agent-bober 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/.claude-plugin/plugin.json +9 -0
- package/LICENSE +21 -0
- package/README.md +495 -0
- package/agents/bober-evaluator.md +323 -0
- package/agents/bober-generator.md +245 -0
- package/agents/bober-planner.md +248 -0
- package/dist/cli/commands/eval.d.ts +6 -0
- package/dist/cli/commands/eval.d.ts.map +1 -0
- package/dist/cli/commands/eval.js +129 -0
- package/dist/cli/commands/eval.js.map +1 -0
- package/dist/cli/commands/init.d.ts +5 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +547 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +5 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +87 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/run.d.ts +5 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +120 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/sprint.d.ts +6 -0
- package/dist/cli/commands/sprint.d.ts.map +1 -0
- package/dist/cli/commands/sprint.js +206 -0
- package/dist/cli/commands/sprint.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +124 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/defaults.d.ts +15 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +226 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +18 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +189 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +904 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +181 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/contracts/eval-result.d.ts +205 -0
- package/dist/contracts/eval-result.d.ts.map +1 -0
- package/dist/contracts/eval-result.js +87 -0
- package/dist/contracts/eval-result.js.map +1 -0
- package/dist/contracts/index.d.ts +4 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +16 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/spec.d.ts +101 -0
- package/dist/contracts/spec.d.ts.map +1 -0
- package/dist/contracts/spec.js +51 -0
- package/dist/contracts/spec.js.map +1 -0
- package/dist/contracts/sprint-contract.d.ts +141 -0
- package/dist/contracts/sprint-contract.d.ts.map +1 -0
- package/dist/contracts/sprint-contract.js +80 -0
- package/dist/contracts/sprint-contract.js.map +1 -0
- package/dist/evaluators/builtin/api-check.d.ts +13 -0
- package/dist/evaluators/builtin/api-check.d.ts.map +1 -0
- package/dist/evaluators/builtin/api-check.js +152 -0
- package/dist/evaluators/builtin/api-check.js.map +1 -0
- package/dist/evaluators/builtin/build-check.d.ts +17 -0
- package/dist/evaluators/builtin/build-check.d.ts.map +1 -0
- package/dist/evaluators/builtin/build-check.js +155 -0
- package/dist/evaluators/builtin/build-check.js.map +1 -0
- package/dist/evaluators/builtin/command-runner.d.ts +26 -0
- package/dist/evaluators/builtin/command-runner.d.ts.map +1 -0
- package/dist/evaluators/builtin/command-runner.js +114 -0
- package/dist/evaluators/builtin/command-runner.js.map +1 -0
- package/dist/evaluators/builtin/lint.d.ts +17 -0
- package/dist/evaluators/builtin/lint.d.ts.map +1 -0
- package/dist/evaluators/builtin/lint.js +264 -0
- package/dist/evaluators/builtin/lint.js.map +1 -0
- package/dist/evaluators/builtin/playwright.d.ts +16 -0
- package/dist/evaluators/builtin/playwright.d.ts.map +1 -0
- package/dist/evaluators/builtin/playwright.js +238 -0
- package/dist/evaluators/builtin/playwright.js.map +1 -0
- package/dist/evaluators/builtin/typescript-check.d.ts +12 -0
- package/dist/evaluators/builtin/typescript-check.d.ts.map +1 -0
- package/dist/evaluators/builtin/typescript-check.js +155 -0
- package/dist/evaluators/builtin/typescript-check.js.map +1 -0
- package/dist/evaluators/builtin/unit-test.d.ts +18 -0
- package/dist/evaluators/builtin/unit-test.d.ts.map +1 -0
- package/dist/evaluators/builtin/unit-test.js +279 -0
- package/dist/evaluators/builtin/unit-test.js.map +1 -0
- package/dist/evaluators/index.d.ts +11 -0
- package/dist/evaluators/index.d.ts.map +1 -0
- package/dist/evaluators/index.js +13 -0
- package/dist/evaluators/index.js.map +1 -0
- package/dist/evaluators/plugin-interface.d.ts +50 -0
- package/dist/evaluators/plugin-interface.d.ts.map +1 -0
- package/dist/evaluators/plugin-interface.js +2 -0
- package/dist/evaluators/plugin-interface.js.map +1 -0
- package/dist/evaluators/plugin-loader.d.ts +18 -0
- package/dist/evaluators/plugin-loader.d.ts.map +1 -0
- package/dist/evaluators/plugin-loader.js +107 -0
- package/dist/evaluators/plugin-loader.js.map +1 -0
- package/dist/evaluators/registry.d.ts +78 -0
- package/dist/evaluators/registry.d.ts.map +1 -0
- package/dist/evaluators/registry.js +238 -0
- package/dist/evaluators/registry.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator/context-handoff.d.ts +543 -0
- package/dist/orchestrator/context-handoff.d.ts.map +1 -0
- package/dist/orchestrator/context-handoff.js +133 -0
- package/dist/orchestrator/context-handoff.js.map +1 -0
- package/dist/orchestrator/evaluator-agent.d.ts +15 -0
- package/dist/orchestrator/evaluator-agent.d.ts.map +1 -0
- package/dist/orchestrator/evaluator-agent.js +233 -0
- package/dist/orchestrator/evaluator-agent.js.map +1 -0
- package/dist/orchestrator/generator-agent.d.ts +16 -0
- package/dist/orchestrator/generator-agent.d.ts.map +1 -0
- package/dist/orchestrator/generator-agent.js +147 -0
- package/dist/orchestrator/generator-agent.js.map +1 -0
- package/dist/orchestrator/pipeline.d.ts +24 -0
- package/dist/orchestrator/pipeline.d.ts.map +1 -0
- package/dist/orchestrator/pipeline.js +290 -0
- package/dist/orchestrator/pipeline.js.map +1 -0
- package/dist/orchestrator/planner-agent.d.ts +10 -0
- package/dist/orchestrator/planner-agent.d.ts.map +1 -0
- package/dist/orchestrator/planner-agent.js +187 -0
- package/dist/orchestrator/planner-agent.js.map +1 -0
- package/dist/state/helpers.d.ts +5 -0
- package/dist/state/helpers.d.ts.map +1 -0
- package/dist/state/helpers.js +8 -0
- package/dist/state/helpers.js.map +1 -0
- package/dist/state/history.d.ts +39 -0
- package/dist/state/history.d.ts.map +1 -0
- package/dist/state/history.js +162 -0
- package/dist/state/history.js.map +1 -0
- package/dist/state/index.d.ts +8 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +22 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/plan-state.d.ts +21 -0
- package/dist/state/plan-state.d.ts.map +1 -0
- package/dist/state/plan-state.js +108 -0
- package/dist/state/plan-state.js.map +1 -0
- package/dist/state/sprint-state.d.ts +20 -0
- package/dist/state/sprint-state.d.ts.map +1 -0
- package/dist/state/sprint-state.js +98 -0
- package/dist/state/sprint-state.js.map +1 -0
- package/dist/utils/fs.d.ts +31 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +67 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/git.d.ts +35 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +84 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +45 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +73 -0
- package/dist/utils/logger.js.map +1 -0
- package/hooks/hooks.json +10 -0
- package/package.json +67 -0
- package/scripts/detect-stack.sh +287 -0
- package/scripts/init-project.sh +206 -0
- package/scripts/run-eval.sh +175 -0
- package/skills/bober.anchor/SKILL.md +365 -0
- package/skills/bober.anchor/references/anchor-guide.md +567 -0
- package/skills/bober.brownfield/SKILL.md +422 -0
- package/skills/bober.brownfield/references/codebase-analysis.md +304 -0
- package/skills/bober.eval/SKILL.md +235 -0
- package/skills/bober.eval/references/eval-strategies.md +407 -0
- package/skills/bober.eval/references/feedback-format.md +182 -0
- package/skills/bober.plan/SKILL.md +244 -0
- package/skills/bober.plan/references/clarification-guide.md +124 -0
- package/skills/bober.plan/references/spec-schema.md +253 -0
- package/skills/bober.react/SKILL.md +330 -0
- package/skills/bober.react/references/react-scaffold.md +344 -0
- package/skills/bober.run/SKILL.md +303 -0
- package/skills/bober.solidity/SKILL.md +416 -0
- package/skills/bober.solidity/references/solidity-guide.md +487 -0
- package/skills/bober.sprint/SKILL.md +280 -0
- package/skills/bober.sprint/references/contract-schema.md +251 -0
- package/templates/base/CLAUDE.md +20 -0
- package/templates/base/bober.config.json +35 -0
- package/templates/brownfield/CLAUDE.md +34 -0
- package/templates/brownfield/bober.config.json +37 -0
- package/templates/presets/anchor/CLAUDE.md +163 -0
- package/templates/presets/anchor/bober.config.json +9 -0
- package/templates/presets/api-node/CLAUDE.md +153 -0
- package/templates/presets/api-node/bober.config.json +10 -0
- package/templates/presets/nextjs/CLAUDE.md +82 -0
- package/templates/presets/nextjs/bober.config.json +14 -0
- package/templates/presets/python-api/CLAUDE.md +202 -0
- package/templates/presets/python-api/bober.config.json +9 -0
- package/templates/presets/react-vite/CLAUDE.md +71 -0
- package/templates/presets/react-vite/bober.config.json +53 -0
- package/templates/presets/react-vite/scaffold/package.json +45 -0
- package/templates/presets/react-vite/scaffold/server/index.ts +38 -0
- package/templates/presets/react-vite/scaffold/server/tsconfig.json +24 -0
- package/templates/presets/react-vite/scaffold/src/App.tsx +37 -0
- package/templates/presets/react-vite/scaffold/src/index.html +12 -0
- package/templates/presets/react-vite/scaffold/src/main.tsx +12 -0
- package/templates/presets/react-vite/scaffold/tsconfig.json +27 -0
- package/templates/presets/react-vite/scaffold/vite.config.ts +34 -0
- package/templates/presets/solidity/CLAUDE.md +106 -0
- package/templates/presets/solidity/bober.config.json +9 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bober.brownfield
|
|
3
|
+
description: Safely add features to an existing codebase — deep analysis first, conservative sprints, regression-focused evaluation.
|
|
4
|
+
argument-hint: <feature-description>
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# bober.brownfield — Existing Codebase Workflow
|
|
8
|
+
|
|
9
|
+
You are running the **bober.brownfield** skill. This is a specialized workflow for adding features to existing, established codebases. It prioritizes safety: deep analysis before any changes, conservative sprint sizing, mandatory regression testing, and rollback strategies.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
Use `bober.brownfield` instead of `bober.run` when:
|
|
14
|
+
- The codebase is established with existing features, tests, and users
|
|
15
|
+
- You need to modify existing code, not just add new files
|
|
16
|
+
- Regression risk is a primary concern
|
|
17
|
+
- The codebase has patterns and conventions that must be followed exactly
|
|
18
|
+
- There is an existing test suite that must continue passing
|
|
19
|
+
|
|
20
|
+
## Key Differences from Standard Pipeline
|
|
21
|
+
|
|
22
|
+
| Aspect | Standard (`bober.run`) | Brownfield (`bober.brownfield`) |
|
|
23
|
+
|--------|----------------------|-------------------------------|
|
|
24
|
+
| Sprint size | Medium (1-3 hours) | Small (30-60 minutes) |
|
|
25
|
+
| Approval | Optional | Required by default |
|
|
26
|
+
| Regression testing | Basic | Comprehensive |
|
|
27
|
+
| Codebase analysis | Brief | Deep (full architecture map) |
|
|
28
|
+
| Rollback strategy | None | Per-sprint rollback plan |
|
|
29
|
+
| Test requirements | Write new tests | Write new tests AND verify existing tests |
|
|
30
|
+
| Pattern following | Suggested | Mandatory (strict adherence) |
|
|
31
|
+
|
|
32
|
+
## Step 1: Deep Codebase Analysis
|
|
33
|
+
|
|
34
|
+
Before planning anything, perform a thorough analysis of the existing codebase. This is the most important step in brownfield work -- skip it and you will break things.
|
|
35
|
+
|
|
36
|
+
### 1a. Tech Stack Detection
|
|
37
|
+
|
|
38
|
+
Read and analyze:
|
|
39
|
+
- `package.json` (or equivalent: `requirements.txt`, `Cargo.toml`, `go.mod`)
|
|
40
|
+
- All config files: `tsconfig.json`, `vite.config.ts`, `next.config.js`, `webpack.config.js`, `.babelrc`, etc.
|
|
41
|
+
- CI/CD configuration: `.github/workflows/`, `Jenkinsfile`, `.gitlab-ci.yml`
|
|
42
|
+
- Docker configuration: `Dockerfile`, `docker-compose.yml`
|
|
43
|
+
- Environment files: `.env.example`, `.env.local.example`
|
|
44
|
+
|
|
45
|
+
Produce a tech stack summary:
|
|
46
|
+
```
|
|
47
|
+
Language: TypeScript 5.x
|
|
48
|
+
Frontend: React 18, Vite, React Router v6
|
|
49
|
+
Backend: Express.js
|
|
50
|
+
Database: PostgreSQL via Prisma
|
|
51
|
+
Styling: Tailwind CSS + shadcn/ui
|
|
52
|
+
Testing: Vitest (unit), Playwright (E2E)
|
|
53
|
+
CI/CD: GitHub Actions
|
|
54
|
+
Deployment: Vercel (frontend), Railway (backend)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 1b. Architecture Mapping
|
|
58
|
+
|
|
59
|
+
Use Glob and Grep to map the architecture. Reference `skills/bober.brownfield/references/codebase-analysis.md` for the full methodology.
|
|
60
|
+
|
|
61
|
+
**Directory structure analysis:**
|
|
62
|
+
- Use Glob to survey: `src/**/*`, `app/**/*`, `server/**/*`, `lib/**/*`
|
|
63
|
+
- Identify the organizational pattern: feature-based, layer-based, or hybrid
|
|
64
|
+
- Map the key directories and their purposes
|
|
65
|
+
|
|
66
|
+
**Route/endpoint mapping:**
|
|
67
|
+
- Use Grep to find all route definitions
|
|
68
|
+
- List every API endpoint with its HTTP method and handler location
|
|
69
|
+
- List every frontend route with its component
|
|
70
|
+
|
|
71
|
+
**Database schema mapping:**
|
|
72
|
+
- Read the ORM schema file (Prisma schema, Drizzle schema, etc.)
|
|
73
|
+
- List all models/tables and their relationships
|
|
74
|
+
- Note any recent migrations
|
|
75
|
+
|
|
76
|
+
**Component inventory (for React/frontend):**
|
|
77
|
+
- List all page-level components
|
|
78
|
+
- List shared/reusable components
|
|
79
|
+
- Identify the state management pattern
|
|
80
|
+
- Map data flow (how do components get data?)
|
|
81
|
+
|
|
82
|
+
**Test coverage mapping:**
|
|
83
|
+
- Count total test files and test cases
|
|
84
|
+
- Identify which modules have tests and which do not
|
|
85
|
+
- Note the test patterns used (unit, integration, E2E)
|
|
86
|
+
- Run the test suite and record the baseline results:
|
|
87
|
+
```bash
|
|
88
|
+
npm test 2>&1 | tail -20
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 1c. Pattern Extraction
|
|
92
|
+
|
|
93
|
+
Identify the coding patterns used throughout the codebase. The Generator MUST follow these exactly.
|
|
94
|
+
|
|
95
|
+
**Patterns to extract:**
|
|
96
|
+
- **File naming:** kebab-case, camelCase, PascalCase? What convention for components, hooks, utils?
|
|
97
|
+
- **Export style:** Default exports or named exports? Barrel files (index.ts)?
|
|
98
|
+
- **Component pattern:** Function components with arrow functions or function declarations? Props destructured in params or separate?
|
|
99
|
+
- **State management:** How is state managed? Context, Zustand, Redux, TanStack Query?
|
|
100
|
+
- **API calls:** fetch, axios, custom wrapper? Where do API calls live (in components, hooks, services)?
|
|
101
|
+
- **Error handling:** How are errors handled? Try/catch, error boundaries, toast notifications?
|
|
102
|
+
- **Styling approach:** Tailwind classes inline, CSS modules, styled-components? Is there a design system?
|
|
103
|
+
- **Test pattern:** Arrange-Act-Assert? What test utilities are used? How are mocks set up?
|
|
104
|
+
|
|
105
|
+
Document these patterns explicitly in the Generator notes for each sprint contract.
|
|
106
|
+
|
|
107
|
+
### 1d. Risk Assessment
|
|
108
|
+
|
|
109
|
+
Identify areas of risk:
|
|
110
|
+
- **High-coupling areas:** Files imported by many other files -- changing these is high risk
|
|
111
|
+
- **No-test areas:** Code without tests -- changes here cannot be regression-tested
|
|
112
|
+
- **Recently changed areas:** Files with recent git activity might be in flux
|
|
113
|
+
- **Complex areas:** Files with high cyclomatic complexity
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Find the most imported files (high coupling)
|
|
117
|
+
grep -r "from './" src/ --include="*.ts" --include="*.tsx" | sed "s/.*from '//;s/'.*//" | sort | uniq -c | sort -rn | head -20
|
|
118
|
+
|
|
119
|
+
# Find files without corresponding test files
|
|
120
|
+
find src -name "*.ts" -not -name "*.test.ts" -not -name "*.d.ts" | while read f; do
|
|
121
|
+
test_file="${f%.ts}.test.ts"
|
|
122
|
+
[ ! -f "$test_file" ] && echo "NO TEST: $f"
|
|
123
|
+
done
|
|
124
|
+
|
|
125
|
+
# Find recently modified files
|
|
126
|
+
git log --name-only --since="2 weeks ago" --pretty=format: | sort | uniq -c | sort -rn | head -20
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Step 2: Initialize Configuration
|
|
130
|
+
|
|
131
|
+
Create `bober.config.json` with brownfield-specific defaults:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"project": {
|
|
136
|
+
"name": "<detected from package.json>",
|
|
137
|
+
"mode": "brownfield",
|
|
138
|
+
"description": "<inferred from README or package.json>"
|
|
139
|
+
},
|
|
140
|
+
"planner": {
|
|
141
|
+
"maxClarifications": 5,
|
|
142
|
+
"model": "opus",
|
|
143
|
+
"contextFiles": ["<detected key files>"]
|
|
144
|
+
},
|
|
145
|
+
"generator": {
|
|
146
|
+
"model": "sonnet",
|
|
147
|
+
"maxTurnsPerSprint": 50,
|
|
148
|
+
"autoCommit": true,
|
|
149
|
+
"branchPattern": "bober/{feature-name}"
|
|
150
|
+
},
|
|
151
|
+
"evaluator": {
|
|
152
|
+
"model": "sonnet",
|
|
153
|
+
"strategies": [
|
|
154
|
+
{ "type": "typecheck", "required": true },
|
|
155
|
+
{ "type": "lint", "required": true },
|
|
156
|
+
{ "type": "unit-test", "required": true },
|
|
157
|
+
{ "type": "build", "required": true }
|
|
158
|
+
],
|
|
159
|
+
"maxIterations": 3
|
|
160
|
+
},
|
|
161
|
+
"sprint": {
|
|
162
|
+
"maxSprints": 10,
|
|
163
|
+
"requireContracts": true,
|
|
164
|
+
"sprintSize": "small"
|
|
165
|
+
},
|
|
166
|
+
"pipeline": {
|
|
167
|
+
"maxIterations": 20,
|
|
168
|
+
"requireApproval": true,
|
|
169
|
+
"contextReset": "always"
|
|
170
|
+
},
|
|
171
|
+
"commands": {
|
|
172
|
+
"install": "<detected>",
|
|
173
|
+
"build": "<detected>",
|
|
174
|
+
"test": "<detected>",
|
|
175
|
+
"lint": "<detected>",
|
|
176
|
+
"typecheck": "<detected>",
|
|
177
|
+
"dev": "<detected>"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Key brownfield defaults:**
|
|
183
|
+
- `sprint.sprintSize: "small"` — Smaller sprints mean less risk per change
|
|
184
|
+
- `pipeline.requireApproval: true` — Human reviews each sprint before proceeding
|
|
185
|
+
- `unit-test` strategy is `required: true` — Existing tests must keep passing
|
|
186
|
+
|
|
187
|
+
## Step 3: Establish Baselines
|
|
188
|
+
|
|
189
|
+
Before any changes, record baselines that the evaluator will check against:
|
|
190
|
+
|
|
191
|
+
1. **Test baseline:**
|
|
192
|
+
```bash
|
|
193
|
+
npm test 2>&1 > .bober/baseline-test-output.txt
|
|
194
|
+
```
|
|
195
|
+
Count total tests, passed, failed, skipped.
|
|
196
|
+
|
|
197
|
+
2. **Type check baseline:**
|
|
198
|
+
```bash
|
|
199
|
+
npx tsc --noEmit 2>&1 > .bober/baseline-typecheck-output.txt
|
|
200
|
+
```
|
|
201
|
+
Record number of existing type errors (if any).
|
|
202
|
+
|
|
203
|
+
3. **Lint baseline:**
|
|
204
|
+
```bash
|
|
205
|
+
npm run lint 2>&1 > .bober/baseline-lint-output.txt
|
|
206
|
+
```
|
|
207
|
+
Record number of existing lint errors/warnings.
|
|
208
|
+
|
|
209
|
+
4. **Build baseline:**
|
|
210
|
+
```bash
|
|
211
|
+
npm run build 2>&1 > .bober/baseline-build-output.txt
|
|
212
|
+
```
|
|
213
|
+
Verify the build passes.
|
|
214
|
+
|
|
215
|
+
5. **Save baseline summary to `.bober/baseline.json`:**
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"timestamp": "<ISO-8601>",
|
|
219
|
+
"commit": "<current git commit hash>",
|
|
220
|
+
"tests": {
|
|
221
|
+
"total": 47,
|
|
222
|
+
"passed": 45,
|
|
223
|
+
"failed": 2,
|
|
224
|
+
"skipped": 0
|
|
225
|
+
},
|
|
226
|
+
"typeErrors": 0,
|
|
227
|
+
"lintErrors": 3,
|
|
228
|
+
"lintWarnings": 12,
|
|
229
|
+
"buildPasses": true
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The evaluator will compare post-sprint results against these baselines to detect regressions.
|
|
234
|
+
|
|
235
|
+
## Step 4: Plan with Brownfield Constraints
|
|
236
|
+
|
|
237
|
+
Run the planning workflow with these additional constraints:
|
|
238
|
+
|
|
239
|
+
### Brownfield-Specific Clarifying Questions
|
|
240
|
+
|
|
241
|
+
Add these to the standard clarifying questions:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
**Q: Modification Scope**
|
|
245
|
+
A) Only add new files -- do not modify existing code
|
|
246
|
+
B) Modify existing files minimally (add new routes, extend schemas)
|
|
247
|
+
C) Refactor existing code to accommodate the new feature
|
|
248
|
+
D) Full integration requiring significant changes to existing code
|
|
249
|
+
|
|
250
|
+
> Based on the codebase analysis, I recommend [X] because [reason].
|
|
251
|
+
|
|
252
|
+
**Q: Regression Tolerance**
|
|
253
|
+
A) Zero tolerance -- all existing tests must pass, no new warnings
|
|
254
|
+
B) Moderate -- existing tests must pass, minor warnings acceptable
|
|
255
|
+
C) Flexible -- focus on the new feature working correctly
|
|
256
|
+
|
|
257
|
+
**Q: Rollback Requirements**
|
|
258
|
+
A) Each sprint should be independently revertable (atomic changes)
|
|
259
|
+
B) The full feature should be revertable as a unit
|
|
260
|
+
C) No specific rollback requirements
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Brownfield Sprint Decomposition Rules
|
|
264
|
+
|
|
265
|
+
1. **Smaller sprints.** Default to `small` size (30-60 minutes, 1-3 files). Larger sprints in brownfield codebases have exponentially higher regression risk.
|
|
266
|
+
|
|
267
|
+
2. **Interface-first sprints.** When adding a new feature that touches existing code, the first sprint should define the interfaces (types, API contracts, database schema changes) without changing existing behavior. This is the one exception to the "no setup-only sprints" rule.
|
|
268
|
+
|
|
269
|
+
3. **One existing file per sprint.** If multiple existing files need modification, split into separate sprints. Each sprint should modify at most one critical existing file.
|
|
270
|
+
|
|
271
|
+
4. **Test-first sprints.** For complex changes, consider a sprint that writes tests for the EXPECTED new behavior before implementing it. This gives the evaluator a concrete check.
|
|
272
|
+
|
|
273
|
+
5. **Rollback plan per sprint.** Each contract must include a `rollbackPlan` field:
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"rollbackPlan": "Revert commits on branch bober/feature. No database migration to reverse. No configuration changes to undo."
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Brownfield-Specific Success Criteria
|
|
281
|
+
|
|
282
|
+
Every brownfield sprint MUST include these baseline criteria:
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
[
|
|
286
|
+
{
|
|
287
|
+
"criterionId": "sc-N-baseline-build",
|
|
288
|
+
"description": "The project builds without any new errors compared to baseline.",
|
|
289
|
+
"verificationMethod": "build",
|
|
290
|
+
"required": true
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"criterionId": "sc-N-baseline-types",
|
|
294
|
+
"description": "TypeScript compilation has no new type errors compared to baseline.",
|
|
295
|
+
"verificationMethod": "typecheck",
|
|
296
|
+
"required": true
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"criterionId": "sc-N-baseline-tests",
|
|
300
|
+
"description": "All pre-existing tests that passed at baseline still pass.",
|
|
301
|
+
"verificationMethod": "unit-test",
|
|
302
|
+
"required": true
|
|
303
|
+
}
|
|
304
|
+
]
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
These are IN ADDITION to the sprint-specific criteria.
|
|
308
|
+
|
|
309
|
+
### Generator Notes Enhancement
|
|
310
|
+
|
|
311
|
+
Every brownfield contract's `generatorNotes` must include:
|
|
312
|
+
1. Specific files to read before making changes (the "pattern files")
|
|
313
|
+
2. Explicit naming conventions to follow
|
|
314
|
+
3. Import patterns used in the codebase
|
|
315
|
+
4. Warning about files NOT to modify
|
|
316
|
+
5. The exact git diff of any existing file modifications expected
|
|
317
|
+
|
|
318
|
+
## Step 5: Execute with Caution
|
|
319
|
+
|
|
320
|
+
Run the sprint loop with brownfield-specific enhancements:
|
|
321
|
+
|
|
322
|
+
### Pre-Sprint Verification
|
|
323
|
+
|
|
324
|
+
Before EVERY sprint:
|
|
325
|
+
1. Verify the baseline still holds (tests pass, build works)
|
|
326
|
+
2. If baseline is broken, STOP and report to the user -- do not start a sprint on a broken codebase
|
|
327
|
+
3. Create a git checkpoint:
|
|
328
|
+
```bash
|
|
329
|
+
git stash # if there are uncommitted changes
|
|
330
|
+
git tag bober-checkpoint-sprint-<N>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Approval Gate
|
|
334
|
+
|
|
335
|
+
After each sprint passes evaluation, BEFORE moving to the next sprint:
|
|
336
|
+
|
|
337
|
+
```
|
|
338
|
+
Sprint <N> PASSED evaluation.
|
|
339
|
+
|
|
340
|
+
### Changes Made:
|
|
341
|
+
<file list with brief descriptions>
|
|
342
|
+
|
|
343
|
+
### Test Results:
|
|
344
|
+
- Existing tests: <X>/<Y> still passing (baseline: <Y>/<Y>)
|
|
345
|
+
- New tests added: <Z>
|
|
346
|
+
|
|
347
|
+
### Review Request:
|
|
348
|
+
Please review the changes and confirm:
|
|
349
|
+
A) Approve -- continue to next sprint
|
|
350
|
+
B) Review code first -- I'll wait
|
|
351
|
+
C) Rollback -- revert this sprint's changes
|
|
352
|
+
D) Stop -- halt the pipeline
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Wait for user confirmation before proceeding.
|
|
356
|
+
|
|
357
|
+
### Evaluator Enhancement
|
|
358
|
+
|
|
359
|
+
The brownfield evaluator additionally checks:
|
|
360
|
+
1. **Baseline comparison:** Compare test count, type errors, lint errors against `.bober/baseline.json`. Any regression is a failure.
|
|
361
|
+
2. **Changed file audit:** Every file modified must be justified by the contract's `estimatedFiles`. Unexpected modifications are flagged as warnings.
|
|
362
|
+
3. **Pattern compliance:** Spot-check that new code follows the patterns documented in the generator notes.
|
|
363
|
+
4. **Import impact:** Check if any changes affect widely-imported modules. Flag as high-risk if so.
|
|
364
|
+
|
|
365
|
+
## Step 6: Post-Pipeline Verification
|
|
366
|
+
|
|
367
|
+
After all sprints complete:
|
|
368
|
+
|
|
369
|
+
1. **Full regression suite:**
|
|
370
|
+
```bash
|
|
371
|
+
npm test
|
|
372
|
+
npm run build
|
|
373
|
+
npx tsc --noEmit
|
|
374
|
+
npm run lint
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
2. **Baseline comparison:**
|
|
378
|
+
Compare every metric against `.bober/baseline.json`. Report any regressions.
|
|
379
|
+
|
|
380
|
+
3. **Git diff review:**
|
|
381
|
+
```bash
|
|
382
|
+
git diff main...HEAD --stat
|
|
383
|
+
```
|
|
384
|
+
Show the user the complete set of changes.
|
|
385
|
+
|
|
386
|
+
4. **Report:**
|
|
387
|
+
```
|
|
388
|
+
## Brownfield Integration Complete
|
|
389
|
+
|
|
390
|
+
### Baseline Comparison
|
|
391
|
+
| Metric | Before | After | Status |
|
|
392
|
+
|--------|--------|-------|--------|
|
|
393
|
+
| Tests passing | 45/47 | 52/54 | OK (+7 new) |
|
|
394
|
+
| Type errors | 0 | 0 | OK |
|
|
395
|
+
| Lint errors | 3 | 3 | OK (no new) |
|
|
396
|
+
| Build | pass | pass | OK |
|
|
397
|
+
|
|
398
|
+
### Changes Summary
|
|
399
|
+
- Files created: <N>
|
|
400
|
+
- Files modified: <M>
|
|
401
|
+
- Total lines added: <A>
|
|
402
|
+
- Total lines removed: <R>
|
|
403
|
+
|
|
404
|
+
### Modified Existing Files
|
|
405
|
+
<list with brief description of changes to each>
|
|
406
|
+
|
|
407
|
+
### Rollback Instructions
|
|
408
|
+
To revert all changes:
|
|
409
|
+
git checkout main
|
|
410
|
+
git branch -D bober/<feature-slug>
|
|
411
|
+
|
|
412
|
+
To revert individual sprints:
|
|
413
|
+
git revert <commit-hash> # Sprint N
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
## Error Handling
|
|
417
|
+
|
|
418
|
+
- **Baseline broken before start:** Do NOT proceed. Tell the user the codebase has pre-existing failures and they should fix them first.
|
|
419
|
+
- **Regression detected during sprint:** Immediately fail the sprint. The evaluator should clearly identify which existing behavior broke.
|
|
420
|
+
- **Pattern violation by Generator:** Fail the sprint with specific feedback about which pattern was violated and what the correct pattern is. Include a code example from the existing codebase.
|
|
421
|
+
- **Merge conflicts:** If the feature branch has conflicts with main, report to the user. Never auto-resolve in brownfield.
|
|
422
|
+
- **Database migration conflicts:** If a schema change conflicts with existing migrations, report the conflict. The user may need to resolve this manually.
|