projscan 4.16.0 → 4.17.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
@@ -25,8 +25,9 @@ Use projscan when an agent asks one of these questions:
25
25
  - Which proof commands should I run before handoff?
26
26
  - Which risks need fixes, reviewer attention, or release sign-off?
27
27
  - Which risk should I fix first?
28
+ - Did the agent stay inside the approved change boundary?
28
29
 
29
- projscan runs core scans on your machine. It respects `.gitignore`, keeps `.env` values out of scans unless you opt in, and exposes the same evidence through a CLI and a 48-tool MCP server. The language layer uses 11 AST adapters covering 12 named languages.
30
+ projscan runs core scans on your machine. It respects `.gitignore`, keeps `.env` values out of scans unless you opt in, and exposes the same evidence through a CLI and a 49-tool MCP server. The language layer uses 11 AST adapters covering 12 named languages.
30
31
 
31
32
  ```text
32
33
  Your agent / engineer
@@ -41,6 +42,8 @@ Your agent / engineer
41
42
  | | | +- allowed files
42
43
  | | | +- forbidden files
43
44
  | | | +- proof receipt
45
+ | | | +- change passport
46
+ | | | +- live guard
44
47
  | | +- bounded extraction |
45
48
  | | +- regression test first |
46
49
  | | +- leave unchanged |
@@ -104,6 +107,7 @@ projscan prove --intent "is my agent allowed to change billing retry logic?" --s
104
107
  # Make the bounded edit, then run the proof command.
105
108
  projscan prove --run -- npm test -- tests/billing/retry.test.ts
106
109
  projscan prove --changed --contract .projscan/proof-contract.json --format markdown
110
+ projscan passport --contract .projscan/proof-contract.json --format markdown
107
111
  ```
108
112
 
109
113
  The command path is `start -> prove -> run -> changed`. Make the bounded edit after the contract exists and before `prove --run`. `start` chooses the contract workflow. `prove --intent` writes `.projscan/proof-contract.json` only when `--save-contract` is present. `prove --run -- <command...>` executes a local proof command, records the exit code, captures a redacted log, and fingerprints the current changed files. `prove --record-command` remains available for imported CI or external evidence when projscan did not run the command. `prove --changed` checks the current working tree against the contract and local ledger.
@@ -119,6 +123,22 @@ Saved contracts are the source of truth for `prove --changed`; update the contra
119
123
 
120
124
  Every `prove` report includes `verifiedWorkflow`, a compact JSON summary for agents and MCP clients. It names the phase, next action, next command, scope status, proof status, proof sufficiency status, risk delta direction, reviewer decision, and stale/missing/failed proof flags.
121
125
 
126
+ `projscan passport` turns the contract and receipt into one handoff artifact. It names allowed files, forbidden files, changed files, proof replay status, Proof Sufficiency, reviewer action, and next commands. Save it when a reviewer or another agent needs the whole change story in one JSON file:
127
+
128
+ ```bash
129
+ projscan passport \
130
+ --intent "is my agent allowed to change billing retry logic?" \
131
+ --save-contract .projscan/proof-contract.json \
132
+ --output .projscan/passport.json
133
+ ```
134
+
135
+ `projscan guard` checks the current working tree against a saved Proof Contract. Use it after an agent edits files, or run `--watch` during a session:
136
+
137
+ ```bash
138
+ projscan guard --contract .projscan/proof-contract.json
139
+ projscan guard --contract .projscan/proof-contract.json --watch
140
+ ```
141
+
122
142
  Success criteria: the reviewer sees scope, proof execution, proof freshness, and sufficiency for the changed risk surface.
123
143
 
124
144
  ### Before handoff or commit
@@ -222,6 +242,28 @@ npm run docs:screenshots
222
242
  npm run docs:demos
