codeloop-mcp-server 0.1.14 → 0.1.16
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/LICENSE +21 -0
- package/README.md +75 -0
- package/dist/auth/local_mode.d.ts +32 -0
- package/dist/auth/local_mode.d.ts.map +1 -0
- package/dist/auth/local_mode.js +56 -0
- package/dist/auth/local_mode.js.map +1 -0
- package/dist/auth/usage_tracker.d.ts +11 -1
- package/dist/auth/usage_tracker.d.ts.map +1 -1
- package/dist/auth/usage_tracker.js +51 -4
- package/dist/auth/usage_tracker.js.map +1 -1
- package/dist/environment/presets.d.ts +46 -0
- package/dist/environment/presets.d.ts.map +1 -0
- package/dist/environment/presets.js +109 -0
- package/dist/environment/presets.js.map +1 -0
- package/dist/evidence/baseline_governance.d.ts +62 -0
- package/dist/evidence/baseline_governance.d.ts.map +1 -0
- package/dist/evidence/baseline_governance.js +113 -0
- package/dist/evidence/baseline_governance.js.map +1 -0
- package/dist/evidence/run_lineage.d.ts +66 -0
- package/dist/evidence/run_lineage.d.ts.map +1 -0
- package/dist/evidence/run_lineage.js +138 -0
- package/dist/evidence/run_lineage.js.map +1 -0
- package/dist/evidence/screenshot_diff.d.ts +6 -2
- package/dist/evidence/screenshot_diff.d.ts.map +1 -1
- package/dist/evidence/screenshot_diff.js +40 -3
- package/dist/evidence/screenshot_diff.js.map +1 -1
- package/dist/evidence/visual_attribution.d.ts +32 -0
- package/dist/evidence/visual_attribution.d.ts.map +1 -0
- package/dist/evidence/visual_attribution.js +88 -0
- package/dist/evidence/visual_attribution.js.map +1 -0
- package/dist/index.js +163 -1
- package/dist/index.js.map +1 -1
- package/dist/prompt_manager/index.d.ts +27 -0
- package/dist/prompt_manager/index.d.ts.map +1 -0
- package/dist/prompt_manager/index.js +28 -0
- package/dist/prompt_manager/index.js.map +1 -0
- package/dist/prompt_manager/state_machine.d.ts +55 -0
- package/dist/prompt_manager/state_machine.d.ts.map +1 -0
- package/dist/prompt_manager/state_machine.js +60 -0
- package/dist/prompt_manager/state_machine.js.map +1 -0
- package/dist/prompt_manager/templates.d.ts +43 -0
- package/dist/prompt_manager/templates.d.ts.map +1 -0
- package/dist/prompt_manager/templates.js +177 -0
- package/dist/prompt_manager/templates.js.map +1 -0
- package/dist/runners/base.d.ts +1 -1
- package/dist/runners/base.d.ts.map +1 -1
- package/dist/runners/base.js +2 -2
- package/dist/runners/base.js.map +1 -1
- package/dist/runners/figma_spec_generator.d.ts +54 -0
- package/dist/runners/figma_spec_generator.d.ts.map +1 -0
- package/dist/runners/figma_spec_generator.js +227 -0
- package/dist/runners/figma_spec_generator.js.map +1 -0
- package/dist/runners/generic.js +23 -20
- package/dist/runners/generic.js.map +1 -1
- package/dist/runners/playwright.d.ts +9 -1
- package/dist/runners/playwright.d.ts.map +1 -1
- package/dist/runners/playwright.js +18 -3
- package/dist/runners/playwright.js.map +1 -1
- package/dist/runners/plugin_sdk.d.ts +25 -0
- package/dist/runners/plugin_sdk.d.ts.map +1 -0
- package/dist/runners/plugin_sdk.js +86 -0
- package/dist/runners/plugin_sdk.js.map +1 -0
- package/dist/state/dependency_graph.d.ts +23 -0
- package/dist/state/dependency_graph.d.ts.map +1 -0
- package/dist/state/dependency_graph.js +127 -0
- package/dist/state/dependency_graph.js.map +1 -0
- package/dist/state/section_registry.d.ts.map +1 -1
- package/dist/state/section_registry.js +11 -5
- package/dist/state/section_registry.js.map +1 -1
- package/dist/tools/design_compare.js +2 -2
- package/dist/tools/design_compare.js.map +1 -1
- package/dist/tools/init-project.d.ts.map +1 -1
- package/dist/tools/init-project.js +40 -262
- package/dist/tools/init-project.js.map +1 -1
- package/dist/tools/update_baseline.d.ts +3 -0
- package/dist/tools/update_baseline.d.ts.map +1 -1
- package/dist/tools/update_baseline.js +18 -2
- package/dist/tools/update_baseline.js.map +1 -1
- package/dist/tools/verify.d.ts.map +1 -1
- package/dist/tools/verify.js +66 -4
- package/dist/tools/verify.js.map +1 -1
- package/dist/tools/visual_review.js +1 -1
- package/dist/tools/visual_review.js.map +1 -1
- package/package.json +28 -4
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-level state machine for multi-section orchestration.
|
|
3
|
+
*
|
|
4
|
+
* Layered above the per-section state machine in `state/section_registry.ts`.
|
|
5
|
+
* The app-level machine answers a single question: "what prompt layer should
|
|
6
|
+
* the agent receive next?" Inputs are coarse-grained events emitted by the
|
|
7
|
+
* MCP tools (`section_status`, `verify`, `gate_check`, `integration_check`,
|
|
8
|
+
* `replan`).
|
|
9
|
+
*/
|
|
10
|
+
import type { PromptLayer } from "./templates.js";
|
|
11
|
+
export type AppState = "idle" | "planning" | "implementing" | "repairing" | "integrating" | "released";
|
|
12
|
+
export type AppEvent = {
|
|
13
|
+
type: "user_goal_received";
|
|
14
|
+
} | {
|
|
15
|
+
type: "spec_ready";
|
|
16
|
+
} | {
|
|
17
|
+
type: "section_started";
|
|
18
|
+
} | {
|
|
19
|
+
type: "verify_failed";
|
|
20
|
+
} | {
|
|
21
|
+
type: "verify_passed";
|
|
22
|
+
} | {
|
|
23
|
+
type: "gate_failed";
|
|
24
|
+
} | {
|
|
25
|
+
type: "gate_passed";
|
|
26
|
+
} | {
|
|
27
|
+
type: "integration_due";
|
|
28
|
+
} | {
|
|
29
|
+
type: "integration_passed";
|
|
30
|
+
} | {
|
|
31
|
+
type: "integration_failed";
|
|
32
|
+
} | {
|
|
33
|
+
type: "replan_requested";
|
|
34
|
+
} | {
|
|
35
|
+
type: "all_sections_ready";
|
|
36
|
+
};
|
|
37
|
+
export interface Transition {
|
|
38
|
+
from: AppState;
|
|
39
|
+
event: AppEvent["type"];
|
|
40
|
+
to: AppState;
|
|
41
|
+
prompt_layer: PromptLayer;
|
|
42
|
+
}
|
|
43
|
+
export interface StepResult {
|
|
44
|
+
next_state: AppState;
|
|
45
|
+
prompt_layer: PromptLayer;
|
|
46
|
+
matched: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Compute the next app state and the prompt layer the agent should receive.
|
|
50
|
+
* If no transition matches, the state is preserved and `matched` is false; the
|
|
51
|
+
* caller should treat that as a no-op (continue the current loop).
|
|
52
|
+
*/
|
|
53
|
+
export declare function step(current: AppState, event: AppEvent): StepResult;
|
|
54
|
+
export declare function listTransitions(): readonly Transition[];
|
|
55
|
+
//# sourceMappingURL=state_machine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state_machine.d.ts","sourceRoot":"","sources":["../../src/prompt_manager/state_machine.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,UAAU,GACV,cAAc,GACd,WAAW,GACX,aAAa,GACb,UAAU,CAAC;AAEf,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GACvB;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GACvB;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxB,EAAE,EAAE,QAAQ,CAAC;IACb,YAAY,EAAE,WAAW,CAAC;CAC3B;AAuBD,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,QAAQ,CAAC;IACrB,YAAY,EAAE,WAAW,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,UAAU,CAOnE;AAiBD,wBAAgB,eAAe,IAAI,SAAS,UAAU,EAAE,CAEvD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-level state machine for multi-section orchestration.
|
|
3
|
+
*
|
|
4
|
+
* Layered above the per-section state machine in `state/section_registry.ts`.
|
|
5
|
+
* The app-level machine answers a single question: "what prompt layer should
|
|
6
|
+
* the agent receive next?" Inputs are coarse-grained events emitted by the
|
|
7
|
+
* MCP tools (`section_status`, `verify`, `gate_check`, `integration_check`,
|
|
8
|
+
* `replan`).
|
|
9
|
+
*/
|
|
10
|
+
const TRANSITIONS = [
|
|
11
|
+
{ from: "idle", event: "user_goal_received", to: "planning", prompt_layer: "master_human" },
|
|
12
|
+
{ from: "planning", event: "spec_ready", to: "implementing", prompt_layer: "planning" },
|
|
13
|
+
{ from: "implementing", event: "section_started", to: "implementing", prompt_layer: "section_implement" },
|
|
14
|
+
{ from: "implementing", event: "verify_failed", to: "repairing", prompt_layer: "repair" },
|
|
15
|
+
{ from: "implementing", event: "gate_failed", to: "repairing", prompt_layer: "repair" },
|
|
16
|
+
// Happy-path: verify/gate pass on the first try (no detour through repairing).
|
|
17
|
+
{ from: "implementing", event: "verify_passed", to: "implementing", prompt_layer: "section_implement" },
|
|
18
|
+
{ from: "implementing", event: "gate_passed", to: "implementing", prompt_layer: "section_implement" },
|
|
19
|
+
{ from: "repairing", event: "verify_passed", to: "implementing", prompt_layer: "section_implement" },
|
|
20
|
+
{ from: "repairing", event: "gate_passed", to: "implementing", prompt_layer: "section_implement" },
|
|
21
|
+
{ from: "repairing", event: "verify_failed", to: "repairing", prompt_layer: "repair" },
|
|
22
|
+
{ from: "repairing", event: "replan_requested", to: "planning", prompt_layer: "planning" },
|
|
23
|
+
{ from: "implementing", event: "integration_due", to: "integrating", prompt_layer: "integration" },
|
|
24
|
+
{ from: "integrating", event: "integration_passed", to: "implementing", prompt_layer: "section_implement" },
|
|
25
|
+
{ from: "integrating", event: "integration_failed", to: "repairing", prompt_layer: "repair" },
|
|
26
|
+
{ from: "integrating", event: "all_sections_ready", to: "released", prompt_layer: "integration" },
|
|
27
|
+
{ from: "implementing", event: "all_sections_ready", to: "integrating", prompt_layer: "integration" },
|
|
28
|
+
{ from: "implementing", event: "replan_requested", to: "planning", prompt_layer: "planning" },
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Compute the next app state and the prompt layer the agent should receive.
|
|
32
|
+
* If no transition matches, the state is preserved and `matched` is false; the
|
|
33
|
+
* caller should treat that as a no-op (continue the current loop).
|
|
34
|
+
*/
|
|
35
|
+
export function step(current, event) {
|
|
36
|
+
for (const t of TRANSITIONS) {
|
|
37
|
+
if (t.from === current && t.event === event.type) {
|
|
38
|
+
return { next_state: t.to, prompt_layer: t.prompt_layer, matched: true };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { next_state: current, prompt_layer: defaultLayerFor(current), matched: false };
|
|
42
|
+
}
|
|
43
|
+
function defaultLayerFor(state) {
|
|
44
|
+
switch (state) {
|
|
45
|
+
case "idle":
|
|
46
|
+
case "planning":
|
|
47
|
+
return "master_human";
|
|
48
|
+
case "implementing":
|
|
49
|
+
return "section_implement";
|
|
50
|
+
case "repairing":
|
|
51
|
+
return "repair";
|
|
52
|
+
case "integrating":
|
|
53
|
+
case "released":
|
|
54
|
+
return "integration";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function listTransitions() {
|
|
58
|
+
return TRANSITIONS;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=state_machine.js.map
|
|
@@ -0,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Y,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACzF,CAAC;AAED,SAAS,eAAe,CAAC,KAAe;IACtC,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM,CAAC;QACZ,KAAK,UAAU;YACb,OAAO,cAAc,CAAC;QACxB,KAAK,cAAc;YACjB,OAAO,mBAAmB,CAAC;QAC7B,KAAK,WAAW;YACd,OAAO,QAAQ,CAAC;QAClB,KAAK,aAAa,CAAC;QACnB,KAAK,UAAU;YACb,OAAO,aAAa,CAAC;IACzB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Manager — five-layer template library.
|
|
3
|
+
*
|
|
4
|
+
* Layers correspond to the lifecycle of multi-section app construction
|
|
5
|
+
* (see CodeLoop_Development_Plan.md §19):
|
|
6
|
+
* 1. master_human — top-level user-facing instruction relayed to the agent
|
|
7
|
+
* 2. planning — translate master spec into section graph + checkpoints
|
|
8
|
+
* 3. section_implement — per-section build prompt
|
|
9
|
+
* 4. repair — issued when verification or gate_check fails
|
|
10
|
+
* 5. integration — issued at integration checkpoints to wire sections together
|
|
11
|
+
*
|
|
12
|
+
* Each template is plain text with `{{variable}}` placeholders that are filled
|
|
13
|
+
* from a context object at render time. Missing variables become the literal
|
|
14
|
+
* empty string (the renderer never throws); callers are expected to validate
|
|
15
|
+
* required variables via {@link describeTemplate}.
|
|
16
|
+
*/
|
|
17
|
+
export type PromptLayer = "master_human" | "planning" | "section_implement" | "repair" | "integration";
|
|
18
|
+
export interface PromptTemplate {
|
|
19
|
+
layer: PromptLayer;
|
|
20
|
+
id: string;
|
|
21
|
+
description: string;
|
|
22
|
+
required_vars: readonly string[];
|
|
23
|
+
body: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const PROMPT_LAYERS: readonly PromptLayer[];
|
|
26
|
+
export declare function listTemplates(): readonly PromptTemplate[];
|
|
27
|
+
export declare function getTemplate(layer: PromptLayer): PromptTemplate;
|
|
28
|
+
export declare function describeTemplate(layer: PromptLayer): {
|
|
29
|
+
id: string;
|
|
30
|
+
description: string;
|
|
31
|
+
required_vars: readonly string[];
|
|
32
|
+
};
|
|
33
|
+
export interface RenderResult {
|
|
34
|
+
prompt: string;
|
|
35
|
+
missing_vars: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Render a template using a context object. Missing variables are recorded in
|
|
39
|
+
* `missing_vars` and replaced with the empty string. Caller decides whether to
|
|
40
|
+
* treat missing required variables as an error.
|
|
41
|
+
*/
|
|
42
|
+
export declare function renderTemplate(layer: PromptLayer, context?: Record<string, unknown>): RenderResult;
|
|
43
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/prompt_manager/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,WAAW,GACnB,cAAc,GACd,UAAU,GACV,mBAAmB,GACnB,QAAQ,GACR,aAAa,CAAC;AAElB,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd;AAwHD,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAM/C,CAAC;AAEF,wBAAgB,aAAa,IAAI,SAAS,cAAc,EAAE,CAEzD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,CAM9D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,CAOA;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACpC,YAAY,CAiBd"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Manager — five-layer template library.
|
|
3
|
+
*
|
|
4
|
+
* Layers correspond to the lifecycle of multi-section app construction
|
|
5
|
+
* (see CodeLoop_Development_Plan.md §19):
|
|
6
|
+
* 1. master_human — top-level user-facing instruction relayed to the agent
|
|
7
|
+
* 2. planning — translate master spec into section graph + checkpoints
|
|
8
|
+
* 3. section_implement — per-section build prompt
|
|
9
|
+
* 4. repair — issued when verification or gate_check fails
|
|
10
|
+
* 5. integration — issued at integration checkpoints to wire sections together
|
|
11
|
+
*
|
|
12
|
+
* Each template is plain text with `{{variable}}` placeholders that are filled
|
|
13
|
+
* from a context object at render time. Missing variables become the literal
|
|
14
|
+
* empty string (the renderer never throws); callers are expected to validate
|
|
15
|
+
* required variables via {@link describeTemplate}.
|
|
16
|
+
*/
|
|
17
|
+
const TEMPLATES = {
|
|
18
|
+
master_human: {
|
|
19
|
+
layer: "master_human",
|
|
20
|
+
id: "master_human.v1",
|
|
21
|
+
description: "Initial framing for the agent when the user issues a one-line application goal. Echoes back the goal, requires a master spec, and forces a planning pass.",
|
|
22
|
+
required_vars: ["user_goal", "project_name"],
|
|
23
|
+
body: [
|
|
24
|
+
"You are working on **{{project_name}}**.",
|
|
25
|
+
"",
|
|
26
|
+
"User goal:",
|
|
27
|
+
"> {{user_goal}}",
|
|
28
|
+
"",
|
|
29
|
+
"Before writing any code:",
|
|
30
|
+
"1. Confirm `docs/specs/_master.md` exists. If it does not, write one that breaks the goal into independently testable sections with explicit dependencies.",
|
|
31
|
+
"2. Call `codeloop_section_status` to bootstrap the section registry.",
|
|
32
|
+
"3. Call `codeloop_get_prompt` with `layer=\"planning\"` to produce a build plan, then proceed section by section.",
|
|
33
|
+
"",
|
|
34
|
+
"Constraints:",
|
|
35
|
+
"- Never declare the project complete without a passing `codeloop_gate_check` (confidence ≥ 94%).",
|
|
36
|
+
"- After every code change, call `codeloop_verify`. If `codeloop_diagnose` returns repair tasks, call `codeloop_get_prompt` with `layer=\"repair\"`.",
|
|
37
|
+
"- After every {{integration_cadence}} sections, call `codeloop_integration_check`.",
|
|
38
|
+
].join("\n"),
|
|
39
|
+
},
|
|
40
|
+
planning: {
|
|
41
|
+
layer: "planning",
|
|
42
|
+
id: "planning.v1",
|
|
43
|
+
description: "Translates the master spec into an ordered build plan and per-section acceptance criteria. Output is consumed by section_implement.",
|
|
44
|
+
required_vars: ["master_spec_path", "section_count"],
|
|
45
|
+
body: [
|
|
46
|
+
"Plan a section-by-section build for the spec at `{{master_spec_path}}`.",
|
|
47
|
+
"There are {{section_count}} sections. For each section, list:",
|
|
48
|
+
" - section_id (kebab-case, matches the spec heading)",
|
|
49
|
+
" - blocking dependencies (other section_ids that must be `READY` first)",
|
|
50
|
+
" - acceptance criteria (testable, max 6 bullets)",
|
|
51
|
+
" - integration risk (which earlier sections are most likely to regress)",
|
|
52
|
+
"",
|
|
53
|
+
"Order the sections via topological sort. When dependencies tie, prefer the section with the fewest acceptance criteria first to maximise early gate-check signal.",
|
|
54
|
+
"",
|
|
55
|
+
"Emit the result as JSON matching this shape:",
|
|
56
|
+
"```json",
|
|
57
|
+
"{",
|
|
58
|
+
" \"order\": [\"section-id-1\", \"section-id-2\", ...],",
|
|
59
|
+
" \"sections\": {",
|
|
60
|
+
" \"section-id-1\": { \"deps\": [], \"acceptance\": [...], \"risk\": [...] }",
|
|
61
|
+
" },",
|
|
62
|
+
" \"integration_checkpoints\": [\"section-id-2\", \"section-id-4\"]",
|
|
63
|
+
"}",
|
|
64
|
+
"```",
|
|
65
|
+
].join("\n"),
|
|
66
|
+
},
|
|
67
|
+
section_implement: {
|
|
68
|
+
layer: "section_implement",
|
|
69
|
+
id: "section_implement.v1",
|
|
70
|
+
description: "Per-section build prompt. Embeds acceptance criteria and forces a verify+gate loop before the section may be marked READY.",
|
|
71
|
+
required_vars: ["section_id", "section_name", "acceptance_criteria"],
|
|
72
|
+
body: [
|
|
73
|
+
"Implement section **{{section_id}} — {{section_name}}**.",
|
|
74
|
+
"",
|
|
75
|
+
"Acceptance criteria:",
|
|
76
|
+
"{{acceptance_criteria}}",
|
|
77
|
+
"",
|
|
78
|
+
"Dependencies already READY: {{ready_deps}}",
|
|
79
|
+
"",
|
|
80
|
+
"Workflow:",
|
|
81
|
+
"1. Make the smallest coherent code change that advances at least one acceptance criterion.",
|
|
82
|
+
"2. Call `codeloop_verify` with `section_id={{section_id}}`.",
|
|
83
|
+
"3. If verification fails, request the repair prompt (`codeloop_get_prompt` layer=\"repair\"). Do not skip to the next section.",
|
|
84
|
+
"4. When all acceptance criteria are met and `codeloop_gate_check` passes for this section, call `codeloop_section_status` to mark it READY.",
|
|
85
|
+
"",
|
|
86
|
+
"Do not modify files belonging to other sections. If you must, stop and request `layer=\"integration\"` instead.",
|
|
87
|
+
].join("\n"),
|
|
88
|
+
},
|
|
89
|
+
repair: {
|
|
90
|
+
layer: "repair",
|
|
91
|
+
id: "repair.v1",
|
|
92
|
+
description: "Repair prompt. Used when codeloop_verify or codeloop_gate_check fails. Forces a constrained, deterministic fix loop.",
|
|
93
|
+
required_vars: ["section_id", "failure_summary", "attempt", "max_attempts"],
|
|
94
|
+
body: [
|
|
95
|
+
"Repair attempt {{attempt}}/{{max_attempts}} for section **{{section_id}}**.",
|
|
96
|
+
"",
|
|
97
|
+
"Failure summary from `codeloop_diagnose`:",
|
|
98
|
+
"{{failure_summary}}",
|
|
99
|
+
"",
|
|
100
|
+
"Rules:",
|
|
101
|
+
"1. Address the highest-priority repair task first.",
|
|
102
|
+
"2. Do not introduce changes outside the failing section's directory unless the diagnose report explicitly says so.",
|
|
103
|
+
"3. After each fix, re-run `codeloop_verify` for this section only.",
|
|
104
|
+
"4. If attempt {{attempt}} >= {{max_attempts}}, stop and call `codeloop_replan` to escalate.",
|
|
105
|
+
"",
|
|
106
|
+
"Treat any new lint warnings or test regressions in already-READY sections as a hard stop — switch to the integration prompt instead.",
|
|
107
|
+
].join("\n"),
|
|
108
|
+
},
|
|
109
|
+
integration: {
|
|
110
|
+
layer: "integration",
|
|
111
|
+
id: "integration.v1",
|
|
112
|
+
description: "Integration prompt issued at checkpoints. Coordinates cross-section verification and regression hunting.",
|
|
113
|
+
required_vars: ["sections_in_scope", "checkpoint_index"],
|
|
114
|
+
body: [
|
|
115
|
+
"Integration checkpoint #{{checkpoint_index}}.",
|
|
116
|
+
"",
|
|
117
|
+
"Sections in scope: {{sections_in_scope}}",
|
|
118
|
+
"",
|
|
119
|
+
"Workflow:",
|
|
120
|
+
"1. Call `codeloop_integration_check` for the listed sections.",
|
|
121
|
+
"2. For each regression listed in the result, open the affected section, run `codeloop_get_prompt` with `layer=\"repair\"`, and fix it before continuing.",
|
|
122
|
+
"3. Capture cross-section screenshots and a short interaction recording with `codeloop_capture_screenshot` and `codeloop_start_recording`/`codeloop_stop_recording`.",
|
|
123
|
+
"4. Call `codeloop_gate_check` with `scope=\"integration\"`.",
|
|
124
|
+
"",
|
|
125
|
+
"Only return to per-section work when integration confidence is ≥ 94%.",
|
|
126
|
+
].join("\n"),
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
export const PROMPT_LAYERS = [
|
|
130
|
+
"master_human",
|
|
131
|
+
"planning",
|
|
132
|
+
"section_implement",
|
|
133
|
+
"repair",
|
|
134
|
+
"integration",
|
|
135
|
+
];
|
|
136
|
+
export function listTemplates() {
|
|
137
|
+
return PROMPT_LAYERS.map((layer) => TEMPLATES[layer]);
|
|
138
|
+
}
|
|
139
|
+
export function getTemplate(layer) {
|
|
140
|
+
const t = TEMPLATES[layer];
|
|
141
|
+
if (!t) {
|
|
142
|
+
throw new Error(`Unknown prompt layer: ${layer}`);
|
|
143
|
+
}
|
|
144
|
+
return t;
|
|
145
|
+
}
|
|
146
|
+
export function describeTemplate(layer) {
|
|
147
|
+
const t = getTemplate(layer);
|
|
148
|
+
return {
|
|
149
|
+
id: t.id,
|
|
150
|
+
description: t.description,
|
|
151
|
+
required_vars: t.required_vars,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Render a template using a context object. Missing variables are recorded in
|
|
156
|
+
* `missing_vars` and replaced with the empty string. Caller decides whether to
|
|
157
|
+
* treat missing required variables as an error.
|
|
158
|
+
*/
|
|
159
|
+
export function renderTemplate(layer, context = {}) {
|
|
160
|
+
const tpl = getTemplate(layer);
|
|
161
|
+
const missing = [];
|
|
162
|
+
const prompt = tpl.body.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g, (_m, key) => {
|
|
163
|
+
const value = context[key];
|
|
164
|
+
if (value === undefined || value === null || value === "") {
|
|
165
|
+
if (tpl.required_vars.includes(key)) {
|
|
166
|
+
missing.push(key);
|
|
167
|
+
}
|
|
168
|
+
return "";
|
|
169
|
+
}
|
|
170
|
+
if (Array.isArray(value)) {
|
|
171
|
+
return value.map((v) => `- ${String(v)}`).join("\n");
|
|
172
|
+
}
|
|
173
|
+
return String(value);
|
|
174
|
+
});
|
|
175
|
+
return { prompt, missing_vars: [...new Set(missing)] };
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/prompt_manager/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAiBH,MAAM,SAAS,GAAwC;IACrD,YAAY,EAAE;QACZ,KAAK,EAAE,cAAc;QACrB,EAAE,EAAE,iBAAiB;QACrB,WAAW,EACT,2JAA2J;QAC7J,aAAa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}
|
|
13
13
|
export declare function makeSkippedResult(runnerName: string, reason: string): RunnerResult;
|
|
14
14
|
export declare function checkToolAvailable(command: string): Promise<boolean>;
|
|
15
|
-
export declare function runCommand(cmd: string, args: string[], cwd: string, logPath?: string): Promise<{
|
|
15
|
+
export declare function runCommand(cmd: string, args: string[], cwd: string, logPath?: string, extraEnv?: Record<string, string>): Promise<{
|
|
16
16
|
exit_code: number;
|
|
17
17
|
stdout: string;
|
|
18
18
|
stderr: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/runners/base.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,YAAY,CAad;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ1E;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/runners/base.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,YAAY,CAad;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ1E;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAqDrF"}
|
package/dist/runners/base.js
CHANGED
|
@@ -25,7 +25,7 @@ export async function checkToolAvailable(command) {
|
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
export async function runCommand(cmd, args, cwd, logPath) {
|
|
28
|
+
export async function runCommand(cmd, args, cwd, logPath, extraEnv) {
|
|
29
29
|
const start = Date.now();
|
|
30
30
|
return new Promise((resolve) => {
|
|
31
31
|
const quotedArgs = args.map(a => (a.includes(" ") ? `"${a}"` : a));
|
|
@@ -33,7 +33,7 @@ export async function runCommand(cmd, args, cwd, logPath) {
|
|
|
33
33
|
cwd,
|
|
34
34
|
shell: true,
|
|
35
35
|
stdio: ["pipe", "pipe", "pipe"],
|
|
36
|
-
env: { ...process.env },
|
|
36
|
+
env: { ...process.env, ...(extraEnv ?? {}) },
|
|
37
37
|
});
|
|
38
38
|
const stdoutChunks = [];
|
|
39
39
|
const stderrChunks = [];
|
package/dist/runners/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/runners/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAe/B,MAAM,UAAU,iBAAiB,CAC/B,UAAkB,EAClB,MAAc;IAEd,OAAO;QACL,WAAW,EAAE,UAAU;QACvB,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,CAAC,CAAC;QACb,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,CAAC;QACd,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,MAAM;KACf,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAe;IACtD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAClE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpE,OAAO,MAAM,CAAC,SAAS,KAAK,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,GAAW,EACX,IAAc,EACd,GAAW,EACX,OAAgB;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/runners/base.ts"],"names":[],"mappings":"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,IAAI,IAAI,CAAC,IAAI;oBAC3B,gBAAgB,WAAW,MAAM;oBACjC,mBAAmB,MAAM,IAAI;oBAC7B,mBAAmB,MAAM,IAAI,CAChC,CAAC;YACJ,CAAC;YAED,OAAO,CAAC;gBACN,SAAS,EAAE,IAAI,IAAI,CAAC;gBACpB,MAAM;gBACN,MAAM;gBACN,WAAW;aACZ,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACrB,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;YACvC,OAAO,CAAC;gBACN,SAAS,EAAE,GAAG;gBACd,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,oBAAoB,GAAG,EAAE;gBACjC,WAAW;aACZ,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Spec Generator — pulls design tokens (colors, typography, spacing)
|
|
3
|
+
* from a Figma file's styles and writes them to `docs/specs/` and
|
|
4
|
+
* `docs/ui_rules.md`. Extends the existing Figma fetcher with token-level
|
|
5
|
+
* extraction via the Figma REST API v1 `files/:key` endpoint.
|
|
6
|
+
*/
|
|
7
|
+
export interface ColorToken {
|
|
8
|
+
name: string;
|
|
9
|
+
hex: string;
|
|
10
|
+
opacity: number;
|
|
11
|
+
r: number;
|
|
12
|
+
g: number;
|
|
13
|
+
b: number;
|
|
14
|
+
}
|
|
15
|
+
export interface TypographyToken {
|
|
16
|
+
name: string;
|
|
17
|
+
family: string;
|
|
18
|
+
weight: number;
|
|
19
|
+
size: number;
|
|
20
|
+
line_height?: number;
|
|
21
|
+
letter_spacing?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface SpacingToken {
|
|
24
|
+
name: string;
|
|
25
|
+
value: number;
|
|
26
|
+
}
|
|
27
|
+
export interface DesignTokens {
|
|
28
|
+
colors: ColorToken[];
|
|
29
|
+
typography: TypographyToken[];
|
|
30
|
+
spacing: SpacingToken[];
|
|
31
|
+
extracted_at: string;
|
|
32
|
+
figma_file_key: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Extract design tokens from a Figma file using the REST API.
|
|
36
|
+
*/
|
|
37
|
+
export declare function extractTokensFromFigma(fileKey: string, token: string): Promise<{
|
|
38
|
+
tokens: DesignTokens;
|
|
39
|
+
errors: string[];
|
|
40
|
+
}>;
|
|
41
|
+
export declare function writeTokenFiles(cwd: string, tokens: DesignTokens): {
|
|
42
|
+
specPath: string;
|
|
43
|
+
rulesPath: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Full pipeline: load Figma config -> extract tokens -> write docs.
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateSpec(cwd: string): Promise<{
|
|
49
|
+
tokens: DesignTokens;
|
|
50
|
+
errors: string[];
|
|
51
|
+
specPath?: string;
|
|
52
|
+
rulesPath?: string;
|
|
53
|
+
}>;
|
|
54
|
+
//# sourceMappingURL=figma_spec_generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figma_spec_generator.d.ts","sourceRoot":"","sources":["../../src/runners/figma_spec_generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,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