fix: json flag issue interactive mode - #86
Merged
felipefreitag merged 8 commits intoMar 17, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
No issues found across 6 files
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Extends the globalOpts.json guard to all remaining bare isInteractive() calls so that --json output is always pipeable to jq without prompts interrupting. Adds tests verifying --json suppresses prompts even when isTTY is true, and fixes pre-existing lint formatting in login/send tests.
Contributor
There was a problem hiding this comment.
2 issues found across 20 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/commands/contacts/add-segment.test.ts">
<violation number="1" location="tests/commands/contacts/add-segment.test.ts:171">
P2: The new test mutates the shared addContactSegmentCommand instance by attaching it to a parent Command, but the cleanup is only at the end of the happy path. If the test fails before the reset, the singleton keeps its parent and can leak state into later tests. Move the reset into a finally/afterEach cleanup to make it failure-safe.</violation>
</file>
<file name="tests/commands/broadcasts/create.test.ts">
<violation number="1" location="tests/commands/broadcasts/create.test.ts:403">
P2: The new test mutates the shared `createBroadcastCommand` singleton by adding it as a subcommand, but only resets `parent` on the happy path. If the test throws before cleanup, the shared command stays attached and can pollute later tests that reuse it. Consider moving the reset into `afterEach` or a `try/finally` so it always runs.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
The shared command singleton's parent was only reset at the end of the test body, leaking state if the test threw before cleanup. Move the reset into afterEach via a commandRef variable so it always runs.
felipefreitag
approved these changes
Mar 17, 2026
felipefreitag
left a comment
Member
There was a problem hiding this comment.
The implementation looks good, but it should cover the whole surface of the CLI
Contributor
Author
|
Thanks for the feedback. Will keep it in mind for next time!
|
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.
Fixes #74
Summary by cubic
Treats the --json flag as non-interactive across the CLI to suppress prompts and require explicit flags, even in TTY sessions. Extends this to all remaining commands and shared prompts, with tests ensuring consistent, pipeable JSON output. Fixes #74.
Bug Fixes
Tests
Written for commit e90e733. Summary will update on new commits.