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/sessions.mjs
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import a from './index2.mjs';
|
|
2
|
-
import { t as taskPersistence } from '../shared/ccjk.BFxsJM0k.mjs';
|
|
3
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
4
|
-
import 'better-sqlite3';
|
|
5
|
-
import 'node:fs';
|
|
6
|
-
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
7
|
-
|
|
8
|
-
async function sessionsCommand(options = {}) {
|
|
9
|
-
if (options.list) {
|
|
10
|
-
const sessions = taskPersistence.listSessions(20);
|
|
11
|
-
if (sessions.length === 0) {
|
|
12
|
-
console.log(a.yellow("\n\u26A0\uFE0F No sessions found\n"));
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
console.log(a.cyan.bold("\n\u{1F4CB} Brain Sessions\n"));
|
|
16
|
-
for (const session of sessions) {
|
|
17
|
-
const date = new Date(session.createdAt).toLocaleString();
|
|
18
|
-
console.log(a.white(` ${session.id}`));
|
|
19
|
-
console.log(a.gray(` Created: ${date}`));
|
|
20
|
-
if (session.metadata.rootTask) {
|
|
21
|
-
console.log(a.gray(` Task: ${session.metadata.rootTask}`));
|
|
22
|
-
}
|
|
23
|
-
console.log();
|
|
24
|
-
}
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (options.show) {
|
|
28
|
-
const context = taskPersistence.restoreContext(options.show);
|
|
29
|
-
if (!context) {
|
|
30
|
-
console.log(a.red(`
|
|
31
|
-
\u274C Session not found: ${options.show}
|
|
32
|
-
`));
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
console.log(a.cyan.bold(`
|
|
36
|
-
\u{1F4CA} Session: ${context.sessionId}
|
|
37
|
-
`));
|
|
38
|
-
console.log(a.white(`Tasks: ${context.tasks.length}`));
|
|
39
|
-
console.log();
|
|
40
|
-
for (const task of context.tasks) {
|
|
41
|
-
const statusIcon = {
|
|
42
|
-
pending: "\u23F3",
|
|
43
|
-
running: "\u{1F504}",
|
|
44
|
-
completed: "\u2705",
|
|
45
|
-
failed: "\u274C"
|
|
46
|
-
}[task.status];
|
|
47
|
-
console.log(` ${statusIcon} ${task.name}`);
|
|
48
|
-
console.log(a.gray(` Status: ${task.status}`));
|
|
49
|
-
console.log(a.gray(` Priority: ${task.priority}`));
|
|
50
|
-
if (task.dependencies.length > 0) {
|
|
51
|
-
console.log(a.gray(` Depends on: ${task.dependencies.join(", ")}`));
|
|
52
|
-
}
|
|
53
|
-
if (task.error) {
|
|
54
|
-
const error = JSON.parse(task.error);
|
|
55
|
-
console.log(a.red(` Error: ${error.message}`));
|
|
56
|
-
}
|
|
57
|
-
console.log();
|
|
58
|
-
}
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (options.restore) {
|
|
62
|
-
const context = taskPersistence.restoreContext(options.restore);
|
|
63
|
-
if (!context) {
|
|
64
|
-
console.log(a.red(`
|
|
65
|
-
\u274C Session not found: ${options.restore}
|
|
66
|
-
`));
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
console.log(a.cyan.bold(`
|
|
70
|
-
\u{1F504} Restoring session: ${context.sessionId}
|
|
71
|
-
`));
|
|
72
|
-
const incompleteTasks = context.tasks.filter(
|
|
73
|
-
(t) => t.status === "pending" || t.status === "running"
|
|
74
|
-
);
|
|
75
|
-
if (incompleteTasks.length === 0) {
|
|
76
|
-
console.log(a.green("\u2705 All tasks completed, nothing to restore\n"));
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
console.log(a.yellow(`Found ${incompleteTasks.length} incomplete tasks:
|
|
80
|
-
`));
|
|
81
|
-
for (const task of incompleteTasks) {
|
|
82
|
-
console.log(` \u23F3 ${task.name}`);
|
|
83
|
-
}
|
|
84
|
-
console.log();
|
|
85
|
-
console.log(a.gray("\u{1F4A1} To resume execution, use:"));
|
|
86
|
-
console.log(a.cyan(` ccjk brain execute --session ${context.sessionId}`));
|
|
87
|
-
console.log();
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (options.cleanup) {
|
|
91
|
-
const deleted = taskPersistence.cleanup(7);
|
|
92
|
-
console.log(a.green(`
|
|
93
|
-
\u2705 Cleaned up ${deleted} old records (kept last 7 days)
|
|
94
|
-
`));
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
console.log(a.cyan.bold("\n\u{1F4CB} Brain Sessions Management\n"));
|
|
98
|
-
console.log(a.white("Usage:"));
|
|
99
|
-
console.log(a.gray(" ccjk sessions --list # List all sessions"));
|
|
100
|
-
console.log(a.gray(" ccjk sessions --show <id> # Show session details"));
|
|
101
|
-
console.log(a.gray(" ccjk sessions --restore <id> # Restore incomplete session"));
|
|
102
|
-
console.log(a.gray(" ccjk sessions --cleanup # Clean up old sessions"));
|
|
103
|
-
console.log();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export { sessionsCommand };
|
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync, appendFileSync, unlinkSync, mkdirSync } from 'node:fs';
|
|
2
|
-
import { platform } from 'node:os';
|
|
3
|
-
import process__default from 'node:process';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { CCJK_CONFIG_DIR } from './constants.mjs';
|
|
6
|
-
import { getCloudState, updateCloudState } from './auto-bootstrap.mjs';
|
|
7
|
-
import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
8
|
-
import './index5.mjs';
|
|
9
|
-
import 'node:crypto';
|
|
10
|
-
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = dirname(__filename);
|
|
13
|
-
const UPGRADE_LOG_DIR = join(CCJK_CONFIG_DIR, "cloud", "logs");
|
|
14
|
-
const UPGRADE_LOG_FILE = join(UPGRADE_LOG_DIR, "upgrades.log");
|
|
15
|
-
const UPGRADE_LOCK_FILE = join(CCJK_CONFIG_DIR, "cloud", ".upgrade.lock");
|
|
16
|
-
const UPGRADE_CHECK_INTERVAL = 6 * 60 * 60 * 1e3;
|
|
17
|
-
const UPGRADE_TIMEOUT = 5 * 60 * 1e3;
|
|
18
|
-
async function checkAllToolVersions() {
|
|
19
|
-
const results = [];
|
|
20
|
-
const [ccjk, claudeCode, ccr] = await Promise.all([
|
|
21
|
-
checkCcjkVersion(),
|
|
22
|
-
checkClaudeCodeVersion(),
|
|
23
|
-
checkCcrVersion()
|
|
24
|
-
]);
|
|
25
|
-
results.push(ccjk, claudeCode, ccr);
|
|
26
|
-
return results;
|
|
27
|
-
}
|
|
28
|
-
async function checkCcjkVersion() {
|
|
29
|
-
try {
|
|
30
|
-
const currentVersion = getCurrentCcjkVersion();
|
|
31
|
-
const latestVersion = await fetchLatestNpmVersion("ccjk");
|
|
32
|
-
return {
|
|
33
|
-
tool: "ccjk",
|
|
34
|
-
installed: true,
|
|
35
|
-
currentVersion,
|
|
36
|
-
latestVersion,
|
|
37
|
-
needsUpdate: latestVersion ? isNewerVersion(latestVersion, currentVersion) : false,
|
|
38
|
-
installMethod: "npm"
|
|
39
|
-
};
|
|
40
|
-
} catch {
|
|
41
|
-
return {
|
|
42
|
-
tool: "ccjk",
|
|
43
|
-
installed: true,
|
|
44
|
-
currentVersion: getCurrentCcjkVersion(),
|
|
45
|
-
latestVersion: null,
|
|
46
|
-
needsUpdate: false,
|
|
47
|
-
installMethod: "npm"
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function checkClaudeCodeVersion() {
|
|
52
|
-
try {
|
|
53
|
-
const { exec } = await import('./main.mjs');
|
|
54
|
-
const result = await exec("claude", ["--version"], { timeout: 5e3 });
|
|
55
|
-
if (result.exitCode !== 0) {
|
|
56
|
-
return {
|
|
57
|
-
tool: "claude-code",
|
|
58
|
-
installed: false,
|
|
59
|
-
currentVersion: null,
|
|
60
|
-
latestVersion: null,
|
|
61
|
-
needsUpdate: false,
|
|
62
|
-
installMethod: "unknown"
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const currentVersion = result.stdout.trim().replace(/^v/, "");
|
|
66
|
-
const latestVersion = await fetchLatestNpmVersion("@anthropic-ai/claude-code");
|
|
67
|
-
const installMethod = await detectClaudeCodeInstallMethod();
|
|
68
|
-
return {
|
|
69
|
-
tool: "claude-code",
|
|
70
|
-
installed: true,
|
|
71
|
-
currentVersion,
|
|
72
|
-
latestVersion,
|
|
73
|
-
needsUpdate: latestVersion ? isNewerVersion(latestVersion, currentVersion) : false,
|
|
74
|
-
installMethod
|
|
75
|
-
};
|
|
76
|
-
} catch {
|
|
77
|
-
return {
|
|
78
|
-
tool: "claude-code",
|
|
79
|
-
installed: false,
|
|
80
|
-
currentVersion: null,
|
|
81
|
-
latestVersion: null,
|
|
82
|
-
needsUpdate: false,
|
|
83
|
-
installMethod: "unknown"
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async function checkCcrVersion() {
|
|
88
|
-
try {
|
|
89
|
-
const { exec } = await import('./main.mjs');
|
|
90
|
-
const result = await exec("ccr", ["--version"], { timeout: 5e3 });
|
|
91
|
-
if (result.exitCode !== 0) {
|
|
92
|
-
return {
|
|
93
|
-
tool: "ccr",
|
|
94
|
-
installed: false,
|
|
95
|
-
currentVersion: null,
|
|
96
|
-
latestVersion: null,
|
|
97
|
-
needsUpdate: false,
|
|
98
|
-
installMethod: "unknown"
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
const currentVersion = result.stdout.trim().replace(/^v/, "");
|
|
102
|
-
const latestVersion = await fetchLatestNpmVersion("@musistudio/claude-code-router");
|
|
103
|
-
return {
|
|
104
|
-
tool: "ccr",
|
|
105
|
-
installed: true,
|
|
106
|
-
currentVersion,
|
|
107
|
-
latestVersion,
|
|
108
|
-
needsUpdate: latestVersion ? isNewerVersion(latestVersion, currentVersion) : false,
|
|
109
|
-
installMethod: "npm"
|
|
110
|
-
};
|
|
111
|
-
} catch {
|
|
112
|
-
return {
|
|
113
|
-
tool: "ccr",
|
|
114
|
-
installed: false,
|
|
115
|
-
currentVersion: null,
|
|
116
|
-
latestVersion: null,
|
|
117
|
-
needsUpdate: false,
|
|
118
|
-
installMethod: "unknown"
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function getCurrentCcjkVersion() {
|
|
123
|
-
try {
|
|
124
|
-
const packagePath = join(__dirname, "../../../package.json");
|
|
125
|
-
if (existsSync(packagePath)) {
|
|
126
|
-
const pkg = JSON.parse(readFileSync(packagePath, "utf-8"));
|
|
127
|
-
return pkg.version || "unknown";
|
|
128
|
-
}
|
|
129
|
-
} catch {
|
|
130
|
-
}
|
|
131
|
-
return "unknown";
|
|
132
|
-
}
|
|
133
|
-
async function fetchLatestNpmVersion(packageName) {
|
|
134
|
-
const controller = new AbortController();
|
|
135
|
-
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
136
|
-
try {
|
|
137
|
-
const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`, {
|
|
138
|
-
signal: controller.signal
|
|
139
|
-
});
|
|
140
|
-
if (response.ok) {
|
|
141
|
-
const data = await response.json();
|
|
142
|
-
return data.version;
|
|
143
|
-
}
|
|
144
|
-
} catch {
|
|
145
|
-
} finally {
|
|
146
|
-
clearTimeout(timeoutId);
|
|
147
|
-
}
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
async function detectClaudeCodeInstallMethod() {
|
|
151
|
-
try {
|
|
152
|
-
const { exec } = await import('./main.mjs');
|
|
153
|
-
if (platform() === "darwin") {
|
|
154
|
-
const brewResult = await exec("brew", ["list", "--cask", "claude-code"], { timeout: 5e3 });
|
|
155
|
-
if (brewResult.exitCode === 0) {
|
|
156
|
-
return "homebrew";
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
const npmResult = await exec("npm", ["list", "-g", "@anthropic-ai/claude-code"], { timeout: 5e3 });
|
|
160
|
-
if (npmResult.exitCode === 0 && npmResult.stdout.includes("@anthropic-ai/claude-code")) {
|
|
161
|
-
return "npm";
|
|
162
|
-
}
|
|
163
|
-
return "curl";
|
|
164
|
-
} catch {
|
|
165
|
-
return "unknown";
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function isNewerVersion(latest, current) {
|
|
169
|
-
if (!latest || !current || current === "unknown")
|
|
170
|
-
return false;
|
|
171
|
-
const latestParts = latest.split(".").map(Number);
|
|
172
|
-
const currentParts = current.split(".").map(Number);
|
|
173
|
-
for (let i = 0; i < 3; i++) {
|
|
174
|
-
const l = latestParts[i] || 0;
|
|
175
|
-
const c = currentParts[i] || 0;
|
|
176
|
-
if (l > c)
|
|
177
|
-
return true;
|
|
178
|
-
if (l < c)
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
async function performSilentUpgradeAll() {
|
|
184
|
-
const startTime = Date.now();
|
|
185
|
-
const results = [];
|
|
186
|
-
if (isUpgradeLocked()) {
|
|
187
|
-
return {
|
|
188
|
-
success: false,
|
|
189
|
-
results: [],
|
|
190
|
-
totalDuration: 0,
|
|
191
|
-
upgradedCount: 0,
|
|
192
|
-
failedCount: 0
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
try {
|
|
196
|
-
createUpgradeLock();
|
|
197
|
-
const versions = await checkAllToolVersions();
|
|
198
|
-
const toolsToUpgrade = versions.filter((v) => v.needsUpdate && v.installed);
|
|
199
|
-
for (const tool of toolsToUpgrade) {
|
|
200
|
-
const result = await upgradeTool(tool);
|
|
201
|
-
results.push(result);
|
|
202
|
-
logUpgrade({
|
|
203
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
204
|
-
tool: tool.tool,
|
|
205
|
-
fromVersion: tool.currentVersion || "unknown",
|
|
206
|
-
toVersion: tool.latestVersion || "unknown",
|
|
207
|
-
success: result.success,
|
|
208
|
-
error: result.error,
|
|
209
|
-
duration: result.duration
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
const totalDuration = Date.now() - startTime;
|
|
213
|
-
const upgradedCount = results.filter((r) => r.upgraded).length;
|
|
214
|
-
const failedCount = results.filter((r) => !r.success).length;
|
|
215
|
-
const state = getCloudState();
|
|
216
|
-
updateCloudState({
|
|
217
|
-
lastUpgradeCheckAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
218
|
-
upgradeStats: {
|
|
219
|
-
totalChecks: state.upgradeStats.totalChecks + 1,
|
|
220
|
-
upgradesApplied: state.upgradeStats.upgradesApplied + upgradedCount,
|
|
221
|
-
upgradesFailed: state.upgradeStats.upgradesFailed + failedCount
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
return {
|
|
225
|
-
success: failedCount === 0,
|
|
226
|
-
results,
|
|
227
|
-
totalDuration,
|
|
228
|
-
upgradedCount,
|
|
229
|
-
failedCount
|
|
230
|
-
};
|
|
231
|
-
} finally {
|
|
232
|
-
releaseUpgradeLock();
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
async function upgradeTool(info) {
|
|
236
|
-
const startTime = Date.now();
|
|
237
|
-
try {
|
|
238
|
-
switch (info.tool) {
|
|
239
|
-
case "ccjk":
|
|
240
|
-
return await upgradeCcjk(info, startTime);
|
|
241
|
-
case "claude-code":
|
|
242
|
-
return await upgradeClaudeCode(info, startTime);
|
|
243
|
-
case "ccr":
|
|
244
|
-
return await upgradeCcr(info, startTime);
|
|
245
|
-
default:
|
|
246
|
-
return {
|
|
247
|
-
tool: info.tool,
|
|
248
|
-
success: false,
|
|
249
|
-
upgraded: false,
|
|
250
|
-
error: "Unknown tool",
|
|
251
|
-
duration: Date.now() - startTime
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
} catch (error) {
|
|
255
|
-
return {
|
|
256
|
-
tool: info.tool,
|
|
257
|
-
success: false,
|
|
258
|
-
upgraded: false,
|
|
259
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
260
|
-
duration: Date.now() - startTime
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
async function upgradeCcjk(info, startTime) {
|
|
265
|
-
const { exec } = await import('./main.mjs');
|
|
266
|
-
const result = await exec("npm", ["update", "-g", "ccjk"], {
|
|
267
|
-
timeout: UPGRADE_TIMEOUT
|
|
268
|
-
});
|
|
269
|
-
return {
|
|
270
|
-
tool: "ccjk",
|
|
271
|
-
success: result.exitCode === 0,
|
|
272
|
-
upgraded: result.exitCode === 0,
|
|
273
|
-
fromVersion: info.currentVersion || void 0,
|
|
274
|
-
toVersion: info.latestVersion || void 0,
|
|
275
|
-
error: result.exitCode !== 0 ? result.stderr : void 0,
|
|
276
|
-
duration: Date.now() - startTime
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
async function upgradeClaudeCode(info, startTime) {
|
|
280
|
-
const { exec } = await import('./main.mjs');
|
|
281
|
-
let result;
|
|
282
|
-
switch (info.installMethod) {
|
|
283
|
-
case "homebrew":
|
|
284
|
-
result = await exec("brew", ["upgrade", "--cask", "claude-code"], {
|
|
285
|
-
timeout: UPGRADE_TIMEOUT
|
|
286
|
-
});
|
|
287
|
-
break;
|
|
288
|
-
case "npm":
|
|
289
|
-
result = await exec("npm", ["update", "-g", "@anthropic-ai/claude-code"], {
|
|
290
|
-
timeout: UPGRADE_TIMEOUT
|
|
291
|
-
});
|
|
292
|
-
break;
|
|
293
|
-
case "curl":
|
|
294
|
-
default:
|
|
295
|
-
result = await exec("claude", ["update"], {
|
|
296
|
-
timeout: UPGRADE_TIMEOUT
|
|
297
|
-
});
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
return {
|
|
301
|
-
tool: "claude-code",
|
|
302
|
-
success: result.exitCode === 0,
|
|
303
|
-
upgraded: result.exitCode === 0,
|
|
304
|
-
fromVersion: info.currentVersion || void 0,
|
|
305
|
-
toVersion: info.latestVersion || void 0,
|
|
306
|
-
error: result.exitCode !== 0 ? result.stderr : void 0,
|
|
307
|
-
duration: Date.now() - startTime
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
async function upgradeCcr(info, startTime) {
|
|
311
|
-
const { exec } = await import('./main.mjs');
|
|
312
|
-
const result = await exec("npm", ["update", "-g", "@musistudio/claude-code-router"], {
|
|
313
|
-
timeout: UPGRADE_TIMEOUT
|
|
314
|
-
});
|
|
315
|
-
return {
|
|
316
|
-
tool: "ccr",
|
|
317
|
-
success: result.exitCode === 0,
|
|
318
|
-
upgraded: result.exitCode === 0,
|
|
319
|
-
fromVersion: info.currentVersion || void 0,
|
|
320
|
-
toVersion: info.latestVersion || void 0,
|
|
321
|
-
error: result.exitCode !== 0 ? result.stderr : void 0,
|
|
322
|
-
duration: Date.now() - startTime
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
function isUpgradeLocked() {
|
|
326
|
-
if (!existsSync(UPGRADE_LOCK_FILE)) {
|
|
327
|
-
return false;
|
|
328
|
-
}
|
|
329
|
-
try {
|
|
330
|
-
const lockData = JSON.parse(readFileSync(UPGRADE_LOCK_FILE, "utf-8"));
|
|
331
|
-
const lockTime = new Date(lockData.timestamp).getTime();
|
|
332
|
-
const now = Date.now();
|
|
333
|
-
if (now - lockTime > 10 * 60 * 1e3) {
|
|
334
|
-
releaseUpgradeLock();
|
|
335
|
-
return false;
|
|
336
|
-
}
|
|
337
|
-
return true;
|
|
338
|
-
} catch {
|
|
339
|
-
return false;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
function createUpgradeLock() {
|
|
343
|
-
ensureLogDir();
|
|
344
|
-
writeFileSync(UPGRADE_LOCK_FILE, JSON.stringify({
|
|
345
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
346
|
-
pid: process__default.pid
|
|
347
|
-
}));
|
|
348
|
-
}
|
|
349
|
-
function releaseUpgradeLock() {
|
|
350
|
-
try {
|
|
351
|
-
if (existsSync(UPGRADE_LOCK_FILE)) {
|
|
352
|
-
unlinkSync(UPGRADE_LOCK_FILE);
|
|
353
|
-
}
|
|
354
|
-
} catch {
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
function ensureLogDir() {
|
|
358
|
-
if (!existsSync(UPGRADE_LOG_DIR)) {
|
|
359
|
-
mkdirSync(UPGRADE_LOG_DIR, { recursive: true });
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function logUpgrade(entry) {
|
|
363
|
-
ensureLogDir();
|
|
364
|
-
const logLine = [
|
|
365
|
-
entry.timestamp,
|
|
366
|
-
entry.tool,
|
|
367
|
-
entry.fromVersion,
|
|
368
|
-
"->",
|
|
369
|
-
entry.toVersion,
|
|
370
|
-
entry.success ? "SUCCESS" : "FAILED",
|
|
371
|
-
entry.error || "",
|
|
372
|
-
`${entry.duration}ms`
|
|
373
|
-
].join(" | ");
|
|
374
|
-
appendFileSync(UPGRADE_LOG_FILE, `${logLine}
|
|
375
|
-
`);
|
|
376
|
-
}
|
|
377
|
-
function shouldCheckForUpgrades() {
|
|
378
|
-
const state = getCloudState();
|
|
379
|
-
if (!state.silentUpgradeEnabled) {
|
|
380
|
-
return false;
|
|
381
|
-
}
|
|
382
|
-
if (!state.lastUpgradeCheckAt) {
|
|
383
|
-
return true;
|
|
384
|
-
}
|
|
385
|
-
const lastCheck = new Date(state.lastUpgradeCheckAt).getTime();
|
|
386
|
-
const now = Date.now();
|
|
387
|
-
return now - lastCheck >= UPGRADE_CHECK_INTERVAL;
|
|
388
|
-
}
|
|
389
|
-
async function checkAndUpgradeIfNeeded() {
|
|
390
|
-
if (!shouldCheckForUpgrades()) {
|
|
391
|
-
return null;
|
|
392
|
-
}
|
|
393
|
-
return performSilentUpgradeAll();
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
export { UPGRADE_CHECK_INTERVAL, UPGRADE_LOCK_FILE, UPGRADE_LOG_DIR, UPGRADE_LOG_FILE, UPGRADE_TIMEOUT, checkAndUpgradeIfNeeded as autoUpgrade, checkAllToolVersions, checkAndUpgradeIfNeeded, checkAllToolVersions as checkVersions, performSilentUpgradeAll, shouldCheckForUpgrades, performSilentUpgradeAll as upgradeAll };
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { exec as q } from './main.mjs';
|
|
4
|
-
import { SETTINGS_FILE, CLAUDE_DIR } from './constants.mjs';
|
|
5
|
-
import { ensureDir, writeFileAtomic } from './fs-operations.mjs';
|
|
6
|
-
import { m as mergeAndCleanPermissions } from '../shared/ccjk.DXRAZcix.mjs';
|
|
7
|
-
import { g as getPlatform } from './platform.mjs';
|
|
8
|
-
import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
9
|
-
import 'module';
|
|
10
|
-
import 'node:child_process';
|
|
11
|
-
import 'node:path';
|
|
12
|
-
import 'node:process';
|
|
13
|
-
import 'node:stream';
|
|
14
|
-
import 'node:readline';
|
|
15
|
-
import 'node:os';
|
|
16
|
-
import './index5.mjs';
|
|
17
|
-
import 'node:crypto';
|
|
18
|
-
import 'node:fs/promises';
|
|
19
|
-
|
|
20
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
|
-
function getTemplateSettings() {
|
|
22
|
-
const templatePath = join(__dirname, "../../templates/claude-code/common/settings.json");
|
|
23
|
-
const content = readFileSync(templatePath, "utf-8");
|
|
24
|
-
return JSON.parse(content);
|
|
25
|
-
}
|
|
26
|
-
function loadCurrentSettings() {
|
|
27
|
-
if (!existsSync(SETTINGS_FILE)) {
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
const content = readFileSync(SETTINGS_FILE, "utf-8");
|
|
32
|
-
return JSON.parse(content);
|
|
33
|
-
} catch {
|
|
34
|
-
return {};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function saveSettings(settings) {
|
|
38
|
-
ensureDir(CLAUDE_DIR);
|
|
39
|
-
writeFileAtomic(SETTINGS_FILE, JSON.stringify(settings, null, 2));
|
|
40
|
-
}
|
|
41
|
-
async function importRecommendedEnv() {
|
|
42
|
-
const templateSettings = getTemplateSettings();
|
|
43
|
-
const currentSettings = loadCurrentSettings();
|
|
44
|
-
currentSettings.env = {
|
|
45
|
-
...currentSettings.env,
|
|
46
|
-
...templateSettings.env
|
|
47
|
-
};
|
|
48
|
-
saveSettings(currentSettings);
|
|
49
|
-
}
|
|
50
|
-
async function importRecommendedPermissions() {
|
|
51
|
-
const templateSettings = getTemplateSettings();
|
|
52
|
-
const currentSettings = loadCurrentSettings();
|
|
53
|
-
if (templateSettings.permissions && templateSettings.permissions.allow) {
|
|
54
|
-
currentSettings.permissions = {
|
|
55
|
-
...templateSettings.permissions,
|
|
56
|
-
allow: mergeAndCleanPermissions(
|
|
57
|
-
templateSettings.permissions.allow,
|
|
58
|
-
currentSettings.permissions?.allow
|
|
59
|
-
)
|
|
60
|
-
};
|
|
61
|
-
} else {
|
|
62
|
-
currentSettings.permissions = templateSettings.permissions;
|
|
63
|
-
}
|
|
64
|
-
saveSettings(currentSettings);
|
|
65
|
-
}
|
|
66
|
-
async function openSettingsJson() {
|
|
67
|
-
ensureDir(CLAUDE_DIR);
|
|
68
|
-
if (!existsSync(SETTINGS_FILE)) {
|
|
69
|
-
saveSettings({});
|
|
70
|
-
}
|
|
71
|
-
const platform = getPlatform();
|
|
72
|
-
let command;
|
|
73
|
-
switch (platform) {
|
|
74
|
-
case "macos":
|
|
75
|
-
command = "open";
|
|
76
|
-
break;
|
|
77
|
-
case "windows":
|
|
78
|
-
command = "start";
|
|
79
|
-
break;
|
|
80
|
-
default:
|
|
81
|
-
command = "xdg-open";
|
|
82
|
-
}
|
|
83
|
-
try {
|
|
84
|
-
await q(command, [SETTINGS_FILE]);
|
|
85
|
-
} catch {
|
|
86
|
-
try {
|
|
87
|
-
await q("code", [SETTINGS_FILE]);
|
|
88
|
-
} catch {
|
|
89
|
-
try {
|
|
90
|
-
await q("vim", [SETTINGS_FILE]);
|
|
91
|
-
} catch {
|
|
92
|
-
await q("nano", [SETTINGS_FILE]);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export { importRecommendedEnv, importRecommendedPermissions, openSettingsJson };
|
package/dist/chunks/skill.mjs
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
const browserSkill = {
|
|
2
|
-
id: "browser-automation",
|
|
3
|
-
name: {
|
|
4
|
-
"en": "Browser Automation",
|
|
5
|
-
"zh-CN": "\u6D4F\u89C8\u5668\u81EA\u52A8\u5316"
|
|
6
|
-
},
|
|
7
|
-
description: {
|
|
8
|
-
"en": "Zero-config headless browser automation for AI agents",
|
|
9
|
-
"zh-CN": "\u96F6\u914D\u7F6E\u7684 AI \u4EE3\u7406\u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u5DE5\u5177"
|
|
10
|
-
},
|
|
11
|
-
category: "dev",
|
|
12
|
-
triggers: ["/browser", "/web", "/browse"],
|
|
13
|
-
enabled: true,
|
|
14
|
-
version: "1.0.0",
|
|
15
|
-
author: "CCJK",
|
|
16
|
-
tags: ["browser", "automation", "web", "scraping", "testing"],
|
|
17
|
-
template: `# Browser Automation Skill
|
|
18
|
-
|
|
19
|
-
## Overview
|
|
20
|
-
This skill provides zero-config headless browser automation powered by agent-browser.
|
|
21
|
-
|
|
22
|
-
## Quick Start
|
|
23
|
-
|
|
24
|
-
### Open a URL
|
|
25
|
-
\`\`\`bash
|
|
26
|
-
ccjk browser open https://example.com
|
|
27
|
-
\`\`\`
|
|
28
|
-
|
|
29
|
-
### Get Page Snapshot (AI-optimized)
|
|
30
|
-
\`\`\`bash
|
|
31
|
-
ccjk browser snapshot -i # Interactive elements only
|
|
32
|
-
ccjk browser snapshot -c # Compact output
|
|
33
|
-
\`\`\`
|
|
34
|
-
|
|
35
|
-
### Interact with Elements
|
|
36
|
-
\`\`\`bash
|
|
37
|
-
ccjk browser click @e1 # Click by ref
|
|
38
|
-
ccjk browser fill @e2 "text" # Fill input
|
|
39
|
-
ccjk browser get text @e3 # Get text content
|
|
40
|
-
\`\`\`
|
|
41
|
-
|
|
42
|
-
### Screenshots
|
|
43
|
-
\`\`\`bash
|
|
44
|
-
ccjk browser screenshot # Viewport
|
|
45
|
-
ccjk browser screenshot --full # Full page
|
|
46
|
-
ccjk browser screenshot output.png # Custom path
|
|
47
|
-
\`\`\`
|
|
48
|
-
|
|
49
|
-
### Wait for Conditions
|
|
50
|
-
\`\`\`bash
|
|
51
|
-
ccjk browser wait 2000 # Wait 2 seconds
|
|
52
|
-
ccjk browser wait @e1 # Wait for element
|
|
53
|
-
ccjk browser wait --text "Success" # Wait for text
|
|
54
|
-
\`\`\`
|
|
55
|
-
|
|
56
|
-
## Common Workflows
|
|
57
|
-
|
|
58
|
-
### Login Flow
|
|
59
|
-
\`\`\`bash
|
|
60
|
-
ccjk browser open https://app.example.com/login
|
|
61
|
-
ccjk browser snapshot -i
|
|
62
|
-
ccjk browser fill @e1 "username"
|
|
63
|
-
ccjk browser fill @e2 "password"
|
|
64
|
-
ccjk browser click @e3
|
|
65
|
-
ccjk browser wait --text "Dashboard"
|
|
66
|
-
\`\`\`
|
|
67
|
-
|
|
68
|
-
### Form Submission
|
|
69
|
-
\`\`\`bash
|
|
70
|
-
ccjk browser open https://example.com/form
|
|
71
|
-
ccjk browser snapshot -i
|
|
72
|
-
ccjk browser fill @e1 "John Doe"
|
|
73
|
-
ccjk browser fill @e2 "john@example.com"
|
|
74
|
-
ccjk browser click @e3 # Submit button
|
|
75
|
-
ccjk browser wait --text "Thank you"
|
|
76
|
-
\`\`\`
|
|
77
|
-
|
|
78
|
-
### Web Scraping
|
|
79
|
-
\`\`\`bash
|
|
80
|
-
ccjk browser open https://example.com/products
|
|
81
|
-
ccjk browser snapshot --json > products.json
|
|
82
|
-
\`\`\`
|
|
83
|
-
|
|
84
|
-
## Session Management
|
|
85
|
-
|
|
86
|
-
### Parallel Sessions
|
|
87
|
-
\`\`\`bash
|
|
88
|
-
ccjk browser --session s1 open site-a.com
|
|
89
|
-
ccjk browser --session s2 open site-b.com
|
|
90
|
-
ccjk browser session list
|
|
91
|
-
\`\`\`
|
|
92
|
-
|
|
93
|
-
## Debug Mode
|
|
94
|
-
\`\`\`bash
|
|
95
|
-
ccjk browser open example.com --headed # Show browser window
|
|
96
|
-
\`\`\`
|
|
97
|
-
|
|
98
|
-
## Element References
|
|
99
|
-
|
|
100
|
-
The snapshot command returns elements with refs like \`@e1\`, \`@e2\`, etc.
|
|
101
|
-
Use these refs to interact with specific elements:
|
|
102
|
-
|
|
103
|
-
- \`@e1\` - First interactive element
|
|
104
|
-
- \`@e2\` - Second interactive element
|
|
105
|
-
- etc.
|
|
106
|
-
|
|
107
|
-
## Tips for AI Agents
|
|
108
|
-
|
|
109
|
-
1. Always run \`snapshot -i\` first to get interactive elements
|
|
110
|
-
2. Use refs from snapshot output for interactions
|
|
111
|
-
3. Wait for page loads with \`wait --text\` or \`wait @ref\`
|
|
112
|
-
4. Use \`--json\` for programmatic parsing
|
|
113
|
-
5. Close browser when done to free resources
|
|
114
|
-
`
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export { browserSkill };
|