@atlasharness/atlascode 0.1.42 → 0.1.44
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/cli.js +603 -711
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -54855,20 +54855,77 @@ class DefaultSandboxEventBus {
|
|
|
54855
54855
|
}
|
|
54856
54856
|
|
|
54857
54857
|
// src/sandbox/ripgrep.ts
|
|
54858
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
54859
|
+
import { homedir as homedir9 } from "node:os";
|
|
54860
|
+
import * as path3 from "node:path";
|
|
54861
|
+
import { createRequire as createRequire3 } from "node:module";
|
|
54858
54862
|
import {
|
|
54859
54863
|
execFile as execFile2,
|
|
54860
|
-
execFileSync as execFileSync2
|
|
54864
|
+
execFileSync as execFileSync2,
|
|
54865
|
+
spawn as spawn3
|
|
54861
54866
|
} from "child_process";
|
|
54862
|
-
function
|
|
54863
|
-
|
|
54867
|
+
function getBundledRgPath() {
|
|
54868
|
+
try {
|
|
54869
|
+
const arch = process.env.npm_config_arch || process.arch;
|
|
54870
|
+
const platformPkg = `@vscode/ripgrep-${process.platform}-${arch}`;
|
|
54871
|
+
const binaryName = process.platform === "win32" ? "rg.exe" : "rg";
|
|
54872
|
+
const p = createRequire3(import.meta.url).resolve(`${platformPkg}/bin/${binaryName}`);
|
|
54873
|
+
return existsSync5(p) ? p : null;
|
|
54874
|
+
} catch {
|
|
54875
|
+
return null;
|
|
54876
|
+
}
|
|
54877
|
+
}
|
|
54878
|
+
function probeSystemRg() {
|
|
54879
|
+
if (systemRgProbe !== null)
|
|
54880
|
+
return systemRgProbe;
|
|
54881
|
+
try {
|
|
54882
|
+
const out = execFileSync2("rg", ["--version"], {
|
|
54883
|
+
timeout: 2000,
|
|
54884
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
54885
|
+
});
|
|
54886
|
+
systemRgProbe = out.toString().trim().startsWith("ripgrep ");
|
|
54887
|
+
} catch {
|
|
54888
|
+
systemRgProbe = false;
|
|
54889
|
+
}
|
|
54890
|
+
return systemRgProbe;
|
|
54891
|
+
}
|
|
54892
|
+
function resolveRg() {
|
|
54893
|
+
if (cachedResolved)
|
|
54894
|
+
return cachedResolved;
|
|
54895
|
+
if (probeSystemRg()) {
|
|
54896
|
+
cachedResolved = { command: "rg", args: [], source: "path" };
|
|
54897
|
+
} else {
|
|
54898
|
+
const bundled = getBundledRgPath();
|
|
54899
|
+
cachedResolved = bundled ? { command: bundled, args: [], source: "vscode-ripgrep" } : { command: "rg", args: [], source: "none" };
|
|
54900
|
+
}
|
|
54901
|
+
return cachedResolved;
|
|
54864
54902
|
}
|
|
54865
54903
|
function ripgrepCommand() {
|
|
54866
|
-
const
|
|
54867
|
-
return {
|
|
54868
|
-
|
|
54869
|
-
|
|
54870
|
-
|
|
54871
|
-
|
|
54904
|
+
const r = resolveRg();
|
|
54905
|
+
return { rgPath: r.command, rgArgs: r.args, source: r.source };
|
|
54906
|
+
}
|
|
54907
|
+
function getRipgrepStatus() {
|
|
54908
|
+
const { rgPath, source } = ripgrepCommand();
|
|
54909
|
+
if (source === "none") {
|
|
54910
|
+
return { mode: "missing", path: rgPath, working: false };
|
|
54911
|
+
}
|
|
54912
|
+
try {
|
|
54913
|
+
const out = execFileSync2(rgPath, ["--version"], {
|
|
54914
|
+
timeout: 2000,
|
|
54915
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
54916
|
+
});
|
|
54917
|
+
return {
|
|
54918
|
+
mode: source === "path" ? "system" : "bundled",
|
|
54919
|
+
path: rgPath,
|
|
54920
|
+
working: out.toString().trim().startsWith("ripgrep ")
|
|
54921
|
+
};
|
|
54922
|
+
} catch {
|
|
54923
|
+
return {
|
|
54924
|
+
mode: source === "path" ? "system" : "bundled",
|
|
54925
|
+
path: rgPath,
|
|
54926
|
+
working: false
|
|
54927
|
+
};
|
|
54928
|
+
}
|
|
54872
54929
|
}
|
|
54873
54930
|
function isEagainError(stderr) {
|
|
54874
54931
|
return stderr.includes("os error 11") || stderr.includes("Resource temporarily unavailable");
|
|
@@ -54887,6 +54944,9 @@ function ripGrepRaw(args, target, abortSignal, callback, singleThread = false) {
|
|
|
54887
54944
|
}, callback);
|
|
54888
54945
|
}
|
|
54889
54946
|
async function ripGrep(args, target, abortSignal) {
|
|
54947
|
+
const { source } = ripgrepCommand();
|
|
54948
|
+
if (source === "none")
|
|
54949
|
+
throw new RipgrepMissingError;
|
|
54890
54950
|
return new Promise((resolve, reject) => {
|
|
54891
54951
|
const handleResult = (error, stdout, stderr, isRetry) => {
|
|
54892
54952
|
if (!error) {
|
|
@@ -54936,9 +54996,122 @@ async function ripGrep(args, target, abortSignal) {
|
|
|
54936
54996
|
});
|
|
54937
54997
|
});
|
|
54938
54998
|
}
|
|
54939
|
-
|
|
54999
|
+
async function ripGrepStream(args, target, abortSignal, onLines) {
|
|
55000
|
+
const { rgPath, rgArgs, source } = ripgrepCommand();
|
|
55001
|
+
if (source === "none")
|
|
55002
|
+
throw new RipgrepMissingError;
|
|
55003
|
+
return new Promise((resolve, reject) => {
|
|
55004
|
+
const child = spawn3(rgPath, [...rgArgs, ...args, target], {
|
|
55005
|
+
signal: abortSignal,
|
|
55006
|
+
windowsHide: true,
|
|
55007
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
55008
|
+
});
|
|
55009
|
+
const stripCR = (l) => l.endsWith("\r") ? l.slice(0, -1) : l;
|
|
55010
|
+
let remainder = "";
|
|
55011
|
+
child.stdout?.on("data", (chunk) => {
|
|
55012
|
+
const data = remainder + chunk.toString();
|
|
55013
|
+
const lines = data.split(`
|
|
55014
|
+
`);
|
|
55015
|
+
remainder = lines.pop() ?? "";
|
|
55016
|
+
if (lines.length)
|
|
55017
|
+
onLines(lines.map(stripCR));
|
|
55018
|
+
});
|
|
55019
|
+
let settled = false;
|
|
55020
|
+
child.on("close", (code) => {
|
|
55021
|
+
if (settled)
|
|
55022
|
+
return;
|
|
55023
|
+
if (abortSignal.aborted)
|
|
55024
|
+
return;
|
|
55025
|
+
settled = true;
|
|
55026
|
+
if (code === 0 || code === 1) {
|
|
55027
|
+
if (remainder)
|
|
55028
|
+
onLines([stripCR(remainder)]);
|
|
55029
|
+
resolve();
|
|
55030
|
+
} else {
|
|
55031
|
+
reject(new Error(`ripgrep exited with code ${code}`));
|
|
55032
|
+
}
|
|
55033
|
+
});
|
|
55034
|
+
child.on("error", (err) => {
|
|
55035
|
+
if (settled)
|
|
55036
|
+
return;
|
|
55037
|
+
settled = true;
|
|
55038
|
+
reject(err);
|
|
55039
|
+
});
|
|
55040
|
+
});
|
|
55041
|
+
}
|
|
55042
|
+
async function ripGrepFileCount(args, target, abortSignal) {
|
|
55043
|
+
const { rgPath, rgArgs, source } = ripgrepCommand();
|
|
55044
|
+
if (source === "none")
|
|
55045
|
+
throw new RipgrepMissingError;
|
|
55046
|
+
return new Promise((resolve, reject) => {
|
|
55047
|
+
const child = spawn3(rgPath, [...rgArgs, ...args, target], {
|
|
55048
|
+
signal: abortSignal,
|
|
55049
|
+
windowsHide: true,
|
|
55050
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
55051
|
+
});
|
|
55052
|
+
let lines = 0;
|
|
55053
|
+
child.stdout?.on("data", (chunk) => {
|
|
55054
|
+
lines += countCharInString(chunk, `
|
|
55055
|
+
`);
|
|
55056
|
+
});
|
|
55057
|
+
let settled = false;
|
|
55058
|
+
child.on("close", (code) => {
|
|
55059
|
+
if (settled)
|
|
55060
|
+
return;
|
|
55061
|
+
settled = true;
|
|
55062
|
+
if (code === 0 || code === 1)
|
|
55063
|
+
resolve(lines);
|
|
55064
|
+
else
|
|
55065
|
+
reject(new Error(`rg --files exited ${code}`));
|
|
55066
|
+
});
|
|
55067
|
+
child.on("error", (err) => {
|
|
55068
|
+
if (settled)
|
|
55069
|
+
return;
|
|
55070
|
+
settled = true;
|
|
55071
|
+
reject(err);
|
|
55072
|
+
});
|
|
55073
|
+
});
|
|
55074
|
+
}
|
|
55075
|
+
function countFilesRoundedRg(dirPath, abortSignal, ignorePatterns = []) {
|
|
55076
|
+
const key = `${dirPath}|${ignorePatterns.join(",")}`;
|
|
55077
|
+
let cached = countFilesMemo.get(key);
|
|
55078
|
+
if (!cached) {
|
|
55079
|
+
cached = countFilesRoundedRgImpl(dirPath, abortSignal, ignorePatterns);
|
|
55080
|
+
countFilesMemo.set(key, cached);
|
|
55081
|
+
}
|
|
55082
|
+
return cached;
|
|
55083
|
+
}
|
|
55084
|
+
async function countFilesRoundedRgImpl(dirPath, abortSignal, ignorePatterns = []) {
|
|
55085
|
+
if (path3.resolve(dirPath) === path3.resolve(homedir9())) {
|
|
55086
|
+
return;
|
|
55087
|
+
}
|
|
55088
|
+
try {
|
|
55089
|
+
const args = ["--files", "--hidden"];
|
|
55090
|
+
ignorePatterns.forEach((pattern) => {
|
|
55091
|
+
args.push("--glob", `!${pattern}`);
|
|
55092
|
+
});
|
|
55093
|
+
const count = await ripGrepFileCount(args, dirPath, abortSignal);
|
|
55094
|
+
if (count === 0)
|
|
55095
|
+
return 0;
|
|
55096
|
+
const magnitude = Math.floor(Math.log10(count));
|
|
55097
|
+
const power = Math.pow(10, magnitude);
|
|
55098
|
+
return Math.round(count / power) * power;
|
|
55099
|
+
} catch (error) {
|
|
55100
|
+
if (error?.name !== "AbortError") {
|
|
55101
|
+
logForDebugging(`countFilesRoundedRg failed: ${error?.message ?? String(error)}`);
|
|
55102
|
+
}
|
|
55103
|
+
}
|
|
55104
|
+
return;
|
|
55105
|
+
}
|
|
55106
|
+
var MAX_BUFFER_SIZE = 20000000, systemRgProbe = null, cachedResolved = null, RipgrepMissingError, RipgrepTimeoutError, countFilesMemo;
|
|
54940
55107
|
var init_ripgrep = __esm(() => {
|
|
54941
55108
|
init_shared();
|
|
55109
|
+
RipgrepMissingError = class RipgrepMissingError extends Error {
|
|
55110
|
+
constructor() {
|
|
55111
|
+
super("ripgrep not found: rg is not in PATH and the @vscode/ripgrep platform binary is missing. " + "Install ripgrep (apt/brew/scoop/winget) or re-run the package install (npm install / bun install) so the platform optional dependency is fetched.");
|
|
55112
|
+
this.name = "RipgrepMissingError";
|
|
55113
|
+
}
|
|
55114
|
+
};
|
|
54942
55115
|
RipgrepTimeoutError = class RipgrepTimeoutError extends Error {
|
|
54943
55116
|
partialResults;
|
|
54944
55117
|
constructor(message, partialResults) {
|
|
@@ -54947,6 +55120,7 @@ var init_ripgrep = __esm(() => {
|
|
|
54947
55120
|
this.name = "RipgrepTimeoutError";
|
|
54948
55121
|
}
|
|
54949
55122
|
};
|
|
55123
|
+
countFilesMemo = new Map;
|
|
54950
55124
|
});
|
|
54951
55125
|
|
|
54952
55126
|
// src/sandbox/runtime.ts
|
|
@@ -55119,7 +55293,7 @@ var init_sandbox_backend = __esm(() => {
|
|
|
55119
55293
|
// src/sandbox/createSandboxManager.ts
|
|
55120
55294
|
import { rmSync, statSync as statSync3 } from "fs";
|
|
55121
55295
|
import { readFile as readFile3 } from "fs/promises";
|
|
55122
|
-
import { join as join16, resolve as
|
|
55296
|
+
import { join as join16, resolve as resolve10, sep as sep3 } from "path";
|
|
55123
55297
|
function memoizeNoArg2(fn) {
|
|
55124
55298
|
let cached = false;
|
|
55125
55299
|
let value;
|
|
@@ -55159,18 +55333,18 @@ function createSandboxManager(deps, backend) {
|
|
|
55159
55333
|
const cwd = deps.getCwd();
|
|
55160
55334
|
const originalCwd = deps.getOriginalCwd();
|
|
55161
55335
|
if (cwd !== originalCwd) {
|
|
55162
|
-
denyWrite.push(
|
|
55163
|
-
denyWrite.push(
|
|
55336
|
+
denyWrite.push(resolve10(cwd, deps.getConfigDirName(), "settings.json"));
|
|
55337
|
+
denyWrite.push(resolve10(cwd, deps.getConfigDirName(), "settings.local.json"));
|
|
55164
55338
|
}
|
|
55165
|
-
denyWrite.push(
|
|
55339
|
+
denyWrite.push(resolve10(originalCwd, deps.getConfigDirName(), "skills"));
|
|
55166
55340
|
if (cwd !== originalCwd) {
|
|
55167
|
-
denyWrite.push(
|
|
55341
|
+
denyWrite.push(resolve10(cwd, deps.getConfigDirName(), "skills"));
|
|
55168
55342
|
}
|
|
55169
55343
|
bareGitRepoScrubPaths.length = 0;
|
|
55170
55344
|
const bareGitRepoFiles = ["HEAD", "objects", "refs", "hooks", "config"];
|
|
55171
55345
|
for (const dir of cwd === originalCwd ? [originalCwd] : [originalCwd, cwd]) {
|
|
55172
55346
|
for (const gitFile of bareGitRepoFiles) {
|
|
55173
|
-
const p =
|
|
55347
|
+
const p = resolve10(dir, gitFile);
|
|
55174
55348
|
try {
|
|
55175
55349
|
statSync3(p);
|
|
55176
55350
|
denyWrite.push(p);
|
|
@@ -55239,7 +55413,7 @@ function createSandboxManager(deps, backend) {
|
|
|
55239
55413
|
if (!gitdirMatch?.[1]) {
|
|
55240
55414
|
return null;
|
|
55241
55415
|
}
|
|
55242
|
-
const gitdir =
|
|
55416
|
+
const gitdir = resolve10(cwd, gitdirMatch[1].trim());
|
|
55243
55417
|
const marker = sep3 + ".git" + sep3 + "worktrees" + sep3;
|
|
55244
55418
|
const markerIndex = gitdir.lastIndexOf(marker);
|
|
55245
55419
|
if (markerIndex > 0) {
|
|
@@ -57111,17 +57285,17 @@ class RootedMemoryStore {
|
|
|
57111
57285
|
var init_RootedMemoryStore = () => {};
|
|
57112
57286
|
|
|
57113
57287
|
// src/memory/envUtils.ts
|
|
57114
|
-
import { homedir as
|
|
57288
|
+
import { homedir as homedir10 } from "os";
|
|
57115
57289
|
import { join as join20 } from "path";
|
|
57116
57290
|
function getAtlasConfigHomeDir2() {
|
|
57117
|
-
return (process.env.ATLAS_CONFIG_DIR ?? join20(
|
|
57291
|
+
return (process.env.ATLAS_CONFIG_DIR ?? join20(homedir10(), getConfigDirName())).normalize("NFC");
|
|
57118
57292
|
}
|
|
57119
57293
|
var init_envUtils = __esm(() => {
|
|
57120
57294
|
init_shared();
|
|
57121
57295
|
});
|
|
57122
57296
|
|
|
57123
57297
|
// src/memory/paths.ts
|
|
57124
|
-
import { homedir as
|
|
57298
|
+
import { homedir as homedir11 } from "os";
|
|
57125
57299
|
import { isAbsolute as isAbsolute8, join as join21, normalize as normalize2, sep as sep5 } from "path";
|
|
57126
57300
|
function memoizeOnProjectRoot(fn) {
|
|
57127
57301
|
let cachedKey;
|
|
@@ -57169,7 +57343,7 @@ function validateMemoryPath(raw, expandTilde) {
|
|
|
57169
57343
|
if (restNorm === "." || restNorm === "..") {
|
|
57170
57344
|
return;
|
|
57171
57345
|
}
|
|
57172
|
-
candidate = join21(
|
|
57346
|
+
candidate = join21(homedir11(), rest);
|
|
57173
57347
|
}
|
|
57174
57348
|
const normalized = normalize2(candidate).replace(/[/\\]+$/, "");
|
|
57175
57349
|
if (!isAbsolute8(normalized) || normalized.length < 3 || /^[A-Za-z]:$/.test(normalized) || normalized.startsWith("\\\\") || normalized.startsWith("//") || normalized.includes("\x00")) {
|
|
@@ -64392,7 +64566,7 @@ var init_memory = __esm(() => {
|
|
|
64392
64566
|
|
|
64393
64567
|
// src/engine/tools/files/readTool.ts
|
|
64394
64568
|
import { readdir as readdir2, readFile as readFileAsync } from "fs/promises";
|
|
64395
|
-
import * as
|
|
64569
|
+
import * as path4 from "path";
|
|
64396
64570
|
function isBlockedDevicePath(filePath) {
|
|
64397
64571
|
if (BLOCKED_DEVICE_PATHS.has(filePath))
|
|
64398
64572
|
return true;
|
|
@@ -64401,7 +64575,7 @@ function isBlockedDevicePath(filePath) {
|
|
|
64401
64575
|
return false;
|
|
64402
64576
|
}
|
|
64403
64577
|
function getAlternateScreenshotPath(filePath) {
|
|
64404
|
-
const filename =
|
|
64578
|
+
const filename = path4.basename(filePath);
|
|
64405
64579
|
const amPmPattern = /^(.+)([ \u202F])(AM|PM)(\.png)$/;
|
|
64406
64580
|
const match = filename.match(amPmPattern);
|
|
64407
64581
|
if (!match)
|
|
@@ -64416,7 +64590,7 @@ async function readImageWithTokenBudget(filePath) {
|
|
|
64416
64590
|
if (originalSize === 0) {
|
|
64417
64591
|
throw new Error(`Image file is empty: ${filePath}`);
|
|
64418
64592
|
}
|
|
64419
|
-
const ext =
|
|
64593
|
+
const ext = path4.extname(filePath).toLowerCase().slice(1);
|
|
64420
64594
|
const mediaType = EXT_MEDIA_TYPE[ext] ?? "image/png";
|
|
64421
64595
|
return {
|
|
64422
64596
|
type: "image",
|
|
@@ -64495,7 +64669,7 @@ async function callInner(file_path, fullFilePath, resolvedFilePath, ext, offset,
|
|
|
64495
64669
|
const entries = await readdir2(extractResult.data.file.outputDir);
|
|
64496
64670
|
const imageFiles = entries.filter((f) => f.endsWith(".jpg")).sort();
|
|
64497
64671
|
const imageBlocks = await Promise.all(imageFiles.map(async (f) => {
|
|
64498
|
-
const imgPath =
|
|
64672
|
+
const imgPath = path4.join(extractResult.data.file.outputDir, f);
|
|
64499
64673
|
const imgBuffer = await readFileAsync(imgPath);
|
|
64500
64674
|
return {
|
|
64501
64675
|
type: "image",
|
|
@@ -64718,7 +64892,7 @@ var init_readTool = __esm(() => {
|
|
|
64718
64892
|
if (isUncPath) {
|
|
64719
64893
|
return { result: true };
|
|
64720
64894
|
}
|
|
64721
|
-
const ext =
|
|
64895
|
+
const ext = path4.extname(fullFilePath).toLowerCase();
|
|
64722
64896
|
if (hasBinaryExtension(fullFilePath) && !isPDFExtension(ext) && !IMAGE_EXTENSIONS.has(ext.slice(1))) {
|
|
64723
64897
|
return {
|
|
64724
64898
|
result: false,
|
|
@@ -64771,7 +64945,7 @@ var init_readTool = __esm(() => {
|
|
|
64771
64945
|
const defaults = getDefaultFileReadingLimits();
|
|
64772
64946
|
const maxSizeBytes = fileReadingLimits?.maxSizeBytes ?? defaults.maxSizeBytes;
|
|
64773
64947
|
const maxTokens = fileReadingLimits?.maxTokens ?? defaults.maxTokens;
|
|
64774
|
-
const ext =
|
|
64948
|
+
const ext = path4.extname(file_path).toLowerCase().slice(1);
|
|
64775
64949
|
const fullFilePath = expandPath(file_path, getCwd());
|
|
64776
64950
|
const dedupKillswitch = isEnvTruthy(process.env.ATLAS_DISABLE_READ_DEDUP);
|
|
64777
64951
|
const existingState = dedupKillswitch || !readFileState ? undefined : readFileState.get(fullFilePath);
|
|
@@ -66130,7 +66304,7 @@ var init_lspSymbolContext = __esm(() => {
|
|
|
66130
66304
|
// src/engine/tools/lsp/lspTool.ts
|
|
66131
66305
|
import { execFile as execFile4 } from "child_process";
|
|
66132
66306
|
import { open as open4 } from "fs/promises";
|
|
66133
|
-
import * as
|
|
66307
|
+
import * as path5 from "path";
|
|
66134
66308
|
import { pathToFileURL } from "url";
|
|
66135
66309
|
import { promisify } from "util";
|
|
66136
66310
|
function getMethodAndParams(input, absolutePath) {
|
|
@@ -66594,10 +66768,10 @@ var init_lspTool = __esm(() => {
|
|
|
66594
66768
|
}
|
|
66595
66769
|
let result = await manager.sendRequest(absolutePath, method, params);
|
|
66596
66770
|
if (result === undefined) {
|
|
66597
|
-
logForDebugging(`No LSP server available for file type ${
|
|
66771
|
+
logForDebugging(`No LSP server available for file type ${path5.extname(absolutePath)} for operation ${input.operation} on file ${input.filePath}`);
|
|
66598
66772
|
const output = {
|
|
66599
66773
|
operation: input.operation,
|
|
66600
|
-
result: `No LSP server available for file type: ${
|
|
66774
|
+
result: `No LSP server available for file type: ${path5.extname(absolutePath)}`,
|
|
66601
66775
|
filePath: input.filePath
|
|
66602
66776
|
};
|
|
66603
66777
|
return {
|
|
@@ -68097,7 +68271,7 @@ var init_mcp2 = __esm(() => {
|
|
|
68097
68271
|
var PROMPT = `Completely replaces the contents of a specific cell in a Jupyter notebook (.ipynb file) with new source. Jupyter notebooks are interactive documents that combine code, text, and visualizations, commonly used for data analysis and scientific computing. The notebook_path parameter must be an absolute path, not a relative path. The cell_number is 0-indexed. Use edit_mode=insert to add a new cell at the index specified by cell_number. Use edit_mode=delete to delete the cell at the index specified by cell_number.`;
|
|
68098
68272
|
|
|
68099
68273
|
// src/engine/tools/notebook/notebookEditTool.ts
|
|
68100
|
-
import { extname as extname4, isAbsolute as isAbsolute9, resolve as
|
|
68274
|
+
import { extname as extname4, isAbsolute as isAbsolute9, resolve as resolve11 } from "path";
|
|
68101
68275
|
var NOTEBOOK_EDIT_TOOL_INPUT_SCHEMA, NotebookEditTool;
|
|
68102
68276
|
var init_notebookEditTool = __esm(() => {
|
|
68103
68277
|
init_shared();
|
|
@@ -68213,7 +68387,7 @@ var init_notebookEditTool = __esm(() => {
|
|
|
68213
68387
|
edit_mode = "replace"
|
|
68214
68388
|
} = input;
|
|
68215
68389
|
const ctx = context;
|
|
68216
|
-
const fullPath = isAbsolute9(notebook_path) ? notebook_path :
|
|
68390
|
+
const fullPath = isAbsolute9(notebook_path) ? notebook_path : resolve11(getCwd(), notebook_path);
|
|
68217
68391
|
if (fullPath.startsWith("\\\\") || fullPath.startsWith("//")) {
|
|
68218
68392
|
return { result: true };
|
|
68219
68393
|
}
|
|
@@ -68317,7 +68491,7 @@ var init_notebookEditTool = __esm(() => {
|
|
|
68317
68491
|
} = args ?? {};
|
|
68318
68492
|
let cell_type = inputCellType;
|
|
68319
68493
|
const { readFileState } = context;
|
|
68320
|
-
const fullPath = isAbsolute9(notebook_path) ? notebook_path :
|
|
68494
|
+
const fullPath = isAbsolute9(notebook_path) ? notebook_path : resolve11(getCwd(), notebook_path);
|
|
68321
68495
|
try {
|
|
68322
68496
|
const { content, encoding, lineEndings } = readFileSyncWithMetadata(fullPath);
|
|
68323
68497
|
let notebook;
|
|
@@ -72296,12 +72470,12 @@ var init_cron = __esm(() => {
|
|
|
72296
72470
|
|
|
72297
72471
|
// src/engine/scheduler/cronEnv.ts
|
|
72298
72472
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
72299
|
-
import { existsSync as
|
|
72473
|
+
import { existsSync as existsSync6 } from "fs";
|
|
72300
72474
|
import { dirname as dirname13, join as join26 } from "path";
|
|
72301
72475
|
function resolveProjectRoot() {
|
|
72302
72476
|
let dir = process.cwd();
|
|
72303
72477
|
for (;; ) {
|
|
72304
|
-
if (
|
|
72478
|
+
if (existsSync6(join26(dir, ".git")))
|
|
72305
72479
|
return dir;
|
|
72306
72480
|
const parent = dirname13(dir);
|
|
72307
72481
|
if (parent === dir)
|
|
@@ -74732,7 +74906,7 @@ var init_skillModel = __esm(() => {
|
|
|
74732
74906
|
import { execFile as execFile5 } from "child_process";
|
|
74733
74907
|
import { readFileSync as readFileSync8, realpathSync as realpathSync4, statSync as statSync4 } from "fs";
|
|
74734
74908
|
import { readFile as readFile9, stat as stat6 } from "fs/promises";
|
|
74735
|
-
import { basename as basename6, dirname as dirname15, join as join29, resolve as
|
|
74909
|
+
import { basename as basename6, dirname as dirname15, join as join29, resolve as resolve12, sep as sep6 } from "path";
|
|
74736
74910
|
function getErrorMessage(code, signal) {
|
|
74737
74911
|
if (signal)
|
|
74738
74912
|
return signal;
|
|
@@ -74794,7 +74968,7 @@ function gitExe() {
|
|
|
74794
74968
|
function findGitRootImpl(startPath) {
|
|
74795
74969
|
if (typeof startPath !== "string")
|
|
74796
74970
|
startPath = String(startPath || "/tmp");
|
|
74797
|
-
let current =
|
|
74971
|
+
let current = resolve12(startPath);
|
|
74798
74972
|
const root = current.substring(0, current.indexOf(sep6) + 1) || sep6;
|
|
74799
74973
|
while (current !== root) {
|
|
74800
74974
|
try {
|
|
@@ -74833,9 +75007,9 @@ function resolveCanonicalRoot(gitRoot) {
|
|
|
74833
75007
|
if (!gitContent.startsWith("gitdir:")) {
|
|
74834
75008
|
return gitRoot;
|
|
74835
75009
|
}
|
|
74836
|
-
const worktreeGitDir =
|
|
74837
|
-
const commonDir =
|
|
74838
|
-
if (
|
|
75010
|
+
const worktreeGitDir = resolve12(gitRoot, gitContent.slice("gitdir:".length).trim());
|
|
75011
|
+
const commonDir = resolve12(worktreeGitDir, readFileSync8(join29(worktreeGitDir, "commondir"), "utf-8").trim());
|
|
75012
|
+
if (resolve12(dirname15(worktreeGitDir)) !== join29(commonDir, "worktrees")) {
|
|
74839
75013
|
return gitRoot;
|
|
74840
75014
|
}
|
|
74841
75015
|
const backlink = realpathSync4(readFileSync8(join29(worktreeGitDir, "gitdir"), "utf-8").trim());
|
|
@@ -74864,7 +75038,7 @@ function findCanonicalGitRoot(startPath) {
|
|
|
74864
75038
|
return resolved;
|
|
74865
75039
|
}
|
|
74866
75040
|
async function resolveGitDir(startPath) {
|
|
74867
|
-
const cwd =
|
|
75041
|
+
const cwd = resolve12(startPath ?? process.cwd());
|
|
74868
75042
|
const cached = resolveGitDirCache.get(cwd);
|
|
74869
75043
|
if (cached !== undefined) {
|
|
74870
75044
|
return cached;
|
|
@@ -74881,7 +75055,7 @@ async function resolveGitDir(startPath) {
|
|
|
74881
75055
|
const content = (await readFile9(gitPath, "utf-8")).trim();
|
|
74882
75056
|
if (content.startsWith("gitdir:")) {
|
|
74883
75057
|
const rawDir = content.slice("gitdir:".length).trim();
|
|
74884
|
-
const resolved =
|
|
75058
|
+
const resolved = resolve12(root, rawDir);
|
|
74885
75059
|
resolveGitDirCache.set(cwd, resolved);
|
|
74886
75060
|
return resolved;
|
|
74887
75061
|
}
|
|
@@ -74985,7 +75159,7 @@ async function resolveRefInDir(dir, ref) {
|
|
|
74985
75159
|
async function getCommonDir(gitDir) {
|
|
74986
75160
|
try {
|
|
74987
75161
|
const content = (await readFile9(join29(gitDir, "commondir"), "utf-8")).trim();
|
|
74988
|
-
return
|
|
75162
|
+
return resolve12(gitDir, content);
|
|
74989
75163
|
} catch {
|
|
74990
75164
|
return null;
|
|
74991
75165
|
}
|
|
@@ -74997,7 +75171,7 @@ async function readWorktreeHeadSha(worktreePath) {
|
|
|
74997
75171
|
if (!ptr.startsWith("gitdir:")) {
|
|
74998
75172
|
return null;
|
|
74999
75173
|
}
|
|
75000
|
-
gitDir =
|
|
75174
|
+
gitDir = resolve12(worktreePath, ptr.slice("gitdir:".length).trim());
|
|
75001
75175
|
} catch {
|
|
75002
75176
|
return null;
|
|
75003
75177
|
}
|
|
@@ -75696,8 +75870,8 @@ function memoize2(fn, resolver) {
|
|
|
75696
75870
|
// src/engine/skill/markdownLoader.ts
|
|
75697
75871
|
import { statSync as statSync5 } from "fs";
|
|
75698
75872
|
import { lstat, readdir as readdir5, readFile as readFile10, stat as stat8, realpath as realpath2 } from "fs/promises";
|
|
75699
|
-
import { homedir as
|
|
75700
|
-
import { dirname as dirname17, join as join31, resolve as
|
|
75873
|
+
import { homedir as homedir12 } from "os";
|
|
75874
|
+
import { dirname as dirname17, join as join31, resolve as resolve13 } from "path";
|
|
75701
75875
|
function extractDescriptionFromMarkdown(content, defaultDescription = "Custom item") {
|
|
75702
75876
|
const lines = content.split(`
|
|
75703
75877
|
`);
|
|
@@ -75755,9 +75929,9 @@ function resolveStopBoundary(cwd) {
|
|
|
75755
75929
|
return findGitRoot(cwd);
|
|
75756
75930
|
}
|
|
75757
75931
|
function getProjectDirsUpToHome(subdir, cwd) {
|
|
75758
|
-
const home =
|
|
75932
|
+
const home = resolve13(homedir12()).normalize("NFC");
|
|
75759
75933
|
const gitRoot = resolveStopBoundary(cwd);
|
|
75760
|
-
let current =
|
|
75934
|
+
let current = resolve13(cwd);
|
|
75761
75935
|
const dirs = [];
|
|
75762
75936
|
while (true) {
|
|
75763
75937
|
if (normalizePathForComparison(current) === normalizePathForComparison(home)) {
|
|
@@ -77325,7 +77499,7 @@ var init_types6 = __esm(() => {
|
|
|
77325
77499
|
});
|
|
77326
77500
|
|
|
77327
77501
|
// src/mcp/mcpJsonRpc.ts
|
|
77328
|
-
import { spawn as
|
|
77502
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
77329
77503
|
function createMcpJsonRpcClient(readStream, writeStream) {
|
|
77330
77504
|
let nextId = 1;
|
|
77331
77505
|
const pending = new Map;
|
|
@@ -77517,7 +77691,7 @@ function createMcpJsonRpcClient(readStream, writeStream) {
|
|
|
77517
77691
|
};
|
|
77518
77692
|
}
|
|
77519
77693
|
function spawnMcpStdioClient(opts) {
|
|
77520
|
-
const child =
|
|
77694
|
+
const child = spawn4(opts.command, opts.args, {
|
|
77521
77695
|
env: opts.env,
|
|
77522
77696
|
stdio: ["pipe", "pipe", "pipe"]
|
|
77523
77697
|
});
|
|
@@ -82397,7 +82571,7 @@ var maxDistance = 3;
|
|
|
82397
82571
|
// node_modules/commander/lib/command.js
|
|
82398
82572
|
import { EventEmitter } from "node:events";
|
|
82399
82573
|
import childProcess from "node:child_process";
|
|
82400
|
-
import
|
|
82574
|
+
import path6 from "node:path";
|
|
82401
82575
|
import fs3 from "node:fs";
|
|
82402
82576
|
import process2 from "node:process";
|
|
82403
82577
|
import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
|
|
@@ -82984,10 +83158,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
82984
83158
|
args = args.slice();
|
|
82985
83159
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
82986
83160
|
function findFile(baseDir, baseName) {
|
|
82987
|
-
const localBin =
|
|
83161
|
+
const localBin = path6.resolve(baseDir, baseName);
|
|
82988
83162
|
if (fs3.existsSync(localBin))
|
|
82989
83163
|
return localBin;
|
|
82990
|
-
if (sourceExt.includes(
|
|
83164
|
+
if (sourceExt.includes(path6.extname(baseName)))
|
|
82991
83165
|
return;
|
|
82992
83166
|
const foundExt = sourceExt.find((ext) => fs3.existsSync(`${localBin}${ext}`));
|
|
82993
83167
|
if (foundExt)
|
|
@@ -83005,19 +83179,19 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
83005
83179
|
} catch {
|
|
83006
83180
|
resolvedScriptPath = this._scriptPath;
|
|
83007
83181
|
}
|
|
83008
|
-
executableDir =
|
|
83182
|
+
executableDir = path6.resolve(path6.dirname(resolvedScriptPath), executableDir);
|
|
83009
83183
|
}
|
|
83010
83184
|
if (executableDir) {
|
|
83011
83185
|
let localFile = findFile(executableDir, executableFile);
|
|
83012
83186
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
83013
|
-
const legacyName =
|
|
83187
|
+
const legacyName = path6.basename(this._scriptPath, path6.extname(this._scriptPath));
|
|
83014
83188
|
if (legacyName !== this._name) {
|
|
83015
83189
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
83016
83190
|
}
|
|
83017
83191
|
}
|
|
83018
83192
|
executableFile = localFile || executableFile;
|
|
83019
83193
|
}
|
|
83020
|
-
const launchWithNode = sourceExt.includes(
|
|
83194
|
+
const launchWithNode = sourceExt.includes(path6.extname(executableFile));
|
|
83021
83195
|
let proc;
|
|
83022
83196
|
if (process2.platform !== "win32") {
|
|
83023
83197
|
if (launchWithNode) {
|
|
@@ -83608,7 +83782,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
83608
83782
|
cmd.helpGroup(this._defaultCommandGroup);
|
|
83609
83783
|
}
|
|
83610
83784
|
nameFromFilename(filename) {
|
|
83611
|
-
this._name =
|
|
83785
|
+
this._name = path6.basename(filename, path6.extname(filename));
|
|
83612
83786
|
return this;
|
|
83613
83787
|
}
|
|
83614
83788
|
executableDir(path) {
|
|
@@ -83981,7 +84155,7 @@ var init_dispatch = __esm(() => {
|
|
|
83981
84155
|
|
|
83982
84156
|
// src/cli/debugSink.ts
|
|
83983
84157
|
import { appendFile, mkdir as mkdir11 } from "fs/promises";
|
|
83984
|
-
import { homedir as
|
|
84158
|
+
import { homedir as homedir13 } from "os";
|
|
83985
84159
|
import { dirname as dirname19, join as join35 } from "path";
|
|
83986
84160
|
function argvHas(flag) {
|
|
83987
84161
|
return process.argv.includes(flag);
|
|
@@ -84052,7 +84226,7 @@ function initDebugSink() {
|
|
|
84052
84226
|
enabled = argvHas("--debug") || argvHas("-d") || process.argv.some((a) => a.startsWith("--debug=")) || toStderr || sinkFile !== null || isEnvTruthy(process.env.DEBUG) || isEnvTruthy(process.env.DEBUG_SDK);
|
|
84053
84227
|
if (false) {}
|
|
84054
84228
|
if (sinkFile === null && !toStderr) {
|
|
84055
|
-
const configDir = process.env.ATLAS_CONFIG_DIR ?? join35(
|
|
84229
|
+
const configDir = process.env.ATLAS_CONFIG_DIR ?? join35(homedir13(), ".atlas");
|
|
84056
84230
|
sinkFile = join35(configDir, "debug", `${getSessionId()}.txt`);
|
|
84057
84231
|
}
|
|
84058
84232
|
}
|
|
@@ -85508,8 +85682,8 @@ var init_print = __esm(() => {
|
|
|
85508
85682
|
|
|
85509
85683
|
// src/cli/handlers/update.ts
|
|
85510
85684
|
import { execFile as execFile6 } from "node:child_process";
|
|
85511
|
-
import { existsSync as
|
|
85512
|
-
import { homedir as
|
|
85685
|
+
import { existsSync as existsSync7, readFileSync as readFileSync10, realpathSync as realpathSync5 } from "node:fs";
|
|
85686
|
+
import { homedir as homedir14 } from "node:os";
|
|
85513
85687
|
import { dirname as dirname20, join as join38 } from "node:path";
|
|
85514
85688
|
function pExecFile(command, args, options = {}) {
|
|
85515
85689
|
return new Promise((resolve, reject) => {
|
|
@@ -85536,7 +85710,7 @@ function resolvePackageRoot() {
|
|
|
85536
85710
|
}
|
|
85537
85711
|
for (let dir = current;; dir = dirname20(dir)) {
|
|
85538
85712
|
const pkgPath = join38(dir, "package.json");
|
|
85539
|
-
if (
|
|
85713
|
+
if (existsSync7(pkgPath)) {
|
|
85540
85714
|
try {
|
|
85541
85715
|
const pkg = JSON.parse(readFileSync10(pkgPath, "utf8"));
|
|
85542
85716
|
if (typeof pkg.name === "string" && pkg.name.length > 0) {
|
|
@@ -85588,7 +85762,7 @@ function semverGt(a, b) {
|
|
|
85588
85762
|
return false;
|
|
85589
85763
|
}
|
|
85590
85764
|
async function npmViewLatest(name) {
|
|
85591
|
-
const res = await execFileResult("npm", ["view", name, "version", "--prefer-online"], { cwd:
|
|
85765
|
+
const res = await execFileResult("npm", ["view", name, "version", "--prefer-online"], { cwd: homedir14() });
|
|
85592
85766
|
if (res.code !== 0)
|
|
85593
85767
|
return null;
|
|
85594
85768
|
const v = res.stdout.trim();
|
|
@@ -85642,7 +85816,7 @@ async function npmChannelUpdate(name) {
|
|
|
85642
85816
|
return;
|
|
85643
85817
|
}
|
|
85644
85818
|
try {
|
|
85645
|
-
await runStep(
|
|
85819
|
+
await runStep(homedir14(), "npm", ["install", "-g", `${name}@latest`]);
|
|
85646
85820
|
} catch {
|
|
85647
85821
|
process.stderr.write(`AtlasCode update: npm 全局安装失败(见上方输出)。权限问题可试:sudo npm install -g ${name}@latest 或配置 npm prefix。
|
|
85648
85822
|
`);
|
|
@@ -85662,7 +85836,7 @@ async function updateHandler(options = {}) {
|
|
|
85662
85836
|
process.exitCode = 1;
|
|
85663
85837
|
return;
|
|
85664
85838
|
}
|
|
85665
|
-
const isGit =
|
|
85839
|
+
const isGit = existsSync7(join38(pkg.root, ".git"));
|
|
85666
85840
|
const channel = isGit ? "git" : "npm";
|
|
85667
85841
|
process.stderr.write(`AtlasCode update:安装根 ${pkg.root}(${pkg.name},当前版本 ${pkg.version},通道 ${channel})
|
|
85668
85842
|
`);
|
|
@@ -86464,8 +86638,8 @@ var init_autoMode2 = __esm(() => {
|
|
|
86464
86638
|
});
|
|
86465
86639
|
|
|
86466
86640
|
// src/cli/parse.ts
|
|
86467
|
-
import { existsSync as
|
|
86468
|
-
import { dirname as dirname21, join as join40, resolve as
|
|
86641
|
+
import { existsSync as existsSync8, readFileSync as readFileSync11, realpathSync as realpathSync6 } from "fs";
|
|
86642
|
+
import { dirname as dirname21, join as join40, resolve as resolve14 } from "path";
|
|
86469
86643
|
function resolveCliVersion(startDir) {
|
|
86470
86644
|
let dir;
|
|
86471
86645
|
try {
|
|
@@ -86473,11 +86647,11 @@ function resolveCliVersion(startDir) {
|
|
|
86473
86647
|
} catch {
|
|
86474
86648
|
return "0.0.0";
|
|
86475
86649
|
}
|
|
86476
|
-
if (!
|
|
86650
|
+
if (!existsSync8(dir))
|
|
86477
86651
|
return "0.0.0";
|
|
86478
86652
|
for (let d = dir;; d = dirname21(d)) {
|
|
86479
86653
|
const pkgPath = join40(d, "package.json");
|
|
86480
|
-
if (
|
|
86654
|
+
if (existsSync8(pkgPath)) {
|
|
86481
86655
|
try {
|
|
86482
86656
|
const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
|
|
86483
86657
|
if (typeof pkg.version === "string" && pkg.version.length > 0) {
|
|
@@ -86508,11 +86682,11 @@ function readPromptFileInline(inline, file, label) {
|
|
|
86508
86682
|
process.exit(1);
|
|
86509
86683
|
}
|
|
86510
86684
|
try {
|
|
86511
|
-
return readFileSync11(
|
|
86685
|
+
return readFileSync11(resolve14(file), "utf8");
|
|
86512
86686
|
} catch (error) {
|
|
86513
86687
|
const code = error.code;
|
|
86514
86688
|
if (code === "ENOENT") {
|
|
86515
|
-
process.stderr.write(`Error: ${label} file not found: ${
|
|
86689
|
+
process.stderr.write(`Error: ${label} file not found: ${resolve14(file)}
|
|
86516
86690
|
`);
|
|
86517
86691
|
} else {
|
|
86518
86692
|
process.stderr.write(`Error reading ${label} file: ${error.message}
|
|
@@ -86765,7 +86939,7 @@ var init_parse4 = __esm(() => {
|
|
|
86765
86939
|
});
|
|
86766
86940
|
|
|
86767
86941
|
// src/cli/dev.ts
|
|
86768
|
-
import { spawn as
|
|
86942
|
+
import { spawn as spawn5 } from "child_process";
|
|
86769
86943
|
function hasDevFlag(argv) {
|
|
86770
86944
|
for (const a of argv) {
|
|
86771
86945
|
if (!a.startsWith("-"))
|
|
@@ -86801,7 +86975,7 @@ function runHealthCheck() {
|
|
|
86801
86975
|
}
|
|
86802
86976
|
function runE2eProbe() {
|
|
86803
86977
|
const bunBin = process.env.ATLAS_BUN_BIN || "bun";
|
|
86804
|
-
|
|
86978
|
+
spawn5(bunBin, ["test", "--isolate", "tests/func/atlascode-gelu-probe.test.ts"], {
|
|
86805
86979
|
stdio: "inherit"
|
|
86806
86980
|
});
|
|
86807
86981
|
}
|
|
@@ -87752,7 +87926,7 @@ function pathKey(options = {}) {
|
|
|
87752
87926
|
// node_modules/unicorn-magic/node.js
|
|
87753
87927
|
import { promisify as promisify2 } from "node:util";
|
|
87754
87928
|
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
87755
|
-
import
|
|
87929
|
+
import path7 from "node:path";
|
|
87756
87930
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
87757
87931
|
function toPath(urlOrPath) {
|
|
87758
87932
|
return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
|
|
@@ -87760,12 +87934,12 @@ function toPath(urlOrPath) {
|
|
|
87760
87934
|
function traversePathUp(startPath) {
|
|
87761
87935
|
return {
|
|
87762
87936
|
*[Symbol.iterator]() {
|
|
87763
|
-
let currentPath =
|
|
87937
|
+
let currentPath = path7.resolve(toPath(startPath));
|
|
87764
87938
|
let previousPath;
|
|
87765
87939
|
while (previousPath !== currentPath) {
|
|
87766
87940
|
yield currentPath;
|
|
87767
87941
|
previousPath = currentPath;
|
|
87768
|
-
currentPath =
|
|
87942
|
+
currentPath = path7.resolve(currentPath, "..");
|
|
87769
87943
|
}
|
|
87770
87944
|
}
|
|
87771
87945
|
};
|
|
@@ -87778,7 +87952,7 @@ var init_node = __esm(() => {
|
|
|
87778
87952
|
|
|
87779
87953
|
// node_modules/npm-run-path/index.js
|
|
87780
87954
|
import process5 from "node:process";
|
|
87781
|
-
import
|
|
87955
|
+
import path8 from "node:path";
|
|
87782
87956
|
var npmRunPath = ({
|
|
87783
87957
|
cwd = process5.cwd(),
|
|
87784
87958
|
path: pathOption = process5.env[pathKey()],
|
|
@@ -87786,25 +87960,25 @@ var npmRunPath = ({
|
|
|
87786
87960
|
execPath = process5.execPath,
|
|
87787
87961
|
addExecPath = true
|
|
87788
87962
|
} = {}) => {
|
|
87789
|
-
const cwdPath =
|
|
87963
|
+
const cwdPath = path8.resolve(toPath(cwd));
|
|
87790
87964
|
const result = [];
|
|
87791
|
-
const pathParts = pathOption.split(
|
|
87965
|
+
const pathParts = pathOption.split(path8.delimiter);
|
|
87792
87966
|
if (preferLocal) {
|
|
87793
87967
|
applyPreferLocal(result, pathParts, cwdPath);
|
|
87794
87968
|
}
|
|
87795
87969
|
if (addExecPath) {
|
|
87796
87970
|
applyExecPath(result, pathParts, execPath, cwdPath);
|
|
87797
87971
|
}
|
|
87798
|
-
return pathOption === "" || pathOption ===
|
|
87972
|
+
return pathOption === "" || pathOption === path8.delimiter ? `${result.join(path8.delimiter)}${pathOption}` : [...result, pathOption].join(path8.delimiter);
|
|
87799
87973
|
}, applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
87800
87974
|
for (const directory of traversePathUp(cwdPath)) {
|
|
87801
|
-
const pathPart =
|
|
87975
|
+
const pathPart = path8.join(directory, "node_modules/.bin");
|
|
87802
87976
|
if (!pathParts.includes(pathPart)) {
|
|
87803
87977
|
result.push(pathPart);
|
|
87804
87978
|
}
|
|
87805
87979
|
}
|
|
87806
87980
|
}, applyExecPath = (result, pathParts, execPath, cwdPath) => {
|
|
87807
|
-
const pathPart =
|
|
87981
|
+
const pathPart = path8.resolve(cwdPath, toPath(execPath), "..");
|
|
87808
87982
|
if (!pathParts.includes(pathPart)) {
|
|
87809
87983
|
result.push(pathPart);
|
|
87810
87984
|
}
|
|
@@ -88848,7 +89022,7 @@ var init_timeout = __esm(() => {
|
|
|
88848
89022
|
|
|
88849
89023
|
// node_modules/execa/lib/methods/node.js
|
|
88850
89024
|
import { execPath, execArgv } from "node:process";
|
|
88851
|
-
import
|
|
89025
|
+
import path9 from "node:path";
|
|
88852
89026
|
var mapNode = ({ options }) => {
|
|
88853
89027
|
if (options.node === false) {
|
|
88854
89028
|
throw new TypeError('The "node" option cannot be false with `execaNode()`.');
|
|
@@ -88866,7 +89040,7 @@ var mapNode = ({ options }) => {
|
|
|
88866
89040
|
throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
|
|
88867
89041
|
}
|
|
88868
89042
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option');
|
|
88869
|
-
const resolvedNodePath =
|
|
89043
|
+
const resolvedNodePath = path9.resolve(cwd, normalizedNodePath);
|
|
88870
89044
|
const newOptions = {
|
|
88871
89045
|
__proto__: null,
|
|
88872
89046
|
shell: false,
|
|
@@ -88878,7 +89052,7 @@ var mapNode = ({ options }) => {
|
|
|
88878
89052
|
if (!shouldHandleNode) {
|
|
88879
89053
|
return [file, commandArguments, newOptions];
|
|
88880
89054
|
}
|
|
88881
|
-
if (
|
|
89055
|
+
if (path9.basename(file, ".exe") === "node") {
|
|
88882
89056
|
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
|
|
88883
89057
|
}
|
|
88884
89058
|
return [
|
|
@@ -88984,7 +89158,7 @@ var init_encoding_option = __esm(() => {
|
|
|
88984
89158
|
|
|
88985
89159
|
// node_modules/which-command/index.js
|
|
88986
89160
|
import fs4 from "node:fs";
|
|
88987
|
-
import
|
|
89161
|
+
import path10 from "node:path";
|
|
88988
89162
|
import process6 from "node:process";
|
|
88989
89163
|
function resolveOptions(command, options) {
|
|
88990
89164
|
if (typeof command !== "string" || command.length === 0) {
|
|
@@ -88998,8 +89172,8 @@ function resolveOptions(command, options) {
|
|
|
88998
89172
|
return { cwd, searchPath, pathExt };
|
|
88999
89173
|
}
|
|
89000
89174
|
function windowsExtensions(command, pathExt) {
|
|
89001
|
-
const extensions = pathExt.split(
|
|
89002
|
-
const commandExtension =
|
|
89175
|
+
const extensions = pathExt.split(path10.delimiter).filter(Boolean);
|
|
89176
|
+
const commandExtension = path10.extname(command).toLowerCase();
|
|
89003
89177
|
if (commandExtension !== "" && extensions.some((extension) => extension.toLowerCase() === commandExtension)) {
|
|
89004
89178
|
return ["", ...extensions];
|
|
89005
89179
|
}
|
|
@@ -89008,7 +89182,7 @@ function windowsExtensions(command, pathExt) {
|
|
|
89008
89182
|
function* candidatePaths(command, { cwd, searchPath, pathExt }) {
|
|
89009
89183
|
const extensions = isWindows ? windowsExtensions(command, pathExt) : [""];
|
|
89010
89184
|
if (separatorPattern.test(command)) {
|
|
89011
|
-
const base =
|
|
89185
|
+
const base = path10.resolve(cwd, command);
|
|
89012
89186
|
for (const extension of extensions) {
|
|
89013
89187
|
yield base + extension;
|
|
89014
89188
|
}
|
|
@@ -89016,14 +89190,14 @@ function* candidatePaths(command, { cwd, searchPath, pathExt }) {
|
|
|
89016
89190
|
}
|
|
89017
89191
|
const directories = [
|
|
89018
89192
|
...isWindows ? [cwd] : [],
|
|
89019
|
-
...searchPath.split(
|
|
89193
|
+
...searchPath.split(path10.delimiter)
|
|
89020
89194
|
];
|
|
89021
89195
|
for (const directory of directories) {
|
|
89022
89196
|
const unquoted = isWindows && directory.length > 1 && directory.startsWith('"') && directory.endsWith('"') ? directory.slice(1, -1) : directory;
|
|
89023
89197
|
if (unquoted === "") {
|
|
89024
89198
|
continue;
|
|
89025
89199
|
}
|
|
89026
|
-
const base =
|
|
89200
|
+
const base = path10.resolve(cwd, unquoted, command);
|
|
89027
89201
|
for (const extension of extensions) {
|
|
89028
89202
|
yield base + extension;
|
|
89029
89203
|
}
|
|
@@ -89067,7 +89241,7 @@ var init_which_command = __esm(() => {
|
|
|
89067
89241
|
// node_modules/execa/lib/arguments/command-file.js
|
|
89068
89242
|
import { openSync as openSync3, readSync as readSync3, closeSync as closeSync3 } from "node:fs";
|
|
89069
89243
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
89070
|
-
import
|
|
89244
|
+
import path11 from "node:path";
|
|
89071
89245
|
import process7 from "node:process";
|
|
89072
89246
|
var parseCommandFile = (file, commandArguments, options) => {
|
|
89073
89247
|
const parsed = { file, commandArguments: [...commandArguments], options };
|
|
@@ -89088,7 +89262,7 @@ var parseCommandFile = (file, commandArguments, options) => {
|
|
|
89088
89262
|
assertNoLineBreak(value);
|
|
89089
89263
|
}
|
|
89090
89264
|
const isDoubleEscape = resolvedFile !== undefined && batchFileRegExp.test(resolvedFile);
|
|
89091
|
-
const escapedFile = escapeMetaChars(
|
|
89265
|
+
const escapedFile = escapeMetaChars(path11.normalize(resolvedFile ?? parsed.file));
|
|
89092
89266
|
const escapedArguments = parsed.commandArguments.map((argument) => escapeArgument(argument, isDoubleEscape));
|
|
89093
89267
|
const commandLine = `"${[escapedFile, ...escapedArguments].join(" ")}"`;
|
|
89094
89268
|
parsed.options.windowsVerbatimArguments = true;
|
|
@@ -89110,10 +89284,10 @@ var parseCommandFile = (file, commandArguments, options) => {
|
|
|
89110
89284
|
const environment = parsed.options.env || process7.env;
|
|
89111
89285
|
const cwd = parsed.options.cwd ?? process7.cwd();
|
|
89112
89286
|
const environmentPathExt = getWindowsEnvironmentValue(environment, "PATHEXT");
|
|
89113
|
-
const commandExtension =
|
|
89114
|
-
const pathExt = commandExtension === "" ? environmentPathExt : `${commandExtension}${
|
|
89287
|
+
const commandExtension = path11.extname(parsed.file);
|
|
89288
|
+
const pathExt = commandExtension === "" ? environmentPathExt : `${commandExtension}${path11.delimiter}${environmentPathExt ?? ""}`;
|
|
89115
89289
|
if (hasWindowsPathSeparator(parsed.file)) {
|
|
89116
|
-
return whichCommandSync(
|
|
89290
|
+
return whichCommandSync(path11.resolve(cwd, parsed.file), { cwd, pathExt });
|
|
89117
89291
|
}
|
|
89118
89292
|
const searchPath = getWindowsEnvironmentValue(environment, "PATH") ?? getWindowsEnvironmentValue(process7.env, "PATH") ?? "";
|
|
89119
89293
|
const resolveOptions = {
|
|
@@ -89123,12 +89297,12 @@ var parseCommandFile = (file, commandArguments, options) => {
|
|
|
89123
89297
|
};
|
|
89124
89298
|
return shouldSearchCurrentDirectory(environment) ? whichCommandSync(parsed.file, resolveOptions) : resolvePathDirectories(parsed.file, resolveOptions);
|
|
89125
89299
|
}, hasWindowsPathSeparator = (file) => file.includes("/") || file.includes("\\") || file.includes(":"), shouldSearchCurrentDirectory = (environment) => getWindowsEnvironmentValue(process7.env, "NODEFAULTCURRENTDIRECTORYINEXEPATH") === undefined && getWindowsEnvironmentValue(environment, "NODEFAULTCURRENTDIRECTORYINEXEPATH") === undefined, resolvePathDirectories = (file, { cwd, path: searchPath, pathExt }) => {
|
|
89126
|
-
for (const directory of searchPath.split(
|
|
89300
|
+
for (const directory of searchPath.split(path11.delimiter)) {
|
|
89127
89301
|
const unquotedDirectory = directory.length > 1 && directory.startsWith('"') && directory.endsWith('"') ? directory.slice(1, -1) : directory;
|
|
89128
89302
|
if (unquotedDirectory === "") {
|
|
89129
89303
|
continue;
|
|
89130
89304
|
}
|
|
89131
|
-
const resolvedFile = whichCommandSync(
|
|
89305
|
+
const resolvedFile = whichCommandSync(path11.resolve(cwd, unquotedDirectory, file), { cwd, pathExt });
|
|
89132
89306
|
if (resolvedFile !== undefined) {
|
|
89133
89307
|
return resolvedFile;
|
|
89134
89308
|
}
|
|
@@ -89187,11 +89361,11 @@ var init_command_file = __esm(() => {
|
|
|
89187
89361
|
|
|
89188
89362
|
// node_modules/execa/lib/arguments/cwd.js
|
|
89189
89363
|
import { statSync as statSync6 } from "node:fs";
|
|
89190
|
-
import
|
|
89364
|
+
import path12 from "node:path";
|
|
89191
89365
|
import process8 from "node:process";
|
|
89192
89366
|
var normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
89193
89367
|
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
|
|
89194
|
-
return
|
|
89368
|
+
return path12.resolve(cwdString);
|
|
89195
89369
|
}, getDefaultCwd = () => {
|
|
89196
89370
|
try {
|
|
89197
89371
|
return process8.cwd();
|
|
@@ -89223,7 +89397,7 @@ var init_cwd2 = __esm(() => {
|
|
|
89223
89397
|
});
|
|
89224
89398
|
|
|
89225
89399
|
// node_modules/execa/lib/arguments/options.js
|
|
89226
|
-
import
|
|
89400
|
+
import path13 from "node:path";
|
|
89227
89401
|
import process9 from "node:process";
|
|
89228
89402
|
var cmdExeRegExp, normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
89229
89403
|
const sanitizedOptions = { __proto__: null, ...rawOptions };
|
|
@@ -89242,7 +89416,7 @@ var cmdExeRegExp, normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
89242
89416
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
89243
89417
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
89244
89418
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
89245
|
-
if (process9.platform === "win32" && cmdExeRegExp.test(
|
|
89419
|
+
if (process9.platform === "win32" && cmdExeRegExp.test(path13.basename(file))) {
|
|
89246
89420
|
commandArguments.unshift("/q");
|
|
89247
89421
|
}
|
|
89248
89422
|
return { file, commandArguments, options };
|
|
@@ -92345,7 +92519,7 @@ var init_output_async = __esm(() => {
|
|
|
92345
92519
|
// node_modules/execa/lib/terminate/kill-descendants.js
|
|
92346
92520
|
import process12 from "node:process";
|
|
92347
92521
|
import { execFile as execFile7 } from "node:child_process";
|
|
92348
|
-
import
|
|
92522
|
+
import path14 from "node:path/win32";
|
|
92349
92523
|
var isWindows2, getSpawnOptions = (options) => options.killDescendants && !isWindows2 ? { ...options, detached: true } : options, getKillFunction = (subprocess, { killDescendants }) => {
|
|
92350
92524
|
if (!killDescendants) {
|
|
92351
92525
|
return subprocess.kill.bind(subprocess);
|
|
@@ -92377,9 +92551,9 @@ var isWindows2, getSpawnOptions = (options) => options.killDescendants && !isWin
|
|
|
92377
92551
|
return true;
|
|
92378
92552
|
}, getTaskkillFile = () => {
|
|
92379
92553
|
const windowsDirectory = [process12.env.SystemRoot, process12.env.windir].find((directory) => directory && isWindowsDriveAbsolutePath(directory));
|
|
92380
|
-
return windowsDirectory === undefined ? undefined :
|
|
92554
|
+
return windowsDirectory === undefined ? undefined : path14.join(windowsDirectory, "System32", "taskkill.exe");
|
|
92381
92555
|
}, isWindowsDriveAbsolutePath = (directory) => {
|
|
92382
|
-
const { root } =
|
|
92556
|
+
const { root } = path14.parse(directory);
|
|
92383
92557
|
return /^[a-z]:[/\\]/i.test(root);
|
|
92384
92558
|
};
|
|
92385
92559
|
var init_kill_descendants = __esm(() => {
|
|
@@ -93830,7 +94004,7 @@ var mergePromise = (promise, properties) => Object.assign(promise, properties);
|
|
|
93830
94004
|
|
|
93831
94005
|
// node_modules/execa/lib/methods/main-async.js
|
|
93832
94006
|
import { setMaxListeners as setMaxListeners2 } from "node:events";
|
|
93833
|
-
import { spawn as
|
|
94007
|
+
import { spawn as spawn6 } from "node:child_process";
|
|
93834
94008
|
var execaCoreAsync = (rawFile, rawArguments, rawOptions, createNested) => {
|
|
93835
94009
|
const { file, commandArguments, command, escapedCommand, startTime, verboseInfo, options, fileDescriptors } = handleAsyncArguments(rawFile, rawArguments, rawOptions);
|
|
93836
94010
|
const { subprocess: nodeChildProcess, promise, kill, all, convertedStreams } = spawnSubprocessAsync({
|
|
@@ -93882,7 +94056,7 @@ var execaCoreAsync = (rawFile, rawArguments, rawOptions, createNested) => {
|
|
|
93882
94056
|
}, spawnSubprocessAsync = ({ file, commandArguments, options, startTime, verboseInfo, command, escapedCommand, fileDescriptors }) => {
|
|
93883
94057
|
let subprocess;
|
|
93884
94058
|
try {
|
|
93885
|
-
subprocess =
|
|
94059
|
+
subprocess = spawn6(...concatenateShell(file, commandArguments, getSpawnOptions(options)));
|
|
93886
94060
|
} catch (error) {
|
|
93887
94061
|
return handleEarlyError({
|
|
93888
94062
|
error,
|
|
@@ -94846,7 +95020,7 @@ var init_debugFilter = __esm(() => {
|
|
|
94846
95020
|
});
|
|
94847
95021
|
|
|
94848
95022
|
// src/tui/utils/configDir.ts
|
|
94849
|
-
import { existsSync as
|
|
95023
|
+
import { existsSync as existsSync9 } from "fs";
|
|
94850
95024
|
import { join as join43 } from "path";
|
|
94851
95025
|
function getConfigDirName2() {
|
|
94852
95026
|
const override = process.env.ATLAS_CONFIG_DIR_NAME;
|
|
@@ -94864,7 +95038,7 @@ function findMemoryFile(dir, local = false) {
|
|
|
94864
95038
|
function findManifestInDir(dir, fileName) {
|
|
94865
95039
|
for (const d of getPluginManifestDirs()) {
|
|
94866
95040
|
const p = join43(dir, d, fileName);
|
|
94867
|
-
if (
|
|
95041
|
+
if (existsSync9(p)) {
|
|
94868
95042
|
return p;
|
|
94869
95043
|
}
|
|
94870
95044
|
}
|
|
@@ -94874,7 +95048,7 @@ var NEW_CONFIG_DIR2 = ".atlas", PLUGIN_MANIFEST_DIR = "atlas-plugin", LEGACY_PLU
|
|
|
94874
95048
|
var init_configDir = () => {};
|
|
94875
95049
|
|
|
94876
95050
|
// src/tui/utils/envUtils.ts
|
|
94877
|
-
import { homedir as
|
|
95051
|
+
import { homedir as homedir15 } from "os";
|
|
94878
95052
|
import { join as join44 } from "path";
|
|
94879
95053
|
function getTeamsDir4() {
|
|
94880
95054
|
return join44(getAtlasConfigHomeDir3(), "teams");
|
|
@@ -94931,7 +95105,7 @@ var init_envUtils2 = __esm(() => {
|
|
|
94931
95105
|
init_memoize();
|
|
94932
95106
|
init_configDir();
|
|
94933
95107
|
getAtlasConfigHomeDir3 = memoize_default(() => {
|
|
94934
|
-
return (process.env.ATLAS_CONFIG_DIR ?? join44(
|
|
95108
|
+
return (process.env.ATLAS_CONFIG_DIR ?? join44(homedir15(), getConfigDirName2())).normalize("NFC");
|
|
94935
95109
|
}, () => process.env.ATLAS_CONFIG_DIR);
|
|
94936
95110
|
});
|
|
94937
95111
|
|
|
@@ -97539,7 +97713,7 @@ var init_is_safe_filename = __esm(() => {
|
|
|
97539
97713
|
});
|
|
97540
97714
|
|
|
97541
97715
|
// node_modules/env-paths/index.js
|
|
97542
|
-
import
|
|
97716
|
+
import path15 from "node:path";
|
|
97543
97717
|
import os from "node:os";
|
|
97544
97718
|
import process14 from "node:process";
|
|
97545
97719
|
function envPaths(name, { suffix = "nodejs" } = {}) {
|
|
@@ -97556,38 +97730,38 @@ function envPaths(name, { suffix = "nodejs" } = {}) {
|
|
|
97556
97730
|
}
|
|
97557
97731
|
return linux(name);
|
|
97558
97732
|
}
|
|
97559
|
-
var
|
|
97560
|
-
const library =
|
|
97733
|
+
var homedir16, tmpdir5, env3, macos = (name) => {
|
|
97734
|
+
const library = path15.join(homedir16, "Library");
|
|
97561
97735
|
return {
|
|
97562
|
-
data:
|
|
97563
|
-
config:
|
|
97564
|
-
cache:
|
|
97565
|
-
log:
|
|
97566
|
-
temp:
|
|
97736
|
+
data: path15.join(library, "Application Support", name),
|
|
97737
|
+
config: path15.join(library, "Preferences", name),
|
|
97738
|
+
cache: path15.join(library, "Caches", name),
|
|
97739
|
+
log: path15.join(library, "Logs", name),
|
|
97740
|
+
temp: path15.join(tmpdir5, name)
|
|
97567
97741
|
};
|
|
97568
97742
|
}, windows = (name) => {
|
|
97569
|
-
const appData = env3.APPDATA ||
|
|
97570
|
-
const localAppData = env3.LOCALAPPDATA ||
|
|
97743
|
+
const appData = env3.APPDATA || path15.join(homedir16, "AppData", "Roaming");
|
|
97744
|
+
const localAppData = env3.LOCALAPPDATA || path15.join(homedir16, "AppData", "Local");
|
|
97571
97745
|
return {
|
|
97572
|
-
data:
|
|
97573
|
-
config:
|
|
97574
|
-
cache:
|
|
97575
|
-
log:
|
|
97576
|
-
temp:
|
|
97746
|
+
data: path15.join(localAppData, name, "Data"),
|
|
97747
|
+
config: path15.join(appData, name, "Config"),
|
|
97748
|
+
cache: path15.join(localAppData, name, "Cache"),
|
|
97749
|
+
log: path15.join(localAppData, name, "Log"),
|
|
97750
|
+
temp: path15.join(tmpdir5, name)
|
|
97577
97751
|
};
|
|
97578
97752
|
}, linux = (name) => {
|
|
97579
|
-
const username =
|
|
97753
|
+
const username = path15.basename(homedir16);
|
|
97580
97754
|
return {
|
|
97581
|
-
data:
|
|
97582
|
-
config:
|
|
97583
|
-
cache:
|
|
97584
|
-
log:
|
|
97585
|
-
temp:
|
|
97755
|
+
data: path15.join(env3.XDG_DATA_HOME || path15.join(homedir16, ".local", "share"), name),
|
|
97756
|
+
config: path15.join(env3.XDG_CONFIG_HOME || path15.join(homedir16, ".config"), name),
|
|
97757
|
+
cache: path15.join(env3.XDG_CACHE_HOME || path15.join(homedir16, ".cache"), name),
|
|
97758
|
+
log: path15.join(env3.XDG_STATE_HOME || path15.join(homedir16, ".local", "state"), name),
|
|
97759
|
+
temp: path15.join(tmpdir5, username, name)
|
|
97586
97760
|
};
|
|
97587
97761
|
};
|
|
97588
97762
|
var init_env_paths = __esm(() => {
|
|
97589
97763
|
init_is_safe_filename();
|
|
97590
|
-
|
|
97764
|
+
homedir16 = os.homedir();
|
|
97591
97765
|
tmpdir5 = os.tmpdir();
|
|
97592
97766
|
({ env: env3 } = process14);
|
|
97593
97767
|
});
|
|
@@ -98092,12 +98266,12 @@ var init_gitConfigParser = () => {};
|
|
|
98092
98266
|
// src/tui/utils/git/gitFilesystem.ts
|
|
98093
98267
|
import { unwatchFile, watchFile } from "fs";
|
|
98094
98268
|
import { readdir as readdir7, readFile as readFile15, stat as stat13 } from "fs/promises";
|
|
98095
|
-
import { join as join47, resolve as
|
|
98269
|
+
import { join as join47, resolve as resolve15 } from "path";
|
|
98096
98270
|
function clearResolveGitDirCache() {
|
|
98097
98271
|
resolveGitDirCache2.clear();
|
|
98098
98272
|
}
|
|
98099
98273
|
async function resolveGitDir2(startPath) {
|
|
98100
|
-
const cwd =
|
|
98274
|
+
const cwd = resolve15(startPath ?? getCwd());
|
|
98101
98275
|
const cached = resolveGitDirCache2.get(cwd);
|
|
98102
98276
|
if (cached !== undefined) {
|
|
98103
98277
|
return cached;
|
|
@@ -98114,7 +98288,7 @@ async function resolveGitDir2(startPath) {
|
|
|
98114
98288
|
const content = (await readFile15(gitPath, "utf-8")).trim();
|
|
98115
98289
|
if (content.startsWith("gitdir:")) {
|
|
98116
98290
|
const rawDir = content.slice("gitdir:".length).trim();
|
|
98117
|
-
const resolved =
|
|
98291
|
+
const resolved = resolve15(root, rawDir);
|
|
98118
98292
|
resolveGitDirCache2.set(cwd, resolved);
|
|
98119
98293
|
return resolved;
|
|
98120
98294
|
}
|
|
@@ -98218,7 +98392,7 @@ async function resolveRefInDir2(dir, ref) {
|
|
|
98218
98392
|
async function getCommonDir2(gitDir) {
|
|
98219
98393
|
try {
|
|
98220
98394
|
const content = (await readFile15(join47(gitDir, "commondir"), "utf-8")).trim();
|
|
98221
|
-
return
|
|
98395
|
+
return resolve15(gitDir, content);
|
|
98222
98396
|
} catch {
|
|
98223
98397
|
return null;
|
|
98224
98398
|
}
|
|
@@ -98438,7 +98612,7 @@ async function readWorktreeHeadSha2(worktreePath) {
|
|
|
98438
98612
|
if (!ptr.startsWith("gitdir:")) {
|
|
98439
98613
|
return null;
|
|
98440
98614
|
}
|
|
98441
|
-
gitDir =
|
|
98615
|
+
gitDir = resolve15(worktreePath, ptr.slice("gitdir:".length).trim());
|
|
98442
98616
|
} catch {
|
|
98443
98617
|
return null;
|
|
98444
98618
|
}
|
|
@@ -99234,9 +99408,64 @@ var init_which = __esm(() => {
|
|
|
99234
99408
|
whichSync = bunWhich ?? whichNodeSync;
|
|
99235
99409
|
});
|
|
99236
99410
|
|
|
99411
|
+
// src/tui/utils/plugins/gitAvailability.ts
|
|
99412
|
+
import { existsSync as existsSync10 } from "fs";
|
|
99413
|
+
import { join as join48 } from "path";
|
|
99414
|
+
function windowsGitCandidates() {
|
|
99415
|
+
const candidates = [];
|
|
99416
|
+
const roots = [
|
|
99417
|
+
process.env["ProgramFiles"] ?? "C:\\Program Files",
|
|
99418
|
+
process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)"
|
|
99419
|
+
];
|
|
99420
|
+
for (const root of roots) {
|
|
99421
|
+
candidates.push(join48(root, "Git", "cmd", "git.exe"));
|
|
99422
|
+
candidates.push(join48(root, "Git", "bin", "git.exe"));
|
|
99423
|
+
}
|
|
99424
|
+
if (process.env["LOCALAPPDATA"]) {
|
|
99425
|
+
candidates.push(join48(process.env["LOCALAPPDATA"], "Programs", "Git", "cmd", "git.exe"));
|
|
99426
|
+
}
|
|
99427
|
+
if (process.env["USERPROFILE"]) {
|
|
99428
|
+
candidates.push(join48(process.env["USERPROFILE"], "scoop", "shims", "git.exe"));
|
|
99429
|
+
}
|
|
99430
|
+
candidates.push("C:\\ProgramData\\chocolatey\\bin\\git.exe");
|
|
99431
|
+
candidates.push("C:\\msys64\\usr\\bin\\git.exe");
|
|
99432
|
+
return candidates;
|
|
99433
|
+
}
|
|
99434
|
+
async function isCommandAvailable(command) {
|
|
99435
|
+
try {
|
|
99436
|
+
return !!await which(command);
|
|
99437
|
+
} catch {
|
|
99438
|
+
return false;
|
|
99439
|
+
}
|
|
99440
|
+
}
|
|
99441
|
+
function markGitUnavailable() {
|
|
99442
|
+
checkGitAvailable.cache?.set?.(undefined, Promise.resolve(false));
|
|
99443
|
+
}
|
|
99444
|
+
var resolveWindowsGitBinary, checkGitAvailable;
|
|
99445
|
+
var init_gitAvailability = __esm(() => {
|
|
99446
|
+
init_memoize();
|
|
99447
|
+
init_which();
|
|
99448
|
+
resolveWindowsGitBinary = memoize_default(() => {
|
|
99449
|
+
if (process.platform !== "win32")
|
|
99450
|
+
return null;
|
|
99451
|
+
for (const candidate of windowsGitCandidates()) {
|
|
99452
|
+
try {
|
|
99453
|
+
if (existsSync10(candidate))
|
|
99454
|
+
return candidate;
|
|
99455
|
+
} catch {}
|
|
99456
|
+
}
|
|
99457
|
+
return null;
|
|
99458
|
+
});
|
|
99459
|
+
checkGitAvailable = memoize_default(async () => {
|
|
99460
|
+
if (await isCommandAvailable("git"))
|
|
99461
|
+
return true;
|
|
99462
|
+
return resolveWindowsGitBinary() !== null;
|
|
99463
|
+
});
|
|
99464
|
+
});
|
|
99465
|
+
|
|
99237
99466
|
// src/tui/utils/git.ts
|
|
99238
99467
|
import { readFileSync as readFileSync14, realpathSync as realpathSync7, statSync as statSync7 } from "fs";
|
|
99239
|
-
import { basename as basename9, dirname as dirname25, join as
|
|
99468
|
+
import { basename as basename9, dirname as dirname25, join as join49, resolve as resolve16, sep as sep7 } from "path";
|
|
99240
99469
|
function createFindGitRoot() {
|
|
99241
99470
|
function wrapper(startPath) {
|
|
99242
99471
|
const result = findGitRootImpl2(startPath);
|
|
@@ -99291,14 +99520,14 @@ async function getGitState() {
|
|
|
99291
99520
|
function isCurrentDirectoryBareGitRepo2() {
|
|
99292
99521
|
const fs = getFsImplementation2();
|
|
99293
99522
|
const cwd = getCwd();
|
|
99294
|
-
const gitPath =
|
|
99523
|
+
const gitPath = join49(cwd, ".git");
|
|
99295
99524
|
try {
|
|
99296
99525
|
const stats = fs.statSync(gitPath);
|
|
99297
99526
|
if (stats.isFile()) {
|
|
99298
99527
|
return false;
|
|
99299
99528
|
}
|
|
99300
99529
|
if (stats.isDirectory()) {
|
|
99301
|
-
const gitHeadPath =
|
|
99530
|
+
const gitHeadPath = join49(gitPath, "HEAD");
|
|
99302
99531
|
try {
|
|
99303
99532
|
if (fs.statSync(gitHeadPath).isFile()) {
|
|
99304
99533
|
return false;
|
|
@@ -99307,15 +99536,15 @@ function isCurrentDirectoryBareGitRepo2() {
|
|
|
99307
99536
|
}
|
|
99308
99537
|
} catch {}
|
|
99309
99538
|
try {
|
|
99310
|
-
if (fs.statSync(
|
|
99539
|
+
if (fs.statSync(join49(cwd, "HEAD")).isFile())
|
|
99311
99540
|
return true;
|
|
99312
99541
|
} catch {}
|
|
99313
99542
|
try {
|
|
99314
|
-
if (fs.statSync(
|
|
99543
|
+
if (fs.statSync(join49(cwd, "objects")).isDirectory())
|
|
99315
99544
|
return true;
|
|
99316
99545
|
} catch {}
|
|
99317
99546
|
try {
|
|
99318
|
-
if (fs.statSync(
|
|
99547
|
+
if (fs.statSync(join49(cwd, "refs")).isDirectory())
|
|
99319
99548
|
return true;
|
|
99320
99549
|
} catch {}
|
|
99321
99550
|
return false;
|
|
@@ -99364,6 +99593,7 @@ var init_git2 = __esm(() => {
|
|
|
99364
99593
|
init_gitFilesystem();
|
|
99365
99594
|
init_log5();
|
|
99366
99595
|
init_memoize2();
|
|
99596
|
+
init_gitAvailability();
|
|
99367
99597
|
init_which();
|
|
99368
99598
|
GIT_ROOT_NOT_FOUND2 = Symbol("git-root-not-found");
|
|
99369
99599
|
findGitRootImpl2 = memoizeWithLRU((startPath) => {
|
|
@@ -99371,12 +99601,12 @@ var init_git2 = __esm(() => {
|
|
|
99371
99601
|
logForDiagnosticsNoPII("info", "find_git_root_started");
|
|
99372
99602
|
if (typeof startPath !== "string")
|
|
99373
99603
|
startPath = String(startPath || "/tmp");
|
|
99374
|
-
let current =
|
|
99604
|
+
let current = resolve16(startPath);
|
|
99375
99605
|
const root = current.substring(0, current.indexOf(sep7) + 1) || sep7;
|
|
99376
99606
|
let statCount = 0;
|
|
99377
99607
|
while (current !== root) {
|
|
99378
99608
|
try {
|
|
99379
|
-
const gitPath =
|
|
99609
|
+
const gitPath = join49(current, ".git");
|
|
99380
99610
|
statCount++;
|
|
99381
99611
|
const stat = statSync7(gitPath);
|
|
99382
99612
|
if (stat.isDirectory() || stat.isFile()) {
|
|
@@ -99395,7 +99625,7 @@ var init_git2 = __esm(() => {
|
|
|
99395
99625
|
current = parent;
|
|
99396
99626
|
}
|
|
99397
99627
|
try {
|
|
99398
|
-
const gitPath =
|
|
99628
|
+
const gitPath = join49(root, ".git");
|
|
99399
99629
|
statCount++;
|
|
99400
99630
|
const stat = statSync7(gitPath);
|
|
99401
99631
|
if (stat.isDirectory() || stat.isFile()) {
|
|
@@ -99417,17 +99647,17 @@ var init_git2 = __esm(() => {
|
|
|
99417
99647
|
findGitRoot2 = createFindGitRoot();
|
|
99418
99648
|
resolveCanonicalRoot2 = memoizeWithLRU((gitRoot) => {
|
|
99419
99649
|
try {
|
|
99420
|
-
const gitContent = readFileSync14(
|
|
99650
|
+
const gitContent = readFileSync14(join49(gitRoot, ".git"), "utf-8").trim();
|
|
99421
99651
|
if (!gitContent.startsWith("gitdir:")) {
|
|
99422
99652
|
return gitRoot;
|
|
99423
99653
|
}
|
|
99424
|
-
const worktreeGitDir =
|
|
99425
|
-
const commonDir =
|
|
99426
|
-
if (
|
|
99654
|
+
const worktreeGitDir = resolve16(gitRoot, gitContent.slice("gitdir:".length).trim());
|
|
99655
|
+
const commonDir = resolve16(worktreeGitDir, readFileSync14(join49(worktreeGitDir, "commondir"), "utf-8").trim());
|
|
99656
|
+
if (resolve16(dirname25(worktreeGitDir)) !== join49(commonDir, "worktrees")) {
|
|
99427
99657
|
return gitRoot;
|
|
99428
99658
|
}
|
|
99429
|
-
const backlink = realpathSync7(readFileSync14(
|
|
99430
|
-
if (backlink !==
|
|
99659
|
+
const backlink = realpathSync7(readFileSync14(join49(worktreeGitDir, "gitdir"), "utf-8").trim());
|
|
99660
|
+
if (backlink !== join49(realpathSync7(gitRoot), ".git")) {
|
|
99431
99661
|
return gitRoot;
|
|
99432
99662
|
}
|
|
99433
99663
|
if (basename9(commonDir) !== ".git") {
|
|
@@ -99440,7 +99670,7 @@ var init_git2 = __esm(() => {
|
|
|
99440
99670
|
}, (root) => root, 50);
|
|
99441
99671
|
findCanonicalGitRoot2 = createFindCanonicalGitRoot();
|
|
99442
99672
|
gitExe2 = memoize_default(() => {
|
|
99443
|
-
return whichSync("git") || "git";
|
|
99673
|
+
return whichSync("git") || resolveWindowsGitBinary() || "git";
|
|
99444
99674
|
});
|
|
99445
99675
|
getIsGit = memoize_default(async () => {
|
|
99446
99676
|
const startTime = Date.now();
|
|
@@ -99536,7 +99766,7 @@ var init_platform3 = __esm(() => {
|
|
|
99536
99766
|
});
|
|
99537
99767
|
|
|
99538
99768
|
// src/tui/utils/windowsPaths.ts
|
|
99539
|
-
import * as
|
|
99769
|
+
import * as path16 from "path";
|
|
99540
99770
|
import * as pathWin32 from "path/win32";
|
|
99541
99771
|
function checkPathExists(path) {
|
|
99542
99772
|
try {
|
|
@@ -99567,9 +99797,9 @@ function findExecutable(executable) {
|
|
|
99567
99797
|
`).filter(Boolean);
|
|
99568
99798
|
const cwd = getCwd().toLowerCase();
|
|
99569
99799
|
for (const candidatePath of paths) {
|
|
99570
|
-
const normalizedPath =
|
|
99571
|
-
const pathDir =
|
|
99572
|
-
if (pathDir === cwd || normalizedPath.startsWith(cwd +
|
|
99800
|
+
const normalizedPath = path16.resolve(candidatePath).toLowerCase();
|
|
99801
|
+
const pathDir = path16.dirname(normalizedPath).toLowerCase();
|
|
99802
|
+
if (pathDir === cwd || normalizedPath.startsWith(cwd + path16.sep)) {
|
|
99573
99803
|
logForDebugging3(`Skipping potentially malicious executable in current directory: ${candidatePath}`);
|
|
99574
99804
|
continue;
|
|
99575
99805
|
}
|
|
@@ -99964,8 +100194,8 @@ var init_sessionStoragePortable = __esm(() => {
|
|
|
99964
100194
|
});
|
|
99965
100195
|
|
|
99966
100196
|
// src/tui/utils/path.ts
|
|
99967
|
-
import { homedir as
|
|
99968
|
-
import { dirname as dirname27, isAbsolute as isAbsolute11, join as
|
|
100197
|
+
import { homedir as homedir17 } from "os";
|
|
100198
|
+
import { dirname as dirname27, isAbsolute as isAbsolute11, join as join51, normalize as normalize3, relative as relative5, resolve as resolve18 } from "path";
|
|
99969
100199
|
function expandPath2(path, baseDir) {
|
|
99970
100200
|
const actualBaseDir = baseDir ?? getCwd() ?? getFsImplementation2().cwd();
|
|
99971
100201
|
if (typeof path !== "string") {
|
|
@@ -99982,10 +100212,10 @@ function expandPath2(path, baseDir) {
|
|
|
99982
100212
|
return normalize3(actualBaseDir).normalize("NFC");
|
|
99983
100213
|
}
|
|
99984
100214
|
if (trimmedPath === "~") {
|
|
99985
|
-
return
|
|
100215
|
+
return homedir17().normalize("NFC");
|
|
99986
100216
|
}
|
|
99987
100217
|
if (trimmedPath.startsWith("~/")) {
|
|
99988
|
-
return
|
|
100218
|
+
return join51(homedir17(), trimmedPath.slice(2)).normalize("NFC");
|
|
99989
100219
|
}
|
|
99990
100220
|
let processedPath = trimmedPath;
|
|
99991
100221
|
if (getPlatform3() === "windows" && trimmedPath.match(/^\/[a-z]\//i)) {
|
|
@@ -99998,7 +100228,7 @@ function expandPath2(path, baseDir) {
|
|
|
99998
100228
|
if (isAbsolute11(processedPath)) {
|
|
99999
100229
|
return normalize3(processedPath).normalize("NFC");
|
|
100000
100230
|
}
|
|
100001
|
-
return
|
|
100231
|
+
return resolve18(actualBaseDir, processedPath).normalize("NFC");
|
|
100002
100232
|
}
|
|
100003
100233
|
function toRelativePath2(absolutePath) {
|
|
100004
100234
|
const relativePath = relative5(getCwd(), absolutePath);
|
|
@@ -100033,8 +100263,8 @@ var init_path3 = __esm(() => {
|
|
|
100033
100263
|
});
|
|
100034
100264
|
|
|
100035
100265
|
// src/tui/memdir/paths.ts
|
|
100036
|
-
import { homedir as
|
|
100037
|
-
import { isAbsolute as isAbsolute12, join as
|
|
100266
|
+
import { homedir as homedir18 } from "os";
|
|
100267
|
+
import { isAbsolute as isAbsolute12, join as join52, normalize as normalize4, sep as sep9 } from "path";
|
|
100038
100268
|
function isAutoMemoryEnabled2() {
|
|
100039
100269
|
const envVal = process.env.ATLAS_DISABLE_AUTO_MEMORY;
|
|
100040
100270
|
if (isEnvTruthy2(envVal)) {
|
|
@@ -100078,7 +100308,7 @@ function validateMemoryPath2(raw, expandTilde) {
|
|
|
100078
100308
|
if (restNorm === "." || restNorm === "..") {
|
|
100079
100309
|
return;
|
|
100080
100310
|
}
|
|
100081
|
-
candidate =
|
|
100311
|
+
candidate = join52(homedir18(), rest);
|
|
100082
100312
|
}
|
|
100083
100313
|
const normalized = normalize4(candidate).replace(/[/\\]+$/, "");
|
|
100084
100314
|
if (!isAbsolute12(normalized) || normalized.length < 3 || /^[A-Za-z]:$/.test(normalized) || normalized.startsWith("\\\\") || normalized.startsWith("//") || normalized.includes("\x00")) {
|
|
@@ -100103,7 +100333,7 @@ function getAutoMemBase2() {
|
|
|
100103
100333
|
return findCanonicalGitRoot2(getProjectRoot()) ?? getProjectRoot();
|
|
100104
100334
|
}
|
|
100105
100335
|
function getAutoMemEntrypoint2() {
|
|
100106
|
-
return
|
|
100336
|
+
return join52(getAutoMemPath2(), AUTO_MEM_ENTRYPOINT_NAME);
|
|
100107
100337
|
}
|
|
100108
100338
|
function isAutoMemPath2(absolutePath) {
|
|
100109
100339
|
const normalizedPath = normalize4(absolutePath);
|
|
@@ -100123,8 +100353,8 @@ var init_paths3 = __esm(() => {
|
|
|
100123
100353
|
if (override) {
|
|
100124
100354
|
return override;
|
|
100125
100355
|
}
|
|
100126
|
-
const projectsDir =
|
|
100127
|
-
return (
|
|
100356
|
+
const projectsDir = join52(getMemoryBaseDir2(), "projects");
|
|
100357
|
+
return (join52(projectsDir, sanitizePath3(getAutoMemBase2()), AUTO_MEM_DIRNAME2) + sep9).normalize("NFC");
|
|
100128
100358
|
}, () => getProjectRoot());
|
|
100129
100359
|
});
|
|
100130
100360
|
|
|
@@ -117329,9 +117559,9 @@ var init_axios2 = __esm(() => {
|
|
|
117329
117559
|
});
|
|
117330
117560
|
|
|
117331
117561
|
// src/tui/utils/env.ts
|
|
117332
|
-
import { homedir as
|
|
117333
|
-
import { join as
|
|
117334
|
-
async function
|
|
117562
|
+
import { homedir as homedir19 } from "os";
|
|
117563
|
+
import { join as join53 } from "path";
|
|
117564
|
+
async function isCommandAvailable2(command) {
|
|
117335
117565
|
try {
|
|
117336
117566
|
return !!await which(command);
|
|
117337
117567
|
} catch {
|
|
@@ -117451,12 +117681,12 @@ var init_env2 = __esm(() => {
|
|
|
117451
117681
|
init_which();
|
|
117452
117682
|
getGlobalClaudeFile = memoize_default(() => {
|
|
117453
117683
|
const fs = getFsImplementation2();
|
|
117454
|
-
const dotConfigPath =
|
|
117684
|
+
const dotConfigPath = join53(getAtlasConfigHomeDir3(), ".config.json");
|
|
117455
117685
|
if (fs.existsSync(dotConfigPath)) {
|
|
117456
117686
|
return dotConfigPath;
|
|
117457
117687
|
}
|
|
117458
|
-
const dir = process.env.ATLAS_CONFIG_DIR ||
|
|
117459
|
-
const newPath =
|
|
117688
|
+
const dir = process.env.ATLAS_CONFIG_DIR || homedir19();
|
|
117689
|
+
const newPath = join53(dir, ".atlas.json");
|
|
117460
117690
|
return newPath;
|
|
117461
117691
|
});
|
|
117462
117692
|
hasInternetAccess = memoize_default(async () => {
|
|
@@ -117472,21 +117702,21 @@ var init_env2 = __esm(() => {
|
|
|
117472
117702
|
});
|
|
117473
117703
|
detectPackageManagers = memoize_default(async () => {
|
|
117474
117704
|
const packageManagers = [];
|
|
117475
|
-
if (await
|
|
117705
|
+
if (await isCommandAvailable2("npm"))
|
|
117476
117706
|
packageManagers.push("npm");
|
|
117477
|
-
if (await
|
|
117707
|
+
if (await isCommandAvailable2("yarn"))
|
|
117478
117708
|
packageManagers.push("yarn");
|
|
117479
|
-
if (await
|
|
117709
|
+
if (await isCommandAvailable2("pnpm"))
|
|
117480
117710
|
packageManagers.push("pnpm");
|
|
117481
117711
|
return packageManagers;
|
|
117482
117712
|
});
|
|
117483
117713
|
detectRuntimes = memoize_default(async () => {
|
|
117484
117714
|
const runtimes = [];
|
|
117485
|
-
if (await
|
|
117715
|
+
if (await isCommandAvailable2("bun"))
|
|
117486
117716
|
runtimes.push("bun");
|
|
117487
|
-
if (await
|
|
117717
|
+
if (await isCommandAvailable2("deno"))
|
|
117488
117718
|
runtimes.push("deno");
|
|
117489
|
-
if (await
|
|
117719
|
+
if (await isCommandAvailable2("node"))
|
|
117490
117720
|
runtimes.push("node");
|
|
117491
117721
|
return runtimes;
|
|
117492
117722
|
});
|
|
@@ -120686,7 +120916,7 @@ function check2(file, options) {
|
|
|
120686
120916
|
var _lockfile2;
|
|
120687
120917
|
|
|
120688
120918
|
// src/tui/utils/settings/managedPath.ts
|
|
120689
|
-
import { join as
|
|
120919
|
+
import { join as join54 } from "path";
|
|
120690
120920
|
var getManagedFilePath, getManagedSettingsDropInDir2;
|
|
120691
120921
|
var init_managedPath2 = __esm(() => {
|
|
120692
120922
|
init_memoize();
|
|
@@ -120702,7 +120932,7 @@ var init_managedPath2 = __esm(() => {
|
|
|
120702
120932
|
}
|
|
120703
120933
|
});
|
|
120704
120934
|
getManagedSettingsDropInDir2 = memoize_default(function() {
|
|
120705
|
-
return
|
|
120935
|
+
return join54(getManagedFilePath(), "managed-settings.d");
|
|
120706
120936
|
});
|
|
120707
120937
|
});
|
|
120708
120938
|
|
|
@@ -120731,7 +120961,7 @@ __export(exports_teamMemPaths, {
|
|
|
120731
120961
|
isTeamMemPath: () => isTeamMemPath,
|
|
120732
120962
|
isTeamMemoryEnabled: () => isTeamMemoryEnabled
|
|
120733
120963
|
});
|
|
120734
|
-
import { dirname as dirname28, join as
|
|
120964
|
+
import { dirname as dirname28, join as join55, resolve as resolve19, sep as sep10 } from "path";
|
|
120735
120965
|
function isTeamMemoryEnabled() {
|
|
120736
120966
|
if (!isAutoMemoryEnabled2()) {
|
|
120737
120967
|
return false;
|
|
@@ -120739,13 +120969,13 @@ function isTeamMemoryEnabled() {
|
|
|
120739
120969
|
return getFeatureValue_CACHED_MAY_BE_STALE("atlas_herring_clock", false);
|
|
120740
120970
|
}
|
|
120741
120971
|
function getTeamMemPath() {
|
|
120742
|
-
return (
|
|
120972
|
+
return (join55(getAutoMemPath2(), "team") + sep10).normalize("NFC");
|
|
120743
120973
|
}
|
|
120744
120974
|
function getTeamMemEntrypoint() {
|
|
120745
|
-
return
|
|
120975
|
+
return join55(getAutoMemPath2(), "team", "MEMORY.md");
|
|
120746
120976
|
}
|
|
120747
120977
|
function isTeamMemPath(filePath) {
|
|
120748
|
-
const resolvedPath =
|
|
120978
|
+
const resolvedPath = resolve19(filePath);
|
|
120749
120979
|
const teamDir = getTeamMemPath();
|
|
120750
120980
|
return resolvedPath.startsWith(teamDir);
|
|
120751
120981
|
}
|
|
@@ -120761,7 +120991,7 @@ var init_teamMemPaths = __esm(() => {
|
|
|
120761
120991
|
// src/tui/utils/config.ts
|
|
120762
120992
|
import { randomBytes as randomBytes5 } from "crypto";
|
|
120763
120993
|
import { unwatchFile as unwatchFile2, watchFile as watchFile2 } from "fs";
|
|
120764
|
-
import { basename as basename10, dirname as dirname29, join as
|
|
120994
|
+
import { basename as basename10, dirname as dirname29, join as join56, resolve as resolve20 } from "path";
|
|
120765
120995
|
function createDefaultGlobalConfig() {
|
|
120766
120996
|
return {
|
|
120767
120997
|
numStartups: 0,
|
|
@@ -120820,7 +121050,7 @@ function computeTrustDialogAccepted() {
|
|
|
120820
121050
|
if (pathConfig?.hasTrustDialogAccepted) {
|
|
120821
121051
|
return true;
|
|
120822
121052
|
}
|
|
120823
|
-
const parentPath = normalizePathForConfigKey(
|
|
121053
|
+
const parentPath = normalizePathForConfigKey(resolve20(currentPath, ".."));
|
|
120824
121054
|
if (parentPath === currentPath) {
|
|
120825
121055
|
break;
|
|
120826
121056
|
}
|
|
@@ -121080,14 +121310,14 @@ function saveConfigWithLock(file, createDefault, mergeFn) {
|
|
|
121080
121310
|
const mostRecentTimestamp = mostRecentBackup ? Number(mostRecentBackup.split(".backup.").pop()) : 0;
|
|
121081
121311
|
const shouldCreateBackup = Number.isNaN(mostRecentTimestamp) || Date.now() - mostRecentTimestamp >= MIN_BACKUP_INTERVAL_MS;
|
|
121082
121312
|
if (shouldCreateBackup) {
|
|
121083
|
-
const backupPath =
|
|
121313
|
+
const backupPath = join56(backupDir, `${fileBase}.backup.${Date.now()}`);
|
|
121084
121314
|
fs.copyFileSync(file, backupPath);
|
|
121085
121315
|
}
|
|
121086
121316
|
const MAX_BACKUPS = 5;
|
|
121087
121317
|
const backupsForCleanup = shouldCreateBackup ? fs.readdirStringSync(backupDir).filter((f) => f.startsWith(`${fileBase}.backup.`)).sort().reverse() : existingBackups;
|
|
121088
121318
|
for (const oldBackup of backupsForCleanup.slice(MAX_BACKUPS)) {
|
|
121089
121319
|
try {
|
|
121090
|
-
fs.unlinkSync(
|
|
121320
|
+
fs.unlinkSync(join56(backupDir, oldBackup));
|
|
121091
121321
|
} catch {}
|
|
121092
121322
|
}
|
|
121093
121323
|
} catch (e) {
|
|
@@ -121125,7 +121355,7 @@ function enableConfigs() {
|
|
|
121125
121355
|
});
|
|
121126
121356
|
}
|
|
121127
121357
|
function getConfigBackupDir() {
|
|
121128
|
-
return
|
|
121358
|
+
return join56(getAtlasConfigHomeDir3(), "backups");
|
|
121129
121359
|
}
|
|
121130
121360
|
function findMostRecentBackup(file) {
|
|
121131
121361
|
const fs = getFsImplementation2();
|
|
@@ -121135,7 +121365,7 @@ function findMostRecentBackup(file) {
|
|
|
121135
121365
|
const backups = fs.readdirStringSync(backupDir).filter((f) => f.startsWith(`${fileBase}.backup.`)).sort();
|
|
121136
121366
|
const mostRecent = backups.at(-1);
|
|
121137
121367
|
if (mostRecent) {
|
|
121138
|
-
return
|
|
121368
|
+
return join56(backupDir, mostRecent);
|
|
121139
121369
|
}
|
|
121140
121370
|
} catch {}
|
|
121141
121371
|
const fileDir = dirname29(file);
|
|
@@ -121143,7 +121373,7 @@ function findMostRecentBackup(file) {
|
|
|
121143
121373
|
const backups = fs.readdirStringSync(fileDir).filter((f) => f.startsWith(`${fileBase}.backup.`)).sort();
|
|
121144
121374
|
const mostRecent = backups.at(-1);
|
|
121145
121375
|
if (mostRecent) {
|
|
121146
|
-
return
|
|
121376
|
+
return join56(fileDir, mostRecent);
|
|
121147
121377
|
}
|
|
121148
121378
|
const legacyBackup = `${file}.backup`;
|
|
121149
121379
|
try {
|
|
@@ -121211,7 +121441,7 @@ Claude configuration file at ${file} is corrupted: ${error.message}
|
|
|
121211
121441
|
const currentContent = fs.readFileSync(file, { encoding: "utf-8" });
|
|
121212
121442
|
for (const backup of existingCorruptedBackups) {
|
|
121213
121443
|
try {
|
|
121214
|
-
const backupContent = fs.readFileSync(
|
|
121444
|
+
const backupContent = fs.readFileSync(join56(corruptedBackupDir, backup), { encoding: "utf-8" });
|
|
121215
121445
|
if (currentContent === backupContent) {
|
|
121216
121446
|
alreadyBackedUp = true;
|
|
121217
121447
|
break;
|
|
@@ -121219,7 +121449,7 @@ Claude configuration file at ${file} is corrupted: ${error.message}
|
|
|
121219
121449
|
} catch {}
|
|
121220
121450
|
}
|
|
121221
121451
|
if (!alreadyBackedUp) {
|
|
121222
|
-
corruptedBackupPath =
|
|
121452
|
+
corruptedBackupPath = join56(corruptedBackupDir, `${fileBase}.corrupted.${Date.now()}`);
|
|
121223
121453
|
try {
|
|
121224
121454
|
fs.copyFileSync(file, corruptedBackupPath);
|
|
121225
121455
|
logForDebugging3(`Corrupted config backed up to: ${corruptedBackupPath}`, {
|
|
@@ -121389,10 +121619,10 @@ function getMemoryPath(memoryType) {
|
|
|
121389
121619
|
return "";
|
|
121390
121620
|
}
|
|
121391
121621
|
function getManagedClaudeRulesDir() {
|
|
121392
|
-
return
|
|
121622
|
+
return join56(getManagedFilePath(), getConfigDirName2(), "rules");
|
|
121393
121623
|
}
|
|
121394
121624
|
function getUserClaudeRulesDir() {
|
|
121395
|
-
return
|
|
121625
|
+
return join56(getAtlasConfigHomeDir3(), "rules");
|
|
121396
121626
|
}
|
|
121397
121627
|
var teamMemPaths, DEFAULT_PROJECT_CONFIG, DEFAULT_GLOBAL_CONFIG, _trustAccepted2 = false, TEST_GLOBAL_CONFIG_FOR_TESTING, TEST_PROJECT_CONFIG_FOR_TESTING, globalConfigCache, lastReadFileStats = null, configCacheHits = 0, configCacheMisses = 0, globalConfigWriteCount = 0, CONFIG_FRESHNESS_POLL_MS = 1000, freshnessWatcherStarted = false, configReadingAllowed = false, getProjectPathForConfig;
|
|
121398
121628
|
var init_config6 = __esm(() => {
|
|
@@ -121451,7 +121681,7 @@ var init_config6 = __esm(() => {
|
|
|
121451
121681
|
if (gitRoot) {
|
|
121452
121682
|
return normalizePathForConfigKey(gitRoot);
|
|
121453
121683
|
}
|
|
121454
|
-
return normalizePathForConfigKey(
|
|
121684
|
+
return normalizePathForConfigKey(resolve20(originalCwd));
|
|
121455
121685
|
});
|
|
121456
121686
|
});
|
|
121457
121687
|
|
|
@@ -121690,16 +121920,16 @@ var init_fileReadCache2 = __esm(() => {
|
|
|
121690
121920
|
// src/tui/utils/file.ts
|
|
121691
121921
|
import { chmodSync as chmodSync2, writeFileSync as fsWriteFileSync2 } from "fs";
|
|
121692
121922
|
import { realpath as realpath5, stat as stat16 } from "fs/promises";
|
|
121693
|
-
import { homedir as
|
|
121923
|
+
import { homedir as homedir20 } from "os";
|
|
121694
121924
|
import {
|
|
121695
121925
|
basename as basename11,
|
|
121696
121926
|
dirname as dirname30,
|
|
121697
121927
|
extname as extname5,
|
|
121698
121928
|
isAbsolute as isAbsolute13,
|
|
121699
|
-
join as
|
|
121929
|
+
join as join57,
|
|
121700
121930
|
normalize as normalize5,
|
|
121701
121931
|
relative as relative6,
|
|
121702
|
-
resolve as
|
|
121932
|
+
resolve as resolve21,
|
|
121703
121933
|
sep as sep11
|
|
121704
121934
|
} from "path";
|
|
121705
121935
|
async function pathExists2(path) {
|
|
@@ -121769,7 +121999,7 @@ function getDisplayPath2(filePath) {
|
|
|
121769
121999
|
if (relativePath && !relativePath.startsWith("..")) {
|
|
121770
122000
|
return relativePath;
|
|
121771
122001
|
}
|
|
121772
|
-
const homeDir =
|
|
122002
|
+
const homeDir = homedir20();
|
|
121773
122003
|
if (filePath.startsWith(homeDir + sep11)) {
|
|
121774
122004
|
return "~" + filePath.slice(homeDir.length);
|
|
121775
122005
|
}
|
|
@@ -121781,7 +122011,7 @@ function findSimilarFile2(filePath) {
|
|
|
121781
122011
|
const dir = dirname30(filePath);
|
|
121782
122012
|
const fileBaseName = basename11(filePath, extname5(filePath));
|
|
121783
122013
|
const files = fs.readdirSync(dir);
|
|
121784
|
-
const similarFiles = files.filter((file) => basename11(file.name, extname5(file.name)) === fileBaseName &&
|
|
122014
|
+
const similarFiles = files.filter((file) => basename11(file.name, extname5(file.name)) === fileBaseName && join57(dir, file.name) !== filePath);
|
|
121785
122015
|
const firstMatch = similarFiles[0];
|
|
121786
122016
|
if (firstMatch) {
|
|
121787
122017
|
return firstMatch.name;
|
|
@@ -121800,14 +122030,14 @@ async function suggestPathUnderCwd2(requestedPath) {
|
|
|
121800
122030
|
let resolvedPath = requestedPath;
|
|
121801
122031
|
try {
|
|
121802
122032
|
const resolvedDir = await realpath5(dirname30(requestedPath));
|
|
121803
|
-
resolvedPath =
|
|
122033
|
+
resolvedPath = join57(resolvedDir, basename11(requestedPath));
|
|
121804
122034
|
} catch {}
|
|
121805
122035
|
const cwdParentPrefix = cwdParent === sep11 ? sep11 : cwdParent + sep11;
|
|
121806
122036
|
if (!resolvedPath.startsWith(cwdParentPrefix) || resolvedPath.startsWith(cwd + sep11) || resolvedPath === cwd) {
|
|
121807
122037
|
return;
|
|
121808
122038
|
}
|
|
121809
122039
|
const relFromParent = relative6(cwdParent, resolvedPath);
|
|
121810
|
-
const correctedPath =
|
|
122040
|
+
const correctedPath = join57(cwd, relFromParent);
|
|
121811
122041
|
try {
|
|
121812
122042
|
await stat16(correctedPath);
|
|
121813
122043
|
return correctedPath;
|
|
@@ -121859,7 +122089,7 @@ function writeFileSyncAndFlush_DEPRECATED2(filePath, content, options = { encodi
|
|
|
121859
122089
|
let targetPath = filePath;
|
|
121860
122090
|
try {
|
|
121861
122091
|
const linkTarget = fs.readlinkSync(filePath);
|
|
121862
|
-
targetPath = isAbsolute13(linkTarget) ? linkTarget :
|
|
122092
|
+
targetPath = isAbsolute13(linkTarget) ? linkTarget : resolve21(dirname30(filePath), linkTarget);
|
|
121863
122093
|
logForDebugging3(`Writing through symlink: ${filePath} -> ${targetPath}`);
|
|
121864
122094
|
} catch {}
|
|
121865
122095
|
const tempPath = `${targetPath}.tmp.${process.pid}.${Date.now()}`;
|
|
@@ -121924,9 +122154,9 @@ function writeFileSyncAndFlush_DEPRECATED2(filePath, content, options = { encodi
|
|
|
121924
122154
|
}
|
|
121925
122155
|
function getDesktopPath2() {
|
|
121926
122156
|
const platform = getPlatform3();
|
|
121927
|
-
const homeDir =
|
|
122157
|
+
const homeDir = homedir20();
|
|
121928
122158
|
if (platform === "macos") {
|
|
121929
|
-
return
|
|
122159
|
+
return join57(homeDir, "Desktop");
|
|
121930
122160
|
}
|
|
121931
122161
|
if (platform === "windows") {
|
|
121932
122162
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
@@ -121944,7 +122174,7 @@ function getDesktopPath2() {
|
|
|
121944
122174
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
121945
122175
|
continue;
|
|
121946
122176
|
}
|
|
121947
|
-
const potentialDesktopPath =
|
|
122177
|
+
const potentialDesktopPath = join57(usersDir, user.name, "Desktop");
|
|
121948
122178
|
if (getFsImplementation2().existsSync(potentialDesktopPath)) {
|
|
121949
122179
|
return potentialDesktopPath;
|
|
121950
122180
|
}
|
|
@@ -121953,7 +122183,7 @@ function getDesktopPath2() {
|
|
|
121953
122183
|
logError3(error);
|
|
121954
122184
|
}
|
|
121955
122185
|
}
|
|
121956
|
-
const desktopPath =
|
|
122186
|
+
const desktopPath = join57(homeDir, "Desktop");
|
|
121957
122187
|
if (getFsImplementation2().existsSync(desktopPath)) {
|
|
121958
122188
|
return desktopPath;
|
|
121959
122189
|
}
|
|
@@ -121994,8 +122224,8 @@ var init_file = __esm(() => {
|
|
|
121994
122224
|
|
|
121995
122225
|
// src/tui/utils/git/gitignore.ts
|
|
121996
122226
|
import { appendFile as appendFile2, mkdir as mkdir14, readFile as readFile18, writeFile as writeFile10 } from "fs/promises";
|
|
121997
|
-
import { homedir as
|
|
121998
|
-
import { dirname as dirname31, join as
|
|
122227
|
+
import { homedir as homedir21 } from "os";
|
|
122228
|
+
import { dirname as dirname31, join as join58 } from "path";
|
|
121999
122229
|
async function isPathGitignored2(filePath, cwd) {
|
|
122000
122230
|
const { code } = await execFileNoThrowWithCwd2("git", ["check-ignore", filePath], {
|
|
122001
122231
|
preserveOutputOnError: false,
|
|
@@ -122004,7 +122234,7 @@ async function isPathGitignored2(filePath, cwd) {
|
|
|
122004
122234
|
return code === 0;
|
|
122005
122235
|
}
|
|
122006
122236
|
function getGlobalGitignorePath2() {
|
|
122007
|
-
return
|
|
122237
|
+
return join58(homedir21(), ".config", "git", "ignore");
|
|
122008
122238
|
}
|
|
122009
122239
|
async function addFileGlobRuleToGitignore(filename, cwd = getCwd()) {
|
|
122010
122240
|
try {
|
|
@@ -123067,7 +123297,7 @@ var init_constants7 = () => {};
|
|
|
123067
123297
|
var fireRawRead = () => Promise.resolve({ plistStdouts: [], regQueryStdouts: [], exitCode: 0 }), getMdmRawReadPromise = () => null;
|
|
123068
123298
|
|
|
123069
123299
|
// src/tui/utils/settings/mdm/settings.ts
|
|
123070
|
-
import { join as
|
|
123300
|
+
import { join as join59 } from "path";
|
|
123071
123301
|
function startMdmSettingsLoad() {
|
|
123072
123302
|
if (mdmLoadPromise)
|
|
123073
123303
|
return;
|
|
@@ -123169,7 +123399,7 @@ function consumeRawReadResult(raw) {
|
|
|
123169
123399
|
}
|
|
123170
123400
|
function hasManagedSettingsFile() {
|
|
123171
123401
|
try {
|
|
123172
|
-
const filePath =
|
|
123402
|
+
const filePath = join59(getManagedFilePath(), "managed-settings.json");
|
|
123173
123403
|
const content = readFileSync15(filePath);
|
|
123174
123404
|
const data = safeParseJSON3(content, false);
|
|
123175
123405
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
@@ -123184,7 +123414,7 @@ function hasManagedSettingsFile() {
|
|
|
123184
123414
|
continue;
|
|
123185
123415
|
}
|
|
123186
123416
|
try {
|
|
123187
|
-
const content = readFileSync15(
|
|
123417
|
+
const content = readFileSync15(join59(dropInDir, d.name));
|
|
123188
123418
|
const data = safeParseJSON3(content, false);
|
|
123189
123419
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
123190
123420
|
return true;
|
|
@@ -123249,9 +123479,9 @@ var init_settingsCache2 = __esm(() => {
|
|
|
123249
123479
|
});
|
|
123250
123480
|
|
|
123251
123481
|
// src/tui/utils/settings/settings.ts
|
|
123252
|
-
import { dirname as dirname32, join as
|
|
123482
|
+
import { dirname as dirname32, join as join60, resolve as resolve22 } from "path";
|
|
123253
123483
|
function getManagedSettingsFilePath2() {
|
|
123254
|
-
return
|
|
123484
|
+
return join60(getManagedFilePath(), "managed-settings.json");
|
|
123255
123485
|
}
|
|
123256
123486
|
function loadManagedFileSettings2() {
|
|
123257
123487
|
const errors = [];
|
|
@@ -123267,7 +123497,7 @@ function loadManagedFileSettings2() {
|
|
|
123267
123497
|
try {
|
|
123268
123498
|
const entries = getFsImplementation2().readdirSync(dropInDir).filter((d) => (d.isFile() || d.isSymbolicLink()) && d.name.endsWith(".json") && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
123269
123499
|
for (const name of entries) {
|
|
123270
|
-
const { settings, errors: fileErrors } = parseSettingsFile2(
|
|
123500
|
+
const { settings, errors: fileErrors } = parseSettingsFile2(join60(dropInDir, name));
|
|
123271
123501
|
errors.push(...fileErrors);
|
|
123272
123502
|
if (settings && Object.keys(settings).length > 0) {
|
|
123273
123503
|
merged = mergeWith_default(merged, settings, settingsMergeCustomizer2);
|
|
@@ -123337,15 +123567,15 @@ function parseSettingsFileUncached2(path) {
|
|
|
123337
123567
|
function getSettingsRootPathForSource2(source) {
|
|
123338
123568
|
switch (source) {
|
|
123339
123569
|
case "userSettings":
|
|
123340
|
-
return
|
|
123570
|
+
return resolve22(getAtlasConfigHomeDir3());
|
|
123341
123571
|
case "policySettings":
|
|
123342
123572
|
case "projectSettings":
|
|
123343
123573
|
case "localSettings": {
|
|
123344
|
-
return
|
|
123574
|
+
return resolve22(getOriginalCwd());
|
|
123345
123575
|
}
|
|
123346
123576
|
case "flagSettings": {
|
|
123347
123577
|
const path = getFlagSettingsPath();
|
|
123348
|
-
return path ? dirname32(
|
|
123578
|
+
return path ? dirname32(resolve22(path)) : resolve22(getOriginalCwd());
|
|
123349
123579
|
}
|
|
123350
123580
|
}
|
|
123351
123581
|
}
|
|
@@ -123358,10 +123588,10 @@ function getUserSettingsFilePath2() {
|
|
|
123358
123588
|
function getSettingsFilePathForSource2(source) {
|
|
123359
123589
|
switch (source) {
|
|
123360
123590
|
case "userSettings":
|
|
123361
|
-
return
|
|
123591
|
+
return join60(getSettingsRootPathForSource2(source), getUserSettingsFilePath2());
|
|
123362
123592
|
case "projectSettings":
|
|
123363
123593
|
case "localSettings": {
|
|
123364
|
-
return
|
|
123594
|
+
return join60(getSettingsRootPathForSource2(source), getRelativeSettingsFilePathForSource2(source));
|
|
123365
123595
|
}
|
|
123366
123596
|
case "policySettings":
|
|
123367
123597
|
return getManagedSettingsFilePath2();
|
|
@@ -123373,9 +123603,9 @@ function getSettingsFilePathForSource2(source) {
|
|
|
123373
123603
|
function getRelativeSettingsFilePathForSource2(source) {
|
|
123374
123604
|
switch (source) {
|
|
123375
123605
|
case "projectSettings":
|
|
123376
|
-
return
|
|
123606
|
+
return join60(getConfigDirName2(), "settings.json");
|
|
123377
123607
|
case "localSettings":
|
|
123378
|
-
return
|
|
123608
|
+
return join60(getConfigDirName2(), "settings.local.json");
|
|
123379
123609
|
}
|
|
123380
123610
|
}
|
|
123381
123611
|
function getSettingsForSource2(source) {
|
|
@@ -123626,7 +123856,7 @@ function loadSettingsFromDisk2() {
|
|
|
123626
123856
|
}
|
|
123627
123857
|
const filePath = getSettingsFilePathForSource2(source);
|
|
123628
123858
|
if (filePath) {
|
|
123629
|
-
const resolvedPath =
|
|
123859
|
+
const resolvedPath = resolve22(filePath);
|
|
123630
123860
|
if (!seenFiles.has(resolvedPath)) {
|
|
123631
123861
|
seenFiles.add(resolvedPath);
|
|
123632
123862
|
const { settings, errors } = parseSettingsFile2(filePath);
|
|
@@ -124002,7 +124232,7 @@ import {
|
|
|
124002
124232
|
stat as statPromise2,
|
|
124003
124233
|
unlink as unlinkPromise
|
|
124004
124234
|
} from "fs/promises";
|
|
124005
|
-
import { homedir as
|
|
124235
|
+
import { homedir as homedir22 } from "os";
|
|
124006
124236
|
import * as nodePath from "path";
|
|
124007
124237
|
function safeResolvePath3(fs, filePath) {
|
|
124008
124238
|
if (filePath.startsWith("//") || filePath.startsWith("\\\\")) {
|
|
@@ -124066,9 +124296,9 @@ function resolveDeepestExistingAncestorSync(fs, absolutePath) {
|
|
|
124066
124296
|
function getPathsForPermissionCheck2(inputPath) {
|
|
124067
124297
|
let path = inputPath;
|
|
124068
124298
|
if (path === "~") {
|
|
124069
|
-
path =
|
|
124299
|
+
path = homedir22().normalize("NFC");
|
|
124070
124300
|
} else if (path.startsWith("~/")) {
|
|
124071
|
-
path = nodePath.join(
|
|
124301
|
+
path = nodePath.join(homedir22().normalize("NFC"), path.slice(2));
|
|
124072
124302
|
}
|
|
124073
124303
|
const pathSet = new Set;
|
|
124074
124304
|
const fsImpl = getFsImplementation2();
|
|
@@ -124566,7 +124796,7 @@ function peekForStdinData2(stream, ms) {
|
|
|
124566
124796
|
|
|
124567
124797
|
// src/tui/utils/debug.ts
|
|
124568
124798
|
import { appendFile as appendFile3, mkdir as mkdir15, symlink as symlink3, unlink as unlink6 } from "fs/promises";
|
|
124569
|
-
import { dirname as dirname34, join as
|
|
124799
|
+
import { dirname as dirname34, join as join62 } from "path";
|
|
124570
124800
|
function enableDebugLogging() {
|
|
124571
124801
|
const wasActive = isDebugMode() || isAtlasDev();
|
|
124572
124802
|
runtimeDebugEnabled = true;
|
|
@@ -124650,7 +124880,7 @@ function logForDebugging3(message, { level } = {
|
|
|
124650
124880
|
getDebugWriter().write(output);
|
|
124651
124881
|
}
|
|
124652
124882
|
function getDebugLogPath() {
|
|
124653
|
-
return getDebugFilePath() ?? process.env.ATLAS_DEBUG_LOGS_DIR ??
|
|
124883
|
+
return getDebugFilePath() ?? process.env.ATLAS_DEBUG_LOGS_DIR ?? join62(getAtlasConfigHomeDir3(), "debug", `${getSessionId()}.txt`);
|
|
124654
124884
|
}
|
|
124655
124885
|
function logAntError(context, error) {
|
|
124656
124886
|
if (!isAtlasDev()) {
|
|
@@ -124717,7 +124947,7 @@ var init_debug = __esm(() => {
|
|
|
124717
124947
|
try {
|
|
124718
124948
|
const debugLogPath = getDebugLogPath();
|
|
124719
124949
|
const debugLogsDir = dirname34(debugLogPath);
|
|
124720
|
-
const latestSymlinkPath =
|
|
124950
|
+
const latestSymlinkPath = join62(debugLogsDir, "latest");
|
|
124721
124951
|
await unlink6(latestSymlinkPath).catch(() => {});
|
|
124722
124952
|
await symlink3(debugLogPath, latestSymlinkPath);
|
|
124723
124953
|
} catch {}
|
|
@@ -125305,7 +125535,7 @@ var init_profilerBase = __esm(() => {
|
|
|
125305
125535
|
});
|
|
125306
125536
|
|
|
125307
125537
|
// src/tui/utils/startupProfiler.ts
|
|
125308
|
-
import { dirname as dirname35, join as
|
|
125538
|
+
import { dirname as dirname35, join as join63 } from "path";
|
|
125309
125539
|
function profileCheckpoint(name) {
|
|
125310
125540
|
if (!SHOULD_PROFILE)
|
|
125311
125541
|
return;
|
|
@@ -125360,7 +125590,7 @@ function profileReport() {
|
|
|
125360
125590
|
}
|
|
125361
125591
|
}
|
|
125362
125592
|
function getStartupPerfLogPath() {
|
|
125363
|
-
return
|
|
125593
|
+
return join63(getAtlasConfigHomeDir3(), "startup-perf", `${getSessionId()}.txt`);
|
|
125364
125594
|
}
|
|
125365
125595
|
function logStartupPerf() {
|
|
125366
125596
|
if (!STATSIG_LOGGING_SAMPLED)
|
|
@@ -130563,41 +130793,41 @@ var require_tree_kill = __commonJS(function(exports, module) {
|
|
|
130563
130793
|
});
|
|
130564
130794
|
|
|
130565
130795
|
// src/tui/tools/AgentTool/agentMemory.ts
|
|
130566
|
-
import { join as
|
|
130796
|
+
import { join as join64, normalize as normalize6, sep as sep12 } from "path";
|
|
130567
130797
|
function sanitizeAgentTypeForPath(agentType) {
|
|
130568
130798
|
return agentType.replace(/:/g, "-");
|
|
130569
130799
|
}
|
|
130570
130800
|
function getLocalAgentMemoryDir(dirName) {
|
|
130571
130801
|
if (process.env.ATLAS_REMOTE_MEMORY_DIR) {
|
|
130572
|
-
return
|
|
130802
|
+
return join64(process.env.ATLAS_REMOTE_MEMORY_DIR, "projects", sanitizePath3(findCanonicalGitRoot2(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep12;
|
|
130573
130803
|
}
|
|
130574
|
-
return
|
|
130804
|
+
return join64(getCwd(), getConfigDirName2(), "agent-memory-local", dirName) + sep12;
|
|
130575
130805
|
}
|
|
130576
130806
|
function getAgentMemoryDir(agentType, scope) {
|
|
130577
130807
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
130578
130808
|
switch (scope) {
|
|
130579
130809
|
case "project":
|
|
130580
|
-
return
|
|
130810
|
+
return join64(getCwd(), getConfigDirName2(), "agent-memory", dirName) + sep12;
|
|
130581
130811
|
case "local":
|
|
130582
130812
|
return getLocalAgentMemoryDir(dirName);
|
|
130583
130813
|
case "user":
|
|
130584
|
-
return
|
|
130814
|
+
return join64(getMemoryBaseDir2(), "agent-memory", dirName) + sep12;
|
|
130585
130815
|
}
|
|
130586
130816
|
}
|
|
130587
130817
|
function isAgentMemoryPath(absolutePath) {
|
|
130588
130818
|
const normalizedPath = normalize6(absolutePath);
|
|
130589
130819
|
const memoryBase = getMemoryBaseDir2();
|
|
130590
|
-
if (normalizedPath.startsWith(
|
|
130820
|
+
if (normalizedPath.startsWith(join64(memoryBase, "agent-memory") + sep12)) {
|
|
130591
130821
|
return true;
|
|
130592
130822
|
}
|
|
130593
|
-
if (normalizedPath.startsWith(
|
|
130823
|
+
if (normalizedPath.startsWith(join64(getCwd(), getConfigDirName2(), "agent-memory") + sep12)) {
|
|
130594
130824
|
return true;
|
|
130595
130825
|
}
|
|
130596
130826
|
if (process.env.ATLAS_REMOTE_MEMORY_DIR) {
|
|
130597
|
-
if (normalizedPath.includes(sep12 + "agent-memory-local" + sep12) && normalizedPath.startsWith(
|
|
130827
|
+
if (normalizedPath.includes(sep12 + "agent-memory-local" + sep12) && normalizedPath.startsWith(join64(process.env.ATLAS_REMOTE_MEMORY_DIR, "projects") + sep12)) {
|
|
130598
130828
|
return true;
|
|
130599
130829
|
}
|
|
130600
|
-
} else if (normalizedPath.startsWith(
|
|
130830
|
+
} else if (normalizedPath.startsWith(join64(getCwd(), getConfigDirName2(), "agent-memory-local") + sep12)) {
|
|
130601
130831
|
return true;
|
|
130602
130832
|
}
|
|
130603
130833
|
return false;
|
|
@@ -130605,7 +130835,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
130605
130835
|
function getMemoryScopeDisplay(memory) {
|
|
130606
130836
|
switch (memory) {
|
|
130607
130837
|
case "user":
|
|
130608
|
-
return `User (${
|
|
130838
|
+
return `User (${join64(getMemoryBaseDir2(), "agent-memory")}/)`;
|
|
130609
130839
|
case "project":
|
|
130610
130840
|
return "Project (getConfigDirName()/agent-memory/)";
|
|
130611
130841
|
case "local":
|
|
@@ -161787,14 +162017,14 @@ var init_MessageResponse = __esm(() => {
|
|
|
161787
162017
|
|
|
161788
162018
|
// src/tui/commands/add-dir/validation.ts
|
|
161789
162019
|
import { stat as stat17 } from "fs/promises";
|
|
161790
|
-
import { dirname as dirname36, resolve as
|
|
162020
|
+
import { dirname as dirname36, resolve as resolve24 } from "path";
|
|
161791
162021
|
async function validateDirectoryForWorkspace(directoryPath, permissionContext) {
|
|
161792
162022
|
if (!directoryPath) {
|
|
161793
162023
|
return {
|
|
161794
162024
|
resultType: "emptyPath"
|
|
161795
162025
|
};
|
|
161796
162026
|
}
|
|
161797
|
-
const absolutePath =
|
|
162027
|
+
const absolutePath = resolve24(expandPath2(directoryPath));
|
|
161798
162028
|
try {
|
|
161799
162029
|
const stats = await stat17(absolutePath);
|
|
161800
162030
|
if (!stats.isDirectory()) {
|
|
@@ -164223,383 +164453,6 @@ var init_frontmatterParser2 = __esm(() => {
|
|
|
164223
164453
|
FRONTMATTER_SHELLS = ["bash", "powershell"];
|
|
164224
164454
|
});
|
|
164225
164455
|
|
|
164226
|
-
// src/tui/utils/ripgrep.ts
|
|
164227
|
-
import { execFile as execFile8, spawn as spawn6 } from "child_process";
|
|
164228
|
-
import { homedir as homedir22 } from "os";
|
|
164229
|
-
import * as path16 from "path";
|
|
164230
|
-
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
164231
|
-
function ripgrepCommand2() {
|
|
164232
|
-
const config = getRipgrepConfig2();
|
|
164233
|
-
return {
|
|
164234
|
-
rgPath: config.command,
|
|
164235
|
-
rgArgs: config.args,
|
|
164236
|
-
argv0: config.argv0
|
|
164237
|
-
};
|
|
164238
|
-
}
|
|
164239
|
-
function isEagainError2(stderr) {
|
|
164240
|
-
return stderr.includes("os error 11") || stderr.includes("Resource temporarily unavailable");
|
|
164241
|
-
}
|
|
164242
|
-
function ripGrepRaw2(args, target, abortSignal, callback, singleThread = false) {
|
|
164243
|
-
const { rgPath, rgArgs, argv0 } = ripgrepCommand2();
|
|
164244
|
-
const threadArgs = singleThread ? ["-j", "1"] : [];
|
|
164245
|
-
const fullArgs = [...rgArgs, ...threadArgs, ...args, target];
|
|
164246
|
-
const defaultTimeout = getPlatform3() === "wsl" ? 60000 : 20000;
|
|
164247
|
-
const parsedSeconds = parseInt(process.env.ATLAS_GLOB_TIMEOUT_SECONDS || "", 10) || 0;
|
|
164248
|
-
const timeout = parsedSeconds > 0 ? parsedSeconds * 1000 : defaultTimeout;
|
|
164249
|
-
if (argv0) {
|
|
164250
|
-
const child = spawn6(rgPath, fullArgs, {
|
|
164251
|
-
argv0,
|
|
164252
|
-
signal: abortSignal,
|
|
164253
|
-
windowsHide: true
|
|
164254
|
-
});
|
|
164255
|
-
let stdout = "";
|
|
164256
|
-
let stderr = "";
|
|
164257
|
-
let stdoutTruncated = false;
|
|
164258
|
-
let stderrTruncated = false;
|
|
164259
|
-
child.stdout?.on("data", (data) => {
|
|
164260
|
-
if (!stdoutTruncated) {
|
|
164261
|
-
stdout += data.toString();
|
|
164262
|
-
if (stdout.length > MAX_BUFFER_SIZE2) {
|
|
164263
|
-
stdout = stdout.slice(0, MAX_BUFFER_SIZE2);
|
|
164264
|
-
stdoutTruncated = true;
|
|
164265
|
-
}
|
|
164266
|
-
}
|
|
164267
|
-
});
|
|
164268
|
-
child.stderr?.on("data", (data) => {
|
|
164269
|
-
if (!stderrTruncated) {
|
|
164270
|
-
stderr += data.toString();
|
|
164271
|
-
if (stderr.length > MAX_BUFFER_SIZE2) {
|
|
164272
|
-
stderr = stderr.slice(0, MAX_BUFFER_SIZE2);
|
|
164273
|
-
stderrTruncated = true;
|
|
164274
|
-
}
|
|
164275
|
-
}
|
|
164276
|
-
});
|
|
164277
|
-
let killTimeoutId;
|
|
164278
|
-
const timeoutId = setTimeout(() => {
|
|
164279
|
-
if (process.platform === "win32") {
|
|
164280
|
-
child.kill();
|
|
164281
|
-
} else {
|
|
164282
|
-
child.kill("SIGTERM");
|
|
164283
|
-
killTimeoutId = setTimeout((c) => c.kill("SIGKILL"), 5000, child);
|
|
164284
|
-
}
|
|
164285
|
-
}, timeout);
|
|
164286
|
-
let settled = false;
|
|
164287
|
-
child.on("close", (code, signal) => {
|
|
164288
|
-
if (settled)
|
|
164289
|
-
return;
|
|
164290
|
-
settled = true;
|
|
164291
|
-
clearTimeout(timeoutId);
|
|
164292
|
-
clearTimeout(killTimeoutId);
|
|
164293
|
-
if (code === 0 || code === 1) {
|
|
164294
|
-
callback(null, stdout, stderr);
|
|
164295
|
-
} else {
|
|
164296
|
-
const error = new Error(`ripgrep exited with code ${code}`);
|
|
164297
|
-
error.code = code ?? undefined;
|
|
164298
|
-
error.signal = signal ?? undefined;
|
|
164299
|
-
callback(error, stdout, stderr);
|
|
164300
|
-
}
|
|
164301
|
-
});
|
|
164302
|
-
child.on("error", (err) => {
|
|
164303
|
-
if (settled)
|
|
164304
|
-
return;
|
|
164305
|
-
settled = true;
|
|
164306
|
-
clearTimeout(timeoutId);
|
|
164307
|
-
clearTimeout(killTimeoutId);
|
|
164308
|
-
const error = err;
|
|
164309
|
-
callback(error, stdout, stderr);
|
|
164310
|
-
});
|
|
164311
|
-
return child;
|
|
164312
|
-
}
|
|
164313
|
-
return execFile8(rgPath, fullArgs, {
|
|
164314
|
-
maxBuffer: MAX_BUFFER_SIZE2,
|
|
164315
|
-
signal: abortSignal,
|
|
164316
|
-
timeout,
|
|
164317
|
-
killSignal: process.platform === "win32" ? undefined : "SIGKILL"
|
|
164318
|
-
}, callback);
|
|
164319
|
-
}
|
|
164320
|
-
async function ripGrepFileCount(args, target, abortSignal) {
|
|
164321
|
-
await codesignRipgrepIfNecessary();
|
|
164322
|
-
const { rgPath, rgArgs, argv0 } = ripgrepCommand2();
|
|
164323
|
-
return new Promise((resolve, reject) => {
|
|
164324
|
-
const child = spawn6(rgPath, [...rgArgs, ...args, target], {
|
|
164325
|
-
argv0,
|
|
164326
|
-
signal: abortSignal,
|
|
164327
|
-
windowsHide: true,
|
|
164328
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
164329
|
-
});
|
|
164330
|
-
let lines = 0;
|
|
164331
|
-
child.stdout?.on("data", (chunk) => {
|
|
164332
|
-
lines += countCharInString2(chunk, `
|
|
164333
|
-
`);
|
|
164334
|
-
});
|
|
164335
|
-
let settled = false;
|
|
164336
|
-
child.on("close", (code) => {
|
|
164337
|
-
if (settled)
|
|
164338
|
-
return;
|
|
164339
|
-
settled = true;
|
|
164340
|
-
if (code === 0 || code === 1)
|
|
164341
|
-
resolve(lines);
|
|
164342
|
-
else
|
|
164343
|
-
reject(new Error(`rg --files exited ${code}`));
|
|
164344
|
-
});
|
|
164345
|
-
child.on("error", (err) => {
|
|
164346
|
-
if (settled)
|
|
164347
|
-
return;
|
|
164348
|
-
settled = true;
|
|
164349
|
-
reject(err);
|
|
164350
|
-
});
|
|
164351
|
-
});
|
|
164352
|
-
}
|
|
164353
|
-
async function ripGrepStream(args, target, abortSignal, onLines) {
|
|
164354
|
-
await codesignRipgrepIfNecessary();
|
|
164355
|
-
const { rgPath, rgArgs, argv0 } = ripgrepCommand2();
|
|
164356
|
-
return new Promise((resolve, reject) => {
|
|
164357
|
-
const child = spawn6(rgPath, [...rgArgs, ...args, target], {
|
|
164358
|
-
argv0,
|
|
164359
|
-
signal: abortSignal,
|
|
164360
|
-
windowsHide: true,
|
|
164361
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
164362
|
-
});
|
|
164363
|
-
const stripCR = (l) => l.endsWith("\r") ? l.slice(0, -1) : l;
|
|
164364
|
-
let remainder = "";
|
|
164365
|
-
child.stdout?.on("data", (chunk) => {
|
|
164366
|
-
const data = remainder + chunk.toString();
|
|
164367
|
-
const lines = data.split(`
|
|
164368
|
-
`);
|
|
164369
|
-
remainder = lines.pop() ?? "";
|
|
164370
|
-
if (lines.length)
|
|
164371
|
-
onLines(lines.map(stripCR));
|
|
164372
|
-
});
|
|
164373
|
-
let settled = false;
|
|
164374
|
-
child.on("close", (code) => {
|
|
164375
|
-
if (settled)
|
|
164376
|
-
return;
|
|
164377
|
-
if (abortSignal.aborted)
|
|
164378
|
-
return;
|
|
164379
|
-
settled = true;
|
|
164380
|
-
if (code === 0 || code === 1) {
|
|
164381
|
-
if (remainder)
|
|
164382
|
-
onLines([stripCR(remainder)]);
|
|
164383
|
-
resolve();
|
|
164384
|
-
} else {
|
|
164385
|
-
reject(new Error(`ripgrep exited with code ${code}`));
|
|
164386
|
-
}
|
|
164387
|
-
});
|
|
164388
|
-
child.on("error", (err) => {
|
|
164389
|
-
if (settled)
|
|
164390
|
-
return;
|
|
164391
|
-
settled = true;
|
|
164392
|
-
reject(err);
|
|
164393
|
-
});
|
|
164394
|
-
});
|
|
164395
|
-
}
|
|
164396
|
-
async function ripGrep2(args, target, abortSignal) {
|
|
164397
|
-
await codesignRipgrepIfNecessary();
|
|
164398
|
-
testRipgrepOnFirstUse().catch((error) => {
|
|
164399
|
-
logError3(error);
|
|
164400
|
-
});
|
|
164401
|
-
return new Promise((resolve, reject) => {
|
|
164402
|
-
const handleResult = (error, stdout, stderr, isRetry) => {
|
|
164403
|
-
if (!error) {
|
|
164404
|
-
resolve(stdout.trim().split(`
|
|
164405
|
-
`).map((line) => line.replace(/\r$/, "")).filter(Boolean));
|
|
164406
|
-
return;
|
|
164407
|
-
}
|
|
164408
|
-
if (error.code === 1) {
|
|
164409
|
-
resolve([]);
|
|
164410
|
-
return;
|
|
164411
|
-
}
|
|
164412
|
-
const CRITICAL_ERROR_CODES = ["ENOENT", "EACCES", "EPERM"];
|
|
164413
|
-
if (CRITICAL_ERROR_CODES.includes(error.code)) {
|
|
164414
|
-
reject(error);
|
|
164415
|
-
return;
|
|
164416
|
-
}
|
|
164417
|
-
if (!isRetry && isEagainError2(stderr)) {
|
|
164418
|
-
logForDebugging3(`rg EAGAIN error detected, retrying with single-threaded mode (-j 1)`);
|
|
164419
|
-
ripGrepRaw2(args, target, abortSignal, (retryError, retryStdout, retryStderr) => {
|
|
164420
|
-
handleResult(retryError, retryStdout, retryStderr, true);
|
|
164421
|
-
}, true);
|
|
164422
|
-
return;
|
|
164423
|
-
}
|
|
164424
|
-
const hasOutput = stdout && stdout.trim().length > 0;
|
|
164425
|
-
const isTimeout = error.signal === "SIGTERM" || error.signal === "SIGKILL" || error.code === "ABORT_ERR";
|
|
164426
|
-
const isBufferOverflow = error.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER";
|
|
164427
|
-
let lines = [];
|
|
164428
|
-
if (hasOutput) {
|
|
164429
|
-
lines = stdout.trim().split(`
|
|
164430
|
-
`).map((line) => line.replace(/\r$/, "")).filter(Boolean);
|
|
164431
|
-
if (lines.length > 0 && (isTimeout || isBufferOverflow)) {
|
|
164432
|
-
lines = lines.slice(0, -1);
|
|
164433
|
-
}
|
|
164434
|
-
}
|
|
164435
|
-
logForDebugging3(`rg error (signal=${error.signal}, code=${error.code}, stderr: ${stderr}), ${lines.length} results`);
|
|
164436
|
-
if (error.code !== 2 && error.code !== "ABORT_ERR") {
|
|
164437
|
-
logError3(error);
|
|
164438
|
-
}
|
|
164439
|
-
if (isTimeout && lines.length === 0) {
|
|
164440
|
-
reject(new RipgrepTimeoutError2(`Ripgrep search timed out after ${getPlatform3() === "wsl" ? 60 : 20} seconds. The search may have matched files but did not complete in time. Try searching a more specific path or pattern.`, lines));
|
|
164441
|
-
return;
|
|
164442
|
-
}
|
|
164443
|
-
resolve(lines);
|
|
164444
|
-
};
|
|
164445
|
-
ripGrepRaw2(args, target, abortSignal, (error, stdout, stderr) => {
|
|
164446
|
-
handleResult(error, stdout, stderr, false);
|
|
164447
|
-
});
|
|
164448
|
-
});
|
|
164449
|
-
}
|
|
164450
|
-
function getRipgrepStatus() {
|
|
164451
|
-
const config = getRipgrepConfig2();
|
|
164452
|
-
return {
|
|
164453
|
-
mode: config.mode,
|
|
164454
|
-
path: config.command,
|
|
164455
|
-
working: ripgrepStatus?.working ?? null
|
|
164456
|
-
};
|
|
164457
|
-
}
|
|
164458
|
-
async function codesignRipgrepIfNecessary() {
|
|
164459
|
-
if (process.platform !== "darwin" || alreadyDoneSignCheck) {
|
|
164460
|
-
return;
|
|
164461
|
-
}
|
|
164462
|
-
alreadyDoneSignCheck = true;
|
|
164463
|
-
const config = getRipgrepConfig2();
|
|
164464
|
-
if (config.mode !== "builtin") {
|
|
164465
|
-
return;
|
|
164466
|
-
}
|
|
164467
|
-
const builtinPath = config.command;
|
|
164468
|
-
const lines = (await execFileNoThrow3("codesign", ["-vv", "-d", builtinPath], {
|
|
164469
|
-
preserveOutputOnError: false
|
|
164470
|
-
})).stdout.split(`
|
|
164471
|
-
`);
|
|
164472
|
-
const needsSigned = lines.find((line) => line.includes("linker-signed"));
|
|
164473
|
-
if (!needsSigned) {
|
|
164474
|
-
return;
|
|
164475
|
-
}
|
|
164476
|
-
try {
|
|
164477
|
-
const signResult = await execFileNoThrow3("codesign", [
|
|
164478
|
-
"--sign",
|
|
164479
|
-
"-",
|
|
164480
|
-
"--force",
|
|
164481
|
-
"--preserve-metadata=entitlements,requirements,flags,runtime",
|
|
164482
|
-
builtinPath
|
|
164483
|
-
]);
|
|
164484
|
-
if (signResult.code !== 0) {
|
|
164485
|
-
logError3(new Error(`Failed to sign ripgrep: ${signResult.stdout} ${signResult.stderr}`));
|
|
164486
|
-
}
|
|
164487
|
-
const quarantineResult = await execFileNoThrow3("xattr", [
|
|
164488
|
-
"-d",
|
|
164489
|
-
"com.apple.quarantine",
|
|
164490
|
-
builtinPath
|
|
164491
|
-
]);
|
|
164492
|
-
if (quarantineResult.code !== 0) {
|
|
164493
|
-
logError3(new Error(`Failed to remove quarantine: ${quarantineResult.stdout} ${quarantineResult.stderr}`));
|
|
164494
|
-
}
|
|
164495
|
-
} catch (e) {
|
|
164496
|
-
logError3(e);
|
|
164497
|
-
}
|
|
164498
|
-
}
|
|
164499
|
-
var __filename2, __dirname2, getRipgrepConfig2, MAX_BUFFER_SIZE2 = 20000000, RipgrepTimeoutError2, countFilesRoundedRg, ripgrepStatus = null, testRipgrepOnFirstUse, alreadyDoneSignCheck = false;
|
|
164500
|
-
var init_ripgrep2 = __esm(() => {
|
|
164501
|
-
init_memoize();
|
|
164502
|
-
init_debug();
|
|
164503
|
-
init_envUtils2();
|
|
164504
|
-
init_execFileNoThrow2();
|
|
164505
|
-
init_findExecutable();
|
|
164506
|
-
init_log5();
|
|
164507
|
-
init_platform3();
|
|
164508
|
-
init_stringUtils2();
|
|
164509
|
-
__filename2 = fileURLToPath3(import.meta.url);
|
|
164510
|
-
__dirname2 = path16.join(__filename2, "../");
|
|
164511
|
-
getRipgrepConfig2 = memoize_default(() => {
|
|
164512
|
-
const userWantsSystemRipgrep = isEnvDefinedFalsy2(process.env.USE_BUILTIN_RIPGREP);
|
|
164513
|
-
if (userWantsSystemRipgrep) {
|
|
164514
|
-
const { cmd: systemPath } = findExecutable2("rg", []);
|
|
164515
|
-
if (systemPath !== "rg") {
|
|
164516
|
-
return { mode: "system", command: "rg", args: [] };
|
|
164517
|
-
}
|
|
164518
|
-
}
|
|
164519
|
-
if (isInBundledMode2()) {
|
|
164520
|
-
return {
|
|
164521
|
-
mode: "embedded",
|
|
164522
|
-
command: process.execPath,
|
|
164523
|
-
args: ["--no-config"],
|
|
164524
|
-
argv0: "rg"
|
|
164525
|
-
};
|
|
164526
|
-
}
|
|
164527
|
-
const rgRoot = path16.resolve(__dirname2, "..", "vendor", "ripgrep");
|
|
164528
|
-
const command = process.platform === "win32" ? path16.resolve(rgRoot, "x86_64-win32", "rg.exe") : path16.resolve(rgRoot, "x86_64-linux", "rg");
|
|
164529
|
-
return { mode: "builtin", command, args: [] };
|
|
164530
|
-
});
|
|
164531
|
-
RipgrepTimeoutError2 = class RipgrepTimeoutError2 extends Error {
|
|
164532
|
-
partialResults;
|
|
164533
|
-
constructor(message, partialResults) {
|
|
164534
|
-
super(message);
|
|
164535
|
-
this.partialResults = partialResults;
|
|
164536
|
-
this.name = "RipgrepTimeoutError";
|
|
164537
|
-
}
|
|
164538
|
-
};
|
|
164539
|
-
countFilesRoundedRg = memoize_default(async (dirPath, abortSignal, ignorePatterns = []) => {
|
|
164540
|
-
if (path16.resolve(dirPath) === path16.resolve(homedir22())) {
|
|
164541
|
-
return;
|
|
164542
|
-
}
|
|
164543
|
-
try {
|
|
164544
|
-
const args = ["--files", "--hidden"];
|
|
164545
|
-
ignorePatterns.forEach((pattern) => {
|
|
164546
|
-
args.push("--glob", `!${pattern}`);
|
|
164547
|
-
});
|
|
164548
|
-
const count = await ripGrepFileCount(args, dirPath, abortSignal);
|
|
164549
|
-
if (count === 0)
|
|
164550
|
-
return 0;
|
|
164551
|
-
const magnitude = Math.floor(Math.log10(count));
|
|
164552
|
-
const power = Math.pow(10, magnitude);
|
|
164553
|
-
return Math.round(count / power) * power;
|
|
164554
|
-
} catch (error) {
|
|
164555
|
-
if (error?.name !== "AbortError")
|
|
164556
|
-
logError3(error);
|
|
164557
|
-
}
|
|
164558
|
-
}, (dirPath, _abortSignal, ignorePatterns = []) => `${dirPath}|${ignorePatterns.join(",")}`);
|
|
164559
|
-
testRipgrepOnFirstUse = memoize_default(async () => {
|
|
164560
|
-
if (ripgrepStatus !== null) {
|
|
164561
|
-
return;
|
|
164562
|
-
}
|
|
164563
|
-
const config = getRipgrepConfig2();
|
|
164564
|
-
try {
|
|
164565
|
-
let test;
|
|
164566
|
-
if (config.argv0) {
|
|
164567
|
-
const proc = Bun.spawn([config.command, "--version"], {
|
|
164568
|
-
argv0: config.argv0,
|
|
164569
|
-
stderr: "ignore",
|
|
164570
|
-
stdout: "pipe"
|
|
164571
|
-
});
|
|
164572
|
-
const [stdout, code] = await Promise.all([
|
|
164573
|
-
proc.stdout.text(),
|
|
164574
|
-
proc.exited
|
|
164575
|
-
]);
|
|
164576
|
-
test = {
|
|
164577
|
-
code,
|
|
164578
|
-
stdout
|
|
164579
|
-
};
|
|
164580
|
-
} else {
|
|
164581
|
-
test = await execFileNoThrow3(config.command, [...config.args, "--version"], {
|
|
164582
|
-
timeout: 5000
|
|
164583
|
-
});
|
|
164584
|
-
}
|
|
164585
|
-
const working = test.code === 0 && !!test.stdout && test.stdout.startsWith("ripgrep ");
|
|
164586
|
-
ripgrepStatus = {
|
|
164587
|
-
working,
|
|
164588
|
-
lastTested: Date.now(),
|
|
164589
|
-
config
|
|
164590
|
-
};
|
|
164591
|
-
logForDebugging3(`Ripgrep first use test: ${working ? "PASSED" : "FAILED"} (mode=${config.mode}, path=${config.command})`);
|
|
164592
|
-
} catch (error) {
|
|
164593
|
-
ripgrepStatus = {
|
|
164594
|
-
working: false,
|
|
164595
|
-
lastTested: Date.now(),
|
|
164596
|
-
config
|
|
164597
|
-
};
|
|
164598
|
-
logError3(error);
|
|
164599
|
-
}
|
|
164600
|
-
});
|
|
164601
|
-
});
|
|
164602
|
-
|
|
164603
164456
|
// src/tui/utils/settings/pluginOnlyPolicy.ts
|
|
164604
164457
|
function isRestrictedToPluginOnly(surface) {
|
|
164605
164458
|
const policy = getSettingsForSource2("policySettings")?.strictPluginOnlyCustomization;
|
|
@@ -164802,7 +164655,7 @@ async function loadMarkdownFiles2(dir) {
|
|
|
164802
164655
|
const signal = AbortSignal.timeout(3000);
|
|
164803
164656
|
let files;
|
|
164804
164657
|
try {
|
|
164805
|
-
files = useNative ? await findMarkdownFilesNative2(dir, signal) : await
|
|
164658
|
+
files = useNative ? await findMarkdownFilesNative2(dir, signal) : await ripGrep(["--files", "--hidden", "--follow", "--no-ignore", "--glob", "*.md"], dir, signal);
|
|
164806
164659
|
} catch (e) {
|
|
164807
164660
|
if (isFsInaccessible2(e))
|
|
164808
164661
|
return [];
|
|
@@ -164838,7 +164691,7 @@ var init_markdownConfigLoader = __esm(() => {
|
|
|
164838
164691
|
init_frontmatterParser2();
|
|
164839
164692
|
init_git2();
|
|
164840
164693
|
init_permissionSetup2();
|
|
164841
|
-
|
|
164694
|
+
init_sandboxCompat();
|
|
164842
164695
|
init_constants5();
|
|
164843
164696
|
init_managedPath2();
|
|
164844
164697
|
init_pluginOnlyPolicy();
|
|
@@ -166939,26 +166792,6 @@ var init_fetchTelemetry = __esm(() => {
|
|
|
166939
166792
|
]);
|
|
166940
166793
|
});
|
|
166941
166794
|
|
|
166942
|
-
// src/tui/utils/plugins/gitAvailability.ts
|
|
166943
|
-
async function isCommandAvailable2(command) {
|
|
166944
|
-
try {
|
|
166945
|
-
return !!await which(command);
|
|
166946
|
-
} catch {
|
|
166947
|
-
return false;
|
|
166948
|
-
}
|
|
166949
|
-
}
|
|
166950
|
-
function markGitUnavailable() {
|
|
166951
|
-
checkGitAvailable.cache?.set?.(undefined, Promise.resolve(false));
|
|
166952
|
-
}
|
|
166953
|
-
var checkGitAvailable;
|
|
166954
|
-
var init_gitAvailability = __esm(() => {
|
|
166955
|
-
init_memoize();
|
|
166956
|
-
init_which();
|
|
166957
|
-
checkGitAvailable = memoize_default(async () => {
|
|
166958
|
-
return isCommandAvailable2("git");
|
|
166959
|
-
});
|
|
166960
|
-
});
|
|
166961
|
-
|
|
166962
166795
|
// src/tui/utils/shell/readOnlyCommandValidation.ts
|
|
166963
166796
|
function containsVulnerableUncPath2(pathOrCommand) {
|
|
166964
166797
|
if (getPlatform3() !== "windows") {
|
|
@@ -188884,7 +188717,7 @@ var init_utils5 = __esm(() => {
|
|
|
188884
188717
|
});
|
|
188885
188718
|
|
|
188886
188719
|
// src/tui/components/design-system/beamTheme.ts
|
|
188887
|
-
function beamDividerLine(width, pattern = "
|
|
188720
|
+
function beamDividerLine(width, pattern = "━") {
|
|
188888
188721
|
if (width <= 0)
|
|
188889
188722
|
return "";
|
|
188890
188723
|
const reps = Math.ceil(width / pattern.length);
|
|
@@ -197167,8 +197000,8 @@ function Divider(t0) {
|
|
|
197167
197000
|
let t7;
|
|
197168
197001
|
if ($[8] !== color || $[9] !== t3 || $[10] !== t4 || $[11] !== t5 || $[12] !== t6) {
|
|
197169
197002
|
t7 = /* @__PURE__ */ jsx_dev_runtime32.jsxDEV(ThemedText, {
|
|
197170
|
-
color,
|
|
197171
|
-
dimColor:
|
|
197003
|
+
color: color ?? "brandShimmer",
|
|
197004
|
+
dimColor: false,
|
|
197172
197005
|
children: [
|
|
197173
197006
|
t4,
|
|
197174
197007
|
" ",
|
|
@@ -197201,8 +197034,8 @@ function Divider(t0) {
|
|
|
197201
197034
|
let t5;
|
|
197202
197035
|
if ($[17] !== color || $[18] !== t3 || $[19] !== t4) {
|
|
197203
197036
|
t5 = /* @__PURE__ */ jsx_dev_runtime32.jsxDEV(ThemedText, {
|
|
197204
|
-
color,
|
|
197205
|
-
dimColor:
|
|
197037
|
+
color: color ?? "brandShimmer",
|
|
197038
|
+
dimColor: false,
|
|
197206
197039
|
children: t4
|
|
197207
197040
|
}, undefined, false, undefined, this);
|
|
197208
197041
|
$[17] = color;
|
|
@@ -199071,10 +198904,10 @@ function parseProxyResponse(socket) {
|
|
|
199071
198904
|
read();
|
|
199072
198905
|
});
|
|
199073
198906
|
}
|
|
199074
|
-
var
|
|
198907
|
+
var import_debug52, debug;
|
|
199075
198908
|
var init_parse_proxy_response = __esm(() => {
|
|
199076
|
-
|
|
199077
|
-
debug =
|
|
198909
|
+
import_debug52 = __toESM(require_src(), 1);
|
|
198910
|
+
debug = import_debug52.default("https-proxy-agent:parse-proxy-response");
|
|
199078
198911
|
});
|
|
199079
198912
|
|
|
199080
198913
|
// node_modules/proxy-agent-negotiate/dist/index.js
|
|
@@ -199127,7 +198960,7 @@ function omit2(obj, ...keys) {
|
|
|
199127
198960
|
}
|
|
199128
198961
|
return ret;
|
|
199129
198962
|
}
|
|
199130
|
-
var
|
|
198963
|
+
var import_debug53, debug2, setServernameFromNonIpHost = (options) => {
|
|
199131
198964
|
if (options.servername === undefined && options.host && !net2.isIP(options.host)) {
|
|
199132
198965
|
return {
|
|
199133
198966
|
...options,
|
|
@@ -199139,8 +198972,8 @@ var import_debug54, debug2, setServernameFromNonIpHost = (options) => {
|
|
|
199139
198972
|
var init_dist7 = __esm(() => {
|
|
199140
198973
|
init_dist6();
|
|
199141
198974
|
init_parse_proxy_response();
|
|
199142
|
-
|
|
199143
|
-
debug2 =
|
|
198975
|
+
import_debug53 = __toESM(require_src(), 1);
|
|
198976
|
+
debug2 = import_debug53.default("https-proxy-agent");
|
|
199144
198977
|
HttpsProxyAgent2 = class HttpsProxyAgent2 extends Agent2 {
|
|
199145
198978
|
constructor(proxy, opts) {
|
|
199146
198979
|
super(opts);
|
|
@@ -214390,7 +214223,7 @@ var init_LSPServerManager = __esm(() => {
|
|
|
214390
214223
|
});
|
|
214391
214224
|
|
|
214392
214225
|
// src/tui/services/lsp/passiveFeedback.ts
|
|
214393
|
-
import { fileURLToPath as
|
|
214226
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
214394
214227
|
function mapLSPSeverity(lspSeverity) {
|
|
214395
214228
|
switch (lspSeverity) {
|
|
214396
214229
|
case 1:
|
|
@@ -214408,7 +214241,7 @@ function mapLSPSeverity(lspSeverity) {
|
|
|
214408
214241
|
function formatDiagnosticsForAttachment2(params) {
|
|
214409
214242
|
let uri;
|
|
214410
214243
|
try {
|
|
214411
|
-
uri = params.uri.startsWith("file://") ?
|
|
214244
|
+
uri = params.uri.startsWith("file://") ? fileURLToPath3(params.uri) : params.uri;
|
|
214412
214245
|
} catch (error) {
|
|
214413
214246
|
const err = toError2(error);
|
|
214414
214247
|
logError3(err);
|
|
@@ -252206,7 +252039,7 @@ async function getGlobExclusionsForPluginCache(searchPath) {
|
|
|
252206
252039
|
return cachedExclusions;
|
|
252207
252040
|
}
|
|
252208
252041
|
try {
|
|
252209
|
-
const markers = await
|
|
252042
|
+
const markers = await ripGrep([
|
|
252210
252043
|
"--files",
|
|
252211
252044
|
"--hidden",
|
|
252212
252045
|
"--no-ignore",
|
|
@@ -252241,7 +252074,7 @@ function normalizeForCompare(p) {
|
|
|
252241
252074
|
}
|
|
252242
252075
|
var ORPHANED_AT_FILENAME = ".orphaned_at", cachedExclusions = null;
|
|
252243
252076
|
var init_orphanedPluginFilter = __esm(() => {
|
|
252244
|
-
|
|
252077
|
+
init_sandboxCompat();
|
|
252245
252078
|
init_pluginDirectories();
|
|
252246
252079
|
});
|
|
252247
252080
|
|
|
@@ -252296,7 +252129,7 @@ async function glob2(filePattern, cwd, { limit, offset }, abortSignal, toolPermi
|
|
|
252296
252129
|
for (const exclusion of await getGlobExclusionsForPluginCache(searchDir)) {
|
|
252297
252130
|
args.push("--glob", exclusion);
|
|
252298
252131
|
}
|
|
252299
|
-
const allPaths = await
|
|
252132
|
+
const allPaths = await ripGrep(args, searchDir, abortSignal);
|
|
252300
252133
|
const absolutePaths = allPaths.map((p) => isAbsolute22(p) ? p : join93(searchDir, p));
|
|
252301
252134
|
const truncated = absolutePaths.length > offset + limit;
|
|
252302
252135
|
const files = absolutePaths.slice(offset, offset + limit);
|
|
@@ -252307,7 +252140,7 @@ var init_glob = __esm(() => {
|
|
|
252307
252140
|
init_filesystem2();
|
|
252308
252141
|
init_platform3();
|
|
252309
252142
|
init_orphanedPluginFilter();
|
|
252310
|
-
|
|
252143
|
+
init_sandboxCompat();
|
|
252311
252144
|
});
|
|
252312
252145
|
|
|
252313
252146
|
// src/tui/utils/semanticNumber.ts
|
|
@@ -252617,7 +252450,7 @@ var init_GrepTool = __esm(() => {
|
|
|
252617
252450
|
init_filesystem2();
|
|
252618
252451
|
init_shellRuleMatching2();
|
|
252619
252452
|
init_orphanedPluginFilter();
|
|
252620
|
-
|
|
252453
|
+
init_sandboxCompat();
|
|
252621
252454
|
init_semanticBoolean();
|
|
252622
252455
|
init_semanticNumber();
|
|
252623
252456
|
init_stringUtils2();
|
|
@@ -252874,7 +252707,7 @@ ${filenames.join(`
|
|
|
252874
252707
|
for (const exclusion of await getGlobExclusionsForPluginCache(absolutePath)) {
|
|
252875
252708
|
args.push("--glob", exclusion);
|
|
252876
252709
|
}
|
|
252877
|
-
const results = await
|
|
252710
|
+
const results = await ripGrep(args, absolutePath, abortController.signal);
|
|
252878
252711
|
if (output_mode === "content") {
|
|
252879
252712
|
const { items: limitedResults, appliedLimit } = applyHeadLimit2(results, head_limit, offset);
|
|
252880
252713
|
const finalLines = limitedResults.map((line) => {
|
|
@@ -257057,7 +256890,7 @@ var init_bashPipeCommand = __esm(() => {
|
|
|
257057
256890
|
});
|
|
257058
256891
|
|
|
257059
256892
|
// src/tui/utils/bash/ShellSnapshot.ts
|
|
257060
|
-
import { execFile as
|
|
256893
|
+
import { execFile as execFile8 } from "child_process";
|
|
257061
256894
|
import { mkdir as mkdir26, stat as stat31 } from "fs/promises";
|
|
257062
256895
|
import * as os4 from "os";
|
|
257063
256896
|
import { join as join97 } from "path";
|
|
@@ -257080,7 +256913,7 @@ function createArgv0ShellFunction(funcName, argv0, binaryPath, prependArgs = [])
|
|
|
257080
256913
|
`);
|
|
257081
256914
|
}
|
|
257082
256915
|
function createRipgrepShellIntegration() {
|
|
257083
|
-
const rgCommand =
|
|
256916
|
+
const rgCommand = ripgrepCommand();
|
|
257084
256917
|
if (rgCommand.argv0) {
|
|
257085
256918
|
return {
|
|
257086
256919
|
type: "function",
|
|
@@ -257277,7 +257110,7 @@ var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_T
|
|
|
257277
257110
|
const snapshotScript = await getSnapshotScript(binShell, shellSnapshotPath, configFileExists);
|
|
257278
257111
|
logForDebugging3(`Creating snapshot at: ${shellSnapshotPath}`);
|
|
257279
257112
|
logForDebugging3(`Execution timeout: ${SNAPSHOT_CREATION_TIMEOUT}ms`);
|
|
257280
|
-
|
|
257113
|
+
execFile8(binShell, ["-c", "-l", snapshotScript], {
|
|
257281
257114
|
env: {
|
|
257282
257115
|
...process.env.ATLAS_DONT_INHERIT_ENV ? {} : subprocessEnv(),
|
|
257283
257116
|
SHELL: binShell,
|
|
@@ -257366,7 +257199,7 @@ var init_ShellSnapshot = __esm(() => {
|
|
|
257366
257199
|
init_fsOperations();
|
|
257367
257200
|
init_log5();
|
|
257368
257201
|
init_platform3();
|
|
257369
|
-
|
|
257202
|
+
init_sandboxCompat();
|
|
257370
257203
|
init_subprocessEnv();
|
|
257371
257204
|
init_shellQuote2();
|
|
257372
257205
|
VCS_DIRECTORIES_TO_EXCLUDE3 = [
|
|
@@ -319846,7 +319679,7 @@ var init_api2 = __esm(() => {
|
|
|
319846
319679
|
init_filesystem2();
|
|
319847
319680
|
init_plans();
|
|
319848
319681
|
init_platform3();
|
|
319849
|
-
|
|
319682
|
+
init_sandboxCompat();
|
|
319850
319683
|
init_slowOperations();
|
|
319851
319684
|
init_toolSchemaCache();
|
|
319852
319685
|
init_windowsPaths2();
|
|
@@ -329592,13 +329425,19 @@ function classifyGcsError(e) {
|
|
|
329592
329425
|
return "empty_latest";
|
|
329593
329426
|
return "other";
|
|
329594
329427
|
}
|
|
329595
|
-
var
|
|
329428
|
+
var DEFAULT_GCS_BASE = "https://downloads.claude.ai/claude-code-releases/plugins/claude-plugins-official", GCS_BASE, ARC_PREFIX = "marketplaces/claude-plugins-official/", KNOWN_FS_CODES;
|
|
329596
329429
|
var init_officialMarketplaceGcs = __esm(() => {
|
|
329597
329430
|
init_axios2();
|
|
329598
329431
|
init_bootstrapState();
|
|
329599
329432
|
init_debug();
|
|
329600
329433
|
init_zip();
|
|
329601
329434
|
init_errors4();
|
|
329435
|
+
GCS_BASE = (() => {
|
|
329436
|
+
const mirror = (process.env["ATLAS_OFFICIAL_MKT_MIRROR"] ?? "").trim();
|
|
329437
|
+
if (!mirror)
|
|
329438
|
+
return DEFAULT_GCS_BASE;
|
|
329439
|
+
return mirror.replace(/\/+$/, "");
|
|
329440
|
+
})();
|
|
329602
329441
|
KNOWN_FS_CODES = new Set([
|
|
329603
329442
|
"ENOSPC",
|
|
329604
329443
|
"EACCES",
|
|
@@ -345301,7 +345140,7 @@ async function getProjectFiles(abortSignal, respectGitignore) {
|
|
|
345301
345140
|
if (!respectGitignore) {
|
|
345302
345141
|
rgArgs.push("--no-ignore-vcs");
|
|
345303
345142
|
}
|
|
345304
|
-
const files = await
|
|
345143
|
+
const files = await ripGrep(rgArgs, ".", abortSignal);
|
|
345305
345144
|
const relativePaths = files.map((f) => path21.relative(getCwd(), f));
|
|
345306
345145
|
const duration = Date.now() - startTime;
|
|
345307
345146
|
logForDebugging3(`[FileIndex] ripgrep: ${relativePaths.length} files in ${duration}ms`);
|
|
@@ -345475,7 +345314,7 @@ var init_fileSuggestions = __esm(() => {
|
|
|
345475
345314
|
init_hooks7();
|
|
345476
345315
|
init_log5();
|
|
345477
345316
|
init_path3();
|
|
345478
|
-
|
|
345317
|
+
init_sandboxCompat();
|
|
345479
345318
|
init_settings3();
|
|
345480
345319
|
import_ignore3 = __toESM(require_ignore(), 1);
|
|
345481
345320
|
indexBuildComplete = createSignal3();
|
|
@@ -349011,7 +348850,7 @@ async function getDoctorDiagnostic() {
|
|
|
349011
348850
|
const ripgrepStatus = {
|
|
349012
348851
|
working: ripgrepStatusRaw.working ?? true,
|
|
349013
348852
|
mode: ripgrepStatusRaw.mode,
|
|
349014
|
-
systemPath: ripgrepStatusRaw.mode === "
|
|
348853
|
+
systemPath: ripgrepStatusRaw.mode === "missing" ? null : ripgrepStatusRaw.path
|
|
349015
348854
|
};
|
|
349016
348855
|
const packageManager = installationType === "package-manager" ? await getPackageManager() : undefined;
|
|
349017
348856
|
const diagnostic = {
|
|
@@ -349044,7 +348883,7 @@ var init_doctorDiagnostic = __esm(() => {
|
|
|
349044
348883
|
init_localInstaller();
|
|
349045
348884
|
init_packageManagers();
|
|
349046
348885
|
init_platform3();
|
|
349047
|
-
|
|
348886
|
+
init_sandboxCompat();
|
|
349048
348887
|
init_sandboxCompat();
|
|
349049
348888
|
init_managedPath2();
|
|
349050
348889
|
init_types7();
|
|
@@ -359492,7 +359331,7 @@ function Doctor(t0) {
|
|
|
359492
359331
|
t15 = $[28];
|
|
359493
359332
|
}
|
|
359494
359333
|
const t16 = diagnostic.ripgrepStatus.working ? "OK" : "Not working";
|
|
359495
|
-
const t17 = diagnostic.ripgrepStatus.mode === "
|
|
359334
|
+
const t17 = diagnostic.ripgrepStatus.mode === "missing" ? "missing" : diagnostic.ripgrepStatus.mode === "bundled" ? "bundled (@vscode/ripgrep)" : diagnostic.ripgrepStatus.systemPath || "system";
|
|
359496
359335
|
let t18;
|
|
359497
359336
|
if ($[29] !== t16 || $[30] !== t17) {
|
|
359498
359337
|
t18 = /* @__PURE__ */ jsx_dev_runtime168.jsxDEV(ThemedText, {
|
|
@@ -374016,7 +373855,7 @@ var init_promptOverlayContext = __esm(() => {
|
|
|
374016
373855
|
});
|
|
374017
373856
|
|
|
374018
373857
|
// src/tui/components/FullscreenLayout.tsx
|
|
374019
|
-
import { fileURLToPath as
|
|
373858
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
374020
373859
|
function useUnseenDivider(messageCount) {
|
|
374021
373860
|
const [dividerIndex, setDividerIndex] = import_react125.useState(null);
|
|
374022
373861
|
const countRef = import_react125.useRef(messageCount);
|
|
@@ -374401,7 +374240,7 @@ function _temp326() {
|
|
|
374401
374240
|
function _temp238(url) {
|
|
374402
374241
|
if (url.startsWith("file:")) {
|
|
374403
374242
|
try {
|
|
374404
|
-
openPath(
|
|
374243
|
+
openPath(fileURLToPath4(url));
|
|
374405
374244
|
} catch {}
|
|
374406
374245
|
} else {
|
|
374407
374246
|
openBrowser(url);
|
|
@@ -430598,7 +430437,7 @@ var init_contextHostWiring = __esm(() => {
|
|
|
430598
430437
|
});
|
|
430599
430438
|
|
|
430600
430439
|
// src/tui/core/executor/AscendFreshnessPort.ts
|
|
430601
|
-
import { readFileSync as readFileSync22, existsSync as
|
|
430440
|
+
import { readFileSync as readFileSync22, existsSync as existsSync12 } from "fs";
|
|
430602
430441
|
import { join as join165, dirname as dirname77 } from "path";
|
|
430603
430442
|
|
|
430604
430443
|
class DefaultAscendFreshnessPort {
|
|
@@ -430613,7 +430452,7 @@ class DefaultAscendFreshnessPort {
|
|
|
430613
430452
|
return env;
|
|
430614
430453
|
let dir = dirname77(new URL(import.meta.url).pathname);
|
|
430615
430454
|
for (let i = 0;i < MAX_WALK_UP; i++) {
|
|
430616
|
-
if (
|
|
430455
|
+
if (existsSync12(join165(dir, "package.json")))
|
|
430617
430456
|
return join165(dir, ".freshness-cache.json");
|
|
430618
430457
|
const parent = dirname77(dir);
|
|
430619
430458
|
if (parent === dir)
|
|
@@ -430630,7 +430469,7 @@ class DefaultAscendFreshnessPort {
|
|
|
430630
430469
|
return this.cache;
|
|
430631
430470
|
}
|
|
430632
430471
|
const p = this.resolveCachePath();
|
|
430633
|
-
if (!p || !
|
|
430472
|
+
if (!p || !existsSync12(p)) {
|
|
430634
430473
|
this.cache = null;
|
|
430635
430474
|
return null;
|
|
430636
430475
|
}
|
|
@@ -454615,7 +454454,7 @@ var init_GlobalSearchDialog = __esm(() => {
|
|
|
454615
454454
|
init_highlightMatch();
|
|
454616
454455
|
init_filesystem2();
|
|
454617
454456
|
init_readFileInRange2();
|
|
454618
|
-
|
|
454457
|
+
init_sandboxCompat();
|
|
454619
454458
|
init_FuzzyPicker();
|
|
454620
454459
|
init_LoadingState();
|
|
454621
454460
|
import_compiler_runtime288 = __toESM(require_compiler_runtime(), 1);
|
|
@@ -457951,7 +457790,7 @@ var init_segments = __esm(() => {
|
|
|
457951
457790
|
});
|
|
457952
457791
|
|
|
457953
457792
|
// src/tui/components/StatusLine/segments/statusLineConfig.ts
|
|
457954
|
-
import { readFileSync as readFileSync23, existsSync as
|
|
457793
|
+
import { readFileSync as readFileSync23, existsSync as existsSync13, writeFileSync as writeFileSync9, renameSync as renameSync3, mkdirSync as mkdirSync9 } from "fs";
|
|
457955
457794
|
import { join as join168 } from "path";
|
|
457956
457795
|
import { homedir as homedir41 } from "os";
|
|
457957
457796
|
function getStatusLineJsonPath() {
|
|
@@ -457972,7 +457811,7 @@ function loadStatusLineConfig() {
|
|
|
457972
457811
|
}
|
|
457973
457812
|
const path = getStatusLineJsonPath();
|
|
457974
457813
|
let result;
|
|
457975
|
-
if (!
|
|
457814
|
+
if (!existsSync13(path)) {
|
|
457976
457815
|
result = { config: getDefaultConfig(), degraded: false };
|
|
457977
457816
|
} else {
|
|
457978
457817
|
try {
|
|
@@ -469536,6 +469375,9 @@ function calculateNextRetryDelay(retryCount) {
|
|
|
469536
469375
|
const delay = RETRY_CONFIG.INITIAL_DELAY_MS * Math.pow(RETRY_CONFIG.BACKOFF_MULTIPLIER, retryCount);
|
|
469537
469376
|
return Math.min(delay, RETRY_CONFIG.MAX_DELAY_MS);
|
|
469538
469377
|
}
|
|
469378
|
+
function isRetryBackoffGateEnabled() {
|
|
469379
|
+
return isEnvTruthy2(process.env.ATLAS_ENABLE_OFFICIAL_MKT_RETRY_BACKOFF);
|
|
469380
|
+
}
|
|
469539
469381
|
function shouldRetryInstallation(config) {
|
|
469540
469382
|
if (!config.officialMarketplaceAutoInstallAttempted) {
|
|
469541
469383
|
return true;
|
|
@@ -469543,20 +469385,22 @@ function shouldRetryInstallation(config) {
|
|
|
469543
469385
|
if (config.officialMarketplaceAutoInstalled) {
|
|
469544
469386
|
return false;
|
|
469545
469387
|
}
|
|
469546
|
-
|
|
469388
|
+
if (config.officialMarketplaceAutoInstallFailReason === "policy_blocked") {
|
|
469389
|
+
return false;
|
|
469390
|
+
}
|
|
469391
|
+
if (!isRetryBackoffGateEnabled()) {
|
|
469392
|
+
return true;
|
|
469393
|
+
}
|
|
469547
469394
|
const retryCount = config.officialMarketplaceAutoInstallRetryCount || 0;
|
|
469548
469395
|
const nextRetryTime = config.officialMarketplaceAutoInstallNextRetryTime;
|
|
469549
469396
|
const now = Date.now();
|
|
469550
469397
|
if (retryCount >= RETRY_CONFIG.MAX_ATTEMPTS) {
|
|
469551
469398
|
return false;
|
|
469552
469399
|
}
|
|
469553
|
-
if (failReason === "policy_blocked") {
|
|
469554
|
-
return false;
|
|
469555
|
-
}
|
|
469556
469400
|
if (nextRetryTime && now < nextRetryTime) {
|
|
469557
469401
|
return false;
|
|
469558
469402
|
}
|
|
469559
|
-
return
|
|
469403
|
+
return config.officialMarketplaceAutoInstallFailReason === "unknown" || config.officialMarketplaceAutoInstallFailReason === "git_unavailable" || config.officialMarketplaceAutoInstallFailReason === "gcs_unavailable" || config.officialMarketplaceAutoInstallFailReason === undefined;
|
|
469560
469404
|
}
|
|
469561
469405
|
async function checkAndInstallOfficialMarketplace() {
|
|
469562
469406
|
const config = getGlobalConfig();
|
|
@@ -469776,19 +469620,39 @@ async function _temp179() {
|
|
|
469776
469620
|
priority: "immediate",
|
|
469777
469621
|
timeoutMs: 7000
|
|
469778
469622
|
});
|
|
469779
|
-
} else {
|
|
469780
|
-
|
|
469781
|
-
|
|
469782
|
-
|
|
469783
|
-
|
|
469784
|
-
|
|
469785
|
-
|
|
469786
|
-
|
|
469787
|
-
|
|
469788
|
-
|
|
469789
|
-
|
|
469790
|
-
|
|
469791
|
-
|
|
469623
|
+
} else if (result.skipped && result.reason === "git_unavailable") {
|
|
469624
|
+
logForDebugging3("Showing marketplace git_unavailable notification");
|
|
469625
|
+
notifs.push({
|
|
469626
|
+
key: "marketplace-git-unavailable",
|
|
469627
|
+
jsx: /* @__PURE__ */ jsx_dev_runtime408.jsxDEV(ThemedText, {
|
|
469628
|
+
color: "warning",
|
|
469629
|
+
children: "官方插件源未就绪 · git 缺失或未在 PATH(安装 Git for Windows 并加入 PATH)· 下次启动自动重试"
|
|
469630
|
+
}, undefined, false, undefined, this),
|
|
469631
|
+
priority: "immediate",
|
|
469632
|
+
timeoutMs: 1e4
|
|
469633
|
+
});
|
|
469634
|
+
} else if (result.skipped && result.reason === "gcs_unavailable") {
|
|
469635
|
+
logForDebugging3("Showing marketplace gcs_unavailable notification");
|
|
469636
|
+
notifs.push({
|
|
469637
|
+
key: "marketplace-gcs-unavailable",
|
|
469638
|
+
jsx: /* @__PURE__ */ jsx_dev_runtime408.jsxDEV(ThemedText, {
|
|
469639
|
+
color: "warning",
|
|
469640
|
+
children: "官方插件源未就绪 · 镜像不可达(设 ATLAS_OFFICIAL_MKT_MIRROR 指向内网镜像,或安装 git 走 git 源)· 下次启动自动重试"
|
|
469641
|
+
}, undefined, false, undefined, this),
|
|
469642
|
+
priority: "immediate",
|
|
469643
|
+
timeoutMs: 1e4
|
|
469644
|
+
});
|
|
469645
|
+
} else if (result.skipped && result.reason === "unknown") {
|
|
469646
|
+
logForDebugging3("Showing marketplace installation failure notification");
|
|
469647
|
+
notifs.push({
|
|
469648
|
+
key: "marketplace-install-failed",
|
|
469649
|
+
jsx: /* @__PURE__ */ jsx_dev_runtime408.jsxDEV(ThemedText, {
|
|
469650
|
+
color: "warning",
|
|
469651
|
+
children: "Failed to install marketplace · Will retry on next startup"
|
|
469652
|
+
}, undefined, false, undefined, this),
|
|
469653
|
+
priority: "immediate",
|
|
469654
|
+
timeoutMs: 8000
|
|
469655
|
+
});
|
|
469792
469656
|
}
|
|
469793
469657
|
return notifs;
|
|
469794
469658
|
}
|
|
@@ -469917,6 +469781,20 @@ function useAscendMarketplaceNotification() {
|
|
|
469917
469781
|
priority: "immediate",
|
|
469918
469782
|
timeoutMs: 7000
|
|
469919
469783
|
});
|
|
469784
|
+
} else if (result.skipped && result.reason === "git_unavailable") {
|
|
469785
|
+
logForDebugging3("Showing Ascend marketplace git_unavailable notification");
|
|
469786
|
+
notifs.push({
|
|
469787
|
+
key: "ascend-marketplace-git-unavailable",
|
|
469788
|
+
jsx: /* @__PURE__ */ jsx_dev_runtime409.jsxDEV(ThemedText, {
|
|
469789
|
+
color: "warning",
|
|
469790
|
+
children: [
|
|
469791
|
+
ASCEND_OFFICIAL_DISPLAY_LABEL,
|
|
469792
|
+
" 源未就绪 · git 缺失(安装 Git 并加入 PATH)· 下次启动自动重试"
|
|
469793
|
+
]
|
|
469794
|
+
}, undefined, true, undefined, this),
|
|
469795
|
+
priority: "immediate",
|
|
469796
|
+
timeoutMs: 1e4
|
|
469797
|
+
});
|
|
469920
469798
|
} else if (result.skipped && result.reason === "unknown") {
|
|
469921
469799
|
logForDebugging3("Showing Ascend marketplace installation failure notification");
|
|
469922
469800
|
notifs.push({
|
|
@@ -469986,6 +469864,20 @@ function useAtlasMarketplaceNotification() {
|
|
|
469986
469864
|
priority: "immediate",
|
|
469987
469865
|
timeoutMs: 7000
|
|
469988
469866
|
});
|
|
469867
|
+
} else if (result.skipped && result.reason === "git_unavailable") {
|
|
469868
|
+
logForDebugging3("Showing Atlas marketplace git_unavailable notification");
|
|
469869
|
+
notifs.push({
|
|
469870
|
+
key: "atlas-marketplace-git-unavailable",
|
|
469871
|
+
jsx: /* @__PURE__ */ jsx_dev_runtime410.jsxDEV(ThemedText, {
|
|
469872
|
+
color: "warning",
|
|
469873
|
+
children: [
|
|
469874
|
+
ATLAS_MARKETPLACE_DISPLAY_LABEL,
|
|
469875
|
+
" 源未就绪 · git 缺失(安装 Git 并 加入 PATH)· 下次启动自动重试"
|
|
469876
|
+
]
|
|
469877
|
+
}, undefined, true, undefined, this),
|
|
469878
|
+
priority: "immediate",
|
|
469879
|
+
timeoutMs: 1e4
|
|
469880
|
+
});
|
|
469989
469881
|
} else if (result.skipped && result.reason === "unknown") {
|
|
469990
469882
|
logForDebugging3("Showing Atlas marketplace installation failure notification");
|
|
469991
469883
|
notifs.push({
|
|
@@ -472895,12 +472787,12 @@ var init_DevBar = __esm(() => {
|
|
|
472895
472787
|
});
|
|
472896
472788
|
|
|
472897
472789
|
// src/tui/screens/SessionTreeScreen.tsx
|
|
472898
|
-
import { readFileSync as readFileSync24, existsSync as
|
|
472790
|
+
import { readFileSync as readFileSync24, existsSync as existsSync14 } from "fs";
|
|
472899
472791
|
function getSessionFileMeta(log) {
|
|
472900
472792
|
if (!log.isLite && log.messageCount > 0) {
|
|
472901
472793
|
return { isBranch: checkBranchFromFile(log.fullPath), messageCount: log.messageCount };
|
|
472902
472794
|
}
|
|
472903
|
-
if (!log.fullPath || !
|
|
472795
|
+
if (!log.fullPath || !existsSync14(log.fullPath)) {
|
|
472904
472796
|
return { isBranch: false, messageCount: log.messageCount ?? 0 };
|
|
472905
472797
|
}
|
|
472906
472798
|
try {
|
|
@@ -472925,7 +472817,7 @@ function getSessionFileMeta(log) {
|
|
|
472925
472817
|
}
|
|
472926
472818
|
}
|
|
472927
472819
|
function checkBranchFromFile(fullPath) {
|
|
472928
|
-
if (!fullPath || !
|
|
472820
|
+
if (!fullPath || !existsSync14(fullPath))
|
|
472929
472821
|
return false;
|
|
472930
472822
|
try {
|
|
472931
472823
|
const firstLine = readFileSync24(fullPath, "utf-8").split(`
|
|
@@ -485836,11 +485728,11 @@ var init_sinks = __esm(() => {
|
|
|
485836
485728
|
|
|
485837
485729
|
// src/tui/utils/computerUse/setup.ts
|
|
485838
485730
|
import { join as join181 } from "path";
|
|
485839
|
-
import { fileURLToPath as
|
|
485731
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
485840
485732
|
function setupComputerUseMCP() {
|
|
485841
485733
|
const allowedTools = buildComputerUseTools(CLI_CU_CAPABILITIES, getChicagoCoordinateMode()).map((t) => buildMcpToolName3(COMPUTER_USE_MCP_SERVER_NAME, t.name));
|
|
485842
485734
|
const args = isInBundledMode2() ? ["--computer-use-mcp"] : [
|
|
485843
|
-
join181(
|
|
485735
|
+
join181(fileURLToPath5(import.meta.url), "..", "cli.js"),
|
|
485844
485736
|
"--computer-use-mcp"
|
|
485845
485737
|
];
|
|
485846
485738
|
return {
|
|
@@ -487730,7 +487622,7 @@ var init_marketplacePublish = __esm(() => {
|
|
|
487730
487622
|
|
|
487731
487623
|
// src/tui/utils/plugins/marketplaceScaffold.ts
|
|
487732
487624
|
import { userInfo as userInfo2 } from "os";
|
|
487733
|
-
import { existsSync as
|
|
487625
|
+
import { existsSync as existsSync15 } from "fs";
|
|
487734
487626
|
import { mkdir as mkdir56, writeFile as writeFile54 } from "fs/promises";
|
|
487735
487627
|
import { dirname as dirname88, join as join185, resolve as resolve55 } from "path";
|
|
487736
487628
|
async function scaffoldMarketplace(opts) {
|
|
@@ -487738,7 +487630,7 @@ async function scaffoldMarketplace(opts) {
|
|
|
487738
487630
|
const name = opts.name.trim();
|
|
487739
487631
|
const manifestDirName = getPluginManifestDirs()[0];
|
|
487740
487632
|
const marketplaceManifestPath = join185(targetDir, manifestDirName, "marketplace.json");
|
|
487741
|
-
if (
|
|
487633
|
+
if (existsSync15(marketplaceManifestPath)) {
|
|
487742
487634
|
throw new Error(`Marketplace manifest already exists at ${marketplaceManifestPath} — refusing to overwrite (delete it and re-run to re-scaffold)`);
|
|
487743
487635
|
}
|
|
487744
487636
|
const owner = opts.owner ?? { name: userInfo2().username };
|
|
@@ -491500,7 +491392,7 @@ var init_main3 = __esm(() => {
|
|
|
491500
491392
|
init_installedPluginsManager();
|
|
491501
491393
|
init_managedPlugins();
|
|
491502
491394
|
init_orphanedPluginFilter();
|
|
491503
|
-
|
|
491395
|
+
init_sandboxCompat();
|
|
491504
491396
|
init_sessionStart();
|
|
491505
491397
|
init_sessionStorage();
|
|
491506
491398
|
init_settings2();
|