CLI
Scripts and Agents
When stdout is not a terminal the CLI prints JSON and never prompts. Two things follow.
Approvals need --yes. Environment roles apply exactly as in the editor. A statement the role marks “ask” is refused with exit code 4 unless you pass --yes; a statement the role denies is refused either way. A DELETE or UPDATE without a WHERE clause follows the role’s missing-WHERE rule.
Agents see real data. AI data masking in DBCode applies to results that go to a model through DBCode’s own AI features and MCP server. A coding agent that runs dbcode query is a terminal user like any other, the same as if it ran psql. Point agents at DBCode’s MCP server when you want masking and AI roles to apply.
The CLI runs on your own machine: it reads the connections and stored passwords from your DBCode install, so it lives alongside the editor. Useful patterns:
# a quick check from your terminaln=$(dbcode query -c prod "select count(*) as n from orders where status = 'stuck'" | jq '.[0].n')[ "$n" -eq 0 ] && echo "all clear" || echo "$n stuck orders"
# one row per line for streaming toolsdbcode query -c prod --format jsonl "select * from events" | head -100Give your coding agent the CLI
Section titled “Give your coding agent the CLI”An Agent Skill for the CLI lives in the public repo at skills/dbcode-cli. It teaches an agent the parts --help cannot: how to find a connection it can open, that piped output is JSON and never prompts, that statements your role marks “ask” need --yes, and that AI data masking does not apply on the CLI.
Install it into whichever agents you use:
npx skills add dbcodeio/publicThat works for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and most other agents that read SKILL.md. Or copy the skills/dbcode-cli folder into your agent’s skills directory.