workspace-maxxing 0.1.0
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/.agents/skills/workspace-maxxing/.workspace-templates/CONTEXT.md +44 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/SYSTEM.md +44 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/references/anti-patterns.md +16 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/references/iron-laws.md +26 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/references/reporting-format.md +52 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/benchmark.ts +171 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/dispatch.ts +473 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/generate-tests.ts +158 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/install-tool.ts +82 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/iterate.ts +265 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/orchestrator.ts +539 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/scaffold.ts +282 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/scripts/validate.ts +452 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/architecture/SKILL.md +95 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/fixer/SKILL.md +109 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/iteration/SKILL.md +89 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/prompt-engineering/SKILL.md +87 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/research/SKILL.md +94 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/testing/SKILL.md +89 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/tooling/SKILL.md +87 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/validation/SKILL.md +103 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/skills/worker/SKILL.md +79 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/00-meta/CONTEXT.md +6 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/00-meta/execution-log.md +27 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/01-input/CONTEXT.md +29 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/02-process/CONTEXT.md +29 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/03-output/CONTEXT.md +29 -0
- package/.agents/skills/workspace-maxxing/.workspace-templates/workspace/README.md +14 -0
- package/.agents/skills/workspace-maxxing/SKILL.md +312 -0
- package/.agents/skills/workspace-maxxing/scripts/benchmark.ts +171 -0
- package/.agents/skills/workspace-maxxing/scripts/dispatch.ts +473 -0
- package/.agents/skills/workspace-maxxing/scripts/generate-tests.ts +158 -0
- package/.agents/skills/workspace-maxxing/scripts/install-tool.ts +82 -0
- package/.agents/skills/workspace-maxxing/scripts/iterate.ts +265 -0
- package/.agents/skills/workspace-maxxing/scripts/orchestrator.ts +539 -0
- package/.agents/skills/workspace-maxxing/scripts/scaffold.ts +282 -0
- package/.agents/skills/workspace-maxxing/scripts/validate.ts +452 -0
- package/README.md +144 -0
- package/dist/agent-creator.d.ts +9 -0
- package/dist/agent-creator.d.ts.map +1 -0
- package/dist/agent-creator.js +199 -0
- package/dist/agent-creator.js.map +1 -0
- package/dist/agent-iterator.d.ts +38 -0
- package/dist/agent-iterator.d.ts.map +1 -0
- package/dist/agent-iterator.js +327 -0
- package/dist/agent-iterator.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +18 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +117 -0
- package/dist/install.js.map +1 -0
- package/dist/platforms/claude.d.ts +7 -0
- package/dist/platforms/claude.d.ts.map +1 -0
- package/dist/platforms/claude.js +70 -0
- package/dist/platforms/claude.js.map +1 -0
- package/dist/platforms/copilot.d.ts +7 -0
- package/dist/platforms/copilot.d.ts.map +1 -0
- package/dist/platforms/copilot.js +75 -0
- package/dist/platforms/copilot.js.map +1 -0
- package/dist/platforms/gemini.d.ts +7 -0
- package/dist/platforms/gemini.d.ts.map +1 -0
- package/dist/platforms/gemini.js +81 -0
- package/dist/platforms/gemini.js.map +1 -0
- package/dist/platforms/index.d.ts +8 -0
- package/dist/platforms/index.d.ts.map +1 -0
- package/dist/platforms/index.js +41 -0
- package/dist/platforms/index.js.map +1 -0
- package/dist/platforms/opencode.d.ts +7 -0
- package/dist/platforms/opencode.d.ts.map +1 -0
- package/dist/platforms/opencode.js +70 -0
- package/dist/platforms/opencode.js.map +1 -0
- package/dist/scripts/benchmark.d.ts +20 -0
- package/dist/scripts/benchmark.d.ts.map +1 -0
- package/dist/scripts/benchmark.js +170 -0
- package/dist/scripts/benchmark.js.map +1 -0
- package/dist/scripts/dispatch.d.ts +32 -0
- package/dist/scripts/dispatch.d.ts.map +1 -0
- package/dist/scripts/dispatch.js +386 -0
- package/dist/scripts/dispatch.js.map +1 -0
- package/dist/scripts/generate-tests.d.ts +11 -0
- package/dist/scripts/generate-tests.d.ts.map +1 -0
- package/dist/scripts/generate-tests.js +118 -0
- package/dist/scripts/generate-tests.js.map +1 -0
- package/dist/scripts/install-tool.d.ts +8 -0
- package/dist/scripts/install-tool.d.ts.map +1 -0
- package/dist/scripts/install-tool.js +98 -0
- package/dist/scripts/install-tool.js.map +1 -0
- package/dist/scripts/iterate.d.ts +44 -0
- package/dist/scripts/iterate.d.ts.map +1 -0
- package/dist/scripts/iterate.js +260 -0
- package/dist/scripts/iterate.js.map +1 -0
- package/dist/scripts/orchestrator.d.ts +40 -0
- package/dist/scripts/orchestrator.d.ts.map +1 -0
- package/dist/scripts/orchestrator.js +378 -0
- package/dist/scripts/orchestrator.js.map +1 -0
- package/dist/scripts/scaffold.d.ts +8 -0
- package/dist/scripts/scaffold.d.ts.map +1 -0
- package/dist/scripts/scaffold.js +279 -0
- package/dist/scripts/scaffold.js.map +1 -0
- package/dist/scripts/validate.d.ts +11 -0
- package/dist/scripts/validate.d.ts.map +1 -0
- package/dist/scripts/validate.js +472 -0
- package/dist/scripts/validate.js.map +1 -0
- package/docs/superpowers/plans/2026-04-07-autonomous-iteration-plan.md +1123 -0
- package/docs/superpowers/plans/2026-04-07-autonomous-iteration-sub-agent-batches.md +1923 -0
- package/docs/superpowers/plans/2026-04-07-autonomous-workflow-sub-skill-plan.md +1505 -0
- package/docs/superpowers/plans/2026-04-07-benchmarking-multi-agent-plan.md +854 -0
- package/docs/superpowers/plans/2026-04-07-workspace-builder-logic-plan.md +1426 -0
- package/docs/superpowers/plans/2026-04-07-workspace-maxxing-plan.md +1299 -0
- package/docs/superpowers/plans/2026-04-08-session-294c-subagent-invocation-plan.md +320 -0
- package/docs/superpowers/plans/2026-04-08-workflow-prompt-hardening-plan.md +1025 -0
- package/docs/superpowers/plans/2026-04-12-workspace-agent-creation-plan.md +992 -0
- package/docs/superpowers/specs/2026-04-07-autonomous-iteration-design.md +214 -0
- package/docs/superpowers/specs/2026-04-07-autonomous-iteration-sub-agent-batches-design.md +188 -0
- package/docs/superpowers/specs/2026-04-07-autonomous-workflow-sub-skill-design.md +137 -0
- package/docs/superpowers/specs/2026-04-07-benchmarking-multi-agent-design.md +105 -0
- package/docs/superpowers/specs/2026-04-07-workspace-builder-logic-design.md +179 -0
- package/docs/superpowers/specs/2026-04-07-workspace-maxxing-design.md +227 -0
- package/docs/superpowers/specs/2026-04-08-session-294c-subagent-invocation-design.md +265 -0
- package/docs/superpowers/specs/2026-04-08-workflow-prompt-hardening-design.md +146 -0
- package/docs/superpowers/specs/2026-04-12-workspace-agent-creation-design.md +239 -0
- package/jest.config.js +8 -0
- package/package.json +32 -0
- package/src/agent-creator.ts +180 -0
- package/src/agent-iterator.ts +397 -0
- package/src/index.ts +189 -0
- package/src/install.ts +105 -0
- package/src/platforms/claude.ts +40 -0
- package/src/platforms/copilot.ts +50 -0
- package/src/platforms/gemini.ts +55 -0
- package/src/platforms/index.ts +45 -0
- package/src/platforms/opencode.ts +41 -0
- package/src/scripts/benchmark.ts +171 -0
- package/src/scripts/dispatch.ts +473 -0
- package/src/scripts/generate-tests.ts +112 -0
- package/src/scripts/install-tool.ts +82 -0
- package/src/scripts/iterate.ts +271 -0
- package/src/scripts/orchestrator.ts +539 -0
- package/src/scripts/scaffold.ts +282 -0
- package/src/scripts/validate.ts +516 -0
- package/templates/.workspace-templates/CONTEXT.md +44 -0
- package/templates/.workspace-templates/SYSTEM.md +44 -0
- package/templates/.workspace-templates/references/anti-patterns.md +16 -0
- package/templates/.workspace-templates/references/iron-laws.md +26 -0
- package/templates/.workspace-templates/references/reporting-format.md +52 -0
- package/templates/.workspace-templates/scripts/benchmark.ts +171 -0
- package/templates/.workspace-templates/scripts/dispatch.ts +473 -0
- package/templates/.workspace-templates/scripts/generate-tests.ts +158 -0
- package/templates/.workspace-templates/scripts/install-tool.ts +82 -0
- package/templates/.workspace-templates/scripts/iterate.ts +265 -0
- package/templates/.workspace-templates/scripts/orchestrator.ts +539 -0
- package/templates/.workspace-templates/scripts/scaffold.ts +282 -0
- package/templates/.workspace-templates/scripts/validate.ts +452 -0
- package/templates/.workspace-templates/skills/architecture/SKILL.md +95 -0
- package/templates/.workspace-templates/skills/fixer/SKILL.md +109 -0
- package/templates/.workspace-templates/skills/iteration/SKILL.md +89 -0
- package/templates/.workspace-templates/skills/prompt-engineering/SKILL.md +87 -0
- package/templates/.workspace-templates/skills/research/SKILL.md +94 -0
- package/templates/.workspace-templates/skills/testing/SKILL.md +89 -0
- package/templates/.workspace-templates/skills/tooling/SKILL.md +87 -0
- package/templates/.workspace-templates/skills/validation/SKILL.md +103 -0
- package/templates/.workspace-templates/skills/worker/SKILL.md +79 -0
- package/templates/.workspace-templates/workspace/00-meta/CONTEXT.md +6 -0
- package/templates/.workspace-templates/workspace/00-meta/execution-log.md +27 -0
- package/templates/.workspace-templates/workspace/01-input/CONTEXT.md +29 -0
- package/templates/.workspace-templates/workspace/02-process/CONTEXT.md +29 -0
- package/templates/.workspace-templates/workspace/03-output/CONTEXT.md +29 -0
- package/templates/.workspace-templates/workspace/README.md +14 -0
- package/templates/SKILL.md +347 -0
- package/tests/benchmark.test.ts +158 -0
- package/tests/cli.test.ts +109 -0
- package/tests/dispatch-parallel.test.ts +124 -0
- package/tests/dispatch.test.ts +218 -0
- package/tests/fixer-skill.test.ts +203 -0
- package/tests/generate-tests.test.ts +101 -0
- package/tests/install-tool.test.ts +141 -0
- package/tests/install.test.ts +144 -0
- package/tests/integration.test.ts +324 -0
- package/tests/iterate.test.ts +219 -0
- package/tests/orchestrator.test.ts +710 -0
- package/tests/scaffold.test.ts +238 -0
- package/tests/templates-enhanced.test.ts +208 -0
- package/tests/templates.test.ts +219 -0
- package/tests/validate.test.ts +421 -0
- package/tests/validation-enhanced.test.ts +303 -0
- package/tests/worker-skill.test.ts +88 -0
- package/tsconfig.json +19 -0
- package/workspace/00-meta/CONTEXT.md +3 -0
- package/workspace/00-meta/execution-log.md +17 -0
- package/workspace/00-meta/tools.md +11 -0
- package/workspace/01-input/CONTEXT.md +27 -0
- package/workspace/CONTEXT.md +35 -0
- package/workspace/README.md +14 -0
- package/workspace/SYSTEM.md +36 -0
- package/workspace-maxxing-0.1.0.tgz +0 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
export interface ScaffoldOptions {
|
|
5
|
+
name: string;
|
|
6
|
+
stages: string[];
|
|
7
|
+
output: string;
|
|
8
|
+
force?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function scaffoldWorkspace(options: ScaffoldOptions): void {
|
|
12
|
+
const { name, stages, output, force = false } = options;
|
|
13
|
+
|
|
14
|
+
if (!stages || stages.length === 0) {
|
|
15
|
+
throw new Error('stages list cannot be empty');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const outputDir = path.resolve(output);
|
|
19
|
+
|
|
20
|
+
if (fs.existsSync(outputDir)) {
|
|
21
|
+
if (!force) {
|
|
22
|
+
throw new Error(`Output directory already exists: ${outputDir} (use --force to overwrite)`);
|
|
23
|
+
}
|
|
24
|
+
fs.rmSync(outputDir, { recursive: true, force: true });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
28
|
+
|
|
29
|
+
const systemMd = generateSystemMd(name, stages);
|
|
30
|
+
fs.writeFileSync(path.join(outputDir, 'SYSTEM.md'), systemMd);
|
|
31
|
+
|
|
32
|
+
const contextMd = generateContextMd(name, stages);
|
|
33
|
+
fs.writeFileSync(path.join(outputDir, 'CONTEXT.md'), contextMd);
|
|
34
|
+
|
|
35
|
+
const metaDir = path.join(outputDir, '00-meta');
|
|
36
|
+
fs.mkdirSync(metaDir, { recursive: true });
|
|
37
|
+
fs.writeFileSync(path.join(metaDir, 'tools.md'), generateToolsMd());
|
|
38
|
+
fs.writeFileSync(path.join(metaDir, 'execution-log.md'), generateExecutionLogMd(stages));
|
|
39
|
+
fs.writeFileSync(path.join(metaDir, 'CONTEXT.md'), `# 00-meta Context\n\nMetadata and tool inventory for the ${name} workspace.\n`);
|
|
40
|
+
|
|
41
|
+
for (const stage of stages) {
|
|
42
|
+
const stageDir = path.join(outputDir, stage);
|
|
43
|
+
fs.mkdirSync(stageDir, { recursive: true });
|
|
44
|
+
fs.writeFileSync(
|
|
45
|
+
path.join(stageDir, 'CONTEXT.md'),
|
|
46
|
+
generateStageContextMd(name, stage, stages),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fs.writeFileSync(path.join(outputDir, 'README.md'), generateReadmeMd(name, stages));
|
|
51
|
+
|
|
52
|
+
console.log(`Workspace "${name}" scaffolded at: ${outputDir}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function generateSystemMd(name: string, stages: string[]): string {
|
|
56
|
+
const folderRows = stages
|
|
57
|
+
.map((stage, index) => `| ${index + 1} | \`${stage}/\` | ${stageDescription(stage)} |`)
|
|
58
|
+
.join('\n');
|
|
59
|
+
|
|
60
|
+
return `# ${name} — System Prompt
|
|
61
|
+
|
|
62
|
+
## Role
|
|
63
|
+
You are an AI assistant operating inside the ${name} workspace. Follow stage boundaries and route tasks through stage-specific CONTEXT files.
|
|
64
|
+
|
|
65
|
+
## Folder Map
|
|
66
|
+
|
|
67
|
+
| Stage | Folder | Purpose |
|
|
68
|
+
|------:|--------|---------|
|
|
69
|
+
${folderRows}
|
|
70
|
+
| meta | \`00-meta/\` | Workspace configuration, tool inventory, and session notes |
|
|
71
|
+
|
|
72
|
+
## Workflow Rules
|
|
73
|
+
1. Read \`SYSTEM.md\` first, then root \`CONTEXT.md\`.
|
|
74
|
+
2. Load only one stage \`CONTEXT.md\` at a time unless handoff explicitly requires another stage.
|
|
75
|
+
3. Keep information canonical; do not duplicate facts across files.
|
|
76
|
+
4. Maintain one-way stage dependencies from earlier stage numbers to later stage numbers.
|
|
77
|
+
|
|
78
|
+
## Scope Guardrails
|
|
79
|
+
- Build and maintain workflow documentation, not product implementation code.
|
|
80
|
+
- Keep stage outputs as markdown artifacts (plans, checklists, prompts, routing notes).
|
|
81
|
+
- If asked to build the product itself, capture that request as workflow requirements and stay in ICM workspace scope.
|
|
82
|
+
|
|
83
|
+
## Sequential Execution Protocol
|
|
84
|
+
1. Complete stages strictly in ascending numeric order.
|
|
85
|
+
2. Record stage completion in \`00-meta/execution-log.md\` before moving to the next stage.
|
|
86
|
+
3. Do not produce final deliverables until all prior stage checkboxes are complete.
|
|
87
|
+
|
|
88
|
+
## Stage Boundaries
|
|
89
|
+
- Each numbered folder is an execution stage.
|
|
90
|
+
- A stage may consume upstream outputs but must not redefine upstream facts.
|
|
91
|
+
- Cross-stage jumps require explicit routing through root \`CONTEXT.md\`.
|
|
92
|
+
|
|
93
|
+
## Tooling Policy
|
|
94
|
+
- Check \`00-meta/tools.md\` before proposing tool installation.
|
|
95
|
+
- Document approved tooling changes in \`00-meta/tools.md\`.
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function generateContextMd(name: string, stages: string[]): string {
|
|
100
|
+
const routingRows = stages
|
|
101
|
+
.map((stage) => `| Work in ${stage} tasks | \`${stage}/CONTEXT.md\` | Stage contract and required outputs |`)
|
|
102
|
+
.join('\n');
|
|
103
|
+
|
|
104
|
+
const handoffs = stages
|
|
105
|
+
.map((stage, index) => {
|
|
106
|
+
const nextStage = stages[index + 1];
|
|
107
|
+
return nextStage
|
|
108
|
+
? `- \`${stage}\` -> \`${nextStage}\` when completion criteria are met`
|
|
109
|
+
: `- \`${stage}\` -> deliver final output and close loop`;
|
|
110
|
+
})
|
|
111
|
+
.join('\n');
|
|
112
|
+
|
|
113
|
+
return `# ${name} — Context Router
|
|
114
|
+
|
|
115
|
+
## How to Use This File
|
|
116
|
+
Use this file to route each task to the smallest required context scope.
|
|
117
|
+
|
|
118
|
+
## Task Routing
|
|
119
|
+
This routing table maps task intent to the correct stage context.
|
|
120
|
+
|
|
121
|
+
| When you need to... | Load | Why |
|
|
122
|
+
|---------------------|------|-----|
|
|
123
|
+
| Understand workspace constraints | \`SYSTEM.md\` | Global rules and stage boundaries |
|
|
124
|
+
${routingRows}
|
|
125
|
+
| Check available tools | \`00-meta/tools.md\` | Tool inventory and approval status |
|
|
126
|
+
|
|
127
|
+
## Loading Order
|
|
128
|
+
1. \`SYSTEM.md\` (always)
|
|
129
|
+
2. This root \`CONTEXT.md\`
|
|
130
|
+
3. One relevant stage \`CONTEXT.md\`
|
|
131
|
+
4. Only the task files needed for that stage
|
|
132
|
+
|
|
133
|
+
## Scope Guardrails
|
|
134
|
+
- Route domain requests into workflow design steps and markdown deliverables.
|
|
135
|
+
- Do not scaffold backend, frontend, or runtime product source files from this router.
|
|
136
|
+
- Keep outputs file-structured and markdown-first across numbered workflow folders.
|
|
137
|
+
|
|
138
|
+
## Sequential Routing Contract
|
|
139
|
+
- Route only to the earliest incomplete stage in \`00-meta/execution-log.md\`.
|
|
140
|
+
- Refuse jumps to later stages when earlier stages are not marked complete.
|
|
141
|
+
- Append handoff notes for each completed stage before routing onward.
|
|
142
|
+
|
|
143
|
+
## Stage Handoff Routing
|
|
144
|
+
${handoffs}
|
|
145
|
+
|
|
146
|
+
## Escalation
|
|
147
|
+
Escalate when required sections are missing, dependencies are contradictory, or no valid stage route can satisfy the task.
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function generateStageContextMd(name: string, stage: string, stages: string[]): string {
|
|
152
|
+
const stageIndex = stages.indexOf(stage);
|
|
153
|
+
const previousStage = stageIndex > 0 ? stages[stageIndex - 1] : undefined;
|
|
154
|
+
const nextStage = stageIndex >= 0 && stageIndex < stages.length - 1
|
|
155
|
+
? stages[stageIndex + 1]
|
|
156
|
+
: undefined;
|
|
157
|
+
|
|
158
|
+
const dependencyLine = previousStage
|
|
159
|
+
? `- ${previousStage}`
|
|
160
|
+
: '- None (entry stage)';
|
|
161
|
+
|
|
162
|
+
const handoffLine = nextStage
|
|
163
|
+
? `- After completion, hand off outputs to ${nextStage}`
|
|
164
|
+
: '- This is the terminal stage. Package and deliver final output.';
|
|
165
|
+
|
|
166
|
+
return `# ${stage} — Context
|
|
167
|
+
|
|
168
|
+
## Purpose
|
|
169
|
+
This folder executes the ${stage} stage of the ${name} workflow.
|
|
170
|
+
|
|
171
|
+
## Inputs
|
|
172
|
+
- Required data artifacts for ${stage}
|
|
173
|
+
- Upstream context from previous stage when applicable
|
|
174
|
+
|
|
175
|
+
## Outputs
|
|
176
|
+
- Stage-specific deliverables for downstream consumption
|
|
177
|
+
- Updated markdown artifacts needed by the next stage
|
|
178
|
+
|
|
179
|
+
## Dependencies
|
|
180
|
+
${dependencyLine}
|
|
181
|
+
|
|
182
|
+
## Required Evidence
|
|
183
|
+
- Update \`00-meta/execution-log.md\` to mark ${stage} complete before handoff.
|
|
184
|
+
- Link or reference the markdown artifacts produced in this stage.
|
|
185
|
+
|
|
186
|
+
## Completion Criteria
|
|
187
|
+
- Required outputs are produced and non-empty
|
|
188
|
+
- Outputs conform to stage purpose and markdown-first workflow format
|
|
189
|
+
- Handoff notes are updated for downstream stage
|
|
190
|
+
|
|
191
|
+
## Handoff
|
|
192
|
+
${handoffLine}
|
|
193
|
+
`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function generateToolsMd(): string {
|
|
197
|
+
return `## Tool Inventory
|
|
198
|
+
|
|
199
|
+
## Installed Tools
|
|
200
|
+
|
|
201
|
+
| Tool | Version | Manager | Installed |
|
|
202
|
+
|------|---------|---------|-----------|
|
|
203
|
+
| — | — | — | — |
|
|
204
|
+
|
|
205
|
+
## Pending Tools
|
|
206
|
+
|
|
207
|
+
List tools that are proposed but not yet approved.
|
|
208
|
+
`;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function generateExecutionLogMd(stages: string[]): string {
|
|
212
|
+
return `# Execution Log
|
|
213
|
+
|
|
214
|
+
## Stage Checklist
|
|
215
|
+
|
|
216
|
+
${stages.map((stage) => `- [ ] ${stage}`).join('\n')}
|
|
217
|
+
|
|
218
|
+
## Rules
|
|
219
|
+
|
|
220
|
+
1. Mark a stage complete only after its completion criteria are satisfied.
|
|
221
|
+
2. Stages must be checked in ascending numerical order.
|
|
222
|
+
3. Every checked stage must have corresponding evidence notes.
|
|
223
|
+
|
|
224
|
+
## Evidence Notes
|
|
225
|
+
|
|
226
|
+
${stages.map((stage) => `### ${stage}\n- Artifacts:\n- Handoff Summary:\n`).join('\n')}`;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function generateReadmeMd(name: string, stages: string[]): string {
|
|
230
|
+
return `# ${name} Workspace
|
|
231
|
+
|
|
232
|
+
## Structure
|
|
233
|
+
|
|
234
|
+
${stages.map((s) => `- \`${s}/\``).join('\n')}
|
|
235
|
+
- \`00-meta/\`
|
|
236
|
+
|
|
237
|
+
## Usage
|
|
238
|
+
|
|
239
|
+
1. Follow the workflow stages in order
|
|
240
|
+
2. Load CONTEXT.md files selectively — only what you need
|
|
241
|
+
3. Update 00-meta/execution-log.md after each completed stage
|
|
242
|
+
4. Keep outputs in stage folders as markdown workflow artifacts
|
|
243
|
+
5. Run validate.ts to check ICM compliance
|
|
244
|
+
`;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function stageDescription(stage: string): string {
|
|
248
|
+
const descriptions: Record<string, string> = {
|
|
249
|
+
'01-input': 'Input collection and validation',
|
|
250
|
+
'02-process': 'Processing and transformation',
|
|
251
|
+
'03-output': 'Output generation and delivery',
|
|
252
|
+
};
|
|
253
|
+
return descriptions[stage] || `Stage: ${stage}`;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (require.main === module) {
|
|
257
|
+
const args = process.argv.slice(2);
|
|
258
|
+
const parseArg = (flag: string): string | undefined => {
|
|
259
|
+
const idx = args.indexOf(flag);
|
|
260
|
+
return idx !== -1 ? args[idx + 1] : undefined;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const hasFlag = (flag: string): boolean => args.includes(flag);
|
|
264
|
+
|
|
265
|
+
const name = parseArg('--name');
|
|
266
|
+
const stagesStr = parseArg('--stages');
|
|
267
|
+
const output = parseArg('--output');
|
|
268
|
+
|
|
269
|
+
if (!name || !stagesStr || !output) {
|
|
270
|
+
console.error('Usage: node scaffold.ts --name <name> --stages <s1,s2,...> --output <path> [--force]');
|
|
271
|
+
process.exit(1);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const stages = stagesStr.split(',').map((s) => s.trim()).filter(Boolean);
|
|
275
|
+
|
|
276
|
+
scaffoldWorkspace({
|
|
277
|
+
name,
|
|
278
|
+
stages,
|
|
279
|
+
output,
|
|
280
|
+
force: hasFlag('--force'),
|
|
281
|
+
});
|
|
282
|
+
}
|