@aligndottech/cli 0.47.1 → 0.48.0

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 (102) hide show
  1. package/dist/commands/agents.d.ts +20 -0
  2. package/dist/commands/agents.d.ts.map +1 -0
  3. package/dist/commands/agents.js +60 -0
  4. package/dist/commands/agents.js.map +1 -0
  5. package/dist/commands/registry.d.ts.map +1 -1
  6. package/dist/commands/registry.js +3 -0
  7. package/dist/commands/registry.js.map +1 -1
  8. package/dist/commands/setup.js.map +1 -1
  9. package/dist/commands/use.js +1 -1
  10. package/dist/commands/use.js.map +1 -1
  11. package/dist/lib/launch/adapters/claude-code.d.ts +8 -0
  12. package/dist/lib/launch/adapters/claude-code.d.ts.map +1 -1
  13. package/dist/lib/launch/adapters/claude-code.js.map +1 -1
  14. package/dist/lib/launch/adapters/codex.d.ts +17 -0
  15. package/dist/lib/launch/adapters/codex.d.ts.map +1 -0
  16. package/dist/lib/launch/adapters/codex.js +44 -0
  17. package/dist/lib/launch/adapters/codex.js.map +1 -0
  18. package/dist/lib/launch/adapters/copilot.d.ts +17 -0
  19. package/dist/lib/launch/adapters/copilot.d.ts.map +1 -0
  20. package/dist/lib/launch/adapters/copilot.js +29 -0
  21. package/dist/lib/launch/adapters/copilot.js.map +1 -0
  22. package/dist/lib/launch/adapters/gemini-cli.d.ts +25 -0
  23. package/dist/lib/launch/adapters/gemini-cli.d.ts.map +1 -0
  24. package/dist/lib/launch/adapters/gemini-cli.js +73 -0
  25. package/dist/lib/launch/adapters/gemini-cli.js.map +1 -0
  26. package/dist/lib/launch/agents.d.ts +12 -2
  27. package/dist/lib/launch/agents.d.ts.map +1 -1
  28. package/dist/lib/launch/agents.js +17 -1
  29. package/dist/lib/launch/agents.js.map +1 -1
  30. package/dist/lib/launch/codex-state.d.ts +31 -0
  31. package/dist/lib/launch/codex-state.d.ts.map +1 -0
  32. package/dist/lib/launch/codex-state.js +92 -0
  33. package/dist/lib/launch/codex-state.js.map +1 -0
  34. package/dist/lib/launch/copilot-state.d.ts +19 -0
  35. package/dist/lib/launch/copilot-state.d.ts.map +1 -0
  36. package/dist/lib/launch/copilot-state.js +51 -0
  37. package/dist/lib/launch/copilot-state.js.map +1 -0
  38. package/dist/lib/launch/gemini-state.d.ts +32 -0
  39. package/dist/lib/launch/gemini-state.d.ts.map +1 -0
  40. package/dist/lib/launch/gemini-state.js +59 -0
  41. package/dist/lib/launch/gemini-state.js.map +1 -0
  42. package/dist/lib/launch/gemini-trust.d.ts +26 -0
  43. package/dist/lib/launch/gemini-trust.d.ts.map +1 -0
  44. package/dist/lib/launch/gemini-trust.js +103 -0
  45. package/dist/lib/launch/gemini-trust.js.map +1 -0
  46. package/dist/lib/launch/install.d.ts +33 -0
  47. package/dist/lib/launch/install.d.ts.map +1 -0
  48. package/dist/lib/launch/install.js +48 -0
  49. package/dist/lib/launch/install.js.map +1 -0
  50. package/dist/lib/launch/launch-files.d.ts +15 -0
  51. package/dist/lib/launch/launch-files.d.ts.map +1 -1
  52. package/dist/lib/launch/launch-files.js +64 -4
  53. package/dist/lib/launch/launch-files.js.map +1 -1
  54. package/dist/lib/launch/launch.d.ts +27 -6
  55. package/dist/lib/launch/launch.d.ts.map +1 -1
  56. package/dist/lib/launch/launch.js +64 -28
  57. package/dist/lib/launch/launch.js.map +1 -1
  58. package/dist/lib/launch/pick-agent.d.ts +12 -5
  59. package/dist/lib/launch/pick-agent.d.ts.map +1 -1
  60. package/dist/lib/launch/pick-agent.js +46 -19
  61. package/dist/lib/launch/pick-agent.js.map +1 -1
  62. package/dist/lib/launch/picker-options.d.ts +30 -0
  63. package/dist/lib/launch/picker-options.d.ts.map +1 -0
  64. package/dist/lib/launch/picker-options.js +42 -0
  65. package/dist/lib/launch/picker-options.js.map +1 -0
  66. package/dist/lib/launch/prompts.d.ts +11 -0
  67. package/dist/lib/launch/prompts.d.ts.map +1 -0
  68. package/dist/lib/launch/prompts.js +27 -0
  69. package/dist/lib/launch/prompts.js.map +1 -0
  70. package/dist/lib/launch/registry/agents/claude-code.js +1 -1
  71. package/dist/lib/launch/registry/agents/claude-code.js.map +1 -1
  72. package/dist/lib/launch/registry/agents/codex.d.ts.map +1 -1
  73. package/dist/lib/launch/registry/agents/codex.js +4 -2
  74. package/dist/lib/launch/registry/agents/codex.js.map +1 -1
  75. package/dist/lib/launch/registry/agents/copilot.d.ts +3 -0
  76. package/dist/lib/launch/registry/agents/copilot.d.ts.map +1 -0
  77. package/dist/lib/launch/registry/agents/copilot.js +11 -0
  78. package/dist/lib/launch/registry/agents/copilot.js.map +1 -0
  79. package/dist/lib/launch/registry/agents/cursor.js +1 -1
  80. package/dist/lib/launch/registry/agents/cursor.js.map +1 -1
  81. package/dist/lib/launch/registry/agents/gemini-cli.d.ts.map +1 -1
  82. package/dist/lib/launch/registry/agents/gemini-cli.js +4 -2
  83. package/dist/lib/launch/registry/agents/gemini-cli.js.map +1 -1
  84. package/dist/lib/launch/registry/agents/opencode.js +1 -1
  85. package/dist/lib/launch/registry/agents/opencode.js.map +1 -1
  86. package/dist/lib/launch/registry/agents/pi.js +1 -1
  87. package/dist/lib/launch/registry/agents/pi.js.map +1 -1
  88. package/dist/lib/launch/registry/index.d.ts +1 -1
  89. package/dist/lib/launch/registry/index.d.ts.map +1 -1
  90. package/dist/lib/launch/registry/index.js +3 -2
  91. package/dist/lib/launch/registry/index.js.map +1 -1
  92. package/dist/lib/launch/registry/types.d.ts +13 -2
  93. package/dist/lib/launch/registry/types.d.ts.map +1 -1
  94. package/dist/lib/launch/run-agent.d.ts +4 -0
  95. package/dist/lib/launch/run-agent.d.ts.map +1 -1
  96. package/dist/lib/launch/run-agent.js +1 -1
  97. package/dist/lib/launch/run-agent.js.map +1 -1
  98. package/dist/lib/launch/strict-entry.d.ts +49 -0
  99. package/dist/lib/launch/strict-entry.d.ts.map +1 -0
  100. package/dist/lib/launch/strict-entry.js +106 -0
  101. package/dist/lib/launch/strict-entry.js.map +1 -0
  102. package/package.json +3 -2
@@ -0,0 +1,25 @@
1
+ import { type GeminiProjectState } from '../gemini-state.js';
2
+ import type { LaunchContext, LaunchSpec } from './claude-code.js';
3
+ export interface GeminiLaunchContext extends Pick<LaunchContext, 'passthrough' | 'cachePath'>, GeminiProjectState {
4
+ /** The environment the child will inherit: the user's own GEMINI_CLI_* are read from here. */
5
+ env: Record<string, string | undefined>;
6
+ platform: string;
7
+ }
8
+ export declare const GEMINI_TRUST_NOTE = "Gemini turns off MCP servers, Align's included, in folders you haven't trusted. Trust this folder in Gemini to use the graph here.";
9
+ /**
10
+ * Gemini CLI, per session, nothing written to the user's own config (gemini 0.58.0):
11
+ * GEMINI_CLI_SYSTEM_SETTINGS_PATH names the system settings file, and Gemini MERGES its
12
+ * mcpServers with the user's (verified: `gemini mcp list` shows both). That variable REPLACES
13
+ * the system file Gemini would otherwise read (the user's own value, or the platform default an
14
+ * admin may have filled), so align points it at a COPY of that file with align-local added,
15
+ * never at a file of align's alone. Gemini also derives system-defaults.json from that file's
16
+ * directory, so the original location is pinned with GEMINI_CLI_SYSTEM_DEFAULTS_PATH unless the
17
+ * user set it. A system file align cannot read or parse is never replaced: no injection, and
18
+ * one line saying why (the same rule as OpenCode's OPENCODE_CONFIG_CONTENT).
19
+ *
20
+ * Trust: Gemini turns off every MCP server in a folder it does not trust. align says so in one
21
+ * line and never trusts a folder for the user (no --skip-trust, no GEMINI_CLI_TRUST_WORKSPACE).
22
+ * Instructions come from the managed GEMINI.md block. Pass-through args are the whole of the args.
23
+ */
24
+ export declare function buildGeminiLaunch(c: GeminiLaunchContext): LaunchSpec;
25
+ //# sourceMappingURL=gemini-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini-cli.d.ts","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/gemini-cli.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG1F,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,WAAW,CAAC,EAAE,kBAAkB;IAC/G,8FAA8F;IAC9F,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAKD,eAAO,MAAM,iBAAiB,uIAAuI,CAAC;AActK;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,mBAAmB,GAAG,UAAU,CAkCpE"}
@@ -0,0 +1,73 @@
1
+ import { alignServerEntry } from '../../mcp-setup.js';
2
+ import { COPY_PREFIX, geminiCopyName } from '../gemini-state.js';
3
+ import { geminiSystemDefaultsPath } from '../gemini-trust.js';
4
+ import { parseJsonc } from '../strict-entry.js';
5
+ /** Same reason as the Claude adapter: never shadow a user's own `align` server. */
6
+ const INJECTED_SERVER_NAME = 'align-local';
7
+ export const GEMINI_TRUST_NOTE = "Gemini turns off MCP servers, Align's included, in folders you haven't trusted. Trust this folder in Gemini to use the graph here.";
8
+ const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
9
+ /** The system settings (JSONC, as Gemini reads them) as an object we can add to, or null when we must not touch them. */
10
+ function parseTheirs(text) {
11
+ if (text === null)
12
+ return {};
13
+ const parsed = parseJsonc(text);
14
+ if (!parsed)
15
+ return null;
16
+ if (parsed['mcpServers'] !== undefined && !isObject(parsed['mcpServers']))
17
+ return null;
18
+ return parsed;
19
+ }
20
+ /**
21
+ * Gemini CLI, per session, nothing written to the user's own config (gemini 0.58.0):
22
+ * GEMINI_CLI_SYSTEM_SETTINGS_PATH names the system settings file, and Gemini MERGES its
23
+ * mcpServers with the user's (verified: `gemini mcp list` shows both). That variable REPLACES
24
+ * the system file Gemini would otherwise read (the user's own value, or the platform default an
25
+ * admin may have filled), so align points it at a COPY of that file with align-local added,
26
+ * never at a file of align's alone. Gemini also derives system-defaults.json from that file's
27
+ * directory, so the original location is pinned with GEMINI_CLI_SYSTEM_DEFAULTS_PATH unless the
28
+ * user set it. A system file align cannot read or parse is never replaced: no injection, and
29
+ * one line saying why (the same rule as OpenCode's OPENCODE_CONFIG_CONTENT).
30
+ *
31
+ * Trust: Gemini turns off every MCP server in a folder it does not trust. align says so in one
32
+ * line and never trusts a folder for the user (no --skip-trust, no GEMINI_CLI_TRUST_WORKSPACE).
33
+ * Instructions come from the managed GEMINI.md block. Pass-through args are the whole of the args.
34
+ */
35
+ export function buildGeminiLaunch(c) {
36
+ const env = { ALIGN_WRAPPED: '1' };
37
+ const files = [];
38
+ const notes = [];
39
+ const copy = geminiCopyName(c.systemSettings.path);
40
+ let injected = false;
41
+ if (c.overridden.length > 0 || !c.present) {
42
+ const theirs = c.systemSettings.unreadable ? null : parseTheirs(c.systemSettings.text);
43
+ if (!theirs) {
44
+ notes.push(`Gemini's system settings file ${c.systemSettings.path} is not readable JSON with an object "mcpServers", so Align's graph tools were not added to this session. Fix the file, or point GEMINI_CLI_SYSTEM_SETTINGS_PATH at one that is.`);
45
+ }
46
+ else {
47
+ // Set unconditionally: a canonical align-local here would have made `present` true with
48
+ // nothing overridden, so whatever is under this name now is replaced by ours.
49
+ const merged = { ...theirs, mcpServers: { ...(theirs['mcpServers'] ?? {}), [INJECTED_SERVER_NAME]: alignServerEntry('mcpServers', 'local') } };
50
+ // 0600: the copy carries whatever the admin's system file holds.
51
+ files.push({ name: copy, content: `${JSON.stringify(merged, null, 2)}\n`, mode: 0o600 });
52
+ env['GEMINI_CLI_SYSTEM_SETTINGS_PATH'] = c.cachePath(copy);
53
+ if (!c.env['GEMINI_CLI_SYSTEM_DEFAULTS_PATH'])
54
+ env['GEMINI_CLI_SYSTEM_DEFAULTS_PATH'] = geminiSystemDefaultsPath(c.systemSettings.path, c.platform);
55
+ if (c.overridden.length > 0)
56
+ notes.push(`Gemini will use Align's own align-local MCP server this session, not the one in ${c.overridden.join(', ')}.`);
57
+ injected = true;
58
+ }
59
+ }
60
+ if (c.trust === 'untrusted' || c.trust === 'unknown')
61
+ notes.push(GEMINI_TRUST_NOTE);
62
+ return {
63
+ bin: 'gemini',
64
+ args: [...c.passthrough],
65
+ env,
66
+ files,
67
+ // This source's copy is refreshed when used and removed when not. Other sources' copies may
68
+ // belong to a concurrent session, so they only age out (pruneLaunchFiles).
69
+ prune: { prefix: COPY_PREFIX, ...(injected ? { keep: copy } : { remove: copy }) },
70
+ ...(notes.length > 0 ? { notes } : {}),
71
+ };
72
+ }
73
+ //# sourceMappingURL=gemini-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini-cli.js","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/gemini-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,cAAc,EAA2B,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAShD,mFAAmF;AACnF,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,oIAAoI,CAAC;AAGtK,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAa,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAErG,yHAAyH;AACzH,SAAS,WAAW,CAAC,IAAmB;IACtC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,SAAS,IAAI,C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,EAAE,KAAK,EAAE,CAAC,CAAC;YACzF,GAAG,CAAC,iCAAiC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC3D,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,iCAAiC,CAAC;gBAAE,GAAG,CAAC,iCAAiC,CAAC,GAAG,wBAAwB,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;YACpJ,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,mFAAmF,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACvJ,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;IACH,CAAC;IACD,IAAI,CAAC,CAAC,KAAK,KAAK,WAAW,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACpF,OAAO;QACL,GAAG,EAAE,QAAQ;QACb,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC;QACxB,GAAG;QACH,KAAK;QACL,4FAA4F;QAC5F,2EAA2E;QAC3E,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;QACjF,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvC,CAAC;AACJ,CAAC"}
@@ -1,17 +1,27 @@
1
- import type { AgentName } from '../sessions/types.js';
1
+ import type { LaunchAgentId } from './registry/types.js';
2
2
  export interface LaunchAgent {
3
- name: AgentName;
3
+ name: LaunchAgentId;
4
4
  label: string;
5
5
  bin: string;
6
6
  /** per-session: nothing written to the user's config. written-once: later phases. */
7
7
  injection: 'per-session' | 'written-once';
8
8
  /** A launch target today. Later phases flip more entries to true; nothing else changes. */
9
9
  supported: boolean;
10
+ /** The install command or URL, as text. The structured form is on the registry spec. */
10
11
  install: string;
11
12
  }
