Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .claude/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Run the main orchestration command:
```

This will:

1. Initialize the checkpoint system
2. Launch specialized agents to analyze the codebase
3. Track progress across sessions
Expand All @@ -48,6 +49,7 @@ This will:
### Resume from Checkpoint

If a session was interrupted, simply run `/modernize-brownfield` again. The orchestrator will:

1. Read the existing checkpoint
2. Identify incomplete phases
3. Resume from where it left off
Expand Down
7 changes: 7 additions & 0 deletions .claude/agents/architecture-analyzer.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 1 for detail
**Process**:

1. **Generate Initial Inventory**:

```bash
# Count TypeScript/JavaScript files
find . -name "*.ts" -o -name "*.js" | grep -v node_modules | grep -v dist | wc -l
Expand All @@ -33,11 +34,13 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 1 for detail
```

2. **Verification Questions**:

- Are there any dynamic imports not captured?
- Do file counts match directory traversal?
- Are build/generated files excluded?

3. **Verification Execution**:

```bash
# Check for dynamic imports
grep -r "import(" src/ --include="*.ts"
Expand All @@ -59,6 +62,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 1 for detail
**Process**:

1. **Analyze Imports**:

```bash
# Find all import statements
grep -rn "^import\|from.*import" src/ --include="*.ts"
Expand All @@ -68,6 +72,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 1 for detail
```

2. **Identify Hidden Dependencies**:

- Runtime dependencies via dynamic imports
- Peer dependencies not in package.json
- Build-time dependencies
Expand All @@ -82,6 +87,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 1 for detail
**Process**:

1. **Identify Potential Issues**:

```bash
# Check for hardcoded secrets patterns
grep -rn "password\|secret\|api_key\|apikey\|token" src/ --include="*.ts" -i
Expand Down Expand Up @@ -124,6 +130,7 @@ Update the checkpoint file with your findings:
## Chain-of-Verification Checklist

Before marking complete, verify:

- [ ] File counts match actual directory contents
- [ ] All imports are captured in dependency graph
- [ ] Dynamic imports are flagged
Expand Down
42 changes: 28 additions & 14 deletions .claude/agents/documentation-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 7 for detail
**Process**:

1. **Directory Audit**:

```bash
# Find all directories in src
find src -type d
Expand All @@ -35,21 +36,24 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 7 for detail

2. **For Each Directory**:
a. List actual contents:
```bash
ls -la src/directory/
```

```bash
ls -la src/directory/
```

b. Analyze file purposes by reading them:
```bash
head -50 src/directory/file.ts
```

```bash
head -50 src/directory/file.ts
```

c. Generate README with:
- Directory purpose
- File descriptions
- Usage examples
- Dependencies
- Testing instructions

- Directory purpose
- File descriptions
- Usage examples
- Dependencies
- Testing instructions

3. **Validation Loop**:
- Verify all files are documented
Expand All @@ -66,12 +70,15 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 7 for detail
a. Read the file content
b. Identify exports and their purposes
c. Find where the file is imported:
```bash
grep -rn "from.*filename\|import.*filename" src/
```

```bash
grep -rn "from.*filename\|import.*filename" src/
```

d. Document based on actual usage, not assumptions

2. **Cross-Validation**:

```bash
# Verify documented exports exist
grep -n "export" src/file.ts
Expand All @@ -87,6 +94,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 7 for detail
**Process**:

1. **Audit Navigation**:

- Every directory should have a README.md
- README should be visible in GitHub UI
- Links between docs should work
Expand All @@ -101,12 +109,14 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 7 for detail
For every documentation claim, verify:

1. **Function/Class Claims**:

```bash
# Verify the function exists
grep -n "function functionName\|class ClassName" src/
```

2. **Parameter Claims**:

```bash
# Check actual function signature
grep -A5 "function functionName" src/file.ts
Expand All @@ -123,15 +133,18 @@ For every documentation claim, verify:
When documentation doesn't match code:

1. **Identify Discrepancy**:

- Documented: "Function takes 2 parameters"
- Actual: Function takes 3 parameters

2. **Determine Source of Truth**:

- Check git history for recent changes
- Verify against tests
- Read actual implementation

3. **Correct Documentation**:

- Update to match actual code
- Add note if behavior is unexpected

Expand Down Expand Up @@ -172,6 +185,7 @@ Update the checkpoint file:
## Documentation Checklist

Before marking complete, verify:

- [ ] Every src/ subdirectory has README.md
- [ ] All documented functions exist in code
- [ ] All documented parameters match actual signatures
Expand Down
34 changes: 24 additions & 10 deletions .claude/agents/modernization-planner.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 4 for detail
**Process**:

