ccjk 7.0.0 โ†’ 7.0.2

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.
@@ -1,265 +0,0 @@
1
- # CCJK Shared Defaults
2
-
3
- > **Purpose**: Centralized configuration and patterns for all CCJK child skills
4
- > **Used By**: All child skills via inheritance
5
-
6
- ## ๐ŸŽฏ What This File Provides
7
-
8
- All CCJK child skills inherit these defaults, ensuring consistency and reducing duplication.
9
-
10
- ## ๐Ÿ“ Code Generation Defaults
11
-
12
- ### TypeScript Configuration
13
- ```typescript
14
- // Always use these TypeScript defaults
15
- {
16
- "compilerOptions": {
17
- "target": "ES2022",
18
- "module": "ESNext",
19
- "moduleResolution": "bundler",
20
- "strict": true,
21
- "esModuleInterop": true,
22
- "skipLibCheck": true,
23
- "forceConsistentCasingInFileNames": true
24
- }
25
- }
26
- ```
27
-
28
- ### Import/Export Style
29
- ```typescript
30
- // โœ… CORRECT: ESM imports
31
- import { foo } from './foo'
32
- export { bar }
33
-
34
- // โŒ INCORRECT: CommonJS
35
- const foo = require('./foo')
36
- module.exports = { bar }
37
- ```
38
-
39
- ### Error Handling Pattern
40
- ```typescript
41
- // Standard error handling for all CCJK code
42
- class CCJKError extends Error {
43
- constructor(
44
- message: string,
45
- public code: string,
46
- public details?: unknown
47
- ) {
48
- super(i18n.t(`errors.${code}`))
49
- this.name = 'CCJKError'
50
- }
51
- }
52
-
53
- // Usage
54
- throw new CCJKError('Failed to load config', 'CONFIG_LOAD_FAILED', { path })
55
- ```
56
-
57
- ## ๐Ÿ“ Cross-Platform Paths
58
-
59
- ### Path Resolution
60
- ```typescript
61
- import path from 'node:path'
62
- import os from 'node:os'
63
-
64
- // Config directories (platform-aware)
65
- export const PATHS = {
66
- config: process.env.APPDATA || path.join(os.homedir(), '.config'),
67
- cache: path.join(os.homedir(), '.ccjk', 'cache'),
68
- data: path.join(os.homedir(), '.ccjk'),
69
- temp: os.tmpdir()
70
- }
71
- ```
72
-
73
- ### Path Separators
74
- ```typescript
75
- // โœ… CORRECT: Use path.join for cross-platform
76
- const configPath = path.join(os.homedir(), '.ccjk', 'config.json')
77
-
78
- // โŒ INCORRECT: Hardcoded separators (won't work on Windows)
79
- const configPath = os.homedir() + '/.ccjk/config.json'
80
- ```
81
-
82
- ## ๐Ÿ”’ Security Patterns
83
-
84
- ### Environment Variables
85
- ```typescript
86
- // โœ… CORRECT: Use environment variables for secrets
87
- const apiKey = process.env.CCJK_API_KEY
88
-
89
- // โŒ INCORRECT: Hardcoded secrets
90
- const apiKey = 'sk-ant-xxx...'
91
- ```
92
-
93
- ### File Permissions
94
- ```typescript
95
- // Check file permissions before operations
96
- import { access } from 'node:fs/promises'
97
-
98
- async function ensureWriteAccess(filePath: string) {
99
- try {
100
- await access(filePath, constants.W_OK)
101
- return true
102
- } catch {
103
- return false
104
- }
105
- }
106
- ```
107
-
108
- ## ๐ŸŒ i18n Patterns
109
-
110
- ### User-Facing Strings
111
- ```typescript
112
- // โœ… CORRECT: Use i18n for user-facing strings
113
- console.log(i18n.t('cli.init.success'))
114
-
115
- // โŒ INCORRECT: Hardcoded strings
116
- console.log('Initialization successful')
117
- ```
118
-
119
- ### Error Messages
120
- ```typescript
121
- // โœ… CORRECT: i18n with context
122
- throw new Error(i18n.t('errors.config.notFound', { path }))
123
-
124
- // โŒ INCORRECT: Hardcoded error
125
- throw new Error(`Config not found: ${path}`)
126
- ```
127
-
128
- ## ๐Ÿงช Testing Patterns
129
-
130
- ### Test Structure
131
- ```typescript
132
- describe('FeatureName', () => {
133
- describe('functionName()', () => {
134
- it('should do X when Y', async () => {
135
- // Arrange
136
- const input = createMockInput()
137
-
138
- // Act
139
- const result = await functionName(input)
140
-
141
- // Assert
142
- expect(result).toEqual(expectedOutput)
143
- })
144
- })
145
- })
146
- ```
147
-
148
- ### Coverage Goals
149
- - Lines: > 80%
150
- - Functions: > 80%
151
- - Branches: > 80%
152
- - Statements: > 80%
153
-
154
- ## ๐ŸŽจ Code Style
155
-
156
- ### Naming Conventions
157
- - **Files**: kebab-case (`config-manager.ts`)
158
- - **Variables**: camelCase (`const configPath`)
159
- - **Classes**: PascalCase (`class ConfigManager`)
160
- - **Constants**: SCREAMING_SNAKE_CASE (`const MAX_RETRIES`)
161
- - **Types/Interfaces**: PascalCase (`interface ConfigOptions`)
162
- - **Enums**: PascalCase (`enum ErrorType`)
163
-
164
- ### Formatting
165
- - Use `@antfu/eslint-config`
166
- - 2 space indentation
167
- - Single quotes for strings
168
- - Semicolons required
169
- - Trailing commas in objects/arrays
170
-
171
- ## ๐Ÿ”ง Configuration Defaults
172
-
173
- ### Default Config Structure
174
- ```typescript
175
- interface CCJKConfig {
176
- version: string
177
- apiProvider: string
178
- mcpServers: Record<string, MCPConfig>
179
- workflows: Record<string, WorkflowConfig>
180
- features: FeatureFlags
181
- }
182
-
183
- interface MCPConfig {
184
- transport: 'stdio' | 'sse'
185
- command?: string
186
- args?: string[]
187
- env?: Record<string, string>
188
- }
189
-
190
- interface FeatureFlags {
191
- cloudSync: boolean
192
- remoteExecution: boolean
193
- errorTerminator: boolean
194
- }
195
- ```
196
-
197
- ### Default Values
198
- ```typescript
199
- export const DEFAULTS = {
200
- timeout: 30000, // 30 seconds
201
- retries: 3,
202
- cacheTTL: 24 * 60 * 60 * 1000, // 24 hours
203
- maxCacheSize: 100 * 1024 * 1024, // 100MB
204
- logLevel: 'info' as const
205
- }
206
- ```
207
-
208
- ## ๐Ÿš€ Performance Patterns
209
-
210
- ### Async Operations
211
- ```typescript
212
- // โœ… CORRECT: Use Promise.all for parallel operations
213
- const [config1, config2] = await Promise.all([
214
- loadConfig('config1.json'),
215
- loadConfig('config2.json')
216
- ])
217
-
218
- // โŒ INCORRECT: Sequential await (slower)
219
- const config1 = await loadConfig('config1.json')
220
- const config2 = await loadConfig('config2.json')
221
- ```
222
-
223
- ### Caching Strategy
224
- ```typescript
225
- // Cache-first pattern with fallback
226
- async function getCachedOrFetch(key: string) {
227
- const cached = await cache.get(key)
228
- if (cached && !isExpired(cached)) {
229
- return cached
230
- }
231
-
232
- const fresh = await fetchFromSource(key)
233
- await cache.set(key, fresh)
234
- return fresh
235
- }
236
- ```
237
-
238
- ## ๐Ÿ“‹ Platform-Specific Notes
239
-
240
- ### Windows
241
- - Use `path.join()` for paths
242
- - Use `process.env.APPDATA` for config
243
- - Handle both PowerShell and CMD
244
- - Line endings: CRLF
245
-
246
- ### macOS/Linux
247
- - Use `path.join()` for paths
248
- - Use `~/.config` for config
249
- - Use bash/zsh scripts
250
- - Line endings: LF
251
-
252
- ### Termux
253
- - Paths: `/data/data/com.termux/files/home/.ccjk`
254
- - Limited package support
255
- - Some features may not work
256
-
257
- ## ๐Ÿ”— Related Files
258
-
259
- - [Coding Standards](./coding-standards.md)
260
- - [Platform Conventions](./platform-conventions.md)
261
- - [Error Patterns](./error-patterns.md)
262
-
263
- ---
264
-
265
- **Note**: When this file is updated, all child skills benefit from the changes automatically.
@@ -1,198 +0,0 @@
1
- # CCJK Coding Standards
2
-
3
- > **Purpose**: Define coding standards for all CCJK development
4
- > **Applied To**: All generated code, child skills
5
-
6
- ## ๐ŸŽฏ Core Principles
7
-
8
- ### 1. TypeScript-First
9
- - โœ… Use TypeScript for all new code
10
- - โœ… Enable strict mode
11
- - โœ… Provide explicit type annotations
12
- - โŒ Avoid `any` without good reason
13
-
14
- ```typescript
15
- // โœ… GOOD
16
- interface Config {
17
- name: string
18
- version: string
19
- }
20
-
21
- function loadConfig(config: Config): void {
22
- // ...
23
- }
24
-
25
- // โŒ BAD
26
- function loadConfig(config: any): void {
27
- // ...
28
- }
29
- ```
30
-
31
- ### 2. English Comments Only
32
- - โœ… All code comments in English
33
- - โœ… All documentation in English (except README_zh-CN)
34
- - โŒ No Chinese in code comments
35
-
36
- ```typescript
37
- // โœ… GOOD: Clear English comment
38
- // Load MCP configuration from file
39
- async function loadMCPConfig(): Promise<MCPConfig> {
40
- // ...
41
- }
42
-
43
- // โŒ BAD: Chinese comment
44
- // ๅŠ ่ฝฝ MCP ้…็ฝฎ
45
- async function loadMCPConfig(): Promise<MCPConfig> {
46
- // ...
47
- }
48
- ```
49
-
50
- ### 3. i18n for User-Facing Strings
51
- - โœ… Use `i18n.t()` for all user-facing strings
52
- - โœ… Support both zh-CN and en
53
- - โŒ Don't hardcode user messages
54
-
55
- ```typescript
56
- // โœ… GOOD
57
- console.log(i18n.t('cli.init.success'))
58
-
59
- // โŒ BAD
60
- console.log('ๅˆๅง‹ๅŒ–ๆˆๅŠŸ') // Chinese
61
- console.log('Init success') // English, not translatable
62
- ```
63
-
64
- ### 4. ESM-Only
65
- - โœ… Use ES modules (import/export)
66
- - โŒ Don't use CommonJS (require/module.exports)
67
-
68
- ```typescript
69
- // โœ… GOOD: ESM
70
- import { foo } from './foo'
71
- export { bar }
72
-
73
- // โŒ BAD: CommonJS
74
- const foo = require('./foo')
75
- module.exports = { bar }
76
- ```
77
-
78
- ## ๐Ÿ“ File Organization
79
-
80
- ### Directory Structure
81
- ```
82
- src/
83
- โ”œโ”€โ”€ commands/ # CLI commands
84
- โ”œโ”€โ”€ utils/ # Utility functions
85
- โ”œโ”€โ”€ i18n/ # Internationalization
86
- โ”œโ”€โ”€ types/ # Type definitions
87
- โ””โ”€โ”€ config/ # Configuration management
88
- ```
89
-
90
- ### File Naming
91
- - Source files: kebab-case (`config-manager.ts`)
92
- - Test files: `*.test.ts` suffix
93
- - Type files: `*.types.ts` or `types.ts`
94
-
95
- ## ๐ŸŽจ Code Style
96
-
97
- ### Naming Conventions
98
- | Type | Convention | Example |
99
- |------|-----------|---------|
100
- | Variables | camelCase | `const configPath` |
101
- | Functions | camelCase | `function loadConfig()` |
102
- | Classes | PascalCase | `class ConfigManager` |
103
- | Interfaces | PascalCase | `interface IConfig` |
104
- | Types | PascalCase | `type ConfigOptions` |
105
- | Constants | SCREAMING_SNAKE_CASE | `const MAX_RETRIES` |
106
-
107
- ### Indentation & Spacing
108
- - 2 spaces (no tabs)
109
- - Single quotes for strings
110
- - Semicolons required
111
- - Trailing commas in objects/arrays
112
-
113
- ## ๐Ÿงช Testing Standards
114
-
115
- ### Test Structure
116
- ```typescript
117
- describe('FeatureName', () => {
118
- describe('functionName()', () => {
119
- it('should do X when Y', async () => {
120
- // Arrange
121
- const input = createMockInput()
122
-
123
- // Act
124
- const result = await functionName(input)
125
-
126
- // Assert
127
- expect(result).toEqual(expectedOutput)
128
- })
129
- })
130
- })
131
- ```
132
-
133
- ### Coverage Goals
134
- - Lines: > 80%
135
- - Functions: > 80%
136
- - Branches: > 80%
137
- - Statements: > 80%
138
-
139
- ## ๐Ÿ”’ Error Handling
140
-
141
- ### Error Class
142
- ```typescript
143
- class CCJKError extends Error {
144
- constructor(
145
- message: string,
146
- public code: string,
147
- public details?: unknown
148
- ) {
149
- super(i18n.t(`errors.${code}`))
150
- this.name = 'CCJKError'
151
- }
152
- }
153
- ```
154
-
155
- ### Error Throwing
156
- ```typescript
157
- // โœ… GOOD: Use custom error
158
- throw new CCJKError(
159
- 'Failed to load configuration',
160
- 'CONFIG_LOAD_FAILED',
161
- { path }
162
- )
163
-
164
- // โŒ BAD: Throw string
165
- throw 'Config not found'
166
- ```
167
-
168
- ## ๐Ÿ“š Documentation Standards
169
-
170
- ### Function Documentation
171
- ```typescript
172
- /**
173
- * Load CCJK configuration from file
174
- * @param configPath - Path to config file
175
- * @returns Parsed configuration object
176
- * @throws {CCJKError} If file not found or invalid JSON
177
- */
178
- async function loadConfig(configPath: string): Promise<CCJKConfig> {
179
- // ...
180
- }
181
- ```
182
-
183
- ### JSDoc Tags
184
- - `@param` - Parameter description
185
- - `@returns` - Return value description
186
- - `@throws` - Error conditions
187
- - `@example` - Usage example
188
-
189
- ## ๐Ÿ”— Related Files
190
-
191
- - [CCJK Defaults](./ccjk-defaults.md)
192
- - [Platform Conventions](./platform-conventions.md)
193
- - [Error Patterns](./error-patterns.md)
194
-
195
- ---
196
-
197
- **Status**: โœ… Active standard
198
- **Enforced By**: ESLint, TypeScript compiler