argsbarg 5.1.4 → 5.1.6

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 CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [5.1.6] - 2026-07-05
11
+
12
+
13
+ ## [5.1.5] - 2026-07-05
14
+
15
+ ### Changed
16
+
17
+ - **`just install-local`** — back up release `Formula/{key}.rb`, write dev formula for `brew install`, then restore (`scripts/with-dev-formula.ts`; dropped `gen-dev-formula.ts` / `dev-formula.ts`).
18
+
10
19
  ## [5.1.4] - 2026-07-04
11
20
 
12
21
  ### Changed
@@ -610,7 +619,9 @@ const cli = { ... } satisfies CliProgram; // or : CliProgram
610
619
  - 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`).
611
620
  - Imports: use `CliPositional` where needed; replace `CliOptionDef` with `CliOption` or `CliPositional` as appropriate.
612
621
 
613
- [Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v5.1.4...HEAD
622
+ [Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v5.1.6...HEAD
623
+ [5.1.6]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.1.6
624
+ [5.1.5]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.1.5
614
625
  [5.1.4]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.1.4
615
626
  [5.1.3]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.1.3
616
627
  [5.1.2]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.1.2
package/README.md CHANGED
@@ -264,7 +264,7 @@ To refresh the Cursor rule in an existing consumer: `bun scripts/merge-cli-progr
264
264
  | Command layout | `src/commands/<name>/command.ts`; registration in `src/program.ts` |
265
265
  | MCP doc topics | `docs.topics` auto-exposed as `<key>://docs/<topic>` resources when docs + MCP enabled |
266
266
  | Package import | `from "argsbarg"` (not relative to argsbarg `src/`) |
267
- | Homebrew distribution | `scripts/formula-shared.ts`, `scripts/gen-dev-formula.ts`, `Formula/`, `justfile` |
267
+ | Homebrew distribution | `scripts/formula-shared.ts`, `scripts/with-dev-formula.ts`, `Formula/`, `justfile` |
268
268
  | Dev tooling | Biome (`just format` / `just lint`), TypeScript, colocated tests |
269
269
  | Cursor rules | `.cursor/rules/cli-program.mdc`, `.cursor/rules/code.mdc` |
270
270
 
package/docs/configure.md CHANGED
@@ -27,7 +27,7 @@ brew uninstall <tap>/<key>
27
27
 
28
28
  ```bash
29
29
  just build
30
- just install-local # same formula as production; gen-dev-formula uses file:// URL (`just install` is an alias)
30
+ just install-local # same formula as production; temporary file:// URL during brew install (`just install` is an alias)
31
31
  ```
32
32
 
33
33
  Dev flow matches release: formula `install` copies the binary and generates completions; `post_install` runs `<key> configure --sync --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 sync-artifacts` to refresh agent artifacts without touching the binary.
@@ -51,7 +51,7 @@ just reinstall-local # fast binary swap (`install -m 755` into Cellar; run ins
51
51
  just uninstall # undo formula + agent artifacts (not app config)
52
52
  ```
53
53
 
54
- Dev and release use the **same formula** (`Formula/{key}.rb`, class name, install/post_install/test). `gen-dev-formula.ts` only changes `url`, `version`, and `sha256` to point at the local binary in `Formula/.staging/`. Release bumps restore the GitHub URL via `scripts/release.ts`.
54
+ Dev and release use the **same formula file** (`Formula/{key}.rb`, class name, install/post_install/test). `just install-local` temporarily overwrites it with a `file://` dev formula (staged under `Formula/.staging/`), runs `brew install`, then **restores** the release formula from backup. Release bumps rewrite the GitHub URL via `scripts/release.ts`.
55
55
 
56
56
  ### Developer uninstall
57
57
 
@@ -49,13 +49,12 @@ install: install-local
49
49
  sync-artifacts:
50
50
  just run configure --sync --yes
51
51
 
52
- # Dev install: build, write dev formula, symlink tap, brew install
52
+ # Dev install: build, dev formula (restored after brew), symlink tap, brew install
53
53
  install-local: build
54
- @bun scripts/gen-dev-formula.ts
55
54
  @brew untap {{tap}} 2>/dev/null || true
56
55
  mkdir -p {{tap_parent}}
57
56
  ln -sfn '{{justfile_directory()}}' {{tap_path}}
58
- brew install --formula {{tap}}/{{cli_key}}
57
+ bun scripts/with-dev-formula.ts -- brew install --formula {{tap}}/{{cli_key}}
59
58
  @echo ""
