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,354 @@
1
+ ---
2
+ name: ts-best-practices
3
+ description: TypeScript 5.3+ best practices and patterns for type-safe development
4
+ description_zh: TypeScript 5.3+ 最佳实践和类型安全开发模式
5
+ version: 1.0.0
6
+ category: programming
7
+ triggers: ['/ts-best-practices', '/typescript', '/ts-patterns']
8
+ use_when:
9
+ - Writing TypeScript code with strict typing
10
+ - Implementing generic constraints and utility types
11
+ - Optimizing TypeScript performance and maintainability
12
+ - Code review for TypeScript projects
13
+ use_when_zh:
14
+ - 编写严格类型的 TypeScript 代码
15
+ - 实现泛型约束和工具类型
16
+ - 优化 TypeScript 性能和可维护性
17
+ - TypeScript 项目代码审查
18
+ auto_activate: true
19
+ priority: 8
20
+ agents: [typescript-expert, code-reviewer]
21
+ tags: [typescript, types, generics, patterns, best-practices]
22
+ ---
23
+
24
+ # TypeScript Best Practices | TypeScript 最佳实践
25
+
26
+ ## Context | 上下文
27
+
28
+ Use this skill when working with TypeScript 5.3+ projects that require strict typing, performance optimization, and maintainable code architecture. Essential for enterprise-grade TypeScript development.
29
+
30
+ 在使用 TypeScript 5.3+ 项目时使用此技能,需要严格类型、性能优化和可维护的代码架构。对于企业级 TypeScript 开发至关重要。
31
+
32
+ ## Best Practices | 最佳实践
33
+
34
+ ### 1. Strict Type Configuration | 严格类型配置
35
+
36
+ ```typescript
37
+ // tsconfig.json - Recommended strict settings
38
+ {
39
+ "compilerOptions": {
40
+ "strict": true,
41
+ "noUncheckedIndexedAccess": true,
42
+ "exactOptionalPropertyTypes": true,
43
+ "noImplicitReturns": true,
44
+ "noFallthroughCasesInSwitch": true,
45
+ "noUncheckedSideEffectImports": true
46
+ }
47
+ }
48
+ ```
49
+
50
+ ### 2. Generic Constraints | 泛型约束
51
+
52
+ ```typescript
53
+ // ✅ Good: Proper generic constraints
54
+ interface Repository<T extends { id: string }> {
55
+ findById(id: string): Promise<T | null>;
56
+ save(entity: T): Promise<T>;
57
+ }
58
+
59
+ // ✅ Good: Conditional types with constraints
60
+ type ApiResponse<T> = T extends string
61
+ ? { message: T }
62
+ : { data: T };
63
+
64
+ // ❌ Bad: Unconstrained generics
65
+ interface BadRepository<T> {
66
+ findById(id: string): Promise<T | null>; // T could be anything
67
+ }
68
+ ```
69
+
70
+ ### 3. Utility Types Usage | 工具类型使用
71
+
72
+ ```typescript
73
+ // ✅ Good: Leverage built-in utility types
74
+ interface User {
75
+ id: string;
76
+ name: string;
77
+ email: string;
78
+ password: string;
79
+ }
80
+
81
+ type PublicUser = Omit<User, 'password'>;
82
+ type UserUpdate = Partial<Pick<User, 'name' | 'email'>>;
83
+ type CreateUser = Omit<User, 'id'>;
84
+
85
+ // ✅ Good: Custom utility types
86
+ type NonNullable<T> = T extends null | undefined ? never : T;
87
+ type DeepReadonly<T> = {
88
+ readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
89
+ };
90
+ ```
91
+
92
+ ### 4. Type Guards and Assertions | 类型守卫和断言
93
+
94
+ ```typescript
95
+ // ✅ Good: Type guards
96
+ function isString(value: unknown): value is string {
97
+ return typeof value === 'string';
98
+ }
99
+
100
+ function isUser(obj: unknown): obj is User {
101
+ return typeof obj === 'object' &&
102
+ obj !== null &&
103
+ 'id' in obj &&
104
+ 'name' in obj;
105
+ }
106
+
107
+ // ✅ Good: Assertion functions
108
+ function assertIsNumber(value: unknown): asserts value is number {
109
+ if (typeof value !== 'number') {
110
+ throw new Error('Expected number');
111
+ }
112
+ }
113
+ ```
114
+
115
+ ## Common Patterns | 常用模式
116
+
117
+ ### 1. Builder Pattern with Types | 带类型的建造者模式
118
+
119
+ ```typescript
120
+ class QueryBuilder<T> {
121
+ private conditions: Array<(item: T) => boolean> = [];
122
+
123
+ where<K extends keyof T>(
124
+ key: K,
125
+ value: T[K]
126
+ ): QueryBuilder<T> {
127
+ this.conditions.push(item => item[key] === value);
128
+ return this;
129
+ }
130
+
131
+ build(): (items: T[]) => T[] {
132
+ return items => items.filter(item =>
133
+ this.conditions.every(condition => condition(item))
134
+ );
135
+ }
136
+ }
137
+
138
+ // Usage
139
+ const userFilter = new QueryBuilder<User>()
140
+ .where('status', 'active')
141
+ .where('role', 'admin')
142
+ .build();
143
+ ```
144
+
145
+ ### 2. Event System with Type Safety | 类型安全的事件系统
146
+
147
+ ```typescript
148
+ interface EventMap {
149
+ 'user:created': { user: User };
150
+ 'user:updated': { user: User; changes: Partial<User> };
151
+ 'user:deleted': { userId: string };
152
+ }
153
+
154
+ class TypedEventEmitter<T extends Record<string, any>> {
155
+ private listeners: {
156
+ [K in keyof T]?: Array<(data: T[K]) => void>;
157
+ } = {};
158
+
159
+ on<K extends keyof T>(
160
+ event: K,
161
+ listener: (data: T[K]) => void
162
+ ): void {
163
+ if (!this.listeners[event]) {
164
+ this.listeners[event] = [];
165
+ }
166
+ this.listeners[event]!.push(listener);
167
+ }
168
+
169
+ emit<K extends keyof T>(event: K, data: T[K]): void {
170
+ this.listeners[event]?.forEach(listener => listener(data));
171
+ }
172
+ }
173
+
174
+ // Usage with full type safety
175
+ const emitter = new TypedEventEmitter<EventMap>();
176
+ emitter.on('user:created', ({ user }) => {
177
+ console.log(`User ${user.name} created`); // ✅ Type-safe
178
+ });
179
+ ```
180
+
181
+ ### 3. Branded Types for Domain Safety | 领域安全的品牌类型
182
+
183
+ ```typescript
184
+ // ✅ Good: Branded types prevent mixing different IDs
185
+ type UserId = string & { readonly brand: unique symbol };
186
+ type ProductId = string & { readonly brand: unique symbol };
187
+
188
+ function createUserId(id: string): UserId {
189
+ return id as UserId;
190
+ }
191
+
192
+ function createProductId(id: string): ProductId {
193
+ return id as ProductId;
194
+ }
195
+
196
+ function getUser(id: UserId): Promise<User> {
197
+ // Implementation
198
+ }
199
+
200
+ // This prevents accidental ID mixing
201
+ const userId = createUserId('user-123');
202
+ const productId = createProductId('product-456');
203
+
204
+ getUser(userId); // ✅ Works
205
+ getUser(productId); // ❌ Type error - prevents bugs
206
+ ```
207
+
208
+ ## Anti-Patterns | 反模式
209
+
210
+ ### 1. Avoid `any` and Type Assertions | 避免 `any` 和类型断言
211
+
212
+ ```typescript
213
+ // ❌ Bad: Using any
214
+ function processData(data: any): any {
215
+ return data.someProperty;
216
+ }
217
+
218
+ // ❌ Bad: Unsafe type assertions
219
+ const user = data as User; // Could fail at runtime
220
+
221
+ // ✅ Good: Proper typing with validation
222
+ function processData<T extends { someProperty: unknown }>(
223
+ data: T
224
+ ): T['someProperty'] {
225
+ return data.someProperty;
226
+ }
227
+
228
+ // ✅ Good: Safe type assertions with validation
229
+ function isUser(data: unknown): data is User {
230
+ return typeof data === 'object' &&
231
+ data !== null &&
232
+ 'id' in data;
233
+ }
234
+
235
+ const user = isUser(data) ? data : null;
236
+ ```
237
+
238
+ ### 2. Avoid Overly Complex Types | 避免过于复杂的类型
239
+
240
+ ```typescript
241
+ // ❌ Bad: Overly complex type that's hard to understand
242
+ type ComplexType<T> = T extends infer U
243
+ ? U extends Record<string, any>
244
+ ? { [K in keyof U]: U[K] extends Function
245
+ ? ReturnType<U[K]> extends Promise<infer R>
246
+ ? R extends object
247
+ ? ComplexType<R>
248
+ : never
249
+ : never
250
+ : never }
251
+ : never
252
+ : never;
253
+
254
+ // ✅ Good: Break down complex types into smaller, named pieces
255
+ type AsyncReturnType<T> = T extends (...args: any[]) => Promise<infer R>
256
+ ? R
257
+ : never;
258
+
259
+ type FunctionProperties<T> = {
260
+ [K in keyof T]: T[K] extends Function ? T[K] : never;
261
+ };
262
+
263
+ type ExtractAsyncReturns<T> = {
264
+ [K in keyof FunctionProperties<T>]: AsyncReturnType<T[K]>;
265
+ };
266
+ ```
267
+
268
+ ### 3. Avoid Mutation of Readonly Types | 避免修改只读类型
269
+
270
+ ```typescript
271
+ // ❌ Bad: Mutating readonly arrays
272
+ function badSort(items: readonly number[]): readonly number[] {
273
+ return items.sort(); // Mutates the original array!
274
+ }
275
+
276
+ // ✅ Good: Create new arrays for readonly inputs
277
+ function goodSort(items: readonly number[]): readonly number[] {
278
+ return [...items].sort();
279
+ }
280
+
281
+ // ✅ Good: Use proper readonly patterns
282
+ interface ReadonlyConfig {
283
+ readonly apiUrl: string;
284
+ readonly timeout: number;
285
+ readonly features: readonly string[];
286
+ }
287
+ ```
288
+
289
+ ## Performance Tips | 性能提示
290
+
291
+ ### 1. Use Type-Only Imports | 使用仅类型导入
292
+
293
+ ```typescript
294
+ // ✅ Good: Type-only imports don't affect bundle size
295
+ import type { User, ApiResponse } from './types';
296
+ import { validateUser } from './validators';
297
+
298
+ // ❌ Bad: Importing types as values
299
+ import { User, ApiResponse, validateUser } from './module';
300
+ ```
301
+
302
+ ### 2. Optimize Conditional Types | 优化条件类型
303
+
304
+ ```typescript
305
+ // ✅ Good: Efficient conditional type
306
+ type IsArray<T> = T extends readonly any[] ? true : false;
307
+
308
+ // ❌ Bad: Inefficient nested conditionals
309
+ type BadIsArray<T> = T extends any[]
310
+ ? true
311
+ : T extends readonly any[]
312
+ ? true
313
+ : false;
314
+ ```
315
+
316
+ ### 3. Use Template Literal Types Wisely | 明智使用模板字面量类型
317
+
318
+ ```typescript
319
+ // ✅ Good: Reasonable template literal usage
320
+ type EventName = `on${Capitalize<string>}`;
321
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
322
+ type ApiEndpoint = `/${string}`;
323
+
324
+ // ❌ Bad: Overly complex template literals that slow compilation
325
+ type BadComplexTemplate<T extends Record<string, any>> = {
326
+ [K in keyof T as `get${Capitalize<string & K>}From${Capitalize<string>}With${Capitalize<string>}`]: T[K];
327
+ };
328
+ ```
329
+
330
+ ## Code Quality Checklist | 代码质量检查清单
331
+
332
+ - [ ] All functions have explicit return types
333
+ - [ ] Generic constraints are properly defined
334
+ - [ ] No usage of `any` or unsafe type assertions
335
+ - [ ] Proper error handling with typed errors
336
+ - [ ] Type guards are used for runtime validation
337
+ - [ ] Utility types are leveraged appropriately
338
+ - [ ] Complex types are broken down into smaller pieces
339
+ - [ ] Type-only imports are used where possible
340
+ - [ ] Branded types are used for domain safety
341
+ - [ ] Performance implications of types are considered
342
+
343
+ ## 代码质量检查清单
344
+
345
+ - [ ] 所有函数都有明确的返回类型
346
+ - [ ] 泛型约束定义正确
347
+ - [ ] 不使用 `any` 或不安全的类型断言
348
+ - [ ] 使用类型化错误进行适当的错误处理
349
+ - [ ] 使用类型守卫进行运行时验证
350
+ - [ ] 适当利用工具类型
351
+ - [ ] 复杂类型被分解为更小的部分
352
+ - [ ] 在可能的地方使用仅类型导入
353
+ - [ ] 使用品牌类型确保领域安全
354
+ - [ ] 考虑类型的性能影响
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "14.1.10",
5
- "packageManager": "pnpm@10.17.1",
4
+ "version": "14.2.0",
6
5
  "description": "Production-ready AI dev environment for Claude Code, Codex, and modern coding workflows with 30-second onboarding, persistent memory, Agent Teams, remote control, and capability discovery.",
