Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions SKILL.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
---
name: gitcode-issue-fix
description: Use this skill for GitCode-hosted repositories when asked to analyze repository architecture and contribution rules, discover security/functionality/pre-existing bug issues, create GitCode issues with gitcode-cli/gc, fix issues, submit pull requests, or repair PR CI failures while following project contribution guidelines.
description: Use this skill for GitCode-hosted repositories when asked to analyze repository architecture and contribution rules, discover security/functionality/pre-existing bug issues, create GitCode issues with gitcode-cli, fix issues, submit pull requests, or repair PR CI failures while following project contribution guidelines.
---

# GitCode Issue Fix

## Overview

Use this skill for a full GitCode open-source contribution loop: understand the repository, generate a repository architecture and contribution-rules Markdown profile, identify candidate issues, file issues with `gc`, implement minimal fixes, open/update PRs, and drive local/remote CI to green.
Use this skill for a full GitCode open-source contribution loop: understand the repository, generate a repository architecture and contribution-rules Markdown profile, identify candidate issues, file issues with `gitcode`, implement minimal fixes, open/update PRs, and drive local/remote CI to green.

Use the GitCode CLI as `gc`. If only `gitcode` or `gitcode-cli` exists locally, inspect its `--help` and adapt commands.
Use the GitCode CLI as `gitcode`/`gitcode.exe` by default. On Windows PowerShell, do not use bare `gc` because it is a built-in alias for `Get-Content`; use `gitcode.exe`, `gc.exe`, or `python -m gc_cli` instead. Inspect `gitcode <subcommand> --help` and adapt commands if flags differ.

## Required First Step

Before proposing issues or editing code:

1. Preserve local work: run `git status --short`, `git branch --show-current`, and `git remote -v`.
2. Read repository rules: `AGENTS.md`, `CONTRIBUTING*`, `SECURITY*`, `.gitcode/PULL_REQUEST_TEMPLATE*`, `.gitcode/ISSUE_TEMPLATE*`, `.gitcode/workflows/`, `.pre-commit-config.yaml`, build/test configs, and language manifests.
3. Generate or refresh a repository profile Markdown:
- `python "<skill>/scripts/generate_repo_profile.py" --repo "." --output "docs/architecture-and-contribution-rules.md"`
- If the repo has another docs convention, choose the nearest existing docs path.
4. Read `references/gitcode-cli-workflow.md` before using `gc`.
5. Read `references/pr-quality-gate.md` before committing, pushing, or opening a PR.

For work that may sprawl across files, or when discovering new engineering issues, read
`references/scope-and-archetypes.md` for the minimal-change scope guard and common issue archetypes.
3. Generate or refresh a repository profile Markdown:
- `python "<skill>/scripts/generate_repo_profile.py" --repo "." --output "docs/architecture-and-contribution-rules.md"`
- If the repo has another docs convention, choose the nearest existing docs path.
4. Read `references/gitcode-cli-workflow.md` before using `gitcode`.
5. Read `references/pr-quality-gate.md` before committing, pushing, or opening a PR.
For work that may sprawl across files, or when discovering new engineering issues, read
`references/scope-and-archetypes.md` for the minimal-change scope guard and common issue archetypes.

## Issue Discovery

Expand Down Expand Up @@ -56,16 +56,14 @@ Use repository templates when present. For this common GitCode layout:
Prefer body files to avoid shell quoting mistakes:

```bash
gc issue create -R <owner>/<repo> --title "<template prefix>: <summary>" --body-file <issue-body.md> --label <label>
gitcode issue create -R <owner>/<repo> --title "<template prefix>: <summary>" --body-file <issue-body.md> --label <label>
```

If the installed `gc` version does not support `--body-file`, pass a short `--body` value or use the GitCode API while preserving the same issue content.

After creating an issue, comment `/assign @yourself` only if the project workflow asks contributors to self-assign and you intend to fix it.

## Fix Workflow

1. Fetch issue metadata with `gc issue view <number> -R <owner>/<repo> --comments` and search linked PRs with `gc issue prs <number> -R <owner>/<repo>`.
1. Fetch issue metadata with `gitcode issue view <number> -R <owner>/<repo> --comments` and search linked PRs with `gitcode issue prs <number> -R <owner>/<repo>`.
2. Classify:
- `skip`: closed, duplicate, already fixed, active maintainer owner, or outside repo scope.
- `needs-info`: missing reproduction, design decision needed, hardware/private data required with no local proxy.
Expand All @@ -75,15 +73,15 @@ After creating an issue, comment `/assign @yourself` only if the project workflo
5. Add or update focused regression tests where practical. If hardware is required, add deterministic static/unit/docs validation that CI can still review.
6. Run the quality gate. Record exact commands and results.
7. Commit using project style and required trailers. Use sign-off only if the project requires it.
8. Push to a fork and create a PR with `gc pr create`, filling the project PR template and linking the issue.
8. Push to a fork and create a PR with `gitcode pr create`, filling the project PR template and linking the issue.

## PR and CI Workflow

Use `gc pr test <number> -R <owner>/<repo>` when the project supports explicit PR test triggering. For projects that use bot comments such as `compile`, follow the contribution guide and comment only after local validation passes.
Use `gitcode pr test <number> -R <owner>/<repo>` when the project supports explicit PR test triggering. For projects that use bot comments such as `compile`, follow the contribution guide and comment only after local validation passes.

