npx @slkiser/opencode-quota@latest update first asks npm to resolve and run the published @latest CLI package. That npm resolution and execution begins before the updater can print its preview. The preview guarantee covers changes owned by the updater: OpenCode configuration files and OpenCode Quota package-cache directories.
The updater builds one plan, prints it in full, and then either stops or applies that same plan. It does not add runtime compatibility fallbacks.
-
Close OpenCode.
-
Preview without changing configuration or package caches:
npx @slkiser/opencode-quota@latest update --dry-run
-
Read every section. If the plan is correct, apply it:
npx @slkiser/opencode-quota@latest update
The interactive command asks once before safe work begins. For a noninteractive run, use:
npx @slkiser/opencode-quota@latest update --yes
--yesstill prints the full preview. It authorizes only deterministic config edits and manifest-verified cache cleanup, never secret changes. -
Restart OpenCode.
-
Run
/quota_statusin OpenCode, or run this in a terminal:opencode-quota status
The preview can contain three sections:
- Safe changes this command can make: package-spec edits and recognized file-backed display-setting migration.
- Manual actions — this command will not change these sources: credential findings or config cases that require your review.
- Package-cache candidates: directories considered for removal. A candidate is removed only after current config and the package manifest are verified.
Empty sections are omitted. No updater-owned config or cache change happens before the preview and, for the interactive command, your confirmation.
The command uses two exit codes:
0: applied, already current, successful dry-run, manual-only findings, or cancellation.1: invalid arguments, incomplete planning, a config race, a write failure, or post-write validation failure.
Manual findings do not make the command fail. They remain your responsibility.
The updater can:
- change supported OpenCode Quota plugin package specs to
@latest; - remove only package-cache directories that pass path, symlink, containment, and exact package-manifest checks;
- migrate recognized
opencodeZenDisplayvalues in known file-backed quota config locations:"default"becomes rootaccountingDetail: "summary";"detailed"becomes rootaccountingDetail: "detailed";
- keep an existing valid
accountingDetailvalue and remove the obsolete ignored key, even when the two values differ.
Targeted JSON/JSONC edits preserve unrelated settings, plugins, comments, trailing commas, and tuple options where the document can be edited safely.
Unsupported or invalid display values, invalid replacement values, duplicate keys, ambiguous structures, malformed files, unsupported roots, and newly discovered symlinks are left unchanged for manual review. SDK-only config is diagnostic-only because it has no safe file path for the updater to edit.
Credential findings are report-only. The audit detects known obsolete sources by variable-name or file-path presence without retrieving environment values or opening credential files. It never prints, copies, or deletes secret values, and it does not edit environment declarations, shell startup files, auth.json, supported credential files, or legacy credential files.
OpenCode Go now uses an official API key. Configure one supported source in this order:
OPENCODE_API_KEY- Trusted user/global OpenCode config:
provider.opencode-go.options.apiKey - Trusted user/global fallback:
provider.opencode.options.apiKey - A strict
opencode-goAPI-key entry in OpenCodeauth.json - A strict legacy
opencodeAPI-key entry inauth.jsonas the final fallback
You can create the canonical auth.json entry with:
opencode auth login -p opencode-goVerify the supported key with /quota_status or terminal opencode-quota status. Only after it works, manually remove obsolete declarations for OPENCODE_GO_WORKSPACE_ID and OPENCODE_GO_AUTH_COOKIE, plus any obsolete global opencode-quota/opencode-go.json file.
Workspace/cookie material cannot be converted into the official API key. Do not paste credential values into command output, issue reports, or support messages.
OPENCODE_WORKSPACE_ID and OPENCODE_AUTH_COOKIE are ambiguous names: they may come from an older Zen setup, but they may instead belong to OpenCode's workspace feature. Current quota code ignores them. The updater reports them only when it finds no supported global opencode-quota/opencode.json path, and it does not read or move their values.
First decide whether those variables really contain Zen credentials. If they do, create the supported file under your global OpenCode config directory. The usual path is ~/.config/opencode/opencode-quota/opencode.json:
{
"workspaceId": "your-workspace-id",
"authCookie": "your-auth-cookie"
}Use placeholders while documenting or sharing the setup; never share the real values. Restrict file access to your user account, verify with /quota_status or terminal opencode-quota status, and only then remove obsolete environment declarations manually. If the variables belong to OpenCode's workspace feature, leave them with that feature instead of treating them as Zen credentials.
Before updating, back up the OpenCode config files you use. This is especially important if you may roll back to an older plugin version, because old versions do not understand every current setting.
Cancelling the interactive prompt changes nothing. Dry-run also changes nothing. A successful migration is idempotent: rerunning does not repeat a completed display edit, though manual findings remain until you resolve their sources.
The updater checks every planned file again before writing and writes each changed file atomically. It does not claim that several files form one transaction and it does not overwrite concurrent edits with an automatic rollback. If a later file changes or a write fails after earlier files were written, the error lists the files changed before failure and deletes no package cache. Fix the reported cause, inspect those paths, and rerun the dry-run command to build a fresh plan.