ccjk 14.2.2 → 15.0.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.
- package/LICENSE +1 -1
- package/README.md +58 -341
- package/dist/cli.js +59 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/detect.js +15 -0
- package/dist/commands/detect.js.map +1 -0
- package/dist/commands/doctor.js +68 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/git-install.js +50 -0
- package/dist/commands/git-install.js.map +1 -0
- package/dist/commands/init.js +102 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.js +66 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/menu.js +33 -0
- package/dist/commands/menu.js.map +1 -0
- package/dist/core/detect.js +24 -0
- package/dist/core/detect.js.map +1 -0
- package/dist/core/lint.js +49 -0
- package/dist/core/lint.js.map +1 -0
- package/dist/core/mcp.js +41 -0
- package/dist/core/mcp.js.map +1 -0
- package/dist/core/paths.js +9 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/providers.js +53 -0
- package/dist/core/providers.js.map +1 -0
- package/dist/core/settings.js +31 -0
- package/dist/core/settings.js.map +1 -0
- package/dist/core/slash-templates.js +56 -0
- package/dist/core/slash-templates.js.map +1 -0
- package/dist/core/tools.js +27 -0
- package/dist/core/tools.js.map +1 -0
- package/package.json +43 -164
- package/README.HONEST.md +0 -176
- package/README.en.md +0 -67
- package/README.ja.md +0 -67
- package/README.ko.md +0 -67
- package/README.zh-CN.md +0 -86
- package/bin/ccjk.mjs +0 -5
- package/bin/ccjk.ts +0 -222
- package/dist/chunks/agent-teams.mjs +0 -145
- package/dist/chunks/agent.mjs +0 -1439
- package/dist/chunks/agents.mjs +0 -3783
- package/dist/chunks/api-cli.mjs +0 -135
- package/dist/chunks/api-config-selector.mjs +0 -159
- package/dist/chunks/api-providers.mjs +0 -144
- package/dist/chunks/api.mjs +0 -115
- package/dist/chunks/auto-bootstrap.mjs +0 -358
- package/dist/chunks/auto-fixer.mjs +0 -95
- package/dist/chunks/auto-updater.mjs +0 -507
- package/dist/chunks/banner.mjs +0 -173
- package/dist/chunks/bash.mjs +0 -187
- package/dist/chunks/boost.mjs +0 -474
- package/dist/chunks/brain-config.mjs +0 -75
- package/dist/chunks/brain-status.mjs +0 -89
- package/dist/chunks/ccjk-agents.mjs +0 -416
- package/dist/chunks/ccjk-all.mjs +0 -1046
- package/dist/chunks/ccjk-config.mjs +0 -445
- package/dist/chunks/ccjk-hooks.mjs +0 -1074
- package/dist/chunks/ccjk-mcp.mjs +0 -763
- package/dist/chunks/ccjk-setup.mjs +0 -765
- package/dist/chunks/ccjk-skills.mjs +0 -518
- package/dist/chunks/ccr.mjs +0 -109
- package/dist/chunks/ccu.mjs +0 -40
- package/dist/chunks/check-updates.mjs +0 -117
- package/dist/chunks/claude-code-incremental-manager.mjs +0 -761
- package/dist/chunks/claude-config.mjs +0 -606
- package/dist/chunks/claude-config2.mjs +0 -62
- package/dist/chunks/claude-wrapper.mjs +0 -85
- package/dist/chunks/clavue-config.mjs +0 -1454
- package/dist/chunks/cleanup-migration.mjs +0 -20
- package/dist/chunks/cli-hook.mjs +0 -4096
- package/dist/chunks/cloud-sync.mjs +0 -29
- package/dist/chunks/code-type-resolver.mjs +0 -880
- package/dist/chunks/codex-config-switch.mjs +0 -452
- package/dist/chunks/codex-provider-manager.mjs +0 -238
- package/dist/chunks/codex-uninstaller.mjs +0 -404
- package/dist/chunks/codex.mjs +0 -2141
- package/dist/chunks/commands.mjs +0 -108
- package/dist/chunks/commands2.mjs +0 -421
- package/dist/chunks/commit.mjs +0 -140
- package/dist/chunks/completion.mjs +0 -517
- package/dist/chunks/config-consolidator.mjs +0 -172
- package/dist/chunks/config-switch.mjs +0 -334
- package/dist/chunks/config.mjs +0 -558
- package/dist/chunks/config2.mjs +0 -484
- package/dist/chunks/config3.mjs +0 -486
- package/dist/chunks/constants.mjs +0 -323
- package/dist/chunks/context-opt.mjs +0 -444
- package/dist/chunks/context.mjs +0 -974
- package/dist/chunks/dashboard.mjs +0 -481
- package/dist/chunks/doctor.mjs +0 -1301
- package/dist/chunks/eval.mjs +0 -502
- package/dist/chunks/evolution.mjs +0 -322
- package/dist/chunks/features.mjs +0 -715
- package/dist/chunks/fish.mjs +0 -181
- package/dist/chunks/fs-operations.mjs +0 -180
- package/dist/chunks/health-alerts.mjs +0 -830
- package/dist/chunks/help.mjs +0 -341
- package/dist/chunks/hook-installer.mjs +0 -48
- package/dist/chunks/impact.mjs +0 -651
- package/dist/chunks/index.mjs +0 -23
- package/dist/chunks/index10.mjs +0 -19
- package/dist/chunks/index11.mjs +0 -1171
- package/dist/chunks/index12.mjs +0 -218
- package/dist/chunks/index13.mjs +0 -679
- package/dist/chunks/index14.mjs +0 -1009
- package/dist/chunks/index15.mjs +0 -194
- package/dist/chunks/index2.mjs +0 -7637
- package/dist/chunks/index3.mjs +0 -171
- package/dist/chunks/index4.mjs +0 -26
- package/dist/chunks/index5.mjs +0 -19
- package/dist/chunks/index6.mjs +0 -19092
- package/dist/chunks/index7.mjs +0 -616
- package/dist/chunks/index8.mjs +0 -1602
- package/dist/chunks/index9.mjs +0 -5384
- package/dist/chunks/init.mjs +0 -1911
- package/dist/chunks/installer.mjs +0 -757
- package/dist/chunks/installer2.mjs +0 -103
- package/dist/chunks/interview.mjs +0 -2927
- package/dist/chunks/json-config.mjs +0 -60
- package/dist/chunks/linux.mjs +0 -3863
- package/dist/chunks/macos.mjs +0 -69
- package/dist/chunks/main.mjs +0 -635
- package/dist/chunks/manager.mjs +0 -1048
- package/dist/chunks/marketplace.mjs +0 -265
- package/dist/chunks/mcp-cli.mjs +0 -205
- package/dist/chunks/mcp-performance.mjs +0 -187
- package/dist/chunks/mcp.mjs +0 -667
- package/dist/chunks/memory-check.mjs +0 -2973
- package/dist/chunks/memory-paths.mjs +0 -259
- package/dist/chunks/memory-sync.mjs +0 -209
- package/dist/chunks/memory.mjs +0 -354
- package/dist/chunks/metrics-display.mjs +0 -153
- package/dist/chunks/monitor.mjs +0 -1856
- package/dist/chunks/notification.mjs +0 -1864
- package/dist/chunks/onboarding.mjs +0 -386
- package/dist/chunks/package.mjs +0 -3
- package/dist/chunks/paradigm.mjs +0 -74
- package/dist/chunks/permission-manager.mjs +0 -250
- package/dist/chunks/permissions.mjs +0 -265
- package/dist/chunks/persistence-manager.mjs +0 -801
- package/dist/chunks/persistence.mjs +0 -707
- package/dist/chunks/platform.mjs +0 -395
- package/dist/chunks/plugin.mjs +0 -1936
- package/dist/chunks/powershell.mjs +0 -213
- package/dist/chunks/prompts.mjs +0 -244
- package/dist/chunks/providers.mjs +0 -263
- package/dist/chunks/quick-actions.mjs +0 -335
- package/dist/chunks/quick-provider.mjs +0 -755
- package/dist/chunks/quick-setup.mjs +0 -421
- package/dist/chunks/remote.mjs +0 -497
- package/dist/chunks/research.mjs +0 -1904
- package/dist/chunks/rollback.mjs +0 -38
- package/dist/chunks/session-manager.mjs +0 -1371
- package/dist/chunks/session.mjs +0 -878
- package/dist/chunks/sessions.mjs +0 -106
- package/dist/chunks/silent-updater.mjs +0 -396
- package/dist/chunks/simple-config.mjs +0 -122
- package/dist/chunks/skill.mjs +0 -117
- package/dist/chunks/skill2.mjs +0 -9052
- package/dist/chunks/skills-sync.mjs +0 -1343
- package/dist/chunks/skills.mjs +0 -577
- package/dist/chunks/slash-commands.mjs +0 -208
- package/dist/chunks/smart-guide.mjs +0 -247
- package/dist/chunks/snapshot.mjs +0 -58
- package/dist/chunks/startup.mjs +0 -487
- package/dist/chunks/stats.mjs +0 -191
- package/dist/chunks/status.mjs +0 -471
- package/dist/chunks/team.mjs +0 -63
- package/dist/chunks/thinking.mjs +0 -626
- package/dist/chunks/trace.mjs +0 -57
- package/dist/chunks/uninstall.mjs +0 -852
- package/dist/chunks/update.mjs +0 -174
- package/dist/chunks/upgrade-manager.mjs +0 -204
- package/dist/chunks/upgrade.mjs +0 -133
- package/dist/chunks/version-checker.mjs +0 -891
- package/dist/chunks/vim.mjs +0 -903
- package/dist/chunks/windows.mjs +0 -14
- package/dist/chunks/workflows.mjs +0 -633
- package/dist/chunks/wsl.mjs +0 -129
- package/dist/chunks/zero-config.mjs +0 -871
- package/dist/chunks/zsh.mjs +0 -182
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -2684
- package/dist/i18n/locales/en/agent-teams.json +0 -18
- package/dist/i18n/locales/en/agentBrowser.json +0 -80
- package/dist/i18n/locales/en/agents.json +0 -135
- package/dist/i18n/locales/en/api.json +0 -63
- package/dist/i18n/locales/en/ccjk-agents.json +0 -33
- package/dist/i18n/locales/en/ccjk-all.json +0 -23
- package/dist/i18n/locales/en/ccjk-skills.json +0 -22
- package/dist/i18n/locales/en/ccjk.json +0 -276
- package/dist/i18n/locales/en/ccr.json +0 -65
- package/dist/i18n/locales/en/claude-md.json +0 -73
- package/dist/i18n/locales/en/cli.json +0 -148
- package/dist/i18n/locales/en/cloud-setup.json +0 -31
- package/dist/i18n/locales/en/cloud-sync.json +0 -147
- package/dist/i18n/locales/en/cloud.json +0 -40
- package/dist/i18n/locales/en/cloudPlugins.json +0 -118
- package/dist/i18n/locales/en/codex.json +0 -184
- package/dist/i18n/locales/en/cometix.json +0 -29
- package/dist/i18n/locales/en/common.json +0 -68
- package/dist/i18n/locales/en/config.json +0 -108
- package/dist/i18n/locales/en/configuration.json +0 -236
- package/dist/i18n/locales/en/context.json +0 -85
- package/dist/i18n/locales/en/dashboard.json +0 -78
- package/dist/i18n/locales/en/errors.json +0 -26
- package/dist/i18n/locales/en/evolution.json +0 -54
- package/dist/i18n/locales/en/hooks.json +0 -74
- package/dist/i18n/locales/en/hooksSync.json +0 -133
- package/dist/i18n/locales/en/installation.json +0 -83
- package/dist/i18n/locales/en/interview.json +0 -104
- package/dist/i18n/locales/en/language.json +0 -19
- package/dist/i18n/locales/en/lsp.json +0 -78
- package/dist/i18n/locales/en/marketplace.json +0 -116
- package/dist/i18n/locales/en/mcp.json +0 -180
- package/dist/i18n/locales/en/memory.json +0 -23
- package/dist/i18n/locales/en/menu.json +0 -299
- package/dist/i18n/locales/en/multi-config.json +0 -79
- package/dist/i18n/locales/en/notification.json +0 -307
- package/dist/i18n/locales/en/permissions.json +0 -95
- package/dist/i18n/locales/en/persistence.json +0 -127
- package/dist/i18n/locales/en/plugins.json +0 -146
- package/dist/i18n/locales/en/quick-actions.json +0 -78
- package/dist/i18n/locales/en/registry.json +0 -54
- package/dist/i18n/locales/en/remote.json +0 -93
- package/dist/i18n/locales/en/sandbox.json +0 -44
- package/dist/i18n/locales/en/setup.json +0 -44
- package/dist/i18n/locales/en/shencha.json +0 -14
- package/dist/i18n/locales/en/skills.json +0 -100
- package/dist/i18n/locales/en/skillsSync.json +0 -74
- package/dist/i18n/locales/en/smartGuide.json +0 -49
- package/dist/i18n/locales/en/stats.json +0 -20
- package/dist/i18n/locales/en/subagent.json +0 -69
- package/dist/i18n/locales/en/superpowers.json +0 -117
- package/dist/i18n/locales/en/team.json +0 -7
- package/dist/i18n/locales/en/thinking.json +0 -65
- package/dist/i18n/locales/en/tools.json +0 -42
- package/dist/i18n/locales/en/uninstall.json +0 -56
- package/dist/i18n/locales/en/updater.json +0 -29
- package/dist/i18n/locales/en/vim.json +0 -169
- package/dist/i18n/locales/en/workflow.json +0 -55
- package/dist/i18n/locales/en/workspace.json +0 -108
- package/dist/i18n/locales/zh-CN/agent-teams.json +0 -18
- package/dist/i18n/locales/zh-CN/agentBrowser.json +0 -80
- package/dist/i18n/locales/zh-CN/agents.json +0 -135
- package/dist/i18n/locales/zh-CN/api.json +0 -63
- package/dist/i18n/locales/zh-CN/ccjk-agents.json +0 -33
- package/dist/i18n/locales/zh-CN/ccjk-all.json +0 -23
- package/dist/i18n/locales/zh-CN/ccjk-skills.json +0 -22
- package/dist/i18n/locales/zh-CN/ccjk.json +0 -276
- package/dist/i18n/locales/zh-CN/ccr.json +0 -65
- package/dist/i18n/locales/zh-CN/claude-md.json +0 -73
- package/dist/i18n/locales/zh-CN/cli.json +0 -148
- package/dist/i18n/locales/zh-CN/cloud-setup.json +0 -31
- package/dist/i18n/locales/zh-CN/cloud-sync.json +0 -147
- package/dist/i18n/locales/zh-CN/cloud.json +0 -40
- package/dist/i18n/locales/zh-CN/cloudPlugins.json +0 -118
- package/dist/i18n/locales/zh-CN/codex.json +0 -184
- package/dist/i18n/locales/zh-CN/cometix.json +0 -29
- package/dist/i18n/locales/zh-CN/common.json +0 -68
- package/dist/i18n/locales/zh-CN/config.json +0 -108
- package/dist/i18n/locales/zh-CN/configuration.json +0 -234
- package/dist/i18n/locales/zh-CN/context.json +0 -85
- package/dist/i18n/locales/zh-CN/dashboard.json +0 -78
- package/dist/i18n/locales/zh-CN/errors.json +0 -26
- package/dist/i18n/locales/zh-CN/evolution.json +0 -54
- package/dist/i18n/locales/zh-CN/hooks.json +0 -74
- package/dist/i18n/locales/zh-CN/hooksSync.json +0 -133
- package/dist/i18n/locales/zh-CN/installation.json +0 -83
- package/dist/i18n/locales/zh-CN/interview.json +0 -104
- package/dist/i18n/locales/zh-CN/language.json +0 -19
- package/dist/i18n/locales/zh-CN/lsp.json +0 -78
- package/dist/i18n/locales/zh-CN/marketplace.json +0 -116
- package/dist/i18n/locales/zh-CN/mcp.json +0 -180
- package/dist/i18n/locales/zh-CN/memory.json +0 -23
- package/dist/i18n/locales/zh-CN/menu.json +0 -299
- package/dist/i18n/locales/zh-CN/multi-config.json +0 -79
- package/dist/i18n/locales/zh-CN/notification.json +0 -307
- package/dist/i18n/locales/zh-CN/permissions.json +0 -95
- package/dist/i18n/locales/zh-CN/persistence.json +0 -127
- package/dist/i18n/locales/zh-CN/plugins.json +0 -146
- package/dist/i18n/locales/zh-CN/quick-actions.json +0 -78
- package/dist/i18n/locales/zh-CN/registry.json +0 -54
- package/dist/i18n/locales/zh-CN/remote.json +0 -93
- package/dist/i18n/locales/zh-CN/sandbox.json +0 -44
- package/dist/i18n/locales/zh-CN/setup.json +0 -44
- package/dist/i18n/locales/zh-CN/shencha.json +0 -14
- package/dist/i18n/locales/zh-CN/skills.json +0 -100
- package/dist/i18n/locales/zh-CN/skillsSync.json +0 -74
- package/dist/i18n/locales/zh-CN/smartGuide.json +0 -49
- package/dist/i18n/locales/zh-CN/stats.json +0 -20
- package/dist/i18n/locales/zh-CN/subagent.json +0 -69
- package/dist/i18n/locales/zh-CN/superpowers.json +0 -117
- package/dist/i18n/locales/zh-CN/team.json +0 -7
- package/dist/i18n/locales/zh-CN/thinking.json +0 -65
- package/dist/i18n/locales/zh-CN/tools.json +0 -42
- package/dist/i18n/locales/zh-CN/uninstall.json +0 -56
- package/dist/i18n/locales/zh-CN/updater.json +0 -29
- package/dist/i18n/locales/zh-CN/vim.json +0 -169
- package/dist/i18n/locales/zh-CN/workflow.json +0 -55
- package/dist/i18n/locales/zh-CN/workspace.json +0 -108
- package/dist/index.d.mts +0 -5658
- package/dist/index.d.ts +0 -5658
- package/dist/index.mjs +0 -3732
- package/dist/shared/ccjk.5bEolFrk.mjs +0 -254
- package/dist/shared/ccjk.8oaxX4iR.mjs +0 -90
- package/dist/shared/ccjk.B2U7DsPy.mjs +0 -31
- package/dist/shared/ccjk.B2f-cwUP.mjs +0 -468
- package/dist/shared/ccjk.BAGoDD49.mjs +0 -36
- package/dist/shared/ccjk.BBtCGd_g.mjs +0 -899
- package/dist/shared/ccjk.BFQ7yr5S.mjs +0 -16
- package/dist/shared/ccjk.BLsIiTqO.mjs +0 -449
- package/dist/shared/ccjk.BXv8aYs1.mjs +0 -170
- package/dist/shared/ccjk.BnsY5WxD.mjs +0 -171
- package/dist/shared/ccjk.BoApaI4j.mjs +0 -28
- package/dist/shared/ccjk.Bq8TqZG_.mjs +0 -189
- package/dist/shared/ccjk.BtrioX1Z.mjs +0 -25
- package/dist/shared/ccjk.Bx_rmYfN.mjs +0 -69
- package/dist/shared/ccjk.BzPbSEP2.mjs +0 -115
- package/dist/shared/ccjk.C0WLUnFV.mjs +0 -293
- package/dist/shared/ccjk.C1hANZTu.mjs +0 -19
- package/dist/shared/ccjk.C2jHOZVP.mjs +0 -52
- package/dist/shared/ccjk.CNhnT6uQ.mjs +0 -636
- package/dist/shared/ccjk.COweQ1RR.mjs +0 -5
- package/dist/shared/ccjk.CfKKcvWy.mjs +0 -126
- package/dist/shared/ccjk.Cjgrln_h.mjs +0 -297
- package/dist/shared/ccjk.CoCHVXl3.mjs +0 -3951
- package/dist/shared/ccjk.CwGZSTAK.mjs +0 -319
- package/dist/shared/ccjk.CxpGa6MC.mjs +0 -2724
- package/dist/shared/ccjk.D-magaEx.mjs +0 -763
- package/dist/shared/ccjk.D0g2ABGg.mjs +0 -171
- package/dist/shared/ccjk.D6ycHbak.mjs +0 -270
- package/dist/shared/ccjk.D75wivnp.mjs +0 -142
- package/dist/shared/ccjk.DDL-4C-k.mjs +0 -100
- package/dist/shared/ccjk.DFRPtmK_.mjs +0 -75
- package/dist/shared/ccjk.DMV3x5Sd.mjs +0 -299
- package/dist/shared/ccjk.DZ2LLOa-.mjs +0 -2195
- package/dist/shared/ccjk.DbigonEQ.mjs +0 -698
- package/dist/shared/ccjk.DcMvE7lf.mjs +0 -618
- package/dist/shared/ccjk.DeWpAShp.mjs +0 -1828
- package/dist/shared/ccjk.DhJ1kyDR.mjs +0 -30
- package/dist/shared/ccjk.DlTXS9rP.mjs +0 -224
- package/dist/shared/ccjk.DopKzo3z.mjs +0 -305
- package/dist/shared/ccjk.DsZsc4LR.mjs +0 -1280
- package/dist/shared/ccjk.DuzJZlgj.mjs +0 -418
- package/dist/shared/ccjk.Dxgd2vjc.mjs +0 -444
- package/dist/shared/ccjk.J8YiPsOw.mjs +0 -259
- package/dist/shared/ccjk.KfSWcGlE.mjs +0 -38
- package/dist/shared/ccjk.L7yC58_i.mjs +0 -225
- package/dist/shared/ccjk.MwtjAULc.mjs +0 -1447
- package/dist/shared/ccjk.OJKHVSOb.mjs +0 -2005
- package/dist/shared/ccjk.OTnevPNE.mjs +0 -225
- package/dist/shared/ccjk.RyizuzOI.mjs +0 -21
- package/dist/shared/ccjk.T_cX87dY.mjs +0 -15
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +0 -249
- package/dist/shared/ccjk.gDEDGD_t.mjs +0 -38
- package/dist/shared/ccjk.hoqrwWdN.mjs +0 -333
- package/dist/shared/ccjk.i_vn-9C3.mjs +0 -317
- package/dist/shared/ccjk.lG3ccFjm.mjs +0 -885
- package/dist/shared/ccjk.wLJHO0Af.mjs +0 -244
- package/dist/shared/ccjk.y-a_1vK4.mjs +0 -5127
- package/dist/templates/agents/README.md +0 -78
- package/dist/templates/agents/fullstack-developer.json +0 -70
- package/dist/templates/agents/go-expert.json +0 -69
- package/dist/templates/agents/index.json +0 -64
- package/dist/templates/agents/python-expert.json +0 -69
- package/dist/templates/agents/react-specialist.json +0 -69
- package/dist/templates/agents/testing-automation-expert.json +0 -70
- package/dist/templates/agents/typescript-architect.json +0 -69
- package/dist/templates/claude-code/common/settings.json +0 -109
- package/dist/templates/common/error-prevention.md +0 -267
- package/dist/templates/common/karpathy-baseline.md +0 -83
- package/dist/templates/common/output-styles/zh-CN/carmack-mode.md +0 -381
- package/dist/templates/common/output-styles/zh-CN/codex-rigor-mode.md +0 -114
- package/dist/templates/common/output-styles/zh-CN/dhh-mode.md +0 -265
- package/dist/templates/common/output-styles/zh-CN/evan-you-mode.md +0 -539
- package/dist/templates/common/output-styles/zh-CN/jobs-mode.md +0 -369
- package/dist/templates/common/output-styles/zh-CN/linus-mode.md +0 -135
- package/dist/templates/common/output-styles/zh-CN/uncle-bob-mode.md +0 -221
- package/dist/templates/common/workflow/continuousDelivery/en/continuous-delivery.md +0 -628
- package/dist/templates/common/workflow/continuousDelivery/zh-CN/continuous-delivery.md +0 -628
- package/dist/templates/common/workflow/essential/en/agents/ccjk-config-agent.md +0 -187
- package/dist/templates/common/workflow/essential/en/agents/ccjk-mcp-agent.md +0 -191
- package/dist/templates/common/workflow/essential/en/agents/ccjk-skill-agent.md +0 -249
- package/dist/templates/common/workflow/essential/en/agents/ccjk-workflow-agent.md +0 -277
- package/dist/templates/common/workflow/essential/en/agents/get-current-datetime.md +0 -29
- package/dist/templates/common/workflow/essential/en/agents/init-architect.md +0 -115
- package/dist/templates/common/workflow/essential/en/agents/ui-ux-designer.md +0 -91
- package/dist/templates/common/workflow/essential/en/feat.md +0 -92
- package/dist/templates/common/workflow/essential/en/goal.md +0 -147
- package/dist/templates/common/workflow/essential/en/init-project.md +0 -53
- package/dist/templates/common/workflow/essential/zh-CN/agents/get-current-datetime.md +0 -29
- package/dist/templates/common/workflow/essential/zh-CN/agents/init-architect.md +0 -115
- package/dist/templates/common/workflow/essential/zh-CN/agents/ui-ux-designer.md +0 -91
- package/dist/templates/common/workflow/essential/zh-CN/feat.md +0 -315
- package/dist/templates/common/workflow/essential/zh-CN/goal.md +0 -146
- package/dist/templates/common/workflow/essential/zh-CN/init-project.md +0 -53
- package/dist/templates/common/workflow/git/en/git-cleanBranches.md +0 -102
- package/dist/templates/common/workflow/git/en/git-commit.md +0 -205
- package/dist/templates/common/workflow/git/en/git-rollback.md +0 -90
- package/dist/templates/common/workflow/git/en/git-worktree.md +0 -276
- package/dist/templates/common/workflow/git/zh-CN/git-cleanBranches.md +0 -102
- package/dist/templates/common/workflow/git/zh-CN/git-commit.md +0 -205
- package/dist/templates/common/workflow/git/zh-CN/git-rollback.md +0 -90
- package/dist/templates/common/workflow/git/zh-CN/git-worktree.md +0 -276
- package/dist/templates/common/workflow/interview/en/interview.md +0 -67
- package/dist/templates/common/workflow/interview/zh-CN/interview.md +0 -67
- package/dist/templates/common/workflow/linearMethod/en/linear-method.md +0 -651
- package/dist/templates/common/workflow/linearMethod/zh-CN/linear-method.md +0 -752
- package/dist/templates/common/workflow/refactoringMaster/en/refactoring-master.md +0 -516
- package/dist/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +0 -812
- package/dist/templates/common/workflow/sixStep/en/workflow.md +0 -83
- package/dist/templates/common/workflow/sixStep/zh-CN/workflow.md +0 -359
- package/dist/templates/common/workflow/specFirstTDD/en/spec-first-tdd.md +0 -364
- package/dist/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +0 -366
- package/dist/templates/hooks/README.md +0 -212
- package/dist/templates/hooks/git-workflow-hooks.md +0 -551
- package/dist/templates/hooks/post-test/coverage.json +0 -21
- package/dist/templates/hooks/post-test/summary.json +0 -21
- package/dist/templates/hooks/post-test-coverage.md +0 -434
- package/dist/templates/hooks/pre-commit/eslint.json +0 -22
- package/dist/templates/hooks/pre-commit/prettier.json +0 -22
- package/dist/templates/hooks/pre-commit-black.md +0 -274
- package/dist/templates/hooks/pre-commit-eslint.md +0 -153
- package/dist/templates/hooks/pre-commit-gofmt.md +0 -284
- package/dist/templates/hooks/pre-commit-prettier.md +0 -212
- package/dist/templates/hooks/pre-commit-type-check.md +0 -377
- package/dist/templates/skills/ccjk-init.md +0 -154
- package/dist/templates/skills/ccjk-mcp-setup.md +0 -205
- package/dist/templates/skills/ccjk-troubleshoot.md +0 -228
- package/dist/templates/skills/django-patterns.md +0 -1016
- package/dist/templates/skills/git-workflow.md +0 -748
- package/dist/templates/skills/go-idioms.md +0 -963
- package/dist/templates/skills/index.json +0 -132
- package/dist/templates/skills/nextjs-optimization.md +0 -694
- package/dist/templates/skills/python-pep8.md +0 -852
- package/dist/templates/skills/react-patterns.md +0 -686
- package/dist/templates/skills/rust-patterns.md +0 -1057
- package/dist/templates/skills/security-best-practices.md +0 -1413
- package/dist/templates/skills/testing-best-practices.md +0 -1315
- package/dist/templates/skills/ts-best-practices.md +0 -354
- package/templates/agents/README.md +0 -78
- package/templates/agents/fullstack-developer.json +0 -70
- package/templates/agents/go-expert.json +0 -69
- package/templates/agents/index.json +0 -64
- package/templates/agents/python-expert.json +0 -69
- package/templates/agents/react-specialist.json +0 -69
- package/templates/agents/testing-automation-expert.json +0 -70
- package/templates/agents/typescript-architect.json +0 -69
- package/templates/claude-code/common/settings.json +0 -109
- package/templates/common/error-prevention.md +0 -267
- package/templates/common/karpathy-baseline.md +0 -83
- package/templates/common/output-styles/zh-CN/carmack-mode.md +0 -381
- package/templates/common/output-styles/zh-CN/codex-rigor-mode.md +0 -114
- package/templates/common/output-styles/zh-CN/dhh-mode.md +0 -265
- package/templates/common/output-styles/zh-CN/evan-you-mode.md +0 -539
- package/templates/common/output-styles/zh-CN/jobs-mode.md +0 -369
- package/templates/common/output-styles/zh-CN/linus-mode.md +0 -135
- package/templates/common/output-styles/zh-CN/uncle-bob-mode.md +0 -221
- package/templates/common/workflow/continuousDelivery/en/continuous-delivery.md +0 -628
- package/templates/common/workflow/continuousDelivery/zh-CN/continuous-delivery.md +0 -628
- package/templates/common/workflow/essential/en/agents/ccjk-config-agent.md +0 -187
- package/templates/common/workflow/essential/en/agents/ccjk-mcp-agent.md +0 -191
- package/templates/common/workflow/essential/en/agents/ccjk-skill-agent.md +0 -249
- package/templates/common/workflow/essential/en/agents/ccjk-workflow-agent.md +0 -277
- package/templates/common/workflow/essential/en/agents/get-current-datetime.md +0 -29
- package/templates/common/workflow/essential/en/agents/init-architect.md +0 -115
- package/templates/common/workflow/essential/en/agents/ui-ux-designer.md +0 -91
- package/templates/common/workflow/essential/en/feat.md +0 -92
- package/templates/common/workflow/essential/en/goal.md +0 -147
- package/templates/common/workflow/essential/en/init-project.md +0 -53
- package/templates/common/workflow/essential/zh-CN/agents/get-current-datetime.md +0 -29
- package/templates/common/workflow/essential/zh-CN/agents/init-architect.md +0 -115
- package/templates/common/workflow/essential/zh-CN/agents/ui-ux-designer.md +0 -91
- package/templates/common/workflow/essential/zh-CN/feat.md +0 -315
- package/templates/common/workflow/essential/zh-CN/goal.md +0 -146
- package/templates/common/workflow/essential/zh-CN/init-project.md +0 -53
- package/templates/common/workflow/git/en/git-cleanBranches.md +0 -102
- package/templates/common/workflow/git/en/git-commit.md +0 -205
- package/templates/common/workflow/git/en/git-rollback.md +0 -90
- package/templates/common/workflow/git/en/git-worktree.md +0 -276
- package/templates/common/workflow/git/zh-CN/git-cleanBranches.md +0 -102
- package/templates/common/workflow/git/zh-CN/git-commit.md +0 -205
- package/templates/common/workflow/git/zh-CN/git-rollback.md +0 -90
- package/templates/common/workflow/git/zh-CN/git-worktree.md +0 -276
- package/templates/common/workflow/interview/en/interview.md +0 -67
- package/templates/common/workflow/interview/zh-CN/interview.md +0 -67
- package/templates/common/workflow/linearMethod/en/linear-method.md +0 -651
- package/templates/common/workflow/linearMethod/zh-CN/linear-method.md +0 -752
- package/templates/common/workflow/refactoringMaster/en/refactoring-master.md +0 -516
- package/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +0 -812
- package/templates/common/workflow/sixStep/en/workflow.md +0 -83
- package/templates/common/workflow/sixStep/zh-CN/workflow.md +0 -359
- package/templates/common/workflow/specFirstTDD/en/spec-first-tdd.md +0 -364
- package/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +0 -366
- package/templates/hooks/README.md +0 -212
- package/templates/hooks/git-workflow-hooks.md +0 -551
- package/templates/hooks/post-test/coverage.json +0 -21
- package/templates/hooks/post-test/summary.json +0 -21
- package/templates/hooks/post-test-coverage.md +0 -434
- package/templates/hooks/pre-commit/eslint.json +0 -22
- package/templates/hooks/pre-commit/prettier.json +0 -22
- package/templates/hooks/pre-commit-black.md +0 -274
- package/templates/hooks/pre-commit-eslint.md +0 -153
- package/templates/hooks/pre-commit-gofmt.md +0 -284
- package/templates/hooks/pre-commit-prettier.md +0 -212
- package/templates/hooks/pre-commit-type-check.md +0 -377
- package/templates/skills/basic.hbs +0 -72
- package/templates/skills/ccjk-init.md +0 -154
- package/templates/skills/ccjk-mcp-setup.md +0 -205
- package/templates/skills/ccjk-troubleshoot.md +0 -228
- package/templates/skills/code-refactor.hbs +0 -133
- package/templates/skills/code-review.hbs +0 -141
- package/templates/skills/django-patterns.md +0 -1016
- package/templates/skills/git-workflow.md +0 -748
- package/templates/skills/go-idioms.md +0 -963
- package/templates/skills/index.json +0 -132
- package/templates/skills/nextjs-optimization.md +0 -694
- package/templates/skills/python-pep8.md +0 -852
- package/templates/skills/react-patterns.md +0 -686
- package/templates/skills/rust-patterns.md +0 -1057
- package/templates/skills/security-best-practices.md +0 -1413
- package/templates/skills/testing-best-practices.md +0 -1315
- package/templates/skills/ts-best-practices.md +0 -354
- package/templates/skills/type-fix.hbs +0 -132
|
@@ -1,1343 +0,0 @@
|
|
|
1
|
-
import a from './index5.mjs';
|
|
2
|
-
import { i as inquirer } from './index6.mjs';
|
|
3
|
-
import { getTranslation } from './index2.mjs';
|
|
4
|
-
import { createHash } from 'node:crypto';
|
|
5
|
-
import { existsSync, readdirSync, readFileSync, mkdirSync } from 'node:fs';
|
|
6
|
-
import process__default from 'node:process';
|
|
7
|
-
import { a as createGateway } from '../shared/ccjk.D0g2ABGg.mjs';
|
|
8
|
-
import { CCJK_SKILLS_DIR, CCJK_CONFIG_DIR, CLOUD_ENDPOINTS } from './constants.mjs';
|
|
9
|
-
import { writeFileAtomic } from './fs-operations.mjs';
|
|
10
|
-
import { readFile, stat } from 'node:fs/promises';
|
|
11
|
-
import { m as matter } from '../shared/ccjk.y-a_1vK4.mjs';
|
|
12
|
-
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
13
|
-
import { C as CloudErrorFactory, a as CloudError } from '../shared/ccjk.DMV3x5Sd.mjs';
|
|
14
|
-
import { s as showImpactReminder } from '../shared/ccjk.C1hANZTu.mjs';
|
|
15
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
16
|
-
import 'node:readline';
|
|
17
|
-
import 'stream';
|
|
18
|
-
import 'node:tty';
|
|
19
|
-
import 'node:async_hooks';
|
|
20
|
-
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
21
|
-
import 'node:util';
|
|
22
|
-
import 'tty';
|
|
23
|
-
import 'fs';
|
|
24
|
-
import 'child_process';
|
|
25
|
-
import 'node:path';
|
|
26
|
-
import 'node:os';
|
|
27
|
-
import 'buffer';
|
|
28
|
-
import 'string_decoder';
|
|
29
|
-
import 'node:url';
|
|
30
|
-
import '../shared/ccjk.D6ycHbak.mjs';
|
|
31
|
-
import '../shared/ccjk.COweQ1RR.mjs';
|
|
32
|
-
|
|
33
|
-
function validateSkillListResponse(data) {
|
|
34
|
-
if (!data || typeof data !== "object")
|
|
35
|
-
return false;
|
|
36
|
-
const obj = data;
|
|
37
|
-
return Array.isArray(obj.skills) && typeof obj.total === "number" && typeof obj.page === "number" && typeof obj.pageSize === "number" && typeof obj.totalPages === "number";
|
|
38
|
-
}
|
|
39
|
-
function validateSkillGetResponse(data) {
|
|
40
|
-
if (!data || typeof data !== "object")
|
|
41
|
-
return false;
|
|
42
|
-
const obj = data;
|
|
43
|
-
return obj.skill !== void 0 && typeof obj.skill === "object" && obj.skill !== null;
|
|
44
|
-
}
|
|
45
|
-
function validateSkillUploadResponse(data) {
|
|
46
|
-
if (!data || typeof data !== "object")
|
|
47
|
-
return false;
|
|
48
|
-
const obj = data;
|
|
49
|
-
return obj.skill !== void 0 && typeof obj.skill === "object" && obj.skill !== null;
|
|
50
|
-
}
|
|
51
|
-
function validateSkillDownloadResponse(data) {
|
|
52
|
-
if (!data || typeof data !== "object")
|
|
53
|
-
return false;
|
|
54
|
-
const obj = data;
|
|
55
|
-
return obj.skill !== void 0 && typeof obj.skill === "object" && obj.skill !== null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
class SkillsApiClient {
|
|
59
|
-
gateway;
|
|
60
|
-
constructor(gateway) {
|
|
61
|
-
this.gateway = gateway;
|
|
62
|
-
}
|
|
63
|
-
// ==========================================================================
|
|
64
|
-
// List Skills
|
|
65
|
-
// ==========================================================================
|
|
66
|
-
/**
|
|
67
|
-
* List skills from cloud
|
|
68
|
-
*
|
|
69
|
-
* @param request - List request parameters
|
|
70
|
-
* @returns List response with skills array
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* const response = await client.list({
|
|
75
|
-
* privacy: 'public',
|
|
76
|
-
* page: 1,
|
|
77
|
-
* pageSize: 20
|
|
78
|
-
* })
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
async list(request = {}) {
|
|
82
|
-
try {
|
|
83
|
-
const response = await this.gateway.request(
|
|
84
|
-
"skills.list",
|
|
85
|
-
{
|
|
86
|
-
method: "GET",
|
|
87
|
-
query: this.buildListQuery(request)
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
if (response.success && response.data) {
|
|
91
|
-
if (!validateSkillListResponse(response.data)) {
|
|
92
|
-
throw CloudErrorFactory.schemaMismatch(
|
|
93
|
-
"Invalid skill list response format",
|
|
94
|
-
{ context: { request } }
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return response;
|
|
99
|
-
} catch (error) {
|
|
100
|
-
if (error instanceof CloudError) {
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
103
|
-
throw CloudErrorFactory.unknown(error, {
|
|
104
|
-
context: { operation: "skills.list", request }
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// ==========================================================================
|
|
109
|
-
// Get Skill
|
|
110
|
-
// ==========================================================================
|
|
111
|
-
/**
|
|
112
|
-
* Get skill details by ID
|
|
113
|
-
*
|
|
114
|
-
* @param request - Get request with skill ID
|
|
115
|
-
* @returns Skill details
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```typescript
|
|
119
|
-
* const response = await client.get({
|
|
120
|
-
* skillId: 'my-skill',
|
|
121
|
-
* version: '1.0.0'
|
|
122
|
-
* })
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
async get(request) {
|
|
126
|
-
try {
|
|
127
|
-
if (!request.skillId || request.skillId.trim() === "") {
|
|
128
|
-
throw CloudErrorFactory.validation("Skill ID is required");
|
|
129
|
-
}
|
|
130
|
-
const query = {};
|
|
131
|
-
if (request.version) {
|
|
132
|
-
query.version = request.version;
|
|
133
|
-
}
|
|
134
|
-
const response = await this.gateway.request(
|
|
135
|
-
"skills.download",
|
|
136
|
-
{
|
|
137
|
-
method: "GET",
|
|
138
|
-
query: {
|
|
139
|
-
skillId: request.skillId,
|
|
140
|
-
...query
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
if (response.success && response.data) {
|
|
145
|
-
if (!validateSkillGetResponse(response.data)) {
|
|
146
|
-
throw CloudErrorFactory.schemaMismatch(
|
|
147
|
-
"Invalid skill get response format",
|
|
148
|
-
{ context: { request } }
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return response;
|
|
153
|
-
} catch (error) {
|
|
154
|
-
if (error instanceof CloudError) {
|
|
155
|
-
throw error;
|
|
156
|
-
}
|
|
157
|
-
throw CloudErrorFactory.unknown(error, {
|
|
158
|
-
context: { operation: "skills.get", request }
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
// ==========================================================================
|
|
163
|
-
// Upload Skill
|
|
164
|
-
// ==========================================================================
|
|
165
|
-
/**
|
|
166
|
-
* Upload skill to cloud
|
|
167
|
-
*
|
|
168
|
-
* @param request - Upload request with skill data
|
|
169
|
-
* @returns Upload response with skill details
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* ```typescript
|
|
173
|
-
* const response = await client.upload({
|
|
174
|
-
* name: 'my-skill',
|
|
175
|
-
* version: '1.0.0',
|
|
176
|
-
* content: '# My Skill...',
|
|
177
|
-
* metadata: { author: 'me', description: 'A skill' },
|
|
178
|
-
* privacy: 'private',
|
|
179
|
-
* checksum: 'abc123'
|
|
180
|
-
* })
|
|
181
|
-
* ```
|
|
182
|
-
*/
|
|
183
|
-
async upload(request) {
|
|
184
|
-
try {
|
|
185
|
-
this.validateUploadRequest(request);
|
|
186
|
-
const response = await this.gateway.request(
|
|
187
|
-
"skills.upload",
|
|
188
|
-
{
|
|
189
|
-
method: "POST",
|
|
190
|
-
body: request
|
|
191
|
-
}
|
|
192
|
-
);
|
|
193
|
-
if (response.success && response.data) {
|
|
194
|
-
if (!validateSkillUploadResponse(response.data)) {
|
|
195
|
-
throw CloudErrorFactory.schemaMismatch(
|
|
196
|
-
"Invalid skill upload response format",
|
|
197
|
-
{ context: { request } }
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return response;
|
|
202
|
-
} catch (error) {
|
|
203
|
-
if (error instanceof CloudError) {
|
|
204
|
-
throw error;
|
|
205
|
-
}
|
|
206
|
-
throw CloudErrorFactory.unknown(error, {
|
|
207
|
-
context: { operation: "skills.upload", request }
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
// ==========================================================================
|
|
212
|
-
// Download Skill
|
|
213
|
-
// ==========================================================================
|
|
214
|
-
/**
|
|
215
|
-
* Download skill from cloud
|
|
216
|
-
*
|
|
217
|
-
* @param request - Download request with skill ID
|
|
218
|
-
* @returns Download response with skill content
|
|
219
|
-
*
|
|
220
|
-
* @example
|
|
221
|
-
* ```typescript
|
|
222
|
-
* const response = await client.download({
|
|
223
|
-
* skillId: 'my-skill',
|
|
224
|
-
* version: '1.0.0'
|
|
225
|
-
* })
|
|
226
|
-
* ```
|
|
227
|
-
*/
|
|
228
|
-
async download(request) {
|
|
229
|
-
try {
|
|
230
|
-
if (!request.skillId || request.skillId.trim() === "") {
|
|
231
|
-
throw CloudErrorFactory.validation("Skill ID is required");
|
|
232
|
-
}
|
|
233
|
-
const query = {
|
|
234
|
-
skillId: request.skillId
|
|
235
|
-
};
|
|
236
|
-
if (request.version) {
|
|
237
|
-
query.version = request.version;
|
|
238
|
-
}
|
|
239
|
-
const response = await this.gateway.request(
|
|
240
|
-
"skills.download",
|
|
241
|
-
{
|
|
242
|
-
method: "GET",
|
|
243
|
-
query
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
if (response.success && response.data) {
|
|
247
|
-
if (!validateSkillDownloadResponse(response.data)) {
|
|
248
|
-
throw CloudErrorFactory.schemaMismatch(
|
|
249
|
-
"Invalid skill download response format",
|
|
250
|
-
{ context: { request } }
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return response;
|
|
255
|
-
} catch (error) {
|
|
256
|
-
if (error instanceof CloudError) {
|
|
257
|
-
throw error;
|
|
258
|
-
}
|
|
259
|
-
throw CloudErrorFactory.unknown(error, {
|
|
260
|
-
context: { operation: "skills.download", request }
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
// ==========================================================================
|
|
265
|
-
// Update Skill
|
|
266
|
-
// ==========================================================================
|
|
267
|
-
/**
|
|
268
|
-
* Update skill in cloud
|
|
269
|
-
*
|
|
270
|
-
* @param request - Update request with skill ID and changes
|
|
271
|
-
* @returns Update response with updated skill
|
|
272
|
-
*
|
|
273
|
-
* @example
|
|
274
|
-
* ```typescript
|
|
275
|
-
* const response = await client.update({
|
|
276
|
-
* skillId: 'my-skill',
|
|
277
|
-
* version: '1.1.0',
|
|
278
|
-
* content: '# Updated content...'
|
|
279
|
-
* })
|
|
280
|
-
* ```
|
|
281
|
-
*/
|
|
282
|
-
async update(request) {
|
|
283
|
-
try {
|
|
284
|
-
if (!request.skillId || request.skillId.trim() === "") {
|
|
285
|
-
throw CloudErrorFactory.validation("Skill ID is required");
|
|
286
|
-
}
|
|
287
|
-
const response = await this.gateway.request(
|
|
288
|
-
"skills.upload",
|
|
289
|
-
{
|
|
290
|
-
method: "PUT",
|
|
291
|
-
body: request
|
|
292
|
-
}
|
|
293
|
-
);
|
|
294
|
-
return response;
|
|
295
|
-
} catch (error) {
|
|
296
|
-
if (error instanceof CloudError) {
|
|
297
|
-
throw error;
|
|
298
|
-
}
|
|
299
|
-
throw CloudErrorFactory.unknown(error, {
|
|
300
|
-
context: { operation: "skills.update", request }
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
// ==========================================================================
|
|
305
|
-
// Delete Skill
|
|
306
|
-
// ==========================================================================
|
|
307
|
-
/**
|
|
308
|
-
* Delete skill from cloud
|
|
309
|
-
*
|
|
310
|
-
* @param request - Delete request with skill ID
|
|
311
|
-
* @returns Delete response
|
|
312
|
-
*
|
|
313
|
-
* @example
|
|
314
|
-
* ```typescript
|
|
315
|
-
* const response = await client.delete({
|
|
316
|
-
* skillId: 'my-skill'
|
|
317
|
-
* })
|
|
318
|
-
* ```
|
|
319
|
-
*/
|
|
320
|
-
async delete(request) {
|
|
321
|
-
try {
|
|
322
|
-
if (!request.skillId || request.skillId.trim() === "") {
|
|
323
|
-
throw CloudErrorFactory.validation("Skill ID is required");
|
|
324
|
-
}
|
|
325
|
-
const response = await this.gateway.request(
|
|
326
|
-
"skills.upload",
|
|
327
|
-
{
|
|
328
|
-
method: "DELETE",
|
|
329
|
-
query: {
|
|
330
|
-
skillId: request.skillId
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
);
|
|
334
|
-
return response;
|
|
335
|
-
} catch (error) {
|
|
336
|
-
if (error instanceof CloudError) {
|
|
337
|
-
throw error;
|
|
338
|
-
}
|
|
339
|
-
throw CloudErrorFactory.unknown(error, {
|
|
340
|
-
context: { operation: "skills.delete", request }
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
// ==========================================================================
|
|
345
|
-
// Helper Methods
|
|
346
|
-
// ==========================================================================
|
|
347
|
-
/**
|
|
348
|
-
* Build query parameters for list request
|
|
349
|
-
*/
|
|
350
|
-
buildListQuery(request) {
|
|
351
|
-
const query = {};
|
|
352
|
-
if (request.privacy)
|
|
353
|
-
query.privacy = request.privacy;
|
|
354
|
-
if (request.author)
|
|
355
|
-
query.author = request.author;
|
|
356
|
-
if (request.tags && request.tags.length > 0)
|
|
357
|
-
query.tags = request.tags.join(",");
|
|
358
|
-
if (request.query)
|
|
359
|
-
query.query = request.query;
|
|
360
|
-
if (request.page)
|
|
361
|
-
query.page = request.page;
|
|
362
|
-
if (request.pageSize)
|
|
363
|
-
query.pageSize = request.pageSize;
|
|
364
|
-
if (request.sortBy)
|
|
365
|
-
query.sortBy = request.sortBy;
|
|
366
|
-
if (request.sortDir)
|
|
367
|
-
query.sortDir = request.sortDir;
|
|
368
|
-
return query;
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Validate upload request
|
|
372
|
-
*/
|
|
373
|
-
validateUploadRequest(request) {
|
|
374
|
-
const errors = [];
|
|
375
|
-
if (!request.name || request.name.trim() === "")
|
|
376
|
-
errors.push("Skill name is required");
|
|
377
|
-
if (!request.version || request.version.trim() === "")
|
|
378
|
-
errors.push("Skill version is required");
|
|
379
|
-
if (!request.content || request.content.trim() === "")
|
|
380
|
-
errors.push("Skill content is required");
|
|
381
|
-
if (!request.metadata)
|
|
382
|
-
errors.push("Skill metadata is required");
|
|
383
|
-
else if (!request.metadata.author || request.metadata.author.trim() === "")
|
|
384
|
-
errors.push("Skill author is required");
|
|
385
|
-
if (!request.privacy)
|
|
386
|
-
errors.push("Skill privacy level is required");
|
|
387
|
-
if (!request.checksum || request.checksum.trim() === "")
|
|
388
|
-
errors.push("Skill checksum is required");
|
|
389
|
-
if (errors.length > 0) {
|
|
390
|
-
throw CloudErrorFactory.validation(
|
|
391
|
-
`Invalid upload request: ${errors.join(", ")}`
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
function createSkillsClient(gateway) {
|
|
397
|
-
return new SkillsApiClient(gateway);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
function parseSkillMd(content, filePath = "unknown") {
|
|
401
|
-
try {
|
|
402
|
-
const parsed = matter(content);
|
|
403
|
-
const metadata = extractMetadata(parsed.data, filePath);
|
|
404
|
-
return {
|
|
405
|
-
metadata,
|
|
406
|
-
content: parsed.content.trim(),
|
|
407
|
-
filePath
|
|
408
|
-
};
|
|
409
|
-
} catch (error) {
|
|
410
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
411
|
-
throw new Error(`Failed to parse SKILL.md at ${filePath}: ${errorMessage}`);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
async function parseSkillMdFile(filePath) {
|
|
415
|
-
try {
|
|
416
|
-
const content = await readFile(filePath, "utf-8");
|
|
417
|
-
const skill = parseSkillMd(content, filePath);
|
|
418
|
-
try {
|
|
419
|
-
const stats = await stat(filePath);
|
|
420
|
-
skill.modifiedAt = stats.mtime;
|
|
421
|
-
} catch {
|
|
422
|
-
}
|
|
423
|
-
return skill;
|
|
424
|
-
} catch (error) {
|
|
425
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
426
|
-
throw new Error(`Failed to read SKILL.md file at ${filePath}: ${errorMessage}`);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
function extractMetadata(data, filePath) {
|
|
430
|
-
if (!data.name || typeof data.name !== "string") {
|
|
431
|
-
throw new Error(`Missing or invalid 'name' field in ${filePath}`);
|
|
432
|
-
}
|
|
433
|
-
if (!data.description || typeof data.description !== "string") {
|
|
434
|
-
throw new Error(`Missing or invalid 'description' field in ${filePath}`);
|
|
435
|
-
}
|
|
436
|
-
if (!data.version || typeof data.version !== "string") {
|
|
437
|
-
throw new Error(`Missing or invalid 'version' field in ${filePath}`);
|
|
438
|
-
}
|
|
439
|
-
if (!data.category || typeof data.category !== "string") {
|
|
440
|
-
throw new Error(`Missing or invalid 'category' field in ${filePath}`);
|
|
441
|
-
}
|
|
442
|
-
if (!Array.isArray(data.triggers) || data.triggers.length === 0) {
|
|
443
|
-
throw new Error(`Missing or invalid 'triggers' field in ${filePath}`);
|
|
444
|
-
}
|
|
445
|
-
if (!Array.isArray(data.use_when) || data.use_when.length === 0) {
|
|
446
|
-
throw new Error(`Missing or invalid 'use_when' field in ${filePath}`);
|
|
447
|
-
}
|
|
448
|
-
const metadata = {
|
|
449
|
-
name: data.name,
|
|
450
|
-
description: data.description,
|
|
451
|
-
version: data.version,
|
|
452
|
-
category: data.category,
|
|
453
|
-
triggers: data.triggers,
|
|
454
|
-
use_when: data.use_when
|
|
455
|
-
};
|
|
456
|
-
if (data.author && typeof data.author === "string") {
|
|
457
|
-
metadata.author = data.author;
|
|
458
|
-
}
|
|
459
|
-
if (typeof data.auto_activate === "boolean") {
|
|
460
|
-
metadata.auto_activate = data.auto_activate;
|
|
461
|
-
}
|
|
462
|
-
if (typeof data.priority === "number") {
|
|
463
|
-
metadata.priority = data.priority;
|
|
464
|
-
}
|
|
465
|
-
if (Array.isArray(data.agents)) {
|
|
466
|
-
metadata.agents = data.agents;
|
|
467
|
-
}
|
|
468
|
-
if (data.difficulty && typeof data.difficulty === "string") {
|
|
469
|
-
metadata.difficulty = data.difficulty;
|
|
470
|
-
}
|
|
471
|
-
if (Array.isArray(data.related_skills)) {
|
|
472
|
-
metadata.related_skills = data.related_skills;
|
|
473
|
-
}
|
|
474
|
-
if (data.ccjk_version && typeof data.ccjk_version === "string") {
|
|
475
|
-
metadata.ccjk_version = data.ccjk_version;
|
|
476
|
-
}
|
|
477
|
-
if (Array.isArray(data.tags)) {
|
|
478
|
-
metadata.tags = data.tags;
|
|
479
|
-
}
|
|
480
|
-
if (Array.isArray(data.allowed_tools)) {
|
|
481
|
-
metadata.allowed_tools = data.allowed_tools;
|
|
482
|
-
}
|
|
483
|
-
if (data.context && typeof data.context === "string") {
|
|
484
|
-
metadata.context = data.context;
|
|
485
|
-
}
|
|
486
|
-
if (data.agent && typeof data.agent === "string") {
|
|
487
|
-
metadata.agent = data.agent;
|
|
488
|
-
}
|
|
489
|
-
if (typeof data.user_invocable === "boolean") {
|
|
490
|
-
metadata.user_invocable = data.user_invocable;
|
|
491
|
-
}
|
|
492
|
-
if (Array.isArray(data.hooks)) {
|
|
493
|
-
metadata.hooks = data.hooks;
|
|
494
|
-
}
|
|
495
|
-
if (Array.isArray(data.permissions)) {
|
|
496
|
-
metadata.permissions = data.permissions;
|
|
497
|
-
}
|
|
498
|
-
if (typeof data.timeout === "number") {
|
|
499
|
-
metadata.timeout = data.timeout;
|
|
500
|
-
}
|
|
501
|
-
if (Array.isArray(data.outputs)) {
|
|
502
|
-
metadata.outputs = data.outputs;
|
|
503
|
-
}
|
|
504
|
-
return metadata;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
process__default.env.CCJK_CLOUD_API_URL || `${CLOUD_ENDPOINTS.MAIN.BASE_URL}${CLOUD_ENDPOINTS.MAIN.API_VERSION}`;
|
|
508
|
-
const SYNC_STATE_FILE = join(CCJK_CONFIG_DIR, "skills-sync-state.json");
|
|
509
|
-
const DEFAULT_TIMEOUT = 3e4;
|
|
510
|
-
function loadSyncState() {
|
|
511
|
-
if (!existsSync(SYNC_STATE_FILE)) {
|
|
512
|
-
return {
|
|
513
|
-
version: "1.0.0",
|
|
514
|
-
lastGlobalSync: (/* @__PURE__ */ new Date()).toISOString(),
|
|
515
|
-
skills: {}
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
try {
|
|
519
|
-
const content = readFileSync(SYNC_STATE_FILE, "utf-8");
|
|
520
|
-
return JSON.parse(content);
|
|
521
|
-
} catch (error) {
|
|
522
|
-
console.warn("Failed to load sync state, using empty state:", error);
|
|
523
|
-
return {
|
|
524
|
-
version: "1.0.0",
|
|
525
|
-
lastGlobalSync: (/* @__PURE__ */ new Date()).toISOString(),
|
|
526
|
-
skills: {}
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
function saveSyncState(state) {
|
|
531
|
-
try {
|
|
532
|
-
if (!existsSync(CCJK_CONFIG_DIR)) {
|
|
533
|
-
mkdirSync(CCJK_CONFIG_DIR, { recursive: true });
|
|
534
|
-
}
|
|
535
|
-
writeFileAtomic(SYNC_STATE_FILE, JSON.stringify(state, null, 2), "utf-8");
|
|
536
|
-
} catch (error) {
|
|
537
|
-
console.error("Failed to save sync state:", error);
|
|
538
|
-
throw new Error(`Failed to save sync state: ${error}`);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
function updateSyncState(skillId, localVersion, remoteVersion, localChecksum, remoteChecksum) {
|
|
542
|
-
const state = loadSyncState();
|
|
543
|
-
let status = "synced";
|
|
544
|
-
if (localChecksum === remoteChecksum) {
|
|
545
|
-
status = "synced";
|
|
546
|
-
} else if (!remoteChecksum) {
|
|
547
|
-
status = "local_only";
|
|
548
|
-
} else if (!localChecksum) {
|
|
549
|
-
status = "remote_only";
|
|
550
|
-
} else if (localVersion > remoteVersion) {
|
|
551
|
-
status = "local_ahead";
|
|
552
|
-
} else if (remoteVersion > localVersion) {
|
|
553
|
-
status = "remote_ahead";
|
|
554
|
-
} else {
|
|
555
|
-
status = "conflict";
|
|
556
|
-
}
|
|
557
|
-
state.skills[skillId] = {
|
|
558
|
-
skillId,
|
|
559
|
-
lastSyncTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
560
|
-
localVersion,
|
|
561
|
-
remoteVersion,
|
|
562
|
-
localChecksum,
|
|
563
|
-
remoteChecksum,
|
|
564
|
-
status
|
|
565
|
-
};
|
|
566
|
-
state.lastGlobalSync = (/* @__PURE__ */ new Date()).toISOString();
|
|
567
|
-
saveSyncState(state);
|
|
568
|
-
}
|
|
569
|
-
function calculateChecksum(content) {
|
|
570
|
-
return createHash("sha256").update(content).digest("hex");
|
|
571
|
-
}
|
|
572
|
-
async function getLocalSkills() {
|
|
573
|
-
if (!existsSync(CCJK_SKILLS_DIR)) {
|
|
574
|
-
return [];
|
|
575
|
-
}
|
|
576
|
-
const skills = [];
|
|
577
|
-
const files = readdirSync(CCJK_SKILLS_DIR);
|
|
578
|
-
for (const file of files) {
|
|
579
|
-
if (file.endsWith(".md")) {
|
|
580
|
-
const filePath = join(CCJK_SKILLS_DIR, file);
|
|
581
|
-
try {
|
|
582
|
-
const skill = await parseSkillMdFile(filePath);
|
|
583
|
-
skills.push(skill);
|
|
584
|
-
} catch (error) {
|
|
585
|
-
console.warn(`Failed to parse skill file ${file}:`, error);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
return skills;
|
|
590
|
-
}
|
|
591
|
-
async function getLocalSkill(skillId) {
|
|
592
|
-
const filePath = join(CCJK_SKILLS_DIR, `${skillId}.md`);
|
|
593
|
-
if (!existsSync(filePath)) {
|
|
594
|
-
return null;
|
|
595
|
-
}
|
|
596
|
-
try {
|
|
597
|
-
return await parseSkillMdFile(filePath);
|
|
598
|
-
} catch (error) {
|
|
599
|
-
console.error(`Failed to parse skill ${skillId}:`, error);
|
|
600
|
-
return null;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
function saveLocalSkill(skillId, content) {
|
|
604
|
-
if (!existsSync(CCJK_SKILLS_DIR)) {
|
|
605
|
-
mkdirSync(CCJK_SKILLS_DIR, { recursive: true });
|
|
606
|
-
}
|
|
607
|
-
const filePath = join(CCJK_SKILLS_DIR, `${skillId}.md`);
|
|
608
|
-
writeFileAtomic(filePath, content, "utf-8");
|
|
609
|
-
}
|
|
610
|
-
function getAuthToken() {
|
|
611
|
-
const tokenFile = join(CCJK_CONFIG_DIR, "cloud-token.json");
|
|
612
|
-
if (!existsSync(tokenFile)) {
|
|
613
|
-
return null;
|
|
614
|
-
}
|
|
615
|
-
try {
|
|
616
|
-
const content = readFileSync(tokenFile, "utf-8");
|
|
617
|
-
const data = JSON.parse(content);
|
|
618
|
-
return data.deviceToken || null;
|
|
619
|
-
} catch {
|
|
620
|
-
return null;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
let skillsClient = null;
|
|
624
|
-
function getSkillsClient() {
|
|
625
|
-
if (!skillsClient) {
|
|
626
|
-
const token = getAuthToken();
|
|
627
|
-
if (!token) {
|
|
628
|
-
throw new Error("Not authenticated. Please bind device first using: npx ccjk notification bind");
|
|
629
|
-
}
|
|
630
|
-
const gateway = createGateway({
|
|
631
|
-
authToken: token,
|
|
632
|
-
timeout: DEFAULT_TIMEOUT
|
|
633
|
-
});
|
|
634
|
-
skillsClient = createSkillsClient(gateway);
|
|
635
|
-
}
|
|
636
|
-
return skillsClient;
|
|
637
|
-
}
|
|
638
|
-
async function listCloudSkills(options = {}) {
|
|
639
|
-
try {
|
|
640
|
-
const client = getSkillsClient();
|
|
641
|
-
const response = await client.list({
|
|
642
|
-
privacy: options.privacy,
|
|
643
|
-
author: options.author,
|
|
644
|
-
tags: options.tags,
|
|
645
|
-
query: options.query,
|
|
646
|
-
page: options.page,
|
|
647
|
-
pageSize: options.pageSize,
|
|
648
|
-
sortBy: options.sortBy,
|
|
649
|
-
sortDir: options.sortDir
|
|
650
|
-
});
|
|
651
|
-
if (!response.success || !response.data) {
|
|
652
|
-
return {
|
|
653
|
-
success: false,
|
|
654
|
-
error: response.error || "Failed to list skills",
|
|
655
|
-
code: response.code,
|
|
656
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
const skills = response.data.skills.map((skill) => ({
|
|
660
|
-
id: skill.id,
|
|
661
|
-
name: skill.name,
|
|
662
|
-
version: skill.version,
|
|
663
|
-
content: skill.content,
|
|
664
|
-
metadata: skill.metadata,
|
|
665
|
-
privacy: skill.privacy,
|
|
666
|
-
checksum: skill.checksum,
|
|
667
|
-
createdAt: skill.createdAt,
|
|
668
|
-
updatedAt: skill.updatedAt
|
|
669
|
-
}));
|
|
670
|
-
return {
|
|
671
|
-
success: true,
|
|
672
|
-
data: {
|
|
673
|
-
skills,
|
|
674
|
-
total: response.data.total,
|
|
675
|
-
page: response.data.page,
|
|
676
|
-
pageSize: response.data.pageSize,
|
|
677
|
-
totalPages: response.data.totalPages
|
|
678
|
-
},
|
|
679
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
680
|
-
};
|
|
681
|
-
} catch (error) {
|
|
682
|
-
return {
|
|
683
|
-
success: false,
|
|
684
|
-
error: error instanceof Error ? error.message : String(error),
|
|
685
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
async function getCloudSkill(skillId, version) {
|
|
690
|
-
try {
|
|
691
|
-
const client = getSkillsClient();
|
|
692
|
-
const response = await client.get({
|
|
693
|
-
skillId,
|
|
694
|
-
version
|
|
695
|
-
});
|
|
696
|
-
if (!response.success || !response.data) {
|
|
697
|
-
return {
|
|
698
|
-
success: false,
|
|
699
|
-
error: response.error || "Failed to get skill",
|
|
700
|
-
code: response.code,
|
|
701
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
702
|
-
};
|
|
703
|
-
}
|
|
704
|
-
const skill = response.data.skill;
|
|
705
|
-
return {
|
|
706
|
-
success: true,
|
|
707
|
-
data: {
|
|
708
|
-
id: skill.id,
|
|
709
|
-
name: skill.name,
|
|
710
|
-
version: skill.version,
|
|
711
|
-
content: skill.content,
|
|
712
|
-
checksum: skill.checksum,
|
|
713
|
-
privacy: skill.privacy,
|
|
714
|
-
metadata: skill.metadata,
|
|
715
|
-
createdAt: skill.createdAt,
|
|
716
|
-
updatedAt: skill.updatedAt
|
|
717
|
-
},
|
|
718
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
719
|
-
};
|
|
720
|
-
} catch (error) {
|
|
721
|
-
return {
|
|
722
|
-
success: false,
|
|
723
|
-
error: error instanceof Error ? error.message : String(error),
|
|
724
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
async function uploadSkill(request) {
|
|
729
|
-
try {
|
|
730
|
-
const client = getSkillsClient();
|
|
731
|
-
const response = await client.upload({
|
|
732
|
-
name: request.name,
|
|
733
|
-
version: request.version,
|
|
734
|
-
content: request.content,
|
|
735
|
-
metadata: request.metadata,
|
|
736
|
-
privacy: request.privacy,
|
|
737
|
-
checksum: request.checksum
|
|
738
|
-
});
|
|
739
|
-
if (!response.success || !response.data) {
|
|
740
|
-
return {
|
|
741
|
-
success: false,
|
|
742
|
-
error: response.error || "Failed to upload skill",
|
|
743
|
-
code: response.code,
|
|
744
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
|
-
const skill = response.data.skill;
|
|
748
|
-
return {
|
|
749
|
-
success: true,
|
|
750
|
-
data: {
|
|
751
|
-
id: skill.id,
|
|
752
|
-
name: skill.name,
|
|
753
|
-
version: skill.version,
|
|
754
|
-
content: skill.content,
|
|
755
|
-
checksum: skill.checksum,
|
|
756
|
-
privacy: skill.privacy,
|
|
757
|
-
metadata: skill.metadata,
|
|
758
|
-
createdAt: skill.createdAt,
|
|
759
|
-
updatedAt: skill.updatedAt
|
|
760
|
-
},
|
|
761
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
762
|
-
};
|
|
763
|
-
} catch (error) {
|
|
764
|
-
return {
|
|
765
|
-
success: false,
|
|
766
|
-
error: error instanceof Error ? error.message : String(error),
|
|
767
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
768
|
-
};
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
async function updateCloudSkill(skillId, request) {
|
|
772
|
-
try {
|
|
773
|
-
const client = getSkillsClient();
|
|
774
|
-
const response = await client.update({
|
|
775
|
-
skillId,
|
|
776
|
-
version: request.version,
|
|
777
|
-
content: request.content,
|
|
778
|
-
metadata: request.metadata,
|
|
779
|
-
privacy: request.privacy,
|
|
780
|
-
checksum: request.checksum
|
|
781
|
-
});
|
|
782
|
-
if (!response.success || !response.data) {
|
|
783
|
-
return {
|
|
784
|
-
success: false,
|
|
785
|
-
error: response.error || "Failed to update skill",
|
|
786
|
-
code: response.code,
|
|
787
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
const skill = response.data.skill;
|
|
791
|
-
return {
|
|
792
|
-
success: true,
|
|
793
|
-
data: {
|
|
794
|
-
id: skill.id,
|
|
795
|
-
name: skill.name,
|
|
796
|
-
version: skill.version,
|
|
797
|
-
content: skill.content,
|
|
798
|
-
checksum: skill.checksum,
|
|
799
|
-
privacy: skill.privacy,
|
|
800
|
-
metadata: skill.metadata,
|
|
801
|
-
createdAt: skill.createdAt,
|
|
802
|
-
updatedAt: skill.updatedAt
|
|
803
|
-
},
|
|
804
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
805
|
-
};
|
|
806
|
-
} catch (error) {
|
|
807
|
-
return {
|
|
808
|
-
success: false,
|
|
809
|
-
error: error instanceof Error ? error.message : String(error),
|
|
810
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
async function syncSkill(skillId, options = {}) {
|
|
815
|
-
try {
|
|
816
|
-
const localSkill = await getLocalSkill(skillId);
|
|
817
|
-
const localContent = localSkill ? readFileSync(join(CCJK_SKILLS_DIR, `${skillId}.md`), "utf-8") : "";
|
|
818
|
-
const localChecksum = localContent ? calculateChecksum(localContent) : "";
|
|
819
|
-
const localVersion = localSkill?.metadata.version || "";
|
|
820
|
-
const cloudResponse = await getCloudSkill(skillId);
|
|
821
|
-
const cloudSkill = cloudResponse.success ? cloudResponse.data : null;
|
|
822
|
-
const remoteChecksum = cloudSkill?.checksum || "";
|
|
823
|
-
const remoteVersion = cloudSkill?.version || "";
|
|
824
|
-
const syncState = loadSyncState();
|
|
825
|
-
const previousState = syncState.skills[skillId];
|
|
826
|
-
let action = "skipped";
|
|
827
|
-
let newState;
|
|
828
|
-
if (localSkill && cloudSkill) {
|
|
829
|
-
if (localChecksum === remoteChecksum) {
|
|
830
|
-
action = "skipped";
|
|
831
|
-
} else if (options.force) {
|
|
832
|
-
if (!options.dryRun) {
|
|
833
|
-
const uploadRequest = {
|
|
834
|
-
name: localSkill.metadata.name,
|
|
835
|
-
version: localSkill.metadata.version,
|
|
836
|
-
content: localContent,
|
|
837
|
-
metadata: {
|
|
838
|
-
author: localSkill.metadata.author || "unknown",
|
|
839
|
-
description: localSkill.metadata.description,
|
|
840
|
-
tags: localSkill.metadata.tags || [],
|
|
841
|
-
category: localSkill.metadata.category
|
|
842
|
-
},
|
|
843
|
-
privacy: "private",
|
|
844
|
-
checksum: localChecksum
|
|
845
|
-
};
|
|
846
|
-
await updateCloudSkill(skillId, uploadRequest);
|
|
847
|
-
}
|
|
848
|
-
action = "uploaded";
|
|
849
|
-
} else {
|
|
850
|
-
const resolution = options.conflictResolution || "prompt";
|
|
851
|
-
if (resolution === "local") {
|
|
852
|
-
if (!options.dryRun) {
|
|
853
|
-
const uploadRequest = {
|
|
854
|
-
name: localSkill.metadata.name,
|
|
855
|
-
version: localSkill.metadata.version,
|
|
856
|
-
content: localContent,
|
|
857
|
-
metadata: {
|
|
858
|
-
author: localSkill.metadata.author || "unknown",
|
|
859
|
-
description: localSkill.metadata.description,
|
|
860
|
-
tags: localSkill.metadata.tags || [],
|
|
861
|
-
category: localSkill.metadata.category
|
|
862
|
-
},
|
|
863
|
-
privacy: "private",
|
|
864
|
-
checksum: localChecksum
|
|
865
|
-
};
|
|
866
|
-
await updateCloudSkill(skillId, uploadRequest);
|
|
867
|
-
}
|
|
868
|
-
action = "uploaded";
|
|
869
|
-
} else if (resolution === "remote") {
|
|
870
|
-
if (!options.dryRun) {
|
|
871
|
-
saveLocalSkill(skillId, cloudSkill.content);
|
|
872
|
-
}
|
|
873
|
-
action = "downloaded";
|
|
874
|
-
} else if (resolution === "newer") {
|
|
875
|
-
const localTime = localSkill.modifiedAt?.getTime() || 0;
|
|
876
|
-
const remoteTime = new Date(cloudSkill.updatedAt).getTime();
|
|
877
|
-
if (localTime > remoteTime) {
|
|
878
|
-
if (!options.dryRun) {
|
|
879
|
-
const uploadRequest = {
|
|
880
|
-
name: localSkill.metadata.name,
|
|
881
|
-
version: localSkill.metadata.version,
|
|
882
|
-
content: localContent,
|
|
883
|
-
metadata: {
|
|
884
|
-
author: localSkill.metadata.author || "unknown",
|
|
885
|
-
description: localSkill.metadata.description,
|
|
886
|
-
tags: localSkill.metadata.tags || [],
|
|
887
|
-
category: localSkill.metadata.category
|
|
888
|
-
},
|
|
889
|
-
privacy: "private",
|
|
890
|
-
checksum: localChecksum
|
|
891
|
-
};
|
|
892
|
-
await updateCloudSkill(skillId, uploadRequest);
|
|
893
|
-
}
|
|
894
|
-
action = "uploaded";
|
|
895
|
-
} else {
|
|
896
|
-
if (!options.dryRun) {
|
|
897
|
-
saveLocalSkill(skillId, cloudSkill.content);
|
|
898
|
-
}
|
|
899
|
-
action = "downloaded";
|
|
900
|
-
}
|
|
901
|
-
} else {
|
|
902
|
-
action = "conflict";
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
} else if (localSkill && !cloudSkill) {
|
|
906
|
-
if (!options.dryRun) {
|
|
907
|
-
const uploadRequest = {
|
|
908
|
-
name: localSkill.metadata.name,
|
|
909
|
-
version: localSkill.metadata.version,
|
|
910
|
-
content: localContent,
|
|
911
|
-
metadata: {
|
|
912
|
-
author: localSkill.metadata.author || "unknown",
|
|
913
|
-
description: localSkill.metadata.description,
|
|
914
|
-
tags: localSkill.metadata.tags || [],
|
|
915
|
-
category: localSkill.metadata.category
|
|
916
|
-
},
|
|
917
|
-
privacy: "private",
|
|
918
|
-
checksum: localChecksum
|
|
919
|
-
};
|
|
920
|
-
await uploadSkill(uploadRequest);
|
|
921
|
-
}
|
|
922
|
-
action = "uploaded";
|
|
923
|
-
} else if (!localSkill && cloudSkill) {
|
|
924
|
-
if (!options.dryRun) {
|
|
925
|
-
saveLocalSkill(skillId, cloudSkill.content);
|
|
926
|
-
}
|
|
927
|
-
action = "downloaded";
|
|
928
|
-
}
|
|
929
|
-
if (!options.dryRun && action !== "conflict") {
|
|
930
|
-
updateSyncState(skillId, localVersion, remoteVersion, localChecksum, remoteChecksum);
|
|
931
|
-
newState = loadSyncState().skills[skillId];
|
|
932
|
-
}
|
|
933
|
-
return {
|
|
934
|
-
skillId,
|
|
935
|
-
skillName: localSkill?.metadata.name || cloudSkill?.name || skillId,
|
|
936
|
-
success: true,
|
|
937
|
-
action,
|
|
938
|
-
previousState,
|
|
939
|
-
newState
|
|
940
|
-
};
|
|
941
|
-
} catch (error) {
|
|
942
|
-
return {
|
|
943
|
-
skillId,
|
|
944
|
-
skillName: skillId,
|
|
945
|
-
success: false,
|
|
946
|
-
action: "skipped",
|
|
947
|
-
error: error instanceof Error ? error.message : String(error)
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
async function syncAllSkills(options = {}) {
|
|
952
|
-
const startTime = Date.now();
|
|
953
|
-
try {
|
|
954
|
-
const localSkills = await getLocalSkills();
|
|
955
|
-
const localSkillIds = new Set(localSkills.map((s) => s.metadata.name));
|
|
956
|
-
const cloudResponse = await listCloudSkills({ privacy: options.privacy });
|
|
957
|
-
if (!cloudResponse.success) {
|
|
958
|
-
throw new Error(cloudResponse.error || "Failed to list cloud skills");
|
|
959
|
-
}
|
|
960
|
-
const cloudSkills = cloudResponse.data?.skills || [];
|
|
961
|
-
const cloudSkillIds = new Set(cloudSkills.map((s) => s.id));
|
|
962
|
-
const allSkillIds = /* @__PURE__ */ new Set([...localSkillIds, ...cloudSkillIds]);
|
|
963
|
-
let skillIdsToSync = Array.from(allSkillIds);
|
|
964
|
-
if (options.skillIds && options.skillIds.length > 0) {
|
|
965
|
-
skillIdsToSync = skillIdsToSync.filter((id) => options.skillIds.includes(id));
|
|
966
|
-
}
|
|
967
|
-
const results = [];
|
|
968
|
-
for (const skillId of skillIdsToSync) {
|
|
969
|
-
const result = await syncSkill(skillId, options);
|
|
970
|
-
results.push(result);
|
|
971
|
-
}
|
|
972
|
-
const succeeded = results.filter((r) => r.success).length;
|
|
973
|
-
const failed = results.filter((r) => !r.success).length;
|
|
974
|
-
const conflicts = results.filter((r) => r.action === "conflict").length;
|
|
975
|
-
const uploaded = results.filter((r) => r.action === "uploaded").length;
|
|
976
|
-
const downloaded = results.filter((r) => r.action === "downloaded").length;
|
|
977
|
-
const skipped = results.filter((r) => r.action === "skipped").length;
|
|
978
|
-
return {
|
|
979
|
-
success: failed === 0,
|
|
980
|
-
total: results.length,
|
|
981
|
-
succeeded,
|
|
982
|
-
failed,
|
|
983
|
-
conflicts,
|
|
984
|
-
uploaded,
|
|
985
|
-
downloaded,
|
|
986
|
-
skipped,
|
|
987
|
-
results,
|
|
988
|
-
durationMs: Date.now() - startTime
|
|
989
|
-
};
|
|
990
|
-
} catch (error) {
|
|
991
|
-
return {
|
|
992
|
-
success: false,
|
|
993
|
-
total: 0,
|
|
994
|
-
succeeded: 0,
|
|
995
|
-
failed: 0,
|
|
996
|
-
conflicts: 0,
|
|
997
|
-
uploaded: 0,
|
|
998
|
-
downloaded: 0,
|
|
999
|
-
skipped: 0,
|
|
1000
|
-
results: [],
|
|
1001
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1002
|
-
durationMs: Date.now() - startTime
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
async function pushSkills(skillIds, options = {}) {
|
|
1007
|
-
return syncAllSkills({
|
|
1008
|
-
...options,
|
|
1009
|
-
skillIds,
|
|
1010
|
-
conflictResolution: options.conflictResolution || "local"
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
async function pullSkills(skillIds, options = {}) {
|
|
1014
|
-
return syncAllSkills({
|
|
1015
|
-
...options,
|
|
1016
|
-
skillIds,
|
|
1017
|
-
conflictResolution: options.conflictResolution || "remote"
|
|
1018
|
-
});
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
async function syncSkills(options = {}) {
|
|
1022
|
-
const t = getTranslation(options.lang);
|
|
1023
|
-
console.log("");
|
|
1024
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1025
|
-
console.log(a.bold.cyan(` ${t("skillsSync:title.sync")}`));
|
|
1026
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1027
|
-
console.log("");
|
|
1028
|
-
try {
|
|
1029
|
-
await showSyncStatus(options);
|
|
1030
|
-
const { confirm } = await inquirer.prompt({
|
|
1031
|
-
type: "confirm",
|
|
1032
|
-
name: "confirm",
|
|
1033
|
-
message: t("skillsSync:prompt.confirmSync"),
|
|
1034
|
-
default: true
|
|
1035
|
-
});
|
|
1036
|
-
if (!confirm) {
|
|
1037
|
-
console.log(a.yellow(`
|
|
1038
|
-
${t("skillsSync:message.cancelled")}`));
|
|
1039
|
-
return;
|
|
1040
|
-
}
|
|
1041
|
-
console.log(a.dim(`
|
|
1042
|
-
${t("skillsSync:message.syncing")}...
|
|
1043
|
-
`));
|
|
1044
|
-
const syncOptions = {
|
|
1045
|
-
conflictResolution: options.conflictResolution || "prompt",
|
|
1046
|
-
dryRun: options.dryRun,
|
|
1047
|
-
force: options.force,
|
|
1048
|
-
skillIds: options.skillIds,
|
|
1049
|
-
privacy: options.privacy
|
|
1050
|
-
};
|
|
1051
|
-
const result = await syncAllSkills(syncOptions);
|
|
1052
|
-
displaySyncResult(result, options.lang);
|
|
1053
|
-
} catch (error) {
|
|
1054
|
-
console.error(a.red(`
|
|
1055
|
-
${t("skillsSync:error.syncFailed")}: ${error}`));
|
|
1056
|
-
throw error;
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
async function pushSkillsCommand(options = {}) {
|
|
1060
|
-
const t = getTranslation(options.lang);
|
|
1061
|
-
console.log("");
|
|
1062
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1063
|
-
console.log(a.bold.cyan(` ${t("skillsSync:title.push")}`));
|
|
1064
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1065
|
-
console.log("");
|
|
1066
|
-
try {
|
|
1067
|
-
const localSkills = await getLocalSkills();
|
|
1068
|
-
console.log(a.dim(` ${t("skillsSync:message.foundLocalSkills", { count: localSkills.length })}`));
|
|
1069
|
-
if (localSkills.length === 0) {
|
|
1070
|
-
console.log(a.yellow(`
|
|
1071
|
-
${t("skillsSync:message.noLocalSkills")}`));
|
|
1072
|
-
return;
|
|
1073
|
-
}
|
|
1074
|
-
const { confirm } = await inquirer.prompt({
|
|
1075
|
-
type: "confirm",
|
|
1076
|
-
name: "confirm",
|
|
1077
|
-
message: t("skillsSync:prompt.confirmPush"),
|
|
1078
|
-
default: true
|
|
1079
|
-
});
|
|
1080
|
-
if (!confirm) {
|
|
1081
|
-
console.log(a.yellow(`
|
|
1082
|
-
${t("skillsSync:message.cancelled")}`));
|
|
1083
|
-
return;
|
|
1084
|
-
}
|
|
1085
|
-
console.log(a.dim(`
|
|
1086
|
-
${t("skillsSync:message.pushing")}...
|
|
1087
|
-
`));
|
|
1088
|
-
const syncOptions = {
|
|
1089
|
-
conflictResolution: "local",
|
|
1090
|
-
dryRun: options.dryRun,
|
|
1091
|
-
force: options.force,
|
|
1092
|
-
skillIds: options.skillIds,
|
|
1093
|
-
privacy: options.privacy
|
|
1094
|
-
};
|
|
1095
|
-
const result = await pushSkills(options.skillIds, syncOptions);
|
|
1096
|
-
displaySyncResult(result, options.lang);
|
|
1097
|
-
} catch (error) {
|
|
1098
|
-
console.error(a.red(`
|
|
1099
|
-
${t("skillsSync:error.pushFailed")}: ${error}`));
|
|
1100
|
-
throw error;
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
async function pullSkillsCommand(options = {}) {
|
|
1104
|
-
const t = getTranslation(options.lang);
|
|
1105
|
-
console.log("");
|
|
1106
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1107
|
-
console.log(a.bold.cyan(` ${t("skillsSync:title.pull")}`));
|
|
1108
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1109
|
-
console.log("");
|
|
1110
|
-
try {
|
|
1111
|
-
const cloudResponse = await listCloudSkills({ privacy: options.privacy });
|
|
1112
|
-
if (!cloudResponse.success) {
|
|
1113
|
-
throw new Error(cloudResponse.error || "Failed to list cloud skills");
|
|
1114
|
-
}
|
|
1115
|
-
const cloudSkills = cloudResponse.data?.skills || [];
|
|
1116
|
-
console.log(a.dim(` ${t("skillsSync:message.foundCloudSkills", { count: cloudSkills.length })}`));
|
|
1117
|
-
if (cloudSkills.length === 0) {
|
|
1118
|
-
console.log(a.yellow(`
|
|
1119
|
-
${t("skillsSync:message.noCloudSkills")}`));
|
|
1120
|
-
return;
|
|
1121
|
-
}
|
|
1122
|
-
const { confirm } = await inquirer.prompt({
|
|
1123
|
-
type: "confirm",
|
|
1124
|
-
name: "confirm",
|
|
1125
|
-
message: t("skillsSync:prompt.confirmPull"),
|
|
1126
|
-
default: true
|
|
1127
|
-
});
|
|
1128
|
-
if (!confirm) {
|
|
1129
|
-
console.log(a.yellow(`
|
|
1130
|
-
${t("skillsSync:message.cancelled")}`));
|
|
1131
|
-
return;
|
|
1132
|
-
}
|
|
1133
|
-
console.log(a.dim(`
|
|
1134
|
-
${t("skillsSync:message.pulling")}...
|
|
1135
|
-
`));
|
|
1136
|
-
const syncOptions = {
|
|
1137
|
-
conflictResolution: "remote",
|
|
1138
|
-
dryRun: options.dryRun,
|
|
1139
|
-
force: options.force,
|
|
1140
|
-
skillIds: options.skillIds,
|
|
1141
|
-
privacy: options.privacy
|
|
1142
|
-
};
|
|
1143
|
-
const result = await pullSkills(options.skillIds, syncOptions);
|
|
1144
|
-
displaySyncResult(result, options.lang);
|
|
1145
|
-
} catch (error) {
|
|
1146
|
-
console.error(a.red(`
|
|
1147
|
-
${t("skillsSync:error.pullFailed")}: ${error}`));
|
|
1148
|
-
throw error;
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
async function listCloudSkillsCommand(options = {}) {
|
|
1152
|
-
const t = getTranslation(options.lang);
|
|
1153
|
-
console.log("");
|
|
1154
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1155
|
-
console.log(a.bold.cyan(` ${t("skillsSync:title.list")}`));
|
|
1156
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1157
|
-
console.log("");
|
|
1158
|
-
try {
|
|
1159
|
-
const response = await listCloudSkills({ privacy: options.privacy });
|
|
1160
|
-
if (!response.success) {
|
|
1161
|
-
throw new Error(response.error || "Failed to list cloud skills");
|
|
1162
|
-
}
|
|
1163
|
-
const skills = response.data?.skills || [];
|
|
1164
|
-
if (skills.length === 0) {
|
|
1165
|
-
console.log(a.yellow(` ${t("skillsSync:message.noCloudSkills")}`));
|
|
1166
|
-
return;
|
|
1167
|
-
}
|
|
1168
|
-
console.log(a.bold.green(` ${t("skillsSync:message.foundCloudSkills", { count: skills.length })}
|
|
1169
|
-
`));
|
|
1170
|
-
for (const skill of skills) {
|
|
1171
|
-
const privacyBadge = getPrivacyBadge(skill.privacy);
|
|
1172
|
-
console.log(`${a.bold(` ${skill.name}`) + a.dim(` v${skill.version}`)} ${privacyBadge}`);
|
|
1173
|
-
console.log(a.dim(` ${skill.metadata.description}`));
|
|
1174
|
-
if (skill.metadata.tags && skill.metadata.tags.length > 0) {
|
|
1175
|
-
const tags = skill.metadata.tags.map((tag) => a.bgGray.white(` ${tag} `)).join(" ");
|
|
1176
|
-
console.log(` ${tags}`);
|
|
1177
|
-
}
|
|
1178
|
-
console.log(a.dim(` ${t("skillsSync:label.author")}: ${skill.metadata.author}`));
|
|
1179
|
-
console.log(a.dim(` ${t("skillsSync:label.updated")}: ${new Date(skill.updatedAt).toLocaleString()}`));
|
|
1180
|
-
console.log("");
|
|
1181
|
-
}
|
|
1182
|
-
} catch (error) {
|
|
1183
|
-
console.error(a.red(`
|
|
1184
|
-
${t("skillsSync:error.listFailed")}: ${error}`));
|
|
1185
|
-
throw error;
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
async function showSyncStatus(options = {}) {
|
|
1189
|
-
const t = getTranslation(options.lang);
|
|
1190
|
-
try {
|
|
1191
|
-
const syncState = loadSyncState();
|
|
1192
|
-
const localSkills = await getLocalSkills();
|
|
1193
|
-
const cloudResponse = await listCloudSkills({ privacy: options.privacy });
|
|
1194
|
-
const cloudSkills = cloudResponse.success ? cloudResponse.data?.skills || [] : [];
|
|
1195
|
-
console.log(a.bold(` ${t("skillsSync:label.status")}:`));
|
|
1196
|
-
console.log(a.dim(` ${t("skillsSync:label.localSkills")}: ${localSkills.length}`));
|
|
1197
|
-
console.log(a.dim(` ${t("skillsSync:label.cloudSkills")}: ${cloudSkills.length}`));
|
|
1198
|
-
console.log(a.dim(` ${t("skillsSync:label.lastSync")}: ${new Date(syncState.lastGlobalSync).toLocaleString()}`));
|
|
1199
|
-
const states = Object.values(syncState.skills);
|
|
1200
|
-
const synced = states.filter((s) => s.status === "synced").length;
|
|
1201
|
-
const localAhead = states.filter((s) => s.status === "local_ahead").length;
|
|
1202
|
-
const remoteAhead = states.filter((s) => s.status === "remote_ahead").length;
|
|
1203
|
-
const conflicts = states.filter((s) => s.status === "conflict").length;
|
|
1204
|
-
const localOnly = states.filter((s) => s.status === "local_only").length;
|
|
1205
|
-
const remoteOnly = states.filter((s) => s.status === "remote_only").length;
|
|
1206
|
-
console.log("");
|
|
1207
|
-
console.log(a.bold(` ${t("skillsSync:label.syncStates")}:`));
|
|
1208
|
-
if (synced > 0)
|
|
1209
|
-
console.log(a.green(` \u2713 ${t("skillsSync:status.synced")}: ${synced}`));
|
|
1210
|
-
if (localAhead > 0)
|
|
1211
|
-
console.log(a.yellow(` \u2191 ${t("skillsSync:status.localAhead")}: ${localAhead}`));
|
|
1212
|
-
if (remoteAhead > 0)
|
|
1213
|
-
console.log(a.yellow(` \u2193 ${t("skillsSync:status.remoteAhead")}: ${remoteAhead}`));
|
|
1214
|
-
if (conflicts > 0)
|
|
1215
|
-
console.log(a.red(` \u26A0 ${t("skillsSync:status.conflict")}: ${conflicts}`));
|
|
1216
|
-
if (localOnly > 0)
|
|
1217
|
-
console.log(a.green(` \u2295 ${t("skillsSync:status.localOnly")}: ${localOnly}`));
|
|
1218
|
-
if (remoteOnly > 0)
|
|
1219
|
-
console.log(a.green(` \u2296 ${t("skillsSync:status.remoteOnly")}: ${remoteOnly}`));
|
|
1220
|
-
console.log("");
|
|
1221
|
-
} catch (error) {
|
|
1222
|
-
console.warn(a.yellow(` ${t("skillsSync:warning.statusFailed")}: ${error}`));
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
async function skillsSyncMenu(options = {}) {
|
|
1226
|
-
const t = getTranslation(options.lang);
|
|
1227
|
-
while (true) {
|
|
1228
|
-
console.log("");
|
|
1229
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1230
|
-
console.log(a.bold.cyan(` ${t("skillsSync:menu.title")}`));
|
|
1231
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1232
|
-
console.log("");
|
|
1233
|
-
const { action } = await inquirer.prompt({
|
|
1234
|
-
type: "list",
|
|
1235
|
-
name: "action",
|
|
1236
|
-
message: t("skillsSync:menu.prompt"),
|
|
1237
|
-
choices: [
|
|
1238
|
-
{ name: `\u{1F504} ${t("skillsSync:menu.sync")}`, value: "sync" },
|
|
1239
|
-
{ name: `\u2191 ${t("skillsSync:menu.push")}`, value: "push" },
|
|
1240
|
-
{ name: `\u2193 ${t("skillsSync:menu.pull")}`, value: "pull" },
|
|
1241
|
-
{ name: `\u{1F4CB} ${t("skillsSync:menu.list")}`, value: "list" },
|
|
1242
|
-
{ name: `\u{1F4CA} ${t("skillsSync:menu.status")}`, value: "status" },
|
|
1243
|
-
new inquirer.Separator(),
|
|
1244
|
-
{ name: `\u{1F519} ${t("skillsSync:menu.back")}`, value: "back" }
|
|
1245
|
-
]
|
|
1246
|
-
});
|
|
1247
|
-
if (action === "back") {
|
|
1248
|
-
break;
|
|
1249
|
-
}
|
|
1250
|
-
try {
|
|
1251
|
-
switch (action) {
|
|
1252
|
-
case "sync":
|
|
1253
|
-
await syncSkills(options);
|
|
1254
|
-
break;
|
|
1255
|
-
case "push":
|
|
1256
|
-
await pushSkillsCommand(options);
|
|
1257
|
-
break;
|
|
1258
|
-
case "pull":
|
|
1259
|
-
await pullSkillsCommand(options);
|
|
1260
|
-
break;
|
|
1261
|
-
case "list":
|
|
1262
|
-
await listCloudSkillsCommand(options);
|
|
1263
|
-
break;
|
|
1264
|
-
case "status":
|
|
1265
|
-
await showSyncStatus(options);
|
|
1266
|
-
break;
|
|
1267
|
-
}
|
|
1268
|
-
} catch (error) {
|
|
1269
|
-
console.error(a.red(`
|
|
1270
|
-
${t("common.error")}: ${error}`));
|
|
1271
|
-
}
|
|
1272
|
-
await inquirer.prompt({
|
|
1273
|
-
type: "input",
|
|
1274
|
-
name: "continue",
|
|
1275
|
-
message: t("common.pressEnterToContinue")
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
function displaySyncResult(result, lang) {
|
|
1280
|
-
const t = getTranslation();
|
|
1281
|
-
console.log("");
|
|
1282
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1283
|
-
console.log(a.bold.cyan(` ${t("skillsSync:result.title")}`));
|
|
1284
|
-
console.log(a.bold.cyan("\u2501".repeat(60)));
|
|
1285
|
-
console.log("");
|
|
1286
|
-
if (result.success) {
|
|
1287
|
-
console.log(a.bold.green(` \u2713 ${t("skillsSync:result.success")}`));
|
|
1288
|
-
} else {
|
|
1289
|
-
console.log(a.bold.red(` \u2717 ${t("skillsSync:result.failed")}`));
|
|
1290
|
-
if (result.error) {
|
|
1291
|
-
console.log(a.red(` ${result.error}`));
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
console.log("");
|
|
1295
|
-
console.log(a.bold(` ${t("skillsSync:result.statistics")}:`));
|
|
1296
|
-
console.log(a.dim(` ${t("skillsSync:result.total")}: ${result.total}`));
|
|
1297
|
-
console.log(a.green(` ${t("skillsSync:result.succeeded")}: ${result.succeeded}`));
|
|
1298
|
-
if (result.failed > 0) {
|
|
1299
|
-
console.log(a.red(` ${t("skillsSync:result.failed")}: ${result.failed}`));
|
|
1300
|
-
}
|
|
1301
|
-
if (result.conflicts > 0) {
|
|
1302
|
-
console.log(a.yellow(` ${t("skillsSync:result.conflicts")}: ${result.conflicts}`));
|
|
1303
|
-
}
|
|
1304
|
-
console.log(a.green(` ${t("skillsSync:result.uploaded")}: ${result.uploaded}`));
|
|
1305
|
-
console.log(a.green(` ${t("skillsSync:result.downloaded")}: ${result.downloaded}`));
|
|
1306
|
-
console.log(a.dim(` ${t("skillsSync:result.skipped")}: ${result.skipped}`));
|
|
1307
|
-
console.log(a.dim(` ${t("skillsSync:result.duration")}: ${(result.durationMs / 1e3).toFixed(2)}s`));
|
|
1308
|
-
if (result.failed > 0 || result.conflicts > 0) {
|
|
1309
|
-
console.log("");
|
|
1310
|
-
console.log(a.bold(` ${t("skillsSync:result.details")}:`));
|
|
1311
|
-
for (const item of result.results) {
|
|
1312
|
-
if (!item.success || item.action === "conflict") {
|
|
1313
|
-
const icon = item.success ? "\u26A0" : "\u2717";
|
|
1314
|
-
const color = item.success ? a.yellow : a.red;
|
|
1315
|
-
console.log(color(` ${icon} ${item.skillName}`));
|
|
1316
|
-
if (item.error) {
|
|
1317
|
-
console.log(a.dim(` ${item.error}`));
|
|
1318
|
-
}
|
|
1319
|
-
if (item.action === "conflict") {
|
|
1320
|
-
console.log(a.dim(` ${t("skillsSync:result.conflictHint")}`));
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
if (result.success && result.uploaded > 0) {
|
|
1326
|
-
showImpactReminder("publish");
|
|
1327
|
-
}
|
|
1328
|
-
console.log("");
|
|
1329
|
-
}
|
|
1330
|
-
function getPrivacyBadge(privacy) {
|
|
1331
|
-
switch (privacy) {
|
|
1332
|
-
case "private":
|
|
1333
|
-
return a.bgRed.white(" PRIVATE ");
|
|
1334
|
-
case "team":
|
|
1335
|
-
return a.bgYellow.black(" TEAM ");
|
|
1336
|
-
case "public":
|
|
1337
|
-
return a.bgGreen.white(" PUBLIC ");
|
|
1338
|
-
default:
|
|
1339
|
-
return "";
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
export { listCloudSkillsCommand, pullSkillsCommand, pushSkillsCommand, showSyncStatus, skillsSyncMenu, syncSkills };
|