Skip to content

feat: support non-interactive use for CI and AI agents#227

Open
LuLaValva wants to merge 1 commit into
mainfrom
claude/cli-agents-setup-z0wkt9
Open

feat: support non-interactive use for CI and AI agents#227
LuLaValva wants to merge 1 commit into
mainfrom
claude/cli-agents-setup-z0wkt9

Conversation

@LuLaValva

Copy link
Copy Markdown
Member

@marko/create and @marko/migrate hung 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

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This change adds non-interactive and agent-aware behavior to the create and migrate CLIs. packages/create/src/cli.js now supports --yes/-y, skips prompts in CI or detected agent environments, fills defaults when needed, and returns guided errors when non-interactive execution lacks required inputs. packages/migrate/src/cli.js now chooses between Enquirer prompts and a fail-fast fallback based on TTY, CI, agent detection, and --safe. Both READMEs document the new behavior, and the CI workflow updates the Node.js test matrix to 18.x, 20.x, and 22.x.

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)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: non-interactive support for CI and AI agents.
Description check ✅ Passed The description accurately summarizes the non-interactive prompt handling changes in create and migrate.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/cli-agents-setup-z0wkt9

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/migrate/src/cli.js (1)

88-96: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

isAgent() duplicated verbatim in create/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

📥 Commits

Reviewing files that changed from the base of the PR and between c66d735 and 2004647.

📒 Files selected for processing (4)
  • packages/create/README.md
  • packages/create/src/cli.js
  • packages/migrate/README.md
  • packages/migrate/src/cli.js

Comment thread packages/migrate/src/cli.js Outdated
@LuLaValva
LuLaValva force-pushed the claude/cli-agents-setup-z0wkt9 branch from 2350e12 to a29ed67 Compare July 7, 2026 17:24
@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.
@LuLaValva
LuLaValva force-pushed the claude/cli-agents-setup-z0wkt9 branch 2 times, most recently from 5b7aa4f to 6a5695a Compare July 8, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant