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,301 +0,0 @@
1
- ---
2
- name: ccjk-config
3
- description: "CRITICAL: Use for general CCJK configuration questions. Triggers on: ccjk config, ccjk configuration, ccjk settings"
4
- parents: ["ccjk"]
5
- ---
6
-
7
- # CCJK Config Skill
8
-
9
- > **Parent**: ccjk (inherits shared defaults and patterns)
10
- > **Purpose**: Handle general CCJK configuration management
11
-
12
- ## 🎯 Quick Start
13
-
14
- **IMPORTANT**: Before generating config code, read `../ccjk/references/ccjk-defaults.md` for shared configuration patterns.
15
-
16
- ## 🔄 Inherited from Parent
17
-
18
- From `ccjk` parent skill, this child skill inherits:
19
- - ✅ Default configuration structure
20
- - ✅ Cross-platform config paths
21
- - ✅ Validation patterns
22
- - ✅ Merge strategies
23
-
24
- See: [../ccjk/SKILL.md](../ccjk/SKILL.md)
25
-
26
- ## 📋 CCJK Configuration Structure
27
-
28
- ### Complete Config Schema
29
- ```typescript
30
- // Inherited from ccjk-defaults.md
31
- interface CCJKConfig {
32
- // Core settings
33
- version: string
34
- environment: 'development' | 'production' | 'test'
35
-
36
- // API provider (inherited from layer1-api)
37
- apiProvider: {
38
- name: string // 'anthropic', '302.ai', 'glm', etc.
39
- apiKey: string
40
- baseURL?: string
41
- model?: string
42
- }
43
-
44
- // MCP servers (inherited from ccjk-mcp)
45
- mcpServers: Record<string, MCPConfig>
46
-
47
- // Workflows (inherited from layer1-workflow)
48
- workflows: Record<string, WorkflowConfig>
49
-
50
- // Sync (inherited from ccjk-sync)
51
- sync: SyncConfig
52
-
53
- // Features
54
- features: {
55
- cloudSync: boolean
56
- remoteExecution: boolean
57
- errorTerminator: boolean
58
- skillsAutoLoad: boolean
59
- }
60
- }
61
- ```
62
-
63
- ## 🎨 Child-Specific Features
64
-
65
- ### Feature 1: Config Validation
66
- ```typescript
67
- // Validate configuration (inherited patterns)
68
- async function validateConfig(config: CCJKConfig) {
69
- const schema = CCJKConfigSchema
70
-
71
- try {
72
- await schema.validate(config)
73
- return { valid: true }
74
- } catch (error) {
75
- return {
76
- valid: false,
77
- errors: error.errors
78
- }
79
- }
80
- }
81
- ```
82
-
83
- ### Feature 2: Config Merge
84
- ```typescript
85
- // Merge user config with defaults (inherited pattern)
86
- async function mergeConfig(userConfig: Partial<CCJKConfig>) {
87
- const defaults = await loadDefaults()
88
-
89
- // Deep merge (inherited from ccjk-defaults.md)
90
- return deepMerge(defaults, userConfig)
91
- }
92
- ```
93
-
94
- ### Feature 3: Config Migration
95
- ```typescript
96
- // Migrate config from old version
97
- async function migrateConfig(oldConfig: any, targetVersion: string) {
98
- const migrations = [
99
- // v4 → v5
100
- (config) => ({
101
- ...config,
102
- version: '5.0.0',
103
- features: {
104
- ...config.features,
105
- skillsAutoLoad: true // New in v5
106
- }
107
- })
108
- ]
109
-
110
- let migrated = oldConfig
111
- for (const migration of migrations) {
112
- if (semver.lt(migrated.version, targetVersion)) {
113
- migrated = migration(migrated)
114
- }
115
- }
116
-
117
- return migrated
118
- }
119
- ```
120
-
121
- ## 🚀 Override from Parent
122
-
123
- ### Override: Config-Specific Error Handling
124
- ```typescript
125
- // PARENT pattern (from ccjk-defaults.md):
126
- throw new CCJKError('Failed to load config', 'CONFIG_LOAD_FAILED')
127
-
128
- // CHILD override (config-specific):
129
- throw new CCJKError(
130
- 'Invalid configuration: Missing required field',
131
- 'CONFIG_VALIDATION_FAILED',
132
- {
133
- field: 'apiProvider.apiKey',
134
- required: true,
135
- suggestion: 'Set CCJK_API_KEY environment variable'
136
- }
137
- )
138
- ```
139
-
140
- ## 📊 Config-Specific Patterns
141
-
142
- ### Pattern 1: Config Hierarchy
143
- ```typescript
144
- // Config loading priority (highest to lowest)
145
- async function loadConfigWithPriority() {
146
- const sources = [
147
- process.env.CCJK_CONFIG, // Environment override
148
- './.ccjk/config.json', // Project config
149
- path.join(os.homedir(), '.ccjk', 'config.json') // User config
150
- ]
151
-
152
- for (const source of sources) {
153
- if (source && existsSync(source)) {
154
- return await loadConfig(source)
155
- }
156
- }
157
-
158
- // Fallback to defaults
159
- return await loadDefaults()
160
- }
161
- ```
162
-
163
- ### Pattern 2: Config Watcher
164
- ```typescript
165
- // Watch config file for changes
166
- function watchConfig(callback: (config) => void) {
167
- const watcher = chokidar.watch(getPath('config.json'))
168
-
169
- watcher.on('change', async () => {
170
- const newConfig = await loadConfig()
171
- await validateConfig(newConfig)
172
- callback(newConfig)
173
- })
174
-
175
- return watcher
176
- }
177
- ```
178
-
179
- ### Pattern 3: Config Encryption
180
- ```typescript
181
- // Encrypt sensitive config fields (inherited from security patterns)
182
- async function encryptConfig(config: CCJKConfig) {
183
- const sensitive = ['apiProvider.apiKey', 'sync.token']
184
-
185
- for (const field of sensitive) {
186
- const value = getNestedValue(config, field)
187
- if (value) {
188
- const encrypted = await encrypt(value, MASTER_KEY)
189
- setNestedValue(config, field, encrypted)
190
- }
191
- }
192
-
193
- return config
194
- }
195
- ```
196
-
197
- ## 🔧 CCJK Config Tools
198
-
199
- ### Tool 1: Config Getter
200
- ```typescript
201
- // Get config value with path support
202
- function getConfigValue(config: CCJKConfig, path: string) {
203
- return getNestedValue(config, path)
204
- }
205
-
206
- // Usage
207
- const apiKey = getConfigValue(config, 'apiProvider.apiKey')
208
- ```
209
-
210
- ### Tool 2: Config Setter
211
- ```typescript
212
- // Set config value with path support
213
- function setConfigValue(config: CCJKConfig, path: string, value: any) {
214
- setNestedValue(config, path, value)
215
- return config
216
- }
217
-
218
- // Usage
219
- setConfigValue(config, 'features.cloudSync', true)
220
- ```
221
-
222
- ### Tool 3: Config Reset
223
- ```typescript
224
- // Reset config to defaults
225
- async function resetConfig(options: {
226
- keepAPIKey?: boolean
227
- keepMCP?: boolean
228
- }) {
229
- const defaults = await loadDefaults()
230
-
231
- if (options.keepAPIKey) {
232
- const current = await loadConfig()
233
- defaults.apiProvider.apiKey = current.apiProvider.apiKey
234
- }
235
-
236
- if (options.keepMCP) {
237
- const current = await loadConfig()
238
- defaults.mcpServers = current.mcpServers
239
- }
240
-
241
- await saveConfig(defaults)
242
- console.log('✅ Config reset to defaults')
243
- }
244
- ```
245
-
246
- ## 🔗 Config + Skills Integration
247
-
248
- ### Config for ccjk-init
249
- ```typescript
250
- // Config initialization (uses ccjk-init patterns)
251
- const initConfig = {
252
- version: '5.0.0',
253
- environment: 'production',
254
- apiProvider: {
255
- name: 'anthropic',
256
- apiKey: await promptForAPIKey()
257
- }
258
- }
259
- ```
260
-
261
- ### Config for ccjk-mcp
262
- ```typescript
263
- // MCP configuration (uses ccjk-mcp patterns)
264
- const mcpConfig = {
265
- mcpServers: {
266
- 'ccjk-docs': CCJK_DEFAULT_MCP['ccjk-docs'],
267
- ...userMCPServers
268
- }
269
- }
270
- ```
271
-
272
- ### Config for ccjk-sync
273
- ```typescript
274
- // Sync configuration (uses ccjk-sync patterns)
275
- const syncConfig = {
276
- sync: {
277
- adapter: 'local',
278
- enabled: true,
279
- autoSync: false
280
- }
281
- }
282
- ```
283
-
284
- ## 🔗 Related Skills
285
-
286
- - **Parent**: [ccjk](../ccjk/SKILL.md) - Shared defaults
287
- - **Siblings**: [ccjk-init](../ccjk-init/SKILL.md), [ccjk-mcp](../ccjk-mcp/SKILL.md), [ccjk-sync](../ccjk-sync/SKILL.md)
288
- - **Related**: [layer1-api](../../layer1-api.md) - API provider config
289
-
290
- ## 📚 References
291
-
292
- - [CCJK Defaults](../ccjk/references/ccjk-defaults.md)
293
- - [Platform Conventions](../ccjk/references/platform-conventions.md)
294
- - [Error Patterns](../ccjk/references/error-patterns.md)
295
-
296
- ---
297
-
298
- **Parent**: ccjk
299
- **Status**: ✅ Ready for use
300
- **Inherits**: Shared defaults + config structure
301
- **Extends**: Config management + validation + migration
@@ -1,201 +0,0 @@
1
- ---
2
- name: ccjk-init
3
- description: "CRITICAL: Use for CCJK initialization questions. Triggers on: ccjk init, initialize ccjk, setup ccjk, install ccjk, first time setup"
4
- parents: ["ccjk"]
5
- ---
6
-
7
- # CCJK Init Skill
8
-
9
- > **Parent**: ccjk (inherits shared defaults and patterns)
10
- > **Purpose**: Handle CCJK initialization and first-time setup
11
-
12
- ## 🎯 Quick Start
13
-
14
- **IMPORTANT**: Before generating code, read `../ccjk/references/ccjk-defaults.md` for shared configuration patterns.
15
-
16
- ## 🔄 Inherited from Parent
17
-
18
- From `ccjk` parent skill, this child skill inherits:
19
- - ✅ Code generation defaults (TypeScript, ESM)
20
- - ✅ Cross-platform path handling
21
- - ✅ Error handling patterns
22
- - ✅ i18n patterns for user messages
23
- - ✅ Testing patterns (TDD, 80% coverage)
24
-
25
- See: [../ccjk/SKILL.md](../ccjk/SKILL.md)
26
-
27
- ## 📋 Initialization Steps
28
-
29
- ### Step 1: Environment Check
30
- ```typescript
31
- // Check prerequisites
32
- async function checkPrerequisites() {
33
- const checks = {
34
- nodeVersion: checkNodeVersion(),
35
- npmAvailable: checkCommand('npm'),
36
- gitAvailable: checkCommand('git'),
37
- permissions: checkWritePermissions()
38
- }
39
-
40
- return checks
41
- }
42
- ```
43
-
44
- ### Step 2: Config Creation
45
- ```typescript
46
- // Create default config (inherited from ccjk-defaults.md)
47
- async function createConfig() {
48
- const defaultConfig: CCJKConfig = {
49
- version: '5.0.0',
50
- apiProvider: 'anthropic',
51
- mcpServers: {},
52
- workflows: {},
53
- features: {
54
- cloudSync: false,
55
- remoteExecution: false
56
- }
57
- }
58
-
59
- const configPath = getPath('config.json')
60
- await writeFile(configPath, JSON.stringify(defaultConfig, null, 2))
61
- }
62
- ```
63
-
64
- ### Step 3: Directory Setup
65
- ```typescript
66
- // Create CCJK directories (inherited platform-aware paths)
67
- async function setupDirectories() {
68
- const dirs = [
69
- PATHS.config,
70
- PATHS.cache,
71
- PATHS.data,
72
- path.join(PATHS.data, 'backup')
73
- ]
74
-
75
- for (const dir of dirs) {
76
- await mkdir(dir, { recursive: true })
77
- }
78
- }
79
- ```
80
-
81
- ## 🎨 Child-Specific Features
82
-
83
- ### Feature 1: Interactive Setup
84
- ```typescript
85
- // Interactive prompts (skipped in CI mode)
86
- async function interactiveSetup() {
87
- if (process.env.CI) {
88
- console.log('CI detected: using default configuration')
89
- return createDefaultConfig()
90
- }
91
-
92
- // Ask user questions
93
- const apiProvider = await prompt('Select API provider', ['anthropic', '302.ai'])
94
- const enableCloud = await confirm('Enable cloud sync?', false)
95
-
96
- return { apiProvider, enableCloud }
97
- }
98
- ```
99
-
100
- ### Feature 2: Auto-Detection
101
- ```typescript
102
- // Detect existing setup
103
- async function detectExistingSetup() {
104
- const detections = {
105
- hasClaudeCode: existsFile('claude-deskop-config.json'),
106
- hasMCP: existsFile('.claude/mcp.json'),
107
- hasWorkflows: existsDirectory('.claude/rules')
108
- }
109
-
110
- return detections
111
- }
112
- ```
113
-
114
- ### Feature 3: Migration
115
- ```typescript
116
- // Migrate from old CCJK version
117
- async function migrateFromV4() {
118
- const oldConfig = path.join(os.homedir(), '.ccjk', 'v4', 'config.json')
119
-
120
- if (existsSync(oldConfig)) {
121
- console.log('Detected CCJK v4 installation')
122
- const migrated = await migrateV4ToV5(oldConfig)
123
- await saveConfig(migrated)
124
- console.log('✅ Migration complete')
125
- }
126
- }
127
- ```
128
-
129
- ## 🚀 Override from Parent
130
-
131
- ### Override: Special Error Handling
132
- While the parent skill defines general error handling, init requires specific errors:
133
-
134
- ```typescript
135
- // PARENT pattern (from ccjk-defaults.md):
136
- throw new CCJKError('Failed to load config', 'CONFIG_LOAD_FAILED')
137
-
138
- // CHILD override (init-specific):
139
- throw new CCJKError(
140
- 'Initialization failed: Node.js version too old',
141
- 'INIT_NODE_VERSION',
142
- { required: '18.0.0', found: process.version }
143
- )
144
- ```
145
-
146
- ## 📊 Init-Specific Patterns
147
-
148
- ### Pattern 1: First-Run Detection
149
- ```typescript
150
- function isFirstRun(): boolean {
151
- return !existsSync(getPath('config.json'))
152
- }
153
- ```
154
-
155
- ### Pattern 2: Backup Before Init
156
- ```typescript
157
- async function backupExisting() {
158
- const configPath = getPath('config.json')
159
- const backupPath = path.join(PATHS.data, 'backup', `config-${Date.now()}.json`)
160
-
161
- if (existsSync(configPath)) {
162
- console.log(`Backing up existing config to ${backupPath}`)
163
- await copyFile(configPath, backupPath)
164
- }
165
- }
166
- ```
167
-
168
- ### Pattern 3: Validation After Init
169
- ```typescript
170
- async function validateInstallation() {
171
- const checks = [
172
- 'Config file exists',
173
- 'Directories created',
174
- 'Permissions correct',
175
- 'CLI command available'
176
- ]
177
-
178
- for (const check of checks) {
179
- // Run validation
180
- }
181
-
182
- console.log('✅ Installation validated')
183
- }
184
- ```
185
-
186
- ## 🔗 Related Skills
187
-
188
- - **Parent**: [ccjk](../ccjk/SKILL.md) - Shared defaults
189
- - **Siblings**: [ccjk-mcp](../ccjk-mcp/SKILL.md), [ccjk-sync](../ccjk-sync/SKILL.md)
190
-
191
- ## 📚 References
192
-
193
- - [CCJK Defaults](../ccjk/references/ccjk-defaults.md)
194
- - [Platform Conventions](../ccjk/references/platform-conventions.md)
195
- - [Error Patterns](../ccjk/references/error-patterns.md)
196
-
197
- ---
198
-
199
- **Parent**: ccjk
200
- **Status**: ✅ Ready for use
201
- **Inherits**: Shared defaults + code patterns