diffpact 0.0.0-stage → 0.4.3

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 (51) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/LICENSE +21 -0
  3. package/README.md +223 -2
  4. package/bin/diffpact.mjs +15 -0
  5. package/dist/adapters/claude-code.d.ts +21 -0
  6. package/dist/adapters/claude-code.js +191 -0
  7. package/dist/adapters/codex.d.ts +31 -0
  8. package/dist/adapters/codex.js +348 -0
  9. package/dist/adapters/gemini-agy.d.ts +26 -0
  10. package/dist/adapters/gemini-agy.js +429 -0
  11. package/dist/adapters/vercel-board.d.ts +30 -0
  12. package/dist/adapters/vercel-board.js +138 -0
  13. package/dist/amend.d.ts +46 -0
  14. package/dist/amend.js +476 -0
  15. package/dist/boundaries.d.ts +43 -0
  16. package/dist/boundaries.js +309 -0
  17. package/dist/canonical-json.d.ts +6 -0
  18. package/dist/canonical-json.js +63 -0
  19. package/dist/cli.d.ts +1 -0
  20. package/dist/cli.js +1704 -0
  21. package/dist/delegate.d.ts +22 -0
  22. package/dist/delegate.js +140 -0
  23. package/dist/doctor.d.ts +36 -0
  24. package/dist/doctor.js +293 -0
  25. package/dist/git.d.ts +27 -0
  26. package/dist/git.js +234 -0
  27. package/dist/index.d.ts +19 -0
  28. package/dist/index.js +19 -0
  29. package/dist/merge-verify.d.ts +31 -0
  30. package/dist/merge-verify.js +721 -0
  31. package/dist/report.d.ts +25 -0
  32. package/dist/report.js +220 -0
  33. package/dist/review.d.ts +46 -0
  34. package/dist/review.js +527 -0
  35. package/dist/runner.d.ts +45 -0
  36. package/dist/runner.js +213 -0
  37. package/dist/schema.d.ts +6 -0
  38. package/dist/schema.js +424 -0
  39. package/dist/types.d.ts +190 -0
  40. package/dist/types.js +220 -0
  41. package/dist/verify.d.ts +45 -0
  42. package/dist/verify.js +952 -0
  43. package/dist/worktree.d.ts +82 -0
  44. package/dist/worktree.js +717 -0
  45. package/examples/harnesses/README.md +63 -0
  46. package/examples/quickstart/README.md +17 -0
  47. package/examples/quickstart/run.mjs +247 -0
  48. package/package.json +62 -4
  49. package/schemas/contract.schema.json +148 -0
  50. package/schemas/receipt.schema.json +49 -0
  51. package/schemas/review.schema.json +48 -0
@@ -0,0 +1,190 @@
1
+ export declare const EXIT_PASS = 0;
2
+ export declare const EXIT_VIOLATION = 1;
3
+ export declare const EXIT_INCOMPLETE = 2;
4
+ export declare const EXIT_STALE = 3;
5
+ export type ExitCode = 0 | 1 | 2 | 3;
6
+ export type HarnessKind = 'claude-code' | 'codex' | 'crush' | 'gemini-cli' | 'agy' | 'vercel-board' | 'manual' | 'other';
7
+ export interface SessionIdentity {
8
+ agent_id: string;
9
+ session_id: string;
10
+ harness: HarnessKind;
11
+ model?: string;
12
+ }
13
+ export interface VersionAssertion {
14
+ path: string;
15
+ kind: 'sha256' | 'json_pointer' | 'regex_exact';
16
+ key: string;
17
+ expected: string;
18
+ }
19
+ export interface InterfaceDeltaLockfilePin {
20
+ path: string;
21
+ sha256: string;
22
+ must_remain_unmodified?: boolean;
23
+ }
24
+ export interface RequiredCheck {
25
+ id: string;
26
+ command: string;
27
+ cwd?: string;
28
+ timeout_sec?: number;
29
+ forbid_skipped?: boolean;
30
+ }
31
+ export interface WorktreePolicy {
32
+ branch?: string;
33
+ path?: string;
34
+ require_clean_start?: boolean;
35
+ require_clean_end?: boolean;
36
+ }
37
+ export interface BudgetPolicy {
38
+ max_budget_usd?: number;
39
+ reserved_budget_usd?: number;
40
+ delegation_depth?: number;
41
+ max_delegation_depth?: number;
42
+ parent_contract_sha256?: string;
43
+ }
44
+ export interface ReviewPolicy {
45
+ required_reviews?: number;
46
+ require_non_self_certified?: boolean;
47
+ require_distinct_harness?: boolean;
48
+ require_raw_diff_inspection?: boolean;
49
+ canonical_integrator_agent_id?: string;
50
+ }
51
+ export interface RoleSubstitutionGrant {
52
+ substitute_agent_id: string;
53
+ authorized_by: string;
54
+ task_id: string;
55
+ active: boolean;
56
+ spent: boolean;
57
+ reason?: string;
58
+ }
59
+ export interface TaskContractV01 {
60
+ schema_version: 'diffpact-contract-v0.1';
61
+ task_id: string;
62
+ task_type: 'coding' | 'research';
63
+ mission: string;
64
+ starting_sha: string;
65
+ candidate_sha?: string | null;
66
+ worktree: WorktreePolicy;
67
+ allowed_paths: string[];
68
+ read_only_paths?: string[];
69
+ forbidden_paths: string[];
70
+ version_assertions?: VersionAssertion[];
71
+ interfacedelta_lockfile?: InterfaceDeltaLockfilePin | null;
72
+ budget?: BudgetPolicy;
73
+ required_checks: RequiredCheck[];
74
+ advisory_checks?: RequiredCheck[];
75
+ allow_no_checks?: boolean;
76
+ allow_no_commit?: boolean;
77
+ implementer_session: SessionIdentity;
78
+ review_policy?: ReviewPolicy;
79
+ role_substitution?: RoleSubstitutionGrant | null;
80
+ }
81
+ export interface ViolationItem {
82
+ code: string;
83
+ message: string;
84
+ path?: string;
85
+ }
86
+ export interface ChangedFileEntry {
87
+ status: string;
88
+ path: string;
89
+ old_path?: string;
90
+ is_symlink?: boolean;
91
+ is_submodule?: boolean;
92
+ }
93
+ export interface CheckRunResult {
94
+ id: string;
95
+ command: string;
96
+ exit_code: number;
97
+ skipped_count: number;
98
+ duration_ms: number;
99
+ stdout_sha256: string;
100
+ stderr_sha256: string;
101
+ timed_out?: boolean;
102
+ spawn_error_code?: string;
103
+ spawn_error_message?: string;
104
+ }
105
+ export interface VerificationReceiptV01 {
106
+ schema_version: 'diffpact-receipt-v0.1';
107
+ receipt_sha256: string;
108
+ contract_sha256: string;
109
+ task_id: string;
110
+ verified_at: string;
111
+ starting_sha: string;
112
+ candidate_sha: string;
113
+ raw_diff_sha256: string;
114
+ branch: string;
115
+ worktree_path: string;
116
+ working_tree_clean: boolean;
117
+ status: 'pass' | 'violation' | 'incomplete' | 'stale';
118
+ exit_code: ExitCode;
119
+ diff_summary: {
120
+ changed_files: ChangedFileEntry[];
121
+ untracked_files: string[];
122
+ out_of_bounds_files: string[];
123
+ };
124
+ version_assertions_ok: boolean;
125
+ interfacedelta_lockfile_ok: boolean | null;
126
+ subcontracts_checked: number;
127
+ checks: CheckRunResult[];
128
+ advisory_checks?: CheckRunResult[];
129
+ violations: ViolationItem[];
130
+ }
131
+ export type ReviewAttestationMode = 'wrapper-verified' | 'diff-sha-bound' | 'cli-explicit' | 'api';
132
+ export interface ReviewAttestationV01 {
133
+ schema_version: 'diffpact-review-v0.1';
134
+ review_sha256: string;
135
+ contract_sha256: string;
136
+ receipt_sha256: string;
137
+ task_id: string;
138
+ starting_sha: string;
139
+ candidate_sha: string;
140
+ raw_diff_sha256: string;
141
+ evidence_lineage_id: string;
142
+ inspected_raw_diff: boolean;
143
+ attestation_mode?: ReviewAttestationMode;
144
+ attestation_hmac_sha256?: string;
145
+ implementer_session: SessionIdentity;
146
+ reviewer_session: SessionIdentity;
147
+ verdict: 'approve' | 'reject';
148
+ findings: string[];
149
+ summary: string;
150
+ reviewed_at: string;
151
+ }
152
+ export interface MergeVerificationReceiptV01 {
153
+ schema_version: 'diffpact-merge-receipt-v0.1';
154
+ merge_receipt_sha256: string;
155
+ verified_at: string;
156
+ base_sha: string;
157
+ merged_sha: string;
158
+ raw_diff_sha256: string;
159
+ branch: string;
160
+ repo_root: string;
161
+ working_tree_clean: boolean;
162
+ status: 'pass' | 'violation' | 'incomplete' | 'stale';
163
+ exit_code: ExitCode;
164
+ source_contracts: Array<{
165
+ path: string;
166
+ task_id: string;
167
+ contract_sha256: string;
168
+ starting_sha: string;
169
+ }>;
170
+ merged_policy: {
171
+ allowed_paths: string[];
172
+ global_forbidden_paths: string[];
173
+ integration_allowed_paths?: string[];
174
+ integration_reason?: string;
175
+ allow_untracked?: boolean;
176
+ required_checks_count: number;
177
+ advisory_checks_count: number;
178
+ };
179
+ diff_summary: {
180
+ changed_files: ChangedFileEntry[];
181
+ untracked_files: string[];
182
+ ignored_untracked_files?: string[];
183
+ out_of_bounds_files: string[];
184
+ };
185
+ version_assertions_ok: boolean;
186
+ lockfiles_ok: boolean | null;
187
+ checks: CheckRunResult[];
188
+ advisory_checks?: CheckRunResult[];
189
+ violations: ViolationItem[];
190
+ }
@@ -0,0 +1,45 @@
1
+ import { type ExitCode, type VerificationReceiptV01 } from './types.ts';
2
+ export interface ClassifiedCheckOutcome {
3
+ exitCode: number;
4
+ timedOut: boolean;
5
+ spawnErrorCode?: string;
6
+ spawnErrorMessage?: string;
7
+ }
8
+ /**
9
+ * Classifies child process outcomes accurately so sandbox/spawn errors (EPERM, EACCES, ENOENT)
10
+ * are NEVER masked as exit code 124 (timeout).
11
+ */
12
+ export declare function classifyCheckProcessOutcome(input: {
13
+ error?: Error | null;
14
+ status: number | null;
15
+ signal?: NodeJS.Signals | null;
16
+ timedOut?: boolean;
17
+ }): ClassifiedCheckOutcome;
18
+ /**
19
+ * Parses skipped test counts from common runners (Vitest, Node --test / TAP, Jest, Pytest)
20
+ * so skipped suites cannot silently masquerade as complete verification ("No Silent Zero").
21
+ */
22
+ export declare function parseSkippedTestCount(combinedOutput: string): number;
23
+ export interface VerifyOptions {
24
+ contractPath: string;
25
+ cwd?: string;
26
+ writeReceipt?: boolean;
27
+ shellPath?: string;
28
+ }
29
+ export interface VerifyAsyncOptions extends VerifyOptions {
30
+ heartbeatSec?: number;
31
+ onHeartbeat?: (message: string) => void;
32
+ }
33
+ export declare function runVerify(options: VerifyOptions): {
34
+ exitCode: ExitCode;
35
+ receipt?: VerificationReceiptV01;
36
+ error?: string;
37
+ };
38
+ /**
39
+ * Async variant of `runVerify` that emits periodic stderr heartbeats during long-running checks.
40
+ */
41
+ export declare function runVerifyAsync(options: VerifyAsyncOptions): Promise<{
42
+ exitCode: ExitCode;
43
+ receipt?: VerificationReceiptV01;
44
+ error?: string;
45
+ }>;