@pareto4/pp-core 1.13.0 → 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 +3 -3
- package/README.md +31 -12
- package/agents/pp-code-fixer.md +0 -11
- package/agents/pp-code-reviewer.md +1 -77
- package/agents/pp-debug-session-manager.md +9 -6
- package/agents/pp-executor.md +12 -29
- package/agents/pp-plan-checker.md +4 -4
- package/agents/pp-planner.md +34 -20
- package/agents/pp-vault-reviewer.md +100 -23
- package/agents/pp-verifier.md +1 -3
- package/bin/install.js +10 -3
- package/commands/pp-execute-phase.md +1 -3
- package/commands/pp-ns-manage.md +1 -1
- package/commands/pp-ns-review.md +1 -1
- package/commands/pp-plan-phase.md +1 -2
- package/commands/pp-vault-promote.md +7 -8
- package/commands/pp-vault-review.md +6 -5
- 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 +10 -18
- 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 +201 -229
- package/pp-core/bin/lib/capability-state.cjs +93 -1
- package/pp-core/bin/lib/capability-writer.cjs +3 -3
- package/pp-core/bin/lib/check-command-router.cjs +1906 -1514
- 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 +151 -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 +11 -12
- package/pp-core/bin/lib/git-provider.cjs +9 -10
- package/pp-core/bin/lib/init-command-router.cjs +5 -8
- package/pp-core/bin/lib/init-contract.cjs +620 -738
- package/pp-core/bin/lib/init-interactive.cjs +62 -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 +4 -2
- package/pp-core/bin/lib/loop-resolver.cjs +165 -129
- package/pp-core/bin/lib/org-profile.cjs +402 -161
- 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/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-command-router.cjs +1682 -477
- package/pp-core/bin/lib/vault-coordinates.cjs +16 -7
- package/pp-core/bin/lib/vault-index.cjs +656 -0
- package/pp-core/bin/lib/vault-seal.cjs +1851 -0
- 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 +1504 -0
- package/pp-core/bin/lib/vault-trace.cjs +155 -2778
- package/pp-core/bin/lib/vault-update.cjs +10 -59
- package/pp-core/bin/lib/vault.cjs +2570 -950
- 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 +157 -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-standards.md +311 -0
- package/pp-core/references/planning-config.md +0 -8
- package/pp-core/references/tdd.md +0 -1
- package/pp-core/templates/README.md +1 -0
- package/pp-core/templates/VAULT-REVIEW.md +56 -0
- package/pp-core/templates/phase-prompt.md +2 -6
- 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 -57
- 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 +207 -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 +327 -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 +78 -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 +219 -20
- package/pp-core/workflows/execute-phase/steps/verify-post-gate.md +147 -0
- package/pp-core/workflows/execute-phase.md +152 -128
- package/pp-core/workflows/execute-plan.md +54 -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 +161 -23
- package/pp-core/workflows/vault-write-back.md +73 -110
- 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 +120 -13
- 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 +3 -19
- package/scripts/lint-test-file-count.cjs +5 -6
- package/scripts/prompt-injection-scan.sh +19 -17
- 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/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/bin/lib/practices-review-check.cjs +0 -938
- package/pp-core/bin/lib/vault-audit.cjs +0 -2070
- package/pp-core/bin/lib/vault-practices.cjs +0 -1990
- package/pp-core/bin/lib/vault-review.cjs +0 -2359
- package/pp-core/bin/lib/vault-write-back.cjs +0 -877
- package/pp-core/references/executor-vault-trace.md +0 -47
- package/pp-core/references/planner-plan-graph.md +0 -66
- package/pp-core/references/planner-vault-practices.md +0 -112
- package/pp-core/templates/practices/README.md +0 -251
- 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/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
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Loop gate runner — the one owner of the generic `check.query` gate contract.
|
|
4
|
-
*
|
|
5
|
-
* Command surface: pp-tools loop run-gates <point> [--phase <N>] [--tier light|standard|heavy] [--query <q>] [--raw]
|
|
6
|
-
*
|
|
7
|
-
* Resolves the active hooks at <point> through the loop resolver (the same
|
|
8
|
-
* owner `loop render-hooks` uses, so an unreadable config refuses here too),
|
|
9
|
-
* then runs every active gate in registry order and applies the two-step gate
|
|
10
|
-
* contract execute-phase states for `execute:wave:post` / `execute:post`:
|
|
11
|
-
*
|
|
12
|
-
* Step 1 — did the check COMMAND succeed? (`pp-tools check <query> [<phase>]
|
|
13
|
-
* [<check.args>…] --raw` exits 0 with a JSON object). If not: `onError: halt` halts,
|
|
14
|
-
* `onError: skip` (or absent) warns and moves on; `block` is never read.
|
|
15
|
-
* Step 2 — read `block`. A blocking gate (`blocking: true`) halts on
|
|
16
|
-
* `block: true`; that halt is never bypassed by `onError`. An advisory gate
|
|
17
|
-
* (`blocking` not true) reports `block: true` or a non-empty `message` as an
|
|
18
|
-
* advisory and never halts. `block: false` with no message passes silently;
|
|
19
|
-
* a blocking gate that passes WITH a message (a note) passes with an `ℹ` line.
|
|
20
|
-
*
|
|
21
|
-
* `check.args` (optional) are literal tokens the gate declaration appends after
|
|
22
|
-
* the phase — the gate's own policy, stated where the gate is declared (e.g.
|
|
23
|
-
* `--stage plan`). `--query <q>` runs only the gates whose `check.query` is `q`,
|
|
24
|
-
* so a host can run one gate in code beside a loop that handles the others.
|
|
25
|
-
*
|
|
26
|
-
* A gate this runner cannot run (no `check.query`, or a query that is not a
|
|
27
|
-
* check name) halts when it is blocking and is reported when it is advisory:
|
|
28
|
-
* a blocking gate is never passed having checked nothing.
|
|
29
|
-
*
|
|
30
|
-
* Output: the verdict JSON on stdout (`{ point, phase, halt, gates[], lines[] }`),
|
|
31
|
-
* every line of `lines` also on stderr so a host capturing `$(…)` still shows
|
|
32
|
-
* them, and exit 1 when `halt` is true. A host therefore writes
|
|
33
|
-
* `X=$(pp_run loop run-gates <point> …) || exit 1` and the halt stops it.
|
|
34
|
-
*/
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
39
|
-
const shell_command_projection_cjs_1 = require("./shell-command-projection.cjs");
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
41
|
-
const ioMod = require("./io.cjs");
|
|
42
|
-
const { output: coreOutput, error: coreError, ERROR_REASON } = ioMod;
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
44
|
-
const loopResolverModule = require("./loop-resolver.cjs");
|
|
45
|
-
const { resolveProjectLoopHooks } = loopResolverModule;
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
47
|
-
const configLoaderModule = require("./config-loader.cjs");
|
|
48
|
-
const { unreadableConfigFiles } = configLoaderModule;
|
|
49
|
-
const phase_tier_cjs_1 = require("./phase-tier.cjs");
|
|
50
|
-
/** A check name as `routeCheckCommand` accepts it (dotted or hyphenated); never an option or a path. */
|
|
51
|
-
const CHECK_QUERY_RE = /^[a-z0-9][a-z0-9.-]*$/i;
|
|
52
|
-
/** A declared `check.args` token: a flag or a plain word — never a path, a quote or a shell metacharacter. */
|
|
53
|
-
const CHECK_ARG_RE = /^(?:--[a-z][a-z0-9-]*|[a-z0-9][a-z0-9._-]*)$/i;
|
|
54
|
-
const CHECK_ARGS_MAX = 8;
|
|
55
|
-
const CHECK_TIMEOUT_MS = 300_000;
|
|
56
|
-
/** A check's operator message is relayed whole (line breaks kept), up to this many characters. */
|
|
57
|
-
const MESSAGE_CAP = 16_000;
|
|
58
|
-
function boundMessage(v) {
|
|
59
|
-
if (typeof v !== 'string')
|
|
60
|
-
return null;
|
|
61
|
-
const flat = v.replace(/\r\n?/g, '\n').replace(/[\u0000-\u0008\u000B-\u001F\u007F]+/g, ' ').trim();
|
|
62
|
-
if (flat === '')
|
|
63
|
-
return null;
|
|
64
|
-
return flat.length > MESSAGE_CAP ? `${flat.slice(0, MESSAGE_CAP)}…` : flat;
|
|
65
|
-
}
|
|
66
|
-
/** The declared `check.args`, or null when the declaration carries an argument this runner will not pass. */
|
|
67
|
-
function declaredCheckArgs(check) {
|
|
68
|
-
const args = check ? check['args'] : undefined;
|
|
69
|
-
if (args === undefined)
|
|
70
|
-
return [];
|
|
71
|
-
if (!Array.isArray(args) || args.length > CHECK_ARGS_MAX)
|
|
72
|
-
return null;
|
|
73
|
-
return args.every((a) => typeof a === 'string' && CHECK_ARG_RE.test(a)) ? args : null;
|
|
74
|
-
}
|
|
75
|
-
/** Run `pp-tools check <query> [<phase>] [<args>…] --raw` in a child process (check handlers exit the process). */
|
|
76
|
-
const defaultCheckRunner = (query, phase, cwd, checkArgs) => {
|
|
77
|
-
const tools = node_path_1.default.join(__dirname, '..', 'pp-tools.cjs');
|
|
78
|
-
const args = [tools, 'check', query, ...(phase ? [phase] : []), ...checkArgs, '--raw'];
|
|
79
|
-
const r = (0, shell_command_projection_cjs_1.execTool)(process.execPath, args, { cwd, timeout: CHECK_TIMEOUT_MS });
|
|
80
|
-
if (r.exitCode !== 0 || r.signal) {
|
|
81
|
-
const why = r.signal ? `killed by ${r.signal}` : `exit ${r.exitCode}`;
|
|
82
|
-
return { ok: false, result: null, error: `${why}${r.stderr ? `: ${r.stderr.split('\n')[0]}` : ''}` };
|
|
83
|
-
}
|
|
84
|
-
if (r.stdout === '')
|
|
85
|
-
return { ok: false, result: null, error: 'empty output' };
|
|
86
|
-
try {
|
|
87
|
-
const parsed = JSON.parse(r.stdout);
|
|
88
|
-
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
89
|
-
return { ok: false, result: null, error: 'output is not a JSON object' };
|
|
90
|
-
return { ok: true, result: parsed, error: null };
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
return { ok: false, result: null, error: 'output is not JSON' };
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Run every active gate at `point` (already resolved) under the two-step
|
|
98
|
-
* contract. Pure apart from `runCheck`.
|
|
99
|
-
*/
|
|
100
|
-
function runGates(point, phase, activeHooks, cwd, runCheck = defaultCheckRunner) {
|
|
101
|
-
const gates = [];
|
|
102
|
-
const lines = [];
|
|
103
|
-
let halt = false;
|
|
104
|
-
for (const h of activeHooks) {
|
|
105
|
-
if (h.kind !== 'gate')
|
|
106
|
-
continue;
|
|
107
|
-
const blocking = h.blocking === true;
|
|
108
|
-
const onError = typeof h.onError === 'string' ? h.onError : 'skip';
|
|
109
|
-
const check = h.check && typeof h.check === 'object' ? h.check : null;
|
|
110
|
-
const query = check && typeof check['query'] === 'string' ? check['query'] : null;
|
|
111
|
-
const checkArgs = declaredCheckArgs(check);
|
|
112
|
-
const run = { capId: h.capId, query, blocking, onError, outcome: 'pass', block: null, message: null };
|
|
113
|
-
if (query === null || !CHECK_QUERY_RE.test(query) || checkArgs === null) {
|
|
114
|
-
run.outcome = 'unrunnable';
|
|
115
|
-
run.message = query === null
|
|
116
|
-
? 'the gate declares no check.query'
|
|
117
|
-
: checkArgs === null ? 'check.args is not a list of plain flags and words' : 'check.query is not a check name';
|
|
118
|
-
if (blocking) {
|
|
119
|
-
halt = true;
|
|
120
|
-
lines.push(`⛔ ${point} blocked: capability gate (${h.capId}) cannot be run (${run.message}). Fix the capability declaration before continuing.`);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
lines.push(`⚠ ${h.capId} advisory (${point}): gate not run — ${run.message}.`);
|
|
124
|
-
}
|
|
125
|
-
gates.push(run);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
// Step 1 — did the check command itself succeed?
|
|
129
|
-
const r = runCheck(query, phase, cwd, checkArgs);
|
|
130
|
-
if (!r.ok || r.result === null) {
|
|
131
|
-
run.message = boundMessage(r.error) ?? 'command error';
|
|
132
|
-
if (onError === 'halt') {
|
|
133
|
-
run.outcome = 'error-halt';
|
|
134
|
-
halt = true;
|
|
135
|
-
lines.push(`⛔ ${point} blocked: gate check command failed (${h.capId}: check ${query}): ${run.message}. Resolve before continuing.`);
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
run.outcome = 'error-skip';
|
|
139
|
-
lines.push(`⚠ ${point} gate check command failed (${h.capId}: check ${query}): ${run.message} — skipped (onError: ${onError}).`);
|
|
140
|
-
}
|
|
141
|
-
gates.push(run);
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
// Step 2 — read block (only reached when the command succeeded).
|
|
145
|
-
const block = r.result['block'] === true;
|
|
146
|
-
run.block = block;
|
|
147
|
-
run.message = boundMessage(r.result['message']) ?? boundMessage(r.result['reason']);
|
|
148
|
-
if (blocking && block) {
|
|
149
|
-
run.outcome = 'blocked';
|
|
150
|
-
halt = true;
|
|
151
|
-
lines.push(`⛔ ${point} blocked by capability gate (${h.capId}): ${run.message ?? `check ${query} reported block`}. Resolve before continuing.`);
|
|
152
|
-
}
|
|
153
|
-
else if (!blocking && (block || boundMessage(r.result['message']) !== null)) {
|
|
154
|
-
run.outcome = 'advisory';
|
|
155
|
-
lines.push(`⚠ ${h.capId} advisory (${point}): ${run.message ?? `check ${query} reported block`}`);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
run.outcome = 'pass';
|
|
159
|
-
const note = blocking ? boundMessage(r.result['message']) : null;
|
|
160
|
-
if (note !== null)
|
|
161
|
-
lines.push(`ℹ ${h.capId} (${point}): ${note}`);
|
|
162
|
-
}
|
|
163
|
-
gates.push(run);
|
|
164
|
-
}
|
|
165
|
-
return { point, phase, halt, gates, lines };
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* `loop run-gates <point> [--phase <N>] [--tier <t>]`. Exit 1 on a halt or a
|
|
169
|
-
* refusal; the verdict JSON is on stdout either way except on a refusal.
|
|
170
|
-
*/
|
|
171
|
-
function cmdLoopRunGates(cwd, point, raw, options = {}) {
|
|
172
|
-
if (!point) {
|
|
173
|
-
coreError('loop run-gates requires a <point> argument (e.g. verify:post)', ERROR_REASON.USAGE);
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
const phase = typeof options['phase'] === 'string' && options['phase'] !== '' ? options['phase'] : null;
|
|
177
|
-
const tierCli = typeof options['tier'] === 'string' && options['tier'] !== '' ? options['tier'] : null;
|
|
178
|
-
if (tierCli !== null && !['light', 'standard', 'heavy'].includes(tierCli)) {
|
|
179
|
-
coreError('--tier needs one of light, standard, heavy', ERROR_REASON.USAGE);
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
const phaseTier = (phase !== null || tierCli !== null) && unreadableConfigFiles(cwd).length === 0
|
|
183
|
-
? (0, phase_tier_cjs_1.resolvePhaseTierForProject)(cwd, phase, tierCli)
|
|
184
|
-
: null;
|
|
185
|
-
const outcome = resolveProjectLoopHooks(cwd, point, { phaseTier, what: `loop run-gates ${point}` });
|
|
186
|
-
if (!outcome.ok) {
|
|
187
|
-
coreError(outcome.message, outcome.reason === 'config_unreadable' ? ERROR_REASON.CONFIG_PARSE_FAILED : undefined);
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const onlyQuery = typeof options['query'] === 'string' && options['query'] !== '' ? options['query'] : null;
|
|
191
|
-
const hooks = onlyQuery === null
|
|
192
|
-
? outcome.resolved.activeHooks
|
|
193
|
-
: outcome.resolved.activeHooks.filter((h) => {
|
|
194
|
-
const c = h.check && typeof h.check === 'object' ? h.check : null;
|
|
195
|
-
return c !== null && c['query'] === onlyQuery;
|
|
196
|
-
});
|
|
197
|
-
const verdict = runGates(point, phase, hooks, cwd);
|
|
198
|
-
if (verdict.lines.length > 0) {
|
|
199
|
-
try {
|
|
200
|
-
process.stderr.write(verdict.lines.join('\n') + '\n');
|
|
201
|
-
}
|
|
202
|
-
catch {
|
|
203
|
-
/* stderr closed */
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
coreOutput(verdict, raw);
|
|
207
|
-
if (verdict.halt)
|
|
208
|
-
process.exitCode = 1;
|
|
209
|
-
}
|
|
210
|
-
module.exports = {
|
|
211
|
-
runGates,
|
|
212
|
-
cmdLoopRunGates,
|
|
213
|
-
};
|