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
package/dist/chunks/wsl.mjs
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'node:buffer';
|
|
2
|
-
import { c as chunkify } from '../shared/ccjk.KfSWcGlE.mjs';
|
|
3
|
-
import { canAccessPowerShell, convertWslPathToWindows, isUncPath } from './index13.mjs';
|
|
4
|
-
import process__default from 'node:process';
|
|
5
|
-
import { promisify } from 'node:util';
|
|
6
|
-
import childProcess from 'node:child_process';
|
|
7
|
-
import 'node:fs/promises';
|
|
8
|
-
import 'node:os';
|
|
9
|
-
import 'node:fs';
|
|
10
|
-
|
|
11
|
-
const execFile = promisify(childProcess.execFile);
|
|
12
|
-
|
|
13
|
-
const powerShellPath = () => `${process__default.env.SYSTEMROOT || process__default.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
14
|
-
|
|
15
|
-
const argumentsPrefix = [
|
|
16
|
-
'-NoProfile',
|
|
17
|
-
'-NonInteractive',
|
|
18
|
-
'-ExecutionPolicy',
|
|
19
|
-
'Bypass',
|
|
20
|
-
'-EncodedCommand',
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
const encodeCommand = command => Buffer.from(command, 'utf16le').toString('base64');
|
|
24
|
-
|
|
25
|
-
const escapeArgument = value => `'${String(value).replaceAll('\'', '\'\'')}'`;
|
|
26
|
-
|
|
27
|
-
const createArguments = command => [...argumentsPrefix, encodeCommand(command)];
|
|
28
|
-
|
|
29
|
-
const executePowerShell = async (command, options = {}) => {
|
|
30
|
-
const {
|
|
31
|
-
powerShellPath: psPath,
|
|
32
|
-
...execFileOptions
|
|
33
|
-
} = options;
|
|
34
|
-
|
|
35
|
-
return execFile(
|
|
36
|
-
psPath ?? powerShellPath(),
|
|
37
|
-
createArguments(command),
|
|
38
|
-
{
|
|
39
|
-
encoding: 'utf8',
|
|
40
|
-
...execFileOptions,
|
|
41
|
-
},
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
executePowerShell.argumentsPrefix = argumentsPrefix;
|
|
46
|
-
executePowerShell.encodeCommand = encodeCommand;
|
|
47
|
-
executePowerShell.escapeArgument = escapeArgument;
|
|
48
|
-
executePowerShell.createArguments = createArguments;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
WSL implementation:
|
|
52
|
-
- Converts WSL paths to Windows paths
|
|
53
|
-
- For Windows-local paths (e.g., `C:\…`), uses PowerShell to send to Recycle Bin
|
|
54
|
-
- For UNC `\\wsl$\…` paths (Linux filesystem), falls back to the Linux trash implementation
|
|
55
|
-
- Processes inputs in chunks to avoid command-line length limits
|
|
56
|
-
- Uses `-LiteralPath` to avoid wildcard expansion
|
|
57
|
-
- Uses `-EncodedCommand` with UTF-16LE to avoid quoting/length issues
|
|
58
|
-
*/
|
|
59
|
-
async function wsl(paths) {
|
|
60
|
-
const interopEnabled = await canAccessPowerShell();
|
|
61
|
-
if (!interopEnabled) {
|
|
62
|
-
const error = new Error('WSL interop is disabled. Enable it or use Linux trash implementation.');
|
|
63
|
-
error.code = 'WSL_INTEROP_DISABLED';
|
|
64
|
-
throw error;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
let linuxTrash;
|
|
68
|
-
|
|
69
|
-
for (const chunk of chunkify(paths, 400)) {
|
|
70
|
-
// eslint-disable-next-line no-await-in-loop
|
|
71
|
-
const windowsPaths = await convertWslPathToWindows(chunk);
|
|
72
|
-
|
|
73
|
-
// Partition into local drive paths and UNC \\wsl$ paths
|
|
74
|
-
const localWindowsPaths = [];
|
|
75
|
-
const uncLinuxPaths = [];
|
|
76
|
-
|
|
77
|
-
for (const [index, windowsPath] of windowsPaths.entries()) {
|
|
78
|
-
if (isUncPath(windowsPath)) {
|
|
79
|
-
uncLinuxPaths.push(chunk[index]);
|
|
80
|
-
} else {
|
|
81
|
-
localWindowsPaths.push(windowsPath);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Fallback to Linux trash for files that live on the Linux filesystem (UNC \\wsl$)
|
|
86
|
-
if (uncLinuxPaths.length > 0) {
|
|
87
|
-
if (!linuxTrash) {
|
|
88
|
-
// eslint-disable-next-line no-await-in-loop
|
|
89
|
-
const {default: linuxTrashImport} = await import('./linux.mjs');
|
|
90
|
-
linuxTrash = linuxTrashImport;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// eslint-disable-next-line no-await-in-loop
|
|
94
|
-
await linuxTrash(uncLinuxPaths);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Nothing to recycle on Windows side for this chunk
|
|
98
|
-
if (localWindowsPaths.length === 0) {
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Build a PowerShell script that:
|
|
103
|
-
// - Decodes a Base64 JSON array of paths
|
|
104
|
-
// - Uses LiteralPath to avoid wildcard expansion
|
|
105
|
-
// - Sends files/dirs to Recycle Bin
|
|
106
|
-
const json = JSON.stringify(localWindowsPaths);
|
|
107
|
-
const base64Json = Buffer.from(json, 'utf8').toString('base64');
|
|
108
|
-
|
|
109
|
-
const psScript = `
|
|
110
|
-
$ErrorActionPreference = 'Stop'
|
|
111
|
-
Add-Type -AssemblyName Microsoft.VisualBasic
|
|
112
|
-
$paths = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${base64Json}')) | ConvertFrom-Json
|
|
113
|
-
foreach ($p in $paths) {
|
|
114
|
-
if (Test-Path -LiteralPath $p) {
|
|
115
|
-
if (Test-Path -LiteralPath $p -PathType Container) {
|
|
116
|
-
[Microsoft.VisualBasic.FileIO.FileSystem]::DeleteDirectory($p, 'OnlyErrorDialogs', 'SendToRecycleBin')
|
|
117
|
-
} else {
|
|
118
|
-
[Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile($p, 'OnlyErrorDialogs', 'SendToRecycleBin')
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
`.trim();
|
|
123
|
-
|
|
124
|
-
// eslint-disable-next-line no-await-in-loop
|
|
125
|
-
await executePowerShell(psScript);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export { wsl as default };
|
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
import a from './index2.mjs';
|
|
2
|
-
import { i as inquirer } from './index3.mjs';
|
|
3
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
-
import { SETTINGS_FILE, CLAUDE_DIR } from './constants.mjs';
|
|
5
|
-
import { i18n } from './index5.mjs';
|
|
6
|
-
import { ensureDir, writeFileAtomic } from './fs-operations.mjs';
|
|
7
|
-
import { m as mergeAndCleanPermissions } from '../shared/ccjk.DXRAZcix.mjs';
|
|
8
|
-
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
9
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
10
|
-
import 'node:readline';
|
|
11
|
-
import 'stream';
|
|
12
|
-
import 'node:tty';
|
|
13
|
-
import 'node:process';
|
|
14
|
-
import 'node:async_hooks';
|
|
15
|
-
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
16
|
-
import 'node:util';
|
|
17
|
-
import 'tty';
|
|
18
|
-
import 'fs';
|
|
19
|
-
import 'child_process';
|
|
20
|
-
import 'node:path';
|
|
21
|
-
import 'node:os';
|
|
22
|
-
import 'node:crypto';
|
|
23
|
-
import 'buffer';
|
|
24
|
-
import 'string_decoder';
|
|
25
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
26
|
-
import 'node:url';
|
|
27
|
-
import 'node:fs/promises';
|
|
28
|
-
|
|
29
|
-
const MAX_PRESET = {
|
|
30
|
-
id: "max",
|
|
31
|
-
name: "Maximum Permissions",
|
|
32
|
-
description: "All common commands, file operations, and MCP servers",
|
|
33
|
-
permissions: [
|
|
34
|
-
"Bash(*)",
|
|
35
|
-
"Bash(sips *)",
|
|
36
|
-
// Package managers
|
|
37
|
-
"Bash(pnpm *)",
|
|
38
|
-
"Bash(npm *)",
|
|
39
|
-
"Bash(npx *)",
|
|
40
|
-
"Bash(NODE_ENV=* pnpm *)",
|
|
41
|
-
"Bash(yarn *)",
|
|
42
|
-
"Bash(bun *)",
|
|
43
|
-
"Bash(deno *)",
|
|
44
|
-
// Version control
|
|
45
|
-
"Bash(git *)",
|
|
46
|
-
// Build tools
|
|
47
|
-
"Bash(make *)",
|
|
48
|
-
"Bash(cmake *)",
|
|
49
|
-
"Bash(cargo *)",
|
|
50
|
-
"Bash(go *)",
|
|
51
|
-
"Bash(rustc *)",
|
|
52
|
-
// Container tools
|
|
53
|
-
"Bash(docker *)",
|
|
54
|
-
"Bash(docker-compose *)",
|
|
55
|
-
"Bash(podman *)",
|
|
56
|
-
// Programming languages
|
|
57
|
-
"Bash(python *)",
|
|
58
|
-
"Bash(python3 *)",
|
|
59
|
-
"Bash(node *)",
|
|
60
|
-
"Bash(ruby *)",
|
|
61
|
-
"Bash(php *)",
|
|
62
|
-
"Bash(java *)",
|
|
63
|
-
"Bash(javac *)",
|
|
64
|
-
// Shell utilities
|
|
65
|
-
"Bash(which *)",
|
|
66
|
-
"Bash(cat *)",
|
|
67
|
-
"Bash(ls *)",
|
|
68
|
-
"Bash(echo *)",
|
|
69
|
-
"Bash(grep *)",
|
|
70
|
-
"Bash(find *)",
|
|
71
|
-
"Bash(head *)",
|
|
72
|
-
"Bash(tail *)",
|
|
73
|
-
"Bash(wc *)",
|
|
74
|
-
"Bash(sort *)",
|
|
75
|
-
"Bash(uniq *)",
|
|
76
|
-
"Bash(cut *)",
|
|
77
|
-
"Bash(sed *)",
|
|
78
|
-
"Bash(awk *)",
|
|
79
|
-
"Bash(tr *)",
|
|
80
|
-
"Bash(xargs *)",
|
|
81
|
-
// File operations
|
|
82
|
-
"Bash(mkdir *)",
|
|
83
|
-
"Bash(touch *)",
|
|
84
|
-
"Bash(cp *)",
|
|
85
|
-
"Bash(mv *)",
|
|
86
|
-
"Bash(chmod *)",
|
|
87
|
-
"Bash(chown *)",
|
|
88
|
-
"Bash(ln *)",
|
|
89
|
-
// Network tools
|
|
90
|
-
"Bash(curl *)",
|
|
91
|
-
"Bash(wget *)",
|
|
92
|
-
"Bash(ping *)",
|
|
93
|
-
"Bash(netstat *)",
|
|
94
|
-
"Bash(ss *)",
|
|
95
|
-
// System info
|
|
96
|
-
"Bash(ps *)",
|
|
97
|
-
"Bash(top *)",
|
|
98
|
-
"Bash(htop *)",
|
|
99
|
-
"Bash(df *)",
|
|
100
|
-
"Bash(du *)",
|
|
101
|
-
"Bash(free *)",
|
|
102
|
-
"Bash(uname *)",
|
|
103
|
-
// Text editors
|
|
104
|
-
"Bash(vim *)",
|
|
105
|
-
"Bash(nano *)",
|
|
106
|
-
"Bash(emacs *)",
|
|
107
|
-
"Bash(code *)",
|
|
108
|
-
// Compression
|
|
109
|
-
"Bash(tar *)",
|
|
110
|
-
"Bash(gzip *)",
|
|
111
|
-
"Bash(gunzip *)",
|
|
112
|
-
"Bash(zip *)",
|
|
113
|
-
"Bash(unzip *)",
|
|
114
|
-
// Package managers (system)
|
|
115
|
-
"Bash(brew *)",
|
|
116
|
-
"Bash(apt *)",
|
|
117
|
-
"Bash(apt-get *)",
|
|
118
|
-
"Bash(yum *)",
|
|
119
|
-
"Bash(dnf *)",
|
|
120
|
-
"Bash(pacman *)",
|
|
121
|
-
// File operations (Claude Code tools)
|
|
122
|
-
"Read(*)",
|
|
123
|
-
"Edit(*)",
|
|
124
|
-
"Write(*)",
|
|
125
|
-
"NotebookEdit(*)",
|
|
126
|
-
// Web access
|
|
127
|
-
"WebFetch(*)",
|
|
128
|
-
// MCP servers (wildcard for all)
|
|
129
|
-
"MCP(*)"
|
|
130
|
-
],
|
|
131
|
-
env: {
|
|
132
|
-
ANTHROPIC_MODEL: "",
|
|
133
|
-
ANTHROPIC_DEFAULT_HAIKU_MODEL: "",
|
|
134
|
-
ANTHROPIC_DEFAULT_SONNET_MODEL: "",
|
|
135
|
-
ANTHROPIC_DEFAULT_OPUS_MODEL: ""
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
const DEV_PRESET = {
|
|
139
|
-
id: "dev",
|
|
140
|
-
name: "Developer Preset",
|
|
141
|
-
description: "Build tools, git, package managers, and file operations",
|
|
142
|
-
permissions: [
|
|
143
|
-
"Bash(*)",
|
|
144
|
-
"Bash(sips *)",
|
|
145
|
-
// Package managers
|
|
146
|
-
"Bash(pnpm *)",
|
|
147
|
-
"Bash(npm *)",
|
|
148
|
-
"Bash(npx *)",
|
|
149
|
-
"Bash(NODE_ENV=* pnpm *)",
|
|
150
|
-
"Bash(yarn *)",
|
|
151
|
-
"Bash(bun *)",
|
|
152
|
-
// Version control
|
|
153
|
-
"Bash(git *)",
|
|
154
|
-
// Build tools
|
|
155
|
-
"Bash(make *)",
|
|
156
|
-
"Bash(cargo *)",
|
|
157
|
-
"Bash(go *)",
|
|
158
|
-
// Programming languages
|
|
159
|
-
"Bash(python *)",
|
|
160
|
-
"Bash(python3 *)",
|
|
161
|
-
"Bash(node *)",
|
|
162
|
-
// Shell utilities
|
|
163
|
-
"Bash(which *)",
|
|
164
|
-
"Bash(cat *)",
|
|
165
|
-
"Bash(ls *)",
|
|
166
|
-
"Bash(echo *)",
|
|
167
|
-
"Bash(grep *)",
|
|
168
|
-
"Bash(find *)",
|
|
169
|
-
"Bash(head *)",
|
|
170
|
-
"Bash(tail *)",
|
|
171
|
-
"Bash(wc *)",
|
|
172
|
-
"Bash(sort *)",
|
|
173
|
-
// File operations
|
|
174
|
-
"Bash(mkdir *)",
|
|
175
|
-
"Bash(touch *)",
|
|
176
|
-
"Bash(cp *)",
|
|
177
|
-
"Bash(mv *)",
|
|
178
|
-
"Bash(chmod *)",
|
|
179
|
-
// File operations (Claude Code tools)
|
|
180
|
-
"Read(*)",
|
|
181
|
-
"Edit(*)",
|
|
182
|
-
"Write(*)",
|
|
183
|
-
"NotebookEdit(*)",
|
|
184
|
-
// Web access for docs
|
|
185
|
-
"WebFetch(*)"
|
|
186
|
-
],
|
|
187
|
-
env: {
|
|
188
|
-
ANTHROPIC_MODEL: ""
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
const SAFE_PRESET = {
|
|
192
|
-
id: "safe",
|
|
193
|
-
name: "Safe Preset",
|
|
194
|
-
description: "Read-only commands, no file modifications",
|
|
195
|
-
permissions: [
|
|
196
|
-
// Read-only shell utilities
|
|
197
|
-
"Bash(which *)",
|
|
198
|
-
"Bash(cat *)",
|
|
199
|
-
"Bash(ls *)",
|
|
200
|
-
"Bash(echo *)",
|
|
201
|
-
"Bash(grep *)",
|
|
202
|
-
"Bash(find *)",
|
|
203
|
-
"Bash(head *)",
|
|
204
|
-
"Bash(tail *)",
|
|
205
|
-
"Bash(wc *)",
|
|
206
|
-
"Bash(sort *)",
|
|
207
|
-
"Bash(uniq *)",
|
|
208
|
-
"Bash(cut *)",
|
|
209
|
-
// System info (read-only)
|
|
210
|
-
"Bash(ps *)",
|
|
211
|
-
"Bash(df *)",
|
|
212
|
-
"Bash(du *)",
|
|
213
|
-
"Bash(uname *)",
|
|
214
|
-
// Git read operations
|
|
215
|
-
"Bash(git status *)",
|
|
216
|
-
"Bash(git log *)",
|
|
217
|
-
"Bash(git diff *)",
|
|
218
|
-
"Bash(git show *)",
|
|
219
|
-
"Bash(git branch *)",
|
|
220
|
-
// File operations (read-only)
|
|
221
|
-
"Read(*)",
|
|
222
|
-
// Web access
|
|
223
|
-
"WebFetch(*)"
|
|
224
|
-
]
|
|
225
|
-
};
|
|
226
|
-
const PRESETS = [MAX_PRESET, DEV_PRESET, SAFE_PRESET];
|
|
227
|
-
function loadCurrentSettings() {
|
|
228
|
-
if (!existsSync(SETTINGS_FILE)) {
|
|
229
|
-
return {};
|
|
230
|
-
}
|
|
231
|
-
try {
|
|
232
|
-
const content = readFileSync(SETTINGS_FILE, "utf-8");
|
|
233
|
-
return JSON.parse(content);
|
|
234
|
-
} catch {
|
|
235
|
-
return {};
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
function saveSettings(settings) {
|
|
239
|
-
ensureDir(CLAUDE_DIR);
|
|
240
|
-
writeFileAtomic(SETTINGS_FILE, JSON.stringify(settings, null, 2));
|
|
241
|
-
}
|
|
242
|
-
function backupSettings() {
|
|
243
|
-
if (!existsSync(SETTINGS_FILE)) {
|
|
244
|
-
return null;
|
|
245
|
-
}
|
|
246
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -5);
|
|
247
|
-
const backupDir = `${CLAUDE_DIR}/backup`;
|
|
248
|
-
ensureDir(backupDir);
|
|
249
|
-
const backupPath = `${backupDir}/settings-${timestamp}.json`;
|
|
250
|
-
const content = readFileSync(SETTINGS_FILE, "utf-8");
|
|
251
|
-
writeFileAtomic(backupPath, content);
|
|
252
|
-
return backupPath;
|
|
253
|
-
}
|
|
254
|
-
function applyPreset(preset, currentSettings) {
|
|
255
|
-
const newSettings = { ...currentSettings };
|
|
256
|
-
if (!newSettings.permissions) {
|
|
257
|
-
newSettings.permissions = { allow: [] };
|
|
258
|
-
}
|
|
259
|
-
newSettings.permissions.allow = mergeAndCleanPermissions(
|
|
260
|
-
preset.permissions,
|
|
261
|
-
newSettings.permissions.allow || []
|
|
262
|
-
);
|
|
263
|
-
if (preset.env) {
|
|
264
|
-
newSettings.env = {
|
|
265
|
-
...newSettings.env,
|
|
266
|
-
...preset.env
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
return newSettings;
|
|
270
|
-
}
|
|
271
|
-
function showPresetDiff(preset, currentSettings) {
|
|
272
|
-
const isZh = i18n.language === "zh-CN";
|
|
273
|
-
const currentPermissions = new Set(currentSettings.permissions?.allow || []);
|
|
274
|
-
const newPermissions = preset.permissions.filter((p) => !currentPermissions.has(p));
|
|
275
|
-
console.log("");
|
|
276
|
-
console.log(a.bold.cyan(isZh ? "\u{1F4CB} \u9884\u8BBE\u8BE6\u60C5" : "\u{1F4CB} Preset Details"));
|
|
277
|
-
console.log(a.dim("\u2500".repeat(60)));
|
|
278
|
-
console.log(`${a.green("Name:")} ${preset.name}`);
|
|
279
|
-
console.log(`${a.green("Description:")} ${preset.description}`);
|
|
280
|
-
console.log("");
|
|
281
|
-
if (newPermissions.length > 0) {
|
|
282
|
-
console.log(a.bold.yellow(isZh ? "\u2728 \u5C06\u6DFB\u52A0\u7684\u6743\u9650:" : "\u2728 Permissions to be added:"));
|
|
283
|
-
console.log(a.dim(` ${isZh ? "\u603B\u8BA1" : "Total"}: ${newPermissions.length} ${isZh ? "\u9879" : "items"}`));
|
|
284
|
-
const bashPerms = newPermissions.filter((p) => p.startsWith("Bash("));
|
|
285
|
-
const filePerms = newPermissions.filter((p) => ["Read", "Edit", "Write", "NotebookEdit"].some((t) => p.startsWith(t)));
|
|
286
|
-
const otherPerms = newPermissions.filter((p) => !bashPerms.includes(p) && !filePerms.includes(p));
|
|
287
|
-
if (bashPerms.length > 0) {
|
|
288
|
-
console.log(` ${a.cyan("Bash:")} ${bashPerms.length} ${isZh ? "\u4E2A\u547D\u4EE4" : "commands"}`);
|
|
289
|
-
}
|
|
290
|
-
if (filePerms.length > 0) {
|
|
291
|
-
console.log(` ${a.cyan("File:")} ${filePerms.length} ${isZh ? "\u4E2A\u64CD\u4F5C" : "operations"}`);
|
|
292
|
-
}
|
|
293
|
-
if (otherPerms.length > 0) {
|
|
294
|
-
console.log(` ${a.cyan("Other:")} ${otherPerms.length} ${isZh ? "\u9879" : "items"}`);
|
|
295
|
-
}
|
|
296
|
-
} else {
|
|
297
|
-
console.log(a.yellow(isZh ? "\u2713 \u6240\u6709\u6743\u9650\u5DF2\u5B58\u5728" : "\u2713 All permissions already exist"));
|
|
298
|
-
}
|
|
299
|
-
console.log(a.dim("\u2500".repeat(60)));
|
|
300
|
-
console.log("");
|
|
301
|
-
}
|
|
302
|
-
async function zeroConfig(options = {}) {
|
|
303
|
-
const isZh = i18n.language === "zh-CN";
|
|
304
|
-
if (options.list) {
|
|
305
|
-
console.log("");
|
|
306
|
-
console.log(a.bold.cyan(isZh ? "\u{1F4E6} \u53EF\u7528\u7684\u6743\u9650\u9884\u8BBE" : "\u{1F4E6} Available Permission Presets"));
|
|
307
|
-
console.log(a.dim("\u2500".repeat(60)));
|
|
308
|
-
for (const preset of PRESETS) {
|
|
309
|
-
console.log(` ${a.green(preset.id.padEnd(8))} - ${preset.name}`);
|
|
310
|
-
console.log(` ${a.dim(" ".repeat(10))}${preset.description}`);
|
|
311
|
-
console.log(` ${a.dim(" ".repeat(10))}${preset.permissions.length} ${isZh ? "\u9879\u6743\u9650" : "permissions"}`);
|
|
312
|
-
console.log("");
|
|
313
|
-
}
|
|
314
|
-
console.log(a.dim("\u2500".repeat(60)));
|
|
315
|
-
console.log(a.gray(isZh ? "\u4F7F\u7528: npx ccjk zc --preset=<id>" : "Usage: npx ccjk zc --preset=<id>"));
|
|
316
|
-
console.log("");
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
let selectedPreset;
|
|
320
|
-
if (options.preset) {
|
|
321
|
-
selectedPreset = PRESETS.find((p) => p.id === options.preset);
|
|
322
|
-
if (!selectedPreset) {
|
|
323
|
-
console.error(a.red(isZh ? `\u9519\u8BEF: \u672A\u627E\u5230\u9884\u8BBE "${options.preset}"` : `Error: Preset "${options.preset}" not found`));
|
|
324
|
-
console.log(a.gray(isZh ? "\u4F7F\u7528 --list \u67E5\u770B\u53EF\u7528\u9884\u8BBE" : "Use --list to see available presets"));
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
} else {
|
|
328
|
-
const { presetId } = await inquirer.prompt({
|
|
329
|
-
type: "list",
|
|
330
|
-
name: "presetId",
|
|
331
|
-
message: isZh ? "\u9009\u62E9\u6743\u9650\u9884\u8BBE:" : "Select permission preset:",
|
|
332
|
-
choices: addNumbersToChoices(
|
|
333
|
-
PRESETS.map((p) => ({
|
|
334
|
-
name: `${p.name} - ${a.gray(p.description)}`,
|
|
335
|
-
value: p.id,
|
|
336
|
-
short: p.name
|
|
337
|
-
}))
|
|
338
|
-
)
|
|
339
|
-
});
|
|
340
|
-
selectedPreset = PRESETS.find((p) => p.id === presetId);
|
|
341
|
-
if (!selectedPreset) {
|
|
342
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
const currentSettings = loadCurrentSettings();
|
|
347
|
-
showPresetDiff(selectedPreset, currentSettings);
|
|
348
|
-
if (!options.preset) {
|
|
349
|
-
const { confirm } = await inquirer.prompt({
|
|
350
|
-
type: "confirm",
|
|
351
|
-
name: "confirm",
|
|
352
|
-
message: isZh ? "\u786E\u8BA4\u5E94\u7528\u6B64\u9884\u8BBE?" : "Confirm applying this preset?",
|
|
353
|
-
default: true
|
|
354
|
-
});
|
|
355
|
-
if (!confirm) {
|
|
356
|
-
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
if (!options.skipBackup) {
|
|
361
|
-
const backupPath = backupSettings();
|
|
362
|
-
if (backupPath) {
|
|
363
|
-
console.log(a.gray(`\u2714 ${isZh ? "\u5DF2\u5907\u4EFD\u5230" : "Backed up to"}: ${backupPath}`));
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
const newSettings = applyPreset(selectedPreset, currentSettings);
|
|
367
|
-
saveSettings(newSettings);
|
|
368
|
-
console.log("");
|
|
369
|
-
console.log(a.green(`\u2705 ${isZh ? "\u6743\u9650\u9884\u8BBE\u5DF2\u5E94\u7528" : "Permission preset applied"}: ${selectedPreset.name}`));
|
|
370
|
-
console.log(a.gray(` ${isZh ? "\u914D\u7F6E\u6587\u4EF6" : "Config file"}: ${SETTINGS_FILE}`));
|
|
371
|
-
console.log("");
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
export { zeroConfig };
|
package/dist/chunks/zsh.mjs
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
function generateZshCompletion(commands) {
|
|
2
|
-
return `#compdef ccjk
|
|
3
|
-
# CCJK CLI Zsh Completion
|
|
4
|
-
# Generated automatically - do not edit manually
|
|
5
|
-
# Install: place in $fpath as _ccjk
|
|
6
|
-
|
|
7
|
-
_ccjk() {
|
|
8
|
-
local curcontext="$curcontext" state line
|
|
9
|
-
typeset -A opt_args
|
|
10
|
-
|
|
11
|
-
local -a commands
|
|
12
|
-
commands=(
|
|
13
|
-
${generateZshCommandList(commands)}
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
_arguments -C \\
|
|
17
|
-
'(-h --help)'{-h,--help}'[Show help]' \\
|
|
18
|
-
'(-v --version)'{-v,--version}'[Show version]' \\
|
|
19
|
-
'(-l --lang)'{-l,--lang}'[Display language]:language:(zh-CN en)' \\
|
|
20
|
-
'1: :->command' \\
|
|
21
|
-
'*:: :->args'
|
|
22
|
-
|
|
23
|
-
case $state in
|
|
24
|
-
command)
|
|
25
|
-
_describe -t commands 'ccjk commands' commands
|
|
26
|
-
;;
|
|
27
|
-
args)
|
|
28
|
-
case $line[1] in
|
|
29
|
-
${generateZshCommandCases(commands)}
|
|
30
|
-
*)
|
|
31
|
-
_default
|
|
32
|
-
;;
|
|
33
|
-
esac
|
|
34
|
-
;;
|
|
35
|
-
esac
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
# Helper functions for dynamic completion
|
|
39
|
-
|
|
40
|
-
# Get installed MCP services
|
|
41
|
-
_ccjk_mcp_services() {
|
|
42
|
-
local -a services
|
|
43
|
-
services=(\${(f)"$(ccjk mcp list --json 2>/dev/null | grep -oP '"name":\\s*"\\K[^"]+' 2>/dev/null)"})
|
|
44
|
-
_describe -t services 'MCP services' services
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
# Get available skills
|
|
48
|
-
_ccjk_skills() {
|
|
49
|
-
local -a skills
|
|
50
|
-
skills=(\${(f)"$(ccjk skills list --format list 2>/dev/null | grep -v '^$' 2>/dev/null)"})
|
|
51
|
-
_describe -t skills 'skills' skills
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
# Get available agents
|
|
55
|
-
_ccjk_agents() {
|
|
56
|
-
local -a agents
|
|
57
|
-
agents=(\${(f)"$(ccjk agent list --json 2>/dev/null | grep -oP '"id":\\s*"\\K[^"]+' 2>/dev/null)"})
|
|
58
|
-
_describe -t agents 'agents' agents
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
# Get available sessions
|
|
62
|
-
_ccjk_sessions() {
|
|
63
|
-
local -a sessions
|
|
64
|
-
sessions=(\${(f)"$(ccjk session list --json 2>/dev/null | grep -oP '"name":\\s*"\\K[^"]+' 2>/dev/null)"})
|
|
65
|
-
_describe -t sessions 'sessions' sessions
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
_ccjk "$@"
|
|
69
|
-
`;
|
|
70
|
-
}
|
|
71
|
-
function generateZshCommandList(commands) {
|
|
72
|
-
const lines = [];
|
|
73
|
-
for (const cmd of commands) {
|
|
74
|
-
const desc = escapeZshString(cmd.description);
|
|
75
|
-
lines.push(` '${cmd.name}:${desc}'`);
|
|
76
|
-
if (cmd.aliases) {
|
|
77
|
-
for (const alias of cmd.aliases) {
|
|
78
|
-
lines.push(` '${alias}:${desc} (alias)'`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return lines.join("\n");
|
|
83
|
-
}
|
|
84
|
-
function generateZshCommandCases(commands) {
|
|
85
|
-
const cases = [];
|
|
86
|
-
for (const cmd of commands) {
|
|
87
|
-
const casePatterns = [cmd.name, ...cmd.aliases || []].join("|");
|
|
88
|
-
const caseBody = generateZshCommandBody(cmd);
|
|
89
|
-
cases.push(` ${casePatterns})
|
|
90
|
-
${caseBody}
|
|
91
|
-
;;`);
|
|
92
|
-
}
|
|
93
|
-
return cases.join("\n");
|
|
94
|
-
}
|
|
95
|
-
function generateZshCommandBody(cmd) {
|
|
96
|
-
const lines = [];
|
|
97
|
-
if (cmd.subcommands) {
|
|
98
|
-
lines.push(" local -a subcommands");
|
|
99
|
-
lines.push(" subcommands=(");
|
|
100
|
-
for (const sub of cmd.subcommands) {
|
|
101
|
-
const desc = escapeZshString(sub.description);
|
|
102
|
-
lines.push(` '${sub.name}:${desc}'`);
|
|
103
|
-
}
|
|
104
|
-
lines.push(" )");
|
|
105
|
-
lines.push("");
|
|
106
|
-
lines.push(" _arguments -C \\");
|
|
107
|
-
if (cmd.options) {
|
|
108
|
-
for (const opt of cmd.options) {
|
|
109
|
-
lines.push(` ${generateZshOption(opt)} \\`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
lines.push(" '1: :->subcmd' \\");
|
|
113
|
-
lines.push(" '*:: :->args'");
|
|
114
|
-
lines.push("");
|
|
115
|
-
lines.push(" case $state in");
|
|
116
|
-
lines.push(" subcmd)");
|
|
117
|
-
lines.push(" _describe -t subcommands 'subcommands' subcommands");
|
|
118
|
-
lines.push(" ;;");
|
|
119
|
-
lines.push(" args)");
|
|
120
|
-
lines.push(" case $line[1] in");
|
|
121
|
-
for (const sub of cmd.subcommands) {
|
|
122
|
-
lines.push(` ${sub.name})`);
|
|
123
|
-
lines.push(" _arguments \\");
|
|
124
|
-
if (sub.options) {
|
|
125
|
-
for (const opt of sub.options) {
|
|
126
|
-
lines.push(` ${generateZshOption(opt)} \\`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (cmd.options) {
|
|
130
|
-
for (const opt of cmd.options) {
|
|
131
|
-
lines.push(` ${generateZshOption(opt)} \\`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
lines.push(" '*:file:_files'");
|
|
135
|
-
lines.push(" ;;");
|
|
136
|
-
}
|
|
137
|
-
lines.push(" esac");
|
|
138
|
-
lines.push(" ;;");
|
|
139
|
-
lines.push(" esac");
|
|
140
|
-
} else if (cmd.options) {
|
|
141
|
-
lines.push(" _arguments \\");
|
|
142
|
-
for (const opt of cmd.options) {
|
|
143
|
-
lines.push(` ${generateZshOption(opt)} \\`);
|
|
144
|
-
}
|
|
145
|
-
lines.push(" '*:file:_files'");
|
|
146
|
-
} else {
|
|
147
|
-
lines.push(" _default");
|
|
148
|
-
}
|
|
149
|
-
return lines.join("\n");
|
|
150
|
-
}
|
|
151
|
-
function generateZshOption(opt) {
|
|
152
|
-
const flags = parseOptionFlags(opt.flags);
|
|
153
|
-
const desc = escapeZshString(opt.description);
|
|
154
|
-
if (flags.length === 2) {
|
|
155
|
-
const [short, long] = flags;
|
|
156
|
-
const valueSpec = getZshValueSpec(opt);
|
|
157
|
-
return `'(${short} ${long})'\\{${short},${long}\\}'[${desc}]${valueSpec}'`;
|
|
158
|
-
} else if (flags.length === 1) {
|
|
159
|
-
const flag = flags[0];
|
|
160
|
-
const valueSpec = getZshValueSpec(opt);
|
|
161
|
-
return `'${flag}[${desc}]${valueSpec}'`;
|
|
162
|
-
}
|
|
163
|
-
return "";
|
|
164
|
-
}
|
|
165
|
-
function getZshValueSpec(opt) {
|
|
166
|
-
if (!opt.values)
|
|
167
|
-
return "";
|
|
168
|
-
if (typeof opt.values === "function") {
|
|
169
|
-
return ":value:_default";
|
|
170
|
-
}
|
|
171
|
-
const values = opt.values.join(" ");
|
|
172
|
-
return `:value:(${values})`;
|
|
173
|
-
}
|
|
174
|
-
function parseOptionFlags(flags) {
|
|
175
|
-
const parts = flags.split(",").map((f) => f.trim().split(/\s+/)[0]);
|
|
176
|
-
return parts.sort((a, b) => a.length - b.length);
|
|
177
|
-
}
|
|
178
|
-
function escapeZshString(str) {
|
|
179
|
-
return str.replace(/'/g, "'\\''").replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/:/g, "\\:");
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export { generateZshCompletion };
|
package/dist/cli.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|