@bastani/atomic 0.6.6-1 → 0.6.6

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.
@@ -22,7 +22,8 @@ export declare function copilotSubprocessEnv(baseEnv?: NodeJS.ProcessEnv): Recor
22
22
  * Enumerate every existing `cmd` candidate across PATH order.
23
23
  */
24
24
  export declare function enumeratePathCandidates(cmd: string, pathEnv: string): string[];
25
- export declare function resolveCopilotCliPath(): string | undefined;
25
+ export type CommandPathResolver = (cmd: string) => string | null;
26
+ export declare function resolveCopilotCliPath(resolveCommandPath?: CommandPathResolver): string | undefined;
26
27
  /**
27
28
  * Build options suitable for `new CopilotClient(...)`.
28
29
  *
@@ -31,7 +32,7 @@ export declare function resolveCopilotCliPath(): string | undefined;
31
32
  * - `cliPath` from {@link resolveCopilotCliPath} when resolvable; omitted
32
33
  * otherwise so the SDK falls back to its bundled CLI.
33
34
  */
34
- export declare function copilotSdkLaunchOptions(): CopilotClientOptions;
35
+ export declare function copilotSdkLaunchOptions(resolveCommandPath?: CommandPathResolver): CopilotClientOptions;
35
36
  /**
36
37
  * Fold the atomic-managed additional instructions into a caller's
37
38
  * `systemMessage` value on `client.createSession`. Behavior:
@@ -1 +1 @@
1
- {"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../../src/sdk/providers/copilot.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,IAAI,oBAAoB,EACtC,MAAM,qBAAqB,CAAC;AAwC7B;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAYxD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,MAAM,CAAC,UAAwB,GACvC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAEpC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAA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C,KAAK,EAAE,MAAM,GACZ,oBAAoB,CAAC,eAAe,CAAC,CASvC;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,+DAelC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.6.6-1",
3
+ "version": "0.6.6",
4
4
  "description": "Configuration management CLI and SDK for coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,7 +49,10 @@ import {
49
49
  buildTmuxEnv,
50
50
  } from "../../../lib/terminal-env.ts";
51
51
  import { atomicTempEnv } from "../../../lib/atomic-temp.ts";
52
- import { resolveCopilotCliPath } from "../../../sdk/providers/copilot.ts";
52
+ import {
53
+ type CommandPathResolver,
54
+ resolveCopilotCliPath,
55
+ } from "../../../sdk/providers/copilot.ts";
53
56
 
54
57
  export {
55
58
  buildLauncherEnv,
@@ -134,13 +137,16 @@ export function getAdditionalInstructionsDir(
134
137
  return path ? dirname(path) : undefined;
135
138
  }
136
139
 
137
- export function resolveChatCommand(agentType: AgentType): string | undefined {
140
+ export function resolveChatCommand(
141
+ agentType: AgentType,
142
+ resolveCommandPath: CommandPathResolver = getCommandPath,
143
+ ): string | undefined {
138
144
  if (agentType === "copilot") {
139
- return resolveCopilotCliPath();
145
+ return resolveCopilotCliPath(resolveCommandPath);
140
146
  }
141
147
 
142
148
  const config = AGENT_CONFIG[agentType];
143
- return getCommandPath(config.cmd) ?? undefined;
149
+ return resolveCommandPath(config.cmd) ?? undefined;
144
150
  }
145
151
 
146
152
  function generateChatId(): string {
@@ -94,11 +94,15 @@ export function enumeratePathCandidates(cmd: string, pathEnv: string): string[]
94
94
  return results;
95
95
  }
96
96
 
97
- export function resolveCopilotCliPath(): string | undefined {
97
+ export type CommandPathResolver = (cmd: string) => string | null;
98
+
99
+ export function resolveCopilotCliPath(
100
+ resolveCommandPath: CommandPathResolver = getCommandPath,
101
+ ): string | undefined {
98
102
  const envPath = process.env["COPILOT_CLI_PATH"];
99
103
  if (envPath) return envPath;
100
104
 
101
- const primary = getCommandPath("copilot");
105
+ const primary = resolveCommandPath("copilot");
102
106
  if (primary === null) return undefined;
103
107
  if (!isCopilotShim(primary)) return primary;
104
108
 
@@ -119,11 +123,13 @@ export function resolveCopilotCliPath(): string | undefined {
119
123
  * - `cliPath` from {@link resolveCopilotCliPath} when resolvable; omitted
120
124
  * otherwise so the SDK falls back to its bundled CLI.
121
125
  */
122
- export function copilotSdkLaunchOptions(): CopilotClientOptions {
126
+ export function copilotSdkLaunchOptions(
127
+ resolveCommandPath: CommandPathResolver = getCommandPath,
128
+ ): CopilotClientOptions {
123
129
  const options: CopilotClientOptions = {
124
130
  env: copilotSubprocessEnv(),
125
131
  };
126
- const cliPath = resolveCopilotCliPath();
132
+ const cliPath = resolveCopilotCliPath(resolveCommandPath);
127
133
  if (cliPath !== undefined) {
128
134
  options.cliPath = cliPath;
129
135
  }