|
| 1 | +# Project Folder Restructure & Organization |
| 2 | + |
| 3 | +**Status**: 📅 Planned |
| 4 | +**Created**: 2025-11-01 |
| 5 | +**Spec**: `20251101/001-project-folder-restructure` |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +Comprehensive restructuring of the devlog monorepo to address critical gaps in testing (2% coverage), code quality (no ESLint), and organization. The plan creates a more maintainable structure with proper separation of concerns, comprehensive testing infrastructure, and improved developer experience. |
| 10 | + |
| 11 | +This spec includes the Go collector package (`packages/collector-go`) which needs proper integration into the monorepo tooling. |
| 12 | + |
| 13 | +## Objectives |
| 14 | + |
| 15 | +1. **Establish Testing Infrastructure** - Achieve 50-70% test coverage with proper tooling |
| 16 | +2. **Add Code Quality Tooling** - ESLint, pre-commit hooks, CI/CD quality gates |
| 17 | +3. **Refactor Package Structure** - Extract shared types, separate auth, organize by domain |
| 18 | +4. **Reorganize Web App** - Feature-based organization with clear component hierarchy |
| 19 | +5. **Integrate Go Collector** - Proper monorepo integration for Go package |
| 20 | + |
| 21 | +### Key Problems Addressed |
| 22 | + |
| 23 | +- **Testing Crisis**: Only 4 test files for 212 TypeScript files (~2% coverage) |
| 24 | +- **No ESLint**: No linting enforcement, 20+ console.log statements in production |
| 25 | +- **Package Organization**: Core overloaded, no shared types, unclear boundaries |
| 26 | +- **Web App Structure**: Flat hierarchy, mixed concerns, no feature organization |
| 27 | +- **Go Collector Isolation**: Not integrated into monorepo tooling |
| 28 | + |
| 29 | +## Design |
| 30 | + |
| 31 | +See **[design.md](./design.md)** for complete technical design including: |
| 32 | + |
| 33 | +- Detailed proposed structure for all packages |
| 34 | +- New packages: `shared`, `auth`, and `tools/*` |
| 35 | +- Refactored `core` and `web` app structure |
| 36 | +- Go collector monorepo integration |
| 37 | +- Migration strategy with 5 phases |
| 38 | +- Risk assessment and mitigation |
| 39 | + |
| 40 | +## Implementation Plan |
| 41 | + |
| 42 | +See **[implementation.md](./implementation.md)** for detailed task breakdown with: |
| 43 | + |
| 44 | +- **Phase 1**: Foundation (Week 1) - Tooling, new packages, ESLint |
| 45 | +- **Phase 2**: Core Refactoring (Week 2) - Extract auth, refactor core |
| 46 | +- **Phase 3**: Web App Restructure (Week 3) - Components, routes, organization |
| 47 | +- **Phase 4**: Testing & Quality (Week 4) - Tests, coverage, CI/CD |
| 48 | +- **Phase 5**: Documentation & Polish (Week 5) - API docs, architecture, optimization |
| 49 | + |
| 50 | +Each phase has detailed checklists with specific tasks. |
| 51 | + |
| 52 | +## Success Criteria |
| 53 | + |
| 54 | +### Testing |
| 55 | +- [ ] Test coverage ≥ 50% for core packages |
| 56 | +- [ ] Test coverage ≥ 70% for web app |
| 57 | +- [ ] E2E tests for critical user flows |
| 58 | +- [ ] All tests run in CI/CD |
| 59 | + |
| 60 | +### Code Quality |
| 61 | +- [ ] ESLint enabled on all packages with 0 errors |
| 62 | +- [ ] Zero console.log statements in production code |
| 63 | +- [ ] All TODO comments tracked in issues |
| 64 | +- [ ] Pre-commit hooks enforcing quality |
| 65 | + |
| 66 | +### Structure |
| 67 | +- [ ] `@codervisor/devlog-shared` package created and used |
| 68 | +- [ ] `@codervisor/devlog-auth` package extracted from core |
| 69 | +- [ ] Web app components organized: ui / features / layouts |
| 70 | +- [ ] Go collector integrated with package.json |
| 71 | + |
| 72 | +### Performance |
| 73 | +- [ ] Build time reduced by 20% |
| 74 | +- [ ] Bundle size reduced by 15% |
| 75 | +- [ ] Hot reload time < 2 seconds |
| 76 | + |
| 77 | +### Documentation |
| 78 | +- [ ] API documentation (OpenAPI/Swagger) |
| 79 | +- [ ] Architecture documentation with diagrams |
| 80 | +- [ ] Comprehensive developer guide |
| 81 | + |
| 82 | +## Timeline |
| 83 | + |
| 84 | +**Total**: 5 weeks (25 working days) |
| 85 | + |
| 86 | +- Week 1: Foundation & tooling |
| 87 | +- Week 2: Core refactoring |
| 88 | +- Week 3: Web app restructure |
| 89 | +- Week 4: Testing & quality |
| 90 | +- Week 5: Documentation & polish |
| 91 | + |
| 92 | +## References |
| 93 | + |
| 94 | +- [AGENTS.md](../../../AGENTS.md) - AI Agent development guidelines |
| 95 | +- [Project Analysis](./design.md#current-problems) - Detailed problem analysis |
| 96 | +- [CONTRIBUTING.md](../../../CONTRIBUTING.md) - Contribution guidelines |
| 97 | +- Related specs in `specs/20251031/` - Database and project hierarchy specs |
0 commit comments