buildflow-dev 1.0.1 → 1.0.3

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.
@@ -86,36 +86,409 @@ function scaffoldBuildflow(appName, projectInfo) {
86
86
  for (const d of dirs) mkdirSync(join(base, d), { recursive: true })
87
87
 
88
88
  const today = new Date().toISOString().split('T')[0]
89
+ const isExisting = projectInfo.projectType === 'existing'
89
90
 
90
- writeFileSync(join(base, 'core', 'vision.md'),
91
- projectInfo.projectType === 'existing'
92
- ? `# Project Vision: ${appName}\n\n## Type\nExisting ${projectInfo.framework} project\n\n## Goals\n[Fill during /buildflow-start]\n\n---\nInitialized: ${today}\n`
93
- : `# Project Vision: ${appName}\n\n## What I'm Building\n[Fill during /buildflow-start]\n\n---\nInitialized: ${today}\n`
94
- )
91
+ // ── core/vision.md ──────────────────────────────────────────────────────────
92
+ writeFileSync(join(base, 'core', 'vision.md'), isExisting
93
+ ? `# Vision ${appName}
95
94
 
95
+ > **Purpose:** This file is the source of truth for what you're building.
96
+ > Every agent reads it at session start to stay aligned with your goals.
97
+ > Fill it in during your first \`/buildflow-start\` session.
98
+
99
+ ---
100
+
101
+ ## Project Type
102
+
103
+ **Existing ${projectInfo.framework} project** — language: ${projectInfo.language}
104
+
105
+ ---
106
+
107
+ ## Goals for This Project
108
+
109
+ > What do you want to achieve by using BuildFlow on this codebase?
110
+ > Examples: "Add auth system", "Migrate to TypeScript", "Improve performance"
111
+
112
+ - [ ] Goal 1 — *(fill in)*
113
+ - [ ] Goal 2 — *(fill in)*
114
+
115
+ ---
116
+
117
+ ## What NOT to Change
118
+
119
+ > Any areas of the codebase that are off-limits or need special care?
120
+
121
+ *(fill in or delete this section)*
122
+
123
+ ---
124
+
125
+ ## Success Criteria
126
+
127
+ > How will you know the work is done and done well?
128
+
129
+ - [ ] *(fill in)*
130
+
131
+ ---
132
+
133
+ *Initialized: ${today} · BuildFlow v3.0*
134
+ `
135
+ : `# Vision — ${appName}
136
+
137
+ > **Purpose:** This file is the source of truth for what you're building.
138
+ > Every agent reads it at session start to stay aligned with your goals.
139
+ > Fill it in during your first \`/buildflow-start\` session.
140
+
141
+ ---
142
+
143
+ ## What I'm Building
144
+
145
+ > One paragraph: what is this product, tool, or service?
146
+
147
+ *(fill in during /buildflow-start)*
148
+
149
+ ---
150
+
151
+ ## Who It's For
152
+
153
+ > Describe the target user. Be specific — "developers using Node.js" beats "developers".
154
+
155
+ *(fill in)*
156
+
157
+ ---
158
+
159
+ ## Problem It Solves
160
+
161
+ > What exists today that's painful, broken, or missing?
162
+
163
+ *(fill in)*
164
+
165
+ ---
166
+
167
+ ## Success Criteria
168
+
169
+ > How will you know it's working? Measurable outcomes are better than vague goals.
170
+
171
+ - [ ] *(fill in)*
172
+
173
+ ---
174
+
175
+ ## Simplest Useful Version (MVP)
176
+
177
+ > What's the smallest thing you can ship that delivers real value?
178
+
179
+ *(fill in)*
180
+
181
+ ---
182
+
183
+ ## Constraints
184
+
185
+ | Constraint | Value |
186
+ |---------------|---------------|
187
+ | Target date | — |
188
+ | Team size | — |
189
+ | Stack | ${projectInfo.language !== 'unknown' ? projectInfo.language : '—'} |
190
+
191
+ ---
192
+
193
+ *Initialized: ${today} · BuildFlow v3.0*
194
+ `)
195
+
196
+ // ── core/state.md ───────────────────────────────────────────────────────────
96
197
  writeFileSync(join(base, 'core', 'state.md'),
97
- `# State\n\nProject: ${appName}\nType: ${projectInfo.projectType}\nFramework: ${projectInfo.framework}\nPhase: 0\nStatus: Initialized\nBuildFlow: 3.0\nDate: ${today}\n`
98
- )
198
+ `# Project State
199
+
200
+ > **Purpose:** Tracks where you are in the BuildFlow workflow.
201
+ > Updated automatically by \`/buildflow-plan\`, \`/buildflow-ship\`, and \`/buildflow-back\`.
202
+ > Also read by \`buildflow status\` in the terminal.
203
+
204
+ ---
205
+
206
+ ## Current State
207
+
208
+ | Field | Value |
209
+ |---------------|------------------------|
210
+ | **Project** | ${appName} |
211
+ | **Type** | ${projectInfo.projectType} |
212
+ | **Framework** | ${projectInfo.framework} |
213
+ | **Phase** | 0 |
214
+ | **Status** | Initialized |
215
+ | **BuildFlow** | 3.0 |
216
+ | **Updated** | ${today} |
99
217
 
218
+ ---
219
+
220
+ ## Phase History
221
+
222
+ | Phase | Description | Status | Date |
223
+ |-------|-------------|------------|------|
224
+ | 0 | Setup | ✅ Complete | ${today} |
225
+
226
+ ---
227
+
228
+ ## Status Reference
229
+
230
+ | Status | Meaning |
231
+ |---------------|----------------------------------------------|
232
+ | Initialized | BuildFlow set up, ready to start |
233
+ | In Progress | Actively building a phase |
234
+ | Shipped | Phase complete and committed to git |
235
+ | Blocked | Waiting on a decision or external dependency |
236
+ `)
237
+
238
+ // ── you/preferences.md ──────────────────────────────────────────────────────
100
239
  writeFileSync(join(base, 'you', 'preferences.md'),
101
- `# Preferences\n\nexperience: junior\nproject_type: ${projectInfo.projectType}\nframework: ${projectInfo.framework}\n\nlearning:\n show_explanations: true\n confidence_calibration: true\n source_citations: true\n\nsafety:\n enable_undo: true\n restore_points: true\n\nmemory:\n type: light\n retention_days: 30\n\nparallel:\n enabled: true\n max_researchers: 3\n\nsecurity:\n pre_ship_gate: true\n auto_suggest_on_sensitive: true\n`
102
- )
240
+ `# Your Preferences
241
+
242
+ > **Purpose:** BuildFlow reads this at session start to adapt its behavior to you.
243
+ > Edit any value — changes take effect in the next AI session.
244
+
245
+ ---
246
+
247
+ ## Experience Level
248
+
249
+ \`\`\`yaml
250
+ experience: junior # junior | mid | senior
251
+ \`\`\`
252
+
253
+ | Value | What it changes |
254
+ |----------|------------------------------------------------------------------|
255
+ | \`junior\` | More explanations, analogies, LEARN: comments in generated code |
256
+ | \`mid\` | Balanced — assumes framework knowledge, skips basics |
257
+ | \`senior\` | Concise — assumes full-stack knowledge, no hand-holding |
258
+
259
+ ---
260
+
261
+ ## Project Context
262
+
263
+ \`\`\`yaml
264
+ project_type: ${projectInfo.projectType} # greenfield | existing
265
+ framework: ${projectInfo.framework}
266
+ \`\`\`
267
+
268
+ ---
103
269
 
270
+ ## Learning Aids
271
+
272
+ \`\`\`yaml
273
+ learning:
274
+ show_explanations: true # Explain WHY, not just WHAT
275
+ confidence_calibration: true # Ask confidence (1-5) before big decisions
276
+ source_citations: true # Cite research sources with trust scores (1-5)
277
+ \`\`\`
278
+
279
+ ---
280
+
281
+ ## Safety
282
+
283
+ \`\`\`yaml
284
+ safety:
285
+ enable_undo: true # /buildflow-back restores to git checkpoints
286
+ restore_points: true # Auto-commit before destructive operations
287
+ \`\`\`
288
+
289
+ ---
290
+
291
+ ## Memory
292
+
293
+ \`\`\`yaml
294
+ memory:
295
+ type: light # light (≤5K tokens) | full (more context, more cost)
296
+ retention_days: 30 # Discard session data older than this
297
+ \`\`\`
298
+
299
+ ---
300
+
301
+ ## Parallelization
302
+
303
+ \`\`\`yaml
304
+ parallel:
305
+ enabled: true # Run multiple agents simultaneously
306
+ max_researchers: 3 # Max parallel Researcher agents in /buildflow-think
307
+ \`\`\`
308
+
309
+ ---
310
+
311
+ ## Security
312
+
313
+ \`\`\`yaml
314
+ security:
315
+ pre_ship_gate: true # Run security audit before every /buildflow-ship
316
+ auto_suggest_on_sensitive: true # Flag sensitive files (auth, payments) automatically
317
+ \`\`\`
318
+ `)
319
+
320
+ // ── memory/light.md ─────────────────────────────────────────────────────────
104
321
  writeFileSync(join(base, 'memory', 'light.md'),
105
- `# Light Memory\n\napp: ${appName}\ntype: ${projectInfo.projectType}\nframework: ${projectInfo.framework}\nphase: 0\nlast_session: ${today}\nbuildflow: 3.0\nonboarded: ${projectInfo.projectType === 'greenfield' ? 'n/a' : 'false'}\n\n## Style Fingerprint\n[Auto-populated after first build]\n\n## Recent Decisions\n[Auto-populated]\n`
106
- )
322
+ `# Light Memory
323
+
324
+ > **Purpose:** Persists essential project context across AI sessions.
325
+ > Loaded at the start of every BuildFlow session to avoid re-detecting things.
326
+ > **Keep this file under 5,000 tokens.** Distill insights — don't log events.
327
+ > The AI updates this automatically. You can edit it too.
328
+
329
+ ---
107
330
 
331
+ ## Session Data
332
+
333
+ \`\`\`yaml
334
+ app: ${appName}
335
+ type: ${projectInfo.projectType}
336
+ framework: ${projectInfo.framework}
337
+ phase: 0
338
+ last_session: ${today}
339
+ buildflow: 3.0
340
+ onboarded: ${projectInfo.projectType === 'greenfield' ? 'n/a # greenfield project — no onboarding needed' : 'false # run /buildflow-onboard to analyze your codebase'}
341
+ \`\`\`
342
+
343
+ ---
344
+
345
+ ## Style Fingerprint
346
+
347
+ > Auto-populated by \`/buildflow-build\` after the first coding session.
348
+ > Captures naming conventions, import style, error handling patterns.
349
+
350
+ *(not yet populated)*
351
+
352
+ ---
353
+
354
+ ## Key Decisions
355
+
356
+ > Major architectural or technology decisions. Summarized here so agents
357
+ > don't relitigate them. Full details are in \`learnings/decisions.md\`.
358
+
359
+ *(not yet populated)*
360
+
361
+ ---
362
+
363
+ ## Current Focus
364
+
365
+ > What you're working on right now. Updated by \`/buildflow-plan\` and \`/buildflow-ship\`.
366
+
367
+ Phase 0 — Initial setup complete. Run \`/buildflow-start\` to begin.
368
+ `)
369
+
370
+ // ── learnings/glossary.md ───────────────────────────────────────────────────
108
371
  writeFileSync(join(base, 'learnings', 'glossary.md'),
109
- `# Glossary\n\n## context-rot\nAI quality degrades as conversation grows. Avoided by fresh agents.\n\n## confidence-calibration\nAsking 1-5 before locking decisions. Triggers explanations when low.\n\n## cartographer\nAgent that maps existing codebases for other agents to use.\n\n## surgeon\nAgent that makes precise modifications to existing code.\n\n## security-auditor\nAgent that runs OWASP Top 10 checks before shipping.\n`
110
- )
372
+ `# Glossary
373
+
374
+ > **Purpose:** Defines terms used across BuildFlow sessions.
375
+ > Agents reference this to stay consistent with terminology.
376
+ > Grows automatically when you use \`/buildflow-explain\`.
377
+ > Add your own project-specific terms below the BuildFlow section.
378
+
379
+ ---
111
380
 
381
+ ## BuildFlow Terms
382
+
383
+ | Term | Definition |
384
+ |------|------------|
385
+ | **context-rot** | AI quality degrades as conversation grows long. BuildFlow avoids this by using fresh agent sessions per task. |
386
+ | **confidence-calibration** | Asking for a 1–5 confidence score before locking major decisions. Score below 3 triggers alternatives or research. |
387
+ | **light memory** | The \`memory/light.md\` file — essential project context kept under 5K tokens, loaded at every session start. |
388
+ | **wave** | A group of tasks that can run in parallel because they have no dependencies on each other. |
389
+ | **restore point** | A git commit created before a destructive operation so \`/buildflow-back\` can undo it. |
390
+ | **blast radius** | The set of files affected by a code change — mapped before modifying anything in Surgeon mode. |
391
+
392
+ ---
393
+
394
+ ## Agent Roles
395
+
396
+ | Agent | Role |
397
+ |-------|------|
398
+ | **Strategist** | Vision, decisions, project orientation |
399
+ | **Researcher** | Web research with source trust scores (1–5) |
400
+ | **Synthesizer** | Combines parallel research into a recommendation |
401
+ | **Architect** | Maps task dependencies, creates wave-based plans |
402
+ | **Builder** | Writes code matched to your existing style |
403
+ | **Reviewer** | Quality, correctness, and security checks |
404
+ | **Cartographer** | One-time existing codebase analysis |
405
+ | **Surgeon** | Precise, minimal-footprint code modifications |
406
+ | **Security Auditor** | OWASP Top 10 scanning, pre-ship gate |
407
+
408
+ ---
409
+
410
+ ## Project Terms
411
+
412
+ > Add your project-specific jargon here so all agents use consistent language.
413
+
414
+ *(add terms as your project evolves)*
415
+ `)
416
+
417
+ // ── learnings/decisions.md ──────────────────────────────────────────────────
112
418
  writeFileSync(join(base, 'learnings', 'decisions.md'),
113
- `# Decision Log\n\n## ${today} — Initial Setup\nDecision: Use BuildFlow v3.0\nType: ${projectInfo.projectType} (${projectInfo.framework})\nConfidence: 5/5\n`
114
- )
419
+ `# Decision Log
420
+
421
+ > **Purpose:** Records major architectural and technology decisions.
422
+ > Prevents relitigating the same choices in future sessions.
423
+ > Each decision includes what was decided, why, and how confident you were.
424
+ > Updated by agents during \`/buildflow-think\` and \`/buildflow-plan\`.
425
+
426
+ ---
427
+
428
+ ## How to Read This Log
429
+
430
+ | Field | Meaning |
431
+ |-------|---------|
432
+ | **Decision** | What was chosen |
433
+ | **Alternatives** | What else was considered |
434
+ | **Rationale** | Why this option won |
435
+ | **Confidence** | 1–5 at time of decision (5 = very sure) |
436
+ | **Revisit if** | Conditions that would make this worth reconsidering |
437
+
438
+ ---
439
+
440
+ ## Log
441
+
442
+ ### ${today} — Initial Setup
115
443
 
444
+ | Field | Value |
445
+ |-------|-------|
446
+ | **Decision** | Use BuildFlow v3.0 for development orchestration |
447
+ | **Type** | ${projectInfo.projectType} · ${projectInfo.framework} |
448
+ | **Confidence** | 5/5 |
449
+ | **Revisit if** | — |
450
+
451
+ ---
452
+
453
+ *New decisions are appended below by \`/buildflow-think\` and \`/buildflow-plan\`.*
454
+ `)
455
+
456
+ // ── security/DEBT.md ────────────────────────────────────────────────────────
116
457
  writeFileSync(join(base, 'security', 'DEBT.md'),
117
- `# Security Debt\n\nTrack deferred security issues.\n\n## Active\n[None]\n`
118
- )
458
+ `# Security Debt
459
+
460
+ > **Purpose:** Tracks security issues that were found but not immediately fixed.
461
+ > Populated by \`buildflow fix\` (log to debt option) and \`/buildflow-ship\`
462
+ > when high-severity issues are found but you choose to ship anyway.
463
+ > Review this before every major release.
464
+
465
+ ---
466
+
467
+ ## Severity Reference
468
+
469
+ | Level | Icon | Action Required |
470
+ |-------|------|-----------------|
471
+ | Critical | 🔴 | Fix before next commit. Blocks \`/buildflow-ship\`. |
472
+ | High | 🟡 | Fix this sprint. Logged here when shipping despite warning. |
473
+ | Medium | 🟠 | Fix when in the area. Won't block shipping. |
474
+ | Low | 🔵 | Fix opportunistically. |
475
+
476
+ ---
477
+
478
+ ## Active Issues
479
+
480
+ > Issues that need to be addressed.
481
+
482
+ *None — clean slate.*
483
+
484
+ ---
485
+
486
+ ## Resolved Issues
487
+
488
+ > Move items here (with resolution date and fix description) when addressed.
489
+
490
+ *None yet.*
491
+ `)
119
492
 
120
493
  return base
121
494
  }