@ai-dossier/worktree-pool 0.4.0 → 0.5.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/README.md CHANGED
@@ -4,7 +4,9 @@
4
4
  [![npm downloads](https://img.shields.io/npm/dm/@ai-dossier/worktree-pool)](https://www.npmjs.com/package/@ai-dossier/worktree-pool)
5
5
  [![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](https://github.com/imboard-ai/ai-dossier/blob/main/LICENSE)
6
6
 
7
- Pre-warmed git worktree pool for instant issue setup. Eliminates the ~3-5 minute cold start (git worktree add + npm install + build) by maintaining a pool of ready-to-use worktrees.
7
+ Pre-warmed git worktree pool for instant issue setup. Eliminates the ~3-5 minute cold start (git worktree add + install + build) by maintaining a pool of ready-to-use worktrees.
8
+
9
+ Works with pnpm, yarn, bun and npm — the package manager, lockfile and build command are detected from the project, or pinned explicitly in `.worktree-pool.json`.
8
10
 
9
11
  ## Install
10
12
 
@@ -29,8 +31,9 @@ Requires Node.js >= 20.0.0.
29
31
  | `worktree-pool claim --issue N --branch B` | Claim a warm worktree, print path |
30
32
  | `worktree-pool return --path P` | Return worktree to pool for reuse |
31
33
  | `worktree-pool refresh` | Fetch origin + rebuild in all warm worktrees |
32
- | `worktree-pool gc` | Remove stale/orphaned/excess worktrees |
34
+ | `worktree-pool gc [--dry-run] [--yes]` | Remove stale/orphaned pool worktrees (never anything else) |
33
35
  | `worktree-pool init` | Configure pool directory for this project |
36
+ | `worktree-pool detect [dir]` | Print the detected package-manager env as JSON |
34
37
 
35
38
  ## Quick Start
36
39
 
@@ -51,8 +54,9 @@ cd "$WORKTREE_PATH"
51
54
  # Return worktree to pool when done
52
55
  worktree-pool return --path "$WORKTREE_PATH"
53
56
 
54
- # Clean up stale worktrees
55
- worktree-pool gc
57
+ # Clean up stale worktrees (prints the plan first, then asks)
58
+ worktree-pool gc --dry-run # show what would go
59
+ worktree-pool gc --yes # remove it, no prompt (required when stdin is not a TTY)
56
60
  ```
57
61
 
58
62
  ## How It Works
@@ -61,15 +65,17 @@ worktree-pool gc
61
65
  replenish claim return
62
66
  | | |
63
67
  v v v
64
- origin/main ──> [warm worktree] ──> [assigned] ──> [recycled/warm]
65
- npm install rename to reset to
68
+ base_ref ──> [warm worktree] ──> [assigned] ──> [recycled/warm]
69
+ install rename to reset to
66
70
  + build feature branch temp branch
67
71
  ```
68
72
 
69
- 1. **Replenish** creates worktrees from `origin/main` on temp branches, runs `npm install` and builds
73
+ 1. **Replenish** creates worktrees from `base_ref` (default `origin/main`) on temp branches, then runs the warm commands (install + build)
70
74
  2. **Claim** renames a warm worktree, switches to your feature branch — instant setup (~2s)
71
75
  3. **Return** recycles the worktree back to pool on a fresh temp branch
72
- 4. **GC** removes stale entries (>72h) and reconciles disk state vs pool state
76
+ 4. **GC** removes stale entries (>72h) and reconciles disk state vs pool state — only for worktrees the pool created (see [Sharing the pool directory](#sharing-the-pool-directory))
77
+
78
+ Claim and return only re-run the warm commands when the project's lockfile changed between the worktree's base commit and `base_ref` — otherwise the existing `node_modules` and build output are reused.
73
79
 
74
80
  ### Pool State
75
81
 
@@ -82,9 +88,50 @@ creating -> warming -> warm -> assigned -> recycling -> warm
82
88
 
83
89
  Concurrent access is protected by atomic `mkdir`-based file locking.
84
90
 
91
+ ## Sharing the pool directory
92
+
93
+ `pool_dir` may be — and usually is — the same directory you keep your own
94
+ worktrees in. **The pool never touches a worktree it did not create.**
95
+
96
+ A worktree in `pool_dir` belongs to the pool only when either:
97
+
98
+ - its path is recorded in `.pool-state.json`, **or**
99
+ - its directory name matches the pool's own `pool-<timestamp>-<pid>` naming
100
+ **and** it has a `pool/spare-*` temp branch checked out.
101
+
102
+ Everything else — your branch worktrees, plain directories, even a directory
103
+ that happens to match the pool's naming but is on a branch of yours — is
104
+ *foreign*. Foreign worktrees are listed by `status` and `gc` as
105
+ `foreign, skipped` and are never removed, reset, or cleaned by `gc`, `refresh`,
106
+ or a failed `return`. Branches are held to the same rule: `gc` only ever deletes
107
+ `pool/spare-*` refs.
108
+
109
+ Because deletions are irreversible for uncommitted work, `gc` also prints the
110
+ exact list it is about to remove and then either asks for confirmation (TTY) or
111
+ requires `--yes`. Use `--dry-run` to see the plan and exit.
112
+
113
+ ```bash
114
+ $ worktree-pool gc --dry-run
115
+ Will remove 1 item(s):
116
+ [stale] /repo/../worktrees/pool-1750000000000-4242
117
+ stale past 72h (warmed 2026-08-13T15:13:22.790Z); recorded in .pool-state.json
118
+
119
+ Foreign, skipped (2) — not created by the pool:
120
+ /repo/../worktrees/2332-budget-composable-dashboard
121
+ not recorded in .pool-state.json and the directory name does not match the pool's own pool-<timestamp>-<pid> naming
122
+ /repo/../worktrees/fix-1173-playwright-start
123
+ not recorded in .pool-state.json and the directory name does not match the pool's own pool-<timestamp>-<pid> naming
124
+
125
+ Dry run — nothing was removed.
126
+ ```
127
+
128
+ If a pool worktree's directory has drifted — the recorded path now holds a
129
+ different branch — `gc` drops the stale row from `.pool-state.json` and leaves
130
+ the directory on disk rather than guessing.
131
+
85
132
  ## Configuration
86
133
 
87
- Default pool settings (configurable via `.pool-state.json`):
134
+ ### Pool sizing — `.pool-state.json`
88
135
 
89
136
  | Setting | Default | Description |
90
137
  |---------|---------|-------------|
@@ -92,6 +139,60 @@ Default pool settings (configurable via `.pool-state.json`):
92
139
  | `max_pool_size` | 10 | Maximum total worktrees in pool |
93
140
  | `stale_after_hours` | 72 | Hours before a warm worktree is considered stale |
94
141
 
142
+ ### Project layout — `.worktree-pool.json`
143
+
144
+ Lives at the repo root. Every key is optional; `worktree-pool init` writes `pool_dir` into it without touching the others.
145
+
146
+ | Key | Default | Description |
147
+ |-----|---------|-------------|
148
+ | `pool_dir` | `../worktrees` | Directory holding pool worktrees, relative to the repo root |
149
+ | `project_subdir` | _(none)_ | Package root relative to the worktree root, for repos whose `package.json` is nested (e.g. `"main"`). Warm commands run here, and the lockfile is looked for here |
150
+ | `warm_commands` | _(detected)_ | Explicit warm-up commands as argv arrays. Wins over detection |
151
+ | `base_ref` | `origin/main` | Ref that pool worktrees are branched from and reset to. The remote to fetch is taken from its prefix (`upstream/develop` fetches `upstream`) |
152
+
153
+ ```json
154
+ {
155
+ "pool_dir": "../worktrees",
156
+ "project_subdir": "main",
157
+ "base_ref": "origin/develop",
158
+ "warm_commands": [
159
+ ["pnpm", "install", "--frozen-lockfile", "--prefer-offline"],
160
+ ["pnpm", "run", "build:libs"]
161
+ ]
162
+ }
163
+ ```
164
+
165
+ ### Package-manager detection
166
+
167
+ When `warm_commands` is not set, the warm-up is derived from the project directory (`<worktree>/<project_subdir>`):
168
+
169
+ 1. **Package manager** — the `packageManager` field in `package.json` wins; otherwise the first lockfile found, probed in the order `pnpm-lock.yaml`, `yarn.lock`, `bun.lockb` / `bun.lock`, `package-lock.json`; otherwise npm.
170
+ 2. **Install** — the frozen variant when the lockfile is present, a plain install when it is not (`npm ci`, `pnpm install --frozen-lockfile`, and `yarn install --immutable` all fail without a lockfile).
171
+ 3. **Build** — `build:libs` if that script exists, else `build`, else no build step.
172
+
173
+ | Manager | Lockfile | Install (lockfile present) | Install (no lockfile) |
174
+ |---------|----------|----------------------------|-----------------------|
175
+ | pnpm | `pnpm-lock.yaml` | `pnpm install --frozen-lockfile --prefer-offline` | `pnpm install --prefer-offline` |
176
+ | yarn | `yarn.lock` | `yarn install --immutable` | `yarn install` |
177
+ | bun | `bun.lockb` / `bun.lock` | `bun install` | `bun install` |
178
+ | npm | `package-lock.json` | `npm ci` | `npm install` |
179
+
180
+ Inspect what would run:
181
+
182
+ ```bash
183
+ worktree-pool detect # this repo's package root
184
+ worktree-pool detect ./apps/api # any directory
185
+ ```
186
+
187
+ ```json
188
+ {
189
+ "pm": "pnpm",
190
+ "lockfile": "pnpm-lock.yaml",
191
+ "installCmd": ["pnpm", "install", "--frozen-lockfile", "--prefer-offline"],
192
+ "buildCmd": ["pnpm", "run", "build:libs"]
193
+ }
194
+ ```
195
+
95
196
  ## Integration
96
197
 
97
198
  Works with [ai-dossier](https://github.com/imboard-ai/ai-dossier) workflows:
package/dist/cli.js CHANGED
@@ -11,8 +11,13 @@ Commands:
11
11
  claim --issue N --branch B Claim a warm worktree, print path
12
12
  return --path P Return worktree to pool
13
13
  refresh Fetch + rebuild all warm worktrees
14
- gc Remove stale/orphaned worktrees
15
- init Configure pool directory for this project`);
14
+ gc [--dry-run] [--yes] Remove stale/orphaned worktrees
15
+ init Configure pool directory for this project
16
+ detect [dir] Print detected package manager env as JSON
17
+
18
+ The pool only ever removes worktrees it created. Worktrees sharing the pool
19
+ directory that the pool did not create are reported as "foreign, skipped" and
20
+ are never touched. gc requires --yes when stdin is not a TTY.`);
16
21
  }
17
22
  function parseArgs(args) {
18
23
  const command = args[0];
@@ -56,6 +61,12 @@ async function main() {
56
61
  console.log(` ${wt.id} [${wt.status}] ${wt.path}${info}`);
57
62
  }
58
63
  }
64
+ if (s.foreign.length > 0) {
65
+ console.log(`\nOther (foreign, never touched by the pool): ${s.foreign.length}`);
66
+ for (const f of s.foreign) {
67
+ console.log(` ${f.name} [${f.branch ?? 'detached'}] ${f.reason}`);
68
+ }
69
+ }
59
70
  break;
60
71
  }
61
72
  case 'replenish': {
@@ -102,6 +113,12 @@ async function main() {
102
113
  console.error('Refreshing warm worktrees...');
103
114
  const result = (0, pool_actions_1.refresh)();
104
115
  console.error(`Refreshed ${result.refreshed} worktree(s)`);
116
+ if (result.skipped.length > 0) {
117
+ console.error(`Foreign, skipped: ${result.skipped.length}`);
118
+ for (const f of result.skipped) {
119
+ console.error(` ${f.path} — ${f.reason}`);
120
+ }
121
+ }
105
122
  if (result.errors.length > 0) {
106
123
  for (const err of result.errors) {
107
124
  console.error(` Error: ${err}`);
@@ -110,20 +127,32 @@ async function main() {
110
127
  break;
111
128
  }
112
129
  case 'gc': {
113
- console.error('Running garbage collection...');
114
- const result = (0, pool_actions_1.gc)();
115
- console.error(`Removed ${result.removed} worktree(s)`);
116
- if (result.staleIds.length > 0) {
117
- console.error(` Stale: ${result.staleIds.join(', ')}`);
118
- }
119
- if (result.orphanIds.length > 0) {
120
- console.error(` Orphans: ${result.orphanIds.join(', ')}`);
130
+ const dryRun = flags['dry-run'] === true || flags['dry-run'] === 'true';
131
+ const yes = flags.yes === true || flags.yes === 'true' || flags.force === true;
132
+ console.error(dryRun ? 'Garbage collection (dry run)...' : 'Running garbage collection...');
133
+ const result = await (0, pool_actions_1.gc)({ dryRun, yes });
134
+ if (!result.dryRun && !result.aborted) {
135
+ console.error(`Removed ${result.removed} item(s)`);
136
+ if (result.staleIds.length > 0) {
137
+ console.error(` Stale: ${result.staleIds.join(', ')}`);
138
+ }
139
+ if (result.orphanIds.length > 0) {
140
+ console.error(` Orphans: ${result.orphanIds.join(', ')}`);
141
+ }
121
142
  }
122
143
  if (result.errors.length > 0) {
123
144
  for (const err of result.errors) {
124
145
  console.error(` Error: ${err}`);
125
146
  }
126
147
  }
148
+ if (result.aborted) {
149
+ process.exit(1);
150
+ }
151
+ break;
152
+ }
153
+ case 'detect': {
154
+ const dir = args[1] && !args[1].startsWith('--') ? args[1] : undefined;
155
+ console.log(JSON.stringify((0, pool_actions_1.detect)(dir), null, 2));
127
156
  break;
128
157
  }
129
158
  case 'init': {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,iDAA6F;AAE7F,SAAS,KAAK;IACZ,OAAO,CAAC,KAAK,CAAC;;;;;;;;;4EAS4D,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,KAAK,GAAqC,EAAE,CAAC;IAEnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,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,CAAC;gBAC5B,OAAO,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAClD,MAAM;YACR,CAAC;YAED;gBACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;gBAC7C,KAAK,EAAE,CAAC;gBACR,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export { claim, gc, init, refresh, replenish, resolvePoolDir, returnWorktree, status, } from './pool-actions';
1
+ export { claim, detect, gc, init, readPoolFileConfig, refresh, replenish, resolvePoolDir, returnWorktree, status, } from './pool-actions';
2
2
  export * from './pool-state';
3
+ export * from './project-env';
3
4
  export * from './types';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,EAAE,EACF,IAAI,EACJ,OAAO,EACP,SAAS,EACT,cAAc,EACd,cAAc,EACd,MAAM,GACP,MAAM,gBAAgB,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,EACN,EAAE,EACF,IAAI,EACJ,kBAAkB,EAClB,OAAO,EACP,SAAS,EACT,cAAc,EACd,cAAc,EACd,MAAM,GACP,MAAM,gBAAgB,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -14,16 +14,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.status = exports.returnWorktree = exports.resolvePoolDir = exports.replenish = exports.refresh = exports.init = exports.gc = exports.claim = void 0;
17
+ exports.status = exports.returnWorktree = exports.resolvePoolDir = exports.replenish = exports.refresh = exports.readPoolFileConfig = exports.init = exports.gc = exports.detect = exports.claim = void 0;
18
18
  var pool_actions_1 = require("./pool-actions");
19
19
  Object.defineProperty(exports, "claim", { enumerable: true, get: function () { return pool_actions_1.claim; } });
20
+ Object.defineProperty(exports, "detect", { enumerable: true, get: function () { return pool_actions_1.detect; } });
20
21
  Object.defineProperty(exports, "gc", { enumerable: true, get: function () { return pool_actions_1.gc; } });
21
22
  Object.defineProperty(exports, "init", { enumerable: true, get: function () { return pool_actions_1.init; } });
23
+ Object.defineProperty(exports, "readPoolFileConfig", { enumerable: true, get: function () { return pool_actions_1.readPoolFileConfig; } });
22
24
  Object.defineProperty(exports, "refresh", { enumerable: true, get: function () { return pool_actions_1.refresh; } });
23
25
  Object.defineProperty(exports, "replenish", { enumerable: true, get: function () { return pool_actions_1.replenish; } });
24
26
  Object.defineProperty(exports, "resolvePoolDir", { enumerable: true, get: function () { return pool_actions_1.resolvePoolDir; } });
25
27
  Object.defineProperty(exports, "returnWorktree", { enumerable: true, get: function () { return pool_actions_1.returnWorktree; } });
26
28
  Object.defineProperty(exports, "status", { enumerable: true, get: function () { return pool_actions_1.status; } });
27
29
  __exportStar(require("./pool-state"), exports);
30
+ __exportStar(require("./project-env"), exports);
28
31
  __exportStar(require("./types"), exports);
29
32
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CASwB;AARtB,qGAAA,KAAK,OAAA;AACL,kGAAA,EAAE,OAAA;AACF,oGAAA,IAAI,OAAA;AACJ,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,8GAAA,cAAc,OAAA;AACd,8GAAA,cAAc,OAAA;AACd,sGAAA,MAAM,OAAA;AAER,+CAA6B;AAC7B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAWwB;AAVtB,qGAAA,KAAK,OAAA;AACL,sGAAA,MAAM,OAAA;AACN,kGAAA,EAAE,OAAA;AACF,oGAAA,IAAI,OAAA;AACJ,kHAAA,kBAAkB,OAAA;AAClB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,8GAAA,cAAc,OAAA;AACd,8GAAA,cAAc,OAAA;AACd,sGAAA,MAAM,OAAA;AAER,+CAA6B;AAC7B,gDAA8B;AAC9B,0CAAwB"}
@@ -1,7 +1,21 @@
1
- import { getPoolStatus } from './pool-state';
1
+ import { getPoolStatus, type PoolDirClassification } from './pool-state';
2
+ import { type PoolFileConfig, type ProjectEnv } from './types';
3
+ /**
4
+ * Read `.worktree-pool.json` from the repo root. Missing or corrupt files fall
5
+ * back to defaults. `pool_dir`, when set, is resolved to an absolute path.
6
+ */
7
+ export declare function readPoolFileConfig(gitRoot: string): PoolFileConfig;
2
8
  export declare function resolvePoolDir(gitRoot: string, opts?: {
3
9
  interactive?: boolean;
4
10
  }): Promise<string>;
11
+ export interface PoolDirEntryReport extends PoolDirClassification {
12
+ /** Directory name inside the pool directory. */
13
+ name: string;
14
+ /** Absolute path on disk. */
15
+ path: string;
16
+ /** Branch checked out there, or `null`. */
17
+ branch: string | null;
18
+ }
5
19
  export declare function replenish(count?: number, _parallel?: boolean): Promise<{
6
20
  created: number;
7
21
  errors: string[];
@@ -10,19 +24,62 @@ export declare function claim(issue: number, branch: string): {
10
24
  path: string;
11
25
  } | null;
12
26
  export declare function returnWorktree(worktreePath: string): void;
13
- export declare function refresh(): {
27
+ export interface RefreshResult {
14
28
  refreshed: number;
29
+ /** Worktrees left untouched because provenance could not be confirmed. */
30
+ skipped: PoolDirEntryReport[];
15
31
  errors: string[];
16
- };
17
- export declare function gc(): {
32
+ }
33
+ export declare function refresh(): RefreshResult;
34
+ export interface GcOptions {
35
+ /** Report what would be removed and exit without touching anything. */
36
+ dryRun?: boolean;
37
+ /** Approve the removal list without prompting. */
38
+ yes?: boolean;
39
+ /** Override TTY detection for the confirmation prompt. */
40
+ interactive?: boolean;
41
+ }
42
+ export type GcCandidateKind =
43
+ /** Pool worktree past `stale_after_hours` — removed from disk and state. */
44
+ 'stale'
45
+ /** State row with nothing (of ours) on disk — the row is dropped, disk untouched. */
46
+ | 'orphan-state'
47
+ /** Pool-created directory missing from state — removed from disk. */
48
+ | 'orphan-disk';
49
+ export interface GcCandidate {
50
+ kind: GcCandidateKind;
51
+ /** Pool worktree id, or the directory name for a disk-only orphan. */
52
+ id: string;
53
+ /** Absolute path, or `null` when only a state row is dropped. */
54
+ path: string | null;
55
+ /** Branch to delete along with it, when it is one of ours. */
56
+ tempBranch: string | null;
57
+ reason: string;
58
+ }
59
+ export interface GcResult {
18
60
  removed: number;
19
61
  staleIds: string[];
20
62
  orphanIds: string[];
63
+ /** Everything in the pool directory the pool refuses to touch. */
64
+ foreign: PoolDirEntryReport[];
65
+ /** The exact removal list, whether or not it was executed. */
66
+ candidates: GcCandidate[];
67
+ dryRun: boolean;
68
+ /** `true` when confirmation was missing and nothing was removed. */
69
+ aborted: boolean;
21
70
  errors: string[];
22
- };
71
+ }
72
+ export declare function gc(opts?: GcOptions): Promise<GcResult>;
23
73
  export declare function status(): ReturnType<typeof getPoolStatus> & {
24
74
  pool_dir: string;
75
+ /** Worktrees sharing the pool directory that the pool did not create. */
76
+ foreign: PoolDirEntryReport[];
25
77
  };
78
+ /**
79
+ * Detect the project environment for `dir`, or — when omitted — for this
80
+ * repo's package root (git root plus `project_subdir` from the pool config).
81
+ */
82
+ export declare function detect(dir?: string): ProjectEnv;
26
83
  export declare function init(): Promise<{
27
84
  pool_dir: string;
28
85
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"pool-actions.d.ts","sourceRoot":"","sources":["../src/pool-actions.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,aAAa,EAKd,MAAM,cAAc,CAAC;AAyHtB,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/B,OAAO,CAAC,MAAM,CAAC,CAuBjB;AA2JD,wBAAsB,SAAS,CAC7B,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,UAAQ,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAkGhD;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAuF5E;AAED,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CA+FzD;AAED,wBAAgB,OAAO,IAAI;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CA2CjE;AAED,wBAAgB,EAAE,IAAI;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAmFA;AAED,wBAAgB,MAAM,IAAI,UAAU,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