buildflow-dev 1.0.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.
@@ -0,0 +1,83 @@
1
+ import chalk from 'chalk'
2
+ import { existsSync, readFileSync } from 'fs'
3
+ import { join } from 'path'
4
+
5
+ export async function showWelcome() {
6
+ const isInitialized = existsSync(join(process.cwd(), '.buildflow'))
7
+
8
+ console.log('\n' + chalk.bold.white(' BuildFlow v3.0'))
9
+ console.log(chalk.dim(' Adaptive AI-powered development orchestration\n'))
10
+
11
+ console.log(
12
+ chalk.dim(' Works with: ') +
13
+ chalk.hex('#8B5CF6')('Claude Code') + ' ' +
14
+ chalk.hex('#4285F4')('Gemini CLI') + ' ' +
15
+ chalk.hex('#10A37F')('Codex CLI') + ' ' +
16
+ chalk.white('Cursor') + ' ' +
17
+ chalk.hex('#007AFF')('Cline') + ' ' +
18
+ chalk.hex('#F59E0B')('Continue')
19
+ )
20
+ console.log('')
21
+
22
+ if (isInitialized) {
23
+ let state = {}
24
+ try {
25
+ const statePath = join(process.cwd(), '.buildflow', 'core', 'state.md')
26
+ const raw = readFileSync(statePath, 'utf8')
27
+ state = {
28
+ app: raw.match(/Project:\s*(.+)/)?.[1]?.trim() ?? '?',
29
+ type: raw.match(/Type:\s*(.+)/)?.[1]?.trim() ?? '?',
30
+ phase: raw.match(/Phase:\s*(.+)/)?.[1]?.trim() ?? '0',
31
+ }
32
+ } catch {}
33
+
34
+ console.log(chalk.green(' ✓ BuildFlow active') + chalk.dim(` — ${state.app} (${state.type})`))
35
+ console.log('')
36
+ console.log(chalk.bold(' Commands:'))
37
+ console.log('')
38
+
39
+ if (state.type?.includes('existing')) {
40
+ console.log(chalk.cyan(' /buildflow-onboard ') + chalk.dim(' Map your codebase (run once)'))
41
+ console.log(chalk.cyan(' /buildflow-modify ') + chalk.dim(' Change existing code safely'))
42
+ console.log(chalk.cyan(' /buildflow-refactor') + chalk.dim(' Improve existing code'))
43
+ } else {
44
+ console.log(chalk.cyan(' /buildflow-start ') + chalk.dim(' Begin your project'))
45
+ console.log(chalk.cyan(' /buildflow-think ') + chalk.dim(' Discuss & research'))
46
+ console.log(chalk.cyan(' /buildflow-plan ') + chalk.dim(' Create execution plan'))
47
+ }
48
+
49
+ console.log(chalk.cyan(' /buildflow-build ') + chalk.dim(' Execute the plan'))
50
+ console.log(chalk.cyan(' /buildflow-check ') + chalk.dim(' Verify quality'))
51
+ console.log(chalk.cyan(' /buildflow-ship ') + chalk.dim(' Finalize (runs security gate)'))
52
+ console.log(chalk.cyan(' /buildflow-audit ') + chalk.dim(' Run security audit'))
53
+ console.log(chalk.cyan(' /buildflow-status ') + chalk.dim(' Where am I?'))
54
+ console.log('')
55
+ console.log(chalk.dim(' CLI commands:'))
56
+ console.log(chalk.white(' buildflow status ') + chalk.dim(' Show project status'))
57
+ console.log(chalk.white(' buildflow audit ') + chalk.dim(' Run security audit from terminal'))
58
+ console.log(chalk.white(' buildflow update ') + chalk.dim(' Update BuildFlow commands'))
59
+ } else {
60
+ console.log(chalk.yellow(' Not initialized in this directory.\n'))
61
+ console.log(chalk.bold(' Get started:\n'))
62
+ console.log(
63
+ ' ' + chalk.bgCyan.black(' npx buildflow-dev init ') +
64
+ chalk.dim(' ← Set up BuildFlow + install slash commands')
65
+ )
66
+ console.log('')
67
+ console.log(chalk.dim(' What this does:'))
68
+ console.log(chalk.dim(' 1. Detects your project (framework, language, existing code)'))
69
+ console.log(chalk.dim(' 2. Sets up .buildflow/ with agents, memory, security rules'))
70
+ console.log(chalk.dim(' 3. Detects Claude Code, Gemini CLI, Codex CLI, Cursor, etc.'))
71
+ console.log(chalk.dim(' 4. Installs /buildflow-* slash commands into each detected tool'))
72
+ console.log(chalk.dim(' 5. Type "/" in your AI tool to start'))
73
+ console.log('')
74
+ console.log(chalk.bold(' Or install directly into a specific tool:\n'))
75
+ console.log(chalk.white(' buildflow install --tool claude'))
76
+ console.log(chalk.white(' buildflow install --tool gemini'))
77
+ console.log(chalk.white(' buildflow install --tool codex'))
78
+ console.log(chalk.white(' buildflow install --tool cursor'))
79
+ console.log(chalk.white(' buildflow install --tool all'))
80
+ }
81
+
82
+ console.log('')
83
+ }
@@ -0,0 +1,75 @@
1
+ # {{APP_NAME}} — Claude Code Configuration
2
+
3
+ This project uses **BuildFlow v3.0** for adaptive AI-powered development orchestration.
4
+
5
+ ## Quick Start
6
+
7
+ Type `/` in Claude Code to see available commands:
8
+
9
+ - `/buildflow-start` — begin or continue the project
10
+ - `/buildflow-onboard` — analyze existing codebase (run once for existing projects)
11
+ - `/buildflow-think` — research and discuss
12
+ - `/buildflow-plan` — create execution plan
13
+ - `/buildflow-build` — implement the plan
14
+ - `/buildflow-check` — verify quality
15
+ - `/buildflow-ship` — finalize with security gate
16
+ - `/buildflow-audit` — run security scan
17
+ - `/buildflow-status` — see where you are
18
+ - `/buildflow-help` — get help or recover from issues
19
+
20
+ ## Always Do at Session Start
21
+
22
+ 1. Read `.buildflow/memory/light.md` for project context
23
+ 2. Read `.buildflow/core/state.md` for current phase and status
24
+ 3. If onboarded: load `.buildflow/codebase/MAP.md`
25
+
26
+ ## Core Rules
27
+
28
+ - Ask confidence (1-5) before locking major decisions
29
+ - Show alternatives before making architectural choices
30
+ - Add `LEARN:` comments when introducing unfamiliar patterns
31
+ - Create git restore points before destructive operations
32
+ - Run `/buildflow-audit` before every `/buildflow-ship`
33
+ - Cite research sources with trust scores (1-5)
34
+ - Keep `.buildflow/memory/light.md` under 5K tokens
35
+
36
+ ## Agents
37
+
38
+ | Agent | Role |
39
+ |-------|------|
40
+ | Strategist | Vision, decisions, direction |
41
+ | Researcher | Parallel web research with sources |
42
+ | Synthesizer | Combines research findings |
43
+ | Architect | Dependency-aware planning |
44
+ | Builder | Code matching project style |
45
+ | Reviewer | Quality checks |
46
+ | Cartographer | Maps existing codebases |
47
+ | Surgeon | Precise modifications to existing code |
48
+ | Security Auditor | OWASP Top 10 scanning |
49
+
50
+ Each agent gets a **fresh context window** — no context rot.
51
+
52
+ ## Project Structure
53
+
54
+ ```
55
+ .buildflow/
56
+ ├── core/
57
+ │ ├── vision.md ← What we're building
58
+ │ └── state.md ← Current phase and status
59
+ ├── you/
60
+ │ └── preferences.md ← Experience level, style prefs
61
+ ├── memory/
62
+ │ └── light.md ← Persistent context (≤5K tokens)
63
+ ├── codebase/ ← Generated by /buildflow-onboard
64
+ │ ├── MAP.md
65
+ │ ├── PATTERNS.md
66
+ │ ├── DEPENDENCIES.md
67
+ │ └── HOTSPOTS.md
68
+ ├── security/
69
+ │ ├── DEBT.md
70
+ │ └── reports/
71
+ ├── phases/ ← Per-phase work and retros
72
+ └── learnings/
73
+ ├── glossary.md
74
+ └── decisions.md
75
+ ```
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: buildflow-audit
3
+ description: Comprehensive OWASP Top 10 security audit
4
+ allowed-tools: Read, Bash, Grep, Glob
5
+ agent: security-auditor
6
+ ---
7
+
8
+ # /buildflow-audit
9
+
10
+ Full security audit. The Security Auditor agent scans for OWASP Top 10 vulnerabilities.
11
+
12
+ ## Flags
13
+ - `--quick` : Only recently changed files (~15K tokens)
14
+ - `--target <path>` : Specific file or directory
15
+ - `--category <A01-A10>` : Single OWASP category
16
+ - `--pre-ship` : Lightweight secrets + critical patterns (~10K)
17
+
18
+ ## Phase 1: Secrets Scan
19
+ Search for:
20
+ - API keys (sk-, pk-, AKIA patterns)
21
+ - Hardcoded passwords/credentials
22
+ - Private keys (-----BEGIN)
23
+ - Database URLs with embedded credentials
24
+ - Env variables exposed to client (NEXT_PUBLIC_*SECRET etc.)
25
+
26
+ Skip: node_modules, test files, .env.example
27
+
28
+ ## Phase 2: OWASP Top 10
29
+
30
+ ### A01: Broken Access Control
31
+ - API routes without auth middleware
32
+ - Direct object references without ownership check
33
+ - Missing role verification on admin routes
34
+ - Overly permissive CORS (Access-Control-Allow-Origin: *)
35
+
36
+ ### A02: Cryptographic Failures
37
+ - Hardcoded secrets in source code
38
+ - Weak hashing (MD5, SHA1 for passwords)
39
+ - Sensitive data in localStorage or console.log
40
+ - Missing httpOnly/secure flags on cookies
41
+
42
+ ### A03: Injection
43
+ - SQL concatenation without parameterization
44
+ - eval() with user input
45
+ - exec()/spawn() with user-controlled values
46
+
47
+ ### A04: Insecure Design
48
+ - Login endpoints without rate limiting
49
+ - File uploads without type/size validation
50
+ - Missing CSRF protection
51
+
52
+ ### A05: Security Misconfiguration
53
+ - Missing security headers (CSP, HSTS, X-Frame-Options)
54
+ - Debug mode enabled
55
+ - Error handlers exposing stack traces
56
+
57
+ ### A06: Vulnerable Components
58
+ - npm audit findings (if package.json present)
59
+ - Known CVE packages
60
+
61
+ ### A07: Auth Failures
62
+ - Math.random() for tokens (not cryptographically secure)
63
+ - Session IDs in URLs
64
+ - Missing account lockout
65
+
66
+ ### A08: Data Integrity
67
+ - Missing package-lock.json / yarn.lock
68
+
69
+ ### A09: Security Logging
70
+ - No audit logging for auth failures
71
+ - PII in logs
72
+
73
+ ### A10: SSRF
74
+ - Server-side URL fetching with user-controlled URLs
75
+
76
+ ## Phase 3: Generate Report
77
+
78
+ Write to `.buildflow/security/reports/audit-[date].md`:
79
+
80
+ ```
81
+ # Security Audit Report
82
+
83
+ ## Summary
84
+ 🔴 Critical: X 🟡 High: Y 🟠 Medium: Z 🔵 Low: N
85
+
86
+ Ship Recommendation: [Safe / Fix Critical First / Do Not Ship]
87
+
88
+ ## Critical Findings
89
+ ### [C1] [Issue] - [file:line]
90
+ OWASP: [category]
91
+ Risk: [what could happen]
92
+ Fix: [concrete code change]
93
+
94
+ ## [Other severities...]
95
+
96
+ ## Positive Practices Found
97
+ [What's done well]
98
+
99
+ ## Dependencies
100
+ [CVE status]
101
+ ```
102
+
103
+ ## Phase 4: Update Memory
104
+ ```yaml
105
+ last_audit_date: [today]
106
+ critical_findings: X
107
+ ship_safe: true/false
108
+ ```
109
+
110
+ ## Severity Definitions
111
+ - 🔴 Critical: Direct path to breach, fix immediately
112
+ - 🟡 High: Significant risk, fix this week
113
+ - 🟠 Medium: Moderate risk, fix this sprint
114
+ - 🔵 Low: Minor, fix when nearby
115
+
116
+ ## Token Budget
117
+ - Full audit: ~30-40K
118
+ - Quick audit: ~15K
119
+ - Pre-ship: ~10K
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: buildflow-back
3
+ description: Undo recent changes and restore to a safe state
4
+ allowed-tools: Read, Write, Bash
5
+ agent: strategist
6
+ ---
7
+
8
+ # /buildflow-back
9
+
10
+ Undo recent changes and restore to a known-good state.
11
+
12
+ ## Usage
13
+ - `/buildflow-back` — undo last action
14
+ - `/buildflow-back 3` — undo last 3 actions
15
+ - `/buildflow-back --list` — show available restore points
16
+ - `/buildflow-back phase-1-complete` — restore to named checkpoint
17
+
18
+ ## Step 1: List Restore Points
19
+
20
+ Check available options in order:
21
+ 1. Git commits (most reliable)
22
+ 2. Named BuildFlow checkpoints in `.buildflow/phases/`
23
+ 3. Git stash entries
24
+
25
+ Show numbered list with timestamps and descriptions.
26
+
27
+ ## Step 2: Confirm Intent
28
+ Ask: "Which restore point do you want to go back to?"
29
+ Show what will be LOST if they go back.
30
+
31
+ ## Step 3: Safety Check
32
+ If there are uncommitted changes:
33
+ ```
34
+ ⚠️ You have uncommitted changes.
35
+ These will be lost: [list files]
36
+ Type "yes, discard changes" to continue.
37
+ ```
38
+
39
+ ## Step 4: Restore
40
+
41
+ For git restore:
42
+ ```bash
43
+ git reset --hard [commit-hash]
44
+ ```
45
+
46
+ For named checkpoint:
47
+ ```bash
48
+ git checkout [checkpoint-tag]
49
+ ```
50
+
51
+ ## Step 5: Update State
52
+ Update `.buildflow/core/state.md` to reflect restored phase.
53
+ Update `.buildflow/memory/light.md` to match.
54
+
55
+ ## Step 6: Confirm
56
+ Show: "Restored to: [checkpoint name] from [date]"
57
+ Suggest next action: "Run /buildflow-status to see current state."
58
+
59
+ ## Token Budget: ~3K
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: buildflow-build
3
+ description: Execute the plan with parallel Builder agents
4
+ allowed-tools: Read, Write, Bash
5
+ agents: builder, reviewer
6
+ ---
7
+
8
+ # /buildflow-build
9
+
10
+ Execute the current phase plan. Spawns parallel Builder agents per wave, then Reviewer checks quality.
11
+
12
+ ## Usage
13
+ - `/buildflow-build` — execute current phase plan
14
+ - `/buildflow-build wave-2` — execute a specific wave
15
+ - `/buildflow-build <task>` — build a single task
16
+
17
+ ## Step 1: Load Plan
18
+ Read `.buildflow/phases/[N]/PLAN.md`.
19
+ Load `.buildflow/memory/light.md` for style preferences.
20
+ If existing project: load `.buildflow/codebase/PATTERNS.md`.
21
+
22
+ ## Step 2: Style Fingerprint
23
+ Before writing code, confirm:
24
+ - Naming conventions (camelCase, PascalCase, snake_case)
25
+ - Import organization
26
+ - Error handling style
27
+ - Comment style
28
+ - Test file location and naming
29
+
30
+ ## Step 3: Execute Wave 1
31
+ Spawn Builder agents in parallel for Wave 1 tasks.
32
+ Each Builder agent:
33
+ - Gets the task spec and relevant context files
34
+ - Writes code matching detected style
35
+ - Adds LEARN: comments for non-obvious patterns
36
+ - Reports back: files created/modified, decisions made
37
+
38
+ ## Step 4: Review Wave 1
39
+ Reviewer agent checks each output:
40
+ - Does it meet the task spec?
41
+ - Does it match the codebase style?
42
+ - Any security concerns?
43
+ - Tests present if needed?
44
+
45
+ ## Step 5: Continue Waves
46
+ Repeat for Wave 2, Wave 3, etc.
47
+ Each wave waits for the previous to complete and pass review.
48
+
49
+ ## Step 6: Integration Check
50
+ After all waves: verify the pieces connect correctly.
51
+ Run existing tests if available.
52
+
53
+ ## Step 7: Update Memory
54
+ ```yaml
55
+ last_build_date: [today]
56
+ phase: [N]
57
+ tasks_completed: [list]
58
+ files_changed: [list]
59
+ ```
60
+
61
+ ## Token Budget: ~50K per wave (parallel)
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: buildflow-check
3
+ description: Verify quality with parallel Reviewer agents
4
+ allowed-tools: Read, Bash, Grep, Glob
5
+ agent: reviewer
6
+ ---
7
+
8
+ # /buildflow-check
9
+
10
+ Quality verification. Parallel Reviewers check code against acceptance criteria.
11
+
12
+ ## Usage
13
+ - `/buildflow-check` — check current phase
14
+ - `/buildflow-check <file>` — check a specific file
15
+ - `/buildflow-check tests` — verify test coverage
16
+ - `/buildflow-check acceptance` — verify acceptance criteria only
17
+
18
+ ## Step 1: Load Acceptance Criteria
19
+ Read `.buildflow/phases/[N]/PLAN.md` for definition of done.
20
+
21
+ ## Step 2: Parallel Review (3 reviewers)
22
+
23
+ **Reviewer A — Correctness:**
24
+ - Does the code do what was specified?
25
+ - Are edge cases handled?
26
+ - Are there logical errors?
27
+
28
+ **Reviewer B — Quality:**
29
+ - Is the code readable?
30
+ - Are there unnecessary duplications?
31
+ - Does it match `.buildflow/codebase/PATTERNS.md`?
32
+ - Are functions appropriately sized?
33
+
34
+ **Reviewer C — Security:**
35
+ - No hardcoded secrets?
36
+ - No obvious injection risks?
37
+ - No sensitive data in logs?
38
+ - Dependencies up to date?
39
+
40
+ ## Step 3: Test Check
41
+ - Do existing tests pass?
42
+ - Are new tests written for new code?
43
+ - Is critical logic tested?
44
+
45
+ ## Step 4: Synthesize Findings
46
+
47
+ Report format:
48
+ ```
49
+ ✓ PASS — criterion
50
+ ⚠ WARN — issue (non-blocking)
51
+ ✗ FAIL — issue (must fix before /buildflow-ship)
52
+ ```
53
+
54
+ ## Step 5: Confidence Check
55
+ Ask: "How confident are you in this code? (1-5)"
56
+
57
+ ## Step 6: Next Steps
58
+ - All pass: "Ready for /buildflow-ship"
59
+ - Warnings: "Warnings noted. Run /buildflow-ship or fix first."
60
+ - Failures: "Fix these issues, then re-run /buildflow-check"
61
+
62
+ ## Token Budget: ~20K
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: buildflow-explain
3
+ description: Explain code, concepts, or terms in plain language
4
+ allowed-tools: Read, WebSearch
5
+ agent: strategist
6
+ ---
7
+
8
+ # /buildflow-explain
9
+
10
+ Plain-language explanations for code, concepts, jargon, or files.
11
+
12
+ ## Usage
13
+ - `/buildflow-explain src/auth/middleware.ts`
14
+ - `/buildflow-explain JWT`
15
+ - `/buildflow-explain "What does this error mean: ECONNREFUSED"`
16
+ - `/buildflow-explain "How does the payment flow work?"`
17
+
18
+ ## Step 1: Detect Type
19
+ What is being explained?
20
+ - **File/Code**: Read the file, explain what it does and why
21
+ - **Term/Concept**: Define it in context of this project
22
+ - **Error**: Diagnose the error and suggest fixes
23
+ - **Flow**: Trace the data/control flow end-to-end
24
+
25
+ ## Step 2: Adapt to Experience Level
26
+ Read `.buildflow/you/preferences.md` for experience level.
27
+ - Junior: Use analogies, avoid jargon, explain the why
28
+ - Senior: Be concise, assume fundamentals, focus on nuance
29
+ - Unknown: Start at an intermediate level
30
+
31
+ ## Step 3: Explain
32
+
33
+ **For files:**
34
+ 1. Purpose — what problem does this solve?
35
+ 2. How it works — key logic in plain English
36
+ 3. How it connects — what calls this, what does it call?
37
+ 4. Gotchas — anything non-obvious to watch out for
38
+
39
+ **For concepts/terms:**
40
+ 1. One-sentence definition
41
+ 2. How it applies to THIS project
42
+ 3. Example in context
43
+ 4. Further reading (if helpful)
44
+
45
+ **For errors:**
46
+ 1. What the error means
47
+ 2. Most likely cause in this codebase
48
+ 3. How to fix it
49
+
50
+ ## Step 4: Add to Glossary
51
+ If explaining a new term, append to `.buildflow/learnings/glossary.md`.
52
+
53
+ ## Token Budget: ~2K
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: buildflow-help
3
+ description: Diagnostic help and recovery guide
4
+ allowed-tools: Read, Bash
5
+ agent: strategist
6
+ ---
7
+
8
+ # /buildflow-help
9
+
10
+ Diagnostic mode. Use when stuck, confused, or when something isn't working.
11
+
12
+ ## Usage
13
+ - `/buildflow-help` — general help and orientation
14
+ - `/buildflow-help stuck` — help getting unstuck
15
+ - `/buildflow-help reset` — reset BuildFlow state
16
+ - `/buildflow-help <error message>` — diagnose a specific error
17
+
18
+ ## Step 1: Load Current State
19
+ Read `.buildflow/core/state.md` and `.buildflow/memory/light.md`.
20
+ Check if `.buildflow/` exists and is properly structured.
21
+
22
+ ## Step 2: Diagnose
23
+
24
+ **If .buildflow/ is missing:**
25
+ "BuildFlow isn't initialized here. Run: `npx buildflow-dev init`"
26
+
27
+ **If state.md is corrupted:**
28
+ Re-detect project and recreate state.md from scratch.
29
+
30
+ **If stuck in a phase:**
31
+ Show what the current phase plan says and where progress stopped.
32
+ Suggest: continue from last completed task, or start over.
33
+
34
+ **If error message provided:**
35
+ Analyze the error:
36
+ - Is it a BuildFlow config issue?
37
+ - Is it a project code issue?
38
+ - Is it an AI tool integration issue?
39
+
40
+ ## Step 3: Recovery Options
41
+
42
+ Based on the situation, offer:
43
+ 1. **Continue** — pick up where you left off
44
+ 2. **Re-run** — redo the last command from scratch
45
+ 3. **Skip** — skip the problematic step with a note
46
+ 4. **Reset phase** — restart current phase from the beginning
47
+ 5. **Full reset** — clear `.buildflow/` and start fresh (asks for confirmation)
48
+
49
+ ## Step 4: All Commands Reference
50
+
51
+ ### Workflow (greenfield)
52
+ - `/buildflow-start` — begin project
53
+ - `/buildflow-think [topic]` — research and discuss
54
+ - `/buildflow-plan [phase]` — create execution plan
55
+ - `/buildflow-build [wave]` — execute the plan
56
+ - `/buildflow-check` — verify quality
57
+ - `/buildflow-ship` — finalize with security gate
58
+
59
+ ### Existing codebase
60
+ - `/buildflow-onboard` — map codebase (one-time)
61
+ - `/buildflow-modify "description"` — surgical code change
62
+ - `/buildflow-refactor [scope]` — improve code quality
63
+
64
+ ### Security
65
+ - `/buildflow-audit` — full OWASP scan
66
+ - `/buildflow-audit --quick` — recent changes only
67
+ - `/buildflow-audit --pre-ship` — lightweight pre-ship check
68
+
69
+ ### Utility
70
+ - `/buildflow-status` — where am I?
71
+ - `/buildflow-explain <term/file>` — get explanation
72
+ - `/buildflow-back [n]` — undo recent changes
73
+ - `/buildflow-help` — this command
74
+
75
+ ### CLI (terminal)
76
+ ```
77
+ buildflow init
78
+ buildflow install [--tool <name>]
79
+ buildflow audit [--quick] [--target <path>]
80
+ buildflow status [--verbose]
81
+ buildflow update [--check]
82
+ ```
83
+
84
+ ## Token Budget: ~15K (full diagnostic)
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: buildflow-modify
3
+ description: Safely modify existing code with the Surgeon agent
4
+ allowed-tools: Read, Write, Grep, Glob, Bash
5
+ agent: surgeon
6
+ ---
7
+
8
+ # /buildflow-modify
9
+
10
+ Make precise, safe changes to existing code. The Surgeon agent minimizes blast radius.
11
+
12
+ ## Usage
13
+ - `/buildflow-modify "Add dark mode toggle to settings page"`
14
+ - `/buildflow-modify src/auth/login.ts "Add rate limiting"`
15
+ - `/buildflow-modify --dry-run "Rename getUserById to fetchUserById"`
16
+
17
+ ## Step 1: Load Codebase Context
18
+ Read `.buildflow/codebase/MAP.md` and `PATTERNS.md`.
19
+ If not onboarded: "Run /buildflow-onboard first."
20
+
21
+ ## Step 2: Understand the Change
22
+ Ask:
23
+ 1. What exactly needs to change?
24
+ 2. What should NOT change (blast radius constraints)?
25
+ 3. Are there tests that must keep passing?
26
+ 4. Confidence in understanding the request (1-5)?
27
+
28
+ ## Step 3: Impact Analysis
29
+ Before touching any code:
30
+ - List all files that will be modified
31
+ - List all files that call or import changed code
32
+ - Identify test files that cover this area
33
+ - Flag any security-sensitive areas
34
+
35
+ Show impact summary and ask for confirmation.
36
+
37
+ ## Step 4: Create Restore Point
38
+ ```bash
39
+ git stash # or commit current state
40
+ # Log: "restore point before /buildflow-modify: [description]"
41
+ ```
42
+
43
+ ## Step 5: Surgical Modification
44
+ Make changes with minimum footprint:
45
+ - Change only what is necessary
46
+ - Match existing code style exactly (from PATTERNS.md)
47
+ - Add LEARN: comments for non-obvious changes
48
+ - Do NOT refactor unrelated code
49
+
50
+ ## Step 6: Verify
51
+ - Run existing tests
52
+ - Check that unchanged code still works
53
+ - Diff review: does it match the spec?
54
+
55
+ ## Step 7: Update Memory
56
+ ```yaml
57
+ last_modify: [today]
58
+ change: [brief description]
59
+ files_changed: [list]
60
+ ```
61
+
62
+ ## --dry-run Flag
63
+ Shows what WOULD change without modifying files.
64
+
65
+ ## Token Budget: ~30K