@kaynooo/cli-base 0.11.1 → 0.12.2
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 +5 -5
- package/dist/cli.js +414 -191
- package/package.json +9 -11
- package/dist/proof-cli.js +0 -1640
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# base
|
|
2
2
|
|
|
3
|
-
Runs a command at HEAD or another ref for Claude Code, where a session would otherwise reach for `git stash` to see whether a test fails without its change: `base` checks the ref out in a temporary worktree, runs the command there and removes it, the working tree
|
|
3
|
+
Runs a command at HEAD or another ref for Claude Code, where a session would otherwise reach for `git stash` to see whether a test fails without its change: `base` checks the ref out in a temporary worktree, runs the command there and removes it, the working tree's changes left out of the run.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
bun install -g @kaynooo/cli-base
|
|
@@ -11,19 +11,19 @@ base --keep tests/NewTest.php -- vendor/bin/phpunit tests/NewTest.php
|
|
|
11
11
|
|
|
12
12
|
- The ref is HEAD unless `--ref <rev>` names another commit; the command runs in the caller's folder of the worktree, `api/` in `api/`.
|
|
13
13
|
- `--keep <path>` (repeatable) copies a working-tree file or folder over, such as the new test of a red-then-green check; a path missing or outside the repository is refused before anything is created.
|
|
14
|
-
- The env files (`.env.local`, `.env.test.local`), `node_modules`, `vendor` and `.venv` the checkout has but git ignores are symlinked into the worktree, at any depth, so the run finds its dependencies and settings
|
|
14
|
+
- The env files (`.env.local`, `.env.test.local`), `node_modules`, `vendor` and `.venv` the checkout has but git ignores are symlinked into the worktree, at any depth, so the run finds its dependencies and settings: they are the working tree's own, and a write to them lands there. `--no-link` leaves them out for a fully separate run. Other ignored files (build output, caches) are not, so the ref's own are rebuilt; `--keep` copies one a run needs.
|
|
15
15
|
- The worktree is removed afterwards, on failure and on SIGINT, SIGTERM or SIGHUP too (passed on to the command), its links unlinked first so nothing is deleted through them.
|
|
16
16
|
- One argument holding spaces runs through `sh -c`: `base -- 'bun test a.test.ts | tail -5'`.
|
|
17
17
|
- A command run through `docker compose exec|run` or `docker exec` is refused: the container mounts the main checkout, not the temporary worktree, so it would not run at the ref.
|
|
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.
|