ccjk 12.0.0 → 12.0.2
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/dist/chunks/agent-teams.mjs +17 -18
- package/dist/chunks/agent.mjs +105 -102
- package/dist/chunks/agents.mjs +87 -77
- package/dist/chunks/api-cli.mjs +41 -27
- package/dist/chunks/api-providers.mjs +2 -4
- package/dist/chunks/api.mjs +22 -11
- package/dist/chunks/auto-bootstrap.mjs +3 -5
- package/dist/chunks/auto-init.mjs +3 -4
- package/dist/chunks/auto-updater.mjs +103 -91
- package/dist/chunks/banner.mjs +41 -42
- package/dist/chunks/boost.mjs +30 -31
- package/dist/chunks/ccjk-agents.mjs +6 -9
- package/dist/chunks/ccjk-all.mjs +703 -85
- package/dist/chunks/ccjk-config.mjs +6 -6
- package/dist/chunks/ccjk-hooks.mjs +20 -9
- package/dist/chunks/ccjk-mcp.mjs +64 -52
- package/dist/chunks/ccjk-setup.mjs +35 -25
- package/dist/chunks/ccjk-skills.mjs +51 -41
- package/dist/chunks/ccr.mjs +42 -32
- package/dist/chunks/ccu.mjs +16 -12
- package/dist/chunks/check-updates.mjs +30 -19
- package/dist/chunks/claude-code-config-manager.mjs +25 -10
- package/dist/chunks/claude-code-incremental-manager.mjs +65 -51
- package/dist/chunks/claude-config.mjs +2 -2
- package/dist/chunks/claude-wrapper.mjs +9 -6
- package/dist/chunks/cleanup-migration.mjs +1 -1
- package/dist/chunks/cli-hook.mjs +10 -3
- package/dist/chunks/cloud-sync.mjs +1 -1
- package/dist/chunks/codex-config-switch.mjs +58 -45
- package/dist/chunks/codex-provider-manager.mjs +29 -16
- package/dist/chunks/codex-uninstaller.mjs +5 -6
- package/dist/chunks/codex.mjs +89 -89
- package/dist/chunks/commands.mjs +28 -29
- package/dist/chunks/commands2.mjs +4 -3
- package/dist/chunks/commit.mjs +42 -23
- package/dist/chunks/completion.mjs +46 -47
- package/dist/chunks/config-consolidator.mjs +12 -13
- package/dist/chunks/config-switch.mjs +66 -53
- package/dist/chunks/config.mjs +10 -10
- package/dist/chunks/config2.mjs +53 -42
- package/dist/chunks/config3.mjs +107 -93
- package/dist/chunks/constants.mjs +2 -4
- package/dist/chunks/context-loader.mjs +5 -4
- package/dist/chunks/context.mjs +77 -76
- package/dist/chunks/convoy-manager.mjs +4 -4
- package/dist/chunks/dashboard.mjs +28 -29
- package/dist/chunks/doctor.mjs +68 -54
- package/dist/chunks/evolution.mjs +37 -38
- package/dist/chunks/features.mjs +103 -92
- package/dist/chunks/fs-operations.mjs +1 -1
- package/dist/chunks/health-alerts.mjs +1 -1
- package/dist/chunks/health-check.mjs +1 -1
- package/dist/chunks/help.mjs +117 -116
- package/dist/chunks/hook-installer.mjs +3 -2
- package/dist/chunks/index.mjs +20 -6
- package/dist/chunks/index10.mjs +1171 -0
- package/dist/chunks/index11.mjs +1008 -0
- package/dist/chunks/index12.mjs +193 -0
- package/dist/chunks/index13.mjs +218 -0
- package/dist/chunks/index14.mjs +663 -0
- package/dist/chunks/index2.mjs +19 -10
- package/dist/chunks/index3.mjs +19079 -164
- package/dist/chunks/index4.mjs +8 -1171
- package/dist/chunks/index5.mjs +7479 -884
- package/dist/chunks/index6.mjs +160 -184
- package/dist/chunks/index7.mjs +3573 -653
- package/dist/chunks/index8.mjs +19 -0
- package/dist/chunks/index9.mjs +616 -0
- package/dist/chunks/init.mjs +173 -173
- package/dist/chunks/installer.mjs +92 -82
- package/dist/chunks/installer2.mjs +3 -2
- package/dist/chunks/interview.mjs +118 -107
- package/dist/chunks/json-config.mjs +3 -2
- package/dist/chunks/linux.mjs +3863 -0
- package/dist/chunks/macos.mjs +69 -0
- package/dist/chunks/main.mjs +635 -0
- package/dist/chunks/marketplace.mjs +69 -66
- package/dist/chunks/mcp-cli.mjs +61 -48
- package/dist/chunks/mcp.mjs +140 -127
- package/dist/chunks/menu.mjs +85 -85
- package/dist/chunks/metrics-display.mjs +41 -40
- package/dist/chunks/migrator.mjs +4 -5
- package/dist/chunks/monitor.mjs +95 -95
- package/dist/chunks/notification.mjs +151 -141
- package/dist/chunks/onboarding.mjs +26 -15
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/paradigm.mjs +24 -23
- package/dist/chunks/permission-manager.mjs +10 -11
- package/dist/chunks/permissions.mjs +72 -57
- package/dist/chunks/persistence-manager.mjs +97 -84
- package/dist/chunks/persistence.mjs +1 -1
- package/dist/chunks/platform.mjs +29 -29
- package/dist/chunks/plugin.mjs +104 -105
- package/dist/chunks/prompts.mjs +36 -25
- package/dist/chunks/providers.mjs +68 -69
- package/dist/chunks/quick-actions.mjs +71 -72
- package/dist/chunks/quick-provider.mjs +56 -40
- package/dist/chunks/quick-setup.mjs +71 -60
- package/dist/chunks/remote.mjs +21 -12
- package/dist/chunks/session.mjs +116 -103
- package/dist/chunks/sessions.mjs +29 -28
- package/dist/chunks/silent-updater.mjs +8 -10
- package/dist/chunks/simple-config.mjs +13 -10
- package/dist/chunks/skill.mjs +8560 -103
- package/dist/chunks/skills-sync.mjs +5212 -79
- package/dist/chunks/skills.mjs +105 -94
- package/dist/chunks/slash-commands.mjs +36 -37
- package/dist/chunks/smart-defaults.mjs +7 -3
- package/dist/chunks/smart-guide.mjs +1 -1
- package/dist/chunks/startup.mjs +2 -4
- package/dist/chunks/stats.mjs +41 -42
- package/dist/chunks/status.mjs +49 -50
- package/dist/chunks/team.mjs +24 -12
- package/dist/chunks/thinking.mjs +74 -63
- package/dist/chunks/trace.mjs +20 -19
- package/dist/chunks/uninstall.mjs +69 -56
- package/dist/chunks/update.mjs +39 -28
- package/dist/chunks/upgrade-manager.mjs +24 -18
- package/dist/chunks/version-checker.mjs +45 -41
- package/dist/chunks/vim.mjs +81 -69
- package/dist/chunks/windows.mjs +14 -0
- package/dist/chunks/workflows.mjs +15 -15
- package/dist/chunks/wsl.mjs +129 -0
- package/dist/chunks/zero-config.mjs +45 -34
- package/dist/cli.mjs +20 -20
- package/dist/index.mjs +41 -31
- package/dist/shared/ccjk.BAGoDD49.mjs +36 -0
- package/dist/shared/ccjk.BBtCGd_g.mjs +899 -0
- package/dist/shared/{ccjk.CGcy7cNM.mjs → ccjk.BDKUdmLk.mjs} +1 -1
- package/dist/shared/{ccjk.DtMBiwVG.mjs → ccjk.BFxsJM0k.mjs} +1 -1
- package/dist/shared/{ccjk.j4uut26D.mjs → ccjk.BIxuVL3_.mjs} +5 -5
- package/dist/shared/ccjk.BRZ9ww8S.mjs +142 -0
- package/dist/shared/{ccjk.CN0edl87.mjs → ccjk.BSYWk9ML.mjs} +1 -1
- package/dist/shared/{ccjk.Dk1HDseQ.mjs → ccjk.BnpWvs9V.mjs} +75 -75
- package/dist/shared/ccjk.BoApaI4j.mjs +28 -0
- package/dist/shared/{ccjk.DKojSRzw.mjs → ccjk.BrPUmTqm.mjs} +1 -1
- package/dist/shared/{ccjk.C10pepYx.mjs → ccjk.BxSmJ8B7.mjs} +1 -1
- package/dist/shared/ccjk.Bx_rmYfN.mjs +69 -0
- package/dist/shared/ccjk.COweQ1RR.mjs +5 -0
- package/dist/shared/{ccjk.BN90X6oc.mjs → ccjk.CePkJq2S.mjs} +17 -17
- package/dist/shared/{ccjk.Bvoex4TZ.mjs → ccjk.CfKKcvWy.mjs} +1 -1
- package/dist/shared/ccjk.Cjgrln_h.mjs +297 -0
- package/dist/shared/ccjk.CxpGa6MC.mjs +2724 -0
- package/dist/shared/{ccjk.DfwJOEok.mjs → ccjk.D5MFQT7w.mjs} +1 -1
- package/dist/shared/{ccjk.cChAaGgT.mjs → ccjk.DG_o24cZ.mjs} +6 -6
- package/dist/shared/{ccjk.bhFAMRyc.mjs → ccjk.DLLw-h4Y.mjs} +32 -32
- package/dist/shared/ccjk.DOwtZMk8.mjs +4019 -0
- package/dist/shared/{ccjk.BsXQugfY.mjs → ccjk.DTdjs-qK.mjs} +13 -13
- package/dist/shared/{ccjk.Bdhyg3X-.mjs → ccjk.DsYaCCx4.mjs} +1 -1
- package/dist/shared/ccjk.KfSWcGlE.mjs +38 -0
- package/dist/shared/ccjk.RyizuzOI.mjs +21 -0
- package/dist/shared/{ccjk.h7_W-wTs.mjs → ccjk.SPoXMvZD.mjs} +1 -1
- package/dist/shared/ccjk.T_cX87dY.mjs +15 -0
- package/dist/shared/{ccjk.CrB6OYHv.mjs → ccjk._dESH4Rk.mjs} +2 -2
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +249 -0
- package/dist/shared/{ccjk.CBhIZiPz.mjs → ccjk.hoqrwWdN.mjs} +1 -1
- package/dist/shared/{ccjk.BNwRnWYx.mjs → ccjk.s7OCVzdd.mjs} +1230 -33
- package/dist/shared/{ccjk.BOIUTf5z.mjs → ccjk.waa2ikKJ.mjs} +8 -9
- package/package.json +31 -30
- package/dist/shared/ccjk.DHbrGcgg.mjs +0 -13
- package/dist/shared/ccjk.DntgA8fQ.mjs +0 -42
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import { existsSync, readFileSync, readdirSync, mkdirSync, statSync } from 'node:fs';
|
|
2
2
|
import process__default from 'node:process';
|
|
3
|
-
import
|
|
4
|
-
import dayjs from '
|
|
5
|
-
import inquirer from '
|
|
6
|
-
import ora from '
|
|
7
|
-
import { join, basename } from 'pathe';
|
|
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';
|
|
8
7
|
import { CCJK_CONFIG_DIR } from './constants.mjs';
|
|
9
|
-
import { d as detectProject, g as getProjectSummary, a as generateSuggestions } from '../shared/ccjk.
|
|
8
|
+
import { d as detectProject, g as getProjectSummary, a as generateSuggestions } from '../shared/ccjk.hoqrwWdN.mjs';
|
|
10
9
|
import { boxify, COLORS as theme, STATUS } from './banner.mjs';
|
|
11
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';
|
|
12
23
|
import 'node:os';
|
|
13
|
-
import '
|
|
24
|
+
import 'node:crypto';
|
|
25
|
+
import 'buffer';
|
|
26
|
+
import 'string_decoder';
|
|
27
|
+
import './index5.mjs';
|
|
14
28
|
import 'node:url';
|
|
15
|
-
import 'i18next';
|
|
16
|
-
import 'i18next-fs-backend';
|
|
17
29
|
import './package.mjs';
|
|
18
|
-
import 'node:crypto';
|
|
19
30
|
import 'node:fs/promises';
|
|
20
31
|
|
|
21
32
|
const KNOWLEDGE_BASE_FILE = join(CCJK_CONFIG_DIR, "knowledge-base.json");
|
|
@@ -222,7 +233,7 @@ async function runOnboarding(projectDir = process__default.cwd()) {
|
|
|
222
233
|
result.projectDetected = true;
|
|
223
234
|
console.log("");
|
|
224
235
|
console.log(theme.secondary("\u{1F4C1} Project Info:"));
|
|
225
|
-
console.log(
|
|
236
|
+
console.log(a.gray(getProjectSummary(project)));
|
|
226
237
|
console.log("");
|
|
227
238
|
spinner.start("Looking for CLAUDE.md...");
|
|
228
239
|
const claudeMd = scanClaudeMd(projectDir);
|
|
@@ -339,14 +350,14 @@ async function runOnboarding(projectDir = process__default.cwd()) {
|
|
|
339
350
|
if (result.recommendations.length > 0) {
|
|
340
351
|
console.log(theme.secondary("\u{1F4A1} Recommendations:"));
|
|
341
352
|
for (const rec of result.recommendations) {
|
|
342
|
-
console.log(
|
|
353
|
+
console.log(a.gray(` \u2022 ${rec}`));
|
|
343
354
|
}
|
|
344
355
|
console.log("");
|
|
345
356
|
}
|
|
346
357
|
console.log(theme.secondary("\u{1F4CC} Next Steps:"));
|
|
347
|
-
console.log(
|
|
348
|
-
console.log(
|
|
349
|
-
console.log(
|
|
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"));
|
|
350
361
|
console.log("");
|
|
351
362
|
result.success = true;
|
|
352
363
|
return result;
|
package/dist/chunks/package.mjs
CHANGED
package/dist/chunks/paradigm.mjs
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { f as fsParadigm } from '../shared/ccjk.
|
|
1
|
+
import a from './index2.mjs';
|
|
2
|
+
import { f as fsParadigm } from '../shared/ccjk.BxSmJ8B7.mjs';
|
|
3
|
+
import '../shared/ccjk.BAGoDD49.mjs';
|
|
3
4
|
import 'node:fs';
|
|
4
|
-
import 'pathe';
|
|
5
5
|
import 'tinyglobby';
|
|
6
|
+
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
6
7
|
|
|
7
8
|
async function paradigmCommand(options = {}) {
|
|
8
|
-
console.log(
|
|
9
|
+
console.log(a.cyan.bold("\n\u{1F3D7}\uFE0F Detecting Project Paradigm...\n"));
|
|
9
10
|
const structure = await fsParadigm.detect(process.cwd());
|
|
10
11
|
const paradigm = fsParadigm.getParadigm(structure.paradigm);
|
|
11
12
|
if (paradigm) {
|
|
12
|
-
console.log(
|
|
13
|
-
console.log(
|
|
14
|
-
console.log(
|
|
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}%`));
|
|
15
16
|
console.log();
|
|
16
17
|
}
|
|
17
|
-
console.log(
|
|
18
|
+
console.log(a.cyan.bold("\u{1F4C1} Conventions:"));
|
|
18
19
|
if (structure.conventions.sourceDir) {
|
|
19
|
-
console.log(
|
|
20
|
+
console.log(a.white(` Source: ${structure.conventions.sourceDir}`));
|
|
20
21
|
}
|
|
21
22
|
if (structure.conventions.testDir) {
|
|
22
|
-
console.log(
|
|
23
|
+
console.log(a.white(` Test: ${structure.conventions.testDir}`));
|
|
23
24
|
}
|
|
24
25
|
if (structure.conventions.configDir) {
|
|
25
|
-
console.log(
|
|
26
|
+
console.log(a.white(` Config: ${structure.conventions.configDir}`));
|
|
26
27
|
}
|
|
27
28
|
if (structure.conventions.buildDir) {
|
|
28
|
-
console.log(
|
|
29
|
+
console.log(a.white(` Build: ${structure.conventions.buildDir}`));
|
|
29
30
|
}
|
|
30
31
|
console.log();
|
|
31
32
|
if (options.role) {
|
|
32
33
|
const role = options.role;
|
|
33
34
|
const files = fsParadigm.getFilesByRole(structure, role);
|
|
34
|
-
console.log(
|
|
35
|
+
console.log(a.cyan.bold(`\u{1F4C4} ${role.toUpperCase()} Files (${files.length}):
|
|
35
36
|
`));
|
|
36
37
|
if (files.length === 0) {
|
|
37
|
-
console.log(
|
|
38
|
+
console.log(a.gray(" No files found for this role\n"));
|
|
38
39
|
} else {
|
|
39
40
|
for (const file of files.slice(0, 20)) {
|
|
40
|
-
console.log(
|
|
41
|
+
console.log(a.white(` \u2022 ${file.replace(process.cwd(), "")}`));
|
|
41
42
|
}
|
|
42
43
|
if (files.length > 20) {
|
|
43
|
-
console.log(
|
|
44
|
+
console.log(a.gray(` ... and ${files.length - 20} more`));
|
|
44
45
|
}
|
|
45
46
|
console.log();
|
|
46
47
|
}
|
|
47
48
|
} else {
|
|
48
|
-
console.log(
|
|
49
|
+
console.log(a.cyan.bold("\u{1F4CA} File Map:"));
|
|
49
50
|
const roles = ["source", "test", "config", "types", "docs", "assets"];
|
|
50
51
|
for (const role of roles) {
|
|
51
52
|
const files = fsParadigm.getFilesByRole(structure, role);
|
|
52
53
|
if (files.length > 0) {
|
|
53
|
-
console.log(
|
|
54
|
+
console.log(a.white(` ${role.padEnd(10)} ${files.length} files`));
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
console.log();
|
|
57
58
|
if (options.verbose) {
|
|
58
|
-
console.log(
|
|
59
|
-
console.log(
|
|
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"));
|
|
60
61
|
console.log();
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
if (options.verbose && paradigm) {
|
|
64
|
-
console.log(
|
|
65
|
+
console.log(a.cyan.bold("\u{1F50D} Patterns:"));
|
|
65
66
|
for (const pattern of paradigm.patterns) {
|
|
66
|
-
console.log(
|
|
67
|
-
console.log(
|
|
67
|
+
console.log(a.white(` ${pattern.role.padEnd(10)} ${pattern.pattern}`));
|
|
68
|
+
console.log(a.gray(` ${pattern.description}`));
|
|
68
69
|
}
|
|
69
70
|
console.log();
|
|
70
71
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import
|
|
3
|
-
import { join } from 'pathe';
|
|
2
|
+
import a from './index2.mjs';
|
|
4
3
|
import { SETTINGS_FILE, CCJK_CONFIG_DIR } from './constants.mjs';
|
|
5
4
|
import { STATUS } from './banner.mjs';
|
|
5
|
+
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
6
|
+
import '../shared/ccjk.BAGoDD49.mjs';
|
|
6
7
|
import 'node:os';
|
|
7
|
-
import './
|
|
8
|
+
import './index5.mjs';
|
|
8
9
|
import 'node:process';
|
|
9
10
|
import 'node:url';
|
|
10
|
-
import 'i18next';
|
|
11
|
-
import 'i18next-fs-backend';
|
|
12
11
|
import './package.mjs';
|
|
13
12
|
|
|
14
13
|
const PERMISSION_CONFIG_FILE = join(CCJK_CONFIG_DIR, "permissions.json");
|
|
@@ -88,17 +87,17 @@ function getCurrentTemplateId() {
|
|
|
88
87
|
function displayPermissions() {
|
|
89
88
|
const permissions = readPermissions();
|
|
90
89
|
const templateId = getCurrentTemplateId();
|
|
91
|
-
console.log(
|
|
92
|
-
console.log(
|
|
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:"));
|
|
93
92
|
if (permissions.trustedDirectories.length === 0) {
|
|
94
|
-
console.log(
|
|
93
|
+
console.log(a.gray(" (none)"));
|
|
95
94
|
} else {
|
|
96
95
|
for (const dir of permissions.trustedDirectories) {
|
|
97
96
|
console.log(STATUS.success(dir));
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
console.log("");
|
|
101
|
-
console.log(
|
|
100
|
+
console.log(a.white.bold("Pre-authorized Operations:"));
|
|
102
101
|
const allPermissions = [
|
|
103
102
|
"file-read",
|
|
104
103
|
"file-write",
|
|
@@ -123,9 +122,9 @@ function displayPermissions() {
|
|
|
123
122
|
console.log("");
|
|
124
123
|
if (templateId) {
|
|
125
124
|
const template = PERMISSION_TEMPLATES.find((t) => t.id === templateId);
|
|
126
|
-
console.log(
|
|
125
|
+
console.log(a.gray(`Template: ${a.green(template?.name || templateId)}`));
|
|
127
126
|
} else {
|
|
128
|
-
console.log(
|
|
127
|
+
console.log(a.gray("Template: custom"));
|
|
129
128
|
}
|
|
130
129
|
console.log("");
|
|
131
130
|
}
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import process__default from 'node:process';
|
|
2
|
-
import
|
|
3
|
-
import inquirer from '
|
|
4
|
-
import '
|
|
5
|
-
import { i18n } from './
|
|
6
|
-
import { g as getPermissionManager } from '../shared/ccjk.
|
|
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';
|
|
7
25
|
import 'node:fs';
|
|
8
26
|
import 'node:url';
|
|
9
|
-
import '
|
|
10
|
-
import 'i18next-fs-backend';
|
|
11
|
-
import 'pathe';
|
|
12
|
-
import 'node:os';
|
|
27
|
+
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
13
28
|
|
|
14
29
|
const permissionManager = getPermissionManager();
|
|
15
30
|
async function listPermissions(options) {
|
|
@@ -29,42 +44,42 @@ async function listPermissions(options) {
|
|
|
29
44
|
return;
|
|
30
45
|
}
|
|
31
46
|
console.log("");
|
|
32
|
-
console.log(
|
|
47
|
+
console.log(a.bold("\u{1F4CB} CCJK Permissions\n"));
|
|
33
48
|
const stats = permissionManager.getStats();
|
|
34
|
-
console.log(
|
|
49
|
+
console.log(a.dim(`Total: ${stats.total} | Allow: ${stats.allow} | Deny: ${stats.deny}
|
|
35
50
|
`));
|
|
36
51
|
if (rules.length === 0) {
|
|
37
|
-
console.log(
|
|
52
|
+
console.log(a.yellow("No permissions configured."));
|
|
38
53
|
return;
|
|
39
54
|
}
|
|
40
55
|
if (format === "list") {
|
|
41
56
|
for (const rule of rules) {
|
|
42
|
-
const typeColor = rule.type === "allow" ?
|
|
43
|
-
console.log(`${typeColor(rule.type.padEnd(6))} ${
|
|
57
|
+
const typeColor = rule.type === "allow" ? a.green : a.red;
|
|
58
|
+
console.log(`${typeColor(rule.type.padEnd(6))} ${a.cyan(rule.pattern)} (${rule.category})`);
|
|
44
59
|
if (verbose) {
|
|
45
60
|
if (rule.description) {
|
|
46
|
-
console.log(
|
|
61
|
+
console.log(a.gray(` Description: ${rule.description}`));
|
|
47
62
|
}
|
|
48
|
-
console.log(
|
|
63
|
+
console.log(a.gray(` Source: ${rule.source}`));
|
|
49
64
|
if (rule.priority !== void 0) {
|
|
50
|
-
console.log(
|
|
65
|
+
console.log(a.gray(` Priority: ${rule.priority}`));
|
|
51
66
|
}
|
|
52
67
|
}
|
|
53
68
|
}
|
|
54
69
|
} else {
|
|
55
70
|
console.log(
|
|
56
|
-
|
|
71
|
+
a.bold("Type".padEnd(8)) + a.bold("Pattern".padEnd(40)) + a.bold("Category".padEnd(12)) + a.bold("Source")
|
|
57
72
|
);
|
|
58
|
-
console.log(
|
|
73
|
+
console.log(a.dim("\u2500".repeat(80)));
|
|
59
74
|
for (const rule of rules) {
|
|
60
|
-
const typeColor = rule.type === "allow" ?
|
|
75
|
+
const typeColor = rule.type === "allow" ? a.green : a.red;
|
|
61
76
|
const type2 = typeColor(rule.type.padEnd(8));
|
|
62
|
-
const pattern =
|
|
63
|
-
const category2 =
|
|
64
|
-
const source =
|
|
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);
|
|
65
80
|
console.log(`${type2}${pattern}${category2}${source}`);
|
|
66
81
|
if (verbose && rule.description) {
|
|
67
|
-
console.log(
|
|
82
|
+
console.log(a.gray(` \u2514\u2500 ${rule.description}`));
|
|
68
83
|
}
|
|
69
84
|
}
|
|
70
85
|
}
|
|
@@ -73,45 +88,45 @@ async function listPermissions(options) {
|
|
|
73
88
|
async function checkPermission(resource, options) {
|
|
74
89
|
const isZh = i18n.language === "zh-CN";
|
|
75
90
|
if (!resource) {
|
|
76
|
-
console.error(
|
|
91
|
+
console.error(a.red(isZh ? "\u9519\u8BEF\uFF1A\u9700\u8981\u6307\u5B9A\u8D44\u6E90" : "Error: Resource is required"));
|
|
77
92
|
console.log(isZh ? "\u7528\u6CD5: ccjk permissions check <resource>" : "Usage: ccjk permissions check <resource>");
|
|
78
93
|
process__default.exit(1);
|
|
79
94
|
}
|
|
80
95
|
const action = options.action || "execute";
|
|
81
96
|
const verbose = options.verbose || false;
|
|
82
97
|
console.log("");
|
|
83
|
-
console.log(
|
|
98
|
+
console.log(a.bold(`${a.cyan("\u{1F50D}")} ${isZh ? "\u68C0\u67E5\u6743\u9650" : "Checking Permission"}: ${a.cyan(resource)}
|
|
84
99
|
`));
|
|
85
100
|
const result = await permissionManager.checkPermission(action, resource);
|
|
86
101
|
if (result.allowed) {
|
|
87
|
-
console.log(
|
|
88
|
-
console.log(` ${
|
|
102
|
+
console.log(a.green(`\u2713 ${isZh ? "\u5141\u8BB8" : "ALLOWED"}`));
|
|
103
|
+
console.log(` ${a.dim("Reason:")} ${result.reason}`);
|
|
89
104
|
if (verbose && result.matchedRule) {
|
|
90
|
-
console.log(` ${
|
|
91
|
-
console.log(` ${
|
|
92
|
-
console.log(` ${
|
|
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}`);
|
|
93
108
|
}
|
|
94
109
|
} else {
|
|
95
|
-
console.log(
|
|
96
|
-
console.log(` ${
|
|
97
|
-
console.log(
|
|
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'));
|
|
98
113
|
}
|
|
99
114
|
console.log("");
|
|
100
115
|
}
|
|
101
116
|
async function grantPermission(resource, options) {
|
|
102
117
|
const isZh = i18n.language === "zh-CN";
|
|
103
118
|
if (!resource) {
|
|
104
|
-
console.error(
|
|
119
|
+
console.error(a.red(isZh ? "\u9519\u8BEF\uFF1A\u9700\u8981\u6307\u5B9A\u8D44\u6E90" : "Error: Resource is required"));
|
|
105
120
|
console.log(isZh ? "\u7528\u6CD5: ccjk permissions grant <pattern>" : "Usage: ccjk permissions grant <pattern>");
|
|
106
121
|
process__default.exit(1);
|
|
107
122
|
}
|
|
108
123
|
const validation = permissionManager.validatePattern(resource);
|
|
109
124
|
if (!validation.valid) {
|
|
110
|
-
console.error(
|
|
125
|
+
console.error(a.red(`${isZh ? "\u9519\u8BEF" : "Error"}: ${validation.error}`));
|
|
111
126
|
process__default.exit(1);
|
|
112
127
|
}
|
|
113
128
|
console.log("");
|
|
114
|
-
console.log(
|
|
129
|
+
console.log(a.bold(`${a.cyan("\u2713")} ${isZh ? "\u6388\u4E88\u6743\u9650" : "Granting Permission"}: ${a.cyan(resource)}
|
|
115
130
|
`));
|
|
116
131
|
const permission = {
|
|
117
132
|
type: "allow",
|
|
@@ -120,31 +135,31 @@ async function grantPermission(resource, options) {
|
|
|
120
135
|
description: options.description || "Granted via CLI"
|
|
121
136
|
};
|
|
122
137
|
permissionManager.addPermission(permission);
|
|
123
|
-
console.log(
|
|
138
|
+
console.log(a.green(isZh ? "\u6743\u9650\u5DF2\u6210\u529F\u6388\u4E88\uFF01" : "Permission granted successfully!"));
|
|
124
139
|
console.log("");
|
|
125
140
|
}
|
|
126
141
|
async function revokePermission(resource, _options) {
|
|
127
142
|
const isZh = i18n.language === "zh-CN";
|
|
128
143
|
if (!resource) {
|
|
129
|
-
console.error(
|
|
144
|
+
console.error(a.red(isZh ? "\u9519\u8BEF\uFF1A\u9700\u8981\u6307\u5B9A\u8D44\u6E90" : "Error: Resource is required"));
|
|
130
145
|
console.log(isZh ? "\u7528\u6CD5: ccjk permissions revoke <pattern>" : "Usage: ccjk permissions revoke <pattern>");
|
|
131
146
|
process__default.exit(1);
|
|
132
147
|
}
|
|
133
148
|
console.log("");
|
|
134
|
-
console.log(
|
|
149
|
+
console.log(a.bold(`${a.red("\u2717")} ${isZh ? "\u64A4\u9500\u6743\u9650" : "Revoking Permission"}: ${a.cyan(resource)}
|
|
135
150
|
`));
|
|
136
151
|
const removed = permissionManager.removePermission(resource);
|
|
137
152
|
if (removed) {
|
|
138
|
-
console.log(
|
|
153
|
+
console.log(a.green(isZh ? "\u6743\u9650\u5DF2\u6210\u529F\u64A4\u9500\uFF01" : "Permission revoked successfully!"));
|
|
139
154
|
} else {
|
|
140
|
-
console.log(
|
|
155
|
+
console.log(a.yellow(isZh ? "\u672A\u627E\u5230\u5339\u914D\u7684\u6743\u9650\u89C4\u5219" : "No matching permission found"));
|
|
141
156
|
}
|
|
142
157
|
console.log("");
|
|
143
158
|
}
|
|
144
159
|
async function resetPermissions(_options) {
|
|
145
160
|
const isZh = i18n.language === "zh-CN";
|
|
146
161
|
console.log("");
|
|
147
|
-
console.log(
|
|
162
|
+
console.log(a.bold.yellow(`${a.yellow("\u26A0\uFE0F")} ${isZh ? "\u91CD\u7F6E\u6240\u6709\u6743\u9650" : "Resetting All Permissions"}
|
|
148
163
|
`));
|
|
149
164
|
const { confirm } = await inquirer.prompt({
|
|
150
165
|
type: "confirm",
|
|
@@ -153,11 +168,11 @@ async function resetPermissions(_options) {
|
|
|
153
168
|
default: false
|
|
154
169
|
});
|
|
155
170
|
if (!confirm) {
|
|
156
|
-
console.log(
|
|
171
|
+
console.log(a.gray(isZh ? "\u64CD\u4F5C\u5DF2\u53D6\u6D88" : "Operation cancelled"));
|
|
157
172
|
return;
|
|
158
173
|
}
|
|
159
174
|
permissionManager.clearPermissions();
|
|
160
|
-
console.log(
|
|
175
|
+
console.log(a.green(isZh ? "\u6240\u6709\u6743\u9650\u5DF2\u6E05\u9664\uFF01" : "All permissions have been reset!"));
|
|
161
176
|
console.log("");
|
|
162
177
|
}
|
|
163
178
|
async function exportPermissions(filePath, _options) {
|
|
@@ -165,24 +180,24 @@ async function exportPermissions(filePath, _options) {
|
|
|
165
180
|
const path = await import('node:path');
|
|
166
181
|
const outputPath = filePath || path.join(process__default.cwd(), "permissions.json");
|
|
167
182
|
console.log("");
|
|
168
|
-
console.log(
|
|
183
|
+
console.log(a.bold(`\u{1F4E4} ${a.cyan("Exporting Permissions")} ${a.dim("to")} ${a.cyan(outputPath)}
|
|
169
184
|
`));
|
|
170
185
|
const permissions = permissionManager.exportPermissions();
|
|
171
186
|
await fs.writeFile(outputPath, JSON.stringify(permissions, null, 2), "utf-8");
|
|
172
187
|
const totalCount = (permissions.allow?.length || 0) + (permissions.deny?.length || 0);
|
|
173
|
-
console.log(
|
|
188
|
+
console.log(a.green(`\u2713 Exported ${totalCount} permission(s) successfully!`));
|
|
174
189
|
console.log("");
|
|
175
190
|
}
|
|
176
191
|
async function importPermissions(filePath, options) {
|
|
177
192
|
const isZh = i18n.language === "zh-CN";
|
|
178
193
|
if (!filePath) {
|
|
179
|
-
console.error(
|
|
194
|
+
console.error(a.red(isZh ? "\u9519\u8BEF\uFF1A\u9700\u8981\u6307\u5B9A\u6587\u4EF6\u8DEF\u5F84" : "Error: File path is required"));
|
|
180
195
|
console.log(isZh ? "\u7528\u6CD5: ccjk permissions import <file>" : "Usage: ccjk permissions import <file>");
|
|
181
196
|
process__default.exit(1);
|
|
182
197
|
}
|
|
183
198
|
const fs = await import('node:fs/promises');
|
|
184
199
|
console.log("");
|
|
185
|
-
console.log(
|
|
200
|
+
console.log(a.bold(`\u{1F4E5} ${a.cyan("Importing Permissions")} ${a.dim("from")} ${a.cyan(filePath)}
|
|
186
201
|
`));
|
|
187
202
|
try {
|
|
188
203
|
const content = await fs.readFile(filePath, "utf-8");
|
|
@@ -193,9 +208,9 @@ async function importPermissions(filePath, options) {
|
|
|
193
208
|
const merge = options.merge ?? false;
|
|
194
209
|
permissionManager.importPermissions(config, merge);
|
|
195
210
|
const totalCount = (config.allow?.length || 0) + (config.deny?.length || 0);
|
|
196
|
-
console.log(
|
|
211
|
+
console.log(a.green(`\u2713 Imported ${totalCount} permission(s) successfully!`));
|
|
197
212
|
} catch (error) {
|
|
198
|
-
console.error(
|
|
213
|
+
console.error(a.red(`${isZh ? "\u5BFC\u5165\u6743\u9650\u65F6\u51FA\u9519" : "Error importing permissions"}:`), error);
|
|
199
214
|
process__default.exit(1);
|
|
200
215
|
}
|
|
201
216
|
console.log("");
|
|
@@ -203,11 +218,11 @@ async function importPermissions(filePath, options) {
|
|
|
203
218
|
function permissionsHelp(_options) {
|
|
204
219
|
const isZh = i18n.language === "zh-CN";
|
|
205
220
|
console.log("");
|
|
206
|
-
console.log(
|
|
221
|
+
console.log(a.bold.cyan(`\u{1F4CB} ${isZh ? "CCJK \u6743\u9650\u7BA1\u7406" : "CCJK Permissions Management"}
|
|
207
222
|
`));
|
|
208
|
-
console.log(
|
|
223
|
+
console.log(a.bold(isZh ? "\u7528\u6CD5\uFF1A" : "Usage:"));
|
|
209
224
|
console.log(" ccjk permissions [action] [...args]\n");
|
|
210
|
-
console.log(
|
|
225
|
+
console.log(a.bold(isZh ? "\u64CD\u4F5C\uFF1A" : "Actions:"));
|
|
211
226
|
console.log(` list ${isZh ? "\u5217\u51FA\u6240\u6709\u6743\u9650" : "List all permissions"}`);
|
|
212
227
|
console.log(` search [query] ${isZh ? "\u4EA4\u4E92\u5F0F\u641C\u7D22\u6743\u9650" : "Interactive permission search"}`);
|
|
213
228
|
console.log(` check <resource> ${isZh ? "\u68C0\u67E5\u8D44\u6E90\u6743\u9650" : "Check permission for a resource"}`);
|
|
@@ -220,7 +235,7 @@ function permissionsHelp(_options) {
|
|
|
220
235
|
console.log(` export [file] ${isZh ? "\u5BFC\u51FA\u6743\u9650\u5230\u6587\u4EF6" : "Export permissions to a file"}`);
|
|
221
236
|
console.log(` import <file> ${isZh ? "\u4ECE\u6587\u4EF6\u5BFC\u5165\u6743\u9650" : "Import permissions from a file"}
|
|
222
237
|
`);
|
|
223
|
-
console.log(
|
|
238
|
+
console.log(a.bold(isZh ? "\u9009\u9879\uFF1A" : "Options:"));
|
|
224
239
|
console.log(` --format, -f ${isZh ? "\u8F93\u51FA\u683C\u5F0F (table|json|list)" : "Output format (table|json|list)"}`);
|
|
225
240
|
console.log(` --verbose, -v ${isZh ? "\u8BE6\u7EC6\u8F93\u51FA" : "Verbose output"}`);
|
|
226
241
|
console.log(` --type, -t ${isZh ? "\u8FC7\u6EE4\u7C7B\u578B (allow|deny)" : "Filter by type (allow|deny)"}`);
|
|
@@ -229,7 +244,7 @@ function permissionsHelp(_options) {
|
|
|
229
244
|
console.log(` --description, -d ${isZh ? "\u89C4\u5219\u63CF\u8FF0" : "Rule description"}`);
|
|
230
245
|
console.log(` --merge ${isZh ? "\u5408\u5E76\u5BFC\u5165\uFF08\u800C\u4E0D\u662F\u66FF\u6362\uFF09" : "Merge on import (not replace)"}
|
|
231
246
|
`);
|
|
232
|
-
console.log(
|
|
247
|
+
console.log(a.bold(isZh ? "\u793A\u4F8B\uFF1A" : "Examples:"));
|
|
233
248
|
console.log(" ccjk permissions list");
|
|
234
249
|
console.log(" ccjk permissions search");
|
|
235
250
|
console.log(' ccjk permissions check "Bash(npm install)"');
|
|
@@ -237,7 +252,7 @@ function permissionsHelp(_options) {
|
|
|
237
252
|
console.log(' ccjk permissions test "mcp__server__*"');
|
|
238
253
|
console.log(" ccjk permissions diagnose");
|
|
239
254
|
console.log(" ccjk permissions examples\n");
|
|
240
|
-
console.log(
|
|
255
|
+
console.log(a.bold(isZh ? "\u6A21\u5F0F\u683C\u5F0F\uFF1A" : "Pattern Formats:"));
|
|
241
256
|
console.log(` Bash(npm install) ${isZh ? "\u7CBE\u786E\u5339\u914D Bash \u547D\u4EE4" : "Exact Bash command match"}`);
|
|
242
257
|
console.log(` Bash(npm *) ${isZh ? "\u5339\u914D\u6240\u6709 npm \u547D\u4EE4" : "Match all npm commands"}`);
|
|
243
258
|
console.log(` Bash(* install) ${isZh ? '\u5339\u914D\u4EFB\u610F "* install" \u547D\u4EE4' : 'Match any "* install" command'}`);
|