handoff-check 0.2.0 → 0.3.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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ - Show the expected active-rule count in every text verification summary.
6
+ - Mark valid zero-rule checks as PASS (EMPTY), with an explicit scope/time notice.
7
+ - Add activeConstraintCount to v2 JSON while preserving legacy default JSON shape.
8
+ - Add opt-in --require-active with a global NO_ACTIVE_CONSTRAINTS finding and exit 1.
9
+
3
10
  ## 0.2.0
4
11
 
5
12
  - Detect same-ID rule edits through revision and canonical SHA-256 references.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  A deterministic, local CLI that verifies active constraints before a coding agent
4
4
  resumes work.
5
5
 
6
- **Version: 0.2.0.**
6
+ **Version: 0.3.0.**
7
7
 
8
8
  A task summary may preserve the goal while losing an active rule, carrying an
9
9
  expired restriction, or moving a staging-only instruction into production.
@@ -18,8 +18,8 @@ Source references are review metadata and are never fetched.
18
18
  Once the npm package is published, run in the repository where your agent works:
19
19
 
20
20
  ```sh
21
- npx handoff-check@0.2.0 init --scope staging --agent both --dry-run
22
- npx handoff-check@0.2.0 init --scope staging --agent both
21
+ npx handoff-check@0.3.0 init --scope staging --agent both --dry-run
22
+ npx handoff-check@0.3.0 init --scope staging --agent both
23
23
  ```
24
24
 
25
25
  This creates `.handoff-check.json`, starter `constraints.json` and `handoff.json`,
@@ -33,7 +33,7 @@ on verification. Revisions and hashes detect edits under an unchanged rule ID.
33
33
  Ask a resuming agent to use the installed skill, or run:
34
34
 
35
35
  ```sh
36
- npx handoff-check@0.2.0 verify --format json --require-content
36
+ npx handoff-check@0.3.0 verify --format json --require-content
37
37
  ```
38
38
 
39
39
  The saved config supplies paths and scope. `init --ci` also creates a pinned GitHub
@@ -43,15 +43,45 @@ Neither checks whether the agent obeys a rule's meaning.
43
43
 
44
44
  Until publication, use a local package via the [setup guide](docs/agent-integration.md).
45
45
  Node.js 22+ is required; end users do not need Bun. After publication, global
46
- installation is also available: `npm install --global handoff-check@0.2.0`.
46
+ installation is also available: `npm install --global handoff-check@0.3.0`.
47
+
48
+ ## See how many rules were checked
49
+
50
+ Every text summary includes the expected active-rule count:
51
+
52
+ ```text
53
+ PASS 7 active constraints checked | 0 findings | scope staging | ...
54
+ PASS (EMPTY) 0 active constraints checked | 0 findings | ... | No active constraints apply to this scope and time
55
+ ```
56
+
57
+ This counts active selected/global rules, not reported IDs or total manifest
58
+ entries. Missing active rules count too. Zero may mean a starter, another scope,
59
+ or inactive rules; it does not prove the manifest is empty. Empty checks exit 0 by
60
+ default but are explicitly marked. Unexpected reported IDs still fail.
61
+
62
+ To require actual active rules, opt in:
63
+
64
+ ```sh
65
+ npx handoff-check@0.3.0 verify --require-content --require-active --format json
66
+ ```
67
+
68
+ A zero active set produces global NO_ACTIVE_CONSTRAINTS (no fake ID), mismatch
69
+ status and exit 1. Other findings remain. Invalid inputs still exit 2. V2 JSON
70
+ includes activeConstraintCount; legacy default JSON exposes the expected set in
71
+ expectedConstraints without changing its fields.
72
+
73
+ The policy is not automatically enabled in starter CI. After adding real rules,
74
+ append --require-active to the generated workflow command. It is verify-only;
75
+ init and snapshot reject it. See the
76
+ [empty verification contract](docs/decisions/0003-empty-verification.md).
47
77
 
48
78
  ## Catch rule edits between sessions
49
79
 
50
80
  After reviewing rules at handoff creation, capture a new baseline:
51
81
 
52
82
  ```sh
53
- npx handoff-check@0.2.0 snapshot --task "Resume migration review" --output handoff.next.json
54
- npx handoff-check@0.2.0 verify --handoff handoff.next.json --require-content --format json
83
+ npx handoff-check@0.3.0 snapshot --task "Resume migration review" --output handoff.next.json
84
+ npx handoff-check@0.3.0 verify --handoff handoff.next.json --require-content --format json
55
85
  ```
56
86
 
57
87
  Snapshot creates a new file exclusively. Review it before deliberately replacing
@@ -86,7 +116,7 @@ or revisioned v2 manifests. Scope must match the v2 handoff's saved scope.
86
116
  Review current rules, capture a new v2 baseline, and deliberately update the saved
87
117
  handoff. Existing inputs are preserved by init, not silently upgraded. Review
88
118
  installed skills, instruction blocks and CI commands to update their pinned
89
- version to 0.2.0 and add `--require-content`. Init refuses to overwrite differing
119
+ version to 0.3.0 and add `--require-content`. Init refuses to overwrite differing
90
120
  integrations; compare them with the new packaged templates and update reviewed
91
121
  copies explicitly. Never refresh before checking resumed work or reuse capturedAt
92
122
  as the clock for real resumed work.
@@ -146,7 +176,7 @@ The synthetic Friday freeze has expired and the migration review rule is missing
146
176
  ```text
147
177
  EXPIRED C-02 Remove expired constraint: Staging freeze ended Friday at 18:00 UTC
148
178
  MISSING C-07 Include active constraint: Require review before applying migrations
149
- FAIL 2 findings | scope staging | as of 2026-11-23T09:00:00.000Z
179
+ FAIL 1 active constraints checked | 2 findings | scope staging | as of 2026-11-23T09:00:00.000Z | IDs only; content changes not checked
150
180
  ```
151
181
 
152
182
  This command intentionally exits with code 1. Use the corrected handoff to pass:
@@ -156,7 +186,7 @@ bun run dev verify --constraints examples/stale-handoff/constraints.json --hando
156
186
  ```
157
187
 
158
188
  ```text
159
- PASS 0 findings | scope staging | as of 2026-11-23T09:00:00.000Z
189
+ PASS 1 active constraints checked | 0 findings | scope staging | as of 2026-11-23T09:00:00.000Z | IDs only; content changes not checked
160
190
  ```
161
191
 
162
192
  For the built CLI, run `bun run build`, then replace `bun run dev` with
@@ -225,7 +255,7 @@ include global rules even when no scope-specific rules exist.
225
255
  | 1 | Rule mismatch; inspect findings |
226
256
  | 2 | Invalid arguments, invalid input, or unreadable input file |
227
257
 
228
- Findings include `MISSING`, `EXPIRED`, `REVOKED`, `SUPERSEDED`, `OUT_OF_SCOPE`,
258
+ Per-rule findings include `MISSING`, `EXPIRED`, `REVOKED`, `SUPERSEDED`, `OUT_OF_SCOPE`,
229
259
  `UNKNOWN`, and (for v2) `CHANGED`, ordered by ID. A reported ID receives one primary finding according to
230
260
  the precedence in the lifecycle ADR.
231
261
 
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import { parseArgs } from "node:util";
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "handoff-check",
10
- version: "0.2.0",
10
+ version: "0.3.0",
11
11
  description: "A deterministic, local CLI that verifies active constraints before a coding agent resumes work.",
12
12
  type: "module",
13
13
  packageManager: "bun@1.2.10",
@@ -540,7 +540,7 @@ function inactive(rule, scope, time) {
540
540
  return "EXPIRED";
541
541
  return;
542
542
  }
543
- function verify(manifest, handoff, scope, asOf) {
543
+ function verify(manifest, handoff, scope, asOf, options = {}) {
544
544
  identifier(scope, "scope");
545
545
  if (handoff.schemaVersion === 2 && handoff.scope !== scope)
546
546
  throw new InputError(`Handoff scope '${handoff.scope}' does not match selected scope '${scope}'`);
@@ -589,10 +589,19 @@ function verify(manifest, handoff, scope, asOf) {
589
589
  }
590
590
  }
591
591
  }
592
- findings.sort((a, b) => compare(a.id, b.id) || compare(a.code, b.code));
592
+ if (options.requireActive && expectedConstraints.length === 0) {
593
+ findings.push({
594
+ code: "NO_ACTIVE_CONSTRAINTS",
595
+ message: "No active constraints apply to the selected scope and time; --require-active requires at least one"
596
+ });
597
+ }
598
+ findings.sort((a, b) => compare(a.id ?? "", b.id ?? "") || compare(a.code, b.code));
593
599
  return {
594
600
  schemaVersion: handoff.schemaVersion,
595
- ...handoff.schemaVersion === 2 ? { tracking: "content" } : {},
601
+ ...handoff.schemaVersion === 2 ? {
602
+ tracking: "content",
603
+ activeConstraintCount: expectedConstraints.length
604
+ } : {},
596
605
  status: findings.length ? "mismatch" : "verified",
597
606
  scope,
598
607
  asOf: new Date(time).toISOString(),
@@ -629,6 +638,7 @@ Options:
629
638
  --config <path> Project config (default: cwd/.handoff-check.json)
630
639
  --as-of <UTC time> Fixed evaluation time (default: current time)
631
640
  --require-content verify: require a v2 content-aware handoff
641
+ --require-active verify: fail if no constraints apply to scope/time
632
642
  --task <task> snapshot: task description (required)
633
643
  --output <path> snapshot: create a new baseline file, never overwrite
634
644
  --format text|json Output format (default: text)
@@ -638,7 +648,7 @@ Options:
638
648
  --version Show package version
639
649
  --help Show this help
640
650
 
641
- Exit codes: 0 verified, 1 rule mismatch, 2 invalid input
651
+ Exit codes: 0 verified, 1 rule/policy mismatch, 2 invalid input
642
652
  `;
