@oh-my-pi/pi-utils 15.2.2 → 15.2.4

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.
@@ -63,7 +63,7 @@ export declare function getPluginsPackageJson(): string;
63
63
  export declare function getPluginsLockfile(): string;
64
64
  /** Get the remote mount directory (~/.omp/remote). */
65
65
  export declare function getRemoteDir(): string;
66
- /** Get the PR worktrees directory (~/.omp/wt). */
66
+ /** Get the agent-managed worktrees directory (~/.omp/wt). */
67
67
  export declare function getWorktreesDir(): string;
68
68
  /** Get the SSH control socket directory (~/.omp/ssh-control). */
69
69
  export declare function getSshControlDir(): string;
@@ -75,10 +75,18 @@ export declare function getPythonEnvDir(): string;
75
75
  export declare function getPythonGatewayDir(): string;
76
76
  /** Get the puppeteer sandbox directory (~/.omp/puppeteer). */
77
77
  export declare function getPuppeteerDir(): string;
78
- /** Get the worktree base directory (~/.omp/wt). */
79
- export declare function getWorktreeBaseDir(): string;
80
- /** Get the path to a worktree directory (~/.omp/wt/<project>/<id>). */
81
- export declare function getWorktreeDir(encodedProject: string, id: string): string;
78
+ /**
79
+ * Stable 7-character hex digest of an absolute filesystem path.
80
+ *
81
+ * Used to pack the project identity into a single short fs-safe segment
82
+ * (e.g. PR-checkout and task-isolation worktree dirs under `~/.omp/wt/`).
83
+ * Bun.hash is non-cryptographic — collision space is ~2^28, which is fine
84
+ * for naming a handful of repos on a single machine. Same input on the
85
+ * same Bun runtime yields the same output.
86
+ */
87
+ export declare function hashPath(absPath: string): string;
88
+ /** Get the path to a single worktree directory (~/.omp/wt/<segment>). */
89
+ export declare function getWorktreeDir(segment: string): string;
82
90
  /** Get the GPU cache path (~/.omp/gpu_cache.json). */
83
91
  export declare function getGpuCachePath(): string;
84
92
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-utils",
4
- "version": "15.2.2",
4
+ "version": "15.2.4",
5
5
  "description": "Shared utilities for pi packages",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
@@ -31,7 +31,7 @@
31
31
  "fmt": "biome format --write ."
32
32
  },
33
33
  "dependencies": {
34
- "@oh-my-pi/pi-natives": "15.2.2",
34
+ "@oh-my-pi/pi-natives": "15.2.4",
35
35
  "beautiful-mermaid": "^1.1.3",
36
36
  "handlebars": "^4.7.9",
37
37
  "winston": "^3.19.0",
package/src/dirs.ts CHANGED
@@ -279,7 +279,7 @@ export function getRemoteDir(): string {
279
279
  return dirs.rootSubdir("remote", "data");
280
280
  }
281
281
 
282
- /** Get the PR worktrees directory (~/.omp/wt). */
282
+ /** Get the agent-managed worktrees directory (~/.omp/wt). */
283
283
  export function getWorktreesDir(): string {
284
284
  return dirs.rootSubdir("wt", "data");
285
285
  }
@@ -309,14 +309,22 @@ export function getPuppeteerDir(): string {
309
309
  return dirs.rootSubdir("puppeteer", "cache");
310
310
  }
311
311
 
312
- /** Get the worktree base directory (~/.omp/wt). */
313
- export function getWorktreeBaseDir(): string {
314
- return dirs.rootSubdir("wt", "data");
312
+ /**
313
+ * Stable 7-character hex digest of an absolute filesystem path.
314
+ *
315
+ * Used to pack the project identity into a single short fs-safe segment
316
+ * (e.g. PR-checkout and task-isolation worktree dirs under `~/.omp/wt/`).
317
+ * Bun.hash is non-cryptographic — collision space is ~2^28, which is fine
318
+ * for naming a handful of repos on a single machine. Same input on the
319
+ * same Bun runtime yields the same output.
320
+ */
321
+ export function hashPath(absPath: string): string {
322
+ return Bun.hash(path.resolve(absPath)).toString(16).padStart(16, "0").slice(-7);
315
323
  }
316
324
 
317
- /** Get the path to a worktree directory (~/.omp/wt/<project>/<id>). */
318
- export function getWorktreeDir(encodedProject: string, id: string): string {
319
- return path.join(getWorktreeBaseDir(), encodedProject, id);
325
+ /** Get the path to a single worktree directory (~/.omp/wt/<segment>). */
326
+ export function getWorktreeDir(segment: string): string {
327
+ return path.join(getWorktreesDir(), segment);
320
328
  }
321
329
 
322
330
  /** Get the GPU cache path (~/.omp/gpu_cache.json). */