ccjk 12.0.7 → 12.0.8
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/package.json +1 -1
- package/dist/chunks/agent-teams.mjs +0 -136
- package/dist/chunks/agent.mjs +0 -1439
- package/dist/chunks/agents.mjs +0 -3778
- package/dist/chunks/api-cli.mjs +0 -132
- package/dist/chunks/api-providers.mjs +0 -129
- package/dist/chunks/api.mjs +0 -112
- package/dist/chunks/auto-bootstrap.mjs +0 -358
- package/dist/chunks/auto-init.mjs +0 -7584
- package/dist/chunks/auto-updater.mjs +0 -410
- package/dist/chunks/banner.mjs +0 -188
- package/dist/chunks/bash.mjs +0 -187
- package/dist/chunks/boost.mjs +0 -397
- package/dist/chunks/ccjk-agents.mjs +0 -414
- package/dist/chunks/ccjk-all.mjs +0 -1028
- package/dist/chunks/ccjk-config.mjs +0 -261
- package/dist/chunks/ccjk-hooks.mjs +0 -1074
- package/dist/chunks/ccjk-mcp.mjs +0 -761
- package/dist/chunks/ccjk-setup.mjs +0 -763
- package/dist/chunks/ccjk-skills.mjs +0 -514
- package/dist/chunks/ccr.mjs +0 -98
- package/dist/chunks/ccu.mjs +0 -40
- package/dist/chunks/check-updates.mjs +0 -108
- package/dist/chunks/claude-code-config-manager.mjs +0 -750
- package/dist/chunks/claude-code-incremental-manager.mjs +0 -623
- package/dist/chunks/claude-config.mjs +0 -236
- package/dist/chunks/claude-wrapper.mjs +0 -85
- package/dist/chunks/cleanup-migration.mjs +0 -20
- package/dist/chunks/cli-hook.mjs +0 -2285
- package/dist/chunks/cloud-sync.mjs +0 -29
- package/dist/chunks/codex-config-switch.mjs +0 -451
- package/dist/chunks/codex-provider-manager.mjs +0 -236
- package/dist/chunks/codex-uninstaller.mjs +0 -404
- package/dist/chunks/codex.mjs +0 -2077
- package/dist/chunks/commands.mjs +0 -108
- package/dist/chunks/commands2.mjs +0 -413
- package/dist/chunks/commit.mjs +0 -138
- package/dist/chunks/completion.mjs +0 -515
- package/dist/chunks/config-consolidator.mjs +0 -172
- package/dist/chunks/config-switch.mjs +0 -317
- package/dist/chunks/config.mjs +0 -379
- package/dist/chunks/config2.mjs +0 -477
- package/dist/chunks/config3.mjs +0 -470
- package/dist/chunks/constants.mjs +0 -133
- package/dist/chunks/context-loader.mjs +0 -343
- package/dist/chunks/context.mjs +0 -372
- package/dist/chunks/convoy-manager.mjs +0 -880
- package/dist/chunks/dashboard.mjs +0 -476
- package/dist/chunks/doctor.mjs +0 -964
- package/dist/chunks/evolution.mjs +0 -382
- package/dist/chunks/features.mjs +0 -698
- package/dist/chunks/fish.mjs +0 -181
- package/dist/chunks/fs-operations.mjs +0 -192
- package/dist/chunks/health-alerts.mjs +0 -304
- package/dist/chunks/health-check.mjs +0 -532
- package/dist/chunks/help.mjs +0 -340
- package/dist/chunks/hook-installer.mjs +0 -45
- package/dist/chunks/index.mjs +0 -24
- package/dist/chunks/index10.mjs +0 -1171
- package/dist/chunks/index11.mjs +0 -1008
- package/dist/chunks/index12.mjs +0 -193
- package/dist/chunks/index13.mjs +0 -218
- package/dist/chunks/index14.mjs +0 -663
- package/dist/chunks/index2.mjs +0 -19
- package/dist/chunks/index3.mjs +0 -19092
- package/dist/chunks/index4.mjs +0 -8
- package/dist/chunks/index5.mjs +0 -7600
- package/dist/chunks/index6.mjs +0 -171
- package/dist/chunks/index7.mjs +0 -3583
- package/dist/chunks/index8.mjs +0 -19
- package/dist/chunks/index9.mjs +0 -616
- package/dist/chunks/init.mjs +0 -1606
- package/dist/chunks/installer.mjs +0 -690
- package/dist/chunks/installer2.mjs +0 -179
- 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 -949
- package/dist/chunks/mcp-cli.mjs +0 -204
- package/dist/chunks/mcp-performance.mjs +0 -187
- package/dist/chunks/mcp.mjs +0 -1231
- package/dist/chunks/menu.mjs +0 -652
- package/dist/chunks/metrics-display.mjs +0 -153
- package/dist/chunks/migrator.mjs +0 -178
- package/dist/chunks/monitor.mjs +0 -1856
- package/dist/chunks/notification.mjs +0 -1864
- package/dist/chunks/onboarding.mjs +0 -385
- package/dist/chunks/package.mjs +0 -3
- package/dist/chunks/paradigm.mjs +0 -74
- package/dist/chunks/permission-manager.mjs +0 -132
- package/dist/chunks/permissions.mjs +0 -265
- package/dist/chunks/persistence-manager.mjs +0 -794
- package/dist/chunks/persistence.mjs +0 -667
- package/dist/chunks/platform.mjs +0 -391
- package/dist/chunks/plugin.mjs +0 -1936
- package/dist/chunks/powershell.mjs +0 -213
- package/dist/chunks/prompts.mjs +0 -241
- package/dist/chunks/providers.mjs +0 -260
- package/dist/chunks/quick-actions.mjs +0 -320
- package/dist/chunks/quick-provider.mjs +0 -682
- package/dist/chunks/quick-setup.mjs +0 -412
- package/dist/chunks/remote.mjs +0 -497
- 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 -98
- package/dist/chunks/skill.mjs +0 -117
- package/dist/chunks/skill2.mjs +0 -9003
- package/dist/chunks/skills-sync.mjs +0 -6460
- package/dist/chunks/skills.mjs +0 -567
- package/dist/chunks/slash-commands.mjs +0 -207
- package/dist/chunks/smart-defaults.mjs +0 -412
- package/dist/chunks/smart-guide.mjs +0 -194
- package/dist/chunks/startup.mjs +0 -487
- package/dist/chunks/stats.mjs +0 -410
- package/dist/chunks/status.mjs +0 -289
- 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 -849
- package/dist/chunks/update.mjs +0 -167
- package/dist/chunks/upgrade-manager.mjs +0 -204
- package/dist/chunks/version-checker.mjs +0 -881
- 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 -374
- 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 -2199
- package/dist/i18n/locales/en/agent-teams.json +0 -18
- package/dist/i18n/locales/en/agentBrowser.json +0 -79
- 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 -152
- 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 -127
- 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 -226
- 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 -178
- package/dist/i18n/locales/en/memory.json +0 -92
- package/dist/i18n/locales/en/menu.json +0 -143
- 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 -79
- 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 -152
- 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 -127
- 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 -224
- 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 -178
- package/dist/i18n/locales/zh-CN/memory.json +0 -92
- package/dist/i18n/locales/zh-CN/menu.json +0 -143
- 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 -5295
- package/dist/index.d.ts +0 -5295
- package/dist/index.mjs +0 -4941
- package/dist/shared/ccjk.B364Fu0N.mjs +0 -1819
- 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.BFxsJM0k.mjs +0 -599
- package/dist/shared/ccjk.BIxuVL3_.mjs +0 -25
- package/dist/shared/ccjk.BRZ9ww8S.mjs +0 -142
- package/dist/shared/ccjk.BoApaI4j.mjs +0 -28
- package/dist/shared/ccjk.BrPUmTqm.mjs +0 -266
- package/dist/shared/ccjk.BtB1e5jm.mjs +0 -171
- package/dist/shared/ccjk.BwfbSKN2.mjs +0 -1051
- package/dist/shared/ccjk.BxSmJ8B7.mjs +0 -243
- package/dist/shared/ccjk.Bx_rmYfN.mjs +0 -69
- package/dist/shared/ccjk.C2jHOZVP.mjs +0 -52
- package/dist/shared/ccjk.CL4Yat0G.mjs +0 -303
- package/dist/shared/ccjk.COweQ1RR.mjs +0 -5
- package/dist/shared/ccjk.CePkJq2S.mjs +0 -223
- package/dist/shared/ccjk.CfKKcvWy.mjs +0 -126
- package/dist/shared/ccjk.Cjgrln_h.mjs +0 -297
- package/dist/shared/ccjk.Cjj8SVrn.mjs +0 -54
- package/dist/shared/ccjk.CxpGa6MC.mjs +0 -2724
- package/dist/shared/ccjk.D5MFQT7w.mjs +0 -400
- package/dist/shared/ccjk.D6ycHbak.mjs +0 -270
- package/dist/shared/ccjk.D8ZLYSZZ.mjs +0 -299
- package/dist/shared/ccjk.DG_o24cZ.mjs +0 -88
- package/dist/shared/ccjk.DLLw-h4Y.mjs +0 -460
- package/dist/shared/ccjk.DOwtZMk8.mjs +0 -4019
- package/dist/shared/ccjk.DS7UESmF.mjs +0 -2451
- package/dist/shared/ccjk.DTdjs-qK.mjs +0 -1447
- package/dist/shared/ccjk.DXRAZcix.mjs +0 -66
- package/dist/shared/ccjk.DsYaCCx4.mjs +0 -317
- package/dist/shared/ccjk.J8YiPsOw.mjs +0 -259
- package/dist/shared/ccjk.KfSWcGlE.mjs +0 -38
- package/dist/shared/ccjk.RyizuzOI.mjs +0 -21
- package/dist/shared/ccjk.SPoXMvZD.mjs +0 -1242
- package/dist/shared/ccjk.T_cX87dY.mjs +0 -15
- package/dist/shared/ccjk.UIvifqNE.mjs +0 -1486
- package/dist/shared/ccjk._dESH4Rk.mjs +0 -111
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +0 -249
- package/dist/shared/ccjk.c-ETfBZ_.mjs +0 -617
- package/dist/shared/ccjk.gDEDGD_t.mjs +0 -38
- package/dist/shared/ccjk.hoqrwWdN.mjs +0 -333
- package/dist/shared/ccjk.waa2ikKJ.mjs +0 -351
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, readdirSync, mkdirSync, statSync } from 'node:fs';
|
|
2
|
-
import process__default from 'node:process';
|
|
3
|
-
import a from './index2.mjs';
|
|
4
|
-
import { d as dayjs } from '../shared/ccjk.RyizuzOI.mjs';
|
|
5
|
-
import { i as inquirer } from './index3.mjs';
|
|
6
|
-
import ora from './index7.mjs';
|
|
7
|
-
import { CCJK_CONFIG_DIR } from './constants.mjs';
|
|
8
|
-
import { d as detectProject, g as getProjectSummary, a as generateSuggestions } from '../shared/ccjk.hoqrwWdN.mjs';
|
|
9
|
-
import { boxify, COLORS as theme, STATUS } from './banner.mjs';
|
|
10
|
-
import { writeFileAtomic } from './fs-operations.mjs';
|
|
11
|
-
import { j as join, b as basename } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
12
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
13
|
-
import 'node:readline';
|
|
14
|
-
import 'stream';
|
|
15
|
-
import 'node:tty';
|
|
16
|
-
import 'node:async_hooks';
|
|
17
|
-
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
18
|
-
import 'node:util';
|
|
19
|
-
import 'tty';
|
|
20
|
-
import 'fs';
|
|
21
|
-
import 'child_process';
|
|
22
|
-
import 'node:path';
|
|
23
|
-
import 'node:os';
|
|
24
|
-
import 'node:crypto';
|
|
25
|
-
import 'buffer';
|
|
26
|
-
import 'string_decoder';
|
|
27
|
-
import './index5.mjs';
|
|
28
|
-
import 'node:url';
|
|
29
|
-
import '../shared/ccjk.gDEDGD_t.mjs';
|
|
30
|
-
import 'node:fs/promises';
|
|
31
|
-
|
|
32
|
-
const KNOWLEDGE_BASE_FILE = join(CCJK_CONFIG_DIR, "knowledge-base.json");
|
|
33
|
-
function simpleHash(content) {
|
|
34
|
-
let hash = 0;
|
|
35
|
-
for (let i = 0; i < content.length; i++) {
|
|
36
|
-
const char = content.charCodeAt(i);
|
|
37
|
-
hash = (hash << 5) - hash + char;
|
|
38
|
-
hash = hash & hash;
|
|
39
|
-
}
|
|
40
|
-
return hash.toString(16);
|
|
41
|
-
}
|
|
42
|
-
function loadKnowledgeBase() {
|
|
43
|
-
if (existsSync(KNOWLEDGE_BASE_FILE)) {
|
|
44
|
-
try {
|
|
45
|
-
return JSON.parse(readFileSync(KNOWLEDGE_BASE_FILE, "utf-8"));
|
|
46
|
-
} catch {
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
version: "1.0.0",
|
|
51
|
-
lastSync: (/* @__PURE__ */ new Date()).toISOString(),
|
|
52
|
-
entries: [],
|
|
53
|
-
projectContexts: []
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function saveKnowledgeBase(kb) {
|
|
57
|
-
if (!existsSync(CCJK_CONFIG_DIR)) {
|
|
58
|
-
mkdirSync(CCJK_CONFIG_DIR, { recursive: true });
|
|
59
|
-
}
|
|
60
|
-
kb.lastSync = (/* @__PURE__ */ new Date()).toISOString();
|
|
61
|
-
writeFileAtomic(KNOWLEDGE_BASE_FILE, JSON.stringify(kb, null, 2));
|
|
62
|
-
}
|
|
63
|
-
function isFileOutdated(filePath, daysThreshold = 30) {
|
|
64
|
-
try {
|
|
65
|
-
const stat = statSync(filePath);
|
|
66
|
-
const daysSinceModified = dayjs().diff(dayjs(stat.mtime), "day");
|
|
67
|
-
return daysSinceModified > daysThreshold;
|
|
68
|
-
} catch {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function scanClaudeMd(projectDir) {
|
|
73
|
-
const possiblePaths = [
|
|
74
|
-
join(projectDir, "CLAUDE.md"),
|
|
75
|
-
join(projectDir, "claude.md"),
|
|
76
|
-
join(projectDir, ".claude", "CLAUDE.md"),
|
|
77
|
-
join(projectDir, "docs", "CLAUDE.md")
|
|
78
|
-
];
|
|
79
|
-
for (const path of possiblePaths) {
|
|
80
|
-
if (existsSync(path)) {
|
|
81
|
-
const content = readFileSync(path, "utf-8");
|
|
82
|
-
return {
|
|
83
|
-
path,
|
|
84
|
-
content,
|
|
85
|
-
outdated: isFileOutdated(path)
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
function scanAgents(projectDir) {
|
|
92
|
-
const agents = [];
|
|
93
|
-
const agentDirs = [
|
|
94
|
-
join(projectDir, ".claude", "agents"),
|
|
95
|
-
join(projectDir, "agents"),
|
|
96
|
-
join(projectDir, ".agents")
|
|
97
|
-
];
|
|
98
|
-
for (const dir of agentDirs) {
|
|
99
|
-
if (existsSync(dir)) {
|
|
100
|
-
try {
|
|
101
|
-
const files = readdirSync(dir);
|
|
102
|
-
for (const file of files) {
|
|
103
|
-
if (file.endsWith(".md")) {
|
|
104
|
-
const filePath = join(dir, file);
|
|
105
|
-
agents.push({
|
|
106
|
-
path: filePath,
|
|
107
|
-
name: basename(file, ".md"),
|
|
108
|
-
content: readFileSync(filePath, "utf-8")
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
} catch {
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return agents;
|
|
117
|
-
}
|
|
118
|
-
function scanSkills(projectDir) {
|
|
119
|
-
const skills = [];
|
|
120
|
-
const skillDirs = [
|
|
121
|
-
join(projectDir, ".claude", "commands"),
|
|
122
|
-
join(projectDir, ".claude", "skills"),
|
|
123
|
-
join(projectDir, "skills")
|
|
124
|
-
];
|
|
125
|
-
for (const dir of skillDirs) {
|
|
126
|
-
if (existsSync(dir)) {
|
|
127
|
-
try {
|
|
128
|
-
const files = readdirSync(dir);
|
|
129
|
-
for (const file of files) {
|
|
130
|
-
if (file.endsWith(".md")) {
|
|
131
|
-
const filePath = join(dir, file);
|
|
132
|
-
skills.push({
|
|
133
|
-
path: filePath,
|
|
134
|
-
name: basename(file, ".md"),
|
|
135
|
-
content: readFileSync(filePath, "utf-8")
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
} catch {
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return skills;
|
|
144
|
-
}
|
|
145
|
-
function addToKnowledgeBase(kb, type, name, path, content, projectRoot) {
|
|
146
|
-
const hash = simpleHash(content);
|
|
147
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
148
|
-
const existingIndex = kb.entries.findIndex((e) => e.path === path);
|
|
149
|
-
if (existingIndex >= 0) {
|
|
150
|
-
if (kb.entries[existingIndex].hash !== hash) {
|
|
151
|
-
kb.entries[existingIndex] = {
|
|
152
|
-
...kb.entries[existingIndex],
|
|
153
|
-
content,
|
|
154
|
-
hash,
|
|
155
|
-
updatedAt: now
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
} else {
|
|
159
|
-
kb.entries.push({
|
|
160
|
-
id: `${type}-${Date.now()}`,
|
|
161
|
-
type,
|
|
162
|
-
name,
|
|
163
|
-
path,
|
|
164
|
-
content,
|
|
165
|
-
hash,
|
|
166
|
-
createdAt: now,
|
|
167
|
-
updatedAt: now,
|
|
168
|
-
projectRoot
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
function generateDefaultClaudeMd(project) {
|
|
173
|
-
return `# ${project.name}
|
|
174
|
-
|
|
175
|
-
## Project Overview
|
|
176
|
-
|
|
177
|
-
This is a ${project.type} project using ${project.frameworks.join(", ") || "standard tools"}.
|
|
178
|
-
|
|
179
|
-
## Tech Stack
|
|
180
|
-
|
|
181
|
-
${project.languages.map((l) => `- ${l}`).join("\n")}
|
|
182
|
-
${project.frameworks.map((f) => `- ${f}`).join("\n")}
|
|
183
|
-
|
|
184
|
-
## Development Guidelines
|
|
185
|
-
|
|
186
|
-
### Code Style
|
|
187
|
-
- Follow existing code conventions
|
|
188
|
-
- Use TypeScript strict mode
|
|
189
|
-
- Write meaningful commit messages
|
|
190
|
-
|
|
191
|
-
### Testing
|
|
192
|
-
${project.testFrameworks.length > 0 ? `Using: ${project.testFrameworks.join(", ")}` : "- Add tests for new features"}
|
|
193
|
-
|
|
194
|
-
### Build & Deploy
|
|
195
|
-
${project.buildTools.length > 0 ? `Build tools: ${project.buildTools.join(", ")}` : "- Follow standard build process"}
|
|
196
|
-
|
|
197
|
-
## Important Files
|
|
198
|
-
|
|
199
|
-
- \`README.md\` - Project documentation
|
|
200
|
-
- \`package.json\` - Dependencies and scripts
|
|
201
|
-
|
|
202
|
-
## AI Assistant Notes
|
|
203
|
-
|
|
204
|
-
- Prefer concise, actionable responses
|
|
205
|
-
- Follow existing patterns in the codebase
|
|
206
|
-
- Ask before making breaking changes
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
*Generated by CCJK on ${dayjs().format("YYYY-MM-DD")}*
|
|
210
|
-
`;
|
|
211
|
-
}
|
|
212
|
-
async function runOnboarding(projectDir = process__default.cwd()) {
|
|
213
|
-
console.log(boxify(`
|
|
214
|
-
Welcome to CCJK!
|
|
215
|
-
|
|
216
|
-
Let's set up your project for optimal AI-assisted development.
|
|
217
|
-
This will scan your project and create a knowledge base.
|
|
218
|
-
`, "double", "\u{1F680} CCJK Setup"));
|
|
219
|
-
const result = {
|
|
220
|
-
success: false,
|
|
221
|
-
projectDetected: false,
|
|
222
|
-
claudeMdFound: false,
|
|
223
|
-
claudeMdUpdated: false,
|
|
224
|
-
agentsFound: 0,
|
|
225
|
-
skillsFound: 0,
|
|
226
|
-
knowledgeEntriesCreated: 0,
|
|
227
|
-
recommendations: []
|
|
228
|
-
};
|
|
229
|
-
const kb = loadKnowledgeBase();
|
|
230
|
-
const spinner = ora("Scanning project...").start();
|
|
231
|
-
const project = detectProject(projectDir);
|
|
232
|
-
spinner.succeed("Project detected");
|
|
233
|
-
result.projectDetected = true;
|
|
234
|
-
console.log("");
|
|
235
|
-
console.log(theme.secondary("\u{1F4C1} Project Info:"));
|
|
236
|
-
console.log(a.gray(getProjectSummary(project)));
|
|
237
|
-
console.log("");
|
|
238
|
-
spinner.start("Looking for CLAUDE.md...");
|
|
239
|
-
const claudeMd = scanClaudeMd(projectDir);
|
|
240
|
-
if (claudeMd) {
|
|
241
|
-
spinner.succeed(`Found CLAUDE.md at ${claudeMd.path}`);
|
|
242
|
-
result.claudeMdFound = true;
|
|
243
|
-
if (claudeMd.outdated) {
|
|
244
|
-
console.log(STATUS.warning("CLAUDE.md appears to be outdated (>30 days old)"));
|
|
245
|
-
const { updateClaudeMd } = await inquirer.prompt([
|
|
246
|
-
{
|
|
247
|
-
type: "confirm",
|
|
248
|
-
name: "updateClaudeMd",
|
|
249
|
-
message: "Would you like to refresh it with current project info?",
|
|
250
|
-
default: true
|
|
251
|
-
}
|
|
252
|
-
]);
|
|
253
|
-
if (updateClaudeMd) {
|
|
254
|
-
const newContent = generateDefaultClaudeMd(project);
|
|
255
|
-
const backupPath = `${claudeMd.path}.backup-${dayjs().format("YYYYMMDD")}`;
|
|
256
|
-
writeFileAtomic(backupPath, claudeMd.content);
|
|
257
|
-
writeFileAtomic(claudeMd.path, newContent);
|
|
258
|
-
console.log(STATUS.success(`Updated! Backup saved to ${backupPath}`));
|
|
259
|
-
result.claudeMdUpdated = true;
|
|
260
|
-
addToKnowledgeBase(kb, "claude-md", "CLAUDE.md", claudeMd.path, newContent, projectDir);
|
|
261
|
-
} else {
|
|
262
|
-
addToKnowledgeBase(kb, "claude-md", "CLAUDE.md", claudeMd.path, claudeMd.content, projectDir);
|
|
263
|
-
}
|
|
264
|
-
} else {
|
|
265
|
-
addToKnowledgeBase(kb, "claude-md", "CLAUDE.md", claudeMd.path, claudeMd.content, projectDir);
|
|
266
|
-
}
|
|
267
|
-
result.knowledgeEntriesCreated++;
|
|
268
|
-
} else {
|
|
269
|
-
spinner.warn("No CLAUDE.md found");
|
|
270
|
-
const { createClaudeMd } = await inquirer.prompt([
|
|
271
|
-
{
|
|
272
|
-
type: "confirm",
|
|
273
|
-
name: "createClaudeMd",
|
|
274
|
-
message: "Would you like to create one? (Recommended for AI assistance)",
|
|
275
|
-
default: true
|
|
276
|
-
}
|
|
277
|
-
]);
|
|
278
|
-
if (createClaudeMd) {
|
|
279
|
-
const newContent = generateDefaultClaudeMd(project);
|
|
280
|
-
const newPath = join(projectDir, "CLAUDE.md");
|
|
281
|
-
writeFileAtomic(newPath, newContent);
|
|
282
|
-
console.log(STATUS.success(`Created ${newPath}`));
|
|
283
|
-
result.claudeMdFound = true;
|
|
284
|
-
result.claudeMdUpdated = true;
|
|
285
|
-
addToKnowledgeBase(kb, "claude-md", "CLAUDE.md", newPath, newContent, projectDir);
|
|
286
|
-
result.knowledgeEntriesCreated++;
|
|
287
|
-
} else {
|
|
288
|
-
result.recommendations.push("Consider creating a CLAUDE.md file for better AI assistance");
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
spinner.start("Scanning for agents...");
|
|
292
|
-
const agents = scanAgents(projectDir);
|
|
293
|
-
spinner.succeed(`Found ${agents.length} agent(s)`);
|
|
294
|
-
result.agentsFound = agents.length;
|
|
295
|
-
for (const agent of agents) {
|
|
296
|
-
addToKnowledgeBase(kb, "agent", agent.name, agent.path, agent.content, projectDir);
|
|
297
|
-
result.knowledgeEntriesCreated++;
|
|
298
|
-
}
|
|
299
|
-
if (agents.length === 0) {
|
|
300
|
-
result.recommendations.push("Add custom agents in .claude-code/agents/ for specialized assistance");
|
|
301
|
-
}
|
|
302
|
-
spinner.start("Scanning for skills...");
|
|
303
|
-
const skills = scanSkills(projectDir);
|
|
304
|
-
spinner.succeed(`Found ${skills.length} skill(s)`);
|
|
305
|
-
result.skillsFound = skills.length;
|
|
306
|
-
for (const skill of skills) {
|
|
307
|
-
addToKnowledgeBase(kb, "skill", skill.name, skill.path, skill.content, projectDir);
|
|
308
|
-
result.knowledgeEntriesCreated++;
|
|
309
|
-
}
|
|
310
|
-
if (skills.length === 0) {
|
|
311
|
-
result.recommendations.push("Add custom skills in .claude/commands/ for quick actions");
|
|
312
|
-
}
|
|
313
|
-
const suggestions = generateSuggestions(project);
|
|
314
|
-
const existingContextIndex = kb.projectContexts.findIndex((c) => c.rootDir === projectDir);
|
|
315
|
-
const projectContext = {
|
|
316
|
-
rootDir: projectDir,
|
|
317
|
-
name: project.name,
|
|
318
|
-
type: project.type,
|
|
319
|
-
frameworks: project.frameworks,
|
|
320
|
-
lastScanned: (/* @__PURE__ */ new Date()).toISOString(),
|
|
321
|
-
claudeMdHash: claudeMd ? simpleHash(claudeMd.content) : void 0,
|
|
322
|
-
agentsCount: agents.length,
|
|
323
|
-
skillsCount: skills.length
|
|
324
|
-
};
|
|
325
|
-
if (existingContextIndex >= 0) {
|
|
326
|
-
kb.projectContexts[existingContextIndex] = projectContext;
|
|
327
|
-
} else {
|
|
328
|
-
kb.projectContexts.push(projectContext);
|
|
329
|
-
}
|
|
330
|
-
addToKnowledgeBase(
|
|
331
|
-
kb,
|
|
332
|
-
"project-info",
|
|
333
|
-
project.name,
|
|
334
|
-
projectDir,
|
|
335
|
-
JSON.stringify({ project, suggestions }, null, 2),
|
|
336
|
-
projectDir
|
|
337
|
-
);
|
|
338
|
-
result.knowledgeEntriesCreated++;
|
|
339
|
-
saveKnowledgeBase(kb);
|
|
340
|
-
console.log("");
|
|
341
|
-
console.log(theme.primary("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
|
|
342
|
-
console.log(theme.accent(" Setup Complete! "));
|
|
343
|
-
console.log(theme.primary("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
|
|
344
|
-
console.log("");
|
|
345
|
-
console.log(` \u{1F4DA} Knowledge entries: ${result.knowledgeEntriesCreated}`);
|
|
346
|
-
console.log(` \u{1F4C4} CLAUDE.md: ${result.claudeMdFound ? "\u2713" : "\u2717"}`);
|
|
347
|
-
console.log(` \u{1F916} Agents: ${result.agentsFound}`);
|
|
348
|
-
console.log(` \u26A1 Skills: ${result.skillsFound}`);
|
|
349
|
-
console.log("");
|
|
350
|
-
if (result.recommendations.length > 0) {
|
|
351
|
-
console.log(theme.secondary("\u{1F4A1} Recommendations:"));
|
|
352
|
-
for (const rec of result.recommendations) {
|
|
353
|
-
console.log(a.gray(` \u2022 ${rec}`));
|
|
354
|
-
}
|
|
355
|
-
console.log("");
|
|
356
|
-
}
|
|
357
|
-
console.log(theme.secondary("\u{1F4CC} Next Steps:"));
|
|
358
|
-
console.log(a.gray(" \u2022 Run `ccjk` to open the main menu"));
|
|
359
|
-
console.log(a.gray(" \u2022 Run `ccjk doctor` to check environment"));
|
|
360
|
-
console.log(a.gray(" \u2022 Run `ccjk groups enable typescript-dev` for TypeScript support"));
|
|
361
|
-
console.log("");
|
|
362
|
-
result.success = true;
|
|
363
|
-
return result;
|
|
364
|
-
}
|
|
365
|
-
async function quickSync(projectDir = process__default.cwd()) {
|
|
366
|
-
const spinner = ora("Syncing project knowledge...").start();
|
|
367
|
-
const kb = loadKnowledgeBase();
|
|
368
|
-
detectProject(projectDir);
|
|
369
|
-
const claudeMd = scanClaudeMd(projectDir);
|
|
370
|
-
if (claudeMd) {
|
|
371
|
-
addToKnowledgeBase(kb, "claude-md", "CLAUDE.md", claudeMd.path, claudeMd.content, projectDir);
|
|
372
|
-
}
|
|
373
|
-
const agents = scanAgents(projectDir);
|
|
374
|
-
for (const agent of agents) {
|
|
375
|
-
addToKnowledgeBase(kb, "agent", agent.name, agent.path, agent.content, projectDir);
|
|
376
|
-
}
|
|
377
|
-
const skills = scanSkills(projectDir);
|
|
378
|
-
for (const skill of skills) {
|
|
379
|
-
addToKnowledgeBase(kb, "skill", skill.name, skill.path, skill.content, projectDir);
|
|
380
|
-
}
|
|
381
|
-
saveKnowledgeBase(kb);
|
|
382
|
-
spinner.succeed(`Synced: ${claudeMd ? 1 : 0} CLAUDE.md, ${agents.length} agents, ${skills.length} skills`);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
export { loadKnowledgeBase, quickSync, runOnboarding, saveKnowledgeBase };
|
package/dist/chunks/package.mjs
DELETED
package/dist/chunks/paradigm.mjs
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import a from './index2.mjs';
|
|
2
|
-
import { f as fsParadigm } from '../shared/ccjk.BxSmJ8B7.mjs';
|
|
3
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
4
|
-
import 'node:fs';
|
|
5
|
-
import 'tinyglobby';
|
|
6
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
7
|
-
|
|
8
|
-
async function paradigmCommand(options = {}) {
|
|
9
|
-
console.log(a.cyan.bold("\n\u{1F3D7}\uFE0F Detecting Project Paradigm...\n"));
|
|
10
|
-
const structure = await fsParadigm.detect(process.cwd());
|
|
11
|
-
const paradigm = fsParadigm.getParadigm(structure.paradigm);
|
|
12
|
-
if (paradigm) {
|
|
13
|
-
console.log(a.white.bold(`Type: ${paradigm.name}`));
|
|
14
|
-
console.log(a.gray(`Description: ${paradigm.description}`));
|
|
15
|
-
console.log(a.gray(`Confidence: ${structure.confidence}%`));
|
|
16
|
-
console.log();
|
|
17
|
-
}
|
|
18
|
-
console.log(a.cyan.bold("\u{1F4C1} Conventions:"));
|
|
19
|
-
if (structure.conventions.sourceDir) {
|
|
20
|
-
console.log(a.white(` Source: ${structure.conventions.sourceDir}`));
|
|
21
|
-
}
|
|
22
|
-
if (structure.conventions.testDir) {
|
|
23
|
-
console.log(a.white(` Test: ${structure.conventions.testDir}`));
|
|
24
|
-
}
|
|
25
|
-
if (structure.conventions.configDir) {
|
|
26
|
-
console.log(a.white(` Config: ${structure.conventions.configDir}`));
|
|
27
|
-
}
|
|
28
|
-
if (structure.conventions.buildDir) {
|
|
29
|
-
console.log(a.white(` Build: ${structure.conventions.buildDir}`));
|
|
30
|
-
}
|
|
31
|
-
console.log();
|
|
32
|
-
if (options.role) {
|
|
33
|
-
const role = options.role;
|
|
34
|
-
const files = fsParadigm.getFilesByRole(structure, role);
|
|
35
|
-
console.log(a.cyan.bold(`\u{1F4C4} ${role.toUpperCase()} Files (${files.length}):
|
|
36
|
-
`));
|
|
37
|
-
if (files.length === 0) {
|
|
38
|
-
console.log(a.gray(" No files found for this role\n"));
|
|
39
|
-
} else {
|
|
40
|
-
for (const file of files.slice(0, 20)) {
|
|
41
|
-
console.log(a.white(` \u2022 ${file.replace(process.cwd(), "")}`));
|
|
42
|
-
}
|
|
43
|
-
if (files.length > 20) {
|
|
44
|
-
console.log(a.gray(` ... and ${files.length - 20} more`));
|
|
45
|
-
}
|
|
46
|
-
console.log();
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
console.log(a.cyan.bold("\u{1F4CA} File Map:"));
|
|
50
|
-
const roles = ["source", "test", "config", "types", "docs", "assets"];
|
|
51
|
-
for (const role of roles) {
|
|
52
|
-
const files = fsParadigm.getFilesByRole(structure, role);
|
|
53
|
-
if (files.length > 0) {
|
|
54
|
-
console.log(a.white(` ${role.padEnd(10)} ${files.length} files`));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
console.log();
|
|
58
|
-
if (options.verbose) {
|
|
59
|
-
console.log(a.gray("Use --role <role> to see specific files"));
|
|
60
|
-
console.log(a.gray("Available roles: source, test, config, types, docs, assets"));
|
|
61
|
-
console.log();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (options.verbose && paradigm) {
|
|
65
|
-
console.log(a.cyan.bold("\u{1F50D} Patterns:"));
|
|
66
|
-
for (const pattern of paradigm.patterns) {
|
|
67
|
-
console.log(a.white(` ${pattern.role.padEnd(10)} ${pattern.pattern}`));
|
|
68
|
-
console.log(a.gray(` ${pattern.description}`));
|
|
69
|
-
}
|
|
70
|
-
console.log();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { paradigmCommand };
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import a from './index2.mjs';
|
|
3
|
-
import { SETTINGS_FILE, CCJK_CONFIG_DIR } from './constants.mjs';
|
|
4
|
-
import { STATUS } from './banner.mjs';
|
|
5
|
-
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
6
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
7
|
-
import 'node:os';
|
|
8
|
-
import './index5.mjs';
|
|
9
|
-
import 'node:process';
|
|
10
|
-
import 'node:url';
|
|
11
|
-
import '../shared/ccjk.gDEDGD_t.mjs';
|
|
12
|
-
|
|
13
|
-
const PERMISSION_CONFIG_FILE = join(CCJK_CONFIG_DIR, "permissions.json");
|
|
14
|
-
const PERMISSION_TEMPLATES = [
|
|
15
|
-
{
|
|
16
|
-
id: "development",
|
|
17
|
-
name: "Development",
|
|
18
|
-
description: "Standard development permissions - file read/write, git, npm, node execution",
|
|
19
|
-
permissions: {
|
|
20
|
-
allowed: ["file-read", "file-write", "git-operations", "npm-commands", "node-execution", "mcp-server"],
|
|
21
|
-
denied: ["system-commands", "network-access", "file-delete"],
|
|
22
|
-
trustedDirectories: [],
|
|
23
|
-
autoApprovePatterns: ["*.ts", "*.js", "*.json", "*.md", "*.css", "*.html"]
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: "readonly",
|
|
28
|
-
name: "Read Only",
|
|
29
|
-
description: "Read-only access - no file modifications or command execution",
|
|
30
|
-
permissions: {
|
|
31
|
-
allowed: ["file-read"],
|
|
32
|
-
denied: ["file-write", "file-delete", "git-operations", "npm-commands", "node-execution", "system-commands", "network-access"],
|
|
33
|
-
trustedDirectories: [],
|
|
34
|
-
autoApprovePatterns: []
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
id: "full-trust",
|
|
39
|
-
name: "Full Trust",
|
|
40
|
-
description: "All operations pre-authorized - use with caution",
|
|
41
|
-
permissions: {
|
|
42
|
-
allowed: ["file-read", "file-write", "file-delete", "git-operations", "npm-commands", "node-execution", "system-commands", "network-access", "mcp-server"],
|
|
43
|
-
denied: [],
|
|
44
|
-
trustedDirectories: [],
|
|
45
|
-
autoApprovePatterns: ["*"]
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: "restricted",
|
|
50
|
-
name: "Restricted",
|
|
51
|
-
description: "Minimal permissions - all operations require confirmation",
|
|
52
|
-
permissions: {
|
|
53
|
-
allowed: [],
|
|
54
|
-
denied: ["file-read", "file-write", "file-delete", "git-operations", "npm-commands", "node-execution", "system-commands", "network-access"],
|
|
55
|
-
trustedDirectories: [],
|
|
56
|
-
autoApprovePatterns: []
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
];
|
|
60
|
-
function readPermissions() {
|
|
61
|
-
if (existsSync(PERMISSION_CONFIG_FILE)) {
|
|
62
|
-
try {
|
|
63
|
-
return JSON.parse(readFileSync(PERMISSION_CONFIG_FILE, "utf-8"));
|
|
64
|
-
} catch {
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (existsSync(SETTINGS_FILE)) {
|
|
68
|
-
try {
|
|
69
|
-
const settings = JSON.parse(readFileSync(SETTINGS_FILE, "utf-8"));
|
|
70
|
-
if (settings.permissions) {
|
|
71
|
-
return settings.permissions;
|
|
72
|
-
}
|
|
73
|
-
} catch {
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return PERMISSION_TEMPLATES.find((t) => t.id === "development").permissions;
|
|
77
|
-
}
|
|
78
|
-
function getCurrentTemplateId() {
|
|
79
|
-
const permissions = readPermissions();
|
|
80
|
-
for (const template of PERMISSION_TEMPLATES) {
|
|
81
|
-
if (JSON.stringify(permissions.allowed.sort()) === JSON.stringify(template.permissions.allowed.sort()) && JSON.stringify(permissions.denied.sort()) === JSON.stringify(template.permissions.denied.sort())) {
|
|
82
|
-
return template.id;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
function displayPermissions() {
|
|
88
|
-
const permissions = readPermissions();
|
|
89
|
-
const templateId = getCurrentTemplateId();
|
|
90
|
-
console.log(a.green("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 Claude Code Permissions \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n"));
|
|
91
|
-
console.log(a.white.bold("Trusted Directories:"));
|
|
92
|
-
if (permissions.trustedDirectories.length === 0) {
|
|
93
|
-
console.log(a.gray(" (none)"));
|
|
94
|
-
} else {
|
|
95
|
-
for (const dir of permissions.trustedDirectories) {
|
|
96
|
-
console.log(STATUS.success(dir));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
console.log("");
|
|
100
|
-
console.log(a.white.bold("Pre-authorized Operations:"));
|
|
101
|
-
const allPermissions = [
|
|
102
|
-
"file-read",
|
|
103
|
-
"file-write",
|
|
104
|
-
"file-delete",
|
|
105
|
-
"git-operations",
|
|
106
|
-
"npm-commands",
|
|
107
|
-
"node-execution",
|
|
108
|
-
"system-commands",
|
|
109
|
-
"network-access",
|
|
110
|
-
"mcp-server"
|
|
111
|
-
];
|
|
112
|
-
for (const perm of allPermissions) {
|
|
113
|
-
const label = perm.replace(/-/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
114
|
-
if (permissions.allowed.includes(perm)) {
|
|
115
|
-
console.log(STATUS.success(label));
|
|
116
|
-
} else if (permissions.denied.includes(perm)) {
|
|
117
|
-
console.log(STATUS.error(`${label} (denied)`));
|
|
118
|
-
} else {
|
|
119
|
-
console.log(STATUS.warning(`${label} (requires confirmation)`));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
console.log("");
|
|
123
|
-
if (templateId) {
|
|
124
|
-
const template = PERMISSION_TEMPLATES.find((t) => t.id === templateId);
|
|
125
|
-
console.log(a.gray(`Template: ${a.green(template?.name || templateId)}`));
|
|
126
|
-
} else {
|
|
127
|
-
console.log(a.gray("Template: custom"));
|
|
128
|
-
}
|
|
129
|
-
console.log("");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { PERMISSION_TEMPLATES, displayPermissions, getCurrentTemplateId, readPermissions };
|