@aligndottech/cli 0.47.0 → 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.
- package/dist/commands/agents.d.ts +20 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +60 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/connect-agents.d.ts +3 -1
- package/dist/commands/connect-agents.d.ts.map +1 -1
- package/dist/commands/connect-agents.js +15 -5
- package/dist/commands/connect-agents.js.map +1 -1
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/registry.js +3 -0
- package/dist/commands/registry.js.map +1 -1
- package/dist/commands/setup.d.ts +1 -0
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +10 -5
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/use.js +1 -1
- package/dist/commands/use.js.map +1 -1
- package/dist/lib/foreign-env.d.ts +11 -0
- package/dist/lib/foreign-env.d.ts.map +1 -1
- package/dist/lib/foreign-env.js +23 -0
- package/dist/lib/foreign-env.js.map +1 -1
- package/dist/lib/launch/adapters/claude-code.d.ts +8 -0
- package/dist/lib/launch/adapters/claude-code.d.ts.map +1 -1
- package/dist/lib/launch/adapters/claude-code.js.map +1 -1
- package/dist/lib/launch/adapters/codex.d.ts +17 -0
- package/dist/lib/launch/adapters/codex.d.ts.map +1 -0
- package/dist/lib/launch/adapters/codex.js +44 -0
- package/dist/lib/launch/adapters/codex.js.map +1 -0
- package/dist/lib/launch/adapters/copilot.d.ts +17 -0
- package/dist/lib/launch/adapters/copilot.d.ts.map +1 -0
- package/dist/lib/launch/adapters/copilot.js +29 -0
- package/dist/lib/launch/adapters/copilot.js.map +1 -0
- package/dist/lib/launch/adapters/gemini-cli.d.ts +25 -0
- package/dist/lib/launch/adapters/gemini-cli.d.ts.map +1 -0
- package/dist/lib/launch/adapters/gemini-cli.js +73 -0
- package/dist/lib/launch/adapters/gemini-cli.js.map +1 -0
- package/dist/lib/launch/agents.d.ts +12 -2
- package/dist/lib/launch/agents.d.ts.map +1 -1
- package/dist/lib/launch/agents.js +18 -8
- package/dist/lib/launch/agents.js.map +1 -1
- package/dist/lib/launch/codex-state.d.ts +31 -0
- package/dist/lib/launch/codex-state.d.ts.map +1 -0
- package/dist/lib/launch/codex-state.js +92 -0
- package/dist/lib/launch/codex-state.js.map +1 -0
- package/dist/lib/launch/copilot-state.d.ts +19 -0
- package/dist/lib/launch/copilot-state.d.ts.map +1 -0
- package/dist/lib/launch/copilot-state.js +51 -0
- package/dist/lib/launch/copilot-state.js.map +1 -0
- package/dist/lib/launch/gemini-state.d.ts +32 -0
- package/dist/lib/launch/gemini-state.d.ts.map +1 -0
- package/dist/lib/launch/gemini-state.js +59 -0
- package/dist/lib/launch/gemini-state.js.map +1 -0
- package/dist/lib/launch/gemini-trust.d.ts +26 -0
- package/dist/lib/launch/gemini-trust.d.ts.map +1 -0
- package/dist/lib/launch/gemini-trust.js +103 -0
- package/dist/lib/launch/gemini-trust.js.map +1 -0
- package/dist/lib/launch/install.d.ts +33 -0
- package/dist/lib/launch/install.d.ts.map +1 -0
- package/dist/lib/launch/install.js +48 -0
- package/dist/lib/launch/install.js.map +1 -0
- package/dist/lib/launch/launch-files.d.ts +15 -0
- package/dist/lib/launch/launch-files.d.ts.map +1 -1
- package/dist/lib/launch/launch-files.js +64 -4
- package/dist/lib/launch/launch-files.js.map +1 -1
- package/dist/lib/launch/launch.d.ts +32 -7
- package/dist/lib/launch/launch.d.ts.map +1 -1
- package/dist/lib/launch/launch.js +66 -40
- package/dist/lib/launch/launch.js.map +1 -1
- package/dist/lib/launch/pick-agent.d.ts +12 -5
- package/dist/lib/launch/pick-agent.d.ts.map +1 -1
- package/dist/lib/launch/pick-agent.js +46 -19
- package/dist/lib/launch/pick-agent.js.map +1 -1
- package/dist/lib/launch/picker-options.d.ts +30 -0
- package/dist/lib/launch/picker-options.d.ts.map +1 -0
- package/dist/lib/launch/picker-options.js +42 -0
- package/dist/lib/launch/picker-options.js.map +1 -0
- package/dist/lib/launch/prompts.d.ts +11 -0
- package/dist/lib/launch/prompts.d.ts.map +1 -0
- package/dist/lib/launch/prompts.js +27 -0
- package/dist/lib/launch/prompts.js.map +1 -0
- package/dist/lib/launch/registry/agents/claude-code.d.ts +3 -0
- package/dist/lib/launch/registry/agents/claude-code.d.ts.map +1 -0
- package/dist/lib/launch/registry/agents/claude-code.js +11 -0
- package/dist/lib/launch/registry/agents/claude-code.js.map +1 -0
- package/dist/lib/launch/registry/agents/codex.d.ts +3 -0
- package/dist/lib/launch/registry/agents/codex.d.ts.map +1 -0
- package/dist/lib/launch/registry/agents/codex.js +11 -0
- package/dist/lib/launch/registry/agents/codex.js.map +1 -0
- package/dist/lib/launch/registry/agents/copilot.d.ts +3 -0
- package/dist/lib/launch/registry/agents/copilot.d.ts.map +1 -0
- package/dist/lib/launch/registry/agents/copilot.js +11 -0
- package/dist/lib/launch/registry/agents/copilot.js.map +1 -0
- package/dist/lib/launch/registry/agents/cursor.d.ts +3 -0
- package/dist/lib/launch/registry/agents/cursor.d.ts.map +1 -0
- package/dist/lib/launch/registry/agents/cursor.js +11 -0
- package/dist/lib/launch/registry/agents/cursor.js.map +1 -0
- package/dist/lib/launch/registry/agents/gemini-cli.d.ts +3 -0
- package/dist/lib/launch/registry/agents/gemini-cli.d.ts.map +1 -0
- package/dist/lib/launch/registry/agents/gemini-cli.js +11 -0
- package/dist/lib/launch/registry/agents/gemini-cli.js.map +1 -0
- package/dist/lib/launch/registry/agents/opencode.d.ts +3 -0
- package/dist/lib/launch/registry/agents/opencode.d.ts.map +1 -0
- package/dist/lib/launch/registry/agents/opencode.js +11 -0
- package/dist/lib/launch/registry/agents/opencode.js.map +1 -0
- package/dist/lib/launch/registry/agents/pi.d.ts +3 -0
- package/dist/lib/launch/registry/agents/pi.d.ts.map +1 -0
- package/dist/lib/launch/registry/agents/pi.js +11 -0
- package/dist/lib/launch/registry/agents/pi.js.map +1 -0
- package/dist/lib/launch/registry/index.d.ts +5 -0
- package/dist/lib/launch/registry/index.d.ts.map +1 -0
- package/dist/lib/launch/registry/index.js +13 -0
- package/dist/lib/launch/registry/index.js.map +1 -0
- package/dist/lib/launch/registry/types.d.ts +31 -0
- package/dist/lib/launch/registry/types.d.ts.map +1 -0
- package/dist/lib/launch/registry/types.js +2 -0
- package/dist/lib/launch/registry/types.js.map +1 -0
- package/dist/lib/launch/run-agent.d.ts +4 -0
- package/dist/lib/launch/run-agent.d.ts.map +1 -1
- package/dist/lib/launch/run-agent.js +1 -1
- package/dist/lib/launch/run-agent.js.map +1 -1
- package/dist/lib/launch/strict-entry.d.ts +49 -0
- package/dist/lib/launch/strict-entry.d.ts.map +1 -0
- package/dist/lib/launch/strict-entry.js +106 -0
- package/dist/lib/launch/strict-entry.js.map +1 -0
- package/package.json +3 -2
package/dist/lib/foreign-env.js
CHANGED
|
@@ -24,4 +24,27 @@ export function foreignNotice(file, scope) {
|
|
|
24
24
|
? `Left the existing align entry in ${file} as is. To point this agent at the local graph instead, run: align mcp --setup --env local`
|
|
25
25
|
: `Left the existing align entry in ${file} as is (it is not set to --env local). Edit it by hand to use the local graph.`;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* ONE calm line for every global agent whose existing align entry was kept. Five agents
|
|
29
|
+
* with a non-local entry is one fact, not five warnings: and the advice is mostly moot,
|
|
30
|
+
* because `align` injects `align-local` next to the user's own entry for that session.
|
|
31
|
+
*/
|
|
32
|
+
export function keptConnectionNotice(agents) {
|
|
33
|
+
if (agents.length === 0)
|
|
34
|
+
return undefined;
|
|
35
|
+
const who = agents.length === 1 ? agents[0] : `${agents.length} agents (${agents.join(', ')})`;
|
|
36
|
+
return `Kept your existing Align connection in ${who}. Agents opened with \`align\` also get the local graph.`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* One line for committed project files left alone. A different fact from the global agents:
|
|
40
|
+
* the file is teammate-visible and editing it by hand is the only way to change it.
|
|
41
|
+
*/
|
|
42
|
+
export function projectForeignNotice(files) {
|
|
43
|
+
const unique = [...new Set(files)];
|
|
44
|
+
if (unique.length === 0)
|
|
45
|
+
return undefined;
|
|
46
|
+
return unique.length === 1
|
|
47
|
+
? `Left the existing align entry as is in ${unique[0]} (a committed project file, not set to --env local). Edit it by hand to use the local graph.`
|
|
48
|
+
: `Left the existing align entry as is in ${unique.join(', ')} (committed project files, not set to --env local). Edit them by hand to use the local graph.`;
|
|
49
|
+
}
|
|
27
50
|
//# sourceMappingURL=foreign-env.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foreign-env.js","sourceRoot":"","sources":["../../src/lib/foreign-env.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,KAA2B;IACrE,OAAO,KAAK,KAAK,QAAQ;QACvB,CAAC,CAAC,oCAAoC,IAAI,4FAA4F;QACtI,CAAC,CAAC,oCAAoC,IAAI,gFAAgF,CAAC;AAC/H,CAAC"}
|
|
1
|
+
{"version":3,"file":"foreign-env.js","sourceRoot":"","sources":["../../src/lib/foreign-env.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,KAA2B;IACrE,OAAO,KAAK,KAAK,QAAQ;QACvB,CAAC,CAAC,oCAAoC,IAAI,4FAA4F;QACtI,CAAC,CAAC,oCAAoC,IAAI,gFAAgF,CAAC;AAC/H,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAgB;IACnD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,YAAY,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAChG,OAAO,0CAA0C,GAAG,0DAA0D,CAAC;AACjH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAe;IAClD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACnC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC;QACxB,CAAC,CAAC,0CAA0C,MAAM,CAAC,CAAC,CAAC,8FAA8F;QACnJ,CAAC,CAAC,0CAA0C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,+FAA+F,CAAC;AACjK,CAAC"}
|
|
@@ -2,6 +2,8 @@ import type { ConfigWrite } from '../config-writes.js';
|
|
|
2
2
|
export interface LaunchFile {
|
|
3
3
|
name: string;
|
|
4
4
|
content: string;
|
|
5
|
+
/** File mode, for a file that copies something of the user's (Gemini's system settings). */
|
|
6
|
+
mode?: number;
|
|
5
7
|
}
|
|
6
8
|
/** What to run: pure data, so the builder is testable without spawning anything. */
|
|
7
9
|
export interface LaunchSpec {
|
|
@@ -11,6 +13,12 @@ export interface LaunchSpec {
|
|
|
11
13
|
env: Record<string, string>;
|
|
12
14
|
/** Launch files the args point at. Commands and text only, never secrets. */
|
|
13
15
|
files: LaunchFile[];
|
|
16
|
+
/** Tidy `<prefix>*` launch files: refresh `keep`, delete `remove`, and age out the rest (pruneLaunchFiles). */
|
|
17
|
+
prune?: {
|
|
18
|
+
prefix: string;
|
|
19
|
+
keep?: string;
|
|
20
|
+
remove?: string;
|
|
21
|
+
};
|
|
14
22
|
/** Lines align prints to stderr before launching (why an injection was skipped). */
|
|
15
23
|
notes?: string[];
|
|
16
24
|
/** Files in the user's own agent config to add to ONCE (C4). Applied after the dry-run exit, never before. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/claude-code.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/claude-code.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,6EAA6E;IAC7E,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,+GAA+G;IAC/G,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,8GAA8G;IAC9G,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,+FAA+F;IAC/F,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,0DAA0D;IAC1D,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAWD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,aAAa,GAAG,UAAU,CAmB9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/claude-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/claude-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAqCtD;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAE3C,MAAM,IAAI,GAAG,CAAC,KAAc,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAE/E;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,CAAgB;IAChD,MAAM,IAAI,GAAa,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAI,CAAC,YAAY,EAAE,aAAa,CAAW,CAAC,MAAM,C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AI,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5I,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AlignLocalState } from '../strict-entry.js';
|
|
2
|
+
import type { LaunchContext, LaunchSpec } from './claude-code.js';
|
|
3
|
+
export interface CodexLaunchContext extends Pick<LaunchContext, 'passthrough'>, AlignLocalState {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Codex, per session, nothing written to the user's own config (codex-cli 0.153.0):
|
|
7
|
+
* `-c key=value` overrides one config value for this run, parsed as TOML, and leaves every
|
|
8
|
+
* other `mcp_servers` table in place. So align-local is two overrides, and the user's own
|
|
9
|
+
* servers still load beside it (verified with `codex -c ... mcp list`).
|
|
10
|
+
*
|
|
11
|
+
* ORDER: our -c flags go FIRST. `-c` is a root option, and codex reads root options before the
|
|
12
|
+
* `[PROMPT]` or `<COMMAND>` that follows them, so in front it applies to a bare session, to
|
|
13
|
+
* `exec`, `resume` and every other subcommand, and it can never land after a user's `--`, where
|
|
14
|
+
* it would be read as a prompt.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildCodexLaunch(c: CodexLaunchContext): LaunchSpec;
|
|
17
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/codex.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,eAAe;CAAG;AAelG;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,kBAAkB,GAAG,UAAU,CAiBlE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { alignServerEntry } from '../../mcp-setup.js';
|
|
2
|
+
/** Same reason as the Claude adapter: never shadow a user's own `align` server. */
|
|
3
|
+
const INJECTED_SERVER_NAME = 'align-local';
|
|
4
|
+
/**
|
|
5
|
+
* A TOML literal string. Single quotes, not JSON's double quotes: on Windows an npm `codex.cmd`
|
|
6
|
+
* runs through cmd.exe, and runAgent refuses any arg holding `"`. A literal string has no
|
|
7
|
+
* escapes, so a value holding `'` or a newline cannot be written this way; ours never do.
|
|
8
|
+
*/
|
|
9
|
+
function tomlLiteral(value) {
|
|
10
|
+
if (/['\n\r]/.test(value))
|
|
11
|
+
throw new Error(`cannot pass ${JSON.stringify(value)} to codex -c as a TOML literal string`);
|
|
12
|
+
return `'${value}'`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Codex, per session, nothing written to the user's own config (codex-cli 0.153.0):
|
|
16
|
+
* `-c key=value` overrides one config value for this run, parsed as TOML, and leaves every
|
|
17
|
+
* other `mcp_servers` table in place. So align-local is two overrides, and the user's own
|
|
18
|
+
* servers still load beside it (verified with `codex -c ... mcp list`).
|
|
19
|
+
*
|
|
20
|
+
* ORDER: our -c flags go FIRST. `-c` is a root option, and codex reads root options before the
|
|
21
|
+
* `[PROMPT]` or `<COMMAND>` that follows them, so in front it applies to a bare session, to
|
|
22
|
+
* `exec`, `resume` and every other subcommand, and it can never land after a user's `--`, where
|
|
23
|
+
* it would be read as a prompt.
|
|
24
|
+
*/
|
|
25
|
+
export function buildCodexLaunch(c) {
|
|
26
|
+
const injected = [];
|
|
27
|
+
const notes = [];
|
|
28
|
+
if (c.conflict) {
|
|
29
|
+
// -c can set keys but never remove one: injecting would launch a merged, repo-shaped server.
|
|
30
|
+
notes.push(`${c.conflict} redefines the align-local MCP server, so Align's graph is off for this Codex session. Remove that entry to use the graph here.`);
|
|
31
|
+
}
|
|
32
|
+
else if (c.overridden.length > 0 || !c.present) {
|
|
33
|
+
const { command, args } = alignServerEntry('mcpServers', 'local');
|
|
34
|
+
const key = `mcp_servers.${INJECTED_SERVER_NAME}`;
|
|
35
|
+
injected.push('-c', `${key}.command=${tomlLiteral(command)}`, '-c', `${key}.args=[${args.map(tomlLiteral).join(',')}]`);
|
|
36
|
+
if (c.overridden.length > 0) {
|
|
37
|
+
// The table holds only command/args/enabled, so these three overrides replace all of it.
|
|
38
|
+
injected.push('-c', `${key}.enabled=true`);
|
|
39
|
+
notes.push(`Replaced the align-local MCP server in ${c.overridden.join(', ')} with Align's own for this Codex session.`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { bin: 'codex', args: [...injected, ...c.passthrough], env: { ALIGN_WRAPPED: '1' }, files: [], ...(notes.length > 0 ? { notes } : {}) };
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,mFAAmF;AACnF,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAE3C;;;;GAIG;AACH,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACxH,OAAO,IAAI,KAAK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E,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACjJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AlignLocalState } from '../strict-entry.js';
|
|
2
|
+
import type { LaunchContext, LaunchSpec } from './claude-code.js';
|
|
3
|
+
export interface CopilotLaunchContext extends Pick<LaunchContext, 'passthrough' | 'cachePath'>, AlignLocalState {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* GitHub Copilot CLI, per session, nothing written to the user's own config (copilot 1.0.95,
|
|
7
|
+
* `copilot --help`): `--additional-mcp-config <json>` takes "JSON string or file path (prefix
|
|
8
|
+
* with @) ... augments config from ~/.copilot/mcp-config.json for this session". So align-local
|
|
9
|
+
* goes in a launch file and the user's own servers still load. COPILOT_HOME is never set: that
|
|
10
|
+
* dir also holds the user's auth.
|
|
11
|
+
*
|
|
12
|
+
* ORDER: the flag goes FIRST. It is a root option: `copilot --additional-mcp-config @f mcp list`
|
|
13
|
+
* is accepted and `copilot mcp list --additional-mcp-config @f` is refused by the subcommand
|
|
14
|
+
* (both checked on 1.0.95), and in front it can never land after a user's `--`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildCopilotLaunch(c: CopilotLaunchContext): LaunchSpec;
|
|
17
|
+
//# sourceMappingURL=copilot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/copilot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,WAAW,CAAC,EAAE,eAAe;CAAG;AAMlH;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,oBAAoB,GAAG,UAAU,CAWtE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { alignServerEntry } from '../../mcp-setup.js';
|
|
2
|
+
/** Same reason as the Claude adapter: never shadow a user's own `align` server. */
|
|
3
|
+
const INJECTED_SERVER_NAME = 'align-local';
|
|
4
|
+
const MCP_FILE = 'copilot-mcp.json';
|
|
5
|
+
/**
|
|
6
|
+
* GitHub Copilot CLI, per session, nothing written to the user's own config (copilot 1.0.95,
|
|
7
|
+
* `copilot --help`): `--additional-mcp-config <json>` takes "JSON string or file path (prefix
|
|
8
|
+
* with @) ... augments config from ~/.copilot/mcp-config.json for this session". So align-local
|
|
9
|
+
* goes in a launch file and the user's own servers still load. COPILOT_HOME is never set: that
|
|
10
|
+
* dir also holds the user's auth.
|
|
11
|
+
*
|
|
12
|
+
* ORDER: the flag goes FIRST. It is a root option: `copilot --additional-mcp-config @f mcp list`
|
|
13
|
+
* is accepted and `copilot mcp list --additional-mcp-config @f` is refused by the subcommand
|
|
14
|
+
* (both checked on 1.0.95), and in front it can never land after a user's `--`.
|
|
15
|
+
*/
|
|
16
|
+
export function buildCopilotLaunch(c) {
|
|
17
|
+
const injected = [];
|
|
18
|
+
const files = [];
|
|
19
|
+
const notes = [];
|
|
20
|
+
if (c.conflict) {
|
|
21
|
+
notes.push(`${c.conflict} redefines the align-local MCP server, so Align's graph is off for this Copilot session. Remove that entry to use the graph here.`);
|
|
22
|
+
}
|
|
23
|
+
else if (!c.present) {
|
|
24
|
+
files.push({ name: MCP_FILE, content: `${JSON.stringify({ mcpServers: { [INJECTED_SERVER_NAME]: alignServerEntry('copilot', 'local') } }, null, 2)}\n` });
|
|
25
|
+
injected.push('--additional-mcp-config', `@${c.cachePath(MCP_FILE)}`);
|
|
26
|
+
}
|
|
27
|
+
return { bin: 'copilot', args: [...injected, ...c.passthrough], env: { ALIGN_WRAPPED: '1' }, files, ...(notes.length > 0 ? { notes } : {}) };
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=copilot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../../src/lib/launch/adapters/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,mFAAmF;AACnF,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,CAAuB;IACxD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,KAAK,GAAwB,EAAE,CAAC;IACtC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,mIAAmI,CAAC,CAAC;IAC/J,CAAC;SAAM,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1J,QAAQ,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,GAAG,QAAQ,EAAE,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC/I,CAAC"}
|
|
@@ -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
|
+
}
|
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,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 {
|
|
1
|
+
import type { LaunchAgentId } from './registry/types.js';
|
|
2
2
|
export interface LaunchAgent {
|
|
3
|
-
name:
|
|
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":"
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../src/lib/launch/agents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,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,wFAAwF;IACxF,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,GAAG,SAAS,CAE7E;AAED,eAAO,MAAM,eAAe,QAAO,WAAW,EAA8C,CAAC;AAE7F;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,aAAa,EAAkF,CAAC;AACrI,2CAA2C;AAC3C,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,aAAa,CAAwD,CAAC;AAE3G,wBAAgB,UAAU,CAAC,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,15 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
{ name: 'cursor', label: 'Cursor', bin: 'cursor-agent', injection: 'written-once', supported: true, install: 'https://cursor.com/cli' },
|
|
5
|
-
{ name: 'gemini-cli', label: 'Gemini CLI', bin: 'gemini', injection: 'per-session', supported: false, install: 'npm i -g @google/gemini-cli' },
|
|
6
|
-
{ name: 'opencode', label: 'OpenCode', bin: 'opencode', injection: 'per-session', supported: true, install: 'npm i -g opencode-ai' },
|
|
7
|
-
{ name: 'pi', label: 'pi', bin: 'pi', injection: 'written-once', supported: true, install: 'https://pi.dev' },
|
|
8
|
-
];
|
|
1
|
+
import { installText } from './install.js';
|
|
2
|
+
import { AGENT_REGISTRY } from './registry/index.js';
|
|
3
|
+
export const LAUNCH_AGENTS = AGENT_REGISTRY.map(({ name, label, bin, injection, supported, install }) => ({ name, label, bin, injection, supported, install: installText(install) }));
|
|
9
4
|
export function agentByName(name) {
|
|
10
5
|
return LAUNCH_AGENTS.find((a) => a.name === name);
|
|
11
6
|
}
|
|
12
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
|
+
}
|
|
13
23
|
/**
|
|
14
24
|
* The agent's binary on PATH, and where. Only `bin` is accepted: for Cursor that is `cursor-agent`,
|
|
15
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":"
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../src/lib/launch/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAerD,MAAM,CAAC,MAAM,aAAa,GAA2B,cAAc,CAAC,GAAG,CACrE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,SAA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AM,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,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;;;;GAIG;AACH,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,gEAAgE;AAChE,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,IAAI,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ChD,EACD,CAAC,EACD,WAAW,CACZ,CAAC;IACF,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC;IACpH,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACnD,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;QACvD,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClC,CAAC;AACJ,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"}
|