Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@BilalG1
Copy link
Contributor

@BilalG1 BilalG1 commented Oct 1, 2025

High-level PR Summary

This PR replaces the --agent-mode flag with a more flexible --on-question parameter in the Stack Auth initialization tool. The new parameter allows three modes: "ask" (interactive prompts), "guess" (make assumptions without asking), and "error" (fail with clear error messages). It also improves environment variable detection for non-interactive environments, updates documentation to reflect these changes, and fixes a bug in the Next.js layout template that was incorrectly using server app instead of client app in the StackProvider. Additionally, the PR optimizes file tracing configuration in Next.js and improves error message clarity.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 packages/init-stack/src/index.ts
2 packages/init-stack/package.json
3 docs/content/setup-instructions.md
4 docs/templates/getting-started/setup.mdx
5 docs/next.config.mjs
6 docs/src/app/api/internal/[transport]/route.ts
⚠️ Inconsistent Changes Detected
File Path Warning
docs/src/app/api/internal/[transport]/route.ts Contains a variable rename from 'instructionsPath' to 'instructionsFromCurrentFile' that seems unrelated to the main PR purpose of improving the initialization tool's question handling.

Need help? Join our Discord


Important

Introduces --on-question option in init-stack for handling interactive questions, replacing --agent-mode, and updates related scripts and documentation.

  • Behavior:
    • Introduces --on-question <mode> option in init-stack to handle interactive questions with modes: ask, guess, error, default.
    • Replaces --agent-mode with --on-question in index.ts and package.json scripts.
    • Updates setup-instructions.md and setup.mdx to use --on-question error.
  • Error Handling:
    • Adds UnansweredQuestionError for handling unanswered questions in non-interactive environments in index.ts.
    • Improves error messages for missing package.json and ambiguous installation types.
  • Misc:
    • Updates next.config.mjs to include ./content/**/* in outputFileTracingIncludes.
    • Minor refactoring in route.ts for variable renaming.

This description was created by Ellipsis for 704179d. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Documentation
    • Updated setup instructions to use a flag-based non-interactive mode, replacing environment-variable guidance.
    • Added --on-question error to command examples for npx and npm install to clarify behavior when prompts occur.
    • Aligned wizard and manual Next.js installation steps for consistency.
    • No changes to product functionality; improvements are limited to clearer, more reliable setup guidance.

@vercel
Copy link

vercel bot commented Oct 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
stack-backend Error Error Oct 3, 2025 11:37am
stack-dashboard Ready Ready Preview Comment Oct 3, 2025 11:37am
stack-demo Ready Ready Preview Comment Oct 3, 2025 11:37am
stack-docs Error Error Oct 3, 2025 11:37am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

Documentation commands were updated to replace environment-variable-based non-interactive mode with the --on-question error flag in setup/install instructions across two docs files. No code, APIs, or control flow were changed.

Changes

Cohort / File(s) Summary of Changes
Docs: setup instructions
docs/content/setup-instructions.md, docs/templates/getting-started/setup.mdx
Replaced usage of environment variable (STACK_DISABLE_INTERACTIVE=1) or plain install commands with flag-based non-interactive behavior by appending --on-question error to the relevant npx/npm install commands in setup sections. No other steps modified.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • N2D4

Poem

A rabbit taps keys with delighted care,
Swaps env for flags in the morning air.
“On question: error,” the scripts now say—
Fewer surprises to hop your way.
Docs tidy, trails clear, commands run true,
Thump-thump hooray for a simpler view! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “Mcp set” does not describe any of the substantive changes in this pull request and is unrelated to replacing the --agent-mode flag with --on-question, updating documentation, or fixing the Next.js layout bug. It is too vague to convey the primary purpose of the changes. Please rename the pull request to a concise, descriptive title such as “Replace --agent-mode with --on-question in init-stack and update related docs” to clearly reflect the main changes introduced.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed The pull request description includes the required contributing guidelines comment at the top and provides a detailed high-level summary of all behavioral changes, new parameters, documentation updates, bug fixes, and configuration optimizations, matching the repository’s minimal template placeholder. It clearly outlines the PR’s scope, intent, and estimated review time, ensuring reviewers have the necessary context.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mcp-set

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.

❤️ Share

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

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ N2D4
✅ BilalG1
❌ osammotg
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR modernizes the Stack Auth CLI interface by replacing the deprecated `--agent-mode` flag with a more sophisticated `--on-question` system across the entire codebase. The change introduces three distinct modes for handling interactive prompts: 'ask' (interactive), 'guess' (automatic with defaults), and 'error' (fail on ambiguity).

