Commit graph

12 commits

Author SHA1 Message Date
Rasmus Widing
3026a6445d
Add Archon distribution config and directory structure (#101)
* Add Archon distribution config and directory structure

- Create centralized path resolution in src/utils/archon-paths.ts
- Add YAML configuration system (src/config/) with layered loading
- Update Dockerfile and docker-compose for /.archon/ directory
- Add GHCR publish workflow for multi-arch Docker builds
- Create deploy/ directory with end-user docker-compose
- Add /init command to create .archon structure in repos
- Add docs/configuration.md reference guide
- Update README with Quick Start section
- Add bun run validate script
- Update tests for new path defaults (~/.archon/)

Directory structure:
- Local: ~/.archon/{workspaces,worktrees,config.yaml}
- Docker: /.archon/{workspaces,worktrees}
- Repo: .archon/{commands,workflows,config.yaml}

Legacy WORKSPACE_PATH and WORKTREE_BASE env vars still supported.

* Complete Archon distribution config implementation

- Wire up config system in src/index.ts (Task 3.5)
- Remove legacy WORKSPACE_PATH and WORKTREE_BASE support
- Add logConfig() function to config-loader.ts
- Update docker-compose.yml to use ARCHON_DOCKER env var
- Remove legacy env vars from .env.example
- Update all documentation to reference ARCHON_HOME
- Create scripts/validate-setup.sh for setup validation
- Add setup:check script to package.json
- Create docs/getting-started.md guide
- Create docs/archon-architecture.md technical docs
- Update tests to use ARCHON_HOME instead of legacy vars
- Fix validate.md command template for new paths

All plan phases now complete:
- Phase 1: Archon Directory Structure
- Phase 2: Docker Distribution
- Phase 3: YAML Configuration System
- Phase 4: Developer Experience
- Phase 5: Documentation
2025-12-17 21:45:41 +02:00
Rasmus Widing
c85622fbbb
Migrate from Node.js/npm/Jest to Bun runtime (#85)
* Migrate from Node.js/npm/Jest to Bun runtime

- Replace npm with bun for package management (bun.lock)
- Replace Jest with bun:test for testing
- Update tsconfig for Bun (ESNext module, bundler resolution)
- Update Dockerfile to use oven/bun:1-slim
- Update CI workflow to use oven-sh/setup-bun@v2
- Remove dynamic import hack from codex.ts (direct ESM imports)
- Fix test mocking for Bun (export execFileAsync, use spyOn)
- Update all documentation (CLAUDE.md, README.md, CONTRIBUTING.md)

All 395 tests pass, type-check passes, E2E validated with curl.

* ci: retrigger CI build

* fix: make execFileAsync a function for better Bun mockability

* fix: ensure execFileAsync returns string not Buffer

* fix: rename _execFileAsync to comply with naming convention

* fix: make mkdirAsync mockable for Bun tests

* fix: update engines to bun>=1.0.0 and add mkdirAsync mock

* fix: pin Bun to 1.3.4 in CI to fix mock.module test failures

Newer Bun versions have different mock.module() behavior that causes
cross-test module pollution, resulting in 71 test failures in CI while
tests pass locally. Pinning to 1.3.4 ensures consistent behavior.

* fix: run orchestrator tests last to avoid mock.module pollution

Bun's mock.module() pollutes the global module cache, causing tests to
fail when orchestrator.test.ts (which mocks command-handler and factory)
runs before those modules' own test files.

Fix by running tests in two batches:
1. All tests except orchestrator
2. Orchestrator tests last

This ensures orchestrator's mocks don't affect other test files.
2025-12-16 15:34:58 +02:00
Wirasm
45c7adbf2f
Add Slack platform adapter with Socket Mode support (#73)
- Add SlackAdapter using @slack/bolt with Socket Mode (no HTTP endpoints needed)
- Implement thread handling mirroring Discord pattern (channel:thread_ts conversation IDs)
- Add Slack URL normalization to strip <url> formatting from messages
- Add user whitelist authorization (SLACK_ALLOWED_USER_IDS)
- Support @mention activation in channels and direct DMs
- Add comprehensive setup guide and update README with Slack section
2025-12-05 21:34:42 +02:00
Wirasm
7a1cc7211a
Fix npm deprecation warnings and vulnerability (#29)
* Fix npm deprecation warnings and vulnerability

- Update Jest 29→30.2.0 to eliminate glob@7/inflight deprecation warnings
- Update Express 5.1.0→5.2.1 to fix query property vulnerability
- Update ts-jest 29.1.0→29.4.6 for Jest 30 compatibility
- Update @types/jest 29.5.0→30.0.0 for Jest 30 types
- Add npm override for test-exclude@7 to fully eliminate glob@7

* Update SDK and tooling dependencies to latest
2025-12-03 10:43:24 +02:00
Rasmus Widing
0ec36a9d10 Add Discord platform adapter
- Implement DiscordAdapter using discord.js v14 with IPlatformAdapter interface
- Support 2000 char message limit with automatic splitting
- Add MESSAGE_CONTENT intent for reading messages
- Fix dotenv import order to use 'dotenv/config' for proper env loading
- Update batch mode tests to account for "starting" message

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 17:08:50 +02:00
Rasmus Widing
875b54c16d chore: Update dependencies to latest versions
- Claude SDK 0.1.30 → 0.1.55
- Codex SDK 0.57.0 → 0.63.0
- Express 4.21.2 → 5.1.0 (with route syntax fix)
- dotenv 16.6.1 → 17.2.3
- prettier, tsx, typescript-eslint updated
2025-12-01 14:01:22 +02:00
Wirasm
05b1c32bf2
feat: Add Telegram MarkdownV2 formatting for AI responses (#2)
* feat: Add Telegram MarkdownV2 formatting for AI responses

- Add telegramify-markdown package to convert GitHub-flavored markdown
  to Telegram's MarkdownV2 format
- Create telegram-markdown utility with:
  - convertToTelegramMarkdown(): Main conversion function
  - stripMarkdown(): Fallback for plain text
  - escapeMarkdownV2(): Manual escaping helper
- Update TelegramAdapter to:
  - Format short messages with MarkdownV2
  - Split long messages by paragraphs for better formatting
  - Fallback to stripped plain text when MarkdownV2 parsing fails
- Add comprehensive tests for markdown conversion

Transforms AI responses from raw markdown (## headers, **bold**) to
properly formatted Telegram messages with bold text, code blocks, etc.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Correct telegram adapter test mocks and assertions

- Add missing stripMarkdown mock to telegram-markdown module mock
- Fix paragraph splitting test to use double newlines (\n\n) matching
  actual implementation behavior
- Use smaller paragraph sizes (3000 chars) to stay within MAX_LENGTH

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-01 11:39:17 +02:00
Wirasm
ca6a5b2dd5
chore: Improve unit test coverage (#3)
* docs: add PRP for improving test coverage

- Create comprehensive PRP documenting test infrastructure improvements
- Add coverage directory to .gitignore
- Plan covers 6 phases: infrastructure, utilities, database, adapters, orchestrator, CI/CD
- Target: increase coverage from 15.98% to 80%+

* test: add comprehensive unit test coverage

- Add test infrastructure: setup.ts, mock utilities for database, platform, and streaming
- Add tests for all database modules (conversations, codebases, sessions)
- Add tests for test adapter, client factory, orchestrator
- Expand Claude and Codex client tests with full mock coverage
- Add tool-formatter tests
- Configure Jest with coverage thresholds (30% branches, 40% functions/lines/statements)
- Add CI workflow for automated testing on push/PR
- Add test:coverage and test:ci npm scripts

Coverage: 170 tests passing, 53% lines, 48% branches, 65% functions

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: improve test coverage and fix type issues

- Fix type annotations across multiple files
- Improve test mocks for streaming and database operations
- Update jest config for better coverage reporting
- Fix minor type issues in orchestrator, sessions, and adapters
- Update documentation for architecture and cloud deployment

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-01 11:31:00 +02:00
Cole Medin
ca74774cac Codex Implementation 2025-11-11 23:06:29 -06:00
Cole Medin
7afa1bbb23 GitHub Adapter Implementation 2025-11-11 12:38:20 -06:00
Cole Medin
88b688b331 Small ESLint/Prettier PIV Loop 2025-11-11 08:59:22 -06:00
Cole Medin
41415d7e7f feat: implement telegram + claude mvp with generic architecture
- Add generic IPlatformAdapter and IAssistantClient interfaces for extensibility
- Implement TelegramAdapter with streaming/batch modes
- Implement ClaudeClient with session persistence and resume capability
- Create TestAdapter for autonomous validation via HTTP endpoints
- Add PostgreSQL database with 3-table schema (conversations, codebases, sessions)
- Implement slash command system (/clone, /status, /getcwd, /setcwd, /reset, /help)
- Add Docker containerization with docker-compose (with-db profile for local PostgreSQL)
- Fix Claude Agent SDK spawn error (install bash, pass PATH environment variable)
- Fix workspace volume mount to use /workspace in container
- Add comprehensive documentation and health check endpoints

Architecture highlights:
- Platform-agnostic design allows adding Slack, GitHub, etc. via IPlatformAdapter
- AI-agnostic design allows adding Codex, etc. via IAssistantClient
- Orchestrator uses dependency injection with interface types
- Session persistence survives container restarts
- Working directory + codebase context determine Claude behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 19:35:50 -06:00