Skip to content

feat: introduce Adapter pattern, unit tests, and v1.3.7#9

Merged
puterjam merged 10 commits intomasterfrom
dev
Mar 11, 2026
Merged

feat: introduce Adapter pattern, unit tests, and v1.3.7#9
puterjam merged 10 commits intomasterfrom
dev

Conversation

@puterjam
Copy link
Owner

Summary

  • Refactor CLI configuration management with Adapter pattern (ClaudeAdapter, CodexAdapter) for cleaner separation between providers
  • Add unit tests for ConfigStore and all adapters (moved to test/ directory with dedicated test script)
  • Fix type safety issues — remove as any casts throughout codebase using proper CliTarget and ProviderTemplate types
  • Fix pre-commit hook to sync both package.json and src/version.ts on every commit
  • Bump version to 1.3.7

Test plan

  • bun test — all unit tests pass
  • bun run dev switch — switching providers works for both Claude and Codex targets
  • bun run dev add — adding providers with templates works correctly
  • bun run dev list — lists providers correctly

🤖 Generated with Claude Code

puterjam and others added 10 commits February 19, 2026 22:41
- Extract Claude and Codex configuration logic into separate adapters
- Add CliAdapter interface for extensible CLI support
- Simplify ConfigStore by delegating to adapters
- Add type guards for provider type checking
- Improve TypeScript type safety across commands and TUI

This enables adding new CLI targets (e.g., OpenAI CLI) by:
1. Creating a new adapter class
2. Registering it in the adapter factory
- Add ConfigStore unit tests (Provider CRUD, active provider, theme, config)
- Add Adapter tests (ClaudeAdapter, CodexAdapter general config, env parsing)
- Add mock provider fixtures
- Refactor ConfigStore to support test config directory injection
- Refactor Adapters to support custom config directory

Test results: 32 tests passing
- Relocate test files from src/ to test/
- Add 'pnpm test' script to package.json
- Update import paths in test files
# Conflicts:
#	src/config/store.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pre-commit hook was only updating package.json but not src/version.ts,
causing version mismatch. Hook now updates both files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@puterjam puterjam merged commit fd45a76 into master Mar 11, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant