peaks-loop 4.1.17 → 4.1.19
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/marketplace.json +2 -2
- package/CHANGELOG.md +269 -0
- package/README-en.md +6 -0
- package/README.md +5 -0
- package/contracts/test-style-contract.md +14 -5
- package/dist/cli/commands/audit-red-lines-runners.js +6 -1
- package/dist/cli/commands/best-practice-scan-collision.d.ts +42 -0
- package/dist/cli/commands/best-practice-scan-collision.js +115 -0
- package/dist/cli/commands/best-practice-scan-command.d.ts +5 -0
- package/dist/cli/commands/best-practice-scan-command.js +9 -18
- package/dist/cli/commands/best-practice-scan-helpers.d.ts +12 -6
- package/dist/cli/commands/best-practice-scan-helpers.js +37 -17
- package/dist/cli/commands/code-auto-compact-command.js +71 -40
- package/dist/cli/commands/code-auto-compact-deferral.d.ts +34 -0
- package/dist/cli/commands/code-auto-compact-deferral.js +59 -0
- package/dist/cli/commands/code-gate-command.d.ts +4 -4
- package/dist/cli/commands/code-gate-command.js +4 -4
- package/dist/cli/commands/core/skill-generated-config-notice.d.ts +5 -0
- package/dist/cli/commands/core/skill-generated-config-notice.js +42 -8
- package/dist/cli/commands/core/skill-presence-commands.js +42 -74
- package/dist/cli/commands/core/skill-presence-set-command.d.ts +11 -0
- package/dist/cli/commands/core/skill-presence-set-command.js +175 -0
- package/dist/cli/commands/core/skill-registry-commands.js +32 -0
- package/dist/cli/commands/core/skill-store-report.d.ts +8 -0
- package/dist/cli/commands/core/skill-store-report.js +79 -0
- package/dist/cli/commands/core/standards-init-command.js +44 -8
- package/dist/cli/commands/core/standards-migrate-command.js +5 -4
- package/dist/cli/commands/dispatch-dag-runners.d.ts +1 -0
- package/dist/cli/commands/dispatch-dag-runners.js +11 -1
- package/dist/cli/commands/dispatch-detached-branch.js +19 -1
- package/dist/cli/commands/dispatch-prompt-composition.js +7 -2
- package/dist/cli/commands/dispatch-scratch-path-block.d.ts +73 -0
- package/dist/cli/commands/dispatch-scratch-path-block.js +131 -0
- package/dist/cli/commands/hooks-commands.js +36 -7
- package/dist/cli/commands/hooks-uninstall-command.js +5 -5
- package/dist/cli/commands/mut-commands-helpers.d.ts +72 -5
- package/dist/cli/commands/mut-commands-helpers.js +197 -4
- package/dist/cli/commands/mut-commands.d.ts +9 -1
- package/dist/cli/commands/mut-commands.js +82 -154
- package/dist/cli/commands/preferences-commands.js +27 -2
- package/dist/cli/commands/scan-scope-helpers.js +2 -2
- package/dist/services/24h-mode/auto-engage.d.ts +11 -3
- package/dist/services/24h-mode/auto-engage.js +14 -6
- package/dist/services/artifacts/artifact-templates.js +10 -0
- package/dist/services/artifacts/backcompat-acceptance.d.ts +8 -1
- package/dist/services/artifacts/backcompat-acceptance.js +8 -7
- package/dist/services/artifacts/rd-transition-gates.d.ts +32 -5
- package/dist/services/artifacts/rd-transition-gates.js +96 -19
- package/dist/services/artifacts/request-artifact-service.js +6 -6
- package/dist/services/audit/enforcers/lint-output-style.js +14 -2
- package/dist/services/audit/enforcers/root-scratch-artifacts.d.ts +46 -0
- package/dist/services/audit/enforcers/root-scratch-artifacts.js +97 -0
- package/dist/services/audit/static-service.js +4 -4
- package/dist/services/code/auto-compact-history.d.ts +6 -1
- package/dist/services/code/auto-compact-history.js +6 -1
- package/dist/services/code/auto-compact-modes.d.ts +60 -14
- package/dist/services/code/auto-compact-modes.js +75 -20
- package/dist/services/code/auto-compact-orchestrator.js +7 -5
- package/dist/services/code/auto-compact-profile.d.ts +23 -0
- package/dist/services/code/auto-compact-profile.js +51 -0
- package/dist/services/code/auto-compact-run-types.d.ts +8 -4
- package/dist/services/compact-history/compact-history-service.d.ts +6 -1
- package/dist/services/compact-history/compact-history-service.js +5 -1
- package/dist/services/context/auto-compact-types.d.ts +7 -5
- package/dist/services/dispatch/dispatch-ledger-reader.d.ts +13 -0
- package/dist/services/dispatch/dispatch-ledger-reader.js +164 -0
- package/dist/services/doctor/doctor-service/checks/canonical-store-version.d.ts +57 -0
- package/dist/services/doctor/doctor-service/checks/canonical-store-version.js +190 -0
- package/dist/services/doctor/doctor-service/checks/l3-runtime-root-census.d.ts +37 -0
- package/dist/services/doctor/doctor-service/checks/l3-runtime-root-census.js +100 -0
- package/dist/services/doctor/doctor-service/checks/skill-reference-parity.d.ts +11 -3
- package/dist/services/doctor/doctor-service/checks/skill-reference-parity.js +48 -29
- package/dist/services/doctor/doctor-service/plugin-registry.js +4 -0
- package/dist/services/doctor/doctor-service/types.d.ts +12 -0
- package/dist/services/hooks/hook-payload-cwd.d.ts +11 -4
- package/dist/services/hooks/hook-payload-cwd.js +11 -4
- package/dist/services/hooks/pre-tool-code-gate.d.ts +4 -4
- package/dist/services/hooks/pre-tool-code-gate.js +4 -4
- package/dist/services/hooks/presence-marker-detector.d.ts +3 -0
- package/dist/services/hooks/presence-marker-detector.js +21 -19
- package/dist/services/ide/adapters/claude-code-adapter.js +6 -8
- package/dist/services/ide/adapters/codex-adapter.js +23 -7
- package/dist/services/ide/adapters/cursor-adapter.js +23 -7
- package/dist/services/mode/mode-status-service.d.ts +26 -27
- package/dist/services/mode/mode-status-service.js +36 -60
- package/dist/services/preferences/preferences-types.d.ts +30 -0
- package/dist/services/preferences/preferences-types.js +13 -0
- package/dist/services/scan/acceptance-coverage-service.d.ts +14 -11
- package/dist/services/scan/acceptance-coverage-service.js +157 -52
- package/dist/services/scan/rid-change-claims.d.ts +15 -0
- package/dist/services/scan/rid-change-claims.js +116 -0
- package/dist/services/session/getSessionDir.d.ts +13 -0
- package/dist/services/session/getSessionDir.js +7 -1
- package/dist/services/skills/hooks-settings-types.d.ts +17 -21
- package/dist/services/skills/presence-caller-id.d.ts +51 -0
- package/dist/services/skills/presence-caller-id.js +43 -0
- package/dist/services/skills/presence-gate.d.ts +65 -0
- package/dist/services/skills/presence-gate.js +113 -0
- package/dist/services/skills/presence-lease-resolver.d.ts +63 -0
- package/dist/services/skills/presence-lease-resolver.js +114 -0
- package/dist/services/skills/presence-lease-selection.d.ts +91 -0
- package/dist/services/skills/presence-lease-selection.js +135 -0
- package/dist/services/skills/presence-lease-service.d.ts +3 -11
- package/dist/services/skills/presence-lease-service.js +34 -87
- package/dist/services/skills/presence-lease-store.d.ts +33 -0
- package/dist/services/skills/presence-lease-store.js +94 -0
- package/dist/services/skills/presence-lease-types.d.ts +31 -0
- package/dist/services/skills/presence-lease-types.js +27 -0
- package/dist/services/skills/presence-role.d.ts +35 -0
- package/dist/services/skills/presence-role.js +72 -0
- package/dist/services/skills/skill-presence-service.d.ts +39 -9
- package/dist/services/skills/skill-presence-service.js +143 -174
- package/dist/services/skills/skill-presence-write.d.ts +60 -0
- package/dist/services/skills/skill-presence-write.js +74 -0
- package/dist/services/skills/skill-statusline-service.js +7 -7
- package/dist/services/skills/sync-service-support.d.ts +27 -0
- package/dist/services/skills/sync-service.js +1 -0
- package/dist/services/standards/ide-aware-standards-service.d.ts +35 -23
- package/dist/services/standards/ide-aware-standards-service.js +45 -20
- package/dist/services/standards/migrate-claude-rules-service.d.ts +6 -0
- package/dist/services/standards/migrate-claude-rules-service.js +18 -0
- package/dist/services/standards/migrate-service.d.ts +1 -1
- package/dist/services/standards/migrate-service.js +27 -7
- package/dist/services/standards/project-scripts.d.ts +25 -0
- package/dist/services/standards/project-scripts.js +116 -0
- package/dist/services/standards/project-standards-service.d.ts +23 -15
- package/dist/services/standards/project-standards-service.js +176 -243
- package/dist/services/standards/standards-constitution.d.ts +89 -0
- package/dist/services/standards/standards-constitution.js +199 -0
- package/dist/services/standards/standards-files.d.ts +37 -0
- package/dist/services/standards/standards-files.js +138 -0
- package/dist/services/standards/standards-pointer.d.ts +73 -0
- package/dist/services/standards/standards-pointer.js +98 -0
- package/dist/services/standards/standards-render-agents.d.ts +34 -0
- package/dist/services/standards/standards-render-agents.js +149 -0
- package/dist/services/standards/standards-render-common.d.ts +38 -1
- package/dist/services/standards/standards-render-common.js +44 -7
- package/dist/services/standards/standards-render.d.ts +1 -3
- package/dist/services/standards/standards-render.js +6 -87
- package/dist/services/workflow/workflow-graph-ensure.d.ts +77 -0
- package/dist/services/workflow/workflow-graph-ensure.js +97 -0
- package/dist/services/workflow/workflow-inflight-probe.d.ts +68 -31
- package/dist/services/workflow/workflow-inflight-probe.js +163 -75
- package/dist/services/workflow/workflow-presence-lifecycle.js +21 -6
- package/dist/services/workspace/generated-artifacts-content.d.ts +46 -0
- package/dist/services/workspace/generated-artifacts-content.js +167 -0
- package/dist/services/workspace/generated-artifacts-stamp.d.ts +36 -13
- package/dist/services/workspace/generated-artifacts-stamp.js +37 -15
- package/dist/services/workspace/runtime-layout.d.ts +64 -0
- package/dist/services/workspace/runtime-layout.js +62 -0
- package/output-styles/peaks-skill-swarm.md +18 -2
- package/package.json +10 -9
- package/schemas/doctor-report.schema.json +1 -1
- package/scripts/canonical-store-fs.mjs +112 -0
- package/scripts/canonical-store-link.mjs +13 -22
- package/scripts/canonical-store-marker.mjs +241 -0
- package/scripts/canonical-store.mjs +119 -141
- package/scripts/install-skills-bundles.mjs +56 -13
- package/scripts/install-skills-fs.mjs +73 -0
- package/scripts/install-skills-output-styles.mjs +8 -2
- package/scripts/install-skills-report.mjs +19 -0
- package/scripts/install-skills.mjs +9 -0
- package/skills/bee/peaks-perf-audit/SKILL.md +3 -1
- package/skills/bee/peaks-prd/SKILL.md +5 -3
- package/skills/bee/peaks-qa/SKILL.md +4 -2
- package/skills/bee/peaks-qa/references/qa-skill-presence.md +1 -1
- package/skills/bee/peaks-qa/references/qa-standards-preflight.md +3 -1
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +2 -2
- package/skills/bee/peaks-rd/SKILL.md +4 -2
- package/skills/bee/peaks-rd/references/artifact-and-standards-output.md +1 -1
- package/skills/bee/peaks-rd/references/rd-runbook.md +11 -2
- package/skills/bee/peaks-rd/references/rd-standards-preflight.md +3 -1
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +24 -5
- package/skills/bee/peaks-rd/references/rd-transition-gates.md +49 -5
- package/skills/bee/peaks-rd/references/skill-presence-and-title.md +1 -1
- package/skills/bee/peaks-reviewer/SKILL.md +3 -1
- package/skills/bee/peaks-sc/SKILL.md +4 -2
- package/skills/bee/peaks-security-audit/SKILL.md +3 -1
- package/skills/bee/peaks-txt/SKILL.md +5 -3
- package/skills/bee/peaks-ui/SKILL.md +6 -4
- package/skills/peaks-audit/SKILL.md +3 -1
- package/skills/peaks-code/SKILL.md +4 -2
- package/skills/peaks-code/references/a2a-artifact-mapping.md +3 -3
- package/skills/peaks-code/references/completion-handoff.md +1 -1
- package/skills/peaks-code/references/local-artifact-workspace.md +10 -11
- package/skills/peaks-code/references/micro-cycle.md +2 -2
- package/skills/peaks-code/references/mode-selection-with-stale-presence.md +3 -3
- package/skills/peaks-code/references/runbook.md +4 -4
- package/skills/peaks-code/references/skill-presence-and-title.md +4 -2
- package/skills/peaks-code/references/standards-preflight.md +7 -6
- package/skills/peaks-code/references/sub-agent-dispatch.md +1 -1
- package/skills/peaks-code/references/swarm-dispatch-contract.md +5 -5
- package/skills/peaks-code/references/workflow-gates-and-types.md +37 -11
- package/skills/peaks-content/SKILL.md +3 -1
- package/skills/peaks-doctor/SKILL.md +3 -1
- package/skills/peaks-final-review/SKILL.md +3 -1
- package/skills/peaks-ide/SKILL.md +3 -1
- package/skills/peaks-issue-fix-orchestrator/SKILL.md +5 -3
- package/skills/peaks-race-code/SKILL.md +9 -4
- package/skills/peaks-resume/SKILL.md +3 -1
- package/skills/peaks-slice-decompose/SKILL.md +3 -1
- package/skills/peaks-solo/SKILL.md +3 -1
- package/skills/peaks-sop/SKILL.md +4 -2
- package/skills/peaks-status/SKILL.md +3 -1
- package/skills/peaks-test/SKILL.md +3 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { detectInstalledIde } from '../../services/ide/ide-detector.js';
|
|
2
2
|
import { getAdapter } from '../../services/ide/ide-registry.js';
|
|
3
3
|
import { planFileOverlapWaves } from '../../services/dispatch/file-overlap-wave-planner.js';
|
|
4
|
+
import { buildScratchPathInjection } from './dispatch-scratch-path-block.js';
|
|
4
5
|
/** Detect the IDE and resolve its sub-agent dispatcher. */
|
|
5
6
|
export function resolveDagDispatcher(projectRoot) {
|
|
6
7
|
const ide = detectInstalledIde(projectRoot) ?? 'claude-code';
|
|
@@ -32,9 +33,18 @@ export function planFirstLevelWaves(dag, levelArr) {
|
|
|
32
33
|
export function makeCliRunner(args) {
|
|
33
34
|
const { firstLevelIds, dispatcher, ids, emissions } = args;
|
|
34
35
|
return async (spec) => {
|
|
36
|
+
// The scratch path is pinned HERE, in the brief the leaf receives: the DAG
|
|
37
|
+
// path does not pass through the prompt composer, so without this the leaf
|
|
38
|
+
// would pick its own redirect target, and a cwd-relative one lands at the
|
|
39
|
+
// repository root.
|
|
40
|
+
const scratch = buildScratchPathInjection({
|
|
41
|
+
projectRoot: ids.projectRoot,
|
|
42
|
+
sid: ids.sid,
|
|
43
|
+
role: spec.role
|
|
44
|
+
});
|
|
35
45
|
const toolCall = dispatcher.buildToolCall({
|
|
36
46
|
role: spec.role,
|
|
37
|
-
prompt: spec.prompt
|
|
47
|
+
prompt: `${spec.prompt}\n\n${scratch.block}`,
|
|
38
48
|
requestId: ids.rid,
|
|
39
49
|
sessionId: ids.sid
|
|
40
50
|
});
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// in-process pipeline runs, so it lives in its own module.
|
|
4
4
|
import { fail, getErrorMessage, ok } from 'peaks-loop-shared/result';
|
|
5
5
|
import { printResult } from '../cli-helpers.js';
|
|
6
|
+
import { buildScratchPathInjection } from './dispatch-scratch-path-block.js';
|
|
6
7
|
function resolveMaxConcurrent(options) {
|
|
7
8
|
return typeof options.maxConcurrent === 'string' && options.maxConcurrent.length > 0
|
|
8
9
|
? Number.parseInt(options.maxConcurrent, 10)
|
|
@@ -32,6 +33,23 @@ function reportDetachedError(io, role, error, asJson) {
|
|
|
32
33
|
]), asJson);
|
|
33
34
|
process.exitCode = 1;
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The brief the vendor CLI receives: the caller's prompt plus the scratch
|
|
38
|
+
* block.
|
|
39
|
+
*
|
|
40
|
+
* The scratch path is pinned HERE, in the brief itself: the detached path does
|
|
41
|
+
* not pass through the prompt composer, so without this the leaf would pick its
|
|
42
|
+
* own redirect target, and a cwd-relative one lands at the repository root. The
|
|
43
|
+
* session id is resolved the way the detached handler resolves it, so both name
|
|
44
|
+
* one directory.
|
|
45
|
+
*/
|
|
46
|
+
function detachedBrief(options, role) {
|
|
47
|
+
const projectRoot = options.project ?? process.cwd();
|
|
48
|
+
const sid = process.env.PEAKS_SESSION_ID ?? 'local';
|
|
49
|
+
const scratch = buildScratchPathInjection({ projectRoot, sid, role });
|
|
50
|
+
const prompt = typeof options.prompt === 'string' ? options.prompt : '';
|
|
51
|
+
return `${prompt}\n\n${scratch.block}`;
|
|
52
|
+
}
|
|
35
53
|
export async function runDetachedDispatch(io, role, options, asJson) {
|
|
36
54
|
try {
|
|
37
55
|
const { dispatch: detachedDispatch } = await import('./sub-agent/detached.js');
|
|
@@ -39,7 +57,7 @@ export async function runDetachedDispatch(io, role, options, asJson) {
|
|
|
39
57
|
const maxConcurrent = resolveMaxConcurrent(options);
|
|
40
58
|
const result = await detachedDispatch({
|
|
41
59
|
role,
|
|
42
|
-
prompt:
|
|
60
|
+
prompt: detachedBrief(options, role),
|
|
43
61
|
requestId: options.requestId ?? 'unknown-rid',
|
|
44
62
|
mode: 'detached',
|
|
45
63
|
...(typeof options.vendor === 'string' ? { vendor: options.vendor } : {}),
|
|
@@ -12,6 +12,7 @@ import { computeUiLibraryDispatchBlock } from '../../services/standards/ui-libra
|
|
|
12
12
|
import { readFreshContextBlock } from '../../services/fresh-context/fresh-context-block.js';
|
|
13
13
|
import { deprecatedReviewerWarnings } from './sub-agent-shared.js';
|
|
14
14
|
import { buildIsolationBlock, buildMustLsFilesBlock } from './dispatch-prompt-blocks.js';
|
|
15
|
+
import { buildScratchPathInjection } from './dispatch-scratch-path-block.js';
|
|
15
16
|
import { ensureArtifactContractBlock, readArtifactContractBlock } from '../../services/artifacts/artifact-contract-block.js';
|
|
16
17
|
import { ensureKarpathyBlock } from '../../services/dispatch/karpathy-block.js';
|
|
17
18
|
import { cliInvocationWarnings } from './dispatch-cli-invocation-check.js';
|
|
@@ -173,12 +174,15 @@ export async function composeDispatchPrompt(io, input) {
|
|
|
173
174
|
requestId: rid,
|
|
174
175
|
role
|
|
175
176
|
});
|
|
177
|
+
// The scratch path for this dispatch: an ABSOLUTE directory, so a redirect
|
|
178
|
+
// into it cannot depend on the cwd the sub-agent happens to be in.
|
|
179
|
+
const scratch = buildScratchPathInjection({ projectRoot, sid, role });
|
|
176
180
|
// The presence test runs on the ASSEMBLED prompt, not on the caller's draft:
|
|
177
181
|
// this string is what the sub-agent receives as `toolCall.args.prompt` and
|
|
178
182
|
// what the dispatch record stores as `prompt`. A draft that merely names
|
|
179
183
|
// Karpathy (or carries a copy with a word wrong) does not count as carrying
|
|
180
184
|
// the canonical block, so the block is added rather than trusted.
|
|
181
|
-
const effectivePrompt = ensureKarpathyBlock(ensureArtifactContractBlock(`${memoryAugmentedBody}${isolationBlock}${mustLsFilesBlock}`, contractBlock));
|
|
185
|
+
const effectivePrompt = ensureKarpathyBlock(ensureArtifactContractBlock(`${memoryAugmentedBody}${isolationBlock}${mustLsFilesBlock}${scratch.block}`, contractBlock));
|
|
182
186
|
// Findings travel as WARNINGS, never as a refusal, and they are read off the
|
|
183
187
|
// CALLER's prompt rather than the assembled one — both decisions are measured
|
|
184
188
|
// and recorded on `dispatch-cli-invocation-check.ts`.
|
|
@@ -187,7 +191,8 @@ export async function composeDispatchPrompt(io, input) {
|
|
|
187
191
|
const warnings = [
|
|
188
192
|
...decision.warnings,
|
|
189
193
|
...deprecatedReviewerWarnings(role),
|
|
190
|
-
...invocationWarnings
|
|
194
|
+
...invocationWarnings,
|
|
195
|
+
...(scratch.warning === null ? [] : [scratch.warning])
|
|
191
196
|
];
|
|
192
197
|
return { adapter, effectivePrompt, warnings, mustLsFilesVerification };
|
|
193
198
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** The heading the block carries, and the marker a reader looks for. */
|
|
2
|
+
export declare const SCRATCH_PATH_BLOCK_HEADING = "Scratch path (REQUIRED \u2014 absolute path; never a cwd-relative redirect)";
|
|
3
|
+
/** Where the absolute path goes in the template. */
|
|
4
|
+
export declare const SCRATCH_DIR_PLACEHOLDER = "{{scratchDir}}";
|
|
5
|
+
/**
|
|
6
|
+
* The canonical block, verbatim, with the path left as a placeholder: the
|
|
7
|
+
* path differs for every dispatch, so the template is what can be pinned
|
|
8
|
+
* against the reference file's fenced copy.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SCRATCH_PATH_BLOCK_TEMPLATE = "Scratch path (REQUIRED \u2014 absolute path; never a cwd-relative redirect)\n\nWrite every temporary file for this task under this ABSOLUTE path:\n{{scratchDir}}\n\nNever redirect to a path that depends on the working directory \u2014 `2> out.err`, `> run.log`, `./scratch/`. A cwd-relative redirect writes wherever the task happens to `cd`: measured 2026-10-02, five zero-byte `*.err` captures landed at the repository root and were committed, and `git status` stayed clean because the files were tracked. Use the absolute path above; it lives under the session's runtime dir, which is gitignored, so nothing written there can be committed by accident.\n";
|
|
11
|
+
/**
|
|
12
|
+
* The path in the form every shell accepts: forward slashes on every
|
|
13
|
+
* platform.
|
|
14
|
+
*
|
|
15
|
+
* A Windows path spelled with backslashes is an ESCAPE SEQUENCE to a POSIX
|
|
16
|
+
* shell — `> D:\repo\x.log` there writes a file named `D:repox.log` into the
|
|
17
|
+
* CURRENT directory, which is the exact leak this block exists to stop. The
|
|
18
|
+
* forward-slash form is accepted by bash, cmd, PowerShell and Node alike.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toShellPath(path: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* The absolute scratch directory for one dispatch.
|
|
23
|
+
*
|
|
24
|
+
* Pure, and independent of the working directory: the only input that is not
|
|
25
|
+
* the project root and the two id segments is the filesystem separator. A
|
|
26
|
+
* RELATIVE project root is resolved against the cwd — the dispatch CLI passes
|
|
27
|
+
* an absolute one (`options.project ?? process.cwd()`), and the emitted path
|
|
28
|
+
* is absolute either way.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveScratchDir(projectRoot: string, sid: string, role: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* The block for one dispatch, with the absolute path substituted.
|
|
33
|
+
*
|
|
34
|
+
* Pure. The replacement is done with a FUNCTION so a path that contains a
|
|
35
|
+
* `$` sequence is inserted literally rather than read as a replacement
|
|
36
|
+
* pattern.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildScratchPathBlock(scratchDir: string): string;
|
|
39
|
+
/** The outcome of creating the scratch directory. */
|
|
40
|
+
export type ScratchDirState = {
|
|
41
|
+
readonly ok: true;
|
|
42
|
+
} | {
|
|
43
|
+
readonly ok: false;
|
|
44
|
+
readonly reason: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Create the scratch directory so the FIRST redirect into it works.
|
|
48
|
+
*
|
|
49
|
+
* A redirect into a directory that does not exist fails, and an agent that
|
|
50
|
+
* hits that failure is an agent that may fall back to a cwd-relative path —
|
|
51
|
+
* the leak this block exists to stop. The failure is reported rather than
|
|
52
|
+
* swallowed: the caller turns it into a dispatch warning, so a scratch
|
|
53
|
+
* directory that could not be created is visible instead of silent.
|
|
54
|
+
*/
|
|
55
|
+
export declare function ensureScratchDir(scratchDir: string): ScratchDirState;
|
|
56
|
+
/** What one dispatch's prompt gains. */
|
|
57
|
+
export type ScratchPathInjection = {
|
|
58
|
+
/** The block, with the absolute path substituted. */
|
|
59
|
+
readonly block: string;
|
|
60
|
+
/** The absolute scratch directory, with the platform's own separators. */
|
|
61
|
+
readonly scratchDir: string;
|
|
62
|
+
/** Null when the directory exists; the reason when it does not. */
|
|
63
|
+
readonly warning: string | null;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The scratch-path block for one dispatch, and the one side effect that makes
|
|
67
|
+
* it usable: the directory is created so the first redirect into it works.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildScratchPathInjection(input: {
|
|
70
|
+
projectRoot: string;
|
|
71
|
+
sid: string;
|
|
72
|
+
role: string;
|
|
73
|
+
}): ScratchPathInjection;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scratch-path block: the ABSOLUTE directory a dispatched sub-agent writes
|
|
3
|
+
* its temporary files to, machine-injected into every dispatch prompt.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS MODULE EXISTS. The rule "a leaf's scratch must not depend on the
|
|
6
|
+
* cwd it happens to be in" lived only as prose in an orchestrator's brief, so
|
|
7
|
+
* it was exactly as strong as the orchestrator's memory at 3am. Measured
|
|
8
|
+
* 2026-10-02: five zero-byte `*.err` captures — the `2> name.err` of five
|
|
9
|
+
* per-file test runs — landed at the repository root and were COMMITTED;
|
|
10
|
+
* `git status` stayed clean because the files were tracked, and neither the
|
|
11
|
+
* file-size census nor eslint reads a `.err`. An obligation a busy caller can
|
|
12
|
+
* forget is not an executor; this is the same shape as the Karpathy block
|
|
13
|
+
* (`src/services/dispatch/karpathy-block.ts`), which replaced the same class
|
|
14
|
+
* of prose obligation for the same reason.
|
|
15
|
+
*
|
|
16
|
+
* SOURCE OF TRUTH: the fenced block in
|
|
17
|
+
* `skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md` is the canonical
|
|
18
|
+
* human-facing text; `SCRATCH_PATH_BLOCK_TEMPLATE` below is its machine copy,
|
|
19
|
+
* and `tests/unit/cli/commands/dispatch-scratch-path-block.test.ts` asserts
|
|
20
|
+
* the two are byte-equal, so the copy cannot drift silently. A second copy
|
|
21
|
+
* that CAN drift is the same defect class as the dropped block; a pinned one
|
|
22
|
+
* is not.
|
|
23
|
+
*
|
|
24
|
+
* WHY THE PATH IS ABSOLUTE, AND WHY IT IS THIS SHAPE.
|
|
25
|
+
* - Absolute: a redirect that depends on the cwd writes wherever the task
|
|
26
|
+
* happens to `cd`. The path is derived from the project root alone.
|
|
27
|
+
* - Under the session's runtime dir (`.peaks/_runtime/<sessionId>/<role>/`):
|
|
28
|
+
* the shape the backlog names, and the runtime tree is gitignored, so a
|
|
29
|
+
* stray capture written there can never be committed by accident.
|
|
30
|
+
* - Per role: two leaves dispatched in parallel get two directories, so
|
|
31
|
+
* their captures cannot collide.
|
|
32
|
+
*
|
|
33
|
+
* The block is injected for EVERY role and regardless of which optional
|
|
34
|
+
* blocks a dispatch carries: the point of the block is that the rule is not
|
|
35
|
+
* per-brief.
|
|
36
|
+
*/
|
|
37
|
+
import { mkdirSync } from 'node:fs';
|
|
38
|
+
import { join, resolve } from 'node:path';
|
|
39
|
+
import { getSessionDir, isSinglePathSegment } from '../../services/session/getSessionDir.js';
|
|
40
|
+
/** The heading the block carries, and the marker a reader looks for. */
|
|
41
|
+
export const SCRATCH_PATH_BLOCK_HEADING = 'Scratch path (REQUIRED — absolute path; never a cwd-relative redirect)';
|
|
42
|
+
/** Where the absolute path goes in the template. */
|
|
43
|
+
export const SCRATCH_DIR_PLACEHOLDER = '{{scratchDir}}';
|
|
44
|
+
/**
|
|
45
|
+
* The canonical block, verbatim, with the path left as a placeholder: the
|
|
46
|
+
* path differs for every dispatch, so the template is what can be pinned
|
|
47
|
+
* against the reference file's fenced copy.
|
|
48
|
+
*/
|
|
49
|
+
export const SCRATCH_PATH_BLOCK_TEMPLATE = `${SCRATCH_PATH_BLOCK_HEADING}
|
|
50
|
+
|
|
51
|
+
Write every temporary file for this task under this ABSOLUTE path:
|
|
52
|
+
${SCRATCH_DIR_PLACEHOLDER}
|
|
53
|
+
|
|
54
|
+
Never redirect to a path that depends on the working directory — \`2> out.err\`, \`> run.log\`, \`./scratch/\`. A cwd-relative redirect writes wherever the task happens to \`cd\`: measured 2026-10-02, five zero-byte \`*.err\` captures landed at the repository root and were committed, and \`git status\` stayed clean because the files were tracked. Use the absolute path above; it lives under the session's runtime dir, which is gitignored, so nothing written there can be committed by accident.
|
|
55
|
+
`;
|
|
56
|
+
/** The session id the dispatch context itself uses when none is bound. */
|
|
57
|
+
const UNKNOWN_SESSION_ID = 'unknown-sid';
|
|
58
|
+
/** The role segment used when the role is not a single safe path segment. */
|
|
59
|
+
const UNKNOWN_ROLE = 'unknown-role';
|
|
60
|
+
/**
|
|
61
|
+
* The path in the form every shell accepts: forward slashes on every
|
|
62
|
+
* platform.
|
|
63
|
+
*
|
|
64
|
+
* A Windows path spelled with backslashes is an ESCAPE SEQUENCE to a POSIX
|
|
65
|
+
* shell — `> D:\repo\x.log` there writes a file named `D:repox.log` into the
|
|
66
|
+
* CURRENT directory, which is the exact leak this block exists to stop. The
|
|
67
|
+
* forward-slash form is accepted by bash, cmd, PowerShell and Node alike.
|
|
68
|
+
*/
|
|
69
|
+
export function toShellPath(path) {
|
|
70
|
+
return path.split('\\').join('/');
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The absolute scratch directory for one dispatch.
|
|
74
|
+
*
|
|
75
|
+
* Pure, and independent of the working directory: the only input that is not
|
|
76
|
+
* the project root and the two id segments is the filesystem separator. A
|
|
77
|
+
* RELATIVE project root is resolved against the cwd — the dispatch CLI passes
|
|
78
|
+
* an absolute one (`options.project ?? process.cwd()`), and the emitted path
|
|
79
|
+
* is absolute either way.
|
|
80
|
+
*/
|
|
81
|
+
export function resolveScratchDir(projectRoot, sid, role) {
|
|
82
|
+
const root = resolve(projectRoot);
|
|
83
|
+
const sessionId = isSinglePathSegment(sid) ? sid : UNKNOWN_SESSION_ID;
|
|
84
|
+
const roleSegment = isSinglePathSegment(role) ? role : UNKNOWN_ROLE;
|
|
85
|
+
return join(getSessionDir(root, sessionId), roleSegment, 'scratch');
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The block for one dispatch, with the absolute path substituted.
|
|
89
|
+
*
|
|
90
|
+
* Pure. The replacement is done with a FUNCTION so a path that contains a
|
|
91
|
+
* `$` sequence is inserted literally rather than read as a replacement
|
|
92
|
+
* pattern.
|
|
93
|
+
*/
|
|
94
|
+
export function buildScratchPathBlock(scratchDir) {
|
|
95
|
+
return SCRATCH_PATH_BLOCK_TEMPLATE.replace(SCRATCH_DIR_PLACEHOLDER, () => toShellPath(scratchDir));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create the scratch directory so the FIRST redirect into it works.
|
|
99
|
+
*
|
|
100
|
+
* A redirect into a directory that does not exist fails, and an agent that
|
|
101
|
+
* hits that failure is an agent that may fall back to a cwd-relative path —
|
|
102
|
+
* the leak this block exists to stop. The failure is reported rather than
|
|
103
|
+
* swallowed: the caller turns it into a dispatch warning, so a scratch
|
|
104
|
+
* directory that could not be created is visible instead of silent.
|
|
105
|
+
*/
|
|
106
|
+
export function ensureScratchDir(scratchDir) {
|
|
107
|
+
try {
|
|
108
|
+
mkdirSync(scratchDir, { recursive: true });
|
|
109
|
+
return { ok: true };
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
return { ok: false, reason: error instanceof Error ? error.message : String(error) };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The scratch-path block for one dispatch, and the one side effect that makes
|
|
117
|
+
* it usable: the directory is created so the first redirect into it works.
|
|
118
|
+
*/
|
|
119
|
+
export function buildScratchPathInjection(input) {
|
|
120
|
+
const scratchDir = resolveScratchDir(input.projectRoot, input.sid, input.role);
|
|
121
|
+
const state = ensureScratchDir(scratchDir);
|
|
122
|
+
return {
|
|
123
|
+
scratchDir,
|
|
124
|
+
block: buildScratchPathBlock(scratchDir),
|
|
125
|
+
warning: state.ok === true
|
|
126
|
+
? null
|
|
127
|
+
: `scratch directory could not be created (${state.reason}); the sub-agent must ` +
|
|
128
|
+
'create it before writing scratch into it, and must not fall back to a ' +
|
|
129
|
+
'cwd-relative path'
|
|
130
|
+
};
|
|
131
|
+
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* `hooks-install-envelopes.ts`, and the scope / IDE resolution in
|
|
19
19
|
* `hooks-command-shared.ts`.
|
|
20
20
|
*/
|
|
21
|
-
import { existsSync, copyFileSync, mkdirSync } from 'node:fs';
|
|
21
|
+
import { existsSync, copyFileSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
22
22
|
import { dirname, resolve } from 'node:path';
|
|
23
23
|
import { fileURLToPath } from 'node:url';
|
|
24
24
|
import { resolveIdeOptionHelp } from '../../services/ide/ide-registry.js';
|
|
@@ -76,15 +76,43 @@ function copyBridgeHookIfPresent(userHome, dryRun = false) {
|
|
|
76
76
|
copyFileSync(source, target);
|
|
77
77
|
return { copied: true, source, target };
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* The sibling file the copied code-gate wrapper reads to find the CLI.
|
|
81
|
+
*
|
|
82
|
+
* The wrapper is a THIN WRAPPER over the Node command: where a CLI is
|
|
83
|
+
* reachable it execs `peaks code-gate`, so there is one implementation of the
|
|
84
|
+
* rule wherever Node exists. It looks for that CLI in two places — `peaks` on
|
|
85
|
+
* PATH, and this file. What this file carries is the PACKAGE ROOT, which is
|
|
86
|
+
* INSTALLER information (where the installed package lives), not PROJECT
|
|
87
|
+
* information: the project root is per-project and one user-global copy of
|
|
88
|
+
* the wrapper serves every project, so it cannot be stored here.
|
|
89
|
+
*/
|
|
90
|
+
const CODE_GATE_PACKAGE_ROOT_FILE = 'pre-tool-code-gate.package-root';
|
|
91
|
+
/**
|
|
92
|
+
* The package root this CLI was loaded from: `<root>/src/cli/commands` in the
|
|
93
|
+
* source tree, `<root>/dist/cli/commands` in a build. Three levels up is the
|
|
94
|
+
* root in both, and it is the directory that holds `bin/peaks.js`.
|
|
95
|
+
*/
|
|
96
|
+
const PACKAGE_ROOT = resolve(MODULE_DIR, '..', '..', '..');
|
|
97
|
+
/**
|
|
98
|
+
* Write the package-root pointer next to the copied wrapper.
|
|
99
|
+
*
|
|
100
|
+
* It is written next to the script and NOT inside it: the script is copied
|
|
101
|
+
* once, byte for byte, and the pointer is a separate file the wrapper reads
|
|
102
|
+
* at run time. A dry-run install writes nothing.
|
|
103
|
+
*/
|
|
104
|
+
function writeCodeGatePackageRootPointer(hooksDir) {
|
|
105
|
+
writeFileSync(resolve(hooksDir, CODE_GATE_PACKAGE_ROOT_FILE), `${PACKAGE_ROOT}\n`, 'utf8');
|
|
106
|
+
}
|
|
79
107
|
/**
|
|
80
108
|
* The same distribution for the code-gate hook
|
|
81
109
|
* source (`src/services/hooks/pre-tool-code-gate.sh`) into the user-
|
|
82
110
|
* global peaks-code hooks dir, mirroring the bridge-hook copy. The
|
|
83
|
-
* hook itself is vendor-neutral (no
|
|
84
|
-
*
|
|
111
|
+
* hook itself is vendor-neutral (no IDE / vendor names in the
|
|
112
|
+
* script) — this installer is the vendor adapter that decides
|
|
85
113
|
* where the file lands. The CLI command `peaks code-gate` is the
|
|
86
114
|
* runtime entry; the shell script is the canonical artifact distributed
|
|
87
|
-
* alongside the bridge hook.
|
|
115
|
+
* alongside the bridge hook, and it is a thin wrapper over that command.
|
|
88
116
|
*/
|
|
89
117
|
function copyCodeGateHookIfPresent(userHome, dryRun = false) {
|
|
90
118
|
const source = resolve(MODULE_DIR, '..', '..', 'services', 'hooks', 'pre-tool-code-gate.sh');
|
|
@@ -97,6 +125,7 @@ function copyCodeGateHookIfPresent(userHome, dryRun = false) {
|
|
|
97
125
|
}
|
|
98
126
|
mkdirSync(dirname(target), { recursive: true });
|
|
99
127
|
copyFileSync(source, target);
|
|
128
|
+
writeCodeGatePackageRootPointer(dirname(target));
|
|
100
129
|
return { copied: true, source, target };
|
|
101
130
|
}
|
|
102
131
|
/** The `{ copied: false, source: '', target: '' }` a non-global scope reports. */
|
|
@@ -138,15 +167,15 @@ function runHooksInstall(io, options) {
|
|
|
138
167
|
export function registerHooksCommands(program, io) {
|
|
139
168
|
const hooks = program
|
|
140
169
|
.command('hooks')
|
|
141
|
-
.description("Manage the Peaks-managed hook
|
|
170
|
+
.description("Manage the Peaks-managed hook entries in the adapter's settings.json (default: .claude/settings.json for Claude, .trae/settings.json for Trae). The installed set is the adapter's own peaks-managed entries — for Claude Code: peaks gate enforce (Bash and MCP tool calls), peaks code-gate (Edit|Write|MultiEdit), peaks outer-cache write, peaks session primer, peaks session reinject, peaks compact settle — plus the Layer-3 permissions.deny entries (worktree governance); the other adapters install their own single hook entry. The legacy progress-start hook (auto-spawn sub-agent progress terminal) is not installed (slice #014) — sub-agent progress is now surfaced via the dispatch + heartbeat flow (`peaks sub-agent dispatch` / `peaks sub-agent heartbeat`). The IDE is auto-detected from env / cwd; override with --ide <id>.");
|
|
142
171
|
addJsonOption(hooks
|
|
143
172
|
.command('install')
|
|
144
|
-
.description(`Install the peaks-managed
|
|
173
|
+
.description(`Install the peaks-managed hook entries into the adapter's settings.json — for Claude Code: peaks gate enforce (Bash and MCP tool calls), peaks code-gate (Edit|Write|MultiEdit), peaks outer-cache write, peaks session primer, peaks session reinject, peaks compact settle — plus the Layer-3 permissions.deny entries (worktree governance); the other adapters install their own single hook entry. The legacy progress-start entry is not installed (slice #014). Idempotent: re-runs are no-ops. Project scope by default. --global additionally copies the two hook scripts (pre-tool-code-gate.sh and pre-tool-superpowers-bridge.sh) and writes the package-root pointer pre-tool-code-gate.package-root into the user-global ~/.claude/skills/peaks-code/hooks/ directory; the project scope copies nothing there.`)
|
|
145
174
|
.option('--global', 'install into the user-level ~/.claude/settings.json instead of the project')
|
|
146
175
|
.option('--project <path>', 'project root path (auto-detected from cwd when omitted)')
|
|
147
176
|
.option('--ide <id>', resolveIdeOptionHelp())
|
|
148
177
|
.option('--dry-run', 'show what would change without writing')
|
|
149
|
-
.option('--no-progress', '
|
|
178
|
+
.option('--no-progress', 'retained for backward compatibility and currently a no-op: the progress-start entry is no longer installed (slice #014), so the installed entry set is identical with or without this flag')).action((options) => runHooksInstall(io, options));
|
|
150
179
|
registerHooksUninstallCommand(hooks, io);
|
|
151
180
|
registerHooksStatusCommand(hooks, io);
|
|
152
181
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/cli/commands/hooks-uninstall-command.ts
|
|
2
2
|
//
|
|
3
|
-
// `peaks hooks uninstall` — remove the peaks-managed
|
|
4
|
-
//
|
|
5
|
-
// out of `hooks-commands.ts`; the verb
|
|
6
|
-
// are unchanged.
|
|
3
|
+
// `peaks hooks uninstall` — remove the peaks-managed hook entries (the whole
|
|
4
|
+
// set the install writes, plus a legacy progress-start entry an install from
|
|
5
|
+
// before slice #014 left behind). Split out of `hooks-commands.ts`; the verb
|
|
6
|
+
// name, its options and the envelope shape are unchanged.
|
|
7
7
|
import { listSuperpowersDenyEntries, removeHookInstall } from '../../services/skills/hooks-settings-service.js';
|
|
8
8
|
import { resolveIdeOptionHelp } from '../../services/ide/ide-registry.js';
|
|
9
9
|
import { fail, ok } from 'peaks-loop-shared/result';
|
|
@@ -36,7 +36,7 @@ function runHooksUninstall(io, options) {
|
|
|
36
36
|
export function registerHooksUninstallCommand(hooks, io) {
|
|
37
37
|
addJsonOption(hooks
|
|
38
38
|
.command('uninstall')
|
|
39
|
-
.description('Remove the peaks-managed
|
|
39
|
+
.description('Remove the peaks-managed hook entries from the target settings.json — for Claude Code: peaks gate enforce (Bash and MCP tool calls), peaks code-gate (Edit|Write|MultiEdit), peaks outer-cache write, peaks session primer, peaks session reinject, peaks compact settle — plus the Layer-3 permissions.deny entries (worktree governance); the other adapters remove their own single hook entry. A legacy progress-start entry left behind by an install from before slice #014 is removed too (sentinel-based scan). Third-party hooks are preserved.')
|
|
40
40
|
.option('--global', 'remove from the user-level ~/.claude/settings.json instead of the project')
|
|
41
41
|
.option('--project <path>', 'project root path (auto-detected from cwd when omitted)')
|
|
42
42
|
.option('--ide <id>', resolveIdeOptionHelp())).action((options) => runHooksUninstall(io, options));
|
|
@@ -1,9 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `peaks mut` —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* `peaks mut` — command builders and helper functions.
|
|
3
|
+
*
|
|
4
|
+
* Originally extracted from `mut-commands.ts` (file-size cap campaign).
|
|
5
|
+
* It holds the stub-report factories, the summary emitter, the named-error
|
|
6
|
+
* mapping, and — after the `max-lines-per-function` rule was measured at
|
|
7
|
+
* 209 code lines for `createMutCommands` — the three subcommand builders
|
|
8
|
+
* that drive the mutation pipeline (`run`, `mutants`, `asserts`).
|
|
9
|
+
* The `report` subcommand — a pure reader of an already-written file —
|
|
10
|
+
* lives with the CLI surface in `mut-commands.ts`.
|
|
11
|
+
*
|
|
12
|
+
* The named-error part exists for R7: a missing or unloadable mutation
|
|
13
|
+
* toolchain must surface a MACHINE-READABLE error code (for example
|
|
14
|
+
* `MUT_TOOLCHAIN_UNAVAILABLE`) plus an actionable message and a
|
|
15
|
+
* non-zero exit code — never `UNHANDLED_ERROR` with a bare
|
|
16
|
+
* "Cannot find package".
|
|
5
17
|
*/
|
|
6
|
-
import {
|
|
18
|
+
import { Command } from 'commander';
|
|
19
|
+
import { type AssertionsReport, type MutationReport, type StrykerInvoker } from 'peaks-loop-mut';
|
|
20
|
+
import { type ProgramIO } from '../cli-helpers.js';
|
|
21
|
+
/**
|
|
22
|
+
* Fallback code for a mutation failure that carries no named code of its
|
|
23
|
+
* own. The production invoker raises the specific codes; anything that
|
|
24
|
+
* escapes it without one still gets a stable, greppable name.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MUT_CLI_ERROR_CODE = "MUT_FAILED";
|
|
27
|
+
/**
|
|
28
|
+
* The IO the mut family writes to when the caller injects none. Same
|
|
29
|
+
* shape as `src/cli/program.ts`'s default sinks: one trailing newline
|
|
30
|
+
* per write.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_MUT_IO: ProgramIO;
|
|
33
|
+
/** The options every Stryker-backed subcommand receives. */
|
|
34
|
+
export interface MutCommandArgs {
|
|
35
|
+
readonly project: string;
|
|
36
|
+
readonly testFiles: string[];
|
|
37
|
+
readonly mutate?: string[];
|
|
38
|
+
readonly inputSig: string;
|
|
39
|
+
readonly sessionId: string;
|
|
40
|
+
readonly out: string;
|
|
41
|
+
readonly json: boolean;
|
|
42
|
+
}
|
|
7
43
|
/**
|
|
8
44
|
* Pure helper: a stub AssertionsReport used when only Stryker ran.
|
|
9
45
|
* The mutants-only path does NOT touch the AST scanner; we still need
|
|
@@ -22,9 +58,40 @@ export declare function emptyMutation(): MutationReport;
|
|
|
22
58
|
* both `--json` and the human-readable branches so the `passed` /
|
|
23
59
|
* `sha256` shape stays consistent regardless of TTY mode.
|
|
24
60
|
*/
|
|
25
|
-
export declare function emitSummary(json: boolean, payload: {
|
|
61
|
+
export declare function emitSummary(io: ProgramIO, json: boolean, payload: {
|
|
26
62
|
ok: true;
|
|
27
63
|
sha256: string;
|
|
28
64
|
passed: boolean;
|
|
29
65
|
path: string;
|
|
30
66
|
}): void;
|
|
67
|
+
/**
|
|
68
|
+
* Read the machine-readable code off a failure. The production invoker
|
|
69
|
+
* raises named codes (`MUT_TOOLCHAIN_UNAVAILABLE`, `MUT_NO_MUTANTS`,
|
|
70
|
+
* `MUT_MUTATE_PATTERN_REQUIRED`, …) and `runMutation` preserves them
|
|
71
|
+
* while wrapping. Anything without a recognised code falls back to
|
|
72
|
+
* `MUT_FAILED` so the envelope is never anonymous.
|
|
73
|
+
*/
|
|
74
|
+
export declare function mutErrorCode(err: unknown): string;
|
|
75
|
+
/** The human-readable half of the envelope. */
|
|
76
|
+
export declare function mutErrorMessage(err: unknown): string;
|
|
77
|
+
/**
|
|
78
|
+
* Emit the failure envelope on stderr and set a non-zero exit code.
|
|
79
|
+
* stdout stays reserved for the `--json` payload (R6), so the envelope
|
|
80
|
+
* goes to stderr exactly like every other peaks CLI error.
|
|
81
|
+
*/
|
|
82
|
+
export declare function emitMutError(io: ProgramIO, err: unknown): void;
|
|
83
|
+
/**
|
|
84
|
+
* `peaks mut run` — the full mut pipeline (Stryker + assertion scan +
|
|
85
|
+
* report). One-axis: --session-id required.
|
|
86
|
+
*/
|
|
87
|
+
export declare function buildMutRunCommand(invokeStryker: StrykerInvoker, io: ProgramIO): Command;
|
|
88
|
+
/**
|
|
89
|
+
* `peaks mut mutants` — Stryker only; writes a stub-assertions
|
|
90
|
+
* mut-report.json. One-axis: --session-id required.
|
|
91
|
+
*/
|
|
92
|
+
export declare function buildMutMutantsCommand(invokeStryker: StrykerInvoker, io: ProgramIO): Command;
|
|
93
|
+
/**
|
|
94
|
+
* `peaks mut asserts` — the assertion scan only; writes a mut-report.json
|
|
95
|
+
* with an empty mutation block. One-axis: --session-id required.
|
|
96
|
+
*/
|
|
97
|
+
export declare function buildMutAssertsCommand(io: ProgramIO): Command;
|