When CI fails:

1. Inspect PR details and comments: `gc pr view <number> -R <owner>/<repo> --comments`, `gc pr comments <number> -R <owner>/<repo>`.
1. Inspect PR details and comments: `gitcode pr view <number> -R <owner>/<repo> --comments`, `gitcode pr comments <number> -R <owner>/<repo>`.
2. Classify failures: lint/format, build, unit test, docs, permission gate, hardware gate, flaky/environmental, or reviewer feedback.
3. Fix only failures caused by the PR. Do not hide failures by deleting tests, weakening assertions, or bypassing checks unless the check is demonstrably wrong.
4. Re-run the closest local equivalent before pushing.
Expand Down
44 changes: 23 additions & 21 deletions references/gitcode-cli-workflow.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# GitCode CLI Workflow

Use `gc` for GitCode issue, PR, repository, and auth operations. Verify current command flags with `gc <subcommand> --help` if a command fails.
Use `gitcode` for GitCode issue, PR, repository, and auth operations. Verify current command flags with `gitcode <subcommand> --help` if a command fails.

On Windows PowerShell, avoid bare `gc` because PowerShell aliases it to `Get-Content`. Use `gitcode.exe`, `gc.exe`, or `python -m gc_cli`.

## Install and Auth

Common install paths:

```bash
pip install gitcode-cli
gc auth login
gc auth status
python -m pip install -U gitcode-cli
gitcode auth login
gitcode auth status
```

Token environment variables are commonly supported:
Expand All @@ -23,7 +25,7 @@ On Windows PowerShell:

```powershell
$env:GC_TOKEN="<token>"
gc auth status
gitcode.exe auth status
```

## Repository Preflight
Expand All @@ -32,40 +34,40 @@ gc auth status
git status --short
git branch --show-current
git remote -v
gc auth status
gc repo view <owner>/<repo>
gitcode auth status
gitcode repo view <owner>/<repo>
```

Infer `<owner>/<repo>` from the Git remote. For `https://gitcode.com/cann/ops-math.git`, use `cann/ops-math`.

## Issue Commands

```bash
gc issue list -R <owner>/<repo> --state open --limit 20
gc issue list -R <owner>/<repo> --state open --search "<keyword>"
gc issue view <number> -R <owner>/<repo> --comments
gc issue prs <number> -R <owner>/<repo>
gc issue create -R <owner>/<repo> --title "<title>" --body-file <body.md> --label <label>
gc issue comment <number> -R <owner>/<repo> --body "/assign @yourself"
gitcode issue list -R <owner>/<repo> --state open --limit 20
gitcode issue list -R <owner>/<repo> --state open --search "<keyword>"
gitcode issue view <number> -R <owner>/<repo> --comments
gitcode issue prs <number> -R <owner>/<repo>
gitcode issue create -R <owner>/<repo> --title "<title>" --body-file <body.md> --label <label>
gitcode issue comment <number> -R <owner>/<repo> --body "/assign @yourself"
```

Prefer `--body-file` for generated issue bodies.

## PR Commands

```bash
gc repo fork <owner>/<repo>
gitcode repo fork <owner>/<repo>
git switch -c codex/issue-<number>-<slug> <upstream>/<base>
git push -u <fork-remote> codex/issue-<number>-<slug>
gc pr create -R <owner>/<repo> --fork <fork-owner>/<repo> --head codex/issue-<number>-<slug> --base <base> --title "<title>" --body-file <body.md>
gc pr view <number> -R <owner>/<repo> --comments
gc pr diff <number> -R <owner>/<repo>
gc pr comments <number> -R <owner>/<repo>
gc pr test <number> -R <owner>/<repo>
gc pr edit <number> -R <owner>/<repo> --body-file <body.md>
gitcode pr create -R <owner>/<repo> --fork <fork-owner>/<repo> --head codex/issue-<number>-<slug> --base <base> --title "<title>" --body-file <body.md>
gitcode pr view <number> -R <owner>/<repo> --comments
gitcode pr diff <number> -R <owner>/<repo>
gitcode pr comments <number> -R <owner>/<repo>
gitcode pr test <number> -R <owner>/<repo>
gitcode pr edit <number> -R <owner>/<repo> --body-file <body.md>
```

If `--body-file` or `--fork` is not supported by the installed version, inspect `gc pr create --help`. Fall back to a temporary text body or a manual handoff generated by `scripts/generate_pr_report.py`.
If a flag is not supported by the installed version, upgrade with `python -m pip install -U gitcode-cli` and inspect `gitcode pr create --help`. Fall back to a temporary text body or a manual handoff generated by `scripts/generate_pr_report.py`.

## GitCode Community Conventions

Expand Down
6 changes: 3 additions & 3 deletions references/pr-quality-gate.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ Use the repository template. Include:
After opening a PR:

```bash
gc pr view <number> -R <owner>/<repo> --comments
gc pr test <number> -R <owner>/<repo>
gc pr comments <number> -R <owner>/<repo>
gitcode pr view <number> -R <owner>/<repo> --comments
gitcode pr test <number> -R <owner>/<repo>
gitcode pr comments <number> -R <owner>/<repo>
```

If checks are blocked by maintainer permission, missing hardware, or new-contributor gates, leave a concise comment with local validation and the exact gate. Do not repeatedly push without a code or metadata change.