feat: add workspace list command and short alias#24
Conversation
Signed-off-by: Philippe Martin <phmartin@redhat.com> Co-Authored-By: Claude Code (Claude Sonnet 4.5) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a workspace command hierarchy and a reusable workspace list command. The list command initializes an instances.Manager from the global --storage flag and prints registered workspaces (or a no-workspaces message). A top-level Changes
Sequence DiagramsequenceDiagram
actor User
participant CLI as Root CLI / list
participant WkspList as workspaceListCmd
participant Manager as instances.Manager
participant Storage as Storage (fs)
User->>CLI: run "list"
CLI->>WkspList: PreRunE (read --storage, init manager)
WkspList->>Manager: New Manager(storageDir)
Manager->>Storage: read workspace configs
Storage-->>Manager: workspace instances
CLI->>WkspList: RunE (invoke list)
WkspList->>Manager: List()
Manager-->>WkspList: instances[]
WkspList->>CLI: print workspaces or "No workspaces registered"
CLI-->>User: display output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
🧹 Nitpick comments (2)
pkg/cmd/workspace_list_test.go (1)
230-231: Remove unused import workaround.The
ospackage is imported but not used in any actual test logic. Thevar _ = os.Statis dead code added solely to silence the unused import warning. Consider removing both.🧹 Proposed cleanup
import ( "bytes" - "os" "path/filepath" "strings" "testing" "github.com/kortex-hub/kortex-cli/pkg/instances" )And remove lines 230-231:
-// Ensure we don't import os without using it -var _ = os.Stat🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/cmd/workspace_list_test.go` around lines 230 - 231, Remove the dead-code workaround that silences the unused import: delete the `var _ = os.Stat` line and also remove the unused `os` entry from the import block so the `os` package is no longer imported; this cleans up the unused-import warning without adding no-op references.pkg/cmd/workspace_list.go (1)
86-86: TODO comment: Add flags as needed.This TODO indicates potential future enhancements for the list command (e.g., output format flags like
--json,--quiet, or filtering options).Would you like me to open an issue to track this enhancement, or help implement specific flags such as
--output=jsonor--quiet?🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/cmd/workspace_list.go` at line 86, The TODO about adding flags to the workspace list command should be resolved: either remove the TODO and add an issue to track enhancement, or implement common flags now (e.g., add --output/-o with values json|plain and a --quiet/-q boolean) on the command constructor (e.g., NewWorkspaceListCmd or the workspace list command variable), wire the flags into the command's Run handler to change output formatting and verbosity, validate flag values, and update help text and tests; if you prefer tracking, create an issue referencing the TODO and remove or replace the TODO with a short comment linking the issue.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@pkg/cmd/workspace_list_test.go`:
- Around line 230-231: Remove the dead-code workaround that silences the unused
import: delete the `var _ = os.Stat` line and also remove the unused `os` entry
from the import block so the `os` package is no longer imported; this cleans up
the unused-import warning without adding no-op references.
In `@pkg/cmd/workspace_list.go`:
- Line 86: The TODO about adding flags to the workspace list command should be
resolved: either remove the TODO and add an issue to track enhancement, or
implement common flags now (e.g., add --output/-o with values json|plain and a
--quiet/-q boolean) on the command constructor (e.g., NewWorkspaceListCmd or the
workspace list command variable), wire the flags into the command's Run handler
to change output formatting and verbosity, validate flag values, and update help
text and tests; if you prefer tracking, create an issue referencing the TODO and
remove or replace the TODO with a short comment linking the issue.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 62357c96-94f8-4ce3-a6eb-ad9adb9eb17b
📒 Files selected for processing (7)
pkg/cmd/list.gopkg/cmd/list_test.gopkg/cmd/root.gopkg/cmd/workspace.gopkg/cmd/workspace_list.gopkg/cmd/workspace_list_test.gopkg/cmd/workspace_test.go
Signed-off-by: Philippe Martin <phmartin@redhat.com> Co-Authored-By: Claude Code (Claude Sonnet 4.5) <noreply@anthropic.com>
benoitf
left a comment
There was a problem hiding this comment.
I was expecting a tabular view but the command works
tab rendering can come later
and probably needs first the JSON output
Adds the command
kortex-cli workspace listand an aliaskortex-cli listExample: