TheFlow
|
0e6be3eaf1
|
refactor: remove website code and fix critical startup crashes (Phase 8)
CRITICAL FIX: Server would CRASH ON STARTUP (multiple import errors)
REMOVED (2 scripts):
1. scripts/framework-watchdog.js
- Monitored .claude/session-state.json (OUR Claude Code setup)
- Monitored .claude/token-checkpoints.json (OUR file structure)
- Implementers won't have our .claude/ directory
2. scripts/init-db.js
- Created website collections: blog_posts, media_inquiries, case_submissions
- Created website collections: resources, moderation_queue, users, citations
- Created website collections: translations, koha_donations
- Next steps referenced deleted scripts (npm run seed:admin)
REWRITTEN (2 files):
src/models/index.js (29 lines → 27 lines)
- REMOVED imports: Document, BlogPost, MediaInquiry, CaseSubmission, Resource
- REMOVED imports: ModerationQueue, User (all deleted in Phase 2)
- KEPT imports: AuditLog, DeliberationSession, GovernanceLog, GovernanceRule
- KEPT imports: Precedent, Project, SessionState, VariableValue, VerificationLog
- Result: Only framework models exported
src/server.js (284 lines → 163 lines, 43% reduction)
- REMOVED: Imports to deleted middleware (csrf-protection, response-sanitization)
- REMOVED: Stripe webhook handling (/api/koha/webhook)
- REMOVED: Static file caching (for deleted public/ directory)
- REMOVED: Static file serving (public/ deleted in Phase 6)
- REMOVED: CSRF token endpoint
- REMOVED: Website homepage with "auth, documents, blog, admin" references
- REMOVED: Instruction sync (scripts/sync-instructions-to-db.js reference)
- REMOVED: Hardcoded log path (${process.env.HOME}/var/log/tractatus/...)
- REMOVED: Website-specific security middleware
- KEPT: Security headers, rate limiting, CORS, body parsers
- KEPT: API routes, governance services, MongoDB connections
- RESULT: Clean framework-only server
RESULT: Repository can now start without crashes, all imports resolve
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-21 22:17:02 +13:00 |
|
TheFlow
|
bd262ae48d
|
refactor: reduce public repo to minimal implementation-only resource
REMOVED: 267 non-implementation files (51% reduction)
Categories removed:
- Research documents & case studies (35 files)
- Planning/internal development docs (28 files)
- Website pages & assets (93 files - this is framework code, not website code)
- Audit reports (6 files)
- Non-essential admin UI (11 files)
- Markdown content duplicates (10 files)
- Internal development scripts (96 files)
- Internal setup docs (2 files)
RETAINED: 253 implementation-focused files
- Core framework services (src/)
- Test suite (tests/)
- API documentation (docs/api/)
- Deployment quickstart guide
- Essential admin UI (rule manager, dashboard, hooks dashboard)
- Architecture decision records
- Configuration files
PURPOSE: Public repo is now focused exclusively on developers
implementing Tractatus, not researchers studying it or users visiting
the website. All background/research content available at
https://agenticgovernance.digital
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-21 21:09:34 +13:00 |
|
TheFlow
|
946e8d35f1
|
feat: deployment quickstart kit - 30-minute Docker deployment (Task 6)
Complete production-ready deployment package enabling implementers to deploy
Tractatus with all 5 governance services in 30 minutes using Docker Compose.
**Package Contents (15KB):**
1. docker-compose.yml
- MongoDB 7.0 with authentication
- Tractatus Node.js application
- Health checks and volume management
- Network configuration
2. Dockerfile
- Multi-stage build (builder + production)
- Security-hardened (non-root user, minimal image)
- Health checks integrated
- Production-optimized
3. .env.example
- Complete configuration template
- All 5 governance service toggles
- Required secrets (MongoDB, JWT, Admin)
- Feature flags and optional services
- Rate limiting, CORS, CSP configuration
4. sample-governance-rules.json
- 10 production-ready governance rules
- STR-001: BoundaryEnforcer (human approval for values)
- STR-002: CrossReferenceValidator (port specifications)
- OPS-001: ContextPressureMonitor (pressure monitoring)
- OPS-002: InstructionPersistenceClassifier (classification)
- TAC-001: MetacognitiveVerifier (complex verification)
- SYS-001/002: Database and project isolation
- SEC-001: CSP enforcement
- VAL-001: Te Tiriti commitment
- QUAL-001: World-class quality
5. verify-deployment.sh
- Automated verification (40+ checks)
- 7 test categories: env, Docker, network, DB, services, security, files
- Color-coded output (pass/fail/warn)
- CI/CD integration ready
6. TROUBLESHOOTING.md
- Comprehensive troubleshooting guide
- 6 major sections covering common deployment issues
- Docker, database, application, services, performance, security
- Quick reference commands
7. README.md
- "Deploy in 30 minutes" guide
- 6-step quickstart (2+5+10+3+5+5 minutes)
- Configuration guide (basic + production)
- Testing procedures and monitoring
- Architecture diagram
- Backup/restore procedures
8. scripts/load-governance-rules.js
- Loads sample rules into MongoDB
- JSON validation and error handling
- Creates indexes (rule_id, quadrant, enforced_by)
- Summary statistics by quadrant and service
**Implementer Page Updates:**
- Added prominent "Deployment Quickstart Kit" section after hero
- Green gradient background with "NEW" badge
- Two-column layout: description + download / file list
- Download button: /downloads/tractatus-quickstart.tar.gz (15KB)
- Professional design matching site aesthetic
**Deliverables:**
✅ Production-ready Docker Compose configuration
✅ Complete environment configuration template
✅ 10 sample governance rules (all 5 services)
✅ Automated deployment verification (40+ tests)
✅ Comprehensive troubleshooting guide
✅ Step-by-step deployment guide (30 minutes)
✅ Database initialization scripts
✅ Package deployed to production
**Testing:**
- Package structure validated
- File permissions correct (644/755)
- Deployed to https://agenticgovernance.digital/downloads/
- Implementer page updated with download section
**Roadmap Progress:**
Phase 1, Week 2, Task 6: Deployment Quickstart Kit - COMPLETED
Priority: High | Effort: 3-4 days | Status: ✅ Done
Next: Task 8 - Technical Architecture Diagram (Week 3)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-12 07:27:37 +13:00 |
|