-
-
Notifications
You must be signed in to change notification settings - Fork 763
feat(cli): add --print-url flag to promptfoo view (implies no auto-open) #6071
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
📝 WalkthroughWalkthroughThis pull request adds a new Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Areas to review:
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
📒 Files selected for processing (2)
CHANGELOG.md(1 hunks)src/commands/view.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
CHANGELOG.md
📄 CodeRabbit inference engine (.cursor/rules/changelog.mdc)
CHANGELOG.md: Document all user-facing changes in CHANGELOG.md
Every pull request must add or update an entry in CHANGELOG.md under the [Unreleased] section
Follow Keep a Changelog structure under [Unreleased] with sections: Added, Changed, Fixed, Dependencies, Documentation, Tests, Removed
Each changelog entry must include the PR number formatted as (#1234) or temporary placeholder (#XXXX)
Each changelog entry must use a Conventional Commit prefix: feat:, fix:, chore:, docs:, test:, or refactor:
Each changelog entry must be concise and on a single line
Each changelog entry must be user-focused, describing what changed and why it matters to users
Each changelog entry must include a scope in parentheses, e.g., feat(providers): or fix(evaluator):
Use common scopes for consistency: providers, evaluator, webui or app, cli, redteam, core, assertions, config, database
Place all dependency updates under the Dependencies category
Place all test changes under the Tests category
Use categories consistently: Added for new features, Changed for modifications/refactors/CI, Fixed for bug fixes, Removed for removed features
After a PR number is assigned, replace (#XXXX) placeholders with the actual PR number
Be specific, use active voice, include context, and avoid repeating the PR title in changelog entries
Group related changes with multiple bullets in the same category when needed; use one entry per logical change
CHANGELOG.md: All user-facing changes require a CHANGELOG.md entry before creating a PR
Add entries under [Unreleased] in appropriate category (Added, Changed, Fixed, Dependencies, Documentation, Tests)
Each changelog entry must include PR number (#1234) or placeholder (#XXXX)
Use conventional commit prefixes in changelog entries (feat:, fix:, chore:, docs:, test:, refactor:)
CHANGELOG.md: Document all user-facing changes in CHANGELOG.md
Changelog entries must include the PR number in format (#1234)
Use conventional commit prefixes in changelog entries: feat:,...
Files:
CHANGELOG.md
src/commands/**/*.ts
📄 CodeRabbit inference engine (src/commands/CLAUDE.md)
src/commands/**/*.ts: Record telemetry at the start of each command action using telemetry.record('command_used', ...)
Validate user inputs with Zod schemas before use; log and exit early on validation failure
On errors in command handlers, log the error and set process.exitCode = 1; do not throw errors
Do not call process.exit() directly in commands; use process.exitCode instead
Define commands as functions that register with Commander.js and use .command().description().option().action()
Use Commander's .option() for flags and provide clear descriptions for commands and options
Call setupEnv() with the provided env path before command logic when applicable
Return early on errors from action handlers after setting exitCode (avoid continuing execution)
Files:
src/commands/view.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/gh-cli-workflow.mdc)
Prefer not to introduce new TypeScript types; reuse existing interfaces where possible
**/*.{ts,tsx}: Maintain consistent import order (Biome handles sorting)
Use consistent curly braces for all control statements
Prefer const over let and avoid var
Use object shorthand syntax when possible
Use async/await for asynchronous code
Use consistent error handling with proper type checks
**/*.{ts,tsx}: Use TypeScript with strict type checking enabled
Follow consistent import order (Biome will sort imports)
Use consistent curly braces for all control statements
Prefer const over let; avoid var
Use object property shorthand when possible
Use async/await for asynchronous code instead of raw promises/callbacks
When logging, pass sensitive data via the logger context object so it is auto-sanitized; avoid interpolating secrets into message strings
Manually sanitize sensitive objects with sanitizeObject before storing or emitting outside logging contexts
Files:
src/commands/view.ts
src/**
📄 CodeRabbit inference engine (AGENTS.md)
Place core application/library logic under src/
Files:
src/commands/view.ts
🧬 Code graph analysis (1)
src/commands/view.ts (1)
src/constants.ts (1)
getDefaultPort(39-41)
🔇 Additional comments (2)
src/commands/view.ts (2)
19-19: LGTM: Clear option declaration.The
--print-urloption is properly declared with a clear description that communicates the behavior to users.
27-27: LGTM: Appropriate type addition.The optional
printUrlproperty is correctly typed and follows the pattern of other CLI flag properties.
| ### Added | ||
|
|
||
| - feat(redteam): add goal-misalignment plugin for detecting Goodhart's Law vulnerabilities (#6045) | ||
| - feat(cli): add `--print-url` flag to `promptfoo view` to print the local web UI URL without opening a browser |
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.
Missing PR number and user-focused phrasing
Add the PR reference and tighten wording per changelog rules. Also include contributor attribution for consistency.
Apply this diff:
-- feat(cli): add `--print-url` flag to `promptfoo view` to print the local web UI URL without opening a browser
+- feat(cli): `promptfoo view --print-url` prints the viewer URL to stdout and skips browser auto-open; useful in CI/headless runs (#6071) by @iitslamaaAs per coding guidelines.
📝 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.
| - feat(cli): add `--print-url` flag to `promptfoo view` to print the local web UI URL without opening a browser | |
| - feat(cli): `promptfoo view --print-url` prints the viewer URL to stdout and skips browser auto-open; useful in CI/headless runs (#6071) by @iitslamaa |
🤖 Prompt for AI Agents
In CHANGELOG.md around line 12, the entry lacks a PR reference, contributor
attribution, and user-focused wording; update the line to include the merged PR
number in parentheses (e.g., "(#NNNN)"), rephrase to a user-centric description
(e.g., "Add --print-url to promptfoo view to print the local web UI URL without
opening a browser"), and append contributor attribution (e.g., "Contributed by
@username") to follow changelog guidelines.
|
hey @mldangelo — this is ready. if alls good, i can update the docs to include it too. |
Adds
--print-urltopromptfoo view. Prints the viewer URL to stdout and does not auto-open a browser.--print-urlimplies no auto-open behavior