argsbarg 6.2.0 → 6.3.0
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/CHANGELOG.md +26 -1
- package/README.md +10 -12
- package/docs/README.md +5 -5
- package/docs/ai-skills.md +9 -9
- package/docs/bundled-docs.md +3 -3
- package/docs/cli-program.md +11 -13
- package/docs/configure.md +37 -15
- package/docs/developing.md +11 -7
- package/docs/distribution-homebrew.md +2 -2
- package/docs/mcp.md +3 -3
- package/docs/output-schema.md +1 -1
- package/examples/full-example/.cursor/hooks/run-tests-on-stop.ts +56 -0
- package/examples/full-example/.cursor/hooks.json +12 -0
- package/examples/full-example/AGENTS.md +75 -0
- package/examples/full-example/CLAUDE.md +1 -0
- package/examples/full-example/Formula/full-example.rb +1 -1
- package/examples/full-example/docs/README.md +1 -1
- package/examples/full-example/docs/cli-schema.json +6 -6
- package/examples/full-example/docs/cli.md +6 -6
- package/examples/full-example/docs/mcp.md +2 -2
- package/examples/full-example/docs/skill.md +2 -2
- package/examples/full-example/justfile +12 -12
- package/examples/full-example/scripts/formula-shared.ts +1 -1
- package/examples/full-example-json/.cursor/hooks/run-tests-on-stop.ts +56 -0
- package/examples/full-example-json/.cursor/hooks.json +12 -0
- package/examples/full-example-json/AGENTS.md +86 -0
- package/examples/full-example-json/CLAUDE.md +1 -0
- package/examples/full-example-json/Formula/full-example-json.rb +1 -1
- package/examples/full-example-json/docs/README.md +1 -1
- package/examples/full-example-json/docs/cli-schema.json +27 -27
- package/examples/full-example-json/docs/cli.md +27 -27
- package/examples/full-example-json/docs/mcp.md +2 -2
- package/examples/full-example-json/docs/skill.md +2 -2
- package/examples/full-example-json/justfile +12 -12
- package/examples/full-example-json/scripts/formula-shared.ts +1 -1
- package/index.d.ts +20 -4
- package/package.json +1 -1
- package/src/builtins/builtins.test.ts +7 -7
- package/src/builtins/configure-copy.ts +2 -2
- package/src/builtins/configure.ts +4 -4
- package/src/configure/configure.test.ts +85 -12
- package/src/configure/index.ts +45 -13
- package/src/core/types.ts +21 -4
- package/src/docs/docs.test.ts +2 -2
- package/src/docs/mcp-guide.ts +2 -2
- package/src/index.ts +1 -0
- package/src/skill/generate.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [6.3.0] - 2026-08-07
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Cursor `stop` hook** — `.cursor/hooks.json` runs `just test` after agent edits to `justfile` or `*.{ts,tsx,js,jsx}` (excluding `node_modules/`, `dist/`, `.cursor/`); test failures auto-submit up to 20 follow-ups. Shipped in copy templates and argsbarg repo root (Cursor-only; not in `AGENTS.md`).
|
|
15
|
+
- **`configure` lifecycle hooks** — `program.configure.afterRefresh` and `program.configure.beforeRemoveAll` for app-specific agent artifact setup/teardown around `configure --refresh` and `configure --remove-all`.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **Breaking: `configure --sync` → `configure --refresh`** — renames the non-interactive agent-artifact refresh flag (skills, MCP, config bootstrap). `just sync-artifacts` → `just refresh-artifacts`. No `--sync` alias.
|
|
20
|
+
- **Copy-template justfiles** — `install-local` uses `brew install --force`; uninstall/untap recipes prefix `NONINTERACTIVE=1` so agents and CI skip Homebrew confirm prompts (including post-uninstall untap). `install-production` unchanged.
|
|
21
|
+
|
|
22
|
+
## [6.2.2] - 2026-08-07
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **Agent instructions (`AGENTS.md`)** — replace `.cursor/rules/*.mdc` with inlined `AGENTS.md` + `CLAUDE.md` (`@AGENTS.md`) in copy templates and consumer sync. `scripts/merge-agents-md.ts` replaces `merge-cli-program-rule.ts` and `merge-code-rule.ts`. Argsbarg maintainer repo uses root `AGENTS.md`.
|
|
27
|
+
|
|
28
|
+
## [6.2.1] - 2026-08-07
|
|
29
|
+
|
|
30
|
+
Chore
|
|
31
|
+
|
|
10
32
|
## [6.2.0] - 2026-07-30
|
|
11
33
|
|
|
12
34
|
### Changed
|
|
@@ -893,7 +915,10 @@ const cli = { ... } satisfies CliProgram; // or : CliProgram
|
|
|
893
915
|
- Migrate schemas: rename every `children` property to **`commands`**; move positional definitions to **`CliPositional`** objects on `positionals` and strip `positional` / `argMin` / `argMax` from flag definitions under `options` (flags only carry `name`, `description`, `kind`, and optional `shortName`).
|
|
894
916
|
- Imports: use `CliPositional` where needed; replace `CliOptionDef` with `CliOption` or `CliPositional` as appropriate.
|
|
895
917
|
|
|
896
|
-
[Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v6.
|
|
918
|
+
[Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v6.3.0...HEAD
|
|
919
|
+
[6.3.0]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.3.0
|
|
920
|
+
[6.2.2]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.2.2
|
|
921
|
+
[6.2.1]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.2.1
|
|
897
922
|
[6.2.0]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.2.0
|
|
898
923
|
[6.1.10]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.1.10
|
|
899
924
|
[6.1.9]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.1.9
|
package/README.md
CHANGED
|
@@ -133,7 +133,7 @@ Edit `scripts/create-identity.ts` in the new repository to set your description.
|
|
|
133
133
|
| Package import | `from "argsbarg"` (not relative to argsbarg `src/`) |
|
|
134
134
|
| Homebrew distribution | `scripts/formula-shared.ts`, `scripts/dev-formula.ts`, `Formula/`, `justfile` |
|
|
135
135
|
| Dev tooling | Biome (`just format` / `just lint`), TypeScript, colocated tests |
|
|
136
|
-
|
|
|
136
|
+
| Agent instructions | `AGENTS.md`, `CLAUDE.md` (`@AGENTS.md`) |
|
|
137
137
|
|
|
138
138
|
*Tip: Verify an existing tree or template setup with `bunx argsbarg create --check .`*
|
|
139
139
|
|
|
@@ -158,7 +158,7 @@ ArgsBarg automatically integrates several core features into your application. T
|
|
|
158
158
|
### Experimental Integrations (Opt-in)
|
|
159
159
|
|
|
160
160
|
- `mcp` — Run as a Model Context Protocol stdio-based agent server (injected when `mcpServer.enabled` is `true`). See [docs/mcp.md](docs/mcp.md).
|
|
161
|
-
- `configure` (`--
|
|
161
|
+
- `configure` (`--refresh` / `--status` / `--remove-all`) — Interactive environment setup and developer agent credentials sync (enabled by default; opt out with `configure: { enabled: false }`). See [docs/configure.md](docs/configure.md).
|
|
162
162
|
|
|
163
163
|
Do not declare top-level commands named `completion`, `version`, or `docs` as they are reserved by default. If their respective features are enabled, `http`, `mcp`, and `configure` are also reserved.
|
|
164
164
|
|
|
@@ -321,17 +321,17 @@ bunx argsbarg create my-api \
|
|
|
321
321
|
|
|
322
322
|
Edit `scripts/create-identity.ts` in the new repo to set `desc` (used by `program.description` and the Homebrew formula).
|
|
323
323
|
|
|
324
|
-
`create` copies the template (including
|
|
324
|
+
`create` copies the template (including `AGENTS.md` and `CLAUDE.md`), substitutes `{key}` / `{tap}` / `{releaseRepo}` placeholders, runs `bun install`, `argsbarg schemagen` (json template only), `bun test`, and `git init` + Initial commit when appropriate.
|
|
325
325
|
|
|
326
326
|
**Git bootstrap:** skipped when the target already has a `.git` directory, or when the target sits inside an existing git work tree (monorepo subfolder). Standalone new directories get an `Initial commit`.
|
|
327
327
|
|
|
328
328
|
Verify an existing tree: `bunx argsbarg create --check .`
|
|
329
329
|
|
|
330
|
-
To refresh
|
|
330
|
+
To refresh agent instructions in an existing consumer: `bun scripts/merge-agents-md.ts .` from an argsbarg checkout (or pass the npm package path to the template).
|
|
331
331
|
|
|
332
332
|
### What the copy templates include
|
|
333
333
|
|
|
334
|
-
Both templates ship all builtins (`completion`, `version`, `configure`, `docs`, `mcp`, `http`), Homebrew `justfile` + formula scripts, and `.
|
|
334
|
+
Both templates ship all builtins (`completion`, `version`, `configure`, `docs`, `mcp`, `http`), Homebrew `justfile` + formula scripts, and `AGENTS.md` + `CLAUDE.md`.
|
|
335
335
|
|
|
336
336
|
| Template | Path | Adds beyond builtins |
|
|
337
337
|
| --- | --- | --- |
|
|
@@ -373,21 +373,19 @@ Opt in by setting `mcpServer: { enabled: true }` on your program root. Running `
|
|
|
373
373
|
|
|
374
374
|
See **[docs/mcp.md](docs/mcp.md)** for configuration, env bootstrapping, custom resources, Cursor/Claude setup, and protocol details.
|
|
375
375
|
|
|
376
|
-
### 2.
|
|
376
|
+
### 2. Agent instructions (`AGENTS.md`)
|
|
377
377
|
|
|
378
|
-
ArgsBarg ships authoring docs under `node_modules/argsbarg/docs/`. Because AI agents do not automatically read inside `node_modules/`,
|
|
378
|
+
ArgsBarg ships authoring docs under `node_modules/argsbarg/docs/`. Because AI agents do not automatically read inside `node_modules/`, each copy template includes an `AGENTS.md` with inlined argsbarg authoring rules and a `CLAUDE.md` bridge (`@AGENTS.md`).
|
|
379
379
|
|
|
380
380
|
```bash
|
|
381
|
-
|
|
382
|
-
bun scripts/merge-cli-program-rule.ts . \
|
|
383
|
-
node_modules/argsbarg/examples/full-example/.cursor/rules/cli-program.mdc
|
|
381
|
+
bun scripts/merge-agents-md.ts .
|
|
384
382
|
```
|
|
385
383
|
|
|
386
|
-
This
|
|
384
|
+
This refreshes the argsbarg-managed section in `AGENTS.md` while preserving your app-specific prefix and `**<app> conventions:**` footer. See **Agent instructions** in [docs/cli-program.md](docs/cli-program.md).
|
|
387
385
|
|
|
388
386
|
### 3. Generated Skills & Workspace Configuration
|
|
389
387
|
|
|
390
|
-
Running `myapp configure --
|
|
388
|
+
Running `myapp configure --refresh` installs a compact `SKILL.md` index and full-reference `reference.md` to `~/.agents/skills/<key>/` when `program.skill: { enabled: true }`.
|
|
391
389
|
|
|
392
390
|
See **[docs/configure.md](docs/configure.md)** and **[docs/ai-skills.md](docs/ai-skills.md)** for developer setup and automated Homebrew pipeline integration.
|
|
393
391
|
|
package/docs/README.md
CHANGED
|
@@ -9,15 +9,15 @@ Start here to pick the right guide.
|
|
|
9
9
|
| **JSON stdout / `outputSchema`** | [output-schema.md](output-schema.md) — codegen pipeline, JSDoc, narrowing |
|
|
10
10
|
| **App config / `program.appConfig`** | [config-schema.md](config-schema.md) — flat JSON file, `ctx.appConfig`, codegen |
|
|
11
11
|
| **JSON Schema validation** | [json-schema-subset.md](json-schema-subset.md) — Draft-07 / 2019-09 / 2020-12 (`$schema` on each schema; default Draft-07) |
|
|
12
|
-
| **Exposing MCP tools** | [mcp.md](mcp.md) — stdio server, `inputSchema`, varargs, `configure --
|
|
12
|
+
| **Exposing MCP tools** | [mcp.md](mcp.md) — stdio server, `inputSchema`, varargs, `configure --refresh` |
|
|
13
13
|
| **HTTP tool server** | [http-server.md](http-server.md) — `myapp http`, endpoints, curl examples |
|
|
14
14
|
| **Server logging** (`program.log`, `enrich`, `serialize`) | [logging.md](logging.md) — ECS JSON lines, trace headers, custom formats |
|
|
15
|
-
| **Shipping configure / agent artifacts** | [configure.md](configure.md) — Homebrew + `myapp configure --
|
|
15
|
+
| **Shipping configure / agent artifacts** | [configure.md](configure.md) — Homebrew + `myapp configure --refresh` |
|
|
16
16
|
| **Homebrew tap-from-repo distribution** | [distribution-homebrew.md](distribution-homebrew.md) — formula pattern, `argsbarg create` |
|
|
17
17
|
| **Bundling `myapp docs` topics** | [bundled-docs.md](bundled-docs.md) — consumer docgen vs framework docs |
|
|
18
18
|
| **Agent skills** | [ai-skills.md](ai-skills.md) — `configure`, `docs skill` |
|
|
19
19
|
| **Maintaining the argsbarg repo** | [developing.md](developing.md) — release, consumers, npm `files` |
|
|
20
|
-
| **
|
|
20
|
+
| **IDE agents in a consumer app** | `bunx argsbarg create` (includes `AGENTS.md`) or `bun scripts/merge-agents-md.ts .` from argsbarg checkout |
|
|
21
21
|
| **Runnable examples** (shipped in npm) | [examples/](examples/) — see table below |
|
|
22
22
|
|
|
23
23
|
## Examples (agents: read these)
|
|
@@ -36,6 +36,6 @@ Examples are included in the npm tarball (`package.json` `files`). After `bun ad
|
|
|
36
36
|
| --- | --- | --- |
|
|
37
37
|
| **Framework docs** | How argsbarg works; authoring conventions | This directory — shipped in `node_modules/argsbarg/docs/` after `bun add argsbarg` |
|
|
38
38
|
| **Consumer docgen** | *Your* command tree, API, MCP guide for *your* app | `myapp docs cli`, `docs cli-schema`, `docs mcp` — written to `./docs/` with `--save` |
|
|
39
|
-
| **
|
|
39
|
+
| **Agent instructions** | Inlined argsbarg authoring rules in `AGENTS.md` | `node_modules/argsbarg/examples/full-example-json/AGENTS.md` — merge default for consumers; `create` includes a template copy |
|
|
40
40
|
|
|
41
|
-
Agents do **not** load `node_modules/argsbarg/docs/` unless your repo references them (
|
|
41
|
+
Agents do **not** load `node_modules/argsbarg/docs/` unless your repo references them (`AGENTS.md`, or an always-on project rule). Generated `./docs/cli.md` in a consumer repo describes **your** CLI, not argsbarg itself.
|
package/docs/ai-skills.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> This feature is experimental.
|
|
4
4
|
|
|
5
|
-
ArgsBarg can generate agent skill directories (`skill.md` + `reference.md`) from your CLI schema and install them to `~/.agents/skills/<key>/` per the
|
|
5
|
+
ArgsBarg can generate agent skill directories (`skill.md` + `reference.md`) from your CLI schema and install them to `~/.agents/skills/<key>/` per the open standard at https://dotagentsprotocol.com/.
|
|
6
6
|
|
|
7
7
|
## Enable on the program root
|
|
8
8
|
|
|
@@ -14,17 +14,17 @@ export const program = {
|
|
|
14
14
|
} satisfies CliProgram;
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
When `skill.enabled` is `true`, Homebrew `post_install` (`configure --
|
|
17
|
+
When `skill.enabled` is `true`, Homebrew `post_install` (`configure --refresh --yes`) installs and refreshes the skill. When omitted or `enabled` is not `true`, no skill is installed.
|
|
18
18
|
|
|
19
19
|
The skill directory name is the program `key` with `/`, `\`, and spaces replaced by `_` (e.g. `sqsp-qa`, `full-example`).
|
|
20
20
|
|
|
21
|
-
## Install via `configure --
|
|
21
|
+
## Install via `configure --refresh`
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
myapp configure --
|
|
24
|
+
myapp configure --refresh --yes
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Skills are not prompted during interactive `configure` — install and uninstall are automatic when `skill.enabled` is set (brew install/uninstall and `--
|
|
27
|
+
Skills are not prompted during interactive `configure` — install and uninstall are automatic when `skill.enabled` is set (brew install/uninstall and `--refresh` / `--remove-all`).
|
|
28
28
|
|
|
29
29
|
## Programmatic install
|
|
30
30
|
|
|
@@ -36,7 +36,7 @@ import { cliSkillInstall } from "argsbarg/skill/install"; // internal module
|
|
|
36
36
|
|
|
37
37
|
## Generated content
|
|
38
38
|
|
|
39
|
-
- **`skill.md`** —
|
|
39
|
+
- **`skill.md`** — https://dotagentsprotocol.com frontmatter (`id`, `name`, `description`, `enabled`), compact command index, pitfalls, client setup, and a pointer to `reference.md`
|
|
40
40
|
- **`SKILL.md`** — compatibility copy of `skill.md` for tools that expect uppercase filenames
|
|
41
41
|
- **`reference.md`** — full `docs cli` markdown reference
|
|
42
42
|
|
|
@@ -46,7 +46,7 @@ Installed files include an HTML comment hint (`Generated by myapp configure; do
|
|
|
46
46
|
|
|
47
47
|
| Client | Skill path |
|
|
48
48
|
| --- | --- |
|
|
49
|
-
| Cursor, Codex, Copilot, most agents | `~/.agents/skills/<key>/` (auto via `configure --
|
|
49
|
+
| Cursor, Codex, Copilot, most agents | `~/.agents/skills/<key>/` (auto via `configure --refresh`) |
|
|
50
50
|
| Claude Code | Manual symlink to `~/.claude/skills/<key>/` |
|
|
51
51
|
|
|
52
52
|
```bash
|
|
@@ -61,10 +61,10 @@ Skills describe **shell invocation only** — no MCP setup or `tools/call` guida
|
|
|
61
61
|
| Mechanism | Role |
|
|
62
62
|
| --- | --- |
|
|
63
63
|
| **`myapp mcp`** (requires `mcpServer`) | Runtime tool execution over MCP |
|
|
64
|
-
| **`program.skill.enabled`** + **`configure --
|
|
64
|
+
| **`program.skill.enabled`** + **`configure --refresh`** | Persists optimized skill bundle at `~/.agents/skills/<key>/` |
|
|
65
65
|
| **`myapp docs`** (requires `docs`) | Bundled markdown on stdout (`docs mcp` when MCP enabled) |
|
|
66
66
|
|
|
67
|
-
`skill.md` is the routing index; `reference.md` matches `docs cli`. Prefer `configure --
|
|
67
|
+
`skill.md` is the routing index; `reference.md` matches `docs cli`. Prefer `configure --refresh` over `docs skill` for installed agents. See [cli-program.md](cli-program.md).
|
|
68
68
|
|
|
69
69
|
**Claude Code plugin** (`mcpServer.claudePlugin: true` → `mcp bundle` writes `dist/claude-plugin/<name>.zip`) ships a separate MCP pointer skill (`SKILL.md` only) that routes agents to the bundled MCP server. This is a **dist artifact**, not installed via `configure`.
|
|
70
70
|
|
package/docs/bundled-docs.md
CHANGED
|
@@ -8,7 +8,7 @@ Two documentation layers often coexist in a consumer repo:
|
|
|
8
8
|
|
|
9
9
|
| Layer | Contents | How agents/humans get it |
|
|
10
10
|
| --- | --- | --- |
|
|
11
|
-
| **Argsbarg framework** | How to author `CliProgram`, MCP varargs policy, headless patterns | `node_modules/argsbarg/docs/` —
|
|
11
|
+
| **Argsbarg framework** | How to author `CliProgram`, MCP varargs policy, headless patterns | `node_modules/argsbarg/docs/` — wired via consumer [`AGENTS.md`](../examples/full-example-json/AGENTS.md) |
|
|
12
12
|
| **Your CLI (docgen)** | Your command tree, options, MCP tool list, install notes | `myapp docs cli`, `docs cli-schema`, `docs mcp` — save with `--save` to `./docs/` |
|
|
13
13
|
|
|
14
14
|
`docs cli` and `docs cli-schema` embed each leaf’s `outputSchema` when set — see [output-schema.md](output-schema.md) for how to generate and wire schemas.
|
|
@@ -97,11 +97,11 @@ By default (unless `docs.enabled: false`):
|
|
|
97
97
|
|
|
98
98
|
- **`docs cli-schema`** — same JSON as the former root `--schema` flag (handlers omitted; built-in subtrees included for leaf roots).
|
|
99
99
|
- **`docs cli`** — markdown rendering of the same command tree (options, positionals, subcommands, fallback routing).
|
|
100
|
-
- **`docs skill`** — prints the compact `SKILL.md` index. Prefer `configure --
|
|
100
|
+
- **`docs skill`** — prints the compact `SKILL.md` index. Prefer `configure --refresh --yes` for agents (persists index + full API in `reference.md`).
|
|
101
101
|
|
|
102
102
|
## MCP guide (`docs mcp`)
|
|
103
103
|
|
|
104
|
-
When both docs (default) and `mcpServer.enabled` are `true`, ArgsBarg injects a **`docs mcp`** topic with an auto-generated guide: tool list, `program.appConfig`, schema resource URI, `configure --
|
|
104
|
+
When both docs (default) and `mcpServer.enabled` are `true`, ArgsBarg injects a **`docs mcp`** topic with an auto-generated guide: tool list, `program.appConfig`, schema resource URI, `configure --refresh`, and protocol notes.
|
|
105
105
|
|
|
106
106
|
There is no override API in v1 — customize behavior via `mcpTool.description` on leaf commands.
|
|
107
107
|
|
package/docs/cli-program.md
CHANGED
|
@@ -541,9 +541,9 @@ await cli.run();
|
|
|
541
541
|
- **Strict:** unknown keys rejected on load.
|
|
542
542
|
- **CLI:** missing required config exits 1 before the leaf handler (TTY prompt when interactive). Built-in `docs` and `configure get`/`set` skip this exit.
|
|
543
543
|
- **MCP:** server stays up; missing config returns `isError: true` at `tools/call`.
|
|
544
|
-
- **Configure:** interactive `configure` runs the app config wizard; **`configure --
|
|
545
|
-
- **Agent skill:** `program.skill: { enabled: true }` installs to `~/.agents/skills/<key>/` on `configure --
|
|
546
|
-
- **MCP install:** `mcpServer: { enabled: true }` merges into `~/.agents/mcp.json` on `configure --
|
|
544
|
+
- **Configure:** interactive `configure` runs the app config wizard; **`configure --refresh`** refreshes agent artifacts to `~/.agents/` (see https://dotagentsprotocol.com). Optional `configure.afterRefresh` / `configure.beforeRemoveAll` for app-specific agent setup; see [configure.md](configure.md).
|
|
545
|
+
- **Agent skill:** `program.skill: { enabled: true }` installs to `~/.agents/skills/<key>/` on `configure --refresh`; see [configure.md](configure.md) and [ai-skills.md](ai-skills.md).
|
|
546
|
+
- **MCP install:** `mcpServer: { enabled: true }` merges into `~/.agents/mcp.json` on `configure --refresh`; manual Cursor/Claude setup in [mcp.md](mcp.md).
|
|
547
547
|
|
|
548
548
|
See [config-schema.md](config-schema.md) for codegen, [configure.md](configure.md) (`configure.targets`), and [mcp.md](mcp.md).
|
|
549
549
|
|
|
@@ -555,21 +555,19 @@ See [config-schema.md](config-schema.md) for codegen, [configure.md](configure.m
|
|
|
555
555
|
|
|
556
556
|
Do not declare user commands named `completion`, `configure`, `mcp`, `version`, or `docs` at the root — ArgsBarg injects these when configured. App config uses `configure get` / `configure set` subcommands (not a top-level `config` command).
|
|
557
557
|
|
|
558
|
-
##
|
|
558
|
+
## Agent instructions for consumer repos
|
|
559
559
|
|
|
560
|
-
Argsbarg ships framework docs under `node_modules/argsbarg/docs/` (same files as this repo’s `docs/`). **This file is the authoritative guide** —
|
|
560
|
+
Argsbarg ships framework docs under `node_modules/argsbarg/docs/` (same files as this repo’s `docs/`). **This file is the authoritative guide** — `AGENTS.md` inlines the tripwire rules that tell agents when to read it.
|
|
561
561
|
|
|
562
562
|
Agents do **not** discover package docs automatically. Wire them in after `bun add argsbarg`:
|
|
563
563
|
|
|
564
|
-
1. **
|
|
564
|
+
1. **Use the copy template `AGENTS.md`** (recommended):
|
|
565
565
|
|
|
566
566
|
```bash
|
|
567
|
-
|
|
568
|
-
bun scripts/merge-cli-program-rule.ts . \
|
|
569
|
-
node_modules/argsbarg/examples/full-example/.cursor/rules/cli-program.mdc
|
|
567
|
+
bun scripts/merge-agents-md.ts .
|
|
570
568
|
```
|
|
571
569
|
|
|
572
|
-
|
|
570
|
+
`bunx argsbarg create` copies `AGENTS.md` and `CLAUDE.md` (`@AGENTS.md`) into new projects automatically.
|
|
573
571
|
|
|
574
572
|
2. **Add an app-specific block at the bottom** (recommended). Replace the template placeholder with a heading like `**myapp conventions:**` and short bullets — shared flag modules, `read*Flags` / `resolve*` paths, Ink vs JSON-only, etc. Example:
|
|
575
573
|
|
|
@@ -580,11 +578,11 @@ The template is ~30 lines: when to read which doc, plus hard rules agents often
|
|
|
580
578
|
- Per command: `read*Flags` + `resolve*Input` in `commands/<name>/resolve.ts`.
|
|
581
579
|
```
|
|
582
580
|
|
|
583
|
-
If you maintain argsbarg from a sibling checkout, `just
|
|
581
|
+
If you maintain argsbarg from a sibling checkout, `just consumers-dev` / `just consumers-sync` refresh the shared managed section and **keep** your prefix and conventions footer. Commit `AGENTS.md` in your repo.
|
|
584
582
|
|
|
585
|
-
3. **Optional:**
|
|
583
|
+
3. **Optional:** add consumer-specific sections above the `<!-- argsbarg:managed -->` marker in `AGENTS.md` (project context, Ink patterns, domain notes).
|
|
586
584
|
|
|
587
|
-
- **Not this file:** `myapp configure --
|
|
585
|
+
- **Not this file:** `myapp configure --refresh` writes the **app** skill (`SKILL.md` under `~/.agents/skills/<key>/`) from your command schema — how to *invoke* the CLI. `AGENTS.md` is for *authoring* argsbarg schema.
|
|
588
586
|
|
|
589
587
|
## See also
|
|
590
588
|
|
package/docs/configure.md
CHANGED
|
@@ -35,13 +35,13 @@ just build
|
|
|
35
35
|
just install-local # same formula as production; temporary file:// URL during brew install (`just install` is an alias)
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Dev flow matches release: formula `install` copies the binary and generates completions; `post_install` runs `<key> configure --
|
|
38
|
+
Dev flow matches release: formula `install` copies the binary and generates completions; `post_install` runs `<key> configure --refresh --yes` for skills/MCP. Use `just reinstall-local` to swap the binary into Cellar during tight edit cycles (skips completions and `post_install`). Use `just refresh-artifacts` to refresh agent artifacts without touching the binary.
|
|
39
39
|
|
|
40
40
|
## Quick reference
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
43
|
# Refresh skills/MCP after upgrade (Homebrew post_install runs this automatically)
|
|
44
|
-
<key> configure --
|
|
44
|
+
<key> configure --refresh --yes
|
|
45
45
|
|
|
46
46
|
# See what is installed
|
|
47
47
|
<key> configure --status
|
|
@@ -60,7 +60,7 @@ Dev flow matches release: formula `install` copies the binary and generates comp
|
|
|
60
60
|
<key> configure set <key> <value> [--json] [--from-env]
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Non-interactive / CI: pass **`--yes`** (or **`--json`**, **`--
|
|
63
|
+
Non-interactive / CI: pass **`--yes`** (or **`--json`**, **`--refresh`**, **`--remove-all`**, **`--remove-config`**) — see [Confirmation](#confirmation).
|
|
64
64
|
|
|
65
65
|
## What gets configured
|
|
66
66
|
|
|
@@ -69,36 +69,36 @@ Non-interactive / CI: pass **`--yes`** (or **`--json`**, **`--sync`**, **`--remo
|
|
|
69
69
|
| Binary | skipped (read-only) | Homebrew formula `bin.install` |
|
|
70
70
|
| Shell completions | skipped | Homebrew `generate_completions_from_executable` |
|
|
71
71
|
| Agent skill | skipped (automatic) | `~/.agents/skills/<key>/` when `program.skill.enabled` |
|
|
72
|
-
| MCP config | skipped (automatic) | `~/.agents/mcp.json` when `mcpServer.enabled` (
|
|
73
|
-
| App config | auto-runs wizard | Interactive wizard may update `~/.local/lib/<key>/config.json` when values change; `--
|
|
72
|
+
| MCP config | skipped (automatic) | `~/.agents/mcp.json` when `mcpServer.enabled` (see https://dotagentsprotocol.com) |
|
|
73
|
+
| App config | auto-runs wizard | Interactive wizard may update `~/.local/lib/<key>/config.json` when values change; `--refresh` bootstraps an empty file on install |
|
|
74
74
|
|
|
75
75
|
### Externally managed binary (Homebrew)
|
|
76
76
|
|
|
77
77
|
When **`PATH`** resolves the program key to the **running executable** (e.g. after `brew install`):
|
|
78
78
|
|
|
79
79
|
- **`configure --status`** shows `app: system (PATH)`
|
|
80
|
-
- **`configure --
|
|
80
|
+
- **`configure --refresh`** refreshes the agent skill (when `program.skill.enabled`) and merges MCP into `~/.agents/mcp.json` (when `mcpServer.enabled`); also creates `~/.local/lib/<key>/config.json` as `{}` when missing (all apps)
|
|
81
81
|
|
|
82
82
|
MCP config uses the command name on **`PATH`**, not a Cellar path. For Cursor, Claude Code, and Claude Desktop, copy the `mcpServers` entry manually — see [mcp.md](mcp.md) and `docs mcp`.
|
|
83
83
|
|
|
84
84
|
### Interactive default
|
|
85
85
|
|
|
86
|
-
Bare **`configure`** (TTY required) runs the app config wizard when `program.appConfig` has entries. Agent skills and MCP are **not** prompted — they install automatically via brew `post_install` / `--
|
|
86
|
+
Bare **`configure`** (TTY required) runs the app config wizard when `program.appConfig` has entries. Agent skills and MCP are **not** prompted — they install automatically via brew `post_install` / `--refresh` when `program.skill.enabled` or `mcpServer.enabled` respectively.
|
|
87
87
|
|
|
88
88
|
Remove the config file with **`configure --remove-config --yes`**.
|
|
89
89
|
|
|
90
|
-
The **`app`** and **`skill`** / **`agentsMcp`** targets are shown in `--status` only — never mutated by interactive `configure` (use `--
|
|
90
|
+
The **`app`** and **`skill`** / **`agentsMcp`** targets are shown in `--status` only — never mutated by interactive `configure` (use `--refresh` / brew hooks).
|
|
91
91
|
|
|
92
92
|
### `configure.targets`
|
|
93
93
|
|
|
94
|
-
Optional gates for app binary status and app-config wizard participation in `--
|
|
94
|
+
Optional gates for app binary status and app-config wizard participation in `--refresh`:
|
|
95
95
|
|
|
96
96
|
```typescript
|
|
97
97
|
skill: { enabled: true },
|
|
98
98
|
mcpServer: { enabled: true },
|
|
99
99
|
configure: {
|
|
100
100
|
targets: {
|
|
101
|
-
configure: { includedInAll: true }, // optional: app config wizard on --
|
|
101
|
+
configure: { includedInAll: true }, // optional: app config wizard on --refresh
|
|
102
102
|
},
|
|
103
103
|
},
|
|
104
104
|
```
|
|
@@ -107,15 +107,37 @@ configure: {
|
|
|
107
107
|
|
|
108
108
|
Artifact keys: `app`, `configure`. Legacy `configure.targets.*Mcp` keys are rejected — MCP installs to `~/.agents/mcp.json` when `mcpServer.enabled`.
|
|
109
109
|
|
|
110
|
+
### Lifecycle hooks
|
|
111
|
+
|
|
112
|
+
Optional callbacks on `program.configure` for app-specific agent setup beyond the `.agents` protocol (e.g. Cursor or Claude Desktop config). Framework artifacts are installed/refreshed first; hooks extend or retract custom files.
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
configure: {
|
|
116
|
+
afterRefresh: async (ctx) => {
|
|
117
|
+
if (ctx.dry) return;
|
|
118
|
+
// e.g. symlink skill, merge Cursor mcp.json — ctx.paths has agentsSkillDir, agentsMcpPath, mcpName
|
|
119
|
+
},
|
|
120
|
+
beforeRemoveAll: async (ctx) => {
|
|
121
|
+
if (ctx.dry) return;
|
|
122
|
+
// undo custom installs before framework removes ~/.agents/ artifacts
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
| Hook | When |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| `afterRefresh` | After `configure --refresh` installs framework artifacts |
|
|
130
|
+
| `beforeRemoveAll` | Before `configure --remove-all` removes framework artifacts (not `--remove-config`) |
|
|
131
|
+
|
|
110
132
|
## App config (`program.appConfig`)
|
|
111
133
|
|
|
112
|
-
Every app gets `~/.local/lib/<sanitized-key>/config.json` on first **`configure --
|
|
134
|
+
Every app gets `~/.local/lib/<sanitized-key>/config.json` on first **`configure --refresh`** (Homebrew `post_install`), even without `program.appConfig`.
|
|
113
135
|
|
|
114
136
|
When `program.appConfig` is set, ArgsBarg manages schema-driven values in that file.
|
|
115
137
|
|
|
116
138
|
| Mode | Description |
|
|
117
139
|
| --- | --- |
|
|
118
|
-
| `configure --
|
|
140
|
+
| `configure --refresh` | Bootstraps `config.json` as `{}` when missing |
|
|
119
141
|
| Interactive `configure` | Config wizard when `entries` is non-empty; re-prompts every entry (Enter keeps current); writes only when values or `_bindings` change |
|
|
120
142
|
| `--status` | Shows config path, required keys (`set` / `missing`), and binding hints (`env`, `file`, `skip`) |
|
|
121
143
|
| `--remove-config --yes` | Removes the config directory |
|
|
@@ -132,7 +154,7 @@ Export helpers from `argsbarg`: `resolveAppConfigPath`, `displayAppConfigPath`.
|
|
|
132
154
|
| Flag | Description |
|
|
133
155
|
| --- | --- |
|
|
134
156
|
| `--status` | Read-only inventory |
|
|
135
|
-
| `--
|
|
157
|
+
| `--refresh` | Refresh installed agent artifacts; bootstrap `config.json` when missing (Homebrew `post_install`; greenfield → full install plan) |
|
|
136
158
|
| `--remove-all` | Remove all detected agent artifacts |
|
|
137
159
|
| `--remove-config` | Remove app config directory only |
|
|
138
160
|
|
|
@@ -146,7 +168,7 @@ Export helpers from `argsbarg`: `resolveAppConfigPath`, `displayAppConfigPath`.
|
|
|
146
168
|
|
|
147
169
|
## Confirmation
|
|
148
170
|
|
|
149
|
-
Interactive `configure` prints a **`{app} Setup`** banner and per-target prompts. Non-interactive modes (`--
|
|
171
|
+
Interactive `configure` prints a **`{app} Setup`** banner and per-target prompts. Non-interactive modes (`--refresh`, `--remove-all`, `--remove-config`) require **`--yes`** unless `--dry`.
|
|
150
172
|
|
|
151
173
|
## MCP merge behavior
|
|
152
174
|
|
|
@@ -164,7 +186,7 @@ Release formulae should run:
|
|
|
164
186
|
|
|
165
187
|
```ruby
|
|
166
188
|
def post_install
|
|
167
|
-
system bin/"myapp", "configure", "--
|
|
189
|
+
system bin/"myapp", "configure", "--refresh", "--yes"
|
|
168
190
|
end
|
|
169
191
|
```
|
|
170
192
|
|
package/docs/developing.md
CHANGED
|
@@ -26,21 +26,25 @@ The release script bumps `package.json`, promotes `[Unreleased]` in `CHANGELOG.m
|
|
|
26
26
|
|
|
27
27
|
Update `CHANGELOG.md` under `[Unreleased]` before releasing.
|
|
28
28
|
|
|
29
|
+
## Cursor test hook (optional)
|
|
30
|
+
|
|
31
|
+
Copy templates and the argsbarg repo root include `.cursor/hooks.json` plus `.cursor/hooks/run-tests-on-stop.ts`. On agent **stop** (completed turn), when git shows changes to `justfile` or `*.{ts,tsx,js,jsx}` (excluding `node_modules/`, `dist/`, `.cursor/`), the hook runs `just test`. Failures return a `followup_message` (up to **20** auto-retries via `loop_limit`). Requires [Cursor hooks](https://cursor.com/docs/hooks); not part of `AGENTS.md`. New projects get hooks via `argsbarg create`.
|
|
32
|
+
|
|
29
33
|
## Local consumer apps
|
|
30
34
|
|
|
31
35
|
Sibling consumer repos (machine-specific paths in the root `justfile` `consumer_apps` variable, e.g. `~/dev/ss/sqsp-workspaces`):
|
|
32
36
|
|
|
33
37
|
| Recipe | When | Effect |
|
|
34
38
|
| --- | --- | --- |
|
|
35
|
-
| `just consumers-dev` | Before publish; hacking on argsbarg locally | `bun add argsbarg@file:<relative>`; refresh
|
|
36
|
-
| `just consumers-sync` | After release | Sets `"argsbarg": "^<this package.json version>"`, `bun install`, merge
|
|
39
|
+
| `just consumers-dev` | Before publish; hacking on argsbarg locally | `bun add argsbarg@file:<relative>`; refresh `AGENTS.md` from template (keeps app-specific prefix and conventions footer) |
|
|
40
|
+
| `just consumers-sync` | After release | Sets `"argsbarg": "^<this package.json version>"`, `bun install`, merge `AGENTS.md`, `just build`, `just docgen`, `just install-local` (Homebrew dev formula + agent artifacts; `just install` is an alias) |
|
|
37
41
|
| `just consumers-schemagen` | After `@sg` type changes in consumers | Runs `argsbarg schemagen` in each `consumer_apps` path (fails if missing) |
|
|
38
42
|
|
|
39
43
|
`consumers-sync` reads the version from **this repo’s** `package.json` — not npm. Run it **after** `just release` so consumers pin a version that exists on the registry.
|
|
40
44
|
|
|
41
|
-
**Argsbarg authoring rules** — `scripts/merge-
|
|
45
|
+
**Argsbarg authoring rules** — `scripts/merge-agents-md.ts` copies the template from `examples/full-example-json/AGENTS.md` into each consumer, preserving any existing prefix and `**… conventions:**` footer block.
|
|
42
46
|
|
|
43
|
-
**Recommended in each consumer:** replace template placeholders with `**<app> conventions:**` bullets. Commit
|
|
47
|
+
**Recommended in each consumer:** replace template placeholders with `**<app> conventions:**` bullets. Commit `AGENTS.md`; merges refresh the managed section, not your prefix or footer.
|
|
44
48
|
|
|
45
49
|
## Upgrading consumer apps to 7.0
|
|
46
50
|
|
|
@@ -52,10 +56,10 @@ Breaking changes (no backward compat). See [CHANGELOG.md](../CHANGELOG.md) `[Unr
|
|
|
52
56
|
4. **HTTP:** use `/api/...` REST routes only (`POST /tools/*` removed).
|
|
53
57
|
5. **Hooks:** remove manual `ctx.locals.requestId` in `beforeInvoke` — framework seeds it.
|
|
54
58
|
6. **Exports:** stop importing `loadLeafInputs` / `CliHttpResponseConfig` from `argsbarg` (use `ctx.inputs`, leaf `http.successContentType`).
|
|
55
|
-
7. **
|
|
59
|
+
7. **Agent instructions:** `just consumers-dev` merges `AGENTS.md` + `CLAUDE.md` (includes **Abstractions** needless-extraction rule).
|
|
56
60
|
8. **Verify:** `just test` and `just docgen` in each consumer repo.
|
|
57
61
|
|
|
58
|
-
**Consumer app skill** — `just install-local` in each consumer (part of `consumers-sync`) runs Homebrew dev install then `myapp configure --
|
|
62
|
+
**Consumer app skill** — `just install-local` in each consumer (part of `consumers-sync`) runs Homebrew dev install then `myapp configure --refresh --yes`, which updates `~/.agents/skills/<app>/` when `program.skill.enabled` — not the argsbarg framework rule.
|
|
59
63
|
|
|
60
64
|
## npm package contents
|
|
61
65
|
|
|
@@ -95,7 +99,7 @@ import { runSchemagen } from "argsbarg/schemagen";
|
|
|
95
99
|
| `schema.ts`, `parse.ts`, `context.ts` | Transport-agnostic CLI core |
|
|
96
100
|
| `http/` | HTTP tool server (`httpServer` capability) |
|
|
97
101
|
| `mcp/` | MCP stdio server and bundle (`mcpServer` capability) |
|
|
98
|
-
| `configure/artifacts/` | Agent artifact
|
|
102
|
+
| `configure/artifacts/` | Agent artifact install/refresh (`configure` capability) |
|
|
99
103
|
| `docs/` | Built-in documentation generators |
|
|
100
104
|
|
|
101
105
|
Capabilities are declared on `CliProgram`; builtins wire them in [`src/builtins/`](../src/builtins/).
|
|
@@ -11,7 +11,7 @@ ArgsBarg maps the lifecycle of your application directly to standard Homebrew ho
|
|
|
11
11
|
| Layer | Mechanism | Role in Lifecycle |
|
|
12
12
|
| --- | --- | --- |
|
|
13
13
|
| **Binary & Autocompletions** | Formula `install` block | Installs compiled binary and registers native shell autocompletions. |
|
|
14
|
-
| **
|
|
14
|
+
| **Agent artifacts** | Formula `post_install` | Automatically runs `{key} configure --refresh --yes` to bootstrap configuration files and refresh agent artifacts. |
|
|
15
15
|
| **Application Configuration** | User-facing `{key} configure` | Runs an interactive TTY setup wizard (only when `program.appConfig` defines required parameters). |
|
|
16
16
|
| **Clean Uninstall** | Formula `uninstall` | Automatically runs `{key} configure --remove-all --yes` to clean up local configurations and symlinks. |
|
|
17
17
|
|
|
@@ -87,7 +87,7 @@ class Myapp < Formula
|
|
|
87
87
|
|
|
88
88
|
def post_install
|
|
89
89
|
# Non-interactive bootstrap of config files and developer links
|
|
90
|
-
system bin/"myapp", "configure", "--
|
|
90
|
+
system bin/"myapp", "configure", "--refresh", "--yes"
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def uninstall
|
package/docs/mcp.md
CHANGED
|
@@ -46,10 +46,10 @@ bun run examples/nested.ts mcp
|
|
|
46
46
|
|
|
47
47
|
### `.agents` auto-install
|
|
48
48
|
|
|
49
|
-
When `mcpServer.enabled` is set, `configure --
|
|
49
|
+
When `mcpServer.enabled` is set, `configure --refresh` merges a `mcpServers` entry into `~/.agents/mcp.json` per the https://dotagentsprotocol.com:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
myapp configure --
|
|
52
|
+
myapp configure --refresh --yes
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
### Manual client setup
|
|
@@ -381,7 +381,7 @@ The bundled `SKILL.md` is an **MCP routing stub** — it tells Claude to use the
|
|
|
381
381
|
|
|
382
382
|
Load locally with `claude --plugin-dir ./dist/claude-plugin/myapp.zip`.
|
|
383
383
|
|
|
384
|
-
Bare **`myapp mcp`** still runs the stdio MCP server (unchanged for `configure` MCP targets and MCP hosts). Use **`configure --
|
|
384
|
+
Bare **`myapp mcp`** still runs the stdio MCP server (unchanged for `configure` MCP targets and MCP hosts). Use **`configure --refresh --yes`** for Cursor, Claude Code, Claude Desktop, and OpenCode JSON config.
|
|
385
385
|
|
|
386
386
|
## Hidden commands and options
|
|
387
387
|
|
package/docs/output-schema.md
CHANGED
|
@@ -212,7 +212,7 @@ Per consumer repo (optional):
|
|
|
212
212
|
4. `just docgen` / `myapp docs cli --save` — refresh consumer docs.
|
|
213
213
|
5. Document which commands use which roots in **your** `docs/architecture.md` (argsbarg does not maintain per-app tables).
|
|
214
214
|
|
|
215
|
-
Add a bullet under your app’s `**… conventions:**` block in
|
|
215
|
+
Add a bullet under your app’s `**… conventions:**` block in `AGENTS.md` pointing at `node_modules/argsbarg/docs/output-schema.md`.
|
|
216
216
|
|
|
217
217
|
**Reference implementation:** [`examples/full-example-json/`](../examples/full-example-json/) in this repo — `@sg` on command types, `__generated__/`, and `status` leaf with `StatusJsonOutputSchema`.
|
|
218
218
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/* Cursor stop hook: run `just test` on agent completion; follow up if it fails. */
|
|
3
|
+
|
|
4
|
+
try {
|
|
5
|
+
const empty = () => {
|
|
6
|
+
console.log("{}");
|
|
7
|
+
process.exit(0);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const input = JSON.parse(await Bun.stdin.text()) as {
|
|
11
|
+
status?: string;
|
|
12
|
+
loop_count?: number;
|
|
13
|
+
workspace_roots?: string[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
if (input.status !== "completed") empty();
|
|
17
|
+
|
|
18
|
+
const cwd = input.workspace_roots?.[0] ?? process.cwd();
|
|
19
|
+
if (!(await Bun.file(`${cwd}/justfile`).exists())) empty();
|
|
20
|
+
|
|
21
|
+
const diff = Bun.spawnSync(["git", "diff", "--name-only", "HEAD"], { cwd, stdout: "pipe" });
|
|
22
|
+
const CODE_FILE = /\.(t|j)sx?$/i;
|
|
23
|
+
const SKIP_PREFIX = /^(node_modules|dist|\.cursor)\//;
|
|
24
|
+
const changed = new TextDecoder()
|
|
25
|
+
.decode(diff.stdout)
|
|
26
|
+
.split("\n")
|
|
27
|
+
.some(
|
|
28
|
+
(path) =>
|
|
29
|
+
path &&
|
|
30
|
+
(path === "justfile" || (CODE_FILE.test(path) && !SKIP_PREFIX.test(path))),
|
|
31
|
+
);
|
|
32
|
+
if (!changed) empty();
|
|
33
|
+
|
|
34
|
+
const proc = Bun.spawnSync(["just", "test"], {
|
|
35
|
+
cwd,
|
|
36
|
+
env: { ...process.env, FORCE_COLOR: "0" },
|
|
37
|
+
stderr: "pipe",
|
|
38
|
+
stdout: "pipe",
|
|
39
|
+
});
|
|
40
|
+
const output =
|
|
41
|
+
new TextDecoder().decode(proc.stdout) + new TextDecoder().decode(proc.stderr);
|
|
42
|
+
|
|
43
|
+
if (proc.exitCode === 0) empty();
|
|
44
|
+
|
|
45
|
+
const lines = output.trimEnd().split("\n");
|
|
46
|
+
const tail = lines.length > 80 ? lines.slice(-80).join("\n") : output.trimEnd();
|
|
47
|
+
const n = (input.loop_count ?? 0) + 1;
|
|
48
|
+
|
|
49
|
+
console.log(
|
|
50
|
+
JSON.stringify({
|
|
51
|
+
followup_message: `Tests failed (auto-retry ${n}/20). Fix and ensure \`just test\` passes.\n\n\`\`\`\n${tail}\n\`\`\``,
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
} catch {
|
|
55
|
+
console.log("{}");
|
|
56
|
+
}
|