Skip to content

fix: keep CLI JSON output parseable#3678

Closed
caio-pizzol wants to merge 1 commit into
mainfrom
caio/pr3257-cli-stdout-diagnostics
Closed

fix: keep CLI JSON output parseable#3678
caio-pizzol wants to merge 1 commit into
mainfrom
caio/pr3257-cli-stdout-diagnostics

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol commented Jun 8, 2026

Supersedes #3257 with a CLI-boundary fix.

superdoc info --json could emit library diagnostics on stdout when NODE_ENV was unset, which made the JSON envelope unparseable. The fix keeps protocol ownership at the executable boundary instead of mutating console inside importable APIs.

What changed:

  • split the executable bootstrap into apps/cli/src/main.ts; apps/cli/src/index.ts remains importable
  • install the process console policy before importing CLI internals
  • suppress all console.* for one-shot JSON mode, because success uses stdout and failures use stderr
  • redirect console.log / console.info / console.debug to stderr only for host, where stdout is JSON-RPC
  • suppress all console methods for --quiet
  • remove the telemetry console.debug
  • update CLI executable references from dist/index.js to dist/main.js
  • add subprocess coverage for success JSON stdout and failure JSON stderr

Validation:

  • git diff --check HEAD~1..HEAD
  • stale CLI path guard with rg
  • bun build apps/cli/src/main.ts --packages external --outfile /tmp/superdoc-cli-main-final-review.js
  • node .github/scripts/agent-docs-l1.mjs --target . confirms the new evals/AGENTS.md broken path finding is gone
  • local unit tests were not run per repo policy; CI is the verification path

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@caio-pizzol caio-pizzol force-pushed the caio/pr3257-cli-stdout-diagnostics branch from 622e843 to 14ea06b Compare June 8, 2026 14:17
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 8, 2026

Agent docs audit

Found deterministic findings on 1 changed agent-doc item(s).

evals/AGENTS.md (64 lines)

  • 9 unresolved command(s)

Unresolved pnpm commands (advisory):

  • pnpm baseline:compare
  • pnpm baseline:save
  • pnpm eval
  • pnpm eval:benchmark
  • pnpm eval:benchmark:claude
  • pnpm eval:benchmark:codex
  • pnpm eval:benchmark:report
  • pnpm eval:e2e
  • pnpm view

Deterministic L1 only: no AI, no Bash, no secrets. Semantic L2/L3 audit runs weekly on main. Policy: agent-docs-policy.md.

@caio-pizzol caio-pizzol force-pushed the caio/pr3257-cli-stdout-diagnostics branch from 14ea06b to 4021d1a Compare June 8, 2026 15:04
@caio-pizzol caio-pizzol changed the title fix: keep CLI JSON stdout parseable fix: keep CLI JSON output parseable Jun 8, 2026
@caio-pizzol caio-pizzol closed this Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants