ccjk 12.0.0 → 12.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/agent-teams.mjs +17 -18
- package/dist/chunks/agent.mjs +105 -102
- package/dist/chunks/agents.mjs +87 -77
- package/dist/chunks/api-cli.mjs +41 -27
- package/dist/chunks/api-providers.mjs +2 -4
- package/dist/chunks/api.mjs +22 -11
- package/dist/chunks/auto-bootstrap.mjs +3 -5
- package/dist/chunks/auto-init.mjs +3 -4
- package/dist/chunks/auto-updater.mjs +103 -91
- package/dist/chunks/banner.mjs +41 -42
- package/dist/chunks/boost.mjs +30 -31
- package/dist/chunks/ccjk-agents.mjs +6 -9
- package/dist/chunks/ccjk-all.mjs +703 -85
- package/dist/chunks/ccjk-config.mjs +6 -6
- package/dist/chunks/ccjk-hooks.mjs +20 -9
- package/dist/chunks/ccjk-mcp.mjs +64 -52
- package/dist/chunks/ccjk-setup.mjs +35 -25
- package/dist/chunks/ccjk-skills.mjs +51 -41
- package/dist/chunks/ccr.mjs +42 -32
- package/dist/chunks/ccu.mjs +16 -12
- package/dist/chunks/check-updates.mjs +30 -19
- package/dist/chunks/claude-code-config-manager.mjs +25 -10
- package/dist/chunks/claude-code-incremental-manager.mjs +65 -51
- package/dist/chunks/claude-config.mjs +2 -2
- package/dist/chunks/claude-wrapper.mjs +9 -6
- package/dist/chunks/cleanup-migration.mjs +1 -1
- package/dist/chunks/cli-hook.mjs +10 -3
- package/dist/chunks/cloud-sync.mjs +1 -1
- package/dist/chunks/codex-config-switch.mjs +58 -45
- package/dist/chunks/codex-provider-manager.mjs +29 -16
- package/dist/chunks/codex-uninstaller.mjs +5 -6
- package/dist/chunks/codex.mjs +89 -89
- package/dist/chunks/commands.mjs +28 -29
- package/dist/chunks/commands2.mjs +4 -3
- package/dist/chunks/commit.mjs +42 -23
- package/dist/chunks/completion.mjs +46 -47
- package/dist/chunks/config-consolidator.mjs +12 -13
- package/dist/chunks/config-switch.mjs +66 -53
- package/dist/chunks/config.mjs +10 -10
- package/dist/chunks/config2.mjs +53 -42
- package/dist/chunks/config3.mjs +107 -93
- package/dist/chunks/constants.mjs +2 -4
- package/dist/chunks/context-loader.mjs +5 -4
- package/dist/chunks/context.mjs +77 -76
- package/dist/chunks/convoy-manager.mjs +4 -4
- package/dist/chunks/dashboard.mjs +28 -29
- package/dist/chunks/doctor.mjs +68 -54
- package/dist/chunks/evolution.mjs +37 -38
- package/dist/chunks/features.mjs +103 -92
- package/dist/chunks/fs-operations.mjs +1 -1
- package/dist/chunks/health-alerts.mjs +1 -1
- package/dist/chunks/health-check.mjs +1 -1
- package/dist/chunks/help.mjs +117 -116
- package/dist/chunks/hook-installer.mjs +3 -2
- package/dist/chunks/index.mjs +20 -6
- package/dist/chunks/index10.mjs +1171 -0
- package/dist/chunks/index11.mjs +1008 -0
- package/dist/chunks/index12.mjs +193 -0
- package/dist/chunks/index13.mjs +218 -0
- package/dist/chunks/index14.mjs +663 -0
- package/dist/chunks/index2.mjs +19 -10
- package/dist/chunks/index3.mjs +19079 -164
- package/dist/chunks/index4.mjs +8 -1171
- package/dist/chunks/index5.mjs +7479 -884
- package/dist/chunks/index6.mjs +160 -184
- package/dist/chunks/index7.mjs +3573 -653
- package/dist/chunks/index8.mjs +19 -0
- package/dist/chunks/index9.mjs +616 -0
- package/dist/chunks/init.mjs +173 -173
- package/dist/chunks/installer.mjs +92 -82
- package/dist/chunks/installer2.mjs +3 -2
- package/dist/chunks/interview.mjs +118 -107
- package/dist/chunks/json-config.mjs +3 -2
- package/dist/chunks/linux.mjs +3863 -0
- package/dist/chunks/macos.mjs +69 -0
- package/dist/chunks/main.mjs +635 -0
- package/dist/chunks/marketplace.mjs +69 -66
- package/dist/chunks/mcp-cli.mjs +61 -48
- package/dist/chunks/mcp.mjs +140 -127
- package/dist/chunks/menu.mjs +85 -85
- package/dist/chunks/metrics-display.mjs +41 -40
- package/dist/chunks/migrator.mjs +4 -5
- package/dist/chunks/monitor.mjs +95 -95
- package/dist/chunks/notification.mjs +151 -141
- package/dist/chunks/onboarding.mjs +26 -15
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/paradigm.mjs +24 -23
- package/dist/chunks/permission-manager.mjs +10 -11
- package/dist/chunks/permissions.mjs +72 -57
- package/dist/chunks/persistence-manager.mjs +97 -84
- package/dist/chunks/persistence.mjs +1 -1
- package/dist/chunks/platform.mjs +29 -29
- package/dist/chunks/plugin.mjs +104 -105
- package/dist/chunks/prompts.mjs +36 -25
- package/dist/chunks/providers.mjs +68 -69
- package/dist/chunks/quick-actions.mjs +71 -72
- package/dist/chunks/quick-provider.mjs +56 -40
- package/dist/chunks/quick-setup.mjs +71 -60
- package/dist/chunks/remote.mjs +21 -12
- package/dist/chunks/session.mjs +116 -103
- package/dist/chunks/sessions.mjs +29 -28
- package/dist/chunks/silent-updater.mjs +8 -10
- package/dist/chunks/simple-config.mjs +13 -10
- package/dist/chunks/skill.mjs +8560 -103
- package/dist/chunks/skills-sync.mjs +5212 -79
- package/dist/chunks/skills.mjs +105 -94
- package/dist/chunks/slash-commands.mjs +36 -37
- package/dist/chunks/smart-defaults.mjs +7 -3
- package/dist/chunks/smart-guide.mjs +1 -1
- package/dist/chunks/startup.mjs +2 -4
- package/dist/chunks/stats.mjs +41 -42
- package/dist/chunks/status.mjs +49 -50
- package/dist/chunks/team.mjs +24 -12
- package/dist/chunks/thinking.mjs +74 -63
- package/dist/chunks/trace.mjs +20 -19
- package/dist/chunks/uninstall.mjs +69 -56
- package/dist/chunks/update.mjs +39 -28
- package/dist/chunks/upgrade-manager.mjs +24 -18
- package/dist/chunks/version-checker.mjs +45 -41
- package/dist/chunks/vim.mjs +81 -69
- package/dist/chunks/windows.mjs +14 -0
- package/dist/chunks/workflows.mjs +15 -15
- package/dist/chunks/wsl.mjs +129 -0
- package/dist/chunks/zero-config.mjs +45 -34
- package/dist/cli.mjs +20 -20
- package/dist/index.mjs +41 -31
- package/dist/shared/ccjk.BAGoDD49.mjs +36 -0
- package/dist/shared/ccjk.BBtCGd_g.mjs +899 -0
- package/dist/shared/{ccjk.CGcy7cNM.mjs → ccjk.BDKUdmLk.mjs} +1 -1
- package/dist/shared/{ccjk.DtMBiwVG.mjs → ccjk.BFxsJM0k.mjs} +1 -1
- package/dist/shared/{ccjk.j4uut26D.mjs → ccjk.BIxuVL3_.mjs} +5 -5
- package/dist/shared/ccjk.BRZ9ww8S.mjs +142 -0
- package/dist/shared/{ccjk.CN0edl87.mjs → ccjk.BSYWk9ML.mjs} +1 -1
- package/dist/shared/{ccjk.Dk1HDseQ.mjs → ccjk.BnpWvs9V.mjs} +75 -75
- package/dist/shared/ccjk.BoApaI4j.mjs +28 -0
- package/dist/shared/{ccjk.DKojSRzw.mjs → ccjk.BrPUmTqm.mjs} +1 -1
- package/dist/shared/{ccjk.C10pepYx.mjs → ccjk.BxSmJ8B7.mjs} +1 -1
- package/dist/shared/ccjk.Bx_rmYfN.mjs +69 -0
- package/dist/shared/ccjk.COweQ1RR.mjs +5 -0
- package/dist/shared/{ccjk.BN90X6oc.mjs → ccjk.CePkJq2S.mjs} +17 -17
- package/dist/shared/{ccjk.Bvoex4TZ.mjs → ccjk.CfKKcvWy.mjs} +1 -1
- package/dist/shared/ccjk.Cjgrln_h.mjs +297 -0
- package/dist/shared/ccjk.CxpGa6MC.mjs +2724 -0
- package/dist/shared/{ccjk.DfwJOEok.mjs → ccjk.D5MFQT7w.mjs} +1 -1
- package/dist/shared/{ccjk.cChAaGgT.mjs → ccjk.DG_o24cZ.mjs} +6 -6
- package/dist/shared/{ccjk.bhFAMRyc.mjs → ccjk.DLLw-h4Y.mjs} +32 -32
- package/dist/shared/ccjk.DOwtZMk8.mjs +4019 -0
- package/dist/shared/{ccjk.BsXQugfY.mjs → ccjk.DTdjs-qK.mjs} +13 -13
- package/dist/shared/{ccjk.Bdhyg3X-.mjs → ccjk.DsYaCCx4.mjs} +1 -1
- package/dist/shared/ccjk.KfSWcGlE.mjs +38 -0
- package/dist/shared/ccjk.RyizuzOI.mjs +21 -0
- package/dist/shared/{ccjk.h7_W-wTs.mjs → ccjk.SPoXMvZD.mjs} +1 -1
- package/dist/shared/ccjk.T_cX87dY.mjs +15 -0
- package/dist/shared/{ccjk.CrB6OYHv.mjs → ccjk._dESH4Rk.mjs} +2 -2
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +249 -0
- package/dist/shared/{ccjk.CBhIZiPz.mjs → ccjk.hoqrwWdN.mjs} +1 -1
- package/dist/shared/{ccjk.BNwRnWYx.mjs → ccjk.s7OCVzdd.mjs} +1230 -33
- package/dist/shared/{ccjk.BOIUTf5z.mjs → ccjk.waa2ikKJ.mjs} +8 -9
- package/package.json +31 -30
- package/dist/shared/ccjk.DHbrGcgg.mjs +0 -13
- package/dist/shared/ccjk.DntgA8fQ.mjs +0 -42
package/dist/chunks/context.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from './index2.mjs';
|
|
2
2
|
import { contextLoader } from './context-loader.mjs';
|
|
3
|
+
import '../shared/ccjk.BAGoDD49.mjs';
|
|
3
4
|
import 'node:fs';
|
|
4
|
-
import 'pathe';
|
|
5
5
|
import 'tinyglobby';
|
|
6
|
-
import '../shared/ccjk.
|
|
7
|
-
import '../shared/ccjk.
|
|
6
|
+
import '../shared/ccjk.CePkJq2S.mjs';
|
|
7
|
+
import '../shared/ccjk.BxSmJ8B7.mjs';
|
|
8
|
+
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
8
9
|
|
|
9
10
|
async function contextCommand(options = {}) {
|
|
10
11
|
if (options.health) {
|
|
@@ -37,7 +38,7 @@ async function contextCommand(options = {}) {
|
|
|
37
38
|
}
|
|
38
39
|
if (options.clear) {
|
|
39
40
|
contextLoader.clearCache();
|
|
40
|
-
console.log(
|
|
41
|
+
console.log(a.green("\n\u2705 Context cache cleared\n"));
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
if (options.show) {
|
|
@@ -65,56 +66,56 @@ async function contextCommand(options = {}) {
|
|
|
65
66
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
|
-
console.log(
|
|
69
|
+
console.log(a.cyan.bold("\n\u{1F50D} Loading Context...\n"));
|
|
69
70
|
const context = await contextLoader.load({
|
|
70
71
|
projectRoot: process.cwd(),
|
|
71
72
|
layers,
|
|
72
73
|
task
|
|
73
74
|
});
|
|
74
|
-
console.log(
|
|
75
|
-
console.log(
|
|
75
|
+
console.log(a.white(`Total Size: ${formatBytes(context.totalSize)}`));
|
|
76
|
+
console.log(a.white(`Layers: ${context.layers.size}`));
|
|
76
77
|
console.log();
|
|
77
78
|
for (const [layer, entries] of context.layers) {
|
|
78
|
-
console.log(
|
|
79
|
-
console.log(
|
|
79
|
+
console.log(a.cyan.bold(`\u{1F4C1} ${layer.toUpperCase()}`));
|
|
80
|
+
console.log(a.gray(` ${entries.length} entries`));
|
|
80
81
|
for (const entry of entries) {
|
|
81
82
|
const size = formatBytes(entry.content.length);
|
|
82
|
-
console.log(
|
|
83
|
+
console.log(a.white(` \u2022 ${entry.source} (${size})`));
|
|
83
84
|
}
|
|
84
85
|
console.log();
|
|
85
86
|
}
|
|
86
87
|
if (context.totalSize < 1e4) {
|
|
87
|
-
console.log(
|
|
88
|
-
console.log(
|
|
88
|
+
console.log(a.cyan.bold("\u{1F4C4} Formatted Context:\n"));
|
|
89
|
+
console.log(a.gray("\u2500".repeat(60)));
|
|
89
90
|
console.log(contextLoader.formatForLLM(context));
|
|
90
|
-
console.log(
|
|
91
|
+
console.log(a.gray("\u2500".repeat(60)));
|
|
91
92
|
console.log();
|
|
92
93
|
} else {
|
|
93
|
-
console.log(
|
|
94
|
+
console.log(a.yellow("\u26A0\uFE0F Context too large to display (use --layers to filter)\n"));
|
|
94
95
|
}
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
|
-
console.log(
|
|
98
|
-
console.log(
|
|
99
|
-
console.log(
|
|
100
|
-
console.log(
|
|
101
|
-
console.log(
|
|
102
|
-
console.log(
|
|
98
|
+
console.log(a.cyan.bold("\n\u{1F50D} Context Management\n"));
|
|
99
|
+
console.log(a.white("Context Loading:"));
|
|
100
|
+
console.log(a.gray(" ccjk context --show # Show all context layers"));
|
|
101
|
+
console.log(a.gray(" ccjk context --show --layers project # Show specific layers"));
|
|
102
|
+
console.log(a.gray(' ccjk context --show --task "api work" # Preview context for task'));
|
|
103
|
+
console.log(a.gray(" ccjk context --clear # Clear context cache"));
|
|
103
104
|
console.log();
|
|
104
|
-
console.log(
|
|
105
|
-
console.log(
|
|
106
|
-
console.log(
|
|
107
|
-
console.log(
|
|
108
|
-
console.log(
|
|
109
|
-
console.log(
|
|
110
|
-
console.log(
|
|
111
|
-
console.log(
|
|
105
|
+
console.log(a.white("Database Health:"));
|
|
106
|
+
console.log(a.gray(" ccjk context --health # Run health check"));
|
|
107
|
+
console.log(a.gray(" ccjk context --alerts # Show current alerts"));
|
|
108
|
+
console.log(a.gray(" ccjk context --alert-history # Show alert history"));
|
|
109
|
+
console.log(a.gray(" ccjk context --checkpoint # Checkpoint WAL file"));
|
|
110
|
+
console.log(a.gray(" ccjk context --vacuum # Vacuum database"));
|
|
111
|
+
console.log(a.gray(" ccjk context --backup # Create backup"));
|
|
112
|
+
console.log(a.gray(" ccjk context --recover # Attempt recovery"));
|
|
112
113
|
console.log();
|
|
113
|
-
console.log(
|
|
114
|
-
console.log(
|
|
115
|
-
console.log(
|
|
116
|
-
console.log(
|
|
117
|
-
console.log(
|
|
114
|
+
console.log(a.white("Available Layers:"));
|
|
115
|
+
console.log(a.gray(" \u2022 project - README, CLAUDE.md, package.json, tsconfig.json"));
|
|
116
|
+
console.log(a.gray(" \u2022 domain - Domain-specific files (api, ui, database, etc.)"));
|
|
117
|
+
console.log(a.gray(" \u2022 task - Task description and input"));
|
|
118
|
+
console.log(a.gray(" \u2022 execution - Previous outputs and errors"));
|
|
118
119
|
console.log();
|
|
119
120
|
}
|
|
120
121
|
function formatBytes(bytes) {
|
|
@@ -137,50 +138,50 @@ async function runHealthCheck() {
|
|
|
137
138
|
const dbPath = getDbPath();
|
|
138
139
|
const { existsSync } = await import('node:fs');
|
|
139
140
|
if (!existsSync(dbPath)) {
|
|
140
|
-
console.log(
|
|
141
|
+
console.log(a.yellow("\n\u26A0\uFE0F Database not found. No health check needed.\n"));
|
|
141
142
|
return;
|
|
142
143
|
}
|
|
143
|
-
console.log(
|
|
144
|
+
console.log(a.cyan.bold("\n\u{1F3E5} Running Database Health Check...\n"));
|
|
144
145
|
const monitor = new DatabaseHealthMonitor(dbPath);
|
|
145
146
|
try {
|
|
146
147
|
const health = await monitor.runHealthCheck();
|
|
147
148
|
const statusEmoji = health.status === "healthy" ? "\u2705" : health.status === "warning" ? "\u26A0\uFE0F" : "\u{1F534}";
|
|
148
|
-
console.log(
|
|
149
|
+
console.log(a.bold(`${statusEmoji} Status: ${health.status.toUpperCase()}`));
|
|
149
150
|
console.log();
|
|
150
|
-
console.log(
|
|
151
|
+
console.log(a.cyan("Integrity Check:"));
|
|
151
152
|
console.log(` ${health.checks.integrity.passed ? "\u2705" : "\u274C"} ${health.checks.integrity.passed ? "Passed" : "Failed"} (${health.checks.integrity.duration}ms)`);
|
|
152
153
|
if (health.checks.integrity.errors.length > 0) {
|
|
153
154
|
for (const error of health.checks.integrity.errors) {
|
|
154
|
-
console.log(
|
|
155
|
+
console.log(a.red(` \u2022 ${error}`));
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
console.log();
|
|
158
|
-
console.log(
|
|
159
|
+
console.log(a.cyan("WAL Status:"));
|
|
159
160
|
console.log(` Mode: ${health.checks.wal.mode}`);
|
|
160
161
|
console.log(` Size: ${formatBytes(health.checks.wal.walSize)}`);
|
|
161
162
|
console.log(` Checkpointable: ${health.checks.wal.checkpointable ? "Yes" : "No"}`);
|
|
162
163
|
console.log();
|
|
163
|
-
console.log(
|
|
164
|
+
console.log(a.cyan("Database Size:"));
|
|
164
165
|
console.log(` DB: ${formatBytes(health.checks.size.dbSize)}`);
|
|
165
166
|
console.log(` WAL: ${formatBytes(health.checks.size.walSize)}`);
|
|
166
167
|
console.log(` Total: ${formatBytes(health.checks.size.totalSize)}`);
|
|
167
168
|
console.log(` Utilization: ${health.checks.size.utilizationPercent.toFixed(1)}%`);
|
|
168
169
|
console.log();
|
|
169
|
-
console.log(
|
|
170
|
+
console.log(a.cyan("Performance:"));
|
|
170
171
|
console.log(` Query Time: ${health.checks.performance.queryTime}ms`);
|
|
171
172
|
console.log(` Write Time: ${health.checks.performance.writeTime}ms`);
|
|
172
173
|
console.log();
|
|
173
174
|
if (health.recommendations.length > 0) {
|
|
174
|
-
console.log(
|
|
175
|
+
console.log(a.yellow.bold("\u{1F4A1} Recommendations:"));
|
|
175
176
|
for (const rec of health.recommendations) {
|
|
176
|
-
console.log(
|
|
177
|
+
console.log(a.yellow(` \u2022 ${rec}`));
|
|
177
178
|
}
|
|
178
179
|
console.log();
|
|
179
180
|
}
|
|
180
181
|
if (health.errors.length > 0) {
|
|
181
|
-
console.log(
|
|
182
|
+
console.log(a.red.bold("\u{1F534} Errors:"));
|
|
182
183
|
for (const error of health.errors) {
|
|
183
|
-
console.log(
|
|
184
|
+
console.log(a.red(` \u2022 ${error}`));
|
|
184
185
|
}
|
|
185
186
|
console.log();
|
|
186
187
|
}
|
|
@@ -193,14 +194,14 @@ async function showAlerts() {
|
|
|
193
194
|
const dbPath = getDbPath();
|
|
194
195
|
const { existsSync } = await import('node:fs');
|
|
195
196
|
if (!existsSync(dbPath)) {
|
|
196
|
-
console.log(
|
|
197
|
+
console.log(a.yellow("\n\u26A0\uFE0F Database not found. No alerts.\n"));
|
|
197
198
|
return;
|
|
198
199
|
}
|
|
199
200
|
const manager = new HealthAlertsManager(dbPath);
|
|
200
201
|
try {
|
|
201
202
|
const alerts = await manager.checkHealth();
|
|
202
203
|
if (alerts.length === 0) {
|
|
203
|
-
console.log(
|
|
204
|
+
console.log(a.green("\n\u2705 No alerts. Database is healthy.\n"));
|
|
204
205
|
return;
|
|
205
206
|
}
|
|
206
207
|
manager.displayAlerts(alerts);
|
|
@@ -215,30 +216,30 @@ async function showAlertHistory() {
|
|
|
215
216
|
try {
|
|
216
217
|
const history = await manager.getHistory(20);
|
|
217
218
|
if (history.length === 0) {
|
|
218
|
-
console.log(
|
|
219
|
+
console.log(a.yellow("\n\u26A0\uFE0F No alert history found.\n"));
|
|
219
220
|
return;
|
|
220
221
|
}
|
|
221
|
-
console.log(
|
|
222
|
+
console.log(a.cyan.bold("\n\u{1F4CB} Alert History\n"));
|
|
222
223
|
for (const entry of history) {
|
|
223
224
|
const date = new Date(entry.timestamp).toLocaleString();
|
|
224
225
|
const statusEmoji = entry.healthStatus === "healthy" ? "\u2705" : entry.healthStatus === "warning" ? "\u26A0\uFE0F" : "\u{1F534}";
|
|
225
|
-
const resolvedBadge = entry.resolved ?
|
|
226
|
+
const resolvedBadge = entry.resolved ? a.green("[Resolved]") : a.red("[Unresolved]");
|
|
226
227
|
console.log(`${statusEmoji} ${date} ${resolvedBadge}`);
|
|
227
|
-
console.log(
|
|
228
|
-
console.log(
|
|
228
|
+
console.log(a.gray(` Status: ${entry.healthStatus}`));
|
|
229
|
+
console.log(a.gray(` Alerts: ${entry.alerts.length}`));
|
|
229
230
|
if (entry.alerts.length > 0) {
|
|
230
231
|
for (const alert of entry.alerts.slice(0, 3)) {
|
|
231
232
|
const emoji = alert.severity === "critical" ? "\u{1F534}" : alert.severity === "warning" ? "\u{1F7E1}" : "\u{1F4A1}";
|
|
232
|
-
console.log(
|
|
233
|
+
console.log(a.gray(` ${emoji} ${alert.message}`));
|
|
233
234
|
}
|
|
234
235
|
if (entry.alerts.length > 3) {
|
|
235
|
-
console.log(
|
|
236
|
+
console.log(a.gray(` ... and ${entry.alerts.length - 3} more`));
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
console.log();
|
|
239
240
|
}
|
|
240
241
|
const summary = await manager.getSummary();
|
|
241
|
-
console.log(
|
|
242
|
+
console.log(a.cyan.bold("\u{1F4CA} Summary"));
|
|
242
243
|
console.log(` Total Alerts: ${summary.totalAlerts}`);
|
|
243
244
|
console.log(` Critical: ${summary.criticalCount}`);
|
|
244
245
|
console.log(` Warnings: ${summary.warningCount}`);
|
|
@@ -254,20 +255,20 @@ async function checkpointWAL() {
|
|
|
254
255
|
const dbPath = getDbPath();
|
|
255
256
|
const { existsSync } = await import('node:fs');
|
|
256
257
|
if (!existsSync(dbPath)) {
|
|
257
|
-
console.log(
|
|
258
|
+
console.log(a.yellow("\n\u26A0\uFE0F Database not found.\n"));
|
|
258
259
|
return;
|
|
259
260
|
}
|
|
260
|
-
console.log(
|
|
261
|
+
console.log(a.cyan("\n\u{1F504} Checkpointing WAL file...\n"));
|
|
261
262
|
const monitor = new DatabaseHealthMonitor(dbPath);
|
|
262
263
|
try {
|
|
263
264
|
const result = await monitor.checkpoint("RESTART");
|
|
264
265
|
if (result.success) {
|
|
265
|
-
console.log(
|
|
266
|
+
console.log(a.green(`\u2705 Checkpoint successful`));
|
|
266
267
|
console.log(` WAL frames: ${result.walFrames}`);
|
|
267
268
|
console.log(` Checkpointed: ${result.checkpointed}
|
|
268
269
|
`);
|
|
269
270
|
} else {
|
|
270
|
-
console.log(
|
|
271
|
+
console.log(a.red(`\u274C Checkpoint failed: ${result.error}
|
|
271
272
|
`));
|
|
272
273
|
}
|
|
273
274
|
} finally {
|
|
@@ -279,10 +280,10 @@ async function vacuumDatabase() {
|
|
|
279
280
|
const dbPath = getDbPath();
|
|
280
281
|
const { existsSync } = await import('node:fs');
|
|
281
282
|
if (!existsSync(dbPath)) {
|
|
282
|
-
console.log(
|
|
283
|
+
console.log(a.yellow("\n\u26A0\uFE0F Database not found.\n"));
|
|
283
284
|
return;
|
|
284
285
|
}
|
|
285
|
-
console.log(
|
|
286
|
+
console.log(a.cyan("\n\u{1F9F9} Running VACUUM...\n"));
|
|
286
287
|
const monitor = new DatabaseHealthMonitor(dbPath);
|
|
287
288
|
try {
|
|
288
289
|
const sizeBefore = await monitor.checkSize();
|
|
@@ -292,13 +293,13 @@ async function vacuumDatabase() {
|
|
|
292
293
|
const sizeAfter = await monitor.checkSize();
|
|
293
294
|
const afterSize = sizeAfter.totalSize;
|
|
294
295
|
const saved = beforeSize - afterSize;
|
|
295
|
-
console.log(
|
|
296
|
+
console.log(a.green("\u2705 VACUUM completed"));
|
|
296
297
|
console.log(` Before: ${formatBytes(beforeSize)}`);
|
|
297
298
|
console.log(` After: ${formatBytes(afterSize)}`);
|
|
298
299
|
console.log(` Saved: ${formatBytes(saved)}
|
|
299
300
|
`);
|
|
300
301
|
} catch (error) {
|
|
301
|
-
console.log(
|
|
302
|
+
console.log(a.red(`\u274C VACUUM failed: ${error instanceof Error ? error.message : String(error)}
|
|
302
303
|
`));
|
|
303
304
|
} finally {
|
|
304
305
|
monitor.close();
|
|
@@ -309,15 +310,15 @@ async function backupDatabase() {
|
|
|
309
310
|
const dbPath = getDbPath();
|
|
310
311
|
const { existsSync } = await import('node:fs');
|
|
311
312
|
if (!existsSync(dbPath)) {
|
|
312
|
-
console.log(
|
|
313
|
+
console.log(a.yellow("\n\u26A0\uFE0F Database not found.\n"));
|
|
313
314
|
return;
|
|
314
315
|
}
|
|
315
|
-
console.log(
|
|
316
|
+
console.log(a.cyan("\n\u{1F4BE} Creating backup...\n"));
|
|
316
317
|
const monitor = new DatabaseHealthMonitor(dbPath);
|
|
317
318
|
try {
|
|
318
319
|
const result = await monitor.backup("manual");
|
|
319
320
|
if (result.success) {
|
|
320
|
-
console.log(
|
|
321
|
+
console.log(a.green("\u2705 Backup created successfully"));
|
|
321
322
|
console.log(` Path: ${result.backupPath}`);
|
|
322
323
|
console.log(` Size: ${formatBytes(result.metadata.dbSize)}`);
|
|
323
324
|
console.log(` Contexts: ${result.metadata.contextCount}`);
|
|
@@ -325,7 +326,7 @@ async function backupDatabase() {
|
|
|
325
326
|
console.log(` Duration: ${result.duration}ms
|
|
326
327
|
`);
|
|
327
328
|
} else {
|
|
328
|
-
console.log(
|
|
329
|
+
console.log(a.red(`\u274C Backup failed: ${result.error}
|
|
329
330
|
`));
|
|
330
331
|
}
|
|
331
332
|
} finally {
|
|
@@ -337,29 +338,29 @@ async function recoverDatabase() {
|
|
|
337
338
|
const dbPath = getDbPath();
|
|
338
339
|
const { existsSync } = await import('node:fs');
|
|
339
340
|
if (!existsSync(dbPath)) {
|
|
340
|
-
console.log(
|
|
341
|
+
console.log(a.yellow("\n\u26A0\uFE0F Database not found.\n"));
|
|
341
342
|
return;
|
|
342
343
|
}
|
|
343
|
-
console.log(
|
|
344
|
+
console.log(a.cyan("\n\u{1F527} Attempting database recovery...\n"));
|
|
344
345
|
const monitor = new DatabaseHealthMonitor(dbPath);
|
|
345
346
|
try {
|
|
346
347
|
const result = await monitor.attemptRecovery();
|
|
347
348
|
if (result.success) {
|
|
348
|
-
console.log(
|
|
349
|
+
console.log(a.green("\u2705 Recovery successful\n"));
|
|
349
350
|
} else {
|
|
350
|
-
console.log(
|
|
351
|
+
console.log(a.red("\u274C Recovery failed\n"));
|
|
351
352
|
}
|
|
352
353
|
if (result.actions.length > 0) {
|
|
353
|
-
console.log(
|
|
354
|
+
console.log(a.cyan("Actions Taken:"));
|
|
354
355
|
for (const action of result.actions) {
|
|
355
|
-
console.log(
|
|
356
|
+
console.log(a.white(` \u2022 ${action}`));
|
|
356
357
|
}
|
|
357
358
|
console.log();
|
|
358
359
|
}
|
|
359
360
|
if (result.errors.length > 0) {
|
|
360
|
-
console.log(
|
|
361
|
+
console.log(a.red("Errors:"));
|
|
361
362
|
for (const error of result.errors) {
|
|
362
|
-
console.log(
|
|
363
|
+
console.log(a.red(` \u2022 ${error}`));
|
|
363
364
|
}
|
|
364
365
|
console.log();
|
|
365
366
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import { nanoid } from '
|
|
2
|
+
import { n as nanoid } from '../shared/ccjk.BoApaI4j.mjs';
|
|
3
3
|
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'node:fs';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { x as K } from './main.mjs';
|
|
6
|
+
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
7
7
|
|
|
8
8
|
class GitBackedStateManager extends EventEmitter {
|
|
9
9
|
config;
|
|
@@ -433,7 +433,7 @@ Thumbs.db
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
async exec(cmd, args, cwd) {
|
|
436
|
-
const result = await
|
|
436
|
+
const result = await K(cmd, args, { nodeOptions: { cwd } });
|
|
437
437
|
return {
|
|
438
438
|
stdout: result.stdout,
|
|
439
439
|
stderr: result.stderr
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { existsSync, statSync } from 'node:fs';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import process__default from 'node:process';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import a from './index2.mjs';
|
|
5
|
+
import { i18n } from './index5.mjs';
|
|
6
|
+
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
7
|
+
import '../shared/ccjk.BAGoDD49.mjs';
|
|
7
8
|
import 'node:url';
|
|
8
|
-
import 'i18next';
|
|
9
|
-
import 'i18next-fs-backend';
|
|
10
9
|
|
|
11
10
|
const DB_PATH = join(homedir(), ".ccjk", "context", "contexts.db");
|
|
12
11
|
const WAL_PATH = `${DB_PATH}-wal`;
|
|
@@ -16,16 +15,16 @@ const WAL_SIZE_CRITICAL = 50 * 1024 * 1024;
|
|
|
16
15
|
const DB_SIZE_WARNING = 100 * 1024 * 1024;
|
|
17
16
|
const DB_SIZE_CRITICAL = 500 * 1024 * 1024;
|
|
18
17
|
function label(text) {
|
|
19
|
-
return
|
|
18
|
+
return a.gray(text);
|
|
20
19
|
}
|
|
21
20
|
function val(text) {
|
|
22
|
-
return
|
|
21
|
+
return a.white(text);
|
|
23
22
|
}
|
|
24
23
|
function heading(text) {
|
|
25
|
-
return
|
|
24
|
+
return a.cyan.bold(text);
|
|
26
25
|
}
|
|
27
26
|
function divider() {
|
|
28
|
-
return
|
|
27
|
+
return a.gray("\u2500".repeat(50));
|
|
29
28
|
}
|
|
30
29
|
function formatBytes(bytes) {
|
|
31
30
|
if (bytes === 0) return "0 B";
|
|
@@ -53,11 +52,11 @@ function formatDate(timestamp) {
|
|
|
53
52
|
function statusIcon(status) {
|
|
54
53
|
switch (status) {
|
|
55
54
|
case "green":
|
|
56
|
-
return
|
|
55
|
+
return a.green("\u25CF");
|
|
57
56
|
case "yellow":
|
|
58
|
-
return
|
|
57
|
+
return a.yellow("\u25CF");
|
|
59
58
|
case "red":
|
|
60
|
-
return
|
|
59
|
+
return a.red("\u25CF");
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
async function collectDashboardData() {
|
|
@@ -255,12 +254,12 @@ function renderCompressionSection(data) {
|
|
|
255
254
|
lines.push(heading(isZh ? "\u{1F4CA} \u538B\u7F29\u6307\u6807" : "\u{1F4CA} Compression Metrics"));
|
|
256
255
|
lines.push("");
|
|
257
256
|
if (data.persistence.totalContexts === 0) {
|
|
258
|
-
lines.push(` ${
|
|
257
|
+
lines.push(` ${a.gray(isZh ? "\u6682\u65E0\u538B\u7F29\u6570\u636E" : "No compression data yet")}`);
|
|
259
258
|
return lines;
|
|
260
259
|
}
|
|
261
|
-
lines.push(` ${label((isZh ? "\u4F1A\u8BDD\u8282\u7701:" : "Session savings:").padEnd(20))} ${val(formatNumber(data.compression.sessionSavings))} ${
|
|
262
|
-
lines.push(` ${label((isZh ? "\u672C\u5468\u8282\u7701:" : "Weekly savings:").padEnd(20))} ${val(formatNumber(data.compression.weeklySavings))} ${
|
|
263
|
-
lines.push(` ${label((isZh ? "\u672C\u6708\u8282\u7701:" : "Monthly savings:").padEnd(20))} ${val(formatNumber(data.compression.monthlySavings))} ${
|
|
260
|
+
lines.push(` ${label((isZh ? "\u4F1A\u8BDD\u8282\u7701:" : "Session savings:").padEnd(20))} ${val(formatNumber(data.compression.sessionSavings))} ${a.gray("tokens")}`);
|
|
261
|
+
lines.push(` ${label((isZh ? "\u672C\u5468\u8282\u7701:" : "Weekly savings:").padEnd(20))} ${val(formatNumber(data.compression.weeklySavings))} ${a.gray("tokens")}`);
|
|
262
|
+
lines.push(` ${label((isZh ? "\u672C\u6708\u8282\u7701:" : "Monthly savings:").padEnd(20))} ${val(formatNumber(data.compression.monthlySavings))} ${a.gray("tokens")}`);
|
|
264
263
|
lines.push(` ${label((isZh ? "\u538B\u7F29\u7387:" : "Compression ratio:").padEnd(20))} ${val(formatPercentage(data.compression.compressionRatio))}`);
|
|
265
264
|
return lines;
|
|
266
265
|
}
|
|
@@ -274,7 +273,7 @@ function renderPersistenceSection(data) {
|
|
|
274
273
|
if (data.persistence.lastBackup) {
|
|
275
274
|
lines.push(` ${label((isZh ? "\u6700\u540E\u5907\u4EFD:" : "Last backup:").padEnd(20))} ${val(formatDate(data.persistence.lastBackup))}`);
|
|
276
275
|
} else {
|
|
277
|
-
lines.push(` ${label((isZh ? "\u6700\u540E\u5907\u4EFD:" : "Last backup:").padEnd(20))} ${
|
|
276
|
+
lines.push(` ${label((isZh ? "\u6700\u540E\u5907\u4EFD:" : "Last backup:").padEnd(20))} ${a.gray(isZh ? "\u4ECE\u672A\u5907\u4EFD" : "Never")}`);
|
|
278
277
|
}
|
|
279
278
|
return lines;
|
|
280
279
|
}
|
|
@@ -285,11 +284,11 @@ function renderHealthSection(data) {
|
|
|
285
284
|
lines.push("");
|
|
286
285
|
lines.push(` ${label((isZh ? "\u6570\u636E\u5E93\u5B8C\u6574\u6027:" : "Database integrity:").padEnd(20))} ${statusIcon(data.health.status)} ${val(data.health.message)}`);
|
|
287
286
|
for (const detail of data.health.details) {
|
|
288
|
-
lines.push(` ${
|
|
287
|
+
lines.push(` ${a.gray(detail)}`);
|
|
289
288
|
}
|
|
290
289
|
lines.push(` ${label((isZh ? "WAL \u72B6\u6001:" : "WAL status:").padEnd(20))} ${statusIcon(data.wal.needsCheckpoint ? "yellow" : "green")} ${val(data.wal.message)}`);
|
|
291
290
|
if (data.wal.size > 0) {
|
|
292
|
-
lines.push(` ${
|
|
291
|
+
lines.push(` ${a.gray(`${isZh ? "\u5927\u5C0F" : "Size"}: ${formatBytes(data.wal.size)}`)}`);
|
|
293
292
|
}
|
|
294
293
|
const diskStatus = data.persistence.databaseSize > DB_SIZE_WARNING ? "yellow" : "green";
|
|
295
294
|
lines.push(` ${label((isZh ? "\u78C1\u76D8\u4F7F\u7528:" : "Disk utilization:").padEnd(20))} ${statusIcon(diskStatus)} ${val(formatBytes(data.persistence.databaseSize))}`);
|
|
@@ -302,12 +301,12 @@ function renderTierSection(data) {
|
|
|
302
301
|
lines.push("");
|
|
303
302
|
const total = data.tiers.hot + data.tiers.warm + data.tiers.cold;
|
|
304
303
|
if (total === 0) {
|
|
305
|
-
lines.push(` ${
|
|
304
|
+
lines.push(` ${a.gray(isZh ? "\u6682\u65E0\u5C42\u7EA7\u6570\u636E" : "No tier data yet")}`);
|
|
306
305
|
return lines;
|
|
307
306
|
}
|
|
308
|
-
lines.push(` ${label((isZh ? "L0 (\u70ED):" : "L0 (Hot):").padEnd(20))} ${val(formatNumber(data.tiers.hot))} ${
|
|
309
|
-
lines.push(` ${label((isZh ? "L1 (\u6E29):" : "L1 (Warm):").padEnd(20))} ${val(formatNumber(data.tiers.warm))} ${
|
|
310
|
-
lines.push(` ${label((isZh ? "L2 (\u51B7):" : "L2 (Cold):").padEnd(20))} ${val(formatNumber(data.tiers.cold))} ${
|
|
307
|
+
lines.push(` ${label((isZh ? "L0 (\u70ED):" : "L0 (Hot):").padEnd(20))} ${val(formatNumber(data.tiers.hot))} ${a.gray(`(${formatPercentage(data.tiers.hot / total)})`)}`);
|
|
308
|
+
lines.push(` ${label((isZh ? "L1 (\u6E29):" : "L1 (Warm):").padEnd(20))} ${val(formatNumber(data.tiers.warm))} ${a.gray(`(${formatPercentage(data.tiers.warm / total)})`)}`);
|
|
309
|
+
lines.push(` ${label((isZh ? "L2 (\u51B7):" : "L2 (Cold):").padEnd(20))} ${val(formatNumber(data.tiers.cold))} ${a.gray(`(${formatPercentage(data.tiers.cold / total)})`)}`);
|
|
311
310
|
lines.push(` ${label((isZh ? "\u7F13\u5B58\u547D\u4E2D\u7387:" : "Cache hit rate:").padEnd(20))} ${val(formatPercentage(data.cacheHitRate))}`);
|
|
312
311
|
return lines;
|
|
313
312
|
}
|
|
@@ -318,14 +317,14 @@ function renderRecommendationsSection(data) {
|
|
|
318
317
|
return lines;
|
|
319
318
|
}
|
|
320
319
|
lines.push("");
|
|
321
|
-
lines.push(
|
|
320
|
+
lines.push(a.yellow.bold(isZh ? "\u{1F4A1} \u5EFA\u8BAE" : "\u{1F4A1} Recommendations"));
|
|
322
321
|
lines.push("");
|
|
323
322
|
for (const rec of data.recommendations) {
|
|
324
|
-
const priority = rec.priority === "high" ?
|
|
325
|
-
lines.push(` ${priority} ${
|
|
326
|
-
lines.push(` ${
|
|
323
|
+
const priority = rec.priority === "high" ? a.red("!") : rec.priority === "medium" ? a.yellow("\u2022") : a.gray("\xB7");
|
|
324
|
+
lines.push(` ${priority} ${a.bold(rec.title)}`);
|
|
325
|
+
lines.push(` ${a.gray(rec.description)}`);
|
|
327
326
|
if (rec.command) {
|
|
328
|
-
lines.push(` ${
|
|
327
|
+
lines.push(` ${a.gray("\u2192")} ${a.cyan(rec.command)}`);
|
|
329
328
|
}
|
|
330
329
|
}
|
|
331
330
|
return lines;
|
|
@@ -357,7 +356,7 @@ async function dashboardCommand(options = {}) {
|
|
|
357
356
|
}
|
|
358
357
|
console.log();
|
|
359
358
|
} catch (error) {
|
|
360
|
-
console.error(
|
|
359
|
+
console.error(a.red("Error running dashboard command:"), error);
|
|
361
360
|
process__default.exit(1);
|
|
362
361
|
}
|
|
363
362
|
}
|