From d6d9b4c4833164634057295c5c56f5acd5122556 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Fri, 15 May 2026 15:58:46 -0400 Subject: [PATCH] Add skill support for other coding agents and add new release skill --- .../skills/debug-test-failures/SKILL.md | 0 .../references/common-bug-patterns.md | 0 .../references/patching-workflow.md | 0 .../references/stack-trace-techniques.md | 0 .agents/skills/sleigh-ghidra-release/SKILL.md | 67 ++++++++++++++++ .../sleigh-ghidra-release/agents/openai.yaml | 4 + .../references/release-checklist.md | 78 +++++++++++++++++++ .claude/skills | 1 + 8 files changed, 150 insertions(+) rename {.claude => .agents}/skills/debug-test-failures/SKILL.md (100%) rename {.claude => .agents}/skills/debug-test-failures/references/common-bug-patterns.md (100%) rename {.claude => .agents}/skills/debug-test-failures/references/patching-workflow.md (100%) rename {.claude => .agents}/skills/debug-test-failures/references/stack-trace-techniques.md (100%) create mode 100644 .agents/skills/sleigh-ghidra-release/SKILL.md create mode 100644 .agents/skills/sleigh-ghidra-release/agents/openai.yaml create mode 100644 .agents/skills/sleigh-ghidra-release/references/release-checklist.md create mode 120000 .claude/skills diff --git a/.claude/skills/debug-test-failures/SKILL.md b/.agents/skills/debug-test-failures/SKILL.md similarity index 100% rename from .claude/skills/debug-test-failures/SKILL.md rename to .agents/skills/debug-test-failures/SKILL.md diff --git a/.claude/skills/debug-test-failures/references/common-bug-patterns.md b/.agents/skills/debug-test-failures/references/common-bug-patterns.md similarity index 100% rename from .claude/skills/debug-test-failures/references/common-bug-patterns.md rename to .agents/skills/debug-test-failures/references/common-bug-patterns.md diff --git a/.claude/skills/debug-test-failures/references/patching-workflow.md b/.agents/skills/debug-test-failures/references/patching-workflow.md similarity index 100% rename from .claude/skills/debug-test-failures/references/patching-workflow.md rename to .agents/skills/debug-test-failures/references/patching-workflow.md diff --git a/.claude/skills/debug-test-failures/references/stack-trace-techniques.md b/.agents/skills/debug-test-failures/references/stack-trace-techniques.md similarity index 100% rename from .claude/skills/debug-test-failures/references/stack-trace-techniques.md rename to .agents/skills/debug-test-failures/references/stack-trace-techniques.md diff --git a/.agents/skills/sleigh-ghidra-release/SKILL.md b/.agents/skills/sleigh-ghidra-release/SKILL.md new file mode 100644 index 0000000..30acca3 --- /dev/null +++ b/.agents/skills/sleigh-ghidra-release/SKILL.md @@ -0,0 +1,67 @@ +--- +name: sleigh-ghidra-release +description: Update the lifting-bits/sleigh repository for a new upstream Ghidra stable release. Use when bumping Ghidra stable tags or versions, porting or regenerating src/patches/stable from HEAD patches, updating Ghidra source or spec file lists, moving HEAD-only source/header entries into stable, validating local Ghidra builds, or preparing release-update commits and PRs. +--- + +# Sleigh Ghidra Release + +## Overview + +Update this repository after NSA publishes a new Ghidra release. Prefer the repo's existing release-update shape: verify the upstream tag, reuse `src/ghidra-stable`, regenerate stable patches mechanically from HEAD patches where possible, update CMake lists, and validate with a local build. + +Read [references/release-checklist.md](references/release-checklist.md) when doing the update; it contains the detailed checklist and decision points. + +## Workflow + +1. Inspect state before changing anything: + - Run `git status --short`. + - Treat existing edits and untracked files as user-owned unless the task clearly says otherwise. + - Keep unrelated files out of release-update commits. + +2. Verify the target release: + - Use official upstream sources for release and tag facts. + - Prefer Exa MCP tools for web lookup when available. + - Confirm the tag format, usually `Ghidra__build`. + +3. Prepare `src/ghidra-stable`: + - Use the existing checkout when present. + - If a clone is needed, clone under `src/`. + - Normalize `origin` to HTTPS if the remote uses a local SSH alias: + +```bash +git -C src/ghidra-stable remote set-url origin https://github.com/NationalSecurityAgency/ghidra.git +``` + + - Fetch and check out the release tag: + +```bash +git -C src/ghidra-stable fetch origin tag Ghidra__build --depth=1 +git -C src/ghidra-stable checkout --detach Ghidra__build +git -C src/ghidra-stable config user.name "github-actions[bot]" +git -C src/ghidra-stable config user.email "41898282+github-actions[bot]@users.noreply.github.com" +``` + +4. Regenerate stable patches mechanically: + - Start from a clean `Ghidra__build` checkout. + - Try applying HEAD patches in order. + - If a HEAD patch fails, inspect whether it is already upstreamed, still needed with adjusted context, or only applies to HEAD-only code. Abort and retry with the applicable subset when needed. + - Use `format-patch` from `Ghidra__build..HEAD` to create the new stable patch files. + - Update `src/setup-ghidra-source.cmake` patch ordering to match the regenerated files. + +5. Update release metadata and lists: + - Set `ghidra_version` in `src/setup-ghidra-source.cmake`. + - Search for `sleigh_RELEASE_IS_HEAD`; move entries into stable when the release now contains those sources or headers. + - Update `src/spec_files_stable.cmake` from the release checkout's `.slaspec` inventory. + - Check `cmake/packaging.cmake` and reset `PACKAGE_VERSION` to `1` when the release cycle requires it. + +6. Validate the exact files CMake will use: + - Re-checkout the release tag in `src/ghidra-stable`. + - Apply `src/patches/stable/*.patch`. + - Configure with `FETCHCONTENT_SOURCE_DIR_GHIDRASOURCE` pointing at the local checkout. + - Build with `cmake --build ... --parallel`. + - Run `ctest`; if no developer-mode configure was used, `No tests were found` may be expected. + +7. Review and commit only when asked: + - Use `git diff --cached --stat`, `git diff --cached --name-status`, and `git diff --cached --check`. + - `git diff --check` may flag generated `git format-patch` signature lines; inspect before changing generated patch files. + - Commit messages must follow the repo's 50/72 rule. diff --git a/.agents/skills/sleigh-ghidra-release/agents/openai.yaml b/.agents/skills/sleigh-ghidra-release/agents/openai.yaml new file mode 100644 index 0000000..2207a07 --- /dev/null +++ b/.agents/skills/sleigh-ghidra-release/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Sleigh Ghidra Release" + short_description: "Update Sleigh for new Ghidra releases" + default_prompt: "Use $sleigh-ghidra-release to update this repo for a new upstream Ghidra release." diff --git a/.agents/skills/sleigh-ghidra-release/references/release-checklist.md b/.agents/skills/sleigh-ghidra-release/references/release-checklist.md new file mode 100644 index 0000000..ae5bc24 --- /dev/null +++ b/.agents/skills/sleigh-ghidra-release/references/release-checklist.md @@ -0,0 +1,78 @@ +# Release Update Checklist + +This checklist is based on the repository wiki page: +https://github.com/lifting-bits/sleigh/wiki/New-Ghidra-Release-Update-Checklist + +## Files To Check + +- `src/setup-ghidra-source.cmake`: stable version, stable patch list, HEAD pin, source lists. +- `src/patches/stable/`: regenerated patches for the stable Ghidra tag. +- `src/patches/HEAD/`: source patches to port to the new stable release. +- `src/spec_files_stable.cmake`: stable `.slaspec` inventory. +- `src/spec_files_HEAD.cmake`: comparison point for new spec files. +- `CMakeLists.txt`: public Ghidra headers copied into the build include directory. +- `cmake/packaging.cmake`: package version reset when relevant. + +## Patch Regeneration + +Preferred pattern: + +```bash +git -C src/ghidra-stable checkout --detach Ghidra__build +git -C src/ghidra-stable am --ignore-space-change --ignore-whitespace --no-gpg-sign \ + /absolute/path/to/src/patches/HEAD/*.patch +git -C src/ghidra-stable format-patch -o /private/tmp/sleigh-ghidra-stable-patches \ + Ghidra__build..HEAD +``` + +If a patch fails: + +- Run `git -C src/ghidra-stable am --abort`. +- Inspect the failed patch and the target source. +- Decide whether the patch is already upstreamed, still needed with refreshed context, or only applicable to HEAD-only code. +- Reapply the exact applicable patch sequence or subset. +- Regenerate stable patches from the resulting commits; avoid hand-editing patch bodies unless conflict resolution requires it. + +## Source And Header Lists + +Find HEAD-only gates: + +```bash +rg -n "sleigh_RELEASE_IS_HEAD|sleigh_RELEASE_TYPE.*HEAD" \ + CMakeLists.txt src cmake support tests +``` + +When a previously HEAD-only file exists in the new stable release, move it to the normal stable list and leave no dead conditional branch unless the branch still has a purpose. + +## Spec Files + +Build the stable inventory from the release checkout: + +```bash +fd -e slaspec . src/ghidra-stable/Ghidra/Processors +``` + +Update `src/spec_files_stable.cmake` with sorted +`${ghidrasource_SOURCE_DIR}/...` entries. Compare against both the old stable +list and `src/spec_files_HEAD.cmake`. + +## Validation + +Verify the generated stable patch files directly: + +```bash +git -C src/ghidra-stable checkout --detach Ghidra__build +git -C src/ghidra-stable am --ignore-space-change --ignore-whitespace --no-gpg-sign \ + /absolute/path/to/src/patches/stable/*.patch +``` + +Then configure and build Sleigh against the local checkout: + +```bash +cmake -B build/ghidra--local -S . \ + -DFETCHCONTENT_SOURCE_DIR_GHIDRASOURCE=/absolute/path/to/src/ghidra-stable +cmake --build build/ghidra--local --parallel +ctest --test-dir build/ghidra--local --output-on-failure +``` + +If tests matter for the update, use a developer-mode preset or option. A plain configure may not register tests. diff --git a/.claude/skills b/.claude/skills new file mode 120000 index 0000000..2b7a412 --- /dev/null +++ b/.claude/skills @@ -0,0 +1 @@ +../.agents/skills \ No newline at end of file