@usearete/a4 0.24.0 → 0.25.1

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.
Files changed (3) hide show
  1. package/README.md +6 -1
  2. package/bin/a4.js +30 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -55,7 +55,12 @@ the network at `npm install` time.
55
55
  Once installed, `a4` is on PATH in new shells. `npx @usearete/a4 <args>` also
56
56
  works in the same session: it runs the binary recorded in
57
57
  `~/.arete/receipt.json`, installing it silently first if needed, so
58
- `npx @usearete/a4 explore --json` prints only the command's JSON.
58
+ `npx @usearete/a4 explore --json` prints only the command's JSON. `install`
59
+ installs the CLI only when every argument after it is an `a4 self install`
60
+ option: `--install-dir`, `--no-modify-path`, `--json`, `--force`,
61
+ `--verbose`, `-y`/`--yes`, `--non-interactive`, `-c`/`--config`,
62
+ `--api-url` or `-h`/`--help`. Anything else is a project install, so
63
+ `npx @usearete/a4 install stack ore --ts` runs `a4 install stack ore --ts`.
59
64
 
60
65
  ```bash
61
66
  a4 init -y # arete.toml, AGENTS.md, CLAUDE.md, MCP config, skills
package/bin/a4.js CHANGED
@@ -8,7 +8,9 @@
8
8
  // minisign signature, then run `<tmp>/a4 self install --source npm ...`.
9
9
  // npx @usearete/a4 <anything else>
10
10
  // Run the binary recorded in ~/.arete/receipt.json (installing silently
11
- // first when there is no receipt) with the given argv.
11
+ // first when there is no receipt) with the given argv. This includes
12
+ // project installs such as `install stack ore --ts`: `install` followed
13
+ // by anything other than `a4 self install` options.
12
14
  //
13
15
  // No lifecycle scripts, no dependencies, no network access at `npm install`.
14
16
  // Design: docs/internal/agent-first-onboarding.md (WP3).
@@ -294,6 +296,31 @@ async function runInstall(passthrough = [], options = {}) {
294
296
  // ---------------------------------------------------------------------------
295
297
  // Launcher
296
298
 
299
+ // Options `a4 self install` accepts from the caller (the launcher passes
300
+ // --source, --checksums and --signature itself).
301
+ const SELF_INSTALL_FLAGS = new Set(["--no-modify-path", "--force", "--json", "--verbose", "-y", "--yes", "--non-interactive", "-h", "--help"]);
302
+ const SELF_INSTALL_VALUE_OPTIONS = new Set(["--install-dir", "-c", "--config", "--api-url"]);
303
+
304
+ // `install` installs the CLI itself only when every following argument is a
305
+ // self-install option. Anything else (`install stack ore --ts`,
306
+ // `install --locked`) is a project install, which `a4 self install` would
307
+ // reject, so it goes to the installed binary.
308
+ function isSelfInstall(argv) {
309
+ if (argv[0] !== "install") return false;
310
+ for (let i = 1; i < argv.length; i += 1) {
311
+ const arg = argv[i];
312
+ if (SELF_INSTALL_FLAGS.has(arg)) continue;
313
+ if (SELF_INSTALL_VALUE_OPTIONS.has(arg)) {
314
+ i += 1;
315
+ continue;
316
+ }
317
+ const eq = arg.indexOf("=");
318
+ if (arg.startsWith("--") && eq > 0 && SELF_INSTALL_VALUE_OPTIONS.has(arg.slice(0, eq))) continue;
319
+ return false;
320
+ }
321
+ return true;
322
+ }
323
+
297
324
  function runBinary(binary, argv, { env = process.env, stdio = "inherit" } = {}) {
298
325
  const result = spawnSync(binary, argv, { stdio, env: { ...env, [RECURSION_SENTINEL]: "1" }, encoding: "utf8" });
299
326
  if (result.error) {
@@ -310,7 +337,7 @@ async function launch(argv, options = {}) {
310
337
  log("Refusing to recursively launch the Arete CLI shim.");
311
338
  return 1;
312
339
  }
313
- if (argv[0] === "install") {
340
+ if (isSelfInstall(argv)) {
314
341
  return (await runInstall(argv.slice(1), { ...options, env, log })).status;
315
342
  }
316
343
 
@@ -346,6 +373,7 @@ module.exports = {
346
373
  RECURSION_SENTINEL,
347
374
  areteHome,
348
375
  downloadRelease,
376
+ isSelfInstall,
349
377
  launch,
350
378
  parseChecksums,
351
379
  parseMinisignPublicKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usearete/a4",
3
- "version": "0.24.0",
3
+ "version": "0.25.1",
4
4
  "description": "Arete CLI (a4) - Real-time Solana streaming pipelines",
5
5
  "bin": {
6
6
  "a4": "bin/a4.js"