ccjk 12.0.6 → 12.0.7

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 (62) hide show
  1. package/README.md +14 -0
  2. package/README.zh-CN.md +13 -0
  3. package/dist/chunks/api-cli.mjs +1 -1
  4. package/dist/chunks/ccjk-agents.mjs +3 -2
  5. package/dist/chunks/ccjk-all.mjs +129 -1764
  6. package/dist/chunks/ccjk-hooks.mjs +5 -4
  7. package/dist/chunks/ccjk-mcp.mjs +7 -6
  8. package/dist/chunks/ccjk-setup.mjs +3 -2
  9. package/dist/chunks/ccjk-skills.mjs +6 -5
  10. package/dist/chunks/ccr.mjs +6 -5
  11. package/dist/chunks/check-updates.mjs +8 -8
  12. package/dist/chunks/claude-code-config-manager.mjs +1 -1
  13. package/dist/chunks/claude-code-incremental-manager.mjs +2 -2
  14. package/dist/chunks/codex-config-switch.mjs +1 -1
  15. package/dist/chunks/codex-provider-manager.mjs +1 -1
  16. package/dist/chunks/config-switch.mjs +1 -1
  17. package/dist/chunks/config.mjs +1 -1
  18. package/dist/chunks/config2.mjs +1 -1
  19. package/dist/chunks/config3.mjs +1 -1
  20. package/dist/chunks/constants.mjs +33 -2
  21. package/dist/chunks/dashboard.mjs +115 -3
  22. package/dist/chunks/features.mjs +3 -3
  23. package/dist/chunks/init.mjs +108 -4
  24. package/dist/chunks/installer2.mjs +7 -7
  25. package/dist/chunks/manager.mjs +1048 -0
  26. package/dist/chunks/mcp-cli.mjs +1 -1
  27. package/dist/chunks/mcp.mjs +1 -1
  28. package/dist/chunks/menu.mjs +22 -1
  29. package/dist/chunks/notification.mjs +5 -2
  30. package/dist/chunks/package.mjs +1 -1
  31. package/dist/chunks/quick-provider.mjs +1 -269
  32. package/dist/chunks/quick-setup.mjs +10 -10
  33. package/dist/chunks/remote.mjs +4 -1
  34. package/dist/chunks/simple-config.mjs +1 -1
  35. package/dist/chunks/skill.mjs +117 -9003
  36. package/dist/chunks/skill2.mjs +9003 -0
  37. package/dist/chunks/skills-sync.mjs +536 -55
  38. package/dist/chunks/skills.mjs +7 -1156
  39. package/dist/chunks/smart-defaults.mjs +87 -9
  40. package/dist/chunks/status.mjs +1 -1
  41. package/dist/chunks/uninstall.mjs +1 -1
  42. package/dist/chunks/update.mjs +2 -2
  43. package/dist/chunks/zero-config.mjs +6 -2
  44. package/dist/cli.mjs +3 -1
  45. package/dist/i18n/locales/en/cloud.json +40 -0
  46. package/dist/i18n/locales/zh-CN/cloud.json +40 -0
  47. package/dist/index.d.mts +2586 -2
  48. package/dist/index.d.ts +2586 -2
  49. package/dist/index.mjs +1340 -7
  50. package/dist/shared/ccjk.B364Fu0N.mjs +1819 -0
  51. package/dist/shared/ccjk.BtB1e5jm.mjs +171 -0
  52. package/dist/shared/{ccjk.BnpWvs9V.mjs → ccjk.BwfbSKN2.mjs} +1 -1
  53. package/dist/shared/{ccjk.AqnXPAzw.mjs → ccjk.C2jHOZVP.mjs} +1 -1
  54. package/dist/shared/{ccjk.BSYWk9ML.mjs → ccjk.Cjj8SVrn.mjs} +1 -1
  55. package/dist/shared/ccjk.D6ycHbak.mjs +270 -0
  56. package/dist/shared/ccjk.D8ZLYSZZ.mjs +299 -0
  57. package/dist/shared/{ccjk.s7OCVzdd.mjs → ccjk.DS7UESmF.mjs} +2 -1483
  58. package/dist/shared/{ccjk.BiCrMV5O.mjs → ccjk.DXRAZcix.mjs} +0 -28
  59. package/dist/shared/ccjk.UIvifqNE.mjs +1486 -0
  60. package/dist/shared/{ccjk.BDKUdmLk.mjs → ccjk.c-ETfBZ_.mjs} +208 -86
  61. package/package.json +5 -1
  62. package/templates/claude-code/common/settings.json +3 -1
@@ -1,11 +1,7 @@
1
1
  import a from './index2.mjs';
2
2
  import { i as inquirer } from './index3.mjs';
3
3
  import { i18n } from './index5.mjs';
4
- import { existsSync, unlinkSync, mkdirSync, readdirSync, readFileSync } from 'node:fs';
5
- import 'node:os';
6
- import { CCJK_SKILLS_DIR } from './constants.mjs';
7
- import { writeFileAtomic } from './fs-operations.mjs';
8
- import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
4
+ import { searchSkills, getSkill, getAllSkills, addSkill, setSkillEnabled, removeSkill, getBatchCategories, createBatchSkills } from './manager.mjs';
9
5
  import '../shared/ccjk.BAGoDD49.mjs';
10
6
  import 'node:readline';
11
7
  import 'stream';
@@ -18,1163 +14,18 @@ import 'tty';
18
14
  import 'fs';
19
15
  import 'child_process';
20
16
  import 'node:path';
17
+ import 'node:os';
21
18
  import 'node:crypto';
22
19
  import 'buffer';
23
20
  import 'string_decoder';
21
+ import 'node:fs';
24
22
  import 'node:url';
23
+ import '../shared/ccjk.bQ7Dh1g4.mjs';
24
+ import './constants.mjs';
25
+ import './skill.mjs';
26
+ import './fs-operations.mjs';
25
27
  import 'node:fs/promises';
26
28
 
