storyforge 0.4.19 → 0.4.20
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.
|
@@ -117,11 +117,9 @@ function parseCodexFile(file) {
|
|
|
117
117
|
async function gatherCliUsage() {
|
|
118
118
|
const claudeEntries = [];
|
|
119
119
|
let claudeFileCount = 0;
|
|
120
|
+
let claudeError;
|
|
120
121
|
try {
|
|
121
|
-
const blocks = await loadSessionBlockData(
|
|
122
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
123
|
-
{ offline: true }
|
|
124
|
-
);
|
|
122
|
+
const blocks = await loadSessionBlockData();
|
|
125
123
|
for (const block of blocks) {
|
|
126
124
|
const entries = block.entries ?? [];
|
|
127
125
|
for (const e of entries) {
|
|
@@ -144,7 +142,8 @@ async function gatherCliUsage() {
|
|
|
144
142
|
}
|
|
145
143
|
claudeFileCount = listJsonlFiles(path.join(os.homedir(), ".claude", "projects")).length;
|
|
146
144
|
} catch (err) {
|
|
147
|
-
|
|
145
|
+
claudeError = err.message ?? String(err);
|
|
146
|
+
console.error("[cli-usage] ccusage loader failed:", claudeError);
|
|
148
147
|
}
|
|
149
148
|
const codexDir = path.join(os.homedir(), ".codex", "sessions");
|
|
150
149
|
const codexFiles = listJsonlFiles(codexDir);
|
|
@@ -214,7 +213,8 @@ async function gatherCliUsage() {
|
|
|
214
213
|
sources: {
|
|
215
214
|
claudeFiles: claudeFileCount,
|
|
216
215
|
codexFiles: codexFiles.length,
|
|
217
|
-
skipped: 0
|
|
216
|
+
skipped: 0,
|
|
217
|
+
claudeError
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
220
|
}
|
package/dist/index.js
CHANGED
|
@@ -839,6 +839,17 @@ async function devCommand(options) {
|
|
|
839
839
|
if (env.loaded.length > 0) {
|
|
840
840
|
log.info(`Loaded env: ${env.loaded.join(", ")} from ${env.sources.join(", ")}`);
|
|
841
841
|
}
|
|
842
|
+
void (async () => {
|
|
843
|
+
try {
|
|
844
|
+
const { gatherCliUsage, CLI_USAGE_PARSER_VERSION } = await import("./cli-usage-7QODAG26.js");
|
|
845
|
+
const report = await gatherCliUsage();
|
|
846
|
+
const g = global;
|
|
847
|
+
g.__forgeCliUsageCache = { at: Date.now(), ver: CLI_USAGE_PARSER_VERSION, data: report };
|
|
848
|
+
log.info(`[cli-usage] warmed cache \xB7 ${report.sources.claudeFiles} claude, ${report.sources.codexFiles} codex sessions${report.sources.claudeError ? ` (claude error: ${report.sources.claudeError.slice(0, 80)})` : ""}`);
|
|
849
|
+
} catch (err) {
|
|
850
|
+
log.warn(`[cli-usage] warm-up failed: ${err.message}`);
|
|
851
|
+
}
|
|
852
|
+
})();
|
|
842
853
|
const counts = scanAssets(dir);
|
|
843
854
|
const total = Object.values(counts).reduce((a, b) => a + b, 0);
|
|
844
855
|
if (total > 0) {
|
|
@@ -866,7 +877,7 @@ async function devCommand(options) {
|
|
|
866
877
|
const pathname = url.pathname;
|
|
867
878
|
if (pathname === "/api/cli-usage") {
|
|
868
879
|
try {
|
|
869
|
-
const { gatherCliUsage, CLI_USAGE_PARSER_VERSION } = await import("./cli-usage-
|
|
880
|
+
const { gatherCliUsage, CLI_USAGE_PARSER_VERSION } = await import("./cli-usage-7QODAG26.js");
|
|
870
881
|
const g = global;
|
|
871
882
|
const now = Date.now();
|
|
872
883
|
if (g.__forgeCliUsageCache && g.__forgeCliUsageCache.ver === CLI_USAGE_PARSER_VERSION && now - g.__forgeCliUsageCache.at < 3e4) {
|