@threadbase-sh/scanner 0.11.5 → 0.12.1

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/cli.js CHANGED
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
  import pino2 from "pino";
6
6
 
7
7
  // package.json
8
- var version = "0.11.5";
8
+ var version = "0.12.1";
9
9
 
10
10
  // src/logger.ts
11
11
  import pino from "pino";
@@ -647,7 +647,7 @@ function finalizeMeta(state, filePath, account, tier) {
647
647
  filePath,
648
648
  provider: CLAUDE_CODE_PROVIDER,
649
649
  sessionId: state.sessionId || basename(filePath, ".jsonl"),
650
- sessionName: state.sessionName,
650
+ sessionName: state.sessionName || deriveSessionNameFromFirstMessage(state.firstMessage),
651
651
  projectPath,
652
652
  projectName: getShortProjectName(projectPath),
653
653
  account,
@@ -668,6 +668,10 @@ function finalizeMeta(state, filePath, account, tier) {
668
668
  lastPrompt: state.lastPrompt || void 0
669
669
  };
670
670
  }
671
+ function deriveSessionNameFromFirstMessage(firstMessage) {
672
+ const firstLine = firstMessage?.text.split("\n", 1)[0]?.trim() ?? "";
673
+ return firstLine.slice(0, 80);
674
+ }
671
675
  function getShortProjectName(fullPath) {
672
676
  const parts = fullPath.split("/").filter(Boolean);
673
677
  return parts.slice(-3).join("/");
@@ -787,7 +791,7 @@ async function parseConversation(filePath, account) {
787
791
  projectPath: state.cwd,
788
792
  projectName: getShortProjectName2(state.cwd),
789
793
  sessionId: state.sessionId || basename2(filePath, ".jsonl"),
790
- sessionName: state.sessionName,
794
+ sessionName: state.sessionName || deriveSessionNameFromFirstMessage(messages.find((m) => m.role === "user" && m.text) ?? null),
791
795
  messages,
792
796
  fullText: textParts.join(" "),
793
797
  timestamp: state.latestTimestamp || (/* @__PURE__ */ new Date()).toISOString(),
@@ -1052,7 +1056,7 @@ function assemble(filePath, account, messages, fullText, turnDurations, state) {
1052
1056
  projectPath: state.cwd,
1053
1057
  projectName: getShortProjectName2(state.cwd),
1054
1058
  sessionId: state.sessionId || basename3(filePath, ".jsonl"),
1055
- sessionName: state.sessionName,
1059
+ sessionName: state.sessionName || deriveSessionNameFromFirstMessage(messages.find((m) => m.role === "user" && m.text) ?? null),
1056
1060
  messages,
1057
1061
  fullText,
1058
1062
  timestamp: state.latestTimestamp || (/* @__PURE__ */ new Date()).toISOString(),