@rpamis/comet 0.4.0-beta.10 → 0.4.0-beta.12
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 +1 -1
- package/assets/manifest.json +1 -1
- package/assets/skills/comet/SKILL.md +8 -4
- package/assets/skills/comet/reference/classic-layout.md +3 -3
- package/assets/skills/comet/rules/comet-workflow-guard.en.md +4 -3
- package/assets/skills/comet/rules/comet-workflow-guard.md +4 -3
- package/assets/skills/comet/scripts/comet-entry-runtime.mjs +145 -145
- package/assets/skills/comet/scripts/comet-hook-router.mjs +353 -1035
- package/assets/skills/comet/scripts/comet-runtime.mjs +164 -186
- package/assets/skills/comet-native/SKILL.md +20 -23
- package/assets/skills/comet-native/reference/artifacts.md +0 -7
- package/assets/skills/comet-native/reference/clarification.md +1 -1
- package/assets/skills/comet-native/reference/commands.md +63 -65
- package/assets/skills/comet-native/reference/recovery.md +9 -1
- package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +2574 -5719
- package/assets/skills-zh/comet/SKILL.md +8 -4
- package/assets/skills-zh/comet/reference/classic-layout.md +3 -3
- package/assets/skills-zh/comet-native/SKILL.md +20 -23
- package/assets/skills-zh/comet-native/reference/artifacts.md +0 -7
- package/assets/skills-zh/comet-native/reference/clarification.md +1 -1
- package/assets/skills-zh/comet-native/reference/commands.md +63 -65
- package/assets/skills-zh/comet-native/reference/recovery.md +9 -1
- package/dist/app/commands/classic.js +2 -2
- package/dist/app/commands/classic.js.map +1 -1
- package/dist/app/commands/dashboard.d.ts.map +1 -1
- package/dist/app/commands/dashboard.js +2 -1
- package/dist/app/commands/dashboard.js.map +1 -1
- package/dist/app/commands/doctor.d.ts.map +1 -1
- package/dist/app/commands/doctor.js +9 -3
- package/dist/app/commands/doctor.js.map +1 -1
- package/dist/app/commands/update.d.ts.map +1 -1
- package/dist/app/commands/update.js +14 -2
- package/dist/app/commands/update.js.map +1 -1
- package/dist/config/repository-layout.json +1 -4
- package/dist/domains/comet-classic/classic-layout-initialization.js +3 -3
- package/dist/domains/comet-classic/classic-layout-initialization.js.map +1 -1
- package/dist/domains/comet-classic/classic-root-command.d.ts +4 -1
- package/dist/domains/comet-classic/classic-root-command.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-root-command.js +159 -49
- package/dist/domains/comet-classic/classic-root-command.js.map +1 -1
- package/dist/domains/comet-classic/classic-root-move.d.ts +0 -1
- package/dist/domains/comet-classic/classic-root-move.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-root-move.js +24 -121
- package/dist/domains/comet-classic/classic-root-move.js.map +1 -1
- package/dist/domains/comet-entry/current-selection-repair.js +1 -1
- package/dist/domains/comet-entry/current-selection-repair.js.map +1 -1
- package/dist/domains/comet-entry/hook-router.d.ts +12 -2
- package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
- package/dist/domains/comet-entry/hook-router.js +40 -14
- package/dist/domains/comet-entry/hook-router.js.map +1 -1
- package/dist/domains/comet-entry/init-workflow.d.ts.map +1 -1
- package/dist/domains/comet-entry/init-workflow.js +17 -3
- package/dist/domains/comet-entry/init-workflow.js.map +1 -1
- package/dist/domains/comet-native/native-acceptance.d.ts +1 -2
- package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
- package/dist/domains/comet-native/native-acceptance.js +5 -29
- package/dist/domains/comet-native/native-acceptance.js.map +1 -1
- package/dist/domains/comet-native/native-change.d.ts +0 -2
- package/dist/domains/comet-native/native-change.d.ts.map +1 -1
- package/dist/domains/comet-native/native-change.js +8 -104
- package/dist/domains/comet-native/native-change.js.map +1 -1
- package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli.js +6 -493
- package/dist/domains/comet-native/native-cli.js.map +1 -1
- package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
- package/dist/domains/comet-native/native-continuation.js +18 -5
- package/dist/domains/comet-native/native-continuation.js.map +1 -1
- package/dist/domains/comet-native/native-evidence-retention.d.ts.map +1 -1
- package/dist/domains/comet-native/native-evidence-retention.js +5 -21
- package/dist/domains/comet-native/native-evidence-retention.js.map +1 -1
- package/dist/domains/comet-native/native-evidence-storage.d.ts +2 -8
- package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
- package/dist/domains/comet-native/native-evidence-storage.js +2 -23
- package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
- package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
- package/dist/domains/comet-native/native-findings.js +6 -4
- package/dist/domains/comet-native/native-findings.js.map +1 -1
- package/dist/domains/comet-native/native-repair-integration.d.ts +1 -3
- package/dist/domains/comet-native/native-repair-integration.d.ts.map +1 -1
- package/dist/domains/comet-native/native-repair-integration.js +12 -15
- package/dist/domains/comet-native/native-repair-integration.js.map +1 -1
- package/dist/domains/comet-native/native-repair-runtime.d.ts +0 -1
- package/dist/domains/comet-native/native-repair-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-repair-runtime.js +3 -10
- package/dist/domains/comet-native/native-repair-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-repair-stagnation.d.ts +1 -9
- package/dist/domains/comet-native/native-repair-stagnation.d.ts.map +1 -1
- package/dist/domains/comet-native/native-repair-stagnation.js +4 -14
- package/dist/domains/comet-native/native-repair-stagnation.js.map +1 -1
- package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
- package/dist/domains/comet-native/native-snapshot.js +0 -77
- package/dist/domains/comet-native/native-snapshot.js.map +1 -1
- package/dist/domains/comet-native/native-transition-evidence.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transition-evidence.js +0 -10
- package/dist/domains/comet-native/native-transition-evidence.js.map +1 -1
- package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
- package/dist/domains/comet-native/native-transitions.js +3 -31
- package/dist/domains/comet-native/native-transitions.js.map +1 -1
- package/dist/domains/comet-native/native-types.d.ts +1 -16
- package/dist/domains/comet-native/native-types.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-evidence.d.ts +2 -48
- package/dist/domains/comet-native/native-verification-evidence.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-evidence.js +13 -301
- package/dist/domains/comet-native/native-verification-evidence.js.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +2 -138
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.js +103 -769
- package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt.d.ts +3 -89
- package/dist/domains/comet-native/native-verification-receipt.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt.js +19 -350
- package/dist/domains/comet-native/native-verification-receipt.js.map +1 -1
- package/dist/domains/comet-native/native-verification-runtime.d.ts +1 -4
- package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-runtime.js +14 -209
- package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
- package/dist/domains/dashboard/web/assets/{arc-BXWNV2Qv.js → arc-BXDAG6Qx.js} +1 -1
- package/dist/domains/dashboard/web/assets/{architectureDiagram-3BPJPVTR-CjVHPivo.js → architectureDiagram-3BPJPVTR-R2JyCv0i.js} +1 -1
- package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-P2PGImSM.js → blockDiagram-GPEHLZMM-STNPWdDl.js} +1 -1
- package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-fTj6Xhs1.js → c4Diagram-AAUBKEIU-Bh-rUIcJ.js} +1 -1
- package/dist/domains/dashboard/web/assets/channel-XR_5gd6D.js +1 -0
- package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-BjFDZ5yo.js → chunk-2J33WTMH-BRhFNAFH.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-BAUkbZdT.js → chunk-4BX2VUAB-CwA3zkFS.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-DBmuiYme.js → chunk-55IACEB6-C1tqAl_E.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-Do9ufCgY.js → chunk-727SXJPM-DDefBoUS.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-qRQWlB5d.js → chunk-AQP2D5EJ-Dq-0Yi9D.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-BzDzeJ4_.js → chunk-FMBD7UC4-DC-MVNgk.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-OQcAmIvL.js → chunk-ND2GUHAM-BLWZ8zWd.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-BiRfH4d2.js → chunk-QZHKN3VN-DaK5rvZu.js} +1 -1
- package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CG_TnucZ.js +1 -0
- package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CG_TnucZ.js +1 -0
- package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-CZk37fGn.js → cose-bilkent-S5V4N54A-DCPgAyMU.js} +1 -1
- package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-B3F-qRTJ.js → cynefin-VYW2F7L2-CBaY4KFj.js} +1 -1
- package/dist/domains/dashboard/web/assets/{dagre-BM42HDAG-D5BQ0eqN.js → dagre-BM42HDAG-CLKQ6BQM.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-2AECGRRQ-33mXstha.js → diagram-2AECGRRQ-DCup336F.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-5GNKFQAL-BWHCMFvD.js → diagram-5GNKFQAL-DgpDOFTE.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-DrPGimEt.js → diagram-KO2AKTUF-BZcengGf.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-LMA3HP47-BBlsg7jG.js → diagram-LMA3HP47-DSECilBo.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-OG6HWLK6-CsaFSpHi.js → diagram-OG6HWLK6-3FuzANXW.js} +1 -1
- package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-CoB0mzhk.js → erDiagram-TEJ5UH35-BBrwULhs.js} +1 -1
- package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-lT53XfSE.js → flowDiagram-I6XJVG4X-DiNn0Yzp.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ganttDiagram-6RSMTGT7-D1SQ56fl.js → ganttDiagram-6RSMTGT7-DcvbTHnu.js} +1 -1
- package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-D4oDMS5x.js → gitGraphDiagram-PVQCEYII-CgCY3MJo.js} +1 -1
- package/dist/domains/dashboard/web/assets/index-BR3wUr2k.css +1 -0
- package/dist/domains/dashboard/web/assets/{index-Msce_H_q.js → index-CovQUq5W.js} +4 -4
- package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-BeICn98s.js → infoDiagram-5YYISTIA-hzBGAEue.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-Dkspu33d.js → ishikawaDiagram-YF4QCWOH-DCPPspol.js} +1 -1
- package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C-EM1sZl.js → journeyDiagram-JHISSGLW-C_v8b1Os.js} +1 -1
- package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-BTbB0IO2.js → kanban-definition-UN3LZRKU-CgpE9lG7.js} +1 -1
- package/dist/domains/dashboard/web/assets/{linear-Cp0UrqDr.js → linear-jSddcREx.js} +1 -1
- package/dist/domains/dashboard/web/assets/{mermaid.core-CucmqsLW.js → mermaid.core-5Ibr28Ig.js} +4 -4
- package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-CjEshF1X.js → mindmap-definition-RKZ34NQL-XPCohX0x.js} +1 -1
- package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-DrwFnX1b.js → pieDiagram-4H26LBE5-DvhxgQWl.js} +1 -1
- package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-CjG6pBR2.js → quadrantDiagram-W4KKPZXB-CCUxdF-S.js} +1 -1
- package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-BpUQVqCV.js → requirementDiagram-4Y6WPE33-FS3TCmdX.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-BeGkEvzR.js → sankeyDiagram-5OEKKPKP-r129rscN.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK-sSTU3MCO.js → sequenceDiagram-3UESZ5HK--DCY0bvU.js} +1 -1
- package/dist/domains/dashboard/web/assets/{stateDiagram-AJRCARHV-CcFBc6qh.js → stateDiagram-AJRCARHV-yHkUByrT.js} +1 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-XHzDdqcm.js +1 -0
- package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-DCN7NjEs.js → timeline-definition-PNZ67QCA-NlqCuFuo.js} +1 -1
- package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-DZAN1_rr.js → vennDiagram-CIIHVFJN-B4W_d1Nq.js} +1 -1
- package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-FfkJfr4C.js → wardleyDiagram-YWT4CUSO-Bex-_jWd.js} +1 -1
- package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-CD8B-EmR.js → xychartDiagram-2RQKCTM6-CmxeVM2Z.js} +1 -1
- package/dist/domains/dashboard/web/index.html +2 -2
- package/dist/domains/skill/platform-install.d.ts.map +1 -1
- package/dist/domains/skill/platform-install.js +22 -2
- package/dist/domains/skill/platform-install.js.map +1 -1
- package/dist/domains/workflow-contract/project-config.d.ts.map +1 -1
- package/dist/domains/workflow-contract/project-config.js +4 -4
- package/dist/domains/workflow-contract/project-config.js.map +1 -1
- package/eval/local/tasks/comet-native-workflow/instruction.md +4 -17
- package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +22 -232
- package/eval/local/tests/conftest.py +0 -218
- package/eval/local/tests/scaffold/test_native_wave_evaluations.py +0 -163
- package/eval/local/tests/scaffold/test_tasks.py +1 -8
- package/eval/local/tests/scaffold/test_utils.py +4 -7
- package/eval/scaffold/shell/docker.sh +2 -95
- package/package.json +1 -1
- package/dist/domains/comet-native/native-controller-trust.d.ts +0 -22
- package/dist/domains/comet-native/native-controller-trust.d.ts.map +0 -1
- package/dist/domains/comet-native/native-controller-trust.js +0 -153
- package/dist/domains/comet-native/native-controller-trust.js.map +0 -1
- package/dist/domains/comet-native/native-creation-authorization.d.ts +0 -30
- package/dist/domains/comet-native/native-creation-authorization.d.ts.map +0 -1
- package/dist/domains/comet-native/native-creation-authorization.js +0 -110
- package/dist/domains/comet-native/native-creation-authorization.js.map +0 -1
- package/dist/domains/comet-native/native-independent-review.d.ts +0 -28
- package/dist/domains/comet-native/native-independent-review.d.ts.map +0 -1
- package/dist/domains/comet-native/native-independent-review.js +0 -134
- package/dist/domains/comet-native/native-independent-review.js.map +0 -1
- package/dist/domains/comet-native/native-review-contract.d.ts +0 -6
- package/dist/domains/comet-native/native-review-contract.d.ts.map +0 -1
- package/dist/domains/comet-native/native-review-contract.js +0 -6
- package/dist/domains/comet-native/native-review-contract.js.map +0 -1
- package/dist/domains/comet-native/native-review-identity.d.ts +0 -50
- package/dist/domains/comet-native/native-review-identity.d.ts.map +0 -1
- package/dist/domains/comet-native/native-review-identity.js +0 -209
- package/dist/domains/comet-native/native-review-identity.js.map +0 -1
- package/dist/domains/comet-native/native-review-signer.d.ts +0 -24
- package/dist/domains/comet-native/native-review-signer.d.ts.map +0 -1
- package/dist/domains/comet-native/native-review-signer.js +0 -125
- package/dist/domains/comet-native/native-review-signer.js.map +0 -1
- package/dist/domains/comet-native/native-review-trust.d.ts +0 -35
- package/dist/domains/comet-native/native-review-trust.d.ts.map +0 -1
- package/dist/domains/comet-native/native-review-trust.js +0 -176
- package/dist/domains/comet-native/native-review-trust.js.map +0 -1
- package/dist/domains/dashboard/web/assets/channel--JtnhJr8.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BRGmx8Iz.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BRGmx8Iz.js +0 -1
- package/dist/domains/dashboard/web/assets/index-D-AGxvI4.css +0 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-D5zZYi4x.js +0 -1
- package/eval/local/tasks/comet-native-workflow/environment/.include-trusted-native-review-fixture +0 -1
- package/eval/scaffold/shell/native-review-signer-daemon.mjs +0 -144
- package/eval/scaffold/shell/native-review-verifier-daemon.mjs +0 -178
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { promises as fs } from 'node:fs';
|
|
2
1
|
import path from 'path';
|
|
3
2
|
import { RaceSafeReadError, readFileRaceSafe } from '../../platform/fs/race-safe-read.js';
|
|
4
3
|
import { archiveNativeChange, NativeArchivePreflightError, NativeSpecConflictError, } from './native-archive.js';
|
|
5
|
-
import { atomicWriteJson } from './native-atomic-file.js';
|
|
6
4
|
import { serializeNativeVerificationMachineBlock } from './native-acceptance.js';
|
|
7
5
|
import { inspectNativeArchivePreflight } from './native-archive-inspection.js';
|
|
8
6
|
import { createNativeChange, inspectNativeChange, NativeChangeRevisionConflictError, NativeBaselineIncompleteError, NativeRuntimeCompatibilityError, nativeChangeDir, readNativeChange, } from './native-change.js';
|
|
@@ -12,20 +10,14 @@ import { doctorNativeProject } from './native-doctor.js';
|
|
|
12
10
|
import { checkNativeChange } from './native-check.js';
|
|
13
11
|
import { checkpointNativeChange } from './native-progress-checkpoint.js';
|
|
14
12
|
import { nativeContinuation } from './native-continuation.js';
|
|
15
|
-
import { discoverNativeProject, ensureNativeDirectories, nativeProjectPaths, normalizeArtifactRootRef,
|
|
16
|
-
import { withNativeMutationLock } from './native-mutation-lock.js';
|
|
13
|
+
import { discoverNativeProject, ensureNativeDirectories, nativeProjectPaths, normalizeArtifactRootRef, } from './native-paths.js';
|
|
17
14
|
import { moveNativeRoot } from './native-root-move.js';
|
|
18
15
|
import { selectNativeChange } from './native-selection.js';
|
|
19
16
|
import { markNativeSpecRemoval, readNativeProposedSpecs, rebaseNativeSpecChanges, } from './native-specs.js';
|
|
20
17
|
import { readNativeBoundedTextFile } from './native-bounded-file.js';
|
|
21
18
|
import { NATIVE_CONTRACT_FILE_LIMITS } from './native-contract-files.js';
|
|
22
19
|
import { MAX_NATIVE_IMPLEMENTATION_EVIDENCE_DOCUMENT_BYTES } from './native-verification-scope.js';
|
|
23
|
-
import {
|
|
24
|
-
import { nativeControllerProjectRootHash, readNativeControllerTrustProject, } from './native-controller-trust.js';
|
|
25
|
-
import { approveNativeIndependentReviewPreparation, finalizeNativeImplementationAttestation, finalizeNativeIndependentReviewReceipt, issueNativeAutomatedCheckReceipt, issueNativeManualEvidenceReceipt, issueNativeWaiverReceipt, MAX_NATIVE_AUTOMATED_COMMAND_TIMEOUT_MS, prepareNativeIndependentReview, prepareNativeImplementationAttestation, } from './native-verification-receipt-runtime.js';
|
|
26
|
-
import { generateNativeReviewKeyPair, nativeReviewIdentityFromPrivateKey, nativeReviewPrivateKeyFilePersistenceSupported, parseNativeReviewIdentity, parseNativeReviewSignature, } from './native-review-identity.js';
|
|
27
|
-
import { buildNativeReviewTrustPolicy, NATIVE_REVIEW_TRUST_POLICY_REF, readNativeReviewTrustPolicy, } from './native-review-trust.js';
|
|
28
|
-
import { parseNativeImplementationPreparation, parseNativeIndependentReviewApproval, signNativeImplementationPreparation, signNativeIndependentReviewApproval, } from './native-review-signer.js';
|
|
20
|
+
import { issueNativeAutomatedCheckReceipt, issueNativeManualEvidenceReceipt, MAX_NATIVE_AUTOMATED_COMMAND_TIMEOUT_MS, } from './native-verification-receipt-runtime.js';
|
|
29
21
|
import { advanceNativeChange } from './native-transitions.js';
|
|
30
22
|
import { inspectNativeHookGuard, readNativeHookRequest } from './native-hook-guard.js';
|
|
31
23
|
const NATIVE_SHOW_MAX_SERIALIZED_BYTES = 10 * 1024 * 1024;
|
|
@@ -38,31 +30,18 @@ Commands:
|
|
|
38
30
|
init [--root <artifact-root>] [--language en|zh-CN]
|
|
39
31
|
root show
|
|
40
32
|
root move <artifact-root>
|
|
41
|
-
new <change-name>
|
|
33
|
+
new <change-name> [--language en|zh-CN]
|
|
42
34
|
spec remove <change-name> <capability>
|
|
43
35
|
spec rebase <change-name> --summary <text>
|
|
44
|
-
list [--cursor <token>]
|
|
45
36
|
show <change-name>
|
|
46
37
|
status [<change-name>] [--cursor <token>] [--details [--acceptance-cursor <token>]]
|
|
47
38
|
select <change-name>
|
|
48
39
|
checkpoint <change-name> --summary <text> --next-action <text> [--artifact <project-relative>] [--expect-revision <n>]
|
|
49
40
|
check <change-name>
|
|
50
41
|
evidence format [--entries <path>]
|
|
51
|
-
|
|
52
|
-
trust identity --private-key-env <name> --identity <path>
|
|
53
|
-
trust policy --implementation-identity <path> --reviewer-identity <path> --waiver-identity <path> --controller-private-key-env <name>
|
|
54
|
-
trust authorize <change-name> --controller-private-key-env <name> --output <path>
|
|
55
|
-
receipt manual <change-name> --acceptance <id> --responsible <text> --step <text> --observation <text> --confirmed
|
|
42
|
+
receipt manual <change-name> --acceptance <id> --step <text> --observation <text>
|
|
56
43
|
receipt automated <change-name> --acceptance <id> [--timeout-ms <n>] -- <executable> [args...]
|
|
57
|
-
|
|
58
|
-
receipt implement sign --preparation <path> --identity <path> --private-key-env <name> --output <path>
|
|
59
|
-
receipt implement <change-name> finalize --preparation <path> --attestation <path> --confirmed
|
|
60
|
-
receipt review <change-name> prepare --implementation-receipt <ref> --report <path> --required-receipt <ref> --identity <path> [--unified-io-receipt <ref> --adversarial-paths-receipt <ref> --generated-assets-receipt <ref> --lifecycle-eval-receipt <ref>] --output <path>
|
|
61
|
-
receipt review <change-name> approve --preparation <path> --attest-manual <ref> [--findings <path>] --checked-acceptance-applicability --output <path>
|
|
62
|
-
receipt review sign --approval <path> --identity <path> --private-key-env <name> --output <path>
|
|
63
|
-
receipt review <change-name> finalize --preparation <path> --approval <path> --attestation <path> --confirmed
|
|
64
|
-
receipt waive <change-name> --acceptance <id> --blocked-receipt <ref> --reason <text> --risk <text> --alternative-receipt <ref> --identity <path> --private-key-env <name> --confirmed
|
|
65
|
-
next <change-name> --summary <text> [--confirmed] [--artifact <path>] [--no-code-reason <text>] [--allow-partial-scope <sha256> --partial-reason <text>] [--result pass|fail] [--report <path>] [--receipt <required-ref>] [--evidence-receipt <ref>] [--waiver <ref>] [--independent-review-receipt <ref>] [--failure-category <token>] [--failed-check <token>] [--override-repair <sha256> --override-summary <text>]
|
|
44
|
+
next <change-name> --summary <text> [--confirmed] [--artifact <path>] [--no-code-reason <text>] [--allow-partial-scope <sha256> --partial-reason <text>] [--result pass|fail] [--report <path>] [--override-repair <sha256> --override-summary <text>]
|
|
66
45
|
archive <change-name> --dry-run
|
|
67
46
|
archive <change-name> --expect-preflight <sha256> [--confirmed]
|
|
68
47
|
doctor [<change-name>] [--repair] [--strategy continue|rollback]
|
|
@@ -188,106 +167,6 @@ async function readBoundedEvidenceStdin(maxBytes) {
|
|
|
188
167
|
}
|
|
189
168
|
return Buffer.concat(chunks).toString('utf8');
|
|
190
169
|
}
|
|
191
|
-
async function readEvidenceJson(filePath, label) {
|
|
192
|
-
const raw = await readBoundedEvidenceFile(path.resolve(filePath), MAX_NATIVE_IMPLEMENTATION_EVIDENCE_DOCUMENT_BYTES);
|
|
193
|
-
try {
|
|
194
|
-
return JSON.parse(raw);
|
|
195
|
-
}
|
|
196
|
-
catch (error) {
|
|
197
|
-
throw new Error(`${label} must be valid JSON: ${error.message}`, {
|
|
198
|
-
cause: error,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function privateKeyFromEnvironment(name) {
|
|
203
|
-
if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(name)) {
|
|
204
|
-
throw new NativeUsageError('--private-key-env must be an environment variable name');
|
|
205
|
-
}
|
|
206
|
-
const value = process.env[name];
|
|
207
|
-
if (!value)
|
|
208
|
-
throw new NativeUsageError(`Private key environment variable ${name} is not set`);
|
|
209
|
-
delete process.env[name];
|
|
210
|
-
return value;
|
|
211
|
-
}
|
|
212
|
-
function pathIsInside(parent, target) {
|
|
213
|
-
const relative = path.relative(parent, target);
|
|
214
|
-
return (relative === '' ||
|
|
215
|
-
(!path.isAbsolute(relative) && relative !== '..' && !relative.startsWith(`..${path.sep}`)));
|
|
216
|
-
}
|
|
217
|
-
async function assertPrivateKeyOutsideProject(projectRoot, file) {
|
|
218
|
-
const relative = path.relative(projectRoot, file);
|
|
219
|
-
if (relative === '' ||
|
|
220
|
-
(relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative))) {
|
|
221
|
-
throw new NativeUsageError('--private-key must resolve outside the Native project');
|
|
222
|
-
}
|
|
223
|
-
const physicalProjectRoot = await fs.realpath(projectRoot);
|
|
224
|
-
const parsed = path.parse(path.resolve(path.dirname(file)));
|
|
225
|
-
let cursor = parsed.root;
|
|
226
|
-
for (const segment of path
|
|
227
|
-
.relative(parsed.root, path.resolve(path.dirname(file)))
|
|
228
|
-
.split(path.sep)
|
|
229
|
-
.filter(Boolean)) {
|
|
230
|
-
cursor = path.join(cursor, segment);
|
|
231
|
-
let stat;
|
|
232
|
-
try {
|
|
233
|
-
stat = await fs.lstat(cursor);
|
|
234
|
-
}
|
|
235
|
-
catch (error) {
|
|
236
|
-
if (error.code === 'ENOENT')
|
|
237
|
-
continue;
|
|
238
|
-
throw error;
|
|
239
|
-
}
|
|
240
|
-
if (!stat.isDirectory() || stat.isSymbolicLink()) {
|
|
241
|
-
throw new NativeUsageError('--private-key parent chain must not contain symlinks, junctions, or non-directories');
|
|
242
|
-
}
|
|
243
|
-
if (pathIsInside(physicalProjectRoot, await fs.realpath(cursor))) {
|
|
244
|
-
throw new NativeUsageError('--private-key parent resolves inside the Native project');
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
async function writeExclusiveFile(file, content, mode) {
|
|
249
|
-
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
250
|
-
const handle = await fs.open(file, 'wx', mode);
|
|
251
|
-
try {
|
|
252
|
-
await handle.writeFile(content, 'utf8');
|
|
253
|
-
}
|
|
254
|
-
finally {
|
|
255
|
-
await handle.close();
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
async function writeExclusivePrivateKeyFile(projectRoot, file, content) {
|
|
259
|
-
if (!nativeReviewPrivateKeyFilePersistenceSupported()) {
|
|
260
|
-
throw new NativeUsageError('trust keygen cannot persist private keys on Windows because owner-only ACLs cannot be verified; generate the identity in an external secret store and provide signing keys through --private-key-env');
|
|
261
|
-
}
|
|
262
|
-
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
263
|
-
await assertPrivateKeyOutsideProject(projectRoot, file);
|
|
264
|
-
const handle = await fs.open(file, 'wx', 0o600);
|
|
265
|
-
let secure = false;
|
|
266
|
-
try {
|
|
267
|
-
await handle.writeFile(content, 'utf8');
|
|
268
|
-
await handle.chmod(0o600);
|
|
269
|
-
const stat = await handle.stat();
|
|
270
|
-
if ((stat.mode & 0o077) !== 0) {
|
|
271
|
-
throw new Error('Native review private key file permissions are not owner-only');
|
|
272
|
-
}
|
|
273
|
-
const [physicalProjectRoot, physicalFile, target] = await Promise.all([
|
|
274
|
-
fs.realpath(projectRoot),
|
|
275
|
-
fs.realpath(file),
|
|
276
|
-
fs.lstat(file),
|
|
277
|
-
]);
|
|
278
|
-
if (!target.isFile() ||
|
|
279
|
-
target.isSymbolicLink() ||
|
|
280
|
-
pathIsInside(physicalProjectRoot, physicalFile)) {
|
|
281
|
-
throw new Error('Native review private key resolved inside the project during write');
|
|
282
|
-
}
|
|
283
|
-
secure = true;
|
|
284
|
-
}
|
|
285
|
-
finally {
|
|
286
|
-
await handle.close();
|
|
287
|
-
if (!secure)
|
|
288
|
-
await fs.rm(file, { force: true });
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
170
|
async function dispatch(rawArgs, explicitProjectRoot) {
|
|
292
171
|
if (rawArgs.length === 0 || rawArgs[0] === '--help' || rawArgs[0] === 'help') {
|
|
293
172
|
return { command: rawArgs[0] ?? null, exitCode: 0, data: { usage: USAGE }, text: USAGE };
|
|
@@ -374,10 +253,6 @@ async function dispatch(rawArgs, explicitProjectRoot) {
|
|
|
374
253
|
}
|
|
375
254
|
if (command === 'new') {
|
|
376
255
|
const name = requiredPositional(rawArgs, 'change name');
|
|
377
|
-
const creationAuthorizationPath = takeOption(rawArgs, '--creation-authorization');
|
|
378
|
-
if (!creationAuthorizationPath) {
|
|
379
|
-
throw new NativeUsageError('--creation-authorization is required');
|
|
380
|
-
}
|
|
381
256
|
let config = await readProjectConfig(projectRoot);
|
|
382
257
|
const language = languageOption(rawArgs, config?.native.language ?? 'en');
|
|
383
258
|
assertNoArguments(rawArgs);
|
|
@@ -396,8 +271,6 @@ async function dispatch(rawArgs, explicitProjectRoot) {
|
|
|
396
271
|
paths,
|
|
397
272
|
name,
|
|
398
273
|
language,
|
|
399
|
-
verificationProtocol: 'signed-v2',
|
|
400
|
-
creationAuthorization: parseNativeCreationAuthorization(await readEvidenceJson(creationAuthorizationPath, 'Native creation authorization')),
|
|
401
274
|
});
|
|
402
275
|
await selectNativeChange(paths, state.name);
|
|
403
276
|
const status = await inspectNativeStatus(paths, state.name, {
|
|
@@ -436,17 +309,6 @@ async function dispatch(rawArgs, explicitProjectRoot) {
|
|
|
436
309
|
}
|
|
437
310
|
throw new NativeUsageError(`Unknown spec command: ${subcommand}`);
|
|
438
311
|
}
|
|
439
|
-
if (command === 'list') {
|
|
440
|
-
const cursor = takeOption(rawArgs, '--cursor');
|
|
441
|
-
assertNoArguments(rawArgs);
|
|
442
|
-
const { config, paths } = await configuredPaths(projectRoot);
|
|
443
|
-
const page = await listNativeStatusPage(paths, {
|
|
444
|
-
...(cursor ? { cursor } : {}),
|
|
445
|
-
clarificationMode: config.native.clarification_mode,
|
|
446
|
-
maxVerifyFailures: config.native.max_verify_failures,
|
|
447
|
-
});
|
|
448
|
-
return success('list', page);
|
|
449
|
-
}
|
|
450
312
|
if (command === 'show') {
|
|
451
313
|
const name = requiredPositional(rawArgs, 'change name');
|
|
452
314
|
assertNoArguments(rawArgs);
|
|
@@ -616,214 +478,21 @@ async function dispatch(rawArgs, explicitProjectRoot) {
|
|
|
616
478
|
}
|
|
617
479
|
throw new NativeUsageError(`Unknown evidence command: ${subcommand}`);
|
|
618
480
|
}
|
|
619
|
-
if (command === 'trust') {
|
|
620
|
-
const subcommand = requiredPositional(rawArgs, 'trust subcommand');
|
|
621
|
-
if (subcommand === 'identity') {
|
|
622
|
-
const identityPathValue = takeOption(rawArgs, '--identity');
|
|
623
|
-
const privateKeyEnv = takeOption(rawArgs, '--private-key-env');
|
|
624
|
-
if (!identityPathValue || !privateKeyEnv) {
|
|
625
|
-
throw new NativeUsageError('trust identity requires --identity and --private-key-env');
|
|
626
|
-
}
|
|
627
|
-
assertNoArguments(rawArgs);
|
|
628
|
-
const identityPath = path.resolve(identityPathValue);
|
|
629
|
-
const identity = nativeReviewIdentityFromPrivateKey(privateKeyFromEnvironment(privateKeyEnv));
|
|
630
|
-
await writeExclusiveFile(identityPath, `${JSON.stringify(identity, null, 2)}\n`, 0o644);
|
|
631
|
-
return success('trust identity', { identityPath, keyId: identity.keyId, privateKeyPrinted: false }, `Native review identity ${identity.keyId} created from external private key material\n`);
|
|
632
|
-
}
|
|
633
|
-
if (subcommand === 'keygen') {
|
|
634
|
-
const identityPathValue = takeOption(rawArgs, '--identity');
|
|
635
|
-
const privateKeyPathValue = takeOption(rawArgs, '--private-key');
|
|
636
|
-
if (!identityPathValue || !privateKeyPathValue) {
|
|
637
|
-
throw new NativeUsageError('trust keygen requires --identity and --private-key');
|
|
638
|
-
}
|
|
639
|
-
assertNoArguments(rawArgs);
|
|
640
|
-
const identityPath = path.resolve(identityPathValue);
|
|
641
|
-
const privateKeyPath = path.resolve(privateKeyPathValue);
|
|
642
|
-
await assertPrivateKeyOutsideProject(projectRoot, privateKeyPath);
|
|
643
|
-
if (identityPath === privateKeyPath) {
|
|
644
|
-
throw new NativeUsageError('--identity and --private-key must be different files');
|
|
645
|
-
}
|
|
646
|
-
const keyPair = generateNativeReviewKeyPair();
|
|
647
|
-
await writeExclusivePrivateKeyFile(projectRoot, privateKeyPath, `${keyPair.privateKey}\n`);
|
|
648
|
-
await writeExclusiveFile(identityPath, `${JSON.stringify(keyPair.identity, null, 2)}\n`, 0o644);
|
|
649
|
-
return success('trust keygen', {
|
|
650
|
-
identityPath,
|
|
651
|
-
privateKeyPath,
|
|
652
|
-
keyId: keyPair.identity.keyId,
|
|
653
|
-
privateKeyPrinted: false,
|
|
654
|
-
}, `Native review identity ${keyPair.identity.keyId} created; private key written only to ${privateKeyPath}\n`);
|
|
655
|
-
}
|
|
656
|
-
if (subcommand === 'policy') {
|
|
657
|
-
const implementationIdentityPath = takeOption(rawArgs, '--implementation-identity');
|
|
658
|
-
const reviewerIdentityPaths = takeMany(rawArgs, '--reviewer-identity');
|
|
659
|
-
const waiverIdentityPaths = takeMany(rawArgs, '--waiver-identity');
|
|
660
|
-
const controllerPrivateKeyEnv = takeOption(rawArgs, '--controller-private-key-env');
|
|
661
|
-
if (!implementationIdentityPath ||
|
|
662
|
-
reviewerIdentityPaths.length === 0 ||
|
|
663
|
-
waiverIdentityPaths.length === 0 ||
|
|
664
|
-
!controllerPrivateKeyEnv) {
|
|
665
|
-
throw new NativeUsageError('trust policy requires --implementation-identity, --reviewer-identity, --waiver-identity, and --controller-private-key-env');
|
|
666
|
-
}
|
|
667
|
-
assertNoArguments(rawArgs);
|
|
668
|
-
const { paths } = await configuredPaths(projectRoot);
|
|
669
|
-
const implementationIdentity = parseNativeReviewIdentity(await readEvidenceJson(implementationIdentityPath, 'Implementation identity'));
|
|
670
|
-
const trustedReviewers = await Promise.all(reviewerIdentityPaths.map(async (file) => parseNativeReviewIdentity(await readEvidenceJson(file, 'Reviewer identity'))));
|
|
671
|
-
const trustedWaiverSigners = await Promise.all(waiverIdentityPaths.map(async (file) => parseNativeReviewIdentity(await readEvidenceJson(file, 'Waiver signer identity'))));
|
|
672
|
-
const controllerTrust = await readNativeControllerTrustProject(projectRoot);
|
|
673
|
-
if (!controllerTrust) {
|
|
674
|
-
throw new Error('Native project has no controller-owned trust root');
|
|
675
|
-
}
|
|
676
|
-
const policy = buildNativeReviewTrustPolicy({
|
|
677
|
-
controllerIdentity: controllerTrust.controllerIdentity,
|
|
678
|
-
controllerPrivateKey: privateKeyFromEnvironment(controllerPrivateKeyEnv),
|
|
679
|
-
implementationKeyId: implementationIdentity.keyId,
|
|
680
|
-
trustedReviewers,
|
|
681
|
-
trustedWaiverSigners,
|
|
682
|
-
});
|
|
683
|
-
const policyPath = path.join(projectRoot, ...NATIVE_REVIEW_TRUST_POLICY_REF.split('/'));
|
|
684
|
-
await withNativeMutationLock(paths, 'create review trust policy', async () => {
|
|
685
|
-
await resolveContainedNativePath(projectRoot, policyPath);
|
|
686
|
-
const activeEntries = await fs.readdir(paths.changesDir).catch((error) => {
|
|
687
|
-
if (error.code === 'ENOENT')
|
|
688
|
-
return [];
|
|
689
|
-
throw error;
|
|
690
|
-
});
|
|
691
|
-
if (activeEntries.length > 0) {
|
|
692
|
-
throw new Error('Native review trust policy must be created before any active change');
|
|
693
|
-
}
|
|
694
|
-
await atomicWriteJson(policyPath, policy, {
|
|
695
|
-
containedRoot: projectRoot,
|
|
696
|
-
exclusive: true,
|
|
697
|
-
});
|
|
698
|
-
});
|
|
699
|
-
return success('trust policy', { ref: NATIVE_REVIEW_TRUST_POLICY_REF, policy }, `Native review trust policy created: ${NATIVE_REVIEW_TRUST_POLICY_REF}\n`);
|
|
700
|
-
}
|
|
701
|
-
if (subcommand === 'authorize') {
|
|
702
|
-
const name = requiredPositional(rawArgs, 'change name');
|
|
703
|
-
const controllerPrivateKeyEnv = takeOption(rawArgs, '--controller-private-key-env');
|
|
704
|
-
const outputPathValue = takeOption(rawArgs, '--output');
|
|
705
|
-
if (!controllerPrivateKeyEnv || !outputPathValue) {
|
|
706
|
-
throw new NativeUsageError('trust authorize requires --controller-private-key-env and --output');
|
|
707
|
-
}
|
|
708
|
-
assertNoArguments(rawArgs);
|
|
709
|
-
const { paths } = await configuredPaths(projectRoot);
|
|
710
|
-
const [controllerTrust, policy, projectRootHash] = await Promise.all([
|
|
711
|
-
readNativeControllerTrustProject(projectRoot),
|
|
712
|
-
readNativeReviewTrustPolicy(paths),
|
|
713
|
-
nativeControllerProjectRootHash(projectRoot),
|
|
714
|
-
]);
|
|
715
|
-
if (!controllerTrust) {
|
|
716
|
-
throw new Error('Native project has no controller-owned trust root');
|
|
717
|
-
}
|
|
718
|
-
const authorization = buildNativeCreationAuthorization({
|
|
719
|
-
controllerIdentity: controllerTrust.controllerIdentity,
|
|
720
|
-
controllerPrivateKey: privateKeyFromEnvironment(controllerPrivateKeyEnv),
|
|
721
|
-
projectRootHash,
|
|
722
|
-
policyHash: policy.policyHash,
|
|
723
|
-
change: name,
|
|
724
|
-
});
|
|
725
|
-
const outputPath = path.resolve(outputPathValue);
|
|
726
|
-
await writeExclusiveFile(outputPath, `${JSON.stringify(authorization, null, 2)}\n`, 0o644);
|
|
727
|
-
return success('trust authorize', { outputPath, authorization }, `Native creation authorization written to ${outputPath}\n`);
|
|
728
|
-
}
|
|
729
|
-
throw new NativeUsageError(`Unknown trust command: ${subcommand}`);
|
|
730
|
-
}
|
|
731
481
|
if (command === 'receipt') {
|
|
732
482
|
const subcommand = requiredPositional(rawArgs, 'receipt subcommand');
|
|
733
|
-
if (subcommand === 'implement' && rawArgs[0] === 'sign') {
|
|
734
|
-
rawArgs.shift();
|
|
735
|
-
const preparationPath = takeOption(rawArgs, '--preparation');
|
|
736
|
-
const identityPath = takeOption(rawArgs, '--identity');
|
|
737
|
-
const privateKeyEnv = takeOption(rawArgs, '--private-key-env');
|
|
738
|
-
const outputPathValue = takeOption(rawArgs, '--output');
|
|
739
|
-
if (!preparationPath || !identityPath || !privateKeyEnv || !outputPathValue) {
|
|
740
|
-
throw new NativeUsageError('receipt implement sign requires --preparation, --identity, --private-key-env, and --output');
|
|
741
|
-
}
|
|
742
|
-
assertNoArguments(rawArgs);
|
|
743
|
-
const attestation = signNativeImplementationPreparation({
|
|
744
|
-
preparation: await readEvidenceJson(preparationPath, 'Native implementation preparation'),
|
|
745
|
-
identity: parseNativeReviewIdentity(await readEvidenceJson(identityPath, 'Implementation identity')),
|
|
746
|
-
privateKey: privateKeyFromEnvironment(privateKeyEnv),
|
|
747
|
-
});
|
|
748
|
-
const outputPath = path.resolve(outputPathValue);
|
|
749
|
-
await atomicWriteJson(outputPath, attestation);
|
|
750
|
-
return success('receipt implement sign', { outputPath, attestation }, `Native implementation attestation written to ${outputPath}\n`);
|
|
751
|
-
}
|
|
752
|
-
if (subcommand === 'review' && rawArgs[0] === 'sign') {
|
|
753
|
-
rawArgs.shift();
|
|
754
|
-
const approvalPath = takeOption(rawArgs, '--approval');
|
|
755
|
-
const identityPath = takeOption(rawArgs, '--identity');
|
|
756
|
-
const privateKeyEnv = takeOption(rawArgs, '--private-key-env');
|
|
757
|
-
const outputPathValue = takeOption(rawArgs, '--output');
|
|
758
|
-
if (!approvalPath || !identityPath || !privateKeyEnv || !outputPathValue) {
|
|
759
|
-
throw new NativeUsageError('receipt review sign requires --approval, --identity, --private-key-env, and --output');
|
|
760
|
-
}
|
|
761
|
-
assertNoArguments(rawArgs);
|
|
762
|
-
const attestation = signNativeIndependentReviewApproval({
|
|
763
|
-
approval: await readEvidenceJson(approvalPath, 'Native review approval'),
|
|
764
|
-
identity: parseNativeReviewIdentity(await readEvidenceJson(identityPath, 'Reviewer identity')),
|
|
765
|
-
privateKey: privateKeyFromEnvironment(privateKeyEnv),
|
|
766
|
-
});
|
|
767
|
-
const outputPath = path.resolve(outputPathValue);
|
|
768
|
-
await atomicWriteJson(outputPath, attestation);
|
|
769
|
-
return success('receipt review sign', { outputPath, attestation }, `Native review attestation written to ${outputPath}\n`);
|
|
770
|
-
}
|
|
771
483
|
const name = requiredPositional(rawArgs, 'change name');
|
|
772
484
|
const { paths } = await configuredPaths(projectRoot);
|
|
773
|
-
if (subcommand === 'implement') {
|
|
774
|
-
const implementationPhase = requiredPositional(rawArgs, 'implementation phase');
|
|
775
|
-
if (implementationPhase === 'prepare') {
|
|
776
|
-
const identityPath = takeOption(rawArgs, '--identity');
|
|
777
|
-
const outputPathValue = takeOption(rawArgs, '--output');
|
|
778
|
-
if (!identityPath || !outputPathValue) {
|
|
779
|
-
throw new NativeUsageError('receipt implement prepare requires --identity and --output');
|
|
780
|
-
}
|
|
781
|
-
assertNoArguments(rawArgs);
|
|
782
|
-
const preparation = await prepareNativeImplementationAttestation({
|
|
783
|
-
paths,
|
|
784
|
-
name,
|
|
785
|
-
implementationIdentity: parseNativeReviewIdentity(await readEvidenceJson(identityPath, 'Implementation identity')),
|
|
786
|
-
});
|
|
787
|
-
const outputPath = path.resolve(outputPathValue);
|
|
788
|
-
await atomicWriteJson(outputPath, preparation);
|
|
789
|
-
return success('receipt implement prepare', { outputPath, preparation }, `Native implementation preparation written to ${outputPath}\n`);
|
|
790
|
-
}
|
|
791
|
-
if (implementationPhase === 'finalize') {
|
|
792
|
-
const preparationPath = takeOption(rawArgs, '--preparation');
|
|
793
|
-
const attestationPath = takeOption(rawArgs, '--attestation');
|
|
794
|
-
const confirmed = takeFlag(rawArgs, '--confirmed');
|
|
795
|
-
if (!preparationPath || !attestationPath) {
|
|
796
|
-
throw new NativeUsageError('receipt implement finalize requires --preparation and --attestation');
|
|
797
|
-
}
|
|
798
|
-
assertNoArguments(rawArgs);
|
|
799
|
-
const issued = await finalizeNativeImplementationAttestation({
|
|
800
|
-
paths,
|
|
801
|
-
name,
|
|
802
|
-
preparation: parseNativeImplementationPreparation(await readEvidenceJson(preparationPath, 'Native implementation preparation')),
|
|
803
|
-
attestation: parseNativeReviewSignature(await readEvidenceJson(attestationPath, 'Native implementation attestation')),
|
|
804
|
-
confirmed,
|
|
805
|
-
});
|
|
806
|
-
return success('receipt implement finalize', issued, `Native implementation attestation: ${issued.ref}\n`);
|
|
807
|
-
}
|
|
808
|
-
throw new NativeUsageError(`Unknown receipt implementation phase: ${implementationPhase}`);
|
|
809
|
-
}
|
|
810
485
|
if (subcommand === 'manual') {
|
|
811
486
|
const acceptanceIds = takeMany(rawArgs, '--acceptance');
|
|
812
|
-
const responsible = takeOption(rawArgs, '--responsible');
|
|
813
487
|
const steps = takeMany(rawArgs, '--step');
|
|
814
488
|
const observations = takeMany(rawArgs, '--observation');
|
|
815
|
-
const confirmed = takeFlag(rawArgs, '--confirmed');
|
|
816
|
-
if (!responsible)
|
|
817
|
-
throw new NativeUsageError('--responsible is required');
|
|
818
489
|
assertNoArguments(rawArgs);
|
|
819
490
|
const issued = await issueNativeManualEvidenceReceipt({
|
|
820
491
|
paths,
|
|
821
492
|
name,
|
|
822
493
|
acceptanceIds,
|
|
823
|
-
responsible,
|
|
824
494
|
steps,
|
|
825
495
|
observations,
|
|
826
|
-
confirmed,
|
|
827
496
|
});
|
|
828
497
|
return success('receipt manual', issued, `Native manual receipt: ${issued.ref}\n`);
|
|
829
498
|
}
|
|
@@ -862,128 +531,6 @@ async function dispatch(rawArgs, explicitProjectRoot) {
|
|
|
862
531
|
text: `Native automated receipt ${issued.receipt.status}: ${issued.ref}\n`,
|
|
863
532
|
};
|
|
864
533
|
}
|
|
865
|
-
if (subcommand === 'review') {
|
|
866
|
-
const reviewPhase = requiredPositional(rawArgs, 'review phase');
|
|
867
|
-
if (reviewPhase === 'prepare') {
|
|
868
|
-
const implementationReceiptRef = takeOption(rawArgs, '--implementation-receipt');
|
|
869
|
-
const reportRef = takeOption(rawArgs, '--report');
|
|
870
|
-
const requiredReceiptRefs = takeMany(rawArgs, '--required-receipt');
|
|
871
|
-
const identityPath = takeOption(rawArgs, '--identity');
|
|
872
|
-
const outputPathValue = takeOption(rawArgs, '--output');
|
|
873
|
-
const checkedEvidence = {
|
|
874
|
-
unifiedIo: takeOption(rawArgs, '--unified-io-receipt') ?? null,
|
|
875
|
-
adversarialPaths: takeOption(rawArgs, '--adversarial-paths-receipt') ?? null,
|
|
876
|
-
generatedAssets: takeOption(rawArgs, '--generated-assets-receipt') ?? null,
|
|
877
|
-
lifecycleEval: takeOption(rawArgs, '--lifecycle-eval-receipt') ?? null,
|
|
878
|
-
};
|
|
879
|
-
if (!implementationReceiptRef ||
|
|
880
|
-
!reportRef ||
|
|
881
|
-
requiredReceiptRefs.length === 0 ||
|
|
882
|
-
!identityPath ||
|
|
883
|
-
!outputPathValue) {
|
|
884
|
-
throw new NativeUsageError('receipt review prepare requires --implementation-receipt, --report, at least one --required-receipt, --identity, and --output');
|
|
885
|
-
}
|
|
886
|
-
assertNoArguments(rawArgs);
|
|
887
|
-
const preparation = await prepareNativeIndependentReview({
|
|
888
|
-
paths,
|
|
889
|
-
name,
|
|
890
|
-
implementationReceiptRef,
|
|
891
|
-
reportRef,
|
|
892
|
-
requiredReceiptRefs,
|
|
893
|
-
reviewerIdentity: parseNativeReviewIdentity(await readEvidenceJson(identityPath, 'Reviewer identity')),
|
|
894
|
-
checkedEvidence,
|
|
895
|
-
});
|
|
896
|
-
const outputPath = path.resolve(outputPathValue);
|
|
897
|
-
await atomicWriteJson(outputPath, preparation);
|
|
898
|
-
return success('receipt review prepare', { outputPath, preparation }, `Native review preparation written to ${outputPath}\n`);
|
|
899
|
-
}
|
|
900
|
-
if (reviewPhase === 'approve') {
|
|
901
|
-
const preparationPath = takeOption(rawArgs, '--preparation');
|
|
902
|
-
const outputPathValue = takeOption(rawArgs, '--output');
|
|
903
|
-
const manualAttestationRefs = takeMany(rawArgs, '--attest-manual');
|
|
904
|
-
const findingsPath = takeOption(rawArgs, '--findings');
|
|
905
|
-
const acceptanceApplicability = takeFlag(rawArgs, '--checked-acceptance-applicability');
|
|
906
|
-
if (!preparationPath || !outputPathValue) {
|
|
907
|
-
throw new NativeUsageError('receipt review approve requires --preparation and --output');
|
|
908
|
-
}
|
|
909
|
-
assertNoArguments(rawArgs);
|
|
910
|
-
const rawFindings = findingsPath
|
|
911
|
-
? await readEvidenceJson(findingsPath, 'Independent review findings')
|
|
912
|
-
: [];
|
|
913
|
-
if (!Array.isArray(rawFindings)) {
|
|
914
|
-
throw new Error('Independent review findings must be a JSON array');
|
|
915
|
-
}
|
|
916
|
-
const preparation = (await readEvidenceJson(preparationPath, 'Native review preparation'));
|
|
917
|
-
const approval = await approveNativeIndependentReviewPreparation({
|
|
918
|
-
paths,
|
|
919
|
-
name,
|
|
920
|
-
preparation,
|
|
921
|
-
acceptanceApplicability,
|
|
922
|
-
manualAttestationRefs,
|
|
923
|
-
findings: rawFindings,
|
|
924
|
-
});
|
|
925
|
-
const outputPath = path.resolve(outputPathValue);
|
|
926
|
-
await atomicWriteJson(outputPath, approval);
|
|
927
|
-
return success('receipt review approve', { outputPath, approval }, `Native review approval written to ${outputPath}\n`);
|
|
928
|
-
}
|
|
929
|
-
if (reviewPhase === 'finalize') {
|
|
930
|
-
const preparationPath = takeOption(rawArgs, '--preparation');
|
|
931
|
-
const approvalPath = takeOption(rawArgs, '--approval');
|
|
932
|
-
const attestationPath = takeOption(rawArgs, '--attestation');
|
|
933
|
-
const confirmed = takeFlag(rawArgs, '--confirmed');
|
|
934
|
-
if (!preparationPath || !approvalPath || !attestationPath) {
|
|
935
|
-
throw new NativeUsageError('receipt review finalize requires --preparation, --approval, and --attestation');
|
|
936
|
-
}
|
|
937
|
-
assertNoArguments(rawArgs);
|
|
938
|
-
const issued = await finalizeNativeIndependentReviewReceipt({
|
|
939
|
-
paths,
|
|
940
|
-
name,
|
|
941
|
-
preparation: (await readEvidenceJson(preparationPath, 'Native review preparation')),
|
|
942
|
-
approval: parseNativeIndependentReviewApproval(await readEvidenceJson(approvalPath, 'Native review approval')),
|
|
943
|
-
attestation: parseNativeReviewSignature(await readEvidenceJson(attestationPath, 'Native review attestation')),
|
|
944
|
-
confirmed,
|
|
945
|
-
});
|
|
946
|
-
return {
|
|
947
|
-
command: 'receipt review finalize',
|
|
948
|
-
exitCode: issued.receipt.status === 'passed' ? 0 : 1,
|
|
949
|
-
data: issued,
|
|
950
|
-
text: `Native review receipt ${issued.receipt.status}: ${issued.ref}\n`,
|
|
951
|
-
};
|
|
952
|
-
}
|
|
953
|
-
throw new NativeUsageError(`Unknown receipt review phase: ${reviewPhase}`);
|
|
954
|
-
}
|
|
955
|
-
if (subcommand === 'waive') {
|
|
956
|
-
const acceptanceId = takeOption(rawArgs, '--acceptance');
|
|
957
|
-
const blockedReceiptRef = takeOption(rawArgs, '--blocked-receipt');
|
|
958
|
-
const reason = takeOption(rawArgs, '--reason');
|
|
959
|
-
const risk = takeOption(rawArgs, '--risk');
|
|
960
|
-
const alternativeReceiptRefs = takeMany(rawArgs, '--alternative-receipt');
|
|
961
|
-
const identityPath = takeOption(rawArgs, '--identity');
|
|
962
|
-
const privateKeyEnv = takeOption(rawArgs, '--private-key-env');
|
|
963
|
-
const confirmed = takeFlag(rawArgs, '--confirmed');
|
|
964
|
-
if (!acceptanceId ||
|
|
965
|
-
!blockedReceiptRef ||
|
|
966
|
-
!reason ||
|
|
967
|
-
!risk ||
|
|
968
|
-
!identityPath ||
|
|
969
|
-
!privateKeyEnv) {
|
|
970
|
-
throw new NativeUsageError('receipt waive requires --acceptance, --blocked-receipt, --reason, --risk, --identity, and --private-key-env');
|
|
971
|
-
}
|
|
972
|
-
assertNoArguments(rawArgs);
|
|
973
|
-
const issued = await issueNativeWaiverReceipt({
|
|
974
|
-
paths,
|
|
975
|
-
name,
|
|
976
|
-
acceptanceId,
|
|
977
|
-
blockedReceiptRef,
|
|
978
|
-
reason,
|
|
979
|
-
risk,
|
|
980
|
-
alternativeReceiptRefs,
|
|
981
|
-
signerIdentity: parseNativeReviewIdentity(await readEvidenceJson(identityPath, 'Waiver signer identity')),
|
|
982
|
-
privateKey: privateKeyFromEnvironment(privateKeyEnv),
|
|
983
|
-
confirmed,
|
|
984
|
-
});
|
|
985
|
-
return success('receipt waive', issued, `Native waiver receipt: ${issued.ref}\n`);
|
|
986
|
-
}
|
|
987
534
|
throw new NativeUsageError(`Unknown receipt command: ${subcommand}`);
|
|
988
535
|
}
|
|
989
536
|
if (command === 'next') {
|
|
@@ -998,14 +545,6 @@ async function dispatch(rawArgs, explicitProjectRoot) {
|
|
|
998
545
|
const partialReason = takeOption(rawArgs, '--partial-reason');
|
|
999
546
|
const verificationResult = takeOption(rawArgs, '--result');
|
|
1000
547
|
const verificationReport = takeOption(rawArgs, '--report');
|
|
1001
|
-
const verificationReceipt = takeOption(rawArgs, '--receipt');
|
|
1002
|
-
const hasVerificationReceiptRefs = rawArgs.includes('--evidence-receipt');
|
|
1003
|
-
const hasVerificationWaiverRefs = rawArgs.includes('--waiver');
|
|
1004
|
-
const verificationReceiptRefs = takeMany(rawArgs, '--evidence-receipt');
|
|
1005
|
-
const verificationWaiverRefs = takeMany(rawArgs, '--waiver');
|
|
1006
|
-
const independentReviewReceiptRef = takeOption(rawArgs, '--independent-review-receipt');
|
|
1007
|
-
const repairFailureCategories = takeMany(rawArgs, '--failure-category');
|
|
1008
|
-
const repairFailedCheckIds = takeMany(rawArgs, '--failed-check');
|
|
1009
548
|
const repairOverrideSignature = takeOption(rawArgs, '--override-repair');
|
|
1010
549
|
const repairOverrideSummary = takeOption(rawArgs, '--override-summary');
|
|
1011
550
|
if (verificationResult !== undefined &&
|
|
@@ -1022,22 +561,6 @@ async function dispatch(rawArgs, explicitProjectRoot) {
|
|
|
1022
561
|
if (allowPartialScopeHash && !confirmed) {
|
|
1023
562
|
throw new NativeUsageError('--allow-partial-scope requires --confirmed');
|
|
1024
563
|
}
|
|
1025
|
-
if ((repairFailureCategories.length > 0 || repairFailedCheckIds.length > 0) &&
|
|
1026
|
-
verificationResult !== 'fail') {
|
|
1027
|
-
throw new NativeUsageError('--failure-category and --failed-check require --result fail');
|
|
1028
|
-
}
|
|
1029
|
-
if (verificationReceipt && verificationResult === undefined) {
|
|
1030
|
-
throw new NativeUsageError('--receipt requires --result');
|
|
1031
|
-
}
|
|
1032
|
-
if ((verificationReceiptRefs.length > 0 ||
|
|
1033
|
-
verificationWaiverRefs.length > 0 ||
|
|
1034
|
-
independentReviewReceiptRef) &&
|
|
1035
|
-
verificationResult === undefined) {
|
|
1036
|
-
throw new NativeUsageError('--evidence-receipt, --waiver, and --independent-review-receipt require --result');
|
|
1037
|
-
}
|
|
1038
|
-
if (independentReviewReceiptRef && verificationResult !== 'pass') {
|
|
1039
|
-
throw new NativeUsageError('--independent-review-receipt requires --result pass');
|
|
1040
|
-
}
|
|
1041
564
|
if ((repairOverrideSignature === undefined) !== (repairOverrideSummary === undefined)) {
|
|
1042
565
|
throw new NativeUsageError('--override-repair and --override-summary must be provided together');
|
|
1043
566
|
}
|
|
@@ -1058,16 +581,6 @@ async function dispatch(rawArgs, explicitProjectRoot) {
|
|
|
1058
581
|
...(partialReason ? { partialReason } : {}),
|
|
1059
582
|
...(verificationResult ? { verificationResult } : {}),
|
|
1060
583
|
...(verificationReport ? { verificationReport } : {}),
|
|
1061
|
-
...(verificationReceipt ? { verificationReceipt } : {}),
|
|
1062
|
-
...(verificationResult && hasVerificationReceiptRefs
|
|
1063
|
-
? {
|
|
1064
|
-
verificationReceiptRefs,
|
|
1065
|
-
}
|
|
1066
|
-
: {}),
|
|
1067
|
-
...(verificationResult && hasVerificationWaiverRefs ? { verificationWaiverRefs } : {}),
|
|
1068
|
-
...(independentReviewReceiptRef ? { independentReviewReceiptRef } : {}),
|
|
1069
|
-
...(repairFailureCategories.length > 0 ? { repairFailureCategories } : {}),
|
|
1070
|
-
...(repairFailedCheckIds.length > 0 ? { repairFailedCheckIds } : {}),
|
|
1071
584
|
...(repairOverrideSignature ? { repairOverrideSignature } : {}),
|
|
1072
585
|
...(repairOverrideSummary ? { repairOverrideSummary } : {}),
|
|
1073
586
|
};
|
|
@@ -1230,7 +743,7 @@ function errorResult(command, error) {
|
|
|
1230
743
|
policyHash: error.policyHash,
|
|
1231
744
|
configPath: '.comet/config.yaml',
|
|
1232
745
|
supportedFixes: [
|
|
1233
|
-
'increase native.snapshot.max_total_bytes or native.snapshot.max_duration_ms',
|
|
746
|
+
'increase native.snapshot.max_files, native.snapshot.max_total_bytes, or native.snapshot.max_duration_ms',
|
|
1234
747
|
'add an explicit native.snapshot.exclude pattern for data outside implementation scope',
|
|
1235
748
|
],
|
|
1236
749
|
requiredAction: 'resolve-native-baseline',
|