-
Notifications
You must be signed in to change notification settings - Fork 498
Mcp set #920
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
Conversation
Apply suggested changes
This reverts commit 5904fe3.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughDocumentation 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
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests
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.
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:
-
CLI Tool Enhancement: The main
init-stackpackage now includes comprehensive environment detection for CI/CD systems (GitHub Actions, GitLab CI, Jenkins, etc.) and provides clearer error handling through a newUnansweredQuestionErrorclass that guides users on resolution options. -
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. -
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.
-
Documentation Updates: All documentation and setup instructions have been updated to use the new
--on-question errorflag instead of the oldSTACK_DISABLE_INTERACTIVE=1environment variable approach. -
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
|
|
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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
| ```bash title="Terminal" | ||
| npm install @stackframe/stack | ||
| npm install @stackframe/stack --on-question error | ||
| ``` |
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.
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.
| ```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.
High-level PR Summary
This PR replaces the
--agent-modeflag with a more flexible--on-questionparameter 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
packages/init-stack/src/index.tspackages/init-stack/package.jsondocs/content/setup-instructions.mddocs/templates/getting-started/setup.mdxdocs/next.config.mjsdocs/src/app/api/internal/[transport]/route.tsdocs/src/app/api/internal/[transport]/route.tsImportant
Introduces
--on-questionoption ininit-stackfor handling interactive questions, replacing--agent-mode, and updates related scripts and documentation.--on-question <mode>option ininit-stackto handle interactive questions with modes:ask,guess,error,default.--agent-modewith--on-questioninindex.tsandpackage.jsonscripts.setup-instructions.mdandsetup.mdxto use--on-question error.UnansweredQuestionErrorfor handling unanswered questions in non-interactive environments inindex.ts.package.jsonand ambiguous installation types.next.config.mjsto include./content/**/*inoutputFileTracingIncludes.route.tsfor variable renaming.This description was created by
for 704179d. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit