claude-pro-minmax 1.0.2 → 1.2.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/README.ko.md +79 -52
- package/README.md +79 -52
- package/bin/cpmm.js +2 -168
- package/install.sh +244 -106
- package/lib/cli.js +244 -0
- package/package.json +13 -12
- package/.claude/sessions/2025-01-27-auth-jwt-refresh.md +0 -32
- package/.claude/sessions/README.ko.md +0 -195
- package/.claude/sessions/README.md +0 -195
- package/.claude/skills/learned/README.ko.md +0 -64
- package/.claude/skills/learned/README.md +0 -64
- package/scripts/claude_command_smoke.sh +0 -116
package/README.ko.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<!-- Badges -->
|
|
4
4
|
[](https://www.npmjs.com/package/claude-pro-minmax)
|
|
5
5
|
[](https://www.npmjs.com/package/claude-pro-minmax)
|
|
6
|
+
[](https://nodejs.org/)
|
|
6
7
|

|
|
7
8
|

|
|
8
9
|

|
|
@@ -27,73 +28,93 @@ CPMM은 모델 라우팅, 출력 제어, 로컬 안전장치로 리셋 전까지
|
|
|
27
28
|
|
|
28
29
|
## 🛠 설치 (Installation)
|
|
29
30
|
|
|
30
|
-
### 1.
|
|
31
|
+
### 1. 설치 (권장)
|
|
31
32
|
```bash
|
|
32
|
-
npm install -g
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
brew install jq # macOS (Linux: sudo apt-get install jq)
|
|
36
|
-
brew install tmux # 선택: /watch 사용 시 필요 (Linux: sudo apt-get install tmux)
|
|
33
|
+
npm install -g claude-pro-minmax@latest
|
|
34
|
+
cpmm setup
|
|
35
|
+
cpmm doctor
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
### 2.
|
|
38
|
+
### 2. 업데이트
|
|
40
39
|
```bash
|
|
41
|
-
|
|
40
|
+
npm install -g claude-pro-minmax@latest
|
|
41
|
+
cpmm setup
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
### 3. 트러블슈팅 (빠른 복구)
|
|
45
45
|
```bash
|
|
46
|
-
|
|
47
|
-
cpmm
|
|
46
|
+
# 누락된 의존성 재설치
|
|
47
|
+
cpmm setup
|
|
48
|
+
|
|
49
|
+
# 상태 확인만
|
|
50
|
+
cpmm doctor
|
|
48
51
|
```
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
의존성 정책:
|
|
54
|
+
- `required`: `jq`, `mgrep`, `tmux`
|
|
55
|
+
- `optional` (확인만): `claude` (사전 설치 가정)
|
|
56
|
+
- 자동 설치 지원: `npm` (mgrep), `brew` (macOS), Linux 패키지 매니저 `apt-get`, `dnf`, `pacman`, `apk`
|
|
57
|
+
- macOS에서 Homebrew가 없으면 설치 명령을 안내합니다
|
|
58
|
+
|
|
59
|
+
### 4. Perplexity/언어 설정 (선택)
|
|
60
|
+
- 최초 인터랙티브 설치 시 `cpmm setup`이 출력 언어와 Perplexity API 키를 묻습니다.
|
|
61
|
+
- 영어(기본): 파일이 필요 없습니다. `~/.claude/rules/language.md`가 있으면 삭제하세요.
|
|
62
|
+
- 비영어: `~/.claude/rules/language.md`를 만들어 원하는 언어를 지정하세요.
|
|
63
|
+
- Perplexity를 수동으로 설정하려면 `~/.claude.json`의 `mcpServers`에 아래를 추가하세요:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
"perplexity": {
|
|
67
|
+
"command": "npx",
|
|
68
|
+
"args": ["-y", "@perplexity-ai/mcp-server"],
|
|
69
|
+
"env": {
|
|
70
|
+
"PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 5. 고급 (선택)
|
|
76
|
+
<details>
|
|
77
|
+
<summary>수동 의존성 설치와 소스 설치 보기</summary>
|
|
78
|
+
|
|
79
|
+
수동 의존성 설치:
|
|
51
80
|
```bash
|
|
52
|
-
|
|
81
|
+
# jq
|
|
82
|
+
brew install jq # macOS
|
|
83
|
+
sudo apt-get install -y jq # Ubuntu/Debian
|
|
84
|
+
sudo dnf install -y jq # Fedora/RHEL
|
|
85
|
+
sudo pacman -S --noconfirm jq # Arch
|
|
86
|
+
sudo apk add jq # Alpine
|
|
87
|
+
|
|
88
|
+
# mgrep
|
|
89
|
+
npm install -g @mixedbread/mgrep
|
|
90
|
+
mgrep install-claude-code
|
|
91
|
+
|
|
92
|
+
# tmux
|
|
93
|
+
brew install tmux # macOS
|
|
94
|
+
sudo apt-get install -y tmux # Ubuntu/Debian
|
|
95
|
+
sudo dnf install -y tmux # Fedora/RHEL
|
|
96
|
+
sudo pacman -S --noconfirm tmux # Arch
|
|
97
|
+
sudo apk add tmux # Alpine
|
|
53
98
|
```
|
|
54
99
|
|
|
55
|
-
|
|
100
|
+
소스에서 수동 설치:
|
|
56
101
|
```bash
|
|
57
102
|
git clone https://github.com/move-hoon/claude-pro-minmax.git
|
|
58
103
|
cd claude-pro-minmax
|
|
59
|
-
|
|
60
|
-
|
|
104
|
+
node bin/cpmm.js setup
|
|
105
|
+
# 고급/디버그 경로 (동일한 내부 설치기):
|
|
106
|
+
# bash install.sh
|
|
61
107
|
```
|
|
62
108
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```json
|
|
73
|
-
"perplexity": {
|
|
74
|
-
"command": "npx",
|
|
75
|
-
"args": ["-y", "@perplexity-ai/mcp-server"],
|
|
76
|
-
"env": {
|
|
77
|
-
"PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
> **함께 포함된 MCP 서버 (기본 활성화):**
|
|
83
|
-
> - **Sequential Thinking**: 복잡한 로직 처리를 위한 강력한 추론 도구
|
|
84
|
-
> - **Context7**: 고급 문서 조회 및 컨텍스트 관리 도구
|
|
85
|
-
|
|
86
|
-
> **Note:** 설치 스크립트가 기존 `~/.claude` 설정을 자동으로 백업(`~/.claude-backup-{timestamp}`)합니다.
|
|
87
|
-
|
|
88
|
-
### 6. 프로젝트 초기화
|
|
89
|
-
> **Tip:** `claude` 실행 전, 이 저장소의 `project-templates/`를 참고해 프로젝트를 초기화하세요. (`install.sh`는 `project-templates`를 `~/.claude`로 복사하지 않습니다.)
|
|
90
|
-
|
|
91
|
-
### 7. 설치 확인
|
|
92
|
-
```bash
|
|
93
|
-
npx claude-pro-minmax@latest doctor
|
|
94
|
-
# 또는 (전역 설치한 경우)
|
|
95
|
-
cpmm doctor
|
|
96
|
-
```
|
|
109
|
+
설치 동작:
|
|
110
|
+
- `cpmm setup`은 누락된 의존성을 설치한 뒤, CPMM 설정(설정 파일 복사, 언어 선택, Perplexity 설정)까지 진행합니다.
|
|
111
|
+
- `cpmm doctor`는 수정 없이 의존성 상태만 확인합니다.
|
|
112
|
+
- 재실행 시 CPMM 관리 파일만 갱신하고, `language.md`, `settings.local.json`, `skills/learned/`, `sessions/` 등 사용자 파일은 보존합니다.
|
|
113
|
+
|
|
114
|
+
프로젝트 초기화 팁:
|
|
115
|
+
- `claude` 실행 전에 `project-templates/`를 참고해 프로젝트를 초기화하세요. (설치기는 `project-templates`를 `~/.claude`로 복사하지 않습니다.)
|
|
116
|
+
|
|
117
|
+
</details>
|
|
97
118
|
|
|
98
119
|
---
|
|
99
120
|
|
|
@@ -237,10 +258,16 @@ claude-pro-minmax
|
|
|
237
258
|
├── .claude.json # 글로벌 MCP 설정 (User Scope)
|
|
238
259
|
├── .claudeignore # Claude 컨텍스트 제외 규칙
|
|
239
260
|
├── .gitignore # Git ignore 규칙
|
|
240
|
-
├──
|
|
261
|
+
├── CONTRIBUTING.md # 기여 가이드
|
|
262
|
+
├── install.sh # 핵심 설치 스크립트 (`cpmm setup`이 내부 호출)
|
|
241
263
|
├── LICENSE # MIT 라이선스
|
|
242
264
|
├── README.md # 영문 문서
|
|
243
265
|
├── README.ko.md # 국문 문서
|
|
266
|
+
├── package.json # npm 패키지 매니페스트
|
|
267
|
+
├── bin/ # CPMM CLI 엔트리포인트
|
|
268
|
+
│ ├── cpmm.js # `cpmm` 실행 진입점
|
|
269
|
+
├── lib/ # CPMM CLI 코어 구현
|
|
270
|
+
│ └── cli.js # setup/doctor 명령 로직
|
|
244
271
|
├── .claude/
|
|
245
272
|
│ ├── CLAUDE.md # 핵심 지침 (모든 세션에 로드됨)
|
|
246
273
|
│ ├── settings.json # 프로젝트 설정 (권한, 훅, 환경변수)
|
|
@@ -386,7 +413,7 @@ A: 네, 하지만 이러한 최적화가 필요하지 않을 수 있습니다. M
|
|
|
386
413
|
<details>
|
|
387
414
|
<summary><strong>Q: 기존 Claude Code 설정과 충돌하나요?</strong></summary>
|
|
388
415
|
|
|
389
|
-
A:
|
|
416
|
+
A: 최초 `cpmm setup` 시 기존 `~/.claude`를 `~/.claude.pre-cpmm`으로 백업합니다. 재실행 시 CPMM 관리 파일만 갱신하고, 언어 설정·로컬 설정·학습된 패턴·세션 기록은 보존됩니다.
|
|
390
417
|
</details>
|
|
391
418
|
|
|
392
419
|
<details>
|
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<!-- Badges -->
|
|
4
4
|
[](https://www.npmjs.com/package/claude-pro-minmax)
|
|
5
5
|
[](https://www.npmjs.com/package/claude-pro-minmax)
|
|
6
|
+
[](https://nodejs.org/)
|
|
6
7
|

|
|
7
8
|

|
|
8
9
|

|
|
@@ -27,73 +28,93 @@ CPMM helps Pro users complete more verified tasks before reset through model rou
|
|
|
27
28
|
|
|
28
29
|
## 🛠 Installation
|
|
29
30
|
|
|
30
|
-
### 1.
|
|
31
|
+
### 1. Install (Recommended)
|
|
31
32
|
```bash
|
|
32
|
-
npm install -g
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
brew install jq # macOS (Linux: sudo apt-get install jq)
|
|
36
|
-
brew install tmux # optional: required for /watch (Linux: sudo apt-get install tmux)
|
|
33
|
+
npm install -g claude-pro-minmax@latest
|
|
34
|
+
cpmm setup
|
|
35
|
+
cpmm doctor
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
### 2.
|
|
38
|
+
### 2. Update
|
|
40
39
|
```bash
|
|
41
|
-
|
|
40
|
+
npm install -g claude-pro-minmax@latest
|
|
41
|
+
cpmm setup
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
### 3. Troubleshooting (Quick)
|
|
45
45
|
```bash
|
|
46
|
-
|
|
47
|
-
cpmm
|
|
46
|
+
# re-run setup to install any missing deps
|
|
47
|
+
cpmm setup
|
|
48
|
+
|
|
49
|
+
# check status only
|
|
50
|
+
cpmm doctor
|
|
48
51
|
```
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
Dependency policy:
|
|
54
|
+
- `required`: `jq`, `mgrep`, `tmux`
|
|
55
|
+
- `optional` (check only): `claude` (assumed pre-installed)
|
|
56
|
+
- auto-install supports `npm` (mgrep), `brew` (macOS), and Linux package managers `apt-get`, `dnf`, `pacman`, `apk`
|
|
57
|
+
- on macOS without Homebrew, setup prints the Homebrew install command
|
|
58
|
+
|
|
59
|
+
### 4. Perplexity and Language (Optional)
|
|
60
|
+
- On fresh interactive installs, `cpmm setup` asks for output language and Perplexity API key.
|
|
61
|
+
- English (default): no file needed; remove `~/.claude/rules/language.md` if it exists.
|
|
62
|
+
- Non-English: create `~/.claude/rules/language.md` with your preferred language.
|
|
63
|
+
- To configure Perplexity manually, add this under `mcpServers` in `~/.claude.json`:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
"perplexity": {
|
|
67
|
+
"command": "npx",
|
|
68
|
+
"args": ["-y", "@perplexity-ai/mcp-server"],
|
|
69
|
+
"env": {
|
|
70
|
+
"PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 5. Advanced (Optional)
|
|
76
|
+
<details>
|
|
77
|
+
<summary>Show manual dependency setup and source install</summary>
|
|
78
|
+
|
|
79
|
+
Manual dependency setup:
|
|
51
80
|
```bash
|
|
52
|
-
|
|
81
|
+
# jq
|
|
82
|
+
brew install jq # macOS
|
|
83
|
+
sudo apt-get install -y jq # Ubuntu/Debian
|
|
84
|
+
sudo dnf install -y jq # Fedora/RHEL
|
|
85
|
+
sudo pacman -S --noconfirm jq # Arch
|
|
86
|
+
sudo apk add jq # Alpine
|
|
87
|
+
|
|
88
|
+
# mgrep
|
|
89
|
+
npm install -g @mixedbread/mgrep
|
|
90
|
+
mgrep install-claude-code
|
|
91
|
+
|
|
92
|
+
# tmux
|
|
93
|
+
brew install tmux # macOS
|
|
94
|
+
sudo apt-get install -y tmux # Ubuntu/Debian
|
|
95
|
+
sudo dnf install -y tmux # Fedora/RHEL
|
|
96
|
+
sudo pacman -S --noconfirm tmux # Arch
|
|
97
|
+
sudo apk add tmux # Alpine
|
|
53
98
|
```
|
|
54
99
|
|
|
55
|
-
|
|
100
|
+
Manual install from source:
|
|
56
101
|
```bash
|
|
57
102
|
git clone https://github.com/move-hoon/claude-pro-minmax.git
|
|
58
103
|
cd claude-pro-minmax
|
|
59
|
-
|
|
60
|
-
|
|
104
|
+
node bin/cpmm.js setup
|
|
105
|
+
# advanced/debug path (same underlying installer):
|
|
106
|
+
# bash install.sh
|
|
61
107
|
```
|
|
62
108
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```json
|
|
73
|
-
"perplexity": {
|
|
74
|
-
"command": "npx",
|
|
75
|
-
"args": ["-y", "@perplexity-ai/mcp-server"],
|
|
76
|
-
"env": {
|
|
77
|
-
"PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
> **Other included MCP servers (Enabled by default):**
|
|
83
|
-
> - **Sequential Thinking**: Powerful reasoning tool for complex logic.
|
|
84
|
-
> - **Context7**: Advanced documentation fetching and context management.
|
|
85
|
-
|
|
86
|
-
> **Note:** The installation script automatically backs up your existing `~/.claude` settings (`~/.claude-backup-{timestamp}`).
|
|
87
|
-
|
|
88
|
-
### 6. Project Initialization
|
|
89
|
-
> **Tip:** Before running `claude`, initialize your project by referencing templates in this repository's `project-templates/` directory. (`install.sh` does not copy `project-templates` into `~/.claude`.)
|
|
90
|
-
|
|
91
|
-
### 7. Verify Installation
|
|
92
|
-
```bash
|
|
93
|
-
npx claude-pro-minmax@latest doctor
|
|
94
|
-
# or (if installed globally)
|
|
95
|
-
cpmm doctor
|
|
96
|
-
```
|
|
109
|
+
Install behavior:
|
|
110
|
+
- `cpmm setup` installs missing dependencies, then configures CPMM (copies config files, language selection, Perplexity setup).
|
|
111
|
+
- `cpmm doctor` checks dependency status without modifying anything.
|
|
112
|
+
- Re-running `cpmm setup` updates CPMM-managed files in place and preserves user-owned files like `language.md`, `settings.local.json`, `skills/learned/`, and `sessions/`.
|
|
113
|
+
|
|
114
|
+
Project initialization tip:
|
|
115
|
+
- Before running `claude`, initialize your project with templates in `project-templates/` (not copied into `~/.claude`).
|
|
116
|
+
|
|
117
|
+
</details>
|
|
97
118
|
|
|
98
119
|
---
|
|
99
120
|
|
|
@@ -237,10 +258,16 @@ claude-pro-minmax
|
|
|
237
258
|
├── .claude.json # Global MCP Settings (User Scope)
|
|
238
259
|
├── .claudeignore # Files excluded from Claude's context
|
|
239
260
|
├── .gitignore # Git ignore rules
|
|
240
|
-
├──
|
|
261
|
+
├── CONTRIBUTING.md # Contribution guide
|
|
262
|
+
├── install.sh # Core installer (invoked by `cpmm setup`)
|
|
241
263
|
├── LICENSE # MIT License
|
|
242
264
|
├── README.md # English Documentation
|
|
243
265
|
├── README.ko.md # Korean Documentation
|
|
266
|
+
├── package.json # npm package manifest
|
|
267
|
+
├── bin/ # CPMM CLI entrypoints
|
|
268
|
+
│ ├── cpmm.js # `cpmm` executable entry
|
|
269
|
+
├── lib/ # CPMM CLI core implementation
|
|
270
|
+
│ └── cli.js # setup/doctor command logic
|
|
244
271
|
├── .claude/
|
|
245
272
|
│ ├── CLAUDE.md # Core Instructions (Loaded in all sessions)
|
|
246
273
|
│ ├── settings.json # Project Settings (Permissions, hooks, env vars)
|
|
@@ -386,7 +413,7 @@ This configuration is specifically designed for the Pro Plan's 5-hour rolling re
|
|
|
386
413
|
<details>
|
|
387
414
|
<summary><strong>Q: Does it conflict with existing Claude Code settings?</strong></summary>
|
|
388
415
|
|
|
389
|
-
A:
|
|
416
|
+
A: On first `cpmm setup`, CPMM backs up your existing `~/.claude` to `~/.claude.pre-cpmm`. Re-running `cpmm setup` updates CPMM-managed files in place — your language settings, local config, learned patterns, and session history are preserved.
|
|
390
417
|
</details>
|
|
391
418
|
|
|
392
419
|
<details>
|
package/bin/cpmm.js
CHANGED
|
@@ -1,171 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const path = require("node:path");
|
|
5
|
-
const os = require("node:os");
|
|
6
|
-
const { spawnSync } = require("node:child_process");
|
|
3
|
+
const { runCli } = require("../lib/cli");
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
const argv = process.argv.slice(2);
|
|
10
|
-
const command = argv[0] || "install";
|
|
11
|
-
const installScript = path.resolve(__dirname, "..", "install.sh");
|
|
12
|
-
const HOME = os.homedir();
|
|
13
|
-
|
|
14
|
-
function printHelp() {
|
|
15
|
-
console.log(`CPMM CLI v${pkg.version}
|
|
16
|
-
|
|
17
|
-
Usage:
|
|
18
|
-
cpmm install Install CPMM to ~/.claude
|
|
19
|
-
cpmm doctor Verify installation
|
|
20
|
-
cpmm --help Show this help
|
|
21
|
-
cpmm --version Show version
|
|
22
|
-
`);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (command === "--help" || command === "-h" || command === "help") {
|
|
26
|
-
printHelp();
|
|
27
|
-
process.exit(0);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (command === "--version" || command === "-v" || command === "version") {
|
|
31
|
-
console.log(pkg.version);
|
|
32
|
-
process.exit(0);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (process.platform === "win32") {
|
|
36
|
-
console.error(
|
|
37
|
-
"CPMM installer requires macOS/Linux. Windows users: use WSL (https://learn.microsoft.com/windows/wsl/install)"
|
|
38
|
-
);
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (command === "doctor") {
|
|
43
|
-
runDoctor();
|
|
44
|
-
process.exit(0);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!fs.existsSync(installScript)) {
|
|
48
|
-
console.error(`Install script not found: ${installScript}`);
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (command !== "install") {
|
|
53
|
-
console.error(`Unknown command: ${command}`);
|
|
54
|
-
printHelp();
|
|
55
|
-
process.exit(1);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const filteredEnv = buildFilteredEnv();
|
|
59
|
-
const result = spawnSync("bash", [installScript], {
|
|
60
|
-
stdio: "inherit",
|
|
61
|
-
env: filteredEnv,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
if (result.error) {
|
|
65
|
-
console.error(result.error.message);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
process.exit(result.status ?? 1);
|
|
70
|
-
|
|
71
|
-
function buildFilteredEnv() {
|
|
72
|
-
const allowed = [
|
|
73
|
-
"PATH", "HOME", "SHELL", "USER", "TERM",
|
|
74
|
-
"LANG", "LC_ALL", "TMPDIR", "XDG_CONFIG_HOME",
|
|
75
|
-
];
|
|
76
|
-
return Object.fromEntries(
|
|
77
|
-
allowed
|
|
78
|
-
.filter((k) => process.env[k] !== undefined)
|
|
79
|
-
.map((k) => [k, process.env[k]])
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function checkFile(filePath) {
|
|
84
|
-
return fs.existsSync(filePath);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function checkExecutable(filePath) {
|
|
88
|
-
if (!fs.existsSync(filePath)) return false;
|
|
89
|
-
try {
|
|
90
|
-
fs.accessSync(filePath, fs.constants.X_OK);
|
|
91
|
-
return true;
|
|
92
|
-
} catch {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function checkCli(name) {
|
|
98
|
-
const r = spawnSync("which", [name], { encoding: "utf8" });
|
|
99
|
-
return r.status === 0 && r.stdout.trim().length > 0;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function parseMcpServers() {
|
|
103
|
-
const claudeJson = path.join(HOME, ".claude.json");
|
|
104
|
-
if (!fs.existsSync(claudeJson)) return [];
|
|
105
|
-
try {
|
|
106
|
-
const data = JSON.parse(fs.readFileSync(claudeJson, "utf8"));
|
|
107
|
-
return Object.keys(data.mcpServers || {});
|
|
108
|
-
} catch {
|
|
109
|
-
return [];
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function formatLine(symbol, label, note) {
|
|
114
|
-
const base = ` ${symbol} ${label}`;
|
|
115
|
-
return note ? base.padEnd(46) + note : base;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function runDoctor() {
|
|
119
|
-
const results = { pass: 0, fail: 0, warn: 0 };
|
|
120
|
-
|
|
121
|
-
function check(symbol, label, note) {
|
|
122
|
-
if (symbol === "✓") results.pass++;
|
|
123
|
-
else if (symbol === "✗") results.fail++;
|
|
124
|
-
else results.warn++;
|
|
125
|
-
console.log(formatLine(symbol, label, note));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function required(ok, label) {
|
|
129
|
-
check(ok ? "✓" : "✗", label, ok ? null : "(required — missing)");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function optional(ok, label, note) {
|
|
133
|
-
check(ok ? "✓" : "⚠", label, ok ? null : note);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
console.log(`CPMM Doctor v${pkg.version}\n`);
|
|
137
|
-
|
|
138
|
-
console.log("Core Files:");
|
|
139
|
-
required(checkFile(`${HOME}/.claude/CLAUDE.md`), "~/.claude/CLAUDE.md");
|
|
140
|
-
required(checkFile(`${HOME}/.claude/settings.json`), "~/.claude/settings.json");
|
|
141
|
-
|
|
142
|
-
console.log("\nRules:");
|
|
143
|
-
required(checkFile(`${HOME}/.claude/rules/critical-actions.md`), "~/.claude/rules/critical-actions.md");
|
|
144
|
-
required(checkFile(`${HOME}/.claude/rules/security.md`), "~/.claude/rules/security.md");
|
|
145
|
-
required(checkFile(`${HOME}/.claude/rules/code-style.md`), "~/.claude/rules/code-style.md");
|
|
146
|
-
optional(checkFile(`${HOME}/.claude/rules/language.md`), "~/.claude/rules/language.md", "(optional)");
|
|
147
|
-
|
|
148
|
-
console.log("\nScripts:");
|
|
149
|
-
required(checkExecutable(`${HOME}/.claude/scripts/verify.sh`), "~/.claude/scripts/verify.sh");
|
|
150
|
-
required(checkExecutable(`${HOME}/.claude/scripts/runtime/detect.sh`), "~/.claude/scripts/runtime/detect.sh");
|
|
151
|
-
|
|
152
|
-
console.log("\nSkills:");
|
|
153
|
-
required(checkFile(`${HOME}/.claude/skills/`), "~/.claude/skills/");
|
|
154
|
-
|
|
155
|
-
const mcpServers = parseMcpServers();
|
|
156
|
-
console.log("\nMCP Servers:");
|
|
157
|
-
required(mcpServers.includes("context7"), "context7");
|
|
158
|
-
required(mcpServers.includes("sequential-thinking"), "sequential-thinking");
|
|
159
|
-
optional(mcpServers.includes("perplexity"), "perplexity", "(optional — set API key)");
|
|
160
|
-
|
|
161
|
-
console.log("\nCLI Tools:");
|
|
162
|
-
required(checkCli("claude"), "claude");
|
|
163
|
-
required(checkCli("jq"), "jq");
|
|
164
|
-
optional(checkCli("mgrep"), "mgrep", "(optional — npm install -g @mixedbread/mgrep)");
|
|
165
|
-
optional(checkCli("tmux"), "tmux", "(optional)");
|
|
166
|
-
|
|
167
|
-
const total = results.pass + results.fail + results.warn;
|
|
168
|
-
console.log(`\nResult: ${results.pass}/${total} passed, ${results.warn} optional skipped`);
|
|
169
|
-
|
|
170
|
-
if (results.fail > 0) process.exit(1);
|
|
171
|
-
}
|
|
5
|
+
process.exit(runCli(process.argv.slice(2)));
|