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/stats.mjs
DELETED
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
import a from './index2.mjs';
|
|
2
|
-
import { i18n } from './index5.mjs';
|
|
3
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
|
|
4
|
-
import { homedir } from 'node:os';
|
|
5
|
-
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
6
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
7
|
-
import 'node:process';
|
|
8
|
-
import 'node:url';
|
|
9
|
-
|
|
10
|
-
class StatsStorage {
|
|
11
|
-
baseDir;
|
|
12
|
-
recordsDir;
|
|
13
|
-
dailyDir;
|
|
14
|
-
constructor(baseDir) {
|
|
15
|
-
this.baseDir = baseDir || join(homedir(), ".ccjk", "stats");
|
|
16
|
-
this.recordsDir = join(this.baseDir, "records");
|
|
17
|
-
this.dailyDir = join(this.baseDir, "daily");
|
|
18
|
-
this.ensureDirectories();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Ensure storage directories exist
|
|
22
|
-
*/
|
|
23
|
-
ensureDirectories() {
|
|
24
|
-
for (const dir of [this.baseDir, this.recordsDir, this.dailyDir]) {
|
|
25
|
-
if (!existsSync(dir)) {
|
|
26
|
-
mkdirSync(dir, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get file path for a specific date
|
|
32
|
-
*/
|
|
33
|
-
getRecordFilePath(date) {
|
|
34
|
-
return join(this.recordsDir, `${date}.json`);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Get daily stats file path for a specific date
|
|
38
|
-
*/
|
|
39
|
-
getDailyStatsFilePath(date) {
|
|
40
|
-
return join(this.dailyDir, `${date}.json`);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Format date as YYYY-MM-DD
|
|
44
|
-
*/
|
|
45
|
-
formatDate(timestamp) {
|
|
46
|
-
const date = new Date(timestamp);
|
|
47
|
-
const year = date.getFullYear();
|
|
48
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
49
|
-
const day = String(date.getDate()).padStart(2, "0");
|
|
50
|
-
return `${year}-${month}-${day}`;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Save a request record
|
|
54
|
-
*/
|
|
55
|
-
saveRecord(record) {
|
|
56
|
-
const date = this.formatDate(record.timestamp);
|
|
57
|
-
const filePath = this.getRecordFilePath(date);
|
|
58
|
-
let records = [];
|
|
59
|
-
if (existsSync(filePath)) {
|
|
60
|
-
try {
|
|
61
|
-
const content = readFileSync(filePath, "utf-8");
|
|
62
|
-
records = JSON.parse(content);
|
|
63
|
-
} catch {
|
|
64
|
-
records = [];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
records.push(record);
|
|
68
|
-
writeFileSync(filePath, JSON.stringify(records, null, 2), "utf-8");
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Get records for a specific date
|
|
72
|
-
*/
|
|
73
|
-
getRecordsByDate(date) {
|
|
74
|
-
const filePath = this.getRecordFilePath(date);
|
|
75
|
-
if (!existsSync(filePath)) {
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
const content = readFileSync(filePath, "utf-8");
|
|
80
|
-
return JSON.parse(content);
|
|
81
|
-
} catch {
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Get records for a date range
|
|
87
|
-
*/
|
|
88
|
-
getRecordsByDateRange(startDate, endDate) {
|
|
89
|
-
const records = [];
|
|
90
|
-
const start = new Date(startDate);
|
|
91
|
-
const end = new Date(endDate);
|
|
92
|
-
const d = new Date(start);
|
|
93
|
-
while (d <= end) {
|
|
94
|
-
const dateStr = this.formatDate(d.getTime());
|
|
95
|
-
records.push(...this.getRecordsByDate(dateStr));
|
|
96
|
-
d.setDate(d.getDate() + 1);
|
|
97
|
-
}
|
|
98
|
-
return records;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get all available record dates
|
|
102
|
-
*/
|
|
103
|
-
getAvailableDates() {
|
|
104
|
-
if (!existsSync(this.recordsDir)) {
|
|
105
|
-
return [];
|
|
106
|
-
}
|
|
107
|
-
const files = readdirSync(this.recordsDir);
|
|
108
|
-
return files.filter((f) => f.endsWith(".json")).map((f) => f.replace(".json", "")).sort();
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Save daily statistics
|
|
112
|
-
*/
|
|
113
|
-
saveDailyStats(stats) {
|
|
114
|
-
const filePath = this.getDailyStatsFilePath(stats.date);
|
|
115
|
-
writeFileSync(filePath, JSON.stringify(stats, null, 2), "utf-8");
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Get daily statistics for a specific date
|
|
119
|
-
*/
|
|
120
|
-
getDailyStats(date) {
|
|
121
|
-
const filePath = this.getDailyStatsFilePath(date);
|
|
122
|
-
if (!existsSync(filePath)) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
try {
|
|
126
|
-
const content = readFileSync(filePath, "utf-8");
|
|
127
|
-
return JSON.parse(content);
|
|
128
|
-
} catch {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Get daily statistics for a date range
|
|
134
|
-
*/
|
|
135
|
-
getDailyStatsByDateRange(startDate, endDate) {
|
|
136
|
-
const stats = [];
|
|
137
|
-
const start = new Date(startDate);
|
|
138
|
-
const end = new Date(endDate);
|
|
139
|
-
const d = new Date(start);
|
|
140
|
-
while (d <= end) {
|
|
141
|
-
const dateStr = this.formatDate(d.getTime());
|
|
142
|
-
const dailyStats = this.getDailyStats(dateStr);
|
|
143
|
-
if (dailyStats) {
|
|
144
|
-
stats.push(dailyStats);
|
|
145
|
-
}
|
|
146
|
-
d.setDate(d.getDate() + 1);
|
|
147
|
-
}
|
|
148
|
-
return stats;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Get all available daily stats dates
|
|
152
|
-
*/
|
|
153
|
-
getAvailableDailyStatsDates() {
|
|
154
|
-
if (!existsSync(this.dailyDir)) {
|
|
155
|
-
return [];
|
|
156
|
-
}
|
|
157
|
-
const files = readdirSync(this.dailyDir);
|
|
158
|
-
return files.filter((f) => f.endsWith(".json")).map((f) => f.replace(".json", "")).sort();
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Calculate date range for a period
|
|
162
|
-
*/
|
|
163
|
-
getDateRangeForPeriod(period) {
|
|
164
|
-
const now = /* @__PURE__ */ new Date();
|
|
165
|
-
const endDate = this.formatDate(now.getTime());
|
|
166
|
-
if (period === "all") {
|
|
167
|
-
const dates = this.getAvailableDates();
|
|
168
|
-
const startDate2 = dates.length > 0 ? dates[0] : endDate;
|
|
169
|
-
return { startDate: startDate2, endDate };
|
|
170
|
-
}
|
|
171
|
-
const days = period === "1d" ? 1 : period === "7d" ? 7 : period === "30d" ? 30 : 90;
|
|
172
|
-
const start = new Date(now);
|
|
173
|
-
start.setDate(start.getDate() - days + 1);
|
|
174
|
-
const startDate = this.formatDate(start.getTime());
|
|
175
|
-
return { startDate, endDate };
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Clean up old records (older than specified days)
|
|
179
|
-
*/
|
|
180
|
-
cleanupOldRecords(daysToKeep) {
|
|
181
|
-
const cutoffDate = /* @__PURE__ */ new Date();
|
|
182
|
-
cutoffDate.setDate(cutoffDate.getDate() - daysToKeep);
|
|
183
|
-
const cutoffStr = this.formatDate(cutoffDate.getTime());
|
|
184
|
-
const dates = this.getAvailableDates();
|
|
185
|
-
let deletedCount = 0;
|
|
186
|
-
for (const date of dates) {
|
|
187
|
-
if (date < cutoffStr) {
|
|
188
|
-
try {
|
|
189
|
-
const recordFile = this.getRecordFilePath(date);
|
|
190
|
-
const dailyFile = this.getDailyStatsFilePath(date);
|
|
191
|
-
if (existsSync(recordFile)) {
|
|
192
|
-
deletedCount++;
|
|
193
|
-
}
|
|
194
|
-
if (existsSync(dailyFile)) {
|
|
195
|
-
}
|
|
196
|
-
} catch {
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return deletedCount;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Get storage statistics
|
|
204
|
-
*/
|
|
205
|
-
getStorageStats() {
|
|
206
|
-
const recordDates = this.getAvailableDates();
|
|
207
|
-
const dailyDates = this.getAvailableDailyStatsDates();
|
|
208
|
-
let totalRecords = 0;
|
|
209
|
-
for (const date of recordDates) {
|
|
210
|
-
const records = this.getRecordsByDate(date);
|
|
211
|
-
totalRecords += records.length;
|
|
212
|
-
}
|
|
213
|
-
return {
|
|
214
|
-
totalRecordFiles: recordDates.length,
|
|
215
|
-
totalDailyFiles: dailyDates.length,
|
|
216
|
-
oldestDate: recordDates.length > 0 ? recordDates[0] : null,
|
|
217
|
-
newestDate: recordDates.length > 0 ? recordDates[recordDates.length - 1] : null,
|
|
218
|
-
totalRecords
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
let storageInstance = null;
|
|
223
|
-
function getStatsStorage() {
|
|
224
|
-
if (!storageInstance) {
|
|
225
|
-
storageInstance = new StatsStorage();
|
|
226
|
-
}
|
|
227
|
-
return storageInstance;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
async function stats(options = {}) {
|
|
231
|
-
const period = options.period || "7d";
|
|
232
|
-
const format = options.format || "table";
|
|
233
|
-
const storage = getStatsStorage();
|
|
234
|
-
const { startDate, endDate } = storage.getDateRangeForPeriod(period);
|
|
235
|
-
const records = storage.getRecordsByDateRange(startDate, endDate);
|
|
236
|
-
if (records.length === 0) {
|
|
237
|
-
console.log(a.yellow(`
|
|
238
|
-
${i18n.t("stats:noData")}
|
|
239
|
-
`));
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
const filteredRecords = options.provider ? records.filter((r) => r.provider === options.provider) : records;
|
|
243
|
-
if (filteredRecords.length === 0) {
|
|
244
|
-
console.log(a.yellow(`
|
|
245
|
-
${i18n.t("stats:noData")} for provider: ${options.provider}
|
|
246
|
-
`));
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
const stats2 = calculateStats(filteredRecords);
|
|
250
|
-
if (format === "json") {
|
|
251
|
-
console.log(JSON.stringify(stats2, null, 2));
|
|
252
|
-
} else if (format === "csv") {
|
|
253
|
-
displayCSV(stats2);
|
|
254
|
-
} else {
|
|
255
|
-
displayTable(stats2, period);
|
|
256
|
-
}
|
|
257
|
-
if (options.export) {
|
|
258
|
-
await exportStats(stats2, options.export, format);
|
|
259
|
-
console.log(a.green(`
|
|
260
|
-
${i18n.t("stats:exportSuccess")}: ${options.export}
|
|
261
|
-
`));
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
function calculateStats(records) {
|
|
265
|
-
const totalRequests = records.length;
|
|
266
|
-
const successfulRequests = records.filter((r) => r.success).length;
|
|
267
|
-
const successRate = totalRequests > 0 ? successfulRequests / totalRequests * 100 : 0;
|
|
268
|
-
let totalInputTokens = 0;
|
|
269
|
-
let totalOutputTokens = 0;
|
|
270
|
-
let totalCost = 0;
|
|
271
|
-
let totalLatency = 0;
|
|
272
|
-
const providerCounts = {};
|
|
273
|
-
const modelCounts = {};
|
|
274
|
-
for (const record of records) {
|
|
275
|
-
totalInputTokens += record.inputTokens || 0;
|
|
276
|
-
totalOutputTokens += record.outputTokens || 0;
|
|
277
|
-
totalCost += record.cost || 0;
|
|
278
|
-
totalLatency += record.latency || 0;
|
|
279
|
-
const provider = record.provider || "unknown";
|
|
280
|
-
providerCounts[provider] = (providerCounts[provider] || 0) + 1;
|
|
281
|
-
const model = record.model || "unknown";
|
|
282
|
-
modelCounts[model] = (modelCounts[model] || 0) + 1;
|
|
283
|
-
}
|
|
284
|
-
const averageLatency = totalRequests > 0 ? totalLatency / totalRequests : 0;
|
|
285
|
-
return {
|
|
286
|
-
totalRequests,
|
|
287
|
-
successfulRequests,
|
|
288
|
-
failedRequests: totalRequests - successfulRequests,
|
|
289
|
-
successRate,
|
|
290
|
-
totalInputTokens,
|
|
291
|
-
totalOutputTokens,
|
|
292
|
-
totalTokens: totalInputTokens + totalOutputTokens,
|
|
293
|
-
totalCost,
|
|
294
|
-
averageLatency,
|
|
295
|
-
providerCounts,
|
|
296
|
-
modelCounts
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
function displayTable(stats2, period) {
|
|
300
|
-
console.log(a.cyan.bold(`
|
|
301
|
-
\u{1F4CA} ${i18n.t("stats:title")} - ${i18n.t(`stats:period.${period}`)}`));
|
|
302
|
-
console.log(a.dim("\u2500".repeat(60)));
|
|
303
|
-
console.log(a.yellow("\n\u{1F4C8} Request Statistics:"));
|
|
304
|
-
console.log(` ${i18n.t("stats:totalRequests")}: ${a.bold(stats2.totalRequests.toLocaleString())}`);
|
|
305
|
-
console.log(` ${a.green("\u2713")} Successful: ${a.bold(stats2.successfulRequests.toLocaleString())}`);
|
|
306
|
-
console.log(` ${a.red("\u2717")} Failed: ${a.bold(stats2.failedRequests.toLocaleString())}`);
|
|
307
|
-
console.log(` ${i18n.t("stats:successRate")}: ${a.bold(stats2.successRate.toFixed(2))}%`);
|
|
308
|
-
console.log(a.yellow("\n\u{1F3AF} Token Usage:"));
|
|
309
|
-
console.log(` ${i18n.t("stats:input")}: ${a.bold(stats2.totalInputTokens.toLocaleString())}`);
|
|
310
|
-
console.log(` ${i18n.t("stats:output")}: ${a.bold(stats2.totalOutputTokens.toLocaleString())}`);
|
|
311
|
-
console.log(` ${i18n.t("stats:totalTokens")}: ${a.bold(stats2.totalTokens.toLocaleString())}`);
|
|
312
|
-
console.log(a.yellow("\n\u{1F4B0} Cost Analysis:"));
|
|
313
|
-
console.log(` ${i18n.t("stats:estimatedCost")}: ${a.bold(`$${stats2.totalCost.toFixed(4)}`)}`);
|
|
314
|
-
console.log(a.yellow("\n\u26A1 Performance:"));
|
|
315
|
-
console.log(` ${i18n.t("stats:averageLatency")}: ${a.bold(stats2.averageLatency.toFixed(0))}ms`);
|
|
316
|
-
if (Object.keys(stats2.providerCounts).length > 0) {
|
|
317
|
-
console.log(a.yellow(`
|
|
318
|
-
\u2601\uFE0F ${i18n.t("stats:providerDistribution")}:`));
|
|
319
|
-
for (const [provider, count] of Object.entries(stats2.providerCounts)) {
|
|
320
|
-
const percentage = (count / stats2.totalRequests * 100).toFixed(1);
|
|
321
|
-
console.log(` ${provider}: ${a.bold(count)} (${percentage}%)`);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
if (Object.keys(stats2.modelCounts).length > 0) {
|
|
325
|
-
console.log(a.yellow("\n\u{1F916} Model Distribution:"));
|
|
326
|
-
for (const [model, count] of Object.entries(stats2.modelCounts)) {
|
|
327
|
-
const percentage = (count / stats2.totalRequests * 100).toFixed(1);
|
|
328
|
-
console.log(` ${model}: ${a.bold(count)} (${percentage}%)`);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
console.log(a.dim(`
|
|
332
|
-
${"\u2500".repeat(60)}
|
|
333
|
-
`));
|
|
334
|
-
}
|
|
335
|
-
function displayCSV(stats2) {
|
|
336
|
-
console.log("metric,value");
|
|
337
|
-
console.log(`total_requests,${stats2.totalRequests}`);
|
|
338
|
-
console.log(`successful_requests,${stats2.successfulRequests}`);
|
|
339
|
-
console.log(`failed_requests,${stats2.failedRequests}`);
|
|
340
|
-
console.log(`success_rate,${stats2.successRate.toFixed(2)}`);
|
|
341
|
-
console.log(`total_input_tokens,${stats2.totalInputTokens}`);
|
|
342
|
-
console.log(`total_output_tokens,${stats2.totalOutputTokens}`);
|
|
343
|
-
console.log(`total_tokens,${stats2.totalTokens}`);
|
|
344
|
-
console.log(`total_cost,${stats2.totalCost.toFixed(4)}`);
|
|
345
|
-
console.log(`average_latency,${stats2.averageLatency.toFixed(0)}`);
|
|
346
|
-
}
|
|
347
|
-
async function exportStats(stats2, filePath, format) {
|
|
348
|
-
const { writeFileSync } = await import('node:fs');
|
|
349
|
-
let content;
|
|
350
|
-
if (format === "json") {
|
|
351
|
-
content = JSON.stringify(stats2, null, 2);
|
|
352
|
-
} else if (format === "csv") {
|
|
353
|
-
const lines = [
|
|
354
|
-
"metric,value",
|
|
355
|
-
`total_requests,${stats2.totalRequests}`,
|
|
356
|
-
`successful_requests,${stats2.successfulRequests}`,
|
|
357
|
-
`failed_requests,${stats2.failedRequests}`,
|
|
358
|
-
`success_rate,${stats2.successRate.toFixed(2)}`,
|
|
359
|
-
`total_input_tokens,${stats2.totalInputTokens}`,
|
|
360
|
-
`total_output_tokens,${stats2.totalOutputTokens}`,
|
|
361
|
-
`total_tokens,${stats2.totalTokens}`,
|
|
362
|
-
`total_cost,${stats2.totalCost.toFixed(4)}`,
|
|
363
|
-
`average_latency,${stats2.averageLatency.toFixed(0)}`
|
|
364
|
-
];
|
|
365
|
-
content = lines.join("\n");
|
|
366
|
-
} else {
|
|
367
|
-
content = JSON.stringify(stats2, null, 2);
|
|
368
|
-
}
|
|
369
|
-
writeFileSync(filePath, content, "utf-8");
|
|
370
|
-
}
|
|
371
|
-
async function listStatsDates() {
|
|
372
|
-
const storage = getStatsStorage();
|
|
373
|
-
const dates = storage.getAvailableDates();
|
|
374
|
-
if (dates.length === 0) {
|
|
375
|
-
console.log(a.yellow("\nNo statistics data available\n"));
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
console.log(a.cyan.bold("\n\u{1F4C5} Available Statistics Dates:"));
|
|
379
|
-
console.log(a.dim("\u2500".repeat(40)));
|
|
380
|
-
for (const date of dates) {
|
|
381
|
-
const records = storage.getRecordsByDate(date);
|
|
382
|
-
console.log(` ${date}: ${a.bold(records.length)} requests`);
|
|
383
|
-
}
|
|
384
|
-
console.log(a.dim(`
|
|
385
|
-
${"\u2500".repeat(40)}
|
|
386
|
-
`));
|
|
387
|
-
}
|
|
388
|
-
async function storageStats() {
|
|
389
|
-
const storage = getStatsStorage();
|
|
390
|
-
const stats2 = storage.getStorageStats();
|
|
391
|
-
console.log(a.cyan.bold("\n\u{1F4BE} Storage Statistics:"));
|
|
392
|
-
console.log(a.dim("\u2500".repeat(40)));
|
|
393
|
-
console.log(` Total record files: ${a.bold(stats2.totalRecordFiles)}`);
|
|
394
|
-
console.log(` Total daily files: ${a.bold(stats2.totalDailyFiles)}`);
|
|
395
|
-
console.log(` Total records: ${a.bold(stats2.totalRecords.toLocaleString())}`);
|
|
396
|
-
console.log(` Oldest date: ${a.bold(stats2.oldestDate || "N/A")}`);
|
|
397
|
-
console.log(` Newest date: ${a.bold(stats2.newestDate || "N/A")}`);
|
|
398
|
-
console.log(a.dim(`
|
|
399
|
-
${"\u2500".repeat(40)}
|
|
400
|
-
`));
|
|
401
|
-
}
|
|
402
|
-
async function cleanupStats(daysToKeep = 90) {
|
|
403
|
-
const storage = getStatsStorage();
|
|
404
|
-
const deletedCount = storage.cleanupOldRecords(daysToKeep);
|
|
405
|
-
console.log(a.green(`
|
|
406
|
-
\u2713 Cleanup complete: ${deletedCount} old records marked for deletion
|
|
407
|
-
`));
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
export { cleanupStats, listStatsDates, stats, storageStats };
|
package/dist/chunks/status.mjs
DELETED
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { homedir } from 'node:os';
|
|
3
|
-
import process__default from 'node:process';
|
|
4
|
-
import a from './index2.mjs';
|
|
5
|
-
import { s as scanProject } from '../shared/ccjk.BrPUmTqm.mjs';
|
|
6
|
-
import { getContextPersistence } from './persistence.mjs';
|
|
7
|
-
import { MetricsDisplay } from './metrics-display.mjs';
|
|
8
|
-
import { r as runHealthCheck } from '../shared/ccjk.D5MFQT7w.mjs';
|
|
9
|
-
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
10
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
11
|
-
import 'node:child_process';
|
|
12
|
-
import 'better-sqlite3';
|
|
13
|
-
import './constants.mjs';
|
|
14
|
-
import './index5.mjs';
|
|
15
|
-
import 'node:url';
|
|
16
|
-
|
|
17
|
-
const GRADE_COLORS = {
|
|
18
|
-
S: (s) => a.magenta.bold(s),
|
|
19
|
-
A: (s) => a.green.bold(s),
|
|
20
|
-
B: (s) => a.cyan.bold(s),
|
|
21
|
-
C: (s) => a.yellow.bold(s),
|
|
22
|
-
D: (s) => a.red(s),
|
|
23
|
-
F: (s) => a.red.bold(s)
|
|
24
|
-
};
|
|
25
|
-
const STATUS_ICONS = {
|
|
26
|
-
pass: a.green("\u2713"),
|
|
27
|
-
warn: a.yellow("\u26A0"),
|
|
28
|
-
fail: a.red("\u2717")
|
|
29
|
-
};
|
|
30
|
-
const INSTALLED = a.green("\u2713");
|
|
31
|
-
const MISSING = a.gray("\u2212");
|
|
32
|
-
function label(text) {
|
|
33
|
-
return a.gray(text);
|
|
34
|
-
}
|
|
35
|
-
function val(text) {
|
|
36
|
-
return a.white(text);
|
|
37
|
-
}
|
|
38
|
-
function heading(text) {
|
|
39
|
-
return a.cyan.bold(text);
|
|
40
|
-
}
|
|
41
|
-
function divider() {
|
|
42
|
-
return a.gray("\u2500".repeat(44));
|
|
43
|
-
}
|
|
44
|
-
function renderScoreBar(score) {
|
|
45
|
-
const filled = Math.round(score / 5);
|
|
46
|
-
const empty = 20 - filled;
|
|
47
|
-
let bar = "";
|
|
48
|
-
if (score >= 80)
|
|
49
|
-
bar = a.green("\u2588".repeat(filled));
|
|
50
|
-
else if (score >= 50)
|
|
51
|
-
bar = a.yellow("\u2588".repeat(filled));
|
|
52
|
-
else bar = a.red("\u2588".repeat(filled));
|
|
53
|
-
bar += a.gray("\u2591".repeat(empty));
|
|
54
|
-
return bar;
|
|
55
|
-
}
|
|
56
|
-
function loadInstalledSettings() {
|
|
57
|
-
const settingsPath = join(homedir(), ".claude", "settings.json");
|
|
58
|
-
try {
|
|
59
|
-
if (!existsSync(settingsPath)) return { mcpServers: {}, hooks: {} };
|
|
60
|
-
const data = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
61
|
-
return {
|
|
62
|
-
mcpServers: data.mcpServers || {},
|
|
63
|
-
hooks: data.hooks || {}
|
|
64
|
-
};
|
|
65
|
-
} catch {
|
|
66
|
-
return { mcpServers: {}, hooks: {} };
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function loadSmartDefaults() {
|
|
70
|
-
try {
|
|
71
|
-
const { detectSmartDefaults } = await import('./smart-defaults.mjs').then(function (n) { return n.s; });
|
|
72
|
-
return await detectSmartDefaults();
|
|
73
|
-
} catch {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function renderProjectSection(ctx) {
|
|
78
|
-
const lines = [];
|
|
79
|
-
lines.push(heading("Project"));
|
|
80
|
-
const fields = [
|
|
81
|
-
["Language", ctx.language],
|
|
82
|
-
["Framework", ctx.framework],
|
|
83
|
-
["Test Runner", ctx.testRunner],
|
|
84
|
-
["Pkg Manager", ctx.packageManager],
|
|
85
|
-
["Linter", ctx.linter],
|
|
86
|
-
["Formatter", ctx.formatter],
|
|
87
|
-
["Database", ctx.database === "none" ? "none" : ctx.database]
|
|
88
|
-
];
|
|
89
|
-
for (const [k, v] of fields) {
|
|
90
|
-
const display = v === "none" || v === "unknown" ? a.gray(v) : val(v);
|
|
91
|
-
lines.push(` ${label(`${k}:`.padEnd(14))} ${display}`);
|
|
92
|
-
}
|
|
93
|
-
const flags = [];
|
|
94
|
-
if (ctx.isMonorepo) flags.push("monorepo");
|
|
95
|
-
if (ctx.hasDocker) flags.push("docker");
|
|
96
|
-
if (ctx.hasCI) flags.push("CI");
|
|
97
|
-
if (ctx.hasGitHooks) flags.push("git-hooks");
|
|
98
|
-
if (ctx.usesConventionalCommits) flags.push("conventional-commits");
|
|
99
|
-
if (flags.length > 0) {
|
|
100
|
-
lines.push(` ${label("Flags:".padEnd(14))} ${val(flags.join(", "))}`);
|
|
101
|
-
}
|
|
102
|
-
return lines;
|
|
103
|
-
}
|
|
104
|
-
function renderRuntimeSection(ctx) {
|
|
105
|
-
const lines = [];
|
|
106
|
-
lines.push(heading("Runtime"));
|
|
107
|
-
const rt = ctx.runtime;
|
|
108
|
-
lines.push(` ${label("Platform:".padEnd(14))} ${val(process__default.platform)} ${a.gray(`(${process__default.arch})`)}`);
|
|
109
|
-
const envFlags = [];
|
|
110
|
-
if (rt.isContainer) envFlags.push("container");
|
|
111
|
-
if (rt.isHeadless) envFlags.push("headless");
|
|
112
|
-
if (rt.isSSH) envFlags.push("SSH");
|
|
113
|
-
if (rt.isCI) envFlags.push("CI");
|
|
114
|
-
if (rt.isWSL) envFlags.push("WSL");
|
|
115
|
-
if (envFlags.length > 0) {
|
|
116
|
-
lines.push(` ${label("Environment:".padEnd(14))} ${val(envFlags.join(", "))}`);
|
|
117
|
-
} else {
|
|
118
|
-
lines.push(` ${label("Environment:".padEnd(14))} ${a.gray("standard")}`);
|
|
119
|
-
}
|
|
120
|
-
lines.push(` ${label("Browser:".padEnd(14))} ${rt.hasBrowser ? a.green("available") : a.gray("unavailable")}`);
|
|
121
|
-
return lines;
|
|
122
|
-
}
|
|
123
|
-
function renderMcpSection(recommended, installed) {
|
|
124
|
-
const lines = [];
|
|
125
|
-
lines.push(heading("MCP Services"));
|
|
126
|
-
const installedNames = Object.keys(installed);
|
|
127
|
-
if (recommended.length === 0 && installedNames.length === 0) {
|
|
128
|
-
lines.push(` ${a.gray("No MCP services detected")}`);
|
|
129
|
-
return lines;
|
|
130
|
-
}
|
|
131
|
-
const shown = /* @__PURE__ */ new Set();
|
|
132
|
-
for (const svc of recommended) {
|
|
133
|
-
const isInstalled = installedNames.some(
|
|
134
|
-
(name) => name.toLowerCase().includes(svc.toLowerCase()) || svc.toLowerCase().includes(name.toLowerCase())
|
|
135
|
-
);
|
|
136
|
-
const icon = isInstalled ? INSTALLED : MISSING;
|
|
137
|
-
lines.push(` ${icon} ${isInstalled ? val(svc) : a.gray(svc)}`);
|
|
138
|
-
shown.add(svc.toLowerCase());
|
|
139
|
-
}
|
|
140
|
-
for (const name of installedNames) {
|
|
141
|
-
if (!shown.has(name.toLowerCase()) && !recommended.some((r) => r.toLowerCase() === name.toLowerCase())) {
|
|
142
|
-
lines.push(` ${INSTALLED} ${val(name)} ${a.gray("(extra)")}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return lines;
|
|
146
|
-
}
|
|
147
|
-
function renderHooksSection(recommended, installed) {
|
|
148
|
-
const lines = [];
|
|
149
|
-
lines.push(heading("Hooks"));
|
|
150
|
-
const installedEvents = Object.keys(installed);
|
|
151
|
-
const hasAnyHooks = installedEvents.length > 0;
|
|
152
|
-
if (recommended.length === 0 && !hasAnyHooks) {
|
|
153
|
-
lines.push(` ${a.gray("No hooks detected")}`);
|
|
154
|
-
return lines;
|
|
155
|
-
}
|
|
156
|
-
for (const hookId of recommended) {
|
|
157
|
-
const isInstalled = hasAnyHooks;
|
|
158
|
-
const icon = isInstalled ? INSTALLED : MISSING;
|
|
159
|
-
lines.push(` ${icon} ${isInstalled ? val(hookId) : a.gray(hookId)}`);
|
|
160
|
-
}
|
|
161
|
-
if (hasAnyHooks) {
|
|
162
|
-
const totalHookCount = installedEvents.reduce((sum, event) => {
|
|
163
|
-
const eventHooks = installed[event];
|
|
164
|
-
return sum + (Array.isArray(eventHooks) ? eventHooks.length : 0);
|
|
165
|
-
}, 0);
|
|
166
|
-
if (totalHookCount > 0) {
|
|
167
|
-
lines.push(` ${a.gray(`${totalHookCount} hook(s) across ${installedEvents.length} event(s)`)}`);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return lines;
|
|
171
|
-
}
|
|
172
|
-
function renderClaudeCodeSection(defaults) {
|
|
173
|
-
const lines = [];
|
|
174
|
-
lines.push(heading("Claude Code"));
|
|
175
|
-
const version = defaults?.claudeCodeVersion;
|
|
176
|
-
lines.push(` ${label("Version:".padEnd(14))} ${version ? val(version) : a.gray("not detected")}`);
|
|
177
|
-
if (defaults?.nativeFeatures) {
|
|
178
|
-
const nf = defaults.nativeFeatures;
|
|
179
|
-
const features = [];
|
|
180
|
-
if (nf.hooks) features.push("hooks");
|
|
181
|
-
if (nf.memory) features.push("memory");
|
|
182
|
-
if (nf.subagents) features.push("subagents");
|
|
183
|
-
if (nf.toolSearch) features.push("tool-search");
|
|
184
|
-
if (features.length > 0) {
|
|
185
|
-
lines.push(` ${label("Features:".padEnd(14))} ${val(features.join(", "))}`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return lines;
|
|
189
|
-
}
|
|
190
|
-
function renderCompressionMetricsSection(projectHash) {
|
|
191
|
-
const lines = [];
|
|
192
|
-
lines.push(heading("Compression Metrics"));
|
|
193
|
-
try {
|
|
194
|
-
const persistence = getContextPersistence();
|
|
195
|
-
const stats = persistence.getCompressionMetricsStats(projectHash);
|
|
196
|
-
if (stats.totalCompressions === 0) {
|
|
197
|
-
lines.push(` ${a.gray("No compression data available")}`);
|
|
198
|
-
return lines;
|
|
199
|
-
}
|
|
200
|
-
lines.push(` ${label("Total Saved:".padEnd(14))} ${a.green(MetricsDisplay.formatTokenCount(stats.totalTokensSaved))} tokens`);
|
|
201
|
-
lines.push(` ${label("Avg Reduction:".padEnd(14))} ${a.yellow(MetricsDisplay.formatRatio(stats.averageCompressionRatio))}`);
|
|
202
|
-
lines.push(` ${label("Cost Savings:".padEnd(14))} ${a.green.bold(MetricsDisplay.formatCost(stats.estimatedCostSavings))}`);
|
|
203
|
-
if (stats.sessionStats && stats.sessionStats.compressions > 0) {
|
|
204
|
-
lines.push(` ${label("Session (24h):".padEnd(14))} ${a.white(stats.sessionStats.compressions)} compressions, ${a.green(MetricsDisplay.formatCost(stats.sessionStats.costSavings))} saved`);
|
|
205
|
-
}
|
|
206
|
-
return lines;
|
|
207
|
-
} catch {
|
|
208
|
-
lines.push(` ${a.gray("Metrics unavailable")}`);
|
|
209
|
-
return lines;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
function renderHealthSection(report, compact) {
|
|
213
|
-
const lines = [];
|
|
214
|
-
lines.push(heading("Brain Dashboard"));
|
|
215
|
-
const gradeColor = GRADE_COLORS[report.grade] || ((s) => s);
|
|
216
|
-
const scoreBar = renderScoreBar(report.totalScore);
|
|
217
|
-
lines.push(` ${label("Score:".padEnd(14))} ${scoreBar} ${gradeColor(report.grade)} ${a.gray(`(${report.totalScore}/100)`)}`);
|
|
218
|
-
if (!compact) {
|
|
219
|
-
lines.push("");
|
|
220
|
-
for (const r of report.results) {
|
|
221
|
-
const icon = STATUS_ICONS[r.status];
|
|
222
|
-
const scoreText = a.gray(`${r.score}/${r.weight}`);
|
|
223
|
-
lines.push(` ${icon} ${r.name.padEnd(18)} ${scoreText.padEnd(10)} ${a.gray(r.message)}`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if (report.recommendations.length > 0) {
|
|
227
|
-
lines.push("");
|
|
228
|
-
lines.push(a.yellow.bold(" Recommendations:"));
|
|
229
|
-
for (const rec of report.recommendations.slice(0, 3)) {
|
|
230
|
-
const priority = rec.priority === "high" ? a.red("!") : rec.priority === "medium" ? a.yellow("\u2022") : a.gray("\xB7");
|
|
231
|
-
lines.push(` ${priority} ${rec.title}`);
|
|
232
|
-
if (rec.command) {
|
|
233
|
-
lines.push(` ${a.gray("\u2192")} ${a.cyan(rec.command)}`);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return lines;
|
|
238
|
-
}
|
|
239
|
-
async function statusCommand(options = {}) {
|
|
240
|
-
try {
|
|
241
|
-
const [ctx, defaults, installed, health] = await Promise.all([
|
|
242
|
-
scanProject(),
|
|
243
|
-
loadSmartDefaults(),
|
|
244
|
-
Promise.resolve(loadInstalledSettings()),
|
|
245
|
-
runHealthCheck()
|
|
246
|
-
]);
|
|
247
|
-
if (options.json) {
|
|
248
|
-
console.log(JSON.stringify({
|
|
249
|
-
project: ctx,
|
|
250
|
-
smartDefaults: defaults,
|
|
251
|
-
installed,
|
|
252
|
-
health
|
|
253
|
-
}, null, 2));
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
const sections = [];
|
|
257
|
-
sections.push(renderProjectSection(ctx));
|
|
258
|
-
sections.push(renderRuntimeSection(ctx));
|
|
259
|
-
if (defaults) {
|
|
260
|
-
sections.push(renderMcpSection(defaults.mcpServices, installed.mcpServers));
|
|
261
|
-
sections.push(renderHooksSection(defaults.recommendedHooks, installed.hooks));
|
|
262
|
-
sections.push(renderClaudeCodeSection(defaults));
|
|
263
|
-
} else {
|
|
264
|
-
sections.push(renderMcpSection([], installed.mcpServers));
|
|
265
|
-
sections.push(renderHooksSection([], installed.hooks));
|
|
266
|
-
sections.push(renderClaudeCodeSection(null));
|
|
267
|
-
}
|
|
268
|
-
sections.push(renderHealthSection(health, options.compact || false));
|
|
269
|
-
try {
|
|
270
|
-
sections.push(renderCompressionMetricsSection());
|
|
271
|
-
} catch {
|
|
272
|
-
}
|
|
273
|
-
console.log();
|
|
274
|
-
for (let i = 0; i < sections.length; i++) {
|
|
275
|
-
console.log(sections[i].join("\n"));
|
|
276
|
-
if (i < sections.length - 1) {
|
|
277
|
-
console.log();
|
|
278
|
-
console.log(divider());
|
|
279
|
-
console.log();
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
console.log();
|
|
283
|
-
} catch (error) {
|
|
284
|
-
console.error(a.red("Error running status command:"), error);
|
|
285
|
-
process__default.exit(1);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
export { statusCommand };
|