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/context.mjs
DELETED
|
@@ -1,974 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile, access, readFile, readdir, stat } from 'node:fs/promises';
|
|
2
|
-
import { d as dirname, j as join, r as relative } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
3
|
-
import { constants, existsSync, lstatSync, readFileSync, readdirSync } from 'node:fs';
|
|
4
|
-
import a from './index5.mjs';
|
|
5
|
-
import { getTranslation } from './index2.mjs';
|
|
6
|
-
import { inspectMemoryFiles } from './memory-sync.mjs';
|
|
7
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
8
|
-
import 'node:process';
|
|
9
|
-
import 'node:url';
|
|
10
|
-
import 'node:path';
|
|
11
|
-
import './memory-paths.mjs';
|
|
12
|
-
import '../shared/ccjk.BBtCGd_g.mjs';
|
|
13
|
-
import './index3.mjs';
|
|
14
|
-
import './constants.mjs';
|
|
15
|
-
import 'node:os';
|
|
16
|
-
import './fs-operations.mjs';
|
|
17
|
-
import 'node:crypto';
|
|
18
|
-
|
|
19
|
-
function buildContextPack(intelligence, options = {}) {
|
|
20
|
-
const {
|
|
21
|
-
projectName = "Unknown Project",
|
|
22
|
-
projectDescription = "No description provided",
|
|
23
|
-
includeCommands = true,
|
|
24
|
-
includeRepoMap = true
|
|
25
|
-
} = options;
|
|
26
|
-
return {
|
|
27
|
-
projectIdentity: buildProjectIdentity(projectName, projectDescription, intelligence.stack),
|
|
28
|
-
stack: intelligence.stack,
|
|
29
|
-
commands: includeCommands ? intelligence.commands : [],
|
|
30
|
-
repoTopology: includeRepoMap ? buildRepoTopology(intelligence.repoMap) : "",
|
|
31
|
-
testPolicy: buildTestPolicy(intelligence.commands),
|
|
32
|
-
riskZones: identifyRiskZones(intelligence.repoMap),
|
|
33
|
-
retrievalInstructions: buildRetrievalInstructions(intelligence.stack),
|
|
34
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function buildProjectIdentity(name, description, stack) {
|
|
38
|
-
const parts = [
|
|
39
|
-
`Project: ${name}`,
|
|
40
|
-
`Description: ${description}`,
|
|
41
|
-
""
|
|
42
|
-
];
|
|
43
|
-
if (stack.languages.length > 0) {
|
|
44
|
-
parts.push(`Languages: ${stack.languages.join(", ")}`);
|
|
45
|
-
}
|
|
46
|
-
if (stack.frameworks.length > 0) {
|
|
47
|
-
const frameworkList = stack.frameworks.map((f) => `${f.name}${f.version ? ` ${f.version}` : ""}`).join(", ");
|
|
48
|
-
parts.push(`Frameworks: ${frameworkList}`);
|
|
49
|
-
}
|
|
50
|
-
if (stack.packageManager) {
|
|
51
|
-
parts.push(`Package Manager: ${stack.packageManager}`);
|
|
52
|
-
}
|
|
53
|
-
if (stack.runtime) {
|
|
54
|
-
parts.push(`Runtime: ${stack.runtime}`);
|
|
55
|
-
}
|
|
56
|
-
return parts.join("\n");
|
|
57
|
-
}
|
|
58
|
-
function buildRepoTopology(repoMap) {
|
|
59
|
-
const parts = ["Repository Structure:", ""];
|
|
60
|
-
const byType = /* @__PURE__ */ new Map();
|
|
61
|
-
for (const dir of repoMap.directories) {
|
|
62
|
-
const dirs = byType.get(dir.type) || [];
|
|
63
|
-
dirs.push(dir);
|
|
64
|
-
byType.set(dir.type, dirs);
|
|
65
|
-
}
|
|
66
|
-
const typeOrder = [
|
|
67
|
-
"source",
|
|
68
|
-
"test",
|
|
69
|
-
"config",
|
|
70
|
-
"docs",
|
|
71
|
-
"assets",
|
|
72
|
-
"other"
|
|
73
|
-
];
|
|
74
|
-
for (const type of typeOrder) {
|
|
75
|
-
const dirs = byType.get(type);
|
|
76
|
-
if (dirs && dirs.length > 0) {
|
|
77
|
-
parts.push(`${type.toUpperCase()}:`);
|
|
78
|
-
for (const dir of dirs.slice(0, 5)) {
|
|
79
|
-
parts.push(` - ${dir.relativePath} (${dir.fileCount} files)`);
|
|
80
|
-
}
|
|
81
|
-
parts.push("");
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
parts.push(`Total: ${repoMap.totalFiles} files`);
|
|
85
|
-
return parts.join("\n");
|
|
86
|
-
}
|
|
87
|
-
function buildTestPolicy(commands) {
|
|
88
|
-
const testCommands = commands.filter((c) => c.type === "test");
|
|
89
|
-
if (testCommands.length === 0) {
|
|
90
|
-
return "No test commands detected. Consider adding tests before making changes.";
|
|
91
|
-
}
|
|
92
|
-
const parts = [
|
|
93
|
-
"Test Policy:",
|
|
94
|
-
"",
|
|
95
|
-
"Available test commands:"
|
|
96
|
-
];
|
|
97
|
-
for (const cmd of testCommands) {
|
|
98
|
-
parts.push(` - ${cmd.name}: ${cmd.command}`);
|
|
99
|
-
}
|
|
100
|
-
parts.push("");
|
|
101
|
-
parts.push("Always run tests before committing changes.");
|
|
102
|
-
return parts.join("\n");
|
|
103
|
-
}
|
|
104
|
-
function identifyRiskZones(repoMap) {
|
|
105
|
-
const riskZones = [];
|
|
106
|
-
const buildDirs = repoMap.directories.filter((d) => d.type === "build");
|
|
107
|
-
for (const dir of buildDirs) {
|
|
108
|
-
riskZones.push(`${dir.relativePath} (generated files)`);
|
|
109
|
-
}
|
|
110
|
-
const largeDirs = repoMap.directories.filter((d) => d.fileCount > 100).sort((a, b) => b.fileCount - a.fileCount).slice(0, 3);
|
|
111
|
-
for (const dir of largeDirs) {
|
|
112
|
-
riskZones.push(`${dir.relativePath} (${dir.fileCount} files - high complexity)`);
|
|
113
|
-
}
|
|
114
|
-
return riskZones;
|
|
115
|
-
}
|
|
116
|
-
function buildRetrievalInstructions(stack) {
|
|
117
|
-
const parts = [
|
|
118
|
-
"Retrieval-First Instructions:",
|
|
119
|
-
""
|
|
120
|
-
];
|
|
121
|
-
if (stack.frameworks.length > 0) {
|
|
122
|
-
parts.push("For framework-specific questions:");
|
|
123
|
-
for (const framework of stack.frameworks) {
|
|
124
|
-
parts.push(` - ${framework.name}: Check local docs or official documentation for version ${framework.version || "latest"}`);
|
|
125
|
-
}
|
|
126
|
-
parts.push("");
|
|
127
|
-
}
|
|
128
|
-
parts.push("For repository conventions:");
|
|
129
|
-
parts.push(" - Check existing code patterns before implementing new features");
|
|
130
|
-
parts.push(" - Review test files to understand testing conventions");
|
|
131
|
-
parts.push(" - Consult configuration files for build and deployment settings");
|
|
132
|
-
return parts.join("\n");
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
async function writeClaudeContext(contextPack, outputPath) {
|
|
136
|
-
const content = formatClaudeContext(contextPack);
|
|
137
|
-
await mkdir(dirname(outputPath), { recursive: true });
|
|
138
|
-
await writeFile(outputPath, content, "utf-8");
|
|
139
|
-
}
|
|
140
|
-
function formatClaudeContext(pack) {
|
|
141
|
-
const sections = [];
|
|
142
|
-
sections.push("# CLAUDE.md");
|
|
143
|
-
sections.push("");
|
|
144
|
-
sections.push("This file provides guidance to Claude Code when working with code in this repository.");
|
|
145
|
-
sections.push("");
|
|
146
|
-
sections.push(`Generated: ${new Date(pack.generatedAt).toLocaleString()}`);
|
|
147
|
-
sections.push("");
|
|
148
|
-
sections.push("---");
|
|
149
|
-
sections.push("");
|
|
150
|
-
sections.push("## Project Information");
|
|
151
|
-
sections.push("");
|
|
152
|
-
sections.push(pack.projectIdentity);
|
|
153
|
-
sections.push("");
|
|
154
|
-
if (pack.stack.frameworks.length > 0) {
|
|
155
|
-
sections.push("## Technology Stack");
|
|
156
|
-
sections.push("");
|
|
157
|
-
for (const framework of pack.stack.frameworks) {
|
|
158
|
-
sections.push(`### ${framework.name}`);
|
|
159
|
-
if (framework.version) {
|
|
160
|
-
sections.push(`Version: ${framework.version}`);
|
|
161
|
-
}
|
|
162
|
-
sections.push(`Type: ${framework.type}`);
|
|
163
|
-
sections.push("");
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (pack.commands.length > 0) {
|
|
167
|
-
sections.push("## Available Commands");
|
|
168
|
-
sections.push("");
|
|
169
|
-
const commandsByType = /* @__PURE__ */ new Map();
|
|
170
|
-
for (const cmd of pack.commands) {
|
|
171
|
-
const cmds = commandsByType.get(cmd.type) || [];
|
|
172
|
-
cmds.push(cmd);
|
|
173
|
-
commandsByType.set(cmd.type, cmds);
|
|
174
|
-
}
|
|
175
|
-
for (const [type, commands] of commandsByType) {
|
|
176
|
-
sections.push(`### ${type.charAt(0).toUpperCase() + type.slice(1)}`);
|
|
177
|
-
sections.push("");
|
|
178
|
-
for (const cmd of commands) {
|
|
179
|
-
sections.push(`- \`${cmd.name}\`: ${cmd.command}`);
|
|
180
|
-
if (cmd.description) {
|
|
181
|
-
sections.push(` ${cmd.description}`);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
sections.push("");
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (pack.repoTopology) {
|
|
188
|
-
sections.push("## Repository Structure");
|
|
189
|
-
sections.push("");
|
|
190
|
-
sections.push(pack.repoTopology);
|
|
191
|
-
sections.push("");
|
|
192
|
-
}
|
|
193
|
-
if (pack.testPolicy) {
|
|
194
|
-
sections.push("## Testing");
|
|
195
|
-
sections.push("");
|
|
196
|
-
sections.push(pack.testPolicy);
|
|
197
|
-
sections.push("");
|
|
198
|
-
}
|
|
199
|
-
if (pack.riskZones.length > 0) {
|
|
200
|
-
sections.push("## Risk Zones");
|
|
201
|
-
sections.push("");
|
|
202
|
-
sections.push("Be cautious when modifying these areas:");
|
|
203
|
-
sections.push("");
|
|
204
|
-
for (const zone of pack.riskZones) {
|
|
205
|
-
sections.push(`- ${zone}`);
|
|
206
|
-
}
|
|
207
|
-
sections.push("");
|
|
208
|
-
}
|
|
209
|
-
if (pack.retrievalInstructions) {
|
|
210
|
-
sections.push("## Development Guidelines");
|
|
211
|
-
sections.push("");
|
|
212
|
-
sections.push(pack.retrievalInstructions);
|
|
213
|
-
sections.push("");
|
|
214
|
-
}
|
|
215
|
-
return sections.join("\n");
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
async function detectCommands(projectRoot = ".") {
|
|
219
|
-
const commands = [];
|
|
220
|
-
const packageJsonPath = join(projectRoot, "package.json");
|
|
221
|
-
if (await fileExists$1(packageJsonPath)) {
|
|
222
|
-
commands.push(...await detectNpmScripts(packageJsonPath));
|
|
223
|
-
}
|
|
224
|
-
const makefilePath = join(projectRoot, "Makefile");
|
|
225
|
-
if (await fileExists$1(makefilePath)) {
|
|
226
|
-
commands.push(...await detectMakeTargets(makefilePath));
|
|
227
|
-
}
|
|
228
|
-
const pyprojectPath = join(projectRoot, "pyproject.toml");
|
|
229
|
-
if (await fileExists$1(pyprojectPath)) {
|
|
230
|
-
commands.push(...await detectPoetryScripts(pyprojectPath));
|
|
231
|
-
}
|
|
232
|
-
return commands;
|
|
233
|
-
}
|
|
234
|
-
async function detectNpmScripts(packageJsonPath) {
|
|
235
|
-
const commands = [];
|
|
236
|
-
try {
|
|
237
|
-
const content = await readFile(packageJsonPath, "utf-8");
|
|
238
|
-
const packageJson = JSON.parse(content);
|
|
239
|
-
if (packageJson.scripts) {
|
|
240
|
-
for (const [name, command] of Object.entries(packageJson.scripts)) {
|
|
241
|
-
commands.push({
|
|
242
|
-
name,
|
|
243
|
-
command,
|
|
244
|
-
type: inferCommandType(name)
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
} catch {
|
|
249
|
-
}
|
|
250
|
-
return commands;
|
|
251
|
-
}
|
|
252
|
-
async function detectMakeTargets(makefilePath) {
|
|
253
|
-
const commands = [];
|
|
254
|
-
try {
|
|
255
|
-
const content = await readFile(makefilePath, "utf-8");
|
|
256
|
-
const lines = content.split("\n");
|
|
257
|
-
for (const line of lines) {
|
|
258
|
-
const match = line.match(/^([\w-]+):\s*(.*)/);
|
|
259
|
-
if (match) {
|
|
260
|
-
const [, name, deps] = match;
|
|
261
|
-
if (!name.startsWith(".") && name !== "PHONY") {
|
|
262
|
-
commands.push({
|
|
263
|
-
name,
|
|
264
|
-
command: `make ${name}`,
|
|
265
|
-
type: inferCommandType(name),
|
|
266
|
-
description: deps || void 0
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
} catch {
|
|
272
|
-
}
|
|
273
|
-
return commands;
|
|
274
|
-
}
|
|
275
|
-
async function detectPoetryScripts(pyprojectPath) {
|
|
276
|
-
const commands = [];
|
|
277
|
-
try {
|
|
278
|
-
const content = await readFile(pyprojectPath, "utf-8");
|
|
279
|
-
const scriptsMatch = content.match(/\[tool\.poetry\.scripts\]([\s\S]*?)(?:\[|$)/);
|
|
280
|
-
if (scriptsMatch) {
|
|
281
|
-
const scriptsSection = scriptsMatch[1];
|
|
282
|
-
const lines = scriptsSection.split("\n");
|
|
283
|
-
for (const line of lines) {
|
|
284
|
-
const match = line.match(/^([\w-]+)\s*=\s*"([^"]+)"/);
|
|
285
|
-
if (match) {
|
|
286
|
-
const [, name, command] = match;
|
|
287
|
-
commands.push({
|
|
288
|
-
name,
|
|
289
|
-
command,
|
|
290
|
-
type: inferCommandType(name)
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
} catch {
|
|
296
|
-
}
|
|
297
|
-
return commands;
|
|
298
|
-
}
|
|
299
|
-
function inferCommandType(name) {
|
|
300
|
-
const lowerName = name.toLowerCase();
|
|
301
|
-
if (lowerName.includes("build") || lowerName.includes("compile")) {
|
|
302
|
-
return "build";
|
|
303
|
-
}
|
|
304
|
-
if (lowerName.includes("test") || lowerName.includes("spec")) {
|
|
305
|
-
return "test";
|
|
306
|
-
}
|
|
307
|
-
if (lowerName.includes("lint") || lowerName.includes("format")) {
|
|
308
|
-
return "lint";
|
|
309
|
-
}
|
|
310
|
-
if (lowerName.includes("dev") || lowerName.includes("watch")) {
|
|
311
|
-
return "dev";
|
|
312
|
-
}
|
|
313
|
-
if (lowerName.includes("start") || lowerName.includes("serve")) {
|
|
314
|
-
return "start";
|
|
315
|
-
}
|
|
316
|
-
if (lowerName.includes("deploy") || lowerName.includes("publish")) {
|
|
317
|
-
return "deploy";
|
|
318
|
-
}
|
|
319
|
-
return "other";
|
|
320
|
-
}
|
|
321
|
-
async function fileExists$1(path) {
|
|
322
|
-
try {
|
|
323
|
-
await access(path, constants.F_OK);
|
|
324
|
-
return true;
|
|
325
|
-
} catch {
|
|
326
|
-
return false;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
async function mapRepository(projectRoot = ".", options = {}) {
|
|
331
|
-
const { maxDepth = 3, ignorePatterns = getDefaultIgnorePatterns() } = options;
|
|
332
|
-
const directories = [];
|
|
333
|
-
let totalFiles = 0;
|
|
334
|
-
let totalSize = 0;
|
|
335
|
-
await scanDirectory(projectRoot, projectRoot, 0, maxDepth, ignorePatterns, directories);
|
|
336
|
-
for (const dir of directories) {
|
|
337
|
-
totalFiles += dir.fileCount;
|
|
338
|
-
totalSize += dir.size;
|
|
339
|
-
}
|
|
340
|
-
return {
|
|
341
|
-
root: projectRoot,
|
|
342
|
-
directories,
|
|
343
|
-
totalFiles,
|
|
344
|
-
totalSize
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
async function scanDirectory(root, dir, depth, maxDepth, ignorePatterns, result) {
|
|
348
|
-
if (depth > maxDepth) {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
try {
|
|
352
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
353
|
-
let fileCount = 0;
|
|
354
|
-
let size = 0;
|
|
355
|
-
for (const entry of entries) {
|
|
356
|
-
const fullPath = join(dir, entry.name);
|
|
357
|
-
const relativePath = relative(root, fullPath);
|
|
358
|
-
if (shouldIgnore(relativePath, ignorePatterns)) {
|
|
359
|
-
continue;
|
|
360
|
-
}
|
|
361
|
-
if (entry.isDirectory()) {
|
|
362
|
-
await scanDirectory(root, fullPath, depth + 1, maxDepth, ignorePatterns, result);
|
|
363
|
-
} else if (entry.isFile()) {
|
|
364
|
-
fileCount++;
|
|
365
|
-
try {
|
|
366
|
-
const stats = await stat(fullPath);
|
|
367
|
-
size += stats.size;
|
|
368
|
-
} catch {
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
if (fileCount > 0 || depth === 0) {
|
|
373
|
-
result.push({
|
|
374
|
-
path: dir,
|
|
375
|
-
relativePath: relative(root, dir) || ".",
|
|
376
|
-
type: inferDirectoryType(relative(root, dir)),
|
|
377
|
-
fileCount,
|
|
378
|
-
size
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
} catch {
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
function shouldIgnore(path, patterns) {
|
|
385
|
-
for (const pattern of patterns) {
|
|
386
|
-
if (path.includes(pattern)) {
|
|
387
|
-
return true;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
function getDefaultIgnorePatterns() {
|
|
393
|
-
return [
|
|
394
|
-
"node_modules",
|
|
395
|
-
".git",
|
|
396
|
-
"dist",
|
|
397
|
-
"build",
|
|
398
|
-
"out",
|
|
399
|
-
".next",
|
|
400
|
-
".nuxt",
|
|
401
|
-
"coverage",
|
|
402
|
-
".cache",
|
|
403
|
-
".turbo",
|
|
404
|
-
"__pycache__",
|
|
405
|
-
".pytest_cache",
|
|
406
|
-
"venv",
|
|
407
|
-
".venv",
|
|
408
|
-
"target",
|
|
409
|
-
"vendor"
|
|
410
|
-
];
|
|
411
|
-
}
|
|
412
|
-
function inferDirectoryType(path) {
|
|
413
|
-
const lowerPath = path.toLowerCase();
|
|
414
|
-
if (lowerPath.match(/^(src|lib|app|packages|components|pages|views)/)) {
|
|
415
|
-
return "source";
|
|
416
|
-
}
|
|
417
|
-
if (lowerPath.match(/^(test|tests|__tests__|spec|specs|e2e)/)) {
|
|
418
|
-
return "test";
|
|
419
|
-
}
|
|
420
|
-
if (lowerPath.match(/^(config|configs|\.config|\.github|\.vscode)/)) {
|
|
421
|
-
return "config";
|
|
422
|
-
}
|
|
423
|
-
if (lowerPath.match(/^(docs|documentation|wiki)/)) {
|
|
424
|
-
return "docs";
|
|
425
|
-
}
|
|
426
|
-
if (lowerPath.match(/^(dist|build|out|\.next|\.nuxt|target)/)) {
|
|
427
|
-
return "build";
|
|
428
|
-
}
|
|
429
|
-
if (lowerPath.match(/^(public|static|assets|images|media)/)) {
|
|
430
|
-
return "assets";
|
|
431
|
-
}
|
|
432
|
-
return "other";
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
async function detectStack(projectRoot = ".") {
|
|
436
|
-
const languages = await detectLanguages(projectRoot);
|
|
437
|
-
const frameworks = await detectFrameworks(projectRoot);
|
|
438
|
-
const packageManager = await detectPackageManager(projectRoot);
|
|
439
|
-
const runtime = await detectRuntime(projectRoot);
|
|
440
|
-
return {
|
|
441
|
-
languages,
|
|
442
|
-
frameworks,
|
|
443
|
-
packageManager,
|
|
444
|
-
runtime
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
async function detectLanguages(projectRoot) {
|
|
448
|
-
const languages = /* @__PURE__ */ new Set();
|
|
449
|
-
if (await fileExists(join(projectRoot, "tsconfig.json"))) {
|
|
450
|
-
languages.add("TypeScript");
|
|
451
|
-
}
|
|
452
|
-
if (await fileExists(join(projectRoot, "package.json"))) {
|
|
453
|
-
languages.add("JavaScript");
|
|
454
|
-
}
|
|
455
|
-
if (await fileExists(join(projectRoot, "requirements.txt")) || await fileExists(join(projectRoot, "pyproject.toml")) || await fileExists(join(projectRoot, "setup.py"))) {
|
|
456
|
-
languages.add("Python");
|
|
457
|
-
}
|
|
458
|
-
if (await fileExists(join(projectRoot, "go.mod"))) {
|
|
459
|
-
languages.add("Go");
|
|
460
|
-
}
|
|
461
|
-
if (await fileExists(join(projectRoot, "Cargo.toml"))) {
|
|
462
|
-
languages.add("Rust");
|
|
463
|
-
}
|
|
464
|
-
if (await fileExists(join(projectRoot, "pom.xml")) || await fileExists(join(projectRoot, "build.gradle"))) {
|
|
465
|
-
languages.add("Java");
|
|
466
|
-
}
|
|
467
|
-
return Array.from(languages);
|
|
468
|
-
}
|
|
469
|
-
async function detectFrameworks(projectRoot) {
|
|
470
|
-
const frameworks = [];
|
|
471
|
-
const packageJsonPath = join(projectRoot, "package.json");
|
|
472
|
-
if (await fileExists(packageJsonPath)) {
|
|
473
|
-
const packageJson = await readPackageJson(packageJsonPath);
|
|
474
|
-
if (packageJson) {
|
|
475
|
-
frameworks.push(...detectNodeFrameworks(packageJson));
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
const requirementsPath = join(projectRoot, "requirements.txt");
|
|
479
|
-
if (await fileExists(requirementsPath)) {
|
|
480
|
-
frameworks.push(...await detectPythonFrameworks(requirementsPath));
|
|
481
|
-
}
|
|
482
|
-
return frameworks;
|
|
483
|
-
}
|
|
484
|
-
function detectNodeFrameworks(packageJson) {
|
|
485
|
-
const frameworks = [];
|
|
486
|
-
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
487
|
-
const frameworkMap = {
|
|
488
|
-
next: { type: "fullstack" },
|
|
489
|
-
react: { type: "frontend" },
|
|
490
|
-
vue: { type: "frontend" },
|
|
491
|
-
nuxt: { type: "fullstack" },
|
|
492
|
-
svelte: { type: "frontend" },
|
|
493
|
-
angular: { type: "frontend" },
|
|
494
|
-
express: { type: "backend" },
|
|
495
|
-
fastify: { type: "backend" },
|
|
496
|
-
koa: { type: "backend" },
|
|
497
|
-
nestjs: { type: "backend" },
|
|
498
|
-
vitest: { type: "testing" },
|
|
499
|
-
jest: { type: "testing" },
|
|
500
|
-
vite: { type: "build" },
|
|
501
|
-
webpack: { type: "build" },
|
|
502
|
-
esbuild: { type: "build" }
|
|
503
|
-
};
|
|
504
|
-
for (const [name, config] of Object.entries(frameworkMap)) {
|
|
505
|
-
if (deps[name]) {
|
|
506
|
-
frameworks.push({
|
|
507
|
-
name,
|
|
508
|
-
version: deps[name].replace(/^[\^~]/, ""),
|
|
509
|
-
type: config.type
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
return frameworks;
|
|
514
|
-
}
|
|
515
|
-
async function detectPythonFrameworks(requirementsPath) {
|
|
516
|
-
const frameworks = [];
|
|
517
|
-
try {
|
|
518
|
-
const content = await readFile(requirementsPath, "utf-8");
|
|
519
|
-
const lines = content.split("\n");
|
|
520
|
-
const frameworkMap = {
|
|
521
|
-
django: { type: "fullstack" },
|
|
522
|
-
flask: { type: "backend" },
|
|
523
|
-
fastapi: { type: "backend" },
|
|
524
|
-
pytest: { type: "testing" }
|
|
525
|
-
};
|
|
526
|
-
for (const line of lines) {
|
|
527
|
-
const match = line.match(/^([\w-]+)(?:==|>=|<=)?([\d.]+)?/);
|
|
528
|
-
if (match) {
|
|
529
|
-
const [, name, version] = match;
|
|
530
|
-
const config = frameworkMap[name.toLowerCase()];
|
|
531
|
-
if (config) {
|
|
532
|
-
frameworks.push({
|
|
533
|
-
name,
|
|
534
|
-
version: version || null,
|
|
535
|
-
type: config.type
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
} catch {
|
|
541
|
-
}
|
|
542
|
-
return frameworks;
|
|
543
|
-
}
|
|
544
|
-
async function detectPackageManager(projectRoot) {
|
|
545
|
-
if (await fileExists(join(projectRoot, "pnpm-lock.yaml"))) {
|
|
546
|
-
return "pnpm";
|
|
547
|
-
}
|
|
548
|
-
if (await fileExists(join(projectRoot, "yarn.lock"))) {
|
|
549
|
-
return "yarn";
|
|
550
|
-
}
|
|
551
|
-
if (await fileExists(join(projectRoot, "package-lock.json"))) {
|
|
552
|
-
return "npm";
|
|
553
|
-
}
|
|
554
|
-
if (await fileExists(join(projectRoot, "bun.lockb"))) {
|
|
555
|
-
return "bun";
|
|
556
|
-
}
|
|
557
|
-
return null;
|
|
558
|
-
}
|
|
559
|
-
async function detectRuntime(projectRoot) {
|
|
560
|
-
const packageJsonPath = join(projectRoot, "package.json");
|
|
561
|
-
if (await fileExists(packageJsonPath)) {
|
|
562
|
-
const packageJson = await readPackageJson(packageJsonPath);
|
|
563
|
-
if (packageJson?.engines?.node) {
|
|
564
|
-
return `Node.js ${packageJson.engines.node}`;
|
|
565
|
-
}
|
|
566
|
-
return "Node.js";
|
|
567
|
-
}
|
|
568
|
-
if (await fileExists(join(projectRoot, "go.mod"))) {
|
|
569
|
-
return "Go";
|
|
570
|
-
}
|
|
571
|
-
if (await fileExists(join(projectRoot, "Cargo.toml"))) {
|
|
572
|
-
return "Rust";
|
|
573
|
-
}
|
|
574
|
-
return null;
|
|
575
|
-
}
|
|
576
|
-
async function readPackageJson(path) {
|
|
577
|
-
try {
|
|
578
|
-
const content = await readFile(path, "utf-8");
|
|
579
|
-
return JSON.parse(content);
|
|
580
|
-
} catch {
|
|
581
|
-
return null;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
async function fileExists(path) {
|
|
585
|
-
try {
|
|
586
|
-
await access(path, constants.F_OK);
|
|
587
|
-
return true;
|
|
588
|
-
} catch {
|
|
589
|
-
return false;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
async function analyzeProject(projectRoot = ".") {
|
|
594
|
-
const [stack, commands, repoMap] = await Promise.all([
|
|
595
|
-
detectStack(projectRoot),
|
|
596
|
-
detectCommands(projectRoot),
|
|
597
|
-
mapRepository(projectRoot)
|
|
598
|
-
]);
|
|
599
|
-
return {
|
|
600
|
-
stack,
|
|
601
|
-
commands,
|
|
602
|
-
repoMap,
|
|
603
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
async function analyzeContext() {
|
|
608
|
-
const t = getTranslation();
|
|
609
|
-
console.log(a.green.bold(`
|
|
610
|
-
\u{1F50D} ${t("context.analyzing")}
|
|
611
|
-
`));
|
|
612
|
-
const analysis = analyzeDirectory(process.cwd());
|
|
613
|
-
console.log(a.white(`${t("context.filesInContext")}: ${a.bold(analysis.files.length.toString())}`));
|
|
614
|
-
console.log(a.white(`${t("context.estimatedTokens")}: ${a.bold(analysis.totalTokens.toLocaleString())}`));
|
|
615
|
-
console.log(a.white(`${t("context.totalSize")}: ${a.bold(formatBytes(analysis.totalSize))}
|
|
616
|
-
`));
|
|
617
|
-
if (analysis.largestFiles.length > 0) {
|
|
618
|
-
console.log(a.yellow(`${t("context.largestFiles")}:
|
|
619
|
-
`));
|
|
620
|
-
for (const file of analysis.largestFiles.slice(0, 5)) {
|
|
621
|
-
const sizeStr = formatBytes(file.size);
|
|
622
|
-
const tokensStr = file.tokens.toLocaleString();
|
|
623
|
-
console.log(` ${a.white(file.path)}`);
|
|
624
|
-
console.log(` ${a.dim(`${t("context.size")}: ${sizeStr} | ${t("context.tokens")}: ${tokensStr}`)}`);
|
|
625
|
-
}
|
|
626
|
-
console.log();
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
async function showContextStatus() {
|
|
630
|
-
const t = getTranslation();
|
|
631
|
-
const memoryStatus = inspectMemoryFiles({ projectPath: process.cwd() });
|
|
632
|
-
console.log(a.green.bold(`
|
|
633
|
-
\u{1F4CA} ${t("context.status")}
|
|
634
|
-
`));
|
|
635
|
-
console.log(a.white(`Project: ${a.bold(process.cwd())}`));
|
|
636
|
-
const claudeMdPath = join(process.cwd(), "CLAUDE.md");
|
|
637
|
-
const hasClaudeMd = existsSync(claudeMdPath);
|
|
638
|
-
console.log(`${hasClaudeMd ? a.green("\u2713") : a.red("\u2717")} CLAUDE.md`);
|
|
639
|
-
if (hasClaudeMd) {
|
|
640
|
-
const stats = lstatSync(claudeMdPath);
|
|
641
|
-
const content = readFileSync(claudeMdPath, "utf-8");
|
|
642
|
-
const tokens = estimateTokens(content);
|
|
643
|
-
console.log(` ${a.dim(`${t("context.size")}: ${formatBytes(stats.size)} | ${t("context.tokens")}: ${tokens.toLocaleString()}`)}`);
|
|
644
|
-
}
|
|
645
|
-
console.log();
|
|
646
|
-
const claudeIgnorePath = join(process.cwd(), ".claudeignore");
|
|
647
|
-
const hasIgnore = existsSync(claudeIgnorePath);
|
|
648
|
-
console.log(`${hasIgnore ? a.green("\u2713") : a.yellow("\u25CB")} .claudeignore`);
|
|
649
|
-
const contextFiles = findContextFiles(process.cwd());
|
|
650
|
-
console.log(`
|
|
651
|
-
${a.white(`${t("context.additionalFiles")}: ${contextFiles.length}`)}
|
|
652
|
-
`);
|
|
653
|
-
for (const file of contextFiles.slice(0, 10)) {
|
|
654
|
-
const tokens = estimateTokens(readFileSync(file, "utf-8"));
|
|
655
|
-
lstatSync(file).size;
|
|
656
|
-
console.log(` ${a.white(file)} ${a.dim(`(${tokens.toLocaleString()} ${t("context.tokens")})`)}`);
|
|
657
|
-
}
|
|
658
|
-
if (contextFiles.length > 10) {
|
|
659
|
-
console.log(` ${a.dim(`... and ${contextFiles.length - 10} more`)}`);
|
|
660
|
-
}
|
|
661
|
-
console.log(a.yellow("\nMemory\n"));
|
|
662
|
-
console.log(` ${a.white(`State: ${describeMemorySyncState(memoryStatus.syncState)}`)}`);
|
|
663
|
-
console.log(` ${a.dim(`Claude: ${memoryStatus.paths.claude}`)}`);
|
|
664
|
-
console.log(` ${a.dim(`CCJK: ${memoryStatus.paths.ccjk}`)}`);
|
|
665
|
-
if (memoryStatus.parseMode === "structured") {
|
|
666
|
-
console.log(` ${a.dim(`Entries: ${memoryStatus.entryCount} | Facts: ${memoryStatus.factCount} | Patterns: ${memoryStatus.patternCount} | Decisions: ${memoryStatus.decisionCount}`)}`);
|
|
667
|
-
} else if (memoryStatus.parseMode === "freeform") {
|
|
668
|
-
console.log(` ${a.dim("Structured parsing: freeform notes detected")}`);
|
|
669
|
-
} else {
|
|
670
|
-
console.log(` ${a.dim("Structured parsing: no memory content found")}`);
|
|
671
|
-
}
|
|
672
|
-
console.log(a.yellow("\nNext Commands\n"));
|
|
673
|
-
console.log(` ${a.white("ccjk context status")} ${a.dim("Review project context readiness")}`);
|
|
674
|
-
console.log(` ${a.white("ccjk memory --status")} ${a.dim("Inspect Claude and CCJK memory files")}`);
|
|
675
|
-
console.log(` ${a.white("ccjk memory --doctor")} ${a.dim("Run memory diagnostics and recommendations")}`);
|
|
676
|
-
console.log(` ${a.white("ccjk context --show")} ${a.dim("Preview loaded context layers")}`);
|
|
677
|
-
console.log();
|
|
678
|
-
}
|
|
679
|
-
function describeMemorySyncState(syncState) {
|
|
680
|
-
switch (syncState) {
|
|
681
|
-
case "in-sync":
|
|
682
|
-
return "Claude and CCJK memory are in sync";
|
|
683
|
-
case "claude-only":
|
|
684
|
-
return "Only Claude memory has content";
|
|
685
|
-
case "ccjk-only":
|
|
686
|
-
return "Only CCJK memory has content";
|
|
687
|
-
case "claude-newer":
|
|
688
|
-
return "Claude memory is newer than the CCJK mirror";
|
|
689
|
-
case "ccjk-newer":
|
|
690
|
-
return "CCJK mirror is newer than Claude memory";
|
|
691
|
-
case "empty":
|
|
692
|
-
return "No project memory found";
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
async function compressContext() {
|
|
696
|
-
const t = getTranslation();
|
|
697
|
-
console.log(a.green.bold(`
|
|
698
|
-
\u{1F5DC}\uFE0F ${t("context.compressing")}
|
|
699
|
-
`));
|
|
700
|
-
const analysis = analyzeDirectory(process.cwd());
|
|
701
|
-
const duplicates = findDuplicates(analysis.files);
|
|
702
|
-
const largeFiles = analysis.files.filter((f) => f.tokens > 1e3);
|
|
703
|
-
const binaryFiles = analysis.files.filter((f) => f.type === "binary");
|
|
704
|
-
let totalSavings = 0;
|
|
705
|
-
if (duplicates.length > 0) {
|
|
706
|
-
console.log(a.yellow(`${t("context.duplicatesFound")}: ${duplicates.length}
|
|
707
|
-
`));
|
|
708
|
-
totalSavings += duplicates.length * 500;
|
|
709
|
-
}
|
|
710
|
-
if (largeFiles.length > 0) {
|
|
711
|
-
console.log(a.yellow(`${t("context.largeFiles")}: ${largeFiles.length}
|
|
712
|
-
`));
|
|
713
|
-
for (const file of largeFiles.slice(0, 5)) {
|
|
714
|
-
console.log(` ${a.white(file.path)} (${file.tokens.toLocaleString()} ${t("context.tokens")})`);
|
|
715
|
-
}
|
|
716
|
-
if (largeFiles.length > 5) {
|
|
717
|
-
console.log(` ${a.dim(`... and ${largeFiles.length - 5} more`)}`);
|
|
718
|
-
}
|
|
719
|
-
console.log();
|
|
720
|
-
totalSavings += largeFiles.reduce((sum, f) => sum + Math.floor(f.tokens * 0.3), 0);
|
|
721
|
-
}
|
|
722
|
-
if (binaryFiles.length > 0) {
|
|
723
|
-
console.log(a.yellow(`${t("context.binaryFiles")}: ${binaryFiles.length}
|
|
724
|
-
`));
|
|
725
|
-
console.log(a.dim(`${t("context.binaryNote")}
|
|
726
|
-
`));
|
|
727
|
-
totalSavings += binaryFiles.length * 200;
|
|
728
|
-
}
|
|
729
|
-
if (totalSavings > 0) {
|
|
730
|
-
console.log(a.green(`${t("context.estimatedSavings")}: ${a.bold(totalSavings.toLocaleString())} ${t("context.tokens")}
|
|
731
|
-
`));
|
|
732
|
-
} else {
|
|
733
|
-
console.log(a.dim(`${t("context.noCompressionNeeded")}
|
|
734
|
-
`));
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
async function optimizeContext() {
|
|
738
|
-
const t = getTranslation();
|
|
739
|
-
console.log(a.green.bold(`
|
|
740
|
-
\u26A1 ${t("context.optimizing")}
|
|
741
|
-
`));
|
|
742
|
-
const analysis = analyzeDirectory(process.cwd());
|
|
743
|
-
const suggestions = [];
|
|
744
|
-
const largeFiles = analysis.files.filter((f) => f.tokens > 1e3);
|
|
745
|
-
if (largeFiles.length > 0) {
|
|
746
|
-
suggestions.push(`${t("context.suggestionLargeFiles")}: ${largeFiles.map((f) => f.path).join(", ")}`);
|
|
747
|
-
}
|
|
748
|
-
if (analysis.files.length > 20) {
|
|
749
|
-
suggestions.push(`${t("context.suggestionManyFiles")}: ${analysis.files.length}`);
|
|
750
|
-
}
|
|
751
|
-
if (!existsSync(join(process.cwd(), ".claudeignore"))) {
|
|
752
|
-
suggestions.push(t("context.suggestionClaudeignore"));
|
|
753
|
-
}
|
|
754
|
-
if (suggestions.length === 0) {
|
|
755
|
-
console.log(a.green(`${t("context.optimized")}
|
|
756
|
-
`));
|
|
757
|
-
} else {
|
|
758
|
-
console.log(a.yellow(`${t("context.suggestions")}:
|
|
759
|
-
`));
|
|
760
|
-
for (const suggestion of suggestions) {
|
|
761
|
-
console.log(` \u2022 ${suggestion}`);
|
|
762
|
-
}
|
|
763
|
-
console.log();
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
function analyzeDirectory(dir) {
|
|
767
|
-
const files = [];
|
|
768
|
-
let totalTokens = 0;
|
|
769
|
-
let totalSize = 0;
|
|
770
|
-
try {
|
|
771
|
-
const entries = readdirSync(dir, { withFileTypes: true });
|
|
772
|
-
for (const entry of entries) {
|
|
773
|
-
if (entry.isDirectory()) {
|
|
774
|
-
if (["node_modules", ".git", "dist", "build", ".next", "target"].includes(entry.name)) {
|
|
775
|
-
continue;
|
|
776
|
-
}
|
|
777
|
-
continue;
|
|
778
|
-
}
|
|
779
|
-
const filePath = join(dir, entry.name);
|
|
780
|
-
const fileType = getFileType(entry.name);
|
|
781
|
-
if (fileType === "binary") {
|
|
782
|
-
continue;
|
|
783
|
-
}
|
|
784
|
-
try {
|
|
785
|
-
const stats = lstatSync(filePath);
|
|
786
|
-
const content = readFileSync(filePath, "utf-8");
|
|
787
|
-
const tokens = estimateTokens(content);
|
|
788
|
-
files.push({
|
|
789
|
-
path: filePath,
|
|
790
|
-
size: stats.size,
|
|
791
|
-
tokens,
|
|
792
|
-
type: fileType
|
|
793
|
-
});
|
|
794
|
-
totalTokens += tokens;
|
|
795
|
-
totalSize += stats.size;
|
|
796
|
-
} catch {
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
} catch {
|
|
800
|
-
}
|
|
801
|
-
const largestFiles = [...files].sort((a, b) => b.tokens - a.tokens);
|
|
802
|
-
return {
|
|
803
|
-
files,
|
|
804
|
-
totalTokens,
|
|
805
|
-
totalSize,
|
|
806
|
-
largestFiles
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
function findContextFiles(dir) {
|
|
810
|
-
const contextFiles = [];
|
|
811
|
-
const contextPatterns = [
|
|
812
|
-
"CLAUDE.md",
|
|
813
|
-
"README.md",
|
|
814
|
-
"package.json",
|
|
815
|
-
"tsconfig.json",
|
|
816
|
-
".gitignore",
|
|
817
|
-
".claudeignore"
|
|
818
|
-
];
|
|
819
|
-
try {
|
|
820
|
-
const entries = readdirSync(dir);
|
|
821
|
-
for (const entry of entries) {
|
|
822
|
-
if (contextPatterns.includes(entry)) {
|
|
823
|
-
contextFiles.push(join(dir, entry));
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
} catch {
|
|
827
|
-
}
|
|
828
|
-
return contextFiles;
|
|
829
|
-
}
|
|
830
|
-
function findDuplicates(files) {
|
|
831
|
-
const seen = /* @__PURE__ */ new Map();
|
|
832
|
-
const duplicates = [];
|
|
833
|
-
for (const file of files) {
|
|
834
|
-
const name = file.path.split("/").pop() || file.path;
|
|
835
|
-
if (!seen.has(name)) {
|
|
836
|
-
seen.set(name, []);
|
|
837
|
-
}
|
|
838
|
-
seen.get(name).push(file);
|
|
839
|
-
}
|
|
840
|
-
for (const [, group] of seen) {
|
|
841
|
-
if (group.length > 1) {
|
|
842
|
-
duplicates.push(...group.slice(1));
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
return duplicates;
|
|
846
|
-
}
|
|
847
|
-
function getFileType(filename) {
|
|
848
|
-
const ext = filename.split(".").pop()?.toLowerCase();
|
|
849
|
-
if (["ts", "tsx", "js", "jsx", "py", "rs", "go", "java", "c", "cpp", "h", "hpp"].includes(ext || "")) {
|
|
850
|
-
return "code";
|
|
851
|
-
}
|
|
852
|
-
if (["md", "markdown", "txt"].includes(ext || "")) {
|
|
853
|
-
return "markdown";
|
|
854
|
-
}
|
|
855
|
-
if (["json", "yaml", "yml", "toml", "xml"].includes(ext || "")) {
|
|
856
|
-
return "text";
|
|
857
|
-
}
|
|
858
|
-
if (["png", "jpg", "jpeg", "gif", "ico", "pdf", "zip", "tar", "gz"].includes(ext || "")) {
|
|
859
|
-
return "binary";
|
|
860
|
-
}
|
|
861
|
-
return "text";
|
|
862
|
-
}
|
|
863
|
-
function estimateTokens(text) {
|
|
864
|
-
const chineseChars = (text.match(/[\u4E00-\u9FA5]/g) || []).length;
|
|
865
|
-
const nonChineseChars = text.length - chineseChars;
|
|
866
|
-
return Math.ceil(chineseChars / 2 + nonChineseChars / 4);
|
|
867
|
-
}
|
|
868
|
-
function formatBytes(bytes) {
|
|
869
|
-
if (bytes === 0)
|
|
870
|
-
return "0 B";
|
|
871
|
-
const k = 1024;
|
|
872
|
-
const sizes = ["B", "KB", "MB", "GB"];
|
|
873
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
874
|
-
return `${Number.parseFloat((bytes / k ** i).toFixed(1))} ${sizes[i]}`;
|
|
875
|
-
}
|
|
876
|
-
async function handleContextCommand(args) {
|
|
877
|
-
const [action, ..._rest] = args;
|
|
878
|
-
switch (action) {
|
|
879
|
-
case "analyze":
|
|
880
|
-
await analyzeContext();
|
|
881
|
-
break;
|
|
882
|
-
case "status":
|
|
883
|
-
await showContextStatus();
|
|
884
|
-
break;
|
|
885
|
-
case "compress":
|
|
886
|
-
await compressContext();
|
|
887
|
-
break;
|
|
888
|
-
case "optimize":
|
|
889
|
-
await optimizeContext();
|
|
890
|
-
break;
|
|
891
|
-
default:
|
|
892
|
-
showContextHelp();
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
function showContextHelp() {
|
|
896
|
-
console.log(a.green.bold("\n\u{1F4DD} Context Commands\n"));
|
|
897
|
-
console.log(a.white(" ccjk context analyze ") + a.dim("Analyze context usage"));
|
|
898
|
-
console.log(a.white(" ccjk context status ") + a.dim("Show context status"));
|
|
899
|
-
console.log(a.white(" ccjk context compress ") + a.dim("Compress context"));
|
|
900
|
-
console.log(a.white(" ccjk context optimize ") + a.dim("Optimize context"));
|
|
901
|
-
console.log();
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
async function contextBuild(options = {}) {
|
|
905
|
-
const {
|
|
906
|
-
target: _target = "claude-code",
|
|
907
|
-
output = ".",
|
|
908
|
-
force: _force = false,
|
|
909
|
-
merge = false,
|
|
910
|
-
projectName,
|
|
911
|
-
projectDescription
|
|
912
|
-
} = options;
|
|
913
|
-
console.log("\u{1F50D} Analyzing project...");
|
|
914
|
-
const intelligence = await analyzeProject(".");
|
|
915
|
-
console.log("\u2705 Analysis complete");
|
|
916
|
-
console.log(` Languages: ${intelligence.stack.languages.join(", ")}`);
|
|
917
|
-
console.log(` Frameworks: ${intelligence.stack.frameworks.map((f) => f.name).join(", ")}`);
|
|
918
|
-
console.log(` Commands: ${intelligence.commands.length}`);
|
|
919
|
-
console.log("");
|
|
920
|
-
console.log("\u{1F4E6} Building context pack...");
|
|
921
|
-
const contextPack = buildContextPack(intelligence, {
|
|
922
|
-
projectName,
|
|
923
|
-
projectDescription,
|
|
924
|
-
includeCommands: true,
|
|
925
|
-
includeRepoMap: true
|
|
926
|
-
});
|
|
927
|
-
const outputPath = join(output, "CLAUDE.md");
|
|
928
|
-
if (merge) {
|
|
929
|
-
try {
|
|
930
|
-
await readFile(outputPath, "utf-8");
|
|
931
|
-
console.log("\u{1F4DD} Merging with existing CLAUDE.md...");
|
|
932
|
-
} catch {
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
await writeClaudeContext(contextPack, outputPath);
|
|
936
|
-
console.log(`\u2705 Context pack written to: ${outputPath}`);
|
|
937
|
-
}
|
|
938
|
-
async function contextRefresh() {
|
|
939
|
-
console.log("\u{1F504} Refreshing context pack...");
|
|
940
|
-
await contextBuild({ force: true, merge: true });
|
|
941
|
-
}
|
|
942
|
-
async function contextDoctor() {
|
|
943
|
-
console.log("\u{1F50D} Running context health check...");
|
|
944
|
-
const intelligence = await analyzeProject(".");
|
|
945
|
-
console.log("\n\u{1F4CA} Project Health:");
|
|
946
|
-
console.log(` \u2705 Languages detected: ${intelligence.stack.languages.length}`);
|
|
947
|
-
console.log(` \u2705 Frameworks detected: ${intelligence.stack.frameworks.length}`);
|
|
948
|
-
console.log(` \u2705 Commands detected: ${intelligence.commands.length}`);
|
|
949
|
-
console.log(` \u2705 Directories scanned: ${intelligence.repoMap.directories.length}`);
|
|
950
|
-
if (intelligence.commands.length === 0) {
|
|
951
|
-
console.log("\n\u26A0\uFE0F Warning: No commands detected. Consider adding package.json scripts.");
|
|
952
|
-
}
|
|
953
|
-
if (intelligence.stack.frameworks.length === 0) {
|
|
954
|
-
console.log("\n\u26A0\uFE0F Warning: No frameworks detected. Context may be generic.");
|
|
955
|
-
}
|
|
956
|
-
console.log("\n\u2705 Context health check complete");
|
|
957
|
-
}
|
|
958
|
-
async function contextCommand(options = {}) {
|
|
959
|
-
if (options.action && ["analyze", "compress", "optimize", "status"].includes(options.action)) {
|
|
960
|
-
await handleContextCommand([options.action]);
|
|
961
|
-
return;
|
|
962
|
-
}
|
|
963
|
-
if (options.action === "refresh") {
|
|
964
|
-
await contextRefresh();
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
if (options.action === "doctor") {
|
|
968
|
-
await contextDoctor();
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
await contextBuild(options);
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
export { contextBuild, contextCommand, contextDoctor, contextRefresh };
|