coderifts 8.2.0 → 8.4.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,24 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 8.4.0 - 2026-09-06
6
+
7
+ ### Added
8
+ - Published onboarding for Atomic V2: `coderifts init --agents --atomic-v2` (and `init --strict --atomic-v2`) writes an `ENFORCING_ATOMIC_V2` config plus fail-closed wiring placeholders (`PROFILE_CONFIGURED` / `WIRING_REQUIRED`, `atomic_v2_verified: false`). `coderifts verify atomic-v2` is in the packed binary (exit **0** `TARGET_ENFORCEMENT_VERIFIED` for a named reference target; **2** `WIRING_REQUIRED` for a customer target until the six adapter operations are wired; **3** `VERIFICATION_FAILED`; **1** usage). Packed-install smoke runs `coderifts init --agents --atomic-v2 --dry-run`.
9
+ - ATOMIC_V2 phase 2 (réteg 3): versioned adapter-contract `atomic-v2-adapter/1` (six operations: `state_challenge`, `consume`, `conditional_write`, `mutate`, `executor_attestation`, `provider_readback`). Capability discovery is a machine probe. `coderifts verify atomic-v2` is target-bound (`--target --environment --executor-identity --operation --adapter-id`); reference-executor success is not inherited. Mandatory negative probes (replay, expired challenge, wrong target, CAS mismatch, missing attestation, mismatched JTI/scope-hash) must fail-close. `customer_target_verified:false` + `production_ready:true` is unconstructible.
10
+ - `coderifts init --strict --atomic-v2` writes an `ENFORCING_ATOMIC_V2` config plus fail-closed `unconfiguredCapability` wiring placeholders (`PROFILE_CONFIGURED` / `WIRING_REQUIRED`, `atomic_v2_verified: false`). Init may succeed; verify must not exit 0 on incomplete wiring. Placeholders throw; they are not no-ops.
11
+
12
+ ### Changed
13
+ - Strict installer teaching (`coderifts init --agents --strict`): primary production grant is `cr.exec.v2` (mint with `grantVersion: 'v2'`). `cr.exec.v1` is labelled legacy; the gate still accepts both so a migration is not a hard cut. `ENFORCING_ATOMIC_V2` is not the installer default — that profile needs customer-held executor wiring this installer cannot emit.
14
+ - `inescapable_deploy` is false while `MERGEGATE_ENFORCE` is unobservable. All six layers `VERIFIED` is a proven binding, not a proven inescapable deploy; the composite reads `CLAMP_RESIDUAL` on `required_check` (classic and ruleset). True only when `MERGEGATE_ENFORCE` is observably `'true'`.
15
+
16
+ ## 8.3.0 - 2026-09-05
17
+
18
+ ### Changed
19
+ - `@coderifts/agent-guard` range raised to `^17.1.0`. Guard 17.1.0 fixes the audience binding (the Guard now sends top-level `audience`, which the server actually reads) and makes its public suite hermetic. No CLI behaviour change beyond the installed guard minor.
20
+
21
+
3
22
  ## 8.2.0 - 2026-09-05
4
23
 
5
24
  ### Changed
package/README.md CHANGED
@@ -75,7 +75,9 @@ coderifts init --agents --hosts=cursor # Cursor only
75
75
  coderifts init --agents --hosts=copilot # GitHub Copilot / VS Code only
76
76
  coderifts init --agents --no-hook # skip host hook install
77
77
  coderifts init --agents --no-workflow # skip .github/workflows/coderifts.yml
78
- coderifts init --agents --strict # STRICT: require-verified-monitoring: true
78
+ coderifts init --agents --strict # STRICT: require-verified-monitoring + require-grant (cr.exec.v2 primary)
79
+ coderifts init --strict --atomic-v2 # ATOMIC_V2 config + fail-closed wiring (implies --agents --strict)
80
+ coderifts verify atomic-v2 # 0 TARGET_ENFORCEMENT_VERIFIED; 2 WIRING_REQUIRED; 3 VERIFICATION_FAILED; 1 usage
79
81
  coderifts init --agents --check # which of the four pieces are present
