cc-x10ded 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.serena/project.yml +84 -0
- package/CHANGELOG.md +85 -0
- package/CONTRIBUTING.md +74 -0
- package/LICENSE +21 -0
- package/README.md +122 -0
- package/bun.lock +47 -0
- package/dist/ccx +0 -0
- package/package.json +27 -0
- package/src/commands/config.ts +23 -0
- package/src/commands/doctor.ts +73 -0
- package/src/commands/run.ts +76 -0
- package/src/commands/setup.ts +125 -0
- package/src/core/config.ts +111 -0
- package/src/core/shell.ts +166 -0
- package/src/index.ts +53 -0
- package/src/proxy/map.ts +86 -0
- package/src/proxy/providers.ts +142 -0
- package/src/proxy/server.ts +87 -0
- package/src/proxy/types.ts +21 -0
- package/src/proxy/utils.ts +54 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# list of languages for which language servers are started; choose from:
|
|
2
|
+
# al bash clojure cpp csharp csharp_omnisharp
|
|
3
|
+
# dart elixir elm erlang fortran go
|
|
4
|
+
# haskell java julia kotlin lua markdown
|
|
5
|
+
# nix perl php python python_jedi r
|
|
6
|
+
# rego ruby ruby_solargraph rust scala swift
|
|
7
|
+
# terraform typescript typescript_vts yaml zig
|
|
8
|
+
# Note:
|
|
9
|
+
# - For C, use cpp
|
|
10
|
+
# - For JavaScript, use typescript
|
|
11
|
+
# Special requirements:
|
|
12
|
+
# - csharp: Requires the presence of a .sln file in the project folder.
|
|
13
|
+
# When using multiple languages, the first language server that supports a given file will be used for that file.
|
|
14
|
+
# The first language is the default language and the respective language server will be used as a fallback.
|
|
15
|
+
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
|
|
16
|
+
languages:
|
|
17
|
+
- typescript
|
|
18
|
+
|
|
19
|
+
# the encoding used by text files in the project
|
|
20
|
+
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
|
|
21
|
+
encoding: "utf-8"
|
|
22
|
+
|
|
23
|
+
# whether to use the project's gitignore file to ignore files
|
|
24
|
+
# Added on 2025-04-07
|
|
25
|
+
ignore_all_files_in_gitignore: true
|
|
26
|
+
|
|
27
|
+
# list of additional paths to ignore
|
|
28
|
+
# same syntax as gitignore, so you can use * and **
|
|
29
|
+
# Was previously called `ignored_dirs`, please update your config if you are using that.
|
|
30
|
+
# Added (renamed) on 2025-04-07
|
|
31
|
+
ignored_paths: []
|
|
32
|
+
|
|
33
|
+
# whether the project is in read-only mode
|
|
34
|
+
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
|
|
35
|
+
# Added on 2025-04-18
|
|
36
|
+
read_only: false
|
|
37
|
+
|
|
38
|
+
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
|
|
39
|
+
# Below is the complete list of tools for convenience.
|
|
40
|
+
# To make sure you have the latest list of tools, and to view their descriptions,
|
|
41
|
+
# execute `uv run scripts/print_tool_overview.py`.
|
|
42
|
+
#
|
|
43
|
+
# * `activate_project`: Activates a project by name.
|
|
44
|
+
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
|
|
45
|
+
# * `create_text_file`: Creates/overwrites a file in the project directory.
|
|
46
|
+
# * `delete_lines`: Deletes a range of lines within a file.
|
|
47
|
+
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
|
|
48
|
+
# * `execute_shell_command`: Executes a shell command.
|
|
49
|
+
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
|
|
50
|
+
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
|
|
51
|
+
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
|
|
52
|
+
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
|
|
53
|
+
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
|
|
54
|
+
# * `initial_instructions`: Gets the initial instructions for the current project.
|
|
55
|
+
# Should only be used in settings where the system prompt cannot be set,
|
|
56
|
+
# e.g. in clients you have no control over, like Claude Desktop.
|
|
57
|
+
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
|
|
58
|
+
# * `insert_at_line`: Inserts content at a given line in a file.
|
|
59
|
+
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
|
|
60
|
+
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
|
|
61
|
+
# * `list_memories`: Lists memories in Serena's project-specific memory store.
|
|
62
|
+
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
|
|
63
|
+
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
|
|
64
|
+
# * `read_file`: Reads a file within the project directory.
|
|
65
|
+
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
|
|
66
|
+
# * `remove_project`: Removes a project from the Serena configuration.
|
|
67
|
+
# * `replace_lines`: Replaces a range of lines within a file with new content.
|
|
68
|
+
# * `replace_symbol_body`: Replaces the full definition of a symbol.
|
|
69
|
+
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
|
|
70
|
+
# * `search_for_pattern`: Performs a search for a pattern in the project.
|
|
71
|
+
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
|
|
72
|
+
# * `switch_modes`: Activates modes by providing a list of their names
|
|
73
|
+
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
|
|
74
|
+
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
|
|
75
|
+
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
|
|
76
|
+
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
|
|
77
|
+
excluded_tools: []
|
|
78
|
+
|
|
79
|
+
# initial prompt for the project. It will always be given to the LLM upon activating the project
|
|
80
|
+
# (contrary to the memories, which are loaded on demand).
|
|
81
|
+
initial_prompt: ""
|
|
82
|
+
|
|
83
|
+
project_name: "claude-glm-wrapper"
|
|
84
|
+
included_optional_tools: []
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- GLM-4.7 model support as new default
|
|
12
|
+
- GLM-4.6 wrapper (ccg46) for backward compatibility
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Updated default model from GLM-4.6 to GLM-4.7
|
|
16
|
+
|
|
17
|
+
## [1.0.3] - 2025-10-01
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Removed global installation support - npx only
|
|
21
|
+
- Updated preinstall script to block ALL installation methods (local and global)
|
|
22
|
+
- Clearer error messaging emphasizing npx as the only supported method
|
|
23
|
+
|
|
24
|
+
## [1.0.2] - 2025-10-01
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- Preinstall check to prevent incorrect installation method
|
|
28
|
+
- Error message directing users to use `npx` instead of `npm i`
|
|
29
|
+
- Support for global installation with `-g` flag
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
- Installation now blocks when users try `npm i claude-glm-installer` locally
|
|
33
|
+
- Improved user guidance for correct installation method
|
|
34
|
+
|
|
35
|
+
## [1.0.1] - 2025-10-01
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- Updated package description to include npx usage instructions
|
|
39
|
+
- Clarified installation method in npm package listing
|
|
40
|
+
|
|
41
|
+
## [1.0.0] - 2025-10-01
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
- Windows PowerShell support with full feature parity
|
|
45
|
+
- Cross-platform npm package installer (`npx claude-glm-installer`)
|
|
46
|
+
- Automatic detection and cleanup of old wrapper installations
|
|
47
|
+
- GLM-4.6 model support as new default
|
|
48
|
+
- GLM-4.5 wrapper (ccg45) for backward compatibility
|
|
49
|
+
- Universal bootstrap script for OS auto-detection
|
|
50
|
+
- Comprehensive Windows documentation and troubleshooting
|
|
51
|
+
- Platform-specific installation paths and configuration
|
|
52
|
+
- Bash installer for Unix/Linux/macOS
|
|
53
|
+
- Support for GLM-4.5 and GLM-4.5-Air models
|
|
54
|
+
- Isolated configuration directories per model
|
|
55
|
+
- Shell aliases (ccg, ccg45, ccf, cc)
|
|
56
|
+
- No sudo/admin required installation
|
|
57
|
+
- Wrapper scripts in ~/.local/bin
|
|
58
|
+
- Z.AI API key integration
|
|
59
|
+
- Separate chat histories per model
|
|
60
|
+
- Error reporting system with GitHub issue integration
|
|
61
|
+
- Test mode for error reporting (`--test-error` flag)
|
|
62
|
+
- Debug mode (`--debug` flag)
|
|
63
|
+
- User consent prompts for error reporting
|
|
64
|
+
|
|
65
|
+
### Changed
|
|
66
|
+
- Updated default model from GLM-4.5 to GLM-4.6
|
|
67
|
+
- Renamed aliases: removed `cca`, kept `cc` for regular Claude
|
|
68
|
+
- Improved installation flow with old wrapper detection
|
|
69
|
+
- Enhanced README with collapsible platform-specific sections
|
|
70
|
+
- Updated cross-platform support documentation
|
|
71
|
+
|
|
72
|
+
### Fixed
|
|
73
|
+
- PATH conflicts when multiple wrapper installations exist
|
|
74
|
+
- Version mismatches from old wrapper files
|
|
75
|
+
- Installation detection across different locations
|
|
76
|
+
- PowerShell parsing errors when piping through `iex`
|
|
77
|
+
- Nested here-string issues in PowerShell
|
|
78
|
+
- Subexpression parsing errors in piped contexts
|
|
79
|
+
- Terminal/PowerShell window persistence after errors
|
|
80
|
+
|
|
81
|
+
[Unreleased]: https://github.com/JoeInnsp23/claude-glm-wrapper/compare/v1.0.3...HEAD
|
|
82
|
+
[1.0.3]: https://github.com/JoeInnsp23/claude-glm-wrapper/compare/v1.0.2...v1.0.3
|
|
83
|
+
[1.0.2]: https://github.com/JoeInnsp23/claude-glm-wrapper/compare/v1.0.1...v1.0.2
|
|
84
|
+
[1.0.1]: https://github.com/JoeInnsp23/claude-glm-wrapper/compare/v1.0.0...v1.0.1
|
|
85
|
+
[1.0.0]: https://github.com/JoeInnsp23/claude-glm-wrapper/releases/tag/v1.0.0
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributing to Claude-GLM Wrapper
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to the **Bun-based** version of cc-x10ded!
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- **Bun**: This project is built entirely on Bun. [Install Bun](https://bun.sh/).
|
|
10
|
+
- **Claude Code**: Recommended for testing integration.
|
|
11
|
+
|
|
12
|
+
### Getting Started
|
|
13
|
+
|
|
14
|
+
1. **Clone the repository**:
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/MohMaya/claude-glm-wrapper.git
|
|
17
|
+
cd claude-glm-wrapper
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. **Install dependencies**:
|
|
21
|
+
```bash
|
|
22
|
+
bun install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. **Run in development mode**:
|
|
26
|
+
```bash
|
|
27
|
+
bun run dev --help
|
|
28
|
+
bun run dev doctor
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Project Structure
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
src/
|
|
35
|
+
├── commands/ # CLI commands (run, setup, doctor, config)
|
|
36
|
+
├── core/ # Core logic (ConfigManager, ShellIntegrator)
|
|
37
|
+
├── proxy/ # Proxy server logic & provider adapters
|
|
38
|
+
└── index.ts # Entry point
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Adding Features
|
|
42
|
+
|
|
43
|
+
1. **New Providers**: Add logic to `src/proxy/server.ts` and `src/proxy/providers.ts`. Update `src/core/config.ts` to support new keys.
|
|
44
|
+
2. **New Commands**: Create a new file in `src/commands/` and register it in `src/index.ts`.
|
|
45
|
+
|
|
46
|
+
## Building
|
|
47
|
+
|
|
48
|
+
To compile the standalone binaries:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
bun run build # Builds for current OS
|
|
52
|
+
bun run build:all # Builds for Linux, macOS, and Windows
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Artifacts will be placed in `dist/`.
|
|
56
|
+
|
|
57
|
+
## Testing
|
|
58
|
+
|
|
59
|
+
Please run the doctor command to verify your environment changes didn't break core diagnostics:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
bun run dev doctor
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Pull Request Process
|
|
66
|
+
|
|
67
|
+
1. Fork the repo and create your branch from `main`.
|
|
68
|
+
2. Ensure your code follows the existing style (Bun/TypeScript).
|
|
69
|
+
3. Update documentation if you add user-facing features.
|
|
70
|
+
4. Submit a PR!
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Joseph Stephenson-Mouzo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Claude-GLM Wrapper (ccx)
|
|
2
|
+
|
|
3
|
+
> **📢 Community Fork Notice**
|
|
4
|
+
>
|
|
5
|
+
> This is an actively maintained community fork of the original [claude-glm-wrapper](https://github.com/JoeInnsp23/claude-glm-wrapper).
|
|
6
|
+
> Now rewritten in **Bun** for 10x speed and single-binary simplicity.
|
|
7
|
+
>
|
|
8
|
+
> Install via: `bunx cc-x10ded` or download the binary.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Use [Z.AI's GLM models](https://z.ai), [Minimax](https://minimax.io), [OpenAI](https://openai.com), and more with [Claude Code](https://www.anthropic.com/claude-code).
|
|
13
|
+
|
|
14
|
+
**One Binary. Zero Friction.**
|
|
15
|
+
|
|
16
|
+
## Why ccx?
|
|
17
|
+
|
|
18
|
+
**🚀 10x Faster**: Native binary (written in Bun/TypeScript), starts instantly.
|
|
19
|
+
**📦 Single Binary**: No more "wrapper hell". One `ccx` executable handles everything.
|
|
20
|
+
**🛡️ Safe & Clean**: No more `eval` in shell scripts. Configs stored safely in `~/.config`.
|
|
21
|
+
**🔀 Multi-Provider**: Switch between GLM, Minimax, OpenAI, Gemini, and Claude instantly.
|
|
22
|
+
**🩺 Self-Healing**: Includes a `doctor` command to diagnose and fix configuration issues automatically.
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
### Installation
|
|
27
|
+
|
|
28
|
+
**If you have Bun:**
|
|
29
|
+
```bash
|
|
30
|
+
bunx cc-x10ded setup
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Manual Download (Mac/Linux/Windows):**
|
|
34
|
+
1. Download the latest release from [GitHub Releases](https://github.com/MohMaya/claude-glm-wrapper/releases).
|
|
35
|
+
2. Run `./ccx setup` (or `.\ccx.exe setup` on Windows).
|
|
36
|
+
|
|
37
|
+
### Setup Wizard
|
|
38
|
+
|
|
39
|
+
Run `ccx setup` to:
|
|
40
|
+
1. Configure your API keys (Z.AI, Minimax, OpenAI, etc.).
|
|
41
|
+
2. Install shell aliases (`cc`, `ccg`, `ccm`...) automatically.
|
|
42
|
+
3. Verify your Claude Code installation.
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Commands
|
|
47
|
+
|
|
48
|
+
| Command | Action |
|
|
49
|
+
|---------|--------|
|
|
50
|
+
| `ccx` | Run Claude Code with your default model (e.g. GLM-4.7) |
|
|
51
|
+
| `ccx setup` | Run the interactive setup wizard |
|
|
52
|
+
| `ccx config` | Open configuration file |
|
|
53
|
+
| `ccx doctor` | Run self-diagnostics to check API keys, paths, and dependencies |
|
|
54
|
+
| `ccx update` | Update to the latest version |
|
|
55
|
+
| `ccx --model=gpt-4o` | Run with a specific model override |
|
|
56
|
+
|
|
57
|
+
### Aliases (Optional)
|
|
58
|
+
|
|
59
|
+
If you enabled aliases during setup:
|
|
60
|
+
|
|
61
|
+
| Alias | Equivalent Command |
|
|
62
|
+
|-------|-------------------|
|
|
63
|
+
| `cc` | `claude` (Standard Anthropic) |
|
|
64
|
+
| `ccg` | `ccx --model=glm-4.7` |
|
|
65
|
+
| `ccg45` | `ccx --model=glm-4.5` |
|
|
66
|
+
| `ccf` | `ccx --model=glm-4.5-air` |
|
|
67
|
+
| `ccm` | `ccx --model=MiniMax-M2.1` |
|
|
68
|
+
|
|
69
|
+
### Multi-Provider Proxy
|
|
70
|
+
|
|
71
|
+
`ccx` automatically acts as a local proxy. You can use ANY supported provider by specifying the prefix:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
ccx --model=openai:gpt-4o
|
|
75
|
+
ccx --model=gemini:gemini-1.5-pro
|
|
76
|
+
ccx --model=minimax:MiniMax-M2.1
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Or switch **in-session** using Claude's slash command:
|
|
80
|
+
`/model openai:gpt-4o`
|
|
81
|
+
|
|
82
|
+
### Auto-Discovery (Zero Config)
|
|
83
|
+
|
|
84
|
+
`ccx` is smart! It automatically detects API keys in your environment variables, so you might not even need to run setup.
|
|
85
|
+
|
|
86
|
+
Supported variables:
|
|
87
|
+
- `ZAI_API_KEY` or `GLM_API_KEY`
|
|
88
|
+
- `MINIMAX_API_KEY`
|
|
89
|
+
- `OPENAI_API_KEY`
|
|
90
|
+
- `ANTHROPIC_API_KEY`
|
|
91
|
+
- `GEMINI_API_KEY`
|
|
92
|
+
- `OPENROUTER_API_KEY`
|
|
93
|
+
|
|
94
|
+
## Configuration
|
|
95
|
+
|
|
96
|
+
Config is stored in `~/.config/claude-glm/config.json`.
|
|
97
|
+
You can edit it with `ccx config`.
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"zaiApiKey": "sk-...",
|
|
102
|
+
"minimaxApiKey": "...",
|
|
103
|
+
"providers": {
|
|
104
|
+
"openai": { "apiKey": "sk-..." }
|
|
105
|
+
},
|
|
106
|
+
"defaults": {
|
|
107
|
+
"model": "glm-4.7"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Troubleshooting
|
|
113
|
+
|
|
114
|
+
**"ccx: command not found"**
|
|
115
|
+
Ensure the binary is in your PATH, or that you've run the setup which helps install aliases.
|
|
116
|
+
|
|
117
|
+
**"Error: 'claude' command not found"**
|
|
118
|
+
Run `ccx doctor` or `ccx setup` — it will offer to install Claude Code for you automatically!
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT
|
package/bun.lock
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"configVersion": 1,
|
|
4
|
+
"workspaces": {
|
|
5
|
+
"": {
|
|
6
|
+
"name": "claude-glm-wrapper",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@clack/prompts": "^0.11.0",
|
|
9
|
+
"cac": "^6.7.14",
|
|
10
|
+
"eventsource-parser": "^3.0.6",
|
|
11
|
+
"picocolors": "^1.1.1",
|
|
12
|
+
"zod": "^4.2.1",
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/bun": "latest",
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"typescript": "^5",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
"packages": {
|
|
23
|
+
"@clack/core": ["@clack/core@0.5.0", "", { "dependencies": { "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-p3y0FIOwaYRUPRcMO7+dlmLh8PSRcrjuTndsiA0WAFbWES0mLZlrjVoBRZ9DzkPFJZG6KGkJmoEAY0ZcVWTkow=="],
|
|
24
|
+
|
|
25
|
+
"@clack/prompts": ["@clack/prompts@0.11.0", "", { "dependencies": { "@clack/core": "0.5.0", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-pMN5FcrEw9hUkZA4f+zLlzivQSeQf5dRGJjSUbvVYDLvpKCdQx5OaknvKzgbtXOizhP+SJJJjqEbOe55uKKfAw=="],
|
|
26
|
+
|
|
27
|
+
"@types/bun": ["@types/bun@1.3.5", "", { "dependencies": { "bun-types": "1.3.5" } }, "sha512-RnygCqNrd3srIPEWBd5LFeUYG7plCoH2Yw9WaZGyNmdTEei+gWaHqydbaIRkIkcbXwhBT94q78QljxN0Sk838w=="],
|
|
28
|
+
|
|
29
|
+
"@types/node": ["@types/node@25.0.3", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA=="],
|
|
30
|
+
|
|
31
|
+
"bun-types": ["bun-types@1.3.5", "", { "dependencies": { "@types/node": "*" } }, "sha512-inmAYe2PFLs0SUbFOWSVD24sg1jFlMPxOjOSSCYqUgn4Hsc3rDc7dFvfVYjFPNHtov6kgUeulV4SxbuIV/stPw=="],
|
|
32
|
+
|
|
33
|
+
"cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="],
|
|
34
|
+
|
|
35
|
+
"eventsource-parser": ["eventsource-parser@3.0.6", "", {}, "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg=="],
|
|
36
|
+
|
|
37
|
+
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
|
38
|
+
|
|
39
|
+
"sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
|
|
40
|
+
|
|
41
|
+
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
42
|
+
|
|
43
|
+
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
|
44
|
+
|
|
45
|
+
"zod": ["zod@4.2.1", "", {}, "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw=="],
|
|
46
|
+
}
|
|
47
|
+
}
|
package/dist/ccx
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cc-x10ded",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Cross-platform wrapper for Claude Code with Z.AI GLM models (Bun Edition)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ccx": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "bun run src/index.ts",
|
|
11
|
+
"build": "bun build --compile --minify --sourcemap ./src/index.ts --outfile dist/ccx",
|
|
12
|
+
"build:all": "bun run build:linux && bun run build:windows && bun run build:darwin",
|
|
13
|
+
"build:linux": "bun build --compile --minify --sourcemap --target=bun-linux-x64 ./src/index.ts --outfile dist/ccx-linux",
|
|
14
|
+
"build:windows": "bun build --compile --minify --sourcemap --target=bun-windows-x64 ./src/index.ts --outfile dist/ccx.exe",
|
|
15
|
+
"build:darwin": "bun build --compile --minify --sourcemap --target=bun-darwin-arm64 ./src/index.ts --outfile dist/ccx-darwin"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@clack/prompts": "^0.11.0",
|
|
19
|
+
"cac": "^6.7.14",
|
|
20
|
+
"eventsource-parser": "^3.0.6",
|
|
21
|
+
"picocolors": "^1.1.1",
|
|
22
|
+
"zod": "^3.22.4"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/bun": "latest"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ConfigManager } from "../core/config";
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
import { spawn } from "bun";
|
|
4
|
+
|
|
5
|
+
export async function configCommand() {
|
|
6
|
+
const manager = new ConfigManager();
|
|
7
|
+
const path = manager.getPath();
|
|
8
|
+
manager.ensureConfigDir();
|
|
9
|
+
|
|
10
|
+
console.log(`Config file: ${path}`);
|
|
11
|
+
|
|
12
|
+
// Try to open with default editor
|
|
13
|
+
const editor = process.env.EDITOR || "nano"; // Fallback to nano if EDITOR not set
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const proc = spawn([editor, path], {
|
|
17
|
+
stdio: "inherit"
|
|
18
|
+
});
|
|
19
|
+
await proc.exited;
|
|
20
|
+
} catch (e) {
|
|
21
|
+
console.log(pc.red("Could not open editor. Please edit the file manually."));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { intro, outro, spinner } from "@clack/prompts";
|
|
2
|
+
import { ShellIntegrator } from "../core/shell";
|
|
3
|
+
import { ConfigManager } from "../core/config";
|
|
4
|
+
import pc from "picocolors";
|
|
5
|
+
import { existsSync } from "fs";
|
|
6
|
+
|
|
7
|
+
export async function doctorCommand() {
|
|
8
|
+
intro(pc.bgBlue(pc.white(" ccx Doctor 🩺 ")));
|
|
9
|
+
|
|
10
|
+
const s = spinner();
|
|
11
|
+
const issues: string[] = [];
|
|
12
|
+
const checks: string[] = [];
|
|
13
|
+
|
|
14
|
+
// 1. Check Config
|
|
15
|
+
s.start("Checking configuration...");
|
|
16
|
+
const configManager = new ConfigManager();
|
|
17
|
+
const config = await configManager.read();
|
|
18
|
+
|
|
19
|
+
if (!config.zaiApiKey && !config.minimaxApiKey && Object.keys(config.providers).length === 0) {
|
|
20
|
+
issues.push("❌ No API keys configured. Run 'ccx setup'.");
|
|
21
|
+
} else {
|
|
22
|
+
checks.push("✅ Configuration loaded");
|
|
23
|
+
}
|
|
24
|
+
s.stop("Configuration check complete");
|
|
25
|
+
|
|
26
|
+
// 2. Check Claude Binary
|
|
27
|
+
s.start("Checking Claude Code installation...");
|
|
28
|
+
const shellInt = new ShellIntegrator();
|
|
29
|
+
const claudePath = await shellInt.findClaudeBinary();
|
|
30
|
+
|
|
31
|
+
if (claudePath) {
|
|
32
|
+
checks.push(`✅ Claude binary found: ${claudePath}`);
|
|
33
|
+
} else {
|
|
34
|
+
issues.push("❌ 'claude' command not found in common locations.");
|
|
35
|
+
issues.push(" 👉 Suggestion: Run 'npm install -g @anthropic-ai/claude-code'");
|
|
36
|
+
}
|
|
37
|
+
s.stop("Claude check complete");
|
|
38
|
+
|
|
39
|
+
// 3. Check Shell Integration
|
|
40
|
+
s.start("Checking shell integration...");
|
|
41
|
+
const shell = shellInt.detectShell();
|
|
42
|
+
const profile = shellInt.getProfilePath(shell);
|
|
43
|
+
|
|
44
|
+
if (shell === "unknown") {
|
|
45
|
+
issues.push("⚠️ Could not detect shell type.");
|
|
46
|
+
} else {
|
|
47
|
+
checks.push(`✅ Shell detected: ${shell}`);
|
|
48
|
+
if (profile && existsSync(profile)) {
|
|
49
|
+
const content = await Bun.file(profile).text();
|
|
50
|
+
if (content.includes("ccx")) {
|
|
51
|
+
checks.push("✅ Aliases found in profile");
|
|
52
|
+
} else {
|
|
53
|
+
issues.push(`⚠️ Aliases missing in ${profile}. Run 'ccx setup'.`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
s.stop("Shell check complete");
|
|
58
|
+
|
|
59
|
+
// 4. Check Network/Proxy (Port 17870)
|
|
60
|
+
// We won't actually bind, just check if we can
|
|
61
|
+
|
|
62
|
+
console.log("\n" + pc.bold("Diagnostic Report:"));
|
|
63
|
+
checks.forEach(c => console.log(c));
|
|
64
|
+
console.log("");
|
|
65
|
+
|
|
66
|
+
if (issues.length > 0) {
|
|
67
|
+
issues.forEach(i => console.log(i));
|
|
68
|
+
outro(pc.yellow("Issues found. Please resolve them above."));
|
|
69
|
+
process.exit(1);
|
|
70
|
+
} else {
|
|
71
|
+
outro(pc.green("All systems operational! 🚀"));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { spawn } from "bun";
|
|
2
|
+
import { ConfigManager } from "../core/config";
|
|
3
|
+
import { startProxyServer } from "../proxy/server";
|
|
4
|
+
import { ShellIntegrator } from "../core/shell";
|
|
5
|
+
import pc from "picocolors";
|
|
6
|
+
|
|
7
|
+
export async function runCommand(args: string[], options: { model?: string; port?: number }) {
|
|
8
|
+
const configManager = new ConfigManager();
|
|
9
|
+
const config = await configManager.read();
|
|
10
|
+
|
|
11
|
+
if (!config.zaiApiKey && !config.minimaxApiKey && Object.keys(config.providers).length === 0) {
|
|
12
|
+
console.log(pc.yellow("Configuration missing. Running setup..."));
|
|
13
|
+
const { setupCommand } = await import("./setup");
|
|
14
|
+
await setupCommand();
|
|
15
|
+
// Re-read config
|
|
16
|
+
Object.assign(config, await configManager.read());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Port hunting logic
|
|
20
|
+
let port = options.port || 17870;
|
|
21
|
+
let server;
|
|
22
|
+
let retries = 0;
|
|
23
|
+
|
|
24
|
+
while (retries < 10) {
|
|
25
|
+
try {
|
|
26
|
+
server = startProxyServer(config, port);
|
|
27
|
+
break;
|
|
28
|
+
} catch (e: any) {
|
|
29
|
+
if (e.code === "EADDRINUSE" || e.message.includes("EADDRINUSE")) {
|
|
30
|
+
port++;
|
|
31
|
+
retries++;
|
|
32
|
+
} else {
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!server) {
|
|
39
|
+
console.error(pc.red(`Failed to start proxy server after 10 attempts (ports ${options.port || 17870}-${port}).`));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const model = options.model || config.defaults.model || "glm-4.7";
|
|
44
|
+
|
|
45
|
+
// Robust binary finding
|
|
46
|
+
const shellInt = new ShellIntegrator();
|
|
47
|
+
const claudePath = await shellInt.findClaudeBinary();
|
|
48
|
+
|
|
49
|
+
if (!claudePath) {
|
|
50
|
+
console.error(pc.red("Error: 'claude' command not found."));
|
|
51
|
+
console.error(pc.yellow("Self-Healing Tip: Run 'ccx setup' or 'npm install -g @anthropic-ai/claude-code'"));
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const env = {
|
|
56
|
+
...process.env,
|
|
57
|
+
ANTHROPIC_BASE_URL: `http://127.0.0.1:${port}`,
|
|
58
|
+
ANTHROPIC_AUTH_TOKEN: "ccx-proxy-token", // Dummy token for the client
|
|
59
|
+
ANTHROPIC_MODEL: model,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const proc = spawn([claudePath, ...args], {
|
|
64
|
+
env,
|
|
65
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const code = await proc.exited;
|
|
69
|
+
process.exit(code);
|
|
70
|
+
} catch (e: any) {
|
|
71
|
+
console.error(pc.red(`Error starting Claude: ${e.message}`));
|
|
72
|
+
process.exit(1);
|
|
73
|
+
} finally {
|
|
74
|
+
server.stop();
|
|
75
|
+
}
|
|
76
|
+
}
|