ccjk 10.2.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/dist/chunks/auto-init.mjs +7585 -0
- package/dist/chunks/ccr.mjs +2 -1
- package/dist/chunks/check-updates.mjs +1 -0
- package/dist/chunks/claude-code-config-manager.mjs +1 -0
- package/dist/chunks/claude-code-incremental-manager.mjs +2 -1
- package/dist/chunks/codex-config-switch.mjs +1 -0
- package/dist/chunks/codex-provider-manager.mjs +1 -0
- package/dist/chunks/config-switch.mjs +1 -0
- package/dist/chunks/config.mjs +2 -94
- package/dist/chunks/config2.mjs +1 -0
- package/dist/chunks/config3.mjs +1 -0
- package/dist/chunks/evolution.mjs +383 -0
- package/dist/chunks/features.mjs +2 -1
- package/dist/chunks/init.mjs +1 -1
- package/dist/chunks/mcp.mjs +1 -0
- package/dist/chunks/menu.mjs +7 -1
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/quick-provider.mjs +3 -0
- package/dist/chunks/quick-setup.mjs +2 -1
- package/dist/chunks/remote.mjs +166 -0
- package/dist/chunks/simple-config.mjs +1 -6
- package/dist/chunks/update.mjs +2 -1
- package/dist/chunks/zero-config.mjs +359 -0
- package/dist/cli.mjs +107 -0
- package/dist/i18n/locales/en/configuration.json +33 -0
- package/dist/i18n/locales/en/evolution.json +54 -0
- package/dist/i18n/locales/en/remote.json +39 -0
- package/dist/i18n/locales/zh-CN/configuration.json +33 -0
- package/dist/i18n/locales/zh-CN/evolution.json +54 -0
- package/dist/i18n/locales/zh-CN/remote.json +39 -0
- package/dist/index.mjs +3 -73
- package/dist/shared/ccjk.BiCrMV5O.mjs +94 -0
- package/dist/shared/ccjk.Cu_R2MbQ.mjs +75 -0
- package/dist/shared/{ccjk.IbImMVWM.mjs → ccjk.DVBW2wxp.mjs} +2 -1
- package/package.json +7 -1
package/dist/cli.mjs
CHANGED
|
@@ -382,6 +382,27 @@ const COMMANDS = [
|
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
384
|
},
|
|
385
|
+
{
|
|
386
|
+
name: "zero-config [preset]",
|
|
387
|
+
description: "Apply zero-config permission presets (max, dev, safe)",
|
|
388
|
+
aliases: ["zc"],
|
|
389
|
+
tier: "extended",
|
|
390
|
+
options: [
|
|
391
|
+
{ flags: "--preset, -p <preset>", description: "Preset to apply (max, dev, safe)" },
|
|
392
|
+
{ flags: "--list, -l", description: "List available presets" },
|
|
393
|
+
{ flags: "--skip-backup", description: "Skip backup before applying" }
|
|
394
|
+
],
|
|
395
|
+
loader: async () => {
|
|
396
|
+
const { zeroConfig } = await import('./chunks/zero-config.mjs');
|
|
397
|
+
return async (options, preset) => {
|
|
398
|
+
await zeroConfig({
|
|
399
|
+
preset: preset || options.preset,
|
|
400
|
+
list: options.list,
|
|
401
|
+
skipBackup: options.skipBackup
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
},
|
|
385
406
|
{
|
|
386
407
|
name: "vim",
|
|
387
408
|
description: "Vim mode configuration and keybindings",
|
|
@@ -1435,6 +1456,87 @@ ${ansis.yellow("By Status:")}`);
|
|
|
1435
1456
|
};
|
|
1436
1457
|
}
|
|
1437
1458
|
},
|
|
1459
|
+
{
|
|
1460
|
+
name: "remote",
|
|
1461
|
+
description: "Remote control management",
|
|
1462
|
+
tier: "core",
|
|
1463
|
+
options: [
|
|
1464
|
+
{ flags: "enable", description: "Enable remote control" },
|
|
1465
|
+
{ flags: "disable", description: "Disable remote control" },
|
|
1466
|
+
{ flags: "status", description: "Show remote status" },
|
|
1467
|
+
{ flags: "qr", description: "Show pairing QR code" }
|
|
1468
|
+
],
|
|
1469
|
+
loader: async () => {
|
|
1470
|
+
const { enableRemote, disableRemote, remoteStatus, showQRCode } = await import('./chunks/remote.mjs');
|
|
1471
|
+
return async (options, ...args) => {
|
|
1472
|
+
const action = args[0];
|
|
1473
|
+
switch (action) {
|
|
1474
|
+
case "enable":
|
|
1475
|
+
await enableRemote();
|
|
1476
|
+
break;
|
|
1477
|
+
case "disable":
|
|
1478
|
+
await disableRemote();
|
|
1479
|
+
break;
|
|
1480
|
+
case "status":
|
|
1481
|
+
await remoteStatus();
|
|
1482
|
+
break;
|
|
1483
|
+
case "qr":
|
|
1484
|
+
await showQRCode();
|
|
1485
|
+
break;
|
|
1486
|
+
default:
|
|
1487
|
+
await remoteStatus();
|
|
1488
|
+
}
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
name: "evolution",
|
|
1494
|
+
description: "Evolution Layer - AI knowledge sharing",
|
|
1495
|
+
tier: "core",
|
|
1496
|
+
options: [
|
|
1497
|
+
{ flags: "top", description: "Show top capabilities" },
|
|
1498
|
+
{ flags: "search <query>", description: "Search for solutions" },
|
|
1499
|
+
{ flags: "show <geneId>", description: "Show gene details" },
|
|
1500
|
+
{ flags: "stats", description: "Show statistics" }
|
|
1501
|
+
],
|
|
1502
|
+
loader: async () => {
|
|
1503
|
+
const { handleEvolutionCommand } = await import('./chunks/evolution.mjs');
|
|
1504
|
+
return async (options, ...args) => {
|
|
1505
|
+
const action = args[0];
|
|
1506
|
+
const restArgs = args.slice(1);
|
|
1507
|
+
await handleEvolutionCommand(action, restArgs, options);
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
name: "daemon",
|
|
1513
|
+
description: "Daemon management",
|
|
1514
|
+
tier: "core",
|
|
1515
|
+
options: [
|
|
1516
|
+
{ flags: "start", description: "Start daemon" },
|
|
1517
|
+
{ flags: "stop", description: "Stop daemon" },
|
|
1518
|
+
{ flags: "status", description: "Daemon status" }
|
|
1519
|
+
],
|
|
1520
|
+
loader: async () => {
|
|
1521
|
+
const { startDaemon, stopDaemon, remoteStatus } = await import('./chunks/remote.mjs');
|
|
1522
|
+
return async (options, ...args) => {
|
|
1523
|
+
const action = args[0];
|
|
1524
|
+
switch (action) {
|
|
1525
|
+
case "start":
|
|
1526
|
+
await startDaemon();
|
|
1527
|
+
break;
|
|
1528
|
+
case "stop":
|
|
1529
|
+
await stopDaemon();
|
|
1530
|
+
break;
|
|
1531
|
+
case "status":
|
|
1532
|
+
await remoteStatus();
|
|
1533
|
+
break;
|
|
1534
|
+
default:
|
|
1535
|
+
await remoteStatus();
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
},
|
|
1438
1540
|
{
|
|
1439
1541
|
name: "morning",
|
|
1440
1542
|
description: "Morning health check + stats summary",
|
|
@@ -1897,6 +1999,11 @@ async function runLazyCli() {
|
|
|
1897
1999
|
} catch {
|
|
1898
2000
|
}
|
|
1899
2001
|
bootstrapCloudServices();
|
|
2002
|
+
try {
|
|
2003
|
+
const { autoInitBrainHooks } = await import('./chunks/auto-init.mjs');
|
|
2004
|
+
await autoInitBrainHooks();
|
|
2005
|
+
} catch {
|
|
2006
|
+
}
|
|
1900
2007
|
const handled = await tryQuickProviderLaunch();
|
|
1901
2008
|
if (handled) {
|
|
1902
2009
|
spinner?.stop();
|
|
@@ -103,6 +103,39 @@
|
|
|
103
103
|
"validationErrors": "Configuration validation errors",
|
|
104
104
|
"configUpToDate": "Configuration is up to date"
|
|
105
105
|
},
|
|
106
|
+
"zeroConfig": {
|
|
107
|
+
"title": "Zero-Config Permission Presets",
|
|
108
|
+
"selectPreset": "Select permission preset",
|
|
109
|
+
"confirmApply": "Confirm applying this preset?",
|
|
110
|
+
"presetApplied": "Permission preset applied",
|
|
111
|
+
"backedUpTo": "Backed up to",
|
|
112
|
+
"configFile": "Config file",
|
|
113
|
+
"presetNotFound": "Error: Preset not found",
|
|
114
|
+
"useListToSee": "Use --list to see available presets",
|
|
115
|
+
"availablePresets": "Available Permission Presets",
|
|
116
|
+
"presetDetails": "Preset Details",
|
|
117
|
+
"permissionsToAdd": "Permissions to be added",
|
|
118
|
+
"total": "Total",
|
|
119
|
+
"items": "items",
|
|
120
|
+
"commands": "commands",
|
|
121
|
+
"operations": "operations",
|
|
122
|
+
"allPermissionsExist": "All permissions already exist",
|
|
123
|
+
"usage": "Usage: npx ccjk zc --preset=<id>",
|
|
124
|
+
"presets": {
|
|
125
|
+
"max": {
|
|
126
|
+
"name": "Maximum Permissions",
|
|
127
|
+
"description": "All common commands, file operations, and MCP servers"
|
|
128
|
+
},
|
|
129
|
+
"dev": {
|
|
130
|
+
"name": "Developer Preset",
|
|
131
|
+
"description": "Build tools, git, package managers, and file operations"
|
|
132
|
+
},
|
|
133
|
+
"safe": {
|
|
134
|
+
"name": "Safe Preset",
|
|
135
|
+
"description": "Read-only commands, no file modifications"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
106
139
|
"fields": {
|
|
107
140
|
"language": {
|
|
108
141
|
"label": "Response Language",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Evolution Layer - AI knowledge sharing",
|
|
3
|
+
"connecting": "Connecting to Evolution Layer...",
|
|
4
|
+
"fetching": "Fetching top capabilities...",
|
|
5
|
+
"found": "Found {{count}} capabilities",
|
|
6
|
+
"noResults": "No capabilities found",
|
|
7
|
+
"problem": "Problem",
|
|
8
|
+
"solution": "Solution",
|
|
9
|
+
"used": "Used",
|
|
10
|
+
"times": "times",
|
|
11
|
+
"success": "Success",
|
|
12
|
+
"failed": "Failed",
|
|
13
|
+
"searching": "Searching for: {{query}}",
|
|
14
|
+
"noSolutions": "No solutions found",
|
|
15
|
+
"foundSolutions": "Found {{count}} solutions",
|
|
16
|
+
"context": "Context",
|
|
17
|
+
"geneNotFound": "Gene not found",
|
|
18
|
+
"geneDetails": "Gene Details",
|
|
19
|
+
"type": "Type",
|
|
20
|
+
"signature": "Signature",
|
|
21
|
+
"strategy": "Strategy",
|
|
22
|
+
"code": "Code",
|
|
23
|
+
"steps": "Steps",
|
|
24
|
+
"quality": "Quality",
|
|
25
|
+
"successRate": "Success Rate",
|
|
26
|
+
"usageCount": "Usage Count",
|
|
27
|
+
"avgTime": "Average Time",
|
|
28
|
+
"metadata": "Metadata",
|
|
29
|
+
"author": "Author",
|
|
30
|
+
"createdAt": "Created At",
|
|
31
|
+
"tags": "Tags",
|
|
32
|
+
"fetchingStats": "Fetching statistics...",
|
|
33
|
+
"totalGenes": "Total Genes",
|
|
34
|
+
"avgGDI": "Average GDI",
|
|
35
|
+
"totalUsage": "Total Usage",
|
|
36
|
+
"avgSuccess": "Average Success Rate",
|
|
37
|
+
"byType": "By Type",
|
|
38
|
+
"top": {
|
|
39
|
+
"description": "Show top capabilities by GDI score",
|
|
40
|
+
"limit": "Limit results",
|
|
41
|
+
"minGdi": "Minimum GDI score"
|
|
42
|
+
},
|
|
43
|
+
"search": {
|
|
44
|
+
"description": "Search for solutions",
|
|
45
|
+
"minGdi": "Minimum GDI score",
|
|
46
|
+
"limit": "Limit results"
|
|
47
|
+
},
|
|
48
|
+
"show": {
|
|
49
|
+
"description": "Show gene details"
|
|
50
|
+
},
|
|
51
|
+
"stats": {
|
|
52
|
+
"description": "Show Evolution Layer statistics"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"enable": {
|
|
3
|
+
"title": "🌐 Enable Remote Control",
|
|
4
|
+
"server_url": "Enter CCJK server URL:",
|
|
5
|
+
"already_enabled": "✅ Remote control is already enabled",
|
|
6
|
+
"success": "✅ Remote control enabled successfully!",
|
|
7
|
+
"next_steps": "\nNext steps:\n 1. Run 'ccjk remote qr' to get pairing QR code\n 2. Scan QR code with CCJK mobile app\n 3. Start daemon with 'ccjk daemon start'"
|
|
8
|
+
},
|
|
9
|
+
"disable": {
|
|
10
|
+
"title": "🔌 Disable Remote Control",
|
|
11
|
+
"already_disabled": "Remote control is already disabled",
|
|
12
|
+
"success": "✅ Remote control disabled"
|
|
13
|
+
},
|
|
14
|
+
"status": {
|
|
15
|
+
"title": "📊 Remote Control Status",
|
|
16
|
+
"enabled": "Enabled",
|
|
17
|
+
"server": "Server",
|
|
18
|
+
"machine_id": "Machine ID",
|
|
19
|
+
"daemon": "Daemon"
|
|
20
|
+
},
|
|
21
|
+
"qr": {
|
|
22
|
+
"title": "📱 Mobile Pairing",
|
|
23
|
+
"instructions": "Scan this QR code with CCJK mobile app:",
|
|
24
|
+
"not_enabled": "❌ Remote control is not enabled. Run 'ccjk remote enable' first.",
|
|
25
|
+
"manual_entry": "Or enter manually:"
|
|
26
|
+
},
|
|
27
|
+
"daemon": {
|
|
28
|
+
"starting": "Starting daemon...",
|
|
29
|
+
"started": "✅ Daemon started",
|
|
30
|
+
"start_failed": "❌ Failed to start daemon",
|
|
31
|
+
"start_error": "❌ Error starting daemon",
|
|
32
|
+
"already_running": "Daemon is already running",
|
|
33
|
+
"stopping": "Stopping daemon...",
|
|
34
|
+
"stopped": "✅ Daemon stopped",
|
|
35
|
+
"stop_failed": "❌ Failed to stop daemon",
|
|
36
|
+
"stop_error": "❌ Error stopping daemon",
|
|
37
|
+
"not_running": "Daemon is not running"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -101,6 +101,39 @@
|
|
|
101
101
|
"validationErrors": "配置验证错误",
|
|
102
102
|
"configUpToDate": "配置已是最新版本"
|
|
103
103
|
},
|
|
104
|
+
"zeroConfig": {
|
|
105
|
+
"title": "零配置权限预设",
|
|
106
|
+
"selectPreset": "选择权限预设",
|
|
107
|
+
"confirmApply": "确认应用此预设?",
|
|
108
|
+
"presetApplied": "权限预设已应用",
|
|
109
|
+
"backedUpTo": "已备份到",
|
|
110
|
+
"configFile": "配置文件",
|
|
111
|
+
"presetNotFound": "错误: 未找到预设",
|
|
112
|
+
"useListToSee": "使用 --list 查看可用预设",
|
|
113
|
+
"availablePresets": "可用的权限预设",
|
|
114
|
+
"presetDetails": "预设详情",
|
|
115
|
+
"permissionsToAdd": "将添加的权限",
|
|
116
|
+
"total": "总计",
|
|
117
|
+
"items": "项",
|
|
118
|
+
"commands": "个命令",
|
|
119
|
+
"operations": "个操作",
|
|
120
|
+
"allPermissionsExist": "所有权限已存在",
|
|
121
|
+
"usage": "使用: npx ccjk zc --preset=<id>",
|
|
122
|
+
"presets": {
|
|
123
|
+
"max": {
|
|
124
|
+
"name": "最大权限",
|
|
125
|
+
"description": "所有常用命令、文件操作和 MCP 服务"
|
|
126
|
+
},
|
|
127
|
+
"dev": {
|
|
128
|
+
"name": "开发者预设",
|
|
129
|
+
"description": "构建工具、git、包管理器和文件操作"
|
|
130
|
+
},
|
|
131
|
+
"safe": {
|
|
132
|
+
"name": "安全预设",
|
|
133
|
+
"description": "只读命令,不修改文件"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
104
137
|
"fields": {
|
|
105
138
|
"language": {
|
|
106
139
|
"label": "响应语言",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Evolution Layer - AI 知识共享",
|
|
3
|
+
"connecting": "连接到 Evolution Layer...",
|
|
4
|
+
"fetching": "获取顶级能力...",
|
|
5
|
+
"found": "找到 {{count}} 个能力",
|
|
6
|
+
"noResults": "未找到能力",
|
|
7
|
+
"problem": "问题",
|
|
8
|
+
"solution": "解决方案",
|
|
9
|
+
"used": "使用",
|
|
10
|
+
"times": "次",
|
|
11
|
+
"success": "成功率",
|
|
12
|
+
"failed": "失败",
|
|
13
|
+
"searching": "搜索: {{query}}",
|
|
14
|
+
"noSolutions": "未找到解决方案",
|
|
15
|
+
"foundSolutions": "找到 {{count}} 个解决方案",
|
|
16
|
+
"context": "上下文",
|
|
17
|
+
"geneNotFound": "Gene 未找到",
|
|
18
|
+
"geneDetails": "Gene 详情",
|
|
19
|
+
"type": "类型",
|
|
20
|
+
"signature": "特征",
|
|
21
|
+
"strategy": "策略",
|
|
22
|
+
"code": "代码",
|
|
23
|
+
"steps": "步骤",
|
|
24
|
+
"quality": "质量",
|
|
25
|
+
"successRate": "成功率",
|
|
26
|
+
"usageCount": "使用次数",
|
|
27
|
+
"avgTime": "平均时间",
|
|
28
|
+
"metadata": "元数据",
|
|
29
|
+
"author": "作者",
|
|
30
|
+
"createdAt": "创建时间",
|
|
31
|
+
"tags": "标签",
|
|
32
|
+
"fetchingStats": "获取统计信息...",
|
|
33
|
+
"totalGenes": "总 Genes",
|
|
34
|
+
"avgGDI": "平均 GDI",
|
|
35
|
+
"totalUsage": "总使用次数",
|
|
36
|
+
"avgSuccess": "平均成功率",
|
|
37
|
+
"byType": "按类型",
|
|
38
|
+
"top": {
|
|
39
|
+
"description": "显示顶级能力",
|
|
40
|
+
"limit": "限制结果数量",
|
|
41
|
+
"minGdi": "最小 GDI 分数"
|
|
42
|
+
},
|
|
43
|
+
"search": {
|
|
44
|
+
"description": "搜索解决方案",
|
|
45
|
+
"minGdi": "最小 GDI 分数",
|
|
46
|
+
"limit": "限制结果数量"
|
|
47
|
+
},
|
|
48
|
+
"show": {
|
|
49
|
+
"description": "显示 gene 详情"
|
|
50
|
+
},
|
|
51
|
+
"stats": {
|
|
52
|
+
"description": "显示 Evolution Layer 统计信息"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"enable": {
|
|
3
|
+
"title": "🌐 启用远程控制",
|
|
4
|
+
"server_url": "输入 CCJK 服务器地址:",
|
|
5
|
+
"already_enabled": "✅ 远程控制已启用",
|
|
6
|
+
"success": "✅ 远程控制启用成功!",
|
|
7
|
+
"next_steps": "\n下一步:\n 1. 运行 'ccjk remote qr' 获取配对二维码\n 2. 使用 CCJK 移动应用扫描二维码\n 3. 运行 'ccjk daemon start' 启动守护进程"
|
|
8
|
+
},
|
|
9
|
+
"disable": {
|
|
10
|
+
"title": "🔌 禁用远程控制",
|
|
11
|
+
"already_disabled": "远程控制已禁用",
|
|
12
|
+
"success": "✅ 远程控制已禁用"
|
|
13
|
+
},
|
|
14
|
+
"status": {
|
|
15
|
+
"title": "📊 远程控制状态",
|
|
16
|
+
"enabled": "启用状态",
|
|
17
|
+
"server": "服务器",
|
|
18
|
+
"machine_id": "机器 ID",
|
|
19
|
+
"daemon": "守护进程"
|
|
20
|
+
},
|
|
21
|
+
"qr": {
|
|
22
|
+
"title": "📱 移动端配对",
|
|
23
|
+
"instructions": "使用 CCJK 移动应用扫描此二维码:",
|
|
24
|
+
"not_enabled": "❌ 远程控制未启用。请先运行 'ccjk remote enable'。",
|
|
25
|
+
"manual_entry": "或手动输入:"
|
|
26
|
+
},
|
|
27
|
+
"daemon": {
|
|
28
|
+
"starting": "正在启动守护进程...",
|
|
29
|
+
"started": "✅ 守护进程已启动",
|
|
30
|
+
"start_failed": "❌ 启动守护进程失败",
|
|
31
|
+
"start_error": "❌ 启动守护进程出错",
|
|
32
|
+
"already_running": "守护进程已在运行",
|
|
33
|
+
"stopping": "正在停止守护进程...",
|
|
34
|
+
"stopped": "✅ 守护进程已停止",
|
|
35
|
+
"stop_failed": "❌ 停止守护进程失败",
|
|
36
|
+
"stop_error": "❌ 停止守护进程出错",
|
|
37
|
+
"not_running": "守护进程未运行"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/dist/index.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { version } from './chunks/package.mjs';
|
|
|
9
9
|
import { join as join$1 } from 'pathe';
|
|
10
10
|
export { j as config } from './chunks/config.mjs';
|
|
11
11
|
export { e as extractDisplayName, a as extractString, i as i18nHelpers, n as normalizeRecommendation, b as normalizeRecommendations } from './shared/ccjk.AqnXPAzw.mjs';
|
|
12
|
+
export { a as loggerUtils } from './shared/ccjk.Cu_R2MbQ.mjs';
|
|
12
13
|
export { p as platform } from './chunks/platform.mjs';
|
|
13
14
|
import { Transform } from 'node:stream';
|
|
14
15
|
import { pipeline } from 'node:stream/promises';
|
|
@@ -25,6 +26,7 @@ import './chunks/json-config.mjs';
|
|
|
25
26
|
import './chunks/fs-operations.mjs';
|
|
26
27
|
import 'node:crypto';
|
|
27
28
|
import 'node:fs/promises';
|
|
29
|
+
import './shared/ccjk.BiCrMV5O.mjs';
|
|
28
30
|
import 'tinyexec';
|
|
29
31
|
|
|
30
32
|
const execAsync$1 = promisify(exec);
|
|
@@ -2556,78 +2558,6 @@ const index$2 = {
|
|
|
2556
2558
|
writeJSON: writeJSON
|
|
2557
2559
|
};
|
|
2558
2560
|
|
|
2559
|
-
let Logger$1 = class Logger {
|
|
2560
|
-
level;
|
|
2561
|
-
silent;
|
|
2562
|
-
levels = {
|
|
2563
|
-
debug: 0,
|
|
2564
|
-
info: 1,
|
|
2565
|
-
warn: 2,
|
|
2566
|
-
error: 3
|
|
2567
|
-
};
|
|
2568
|
-
constructor(options = {}) {
|
|
2569
|
-
this.level = options.level || "info";
|
|
2570
|
-
this.silent = options.silent || false;
|
|
2571
|
-
}
|
|
2572
|
-
shouldLog(level) {
|
|
2573
|
-
return !this.silent && this.levels[level] >= this.levels[this.level];
|
|
2574
|
-
}
|
|
2575
|
-
format(level, message, data) {
|
|
2576
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
2577
|
-
const prefix = `[${timestamp}] [${level.toUpperCase()}]`;
|
|
2578
|
-
const coloredPrefix = this.colorize(level, prefix);
|
|
2579
|
-
const dataStr = data ? ` ${JSON.stringify(data)}` : "";
|
|
2580
|
-
return `${coloredPrefix} ${message}${dataStr}`;
|
|
2581
|
-
}
|
|
2582
|
-
/** MUD-style color scheme for log levels */
|
|
2583
|
-
colorize(level, text) {
|
|
2584
|
-
switch (level) {
|
|
2585
|
-
case "debug":
|
|
2586
|
-
return ansis.gray(text);
|
|
2587
|
-
case "info":
|
|
2588
|
-
return ansis.green(text);
|
|
2589
|
-
// MUD green for info
|
|
2590
|
-
case "warn":
|
|
2591
|
-
return ansis.yellow(text);
|
|
2592
|
-
case "error":
|
|
2593
|
-
return ansis.red(text);
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
debug(message, data) {
|
|
2597
|
-
if (this.shouldLog("debug")) {
|
|
2598
|
-
console.log(this.format("debug", message, data));
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
info(message, data) {
|
|
2602
|
-
if (this.shouldLog("info")) {
|
|
2603
|
-
console.log(this.format("info", message, data));
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
warn(message, data) {
|
|
2607
|
-
if (this.shouldLog("warn")) {
|
|
2608
|
-
console.warn(this.format("warn", message, data));
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
error(message, data) {
|
|
2612
|
-
if (this.shouldLog("error")) {
|
|
2613
|
-
console.error(this.format("error", message, data));
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
setLevel(level) {
|
|
2617
|
-
this.level = level;
|
|
2618
|
-
}
|
|
2619
|
-
setSilent(silent) {
|
|
2620
|
-
this.silent = silent;
|
|
2621
|
-
}
|
|
2622
|
-
};
|
|
2623
|
-
const logger$1 = new Logger$1();
|
|
2624
|
-
|
|
2625
|
-
const logger$2 = {
|
|
2626
|
-
__proto__: null,
|
|
2627
|
-
Logger: Logger$1,
|
|
2628
|
-
logger: logger$1
|
|
2629
|
-
};
|
|
2630
|
-
|
|
2631
2561
|
const LOG_LEVELS = {
|
|
2632
2562
|
debug: 0,
|
|
2633
2563
|
info: 1,
|
|
@@ -3665,4 +3595,4 @@ function assert(condition, message) {
|
|
|
3665
3595
|
}
|
|
3666
3596
|
}
|
|
3667
3597
|
|
|
3668
|
-
export { AiderTool, BaseCodeTool, BaseError, ClaudeCodeTool, ClineTool, CodexTool, ConfigManager, ConfigValidator, ConfigurationError, ContinueTool, CursorTool, InternalError, Logger, Mutex, NotFoundError, Semaphore, TimeoutError, ToolFactory, ToolRegistry, UnauthorizedError, ValidationError, index$6 as array, assert, assertDefined, index$5 as async, batchProcessFiles, camelCase, capitalize, chunk, index$4 as command, commandExists, copyFile, countLines, createConfigManager, createLogger, createTool, createValidator, debounce, deepClone, deepMerge, deleteDir, deleteFile, difference, ensureDir, index$3 as error, executeCommand, executeCommandStream, exists, flatten, flatten$1 as flattenArray, formatError, index$2 as fs, generateCompactWelcome, generateRecommendations, generateWelcome, get, getArchitecture, getCacheDir, getCapabilitiesByType, getCapability, getCommandPath, getCommandVersion, getConfigDir, getDataDir, getErrorMessage, getFileInfo, getFileSize, getHomeDir, getPlatform, getPlatformInfo, getRegistry, getTempDir, has, intersection, isArray, isBoolean, isDefined, isDirectory, isEmail, isFile, isLargeFile, isLinux, isMacOS, isNumber, isObject, isString, isURL, isUnix, isWindows, kebabCase, listDirs, listFiles, logger,
|
|
3598
|
+
export { AiderTool, BaseCodeTool, BaseError, ClaudeCodeTool, ClineTool, CodexTool, ConfigManager, ConfigValidator, ConfigurationError, ContinueTool, CursorTool, InternalError, Logger, Mutex, NotFoundError, Semaphore, TimeoutError, ToolFactory, ToolRegistry, UnauthorizedError, ValidationError, index$6 as array, assert, assertDefined, index$5 as async, batchProcessFiles, camelCase, capitalize, chunk, index$4 as command, commandExists, copyFile, countLines, createConfigManager, createLogger, createTool, createValidator, debounce, deepClone, deepMerge, deleteDir, deleteFile, difference, ensureDir, index$3 as error, executeCommand, executeCommandStream, exists, flatten, flatten$1 as flattenArray, formatError, index$2 as fs, generateCompactWelcome, generateRecommendations, generateWelcome, get, getArchitecture, getCacheDir, getCapabilitiesByType, getCapability, getCommandPath, getCommandVersion, getConfigDir, getDataDir, getErrorMessage, getFileInfo, getFileSize, getHomeDir, getPlatform, getPlatformInfo, getRegistry, getTempDir, has, intersection, isArray, isBoolean, isDefined, isDirectory, isEmail, isFile, isLargeFile, isLinux, isMacOS, isNumber, isObject, isString, isURL, isUnix, isWindows, kebabCase, listDirs, listFiles, logger, moveFile, index$1 as object, omit, parallelLimit, partition, pascalCase, pick, processLargeFile, processLineByLine, readFile, readJSON, retry, scanCapabilities, sequence, set, shuffle, sleep, slugify, snakeCase, streamJSON, streamWriteJSON, index as string, template, throttle, timeout, truncate, tryCatch, tryCatchAsync, unflatten, union, unique, validation, validators, waitFor, wrapError, writeFile, writeJSON };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const INVALID_PERMISSION_NAMES = /* @__PURE__ */ new Set([
|
|
2
|
+
"AllowEdit",
|
|
3
|
+
"AllowWrite",
|
|
4
|
+
"AllowRead",
|
|
5
|
+
"AllowExec",
|
|
6
|
+
"AllowCreateProcess",
|
|
7
|
+
"AllowKillProcess",
|
|
8
|
+
"AllowNetworkAccess",
|
|
9
|
+
"AllowFileSystemAccess",
|
|
10
|
+
"AllowShellAccess",
|
|
11
|
+
"AllowHttpAccess"
|
|
12
|
+
]);
|
|
13
|
+
const DANGEROUS_BASH_PATTERNS = /* @__PURE__ */ new Set([
|
|
14
|
+
"Bash(passwd *)",
|
|
15
|
+
"Bash(reboot *)",
|
|
16
|
+
"Bash(shutdown *)",
|
|
17
|
+
"Bash(halt *)",
|
|
18
|
+
"Bash(poweroff *)",
|
|
19
|
+
"Bash(init *)",
|
|
20
|
+
"Bash(telinit *)",
|
|
21
|
+
"Bash(rm *)",
|
|
22
|
+
"Bash(kill *)",
|
|
23
|
+
"Bash(pkill *)",
|
|
24
|
+
"Bash(killall *)",
|
|
25
|
+
"Bash(su *)",
|
|
26
|
+
"Bash(sudo *)",
|
|
27
|
+
"Bash(visudo *)",
|
|
28
|
+
"Bash(useradd *)",
|
|
29
|
+
"Bash(userdel *)",
|
|
30
|
+
"Bash(usermod *)",
|
|
31
|
+
"Bash(groupadd *)",
|
|
32
|
+
"Bash(groupdel *)",
|
|
33
|
+
"Bash(groupmod *)",
|
|
34
|
+
"Bash(modprobe *)",
|
|
35
|
+
"Bash(insmod *)",
|
|
36
|
+
"Bash(rmmod *)"
|
|
37
|
+
]);
|
|
38
|
+
function isValidPermission(perm) {
|
|
39
|
+
if (INVALID_PERMISSION_NAMES.has(perm)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (["mcp__.*", "mcp__*", "mcp__(*)"].includes(perm)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (/^[a-z]/.test(perm) && !perm.startsWith("mcp__")) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
function isCoveredByWildcard(perm, wildcardPerm) {
|
|
51
|
+
const wildcardMatch = wildcardPerm.match(/^(\w+)\((.+)\)$/);
|
|
52
|
+
if (!wildcardMatch) return false;
|
|
53
|
+
const [, tool, wildcardArg] = wildcardMatch;
|
|
54
|
+
if (!wildcardArg.includes("*")) return false;
|
|
55
|
+
const permMatch = perm.match(/^(\w+)\((.+)\)$/);
|
|
56
|
+
if (!permMatch) return false;
|
|
57
|
+
const [, permTool, permArg] = permMatch;
|
|
58
|
+
if (tool !== permTool) return false;
|
|
59
|
+
const regexStr = wildcardArg.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".+");
|
|
60
|
+
return new RegExp(`^${regexStr}$`).test(permArg);
|
|
61
|
+
}
|
|
62
|
+
function mergeAndCleanPermissions(templatePermissions, userPermissions) {
|
|
63
|
+
const template = templatePermissions || [];
|
|
64
|
+
const user = userPermissions || [];
|
|
65
|
+
const result = [...template];
|
|
66
|
+
for (const perm of user) {
|
|
67
|
+
if (result.includes(perm)) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (!isValidPermission(perm)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (DANGEROUS_BASH_PATTERNS.has(perm)) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
let isRedundant = false;
|
|
77
|
+
for (const templatePerm of template) {
|
|
78
|
+
if (perm.startsWith(`${templatePerm}(`)) {
|
|
79
|
+
isRedundant = true;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
if (isCoveredByWildcard(perm, templatePerm)) {
|
|
83
|
+
isRedundant = true;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (!isRedundant) {
|
|
88
|
+
result.push(perm);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { mergeAndCleanPermissions as m };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import ansis from 'ansis';
|
|
2
|
+
|
|
3
|
+
class Logger {
|
|
4
|
+
level;
|
|
5
|
+
silent;
|
|
6
|
+
levels = {
|
|
7
|
+
debug: 0,
|
|
8
|
+
info: 1,
|
|
9
|
+
warn: 2,
|
|
10
|
+
error: 3
|
|
11
|
+
};
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
this.level = options.level || "info";
|
|
14
|
+
this.silent = options.silent || false;
|
|
15
|
+
}
|
|
16
|
+
shouldLog(level) {
|
|
17
|
+
return !this.silent && this.levels[level] >= this.levels[this.level];
|
|
18
|
+
}
|
|
19
|
+
format(level, message, data) {
|
|
20
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
21
|
+
const prefix = `[${timestamp}] [${level.toUpperCase()}]`;
|
|
22
|
+
const coloredPrefix = this.colorize(level, prefix);
|
|
23
|
+
const dataStr = data ? ` ${JSON.stringify(data)}` : "";
|
|
24
|
+
return `${coloredPrefix} ${message}${dataStr}`;
|
|
25
|
+
}
|
|
26
|
+
/** MUD-style color scheme for log levels */
|
|
27
|
+
colorize(level, text) {
|
|
28
|
+
switch (level) {
|
|
29
|
+
case "debug":
|
|
30
|
+
return ansis.gray(text);
|
|
31
|
+
case "info":
|
|
32
|
+
return ansis.green(text);
|
|
33
|
+
// MUD green for info
|
|
34
|
+
case "warn":
|
|
35
|
+
return ansis.yellow(text);
|
|
36
|
+
case "error":
|
|
37
|
+
return ansis.red(text);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
debug(message, data) {
|
|
41
|
+
if (this.shouldLog("debug")) {
|
|
42
|
+
console.log(this.format("debug", message, data));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
info(message, data) {
|
|
46
|
+
if (this.shouldLog("info")) {
|
|
47
|
+
console.log(this.format("info", message, data));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
warn(message, data) {
|
|
51
|
+
if (this.shouldLog("warn")) {
|
|
52
|
+
console.warn(this.format("warn", message, data));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
error(message, data) {
|
|
56
|
+
if (this.shouldLog("error")) {
|
|
57
|
+
console.error(this.format("error", message, data));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
setLevel(level) {
|
|
61
|
+
this.level = level;
|
|
62
|
+
}
|
|
63
|
+
setSilent(silent) {
|
|
64
|
+
this.silent = silent;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const logger = new Logger();
|
|
68
|
+
|
|
69
|
+
const logger$1 = {
|
|
70
|
+
__proto__: null,
|
|
71
|
+
Logger: Logger,
|
|
72
|
+
logger: logger
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export { logger$1 as a, logger as l };
|