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,707 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync } from 'node:fs';
|
|
2
|
-
import Database from 'better-sqlite3';
|
|
3
|
-
import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
4
|
-
|
|
5
|
-
class ContextPersistence {
|
|
6
|
-
db;
|
|
7
|
-
dbPath;
|
|
8
|
-
constructor(dbPath) {
|
|
9
|
-
this.dbPath = dbPath || join(
|
|
10
|
-
process.env.HOME || process.env.USERPROFILE || ".",
|
|
11
|
-
".ccjk",
|
|
12
|
-
"context",
|
|
13
|
-
"contexts.db"
|
|
14
|
-
);
|
|
15
|
-
const dir = dirname(this.dbPath);
|
|
16
|
-
if (!existsSync(dir)) {
|
|
17
|
-
mkdirSync(dir, { recursive: true });
|
|
18
|
-
}
|
|
19
|
-
this.db = new Database(this.dbPath);
|
|
20
|
-
this.db.pragma("journal_mode = WAL");
|
|
21
|
-
this.initSchema();
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Initialize database schema
|
|
25
|
-
*/
|
|
26
|
-
initSchema() {
|
|
27
|
-
this.db.exec(`
|
|
28
|
-
CREATE TABLE IF NOT EXISTS contexts (
|
|
29
|
-
id TEXT PRIMARY KEY,
|
|
30
|
-
project_hash TEXT NOT NULL,
|
|
31
|
-
content TEXT NOT NULL,
|
|
32
|
-
compressed TEXT NOT NULL,
|
|
33
|
-
algorithm TEXT NOT NULL,
|
|
34
|
-
strategy TEXT NOT NULL,
|
|
35
|
-
original_tokens INTEGER NOT NULL,
|
|
36
|
-
compressed_tokens INTEGER NOT NULL,
|
|
37
|
-
compression_ratio REAL NOT NULL,
|
|
38
|
-
metadata TEXT NOT NULL DEFAULT '{}',
|
|
39
|
-
timestamp INTEGER NOT NULL,
|
|
40
|
-
last_accessed INTEGER NOT NULL,
|
|
41
|
-
access_count INTEGER NOT NULL DEFAULT 1
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
CREATE INDEX IF NOT EXISTS idx_contexts_project ON contexts(project_hash);
|
|
45
|
-
CREATE INDEX IF NOT EXISTS idx_contexts_timestamp ON contexts(timestamp);
|
|
46
|
-
CREATE INDEX IF NOT EXISTS idx_contexts_last_accessed ON contexts(last_accessed);
|
|
47
|
-
CREATE INDEX IF NOT EXISTS idx_contexts_access_count ON contexts(access_count);
|
|
48
|
-
|
|
49
|
-
-- FTS5 virtual table for full-text search
|
|
50
|
-
CREATE VIRTUAL TABLE IF NOT EXISTS contexts_fts USING fts5(
|
|
51
|
-
id UNINDEXED,
|
|
52
|
-
content,
|
|
53
|
-
compressed,
|
|
54
|
-
metadata,
|
|
55
|
-
tokenize = 'porter unicode61'
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
-- Triggers to keep FTS5 in sync with main table
|
|
59
|
-
CREATE TRIGGER IF NOT EXISTS contexts_ai AFTER INSERT ON contexts BEGIN
|
|
60
|
-
INSERT INTO contexts_fts(id, content, compressed, metadata)
|
|
61
|
-
VALUES (new.id, new.content, new.compressed, new.metadata);
|
|
62
|
-
END;
|
|
63
|
-
|
|
64
|
-
CREATE TRIGGER IF NOT EXISTS contexts_ad AFTER DELETE ON contexts BEGIN
|
|
65
|
-
DELETE FROM contexts_fts WHERE id = old.id;
|
|
66
|
-
END;
|
|
67
|
-
|
|
68
|
-
CREATE TRIGGER IF NOT EXISTS contexts_au AFTER UPDATE ON contexts BEGIN
|
|
69
|
-
UPDATE contexts_fts
|
|
70
|
-
SET content = new.content,
|
|
71
|
-
compressed = new.compressed,
|
|
72
|
-
metadata = new.metadata
|
|
73
|
-
WHERE id = old.id;
|
|
74
|
-
END;
|
|
75
|
-
|
|
76
|
-
CREATE TABLE IF NOT EXISTS projects (
|
|
77
|
-
hash TEXT PRIMARY KEY,
|
|
78
|
-
path TEXT NOT NULL,
|
|
79
|
-
name TEXT,
|
|
80
|
-
created_at INTEGER NOT NULL,
|
|
81
|
-
updated_at INTEGER NOT NULL,
|
|
82
|
-
context_count INTEGER NOT NULL DEFAULT 0,
|
|
83
|
-
total_tokens INTEGER NOT NULL DEFAULT 0,
|
|
84
|
-
metadata TEXT NOT NULL DEFAULT '{}'
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
CREATE INDEX IF NOT EXISTS idx_projects_created ON projects(created_at);
|
|
88
|
-
CREATE INDEX IF NOT EXISTS idx_projects_updated ON projects(updated_at);
|
|
89
|
-
|
|
90
|
-
-- Compression metrics table
|
|
91
|
-
CREATE TABLE IF NOT EXISTS compression_metrics (
|
|
92
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
93
|
-
project_hash TEXT NOT NULL,
|
|
94
|
-
context_id TEXT NOT NULL,
|
|
95
|
-
original_tokens INTEGER NOT NULL,
|
|
96
|
-
compressed_tokens INTEGER NOT NULL,
|
|
97
|
-
compression_ratio REAL NOT NULL,
|
|
98
|
-
time_taken_ms INTEGER NOT NULL,
|
|
99
|
-
algorithm TEXT NOT NULL,
|
|
100
|
-
strategy TEXT NOT NULL,
|
|
101
|
-
timestamp INTEGER NOT NULL,
|
|
102
|
-
FOREIGN KEY (project_hash) REFERENCES projects(hash) ON DELETE CASCADE
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
CREATE INDEX IF NOT EXISTS idx_metrics_project ON compression_metrics(project_hash);
|
|
106
|
-
CREATE INDEX IF NOT EXISTS idx_metrics_timestamp ON compression_metrics(timestamp);
|
|
107
|
-
CREATE INDEX IF NOT EXISTS idx_metrics_context ON compression_metrics(context_id);
|
|
108
|
-
|
|
109
|
-
-- Composite indexes for hot/warm/cold queries
|
|
110
|
-
CREATE INDEX IF NOT EXISTS idx_contexts_hot ON contexts(project_hash, last_accessed DESC, access_count DESC);
|
|
111
|
-
CREATE INDEX IF NOT EXISTS idx_contexts_warm ON contexts(project_hash, timestamp DESC) WHERE access_count > 1;
|
|
112
|
-
CREATE INDEX IF NOT EXISTS idx_contexts_cold ON contexts(project_hash, timestamp ASC) WHERE access_count = 1;
|
|
113
|
-
`);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Save a compressed context
|
|
117
|
-
*/
|
|
118
|
-
saveContext(context, projectHash, originalContent, timeTakenMs) {
|
|
119
|
-
const stmt = this.db.prepare(`
|
|
120
|
-
INSERT OR REPLACE INTO contexts (
|
|
121
|
-
id, project_hash, content, compressed, algorithm, strategy,
|
|
122
|
-
original_tokens, compressed_tokens, compression_ratio,
|
|
123
|
-
metadata, timestamp, last_accessed, access_count
|
|
124
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
125
|
-
`);
|
|
126
|
-
const now = Date.now();
|
|
127
|
-
const existingContext = this.getContext(context.id);
|
|
128
|
-
const accessCount = existingContext ? existingContext.accessCount + 1 : 1;
|
|
129
|
-
stmt.run(
|
|
130
|
-
context.id,
|
|
131
|
-
projectHash,
|
|
132
|
-
originalContent || "",
|
|
133
|
-
// Store original content if provided
|
|
134
|
-
context.compressed,
|
|
135
|
-
context.algorithm,
|
|
136
|
-
context.strategy,
|
|
137
|
-
context.originalTokens,
|
|
138
|
-
context.compressedTokens,
|
|
139
|
-
context.compressionRatio,
|
|
140
|
-
JSON.stringify(context.metadata || {}),
|
|
141
|
-
context.compressedAt || now,
|
|
142
|
-
now,
|
|
143
|
-
accessCount
|
|
144
|
-
);
|
|
145
|
-
if (timeTakenMs !== void 0) {
|
|
146
|
-
this.saveCompressionMetric({
|
|
147
|
-
projectHash,
|
|
148
|
-
contextId: context.id,
|
|
149
|
-
originalTokens: context.originalTokens,
|
|
150
|
-
compressedTokens: context.compressedTokens,
|
|
151
|
-
compressionRatio: context.compressionRatio,
|
|
152
|
-
timeTakenMs,
|
|
153
|
-
algorithm: context.algorithm,
|
|
154
|
-
strategy: context.strategy,
|
|
155
|
-
timestamp: now
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
this.updateProjectStats(projectHash);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Get context by ID
|
|
162
|
-
*/
|
|
163
|
-
getContext(contextId) {
|
|
164
|
-
const stmt = this.db.prepare(`
|
|
165
|
-
SELECT * FROM contexts WHERE id = ?
|
|
166
|
-
`);
|
|
167
|
-
const row = stmt.get(contextId);
|
|
168
|
-
if (!row)
|
|
169
|
-
return null;
|
|
170
|
-
this.updateLastAccessed(contextId);
|
|
171
|
-
return this.rowToContext(row);
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Get contexts for a project
|
|
175
|
-
*/
|
|
176
|
-
getProjectContexts(projectHash, options) {
|
|
177
|
-
let query = "SELECT * FROM contexts WHERE project_hash = ?";
|
|
178
|
-
const params = [projectHash];
|
|
179
|
-
if (options?.startTime) {
|
|
180
|
-
query += " AND timestamp >= ?";
|
|
181
|
-
params.push(options.startTime);
|
|
182
|
-
}
|
|
183
|
-
if (options?.endTime) {
|
|
184
|
-
query += " AND timestamp <= ?";
|
|
185
|
-
params.push(options.endTime);
|
|
186
|
-
}
|
|
187
|
-
const sortBy = options?.sortBy || "timestamp";
|
|
188
|
-
const sortOrder = options?.sortOrder || "desc";
|
|
189
|
-
query += ` ORDER BY ${sortBy} ${sortOrder.toUpperCase()}`;
|
|
190
|
-
if (options?.limit) {
|
|
191
|
-
query += " LIMIT ?";
|
|
192
|
-
params.push(options.limit);
|
|
193
|
-
}
|
|
194
|
-
const stmt = this.db.prepare(query);
|
|
195
|
-
const rows = stmt.all(...params);
|
|
196
|
-
return rows.map((row) => this.rowToContext(row));
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Query contexts with filters
|
|
200
|
-
*/
|
|
201
|
-
queryContexts(options) {
|
|
202
|
-
let query = "SELECT * FROM contexts WHERE 1=1";
|
|
203
|
-
const params = [];
|
|
204
|
-
if (options?.projectHash) {
|
|
205
|
-
query += " AND project_hash = ?";
|
|
206
|
-
params.push(options.projectHash);
|
|
207
|
-
}
|
|
208
|
-
if (options?.startTime) {
|
|
209
|
-
query += " AND timestamp >= ?";
|
|
210
|
-
params.push(options.startTime);
|
|
211
|
-
}
|
|
212
|
-
if (options?.endTime) {
|
|
213
|
-
query += " AND timestamp <= ?";
|
|
214
|
-
params.push(options.endTime);
|
|
215
|
-
}
|
|
216
|
-
const sortBy = options?.sortBy || "timestamp";
|
|
217
|
-
const sortOrder = options?.sortOrder || "desc";
|
|
218
|
-
query += ` ORDER BY ${sortBy} ${sortOrder.toUpperCase()}`;
|
|
219
|
-
if (options?.limit) {
|
|
220
|
-
query += " LIMIT ?";
|
|
221
|
-
params.push(options.limit);
|
|
222
|
-
}
|
|
223
|
-
const stmt = this.db.prepare(query);
|
|
224
|
-
const rows = stmt.all(...params);
|
|
225
|
-
return rows.map((row) => this.rowToContext(row));
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Search contexts using FTS5 full-text search
|
|
229
|
-
* @param searchQuery - Search query (supports FTS5 syntax: AND, OR, NOT, NEAR, "phrases")
|
|
230
|
-
* @param options - Query options
|
|
231
|
-
* @returns Search results with ranking
|
|
232
|
-
*/
|
|
233
|
-
searchContexts(searchQuery, options) {
|
|
234
|
-
if (!searchQuery || searchQuery.trim().length === 0) {
|
|
235
|
-
return [];
|
|
236
|
-
}
|
|
237
|
-
let query = `
|
|
238
|
-
SELECT
|
|
239
|
-
c.*,
|
|
240
|
-
bm25(contexts_fts) as rank,
|
|
241
|
-
snippet(contexts_fts, 1, '<mark>', '</mark>', '...', 32) as snippet
|
|
242
|
-
FROM contexts c
|
|
243
|
-
INNER JOIN contexts_fts ON contexts_fts.id = c.id
|
|
244
|
-
WHERE contexts_fts MATCH ?
|
|
245
|
-
`;
|
|
246
|
-
const params = [searchQuery];
|
|
247
|
-
if (options?.projectHash) {
|
|
248
|
-
query += " AND c.project_hash = ?";
|
|
249
|
-
params.push(options.projectHash);
|
|
250
|
-
}
|
|
251
|
-
if (options?.startTime) {
|
|
252
|
-
query += " AND c.timestamp >= ?";
|
|
253
|
-
params.push(options.startTime);
|
|
254
|
-
}
|
|
255
|
-
if (options?.endTime) {
|
|
256
|
-
query += " AND c.timestamp <= ?";
|
|
257
|
-
params.push(options.endTime);
|
|
258
|
-
}
|
|
259
|
-
const sortBy = options?.sortBy || "relevance";
|
|
260
|
-
const sortOrder = options?.sortOrder || "desc";
|
|
261
|
-
if (sortBy === "relevance") {
|
|
262
|
-
query += ` ORDER BY rank ${sortOrder === "asc" ? "DESC" : "ASC"}`;
|
|
263
|
-
} else {
|
|
264
|
-
query += ` ORDER BY c.${sortBy} ${sortOrder.toUpperCase()}`;
|
|
265
|
-
}
|
|
266
|
-
if (options?.limit) {
|
|
267
|
-
query += " LIMIT ?";
|
|
268
|
-
params.push(options.limit);
|
|
269
|
-
}
|
|
270
|
-
const stmt = this.db.prepare(query);
|
|
271
|
-
const rows = stmt.all(...params);
|
|
272
|
-
return rows.map((row) => ({
|
|
273
|
-
...this.rowToContext(row),
|
|
274
|
-
rank: row.rank,
|
|
275
|
-
snippet: row.snippet
|
|
276
|
-
}));
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Get hot contexts (frequently accessed, recently used)
|
|
280
|
-
* @param projectHash - Project hash
|
|
281
|
-
* @param limit - Maximum number of results
|
|
282
|
-
*/
|
|
283
|
-
getHotContexts(projectHash, limit = 10) {
|
|
284
|
-
const stmt = this.db.prepare(`
|
|
285
|
-
SELECT * FROM contexts
|
|
286
|
-
WHERE project_hash = ?
|
|
287
|
-
ORDER BY last_accessed DESC, access_count DESC
|
|
288
|
-
LIMIT ?
|
|
289
|
-
`);
|
|
290
|
-
const rows = stmt.all(projectHash, limit);
|
|
291
|
-
return rows.map((row) => this.rowToContext(row));
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Get warm contexts (accessed multiple times but not recently)
|
|
295
|
-
* @param projectHash - Project hash
|
|
296
|
-
* @param limit - Maximum number of results
|
|
297
|
-
*/
|
|
298
|
-
getWarmContexts(projectHash, limit = 10) {
|
|
299
|
-
const stmt = this.db.prepare(`
|
|
300
|
-
SELECT * FROM contexts
|
|
301
|
-
WHERE project_hash = ? AND access_count > 1
|
|
302
|
-
ORDER BY timestamp DESC
|
|
303
|
-
LIMIT ?
|
|
304
|
-
`);
|
|
305
|
-
const rows = stmt.all(projectHash, limit);
|
|
306
|
-
return rows.map((row) => this.rowToContext(row));
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Get cold contexts (rarely accessed, older)
|
|
310
|
-
* @param projectHash - Project hash
|
|
311
|
-
* @param limit - Maximum number of results
|
|
312
|
-
*/
|
|
313
|
-
getColdContexts(projectHash, limit = 10) {
|
|
314
|
-
const stmt = this.db.prepare(`
|
|
315
|
-
SELECT * FROM contexts
|
|
316
|
-
WHERE project_hash = ? AND access_count = 1
|
|
317
|
-
ORDER BY timestamp ASC
|
|
318
|
-
LIMIT ?
|
|
319
|
-
`);
|
|
320
|
-
const rows = stmt.all(projectHash, limit);
|
|
321
|
-
return rows.map((row) => this.rowToContext(row));
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Delete context by ID
|
|
325
|
-
*/
|
|
326
|
-
deleteContext(contextId) {
|
|
327
|
-
const context = this.getContext(contextId);
|
|
328
|
-
if (!context)
|
|
329
|
-
return false;
|
|
330
|
-
const stmt = this.db.prepare("DELETE FROM contexts WHERE id = ?");
|
|
331
|
-
const result = stmt.run(contextId);
|
|
332
|
-
if (context.projectHash) {
|
|
333
|
-
this.updateProjectStats(context.projectHash);
|
|
334
|
-
}
|
|
335
|
-
return result.changes > 0;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Delete all contexts for a project
|
|
339
|
-
*/
|
|
340
|
-
deleteProjectContexts(projectHash) {
|
|
341
|
-
const stmt = this.db.prepare("DELETE FROM contexts WHERE project_hash = ?");
|
|
342
|
-
const result = stmt.run(projectHash);
|
|
343
|
-
this.updateProjectStats(projectHash);
|
|
344
|
-
return result.changes;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Register or update project
|
|
348
|
-
*/
|
|
349
|
-
registerProject(projectHash, projectPath, projectName) {
|
|
350
|
-
const stmt = this.db.prepare(`
|
|
351
|
-
INSERT OR REPLACE INTO projects (hash, path, name, created_at, updated_at, context_count, total_tokens, metadata)
|
|
352
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
353
|
-
`);
|
|
354
|
-
const now = Date.now();
|
|
355
|
-
const existing = this.getProject(projectHash);
|
|
356
|
-
const createdAt = existing?.created_at || now;
|
|
357
|
-
stmt.run(
|
|
358
|
-
projectHash,
|
|
359
|
-
projectPath,
|
|
360
|
-
projectName || null,
|
|
361
|
-
createdAt,
|
|
362
|
-
now,
|
|
363
|
-
existing?.context_count || 0,
|
|
364
|
-
existing?.total_tokens || 0,
|
|
365
|
-
JSON.stringify(existing?.metadata || {})
|
|
366
|
-
);
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Get project info
|
|
370
|
-
*/
|
|
371
|
-
getProject(projectHash) {
|
|
372
|
-
const stmt = this.db.prepare("SELECT * FROM projects WHERE hash = ?");
|
|
373
|
-
return stmt.get(projectHash);
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* List all projects
|
|
377
|
-
*/
|
|
378
|
-
listProjects() {
|
|
379
|
-
const stmt = this.db.prepare("SELECT * FROM projects ORDER BY updated_at DESC");
|
|
380
|
-
return stmt.all();
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Get context statistics
|
|
384
|
-
*/
|
|
385
|
-
getStats(projectHash) {
|
|
386
|
-
let query = "SELECT COUNT(*) as count, SUM(original_tokens) as orig, SUM(compressed_tokens) as comp, MIN(timestamp) as oldest, MAX(timestamp) as newest FROM contexts";
|
|
387
|
-
const params = [];
|
|
388
|
-
if (projectHash) {
|
|
389
|
-
query += " WHERE project_hash = ?";
|
|
390
|
-
params.push(projectHash);
|
|
391
|
-
}
|
|
392
|
-
const stmt = this.db.prepare(query);
|
|
393
|
-
const row = stmt.get(...params);
|
|
394
|
-
const totalProjects = projectHash ? 1 : this.db.prepare("SELECT COUNT(*) as count FROM projects").get().count;
|
|
395
|
-
const avgRatio = row.orig > 0 ? (row.orig - row.comp) / row.orig : 0;
|
|
396
|
-
return {
|
|
397
|
-
totalContexts: row.count || 0,
|
|
398
|
-
totalProjects,
|
|
399
|
-
totalOriginalTokens: row.orig || 0,
|
|
400
|
-
totalCompressedTokens: row.comp || 0,
|
|
401
|
-
averageCompressionRatio: avgRatio,
|
|
402
|
-
totalSize: this.getDatabaseSize(),
|
|
403
|
-
oldestContext: row.oldest || void 0,
|
|
404
|
-
newestContext: row.newest || void 0
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Clean up old contexts
|
|
409
|
-
*/
|
|
410
|
-
cleanup(maxAge) {
|
|
411
|
-
const cutoff = Date.now() - maxAge;
|
|
412
|
-
const stmt = this.db.prepare("DELETE FROM contexts WHERE timestamp < ?");
|
|
413
|
-
const result = stmt.run(cutoff);
|
|
414
|
-
const projects = this.listProjects();
|
|
415
|
-
for (const project of projects) {
|
|
416
|
-
this.updateProjectStats(project.hash);
|
|
417
|
-
}
|
|
418
|
-
return result.changes;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Vacuum database to reclaim space
|
|
422
|
-
*/
|
|
423
|
-
vacuum() {
|
|
424
|
-
this.db.exec("VACUUM");
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Close database
|
|
428
|
-
*/
|
|
429
|
-
close() {
|
|
430
|
-
this.db.close();
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Get database size in bytes
|
|
434
|
-
*/
|
|
435
|
-
getDatabaseSize() {
|
|
436
|
-
try {
|
|
437
|
-
const fs = require("node:fs");
|
|
438
|
-
const stats = fs.statSync(this.dbPath);
|
|
439
|
-
return stats.size;
|
|
440
|
-
} catch {
|
|
441
|
-
return 0;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Export contexts to JSON
|
|
446
|
-
*/
|
|
447
|
-
exportContexts(projectHash) {
|
|
448
|
-
return this.queryContexts({ projectHash });
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Import contexts from JSON
|
|
452
|
-
*/
|
|
453
|
-
importContexts(contexts) {
|
|
454
|
-
let imported = 0;
|
|
455
|
-
const stmt = this.db.prepare(`
|
|
456
|
-
INSERT OR REPLACE INTO contexts (
|
|
457
|
-
id, project_hash, content, compressed, algorithm, strategy,
|
|
458
|
-
original_tokens, compressed_tokens, compression_ratio,
|
|
459
|
-
metadata, timestamp, last_accessed, access_count
|
|
460
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
461
|
-
`);
|
|
462
|
-
for (const context of contexts) {
|
|
463
|
-
try {
|
|
464
|
-
stmt.run(
|
|
465
|
-
context.id,
|
|
466
|
-
context.projectHash,
|
|
467
|
-
context.content,
|
|
468
|
-
context.compressed,
|
|
469
|
-
context.algorithm,
|
|
470
|
-
context.strategy,
|
|
471
|
-
context.originalTokens,
|
|
472
|
-
context.compressedTokens,
|
|
473
|
-
context.compressionRatio,
|
|
474
|
-
context.metadata,
|
|
475
|
-
context.timestamp,
|
|
476
|
-
context.lastAccessed,
|
|
477
|
-
context.accessCount
|
|
478
|
-
);
|
|
479
|
-
imported++;
|
|
480
|
-
} catch {
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return imported;
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* Update last accessed time
|
|
487
|
-
*/
|
|
488
|
-
updateLastAccessed(contextId) {
|
|
489
|
-
const stmt = this.db.prepare(`
|
|
490
|
-
UPDATE contexts
|
|
491
|
-
SET last_accessed = ?, access_count = access_count + 1
|
|
492
|
-
WHERE id = ?
|
|
493
|
-
`);
|
|
494
|
-
stmt.run(Date.now(), contextId);
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Update project statistics
|
|
498
|
-
*/
|
|
499
|
-
updateProjectStats(projectHash) {
|
|
500
|
-
const stmt = this.db.prepare(`
|
|
501
|
-
UPDATE projects
|
|
502
|
-
SET
|
|
503
|
-
context_count = (SELECT COUNT(*) FROM contexts WHERE project_hash = ?),
|
|
504
|
-
total_tokens = (SELECT COALESCE(SUM(original_tokens), 0) FROM contexts WHERE project_hash = ?),
|
|
505
|
-
updated_at = ?
|
|
506
|
-
WHERE hash = ?
|
|
507
|
-
`);
|
|
508
|
-
stmt.run(projectHash, projectHash, Date.now(), projectHash);
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Convert database row to PersistedContext
|
|
512
|
-
*/
|
|
513
|
-
rowToContext(row) {
|
|
514
|
-
return {
|
|
515
|
-
id: row.id,
|
|
516
|
-
projectHash: row.project_hash,
|
|
517
|
-
content: row.content,
|
|
518
|
-
compressed: row.compressed,
|
|
519
|
-
algorithm: row.algorithm,
|
|
520
|
-
strategy: row.strategy,
|
|
521
|
-
originalTokens: row.original_tokens,
|
|
522
|
-
compressedTokens: row.compressed_tokens,
|
|
523
|
-
compressionRatio: row.compression_ratio,
|
|
524
|
-
metadata: row.metadata,
|
|
525
|
-
timestamp: row.timestamp,
|
|
526
|
-
lastAccessed: row.last_accessed,
|
|
527
|
-
accessCount: row.access_count
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* Save compression metric
|
|
532
|
-
*/
|
|
533
|
-
saveCompressionMetric(metric) {
|
|
534
|
-
const stmt = this.db.prepare(`
|
|
535
|
-
INSERT INTO compression_metrics (
|
|
536
|
-
project_hash, context_id, original_tokens, compressed_tokens,
|
|
537
|
-
compression_ratio, time_taken_ms, algorithm, strategy, timestamp
|
|
538
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
539
|
-
`);
|
|
540
|
-
stmt.run(
|
|
541
|
-
metric.projectHash,
|
|
542
|
-
metric.contextId,
|
|
543
|
-
metric.originalTokens,
|
|
544
|
-
metric.compressedTokens,
|
|
545
|
-
metric.compressionRatio,
|
|
546
|
-
metric.timeTakenMs,
|
|
547
|
-
metric.algorithm,
|
|
548
|
-
metric.strategy,
|
|
549
|
-
metric.timestamp
|
|
550
|
-
);
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* Get compression metrics statistics
|
|
554
|
-
*/
|
|
555
|
-
getCompressionMetricsStats(projectHash, options) {
|
|
556
|
-
const now = Date.now();
|
|
557
|
-
const sessionStart = now - 24 * 60 * 60 * 1e3;
|
|
558
|
-
const weekStart = now - 7 * 24 * 60 * 60 * 1e3;
|
|
559
|
-
const monthStart = now - 30 * 24 * 60 * 60 * 1e3;
|
|
560
|
-
let baseQuery = "SELECT * FROM compression_metrics WHERE 1=1";
|
|
561
|
-
const params = [];
|
|
562
|
-
if (projectHash) {
|
|
563
|
-
baseQuery += " AND project_hash = ?";
|
|
564
|
-
params.push(projectHash);
|
|
565
|
-
}
|
|
566
|
-
if (options?.startTime) {
|
|
567
|
-
baseQuery += " AND timestamp >= ?";
|
|
568
|
-
params.push(options.startTime);
|
|
569
|
-
}
|
|
570
|
-
if (options?.endTime) {
|
|
571
|
-
baseQuery += " AND timestamp <= ?";
|
|
572
|
-
params.push(options.endTime);
|
|
573
|
-
}
|
|
574
|
-
const stmt = this.db.prepare(baseQuery);
|
|
575
|
-
const metrics = stmt.all(...params);
|
|
576
|
-
const totalCompressions = metrics.length;
|
|
577
|
-
const totalOriginalTokens = metrics.reduce((sum, m) => sum + m.original_tokens, 0);
|
|
578
|
-
const totalCompressedTokens = metrics.reduce((sum, m) => sum + m.compressed_tokens, 0);
|
|
579
|
-
const totalTokensSaved = totalOriginalTokens - totalCompressedTokens;
|
|
580
|
-
const averageCompressionRatio = totalCompressions > 0 ? metrics.reduce((sum, m) => sum + m.compression_ratio, 0) / totalCompressions : 0;
|
|
581
|
-
const averageTimeTakenMs = totalCompressions > 0 ? metrics.reduce((sum, m) => sum + m.time_taken_ms, 0) / totalCompressions : 0;
|
|
582
|
-
const COST_PER_1K_TOKENS = 0.015;
|
|
583
|
-
const estimatedCostSavings = totalTokensSaved / 1e3 * COST_PER_1K_TOKENS;
|
|
584
|
-
const sessionMetrics = metrics.filter((m) => m.timestamp >= sessionStart);
|
|
585
|
-
const sessionTokensSaved = sessionMetrics.reduce(
|
|
586
|
-
(sum, m) => sum + (m.original_tokens - m.compressed_tokens),
|
|
587
|
-
0
|
|
588
|
-
);
|
|
589
|
-
const weeklyMetrics = metrics.filter((m) => m.timestamp >= weekStart);
|
|
590
|
-
const weeklyTokensSaved = weeklyMetrics.reduce(
|
|
591
|
-
(sum, m) => sum + (m.original_tokens - m.compressed_tokens),
|
|
592
|
-
0
|
|
593
|
-
);
|
|
594
|
-
const monthlyMetrics = metrics.filter((m) => m.timestamp >= monthStart);
|
|
595
|
-
const monthlyTokensSaved = monthlyMetrics.reduce(
|
|
596
|
-
(sum, m) => sum + (m.original_tokens - m.compressed_tokens),
|
|
597
|
-
0
|
|
598
|
-
);
|
|
599
|
-
return {
|
|
600
|
-
totalCompressions,
|
|
601
|
-
totalOriginalTokens,
|
|
602
|
-
totalCompressedTokens,
|
|
603
|
-
totalTokensSaved,
|
|
604
|
-
averageCompressionRatio,
|
|
605
|
-
averageTimeTakenMs,
|
|
606
|
-
estimatedCostSavings,
|
|
607
|
-
sessionStats: {
|
|
608
|
-
compressions: sessionMetrics.length,
|
|
609
|
-
tokensSaved: sessionTokensSaved,
|
|
610
|
-
costSavings: sessionTokensSaved / 1e3 * COST_PER_1K_TOKENS
|
|
611
|
-
},
|
|
612
|
-
weeklyStats: {
|
|
613
|
-
compressions: weeklyMetrics.length,
|
|
614
|
-
tokensSaved: weeklyTokensSaved,
|
|
615
|
-
costSavings: weeklyTokensSaved / 1e3 * COST_PER_1K_TOKENS
|
|
616
|
-
},
|
|
617
|
-
monthlyStats: {
|
|
618
|
-
compressions: monthlyMetrics.length,
|
|
619
|
-
tokensSaved: monthlyTokensSaved,
|
|
620
|
-
costSavings: monthlyTokensSaved / 1e3 * COST_PER_1K_TOKENS
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Get recent compression metrics
|
|
626
|
-
*/
|
|
627
|
-
getRecentCompressionMetrics(projectHash, limit = 10) {
|
|
628
|
-
let query = "SELECT * FROM compression_metrics";
|
|
629
|
-
const params = [];
|
|
630
|
-
if (projectHash) {
|
|
631
|
-
query += " WHERE project_hash = ?";
|
|
632
|
-
params.push(projectHash);
|
|
633
|
-
}
|
|
634
|
-
query += " ORDER BY timestamp DESC LIMIT ?";
|
|
635
|
-
params.push(limit);
|
|
636
|
-
const stmt = this.db.prepare(query);
|
|
637
|
-
const rows = stmt.all(...params);
|
|
638
|
-
return rows.map((row) => ({
|
|
639
|
-
id: row.id,
|
|
640
|
-
projectHash: row.project_hash,
|
|
641
|
-
contextId: row.context_id,
|
|
642
|
-
originalTokens: row.original_tokens,
|
|
643
|
-
compressedTokens: row.compressed_tokens,
|
|
644
|
-
compressionRatio: row.compression_ratio,
|
|
645
|
-
timeTakenMs: row.time_taken_ms,
|
|
646
|
-
algorithm: row.algorithm,
|
|
647
|
-
strategy: row.strategy,
|
|
648
|
-
timestamp: row.timestamp
|
|
649
|
-
}));
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Query compression metrics with optional filters
|
|
653
|
-
*/
|
|
654
|
-
getCompressionMetrics(projectHash, options) {
|
|
655
|
-
let query = "SELECT * FROM compression_metrics WHERE 1=1";
|
|
656
|
-
const params = [];
|
|
657
|
-
if (projectHash) {
|
|
658
|
-
query += " AND project_hash = ?";
|
|
659
|
-
params.push(projectHash);
|
|
660
|
-
}
|
|
661
|
-
if (options?.startTime) {
|
|
662
|
-
query += " AND timestamp >= ?";
|
|
663
|
-
params.push(options.startTime);
|
|
664
|
-
}
|
|
665
|
-
if (options?.endTime) {
|
|
666
|
-
query += " AND timestamp <= ?";
|
|
667
|
-
params.push(options.endTime);
|
|
668
|
-
}
|
|
669
|
-
query += ` ORDER BY timestamp ${(options?.sortOrder || "desc").toUpperCase()}`;
|
|
670
|
-
if (options?.limit) {
|
|
671
|
-
query += " LIMIT ?";
|
|
672
|
-
params.push(options.limit);
|
|
673
|
-
}
|
|
674
|
-
const stmt = this.db.prepare(query);
|
|
675
|
-
const rows = stmt.all(...params);
|
|
676
|
-
return rows.map((row) => ({
|
|
677
|
-
id: row.id,
|
|
678
|
-
projectHash: row.project_hash,
|
|
679
|
-
contextId: row.context_id,
|
|
680
|
-
originalTokens: row.original_tokens,
|
|
681
|
-
compressedTokens: row.compressed_tokens,
|
|
682
|
-
compressionRatio: row.compression_ratio,
|
|
683
|
-
timeTakenMs: row.time_taken_ms,
|
|
684
|
-
algorithm: row.algorithm,
|
|
685
|
-
strategy: row.strategy,
|
|
686
|
-
timestamp: row.timestamp
|
|
687
|
-
}));
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* Clean up old compression metrics
|
|
691
|
-
*/
|
|
692
|
-
cleanupCompressionMetrics(maxAge) {
|
|
693
|
-
const cutoff = Date.now() - maxAge;
|
|
694
|
-
const stmt = this.db.prepare("DELETE FROM compression_metrics WHERE timestamp < ?");
|
|
695
|
-
const result = stmt.run(cutoff);
|
|
696
|
-
return result.changes;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
let globalContextPersistence = null;
|
|
700
|
-
function getContextPersistence(dbPath) {
|
|
701
|
-
if (!globalContextPersistence) {
|
|
702
|
-
globalContextPersistence = new ContextPersistence(dbPath);
|
|
703
|
-
}
|
|
704
|
-
return globalContextPersistence;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
export { ContextPersistence, getContextPersistence };
|