()
| 67 | } |
| 68 | |
| 69 | func (a *App) rootCommand() *cobra.Command { |
| 70 | state := &globalState{} |
| 71 | root := &cobra.Command{ |
| 72 | Use: "cam", |
| 73 | Short: "Code Assistant Manager", |
| 74 | Long: "Code Assistant Manager (CAM) manages AI coding assistant configuration, instructions, " + |
| 75 | "skills, plugins, MCP servers, and launch commands.\n\n" + |
| 76 | "Aliases: launch/l, doctor/d, agent/ag, instruction, skill/s, plugin/pl, mcp/m, " + |
| 77 | "provider/pr, upgrade/u, install/i, uninstall/un, config/cf, completion/comp/c, version/v.", |
| 78 | Version: a.version, |
| 79 | } |
| 80 | root.SetVersionTemplate("{{.Version}}\n") |
| 81 | |
| 82 | root.PersistentFlags().StringVar(&state.configPath, "config", "", "Path to CAM config.yaml") |
| 83 | root.PersistentFlags().StringVar(&state.storePath, "store", "", "Path to SQLite state store (default: ~/.config/code-agent-manager/cam.db)") |
| 84 | root.PersistentFlags().StringVar(&state.endpoints, "endpoints", "", |
| 85 | "Print endpoint information for all tools or a specific tool") |
| 86 | root.PersistentFlags().BoolVarP(&state.debug, "debug", "d", false, |
| 87 | "Enable debug logging") |
| 88 | |
| 89 | root.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { |
| 90 | return handleEndpointsShortCircuit(cmd, state) |
| 91 | } |
| 92 | |
| 93 | root.AddCommand(a.versionCommand()) |
| 94 | root.AddCommand(a.completionCommand(root)) |
| 95 | root.AddCommand(a.launchCommand(state)) |
| 96 | root.AddCommand(a.applyCommand(state)) |
| 97 | root.AddCommand(a.doctorCommand(state)) |
| 98 | root.AddCommand(a.configCommand(state)) |
| 99 | root.AddCommand(a.providerCommand(state)) |
| 100 | root.AddCommand(a.managementCommand("agent", "ag", state)) |
| 101 | root.AddCommand(a.managementCommand("instruction", "", state)) |
| 102 | root.AddCommand(a.deprecatedPromptCommand("prompt")) |
| 103 | root.AddCommand(a.deprecatedPromptCommand("p")) |
| 104 | root.AddCommand(a.managementCommand("skill", "s", state)) |
| 105 | root.AddCommand(a.managementCommand("plugin", "pl", state)) |
| 106 | root.AddCommand(a.mcpCommand(state)) |
| 107 | root.AddCommand(a.metadataCommand(state)) |
| 108 | root.AddCommand(a.extensionsCommand()) |
| 109 | root.AddCommand(a.lifecycleCommand("upgrade", "u")) |
| 110 | root.AddCommand(a.lifecycleCommand("install", "i")) |
| 111 | root.AddCommand(a.lifecycleCommand("uninstall", "un")) |
| 112 | return root |
| 113 | } |
| 114 | |
| 115 | func (a *App) deprecatedPromptCommand(name string) *cobra.Command { |
| 116 | msg := "cam prompt was renamed to cam instruction. Use cam instruction --help." |
no test coverage detected