buildflow-dev 1.0.1 → 1.0.2

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 CHANGED
@@ -1,266 +1,592 @@
1
1
  # BuildFlow
2
2
 
3
- > Adaptive AI-powered development orchestration
3
+ > Adaptive AI-powered development orchestration for Claude Code, Gemini CLI, Codex CLI, Cursor, Cline, and Continue.
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/buildflow-dev.svg)](https://www.npmjs.com/package/buildflow-dev)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org)
7
8
 
8
9
  ---
9
10
 
10
- ## Install
11
+ ## Table of Contents
12
+
13
+ - [What is BuildFlow?](#what-is-buildflow)
14
+ - [Quick Start](#quick-start)
15
+ - [Supported AI Tools](#supported-ai-tools)
16
+ - [AI Slash Commands](#ai-slash-commands)
17
+ - [CLI Commands](#cli-commands)
18
+ - [How It Works](#how-it-works)
19
+ - [Package Source Structure](#package-source-structure)
20
+ - [The .buildflow/ Scaffold](#the-buildflow-scaffold)
21
+ - [Template System](#template-system)
22
+ - [9 Specialized Agents](#9-specialized-agents)
23
+ - [Examples](#examples)
24
+ - [Token Economics](#token-economics)
25
+ - [Contributing](#contributing)
26
+ - [Publishing](#publishing)
27
+ - [Roadmap](#roadmap)
28
+
29
+ ---
30
+
31
+ ## What is BuildFlow?
32
+
33
+ BuildFlow is a **CLI tool** that installs a structured AI workflow into any project. It does two things:
34
+
35
+ 1. **Scaffolds `.buildflow/`** — a folder of markdown files that act as persistent memory, project state, and agent instructions for your AI tool
36
+ 2. **Installs slash commands** — writes `/buildflow-*` command files into whichever AI tools you use (Claude Code, Cursor, etc.)
37
+
38
+ Once installed, you work entirely inside your AI tool using `/buildflow-*` commands. BuildFlow itself stays out of your way — it only runs when you use the CLI (`buildflow audit`, `buildflow fix`, etc.) from the terminal.
39
+
40
+ **The core idea:** AI tools lose context as conversations grow ("context rot"). BuildFlow prevents this by breaking work into phases, using fresh agent sessions per task, and persisting only essential context in `.buildflow/memory/light.md`.
41
+
42
+ ---
43
+
44
+ ## Quick Start
11
45
 
12
46
  ```bash
13
- # Interactive setup (recommended)
47
+ # Run once in any project directory
14
48
  npx buildflow-dev init
15
49
  ```
16
50
 
51
+ This will:
52
+ 1. Detect your project (framework, language, existing code vs. greenfield)
53
+ 2. Ask you 3 questions (app name, mode, security layer)
54
+ 3. Create `.buildflow/` with memory, state, and agent config files
55
+ 4. Detect which AI tools you have installed
56
+ 5. Write `/buildflow-*` slash commands into each detected tool
57
+
58
+ Then open your AI tool and type `/` to see the commands.
59
+
17
60
  ```bash
18
- # Or install globally
61
+ # Or install globally so you can use it in any project
19
62
  npm install -g buildflow-dev
20
63
  buildflow init
21
64
  ```
22
65
 
23
66
  ---
24
67
 
25
- ## What It Does
68
+ ## Supported AI Tools
26
69
 
27
- `buildflow init` will:
70
+ | Tool | Auto-detect Method | Global Install Path | Local Install Path | Trigger |
71
+ |------|-------------------|--------------------|--------------------|---------|
72
+ | **Claude Code** | `claude` CLI or `~/.claude/` directory | `~/.claude/commands/buildflow-*.md` | `.claude/commands/buildflow-*.md` | `/buildflow-*` |
73
+ | **Gemini CLI** | `gemini` CLI | `~/.gemini/commands/*.md` + `~/.gemini/GEMINI.md` | `.gemini/commands/*.md` + `GEMINI.md` | `/buildflow-*` |
74
+ | **Codex CLI** | `codex` CLI | `~/.codex/instructions/` + `~/.codex/skills/` | `.codex/instructions/` + `.codex/skills/` | `$buildflow-*` |
75
+ | **Cursor** | `~/.cursor/` or `/Applications/Cursor.app` | (falls back to local) | `.cursor/rules/buildflow.mdc` | `@buildflow-*` |
76
+ | **Cline** | VS Code extension `saoudrizwan.claude-dev` | (falls back to local) | `.clinerules` | `/buildflow-*` |
77
+ | **Continue** | `~/.continue/config.json` | `~/.continue/buildflow/*.md` + config patch | `.continue/buildflow/*.md` | `/buildflow-*` |
28
78
 
29
- 1. **Detect your project**existing codebase or greenfield, your framework, language, test setup
30
- 2. **Set up `.buildflow/`** — agents, memory, security rules, codebase knowledge
31
- 3. **Detect installed AI tools** — Claude Code, Gemini CLI, Codex CLI, Cursor, Cline, Continue
32
- 4. **Install `/buildflow-*` slash commands** into each detected tool
33
- 5. **You type `/` in your AI tool** to see and use the commands
79
+ **Detection logic** is in [`src/commands/install.js`](src/commands/install.js) each tool has a `detect()` method that checks for CLI binaries via `which` and known config directories.
34
80
 
35
81
  ---
36
82
 
37
- ## Supported AI Tools
38
-
39
- | Tool | Detection | Global Install | Local Install | Slash Commands |
40
- |------|-----------|----------------|---------------|----------------|
41
- | **Claude Code** | ✓ Auto-detect | `~/.claude/commands/` | `.claude/commands/` | `/buildflow-*` |
42
- | **Gemini CLI** | ✓ Auto-detect | `~/.gemini/commands/` | `.gemini/commands/` | `/buildflow-*` |
43
- | **Codex CLI** | ✓ Auto-detect | `~/.codex/instructions/` | `.codex/instructions/` | `/buildflow-*` |
44
- | **Cursor** | ✓ Auto-detect | (local only) | `.cursor/rules/` | `@buildflow-*` |
45
- | **Cline** | ✓ Auto-detect | (local only) | `.clinerules` | `/buildflow-*` |
46
- | **Continue** | ✓ Auto-detect | `~/.continue/` | `.continue/` | `/buildflow-*` |
83
+ ## AI Slash Commands
47
84
 
48
- ---
49
-
50
- ## Commands (type `/` in your AI tool)
85
+ These are installed into your AI tool and triggered by typing `/` (or `@` / `$` depending on the tool).
51
86
 
52
- ### Workflow
87
+ ### Workflow — Greenfield Projects
53
88
 
54
- | Command | Purpose | Tokens |
55
- |---------|---------|--------|
56
- | `/buildflow-start` | Begin project (smart mode detection) | ~8K |
57
- | `/buildflow-think` | Discuss & research (parallel agents) | ~30K |
58
- | `/buildflow-plan` | Create execution plan | ~20K |
59
- | `/buildflow-build` | Execute plan (parallel waves) | ~50K/task |
60
- | `/buildflow-check` | Verify quality | ~20K |
61
- | `/buildflow-ship` | Finalize + **security gate** | ~22K |
89
+ | Command | Agent | Purpose | Token Cost |
90
+ |---------|-------|---------|-----------|
91
+ | `/buildflow-start` | Strategist | Begin project: asks vision questions, detects mode, saves to `core/vision.md` | ~8K |
92
+ | `/buildflow-think [topic]` | Researcher × 3 + Synthesizer | Parallel web research on a topic, synthesized into a recommendation | ~30K |
93
+ | `/buildflow-plan [phase]` | Architect | Maps task dependencies, groups into parallel waves, writes `phases/N/PLAN.md` | ~20K |
94
+ | `/buildflow-build [wave]` | Builder × N + Reviewer | Executes the plan wave-by-wave with parallel Builders, style-matched to your codebase | ~50K/wave |
95
+ | `/buildflow-check` | Reviewer × 3 | Three parallel reviewers check correctness, quality, and security | ~20K |
96
+ | `/buildflow-ship` | Strategist + Security Auditor | Pre-ship security gate → retrospective → git tag | ~22K |
62
97
 
63
- ### Existing Codebase
98
+ ### Workflow — Existing Codebases
64
99
 
65
- | Command | Purpose | Tokens |
66
- |---------|---------|--------|
67
- | `/buildflow-onboard` | Map codebase (run once) | ~35K |
68
- | `/buildflow-modify` | Change existing code safely | ~30K |
69
- | `/buildflow-refactor` | Improve existing code | ~40K |
100
+ | Command | Agent | Purpose | Token Cost |
101
+ |---------|-------|---------|-----------|
102
+ | `/buildflow-onboard` | Cartographer | One-time analysis: writes `MAP.md`, `PATTERNS.md`, `DEPENDENCIES.md`, `HOTSPOTS.md` | ~35K |
103
+ | `/buildflow-modify "description"` | Surgeon | Surgical change with blast-radius analysis and restore point | ~30K |
104
+ | `/buildflow-refactor [scope]` | Surgeon + Reviewer | Improve code quality without changing behavior | ~40K |
70
105
 
71
106
  ### Security
72
107
 
73
- | Command | Purpose | Tokens |
74
- |---------|---------|--------|
75
- | `/buildflow-audit` | Full OWASP Top 10 scan | ~35K |
76
- | `/buildflow-audit --quick` | Recent changes only | ~15K |
108
+ | Command | Agent | Purpose | Token Cost |
109
+ |---------|-------|---------|-----------|
110
+ | `/buildflow-audit` | Security Auditor | Full OWASP Top 10 scan, writes report to `security/reports/` | ~35K |
111
+ | `/buildflow-audit --quick` | Security Auditor | Scans only recently changed files | ~15K |
112
+ | `/buildflow-audit --pre-ship` | Security Auditor | Lightweight secrets + critical patterns check only | ~10K |
77
113
 
78
114
  ### Utility
79
115
 
80
- | Command | Purpose | Tokens |
81
- |---------|---------|--------|
82
- | `/buildflow-status` | Where am I? | ~3K |
83
- | `/buildflow-explain <term>` | Define jargon or describe file | ~2K |
84
- | `/buildflow-back` | Undo to safe restore point | ~3K |
85
- | `/buildflow-help` | Diagnostic recovery | ~15K |
116
+ | Command | Agent | Purpose | Token Cost |
117
+ |---------|-------|---------|-----------|
118
+ | `/buildflow-status` | Strategist | Shows current phase, progress, and recommends next action | ~3K |
119
+ | `/buildflow-explain <term/file>` | Strategist | Plain-language explanation of code, files, or concepts | ~2K |
120
+ | `/buildflow-back [n]` | Strategist | Undo to a git restore point, updates state.md | ~3K |
121
+ | `/buildflow-help` | Strategist | Diagnostic mode: detects what's wrong and offers recovery paths | ~15K |
122
+
123
+ Each command is a markdown file in [`templates/commands/`](templates/commands/). The AI tool reads the file when you trigger the command and follows the instructions inside it.
86
124
 
87
125
  ---
88
126
 
89
- ## CLI Commands (terminal, outside AI tool)
127
+ ## CLI Commands
128
+
129
+ These run in your terminal, outside the AI tool. Useful for automation, CI, and quick checks.
90
130
 
91
131
  ```bash
92
- buildflow init # Set up BuildFlow + install slash commands
93
- buildflow install # (Re)install into AI tools
94
- buildflow install --tool claude # Install into specific tool
95
- buildflow install --tool all # Install into all detected tools
96
- buildflow audit # Terminal-level security scan (pattern-based)
97
- buildflow audit --quick # Scan recent changes only
98
- buildflow status # Show project state
99
- buildflow update # Update commands to latest version
132
+ buildflow init # Scaffold .buildflow/ and install slash commands
133
+ buildflow install # Re-install or add more AI tools
134
+ buildflow install --tool claude # Install into a specific tool
135
+ buildflow install --tool all # Install into all detected tools
136
+ buildflow install --global # Install to home directory (all projects)
137
+ buildflow install --local # Install to current project only (default)
138
+ buildflow audit # Pattern-based security scan, saves report
139
+ buildflow audit --quick # Scan recent changes only
140
+ buildflow audit --target src/api/ # Scan a specific directory
141
+ buildflow audit --report # Print the most recent saved report
142
+ buildflow fix # Interactive issue scanner + auto-fixer
143
+ buildflow fix --target src/ # Fix issues in a specific directory
144
+ buildflow status # Print current phase and project state
145
+ buildflow status --verbose # Also print .buildflow/ directory tree
146
+ buildflow update # Re-install slash commands (pick up new versions)
147
+ buildflow update --check # Check current version without updating
100
148
  ```
101
149
 
102
150
  ---
103
151
 
104
152
  ## How It Works
105
153
 
106
- ### 9 Specialized Agents
154
+ ### The install flow
107
155
 
108
- Each agent gets a **fresh 200K context window** — no context rot.
156
+ ```
157
+ npx buildflow-dev init
158
+
159
+ ├─ detectProjectInfo() Read package.json / requirements.txt / Cargo.toml
160
+ │ → framework, language, hasTests, hasGit
161
+
162
+ ├─ scaffoldBuildflow() Create .buildflow/ folder tree
163
+ │ Write pre-filled markdown files for each subfolder
164
+
165
+ ├─ patchGitignore() Add .buildflow/security/reports/ to .gitignore
166
+
167
+ ├─ ensureGit() Run git init if no .git/ exists
168
+
169
+ └─ runInstall() Detect AI tools → write command files per tool
170
+ ```
109
171
 
110
- | Agent | Role | Used In |
111
- |-------|------|---------|
112
- | 🎯 Strategist | Vision & decisions | `/buildflow-start`, `/buildflow-think` |
113
- | 🔍 Researcher | Parallel web research with source confidence | `/buildflow-think` |
114
- | 🔄 Synthesizer | Combines parallel research findings | `/buildflow-think` |
115
- | 🏗️ Architect | Dependency-aware planning | `/buildflow-plan` |
116
- | ⚒️ Builder | Code matching your style (parallel) | `/buildflow-build` |
117
- | 🔬 Reviewer | Quality checks (parallel) | `/buildflow-check` |
118
- | 🗺️ Cartographer | Maps existing codebases | `/buildflow-onboard` |
119
- | 🩺 Surgeon | Precise code modification | `/buildflow-modify` |
120
- | 🔒 Security Auditor | OWASP Top 10 scanning | `/buildflow-audit`, `/buildflow-ship` |
172
+ ### The fix flow
121
173
 
122
- ### Parallelization
174
+ ```
175
+ buildflow fix
176
+
177
+ ├─ walkFiles() Recursively scan code files (skips node_modules etc.)
178
+
179
+ ├─ scanFile() Test each line against SECRET_PATTERNS + VULN_PATTERNS
180
+
181
+ ├─ checkConfigIssues() Check .env not in .gitignore, missing lockfile, etc.
182
+
183
+ ├─ Auto-fixable group Show all, ask once "apply all?" — then apply silently
184
+ │ ├─ .env → .gitignore
185
+ │ ├─ Math.random() → crypto.randomUUID()
186
+ │ └─ npm install (missing lockfile)
187
+
188
+ └─ Prompt-required group Step through one at a time
189
+ └─ Skip / Log to DEBT.md / Open in editor / Stop
190
+ ```
123
191
 
124
- Research and building run agents in parallel:
192
+ ---
193
+
194
+ ## Package Source Structure
195
+
196
+ Every file in this package and why it exists:
125
197
 
126
198
  ```
127
- Sequential: 3 research topics × 60s = 180s
128
- Parallel: 3 researchers simultaneously = 60s (67% faster)
199
+ buildflow-dev/
200
+
201
+ ├── bin/
202
+ │ └── buildflow.js Entry point. Parses CLI args with commander,
203
+ │ lazy-loads command modules so startup is fast.
204
+ │ Top-level await requires "type": "module" in package.json.
205
+
206
+ ├── src/
207
+ │ ├── index.js Library entry point. Re-exports all command run()
208
+ │ functions so the package can also be used programmatically:
209
+ │ import { init, audit } from 'buildflow-dev'
210
+
211
+ │ ├── commands/
212
+ │ │ ├── init.js buildflow init
213
+ │ │ │ → detectProjectInfo(): reads package.json, pyproject.toml,
214
+ │ │ │ Cargo.toml, go.mod to detect language + framework
215
+ │ │ │ → scaffoldBuildflow(): creates .buildflow/ folder tree
216
+ │ │ │ with pre-filled markdown files
217
+ │ │ │ → patchGitignore(): adds security reports to .gitignore
218
+ │ │ │ → ensureGit(): runs git init if needed
219
+ │ │ │ → calls install.js to wire up AI tools
220
+ │ │ │
221
+ │ │ ├── install.js buildflow install
222
+ │ │ │ Contains TOOLS object: one entry per supported AI tool.
223
+ │ │ │ Each tool has: detect(), installGlobal(), installLocal()
224
+ │ │ │ detect() checks for CLI binary (via which) or config dirs.
225
+ │ │ │ install*() reads templates/commands/*.md and writes them
226
+ │ │ │ to the tool-specific location.
227
+ │ │ │
228
+ │ │ ├── audit.js buildflow audit
229
+ │ │ │ Pattern-based scanner (no AI, runs in terminal).
230
+ │ │ │ SECRET_PATTERNS: catches API keys, DB URLs, private keys.
231
+ │ │ │ VULN_PATTERNS: catches SQL injection, eval(), Math.random()
232
+ │ │ │ for tokens, sensitive data in logs.
233
+ │ │ │ walkFiles(): recursive file iterator that skips
234
+ │ │ │ node_modules, dist, .git, etc.
235
+ │ │ │ Saves timestamped report to .buildflow/security/reports/
236
+ │ │ │ Exits with code 1 if critical issues found (CI-friendly).
237
+ │ │ │
238
+ │ │ ├── fix.js buildflow fix
239
+ │ │ │ Runs the same scan as audit.js, then splits findings into:
240
+ │ │ │ - autoFixable: has an autoFix.apply() function defined.
241
+ │ │ │ Shows all upfront, applies with one confirmation prompt.
242
+ │ │ │ - needsPrompt: no safe auto-fix. Steps through one at a
243
+ │ │ │ time: Skip / Log to DEBT.md / Open in editor / Stop.
244
+ │ │ │ logSecurityDebt(): appends to .buildflow/security/DEBT.md
245
+ │ │ │ openInEditor(): tries $EDITOR env var, falls back to code
246
+ │ │ │
247
+ │ │ ├── status.js buildflow status
248
+ │ │ │ Reads .buildflow/core/state.md and memory/light.md
249
+ │ │ │ Parses key: value lines with a regex helper.
250
+ │ │ │ --verbose flag walks .buildflow/ and prints the tree.
251
+ │ │ │
252
+ │ │ └── update.js buildflow update
253
+ │ │ Re-runs install.js to refresh command files.
254
+ │ │ --check flag reads package.json version and prints it.
255
+ │ │
256
+ │ └── utils/
257
+ │ └── welcome.js Shown when buildflow is run with no arguments.
258
+ │ Two modes:
259
+ │ - Initialized: reads state.md, shows project info + commands
260
+ │ - Not initialized: shows quick-start instructions
261
+
262
+ ├── templates/
263
+ │ ├── CLAUDE.md Written to the user's project root as CLAUDE.md when
264
+ │ │ installing locally for Claude Code. Tells Claude to load
265
+ │ │ .buildflow/memory/light.md at session start and lists
266
+ │ │ all available /buildflow-* commands.
267
+ │ │ {{APP_NAME}} is replaced with the detected project name.
268
+ │ │
269
+ │ └── commands/ 14 markdown files — one per slash command.
270
+ │ │ Each file is the full instruction set for that command.
271
+ │ │ The AI reads and executes these when you trigger the command.
272
+ │ │ Format: YAML frontmatter (name, description, agent, tools)
273
+ │ │ followed by numbered steps the agent follows.
274
+ │ │
275
+ │ ├── start.md Vision gathering, mode detection (greenfield vs existing)
276
+ │ ├── think.md Parallel research with up to 3 Researcher agents
277
+ │ ├── plan.md Dependency mapping → wave-based execution plan
278
+ │ ├── build.md Wave-by-wave parallel Builder execution
279
+ │ ├── check.md 3-reviewer parallel quality check
280
+ │ ├── ship.md Pre-ship security gate → retro → git tag
281
+ │ ├── onboard.md One-time codebase analysis → MAP/PATTERNS/DEPENDENCIES/HOTSPOTS
282
+ │ ├── modify.md Surgical code change with blast-radius analysis
283
+ │ ├── refactor.md Quality improvement without behavior change
284
+ │ ├── audit.md OWASP Top 10 AI-powered scan
285
+ │ ├── status.md Current phase and recommended next action
286
+ │ ├── explain.md Plain-language explanation of code, concepts, errors
287
+ │ ├── back.md Undo to git restore point, update state
288
+ │ └── help.md Diagnostic mode + full command reference
289
+
290
+ ├── .gitignore
291
+ ├── LICENSE MIT
292
+ ├── README.md This file
293
+ └── package.json "type": "module" required for ESM imports.
294
+ "bin" wires buildflow and bf to bin/buildflow.js.
295
+ "files" limits npm publish to bin/, src/, templates/ only.
129
296
  ```
130
297
 
131
- ### Light Memory
298
+ ---
132
299
 
133
- `.buildflow/memory/light.md` persists essentials across sessions (under 5K tokens). Saves more than it costs.
300
+ ## The .buildflow/ Scaffold
134
301
 
135
- ### Security Gate
302
+ When a user runs `buildflow init`, this folder is created in their project:
136
303
 
137
- Every `/buildflow-ship` runs a pre-ship security check:
138
- - 🔴 Critical → **BLOCKED** (must fix)
139
- - 🟡 High → WARNING (can ship, log to DEBT.md)
140
- - ✅ Clean → Ship freely
304
+ ```
305
+ their-project/
306
+ └── .buildflow/
307
+
308
+ ├── core/
309
+ │ ├── vision.md What the project is, who it's for, success criteria.
310
+ │ │ Filled during /buildflow-start. Read by every agent
311
+ │ │ at session start to maintain alignment.
312
+ │ │
313
+ │ └── state.md Current phase number, status, detected framework.
314
+ │ Updated by /buildflow-ship, /buildflow-plan, /buildflow-back.
315
+ │ Also read by buildflow status (CLI).
316
+
317
+ ├── you/
318
+ │ └── preferences.md User's experience level, learning preferences, safety
319
+ │ settings, parallelization limits. The AI adapts its
320
+ │ explanation depth based on the experience: field.
321
+
322
+ ├── memory/
323
+ │ └── light.md The core of the memory system. Persists project essentials
324
+ │ across AI sessions: app name, framework, phase, last session
325
+ │ date, onboarding status, style fingerprint, recent decisions.
326
+ │ Kept under 5K tokens deliberately — costs less to load than
327
+ │ it saves in re-detection work.
328
+
329
+ ├── learnings/
330
+ │ ├── glossary.md Project-specific jargon and BuildFlow concepts. Grows as
331
+ │ │ /buildflow-explain is used. Agents reference it to stay
332
+ │ │ consistent with terminology across sessions.
333
+ │ │
334
+ │ └── decisions.md Log of architectural decisions: what was decided, why,
335
+ │ and the confidence level at the time. Prevents relitigating
336
+ │ the same choices in future sessions.
337
+
338
+ ├── research/ Output from /buildflow-think sessions. One file per topic
339
+ │ with sources, trust scores, and the synthesized recommendation.
340
+
341
+ ├── codebase/ Generated by /buildflow-onboard (existing projects only).
342
+ │ ├── MAP.md Architecture overview, folder structure, entry points
343
+ │ ├── PATTERNS.md Code conventions: naming, imports, error handling, testing
344
+ │ ├── DEPENDENCIES.md Top dependencies with purpose and security status
345
+ │ └── HOTSPOTS.md High-complexity files to handle carefully
346
+
347
+ ├── phases/ One subfolder per phase (01/, 02/, etc.)
348
+ │ └── 01/
349
+ │ ├── PLAN.md Task breakdown with dependency waves
350
+ │ └── retro.md Written during /buildflow-ship: what worked, what didn't
351
+
352
+ └── security/
353
+ ├── DEBT.md Deferred security issues with severity and date.
354
+ │ Populated by /buildflow-fix (log to debt option) and
355
+ │ /buildflow-ship when high-severity issues are found.
356
+ ├── rules/ Custom security rules (future)
357
+ ├── suppressions/ False-positive suppressions (future)
358
+ └── reports/ Timestamped audit reports from buildflow audit CLI.
359
+ Gitignored by default — may contain sensitive findings.
360
+ ```
141
361
 
142
362
  ---
143
363
 
144
- ## Project Structure
364
+ ## Template System
145
365
 
366
+ Templates in [`templates/commands/`](templates/commands/) follow this format:
367
+
368
+ ```markdown
369
+ ---
370
+ name: buildflow-start
371
+ description: One-line description shown in the AI tool's command menu
372
+ allowed-tools: Read, Write, WebSearch
373
+ agent: strategist
374
+ ---
375
+
376
+ # /buildflow-start
377
+
378
+ Steps the AI follows when this command is triggered...
146
379
  ```
147
- your-project/
148
- ├── .buildflow/
149
- │ ├── core/
150
- │ │ ├── vision.md ← What you're building
151
- │ │ └── state.md ← Current position
152
- │ ├── you/
153
- │ │ ├── preferences.md ← Your settings
154
- │ │ └── style-guide.md ← Auto-detected code style
155
- │ ├── memory/
156
- │ │ └── light.md ← Persistent context (≤5K)
157
- │ ├── codebase/ ← Existing project maps
158
- │ │ ├── MAP.md
159
- │ │ ├── PATTERNS.md
160
- │ │ ├── DEPENDENCIES.md
161
- │ │ └── HOTSPOTS.md
162
- │ ├── security/
163
- │ │ ├── DEBT.md
164
- │ │ └── reports/
165
- │ ├── phases/ ← Per-phase work
166
- │ └── learnings/ ← Glossary, decisions
167
-
168
- ├── commands/buildflow/ ← Slash command definitions
169
- │ ├── start.md
170
- │ ├── think.md
171
- │ └── ... (14 commands)
172
-
173
- └── agents/ ← Agent personalities
174
- ├── strategist.md
175
- └── ... (9 agents)
176
- ```
177
380
 
178
- For AI tools with dedicated directories:
381
+ The `agent:` field names the specialized agent persona the AI should adopt. The `allowed-tools:` field tells Claude Code which tools the command is permitted to use.
382
+
383
+ **How templates become commands per tool:**
384
+
385
+ | Tool | Where templates go | File naming |
386
+ |------|--------------------|-------------|
387
+ | Claude Code | `.claude/commands/` or `~/.claude/commands/` | `buildflow-start.md` |
388
+ | Gemini CLI | `.gemini/commands/` + appended to `GEMINI.md` | `start.md` |
389
+ | Codex CLI | `.codex/instructions/` + `.codex/skills/` | `buildflow-start.md` |
390
+ | Cursor | `.cursor/rules/buildflow.mdc` | Single combined file |
391
+ | Cline | `.clinerules` (project root) | Single combined file |
392
+ | Continue | `.continue/buildflow/` + `config.json` patch | `start.md` |
393
+
394
+ ---
179
395
 
396
+ ## 9 Specialized Agents
397
+
398
+ Each agent gets a fresh context window — this is how BuildFlow avoids context rot.
399
+
400
+ | Agent | Persona | Commands |
401
+ |-------|---------|----------|
402
+ | 🎯 **Strategist** | Vision, decisions, orientation | `start`, `status`, `explain`, `back`, `help` |
403
+ | 🔍 **Researcher** | Web research with source trust scores | `think` (parallel × 3) |
404
+ | 🔄 **Synthesizer** | Combines parallel research output | `think` |
405
+ | 🏗️ **Architect** | Dependency mapping, wave planning | `plan` |
406
+ | ⚒️ **Builder** | Style-matched code generation | `build` (parallel per wave) |
407
+ | 🔬 **Reviewer** | Correctness, quality, security checks | `check` (parallel × 3), `build` |
408
+ | 🗺️ **Cartographer** | One-time codebase analysis | `onboard` |
409
+ | 🩺 **Surgeon** | Minimal-footprint code modification | `modify`, `refactor` |
410
+ | 🔒 **Security Auditor** | OWASP Top 10 scanning | `audit`, `ship` (pre-ship gate) |
411
+
412
+ Parallelization example from `/buildflow-think`:
180
413
  ```
181
- ~/.claude/commands/buildflow-*.md ← Global Claude Code
182
- .claude/commands/buildflow-*.md ← Local Claude Code
183
- ~/.gemini/commands/buildflow-*.md ← Global Gemini CLI
184
- .cursor/rules/buildflow.mdc ← Cursor
185
- .clinerules ← Cline
414
+ Sequential: 3 research topics × 60s = 180s total
415
+ Parallel: 3 researchers simultaneously = 60s total (67% faster)
186
416
  ```
187
417
 
188
418
  ---
189
419
 
190
420
  ## Examples
191
421
 
192
- ### New project
422
+ ### Starting a new project
193
423
 
194
424
  ```bash
195
- mkdir my-app && cd my-app
425
+ mkdir my-saas && cd my-saas
196
426
  npx buildflow-dev init
197
-
198
- # → Detects: No existing code (greenfield)
427
+ # → Detects: greenfield (no src/, no package.json)
199
428
  # → Detects: Claude Code ✓, Cursor ✓
200
- # → Installs commands into both
201
- # → Opens Claude Code...
429
+ # → Installs 14 commands into both tools
430
+ ```
202
431
 
432
+ In Claude Code:
433
+ ```
203
434
  /buildflow-start
435
+ # → Asks: What are you building? Who is it for? ...
436
+
204
437
  /buildflow-think tech-stack
438
+ # → 3 parallel researchers compare options, Synthesizer recommends
439
+
205
440
  /buildflow-plan phase-1
206
- /buildflow-build phase-1
441
+ # → Architect maps dependencies, creates phases/01/PLAN.md
442
+
443
+ /buildflow-build
444
+ # → Parallel Builders execute wave-by-wave, matched to your style
445
+
207
446
  /buildflow-check
208
- /buildflow-ship ← security gate runs automatically
447
+ # → 3 reviewers check correctness + quality + security in parallel
448
+
449
+ /buildflow-ship
450
+ # → Security gate runs → retrospective → git tag
209
451
  ```
210
452
 
211
- ### Existing project
453
+ ### Adding to an existing project
212
454
 
213
455
  ```bash
214
- cd my-existing-app
456
+ cd my-next-app
215
457
  npx buildflow-dev init
216
-
217
- # → Detects: Next.js project
458
+ # → Detects: Next.js, TypeScript, Jest tests, git initialized
218
459
  # → Detects: Claude Code ✓
219
- # → Installs commands
220
- # → Opens Claude Code...
460
+ # → Installs commands locally
461
+ ```
462
+
463
+ In Claude Code:
464
+ ```
465
+ /buildflow-onboard
466
+ # → Cartographer reads codebase, writes MAP.md + PATTERNS.md
221
467
 
222
- /buildflow-onboard ← one-time codebase analysis
223
- /buildflow-modify "Add dark mode to settings page"
224
- /buildflow-refactor src/components/Dashboard.tsx
225
- /buildflow-audit --quick ← security check on recent changes
468
+ /buildflow-modify "Add rate limiting to /api/auth/login"
469
+ # → Surgeon: blast-radius analysis restore point surgical change
470
+
471
+ /buildflow-audit --quick
472
+ # → Security Auditor scans changed files since last commit
473
+ ```
474
+
475
+ ### Terminal security check (CI-friendly)
476
+
477
+ ```bash
478
+ buildflow audit
479
+ # → Exits with code 1 if critical issues found
480
+ # → Saves report to .buildflow/security/reports/
481
+
482
+ buildflow fix
483
+ # → Interactive: auto-fixes safe issues, prompts for everything else
226
484
  ```
227
485
 
228
486
  ---
229
487
 
230
488
  ## Token Economics
231
489
 
232
- | Mode | Per Session | Notes |
233
- |------|-------------|-------|
234
- | Greenfield | 130-160K | Full workflow |
235
- | Existing (first time) | +35K | One-time onboarding |
236
- | Existing (after onboard) | 130-160K | Same as greenfield |
237
- | Security gate (pre-ship) | +10K | Always runs with ship |
490
+ | Scenario | Tokens | Notes |
491
+ |----------|--------|-------|
492
+ | Greenfield full workflow | 130160K | All phases, one session |
493
+ | Onboarding existing project | +35K | One-time, never again |
494
+ | Existing project after onboard | 130160K | Same as greenfield |
495
+ | Security gate (per ship) | +10K | Always runs with `/buildflow-ship` |
496
+ | Light memory load (per session) | ~2K | **Saves** ~10K in re-detection |
238
497
 
239
- Light memory SAVES ~10K per session vs no memory (avoids re-detection).
498
+ Light memory pays for itself after one session loading 2K to avoid re-detecting framework, phase, and preferences each time.
240
499
 
241
500
  ---
242
501
 
243
502
  ## Contributing
244
503
 
245
- 1. Fork the repository
246
- 2. Create a feature branch: `git checkout -b feat/new-agent`
247
- 3. Make changes
248
- 4. Run tests: `npm test`
249
- 5. Submit a PR
504
+ ### Dev setup
505
+
506
+ ```bash
507
+ git clone https://github.com/Vikas-gurrapu/buildflow.git
508
+ cd buildflow
509
+ npm install
510
+ node bin/buildflow.js --help # verify it works
511
+ ```
512
+
513
+ ### Project conventions
514
+
515
+ - **ES Modules only** — `"type": "module"` in `package.json`. Use `import/export`, never `require()`.
516
+ - **Node 18+ compatibility** — avoid `import.meta.dirname` (Node 21+). Use `dirname(fileURLToPath(import.meta.url))` instead.
517
+ - **No TypeScript** — keeps the package zero-build, directly runnable. Types via JSDoc if needed.
518
+ - **No bundler** — source files run directly. What you write is what ships.
519
+ - **Lazy command imports** — `bin/buildflow.js` uses `() => import(...)` so startup time stays fast even as commands grow.
520
+
521
+ ### Adding a new AI tool
522
+
523
+ 1. Add an entry to the `TOOLS` object in [`src/commands/install.js`](src/commands/install.js)
524
+ 2. Implement `detect()`, `installGlobal()`, `installLocal()`, and `triggerNote`
525
+ 3. Add the tool to the supported tools table in this README
526
+
527
+ ### Adding a new slash command
528
+
529
+ 1. Create `templates/commands/<name>.md` with frontmatter + steps
530
+ 2. Add the name to the `commandNames` array in `loadCommandTemplates()` in `install.js`
531
+ 3. Document it in the AI Slash Commands table in this README
532
+
533
+ ### Adding a new auto-fix to `buildflow fix`
534
+
535
+ Add an `autoFix` property to a pattern in `VULN_PATTERNS` or `checkConfigIssues()` in [`src/commands/fix.js`](src/commands/fix.js):
536
+
537
+ ```js
538
+ {
539
+ pattern: /somePattern/g,
540
+ label: 'Description of the issue',
541
+ severity: 'HIGH',
542
+ owasp: 'A03',
543
+ autoFix: {
544
+ description: 'What the fix does (shown to user before applying)',
545
+ apply: (content) => content.replace(/somePattern/g, 'saferAlternative'),
546
+ note: 'Optional: shown after fix is applied (e.g. "review this change")',
547
+ },
548
+ }
549
+ ```
550
+
551
+ `apply` receives the file content as a string and must return the fixed content. For fixes that don't modify a single file (like writing to `.gitignore` or running `npm install`), call side effects directly and omit the `content` parameter.
250
552
 
251
553
  ---
252
554
 
253
- ## License
555
+ ## Publishing
556
+
557
+ ```bash
558
+ # Bump version in package.json, then:
559
+ npm login
560
+ npm publish
561
+
562
+ # Or dry-run to see what gets published:
563
+ npm publish --dry-run
564
+ ```
565
+
566
+ Only these paths are included in the npm package (`files` in `package.json`):
567
+ - `bin/` — CLI entry point
568
+ - `src/` — command and utility modules
569
+ - `templates/` — slash command markdown files and CLAUDE.md template
570
+ - `README.md`
571
+ - `LICENSE`
254
572
 
255
- MIT © 2026
573
+ Everything else (`.claude/`, `node_modules/`, `.gitignore`, etc.) is excluded.
256
574
 
257
575
  ---
258
576
 
259
577
  ## Roadmap
260
578
 
261
- - [ ] `buildflow install --tool windsurf` (Windsurf IDE)
262
- - [ ] `buildflow install --tool aider` (Aider CLI)
263
- - [ ] Web dashboard for project status
264
- - [ ] Team collaboration features
265
- - [ ] GitHub Actions integration
266
- - [ ] Custom agent creation wizard
579
+ - [ ] `buildflow install --tool windsurf` Windsurf IDE support
580
+ - [ ] `buildflow install --tool aider` Aider CLI support
581
+ - [ ] `buildflow install --tool zed` — Zed editor support
582
+ - [ ] GitHub Actions workflow: `buildflow audit` in CI
583
+ - [ ] `buildflow fix --auto` — non-interactive mode for CI
584
+ - [ ] Web dashboard for project status visualization
585
+ - [ ] Custom agent creation: `buildflow agent create`
586
+ - [ ] Team sync: shared `.buildflow/` across teammates
587
+
588
+ ---
589
+
590
+ ## License
591
+
592
+ MIT © 2026 [Vikas Gurrapu](https://github.com/Vikas-gurrapu)