(deps commandDeps)
| 119 | } |
| 120 | |
| 121 | func newWorkspaceInfoCommand(deps commandDeps) *cobra.Command { |
| 122 | var workspaceRef string |
| 123 | cmd := &cobra.Command{ |
| 124 | Use: "info [name-or-id]", |
| 125 | Short: "Show one workspace with resolved details", |
| 126 | Example: ` # Show workspace paths, agents, and skills by name |
| 127 | agh workspace info checkout-api |
| 128 | |
| 129 | # Resolve the current directory as a workspace |
| 130 | agh workspace info |
| 131 | |
| 132 | # Emit resolved workspace details as JSON |
| 133 | agh workspace info ws_1234 -o json`, |
| 134 | Args: cobra.RangeArgs(0, 1), |
| 135 | RunE: func(cmd *cobra.Command, args []string) error { |
| 136 | client, err := clientFromDeps(deps) |
| 137 | if err != nil { |
| 138 | return err |
| 139 | } |
| 140 | |
| 141 | resolved, err := resolveWorkspaceInfoRef(deps, args, workspaceRef) |
| 142 | if err != nil { |
| 143 | return err |
| 144 | } |
| 145 | detail, err := client.GetWorkspace(cmd.Context(), resolved.Ref) |
| 146 | if err != nil { |
| 147 | return err |
| 148 | } |
| 149 | return writeCommandOutput(cmd, workspaceDetailBundle(detail, resolved.Source)) |
| 150 | }, |
| 151 | } |
| 152 | cmd.Flags(). |
| 153 | StringVar( |
| 154 | &workspaceRef, |
| 155 | workspaceSkillSource, |
| 156 | "", |
| 157 | "Workspace root/name/id to inspect when no positional ref is supplied", |
| 158 | ) |
| 159 | return cmd |
| 160 | } |
| 161 | |
| 162 | type workspaceInfoRef struct { |
| 163 | Ref string |
no test coverage detected