@gaia-ai/gaia 0.6.1 → 0.6.2

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
@@ -26,6 +26,23 @@ spawn plugins (Claude, Codex, herdr, and a deterministic fake for tests). Point
26
26
  it at a control plane with a `conductor.config.js` (scaffold one with
27
27
  `gaia init`).
28
28
 
29
+ ## `gaia ui` deep links
30
+
31
+ `gaia ui` is the interactive terminal cockpit, and it takes an optional target so you open
32
+ the thing you are working on directly:
33
+
34
+ ```bash
35
+ gaia ui GAIA-221 # a ticket by identifier (case-insensitive)
36
+ gaia ui project:gaia # a project; also ticket:<uuid> · run:<uuid>
37
+ gaia ui --here # this branch's ticket, else this repo's project
38
+ gaia ui GAIA-221 --view teaser # a compact block instead of the tabbed detail
39
+ ```
40
+
41
+ At most **one** target source (the positional, `--ticket`, `--project`, `--run`, `--here`);
42
+ two exit non-zero naming both. `--here` reads the current branch for a ticket identifier and
43
+ otherwise resolves this repo's git remote against the projects that claim it — several
44
+ claimants open a picker. `gaia ui --help` lists every form.
45
+
29
46
  ## Plugins
30
47
 
31
48
  The four spawn plugins ship **inside** this package — nothing extra to install.
@@ -1,5 +1,20 @@
1
1
  import { type ProjectConnectionChoice } from '@gaia-ai/conductor';
2
2
  import type { Command } from 'commander';
3
+ /** Where the running `gaia` resolved from and what it calls itself. */
4
+ export interface GaiaInstallInfo {
5
+ /** The meta package version (`0.0.0` when the manifest is unreadable). */
6
+ version: string;
7
+ /** Absolute path of the package root this module was loaded from. */
8
+ root: string;
9
+ /** `global install` when that root sits inside `node_modules`, else `dev clone`. */
10
+ kind: 'dev clone' | 'global install';
11
+ }
12
+ /**
13
+ * Identify the running install from THIS module's own URL — walking up to the
14
+ * nearest `package.json` — rather than from `$PATH` or `process.argv`, so a shim
15
+ * that execs a checkout's build reports the checkout, not the shim.
16
+ */
17
+ export declare function resolveInstallInfo(): GaiaInstallInfo;
3
18
  /**
4
19
  * GAIA-218 (AC-3, AC-4): resolve what to do with the PROJECT connection override.
5
20
  * Default no in every branch — only an explicit yes opts in. Non-interactive
@@ -13,9 +28,21 @@ export declare function resolveProjectConnectionChoice(opts: {
13
28
  isTTY: boolean;
14
29
  prompt: (question: string) => Promise<boolean>;
15
30
  }): Promise<ProjectConnectionChoice>;
31
+ /**
32
+ * GAIA-230 (AC-9): the intro lines printed BEFORE the first migration step, on
33
+ * `--dry-run` too. `home` is where the schema `from` is read (the home connection
34
+ * config `~/.gaia/gaia.config.js`, the one every repo inherits); `to` is the
35
+ * version this gaia ships. Pure — returns the lines rather than printing them.
36
+ */
37
+ export declare function renderUpgradeIntro(opts: {
38
+ cwd: string;
39
+ home: string;
40
+ install?: GaiaInstallInfo;
41
+ }): string[];
16
42
  /** Register `gaia upgrade` on the host program. `deps` is injectable for tests. */
17
43
  export declare function registerUpgrade(program: Command, deps?: {
18
44
  prompt?: (question: string) => Promise<boolean>;
19
45
  isTTY?: boolean;
20
46
  cwd?: string;
47
+ home?: string;
21
48
  }): void;
@@ -1,11 +1,38 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { dirname, join, sep } from 'node:path';
1
4
  import { createInterface } from 'node:readline';
