Files
skills/skills/gt-usage/references/commands.md
T
kiskaadee 3767cbb383 feat(implement-slice,gt-usage): log lock-free elapsed issue time via POST .../times
- skills/gt-usage/references/commands.md: add POST /repos/{owner}/{repo}/issues/<issue-index>/times recipe for lock-free duration logging

- skills/implement-slice/SKILL.md & references/handoff-contracts.md: record started_at=$(date +%s) at Step 4 (Ready -> Work in Progress) and log elapsed seconds at Step 7 (Work in Progress -> Review), avoiding Gitea's single-user stopwatch/start lock

- tests/fixtures/test_skills_behavioral_contracts.py: assert lock-free POST .../times tracking in gt-usage and implement-slice
2026-11-18 22:19:52 -05:00

4.4 KiB

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

# Check logged-in status
gt auth status

# Authenticate with an instance
gt auth login --host <https-instance-url>

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.

# Create milestone and print server ID and canonical URL
gt milestone create "<title>" -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 (Backlog, Ready, Work in Progress, Review, Completed).

# Create repository project board without default template columns (to provision canonical 5-column pipeline)
gt project create "<title>" --template none -d "<description>" --json id,title,url

# Create organization-level project board
gt project create "<title>" --org <org> --template none -d "<description>" --json id,title,url

# List open projects (repository or organization)
gt project list --json id,title,state,url
gt project list --org <org> --json id,title,state,url

# View project details
gt project view <id> --json id,title,state,url
gt project view <id> --org <org> --json id,title,state,url

# List board columns with IDs, titles, sorting order, default flag, and hex colors
# (For org boards, replace /repos/{owner}/{repo} with /orgs/<org>)
gt api /repos/{owner}/{repo}/projects/<project-id>/columns --jq '.[] | {id, title, sorting, default, color}'

# Create a column with title and 6-digit hex color
gt api -X POST /repos/{owner}/{repo}/projects/<project-id>/columns \
  -f title="<title>" -f color="#<RRGGBB>" --jq '{id, title, color, sorting}'

# Update an existing column in place (preserving attached cards)
gt api -X PATCH /repos/{owner}/{repo}/projects/<project-id>/columns/<column-id> \
  -f title="<title>" -f color="#<RRGGBB>" -F sorting=<0..4> --jq '{id, title, color, sorting}'

# Mark a column as the default column for newly attached issues
gt api -X POST /repos/{owner}/{repo}/projects/<project-id>/columns/<column-id>/default

# List cards (issues/PRs) currently in a column
gt api /repos/{owner}/{repo}/projects/<project-id>/columns/<column-id>/issues --jq '.[] | {id, number, title, state}'

# Move issue card between columns (requires global issue ID from `gt issue view <number> --json id,number`)
gt api -X POST /repos/{owner}/{repo}/projects/<project-id>/issues/<global-issue-id>/move -F column_id=<target-col-id>

4. Issues

# 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

# Add an existing issue in a child repo to an organization project
gt issue edit <number> -R <owner/repo> --add-project <project-id>

# List open issues with global IDs and numbers
gt issue list --json id,number,title,state,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>

# Log elapsed implementation time (seconds) to an issue without a global stopwatch lock
gt api -X POST /repos/{owner}/{repo}/issues/<issue-index>/times -F time=<seconds>

5. Pull Requests

# 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:
    milestone_id=$(gt milestone create "v1.0" --jq '.id')
    issue_url=$(gt issue create -t "Fix bug" -b "Details" --jq '.url')