643
653
  function terminalText(value) {
644
654
  return Array.from(value, (character) => {
@@ -669,6 +679,7 @@ async function main() {
669
679
  "dry-run": { type: "boolean" },
670
680
  ci: { type: "boolean" },
671
681
  "require-content": { type: "boolean" },
682
+ "require-active": { type: "boolean" },
672
683
  task: { type: "string" },
673
684
  output: { type: "string" }
674
685
  }
@@ -695,6 +706,7 @@ async function main() {
695
706
  "config",
696
707
  "as-of",
697
708
  "require-content",
709
+ "require-active",
698
710
  "task",
699
711
  "output"
700
712
  ])
@@ -740,8 +752,8 @@ ${result2.notice}
740
752
  throw new InputError(`--${key}: expected a non-empty path`);
741
753
  const manifest = parseManifest(await readJson(values.constraints !== undefined ? resolve3(cwd, values.constraints) : resolve3(directory, config.constraints ?? "constraints.json")));
742
754
  if (positionals[0] === "snapshot") {
743
- if (values.handoff !== undefined || values["require-content"] !== undefined)
744
- throw new InputError("--handoff and --require-content are only supported by verify");
755
+ if (values.handoff !== undefined || values["require-content"] !== undefined || values["require-active"] !== undefined)
756
+ throw new InputError("--handoff, --require-content and --require-active are only supported by verify");
745
757
  if (values.task === undefined)
746
758
  throw new InputError("snapshot requires --task");
747
759
  const captured = snapshot(manifest, values.task, scope, asOf);
@@ -781,16 +793,20 @@ ${result2.notice}
781
793
  const handoff = parseHandoff(await readJson(values.handoff !== undefined ? resolve3(cwd, values.handoff) : resolve3(directory, config.handoff ?? "handoff.json")));
782
794
  if (values["require-content"] && handoff.schemaVersion !== 2)
783
795
  throw new InputError("Content tracking requires a schemaVersion 2 handoff; review current rules and capture a snapshot before resuming");
784
- const result = verify(manifest, handoff, scope, asOf);
796
+ const result = verify(manifest, handoff, scope, asOf, {
797
+ requireActive: values["require-active"] ?? false
798
+ });
785
799
  if (format === "json") {
786
800
  process.stdout.write(`${JSON.stringify(result, null, 2)}
787
801
  `);
788
802
  } else {
789
803
  for (const finding of result.findings) {
790
- process.stdout.write(`${finding.code.padEnd(12)} ${finding.id} ${terminalText(finding.message)}
804
+ process.stdout.write(`${finding.code.padEnd(12)} ${finding.id === undefined ? "" : `${finding.id} `}${terminalText(finding.message)}
791
805
  `);
792
806
  }
793
- process.stdout.write(`${result.status === "verified" ? "PASS" : "FAIL"} ${result.findings.length} findings | scope ${scope} | as of ${result.asOf}${handoff.schemaVersion === 1 ? " | IDs only; content changes not checked" : " | content tracked"}
807
+ const count = result.expectedConstraints.length;
808
+ const label = result.status === "verified" ? count === 0 ? "PASS (EMPTY)" : "PASS" : "FAIL";
809
+ process.stdout.write(`${label} ${count} active constraints checked | ${result.findings.length} findings | scope ${scope} | as of ${result.asOf}${handoff.schemaVersion === 1 ? " | IDs only; content changes not checked" : " | content tracked"}${count === 0 ? " | No active constraints apply to this scope and time" : ""}
794
810
  `);
795
811
  }
796
812
  return result.status === "verified" ? 0 : 1;
@@ -9,8 +9,8 @@ infers rules from a summary.
9
9
  After the npm release is published, from the consuming repository root:
10
10
 
11
11
  ```sh
12
- npx handoff-check@0.2.0 init --scope staging --agent both --dry-run
13
- npx handoff-check@0.2.0 init --scope staging --agent both
12
+ npx handoff-check@0.3.0 init --scope staging --agent both --dry-run
13
+ npx handoff-check@0.3.0 init --scope staging --agent both
14
14
  ```
15
15
 
16
16
  Choose `codex`, `claude`, `both` (default), or `none`. Generated integrations:
@@ -38,8 +38,8 @@ npm pack
38
38
  From a separate consuming project, substitute the actual absolute tarball path:
39
39
 
40
40
  ```sh
41
- npx --offline --yes --package=/absolute/path/handoff-check-0.2.0.tgz handoff-check init --scope staging --agent both
42
- npx --offline --yes --package=/absolute/path/handoff-check-0.2.0.tgz handoff-check verify --format json --require-content
41
+ npx --offline --yes --package=/absolute/path/handoff-check-0.3.0.tgz handoff-check init --scope staging --agent both
42
+ npx --offline --yes --package=/absolute/path/handoff-check-0.3.0.tgz handoff-check verify --format json --require-content
43
43
  ```
44
44
 
45
45
  Bun is not required for these consumer commands. Generated agent commands use the
@@ -78,6 +78,13 @@ events and context-reset behavior differ.
78
78
 
79
79
  ## Upgrades and contributor instructions
80
80
 
81
+ In 0.3, verification reports how many selected/global rules are active. V2 JSON
82
+ includes activeConstraintCount. Empty checks remain valid by default but text
83
+ clearly says PASS (EMPTY). Agents must not present this as real policy coverage.
84
+ Teams can explicitly add --require-active to verify/CI after authoring rules;
85
+ zero then exits 1 with a global NO_ACTIVE_CONSTRAINTS finding. New starter CI does
86
+ not enable this policy automatically. V1 default JSON remains unchanged.
87
+
81
88
  Matching integrations are preserved on repeated init. If a skill or managed block
82
89
  differs, compare it to the new package and review/update explicitly; there is no
83
90
  force-overwrite mode. Commands stay pinned until a reviewed upgrade.
@@ -0,0 +1,55 @@
1
+ # ADR 0003: Make empty verification explicit
2
+
3
+ Status: accepted for 0.3.0.
4
+
5
+ ## Counts and empty results
6
+
7
+ The active count is the size of the expected set: rules applicable to the selected
8
+ scope plus global rules, after expiry, revocation and supersession. It is not the
9
+ number of reported IDs, successful matches, findings, or manifest entries. Missing
10
+ active rules still count. Globals count once. Fixed-time behavior stays stable.
11
+
12
+ Text always reports the count. A verified result with zero active rules is labeled
13
+ PASS (EMPTY) and says no active constraints apply to scope/time. It still exits 0
14
+ by default: an empty set is valid, but verifies no real active rule. Zero may also
15
+ mean all rules are inactive or in other scopes; do not infer an empty starter.
16
+
17
+ If unexpected IDs remain in a handoff with zero expected rules, the result stays
18
+ FAIL with those findings. Every zero-count text result has the scope/time notice.
19
+
20
+ ## Machine-readable compatibility
21
+
22
+ V2 JSON adds numeric activeConstraintCount, equal to expectedConstraints.length
23
+ regardless of success/mismatch. Existing fields and input schemas stay unchanged;
24
+ consumers should allow additive metadata. Legacy v1 JSON keeps its exact default
25
+ shape; derive its count from expectedConstraints. No snapshot/hash changes occur.
26
+
27
+ ## Optional nonempty policy
28
+
29
+ `verify --require-active` requires at least one expected active rule. This is an
30
+ explicit policy, not input validation: valid files with zero active rules return
31
+ mismatch and exit 1, rather than invalid input/exit 2. The core receives an explicit
32
+ optional policy parameter and never reads flags or files.
33
+
34
+ The zero set adds one global finding:
35
+
36
+ ```json
37
+ {
38
+ "code": "NO_ACTIVE_CONSTRAINTS",
39
+ "message": "No active constraints apply to the selected scope and time; --require-active requires at least one"
40
+ }
41
+ ```
42
+
43
+ It has no invented ID or revision/hash fields. Global findings sort before per-ID
44
+ findings. Existing stale/unknown findings remain; per-ID lifecycle/content
45
+ precedence and ID/code ordering stay unchanged. A nonempty expected set yields
46
+ the same result with or without this policy.
47
+
48
+ The option applies to both handoff formats. Legacy strict mode introduces the
49
+ documented opt-in finding but no v2 count metadata. Init and snapshot reject it;
50
+ capturing a reviewed empty set remains possible.
51
+
52
+ Skills and generated CI do not silently enable this policy. Starters have zero
53
+ rules and some scopes intentionally have none. Teams add --require-active after
54
+ authoring/reviewing constraints. Agents should report zero without presenting it
55
+ as validation of real policy. --require-content is independently combinable.
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.2.0. A registry lookup is not proof that a name can be claimed.
4
+ current version is 0.3.0. A registry lookup is not proof that a name can be claimed.
5
5
  Confirm ownership during the authenticated first publication.
6
6
 
7
7
  ## Release a reviewed version
@@ -19,12 +19,12 @@ Confirm ownership during the authenticated first publication.
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.2.0.tgz --ignore-scripts --access public`.
22
+ `npm publish /absolute/path/handoff-check-0.3.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.2.0 --version` and fresh-project init/verify using a
25
+ `npx --yes handoff-check@0.3.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.2.0` and a GitHub release on the reviewed main commit, attach the
27
+ 6. Create tag `v0.3.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
@@ -30,6 +30,9 @@
30
30
 
31
31
  ## Following releases
32
32
 
33
+ Implemented in 0.3.0: active-rule counts, explicit empty-check summaries and optional
34
+ nonempty verification policy, with v1 default JSON compatibility.
35
+
33
36
  Implemented in 0.2.0: revisioned v2 manifests, content-aware handoff snapshots,
34
37
  canonical SHA-256 comparison, CHANGED findings, explicit --require-content,
35
38
  legacy compatibility and reviewed migration guidance. No automatic baseline refresh.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handoff-check",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "A deterministic, local CLI that verifies active constraints before a coding agent resumes work.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.2.10",
@@ -46,6 +46,14 @@ report. Keep ordinary task summaries separate from the declared constraint IDs.
46
46
 
47
47
  ## Content-aware handoffs
48
48
 
49
+ Report the active-rule count as well as findings. V2 JSON exposes
50
+ `activeConstraintCount`; legacy JSON exposes `expectedConstraints.length`.
51
+ A zero count is not evidence that real active rules were checked. It may mean a
52
+ starter, another scope, or only inactive rules. Text marks this as PASS (EMPTY)
53
+ when there are no mismatches. If the project explicitly requires a nonempty set,
54
+ add `--require-active`: zero then produces global NO_ACTIVE_CONSTRAINTS and exit 1.
55
+ Do not enable this policy silently or invent rules to satisfy it.
56
+
49
57
  Use schemaVersion 2 handoffs with revision/hash references. `CHANGED` means a
50
58
  carried active rule has a different revision or content hash; it does not supply
51
59
  a text diff or prove which state was authorized. Report expected/reported values