The refactoring touches multiple components of the Stack Auth ecosystem:

  1. CLI Tool Enhancement: The main init-stack package now includes comprehensive environment detection for CI/CD systems (GitHub Actions, GitLab CI, Jenkins, etc.) and provides clearer error handling through a new UnansweredQuestionError class that guides users on resolution options.

  2. Security Improvements: The CLI now uses JSON.stringify() to escape user-provided values when generating code, preventing injection attacks when arguments contain quotes or special characters.

  3. Bug Fixes: Critical fixes include correcting Next.js layout file imports to use the client app instead of server app, which was causing runtime errors.

  4. Documentation Updates: All documentation and setup instructions have been updated to use the new --on-question error flag instead of the old STACK_DISABLE_INTERACTIVE=1 environment variable approach.

  5. Test Infrastructure: All automated test scripts in the package.json have been updated to use the new flag system, ensuring consistent behavior across the testing pipeline.

The changes maintain backward compatibility while providing a more intuitive and flexible interface that better serves both interactive development scenarios and automated CI/CD environments. The new system is particularly beneficial for containerized deployments and build pipelines where user interaction is impossible.

Important Files Changed

Changed Files
Filename Score Overview
packages/init-stack/src/index.ts 4/5 Major CLI refactor replacing --agent-mode with sophisticated --on-question system, adds security improvements and critical bug fixes
packages/init-stack/package.json 5/5 Updates all test scripts to use new --on-question error flag instead of deprecated --agent-mode
docs/content/setup-instructions.md 5/5 Documentation update changing from STACK_DISABLE_INTERACTIVE=1 environment variable to --on-question error CLI flag
docs/templates/getting-started/setup.mdx 5/5 Adds --on-question error flag to npm install command for better automation support
docs/src/app/api/internal/[transport]/route.ts 5/5 Minor variable rename from instructionsPath to instructionsFromCurrentFile for code clarity
docs/next.config.mjs 5/5 Consolidates outputFileTracingIncludes configuration by removing redundant API route mapping

Confidence score: 4/5

  • This PR introduces significant CLI interface changes but appears well-tested with comprehensive automated test coverage
  • Score reflects the complexity of the changes in critical CLI tooling, though the implementation appears thorough and well-considered
  • Pay close attention to the main CLI file (packages/init-stack/src/index.ts) due to its complexity and critical role in the Stack Auth setup process

Context used:

Rule - Use JSON.stringify() to escape CLI-provided values when generating code to prevent injection attacks and broken code when arguments contain quotes or special characters. (link)

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ BilalG1
✅ N2D4
❌ osammotg
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27f6a91 and 6295c36.

📒 Files selected for processing (2)
  • docs/content/setup-instructions.md (1 hunks)
  • docs/templates/getting-started/setup.mdx (1 hunks)
⏰ 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). (10)
  • GitHub Check: docker
  • GitHub Check: build (22.x)
  • GitHub Check: build (22.x)
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: restart-dev-and-test
  • GitHub Check: docker
  • GitHub Check: all-good
  • GitHub Check: setup-tests
  • GitHub Check: Vercel Agent Review
  • GitHub Check: Security Check

Comment on lines 70 to 72
```bash title="Terminal"
npm install @stackframe/stack
npm install @stackframe/stack --on-question error
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove --on-question from the npm command.

--on-question is a flag on @stackframe/init-stack, not on npm install. Including it makes the documented command fail immediately in shell (“unknown option: --on-question”), so readers can’t install the package. Please drop the flag here (or add it to the intended npx @stackframe/init-stack command instead).

-      npm install @stackframe/stack --on-question error
+      npm install @stackframe/stack
📝 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.

Suggested change
```bash title="Terminal"
npm install @stackframe/stack
npm install @stackframe/stack --on-question error
```
🤖 Prompt for AI Agents
In docs/templates/getting-started/setup.mdx around lines 70 to 72, the npm
install command incorrectly includes the --on-question flag (which belongs to
@stackframe/init-stack, not npm) causing the command to fail; remove the
--on-question token from the npm install line so it reads simply npm install
@stackframe/stack, and if the flag is needed for interactive initialization, add
it to the intended npx @stackframe/init-stack invocation instead.

@BilalG1 BilalG1 closed this Oct 3, 2025
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.

5 participants