가입 후 초대 링크를 공유하면 동영상 재생 및 초대 보상을 받을 수 있습니다.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture 投稿は個人の意見です。
가입 May 2026
258 팔로잉 중    220
# OpenCode Features and Practical Usage ⚡ OpenCode is not just a TUI tool. With `opencode run` you can execute prompts non-interactively and wire AI directly into shell scripts and CI pipelines. 🏷️ Title: Programmatic Execution 🔗 URL: 📘 Overview The OpenCode CLI launches a TUI by default, but it can also be driven programmatically through commands and flags. At the center is `opencode run`, which executes a prompt in one shot. ⚙️ How It Works ・`opencode run "..."`: runs a prompt non-interactively. Key flags include `-m/--model` (`provider/model`), `--agent` (a custom agent), `-s/--session` (continue an existing session), `-c/--continue` (resume the last session), `-f/--file` (attach files), `--format` (output as `json`, etc.), and `--attach` (connect to a running server). ・`serve`: starts a headless API server with no UI (`--port`; auth via `OPENCODE_SERVER_PASSWORD`). ・`session`: list and delete conversation history (`session list --format json`, `session delete `). ・`export` / `import`: export and import sessions (`export --sanitize`). ・`models` / `auth` / `agent` / `github` / `mcp` / `stats` / `upgrade`: list models, manage auth, create agents, GitHub integration, manage MCP servers, check usage, and update. 🛠️ Practical Usage Embed non-interactive runs in scripts to automate batch processing of many files or reviews in CI. Keeping a server resident and connecting via `--attach` reduces latency. For example, `opencode run --format json "review this diff" > results.json` captures JSON output to a file, and you can loop over files with `opencode serve &` plus repeated `opencode run --attach ... --file "$f"` calls. 💡 Use Cases Great for machine processing: in CI, pass only the changed files to `opencode run`, receive review comments as JSON, and aggregate or notify in a downstream job. Monitoring daily token spend and cost with `stats` is also valuable. ⚠️ Caveats ・When exposing `serve` externally, always enable authentication via `OPENCODE_SERVER_PASSWORD`. ・If your logic depends on the `--format json` output shape, re-verify it after version upgrades. ・Environment variables like `OPENCODE_DISABLE_AUTOUPDATE` let you suppress auto-updates in CI. #OpenCode# #CLI#
더 보기