7
6
  "author": {
8
7
  "name": "CCJK Team",
@@ -81,46 +80,6 @@
81
80
  "engines": {
82
81
  "node": ">=20"
83
82
  },
84
- "scripts": {
85
- "dev": "tsx ./src/cli.ts",
86
- "build": "pnpm build:release:deps && pnpm build:root",
87
- "build:root": "unbuild",
88
- "build:release:deps": "pnpm --filter @ccjk/wire build && pnpm --filter @ccjk/evolution build",
89
- "start": "node bin/ccjk.mjs",
90
- "typecheck": "pnpm build:release:deps && pnpm typecheck:root",
91
- "typecheck:root": "tsc --noEmit",
92
- "release:verify": "node scripts/release-verify.mjs",
93
- "release:verify:full": "node scripts/release-verify.mjs --with-tests",
94
- "prepublishOnly": "node scripts/validate-prepublish.mjs && pnpm contract:check && pnpm build",
95
- "lint": "eslint",
96
- "lint:fix": "eslint --fix",
97
- "test": "vitest",
98
- "test:ui": "vitest --ui",
99
- "test:coverage": "vitest run --coverage",
100
- "test:run": "vitest run",
101
- "test:release": "vitest run src/commands/menu/index.test.ts src/commands/menu/main-menu.test.ts src/utils/tool-update-scheduler.test.ts tests/commands/api-config-selector.test.ts tests/commands/init.silent.test.ts tests/commands/onboarding-wizard.test.ts tests/commands/research.test.ts tests/utils/banner.test.ts tests/utils/code-type-resolver.test.ts tests/utils/memory-feature.test.ts",
102
- "test:watch": "vitest watch",
103
- "test:e2e": "NODE_ENV=test vitest --config vitest.e2e.config.ts",
104
- "test:e2e:run": "NODE_ENV=test vitest run --config vitest.e2e.config.ts",
105
- "test:e2e:ui": "NODE_ENV=test vitest --config vitest.e2e.config.ts --ui",
106
- "test:e2e:coverage": "NODE_ENV=test vitest run --config vitest.e2e.config.ts --coverage",
107
- "test:e2e:debug": "NODE_ENV=test CCJK_E2E_DEBUG=true vitest --config vitest.e2e.config.ts",
108
- "test:integration": "NODE_ENV=test vitest --config vitest.integration.config.ts",
109
- "test:integration:run": "NODE_ENV=test vitest run --config vitest.integration.config.ts",
110
- "test:integration:ui": "NODE_ENV=test vitest --config vitest.integration.config.ts --ui",
111
- "test:integration:coverage": "NODE_ENV=test vitest run --config vitest.integration.config.ts --coverage",
112
- "prepare": "husky",
113
- "format": "prettier --write src/**/*.ts",
114
- "prepublish:fix": "node scripts/fix-package-catalog.mjs",
115
- "cleanup": "node scripts/cleanup.js",
116
- "cleanup:auto": "node scripts/cleanup.js --auto",
117
- "cleanup:dry": "node scripts/cleanup.js --dry-run",
118
- "clean": "rm -rf dist coverage .turbo *.tsbuildinfo",
119
- "benchmark:compression": "tsx scripts/benchmark-compression.ts",
120
- "i18n:check": "tsx scripts/check-i18n.ts",
121
- "i18n:report": "tsx scripts/check-i18n.ts --report",
122
- "contract:check": "node scripts/check-remote-contract.mjs"
123
- },
124
83
  "dependencies": {
125
84
  "better-sqlite3": "^12.9.0",
126
85
  "fdir": "^6.5.0",
@@ -183,5 +142,43 @@
183
142
  "unbuild": "^3.6.1",
184
143
  "uuid": "^11.1.0",
185
144
  "vitest": "^3.2.4"
145
+ },
146
+ "scripts": {
147
+ "dev": "tsx ./src/cli.ts",
148
+ "build": "pnpm build:release:deps && pnpm build:root",
149
+ "build:root": "unbuild",
150
+ "build:release:deps": "pnpm --filter @ccjk/wire build && pnpm --filter @ccjk/evolution build",
151
+ "start": "node bin/ccjk.mjs",
152
+ "typecheck": "pnpm build:release:deps && pnpm typecheck:root",
153
+ "typecheck:root": "tsc --noEmit",
154
+ "release:verify": "node scripts/release-verify.mjs",
155
+ "release:verify:full": "node scripts/release-verify.mjs --with-tests",
156
+ "lint": "eslint",
157
+ "lint:fix": "eslint --fix",
158
+ "test": "vitest",
159
+ "test:ui": "vitest --ui",
160
+ "test:coverage": "vitest run --coverage",
161
+ "test:run": "vitest run",
162
+ "test:release": "vitest run src/commands/menu/index.test.ts src/commands/menu/main-menu.test.ts src/utils/tool-update-scheduler.test.ts tests/commands/api-config-selector.test.ts tests/commands/init.silent.test.ts tests/commands/onboarding-wizard.test.ts tests/commands/research.test.ts tests/utils/banner.test.ts tests/utils/code-type-resolver.test.ts tests/utils/memory-feature.test.ts",
163
+ "test:watch": "vitest watch",
164
+ "test:e2e": "NODE_ENV=test vitest --config vitest.e2e.config.ts",
165
+ "test:e2e:run": "NODE_ENV=test vitest run --config vitest.e2e.config.ts",
166
+ "test:e2e:ui": "NODE_ENV=test vitest --config vitest.e2e.config.ts --ui",
167
+ "test:e2e:coverage": "NODE_ENV=test vitest run --config vitest.e2e.config.ts --coverage",
168
+ "test:e2e:debug": "NODE_ENV=test CCJK_E2E_DEBUG=true vitest --config vitest.e2e.config.ts",
169
+ "test:integration": "NODE_ENV=test vitest --config vitest.integration.config.ts",
170
+ "test:integration:run": "NODE_ENV=test vitest run --config vitest.integration.config.ts",
171
+ "test:integration:ui": "NODE_ENV=test vitest --config vitest.integration.config.ts --ui",
172
+ "test:integration:coverage": "NODE_ENV=test vitest run --config vitest.integration.config.ts --coverage",
173
+ "format": "prettier --write src/**/*.ts",
174
+ "prepublish:fix": "node scripts/fix-package-catalog.mjs",
175
+ "cleanup": "node scripts/cleanup.js",
176
+ "cleanup:auto": "node scripts/cleanup.js --auto",
177
+ "cleanup:dry": "node scripts/cleanup.js --dry-run",
178
+ "clean": "rm -rf dist coverage .turbo *.tsbuildinfo",
179
+ "benchmark:compression": "tsx scripts/benchmark-compression.ts",
180
+ "i18n:check": "tsx scripts/check-i18n.ts",
181
+ "i18n:report": "tsx scripts/check-i18n.ts --report",
182
+ "contract:check": "node scripts/check-remote-contract.mjs"
186
183
  }
187
- }
184
+ }
@@ -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.
@@ -365,3 +365,17 @@ profiler.report();
365
365
  - [ ] 数据结构是否合适?
