Commit Graph

16 Commits

Author SHA1 Message Date
7c55464d54 fix: add mission detection to session hooks (#456)
Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
2026-02-22 23:42:21 +00:00
Jason Woltje
4d089cd020 feat(orchestrator): add recent events API and monitor script 2026-02-17 15:44:43 -06:00
Jason Woltje
3258cd4f4d feat(orchestrator): add SSE events, queue controls, and mosaic rails sync 2026-02-17 15:39:15 -06:00
Jason Woltje
cab8d690ab fix(#411): complete 2026-02-17 remediation sweep
Apply RLS context at task service boundaries, harden orchestrator/web integration and session startup behavior, re-enable targeted frontend tests, and lock vulnerable transitive dependencies so QA and security gates pass cleanly.
2026-02-17 14:19:15 -06:00
Jason Woltje
ddf6851bfd bootstrap repo to mosaic standards layer 2026-02-17 12:43:14 -06:00
ab52827d9c chore: add install scripts, doctor command, and AGENTS.md
All checks were successful
ci/woodpecker/push/infra Pipeline was successful
ci/woodpecker/push/api Pipeline was successful
- Add one-line installer (scripts/install.sh) with platform detection
- Add doctor command (scripts/commands/doctor.sh) for environment diagnostics
- Add shared libraries: dependencies, docker, platform, validation
- Update README with quick-start installer instructions
- Add AGENTS.md with codebase patterns for AI agent context

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 11:04:36 -06:00
6521cba735 feat: add flexible docker-compose architecture with profiles
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Add OpenBao services to docker-compose.yml with profiles (openbao, full)
- Add docker-compose.build.yml for local builds vs registry pulls
- Make PostgreSQL and Valkey optional via profiles (database, cache)
- Create example compose files for common deployment scenarios:
  - docker/docker-compose.example.turnkey.yml (all bundled)
  - docker/docker-compose.example.external.yml (all external)
  - docker/docker.example.hybrid.yml (mixed deployment)
- Update documentation:
  - Enhance .env.example with profiles and external service examples
  - Update README.md with deployment mode quick starts
  - Add deployment scenarios to docs/OPENBAO.md
  - Create docker/DOCKER-COMPOSE-GUIDE.md with comprehensive guide
- Clean up repository structure:
  - Move shell scripts to scripts/ directory
  - Move documentation to docs/ directory
  - Move docker compose examples to docker/ directory
- Configure for external Authentik with internal services:
  - Comment out Authentik services (using external OIDC)
  - Comment out unused volumes for disabled services
  - Keep postgres, valkey, openbao as internal services

This provides a flexible deployment architecture supporting turnkey,
production (all external), and hybrid configurations via Docker Compose
profiles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 16:55:33 -06:00
07f271e4fa Revert "feat: Implement automated PR merging with comprehensive quality gates"
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This reverts commit 7c9bb67fcd.
2026-02-03 20:09:58 -06:00
7c9bb67fcd feat: Implement automated PR merging with comprehensive quality gates
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Add automated PR merge system with strict quality gates ensuring code
review, security review, and QA completion before merging to develop.

Features:
- Enhanced Woodpecker CI with strict quality gates
- Automatic PR merging when all checks pass
- Security scanning (dependency audit, secrets, SAST)
- Test coverage enforcement (≥85%)
- Comprehensive documentation and migration guide

Quality Gates:
 Lint (strict, blocking)
 TypeScript (strict, blocking)
 Build verification (strict, blocking)
 Security audit (strict, blocking)
 Secret scanning (strict, blocking)
 SAST (Semgrep, currently non-blocking)
 Unit tests (strict, blocking)
⚠️  Test coverage (≥85%, planned)

Auto-Merge:
- Triggers when all quality gates pass
- Only for PRs targeting develop
- Automatically deletes source branch
- Notifies on success/failure

Files Added:
- .woodpecker.enhanced.yml - Enhanced CI configuration
- scripts/ci/auto-merge-pr.sh - Standalone merge script
- docs/AUTOMATED-PR-MERGE.md - Complete documentation
- docs/MIGRATION-AUTO-MERGE.md - Migration guide

Migration Plan:
Phase 1: Enhanced CI active, auto-merge in dry-run
Phase 2: Enable auto-merge for clean PRs
Phase 3: Enforce test coverage threshold
Phase 4: Full enforcement (SAST blocking)

Benefits:
- Zero manual intervention for clean PRs
- Strict quality maintained (85% coverage, no errors)
- Security vulnerabilities caught before merge
- Faster iteration (auto-merge within minutes)
- Clear feedback (detailed quality gate results)

Next Steps:
1. Review .woodpecker.enhanced.yml configuration
2. Test with dry-run PR
3. Configure branch protection for develop
4. Gradual rollout per migration guide

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 20:04:48 -06:00
5639d085b4 feat(#154): Implement context estimator
Implements formula-based context estimation for predicting token
usage before issue assignment.

Formula:
  base = (files × 7000) + complexity + tests + docs
  total = base × 1.3  (30% safety buffer)

Features:
- EstimationInput/Result data models with validation
- ComplexityLevel, TestLevel, DocLevel enums
- Agent recommendation (haiku/sonnet/opus) based on tokens
- Validation against actual usage with tolerance checking
- Convenience function for quick estimations
- JSON serialization support

Implementation:
- issue_estimator.py: Core estimator with formula
- models.py: Data models and enums (100% coverage)
- test_issue_estimator.py: 35 tests, 100% coverage
- ESTIMATOR.md: Complete API documentation
- requirements.txt: Python dependencies
- .coveragerc: Coverage configuration

Test Results:
- 35 tests passing
- 100% code coverage (excluding __main__)
- Validates against historical issues
- All edge cases covered

Acceptance Criteria Met:
 Context estimation formula implemented
 Validation suite tests against historical issues
 Formula includes all components (files, complexity, tests, docs, buffer)
 Unit tests for estimator (100% coverage, exceeds 85% requirement)
 All components tested (low/medium/high levels)
 Agent recommendation logic validated

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-01 17:42:59 -06:00
de3f3b9204 feat(#156): Create coordinator bot user documentation and setup scripts
Add comprehensive documentation and automated scripts for setting up the mosaic
coordinator bot user in Gitea. This enables the coordinator system to manage
issue assignments, comments, and orchestration.

Changes:
- docs/1-getting-started/3-configuration/4-gitea-coordinator.md: Complete setup guide
  * Step-by-step bot user creation via UI and API
  * Repository permission configuration
  * API token generation and storage
  * Comprehensive testing procedures
  * Security best practices and troubleshooting

- scripts/coordinator/create-gitea-bot.sh: Automated bot creation script
  * Creates mosaic bot user with proper configuration
  * Sets up repository permissions
  * Generates API token
  * Tests authentication
  * Provides credential output for secure storage

- scripts/coordinator/test-gitea-bot.sh: Bot functionality test suite
  * Tests authentication
  * Verifies repository access
  * Tests issue operations (read, list, assign, comment)
  * Validates label management
  * Confirms all required permissions

- scripts/coordinator/README.md: Scripts usage documentation
  * Workflow guides
  * Configuration reference
  * Troubleshooting section
  * Token rotation procedures

- .env.example: Added Gitea coordinator configuration template
  * GITEA_URL, GITEA_BOT_USERNAME, GITEA_BOT_TOKEN
  * GITEA_BOT_PASSWORD, GITEA_REPO_OWNER, GITEA_REPO_NAME
  * Security notes for credential storage

All acceptance criteria met:
✓ Documentation for bot user creation
✓ Automated setup script
✓ Testing procedures and scripts
✓ Configuration templates
✓ Security best practices
✓ Troubleshooting guide

Addresses Milestone: M4.1-Coordinator
Relates to: #140, #157, #158

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-01 17:32:03 -06:00
38f22f0b4e fix(scripts): Improve base URL configuration display clarity
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
When detecting existing configuration, the setup script now shows a
detailed breakdown instead of just "Current base URL: ...":

  Mode:    Traefik reverse proxy

  Web URL: https://app.mosaicstack.dev
  API URL: https://api.mosaicstack.dev
  Auth:    https://auth.mosaicstack.dev

This makes it clear:
- What access mode is configured (localhost/IP/domain/Traefik)
- What each URL is used for (Web UI, API, Authentication)
- Whether to change the configuration

Added helper functions:
- detect_access_mode(): Determines mode from existing .env values
- display_access_config(): Formats the URL breakdown display

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 00:57:23 -06:00
98f80eaf51 fix(scripts): Fix awk env parsing for POSIX compatibility
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Use index() instead of regex capture groups for key extraction
- More portable across different awk implementations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 00:24:31 -06:00
e63c19d158 chore: Cleanup QA reports and improve setup scripts
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Scripts:
- common.sh: Fix select_option to use /dev/tty for interactive prompts
- common.sh: Improve check_docker with detailed error messages
- setup.sh: Add Traefik configuration options
- setup.sh: Add argument validation for --mode, --external-authentik, etc.
- setup.sh: Add fun taglines

QA Reports:
- Remove stale remediation reports
- Keep current pending reports

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 22:53:47 -06:00
fd93be6032 feat: Add comprehensive setup wizard foundation
Modeled after Calibr setup.sh pattern (~/src/calibr/scripts/setup.sh).

Implemented (Foundation):
- Platform detection (Ubuntu, Arch, macOS, Fedora)
- Dependency checking and installation
- Mode selection (Docker vs Native)
- Interactive + non-interactive modes
- Comprehensive logging (clean console + full trace to log file)
- Common utility functions library (450+ lines)

Features in common.sh:
- Output formatting (colors, headers, success/error/warning)
- User input (confirm, select_option)
- Platform detection
- Dependency checking (Docker, Node, pnpm, PostgreSQL)
- Package installation (apt, pacman, dnf, brew)
- Validation (URL, email, port, domain)
- Secret generation (cryptographically secure)
- .env file parsing and management
- Port conflict detection
- File backup with timestamps

To Be Implemented (See scripts/README.md):
- Complete configuration collection
- .env generation with smart preservation
- Port conflict detection
- Password/secret generation
- Authentik blueprint auto-configuration
- Docker deployment execution
- Post-install instructions

Usage:
  ./scripts/setup.sh                    # Interactive
  ./scripts/setup.sh --help             # Show options
  ./scripts/setup.sh --dry-run          # Preview
  ./scripts/setup.sh --non-interactive  # CI/CD

Refs: Setup wizard issue (created)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 16:45:56 -06:00
Jason Woltje
973502f26e feat(#37-41): Add domains, ideas, relationships, agents, widgets schema
Schema additions for issues #37-41:

New models:
- Domain (#37): Life domains (work, marriage, homelab, etc.)
- Idea (#38): Brain dumps with pgvector embeddings
- Relationship (#39): Generic entity linking (blocks, depends_on)
- Agent (#40): ClawdBot agent tracking with metrics
- AgentSession (#40): Conversation session tracking
- WidgetDefinition (#41): HUD widget registry
- UserLayout (#41): Per-user dashboard configuration

Updated models:
- Task, Event, Project: Added domainId foreign key
- User, Workspace: Added new relations

New enums:
- IdeaStatus: CAPTURED, PROCESSING, ACTIONABLE, ARCHIVED, DISCARDED
- RelationshipType: BLOCKS, BLOCKED_BY, DEPENDS_ON, etc.
- AgentStatus: IDLE, WORKING, WAITING, ERROR, TERMINATED
- EntityType: Added IDEA, DOMAIN

Migration: 20260129182803_add_domains_ideas_agents_widgets
2026-01-29 12:29:21 -06:00