@olegkoval/agent-skills 1.83.0 → 1.85.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.
Files changed (53) hide show
  1. package/.github/copilot-instructions.md +1 -0
  2. package/.github/prompts/1password-agent-access.prompt.md +156 -0
  3. package/.kiro/steering/1password-agent-access.md +155 -0
  4. package/.windsurf/rules/1password-agent-access.md +154 -0
  5. package/README.md +4 -3
  6. package/adapters/claude/olko-github-pr/skills/lekker-review/SKILL.md +13 -3
  7. package/adapters/claude/olko-github-pr/skills/lekker-review/references/boundary-evidence.md +73 -0
  8. package/adapters/claude/olko-github-pr/skills/lekker-review/references/codex-workflow.md +5 -0
  9. package/adapters/claude/olko-github-pr/skills/lekker-review/references/defect-evaluation.md +82 -0
  10. package/adapters/claude/olko-github-pr/skills/lekker-review/references/evidence-efficiency-ablation.md +59 -0
  11. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-probe-contract.mjs +33 -0
  12. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-probe-runner.mjs +92 -0
  13. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-probe.mjs +22 -0
  14. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-report.mjs +2 -2
  15. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-source.mjs +3 -2
  16. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/boundary-validation.mjs +97 -0
  17. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/evidence-bundle.mjs +30 -13
  18. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/evidence-packet.mjs +74 -0
  19. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/stage-ledger.mjs +96 -0
  20. package/adapters/claude/olko-skill-meta/skills/1password-agent-access/SKILL.md +158 -0
  21. package/adapters/codex/olko-skill-meta/README.md +1 -0
  22. package/adapters/cursor/olko-skill-meta/skills/1password-agent-access/SKILL.md +158 -0
  23. package/adapters/grok/olko-skill-meta/skills/1password-agent-access/SKILL.md +158 -0
  24. package/adapters/hermes/olko-skill-meta/README.md +1 -0
  25. package/catalog/skills.json +22 -0
  26. package/package.json +1 -1
  27. package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
  28. package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
  29. package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
  30. package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
  31. package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
  32. package/plugins/olko-github-pr/skills/lekker-review/SKILL.md +13 -3
  33. package/plugins/olko-github-pr/skills/lekker-review/references/boundary-evidence.md +73 -0
  34. package/plugins/olko-github-pr/skills/lekker-review/references/codex-workflow.md +5 -0
  35. package/plugins/olko-github-pr/skills/lekker-review/references/defect-evaluation.md +82 -0
  36. package/plugins/olko-github-pr/skills/lekker-review/references/evidence-efficiency-ablation.md +59 -0
  37. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-probe-contract.mjs +33 -0
  38. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-probe-runner.mjs +92 -0
  39. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-probe.mjs +22 -0
  40. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-report.mjs +2 -2
  41. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-source.mjs +3 -2
  42. package/plugins/olko-github-pr/skills/lekker-review/scripts/boundary-validation.mjs +97 -0
  43. package/plugins/olko-github-pr/skills/lekker-review/scripts/evidence-bundle.mjs +30 -13
  44. package/plugins/olko-github-pr/skills/lekker-review/scripts/evidence-packet.mjs +74 -0
  45. package/plugins/olko-github-pr/skills/lekker-review/scripts/stage-ledger.mjs +96 -0
  46. package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
  47. package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
  48. package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
  49. package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
  50. package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
  51. package/plugins/olko-skill-meta/skills/1password-agent-access/SKILL.md +157 -0
  52. package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
  53. package/scripts/lib/catalog.mjs +1 -1