366
366
  - [ ] 是否有内存泄漏?
367
367
  - [ ] 是否可以缓存结果?
368
+
369
+
370
+ ---
371
+
372
+ ## Discipline Baseline
373
+
374
+ 这一节统一约束所有人物风格,不影响上面的语气与口味。完整版见 `~/.claude/CLAUDE.md` 的 "Coding Discipline Baseline" 章节。
375
+
376
+ 1. **Think before coding** — 含糊请求先问,不静默选择。
377
+ 2. **Simplicity first** — 最小代码满足需求,没要求的抽象/标志/错误处理一律删。
378
+ 3. **Surgical changes** — 只改任务相关的行;不"顺手优化"邻近代码。
379
+ 4. **Goal-driven** — 把任务转成可验证目标(写失败测试 → 跑通 → 完);自己 loop,别让用户帮你跑命令验证。
380
+
381
+ 如果上面的人物风格与这 4 条冲突,**这 4 条优先**。
@@ -249,3 +249,17 @@ const result = data.map(item => item.value * 2);
249
249
  - **快速反馈** - 尽早给用户看
250
250
  - **持续改进** - 小步快跑
251
251
  - **享受编程** - 代码应该是愉悦的
252
+
253
+
254
+ ---
255
+
256
+ ## Discipline Baseline
257
+
258
+ 这一节统一约束所有人物风格,不影响上面的语气与口味。完整版见 `~/.claude/CLAUDE.md` 的 "Coding Discipline Baseline" 章节。
259
+
260
+ 1. **Think before coding** — 含糊请求先问,不静默选择。
261
+ 2. **Simplicity first** — 最小代码满足需求,没要求的抽象/标志/错误处理一律删。
262
+ 3. **Surgical changes** — 只改任务相关的行;不"顺手优化"邻近代码。
263
+ 4. **Goal-driven** — 把任务转成可验证目标(写失败测试 → 跑通 → 完);自己 loop,别让用户帮你跑命令验证。
264
+
265
+ 如果上面的人物风格与这 4 条冲突,**这 4 条优先**。
@@ -523,3 +523,17 @@ const handlers = {
523
523
  - 实际的使用示例
524
524
  - 常见问题解答
525
525
  - TypeScript 类型定义
526
+
527
+
528
+ ---
529
+
530
+ ## Discipline Baseline
531
+
532
+ 这一节统一约束所有人物风格,不影响上面的语气与口味。完整版见 `~/.claude/CLAUDE.md` 的 "Coding Discipline Baseline" 章节。
533
+
534
+ 1. **Think before coding** — 含糊请求先问,不静默选择。
535
+ 2. **Simplicity first** — 最小代码满足需求,没要求的抽象/标志/错误处理一律删。
536
+ 3. **Surgical changes** — 只改任务相关的行;不"顺手优化"邻近代码。
537
+ 4. **Goal-driven** — 把任务转成可验证目标(写失败测试 → 跑通 → 完);自己 loop,别让用户帮你跑命令验证。
538
+
539
+ 如果上面的人物风格与这 4 条冲突,**这 4 条优先**。
@@ -353,3 +353,17 @@ const launchPlan = {
353
353
  3. 这符合我们的愿景吗?
354
354
 
355
355
  如果答案不是三个 YES,就不要做。
356
+
357
+
358
+ ---
359
+
360
+ ## Discipline Baseline
361
+
362
+ 这一节统一约束所有人物风格,不影响上面的语气与口味。完整版见 `~/.claude/CLAUDE.md` 的 "Coding Discipline Baseline" 章节。
363
+
364
+ 1. **Think before coding** — 含糊请求先问,不静默选择。
365
+ 2. **Simplicity first** — 最小代码满足需求,没要求的抽象/标志/错误处理一律删。
366
+ 3. **Surgical changes** — 只改任务相关的行;不"顺手优化"邻近代码。
367
+ 4. **Goal-driven** — 把任务转成可验证目标(写失败测试 → 跑通 → 完);自己 loop,别让用户帮你跑命令验证。
368
+
369
+ 如果上面的人物风格与这 4 条冲突,**这 4 条优先**。
@@ -119,3 +119,17 @@ KISS - Keep It Simple, Stupid.
119
119
  - 用 `rg` 快速搜索
120
120
  - 批量操作提高效率
121
121
  - 不做多余的事
122
+
123
+
124
+ ---
125
+
126
+ ## Discipline Baseline
127
+
128
+ 这一节统一约束所有人物风格,不影响上面的语气与口味。完整版见 `~/.claude/CLAUDE.md` 的 "Coding Discipline Baseline" 章节。
129
+
130
+ 1. **Think before coding** — 含糊请求先问,不静默选择。
131
+ 2. **Simplicity first** — 最小代码满足需求,没要求的抽象/标志/错误处理一律删。
132
+ 3. **Surgical changes** — 只改任务相关的行;不"顺手优化"邻近代码。
133
+ 4. **Goal-driven** — 把任务转成可验证目标(写失败测试 → 跑通 → 完);自己 loop,别让用户帮你跑命令验证。
134
+
135
+ 如果上面的人物风格与这 4 条冲突,**这 4 条优先**。
@@ -205,3 +205,17 @@ class ShoppingCart {
205
205
  - [ ] 是否有重复代码?
206
206
  - [ ] 是否有足够的测试?
207
207
  - [ ] 是否遵循项目规范?
208
+
209
+
210
+ ---
211
+
212
+ ## Discipline Baseline
213
+
214
+ 这一节统一约束所有人物风格,不影响上面的语气与口味。完整版见 `~/.claude/CLAUDE.md` 的 "Coding Discipline Baseline" 章节。
215
+
216
+ 1. **Think before coding** — 含糊请求先问,不静默选择。
217
+ 2. **Simplicity first** — 最小代码满足需求,没要求的抽象/标志/错误处理一律删。
218
+ 3. **Surgical changes** — 只改任务相关的行;不"顺手优化"邻近代码。
219
+ 4. **Goal-driven** — 把任务转成可验证目标(写失败测试 → 跑通 → 完);自己 loop,别让用户帮你跑命令验证。
220
+
221
+ 如果上面的人物风格与这 4 条冲突,**这 4 条优先**。
@@ -9,6 +9,8 @@ argument-hint: [--validate] [--prioritize] [--focus-mode]
9
9
  # - /linear-method --focus-mode # 专注构建模式
10
10
  ---
11
11
 
12
+ > **基于 Discipline Baseline**:本 workflow 在 4 条全局原则(Think / Simplicity / Surgical / Goal-driven)之上提供更具体的流程编排。当本文档与 baseline 冲突,**baseline 优先**。
13
+
12
14
  # Linear Quality Method
13
15
 
14
16
  基于 Linear 团队的产品开发哲学,通过严格的问题验证、优先级排序和专注构建,打造高质量软件产品。
@@ -8,6 +8,8 @@ argument-hint: [--pattern <pattern-name>] [--scope <file|module|system>] [--safe
8
8
  # - /refactoring-master --safe-mode # 安全模式(每步运行测试)
9
9
  ---
10
10
 
11
+ > **基于 Discipline Baseline**:本 workflow 在 4 条全局原则(Think / Simplicity / Surgical / Goal-driven)之上提供更具体的流程编排。当本文档与 baseline 冲突,**baseline 优先**。
12
+
11
13
  # Refactoring Master Mode
12
14
 
13
15
  基于 Martin Fowler 的《重构:改善既有代码的设计》(第 2 版),系统化地改善代码质量。
@@ -8,6 +8,8 @@ argument-hint: <任务描述> [--skip-research] [--quick] [--focus <阶段>]
8
8
  # - /workflow 优化性能 --focus optimize # 聚焦优化阶段
9
9
  ---
10
10
 
11
+ > **基于 Discipline Baseline**:本 workflow 在 4 条全局原则(Think / Simplicity / Surgical / Goal-driven)之上提供更具体的流程编排。当本文档与 baseline 冲突,**baseline 优先**。
12
+
11
13
  # Workflow - 专业开发助手
12
14
 
13
15
  > **核心理念**: 研究驱动,质量把关,持续优化