mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 13:42:21 +00:00
docs: enhance AGENTS.md
This commit is contained in:
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
## Project Overview
|
## Project Overview
|
||||||
|
|
||||||
opencode-multi-model is a Bun/TypeScript project that provides multi-model tmux session management for AI coding assistants. Works as an OpenCode plugin, standalone CLI, and project tool.
|
opencode-multi-model is a Bun/TypeScript project that provides multi-model tmux session management for AI coding assistants. It allows running multiple AI models simultaneously in isolated tmux windows with separate git worktrees.
|
||||||
|
|
||||||
Key features:
|
Available as three integration modes:
|
||||||
- Launch multiple AI models in isolated tmux sessions
|
- **OpenCode Plugin**: Loaded via `opencode.json` plugin array
|
||||||
- Git worktree management for each model session
|
- **Standalone CLI**: Install globally and run `opencode-multi-model open <session> -m <models...>`
|
||||||
- Archive tag creation for session state preservation
|
- **Project Tool**: Import core functions from `"opencode-multi-model/core"` for project-level commands (used during development).
|
||||||
- Supports both OpenCode and Kilo binaries
|
|
||||||
- Available as CLI tool, OpenCode plugin, or project-level import
|
Requires: tmux, git, opencode or kilo binary, Bun runtime.
|
||||||
|
|
||||||
## Build, Lint, and Test Commands
|
## Build, Lint, and Test Commands
|
||||||
|
|
||||||
@@ -20,6 +20,9 @@ bun install
|
|||||||
# Build for production
|
# Build for production
|
||||||
bun run build
|
bun run build
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
bun test
|
||||||
|
|
||||||
# Run tests with coverage (HTML report in ./coverage)
|
# Run tests with coverage (HTML report in ./coverage)
|
||||||
bun run coverage
|
bun run coverage
|
||||||
# Run a specific test by name
|
# Run a specific test by name
|
||||||
@@ -76,13 +79,7 @@ bun run typecheck && bun run lint
|
|||||||
|
|
||||||
- Use `import type` for type-only imports
|
- Use `import type` for type-only imports
|
||||||
- Group imports: external packages, internal modules, types
|
- Group imports: external packages, internal modules, types
|
||||||
- Example:
|
- Biome automatically organizes imports
|
||||||
```typescript
|
|
||||||
import * as fs from "node:fs";
|
|
||||||
import chalk from "chalk";
|
|
||||||
import type { MultiModelOptions } from "../types";
|
|
||||||
import { runCommand } from "./utils";
|
|
||||||
```
|
|
||||||
|
|
||||||
### JSDoc Comments
|
### JSDoc Comments
|
||||||
|
|
||||||
@@ -92,17 +89,17 @@ bun run typecheck && bun run lint
|
|||||||
|
|
||||||
### Error Handling
|
### Error Handling
|
||||||
|
|
||||||
- Return result objects (e.g., `MultiModelResult`, `CommandResult`) with `success: boolean`
|
- Return result objects (e.g., `MultiModelResult`, `CloseSessionResult`, `CleanupResult`) with `success: boolean`
|
||||||
- Include descriptive error messages prefixed with `Error:`
|
- Include descriptive error messages prefixed with `Error:`
|
||||||
- Provide actionable error messages (e.g., suggest valid models on failure)
|
- Provide actionable error messages (e.g., suggest valid models on invalid model name)
|
||||||
- Use `chalk` for colored terminal output (red for errors, dim for secondary info, bold for primary info)
|
- Use `chalk` for colored terminal output (red for errors, dim for secondary info, bold for primary info)
|
||||||
|
|
||||||
### Shell Commands
|
### Shell Commands
|
||||||
|
|
||||||
- Use `Bun.$` template tag for shell commands
|
- Use `Bun.$` template tag for shell commands
|
||||||
- Always use `quiet().nothrow()` to capture output
|
- Always use `quiet().nothrow()` to capture output without throwing
|
||||||
- Wrap command execution in `runCommand()` utility
|
- Wrap command execution in `runCommand()` utility from `core/utils.ts`
|
||||||
- Never use single-character variable names
|
- Use `shellQuote()` for user-provided values in shell commands
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
@@ -112,30 +109,30 @@ bun run typecheck && bun run lint
|
|||||||
- Group tests with `describe()` blocks
|
- Group tests with `describe()` blocks
|
||||||
- Test file naming: `*.test.ts` in `tests/` directory
|
- Test file naming: `*.test.ts` in `tests/` directory
|
||||||
|
|
||||||
### Project Structure
|
## Project Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
src/
|
src/
|
||||||
├── index.ts # Plugin entry point (default export)
|
├── index.ts # Plugin entry point (default export)
|
||||||
├── cli.ts # CLI entry point
|
├── cli.ts # CLI entry point (commander setup)
|
||||||
├── types.ts # All TypeScript interfaces/types
|
├── types.ts # All TypeScript interfaces/types
|
||||||
├── core/
|
├── core/
|
||||||
│ ├── index.ts # Core exports
|
│ ├── index.ts # Core exports
|
||||||
│ ├── open.ts # Session launch logic
|
│ ├── open.ts # Session launch logic
|
||||||
│ ├── close.ts # Session close logic
|
│ ├── close.ts # Session close logic
|
||||||
│ ├── cleanup.ts # Archive tag cleanup logic
|
│ ├── cleanup.ts # Archive tag cleanup logic
|
||||||
│ └── utils.ts # Shared utilities
|
│ └── utils.ts # Shared utilities (runCommand, shellQuote, etc.)
|
||||||
└── tools/
|
└── tools/
|
||||||
├── open.ts # OpenCode tool definition
|
├── open.ts # OpenCode tool definition
|
||||||
├── close.ts # CloseCode tool definition
|
├── close.ts # CloseCode tool definition
|
||||||
└── cleanup.ts # Cleanup tool definition
|
└── cleanup.ts # Cleanup tool definition
|
||||||
tests/
|
tests/
|
||||||
├── open.test.ts
|
├── open.test.ts # Open command tests
|
||||||
├── close.test.ts
|
├── close.test.ts # Close command tests
|
||||||
├── cleanup.test.ts
|
├── cleanup.test.ts # Cleanup command tests
|
||||||
├── open_error.test.ts
|
├── open_error.test.ts # Open error handling tests
|
||||||
├── close_error.test.ts
|
├── close_error.test.ts # Close error handling tests
|
||||||
└── utils.test.ts
|
└── utils.test.ts # Utility function tests
|
||||||
```
|
```
|
||||||
|
|
||||||
### Git Branch and Tag Naming
|
### Git Branch and Tag Naming
|
||||||
@@ -150,3 +147,4 @@ tests/
|
|||||||
- Window names must be unique; collisions get numeric suffixes (e.g., `gpt-5-2`, `gpt-5-2-2`)
|
- Window names must be unique; collisions get numeric suffixes (e.g., `gpt-5-2`, `gpt-5-2-2`)
|
||||||
- Window names are truncated to 24 characters to fit tmux limits
|
- Window names are truncated to 24 characters to fit tmux limits
|
||||||
- Worktree paths are checked for existence before creation to avoid conflicts
|
- Worktree paths are checked for existence before creation to avoid conflicts
|
||||||
|
- Archive tags preserve branch state before deletion for recovery
|
||||||
Reference in New Issue
Block a user