- Notifications
You must be signed in to change notification settings - Fork 426
feat(deploy): significantly improve agent experience (AX) with non-interactive deploy support #7552
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
…interactive support This change dramatically improves the "agent experience" (AX) for AI agents and automated tools using the deploy command: **Key Improvements:** - Added `--create [name]` flag to create and deploy sites in one command - Added `--team <slug>` flag for explicit team selection when creating sites - Intelligent team handling: auto-use single team, require explicit selection for multiple teams - Comprehensive help text with copy-pasteable commands shown at every interactive prompt - Proper command parsing with optional site names (`--create` vs `--create sitename`) **Agent Flow Example:** Before: Agents got stuck in interactive menus when deploying new projects After: Agents can successfully deploy with: `netlify deploy --create my-site --team my-team --dir . --prod` **Interactive Improvements:** - Show copy-pasteable commands before every prompt - Context-aware help text (includes current flags like --prod, --dir, etc.) - Better team selection messaging when multiple teams available - Cleaner help text when only one team available **Validation & Error Handling:** - Proper TypeScript types for new flags (`create?: string | boolean`) - Validation that --team only works with --create - Clear error messages with actionable examples - Smart fallbacks for single vs multiple team scenarios This maintains full backward compatibility while enabling seamless automated deployments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
📊 Benchmark resultsComparing with bd4e641
|
Removed duplicate command generation logic in prepareProductionDeploy by reusing the shared generateDeployCommand helper function. This improves maintainability and ensures consistent command generation across all scenarios. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…nstructions - Removed emojis from all help text messages for cleaner CLI output - Fixed locked deployment instructions to use --prod-if-unlocked flag instead of manual unlock - Added proper warning about only using --prod-if-unlocked when absolutely sure - Updated generateDeployCommand to support prodIfUnlocked flag 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…options Refactored generateDeployCommand to derive available flags from the actual Commander.js command definition instead of maintaining a hardcoded flagMap. This approach: - Eliminates manual flag mapping maintenance - Automatically includes new flags as they're added to the command - Uses command.options to introspect actual option definitions - Handles all option types (string, number, boolean) correctly - Maintains special handling for quoted message values The function now dynamically builds commands from the live command definition, making it more maintainable and less prone to drift. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Removed unnecessary filtering of hidden and deprecated options from generateDeployCommand. If users included these flags in their original command, they should be preserved in the copyable command for consistency. This ensures the generated command exactly matches what the user originally attempted to run. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The teams command is not needed since the deploy command now properly handles team selection with clear error messages that list available teams when multiple teams are present. This simplifies the codebase while maintaining all necessary functionality for both interactive and non-interactive team selection. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Also saw in testing that if I run netlify deploy --create <SITE_NAME> --team <TEAM_SLUG>
in a directory that already has a linked site in state.json
it doesn't create a new site, it deploys to the linked site (and doesn't create a new one). I think having these options set should override the saved state config
Change the --create flag to --create-site in the deploy command to make the flag name more explicit and descriptive. This improves clarity about what the flag does when creating new sites during deployment. Changes: - Rename --create flag to --create-site in command definition - Update all option references from options.create to options.createSite - Update help text and examples to use new flag name - Update TypeScript types to reflect the change - Maintain existing functionality and validation logic 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Change error handling from explicit .catch() with process.exit(1) back to simple top-level await. This removes the explicit fatal error logging and process exit, allowing errors to bubble up naturally. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ted commands Fix the generateDeployCommand function to properly handle Commander.js negatable boolean options. Previously, both --build and --no-build flags were being added to generated command suggestions, causing confusing output like "netlify deploy --create-site <NAME> --build --no-build". Changes: - Add special handling for the 'build' option to only show --no-build when build is false - Skip processing the --no-build option separately since it's handled with build logic - Add flag deduplication to prevent any duplicate flags in generated commands - Maintain clean command suggestions without redundant or conflicting flags This ensures users get clean, actionable command suggestions without conflicting flags that would cause command errors. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
… flag handling Replace complex special-case logic with clean, generic handling for any --no-* flags. Only include negated flags when explicitly used by the user (value === false). Remove verbose comments and deduplication logic in favor of preventing issues at the source. Changes: - Generic handling for all --no-* flags instead of hardcoding --no-build - Remove special build flag logic and deduplication - Clean up verbose comments for better code readability - Maintain functionality: include --no-build only when user specifies it 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Replace complex nested if/else chains with clean, single-purpose functions. The site creation logic was deeply nested with multiple levels of branching that was hard to follow and maintain. Changes: - Extract ensureSiteExists() as main entry point with clear branching - Add createSiteWithFlags() for --create-site flag handling - Add validateTeamForSiteCreation() for team validation logic - Add promptForSiteAction() for interactive site selection - Use early returns to eliminate nesting levels - Remove verbose comments in favor of self-documenting code Results in cleaner, more testable code with the same functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ions Fix ESLint errors introduced in the site creation logic refactor: - Use optional chaining for option.long?.startsWith() - Replace any types with proper TypeScript types ($TSFixMe, SiteInfo) - Ensure all code follows project linting standards 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Just the one comment re: presentation with a ⇄
char otherwise LGTM. I believe you'll have to update some snapshots / tests in deploy
might not be quite right at the moment
Apply prettier formatting to files that were not properly formatted. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Update the help command snapshot to reflect the new deploy command description that was changed from 'Create a new deploy from the contents of a folder' to 'Deploy your project to Netlify'. This fixes the failing CI/CD integration tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Apply prettier formatting to resolve code style warnings. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Update auto-generated documentation to reflect: - New deploy command description: 'Deploy your project to Netlify' - Added --create-site flag documentation - Added --team flag documentation - Updated examples with new flag usage - Improved command description and help text Generated via: npm run docs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary
This PR significantly improves the Agent Experience (AX) of the
netlify deploy
command, enabling AI agents and automated tools to successfully deploy new projects without getting stuck in interactive menus.Problem
Previously, agents using
netlify deploy
would get stuck when:Solution
New Flags
--create [name]
: Create a new site and deploy in one command--create my-site
or just--create
for random name--team <slug>
: Explicit team selection when creating sitesIntelligent Help Text
--team
flag when multiple teams availableValidation & Error Handling
create?: string | boolean
)Agent Success Example
This session with Claude Code demonstrates the improved flow:
Key Behaviors
Before (Blocking)
After (Non-blocking)
Backward Compatibility
Test Coverage
This change enables seamless automated deployments while maintaining the excellent interactive experience for human users.