2
- import { hasProjectConnection, runUpgrade, } from '@gaia-ai/conductor';
3
- // GAIA-216: the `gaia upgrade` migration/seed routine was hoisted DOWN into the
4
- // engine (`@gaia-ai/conductor`) so `conductor init` can call it intra-package
5
- // without a host→engine→host cycle. The host keeps the thin CLI registration
6
- // below plus the GAIA-218 TTY interaction that resolves the PROJECT connection
7
- // decision. See `gaia-cli/conductor/src/cli/upgrade.ts` for `runUpgrade` +
8
- // `UpgradeReport`.
5
+ import { fileURLToPath } from 'node:url';
6
+ import { GAIA_CONFIG_SCHEMA_VERSION, hasProjectConnection, readConfigSchemaVersion, runUpgrade, } from '@gaia-ai/conductor';
7
+ /**
8
+ * Identify the running install from THIS module's own URL — walking up to the
9
+ * nearest `package.json` rather than from `$PATH` or `process.argv`, so a shim
10
+ * that execs a checkout's build reports the checkout, not the shim.
11
+ */
12
+ export function resolveInstallInfo() {
13
+ let root = dirname(fileURLToPath(import.meta.url));
14
+ let version = '0.0.0';
15
+ for (;;) {
16
+ try {
17
+ const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
18
+ version = pkg.version ?? '0.0.0';
19
+ break;
20
+ }
21
+ catch {
22
+ const parent = dirname(root);
23
+ if (parent === root)
24
+ break;
25
+ root = parent;
26
+ }
27
+ }
28
+ return {
29
+ version,
30
+ root,
31
+ kind: root.includes(`${sep}node_modules${sep}`)
32
+ ? 'global install'
33
+ : 'dev clone',
34
+ };
35
+ }
9
36
  /** Ask a yes/no question on the terminal; anything but an explicit yes is no. */
