pi-goosedump 0.6.0 → 0.6.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.
Files changed (2) hide show
  1. package/index.ts +7 -15
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -13,10 +13,10 @@ import type {
13
13
  import { defineTool } from '@earendil-works/pi-coding-agent';
14
14
 
15
15
  import { execFileSync } from 'node:child_process';
16
- import { type Dirent, existsSync, readdirSync, readFileSync } from 'node:fs';
16
+ import { type Dirent, existsSync, readdirSync } from 'node:fs';
17
17
  import { createRequire } from 'node:module';
18
18
  import { homedir } from 'node:os';
19
- import { basename, join } from 'node:path';
19
+ import { basename, extname, join } from 'node:path';
20
20
 
21
21
  import {
22
22
  Key,
@@ -269,7 +269,7 @@ function piSessionsDir(): string {
269
269
 
270
270
  // goosedump's `list` no longer reports session file paths, so map each pi
271
271
  // session id back to its file by scanning the sessions tree, matching the same
272
- // id goosedump derives from the session header.
272
+ // id goosedump derives from the session file stem.
273
273
  function indexPiSessionPaths(): Map<string, string> {
274
274
  const paths = new Map<string, string>();
275
275
  const walk = (dir: string): void => {
@@ -448,19 +448,11 @@ export default function (pi: ExtensionAPI) {
448
448
  function sessionFileContextId(sessionFile: string | null | undefined): string | null {
449
449
  if (!sessionFile) return null;
450
450
 
451
+ // goosedump 0.6+ derives a pi context id from the session file stem (file name
452
+ // without its extension), so match that exactly rather than the inner UUID.
451
453
  const name = basename(sessionFile);
452
- const nameMatch = name.match(
453
- /(?:^|_)([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i,
454
- );
455
- if (nameMatch) return nameMatch[1];
456
-
457
- try {
458
- const firstLine = readFileSync(sessionFile, 'utf-8').split(/\r?\n/, 1)[0];
459
- const header = JSON.parse(firstLine) as { id?: unknown };
460
- return typeof header.id === 'string' && header.id.length > 0 ? header.id : null;
461
- } catch {
462
- return null;
463
- }
454
+ const ext = extname(name);
455
+ return ext ? name.slice(0, -ext.length) : name;
464
456
  }
465
457
 
466
458
  function currentSessionContextId(ctx: ExtensionContext): string | null {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-goosedump",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Coding agent context data browser plugin for pi",
5
5
  "keywords": [
6
6
  "goosedump",