handoff-check 0.6.0 → 0.8.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/CHANGELOG.md +18 -0
- package/README.md +60 -18
- package/dist/cli.js +499 -107
- package/docs/agent-integration.md +4 -4
- package/docs/architecture.md +12 -0
- package/docs/decisions/0007-snapshot-diff-and-guided-setup.md +26 -0
- package/docs/decisions/0008-verified-command-runner.md +30 -0
- package/docs/development-plan.md +22 -3
- package/docs/explainability.md +4 -4
- package/docs/first-check.md +6 -6
- package/docs/lifecycle.md +15 -4
- package/docs/project-context.md +6 -6
- package/docs/releasing.md +4 -4
- package/docs/roadmap.md +8 -1
- package/docs/snapshot-diff-and-setup.md +74 -0
- package/docs/verified-commands.md +104 -0
- package/package.json +1 -1
- package/schemas/diff.v1.schema.json +121 -0
- package/skills/handoff-check/SKILL.md +30 -0
|
@@ -9,8 +9,8 @@ infers rules from a summary.
|
|
|
9
9
|
From the consuming repository root:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npx handoff-check@0.
|
|
13
|
-
npx handoff-check@0.
|
|
12
|
+
npx handoff-check@0.8.0 init --scope staging --agent both --dry-run
|
|
13
|
+
npx handoff-check@0.8.0 init --scope staging --agent both
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Choose `codex`, `claude`, `both` (default), or `none`. Generated integrations:
|
|
@@ -39,8 +39,8 @@ npm pack
|
|
|
39
39
|
From a separate consuming project, substitute the actual absolute tarball path:
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
npx --offline --yes --package=/absolute/path/handoff-check-0.
|
|
43
|
-
npx --offline --yes --package=/absolute/path/handoff-check-0.
|
|
42
|
+
npx --offline --yes --package=/absolute/path/handoff-check-0.8.0.tgz handoff-check init --scope staging --agent both
|
|
43
|
+
npx --offline --yes --package=/absolute/path/handoff-check-0.8.0.tgz handoff-check verify --format json --require-content
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Bun is not required for these consumer commands. Generated agent commands use the
|
package/docs/architecture.md
CHANGED
|
@@ -30,6 +30,18 @@ then calls the same verifier. Hook-config prints a mergeable snippet, never writ
|
|
|
30
30
|
host settings. Advisory host transport success is distinct from verification.
|
|
31
31
|
See decisions/0005-local-diagnostics-and-lifecycle.md.
|
|
32
32
|
|
|
33
|
+
Diff compares two validated saved handoffs without config, manifest, clock or
|
|
34
|
+
lifecycle inference. Setup authors new bound files from explicit answers using
|
|
35
|
+
the existing parsers and snapshot core, previews exact bytes, and creates files
|
|
36
|
+
exclusively only after adoption. Existing init remains stable. See ADR 0007.
|
|
37
|
+
|
|
38
|
+
Run is an opt-in CLI process adapter: it reads regular local inputs through the
|
|
39
|
+
same selectors/parsers, requires current-clock content/nonempty verification,
|
|
40
|
+
then spawns explicit argv with shell false only on success. Child stdio/cwd/env
|
|
41
|
+
are inherited and exit codes preserved. It never expands the pure verifier into
|
|
42
|
+
an execution engine. See ADR 0008 for cancellation, time-of-check/time-of-use and
|
|
43
|
+
platform limits; the supplied program's side effects are outside verification.
|
|
44
|
+
|
|
33
45
|
Exit codes: 0 for verified IDs, 1 for rule mismatches, 2 for invalid input or an
|
|
34
46
|
unreadable input file. JSON output is intended for agent adapters and automation.
|
|
35
47
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# ADR 0007: explicit snapshot diff and new-project guided setup
|
|
2
|
+
|
|
3
|
+
Status: accepted for 0.7.0.
|
|
4
|
+
|
|
5
|
+
Compare two validated content-aware handoffs, rather than inventing a manifest
|
|
6
|
+
history or reading agent transcripts. Require identical scope and project binding;
|
|
7
|
+
permit unbound v2/v3 interoperability and same-project v4 mode interoperability.
|
|
8
|
+
Compare revision/hash references with existing canonical semantics. Only two-sided
|
|
9
|
+
retention enables field details through the shared field comparator. Metadata and
|
|
10
|
+
retention-only changes are ignored. No lifecycle inference, chronology assertion,
|
|
11
|
+
source authentication or baseline adoption follows from diff. JSON is independently
|
|
12
|
+
versioned; exits 0/1/2 mean unchanged/different/invalid.
|
|
13
|
+
|
|
14
|
+
Keep old init stable. A separate terminal-only setup builds new config2/manifest3/
|
|
15
|
+
retained-handoff4 files with explicit identity, environment profiles and one real
|
|
16
|
+
user-authored global rule. It reuses strict parsers and the pure snapshot core.
|
|
17
|
+
The preview is exactly the approved bytes. Only affirmative yes writes; all target
|
|
18
|
+
conflicts are preflighted and exclusive creation prevents overwrites. No nested
|
|
19
|
+
paths or instruction append operations are offered, so existing init integration
|
|
20
|
+
planning remains separate. Writes are explicitly nontransactional with a written
|
|
21
|
+
path list on failure. No migrations, automatic baseline refresh, package installs,
|
|
22
|
+
host setting edits, skills or CI installs are implicit.
|
|
23
|
+
|
|
24
|
+
The bounded onboarding scope trades a general configuration editor for a short
|
|
25
|
+
reviewable first meaningful check. New owner/review metadata, source file watching,
|
|
26
|
+
critical-command wrappers and other host adapters remain separate future proposals.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# ADR 0008: current-clock verification before an explicit command
|
|
2
|
+
|
|
3
|
+
Status: accepted for 0.8.0.
|
|
4
|
+
|
|
5
|
+
Session-start checks become stale before later operations. Add an opt-in `run`
|
|
6
|
+
CLI adapter that uses existing config/profile selectors, strict input parsers
|
|
7
|
+
and the same pure verifier immediately before spawning one explicit executable.
|
|
8
|
+
Require content-aware input, a nonempty active set and the current clock; offer
|
|
9
|
+
no as-of/force/skip/policy override. Read each input once; never refresh a baseline.
|
|
10
|
+
No new manifest/handoff or verification result schema is needed.
|
|
11
|
+
|
|
12
|
+
Require `run` first and an explicit `--` boundary. Parse only preceding wrapper
|
|
13
|
+
options, pass the trailing executable/argv as an array with shell false, and
|
|
14
|
+
inherit cwd/environment/stdio. Do not infer the command from config or rules.
|
|
15
|
+
Keep stdout available for the child and emit phase diagnostics to shared stderr.
|
|
16
|
+
Block mismatch with 1, invalid preflight/launch with 2; preserve all child exit
|
|
17
|
+
codes after launch. Signal forwarding is best-effort to a direct child only;
|
|
18
|
+
there is no descendant supervision, forced termination or command timeout.
|
|
19
|
+
Cancel preflight without launch and bound stalled asynchronous reads with an
|
|
20
|
+
event-loop watchdog removed before spawning. Document platform and timing limits.
|
|
21
|
+
|
|
22
|
+
This narrows the gap between a declared-rule check and an explicitly requested
|
|
23
|
+
operation. It is not atomic with file changes, a model compliance check, an
|
|
24
|
+
authorization boundary, or a sandbox. The chosen program retains ordinary access
|
|
25
|
+
and may itself interpret commands or perform multiple actions. Existing verify,
|
|
26
|
+
init, snapshot, diff, setup and advisory lifecycle behavior stay unchanged.
|
|
27
|
+
|
|
28
|
+
Owner/review-by metadata and explicit source-file checks remain separate future
|
|
29
|
+
work: overdue review must not silently deactivate rules, and source edits do not
|
|
30
|
+
prove semantic policy changes. Do not bundle them into the command gate.
|
package/docs/development-plan.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Development plan
|
|
2
2
|
|
|
3
|
-
Status:
|
|
4
|
-
0.6 project/profile/report support is also implemented; later milestones proposed.
|
|
3
|
+
Status: milestones through 0.8 are implemented; later milestones remain proposed.
|
|
5
4
|
Research reviewed: 2026-11-24. Version labels below are targets, not release promises.
|
|
6
5
|
|
|
7
6
|
## Product direction
|
|
@@ -127,7 +126,24 @@ Acceptance:
|
|
|
127
126
|
- Reports are described as local records, not authenticated attestations or proof
|
|
128
127
|
of agent compliance. Revalidate changed inputs rather than trusting old reports.
|
|
129
128
|
|
|
130
|
-
##
|
|
129
|
+
## 0.7: visible changes and first meaningful check (implemented)
|
|
130
|
+
|
|
131
|
+
Implemented under [ADR 0007](decisions/0007-snapshot-diff-and-guided-setup.md):
|
|
132
|
+
explicit two-snapshot diff with strict scope/project matching, hash-based changes
|
|
133
|
+
and optional retained field details; terminal-only new-project setup with exact
|
|
134
|
+
preview and affirmative adoption of one real global rule. Existing init/verify
|
|
135
|
+
contracts stay unchanged. See [usage](snapshot-diff-and-setup.md).
|
|
136
|
+
|
|
137
|
+
## 0.8: fresh verification before critical commands (implemented)
|
|
138
|
+
|
|
139
|
+
Implemented under [ADR 0008](decisions/0008-verified-command-runner.md): opt-in
|
|
140
|
+
run wraps one explicit executable with current-clock content/nonempty checks
|
|
141
|
+
using the existing verifier. Invalid/mismatched preflight never starts the child;
|
|
142
|
+
successful launch inherits process context and preserves results. It is not a
|
|
143
|
+
sandbox, permission grant, atomic transaction or enforcement outside the wrapper.
|
|
144
|
+
See [usage and limits](verified-commands.md). Existing contracts remain compatible.
|
|
145
|
+
|
|
146
|
+
## 0.9 candidate: rule maintenance, gated by pilot demand
|
|
131
147
|
|
|
132
148
|
Priority: medium. Keep source inspection separate from normal verify semantics.
|
|
133
149
|
|
|
@@ -136,6 +152,9 @@ Priority: medium. Keep source inspection separate from normal verify semantics.
|
|
|
136
152
|
rule's meaning changed. Decide full-file versus section binding deliberately.
|
|
137
153
|
- Consider owner/review-by metadata. Overdue review is distinct from rule expiry;
|
|
138
154
|
it must not silently deactivate a restriction.
|
|
155
|
+
- Decide whether review metadata belongs in a separate versioned registry or a
|
|
156
|
+
new content contract before implementation. Keep existing canonical hashes and
|
|
157
|
+
baseline meaning stable; provide migration and independent maintenance output.
|
|
139
158
|
- Consider explicitly declared relationships such as conflicts/requires. Validate
|
|
140
159
|
these deterministically; defer free-text contradiction inference.
|
|
141
160
|
|
package/docs/explainability.md
CHANGED
|
@@ -6,8 +6,8 @@ No service, model call or API key is needed.
|
|
|
6
6
|
## Understand the active set
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npx handoff-check@0.
|
|
10
|
-
npx handoff-check@0.
|
|
9
|
+
npx handoff-check@0.8.0 explain --format json
|
|
10
|
+
npx handoff-check@0.8.0 explain --scope production --format markdown
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Explain reads the manifest but not the handoff. Every rule has an applicability
|
|
@@ -20,8 +20,8 @@ exits 0 even with zero active rules: use verify to compare a handoff.
|
|
|
20
20
|
At a reviewed handoff creation, after upgrading all consumers to 0.4+:
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
|
-
npx handoff-check@0.
|
|
24
|
-
npx handoff-check@0.
|
|
23
|
+
npx handoff-check@0.8.0 snapshot --task "Review staging migrations" --include-content --output handoff.reviewed.json
|
|
24
|
+
npx handoff-check@0.8.0 verify --handoff handoff.reviewed.json --require-content --require-active --format markdown
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Review the new file before explicitly adopting it in config. Snapshot never
|
package/docs/first-check.md
CHANGED
|
@@ -8,8 +8,8 @@ Bun, API keys, and GitHub Actions are not required. All rules below are syntheti
|
|
|
8
8
|
```sh
|
|
9
9
|
mkdir handoff-check-demo
|
|
10
10
|
cd handoff-check-demo
|
|
11
|
-
npx handoff-check@0.
|
|
12
|
-
npx handoff-check@0.
|
|
11
|
+
npx handoff-check@0.8.0 init --scope staging --agent none
|
|
12
|
+
npx handoff-check@0.8.0 verify --require-content
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
The starter passes with `PASS (EMPTY)` and `0 active constraints checked`.
|
|
@@ -41,7 +41,7 @@ does not fetch it or check the contents of a referenced document.
|
|
|
41
41
|
Before capturing a baseline, run:
|
|
42
42
|
|
|
43
43
|
```sh
|
|
44
|
-
npx handoff-check@0.
|
|
44
|
+
npx handoff-check@0.8.0 verify --require-content --require-active
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
Expect `MISSING MIGRATION-REVIEW`, one active constraint, and exit 1. The old
|
|
@@ -50,8 +50,8 @@ starter handoff does not include the new rule yet.
|
|
|
50
50
|
## Capture and verify a reviewed baseline
|
|
51
51
|
|
|
52
52
|
```sh
|
|
53
|
-
npx handoff-check@0.
|
|
54
|
-
npx handoff-check@0.
|
|
53
|
+
npx handoff-check@0.8.0 snapshot --task "Review staging migration" --output handoff.reviewed.json
|
|
54
|
+
npx handoff-check@0.8.0 verify --handoff handoff.reviewed.json --require-content --require-active
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
Review the generated file before relying on it. The verification command should
|
|
@@ -70,7 +70,7 @@ In `constraints.json`, change the description to
|
|
|
70
70
|
handoff unchanged, then run:
|
|
71
71
|
|
|
72
72
|
```sh
|
|
73
|
-
npx handoff-check@0.
|
|
73
|
+
npx handoff-check@0.8.0 verify --handoff handoff.reviewed.json --require-content --require-active --format json
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
Expect `status: "mismatch"`, `activeConstraintCount: 1`, a `CHANGED` finding, and
|
package/docs/lifecycle.md
CHANGED
|
@@ -6,8 +6,8 @@ calls, source fetches, API keys or transcript access.
|
|
|
6
6
|
## Diagnose the intended repository/worktree root
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npx handoff-check@0.
|
|
10
|
-
npx handoff-check@0.
|
|
9
|
+
npx handoff-check@0.8.0 doctor --format json
|
|
10
|
+
npx handoff-check@0.8.0 doctor --host claude
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Doctor reports resolved input paths/versions, managed integrations/pins and
|
|
@@ -22,10 +22,10 @@ host settings and effective trust are not comprehensively inspected.
|
|
|
22
22
|
|
|
23
23
|
1. Initialize/review inputs and deliberately adopt a content-aware baseline.
|
|
24
24
|
2. Install the exact package in the consuming project. For npm:
|
|
25
|
-
`npm install --save-dev --save-exact handoff-check@0.
|
|
25
|
+
`npm install --save-dev --save-exact handoff-check@0.8.0`. Installation uses
|
|
26
26
|
the registry; the hook later uses only this local package. Temporary npx caches
|
|
27
27
|
and global installs do not meet that prerequisite.
|
|
28
|
-
3. Run `npx handoff-check@0.
|
|
28
|
+
3. Run `npx handoff-check@0.8.0 hook-config --host claude` and inspect the JSON.
|
|
29
29
|
4. In an editor, merge the returned SessionStart entries into the existing
|
|
30
30
|
`.claude/settings.json` hooks object. Preserve other events, handlers,
|
|
31
31
|
permissions and settings. Do not replace the whole file or blindly redirect
|
|
@@ -66,6 +66,17 @@ enterprise policies can disable hooks or require review.
|
|
|
66
66
|
|
|
67
67
|
## Critical actions need a fresh check
|
|
68
68
|
|
|
69
|
+
From 0.8.0, use the dedicated command wrapper with the reviewed local package:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
node ./node_modules/handoff-check/dist/cli.js run --profile production -- node scripts/preflight-demo.js
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Choose a configured profile and explicit reviewed program. The wrapper requires
|
|
76
|
+
nonempty content-aware inputs and the current clock, then preserves the child
|
|
77
|
+
result. It blocks only commands invoked through it, not other agent actions.
|
|
78
|
+
See [verified commands](verified-commands.md) for timing, process and platform limits.
|
|
79
|
+
|
|
69
80
|
In Bash with the project-local package already installed:
|
|
70
81
|
|
|
71
82
|
```sh
|
package/docs/project-context.md
CHANGED
|
@@ -56,10 +56,10 @@ Author `.handoff-check.json` as config v2:
|
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
```sh
|
|
59
|
-
npx handoff-check@0.
|
|
60
|
-
npx handoff-check@0.
|
|
61
|
-
npx handoff-check@0.
|
|
62
|
-
npx handoff-check@0.
|
|
59
|
+
npx handoff-check@0.8.0 explain --profile stage
|
|
60
|
+
npx handoff-check@0.8.0 snapshot --profile stage --task "Review staging work" --output handoffs/staging.reviewed.json
|
|
61
|
+
npx handoff-check@0.8.0 verify --profile stage --require-content
|
|
62
|
+
npx handoff-check@0.8.0 doctor --profile stage
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
These assume you deliberately adopted a baseline at the configured handoff path;
|
|
@@ -83,8 +83,8 @@ bindings produce NOT VERIFIED context; hook transport success is not a pass.
|
|
|
83
83
|
## Record exactly what was checked
|
|
84
84
|
|
|
85
85
|
```sh
|
|
86
|
-
npx handoff-check@0.
|
|
87
|
-
npx handoff-check@0.
|
|
86
|
+
npx handoff-check@0.8.0 verify --profile stage --require-content --report --format json
|
|
87
|
+
npx handoff-check@0.8.0 verify --profile stage --require-content --report --git-context --format markdown
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
--report is optional and verify-only. It adds package version, requested policies,
|
package/docs/releasing.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Releasing
|
|
2
2
|
|
|
3
3
|
The npm package name is `handoff-check`; the binary is `handoff-check` and the
|
|
4
|
-
current version is 0.
|
|
4
|
+
current version is 0.8.0. The package is already published; subsequent releases
|
|
5
5
|
use the configured trusted publisher and the reviewed-artifact process below.
|
|
6
6
|
|
|
7
7
|
## Release a reviewed version
|
|
@@ -19,12 +19,12 @@ use the configured trusted publisher and the reviewed-artifact process below.
|
|
|
19
19
|
publish-run artifact and compare it before claiming artifact continuity.
|
|
20
20
|
For first-publication bootstrap or an explicitly chosen manual release, use
|
|
21
21
|
`npm login` and publish the reviewed tarball directly with
|
|
22
|
-
`npm publish /absolute/path/handoff-check-0.
|
|
22
|
+
`npm publish /absolute/path/handoff-check-0.8.0.tgz --ignore-scripts --access public`.
|
|
23
23
|
Complete interactive two-factor authentication directly with npm.
|
|
24
24
|
5. Verify registry name, version, binary and integrity, then test
|
|
25
|
-
`npx --yes handoff-check@0.
|
|
25
|
+
`npx --yes handoff-check@0.8.0 --version` and fresh-project init/verify using a
|
|
26
26
|
new package cache and the public registry, rather than the local tarball.
|
|
27
|
-
6. Create tag `v0.
|
|
27
|
+
6. Create tag `v0.8.0` and a GitHub release on the reviewed main commit, attach the
|
|
28
28
|
same tarball, and describe features, requirements and known limits.
|
|
29
29
|
|
|
30
30
|
Publishing is immutable for a given npm name/version. Fix failed candidates on a
|
package/docs/roadmap.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Roadmap
|
|
2
2
|
|
|
3
|
+
Implemented in 0.8.0: explicit current-clock verification before a supplied
|
|
4
|
+
command, with mandatory content/nonempty checks and preserved child results.
|
|
5
|
+
See [verified commands](verified-commands.md).
|
|
6
|
+
|
|
7
|
+
Implemented in 0.7.0: explicit saved-snapshot diff and guided new-project setup.
|
|
8
|
+
See [snapshot diff and setup](snapshot-diff-and-setup.md).
|
|
9
|
+
|
|
3
10
|
Implemented in 0.6.0: opt-in portable project IDs, explicit environment profiles,
|
|
4
11
|
and verification metadata reports with separately requested Git context.
|
|
5
12
|
See [project/profile/report guide](project-context.md).
|
|
@@ -9,7 +16,7 @@ and configuration snippet, host matrix and critical-action recipes.
|
|
|
9
16
|
See [lifecycle setup](lifecycle.md). Codex/Cursor adapters remain unshipped.
|
|
10
17
|
|
|
11
18
|
See the [development plan](development-plan.md) for research evidence, proposed
|
|
12
|
-
|
|
19
|
+
milestones, dependencies, pilot validation, and acceptance criteria.
|
|
13
20
|
The plan distinguishes implemented releases from proposed milestones and dates.
|
|
14
21
|
|
|
15
22
|
Implemented in 0.4.0: shared-lifecycle explain, opt-in retained-content v3
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Snapshot comparison and guided setup
|
|
2
|
+
|
|
3
|
+
## Start a new project interactively
|
|
4
|
+
|
|
5
|
+
With Node.js 22 or newer, run in the intended project root:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npx handoff-check@0.8.0 setup
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Enter a portable project ID, comma-separated environments, a rule ID, a real rule
|
|
12
|
+
that applies to **all** those environments, its source reference, and a task.
|
|
13
|
+
Source references are stored as text and never fetched. Setup prints the exact
|
|
14
|
+
config v2, bound manifest v3, and retained v4 baseline for each environment. Full
|
|
15
|
+
rule descriptions and sources are retained: review sensitive content before
|
|
16
|
+
committing or sharing the files. Type `yes` only after reviewing and adopting them.
|
|
17
|
+
Any other answer cancels without writes. Ctrl-C/EOF before approval fails with
|
|
18
|
+
exit 2 and no writes. `setup --dry-run` asks the same questions and previews without
|
|
19
|
+
asking for adoption or writing files. Captured time is fixed once for that plan;
|
|
20
|
+
it is informational, not an evaluation time to reuse on resume.
|
|
21
|
+
|
|
22
|
+
Setup requires an interactive stdin/stdout terminal. It never installs packages,
|
|
23
|
+
agent skills, hooks, CI or host settings. Existing config, manifest or generated
|
|
24
|
+
handoff paths (including symlinks) cause refusal before writes. It is deliberately
|
|
25
|
+
new-project-only; rerunning refuses existing files rather than refreshing them.
|
|
26
|
+
Writes use exclusive creation and are not transactional: an I/O failure lists
|
|
27
|
+
already written paths. Inspect those files before retrying.
|
|
28
|
+
|
|
29
|
+
For environments `staging,production`, setup creates `.handoff-check.json`,
|
|
30
|
+
`constraints.json`, `handoff-staging.json`, and `handoff-production.json`. There
|
|
31
|
+
is no default profile. Choose the intended environment explicitly:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npx handoff-check@0.8.0 verify --profile staging --require-content --require-active
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Add environment-specific rules later through deliberate review and capture;
|
|
38
|
+
the first global rule is authored by you, never inferred. For automation use
|
|
39
|
+
`init --scope <scope> --agent none` instead; it retains its existing unbound,
|
|
40
|
+
zero-rule starter behavior. For existing bound/profile projects, edit and review
|
|
41
|
+
integration files explicitly using [lifecycle setup](lifecycle.md) and the shipped
|
|
42
|
+
portable skill. Do not use setup as a migration or baseline-repair command.
|
|
43
|
+
|
|
44
|
+
## Compare two saved snapshots
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
npx handoff-check@0.8.0 diff --before handoff.saved.json --after handoff.next.json
|
|
48
|
+
npx handoff-check@0.8.0 diff --before handoff.saved.json --after handoff.next.json --format json
|
|
49
|
+
npx handoff-check@0.8.0 diff --before handoff.saved.json --after handoff.next.json --format markdown
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Both operands are strictly validated handoff files. Unbound v2/v3 can be compared
|
|
53
|
+
to each other; bound v4 can compare hashes/retained modes within the same project.
|
|
54
|
+
Legacy v1, mixed bound/unbound, different projects and different scopes fail with
|
|
55
|
+
exit 2. The command accepts only `--before`, `--after`, and `--format`; it reads
|
|
56
|
+
neither config nor manifest, uses no clock, and accesses no Git/network/agent data.
|
|
57
|
+
|
|
58
|
+
IDs present only after are ADDED; only before are REMOVED. Same-ID differences in
|
|
59
|
+
revision or canonical content hash are CHANGED, even without a revision bump.
|
|
60
|
+
Remaining IDs count as unchanged. Output sorts IDs and uses the existing fixed
|
|
61
|
+
field order. Hashes are always shown for changed rules. Field details appear only
|
|
62
|
+
when both snapshots retain content; a missing optional field is represented as
|
|
63
|
+
null. No text is reconstructed from hashes. Reordering, task, capture-time and
|
|
64
|
+
retention-mode-only differences do not count as rule changes. The operands set
|
|
65
|
+
direction even if their capture times are reversed.
|
|
66
|
+
|
|
67
|
+
Exit codes: **0** unchanged declarations; **1** rule differences; **2** invalid
|
|
68
|
+
arguments/input or unreadable files. JSON uses its own schemaVersion 1 contract
|
|
69
|
+
([schema](../schemas/diff.v1.schema.json)), independent of verification results.
|
|
70
|
+
`beforeCount`/`afterCount` count declared references, not current active rules.
|
|
71
|
+
Removed does not mean revoked, expired, authorized removal, or dropped from agent
|
|
72
|
+
memory. This is a comparison of saved declarations. Run verify against the current
|
|
73
|
+
reviewed manifest before resuming work; diff is not authorization or compliance proof.
|
|
74
|
+
Both commands leave existing inputs intact. Never redirect diff output onto inputs.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Verify immediately before a command
|
|
2
|
+
|
|
3
|
+
`run` performs a current-clock verification and starts an explicitly supplied
|
|
4
|
+
executable only after a nonempty, content-aware handoff passes. It calls the same
|
|
5
|
+
verifier as `verify`; the pure core and existing input formats are unchanged.
|
|
6
|
+
|
|
7
|
+
With Node.js 22 or newer, use an existing reviewed project configuration:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx handoff-check@0.8.0 run --profile production -- node scripts/preflight-demo.js
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The profile is an example: select the intended configured profile, or use
|
|
14
|
+
`--scope <scope>` with optional `--constraints <path>`/`--handoff <path>`.
|
|
15
|
+
`--config <path>` selects an explicit config. Config paths resolve relative to
|
|
16
|
+
that config, CLI input paths relative to the invocation directory. The child
|
|
17
|
+
always inherits the invocation working directory, environment and stdin/stdout/
|
|
18
|
+
stderr; selecting a config elsewhere does not move the child. Project/scope
|
|
19
|
+
binding and profile override restrictions are identical to verify.
|
|
20
|
+
|
|
21
|
+
Use a reviewed installed or project-local version for critical workflows so a
|
|
22
|
+
network download is not part of each operation. `npx` installation may access the
|
|
23
|
+
registry; `run` itself performs no network, Git or model calls. The supplied
|
|
24
|
+
program may access networks or mutate files as any normal command can.
|
|
25
|
+
|
|
26
|
+
## Command boundary and mandatory policy
|
|
27
|
+
|
|
28
|
+
`run` must be the first CLI argument. A literal `--` separates wrapper options
|
|
29
|
+
from the executable and its argv. Everything after it is passed literally,
|
|
30
|
+
including `--help`, `--version`, `--profile`, spaces, empty strings and shell
|
|
31
|
+
metacharacters. The wrapper uses `spawn` with `shell: false`; it never constructs
|
|
32
|
+
a command string or reads an executable from project rules/config.
|
|
33
|
+
|
|
34
|
+
Only `--config`, `--profile`, `--scope`, `--constraints`, and `--handoff` are
|
|
35
|
+
supported wrapper options. `run --help` prints usage without starting a child.
|
|
36
|
+
`--as-of`, policy overrides, output/report formats and force/skip modes are not
|
|
37
|
+
supported. Content-aware v2/v3/v4 and at least one active constraint are mandatory.
|
|
38
|
+
An empty starter that passes ordinary verify therefore cannot start a command.
|
|
39
|
+
There is no automatic migration, snapshot refresh, baseline adoption or input edit.
|
|
40
|
+
|
|
41
|
+
The evaluation clock is captured after input reads, immediately before the pure
|
|
42
|
+
verification. Missing/changed/stale declarations produce a blocked result; invalid
|
|
43
|
+
JSON, mismatched binding/scope, unsupported legacy v1 and unreadable files fail
|
|
44
|
+
without starting the child. A five-second event-loop watchdog bounds stalled
|
|
45
|
+
asynchronous preflight reads; it is removed before command launch, not applied as
|
|
46
|
+
a runtime limit to the command. Run opens inputs nonblocking and requires regular
|
|
47
|
+
files (file symlinks to regular files remain supported); FIFOs/devices/directories
|
|
48
|
+
are rejected. The watchdog cannot preempt synchronous JavaScript or guarantee
|
|
49
|
+
termination of an unresponsive operating-system/filesystem operation.
|
|
50
|
+
|
|
51
|
+
Executable lookup uses the inherited PATH; a path containing spaces is one argv
|
|
52
|
+
token. On Windows, prefer `node path/to/script.js` or a native executable.
|
|
53
|
+
`.cmd`/`.bat` scripts require a command interpreter and have no implicit shell
|
|
54
|
+
fallback. An explicitly chosen shell is itself the supplied program; its own
|
|
55
|
+
parsing and side effects are the caller's responsibility.
|
|
56
|
+
|
|
57
|
+
## Diagnostics and exit codes
|
|
58
|
+
|
|
59
|
+
Wrapper diagnostics go to stderr, leaving stdout for the supplied program:
|
|
60
|
+
|
|
61
|
+
- `RUN CHECKING`: preflight begun; no child has started.
|
|
62
|
+
- `RUN BLOCKED`: mismatch, including finding codes/IDs; exit 1, no child.
|
|
63
|
+
- `INVALID` or `RUN INVALID`: invalid invocation/input or stalled preflight;
|
|
64
|
+
exit 2, no child.
|
|
65
|
+
- `RUN VERIFIED`: count, scope, evaluation time and optional project/profile;
|
|
66
|
+
verification passed, but launch has not yet been proven.
|
|
67
|
+
- `RUN LAUNCH ERROR`: executable could not start; exit 2.
|
|
68
|
+
- `RUN STARTED`: spawn succeeded; wait for the program's result.
|
|
69
|
+
- `RUN EXIT`: child exit code is preserved, including 1, 2, 42 or 127. After
|
|
70
|
+
launch, codes 1/2 describe the child, not a new verifier finding.
|
|
71
|
+
|
|
72
|
+
Child stderr shares the same inherited stream and may interleave with diagnostics;
|
|
73
|
+
these prefixes are human diagnostics, not an authenticated machine protocol.
|
|
74
|
+
No full argv, rule descriptions or source references are printed by the wrapper.
|
|
75
|
+
For structured verification details run `verify --format json` separately.
|
|
76
|
+
|
|
77
|
+
On POSIX, SIGINT/SIGTERM received during preflight cancel with 130/143 and no
|
|
78
|
+
launch. While running, forwarding is best-effort to the direct child only. The
|
|
79
|
+
wrapper waits for its exit; a handler's chosen exit code wins. An unhandled child
|
|
80
|
+
signal maps to 128 plus the OS signal number (unknown signals fall back to 129).
|
|
81
|
+
Terminal process groups may deliver a signal to both processes independently.
|
|
82
|
+
Windows console/termination semantics differ and POSIX forwarding is not promised.
|
|
83
|
+
There is no automatic forced termination, command timeout or descendant cleanup;
|
|
84
|
+
a child ignoring a signal can keep running. `RUN PROCESS ERROR` or forwarding
|
|
85
|
+
failure diagnostics after launch do not reclassify it as a launch failure.
|
|
86
|
+
|
|
87
|
+
## Test the gate without running a real operation
|
|
88
|
+
|
|
89
|
+
In a disposable configured project with a reviewed active baseline:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
npx handoff-check@0.8.0 run --profile production -- node -e 'console.log("example command started")'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Edit a rule description in that disposable manifest without refreshing its saved
|
|
96
|
+
baseline, then repeat. Expect `RUN BLOCKED CHANGED`, exit 1, and no example output.
|
|
97
|
+
Review and resolve the difference explicitly before real work. The command is
|
|
98
|
+
never retried automatically.
|
|
99
|
+
|
|
100
|
+
This is a preflight gate around one explicitly invoked command, not a sandbox,
|
|
101
|
+
authorization grant or proof of behavior. Inputs can change or expire after the
|
|
102
|
+
check, and the supplied program can perform additional actions or spawn children.
|
|
103
|
+
It cannot stop agent actions outside this wrapper. Re-run it per intended action;
|
|
104
|
+
a previous pass is not a reusable execution permission.
|
package/package.json
CHANGED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/Larusajs/Handoff-Check/schemas/diff.v1.schema.json",
|
|
4
|
+
"title": "Handoff Check snapshot diff v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schemaVersion",
|
|
9
|
+
"status",
|
|
10
|
+
"scope",
|
|
11
|
+
"beforeCount",
|
|
12
|
+
"afterCount",
|
|
13
|
+
"unchangedCount",
|
|
14
|
+
"changes",
|
|
15
|
+
"notice"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"schemaVersion": { "const": 1 },
|
|
19
|
+
"status": { "enum": ["unchanged", "different"] },
|
|
20
|
+
"scope": { "$ref": "#/$defs/identifier" },
|
|
21
|
+
"projectId": { "$ref": "#/$defs/identifier" },
|
|
22
|
+
"beforeCount": { "type": "integer", "minimum": 0 },
|
|
23
|
+
"afterCount": { "type": "integer", "minimum": 0 },
|
|
24
|
+
"unchangedCount": { "type": "integer", "minimum": 0 },
|
|
25
|
+
"notice": { "type": "string" },
|
|
26
|
+
"changes": {
|
|
27
|
+
"type": "array",
|
|
28
|
+
"items": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"additionalProperties": false,
|
|
31
|
+
"required": ["id", "kind", "before", "after"],
|
|
32
|
+
"properties": {
|
|
33
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
34
|
+
"kind": { "enum": ["ADDED", "REMOVED", "CHANGED"] },
|
|
35
|
+
"before": {
|
|
36
|
+
"oneOf": [{ "$ref": "#/$defs/reference" }, { "type": "null" }]
|
|
37
|
+
},
|
|
38
|
+
"after": {
|
|
39
|
+
"oneOf": [{ "$ref": "#/$defs/reference" }, { "type": "null" }]
|
|
40
|
+
},
|
|
41
|
+
"fields": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"items": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"required": ["field", "before", "after"],
|
|
47
|
+
"properties": {
|
|
48
|
+
"field": {
|
|
49
|
+
"enum": [
|
|
50
|
+
"id",
|
|
51
|
+
"scope",
|
|
52
|
+
"description",
|
|
53
|
+
"source",
|
|
54
|
+
"expiresAt",
|
|
55
|
+
"revokedAt",
|
|
56
|
+
"replacedBy",
|
|
57
|
+
"supersededAt",
|
|
58
|
+
"revision"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"before": { "type": ["string", "number", "null"] },
|
|
62
|
+
"after": { "type": ["string", "number", "null"] }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"allOf": [
|
|
68
|
+
{
|
|
69
|
+
"if": { "properties": { "kind": { "const": "ADDED" } } },
|
|
70
|
+
"then": {
|
|
71
|
+
"properties": {
|
|
72
|
+
"before": { "type": "null" },
|
|
73
|
+
"after": { "$ref": "#/$defs/reference" }
|
|
74
|
+
},
|
|
75
|
+
"not": { "required": ["fields"] }
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"if": { "properties": { "kind": { "const": "REMOVED" } } },
|
|
80
|
+
"then": {
|
|
81
|
+
"properties": {
|
|
82
|
+
"before": { "$ref": "#/$defs/reference" },
|
|
83
|
+
"after": { "type": "null" }
|
|
84
|
+
},
|
|
85
|
+
"not": { "required": ["fields"] }
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"if": { "properties": { "kind": { "const": "CHANGED" } } },
|
|
90
|
+
"then": {
|
|
91
|
+
"properties": {
|
|
92
|
+
"before": { "$ref": "#/$defs/reference" },
|
|
93
|
+
"after": { "$ref": "#/$defs/reference" }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"$defs": {
|
|
102
|
+
"identifier": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*(?![\\s\\S])"
|
|
105
|
+
},
|
|
106
|
+
"reference": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"additionalProperties": false,
|
|
109
|
+
"required": ["id", "revision", "contentHash"],
|
|
110
|
+
"properties": {
|
|
111
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
112
|
+
"revision": {
|
|
113
|
+
"type": "integer",
|
|
114
|
+
"minimum": 1,
|
|
115
|
+
"maximum": 9007199254740991
|
|
116
|
+
},
|
|
117
|
+
"contentHash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|