feat(providers): add opencode_cli semantic-scan provider - #536
Open
Yoseph-Zuskin wants to merge 1 commit into
Open
feat(providers): add opencode_cli semantic-scan provider#536Yoseph-Zuskin wants to merge 1 commit into
Yoseph-Zuskin wants to merge 1 commit into
Conversation
- Add providers/opencode_cli/provider.py and __init__.py mirroring codex_cli - Register opencode in _agent_cli.py: argv builder (opencode run --format json), JSON-event parser, auth check (opencode auth list) - Wire SKILLSPECTOR_PROVIDER=opencode_cli in providers/__init__.py and inference_usage.py - Update docs trio: README provider table, .env.example, docs/DEVELOPMENT.md - Add model-registry entries for opencode/nemotron-3-ultra-free and opencode/nemotron-3.5-lightning-free (1M context) - Add tests/provider/test_opencode_cli.py (31 tests: argv, auth, parser, wiring, registry label) - Verified: live probe and self-scan with opencode 1.18.30 (CLI-default model), llm_available=true, 3/3 semantic calls succeeded; self-scan of the provider package found 0 semantic issues Signed-off-by: Yoseph Zuskin <zuskinyoseph@gmail.com> Co-Authored-By: OpenCode Muse Spark 1.3 Free (1M context) <noreply@opencode.ai> Co-Authored-By: OpenCode Nemotron 3 Ultra Free (1M context) <noreply@opencode.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
opencode_clisemantic-scan providerProblem
SkillSpector ships CLI providers for Claude, Codex, and Gemini, but none
for OpenCode, so OpenCode users get static-only scans (
llm_availablestays false and the three semantic analyzers are skipped).
Fixes: #534
Approach
opencode_cliprovider mirroring thecodex_clishape:providers/opencode_cli/{provider.py,__init__.py}, registry entry,SKILLSPECTOR_PROVIDER=opencode_cliselection,provider_name()label,CLI help text.
opencode run --format jsonwith
--modeladded only whenSKILLSPECTOR_MODELis set. Verifiedlive that
opencode runconsumes piped stdin (nonce round-trip)despite no documented stdin flag; list form throughout, shell never
invoked. Windows hostile-prompt roundtrips covered by test
(spaces, quotes, unicode, backslashes).
--format jsonenvelopes, skips non-JSON noise lines, raises fail-closed on empty
output. Auth check is
opencode auth listwith a 15s timeout,fail-closed.
.env.example,docs/DEVELOPMENT.md); provider tests live intests/provider/per repo convention.
of this change (separate chore).
Verification
tests/provider/test_opencode_cli.py: 31 passed (TDD: argv, auth,parser, wiring, registry label).
tests/unit/test_agent_cli.py: 87 passed.ruff check+ruff format --check: clean on all touched files.tests/nodes/test_build_context.py(Windows symlink limits),test_security_end_to_end.py,test_compare_scan_accuracy.py,test_create_github_release.py,test_input_handler.py— none infiles this PR touches; pre-existing/environmental.
opencode1.18.30, CLI-default model):llm_available: true, 3/3 semantic calls succeeded, risk 0/LOW,0 findings.
opencode1.18.30,CLI-default model):
llm_available: true, 3/3 semantic callssucceeded, 100% coverage, 0 semantic issues — 3 SC8 bytecode FPs
from stale local
__pycache__, since cleaned.opencode/nemotron-3-ultra-freeandopencode/muse-spark-1.3-contributor-free(both free-tier models via OpenCode's zen endpoint); semantic stage
degraded on shared runtime budget exhaustion (4 parallel calls at once),
not model failure — confirmed by spacing calls manually.
Sample
Probe scan of one small skill returned
risk: score 0 / LOW / CAUTION,llm_calls_attempted: 3,llm_calls_succeeded: 3, zero findings.Risks
opencode run --format jsonshapechange degrades to fail-closed (empty-output raise), never silent
heuristic-only.
inference_usageis empty on this path (no token counters from CLIsubprocesses); scan integrity unaffected, cost accounting unavailable.
Signed-off-by(maintainer: verify on push).budget instantly; users on free models should use local Ollama or
add credits for genuine semantic analysis.