@basestream/cli 0.2.10 → 0.2.11

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +35 -3
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -604,6 +604,7 @@ function readSessionAccumulator(sessionId) {
604
604
  const raw = JSON.parse(fs5.readFileSync(sessionFile, "utf-8"));
605
605
  raw.filesWritten = new Set(raw.filesWritten || []);
606
606
  raw.commitShas = new Set(raw.commitShas || []);
607
+ raw.userMessages = raw.userMessages || [];
607
608
  return raw;
608
609
  } catch {
609
610
  return null;
@@ -614,7 +615,9 @@ function writeSessionAccumulator(acc) {
614
615
  const serializable = {
615
616
  ...acc,
616
617
  filesWritten: Array.from(acc.filesWritten),
617
- commitShas: Array.from(acc.commitShas)
618
+ commitShas: Array.from(acc.commitShas),
619
+ userMessages: acc.userMessages.slice(0, 5)
620
+ // Keep at most 5
618
621
  };
619
622
  fs5.writeFileSync(sessionFile, JSON.stringify(serializable, null, 2));
620
623
  }
@@ -631,6 +634,16 @@ function analyzeTranscript(transcriptPath, acc) {
631
634
  }
632
635
  const message = entry.message;
633
636
  const contentBlocks = Array.isArray(message?.content) ? message.content : [];
637
+ if (entry.type === "user" && contentBlocks.length > 0) {
638
+ for (const block of contentBlocks) {
639
+ if (block.type === "text" && typeof block.text === "string") {
640
+ const text = block.text.trim();
641
+ if (text.length > 0 && acc.userMessages.length < 5) {
642
+ acc.userMessages.push(text.slice(0, 200));
643
+ }
644
+ }
645
+ }
646
+ }
634
647
  if (entry.type === "assistant" && contentBlocks.length > 0) {
635
648
  const hasText = contentBlocks.some(
636
649
  (b) => b.type === "text" || b.type === "thinking"
@@ -744,6 +757,7 @@ function flushToBuffer(acc) {
744
757
  prUrl: null,
745
758
  ticketUrl: null,
746
759
  commitShas: Array.from(acc.commitShas),
760
+ userMessages: acc.userMessages.slice(0, 5),
747
761
  visibility: Visibility.TEAM,
748
762
  bufferedAt: now.toISOString()
749
763
  };
@@ -757,8 +771,23 @@ function flushToBuffer(acc) {
757
771
  function buildSummary(acc, category) {
758
772
  const fileCount = acc.filesWritten.size;
759
773
  const commitCount = acc.commitShas.size;
760
- const toolCount = acc.toolCalls.length;
761
774
  const project = acc.projectName || "unknown project";
775
+ const firstMsg = acc.userMessages[0];
776
+ if (firstMsg) {
777
+ let description = firstMsg.split(/[.\n]/)[0].trim();
778
+ if (description.length > 120) {
779
+ description = description.slice(0, 120).replace(/\s+\S*$/, "") + "...";
780
+ }
781
+ const stats = [];
782
+ if (fileCount > 0) {
783
+ stats.push(`${fileCount} file${fileCount !== 1 ? "s" : ""}`);
784
+ }
785
+ if (commitCount > 0) {
786
+ stats.push(`${commitCount} commit${commitCount !== 1 ? "s" : ""}`);
787
+ }
788
+ const suffix = stats.length > 0 ? ` (${stats.join(", ")} in ${project})` : ` in ${project}`;
789
+ return description + suffix;
790
+ }
762
791
  const parts = [];
763
792
  if (category !== WorkCategory.OTHER) {
764
793
  parts.push(category.toLowerCase());
@@ -770,6 +799,7 @@ function buildSummary(acc, category) {
770
799
  parts.push(`${commitCount} commit${commitCount !== 1 ? "s" : ""}`);
771
800
  }
772
801
  if (fileCount === 0 && commitCount === 0) {
802
+ const toolCount = acc.toolCalls.length;
773
803
  if (toolCount > 0) {
774
804
  const uniqueTools = [...new Set(acc.toolCalls.map((t) => t.tool))];
775
805
  parts.push(`${acc.turns} turn${acc.turns !== 1 ? "s" : ""}, ${toolCount} tool call${toolCount !== 1 ? "s" : ""} (${uniqueTools.slice(0, 3).join(", ")})`);
@@ -834,6 +864,7 @@ async function hookStop() {
834
864
  toolCalls: [],
835
865
  filesWritten: /* @__PURE__ */ new Set(),
836
866
  commitShas: /* @__PURE__ */ new Set(),
867
+ userMessages: [],
837
868
  gitBranch: gitInfo.branch,
838
869
  gitRepo: gitInfo.repo,
839
870
  projectName: gitInfo.projectName
@@ -842,6 +873,7 @@ async function hookStop() {
842
873
  }
843
874
  acc.turns = 0;
844
875
  acc.toolCalls = [];
876
+ acc.userMessages = [];
845
877
  if (transcript_path) {
846
878
  acc = analyzeTranscript(transcript_path, acc);
847
879
  }
@@ -982,7 +1014,7 @@ async function main() {
982
1014
  process.exit(0);
983
1015
  }
984
1016
  if (command === "--version" || command === "-v") {
985
- console.log(true ? "0.2.10" : "dev");
1017
+ console.log(true ? "0.2.11" : "dev");
986
1018
  process.exit(0);
987
1019
  }
988
1020
  switch (command || "init") {
package/package.json CHANGED
@@ -18,5 +18,5 @@
18
18
  "unlink:cli": "npm unlink -g @basestream/cli"
19
19
  },
20
20
  "type": "module",
21
- "version": "0.2.10"
21
+ "version": "0.2.11"
22
22
  }