feat: support non-interactive use for CI and AI agents#227
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis change adds non-interactive and agent-aware behavior to the create and migrate CLIs. Related PRs: None identified from provided information. Suggested labels: cli, documentation, ci Suggested reviewers: None identified from provided information. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/migrate/src/cli.js (1)
88-96: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
isAgent()duplicated verbatim increate/cli.js.Same implementation exists in
packages/create/src/cli.js(per context snippet 2). Could be extracted to a shared internal utility if a common location exists, though low priority given the small size.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/migrate/src/cli.js` around lines 88 - 96, The isAgent() helper is duplicated verbatim in both CLI entrypoints, so extract the shared environment check into a common internal utility and reuse it from packages/migrate/src/cli.js and packages/create/src/cli.js. Keep the boolean logic and env var list in one place, then update both call sites to import the shared helper so the two CLIs stay in sync.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/migrate/src/cli.js`:
- Around line 103-104: Move the interactive check into run() in cli.js instead
of keeping it as a module-level constant, since Boolean(process.stdin.isTTY) &&
!process.env.CI && !isAgent() is currently evaluated only at import time. Update
the run() flow to compute interactive at call time, mirroring
packages/create/src/cli.js, so repeated run() calls and tests respect the
current stdin and CI state.
---
Nitpick comments:
In `@packages/migrate/src/cli.js`:
- Around line 88-96: The isAgent() helper is duplicated verbatim in both CLI
entrypoints, so extract the shared environment check into a common internal
utility and reuse it from packages/migrate/src/cli.js and
packages/create/src/cli.js. Keep the boolean logic and env var list in one
place, then update both call sites to import the shared helper so the two CLIs
stay in sync.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7cb9c44c-f958-42dd-b354-5275d51897e7
📒 Files selected for processing (4)
packages/create/README.mdpackages/create/src/cli.jspackages/migrate/README.mdpackages/migrate/src/cli.js
2350e12 to
a29ed67
Compare
@marko/create and @marko/migrate hung when no human was available to answer their interactive prompts (AI agent, CI, or piped input). They now detect non-interactive sessions and fall back to defaults (or clear guidance) instead of blocking; behavior in a real terminal is unchanged. - create: skip the prompts and default the name to "my-app" and the template to the starter app when an agent is detected (CLAUDECODE/CURSOR_TRACE_ID/AGENT), CI is set, or --yes/-y is passed (even with a pseudo-TTY). On a non-TTY with none of those, fail fast with guidance instead of guessing; exit non-zero on failure. - migrate: run the automatic migrations and, instead of hanging when a prompt is required, fail with guidance to re-run with --safe. - Document the behavior in both package READMEs.
5b7aa4f to
6a5695a
Compare
@marko/createand@marko/migratehung on interactive prompts under CI/AI agents/piped input. They now detect non-interactive sessions and fall back to defaults (or clear guidance) instead of blocking. Interactive terminal behavior is unchanged.Generated by Claude Code