@bastani/atomic-acp 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/dist/index.js +75 -52
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -43,7 +43,14 @@ npm install -g @bastani/atomic @bastani/atomic-acp
|
|
|
43
43
|
atomic # sign in, then quit
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
If you use Atomic's standalone release archive instead of the npm package, install only the adapter:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
curl -fsSL https://raw.githubusercontent.com/bastani-inc/atomic/main/install.sh | sh # Windows: irm https://raw.githubusercontent.com/bastani-inc/atomic/main/install.ps1 | iex
|
|
50
|
+
npm install -g @bastani/atomic-acp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`atomic-acp` uses the `atomic` on your `PATH`, or the one `ATOMIC_ACP_ATOMIC_COMMAND` names, and never installs Atomic itself. Run `atomic-acp --help` for its options.
|
|
47
54
|
|
|
48
55
|
### Add it to Zed
|
|
49
56
|
|
|
@@ -112,11 +119,18 @@ Set these in the `env` of your agent server entry:
|
|
|
112
119
|
| `ATOMIC_ACP_ATOMIC_ARGS` | unset | JSON array of extra arguments for every Atomic process |
|
|
113
120
|
| `ATOMIC_ACP_HEADLESS` | unset | `1` when no person can answer questions (see below) |
|
|
114
121
|
| `ATOMIC_ACP_ENABLE_EMBEDDED_CONTEXT` | unset | `true` lets the editor attach file contents directly to prompts |
|
|
122
|
+
| `ATOMIC_ACP_DIR` | unset | Directory for the adapter's own state (see below) |
|
|
115
123
|
|
|
116
124
|
Arguments after `--` also go to every Atomic process, for example `"args": ["--", "--model", "openai/gpt-6.1-sol"]`. Flags the adapter manages itself, such as `--mode` and the session flags, are refused at startup.
|
|
117
125
|
|
|
118
126
|
Everything else, including logins, models, skills, extensions and the session store, comes from your normal Atomic settings.
|
|
119
127
|
|
|
128
|
+
### The adapter's own state
|
|
129
|
+
|
|
130
|
+
The adapter keeps one file of its own, `session-map.json`, which records the project each session belongs to so it can be listed and loaded again. It lives in `~/.atomic/atomic-acp`, or in `ATOMIC_ACP_DIR` when that is set. The directory is made on first use, readable only by you.
|
|
131
|
+
|
|
132
|
+
Set `ATOMIC_ACP_DIR` when Atomic runs on a private agent directory (`ATOMIC_CODING_AGENT_DIR`) in a sandbox where your `~/.atomic` is read-only; otherwise starting a session fails because the map can't be written. A reload finds a session only through the same `ATOMIC_ACP_DIR` it was saved under.
|
|
133
|
+
|
|
120
134
|
### Headless clients
|
|
121
135
|
|
|
122
136
|
With `ATOMIC_ACP_HEADLESS=1`, questions end at once instead of waiting. `ask_user_question` tells the model that no person is available, and extension dialogs are cancelled.
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { ndJsonStream } from "@agentclientprotocol/sdk";
|
|
|
6
6
|
// src/acp/agent.ts
|
|
7
7
|
import { spawnSync } from "child_process";
|
|
8
8
|
import { existsSync as existsSync3, readdirSync as readdirSync2, readFileSync as readFileSync5, realpathSync, statSync as statSync2 } from "fs";
|
|
9
|
-
import { basename as
|
|
9
|
+
import { basename as basename3, dirname as dirname3, isAbsolute as isAbsolute2, join as join6 } from "path";
|
|
10
10
|
import {
|
|
11
11
|
agent,
|
|
12
12
|
methods as methods3,
|
|
@@ -95,6 +95,28 @@ function withExcludedTool(extraArgs, tool) {
|
|
|
95
95
|
return [...args, "--exclude-tools", tool];
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
// src/atomic-rpc/install.ts
|
|
99
|
+
import { basename, dirname, join } from "path";
|
|
100
|
+
var ATOMIC_INSTALL_HINT = "Install it with `curl -fsSL https://raw.githubusercontent.com/bastani-inc/atomic/main/install.sh | sh` (Windows: `install.ps1`) or `npm install -g @bastani/atomic`, or ensure `atomic` is on your PATH";
|
|
101
|
+
function isNpmInstall(realPath) {
|
|
102
|
+
return /[\\/]node_modules[\\/]@bastani[\\/]atomic[\\/]/.test(realPath);
|
|
103
|
+
}
|
|
104
|
+
function atomicInstallKind(realPath) {
|
|
105
|
+
return isNpmInstall(realPath) ? "npm" : "archive";
|
|
106
|
+
}
|
|
107
|
+
function atomicChangelogCandidates(realPath) {
|
|
108
|
+
const dir = dirname(realPath);
|
|
109
|
+
const parent = dirname(dir);
|
|
110
|
+
const candidates = [join(dir, "CHANGELOG.md")];
|
|
111
|
+
if (basename(dir).toLowerCase() === "bin") candidates.push(join(parent, "current", "CHANGELOG.md"));
|
|
112
|
+
candidates.push(join(parent, "CHANGELOG.md"));
|
|
113
|
+
return candidates;
|
|
114
|
+
}
|
|
115
|
+
function atomicUpdateCommand(kind, platform2) {
|
|
116
|
+
if (kind === "npm") return "npm i -g @bastani/atomic";
|
|
117
|
+
return platform2 === "win32" ? "irm https://raw.githubusercontent.com/bastani-inc/atomic/main/install.ps1 | iex" : "curl -fsSL https://raw.githubusercontent.com/bastani-inc/atomic/main/install.sh | sh";
|
|
118
|
+
}
|
|
119
|
+
|
|
98
120
|
// src/atomic-rpc/process.ts
|
|
99
121
|
import { spawn } from "child_process";
|
|
100
122
|
import crossSpawn from "cross-spawn";
|
|
@@ -104,7 +126,7 @@ import { randomBytes } from "crypto";
|
|
|
104
126
|
import { chmodSync, mkdtempSync, rmSync, writeFileSync } from "fs";
|
|
105
127
|
import { rm } from "fs/promises";
|
|
106
128
|
import { tmpdir } from "os";
|
|
107
|
-
import { join } from "path";
|
|
129
|
+
import { join as join2 } from "path";
|
|
108
130
|
var RETRYABLE_RM_CODES = /* @__PURE__ */ new Set(["EBUSY", "EPERM", "ENOTEMPTY", "EMFILE", "ENFILE"]);
|
|
109
131
|
var RM_RETRY_DELAYS_MS = [50, 100, 200, 400, 800, 1600];
|
|
110
132
|
var liveDirs = /* @__PURE__ */ new Set();
|
|
@@ -165,12 +187,12 @@ function writeAdapterExtension(options, cleanup = {}) {
|
|
|
165
187
|
const { servers, env } = referenceSecretValues(options.mcpServers ?? {});
|
|
166
188
|
const askReason = options.askUserQuestionUnavailable;
|
|
167
189
|
if (Object.keys(servers).length === 0 && askReason === void 0) return void 0;
|
|
168
|
-
const dir = mkdtempSync(
|
|
190
|
+
const dir = mkdtempSync(join2(tmpdir(), "atomic-acp-ext-"));
|
|
169
191
|
liveDirs.add(dir);
|
|
170
192
|
installExitHook();
|
|
171
193
|
try {
|
|
172
194
|
chmodSync(dir, 448);
|
|
173
|
-
const path =
|
|
195
|
+
const path = join2(dir, "atomic-acp.mjs");
|
|
174
196
|
const source = [
|
|
175
197
|
`const servers = ${JSON.stringify(servers)}`,
|
|
176
198
|
`const askUserQuestionUnavailable = ${JSON.stringify(askReason ?? null)}`,
|
|
@@ -327,7 +349,7 @@ var AtomicRpcProcess = class _AtomicRpcProcess {
|
|
|
327
349
|
const code = typeof e?.code === "string" ? e.code : void 0;
|
|
328
350
|
if (code === "ENOENT") {
|
|
329
351
|
throw new AtomicRpcSpawnError(
|
|
330
|
-
`Could not start Atomic: executable not found (command: ${cmd}). Atomic needs to be installed before it can run in ACP clients.
|
|
352
|
+
`Could not start Atomic: executable not found (command: ${cmd}). Atomic needs to be installed before it can run in ACP clients. ${ATOMIC_INSTALL_HINT}. Then try again.`,
|
|
331
353
|
{ code, cause: e }
|
|
332
354
|
);
|
|
333
355
|
}
|
|
@@ -697,7 +719,7 @@ function parseAtomicSessionList(data) {
|
|
|
697
719
|
// src/acp/atomic-settings.ts
|
|
698
720
|
import { existsSync, readFileSync } from "fs";
|
|
699
721
|
import { homedir } from "os";
|
|
700
|
-
import { join as
|
|
722
|
+
import { join as join3, resolve } from "path";
|
|
701
723
|
function isObject(x) {
|
|
702
724
|
return Boolean(x) && typeof x === "object" && !Array.isArray(x);
|
|
703
725
|
}
|
|
@@ -744,12 +766,12 @@ function getSettingsWithLocations(cwd) {
|
|
|
744
766
|
{
|
|
745
767
|
location: "user",
|
|
746
768
|
baseDirs: agentDirs,
|
|
747
|
-
settings: readMergedJsonFiles(agentDirs.map((dir) =>
|
|
769
|
+
settings: readMergedJsonFiles(agentDirs.map((dir) => join3(dir, "settings.json")))
|
|
748
770
|
},
|
|
749
771
|
{
|
|
750
772
|
location: "project",
|
|
751
773
|
baseDirs: projectDirs,
|
|
752
|
-
settings: readMergedJsonFiles(projectDirs.map((dir) =>
|
|
774
|
+
settings: readMergedJsonFiles(projectDirs.map((dir) => join3(dir, "settings.json")))
|
|
753
775
|
}
|
|
754
776
|
];
|
|
755
777
|
}
|
|
@@ -759,7 +781,7 @@ function getMergedSettings(cwd) {
|
|
|
759
781
|
}
|
|
760
782
|
function expandHomePath(value) {
|
|
761
783
|
if (value === "~") return homedir();
|
|
762
|
-
if (value.startsWith("~/")) return
|
|
784
|
+
if (value.startsWith("~/")) return join3(homedir(), value.slice(2));
|
|
763
785
|
return value;
|
|
764
786
|
}
|
|
765
787
|
function resolveAtomicPath(value, relativeBase = process.cwd()) {
|
|
@@ -779,12 +801,12 @@ function readMergedResourceSettings(cwd) {
|
|
|
779
801
|
}
|
|
780
802
|
function getAgentDir() {
|
|
781
803
|
const override = getFirstDefinedEnv(["ATOMIC_CODING_AGENT_DIR", "PI_CODING_AGENT_DIR"])?.trim();
|
|
782
|
-
return override ? resolveAtomicPath(override) :
|
|
804
|
+
return override ? resolveAtomicPath(override) : join3(homedir(), ".atomic", "agent");
|
|
783
805
|
}
|
|
784
806
|
function getAgentDirs() {
|
|
785
807
|
const primary = getAgentDir();
|
|
786
808
|
if (hasAgentDirOverride()) return [primary];
|
|
787
|
-
const legacy =
|
|
809
|
+
const legacy = join3(homedir(), ".pi", "agent");
|
|
788
810
|
return legacy === primary ? [primary] : [primary, legacy];
|
|
789
811
|
}
|
|
790
812
|
function getProjectConfigDirs(cwd) {
|
|
@@ -1119,7 +1141,7 @@ import { methods as methods2, RequestError as RequestError3 } from "@agentclient
|
|
|
1119
1141
|
|
|
1120
1142
|
// src/acp/slash-commands.ts
|
|
1121
1143
|
import { existsSync as existsSync2, readdirSync, readFileSync as readFileSync2, statSync } from "fs";
|
|
1122
|
-
import { basename, join as
|
|
1144
|
+
import { basename as basename2, join as join4 } from "path";
|
|
1123
1145
|
function parseFrontmatter(content) {
|
|
1124
1146
|
const frontmatter = {};
|
|
1125
1147
|
if (!content.startsWith("---")) return { frontmatter, content };
|
|
@@ -1144,7 +1166,7 @@ function describeContent(content, frontmatter, sourceStr) {
|
|
|
1144
1166
|
}
|
|
1145
1167
|
return description ? `${description} ${sourceStr}` : sourceStr;
|
|
1146
1168
|
}
|
|
1147
|
-
function loadCommandFromFile(path, sourceStr, name =
|
|
1169
|
+
function loadCommandFromFile(path, sourceStr, name = basename2(path, ".md")) {
|
|
1148
1170
|
try {
|
|
1149
1171
|
const rawContent = readFileSync2(path, "utf-8");
|
|
1150
1172
|
const { frontmatter, content } = parseFrontmatter(rawContent);
|
|
@@ -1166,7 +1188,7 @@ function loadCommandsFromDir(dir, source, subdir = "") {
|
|
|
1166
1188
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
1167
1189
|
for (const entry of entries) {
|
|
1168
1190
|
if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
|
|
1169
|
-
const fullPath =
|
|
1191
|
+
const fullPath = join4(dir, entry.name);
|
|
1170
1192
|
const sourceStr = source === "path" ? "(path)" : source === "user" ? subdir ? `(user:${subdir})` : "(user)" : subdir ? `(project:${subdir})` : "(project)";
|
|
1171
1193
|
const command = loadCommandFromFile(fullPath, sourceStr);
|
|
1172
1194
|
if (command) commands.push(command);
|
|
@@ -1217,8 +1239,8 @@ function loadSlashCommands(cwd) {
|
|
|
1217
1239
|
commands.push(...loadCommandsFromSettingPath(resolved, entry.location));
|
|
1218
1240
|
}
|
|
1219
1241
|
}
|
|
1220
|
-
const projectDirs = getProjectConfigDirs(cwd).map((configDir) =>
|
|
1221
|
-
const userDirs = getAgentDirs().map((agentDir) =>
|
|
1242
|
+
const projectDirs = getProjectConfigDirs(cwd).map((configDir) => join4(configDir, "prompts"));
|
|
1243
|
+
const userDirs = getAgentDirs().map((agentDir) => join4(agentDir, "prompts"));
|
|
1222
1244
|
for (const projectDir of projectDirs) commands.push(...loadCommandsFromDir(projectDir, "project"));
|
|
1223
1245
|
for (const userDir of userDirs) commands.push(...loadCommandsFromDir(userDir, "user"));
|
|
1224
1246
|
return filterExcluded(commands, excludedPaths);
|
|
@@ -2244,21 +2266,22 @@ function toToolKind(toolName) {
|
|
|
2244
2266
|
|
|
2245
2267
|
// src/acp/session-store.ts
|
|
2246
2268
|
import { mkdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
2247
|
-
import { dirname } from "path";
|
|
2269
|
+
import { dirname as dirname2 } from "path";
|
|
2248
2270
|
|
|
2249
2271
|
// src/acp/paths.ts
|
|
2250
2272
|
import { homedir as homedir2 } from "os";
|
|
2251
|
-
import { join as
|
|
2252
|
-
function getAtomicAcpDir() {
|
|
2253
|
-
|
|
2273
|
+
import { join as join5 } from "path";
|
|
2274
|
+
function getAtomicAcpDir(env = process.env) {
|
|
2275
|
+
const override = env.ATOMIC_ACP_DIR?.trim();
|
|
2276
|
+
return override ? resolveAtomicPath(override) : join5(homedir2(), ".atomic", "atomic-acp");
|
|
2254
2277
|
}
|
|
2255
|
-
function getAtomicAcpSessionMapPath() {
|
|
2256
|
-
return
|
|
2278
|
+
function getAtomicAcpSessionMapPath(env = process.env) {
|
|
2279
|
+
return join5(getAtomicAcpDir(env), "session-map.json");
|
|
2257
2280
|
}
|
|
2258
2281
|
|
|
2259
2282
|
// src/acp/session-store.ts
|
|
2260
2283
|
function ensureParentDir(path) {
|
|
2261
|
-
mkdirSync(
|
|
2284
|
+
mkdirSync(dirname2(path), { recursive: true, mode: 448 });
|
|
2262
2285
|
}
|
|
2263
2286
|
function loadFile(path) {
|
|
2264
2287
|
try {
|
|
@@ -2275,7 +2298,7 @@ function loadFile(path) {
|
|
|
2275
2298
|
function saveFile(path, data) {
|
|
2276
2299
|
ensureParentDir(path);
|
|
2277
2300
|
writeFileSync2(path, `${JSON.stringify(data, null, 2)}
|
|
2278
|
-
`, "utf-8");
|
|
2301
|
+
`, { encoding: "utf-8", mode: 384 });
|
|
2279
2302
|
}
|
|
2280
2303
|
var SessionStore = class {
|
|
2281
2304
|
path;
|
|
@@ -2849,20 +2872,16 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
2849
2872
|
if (cmd === "changelog") {
|
|
2850
2873
|
const findChangelog = () => {
|
|
2851
2874
|
try {
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
const pkgRoot = dirname2(dirname2(resolved));
|
|
2856
|
-
const p = join5(pkgRoot, "CHANGELOG.md");
|
|
2857
|
-
if (existsSync3(p)) return p;
|
|
2858
|
-
}
|
|
2875
|
+
const resolved = resolveAtomicRealPath();
|
|
2876
|
+
const found = resolved && atomicChangelogCandidates(resolved).find((p) => existsSync3(p));
|
|
2877
|
+
if (found) return found;
|
|
2859
2878
|
} catch {
|
|
2860
2879
|
}
|
|
2861
2880
|
try {
|
|
2862
2881
|
const npmRoot = spawnSync("npm", ["root", "-g"], { encoding: "utf-8" });
|
|
2863
2882
|
const root = String(npmRoot.stdout ?? "").trim();
|
|
2864
2883
|
if (root) {
|
|
2865
|
-
const p =
|
|
2884
|
+
const p = join6(root, "@bastani", "atomic", "CHANGELOG.md");
|
|
2866
2885
|
if (existsSync3(p)) return p;
|
|
2867
2886
|
}
|
|
2868
2887
|
} catch {
|
|
@@ -2923,7 +2942,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
2923
2942
|
return { stopReason: "end_turn" };
|
|
2924
2943
|
}
|
|
2925
2944
|
const safeSessionId = session.sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
2926
|
-
const outputPath =
|
|
2945
|
+
const outputPath = join6(session.cwd, `atomic-session-${safeSessionId}.html`);
|
|
2927
2946
|
let resultPath;
|
|
2928
2947
|
try {
|
|
2929
2948
|
const result = await session.proc.exportHtml(outputPath);
|
|
@@ -3395,6 +3414,10 @@ function resolveAtomicExecutablePath() {
|
|
|
3395
3414
|
const which = spawnSync(whichCmd, [cmd], { encoding: "utf-8" });
|
|
3396
3415
|
return String(which.stdout ?? "").split(/\r?\n/)[0]?.trim() || null;
|
|
3397
3416
|
}
|
|
3417
|
+
function resolveAtomicRealPath() {
|
|
3418
|
+
const atomicPath = resolveAtomicExecutablePath();
|
|
3419
|
+
return atomicPath ? realpathSync(atomicPath) : null;
|
|
3420
|
+
}
|
|
3398
3421
|
function getAtomicVersionOutput() {
|
|
3399
3422
|
const cmd = getAtomicCommand(process.env.ATOMIC_ACP_ATOMIC_COMMAND);
|
|
3400
3423
|
const atomicVersion = spawnSync(cmd, ["--version"], {
|
|
@@ -3414,7 +3437,9 @@ function buildUpdateNotice() {
|
|
|
3414
3437
|
const latest = String(latestRes.stdout ?? "").trim().replace(/^v/i, "");
|
|
3415
3438
|
if (!latest || !isSemver(latest)) return null;
|
|
3416
3439
|
if (compareSemver(latest, installed) <= 0) return null;
|
|
3417
|
-
|
|
3440
|
+
const resolved = resolveAtomicRealPath();
|
|
3441
|
+
const kind = resolved ? atomicInstallKind(resolved) : "npm";
|
|
3442
|
+
return `New version available: v${latest} (installed v${installed}). Run: \`${atomicUpdateCommand(kind, process.platform)}\``;
|
|
3418
3443
|
} catch {
|
|
3419
3444
|
return null;
|
|
3420
3445
|
}
|
|
@@ -3439,14 +3464,14 @@ function buildStartupInfo(opts) {
|
|
|
3439
3464
|
md.push("");
|
|
3440
3465
|
};
|
|
3441
3466
|
const contextItems = [];
|
|
3442
|
-
const contextPath =
|
|
3467
|
+
const contextPath = join6(opts.cwd, "AGENTS.md");
|
|
3443
3468
|
if (existsSync3(contextPath)) contextItems.push(contextPath);
|
|
3444
3469
|
addSection("Context", contextItems);
|
|
3445
3470
|
const skillsItems = [];
|
|
3446
3471
|
const pushSkillFromRoot = (root) => {
|
|
3447
3472
|
try {
|
|
3448
3473
|
for (const e of readdirSync2(root)) {
|
|
3449
|
-
const p =
|
|
3474
|
+
const p = join6(root, e);
|
|
3450
3475
|
try {
|
|
3451
3476
|
const st = statSync2(p);
|
|
3452
3477
|
if (st.isFile() && e.toLowerCase().endsWith(".md")) {
|
|
@@ -3466,7 +3491,7 @@ function buildStartupInfo(opts) {
|
|
|
3466
3491
|
}
|
|
3467
3492
|
for (const name of entries) {
|
|
3468
3493
|
if (name === "node_modules" || name === ".git") continue;
|
|
3469
|
-
const p =
|
|
3494
|
+
const p = join6(dir, name);
|
|
3470
3495
|
let st;
|
|
3471
3496
|
try {
|
|
3472
3497
|
st = statSync2(p);
|
|
@@ -3483,30 +3508,30 @@ function buildStartupInfo(opts) {
|
|
|
3483
3508
|
} catch {
|
|
3484
3509
|
}
|
|
3485
3510
|
};
|
|
3486
|
-
const globalSkillsDir =
|
|
3511
|
+
const globalSkillsDir = join6(getAgentDir(), "skills");
|
|
3487
3512
|
pushSkillFromRoot(globalSkillsDir);
|
|
3488
|
-
const legacyAgentsSkillsDir =
|
|
3513
|
+
const legacyAgentsSkillsDir = join6(process.env.HOME ?? "", ".agents", "skills");
|
|
3489
3514
|
pushSkillFromRoot(legacyAgentsSkillsDir);
|
|
3490
|
-
const projectSkillsDir =
|
|
3515
|
+
const projectSkillsDir = join6(opts.cwd, ".atomic", "skills");
|
|
3491
3516
|
pushSkillFromRoot(projectSkillsDir);
|
|
3492
3517
|
addSection("Skills", skillsItems);
|
|
3493
3518
|
const promptsItems = [];
|
|
3494
3519
|
const agentDir = getAgentDir();
|
|
3495
|
-
const promptsDir =
|
|
3520
|
+
const promptsDir = join6(agentDir, "prompts");
|
|
3496
3521
|
try {
|
|
3497
3522
|
const prompts = readdirSync2(promptsDir).filter((f) => f.endsWith(".md"));
|
|
3498
|
-
for (const f of prompts) promptsItems.push(`/${
|
|
3523
|
+
for (const f of prompts) promptsItems.push(`/${basename3(f, ".md")}`);
|
|
3499
3524
|
} catch {
|
|
3500
3525
|
}
|
|
3501
3526
|
addSection("Prompts", promptsItems);
|
|
3502
3527
|
const extItems = [];
|
|
3503
|
-
const extDir =
|
|
3528
|
+
const extDir = join6(agentDir, "extensions");
|
|
3504
3529
|
try {
|
|
3505
3530
|
const exts = readdirSync2(extDir).filter((f) => f.endsWith(".ts") || f.endsWith(".js"));
|
|
3506
|
-
for (const f of exts) extItems.push(
|
|
3531
|
+
for (const f of exts) extItems.push(join6(extDir, f));
|
|
3507
3532
|
} catch {
|
|
3508
3533
|
}
|
|
3509
|
-
for (const settingsPath of [
|
|
3534
|
+
for (const settingsPath of [join6(agentDir, "settings.json"), join6(opts.cwd, ".atomic", "settings.json")]) {
|
|
3510
3535
|
try {
|
|
3511
3536
|
const settings = JSON.parse(readFileSync5(settingsPath, "utf-8"));
|
|
3512
3537
|
const packages = Array.isArray(settings.packages) ? settings.packages : [];
|
|
@@ -3530,14 +3555,14 @@ function buildStartupInfo(opts) {
|
|
|
3530
3555
|
}
|
|
3531
3556
|
function readNearestPackageJson(metaUrl) {
|
|
3532
3557
|
try {
|
|
3533
|
-
let dir =
|
|
3558
|
+
let dir = dirname3(fileURLToPath(metaUrl));
|
|
3534
3559
|
for (let i = 0; i < 6; i++) {
|
|
3535
|
-
const p =
|
|
3560
|
+
const p = join6(dir, "package.json");
|
|
3536
3561
|
if (existsSync3(p)) {
|
|
3537
3562
|
const json = JSON.parse(readFileSync5(p, "utf-8"));
|
|
3538
3563
|
return { name: json?.name, version: json?.version };
|
|
3539
3564
|
}
|
|
3540
|
-
dir =
|
|
3565
|
+
dir = dirname3(dir);
|
|
3541
3566
|
}
|
|
3542
3567
|
} catch {
|
|
3543
3568
|
}
|
|
@@ -3602,10 +3627,8 @@ if ("command" in cli && cli.command === "terminal-login") {
|
|
|
3602
3627
|
shell: shouldUseShellForAtomicCommand(cmd)
|
|
3603
3628
|
});
|
|
3604
3629
|
if (res.error && res.error.code === "ENOENT") {
|
|
3605
|
-
process.stderr.write(
|
|
3606
|
-
|
|
3607
|
-
`
|
|
3608
|
-
);
|
|
3630
|
+
process.stderr.write(`atomic-acp: could not start Atomic (command not found: ${cmd}). ${ATOMIC_INSTALL_HINT}.
|
|
3631
|
+
`);
|
|
3609
3632
|
process.exit(1);
|
|
3610
3633
|
}
|
|
3611
3634
|
process.exit(typeof res.status === "number" ? res.status : 1);
|