feat(agents): add --print-config flag to codemie-opencode - #453
Merged
Conversation
…broaden secret redaction - BaseAgentAdapter.run(): dry-run short-circuit now stops the proxy (if setupProxy started one for SSO/JWT-auth profiles) before returning, so `--print-config` no longer hangs the process indefinitely. - config-redaction.ts: SECRET_KEY_PATTERN now also matches hyphenated keys (x-api-key), privateKey, password, and credential(s). Fixes CR-001 and CR-002 from the code-review.final round.
8nevil8
approved these changes
Jul 31, 2026
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.
Summary
Adds a
--print-configflag tocodemie-opencodethat prints the actual generated opencode config (secrets redacted) to stdout and exits, instead of starting opencode. Reuses the existing config-generation path (OPENCODE_CONFIG_CONTENT/OPENCODE_CONFIG) — no changes toopencode.plugin.ts.Changes
redactSecretsutility (src/agents/core/config-redaction.ts) — recursively masks any object key matching a secret-like name (apiKey,x-api-key,token,secret,password,privateKey,credentials,authorization, case-insensitive) at any depth.extractGeneratedConfighelper (src/agents/core/print-config.ts) — reads the config opencode'sbeforeRunalready produced, fromOPENCODE_CONFIG_CONTENTor theOPENCODE_CONFIGfile.BaseAgentAdapter.run()accepts a{ dryRun?: boolean }option; when set, it runs the normalbeforeRunlifecycle, prints the redacted config, stops any proxy it started (SSO/JWT auth), and returns beforespawn().AgentCLIgains--print-config(opencode-only; other agent CLIs reject it) and forwards{ dryRun: true }toadapter.run().code-review-orchestrator) caught and fixed two issues before merge: a critical proxy-hang (the dry-run path never stopped the SSO/JWT proxy it started, so--print-configwould hang forever under opencode's default auth mode) and a security gap in the redaction regex that missed hyphenated/common secret-key spellings (x-api-key,password,privateKey,credentials). Both are fixed with regression tests.Testing
redactSecrets,extractGeneratedConfig, the CLI flag, and the adapter's dry-run/proxy-stop behavior; a new integration test against the real opencodebeforeRunoutput.npm run ciequivalent gates all green: license, lint, typecheck, build, unit (2536 passed), integration (204 passed), commitlint.Checklist
npm run ci)main