jupyterlab_claude_code_extension 1.2.4 → 1.2.5

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/lib/widget.d.ts CHANGED
@@ -92,6 +92,11 @@ export declare class ClaudeCodeSessionsWidget extends Widget {
92
92
  * case the file browser has no way to address it. */
93
93
  private _pathUnderRoot;
94
94
  private _formatRelativeTime;
95
+ /** Branch entry display: conversation name plus short session id in
96
+ * brackets; branches share the project path so only the name and id
97
+ * distinguish them. Skips the suffix when the label already is the
98
+ * short id (the backend's last-resort fallback). */
99
+ private _branchDisplayName;
95
100
  private _setRefreshSpinning;
96
101
  private _setActiveRow;
97
102
  private _setupContextMenu;
package/lib/widget.js CHANGED
@@ -914,6 +914,14 @@ export class ClaudeCodeSessionsWidget extends Widget {
914
914
  }
915
915
  return `${Math.floor(diff / 86400000)}d ago`;
916
916
  }
917
+ /** Branch entry display: conversation name plus short session id in
918
+ * brackets; branches share the project path so only the name and id
919
+ * distinguish them. Skips the suffix when the label already is the
920
+ * short id (the backend's last-resort fallback). */
921
+ _branchDisplayName(b) {
922
+ const shortId = b.session_id.slice(0, 8);
923
+ return b.label === shortId ? b.label : `${b.label} (${shortId})`;
924
+ }
917
925
  _setRefreshSpinning(on) {
918
926
  if (!this._refreshBtn) {
919
927
  return;
@@ -1133,7 +1141,7 @@ export class ClaudeCodeSessionsWidget extends Widget {
1133
1141
  command: 'claude-code-sessions:switch-branch',
1134
1142
  args: {
1135
1143
  session_id: b.session_id,
1136
- label: `${b.label} - ${this._formatRelativeTime(b.file_mtime)}`
1144
+ label: `${this._branchDisplayName(b)} - ${this._formatRelativeTime(b.file_mtime)}`
1137
1145
  }
1138
1146
  });
1139
1147
  }
@@ -1190,7 +1198,7 @@ export class ClaudeCodeSessionsWidget extends Widget {
1190
1198
  row.title = `Session id: ${b.session_id}`;
1191
1199
  const label = document.createElement('span');
1192
1200
  label.className = 'jp-ClaudeSessionsPanel-branchLabel';
1193
- label.textContent = b.label;
1201
+ label.textContent = this._branchDisplayName(b);
1194
1202
  row.appendChild(label);
1195
1203
  const time = document.createElement('span');
1196
1204
  time.className = 'jp-ClaudeSessionsPanel-branchTime';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jupyterlab_claude_code_extension",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "Browse, resume, and manage your Claude Code CLI sessions from a JupyterLab side panel. One click reactivates the right terminal - no duplicate tabs, live remote-control indicator, and favourites for the projects you keep coming back to.",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -157,6 +157,20 @@ describe('launch spinner dismiss contract', () => {
157
157
  );
158
158
  });
159
159
 
160
+ it('branch entries render name plus short id via _branchDisplayName', () => {
161
+ const display = (widgetSrc.match(
162
+ /private _branchDisplayName[\s\S]*?\n \}/
163
+ ) ?? [''])[0];
164
+ expect(display).toMatch(/session_id\.slice\(0, 8\)/);
165
+ expect(display).toMatch(/`\$\{b\.label\} \(\$\{shortId\}\)`/);
166
+ expect(widgetSrc).toMatch(
167
+ /label: `\$\{this\._branchDisplayName\(b\)\} - \$\{this\._formatRelativeTime\(b\.file_mtime\)\}`/
168
+ );
169
+ expect(widgetSrc).toMatch(
170
+ /label\.textContent = this\._branchDisplayName\(b\)/
171
+ );
172
+ });
173
+
160
174
  it('More... popup filters by label or session id and switches on click', () => {
161
175
  const popup = (widgetSrc.match(
162
176
  /private _showBranchPopup[\s\S]*?\n \}/
package/src/widget.ts CHANGED
@@ -1068,6 +1068,15 @@ export class ClaudeCodeSessionsWidget extends Widget {
1068
1068
  return `${Math.floor(diff / 86_400_000)}d ago`;
1069
1069
  }
1070
1070
 
1071
+ /** Branch entry display: conversation name plus short session id in
1072
+ * brackets; branches share the project path so only the name and id
1073
+ * distinguish them. Skips the suffix when the label already is the
1074
+ * short id (the backend's last-resort fallback). */
1075
+ private _branchDisplayName(b: IBranch): string {
1076
+ const shortId = b.session_id.slice(0, 8);
1077
+ return b.label === shortId ? b.label : `${b.label} (${shortId})`;
1078
+ }
1079
+
1071
1080
  private _setRefreshSpinning(on: boolean): void {
1072
1081
  if (!this._refreshBtn) {
1073
1082
  return;
@@ -1320,7 +1329,7 @@ export class ClaudeCodeSessionsWidget extends Widget {
1320
1329
  command: 'claude-code-sessions:switch-branch',
1321
1330
  args: {
1322
1331
  session_id: b.session_id,
1323
- label: `${b.label} - ${this._formatRelativeTime(b.file_mtime)}`
1332
+ label: `${this._branchDisplayName(b)} - ${this._formatRelativeTime(b.file_mtime)}`
1324
1333
  }
1325
1334
  });
1326
1335
  }
@@ -1385,7 +1394,7 @@ export class ClaudeCodeSessionsWidget extends Widget {
1385
1394
 
1386
1395
  const label = document.createElement('span');
1387
1396
  label.className = 'jp-ClaudeSessionsPanel-branchLabel';
1388
- label.textContent = b.label;
1397
+ label.textContent = this._branchDisplayName(b);
1389
1398
  row.appendChild(label);
1390
1399
 
1391
1400
  const time = document.createElement('span');