-
Notifications
You must be signed in to change notification settings - Fork 34
feat(cctx): non-interactive flag #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes introduce interactive/non-interactive mode support to the CCTX command. A new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
packages/commands/src/query/cctx.ts(3 hunks)src/schemas/commands/cctx.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: fadeev
PR: zeta-chain/toolkit#346
File: packages/commands/src/ton/depositAndCall.ts:0-0
Timestamp: 2025-06-13T15:33:54.781Z
Learning: fadeev prefers responses in English.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (1)
packages/commands/src/query/cctx.ts (1)
67-72: Good UX improvement with the enhanced timeout message.Including the CCTX count in the timeout message provides useful feedback to users about the progress made before the timeout.
| const { hash, rpc, delay, interactive } = options; | ||
| const timeout = interactive ? options.timeout : 5000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Property name mismatch prevents this logic from working.
This code attempts to destructure interactive from options, but the schema validation (line 8 in src/schemas/commands/cctx.ts) and CLI flag (line 337) create a property named nonInteractive instead. This will result in interactive being undefined.
After applying the fix suggested in src/schemas/commands/cctx.ts, update this code to:
- const { hash, rpc, delay, interactive } = options;
- const timeout = interactive ? options.timeout : 5000;
+ const { hash, rpc, delay, nonInteractive } = options;
+ const timeout = nonInteractive ? 5000 : options.timeout;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const { hash, rpc, delay, interactive } = options; | |
| const timeout = interactive ? options.timeout : 5000; | |
| const { hash, rpc, delay, nonInteractive } = options; | |
| const timeout = nonInteractive ? 5000 : options.timeout; |
🤖 Prompt for AI Agents
In packages/commands/src/query/cctx.ts around lines 318-319, the code
destructures an undefined 'interactive' property but the schema/CLI use
'nonInteractive'; replace the destructuring and logic to use the existing
property (e.g., derive interactive as !options.nonInteractive or directly use
options.nonInteractive in the conditional) so timeout is set to options.timeout
when interactive is true (nonInteractive is false) and defaults to 5000 when
nonInteractive is true.
| export const cctxOptionsSchema = z.object({ | ||
| delay: z.coerce.number().int().positive().default(DEFAULT_DELAY), | ||
| hash: z.string(), | ||
| interactive: z.coerce.boolean(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Property name mismatch and missing default will cause validation failure.
The CLI flag is defined as --non-interactive (line 337 in packages/commands/src/query/cctx.ts), which Commander automatically converts to the camelCase property nonInteractive. However, the schema expects a field named interactive. This mismatch will cause cctxOptionsSchema.parse(opts) to fail at runtime.
Additionally, the field has no default value, meaning validation will fail when the flag is not provided.
Apply this diff to fix the issues:
- interactive: z.coerce.boolean(),
+ nonInteractive: z.coerce.boolean().default(false),Then update the logic in packages/commands/src/query/cctx.ts line 319 to:
const timeout = options.nonInteractive ? 5000 : options.timeout;Alternatively, if you prefer to keep the schema property as interactive, change the CLI flag to:
.option("--interactive", "Run in interactive mode (default).", true)🤖 Prompt for AI Agents
In src/schemas/commands/cctx.ts around line 8, the schema uses property name
"interactive" but the CLI flag produces "nonInteractive" (camelCase), and there
is no default, causing parse failures; update the schema to use nonInteractive:
z.coerce.boolean().default(false) (or rename to nonInteractive and add the
default) so the field matches the CLI flag and has a default; then update
packages/commands/src/query/cctx.ts at line 319 to use const timeout =
options.nonInteractive ? 5000 : options.timeout; ensuring the property names and
defaults are consistent.
Summary by CodeRabbit
Release Notes
New Features
--non-interactiveoption to the cctx command for customizable timeout behavior.Bug Fixes