@kaitranntt/ccs 3.4.6 → 4.1.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/.claude/agents/ccs-delegator.md +117 -0
- package/.claude/commands/ccs/glm/continue.md +22 -0
- package/.claude/commands/ccs/glm.md +22 -0
- package/.claude/commands/ccs/kimi/continue.md +22 -0
- package/.claude/commands/ccs/kimi.md +22 -0
- package/.claude/skills/ccs-delegation/SKILL.md +54 -0
- package/.claude/skills/ccs-delegation/references/README.md +24 -0
- package/.claude/skills/ccs-delegation/references/delegation-guidelines.md +99 -0
- package/.claude/skills/ccs-delegation/references/headless-workflow.md +174 -0
- package/.claude/skills/ccs-delegation/references/troubleshooting.md +268 -0
- package/README.ja.md +470 -146
- package/README.md +532 -145
- package/README.vi.md +484 -157
- package/VERSION +1 -1
- package/bin/auth/auth-commands.js +98 -13
- package/bin/auth/profile-detector.js +11 -6
- package/bin/ccs.js +148 -2
- package/bin/delegation/README.md +189 -0
- package/bin/delegation/delegation-handler.js +212 -0
- package/bin/delegation/headless-executor.js +617 -0
- package/bin/delegation/result-formatter.js +483 -0
- package/bin/delegation/session-manager.js +156 -0
- package/bin/delegation/settings-parser.js +109 -0
- package/bin/management/doctor.js +94 -1
- package/bin/utils/claude-symlink-manager.js +238 -0
- package/bin/utils/delegation-validator.js +154 -0
- package/bin/utils/error-codes.js +59 -0
- package/bin/utils/error-manager.js +38 -32
- package/bin/utils/helpers.js +65 -1
- package/bin/utils/progress-indicator.js +111 -0
- package/bin/utils/prompt.js +134 -0
- package/bin/utils/shell-completion.js +234 -0
- package/lib/ccs +575 -25
- package/lib/ccs.ps1 +381 -20
- package/lib/error-codes.ps1 +55 -0
- package/lib/error-codes.sh +63 -0
- package/lib/progress-indicator.ps1 +120 -0
- package/lib/progress-indicator.sh +117 -0
- package/lib/prompt.ps1 +109 -0
- package/lib/prompt.sh +99 -0
- package/package.json +2 -1
- package/scripts/completion/README.md +308 -0
- package/scripts/completion/ccs.bash +81 -0
- package/scripts/completion/ccs.fish +92 -0
- package/scripts/completion/ccs.ps1 +157 -0
- package/scripts/completion/ccs.zsh +130 -0
- package/scripts/postinstall.js +35 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
AI-oriented error resolution guide for CCS delegation issues.
|
|
4
|
+
|
|
5
|
+
## Error Pattern Matching
|
|
6
|
+
|
|
7
|
+
### Profile Configuration Errors
|
|
8
|
+
|
|
9
|
+
**Pattern:** `Profile 'X' is not configured for delegation`
|
|
10
|
+
```
|
|
11
|
+
Root cause: Missing ~/.ccs/{profile}.settings.json
|
|
12
|
+
Resolution:
|
|
13
|
+
1. Check file exists: ls ~/.ccs/{profile}.settings.json
|
|
14
|
+
2. Run diagnostics: ccs doctor
|
|
15
|
+
3. If missing, user must configure profile manually
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Pattern:** `Invalid API key` (401 error)
|
|
19
|
+
```
|
|
20
|
+
Root cause: API token expired or invalid
|
|
21
|
+
Resolution:
|
|
22
|
+
1. Verify token exists in settings.json
|
|
23
|
+
2. Test with simple command: ccs {profile} "test"
|
|
24
|
+
3. If fails, user must regenerate token from provider
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Pattern:** `Settings file not found`
|
|
28
|
+
```
|
|
29
|
+
Root cause: ~/.ccs/{profile}.settings.json doesn't exist
|
|
30
|
+
Resolution:
|
|
31
|
+
1. Run: ccs doctor
|
|
32
|
+
2. Shows missing profiles
|
|
33
|
+
3. User must configure manually
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Delegation Execution Errors
|
|
37
|
+
|
|
38
|
+
**Pattern:** `No previous session found for {profile}`
|
|
39
|
+
```
|
|
40
|
+
Root cause: Using :continue without initial session
|
|
41
|
+
Resolution:
|
|
42
|
+
- Cannot use ccs {profile}:continue without prior session
|
|
43
|
+
- Must run: ccs {profile} -p "initial task" first
|
|
44
|
+
- Then can continue with: ccs {profile}:continue -p "follow-up"
|
|
45
|
+
Example:
|
|
46
|
+
[X] ccs glm:continue -p "task" # ERROR: no session
|
|
47
|
+
[OK] ccs glm -p "task" # Creates session
|
|
48
|
+
[OK] ccs glm:continue -p "more" # Uses session
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Pattern:** `Missing prompt after -p flag`
|
|
52
|
+
```
|
|
53
|
+
Root cause: No argument provided after -p
|
|
54
|
+
Resolution:
|
|
55
|
+
- Syntax: ccs {profile} -p "prompt text"
|
|
56
|
+
- Quote prompt if contains spaces
|
|
57
|
+
Example:
|
|
58
|
+
[X] ccs glm -p # ERROR
|
|
59
|
+
[OK] ccs glm -p "add tests" # Correct
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Pattern:** `No profile specified`
|
|
63
|
+
```
|
|
64
|
+
Root cause: Command missing profile name
|
|
65
|
+
Resolution:
|
|
66
|
+
- Syntax: ccs <profile> -p "task"
|
|
67
|
+
- Available profiles: glm, kimi
|
|
68
|
+
Example:
|
|
69
|
+
[X] ccs -p "task" # ERROR: no profile
|
|
70
|
+
[OK] ccs glm -p "task" # Correct
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Pattern:** Exit code 1 with JSON parse error
|
|
74
|
+
```
|
|
75
|
+
Root cause: Claude CLI returned non-stream-JSON output
|
|
76
|
+
Resolution:
|
|
77
|
+
1. Check if --output-format stream-json is supported
|
|
78
|
+
2. Verify Claude CLI version (need recent version with stream-json support)
|
|
79
|
+
3. Test manually: claude -p "test" --output-format stream-json
|
|
80
|
+
4. If not supported, delegation won't work
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Session Management Errors
|
|
84
|
+
|
|
85
|
+
**Pattern:** Session file corrupted
|
|
86
|
+
```
|
|
87
|
+
Root cause: ~/.ccs/delegation-sessions.json malformed
|
|
88
|
+
Resolution:
|
|
89
|
+
1. Backup file: cp ~/.ccs/delegation-sessions.json ~/.ccs/delegation-sessions.json.bak
|
|
90
|
+
2. Delete corrupted file: rm ~/.ccs/delegation-sessions.json
|
|
91
|
+
3. New file created on next delegation
|
|
92
|
+
4. Previous sessions lost but fresh start
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Pattern:** Session expired
|
|
96
|
+
```
|
|
97
|
+
Root cause: Session older than 30 days
|
|
98
|
+
Resolution:
|
|
99
|
+
- Sessions auto-expire after 30 days
|
|
100
|
+
- Start new session: ccs {profile} -p "task"
|
|
101
|
+
- Cannot resume expired sessions
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Network & API Errors
|
|
105
|
+
|
|
106
|
+
**Pattern:** Connection timeout
|
|
107
|
+
```
|
|
108
|
+
Root cause: Network issue or API endpoint unreachable
|
|
109
|
+
Resolution:
|
|
110
|
+
1. Check internet: ping 8.8.8.8
|
|
111
|
+
2. Verify API endpoint in settings.json
|
|
112
|
+
3. Check firewall/proxy settings
|
|
113
|
+
4. Retry delegation
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Pattern:** Rate limiting (429)
|
|
117
|
+
```
|
|
118
|
+
Root cause: Too many API requests
|
|
119
|
+
Resolution:
|
|
120
|
+
1. Wait 60 seconds before retry
|
|
121
|
+
2. Reduce concurrent delegations
|
|
122
|
+
3. Check API quota limits
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### File Operation Errors
|
|
126
|
+
|
|
127
|
+
**Pattern:** File not found during delegation
|
|
128
|
+
```
|
|
129
|
+
Root cause: Path doesn't exist or wrong working directory
|
|
130
|
+
Resolution:
|
|
131
|
+
1. Delegation runs in cwd where command executed
|
|
132
|
+
2. Verify file exists: ls <file>
|
|
133
|
+
3. Use absolute paths in prompt if needed
|
|
134
|
+
Example:
|
|
135
|
+
Prompt: "refactor src/auth.js"
|
|
136
|
+
Check: ls src/auth.js # Must exist in cwd
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Pattern:** Permission denied writing files
|
|
140
|
+
```
|
|
141
|
+
Root cause: Insufficient permissions in target directory
|
|
142
|
+
Resolution:
|
|
143
|
+
1. Check directory permissions: ls -la
|
|
144
|
+
2. Verify cwd is writable
|
|
145
|
+
3. Don't delegate in read-only directories
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Diagnostic Commands
|
|
149
|
+
|
|
150
|
+
**Profile validation:**
|
|
151
|
+
```bash
|
|
152
|
+
ccs doctor # Check all profiles
|
|
153
|
+
cat ~/.ccs/glm.settings.json # Verify settings
|
|
154
|
+
ccs glm "echo test" 2>&1 # Test execution
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Session inspection:**
|
|
158
|
+
```bash
|
|
159
|
+
cat ~/.ccs/delegation-sessions.json # View sessions
|
|
160
|
+
jq '.glm' ~/.ccs/delegation-sessions.json # Check specific profile
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Delegation test:**
|
|
164
|
+
```bash
|
|
165
|
+
ccs glm -p "create test.txt file with 'hello'" # Simple test
|
|
166
|
+
cat test.txt # Verify result
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Debug mode:**
|
|
170
|
+
```bash
|
|
171
|
+
export CCS_DEBUG=1
|
|
172
|
+
ccs glm -p "task" 2>&1 | tee debug.log # Capture full output
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Decision Tree
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
Delegation fails?
|
|
179
|
+
│
|
|
180
|
+
├─→ "Profile not configured"
|
|
181
|
+
│ └─→ Run: ccs doctor
|
|
182
|
+
│ └─→ Configure missing profile
|
|
183
|
+
│
|
|
184
|
+
├─→ "No previous session"
|
|
185
|
+
│ └─→ Using :continue?
|
|
186
|
+
│ ├─→ YES: Run initial task first
|
|
187
|
+
│ └─→ NO: Different error
|
|
188
|
+
│
|
|
189
|
+
├─→ "Missing prompt"
|
|
190
|
+
│ └─→ Check syntax: ccs {profile} -p "prompt"
|
|
191
|
+
│
|
|
192
|
+
├─→ Exit code 1
|
|
193
|
+
│ └─→ Check error message
|
|
194
|
+
│ ├─→ JSON parse: Claude CLI version issue
|
|
195
|
+
│ ├─→ File not found: Verify paths
|
|
196
|
+
│ └─→ API error: Check network/token
|
|
197
|
+
│
|
|
198
|
+
└─→ Silent failure
|
|
199
|
+
└─→ Enable debug: export CCS_DEBUG=1
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Common Patterns to Avoid
|
|
203
|
+
|
|
204
|
+
**Anti-pattern:** Delegating without profile validation
|
|
205
|
+
```
|
|
206
|
+
[X] Assume profile exists
|
|
207
|
+
[OK] Run ccs doctor first to verify
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Anti-pattern:** Using :continue immediately
|
|
211
|
+
```
|
|
212
|
+
[X] ccs glm:continue -p "task" # No initial session
|
|
213
|
+
[OK] ccs glm -p "task" && ccs glm:continue -p "more"
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Anti-pattern:** Delegating complex tasks
|
|
217
|
+
```
|
|
218
|
+
[X] ccs glm -p "implement OAuth2" # Too complex
|
|
219
|
+
[OK] ccs glm -p "add tests for login function"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Anti-pattern:** Vague prompts
|
|
223
|
+
```
|
|
224
|
+
[X] ccs glm -p "fix the bug" # No context
|
|
225
|
+
[OK] ccs glm -p "fix typo in src/auth.js line 42"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Recovery Procedures
|
|
229
|
+
|
|
230
|
+
**Reset session state:**
|
|
231
|
+
```bash
|
|
232
|
+
rm ~/.ccs/delegation-sessions.json
|
|
233
|
+
# Fresh start, all sessions lost
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Reconfigure profile:**
|
|
237
|
+
```bash
|
|
238
|
+
ccs doctor # Shows issues
|
|
239
|
+
# Edit ~/.ccs/{profile}.settings.json manually
|
|
240
|
+
# Verify: ccs {profile} "test"
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Test delegation flow:**
|
|
244
|
+
```bash
|
|
245
|
+
# 1. Simple task
|
|
246
|
+
ccs glm -p "create test.txt with content 'hello'"
|
|
247
|
+
|
|
248
|
+
# 2. Verify session created
|
|
249
|
+
cat ~/.ccs/delegation-sessions.json | jq '.glm.sessionId'
|
|
250
|
+
|
|
251
|
+
# 3. Test continue
|
|
252
|
+
ccs glm:continue -p "append 'world' to test.txt"
|
|
253
|
+
|
|
254
|
+
# 4. Verify aggregation
|
|
255
|
+
cat ~/.ccs/delegation-sessions.json | jq '.glm.turns'
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Emergency Fallback
|
|
259
|
+
|
|
260
|
+
If delegation completely broken:
|
|
261
|
+
```bash
|
|
262
|
+
# Use Claude CLI directly
|
|
263
|
+
claude -p "task" --settings ~/.ccs/glm.settings.json
|
|
264
|
+
|
|
265
|
+
# Bypass delegation (no -p flag)
|
|
266
|
+
ccs glm
|
|
267
|
+
# Then work interactively
|
|
268
|
+
```
|