12
13
  export declare const LAUNCH_AGENTS: readonly LaunchAgent[];
13
14
  export declare function agentByName(name: string | undefined): LaunchAgent | undefined;
14
15
  export declare const supportedAgents: () => LaunchAgent[];
16
+ /**
17
+ * Which agent to take when several are installed and nobody can be asked (no terminal, or
18
+ * --approve). The agents launchable before wave A keep their old order, Claude Code first, so a
19
+ * scripted first run picks what it picked before; the wave A agents come after them.
20
+ */
21
+ export declare const PICK_PRIORITY: readonly LaunchAgentId[];
22
+ /** The agents launchable before wave A. */
23
+ export declare const PRE_WAVE_A: ReadonlySet<LaunchAgentId>;
24
+ export declare function byPriority(agents: LaunchAgent[]): LaunchAgent[];
15
25
  /**
16
26
  * The agent's binary on PATH, and where. Only `bin` is accepted: for Cursor that is `cursor-agent`,
17
27
  * which its installer always creates. Cursor's docs also call the command `agent`, but that name
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../src/lib/launch/agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,qFAAqF;IACrF,SAAS,EAAE,aAAa,GAAG,cAAc,CAAC;IAC1C,2FAA2F;IAC3F,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAE/C,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAA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AC,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAM/D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE,WAAW,EACd,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,EAC/F,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,QAAQ,EAAE,MAAM,GACf;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAGtC"}
@@ -1,9 +1,25 @@
1
+ import { installText } from './install.js';
1
2
  import { AGENT_REGISTRY } from './registry/index.js';
2
- export const LAUNCH_AGENTS = AGENT_REGISTRY.map(({ name, label, bin, injection, supported, install }) => ({ name, label, bin, injection, supported, install }));
3
+ export const LAUNCH_AGENTS = AGENT_REGISTRY.map(({ name, label, bin, injection, supported, install }) => ({ name, label, bin, injection, supported, install: installText(install) }));
3
4
  export function agentByName(name) {
4
5
  return LAUNCH_AGENTS.find((a) => a.name === name);
5
6
  }
6
7
  export const supportedAgents = () => LAUNCH_AGENTS.filter((a) => a.supported);
8
+ /**
9
+ * Which agent to take when several are installed and nobody can be asked (no terminal, or
10
+ * --approve). The agents launchable before wave A keep their old order, Claude Code first, so a
11
+ * scripted first run picks what it picked before; the wave A agents come after them.
12
+ */
13
+ export const PICK_PRIORITY = ['claude-code', 'cursor', 'opencode', 'pi', 'codex', 'copilot', 'gemini-cli'];
14
+ /** The agents launchable before wave A. */
15
+ export const PRE_WAVE_A = new Set(['claude-code', 'cursor', 'opencode', 'pi']);
16
+ export function byPriority(agents) {
17
+ const rank = (a) => {
18
+ const i = PICK_PRIORITY.indexOf(a.name);
19
+ return i < 0 ? PICK_PRIORITY.length : i;
20
+ };
21
+ return [...agents].sort((a, b) => rank(a) - rank(b));
22
+ }
7
23
  /**
8
24
  * The agent's binary on PATH, and where. Only `bin` is accepted: for Cursor that is `cursor-agent`,
9
25
  * which its installer always creates. Cursor's docs also call the command `agent`, but that name
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../src/lib/launch/agents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAarD,MAAM,CAAC,MAAM,aAAa,GAA2B,cAAc,CAAC,GAAG,CACrE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAC/G,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,IAAwB;IAClD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,GAAkB,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAE7F;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,CAAc,EACd,IAA+F,EAC/F,GAAuC,EACvC,QAAgB;IAEhB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC"}
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../src/lib/launch/agents.ts"],"names":[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,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC;IACF,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,CAAc,EACd,IAA+F,EAC/F,GAAuC,EACvC,QAAgB;IAEhB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { type AlignLocalState } from './strict-entry.js';
2
+ export type CodexProjectState = AlignLocalState;
3
+ /**
4
+ * The profile a user's own args select (`-p name`, `--profile name`, `--profile=name`, before
5
+ * any `--`). Codex layers $CODEX_HOME/<name>.config.toml for it. A name that could leave that
6
+ * directory (a separator, `..`) is never made into a path: undefined.
7
+ */
8
+ export declare function codexProfile(passthrough: string[]): string | undefined;
9
+ /**
10
+ * What Codex would already load for align, read with a TOML parser (sub-tables, dotted keys and
11
+ * inline tables all land on the same object).
12
+ *
13
+ * The CONFLICT scan reads every layer Codex might load, whatever the trust state, and fails
14
+ * closed. align cannot reproduce Codex's project resolution: a worktree resolves to its main
15
+ * repo's trust, an untrusted repo becomes trusted with one Enter at Codex's prompt and reloads
16
+ * WITH our -c overrides, and `project_root_markers` can put the project root ABOVE the git
17
+ * root (all verified on 0.153.0). So: /etc/codex/config.toml and managed_config.toml (both
18
+ * named in the 0.153.0 binary), $CODEX_HOME (or ~/.codex)/config.toml, the profile file a
19
+ * `-p`/`--profile` in the user's args selects, and EVERY .codex/config.toml from cwd up to the
20
+ * filesystem root (a superset, so it can only over-refuse). The user config met again as an
21
+ * ancestor is read once, as the user layer.
22
+ *
23
+ * "Already present" counts only the user, profile and system layers. A project's canonical
24
+ * align-local is simply overwritten by our identical -c values; a project's canonical `align`
25
+ * at worst duplicates tools.
26
+ */
27
+ export declare function readCodexState(cwd: string, home: string, opts: {
28
+ localIsDefault: boolean;
29
+ systemDir?: string;
30
+ }, env: Record<string, string | undefined>, platform: string, passthrough?: string[]): CodexProjectState;
31
+ //# sourceMappingURL=codex-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-state.d.ts","sourceRoot":"","sources":["../../../src/lib/launch/codex-state.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,mBAAmB,CAAC;AAEjF,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC;AA4BhD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAUtE;AAKD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EACrD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,QAAQ,EAAE,MAAM,EAChB,WAAW,GAAE,MAAM,EAAO,GACzB,iBAAiB,CA0BnB"}
@@ -0,0 +1,92 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { parse } from 'smol-toml';
4
+ import { foldLayers } from './strict-entry.js';
5
+ const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
6
+ /**
7
+ * A config.toml as an object. Missing or unparseable reads as empty: Codex itself refuses to
8
+ * start on a config.toml it cannot parse and names the error, so no entry in it can run
9
+ * either, and injecting as if it were absent changes nothing about what the user sees.
10
+ */
11
+ function readToml(file) {
12
+ try {
13
+ const parsed = parse(readFileSync(file, 'utf8'));
14
+ return isObject(parsed) ? parsed : {};
15
+ }
16
+ catch {
17
+ return {};
18
+ }
19
+ }
20
+ /** cwd and every directory above it, to the filesystem root. */
21
+ function ancestors(cwd) {
22
+ const dirs = [];
23
+ for (let dir = path.resolve(cwd);; dir = path.dirname(dir)) {
24
+ dirs.push(dir);
25
+ if (path.dirname(dir) === dir)
26
+ return dirs;
27
+ }
28
+ }
29
+ /**
30
+ * The profile a user's own args select (`-p name`, `--profile name`, `--profile=name`, before
31
+ * any `--`). Codex layers $CODEX_HOME/<name>.config.toml for it. A name that could leave that
32
+ * directory (a separator, `..`) is never made into a path: undefined.
33
+ */
34
+ export function codexProfile(passthrough) {
35
+ let name;
36
+ for (let i = 0; i < passthrough.length; i++) {
37
+ const a = passthrough[i];
38
+ if (a === '--')
39
+ break;
40
+ if (a === '-p' || a === '--profile')
41
+ name = passthrough[++i];
42
+ else if (a.startsWith('--profile='))
43
+ name = a.slice('--profile='.length);
44
+ }
45
+ if (!name || /[/\\]/.test(name) || name.includes('..'))
46
+ return undefined;
47
+ return name;
48
+ }
49
+ /** Every key -c overrides when it replaces align-local: command, args, and enabled=true. */
50
+ const REPLACEABLE = new Set(['command', 'args', 'enabled']);
51
+ /**
52
+ * What Codex would already load for align, read with a TOML parser (sub-tables, dotted keys and
53
+ * inline tables all land on the same object).
54
+ *
55
+ * The CONFLICT scan reads every layer Codex might load, whatever the trust state, and fails
56
+ * closed. align cannot reproduce Codex's project resolution: a worktree resolves to its main
57
+ * repo's trust, an untrusted repo becomes trusted with one Enter at Codex's prompt and reloads
58
+ * WITH our -c overrides, and `project_root_markers` can put the project root ABOVE the git
59
+ * root (all verified on 0.153.0). So: /etc/codex/config.toml and managed_config.toml (both
60
+ * named in the 0.153.0 binary), $CODEX_HOME (or ~/.codex)/config.toml, the profile file a
61
+ * `-p`/`--profile` in the user's args selects, and EVERY .codex/config.toml from cwd up to the
62
+ * filesystem root (a superset, so it can only over-refuse). The user config met again as an
63
+ * ancestor is read once, as the user layer.
64
+ *
65
+ * "Already present" counts only the user, profile and system layers. A project's canonical
66
+ * align-local is simply overwritten by our identical -c values; a project's canonical `align`
67
+ * at worst duplicates tools.
68
+ */
69
+ export function readCodexState(cwd, home, opts, env, platform, passthrough = []) {
70
+ const o = { localIsDefault: opts.localIsDefault, platform, host: 'codex' };
71
+ const replaceable = (e) => isObject(e) && Object.keys(e).every((k) => REPLACEABLE.has(k));
72
+ const at = (file) => ({ file, servers: readToml(file)['mcp_servers'] });
73
+ const systemDir = opts.systemDir ?? '/etc/codex';
74
+ const codexHome = env['CODEX_HOME'] ? env['CODEX_HOME'] : path.join(home, '.codex');
75
+ const userFile = path.resolve(codexHome, 'config.toml');
76
+ const profile = codexProfile(passthrough);
77
+ const base = foldLayers([
78
+ at(path.join(systemDir, 'config.toml')),
79
+ at(userFile),
80
+ ...(profile ? [at(path.join(codexHome, `${profile}.config.toml`))] : []),
81
+ at(path.join(systemDir, 'managed_config.toml')),
82
+ ], o, replaceable);
83
+ const projectFiles = ancestors(cwd).map((d) => path.join(d, '.codex', 'config.toml')).filter((f) => f !== userFile);
84
+ const project = foldLayers(projectFiles.map(at), o, replaceable);
85
+ const conflict = base.conflict ?? project.conflict;
86
+ return {
87
+ present: base.present,
88
+ overridden: [...base.overridden, ...project.overridden],
89
+ ...(conflict ? { conflict } : {}),
90
+ };
91
+ }
92
+ //# sourceMappingURL=codex-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-state.js","sourceRoot":"","sources":["../../../src/lib/launch/codex-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAwB,UAAU,EAAc,MAAM,mBAAmB,CAAC;AAKjF,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ACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type AlignLocalState } from './strict-entry.js';
2
+ export type CopilotProjectState = AlignLocalState;
3
+ /**
4
+ * What Copilot CLI (1.0.95) would already load for align. User: $COPILOT_HOME (or ~/.copilot)
5
+ * /mcp-config.json. Workspace: .mcp.json and .github/mcp.json from cwd up to the git root.
6
+ *
7
+ * Copilot loads the workspace files only in a trusted folder, but that verdict comes from its
8
+ * native runtime and several sources (its own store, IDE workspace folders, settings), none of
9
+ * which align can read reliably; only COPILOT_ALLOW_ALL=true is certain. And whether
10
+ * --additional-mcp-config replaces a same-named server whole is also native. So, both ways safe:
11
+ * - a workspace entry counts as "already present" only under COPILOT_ALLOW_ALL=true
12
+ * (otherwise inject: the worst case is a duplicate server, never a missing graph);
13
+ * - a non-canonical align-local in ANY of these files is a conflict (no injection), because
14
+ * a merged, repo-shaped align-local must never be launched.
15
+ */
16
+ export declare function readCopilotState(cwd: string, home: string, opts: {
17
+ localIsDefault: boolean;
18
+ }, env: Record<string, string | undefined>, platform: string): CopilotProjectState;
19
+ //# sourceMappingURL=copilot-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-state.d.ts","sourceRoot":"","sources":["../../../src/lib/launch/copilot-state.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAsC,MAAM,mBAAmB,CAAC;AAE7F,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAsBlD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,cAAc,EAAE,OAAO,CAAA;CAAE,EACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,QAAQ,EAAE,MAAM,GACf,mBAAmB,CAgBrB"}
@@ -0,0 +1,51 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { foldLayers, parseJsonc } from './strict-entry.js';
4
+ function layer(file) {
5
+ let text = null;
6
+ try {
7
+ text = readFileSync(file, 'utf8');
8
+ }
9
+ catch {
10
+ // missing or unreadable: no servers
11
+ }
12
+ return { file, servers: parseJsonc(text)?.['mcpServers'] };
13
+ }
14
+ /** cwd up to and including the git root; with no .git anywhere above, cwd alone. Never past the root. */
15
+ function workspaceDirs(cwd) {
16
+ const dirs = [];
17
+ for (let dir = cwd;; dir = path.dirname(dir)) {
18
+ dirs.push(dir);
19
+ if (existsSync(path.join(dir, '.git')))
20
+ return dirs;
21
+ if (path.dirname(dir) === dir)
22
+ return [cwd];
23
+ }
24
+ }
25
+ /**
26
+ * What Copilot CLI (1.0.95) would already load for align. User: $COPILOT_HOME (or ~/.copilot)
27
+ * /mcp-config.json. Workspace: .mcp.json and .github/mcp.json from cwd up to the git root.
28
+ *
29
+ * Copilot loads the workspace files only in a trusted folder, but that verdict comes from its
30
+ * native runtime and several sources (its own store, IDE workspace folders, settings), none of
31
+ * which align can read reliably; only COPILOT_ALLOW_ALL=true is certain. And whether
32
+ * --additional-mcp-config replaces a same-named server whole is also native. So, both ways safe:
33
+ * - a workspace entry counts as "already present" only under COPILOT_ALLOW_ALL=true
34
+ * (otherwise inject: the worst case is a duplicate server, never a missing graph);
35
+ * - a non-canonical align-local in ANY of these files is a conflict (no injection), because
36
+ * a merged, repo-shaped align-local must never be launched.
37
+ */
38
+ export function readCopilotState(cwd, home, opts, env, platform) {
39
+ const o = { ...opts, platform, host: 'copilot' };
40
+ const userFile = path.join(env['COPILOT_HOME'] ? env['COPILOT_HOME'] : path.join(home, '.copilot'), 'mcp-config.json');
41
+ const never = () => false;
42
+ const user = foldLayers([layer(userFile)], o, never);
43
+ const workspace = foldLayers(workspaceDirs(cwd).reverse().flatMap((d) => [layer(path.join(d, '.mcp.json')), layer(path.join(d, '.github', 'mcp.json'))]), o, never);
44
+ const conflict = user.conflict ?? workspace.conflict;
45
+ return {
46
+ present: user.present || (env['COPILOT_ALLOW_ALL'] === 'true' && workspace.present),
47
+ overridden: [],
48
+ ...(conflict ? { conflict } : {}),
49
+ };
50
+ }
51
+ //# sourceMappingURL=copilot-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-state.js","sourceRoot":"","sources":["../../../src/lib/launch/copilot-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAwB,UAAU,EAAc,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI7F,SAAS,KAAK,CAAC,IAAY;IACzB,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI,CAAC;QACH,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,oCAAoC;IACtC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED,yGAAyG;AACzG,SAAS,aAAa,CAAC,GAAW;IAChC,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,IAAI,GAAG,GAAG,GAAG,GAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACf,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QACpD,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG;YAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAW,EACX,IAAY,EACZ,I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{ type AlignLocalState } from './strict-entry.js';
3
+ /** The system settings file Gemini would read with no help from align, and what it holds. */
4
+ export interface GeminiSystemSettings {
5
+ path: string;
6
+ /** Its text; null when it does not exist (or is unreadable). */
7
+ text: string | null;
8
+ /** It exists but could not be read (a directory, no permission). */
9
+ unreadable: boolean;
10
+ }
11
+ export interface GeminiProjectState extends AlignLocalState {
12
+ systemSettings: GeminiSystemSettings;
13
+ trust: GeminiTrust;
14
+ }
15
+ /**
16
+ * The launch-cache name of the merged copy of one system settings file. One name per SOURCE,
17
+ * so two concurrent launches that read different system files never write the same copy.
18
+ */
19
+ export declare const COPY_PREFIX = "gemini-system-settings-";
20
+ export declare function geminiCopyName(source: string): string;
21
+ /**
22
+ * What Gemini CLI would already load here, in its merge order (gemini 0.58.0 mergeSettings:
23
+ * system-defaults, user, workspace, system): system-defaults, ~/.gemini (or $GEMINI_CLI_HOME)
24
+ * settings, the project's .gemini/settings.json ONLY when the folder is trusted (Gemini drops
25
+ * the workspace layer otherwise), and the system file. Files are JSONC, as Gemini reads them.
26
+ * mcpServers merges shallowly with the system tier last, so the injected system copy replaces
27
+ * any align-local whole: a non-canonical one is overridden, never a conflict.
28
+ */
29
+ export declare function readGeminiState(cwd: string, home: string, opts: {
30
+ localIsDefault: boolean;
31
+ }, env: Record<string, string | undefined>, platform: string): GeminiProjectState;
32
+ //# sourceMappingURL=gemini-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini-state.d.ts","sourceRoot":"","sources":["../../../src/lib/launch/gemini-state.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoF,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvI,OAAO,EAAE,KAAK,eAAe,EAA6D,MAAM,mBAAmB,CAAC;AAEpH,6FAA6F;AAC7F,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,oEAAoE;IACpE,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,cAAc,EAAE,oBAAoB,CAAC;IACrC,KAAK,EAAE,WAAW,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,4BAA4B,CAAC;AAErD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAoBD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,cAAc,EAAE,OAAO,CAAA;CAAE,EACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,QAAQ,EAAE,MAAM,GACf,kBAAkB,CAmBpB"}
@@ -0,0 +1,59 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFileSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { geminiDir, geminiFolderTrust, geminiSystemDefaultsPath, geminiSystemSettingsPath } from './gemini-trust.js';
5
+ import { foldLayers, isCanonicalLocalEntry, parseJsonc } from './strict-entry.js';
6
+ /**
7
+ * The launch-cache name of the merged copy of one system settings file. One name per SOURCE,
8
+ * so two concurrent launches that read different system files never write the same copy.
9
+ */
10
+ export const COPY_PREFIX = 'gemini-system-settings-';
11
+ export function geminiCopyName(source) {
12
+ return `${COPY_PREFIX}${createHash('sha256').update(path.resolve(source)).digest('hex').slice(0, 12)}.json`;
13
+ }
14
+ function readSystem(file) {
15
+ try {
16
+ return { path: file, text: readFileSync(file, 'utf8'), unreadable: false };
17
+ }
18
+ catch (e) {
19
+ return { path: file, text: null, unreadable: e.code !== 'ENOENT' };
20
+ }
21
+ }
22
+ function readText(file) {
23
+ try {
24
+ return readFileSync(file, 'utf8');
25
+ }
26
+ catch {
27
+ return null;
28
+ }
29
+ }
30
+ const layer = (file, text) => ({ file, servers: parseJsonc(text)?.['mcpServers'] });
31
+ /**
32
+ * What Gemini CLI would already load here, in its merge order (gemini 0.58.0 mergeSettings:
33
+ * system-defaults, user, workspace, system): system-defaults, ~/.gemini (or $GEMINI_CLI_HOME)
34
+ * settings, the project's .gemini/settings.json ONLY when the folder is trusted (Gemini drops
35
+ * the workspace layer otherwise), and the system file. Files are JSONC, as Gemini reads them.
36
+ * mcpServers merges shallowly with the system tier last, so the injected system copy replaces
37
+ * any align-local whole: a non-canonical one is overridden, never a conflict.
38
+ */
39
+ export function readGeminiState(cwd, home, opts, env, platform) {
40
+ const system = readSystem(geminiSystemSettingsPath(env, platform));
41
+ const trust = geminiFolderTrust(cwd, home, env, platform);
42
+ const defaultsPath = env['GEMINI_CLI_SYSTEM_DEFAULTS_PATH'] ? env['GEMINI_CLI_SYSTEM_DEFAULTS_PATH'] : geminiSystemDefaultsPath(system.path, platform);
43
+ const userPath = path.join(geminiDir(home, env), 'settings.json');
44
+ const workspacePath = path.join(cwd, '.gemini', 'settings.json');
45
+ const layers = [
46
+ layer(defaultsPath, readText(defaultsPath)),
47
+ layer(userPath, readText(userPath)),
48
+ ...(trust === 'trusted' || trust === 'off' ? [layer(workspacePath, readText(workspacePath))] : []),
49
+ layer(system.path, system.text),
50
+ ];
51
+ const o = { ...opts, platform, host: 'mcpServers' };
52
+ const { overridden } = foldLayers(layers, o, () => true);
53
+ // Only the user's own `align` stands in for us. A canonical align-local does not: the system
54
+ // copy replaces it whole anyway, and skipping would let a workspace align-local trusted later
55
+ // take its place.
56
+ const present = layers.some((l) => isCanonicalLocalEntry(l.servers?.['align'], o));
57
+ return { present, overridden, systemSettings: system, trust };
58
+ }
59
+ //# sourceMappingURL=gemini-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini-state.js","sourceRoot":"","sources":["../../../src/lib/launch/gemini-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,I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CAAC,IAAI,CAAC,CAAC;IACzD,6FAA6F;IAC7F,8FAA8F;IAC9F,kBAAkB;IAClB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAE,CAAC,CAAC,OAA+C,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5H,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAChE,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Whether Gemini CLI will run MCP servers in this folder. Gemini turns off EVERY MCP server,
3
+ * the injected align-local included, in a folder it does not trust.
4
+ * - trusted / untrusted: what Gemini will decide.
5
+ * - off: folder trust is turned off in the user's settings, so nothing is disabled.
6
+ * - unknown: trustedFolders.json is unreadable or invalid (Gemini itself refuses to start then).
7
+ */
8
+ export type GeminiTrust = 'trusted' | 'untrusted' | 'off' | 'unknown';
9
+ /** Gemini's own default system settings file, used when GEMINI_CLI_SYSTEM_SETTINGS_PATH is unset. */
10
+ export declare function geminiSystemSettingsPath(env: Record<string, string | undefined>, platform: string): string;
11
+ /** GEMINI_CLI_SYSTEM_DEFAULTS_PATH, else `system-defaults.json` beside the system settings file. */
12
+ export declare function geminiSystemDefaultsPath(systemSettingsPath: string, platform: string): string;
13
+ /** ~/.gemini, or $GEMINI_CLI_HOME/.gemini when set. */
14
+ export declare function geminiDir(home: string, env: Record<string, string | undefined>): string;
15
+ /**
16
+ * Gemini CLI 0.58.0's folder-trust verdict for `cwd`, read from its own files and never written
17
+ * (packages/core/src/utils/trust.ts, cli/src/config/trustedFolders.ts):
18
+ * - GEMINI_CLI_TRUST_WORKSPACE=true|false decides outright;
19
+ * - folder trust turned off in settings means nothing is disabled;
20
+ * - else the LONGEST matching rule in trustedFolders.json decides, where TRUST_PARENT matches
21
+ * the rule's parent directory, and no matching rule is untrusted.
22
+ * Gemini also accepts a trust decision from a connected IDE; align cannot see that, so in an IDE
23
+ * terminal this can say untrusted for a folder Gemini will treat as trusted (one extra line).
24
+ */
25
+ export declare function geminiFolderTrust(cwd: string, home: string, env: Record<string, string | undefined>, platform: string): GeminiTrust;
26
+ //# sourceMappingURL=gemini-trust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini-trust.d.ts","sourceRoot":"","sources":["../../../src/lib/launch/gemini-trust.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,CAAC;AAgBtE,qGAAqG;AACrG,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK1G;AAED,oGAAoG;AACpG,wBAAgB,wBAAwB,CAAC,kBAAkB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG7F;AAED,uDAAuD;AACvD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAEvF;AAqCD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAuBnI"}