|
| 1 | +# Repository Consolidation Report - @claude-dev-toolkit Focus |
| 2 | + |
| 3 | +## Executive Summary |
| 4 | + |
| 5 | +This report analyzes the current repository structure and identifies consolidation opportunities now that the primary solution is the `@claude-dev-toolkit/` npm package. The analysis reveals significant duplication across directories and opportunities to streamline the codebase by **~40% reduction in files** while maintaining all functionality within the npm package structure. |
| 6 | + |
| 7 | +## Current State Analysis |
| 8 | + |
| 9 | +### Repository Structure Overview |
| 10 | +``` |
| 11 | +claude-code/ |
| 12 | +├── claude-dev-toolkit/ # 🎯 Primary NPM Package (KEEP) |
| 13 | +├── slash-commands/ # ❌ DUPLICATE of claude-dev-toolkit/commands/ |
| 14 | +├── hooks/ # ❌ DUPLICATE of claude-dev-toolkit/hooks/ |
| 15 | +├── subagents/ # ❌ DUPLICATE of claude-dev-toolkit/subagents/ |
| 16 | +├── templates/ # ❌ DUPLICATE of claude-dev-toolkit/templates/ |
| 17 | +├── docs/ # 🔄 PARTIALLY CONSOLIDATE |
| 18 | +├── specs/ # 🔄 PARTIALLY CONSOLIDATE |
| 19 | +├── scripts/ # 🔍 REVIEW for obsolescence |
| 20 | +├── tests/ # 🔄 CONSOLIDATE with npm package tests |
| 21 | +└── [various build artifacts] # ❌ DELETE |
| 22 | +``` |
| 23 | + |
| 24 | +## Critical Duplications Identified |
| 25 | + |
| 26 | +| Root Directory | NPM Package Equivalent | Files Count | Status | Action | |
| 27 | +|---|---|---|---|---| |
| 28 | +| `/slash-commands/active/` | `/claude-dev-toolkit/commands/active/` | 13 files | Identical | **REMOVE ROOT** | |
| 29 | +| `/slash-commands/experiments/` | `/claude-dev-toolkit/commands/experiments/` | 44 files | Identical | **REMOVE ROOT** | |
| 30 | +| `/hooks/` + `/hooks/lib/` | `/claude-dev-toolkit/hooks/` + lib/ | 15 files | Identical | **REMOVE ROOT** | |
| 31 | +| `/subagents/` | `/claude-dev-toolkit/subagents/` | 25 files | Identical | **REMOVE ROOT** | |
| 32 | +| `/templates/` | `/claude-dev-toolkit/templates/` | 8 files | Similar | **MERGE → NPM** | |
| 33 | + |
| 34 | +**Impact**: Removing duplicates eliminates **105+ duplicate files** |
| 35 | + |
| 36 | +## Backup & Legacy Directories |
| 37 | + |
| 38 | +### Within NPM Package |
| 39 | +```bash |
| 40 | +claude-dev-toolkit/ |
| 41 | +├── commands.backup/ # ❌ DELETE (57 files) - Legacy backup |
| 42 | +├── hooks.backup/ # ❌ DELETE (3 files) - Legacy backup |
| 43 | +├── templates.backup/ # ❌ DELETE (4 files) - Legacy backup |
| 44 | +└── paulduvall-*-alpha.*.tgz # ❌ DELETE (2 files) - Build artifacts |
| 45 | +``` |
| 46 | + |
| 47 | +### Root Level Legacy |
| 48 | +```bash |
| 49 | +├── test-results/ # ❌ DELETE (~40 files) - Build artifacts |
| 50 | +├── ubuntu-test-results.zip # ❌ DELETE - Build artifact |
| 51 | +├── dependencies.txt # 🔍 REVIEW - May be obsolete |
| 52 | +└── test-suite.json # 🔍 REVIEW - Check if needed by npm package |
| 53 | +``` |
| 54 | + |
| 55 | +**Impact**: Removing legacy files eliminates **106+ obsolete files** |
| 56 | + |
| 57 | +## Documentation Consolidation Strategy |
| 58 | + |
| 59 | +### NPM-Specific Documentation (Move to Package) |
| 60 | +| Current Location | Target Location | Rationale | |
| 61 | +|---|---|---| |
| 62 | +| `/docs/npm-only/` (4 files) | `/claude-dev-toolkit/docs/` | NPM package documentation | |
| 63 | +| `/docs/npm-package-guide.md` | `/claude-dev-toolkit/docs/` | Package-specific guide | |
| 64 | +| `/specs/claude-dev-toolkit-*` | `/claude-dev-toolkit/specs/` | Package specifications | |
| 65 | + |
| 66 | +### Migration Documentation (Archive) |
| 67 | +| Current Location | Action | Rationale | |
| 68 | +|---|---|---| |
| 69 | +| `/docs/npm-consolidation/` | Archive in `/docs/archive/` | Historical migration docs | |
| 70 | +| `/docs/plans/npm-consolidation-*` | Archive in `/docs/archive/` | Completed migration plans | |
| 71 | + |
| 72 | +### Keep at Root Level |
| 73 | +- `/docs/claude-custom-commands.md` - General command documentation |
| 74 | +- `/docs/claude-code-hooks-system.md` - System architecture |
| 75 | +- `/docs/subagent-hook-integration.md` - Integration guide |
| 76 | +- `/specs/ears-format.md` - General specification standard |
| 77 | + |
| 78 | +## Scripts Analysis & Recommendations |
| 79 | + |
| 80 | +### Potentially Obsolete Scripts |
| 81 | +```bash |
| 82 | +/scripts/ |
| 83 | +├── deploy-subagents.sh # 🔍 REVIEW - May be superseded by npm CLI |
| 84 | +├── setup-github-actions-iam.py # 🔍 REVIEW - Conflicts with xoidc command? |
| 85 | +├── setup-npm-ssm.sh # ❌ DELETE - Obsolete with npm package |
| 86 | +├── xact.sh # ❌ DELETE - Superseded by xact.md command |
| 87 | +└── testing/test-debug-subagent.py # 🔄 CONSOLIDATE with npm test suite |
| 88 | +``` |
| 89 | + |
| 90 | +## Test Infrastructure Consolidation |
| 91 | + |
| 92 | +### Current Test Structure Issues |
| 93 | +- **Duplicate test logic**: Root `/tests/` vs `/claude-dev-toolkit/tests/` |
| 94 | +- **Scattered results**: Multiple test-results directories |
| 95 | +- **Mixed frameworks**: Different test approaches |
| 96 | + |
| 97 | +### Recommended Consolidation |
| 98 | +1. **Primary test suite**: `/claude-dev-toolkit/tests/` (Keep - 25 comprehensive test files) |
| 99 | +2. **Root test utilities**: Move useful utilities from `/tests/` to npm package |
| 100 | +3. **Archive legacy results**: Keep latest reports only |
| 101 | + |
| 102 | +## Template & Configuration Consolidation |
| 103 | + |
| 104 | +### Template Files Analysis |
| 105 | +```bash |
| 106 | +# Root Level (8 files) |
| 107 | +/templates/ |
| 108 | +├── basic-settings.json # 🔄 MERGE with npm package version |
| 109 | +├── comprehensive-settings.json # 🔄 MERGE with npm package version |
| 110 | +├── security-focused-settings.json # 🔄 MERGE with npm package version |
| 111 | +├── hybrid-hook-config.yaml # ❌ DELETE - Obsolete with toolkit |
| 112 | +├── subagent-hooks.yaml # 🔄 MOVE to npm package |
| 113 | +└── *-OLD.json # ❌ DELETE - Legacy versions |
| 114 | + |
| 115 | +# NPM Package (7 files) |
| 116 | +/claude-dev-toolkit/templates/ |
| 117 | +├── basic-settings.json # 🎯 AUTHORITATIVE VERSION |
| 118 | +├── comprehensive-settings.json # 🎯 AUTHORITATIVE VERSION |
| 119 | +├── security-focused-settings.json # 🎯 AUTHORITATIVE VERSION |
| 120 | +├── hybrid-hook-config.yaml # Keep (needed for migration) |
| 121 | +└── subagent-hooks.yaml # Keep (needed for integration) |
| 122 | +``` |
| 123 | + |
| 124 | +## Implementation Phases |
| 125 | + |
| 126 | +### 🚀 Phase 1: Quick Wins (Low Risk, High Impact) |
| 127 | +**Estimated Impact: 150+ files removed** |
| 128 | + |
| 129 | +1. **Delete backup directories**: |
| 130 | + ```bash |
| 131 | + rm -rf claude-dev-toolkit/commands.backup/ |
| 132 | + rm -rf claude-dev-toolkit/hooks.backup/ |
| 133 | + rm -rf claude-dev-toolkit/templates.backup/ |
| 134 | + ``` |
| 135 | + |
| 136 | +2. **Remove build artifacts**: |
| 137 | + ```bash |
| 138 | + rm claude-dev-toolkit/*.tgz |
| 139 | + rm claude-dev-toolkit/test-output.log |
| 140 | + rm -rf test-results/ |
| 141 | + rm ubuntu-test-results.zip |
| 142 | + ``` |
| 143 | + |
| 144 | +3. **Delete obsolete scripts**: |
| 145 | + ```bash |
| 146 | + rm scripts/setup-npm-ssm.sh |
| 147 | + rm scripts/xact.sh |
| 148 | + ``` |
| 149 | + |
| 150 | +### 🔄 Phase 2: Directory Consolidation (Medium Risk, High Impact) |
| 151 | +**Estimated Impact: 100+ duplicate files removed** |
| 152 | + |
| 153 | +1. **Remove duplicate command directories** (after confirming npm package completeness): |
| 154 | + ```bash |
| 155 | + rm -rf slash-commands/ |
| 156 | + ``` |
| 157 | + |
| 158 | +2. **Remove duplicate infrastructure** (verify npm package has all functionality): |
| 159 | + ```bash |
| 160 | + rm -rf hooks/ |
| 161 | + rm -rf subagents/ |
| 162 | + ``` |
| 163 | + |
| 164 | +3. **Consolidate templates** (merge any unique content first): |
| 165 | + ```bash |
| 166 | + # After merging unique content to npm package |
| 167 | + rm -rf templates/ |
| 168 | + ``` |
| 169 | + |
| 170 | +### 📚 Phase 3: Documentation Restructure (Low Risk, Medium Impact) |
| 171 | +**Estimated Impact: Better organization, clearer structure** |
| 172 | + |
| 173 | +1. **Move NPM-specific documentation**: |
| 174 | + ```bash |
| 175 | + mv docs/npm-only/* claude-dev-toolkit/docs/ |
| 176 | + mv docs/npm-package-guide.md claude-dev-toolkit/docs/ |
| 177 | + mv specs/claude-dev-toolkit-* claude-dev-toolkit/specs/ |
| 178 | + ``` |
| 179 | + |
| 180 | +2. **Archive migration documentation**: |
| 181 | + ```bash |
| 182 | + mkdir docs/archive/ |
| 183 | + mv docs/npm-consolidation/ docs/archive/ |
| 184 | + mv docs/plans/npm-consolidation-* docs/archive/ |
| 185 | + ``` |
| 186 | + |
| 187 | +### 🧪 Phase 4: Test Consolidation (Medium Risk, Medium Impact) |
| 188 | +**Estimated Impact: Simplified test infrastructure** |
| 189 | + |
| 190 | +1. **Audit root test utilities** for useful components |
| 191 | +2. **Migrate valuable test code** to npm package test suite |
| 192 | +3. **Update CI/CD workflows** to focus on npm package testing |
| 193 | +4. **Remove redundant test infrastructure** |
| 194 | + |
| 195 | +## Risk Assessment & Mitigation |
| 196 | + |
| 197 | +### Low Risk (Safe to Execute) |
| 198 | +- ✅ **Backup directories**: Confirmed duplicates of current active directories |
| 199 | +- ✅ **Build artifacts**: Temporary files that can be regenerated |
| 200 | +- ✅ **Legacy scripts**: Superseded by npm package functionality |
| 201 | + |
| 202 | +### Medium Risk (Requires Validation) |
| 203 | +- ⚠️ **Root command directories**: Verify npm package has identical content |
| 204 | +- ⚠️ **Templates**: Ensure no unique configurations lost in merge |
| 205 | +- ⚠️ **Test utilities**: Check for unique test logic before removal |
| 206 | + |
| 207 | +### High Risk (Requires Careful Planning) |
| 208 | +- 🚨 **CI/CD workflow updates**: May require GitHub Actions modifications |
| 209 | +- 🚨 **External references**: Documentation or scripts referencing old paths |
| 210 | +- 🚨 **User migration**: Active users may have references to old structure |
| 211 | + |
| 212 | +## Success Metrics |
| 213 | + |
| 214 | +### File Reduction Targets |
| 215 | +- **Total files removed**: 250+ files (~40% of repository) |
| 216 | +- **Directory consolidation**: 8 major duplicate directories eliminated |
| 217 | +- **Storage reduction**: Estimated 50-70% size reduction |
| 218 | + |
| 219 | +### Quality Improvements |
| 220 | +- **Single source of truth**: NPM package becomes authoritative |
| 221 | +- **Simplified maintenance**: No duplicate file management needed |
| 222 | +- **Clearer project structure**: Obvious entry point for new contributors |
| 223 | +- **Improved npm package completeness**: Self-contained solution |
| 224 | + |
| 225 | +## Validation Checklist |
| 226 | + |
| 227 | +Before executing consolidation: |
| 228 | + |
| 229 | +### ✅ Pre-Execution Validation |
| 230 | +- [ ] Verify npm package contains all functionality from root directories |
| 231 | +- [ ] Check CI/CD workflows don't reference removed paths |
| 232 | +- [ ] Confirm documentation references are updated |
| 233 | +- [ ] Test npm package installation from clean environment |
| 234 | +- [ ] Backup repository state (git tag for rollback) |
| 235 | + |
| 236 | +### ✅ Post-Execution Validation |
| 237 | +- [ ] Run complete npm package test suite |
| 238 | +- [ ] Verify all npm scripts function correctly |
| 239 | +- [ ] Test package installation and setup workflows |
| 240 | +- [ ] Validate documentation accuracy |
| 241 | +- [ ] Check for broken internal links |
| 242 | + |
| 243 | +## Next Steps |
| 244 | + |
| 245 | +1. **Create consolidation branch**: `git checkout -b consolidation/npm-focus` |
| 246 | +2. **Execute Phase 1** (quick wins) and validate |
| 247 | +3. **Execute Phase 2** (duplicates) with careful validation |
| 248 | +4. **Execute Phase 3** (documentation) with link updates |
| 249 | +5. **Execute Phase 4** (tests) with CI/CD updates |
| 250 | +6. **Full integration testing** before merging to main |
| 251 | +7. **Update README.md** to reflect new simplified structure |
| 252 | + |
| 253 | +## Conclusion |
| 254 | + |
| 255 | +This consolidation will transform the repository from a complex multi-approach solution into a clean, focused npm package distribution. The `@claude-dev-toolkit/` package already contains all necessary functionality, making the root-level duplicates purely redundant. |
| 256 | + |
| 257 | +**Expected outcome**: A streamlined repository with the npm package as the clear, authoritative solution while preserving all functionality and improving maintainability. |
| 258 | + |
| 259 | +--- |
| 260 | + |
| 261 | +*Report generated: 2025-08-27* |
| 262 | +*Repository state: Post-hybrid architecture cleanup* |
| 263 | +*Focus: NPM package (@claude-dev-toolkit) consolidation* |
0 commit comments