@pareto4/pp-core 1.17.1 → 1.18.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/.claude-plugin/plugin.json +1 -1
- package/README.md +5 -3
- package/agents/pp-code-fixer.md +0 -11
- package/agents/pp-code-reviewer.md +1 -78
- package/agents/pp-executor.md +9 -23
- package/agents/pp-planner.md +11 -11
- package/agents/pp-vault-reviewer.md +43 -189
- package/agents/pp-verifier.md +0 -6
- package/commands/pp-ns-manage.md +1 -1
- package/commands/pp-ns-review.md +1 -1
- package/commands/pp-vault-promote.md +7 -8
- package/commands/pp-vault-review.md +6 -7
- package/gemini-extension.json +1 -1
- package/package.json +3 -6
- package/pp-core/bin/lib/capability-registry.cjs +13 -355
- package/pp-core/bin/lib/capability-state.cjs +15 -79
- package/pp-core/bin/lib/capability-writer.cjs +2 -16
- package/pp-core/bin/lib/check-command-router.cjs +277 -2273
- package/pp-core/bin/lib/clusters.cjs +2 -2
- package/pp-core/bin/lib/compose-bindings.cjs +2 -2
- package/pp-core/bin/lib/config.cjs +3 -6
- package/pp-core/bin/lib/git-base-branch.cjs +10 -13
- package/pp-core/bin/lib/git-provider.cjs +5 -6
- package/pp-core/bin/lib/init-contract.cjs +7 -35
- package/pp-core/bin/lib/init-interactive.cjs +6 -20
- package/pp-core/bin/lib/io.cjs +2 -8
- package/pp-core/bin/lib/loop-resolver.cjs +8 -32
- package/pp-core/bin/lib/org-profile.cjs +16 -92
- package/pp-core/bin/lib/vault-command-router.cjs +174 -1206
- package/pp-core/bin/lib/vault-coordinates.cjs +3 -3
- package/pp-core/bin/lib/vault-index.cjs +27 -70
- package/pp-core/bin/lib/vault-seal.cjs +37 -122
- package/pp-core/bin/lib/vault-standards-promote.cjs +577 -0
- package/pp-core/bin/lib/vault-standards-review.cjs +293 -0
- package/pp-core/bin/lib/vault-standards.cjs +15 -16
- package/pp-core/bin/lib/vault-trace.cjs +40 -3016
- package/pp-core/bin/lib/vault-update.cjs +1 -26
- package/pp-core/bin/lib/vault.cjs +120 -314
- package/pp-core/bin/pp-tools.cjs +5 -32
- package/pp-core/references/autonomous-best-effort.md +1 -1
- package/pp-core/references/planner-vault-standards.md +16 -25
- package/pp-core/templates/README.md +1 -1
- package/pp-core/templates/VAULT-REVIEW.md +24 -170
- package/pp-core/workflows/add-tests.md +3 -3
- package/pp-core/workflows/audit-fix.md +3 -3
- package/pp-core/workflows/code-review-fix.md +3 -3
- package/pp-core/workflows/code-review.md +1 -57
- package/pp-core/workflows/debug.md +2 -2
- package/pp-core/workflows/discovery-sprint/prototype.md +2 -2
- package/pp-core/workflows/discovery-sprint/vault-context.md +4 -10
- package/pp-core/workflows/execute-phase/steps/check-query-gate.md +11 -13
- package/pp-core/workflows/execute-phase/steps/execute-pre-dispatch.md +5 -25
- package/pp-core/workflows/execute-phase/steps/vault-fetch.md +6 -6
- package/pp-core/workflows/execute-phase/steps/vault-load-gate.md +6 -109
- package/pp-core/workflows/execute-phase/steps/verify-post-gate.md +1 -17
- package/pp-core/workflows/execute-phase.md +2 -5
- package/pp-core/workflows/execute-plan.md +6 -8
- package/pp-core/workflows/help/modes/full.md +1 -1
- package/pp-core/workflows/quick.md +8 -8
- package/pp-core/workflows/validate-phase.md +3 -3
- package/pp-core/workflows/vault-review.md +64 -186
- package/pp-core/workflows/vault-write-back.md +73 -110
- package/pp-core/workflows/verify-work.md +1 -1
- package/scripts/gen-capability-registry.cjs +12 -93
- package/scripts/lint-test-file-count.allowlist.json +1 -19
- package/scripts/lint-test-file-count.cjs +5 -6
- package/scripts/prompt-injection-scan.sh +0 -3
- package/pp-core/bin/lib/practices-review-check.cjs +0 -944
- package/pp-core/bin/lib/vault-audit.cjs +0 -2594
- package/pp-core/bin/lib/vault-mode.cjs +0 -235
- package/pp-core/bin/lib/vault-practices.cjs +0 -2057
- package/pp-core/bin/lib/vault-review.cjs +0 -2102
- package/pp-core/bin/lib/vault-write-back.cjs +0 -905
- package/pp-core/references/planner-vault-practices.md +0 -95
- package/pp-core/references/practice-arithmetic-contract.md +0 -121
- package/pp-core/references/verifier-practice-verdicts.md +0 -263
- package/pp-core/templates/practices/README.md +0 -248
- package/pp-core/templates/practices/error-handling.md +0 -18
- package/pp-core/templates/practices/minimal-comments.md +0 -14
- package/pp-core/templates/practices/naming-convention.md +0 -18
- package/pp-core/templates/practices/practice-template.md +0 -23
- package/pp-core/workflows/execute-phase/steps/verifier-practice-payload.md +0 -165
- package/scripts/gen-practice-arithmetic-contract.cjs +0 -412
- package/scripts/practice-arithmetic-contract.allow.json +0 -35
- package/scripts/record-vault-mode-golden.cjs +0 -89
- package/scripts/vault-calibrate.cjs +0 -996
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* src/vault-mode.cts — the vault mode vocabulary (Vault Assurance v1.2,
|
|
4
|
-
* Phase 13-03, D-23).
|
|
5
|
-
*
|
|
6
|
-
* ADR-457 build-at-publish: this TypeScript file is the SOURCE OF TRUTH. It
|
|
7
|
-
* compiles to the git-ignored `pp-core/bin/lib/vault-mode.cjs`; do NOT
|
|
8
|
-
* hand-edit the compiled output. Behaviour is locked by
|
|
9
|
-
* `tests/vault-mode.test.cjs`.
|
|
10
|
-
*
|
|
11
|
-
* `vault.mode` selects which vault shape governs a project: `practices` (the
|
|
12
|
-
* v1.0/v1.1 practice-file matcher, check audit, review and write-back — the
|
|
13
|
-
* default, byte-identical to 1.15.1) or `standards` (prose standards documents
|
|
14
|
-
* indexed by the vault's INDEX.md). This module is the ONE owner of:
|
|
15
|
-
* - the config key name and the two literals,
|
|
16
|
-
* - the predicates every mode-aware surface uses,
|
|
17
|
-
* - the typed reason codes, and
|
|
18
|
-
* - every not-applicable / refusal text a parked surface prints.
|
|
19
|
-
* A surface that needs to say "not applicable in standards mode" quotes a
|
|
20
|
-
* function from here rather than spelling its own sentence, so the wording
|
|
21
|
-
* cannot drift between the CLI verb, the gate and the workflow that relays it.
|
|
22
|
-
*
|
|
23
|
-
* It does NOT resolve the mode. `resolveVaultMode` lives in
|
|
24
|
-
* `src/org-profile.cts` beside `resolveVaultRequired` (D-05) and reads the
|
|
25
|
-
* project config raw, then the org profile, then `DEFAULT_VAULT_MODE`.
|
|
26
|
-
*
|
|
27
|
-
* It imports NOTHING project-internal (no node builtins either). This is
|
|
28
|
-
* load-bearing: `src/org-profile.cts`, `src/vault.cts`,
|
|
29
|
-
* `src/vault-command-router.cts`, `src/check-command-router.cts` and
|
|
30
|
-
* `src/vault-write-back.cts` all require it, and a leaf with no dependencies
|
|
31
|
-
* cannot close a require cycle among them.
|
|
32
|
-
*
|
|
33
|
-
* Message discipline (T-13-03): no text here takes or echoes a configured
|
|
34
|
-
* value. An unrecognised mode is reported by naming the two allowed literals,
|
|
35
|
-
* never by reproducing what was found, so a hand-edited config cannot inject
|
|
36
|
-
* terminal escapes or agent-directed prose through the refusal.
|
|
37
|
-
*/
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.VAULT_MODE_REASON = exports.DEFAULT_VAULT_MODE = exports.VAULT_MODES = exports.VAULT_MODE_CONFIG_KEY = void 0;
|
|
40
|
-
exports.isVaultMode = isVaultMode;
|
|
41
|
-
exports.isStandardsMode = isStandardsMode;
|
|
42
|
-
exports.vaultModeInvalidMessage = vaultModeInvalidMessage;
|
|
43
|
-
exports.vaultModeUnresolvedMessage = vaultModeUnresolvedMessage;
|
|
44
|
-
exports.vaultModeRefusalMessage = vaultModeRefusalMessage;
|
|
45
|
-
exports.notApplicableMatchEnvelope = notApplicableMatchEnvelope;
|
|
46
|
-
exports.notApplicableGateEnvelope = notApplicableGateEnvelope;
|
|
47
|
-
exports.notApplicableReviewStatement = notApplicableReviewStatement;
|
|
48
|
-
exports.notApplicableStandardsVerbMessage = notApplicableStandardsVerbMessage;
|
|
49
|
-
exports.notApplicableStandardsVerbEnvelope = notApplicableStandardsVerbEnvelope;
|
|
50
|
-
exports.notApplicableTraceVerbMessage = notApplicableTraceVerbMessage;
|
|
51
|
-
exports.notApplicableTraceVerbEnvelope = notApplicableTraceVerbEnvelope;
|
|
52
|
-
exports.notApplicableManifestVerbMessage = notApplicableManifestVerbMessage;
|
|
53
|
-
exports.notApplicableManifestVerbEnvelope = notApplicableManifestVerbEnvelope;
|
|
54
|
-
exports.notApplicablePromoteMessage = notApplicablePromoteMessage;
|
|
55
|
-
// ─── Vocabulary ──────────────────────────────────────────────────────────────
|
|
56
|
-
/** The dotted config key. Every other file references it through this constant. */
|
|
57
|
-
exports.VAULT_MODE_CONFIG_KEY = 'vault.mode';
|
|
58
|
-
/** The two recognised modes, in declaration order (matches capability.json `values`). */
|
|
59
|
-
exports.VAULT_MODES = Object.freeze(['practices', 'standards']);
|
|
60
|
-
/** The registered default (capabilities/vault/capability.json `vault.mode.default`). */
|
|
61
|
-
exports.DEFAULT_VAULT_MODE = 'practices';
|
|
62
|
-
/**
|
|
63
|
-
* Machine-stable reason values. Frozen so a typo is a build error rather than
|
|
64
|
-
* a refusal that silently reports a different code. `INVALID` equals
|
|
65
|
-
* `ERROR_REASON.VAULT_MODE_INVALID` in `src/io.cts`; a test pins the equality
|
|
66
|
-
* (this leaf may not import io.cjs, so the two literals are kept apart by
|
|
67
|
-
* design and held together by that test).
|
|
68
|
-
*/
|
|
69
|
-
exports.VAULT_MODE_REASON = Object.freeze({
|
|
70
|
-
INVALID: 'vault_mode_invalid',
|
|
71
|
-
// 13-REVIEW WR-01: the resolver itself failed (a throw, not a bad value).
|
|
72
|
-
// Refused exactly like INVALID — never read as the default mode.
|
|
73
|
-
UNRESOLVED: 'vault_mode_unresolved',
|
|
74
|
-
NOT_APPLICABLE: 'vault_mode_not_applicable',
|
|
75
|
-
});
|
|
76
|
-
// ─── Predicates ──────────────────────────────────────────────────────────────
|
|
77
|
-
/**
|
|
78
|
-
* True only for a string whose trimmed form is one of the two literals.
|
|
79
|
-
* Case-sensitive: `Practices` is not a mode. Non-strings are never a mode.
|
|
80
|
-
*/
|
|
81
|
-
function isVaultMode(value) {
|
|
82
|
-
if (typeof value !== 'string')
|
|
83
|
-
return false;
|
|
84
|
-
const trimmed = value.trim();
|
|
85
|
-
return exports.VAULT_MODES.includes(trimmed);
|
|
86
|
-
}
|
|
87
|
-
/** True only for the resolved literal `standards`. */
|
|
88
|
-
function isStandardsMode(mode) {
|
|
89
|
-
return mode === 'standards';
|
|
90
|
-
}
|
|
91
|
-
// ─── Texts ───────────────────────────────────────────────────────────────────
|
|
92
|
-
//
|
|
93
|
-
// The not-applicable texts state only what is true in THIS build (13-REVIEW
|
|
94
|
-
// WR-03). Phase 13 could not name the standards record, which did not exist
|
|
95
|
-
// yet. Phase 15 built it: 15-07's `vault standards block` writes each plan's
|
|
96
|
-
// record and 15-08's standards trace gate validates it. So Phase 15 D-22
|
|
97
|
-
// rewords each parked text to point at that record and gate, and keeps the
|
|
98
|
-
// practices alternative (`config-set vault.mode practices`). The texts spell
|
|
99
|
-
// the record's tag and the SUMMARY heading as copies; tests/vault-mode.test.cjs
|
|
100
|
-
// holds both copies to the vault-standards leaf, which owns them, and checks
|
|
101
|
-
// that every gate point a text names declares a standards trace gate.
|
|
102
|
-
/**
|
|
103
|
-
* The refusal for an unrecognised `vault.mode`. Names both allowed values and
|
|
104
|
-
* where to correct the setting; never takes or echoes the offending value.
|
|
105
|
-
*
|
|
106
|
-
* Names ONLY the places this refusal can come from (13-REVIEW WR-02): a
|
|
107
|
-
* PROJECT value — `resolveVaultMode` level 1 reads the active workstream's
|
|
108
|
-
* config.json and then the root `.planning/config.json`. An invalid org-profile
|
|
109
|
-
* value never reaches here: it is dropped with a warning (D-09) and the mode
|
|
110
|
-
* falls back to the default. The remedy is `config-set`, which writes the
|
|
111
|
-
* planning dir's config — the workstream's when one is active — and so
|
|
112
|
-
* outranks a bad value in either file.
|
|
113
|
-
*/
|
|
114
|
-
function vaultModeInvalidMessage() {
|
|
115
|
-
return ('vault.mode is set to a value this engine does not recognise. ' +
|
|
116
|
-
'Allowed values: practices, standards. ' +
|
|
117
|
-
"The value is in the project configuration: .planning/config.json, or the active workstream's " +
|
|
118
|
-
'config.json on a workstream-partitioned project. ' +
|
|
119
|
-
'Set it with `pp-tools config-set vault.mode practices` (or `standards`) and run the command again.');
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* The refusal when `vault.mode` could not be resolved at all (13-REVIEW WR-01):
|
|
123
|
-
* the resolver threw. It is refused exactly like an unrecognised value (D-08)
|
|
124
|
-
* — the engine does not know which mode governs the project, so it assumes
|
|
125
|
-
* neither. Carries no error text: a message could hold a path or a value.
|
|
126
|
-
*/
|
|
127
|
-
function vaultModeUnresolvedMessage() {
|
|
128
|
-
return ('vault.mode could not be resolved: reading the project configuration or the org profile failed. ' +
|
|
129
|
-
'The vault commands and gates refuse rather than assume a mode. ' +
|
|
130
|
-
'Check that the project configuration and the org profile can be read, then run the command again.');
|
|
131
|
-
}
|
|
132
|
-
/** The refusal text for a `vaultModeVerdict` `ok: false` reason — the ONE chooser every refusing surface asks. */
|
|
133
|
-
function vaultModeRefusalMessage(reason) {
|
|
134
|
-
return reason === exports.VAULT_MODE_REASON.UNRESOLVED ? vaultModeUnresolvedMessage() : vaultModeInvalidMessage();
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Phase 15 D-22: names the standards record (each plan's block) and the verb
|
|
138
|
-
* that writes it, in place of Phase 13's interim "not yet recorded" clause.
|
|
139
|
-
*/
|
|
140
|
-
function notApplicableMatchEnvelope() {
|
|
141
|
-
return {
|
|
142
|
-
status: 'not_applicable',
|
|
143
|
-
mode: 'standards',
|
|
144
|
-
message: 'vault practices match is not applicable in standards mode (vault.mode = standards): ' +
|
|
145
|
-
'the client vault carries standards documents, not practice files, so no practice is matched; ' +
|
|
146
|
-
"the standards record is each plan's `<vault_standards>` block (`vault standards block`). " +
|
|
147
|
-
'To match practice files instead, run `pp-tools config-set vault.mode practices`.',
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Phase 15 D-22: names the gate that checks the standards record. Both
|
|
152
|
-
* surfaces render only at verify:post and ship:pre, where the vault
|
|
153
|
-
* capability also declares the standards trace gate (a test reads the
|
|
154
|
-
* declarations), so the points this text names are points the gate runs at.
|
|
155
|
-
*/
|
|
156
|
-
function notApplicableGateEnvelope(surface) {
|
|
157
|
-
return {
|
|
158
|
-
status: 'not_applicable',
|
|
159
|
-
block: false,
|
|
160
|
-
mode: 'standards',
|
|
161
|
-
message: `${surface} is not applicable in standards mode (vault.mode = standards): ` +
|
|
162
|
-
'there is no practice layer to audit; ' +
|
|
163
|
-
"the standards `check vault.trace` gate validates each plan's `<vault_standards>` block at verify:post and ship:pre. " +
|
|
164
|
-
'To use the practices checks instead, run `pp-tools config-set vault.mode practices`.',
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* The standards-mode statement of `check vault-review` (D-14). Phase 15 D-22:
|
|
169
|
-
* names where standards mode records the consulted documents.
|
|
170
|
-
*/
|
|
171
|
-
function notApplicableReviewStatement() {
|
|
172
|
-
return ('Vault review: not applicable in standards mode (vault.mode = standards). ' +
|
|
173
|
-
'No practice was reviewed and no review payload was produced; ' +
|
|
174
|
-
"standards mode records the consulted documents in each plan's `<vault_standards>` block " +
|
|
175
|
-
"and its SUMMARY's `## Standards Consulted` section. " +
|
|
176
|
-
'To review practices instead, run `pp-tools config-set vault.mode practices`.');
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* The practices-mode answer of `vault standards block|consulted` (15-07). The
|
|
180
|
-
* mirror image of the not-applicable texts above: the standards record verbs
|
|
181
|
-
* have nothing to record while the project runs the practices layer. One line,
|
|
182
|
-
* names the mode the project is in and the way to switch.
|
|
183
|
-
*/
|
|
184
|
-
function notApplicableStandardsVerbMessage() {
|
|
185
|
-
return ('vault standards is not applicable in practices mode (vault.mode = practices): ' +
|
|
186
|
-
'the practices trace records which practice files applied; ' +
|
|
187
|
-
'in standards mode `vault standards block` and `vault standards consulted` record the consulted documents. ' +
|
|
188
|
-
'To record standards documents instead, run `pp-tools config-set vault.mode standards`.');
|
|
189
|
-
}
|
|
190
|
-
function notApplicableStandardsVerbEnvelope() {
|
|
191
|
-
return { status: 'not_applicable', mode: 'practices', message: notApplicableStandardsVerbMessage() };
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Quick 261015-ect (QD-15): the standards-mode answer of `vault trace
|
|
195
|
-
* scaffold|render`. The practices trace ledger is parked beside `vault
|
|
196
|
-
* practices match` (PARK-01): a standards-mode plan carries no practices
|
|
197
|
-
* ledger, so none is produced. Fixed text; nothing is interpolated.
|
|
198
|
-
*/
|
|
199
|
-
function notApplicableTraceVerbMessage() {
|
|
200
|
-
return ('vault trace is not applicable in standards mode (vault.mode = standards): ' +
|
|
201
|
-
'the practices trace ledger records practice files, and the client vault carries standards documents; ' +
|
|
202
|
-
"the standards record is each plan's `<vault_standards>` block (`vault standards block`) " +
|
|
203
|
-
"and the SUMMARY's Standards Consulted section (`vault standards consulted`). " +
|
|
204
|
-
'To write practices ledgers instead, run `pp-tools config-set vault.mode practices`.');
|
|
205
|
-
}
|
|
206
|
-
function notApplicableTraceVerbEnvelope() {
|
|
207
|
-
return { status: 'not_applicable', mode: 'standards', message: notApplicableTraceVerbMessage() };
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Quick 261015-ect (QD-15): the standards-mode answer of `vault manifest
|
|
211
|
-
* start|record`. The range the manifest anchors is read by `vault audit` and
|
|
212
|
-
* `check vault.review` (both parked, PARK-02/PARK-04) and by `/pp-undo
|
|
213
|
-
* --phase`, which falls back to its git-log search without it.
|
|
214
|
-
*/
|
|
215
|
-
function notApplicableManifestVerbMessage() {
|
|
216
|
-
return ('vault manifest is not applicable in standards mode (vault.mode = standards): ' +
|
|
217
|
-
'the phase range it anchors is read by `vault audit` and `check vault.review`, which answer not-applicable in this mode, ' +
|
|
218
|
-
'and by `/pp-undo --phase`, which falls back to its git-log search without it; nothing was written. ' +
|
|
219
|
-
'To use the practices checks instead, run `pp-tools config-set vault.mode practices`.');
|
|
220
|
-
}
|
|
221
|
-
function notApplicableManifestVerbEnvelope() {
|
|
222
|
-
return {
|
|
223
|
-
ok: false,
|
|
224
|
-
reason: exports.VAULT_MODE_REASON.NOT_APPLICABLE,
|
|
225
|
-
status: 'not_applicable',
|
|
226
|
-
mode: 'standards',
|
|
227
|
-
message: notApplicableManifestVerbMessage(),
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
/** The standards-mode refusal of `vault practices promote` (D-14). */
|
|
231
|
-
function notApplicablePromoteMessage() {
|
|
232
|
-
return ('This practice was not promoted: vault write-back is not applicable in standards mode ' +
|
|
233
|
-
'(vault.mode = standards). ' +
|
|
234
|
-
'Standards documents are maintained in the vault repo through its INDEX.md by the vault owner.');
|
|
235
|
-
}
|