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,444 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
2
|
-
import { homedir } from 'node:os';
|
|
3
|
-
import cron from 'node-cron';
|
|
4
|
-
import initSqlJs from 'sql.js';
|
|
5
|
-
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
6
|
-
|
|
7
|
-
class DecayScheduler {
|
|
8
|
-
memoryTree;
|
|
9
|
-
task = null;
|
|
10
|
-
archiveThreshold;
|
|
11
|
-
constructor(memoryTree, archiveThreshold = 0.3) {
|
|
12
|
-
this.memoryTree = memoryTree;
|
|
13
|
-
this.archiveThreshold = archiveThreshold;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Start scheduled decay (user must explicitly call this)
|
|
17
|
-
*/
|
|
18
|
-
start(schedule = "0 2 * * *") {
|
|
19
|
-
if (this.task) {
|
|
20
|
-
console.warn("[CCJK Context] Decay scheduler already running");
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (!cron.validate(schedule)) {
|
|
24
|
-
throw new Error(`Invalid cron expression: ${schedule}`);
|
|
25
|
-
}
|
|
26
|
-
console.log(`[CCJK Context] Starting decay scheduler: ${schedule}`);
|
|
27
|
-
console.log("[CCJK Context] This will run in the background. Use .stop() to disable.");
|
|
28
|
-
this.task = cron.schedule(schedule, async () => {
|
|
29
|
-
console.log("[CCJK Context] Running scheduled decay...");
|
|
30
|
-
try {
|
|
31
|
-
const result = await this.runDecay();
|
|
32
|
-
console.log(`[CCJK Context] Decayed ${result.decayed} nodes, archived ${result.archived} nodes`);
|
|
33
|
-
} catch (err) {
|
|
34
|
-
console.error("[CCJK Context] Decay error:", err);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Stop scheduled decay
|
|
40
|
-
*/
|
|
41
|
-
stop() {
|
|
42
|
-
if (this.task) {
|
|
43
|
-
this.task.stop();
|
|
44
|
-
this.task = null;
|
|
45
|
-
console.log("[CCJK Context] Decay scheduler stopped");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Check if scheduler is running
|
|
50
|
-
*/
|
|
51
|
-
isRunning() {
|
|
52
|
-
return this.task !== null;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Run decay manually
|
|
56
|
-
*/
|
|
57
|
-
async runNow() {
|
|
58
|
-
return this.runDecay();
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Preview what would be decayed (dry run)
|
|
62
|
-
*/
|
|
63
|
-
async preview() {
|
|
64
|
-
const stats = await this.memoryTree.getStats();
|
|
65
|
-
return {
|
|
66
|
-
wouldDecay: stats.totalNodes - (stats.byPriority.P0 || 0) || 0,
|
|
67
|
-
wouldArchive: stats.brownLeaves,
|
|
68
|
-
stats
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Internal decay execution
|
|
73
|
-
*/
|
|
74
|
-
async runDecay() {
|
|
75
|
-
const decayed = await this.memoryTree.applyDecay();
|
|
76
|
-
const archived = await this.memoryTree.archiveLowConfidence(this.archiveThreshold);
|
|
77
|
-
return {
|
|
78
|
-
decayed,
|
|
79
|
-
archived,
|
|
80
|
-
details: { threshold: this.archiveThreshold }
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
let SQL = null;
|
|
86
|
-
async function initSQL() {
|
|
87
|
-
if (!SQL) {
|
|
88
|
-
SQL = await initSqlJs();
|
|
89
|
-
}
|
|
90
|
-
return SQL;
|
|
91
|
-
}
|
|
92
|
-
async function createDatabase(path) {
|
|
93
|
-
const sql = await initSQL();
|
|
94
|
-
if (existsSync(path)) {
|
|
95
|
-
const buffer = readFileSync(path);
|
|
96
|
-
return new sql.Database(buffer);
|
|
97
|
-
}
|
|
98
|
-
return new sql.Database();
|
|
99
|
-
}
|
|
100
|
-
function saveDatabase(db, path) {
|
|
101
|
-
const data = db.export();
|
|
102
|
-
writeFileSync(path, data);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
class MemoryTree {
|
|
106
|
-
db;
|
|
107
|
-
dbPath;
|
|
108
|
-
initialized = false;
|
|
109
|
-
constructor(dbPath) {
|
|
110
|
-
this.dbPath = dbPath || this.getDefaultDbPath();
|
|
111
|
-
this.ensureDbDirectory();
|
|
112
|
-
}
|
|
113
|
-
async init() {
|
|
114
|
-
if (!this.initialized) {
|
|
115
|
-
this.db = await createDatabase(this.dbPath);
|
|
116
|
-
this.initSchema();
|
|
117
|
-
this.initialized = true;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
getDefaultDbPath() {
|
|
121
|
-
const ccjkDir = process.env.ZCF_CONFIG_DIR || join(homedir(), ".ccjk");
|
|
122
|
-
return join(ccjkDir, "memory.db");
|
|
123
|
-
}
|
|
124
|
-
ensureDbDirectory() {
|
|
125
|
-
const dir = this.dbPath.substring(0, this.dbPath.lastIndexOf("/"));
|
|
126
|
-
if (!existsSync(dir)) {
|
|
127
|
-
mkdirSync(dir, { recursive: true });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
initSchema() {
|
|
131
|
-
this.db.run(`
|
|
132
|
-
CREATE TABLE IF NOT EXISTS memory_nodes (
|
|
133
|
-
id TEXT PRIMARY KEY,
|
|
134
|
-
content TEXT NOT NULL,
|
|
135
|
-
summary TEXT NOT NULL,
|
|
136
|
-
confidence REAL NOT NULL,
|
|
137
|
-
priority TEXT NOT NULL,
|
|
138
|
-
last_accessed INTEGER NOT NULL,
|
|
139
|
-
access_count INTEGER NOT NULL,
|
|
140
|
-
created_at INTEGER NOT NULL,
|
|
141
|
-
metadata TEXT
|
|
142
|
-
);
|
|
143
|
-
`);
|
|
144
|
-
this.db.run(`CREATE INDEX IF NOT EXISTS idx_confidence ON memory_nodes(confidence);`);
|
|
145
|
-
this.db.run(`CREATE INDEX IF NOT EXISTS idx_priority ON memory_nodes(priority);`);
|
|
146
|
-
this.db.run(`CREATE INDEX IF NOT EXISTS idx_last_accessed ON memory_nodes(last_accessed);`);
|
|
147
|
-
this.save();
|
|
148
|
-
}
|
|
149
|
-
async addNode(node) {
|
|
150
|
-
await this.init();
|
|
151
|
-
const id = `mem_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
152
|
-
const now = Date.now();
|
|
153
|
-
this.db.run(
|
|
154
|
-
`INSERT INTO memory_nodes (id, content, summary, confidence, priority, last_accessed, access_count, created_at, metadata)
|
|
155
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
156
|
-
[id, node.content, node.summary, node.confidence, node.priority, now, 0, now, JSON.stringify(node.metadata || {})]
|
|
157
|
-
);
|
|
158
|
-
this.save();
|
|
159
|
-
return id;
|
|
160
|
-
}
|
|
161
|
-
async getNode(id) {
|
|
162
|
-
await this.init();
|
|
163
|
-
const results = this.db.exec(`SELECT * FROM memory_nodes WHERE id = ?`, [id]);
|
|
164
|
-
if (!results.length || !results[0].values.length)
|
|
165
|
-
return null;
|
|
166
|
-
const row = results[0].values[0];
|
|
167
|
-
return this.rowToNode(results[0].columns, row);
|
|
168
|
-
}
|
|
169
|
-
async search(query, options = {}) {
|
|
170
|
-
await this.init();
|
|
171
|
-
const { limit = 10, minConfidence = 0.3, priorities = ["P0", "P1", "P2"] } = options;
|
|
172
|
-
const priorityFilter = priorities.map(() => "?").join(",");
|
|
173
|
-
const pattern = `%${query}%`;
|
|
174
|
-
const sql = `
|
|
175
|
-
SELECT *,
|
|
176
|
-
(CASE
|
|
177
|
-
WHEN content LIKE ? THEN 1
|
|
178
|
-
WHEN summary LIKE ? THEN 2
|
|
179
|
-
ELSE 3
|
|
180
|
-
END) as score
|
|
181
|
-
FROM memory_nodes
|
|
182
|
-
WHERE (content LIKE ? OR summary LIKE ?)
|
|
183
|
-
AND confidence >= ?
|
|
184
|
-
AND priority IN (${priorityFilter})
|
|
185
|
-
ORDER BY score, confidence DESC
|
|
186
|
-
LIMIT ?
|
|
187
|
-
`;
|
|
188
|
-
const results = this.db.exec(sql, [pattern, pattern, pattern, pattern, minConfidence, ...priorities, limit]);
|
|
189
|
-
if (!results.length || !results[0].values.length)
|
|
190
|
-
return [];
|
|
191
|
-
return results[0].values.map((row) => {
|
|
192
|
-
const node = this.rowToNode(results[0].columns, row);
|
|
193
|
-
return { ...node, score: row[results[0].columns.indexOf("score")] };
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
async updateConfidence(id, delta) {
|
|
197
|
-
await this.init();
|
|
198
|
-
this.db.run(
|
|
199
|
-
`UPDATE memory_nodes
|
|
200
|
-
SET confidence = CASE
|
|
201
|
-
WHEN confidence + ? > 1.0 THEN 1.0
|
|
202
|
-
WHEN confidence + ? < 0.0 THEN 0.0
|
|
203
|
-
ELSE confidence + ?
|
|
204
|
-
END
|
|
205
|
-
WHERE id = ?`,
|
|
206
|
-
[delta, delta, delta, id]
|
|
207
|
-
);
|
|
208
|
-
this.save();
|
|
209
|
-
}
|
|
210
|
-
async recordAccess(id) {
|
|
211
|
-
await this.init();
|
|
212
|
-
const now = Date.now();
|
|
213
|
-
this.db.run(
|
|
214
|
-
`UPDATE memory_nodes
|
|
215
|
-
SET last_accessed = ?,
|
|
216
|
-
access_count = access_count + 1,
|
|
217
|
-
confidence = CASE
|
|
218
|
-
WHEN confidence + 0.05 > 1.0 THEN 1.0
|
|
219
|
-
ELSE confidence + 0.05
|
|
220
|
-
END
|
|
221
|
-
WHERE id = ?`,
|
|
222
|
-
[now, id]
|
|
223
|
-
);
|
|
224
|
-
this.save();
|
|
225
|
-
}
|
|
226
|
-
async applyDecay(decayRate = 0.01) {
|
|
227
|
-
await this.init();
|
|
228
|
-
const before = this.db.exec(`SELECT COUNT(*) FROM memory_nodes`);
|
|
229
|
-
const countBefore = before[0]?.values[0]?.[0] || 0;
|
|
230
|
-
this.db.run(
|
|
231
|
-
`UPDATE memory_nodes
|
|
232
|
-
SET confidence = CASE
|
|
233
|
-
WHEN confidence - ? < 0.0 THEN 0.0
|
|
234
|
-
ELSE confidence - ?
|
|
235
|
-
END`,
|
|
236
|
-
[decayRate, decayRate]
|
|
237
|
-
);
|
|
238
|
-
this.save();
|
|
239
|
-
return countBefore;
|
|
240
|
-
}
|
|
241
|
-
async archiveLowConfidence(threshold = 0.3) {
|
|
242
|
-
await this.init();
|
|
243
|
-
const before = this.db.exec(`SELECT COUNT(*) FROM memory_nodes WHERE confidence < ?`, [threshold]);
|
|
244
|
-
const count = before[0]?.values[0]?.[0] || 0;
|
|
245
|
-
this.db.run(`DELETE FROM memory_nodes WHERE confidence < ?`, [threshold]);
|
|
246
|
-
this.save();
|
|
247
|
-
return count;
|
|
248
|
-
}
|
|
249
|
-
async getStats() {
|
|
250
|
-
await this.init();
|
|
251
|
-
const results = this.db.exec(`
|
|
252
|
-
SELECT
|
|
253
|
-
COUNT(*) as total,
|
|
254
|
-
SUM(CASE WHEN confidence >= 0.8 THEN 1 ELSE 0 END) as green,
|
|
255
|
-
SUM(CASE WHEN confidence >= 0.5 AND confidence < 0.8 THEN 1 ELSE 0 END) as yellow,
|
|
256
|
-
SUM(CASE WHEN confidence >= 0.3 AND confidence < 0.5 THEN 1 ELSE 0 END) as brown,
|
|
257
|
-
SUM(CASE WHEN confidence < 0.3 THEN 1 ELSE 0 END) as archived,
|
|
258
|
-
AVG(confidence) as avg_confidence
|
|
259
|
-
FROM memory_nodes
|
|
260
|
-
`);
|
|
261
|
-
const priorityResults = this.db.exec(`
|
|
262
|
-
SELECT priority, COUNT(*) as count
|
|
263
|
-
FROM memory_nodes
|
|
264
|
-
GROUP BY priority
|
|
265
|
-
`);
|
|
266
|
-
const row = results[0]?.values[0] || [];
|
|
267
|
-
const byPriority = {};
|
|
268
|
-
if (priorityResults.length && priorityResults[0].values.length) {
|
|
269
|
-
for (const pRow of priorityResults[0].values) {
|
|
270
|
-
byPriority[pRow[0]] = pRow[1];
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return {
|
|
274
|
-
totalNodes: row[0] || 0,
|
|
275
|
-
greenLeaves: row[1] || 0,
|
|
276
|
-
yellowLeaves: row[2] || 0,
|
|
277
|
-
brownLeaves: row[3] || 0,
|
|
278
|
-
archived: row[4] || 0,
|
|
279
|
-
avgConfidence: row[5] || 0,
|
|
280
|
-
byPriority
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
async getAllNodes(options = {}) {
|
|
284
|
-
await this.init();
|
|
285
|
-
const { minConfidence = 0, priorities = ["P0", "P1", "P2"], limit } = options;
|
|
286
|
-
const priorityFilter = priorities.map(() => "?").join(",");
|
|
287
|
-
let sql = `
|
|
288
|
-
SELECT * FROM memory_nodes
|
|
289
|
-
WHERE confidence >= ?
|
|
290
|
-
AND priority IN (${priorityFilter})
|
|
291
|
-
ORDER BY confidence DESC, last_accessed DESC
|
|
292
|
-
`;
|
|
293
|
-
const params = [minConfidence, ...priorities];
|
|
294
|
-
if (limit) {
|
|
295
|
-
sql += " LIMIT ?";
|
|
296
|
-
params.push(limit);
|
|
297
|
-
}
|
|
298
|
-
const results = this.db.exec(sql, params);
|
|
299
|
-
if (!results.length || !results[0].values.length)
|
|
300
|
-
return [];
|
|
301
|
-
return results[0].values.map((row) => this.rowToNode(results[0].columns, row));
|
|
302
|
-
}
|
|
303
|
-
async deleteNode(id) {
|
|
304
|
-
await this.init();
|
|
305
|
-
this.db.run(`DELETE FROM memory_nodes WHERE id = ?`, [id]);
|
|
306
|
-
this.save();
|
|
307
|
-
const results = this.db.exec(`SELECT changes()`);
|
|
308
|
-
return (results[0]?.values[0]?.[0] || 0) > 0;
|
|
309
|
-
}
|
|
310
|
-
async clear() {
|
|
311
|
-
await this.init();
|
|
312
|
-
this.db.run(`DELETE FROM memory_nodes`);
|
|
313
|
-
this.save();
|
|
314
|
-
}
|
|
315
|
-
close() {
|
|
316
|
-
if (this.initialized) {
|
|
317
|
-
this.save();
|
|
318
|
-
this.db.close();
|
|
319
|
-
this.initialized = false;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
save() {
|
|
323
|
-
if (this.initialized) {
|
|
324
|
-
saveDatabase(this.db, this.dbPath);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
rowToNode(columns, row) {
|
|
328
|
-
const obj = {};
|
|
329
|
-
columns.forEach((col, i) => {
|
|
330
|
-
obj[col] = row[i];
|
|
331
|
-
});
|
|
332
|
-
return {
|
|
333
|
-
id: obj.id,
|
|
334
|
-
content: obj.content,
|
|
335
|
-
summary: obj.summary,
|
|
336
|
-
confidence: obj.confidence,
|
|
337
|
-
priority: obj.priority,
|
|
338
|
-
lastAccessed: new Date(obj.last_accessed),
|
|
339
|
-
accessCount: obj.access_count,
|
|
340
|
-
createdAt: new Date(obj.created_at),
|
|
341
|
-
metadata: obj.metadata ? JSON.parse(obj.metadata) : {}
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
async function contextOptStats() {
|
|
347
|
-
if (process.env.CCJK_MEMORY_TREE !== "true") {
|
|
348
|
-
console.error("\u274C Memory tree not enabled. Set CCJK_MEMORY_TREE=true");
|
|
349
|
-
process.exit(1);
|
|
350
|
-
}
|
|
351
|
-
try {
|
|
352
|
-
const tree = new MemoryTree();
|
|
353
|
-
const stats = await tree.getStats();
|
|
354
|
-
console.log("\n\u{1F4CA} Memory Tree Statistics\n");
|
|
355
|
-
console.log(`Total Nodes: ${stats.totalNodes}`);
|
|
356
|
-
console.log(`Average Confidence: ${stats.avgConfidence.toFixed(2)}
|
|
357
|
-
`);
|
|
358
|
-
console.log("By Confidence:");
|
|
359
|
-
console.log(` \u{1F7E2} Green (\u22650.8): ${stats.greenLeaves}`);
|
|
360
|
-
console.log(` \u{1F7E1} Yellow (0.5-0.8): ${stats.yellowLeaves}`);
|
|
361
|
-
console.log(` \u{1F7E4} Brown (0.3-0.5): ${stats.brownLeaves}`);
|
|
362
|
-
console.log(` \u26AB Archived (<0.3): ${stats.archived}
|
|
363
|
-
`);
|
|
364
|
-
console.log("By Priority:");
|
|
365
|
-
console.log(` P0 (Critical): ${stats.byPriority.P0 || 0}`);
|
|
366
|
-
console.log(` P1 (Important): ${stats.byPriority.P1 || 0}`);
|
|
367
|
-
console.log(` P2 (Routine): ${stats.byPriority.P2 || 0}`);
|
|
368
|
-
tree.close();
|
|
369
|
-
} catch (err) {
|
|
370
|
-
console.error("\u274C Failed to get stats:", err);
|
|
371
|
-
process.exit(1);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
async function contextOptSearch(query, options = {}) {
|
|
375
|
-
if (process.env.CCJK_MEMORY_TREE !== "true") {
|
|
376
|
-
console.error("\u274C Memory tree not enabled. Set CCJK_MEMORY_TREE=true");
|
|
377
|
-
process.exit(1);
|
|
378
|
-
}
|
|
379
|
-
try {
|
|
380
|
-
const tree = new MemoryTree();
|
|
381
|
-
const topK = parseInt(options.topK || "5");
|
|
382
|
-
const results = await tree.search(query, { limit: topK });
|
|
383
|
-
if (results.length === 0) {
|
|
384
|
-
console.log("\n\u{1F50D} No results found\n");
|
|
385
|
-
tree.close();
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
console.log(`
|
|
389
|
-
\u{1F50D} Found ${results.length} results:
|
|
390
|
-
`);
|
|
391
|
-
results.forEach((node, i) => {
|
|
392
|
-
console.log(`${i + 1}. [${node.priority}] Confidence: ${node.confidence.toFixed(2)} | Score: ${node.score.toFixed(2)}`);
|
|
393
|
-
console.log(` ${node.summary.slice(0, 100)}${node.summary.length > 100 ? "..." : ""}`);
|
|
394
|
-
console.log(` Accessed: ${node.accessCount} times | Last: ${node.lastAccessed.toISOString()}
|
|
395
|
-
`);
|
|
396
|
-
});
|
|
397
|
-
tree.close();
|
|
398
|
-
} catch (err) {
|
|
399
|
-
console.error("\u274C Search failed:", err);
|
|
400
|
-
process.exit(1);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
async function contextOptDecay() {
|
|
404
|
-
if (process.env.CCJK_MEMORY_TREE !== "true") {
|
|
405
|
-
console.error("\u274C Memory tree not enabled. Set CCJK_MEMORY_TREE=true");
|
|
406
|
-
process.exit(1);
|
|
407
|
-
}
|
|
408
|
-
try {
|
|
409
|
-
const tree = new MemoryTree();
|
|
410
|
-
const threshold = 0.3;
|
|
411
|
-
const scheduler = new DecayScheduler(tree, threshold);
|
|
412
|
-
console.log("\n\u2699\uFE0F Running decay...\n");
|
|
413
|
-
const result = await scheduler.runNow();
|
|
414
|
-
console.log(`\u2705 Decayed: ${result.decayed} nodes`);
|
|
415
|
-
console.log(`\u{1F4E6} Archived: ${result.archived} nodes
|
|
416
|
-
`);
|
|
417
|
-
console.log("Details:");
|
|
418
|
-
Object.entries(result.details).forEach(([priority, count]) => {
|
|
419
|
-
console.log(` ${priority}: ${count} nodes`);
|
|
420
|
-
});
|
|
421
|
-
tree.close();
|
|
422
|
-
} catch (err) {
|
|
423
|
-
console.error("\u274C Decay failed:", err);
|
|
424
|
-
process.exit(1);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
async function contextOptConfig() {
|
|
428
|
-
console.log("\n\u2699\uFE0F Context Optimization Configuration\n");
|
|
429
|
-
console.log(`CCJK_CONTEXT_OPTIMIZATION: ${process.env.CCJK_CONTEXT_OPTIMIZATION || "false"}`);
|
|
430
|
-
console.log(`CCJK_TOOL_COMPRESSION: ${process.env.CCJK_TOOL_COMPRESSION || "true"}`);
|
|
431
|
-
console.log(`CCJK_SEMANTIC_COMPRESSION: ${process.env.CCJK_SEMANTIC_COMPRESSION || "false"}`);
|
|
432
|
-
console.log(`CCJK_MEMORY_TREE: ${process.env.CCJK_MEMORY_TREE || "false"}`);
|
|
433
|
-
console.log(`CCJK_MAX_CONTEXT_TOKENS: ${process.env.CCJK_MAX_CONTEXT_TOKENS || "150000"}`);
|
|
434
|
-
console.log(`CCJK_COMPRESSION_TIMEOUT: ${process.env.CCJK_COMPRESSION_TIMEOUT || "50"}ms
|
|
435
|
-
`);
|
|
436
|
-
const ccjkDir = process.env.ZCF_CONFIG_DIR || join(homedir(), ".ccjk");
|
|
437
|
-
const dbPath = join(ccjkDir, "memory.db");
|
|
438
|
-
const dbExists = existsSync(dbPath);
|
|
439
|
-
console.log(`Memory DB: ${dbPath}`);
|
|
440
|
-
console.log(`DB Exists: ${dbExists ? "\u2705" : "\u274C"}
|
|
441
|
-
`);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
export { contextOptConfig, contextOptDecay, contextOptSearch, contextOptStats };
|