ccjk 14.1.10 → 14.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.
Files changed (119) hide show
  1. package/dist/chunks/agent-teams.mjs +1 -1
  2. package/dist/chunks/api-cli.mjs +1 -1
  3. package/dist/chunks/api-config-selector.mjs +3 -3
  4. package/dist/chunks/ccjk-all.mjs +1 -1
  5. package/dist/chunks/ccjk-mcp.mjs +1 -1
  6. package/dist/chunks/ccjk-setup.mjs +1 -1
  7. package/dist/chunks/ccr.mjs +8 -8
  8. package/dist/chunks/check-updates.mjs +1 -1
  9. package/dist/chunks/claude-code-incremental-manager.mjs +3 -3
  10. package/dist/chunks/claude-config.mjs +1 -1
  11. package/dist/chunks/codex-config-switch.mjs +1 -1
  12. package/dist/chunks/codex-provider-manager.mjs +1 -1
  13. package/dist/chunks/config-switch.mjs +1 -1
  14. package/dist/chunks/config.mjs +19 -3
  15. package/dist/chunks/config2.mjs +1 -1
  16. package/dist/chunks/config3.mjs +1 -1
  17. package/dist/chunks/doctor.mjs +175 -6
  18. package/dist/chunks/features.mjs +3 -3
  19. package/dist/chunks/index10.mjs +19 -5
  20. package/dist/chunks/init.mjs +5 -5
  21. package/dist/chunks/mcp-cli.mjs +3 -3
  22. package/dist/chunks/mcp.mjs +3 -3
  23. package/dist/chunks/package.mjs +1 -1
  24. package/dist/chunks/quick-provider.mjs +1 -1
  25. package/dist/chunks/quick-setup.mjs +5 -5
  26. package/dist/chunks/simple-config.mjs +1 -1
  27. package/dist/chunks/smart-guide.mjs +1 -1
  28. package/dist/chunks/update.mjs +6 -6
  29. package/dist/chunks/zero-config.mjs +7 -4
  30. package/dist/cli.mjs +0 -0
  31. package/dist/index.d.mts +3 -0
  32. package/dist/index.d.ts +3 -0
  33. package/dist/index.mjs +1 -1
  34. package/dist/shared/{ccjk.BJ3Zpjo5.mjs → ccjk.BCzOWT1L.mjs} +3 -2
  35. package/dist/shared/{ccjk.B8oqkakg.mjs → ccjk.BLsIiTqO.mjs} +1 -1
  36. package/dist/shared/{ccjk.Hwoicrh8.mjs → ccjk.BXv8aYs1.mjs} +1 -1
  37. package/dist/shared/{ccjk.B9OuS4xZ.mjs → ccjk.CfKJnpbB.mjs} +1 -1
  38. package/dist/shared/{ccjk.BzxpiEPF.mjs → ccjk.Cgv_cFVX.mjs} +2 -2
  39. package/dist/shared/{ccjk.Di1IYU3u.mjs → ccjk.DDL-4C-k.mjs} +47 -10
  40. package/dist/shared/{ccjk.BEiR3L4C.mjs → ccjk.DOw7Fawt.mjs} +3 -3
  41. package/dist/shared/{ccjk.tI_s2uSh.mjs → ccjk.f3TBLJSt.mjs} +1 -1
  42. package/dist/templates/agents/README.md +78 -0
  43. package/dist/templates/common/error-prevention.md +267 -0
  44. package/dist/templates/common/karpathy-baseline.md +83 -0
  45. package/dist/templates/common/output-styles/zh-CN/carmack-mode.md +381 -0
  46. package/dist/templates/common/output-styles/zh-CN/dhh-mode.md +265 -0
  47. package/dist/templates/common/output-styles/zh-CN/evan-you-mode.md +539 -0
  48. package/dist/templates/common/output-styles/zh-CN/jobs-mode.md +369 -0
  49. package/dist/templates/common/output-styles/zh-CN/linus-mode.md +135 -0
  50. package/dist/templates/common/output-styles/zh-CN/uncle-bob-mode.md +221 -0
  51. package/dist/templates/common/workflow/continuousDelivery/en/continuous-delivery.md +628 -0
  52. package/dist/templates/common/workflow/continuousDelivery/zh-CN/continuous-delivery.md +628 -0
  53. package/dist/templates/common/workflow/essential/en/agents/ccjk-config-agent.md +187 -0
  54. package/dist/templates/common/workflow/essential/en/agents/ccjk-mcp-agent.md +191 -0
  55. package/dist/templates/common/workflow/essential/en/agents/ccjk-skill-agent.md +249 -0
  56. package/dist/templates/common/workflow/essential/en/agents/ccjk-workflow-agent.md +277 -0
  57. package/dist/templates/common/workflow/essential/en/agents/get-current-datetime.md +29 -0
  58. package/dist/templates/common/workflow/essential/en/agents/init-architect.md +115 -0
  59. package/dist/templates/common/workflow/essential/en/agents/ui-ux-designer.md +91 -0
  60. package/dist/templates/common/workflow/essential/en/feat.md +92 -0
  61. package/dist/templates/common/workflow/essential/en/goal.md +147 -0
  62. package/dist/templates/common/workflow/essential/en/init-project.md +53 -0
  63. package/dist/templates/common/workflow/essential/zh-CN/agents/get-current-datetime.md +29 -0
  64. package/dist/templates/common/workflow/essential/zh-CN/agents/init-architect.md +115 -0
  65. package/dist/templates/common/workflow/essential/zh-CN/agents/ui-ux-designer.md +91 -0
  66. package/dist/templates/common/workflow/essential/zh-CN/feat.md +315 -0
  67. package/dist/templates/common/workflow/essential/zh-CN/goal.md +146 -0
  68. package/dist/templates/common/workflow/essential/zh-CN/init-project.md +53 -0
  69. package/dist/templates/common/workflow/git/en/git-cleanBranches.md +102 -0
  70. package/dist/templates/common/workflow/git/en/git-commit.md +205 -0
  71. package/dist/templates/common/workflow/git/en/git-rollback.md +90 -0
  72. package/dist/templates/common/workflow/git/en/git-worktree.md +276 -0
  73. package/dist/templates/common/workflow/git/zh-CN/git-cleanBranches.md +102 -0
  74. package/dist/templates/common/workflow/git/zh-CN/git-commit.md +205 -0
  75. package/dist/templates/common/workflow/git/zh-CN/git-rollback.md +90 -0
  76. package/dist/templates/common/workflow/git/zh-CN/git-worktree.md +276 -0
  77. package/dist/templates/common/workflow/interview/en/interview.md +67 -0
  78. package/dist/templates/common/workflow/interview/zh-CN/interview.md +67 -0
  79. package/dist/templates/common/workflow/linearMethod/en/linear-method.md +651 -0
  80. package/dist/templates/common/workflow/linearMethod/zh-CN/linear-method.md +752 -0
  81. package/dist/templates/common/workflow/refactoringMaster/en/refactoring-master.md +516 -0
  82. package/dist/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +812 -0
  83. package/dist/templates/common/workflow/sixStep/en/workflow.md +83 -0
  84. package/dist/templates/common/workflow/sixStep/zh-CN/workflow.md +359 -0
  85. package/dist/templates/common/workflow/specFirstTDD/en/spec-first-tdd.md +364 -0
  86. package/dist/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +366 -0
  87. package/dist/templates/hooks/README.md +212 -0
  88. package/dist/templates/hooks/git-workflow-hooks.md +551 -0
  89. package/dist/templates/hooks/post-test-coverage.md +434 -0
  90. package/dist/templates/hooks/pre-commit-black.md +274 -0
  91. package/dist/templates/hooks/pre-commit-eslint.md +153 -0
  92. package/dist/templates/hooks/pre-commit-gofmt.md +284 -0
  93. package/dist/templates/hooks/pre-commit-prettier.md +212 -0
  94. package/dist/templates/hooks/pre-commit-type-check.md +377 -0
  95. package/dist/templates/skills/ccjk-init.md +154 -0
  96. package/dist/templates/skills/ccjk-mcp-setup.md +205 -0
  97. package/dist/templates/skills/ccjk-troubleshoot.md +228 -0
  98. package/dist/templates/skills/django-patterns.md +1016 -0
  99. package/dist/templates/skills/git-workflow.md +748 -0
  100. package/dist/templates/skills/go-idioms.md +963 -0
  101. package/dist/templates/skills/nextjs-optimization.md +694 -0
  102. package/dist/templates/skills/python-pep8.md +852 -0
  103. package/dist/templates/skills/react-patterns.md +686 -0
  104. package/dist/templates/skills/rust-patterns.md +1057 -0
  105. package/dist/templates/skills/security-best-practices.md +1413 -0
  106. package/dist/templates/skills/testing-best-practices.md +1315 -0
  107. package/dist/templates/skills/ts-best-practices.md +354 -0
  108. package/package.json +40 -43
  109. package/templates/common/karpathy-baseline.md +83 -0
  110. package/templates/common/output-styles/zh-CN/carmack-mode.md +14 -0
  111. package/templates/common/output-styles/zh-CN/dhh-mode.md +14 -0
  112. package/templates/common/output-styles/zh-CN/evan-you-mode.md +14 -0
  113. package/templates/common/output-styles/zh-CN/jobs-mode.md +14 -0
  114. package/templates/common/output-styles/zh-CN/linus-mode.md +14 -0
  115. package/templates/common/output-styles/zh-CN/uncle-bob-mode.md +14 -0
  116. package/templates/common/workflow/linearMethod/zh-CN/linear-method.md +2 -0
  117. package/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +2 -0
  118. package/templates/common/workflow/sixStep/zh-CN/workflow.md +2 -0
  119. package/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +2 -0
