shiva-code 0.8.15 → 0.8.16
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.
|
@@ -680,15 +680,17 @@ function startCallbackServer(port) {
|
|
|
680
680
|
}
|
|
681
681
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
682
682
|
res.end(getCallbackHtml("success", { email }));
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
683
|
+
setTimeout(() => {
|
|
684
|
+
server.close();
|
|
685
|
+
resolve({
|
|
686
|
+
token,
|
|
687
|
+
user: {
|
|
688
|
+
id: parseInt(userId, 10),
|
|
689
|
+
email,
|
|
690
|
+
tier: tier || "free"
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
}, 100);
|
|
692
694
|
return;
|
|
693
695
|
}
|
|
694
696
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
@@ -697,7 +699,7 @@ function startCallbackServer(port) {
|
|
|
697
699
|
const timeout = setTimeout(() => {
|
|
698
700
|
server.close();
|
|
699
701
|
reject(new Error("Login-Timeout - keine Antwort erhalten"));
|
|
700
|
-
},
|
|
702
|
+
}, 3e5);
|
|
701
703
|
server.once("close", () => {
|
|
702
704
|
clearTimeout(timeout);
|
|
703
705
|
});
|
|
@@ -727,7 +729,7 @@ async function loginWithBrowser() {
|
|
|
727
729
|
log.newline();
|
|
728
730
|
console.log(` ${colors.cyan(loginUrl)}`);
|
|
729
731
|
log.newline();
|
|
730
|
-
log.dim("Warte auf Anmeldung... (Timeout:
|
|
732
|
+
log.dim("Warte auf Anmeldung... (Timeout: 5 Minuten)");
|
|
731
733
|
log.newline();
|
|
732
734
|
const result = await serverPromise;
|
|
733
735
|
setAuth(result.token, result.user);
|
|
@@ -1001,7 +1003,8 @@ var de_default = {
|
|
|
1001
1003
|
noResults: "Keine Ergebnisse gefunden",
|
|
1002
1004
|
enterQuery: "Suchbegriff eingeben:",
|
|
1003
1005
|
searching: "Suche...",
|
|
1004
|
-
resultsFound: "{count} Ergebnis(se) gefunden"
|
|
1006
|
+
resultsFound: "{count} Ergebnis(se) gefunden",
|
|
1007
|
+
inProjects: "in {count} Projekten"
|
|
1005
1008
|
},
|
|
1006
1009
|
forget: {
|
|
1007
1010
|
description: "Memories loschen (GDPR)",
|
|
@@ -1009,7 +1012,10 @@ var de_default = {
|
|
|
1009
1012
|
warning: "WARNUNG: Alle Memories loschen",
|
|
1010
1013
|
confirmDelete: "Memories wirklich loschen?",
|
|
1011
1014
|
deleted: "Memories geloscht",
|
|
1012
|
-
selectMemories: "Memories zum Loschen auswahlen:"
|
|
1015
|
+
selectMemories: "Memories zum Loschen auswahlen:",
|
|
1016
|
+
loadingMemories: "Lade Memories...",
|
|
1017
|
+
projectLabel: "Projekt:",
|
|
1018
|
+
pathLabel: "Pfad:"
|
|
1013
1019
|
},
|
|
1014
1020
|
sessions: {
|
|
1015
1021
|
description: "Alle Claude Code Sessions auflisten",
|
|
@@ -1609,6 +1615,7 @@ var de_default = {
|
|
|
1609
1615
|
started: "Docker-Container gestarted",
|
|
1610
1616
|
stopped: "Docker-Container gestoppt",
|
|
1611
1617
|
statusDesc: "Docker-Verfugbarkeit prufen",
|
|
1618
|
+
startDesc: "Docker-Container starten",
|
|
1612
1619
|
enableDesc: "Docker-Modus aktivieren",
|
|
1613
1620
|
disableDesc: "Docker-Modus deaktivieren",
|
|
1614
1621
|
containersDesc: "SHIVA Container anzeigen",
|
|
@@ -2106,12 +2113,18 @@ var de_default = {
|
|
|
2106
2113
|
context: {
|
|
2107
2114
|
description: "Context anzeigen",
|
|
2108
2115
|
header: "SHIVA Code - Context",
|
|
2109
|
-
noContext: "Kein Context gefunden"
|
|
2116
|
+
noContext: "Kein Context gefunden",
|
|
2117
|
+
collectingContext: "Sammle Kontext...",
|
|
2118
|
+
projectLabel: "Projekt:",
|
|
2119
|
+
pathLabel: "Pfad:",
|
|
2120
|
+
claudeMdLabel: "CLAUDE.md",
|
|
2121
|
+
claudeMdPresent: "Vorhanden ({lines} Zeilen, {size})"
|
|
2110
2122
|
},
|
|
2111
2123
|
tags: {
|
|
2112
2124
|
description: "Session-Tags verwalten",
|
|
2113
2125
|
header: "SHIVA Code - Tags",
|
|
2114
|
-
noTags: "Keine Tags gefunden"
|
|
2126
|
+
noTags: "Keine Tags gefunden",
|
|
2127
|
+
addHint: "Tag hinzuf\xFCgen: shiva tags add <session-id> <tag>"
|
|
2115
2128
|
},
|
|
2116
2129
|
export: {
|
|
2117
2130
|
description: "Sessions exportieren",
|
|
@@ -3070,7 +3083,8 @@ var en_default = {
|
|
|
3070
3083
|
noResults: "No results found",
|
|
3071
3084
|
enterQuery: "Enter search term:",
|
|
3072
3085
|
searching: "Searching...",
|
|
3073
|
-
resultsFound: "{count} result(s) found"
|
|
3086
|
+
resultsFound: "{count} result(s) found",
|
|
3087
|
+
inProjects: "in {count} projects"
|
|
3074
3088
|
},
|
|
3075
3089
|
forget: {
|
|
3076
3090
|
description: "Delete memories (GDPR)",
|
|
@@ -3078,7 +3092,10 @@ var en_default = {
|
|
|
3078
3092
|
warning: "WARNING: Delete all memories",
|
|
3079
3093
|
confirmDelete: "Really delete memories?",
|
|
3080
3094
|
deleted: "Memories deleted",
|
|
3081
|
-
selectMemories: "Select memories to delete:"
|
|
3095
|
+
selectMemories: "Select memories to delete:",
|
|
3096
|
+
loadingMemories: "Loading memories...",
|
|
3097
|
+
projectLabel: "Project:",
|
|
3098
|
+
pathLabel: "Path:"
|
|
3082
3099
|
},
|
|
3083
3100
|
sessions: {
|
|
3084
3101
|
description: "List all Claude Code sessions",
|
|
@@ -3580,6 +3597,7 @@ var en_default = {
|
|
|
3580
3597
|
started: "Docker container started",
|
|
3581
3598
|
stopped: "Docker container stopped",
|
|
3582
3599
|
statusDesc: "Check Docker availability",
|
|
3600
|
+
startDesc: "Start Docker container",
|
|
3583
3601
|
enableDesc: "Enable Docker mode",
|
|
3584
3602
|
disableDesc: "Disable Docker mode",
|
|
3585
3603
|
containersDesc: "Show SHIVA containers",
|
|
@@ -3839,12 +3857,18 @@ var en_default = {
|
|
|
3839
3857
|
context: {
|
|
3840
3858
|
description: "Show context",
|
|
3841
3859
|
header: "SHIVA Code - Context",
|
|
3842
|
-
noContext: "No context found"
|
|
3860
|
+
noContext: "No context found",
|
|
3861
|
+
collectingContext: "Collecting context...",
|
|
3862
|
+
projectLabel: "Project:",
|
|
3863
|
+
pathLabel: "Path:",
|
|
3864
|
+
claudeMdLabel: "CLAUDE.md",
|
|
3865
|
+
claudeMdPresent: "Present ({lines} lines, {size})"
|
|
3843
3866
|
},
|
|
3844
3867
|
tags: {
|
|
3845
3868
|
description: "Manage session tags",
|
|
3846
3869
|
header: "SHIVA Code - Tags",
|
|
3847
|
-
noTags: "No tags found"
|
|
3870
|
+
noTags: "No tags found",
|
|
3871
|
+
addHint: "Add tag: shiva tags add <session-id> <tag>"
|
|
3848
3872
|
},
|
|
3849
3873
|
export: {
|
|
3850
3874
|
description: "Export sessions",
|
|
@@ -4718,7 +4742,8 @@ var fr_default = {
|
|
|
4718
4742
|
noResults: "Aucun resultat trouve",
|
|
4719
4743
|
enterQuery: "Entrez le terme de recherche:",
|
|
4720
4744
|
searching: "Recherche...",
|
|
4721
|
-
resultsFound: "{count} resultat(s) trouve(s)"
|
|
4745
|
+
resultsFound: "{count} resultat(s) trouve(s)",
|
|
4746
|
+
inProjects: "dans {count} projets"
|
|
4722
4747
|
},
|
|
4723
4748
|
forget: {
|
|
4724
4749
|
description: "Supprimer les memoires (RGPD)",
|
|
@@ -4726,7 +4751,10 @@ var fr_default = {
|
|
|
4726
4751
|
warning: "ATTENTION: Supprimer toutes les memoires",
|
|
4727
4752
|
confirmDelete: "Vraiment supprimer les memoires?",
|
|
4728
4753
|
deleted: "Memoires supprimees",
|
|
4729
|
-
selectMemories: "Selectionnez les memoires a supprimer:"
|
|
4754
|
+
selectMemories: "Selectionnez les memoires a supprimer:",
|
|
4755
|
+
loadingMemories: "Chargement des memoires...",
|
|
4756
|
+
projectLabel: "Projet:",
|
|
4757
|
+
pathLabel: "Chemin:"
|
|
4730
4758
|
},
|
|
4731
4759
|
sessions: {
|
|
4732
4760
|
description: "Lister toutes les sessions Claude Code",
|
|
@@ -5162,6 +5190,7 @@ var fr_default = {
|
|
|
5162
5190
|
started: "Conteneur Docker demarre",
|
|
5163
5191
|
stopped: "Conteneur Docker arrete",
|
|
5164
5192
|
statusDesc: "Verifier la disponibilite de Docker",
|
|
5193
|
+
startDesc: "Demarrer le conteneur Docker",
|
|
5165
5194
|
enableDesc: "Activer le mode Docker",
|
|
5166
5195
|
disableDesc: "Desactiver le mode Docker",
|
|
5167
5196
|
containersDesc: "Afficher les conteneurs SHIVA",
|
|
@@ -5421,12 +5450,18 @@ var fr_default = {
|
|
|
5421
5450
|
context: {
|
|
5422
5451
|
description: "Afficher le contexte",
|
|
5423
5452
|
header: "SHIVA Code - Contexte",
|
|
5424
|
-
noContext: "Aucun contexte trouve"
|
|
5453
|
+
noContext: "Aucun contexte trouve",
|
|
5454
|
+
collectingContext: "Collecte du contexte...",
|
|
5455
|
+
projectLabel: "Projet:",
|
|
5456
|
+
pathLabel: "Chemin:",
|
|
5457
|
+
claudeMdLabel: "CLAUDE.md",
|
|
5458
|
+
claudeMdPresent: "Present ({lines} lignes, {size})"
|
|
5425
5459
|
},
|
|
5426
5460
|
tags: {
|
|
5427
5461
|
description: "Gerer les tags de session",
|
|
5428
5462
|
header: "SHIVA Code - Tags",
|
|
5429
|
-
noTags: "Aucun tag trouve"
|
|
5463
|
+
noTags: "Aucun tag trouve",
|
|
5464
|
+
addHint: "Ajouter tag: shiva tags add <session-id> <tag>"
|
|
5430
5465
|
},
|
|
5431
5466
|
export: {
|
|
5432
5467
|
description: "Exporter les sessions",
|
|
@@ -7004,6 +7039,7 @@ var es_default = {
|
|
|
7004
7039
|
started: "Contenedor Docker iniciado",
|
|
7005
7040
|
stopped: "Contenedor Docker detenido",
|
|
7006
7041
|
statusDesc: "Verificar disponibilidad de Docker",
|
|
7042
|
+
startDesc: "Iniciar contenedor Docker",
|
|
7007
7043
|
enableDesc: "Activar modo Docker",
|
|
7008
7044
|
disableDesc: "Desactivar modo Docker",
|
|
7009
7045
|
containersDesc: "Mostrar contenedores SHIVA",
|
package/dist/index.js
CHANGED
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
t,
|
|
81
81
|
tArray,
|
|
82
82
|
twoFactorService
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-LHZGVHTL.js";
|
|
84
84
|
import {
|
|
85
85
|
colors,
|
|
86
86
|
log
|
|
@@ -325,7 +325,7 @@ async function promptLogin() {
|
|
|
325
325
|
console.log("");
|
|
326
326
|
console.log(" " + colors.cyan("\u2192") + " \xD6ffne Browser...");
|
|
327
327
|
console.log("");
|
|
328
|
-
const { loginCommand: loginCommand2 } = await import("./login-
|
|
328
|
+
const { loginCommand: loginCommand2 } = await import("./login-MDBW674K.js");
|
|
329
329
|
await loginCommand2.parseAsync([], { from: "user" });
|
|
330
330
|
return isAuthenticated();
|
|
331
331
|
}
|
|
@@ -13896,8 +13896,14 @@ statsCommand.command("sessions").description(t("commands.stats.sessions.descript
|
|
|
13896
13896
|
}
|
|
13897
13897
|
const spinner = ora20(t("commands.stats.sessions.loadingAnalytics")).start();
|
|
13898
13898
|
try {
|
|
13899
|
-
const
|
|
13899
|
+
const rawAnalytics = await api2.getSessionAnalytics();
|
|
13900
13900
|
spinner.stop();
|
|
13901
|
+
const analytics = {
|
|
13902
|
+
averageSessionLength: rawAnalytics?.averageSessionLength ?? 0,
|
|
13903
|
+
peakHours: Array.isArray(rawAnalytics?.peakHours) ? rawAnalytics.peakHours : [],
|
|
13904
|
+
topProjects: Array.isArray(rawAnalytics?.topProjects) ? rawAnalytics.topProjects : [],
|
|
13905
|
+
dailySessions: Array.isArray(rawAnalytics?.dailySessions) ? rawAnalytics.dailySessions : []
|
|
13906
|
+
};
|
|
13901
13907
|
if (options.json) {
|
|
13902
13908
|
console.log(JSON.stringify(analytics, null, 2));
|
|
13903
13909
|
return;
|
|
@@ -13908,23 +13914,27 @@ statsCommand.command("sessions").description(t("commands.stats.sessions.descript
|
|
|
13908
13914
|
log.newline();
|
|
13909
13915
|
log.keyValue(t("commands.stats.sessions.avgSessionLength"), `${analytics.averageSessionLength} min`);
|
|
13910
13916
|
log.newline();
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13917
|
+
if (analytics.peakHours.length > 0) {
|
|
13918
|
+
console.log(colors.bold(t("commands.stats.sessions.peakHours")));
|
|
13919
|
+
const sortedHours = [...analytics.peakHours].sort((a, b) => b.count - a.count).slice(0, 5);
|
|
13920
|
+
for (const { hour, count } of sortedHours) {
|
|
13921
|
+
console.log(` ${String(hour).padStart(2)}:00 - ${count} sessions`);
|
|
13922
|
+
}
|
|
13923
|
+
log.newline();
|
|
13915
13924
|
}
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13925
|
+
if (analytics.topProjects.length > 0) {
|
|
13926
|
+
console.log(colors.bold(t("commands.stats.sessions.topProjectsSessions")));
|
|
13927
|
+
for (const proj of analytics.topProjects.slice(0, 5)) {
|
|
13928
|
+
console.log(` ${(proj.projectName || "Unknown").padEnd(25)} ${proj.sessionCount || 0} sessions`);
|
|
13929
|
+
}
|
|
13930
|
+
log.newline();
|
|
13920
13931
|
}
|
|
13921
|
-
log.newline();
|
|
13922
13932
|
if (analytics.dailySessions.length > 0) {
|
|
13923
13933
|
console.log(colors.bold(t("commands.stats.sessions.sessionsLast7Days")));
|
|
13924
13934
|
for (const { date, count } of analytics.dailySessions.slice(-7)) {
|
|
13925
|
-
const barLength = Math.min(20, count);
|
|
13935
|
+
const barLength = Math.min(20, count || 0);
|
|
13926
13936
|
const bar = colors.green("\u2588".repeat(barLength));
|
|
13927
|
-
console.log(` ${date.slice(5)} ${bar} ${count}`);
|
|
13937
|
+
console.log(` ${(date || "").slice(5)} ${bar} ${count || 0}`);
|
|
13928
13938
|
}
|
|
13929
13939
|
}
|
|
13930
13940
|
} catch (error) {
|
|
@@ -13948,8 +13958,14 @@ statsCommand.command("tokens").description(t("commands.stats.tokens.description"
|
|
|
13948
13958
|
}
|
|
13949
13959
|
const spinner = ora20(t("commands.stats.tokens.loadingAnalytics")).start();
|
|
13950
13960
|
try {
|
|
13951
|
-
const
|
|
13961
|
+
const rawAnalytics = await api2.getTokenAnalytics();
|
|
13952
13962
|
spinner.stop();
|
|
13963
|
+
const analytics = {
|
|
13964
|
+
totalTokens: rawAnalytics?.totalTokens ?? 0,
|
|
13965
|
+
tokensThisMonth: rawAnalytics?.tokensThisMonth ?? 0,
|
|
13966
|
+
byProject: Array.isArray(rawAnalytics?.byProject) ? rawAnalytics.byProject : [],
|
|
13967
|
+
dailyUsage: Array.isArray(rawAnalytics?.dailyUsage) ? rawAnalytics.dailyUsage : []
|
|
13968
|
+
};
|
|
13953
13969
|
if (options.json) {
|
|
13954
13970
|
console.log(JSON.stringify(analytics, null, 2));
|
|
13955
13971
|
return;
|
|
@@ -13961,18 +13977,21 @@ statsCommand.command("tokens").description(t("commands.stats.tokens.description"
|
|
|
13961
13977
|
log.keyValue(t("commands.stats.tokens.totalTokens"), formatNumber(analytics.totalTokens));
|
|
13962
13978
|
log.keyValue(t("commands.stats.tokens.thisMonth"), formatNumber(analytics.tokensThisMonth));
|
|
13963
13979
|
log.newline();
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13980
|
+
if (analytics.byProject.length > 0) {
|
|
13981
|
+
console.log(colors.bold(t("commands.stats.tokens.byProject")));
|
|
13982
|
+
for (const proj of analytics.byProject.slice(0, 5)) {
|
|
13983
|
+
console.log(` ${(proj.projectName || "Unknown").padEnd(25)} ${formatNumber(proj.tokens || 0)}`);
|
|
13984
|
+
}
|
|
13985
|
+
log.newline();
|
|
13967
13986
|
}
|
|
13968
|
-
log.newline();
|
|
13969
13987
|
if (analytics.dailyUsage.length > 0) {
|
|
13970
13988
|
console.log(colors.bold(t("commands.stats.tokens.dailyUsage")));
|
|
13971
|
-
const maxTokens = Math.max(...analytics.dailyUsage.slice(-7).map((d) => d.tokens), 1);
|
|
13989
|
+
const maxTokens = Math.max(...analytics.dailyUsage.slice(-7).map((d) => d.tokens || 0), 1);
|
|
13972
13990
|
for (const { date, tokens } of analytics.dailyUsage.slice(-7)) {
|
|
13973
|
-
const
|
|
13991
|
+
const safeTokens = tokens || 0;
|
|
13992
|
+
const barLength = Math.round(safeTokens / maxTokens * 20);
|
|
13974
13993
|
const bar = colors.cyan("\u2588".repeat(barLength)) + colors.dim("\u2591".repeat(20 - barLength));
|
|
13975
|
-
console.log(` ${date.slice(5)} ${bar} ${formatNumber(
|
|
13994
|
+
console.log(` ${(date || "").slice(5)} ${bar} ${formatNumber(safeTokens)}`);
|
|
13976
13995
|
}
|
|
13977
13996
|
}
|
|
13978
13997
|
} catch (error) {
|
|
@@ -13996,8 +14015,14 @@ statsCommand.command("tools").description(t("commands.stats.tools.description"))
|
|
|
13996
14015
|
}
|
|
13997
14016
|
const spinner = ora20(t("commands.stats.tools.loadingAnalytics")).start();
|
|
13998
14017
|
try {
|
|
13999
|
-
const
|
|
14018
|
+
const rawAnalytics = await api2.getToolAnalytics();
|
|
14000
14019
|
spinner.stop();
|
|
14020
|
+
const analytics = {
|
|
14021
|
+
totalToolCalls: rawAnalytics?.totalToolCalls ?? 0,
|
|
14022
|
+
mostUsedTools: Array.isArray(rawAnalytics?.mostUsedTools) ? rawAnalytics.mostUsedTools : [],
|
|
14023
|
+
byTool: Array.isArray(rawAnalytics?.byTool) ? rawAnalytics.byTool : [],
|
|
14024
|
+
dailyUsage: Array.isArray(rawAnalytics?.dailyUsage) ? rawAnalytics.dailyUsage : []
|
|
14025
|
+
};
|
|
14001
14026
|
if (options.json) {
|
|
14002
14027
|
console.log(JSON.stringify(analytics, null, 2));
|
|
14003
14028
|
return;
|
|
@@ -14008,16 +14033,20 @@ statsCommand.command("tools").description(t("commands.stats.tools.description"))
|
|
|
14008
14033
|
log.newline();
|
|
14009
14034
|
log.keyValue(t("commands.stats.tools.totalToolCalls"), formatNumber(analytics.totalToolCalls));
|
|
14010
14035
|
log.newline();
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
const
|
|
14014
|
-
|
|
14036
|
+
if (analytics.mostUsedTools.length > 0) {
|
|
14037
|
+
console.log(colors.bold(t("commands.stats.tools.mostUsedTools")));
|
|
14038
|
+
for (const tool of analytics.mostUsedTools.slice(0, 10)) {
|
|
14039
|
+
const bar = colors.yellow("\u2588".repeat(Math.min(20, Math.round((tool.count || 0) / 10))));
|
|
14040
|
+
console.log(` ${(tool.tool || "Unknown").padEnd(20)} ${bar} ${formatNumber(tool.count || 0)}`);
|
|
14041
|
+
}
|
|
14042
|
+
log.newline();
|
|
14015
14043
|
}
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14044
|
+
if (analytics.byTool.length > 0) {
|
|
14045
|
+
console.log(colors.bold(t("commands.stats.tools.toolPerformance")));
|
|
14046
|
+
const sorted = [...analytics.byTool].sort((a, b) => (b.avgDuration || 0) - (a.avgDuration || 0)).slice(0, 5);
|
|
14047
|
+
for (const tool of sorted) {
|
|
14048
|
+
console.log(` ${(tool.tool || "Unknown").padEnd(20)} ${(tool.avgDuration || 0).toFixed(0)}ms`);
|
|
14049
|
+
}
|
|
14021
14050
|
}
|
|
14022
14051
|
} catch (error) {
|
|
14023
14052
|
spinner.fail(t("commands.stats.tools.loadError"));
|
|
@@ -14159,8 +14188,14 @@ userCommand.command("usage").description(t("commands.user.usage.description")).o
|
|
|
14159
14188
|
}
|
|
14160
14189
|
const spinner = ora21(t("commands.user.usage.loadingUsage")).start();
|
|
14161
14190
|
try {
|
|
14162
|
-
const
|
|
14191
|
+
const rawUsage = await api.getUserUsage();
|
|
14163
14192
|
spinner.stop();
|
|
14193
|
+
const usage = {
|
|
14194
|
+
projects: { current: rawUsage?.projects?.current ?? 0, limit: rawUsage?.projects?.limit ?? 10 },
|
|
14195
|
+
sessions: { current: rawUsage?.sessions?.current ?? 0, limit: rawUsage?.sessions?.limit ?? 100 },
|
|
14196
|
+
storage: { current: rawUsage?.storage?.current ?? 0, limit: rawUsage?.storage?.limit ?? 100, unit: rawUsage?.storage?.unit ?? "MB" },
|
|
14197
|
+
apiCalls: { current: rawUsage?.apiCalls?.current ?? 0, limit: rawUsage?.apiCalls?.limit ?? 1e3, period: rawUsage?.apiCalls?.period ?? "day" }
|
|
14198
|
+
};
|
|
14164
14199
|
if (options.json) {
|
|
14165
14200
|
console.log(JSON.stringify(usage, null, 2));
|
|
14166
14201
|
return;
|
|
@@ -14170,14 +14205,15 @@ userCommand.command("usage").description(t("commands.user.usage.description")).o
|
|
|
14170
14205
|
console.log(colors.dim("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
14171
14206
|
log.newline();
|
|
14172
14207
|
const progressBar = (current, limit, label, unit) => {
|
|
14173
|
-
const
|
|
14208
|
+
const safeLimit = limit || 1;
|
|
14209
|
+
const percentage = Math.min(100, Math.round(current / safeLimit * 100));
|
|
14174
14210
|
const barWidth = 20;
|
|
14175
|
-
const filled = Math.round(current /
|
|
14211
|
+
const filled = Math.round(current / safeLimit * barWidth);
|
|
14176
14212
|
const empty = barWidth - filled;
|
|
14177
14213
|
const barColor = percentage >= 90 ? colors.red : percentage >= 70 ? colors.yellow : colors.green;
|
|
14178
14214
|
const bar = barColor("\u2588".repeat(filled)) + colors.dim("\u2591".repeat(empty));
|
|
14179
14215
|
const unitStr = unit ? ` ${unit}` : "";
|
|
14180
|
-
console.log(` ${label.padEnd(12)} [${bar}] ${current}/${
|
|
14216
|
+
console.log(` ${label.padEnd(12)} [${bar}] ${current}/${safeLimit}${unitStr} (${percentage}%)`);
|
|
14181
14217
|
};
|
|
14182
14218
|
progressBar(usage.projects.current, usage.projects.limit, "Projects");
|
|
14183
14219
|
progressBar(usage.sessions.current, usage.sessions.limit, "Sessions");
|
|
@@ -14202,8 +14238,16 @@ userCommand.command("subscription").description(t("commands.user.subscription.de
|
|
|
14202
14238
|
}
|
|
14203
14239
|
const spinner = ora21(t("commands.user.subscription.loadingSubscription")).start();
|
|
14204
14240
|
try {
|
|
14205
|
-
const
|
|
14241
|
+
const rawSub = await api.getSubscription();
|
|
14206
14242
|
spinner.stop();
|
|
14243
|
+
const sub = {
|
|
14244
|
+
tier: rawSub?.tier ?? "free",
|
|
14245
|
+
status: rawSub?.status ?? "active",
|
|
14246
|
+
billingCycle: rawSub?.billingCycle,
|
|
14247
|
+
currentPeriodEnd: rawSub?.currentPeriodEnd,
|
|
14248
|
+
cancelAtPeriodEnd: rawSub?.cancelAtPeriodEnd ?? false,
|
|
14249
|
+
features: Array.isArray(rawSub?.features) ? rawSub.features : []
|
|
14250
|
+
};
|
|
14207
14251
|
if (options.json) {
|
|
14208
14252
|
console.log(JSON.stringify(sub, null, 2));
|
|
14209
14253
|
return;
|
|
@@ -14230,8 +14274,12 @@ userCommand.command("subscription").description(t("commands.user.subscription.de
|
|
|
14230
14274
|
}
|
|
14231
14275
|
log.newline();
|
|
14232
14276
|
console.log(colors.bold(t("commands.user.subscription.features")));
|
|
14233
|
-
|
|
14234
|
-
|
|
14277
|
+
if (sub.features.length > 0) {
|
|
14278
|
+
for (const feature of sub.features) {
|
|
14279
|
+
console.log(` ${colors.green("\u2713")} ${feature}`);
|
|
14280
|
+
}
|
|
14281
|
+
} else {
|
|
14282
|
+
console.log(` ${colors.dim(t("commands.user.subscription.noFeatures") || "No features available")}`);
|
|
14235
14283
|
}
|
|
14236
14284
|
if (sub.tier === "free") {
|
|
14237
14285
|
log.newline();
|