10
37
  async function promptYesNo(question) {
11
38
  const rl = createInterface({ input: process.stdin, output: process.stdout });
@@ -36,22 +63,52 @@ export async function resolveProjectConnectionChoice(opts) {
36
63
  const yes = await opts.prompt('create a project connection override for this repo? [y/N] ');
37
64
  return yes ? 'create' : 'skip';
38
65
  }
66
+ /**
67
+ * GAIA-230 (AC-9): the intro lines printed BEFORE the first migration step, on
68
+ * `--dry-run` too. `home` is where the schema `from` is read (the home connection
69
+ * config `~/.gaia/gaia.config.js`, the one every repo inherits); `to` is the
70
+ * version this gaia ships. Pure — returns the lines rather than printing them.
71
+ */
72
+ export function renderUpgradeIntro(opts) {
73
+ const info = opts.install ?? resolveInstallInfo();
74
+ const homeConnection = join(opts.home, '.gaia', 'gaia.config.js');
75
+ const from = readConfigSchemaVersion(homeConnection);
76
+ return [
77
+ `gaia upgrade — gaia v${info.version} (${info.kind})`,
78
+ ` resolved from: ${info.root}`,
79
+ ` config schema: v${from} → v${GAIA_CONFIG_SCHEMA_VERSION} (${homeConnection})`,
80
+ ` the .gaia/ configs of ${opts.cwd} and of ${join(opts.home, '.gaia')} get migrated`,
81
+ ];
82
+ }
39
83
  /** Register `gaia upgrade` on the host program. `deps` is injectable for tests. */
40
84
  export function registerUpgrade(program, deps = {}) {
41
85
  program
42
86
  .command('upgrade')
43
- .description('migrate this install: the split config model (gaia.config.js connection + conductor.config.js engine; ~/.gaia/machine.config.js) and the GAIA-224 addon package names (@gaia-ai/plugin-*, @gaia-ai/core/builtins and @gaia-ai/core/plugins → @gaia-ai/addon-*). Prompts before creating/removing a project connection override.')
87
+ .description('migrate this install: the split config model (gaia.config.js connection + conductor.config.js engine; ~/.gaia/machine.config.js) and the GAIA-224 addon package names (@gaia-ai/plugin-*, @gaia-ai/core/builtins and the @gaia-ai/core/plugins + @gaia-ai/gaia/plugins host barrels → @gaia-ai/addon-*). Prompts before creating/removing a project connection override.')
44
88
  .option('--dry-run', 'print the migration plan without writing anything', false)
45
89
  .action(async (opts) => {
46
90
  const cwd = deps.cwd ?? process.cwd();
91
+ const home = deps.home ?? homedir();
47
92
  const isTTY = deps.isTTY ?? Boolean(process.stdin.isTTY);
48
93
  const prompt = deps.prompt ?? promptYesNo;
94
+ // GAIA-230 (AC-9): the intro comes first — before the connection prompt and
95
+ // before the first migration step, so it is on the record either way.
96
+ for (const line of renderUpgradeIntro({ cwd, home }))
97
+ console.log(line);
49
98
  const projectConnection = await resolveProjectConnectionChoice({
50
99
  existing: hasProjectConnection(cwd),
51
100
  isTTY,
52
101
  prompt,
53
102
  });
54
- const report = runUpgrade({ dryRun: opts.dryRun, projectConnection });
103
+ // `cwd`/`home` are forwarded so an injected pair really scopes the run —
104
+ // without them `runUpgrade` reached for `process.cwd()`/`homedir()` and
105
+ // rewrote the developer's own `.gaia/` from a test.
106
+ const report = runUpgrade({
107
+ cwd,
108
+ home,
109
+ dryRun: opts.dryRun,
110
+ projectConnection,
111
+ });
55
112
  for (const line of report.actions)
56
113
  console.log(line);
57
114
  if (report.alreadyCurrent)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaia-ai/gaia",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "GAIA meta package: the `gaia` plugin-host CLI + all runtime plugins. Global install target.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,22 +38,22 @@
38
38
  "jsonapi"
39
39
  ],
40
40
  "dependencies": {
41
- "@gaia-ai/addon-auth-basic": "^0.6.1",
42
- "@gaia-ai/addon-claude": "^0.6.1",
43
- "@gaia-ai/addon-codex": "^0.6.1",
44
- "@gaia-ai/addon-deployment": "^0.6.1",
45
- "@gaia-ai/addon-dropsh": "^0.6.1",
46
- "@gaia-ai/addon-essentials": "^0.6.1",
47
- "@gaia-ai/addon-gaia-ui": "^0.6.1",
48
- "@gaia-ai/addon-herdr": "^0.6.1",
49
- "@gaia-ai/addon-kimi": "^0.6.1",
50
- "@gaia-ai/addon-opencode": "^0.6.1",
51
- "@gaia-ai/addon-pi": "^0.6.1",
52
- "@gaia-ai/addon-remote-drupal": "^0.6.1",
53
- "@gaia-ai/addon-workspace-git": "^0.6.1",
54
- "@gaia-ai/conductor": "^0.6.1",
55
- "@gaia-ai/core": "^0.6.1",
56
- "@gaia-ai/ui": "^0.6.1",
41
+ "@gaia-ai/addon-auth-basic": "^0.6.2",
42
+ "@gaia-ai/addon-claude": "^0.6.2",
43
+ "@gaia-ai/addon-codex": "^0.6.2",
44
+ "@gaia-ai/addon-deployment": "^0.6.2",
45
+ "@gaia-ai/addon-dropsh": "^0.6.2",
46
+ "@gaia-ai/addon-essentials": "^0.6.2",
47
+ "@gaia-ai/addon-gaia-ui": "^0.6.2",
48
+ "@gaia-ai/addon-herdr": "^0.6.2",
49
+ "@gaia-ai/addon-kimi": "^0.6.2",
50
+ "@gaia-ai/addon-opencode": "^0.6.2",
51
+ "@gaia-ai/addon-pi": "^0.6.2",
52
+ "@gaia-ai/addon-remote-drupal": "^0.6.2",
53
+ "@gaia-ai/addon-workspace-git": "^0.6.2",
54
+ "@gaia-ai/conductor": "^0.6.2",
55
+ "@gaia-ai/core": "^0.6.2",
56
+ "@gaia-ai/ui": "^0.6.2",
57
57
  "commander": "^12.1.0"
58
58
  }
59
59
  }