peaks-loop 4.1.18 → 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 +126 -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 +26 -18
- 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/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/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-profile.d.ts +23 -0
- package/dist/services/code/auto-compact-profile.js +51 -0
- 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/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 +2 -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/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/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/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-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 +8 -9
- package/schemas/doctor-report.schema.json +1 -1
- 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 +4 -4
- 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 +3 -1
- 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 +3 -1
- 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
|
@@ -71,13 +71,29 @@ export const CURSOR_ADAPTER = {
|
|
|
71
71
|
// that can host peaks statusline output, so opt in to the capability.
|
|
72
72
|
statusline: true
|
|
73
73
|
},
|
|
74
|
-
// Standards:
|
|
75
|
-
// the
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
74
|
+
// Standards profile: Cursor reads `AGENTS.md` natively — it is one of the
|
|
75
|
+
// tools the AGENTS.md standard (OpenAI's AGENTS.md, now under the Linux
|
|
76
|
+
// Foundation's Agentic AI Foundation) is adopted by. So the shared
|
|
77
|
+
// cross-tool body IS Cursor's project-instructions file, and no CLAUDE.md
|
|
78
|
+
// pointer is needed next to it.
|
|
79
|
+
//
|
|
80
|
+
// `rulesDir` stays `null`: where Cursor looks for MODULE-level rules is
|
|
81
|
+
// still unverified (see slice #012+ for the real-install dogfood), so the
|
|
82
|
+
// profile claims only the root file.
|
|
83
|
+
standardsProfile: {
|
|
84
|
+
rootFile: 'AGENTS.md',
|
|
85
|
+
rulesDir: null,
|
|
86
|
+
rulesFileGlob: '**/*.md',
|
|
87
|
+
autoLoaded: true,
|
|
88
|
+
format: 'markdown',
|
|
89
|
+
migrationHint: 'Cursor reads AGENTS.md directly; no CLAUDE.md pointer is written.'
|
|
90
|
+
},
|
|
91
|
+
// Standards: the ROOT file is verified above (AGENTS.md); the `rulesDir`
|
|
92
|
+
// and `skillInstall` fields remain UNVERIFIED pending slice #012+
|
|
93
|
+
// (Cursor real-install dogfood). Until then the postinstall script writes
|
|
94
|
+
// skills + output-styles to the legacy `~/.claude/{skills,output-styles}`
|
|
95
|
+
// paths with a stderr warning. Users who want Cursor-specific paths must
|
|
96
|
+
// move the files manually.
|
|
81
97
|
// Slice 4.0.8 RD §5: Cursor vendor signal is unverified; reserve-only resolver.
|
|
82
98
|
resolveCallerId: (env) => {
|
|
83
99
|
const e = env ?? process.env;
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { type SkillPresenceMode } from '../skills/skill-presence-service.js';
|
|
22
22
|
import type { State24hSnapshot } from '../24h-mode/state.js';
|
|
23
|
-
import { type
|
|
23
|
+
import { type AutoCompactProfile } from '../code/auto-compact-modes.js';
|
|
24
|
+
import { type AutoCompactProfileSource } from '../code/auto-compact-profile.js';
|
|
24
25
|
export interface ResolvedPresenceMode {
|
|
25
26
|
readonly mode: SkillPresenceMode | null;
|
|
26
27
|
readonly skill: string | null;
|
|
@@ -43,8 +44,14 @@ export interface ModeStatus {
|
|
|
43
44
|
readonly h24State: State24hSnapshot | null;
|
|
44
45
|
/** Job-mode flag from `job-shape.json` (`false` when undecided / unreadable). */
|
|
45
46
|
readonly jobMode: boolean;
|
|
46
|
-
/**
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The resolved auto-compact profile: `standard` or `eager`. It is a PUBLIC
|
|
49
|
+
* choice — the project setting `autoCompactProfile` or an explicit
|
|
50
|
+
* `--mode`, never the 24h state machine.
|
|
51
|
+
*/
|
|
52
|
+
readonly autoCompactProfile: AutoCompactProfile;
|
|
53
|
+
/** Where that profile came from, so the answer is diagnosable. */
|
|
54
|
+
readonly autoCompactProfileSource: AutoCompactProfileSource;
|
|
48
55
|
/** Thresholds backing `autoCompactProfile` (display aid). */
|
|
49
56
|
readonly autoCompactThresholds: {
|
|
50
57
|
readonly autoFire: number;
|
|
@@ -58,35 +65,27 @@ export interface ModeStatus {
|
|
|
58
65
|
*/
|
|
59
66
|
export declare function resolvePresenceMode(projectRoot: string): ResolvedPresenceMode;
|
|
60
67
|
/**
|
|
61
|
-
* Resolve the auto-compact profile: `
|
|
62
|
-
*
|
|
68
|
+
* Resolve the auto-compact profile: `standard` (the v2.13.0 zero-pause
|
|
69
|
+
* contract thresholds) or `eager` (the earlier-firing thresholds).
|
|
63
70
|
*
|
|
64
|
-
*
|
|
71
|
+
* The profile is a PUBLIC choice, resolved in one order:
|
|
65
72
|
*
|
|
66
|
-
* 1.
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* `WAITING_USER`) — the durable, session-scoped record.
|
|
73
|
+
* 1. an explicit `--mode` on this invocation (one call, one override)
|
|
74
|
+
* 2. the project setting `autoCompactProfile`
|
|
75
|
+
* 3. the default `'standard'`
|
|
70
76
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* stamp does not survive the next skill workflow either. The observed
|
|
79
|
-
* consequence was a `24H_ACTIVE` session resolving to `standard` and
|
|
80
|
-
* auto-compacting LATER than a plain session, the opposite of the
|
|
81
|
-
* documented contract.
|
|
77
|
+
* The 24h mode does NOT take part. It used to: the profile was derived from
|
|
78
|
+
* the presence mode and from the 24h state machine, which made the
|
|
79
|
+
* compaction cadence a private property of one mode — a 24h session
|
|
80
|
+
* compacted earlier than a plain one without anybody asking for it. A
|
|
81
|
+
* project that wants to compact earlier now says so with
|
|
82
|
+
* `peaks preferences set --key autoCompactProfile --value eager`, and
|
|
83
|
+
* nothing changes under it silently.
|
|
82
84
|
*
|
|
83
|
-
* The
|
|
84
|
-
*
|
|
85
|
-
* `WAITING_USER`, and keep it when only the state machine knows.
|
|
86
|
-
* Nothing that resolved to `partial` before resolves to `standard`
|
|
87
|
-
* now; a project with no 24h run is byte-identical to before.
|
|
85
|
+
* The resolution itself lives in `services/code/auto-compact-profile.ts`;
|
|
86
|
+
* this function keeps the name and the arity every existing caller uses.
|
|
88
87
|
*/
|
|
89
|
-
export declare function resolveAutoCompactProfile(projectRoot: string):
|
|
88
|
+
export declare function resolveAutoCompactProfile(projectRoot: string): AutoCompactProfile;
|
|
90
89
|
/**
|
|
91
90
|
* Assemble the full stacked status. `sessionId` defaults to the
|
|
92
91
|
* canonical binding when omitted.
|
|
@@ -26,6 +26,7 @@ import { getCurrentSessionId } from '../skills/skill-presence-service.js';
|
|
|
26
26
|
import { read24hState } from '../24h-mode/store.js';
|
|
27
27
|
import { readJobShapeDecision } from '../code/job-shape-decision.js';
|
|
28
28
|
import { AUTO_COMPACT_THRESHOLDS } from '../code/auto-compact-modes.js';
|
|
29
|
+
import { resolveAutoCompactProfile as resolveProfileSelection } from '../code/auto-compact-profile.js';
|
|
29
30
|
/**
|
|
30
31
|
* Read the active presence mode via the canonical lease projection.
|
|
31
32
|
* Never throws.
|
|
@@ -45,64 +46,39 @@ export function resolvePresenceMode(projectRoot) {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
|
-
*
|
|
49
|
+
* Resolve the auto-compact profile: `standard` (the v2.13.0 zero-pause
|
|
50
|
+
* contract thresholds) or `eager` (the earlier-firing thresholds).
|
|
49
51
|
*
|
|
50
|
-
*
|
|
51
|
-
* it (the run is still on — the user just has to answer). `BRAINSTORM`
|
|
52
|
-
* / `USER_CONFIRM` precede the run, `HANDOFF` ends it, `IDLE` means it
|
|
53
|
-
* never started.
|
|
54
|
-
*/
|
|
55
|
-
const ENGAGED_24H_STATES = new Set(['24H_ACTIVE', 'WAITING_USER']);
|
|
56
|
-
/**
|
|
57
|
-
* Fail-soft read of the bound session's 24h state machine: `true` when
|
|
58
|
-
* the long run is engaged. Every degradation (no session, missing or
|
|
59
|
-
* malformed snapshot) reads as `false` so a non-24h project is
|
|
60
|
-
* untouched by this signal.
|
|
61
|
-
*/
|
|
62
|
-
function is24hRunEngaged(projectRoot) {
|
|
63
|
-
try {
|
|
64
|
-
const sessionId = getCurrentSessionId(projectRoot);
|
|
65
|
-
if (sessionId === null)
|
|
66
|
-
return false;
|
|
67
|
-
return ENGAGED_24H_STATES.has(read24hState(projectRoot, sessionId).state);
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Resolve the auto-compact profile: `partial` (earlier thresholds for
|
|
75
|
-
* long-run sessions) or `standard`.
|
|
52
|
+
* The profile is a PUBLIC choice, resolved in one order:
|
|
76
53
|
*
|
|
77
|
-
*
|
|
54
|
+
* 1. an explicit `--mode` on this invocation (one call, one override)
|
|
55
|
+
* 2. the project setting `autoCompactProfile`
|
|
56
|
+
* 3. the default `'standard'`
|
|
78
57
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
58
|
+
* The 24h mode does NOT take part. It used to: the profile was derived from
|
|
59
|
+
* the presence mode and from the 24h state machine, which made the
|
|
60
|
+
* compaction cadence a private property of one mode — a 24h session
|
|
61
|
+
* compacted earlier than a plain one without anybody asking for it. A
|
|
62
|
+
* project that wants to compact earlier now says so with
|
|
63
|
+
* `peaks preferences set --key autoCompactProfile --value eager`, and
|
|
64
|
+
* nothing changes under it silently.
|
|
83
65
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* presence lease, and `applyAutoEngagePresenceMode` can only stamp
|
|
87
|
-
* leases that are already in flight — entering `24H_ACTIVE` with no
|
|
88
|
-
* in-flight lease fails closed as `{ applied: false, reason:
|
|
89
|
-
* 'no-in-flight-lease' }`. A fresh lease is also written without a
|
|
90
|
-
* mode (`workflow-presence-lifecycle.initWorkflow`), so a successful
|
|
91
|
-
* stamp does not survive the next skill workflow either. The observed
|
|
92
|
-
* consequence was a `24H_ACTIVE` session resolving to `standard` and
|
|
93
|
-
* auto-compacting LATER than a plain session, the opposite of the
|
|
94
|
-
* documented contract.
|
|
95
|
-
*
|
|
96
|
-
* The union is a superset of both the pre-2026-09-09 mapping (state
|
|
97
|
-
* mode): keep partial while the mode says `24h` even in
|
|
98
|
-
* `WAITING_USER`, and keep it when only the state machine knows.
|
|
99
|
-
* Nothing that resolved to `partial` before resolves to `standard`
|
|
100
|
-
* now; a project with no 24h run is byte-identical to before.
|
|
66
|
+
* The resolution itself lives in `services/code/auto-compact-profile.ts`;
|
|
67
|
+
* this function keeps the name and the arity every existing caller uses.
|
|
101
68
|
*/
|
|
102
69
|
export function resolveAutoCompactProfile(projectRoot) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
70
|
+
return resolveProfile(projectRoot).profile;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The single place this module resolves the auto-compact profile.
|
|
74
|
+
*
|
|
75
|
+
* Both public entry points — `resolveAutoCompactProfile` and
|
|
76
|
+
* `resolveModeStatus` — go through it, so the profile the status command
|
|
77
|
+
* reports and the profile the services apply come from ONE call and cannot
|
|
78
|
+
* disagree.
|
|
79
|
+
*/
|
|
80
|
+
function resolveProfile(projectRoot) {
|
|
81
|
+
return resolveProfileSelection({ projectRoot });
|
|
106
82
|
}
|
|
107
83
|
/**
|
|
108
84
|
* Assemble the full stacked status. `sessionId` defaults to the
|
|
@@ -139,12 +115,11 @@ export function resolveModeStatus(input) {
|
|
|
139
115
|
jobMode = false;
|
|
140
116
|
}
|
|
141
117
|
}
|
|
142
|
-
// Delegate rather than re-derive
|
|
143
|
-
//
|
|
144
|
-
// copy of the
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
const autoCompactProfile = resolveAutoCompactProfile(projectRoot);
|
|
118
|
+
// Delegate rather than re-derive the profile: the resolution order lives
|
|
119
|
+
// in one place (`services/code/auto-compact-profile.ts`), and a local
|
|
120
|
+
// copy of the rule would make `peaks code mode status` advertise a
|
|
121
|
+
// different profile than the one `peaks code auto-compact` applies.
|
|
122
|
+
const profile = resolveProfile(projectRoot);
|
|
148
123
|
return {
|
|
149
124
|
mode: presence.mode,
|
|
150
125
|
skill: presence.skill,
|
|
@@ -152,7 +127,8 @@ export function resolveModeStatus(input) {
|
|
|
152
127
|
is24h,
|
|
153
128
|
h24State,
|
|
154
129
|
jobMode,
|
|
155
|
-
autoCompactProfile,
|
|
156
|
-
|
|
130
|
+
autoCompactProfile: profile.profile,
|
|
131
|
+
autoCompactProfileSource: profile.source,
|
|
132
|
+
autoCompactThresholds: AUTO_COMPACT_THRESHOLDS[profile.profile]
|
|
157
133
|
};
|
|
158
134
|
}
|
|
@@ -21,6 +21,26 @@ export type UaPromptDecision = 'unset' | 'skip-this-session' | 'skip-forever';
|
|
|
21
21
|
* - 'lax' — always downgrade to previous level (faster, riskier)
|
|
22
22
|
*/
|
|
23
23
|
export type ClassifyConservatism = 'default' | 'strict' | 'lax';
|
|
24
|
+
/**
|
|
25
|
+
* The auto-compact profile a project can pin.
|
|
26
|
+
*
|
|
27
|
+
* PUBLIC: any project, in any mode, can choose the compaction cadence. The
|
|
28
|
+
* profile is a THRESHOLD choice — `eager` fires earlier than `standard` —
|
|
29
|
+
* and it is set with
|
|
30
|
+
* `peaks preferences set --key autoCompactProfile --value eager`.
|
|
31
|
+
*
|
|
32
|
+
* The value set is closed on purpose: an unknown value is rejected at write
|
|
33
|
+
* time with the legal ones named, rather than stored and read back as
|
|
34
|
+
* something else.
|
|
35
|
+
*/
|
|
36
|
+
export type AutoCompactProfilePreference = 'standard' | 'eager';
|
|
37
|
+
/** The legal `autoCompactProfile` values, in the order the error message lists them. */
|
|
38
|
+
export declare const AUTO_COMPACT_PROFILE_VALUES: readonly AutoCompactProfilePreference[];
|
|
39
|
+
/**
|
|
40
|
+
* The `isFanoutMode` paradigm for the auto-compact profile: one guard, one
|
|
41
|
+
* closed set, so a caller never has to re-spell the legal values.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isAutoCompactProfile(value: unknown): value is AutoCompactProfilePreference;
|
|
24
44
|
export interface ClassifyRuleOverrides {
|
|
25
45
|
/** File count threshold above which a task is promoted to 'feature' */
|
|
26
46
|
readonly feature_threshold_files?: number;
|
|
@@ -86,6 +106,16 @@ export interface ProjectPreferences {
|
|
|
86
106
|
readonly classifyConservatism: ClassifyConservatism;
|
|
87
107
|
readonly classifyRules: ClassifyRuleOverrides;
|
|
88
108
|
readonly swarmSpeculative: SwarmSpeculativePreferences;
|
|
109
|
+
/**
|
|
110
|
+
* The auto-compact profile this project pins: `standard` (the v2.13.0
|
|
111
|
+
* zero-pause contract thresholds) or `eager` (fires earlier).
|
|
112
|
+
*
|
|
113
|
+
* OPTIONAL on purpose. The field is additive, so an existing
|
|
114
|
+
* `.peaks/preferences.json` that does not carry it keeps loading — the
|
|
115
|
+
* schema version is unchanged, and a file without the key resolves to the
|
|
116
|
+
* default profile rather than to a load error.
|
|
117
|
+
*/
|
|
118
|
+
readonly autoCompactProfile?: AutoCompactProfilePreference;
|
|
89
119
|
/** Loop Autonomous (L4 14.5) toggle. Default: false — never auto-enable. */
|
|
90
120
|
readonly loopAutonomousEnabled: boolean;
|
|
91
121
|
/**
|
|
@@ -5,6 +5,18 @@
|
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
7
|
export const PREFERENCES_SCHEMA_VERSION = '2.0.0';
|
|
8
|
+
/** The legal `autoCompactProfile` values, in the order the error message lists them. */
|
|
9
|
+
export const AUTO_COMPACT_PROFILE_VALUES = [
|
|
10
|
+
'standard',
|
|
11
|
+
'eager'
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* The `isFanoutMode` paradigm for the auto-compact profile: one guard, one
|
|
15
|
+
* closed set, so a caller never has to re-spell the legal values.
|
|
16
|
+
*/
|
|
17
|
+
export function isAutoCompactProfile(value) {
|
|
18
|
+
return (typeof value === 'string' && AUTO_COMPACT_PROFILE_VALUES.includes(value));
|
|
19
|
+
}
|
|
8
20
|
export const FANOUT_MODES = ['fan-out'];
|
|
9
21
|
/**
|
|
10
22
|
* narrowed the closed set from `['fan-out','serial']` to `['fan-out']`
|
|
@@ -26,6 +38,7 @@ export const DEFAULT_PREFERENCES = {
|
|
|
26
38
|
feature_threshold_lines: 100,
|
|
27
39
|
runtime_clean_grace_hours: 24
|
|
28
40
|
},
|
|
41
|
+
autoCompactProfile: 'standard',
|
|
29
42
|
swarmSpeculative: {
|
|
30
43
|
enabled: true,
|
|
31
44
|
maxConcurrent: 3,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export type CriteriaSource = 'declared' | 'section' | 'both';
|
|
1
2
|
export type AcceptanceItem = {
|
|
2
3
|
id: string;
|
|
3
4
|
text: string;
|
|
4
5
|
line: number;
|
|
6
|
+
source: CriteriaSource;
|
|
5
7
|
};
|
|
6
8
|
export type TestCase = {
|
|
7
9
|
title: string;
|
|
@@ -13,6 +15,18 @@ export type CoverageEntry = {
|
|
|
13
15
|
acceptanceText: string;
|
|
14
16
|
testCases: string[];
|
|
15
17
|
};
|
|
18
|
+
export type AcceptanceCoverageOptions = {
|
|
19
|
+
projectRoot: string;
|
|
20
|
+
requestId: string;
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
};
|
|
23
|
+
export type AcceptanceCoverageError = {
|
|
24
|
+
kind: 'prd-not-found';
|
|
25
|
+
message: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'test-cases-not-found';
|
|
28
|
+
expectedPath: string;
|
|
29
|
+
};
|
|
16
30
|
export type AcceptanceCoverageReport = {
|
|
17
31
|
ok: boolean;
|
|
18
32
|
prdPath: string;
|
|
@@ -27,16 +41,5 @@ export type AcceptanceCoverageReport = {
|
|
|
27
41
|
reference: string;
|
|
28
42
|
}>;
|
|
29
43
|
};
|
|
30
|
-
export type AcceptanceCoverageOptions = {
|
|
31
|
-
projectRoot: string;
|
|
32
|
-
requestId: string;
|
|
33
|
-
sessionId?: string;
|
|
34
|
-
};
|
|
35
|
-
export type AcceptanceCoverageError = {
|
|
36
|
-
kind: 'prd-not-found';
|
|
37
|
-
} | {
|
|
38
|
-
kind: 'test-cases-not-found';
|
|
39
|
-
expectedPath: string;
|
|
40
|
-
};
|
|
41
44
|
export declare function getAcceptanceCoverage(options: AcceptanceCoverageOptions): Promise<AcceptanceCoverageReport | AcceptanceCoverageError>;
|
|
42
45
|
export declare function isAcceptanceCoverageError(value: AcceptanceCoverageReport | AcceptanceCoverageError): value is AcceptanceCoverageError;
|
|
@@ -1,41 +1,165 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import { pathExists, readText } from 'peaks-loop-shared/fs';
|
|
2
|
+
import { isDirectory, listDirectories, pathExists, readText } from 'peaks-loop-shared/fs';
|
|
3
3
|
import { showRequestArtifact } from '../artifacts/request-artifact-service.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { handoffRelativePath } from '../prd/handoff-path-resolution.js';
|
|
5
|
+
import { isUnsafePathInput } from '../../shared/path-safety.js';
|
|
6
|
+
import { runtimeRoot } from '../../shared/runtime-root.js';
|
|
7
|
+
const ACCEPTANCE_SECTION_PATTERN = /^##\s+(?:Acceptance criteria|验收标准|Acceptance Criteria)\s*$/;
|
|
8
|
+
const TABLE_SEPARATOR_PATTERN = /^\s*\|(?:\s*:?-{2,}:?\s*\|)+\s*$/;
|
|
9
|
+
const CRITERION_COLUMN_PATTERN = /criter|判据|验收/i;
|
|
10
|
+
const BULLET_PATTERN = /^\s*-\s+(.+?)\s*$/;
|
|
11
|
+
const TABLE_ROW_PATTERN = /^\s*\|(.+)\|\s*$/;
|
|
12
|
+
/** The criteria a document DECLARES: the `acceptanceCriteria:` list in its frontmatter. */
|
|
13
|
+
function declaredCriteria(content) {
|
|
14
|
+
const block = /^---\r?\n([\s\S]*?)\r?\n---/.exec(content);
|
|
15
|
+
if (block === null)
|
|
9
16
|
return [];
|
|
17
|
+
const lines = (block[1] ?? '').split(/\r?\n/);
|
|
18
|
+
const found = [];
|
|
19
|
+
let inList = false;
|
|
20
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
21
|
+
const raw = lines[i] ?? '';
|
|
22
|
+
if (!inList) {
|
|
23
|
+
inList = raw.trim() === 'acceptanceCriteria:';
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const entry = BULLET_PATTERN.exec(raw);
|
|
27
|
+
if (entry === null) {
|
|
28
|
+
if (raw.trim().length > 0)
|
|
29
|
+
inList = false;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const text = (entry[1] ?? '').trim().replace(/^["'](.*)["']$/, '$1');
|
|
33
|
+
found.push({ text, line: i + 2, source: 'declared' });
|
|
10
34
|
}
|
|
11
|
-
|
|
12
|
-
|
|
35
|
+
return found;
|
|
36
|
+
}
|
|
37
|
+
/** A criteria TABLE row: the criterion text it carries and the criterion column for the
|
|
38
|
+
* rows after it — the header row is the one that NAMES the column. */
|
|
39
|
+
function tableRowCriterion(cells, next, column) {
|
|
40
|
+
if (cells.every((cell) => /^:?-{2,}:?$/.test(cell)))
|
|
41
|
+
return null;
|
|
42
|
+
if (TABLE_SEPARATOR_PATTERN.test(next)) {
|
|
43
|
+
const named = cells.findIndex((cell) => CRITERION_COLUMN_PATTERN.test(cell));
|
|
44
|
+
return { text: '', column: named >= 0 ? named : Math.min(1, cells.length - 1) };
|
|
45
|
+
}
|
|
46
|
+
return { text: cells[column] ?? '', column };
|
|
47
|
+
}
|
|
48
|
+
/** The criteria a document SHOWS: the bullets of its acceptance section and the criterion
|
|
49
|
+
* column of a criteria table inside it. */
|
|
50
|
+
function sectionCriteria(content) {
|
|
51
|
+
const lines = content.split(/\r?\n/);
|
|
52
|
+
const found = [];
|
|
53
|
+
let inSection = false;
|
|
54
|
+
let column = 1;
|
|
13
55
|
for (let i = 0; i < lines.length; i += 1) {
|
|
14
|
-
|
|
15
|
-
|
|
56
|
+
const raw = lines[i] ?? '';
|
|
57
|
+
if (!inSection) {
|
|
58
|
+
inSection = ACCEPTANCE_SECTION_PATTERN.test(raw);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (/^##\s/.test(raw))
|
|
16
62
|
break;
|
|
63
|
+
const bullet = BULLET_PATTERN.exec(raw);
|
|
64
|
+
if (bullet !== null) {
|
|
65
|
+
found.push({ text: (bullet[1] ?? '').trim(), line: i + 1, source: 'section' });
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const row = TABLE_ROW_PATTERN.exec(raw);
|
|
69
|
+
if (row === null)
|
|
70
|
+
continue;
|
|
71
|
+
const cells = (row[1] ?? '').split('|').map((cell) => cell.trim());
|
|
72
|
+
const table = tableRowCriterion(cells, lines[i + 1] ?? '', column);
|
|
73
|
+
if (table === null)
|
|
74
|
+
continue;
|
|
75
|
+
column = table.column;
|
|
76
|
+
if (table.text.length > 0) {
|
|
77
|
+
found.push({ text: table.text, line: i + 1, source: 'section' });
|
|
17
78
|
}
|
|
18
79
|
}
|
|
80
|
+
return found;
|
|
81
|
+
}
|
|
82
|
+
/** The criteria of a PRD: the DECLARED list UNION the criteria the section SHOWS,
|
|
83
|
+
* de-duplicated by text. A criterion carrying both sources says so. */
|
|
84
|
+
function extractAcceptanceItems(content) {
|
|
19
85
|
const items = [];
|
|
86
|
+
const byKey = new Map();
|
|
20
87
|
let counter = 0;
|
|
21
|
-
for (
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
break; // next section
|
|
25
|
-
const bulletMatch = /^\s*-\s+(.+?)\s*$/.exec(raw);
|
|
26
|
-
if (bulletMatch === null)
|
|
27
|
-
continue;
|
|
28
|
-
const text = bulletMatch[1] ?? '';
|
|
29
|
-
if (text.length === 0)
|
|
88
|
+
for (const raw of [...declaredCriteria(content), ...sectionCriteria(content)]) {
|
|
89
|
+
const text = raw.text.trim();
|
|
90
|
+
if (text.length === 0 || /^\.{2,}$/.test(text) || /^<[^>]+>$/.test(text))
|
|
30
91
|
continue;
|
|
31
|
-
|
|
32
|
-
|
|
92
|
+
const key = text.toLowerCase().replace(/\s+/g, ' ');
|
|
93
|
+
const existing = byKey.get(key);
|
|
94
|
+
if (existing === undefined) {
|
|
95
|
+
counter += 1;
|
|
96
|
+
const item = { id: `A${counter}`, text, line: raw.line, source: raw.source };
|
|
97
|
+
byKey.set(key, item);
|
|
98
|
+
items.push(item);
|
|
33
99
|
continue;
|
|
34
|
-
|
|
35
|
-
|
|
100
|
+
}
|
|
101
|
+
if (existing.source !== raw.source)
|
|
102
|
+
existing.source = 'both';
|
|
36
103
|
}
|
|
37
104
|
return items;
|
|
38
105
|
}
|
|
106
|
+
/** The `sessionId:` a capsule declares in its own frontmatter. The PRD-style `- session:`
|
|
107
|
+
* line in the body is a different field. A declared value that is not a single safe path
|
|
108
|
+
* segment is REFUSED: it decides where the test-cases file is read from. */
|
|
109
|
+
function handoffFrontmatterSessionId(content) {
|
|
110
|
+
const block = /^---\r?\n([\s\S]*?)\r?\n---/.exec(content);
|
|
111
|
+
if (block === null)
|
|
112
|
+
return undefined;
|
|
113
|
+
const declared = /^sessionId:\s*(.+?)\s*$/m.exec(block[1] ?? '');
|
|
114
|
+
if (declared === null)
|
|
115
|
+
return undefined;
|
|
116
|
+
const value = (declared[1] ?? '').trim().replace(/^["'](.*)["']$/, '$1');
|
|
117
|
+
if (value.length === 0 || isUnsafePathInput(value))
|
|
118
|
+
return undefined;
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
async function candidateSessionIds(options) {
|
|
122
|
+
if (options.sessionId !== undefined)
|
|
123
|
+
return [options.sessionId];
|
|
124
|
+
const runtimeDir = runtimeRoot(options.projectRoot).dir();
|
|
125
|
+
if (!(await isDirectory(runtimeDir)))
|
|
126
|
+
return [];
|
|
127
|
+
return await listDirectories(runtimeDir);
|
|
128
|
+
}
|
|
129
|
+
/** The MAIN source is the role carrier at `prd/requests/<rid>.md`; the FALLBACK is the
|
|
130
|
+
* handoff capsule at `prd/handoff-<rid>.md` — the artifact the pipeline produces for a
|
|
131
|
+
* session that ran no peaks-prd role. The capsule's path is built by the SAME guarded
|
|
132
|
+
* constructor the capsule writer uses, so neither the rid nor the session id can escape
|
|
133
|
+
* the runtime root. */
|
|
134
|
+
async function resolvePrdSource(options) {
|
|
135
|
+
const showOptions = {
|
|
136
|
+
projectRoot: options.projectRoot,
|
|
137
|
+
role: 'prd',
|
|
138
|
+
requestId: options.requestId,
|
|
139
|
+
...(options.sessionId === undefined ? {} : { sessionId: options.sessionId })
|
|
140
|
+
};
|
|
141
|
+
const prdArtifact = await showRequestArtifact(showOptions);
|
|
142
|
+
if (prdArtifact !== null) {
|
|
143
|
+
const { path, content, sessionId } = prdArtifact;
|
|
144
|
+
return { path, sessionId, acceptanceItems: extractAcceptanceItems(content) };
|
|
145
|
+
}
|
|
146
|
+
for (const sessionDir of await candidateSessionIds(options)) {
|
|
147
|
+
const relative = handoffRelativePath(sessionDir, options.requestId);
|
|
148
|
+
const absolute = join(options.projectRoot, relative);
|
|
149
|
+
if (!(await pathExists(absolute)))
|
|
150
|
+
continue;
|
|
151
|
+
const content = await readText(absolute);
|
|
152
|
+
// The capsule's own `sessionId:` first, then the caller's `--session-id`,
|
|
153
|
+
// then the session dir the capsule was found in — which IS the caller's
|
|
154
|
+
// when one was given.
|
|
155
|
+
const sessionId = handoffFrontmatterSessionId(content) ?? options.sessionId ?? sessionDir;
|
|
156
|
+
return { path: absolute, sessionId, acceptanceItems: extractAcceptanceItems(content) };
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
function prdNotFoundMessage(requestId) {
|
|
161
|
+
return `PRD artifact for requestId=${requestId} not found: neither prd/requests/${requestId}.md nor prd/handoff-${requestId}.md was found`;
|
|
162
|
+
}
|
|
39
163
|
const TEST_CASE_HEADER_PATTERN = /^##\s+Test Case:\s*(.+?)\s*$/;
|
|
40
164
|
const ACCEPTANCE_FIELD_PATTERN = /^\s*-\s+\*\*Acceptance:\*\*\s+(.+?)\s*$/i;
|
|
41
165
|
function extractTestCases(qaBody) {
|
|
@@ -56,10 +180,7 @@ function extractTestCases(qaBody) {
|
|
|
56
180
|
continue;
|
|
57
181
|
const acceptanceMatch = ACCEPTANCE_FIELD_PATTERN.exec(raw);
|
|
58
182
|
if (acceptanceMatch !== null) {
|
|
59
|
-
const refs = (acceptanceMatch[1] ?? '')
|
|
60
|
-
.split(/[,\s]+/)
|
|
61
|
-
.map((part) => part.trim())
|
|
62
|
-
.filter((part) => part.length > 0);
|
|
183
|
+
const refs = (acceptanceMatch[1] ?? '').split(/[,\s]+/).filter((part) => part.length > 0);
|
|
63
184
|
current.ids.push(...refs);
|
|
64
185
|
}
|
|
65
186
|
}
|
|
@@ -69,9 +190,6 @@ function extractTestCases(qaBody) {
|
|
|
69
190
|
return cases;
|
|
70
191
|
}
|
|
71
192
|
function buildCoverage(items, cases) {
|
|
72
|
-
const itemMap = new Map();
|
|
73
|
-
for (const item of items)
|
|
74
|
-
itemMap.set(item.id, item);
|
|
75
193
|
const coverageMap = new Map();
|
|
76
194
|
for (const item of items)
|
|
77
195
|
coverageMap.set(item.id, []);
|
|
@@ -79,7 +197,7 @@ function buildCoverage(items, cases) {
|
|
|
79
197
|
for (const testCase of cases) {
|
|
80
198
|
for (const ref of testCase.acceptanceIds) {
|
|
81
199
|
const normalized = ref.toUpperCase();
|
|
82
|
-
if (!
|
|
200
|
+
if (!coverageMap.has(normalized)) {
|
|
83
201
|
invalidReferences.push({ testCaseTitle: testCase.title, reference: ref });
|
|
84
202
|
continue;
|
|
85
203
|
}
|
|
@@ -95,38 +213,25 @@ function buildCoverage(items, cases) {
|
|
|
95
213
|
return { coverage, uncovered, invalidReferences };
|
|
96
214
|
}
|
|
97
215
|
export async function getAcceptanceCoverage(options) {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
requestId: options.requestId
|
|
102
|
-
};
|
|
103
|
-
if (options.sessionId !== undefined) {
|
|
104
|
-
showOptions.sessionId = options.sessionId;
|
|
105
|
-
}
|
|
106
|
-
const prdArtifact = await showRequestArtifact(showOptions);
|
|
107
|
-
if (prdArtifact === null) {
|
|
108
|
-
return { kind: 'prd-not-found' };
|
|
216
|
+
const source = await resolvePrdSource(options);
|
|
217
|
+
if (source === null) {
|
|
218
|
+
return { kind: 'prd-not-found', message: prdNotFoundMessage(options.requestId) };
|
|
109
219
|
}
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
// under the canonical session dir `.peaks/_runtime/<sid>/qa/test-cases/`.
|
|
114
|
-
// `prdArtifact.sessionId` is the bare session id (the dir the PRD was
|
|
115
|
-
// found in), so we route through `_runtime/` here.
|
|
116
|
-
const sessionId = prdArtifact.sessionId;
|
|
117
|
-
const testCasesPath = join(options.projectRoot, '.peaks', '_runtime', sessionId, 'qa', 'test-cases', `${options.requestId}.md`);
|
|
220
|
+
// test-cases live under the canonical session dir `.peaks/_runtime/<sid>/qa/test-cases/`;
|
|
221
|
+
// `source.sessionId` is the bare session id of the dir the PRD — or the capsule — was in.
|
|
222
|
+
const testCasesPath = join(options.projectRoot, `.peaks/_runtime/${source.sessionId}/qa/test-cases/${options.requestId}.md`);
|
|
118
223
|
if (!(await pathExists(testCasesPath))) {
|
|
119
224
|
return { kind: 'test-cases-not-found', expectedPath: testCasesPath };
|
|
120
225
|
}
|
|
121
226
|
const qaBody = await readText(testCasesPath);
|
|
122
|
-
const acceptanceItems =
|
|
227
|
+
const acceptanceItems = source.acceptanceItems;
|
|
123
228
|
const testCases = extractTestCases(qaBody);
|
|
124
229
|
const { coverage, uncovered, invalidReferences } = buildCoverage(acceptanceItems, testCases);
|
|
125
230
|
const unlinkedTestCases = testCases.filter((testCase) => testCase.acceptanceIds.length === 0);
|
|
126
231
|
const ok = uncovered.length === 0 && invalidReferences.length === 0 && acceptanceItems.length > 0;
|
|
127
232
|
return {
|
|
128
233
|
ok,
|
|
129
|
-
prdPath:
|
|
234
|
+
prdPath: source.path,
|
|
130
235
|
testCasesPath,
|
|
131
236
|
acceptanceItems,
|
|
132
237
|
testCases,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** True when the artifact carries the `## Changed paths` heading. */
|
|
2
|
+
export declare function hasChangedPathsSection(body: string): boolean;
|
|
3
|
+
/** Every `changedPath:` line of the body, in the order they were written. */
|
|
4
|
+
export declare function parseChangedPathLines(body: string): readonly string[];
|
|
5
|
+
/** Every rid that HAS an RD artifact in the session — declared or not. The
|
|
6
|
+
* caller compares this list against the claim table to learn whether the table
|
|
7
|
+
* is COMPLETE, which is what decides whether the anti-lie fallback may run.
|
|
8
|
+
*/
|
|
9
|
+
export declare function listSessionRdArtifactIds(projectRoot: string, sessionId: string): readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* rid -> the paths it declared. ONLY artifacts carrying the `## Changed paths`
|
|
12
|
+
* heading are in the table; a rid without it is NOT, and the caller reads that
|
|
13
|
+
* absence as "this rid declared nothing" and falls back to the whole tree.
|
|
14
|
+
*/
|
|
15
|
+
export declare function readRidChangeClaims(projectRoot: string, sessionId: string): ReadonlyMap<string, readonly string[]>;
|