|
| 1 | +package cli |
| 2 | + |
| 3 | +import ( |
| 4 | + "encoding/json" |
| 5 | + "fmt" |
| 6 | + "strconv" |
| 7 | + |
| 8 | + "github.com/itk-dev/itkdev-claude-code/internal/config" |
| 9 | + "github.com/spf13/cobra" |
| 10 | +) |
| 11 | + |
| 12 | +var infoCmd = &cobra.Command{ |
| 13 | + Use: "info", |
| 14 | + Short: "Show capabilities, hooks, commands, and MCP tools", |
| 15 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 16 | + out := cmd.OutOrStdout() |
| 17 | + info := buildInfo() |
| 18 | + |
| 19 | + if jsonOutput { |
| 20 | + return json.NewEncoder(out).Encode(info) |
| 21 | + } |
| 22 | + |
| 23 | + fmt.Fprintf(out, "%s v%s\n\n", info.Name, info.Version) |
| 24 | + |
| 25 | + fmt.Fprintln(out, "Features:") |
| 26 | + for _, f := range info.Features { |
| 27 | + fmt.Fprintf(out, " %-18s %s\n", f.Name, f.Description) |
| 28 | + } |
| 29 | + |
| 30 | + fmt.Fprintln(out) |
| 31 | + fmt.Fprintln(out, "Commands:") |
| 32 | + for _, c := range info.Commands { |
| 33 | + fmt.Fprintf(out, " %-18s %s\n", c.Name, c.Description) |
| 34 | + } |
| 35 | + |
| 36 | + fmt.Fprintln(out) |
| 37 | + fmt.Fprintln(out, "Hooks:") |
| 38 | + for _, h := range info.Hooks { |
| 39 | + fmt.Fprintf(out, " %-18s %s\n", h.Name, h.Description) |
| 40 | + } |
| 41 | + |
| 42 | + fmt.Fprintln(out) |
| 43 | + fmt.Fprintln(out, "MCP Tools:") |
| 44 | + for _, m := range info.MCPTools { |
| 45 | + fmt.Fprintf(out, " %-18s %s\n", m.Name, m.Description) |
| 46 | + } |
| 47 | + |
| 48 | + fmt.Fprintln(out) |
| 49 | + fmt.Fprintln(out, "Skills:") |
| 50 | + for _, s := range info.Skills { |
| 51 | + fmt.Fprintf(out, " %-18s %s\n", s.Name, s.Description) |
| 52 | + } |
| 53 | + |
| 54 | + fmt.Fprintln(out) |
| 55 | + fmt.Fprintf(out, "Console: http://localhost:%s\n", strconv.Itoa(config.DefaultPort)) |
| 56 | + fmt.Fprintf(out, "Docs: docs/usage.md\n") |
| 57 | + |
| 58 | + return nil |
| 59 | + }, |
| 60 | +} |
| 61 | + |
| 62 | +// InfoData holds all capability information for JSON output. |
| 63 | +type InfoData struct { |
| 64 | + Name string `json:"name"` |
| 65 | + Version string `json:"version"` |
| 66 | + Features []InfoEntry `json:"features"` |
| 67 | + Commands []InfoEntry `json:"commands"` |
| 68 | + Hooks []InfoEntry `json:"hooks"` |
| 69 | + MCPTools []InfoEntry `json:"mcp_tools"` |
| 70 | + Skills []InfoEntry `json:"skills"` |
| 71 | +} |
| 72 | + |
| 73 | +// InfoEntry is a name-description pair used across all info sections. |
| 74 | +type InfoEntry struct { |
| 75 | + Name string `json:"name"` |
| 76 | + Description string `json:"description"` |
| 77 | +} |
| 78 | + |
| 79 | +func buildInfo() InfoData { |
| 80 | + return InfoData{ |
| 81 | + Name: config.DisplayName, |
| 82 | + Version: config.Version(), |
| 83 | + Features: []InfoEntry{ |
| 84 | + {"Quality Hooks", "Lint, format, and TDD enforcement on every edit"}, |
| 85 | + {"Context Mgmt", "Context monitor with Endless Mode at 90%"}, |
| 86 | + {"Memory", "Persistent observations with semantic search"}, |
| 87 | + {"Workflows", "/spec (plan → implement → verify)"}, |
| 88 | + {"Web Console", "Observations, sessions, plans, and search"}, |
| 89 | + {"Worktree", "Git worktree isolation for safe parallel work"}, |
| 90 | + }, |
| 91 | + Commands: []InfoEntry{ |
| 92 | + {"icc run", "Launch Claude Code with hooks and memory"}, |
| 93 | + {"icc install", "Set up project configuration"}, |
| 94 | + {"icc serve", "Standalone console server"}, |
| 95 | + {"icc info", "Show this capabilities reference"}, |
| 96 | + {"icc greet", "Print the welcome banner"}, |
| 97 | + {"icc worktree", "Git worktree management"}, |
| 98 | + {"icc session list", "List sessions"}, |
| 99 | + {"icc check-context", "Show current context usage"}, |
| 100 | + {"icc send-clear", "Send clear signal to session"}, |
| 101 | + }, |
| 102 | + Hooks: []InfoEntry{ |
| 103 | + {"file-checker", "Language-aware lint and format on file writes"}, |
| 104 | + {"tdd-enforcer", "Enforce test-first development order"}, |
| 105 | + {"branch-guard", "Prevent direct commits to main"}, |
| 106 | + {"context-monitor", "Track context usage, trigger Endless Mode"}, |
| 107 | + {"tool-redirect", "Block or redirect tool calls"}, |
| 108 | + {"spec-stop-guard", "Prevent premature stop during /spec"}, |
| 109 | + {"spec-plan-validator", "Validate plan file structure"}, |
| 110 | + {"spec-verify-validator", "Validate verification results"}, |
| 111 | + {"task-tracker", "Track task creation and updates"}, |
| 112 | + {"notify", "Desktop notifications on stop"}, |
| 113 | + }, |
| 114 | + MCPTools: []InfoEntry{ |
| 115 | + {"search", "Semantic search across observations"}, |
| 116 | + {"save_memory", "Save observations to persistent memory"}, |
| 117 | + {"timeline", "Get chronological observation context"}, |
| 118 | + {"get_observations", "Retrieve observations by filter"}, |
| 119 | + }, |
| 120 | + Skills: []InfoEntry{ |
| 121 | + {"/spec", "Plan, implement, and verify with TDD"}, |
| 122 | + {"/spec-plan", "Planning phase only"}, |
| 123 | + {"/spec-implement", "Implementation phase only"}, |
| 124 | + {"/spec-verify", "Verification phase only"}, |
| 125 | + {"/itkdev-issue-workflow", "Autonomous GitHub issue workflow"}, |
| 126 | + }, |
| 127 | + } |
| 128 | +} |
| 129 | + |
| 130 | +func init() { |
| 131 | + rootCmd.AddCommand(infoCmd) |
| 132 | +} |
0 commit comments