Skip to content

feat: build standalone Agent Skills zips for Agensi - #80

Open
forkni wants to merge 19 commits into
developmentfrom
feat/agensi-skill-zips
Open

forkni wants to merge 19 commits into
developmentfrom
feat/agensi-skill-zips

Conversation

@forkni

@forkni forkni commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Before: the toolkit installs only as a Claude Code skill. The hooks, slash command and .claude/ paths are part of that install, so it can't be listed as a portable Agent Skill that any agent reading SKILL.md can load.

After: bash scripts/dev/build_agensi.sh builds three self-contained skill zips into dist/agensi/ (gitignored): gitignore-and-local-config, git-merge-conflict-resolution and safe-git-workflow. Each zip holds one <name>/SKILL.md folder that uses only name and description frontmatter, so the same zip works in Claude Code, Codex, Cursor, Copilot and other agents.

The two knowledge-only skills ship a SKILL.md and edited copies of their canonical references. safe-git-workflow ships 25 scripts, 5 references and assets/cgw.conf.example, with ./scripts/git/ paths rewritten to <skill-dir>/scripts/. Its packaged _config.sh defaults CGW_MARKDOWNLINT_NPX_FALLBACK to 0, so a downloaded skill never fetches an npm package on its own.

How: agensi/ holds the sources and a README that covers the build, its checks and the portable copies to keep in sync.

The build drops sections about scripts it doesn't ship, points links to unshipped references at their GitHub copies, and normalises permissions. It fails on any of these:

  • bad frontmatter
  • Claude Code-only terms
  • a broken link
  • a documented script that doesn't ship
  • a script that fails bash -n
  • a skill name that isn't in --list (checked before any output or delete)

It also lists commonly scanned patterns for a human to review.

A separate commit adds cgw_rm_tmpdir to _lib_lint.sh. The helper only deletes cgw-* temp directories, and the lint temp-dir deletes in _lib_lint.sh and check_lint.sh now go through it. It has 3 unit tests.

Kept current with development through v0.26.2 and the Dec 2 log-folder and fixup-subject changes:

  • development is merged in.
  • The changelog entries sit under an Unreleased section above the released versions.
  • The portable safe-git-workflow SKILL.md notes that undo_last.sh amend-message now applies the subject hard cap and, with --non-interactive, refuses a non-conventional message.
  • Its commit-format section lists the build:, ci: and revert: types that v0.23.3 added to commit_enhanced.sh.
  • v0.24.0 documents branch_switch.sh in wrapper-recipes.md, which the skill ships, so the build's documented-script check failed. The script needs only _common.sh, so safe-git-workflow now ships it and lists it in its operations table.
  • The index.lock fix in _lib_lock.sh rides in the shipped copy; the configure.sh and sync_cgw_tooling.sh fixes are in scripts the zips don't ship.
  • The commit-body flags (--body, --body-file) are documented in the skill's commit-format section and flags table.
  • The skill now notes that fixup!, squash! and amend! subjects pass, and that a fixup commit is folded with rebase_safe.sh --autosquash before it reaches a shared branch. The pre-push hook part is left out, since the zip doesn't ship hooks.
  • CGW_LOG_DIR and the v0.26.x script fixes ride in the shipped scripts and the copied script-reference.md. create_pr.sh (v0.25.0) isn't shipped.
  • The other v0.23.x changes need no skill text: worktree_manage.sh and merge_pr.sh aren't shipped, the typecheck and hook-compare changes ride in the shipped _lib_lint.sh, _config.sh and _common.sh, and the skill description changes are to skill/SKILL.md, which the build doesn't read.
  • The canonical references copied by the two knowledge-only skills are unchanged since the split.

Testing: tests/integration/build_agensi.bats has 7 tests. They build every skill, check each zip's layout and the packaged config, and run the packaged commit_enhanced.sh against a scratch repo. tests/integration/build_agensi_args.bats has 6 tests for rejected skill names.

On the current tree, these pass locally:

  • the build
  • all unit tests plus both build_agensi files
  • the skip ratchet

CI runs the full set on this PR.


Generated by Claude Code

The lint pipeline had two bare recursive deletes of mktemp directories,
in cgw_snapshot_tree and check_lint.sh's snapshot cleanup. A new
cgw_rm_tmpdir helper is now the only one: it deletes nothing unless the
path is an existing directory named cgw-*, so an empty or wrong
variable can never widen the delete. Marketplace scanners flag bare
recursive deletes, and the standalone skill zips ship these files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds three portable skills under agensi/ (gitignore-and-local-config,
git-merge-conflict-resolution, safe-git-workflow) and
scripts/dev/build_agensi.sh, which packages each into dist/agensi/<name>.zip
with skill-relative script paths, drops sections for scripts it does not ship,
defaults the packaged npx markdownlint fallback to off, and fails on
frontmatter, portability, link and script checks.

