Skip to content

feat: Add OpenCode as an AI provider (follow-up to #965) #1684

@bjcoombs

Description

@bjcoombs

Problem

Issue #965 asked for OpenCode support as an AI provider, analogous to claude-code, codex-cli, and gemini-cli. It was closed against PR #970, which added OpenCode as a rules profile (AGENTS.md integration) — a separate, valuable concern but distinct from the original ask. The AI-provider request was never addressed.

This matters for a concrete enterprise use case: organisations that permit OpenCode and its configured backends (notably GitHub Copilot) but prohibit direct LLM API usage. Those users currently cannot use Task Master at all, because every existing provider requires a direct LLM credential or a different CLI.

Technical Context

Since #965 closed, @ben-vargas has published ai-sdk-provider-opencode-sdk — the same community-provider pattern the other CLI-backed providers use. Task Master already depends on Ben's sibling packages:

  • ai-sdk-provider-claude-code
  • ai-sdk-provider-codex-cli
  • ai-sdk-provider-gemini-cli

Adding OpenCode is structurally identical.

Proposed Solution

A minimal PR mirroring src/ai-providers/claude-code.js:

  • New src/ai-providers/opencode.js wrapping ai-sdk-provider-opencode-sdk (pinned to the ai-sdk-v5 tag to match the repo's current ai@^5.0.51)
  • Registration in src/ai-providers/index.js and packages/tm-core/src/common/constants/providers.ts
  • Entry in scripts/modules/supported-models.json
  • CLI availability check (opencode --version) with the same fallback-path logic used by claude-code.js for minimal environments
  • Unit tests mirroring tests/unit/ai-providers/claude-code.test.js
  • Docs updates

Auth, model routing, and provider selection all delegate to OpenCode — Task Master stays agnostic.

Scope

Related

Happy to own the PR. @ben-vargas if you're planning to take this yourself, let me know and I'll step aside.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions