@a2f0/agent-tool 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,440 +1,70 @@
1
1
  # agent-tool
2
2
 
3
- A CLI for independent agent code reviews, guarded GitHub PR operations, package
4
- version management, and portable skills for Claude Code, Codex, and OpenCode.
5
-
6
- - **Review** a committed branch with a different agent than the one that wrote
7
- it, using a pinned, read-only snapshot.
8
- - **Ship** pull requests: open them, check CI, and squash-merge only the exact
9
- reviewed commit.
10
- - **Version** packages: bump changed packages against an exact base and keep
11
- `bun.lock` in sync.
12
- - **Share skills**: install the same workflow instructions where each harness
13
- discovers them, and check them in CI.
14
- - **Render brand images**: build app icons, splash screens, favicons, and store
15
- graphics from the SVGs in `assets/brand/`, with every size and destination
16
- declared in `agent-tool.json`.
17
- - **Compact output**: run noisy commands with full private logs and bounded
18
- diagnostics, keeping routine output out of an agent's context.
3
+ Shared Git, GitHub, review, validation, and release workflows for repositories
4
+ coordinated by Claude Code, Codex, and OpenCode. Repository policy stays in
5
+ `agent-tool.json`; portable skills coordinate independently reviewed changes.
19
6
 
20
7
  ## Install
21
8
 
22
- ### From npm
23
-
24
9
  ```sh
25
10
  bun add --dev --exact @a2f0/agent-tool
26
- # or
11
+ # npm projects also need Bun on PATH to run the executable:
27
12
  npm install --save-dev --save-exact @a2f0/agent-tool
28
13
  ```
29
14
 
30
- The package ships the TypeScript source and embedded skills, with no install
31
- scripts or build step. Bun runs the executable, so Bun must be on `PATH`
32
- wherever it runs, including npm projects and CI; without it, the shell reports
33
- `env: bun: No such file or directory`.
34
-
35
- Add a script such as `"agent-tool": "agent-tool"` and run
36
- `bun run agent-tool --help`. For a command with an empty positional argument,
37
- invoke `node_modules/.bin/agent-tool` directly, for example
38
- `node_modules/.bin/agent-tool pr merge '' "$REVIEWED_SHA" "$REVIEW_BASE_REF"`.
39
-
40
- To use an unreleased commit, pin its full SHA from GitHub:
41
-
42
- ```json
43
- {
44
- "devDependencies": {
45
- "@a2f0/agent-tool": "github:a2f0/agent-tool#<full-commit-sha>"
46
- }
47
- }
48
- ```
49
-
50
- npm records a GitHub dependency in `package-lock.json` as a `git+ssh` URL, but
51
- `npm ci` installs this public repository without SSH credentials.
52
-
53
- ### Standalone executable
54
-
55
- Bun compiles the CLI and its skills into one executable that needs no Node, Bun,
56
- or npm dependencies at runtime:
15
+ The npm package ships source and embedded skills with no install script. It needs
16
+ Bun 1.3.11 or newer; version preparation needs Bun 1.4 or newer. Git is required,
17
+ and GitHub operations require an authenticated `gh` supporting `pr checks --json`.
18
+ Independent reviews require an authenticated Claude Code, Codex, or OpenCode CLI.
19
+ A compiled standalone executable needs no Bun or Node at runtime.
57
20
 
58
21
  ```sh
59
- bun install --frozen-lockfile
60
- bun run build
61
- ./dist/agent-tool --help
22
+ bun run agent-tool init
23
+ bun run agent-tool skills install --apply
24
+ bun run agent-tool doctor
62
25
  ```
63
26
 