tests/integration/build_agensi.bats builds every skill and runs the packaged
commit_enhanced.sh against a scratch repo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The skip-ratchet check (tests/check_skipped_bats.sh) counts any line that
starts with `skip` as unconditional, so the if/fi form failed Validate Branch
State. Use the `cond || skip` form the other suites use; behaviour is the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merging development carried them into the released v0.22.2 section,
which shipped without them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.22.0 made undo_last.sh amend-message apply the subject hard cap and
refuse a non-conventional message under --non-interactive. Say so in the
portable skill's commit-format and undo guidance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@jessesep jessesep left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: do not merge until skill names are validated before deletion.

PR #80 forkni/claude-git-workflow, 15 files, base main.

Blocking - a skill argument can delete the output directory's parent.

_build_one() only checks whether agensi/<name> exists before passing the name to rm -rf.
The name .. passes that check, so --out <dir> .. requests deletion of <dir>/...
That can remove the repository or unrelated files, depending on the output path.

Fix: reject every selected name not in ALL_SKILLS before creating output or deleting anything.

Checked: full 15-file diff and pinned build script; an isolated run intercepted rm and confirmed its parent-directory target.

The intercepted command returned97 and stopped the script before deletion.
No real deletion or package upload was executed; the full packaging suite was not rerun.

@forkni

forkni commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Thanks for the review. The finding is correct. The fix is in 6c05156, and CI is green on it.

Cause. build_agensi.sh checked a skill name only with [[ -d agensi/<name> ]] and then ran rm -rf on <out>/<name>. Any name that resolves to a directory under agensi/ passed that check.

What I reproduced. With a stub zip, so the test runs without the real tool:

  • An empty name deleted the whole output directory.
  • ../scripts deleted a sibling of the output directory.
  • A rejected name still left the output directory behind, because mkdir -p ran before the first name was checked.

A bare .. did not delete anything in my run. GNU rm refuses a path whose last component is .. or .. So the parent-directory case in the review is not reachable on GNU rm. The other cases above are, and one check covers all of them.

Fix.

  • Each selected name is now compared exactly against ALL_SKILLS right after argument parsing. This happens before mkdir and before any delete.
  • A name that is not in --list exits 1 with [ERROR] unknown skill: '<name>' (see --list).
  • _build_one repeats the same check before its rm.
  • agensi/README.md now states this.

Test. The new tests/integration/build_agensi_args.bats has 6 cases: .., ., an empty name, safe-git-workflow/.., ../scripts, and a valid name next to a bad one. Before the fix, 3 of them failed on real damage and 3 on the missing error message. After the fix, all 6 pass.

A note on the review text: the base branch of this PR is development, not main.

@jessesep jessesep left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE — the unsafe-delete blocker is fixed.

PR #80 packages three existing Git skills; base is the default branch, main.
The earlier review covered all 15 files; this review covers all three changed files since that review.
The base is unchanged, so the earlier duplicate-work check still applies.

Resolved: unsafe skill names are rejected before any output or deletion.
Every selected name must exactly match the shipped skill list, with a second check inside the builder.
A bad name alongside a valid name also stops the entire build before output creation.

Verified: six isolated negative cases pass on this head and fail on the previous head.
Deletion was intercepted throughout those comparisons; no real deletion occurred.
All three archives built from exact, pinned source inputs and passed ZIP integrity and path checks.

All nine GitHub checks are successful on this head.
The Bats executable is unavailable locally; equivalent negative checks ran locally, rather than claiming a local Bats run.
No blocking findings remain in the reviewed diff.

Resolve the CHANGELOG conflict: keep the Agensi entries under Unreleased,
above the new v0.23.1 and v0.23.0 sections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the CHANGELOG conflict: keep the Agensi entries under Unreleased,
above the new v0.23.2 section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the CHANGELOG conflict: keep the Agensi entries under Unreleased,
above the new v0.23.3 section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.23.3 added the three types to commit_enhanced.sh, which the skill ships.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the CHANGELOG conflict: keep the Agensi entries under Unreleased,
above the new v0.24.0 section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.24.0 documents branch_switch.sh in wrapper-recipes.md, which the skill
ships, so the build failed its documented-script check. The script needs
only _common.sh, so the skill now ships it (25 scripts) and lists it in
its operations table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kill-zips

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the CHANGELOG conflict: keep the Agensi entries under Unreleased,
above the new v0.25.0 section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…into feat/agensi-skill-zips

Resolve the CHANGELOG conflict: keep the Agensi entries under Unreleased,
above v0.25.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…flow

The skill ships commit_enhanced.sh, which now takes the body as flags.
Add both to the flags table and a short note to the commit-format section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…si-skill-zips

Resolve the CHANGELOG conflict: keep the Agensi entries under Unreleased,
above v0.26.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kflow

Mirror the autosquash rule from the canonical skill, without the pre-push
hook, which the Agensi zip does not ship.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants