@tiphys/kernel 0.0.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +663 -0
- package/LICENSE +202 -0
- package/assurance-modes.yaml +299 -0
- package/checklists/clean-room.yaml +325 -0
- package/checklists/env-failure-diagnosis.yaml +68 -0
- package/checklists/flake-playbook.yaml +68 -0
- package/checklists/hazard-review.yaml +144 -0
- package/checklists/plan-review.yaml +103 -0
- package/dist/bin/tiphys.d.ts +2 -0
- package/dist/bin/tiphys.js +92 -0
- package/dist/src/adapters/load.d.ts +202 -0
- package/dist/src/adapters/load.js +440 -0
- package/dist/src/brief.d.ts +32 -0
- package/dist/src/brief.js +66 -0
- package/dist/src/checklists.d.ts +169 -0
- package/dist/src/checklists.js +310 -0
- package/dist/src/checks.d.ts +1539 -0
- package/dist/src/checks.js +5025 -0
- package/dist/src/cli.d.ts +9 -0
- package/dist/src/cli.js +68 -0
- package/dist/src/commands/brief.d.ts +92 -0
- package/dist/src/commands/brief.js +343 -0
- package/dist/src/commands/checklist.d.ts +42 -0
- package/dist/src/commands/checklist.js +168 -0
- package/dist/src/commands/cutover.d.ts +35 -0
- package/dist/src/commands/cutover.js +448 -0
- package/dist/src/commands/doctor.d.ts +264 -0
- package/dist/src/commands/doctor.js +1546 -0
- package/dist/src/commands/gates.d.ts +9 -0
- package/dist/src/commands/gates.js +360 -0
- package/dist/src/commands/init.d.ts +30 -0
- package/dist/src/commands/init.js +177 -0
- package/dist/src/commands/lock.d.ts +34 -0
- package/dist/src/commands/lock.js +340 -0
- package/dist/src/commands/mode.d.ts +40 -0
- package/dist/src/commands/mode.js +134 -0
- package/dist/src/commands/next.d.ts +130 -0
- package/dist/src/commands/next.js +597 -0
- package/dist/src/commands/plan.d.ts +20 -0
- package/dist/src/commands/plan.js +105 -0
- package/dist/src/commands/pool.d.ts +1 -0
- package/dist/src/commands/pool.js +139 -0
- package/dist/src/commands/resume.d.ts +1 -0
- package/dist/src/commands/resume.js +88 -0
- package/dist/src/commands/spawn.d.ts +1 -0
- package/dist/src/commands/spawn.js +195 -0
- package/dist/src/commands/status.d.ts +21 -0
- package/dist/src/commands/status.js +122 -0
- package/dist/src/commands/sync.d.ts +47 -0
- package/dist/src/commands/sync.js +341 -0
- package/dist/src/commands/teardown.d.ts +1 -0
- package/dist/src/commands/teardown.js +87 -0
- package/dist/src/commands/tuition.d.ts +21 -0
- package/dist/src/commands/tuition.js +218 -0
- package/dist/src/commands/validate.d.ts +78 -0
- package/dist/src/commands/validate.js +430 -0
- package/dist/src/commands/watch.d.ts +1 -0
- package/dist/src/commands/watch.js +172 -0
- package/dist/src/cutover.d.ts +584 -0
- package/dist/src/cutover.js +1444 -0
- package/dist/src/exclusion.d.ts +389 -0
- package/dist/src/exclusion.js +843 -0
- package/dist/src/exec/env.d.ts +278 -0
- package/dist/src/exec/env.js +334 -0
- package/dist/src/fleet.d.ts +223 -0
- package/dist/src/fleet.js +298 -0
- package/dist/src/gates/adapters/http-json.d.ts +5 -0
- package/dist/src/gates/adapters/http-json.js +283 -0
- package/dist/src/gates/adapters/migrations-command.d.ts +1 -0
- package/dist/src/gates/adapters/migrations-command.js +373 -0
- package/dist/src/gates/citations.d.ts +408 -0
- package/dist/src/gates/citations.js +1169 -0
- package/dist/src/gates/coverage.d.ts +375 -0
- package/dist/src/gates/coverage.js +836 -0
- package/dist/src/gates/credentials.d.ts +233 -0
- package/dist/src/gates/credentials.js +752 -0
- package/dist/src/gates/deploy.d.ts +1 -0
- package/dist/src/gates/deploy.js +33 -0
- package/dist/src/gates/gate-classes.d.ts +56 -0
- package/dist/src/gates/gate-classes.js +633 -0
- package/dist/src/gates/manifest.d.ts +99 -0
- package/dist/src/gates/manifest.js +208 -0
- package/dist/src/gates/merge-preconditions.d.ts +319 -0
- package/dist/src/gates/merge-preconditions.js +932 -0
- package/dist/src/gates/migrations.d.ts +1 -0
- package/dist/src/gates/migrations.js +36 -0
- package/dist/src/gates/pin.d.ts +114 -0
- package/dist/src/gates/pin.js +154 -0
- package/dist/src/gates/red-witness.d.ts +22 -0
- package/dist/src/gates/red-witness.js +482 -0
- package/dist/src/gates/release.d.ts +283 -0
- package/dist/src/gates/release.js +820 -0
- package/dist/src/gates/result.d.ts +116 -0
- package/dist/src/gates/result.js +91 -0
- package/dist/src/gates/run.d.ts +614 -0
- package/dist/src/gates/run.js +1614 -0
- package/dist/src/gates/schemas/citation-config.schema.json +59 -0
- package/dist/src/gates/schemas/coverage-config.schema.json +77 -0
- package/dist/src/gates/schemas/gate-manifest.schema.json +125 -0
- package/dist/src/gates/schemas/gate-result.schema.json +160 -0
- package/dist/src/gates/schemas/phase-declaration.schema.json +87 -0
- package/dist/src/gates/schemas/release-record.schema.json +119 -0
- package/dist/src/gates/schemas/verifier-config.schema.json +101 -0
- package/dist/src/gates/schemas/witness-spec.schema.json +110 -0
- package/dist/src/gates/scope.d.ts +131 -0
- package/dist/src/gates/scope.js +1018 -0
- package/dist/src/gates/suite.d.ts +217 -0
- package/dist/src/gates/suite.js +968 -0
- package/dist/src/gates/validate.d.ts +121 -0
- package/dist/src/gates/validate.js +414 -0
- package/dist/src/hooks.d.ts +84 -0
- package/dist/src/hooks.js +125 -0
- package/dist/src/index.d.ts +31 -0
- package/dist/src/index.js +30 -0
- package/dist/src/liveness.d.ts +321 -0
- package/dist/src/liveness.js +396 -0
- package/dist/src/lock.d.ts +256 -0
- package/dist/src/lock.js +792 -0
- package/dist/src/model-resolution.d.ts +159 -0
- package/dist/src/model-resolution.js +307 -0
- package/dist/src/modes.d.ts +149 -0
- package/dist/src/modes.js +258 -0
- package/dist/src/path-identity.d.ts +34 -0
- package/dist/src/path-identity.js +48 -0
- package/dist/src/plan.d.ts +73 -0
- package/dist/src/plan.js +153 -0
- package/dist/src/pool.d.ts +326 -0
- package/dist/src/pool.js +988 -0
- package/dist/src/roles.d.ts +461 -0
- package/dist/src/roles.js +776 -0
- package/dist/src/spawn.d.ts +482 -0
- package/dist/src/spawn.js +1003 -0
- package/dist/src/status.d.ts +116 -0
- package/dist/src/status.js +148 -0
- package/dist/src/task.d.ts +504 -0
- package/dist/src/task.js +307 -0
- package/dist/src/teardown.d.ts +39 -0
- package/dist/src/teardown.js +422 -0
- package/dist/src/tuition.d.ts +159 -0
- package/dist/src/tuition.js +311 -0
- package/dist/src/validate.d.ts +263 -0
- package/dist/src/validate.js +742 -0
- package/dist/src/version.d.ts +3 -0
- package/dist/src/version.js +38 -0
- package/dist/src/watcher.d.ts +275 -0
- package/dist/src/watcher.js +849 -0
- package/dist/src/witness/run.d.ts +299 -0
- package/dist/src/witness/run.js +1373 -0
- package/dist/src/witness/spec.d.ts +270 -0
- package/dist/src/witness/spec.js +475 -0
- package/dist/tsconfig.src.tsbuildinfo +1 -0
- package/gate-registry.yaml +526 -0
- package/gates.manifest.json +257 -0
- package/package.json +72 -3
- package/role-model-config.yaml +88 -0
- package/roles/README.md +128 -0
- package/roles/_shared-dispatch-contract.md +87 -0
- package/roles/adversarial-plan-reviewer.md +80 -0
- package/roles/clean-room-reviewer.md +140 -0
- package/roles/implementer.md +463 -0
- package/roles/investigator.md +138 -0
- package/roles/plan-writer.md +95 -0
- package/schemas/README.md +82 -0
- package/schemas/assurance-modes.schema.json +264 -0
- package/schemas/charter.schema.json +185 -0
- package/schemas/checklist.schema.json +114 -0
- package/schemas/cutover-state.schema.json +64 -0
- package/schemas/decision-record.schema.json +88 -0
- package/schemas/executor-record.schema.json +36 -0
- package/schemas/final-report.schema.json +90 -0
- package/schemas/finding.schema.json +106 -0
- package/schemas/gate-registry.schema.json +260 -0
- package/schemas/mechanism-index.schema.json +94 -0
- package/schemas/model-resolution.schema.json +362 -0
- package/schemas/plan.schema.json +300 -0
- package/schemas/report.schema.json +579 -0
- package/schemas/role-brief.schema.json +105 -0
- package/schemas/role-model-config.schema.json +90 -0
- package/schemas/status-line.schema.json +40 -0
- package/schemas/tuition.schema.json +191 -0
- package/schemas/verdict.schema.json +295 -0
- package/schemas/work-history.schema.json +183 -0
- package/schemas/write-bypass.schema.json +69 -0
- package/templates/charter.example.yaml +54 -0
- package/templates/decision-record.example.yaml +27 -0
- package/templates/final-report.example.yaml +80 -0
- package/templates/plan.example.yaml +87 -0
- package/templates/report.example.yaml +236 -0
- package/templates/warnings.md +74 -0
- package/templates/work-history.example.yaml +185 -0
- package/tuition/README.md +76 -0
- package/tuition/T-001.yaml +48 -0
- package/tuition/T-002.yaml +51 -0
- package/tuition/T-003.yaml +100 -0
- package/tuition/T-004.yaml +52 -0
- package/tuition/T-005.yaml +72 -0
- package/tuition/T-006.yaml +81 -0
- package/tuition/T-007.yaml +56 -0
- package/tuition/T-008.yaml +111 -0
- package/tuition/T-009.yaml +50 -0
- package/tuition/T-015.yaml +36 -0
- package/tuition/T-016.yaml +36 -0
- package/tuition/T-017.yaml +46 -0
- package/tuition/T-018.yaml +84 -0
- package/tuition/T-021.yaml +40 -0
- package/tuition/T-022.yaml +36 -0
- package/tuition/mechanism-index.yaml +256 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://tiphys.dev/schemas/verifier-config.schema.json",
|
|
4
|
+
"title": "Tiphys release-verification declaration",
|
|
5
|
+
"description": "The per-repository release-verification declaration (kernel plan M2, M2-P7 step 7; DR-0014). One document, committed at the repository root as release-verification.json, read from a COMMITTED ref (the merge base at the anti-widening call sites), never from the working tree. Silence is never permission: an absent verification field is error, not none, and mode none requires a non-empty reason. Mode-conditional requirements (none requires reason; adapter requires adapter, config and clock) need conditional composition, which is outside the closed keyword set of M2-D-04, so they are checked in code by src/gates/release.ts, which emits the same INVALID <pointer> <message> diagnostics. Expressed entirely in the closed keyword set.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["version", "repository", "integrationRef", "verifications"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"version": {
|
|
11
|
+
"type": "integer",
|
|
12
|
+
"minimum": 1
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"description": "The project's own identifier for itself (owner/name, or any project-declared identifier). Copied verbatim into the verification subject.",
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"integrationRef": {
|
|
19
|
+
"description": "The branch merges land on, normally main. Copied verbatim into the verification subject.",
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"verifications": {
|
|
23
|
+
"description": "The two M2 registry entries, keyed by gate id. M2 deliberately does not generalize to N charter-declared verifications (kernel plan M2 section 2 item 12); the charter field that will supersede this document is M3's reserved space.",
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"properties": {
|
|
27
|
+
"deploy": {
|
|
28
|
+
"$ref": "#/$defs/verification"
|
|
29
|
+
},
|
|
30
|
+
"migrations": {
|
|
31
|
+
"$ref": "#/$defs/verification"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"$defs": {
|
|
37
|
+
"verification": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"required": ["mode"],
|
|
41
|
+
"properties": {
|
|
42
|
+
"mode": {
|
|
43
|
+
"description": "none is a POSITIVE declaration that this project has no such release state to verify, and it costs a reason. adapter names an executable that performs one bounded observation per invocation.",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"enum": ["none", "adapter"]
|
|
46
|
+
},
|
|
47
|
+
"reason": {
|
|
48
|
+
"description": "Required when mode is none (checked in code). Surfaced in the gate record and the evidence bundle: disabling verification costs visibility.",
|
|
49
|
+
"type": "string"
|
|
50
|
+
},
|
|
51
|
+
"adapter": {
|
|
52
|
+
"description": "argv of the adapter executable. Committed configuration under scope audit, never assembled at run time from an environment variable: an adapter path that can be redirected at run time is a way to make a verifier report anything (investigation section 5.2).",
|
|
53
|
+
"type": "array",
|
|
54
|
+
"minItems": 1,
|
|
55
|
+
"items": {
|
|
56
|
+
"type": "string"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"config": {
|
|
60
|
+
"description": "Adapter-specific configuration, passed through verbatim in the request. The kernel never interprets it; JSON-pointer extraction, satisfying values and platform vocabulary live here and only here.",
|
|
61
|
+
"type": "object"
|
|
62
|
+
},
|
|
63
|
+
"clock": {
|
|
64
|
+
"$ref": "#/$defs/clock"
|
|
65
|
+
},
|
|
66
|
+
"credentials": {
|
|
67
|
+
"description": "Environment variable NAMES, never values. A named variable that is not resolvable is error before any adapter spawn. Values never appear in configuration or in any evidence record (M2-P7 criterion 11).",
|
|
68
|
+
"type": "array",
|
|
69
|
+
"items": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"pattern": "^[A-Z][A-Z0-9_]*$"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"clock": {
|
|
77
|
+
"description": "The kernel's clock, from configuration the kernel validated. The adapter never sleeps, never loops, never schedules and never decides what a timeout means. There are NO defaults here: the kernel's maximum deadline and default poll interval are numbers M2-P7 step 12 forbids inventing, so every project states its own.",
|
|
78
|
+
"type": "object",
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"required": ["intervalMs", "deadlineMs", "attemptTimeoutMs"],
|
|
81
|
+
"properties": {
|
|
82
|
+
"intervalMs": {
|
|
83
|
+
"type": "integer",
|
|
84
|
+
"minimum": 0
|
|
85
|
+
},
|
|
86
|
+
"deadlineMs": {
|
|
87
|
+
"type": "integer",
|
|
88
|
+
"minimum": 1
|
|
89
|
+
},
|
|
90
|
+
"attemptTimeoutMs": {
|
|
91
|
+
"type": "integer",
|
|
92
|
+
"minimum": 1
|
|
93
|
+
},
|
|
94
|
+
"maxAttempts": {
|
|
95
|
+
"type": "integer",
|
|
96
|
+
"minimum": 1
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "tiphys:witness-spec",
|
|
4
|
+
"title": "Witness specification (kernel plan M2, M2-P2 step 2)",
|
|
5
|
+
"description": "One JSON document per behavior at witness/<behavior-id>.json, durable and repository-level (M2R-002, M2-D-14). Kind-specific member fields and the refusal rules (a) to (g) are enforced in src/witness/spec.ts and src/witness/run.ts because conditional composition is outside the closed keyword set (M2-D-04); the code emits the same INVALID <json-pointer> <message> contract.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["id", "behavior", "tests", "class", "dangerousStates", "deterministic"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"id": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$"
|
|
13
|
+
},
|
|
14
|
+
"behavior": {
|
|
15
|
+
"description": "Must resolve by name in test/behaviors.json of the repository under audit (refusal rule (b)).",
|
|
16
|
+
"type": "string",
|
|
17
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$"
|
|
18
|
+
},
|
|
19
|
+
"tests": {
|
|
20
|
+
"description": "Test names, run with --test-name-pattern BEFORE the positional test path (CLAUDE.md warning 7).",
|
|
21
|
+
"type": "array",
|
|
22
|
+
"minItems": 1,
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"pattern": "\\S"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"class": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"enum": ["additive", "destructive", "classification"]
|
|
31
|
+
},
|
|
32
|
+
"dangerousStates": {
|
|
33
|
+
"description": "An ARRAY of one or more members; every member is applied, run and recorded separately, and the witness is green only when every member was red (rule (g) has something to require rather than something to bolt on).",
|
|
34
|
+
"type": "array",
|
|
35
|
+
"minItems": 1,
|
|
36
|
+
"items": { "$ref": "#/$defs/dangerousStateMember" }
|
|
37
|
+
},
|
|
38
|
+
"deterministic": {
|
|
39
|
+
"type": "boolean"
|
|
40
|
+
},
|
|
41
|
+
"repeats": {
|
|
42
|
+
"description": "Red repetitions per member. Default 5 when absent.",
|
|
43
|
+
"type": "integer",
|
|
44
|
+
"minimum": 1
|
|
45
|
+
},
|
|
46
|
+
"consumesExternalOutput": {
|
|
47
|
+
"description": "Required, not optional, when the phase diff touches a module that spawns a subprocess or parses another program's output (rule (f), derived; V-2, warning 10).",
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"required": ["program", "captures", "provenance"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"program": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"pattern": "\\S"
|
|
55
|
+
},
|
|
56
|
+
"captures": {
|
|
57
|
+
"description": "Repository-relative paths to REAL captured output files. Each must exist, be non-empty, and have its basename referenced from the named tests' sources (rule (c)).",
|
|
58
|
+
"type": "array",
|
|
59
|
+
"minItems": 1,
|
|
60
|
+
"items": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"pattern": "\\S"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"provenance": {
|
|
66
|
+
"description": "Where and how the capture was taken (artifact path, date, command).",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"pattern": "\\S"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"$defs": {
|
|
74
|
+
"dangerousStateMember": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"additionalProperties": false,
|
|
77
|
+
"required": ["kind"],
|
|
78
|
+
"properties": {
|
|
79
|
+
"kind": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"enum": ["baseline-ref", "patch", "mutation"]
|
|
82
|
+
},
|
|
83
|
+
"ref": {
|
|
84
|
+
"description": "baseline-ref only: the ref resolved against the FETCHED remote, never a stale local ref.",
|
|
85
|
+
"type": "string",
|
|
86
|
+
"pattern": "\\S"
|
|
87
|
+
},
|
|
88
|
+
"patch": {
|
|
89
|
+
"description": "patch only: repository-relative path of a patch file applied with git apply.",
|
|
90
|
+
"type": "string",
|
|
91
|
+
"pattern": "\\S"
|
|
92
|
+
},
|
|
93
|
+
"file": {
|
|
94
|
+
"description": "mutation only: repository-relative path of the file the substitution edits.",
|
|
95
|
+
"type": "string",
|
|
96
|
+
"pattern": "\\S"
|
|
97
|
+
},
|
|
98
|
+
"find": {
|
|
99
|
+
"description": "mutation only: literal text that must occur in the file; every occurrence is replaced.",
|
|
100
|
+
"type": "string",
|
|
101
|
+
"pattern": "[\\s\\S]"
|
|
102
|
+
},
|
|
103
|
+
"replace": {
|
|
104
|
+
"description": "mutation only: the replacement text.",
|
|
105
|
+
"type": "string"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
interface PhaseDeclaration {
|
|
2
|
+
id: string;
|
|
3
|
+
branch: string;
|
|
4
|
+
filesToTouch: string[];
|
|
5
|
+
declaredExtras: string[];
|
|
6
|
+
citations: string[];
|
|
7
|
+
}
|
|
8
|
+
type MergeBaseResult = {
|
|
9
|
+
ok: true;
|
|
10
|
+
sha: string;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
reason: string;
|
|
14
|
+
};
|
|
15
|
+
declare function resolveMergeBase(cwd: string, base: string, head: string): MergeBaseResult;
|
|
16
|
+
type RefResolution = {
|
|
17
|
+
ok: true;
|
|
18
|
+
sha: string;
|
|
19
|
+
} | {
|
|
20
|
+
ok: false;
|
|
21
|
+
reason: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Resolve any ref-ish string (a sha, a branch, `HEAD`, `HEAD~1`, ...) to the
|
|
25
|
+
* commit sha it names, or a reason it could not be resolved as a commit.
|
|
26
|
+
* Fix round 1 (CR-1030/CR-1045, W3): used to compare the CALLER-SUPPLIED
|
|
27
|
+
* `--head` against the commit this process actually has checked out, so a
|
|
28
|
+
* `--head` set short of the real tip is caught rather than silently
|
|
29
|
+
* narrowing the diff.
|
|
30
|
+
*/
|
|
31
|
+
declare function resolveRef(cwd: string, ref: string): RefResolution;
|
|
32
|
+
type TrunkResolution = {
|
|
33
|
+
ok: true;
|
|
34
|
+
ref: string;
|
|
35
|
+
sha: string;
|
|
36
|
+
} | {
|
|
37
|
+
ok: false;
|
|
38
|
+
reason: string;
|
|
39
|
+
};
|
|
40
|
+
declare function resolveTrunk(cwd: string): TrunkResolution;
|
|
41
|
+
type AncestorCheck = {
|
|
42
|
+
ok: true;
|
|
43
|
+
isAncestor: boolean;
|
|
44
|
+
} | {
|
|
45
|
+
ok: false;
|
|
46
|
+
reason: string;
|
|
47
|
+
};
|
|
48
|
+
/** `git merge-base --is-ancestor`: exit 0 is yes, exit 1 is no, anything else is error. */
|
|
49
|
+
declare function isAncestorOf(cwd: string, ancestor: string, descendant: string): AncestorCheck;
|
|
50
|
+
interface TouchedPath {
|
|
51
|
+
path: string;
|
|
52
|
+
status: string;
|
|
53
|
+
}
|
|
54
|
+
type DiffResult = {
|
|
55
|
+
ok: true;
|
|
56
|
+
paths: TouchedPath[];
|
|
57
|
+
} | {
|
|
58
|
+
ok: false;
|
|
59
|
+
reason: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* `git diff --name-status <mergeBase> <head>`. Never `<base> <head>` and
|
|
63
|
+
* never against `main`'s tip: see the module comment on the anti-widening
|
|
64
|
+
* property. A rename or copy line (`R###` / `C###`) carries the old path
|
|
65
|
+
* and the new path tab-separated on one line; every other status carries
|
|
66
|
+
* exactly one path. Pinned against the captured shape in this phase's work
|
|
67
|
+
* history, not against a hand-written example (MECHANISMS.md, "Deciding
|
|
68
|
+
* what another program will do by pattern-matching the text of a file it
|
|
69
|
+
* consumes").
|
|
70
|
+
*/
|
|
71
|
+
declare function computeTouchedPaths(cwd: string, mergeBase: string, head: string): DiffResult;
|
|
72
|
+
/** Best-effort branch name for a red detail line; never load-bearing for logic. */
|
|
73
|
+
declare function currentBranch(cwd: string): string;
|
|
74
|
+
type DeclarationLoad = {
|
|
75
|
+
ok: true;
|
|
76
|
+
declaration: PhaseDeclaration;
|
|
77
|
+
sha256: string;
|
|
78
|
+
path: string;
|
|
79
|
+
} | {
|
|
80
|
+
ok: false;
|
|
81
|
+
kind: "missing";
|
|
82
|
+
path: string;
|
|
83
|
+
} | {
|
|
84
|
+
ok: false;
|
|
85
|
+
kind: "error";
|
|
86
|
+
reason: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Read `<declarationsDir>/<phase>.json` out of the MERGE BASE commit, never
|
|
90
|
+
* out of the working tree and never out of `--head`. This is the one
|
|
91
|
+
* function the anti-widening property depends on.
|
|
92
|
+
*/
|
|
93
|
+
declare function loadDeclarationAtMergeBase(cwd: string, mergeBase: string, declarationsDir: string, phase: string): DeclarationLoad;
|
|
94
|
+
/**
|
|
95
|
+
* The same object-database read at ANY commit (M3-P11 change B). The
|
|
96
|
+
* merge-base wrapper above keeps its name and its exported identity because
|
|
97
|
+
* the anti-widening property is a statement about THAT call, and a reader
|
|
98
|
+
* following the property should land on a function whose name says which
|
|
99
|
+
* side it reads.
|
|
100
|
+
*/
|
|
101
|
+
declare function loadDeclarationAtCommit(cwd: string, commit: string, declarationsDir: string, phase: string): DeclarationLoad;
|
|
102
|
+
/** A declared entry is a literal path, or (trailing slash) a directory prefix. */
|
|
103
|
+
declare function isAllowed(path: string, allowed: readonly string[]): boolean;
|
|
104
|
+
declare function isPhaseOwnEvidence(path: string, phase: string): boolean;
|
|
105
|
+
interface DeclarationDelta {
|
|
106
|
+
/** Entries present at the head and absent from the merge base. */
|
|
107
|
+
added: string[];
|
|
108
|
+
/** Entries present at the merge base and absent from the head. */
|
|
109
|
+
removed: string[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Compare the merge-base declaration with the head's, field by field.
|
|
113
|
+
*
|
|
114
|
+
* THE ASYMMETRY IS THE POINT (DR-0031,
|
|
115
|
+
* delivery/plan/m3-p11-phase-spec.md:156). Reading the declaration from the
|
|
116
|
+
* head alone would let a phase grant itself scope, which removes the only
|
|
117
|
+
* check on scope there is; reading it from the merge base alone means a
|
|
118
|
+
* declaration amendment can never ride with the phase that needs it, and
|
|
119
|
+
* three of one day's ten pull requests existed for nothing else. So an
|
|
120
|
+
* ADDITION is allowed and reported as a loud NAMED diff for a reviewer to
|
|
121
|
+
* sign off, and a REMOVAL stays hard.
|
|
122
|
+
*
|
|
123
|
+
* `id` and `branch` are compared as scalars and any difference is a
|
|
124
|
+
* REMOVAL, never an addition: they are the two fields the anti-widening
|
|
125
|
+
* cross-checks are anchored to, and a phase that renames its own anchor has
|
|
126
|
+
* changed which declaration governs it.
|
|
127
|
+
*/
|
|
128
|
+
declare function compareDeclarations(base: PhaseDeclaration, head: PhaseDeclaration): DeclarationDelta;
|
|
129
|
+
export declare function main(argv: string[]): number;
|
|
130
|
+
export { compareDeclarations, computeTouchedPaths, currentBranch, isAllowed, isAncestorOf, isPhaseOwnEvidence, loadDeclarationAtCommit, loadDeclarationAtMergeBase, resolveMergeBase, resolveRef, resolveTrunk, };
|
|
131
|
+
export type { DeclarationDelta, PhaseDeclaration, TouchedPath };
|