@cleocode/core 2026.4.4 → 2026.4.6
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/dist/discovery.d.ts +69 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1643 -2349
- package/dist/index.js.map +4 -4
- package/dist/init.d.ts +51 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/internal.d.ts +9 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/lifecycle/default-chain.d.ts +8 -2
- package/dist/lifecycle/default-chain.d.ts.map +1 -1
- package/dist/lifecycle/index.d.ts +1 -0
- package/dist/lifecycle/index.d.ts.map +1 -1
- package/dist/lifecycle/stage-guidance.d.ts +140 -0
- package/dist/lifecycle/stage-guidance.d.ts.map +1 -0
- package/dist/orchestration/protocol-validators.d.ts +122 -3
- package/dist/orchestration/protocol-validators.d.ts.map +1 -1
- package/dist/paths.d.ts +91 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/scaffold.d.ts +31 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/skills/dispatch.d.ts +1 -1
- package/dist/skills/skill-paths.d.ts +9 -6
- package/dist/skills/skill-paths.d.ts.map +1 -1
- package/dist/validation/protocols/_shared.d.ts +40 -0
- package/dist/validation/protocols/_shared.d.ts.map +1 -0
- package/dist/validation/protocols/architecture-decision.d.ts +23 -0
- package/dist/validation/protocols/architecture-decision.d.ts.map +1 -0
- package/dist/validation/protocols/artifact-publish.d.ts +22 -0
- package/dist/validation/protocols/artifact-publish.d.ts.map +1 -0
- package/dist/validation/protocols/consensus.d.ts +11 -17
- package/dist/validation/protocols/consensus.d.ts.map +1 -1
- package/dist/validation/protocols/contribution.d.ts +12 -17
- package/dist/validation/protocols/contribution.d.ts.map +1 -1
- package/dist/validation/protocols/decomposition.d.ts +18 -21
- package/dist/validation/protocols/decomposition.d.ts.map +1 -1
- package/dist/validation/protocols/implementation.d.ts +9 -17
- package/dist/validation/protocols/implementation.d.ts.map +1 -1
- package/dist/validation/protocols/provenance.d.ts +23 -0
- package/dist/validation/protocols/provenance.d.ts.map +1 -0
- package/dist/validation/protocols/release.d.ts +25 -0
- package/dist/validation/protocols/release.d.ts.map +1 -0
- package/dist/validation/protocols/research.d.ts +9 -17
- package/dist/validation/protocols/research.d.ts.map +1 -1
- package/dist/validation/protocols/specification.d.ts +7 -17
- package/dist/validation/protocols/specification.d.ts.map +1 -1
- package/dist/validation/protocols/testing.d.ts +22 -0
- package/dist/validation/protocols/testing.d.ts.map +1 -0
- package/dist/validation/protocols/validation.d.ts +22 -0
- package/dist/validation/protocols/validation.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/__tests__/injection-mvi-tiers.test.js +54 -90
- package/src/__tests__/injection-mvi-tiers.test.js.map +1 -1
- package/src/discovery.ts +235 -0
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js +3 -1
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js.map +1 -1
- package/src/index.ts +16 -0
- package/src/init.ts +196 -0
- package/src/internal.ts +31 -1
- package/src/lifecycle/default-chain.ts +11 -2
- package/src/lifecycle/index.ts +10 -0
- package/src/lifecycle/stage-guidance.ts +282 -0
- package/src/metrics/__tests__/provider-detection.test.js +19 -7
- package/src/metrics/__tests__/provider-detection.test.js.map +1 -1
- package/src/metrics/__tests__/provider-detection.test.ts +19 -7
- package/src/orchestration/__tests__/protocol-validators.test.js +228 -8
- package/src/orchestration/__tests__/protocol-validators.test.js.map +1 -1
- package/src/orchestration/__tests__/protocol-validators.test.ts +259 -7
- package/src/orchestration/protocol-validators.ts +419 -4
- package/src/paths.ts +110 -0
- package/src/scaffold.ts +240 -4
- package/src/skills/dispatch.ts +6 -6
- package/src/skills/skill-paths.ts +27 -23
- package/src/validation/protocols/_shared.ts +88 -0
- package/src/validation/protocols/architecture-decision.ts +52 -0
- package/src/validation/protocols/artifact-publish.ts +49 -0
- package/src/validation/protocols/consensus.ts +44 -74
- package/src/validation/protocols/contribution.ts +28 -65
- package/src/validation/protocols/decomposition.ts +37 -64
- package/src/validation/protocols/implementation.ts +25 -65
- package/src/validation/protocols/protocols-markdown/architecture-decision.md +303 -0
- package/src/validation/protocols/protocols-markdown/artifact-publish.md +600 -0
- package/src/validation/protocols/protocols-markdown/consensus.md +322 -0
- package/src/validation/protocols/protocols-markdown/contribution.md +388 -0
- package/src/validation/protocols/protocols-markdown/decomposition.md +421 -0
- package/src/validation/protocols/protocols-markdown/implementation.md +357 -0
- package/src/validation/protocols/protocols-markdown/provenance.md +613 -0
- package/src/validation/protocols/protocols-markdown/release.md +783 -0
- package/src/validation/protocols/protocols-markdown/research.md +261 -0
- package/src/validation/protocols/protocols-markdown/specification.md +300 -0
- package/src/validation/protocols/protocols-markdown/testing.md +287 -0
- package/src/validation/protocols/protocols-markdown/validation.md +242 -0
- package/src/validation/protocols/provenance.ts +50 -0
- package/src/validation/protocols/release.ts +44 -0
- package/src/validation/protocols/research.ts +25 -87
- package/src/validation/protocols/specification.ts +27 -89
- package/src/validation/protocols/testing.ts +46 -0
- package/src/validation/protocols/validation.ts +46 -0
- package/dist/validation/protocols/release-protocol.d.ts +0 -27
- package/dist/validation/protocols/release-protocol.d.ts.map +0 -1
- package/dist/validation/protocols/testing-protocol.d.ts +0 -27
- package/dist/validation/protocols/testing-protocol.d.ts.map +0 -1
- package/dist/validation/protocols/validation-protocol.d.ts +0 -27
- package/dist/validation/protocols/validation-protocol.d.ts.map +0 -1
- package/schemas/agent-configs.schema.json +0 -120
- package/schemas/agent-registry.schema.json +0 -132
- package/schemas/archive.schema.json +0 -450
- package/schemas/brain-decision.schema.json +0 -69
- package/schemas/brain-learning.schema.json +0 -57
- package/schemas/brain-pattern.schema.json +0 -72
- package/schemas/critical-path.schema.json +0 -246
- package/schemas/deps-cache.schema.json +0 -97
- package/schemas/doctor-output.schema.json +0 -283
- package/schemas/error.schema.json +0 -161
- package/schemas/global-config.schema.json +0 -219
- package/schemas/grade.schema.json +0 -49
- package/schemas/log.schema.json +0 -250
- package/schemas/metrics.schema.json +0 -328
- package/schemas/migrations.schema.json +0 -150
- package/schemas/nexus-registry.schema.json +0 -90
- package/schemas/operation-constitution.schema.json +0 -438
- package/schemas/output.schema.json +0 -164
- package/schemas/projects-registry.schema.json +0 -107
- package/schemas/protocol-frontmatter.schema.json +0 -72
- package/schemas/rcasd-consensus-report.schema.json +0 -10
- package/schemas/rcasd-evidence.schema.json +0 -42
- package/schemas/rcasd-gate-result.schema.json +0 -46
- package/schemas/rcasd-hitl-resolution.schema.json +0 -10
- package/schemas/rcasd-index.schema.json +0 -10
- package/schemas/rcasd-manifest.schema.json +0 -10
- package/schemas/rcasd-research-output.schema.json +0 -10
- package/schemas/rcasd-spec-frontmatter.schema.json +0 -10
- package/schemas/rcasd-stage-transition.schema.json +0 -38
- package/schemas/releases.schema.json +0 -267
- package/schemas/skills-manifest.schema.json +0 -91
- package/schemas/spec-index.schema.json +0 -196
- package/schemas/system-flow-atlas.schema.json +0 -125
- package/src/conduit/__tests__/dual-api-e2e.test.d.ts.map +0 -1
- package/src/conduit/__tests__/dual-api-e2e.test.js +0 -178
- package/src/conduit/__tests__/dual-api-e2e.test.js.map +0 -1
- package/src/conduit/__tests__/dual-api-e2e.test.ts +0 -212
- package/src/validation/protocols/release-protocol.ts +0 -80
- package/src/validation/protocols/testing-protocol.ts +0 -93
- package/src/validation/protocols/validation-protocol.ts +0 -93
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stage-Aware LLM Prompt Guidance (Phase 2, refactored Phase 4).
|
|
3
|
+
*
|
|
4
|
+
* **Architecture (SSoT)**: The protocol text for each RCASD-IVTR+C stage is
|
|
5
|
+
* authoritatively encoded in the `@cleocode/skills` package at
|
|
6
|
+
* `packages/skills/skills/ct-*` — specifically:
|
|
7
|
+
*
|
|
8
|
+
* - Tier 0 (always loaded): `ct-cleo`, `ct-orchestrator`, `ct-task-executor`
|
|
9
|
+
* - Stage-specific (per RCASD-IVTR+C stage): see `STAGE_SKILL_MAP` below
|
|
10
|
+
*
|
|
11
|
+
* This module is a **thin loader** — it does NOT embed protocol text. It
|
|
12
|
+
* resolves stage → skill names via `STAGE_SKILL_MAP`, then calls the
|
|
13
|
+
* existing `prepareSpawnMulti()` helper (from `../skills/dispatch.ts`) to
|
|
14
|
+
* compose the full prompt from real `SKILL.md` files.
|
|
15
|
+
*
|
|
16
|
+
* If the skill files are unavailable at runtime (e.g. fresh install, skills
|
|
17
|
+
* package missing), we fall back to a minimal structured description built
|
|
18
|
+
* from `STAGE_DEFINITIONS` alone — never hand-authored prose.
|
|
19
|
+
*
|
|
20
|
+
* @task Phase 2 — Pi harness registration + stage guidance injection
|
|
21
|
+
* @task Phase 4 — SSoT alignment: pull from skill files, not inline text
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { findSkill } from '../skills/discovery.js';
|
|
25
|
+
import { prepareSpawnMulti } from '../skills/dispatch.js';
|
|
26
|
+
import { STAGE_DEFINITIONS, type Stage } from './stages.js';
|
|
27
|
+
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// SSoT: Stage → Skill mapping
|
|
30
|
+
// ============================================================================
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Canonical mapping from RCASD-IVTR+C pipeline stages to the primary skill
|
|
34
|
+
* that encodes the protocol for that stage.
|
|
35
|
+
*
|
|
36
|
+
* Each pipeline stage maps to exactly one **dedicated** skill that owns
|
|
37
|
+
* the protocol contract for that stage. The keys here are the canonical
|
|
38
|
+
* `Stage` union from `./stages.ts`; the values are skill names that MUST
|
|
39
|
+
* exist under `packages/skills/skills/` and be registered in the global
|
|
40
|
+
* manifest at `packages/skills/skills/manifest.json`.
|
|
41
|
+
*
|
|
42
|
+
* **Relationship to manifest.json:** This table is the runtime authority
|
|
43
|
+
* for stage→skill resolution by `buildStageGuidance()`. The manifest's
|
|
44
|
+
* `dispatch_matrix.by_protocol` table is the broader catalog (it also
|
|
45
|
+
* covers cross-cutting protocols like contribution, artifact-publish, and
|
|
46
|
+
* provenance which are NOT pipeline stages and therefore are not in this
|
|
47
|
+
* map). When the two tables overlap, they MUST agree on the skill name.
|
|
48
|
+
*
|
|
49
|
+
* **Cross-cutting protocols** (`contribution`, `artifact-publish`,
|
|
50
|
+
* `provenance`) compose with pipeline stages but are not themselves
|
|
51
|
+
* stages — see `lifecycle/default-chain.ts#DEFAULT_PROTOCOL_STAGE_MAP`
|
|
52
|
+
* for the cross-cutting → host-stage mapping.
|
|
53
|
+
*
|
|
54
|
+
* @task T260 — replace overloaded ct-validator/ct-dev-workflow assignments
|
|
55
|
+
* with dedicated skills (ct-adr-recorder, ct-consensus-voter,
|
|
56
|
+
* ct-ivt-looper, ct-release-orchestrator). Validation stays on
|
|
57
|
+
* ct-validator now that consensus duties are split out.
|
|
58
|
+
*/
|
|
59
|
+
export const STAGE_SKILL_MAP: Record<Stage, string> = {
|
|
60
|
+
research: 'ct-research-agent',
|
|
61
|
+
consensus: 'ct-consensus-voter',
|
|
62
|
+
architecture_decision: 'ct-adr-recorder',
|
|
63
|
+
specification: 'ct-spec-writer',
|
|
64
|
+
decomposition: 'ct-epic-architect',
|
|
65
|
+
implementation: 'ct-task-executor',
|
|
66
|
+
validation: 'ct-validator',
|
|
67
|
+
testing: 'ct-ivt-looper',
|
|
68
|
+
release: 'ct-release-orchestrator',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Tier 0 skills — always loaded alongside the stage-specific skill.
|
|
73
|
+
*
|
|
74
|
+
* - `ct-cleo`: CLEO task management protocol (session, task, memory CLI)
|
|
75
|
+
* - `ct-orchestrator`: pipeline-aware orchestration constraints (ORC-001..009)
|
|
76
|
+
*
|
|
77
|
+
* `ct-task-executor` is NOT unconditionally included because most stages
|
|
78
|
+
* already resolve to a more-specific executor skill; it's only added when
|
|
79
|
+
* no stage-specific skill exists.
|
|
80
|
+
*/
|
|
81
|
+
export const TIER_0_SKILLS: readonly string[] = ['ct-cleo', 'ct-orchestrator'];
|
|
82
|
+
|
|
83
|
+
// ============================================================================
|
|
84
|
+
// Public types
|
|
85
|
+
// ============================================================================
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Structured guidance for a single pipeline stage.
|
|
89
|
+
*
|
|
90
|
+
* Pi extensions consume the `.prompt` field directly (render via
|
|
91
|
+
* `{ systemPrompt }` in `before_agent_start`). The structured fields are
|
|
92
|
+
* exposed for TUI widgets, badges, and logging.
|
|
93
|
+
*/
|
|
94
|
+
export interface StageGuidance {
|
|
95
|
+
/** The canonical stage identifier. */
|
|
96
|
+
stage: Stage;
|
|
97
|
+
/** Human-readable stage name (e.g. "Research"). */
|
|
98
|
+
name: string;
|
|
99
|
+
/** Numeric stage order (1-9). */
|
|
100
|
+
order: number;
|
|
101
|
+
/** Primary skill loaded for this stage (SSoT from STAGE_SKILL_MAP). */
|
|
102
|
+
primarySkill: string;
|
|
103
|
+
/** All skills loaded (Tier 0 + stage primary). */
|
|
104
|
+
loadedSkills: readonly string[];
|
|
105
|
+
/** Gates that must pass before the stage can be completed. */
|
|
106
|
+
requiredGates: readonly string[];
|
|
107
|
+
/** Artifacts the agent is expected to produce before advancing. */
|
|
108
|
+
expectedArtifacts: readonly string[];
|
|
109
|
+
/** Composed prompt text, ready for LLM system prompt injection. */
|
|
110
|
+
prompt: string;
|
|
111
|
+
/** Source of the prompt: 'skills' (real SKILL.md files) or 'fallback'. */
|
|
112
|
+
source: 'skills' | 'fallback';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ============================================================================
|
|
116
|
+
// Fallback prompt builder — used only when skills are unavailable
|
|
117
|
+
// ============================================================================
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Build a minimal stage prompt from canonical metadata when the skill files
|
|
121
|
+
* cannot be resolved. Uses only `STAGE_DEFINITIONS` — no hand-authored prose.
|
|
122
|
+
*
|
|
123
|
+
* This intentionally produces a compact prompt that tells the agent what
|
|
124
|
+
* stage it's in and where to find the authoritative protocol. It is NOT a
|
|
125
|
+
* substitute for the real skill content.
|
|
126
|
+
*/
|
|
127
|
+
function buildFallbackPrompt(stage: Stage, primarySkill: string): string {
|
|
128
|
+
const def = STAGE_DEFINITIONS[stage];
|
|
129
|
+
const lines: string[] = [];
|
|
130
|
+
lines.push(`## CLEO Pipeline Stage: ${def.name} (stage ${def.order}/9)`);
|
|
131
|
+
lines.push('');
|
|
132
|
+
lines.push(`**Description**: ${def.description}`);
|
|
133
|
+
lines.push(`**Category**: ${def.category}`);
|
|
134
|
+
lines.push(`**Skippable**: ${def.skippable ? 'yes' : 'no'}`);
|
|
135
|
+
lines.push('');
|
|
136
|
+
lines.push('### Required Gates');
|
|
137
|
+
for (const gate of def.requiredGates) {
|
|
138
|
+
lines.push(`- \`${gate}\``);
|
|
139
|
+
}
|
|
140
|
+
lines.push('');
|
|
141
|
+
lines.push('### Expected Artifacts');
|
|
142
|
+
for (const artifact of def.expectedArtifacts) {
|
|
143
|
+
lines.push(`- \`${artifact}\``);
|
|
144
|
+
}
|
|
145
|
+
lines.push('');
|
|
146
|
+
lines.push('### Primary Skill');
|
|
147
|
+
lines.push(
|
|
148
|
+
`- **${primarySkill}** — protocol unavailable at runtime. Install \`@cleocode/skills\` or run \`cleo admin scaffold-hub\` to provision.`,
|
|
149
|
+
);
|
|
150
|
+
lines.push('');
|
|
151
|
+
lines.push('### Tier 0 Skills (always loaded)');
|
|
152
|
+
for (const s of TIER_0_SKILLS) {
|
|
153
|
+
lines.push(`- ${s}`);
|
|
154
|
+
}
|
|
155
|
+
lines.push('');
|
|
156
|
+
lines.push(
|
|
157
|
+
'> Fallback guidance — the full `SKILL.md` files could not be resolved. ' +
|
|
158
|
+
'Check skill installation with `cleo skills list`.',
|
|
159
|
+
);
|
|
160
|
+
return lines.join('\n');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// ============================================================================
|
|
164
|
+
// Public API
|
|
165
|
+
// ============================================================================
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Build structured stage guidance for a given pipeline stage.
|
|
169
|
+
*
|
|
170
|
+
* Resolves the primary skill for the stage from `STAGE_SKILL_MAP`, composes
|
|
171
|
+
* a prompt from the real `SKILL.md` files via `prepareSpawnMulti()`, and
|
|
172
|
+
* returns a `StageGuidance` object suitable for Pi extension injection or
|
|
173
|
+
* direct CLI rendering.
|
|
174
|
+
*
|
|
175
|
+
* If the skills cannot be resolved, returns a fallback prompt built from
|
|
176
|
+
* `STAGE_DEFINITIONS` metadata only — no hand-authored protocol text.
|
|
177
|
+
*
|
|
178
|
+
* @param stage - The canonical pipeline stage identifier
|
|
179
|
+
* @param cwd - Optional project root override for skill resolution
|
|
180
|
+
* @returns Structured guidance with `.prompt` ready for LLM injection
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const guidance = buildStageGuidance('implementation');
|
|
185
|
+
* // guidance.primarySkill === 'ct-task-executor'
|
|
186
|
+
* // guidance.loadedSkills === ['ct-task-executor', 'ct-cleo', 'ct-orchestrator']
|
|
187
|
+
* // guidance.prompt starts with "## Skills Loaded (3 total)"
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
export function buildStageGuidance(stage: Stage, cwd?: string): StageGuidance {
|
|
191
|
+
const def = STAGE_DEFINITIONS[stage];
|
|
192
|
+
const primarySkill = STAGE_SKILL_MAP[stage];
|
|
193
|
+
|
|
194
|
+
// Primary first, then Tier 0 (de-dup if the primary is itself tier 0)
|
|
195
|
+
const skillNames = [primarySkill, ...TIER_0_SKILLS.filter((s) => s !== primarySkill)];
|
|
196
|
+
|
|
197
|
+
// Verify every skill can actually be found before calling prepareSpawnMulti
|
|
198
|
+
const allFound = skillNames.every((name) => findSkill(name, cwd) !== null);
|
|
199
|
+
|
|
200
|
+
if (!allFound) {
|
|
201
|
+
return {
|
|
202
|
+
stage,
|
|
203
|
+
name: def.name,
|
|
204
|
+
order: def.order,
|
|
205
|
+
primarySkill,
|
|
206
|
+
loadedSkills: skillNames,
|
|
207
|
+
requiredGates: def.requiredGates,
|
|
208
|
+
expectedArtifacts: def.expectedArtifacts,
|
|
209
|
+
prompt: buildFallbackPrompt(stage, primarySkill),
|
|
210
|
+
source: 'fallback',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
const composition = prepareSpawnMulti(skillNames, {}, cwd);
|
|
216
|
+
return {
|
|
217
|
+
stage,
|
|
218
|
+
name: def.name,
|
|
219
|
+
order: def.order,
|
|
220
|
+
primarySkill,
|
|
221
|
+
loadedSkills: skillNames,
|
|
222
|
+
requiredGates: def.requiredGates,
|
|
223
|
+
expectedArtifacts: def.expectedArtifacts,
|
|
224
|
+
prompt: composition.prompt,
|
|
225
|
+
source: 'skills',
|
|
226
|
+
};
|
|
227
|
+
} catch {
|
|
228
|
+
return {
|
|
229
|
+
stage,
|
|
230
|
+
name: def.name,
|
|
231
|
+
order: def.order,
|
|
232
|
+
primarySkill,
|
|
233
|
+
loadedSkills: skillNames,
|
|
234
|
+
requiredGates: def.requiredGates,
|
|
235
|
+
expectedArtifacts: def.expectedArtifacts,
|
|
236
|
+
prompt: buildFallbackPrompt(stage, primarySkill),
|
|
237
|
+
source: 'fallback',
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Format stage guidance as a Markdown-wrapped system prompt.
|
|
244
|
+
*
|
|
245
|
+
* Since `buildStageGuidance()` now returns the already-composed prompt in
|
|
246
|
+
* `.prompt`, this helper simply passes it through with a header banner
|
|
247
|
+
* identifying which skills are loaded and which stage is active.
|
|
248
|
+
*
|
|
249
|
+
* @param guidance - The structured guidance from `buildStageGuidance()`
|
|
250
|
+
* @returns Markdown text suitable for LLM system prompt injection
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const g = buildStageGuidance('research');
|
|
255
|
+
* const text = formatStageGuidance(g);
|
|
256
|
+
* return { systemPrompt: text }; // Pi before_agent_start hook return
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
export function formatStageGuidance(guidance: StageGuidance): string {
|
|
260
|
+
const banner = [
|
|
261
|
+
`## CLEO Stage-Aware Injection`,
|
|
262
|
+
`**Stage**: ${guidance.name} (${guidance.order}/9) — primary skill: \`${guidance.primarySkill}\``,
|
|
263
|
+
`**Loaded skills**: ${guidance.loadedSkills.join(', ')}`,
|
|
264
|
+
`**Source**: ${guidance.source}`,
|
|
265
|
+
`**Required gates**: ${guidance.requiredGates.map((g) => `\`${g}\``).join(', ')}`,
|
|
266
|
+
'',
|
|
267
|
+
'---',
|
|
268
|
+
'',
|
|
269
|
+
].join('\n');
|
|
270
|
+
return banner + guidance.prompt;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Convenience wrapper: build AND format in a single call.
|
|
275
|
+
*
|
|
276
|
+
* @param stage - The canonical pipeline stage identifier
|
|
277
|
+
* @param cwd - Optional project root override for skill resolution
|
|
278
|
+
* @returns Markdown text ready for LLM system prompt injection
|
|
279
|
+
*/
|
|
280
|
+
export function renderStageGuidance(stage: Stage, cwd?: string): string {
|
|
281
|
+
return formatStageGuidance(buildStageGuidance(stage, cwd));
|
|
282
|
+
}
|
|
@@ -11,27 +11,39 @@ function makeDetection(overrides) {
|
|
|
11
11
|
pathGlobal: '',
|
|
12
12
|
pathProject: '',
|
|
13
13
|
instructFile: 'CLAUDE.md',
|
|
14
|
-
configKey: 'mcpServers',
|
|
15
|
-
configFormat: 'json',
|
|
16
|
-
configPathGlobal: '',
|
|
17
|
-
configPathProject: '.claude.json',
|
|
18
14
|
pathSkills: '',
|
|
19
15
|
pathProjectSkills: '',
|
|
20
16
|
detection: { methods: ['binary'], binary: 'claude' },
|
|
21
|
-
supportedTransports: ['stdio'],
|
|
22
|
-
supportsHeaders: false,
|
|
23
17
|
priority: 'high',
|
|
24
18
|
status: 'active',
|
|
25
19
|
agentSkillsCompatible: true,
|
|
26
20
|
capabilities: {
|
|
21
|
+
mcp: {
|
|
22
|
+
configKey: 'mcpServers',
|
|
23
|
+
configFormat: 'json',
|
|
24
|
+
configPathGlobal: '',
|
|
25
|
+
configPathProject: '.claude.json',
|
|
26
|
+
supportedTransports: ['stdio'],
|
|
27
|
+
supportsHeaders: false,
|
|
28
|
+
},
|
|
29
|
+
harness: null,
|
|
27
30
|
skills: { agentsGlobalPath: null, agentsProjectPath: null, precedence: 'agents-first' },
|
|
28
|
-
hooks: {
|
|
31
|
+
hooks: {
|
|
32
|
+
supported: [],
|
|
33
|
+
hookConfigPath: null,
|
|
34
|
+
hookConfigPathProject: null,
|
|
35
|
+
hookFormat: null,
|
|
36
|
+
nativeEventCatalog: 'canonical',
|
|
37
|
+
canInjectSystemPrompt: false,
|
|
38
|
+
canBlockTools: false,
|
|
39
|
+
},
|
|
29
40
|
spawn: {
|
|
30
41
|
supportsSubagents: true,
|
|
31
42
|
supportsProgrammaticSpawn: true,
|
|
32
43
|
supportsInterAgentComms: false,
|
|
33
44
|
supportsParallelSpawn: true,
|
|
34
45
|
spawnMechanism: 'cli',
|
|
46
|
+
spawnCommand: null,
|
|
35
47
|
},
|
|
36
48
|
},
|
|
37
49
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-detection.test.js","sourceRoot":"","sources":["provider-detection.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAExE,SAAS,aAAa,CAAC,SAAmC;IACxD,OAAO;QACL,QAAQ,EAAE;YACR,EAAE,EAAE,aAAa;YACjB,QAAQ,EAAE,aAAa;YACvB,MAAM,EAAE,WAAW;YACnB,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,CAAC,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AC,aAAa,EAAE,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -13,27 +13,39 @@ function makeDetection(overrides: Partial<DetectionResult>): DetectionResult {
|
|
|
13
13
|
pathGlobal: '',
|
|
14
14
|
pathProject: '',
|
|
15
15
|
instructFile: 'CLAUDE.md',
|
|
16
|
-
configKey: 'mcpServers',
|
|
17
|
-
configFormat: 'json',
|
|
18
|
-
configPathGlobal: '',
|
|
19
|
-
configPathProject: '.claude.json',
|
|
20
16
|
pathSkills: '',
|
|
21
17
|
pathProjectSkills: '',
|
|
22
18
|
detection: { methods: ['binary'], binary: 'claude' },
|
|
23
|
-
supportedTransports: ['stdio'],
|
|
24
|
-
supportsHeaders: false,
|
|
25
19
|
priority: 'high',
|
|
26
20
|
status: 'active',
|
|
27
21
|
agentSkillsCompatible: true,
|
|
28
22
|
capabilities: {
|
|
23
|
+
mcp: {
|
|
24
|
+
configKey: 'mcpServers',
|
|
25
|
+
configFormat: 'json',
|
|
26
|
+
configPathGlobal: '',
|
|
27
|
+
configPathProject: '.claude.json',
|
|
28
|
+
supportedTransports: ['stdio'],
|
|
29
|
+
supportsHeaders: false,
|
|
30
|
+
},
|
|
31
|
+
harness: null,
|
|
29
32
|
skills: { agentsGlobalPath: null, agentsProjectPath: null, precedence: 'agents-first' },
|
|
30
|
-
hooks: {
|
|
33
|
+
hooks: {
|
|
34
|
+
supported: [],
|
|
35
|
+
hookConfigPath: null,
|
|
36
|
+
hookConfigPathProject: null,
|
|
37
|
+
hookFormat: null,
|
|
38
|
+
nativeEventCatalog: 'canonical',
|
|
39
|
+
canInjectSystemPrompt: false,
|
|
40
|
+
canBlockTools: false,
|
|
41
|
+
},
|
|
31
42
|
spawn: {
|
|
32
43
|
supportsSubagents: true,
|
|
33
44
|
supportsProgrammaticSpawn: true,
|
|
34
45
|
supportsInterAgentComms: false,
|
|
35
46
|
supportsParallelSpawn: true,
|
|
36
47
|
spawnMechanism: 'cli',
|
|
48
|
+
spawnCommand: null,
|
|
37
49
|
},
|
|
38
50
|
},
|
|
39
51
|
},
|