diff --git a/.claude/skills/port-pr/SKILL.md b/.claude/skills/port-pr/SKILL.md index 4fe0b391..dcd3eb04 100644 --- a/.claude/skills/port-pr/SKILL.md +++ b/.claude/skills/port-pr/SKILL.md @@ -32,14 +32,17 @@ gh issue view --json title,body,labels ## Step 2 — Understand the source change ```bash -gh pr view --repo sillsdev/machine --json title,body,files,commits +gh pr view --repo sillsdev/machine --json title,body,files,commits,mergeCommit gh pr diff --repo sillsdev/machine ``` -Read the full diff. For each changed C# file, open the corresponding file(s) in -`../machine` to understand the surrounding context, and identify the Python counterpart -(see mapping below). Read the existing Python code you're about to change so the port -matches local idiom. +Read the full diff. For each changed C# file, read the corresponding file(s) in +`../machine` as of the merge commit, with `git -C ../machine show :`, +to understand the surrounding context. The working tree may have moved on since the PR +merged. First check the commit with `git -C ../machine cat-file -e `. If it +fails, the clone predates the merge: run `git -C ../machine fetch`. Identify the Python +counterpart (see mapping below). Read the existing Python code you're about to change so +the port matches local idiom. Note: not every change ports. Skip C#-only concerns (`.csproj`/`.sln`/`Directory.*.props`, `AssemblyInfo`, `omnisharp.json`, csharpier/editorconfig formatting, NuGet packaging). diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 7a4cfd18..dee8cc3e 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -70,6 +70,11 @@ jobs: - name: Install dependencies run: poetry install --no-interaction --all-extras + # port-pr reads the C# source from a sibling clone, as of each source PR's merge + # commit, so it needs full history. Outside the workspace, black and flake8 skip it. + - name: Clone sillsdev/machine + run: git clone https://github.com/sillsdev/machine.git ../machine + - name: Run Claude Code id: claude uses: anthropics/claude-code-action@v1 @@ -83,7 +88,8 @@ jobs: # The action's own prompt ends an issue run with a "Create a PR" link; the # appended prompt has Claude open the pull request itself. claude_args: >- - --allowedTools "Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh issue view:*),Bash(git log:*),Bash(git blame:*),Bash(git show:*),Bash(git diff:*),Bash(git status:*),Bash(poetry run:*),Bash(./local_check.sh:*)" + --add-dir ../machine + --allowedTools "Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh issue view:*),Bash(git log:*),Bash(git blame:*),Bash(git show:*),Bash(git diff:*),Bash(git status:*),Bash(git -C ../machine show:*),Bash(git -C ../machine cat-file:*),Bash(git -C ../machine log:*),Bash(git -C ../machine blame:*),Bash(poetry run:*),Bash(./local_check.sh:*)" --append-system-prompt "When invoked on an issue and you change code, open the pull request yourself once your commits are pushed: gh pr create --base main --head . Post its link in your comment in place of a Create a PR link. Write the title and body with the pr-authoring skill, and put Closes # in the body. Before opening it, run ./local_check.sh --agent-strict and report its result in the body. Dependencies are already installed, and you work on the branch this action created: where a skill such as port-pr says to install, create or switch branches, or push, commit on the current branch and push it the way these instructions say." # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md # or https://code.claude.com/docs/en/cli-reference for available options