838b5ae216
Update root + 43 directory-level AGENTS.md files to reflect current state: - Root AGENTS.md rewritten with accurate counts (1967 TS files, 1304 source + 663 test, 278k LOC, 120 barrel index.ts), 7-step init flow, 5-tier hook composition, and full Team Mode section (12 team_* tools, eligibility, storage layout, config gate) - src/AGENTS.md adds team-mode init step, current per-subdir file/LOC table - src/tools/AGENTS.md documents conditional gates (team-mode +12, task system +4, hashline +1, interactive_bash +1, look_at +1) with always-on baseline of 20 - src/hooks/AGENTS.md splits into 5 tiers + 4 conditional team-mode hooks - src/features/team-mode/AGENTS.md surfaces 12 tools, eligible agents, spawn-race-safe invariants, and integration points - src/features/builtin-skills/AGENTS.md tracks 10 skills incl. team-mode - src/agents/AGENTS.md, src/plugin/AGENTS.md, src/config/AGENTS.md updated for team-mode awareness, accurate counts, and current schema field list - All other AGENTS.md files refreshed to 2026-05-08 generation date
2.5 KiB
2.5 KiB
src/shared/ — 100+ Utility Files
Generated: 2026-05-08
OVERVIEW
Cross-cutting utilities used throughout the plugin. Barrel-exported from index.ts. Logger writes to /tmp/oh-my-opencode.log.
CATEGORY MAP
| Category | Files | Key Exports |
|---|---|---|
| Model Resolution | ~22 | resolveModel(), checkModelAvailability(), AGENT_MODEL_REQUIREMENTS |
| Tmux Integration | 11 | createTmuxSession(), spawnPane(), closePane(), server health |
| Configuration & Paths | 10 | resolveOpenCodeConfigDir(), getDataPath(), parseJSONC() |
| Session Management | 8 | SessionCursor, trackInjectedPath(), SessionToolsStore |
| Git Worktree | 7 | parseGitStatusPorcelain(), collectGitDiffStats(), formatFileChanges() |
| Command Execution | 7 | executeCommand(), executeHookCommand(), embedded command registry |
| Migration | 6 | migrateConfigFile(), AGENT_NAME_MAP, HOOK_NAME_MAP, MODEL_VERSION_MAP |
| String & Tool Utils | 6 | toSnakeCase(), normalizeToolName(), parseFrontmatter() |
| Agent Configuration | 5 | getAgentVariant(), AGENT_DISPLAY_NAMES, AGENT_TOOL_RESTRICTIONS |
| OpenCode Integration | 5 | injectServerAuth(), detectExternalPlugins(), client accessors |
| Type Helpers | 4 | deepMerge(), DynamicTruncator, matchPattern(), isRecord() |
| Misc | 8 | log(), readFile(), extractZip(), downloadBinary(), findAvailablePort() |
MODEL RESOLUTION PIPELINE
resolveModel(input)
1. Override: UI-selected model (primary agents only)
2. Category default: From category config
3. Provider fallback: AGENT_MODEL_REQUIREMENTS chains
4. System default: Ultimate fallback
Key files: model-resolver.ts (entry), model-resolution-pipeline.ts (orchestration), model-requirements.ts (fallback chains), model-availability.ts (fuzzy matching).
MIGRATION SYSTEM
Automatically transforms legacy config on load:
agent-names.ts: Old agent names → new (e.g.,junior→sisyphus-junior)hook-names.ts: Old hook names → newmodel-versions.ts: Old model IDs → currentagent-category.ts: Legacy agent configs → category system
MOST IMPORTED
| Utility | Import Count | Purpose |
|---|---|---|
logger.ts |
62 | /tmp/oh-my-opencode.log |
data-path.ts |
11 | XDG storage resolution |
model-requirements.ts |
11 | Agent fallback chains |
system-directive.ts |
11 | System message filtering |
frontmatter.ts |
10 | YAML metadata extraction |