ccjk 14.2.2 → 15.1.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 +75 -338
- package/dist/cli.js +89 -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 +165 -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 +42 -0
- package/dist/commands/menu.js.map +1 -0
- package/dist/commands/profile.js +138 -0
- package/dist/commands/profile.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/profiles.js +104 -0
- package/dist/core/profiles.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
package/dist/chunks/startup.mjs
DELETED
|
@@ -1,487 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync } from 'node:fs';
|
|
2
|
-
import { mkdir } from 'node:fs/promises';
|
|
3
|
-
import { homedir } from 'node:os';
|
|
4
|
-
import { j as join, b as basename } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
5
|
-
import { i18n } from './index2.mjs';
|
|
6
|
-
import 'node:process';
|
|
7
|
-
import 'node:url';
|
|
8
|
-
|
|
9
|
-
const DEFAULT_COMPACT_CONFIG = {
|
|
10
|
-
warningThreshold: 0.7,
|
|
11
|
-
// 70% 时警告
|
|
12
|
-
compactThreshold: 0.85,
|
|
13
|
-
// 85% 时建议清理
|
|
14
|
-
messageThreshold: 100,
|
|
15
|
-
// 100 条消息
|
|
16
|
-
planningMessageThreshold: 50,
|
|
17
|
-
// Plan 阶段 50 条消息
|
|
18
|
-
defaultMaxTokens: 2e5
|
|
19
|
-
// 200k tokens (Claude 3.5 Sonnet)
|
|
20
|
-
};
|
|
21
|
-
class CompactAdvisor {
|
|
22
|
-
config;
|
|
23
|
-
constructor(config = {}) {
|
|
24
|
-
this.config = { ...DEFAULT_COMPACT_CONFIG, ...config };
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* 检测是否需要建议 compact
|
|
28
|
-
*/
|
|
29
|
-
shouldSuggestCompact(context) {
|
|
30
|
-
const maxTokens = context.maxTokens || this.config.defaultMaxTokens;
|
|
31
|
-
const usagePercent = context.currentTokens / maxTokens;
|
|
32
|
-
if (usagePercent >= this.config.compactThreshold) {
|
|
33
|
-
return {
|
|
34
|
-
shouldCompact: true,
|
|
35
|
-
reason: "token_threshold",
|
|
36
|
-
message: this.getTokenThresholdMessage(usagePercent, context.currentTokens, maxTokens),
|
|
37
|
-
usagePercent,
|
|
38
|
-
estimatedSavings: Math.floor(context.currentTokens * 0.6),
|
|
39
|
-
// 预计节省 60%
|
|
40
|
-
suggestedActions: this.getSuggestedActions("token_threshold")
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
if (context.messageCount >= this.config.messageThreshold) {
|
|
44
|
-
return {
|
|
45
|
-
shouldCompact: true,
|
|
46
|
-
reason: "message_threshold",
|
|
47
|
-
message: this.getMessageThresholdMessage(context.messageCount),
|
|
48
|
-
usagePercent,
|
|
49
|
-
estimatedSavings: Math.floor(context.currentTokens * 0.5),
|
|
50
|
-
suggestedActions: this.getSuggestedActions("message_threshold")
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
if (usagePercent >= this.config.warningThreshold) {
|
|
54
|
-
return {
|
|
55
|
-
shouldCompact: false,
|
|
56
|
-
message: this.getWarningMessage(usagePercent, context.currentTokens, maxTokens),
|
|
57
|
-
usagePercent,
|
|
58
|
-
suggestedActions: []
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
shouldCompact: false,
|
|
63
|
-
message: this.getHealthyMessage(usagePercent),
|
|
64
|
-
usagePercent,
|
|
65
|
-
suggestedActions: []
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 检测 Plan 阶段完成
|
|
70
|
-
*/
|
|
71
|
-
detectPlanCompletion(planContent) {
|
|
72
|
-
const completionPatterns = [
|
|
73
|
-
/##\s*(实施计划|Implementation Plan|执行计划)/i,
|
|
74
|
-
/##\s*(任务(清单|列表)|Task List|Tasks)/i,
|
|
75
|
-
/##\s*(验收标准|Acceptance Criteria)/i,
|
|
76
|
-
/✅\s*(规划完成|Plan Complete|Planning Complete)/i,
|
|
77
|
-
/---[\t\v\f\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n\s*💡\s*(下一步|Next Step)/i
|
|
78
|
-
];
|
|
79
|
-
return completionPatterns.some((pattern) => pattern.test(planContent));
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* 生成 Plan 完成后的建议
|
|
83
|
-
*/
|
|
84
|
-
generatePlanCompleteSuggestion(plan, context) {
|
|
85
|
-
const maxTokens = context.maxTokens || this.config.defaultMaxTokens;
|
|
86
|
-
const usagePercent = context.currentTokens / maxTokens;
|
|
87
|
-
const planningMessages = context.planningMessageCount || 0;
|
|
88
|
-
const shouldCompact = planningMessages >= this.config.planningMessageThreshold || usagePercent >= 0.3;
|
|
89
|
-
return {
|
|
90
|
-
shouldCompact,
|
|
91
|
-
reason: "plan_complete",
|
|
92
|
-
message: this.getPlanCompleteMessage(plan, context, usagePercent),
|
|
93
|
-
usagePercent,
|
|
94
|
-
estimatedSavings: Math.floor(context.currentTokens * 0.7),
|
|
95
|
-
// Plan 阶段可节省 70%
|
|
96
|
-
suggestedActions: this.getSuggestedActions("plan_complete")
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* 生成建议输出(用于显示给用户)
|
|
101
|
-
*/
|
|
102
|
-
generateSuggestionOutput(suggestion, planPath) {
|
|
103
|
-
const lines = [];
|
|
104
|
-
const isZh = i18n.language === "zh-CN";
|
|
105
|
-
lines.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
|
|
106
|
-
if (suggestion.reason === "plan_complete") {
|
|
107
|
-
lines.push(isZh ? "\u2705 \u89C4\u5212\u5B8C\u6210\uFF01" : "\u2705 Planning Complete!");
|
|
108
|
-
} else if (suggestion.shouldCompact) {
|
|
109
|
-
lines.push(isZh ? "\u26A0\uFE0F \u4E0A\u4E0B\u6587\u4F7F\u7528\u7387\u8F83\u9AD8" : "\u26A0\uFE0F High Context Usage");
|
|
110
|
-
} else {
|
|
111
|
-
lines.push(isZh ? "\u{1F4CA} \u4E0A\u4E0B\u6587\u72B6\u6001" : "\u{1F4CA} Context Status");
|
|
112
|
-
}
|
|
113
|
-
lines.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
|
|
114
|
-
lines.push("");
|
|
115
|
-
if (planPath) {
|
|
116
|
-
lines.push(isZh ? `\u{1F4C4} Plan \u5DF2\u4FDD\u5B58: ${planPath}` : `\u{1F4C4} Plan saved: ${planPath}`);
|
|
117
|
-
lines.push("");
|
|
118
|
-
}
|
|
119
|
-
lines.push(isZh ? "\u{1F4CA} \u5F53\u524D\u4E0A\u4E0B\u6587\u72B6\u6001:" : "\u{1F4CA} Current context status:");
|
|
120
|
-
lines.push(` \u2022 Token ${isZh ? "\u4F7F\u7528" : "usage"}: ${(suggestion.usagePercent * 100).toFixed(1)}%`);
|
|
121
|
-
if (suggestion.estimatedSavings) {
|
|
122
|
-
lines.push(` \u2022 ${isZh ? "\u9884\u8BA1\u53EF\u8282\u7701" : "Estimated savings"}: ~${this.formatTokens(suggestion.estimatedSavings)} tokens`);
|
|
123
|
-
}
|
|
124
|
-
lines.push("");
|
|
125
|
-
lines.push(suggestion.message);
|
|
126
|
-
lines.push("");
|
|
127
|
-
if (suggestion.shouldCompact && suggestion.suggestedActions.length > 0) {
|
|
128
|
-
lines.push(isZh ? "\u{1F4A1} \u5EFA\u8BAE\u64CD\u4F5C:" : "\u{1F4A1} Suggested actions:");
|
|
129
|
-
lines.push("");
|
|
130
|
-
for (let i = 0; i < suggestion.suggestedActions.length; i++) {
|
|
131
|
-
lines.push(` [${i + 1}] ${suggestion.suggestedActions[i]}`);
|
|
132
|
-
}
|
|
133
|
-
lines.push("");
|
|
134
|
-
}
|
|
135
|
-
lines.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
|
|
136
|
-
return lines.join("\n");
|
|
137
|
-
}
|
|
138
|
-
// ==========================================================================
|
|
139
|
-
// Private Helpers
|
|
140
|
-
// ==========================================================================
|
|
141
|
-
getTokenThresholdMessage(usagePercent, current, max) {
|
|
142
|
-
const isZh = i18n.language === "zh-CN";
|
|
143
|
-
const percent = (usagePercent * 100).toFixed(1);
|
|
144
|
-
if (isZh) {
|
|
145
|
-
return `\u4E0A\u4E0B\u6587\u4F7F\u7528\u7387\u5DF2\u8FBE ${percent}%\uFF08${this.formatTokens(current)} / ${this.formatTokens(max)}\uFF09\uFF0C\u5EFA\u8BAE\u6E05\u7406\u4EE5\u907F\u514D\u6027\u80FD\u4E0B\u964D\u3002`;
|
|
146
|
-
}
|
|
147
|
-
return `Context usage at ${percent}% (${this.formatTokens(current)} / ${this.formatTokens(max)}). Consider clearing to maintain performance.`;
|
|
148
|
-
}
|
|
149
|
-
getMessageThresholdMessage(count) {
|
|
150
|
-
const isZh = i18n.language === "zh-CN";
|
|
151
|
-
if (isZh) {
|
|
152
|
-
return `\u5F53\u524D\u4F1A\u8BDD\u5DF2\u6709 ${count} \u6761\u6D88\u606F\uFF0C\u5EFA\u8BAE\u6E05\u7406\u4EE5\u4FDD\u6301\u54CD\u5E94\u8D28\u91CF\u3002`;
|
|
153
|
-
}
|
|
154
|
-
return `Current session has ${count} messages. Consider clearing to maintain response quality.`;
|
|
155
|
-
}
|
|
156
|
-
getWarningMessage(usagePercent, _current, _max) {
|
|
157
|
-
const isZh = i18n.language === "zh-CN";
|
|
158
|
-
const percent = (usagePercent * 100).toFixed(1);
|
|
159
|
-
if (isZh) {
|
|
160
|
-
return `\u26A0\uFE0F \u4E0A\u4E0B\u6587\u4F7F\u7528\u7387 ${percent}%\uFF0C\u63A5\u8FD1\u9608\u503C\u3002\u7EE7\u7EED\u5DE5\u4F5C\u65F6\u8BF7\u6CE8\u610F\u3002`;
|
|
161
|
-
}
|
|
162
|
-
return `\u26A0\uFE0F Context usage at ${percent}%, approaching threshold. Monitor as you continue.`;
|
|
163
|
-
}
|
|
164
|
-
getHealthyMessage(usagePercent) {
|
|
165
|
-
const isZh = i18n.language === "zh-CN";
|
|
166
|
-
const percent = (usagePercent * 100).toFixed(1);
|
|
167
|
-
if (isZh) {
|
|
168
|
-
return `\u2705 \u4E0A\u4E0B\u6587\u72B6\u6001\u826F\u597D\uFF08${percent}%\uFF09\uFF0C\u65E0\u9700\u6E05\u7406\u3002`;
|
|
169
|
-
}
|
|
170
|
-
return `\u2705 Context is healthy (${percent}%), no action needed.`;
|
|
171
|
-
}
|
|
172
|
-
getPlanCompleteMessage(plan, _context, _usagePercent) {
|
|
173
|
-
const isZh = i18n.language === "zh-CN";
|
|
174
|
-
if (isZh) {
|
|
175
|
-
return `Claude Code \u65B0\u529F\u80FD\u652F\u6301\u5728\u63A5\u53D7\u8BA1\u5212\u540E\u81EA\u52A8\u6E05\u7A7A\u4E0A\u4E0B\u6587\uFF0C
|
|
176
|
-
\u8FD9\u80FD\u8BA9 Claude \u66F4\u4E13\u6CE8\u4E8E\u6267\u884C\uFF0C\u63D0\u5347\u4EFB\u52A1\u5B8C\u6210\u8D28\u91CF\u3002
|
|
177
|
-
|
|
178
|
-
Plan "${plan.name}" \u5DF2\u4FDD\u5B58\uFF0C\u60A8\u53EF\u4EE5\u9009\u62E9\uFF1A
|
|
179
|
-
|
|
180
|
-
\u{1F9F9} \u6E05\u7A7A\u4E0A\u4E0B\u6587\u5E76\u6267\u884C\uFF08\u63A8\u8350\uFF09
|
|
181
|
-
- \u81EA\u52A8\u6E05\u7406\u89C4\u5212\u9636\u6BB5\u7684\u8BA8\u8BBA
|
|
182
|
-
- \u4FDD\u7559 Plan \u6587\u6863\u4F5C\u4E3A\u6267\u884C\u4F9D\u636E
|
|
183
|
-
- \u83B7\u5F97\u5E72\u51C0\u7684\u4E0A\u4E0B\u6587\u7A97\u53E3
|
|
184
|
-
|
|
185
|
-
\u{1F4CE} \u4FDD\u7559\u4E0A\u4E0B\u6587\u5E76\u6267\u884C
|
|
186
|
-
- \u4FDD\u7559\u6240\u6709\u5386\u53F2\u5BF9\u8BDD
|
|
187
|
-
- \u9002\u5408\u9700\u8981\u53C2\u8003\u8BA8\u8BBA\u7EC6\u8282\u7684\u60C5\u51B5`;
|
|
188
|
-
}
|
|
189
|
-
return `Claude Code now supports automatically clearing context after accepting a plan.
|
|
190
|
-
This helps Claude stay focused and improves task completion quality.
|
|
191
|
-
|
|
192
|
-
Plan "${plan.name}" has been saved. You can choose:
|
|
193
|
-
|
|
194
|
-
\u{1F9F9} Clear context and execute (Recommended)
|
|
195
|
-
- Automatically clear planning discussions
|
|
196
|
-
- Keep Plan document as execution reference
|
|
197
|
-
- Get a fresh context window
|
|
198
|
-
|
|
199
|
-
\u{1F4CE} Keep context and execute
|
|
200
|
-
- Preserve all conversation history
|
|
201
|
-
- Suitable when you need to reference discussion details`;
|
|
202
|
-
}
|
|
203
|
-
getSuggestedActions(reason) {
|
|
204
|
-
const isZh = i18n.language === "zh-CN";
|
|
205
|
-
switch (reason) {
|
|
206
|
-
case "plan_complete":
|
|
207
|
-
return isZh ? [
|
|
208
|
-
"\u{1F9F9} \u6E05\u7A7A\u4E0A\u4E0B\u6587\u5E76\u6267\u884C (\u63A8\u8350) - \u4F7F\u7528 Claude Code Plan Mode \u7684\u6E05\u7A7A\u9009\u9879",
|
|
209
|
-
"\u{1F4CE} \u4FDD\u7559\u4E0A\u4E0B\u6587\u5E76\u6267\u884C - \u7EE7\u7EED\u5F53\u524D\u4F1A\u8BDD",
|
|
210
|
-
"\u{1F4BE} \u4EC5\u4FDD\u5B58 Plan - \u7A0D\u540E\u6267\u884C"
|
|
211
|
-
] : [
|
|
212
|
-
"\u{1F9F9} Clear context and execute (Recommended) - Use Claude Code Plan Mode clear option",
|
|
213
|
-
"\u{1F4CE} Keep context and execute - Continue current session",
|
|
214
|
-
"\u{1F4BE} Save Plan only - Execute later"
|
|
215
|
-
];
|
|
216
|
-
case "token_threshold":
|
|
217
|
-
case "message_threshold":
|
|
218
|
-
return isZh ? [
|
|
219
|
-
"\u6267\u884C /compact \u538B\u7F29\u4E0A\u4E0B\u6587",
|
|
220
|
-
"\u5F00\u59CB\u65B0\u4F1A\u8BDD",
|
|
221
|
-
"\u4FDD\u5B58\u5F53\u524D\u8FDB\u5EA6\u540E\u6E05\u7406"
|
|
222
|
-
] : [
|
|
223
|
-
"Run /compact to compress context",
|
|
224
|
-
"Start a new session",
|
|
225
|
-
"Save progress and clear"
|
|
226
|
-
];
|
|
227
|
-
default:
|
|
228
|
-
return [];
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
formatTokens(tokens) {
|
|
232
|
-
if (tokens >= 1e6) {
|
|
233
|
-
return `${(tokens / 1e6).toFixed(1)}M`;
|
|
234
|
-
}
|
|
235
|
-
if (tokens >= 1e3) {
|
|
236
|
-
return `${(tokens / 1e3).toFixed(1)}k`;
|
|
237
|
-
}
|
|
238
|
-
return tokens.toString();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
let instance$1 = null;
|
|
242
|
-
function getCompactAdvisor(config) {
|
|
243
|
-
if (!instance$1) {
|
|
244
|
-
instance$1 = new CompactAdvisor(config);
|
|
245
|
-
}
|
|
246
|
-
return instance$1;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
class PlanPersistenceManager {
|
|
250
|
-
baseDir;
|
|
251
|
-
projectPlanDir;
|
|
252
|
-
constructor(projectPath) {
|
|
253
|
-
this.baseDir = join(homedir(), ".ccjk", "plans");
|
|
254
|
-
const cwd = projectPath || process.cwd();
|
|
255
|
-
this.projectPlanDir = join(cwd, ".ccjk", "plan", "current");
|
|
256
|
-
this.ensureDirectories();
|
|
257
|
-
}
|
|
258
|
-
ensureDirectories() {
|
|
259
|
-
for (const dir of [this.baseDir, this.projectPlanDir]) {
|
|
260
|
-
if (!existsSync(dir)) {
|
|
261
|
-
mkdirSync(dir, { recursive: true });
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* 生成 Plan ID
|
|
267
|
-
*/
|
|
268
|
-
generateId() {
|
|
269
|
-
return `plan-${Date.now()}-${Math.random().toString(36).substring(2, 7)}`;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* 生成安全的文件名
|
|
273
|
-
*/
|
|
274
|
-
sanitizeFileName(name) {
|
|
275
|
-
return name.replace(/[<>:"/\\|?*]/g, "-").replace(/\s+/g, "-").replace(/-+/g, "-").substring(0, 50);
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* 保存 Plan 文档
|
|
279
|
-
*/
|
|
280
|
-
savePlan(plan, options = {}) {
|
|
281
|
-
const now = /* @__PURE__ */ new Date();
|
|
282
|
-
const id = this.generateId();
|
|
283
|
-
const document = {
|
|
284
|
-
...plan,
|
|
285
|
-
id,
|
|
286
|
-
createdAt: now,
|
|
287
|
-
updatedAt: now
|
|
288
|
-
};
|
|
289
|
-
const timestamp = now.toISOString().slice(0, 10).replace(/-/g, "");
|
|
290
|
-
const safeName = this.sanitizeFileName(plan.name);
|
|
291
|
-
const fileName = `${safeName}-${timestamp}.md`;
|
|
292
|
-
const projectFilePath = join(this.projectPlanDir, fileName);
|
|
293
|
-
this.writePlanFile(projectFilePath, document, options.overwrite);
|
|
294
|
-
const globalFilePath = join(this.baseDir, fileName);
|
|
295
|
-
this.writePlanFile(globalFilePath, document, true);
|
|
296
|
-
return document;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* 写入 Plan 文件
|
|
300
|
-
*/
|
|
301
|
-
writePlanFile(filePath, plan, overwrite = false) {
|
|
302
|
-
if (existsSync(filePath) && !overwrite) {
|
|
303
|
-
const ext = ".md";
|
|
304
|
-
const base = filePath.slice(0, -ext.length);
|
|
305
|
-
let counter = 1;
|
|
306
|
-
let newPath = `${base}-v${counter}${ext}`;
|
|
307
|
-
while (existsSync(newPath)) {
|
|
308
|
-
counter++;
|
|
309
|
-
newPath = `${base}-v${counter}${ext}`;
|
|
310
|
-
}
|
|
311
|
-
filePath = newPath;
|
|
312
|
-
}
|
|
313
|
-
const content = this.buildPlanMarkdown(plan);
|
|
314
|
-
writeFileSync(filePath, content, "utf-8");
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* 构建 Plan Markdown 内容
|
|
318
|
-
*/
|
|
319
|
-
buildPlanMarkdown(plan) {
|
|
320
|
-
const lines = [];
|
|
321
|
-
lines.push("---");
|
|
322
|
-
lines.push(`id: ${plan.id}`);
|
|
323
|
-
lines.push(`name: ${plan.name}`);
|
|
324
|
-
lines.push(`created: ${plan.createdAt.toISOString()}`);
|
|
325
|
-
lines.push(`updated: ${plan.updatedAt.toISOString()}`);
|
|
326
|
-
if (plan.sessionId) {
|
|
327
|
-
lines.push(`session: ${plan.sessionId}`);
|
|
328
|
-
}
|
|
329
|
-
if (plan.sourceSkill) {
|
|
330
|
-
lines.push(`skill: ${plan.sourceSkill}`);
|
|
331
|
-
}
|
|
332
|
-
if (plan.metadata.tokenEstimate) {
|
|
333
|
-
lines.push(`tokens: ${plan.metadata.tokenEstimate}`);
|
|
334
|
-
}
|
|
335
|
-
lines.push("---");
|
|
336
|
-
lines.push("");
|
|
337
|
-
lines.push(plan.content);
|
|
338
|
-
if (plan.metadata.tasks && plan.metadata.tasks.length > 0) {
|
|
339
|
-
lines.push("");
|
|
340
|
-
lines.push("## \u4EFB\u52A1\u6E05\u5355");
|
|
341
|
-
lines.push("");
|
|
342
|
-
for (const task of plan.metadata.tasks) {
|
|
343
|
-
const checkbox = task.completed ? "[x]" : "[ ]";
|
|
344
|
-
const priority = task.priority ? ` (${task.priority})` : "";
|
|
345
|
-
lines.push(`- ${checkbox} ${task.title}${priority}`);
|
|
346
|
-
if (task.description) {
|
|
347
|
-
lines.push(` - ${task.description}`);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
if (plan.metadata.keyDecisions && plan.metadata.keyDecisions.length > 0) {
|
|
352
|
-
lines.push("");
|
|
353
|
-
lines.push("## \u5173\u952E\u51B3\u7B56");
|
|
354
|
-
lines.push("");
|
|
355
|
-
for (const decision of plan.metadata.keyDecisions) {
|
|
356
|
-
lines.push(`- ${decision}`);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
return lines.join("\n");
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* 读取 Plan 文档
|
|
363
|
-
*/
|
|
364
|
-
readPlan(fileName) {
|
|
365
|
-
let filePath = join(this.projectPlanDir, fileName);
|
|
366
|
-
if (!existsSync(filePath)) {
|
|
367
|
-
filePath = join(this.baseDir, fileName);
|
|
368
|
-
}
|
|
369
|
-
if (!existsSync(filePath)) {
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
return this.parsePlanFile(filePath);
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* 解析 Plan 文件
|
|
376
|
-
*/
|
|
377
|
-
parsePlanFile(filePath) {
|
|
378
|
-
try {
|
|
379
|
-
const content = readFileSync(filePath, "utf-8");
|
|
380
|
-
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
381
|
-
if (!frontmatterMatch) {
|
|
382
|
-
return {
|
|
383
|
-
id: basename(filePath, ".md"),
|
|
384
|
-
name: basename(filePath, ".md"),
|
|
385
|
-
content,
|
|
386
|
-
createdAt: /* @__PURE__ */ new Date(),
|
|
387
|
-
updatedAt: /* @__PURE__ */ new Date(),
|
|
388
|
-
metadata: {}
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
const frontmatter = frontmatterMatch[1];
|
|
392
|
-
const body = frontmatterMatch[2];
|
|
393
|
-
const meta = {};
|
|
394
|
-
for (const line of frontmatter.split("\n")) {
|
|
395
|
-
const match = line.match(/^(\w+):\s*(.*)$/);
|
|
396
|
-
if (match) {
|
|
397
|
-
meta[match[1]] = match[2];
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return {
|
|
401
|
-
id: meta.id || basename(filePath, ".md"),
|
|
402
|
-
name: meta.name || basename(filePath, ".md"),
|
|
403
|
-
content: body.trim(),
|
|
404
|
-
sessionId: meta.session,
|
|
405
|
-
sourceSkill: meta.skill,
|
|
406
|
-
createdAt: meta.created ? new Date(meta.created) : /* @__PURE__ */ new Date(),
|
|
407
|
-
updatedAt: meta.updated ? new Date(meta.updated) : /* @__PURE__ */ new Date(),
|
|
408
|
-
metadata: {
|
|
409
|
-
tokenEstimate: meta.tokens ? Number.parseInt(meta.tokens, 10) : void 0
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
} catch {
|
|
413
|
-
return null;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* 列出所有 Plan 文档
|
|
418
|
-
*/
|
|
419
|
-
listPlans(location = "project") {
|
|
420
|
-
const plans = [];
|
|
421
|
-
if (location === "project" || location === "all") {
|
|
422
|
-
if (existsSync(this.projectPlanDir)) {
|
|
423
|
-
const files = readdirSync(this.projectPlanDir).filter((f) => f.endsWith(".md"));
|
|
424
|
-
plans.push(...files.map((f) => join(this.projectPlanDir, f)));
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
if (location === "global" || location === "all") {
|
|
428
|
-
if (existsSync(this.baseDir)) {
|
|
429
|
-
const files = readdirSync(this.baseDir).filter((f) => f.endsWith(".md"));
|
|
430
|
-
plans.push(...files.map((f) => join(this.baseDir, f)));
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
return plans;
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* 获取最新的 Plan 文档
|
|
437
|
-
*/
|
|
438
|
-
getLatestPlan() {
|
|
439
|
-
const plans = this.listPlans("project");
|
|
440
|
-
if (plans.length === 0) {
|
|
441
|
-
return null;
|
|
442
|
-
}
|
|
443
|
-
const sorted = plans.map((p) => {
|
|
444
|
-
const doc = this.parsePlanFile(p);
|
|
445
|
-
return doc ? { path: p, doc } : null;
|
|
446
|
-
}).filter((p) => p !== null).sort((a, b) => b.doc.updatedAt.getTime() - a.doc.updatedAt.getTime());
|
|
447
|
-
return sorted[0]?.doc || null;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* 获取项目 Plan 目录路径
|
|
451
|
-
*/
|
|
452
|
-
getProjectPlanDir() {
|
|
453
|
-
return this.projectPlanDir;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
let instance = null;
|
|
457
|
-
function getPlanPersistenceManager(projectPath) {
|
|
458
|
-
if (!instance) {
|
|
459
|
-
instance = new PlanPersistenceManager(projectPath);
|
|
460
|
-
}
|
|
461
|
-
return instance;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
const PLAN_DIRECTORIES = [
|
|
465
|
-
".ccjk/plan/current",
|
|
466
|
-
".ccjk/plan/archive"
|
|
467
|
-
];
|
|
468
|
-
const GLOBAL_PLAN_DIR = join(homedir(), ".ccjk", "plans");
|
|
469
|
-
async function initializeContextFeatures() {
|
|
470
|
-
try {
|
|
471
|
-
if (!existsSync(GLOBAL_PLAN_DIR)) {
|
|
472
|
-
await mkdir(GLOBAL_PLAN_DIR, { recursive: true });
|
|
473
|
-
}
|
|
474
|
-
const cwd = process.cwd();
|
|
475
|
-
for (const dir of PLAN_DIRECTORIES) {
|
|
476
|
-
const fullPath = join(cwd, dir);
|
|
477
|
-
if (!existsSync(fullPath)) {
|
|
478
|
-
await mkdir(fullPath, { recursive: true });
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
getCompactAdvisor();
|
|
482
|
-
getPlanPersistenceManager();
|
|
483
|
-
} catch {
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
export { initializeContextFeatures };
|
package/dist/chunks/stats.mjs
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import a from './index5.mjs';
|
|
2
|
-
import { i18n } from './index2.mjs';
|
|
3
|
-
import { g as getStatsStorage } from '../shared/ccjk.OTnevPNE.mjs';
|
|
4
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
5
|
-
import 'node:fs';
|
|
6
|
-
import 'node:process';
|
|
7
|
-
import 'node:url';
|
|
8
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
9
|
-
import 'node:os';
|
|
10
|
-
|
|
11
|
-
async function stats(options = {}) {
|
|
12
|
-
const period = options.period || "7d";
|
|
13
|
-
const format = options.format || "table";
|
|
14
|
-
const storage = getStatsStorage();
|
|
15
|
-
const { startDate, endDate } = storage.getDateRangeForPeriod(period);
|
|
16
|
-
const records = storage.getRecordsByDateRange(startDate, endDate);
|
|
17
|
-
if (records.length === 0) {
|
|
18
|
-
console.log(a.yellow(`
|
|
19
|
-
${i18n.t("stats:noData")}
|
|
20
|
-
`));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const filteredRecords = options.provider ? records.filter((r) => r.provider === options.provider) : records;
|
|
24
|
-
if (filteredRecords.length === 0) {
|
|
25
|
-
console.log(a.yellow(`
|
|
26
|
-
${i18n.t("stats:noData")} for provider: ${options.provider}
|
|
27
|
-
`));
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const stats2 = calculateStats(filteredRecords);
|
|
31
|
-
if (format === "json") {
|
|
32
|
-
console.log(JSON.stringify(stats2, null, 2));
|
|
33
|
-
} else if (format === "csv") {
|
|
34
|
-
displayCSV(stats2);
|
|
35
|
-
} else {
|
|
36
|
-
displayTable(stats2, period);
|
|
37
|
-
}
|
|
38
|
-
if (options.export) {
|
|
39
|
-
await exportStats(stats2, options.export, format);
|
|
40
|
-
console.log(a.green(`
|
|
41
|
-
${i18n.t("stats:exportSuccess")}: ${options.export}
|
|
42
|
-
`));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function calculateStats(records) {
|
|
46
|
-
const totalRequests = records.length;
|
|
47
|
-
const successfulRequests = records.filter((r) => r.success).length;
|
|
48
|
-
const successRate = totalRequests > 0 ? successfulRequests / totalRequests * 100 : 0;
|
|
49
|
-
let totalInputTokens = 0;
|
|
50
|
-
let totalOutputTokens = 0;
|
|
51
|
-
let totalCost = 0;
|
|
52
|
-
let totalLatency = 0;
|
|
53
|
-
const providerCounts = {};
|
|
54
|
-
const modelCounts = {};
|
|
55
|
-
for (const record of records) {
|
|
56
|
-
totalInputTokens += record.inputTokens || 0;
|
|
57
|
-
totalOutputTokens += record.outputTokens || 0;
|
|
58
|
-
totalCost += record.cost || 0;
|
|
59
|
-
totalLatency += record.latency || 0;
|
|
60
|
-
const provider = record.provider || "unknown";
|
|
61
|
-
providerCounts[provider] = (providerCounts[provider] || 0) + 1;
|
|
62
|
-
const model = record.model || "unknown";
|
|
63
|
-
modelCounts[model] = (modelCounts[model] || 0) + 1;
|
|
64
|
-
}
|
|
65
|
-
const averageLatency = totalRequests > 0 ? totalLatency / totalRequests : 0;
|
|
66
|
-
return {
|
|
67
|
-
totalRequests,
|
|
68
|
-
successfulRequests,
|
|
69
|
-
failedRequests: totalRequests - successfulRequests,
|
|
70
|
-
successRate,
|
|
71
|
-
totalInputTokens,
|
|
72
|
-
totalOutputTokens,
|
|
73
|
-
totalTokens: totalInputTokens + totalOutputTokens,
|
|
74
|
-
totalCost,
|
|
75
|
-
averageLatency,
|
|
76
|
-
providerCounts,
|
|
77
|
-
modelCounts
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function displayTable(stats2, period) {
|
|
81
|
-
console.log(a.cyan.bold(`
|
|
82
|
-
\u{1F4CA} ${i18n.t("stats:title")} - ${i18n.t(`stats:period.${period}`)}`));
|
|
83
|
-
console.log(a.dim("\u2500".repeat(60)));
|
|
84
|
-
console.log(a.yellow("\n\u{1F4C8} Request Statistics:"));
|
|
85
|
-
console.log(` ${i18n.t("stats:totalRequests")}: ${a.bold(stats2.totalRequests.toLocaleString())}`);
|
|
86
|
-
console.log(` ${a.green("\u2713")} Successful: ${a.bold(stats2.successfulRequests.toLocaleString())}`);
|
|
87
|
-
console.log(` ${a.red("\u2717")} Failed: ${a.bold(stats2.failedRequests.toLocaleString())}`);
|
|
88
|
-
console.log(` ${i18n.t("stats:successRate")}: ${a.bold(stats2.successRate.toFixed(2))}%`);
|
|
89
|
-
console.log(a.yellow("\n\u{1F3AF} Token Usage:"));
|
|
90
|
-
console.log(` ${i18n.t("stats:input")}: ${a.bold(stats2.totalInputTokens.toLocaleString())}`);
|
|
91
|
-
console.log(` ${i18n.t("stats:output")}: ${a.bold(stats2.totalOutputTokens.toLocaleString())}`);
|
|
92
|
-
console.log(` ${i18n.t("stats:totalTokens")}: ${a.bold(stats2.totalTokens.toLocaleString())}`);
|
|
93
|
-
console.log(a.yellow("\n\u{1F4B0} Cost Analysis:"));
|
|
94
|
-
console.log(` ${i18n.t("stats:estimatedCost")}: ${a.bold(`$${stats2.totalCost.toFixed(4)}`)}`);
|
|
95
|
-
console.log(a.yellow("\n\u26A1 Performance:"));
|
|
96
|
-
console.log(` ${i18n.t("stats:averageLatency")}: ${a.bold(stats2.averageLatency.toFixed(0))}ms`);
|
|
97
|
-
if (Object.keys(stats2.providerCounts).length > 0) {
|
|
98
|
-
console.log(a.yellow(`
|
|
99
|
-
\u2601\uFE0F ${i18n.t("stats:providerDistribution")}:`));
|
|
100
|
-
for (const [provider, count] of Object.entries(stats2.providerCounts)) {
|
|
101
|
-
const percentage = (count / stats2.totalRequests * 100).toFixed(1);
|
|
102
|
-
console.log(` ${provider}: ${a.bold(count)} (${percentage}%)`);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (Object.keys(stats2.modelCounts).length > 0) {
|
|
106
|
-
console.log(a.yellow("\n\u{1F916} Model Distribution:"));
|
|
107
|
-
for (const [model, count] of Object.entries(stats2.modelCounts)) {
|
|
108
|
-
const percentage = (count / stats2.totalRequests * 100).toFixed(1);
|
|
109
|
-
console.log(` ${model}: ${a.bold(count)} (${percentage}%)`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
console.log(a.dim(`
|
|
113
|
-
${"\u2500".repeat(60)}
|
|
114
|
-
`));
|
|
115
|
-
}
|
|
116
|
-
function displayCSV(stats2) {
|
|
117
|
-
console.log("metric,value");
|
|
118
|
-
console.log(`total_requests,${stats2.totalRequests}`);
|
|
119
|
-
console.log(`successful_requests,${stats2.successfulRequests}`);
|
|
120
|
-
console.log(`failed_requests,${stats2.failedRequests}`);
|
|
121
|
-
console.log(`success_rate,${stats2.successRate.toFixed(2)}`);
|
|
122
|
-
console.log(`total_input_tokens,${stats2.totalInputTokens}`);
|
|
123
|
-
console.log(`total_output_tokens,${stats2.totalOutputTokens}`);
|
|
124
|
-
console.log(`total_tokens,${stats2.totalTokens}`);
|
|
125
|
-
console.log(`total_cost,${stats2.totalCost.toFixed(4)}`);
|
|
126
|
-
console.log(`average_latency,${stats2.averageLatency.toFixed(0)}`);
|
|
127
|
-
}
|
|
128
|
-
async function exportStats(stats2, filePath, format) {
|
|
129
|
-
const { writeFileSync } = await import('node:fs');
|
|
130
|
-
let content;
|
|
131
|
-
if (format === "json") {
|
|
132
|
-
content = JSON.stringify(stats2, null, 2);
|
|
133
|
-
} else if (format === "csv") {
|
|
134
|
-
const lines = [
|
|
135
|
-
"metric,value",
|
|
136
|
-
`total_requests,${stats2.totalRequests}`,
|
|
137
|
-
`successful_requests,${stats2.successfulRequests}`,
|
|
138
|
-
`failed_requests,${stats2.failedRequests}`,
|
|
139
|
-
`success_rate,${stats2.successRate.toFixed(2)}`,
|
|
140
|
-
`total_input_tokens,${stats2.totalInputTokens}`,
|
|
141
|
-
`total_output_tokens,${stats2.totalOutputTokens}`,
|
|
142
|
-
`total_tokens,${stats2.totalTokens}`,
|
|
143
|
-
`total_cost,${stats2.totalCost.toFixed(4)}`,
|
|
144
|
-
`average_latency,${stats2.averageLatency.toFixed(0)}`
|
|
145
|
-
];
|
|
146
|
-
content = lines.join("\n");
|
|
147
|
-
} else {
|
|
148
|
-
content = JSON.stringify(stats2, null, 2);
|
|
149
|
-
}
|
|
150
|
-
writeFileSync(filePath, content, "utf-8");
|
|
151
|
-
}
|
|
152
|
-
async function listStatsDates() {
|
|
153
|
-
const storage = getStatsStorage();
|
|
154
|
-
const dates = storage.getAvailableDates();
|
|
155
|
-
if (dates.length === 0) {
|
|
156
|
-
console.log(a.yellow("\nNo statistics data available\n"));
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
console.log(a.cyan.bold("\n\u{1F4C5} Available Statistics Dates:"));
|
|
160
|
-
console.log(a.dim("\u2500".repeat(40)));
|
|
161
|
-
for (const date of dates) {
|
|
162
|
-
const records = storage.getRecordsByDate(date);
|
|
163
|
-
console.log(` ${date}: ${a.bold(records.length)} requests`);
|
|
164
|
-
}
|
|
165
|
-
console.log(a.dim(`
|
|
166
|
-
${"\u2500".repeat(40)}
|
|
167
|
-
`));
|
|
168
|
-
}
|
|
169
|
-
async function storageStats() {
|
|
170
|
-
const storage = getStatsStorage();
|
|
171
|
-
const stats2 = storage.getStorageStats();
|
|
172
|
-
console.log(a.cyan.bold("\n\u{1F4BE} Storage Statistics:"));
|
|
173
|
-
console.log(a.dim("\u2500".repeat(40)));
|
|
174
|
-
console.log(` Total record files: ${a.bold(stats2.totalRecordFiles)}`);
|
|
175
|
-
console.log(` Total daily files: ${a.bold(stats2.totalDailyFiles)}`);
|
|
176
|
-
console.log(` Total records: ${a.bold(stats2.totalRecords.toLocaleString())}`);
|
|
177
|
-
console.log(` Oldest date: ${a.bold(stats2.oldestDate || "N/A")}`);
|
|
178
|
-
console.log(` Newest date: ${a.bold(stats2.newestDate || "N/A")}`);
|
|
179
|
-
console.log(a.dim(`
|
|
180
|
-
${"\u2500".repeat(40)}
|
|
181
|
-
`));
|
|
182
|
-
}
|
|
183
|
-
async function cleanupStats(daysToKeep = 90) {
|
|
184
|
-
const storage = getStatsStorage();
|
|
185
|
-
const deletedCount = storage.cleanupOldRecords(daysToKeep);
|
|
186
|
-
console.log(a.green(`
|
|
187
|
-
\u2713 Cleanup complete: ${deletedCount} old records marked for deletion
|
|
188
|
-
`));
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export { cleanupStats, listStatsDates, stats, storageStats };
|