MCPcopy Create free account
hub / github.com/compozy/agh / newWorkspaceInfoCommand

Function newWorkspaceInfoCommand

internal/cli/workspace.go:121–160  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

119}
120
121func 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
162type workspaceInfoRef struct {
163 Ref string

Callers 1

newWorkspaceCommandFunction · 0.85

Calls 5

clientFromDepsFunction · 0.85
resolveWorkspaceInfoRefFunction · 0.85
writeCommandOutputFunction · 0.85
workspaceDetailBundleFunction · 0.85
GetWorkspaceMethod · 0.65

Tested by

no test coverage detected