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.
- package/dist/chunks/package.mjs +1 -1
- package/package.json +61 -68
- package/.claude/hooks/ccjk-diagnose-hook.sh +0 -106
- package/.claude/hooks/eslint-hook.ts +0 -122
- package/.claude-plugin/plugin.json +0 -9
- package/README-INTERNAL.md +0 -305
- package/agents/agent-router.md +0 -135
- package/agents/agents.json +0 -6
- package/agents/cache-manager.ts +0 -265
- package/agents/doc-researcher.md +0 -202
- package/agents/mcp-researcher.md +0 -285
- package/agents/npm-researcher.md +0 -383
- package/agents/version-checker.md +0 -332
- package/hooks/hooks.json +0 -15
- package/skills/ccjk/SKILL.md +0 -224
- package/skills/ccjk/references/ccjk-defaults.md +0 -265
- package/skills/ccjk/references/coding-standards.md +0 -198
- package/skills/ccjk/references/error-patterns.md +0 -353
- package/skills/ccjk/references/platform-conventions.md +0 -307
- package/skills/ccjk-config/SKILL.md +0 -301
- package/skills/ccjk-init/SKILL.md +0 -201
- package/skills/ccjk-mcp/SKILL.md +0 -249
- package/skills/ccjk-sync/SKILL.md +0 -328
- package/skills/coding-guidelines.md +0 -262
- package/skills/config-router/SKILL.md +0 -233
- package/skills/domain-cli.md +0 -228
- package/skills/domain-cloud.md +0 -246
- package/skills/domain-desktop.md +0 -272
- package/skills/domain-web.md +0 -229
- package/skills/layer1-api.md +0 -160
- package/skills/layer1-mcp.md +0 -305
- package/skills/layer1-workflow.md +0 -144
- package/skills/layer2-best-practices.md +0 -155
- package/skills/layer2-design-patterns.md +0 -107
|
@@ -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
|