@pareto4/pp-core 1.13.0 → 1.17.1
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 +3 -3
- package/README.md +26 -9
- package/agents/pp-code-reviewer.md +2 -1
- package/agents/pp-debug-session-manager.md +9 -6
- package/agents/pp-executor.md +10 -13
- package/agents/pp-plan-checker.md +4 -4
- package/agents/pp-planner.md +23 -9
- package/agents/pp-vault-reviewer.md +244 -21
- package/agents/pp-verifier.md +7 -3
- package/bin/install.js +10 -3
- package/commands/pp-execute-phase.md +1 -3
- package/commands/pp-ns-review.md +1 -1
- package/commands/pp-plan-phase.md +1 -2
- package/commands/pp-vault-review.md +5 -3
- package/commands/pp-verify-work.md +1 -2
- package/gemini-extension.json +1 -1
- package/hooks/dist/pp-check-update.js +0 -0
- package/hooks/dist/pp-cursor-session-start.js +1 -1
- package/hooks/dist/pp-statusline.js +1 -1
- package/hooks/dist/pp-update-banner.js +0 -0
- package/hooks/pp-check-update.js +0 -0
- package/hooks/pp-cursor-session-start.js +1 -1
- package/hooks/pp-statusline.js +1 -1
- package/hooks/pp-update-banner.js +0 -0
- package/package.json +14 -19
- package/pareto-skills/_shared/create-project-board.sh +0 -0
- package/pareto-skills/pp-project-setup/SKILL.md +1 -1
- package/pp-core/bin/check-latest-version.cjs +0 -0
- package/pp-core/bin/detect-build-commands.sh +2 -2
- package/pp-core/bin/lib/capability-activation.cjs +83 -9
- package/pp-core/bin/lib/capability-registry.cjs +396 -82
- package/pp-core/bin/lib/capability-state.cjs +160 -4
- package/pp-core/bin/lib/capability-writer.cjs +19 -5
- package/pp-core/bin/lib/check-command-router.cjs +3334 -946
- package/pp-core/bin/lib/clusters.cjs +3 -0
- package/pp-core/bin/lib/command-aliases.cjs +0 -35
- package/pp-core/bin/lib/commands.cjs +9 -4
- package/pp-core/bin/lib/compose-bindings.cjs +251 -88
- package/pp-core/bin/lib/config-loader.cjs +7 -103
- package/pp-core/bin/lib/config-schema.cjs +1 -1
- package/pp-core/bin/lib/config.cjs +154 -62
- package/pp-core/bin/lib/decisions.cjs +4 -4
- package/pp-core/bin/lib/discovery-vault-check.cjs +246 -0
- package/pp-core/bin/lib/frontmatter.cjs +1 -38
- package/pp-core/bin/lib/git-base-branch.cjs +13 -11
- package/pp-core/bin/lib/git-provider.cjs +4 -4
- package/pp-core/bin/lib/init-command-router.cjs +5 -8
- package/pp-core/bin/lib/init-contract.cjs +648 -738
- package/pp-core/bin/lib/init-interactive.cjs +76 -4
- package/pp-core/bin/lib/init.cjs +24 -51
- package/pp-core/bin/lib/install-profiles.cjs +1 -1
- package/pp-core/bin/lib/io.cjs +8 -0
- package/pp-core/bin/lib/loop-resolver.cjs +189 -129
- package/pp-core/bin/lib/org-profile.cjs +469 -152
- package/pp-core/bin/lib/package-identity.cjs +3 -3
- package/pp-core/bin/lib/phase-command-router.cjs +1 -29
- package/pp-core/bin/lib/phase-scope.cjs +1 -1
- package/pp-core/bin/lib/phase.cjs +11 -253
- package/pp-core/bin/lib/platform-bindings.cjs +40 -19
- package/pp-core/bin/lib/practices-review-check.cjs +15 -9
- package/pp-core/bin/lib/profile-output.cjs +1 -1
- package/pp-core/bin/lib/shell-command-projection.cjs +104 -1
- package/pp-core/bin/lib/state.cjs +11 -85
- package/pp-core/bin/lib/template.cjs +1 -1
- package/pp-core/bin/lib/vault-audit.cjs +650 -126
- package/pp-core/bin/lib/vault-command-router.cjs +2604 -367
- package/pp-core/bin/lib/vault-coordinates.cjs +13 -4
- package/pp-core/bin/lib/vault-index.cjs +699 -0
- package/pp-core/bin/lib/vault-mode.cjs +235 -0
- package/pp-core/bin/lib/vault-practices.cjs +139 -72
- package/pp-core/bin/lib/vault-review.cjs +194 -451
- package/pp-core/bin/lib/vault-seal.cjs +1936 -0
- package/pp-core/bin/lib/vault-standards.cjs +1505 -0
- package/pp-core/bin/lib/vault-trace.cjs +607 -254
- package/pp-core/bin/lib/vault-update.cjs +9 -33
- package/pp-core/bin/lib/vault-write-back.cjs +70 -42
- package/pp-core/bin/lib/vault.cjs +2734 -920
- package/pp-core/bin/lib/verify.cjs +0 -11
- package/pp-core/bin/portable-timeout.sh +1 -1
- package/pp-core/bin/pp-tools.cjs +184 -54
- package/pp-core/bin/shared/config-defaults.manifest.json +0 -7
- package/pp-core/bin/shared/config-schema.manifest.json +0 -3
- package/pp-core/bin/shared/model-catalog.json +2 -2
- package/pp-core/bin/verify-reapply-patches.cjs +0 -0
- package/pp-core/org-profile.json +26 -0
- package/pp-core/references/autonomous-best-effort.md +8 -7
- package/pp-core/references/loop-hook-dispatch.md +0 -25
- package/pp-core/references/planner-gap-closure.md +0 -1
- package/pp-core/references/planner-tdd.md +0 -1
- package/pp-core/references/planner-vault-practices.md +17 -34
- package/pp-core/references/planner-vault-standards.md +320 -0
- package/pp-core/references/planning-config.md +0 -8
- package/pp-core/references/practice-arithmetic-contract.md +121 -0
- package/pp-core/references/tdd.md +0 -1
- package/pp-core/references/verifier-practice-verdicts.md +263 -0
- package/pp-core/templates/README.md +1 -0
- package/pp-core/templates/VAULT-REVIEW.md +202 -0
- package/pp-core/templates/phase-prompt.md +2 -6
- package/pp-core/templates/practices/README.md +20 -23
- package/pp-core/workflows/_runtime-launcher.snippet.sh +0 -0
- package/pp-core/workflows/add-tests.md +55 -4
- package/pp-core/workflows/audit-fix.md +63 -2
- package/pp-core/workflows/audit-milestone.md +1 -1
- package/pp-core/workflows/autonomous.md +85 -11
- package/pp-core/workflows/check-todos.md +13 -2
- package/pp-core/workflows/code-review-fix.md +59 -3
- package/pp-core/workflows/code-review.md +10 -1
- package/pp-core/workflows/complete-milestone.md +1 -1
- package/pp-core/workflows/debug.md +54 -4
- package/pp-core/workflows/discovery-sprint/prefill.md +19 -7
- package/pp-core/workflows/discovery-sprint/prototype.md +46 -49
- package/pp-core/workflows/discovery-sprint/session-13-gates.md +2 -0
- package/pp-core/workflows/discovery-sprint/sessions/01-kick-off.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/02-as-is.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/03-to-be.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/04-ux-design.md +20 -24
- package/pp-core/workflows/discovery-sprint/sessions/05-architecture.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/06-security.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/07-identity.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/08-integration.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/09-qa.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/10-infrastructure.md +1 -6
- package/pp-core/workflows/discovery-sprint/sessions/11-roadmap.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/12-delivery-model.md +1 -3
- package/pp-core/workflows/discovery-sprint/sessions/13-wrap-up.md +1 -3
- package/pp-core/workflows/discovery-sprint/templates/context-template.md +1 -1
- package/pp-core/workflows/discovery-sprint/vault-context.md +213 -0
- package/pp-core/workflows/discovery-sprint.md +7 -3
- package/pp-core/workflows/discovery-to-build/steps/architecture-deliverables.md +4 -4
- package/pp-core/workflows/discovery-to-build/templates/pp-handoff.md +43 -1
- package/pp-core/workflows/discovery-to-build.md +10 -2
- package/pp-core/workflows/discuss-phase.md +3 -10
- package/pp-core/workflows/execute-phase/steps/check-query-gate.md +329 -0
- package/pp-core/workflows/execute-phase/steps/client-context-gate.md +3 -2
- package/pp-core/workflows/execute-phase/steps/cross-ai-delegation.md +1 -1
- package/pp-core/workflows/execute-phase/steps/execute-pre-dispatch.md +98 -0
- package/pp-core/workflows/execute-phase/steps/per-plan-worktree-gate.md +94 -0
- package/pp-core/workflows/execute-phase/steps/post-merge-gate.md +6 -8
- package/pp-core/workflows/execute-phase/steps/vault-fetch.md +115 -14
- package/pp-core/workflows/execute-phase/steps/vault-load-gate.md +322 -20
- package/pp-core/workflows/execute-phase/steps/verifier-practice-payload.md +165 -0
- package/pp-core/workflows/execute-phase/steps/verify-post-gate.md +163 -0
- package/pp-core/workflows/execute-phase.md +155 -128
- package/pp-core/workflows/execute-plan.md +56 -6
- package/pp-core/workflows/fast.md +53 -4
- package/pp-core/workflows/help/modes/full.md +3 -3
- package/pp-core/workflows/init/steps/client-context-capture.md +101 -0
- package/pp-core/workflows/init/steps/gitlab-provisioning.md +130 -0
- package/pp-core/workflows/init/steps/project-md-deferral-narration.md +66 -0
- package/pp-core/workflows/init/steps/reachability-outcome.md +70 -0
- package/pp-core/workflows/init.md +232 -272
- package/pp-core/workflows/new-project.md +31 -23
- package/pp-core/workflows/plan-phase.md +98 -45
- package/pp-core/workflows/quick.md +117 -3
- package/pp-core/workflows/secure-phase.md +1 -1
- package/pp-core/workflows/ship.md +57 -28
- package/pp-core/workflows/undo.md +1 -1
- package/pp-core/workflows/update.md +3 -3
- package/pp-core/workflows/validate-phase.md +58 -3
- package/pp-core/workflows/vault-review.md +282 -22
- package/pp-core/workflows/verify-work.md +12 -14
- package/scripts/changeset/cli.cjs +6 -5
- package/scripts/changeset/lint.cjs +0 -0
- package/scripts/changeset/new.cjs +33 -50
- package/scripts/dev-env.cjs +25 -85
- package/scripts/gen-capability-registry.cjs +199 -11
- package/scripts/gen-practice-arithmetic-contract.cjs +412 -0
- package/scripts/lib/allowlist-ratchet.cjs +1 -103
- package/scripts/lint-allow-test-rule-refs.allowlist.json +0 -2
- package/scripts/lint-docs-required.cjs +0 -0
- package/scripts/lint-pr-check-project-dir.cjs +1 -3
- package/scripts/lint-test-file-count.allowlist.json +12 -10
- package/scripts/practice-arithmetic-contract.allow.json +35 -0
- package/scripts/prompt-injection-scan.sh +22 -17
- package/scripts/record-vault-mode-golden.cjs +89 -0
- package/scripts/release-channel.cjs +0 -0
- package/scripts/sync-manifest-versions.cjs +5 -4
- package/scripts/sync-rulesets.sh +1 -1
- package/scripts/update-size-baseline.cjs +30 -274
- package/scripts/vault-calibrate.cjs +996 -0
- package/scripts/verify-opengsd-sweep.cjs +3 -5
- package/scripts/workflow-size.cjs +9 -61
- package/pp-core/bin/lib/dispatch-plan.cjs +0 -483
- package/pp-core/bin/lib/install-run.cjs +0 -536
- package/pp-core/bin/lib/loop-gates.cjs +0 -213
- package/pp-core/bin/lib/phase-manifest.cjs +0 -527
- package/pp-core/bin/lib/phase-tier.cjs +0 -480
- package/pp-core/bin/lib/plan-graph.cjs +0 -368
- package/pp-core/references/executor-vault-trace.md +0 -47
- package/pp-core/references/planner-plan-graph.md +0 -66
- package/pp-core/workflows/discovery-sprint/vault-fetch.md +0 -37
- package/pp-core/workflows/execute-phase/steps/checkpoint-handling.md +0 -45
- package/pp-core/workflows/execute-phase/steps/install-run.md +0 -29
- package/pp-core/workflows/execute-phase/steps/phase-close-rebaseline.md +0 -23
- package/pp-core/workflows/execute-phase/steps/serial-group-dispatch.md +0 -73
- package/pp-core/workflows/execute-phase/steps/vault-door-gate.md +0 -19
- package/pp-core/workflows/plan-phase/steps/phase-tier.md +0 -43
- package/scripts/lib/size-budget.cjs +0 -311
- package/scripts/lint-neutrality-names.cjs +0 -694
- package/scripts/lint-org-coordinates.allowlist.json +0 -35
- package/scripts/lint-org-coordinates.cjs +0 -426
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pareto4/pp-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.1",
|
|
4
4
|
"description": "Pareto pp-core — The Pareto Project's AI-assisted engineering framework: meta-prompting, context engineering, and spec-driven development for AI coding agents.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pp-core": "bin/install.js",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
|
41
|
-
"url": "git+https://
|
|
41
|
+
"url": "git+https://github.com/pareto000/pp-core.git"
|
|
42
42
|
},
|
|
43
|
-
"homepage": "https://
|
|
43
|
+
"homepage": "https://github.com/pareto000/pp-core",
|
|
44
44
|
"bugs": {
|
|
45
|
-
"url": "https://
|
|
45
|
+
"url": "https://github.com/pareto000/pp-core/issues"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"npm": ">=10.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@anthropic-ai/claude-agent-sdk": "^0.3.
|
|
55
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.251",
|
|
56
56
|
"ws": "^8.21.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
@@ -65,22 +65,13 @@
|
|
|
65
65
|
"eslint-plugin-no-only-tests": "^3.4.0",
|
|
66
66
|
"fast-check": "^4.8.0",
|
|
67
67
|
"globals": "^16.5.0",
|
|
68
|
-
"js-yaml": "^4.
|
|
68
|
+
"js-yaml": "^4.2.0",
|
|
69
69
|
"typescript": "^6.0.3",
|
|
70
70
|
"typescript-eslint": "^8.60.0"
|
|
71
71
|
},
|
|
72
72
|
"overrides": {
|
|
73
73
|
"qs": ">=6.16.0",
|
|
74
|
-
"@hono/node-server": ">=2.0.5"
|
|
75
|
-
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
76
|
-
"fast-uri": "^3.1.8",
|
|
77
|
-
"hono": "^4.13.7",
|
|
78
|
-
"ip-address": "^10.7.1",
|
|
79
|
-
"proxy-addr": "^2.0.8",
|
|
80
|
-
"brace-expansion@^1.1.0": "^1.1.21",
|
|
81
|
-
"brace-expansion@^5.0.0": "^5.0.12",
|
|
82
|
-
"browserslist": "^4.28.7",
|
|
83
|
-
"baseline-browser-mapping": "^2.11.0"
|
|
74
|
+
"@hono/node-server": ">=2.0.5"
|
|
84
75
|
},
|
|
85
76
|
"optionalDependencies": {
|
|
86
77
|
"fallow": "^2.70.0"
|
|
@@ -88,7 +79,7 @@
|
|
|
88
79
|
"scripts": {
|
|
89
80
|
"sync:launcher": "node scripts/sync-runtime-launcher.cjs",
|
|
90
81
|
"check:env": "node scripts/check-env.cjs",
|
|
91
|
-
"setup": "node scripts/dev-env.cjs
|
|
82
|
+
"setup": "node scripts/dev-env.cjs setup",
|
|
92
83
|
"dev:setup": "node scripts/dev-env.cjs dev-setup",
|
|
93
84
|
"dev:install": "node scripts/dev-env.cjs install",
|
|
94
85
|
"dev:claude": "node scripts/dev-env.cjs claude",
|
|
@@ -103,6 +94,7 @@
|
|
|
103
94
|
"gen:capability-registry": "node scripts/gen-capability-registry.cjs --write",
|
|
104
95
|
"gen:platform-bindings-schema": "node scripts/gen-platform-bindings-schema.cjs --write",
|
|
105
96
|
"check:platform-bindings-schema": "node scripts/gen-platform-bindings-schema.cjs --check",
|
|
97
|
+
"check:inventory-manifest": "node scripts/gen-inventory-manifest.cjs --check",
|
|
106
98
|
"gen:commands-reference": "node scripts/gen-commands-reference.cjs --write",
|
|
107
99
|
"prepack": "npm run build:lib",
|
|
108
100
|
"prepare": "npm run build:lib",
|
|
@@ -112,7 +104,7 @@
|
|
|
112
104
|
"pretest:coverage": "npm run build:lib && npm run lint:skill-deps",
|
|
113
105
|
"lint": "eslint . --cache --cache-location node_modules/.cache/eslint/",
|
|
114
106
|
"lint:fix": "eslint . --fix",
|
|
115
|
-
"lint:ci": "npm run lint && npm run lint:skill-deps && node scripts/lint-test-file-count.cjs && node scripts/lint-command-contract.cjs && node scripts/lint-pr-check-project-dir.cjs && npm run lint:legacy-name && node scripts/lint-regression-test-names.cjs && node scripts/lint-windows-test-portability.cjs && node scripts/lint-allow-test-rule-refs.cjs && npm run check:platform-bindings-schema &&
|
|
107
|
+
"lint:ci": "npm run lint && npm run lint:skill-deps && node scripts/lint-test-file-count.cjs && node scripts/lint-command-contract.cjs && node scripts/lint-pr-check-project-dir.cjs && npm run lint:legacy-name && node scripts/lint-regression-test-names.cjs && node scripts/lint-windows-test-portability.cjs && node scripts/lint-allow-test-rule-refs.cjs && npm run check:platform-bindings-schema && npm run check:practice-arithmetic-contract && npm run check:inventory-manifest && npm run rename-guard",
|
|
116
108
|
"lint:allow-test-rule-refs": "node scripts/lint-allow-test-rule-refs.cjs",
|
|
117
109
|
"lint:windows-test-portability": "node scripts/lint-windows-test-portability.cjs",
|
|
118
110
|
"lint:regression-names": "node scripts/lint-regression-test-names.cjs",
|
|
@@ -127,6 +119,7 @@
|
|
|
127
119
|
"rename-guard:baseline": "node scripts/verify-rename-guard.cjs --update-baseline",
|
|
128
120
|
"ci:test-scope": "node scripts/ci-test-scope.cjs",
|
|
129
121
|
"size:baseline": "node scripts/update-size-baseline.cjs",
|
|
122
|
+
"vault:calibrate": "node scripts/vault-calibrate.cjs",
|
|
130
123
|
"changeset": "node scripts/changeset/new.cjs",
|
|
131
124
|
"changelog:render": "node scripts/changeset/cli.cjs render",
|
|
132
125
|
"test": "node scripts/run-tests.cjs",
|
|
@@ -141,6 +134,8 @@
|
|
|
141
134
|
"test:coverage:unit": "c8 --check-coverage --lines 70 --branches 60 --reporter text --include 'pp-core/bin/lib/*.cjs' --exclude 'tests/**' --all node scripts/run-tests.cjs --suite unit && c8 check-coverage --per-file --lines 0 --functions 0 --statements 0 --branches 70 --include 'pp-core/bin/lib/state.cjs' --include 'pp-core/bin/lib/phase.cjs' --include 'pp-core/bin/lib/verify.cjs' --include 'pp-core/bin/lib/init.cjs' --exclude 'tests/**'",
|
|
142
135
|
"test:coverage:all": "npm run test:coverage",
|
|
143
136
|
"test:mutation": "stryker run",
|
|
144
|
-
"test:mutation:since": "stryker run --incremental --since origin/next"
|
|
137
|
+
"test:mutation:since": "stryker run --incremental --since origin/next",
|
|
138
|
+
"gen:practice-arithmetic-contract": "node scripts/gen-practice-arithmetic-contract.cjs --write",
|
|
139
|
+
"check:practice-arithmetic-contract": "node scripts/gen-practice-arithmetic-contract.cjs --check"
|
|
145
140
|
}
|
|
146
141
|
}
|
|
File without changes
|
|
@@ -159,7 +159,7 @@ mkdir -p \
|
|
|
159
159
|
.obsidian
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
Discovery Sprint artifacts are not scaffolded here — `/pp-discovery` creates `.planning/discovery/` itself on first run (session files, `_progress.md`, `_context.md`). The interactive prototype is built by `/pp-discovery prototype` into `.planning/discovery/prototype/`, on the UI kit the client vault declares
|
|
162
|
+
Discovery Sprint artifacts are not scaffolded here — `/pp-discovery` creates `.planning/discovery/` itself on first run (session files, `_progress.md`, `_context.md`). The interactive prototype is built by `/pp-discovery prototype` into `.planning/discovery/prototype/`, on the UI kit the client vault declares.
|
|
163
163
|
|
|
164
164
|
#### 4c. Scaffold Project Definition & Requirements Templates
|
|
165
165
|
|
|
File without changes
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
# the test ladder, after the Python arm in the build ladder, matching where
|
|
48
48
|
# package.json already sat in each. The relative order of every pre-existing
|
|
49
49
|
# arm is unchanged. That placement is load-bearing and is proven by an executed
|
|
50
|
-
# mutation rung in tests/gate-shell-owners.test.cjs
|
|
50
|
+
# mutation rung in tests/feat-73988-gate-shell-owners.test.cjs
|
|
51
51
|
# ("PLACEMENT RUNG"), which swaps the two arms in a scratch copy and asserts
|
|
52
52
|
# the shadowing reappears.
|
|
53
53
|
#
|
|
@@ -86,7 +86,7 @@ _pp_emit() { printf '%s\n' "$1"; }
|
|
|
86
86
|
# -maxdepth 2 probe covers ./App.csproj and ./App/App.csproj but misses the
|
|
87
87
|
# canonical one entirely, which would silently hand a .NET repository back to
|
|
88
88
|
# the package.json arm. All three layouts are pinned as a matrix in
|
|
89
|
-
# tests/gate-shell-owners.test.cjs.
|
|
89
|
+
# tests/feat-73988-gate-shell-owners.test.cjs.
|
|
90
90
|
#
|
|
91
91
|
# The solution probe stays at depth 1: a .sln nested deeper falls through to
|
|
92
92
|
# the project probe, which still yields a correct `dotnet test`, whereas a
|
|
@@ -13,11 +13,19 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
13
13
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
14
14
|
const planningWorkspaceMod = require("./planning-workspace.cjs");
|
|
15
15
|
const { planningDir, planningRoot } = planningWorkspaceMod;
|
|
16
|
+
/**
|
|
17
|
+
* Segments that must never be walked or matched, on either key form.
|
|
18
|
+
* Extracted so the nested walk and the flat fallback cannot drift into
|
|
19
|
+
* disagreeing about what a pollution attempt looks like.
|
|
20
|
+
*/
|
|
21
|
+
function _isRejectedKeySegment(seg) {
|
|
22
|
+
return seg === '__proto__' || seg === 'constructor' || seg === 'prototype';
|
|
23
|
+
}
|
|
16
24
|
function _getNestedConfigValue(config, dotKey) {
|
|
17
25
|
const segments = dotKey.split('.');
|
|
18
26
|
let current = config;
|
|
19
27
|
for (const seg of segments) {
|
|
20
|
-
if (seg
|
|
28
|
+
if (_isRejectedKeySegment(seg)) {
|
|
21
29
|
return { found: false, value: undefined };
|
|
22
30
|
}
|
|
23
31
|
if (typeof current !== 'object' || current === null) {
|
|
@@ -31,6 +39,65 @@ function _getNestedConfigValue(config, dotKey) {
|
|
|
31
39
|
}
|
|
32
40
|
return { found: true, value: current };
|
|
33
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* GATE-05: look the WHOLE dotted string up as a single own property.
|
|
44
|
+
*
|
|
45
|
+
* An operator hand-pasting a gate key into a config.json they did not write
|
|
46
|
+
* writes `{"vault.required": true}` at least as often as the three-line nested
|
|
47
|
+
* form. Before this existed, that flat shape resolved nowhere — the nested walk
|
|
48
|
+
* looked up `config['vault']`, found nothing, and the key silently fell through
|
|
49
|
+
* to its default. For an enforcement gate that is a fail-open with no error
|
|
50
|
+
* message, which is exactly the failure GATE-05 exists to close.
|
|
51
|
+
*
|
|
52
|
+
* Performs NO traversal: one own-property check on a string already in hand.
|
|
53
|
+
* The rejected-segment guard is applied to every segment of the dotted string
|
|
54
|
+
* anyway (T-02-13) so the flat path can never become the bypass the nested
|
|
55
|
+
* path already closes, and `hasOwnProperty` is required (T-02-14) so an
|
|
56
|
+
* inherited property is never mistaken for configuration.
|
|
57
|
+
*
|
|
58
|
+
* A flat own property valued `undefined` is reported NOT-found on purpose: it
|
|
59
|
+
* cannot come from JSON, and treating it as configured would let a
|
|
60
|
+
* programmatically built object shadow the schema default with nothing.
|
|
61
|
+
*/
|
|
62
|
+
function _getFlatConfigValue(config, dotKey) {
|
|
63
|
+
for (const seg of dotKey.split('.')) {
|
|
64
|
+
if (_isRejectedKeySegment(seg))
|
|
65
|
+
return { found: false, value: undefined };
|
|
66
|
+
}
|
|
67
|
+
if (typeof config !== 'object' || config === null) {
|
|
68
|
+
return { found: false, value: undefined };
|
|
69
|
+
}
|
|
70
|
+
if (!Object.prototype.hasOwnProperty.call(config, dotKey)) {
|
|
71
|
+
return { found: false, value: undefined };
|
|
72
|
+
}
|
|
73
|
+
const value = config[dotKey];
|
|
74
|
+
if (value === undefined)
|
|
75
|
+
return { found: false, value: undefined };
|
|
76
|
+
return { found: true, value };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* GATE-05: resolve a dotted key in EITHER form against one config object.
|
|
80
|
+
*
|
|
81
|
+
* PRECEDENCE — nested first, flat only as a fallback. This ordering is the
|
|
82
|
+
* decision, not an implementation detail: when both forms are present for the
|
|
83
|
+
* same key the NESTED form wins. Chosen because every shipped example and every
|
|
84
|
+
* project configured to date is nested, so a nested-first fallback cannot move
|
|
85
|
+
* the resolution of any key that resolves today — the flat form resolves
|
|
86
|
+
* nowhere at present, so adding it below the nested walk is strictly additive.
|
|
87
|
+
* A flat-first ordering would silently change behaviour for any project that
|
|
88
|
+
* later adds a flat key alongside a nested one. Pinned by the
|
|
89
|
+
* "both forms present … NESTED wins" tests in
|
|
90
|
+
* tests/capability-precedence-parity.test.cjs; invert this and they go red.
|
|
91
|
+
*
|
|
92
|
+
* Called from the leaf of every precedence level, so levels 1-3 inherit the
|
|
93
|
+
* fallback without any change to the four-level walk itself.
|
|
94
|
+
*/
|
|
95
|
+
function getConfigValueEitherForm(config, dotKey) {
|
|
96
|
+
const nested = _getNestedConfigValue(config, dotKey);
|
|
97
|
+
if (nested.found)
|
|
98
|
+
return nested;
|
|
99
|
+
return _getFlatConfigValue(config, dotKey);
|
|
100
|
+
}
|
|
34
101
|
const _warnedRawConfigPaths = new Set();
|
|
35
102
|
function _readRawConfigKey(filePath, dotKey) {
|
|
36
103
|
try {
|
|
@@ -49,7 +116,9 @@ function _readRawConfigKey(filePath, dotKey) {
|
|
|
49
116
|
}
|
|
50
117
|
return { found: false, value: undefined };
|
|
51
118
|
}
|
|
52
|
-
|
|
119
|
+
// GATE-05: levels 2 and 3 read raw config.json files — the surface an
|
|
120
|
+
// operator hand-edits — so they need both key forms, nested first.
|
|
121
|
+
return getConfigValueEitherForm(parsed, dotKey);
|
|
53
122
|
}
|
|
54
123
|
catch {
|
|
55
124
|
return { found: false, value: undefined };
|
|
@@ -58,11 +127,11 @@ function _readRawConfigKey(filePath, dotKey) {
|
|
|
58
127
|
/**
|
|
59
128
|
* The raw config files levels 2 and 3 read, in read order: the active
|
|
60
129
|
* `planningDir(cwd)/config.json`, then the root `planningRoot(cwd)/config.json`
|
|
61
|
-
* when it is a different file. Exported so
|
|
62
|
-
* (src/
|
|
63
|
-
* beside `configFilesFor`, the loader's — without restating
|
|
64
|
-
* skip an unparseable file with a stderr warning and read
|
|
65
|
-
* swallow
|
|
130
|
+
* when it is a different file (16-04, D-28). Exported so the door-admission
|
|
131
|
+
* verdict (`vaultAdmissionVerdict` in src/vault.cts) parses every file the gate
|
|
132
|
+
* reads — this list beside `configFilesFor`, the loader's — without restating
|
|
133
|
+
* either. Both levels skip an unparseable file with a stderr warning and read
|
|
134
|
+
* on, which is the swallow the verdict exists to refuse.
|
|
66
135
|
*/
|
|
67
136
|
function activationConfigFilesFor(cwd) {
|
|
68
137
|
const wsConfigPath = node_path_1.default.join(planningDir(cwd), 'config.json');
|
|
@@ -84,8 +153,8 @@ function activationConfigFilesFor(cwd) {
|
|
|
84
153
|
*/
|
|
85
154
|
function resolveConfigKey(dotKey, opts) {
|
|
86
155
|
const { config, cwd, registry } = opts;
|
|
87
|
-
// Level 1: loadConfig result
|
|
88
|
-
const fromConfig =
|
|
156
|
+
// Level 1: loadConfig result (GATE-05: nested form first, flat form as fallback)
|
|
157
|
+
const fromConfig = getConfigValueEitherForm(config, dotKey);
|
|
89
158
|
if (fromConfig.found)
|
|
90
159
|
return { found: true, value: fromConfig.value };
|
|
91
160
|
// Level 2 + 3: raw config.json files (only when cwd is available)
|
|
@@ -116,6 +185,11 @@ function _resolveActivationValue(dotKey, config, cwd, registry) {
|
|
|
116
185
|
}
|
|
117
186
|
module.exports = {
|
|
118
187
|
_getNestedConfigValue,
|
|
188
|
+
// GATE-05: exported so src/config.cts's cmdConfigGet reuses this exact flat
|
|
189
|
+
// lookup rather than growing a second, driftable copy of the rule.
|
|
190
|
+
_getFlatConfigValue,
|
|
191
|
+
_isRejectedKeySegment,
|
|
192
|
+
getConfigValueEitherForm,
|
|
119
193
|
_readRawConfigKey,
|
|
120
194
|
_resolveActivationValue,
|
|
121
195
|
resolveConfigKey,
|