project-iris 0.0.13 → 0.0.15
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/README.md +261 -94
- package/bin/cli.js +21 -0
- package/flows/aidlc/README.md +372 -0
- package/flows/aidlc/agents/construction-agent.md +79 -0
- package/flows/aidlc/agents/inception-agent.md +97 -0
- package/flows/aidlc/agents/master-agent.md +61 -0
- package/flows/aidlc/agents/operations-agent.md +89 -0
- package/flows/aidlc/commands/construction-agent.md +63 -0
- package/flows/aidlc/commands/inception-agent.md +55 -0
- package/flows/aidlc/commands/master-agent.md +47 -0
- package/flows/aidlc/commands/operations-agent.md +77 -0
- package/flows/aidlc/context-config.yaml +67 -0
- package/flows/aidlc/memory-bank.yaml +104 -0
- package/flows/aidlc/quick-start.md +322 -0
- package/flows/aidlc/skills/construction/bolt-list.md +163 -0
- package/flows/aidlc/skills/construction/bolt-replan.md +345 -0
- package/flows/aidlc/skills/construction/bolt-start.md +442 -0
- package/flows/aidlc/skills/construction/bolt-status.md +185 -0
- package/flows/aidlc/skills/construction/navigator.md +196 -0
- package/flows/aidlc/skills/inception/bolt-plan.md +372 -0
- package/flows/aidlc/skills/inception/context.md +171 -0
- package/flows/aidlc/skills/inception/intent-create.md +211 -0
- package/flows/aidlc/skills/inception/intent-list.md +124 -0
- package/flows/aidlc/skills/inception/navigator.md +207 -0
- package/flows/aidlc/skills/inception/requirements.md +227 -0
- package/flows/aidlc/skills/inception/review.md +248 -0
- package/flows/aidlc/skills/inception/story-create.md +304 -0
- package/flows/aidlc/skills/inception/units.md +278 -0
- package/flows/aidlc/skills/master/analyze-context.md +239 -0
- package/flows/aidlc/skills/master/answer-question.md +141 -0
- package/flows/aidlc/skills/master/explain-flow.md +158 -0
- package/flows/aidlc/skills/master/project-init.md +281 -0
- package/flows/aidlc/skills/master/route-request.md +126 -0
- package/flows/aidlc/skills/operations/build.md +237 -0
- package/flows/aidlc/skills/operations/deploy.md +259 -0
- package/flows/aidlc/skills/operations/monitor.md +265 -0
- package/flows/aidlc/skills/operations/navigator.md +209 -0
- package/flows/aidlc/skills/operations/verify.md +224 -0
- package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/construction/bolt-types/ddd-construction-bolt.md +3 -3
- package/{dist → flows/aidlc}/templates/construction/bolt-types/spike-bolt.md +2 -2
- package/flows/aidlc/templates/construction/construction-log-template.md +129 -0
- package/flows/aidlc/templates/construction/standards/coding-standards.md +29 -0
- package/flows/aidlc/templates/construction/standards/system-architecture.md +22 -0
- package/flows/aidlc/templates/construction/standards/tech-stack.md +19 -0
- package/flows/aidlc/templates/inception/inception-log-template.md +134 -0
- package/flows/aidlc/templates/inception/project/README.md +55 -0
- package/flows/aidlc/templates/standards/catalog.yaml +345 -0
- package/flows/aidlc/templates/standards/coding-standards.guide.md +553 -0
- package/flows/aidlc/templates/standards/data-stack.guide.md +162 -0
- package/flows/aidlc/templates/standards/tech-stack.guide.md +280 -0
- package/lib/InstallerFactory.js +36 -0
- package/lib/analytics/env-detector.js +92 -0
- package/lib/analytics/index.js +22 -0
- package/lib/analytics/machine-id.js +33 -0
- package/lib/analytics/tracker.js +232 -0
- package/lib/cli-utils.js +342 -0
- package/lib/constants.js +32 -0
- package/lib/installer.js +402 -0
- package/lib/installers/AntigravityInstaller.js +112 -0
- package/lib/installers/ClaudeInstaller.js +85 -0
- package/lib/installers/ClineInstaller.js +21 -0
- package/lib/installers/CodexInstaller.js +21 -0
- package/lib/installers/CopilotInstaller.js +113 -0
- package/lib/installers/CursorInstaller.js +63 -0
- package/lib/installers/GeminiInstaller.js +75 -0
- package/lib/installers/KiroInstaller.js +22 -0
- package/lib/installers/OpenCodeInstaller.js +22 -0
- package/lib/installers/RooInstaller.js +22 -0
- package/lib/installers/ToolInstaller.js +73 -0
- package/lib/installers/WindsurfInstaller.js +22 -0
- package/lib/markdown-validator.ts +175 -0
- package/lib/yaml-validator.ts +99 -0
- package/package.json +106 -33
- package/scripts/artifact-validator.js +594 -0
- package/scripts/bolt-complete.js +606 -0
- package/scripts/status-integrity.js +598 -0
- package/dist/bridge/agent-runner.js +0 -190
- package/dist/bridge/connector-factory.js +0 -31
- package/dist/bridge/connectors/antigravity-connector.js +0 -18
- package/dist/bridge/connectors/cursor-connector.js +0 -31
- package/dist/bridge/connectors/in-process-connector.js +0 -29
- package/dist/bridge/connectors/vscode-connector.js +0 -31
- package/dist/bridge/connectors/windsurf-connector.js +0 -23
- package/dist/bridge/filesystem-connector.js +0 -110
- package/dist/bridge/helper.js +0 -203
- package/dist/bridge/types.js +0 -10
- package/dist/cli.js +0 -40
- package/dist/commands/ask.js +0 -259
- package/dist/commands/bridge.js +0 -88
- package/dist/commands/create.js +0 -25
- package/dist/commands/develop.js +0 -141
- package/dist/commands/doctor.js +0 -102
- package/dist/commands/flow.js +0 -301
- package/dist/commands/framework.js +0 -273
- package/dist/commands/generate.js +0 -59
- package/dist/commands/install.js +0 -100
- package/dist/commands/pack.js +0 -33
- package/dist/commands/phase.js +0 -38
- package/dist/commands/run.js +0 -199
- package/dist/commands/status.js +0 -114
- package/dist/commands/uninstall.js +0 -14
- package/dist/commands/use.js +0 -20
- package/dist/commands/validate.js +0 -102
- package/dist/framework/framework-loader.js +0 -97
- package/dist/framework/framework-paths.js +0 -48
- package/dist/framework/framework-types.js +0 -15
- package/dist/iris/artifact-checker.js +0 -78
- package/dist/iris/artifacts/config.js +0 -68
- package/dist/iris/artifacts/generator.js +0 -88
- package/dist/iris/artifacts/types.js +0 -1
- package/dist/iris/bundle.js +0 -44
- package/dist/iris/doctrine/collector.js +0 -124
- package/dist/iris/fixer.js +0 -149
- package/dist/iris/flows/manifest.js +0 -124
- package/dist/iris/framework-context.js +0 -49
- package/dist/iris/framework-manager.js +0 -215
- package/dist/iris/fs/atomic.js +0 -22
- package/dist/iris/guard.js +0 -38
- package/dist/iris/importers/index.js +0 -9
- package/dist/iris/importers/types.js +0 -8
- package/dist/iris/importers/writer.js +0 -139
- package/dist/iris/include.js +0 -49
- package/dist/iris/installer.js +0 -334
- package/dist/iris/interactive/env.js +0 -21
- package/dist/iris/interactive/intent-interview.js +0 -345
- package/dist/iris/interactive/intent-schema.js +0 -28
- package/dist/iris/interactive/interview-io.js +0 -22
- package/dist/iris/interview/config.js +0 -71
- package/dist/iris/interview/types.js +0 -16
- package/dist/iris/interview/utils.js +0 -38
- package/dist/iris/manifest.js +0 -54
- package/dist/iris/packer.js +0 -325
- package/dist/iris/parsers/unit-parser.js +0 -43
- package/dist/iris/paths.js +0 -18
- package/dist/iris/policy.js +0 -133
- package/dist/iris/proc.js +0 -56
- package/dist/iris/report.js +0 -53
- package/dist/iris/resolver.js +0 -66
- package/dist/iris/router.js +0 -114
- package/dist/iris/routes.js +0 -189
- package/dist/iris/run-state.js +0 -146
- package/dist/iris/state.js +0 -113
- package/dist/iris/templates.js +0 -70
- package/dist/iris/tmp.js +0 -24
- package/dist/iris/uninstaller.js +0 -181
- package/dist/iris/utils/interpolate.js +0 -42
- package/dist/iris/validator.js +0 -391
- package/dist/iris/workflow/config.js +0 -51
- package/dist/iris/workflow/engine.js +0 -129
- package/dist/iris/workflow/steps.js +0 -448
- package/dist/iris/workflow/types.js +0 -1
- package/dist/iris_bundle/frameworks/iris-core/framework.yaml +0 -9
- package/dist/iris_bundle/frameworks/iris-core/memory/memory-bank.yaml +0 -1
- package/dist/iris_bundle/frameworks/iris-core/policy.yaml +0 -7
- package/dist/iris_bundle/frameworks/iris-core/templates/config/memory-bank.yaml +0 -1
- package/dist/iris_bundle/frameworks/iris-core/templates/construction/bolt-types/spike-bolt.md +0 -240
- package/dist/lib.js +0 -96
- package/dist/templates/construction/bolt-template.md +0 -226
- package/dist/templates/construction/bolt-types/ddd-construction-bolt/adr-template.md +0 -49
- package/dist/templates/construction/bolt-types/ddd-construction-bolt/ddd-01-domain-model-template.md +0 -55
- package/dist/templates/construction/bolt-types/ddd-construction-bolt/ddd-02-technical-design-template.md +0 -67
- package/dist/templates/construction/bolt-types/ddd-construction-bolt/ddd-03-test-report-template.md +0 -62
- package/dist/templates/construction/bolt-types/ddd-construction-bolt.md +0 -528
- package/dist/templates/construction/bolt-types/simple-construction-bolt.md +0 -347
- package/dist/templates/inception/requirements-template.md +0 -144
- package/dist/templates/inception/stories-template.md +0 -38
- package/dist/templates/inception/story-template.md +0 -147
- package/dist/templates/inception/system-context-template.md +0 -29
- package/dist/templates/inception/unit-brief-template.md +0 -177
- package/dist/templates/inception/units-template.md +0 -52
- package/dist/utils/exit-codes.js +0 -7
- package/dist/utils/logo.js +0 -17
- package/dist/workflows/bolt-execution.js +0 -238
- package/dist/workflows/bolt-plan.js +0 -221
- package/dist/workflows/intent-inception.js +0 -285
- package/dist/workflows/memory-bank-generator.js +0 -180
- package/dist/workflows/reporting.js +0 -74
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/construction/bolt-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/construction/bolt-types/ddd-construction-bolt/adr-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/construction/bolt-types/ddd-construction-bolt/ddd-01-domain-model-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/construction/bolt-types/ddd-construction-bolt/ddd-02-technical-design-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/construction/bolt-types/ddd-construction-bolt/ddd-03-test-report-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/construction/bolt-types/simple-construction-bolt.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/inception/requirements-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/inception/stories-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/inception/story-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/inception/system-context-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/inception/unit-brief-template.md +0 -0
- /package/{dist/iris_bundle/frameworks/iris-core → flows/aidlc}/templates/inception/units-template.md +0 -0
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "crypto";
|
|
2
|
-
import inquirer from "inquirer";
|
|
3
|
-
import kleur from "kleur";
|
|
4
|
-
import fs from "fs";
|
|
5
|
-
import path from "path";
|
|
6
|
-
import { WorkflowStage } from "../bridge/types.js";
|
|
7
|
-
import { appendEvent, saveRun } from "../iris/run-state.js";
|
|
8
|
-
import { fileURLToPath } from "url";
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
/**
|
|
12
|
-
* Execute Bolt Plan stage
|
|
13
|
-
* Steps:
|
|
14
|
-
* 1. Generate bolt plan and individual bolt files
|
|
15
|
-
* 2. Parse bolt list from plan
|
|
16
|
-
* 3. Gate: Approve bolt plan? (y/N)
|
|
17
|
-
*/
|
|
18
|
-
export async function executeBoltPlan(runState, connector, options) {
|
|
19
|
-
console.log(kleur.bold("Bolt Plan Stage"));
|
|
20
|
-
console.log(kleur.dim("Generating implementation plan and bolts\n"));
|
|
21
|
-
// Step 1: Generate bolt plan
|
|
22
|
-
console.log(kleur.cyan("→ Generating bolt plan..."));
|
|
23
|
-
const planTaskId = randomUUID();
|
|
24
|
-
// Load template
|
|
25
|
-
const templateDir = path.join(__dirname, "../templates/construction");
|
|
26
|
-
let boltTemplate = "";
|
|
27
|
-
try {
|
|
28
|
-
if (fs.existsSync(path.join(templateDir, "bolt-template.md"))) {
|
|
29
|
-
boltTemplate = fs.readFileSync(path.join(templateDir, "bolt-template.md"), "utf-8");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
console.error("Failed to load bolt template:", e);
|
|
34
|
-
}
|
|
35
|
-
const planPacket = {
|
|
36
|
-
taskId: planTaskId,
|
|
37
|
-
intent: runState.intent,
|
|
38
|
-
stage: WorkflowStage.BOLT_PLAN,
|
|
39
|
-
agent: "iris-master-agent",
|
|
40
|
-
instructions: `Based on the intent artifacts, create a bolt plan and individual bolt files.
|
|
41
|
-
|
|
42
|
-
You must create a DETAILED implementation plan.
|
|
43
|
-
|
|
44
|
-
Intent: ${runState.intent}
|
|
45
|
-
|
|
46
|
-
Review the intent artifacts in memory-bank/intents/ to understand requirements.
|
|
47
|
-
|
|
48
|
-
Create:
|
|
49
|
-
1. memory-bank/bolts/plan.md - Overall implementation plan listing all bolts
|
|
50
|
-
2. memory-bank/bolts/<bolt-id>/bolt.md - One directory and file per bolt
|
|
51
|
-
|
|
52
|
-
For each bolt, generate a separate markdown file with:
|
|
53
|
-
1. Rich YAML frontmatter:
|
|
54
|
-
- id, unit, intent, type, status
|
|
55
|
-
- stories list
|
|
56
|
-
- timestamps (created, started, completed)
|
|
57
|
-
- requires_bolts/enables_bolts arrays
|
|
58
|
-
- complexity metrics
|
|
59
|
-
2. Full bolt structure:
|
|
60
|
-
- Overview, Objective, Stories Included
|
|
61
|
-
- Bolt Type with reference
|
|
62
|
-
- Stages checklist
|
|
63
|
-
- Dependencies (Requires/Enables)
|
|
64
|
-
- Success Criteria
|
|
65
|
-
- Implementation Notes
|
|
66
|
-
|
|
67
|
-
Analyze dependencies:
|
|
68
|
-
- Identify which bolts must complete before others
|
|
69
|
-
- Set requires_bolts field for dependent bolts
|
|
70
|
-
- Set enables_bolts to show what each bolt unlocks
|
|
71
|
-
- Calculate complexity based on:
|
|
72
|
-
- avg_complexity: 1-5 (code complexity)
|
|
73
|
-
- avg_uncertainty: 1-5 (requirements clarity)
|
|
74
|
-
- max_dependencies: count
|
|
75
|
-
- testing_scope: 1-5 (testing needed)
|
|
76
|
-
|
|
77
|
-
Use the following Bolt Template EXACTLY for each bolt file:
|
|
78
|
-
|
|
79
|
-
--- TEMPLATE: bolt.md ---
|
|
80
|
-
${boltTemplate}
|
|
81
|
-
-------------------------
|
|
82
|
-
|
|
83
|
-
In plan.md, list all bolts in dependency order.`,
|
|
84
|
-
inputs: runState.artifacts,
|
|
85
|
-
expectedOutputs: [
|
|
86
|
-
"memory-bank/bolts/plan.md"
|
|
87
|
-
],
|
|
88
|
-
metadata: { step: "generate_bolt_plan" }
|
|
89
|
-
};
|
|
90
|
-
appendEvent(runState.runId, {
|
|
91
|
-
stage: WorkflowStage.BOLT_PLAN,
|
|
92
|
-
action: "Requesting bolt plan generation",
|
|
93
|
-
taskId: planTaskId
|
|
94
|
-
});
|
|
95
|
-
if (options.noBridge) {
|
|
96
|
-
console.log(kleur.yellow(" Bridge disabled. Task packet written to:"));
|
|
97
|
-
console.log(kleur.dim(` .iris/bridge/inbox/${planTaskId}.json`));
|
|
98
|
-
console.log(kleur.dim(" Manually create result in .iris/bridge/outbox/\n"));
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
await connector.sendTask(planPacket);
|
|
103
|
-
console.log(kleur.dim(` Task sent: ${planTaskId}`));
|
|
104
|
-
console.log(kleur.dim(" Waiting for IDE agent to create bolt plan...\n"));
|
|
105
|
-
const planResult = await connector.waitResult(planTaskId, {
|
|
106
|
-
timeoutMs: 600000 // 10 minutes
|
|
107
|
-
});
|
|
108
|
-
if (planResult.status === "error") {
|
|
109
|
-
throw new Error(planResult.error || "Failed to generate bolt plan");
|
|
110
|
-
}
|
|
111
|
-
console.log(kleur.green("✓ Bolt plan created"));
|
|
112
|
-
if (planResult.filesChanged) {
|
|
113
|
-
planResult.filesChanged.forEach(file => {
|
|
114
|
-
console.log(kleur.dim(` - ${file}`));
|
|
115
|
-
runState.artifacts.push(file);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
console.log("");
|
|
119
|
-
appendEvent(runState.runId, {
|
|
120
|
-
stage: WorkflowStage.BOLT_PLAN,
|
|
121
|
-
action: "Bolt plan generated",
|
|
122
|
-
outputs: planResult.filesChanged,
|
|
123
|
-
resultStatus: "ok"
|
|
124
|
-
});
|
|
125
|
-
// Step 2: Parse bolt list from plan
|
|
126
|
-
const bolts = await parseBoltsFromPlan();
|
|
127
|
-
if (bolts.length === 0) {
|
|
128
|
-
console.log(kleur.yellow("⚠ No bolts found in plan. Creating default bolt.\n"));
|
|
129
|
-
bolts.push({
|
|
130
|
-
id: "implementation",
|
|
131
|
-
status: "pending"
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
runState.bolts = bolts;
|
|
135
|
-
console.log(kleur.cyan(`Found ${bolts.length} bolt(s):`));
|
|
136
|
-
bolts.forEach((bolt, i) => {
|
|
137
|
-
console.log(kleur.dim(` ${i + 1}. ${bolt.id}`));
|
|
138
|
-
});
|
|
139
|
-
console.log("");
|
|
140
|
-
// Step 3: Gate - Approve bolt plan?
|
|
141
|
-
if (options.gate === "manual") {
|
|
142
|
-
console.log(kleur.bold(kleur.yellow("Gate: Bolt Plan Approval")));
|
|
143
|
-
const { approved } = await inquirer.prompt([
|
|
144
|
-
{
|
|
145
|
-
type: "confirm",
|
|
146
|
-
name: "approved",
|
|
147
|
-
message: "Approve bolt plan and proceed to execution?",
|
|
148
|
-
default: true
|
|
149
|
-
}
|
|
150
|
-
]);
|
|
151
|
-
appendEvent(runState.runId, {
|
|
152
|
-
stage: WorkflowStage.BOLT_PLAN,
|
|
153
|
-
action: "Gate decision",
|
|
154
|
-
userGateDecision: approved ? "approved" : "rejected"
|
|
155
|
-
});
|
|
156
|
-
if (!approved) {
|
|
157
|
-
console.log(kleur.yellow("\n⚠ Bolt plan rejected. Revision loop not yet implemented."));
|
|
158
|
-
console.log(kleur.dim("For now, manually edit bolt files and re-run.\n"));
|
|
159
|
-
runState.stage = WorkflowStage.DONE;
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
console.log(kleur.green("✓ Bolt plan approved\n"));
|
|
163
|
-
}
|
|
164
|
-
// Move to next stage
|
|
165
|
-
runState.stage = WorkflowStage.BOLT_EXECUTION;
|
|
166
|
-
runState.currentBoltIndex = 0;
|
|
167
|
-
saveRun(runState);
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
console.error(kleur.red(`\n✗ Error: ${error.message}`));
|
|
171
|
-
appendEvent(runState.runId, {
|
|
172
|
-
stage: WorkflowStage.BOLT_PLAN,
|
|
173
|
-
action: "Stage failed",
|
|
174
|
-
message: error.message,
|
|
175
|
-
resultStatus: "error"
|
|
176
|
-
});
|
|
177
|
-
throw error;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Parse bolts from plan.md
|
|
182
|
-
* Looks for bolt file references or creates default list
|
|
183
|
-
*/
|
|
184
|
-
async function parseBoltsFromPlan() {
|
|
185
|
-
const planPath = path.join(process.cwd(), "memory-bank/bolts/plan.md");
|
|
186
|
-
if (!fs.existsSync(planPath)) {
|
|
187
|
-
return [];
|
|
188
|
-
}
|
|
189
|
-
const content = fs.readFileSync(planPath, "utf8");
|
|
190
|
-
const bolts = [];
|
|
191
|
-
// Look for bolt file references (e.g., "- bolt-name" or "1. bolt-name")
|
|
192
|
-
const boltPattern = /(?:^|\n)(?:\d+\.|[-*])\s+([a-z0-9-]+)(?:\/bolt\.md)?/gi;
|
|
193
|
-
let match;
|
|
194
|
-
while ((match = boltPattern.exec(content)) !== null) {
|
|
195
|
-
const boltId = match[1].replace(/\/bolt\.md$/, "");
|
|
196
|
-
if (!bolts.find(b => b.id === boltId)) {
|
|
197
|
-
bolts.push({
|
|
198
|
-
id: boltId,
|
|
199
|
-
status: "pending"
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// Also check for actual bolt directories
|
|
204
|
-
const boltsDir = path.join(process.cwd(), "memory-bank/bolts");
|
|
205
|
-
if (fs.existsSync(boltsDir)) {
|
|
206
|
-
const files = fs.readdirSync(boltsDir);
|
|
207
|
-
files.forEach(file => {
|
|
208
|
-
// Check if it's a directory and has bolt.md
|
|
209
|
-
const boltPath = path.join(boltsDir, file, "bolt.md");
|
|
210
|
-
if (fs.existsSync(boltPath)) {
|
|
211
|
-
if (!bolts.find(b => b.id === file)) {
|
|
212
|
-
bolts.push({
|
|
213
|
-
id: file,
|
|
214
|
-
status: "pending"
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
return bolts;
|
|
221
|
-
}
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "crypto";
|
|
2
|
-
import inquirer from "inquirer";
|
|
3
|
-
import kleur from "kleur";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { WorkflowStage } from "../bridge/types.js";
|
|
6
|
-
import { appendEvent, saveRun } from "../iris/run-state.js";
|
|
7
|
-
import fs from "fs";
|
|
8
|
-
import { fileURLToPath } from "url";
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
/**
|
|
12
|
-
* Execute Intent Inception stage
|
|
13
|
-
* Steps:
|
|
14
|
-
* 1. Generate clarifying questions (3-8)
|
|
15
|
-
* 2. Prompt user for answers
|
|
16
|
-
* 3. Generate requirements/system-context/stories/units
|
|
17
|
-
* 4. Gate: Approve intent? (y/N)
|
|
18
|
-
*/
|
|
19
|
-
export async function executeIntentInception(runState, connector, options) {
|
|
20
|
-
console.log(kleur.bold("Intent Inception Stage"));
|
|
21
|
-
console.log(kleur.dim("Clarifying requirements and creating intent artifacts\n"));
|
|
22
|
-
try {
|
|
23
|
-
// Step 1: Clarification Loop (Ping-Pong)
|
|
24
|
-
console.log(kleur.cyan("→ Starting clarification loop..."));
|
|
25
|
-
const history = [];
|
|
26
|
-
let isDone = false;
|
|
27
|
-
let turnCount = 0;
|
|
28
|
-
const MAX_TURNS = 10;
|
|
29
|
-
while (!isDone && turnCount < MAX_TURNS) {
|
|
30
|
-
turnCount++;
|
|
31
|
-
const turnId = randomUUID();
|
|
32
|
-
// Prepare context for the agent
|
|
33
|
-
const contextStr = history.map(h => `Q: ${h.question}\nA: ${h.answer}`).join("\n\n");
|
|
34
|
-
const instructions = `You are an expert product manager refining a user's intent.
|
|
35
|
-
Intent: "${runState.intent}"
|
|
36
|
-
|
|
37
|
-
Current Understanding (Q&A History):
|
|
38
|
-
${contextStr || "(None yet)"}
|
|
39
|
-
|
|
40
|
-
Task:
|
|
41
|
-
Analyze the intent and history.
|
|
42
|
-
You MUST clarify the following aspects before finishing:
|
|
43
|
-
1. Target User & Use Case
|
|
44
|
-
2. Technical Constraints (Language, Frameworks, Database)
|
|
45
|
-
3. Success Criteria (Specific requirements)
|
|
46
|
-
4. Non-Goals (What to avoid)
|
|
47
|
-
|
|
48
|
-
Instructions:
|
|
49
|
-
1. If you have clear answers for ALL the above aspects, return exactly the string "DONE".
|
|
50
|
-
2. If any aspect is missing or vague, ask the SINGLE most important clarifying question to ask the user next.
|
|
51
|
-
|
|
52
|
-
Return ONLY the question string or "DONE". Do not include JSON or explanation.`;
|
|
53
|
-
const packet = {
|
|
54
|
-
taskId: turnId,
|
|
55
|
-
intent: runState.intent,
|
|
56
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
57
|
-
agent: "iris-inception-agent",
|
|
58
|
-
instructions,
|
|
59
|
-
inputs: [],
|
|
60
|
-
expectedOutputs: [],
|
|
61
|
-
metadata: { step: "clarify_turn", turn: turnCount }
|
|
62
|
-
};
|
|
63
|
-
if (options.noBridge) {
|
|
64
|
-
console.log(kleur.yellow(` [Turn ${turnCount}] Bridge disabled. Write result to .iris/bridge/inbox/${turnId}.json`));
|
|
65
|
-
return; // Cannot proceed in loop without bridge in this mock implementation
|
|
66
|
-
}
|
|
67
|
-
// Inner try/catch for turn resilience
|
|
68
|
-
try {
|
|
69
|
-
await connector.sendTask(packet);
|
|
70
|
-
// Show loading spinner or status?
|
|
71
|
-
const turnResult = await connector.waitResult(turnId, { timeoutMs: 120000 }); // 2 mins per turn
|
|
72
|
-
if (turnResult.status === "error") {
|
|
73
|
-
throw new Error(turnResult.error || "Agent failed to respond");
|
|
74
|
-
}
|
|
75
|
-
const agentResponse = turnResult.message.trim();
|
|
76
|
-
if (agentResponse === "DONE" || agentResponse.includes('"DONE"')) {
|
|
77
|
-
isDone = true;
|
|
78
|
-
console.log(kleur.green("\n✓ Intent clarified. Proceeding to design...\n"));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
// It's a question
|
|
82
|
-
const question = agentResponse.replace(/^"|"$/g, ""); // strip quotes if present
|
|
83
|
-
console.log(kleur.bold(`\n${question}`));
|
|
84
|
-
const { answer } = await inquirer.prompt([
|
|
85
|
-
{
|
|
86
|
-
type: "input",
|
|
87
|
-
name: "answer",
|
|
88
|
-
message: "Answer:",
|
|
89
|
-
validate: (val) => val.trim().length > 0 || "Please provide an answer"
|
|
90
|
-
}
|
|
91
|
-
]);
|
|
92
|
-
history.push({ question, answer });
|
|
93
|
-
// Append event for tracking
|
|
94
|
-
appendEvent(runState.runId, {
|
|
95
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
96
|
-
action: "Q&A Turn",
|
|
97
|
-
message: `Q: ${question}\nA: ${answer}`
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
console.error(kleur.red(`Error in clarification loop: ${e.message}`));
|
|
103
|
-
break; // Exit loop on error to save partial progress
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (history.length > 0) {
|
|
107
|
-
console.log(kleur.dim(`Captured ${history.length} clarification points.`));
|
|
108
|
-
}
|
|
109
|
-
// Prepare answers object for artifact generation (format match)
|
|
110
|
-
const answers = {};
|
|
111
|
-
history.forEach((h, i) => {
|
|
112
|
-
answers[`${i + 1}. ${h.question}`] = h.answer;
|
|
113
|
-
});
|
|
114
|
-
// Step 3: Generate intent artifacts
|
|
115
|
-
console.log(kleur.cyan("→ Generating intent artifacts..."));
|
|
116
|
-
const intentSlug = runState.intent
|
|
117
|
-
.toLowerCase()
|
|
118
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
119
|
-
.replace(/^-|-$/g, "")
|
|
120
|
-
.substring(0, 50);
|
|
121
|
-
const artifactsTaskId = randomUUID();
|
|
122
|
-
// Load templates
|
|
123
|
-
const templateDir = path.join(__dirname, "../templates/inception");
|
|
124
|
-
let templates = {
|
|
125
|
-
requirements: "",
|
|
126
|
-
systemContext: "",
|
|
127
|
-
units: "",
|
|
128
|
-
unitBrief: "",
|
|
129
|
-
story: ""
|
|
130
|
-
};
|
|
131
|
-
try {
|
|
132
|
-
if (fs.existsSync(path.join(templateDir, "requirements-template.md"))) {
|
|
133
|
-
templates.requirements = fs.readFileSync(path.join(templateDir, "requirements-template.md"), "utf-8");
|
|
134
|
-
templates.systemContext = fs.readFileSync(path.join(templateDir, "system-context-template.md"), "utf-8");
|
|
135
|
-
templates.units = fs.readFileSync(path.join(templateDir, "units-template.md"), "utf-8");
|
|
136
|
-
templates.unitBrief = fs.readFileSync(path.join(templateDir, "unit-brief-template.md"), "utf-8");
|
|
137
|
-
templates.story = fs.readFileSync(path.join(templateDir, "story-template.md"), "utf-8");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
catch (e) {
|
|
141
|
-
console.error("Failed to load templates:", e);
|
|
142
|
-
}
|
|
143
|
-
const artifactsPacket = {
|
|
144
|
-
taskId: artifactsTaskId,
|
|
145
|
-
intent: runState.intent,
|
|
146
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
147
|
-
agent: "iris-inception-agent",
|
|
148
|
-
instructions: `Based on the intent and user answers, create the following intent artifacts.
|
|
149
|
-
|
|
150
|
-
You refer to the templates below. Your job is to fill them out with EXTREME DETAIL based on the user's input.
|
|
151
|
-
|
|
152
|
-
Intent: ${runState.intent}
|
|
153
|
-
|
|
154
|
-
User Answers:
|
|
155
|
-
${Object.entries(answers).map(([q, a]) => `Q: ${q}\nA: ${a}`).join("\n\n")}
|
|
156
|
-
|
|
157
|
-
Create files in: memory-bank/intents/${intentSlug}/
|
|
158
|
-
|
|
159
|
-
=== INSTRUCTIONS ===
|
|
160
|
-
|
|
161
|
-
1. **requirements.md**:
|
|
162
|
-
- Use the TEMPLATE below.
|
|
163
|
-
- Use "FR-X.Y" numbering for functional requirements.
|
|
164
|
-
- Use "SHALL", "SHOULD", "MAY" keywords.
|
|
165
|
-
- Group FRs by feature area.
|
|
166
|
-
- Include specific metrics for NFRs.
|
|
167
|
-
- Fill out "Business Goals" with measurable metrics.
|
|
168
|
-
|
|
169
|
-
2. **system-context.md**:
|
|
170
|
-
- Use the TEMPLATE below.
|
|
171
|
-
- Draw a Mermaid diagram for the context.
|
|
172
|
-
- List specific external integrations.
|
|
173
|
-
|
|
174
|
-
3. **units.md**:
|
|
175
|
-
- Decompose the intent into 3-8 logical units.
|
|
176
|
-
- Each unit should have a clear responsibility.
|
|
177
|
-
- Define dependencies between units.
|
|
178
|
-
|
|
179
|
-
4. **unit-brief.md** (for each unit):
|
|
180
|
-
- Create a directory for each unit: memory-bank/intents/${intentSlug}/units/{unit-name}/
|
|
181
|
-
- Create unit-brief.md inside.
|
|
182
|
-
- Use the TEMPLATE below.
|
|
183
|
-
|
|
184
|
-
5. **stories.md**:
|
|
185
|
-
- Use the TEMPLATE below.
|
|
186
|
-
- Create clear user stories and technical stories.
|
|
187
|
-
|
|
188
|
-
DO NOT use placeholders like "{insert here}". Write REAL content.
|
|
189
|
-
|
|
190
|
-
=== TEMPLATES ===
|
|
191
|
-
|
|
192
|
-
--- TEMPLATE: requirements.md ---
|
|
193
|
-
${templates.requirements}
|
|
194
|
-
--------------------------------
|
|
195
|
-
|
|
196
|
-
--- TEMPLATE: system-context.md ---
|
|
197
|
-
${templates.systemContext}
|
|
198
|
-
----------------------------------
|
|
199
|
-
|
|
200
|
-
--- TEMPLATE: units.md (Use for listing units) ---
|
|
201
|
-
${templates.units}
|
|
202
|
-
-------------------------------------------------
|
|
203
|
-
|
|
204
|
-
--- TEMPLATE: unit-brief.md (Use for each unit in units/) ---
|
|
205
|
-
${templates.unitBrief}
|
|
206
|
-
-----------------------------------------------------------
|
|
207
|
-
|
|
208
|
-
--- TEMPLATE: story.md (Use for each story in unit stories/) ---
|
|
209
|
-
${templates.story}
|
|
210
|
-
--------------------------------------------------------------
|
|
211
|
-
`,
|
|
212
|
-
inputs: [],
|
|
213
|
-
expectedOutputs: [
|
|
214
|
-
`memory-bank/intents/${intentSlug}/requirements.md`,
|
|
215
|
-
`memory-bank/intents/${intentSlug}/system-context.md`
|
|
216
|
-
],
|
|
217
|
-
metadata: { step: "generate_artifacts", intentSlug }
|
|
218
|
-
};
|
|
219
|
-
appendEvent(runState.runId, {
|
|
220
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
221
|
-
action: "Requesting artifact generation",
|
|
222
|
-
taskId: artifactsTaskId
|
|
223
|
-
});
|
|
224
|
-
await connector.sendTask(artifactsPacket);
|
|
225
|
-
console.log(kleur.dim(` Task sent: ${artifactsTaskId}`));
|
|
226
|
-
console.log(kleur.dim(" Waiting for IDE agent to create artifacts...\n"));
|
|
227
|
-
const artifactsResult = await connector.waitResult(artifactsTaskId, {
|
|
228
|
-
timeoutMs: 600000 // 10 minutes
|
|
229
|
-
});
|
|
230
|
-
if (artifactsResult.status === "error") {
|
|
231
|
-
throw new Error(artifactsResult.error || "Failed to generate artifacts");
|
|
232
|
-
}
|
|
233
|
-
console.log(kleur.green("✓ Artifacts created"));
|
|
234
|
-
if (artifactsResult.filesChanged) {
|
|
235
|
-
artifactsResult.filesChanged.forEach(file => {
|
|
236
|
-
console.log(kleur.dim(` - ${file}`));
|
|
237
|
-
runState.artifacts.push(file);
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
console.log("");
|
|
241
|
-
appendEvent(runState.runId, {
|
|
242
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
243
|
-
action: "Artifacts generated",
|
|
244
|
-
outputs: artifactsResult.filesChanged,
|
|
245
|
-
resultStatus: "ok"
|
|
246
|
-
});
|
|
247
|
-
// Step 4: Gate - Approve intent?
|
|
248
|
-
if (options.gate === "manual") {
|
|
249
|
-
console.log(kleur.bold(kleur.yellow("Gate: Intent Approval")));
|
|
250
|
-
const { approved } = await inquirer.prompt([
|
|
251
|
-
{
|
|
252
|
-
type: "confirm",
|
|
253
|
-
name: "approved",
|
|
254
|
-
message: "Approve intent artifacts and proceed to Bolt Plan?",
|
|
255
|
-
default: true
|
|
256
|
-
}
|
|
257
|
-
]);
|
|
258
|
-
appendEvent(runState.runId, {
|
|
259
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
260
|
-
action: "Gate decision",
|
|
261
|
-
userGateDecision: approved ? "approved" : "rejected"
|
|
262
|
-
});
|
|
263
|
-
if (!approved) {
|
|
264
|
-
console.log(kleur.yellow("\n⚠ Intent rejected. Revision loop not yet implemented."));
|
|
265
|
-
console.log(kleur.dim("For now, manually edit artifacts and re-run.\n"));
|
|
266
|
-
runState.stage = WorkflowStage.DONE;
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
console.log(kleur.green("✓ Intent approved\n"));
|
|
270
|
-
}
|
|
271
|
-
// Move to next stage
|
|
272
|
-
runState.stage = WorkflowStage.BOLT_PLAN;
|
|
273
|
-
saveRun(runState);
|
|
274
|
-
}
|
|
275
|
-
catch (error) {
|
|
276
|
-
console.error(kleur.red(`\n✗ Error: ${error.message}`));
|
|
277
|
-
appendEvent(runState.runId, {
|
|
278
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
279
|
-
action: "Stage failed",
|
|
280
|
-
message: error.message,
|
|
281
|
-
resultStatus: "error"
|
|
282
|
-
});
|
|
283
|
-
throw error;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "crypto";
|
|
2
|
-
import { WorkflowStage } from "../bridge/types.js";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import fs from "fs";
|
|
5
|
-
import { fileURLToPath } from "url";
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
/**
|
|
9
|
-
* Orchestrate the full memory bank structure generation
|
|
10
|
-
*/
|
|
11
|
-
export async function generateMemoryBankStructure(options) {
|
|
12
|
-
const { intent, answers, connector } = options;
|
|
13
|
-
const intentSlug = intent.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
14
|
-
// Use a timestamp based ID for now or fetch next ID if available in context
|
|
15
|
-
const intentId = "001"; // Placeholder, would need state to know next ID
|
|
16
|
-
const intentPath = `memory-bank/intents/${intentId}-${intentSlug}`;
|
|
17
|
-
// Create base directory
|
|
18
|
-
fs.mkdirSync(intentPath, { recursive: true });
|
|
19
|
-
// Load templats
|
|
20
|
-
const templates = loadTemplates();
|
|
21
|
-
// 1. Generate Requirements & System Context (Batched to save prompt tokens/time)
|
|
22
|
-
console.log("-> Generating Requirements & Context...");
|
|
23
|
-
await generateInitialArtifacts(intent, intentId, intentSlug, answers, connector, templates);
|
|
24
|
-
// 2. Decompose into Units
|
|
25
|
-
console.log("-> Decomposing into Units...");
|
|
26
|
-
const units = await decomposeIntoUnits(intent, intentSlug, connector, templates);
|
|
27
|
-
// 3. Generate Unit Briefs & Stories
|
|
28
|
-
console.log(`-> Generating details for ${units.length} units...`);
|
|
29
|
-
for (const unit of units) {
|
|
30
|
-
console.log(` -> Processing Unit: ${unit.name}`);
|
|
31
|
-
// Create unit directory
|
|
32
|
-
const unitDir = path.join(intentPath, "units", unit.name);
|
|
33
|
-
fs.mkdirSync(unitDir, { recursive: true });
|
|
34
|
-
await generateUnitBrief(unit, intent, intentSlug, connector, templates);
|
|
35
|
-
const stories = await generateStoriesForUnit(unit, intent, connector, templates);
|
|
36
|
-
// Save stories
|
|
37
|
-
const storiesDir = path.join(unitDir, "stories");
|
|
38
|
-
fs.mkdirSync(storiesDir, { recursive: true });
|
|
39
|
-
// This would typically involve another AI pass to write content for each story
|
|
40
|
-
// For efficiency in this script we might batch or generate placeholders
|
|
41
|
-
// But the user requested "full automation", so we should ideally generate them.
|
|
42
|
-
// For V1, we will list them in the unit brief or stories.md and create stub files
|
|
43
|
-
}
|
|
44
|
-
// 4. Generate Bolt Plan & Bolts
|
|
45
|
-
console.log("-> Generating Bolt Plan...");
|
|
46
|
-
// This re-uses the logic we improved in bolt-plan.ts, essentially calling the agent
|
|
47
|
-
// We can construct a packet similar to bolt-plan instructions
|
|
48
|
-
await generateBolts(intent, intentSlug, units, connector);
|
|
49
|
-
}
|
|
50
|
-
function loadTemplates() {
|
|
51
|
-
const templateDir = path.join(__dirname, "../templates/inception");
|
|
52
|
-
return {
|
|
53
|
-
requirements: fs.readFileSync(path.join(templateDir, "requirements-template.md"), "utf-8"),
|
|
54
|
-
systemContext: fs.readFileSync(path.join(templateDir, "system-context-template.md"), "utf-8"),
|
|
55
|
-
units: fs.readFileSync(path.join(templateDir, "units-template.md"), "utf-8"),
|
|
56
|
-
unitBrief: fs.readFileSync(path.join(templateDir, "unit-brief-template.md"), "utf-8"),
|
|
57
|
-
story: fs.readFileSync(path.join(templateDir, "story-template.md"), "utf-8"),
|
|
58
|
-
stories: fs.readFileSync(path.join(templateDir, "stories-template.md"), "utf-8"),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
async function generateInitialArtifacts(intent, intentId, slug, answers, connector, templates) {
|
|
62
|
-
const taskId = randomUUID();
|
|
63
|
-
const packet = {
|
|
64
|
-
taskId,
|
|
65
|
-
intent,
|
|
66
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
67
|
-
agent: "iris-inception-agent",
|
|
68
|
-
instructions: `Generate detailed requirements and system context for intent: "${intent}".
|
|
69
|
-
|
|
70
|
-
User Answers:
|
|
71
|
-
${Object.entries(answers).map(([q, a]) => `Q: ${q}\nA: ${a}`).join("\n\n")}
|
|
72
|
-
|
|
73
|
-
Files to create in memory-bank/intents/${intentId}-${slug}/:
|
|
74
|
-
1. requirements.md
|
|
75
|
-
2. system-context.md
|
|
76
|
-
|
|
77
|
-
Use these templates EXACTLY:
|
|
78
|
-
|
|
79
|
-
--- TEMPLATE: requirements.md ---
|
|
80
|
-
${templates.requirements}
|
|
81
|
-
--------------------------------
|
|
82
|
-
|
|
83
|
-
--- TEMPLATE: system-context.md ---
|
|
84
|
-
${templates.systemContext}
|
|
85
|
-
----------------------------------
|
|
86
|
-
`,
|
|
87
|
-
inputs: [],
|
|
88
|
-
expectedOutputs: [
|
|
89
|
-
`memory-bank/intents/${intentId}-${slug}/requirements.md`,
|
|
90
|
-
`memory-bank/intents/${intentId}-${slug}/system-context.md`
|
|
91
|
-
],
|
|
92
|
-
metadata: { step: "initial_artifacts" }
|
|
93
|
-
};
|
|
94
|
-
const result = await connector.sendTask(packet);
|
|
95
|
-
const taskResult = await connector.waitResult(taskId);
|
|
96
|
-
if (taskResult.status === 'error')
|
|
97
|
-
throw new Error(taskResult.error || "Unknown error");
|
|
98
|
-
}
|
|
99
|
-
async function decomposeIntoUnits(intent, slug, connector, templates) {
|
|
100
|
-
const taskId = randomUUID();
|
|
101
|
-
const packet = {
|
|
102
|
-
taskId,
|
|
103
|
-
intent,
|
|
104
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
105
|
-
agent: "iris-inception-agent",
|
|
106
|
-
instructions: `Analyze the intent "${intent}" and decompose it into 3-8 logical units.
|
|
107
|
-
|
|
108
|
-
Return a JSON object with the units list.
|
|
109
|
-
Do NOT write files yet, just return the JSON analysis.
|
|
110
|
-
|
|
111
|
-
Format:
|
|
112
|
-
{
|
|
113
|
-
"units": [
|
|
114
|
-
{
|
|
115
|
-
"name": "001-unit-name",
|
|
116
|
-
"purpose": "Brief purpose",
|
|
117
|
-
"description": "Longer description"
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
`,
|
|
122
|
-
inputs: [],
|
|
123
|
-
expectedOutputs: [], // We expect JSON in text response for this internal step
|
|
124
|
-
metadata: { step: "decompose_units" }
|
|
125
|
-
};
|
|
126
|
-
// In a real implementation we might want to have the agent write to a file or parse the output
|
|
127
|
-
// For this implementation, we'll assume the agent writes a 'units.json' or we'd parse the completion.
|
|
128
|
-
// Since our bridge is file-based in many cases, we can ask it to write memory-bank/intents/{slug}/units-analysis.json
|
|
129
|
-
// We will update instructions to write to a file we can read
|
|
130
|
-
packet.instructions += `\nWrite the JSON to memory-bank/intents/temp-units-analysis.json`;
|
|
131
|
-
packet.expectedOutputs = [`memory-bank/intents/temp-units-analysis.json`];
|
|
132
|
-
await connector.sendTask(packet);
|
|
133
|
-
const result = await connector.waitResult(taskId);
|
|
134
|
-
// Read the file
|
|
135
|
-
// Note: In a real app we'd handle paths more robustly
|
|
136
|
-
const analysisPath = path.resolve(process.cwd(), "memory-bank/intents/temp-units-analysis.json");
|
|
137
|
-
if (fs.existsSync(analysisPath)) {
|
|
138
|
-
try {
|
|
139
|
-
const data = JSON.parse(fs.readFileSync(analysisPath, 'utf8'));
|
|
140
|
-
return data.units || [];
|
|
141
|
-
}
|
|
142
|
-
catch (e) {
|
|
143
|
-
console.error("Failed to parse units analysis", e);
|
|
144
|
-
return [];
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return [];
|
|
148
|
-
}
|
|
149
|
-
async function generateUnitBrief(unit, intent, intentSlug, connector, templates) {
|
|
150
|
-
const taskId = randomUUID();
|
|
151
|
-
const packet = {
|
|
152
|
-
taskId,
|
|
153
|
-
intent,
|
|
154
|
-
stage: WorkflowStage.INTENT_INCEPTION,
|
|
155
|
-
agent: "iris-inception-agent",
|
|
156
|
-
instructions: `Generate unit brief for unit: ${unit.name}
|
|
157
|
-
|
|
158
|
-
Intent: ${intent}
|
|
159
|
-
Unit Purpose: ${unit.purpose}
|
|
160
|
-
|
|
161
|
-
File to create: memory-bank/intents/${intentSlug}/units/${unit.name}/unit-brief.md
|
|
162
|
-
|
|
163
|
-
Use TEMPLATE:
|
|
164
|
-
${templates.unitBrief}
|
|
165
|
-
`,
|
|
166
|
-
inputs: [],
|
|
167
|
-
expectedOutputs: [`memory-bank/intents/${intentSlug}/units/${unit.name}/unit-brief.md`],
|
|
168
|
-
metadata: { step: "unit_brief", unit: unit.name }
|
|
169
|
-
};
|
|
170
|
-
await connector.sendTask(packet);
|
|
171
|
-
await connector.waitResult(taskId);
|
|
172
|
-
}
|
|
173
|
-
async function generateStoriesForUnit(unit, intent, connector, templates) {
|
|
174
|
-
// Similar implementation to generate unit brief, but for stories
|
|
175
|
-
return []; // Placeholder for brevity in this first pass
|
|
176
|
-
}
|
|
177
|
-
async function generateBolts(intent, intentSlug, units, connector) {
|
|
178
|
-
// Reuse the logic from bolt-plan.ts but orchestrated here
|
|
179
|
-
// This would send a task to the Master Agent to create the bolt plan and bolt files
|
|
180
|
-
}
|