80
82
  ```
81
83
 
@@ -84,17 +86,28 @@ coderifts init --agents --check # which of the four pieces are present
84
86
  | **MCP config** | `.mcp.json` (Claude Code), `.cursor/mcp.json` (Cursor), `.vscode/mcp.json` (Copilot / VS Code) | Three shapes, never normalised into one: Claude `mcpServers` + `type: "http"` + `url`; Cursor `mcpServers` + `url` only (no `type`); Copilot **`servers`** (not `mcpServers`) + `type: "http"` + `url`. Never `httpUrl` (that is Gemini, extension-level — this command does not write it). |
85
87
  | **Agent rules** | generated host files via `agent-setup`'s writer | `AGENTS.md` is always written. Claude also gets `CLAUDE.md`; Cursor also gets `.cursor/rules/coderifts.mdc`; Copilot also gets `.github/copilot-instructions.md`. `--hosts=all` adds LangGraph and OpenAI instructions. (`coderifts init agent` is a different command — it writes a `.coderifts.yml` template.) |
86
88
  | **Host hook** | `.claude/settings.json`, `.cursor/hooks.json` | Reuses `hook install --claude` / `--cursor` (JSON-merge, backup, idempotent). Copilot shares Claude's `.claude/settings.json` — VS Code reads it by default. |
87
- | **CI workflow** | `.github/workflows/coderifts.yml` | `coderifts/contract-gate@v0`. Default: `require-verified-monitoring` commented (honest default: **false**). `--strict`: the same file with `require-verified-monitoring: 'true'` |
89
+ | **CI workflow** | `.github/workflows/coderifts.yml` | `coderifts/contract-gate@v0`. Default: `require-verified-monitoring` commented (honest default: **false**). `--strict`: the same file with `require-verified-monitoring: 'true'` and `require-grant: 'true'` (teaches `cr.exec.v2`) |
88
90
 
89
91
  **Grant versions** (these names are not interchangeable; field-by-field matrix: [Grant versions](https://github.com/coderifts/app/blob/main/docs/grant-versions.md)):
90
92
 
91
93
  | What | Who uses it | What it proves |
92
94
  |------|-------------|----------------|
93
- | `cr.exec.v1` | capability-demo and the strict-install workflow (`require-grant`) | A reference/teaching execution grant bound to `operation target_id after_payload`. The demo and `coderifts init --agents --strict` use this form. |
94
- | Atomic V2 request (the V2 fields of the authorize request; see docs/grant-versions.md) | TS SDK, Python SDK, Guard (not MCP; not the capability-demo executor) | The request contract those three speak when minting a grant. Not the same bytes as a `cr.exec.v1` token. |
95
- | `ENFORCING_STRICT` | Guard `withCodeRifts({ profile })` | Permanent alias of `ENFORCING_STRICT_V1` (must resolve to `_V1` forever). Not a grant format. Different axis from `ENFORCING_ATOMIC_V1`/`V2`. |
95
+ | `cr.exec.v2` | `coderifts init --agents --strict` (`require-grant`); Guard/SDK when `grantVersion: 'v2'` | Canonical production execution grant. Not the same bytes as v1. Mint with `grantVersion: 'v2'`. |
96
+ | `cr.exec.v1` | capability-demo; legacy/migration | Older reference grant bound to `operation target_id after_payload`. Not the installer default. The gate still accepts it so a migration is not a hard cut. |
97
+ | `ENFORCING_STRICT` | Guard `withCodeRifts({ profile })` | Permanent alias of `ENFORCING_STRICT_V1` (must resolve to `_V1` forever). Installer-reachable production lock. Not a grant format. Different axis from `ENFORCING_ATOMIC_V1`/`V2` — those require customer-held executor wiring this installer does not emit. |
96
98
 
97
- `--strict` turns on `require-grant` and `require-verified-monitoring` in the workflow; it does not rename those three things.
99
+ `--strict` turns on `require-grant` and `require-verified-monitoring` in the workflow; it teaches `cr.exec.v2` as the grant to mint. It does not emit `ENFORCING_ATOMIC_V2`.
100
+
101
+ `--atomic-v2` writes `.coderifts/atomic-v2.json` plus fail-closed `unconfiguredCapability` wiring placeholders. Init may exit 0 with `PROFILE_CONFIGURED` / `WIRING_REQUIRED` (`state: ATOMIC_V2_CONFIGURED`, `atomic_v2_verified: false`). That is configuration, not target enforcement. `coderifts verify atomic-v2` is the verifier and **must not exit 0** while placeholders remain:
102
+
103
+ | Exit | Meaning |
104
+ |------|---------|
105
+ | **0** | `TARGET_ENFORCEMENT_VERIFIED` — customer target fully verified |
106
+ | **2** | `WIRING_REQUIRED` — config installed, placeholders still throw |
107
+ | **3** | `VERIFICATION_FAILED` — wiring present but verification failed (including a document that claimed `verified:true` with incomplete wiring) |
108
+ | **1** | usage / missing config |
109
+
110
+ Never emit `state: ENFORCING_ATOMIC_V2` with `atomic_v2_verified: true` while any of the adapter-contract (`atomic-v2-adapter/1`) operations is missing: `state_challenge`, `consume`, `conditional_write`, `mutate`, `executor_attestation`, `provider_readback`. Discovery is a machine probe, not a customer boolean. Exit 0 is target-bound (`--target --environment --executor-identity --operation --adapter-id`); a reference-executor success is not inherited. `customer_target_verified:false` and `production_ready:true` cannot be constructed together. The names are `PROFILE_CONFIGURED` / `TARGET_ENFORCEMENT_VERIFIED`, not STRICT-vs-ATOMIC (that pairing would read as a weaker-but-acceptable end state).
98
111
 
99
112
  **Next manual step:** add `CODERIFTS_API_KEY` to the repository secrets. The
100
113
  CLI never writes a key anywhere.
@@ -477,7 +490,9 @@ coderifts enforce --check --repo owner/repo --env production --json
477
490
  Provider-native pipeline-protection evidence. This is **not** a host claim:
478
491
  `--enforce` and `CODERIFTS_DEPLOY_NO_BYPASS` do **not** set
479
492
  `inescapable_deploy`. The field is true only when every layer below is
480
- `VERIFIED`.
493
+ `VERIFIED` **and** `MERGEGATE_ENFORCE` is observably true. A `VERIFIED`
494
+ required-check binding whose reason names the unobservable clamp is not an
495
+ inescapable deploy.
481
496
 
482
497
  | Layer | VERIFIED when |
483
498
  |-------|----------------|
@@ -488,7 +503,7 @@ Provider-native pipeline-protection evidence. This is **not** a host claim:
488
503
  | `workflow_contract_gate` | an **active** job (not `if: false`) has a step whose `uses:` is `coderifts/contract-gate` at a pinned major. Comments, string literals, and commented-out steps are **NOT_VERIFIED** |
489
504
  | `workflow_deploy_gate` | an **active** job step **invokes** `coderifts deploy-gate` (not `echo` of the string; not a comment) |
490
505
 
491
- **Invariant:** any layer whose evidence cannot be bound to an issuer (our GitHub App id) or to an active job is `NOT_VERIFIED` or `UNVERIFIABLE` — never `VERIFIED`. `inescapable_deploy` remains true only when every layer is `VERIFIED` under that rule.
506
+ **Invariant:** any layer whose evidence cannot be bound to an issuer (our GitHub App id) or to an active job is `NOT_VERIFIED` or `UNVERIFIABLE` — never `VERIFIED`. `inescapable_deploy` remains true only when every layer is `VERIFIED` **and** `MERGEGATE_ENFORCE` is observably true.
492
507
 
493
508
  Statuses: `VERIFIED` / `NOT_VERIFIED` / `UNVERIFIABLE(reason)`. Auth:
494
509
  `GITHUB_TOKEN` (never printed). **No token** → API layers `UNVERIFIABLE` with
package/bin/coderifts.js CHANGED
@@ -52,6 +52,19 @@ program
52
52
  // Exit status is set only at this command boundary (library never process.exit).
53
53
  // program.parse() does not await async actions; process.exit here makes the gate's
54
54
  // fail-closed status authoritative for npm prepublishOnly / child_process callers.
55
+ // ── doctor (1222) — the adoption entry point ──
56
+ // Tier 0 needs no key and calls no model; Tier 1 is BYOK on the developer's own machine.
57
+ program
58
+ .command('doctor')
59
+ .description('Would an agent select CodeRifts for a contract change? Structural check (no key), or the 15-fixture benchmark on your own model.')
60
+ .option('--tools <file>', 'Your host\'s tools/list response (array, { tools }, or { result: { tools } })')
61
+ .option('--model <id>', 'TIER 1: run the fixtures through this model using YOUR key from the environment')
62
+ .option('--mock', 'TIER 1 dry run: a deterministic scripted model. Measures the script, not a model.')
63
+ .action(async (options) => {
64
+ const { runDoctor } = require('../src/commands/doctor');
65
+ await runDoctor(options);
66
+ });
67
+
55
68
  program
56
69
  .command('publish-gate')
57
70
  .description('Gate npm publish on contract-artifact preflight (before=git baseline, after=working tree)')
@@ -152,7 +165,8 @@ program
152
165
  .option('--hosts <list>', 'With --agents: claude, cursor, copilot, or all (default: all)', 'all')
153
166
  .option('--no-hook', 'With --agents: skip host hook install')
154
167
  .option('--no-workflow', 'With --agents: skip writing .github/workflows/coderifts.yml')
155
- .option('--strict', 'With --agents: STRICT workflow (require-verified-monitoring: true)')
168
+ .option('--strict', 'With --agents: STRICT workflow (require-verified-monitoring + require-grant; cr.exec.v2 primary)')
169
+ .option('--atomic-v2', 'Write ENFORCING_ATOMIC_V2 config + fail-closed wiring (implies --agents --strict)')
156
170
  .option('--dry-run', 'With --agents: print the plan without writing')
157
171
  .option('--check', 'With --agents: report which of the four pieces are present (no write)')
158
172
  .option('--out <dir>', 'With --agents: target directory (default: cwd)')
@@ -163,7 +177,7 @@ program
163
177
  AGENT_FLAGS_REQUIRE_AGENTS,
164
178
  AGENTS_NO_TEMPLATE,
165
179
  } = require('../src/commands/init-agents');
166
- if (options.agents) {
180
+ if (options.agents || options.atomicV2) {
167
181
  if (template) {
168
182
  console.error(AGENTS_NO_TEMPLATE);
169
183
  process.exitCode = 1;
@@ -176,7 +190,8 @@ program
176
190
  dryRun: !!options.dryRun,
177
191
  check: !!options.check,
178
192
  out: options.out,
179
- strict: !!options.strict,
193
+ strict: !!options.strict || !!options.atomicV2,
194
+ atomicV2: !!options.atomicV2,
180
195
  });
181
196
  if (result && typeof result.exitCode === 'number') {
182
197
  process.exitCode = result.exitCode;
@@ -455,6 +470,34 @@ const corpusCmd = program
455
470
  .command('corpus')
456
471
  .description('Reproduce the CodeRifts accuracy proof matrix (MCP always; OpenAPI needs oasdiff)');
457
472
 
473
+ program
474
+ .command('verify <target>')
475
+ .description('Verify an installed profile. Target: atomic-v2. Exit 0 = TARGET_ENFORCEMENT_VERIFIED (named target); 2 = WIRING_REQUIRED; 3 = VERIFICATION_FAILED; 1 = usage.')
476
+ .option('--out <dir>', 'Target directory (default: cwd)')
477
+ .option('--json', 'Print the structured status JSON')
478
+ .option('--target <id>', 'Bind verification to this target_id')
479
+ .option('--environment <env>', 'Bind verification to this environment')
480
+ .option('--executor-identity <id>', 'Bind verification to this executor identity')
481
+ .option('--operation <op>', 'Bind verification to this operation')
482
+ .option('--adapter-id <id>', 'Bind verification to this adapter_id')
483
+ .action((target, options) => {
484
+ if (String(target) !== 'atomic-v2') {
485
+ console.error(`verify: unknown target "${target}" (use atomic-v2)`);
486
+ process.exitCode = 1;
487
+ return;
488
+ }
489
+ const { runVerifyAtomicV2 } = require('../src/commands/verify-atomic-v2');
490
+ runVerifyAtomicV2({
491
+ out: options.out,
492
+ json: !!options.json,
493
+ target: options.target,
494
+ environment: options.environment,
495
+ executorIdentity: options.executorIdentity,
496
+ operation: options.operation,
497
+ adapterId: options.adapterId,
498
+ });
499
+ });
500
+
458
501
  corpusCmd
459
502
  .command('verify', { isDefault: true })
460
503
  .description('Evaluate every trust vector and print the proof matrix (exit 1 on any FAIL)')
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "$comment": "GENERATED by scripts/build.js. sha256 over src/**.js + bin/**.js (path + bytes). test/build-freshness.test.js recomputes it; a mismatch means dist/cli.js is stale.",
3
- "sha256": "d9d48f2b01fa76855978dbbaa67d81be419b7632e1cc80eb5b999d5efcf9c090",
4
- "file_count": 42
3
+ "sha256": "e9cca5e219ca1bc43448406afaae8ac9b4bd5f61dcbb880967393ea37575b354",
4
+ "file_count": 49
5
5
  }