stoa-mcp 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/LICENSE +65 -0
- package/README.md +397 -0
- package/dist/cli/build.d.ts +39 -0
- package/dist/cli/build.d.ts.map +1 -0
- package/dist/cli/build.js +288 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/review-loop.d.ts +2 -0
- package/dist/cli/review-loop.d.ts.map +1 -0
- package/dist/cli/review-loop.js +97 -0
- package/dist/cli/review-loop.js.map +1 -0
- package/dist/cli/scenarios-runner.d.ts +12 -0
- package/dist/cli/scenarios-runner.d.ts.map +1 -0
- package/dist/cli/scenarios-runner.js +158 -0
- package/dist/cli/scenarios-runner.js.map +1 -0
- package/dist/cli/verify.d.ts +13 -0
- package/dist/cli/verify.d.ts.map +1 -0
- package/dist/cli/verify.js +149 -0
- package/dist/cli/verify.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1135 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/parsers.d.ts +29 -0
- package/dist/core/parsers.d.ts.map +1 -0
- package/dist/core/parsers.js +296 -0
- package/dist/core/parsers.js.map +1 -0
- package/dist/core/parsers.test.d.ts +2 -0
- package/dist/core/parsers.test.d.ts.map +1 -0
- package/dist/core/parsers.test.js +198 -0
- package/dist/core/parsers.test.js.map +1 -0
- package/dist/core/prompts.d.ts +30 -0
- package/dist/core/prompts.d.ts.map +1 -0
- package/dist/core/prompts.js +346 -0
- package/dist/core/prompts.js.map +1 -0
- package/dist/core/refine.d.ts +38 -0
- package/dist/core/refine.d.ts.map +1 -0
- package/dist/core/refine.js +233 -0
- package/dist/core/refine.js.map +1 -0
- package/dist/core/spec-score.d.ts +17 -0
- package/dist/core/spec-score.d.ts.map +1 -0
- package/dist/core/spec-score.js +59 -0
- package/dist/core/spec-score.js.map +1 -0
- package/dist/formatters/index.d.ts +2 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +2 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/stage-formatters.d.ts +10 -0
- package/dist/formatters/stage-formatters.d.ts.map +1 -0
- package/dist/formatters/stage-formatters.js +100 -0
- package/dist/formatters/stage-formatters.js.map +1 -0
- package/dist/formatters/stage-formatters.test.d.ts +2 -0
- package/dist/formatters/stage-formatters.test.d.ts.map +1 -0
- package/dist/formatters/stage-formatters.test.js +107 -0
- package/dist/formatters/stage-formatters.test.js.map +1 -0
- package/dist/guardrails/index.d.ts +2 -0
- package/dist/guardrails/index.d.ts.map +1 -0
- package/dist/guardrails/index.js +2 -0
- package/dist/guardrails/index.js.map +1 -0
- package/dist/guardrails/loader.d.ts +9 -0
- package/dist/guardrails/loader.d.ts.map +1 -0
- package/dist/guardrails/loader.js +56 -0
- package/dist/guardrails/loader.js.map +1 -0
- package/dist/guardrails/refine.d.ts +53 -0
- package/dist/guardrails/refine.d.ts.map +1 -0
- package/dist/guardrails/refine.js +184 -0
- package/dist/guardrails/refine.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/index.js.map +1 -0
- package/dist/storage/change-detection.d.ts +2 -0
- package/dist/storage/change-detection.d.ts.map +1 -0
- package/dist/storage/change-detection.js +47 -0
- package/dist/storage/change-detection.js.map +1 -0
- package/dist/storage/change-detection.test.d.ts +2 -0
- package/dist/storage/change-detection.test.d.ts.map +1 -0
- package/dist/storage/change-detection.test.js +81 -0
- package/dist/storage/change-detection.test.js.map +1 -0
- package/dist/storage/index.d.ts +9 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +6 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/moodboard-describe.d.ts +14 -0
- package/dist/storage/moodboard-describe.d.ts.map +1 -0
- package/dist/storage/moodboard-describe.js +185 -0
- package/dist/storage/moodboard-describe.js.map +1 -0
- package/dist/storage/moodboard-sync.d.ts +11 -0
- package/dist/storage/moodboard-sync.d.ts.map +1 -0
- package/dist/storage/moodboard-sync.js +205 -0
- package/dist/storage/moodboard-sync.js.map +1 -0
- package/dist/storage/moodboard.d.ts +4 -0
- package/dist/storage/moodboard.d.ts.map +1 -0
- package/dist/storage/moodboard.js +68 -0
- package/dist/storage/moodboard.js.map +1 -0
- package/dist/storage/moodboard.test.d.ts +2 -0
- package/dist/storage/moodboard.test.d.ts.map +1 -0
- package/dist/storage/moodboard.test.js +133 -0
- package/dist/storage/moodboard.test.js.map +1 -0
- package/dist/storage/project-scan.d.ts +12 -0
- package/dist/storage/project-scan.d.ts.map +1 -0
- package/dist/storage/project-scan.js +118 -0
- package/dist/storage/project-scan.js.map +1 -0
- package/dist/storage/project.d.ts +10 -0
- package/dist/storage/project.d.ts.map +1 -0
- package/dist/storage/project.js +101 -0
- package/dist/storage/project.js.map +1 -0
- package/dist/storage/roles-refine.d.ts +59 -0
- package/dist/storage/roles-refine.d.ts.map +1 -0
- package/dist/storage/roles-refine.js +223 -0
- package/dist/storage/roles-refine.js.map +1 -0
- package/dist/storage/roles.d.ts +6 -0
- package/dist/storage/roles.d.ts.map +1 -0
- package/dist/storage/roles.js +41 -0
- package/dist/storage/roles.js.map +1 -0
- package/dist/storage/scenarios-refine.d.ts +47 -0
- package/dist/storage/scenarios-refine.d.ts.map +1 -0
- package/dist/storage/scenarios-refine.js +311 -0
- package/dist/storage/scenarios-refine.js.map +1 -0
- package/dist/storage/scenarios.d.ts +12 -0
- package/dist/storage/scenarios.d.ts.map +1 -0
- package/dist/storage/scenarios.js +37 -0
- package/dist/storage/scenarios.js.map +1 -0
- package/dist/storage/specs.d.ts +17 -0
- package/dist/storage/specs.d.ts.map +1 -0
- package/dist/storage/specs.js +104 -0
- package/dist/storage/specs.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/rerefine.d.ts +8 -0
- package/dist/tools/rerefine.d.ts.map +1 -0
- package/dist/tools/rerefine.js +153 -0
- package/dist/tools/rerefine.js.map +1 -0
- package/dist/tools/rerefine.test.d.ts +2 -0
- package/dist/tools/rerefine.test.d.ts.map +1 -0
- package/dist/tools/rerefine.test.js +123 -0
- package/dist/tools/rerefine.test.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/slug.d.ts +3 -0
- package/dist/utils/slug.d.ts.map +1 -0
- package/dist/utils/slug.js +33 -0
- package/dist/utils/slug.js.map +1 -0
- package/dist/utils/spec-helpers.d.ts +12 -0
- package/dist/utils/spec-helpers.d.ts.map +1 -0
- package/dist/utils/spec-helpers.js +95 -0
- package/dist/utils/spec-helpers.js.map +1 -0
- package/dist/utils/spec-helpers.test.d.ts +2 -0
- package/dist/utils/spec-helpers.test.d.ts.map +1 -0
- package/dist/utils/spec-helpers.test.js +114 -0
- package/dist/utils/spec-helpers.test.js.map +1 -0
- package/package.json +53 -0
- package/templates/guardrails/ask-when-unclear.md +3 -0
- package/templates/guardrails/dont-delete-code.md +3 -0
- package/templates/guardrails/explain-changes.md +3 -0
- package/templates/guardrails/run-tests.md +3 -0
- package/templates/guardrails/small-changes.md +3 -0
- package/templates/roles/builder.md +3 -0
- package/templates/roles/fixer.md +3 -0
- package/templates/roles/planner.md +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Licensor: Lambis Stratoudakis
|
|
4
|
+
|
|
5
|
+
Licensed Work: Stoa MCP
|
|
6
|
+
The Licensed Work is (c) 2026 Lambis Stratoudakis.
|
|
7
|
+
|
|
8
|
+
Additional Use Grant: You may make production use of the Licensed Work,
|
|
9
|
+
provided your use does not include offering the
|
|
10
|
+
Licensed Work to third parties on a hosted or
|
|
11
|
+
embedded basis which is competitive with the
|
|
12
|
+
Licensor's products.
|
|
13
|
+
|
|
14
|
+
Change Date: 2030-03-11
|
|
15
|
+
|
|
16
|
+
Change License: MIT
|
|
17
|
+
|
|
18
|
+
For information about alternative licensing arrangements, please visit:
|
|
19
|
+
https://stoa.dev
|
|
20
|
+
|
|
21
|
+
--------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
Business Source License 1.1
|
|
24
|
+
|
|
25
|
+
Terms
|
|
26
|
+
|
|
27
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
28
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
29
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
30
|
+
production use.
|
|
31
|
+
|
|
32
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
33
|
+
available distribution of a specific version of the Licensed Work under this
|
|
34
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
35
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
36
|
+
above terminate.
|
|
37
|
+
|
|
38
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
39
|
+
currently in effect as described in this License, you must purchase a
|
|
40
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
41
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
42
|
+
|
|
43
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
44
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
45
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
46
|
+
for each version of the Licensed Work released by Licensor.
|
|
47
|
+
|
|
48
|
+
You must conspicuously display this License on each original or modified copy
|
|
49
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
50
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
51
|
+
License apply to your use of that work.
|
|
52
|
+
|
|
53
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
54
|
+
terminate your rights under this License for the current and all other
|
|
55
|
+
versions of the Licensed Work.
|
|
56
|
+
|
|
57
|
+
This License does not grant you any right in any trademark or logo of
|
|
58
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
59
|
+
Licensor as expressly required by this License).
|
|
60
|
+
|
|
61
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
62
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
63
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
64
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
65
|
+
TITLE.
|
package/README.md
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# stoa-mcp
|
|
2
|
+
|
|
3
|
+
**Turn one sentence into a full specification that makes any AI coding tool build what you actually want.**
|
|
4
|
+
|
|
5
|
+
Stoa is a specification compiler. You describe what you want in plain English. Stoa runs a 5-stage pipeline that turns it into a structured spec with design tokens, constraints, acceptance criteria, and test scenarios. Then you feed that spec to Lovable, Bolt, Cursor, Claude Code, v0 — any tool — and they all build the same thing.
|
|
6
|
+
|
|
7
|
+
The same prompt given to 5 different AI tools without a spec produces 5 completely different apps. With a Stoa spec, all 5 match your design.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g stoa-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires Node.js 18 or higher.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Quick Start (5 minutes)
|
|
22
|
+
|
|
23
|
+
### 1. Create a project
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
mkdir my-app && cd my-app
|
|
27
|
+
stoa init
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This creates a `.stoa/` folder with everything Stoa needs:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
.stoa/
|
|
34
|
+
moodboard/notes.md ← your design direction (colors, layout, style)
|
|
35
|
+
context.md ← dependencies, conventions, brand voice
|
|
36
|
+
lessons.md ← project memory (grows automatically)
|
|
37
|
+
guardrails/ ← rules the AI must follow
|
|
38
|
+
roles/ ← AI personas (Builder, Fixer, Planner)
|
|
39
|
+
specs/ ← saved specifications
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Set up your moodboard (optional but powerful)
|
|
43
|
+
|
|
44
|
+
Open the moodboard file:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
stoa edit moodboard
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Replace the template with your design preferences:
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
# Design Direction
|
|
54
|
+
Minimal and dark like Linear
|
|
55
|
+
|
|
56
|
+
# Colors
|
|
57
|
+
Primary: #E8C872
|
|
58
|
+
Background: #1A1A1A
|
|
59
|
+
Text: #F5F5F5
|
|
60
|
+
|
|
61
|
+
# Layout
|
|
62
|
+
Sidebar navigation left, main content right
|
|
63
|
+
|
|
64
|
+
# Typography
|
|
65
|
+
Clean sans-serif, large headings
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
That's it. Four lines. Every spec you generate will include these design tokens.
|
|
69
|
+
|
|
70
|
+
**Have a screenshot of a design you like?** Drop it in `.stoa/moodboard/` and run:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
stoa moodboard describe
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
If you have an Anthropic API key, Stoa will analyze the image and write the design system for you. If not, it prints a prompt you can paste into any Claude chat along with your screenshot.
|
|
77
|
+
|
|
78
|
+
### 3. Refine your idea
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
stoa refine "Personal finance tracker to log expenses and view spending by category"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Stoa runs 5 stages:
|
|
85
|
+
|
|
86
|
+
1. **Problem Statement** — expands your sentence into a full spec with data models, file structure, and design tokens from your moodboard
|
|
87
|
+
2. **Acceptance Criteria** — defines exactly what "done" means
|
|
88
|
+
3. **Constraints** — what the AI must do, must not do, and common mistakes to avoid
|
|
89
|
+
4. **Decomposition** — breaks big tasks into subtasks (or says "no decomposition needed")
|
|
90
|
+
5. **Scenarios** — generates test cases you can verify after the build
|
|
91
|
+
|
|
92
|
+
After refining, Stoa:
|
|
93
|
+
- Saves the spec as readable markdown files in `.stoa/specs/`
|
|
94
|
+
- Copies Stage 1 to your clipboard automatically
|
|
95
|
+
- Prints a build command you can use with Claude Code
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Spec saved to .stoa/specs/personal-finance-tracker/
|
|
99
|
+
Score: 5/5 Executable
|
|
100
|
+
|
|
101
|
+
→ Stage 1 description copied to clipboard
|
|
102
|
+
Paste into Lovable, Bolt, v0, or any AI tool
|
|
103
|
+
|
|
104
|
+
→ Build prompt for Claude Code:
|
|
105
|
+
Read the spec in .stoa/specs/personal-finance-tracker/ and build it.
|
|
106
|
+
|
|
107
|
+
→ Scenarios saved. Run: stoa scenarios run
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 4. Build
|
|
111
|
+
|
|
112
|
+
**Option A — Paste into any AI tool:**
|
|
113
|
+
|
|
114
|
+
Open Lovable, Bolt, v0, or any AI coding tool. Press Cmd+V. The spec is already on your clipboard. The AI builds exactly what you specified.
|
|
115
|
+
|
|
116
|
+
**Option B — Use Claude Code:**
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
claude "Read the spec in .stoa/specs/personal-finance-tracker/ and build it. Follow all constraints and subtasks."
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Option C — Use Cursor with Claude Code extension:**
|
|
123
|
+
|
|
124
|
+
Open the project folder in Cursor. Open Claude Code from the sidebar. Paste the build prompt.
|
|
125
|
+
|
|
126
|
+
### 5. Verify
|
|
127
|
+
|
|
128
|
+
After the build, run through the test scenarios:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
stoa scenarios run
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Stoa walks you through each scenario one by one:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
Scenario 1/5: Happy path — add expense and verify summary
|
|
138
|
+
|
|
139
|
+
GIVEN:
|
|
140
|
+
Add 3 expenses in different categories. Navigate to Dashboard.
|
|
141
|
+
|
|
142
|
+
EXPECTED:
|
|
143
|
+
Each category shows in the donut chart. Total matches the sum.
|
|
144
|
+
|
|
145
|
+
Pass? [y/n/s(skip)] →
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Open your app in the browser, do what GIVEN says, check if EXPECTED matches. Press `y` for pass, `n` for fail, `s` to skip.
|
|
149
|
+
|
|
150
|
+
At the end you get a summary:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
Results: 4 passed, 1 failed, 0 skipped
|
|
154
|
+
Failed:
|
|
155
|
+
- "Category filter shows correct subset"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
If something failed, describe the issue to Claude Code and it will fix it.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Adding Features to an Existing App
|
|
163
|
+
|
|
164
|
+
Stoa knows when code already exists. After the first build, run refine again:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
stoa refine "Add monthly budget limits per category with progress bars on the dashboard"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Stage 1 will reference your existing files, components, and design system. The spec says "modify Dashboard.tsx" — not "build a finance tracker from scratch."
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Changing the Design
|
|
175
|
+
|
|
176
|
+
Update your moodboard, then refine:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
stoa edit moodboard
|
|
180
|
+
# Change colors, layout, style...
|
|
181
|
+
|
|
182
|
+
stoa refine "Redesign the app to match the updated design system"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Stoa generates a migration spec — what changes, what stays, exact old-to-new token mapping.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Project Context Files
|
|
190
|
+
|
|
191
|
+
All files in `.stoa/` are optional. Use what you need, ignore what you don't.
|
|
192
|
+
|
|
193
|
+
| File | What it does | Best for |
|
|
194
|
+
|------|-------------|----------|
|
|
195
|
+
| `moodboard/notes.md` | Design direction: colors, layout, typography | Web apps, UI projects |
|
|
196
|
+
| `moodboard/tokens.json` | Auto-generated machine-readable design values | Generated by `stoa moodboard sync` |
|
|
197
|
+
| `context.md` | Dependencies, conventions, brand voice | All projects |
|
|
198
|
+
| `lessons.md` | Past mistakes — auto-grows, prevents repeats | All projects (grows over time) |
|
|
199
|
+
| `guardrails/*.md` | Rules the AI must follow (e.g. "don't delete code") | All projects |
|
|
200
|
+
| `roles/*.md` | AI personas with different behaviors | Advanced usage |
|
|
201
|
+
|
|
202
|
+
### context.md
|
|
203
|
+
|
|
204
|
+
Open with `stoa edit context`. Add your stack preferences:
|
|
205
|
+
|
|
206
|
+
```markdown
|
|
207
|
+
# Project Context
|
|
208
|
+
|
|
209
|
+
## Brand Voice
|
|
210
|
+
Friendly but professional. Use "Save" not "Submit". Error messages explain what went wrong and what to do.
|
|
211
|
+
|
|
212
|
+
## Dependencies
|
|
213
|
+
Use date-fns for dates, not moment. Use HeroUI for all UI components. Use zustand for state management.
|
|
214
|
+
|
|
215
|
+
## UI Library
|
|
216
|
+
HeroUI (https://www.heroui.com) — buttons, inputs, cards, modals, tables
|
|
217
|
+
|
|
218
|
+
## Code Conventions
|
|
219
|
+
PascalCase for components. One component per file. Test files next to source files.
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
These get injected into every refine automatically. You never have to repeat "we use HeroUI" again.
|
|
223
|
+
|
|
224
|
+
### lessons.md
|
|
225
|
+
|
|
226
|
+
This file grows automatically. After a failed build, tell Claude Code:
|
|
227
|
+
|
|
228
|
+
> Add what we just fixed to .stoa/lessons.md
|
|
229
|
+
|
|
230
|
+
Example entry:
|
|
231
|
+
|
|
232
|
+
```markdown
|
|
233
|
+
## 2026-03-14: HeroUI + Tailwind v4 invisible components
|
|
234
|
+
**What happened:** HeroUI components rendered in the DOM but were invisible.
|
|
235
|
+
**Prevention:** Add @source "../node_modules/@heroui/theme/dist/**/*.js" to index.css after @import "tailwindcss".
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Every future refine includes past lessons as failure modes to avoid. Your project gets smarter with every build.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## CLI Reference
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Setup
|
|
246
|
+
stoa init # Create .stoa/ folder with templates
|
|
247
|
+
stoa edit moodboard # Open moodboard in your editor
|
|
248
|
+
stoa edit context # Open context.md in your editor
|
|
249
|
+
stoa edit lessons # Open lessons.md in your editor
|
|
250
|
+
|
|
251
|
+
# Moodboard
|
|
252
|
+
stoa moodboard sync # Generate tokens.json from notes.md
|
|
253
|
+
stoa moodboard describe # AI-analyze screenshots in moodboard/
|
|
254
|
+
stoa moodboard describe --overwrite # Overwrite existing notes.md
|
|
255
|
+
|
|
256
|
+
# Refine
|
|
257
|
+
stoa refine "your task" # Run 5-stage pipeline
|
|
258
|
+
stoa refine "task" --mode api # Force API mode (needs API key)
|
|
259
|
+
stoa refine "task" --mode clipboard # Get prompts without AI calls
|
|
260
|
+
|
|
261
|
+
# Specs
|
|
262
|
+
stoa specs list # List all saved specs
|
|
263
|
+
stoa specs show <name> # View a spec's contents
|
|
264
|
+
|
|
265
|
+
# Scenarios
|
|
266
|
+
stoa scenarios list # List scenarios for latest spec
|
|
267
|
+
stoa scenarios run # Walk through scenarios interactively
|
|
268
|
+
stoa scenarios run <name> # Run scenarios for a specific spec
|
|
269
|
+
|
|
270
|
+
# Guardrails & Roles
|
|
271
|
+
stoa guardrails list # List active guardrails
|
|
272
|
+
stoa guardrails show <name> # View a guardrail
|
|
273
|
+
stoa roles list # List available roles
|
|
274
|
+
stoa roles show <name> # View a role
|
|
275
|
+
|
|
276
|
+
# Config
|
|
277
|
+
stoa config # View current config
|
|
278
|
+
stoa config set apiKey <key> # Set Anthropic API key
|
|
279
|
+
stoa config set model <model> # Set model (default: claude-sonnet-4-20250514)
|
|
280
|
+
stoa config set mode <mode> # Set mode: api, claude-code, clipboard
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Execution Modes
|
|
286
|
+
|
|
287
|
+
Stoa has three ways to run the AI pipeline:
|
|
288
|
+
|
|
289
|
+
| Mode | How it works | You need |
|
|
290
|
+
|------|-------------|----------|
|
|
291
|
+
| `api` | Direct Anthropic API call | API key (`stoa config set apiKey`) |
|
|
292
|
+
| `claude-code` | Pipes to Claude Code CLI | Claude Code installed + subscription |
|
|
293
|
+
| `clipboard` | Returns prompts — no AI calls | Nothing (free) |
|
|
294
|
+
|
|
295
|
+
Stoa auto-detects: if you have an API key it uses `api`, if Claude Code is installed it uses `claude-code`, otherwise `clipboard`.
|
|
296
|
+
|
|
297
|
+
In clipboard mode, Stoa prints each stage's prompt. You paste it into any AI chat (Claude, ChatGPT, Cursor) and copy the response back. Everything works — just manually.
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Use with Cursor (MCP)
|
|
302
|
+
|
|
303
|
+
Add Stoa as an MCP server in Cursor. Create or edit `.cursor/mcp.json` in your project:
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"mcpServers": {
|
|
308
|
+
"stoa": {
|
|
309
|
+
"command": "node",
|
|
310
|
+
"args": ["/path/to/global/node_modules/stoa-mcp/dist/index.js"]
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Find the global path with:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
npm root -g
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Then in Cursor's Agent chat:
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
Use the refine_task tool with title: "My App" and description: "description of what I want"
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## How It Works
|
|
331
|
+
|
|
332
|
+
### The 5-Stage Pipeline
|
|
333
|
+
|
|
334
|
+
**Stage 1: Problem Statement** — Takes your one-sentence idea and expands it into a complete specification. Includes data models, file structure, CLI/API interface, design tokens (from your moodboard), and explicit assumptions.
|
|
335
|
+
|
|
336
|
+
**Stage 2: Acceptance Criteria** — Generates 3 verifiable "done when" conditions. Each is specific enough that you can test it in a browser or terminal.
|
|
337
|
+
|
|
338
|
+
**Stage 3: Constraints** — Produces four categories:
|
|
339
|
+
- **MUSTs** — non-negotiable requirements
|
|
340
|
+
- **MUST NOTs** — things to avoid (wrong libraries, anti-patterns)
|
|
341
|
+
- **Preferences** — nice-to-haves from your context.md
|
|
342
|
+
- **Failure Modes** — common mistakes to watch for (including lessons.md)
|
|
343
|
+
|
|
344
|
+
**Stage 4: Decomposition** — Breaks complex tasks into ordered subtasks, or says "no decomposition needed" for small tasks.
|
|
345
|
+
|
|
346
|
+
**Stage 5: Scenarios** — Generates GIVEN/EXPECTED test cases. These are blind tests — the AI that builds your app never sees them. You verify after the build.
|
|
347
|
+
|
|
348
|
+
### Project Awareness
|
|
349
|
+
|
|
350
|
+
When you run `stoa refine` in a project that already has code, Stoa scans:
|
|
351
|
+
- `package.json` — knows your stack (React, Vue, Tailwind, etc.)
|
|
352
|
+
- `src/` directory — knows your existing components
|
|
353
|
+
- `.stoa/specs/` — knows what's been built before
|
|
354
|
+
- Moodboard — knows your design system
|
|
355
|
+
- `context.md` — knows your dependencies and conventions
|
|
356
|
+
- `lessons.md` — knows past mistakes to avoid
|
|
357
|
+
|
|
358
|
+
The spec references existing files by name and says "add to" instead of "rebuild."
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## Starter Templates
|
|
363
|
+
|
|
364
|
+
`stoa init` ships with:
|
|
365
|
+
|
|
366
|
+
**5 Guardrails:**
|
|
367
|
+
- `explain-changes` — AI explains what it changed and why
|
|
368
|
+
- `dont-delete-code` — don't remove existing code without explicit request
|
|
369
|
+
- `ask-when-unclear` — stop and ask instead of guessing
|
|
370
|
+
- `run-tests` — run tests after changes
|
|
371
|
+
- `small-changes` — make focused, small changes
|
|
372
|
+
|
|
373
|
+
**3 Roles:**
|
|
374
|
+
- `Builder` — writes new features
|
|
375
|
+
- `Fixer` — fixes bugs from failure context
|
|
376
|
+
- `Planner` — breaks down large tasks
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## The Stoa Desktop App
|
|
381
|
+
|
|
382
|
+
The CLI is the free version. The full loop lives in the Stoa desktop app:
|
|
383
|
+
|
|
384
|
+
- Visual 5-stage refine with Accept/Edit/Skip per stage
|
|
385
|
+
- One-click build with Claude Code integration
|
|
386
|
+
- Blind test verification with auto-fix loop
|
|
387
|
+
- Session tracking with WIP snapshots
|
|
388
|
+
- Task hierarchy (parent → subtask → fix task)
|
|
389
|
+
- Dashboard with spec scores across all tasks
|
|
390
|
+
|
|
391
|
+
**Same pipeline, full GUI.** Coming soon at [stoafactory.com](https://stoafactory.com).
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## License
|
|
396
|
+
|
|
397
|
+
MIT
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface ComposePromptOpts {
|
|
2
|
+
role: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Read an approved spec file and extract Stage 1 + Stage 3 content.
|
|
6
|
+
* Exits non-zero if the file is missing or either stage is absent.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readApprovedSpec(name: string): {
|
|
9
|
+
stage1: string;
|
|
10
|
+
stage3: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Compose a full build prompt from an approved spec, role, guardrails, and moodboard.
|
|
14
|
+
* Does NOT include scenario content.
|
|
15
|
+
*/
|
|
16
|
+
export declare function composePrompt(name: string, opts: ComposePromptOpts): string;
|
|
17
|
+
/**
|
|
18
|
+
* Spawn Claude Code in Edit Files mode with the build prompt.
|
|
19
|
+
* Streams output to both terminal and a session log file in `.stoa/sessions/`.
|
|
20
|
+
* Uses --allowedTools so Claude Code can create/edit files (not --print).
|
|
21
|
+
* Completes when the close event fires (Claude Code exits normally in Edit Files mode).
|
|
22
|
+
*/
|
|
23
|
+
export declare function runBuild(name: string, prompt: string): Promise<void>;
|
|
24
|
+
export interface Subtask {
|
|
25
|
+
index: number;
|
|
26
|
+
text: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parse a `## Subtasks` section from spec content.
|
|
30
|
+
* Extracts numbered items (e.g. "1. Do something").
|
|
31
|
+
* Returns empty array if no Subtasks section exists.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseSubtasks(specContent: string): Subtask[];
|
|
34
|
+
/**
|
|
35
|
+
* Prompt user to choose subtask execution mode.
|
|
36
|
+
* Returns "all", "q", or a 1-based subtask number.
|
|
37
|
+
*/
|
|
38
|
+
export declare function promptSubtaskChoice(subtasks: Subtask[]): Promise<string>;
|
|
39
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA6BjF;AAiBD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAqC3E;AAKD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0GpE;AA6ED,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,EAAE,CAqB5D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAWxE"}
|