From 3f5484e8b14d5bd7bc6dfa49c07d72d718939abf Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Wed, 4 Nov 2026 09:35:10 -0500 Subject: [PATCH] feat(gt-usage): establish gt CLI prerequisite and reference skill - add gt capability preflight check to install.sh - author skills/gt-usage/SKILL.md (<= 80 lines) and reference docs - document sovereign SSH port 2223 convention in profile/AGENTS.md - register gt-usage in ACTIVE_PORTABLE_SKILLS and README.md Closes #9 --- README.md | 1 + install.sh | 29 +++++- profile/AGENTS.md | 2 + skills/gt-usage/SKILL.md | 45 ++++++++++ skills/gt-usage/references/commands.md | 88 +++++++++++++++++++ .../references/instance-conventions.md | 37 ++++++++ 6 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 skills/gt-usage/SKILL.md create mode 100644 skills/gt-usage/references/commands.md create mode 100644 skills/gt-usage/references/instance-conventions.md diff --git a/README.md b/README.md index 50d4d29..dd709c5 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ Every skill features an explicit **"Your call"** checkpoint where the agent paus | **[`gitea-plan`](skills/gitea-plan/SKILL.md)** | `/gitea-plan` | Translates technical goals and plans into Gitea milestones and issues with tiered sizing and falsifiable acceptance criteria. | 54 lines | | **[`implement-slice`](skills/implement-slice/SKILL.md)** | `/implement-slice` | Orchestrates end-to-end delivery of an issue or vertical slice across worker and QA subagents, pre-committed rubrics, and final-HEAD gates without editing code directly. | 44 lines | | **[`gitea-pr`](skills/gitea-pr/SKILL.md)** | `/gitea-pr` | Manages Gitea pull request lifecycle: branch readiness, review/verification synthesis, issue closing, and merge readiness. | 60 lines | +| **[`gt-usage`](skills/gt-usage/SKILL.md)** | `/gt-usage` | Work with Gitea repositories, issues, milestones, projects, and pull requests via the official gt CLI. Verified JSON recipes and anti-hallucination rules. | 44 lines | | **[`document`](skills/document/SKILL.md)** | `/document` | Second-order knowledge classifier (Discussion, ADR, Plan, Debug Record, Knowledge, Journal). User confirms type and provides core insight. | 55 lines | | **[`journal-builder`](skills/journal-builder/SKILL.md)** | `/journal-builder` or `/journal` | Two-phase daily engineering review: generates factual skeleton with question blanks, then reviews and calibrates user reasoning. | 58 lines | | **[`reconcile-docs`](skills/reconcile-docs/SKILL.md)** | `/reconcile-docs [path]` | Reconciles historical evidence, present code reality, and future plans into canonical repo docs (README, ARCHITECTURE, ADR, ROADMAP). | 40 lines | diff --git a/install.sh b/install.sh index 6091cc0..6da0d3c 100755 --- a/install.sh +++ b/install.sh @@ -33,15 +33,42 @@ while [[ $# -gt 0 ]]; do done # Active skills to install -ACTIVE_PORTABLE_SKILLS=(build-skill code-review derive-skill diagnose document git-manager gitea-plan gitea-pr implement-slice inspect-flake-update journal-builder nix-devshell practice reconcile-docs tdd verify-slice) +ACTIVE_PORTABLE_SKILLS=(build-skill code-review derive-skill diagnose document git-manager gitea-plan gitea-pr gt-usage implement-slice inspect-flake-update journal-builder nix-devshell practice reconcile-docs tdd verify-slice) ACTIVE_EXTENSION_SKILLS=(draft-curation) # Legacy / deprecated skills to clean up or back up if found in target OBSOLETE_SKILLS=(engineering-tutor engineering-investigation skill-builder documentation-router inbox-curation commit-logger git-commit git-workspace) OBSOLETE_AGENTS=(anne-droid.md) +check_prerequisites() { + local status=0 + if ! command -v git >/dev/null 2>&1; then + echo " [ERROR] git is required but not found in PATH." >&2 + status=1 + fi + if ! command -v gt >/dev/null 2>&1; then + echo " [WARNING] 'gt' CLI not found in PATH." >&2 + echo " Gitea skills (gt-usage, gitea-plan, gitea-pr, implement-slice) require the official Gitea CLI (v1.0.0+)." >&2 + echo " Install via package manager or download from https://gitea.com/gitea/cli/releases" >&2 + else + local missing_subcommands=() + for sub in issue milestone project pr; do + if ! gt "$sub" --help >/dev/null 2>&1; then + missing_subcommands+=("$sub") + fi + done + if [[ ${#missing_subcommands[@]} -gt 0 ]]; then + echo " [WARNING] 'gt' CLI found but lacks required capabilities: ${missing_subcommands[*]}" >&2 + echo " Update gt to the official release (https://gitea.com/gitea/cli)." >&2 + fi + fi + return "$status" +} + echo "=== Target: $TARGET_DIR (mode: $MODE) ===" +check_prerequisites + if [[ "$CHECK_ONLY" -eq 1 ]]; then echo "Checking installation state..." missing=0 diff --git a/profile/AGENTS.md b/profile/AGENTS.md index e14092b..ec657ff 100644 --- a/profile/AGENTS.md +++ b/profile/AGENTS.md @@ -73,6 +73,8 @@ whether I really understood something), don't make it for me: ## Homelab and connectivity - Sovereign Gitea origin lives at `gitea.roadtotech.me` (hosted on `server-local` at `192.168.1.36`). +- For `gt` (Gitea CLI) repository discovery against sovereign SSH remote on port 2223: + - Run `gt config set ssh_host gitea.roadtotech.me:2223 --host https://gitea.roadtotech.me` so `gt` maps SSH remotes like `ssh://git@gitea.roadtotech.me:2223/...` to `https://gitea.roadtotech.me`. - If `gitea.roadtotech.me` or `roadtotech.me` times out with `dial tcp ...:443: i/o timeout`: - The residential ISP dynamic WAN IP has renewed and public DNS is pointing to an expired IP. - Run `cf-ddns` in bash to automatically sync Cloudflare DNS records with the current public WAN IP. diff --git a/skills/gt-usage/SKILL.md b/skills/gt-usage/SKILL.md new file mode 100644 index 0000000..6eecc95 --- /dev/null +++ b/skills/gt-usage/SKILL.md @@ -0,0 +1,45 @@ +--- +name: gt-usage +description: >- + Work with Gitea repositories, issues, milestones, projects, and pull requests + using the official gt CLI. Use when querying or mutating Gitea entities, + extracting resource identifiers, or configuring instance remotes. +--- + +# Gitea CLI Usage + +## Use when +- Querying, creating, or editing Gitea issues, milestones, project boards, or PRs. +- Extracting exact server identifiers and URLs via JSON output. +- Configuring instance remotes or SSH port mappings for sovereign instances. +- Not for planning or issue decomposition: use `gitea-plan`. +- Not for pull request review synthesis: use `gitea-pr`. + +## Steps +1. **Verify CLI availability and auth.** Run `gt auth status`. If unauthenticated, + guide the user to run `gt auth login` with their instance host and token. +2. **Discover flags and subcommands.** Run `gt --help` to verify local + flag availability before running mutations. +3. **Query with structured JSON.** Always pass `--json ` (or `--jq `) + when reading or creating entities. Never scrape plain terminal tables or guess IDs. +4. **Extract verified server identifiers.** + - Milestones: Query `gt milestone list --json id,title,url` or extract from creation. + - Issues: Query `gt issue list --json number,title,url`. + - Projects: Query `gt project list --json id,title,url`. + - PRs: Query `gt pr list --json number,title,url`. +5. **Format multi-line bodies via files.** Pass issue or PR descriptions via + `-F ` or `-F -` to preserve formatting without shell escaping issues. +6. **Apply instance remotes.** For non-standard SSH ports, configure host mapping + via `gt config set ssh_host : --host `. See + [references/instance-conventions.md](references/instance-conventions.md). + +## Your call +- **Instance authentication**: prompt user if `gt auth status` indicates missing credentials. +- **Entity deletion or closure**: confirm before closing or deleting remote resources. + +## Done when +- Target Gitea entity is created, queried, or updated with confirmed server JSON output. + +## Hands off to +- `gitea-plan`: to decompose technical work into milestones and issues. +- `gitea-pr`: to manage pull request review and merge readiness. diff --git a/skills/gt-usage/references/commands.md b/skills/gt-usage/references/commands.md new file mode 100644 index 0000000..ed6cef1 --- /dev/null +++ b/skills/gt-usage/references/commands.md @@ -0,0 +1,88 @@ +# Verified `gt` CLI Commands & JSON Recipes + +All commands require official `gt` CLI (v1.0.0+). Never guess numeric server identifiers or scrape terminal formatting tables; always query with `--json`. + +## 1. Authentication & Status + +```bash +# Check logged-in status +gt auth status + +# Authenticate with an instance +gt auth login --host +``` + +## 2. Milestones + +Gitea assigns instance-wide auto-incrementing integer IDs to milestones. A repository's first milestone is almost never ID `1`. Always extract `.id` and `.url`. + +```bash +# Create milestone and print server ID and canonical URL +gt milestone create "" -d "<description>" --json id,title,url + +# Create milestone with deadline (format: YYYY-MM-DD) +gt milestone create "<title>" --deadline 2026-12-31 -d "<description>" --json id,title,url + +# List open milestones with verified IDs +gt milestone list --json id,title,state,url + +# View milestone details +gt milestone view <id> +``` + +## 3. Project Boards + +Projects provide spatial Kanban workflow stages. + +```bash +# Create project board with basic kanban columns +gt project create "<title>" --template basic_kanban -d "<description>" --json id,title,url + +# List open projects +gt project list --json id,title,state,url + +# View project cards and columns +gt project view <id> +``` + +## 4. Issues + +```bash +# Create issue attached to milestone and project +gt issue create -t "<title>" -F <body-file> -m <milestone-id> -p <project-id> --json number,title,url + +# List open issues in a milestone +gt issue list -m <milestone-id> --json number,title,state,url + +# Edit issue title, milestone, or body +gt issue edit <number> --title "<new-title>" -m <milestone-id> + +# Close an issue +gt issue close <number> +``` + +## 5. Pull Requests + +```bash +# Create pull request targeting base branch +gt pr create -t "<title>" -F <body-file> --base main --head <branch> --json number,title,url + +# List open PRs +gt pr list --json number,title,state,url + +# View PR details and review status +gt pr view <number> + +# Checkout PR branch locally +gt pr checkout <number> +``` + +## 6. Output Extraction Discipline + +When consuming `gt` output in scripts or skills: +- Use `--json <fields>` to guarantee structured key-value output. +- Use `--jq <expression>` to extract specific scalars without external `jq` dependencies: + ```bash + milestone_id=$(gt milestone create "v1.0" --jq '.id') + issue_url=$(gt issue create -t "Fix bug" -b "Details" --jq '.url') + ``` diff --git a/skills/gt-usage/references/instance-conventions.md b/skills/gt-usage/references/instance-conventions.md new file mode 100644 index 0000000..1832443 --- /dev/null +++ b/skills/gt-usage/references/instance-conventions.md @@ -0,0 +1,37 @@ +# Gitea Instance Conventions & Remote Mapping + +This reference documents generic host targeting, remote discovery, and non-standard SSH port conventions for `gt`. + +## 1. Remote Discovery & Matching + +`gt` discovers the active repository by inspecting `git remote -v`: +- It compares the remote origin URL against configured instance hostnames. +- If the git remote uses HTTPS (e.g. `https://gitea.example.com/owner/repo.git`), discovery matches automatically against authenticated host `https://gitea.example.com`. +- If the git remote uses a custom SSH port (e.g. `ssh://git@gitea.example.com:2223/owner/repo.git`), `gt` will fail remote matching unless `ssh_host` is configured. + +## 2. Non-Standard SSH Port Mapping + +For sovereign or private instances exposing Gitea SSH on a custom port, configure `ssh_host` in `gt` config: + +```bash +# Map custom SSH host and port to the HTTPS instance URL +gt config set ssh_host <ssh-hostname>:<port> --host https://<instance-hostname> +``` + +Example pattern: +```bash +gt config set ssh_host gitea.example.com:2223 --host https://gitea.example.com +``` + +Once configured, `gt` automatically maps `ssh://git@gitea.example.com:2223/...` to `https://gitea.example.com`, eliminating the need to pass `-R owner/repo` on every command. + +## 3. Explicit Repository & Host Targeting + +When running commands outside a cloned repository working tree, or when resolving ambiguity across multiple configured remotes: +- Use `-R, --repo <owner>/<repo>` or full clone URL. +- Use `--host <url>` to target an explicit instance. +- Alternatively, set environment variables `GITEA_HOST` and `GITEA_CLI_REPO`. + +## 4. User Profile Rules vs. Portable Skills + +Instance-specific endpoints, dynamic DNS sync scripts (e.g. `cf-ddns`), internal IP addresses, and private domain names belong strictly in user profile rules (`profile/AGENTS.md` or gitignored configurations). Portable skills remain generic and portable across any Gitea 1.20+ instance.