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
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import inquirer from '
|
|
1
|
+
import a from './index2.mjs';
|
|
2
|
+
import { i as inquirer } from './index3.mjs';
|
|
3
3
|
import { writeFileSync } from 'node:fs';
|
|
4
|
-
import {
|
|
5
|
-
import { i18n } from './index3.mjs';
|
|
4
|
+
import { i18n } from './index5.mjs';
|
|
6
5
|
import { getContextPersistence } from './persistence.mjs';
|
|
6
|
+
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
7
|
+
import '../shared/ccjk.BAGoDD49.mjs';
|
|
8
|
+
import 'node:readline';
|
|
9
|
+
import 'stream';
|
|
10
|
+
import 'node:tty';
|
|
7
11
|
import 'node:process';
|
|
12
|
+
import 'node:async_hooks';
|
|
13
|
+
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
14
|
+
import 'node:util';
|
|
15
|
+
import 'tty';
|
|
16
|
+
import 'fs';
|
|
17
|
+
import 'child_process';
|
|
18
|
+
import 'node:path';
|
|
19
|
+
import 'node:os';
|
|
20
|
+
import 'node:crypto';
|
|
21
|
+
import 'buffer';
|
|
22
|
+
import 'string_decoder';
|
|
8
23
|
import 'node:url';
|
|
9
|
-
import 'i18next';
|
|
10
|
-
import 'i18next-fs-backend';
|
|
11
24
|
import 'better-sqlite3';
|
|
12
25
|
|
|
13
26
|
class L0Cache {
|
|
@@ -385,8 +398,8 @@ async function listContexts(projectHash) {
|
|
|
385
398
|
const isZh = i18n.language === "zh-CN";
|
|
386
399
|
const persistence = getContextPersistence();
|
|
387
400
|
console.log("");
|
|
388
|
-
console.log(
|
|
389
|
-
console.log(
|
|
401
|
+
console.log(a.bold.cyan(isZh ? "\u{1F4CB} \u5B58\u50A8\u7684\u4E0A\u4E0B\u6587\u5217\u8868" : "\u{1F4CB} Stored Contexts"));
|
|
402
|
+
console.log(a.dim("\u2500".repeat(80)));
|
|
390
403
|
const PAGE_SIZE = 20;
|
|
391
404
|
let offset = 0;
|
|
392
405
|
let showMore = true;
|
|
@@ -398,14 +411,14 @@ async function listContexts(projectHash) {
|
|
|
398
411
|
limit: PAGE_SIZE
|
|
399
412
|
});
|
|
400
413
|
if (contexts.length === 0) {
|
|
401
|
-
console.log(
|
|
414
|
+
console.log(a.yellow(isZh ? " \u6CA1\u6709\u627E\u5230\u4E0A\u4E0B\u6587" : " No contexts found"));
|
|
402
415
|
break;
|
|
403
416
|
}
|
|
404
417
|
const displayContexts = contexts.slice(offset, offset + PAGE_SIZE);
|
|
405
418
|
for (const ctx of displayContexts) {
|
|
406
419
|
const age = Date.now() - ctx.lastAccessed;
|
|
407
420
|
const ratio = (ctx.compressionRatio * 100).toFixed(1);
|
|
408
|
-
console.log(` ${
|
|
421
|
+
console.log(` ${a.green(ctx.id.substring(0, 8))}... ${a.dim("|")} ${a.cyan(ctx.algorithm)} ${a.dim("|")} ${ratio}% ${a.dim("|")} ${a.yellow(ctx.accessCount)} ${isZh ? "\u6B21\u8BBF\u95EE" : "accesses"} ${a.dim("|")} ${formatDuration(age)} ${isZh ? "\u524D" : "ago"}`);
|
|
409
422
|
}
|
|
410
423
|
if (offset + PAGE_SIZE < contexts.length) {
|
|
411
424
|
const { action } = await inquirer.prompt({
|
|
@@ -443,21 +456,21 @@ async function searchContexts() {
|
|
|
443
456
|
}
|
|
444
457
|
});
|
|
445
458
|
console.log("");
|
|
446
|
-
console.log(
|
|
447
|
-
console.log(
|
|
459
|
+
console.log(a.bold.cyan(isZh ? "\u{1F50D} \u641C\u7D22\u7ED3\u679C" : "\u{1F50D} Search Results"));
|
|
460
|
+
console.log(a.dim("\u2500".repeat(80)));
|
|
448
461
|
const results = persistence.searchContexts(query, {
|
|
449
462
|
sortBy: "relevance",
|
|
450
463
|
sortOrder: "desc",
|
|
451
464
|
limit: 50
|
|
452
465
|
});
|
|
453
466
|
if (results.length === 0) {
|
|
454
|
-
console.log(
|
|
467
|
+
console.log(a.yellow(isZh ? " \u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u4E0A\u4E0B\u6587" : " No matching contexts found"));
|
|
455
468
|
} else {
|
|
456
469
|
for (const result of results) {
|
|
457
470
|
const ratio = (result.compressionRatio * 100).toFixed(1);
|
|
458
|
-
console.log(` ${
|
|
471
|
+
console.log(` ${a.green(result.id.substring(0, 8))}... ${a.dim("|")} ${a.cyan(result.algorithm)} ${a.dim("|")} ${ratio}% ${a.dim("|")} ${a.magenta(`rank: ${result.rank.toFixed(2)}`)}`);
|
|
459
472
|
if (result.snippet) {
|
|
460
|
-
console.log(` ${
|
|
473
|
+
console.log(` ${a.dim(result.snippet.replace(/<mark>/g, a.yellow.open).replace(/<\/mark>/g, a.yellow.close))}`);
|
|
461
474
|
}
|
|
462
475
|
}
|
|
463
476
|
}
|
|
@@ -480,28 +493,28 @@ async function viewContextDetails() {
|
|
|
480
493
|
const allContexts = persistence.queryContexts({ limit: 1e4 });
|
|
481
494
|
const context = allContexts.find((c) => c.id.startsWith(contextId.trim()));
|
|
482
495
|
if (!context) {
|
|
483
|
-
console.log(
|
|
496
|
+
console.log(a.red(isZh ? " \u672A\u627E\u5230\u4E0A\u4E0B\u6587" : " Context not found"));
|
|
484
497
|
return;
|
|
485
498
|
}
|
|
486
499
|
console.log("");
|
|
487
|
-
console.log(
|
|
488
|
-
console.log(
|
|
489
|
-
console.log(` ${
|
|
490
|
-
console.log(` ${
|
|
491
|
-
console.log(` ${
|
|
492
|
-
console.log(` ${
|
|
493
|
-
console.log(` ${
|
|
494
|
-
console.log(` ${
|
|
495
|
-
console.log(` ${
|
|
496
|
-
console.log(` ${
|
|
497
|
-
console.log(` ${
|
|
498
|
-
console.log(` ${
|
|
500
|
+
console.log(a.bold.cyan(isZh ? "\u{1F4C4} \u4E0A\u4E0B\u6587\u8BE6\u60C5" : "\u{1F4C4} Context Details"));
|
|
501
|
+
console.log(a.dim("\u2500".repeat(80)));
|
|
502
|
+
console.log(` ${a.bold("ID:")} ${context.id}`);
|
|
503
|
+
console.log(` ${a.bold(isZh ? "\u9879\u76EE:" : "Project:")} ${context.projectHash}`);
|
|
504
|
+
console.log(` ${a.bold(isZh ? "\u7B97\u6CD5:" : "Algorithm:")} ${context.algorithm}`);
|
|
505
|
+
console.log(` ${a.bold(isZh ? "\u7B56\u7565:" : "Strategy:")} ${context.strategy}`);
|
|
506
|
+
console.log(` ${a.bold(isZh ? "\u539F\u59CB Tokens:" : "Original Tokens:")} ${context.originalTokens.toLocaleString()}`);
|
|
507
|
+
console.log(` ${a.bold(isZh ? "\u538B\u7F29\u540E Tokens:" : "Compressed Tokens:")} ${context.compressedTokens.toLocaleString()}`);
|
|
508
|
+
console.log(` ${a.bold(isZh ? "\u538B\u7F29\u7387:" : "Compression Ratio:")} ${(context.compressionRatio * 100).toFixed(1)}%`);
|
|
509
|
+
console.log(` ${a.bold(isZh ? "\u8BBF\u95EE\u6B21\u6570:" : "Access Count:")} ${context.accessCount}`);
|
|
510
|
+
console.log(` ${a.bold(isZh ? "\u521B\u5EFA\u65F6\u95F4:" : "Created:")} ${formatDate(context.timestamp)}`);
|
|
511
|
+
console.log(` ${a.bold(isZh ? "\u6700\u540E\u8BBF\u95EE:" : "Last Accessed:")} ${formatDate(context.lastAccessed)}`);
|
|
499
512
|
try {
|
|
500
513
|
const metadata = JSON.parse(context.metadata);
|
|
501
514
|
if (Object.keys(metadata).length > 0) {
|
|
502
|
-
console.log(` ${
|
|
515
|
+
console.log(` ${a.bold(isZh ? "\u5143\u6570\u636E:" : "Metadata:")}`);
|
|
503
516
|
for (const [key, value] of Object.entries(metadata)) {
|
|
504
|
-
console.log(` ${
|
|
517
|
+
console.log(` ${a.cyan(key)}: ${JSON.stringify(value)}`);
|
|
505
518
|
}
|
|
506
519
|
}
|
|
507
520
|
} catch {
|
|
@@ -525,7 +538,7 @@ async function exportContexts() {
|
|
|
525
538
|
const contexts = persistence.exportContexts(projectHash || void 0);
|
|
526
539
|
writeFileSync(outputPath, JSON.stringify(contexts, null, 2), "utf-8");
|
|
527
540
|
console.log("");
|
|
528
|
-
console.log(
|
|
541
|
+
console.log(a.green(`\u2714 ${isZh ? "\u5DF2\u5BFC\u51FA" : "Exported"} ${contexts.length} ${isZh ? "\u4E2A\u4E0A\u4E0B\u6587\u5230" : "contexts to"} ${outputPath}`));
|
|
529
542
|
console.log("");
|
|
530
543
|
}
|
|
531
544
|
async function importContexts() {
|
|
@@ -548,11 +561,11 @@ async function importContexts() {
|
|
|
548
561
|
const contexts = JSON.parse(content);
|
|
549
562
|
const imported = persistence.importContexts(contexts);
|
|
550
563
|
console.log("");
|
|
551
|
-
console.log(
|
|
564
|
+
console.log(a.green(`\u2714 ${isZh ? "\u5DF2\u5BFC\u5165" : "Imported"} ${imported} ${isZh ? "\u4E2A\u4E0A\u4E0B\u6587" : "contexts"}`));
|
|
552
565
|
console.log("");
|
|
553
566
|
} catch (error) {
|
|
554
567
|
console.log("");
|
|
555
|
-
console.log(
|
|
568
|
+
console.log(a.red(`\u2716 ${isZh ? "\u5BFC\u5165\u5931\u8D25:" : "Import failed:"} ${error instanceof Error ? error.message : String(error)}`));
|
|
556
569
|
console.log("");
|
|
557
570
|
}
|
|
558
571
|
}
|
|
@@ -597,12 +610,12 @@ async function clearOldContexts() {
|
|
|
597
610
|
default: false
|
|
598
611
|
});
|
|
599
612
|
if (!confirm) {
|
|
600
|
-
console.log(
|
|
613
|
+
console.log(a.yellow(isZh ? " \u5DF2\u53D6\u6D88" : " Cancelled"));
|
|
601
614
|
return;
|
|
602
615
|
}
|
|
603
616
|
const deleted = persistence.cleanup(maxAge);
|
|
604
617
|
console.log("");
|
|
605
|
-
console.log(
|
|
618
|
+
console.log(a.green(`\u2714 ${isZh ? "\u5DF2\u6E05\u7406" : "Cleared"} ${deleted} ${isZh ? "\u4E2A\u4E0A\u4E0B\u6587" : "contexts"}`));
|
|
606
619
|
console.log("");
|
|
607
620
|
}
|
|
608
621
|
async function viewTierDistribution() {
|
|
@@ -619,23 +632,23 @@ async function viewTierDistribution() {
|
|
|
619
632
|
);
|
|
620
633
|
const stats = loader.getStats();
|
|
621
634
|
console.log("");
|
|
622
|
-
console.log(
|
|
623
|
-
console.log(
|
|
624
|
-
console.log(` ${
|
|
625
|
-
console.log(` ${
|
|
626
|
-
console.log(` ${
|
|
627
|
-
console.log(` ${
|
|
628
|
-
console.log(` ${
|
|
629
|
-
console.log(` ${
|
|
630
|
-
console.log(` ${
|
|
631
|
-
console.log(` ${
|
|
632
|
-
console.log(` ${
|
|
633
|
-
console.log(` ${
|
|
634
|
-
console.log(` ${
|
|
635
|
-
console.log(` ${
|
|
636
|
-
console.log(` ${
|
|
637
|
-
console.log(` ${
|
|
638
|
-
console.log(` ${
|
|
635
|
+
console.log(a.bold.cyan(isZh ? "\u{1F4CA} \u5C42\u7EA7\u5206\u5E03\u7EDF\u8BA1" : "\u{1F4CA} Tier Distribution"));
|
|
636
|
+
console.log(a.dim("\u2500".repeat(80)));
|
|
637
|
+
console.log(` ${a.bold.red("L0 (Hot)")} ${a.dim("- <1 day, in-memory cache")}`);
|
|
638
|
+
console.log(` ${a.cyan(isZh ? "\u6570\u91CF:" : "Count:")} ${stats.l0.count}`);
|
|
639
|
+
console.log(` ${a.cyan(isZh ? "\u5927\u5C0F:" : "Size:")} ${formatBytes(stats.l0.size)}`);
|
|
640
|
+
console.log(` ${a.cyan(isZh ? "\u547D\u4E2D\u7387:" : "Hit Rate:")} ${(stats.l0.hitRate * 100).toFixed(1)}%`);
|
|
641
|
+
console.log(` ${a.bold.yellow("L1 (Warm)")} ${a.dim("- 1-7 days, indexed in DB")}`);
|
|
642
|
+
console.log(` ${a.cyan(isZh ? "\u6570\u91CF:" : "Count:")} ${stats.l1.count}`);
|
|
643
|
+
console.log(` ${a.cyan(isZh ? "\u5E73\u5747\u8BBF\u95EE\u65F6\u95F4:" : "Avg Access Time:")} ${formatDuration(stats.l1.avgAccessTime)}`);
|
|
644
|
+
console.log(` ${a.bold.blue("L2 (Cold)")} ${a.dim("- >7 days, lazy-loaded")}`);
|
|
645
|
+
console.log(` ${a.cyan(isZh ? "\u6570\u91CF:" : "Count:")} ${stats.l2.count}`);
|
|
646
|
+
console.log(` ${a.cyan(isZh ? "\u5E73\u5747\u8BBF\u95EE\u65F6\u95F4:" : "Avg Access Time:")} ${formatDuration(stats.l2.avgAccessTime)}`);
|
|
647
|
+
console.log(` ${a.bold.magenta(isZh ? "\u5C42\u7EA7\u8FC1\u79FB:" : "Tier Migrations:")}`);
|
|
648
|
+
console.log(` ${a.dim("Hot \u2192 Warm:")} ${stats.migrations.hotToWarm}`);
|
|
649
|
+
console.log(` ${a.dim("Warm \u2192 Cold:")} ${stats.migrations.warmToCold}`);
|
|
650
|
+
console.log(` ${a.dim("Cold \u2192 Warm:")} ${stats.migrations.coldToWarm}`);
|
|
651
|
+
console.log(` ${a.dim("Warm \u2192 Hot:")} ${stats.migrations.warmToHot}`);
|
|
639
652
|
console.log("");
|
|
640
653
|
}
|
|
641
654
|
async function migrateTiers() {
|
|
@@ -651,12 +664,12 @@ async function migrateTiers() {
|
|
|
651
664
|
projectHash || "global"
|
|
652
665
|
);
|
|
653
666
|
console.log("");
|
|
654
|
-
console.log(
|
|
667
|
+
console.log(a.cyan(isZh ? "\u6B63\u5728\u8FC1\u79FB\u5C42\u7EA7..." : "Migrating tiers..."));
|
|
655
668
|
const result = loader.migrateContexts();
|
|
656
669
|
console.log("");
|
|
657
|
-
console.log(
|
|
658
|
-
console.log(` ${
|
|
659
|
-
console.log(` ${
|
|
670
|
+
console.log(a.green(`\u2714 ${isZh ? "\u8FC1\u79FB\u5B8C\u6210" : "Migration complete"}`));
|
|
671
|
+
console.log(` ${a.cyan(isZh ? "\u63D0\u5347:" : "Promoted:")} ${result.promoted}`);
|
|
672
|
+
console.log(` ${a.cyan(isZh ? "\u964D\u7EA7:" : "Demoted:")} ${result.demoted}`);
|
|
660
673
|
console.log("");
|
|
661
674
|
}
|
|
662
675
|
async function viewDatabaseStats() {
|
|
@@ -664,22 +677,22 @@ async function viewDatabaseStats() {
|
|
|
664
677
|
const persistence = getContextPersistence();
|
|
665
678
|
const stats = persistence.getStats();
|
|
666
679
|
console.log("");
|
|
667
|
-
console.log(
|
|
668
|
-
console.log(
|
|
669
|
-
console.log(` ${
|
|
670
|
-
console.log(` ${
|
|
671
|
-
console.log(` ${
|
|
672
|
-
console.log(` ${
|
|
673
|
-
console.log(` ${
|
|
674
|
-
console.log(` ${
|
|
680
|
+
console.log(a.bold.cyan(isZh ? "\u{1F4C8} \u6570\u636E\u5E93\u7EDF\u8BA1" : "\u{1F4C8} Database Statistics"));
|
|
681
|
+
console.log(a.dim("\u2500".repeat(80)));
|
|
682
|
+
console.log(` ${a.bold(isZh ? "\u603B\u4E0A\u4E0B\u6587\u6570:" : "Total Contexts:")} ${stats.totalContexts.toLocaleString()}`);
|
|
683
|
+
console.log(` ${a.bold(isZh ? "\u603B\u9879\u76EE\u6570:" : "Total Projects:")} ${stats.totalProjects.toLocaleString()}`);
|
|
684
|
+
console.log(` ${a.bold(isZh ? "\u539F\u59CB Tokens:" : "Original Tokens:")} ${stats.totalOriginalTokens.toLocaleString()}`);
|
|
685
|
+
console.log(` ${a.bold(isZh ? "\u538B\u7F29\u540E Tokens:" : "Compressed Tokens:")} ${stats.totalCompressedTokens.toLocaleString()}`);
|
|
686
|
+
console.log(` ${a.bold(isZh ? "\u5E73\u5747\u538B\u7F29\u7387:" : "Avg Compression:")} ${(stats.averageCompressionRatio * 100).toFixed(1)}%`);
|
|
687
|
+
console.log(` ${a.bold(isZh ? "\u6570\u636E\u5E93\u5927\u5C0F:" : "Database Size:")} ${formatBytes(stats.totalSize)}`);
|
|
675
688
|
if (stats.oldestContext) {
|
|
676
|
-
console.log(` ${
|
|
689
|
+
console.log(` ${a.bold(isZh ? "\u6700\u65E9\u4E0A\u4E0B\u6587:" : "Oldest Context:")} ${formatDate(stats.oldestContext)}`);
|
|
677
690
|
}
|
|
678
691
|
if (stats.newestContext) {
|
|
679
|
-
console.log(` ${
|
|
692
|
+
console.log(` ${a.bold(isZh ? "\u6700\u65B0\u4E0A\u4E0B\u6587:" : "Newest Context:")} ${formatDate(stats.newestContext)}`);
|
|
680
693
|
}
|
|
681
694
|
const saved = stats.totalOriginalTokens - stats.totalCompressedTokens;
|
|
682
|
-
console.log(` ${
|
|
695
|
+
console.log(` ${a.bold.green(isZh ? "\u8282\u7701 Tokens:" : "Tokens Saved:")} ${saved.toLocaleString()} (${(stats.averageCompressionRatio * 100).toFixed(1)}%)`);
|
|
683
696
|
console.log("");
|
|
684
697
|
}
|
|
685
698
|
async function vacuumDatabase() {
|
|
@@ -692,32 +705,32 @@ async function vacuumDatabase() {
|
|
|
692
705
|
default: false
|
|
693
706
|
});
|
|
694
707
|
if (!confirm) {
|
|
695
|
-
console.log(
|
|
708
|
+
console.log(a.yellow(isZh ? " \u5DF2\u53D6\u6D88" : " Cancelled"));
|
|
696
709
|
return;
|
|
697
710
|
}
|
|
698
711
|
console.log("");
|
|
699
|
-
console.log(
|
|
712
|
+
console.log(a.cyan(isZh ? "\u6B63\u5728\u538B\u7F29\u6570\u636E\u5E93..." : "Vacuuming database..."));
|
|
700
713
|
persistence.vacuum();
|
|
701
714
|
console.log("");
|
|
702
|
-
console.log(
|
|
715
|
+
console.log(a.green(`\u2714 ${isZh ? "\u6570\u636E\u5E93\u538B\u7F29\u5B8C\u6210" : "Database vacuum complete"}`));
|
|
703
716
|
console.log("");
|
|
704
717
|
}
|
|
705
718
|
async function showPersistenceMenu() {
|
|
706
719
|
const isZh = i18n.language === "zh-CN";
|
|
707
720
|
console.log("");
|
|
708
|
-
console.log(
|
|
709
|
-
console.log(
|
|
710
|
-
console.log(` ${
|
|
711
|
-
console.log(` ${
|
|
712
|
-
console.log(` ${
|
|
713
|
-
console.log(` ${
|
|
714
|
-
console.log(` ${
|
|
715
|
-
console.log(` ${
|
|
716
|
-
console.log(` ${
|
|
717
|
-
console.log(` ${
|
|
718
|
-
console.log(` ${
|
|
719
|
-
console.log(` ${
|
|
720
|
-
console.log(` ${
|
|
721
|
+
console.log(a.bold.yellow(isZh ? "\u{1F4BE} \u6301\u4E45\u5316\u7BA1\u7406\u5668" : "\u{1F4BE} Persistence Manager"));
|
|
722
|
+
console.log(a.dim("\u2500".repeat(80)));
|
|
723
|
+
console.log(` ${a.green("1.")} ${isZh ? "\u5217\u51FA\u5B58\u50A8\u7684\u4E0A\u4E0B\u6587" : "List stored contexts"} ${a.dim(isZh ? "- \u5206\u9875\u663E\u793A\u6240\u6709\u4E0A\u4E0B\u6587" : "- Paginated view of all contexts")}`);
|
|
724
|
+
console.log(` ${a.green("2.")} ${isZh ? "\u641C\u7D22\u4E0A\u4E0B\u6587" : "Search contexts"} ${a.dim(isZh ? "- \u5168\u6587\u641C\u7D22 (FTS5)" : "- Full-text search (FTS5)")}`);
|
|
725
|
+
console.log(` ${a.green("3.")} ${isZh ? "\u67E5\u770B\u4E0A\u4E0B\u6587\u8BE6\u60C5" : "View context details"} ${a.dim(isZh ? "- \u663E\u793A\u5143\u6570\u636E\u548C\u7EDF\u8BA1" : "- Show metadata and stats")}`);
|
|
726
|
+
console.log(` ${a.green("4.")} ${isZh ? "\u5BFC\u51FA\u4E0A\u4E0B\u6587" : "Export contexts"} ${a.dim(isZh ? "- \u5BFC\u51FA\u4E3A JSON \u683C\u5F0F" : "- Export to JSON format")}`);
|
|
727
|
+
console.log(` ${a.green("5.")} ${isZh ? "\u5BFC\u5165\u4E0A\u4E0B\u6587" : "Import contexts"} ${a.dim(isZh ? "- \u4ECE JSON \u5BFC\u5165" : "- Import from JSON")}`);
|
|
728
|
+
console.log(` ${a.green("6.")} ${isZh ? "\u6E05\u7406\u65E7\u4E0A\u4E0B\u6587" : "Clear old contexts"} ${a.dim(isZh ? "- \u6309\u65F6\u95F4\u6E05\u7406" : "- Clear by age")}`);
|
|
729
|
+
console.log(` ${a.green("7.")} ${isZh ? "\u67E5\u770B\u5C42\u7EA7\u5206\u5E03" : "View tier distribution"} ${a.dim(isZh ? "- L0/L1/L2 \u7EDF\u8BA1" : "- L0/L1/L2 stats")}`);
|
|
730
|
+
console.log(` ${a.green("8.")} ${isZh ? "\u624B\u52A8\u8FC1\u79FB\u5C42\u7EA7" : "Migrate tiers manually"} ${a.dim(isZh ? "- \u4F18\u5316\u5C42\u7EA7\u5206\u5E03" : "- Optimize tier distribution")}`);
|
|
731
|
+
console.log(` ${a.green("9.")} ${isZh ? "\u6570\u636E\u5E93\u7EDF\u8BA1" : "Database statistics"} ${a.dim(isZh ? "- \u67E5\u770B\u5168\u5C40\u7EDF\u8BA1" : "- View global stats")}`);
|
|
732
|
+
console.log(` ${a.green("V.")} ${isZh ? "\u538B\u7F29\u6570\u636E\u5E93" : "Vacuum database"} ${a.dim(isZh ? "- \u56DE\u6536\u7A7A\u95F4" : "- Reclaim space")}`);
|
|
733
|
+
console.log(` ${a.green("Q.")} ${isZh ? "\u8FD4\u56DE" : "Back"}`);
|
|
721
734
|
console.log("");
|
|
722
735
|
const { choice } = await inquirer.prompt({
|
|
723
736
|
type: "input",
|
|
@@ -774,7 +787,7 @@ async function persistenceManager() {
|
|
|
774
787
|
}
|
|
775
788
|
} catch (error) {
|
|
776
789
|
const isZh = i18n.language === "zh-CN";
|
|
777
|
-
console.error(
|
|
790
|
+
console.error(a.red(`${isZh ? "\u9519\u8BEF:" : "Error:"} ${error instanceof Error ? error.message : String(error)}`));
|
|
778
791
|
}
|
|
779
792
|
}
|
|
780
793
|
|
package/dist/chunks/platform.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
2
|
import { homedir, platform as platform$1 } from 'node:os';
|
|
3
3
|
import process__default from 'node:process';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { exec as q } from './main.mjs';
|
|
5
|
+
import { d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
6
6
|
|
|
7
7
|
const WINDOWS_WRAPPED_COMMANDS = ["npx", "uvx", "uv"];
|
|
8
8
|
function getPlatform() {
|
|
@@ -14,7 +14,7 @@ function getPlatform() {
|
|
|
14
14
|
return "linux";
|
|
15
15
|
}
|
|
16
16
|
function isTermux() {
|
|
17
|
-
return !!(process__default.env.PREFIX && process__default.env.PREFIX.includes("com.termux")) || !!process__default.env.TERMUX_VERSION ||
|
|
17
|
+
return !!(process__default.env.PREFIX && process__default.env.PREFIX.includes("com.termux")) || !!process__default.env.TERMUX_VERSION || fs.existsSync("/data/data/com.termux/files/usr");
|
|
18
18
|
}
|
|
19
19
|
function getTermuxPrefix() {
|
|
20
20
|
return process__default.env.PREFIX || "/data/data/com.termux/files/usr";
|
|
@@ -26,16 +26,16 @@ function isWSL() {
|
|
|
26
26
|
if (process__default.env.WSL_DISTRO_NAME) {
|
|
27
27
|
return true;
|
|
28
28
|
}
|
|
29
|
-
if (
|
|
29
|
+
if (fs.existsSync("/proc/version")) {
|
|
30
30
|
try {
|
|
31
|
-
const version =
|
|
31
|
+
const version = fs.readFileSync("/proc/version", "utf8");
|
|
32
32
|
if (version.includes("Microsoft") || version.includes("WSL")) {
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
35
|
} catch {
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
38
|
+
if (fs.existsSync("/mnt/c")) {
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
41
41
|
return false;
|
|
@@ -44,9 +44,9 @@ function getWSLDistro() {
|
|
|
44
44
|
if (process__default.env.WSL_DISTRO_NAME) {
|
|
45
45
|
return process__default.env.WSL_DISTRO_NAME;
|
|
46
46
|
}
|
|
47
|
-
if (
|
|
47
|
+
if (fs.existsSync("/etc/os-release")) {
|
|
48
48
|
try {
|
|
49
|
-
const osRelease =
|
|
49
|
+
const osRelease = fs.readFileSync("/etc/os-release", "utf8");
|
|
50
50
|
const nameMatch = osRelease.match(/^PRETTY_NAME="(.+)"$/m);
|
|
51
51
|
if (nameMatch) {
|
|
52
52
|
return nameMatch[1];
|
|
@@ -61,9 +61,9 @@ function getWSLInfo() {
|
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
63
|
let version = null;
|
|
64
|
-
if (
|
|
64
|
+
if (fs.existsSync("/proc/version")) {
|
|
65
65
|
try {
|
|
66
|
-
version =
|
|
66
|
+
version = fs.readFileSync("/proc/version", "utf8").trim();
|
|
67
67
|
} catch {
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -140,7 +140,7 @@ function isPathInsideHome(path) {
|
|
|
140
140
|
}
|
|
141
141
|
function canWriteToPath(path) {
|
|
142
142
|
try {
|
|
143
|
-
|
|
143
|
+
fs.accessSync(path, WRITE_CHECK_FLAG);
|
|
144
144
|
return true;
|
|
145
145
|
} catch {
|
|
146
146
|
return false;
|
|
@@ -161,7 +161,7 @@ function getGlobalNpmPrefix() {
|
|
|
161
161
|
async function commandExists(command) {
|
|
162
162
|
try {
|
|
163
163
|
const cmd = getPlatform() === "windows" ? "where" : "which";
|
|
164
|
-
const res = await
|
|
164
|
+
const res = await q(cmd, [command]);
|
|
165
165
|
if (res.exitCode === 0) {
|
|
166
166
|
return true;
|
|
167
167
|
}
|
|
@@ -175,7 +175,7 @@ async function commandExists(command) {
|
|
|
175
175
|
`/data/data/com.termux/files/usr/bin/${command}`
|
|
176
176
|
];
|
|
177
177
|
for (const path of possiblePaths) {
|
|
178
|
-
if (
|
|
178
|
+
if (fs.existsSync(path)) {
|
|
179
179
|
return true;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -189,14 +189,14 @@ async function commandExists(command) {
|
|
|
189
189
|
`${home}/.local/bin/${command}`
|
|
190
190
|
];
|
|
191
191
|
for (const path of commonPaths) {
|
|
192
|
-
if (
|
|
192
|
+
if (fs.existsSync(path)) {
|
|
193
193
|
return true;
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
if (getPlatform() === "macos") {
|
|
197
197
|
const homebrewPaths = await getHomebrewCommandPaths(command);
|
|
198
198
|
for (const path of homebrewPaths) {
|
|
199
|
-
if (
|
|
199
|
+
if (fs.existsSync(path)) {
|
|
200
200
|
return true;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
@@ -217,9 +217,9 @@ async function getHomebrewCommandPaths(command) {
|
|
|
217
217
|
}
|
|
218
218
|
for (const prefix of homebrewPrefixes) {
|
|
219
219
|
const cellarNodePath = `${prefix}/Cellar/node`;
|
|
220
|
-
if (
|
|
220
|
+
if (fs.existsSync(cellarNodePath)) {
|
|
221
221
|
try {
|
|
222
|
-
const versions =
|
|
222
|
+
const versions = fs.readdirSync(cellarNodePath);
|
|
223
223
|
for (const version of versions) {
|
|
224
224
|
const binPath = `${cellarNodePath}/${version}/bin/${command}`;
|
|
225
225
|
paths.push(binPath);
|
|
@@ -236,9 +236,9 @@ async function getHomebrewCommandPaths(command) {
|
|
|
236
236
|
if (caskName) {
|
|
237
237
|
for (const prefix of homebrewPrefixes) {
|
|
238
238
|
const caskroomPath = `${prefix}/Caskroom/${caskName}`;
|
|
239
|
-
if (
|
|
239
|
+
if (fs.existsSync(caskroomPath)) {
|
|
240
240
|
try {
|
|
241
|
-
const versions =
|
|
241
|
+
const versions = fs.readdirSync(caskroomPath).filter((v) => !v.startsWith("."));
|
|
242
242
|
for (const version of versions) {
|
|
243
243
|
const binPath = `${caskroomPath}/${version}/${command}`;
|
|
244
244
|
paths.push(binPath);
|
|
@@ -253,7 +253,7 @@ async function getHomebrewCommandPaths(command) {
|
|
|
253
253
|
async function findCommandPath(command) {
|
|
254
254
|
try {
|
|
255
255
|
const cmd = getPlatform() === "windows" ? "where" : "which";
|
|
256
|
-
const res = await
|
|
256
|
+
const res = await q(cmd, [command]);
|
|
257
257
|
if (res.exitCode === 0 && res.stdout) {
|
|
258
258
|
return res.stdout.trim().split("\n")[0];
|
|
259
259
|
}
|
|
@@ -267,14 +267,14 @@ async function findCommandPath(command) {
|
|
|
267
267
|
`${home}/.local/bin/${command}`
|
|
268
268
|
];
|
|
269
269
|
for (const path of commonPaths) {
|
|
270
|
-
if (
|
|
270
|
+
if (fs.existsSync(path)) {
|
|
271
271
|
return path;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
if (getPlatform() === "macos") {
|
|
275
275
|
const homebrewPaths = await getHomebrewCommandPaths(command);
|
|
276
276
|
for (const path of homebrewPaths) {
|
|
277
|
-
if (
|
|
277
|
+
if (fs.existsSync(path)) {
|
|
278
278
|
return path;
|
|
279
279
|
}
|
|
280
280
|
}
|
|
@@ -286,7 +286,7 @@ async function findCommandPath(command) {
|
|
|
286
286
|
`${termuxPrefix}/usr/bin/${command}`
|
|
287
287
|
];
|
|
288
288
|
for (const path of termuxPaths) {
|
|
289
|
-
if (
|
|
289
|
+
if (fs.existsSync(path)) {
|
|
290
290
|
return path;
|
|
291
291
|
}
|
|
292
292
|
}
|
|
@@ -297,10 +297,10 @@ async function findRealCommandPath(command) {
|
|
|
297
297
|
const platform2 = getPlatform();
|
|
298
298
|
if (platform2 !== "windows") {
|
|
299
299
|
try {
|
|
300
|
-
const res = await
|
|
300
|
+
const res = await q("bash", ["-c", `type -P ${command}`]);
|
|
301
301
|
if (res.exitCode === 0 && res.stdout) {
|
|
302
302
|
const path = res.stdout.trim();
|
|
303
|
-
if (path &&
|
|
303
|
+
if (path && fs.existsSync(path)) {
|
|
304
304
|
return path;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
@@ -316,14 +316,14 @@ async function findRealCommandPath(command) {
|
|
|
316
316
|
`${home}/.local/bin/${command}`
|
|
317
317
|
];
|
|
318
318
|
for (const path of commonPaths) {
|
|
319
|
-
if (
|
|
319
|
+
if (fs.existsSync(path)) {
|
|
320
320
|
return path;
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
if (platform2 === "macos") {
|
|
324
324
|
const homebrewPaths = await getHomebrewCommandPaths(command);
|
|
325
325
|
for (const path of homebrewPaths) {
|
|
326
|
-
if (
|
|
326
|
+
if (fs.existsSync(path)) {
|
|
327
327
|
return path;
|
|
328
328
|
}
|
|
329
329
|
}
|
|
@@ -335,7 +335,7 @@ async function findRealCommandPath(command) {
|
|
|
335
335
|
`${termuxPrefix}/usr/bin/${command}`
|
|
336
336
|
];
|
|
337
337
|
for (const path of termuxPaths) {
|
|
338
|
-
if (
|
|
338
|
+
if (fs.existsSync(path)) {
|
|
339
339
|
return path;
|
|
340
340
|
}
|
|
341
341
|
}
|