-
Notifications
You must be signed in to change notification settings - Fork 7
Add project delete in headless mode #402
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
WalkthroughThe command-line project deletion command was updated to accept project IDs as arguments and introduces a Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant ProjectAPI
User->>CLI: Run project delete [projectID(s)] [--force]
alt Project IDs provided
alt --force flag set
CLI->>ProjectAPI: Delete specified projects (no confirmation)
else --force not set
CLI->>User: Prompt for confirmation
User->>CLI: Confirm or cancel
alt Confirmed
CLI->>ProjectAPI: Delete specified projects
else Cancelled
CLI->>User: Operation cancelled
end
end
else No project IDs provided
CLI->>ProjectAPI: Fetch list of projects
CLI->>User: Show interactive project selection UI
User->>CLI: Select projects
CLI->>User: Prompt for confirmation (unless --force)
User->>CLI: Confirm or cancel
alt Confirmed
CLI->>ProjectAPI: Delete selected projects
else Cancelled
CLI->>User: Operation cancelled
end
end
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
✨ Finishing Touches
🧪 Generate Unit Tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 0
🧹 Nitpick comments (1)
cmd/project.go (1)
813-816: Remove unused variable assignment.The static analysis tool correctly identified that
descis assigned but never used in the option construction. This creates unnecessary computation and potential confusion.Apply this diff to remove the unused assignment:
for _, project := range projects { - desc := project.Description - if desc == "" { - desc = emptyProjectDescription - } options = append(options, tui.Option{ ID: project.ID, Text: tui.Bold(tui.PadRight(project.Name, 20, " ")) + tui.Muted(project.ID), })
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cmd/project.go(2 hunks)internal/ignore/rules.go(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
cmd/project.go (1)
internal/project/project.go (1)
ProjectListData(298-304)
🪛 golangci-lint (1.64.8)
cmd/project.go
815-815: ineffectual assignment to desc
(ineffassign)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (go)
- GitHub Check: Test CLI Upgrade Path (windows-latest)
🔇 Additional comments (5)
internal/ignore/rules.go (1)
96-96: LGTM! Good addition of macOS system file ignore pattern.Adding
.DS_Storeto the default ignore patterns is a wise decision as these are macOS-specific metadata files that should typically be excluded from project operations.cmd/project.go (4)
801-834: LGTM! Clean implementation of headless mode support.The logic elegantly handles both headless (argument-based) and interactive modes:
- When project IDs are provided as arguments, they're used directly
- Falls back to the existing interactive multi-select UI when no arguments are given
- Maintains full backward compatibility
This aligns perfectly with the PR objective of adding headless project deletion.
836-841: LGTM! Proper force flag implementation.The force flag implementation correctly:
- Skips the confirmation prompt when
--forceis specified- Maintains the existing confirmation flow for safety when force is not used
- Provides clear feedback when deletion is cancelled
This follows standard CLI patterns and enhances usability for automation scenarios.
845-845: LGTM! Good refactoring for spinner integration.Wrapping the deletion logic in an
actionvariable improves code organization and readability while maintaining the same functionality.
967-967: LGTM! Proper flag definition for force option.The
--forceflag is correctly defined with appropriate description for skipping confirmation prompts.
Summary by CodeRabbit
New Features
--forceflag to skip confirmation prompts when deleting projects.Improvements
Chores
.DS_Storefiles.