(deps commandDeps)
| 110 | } |
| 111 | |
| 112 | func newSkillViewCommand(deps commandDeps) *cobra.Command { |
| 113 | var filePath string |
| 114 | var workspace string |
| 115 | var agentName string |
| 116 | |
| 117 | cmd := &cobra.Command{ |
| 118 | Use: "view <name>", |
| 119 | Short: "Read a skill or one of its resource files", |
| 120 | Example: ` # Render a skill as the XML block injected into agents |
| 121 | agh skill view code-review |
| 122 | |
| 123 | # Read a resource file inside a skill directory |
| 124 | agh skill view code-review --file references/checklist.md`, |
| 125 | Args: exactOneNonBlankArg(), |
| 126 | RunE: func(cmd *cobra.Command, args []string) error { |
| 127 | return runSkillViewCommand(cmd, deps, args[0], filePath) |
| 128 | }, |
| 129 | } |
| 130 | cmd.Flags().StringVar(&filePath, "file", "", "Relative file path inside the skill directory") |
| 131 | cmd.Flags().StringVar( |
| 132 | &workspace, |
| 133 | workspaceSkillSource, |
| 134 | "", |
| 135 | "Resolve the daemon-managed skill from a workspace id, name, or path", |
| 136 | ) |
| 137 | cmd.Flags().StringVar(&agentName, "for-agent", "", "Resolve the effective skill set for one logical agent") |
| 138 | return cmd |
| 139 | } |
| 140 | |
| 141 | func runSkillViewCommand(cmd *cobra.Command, deps commandDeps, name string, filePath string) error { |
| 142 | skillName := strings.TrimSpace(name) |
no test coverage detected