ccjk 9.5.4 → 9.5.6

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.
@@ -837,11 +837,6 @@ async function init(options = {}) {
837
837
  try {
838
838
  writeMcpConfig(mergedConfig);
839
839
  syncMcpPermissions();
840
- try {
841
- const { installGatekeeper } = await import('./mcp-gatekeeper.mjs');
842
- installGatekeeper();
843
- } catch {
844
- }
845
840
  console.log(ansis.green(`\u2714 ${i18n.t("mcp:mcpConfigSuccess")}`));
846
841
  const { checkMcpPerformance, formatPerformanceWarning } = await import('./mcp-performance.mjs').then(function (n) { return n.e; });
847
842
  const serviceCount = Object.keys(newServers).length;
@@ -1,5 +1,5 @@
1
- import process__default from 'node:process';
2
1
  import { existsSync } from 'node:fs';
2
+ import process__default from 'node:process';
3
3
  import ansis from 'ansis';
4
4
  import inquirer from 'inquirer';
5
5
  import { join } from 'pathe';
@@ -1,6 +1,6 @@
1
1
  const name = "ccjk";
2
2
  const type = "module";
3
- const version = "9.5.4";
3
+ const version = "9.5.6";
4
4
  const packageManager = "pnpm@10.17.1";
5
5
  const description = "CCJK v9.0.0 - Revolutionary AI Development Platform with Enterprise Security, Streaming Cloud Sync, CRDT Conflict Resolution, and Unified V3 Architecture";
6
6
  const author = {
@@ -137,7 +137,7 @@ const dependencies = {
137
137
  chokidar: "^4.0.3",
138
138
  consola: "^3.4.2",
139
139
  dayjs: "^1.11.18",
140
- fdir: "^6.4.6",
140
+ fdir: "^6.5.0",
141
141
  "find-up-simple": "^1.0.1",
142
142
  "fs-extra": "^11.3.2",
143
143
  glob: "^11.0.3",
@@ -149,26 +149,26 @@ const dependencies = {
149
149
  "inquirer-toggle": "^1.0.1",
150
150
  ioredis: "^5.9.2",
151
151
  nanoid: "^5.1.6",
152
- ofetch: "^1.4.1",
153
- ohash: "^2.0.11",
152
+ ofetch: "^1.5.1",
153
+ ohash: "^1.1.4",
154
154
  ora: "^9.0.0",
155
155
  pathe: "^2.0.3",
156
156
  semver: "^7.7.2",
157
157
  "smol-toml": "^1.4.2",
158
158
  tar: "^7.5.2",
159
159
  tinyexec: "^1.0.1",
160
- tinyglobby: "^0.2.14",
160
+ tinyglobby: "^0.2.15",
161
161
  trash: "^10.0.0",
162
162
  uuid: "^11.1.0",
163
- "web-tree-sitter": "^0.24.7"
163
+ "web-tree-sitter": "^0.26.3"
164
164
  };
165
165
  const devDependencies = {
166
166
  "@antfu/eslint-config": "^5.4.1",
167
167
  "@types/fs-extra": "^11.0.4",
168
168
  "@types/inquirer": "^9.0.9",
169
169
  "@types/node": "^22.18.6",
170
- "@types/semver": "^7.7.0",
171
- "@types/uuid": "^10.0.0",
170
+ "@types/semver": "^7.7.1",
171
+ "@types/uuid": "^11.0.0",
172
172
  "@typescript-eslint/eslint-plugin": "^6.0.0",
173
173
  "@typescript-eslint/parser": "^6.0.0",
174
174
  "@vitest/coverage-v8": "^3.2.4",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "9.5.4",
4
+ "version": "9.5.6",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "CCJK v9.0.0 - Revolutionary AI Development Platform with Enterprise Security, Streaming Cloud Sync, CRDT Conflict Resolution, and Unified V3 Architecture",
7
7
  "author": {
@@ -138,7 +138,7 @@
138
138
  "chokidar": "^4.0.3",
139
139
  "consola": "^3.4.2",
140
140
  "dayjs": "^1.11.18",
141
- "fdir": "^6.4.6",
141
+ "fdir": "^6.5.0",
142
142
  "find-up-simple": "^1.0.1",
143
143
  "fs-extra": "^11.3.2",
144
144
  "glob": "^11.0.3",
@@ -150,26 +150,26 @@
150
150
  "inquirer-toggle": "^1.0.1",
151
151
  "ioredis": "^5.9.2",
152
152
  "nanoid": "^5.1.6",
153
- "ofetch": "^1.4.1",
154
- "ohash": "^2.0.11",
153
+ "ofetch": "^1.5.1",
154
+ "ohash": "^1.1.4",
155
155
  "ora": "^9.0.0",
156
156
  "pathe": "^2.0.3",
157
157
  "semver": "^7.7.2",
158
158
  "smol-toml": "^1.4.2",
159
159
  "tar": "^7.5.2",
160
160
  "tinyexec": "^1.0.1",
161
- "tinyglobby": "^0.2.14",
161
+ "tinyglobby": "^0.2.15",
162
162
  "trash": "^10.0.0",
163
163
  "uuid": "^11.1.0",
164
- "web-tree-sitter": "^0.24.7"
164
+ "web-tree-sitter": "^0.26.3"
165
165
  },
166
166
  "devDependencies": {
167
167
  "@antfu/eslint-config": "^5.4.1",
168
168
  "@types/fs-extra": "^11.0.4",
169
169
  "@types/inquirer": "^9.0.9",
170
170
  "@types/node": "^22.18.6",
171
- "@types/semver": "^7.7.0",
172
- "@types/uuid": "^10.0.0",
171
+ "@types/semver": "^7.7.1",
172
+ "@types/uuid": "^11.0.0",
173
173
  "@typescript-eslint/eslint-plugin": "^6.0.0",
174
174
  "@typescript-eslint/parser": "^6.0.0",
175
175
  "@vitest/coverage-v8": "^3.2.4",
@@ -1,183 +0,0 @@
1
- import { existsSync, mkdirSync, writeFileSync, chmodSync, readFileSync } from 'node:fs';
2
- import { homedir } from 'node:os';
3
- import { join, dirname } from 'pathe';
4
- import { r as readMcpConfig } from './claude-config.mjs';
5
- import './constants.mjs';
6
- import './index2.mjs';
7
- import 'node:process';
8
- import 'node:url';
9
- import 'i18next';
10
- import 'i18next-fs-backend';
11
- import './json-config.mjs';
12
- import 'dayjs';
13
- import './fs-operations.mjs';
14
- import 'node:crypto';
15
- import 'node:fs/promises';
16
- import './platform.mjs';
17
- import 'tinyexec';
18
-
19
- const CCJK_DIR = join(homedir(), ".ccjk");
20
- const GATEKEEPER_CONFIG_FILE = join(CCJK_DIR, "mcp-gatekeeper.json");
21
- const HOOKS_DIR = join(homedir(), ".claude", "hooks");
22
- const HOOK_SCRIPT_FILE = join(HOOKS_DIR, "mcp-gatekeeper.sh");
23
- const SETTINGS_FILE = join(homedir(), ".claude", "settings.json");
24
- const ON_DEMAND_SERVICES = /* @__PURE__ */ new Set(["Playwright", "serena"]);
25
- function readGatekeeperConfig() {
26
- try {
27
- if (!existsSync(GATEKEEPER_CONFIG_FILE))
28
- return null;
29
- const content = readFileSync(GATEKEEPER_CONFIG_FILE, "utf-8");
30
- return JSON.parse(content);
31
- } catch {
32
- return null;
33
- }
34
- }
35
- function writeGatekeeperConfig(config) {
36
- const dir = dirname(GATEKEEPER_CONFIG_FILE);
37
- if (!existsSync(dir)) {
38
- mkdirSync(dir, { recursive: true });
39
- }
40
- writeFileSync(GATEKEEPER_CONFIG_FILE, JSON.stringify(config, null, 2), "utf-8");
41
- }
42
- function syncGatekeeperFromMcp() {
43
- const existing = readGatekeeperConfig();
44
- const mcpConfig = readMcpConfig();
45
- const installedIds = new Set(Object.keys(mcpConfig?.mcpServers || {}));
46
- const services = {};
47
- for (const id of installedIds) {
48
- if (existing?.services[id]) {
49
- services[id] = existing.services[id];
50
- } else {
51
- services[id] = {
52
- enabled: !ON_DEMAND_SERVICES.has(id),
53
- mode: ON_DEMAND_SERVICES.has(id) ? "on-demand" : "always"
54
- };
55
- }
56
- }
57
- const config = {
58
- enabled: existing?.enabled ?? true,
59
- services
60
- };
61
- writeGatekeeperConfig(config);
62
- return config;
63
- }
64
- function generateHookScript() {
65
- return `#!/usr/bin/env bash
66
- # MCP Gatekeeper Hook - Auto-generated by CCJK
67
- # Blocks disabled MCP service tool calls to reduce token overhead.
68
- # Config: ~/.ccjk/mcp-gatekeeper.json
69
- #
70
- # Exit codes:
71
- # 0 = allow tool call
72
- # 2 = block tool call (with reason on stdout)
73
-
74
- CONFIG_FILE="$HOME/.ccjk/mcp-gatekeeper.json"
75
-
76
- # If config doesn't exist, allow all
77
- if [ ! -f "$CONFIG_FILE" ]; then
78
- exit 0
79
- fi
80
-
81
- # Read tool info from stdin
82
- TOOL_INPUT=$(cat)
83
-
84
- # Use node for reliable JSON parsing
85
- node -e '
86
- const fs = require("fs");
87
- const input = JSON.parse(process.argv[1]);
88
- const toolName = input.tool_name || "";
89
-
90
- // Only gate MCP tools (pattern: mcp__<server>__<tool>)
91
- if (!toolName.startsWith("mcp__")) {
92
- process.exit(0);
93
- }
94
-
95
- // Extract server name: mcp__<server>__<tool>
96
- const parts = toolName.split("__");
97
- const serverName = parts[1] || "";
98
-
99
- try {
100
- const config = JSON.parse(fs.readFileSync(process.env.HOME + "/.ccjk/mcp-gatekeeper.json", "utf-8"));
101
-
102
- // If gatekeeper is disabled globally, allow all
103
- if (!config.enabled) {
104
- process.exit(0);
105
- }
106
-
107
- const svc = (config.services || {})[serverName];
108
-
109
- // If service not in config, allow by default
110
- if (!svc) {
111
- process.exit(0);
112
- }
113
-
114
- // If service is enabled, allow
115
- if (svc.enabled) {
116
- process.exit(0);
117
- }
118
-
119
- // Service is disabled \u2014 block with message
120
- console.log("MCP service "" + serverName + "" is disabled by CCJK gatekeeper. Enable with: npx ccjk mcp --gate-enable " + serverName);
121
- process.exit(2);
122
- } catch (e) {
123
- // On any error, allow the call
124
- process.exit(0);
125
- }
126
- ' "$TOOL_INPUT" 2>/dev/null
127
-
128
- exit $?
129
- `;
130
- }
131
- function installHookScript() {
132
- if (!existsSync(HOOKS_DIR)) {
133
- mkdirSync(HOOKS_DIR, { recursive: true });
134
- }
135
- const script = generateHookScript();
136
- writeFileSync(HOOK_SCRIPT_FILE, script, "utf-8");
137
- chmodSync(HOOK_SCRIPT_FILE, 493);
138
- }
139
- function registerHookInSettings() {
140
- let settings = {};
141
- if (existsSync(SETTINGS_FILE)) {
142
- try {
143
- settings = JSON.parse(readFileSync(SETTINGS_FILE, "utf-8"));
144
- } catch {
145
- }
146
- }
147
- if (!settings.hooks || typeof settings.hooks !== "object") {
148
- settings.hooks = {};
149
- }
150
- const hooks = settings.hooks;
151
- const gatekeeperHook = {
152
- matcher: "mcp__.*",
153
- hooks: [{
154
- type: "command",
155
- command: HOOK_SCRIPT_FILE
156
- }]
157
- };
158
- if (!hooks.PreToolUse) {
159
- hooks.PreToolUse = [];
160
- }
161
- const preToolUse = hooks.PreToolUse;
162
- const existingIdx = preToolUse.findIndex(
163
- (h) => h.hooks?.some((hh) => typeof hh === "object" && hh.command?.includes("mcp-gatekeeper"))
164
- );
165
- if (existingIdx >= 0) {
166
- preToolUse[existingIdx] = gatekeeperHook;
167
- } else {
168
- preToolUse.push(gatekeeperHook);
169
- }
170
- const dir = dirname(SETTINGS_FILE);
171
- if (!existsSync(dir)) {
172
- mkdirSync(dir, { recursive: true });
173
- }
174
- writeFileSync(SETTINGS_FILE, JSON.stringify(settings, null, 2), "utf-8");
175
- }
176
- function installGatekeeper() {
177
- const config = syncGatekeeperFromMcp();
178
- installHookScript();
179
- registerHookInSettings();
180
- return config;
181
- }
182
-
183
- export { generateHookScript, installGatekeeper, installHookScript, readGatekeeperConfig, registerHookInSettings, syncGatekeeperFromMcp, writeGatekeeperConfig };