|
1 | 1 | # code-assistant-manager |
2 | 2 |
|
3 | | -Unified Python CLI for AI coding assistants — a focused, concise guide. |
| 3 | +<div align="center"> |
4 | 4 |
|
5 | | -Overview |
| 5 | +[](https://pypi.org/project/code-assistant-manager/) |
| 6 | +[](https://opensource.org/licenses/MIT) |
| 7 | +[](https://pypi.org/project/code-assistant-manager/) |
6 | 8 |
|
7 | | -code-assistant-manager provides a single CLI to access multiple AI coding assistants (Claude, Codex, Qwen, GitHub Copilot, and more). It offers interactive model selection, configurable endpoints, secure environment management, MCP server integration, **prompt and skill management**, and a polished terminal UI. |
| 9 | +**Unified Python CLI for AI Coding Assistants** |
| 10 | +<br> |
| 11 | +Manage Claude, Codex, Gemini, Qwen, and more from a single, polished terminal interface. |
8 | 12 |
|
9 | | -Deep analysis of this repository (developer-focused) |
| 13 | +[Quick Start](#quick-start) • [Features](#core-features) • [Interactive Mode](#interactive-mode) • [Commands](#subcommands-reference) • [MCP Support](#model-context-protocol-mcp) • [Contributing](#contributing) |
10 | 14 |
|
11 | | -This section is intended to give contributors and maintainers a clear, practical understanding of the repository layout, architecture, important files, runtime behavior, and recommended workflows for development and release. |
| 15 | +</div> |
12 | 16 |
|
13 | | -Repository layout |
| 17 | +--- |
14 | 18 |
|
15 | | -- code_assistant_manager/ — main Python package implementing the CLI, tools registry, MCP support, menus and utilities. |
16 | | - - cli.py: Main Typer-based CLI and legacy compatibility layer. Key commands: launch, upgrade/install, uninstall, doctor, completion. (file: code_assistant_manager/cli.py) |
17 | | - - __init__.py: Package metadata and __version__. |
18 | | - - prompts.py: Prompt management for AI assistants. |
19 | | - - skills.py: Skill management for AI assistants. |
20 | | - - tools/: Tool implementations and CLITool interface. |
21 | | - - mcp/: MCP subsystem with manager, CLI, server registry JSONs. (files: code_assistant_manager/mcp/manager.py, server_commands.py, cli.py, registry/servers/*.json) |
22 | | - - menu/: Terminal UI components and centered menus used to select tools interactively. |
23 | | - - config.py, env_loader.py: Configuration parsing and .env helper utilities. |
24 | | - - list_models_cmd supports three forms now: (1) a python module invocation (e.g. "python -m code_assistant_manager.litellm_models"), (2) legacy shell commands (e.g. "curl ... | jq -r '.data.[].id'"), and (3) a plain space-separated model list (e.g. "qwen3-max qwen3-coder-plus"). |
| 19 | +## Core Features |
25 | 20 |
|
26 | | -- tests/: Pytest test suite (unit, integration, interactive). Test configuration in pytest.ini. Run with: python -m pytest tests/ |
| 21 | +* **Unified CLI:** One tool (`cam`) to manage multiple AI assistants. |
| 22 | +* **Interactive Menus:** Polished TUI for model selection and tool launching. |
| 23 | +* **Prompt Management:** Fetch, sync, and manage system prompts across different assistants. |
| 24 | +* **Skill Management:** Install and manage "skills" (tool definitions) for your AI agents. |
| 25 | +* **MCP Integration:** Full support for the Model Context Protocol (MCP) - manage servers and tools. |
| 26 | +* **Diagnostics:** Built-in `doctor` command to check environment health. |
| 27 | +* **Extensible:** Easy to add new models and providers via LiteLLM. |
27 | 28 |
|
28 | | -- docs/: Supporting documentation (developer guides, API docs, testing notes). |
| 29 | +## Quick Start |
29 | 30 |
|
30 | | -- tools.yaml: Tool installation and environment setup metadata used by the upgrade/install flows. |
| 31 | +### Installation |
31 | 32 |
|
32 | | -Key files and responsibilities |
| 33 | +```bash |
| 34 | +pip install code-assistant-manager |
| 35 | +``` |
33 | 36 |
|
34 | | -- pyproject.toml and setup.py: Packaging metadata and entry points for the CLIs (code-assistant-manager, cam). Prefer pyproject as source-of-truth for modern builds, setup.py exists for compatibility. |
| 37 | +### Basic Usage |
35 | 38 |
|
36 | | -- README.md (this file): User-facing quick-start and developer deep analysis (this section). |
| 39 | +Launch the interactive menu: |
37 | 40 |
|
38 | | -- docs/PROMPTS_AND_SKILLS.md: Guide for managing prompts and skills. |
| 41 | +```bash |
| 42 | +cam launch |
| 43 | +``` |
39 | 44 |
|
40 | | -- docs/INSTALL.md: Detailed installation options and scripts. |
| 45 | +## Interactive Mode |
41 | 46 |
|
42 | | -- docs/CLAUDE.md: Repository guidelines for AI-assisted edits. Important: follow these when creating AI-generated changes. |
| 47 | +The easiest way to use CAM is through the interactive launcher: |
43 | 48 |
|
44 | | -- pytest.ini: Configures test discovery and pytest run options. |
| 49 | +```bash |
| 50 | +cam launch |
| 51 | +``` |
| 52 | +This opens a centered menu where you can: |
| 53 | +* **Select Model:** Choose the active LLM model for your sessions. |
| 54 | +* **Launch Assistant:** Start specific assistants (Claude, Codex, etc.) with the selected configuration. |
| 55 | +* **Manage Settings:** Configure API keys and other preferences. |
45 | 56 |
|
46 | | -Entrypoints and CLI flow |
| 57 | +## Subcommands Reference |
47 | 58 |
|
48 | | -- Console scripts: `code-assistant-manager` and `cam` map to code_assistant_manager.cli:main (pyproject.toml and setup.py). |
| 59 | +CAM offers a rich set of subcommands for advanced management. |
49 | 60 |
|
50 | | -- The CLI is implemented with Typer (click-based). Subcommands include `launch` (interactive menu or per-tool commands), `version` (show version information), `mcp` (MCP server management), `prompt` (prompt management), `skill` (skill management), `upgrade`/`install` (tool installers), `doctor` (diagnostics), `completion` (generate shell completion script). |
| 61 | +### Main Commands |
51 | 62 |
|
52 | | -- `cli.py` also contains compatibility code that allows `code-assistant-manager <tool>` direct invocation and a legacy `main()` wrapper for backward compatibility. |
| 63 | +| Command | Description | |
| 64 | +| :--- | :--- | |
| 65 | +| `cam launch` | Open the interactive menu or launch specific tools directly (e.g., `cam launch claude`). | |
| 66 | +| `cam doctor` | specific Run diagnostic checks on your environment, API keys, and configuration. | |
| 67 | +| `cam version` | Display the current version of CAM. | |
| 68 | +| `cam upgrade` | Update underlying tools (like `claude-engineer`, `aider`, etc.) to their latest versions. | |
53 | 69 |
|
54 | | -Development workflow and testing |
| 70 | +### Prompt Management (`cam prompt`) |
55 | 71 |
|
56 | | -- Run tests locally with `python -m pytest tests/`. The repository uses pytest.ini to set testpaths and addopts. |
| 72 | +Manage and sync system prompts across all your AI assistants. |
57 | 73 |
|
58 | | -- Recommended local development flow: |
59 | | - 1. Create a feature branch: feature/<desc> or fix/<desc>. |
60 | | - 2. Run linters and formatters (project uses Black/Flake8? not enforced in repo snapshot) and the full test suite. |
61 | | - 3. Make focused commits and open a PR with tests and a clear description. Include `Co-Authored-By: Claude <noreply@anthropic.com>` when AI-assisted edits were used (see docs/CLAUDE.md). |
| 74 | +```bash |
| 75 | +# List all available prompts |
| 76 | +cam prompt list |
62 | 77 |
|
63 | | -- Tests are fairly extensive and broken into unit, integration, and interactive categories under tests/. |
| 78 | +# Fetch latest prompts from remote repositories |
| 79 | +cam prompt fetch |
64 | 80 |
|
65 | | -MCP subsystem |
| 81 | +# View details of a specific prompt |
| 82 | +cam prompt view <prompt_id> |
66 | 83 |
|
67 | | -- MCP (Model Connector Protocol) manager and registry lives under code_assistant_manager/mcp/. The registry contains server JSON definitions for many MCP servers (registry/servers/*.json). |
| 84 | +# Set a specific prompt as the default active prompt |
| 85 | +cam prompt set-default <prompt_id> |
68 | 86 |
|
69 | | -- MCP CLI integrates as a Typer app (mcp/cli.py). Use `code-assistant-manager mcp server list` and related commands to manage MCP servers. |
| 87 | +# Sync the default prompt to all installed assistants |
| 88 | +cam prompt sync |
70 | 89 |
|
71 | | -Tools & installer logic |
| 90 | +# Sync a specific prompt to a specific assistant |
| 91 | +cam prompt sync <prompt_id> --app gemini |
72 | 92 |
|
73 | | -- tools.yaml contains installer commands for each tool (npm installs, curl downloads, etc.). The upgrade/install flow uses this registry to perform global `npm install -g` operations and detect versions. |
| 93 | +# Create a new prompt from a file |
| 94 | +cam prompt create my-new-prompt --file ./my_prompt.md |
74 | 95 |
|
75 | | -- Each tool implements a CLITool-like interface exposing: command_name, _check_command_available(), _get_version(), and _perform_upgrade(). The CLI orchestrates parallel upgrades using ThreadPoolExecutor. |
| 96 | +# Import the current live prompt from an assistant |
| 97 | +cam prompt import-live --app claude --name "My Claude Prompt" |
| 98 | +``` |
76 | 99 |
|
77 | | -Security & configuration |
| 100 | +### Skill Management (`cam skill`) |
78 | 101 |
|
79 | | -- Sensitive API keys should be provided via environment variables (recommended) or a .env file loaded by env_loader.py. The doctor command performs basic security checks (checks for common key patterns and file permissions). |
| 102 | +Equip your assistants with new capabilities (tools/skills). |
80 | 103 |
|
81 | | -- Recommended: Keep .env out of version control; use OS keyrings or CI secrets for production environments. |
| 104 | +```bash |
| 105 | +# Discover available skills from configured repositories |
| 106 | +cam skill fetch |
82 | 107 |
|
83 | | -Repository strengths |
| 108 | +# List all skills and their installation status |
| 109 | +cam skill list |
84 | 110 |
|
85 | | -- Comprehensive CLI UX: Typer-based app with interactive menus, shell completion, and clear commands. |
| 111 | +# View details of a skill |
| 112 | +cam skill view <skill_id> |
86 | 113 |
|
87 | | -- MCP integration: Extensible server registry and CLI to add/remove/list/refresh servers. |
| 114 | +# Install a skill to a specific assistant (or 'all') |
| 115 | +cam skill install <skill_id> --app all |
88 | 116 |
|
89 | | -- Solid diagnostics: `doctor` performs many helpful checks (env, config permissions, installed tools, endpoints, cache, basic security scanning). |
| 117 | +# Uninstall a skill |
| 118 | +cam skill uninstall <skill_id> |
90 | 119 |
|
91 | | -- Tests: Structured test suite ready for CI. |
| 120 | +# Manage skill repositories |
| 121 | +cam skill repos # List repositories |
| 122 | +cam skill add-repo ... # Add a new GitHub repo |
| 123 | +``` |
92 | 124 |
|
93 | | -Areas for improvement and recommendations |
| 125 | +### Model Context Protocol (`cam mcp`) |
94 | 126 |
|
95 | | -1. Add CI configuration (GitHub Actions or equivalent). The repo lacks .github/workflows/. Provide jobs for linting, tests, type-checking (mypy/pydantic checks), and security scans. |
| 127 | +Manage MCP servers to connect your AI assistants to external data and tools. |
96 | 128 |
|
97 | | -2. Add pre-commit hooks with formatting/linting (Black, isort, Flake8) and run them in CI. |
| 129 | +```bash |
| 130 | +# List registered and installed MCP servers |
| 131 | +cam mcp server list |
98 | 132 |
|
99 | | -3. Consider replacing global `npm install -g` patterns with safer per-user or containerized installers (or document the implications clearly). |
| 133 | +# Search for available MCP servers |
| 134 | +cam mcp server search "postgres" |
100 | 135 |
|
101 | | -4. Add a Dockerfile and/or GitHub Codespaces devcontainer for easy contributor setup. |
| 136 | +# Show details for a server |
| 137 | +cam mcp server show "postgres" |
102 | 138 |
|
103 | | -5. Hardening: Add secrets scanning to CI and improve the heuristic used in the doctor security check (e.g., integrate detect-secrets or truffleHog). |
| 139 | +# Install an MCP server |
| 140 | +cam mcp server add "postgres" --client all |
104 | 141 |
|
105 | | -6. Documentation: docs/CONTRIBUTING.md and CODE_OF_CONDUCT.md to standardize PR process and contributor expectations (though docs/CLAUDE.md provides AI-specific guidance). |
| 142 | +# Remove an MCP server |
| 143 | +cam mcp server remove "postgres" |
| 144 | +``` |
106 | 145 |
|
107 | | -7. Release automation: Add a release workflow for pushing to PyPI and draft GitHub releases; ensure version bumping is automated (bump2version or similar). |
| 146 | +## Supported Assistants |
108 | 147 |
|
109 | | -Recommended TODOs for the project (short term) |
| 148 | +CAM provides management and wrappers for: |
110 | 149 |
|
111 | | -- Add GitHub Actions workflow with jobs: lint, test, build, publish-check (no publish), and security-scan. |
112 | | -- Add a Makefile with common commands: make test, make lint, make format, make release. |
113 | | -- Add CONTRIBUTING.md summarizing CLAUDE.md for human contributors and CI expectations. |
114 | | -- Add a Dockerfile for a reproducible developer environment. |
| 150 | +* **Claude** (Anthropic) |
| 151 | +* **Codex** (OpenAI / GitHub Copilot CLI) |
| 152 | +* **Gemini** (Google) |
| 153 | +* **Qwen** (Alibaba Cloud) |
| 154 | +* **LiteLLM** (Access to 100+ models via proxy) |
115 | 155 |
|
116 | | -How to review changes made by AI |
| 156 | +## Configuration |
117 | 157 |
|
118 | | -- Per CLAUDE.md: Treat AI edits as drafts. Review line-by-line, run tests, and annotate generated code with a short AI-assisted comment. |
| 158 | +CAM uses a combination of configuration files and environment variables. |
119 | 159 |
|
120 | | -Appendix: Quick file references |
| 160 | +* **Configuration Directory:** `~/.config/code-assistant-manager/` (Linux/Mac) |
| 161 | +* **Environment Variables:** Create a `.env` file in your project root or home directory. |
121 | 162 |
|
122 | | -- Main CLI: code_assistant_manager/cli.py:1 |
123 | | -- Package version: code_assistant_manager/__init__.py:17 |
124 | | -- MCP manager: code_assistant_manager/mcp/manager.py |
125 | | -- Tools registry: code_assistant_manager/tools.yaml |
126 | | -- Tests: tests/ (run with pytest) |
127 | | -- Packaging: pyproject.toml, setup.py |
| 163 | +Example `.env`: |
| 164 | +```env |
| 165 | +OPENAI_API_KEY=sk-... |
| 166 | +ANTHROPIC_API_KEY=sk-ant-... |
| 167 | +GEMINI_API_KEY=... |
| 168 | +``` |
128 | 169 |
|
129 | | -Last updated: 2025-10-28 |
| 170 | +## Contributing |
| 171 | + |
| 172 | +### Development Setup |
| 173 | + |
| 174 | +1. Clone the repository: |
| 175 | + ```bash |
| 176 | + git clone https://github.com/Chat2AnyLLM/code-assistant-manager.git |
| 177 | + cd code-assistant-manager |
| 178 | + ``` |
| 179 | + |
| 180 | +2. Install dependencies: |
| 181 | + ```bash |
| 182 | + pip install -e ".[dev]" |
| 183 | + ``` |
| 184 | + |
| 185 | +3. Run tests: |
| 186 | + ```bash |
| 187 | + pytest tests/ |
| 188 | + ``` |
| 189 | + |
| 190 | +### Repository Structure |
| 191 | + |
| 192 | +* `code_assistant_manager/`: Main package source. |
| 193 | + * `cli.py`: Entry point. |
| 194 | + * `mcp/`: MCP subsystem. |
| 195 | + * `prompts.py`: Prompt logic. |
| 196 | + * `skills.py`: Skill logic. |
| 197 | +* `tests/`: Comprehensive test suite. |
| 198 | + |
| 199 | +See [docs/](docs/) for more detailed developer guides. |
| 200 | + |
| 201 | +## License |
| 202 | + |
| 203 | +This project is licensed under the MIT License. |
0 commit comments