60
59
  @echo "Next: {{cli_key}} configure"
61
60
 
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env bun
2
+
3
+ /** Back up release formula, write dev formula, run a command, then restore. Usage: bun scripts/with-dev-formula.ts -- brew install … */
4
+
5
+ import { spawnSync } from "node:child_process";
6
+ import { createHash } from "node:crypto";
7
+ import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
8
+ import { join } from "node:path";
9
+ import { createIdentity } from "./create-identity.ts";
10
+ import { renderDevFormula } from "./formula-shared.ts";
11
+
12
+ const { key } = createIdentity;
13
+ const root = join(import.meta.dir, "..");
14
+ const stagingDir = join(root, "Formula", ".staging");
15
+ const stagingPath = join(stagingDir, key);
16
+ const formulaPath = join(root, "Formula", `${key}.rb`);
17
+ const backupPath = join(stagingDir, `${key}.rb.bak`);
18
+
19
+ function backupReleaseFormula(): void {
20
+ if (!existsSync(formulaPath)) {
21
+ return;
22
+ }
23
+ mkdirSync(stagingDir, { recursive: true });
24
+ copyFileSync(formulaPath, backupPath);
25
+ }
26
+
27
+ function restoreReleaseFormula(): void {
28
+ if (!existsSync(backupPath)) {
29
+ return;
30
+ }
31
+ copyFileSync(backupPath, formulaPath);
32
+ unlinkSync(backupPath);
33
+ }
34
+
35
+ function writeDevFormula(): void {
36
+ const distPath = join(root, "dist", key);
37
+ mkdirSync(stagingDir, { recursive: true });
38
+ copyFileSync(distPath, stagingPath);
39
+ chmodSync(stagingPath, 0o755);
40
+
41
+ const sha256 = createHash("sha256").update(readFileSync(stagingPath)).digest("hex");
42
+ const version = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).version as string;
43
+ writeFileSync(formulaPath, renderDevFormula(stagingPath, version, sha256), "utf8");
44
+ }
45
+
46
+ const sep = process.argv.indexOf("--");
47
+ if (sep === -1 || sep === process.argv.length - 1) {
48
+ process.stderr.write("Usage: bun scripts/with-dev-formula.ts -- <command...>\n");
49
+ process.exit(1);
50
+ }
51
+
52
+ const cmd = process.argv.slice(sep + 1);
53
+ let restored = false;
54
+
55
+ function restore(): void {
56
+ if (restored) {
57
+ return;
58
+ }
59
+ restored = true;
60
+ restoreReleaseFormula();
61
+ }
62
+
63
+ try {
64
+ backupReleaseFormula();
65
+ writeDevFormula();
66
+ const result = spawnSync(cmd[0], cmd.slice(1), { stdio: "inherit" });
67
+ process.exitCode = result.status === null ? 1 : result.status;
68
+ } finally {
69
+ restore();
70
+ }
71
+
72
+ if (process.exitCode === 0) {
73
+ console.log(`Restored ${formulaPath}`);
74
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argsbarg",
3
- "version": "5.1.4",
3
+ "version": "5.1.6",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "bun": ">=1.3"
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env bun
2
- /** Generate Formula/full-example.rb for local dev install (same formula as release; file:// URL only). */
3
-
4
- import { createHash } from "node:crypto";
5
- import { chmodSync, copyFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
- import { join } from "node:path";
7
- import { createIdentity } from "./create-identity.ts";
8
- import { renderDevFormula } from "./formula-shared.ts";
9
-
10
- const { key } = createIdentity;
11
- const root = join(import.meta.dir, "..");
12
- const distPath = join(root, "dist", key);
13
- const stagingDir = join(root, "Formula", ".staging");
14
- const stagingPath = join(stagingDir, key);
15
-
16
- mkdirSync(stagingDir, { recursive: true });
17
- copyFileSync(distPath, stagingPath);
18
- chmodSync(stagingPath, 0o755);
19
-
20
- const binary = readFileSync(stagingPath);
21
- const sha256 = createHash("sha256").update(binary).digest("hex");
22
- const version = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).version as string;
23
-
24
- const out = join(root, "Formula", `${key}.rb`);
25
- writeFileSync(out, renderDevFormula(stagingPath, version, sha256), "utf8");
26
- console.log(`Wrote ${out}`);