@costrict/csc 4.2.13 → 4.2.14
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 +11483 -7732
- package/dist/services/rawDump/batchWorker.js +179 -132
- package/package.json +1 -1
|
@@ -72,8 +72,8 @@ function getClientVersion() {
|
|
|
72
72
|
if (cached)
|
|
73
73
|
return cached;
|
|
74
74
|
try {
|
|
75
|
-
if ("4.2.
|
|
76
|
-
cached = "4.2.
|
|
75
|
+
if ("4.2.14") {
|
|
76
|
+
cached = "4.2.14";
|
|
77
77
|
return cached;
|
|
78
78
|
}
|
|
79
79
|
} catch {}
|
|
@@ -1631,13 +1631,110 @@ function lockSync(file, options) {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
var _lockfile;
|
|
1633
1633
|
|
|
1634
|
-
// src/costrict/provider/
|
|
1635
|
-
import { promises as fs3 } from "fs";
|
|
1634
|
+
// src/costrict/provider/credentialsStore.ts
|
|
1635
|
+
import { promises as fs3, existsSync } from "fs";
|
|
1636
1636
|
import { join } from "path";
|
|
1637
|
+
|
|
1638
|
+
class CoStrictCredentialsStore {
|
|
1639
|
+
configDir;
|
|
1640
|
+
constructor(configDir) {
|
|
1641
|
+
this.configDir = configDir;
|
|
1642
|
+
}
|
|
1643
|
+
getPath() {
|
|
1644
|
+
return join(this.configDir, "auth.json");
|
|
1645
|
+
}
|
|
1646
|
+
async load() {
|
|
1647
|
+
try {
|
|
1648
|
+
const content = await fs3.readFile(this.getPath(), "utf-8");
|
|
1649
|
+
const credentials = JSON.parse(content);
|
|
1650
|
+
if (!credentials.access_token || !credentials.base_url)
|
|
1651
|
+
return null;
|
|
1652
|
+
return credentials;
|
|
1653
|
+
} catch (error) {
|
|
1654
|
+
if (error.code === "ENOENT")
|
|
1655
|
+
return null;
|
|
1656
|
+
if (error instanceof SyntaxError)
|
|
1657
|
+
return null;
|
|
1658
|
+
return null;
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
async save(credentials) {
|
|
1662
|
+
await this.withLock(async () => {
|
|
1663
|
+
await this.atomicWrite(credentials);
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1666
|
+
async updateAtomically(updater) {
|
|
1667
|
+
return this.withLock(async (creds) => {
|
|
1668
|
+
const updated = updater(creds);
|
|
1669
|
+
if (updated) {
|
|
1670
|
+
await this.atomicWrite(updated);
|
|
1671
|
+
return updated;
|
|
1672
|
+
}
|
|
1673
|
+
return updated ?? creds;
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
async delete() {
|
|
1677
|
+
try {
|
|
1678
|
+
await fs3.unlink(this.getPath());
|
|
1679
|
+
} catch (error) {
|
|
1680
|
+
if (error.code !== "ENOENT")
|
|
1681
|
+
throw error;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
async has() {
|
|
1685
|
+
try {
|
|
1686
|
+
await fs3.access(this.getPath());
|
|
1687
|
+
return true;
|
|
1688
|
+
} catch {
|
|
1689
|
+
return false;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
hasSync() {
|
|
1693
|
+
try {
|
|
1694
|
+
return existsSync(this.getPath());
|
|
1695
|
+
} catch {
|
|
1696
|
+
return false;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
async withLock(fn) {
|
|
1700
|
+
const filepath = this.getPath();
|
|
1701
|
+
await fs3.mkdir(this.configDir, { recursive: true });
|
|
1702
|
+
const release = await lock(filepath, {
|
|
1703
|
+
retries: 10,
|
|
1704
|
+
stale: 5000,
|
|
1705
|
+
realpath: false
|
|
1706
|
+
});
|
|
1707
|
+
try {
|
|
1708
|
+
let creds = null;
|
|
1709
|
+
try {
|
|
1710
|
+
const content = await fs3.readFile(filepath, "utf-8");
|
|
1711
|
+
const parsed = JSON.parse(content);
|
|
1712
|
+
if (parsed.access_token && parsed.base_url) {
|
|
1713
|
+
creds = parsed;
|
|
1714
|
+
}
|
|
1715
|
+
} catch {}
|
|
1716
|
+
return await fn(creds);
|
|
1717
|
+
} finally {
|
|
1718
|
+
await release();
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
async atomicWrite(credentials) {
|
|
1722
|
+
const filepath = this.getPath();
|
|
1723
|
+
const tmpPath = `${filepath}.tmp.${process.pid}`;
|
|
1724
|
+
const data = JSON.stringify(credentials, null, 2) + `
|
|
1725
|
+
`;
|
|
1726
|
+
await fs3.writeFile(tmpPath, data, { encoding: "utf-8", mode: 384 });
|
|
1727
|
+
await fs3.rename(tmpPath, filepath);
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
var init_credentialsStore = () => {};
|
|
1731
|
+
|
|
1732
|
+
// src/costrict/provider/credentials.ts
|
|
1733
|
+
import { join as join2 } from "path";
|
|
1637
1734
|
import { createHash } from "crypto";
|
|
1638
1735
|
import { homedir } from "os";
|
|
1639
|
-
function
|
|
1640
|
-
return
|
|
1736
|
+
function getCoStrictCredentialsDir() {
|
|
1737
|
+
return join2(homedir(), ".costrict", "share");
|
|
1641
1738
|
}
|
|
1642
1739
|
function generateMachineId() {
|
|
1643
1740
|
const os2 = __require("os");
|
|
@@ -1648,72 +1745,21 @@ function generateMachineId() {
|
|
|
1648
1745
|
return createHash("sha256").update(machineInfo).digest("hex");
|
|
1649
1746
|
}
|
|
1650
1747
|
async function loadCoStrictCredentials() {
|
|
1651
|
-
|
|
1652
|
-
const content = await fs3.readFile(getCoStrictCredentialsPath(), "utf-8");
|
|
1653
|
-
const credentials = JSON.parse(content);
|
|
1654
|
-
if (!credentials.access_token || !credentials.base_url)
|
|
1655
|
-
return null;
|
|
1656
|
-
return credentials;
|
|
1657
|
-
} catch (error) {
|
|
1658
|
-
if (error.code === "ENOENT")
|
|
1659
|
-
return null;
|
|
1660
|
-
if (error instanceof SyntaxError)
|
|
1661
|
-
return null;
|
|
1662
|
-
return null;
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
async function withCredentialsLockInternal(fn) {
|
|
1666
|
-
const filepath = getCoStrictCredentialsPath();
|
|
1667
|
-
await fs3.mkdir(COSTRICT_CONFIG_DIR, { recursive: true });
|
|
1668
|
-
const release = await lock(filepath, { retries: 10, stale: 5000 });
|
|
1669
|
-
try {
|
|
1670
|
-
let creds = null;
|
|
1671
|
-
try {
|
|
1672
|
-
const content = await fs3.readFile(filepath, "utf-8");
|
|
1673
|
-
const parsed = JSON.parse(content);
|
|
1674
|
-
if (parsed.access_token && parsed.base_url) {
|
|
1675
|
-
creds = parsed;
|
|
1676
|
-
}
|
|
1677
|
-
} catch {}
|
|
1678
|
-
return await fn(creds);
|
|
1679
|
-
} finally {
|
|
1680
|
-
await release();
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
async function atomicWriteCredentials(filepath, credentials) {
|
|
1684
|
-
const tmpPath = `${filepath}.tmp.${process.pid}`;
|
|
1685
|
-
const data = JSON.stringify(credentials, null, 2) + `
|
|
1686
|
-
`;
|
|
1687
|
-
await fs3.writeFile(tmpPath, data, { encoding: "utf-8", mode: 384 });
|
|
1688
|
-
await fs3.rename(tmpPath, filepath);
|
|
1748
|
+
return defaultStore.load();
|
|
1689
1749
|
}
|
|
1690
1750
|
async function saveCoStrictCredentials(credentials) {
|
|
1691
|
-
|
|
1692
|
-
await withCredentialsLockInternal(async () => {
|
|
1693
|
-
await atomicWriteCredentials(filepath, credentials);
|
|
1694
|
-
return;
|
|
1695
|
-
});
|
|
1751
|
+
return defaultStore.save(credentials);
|
|
1696
1752
|
}
|
|
1697
1753
|
async function updateCredentialsAtomically(updater) {
|
|
1698
|
-
return
|
|
1699
|
-
const updated = updater(creds);
|
|
1700
|
-
if (updated) {
|
|
1701
|
-
return atomicWriteCredentials(getCoStrictCredentialsPath(), updated).then(() => updated);
|
|
1702
|
-
}
|
|
1703
|
-
return Promise.resolve(updated ?? creds);
|
|
1704
|
-
});
|
|
1754
|
+
return defaultStore.updateAtomically(updater);
|
|
1705
1755
|
}
|
|
1706
1756
|
function hasCoStrictCredentialsSync() {
|
|
1707
|
-
|
|
1708
|
-
const { existsSync } = __require("fs");
|
|
1709
|
-
return existsSync(getCoStrictCredentialsPath());
|
|
1710
|
-
} catch {
|
|
1711
|
-
return false;
|
|
1712
|
-
}
|
|
1757
|
+
return defaultStore.hasSync();
|
|
1713
1758
|
}
|
|
1714
|
-
var
|
|
1759
|
+
var defaultStore;
|
|
1715
1760
|
var init_credentials = __esm(() => {
|
|
1716
|
-
|
|
1761
|
+
init_credentialsStore();
|
|
1762
|
+
defaultStore = new CoStrictCredentialsStore(getCoStrictCredentialsDir());
|
|
1717
1763
|
});
|
|
1718
1764
|
|
|
1719
1765
|
// src/costrict/provider/oauth-params.ts
|
|
@@ -16106,12 +16152,12 @@ var init_branding = __esm(() => {
|
|
|
16106
16152
|
|
|
16107
16153
|
// src/utils/envUtils.ts
|
|
16108
16154
|
import { homedir as homedir2 } from "os";
|
|
16109
|
-
import { join as
|
|
16155
|
+
import { join as join3 } from "path";
|
|
16110
16156
|
function getLegacyConfigHomeDir() {
|
|
16111
16157
|
if (process.env.COSTRICT_CONFIG_DIR || process.env.CLAUDE_CONFIG_DIR) {
|
|
16112
16158
|
return;
|
|
16113
16159
|
}
|
|
16114
|
-
return
|
|
16160
|
+
return join3(homedir2(), LEGACY_CONFIG_DIR_NAME).normalize("NFC");
|
|
16115
16161
|
}
|
|
16116
16162
|
function hasNodeOption(flag) {
|
|
16117
16163
|
const nodeOptions = process.env.NODE_OPTIONS;
|
|
@@ -16148,7 +16194,7 @@ var init_envUtils = __esm(() => {
|
|
|
16148
16194
|
init_memoize();
|
|
16149
16195
|
init_branding();
|
|
16150
16196
|
getCostrictConfigHomeDir = memoize_default(() => {
|
|
16151
|
-
return (process.env.COSTRICT_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR ??
|
|
16197
|
+
return (process.env.COSTRICT_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR ?? join3(homedir2(), CONFIG_DIR_NAME)).normalize("NFC");
|
|
16152
16198
|
}, () => process.env.COSTRICT_CONFIG_DIR ?? process.env.CLAUDE_CONFIG_DIR);
|
|
16153
16199
|
getClaudeConfigHomeDir = getCostrictConfigHomeDir;
|
|
16154
16200
|
});
|
|
@@ -20832,7 +20878,7 @@ function writeToStderr(data) {
|
|
|
20832
20878
|
|
|
20833
20879
|
// src/utils/debug.ts
|
|
20834
20880
|
import { appendFile, mkdir, symlink, unlink } from "fs/promises";
|
|
20835
|
-
import { dirname, join as
|
|
20881
|
+
import { dirname, join as join4 } from "path";
|
|
20836
20882
|
function shouldLogDebugMessage(message) {
|
|
20837
20883
|
if (false) {}
|
|
20838
20884
|
if (process.env.USER_TYPE !== "sf" && !isDebugMode()) {
|
|
@@ -20907,7 +20953,7 @@ function logForDebugging(message, { level } = {
|
|
|
20907
20953
|
getDebugWriter().write(output);
|
|
20908
20954
|
}
|
|
20909
20955
|
function getDebugLogPath() {
|
|
20910
|
-
return getDebugFilePath() ?? process.env.CLAUDE_CODE_DEBUG_LOGS_DIR ??
|
|
20956
|
+
return getDebugFilePath() ?? process.env.CLAUDE_CODE_DEBUG_LOGS_DIR ?? join4(getClaudeConfigHomeDir(), "debug", `${getSessionId()}.txt`);
|
|
20911
20957
|
}
|
|
20912
20958
|
function logAntError(context, error2) {
|
|
20913
20959
|
if (process.env.USER_TYPE !== "sf") {
|
|
@@ -20974,7 +21020,7 @@ var init_debug = __esm(() => {
|
|
|
20974
21020
|
try {
|
|
20975
21021
|
const debugLogPath = getDebugLogPath();
|
|
20976
21022
|
const debugLogsDir = dirname(debugLogPath);
|
|
20977
|
-
const latestSymlinkPath =
|
|
21023
|
+
const latestSymlinkPath = join4(debugLogsDir, "latest");
|
|
20978
21024
|
await unlink(latestSymlinkPath).catch(() => {});
|
|
20979
21025
|
await symlink(debugLogPath, latestSymlinkPath);
|
|
20980
21026
|
} catch {}
|
|
@@ -60429,9 +60475,9 @@ function stripBOM2(content) {
|
|
|
60429
60475
|
var UTF8_BOM = "\uFEFF";
|
|
60430
60476
|
|
|
60431
60477
|
// src/services/remoteManagedSettings/syncCacheState.ts
|
|
60432
|
-
import { join as
|
|
60478
|
+
import { join as join5 } from "path";
|
|
60433
60479
|
function getSettingsPath() {
|
|
60434
|
-
return
|
|
60480
|
+
return join5(getClaudeConfigHomeDir(), SETTINGS_FILENAME);
|
|
60435
60481
|
}
|
|
60436
60482
|
function loadSettings() {
|
|
60437
60483
|
try {
|
|
@@ -61430,11 +61476,11 @@ var init_memoize2 = __esm(() => {
|
|
|
61430
61476
|
});
|
|
61431
61477
|
|
|
61432
61478
|
// src/utils/windowsPaths.ts
|
|
61433
|
-
import { existsSync as
|
|
61479
|
+
import { existsSync as existsSync3 } from "fs";
|
|
61434
61480
|
import * as path12 from "path";
|
|
61435
61481
|
import * as pathWin32 from "path/win32";
|
|
61436
61482
|
function checkPathExists(filePath) {
|
|
61437
|
-
return
|
|
61483
|
+
return existsSync3(filePath);
|
|
61438
61484
|
}
|
|
61439
61485
|
function findExecutable(executable) {
|
|
61440
61486
|
if (executable === "git") {
|
|
@@ -61562,7 +61608,7 @@ var init_sessionStoragePortable = __esm(() => {
|
|
|
61562
61608
|
import {
|
|
61563
61609
|
dirname as dirname4,
|
|
61564
61610
|
isAbsolute,
|
|
61565
|
-
join as
|
|
61611
|
+
join as join7,
|
|
61566
61612
|
normalize,
|
|
61567
61613
|
posix,
|
|
61568
61614
|
relative,
|
|
@@ -61587,7 +61633,7 @@ import {
|
|
|
61587
61633
|
dirname as dirname5,
|
|
61588
61634
|
extname,
|
|
61589
61635
|
isAbsolute as isAbsolute2,
|
|
61590
|
-
join as
|
|
61636
|
+
join as join8,
|
|
61591
61637
|
normalize as normalize2,
|
|
61592
61638
|
relative as relative2,
|
|
61593
61639
|
resolve as resolve3,
|
|
@@ -61934,7 +61980,7 @@ var init_gitConfigParser = () => {};
|
|
|
61934
61980
|
// src/utils/git/gitFilesystem.ts
|
|
61935
61981
|
import { unwatchFile, watchFile } from "fs";
|
|
61936
61982
|
import { readdir as readdir2, readFile as readFile2, stat as stat2 } from "fs/promises";
|
|
61937
|
-
import { join as
|
|
61983
|
+
import { join as join9, resolve as resolve4 } from "path";
|
|
61938
61984
|
async function resolveGitDir(startPath) {
|
|
61939
61985
|
const cwd2 = resolve4(startPath ?? getCwd());
|
|
61940
61986
|
const cached3 = resolveGitDirCache.get(cwd2);
|
|
@@ -61946,7 +61992,7 @@ async function resolveGitDir(startPath) {
|
|
|
61946
61992
|
resolveGitDirCache.set(cwd2, null);
|
|
61947
61993
|
return null;
|
|
61948
61994
|
}
|
|
61949
|
-
const gitPath =
|
|
61995
|
+
const gitPath = join9(root2, ".git");
|
|
61950
61996
|
try {
|
|
61951
61997
|
const st = await stat2(gitPath);
|
|
61952
61998
|
if (st.isFile()) {
|
|
@@ -61985,7 +62031,7 @@ function isValidGitSha(s) {
|
|
|
61985
62031
|
}
|
|
61986
62032
|
async function readGitHead(gitDir) {
|
|
61987
62033
|
try {
|
|
61988
|
-
const content = (await readFile2(
|
|
62034
|
+
const content = (await readFile2(join9(gitDir, "HEAD"), "utf-8")).trim();
|
|
61989
62035
|
if (content.startsWith("ref:")) {
|
|
61990
62036
|
const ref = content.slice("ref:".length).trim();
|
|
61991
62037
|
if (ref.startsWith("refs/heads/")) {
|
|
@@ -62022,7 +62068,7 @@ async function resolveRef2(gitDir, ref) {
|
|
|
62022
62068
|
}
|
|
62023
62069
|
async function resolveRefInDir(dir, ref) {
|
|
62024
62070
|
try {
|
|
62025
|
-
const content = (await readFile2(
|
|
62071
|
+
const content = (await readFile2(join9(dir, ref), "utf-8")).trim();
|
|
62026
62072
|
if (content.startsWith("ref:")) {
|
|
62027
62073
|
const target = content.slice("ref:".length).trim();
|
|
62028
62074
|
if (!isSafeRefName(target)) {
|
|
@@ -62036,7 +62082,7 @@ async function resolveRefInDir(dir, ref) {
|
|
|
62036
62082
|
return content;
|
|
62037
62083
|
} catch {}
|
|
62038
62084
|
try {
|
|
62039
|
-
const packed = await readFile2(
|
|
62085
|
+
const packed = await readFile2(join9(dir, "packed-refs"), "utf-8");
|
|
62040
62086
|
for (const line of packed.split(`
|
|
62041
62087
|
`)) {
|
|
62042
62088
|
if (line.startsWith("#") || line.startsWith("^")) {
|
|
@@ -62056,7 +62102,7 @@ async function resolveRefInDir(dir, ref) {
|
|
|
62056
62102
|
}
|
|
62057
62103
|
async function getCommonDir(gitDir) {
|
|
62058
62104
|
try {
|
|
62059
|
-
const content = (await readFile2(
|
|
62105
|
+
const content = (await readFile2(join9(gitDir, "commondir"), "utf-8")).trim();
|
|
62060
62106
|
return resolve4(gitDir, content);
|
|
62061
62107
|
} catch {
|
|
62062
62108
|
return null;
|
|
@@ -62088,10 +62134,10 @@ class GitFileWatcher {
|
|
|
62088
62134
|
return;
|
|
62089
62135
|
}
|
|
62090
62136
|
this.commonDir = await getCommonDir(this.gitDir);
|
|
62091
|
-
this.watchPath(
|
|
62137
|
+
this.watchPath(join9(this.gitDir, "HEAD"), () => {
|
|
62092
62138
|
this.onHeadChanged();
|
|
62093
62139
|
});
|
|
62094
|
-
this.watchPath(
|
|
62140
|
+
this.watchPath(join9(this.commonDir ?? this.gitDir, "config"), () => {
|
|
62095
62141
|
this.invalidate();
|
|
62096
62142
|
});
|
|
62097
62143
|
await this.watchCurrentBranchRef();
|
|
@@ -62109,7 +62155,7 @@ class GitFileWatcher {
|
|
|
62109
62155
|
}
|
|
62110
62156
|
const head = await readGitHead(this.gitDir);
|
|
62111
62157
|
const refsDir = this.commonDir ?? this.gitDir;
|
|
62112
|
-
const refPath = head?.type === "branch" ?
|
|
62158
|
+
const refPath = head?.type === "branch" ? join9(refsDir, "refs", "heads", head.name) : null;
|
|
62113
62159
|
if (refPath === this.branchRefPath) {
|
|
62114
62160
|
return;
|
|
62115
62161
|
}
|
|
@@ -62238,7 +62284,7 @@ var init_which = __esm(() => {
|
|
|
62238
62284
|
|
|
62239
62285
|
// src/utils/git.ts
|
|
62240
62286
|
import { readFileSync as readFileSync7, realpathSync as realpathSync3, statSync as statSync3 } from "fs";
|
|
62241
|
-
import { basename as basename2, dirname as dirname6, join as
|
|
62287
|
+
import { basename as basename2, dirname as dirname6, join as join10, resolve as resolve5, sep as sep3 } from "path";
|
|
62242
62288
|
function createFindGitRoot() {
|
|
62243
62289
|
function wrapper(startPath) {
|
|
62244
62290
|
const result = findGitRootImpl(startPath);
|
|
@@ -62280,7 +62326,7 @@ var init_git = __esm(() => {
|
|
|
62280
62326
|
let statCount = 0;
|
|
62281
62327
|
while (current !== root2) {
|
|
62282
62328
|
try {
|
|
62283
|
-
const gitPath =
|
|
62329
|
+
const gitPath = join10(current, ".git");
|
|
62284
62330
|
statCount++;
|
|
62285
62331
|
const stat3 = statSync3(gitPath);
|
|
62286
62332
|
if (stat3.isDirectory() || stat3.isFile()) {
|
|
@@ -62299,7 +62345,7 @@ var init_git = __esm(() => {
|
|
|
62299
62345
|
current = parent;
|
|
62300
62346
|
}
|
|
62301
62347
|
try {
|
|
62302
|
-
const gitPath =
|
|
62348
|
+
const gitPath = join10(root2, ".git");
|
|
62303
62349
|
statCount++;
|
|
62304
62350
|
const stat3 = statSync3(gitPath);
|
|
62305
62351
|
if (stat3.isDirectory() || stat3.isFile()) {
|
|
@@ -62321,17 +62367,17 @@ var init_git = __esm(() => {
|
|
|
62321
62367
|
findGitRoot = createFindGitRoot();
|
|
62322
62368
|
resolveCanonicalRoot = memoizeWithLRU((gitRoot) => {
|
|
62323
62369
|
try {
|
|
62324
|
-
const gitContent = readFileSync7(
|
|
62370
|
+
const gitContent = readFileSync7(join10(gitRoot, ".git"), "utf-8").trim();
|
|
62325
62371
|
if (!gitContent.startsWith("gitdir:")) {
|
|
62326
62372
|
return gitRoot;
|
|
62327
62373
|
}
|
|
62328
62374
|
const worktreeGitDir = resolve5(gitRoot, gitContent.slice("gitdir:".length).trim());
|
|
62329
|
-
const commonDir = resolve5(worktreeGitDir, readFileSync7(
|
|
62330
|
-
if (resolve5(dirname6(worktreeGitDir)) !==
|
|
62375
|
+
const commonDir = resolve5(worktreeGitDir, readFileSync7(join10(worktreeGitDir, "commondir"), "utf-8").trim());
|
|
62376
|
+
if (resolve5(dirname6(worktreeGitDir)) !== join10(commonDir, "worktrees")) {
|
|
62331
62377
|
return gitRoot;
|
|
62332
62378
|
}
|
|
62333
|
-
const backlink = realpathSync3(readFileSync7(
|
|
62334
|
-
if (backlink !==
|
|
62379
|
+
const backlink = realpathSync3(readFileSync7(join10(worktreeGitDir, "gitdir"), "utf-8").trim());
|
|
62380
|
+
if (backlink !== join10(realpathSync3(gitRoot), ".git")) {
|
|
62335
62381
|
return gitRoot;
|
|
62336
62382
|
}
|
|
62337
62383
|
if (basename2(commonDir) !== ".git") {
|
|
@@ -86779,7 +86825,7 @@ var init_internalWrites = __esm(() => {
|
|
|
86779
86825
|
});
|
|
86780
86826
|
|
|
86781
86827
|
// src/utils/settings/managedPath.ts
|
|
86782
|
-
import { join as
|
|
86828
|
+
import { join as join11 } from "path";
|
|
86783
86829
|
var getManagedFilePath, getManagedSettingsDropInDir;
|
|
86784
86830
|
var init_managedPath = __esm(() => {
|
|
86785
86831
|
init_memoize();
|
|
@@ -86798,7 +86844,7 @@ var init_managedPath = __esm(() => {
|
|
|
86798
86844
|
}
|
|
86799
86845
|
});
|
|
86800
86846
|
getManagedSettingsDropInDir = memoize_default(function() {
|
|
86801
|
-
return
|
|
86847
|
+
return join11(getManagedFilePath(), "managed-settings.d");
|
|
86802
86848
|
});
|
|
86803
86849
|
});
|
|
86804
86850
|
|
|
@@ -86862,7 +86908,7 @@ var init_findExecutable = __esm(() => {
|
|
|
86862
86908
|
|
|
86863
86909
|
// src/utils/env.ts
|
|
86864
86910
|
import { homedir as homedir4 } from "os";
|
|
86865
|
-
import { join as
|
|
86911
|
+
import { join as join12 } from "path";
|
|
86866
86912
|
async function isCommandAvailable(command) {
|
|
86867
86913
|
try {
|
|
86868
86914
|
return !!await which(command);
|
|
@@ -86983,11 +87029,11 @@ var init_env = __esm(() => {
|
|
|
86983
87029
|
init_fsOperations();
|
|
86984
87030
|
init_which();
|
|
86985
87031
|
getGlobalClaudeFile = memoize_default(() => {
|
|
86986
|
-
if (getFsImplementation().existsSync(
|
|
86987
|
-
return
|
|
87032
|
+
if (getFsImplementation().existsSync(join12(getClaudeConfigHomeDir(), ".config.json"))) {
|
|
87033
|
+
return join12(getClaudeConfigHomeDir(), ".config.json");
|
|
86988
87034
|
}
|
|
86989
87035
|
const filename = `.claude${fileSuffixForOauthConfig()}.json`;
|
|
86990
|
-
return
|
|
87036
|
+
return join12(process.env.CLAUDE_CONFIG_DIR || homedir4(), filename);
|
|
86991
87037
|
});
|
|
86992
87038
|
hasInternetAccess = memoize_default(async () => {
|
|
86993
87039
|
try {
|
|
@@ -88320,6 +88366,7 @@ var init_types2 = __esm(() => {
|
|
|
88320
88366
|
sparsePaths: exports_external.array(exports_external.string()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). " + "Dramatically faster in large monorepos \u2014 only the listed paths are written to disk.")
|
|
88321
88367
|
}).optional().describe("Git worktree configuration for --worktree flag."),
|
|
88322
88368
|
disableAllHooks: exports_external.boolean().optional().describe("Disable all hooks and statusLine execution"),
|
|
88369
|
+
dynamicWorkflowsEnabled: exports_external.boolean().optional().describe("Enable dynamic multi-agent workflow orchestration. Defaults to false."),
|
|
88323
88370
|
defaultShell: exports_external.enum(["bash", "powershell"]).optional().describe("Default shell for input-box ! commands. " + "Defaults to 'bash' on all platforms (no Windows auto-flip)."),
|
|
88324
88371
|
allowManagedHooksOnly: exports_external.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. " + "User, project, and local hooks are ignored."),
|
|
88325
88372
|
allowedHttpHookUrls: exports_external.array(exports_external.string()).optional().describe("Allowlist of URL patterns that HTTP hooks may target. " + 'Supports * as a wildcard (e.g. "https://hooks.example.com/*"). ' + "When set, HTTP hooks with non-matching URLs are blocked. " + "If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. " + "Arrays merge across settings sources (same semantics as allowedMcpServers)."),
|
|
@@ -88737,9 +88784,9 @@ var init_settings = __esm(() => {
|
|
|
88737
88784
|
|
|
88738
88785
|
// src/utils/settings/settings.ts
|
|
88739
88786
|
import { homedir as homedir5 } from "os";
|
|
88740
|
-
import { dirname as dirname7, join as
|
|
88787
|
+
import { dirname as dirname7, join as join13, resolve as resolve6 } from "path";
|
|
88741
88788
|
function getManagedSettingsFilePath() {
|
|
88742
|
-
return
|
|
88789
|
+
return join13(getManagedFilePath(), "managed-settings.json");
|
|
88743
88790
|
}
|
|
88744
88791
|
function loadManagedFileSettings() {
|
|
88745
88792
|
const errors3 = [];
|
|
@@ -88755,7 +88802,7 @@ function loadManagedFileSettings() {
|
|
|
88755
88802
|
try {
|
|
88756
88803
|
const entries = getFsImplementation().readdirSync(dropInDir).filter((d) => (d.isFile() || d.isSymbolicLink()) && d.name.endsWith(".json") && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
88757
88804
|
for (const name of entries) {
|
|
88758
|
-
const { settings: settings2, errors: fileErrors } = parseSettingsFile(
|
|
88805
|
+
const { settings: settings2, errors: fileErrors } = parseSettingsFile(join13(dropInDir, name));
|
|
88759
88806
|
errors3.push(...fileErrors);
|
|
88760
88807
|
if (settings2 && Object.keys(settings2).length > 0) {
|
|
88761
88808
|
merged = mergeWith_default(merged, settings2, settingsMergeCustomizer);
|
|
@@ -88835,12 +88882,12 @@ function getUserSettingsFilePath() {
|
|
|
88835
88882
|
}
|
|
88836
88883
|
function getUserSettingsFilePaths() {
|
|
88837
88884
|
const filename = getUserSettingsFilePath();
|
|
88838
|
-
const primary =
|
|
88885
|
+
const primary = join13(resolve6(getClaudeConfigHomeDir()), filename);
|
|
88839
88886
|
if (process.env.COSTRICT_CONFIG_DIR || process.env.CLAUDE_CONFIG_DIR) {
|
|
88840
88887
|
return [primary];
|
|
88841
88888
|
}
|
|
88842
|
-
const legacy =
|
|
88843
|
-
const defaultPrimary =
|
|
88889
|
+
const legacy = join13(homedir5(), LEGACY_CONFIG_DIR_NAME, filename);
|
|
88890
|
+
const defaultPrimary = join13(homedir5(), CONFIG_DIR_NAME, filename);
|
|
88844
88891
|
if (resolve6(primary) !== resolve6(defaultPrimary)) {
|
|
88845
88892
|
return [primary];
|
|
88846
88893
|
}
|
|
@@ -88852,10 +88899,10 @@ function getUserSettingsFilePaths() {
|
|
|
88852
88899
|
function getSettingsFilePathForSource(source) {
|
|
88853
88900
|
switch (source) {
|
|
88854
88901
|
case "userSettings":
|
|
88855
|
-
return
|
|
88902
|
+
return join13(getSettingsRootPathForSource(source), getUserSettingsFilePath());
|
|
88856
88903
|
case "projectSettings":
|
|
88857
88904
|
case "localSettings": {
|
|
88858
|
-
return
|
|
88905
|
+
return join13(getSettingsRootPathForSource(source), getRelativeSettingsFilePathForSource(source));
|
|
88859
88906
|
}
|
|
88860
88907
|
case "policySettings":
|
|
88861
88908
|
return getManagedSettingsFilePath();
|
|
@@ -88867,9 +88914,9 @@ function getSettingsFilePathForSource(source) {
|
|
|
88867
88914
|
function getRelativeSettingsFilePathForSource(source) {
|
|
88868
88915
|
switch (source) {
|
|
88869
88916
|
case "projectSettings":
|
|
88870
|
-
return
|
|
88917
|
+
return join13(".claude", "settings.json");
|
|
88871
88918
|
case "localSettings":
|
|
88872
|
-
return
|
|
88919
|
+
return join13(".claude", "settings.local.json");
|
|
88873
88920
|
}
|
|
88874
88921
|
}
|
|
88875
88922
|
function getSettingsForSource(source) {
|
|
@@ -113023,7 +113070,7 @@ var require_signin = __commonJS((exports) => {
|
|
|
113023
113070
|
import { createHash as createHash2, createPrivateKey, createPublicKey, sign } from "crypto";
|
|
113024
113071
|
import { promises as fs6 } from "fs";
|
|
113025
113072
|
import { homedir as homedir6 } from "os";
|
|
113026
|
-
import { dirname as dirname8, join as
|
|
113073
|
+
import { dirname as dirname8, join as join14 } from "path";
|
|
113027
113074
|
var import_config22, import_protocols3, LoginCredentialsFetcher;
|
|
113028
113075
|
var init_LoginCredentialsFetcher = __esm(() => {
|
|
113029
113076
|
import_config22 = __toESM(require_config(), 1);
|
|
@@ -113182,10 +113229,10 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
113182
113229
|
await fs6.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
|
|
113183
113230
|
}
|
|
113184
113231
|
getTokenFilePath() {
|
|
113185
|
-
const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ??
|
|
113232
|
+
const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join14(homedir6(), ".aws", "login", "cache");
|
|
113186
113233
|
const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
|
|
113187
113234
|
const loginSessionSha256 = createHash2("sha256").update(loginSessionBytes).digest("hex");
|
|
113188
|
-
return
|
|
113235
|
+
return join14(directory, `${loginSessionSha256}.json`);
|
|
113189
113236
|
}
|
|
113190
113237
|
derToRawSignature(derSignature) {
|
|
113191
113238
|
let offset = 2;
|
|
@@ -127938,11 +127985,11 @@ var init_macOsKeychainStorage = __esm(() => {
|
|
|
127938
127985
|
|
|
127939
127986
|
// src/utils/secureStorage/plainTextStorage.ts
|
|
127940
127987
|
import { chmodSync as chmodSync2 } from "fs";
|
|
127941
|
-
import { join as
|
|
127988
|
+
import { join as join15 } from "path";
|
|
127942
127989
|
function getStoragePath() {
|
|
127943
127990
|
const storageDir = getClaudeConfigHomeDir();
|
|
127944
127991
|
const storageFileName = ".credentials.json";
|
|
127945
|
-
return { storageDir, storagePath:
|
|
127992
|
+
return { storageDir, storagePath: join15(storageDir, storageFileName) };
|
|
127946
127993
|
}
|
|
127947
127994
|
var plainTextStorage;
|
|
127948
127995
|
var init_plainTextStorage = __esm(() => {
|
|
@@ -138345,7 +138392,7 @@ var init_user = __esm(() => {
|
|
|
138345
138392
|
deviceId,
|
|
138346
138393
|
sessionId: getSessionId(),
|
|
138347
138394
|
email: getEmail(),
|
|
138348
|
-
appVersion: "4.2.
|
|
138395
|
+
appVersion: "4.2.14",
|
|
138349
138396
|
platform: getHostPlatformForAnalytics(),
|
|
138350
138397
|
organizationUuid,
|
|
138351
138398
|
accountUuid,
|
|
@@ -138632,7 +138679,7 @@ var init_metadata = __esm(() => {
|
|
|
138632
138679
|
"sed"
|
|
138633
138680
|
]);
|
|
138634
138681
|
getVersionBase = memoize_default(() => {
|
|
138635
|
-
const match = "4.2.
|
|
138682
|
+
const match = "4.2.14".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
138636
138683
|
return match ? match[0] : undefined;
|
|
138637
138684
|
});
|
|
138638
138685
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -138672,9 +138719,9 @@ var init_metadata = __esm(() => {
|
|
|
138672
138719
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
138673
138720
|
isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
|
|
138674
138721
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
138675
|
-
version: "4.2.
|
|
138722
|
+
version: "4.2.14",
|
|
138676
138723
|
versionBase: getVersionBase(),
|
|
138677
|
-
buildTime: "2026-07-
|
|
138724
|
+
buildTime: "2026-07-15T07:34:29.634Z",
|
|
138678
138725
|
deploymentEnvironment: env4.detectDeploymentEnvironment(),
|
|
138679
138726
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
138680
138727
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -139230,7 +139277,7 @@ var init_growthbook = __esm(() => {
|
|
|
139230
139277
|
|
|
139231
139278
|
// src/memdir/paths.ts
|
|
139232
139279
|
import { homedir as homedir7 } from "os";
|
|
139233
|
-
import { isAbsolute as isAbsolute3, join as
|
|
139280
|
+
import { isAbsolute as isAbsolute3, join as join16, normalize as normalize3, sep as sep4 } from "path";
|
|
139234
139281
|
function getMemoryBaseDir() {
|
|
139235
139282
|
const remoteMemoryDir = getCostrictEnv("REMOTE_MEMORY_DIR");
|
|
139236
139283
|
if (remoteMemoryDir) {
|
|
@@ -139249,7 +139296,7 @@ function validateMemoryPath(raw, expandTilde) {
|
|
|
139249
139296
|
if (restNorm === "." || restNorm === "..") {
|
|
139250
139297
|
return;
|
|
139251
139298
|
}
|
|
139252
|
-
candidate =
|
|
139299
|
+
candidate = join16(homedir7(), rest);
|
|
139253
139300
|
}
|
|
139254
139301
|
const normalized = normalize3(candidate).replace(/[/\\]+$/u, "");
|
|
139255
139302
|
if (!isAbsolute3(normalized) || normalized.length < 3 || /^[A-Za-z]:$/.test(normalized) || normalized.startsWith("\\\\") || normalized.startsWith("//") || normalized.includes("\x00")) {
|
|
@@ -139281,8 +139328,8 @@ var init_paths = __esm(() => {
|
|
|
139281
139328
|
if (override) {
|
|
139282
139329
|
return override;
|
|
139283
139330
|
}
|
|
139284
|
-
const projectsDir =
|
|
139285
|
-
return (
|
|
139331
|
+
const projectsDir = join16(getMemoryBaseDir(), "projects");
|
|
139332
|
+
return (join16(projectsDir, sanitizePath(getAutoMemBase()), AUTO_MEM_DIRNAME) + sep4).normalize("NFC");
|
|
139286
139333
|
}, () => getProjectRoot());
|
|
139287
139334
|
});
|
|
139288
139335
|
|
|
@@ -139299,7 +139346,7 @@ var init_configConstants = () => {};
|
|
|
139299
139346
|
// src/utils/config.ts
|
|
139300
139347
|
import { randomBytes } from "crypto";
|
|
139301
139348
|
import { unwatchFile as unwatchFile2, watchFile as watchFile2 } from "fs";
|
|
139302
|
-
import { basename as basename3, dirname as dirname9, join as
|
|
139349
|
+
import { basename as basename3, dirname as dirname9, join as join17, resolve as resolve7 } from "path";
|
|
139303
139350
|
function createDefaultGlobalConfig() {
|
|
139304
139351
|
return {
|
|
139305
139352
|
numStartups: 0,
|
|
@@ -139652,14 +139699,14 @@ function saveConfigWithLock(file2, createDefault, mergeFn, readCurrent) {
|
|
|
139652
139699
|
const mostRecentTimestamp = mostRecentBackup ? Number(mostRecentBackup.split(".backup.").pop()) : 0;
|
|
139653
139700
|
const shouldCreateBackup = Number.isNaN(mostRecentTimestamp) || Date.now() - mostRecentTimestamp >= MIN_BACKUP_INTERVAL_MS;
|
|
139654
139701
|
if (shouldCreateBackup) {
|
|
139655
|
-
const backupPath =
|
|
139702
|
+
const backupPath = join17(backupDir, `${fileBase}.backup.${Date.now()}`);
|
|
139656
139703
|
fs7.copyFileSync(file2, backupPath);
|
|
139657
139704
|
}
|
|
139658
139705
|
const MAX_BACKUPS = 5;
|
|
139659
139706
|
const backupsForCleanup = shouldCreateBackup ? fs7.readdirStringSync(backupDir).filter((f5) => f5.startsWith(`${fileBase}.backup.`)).sort().reverse() : existingBackups;
|
|
139660
139707
|
for (const oldBackup of backupsForCleanup.slice(MAX_BACKUPS)) {
|
|
139661
139708
|
try {
|
|
139662
|
-
fs7.unlinkSync(
|
|
139709
|
+
fs7.unlinkSync(join17(backupDir, oldBackup));
|
|
139663
139710
|
} catch {}
|
|
139664
139711
|
}
|
|
139665
139712
|
} catch (e5) {
|
|
@@ -139685,7 +139732,7 @@ function saveConfigWithLock(file2, createDefault, mergeFn, readCurrent) {
|
|
|
139685
139732
|
}
|
|
139686
139733
|
}
|
|
139687
139734
|
function getConfigBackupDir() {
|
|
139688
|
-
return
|
|
139735
|
+
return join17(getClaudeConfigHomeDir(), "backups");
|
|
139689
139736
|
}
|
|
139690
139737
|
function findMostRecentBackup(file2) {
|
|
139691
139738
|
const fs7 = getFsImplementation();
|
|
@@ -139694,7 +139741,7 @@ function findMostRecentBackup(file2) {
|
|
|
139694
139741
|
const backupDirs = [primaryBackupDir];
|
|
139695
139742
|
const legacyHome = getLegacyConfigHomeDir();
|
|
139696
139743
|
if (legacyHome) {
|
|
139697
|
-
const legacyBackupDir =
|
|
139744
|
+
const legacyBackupDir = join17(legacyHome, "backups");
|
|
139698
139745
|
if (legacyBackupDir !== primaryBackupDir) {
|
|
139699
139746
|
backupDirs.push(legacyBackupDir);
|
|
139700
139747
|
}
|
|
@@ -139704,7 +139751,7 @@ function findMostRecentBackup(file2) {
|
|
|
139704
139751
|
const backups = fs7.readdirStringSync(backupDir).filter((f5) => f5.startsWith(`${fileBase}.backup.`)).sort();
|
|
139705
139752
|
const mostRecent = backups.at(-1);
|
|
139706
139753
|
if (mostRecent) {
|
|
139707
|
-
return
|
|
139754
|
+
return join17(backupDir, mostRecent);
|
|
139708
139755
|
}
|
|
139709
139756
|
} catch {}
|
|
139710
139757
|
}
|
|
@@ -139713,7 +139760,7 @@ function findMostRecentBackup(file2) {
|
|
|
139713
139760
|
const backups = fs7.readdirStringSync(fileDir).filter((f5) => f5.startsWith(`${fileBase}.backup.`)).sort();
|
|
139714
139761
|
const mostRecent = backups.at(-1);
|
|
139715
139762
|
if (mostRecent) {
|
|
139716
|
-
return
|
|
139763
|
+
return join17(fileDir, mostRecent);
|
|
139717
139764
|
}
|
|
139718
139765
|
const legacyBackup = `${file2}.backup`;
|
|
139719
139766
|
try {
|
|
@@ -139796,7 +139843,7 @@ Claude configuration file at ${file2} is corrupted: ${error52.message}
|
|
|
139796
139843
|
const currentContent = fs7.readFileSync(file2, { encoding: "utf-8" });
|
|
139797
139844
|
for (const backup of existingCorruptedBackups) {
|
|
139798
139845
|
try {
|
|
139799
|
-
const backupContent = fs7.readFileSync(
|
|
139846
|
+
const backupContent = fs7.readFileSync(join17(corruptedBackupDir, backup), { encoding: "utf-8" });
|
|
139800
139847
|
if (currentContent === backupContent) {
|
|
139801
139848
|
alreadyBackedUp = true;
|
|
139802
139849
|
break;
|
|
@@ -139804,7 +139851,7 @@ Claude configuration file at ${file2} is corrupted: ${error52.message}
|
|
|
139804
139851
|
} catch {}
|
|
139805
139852
|
}
|
|
139806
139853
|
if (!alreadyBackedUp) {
|
|
139807
|
-
corruptedBackupPath =
|
|
139854
|
+
corruptedBackupPath = join17(corruptedBackupDir, `${fileBase}.corrupted.${Date.now()}`);
|
|
139808
139855
|
try {
|
|
139809
139856
|
fs7.copyFileSync(file2, corruptedBackupPath);
|
|
139810
139857
|
logForDebugging(`Corrupted config backed up to: ${corruptedBackupPath}`, {
|
|
@@ -142858,5 +142905,5 @@ export {
|
|
|
142858
142905
|
startBatchWorker
|
|
142859
142906
|
};
|
|
142860
142907
|
|
|
142861
|
-
//# debugId=
|
|
142908
|
+
//# debugId=F58E705C32DFA9C364756E2164756E21
|
|
142862
142909
|
//# sourceMappingURL=batchWorker.js.map
|