64
- The executable works when copied anywhere. See [Releases](#releases) for
65
- platform archives, a Homebrew formula, and Debian packages.
66
-
67
- ### Requirements
27
+ Add `"agent-tool": "agent-tool"` to package scripts, or invoke
28
+ `node_modules/.bin/agent-tool` directly. Use the direct executable for an empty
29
+ positional argument. Global `--repo <directory>` and `--config <file>` select a
30
+ checkout and explicit policy file. Restart the agent harness after installing
31
+ skills if its discovery cache needs refreshing.
68
32
 
69
- - Git.
70
- - An authenticated GitHub CLI (`gh`) for `pr` commands. `pr merge` needs a
71
- `gh` whose `pr checks` supports `--json`; gh 2.45, still shipped by some
72
- distributions, fails with `unknown flag: --json`.
73
- - An authenticated CLI for each agent you review with: `claude`, `codex`, or
74
- `opencode`.
75
- - Bun 1.3.11 or newer to run the npm package.
76
- - Bun 1.4 or newer on `PATH` for `versions prepare`, with either install,
77
- because it refreshes workspace versions in `bun.lock`.
78
-
79
- Run `agent-tool doctor` to report installed versions and the flags the tool needs
80
- from each CLI, such as `gh pr checks --json` for merging, without calling a model.
81
-
82
- ## Quick start
83
-
84
- These examples call `agent-tool` from `PATH`. With the npm package, use
85
- `bun run agent-tool` or `node_modules/.bin/agent-tool` instead.
86
-
87
- ```sh
88
- # Review the current branch with an independent agent:
89
- agent-tool review codex
90
- # Review another checkout against a local base, without GitHub:
91
- agent-tool --repo ../some-project review opencode high --base main
92
-
93
- # Create project policy, then preview and install the shared skills:
94
- agent-tool init
95
- agent-tool skills install
96
- agent-tool skills install --apply
97
- ```
98
-
99
- ## Commands
100
-
101
- | Command | Behavior |
102
- | --- | --- |
103
- | `run [--label text] [--max-bytes N] [--tail-lines N] -- <command> [args...]` | Run with full local logs and compact results; preserve exit status |
104
- | `logs <file> [--max-bytes N] [--tail-lines N]` | Inspect a bounded, terminal-safe tail of a local file |
105
- | `review claude\|codex\|opencode [effort] [--base ref]` | Review committed HEAD using a pinned raw-file snapshot |
106
- | `pr open [title]` | Open a same-repository PR; body from stdin; branch already pushed |
107
- | `pr merge <subject-or-empty> <head-oid> <base-branch>` | Check CI and synchronously squash the reviewed HEAD |
108
- | `versions plan\|bump\|check <base-oid>` | Plan, rewrite, or check package versions against an exact base |
109
- | `versions prepare <base-oid>` | Bump, refresh `bun.lock`, validate, and commit versions; print a JSON receipt |
110
- | `versions resolve-conflicts` | Resolve only version-field conflicts in configured manifests |
111
- | `dependencies check-terraform-plan <json-file>` | Read-only screening for destructive or incomplete Terraform JSON plans |
112
- | `skills list` | List embedded portable skills |
113
- | `skills install [--harness all\|claude\|codex\|opencode] [--apply]` | Preview by default; install or update managed skills |
114
- | `skills check [--harness all\|claude\|codex\|opencode]` | Read-only CI check for current managed skills |
115
- | `images list [target...]` | List the files each image target writes, without rendering |
116
- | `images build [target...] [--out dir]` | Render image targets from `assets/brand/*.svg`; `--out` redirects one target |
117
- | `init` / `config show` | Create or inspect data-only project policy |
118
- | `doctor` | Inspect local versions and required CLI flags without running a model |
119
-
120
- Global options are `--repo <directory>` and `--config <file>`. Effort accepts
121
- `low`, `medium`, `high`, `xhigh`, and `max`; the default is `xhigh` for Claude
122
- and `high` for Codex and OpenCode. Legacy camelCase action names, listed in
123
- `--help`, remain available. Legacy `squashMerge` also accepts a manual form
124
- without a reviewed HEAD; prefer `pr merge`.
125
-
126
- A successful review exit means a complete review was returned, ending in a
127
- `VERDICT:` line. BLOCKER or MAJOR findings still require action. The review
128
- command does not repair, push, or merge; the shipping skills coordinate that
129
- work.
130
-
131
- ### Compact command output
33
+ ## Normal usage
132
34
 
133
35
  ```sh
36
+ agent-tool branch create chore/maintenance --base main --remote origin
37
+ agent-tool repo context
134
38
  agent-tool run --label tests -- bun test
135
- agent-tool run --label build -- npm run build
136
- agent-tool run --label checks -- sh -c 'npm run lint && npm test'
137
- agent-tool logs /path/from/receipt/output.log --max-bytes 8192 --tail-lines 80
138
- ```
139
-
140
- `run` executes the argv after `--` directly, without a shell, in the current
141
- directory (or `--repo`), with inherited environment and stdin. Use an explicit
142
- shell only when the command needs shell syntax. The child receives regular files
143
- for stdout and stderr, so interactive/TTY programs should run directly. This
144
- works outside Git and does not depend on project policy or a package manager.
145
- Use it for finite commands; long-running servers need their own lifecycle.
146
-
147
- Both streams go directly to one private log: even gigabytes of output do not
148
- accumulate in the runner's memory. On completion, stdout contains one JSON
149
- receipt with `status`, `exitCode`, `signal`, `durationMs`, `outputBytes`, and
150
- `log` (plus an optional label of at most 120 characters). Command arguments and
151
- environment are not copied to the receipt. A success emits no log content;
152
- failure adds a terminal-control-stripped tail on stderr. The default tail is at
153
- most 4096 bytes and 40 lines, with explicit limits up to 65536 bytes and 1000
154
- lines. Limits bound the excerpt after decoding too, including one huge line or
155
- invalid UTF-8; receipt metadata is additional. A command's numeric status is
156
- preserved, missing executables return 127, and other launch failures return 126.
157
- On macOS/Linux, SIGINT, SIGTERM, and SIGHUP are forwarded to the child process
158
- group, with SIGKILL escalation after five seconds; the runner then terminates by
159
- the original signal. Children that create a separate session escape that group;
160
- SIGKILL of the runner cannot be intercepted. The command is not a sandbox.
161
-
162
- Logs live in unique `agent-tool-run-*` directories under the system temporary
163
- directory, with mode 0700 directories and 0600 files. They are retained until you
164
- remove the specific directory reported by the receipt or the OS cleans temporary
165
- files. Remove task logs after investigation; long or repeated commands can use
166
- substantial disk space. There is no automatic age sweep or disk quota. Logs are
167
- complete, raw, and may contain secrets; terminal cleanup is not secret redaction.
168
- `logs` reads any explicitly supplied regular local file, including symlink targets;
169
- it does not authenticate a file as an agent-tool artifact.
170
-
171
- Use bounded log inspection or scoped searches for a failure, required warnings,
172
- coverage, timing assertions, or build artifacts; do not reread successful suite
173
- logs wholesale. Success means the command exited zero, not that its logs contain
174
- no warnings. Keep structured output and decisions visible: run `review`,
175
- `versions prepare`, audit reports, and infrastructure plan guards directly.
176
- Review commands retain full reviewer stderr in separate private
177
- `agent-tool-review-log-*` directories and show bounded stderr on failure, while
178
- always displaying the final findings and verdict. Empty reviewer logs are removed.
179
- The bundled shipping, review, and dependency skills use this distinction.
180
-
181
- ## Configuration
182
-
183
- `agent-tool init` creates `agent-tool.json` and never overwrites an existing
184
- file. Missing settings use defaults; misspelled keys, invalid types, and unknown
185
- schema versions fail before any work begins. `--config <file>` or
186
- `AGENT_TOOL_CONFIG` selects an explicit policy file, for example to review a
187
- feature checkout with policy from a trusted source.
188
-
189
- ```json
190
- {
191
- "schemaVersion": 1,
192
- "subject": { "conventional": true, "maxLength": 50 },
193
- "merge": {
194
- "requiredChecks": [{ "name": "CI gate", "workflow": "CI" }],
195
- "requireStrictBaseFreshness": true
196
- },
197
- "review": {
198
- "claudeModel": null,
199
- "codexModel": null,
200
- "opencodeModel": "deepseek/deepseek-v4-pro",
201
- "opencodeVariants": { "xhigh": "max" },
202
- "timeoutMs": 600000
203
- },
204
- "versions": {
205
- "packages": ["packages/api", "packages/client"],
206
- "bundles": ["packages/client"],
207
- "lockfile": "bun.lock",
208
- "validate": [["bun", "run", "lint", "--", "--staged"]],
209
- "commitMessage": "chore: bump package versions"
210
- },
211
- "pr": { "rejectClaudeBranding": true }
212
- }
213
- ```
214
-
215
- The policy is data only: no commitlint binary or JavaScript config runs.
216
-
217
- - **`subject`**: commit and PR titles default to conventional commits with a
218
- 72-character limit.
219
- - **`merge`**: by default a PR must report at least one check, and every check
220
- must succeed or be skipped. Named required checks must succeed; configure
221
- them before shipping.
222
- - **`review`**: Claude and Codex use their CLI defaults unless a model is set.
223
- Set `opencodeModel` to a model your account supports. `opencodeVariants`
224
- replaces the default effort-to-variant map (`xhigh` to `max`); an effort
225
- level missing from the map is passed to OpenCode unchanged.
226
-
227
- ### Versions
228
-
229
- Version helpers use the configured package directories, or discover committed
230
- `package.json` workspaces when `versions.packages` is null. `.` names the
231
- repository's root package, which then counts as changed when any file changes,
232
- including files in other configured packages. A changed package moves one patch
233
- past the base; a deliberate major or minor bump is kept. `plan`, `bump`, and
234
- `check` neither regenerate lockfiles nor commit.
235
-
236
- `versions.bundles` names versioned packages whose published artifact includes
237
- the workspace packages they depend on. Such a package also counts as changed
238
- when any workspace package it reaches through `workspace:` ranges in
239
- `dependencies` changes, directly or transitively; an alias range such as
240
- `workspace:crypto@*` names its target. `devDependencies` and
241
- `peerDependencies` do not count. A bundled package whose only change is its
242
- version does not move the bundle.
243
-
244
- `versions prepare` runs the whole sequence before a review snapshot:
245
-
246
- 1. It requires a clean worktree on an attached branch with the exact base
247
- already merged.
248
- 2. It rewrites versions and, when `versions.lockfile` is `"bun.lock"` (the
249
- default), runs `bun install --lockfile-only --ignore-scripts`. It then
250
- verifies that `bun.lock` records every workspace version, because Bun before
251
- 1.4 exits successfully without refreshing them. Set `versions.lockfile` to
252
- null for projects without a Bun lockfile.
253
- 3. Each `versions.validate` command runs without a shell against the staged
254
- result. Commands resolve on `PATH` outside the repository.
255
- 4. It commits with `versions.commitMessage`, running the project's commit hooks,
256
- and requires the commit to reproduce the prepared tree.
257
-
258
- On success it prints a JSON receipt with `baseOid`, `startHead`, `headOid`,
259
- `committed`, `lockfileChanged`, and the rewritten `versions`. A failure before
260
- the commit restores the manifests, lockfile, and index, unless HEAD or other
261
- paths changed, in which case it leaves that state for inspection. Repeating
262
- against the same base creates no commit.
263
-
264
- ### Images
265
-
266
- `images` declares named targets of brand images rendered from SVG sources in
267
- `assets/brand/`. Each output names its file, pixel size or variants (such as
268
- Android densities or `@2x`/`@3x`), and the layers composed into it:
269
-
270
- ```json
271
- {
272
- "schemaVersion": 1,
273
- "images": {
274
- "targets": {
275
- "ios": {
276
- "dir": "ios/App/Assets.xcassets",
277
- "outputs": [
278
- {
279
- "path": "AppIcon.appiconset/AppIcon.png",
280
- "size": 1024,
281
- "opaque": true,
282
- "layers": [{ "source": "background", "fit": "cover" }, { "source": "logo", "scale": 0.7 }]
283
- }
284
- ]
285
- }
286
- }
287
- }
288
- }
39
+ agent-tool review claude
40
+ agent-tool branch push <reviewed-head> --remote origin
41
+ agent-tool pr open 'chore: maintain repository' < /tmp/pr-body.txt
42
+ agent-tool pr checks --wait --head <reviewed-head>
43
+ agent-tool pr preflight <reviewed-head> <base-branch> <reviewed-base>
44
+ agent-tool pr merge 'chore: maintain repository' <reviewed-head> <base-branch>
289
45
  ```
290
46
 
291
- `agent-tool images build ios` writes PNG, ICO, SVG, and Android color resource
292
- outputs with a bundled WebAssembly renderer, so builds need no ImageMagick or
293
- librsvg and render identically on every machine. See the
294
- [image reference](docs/images.md) for every setting.
295
-
296
- ## Portable skills
297
-
298
- Canonical skills live in `skills/`. The build embeds them, and the installer
299
- writes the same bytes where each harness discovers them:
300
-
301
- | Target | Project discovery directory |
302
- | --- | --- |
303
- | Claude Code | `.claude/skills` |
304
- | Codex | `.agents/skills` |
305
- | OpenCode alone | `.opencode/skills` |
306
- | All three | `.agents/skills` and `.claude/skills`; OpenCode discovers both |
307
-
308
- Discovery paths follow the [Codex](https://learn.chatgpt.com/docs/build-skills#where-codex-loads-local-skills),
309
- [Claude Code](https://code.claude.com/docs/en/skills), and
310
- [OpenCode](https://opencode.ai/docs/skills/) documentation. Restart the harness
311
- if new skills do not appear. OpenCode may list identical skills from both
312
- paths.
313
-
314
- The bundle provides `cross-agent-review`, `open-pr`, `squash-merge`, `ship-pr`,
315
- `reset`, and `update-dependencies`. They make no package-manager or project-layout
316
- assumptions:
317
-
318
- - Keep validation commands, review-bot rules, and deployment checks in the
319
- project's `AGENTS.md`.
320
- - Keep title and required-check policy in `agent-tool.json`.
321
-
322
- The installer is project-scoped and does not touch global harness settings, MCP
323
- configuration, or authentication. It records ownership in
324
- `.agent-tool-skills.json`, previews changes unless `--apply` is given, and
325
- refuses to overwrite unmanaged files, locally edited skills, or symlinks; there
326
- is no force mode. After updating the dependency, run
327
- `agent-tool skills install --apply` and commit the skills with
328
- `.agent-tool-skills.json`. Run `agent-tool skills check` in hooks and CI; it
329
- fails for missing, outdated, unmanaged, or edited skills without writing
330
- anything. Use the same `--harness` for install and check.
331
-
332
- ### Dependency upgrades
333
-
334
- Invoke `update-dependencies` to upgrade repository-owned dependencies, runtimes,
335
- and tool pins with compatibility checks and safe infrastructure previews.
336
- See the [dependency upgrade guide](docs/dependency-upgrades.md) for advisory
337
- checks, preview limits, the Terraform plan guard, and maintaining upgrade records.
338
-
339
- ## Review guarantees and limits
340
-
341
- Reviews run against exact base and head snapshots. Review policy comes from the
342
- base commit. Files are materialized from raw Git blobs with collision and path
343
- validation, and diffs are text-only without external drivers. Snapshots are
344
- cleaned up, output must end in a verdict, and an incomplete but successful run
345
- is retried once. Helper Git operations disable hooks and replace objects.
346
- Reviewer executables must resolve outside the project, reviews time out, and a
347
- review is rejected if HEAD moves before it returns.
348
-
349
- Each harness runs with its own read-only protections:
350
-
351
- - **Claude**: safe mode and read-only tools.
352
- - **Codex**: an ephemeral session, snapshot-scoped filesystem permissions, no
353
- inherited environment for model commands, hosted web search disabled, and
354
- final-message capture.
355
- - **OpenCode**: a neutral directory, pure mode, and inline permissions that
356
- deny every tool except specific read-only ones.
357
-
358
- Unknown or unsupported CLI flags fail the run instead of silently dropping a
359
- protection. These are harness-level protections, not uniform OS isolation:
360
- Claude and OpenCode rely on their own permission implementations, and every
361
- reviewer runs with local authentication in the host environment. A verdict
362
- shows that a review completed, not that its findings are correct.
363
-
364
- `pr merge` binds the squash to the reviewed HEAD through GitHub's atomic
365
- expected-HEAD check. GitHub has no equivalent expected-base check, so the skills
366
- recheck the base, and repository protection must enforce stricter freshness.
367
- With `merge.requireStrictBaseFreshness`, `pr merge` refuses unless an active
368
- repository ruleset that the authenticated actor cannot bypass requires strict
369
- status checks on the base. Classic branch protection is not inspected. Reviews
370
- can resolve fork PR bases; `pr open` supports same-repository branches.
371
-
372
- ## Development
373
-
374
- Development and build/release workflows use the Bun version pinned in
375
- `.mise.toml` and TypeScript 7.0.2. [mise](https://mise.jdx.dev/) installs the
376
- same Bun version locally and in CI.
377
- The compiler is used through `tsc`; this repository does not depend on its removed
378
- JavaScript compiler API. Runtime consumers still support Bun 1.3.11 or newer;
379
- CI also runs the installed-package smoke and plan-guard tests on that minimum.
380
-
381
- ```sh
382
- mise install
383
- bun install --frozen-lockfile
384
- bun run typecheck
385
- bun test
386
- bun scripts/smoke-package.ts
387
- bun run build
388
- bun scripts/smoke.ts dist/agent-tool
389
- ```
390
-
391
- `bun run build` regenerates `src/skills/bundled.ts` from `skills/*/SKILL.md`;
392
- commit it with skill changes. The package smoke test installs the packed npm
393
- tarball into a temporary project. The compiled smoke test drives all three
394
- review adapters through local stubs with Bun and Node absent from `PATH`, and
395
- makes no model calls. CI runs these checks on Linux and macOS and builds a
396
- Debian package on Linux.
397
-
398
- ## Releases
399
-
400
- ### npm
401
-
402
- `ship-pr` bumps the root `package.json` patch version on each merge, and the
403
- [publish workflow](.github/workflows/npm-publish.yml) publishes each version
404
- newer than npm's `latest` using
405
- [trusted publishing](https://docs.npmjs.com/trusted-publishers), with
406
- provenance and no stored npm token. The publish job runs in the `npm`
407
- environment, which only `main` can deploy to; npm's trusted publisher names
408
- that environment and `npm-publish.yml`. Runs never overlap, and when merges land
409
- together only the newest pending run starts, so intermediate versions may never
410
- reach npm. npm adds a trusted publisher only to an existing package, so the
411
- first version was published by hand; the workflow fails with that instruction
412
- when the package is missing from npm.
413
-
414
- ### Standalone archives and packages
415
-
416
- ```sh
417
- # macOS and Linux ARM64/x64 archives, and a Homebrew formula with SHA-256 values:
418
- bun scripts/release.ts a2f0/agent-tool
419
-
420
- # A Debian package (Linux with dpkg-deb); substitute the release version:
421
- scripts/package-deb.sh dist/agent-tool-<version>-linux-x64/bin/agent-tool amd64
422
- sudo apt install ./dist/agent-tool_<version>_amd64.deb
423
- ```
424
-
425
- These scripts only create local artifacts. The manually triggered
426
- `Release artifacts` workflow runs them and uploads the archives, the formula,
427
- and amd64 and arm64 Debian packages as workflow artifacts. To offer
428
- `brew install <owner>/<tap>/agent-tool`, host the archives at the formula's
429
- URLs and publish `agent-tool.rb` in a tap. `apt install agent-tool` by name also
430
- requires a signed APT repository. Neither a tap nor an APT repository exists
431
- yet.
432
-
433
- ## Further reading
434
-
435
- - [Design](docs/design.md): component boundaries and implementation choices.
436
- - [Images](docs/images.md): brand image sources, targets, and output settings.
437
- - [Validation record](docs/validation.md): observed test results and their
438
- limits.
439
- - [Extraction record](docs/extraction.md): the projects this tool was extracted
440
- from.
47
+ Use the `ship-pr` skill for the full validation, versioning, independent review,
48
+ feedback, merge, cleanup, and deployment workflow. A successful review process
49
+ means a complete review was returned; read its final verdict and address blocking
50
+ findings before shipping. Pushing and merging remain explicit authorized actions.
51
+
52
+ ## Documentation
53
+
54
+ - [Shared workflows](docs/workflows.md): branches, commit trust, copied hooks,
55
+ PR checks/threads, cleanup, CI aggregate gates, release verification, durable
56
+ validation receipts, and toolchain/protection diagnostics.
57
+ - [CLI reference](docs/reference.md): existing review, version, skill installation,
58
+ command capture, configuration, and distribution contracts.
59
+ - [Development](docs/development.md): setup, source layout, validation, and release
60
+ procedures for this package.
61
+ - [Images](docs/images.md): declarative brand sources and generated outputs.
62
+ - [Dependency maintenance](docs/dependency-upgrades.md): active compatibility
63
+ constraints and the dependency-update workflow.
64
+ - [Design](docs/design.md) and [extraction history](docs/extraction.md): component
65
+ boundaries, origins, and explicit implementation limits.
66
+
67
+ The tool does not execute repository JavaScript as policy, bypass Git hooks for
68
+ shipping mutations, discard local edits, or silently weaken required CI checks.
69
+ Project builds, tests, deployment previews, health checks, and specialized checks
70
+ remain repository commands.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a2f0/agent-tool",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "packageManager": "bun@1.4.3",
5
5
  "type": "module",
6
6
  "description": "Portable cross-agent review, PR workflows, and shared skills",
@@ -28,7 +28,7 @@
28
28
  "start": "bun src/index.ts",
29
29
  "test": "bun test src scripts",
30
30
  "typecheck": "tsc --noEmit",
31
- "generate": "bun scripts/bundle-skills.ts",
31
+ "generate": "bun scripts/build/bundle-skills.ts",
32
32
  "build": "bun run generate && bun build --compile --minify src/index.ts --outfile dist/agent-tool"
33
33
  },
34
34
  "devDependencies": {
@@ -30,7 +30,8 @@ remote-tracking ref like `origin/main`), and `AGENT_TOOL_REVIEW_BASE_OID`, its
30
30
  fetched commit. Fetch from the repository that owns the PR, which can differ
31
31
  from the checkout's origin.
32
32
 
33
- Record the exact base and HEAD before reviewing. The tool reviews raw committed
33
+ Use `agent-tool repo context --fetch` to resolve and fetch the PR's own base,
34
+ then record the exact base and HEAD before reviewing. The tool reviews raw committed
34
35
  files and excludes worktree edits. A zero exit means a complete review was
35
36
  returned; it does not mean the findings are non-blocking. Read the final
36
37
  `VERDICT: BLOCKER|MAJOR|MINOR|SUGGESTION|CLEAN` and the findings. A reviewer
@@ -6,16 +6,15 @@ description: Open a GitHub pull request for the current feature branch with a va
6
6
  # Open PR
7
7
 
8
8
  Use the installed `agent-tool`. Follow repository policy for validation, commits,
9
- and branch naming. Resolve the repository and default branch with Git and `gh`;
9
+ and branch naming. Resolve the repository and default branch with `agent-tool repo context`;
10
10
  do not assume the branch is named main. Preserve unrelated work and finish
11
11
  requested changes and appropriate checks before publishing them.
12
12
 
13
- Ensure the intended commit is on a feature branch and push it through the
14
- repository's normal push workflow, naming the PR repository's remote and branch
15
- explicitly, as in `git push -u origin HEAD`; a bare push follows whatever
16
- upstream the branch tracks, which may be a local branch. Respect existing push
17
- authorization; do not bypass hooks. If the user only requested a draft
18
- description, prepare that text without publishing a PR.
13
+ Ensure the intended commit is on a feature branch and use
14
+ `agent-tool branch push <reviewed-head> --remote <remote>` through normal hooks.
15
+ It names the destination explicitly and verifies local/remote HEAD afterward;
16
+ a changed result needs another review. Respect existing push authorization.
17
+ If the user only requested a draft description, prepare it without publishing.
19
18
 
20
19
  Write a title that satisfies the data-only `agent-tool.json` subject policy.
21
20
  Describe the concrete resulting behavior and relevant validation. Put multiline
@@ -9,17 +9,27 @@ This is checkout cleanup, not a destructive Git reset. Read repository guidance
9
9
  for setup and hooks. Determine the default branch through the repository's
10
10
  remote metadata rather than assuming main.
11
11
 
12
- Check worktree and index first. Preserve user edits; if they prevent switching,
13
- report the condition instead of discarding or automatically stashing them. For
14
- post-merge cleanup, confirm the PR is MERGED before removing a feature branch.
12
+ For post-merge cleanup, preview with
13
+ `agent-tool repo cleanup <PR-number> <shipped-head>`, then run it with `--apply`
14
+ within the authorized cleanup scope. It requires a confirmed MERGED PR, preserves
15
+ local edits, checks exact local/remote feature commits, verifies the merge is on
16
+ the default branch, and fast-forwards that branch. Pass `--keep-branch` when the
17
+ user asked to preserve feature refs. Read the receipt's completed steps if a
18
+ later operation fails; do not claim full cleanup from a partial result.
15
19
 
16
- Fetch the default branch, switch to it, and update by fast-forward only. A
17
- diverged default branch requires inspection rather than forced replacement.
18
- Delete a merged feature branch only within the requested cleanup scope and
19
- after verifying its exact commit is the shipped commit; squash merging does not
20
- make Git ancestry-based branch deletion proof of shipping. Honor keep-branch.
20
+ Remote branch deletion uses GitHub REST after checking the live ref to avoid
21
+ pre-push hooks. The API has no atomic expected-OID delete guard; the check and
22
+ deletion retain a small concurrent-update window. Fork PRs require manual remote
23
+ handling and are refused by the shared cleanup command.
21
24
 
22
- Run only the hook installer or dependency setup documented by this repository
23
- when the updated checkout requires it. Do not assume a package manager or copy
24
- setup commands from another project. Report final branch, commit, and any
25
- unfinished cleanup.
25
+ For an explicit checkout cleanup without a merged PR, preserve all feature refs:
26
+ check worktree/index, resolve the default branch with `repo context`, fetch it,
27
+ switch, and update by fast-forward only. Never discard or automatically stash
28
+ edits, force a diverged default branch, or infer shipping from Git ancestry after
29
+ a squash merge.
30
+
31
+ Run the repository's documented dependency/hook setup if required. When copied
32
+ hooks are configured, use `agent-tool hooks check` and `hooks install --apply`;
33
+ inspect unmanaged hooks before an explicit `--adopt`, which backs them up.
34
+ Do not assume a package manager. Report final branch, commit, and unfinished
35
+ cleanup or setup.