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