223
243
  ```
224
244
 
245
+ ## 4.17.0 Notes
246
+
247
+ 4.17.0 ships the Agent Change Passport and Live Guard:
248
+
249
+ - `projscan passport --intent "<task>" --save-contract .projscan/proof-contract.json`
250
+ creates a Proof Contract, checks the current working tree, and returns one
251
+ local passport with boundary, receipt, proof replay, Proof Sufficiency,
252
+ reviewer action, and next commands.
253
+ - `projscan passport --contract .projscan/proof-contract.json --output
254
+ .projscan/passport.json` writes a JSON handoff artifact. ProjScan writes to
255
+ `.projscan/passport.json` or `.projscan/passports/<name>.json`, rejects
256
+ traversal, checks symlink paths, and refuses to overwrite unrelated files.
257
+ - `projscan guard --contract .projscan/proof-contract.json` reports whether the
258
+ current diff stayed inside the approved boundary. `--watch` polls during an
259
+ agent session, and `--fail-on-drift` exits non-zero when the guard sees drift.
260
+ - MCP now includes `projscan_passport`, bringing the MCP surface to 49 tools.
261
+ The tool returns passport evidence for agents without adding proof-command
262
+ execution to MCP.
263
+ - Passport can attach Baseframe assessment evidence with `--task-id <id>
264
+ --emit-baseframe`, while ProjScan limits ownership to its assessment artifact
265
+ and shared manifest update.
266
+
225
267
  ## 4.16.0 Notes
226
268
 
227
269
  4.16.0 ships Baseframe Suite assessment export:
@@ -385,6 +427,8 @@ npx -y projscan mcp --watch
385
427
  | Is this refactor worth doing? | `projscan simulate --plan "split bugHunt.ts into ranking, evidence, and output modules"` |
386
428
  | Is my agent allowed to make this change? | `projscan start --intent "is my agent allowed to change billing retry logic?"` |
387
429
  | Did the change stay inside scope? | `projscan prove --changed --contract .projscan/proof-contract.json --format markdown` |
430
+ | Can a reviewer trust this agent handoff? | `projscan passport --contract .projscan/proof-contract.json --format markdown` |
431
+ | Is the agent drifting from the contract? | `projscan guard --contract .projscan/proof-contract.json` |
388
432
  | Which files have high risk and low coverage? | `projscan coverage --format json` |
389
433
  | What should my agent do next? | `projscan workplan --format json` |
390
434
  | Which proof belongs in this PR? | `projscan evidence-pack --pr-comment` |
@@ -400,6 +444,8 @@ npx -y projscan mcp --watch
400
444
  | `projscan assess` | proof-first assessment with Proof Cards, risk delta, and fix-first guidance |
401
445
  | `projscan simulate` | risk delta simulator for a proposed change plan before editing |
402
446
  | `projscan prove` | executable Proof Contracts, Verified Workflow JSON, and Proof Receipts |
447
+ | `projscan passport` | local change passport with boundary, receipt, proof, and reviewer action |
448
+ | `projscan guard` | current working tree check against a saved Proof Contract |
403
449
  | `projscan evidence-pack` | review evidence with risks, owners, proof receipts, and next commands |
404
450
  | `projscan bug-hunt` | ranked fix queue from health, hotspots, session, and preflight evidence |
405
451
  | `projscan workplan` | ordered agent tasks with proof and handoff text |
@@ -604,7 +650,7 @@ Supply-chain scanners may flag package strings or APIs used by `git`, `npm audit
604
650
 
605
651
  ## Install Notes
606
652
 
607
- `projscan@4.16.0` has seven direct runtime dependencies:
653
+ `projscan@4.17.0` has seven direct runtime dependencies:
608
654
 
609
655
  - `@babel/parser`
610
656
  - `@babel/types`