@@ -0,0 +1,82 @@
1
+ # Defect-aware evaluation
2
+
3
+ The existing `eval-runner.mjs` mode remains a location-based legacy heuristic.
4
+ Use `--defects` only for a local, human-approved frozen corpus with reproduced
5
+ defect contracts. It reads data files and never executes reviewed PR code.
6
+
7
+ ## Inputs
8
+
9
+ The manifest records full commit identities, expected runs, and defect contracts:
10
+
11
+ ```json
12
+ {
13
+ "schema": 1,
14
+ "defects": [{
15
+ "id": "DEFECT-1",
16
+ "contract": "Supported long run targets must create an archive without ENAMETOOLONG.",
17
+ "reproductionEvidence": "oracle/reproduction.md"
18
+ }],
19
+ "cases": [{
20
+ "id": "case-buggy",
21
+ "headSha": "<40-character commit SHA>",
22
+ "expectedDefects": ["DEFECT-1"],
23
+ "expectedRuns": 1
24
+ }]
25
+ }
26
+ ```
27
+
28
+ Each results entry carries the completed run identity and the exact findings JSON
29
+ bytes as a string. The evaluator hashes the UTF-8 bytes; formatting changes
30
+ therefore invalidate the adjudication. Include a row for every expected run.
31
+
32
+ ```json
33
+ {"runs":[{"caseId":"case-buggy","runId":"review-001","status":"completed",
34
+ "headSha":"<same full SHA>","findingsBytes":"[{\"file\":\"src/a.js\",\"line\":3,\"severity\":\"important\"}]"}]}
35
+ ```
36
+
37
+ Adjudication is separate from the findings and binds the exact run, commit, and
38
+ finding bytes. Every finding index needs exactly one verdict, rationale, and
39
+ evidence reference. A confirmed verdict also needs a defect ID; use a new ID for
40
+ a candidate defect not yet in the registry.
41
+
42
+ ```json
43
+ {"evaluations":[{"runId":"review-001","headSha":"<same full SHA>",
44
+ "findingsSha256":"<64-character SHA-256>","decisions":[
45
+ {"findingIndex":0,"verdict":"confirmed","defectId":"DEFECT-1",
46
+ "rationale":"Matches the reproduction contract","evidence":"adjudication/DEFECT-1.md"}]}]}
47
+ ```
48
+
49
+ Run the opt-in scorer:
50
+
51
+ ```sh
52
+ node "${SKILL_ROOT}/scripts/eval-runner.mjs" --defects \
53
+ --manifest <manifest.json> --results <defect-runs.json> \
54
+ --adjudication <adjudication.json>
55
+ ```
56
+
57
+ ## Reading the result
58
+
59
+ `available` and `coverageComplete` must both be true before treating corpus
60
+ metrics as complete. Missing, duplicate, malformed, unresolved, or mismatched
61
+ evidence keeps coverage unavailable. A newly confirmed defect remains visible
62
+ but requires corpus adjudication and is not added to the recall denominator.
63
+
64
+ - Recall is expected defect IDs detected, deduplicated once per case run.
65
+ - Precision is confirmed finding decisions divided by confirmed plus false-alarm
66
+ finding decisions. Repeated claims count here because each finding is a
67
+ separate decision; `uniqueConfirmedDefects` reports deduplicated IDs.
68
+ - False alarms are explicit adjudications, not inferred from severity.
69
+ - False alarms per review and clean alarm rate use fully adjudicated runs.
70
+ - `distinctCases` counts case IDs represented; it does not claim statistical
71
+ independence between related cases.
72
+ - Empty precision or recall denominators are `null`, never zero.
73
+
74
+ ## Measurement protocol
75
+
76
+ Evaluate only previously unseen cases with frozen base, buggy, and fixed commits
77
+ and a reproduced contract for each known defect. Hide arm identity and version
78
+ labels from adjudicators; provide the finding text and contract needed to judge
79
+ each claim. Randomize paired case/version order. Record cost for all agents and
80
+ retries in both arms. Report missing
81
+ coverage and unresolved judgments. This harness does not establish a benefit
82
+ claim; that requires a completed, blinded comparison over the frozen protocol.
@@ -0,0 +1,59 @@
1
+ # Evidence projection ablation: preregistration draft
2
+
3
+ This is a future experiment design only. Do not run it as part of implementation.
4
+ The four-case 2026-11-08 screen failed promotion and its cases are now known
5
+ development fixtures. Freeze a new holdout before any model call.
6
+
7
+ ## Arms and scope
8
+
9
+ - Baseline: the assigned dimension reviewer receives the full immutable evidence
10
+ bundle and the same review inputs as today.
11
+ - Projection: that reviewer receives the deterministic, hash-verified packet
12
+ for its assigned dimension. A whole-diff safety pass receives the same full
13
+ diff in both arms; its reviewer count, prompt, proof policy, and routing stay
14
+ fixed. Omitted packet context is never marked reviewed.
15
+ - Use the same pinned model, effort, tools, prompts, timeout, and retry policy in
16
+ both arms. Run one case-arm at a time; alternate arm order within each pair.
17
+
18
+ ## Corpus and procedure
19
+
20
+ Freeze at least 30 independent PR-level pairs from at least three repositories,
21
+ covering three or more defect families. Prefer real bug-introducing commits and
22
+ their repairs; include safe controls and near-boundary changes with explicit
23
+ contracts. Keep root causes and repositories disjoint from packet-development
24
+ fixtures. Record base/head SHAs, contracts, valid-input assumptions, expected
25
+ findings, and immutable source hashes before unblinding. Adjudicators see claims
26
+ and evidence without the arm label.
27
+
28
+ Run three paired repetitions per PR with counterbalanced order and no retries.
29
+ The PR is the sampling unit; repetitions are nested observations, not new PRs.
30
+ Record every reviewer, coordinator, and verification session once from explicit
31
+ saved manifests, plus measured setup/adjudication minutes. Preserve cached,
32
+ uncached, total input, and output tokens separately. Record elapsed observations
33
+ separately; do not sum overlapping durations or convert token sums to currency.
34
+ The primary all-in cost uses invoice-backed provider charges plus a frozen
35
+ hourly rate for measured setup, coordination, adjudication, and verification.
36
+ Freeze provider rates, currency, and labor rate before collection. If charges or
37
+ labor measurements are unavailable, report the resource vector and leave the
38
+ cost endpoint unavailable; do not promote on token totals alone.
39
+
40
+ ## Analysis and stop rules
41
+
42
+ Before collection, freeze the smallest worthwhile all-in cost reduction, the
43
+ defect-recall non-inferiority margin, a hard review-cost ceiling, and the
44
+ maximum sample size. Report paired PR-level differences and 95% cluster
45
+ bootstrap intervals, resampling PRs while keeping their repetitions together.
46
+ Include false alarms, duplicate claims, unavailable evidence, packet bytes, all
47
+ review/coordinator/verification usage, and manual time. Byte reduction is a
48
+ mechanism check, not the efficiency endpoint.
49
+
50
+ Stop immediately on cross-tenant/data exposure, a missed critical defect, stale
51
+ provenance accepted as available, or budget exhaustion. Otherwise evaluate at
52
+ 30 pairs; add only the predeclared next batch when intervals are too wide, up to
53
+ the frozen maximum. Promote only if the cost interval clears the worthwhile
54
+ effect and the recall interval stays within its safety margin. Otherwise retain
55
+ shadow mode and report the result as inconclusive or failed.
56
+
57
+ No sample-size or quality claim is supported by the existing four-case screen.
58
+ The coordinator must approve the frozen corpus, thresholds, and spend ceiling
59
+ before this experiment is launched.
@@ -0,0 +1,33 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { readFileSync } from 'node:fs'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ const HELPER_MODULES = Object.freeze(['boundary-cases.mjs', 'boundary-filesystem.mjs', 'boundary-invocation.mjs', 'boundary-probe-contract.mjs', 'boundary-probe-runner.mjs', 'boundary-report.mjs', 'boundary-source.mjs', 'boundary-validation.mjs', 'git-evidence.mjs'])
6
+ const sha256 = value => createHash('sha256').update(value).digest('hex')
7
+
8
+ export const unavailable = reason => ({ schema: 1, status: 'unavailable', reason, candidates: [] })
9
+
10
+ export function observedChangedPath(bundle, source) {
11
+ return bundle?.git?.status === 'available' && Array.isArray(bundle.git.changedPaths)
12
+ && bundle.git.changedPaths.includes(source) && /^[a-f0-9]{40,64}$/.test(bundle.git.provenance?.baseSha ?? '')
13
+ && /^[a-f0-9]{40,64}$/.test(bundle.git.provenance?.headSha ?? '')
14
+ }
15
+
16
+ export function validProbeConfig(config) {
17
+ return config && typeof config === 'object' && !Array.isArray(config) && config.schema === 1
18
+ && typeof config.trustedRoot === 'string' && typeof config.repoSlug === 'string'
19
+ && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(config.repoSlug)
20
+ && (config.suffix === undefined || typeof config.suffix === 'string') && /^[a-z0-9]*$/.test(config.suffix ?? '')
21
+ && (config.inputKind === undefined || config.inputKind === 'ascii')
22
+ && (config.sourcePath === undefined && config.operation === undefined && config.expectedProperty === undefined
23
+ || typeof config.sourcePath === 'string' && /^(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+\.mjs$/.test(config.sourcePath)
24
+ && config.operation === 'node-fs.mkdtempSync.filename'
25
+ && config.expectedProperty === 'valid ASCII targets produce a component within the observed byte limit')
26
+ && Number.isSafeInteger(config.seed)
27
+ && (config.maxInputs === undefined || Number.isSafeInteger(config.maxInputs) && config.maxInputs >= 8 && config.maxInputs <= 88)
28
+ }
29
+
30
+ export function hashBoundaryHelpers(adapterUrl) {
31
+ return Object.fromEntries(HELPER_MODULES.map(name => [name,
32
+ sha256(readFileSync(fileURLToPath(new URL(`./${name}`, adapterUrl))))]))
33
+ }
@@ -0,0 +1,92 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
3
+ import { join, resolve } from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+ import { observeComponentLimit } from './boundary-filesystem.mjs'
6
+ import { runTrustedCli } from './boundary-invocation.mjs'
7
+ import { generateBoundaryCases } from './boundary-cases.mjs'
8
+ import { assembleBoundaryReport, isBoundaryCandidate } from './boundary-report.mjs'
9
+ import { readTrustedSource, RUN_LOG_SOURCE } from './boundary-source.mjs'
10
+ import { hashBoundaryHelpers, observedChangedPath, unavailable, validProbeConfig } from './boundary-probe-contract.mjs'
11
+ import { collectGitEvidence } from './git-evidence.mjs'
12
+
13
+ const sha256 = value => createHash('sha256').update(value).digest('hex')
14
+
15
+ export function runBoundaryProbe({ config, worktreePath, mergeBase, headSha, outputDir, optIn = false }) {
16
+ if (!optIn) return unavailable('explicit trusted-probe opt-in is required')
17
+ const sourcePath = config?.sourcePath ?? RUN_LOG_SOURCE
18
+ const git = collectGitEvidence({ worktreePath, mergeBase, headSha })
19
+ const evidenceBundle = { git }
20
+ if (!observedChangedPath(evidenceBundle, sourcePath)) return unavailable('trusted adapter path is absent from observed Git changed paths')
21
+ if (!validProbeConfig(config)) {
22
+ return unavailable('trusted adapter configuration is missing or malformed')
23
+ }
24
+ try {
25
+ const root = resolve(config.trustedRoot)
26
+ const out = resolve(outputDir)
27
+ if (existsSync(out)) throw new Error('output directory already exists; refusing to overwrite evidence')
28
+ mkdirSync(out, { recursive: false })
29
+ const componentLimit = observeComponentLimit(out)
30
+ if (config.maxComponentBytes !== undefined && config.maxComponentBytes !== componentLimit) throw new Error('configured component limit differs from observed filesystem limit')
31
+ const provenance = evidenceBundle.git.provenance
32
+ const commits = { original: provenance.baseSha, defective: provenance.headSha,
33
+ ...(config.repairedCommit ? { repaired: config.repairedCommit } : {}) }
34
+ const roles = Object.keys(commits)
35
+ const sources = Object.fromEntries(roles.map(role => [role, readTrustedSource(root, commits[role], sourcePath)]))
36
+ const internalPrefix = `${'0'.repeat(15)}-${config.repoSlug}-`
37
+ const cases = generateBoundaryCases({ seed: config.seed, limit: componentLimit,
38
+ prefix: internalPrefix, suffix: config.suffix ?? '', count: config.maxInputs ?? 32, kinds: ['ascii'] })
39
+ .filter(item => /^[a-z0-9-]+$/.test(item.input))
40
+ const suffixBytes = Buffer.byteLength(config.suffix ?? '')
41
+ const room = componentLimit - Buffer.byteLength(internalPrefix) - suffixBytes
42
+ const requiredLengths = [room - 1 + suffixBytes, room + suffixBytes, room + 1 + suffixBytes]
43
+ if (cases.length > 88 || requiredLengths.some(length => !cases.some(item => item.inputBytes === length))) {
44
+ throw new Error('insufficient boundary coverage or input budget leaves no room for bounded reduction')
45
+ }
46
+ for (const [role, source] of Object.entries(sources)) writeFileSync(join(out, `${role}.source.mjs`), source.bytes)
47
+ const results = cases.map(item => {
48
+ const runs = Object.fromEntries(Object.entries(sources).map(([role, source]) => [role,
49
+ runTrustedCli({ source, target: item.input, repoSlug: config.repoSlug, outputDir: out, id: `${item.id}-${role}` })]))
50
+ return { id: item.id, kind: item.kind, input: item.input, inputSha256: item.inputSha256,
51
+ inputBytes: item.inputBytes, prefix: internalPrefix, suffix: config.suffix ?? '',
52
+ status: item.status, artifactRoot: out, runs }
53
+ })
54
+ const shrinkResults = []
55
+ let reduced = null
56
+ const firstCandidate = results.find(isBoundaryCandidate)
57
+ if (firstCandidate) {
58
+ let low = 0, high = firstCandidate.input.length, best = firstCandidate
59
+ for (let step = 0; step < 10 && high - low > 1 && results.length + shrinkResults.length < 100; step += 1) {
60
+ const middle = Math.floor((low + high) / 2), input = firstCandidate.input.slice(0, middle)
61
+ const runs = Object.fromEntries(Object.entries(sources).map(([role, source]) => [role,
62
+ runTrustedCli({ source, target: input, repoSlug: config.repoSlug, outputDir: out, id: `shrink-${step}-${role}` })]))
63
+ const row = { id: `shrink-${step}`, kind: 'ascii', input, inputSha256: sha256(input), inputBytes: Buffer.byteLength(input),
64
+ prefix: internalPrefix, suffix: config.suffix ?? '', status: 'available', artifactRoot: out, runs }
65
+ shrinkResults.push(row)
66
+ if (isBoundaryCandidate(row)) { high = middle; best = row } else low = middle
67
+ }
68
+ if (high - low > 1) throw new Error('bounded counterexample reduction exhausted invocation coverage')
69
+ reduced = best
70
+ }
71
+ const report = assembleBoundaryReport({ source: sourcePath,
72
+ provenance: { trustedRoot: root, repoSlug: config.repoSlug,
73
+ baseSha: provenance.baseSha, headSha: provenance.headSha,
74
+ sources: Object.fromEntries(Object.entries(sources).map(([role, source]) => [role,
75
+ { commit: source.commit, sha256: source.sha256 }])) },
76
+ seed: config.seed, componentLimit, prefixSha256: sha256(internalPrefix),
77
+ suffixSha256: sha256(config.suffix ?? ''), cases, results, shrinkResults, outputDir: out, reduced })
78
+ report.contract = { ...report.contract, operation: config.operation ?? 'node-fs.mkdtempSync.filename',
79
+ expectedProperty: config.expectedProperty ?? 'valid ASCII targets produce a component within the observed byte limit',
80
+ generator: 'seeded ASCII slug boundary lengths with bounded binary shrink',
81
+ applicability: 'source path must appear in observed changed paths', invocationBudget: { inputs: config.maxInputs ?? 32, shrinkSteps: 10, timeoutMs: 5000 } }
82
+ report.provenance.adapterSha256 = sha256(readFileSync(fileURLToPath(new URL('./boundary-probe.mjs', import.meta.url))))
83
+ report.provenance.generatorSha256 = sha256(readFileSync(fileURLToPath(new URL('./boundary-cases.mjs', import.meta.url))))
84
+ report.provenance.moduleSha256 = hashBoundaryHelpers(import.meta.url)
85
+ report.provenance.runtime = process.version
86
+ const bytes = Buffer.from(JSON.stringify(report, null, 2) + '\n')
87
+ writeFileSync(join(out, 'boundary-report.json'), bytes)
88
+ return { ...report, reportSha256: sha256(bytes), reportFile: join(out, 'boundary-report.json') }
89
+ } catch (error) {
90
+ return unavailable(`trusted boundary probe failed: ${error.message}`)
91
+ }
92
+ }
@@ -0,0 +1,22 @@
1
+ import { readFileSync } from 'node:fs'
2
+ import { fileURLToPath } from 'node:url'
3
+ import { runBoundaryProbe } from './boundary-probe-runner.mjs'
4
+ import { unavailable } from './boundary-probe-contract.mjs'
5
+
6
+ function main(argv) {
7
+ const flag = name => { const index = argv.indexOf(`--${name}`); return index < 0 ? null : argv[index + 1] }
8
+ const configPath = flag('config'), worktreePath = flag('worktree'), outputDir = flag('out')
9
+ if (!argv.includes('--trusted-opt-in') || !configPath || !worktreePath || !outputDir) {
10
+ console.error('usage: boundary-probe.mjs --trusted-opt-in --config <trusted.json> --worktree <worktree.json> --out <directory>')
11
+ process.exitCode = 2; return
12
+ }
13
+ try {
14
+ const metadata = JSON.parse(readFileSync(worktreePath, 'utf8'))
15
+ const report = runBoundaryProbe({ config: JSON.parse(readFileSync(configPath, 'utf8')),
16
+ worktreePath: metadata.worktreePath, mergeBase: metadata.mergeBase, headSha: metadata.headSha, outputDir, optIn: true })
17
+ console.log(JSON.stringify(report))
18
+ if (report.status !== 'available') process.exitCode = 1
19
+ } catch { console.log(JSON.stringify(unavailable('probe input could not be read'))); process.exitCode = 2 }
20
+ }
21
+
22
+ if (process.argv[1] === fileURLToPath(import.meta.url)) main(process.argv.slice(2))
@@ -1,4 +1,4 @@
1
- function isCandidate(row) {
1
+ export function isBoundaryCandidate(row) {
2
2
  const original = row.runs?.original, defective = row.runs?.defective, repaired = row.runs?.repaired
3
3
  return original?.status === 'observed' && defective?.status === 'observed'
4
4
  && original.exitClass === 'success' && defective.exitClass === 'component-limit'
@@ -8,7 +8,7 @@ function isCandidate(row) {
8
8
  export function assembleBoundaryReport({ source, provenance, seed, componentLimit, prefixSha256, suffixSha256,
9
9
  cases, results, shrinkResults, outputDir, reduced }) {
10
10
  const allResults = [...results, ...shrinkResults]
11
- const candidates = allResults.filter(isCandidate).map(row => ({ id: row.id, input: row.input,
11
+ const candidates = allResults.filter(isBoundaryCandidate).map(row => ({ id: row.id, input: row.input,
12
12
  evidenceClass: 'composed trusted CLI probe', inputSha256: row.inputSha256,
13
13
  outcomes: Object.fromEntries(Object.entries(row.runs).map(([role, result]) => [role, result.exitCode])) }))
14
14
  const roles = ['original', 'defective', ...(provenance?.sources?.repaired ? ['repaired'] : [])]
@@ -4,8 +4,9 @@ import { execFileSync } from 'node:child_process'
4
4
  export const RUN_LOG_SOURCE = 'plugins/olko-github-pr/skills/lekker-review/scripts/run-log.mjs'
5
5
  const gitEnv = { PATH: '/usr/bin:/bin', HOME: '/nonexistent', GIT_CONFIG_NOSYSTEM: '1', GIT_CONFIG_GLOBAL: '/dev/null' }
6
6
 
7
- export function readTrustedSource(root, commit) {
7
+ export function readTrustedSource(root, commit, sourcePath = RUN_LOG_SOURCE) {
8
8
  if (!/^[a-f0-9]{40}$/.test(commit ?? '')) throw new Error('trusted source needs an exact commit SHA')
9
+ if (typeof sourcePath !== 'string' || sourcePath.startsWith('/') || sourcePath.split('/').some(part => !part || part === '.' || part === '..')) throw new Error('trusted source path must be repository-relative')
9
10
  let resolved
10
11
  try {
11
12
  resolved = execFileSync('git', ['--no-replace-objects', '-C', root, 'rev-parse', '--verify', `${commit}^{commit}`], {
@@ -14,7 +15,7 @@ export function readTrustedSource(root, commit) {
14
15
  } catch { throw new Error('trusted commit is unavailable') }
15
16
  if (resolved !== commit) throw new Error('trusted commit did not resolve exactly')
16
17
  let bytes
17
- try { bytes = execFileSync('git', ['--no-replace-objects', '-C', root, 'show', `${resolved}:${RUN_LOG_SOURCE}`], { env: gitEnv, stdio: ['ignore', 'pipe', 'ignore'] }) }
18
+ try { bytes = execFileSync('git', ['--no-replace-objects', '-C', root, 'show', `${resolved}:${sourcePath}`], { env: gitEnv, stdio: ['ignore', 'pipe', 'ignore'] }) }
18
19
  catch { throw new Error('trusted CLI source is unavailable at the pinned commit') }
19
20
  return { commit: resolved, bytes, sha256: createHash('sha256').update(bytes).digest('hex') }
20
21
  }
@@ -0,0 +1,97 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFileSync, realpathSync } from 'node:fs';
3
+ import { dirname, join, relative, isAbsolute } from 'node:path';
4
+
5
+ const record = value => value && typeof value === 'object' && !Array.isArray(value);
6
+ const fullSha = value => typeof value === 'string' && /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(value);
7
+ const digest = value => typeof value === 'string' && /^[a-f0-9]{64}$/.test(value);
8
+ const sha256 = value => createHash('sha256').update(value).digest('hex');
9
+ const MODULES = ['boundary-cases.mjs', 'boundary-filesystem.mjs', 'boundary-invocation.mjs',
10
+ 'boundary-probe-contract.mjs', 'boundary-probe-runner.mjs', 'boundary-report.mjs', 'boundary-source.mjs', 'boundary-validation.mjs', 'git-evidence.mjs'];
11
+
12
+ export function validateBoundaryReport(probe, git) {
13
+ try {
14
+ if (probe?.status !== 'available' || typeof probe.reportFile !== 'string') return { captureStatus: 'unavailable', reason: probe?.reason ?? 'trusted boundary probe unavailable' };
15
+ const bytes = readFileSync(probe.reportFile), digestValue = createHash('sha256').update(bytes).digest('hex');
16
+ const report = JSON.parse(bytes.toString('utf8'));
17
+ const invalid = validateShape(report, git);
18
+ if (digestValue !== probe.reportSha256 || invalid) return { captureStatus: 'unavailable', reason: invalid ?? 'boundary artifact hash mismatch' };
19
+ const reducedFailure = readReducedFailure(report, probe.reportFile);
20
+ return { captureStatus: 'available', reportPath: probe.reportFile, reportSha256: digestValue,
21
+ provenance: report.provenance, summary: { candidateCount: report.candidates.length,
22
+ inputCount: report.results.length, evidenceClass: 'composed trusted CLI probe',
23
+ ...(reducedFailure ? { reducedFailure } : {}) }, report };
24
+ } catch { return { captureStatus: 'unavailable', reason: 'trusted boundary artifact is missing or malformed' }; }
25
+ }
26
+
27
+ function readReducedFailure(report, reportFile) {
28
+ if (!report.reducedCounterexample) return null;
29
+ const row = report.results.find(result => result.id === report.reducedCounterexample.id);
30
+ const run = row.runs.defective;
31
+ const root = realpathSync(dirname(reportFile));
32
+ if (realpathSync(report.artifactRoot) !== root || run.stderrFile !== `${row.id}-defective/stderr.raw`) throw new Error('invalid boundary artifact path');
33
+ const path = realpathSync(join(root, run.stderrFile)), inside = relative(root, path);
34
+ if (!inside || inside.startsWith('..') || isAbsolute(inside)) throw new Error('boundary artifact escaped output directory');
35
+ const stderr = readFileSync(path);
36
+ if (sha256(stderr) !== run.stderrSha256 || !stderr.includes('ENAMETOOLONG')) throw new Error('boundary stderr does not support failure class');
37
+ return { caseId: row.id, exitClass: run.exitClass, failureCode: 'ENAMETOOLONG',
38
+ stderrFile: run.stderrFile, stderrSha256: run.stderrSha256 };
39
+ }
40
+
41
+ function validRun(run) {
42
+ if (!record(run) || run.status !== 'observed' || !digest(run.stdoutSha256) || !digest(run.stderrSha256)
43
+ || typeof run.stdoutFile !== 'string' || typeof run.stderrFile !== 'string') return false;
44
+ return run.exitClass === 'success' && run.exitCode === 0 || run.exitClass === 'component-limit' && run.exitCode === 1;
45
+ }
46
+
47
+ function defectCandidate(row) {
48
+ return row.runs.original.exitClass === 'success' && row.runs.defective.exitClass === 'component-limit'
49
+ && (!row.runs.repaired || row.runs.repaired.exitClass === 'success');
50
+ }
51
+
52
+ function validateShape(report, git) {
53
+ if (!record(report) || report.schema !== 1 || report.status !== 'available' || typeof report.source !== 'string'
54
+ || report.source.startsWith('/') || report.source.split('/').some(part => !part || part === '.' || part === '..')) return 'boundary report identity is invalid';
55
+ if (git?.status !== 'available' || !Array.isArray(git.changedPaths) || !git.changedPaths.includes(report.source)
56
+ || report.provenance?.baseSha !== git.provenance?.baseSha || report.provenance?.headSha !== git.provenance?.headSha) return 'boundary report Git identity mismatch';
57
+ if (!Array.isArray(report.results) || report.results.length === 0 || report.results.length > 100
58
+ || report.contract?.count !== report.results.length || !Number.isSafeInteger(report.contract?.maxComponentBytes)
59
+ || report.contract.maxComponentBytes < 1 || typeof report.contract.validInput !== 'string'
60
+ || !Number.isSafeInteger(report.seed) || !Array.isArray(report.candidates)) return 'boundary report coverage is empty, malformed, or over budget';
61
+ if (!fullSha(report.provenance.sources?.original?.commit) || report.provenance.sources.original.commit !== git.provenance.baseSha
62
+ || !fullSha(report.provenance.sources?.defective?.commit) || report.provenance.sources.defective.commit !== git.provenance.headSha
63
+ || !digest(report.provenance.sources.original.sha256) || !digest(report.provenance.sources.defective.sha256)
64
+ || !digest(report.provenance.adapterSha256) || !digest(report.provenance.generatorSha256)
65
+ || !record(report.provenance.moduleSha256) || Object.keys(report.provenance.moduleSha256).sort().join(',') !== MODULES.slice().sort().join(',')
66
+ || Object.values(report.provenance.moduleSha256).some(value => !digest(value))
67
+ || typeof report.provenance.runtime !== 'string' || typeof report.provenance.trustedRoot !== 'string'
68
+ || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(report.provenance.repoSlug ?? '')) return 'boundary report source provenance is invalid';
69
+ const roles = report.provenance.sources.repaired ? ['original', 'defective', 'repaired'] : ['original', 'defective'];
70
+ if (roles.includes('repaired') && (!fullSha(report.provenance.sources.repaired.commit) || !digest(report.provenance.sources.repaired.sha256))) return 'boundary repaired source provenance is invalid';
71
+ const ids = report.results.map(row => row?.id);
72
+ if (new Set(ids).size !== ids.length) return 'boundary input identifiers are duplicated';
73
+ for (const row of report.results) {
74
+ if (!record(row) || typeof row.id !== 'string' || !/^[a-z0-9-]+$/.test(row.id)
75
+ || typeof row.input !== 'string' || !/^[a-z0-9-]+$/.test(row.input)
76
+ || row.status !== 'available' || row.inputBytes !== Buffer.byteLength(row.input) || row.inputSha256 !== sha256(row.input)) return 'boundary input coverage is invalid';
77
+ if (!record(row.runs) || roles.some(role => !validRun(row.runs[role]))) return 'boundary invocation outcome is incomplete';
78
+ }
79
+ const expected = report.results.filter(defectCandidate).map(row => row.id).sort(), candidates = report.candidates;
80
+ if (expected.length !== candidates.length || new Set(candidates.map(candidate => candidate?.id)).size !== candidates.length) return 'boundary candidate summary does not match observed outcomes';
81
+ if (candidates.some(candidate => {
82
+ const row = report.results.find(result => result.id === candidate?.id);
83
+ return !row || !expected.includes(candidate.id) || candidate.input !== row.input || candidate.inputSha256 !== row.inputSha256
84
+ || candidate.evidenceClass !== 'composed trusted CLI probe';
85
+ })) return 'boundary candidate identity does not match observed outcomes';
86
+ if (candidates.some(candidate => {
87
+ const row = report.results.find(result => result.id === candidate.id);
88
+ return roles.some(role => candidate.outcomes?.[role] !== row.runs[role].exitCode);
89
+ })) return 'boundary candidate outcomes do not match invocation outcomes';
90
+ const reduced = report.reducedCounterexample;
91
+ if (!candidates.length) return reduced == null ? null : 'boundary reduced input has no candidate';
92
+ const row = report.results.find(result => result.id === reduced?.id);
93
+ if (!record(reduced) || !row || !candidates.some(candidate => candidate.id === row.id)
94
+ || reduced.input !== row.input || reduced.inputSha256 !== row.inputSha256
95
+ || roles.some(role => reduced.outcomes?.[role] !== row.runs[role].exitCode)) return 'boundary reduced input does not match observed candidate';
96
+ return null;
97
+ }
@@ -3,36 +3,53 @@ import { readFileSync } from 'node:fs';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { collectGitEvidence } from './git-evidence.mjs';
5
5
  import { validateLintReceipt } from './validate-lint-receipt.mjs';
6
+ import { runBoundaryProbe } from './boundary-probe-runner.mjs';
7
+ import { validateBoundaryReport } from './boundary-validation.mjs';
6
8
 
7
9
  const record = value => value && typeof value === 'object' && !Array.isArray(value);
8
10
  const unavailableLint = reason => ({ captureStatus: 'unavailable', reason });
9
11
  const unavailableBundle = reason => ({ schema: 1,
10
12
  git: { schema: 1, status: 'unavailable', reason }, lint: unavailableLint(reason) });
11
13
 
12
- export function collectEvidence(worktreeMetadata) {
13
- if (!record(worktreeMetadata)) return unavailableBundle('worktree metadata is missing or malformed');
14
+ function collectBoundary(options, git) {
15
+ if (!options?.trustedOptIn) return undefined;
16
+ if (typeof options.configPath !== 'string' || typeof options.outputDir !== 'string') return { captureStatus: 'unavailable', reason: 'trusted opt-in needs a config and output directory' };
17
+ try {
18
+ const config = JSON.parse(readFileSync(options.configPath, 'utf8'));
19
+ const probe = runBoundaryProbe({ config, worktreePath: options.worktreePath, mergeBase: git.provenance.baseSha,
20
+ headSha: git.provenance.headSha, outputDir: options.outputDir, optIn: true });
21
+ return validateBoundaryReport(probe, git);
22
+ } catch { return { captureStatus: 'unavailable', reason: 'trusted boundary artifact is missing or malformed' }; }
23
+ }
24
+
25
+ export function collectEvidence(worktreeMetadata, options = {}) {
26
+ if (!record(worktreeMetadata)) return { ...unavailableBundle('worktree metadata is missing or malformed'),
27
+ ...(options.trustedOptIn ? { boundary: { captureStatus: 'unavailable', reason: 'worktree metadata unavailable' } } : {}) };
14
28
  const git = collectGitEvidence({ worktreePath: worktreeMetadata.worktreePath,
15
29
  mergeBase: worktreeMetadata.mergeBase, headSha: worktreeMetadata.headSha });
16
- if (git.status !== 'available') return { schema: 1, git, lint: unavailableLint(`Git evidence unavailable: ${git.reason}`) };
17
- if (typeof worktreeMetadata.eslintJson !== 'string' || !worktreeMetadata.eslintJson) return { schema: 1, git, lint: unavailableLint('lint report path unavailable') };
18
- if (typeof worktreeMetadata.eslintProvenance !== 'string' || !worktreeMetadata.eslintProvenance) return { schema: 1, git, lint: unavailableLint('lint provenance path unavailable') };
30
+ if (git.status !== 'available') return { schema: 1, git, lint: unavailableLint(`Git evidence unavailable: ${git.reason}`), ...(options.trustedOptIn ? { boundary: { captureStatus: 'unavailable', reason: 'Git evidence unavailable' } } : {}) };
31
+ const boundary = collectBoundary({ ...options, worktreePath: worktreeMetadata.worktreePath }, git);
32
+ if (typeof worktreeMetadata.eslintJson !== 'string' || !worktreeMetadata.eslintJson) return { schema: 1, git, lint: unavailableLint('lint report path unavailable'), ...(boundary ? { boundary } : {}) };
33
+ if (typeof worktreeMetadata.eslintProvenance !== 'string' || !worktreeMetadata.eslintProvenance) return { schema: 1, git, lint: unavailableLint('lint provenance path unavailable'), ...(boundary ? { boundary } : {}) };
19
34
  let reportBytes, receipt;
20
- try { reportBytes = readFileSync(worktreeMetadata.eslintJson); } catch { return { schema: 1, git, lint: unavailableLint('lint report could not be read') }; }
21
- try { receipt = JSON.parse(readFileSync(worktreeMetadata.eslintProvenance, 'utf8')); } catch { return { schema: 1, git, lint: unavailableLint('lint provenance is missing or malformed') }; }
35
+ try { reportBytes = readFileSync(worktreeMetadata.eslintJson); } catch { return { schema: 1, git, lint: unavailableLint('lint report could not be read'), ...(boundary ? { boundary } : {}) }; }
36
+ try { receipt = JSON.parse(readFileSync(worktreeMetadata.eslintProvenance, 'utf8')); } catch { return { schema: 1, git, lint: unavailableLint('lint provenance is missing or malformed'), ...(boundary ? { boundary } : {}) }; }
22
37
  const provenance = validateLintReceipt(receipt, { baseSha: git.provenance.baseSha,
23
38
  headSha: git.provenance.headSha, trackedClean: git.provenance.trackedCleanBefore && git.provenance.trackedCleanAfter }, reportBytes);
24
- if (provenance.status !== 'available') return { schema: 1, git, lint: unavailableLint(provenance.reason) };
39
+ if (provenance.status !== 'available') return { schema: 1, git, lint: unavailableLint(provenance.reason), ...(boundary ? { boundary } : {}) };
25
40
  let report;
26
- try { report = JSON.parse(reportBytes.toString('utf8')); } catch { return { schema: 1, git, lint: unavailableLint('lint report is malformed JSON') }; }
27
- if (!Array.isArray(report)) return { schema: 1, git, lint: unavailableLint('lint report is not a JSON array') };
41
+ try { report = JSON.parse(reportBytes.toString('utf8')); } catch { return { schema: 1, git, lint: unavailableLint('lint report is malformed JSON'), ...(boundary ? { boundary } : {}) }; }
42
+ if (!Array.isArray(report)) return { schema: 1, git, lint: unavailableLint('lint report is not a JSON array'), ...(boundary ? { boundary } : {}) };
28
43
  return { schema: 1, git, lint: { captureStatus: 'available', exitCode: provenance.exitCode,
29
- reportSha256: provenance.reportSha256, report } };
44
+ reportSha256: provenance.reportSha256, report }, ...(boundary ? { boundary } : {}) };
30
45
  }
31
46
 
32
47
  function main(argv) {
33
48
  const i = argv.indexOf('--worktree'), path = i < 0 ? null : argv[i + 1];
34
- if (!path || path.startsWith('--')) { console.error('usage: evidence-bundle.mjs --worktree <worktree.json>'); process.exitCode = 2; return; }
35
- try { console.log(JSON.stringify(collectEvidence(JSON.parse(readFileSync(path, 'utf8'))))); }
49
+ if (!path || path.startsWith('--')) { console.error('usage: evidence-bundle.mjs --worktree <worktree.json> [--trusted-boundary-opt-in --boundary-config <file> --boundary-out <dir>]'); process.exitCode = 2; return; }
50
+ const value = name => { const at = argv.indexOf(`--${name}`); return at < 0 ? null : argv[at + 1]; };
51
+ const boundaryOptions = { trustedOptIn: argv.includes('--trusted-boundary-opt-in'), configPath: value('boundary-config'), outputDir: value('boundary-out') };
52
+ try { console.log(JSON.stringify(collectEvidence(JSON.parse(readFileSync(path, 'utf8')), boundaryOptions))); }
36
53
  catch { console.log(JSON.stringify(unavailableBundle('worktree metadata could not be read'))); process.exitCode = 2; }
37
54
  }
38
55
 
@@ -0,0 +1,74 @@
1
+ import { createHash } from 'node:crypto'
2
+ import { readFileSync } from 'node:fs'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ const sha256 = value => createHash('sha256').update(value).digest('hex')
6
+ const record = value => value && typeof value === 'object' && !Array.isArray(value)
7
+ const unavailable = reason => ({ schema: 1, status: 'unavailable', reason })
8
+
9
+ function reportIntegrity(boundary) {
10
+ if (boundary?.captureStatus !== 'available') return false
11
+ const report = boundary.report
12
+ if (!record(report)) return false
13
+ const bytes = Buffer.from(JSON.stringify(report, null, 2) + '\n')
14
+ return sha256(bytes) === boundary.reportSha256
15
+ }
16
+
17
+ function filePatches(diff, paths) {
18
+ const chunks = diff.split(/(?=^diff --git )/m).filter(Boolean)
19
+ return paths.flatMap(path => {
20
+ const chunk = chunks.find(value => value.startsWith(`diff --git a/${path} b/${path}\n`))
21
+ if (!chunk) return []
22
+ return [{ path, patch: chunk.trimEnd(), ranges: [...chunk.matchAll(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/gm)].map(m => ({ start: Number(m[1]), count: Number(m[2] ?? 1) })) }]
23
+ })
24
+ }
25
+
26
+ export function projectEvidencePacket(bundleBytes, expectedSha256, { dimension, paths, maxBytes = 32768 } = {}) {
27
+ try {
28
+ if (!Buffer.isBuffer(bundleBytes) || sha256(bundleBytes) !== expectedSha256) return unavailable('full bundle hash mismatch')
29
+ const bundle = JSON.parse(bundleBytes.toString('utf8'))
30
+ if (!record(bundle) || bundle.schema !== 1 || bundle.git?.status !== 'available' || !record(bundle.git.diff)
31
+ || typeof bundle.git.diff.text !== 'string' || sha256(Buffer.from(bundle.git.diff.text)) !== bundle.git.diff.sha256) return unavailable('full evidence bundle is invalid')
32
+ if (typeof dimension !== 'string' || !dimension || !Array.isArray(paths) || !paths.length
33
+ || paths.some(path => typeof path !== 'string' || !bundle.git.changedPaths.includes(path))
34
+ || !Number.isSafeInteger(maxBytes) || maxBytes < 256 || maxBytes > 262144) return unavailable('packet scope or size budget is invalid')
35
+ const sourceRanges = filePatches(bundle.git.diff.text, paths)
36
+ if (sourceRanges.length !== paths.length) return unavailable('selected source patch is missing from the full diff')
37
+ const diagnostics = bundle.lint?.captureStatus === 'available' && Array.isArray(bundle.lint.report)
38
+ ? bundle.lint.report.filter(row => paths.includes(row.filePath ?? row.file ?? row.filename)) : []
39
+ const boundary = bundle.boundary
40
+ if (boundary?.captureStatus === 'available' && !reportIntegrity(boundary)) return unavailable('boundary report hash mismatch')
41
+ const report = boundary?.report
42
+ if (boundary?.captureStatus === 'available' && (report.provenance?.baseSha !== bundle.git.provenance?.baseSha
43
+ || report.provenance?.headSha !== bundle.git.provenance?.headSha || !bundle.git.changedPaths.includes(report.source))) return unavailable('boundary provenance does not match the full bundle')
44
+ const candidate = report?.reducedCounterexample && report.candidates?.find(row => row.id === report.reducedCounterexample.id)
45
+ const packet = { schema: 1, status: 'available', mode: 'shadow-projection', dimension, scope: { paths: [...paths].sort(), omittedPaths: bundle.git.changedPaths.filter(path => !paths.includes(path)), omittedContextReviewed: false, wholeDiffPassRequired: true },
46
+ provenance: { baseSha: bundle.git.provenance?.baseSha, headSha: bundle.git.provenance?.headSha,
47
+ diffSha256: bundle.git.diff.sha256, fullBundleSha256: expectedSha256,
48
+ boundaryReportSha256: boundary?.captureStatus === 'available' ? boundary.reportSha256 : null },
49
+ sourceRanges, lint: bundle.lint?.captureStatus === 'available' ? { status: 'available', diagnostics } : { status: 'unavailable', reason: bundle.lint?.reason ?? 'lint evidence absent' },
50
+ boundary: boundary?.captureStatus === 'available' ? { status: candidate ? 'candidate' : 'no-candidate', source: report.source,
51
+ contract: report.contract, provenance: report.provenance,
52
+ witness: candidate ? { input: candidate.input, inputSha256: candidate.inputSha256, outcomes: candidate.outcomes,
53
+ reducedScope: report.reducedCounterexample.scope, failure: boundary.summary?.reducedFailure } : null }
54
+ : { status: 'unavailable', reason: boundary?.reason ?? 'boundary evidence absent' },
55
+ coverageGaps: { omittedChangedPaths: bundle.git.changedPaths.filter(path => !paths.includes(path)), notApplicableDiagnosticsOmitted: (bundle.lint?.report?.length ?? 0) - diagnostics.length,
56
+ omittedContextReviewed: false, broadDiffReviewRequired: true } }
57
+ packet.packetBytes = 0
58
+ packet.fullBundleBytes = bundleBytes.length
59
+ let packetBytes = Buffer.byteLength(JSON.stringify(packet))
60
+ while (packet.packetBytes !== packetBytes) { packet.packetBytes = packetBytes; packetBytes = Buffer.byteLength(JSON.stringify(packet)) }
61
+ if (packetBytes > maxBytes) return unavailable('projected packet exceeds configured byte budget')
62
+ return packet
63
+ } catch { return unavailable('bundle or packet input is malformed') }
64
+ }
65
+
66
+ function main(argv) {
67
+ const value = key => { const at = argv.indexOf(`--${key}`); return at < 0 ? null : argv[at + 1] }
68
+ const file = value('bundle'), hash = value('sha256'), dimension = value('dimension'), paths = argv.flatMap((arg, i) => arg === '--path' ? [argv[i + 1]] : [])
69
+ if (!file || !hash || !dimension || !paths.length) { console.error('usage: evidence-packet.mjs --bundle <full-bundle.json> --sha256 <trusted-bundle-sha256> --dimension <name> --path <changed-path> [--path <changed-path>] [--max-bytes <n>]'); process.exitCode = 2; return }
70
+ try { console.log(JSON.stringify(projectEvidencePacket(readFileSync(file), hash, { dimension, paths, maxBytes: Number(value('max-bytes') ?? 32768) }))) }
71
+ catch { console.log(JSON.stringify(unavailable('explicit bundle could not be read'))); process.exitCode = 2 }
72
+ }
73
+
74
+ if (process.argv[1] === fileURLToPath(import.meta.url)) main(process.argv.slice(2))