@kaynooo/cli-base 0.11.1 → 0.12.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/README.md CHANGED
@@ -18,12 +18,12 @@ base --keep tests/NewTest.php -- vendor/bin/phpunit tests/NewTest.php
18
18
  - The exit code is the command's; a last stderr line says which ref ran, `base: ran at HEAD (1a2b3c4), exit 1`.
19
19
  - Exit codes of its own: 2 a usage error, an unknown ref or a refused command, 127 a command that cannot start.
20
20
 
21
- ## proof
21
+ ## base proof
22
22
 
23
- `proof` shows that a test fails before a change and passes after it, the check `base` makes by hand: it runs the command at HEAD (or `--ref <rev>`) in the same temporary worktree as `base`, then in the working tree, both captured.
23
+ `base proof` shows that a test fails before a change and passes after it, the check `base` makes by hand: it runs the command at HEAD (or `--ref <rev>`) in the same temporary worktree as `base`, then in the working tree, both captured.
24
24
 
25
25
  ```sh
26
- proof --keep tests/NewTest.php -- vendor/bin/phpunit tests/NewTest.php
26
+ base proof --keep tests/NewTest.php -- vendor/bin/phpunit tests/NewTest.php
27
27
  ```
28
28
 
29
29
  - `--ref` defaults to the merge base with `origin/main` when HEAD is on a branch other than `main` that is ahead of it, else HEAD; `--ref HEAD` forces the old default. The `--json` `ref` and the line name the commit it resolved to.
package/dist/cli.js CHANGED
@@ -1263,30 +1263,6 @@ function commandPath(scope, argv) {
1263
1263
  }
1264
1264
  return path.length === 0 ? undefined : path.join(" ");
1265
1265
  }
1266
- async function runMain({ name, version, run, redact, usage }, argv = scriptArgs()) {
1267
- if (argv[0] === COMPLETE)
1268
- return printCandidates(leafCandidates(run, argv.slice(1)));
1269
- if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
1270
- return printCompletionScript(name, flagValue(argv));
1271
- if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
1272
- console.log(version ?? packageVersion());
1273
- return 0;
1274
- }
1275
- let code;
1276
- const started = performance.now();
1277
- try {
1278
- code = await run(argv);
1279
- } catch (error) {
1280
- code = reportThrown(name, error, redact, wantsJson(argv));
1281
- }
1282
- notifyEnd(name, code, performance.now() - started);
1283
- if (usage !== false) {
1284
- try {
1285
- recordUsage(usageEntry(name, undefined, argv, code));
1286
- } catch {}
1287
- }
1288
- return code;
1289
- }
1290
1266
  // ../kit/src/folders.ts
1291
1267
  var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
1292
1268
  // ../kit/src/secrets.ts
@@ -1569,7 +1545,7 @@ ${USAGE}`);
1569
1545
 
1570
1546
  // src/proof.ts
1571
1547
  import process18 from "process";
1572
- var USAGE2 = `proof [--ref <rev>] [--runs <n>] [--keep <path>...] [--timeout <duration>] [--no-link] [--json] -- <command> [args...]: runs the command at HEAD or another ref in a temporary worktree, then in the working tree, to show that a test fails before a change and passes after it
1548
+ var USAGE2 = `base proof [--ref <rev>] [--runs <n>] [--keep <path>...] [--timeout <duration>] [--no-link] [--json] -- <command> [args...]: runs the command at HEAD or another ref in a temporary worktree, then in the working tree, to show that a test fails before a change and passes after it
1573
1549
 
1574
1550
  The ref defaults to the merge base with the default branch of origin (origin/main unless origin/HEAD names another) when HEAD is on a branch ahead of it, else HEAD. --runs <n> runs the command n times now, for a flaky test, and every run must pass. --timeout kills a run that lasts longer (a hung test), which says nothing about the change and ends with exit 2.`;
1575
1551
  var EXITS = [[0, "the command fails before and passes in every run now"], [1, "it passes before too, fails in any run now, or passes before and fails now"], [2, "a usage error, an unknown ref, a command that cannot start, ends with exit 126, 127, 125 or a signal, or runs past --timeout"], [130, "interrupted (128 plus the signal)"]];
@@ -1610,7 +1586,7 @@ function describe(outcome, at, now) {
1610
1586
  }
1611
1587
  async function proof(argv) {
1612
1588
  const bare = argv[0] !== undefined && !argv[0].startsWith("-");
1613
- const parsed = parse(bare ? [] : argv, USAGE2, OPTIONS2, { rest: true, exits: EXITS, replaces: "running a test, stashing the change and running it again", examples: [["proof --keep tests/fix.test.ts -- bun test tests/fix.test.ts", "the new test fails at HEAD and passes now"], ["proof --ref v1.2.0 --keep tests/fix.test.ts -- bun test tests/fix.test.ts", "the same against a release"]] });
1589
+ const parsed = parse(bare ? [] : argv, USAGE2, OPTIONS2, { rest: true, exits: EXITS, replaces: "running a test, stashing the change and running it again", examples: [["base proof --keep tests/fix.test.ts -- bun test tests/fix.test.ts", "the new test fails at HEAD and passes now"], ["base proof --ref v1.2.0 --keep tests/fix.test.ts -- bun test tests/fix.test.ts", "the same against a release"]] });
1614
1590
  const given = bare ? argv : parsed.rest ?? [];
1615
1591
  if (given.length === 0 || parsed.positionals.length > 0)
1616
1592
  fail(`give the command after --
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-base",
3
3
  "type": "module",
4
- "version": "0.11.1",
4
+ "version": "0.12.0",
5
5
  "description": "base: a command run at HEAD or another ref in a temporary worktree, the working tree left untouched.",
6
6
  "author": "Kaynooo <contact@kaynooo.fr>",
7
7
  "license": "MIT",
8
- "homepage": "https://git.kaynooo.fr/kaynooo/cli/src/branch/main/packages/base#readme",
8
+ "homepage": "https://github.com/Kayno0o/cli/tree/main/packages/base#readme",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://git.kaynooo.fr/kaynooo/cli.git",
11
+ "url": "git+https://github.com/Kayno0o/cli.git",
12
12
  "directory": "packages/base"
13
13
  },
14
- "bugs": "https://git.kaynooo.fr/kaynooo/cli/issues",
14
+ "bugs": "https://github.com/Kayno0o/cli/issues",
15
15
  "keywords": [
16
16
  "claude-code",
17
17
  "cli",
@@ -20,8 +20,7 @@
20
20
  "stash"
21
21
  ],
22
22
  "bin": {
23
- "base": "./dist/cli.js",
24
- "proof": "./dist/proof-cli.js"
23
+ "base": "./dist/cli.js"
25
24
  },
26
25
  "files": [
27
26
  "dist"
@@ -33,9 +32,8 @@
33
32
  "registry": "https://git.kaynooo.fr/api/packages/kaynooo/npm/"
34
33
  },
35
34
  "scripts": {
36
- "build": "$npm_execpath build src/cli.ts src/proof-cli.ts --target bun --outdir dist",
37
- "base": "$npm_execpath src/cli.ts",
38
- "proof": "$npm_execpath src/proof-cli.ts"
35
+ "build": "$npm_execpath build src/cli.ts --target bun --outdir dist",
36
+ "base": "$npm_execpath src/cli.ts"
39
37
  },
40
38
  "devDependencies": {
41
39
  "@kaynooo/cli-kit": "0.41.0"