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,265 +0,0 @@
|
|
|
1
|
-
import process__default from 'node:process';
|
|
2
|
-
import a from './index2.mjs';
|
|
3
|
-
import { i as inquirer } from './index3.mjs';
|
|
4
|
-
import './main.mjs';
|
|
5
|
-
import { i18n } from './index5.mjs';
|
|
6
|
-
import { g as getPermissionManager } from '../shared/ccjk.SPoXMvZD.mjs';
|
|
7
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
8
|
-
import 'node:readline';
|
|
9
|
-
import 'stream';
|
|
10
|
-
import 'node:tty';
|
|
11
|
-
import 'node:async_hooks';
|
|
12
|
-
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
13
|
-
import 'node:util';
|
|
14
|
-
import 'tty';
|
|
15
|
-
import 'fs';
|
|
16
|
-
import 'child_process';
|
|
17
|
-
import 'node:path';
|
|
18
|
-
import 'node:os';
|
|
19
|
-
import 'node:crypto';
|
|
20
|
-
import 'buffer';
|
|
21
|
-
import 'string_decoder';
|
|
22
|
-
import 'module';
|
|
23
|
-
import 'node:child_process';
|
|
24
|
-
import 'node:stream';
|
|
25
|
-
import 'node:fs';
|
|
26
|
-
import 'node:url';
|
|
27
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
28
|
-
|
|
29
|
-
const permissionManager = getPermissionManager();
|
|
30
|
-
async function listPermissions(options) {
|
|
31
|
-
const format = options.format || "table";
|
|
32
|
-
const verbose = options.verbose || false;
|
|
33
|
-
const category = options.category;
|
|
34
|
-
const type = options.type;
|
|
35
|
-
let rules = permissionManager.getAllRules();
|
|
36
|
-
if (type) {
|
|
37
|
-
rules = rules.filter((r) => r.type === type);
|
|
38
|
-
}
|
|
39
|
-
if (category) {
|
|
40
|
-
rules = rules.filter((r) => r.category === category);
|
|
41
|
-
}
|
|
42
|
-
if (format === "json") {
|
|
43
|
-
console.log(JSON.stringify(rules, null, 2));
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
console.log("");
|
|
47
|
-
console.log(a.bold("\u{1F4CB} CCJK Permissions\n"));
|
|
48
|
-
const stats = permissionManager.getStats();
|
|
49
|
-
console.log(a.dim(`Total: ${stats.total} | Allow: ${stats.allow} | Deny: ${stats.deny}
|
|
50
|
-
`));
|
|
51
|
-
if (rules.length === 0) {
|
|
52
|
-
console.log(a.yellow("No permissions configured."));
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (format === "list") {
|
|
56
|
-
for (const rule of rules) {
|
|
57
|
-
const typeColor = rule.type === "allow" ? a.green : a.red;
|
|
58
|
-
console.log(`${typeColor(rule.type.padEnd(6))} ${a.cyan(rule.pattern)} (${rule.category})`);
|
|
59
|
-
if (verbose) {
|
|
60
|
-
if (rule.description) {
|
|
61
|
-
console.log(a.gray(` Description: ${rule.description}`));
|
|
62
|
-
}
|
|
63
|
-
console.log(a.gray(` Source: ${rule.source}`));
|
|
64
|
-
if (rule.priority !== void 0) {
|
|
65
|
-
console.log(a.gray(` Priority: ${rule.priority}`));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
console.log(
|
|
71
|
-
a.bold("Type".padEnd(8)) + a.bold("Pattern".padEnd(40)) + a.bold("Category".padEnd(12)) + a.bold("Source")
|
|
72
|
-
);
|
|
73
|
-
console.log(a.dim("\u2500".repeat(80)));
|
|
74
|
-
for (const rule of rules) {
|
|
75
|
-
const typeColor = rule.type === "allow" ? a.green : a.red;
|
|
76
|
-
const type2 = typeColor(rule.type.padEnd(8));
|
|
77
|
-
const pattern = a.cyan(rule.pattern.padEnd(40));
|
|
78
|
-
const category2 = a.yellow(rule.category.padEnd(12));
|
|
79
|
-
const source = a.dim(rule.source);
|
|
80
|
-
console.log(`${type2}${pattern}${category2}${source}`);
|
|
81
|
-
if (verbose && rule.description) {
|
|
82
|
-
console.log(a.gray(` \u2514\u2500 ${rule.description}`));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
console.log("");
|
|
87
|
-
}
|
|
88
|
-
async function checkPermission(resource, options) {
|
|
89
|
-
const isZh = i18n.language === "zh-CN";
|
|
90
|
-
if (!resource) {
|
|
91
|
-
console.error(a.red(isZh ? "\u9519\u8BEF\uFF1A\u9700\u8981\u6307\u5B9A\u8D44\u6E90" : "Error: Resource is required"));
|
|
92
|
-
console.log(isZh ? "\u7528\u6CD5: ccjk permissions check <resource>" : "Usage: ccjk permissions check <resource>");
|
|
93
|
-
process__default.exit(1);
|
|
94
|
-
}
|
|
95
|
-
const action = options.action || "execute";
|
|
96
|
-
const verbose = options.verbose || false;
|
|
97
|
-
console.log("");
|
|
98
|
-
console.log(a.bold(`${a.cyan("\u{1F50D}")} ${isZh ? "\u68C0\u67E5\u6743\u9650" : "Checking Permission"}: ${a.cyan(resource)}
|
|
99
|
-
`));
|
|
100
|
-
const result = await permissionManager.checkPermission(action, resource);
|
|
101
|
-
if (result.allowed) {
|
|
102
|
-
console.log(a.green(`\u2713 ${isZh ? "\u5141\u8BB8" : "ALLOWED"}`));
|
|
103
|
-
console.log(` ${a.dim("Reason:")} ${result.reason}`);
|
|
104
|
-
if (verbose && result.matchedRule) {
|
|
105
|
-
console.log(` ${a.dim("Matched rule:")} ${a.cyan(result.matchedRule.pattern)}`);
|
|
106
|
-
console.log(` ${a.dim("Rule type:")} ${result.matchedRule.type}`);
|
|
107
|
-
console.log(` ${a.dim("Source:")} ${result.matchedRule.source}`);
|
|
108
|
-
}
|
|
109
|
-
} else {
|
|
110
|
-
console.log(a.red(`\u2717 ${isZh ? "\u62D2\u7EDD" : "DENIED"}`));
|
|
111
|
-
console.log(` ${a.dim("Reason:")} ${result.reason}`);
|
|
112
|
-
console.log(a.yellow(isZh ? ' \u63D0\u793A\uFF1A\u4F7F\u7528 "ccjk permissions add" \u6DFB\u52A0\u6743\u9650' : ' Tip: Use "ccjk permissions add" to grant permission'));
|
|
113
|
-
}
|
|
114
|
-
console.log("");
|
|
115
|
-
}
|
|
116
|
-
async function grantPermission(resource, options) {
|
|
117
|
-
const isZh = i18n.language === "zh-CN";
|
|
118
|
-
if (!resource) {
|
|
119
|
-
console.error(a.red(isZh ? "\u9519\u8BEF\uFF1A\u9700\u8981\u6307\u5B9A\u8D44\u6E90" : "Error: Resource is required"));
|
|
120
|
-
console.log(isZh ? "\u7528\u6CD5: ccjk permissions grant <pattern>" : "Usage: ccjk permissions grant <pattern>");
|
|
121
|
-
process__default.exit(1);
|
|
122
|
-
}
|
|
123
|
-
const validation = permissionManager.validatePattern(resource);
|
|
124
|
-
if (!validation.valid) {
|
|
125
|
-
console.error(a.red(`${isZh ? "\u9519\u8BEF" : "Error"}: ${validation.error}`));
|
|
126
|
-
process__default.exit(1);
|
|
127
|
-
}
|
|
128
|
-
console.log("");
|
|
129
|
-
console.log(a.bold(`${a.cyan("\u2713")} ${isZh ? "\u6388\u4E88\u6743\u9650" : "Granting Permission"}: ${a.cyan(resource)}
|
|
130
|
-
`));
|
|
131
|
-
const permission = {
|
|
132
|
-
type: "allow",
|
|
133
|
-
pattern: resource,
|
|
134
|
-
scope: "global",
|
|
135
|
-
description: options.description || "Granted via CLI"
|
|
136
|
-
};
|
|
137
|
-
permissionManager.addPermission(permission);
|
|
138
|
-
console.log(a.green(isZh ? "\u6743\u9650\u5DF2\u6210\u529F\u6388\u4E88\uFF01" : "Permission granted successfully!"));
|
|
139
|
-
console.log("");
|
|
140
|
-
}
|
|
141
|
-
async function revokePermission(resource, _options) {
|
|
142
|
-
const isZh = i18n.language === "zh-CN";
|
|
143
|
-
if (!resource) {
|
|
144
|
-
console.error(a.red(isZh ? "\u9519\u8BEF\uFF1A\u9700\u8981\u6307\u5B9A\u8D44\u6E90" : "Error: Resource is required"));
|
|
145
|
-
console.log(isZh ? "\u7528\u6CD5: ccjk permissions revoke <pattern>" : "Usage: ccjk permissions revoke <pattern>");
|
|
146
|
-
process__default.exit(1);
|
|
147
|
-
}
|
|
148
|
-
console.log("");
|
|
149
|
-
console.log(a.bold(`${a.red("\u2717")} ${isZh ? "\u64A4\u9500\u6743\u9650" : "Revoking Permission"}: ${a.cyan(resource)}
|
|
150
|
-
`));
|
|
151
|
-
const removed = permissionManager.removePermission(resource);
|
|
152
|
-
if (removed) {
|
|
153
|
-
console.log(a.green(isZh ? "\u6743\u9650\u5DF2\u6210\u529F\u64A4\u9500\uFF01" : "Permission revoked successfully!"));
|
|
154
|
-
} else {
|
|
155
|
-
console.log(a.yellow(isZh ? "\u672A\u627E\u5230\u5339\u914D\u7684\u6743\u9650\u89C4\u5219" : "No matching permission found"));
|
|
156
|
-
}
|
|
157
|
-
console.log("");
|
|
158
|
-
}
|
|
159
|
-
async function resetPermissions(_options) {
|
|
160
|
-
const isZh = i18n.language === "zh-CN";
|
|
161
|
-
console.log("");
|
|
162
|
-
console.log(a.bold.yellow(`${a.yellow("\u26A0\uFE0F")} ${isZh ? "\u91CD\u7F6E\u6240\u6709\u6743\u9650" : "Resetting All Permissions"}
|
|
163
|
-
`));
|
|
164
|
-
const { confirm } = await inquirer.prompt({
|
|
165
|
-
type: "confirm",
|
|
166
|
-
name: "confirm",
|
|
167
|
-
message: isZh ? "\u786E\u5B9A\u8981\u6E05\u9664\u6240\u6709\u6743\u9650\u89C4\u5219\u5417\uFF1F" : "Are you sure you want to reset all permissions?",
|
|
168
|
-
default: false
|
|
169
|
-
});
|
|
170
|
-
if (!confirm) {
|
|
171
|
-
console.log(a.gray(isZh ? "\u64CD\u4F5C\u5DF2\u53D6\u6D88" : "Operation cancelled"));
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
permissionManager.clearPermissions();
|
|
175
|
-
console.log(a.green(isZh ? "\u6240\u6709\u6743\u9650\u5DF2\u6E05\u9664\uFF01" : "All permissions have been reset!"));
|
|
176
|
-
console.log("");
|
|
177
|
-
}
|
|
178
|
-
async function exportPermissions(filePath, _options) {
|
|
179
|
-
const fs = await import('node:fs/promises');
|
|
180
|
-
const path = await import('node:path');
|
|
181
|
-
const outputPath = filePath || path.join(process__default.cwd(), "permissions.json");
|
|
182
|
-
console.log("");
|
|
183
|
-
console.log(a.bold(`\u{1F4E4} ${a.cyan("Exporting Permissions")} ${a.dim("to")} ${a.cyan(outputPath)}
|
|
184
|
-
`));
|
|
185
|
-
const permissions = permissionManager.exportPermissions();
|
|
186
|
-
await fs.writeFile(outputPath, JSON.stringify(permissions, null, 2), "utf-8");
|
|
187
|
-
const totalCount = (permissions.allow?.length || 0) + (permissions.deny?.length || 0);
|
|
188
|
-
console.log(a.green(`\u2713 Exported ${totalCount} permission(s) successfully!`));
|
|
189
|
-
console.log("");
|
|
190
|
-
}
|
|
191
|
-
async function importPermissions(filePath, options) {
|
|
192
|
-
const isZh = i18n.language === "zh-CN";
|
|
193
|
-
if (!filePath) {
|
|
194
|
-
console.error(a.red(isZh ? "\u9519\u8BEF\uFF1A\u9700\u8981\u6307\u5B9A\u6587\u4EF6\u8DEF\u5F84" : "Error: File path is required"));
|
|
195
|
-
console.log(isZh ? "\u7528\u6CD5: ccjk permissions import <file>" : "Usage: ccjk permissions import <file>");
|
|
196
|
-
process__default.exit(1);
|
|
197
|
-
}
|
|
198
|
-
const fs = await import('node:fs/promises');
|
|
199
|
-
console.log("");
|
|
200
|
-
console.log(a.bold(`\u{1F4E5} ${a.cyan("Importing Permissions")} ${a.dim("from")} ${a.cyan(filePath)}
|
|
201
|
-
`));
|
|
202
|
-
try {
|
|
203
|
-
const content = await fs.readFile(filePath, "utf-8");
|
|
204
|
-
const config = JSON.parse(content);
|
|
205
|
-
if (!config.allow && !config.deny) {
|
|
206
|
-
throw new TypeError(isZh ? "\u65E0\u6548\u7684\u6743\u9650\u6587\u4EF6\u683C\u5F0F\u3002\u671F\u671B { allow: [], deny: [] }" : "Invalid permissions file format. Expected { allow: [], deny: [] }");
|
|
207
|
-
}
|
|
208
|
-
const merge = options.merge ?? false;
|
|
209
|
-
permissionManager.importPermissions(config, merge);
|
|
210
|
-
const totalCount = (config.allow?.length || 0) + (config.deny?.length || 0);
|
|
211
|
-
console.log(a.green(`\u2713 Imported ${totalCount} permission(s) successfully!`));
|
|
212
|
-
} catch (error) {
|
|
213
|
-
console.error(a.red(`${isZh ? "\u5BFC\u5165\u6743\u9650\u65F6\u51FA\u9519" : "Error importing permissions"}:`), error);
|
|
214
|
-
process__default.exit(1);
|
|
215
|
-
}
|
|
216
|
-
console.log("");
|
|
217
|
-
}
|
|
218
|
-
function permissionsHelp(_options) {
|
|
219
|
-
const isZh = i18n.language === "zh-CN";
|
|
220
|
-
console.log("");
|
|
221
|
-
console.log(a.bold.cyan(`\u{1F4CB} ${isZh ? "CCJK \u6743\u9650\u7BA1\u7406" : "CCJK Permissions Management"}
|
|
222
|
-
`));
|
|
223
|
-
console.log(a.bold(isZh ? "\u7528\u6CD5\uFF1A" : "Usage:"));
|
|
224
|
-
console.log(" ccjk permissions [action] [...args]\n");
|
|
225
|
-
console.log(a.bold(isZh ? "\u64CD\u4F5C\uFF1A" : "Actions:"));
|
|
226
|
-
console.log(` list ${isZh ? "\u5217\u51FA\u6240\u6709\u6743\u9650" : "List all permissions"}`);
|
|
227
|
-
console.log(` search [query] ${isZh ? "\u4EA4\u4E92\u5F0F\u641C\u7D22\u6743\u9650" : "Interactive permission search"}`);
|
|
228
|
-
console.log(` check <resource> ${isZh ? "\u68C0\u67E5\u8D44\u6E90\u6743\u9650" : "Check permission for a resource"}`);
|
|
229
|
-
console.log(` grant <pattern> ${isZh ? "\u6388\u4E88\u6743\u9650" : "Grant permission for a pattern"}`);
|
|
230
|
-
console.log(` revoke <pattern> ${isZh ? "\u64A4\u9500\u6743\u9650" : "Revoke permission for a pattern"}`);
|
|
231
|
-
console.log(` reset ${isZh ? "\u91CD\u7F6E\u6240\u6709\u6743\u9650" : "Reset all permissions"}`);
|
|
232
|
-
console.log(` test <pattern> ${isZh ? "\u6D4B\u8BD5\u6A21\u5F0F\u5339\u914D" : "Test pattern matching"}`);
|
|
233
|
-
console.log(` diagnose [pattern] ${isZh ? "\u663E\u793A\u89C4\u5219\u8BCA\u65AD" : "Show rule diagnostics"}`);
|
|
234
|
-
console.log(` examples ${isZh ? "\u663E\u793A\u6A21\u5F0F\u793A\u4F8B" : "Show pattern examples"}`);
|
|
235
|
-
console.log(` export [file] ${isZh ? "\u5BFC\u51FA\u6743\u9650\u5230\u6587\u4EF6" : "Export permissions to a file"}`);
|
|
236
|
-
console.log(` import <file> ${isZh ? "\u4ECE\u6587\u4EF6\u5BFC\u5165\u6743\u9650" : "Import permissions from a file"}
|
|
237
|
-
`);
|
|
238
|
-
console.log(a.bold(isZh ? "\u9009\u9879\uFF1A" : "Options:"));
|
|
239
|
-
console.log(` --format, -f ${isZh ? "\u8F93\u51FA\u683C\u5F0F (table|json|list)" : "Output format (table|json|list)"}`);
|
|
240
|
-
console.log(` --verbose, -v ${isZh ? "\u8BE6\u7EC6\u8F93\u51FA" : "Verbose output"}`);
|
|
241
|
-
console.log(` --type, -t ${isZh ? "\u8FC7\u6EE4\u7C7B\u578B (allow|deny)" : "Filter by type (allow|deny)"}`);
|
|
242
|
-
console.log(` --category, -c ${isZh ? "\u8FC7\u6EE4\u5206\u7C7B" : "Filter by category"}`);
|
|
243
|
-
console.log(` --action, -a ${isZh ? "\u68C0\u67E5\u7684\u64CD\u4F5C" : "Action to check"}`);
|
|
244
|
-
console.log(` --description, -d ${isZh ? "\u89C4\u5219\u63CF\u8FF0" : "Rule description"}`);
|
|
245
|
-
console.log(` --merge ${isZh ? "\u5408\u5E76\u5BFC\u5165\uFF08\u800C\u4E0D\u662F\u66FF\u6362\uFF09" : "Merge on import (not replace)"}
|
|
246
|
-
`);
|
|
247
|
-
console.log(a.bold(isZh ? "\u793A\u4F8B\uFF1A" : "Examples:"));
|
|
248
|
-
console.log(" ccjk permissions list");
|
|
249
|
-
console.log(" ccjk permissions search");
|
|
250
|
-
console.log(' ccjk permissions check "Bash(npm install)"');
|
|
251
|
-
console.log(' ccjk permissions grant "Bash(npm *)"');
|
|
252
|
-
console.log(' ccjk permissions test "mcp__server__*"');
|
|
253
|
-
console.log(" ccjk permissions diagnose");
|
|
254
|
-
console.log(" ccjk permissions examples\n");
|
|
255
|
-
console.log(a.bold(isZh ? "\u6A21\u5F0F\u683C\u5F0F\uFF1A" : "Pattern Formats:"));
|
|
256
|
-
console.log(` Bash(npm install) ${isZh ? "\u7CBE\u786E\u5339\u914D Bash \u547D\u4EE4" : "Exact Bash command match"}`);
|
|
257
|
-
console.log(` Bash(npm *) ${isZh ? "\u5339\u914D\u6240\u6709 npm \u547D\u4EE4" : "Match all npm commands"}`);
|
|
258
|
-
console.log(` Bash(* install) ${isZh ? '\u5339\u914D\u4EFB\u610F "* install" \u547D\u4EE4' : 'Match any "* install" command'}`);
|
|
259
|
-
console.log(` mcp__server__* ${isZh ? "\u5339\u914D MCP \u670D\u52A1\u5668\u5DE5\u5177" : "Match MCP server tools"}`);
|
|
260
|
-
console.log(` /home/user/* ${isZh ? "\u5339\u914D\u8DEF\u5F84\u6A21\u5F0F" : "Match path patterns"}`);
|
|
261
|
-
console.log(` https://api.* ${isZh ? "\u5339\u914D URL \u6A21\u5F0F" : "Match URL patterns"}
|
|
262
|
-
`);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export { checkPermission, exportPermissions, grantPermission, importPermissions, listPermissions, permissionsHelp, resetPermissions, revokePermission };
|