argsbarg 5.1.5 → 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 +6 -3
- package/README.md +1 -1
- package/docs/configure.md +1 -1
- package/examples/full-example/justfile +1 -5
- package/examples/full-example/scripts/with-dev-formula.ts +41 -2
- package/package.json +1 -1
- package/examples/full-example/scripts/dev-formula.ts +0 -54
- package/examples/full-example/scripts/ensure-release-formula.ts +0 -41
- package/examples/full-example/scripts/gen-dev-formula.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -7,12 +7,14 @@ 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
|
+
|
|
10
13
|
## [5.1.5] - 2026-07-05
|
|
11
14
|
|
|
12
15
|
### Changed
|
|
13
16
|
|
|
14
|
-
- **`just install-local`** — back up release `Formula/{key}.rb`, write dev formula for `brew install`, then restore
|
|
15
|
-
- **`just ensure-release-formula`** — normalize release formula layout; restore from install-local backup or fail with `git restore` hint if a dev `file://` formula is left on disk.
|
|
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`).
|
|
16
18
|
|
|
17
19
|
## [5.1.4] - 2026-07-04
|
|
18
20
|
|
|
@@ -617,7 +619,8 @@ const cli = { ... } satisfies CliProgram; // or : CliProgram
|
|
|
617
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`).
|
|
618
620
|
- Imports: use `CliPositional` where needed; replace `CliOptionDef` with `CliOption` or `CliPositional` as appropriate.
|
|
619
621
|
|
|
620
|
-
[Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v5.1.
|
|
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
|
|
621
624
|
[5.1.5]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.1.5
|
|
622
625
|
[5.1.4]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.1.4
|
|
623
626
|
[5.1.3]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.1.3
|
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/
|
|
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;
|
|
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.
|
|
@@ -49,12 +49,8 @@ install: install-local
|
|
|
49
49
|
sync-artifacts:
|
|
50
50
|
just run configure --sync --yes
|
|
51
51
|
|
|
52
|
-
# Normalize release formula (fix leftover dev formula or stale layout)
|
|
53
|
-
ensure-release-formula:
|
|
54
|
-
bun scripts/ensure-release-formula.ts
|
|
55
|
-
|
|
56
52
|
# Dev install: build, dev formula (restored after brew), symlink tap, brew install
|
|
57
|
-
install-local: build
|
|
53
|
+
install-local: build
|
|
58
54
|
@brew untap {{tap}} 2>/dev/null || true
|
|
59
55
|
mkdir -p {{tap_parent}}
|
|
60
56
|
ln -sfn '{{justfile_directory()}}' {{tap_path}}
|
|
@@ -1,8 +1,47 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
|
|
2
3
|
/** Back up release formula, write dev formula, run a command, then restore. Usage: bun scripts/with-dev-formula.ts -- brew install … */
|
|
3
4
|
|
|
4
5
|
import { spawnSync } from "node:child_process";
|
|
5
|
-
import {
|
|
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
|
+
}
|
|
6
45
|
|
|
7
46
|
const sep = process.argv.indexOf("--");
|
|
8
47
|
if (sep === -1 || sep === process.argv.length - 1) {
|
|
@@ -31,5 +70,5 @@ try {
|
|
|
31
70
|
}
|
|
32
71
|
|
|
33
72
|
if (process.exitCode === 0) {
|
|
34
|
-
console.log(`Restored ${
|
|
73
|
+
console.log(`Restored ${formulaPath}`);
|
|
35
74
|
}
|
package/package.json
CHANGED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/** Backup, write, and restore the release formula for local dev Homebrew installs. */
|
|
2
|
-
|
|
3
|
-
import { createHash } from "node:crypto";
|
|
4
|
-
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { createIdentity } from "./create-identity.ts";
|
|
7
|
-
import { renderDevFormula } from "./formula-shared.ts";
|
|
8
|
-
|
|
9
|
-
const { key } = createIdentity;
|
|
10
|
-
const root = join(import.meta.dir, "..");
|
|
11
|
-
const stagingDir = join(root, "Formula", ".staging");
|
|
12
|
-
const stagingPath = join(stagingDir, key);
|
|
13
|
-
const formulaPath = join(root, "Formula", `${key}.rb`);
|
|
14
|
-
const backupPath = join(stagingDir, `${key}.rb.bak`);
|
|
15
|
-
|
|
16
|
-
/** Path to the committed release formula (`Formula/full-example.rb`). */
|
|
17
|
-
export function releaseFormulaPath(): string {
|
|
18
|
-
return formulaPath;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** Gitignored backup path used during `install-local`. */
|
|
22
|
-
export function releaseFormulaBackupPath(): string {
|
|
23
|
-
return backupPath;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Copy the release formula to `.staging` before overwriting with the dev formula. */
|
|
27
|
-
export function backupReleaseFormula(): void {
|
|
28
|
-
if (!existsSync(formulaPath)) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
mkdirSync(stagingDir, { recursive: true });
|
|
32
|
-
copyFileSync(formulaPath, backupPath);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** Restore the release formula from backup; no-op when no backup exists. */
|
|
36
|
-
export function restoreReleaseFormula(): void {
|
|
37
|
-
if (!existsSync(backupPath)) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
copyFileSync(backupPath, formulaPath);
|
|
41
|
-
unlinkSync(backupPath);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Stage `dist/full-example` and overwrite `Formula/full-example.rb` with a local `file://` dev formula. */
|
|
45
|
-
export function writeDevFormula(): void {
|
|
46
|
-
const distPath = join(root, "dist", key);
|
|
47
|
-
mkdirSync(stagingDir, { recursive: true });
|
|
48
|
-
copyFileSync(distPath, stagingPath);
|
|
49
|
-
chmodSync(stagingPath, 0o755);
|
|
50
|
-
|
|
51
|
-
const sha256 = createHash("sha256").update(readFileSync(stagingPath)).digest("hex");
|
|
52
|
-
const version = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).version as string;
|
|
53
|
-
writeFileSync(formulaPath, renderDevFormula(stagingPath, version, sha256), "utf8");
|
|
54
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/** Normalize `Formula/full-example.rb` to the release layout; recover from a leftover dev formula. */
|
|
3
|
-
|
|
4
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
-
import {
|
|
6
|
-
releaseFormulaPath,
|
|
7
|
-
restoreReleaseFormula,
|
|
8
|
-
releaseFormulaBackupPath,
|
|
9
|
-
} from "./dev-formula.ts";
|
|
10
|
-
import { renderReleaseFormula } from "./formula-shared.ts";
|
|
11
|
-
|
|
12
|
-
const formulaPath = releaseFormulaPath();
|
|
13
|
-
const backupPath = releaseFormulaBackupPath();
|
|
14
|
-
|
|
15
|
-
if (existsSync(backupPath)) {
|
|
16
|
-
restoreReleaseFormula();
|
|
17
|
-
console.log(`Restored release formula from ${backupPath}`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
let content = readFileSync(formulaPath, "utf8");
|
|
21
|
-
if (content.includes("file://")) {
|
|
22
|
-
process.stderr.write(
|
|
23
|
-
`Dev formula still present at ${formulaPath}. Run: git restore ${formulaPath}\n`,
|
|
24
|
-
);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const version = content.match(/^\s*version\s+"([^"]+)"/m)?.[1];
|
|
29
|
-
const sha256 = content.match(/^\s*sha256\s+"([^"]+)"/m)?.[1];
|
|
30
|
-
if (!version || !sha256) {
|
|
31
|
-
process.stderr.write(`Could not parse version/sha256 from ${formulaPath}\n`);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const normalized = renderReleaseFormula(version, sha256);
|
|
36
|
-
if (content !== normalized) {
|
|
37
|
-
writeFileSync(formulaPath, normalized, "utf8");
|
|
38
|
-
console.log(`Normalized ${formulaPath} (v${version})`);
|
|
39
|
-
} else {
|
|
40
|
-
console.log(`Release formula OK: ${formulaPath} (v${version})`);
|
|
41
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/** Generate Formula/full-example.rb for local dev install (file:// URL). Prefer `with-dev-formula.ts` via `just install-local`. */
|
|
3
|
-
|
|
4
|
-
import { releaseFormulaPath, writeDevFormula } from "./dev-formula.ts";
|
|
5
|
-
|
|
6
|
-
writeDevFormula();
|
|
7
|
-
console.log(`Wrote ${releaseFormulaPath()}`);
|