@gaia-ai/addon-herdr 0.11.2 → 0.11.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.
@@ -1,26 +1,13 @@
1
- /** Runs `git <args>` in a cwd; resolves stdout, rejects on non-zero exit. */
2
- export type RootGitExec = (args: string[], cwd: string) => Promise<string>;
3
- /** Default git runner for root derivation: real `git` in the given cwd. */
4
- export declare const defaultRootGitExec: RootGitExec;
1
+ import { defaultRootGitExec, deriveCheckoutRoot, type RootGitExec } from '@gaia-ai/core';
2
+ export type { RootGitExec };
3
+ export { defaultRootGitExec };
5
4
  /**
6
- * Derive the main-clone root that herdr requires as the `--cwd` for every
7
- * `worktree list/open/create`. This is the single anchor shared by BOTH the
8
- * `herdrExecutor` and `herdrWorkspace` factories (GAIA-177 AC-3).
9
- *
10
- * The config path is NOT a safe anchor: `.gaia/` is checked in, so config
11
- * discovery walks up to the *worktree-local* config, whose dirname IS the linked
12
- * worktree — and herdr rejects a linked worktree as that `--cwd`
13
- * (`linked_worktree_source`). Instead ask git: `git rev-parse
14
- * --path-format=absolute --git-common-dir`, run from the config dir, always
15
- * resolves to the shared main `.git` even from a linked worktree; its parent is
16
- * the main clone.
17
- *
18
- * `override` (a factory `root:` option) always wins and skips git entirely.
19
- * Best-effort: a missing `config_path` or a git failure (e.g. not a repo) falls
20
- * back to `dirname(config_path)` — the previous behaviour — and finally
21
- * `process.cwd()`.
5
+ * herdr's own name for the shared checkout-root anchor (GAIA-177), kept as a
6
+ * thin alias so `index.ts` and `workspace.ts` need no rename. The behaviour —
7
+ * including the injected git-exec seam — now lives in `@gaia-ai/core` as
8
+ * `deriveCheckoutRoot()` (GAIA-450 D2): two other call sites
9
+ * (`@gaia-ai/conductor`'s `checkoutRootOf()` and `addon-workspace-git`'s
10
+ * `gitWorkspace` fallback) needed the same derivation and neither may import
11
+ * this addon, so the helper moved to the kernel rather than staying herdr-owned.
22
12
  */
23
- export declare function deriveHerdrRoot(configPath: string | undefined, opts?: {
24
- override?: string;
25
- execGit?: RootGitExec;
26
- }): Promise<string>;
13
+ export declare const deriveHerdrRoot: typeof deriveCheckoutRoot;
@@ -1,40 +1,12 @@
1
- import { dirname } from 'node:path';
2
- import { exec } from '@gaia-ai/core';
3
- /** Default git runner for root derivation: real `git` in the given cwd. */
4
- export const defaultRootGitExec = (args, cwd) => exec('git', args, { cwd });
1
+ import { defaultRootGitExec, deriveCheckoutRoot, } from '@gaia-ai/core';
2
+ export { defaultRootGitExec };
5
3
  /**
6
- * Derive the main-clone root that herdr requires as the `--cwd` for every
7
- * `worktree list/open/create`. This is the single anchor shared by BOTH the
8
- * `herdrExecutor` and `herdrWorkspace` factories (GAIA-177 AC-3).
9
- *
10
- * The config path is NOT a safe anchor: `.gaia/` is checked in, so config
11
- * discovery walks up to the *worktree-local* config, whose dirname IS the linked
12
- * worktree — and herdr rejects a linked worktree as that `--cwd`
13
- * (`linked_worktree_source`). Instead ask git: `git rev-parse
14
- * --path-format=absolute --git-common-dir`, run from the config dir, always
15
- * resolves to the shared main `.git` even from a linked worktree; its parent is
16
- * the main clone.
17
- *
18
- * `override` (a factory `root:` option) always wins and skips git entirely.
19
- * Best-effort: a missing `config_path` or a git failure (e.g. not a repo) falls
20
- * back to `dirname(config_path)` — the previous behaviour — and finally
21
- * `process.cwd()`.
4
+ * herdr's own name for the shared checkout-root anchor (GAIA-177), kept as a
5
+ * thin alias so `index.ts` and `workspace.ts` need no rename. The behaviour —
6
+ * including the injected git-exec seam — now lives in `@gaia-ai/core` as
7
+ * `deriveCheckoutRoot()` (GAIA-450 D2): two other call sites
8
+ * (`@gaia-ai/conductor`'s `checkoutRootOf()` and `addon-workspace-git`'s
9
+ * `gitWorkspace` fallback) needed the same derivation and neither may import
10
+ * this addon, so the helper moved to the kernel rather than staying herdr-owned.
22
11
  */
23
- export async function deriveHerdrRoot(configPath, opts = {}) {
24
- if (opts.override !== undefined) {
25
- return opts.override;
26
- }
27
- const configDir = configPath ? dirname(configPath) : undefined;
28
- const fallback = configDir ?? process.cwd();
29
- if (configDir === undefined) {
30
- return fallback;
31
- }
32
- const execGit = opts.execGit ?? defaultRootGitExec;
33
- try {
34
- const commonDir = (await execGit(['rev-parse', '--path-format=absolute', '--git-common-dir'], configDir)).trim();
35
- return commonDir ? dirname(commonDir) : fallback;
36
- }
37
- catch {
38
- return fallback;
39
- }
40
- }
12
+ export const deriveHerdrRoot = deriveCheckoutRoot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaia-ai/addon-herdr",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "GAIA herdr integration: spawn executor + per-ticket worktree workspace.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,10 +20,10 @@
20
20
  "directory": "gaia-cli/addons/herdr"
21
21
  },
22
22
  "dependencies": {
23
- "@gaia-ai/addon-workspace-git": "^0.11.2"
23
+ "@gaia-ai/addon-workspace-git": "^0.11.4"
24
24
  },
25
25
  "peerDependencies": {
26
- "@gaia-ai/conductor": "^0.11.2",
27
- "@gaia-ai/core": "^0.11.2"
26
+ "@gaia-ai/conductor": "^0.11.4",
27
+ "@gaia-ai/core": "^0.11.4"
28
28
  }
29
29
  }