1. **Analyze Current State**:

```bash
# Check package.json for current versions
cat package.json | grep -E '"node"|"typescript"|dependencies' -A 20
Expand All @@ -33,11 +34,13 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 4 for detail
```

2. **Generate Initial Task List** based on findings from other agents:

- Architecture analysis findings
- Validation gate results
- Documentation gaps

3. **Validate Dependencies**:

```bash
# Check if dependencies are compatible
npm outdated 2>/dev/null || yarn outdated 2>/dev/null
Expand All @@ -59,22 +62,26 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 4 for detail

1. **For Each Major Change**:
a. Check git history for similar changes:
```bash
git log --all --oneline --grep="upgrade\|migration\|refactor" | head -20
```

```bash
git log --all --oneline --grep="upgrade\|migration\|refactor" | head -20
```

b. Check how many files depend on the component:
```bash
grep -rn "import.*ComponentName" src/ | wc -l
```

```bash
grep -rn "import.*ComponentName" src/ | wc -l
```

c. Check test coverage for the component:
```bash
# Look at test files
find . -name "*.test.ts" | xargs grep "ComponentName" | wc -l
```

```bash
# Look at test files
find . -name "*.test.ts" | xargs grep "ComponentName" | wc -l
```

2. **Risk Factors to Consider**:

- Number of dependents (more = higher risk)
- Test coverage (lower = higher risk)
- Historical issues (check git for reverts, fixes)
Expand All @@ -92,13 +99,16 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 4 for detail
**Process**:

1. **For Each Task**:

- What can be reverted via git?
- What requires manual intervention?
- What has external dependencies (DB migrations, API changes)?

2. **Document Rollback Steps**:

```markdown
## Rollback Procedure for Task X

1. git revert <commit-hash>
2. npm install (restore dependencies)
3. Verify tests pass
Expand All @@ -110,13 +120,15 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 4 for detail
Before finalizing the plan:

1. **Dependency Order Verification**:

```bash
# For each dependency claim, verify
# "Task A depends on package X" -> check package.json
cat package.json | grep "package-x"
```

2. **Risk Level Verification**:

- Verify dependent counts are accurate
- Verify coverage claims against test files
- Check git history for cited incidents
Expand Down Expand Up @@ -164,6 +176,7 @@ Update the checkpoint file:
## Planning Checklist

Before marking complete, verify:

- [ ] All tasks have clear acceptance criteria
- [ ] Dependencies are in correct order (verified)
- [ ] Risk levels backed by evidence
Expand All @@ -175,6 +188,7 @@ Before marking complete, verify:
## Output Document

Create `docs/MODERNIZATION-PLAN.md` with:

1. Executive summary
2. Task list with dependencies (visual diagram if helpful)
3. Risk assessment with evidence
Expand Down
8 changes: 8 additions & 0 deletions .claude/agents/validation-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 2 for detail
**Process**:

1. **Audit Current Configuration**:

```bash
# Check existing TypeScript config
cat tsconfig.json
Expand All @@ -30,6 +31,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 2 for detail
```

2. **Document Type Coverage**:

- Count files with proper type annotations
- Identify files with `any` types
- Note strict mode settings
Expand All @@ -48,6 +50,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 2 for detail
**Process**:

1. **Audit Current Linting**:

```bash
# Check ESLint configuration
cat .eslintrc.cjs 2>/dev/null || cat .eslintrc.json 2>/dev/null || cat .eslintrc 2>/dev/null
Expand All @@ -57,6 +60,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 2 for detail
```

2. **Identify Linting Gaps**:

- Rules that should be enabled
- Files excluded from linting
- Custom rules needed for project
Expand All @@ -74,6 +78,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 2 for detail
**Process**:

1. **Audit Test Infrastructure**:

```bash
# Check test configuration
cat jest.config.ts 2>/dev/null || cat jest.config.js 2>/dev/null
Expand All @@ -83,6 +88,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 2 for detail
```

2. **Run Test Suite**:

```bash
# Execute tests with coverage
npm test 2>&1 | tail -50
Expand All @@ -98,6 +104,7 @@ Read `docs/AI-ASSISTED-BROWNFIELD-MODERNIZATION-CHECKLIST.md` Phase 2 for detail
When validation gates fail:

1. **Record the Failure**:

```json
{
"gate": "type-check",
Expand Down Expand Up @@ -158,6 +165,7 @@ Update the checkpoint file with validation results:
## Validation Gate Checklist

Before marking complete, verify:

- [ ] Type checker runs without configuration errors
- [ ] Linter runs and produces parseable output
- [ ] Test suite executes (even if tests fail)
Expand Down
Loading
Loading