@@ -0,0 +1,267 @@
1
+ # CCJK Error Prevention System
2
+
3
+ **IMPORTANT**: This project uses the CCJK Error Prevention System to automatically prevent and fix common Claude Code CLI errors.
4
+
5
+ ---
6
+
7
+ ## 🛡️ Automatic Error Prevention
8
+
9
+ All file operations and commands are automatically protected by CCJK's intelligent error prevention system.
10
+
11
+ ### What It Does
12
+
13
+ The Error Prevention System operates in 5 layers:
14
+
15
+ ```
16
+ ┌─────────────────────────────────────────────────────────────────┐
17
+ │ CCJK Error Prevention System │
18
+ ├─────────────────────────────────────────────────────────────────┤
19
+ │ │
20
+ │ Layer 1: Pre-Execution Validation │
21
+ │ ├─ Parameter format validation │
22
+ │ ├─ Path validity checks │
23
+ │ ├─ Permission verification │
24
+ │ └─ Command existence validation │
25
+ │ │
26
+ │ Layer 2: Intelligent Wrappers │
27
+ │ ├─ Smart Write: Handles existing files automatically │
28
+ │ ├─ Smart Bash: Validates and retries commands │
29
+ │ ├─ Smart Path: Resolves cross-platform paths │
30
+ │ └─ Smart Edit: Detects content changes before editing │
31
+ │ │
32
+ │ Layer 3: Auto-Recovery │
33
+ │ ├─ Retry with exponential backoff │
34
+ │ ├─ Automatic error correction │
35
+ │ ├─ Rollback support │
36
+ │ └─ Fallback mechanisms │
37
+ │ │
38
+ │ Layer 4: Real-time Monitoring │
39
+ │ ├─ Error detection and classification │
40
+ │ ├─ Pattern analysis │
41
+ │ └─ Alert system │
42
+ │ │
43
+ │ Layer 5: Learning System │
44
+ │ ├─ Error history tracking │
45
+ │ └─ Solution database │
46
+ │ │
47
+ └─────────────────────────────────────────────────────────────────┘
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 📋 Errors That Are Automatically Prevented
53
+
54
+ ### 1. Error Writing File
55
+
56
+ **Causes**: File already exists, permission denied, path errors
57
+
58
+ **CCJK Auto-Fix**:
59
+ - ✅ Checks if file exists before writing
60
+ - ✅ Automatically backs up existing files
61
+ - ✅ Uses Edit instead of Write when file exists
62
+ - ✅ Creates missing directories automatically
63
+ - ✅ Retries on transient failures
64
+
65
+ ### 2. Invalid Tool Parameters
66
+
67
+ **Causes**: Wrong parameter format, missing required parameters, type mismatch
68
+
69
+ **CCJK Auto-Fix**:
70
+ - ✅ Validates parameter format before execution
71
+ - ✅ Checks for unclosed quotes
72
+ - ✅ Validates file paths
73
+ - ✅ Provides specific error messages
74
+
75
+ ### 3. Bash Command Failures (Exit Code 1)
76
+
77
+ **Causes**: Command not found, syntax errors, missing environment variables
78
+
79
+ **CCJK Auto-Fix**:
80
+ - ✅ Validates command exists before execution
81
+ - ✅ Checks parameter format
82
+ - ✅ Sets up environment automatically
83
+ - ✅ Retries on failures with exponential backoff
84
+ - ✅ Suggests alternative commands
85
+
86
+ ### 4. Path Resolution Issues
87
+
88
+ **Causes**: Relative path errors, symlinks, cross-platform differences
89
+
90
+ **CCJK Auto-Fix**:
91
+ - ✅ Handles ~ (home directory)
92
+ - ✅ Expands environment variables
93
+ - ✅ Resolves symlinks
94
+ - ✅ Cross-platform path normalization
95
+ - ✅ Provides path fix suggestions
96
+
97
+ ### 5. Permission Denied Errors
98
+
99
+ **Causes**: File permissions, directory permissions, read-only filesystem
100
+
101
+ **CCJK Auto-Fix**:
102
+ - ✅ Checks permissions before operations
103
+ - ✅ Attempts to fix script permissions (chmod +x)
104
+ - ✅ Provides specific permission error messages
105
+ - ✅ Suggests appropriate fixes
106
+
107
+ ---
108
+
109
+ ## 🚀 Best Practices
110
+
111
+ ### When Writing Files
112
+
113
+ **❌ Don't worry about**:
114
+ - File already existing → CCJK handles it
115
+ - Creating directories → CCJK does it automatically
116
+ - Backing up files → CCJK backs up automatically
117
+ - Content validation → CCJK checks before writing
118
+
119
+ **✅ Just write**:
120
+ - CCJK will detect if file exists
121
+ - CCJK will use Edit tool if appropriate
122
+ - CCJK will create directories if needed
123
+ - CCJK will retry if write fails
124
+
125
+ ### When Running Commands
126
+
127
+ **❌ Don't worry about**:
128
+ - Command not existing → CCJK checks first
129
+ - Parameter format → CCJK validates
130
+ - Environment setup → CCJK sets up automatically
131
+ - Command failing → CCJK retries with auto-fix
132
+
133
+ **✅ Just run**:
134
+ - CCJK will validate command exists
135
+ - CCJK will check parameters
136
+ - CCJK will handle dangerous command warnings
137
+ - CCJK will retry on failures
138
+
139
+ ### When Reading Files
140
+
141
+ **❌ Don't worry about**:
142
+ - Path resolution → CCJK resolves paths
143
+ - File not found → CCJK provides clear error
144
+ - Permission issues → CCJK checks permissions
145
+
146
+ **✅ Just read**:
147
+ - CCJK will resolve relative paths
148
+ - CCJK will handle symlinks
149
+ - CCJK will provide helpful error messages
150
+
151
+ ---
152
+
153
+ ## 💡 Error Recovery Flow
154
+
155
+ When an error occurs, CCJK follows this process:
156
+
157
+ ```
158
+ 1. Detect → Classify error type
159
+ 2. Analyze → Determine if retryable
160
+ 3. Auto-fix → Apply automatic correction if possible
161
+ 4. Retry → Retry with exponential backoff
162
+ 5. Fallback → Suggest alternative approach
163
+ 6. Report → Provide detailed error and suggestion
164
+ ```
165
+
166
+ ---
167
+
168
+ ## 🔧 Debugging
169
+
170
+ ### Enable Debug Logging
171
+
172
+ ```bash
173
+ # Enable error prevention debug output
174
+ export CCJK_ERROR_PREVENTION_DEBUG=1
175
+
176
+ # Or enable all CCJK debug output
177
+ export CCJK_DEBUG=1
178
+ ```
179
+
180
+ ### View Error Statistics
181
+
182
+ ```typescript
183
+ import { getMiddleware } from 'ccjk/error-prevention'
184
+
185
+ const middleware = getMiddleware()
186
+ const errorStats = middleware.getErrorStats()
187
+ const fixStats = middleware.getFixStats()
188
+
189
+ console.log('Error Stats:', errorStats)
190
+ console.log('Fix Stats:', fixStats)
191
+ ```
192
+
193
+ ---
194
+
195
+ ## 📊 Expected Impact
196
+
197
+ | Error Type | Before CCJK | After CCJK | Reduction |
198
+ |------------|-------------|------------|-----------|
199
+ | Error writing file | ⭐⭐⭐⭐⭐ | ⭐ | **80%** |
200
+ | Invalid tool parameters | ⭐⭐⭐⭐ | ⭐ | **75%** |
201
+ | Bash command failures | ⭐⭐⭐⭐ | ⭐ | **70%** |
202
+ | Path resolution issues | ⭐⭐⭐ | ⭐ | **85%** |
203
+ | Permission denied | ⭐⭐⭐ | ⭐ | **90%** |
204
+
205
+ ---
206
+
207
+ ## 🎯 Tips
208
+
209
+ 1. **Trust CCJK's automatic handling** - Let the system prevent errors
210
+ 2. **Check console for CCJK messages** - Look for `[CCJK ErrorPrevention]` prefix
211
+ 3. **Review suggestions when errors occur** - CCJK provides specific fix suggestions
212
+ 4. **Report persistent errors** - Help improve the system
213
+
214
+ ---
215
+
216
+ ## 📖 API Reference
217
+
218
+ ```typescript
219
+ import {
220
+ getMiddleware,
221
+ SmartWriteTool,
222
+ SmartBashTool,
223
+ SmartPathResolver,
224
+ } from 'ccjk/error-prevention'
225
+
226
+ // Use middleware (recommended)
227
+ const middleware = getMiddleware()
228
+
229
+ // Write files
230
+ const writeResult = await middleware.interceptWrite(path, content)
231
+
232
+ // Execute commands
233
+ const bashResult = await middleware.interceptBash(command, options)
234
+
235
+ // Read files
236
+ const readResult = await middleware.interceptRead(path)
237
+
238
+ // Edit files
239
+ const editResult = await middleware.interceptEdit(path, oldString, newString)
240
+
241
+ // Get path info
242
+ const pathInfo = await middleware.getPathInfo(path)
243
+
244
+ // Get statistics
245
+ const errors = middleware.getErrorStats()
246
+ const fixes = middleware.getFixStats()
247
+ ```
248
+
249
+ ---
250
+
251
+ ## 🎉 Summary
252
+
253
+ **Before CCJK Error Prevention**:
254
+ - ❌ Frequent errors
255
+ - ❌ Manual debugging
256
+ - ❌ Time wasted
257
+ - ❌ Frustration
258
+
259
+ **After CCJK Error Prevention**:
260
+ - ✅ Automatic prevention
261
+ - ✅ Intelligent fixes
262
+ - ✅ Efficient development
263
+ - ✅ Peace of mind
264
+
265
+ ---
266
+
267
+ **Let CCJK handle the errors, focus on your code! 🚀**
@@ -0,0 +1,83 @@
1
+ # Coding Discipline Baseline
2
+
3
+ > Default behavior for all coding tasks in this project, unless the user
4
+ > explicitly says otherwise. Inspired by Andrej Karpathy's observations on
5
+ > common LLM coding failure modes.
6
+
7
+ These rules apply to **every** task. Style guides (Linus / Carmack / DHH …)
8
+ layer on top — they change voice, not discipline.
9
+
10
+ ---
11
+
12
+ ## 1. Think before coding
13
+
14
+ Surface ambiguity. Don't pick silently.
15
+
16
+ - If the request has two reasonable interpretations, present both and ask.
17
+ - If a constraint is unclear (target file, scope, behavior), ask before coding.
18
+ - If you'd push back on a senior engineer ("this seems unnecessary"), do.
19
+ - Prefer clarifying questions before edits over rework after.
20
+
21
+ ## 2. Simplicity first
22
+
23
+ Minimum code that meets the stated request. Nothing speculative.
24
+
25
+ - No unrequested features, options, flags, or config knobs.
26
+ - No abstractions for single-use code. No interfaces with one implementation.
27
+ - No error handling for impossible scenarios.
28
+ - If 200 lines could be 50, rewrite.
29
+
30
+ Litmus test: a senior engineer reviewing the diff should not think "why all this?"
31
+
32
+ ## 3. Surgical changes
33
+
34
+ Touch only what the task requires.
35
+
36
+ - Don't reformat or "improve" code adjacent to your edit.
37
+ - Don't refactor working code unless that *is* the task.
38
+ - Match existing style/naming/imports — don't introduce a new convention.
39
+ - For orphans created by your own change (now-unused imports, variables, helpers): remove them. For pre-existing dead code: leave it, mention it.
40
+
41
+ Litmus test: every changed line should trace directly to the user's request.
42
+
43
+ ## 4. Goal-driven execution
44
+
45
+ Convert tasks into verifiable goals. Loop until the goal is met — don't ask
46
+ the user to re-run something you can verify yourself.
47
+
48
+ | Vague request | Verifiable goal |
49
+ |---|---|
50
+ | "Add validation" | Write a failing test for invalid input, then make it pass |
51
+ | "Fix the bug" | Write a reproducing test, then make it pass |
52
+ | "Refactor X" | Confirm the same tests pass before and after |
53
+ | "Make it work" | Define what "work" means with a command + expected output |
54
+
55
+ For multi-step tasks, share a brief plan with verification per step before
56
+ starting. Strong goals enable independent looping. Weak goals ("make it
57
+ nice") force back-and-forth.
58
+
59
+ ---
60
+
61
+ ## Project-specific rules
62
+
63
+ These extend the baseline; they don't replace it.
64
+
65
+ - **Verification commands:** `pnpm typecheck`, `pnpm lint`, `pnpm test:run`,
66
+ `pnpm test:release` (curated subset). For Codex/Claude integration paths,
67
+ smoke test with `echo '<option>' | node dist/cli.mjs`.
68
+ - **Generated rule files:** `CLAUDE.md`, `clavue.md`, `AGENTS.md` are
69
+ rewritten by Clavue `/init`. Put durable guidance in
70
+ `docs/CLAUDE-NOTES.md`.
71
+ - **Anti-aggression:** ccjk complements Claude Code; do not auto-run things
72
+ in Claude's runtime. Skills run only on explicit invocation. Don't add
73
+ background hooks that fire on every tool call.
74
+ - **Workspace ownership:** ccjk config lives at `~/.ccjk/`, separate from
75
+ `~/.claude/` and `~/.codex/`. Don't mix them.
76
+
77
+ ---
78
+
79
+ ## When to skip this baseline
80
+
81
+ - Trivial fixes (typo, one-liner): use judgment, don't over-process.
82
+ - The user explicitly says "just do it" / "no questions": skip clarification, but keep simplicity + surgical edits.
83
+ - Emergencies (build broken, prod down): goal is restore-first, then write the regression test.