(deps commandDeps)
| 253 | } |
| 254 | |
| 255 | func newSkillInfoCommand(deps commandDeps) *cobra.Command { |
| 256 | var workspace string |
| 257 | var agentName string |
| 258 | |
| 259 | cmd := &cobra.Command{ |
| 260 | Use: skillCommandsInfoNameValue, |
| 261 | Short: "Show detailed metadata for one skill", |
| 262 | Example: ` # Inspect a skill's metadata and resource list |
| 263 | agh skill info code-review`, |
| 264 | Args: exactOneNonBlankArg(), |
| 265 | RunE: func(cmd *cobra.Command, args []string) error { |
| 266 | scope, err := resolveSkillCommandScope(cmd.Context(), cmd, deps, agentActionCLI("skill.info")) |
| 267 | if err != nil { |
| 268 | return err |
| 269 | } |
| 270 | if scope.useDaemon { |
| 271 | client, err := clientFromDeps(deps) |
| 272 | if err != nil { |
| 273 | return err |
| 274 | } |
| 275 | record, err := client.GetSkill( |
| 276 | cmd.Context(), |
| 277 | args[0], |
| 278 | scope.query, |
| 279 | ) |
| 280 | if err != nil { |
| 281 | return err |
| 282 | } |
| 283 | return writeCommandOutput(cmd, skillInfoBundle(skillInfoItemFromRecord(record))) |
| 284 | } |
| 285 | |
| 286 | ctx, err := loadSkillCommandContext(cmd.Context(), deps, scope.query.ForAgent) |
| 287 | if err != nil { |
| 288 | return err |
| 289 | } |
| 290 | |
| 291 | skill, err := findSkillByName(ctx.skills, args[0]) |
| 292 | if err != nil { |
| 293 | return err |
| 294 | } |
| 295 | |
| 296 | resources, err := listSkillResources(skill, ctx.bundledFS) |
| 297 | if err != nil { |
| 298 | return err |
| 299 | } |
| 300 | |
| 301 | item := skillInfoItemFromSkill(skill, resources, cliNow(deps.now)) |
| 302 | |
| 303 | return writeCommandOutput(cmd, skillInfoBundle(item)) |
| 304 | }, |
| 305 | } |
| 306 | cmd.Flags().StringVar( |
| 307 | &workspace, |
| 308 | workspaceSkillSource, |
| 309 | "", |
| 310 | "Resolve the daemon-managed skill from a workspace id, name, or path", |
| 311 | ) |
| 312 | cmd.Flags().StringVar(&agentName, "for-agent", "", "Resolve the effective skill set for one logical agent") |
no test coverage detected