@@ -614,7 +660,7 @@ Supply-chain scanners may flag package strings or APIs used by `git`, `npm audit
614
660
  - `ora`
615
661
  - `web-tree-sitter`
616
662
 
617
- If npm prints `allow-scripts` warnings during a global install, check which package names it lists. projscan core does not need `node-gyp` grammar builds at runtime in 4.16.0. Open an issue with the warning text if npm reports install scripts from `projscan@latest`, or run `projscan feedback intake --text "<warning text>" --format json` to turn it into a focused setup-trust task.
663
+ If npm prints `allow-scripts` warnings during a global install, check which package names it lists. projscan core does not need `node-gyp` grammar builds at runtime in 4.17.0. Open an issue with the warning text if npm reports install scripts from `projscan@latest`, or run `projscan feedback intake --text "<warning text>" --format json` to turn it into a focused setup-trust task.
618
664
 
619
665
  The grammar packages are build-time sources, not global-install dependencies. Published grammar assets include `tree-sitter-python.wasm` and `tree-sitter-c_sharp.wasm`.
620
666
 
@@ -0,0 +1,3 @@
1
+ import type { GuardReport } from '../../types/guard.js';
2
+ export declare function registerGuard(): void;
3
+ export declare function renderGuardMarkdown(report: GuardReport): string;
@@ -0,0 +1,158 @@
1
+ import chalk from 'chalk';
2
+ import { assertFormatSupported, getRootPath, maybeCompactBanner, program, setupLogLevel, } from '../_shared.js';
3
+ import { computeGuard } from '../../core/guard.js';
4
+ import { escapeMarkdownText, markdownInlineCode } from '../../core/markdownSafety.js';
5
+ export function registerGuard() {
6
+ program
7
+ .command('guard')
8
+ .description('Check the current working tree against a saved Proof Contract')
9
+ .option('--contract <path>', 'Proof Contract JSON path')
10
+ .option('--base-ref <ref>', 'base ref for changed-file detection')
11
+ .option('--ledger <path>', 'proof ledger JSONL path')
12
+ .option('--fail-on-drift', 'exit non-zero when scope drift or missing contract is detected')
13
+ .option('--watch', 'poll for guard status changes until interrupted')
14
+ .option('--interval-ms <ms>', 'watch poll interval in milliseconds', parsePositiveInt, 2000)
15
+ .action(async (cmdOpts) => {
16
+ setupLogLevel();
17
+ maybeCompactBanner();
18
+ const format = assertFormatSupported('guard');
19
+ try {
20
+ const options = {
21
+ contractPath: cmdOpts.contract,
22
+ baseRef: cmdOpts.baseRef,
23
+ ledgerPath: cmdOpts.ledger,
24
+ };
25
+ if (cmdOpts.watch) {
26
+ await watchGuard(options, {
27
+ format,
28
+ intervalMs: cmdOpts.intervalMs,
29
+ failOnDrift: Boolean(cmdOpts.failOnDrift),
30
+ });
31
+ return;
32
+ }
33
+ const report = await computeGuard(getRootPath(), options);
34
+ printGuard(report, format);
35
+ if (cmdOpts.failOnDrift && (report.status === 'drift' || report.status === 'blocked')) {
36
+ process.exit(report.exitCode);
37
+ }
38
+ }
39
+ catch (err) {
40
+ console.error(chalk.red(err instanceof Error ? err.message : String(err)));
41
+ process.exit(1);
42
+ }
43
+ });
44
+ }
45
+ async function watchGuard(options, settings) {
46
+ let last = '';
47
+ let stopped = false;
48
+ const stop = () => {
49
+ stopped = true;
50
+ };
51
+ process.once('SIGINT', stop);
52
+ while (!stopped) {
53
+ const report = await computeGuard(getRootPath(), options);
54
+ const key = JSON.stringify({
55
+ status: report.status,
56
+ drift: report.drift.files,
57
+ proof: report.proof.status,
58
+ missing: report.proof.missingCommands,
59
+ stale: report.proof.staleCommands,
60
+ failed: report.proof.failedCommands,
61
+ });
62
+ if (key !== last) {
63
+ printGuard(report, settings.format);
64
+ last = key;
65
+ if (settings.failOnDrift && (report.status === 'drift' || report.status === 'blocked')) {
66
+ process.exit(report.exitCode);
67
+ }
68
+ }
69
+ await delay(settings.intervalMs);
70
+ }
71
+ }
72
+ function printGuard(report, format) {
73
+ if (format === 'json') {
74
+ console.log(JSON.stringify(report, null, 2));
75
+ return;
76
+ }
77
+ if (format === 'markdown') {
78
+ console.log(renderGuardMarkdown(report));
79
+ return;
80
+ }
81
+ printGuardConsole(report);
82
+ }
83
+ function printGuardConsole(report) {
84
+ const color = report.status === 'blocked' || report.status === 'drift'
85
+ ? chalk.red
86
+ : report.status === 'attention'
87
+ ? chalk.yellow
88
+ : chalk.green;
89
+ console.log(color(`Projscan Guard: ${report.status}`));
90
+ console.log(report.summary);
91
+ console.log('');
92
+ console.log(chalk.bold('Drift'));
93
+ printList(report.drift.files, 'No scope drift detected');
94
+ console.log('');
95
+ console.log(chalk.bold('Proof'));
96
+ console.log(`- status: ${report.proof.status}`);
97
+ console.log(`- sufficiency: ${report.proof.sufficiencyStatus ?? 'unknown'}`);
98
+ printList(report.proof.missingCommands.slice(0, 5), 'No missing proof commands');
99
+ }
100
+ export function renderGuardMarkdown(report) {
101
+ const lines = [
102
+ '# Projscan Guard',
103
+ '',
104
+ `- **Status:** ${report.status}`,
105
+ `- **Summary:** ${escapeMarkdownText(report.summary)}`,
106
+ `- **Reviewer action:** ${report.reviewerAction}`,
107
+ `- **Exit code:** ${report.exitCode}`,
108
+ '',
109
+ '## Drift',
110
+ '',
111
+ ];
112
+ renderList(lines, report.drift.files);
113
+ lines.push('');
114
+ lines.push('## Proof');
115
+ lines.push('');
116
+ lines.push(`- **Status:** ${report.proof.status}`);
117
+ lines.push(`- **Sufficiency:** ${report.proof.sufficiencyStatus ?? 'unknown'}`);
118
+ renderCommandGroup(lines, 'Missing', report.proof.missingCommands);
119
+ renderCommandGroup(lines, 'Failed', report.proof.failedCommands);
120
+ renderCommandGroup(lines, 'Stale', report.proof.staleCommands);
121
+ return lines.join('\n');
122
+ }
123
+ function renderCommandGroup(lines, label, values) {
124
+ lines.push(`- **${label}:**`);
125
+ if (values.length === 0) {
126
+ lines.push(' - none');
127
+ return;
128
+ }
129
+ for (const value of values)
130
+ lines.push(` - ${markdownInlineCode(value)}`);
131
+ }
132
+ function renderList(lines, values) {
133
+ if (values.length === 0) {
134
+ lines.push('- none');
135
+ return;
136
+ }
137
+ for (const value of values)
138
+ lines.push(`- ${markdownInlineCode(value)}`);
139
+ }
140
+ function printList(values, empty) {
141
+ if (values.length === 0) {
142
+ console.log(`- ${empty}`);
143
+ return;
144
+ }
145
+ for (const value of values)
146
+ console.log(`- ${value}`);
147
+ }
148
+ function parsePositiveInt(value) {
149
+ const parsed = Number.parseInt(value, 10);
150
+ if (!Number.isFinite(parsed) || parsed <= 0) {
151
+ throw new Error('value must be a positive integer');
152
+ }
153
+ return parsed;
154
+ }
155
+ function delay(ms) {
156
+ return new Promise((resolve) => setTimeout(resolve, ms));
157
+ }
158
+ //# sourceMappingURL=guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.js","sourceRoot":"","sources":["../../../src/cli/commands/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGtF,MAAM,UAAU,aAAa;IAC3B,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,+DAA+D,CAAC;SAC5E,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;SACvD,MAAM,CAAC,kBAAkB,EAAE,qCAAqC,CAAC;SACjE,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;SACpD,MAAM,CAAC,iBAAiB,EAAE,gEAAgE,CAAC;SAC3F,MAAM,CAAC,SAAS,EAAE,iDAAiD,CAAC;SACpE,MAAM,CAAC,oBAAoB,EAAE,qCAAqC,EAAE,gBAAgB,EAAE,IAAI,CAAC;SAC3F,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,aAAa,EAAE,CAAC;QAChB,kBAAkB,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAE9C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG;gBACd,YAAY,EAAE,OAAO,CAAC,QAAQ;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,UAAU,EAAE,OAAO,CAAC,MAAM;aAC3B,CAAC;YACF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gB;IACnD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,SAAS,CAAC,MAAgB,EAAE,KAAa;IAChD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AgentChangePassport } from '../../types/passport.js';
2
+ export declare function registerPassport(): void;
3
+ export declare function renderPassportMarkdown(passport: AgentChangePassport): string;
@@ -0,0 +1,154 @@
1
+ import chalk from 'chalk';
2
+ import { assertFormatSupported, getRootPath, loadProjectConfig, maybeCompactBanner, program, setupLogLevel, } from '../_shared.js';
3
+ import { computePassport } from '../../core/passport.js';
4
+ import { escapeMarkdownText, markdownInlineCode } from '../../core/markdownSafety.js';
5
+ export function registerPassport() {
6
+ program
7
+ .command('passport')
8
+ .description('Create an Agent Change Passport from a Proof Contract and current proof receipt')
9
+ .option('--intent <text>', 'plain-language change intent to contract before or during work')
10
+ .option('--contract <path>', 'existing Proof Contract JSON path')
11
+ .option('--save-contract <path>', 'write the generated Proof Contract JSON when --intent is supplied')
12
+ .option('--output <path>', 'write passport JSON to .projscan/passport.json or .projscan/passports/<name>.json')
13
+ .option('--max-files <count>', 'maximum likely touched files to include in a generated contract', parsePositiveInt)
14
+ .option('--feedback <path>', 'local projscan feedback artifact to apply as trust memory')
15
+ .option('--base-ref <ref>', 'base ref for changed-file detection')
16
+ .option('--ledger <path>', 'proof ledger JSONL path')
17
+ .option('--task-id <id>', 'Baseframe task ID for attached assessment evidence')
18
+ .option('--emit-baseframe', 'write the Baseframe ProjScan assessment artifact')
19
+ .action(async (cmdOpts) => {
20
+ setupLogLevel();
21
+ maybeCompactBanner();
22
+ const format = assertFormatSupported('passport');
23
+ try {
24
+ const config = await loadProjectConfig();
25
+ const passport = await computePassport(getRootPath(), {
26
+ intent: cmdOpts.intent,
27
+ contractPath: cmdOpts.contract,
28
+ saveContractPath: cmdOpts.saveContract,
29
+ outputPath: cmdOpts.output,
30
+ maxFiles: cmdOpts.maxFiles,
31
+ feedbackPath: cmdOpts.feedback,
32
+ baseRef: cmdOpts.baseRef,
33
+ ledgerPath: cmdOpts.ledger,
34
+ taskId: cmdOpts.taskId,
35
+ emitBaseframe: Boolean(cmdOpts.emitBaseframe),
36
+ proofRecipes: config.proofRecipes,
37
+ });
38
+ if (format === 'json') {
39
+ console.log(JSON.stringify(passport, null, 2));
40
+ return;
41
+ }
42
+ if (format === 'markdown') {
43
+ console.log(renderPassportMarkdown(passport));
44
+ return;
45
+ }
46
+ printPassportConsole(passport);
47
+ }
48
+ catch (err) {
49
+ console.error(chalk.red(err instanceof Error ? err.message : String(err)));
50
+ process.exit(1);
51
+ }
52
+ });
53
+ }
54
+ function printPassportConsole(passport) {
55
+ const color = passport.status === 'blocked' || passport.status === 'drifted'
56
+ ? chalk.red
57
+ : passport.status === 'needs-proof'
58
+ ? chalk.yellow
59
+ : chalk.green;
60
+ console.log(color(`Projscan Passport: ${passport.status}`));
61
+ console.log(passport.summary);
62
+ console.log('');
63
+ console.log(chalk.bold('Reviewer'));
64
+ console.log(`- decision: ${passport.reviewer.decision}`);
65
+ console.log(`- action: ${passport.reviewer.action}`);
66
+ console.log(`- ${passport.reviewer.summary}`);
67
+ console.log('');
68
+ console.log(chalk.bold('Boundary'));
69
+ printList(passport.boundary.allowedFiles.slice(0, 8), 'No allowed files in contract');
70
+ if (passport.boundary.forbiddenFiles.length > 0) {
71
+ console.log('');
72
+ console.log(chalk.bold('Forbidden'));
73
+ printList(passport.boundary.forbiddenFiles.slice(0, 8), 'No forbidden files in contract');
74
+ }
75
+ console.log('');
76
+ console.log(chalk.bold('Receipt'));
77
+ console.log(`- scope: ${passport.receipt.scopeStatus}`);
78
+ console.log(`- proof: ${passport.receipt.proofStatus}`);
79
+ console.log(`- sufficiency: ${passport.receipt.proofSufficiencyStatus ?? 'unknown'}`);
80
+ console.log(`- changed files: ${passport.receipt.changedFiles.length}`);
81
+ console.log('');
82
+ console.log(chalk.bold('Next Commands'));
83
+ printList(passport.nextCommands.slice(0, 8), 'No next commands');
84
+ }
85
+ export function renderPassportMarkdown(passport) {
86
+ const lines = [
87
+ '# Projscan Agent Change Passport',
88
+ '',
89
+ `- **Status:** ${passport.status}`,
90
+ `- **Summary:** ${escapeMarkdownText(passport.summary)}`,
91
+ `- **Reviewer action:** ${passport.reviewer.action}`,
92
+ `- **Reviewer decision:** ${passport.reviewer.decision}`,
93
+ ];
94
+ if (passport.intent)
95
+ lines.push(`- **Intent:** ${escapeMarkdownText(passport.intent)}`);
96
+ if (passport.artifacts.contractPath) {
97
+ lines.push(`- **Contract:** ${markdownInlineCode(passport.artifacts.contractPath)}`);
98
+ }
99
+ if (passport.artifacts.passportPath) {
100
+ lines.push(`- **Passport:** ${markdownInlineCode(passport.artifacts.passportPath)}`);
101
+ }
102
+ if (passport.baseframe) {
103
+ lines.push(`- **Baseframe assessment:** ${markdownInlineCode(passport.baseframe.assessmentPath)}`);
104
+ }
105
+ lines.push('');
106
+ lines.push('## Boundary');
107
+ lines.push('');
108
+ renderCommandOrFileList(lines, 'Allowed files', passport.boundary.allowedFiles);
109
+ renderCommandOrFileList(lines, 'Forbidden files', passport.boundary.forbiddenFiles);
110
+ renderCommandOrFileList(lines, 'Likely tests', passport.boundary.likelyTests);
111
+ renderCommandOrFileList(lines, 'Proof commands', passport.boundary.proofCommands);
112
+ lines.push('');
113
+ lines.push('## Receipt');
114
+ lines.push('');
115
+ lines.push(`- **Scope:** ${passport.receipt.scopeStatus}`);
116
+ lines.push(`- **Proof:** ${passport.receipt.proofStatus}`);
117
+ lines.push(`- **Proof sufficiency:** ${passport.receipt.proofSufficiencyStatus ?? 'unknown'}`);
118
+ lines.push(`- **Proof replay:** ${passport.receipt.proofReplayStatus ?? 'unknown'}`);
119
+ renderCommandOrFileList(lines, 'Changed files', passport.receipt.changedFiles);
120
+ renderCommandOrFileList(lines, 'Forbidden touched', passport.receipt.forbiddenTouched);
121
+ renderCommandOrFileList(lines, 'Outside allowed', passport.receipt.outsideAllowed);
122
+ renderCommandOrFileList(lines, 'Changed after proof', passport.receipt.changedAfterProof);
123
+ lines.push('');
124
+ lines.push('## Next Commands');
125
+ lines.push('');
126
+ for (const command of passport.nextCommands)
127
+ lines.push(`- ${markdownInlineCode(command)}`);
128
+ return lines.join('\n');
129
+ }
130
+ function renderCommandOrFileList(lines, label, values) {
131
+ lines.push(`- **${label}:**`);
132
+ if (values.length === 0) {
133
+ lines.push(' - none');
134
+ return;
135
+ }
136
+ for (const value of values.slice(0, 12))
137
+ lines.push(` - ${markdownInlineCode(value)}`);
138
+ }
139
+ function printList(values, empty) {
140
+ if (values.length === 0) {
141
+ console.log(`- ${empty}`);
142
+ return;
143
+ }
144
+ for (const value of values)
145
+ console.log(`- ${value}`);
146
+ }
147
+ function parsePositiveInt(value) {
148
+ const parsed = Number.parseInt(value, 10);
149
+ if (!Number.isFinite(parsed) || parsed <= 0) {
150
+ throw new Error('value must be a positive integer');
151
+ }
152
+ return parsed;
153
+ }
154
+ //# sourceMappingURL=passport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passport.js","sourceRoot":"","sources":["../../../src/cli/commands/passport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,EACP,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGtF,MAAM,UAAU,gBAAgB;IAC9B,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,iFAAiF,CAAC;SAC9F,MAAM,CAAC,iBAAiB,EAAE,gEAAgE,CAAC;SAC3F,MAAM,CAAC,mBAAmB,EAAE,mCAAmC,CAAC;SAChE,MAAM,CAAC,wBAAwB,EAAE,mEAAmE,CAAC;SACrG,MAAM,CAAC,iBAAiB,EAAE,mFAAmF,CAAC;SAC9G,MAAM,CAAC,qBAAqB,EAAE,iEAAiE,EAAE,gBAAgB,CAAC;SAClH,MAAM,CAAC,mBAAmB,EAAE,2DAA2D,CAAC;SACxF,MAAM,CAAC,kBAAkB,EAAE,qCAAqC,CAAC;SACjE,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;SACpD,MAAM,CAAC,gBAAgB,EAAE,oDAAoD,CAAC;SAC9E,MAAM,CAAC,kBAAkB,EAAE,kDAAkD,CAAC;SAC9E,MAAM,CAAC,KAAK,EAAE,OAAO,E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AC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAe,EAAE,KAAa,EAAE,MAAgB;IAC/E,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC;IAC9B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvB,OAAO;IACT,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,SAAS,SAAS,CAAC,MAAgB,EAAE,KAAa;IAChD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -51,6 +51,8 @@ import { registerQualityScorecard } from './commands/qualityScorecard.js';
51
51
  import { registerAssess } from './commands/assess.js';
52
52
  import { registerSimulate } from './commands/simulate.js';
53
53
  import { registerProve } from './commands/prove.js';
54
+ import { registerPassport } from './commands/passport.js';
55
+ import { registerGuard } from './commands/guard.js';
54
56
  import { registerFirstRun, registerRecipes } from './commands/recipes.js';
55
57
  import { registerStart } from './commands/start.js';
56
58
  import { registerTrial } from './commands/trial.js';
@@ -113,6 +115,8 @@ export const CLI_COMMAND_REGISTRARS = [
113
115
  registerAssess,
114
116
  registerSimulate,
115
117
  registerProve,
118
+ registerPassport,
119
+ registerGuard,
116
120
  registerStart,
117
121
  registerTrial,
118
122
  registerTelemetry,
@@ -1 +1 @@
1
- {"version":3,"file":"registerCommands.js","sourceRoot":"","sources":["../../src/cli/registerCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,y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B,oBAAoB;IACpB,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,kBAAkB;IAClB,oBAAoB;IACpB,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,aAAa;IACb,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,qBAAqB;IACrB,WAAW;IACX,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,mBAAmB;IACnB,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,gBAAgB;IAChB,oBAAoB;IACpB,eAAe;IACf,oBAAoB;IACpB,eAAe;IACf,gBAAgB;IAChB,sBAAsB;IACtB,kBAAkB;IAClB,wBAAwB;IACxB,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,oBAAoB;IACpB,eAAe;IACf,gBAAgB;IAChB,YAAY;CACgB,CAAC;AAE/B,MAAM,UAAU,mBAAmB,CACjC,aAA0C,sBAAsB;IAEhE,KAAK,MAAM,eAAe,IAAI,UAAU,EAAE,CAAC;QACzC,eAAe,EAAE,CAAC;IACpB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"registerCommands.js","sourceRoot":"","sources":["../../src/cli/registerCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;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;IAChB,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,oBAAoB;IACpB,eAAe;IACf,gBAAgB;IAChB,YAAY;CACgB,CAAC;AAE/B,MAAM,UAAU,mBAAmB,CACjC,aAA0C,sBAAsB;IAEhE,KAAK,MAAM,eAAe,IAAI,UAAU,EAAE,CAAC;QACzC,eAAe,EAAE,CAAC;IACpB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ComputeGuardOptions, GuardReport } from '../types/guard.js';
2
+ export declare function computeGuard(rootPath: string, options?: ComputeGuardOptions): Promise<GuardReport>;
@@ -0,0 +1,107 @@
1
+ import { computeProve } from './prove.js';
2
+ export async function computeGuard(rootPath, options = {}) {
3
+ const report = await computeProve(rootPath, {
4
+ changed: true,
5
+ contractPath: options.contractPath,
6
+ baseRef: options.baseRef,
7
+ ledgerPath: options.ledgerPath,
8
+ });
9
+ const receipt = report.receipt;
10
+ const status = guardStatus(receipt);
11
+ const reviewerAction = guardReviewerAction(status, receipt);
12
+ return {
13
+ schemaVersion: 1,
14
+ kind: 'agent-scope-guard',
15
+ status,
16
+ exitCode: exitCodeFor(status),
17
+ summary: guardSummary(status, receipt),
18
+ reviewerAction,
19
+ drift: {
20
+ status: receipt?.scope.status ?? 'missing-contract',
21
+ files: driftFiles(receipt),
22
+ forbiddenTouched: receipt?.scope.forbiddenTouched ?? [],
23
+ outsideAllowed: receipt?.scope.outsideAllowed ?? [],
24
+ changedAfterProof: receipt?.proofReplay?.changedAfterProof ?? [],
25
+ },
26
+ proof: {
27
+ status: receipt?.proofStatus.status ?? 'missing',
28
+ ...(receipt?.proofSufficiency?.status ? { sufficiencyStatus: receipt.proofSufficiency.status } : {}),
29
+ missingCommands: receipt?.proofStatus.missingCommands ?? [],
30
+ failedCommands: receipt?.proofStatus.failedCommands ?? [],
31
+ staleCommands: receipt?.proofStatus.staleCommands ?? [],
32
+ },
33
+ mutatedFiles: [],
34
+ ...(receipt ? { receipt } : {}),
35
+ };
36
+ }
37
+ function guardStatus(receipt) {
38
+ if (!receipt || receipt.scope.status === 'missing-contract')
39
+ return 'blocked';
40
+ if (receipt.scope.status === 'drifted' ||
41
+ receipt.scope.forbiddenTouched.length > 0 ||
42
+ receipt.scope.outsideAllowed.length > 0 ||
43
+ (receipt.proofReplay?.changedAfterProof.length ?? 0) > 0) {
44
+ return 'drift';
45
+ }
46
+ if (receipt.proofStatus.status === 'failed')
47
+ return 'blocked';
48
+ if (receipt.proofStatus.status === 'missing' ||
49
+ receipt.proofStatus.status === 'not-run' ||
50
+ receipt.proofStatus.status === 'partial' ||
51
+ receipt.proofStatus.status === 'stale' ||
52
+ receipt.proofSufficiency?.status === 'missing' ||
53
+ receipt.proofSufficiency?.status === 'weak' ||
54
+ receipt.proofSufficiency?.status === 'stale' ||
55
+ receipt.proofSufficiency?.status === 'failed') {
56
+ return 'attention';
57
+ }
58
+ return 'clear';
59
+ }
60
+ function guardReviewerAction(status, receipt) {
61
+ if (status === 'drift' || !receipt || receipt.scope.status === 'missing-contract') {
62
+ return 'stop-and-recontract';
63
+ }
64
+ if (status === 'blocked' || receipt.proofStatus.status === 'failed')
65
+ return 'rerun-proof';
66
+ if (status === 'attention') {
67
+ return receipt.proofStatus.status === 'stale' ? 'rerun-proof' : 'run-proof';
68
+ }
69
+ return 'continue';
70
+ }
71
+ function guardSummary(status, receipt) {
72
+ if (!receipt)
73
+ return 'blocked: no Proof Contract is available for guard evaluation.';
74
+ if (status === 'drift') {
75
+ const files = driftFiles(receipt);
76
+ return files.length > 0
77
+ ? `drift: ${files.join(', ')} changed outside the approved proof boundary.`
78
+ : 'drift: proof is stale because files changed after proof ran.';
79
+ }
80
+ if (status === 'blocked')
81
+ return 'blocked: proof failed or the Proof Contract is missing.';
82
+ if (status === 'attention')
83
+ return `attention: proof is ${receipt.proofStatus.status}.`;
84
+ return 'clear: scope and proof satisfy the current Proof Contract.';
85
+ }
86
+ function driftFiles(receipt) {
87
+ if (!receipt)
88
+ return [];
89
+ return unique([
90
+ ...receipt.scope.forbiddenTouched,
91
+ ...receipt.scope.outsideAllowed,
92
+ ...(receipt.proofReplay?.changedAfterProof ?? []),
93
+ ]);
94
+ }
95
+ function exitCodeFor(status) {
96
+ if (status === 'clear')
97
+ return 0;
98
+ if (status === 'attention')
99
+ return 1;
100
+ if (status === 'drift')
101
+ return 2;
102
+ return 3;
103
+ }
104
+ function unique(values) {
105
+ return [...new Set(values.filter(Boolean))];
106
+ }
107
+ //# sourceMappingURL=guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.js","sourceRoot":"","sources":["../../src/core/guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,QAAgB,EAChB,UAA+B,EAAE;IAEjC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE;QAC1C,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5D,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,IAAI,EAAE,mBAAmB;QACzB,MAAM;QACN,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC;QAC7B,OAAO,EAAE,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC;QACtC,cAAc;QACd,KAAK,EAAE;YACL,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,IAAI,kBAAkB;YACnD,KAAK,EAAE,UAA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C,CAAC;QAClC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC;YACrB,CAAC,CAAC,UAAU,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,+CAA+C;YAC3E,CAAC,CAAC,8DAA8D,CAAC;IACrE,CAAC;IACD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,yDAAyD,CAAC;IAC3F,IAAI,MAAM,KAAK,WAAW;QAAE,OAAO,uBAAuB,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;IACxF,OAAO,4DAA4D,CAAC;AACtE,CAAC;AAED,SAAS,UAAU,CAAC,OAAiC;IACnD,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,OAAO,MAAM,CAAC;QACZ,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB;QACjC,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc;QAC/B,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,iBAAiB,IAAI,EAAE,CAAC;KAClD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,MAAmB;IACtC,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,CAAC,CAAC;IACjC,IAAI,MAAM,KAAK,WAAW;QAAE,OAAO,CAAC,CAAC;IACrC,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,MAAM,CAAC,MAAgB;IAC9B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { AgentChangePassport, ComputePassportOptions } from '../types/passport.js';
2
+ export declare function computePassport(rootPath: string, options?: ComputePassportOptions): Promise<AgentChangePassport>;