27
- const cloudSyncSkill = {
28
- id: "cloud-sync",
29
- name: {
30
- "en": "Cloud Sync",
31
- "zh-CN": "\u4E91\u540C\u6B65\u7BA1\u7406"
32
- },
33
- description: {
34
- "en": "Cross-device synchronization for configurations, skills, and workflows",
35
- "zh-CN": "\u8DE8\u8BBE\u5907\u540C\u6B65\u914D\u7F6E\u3001\u6280\u80FD\u548C\u5DE5\u4F5C\u6D41"
36
- },
37
- category: "devops",
38
- triggers: ["/sync", "/cloud", "/backup", "/restore"],
39
- enabled: true,
40
- version: "1.0.0",
41
- author: "CCJK Team",
42
- tags: ["cloud", "sync", "backup", "restore", "configuration"],
43
- template: `# Cloud Sync Management
44
-
45
- ## Overview
46
-
47
- Cloud Sync provides seamless cross-device synchronization for your CCJK environment.
48
- Keep your configurations, skills, and workflows in sync across all your development machines.
49
-
50
- ## Features
51
-
52
- ### Configuration Sync
53
- - Synchronize CCJK settings across devices
54
- - Preserve API configurations securely
55
- - Sync MCP service configurations
56
-
57
- ### Skills Sync
58
- - Share custom skills between machines
59
- - Version control for skill updates
60
- - Conflict resolution for concurrent edits
61
-
62
- ### Workflow Sync
63
- - Sync workflow states and progress
64
- - Share workflow templates
65
- - Collaborative workflow management
66
-
67
- ### Conflict Resolution
68
- - Intelligent merge for non-conflicting changes
69
- - Manual resolution UI for conflicts
70
- - Version history for rollback
71
-
72
- ## Commands
73
-
74
- ### Sync Status
75
- \`\`\`bash
76
- /sync status
77
- \`\`\`
78
- View current synchronization status, pending changes, and last sync time.
79
-
80
- ### Push Changes
81
- \`\`\`bash
82
- /sync push # Push all pending changes
83
- /sync push --config # Push configuration only
84
- /sync push --skills # Push skills only
85
- /sync push --workflows # Push workflows only
86
- \`\`\`
87
-
88
- ### Pull Changes
89
- \`\`\`bash
90
- /sync pull # Pull all remote changes
91
- /sync pull --force # Force pull, overwrite local
92
- /sync pull --merge # Merge with local changes
93
- \`\`\`
94
-
95
- ### Configure Cloud Storage
96
- \`\`\`bash
97
- /sync config # Interactive configuration
98
- /sync config github # Configure GitHub Gist
99
- /sync config webdav # Configure WebDAV
100
- /sync config local # Configure local folder sync
101
- \`\`\`
102
-
103
- ### Backup Management
104
- \`\`\`bash
105
- /backup create # Create full backup
106
- /backup create --name "v1.0" # Create named backup
107
- /backup list # List all backups
108
- /backup restore <id> # Restore from backup
109
- /backup delete <id> # Delete a backup
110
- \`\`\`
111
-
112
- ### Conflict Management
113
- \`\`\`bash
114
- /sync conflicts # List all conflicts
115
- /sync resolve <id> --local # Keep local version
116
- /sync resolve <id> --remote # Keep remote version
117
- /sync resolve <id> --merge # Manual merge
118
- \`\`\`
119
-
120
- ## Supported Cloud Storage
121
-
122
- ### GitHub Gist (Recommended)
123
- - Free and reliable
124
- - Version history built-in
125
- - Easy to set up with personal access token
126
-
127
- \`\`\`bash
128
- /sync config github
129
- # Enter your GitHub personal access token
130
- # Token needs 'gist' scope
131
- \`\`\`
132
-
133
- ### WebDAV
134
- Compatible with:
135
- - Nutstore (\u575A\u679C\u4E91)
136
- - Nextcloud
137
- - ownCloud
138
- - Any WebDAV server
139
-
140
- \`\`\`bash
141
- /sync config webdav
142
- # Enter WebDAV URL, username, and password
143
- \`\`\`
144
-
145
- ### Local Folder
146
- For manual sync via Dropbox, OneDrive, etc.
147
-
148
- \`\`\`bash
149
- /sync config local
150
- # Enter path to sync folder
151
- \`\`\`
152
-
153
- ## Usage Examples
154
-
155
- ### First-Time Setup
156
- \`\`\`bash
157
- # 1. Configure cloud storage
158
- /sync config github
159
-
160
- # 2. Push initial configuration
161
- /sync push --all
162
-
163
- # 3. Verify sync status
164
- /sync status
165
- \`\`\`
166
-
167
- ### Daily Workflow
168
- \`\`\`bash
169
- # Start of day: pull latest changes
170
- /sync pull
171
-
172
- # End of day: push your changes
173
- /sync push
174
- \`\`\`
175
-
176
- ### Handling Conflicts
177
- \`\`\`bash
178
- # Check for conflicts after pull
179
- /sync conflicts
180
-
181
- # Review and resolve each conflict
182
- /sync resolve skill-123 --merge
183
- \`\`\`
184
-
185
- ### Backup Before Major Changes
186
- \`\`\`bash
187
- # Create backup before risky operations
188
- /backup create --name "before-upgrade"
189
-
190
- # If something goes wrong
191
- /backup restore before-upgrade
192
- \`\`\`
193
-
194
- ## Security
195
-
196
- ### Sensitive Data Handling
197
- - API keys are encrypted before sync
198
- - OAuth tokens are never synced (re-authenticate on each device)
199
- - Local encryption key derived from device-specific identifier
200
-
201
- ### Access Control
202
- - GitHub: Uses personal access token with minimal scope
203
- - WebDAV: Supports app-specific passwords
204
- - All connections use HTTPS/TLS
205
-
206
- ## Best Practices
207
-
208
- 1. **Regular Syncing**: Sync at least daily to avoid large conflicts
209
- 2. **Named Backups**: Create named backups before major changes
210
- 3. **Review Conflicts**: Don't auto-resolve conflicts without review
211
- 4. **Secure Tokens**: Use app-specific passwords when available
212
- 5. **Test Restore**: Periodically test backup restoration
213
-
214
- ## Troubleshooting
215
-
216
- ### Sync Failed
217
- \`\`\`bash
218
- # Check connection
219
- /sync status --verbose
220
-
221
- # Force re-authentication
222
- /sync config github --reauth
223
- \`\`\`
224
-
225
- ### Conflicts Won't Resolve
226
- \`\`\`bash
227
- # Reset sync state
228
- /sync reset
229
-
230
- # Re-initialize from remote
231
- /sync pull --force
232
- \`\`\`
233
-
234
- ### Backup Corrupted
235
- \`\`\`bash
236
- # List all backups with integrity check
237
- /backup list --verify
238
-
239
- # Delete corrupted backup
240
- /backup delete <corrupted-id>
241
- \`\`\`
242
- `
243
- };
244
-
245
- const marketplaceSkill = {
246
- id: "mcp-marketplace",
247
- name: {
248
- "en": "MCP Marketplace",
249
- "zh-CN": "MCP \u63D2\u4EF6\u5E02\u573A"
250
- },
251
- description: {
252
- "en": "Discover, install and manage MCP plugins",
253
- "zh-CN": "\u53D1\u73B0\u3001\u5B89\u88C5\u548C\u7BA1\u7406 MCP \u63D2\u4EF6"
254
- },
255
- category: "dev",
256
- triggers: ["/market", "/mcp", "/plugins", "/install"],
257
- enabled: true,
258
- version: "1.0.0",
259
- author: "CCJK Team",
260
- tags: ["mcp", "marketplace", "plugins", "extensions", "install"],
261
- template: `# MCP Marketplace Skill
262
-
263
- ## Overview
264
-
265
- The MCP Marketplace provides a centralized hub for discovering, installing, and managing
266
- Model Context Protocol (MCP) plugins. It integrates seamlessly with Claude Code and CCJK
267
- to enhance your AI-assisted development workflow.
268
-
269
- ## Features
270
-
271
- - **Browse Marketplace**: Discover trending and recommended plugins
272
- - **Search Plugins**: Search by name, category, or tags
273
- - **Install Management**: One-click install, update, and uninstall
274
- - **Security Scanning**: Automatic security checks before installation
275
- - **Dependency Resolution**: Automatic handling of plugin dependencies
276
-
277
- ## Commands
278
-
279
- ### Search Plugins
280
- \`\`\`bash
281
- # Search by keyword
282
- ccjk market search <query>
283
-
284
- # Search with filters
285
- ccjk market search <query> --category ai-tools
286
- ccjk market search <query> --tag productivity
287
- \`\`\`
288
-
289
- ### Browse Marketplace
290
- \`\`\`bash
291
- # View trending plugins
292
- ccjk market trending
293
-
294
- # Browse by category
295
- ccjk market browse --category dev-tools
296
- ccjk market browse --category ai-tools
297
- ccjk market browse --category data-processing
298
- \`\`\`
299
-
300
- ### Install Plugins
301
- \`\`\`bash
302
- # Install a plugin
303
- ccjk market install <plugin-id>
304
-
305
- # Install specific version
306
- ccjk market install <plugin-id>@1.2.0
307
-
308
- # Install with dependencies
309
- ccjk market install <plugin-id> --with-deps
310
-
311
- # Force reinstall
312
- ccjk market install <plugin-id> --force
313
- \`\`\`
314
-
315
- ### Update Plugins
316
- \`\`\`bash
317
- # Update all plugins
318
- ccjk market update
319
-
320
- # Update specific plugin
321
- ccjk market update <plugin-id>
322
-
323
- # Check for updates
324
- ccjk market check-updates
325
- \`\`\`
326
-
327
- ### Manage Installed Plugins
328
- \`\`\`bash
329
- # List installed plugins
330
- ccjk market list
331
-
332
- # Show plugin details
333
- ccjk market info <plugin-id>
334
-
335
- # Uninstall plugin
336
- ccjk market uninstall <plugin-id>
337
-
338
- # Enable/disable plugin
339
- ccjk market enable <plugin-id>
340
- ccjk market disable <plugin-id>
341
- \`\`\`
342
-
343
- ## Categories
344
-
345
- ### AI Tools
346
- AI-enhanced functionality for code generation, analysis, and optimization.
347
- - Code completion enhancers
348
- - AI-powered refactoring
349
- - Intelligent code review
350
-
351
- ### Development Tools
352
- Tools to assist with coding and development workflows.
353
- - Language servers
354
- - Linters and formatters
355
- - Build tool integrations
356
-
357
- ### Productivity Tools
358
- Enhance your development efficiency.
359
- - Task automation
360
- - Snippet managers
361
- - Documentation generators
362
-
363
- ### Data Processing
364
- Data transformation and analysis tools.
365
- - Data converters
366
- - Schema validators
367
- - API integrators
368
-
369
- ### Integrations
370
- Third-party service integrations.
371
- - Cloud service connectors
372
- - Database integrations
373
- - CI/CD tool bridges
374
-
375
- ## Security
376
-
377
- All plugins undergo security scanning before installation:
378
-
379
- ### Security Checks
380
- - **Permission Analysis**: Detects dangerous permission requests
381
- - **Vulnerability Scanning**: Checks against known CVE databases
382
- - **Code Pattern Analysis**: Identifies suspicious code patterns
383
- - **Dependency Audit**: Scans dependencies for vulnerabilities
384
-
385
- ### Security Levels
386
- - \`verified\` - Officially verified by CCJK team
387
- - \`community\` - Community-reviewed plugin
388
- - \`unverified\` - New or unreviewed plugin
389
-
390
- ### Skip Security (Not Recommended)
391
- \`\`\`bash
392
- ccjk market install <plugin-id> --skip-verification
393
- \`\`\`
394
-
395
- ## Configuration
396
-
397
- ### Plugin Settings
398
- \`\`\`bash
399
- # Configure plugin
400
- ccjk market config <plugin-id> --set key=value
401
-
402
- # View plugin config
403
- ccjk market config <plugin-id> --list
404
-
405
- # Reset plugin config
406
- ccjk market config <plugin-id> --reset
407
- \`\`\`
408
-
409
- ### Global Settings
410
- \`\`\`bash
411
- # Set default registry
412
- ccjk market registry set <url>
413
-
414
- # Enable auto-updates
415
- ccjk market settings --auto-update true
416
-
417
- # Set security level
418
- ccjk market settings --security-level strict
419
- \`\`\`
420
-
421
- ## Plugin Development
422
-
423
- ### Create a Plugin
424
- \`\`\`bash
425
- ccjk market create <plugin-name>
426
- \`\`\`
427
-
428
- ### Publish to Marketplace
429
- \`\`\`bash
430
- ccjk market publish
431
- \`\`\`
432
-
433
- ### Plugin Manifest Example
434
- \`\`\`json
435
- {
436
- "packageId": "my-plugin",
437
- "name": "My Plugin",
438
- "version": "1.0.0",
439
- "description": "A useful MCP plugin",
440
- "author": "Your Name",
441
- "license": "MIT",
442
- "keywords": ["mcp", "plugin"],
443
- "mcpServer": {
444
- "command": "node",
445
- "args": ["dist/server.js"]
446
- }
447
- }
448
- \`\`\`
449
-
450
- ## Troubleshooting
451
-
452
- ### Installation Issues
453
- \`\`\`bash
454
- # Clear cache and retry
455
- ccjk market cache clear
456
- ccjk market install <plugin-id>
457
-
458
- # Verbose installation
459
- ccjk market install <plugin-id> --verbose
460
- \`\`\`
461
-
462
- ### Dependency Conflicts
463
- \`\`\`bash
464
- # Check dependencies
465
- ccjk market deps <plugin-id>
466
-
467
- # Force resolve conflicts
468
- ccjk market install <plugin-id> --force-deps
469
- \`\`\`
470
-
471
- ### Rollback
472
- \`\`\`bash
473
- # Rollback to previous version
474
- ccjk market rollback <plugin-id>
475
-
476
- # Rollback to specific version
477
- ccjk market rollback <plugin-id>@1.0.0
478
- \`\`\`
479
-
480
- ## Best Practices
481
-
482
- 1. **Review Before Install**: Always check plugin ratings and reviews
483
- 2. **Keep Updated**: Regularly update plugins for security patches
484
- 3. **Minimal Plugins**: Only install plugins you actively use
485
- 4. **Backup Config**: Export your plugin configuration before major changes
486
- 5. **Report Issues**: Help improve the ecosystem by reporting bugs
487
-
488
- ## Integration with Claude Code
489
-
490
- The marketplace integrates directly with Claude Code's MCP system:
491
-
492
- \`\`\`bash
493
- # Installed plugins are automatically available in Claude Code
494
- claude --mcp-list # Shows marketplace-installed plugins
495
-
496
- # Plugins can be used in conversations
497
- # Example: Using a database plugin
498
- "Connect to my PostgreSQL database and show tables"
499
- \`\`\`
500
- `
501
- };
502
-
503
- const browserSkill = {
504
- id: "browser-automation",
505
- name: {
506
- "en": "Browser Automation",
507
- "zh-CN": "\u6D4F\u89C8\u5668\u81EA\u52A8\u5316"
508
- },
509
- description: {
510
- "en": "Zero-config headless browser automation for AI agents",
511
- "zh-CN": "\u96F6\u914D\u7F6E\u7684 AI \u4EE3\u7406\u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u5DE5\u5177"
512
- },
513
- category: "dev",
514
- triggers: ["/browser", "/web", "/browse"],
515
- enabled: true,
516
- version: "1.0.0",
517
- author: "CCJK",
518
- tags: ["browser", "automation", "web", "scraping", "testing"],
519
- template: `# Browser Automation Skill
520
-
521
- ## Overview
522
- This skill provides zero-config headless browser automation powered by agent-browser.
523
-
524
- ## Quick Start
525
-
526
- ### Open a URL
527
- \`\`\`bash
528
- ccjk browser open https://example.com
529
- \`\`\`
530
-
531
- ### Get Page Snapshot (AI-optimized)
532
- \`\`\`bash
533
- ccjk browser snapshot -i # Interactive elements only
534
- ccjk browser snapshot -c # Compact output
535
- \`\`\`
536
-
537
- ### Interact with Elements
538
- \`\`\`bash
539
- ccjk browser click @e1 # Click by ref
540
- ccjk browser fill @e2 "text" # Fill input
541
- ccjk browser get text @e3 # Get text content
542
- \`\`\`
543
-
544
- ### Screenshots
545
- \`\`\`bash
546
- ccjk browser screenshot # Viewport
547
- ccjk browser screenshot --full # Full page
548
- ccjk browser screenshot output.png # Custom path
549
- \`\`\`
550
-
551
- ### Wait for Conditions
552
- \`\`\`bash
553
- ccjk browser wait 2000 # Wait 2 seconds
554
- ccjk browser wait @e1 # Wait for element
555
- ccjk browser wait --text "Success" # Wait for text
556
- \`\`\`
557
-
558
- ## Common Workflows
559
-
560
- ### Login Flow
561
- \`\`\`bash
562
- ccjk browser open https://app.example.com/login
563
- ccjk browser snapshot -i
564
- ccjk browser fill @e1 "username"
565
- ccjk browser fill @e2 "password"
566
- ccjk browser click @e3
567
- ccjk browser wait --text "Dashboard"
568
- \`\`\`
569
-
570
- ### Form Submission
571
- \`\`\`bash
572
- ccjk browser open https://example.com/form
573
- ccjk browser snapshot -i
574
- ccjk browser fill @e1 "John Doe"
575
- ccjk browser fill @e2 "john@example.com"
576
- ccjk browser click @e3 # Submit button
577
- ccjk browser wait --text "Thank you"
578
- \`\`\`
579
-
580
- ### Web Scraping
581
- \`\`\`bash
582
- ccjk browser open https://example.com/products
583
- ccjk browser snapshot --json > products.json
584
- \`\`\`
585
-
586
- ## Session Management
587
-
588
- ### Parallel Sessions
589
- \`\`\`bash
590
- ccjk browser --session s1 open site-a.com
591
- ccjk browser --session s2 open site-b.com
592
- ccjk browser session list
593
- \`\`\`
594
-
595
- ## Debug Mode
596
- \`\`\`bash
597
- ccjk browser open example.com --headed # Show browser window
598
- \`\`\`
599
-
600
- ## Element References
601
-
602
- The snapshot command returns elements with refs like \`@e1\`, \`@e2\`, etc.
603
- Use these refs to interact with specific elements:
604
-
605
- - \`@e1\` - First interactive element
606
- - \`@e2\` - Second interactive element
607
- - etc.
608
-
609
- ## Tips for AI Agents
610
-
611
- 1. Always run \`snapshot -i\` first to get interactive elements
612
- 2. Use refs from snapshot output for interactions
613
- 3. Wait for page loads with \`wait --text\` or \`wait @ref\`
614
- 4. Use \`--json\` for programmatic parsing
615
- 5. Close browser when done to free resources
616
- `
617
- };
618
-
619
- const workflowSkill = {
620
- id: "workflow-automation",
621
- name: {
622
- "en": "Workflow Automation",
623
- "zh-CN": "\u5DE5\u4F5C\u6D41\u81EA\u52A8\u5316"
624
- },
625
- description: {
626
- "en": "Subagent-driven development workflow with two-stage review",
627
- "zh-CN": "Subagent \u9A71\u52A8\u7684\u4E24\u9636\u6BB5\u5BA1\u67E5\u5F00\u53D1\u5DE5\u4F5C\u6D41"
628
- },
629
- category: "dev",
630
- triggers: ["/workflow", "/wf", "/flow"],
631
- enabled: true,
632
- version: "1.0.0",
633
- author: "CCJK",
634
- tags: ["workflow", "subagent", "review", "automation", "ci"],
635
- template: `# Workflow Automation Skill
636
-
637
- ## Overview
638
-
639
- This skill provides Subagent-driven development workflows with automatic two-stage review.
640
- Inspired by Anthropic's Superpowers architecture for autonomous agent collaboration.
641
-
642
- ## Core Concepts
643
-
644
- ### Two-Stage Review
645
- 1. **Draft Stage**: Subagents work on tasks in parallel
646
- 2. **Review Stage**: Automated quality checks and validation
647
- 3. **Finalize Stage**: Merge approved changes
648
-
649
- ### Workflow States
650
- - \`idle\` \u2192 \`planning\` \u2192 \`executing\` \u2192 \`reviewing\` \u2192 \`finalizing\` \u2192 \`completed\`
651
-
652
- ## Quick Start
653
-
654
- ### Create a Workflow
655
- \`\`\`bash
656
- ccjk workflow create "Implement user authentication"
657
- \`\`\`
658
-
659
- ### Start Workflow Execution
660
- \`\`\`bash
661
- ccjk workflow start <workflow-id>
662
- \`\`\`
663
-
664
- ### Check Workflow Status
665
- \`\`\`bash
666
- ccjk workflow status <workflow-id>
667
- ccjk workflow list
668
- \`\`\`
669
-
670
- ## Task Management
671
-
672
- ### Add Tasks to Workflow
673
- \`\`\`bash
674
- ccjk workflow task add <workflow-id> "Create login component"
675
- ccjk workflow task add <workflow-id> "Add authentication API" --depends-on task-1
676
- \`\`\`
677
-
678
- ### Task Priorities
679
- \`\`\`bash
680
- ccjk workflow task add <workflow-id> "Fix security bug" --priority critical
681
- ccjk workflow task add <workflow-id> "Add tests" --priority high
682
- \`\`\`
683
-
684
- ### View Task Dependencies
685
- \`\`\`bash
686
- ccjk workflow tasks <workflow-id> --graph
687
- \`\`\`
688
-
689
- ## Subagent Scheduling
690
-
691
- ### Automatic Scheduling
692
- The scheduler automatically:
693
- - Assigns tasks to available subagents
694
- - Respects task dependencies
695
- - Balances workload across agents
696
- - Handles failures with retry logic
697
-
698
- ### Manual Assignment
699
- \`\`\`bash
700
- ccjk workflow assign <task-id> <subagent-id>
701
- \`\`\`
702
-
703
- ### View Subagent Status
704
- \`\`\`bash
705
- ccjk workflow agents
706
- ccjk workflow agent <agent-id> --tasks
707
- \`\`\`
708
-
709
- ## Review System
710
-
711
- ### Automatic Review
712
- When tasks complete, the system automatically:
713
- 1. Runs requirement verification
714
- 2. Performs code quality checks
715
- 3. Validates test coverage
716
- 4. Checks for security issues
717
-
718
- ### Review Results
719
- \`\`\`bash
720
- ccjk workflow review <workflow-id>
721
- ccjk workflow review <task-id> --detailed
722
- \`\`\`
723
-
724
- ### Manual Review Override
725
- \`\`\`bash
726
- ccjk workflow approve <task-id>
727
- ccjk workflow reject <task-id> --reason "Missing tests"
728
- \`\`\`
729
-
730
- ## Quality Checks
731
-
732
- ### Built-in Checks
733
- - **Naming Conventions**: camelCase, PascalCase validation
734
- - **Code Structure**: Function length, nesting depth
735
- - **Error Handling**: Try-catch coverage
736
- - **Documentation**: JSDoc/TSDoc presence
737
- - **Style**: Consistent formatting
738
-
739
- ### Custom Checks
740
- \`\`\`bash
741
- ccjk workflow check add "No console.log" --pattern "console\\.log"
742
- ccjk workflow check add "Max file size" --max-lines 500
743
- \`\`\`
744
-
745
- ## Workflow Templates
746
-
747
- ### Feature Development
748
- \`\`\`bash
749
- ccjk workflow create --template feature "Add dark mode"
750
- \`\`\`
751
-
752
- ### Bug Fix
753
- \`\`\`bash
754
- ccjk workflow create --template bugfix "Fix login timeout"
755
- \`\`\`
756
-
757
- ### Refactoring
758
- \`\`\`bash
759
- ccjk workflow create --template refactor "Migrate to TypeScript"
760
- \`\`\`
761
-
762
- ## Events and Hooks
763
-
764
- ### Available Events
765
- - \`workflow:created\`
766
- - \`workflow:started\`
767
- - \`task:assigned\`
768
- - \`task:completed\`
769
- - \`review:passed\`
770
- - \`review:failed\`
771
- - \`workflow:completed\`
772
-
773
- ### Add Hooks
774
- \`\`\`bash
775
- ccjk workflow hook add task:completed "npm test"
776
- ccjk workflow hook add review:passed "npm run lint"
777
- \`\`\`
778
-
779
- ## Best Practices
780
-
781
- ### 1. Break Down Large Tasks
782
- Split complex features into smaller, independent tasks that can run in parallel.
783
-
784
- ### 2. Define Clear Dependencies
785
- Use \`--depends-on\` to ensure tasks run in the correct order.
786
-
787
- ### 3. Set Appropriate Priorities
788
- - \`critical\`: Security fixes, blocking issues
789
- - \`high\`: Important features, bugs
790
- - \`medium\`: Regular development
791
- - \`low\`: Nice-to-have improvements
792
-
793
- ### 4. Review Before Merge
794
- Always check review results before finalizing:
795
- \`\`\`bash
796
- ccjk workflow review <workflow-id> --summary
797
- \`\`\`
798
-
799
- ### 5. Use Templates
800
- Create custom templates for recurring workflow patterns.
801
-
802
- ## Integration with Git
803
-
804
- ### Automatic Branch Management
805
- \`\`\`bash
806
- ccjk workflow create "Feature X" --branch feature/x
807
- \`\`\`
808
-
809
- ### Worktree Support
810
- Each subagent can work in isolated git worktrees:
811
- \`\`\`bash
812
- ccjk workflow start <id> --worktree
813
- \`\`\`
814
-
815
- ## Troubleshooting
816
-
817
- ### Stuck Workflow
818
- \`\`\`bash
819
- ccjk workflow diagnose <workflow-id>
820
- ccjk workflow retry <task-id>
821
- \`\`\`
822
-
823
- ### Cancel Workflow
824
- \`\`\`bash
825
- ccjk workflow cancel <workflow-id>
826
- ccjk workflow cancel <workflow-id> --force
827
- \`\`\`
828
-
829
- ### View Logs
830
- \`\`\`bash
831
- ccjk workflow logs <workflow-id>
832
- ccjk workflow logs <task-id> --tail 100
833
- \`\`\`
834
- `
835
- };
836
-
837
- const BUILTIN_SKILLS = [
838
- cloudSyncSkill,
839
- browserSkill,
840
- marketplaceSkill,
841
- workflowSkill
842
- ];
843
- let registry = null;
844
- function ensureSkillsDir() {
845
- if (!existsSync(CCJK_SKILLS_DIR)) {
846
- mkdirSync(CCJK_SKILLS_DIR, { recursive: true });
847
- }
848
- }
849
- function getRegistry() {
850
- if (!registry) {
851
- registry = loadRegistry();
852
- }
853
- return registry;
854
- }
855
- function loadRegistry() {
856
- ensureSkillsDir();
857
- const skills = /* @__PURE__ */ new Map();
858
- const categories = /* @__PURE__ */ new Map();
859
- for (const skill of BUILTIN_SKILLS) {
860
- skills.set(skill.id, skill);
861
- const categorySkills = categories.get(skill.category) || [];
862
- categorySkills.push(skill.id);
863
- categories.set(skill.category, categorySkills);
864
- }
865
- const files = readdirSync(CCJK_SKILLS_DIR).filter((f) => f.endsWith(".json"));
866
- for (const file of files) {
867
- try {
868
- const content = readFileSync(join(CCJK_SKILLS_DIR, file), "utf-8");
869
- const skill = JSON.parse(content);
870
- skills.set(skill.id, skill);
871
- const categorySkills = categories.get(skill.category) || [];
872
- categorySkills.push(skill.id);
873
- categories.set(skill.category, categorySkills);
874
- } catch {
875
- }
876
- }
877
- return {
878
- skills,
879
- categories,
880
- lastUpdated: /* @__PURE__ */ new Date()
881
- };
882
- }
883
- function refreshRegistry() {
884
- registry = loadRegistry();
885
- }
886
- function getAllSkills() {
887
- return Array.from(getRegistry().skills.values());
888
- }
889
- function getSkill(id) {
890
- return getRegistry().skills.get(id);
891
- }
892
- function searchSkills(options) {
893
- let skills = getAllSkills();
894
- if (options.category) {
895
- skills = skills.filter((s) => s.category === options.category);
896
- }
897
- if (options.enabled !== void 0) {
898
- skills = skills.filter((s) => s.enabled === options.enabled);
899
- }
900
- if (options.tags && options.tags.length > 0) {
901
- skills = skills.filter(
902
- (s) => s.tags && options.tags.some((tag) => s.tags.includes(tag))
903
- );
904
- }
905
- if (options.query) {
906
- const query = options.query.toLowerCase();
907
- skills = skills.filter((s) => {
908
- const nameEn = typeof s.name === "string" ? s.name : s.name?.en || "";
909
- const nameZh = typeof s.name === "string" ? s.name : s.name?.["zh-CN"] || "";
910
- return s.id.toLowerCase().includes(query) || nameEn.toLowerCase().includes(query) || nameZh.toLowerCase().includes(query) || s.triggers.some((t) => t.toLowerCase().includes(query));
911
- });
912
- }
913
- if (options.limit) {
914
- skills = skills.slice(0, options.limit);
915
- }
916
- return skills;
917
- }
918
- function addSkill(skill) {
919
- ensureSkillsDir();
920
- try {
921
- const filePath = join(CCJK_SKILLS_DIR, `${skill.id}.json`);
922
- writeFileAtomic(filePath, JSON.stringify(skill, null, 2));
923
- refreshRegistry();
924
- return {
925
- skillId: skill.id,
926
- success: true,
927
- path: filePath
928
- };
929
- } catch (error) {
930
- return {
931
- skillId: skill.id,
932
- success: false,
933
- error: error instanceof Error ? error.message : "Unknown error"
934
- };
935
- }
936
- }
937
- function removeSkill(id) {
938
- const filePath = join(CCJK_SKILLS_DIR, `${id}.json`);
939
- if (existsSync(filePath)) {
940
- unlinkSync(filePath);
941
- refreshRegistry();
942
- return true;
943
- }
944
- return false;
945
- }
946
- function setSkillEnabled(id, enabled) {
947
- const skill = getSkill(id);
948
- if (!skill)
949
- return false;
950
- skill.enabled = enabled;
951
- addSkill(skill);
952
- return true;
953
- }
954
- const BATCH_TEMPLATES = {
955
- typescript: {
956
- category: "dev",
957
- skills: [
958
- {
959
- id: "ts-debug",
960
- name: { "en": "TypeScript Debug", "zh-CN": "TypeScript \u8C03\u8BD5" },
961
- description: { "en": "Debug TypeScript code", "zh-CN": "\u8C03\u8BD5 TypeScript \u4EE3\u7801" },
962
- triggers: ["/ts-debug", "/tsd"],
963
- templateFile: "ts-debug.md",
964
- tags: ["typescript", "debug"]
965
- },
966
- {
967
- id: "ts-refactor",
968
- name: { "en": "TypeScript Refactor", "zh-CN": "TypeScript \u91CD\u6784" },
969
- description: { "en": "Refactor TypeScript code", "zh-CN": "\u91CD\u6784 TypeScript \u4EE3\u7801" },
970
- triggers: ["/ts-refactor", "/tsr"],
971
- templateFile: "ts-refactor.md",
972
- tags: ["typescript", "refactor"]
973
- },
974
- {
975
- id: "ts-test",
976
- name: { "en": "TypeScript Test", "zh-CN": "TypeScript \u6D4B\u8BD5" },
977
- description: { "en": "Generate TypeScript tests", "zh-CN": "\u751F\u6210 TypeScript \u6D4B\u8BD5" },
978
- triggers: ["/ts-test", "/tst"],
979
- templateFile: "ts-test.md",
980
- tags: ["typescript", "testing"]
981
- },
982
- {
983
- id: "ts-type-check",
984
- name: { "en": "TypeScript Type Check", "zh-CN": "TypeScript \u7C7B\u578B\u68C0\u67E5" },
985
- description: { "en": "Fix TypeScript type errors", "zh-CN": "\u4FEE\u590D TypeScript \u7C7B\u578B\u9519\u8BEF" },
986
- triggers: ["/ts-type", "/tstc"],
987
- templateFile: "ts-type-check.md",
988
- tags: ["typescript", "types"]
989
- },
990
- {
991
- id: "ts-migrate",
992
- name: { "en": "TypeScript Migration", "zh-CN": "TypeScript \u8FC1\u79FB" },
993
- description: { "en": "Migrate JS to TypeScript", "zh-CN": "\u4ECE JS \u8FC1\u79FB\u5230 TypeScript" },
994
- triggers: ["/ts-migrate", "/tsm"],
995
- templateFile: "ts-migrate.md",
996
- tags: ["typescript", "migration"]
997
- }
998
- ]
999
- },
1000
- python: {
1001
- category: "dev",
1002
- skills: [
1003
- {
1004
- id: "py-debug",
1005
- name: { "en": "Python Debug", "zh-CN": "Python \u8C03\u8BD5" },
1006
- description: { "en": "Debug Python code", "zh-CN": "\u8C03\u8BD5 Python \u4EE3\u7801" },
1007
- triggers: ["/py-debug", "/pyd"],
1008
- templateFile: "py-debug.md",
1009
- tags: ["python", "debug"]
1010
- },
1011
- {
1012
- id: "py-refactor",
1013
- name: { "en": "Python Refactor", "zh-CN": "Python \u91CD\u6784" },
1014
- description: { "en": "Refactor Python code", "zh-CN": "\u91CD\u6784 Python \u4EE3\u7801" },
1015
- triggers: ["/py-refactor", "/pyr"],
1016
- templateFile: "py-refactor.md",
1017
- tags: ["python", "refactor"]
1018
- },
1019
- {
1020
- id: "py-test",
1021
- name: { "en": "Python Test", "zh-CN": "Python \u6D4B\u8BD5" },
1022
- description: { "en": "Generate Python tests", "zh-CN": "\u751F\u6210 Python \u6D4B\u8BD5" },
1023
- triggers: ["/py-test", "/pyt"],
1024
- templateFile: "py-test.md",
1025
- tags: ["python", "testing"]
1026
- }
1027
- ]
1028
- },
1029
- seo: {
1030
- category: "seo",
1031
- skills: [
1032
- {
1033
- id: "seo-meta",
1034
- name: { "en": "SEO Meta Optimization", "zh-CN": "SEO \u5143\u6570\u636E\u4F18\u5316" },
1035
- description: { "en": "Optimize meta tags for SEO", "zh-CN": "\u4F18\u5316 SEO \u5143\u6807\u7B7E" },
1036
- triggers: ["/seo-meta", "/meta"],
1037
- templateFile: "seo-meta.md",
1038
- tags: ["seo", "meta"]
1039
- },
1040
- {
1041
- id: "seo-sitemap",
1042
- name: { "en": "Sitemap Generator", "zh-CN": "\u7AD9\u70B9\u5730\u56FE\u751F\u6210" },
1043
- description: { "en": "Generate XML sitemap", "zh-CN": "\u751F\u6210 XML \u7AD9\u70B9\u5730\u56FE" },
1044
- triggers: ["/sitemap", "/seo-sitemap"],
1045
- templateFile: "seo-sitemap.md",
1046
- tags: ["seo", "sitemap"]
1047
- },
1048
- {
1049
- id: "seo-schema",
1050
- name: { "en": "Schema Markup", "zh-CN": "\u7ED3\u6784\u5316\u6570\u636E\u6807\u8BB0" },
1051
- description: { "en": "Add structured data markup", "zh-CN": "\u6DFB\u52A0\u7ED3\u6784\u5316\u6570\u636E\u6807\u8BB0" },
1052
- triggers: ["/schema", "/seo-schema"],
1053
- templateFile: "seo-schema.md",
1054
- tags: ["seo", "schema"]
1055
- },
1056
- {
1057
- id: "seo-cwv",
1058
- name: { "en": "Core Web Vitals", "zh-CN": "\u6838\u5FC3\u7F51\u9875\u6307\u6807" },
1059
- description: { "en": "Optimize Core Web Vitals", "zh-CN": "\u4F18\u5316\u6838\u5FC3\u7F51\u9875\u6307\u6807" },
1060
- triggers: ["/cwv", "/seo-cwv"],
1061
- templateFile: "seo-cwv.md",
1062
- tags: ["seo", "performance"]
1063
- }
1064
- ]
1065
- },
1066
- devops: {
1067
- category: "devops",
1068
- skills: [
1069
- {
1070
- id: "devops-docker",
1071
- name: { "en": "Docker Setup", "zh-CN": "Docker \u914D\u7F6E" },
1072
- description: { "en": "Set up Docker configuration", "zh-CN": "\u914D\u7F6E Docker" },
1073
- triggers: ["/docker", "/devops-docker"],
1074
- templateFile: "devops-docker.md",
1075
- tags: ["devops", "docker"]
1076
- },
1077
- {
1078
- id: "devops-ci",
1079
- name: { "en": "CI Pipeline", "zh-CN": "CI \u6D41\u6C34\u7EBF" },
1080
- description: { "en": "Set up CI pipeline", "zh-CN": "\u914D\u7F6E CI \u6D41\u6C34\u7EBF" },
1081
- triggers: ["/ci", "/devops-ci"],
1082
- templateFile: "devops-ci.md",
1083
- tags: ["devops", "ci"]
1084
- },
1085
- {
1086
- id: "devops-deploy",
1087
- name: { "en": "Deploy Script", "zh-CN": "\u90E8\u7F72\u811A\u672C" },
1088
- description: { "en": "Create deployment script", "zh-CN": "\u521B\u5EFA\u90E8\u7F72\u811A\u672C" },
1089
- triggers: ["/deploy", "/devops-deploy"],
1090
- templateFile: "devops-deploy.md",
1091
- tags: ["devops", "deploy"]
1092
- },
1093
- {
1094
- id: "devops-monitor",
1095
- name: { "en": "Monitoring Setup", "zh-CN": "\u76D1\u63A7\u914D\u7F6E" },
1096
- description: { "en": "Set up monitoring", "zh-CN": "\u914D\u7F6E\u76D1\u63A7" },
1097
- triggers: ["/monitor", "/devops-monitor"],
1098
- templateFile: "devops-monitor.md",
1099
- tags: ["devops", "monitoring"]
1100
- }
1101
- ]
1102
- }
1103
- };
1104
- function createBatchSkills(options) {
1105
- const results = [];
1106
- const extractStr = (val, fallback) => {
1107
- if (!val)
1108
- return fallback;
1109
- if (typeof val === "string")
1110
- return val;
1111
- return val.en || val["zh-CN"] || Object.values(val)[0] || fallback;
1112
- };
1113
- if (options.lang) {
1114
- const template = BATCH_TEMPLATES[options.lang];
1115
- if (template) {
1116
- for (const skillDef of template.skills) {
1117
- const nameStr = extractStr(skillDef.name, skillDef.id);
1118
- const descStr = extractStr(skillDef.description, "");
1119
- const skill = {
1120
- ...skillDef,
1121
- category: template.category,
1122
- enabled: true,
1123
- version: "1.0.0",
1124
- template: `# ${nameStr}
1125
-
1126
- ${descStr}
1127
-
1128
- This is a placeholder template.`
1129
- };
1130
- results.push(addSkill(skill));
1131
- }
1132
- }
1133
- }
1134
- if (options.seo) {
1135
- const template = BATCH_TEMPLATES.seo;
1136
- for (const skillDef of template.skills) {
1137
- const nameStr = extractStr(skillDef.name, skillDef.id);
1138
- const descStr = extractStr(skillDef.description, "");
1139
- const skill = {
1140
- ...skillDef,
1141
- category: template.category,
1142
- enabled: true,
1143
- version: "1.0.0",
1144
- template: `# ${nameStr}
1145
-
1146
- ${descStr}
1147
-
1148
- This is a placeholder template.`
1149
- };
1150
- results.push(addSkill(skill));
1151
- }
1152
- }
1153
- if (options.devops) {
1154
- const template = BATCH_TEMPLATES.devops;
1155
- for (const skillDef of template.skills) {
1156
- const nameStr = extractStr(skillDef.name, skillDef.id);
1157
- const descStr = extractStr(skillDef.description, "");
1158
- const skill = {
1159
- ...skillDef,
1160
- category: template.category,
1161
- enabled: true,
1162
- version: "1.0.0",
1163
- template: `# ${nameStr}
1164
-
1165
- ${descStr}
1166
-
1167
- This is a placeholder template.`
1168
- };
1169
- results.push(addSkill(skill));
1170
- }
1171
- }
1172
- return results;
1173
- }
1174
- function getBatchCategories() {
1175
- return Object.keys(BATCH_TEMPLATES);
1176
- }
1177
-
1178
29
  async function listSkills(options = {}) {
1179
30
  console.log("");
1180
31
  console.log(a.bold.cyan("\u2501".repeat(60)));