jialing-code 1.3.9 → 1.3.11
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/{chunk-8e0jkfgf.js → chunk-08f7g44v.js} +8 -8
- package/dist/{chunk-rvzfrce8.js → chunk-0dscksme.js} +2 -2
- package/dist/{chunk-3ngzd6jk.js → chunk-0nrwm4nd.js} +1 -1
- package/dist/{chunk-ct2yffwn.js → chunk-0sfffwp9.js} +5 -5
- package/dist/{chunk-n3842tma.js → chunk-0sggm0er.js} +2 -2
- package/dist/{chunk-k5xcxdpp.js → chunk-15cnvrf3.js} +3 -3
- package/dist/{chunk-51dmhxyr.js → chunk-16rh2y4v.js} +3 -3
- package/dist/{chunk-6c0fq24x.js → chunk-1d71eame.js} +7 -7
- package/dist/{chunk-49gdhe3k.js → chunk-24ycwx7b.js} +4 -4
- package/dist/{chunk-ks852t3g.js → chunk-2a1pbzv4.js} +2 -2
- package/dist/{chunk-t5eny9fs.js → chunk-2bh2ha9e.js} +1 -1
- package/dist/{chunk-ztvdhsmc.js → chunk-2dpq8sne.js} +2 -2
- package/dist/{chunk-1m1wy0py.js → chunk-2j5rh25t.js} +4 -4
- package/dist/{chunk-pp4cqkak.js → chunk-2mrdn25v.js} +3 -3
- package/dist/{chunk-r5dwps4c.js → chunk-2v372emv.js} +5 -5
- package/dist/{chunk-yfpeev84.js → chunk-33j400j8.js} +2 -2
- package/dist/{chunk-8skaep8d.js → chunk-39bfwb6r.js} +1 -1
- package/dist/{chunk-rcbtak6h.js → chunk-3fc11fe6.js} +1 -1
- package/dist/{chunk-hj3hr16m.js → chunk-3md12xep.js} +2 -2
- package/dist/{chunk-hdbmw2pw.js → chunk-3n1npe6q.js} +3 -3
- package/dist/{chunk-bn3z2j3s.js → chunk-3ndzjg0j.js} +1 -1
- package/dist/{chunk-2zcgzd82.js → chunk-3t42tbak.js} +7 -7
- package/dist/{chunk-7pqtv531.js → chunk-46vtn4y1.js} +7 -7
- package/dist/{chunk-taksgsnz.js → chunk-49daydmf.js} +3 -3
- package/dist/{chunk-tkazrd4r.js → chunk-4j37dsra.js} +2 -2
- package/dist/{chunk-564pmm5r.js → chunk-4n3a7zns.js} +2 -2
- package/dist/{chunk-dej4rzrq.js → chunk-4x8are03.js} +1 -1
- package/dist/{chunk-69ngxa90.js → chunk-582kxtbh.js} +2 -2
- package/dist/{chunk-3y2e41qm.js → chunk-5b4e5sp8.js} +2 -2
- package/dist/{chunk-wq5drm9q.js → chunk-5ch3c353.js} +2 -2
- package/dist/{chunk-qgez85bx.js → chunk-5m96gcv8.js} +5 -5
- package/dist/{chunk-psg607ek.js → chunk-5mkarzr2.js} +2 -2
- package/dist/{chunk-y6d17fcm.js → chunk-5nb8vmmm.js} +4 -4
- package/dist/{chunk-285myw4c.js → chunk-5wj8hnaf.js} +2 -2
- package/dist/{chunk-vqp7bdqq.js → chunk-611n9cfj.js} +1 -1
- package/dist/{chunk-pwvkrj2s.js → chunk-6ca83nk6.js} +4 -4
- package/dist/{chunk-rdkf0pfy.js → chunk-6jxq19jb.js} +3 -3
- package/dist/{chunk-gjvpy6zq.js → chunk-6wdaz3qb.js} +2 -2
- package/dist/{chunk-gyxqv4t0.js → chunk-6y38cw18.js} +1 -1
- package/dist/{chunk-c62w9hc9.js → chunk-75670gkp.js} +6 -6
- package/dist/{chunk-x78y2qve.js → chunk-78dfxhwg.js} +1 -1
- package/dist/{chunk-z7f0t99j.js → chunk-7av8kdb3.js} +5 -5
- package/dist/{chunk-kcsf92nj.js → chunk-7d6re3rq.js} +3 -3
- package/dist/{chunk-qbj72e85.js → chunk-7gr27vy7.js} +2 -2
- package/dist/{chunk-xarekx5v.js → chunk-7rdfwg0h.js} +2 -2
- package/dist/{chunk-jv983cqf.js → chunk-86xtb4mk.js} +2 -2
- package/dist/{chunk-gdfr6var.js → chunk-8asygwnz.js} +2 -2
- package/dist/{chunk-66eyqvme.js → chunk-8jjjpyn4.js} +1 -1
- package/dist/{chunk-5nn20agx.js → chunk-8vdcnhhj.js} +1 -1
- package/dist/{chunk-wkrg83kf.js → chunk-90gr0yb3.js} +2 -2
- package/dist/{chunk-xmb8x90a.js → chunk-9c3hmh6k.js} +6 -6
- package/dist/{chunk-r6y1ftm2.js → chunk-9nay76zd.js} +6 -6
- package/dist/{chunk-ma59yd0g.js → chunk-a4rm38km.js} +3 -3
- package/dist/{chunk-njj0vx5s.js → chunk-a84qcs23.js} +1 -1
- package/dist/{chunk-x2aa0e3t.js → chunk-aapbr7wd.js} +4 -4
- package/dist/{chunk-y1x9zmmy.js → chunk-aewcpnrk.js} +1 -1
- package/dist/{chunk-y6nsanvy.js → chunk-akst8sb7.js} +2 -2
- package/dist/{chunk-1gmn6108.js → chunk-ar2sxpqw.js} +5 -5
- package/dist/{chunk-t2c5ak6a.js → chunk-ar4ktaxt.js} +1 -1
- package/dist/{chunk-n9jha8nr.js → chunk-b2b1fr8t.js} +7 -7
- package/dist/{chunk-qch7k44b.js → chunk-b88f0ex0.js} +1 -1
- package/dist/{chunk-kxvez41a.js → chunk-b8fv5qv1.js} +7 -7
- package/dist/{chunk-bngvb00h.js → chunk-bne21p5g.js} +2 -2
- package/dist/{chunk-h3jk804w.js → chunk-bx34c1zb.js} +3 -3
- package/dist/{chunk-zep3c3a8.js → chunk-c250dpb7.js} +4 -4
- package/dist/{chunk-n8m13fqp.js → chunk-c2c0ptek.js} +2 -2
- package/dist/{chunk-7gsnnjdf.js → chunk-c556rt3q.js} +6 -6
- package/dist/{chunk-s8hnqawa.js → chunk-c64rkx7d.js} +543 -514
- package/dist/{chunk-c6gvkek4.js → chunk-c788qr3y.js} +2 -2
- package/dist/{chunk-ner6mpmj.js → chunk-cd0k0jnh.js} +2 -2
- package/dist/{chunk-6xdyzddr.js → chunk-cercfqgt.js} +2 -2
- package/dist/{chunk-rxjtw4gv.js → chunk-cgjs9cht.js} +3 -3
- package/dist/{chunk-xb0s6v9g.js → chunk-cns3kx70.js} +7 -7
- package/dist/{chunk-ds1k1b3a.js → chunk-cqk4q5xm.js} +2 -2
- package/dist/{chunk-n4ryz8ny.js → chunk-cqpvt0mt.js} +7 -7
- package/dist/{chunk-7b0q6s38.js → chunk-cwqa1yxt.js} +2 -2
- package/dist/{chunk-k2jkvzm8.js → chunk-d1tn8q2y.js} +43 -43
- package/dist/{chunk-e5t425z7.js → chunk-e0gs2a7d.js} +2 -2
- package/dist/{chunk-40qmpjzh.js → chunk-e20sn529.js} +2 -2
- package/dist/{chunk-5hcg2wxz.js → chunk-e6pjm749.js} +2 -2
- package/dist/{chunk-m4tk6kqq.js → chunk-efmv97ra.js} +1 -1
- package/dist/{chunk-yzjszcbp.js → chunk-eh8xx983.js} +1 -1
- package/dist/{chunk-43zja8kb.js → chunk-em1ba8ze.js} +3 -3
- package/dist/{chunk-fhwn92f3.js → chunk-erhdecnt.js} +3 -3
- package/dist/{chunk-acp5jefr.js → chunk-et93pm4h.js} +2 -2
- package/dist/{chunk-3v2gna97.js → chunk-ewhq93g1.js} +22 -22
- package/dist/{chunk-spzch0sr.js → chunk-ex2hdehn.js} +3 -3
- package/dist/{chunk-k2nny40r.js → chunk-ey6y4m4p.js} +2 -2
- package/dist/{chunk-xbwmjyde.js → chunk-f004q4ha.js} +3 -3
- package/dist/{chunk-8xanmrzq.js → chunk-f5hkz8ec.js} +2 -2
- package/dist/{chunk-741cvhvd.js → chunk-fcx7m6eq.js} +1 -1
- package/dist/{chunk-bjcywqzr.js → chunk-fdbdp649.js} +4 -4
- package/dist/{chunk-szmz6kxt.js → chunk-ffx02f13.js} +3 -3
- package/dist/{chunk-6wj24js4.js → chunk-fn430z5z.js} +1 -1
- package/dist/{chunk-9rg14j1v.js → chunk-fnmdv0s4.js} +1 -1
- package/dist/{chunk-c1321me0.js → chunk-fv5aaq1q.js} +11 -11
- package/dist/{chunk-fr5eqr4m.js → chunk-g166ygyy.js} +1 -1
- package/dist/{chunk-9xsp4wry.js → chunk-g4cb8da0.js} +2 -2
- package/dist/{chunk-8vtyfq7y.js → chunk-g88tmqdn.js} +5 -5
- package/dist/{chunk-atzb513c.js → chunk-gby1m1pm.js} +3 -3
- package/dist/{chunk-sa2rhkap.js → chunk-ge1zp92c.js} +2 -2
- package/dist/{chunk-acacvsez.js → chunk-gkkw8pwq.js} +2 -2
- package/dist/{chunk-dmyqc2bt.js → chunk-gp47dsyt.js} +2 -2
- package/dist/{chunk-dqsnx26h.js → chunk-gpsx7zn5.js} +8 -8
- package/dist/{chunk-n026btkc.js → chunk-h293yra4.js} +35 -35
- package/dist/{chunk-mhd2mn93.js → chunk-hkanah32.js} +3 -3
- package/dist/{chunk-8qm0kqwb.js → chunk-hvv3a5f0.js} +2 -2
- package/dist/{chunk-wsffta0f.js → chunk-j5xvhq6j.js} +1 -1
- package/dist/{chunk-k5kg9pw2.js → chunk-j9pwjndq.js} +3 -3
- package/dist/{chunk-8t7rrb3c.js → chunk-jfee6dt7.js} +2 -2
- package/dist/{chunk-sk8nzk30.js → chunk-jq3907bq.js} +2 -2
- package/dist/{chunk-pfmjchr3.js → chunk-jvb1dp1x.js} +3 -3
- package/dist/{chunk-9pe831ta.js → chunk-k020eh12.js} +3 -3
- package/dist/{chunk-ghc6bgc5.js → chunk-k2vhyqr8.js} +1 -1
- package/dist/{chunk-2413q448.js → chunk-k36x51dg.js} +2 -2
- package/dist/{chunk-m5t7q70f.js → chunk-k9hjx8yf.js} +4 -4
- package/dist/{chunk-kfettk4f.js → chunk-k9w38qcg.js} +1 -1
- package/dist/{chunk-egmc4s2g.js → chunk-ka0adg3q.js} +2 -2
- package/dist/{chunk-2tzgx2xk.js → chunk-ktkhm6h0.js} +7 -7
- package/dist/{chunk-pgcavf9b.js → chunk-m3gybbxf.js} +3 -3
- package/dist/{chunk-gwrr2ne6.js → chunk-m6zfat3g.js} +71 -58
- package/dist/{chunk-23d3jrww.js → chunk-m7y74nyz.js} +3 -3
- package/dist/{chunk-5cq732aj.js → chunk-mvn83r78.js} +1 -1
- package/dist/{chunk-d5vbf0z0.js → chunk-n010544z.js} +2 -2
- package/dist/{chunk-pe3tqm81.js → chunk-n0rjbqjn.js} +1 -1
- package/dist/{chunk-f6729mtf.js → chunk-n34tvtsv.js} +1 -1
- package/dist/{chunk-v0bn9t7v.js → chunk-n83v85hb.js} +44 -44
- package/dist/{chunk-gcr8n2q4.js → chunk-nc9j5k7t.js} +7 -7
- package/dist/{chunk-x3t0rp1s.js → chunk-nms0csv3.js} +2 -2
- package/dist/{chunk-s27p5jrc.js → chunk-nzs9y358.js} +1 -1
- package/dist/{chunk-2m1w7s1v.js → chunk-pd0kfhpc.js} +2 -2
- package/dist/{chunk-yfnx0262.js → chunk-psfw6zfd.js} +2 -2
- package/dist/{chunk-6jsknshr.js → chunk-pzfm2f50.js} +2 -2
- package/dist/{chunk-wvky1r3r.js → chunk-q2xjkbq6.js} +2 -2
- package/dist/{chunk-985t34sr.js → chunk-q4hpfn2j.js} +2 -2
- package/dist/{chunk-2e0dn6zg.js → chunk-qc5njx8n.js} +3 -3
- package/dist/{chunk-zv7a78w1.js → chunk-qdcrcsxd.js} +2 -2
- package/dist/{chunk-w67vsre1.js → chunk-r1k96kj8.js} +3 -3
- package/dist/{chunk-ghm36dzb.js → chunk-r3cjy0fb.js} +5 -5
- package/dist/{chunk-p9b5728z.js → chunk-r58xwjdy.js} +1 -1
- package/dist/{chunk-px526ass.js → chunk-ra2mmg2e.js} +2 -2
- package/dist/{chunk-q0ez6b0a.js → chunk-rhkdwnq9.js} +1 -1
- package/dist/{chunk-2e8g1nj9.js → chunk-sbfst01b.js} +1 -1
- package/dist/{chunk-ntw7f8na.js → chunk-sc0fas5c.js} +1 -1
- package/dist/{chunk-xzdd3xcj.js → chunk-sfjm0eew.js} +10 -10
- package/dist/{chunk-qx021560.js → chunk-ssbwrtq0.js} +1 -1
- package/dist/{chunk-sqejff7m.js → chunk-t89d72xr.js} +4 -4
- package/dist/{chunk-e829zqsg.js → chunk-tfe2hzfk.js} +2 -2
- package/dist/{chunk-kkxh1v5c.js → chunk-tnw04w60.js} +2 -2
- package/dist/{chunk-x982nkvh.js → chunk-tvhjf6ns.js} +5 -5
- package/dist/{chunk-e6bdtd3v.js → chunk-tvyy122a.js} +1 -1
- package/dist/{chunk-g9080r58.js → chunk-ty36dqav.js} +2 -2
- package/dist/{chunk-hr212r6v.js → chunk-tz8nchke.js} +1 -1
- package/dist/{chunk-91qbsaee.js → chunk-v1t9d698.js} +3 -3
- package/dist/{chunk-kareceee.js → chunk-vdbt37hp.js} +3 -3
- package/dist/{chunk-kvqe3050.js → chunk-vp0ha2ab.js} +2 -2
- package/dist/{chunk-7mgy98g7.js → chunk-vyry5ac1.js} +2 -2
- package/dist/{chunk-kdtwztrw.js → chunk-vzy6nyzm.js} +1 -1
- package/dist/{chunk-a6m2j946.js → chunk-w4wev9cv.js} +2 -2
- package/dist/{chunk-tt0ae8jf.js → chunk-wcre2v8b.js} +1 -1
- package/dist/{chunk-c19h5jhk.js → chunk-wpcm9hv3.js} +2 -2
- package/dist/{chunk-8f4p6jdb.js → chunk-wr8284h9.js} +7 -7
- package/dist/{chunk-zwpcckj5.js → chunk-x2xz64fv.js} +1 -1
- package/dist/{chunk-3kdnvvmp.js → chunk-x4zrb9nt.js} +1 -1
- package/dist/{chunk-s4wmc3vz.js → chunk-x7kc9mgr.js} +9 -9
- package/dist/{chunk-6kxqsxdn.js → chunk-x8r2chc3.js} +4 -4
- package/dist/{chunk-zvdm2mvr.js → chunk-y6b19vda.js} +2 -2
- package/dist/{chunk-5wt77h5v.js → chunk-ygz3k4sq.js} +5 -5
- package/dist/{chunk-eegwxgh7.js → chunk-yhm5s26b.js} +2 -2
- package/dist/{chunk-vrj7s722.js → chunk-ytv6hwt0.js} +2 -2
- package/dist/{chunk-905wyebn.js → chunk-yv7fwzxg.js} +1 -1
- package/dist/{chunk-rhngbceb.js → chunk-yxjmt7rs.js} +4 -4
- package/dist/{chunk-pcx5r04e.js → chunk-z30mkwed.js} +2 -2
- package/dist/{chunk-t9tf6ay1.js → chunk-zb1jnnp7.js} +14 -14
- package/dist/{chunk-276nf481.js → chunk-zb71mx14.js} +2 -2
- package/dist/{chunk-sn8p1cvd.js → chunk-ztjf67xg.js} +2 -2
- package/dist/cli.js +12 -6
- package/package.json +1 -1
|
@@ -94,7 +94,7 @@ import {
|
|
|
94
94
|
unregisterTeamForSessionCleanup,
|
|
95
95
|
updateTask,
|
|
96
96
|
writeTeamFileAsync
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-611n9cfj.js";
|
|
98
98
|
import {
|
|
99
99
|
init_worktreeModeEnabled,
|
|
100
100
|
isWorktreeModeEnabled
|
|
@@ -4922,7 +4922,7 @@ var init_add_dir = __esm(() => {
|
|
|
4922
4922
|
name: "add-dir",
|
|
4923
4923
|
description: "Add a new working directory",
|
|
4924
4924
|
argumentHint: "<path>",
|
|
4925
|
-
load: () => import("./chunk-
|
|
4925
|
+
load: () => import("./chunk-ffx02f13.js")
|
|
4926
4926
|
};
|
|
4927
4927
|
add_dir_default = addDir;
|
|
4928
4928
|
});
|
|
@@ -4948,7 +4948,7 @@ var init_btw = __esm(() => {
|
|
|
4948
4948
|
description: "Ask a quick side question without interrupting the main conversation",
|
|
4949
4949
|
immediate: true,
|
|
4950
4950
|
argumentHint: "<question>",
|
|
4951
|
-
load: () => import("./chunk-
|
|
4951
|
+
load: () => import("./chunk-f004q4ha.js")
|
|
4952
4952
|
};
|
|
4953
4953
|
btw_default = btw;
|
|
4954
4954
|
});
|
|
@@ -5052,6 +5052,9 @@ var init_types6 = __esm(() => {
|
|
|
5052
5052
|
});
|
|
5053
5053
|
|
|
5054
5054
|
// src/buddy/companion.ts
|
|
5055
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
5056
|
+
import { join as join4 } from "path";
|
|
5057
|
+
import { homedir as homedir3 } from "os";
|
|
5055
5058
|
function mulberry32(seed) {
|
|
5056
5059
|
let a = seed >>> 0;
|
|
5057
5060
|
return function() {
|
|
@@ -5128,7 +5131,33 @@ function companionUserId() {
|
|
|
5128
5131
|
const config2 = getGlobalConfig();
|
|
5129
5132
|
return config2.oauthAccount?.accountUuid ?? config2.userID ?? "anon";
|
|
5130
5133
|
}
|
|
5134
|
+
function tryMigrateJialingCompanion() {
|
|
5135
|
+
if (jialingCompanionMigrated)
|
|
5136
|
+
return;
|
|
5137
|
+
jialingCompanionMigrated = true;
|
|
5138
|
+
try {
|
|
5139
|
+
const jialingConfigPath = join4(homedir3(), ".jialing-code", "config.json");
|
|
5140
|
+
if (!existsSync4(jialingConfigPath))
|
|
5141
|
+
return;
|
|
5142
|
+
const jialingConfig = JSON.parse(readFileSync3(jialingConfigPath, "utf-8"));
|
|
5143
|
+
if (!jialingConfig.companion)
|
|
5144
|
+
return;
|
|
5145
|
+
const globalConfig = getGlobalConfig();
|
|
5146
|
+
if (globalConfig.companion)
|
|
5147
|
+
return;
|
|
5148
|
+
saveGlobalConfig((current) => ({
|
|
5149
|
+
...current,
|
|
5150
|
+
companion: {
|
|
5151
|
+
name: jialingConfig.companion.name || "Buddy",
|
|
5152
|
+
personality: jialingConfig.companion.personality || "",
|
|
5153
|
+
hatchedAt: jialingConfig.companion.hatchedAt || Date.now()
|
|
5154
|
+
},
|
|
5155
|
+
companionSpeciesOverride: jialingConfig.companion.species
|
|
5156
|
+
}));
|
|
5157
|
+
} catch {}
|
|
5158
|
+
}
|
|
5131
5159
|
function getCompanion() {
|
|
5160
|
+
tryMigrateJialingCompanion();
|
|
5132
5161
|
const config2 = getGlobalConfig();
|
|
5133
5162
|
const stored = config2.companion;
|
|
5134
5163
|
if (!stored)
|
|
@@ -5140,7 +5169,7 @@ function getCompanion() {
|
|
|
5140
5169
|
}
|
|
5141
5170
|
return { ...stored, ...bones };
|
|
5142
5171
|
}
|
|
5143
|
-
var RARITY_FLOOR, SALT = "friend-2026-401", rollCache;
|
|
5172
|
+
var RARITY_FLOOR, SALT = "friend-2026-401", rollCache, jialingCompanionMigrated = false;
|
|
5144
5173
|
var init_companion = __esm(() => {
|
|
5145
5174
|
init_config2();
|
|
5146
5175
|
init_types6();
|
|
@@ -12406,7 +12435,7 @@ import {
|
|
|
12406
12435
|
symlink,
|
|
12407
12436
|
utimes
|
|
12408
12437
|
} from "fs/promises";
|
|
12409
|
-
import { basename, dirname as dirname4, join as
|
|
12438
|
+
import { basename, dirname as dirname4, join as join5 } from "path";
|
|
12410
12439
|
function validateWorktreeSlug(slug) {
|
|
12411
12440
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
12412
12441
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -12429,8 +12458,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
12429
12458
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
12430
12459
|
continue;
|
|
12431
12460
|
}
|
|
12432
|
-
const sourcePath =
|
|
12433
|
-
const destPath =
|
|
12461
|
+
const sourcePath = join5(repoRootPath, dir);
|
|
12462
|
+
const destPath = join5(worktreePath, dir);
|
|
12434
12463
|
try {
|
|
12435
12464
|
await symlink(sourcePath, destPath, "dir");
|
|
12436
12465
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -12454,7 +12483,7 @@ function generateTmuxSessionName(repoPath, branch) {
|
|
|
12454
12483
|
return combined.replace(/[/.]/g, "_");
|
|
12455
12484
|
}
|
|
12456
12485
|
function worktreesDir(repoRoot) {
|
|
12457
|
-
return
|
|
12486
|
+
return join5(repoRoot, ".claude", "worktrees");
|
|
12458
12487
|
}
|
|
12459
12488
|
function flattenSlug(slug) {
|
|
12460
12489
|
return slug.replaceAll("/", "+");
|
|
@@ -12463,7 +12492,7 @@ function worktreeBranchName(slug) {
|
|
|
12463
12492
|
return `worktree-${flattenSlug(slug)}`;
|
|
12464
12493
|
}
|
|
12465
12494
|
function worktreePathFor(repoRoot, slug) {
|
|
12466
|
-
return
|
|
12495
|
+
return join5(worktreesDir(repoRoot), flattenSlug(slug));
|
|
12467
12496
|
}
|
|
12468
12497
|
async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
12469
12498
|
const worktreePath = worktreePathFor(repoRoot, slug);
|
|
@@ -12544,7 +12573,7 @@ async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
|
12544
12573
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
12545
12574
|
let includeContent;
|
|
12546
12575
|
try {
|
|
12547
|
-
includeContent = await readFile(
|
|
12576
|
+
includeContent = await readFile(join5(repoRoot, ".worktreeinclude"), "utf-8");
|
|
12548
12577
|
} catch {
|
|
12549
12578
|
return [];
|
|
12550
12579
|
}
|
|
@@ -12599,8 +12628,8 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
12599
12628
|
}
|
|
12600
12629
|
const copied = [];
|
|
12601
12630
|
for (const relativePath of files) {
|
|
12602
|
-
const srcPath =
|
|
12603
|
-
const destPath =
|
|
12631
|
+
const srcPath = join5(repoRoot, relativePath);
|
|
12632
|
+
const destPath = join5(worktreePath, relativePath);
|
|
12604
12633
|
try {
|
|
12605
12634
|
await mkdir(dirname4(destPath), { recursive: true });
|
|
12606
12635
|
await copyFile(srcPath, destPath);
|
|
@@ -12616,9 +12645,9 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
12616
12645
|
}
|
|
12617
12646
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
12618
12647
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
12619
|
-
const sourceSettingsLocal =
|
|
12648
|
+
const sourceSettingsLocal = join5(repoRoot, localSettingsRelativePath);
|
|
12620
12649
|
try {
|
|
12621
|
-
const destSettingsLocal =
|
|
12650
|
+
const destSettingsLocal = join5(worktreePath, localSettingsRelativePath);
|
|
12622
12651
|
await mkdirRecursive(dirname4(destSettingsLocal));
|
|
12623
12652
|
await copyFile(sourceSettingsLocal, destSettingsLocal);
|
|
12624
12653
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
@@ -12628,8 +12657,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
12628
12657
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
12629
12658
|
}
|
|
12630
12659
|
}
|
|
12631
|
-
const huskyPath =
|
|
12632
|
-
const gitHooksPath =
|
|
12660
|
+
const huskyPath = join5(repoRoot, ".husky");
|
|
12661
|
+
const gitHooksPath = join5(repoRoot, ".git", "hooks");
|
|
12633
12662
|
let hooksPath = null;
|
|
12634
12663
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
12635
12664
|
try {
|
|
@@ -12904,7 +12933,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
12904
12933
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p) => p.test(slug))) {
|
|
12905
12934
|
continue;
|
|
12906
12935
|
}
|
|
12907
|
-
const worktreePath =
|
|
12936
|
+
const worktreePath = join5(dir, slug);
|
|
12908
12937
|
if (currentPath === worktreePath) {
|
|
12909
12938
|
continue;
|
|
12910
12939
|
}
|
|
@@ -20580,11 +20609,11 @@ var init_cron = __esm(() => {
|
|
|
20580
20609
|
|
|
20581
20610
|
// src/utils/cronTasks.ts
|
|
20582
20611
|
import { randomUUID } from "crypto";
|
|
20583
|
-
import { readFileSync as
|
|
20612
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
20584
20613
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
20585
|
-
import { join as
|
|
20614
|
+
import { join as join6 } from "path";
|
|
20586
20615
|
function getCronFilePath(dir) {
|
|
20587
|
-
return
|
|
20616
|
+
return join6(dir ?? getProjectRoot(), CRON_FILE_REL);
|
|
20588
20617
|
}
|
|
20589
20618
|
async function readCronTasks(dir) {
|
|
20590
20619
|
const fs6 = getFsImplementation();
|
|
@@ -20628,7 +20657,7 @@ async function readCronTasks(dir) {
|
|
|
20628
20657
|
function hasCronTasksSync(dir) {
|
|
20629
20658
|
let raw;
|
|
20630
20659
|
try {
|
|
20631
|
-
raw =
|
|
20660
|
+
raw = readFileSync4(getCronFilePath(dir), "utf-8");
|
|
20632
20661
|
} catch {
|
|
20633
20662
|
return false;
|
|
20634
20663
|
}
|
|
@@ -20640,7 +20669,7 @@ function hasCronTasksSync(dir) {
|
|
|
20640
20669
|
}
|
|
20641
20670
|
async function writeCronTasks(tasks, dir) {
|
|
20642
20671
|
const root = dir ?? getProjectRoot();
|
|
20643
|
-
await mkdir2(
|
|
20672
|
+
await mkdir2(join6(root, ".claude"), { recursive: true });
|
|
20644
20673
|
const body = {
|
|
20645
20674
|
tasks: tasks.map(({ durable: _durable, ...rest }) => rest)
|
|
20646
20675
|
};
|
|
@@ -20750,7 +20779,7 @@ var init_cronTasks = __esm(() => {
|
|
|
20750
20779
|
init_json();
|
|
20751
20780
|
init_log();
|
|
20752
20781
|
init_slowOperations();
|
|
20753
|
-
CRON_FILE_REL =
|
|
20782
|
+
CRON_FILE_REL = join6(".claude", "scheduled_tasks.json");
|
|
20754
20783
|
DEFAULT_CRON_JITTER_CONFIG = {
|
|
20755
20784
|
recurringFrac: 0.1,
|
|
20756
20785
|
recurringCapMs: 15 * 60 * 1000,
|
|
@@ -24636,7 +24665,7 @@ import {
|
|
|
24636
24665
|
dirname as dirname5,
|
|
24637
24666
|
extname,
|
|
24638
24667
|
isAbsolute as isAbsolute2,
|
|
24639
|
-
join as
|
|
24668
|
+
join as join7,
|
|
24640
24669
|
parse,
|
|
24641
24670
|
relative,
|
|
24642
24671
|
sep
|
|
@@ -24881,7 +24910,7 @@ async function processMdRules({
|
|
|
24881
24910
|
throw e;
|
|
24882
24911
|
}
|
|
24883
24912
|
for (const entry of entries) {
|
|
24884
|
-
const entryPath =
|
|
24913
|
+
const entryPath = join7(rulesDir, entry.name);
|
|
24885
24914
|
const { resolvedPath: resolvedEntryPath, isSymlink: isSymlink2 } = safeResolvePath(fs6, entryPath);
|
|
24886
24915
|
const stats = isSymlink2 ? await fs6.stat(resolvedEntryPath) : null;
|
|
24887
24916
|
const isDirectory = stats ? stats.isDirectory() : entry.isDirectory();
|
|
@@ -24952,16 +24981,16 @@ async function getManagedAndUserConditionalRules(targetPath, processedPaths) {
|
|
|
24952
24981
|
async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths) {
|
|
24953
24982
|
const result = [];
|
|
24954
24983
|
if (isSettingSourceEnabled("projectSettings")) {
|
|
24955
|
-
const projectPath =
|
|
24984
|
+
const projectPath = join7(dir, "CLAUDE.md");
|
|
24956
24985
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, false));
|
|
24957
|
-
const dotClaudePath =
|
|
24986
|
+
const dotClaudePath = join7(dir, ".claude", "CLAUDE.md");
|
|
24958
24987
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, false));
|
|
24959
24988
|
}
|
|
24960
24989
|
if (isSettingSourceEnabled("localSettings")) {
|
|
24961
|
-
const localPath =
|
|
24990
|
+
const localPath = join7(dir, "CLAUDE.local.md");
|
|
24962
24991
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, false));
|
|
24963
24992
|
}
|
|
24964
|
-
const rulesDir =
|
|
24993
|
+
const rulesDir = join7(dir, ".claude", "rules");
|
|
24965
24994
|
const unconditionalProcessedPaths = new Set(processedPaths);
|
|
24966
24995
|
result.push(...await processMdRules({
|
|
24967
24996
|
rulesDir,
|
|
@@ -24977,7 +25006,7 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
24977
25006
|
return result;
|
|
24978
25007
|
}
|
|
24979
25008
|
async function getConditionalRulesForCwdLevelDirectory(dir, targetPath, processedPaths) {
|
|
24980
|
-
const rulesDir =
|
|
25009
|
+
const rulesDir = join7(dir, ".claude", "rules");
|
|
24981
25010
|
return processConditionedMdRules(targetPath, rulesDir, "Project", processedPaths, false);
|
|
24982
25011
|
}
|
|
24983
25012
|
async function processConditionedMdRules(targetPath, rulesDir, type, processedPaths, includeExternal) {
|
|
@@ -25222,11 +25251,11 @@ var init_claudemd = __esm(() => {
|
|
|
25222
25251
|
for (const dir of dirs.reverse()) {
|
|
25223
25252
|
const skipProject = isNestedWorktree && pathInWorkingPath(dir, canonicalRoot) && !pathInWorkingPath(dir, gitRoot);
|
|
25224
25253
|
if (isSettingSourceEnabled("projectSettings") && !skipProject) {
|
|
25225
|
-
const projectPath =
|
|
25254
|
+
const projectPath = join7(dir, "CLAUDE.md");
|
|
25226
25255
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, includeExternal));
|
|
25227
|
-
const dotClaudePath =
|
|
25256
|
+
const dotClaudePath = join7(dir, ".claude", "CLAUDE.md");
|
|
25228
25257
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, includeExternal));
|
|
25229
|
-
const rulesDir =
|
|
25258
|
+
const rulesDir = join7(dir, ".claude", "rules");
|
|
25230
25259
|
result.push(...await processMdRules({
|
|
25231
25260
|
rulesDir,
|
|
25232
25261
|
type: "Project",
|
|
@@ -25236,18 +25265,18 @@ var init_claudemd = __esm(() => {
|
|
|
25236
25265
|
}));
|
|
25237
25266
|
}
|
|
25238
25267
|
if (isSettingSourceEnabled("localSettings")) {
|
|
25239
|
-
const localPath =
|
|
25268
|
+
const localPath = join7(dir, "CLAUDE.local.md");
|
|
25240
25269
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, includeExternal));
|
|
25241
25270
|
}
|
|
25242
25271
|
}
|
|
25243
25272
|
if (isEnvTruthy(process.env.CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD)) {
|
|
25244
25273
|
const additionalDirs = getAdditionalDirectoriesForClaudeMd();
|
|
25245
25274
|
for (const dir of additionalDirs) {
|
|
25246
|
-
const projectPath =
|
|
25275
|
+
const projectPath = join7(dir, "CLAUDE.md");
|
|
25247
25276
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, includeExternal));
|
|
25248
|
-
const dotClaudePath =
|
|
25277
|
+
const dotClaudePath = join7(dir, ".claude", "CLAUDE.md");
|
|
25249
25278
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, includeExternal));
|
|
25250
|
-
const rulesDir =
|
|
25279
|
+
const rulesDir = join7(dir, ".claude", "rules");
|
|
25251
25280
|
result.push(...await processMdRules({
|
|
25252
25281
|
rulesDir,
|
|
25253
25282
|
type: "Project",
|
|
@@ -30161,9 +30190,9 @@ var init_validate = __esm(() => {
|
|
|
30161
30190
|
});
|
|
30162
30191
|
|
|
30163
30192
|
// src/keybindings/loadUserBindings.ts
|
|
30164
|
-
import { readFileSync as
|
|
30193
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
30165
30194
|
import { readFile as readFile2, stat as stat2 } from "fs/promises";
|
|
30166
|
-
import { dirname as dirname6, join as
|
|
30195
|
+
import { dirname as dirname6, join as join8 } from "path";
|
|
30167
30196
|
function isKeybindingCustomizationEnabled() {
|
|
30168
30197
|
return getFeatureValue_CACHED_MAY_BE_STALE("tengu_keybinding_customization_release", false);
|
|
30169
30198
|
}
|
|
@@ -30186,7 +30215,7 @@ function isKeybindingBlockArray2(arr) {
|
|
|
30186
30215
|
return Array.isArray(arr) && arr.every(isKeybindingBlock2);
|
|
30187
30216
|
}
|
|
30188
30217
|
function getKeybindingsPath() {
|
|
30189
|
-
return
|
|
30218
|
+
return join8(getClaudeConfigHomeDir(), "keybindings.json");
|
|
30190
30219
|
}
|
|
30191
30220
|
function getDefaultParsedBindings() {
|
|
30192
30221
|
return parseBindings(DEFAULT_BINDINGS);
|
|
@@ -30284,7 +30313,7 @@ function loadKeybindingsSyncWithWarnings() {
|
|
|
30284
30313
|
}
|
|
30285
30314
|
const userPath = getKeybindingsPath();
|
|
30286
30315
|
try {
|
|
30287
|
-
const content =
|
|
30316
|
+
const content = readFileSync5(userPath, "utf-8");
|
|
30288
30317
|
const parsed = jsonParse(content);
|
|
30289
30318
|
let userBlocks;
|
|
30290
30319
|
if (typeof parsed === "object" && parsed !== null && "bindings" in parsed) {
|
|
@@ -36376,7 +36405,7 @@ var init_words = __esm(() => {
|
|
|
36376
36405
|
// src/utils/plans.ts
|
|
36377
36406
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
36378
36407
|
import { copyFile as copyFile2, writeFile as writeFile2 } from "fs/promises";
|
|
36379
|
-
import { join as
|
|
36408
|
+
import { join as join9, resolve as resolve3, sep as sep2 } from "path";
|
|
36380
36409
|
function getPlanSlug(sessionId) {
|
|
36381
36410
|
const id = sessionId ?? getSessionId();
|
|
36382
36411
|
const cache = getPlanSlugCache();
|
|
@@ -36385,7 +36414,7 @@ function getPlanSlug(sessionId) {
|
|
|
36385
36414
|
const plansDir = getPlansDirectory();
|
|
36386
36415
|
for (let i = 0;i < MAX_SLUG_RETRIES; i++) {
|
|
36387
36416
|
slug = generateWordSlug();
|
|
36388
|
-
const filePath =
|
|
36417
|
+
const filePath = join9(plansDir, `${slug}.md`);
|
|
36389
36418
|
if (!getFsImplementation().existsSync(filePath)) {
|
|
36390
36419
|
break;
|
|
36391
36420
|
}
|
|
@@ -36403,9 +36432,9 @@ function clearAllPlanSlugs() {
|
|
|
36403
36432
|
function getPlanFilePath(agentId) {
|
|
36404
36433
|
const planSlug = getPlanSlug(getSessionId());
|
|
36405
36434
|
if (!agentId) {
|
|
36406
|
-
return
|
|
36435
|
+
return join9(getPlansDirectory(), `${planSlug}.md`);
|
|
36407
36436
|
}
|
|
36408
|
-
return
|
|
36437
|
+
return join9(getPlansDirectory(), `${planSlug}-agent-${agentId}.md`);
|
|
36409
36438
|
}
|
|
36410
36439
|
function getPlan(agentId) {
|
|
36411
36440
|
const filePath = getPlanFilePath(agentId);
|
|
@@ -36428,7 +36457,7 @@ async function copyPlanForResume(log, targetSessionId) {
|
|
|
36428
36457
|
}
|
|
36429
36458
|
const sessionId = targetSessionId ?? getSessionId();
|
|
36430
36459
|
setPlanSlug(sessionId, slug);
|
|
36431
|
-
const planPath =
|
|
36460
|
+
const planPath = join9(getPlansDirectory(), `${slug}.md`);
|
|
36432
36461
|
try {
|
|
36433
36462
|
await getFsImplementation().readFile(planPath, { encoding: "utf-8" });
|
|
36434
36463
|
return true;
|
|
@@ -36471,9 +36500,9 @@ async function copyPlanForFork(log, targetSessionId) {
|
|
|
36471
36500
|
return false;
|
|
36472
36501
|
}
|
|
36473
36502
|
const plansDir = getPlansDirectory();
|
|
36474
|
-
const originalPlanPath =
|
|
36503
|
+
const originalPlanPath = join9(plansDir, `${originalSlug}.md`);
|
|
36475
36504
|
const newSlug = getPlanSlug(targetSessionId);
|
|
36476
|
-
const newPlanPath =
|
|
36505
|
+
const newPlanPath = join9(plansDir, `${newSlug}.md`);
|
|
36477
36506
|
try {
|
|
36478
36507
|
await copyFile2(originalPlanPath, newPlanPath);
|
|
36479
36508
|
return true;
|
|
@@ -36560,7 +36589,7 @@ async function persistFileSnapshotIfRemote() {
|
|
|
36560
36589
|
uuid: randomUUID3(),
|
|
36561
36590
|
snapshotFiles
|
|
36562
36591
|
};
|
|
36563
|
-
const { recordTranscript } = await import("./chunk-
|
|
36592
|
+
const { recordTranscript } = await import("./chunk-nms0csv3.js");
|
|
36564
36593
|
await recordTranscript([message]);
|
|
36565
36594
|
} catch (error) {
|
|
36566
36595
|
logError(error);
|
|
@@ -36589,12 +36618,12 @@ var init_plans = __esm(() => {
|
|
|
36589
36618
|
const resolved = resolve3(cwd, settingsDir);
|
|
36590
36619
|
if (!resolved.startsWith(cwd + sep2) && resolved !== cwd) {
|
|
36591
36620
|
logError(new Error(`plansDirectory must be within project root: ${settingsDir}`));
|
|
36592
|
-
plansPath =
|
|
36621
|
+
plansPath = join9(getClaudeConfigHomeDir(), "plans");
|
|
36593
36622
|
} else {
|
|
36594
36623
|
plansPath = resolved;
|
|
36595
36624
|
}
|
|
36596
36625
|
} else {
|
|
36597
|
-
plansPath =
|
|
36626
|
+
plansPath = join9(getClaudeConfigHomeDir(), "plans");
|
|
36598
36627
|
}
|
|
36599
36628
|
try {
|
|
36600
36629
|
getFsImplementation().mkdirSync(plansPath);
|
|
@@ -36731,37 +36760,37 @@ var init_capitalize = __esm(() => {
|
|
|
36731
36760
|
});
|
|
36732
36761
|
|
|
36733
36762
|
// src/utils/jetbrains.ts
|
|
36734
|
-
import { homedir as
|
|
36735
|
-
import { join as
|
|
36763
|
+
import { homedir as homedir4, platform } from "os";
|
|
36764
|
+
import { join as join10 } from "path";
|
|
36736
36765
|
function buildCommonPluginDirectoryPaths(ideName) {
|
|
36737
|
-
const homeDir =
|
|
36766
|
+
const homeDir = homedir4();
|
|
36738
36767
|
const directories = [];
|
|
36739
36768
|
const idePatterns = ideNameToDirMap[ideName.toLowerCase()];
|
|
36740
36769
|
if (!idePatterns) {
|
|
36741
36770
|
return directories;
|
|
36742
36771
|
}
|
|
36743
|
-
const appData = process.env.APPDATA ||
|
|
36744
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
36772
|
+
const appData = process.env.APPDATA || join10(homeDir, "AppData", "Roaming");
|
|
36773
|
+
const localAppData = process.env.LOCALAPPDATA || join10(homeDir, "AppData", "Local");
|
|
36745
36774
|
switch (platform()) {
|
|
36746
36775
|
case "darwin":
|
|
36747
|
-
directories.push(
|
|
36776
|
+
directories.push(join10(homeDir, "Library", "Application Support", "JetBrains"), join10(homeDir, "Library", "Application Support"));
|
|
36748
36777
|
if (ideName.toLowerCase() === "androidstudio") {
|
|
36749
|
-
directories.push(
|
|
36778
|
+
directories.push(join10(homeDir, "Library", "Application Support", "Google"));
|
|
36750
36779
|
}
|
|
36751
36780
|
break;
|
|
36752
36781
|
case "win32":
|
|
36753
|
-
directories.push(
|
|
36782
|
+
directories.push(join10(appData, "JetBrains"), join10(localAppData, "JetBrains"), join10(appData));
|
|
36754
36783
|
if (ideName.toLowerCase() === "androidstudio") {
|
|
36755
|
-
directories.push(
|
|
36784
|
+
directories.push(join10(localAppData, "Google"));
|
|
36756
36785
|
}
|
|
36757
36786
|
break;
|
|
36758
36787
|
case "linux":
|
|
36759
|
-
directories.push(
|
|
36788
|
+
directories.push(join10(homeDir, ".config", "JetBrains"), join10(homeDir, ".local", "share", "JetBrains"));
|
|
36760
36789
|
for (const pattern of idePatterns) {
|
|
36761
|
-
directories.push(
|
|
36790
|
+
directories.push(join10(homeDir, "." + pattern));
|
|
36762
36791
|
}
|
|
36763
36792
|
if (ideName.toLowerCase() === "androidstudio") {
|
|
36764
|
-
directories.push(
|
|
36793
|
+
directories.push(join10(homeDir, ".config", "Google"));
|
|
36765
36794
|
}
|
|
36766
36795
|
break;
|
|
36767
36796
|
default:
|
|
@@ -36787,12 +36816,12 @@ async function detectPluginDirectories(ideName) {
|
|
|
36787
36816
|
continue;
|
|
36788
36817
|
if (!entry.isDirectory() && !entry.isSymbolicLink())
|
|
36789
36818
|
continue;
|
|
36790
|
-
const dir =
|
|
36819
|
+
const dir = join10(baseDir, entry.name);
|
|
36791
36820
|
if (platform() === "linux") {
|
|
36792
36821
|
foundDirectories.push(dir);
|
|
36793
36822
|
continue;
|
|
36794
36823
|
}
|
|
36795
|
-
const pluginDir =
|
|
36824
|
+
const pluginDir = join10(dir, "plugins");
|
|
36796
36825
|
try {
|
|
36797
36826
|
await fs6.stat(pluginDir);
|
|
36798
36827
|
foundDirectories.push(pluginDir);
|
|
@@ -36808,7 +36837,7 @@ async function detectPluginDirectories(ideName) {
|
|
|
36808
36837
|
async function isJetBrainsPluginInstalled(ideType) {
|
|
36809
36838
|
const pluginDirs = await detectPluginDirectories(ideType);
|
|
36810
36839
|
for (const dir of pluginDirs) {
|
|
36811
|
-
const pluginPath =
|
|
36840
|
+
const pluginPath = join10(dir, PLUGIN_PREFIX);
|
|
36812
36841
|
try {
|
|
36813
36842
|
await getFsImplementation().stat(pluginPath);
|
|
36814
36843
|
return true;
|
|
@@ -37210,7 +37239,7 @@ var init_IdeOnboardingDialog = __esm(() => {
|
|
|
37210
37239
|
// src/utils/ide.ts
|
|
37211
37240
|
import { createConnection } from "net";
|
|
37212
37241
|
import * as os from "os";
|
|
37213
|
-
import { basename as basename3, join as
|
|
37242
|
+
import { basename as basename3, join as join11, sep as pathSeparator, resolve as resolve4 } from "path";
|
|
37214
37243
|
function isProcessRunning2(pid) {
|
|
37215
37244
|
try {
|
|
37216
37245
|
process.kill(pid, 0);
|
|
@@ -37254,7 +37283,7 @@ async function getSortedIdeLockfiles() {
|
|
|
37254
37283
|
const entries = await getFsImplementation().readdir(ideLockFilePath);
|
|
37255
37284
|
const lockEntries = entries.filter((file) => file.name.endsWith(".lock"));
|
|
37256
37285
|
const stats = await Promise.all(lockEntries.map(async (file) => {
|
|
37257
|
-
const fullPath =
|
|
37286
|
+
const fullPath = join11(ideLockFilePath, file.name);
|
|
37258
37287
|
try {
|
|
37259
37288
|
const fileStat = await getFsImplementation().stat(fullPath);
|
|
37260
37289
|
return { path: fullPath, mtime: fileStat.mtime };
|
|
@@ -37344,7 +37373,7 @@ async function checkIdeConnection(host, port, timeout = 500) {
|
|
|
37344
37373
|
}
|
|
37345
37374
|
}
|
|
37346
37375
|
async function getIdeLockfilesPaths() {
|
|
37347
|
-
const paths = [
|
|
37376
|
+
const paths = [join11(getClaudeConfigHomeDir(), "ide")];
|
|
37348
37377
|
if (getPlatform() !== "wsl") {
|
|
37349
37378
|
return paths;
|
|
37350
37379
|
}
|
|
@@ -37364,7 +37393,7 @@ async function getIdeLockfilesPaths() {
|
|
|
37364
37393
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
37365
37394
|
continue;
|
|
37366
37395
|
}
|
|
37367
|
-
paths.push(
|
|
37396
|
+
paths.push(join11(usersDir, user.name, ".claude", "ide"));
|
|
37368
37397
|
}
|
|
37369
37398
|
} catch (error) {
|
|
37370
37399
|
if (isFsInaccessible(error)) {
|
|
@@ -37848,7 +37877,7 @@ async function initializeIdeIntegration(onIdeDetected, ideToInstallExtension, on
|
|
|
37848
37877
|
}
|
|
37849
37878
|
}
|
|
37850
37879
|
async function installFromArtifactory(command) {
|
|
37851
|
-
const npmrcPath =
|
|
37880
|
+
const npmrcPath = join11(os.homedir(), ".npmrc");
|
|
37852
37881
|
let authToken = null;
|
|
37853
37882
|
const fs6 = getFsImplementation();
|
|
37854
37883
|
try {
|
|
@@ -37883,7 +37912,7 @@ async function installFromArtifactory(command) {
|
|
|
37883
37912
|
throw new Error("No version found in artifactory response");
|
|
37884
37913
|
}
|
|
37885
37914
|
const vsixUrl = `https://artifactory.infra.ant.dev/artifactory/armorcode-claude-code-internal/claude-vscode-releases/${version}/claude-code.vsix`;
|
|
37886
|
-
const tempVsixPath =
|
|
37915
|
+
const tempVsixPath = join11(os.tmpdir(), `claude-code-${version}-${Date.now()}.vsix`);
|
|
37887
37916
|
try {
|
|
37888
37917
|
const vsixResponse = await axios_default.get(vsixUrl, {
|
|
37889
37918
|
headers: {
|
|
@@ -39441,12 +39470,12 @@ var init_builtinPlugins = __esm(() => {
|
|
|
39441
39470
|
});
|
|
39442
39471
|
|
|
39443
39472
|
// src/utils/plugins/addDirPluginSettings.ts
|
|
39444
|
-
import { join as
|
|
39473
|
+
import { join as join12 } from "path";
|
|
39445
39474
|
function getAddDirEnabledPlugins() {
|
|
39446
39475
|
const result = {};
|
|
39447
39476
|
for (const dir of getAdditionalDirectoriesForClaudeMd()) {
|
|
39448
39477
|
for (const file of SETTINGS_FILES) {
|
|
39449
|
-
const { settings } = parseSettingsFile(
|
|
39478
|
+
const { settings } = parseSettingsFile(join12(dir, ".claude", file));
|
|
39450
39479
|
if (!settings?.enabledPlugins) {
|
|
39451
39480
|
continue;
|
|
39452
39481
|
}
|
|
@@ -39459,7 +39488,7 @@ function getAddDirExtraMarketplaces() {
|
|
|
39459
39488
|
const result = {};
|
|
39460
39489
|
for (const dir of getAdditionalDirectoriesForClaudeMd()) {
|
|
39461
39490
|
for (const file of SETTINGS_FILES) {
|
|
39462
|
-
const { settings } = parseSettingsFile(
|
|
39491
|
+
const { settings } = parseSettingsFile(join12(dir, ".claude", file));
|
|
39463
39492
|
if (!settings?.extraKnownMarketplaces) {
|
|
39464
39493
|
continue;
|
|
39465
39494
|
}
|
|
@@ -41084,7 +41113,7 @@ var init_readOnlyCommandValidation = __esm(() => {
|
|
|
41084
41113
|
});
|
|
41085
41114
|
|
|
41086
41115
|
// src/utils/permissions/pathValidation.ts
|
|
41087
|
-
import { homedir as
|
|
41116
|
+
import { homedir as homedir6 } from "os";
|
|
41088
41117
|
import { dirname as dirname7, isAbsolute as isAbsolute3, resolve as resolve5 } from "path";
|
|
41089
41118
|
function formatDirectoryList(directories) {
|
|
41090
41119
|
const dirCount = directories.length;
|
|
@@ -41107,7 +41136,7 @@ function getGlobBaseDirectory(path4) {
|
|
|
41107
41136
|
}
|
|
41108
41137
|
function expandTilde(path4) {
|
|
41109
41138
|
if (path4 === "~" || path4.startsWith("~/") || process.platform === "win32" && path4.startsWith("~\\")) {
|
|
41110
|
-
return
|
|
41139
|
+
return homedir6() + path4.slice(1);
|
|
41111
41140
|
}
|
|
41112
41141
|
return path4;
|
|
41113
41142
|
}
|
|
@@ -41225,7 +41254,7 @@ function isDangerousRemovalPath(resolvedPath) {
|
|
|
41225
41254
|
if (WINDOWS_DRIVE_ROOT_REGEX.test(normalizedPath)) {
|
|
41226
41255
|
return true;
|
|
41227
41256
|
}
|
|
41228
|
-
const normalizedHome =
|
|
41257
|
+
const normalizedHome = homedir6().replace(/[\\/]+/g, "/");
|
|
41229
41258
|
if (normalizedPath === normalizedHome) {
|
|
41230
41259
|
return true;
|
|
41231
41260
|
}
|
|
@@ -41310,7 +41339,7 @@ var init_pathValidation = __esm(() => {
|
|
|
41310
41339
|
// src/utils/plugins/pluginDirectories.ts
|
|
41311
41340
|
import { mkdirSync } from "fs";
|
|
41312
41341
|
import { readdir as readdir2, rm, stat as stat3 } from "fs/promises";
|
|
41313
|
-
import { delimiter, join as
|
|
41342
|
+
import { delimiter, join as join13 } from "path";
|
|
41314
41343
|
function getPluginsDirectoryName() {
|
|
41315
41344
|
if (getUseCoworkPlugins()) {
|
|
41316
41345
|
return COWORK_PLUGINS_DIR;
|
|
@@ -41325,7 +41354,7 @@ function getPluginsDirectory() {
|
|
|
41325
41354
|
if (envOverride) {
|
|
41326
41355
|
return expandTilde(envOverride);
|
|
41327
41356
|
}
|
|
41328
|
-
return
|
|
41357
|
+
return join13(getClaudeConfigHomeDir(), getPluginsDirectoryName());
|
|
41329
41358
|
}
|
|
41330
41359
|
function getPluginSeedDirs() {
|
|
41331
41360
|
const raw = process.env.CLAUDE_CODE_PLUGIN_SEED_DIR;
|
|
@@ -41337,7 +41366,7 @@ function sanitizePluginId(pluginId) {
|
|
|
41337
41366
|
return pluginId.replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
41338
41367
|
}
|
|
41339
41368
|
function pluginDataDirPath(pluginId) {
|
|
41340
|
-
return
|
|
41369
|
+
return join13(getPluginsDirectory(), "data", sanitizePluginId(pluginId));
|
|
41341
41370
|
}
|
|
41342
41371
|
function getPluginDataDir(pluginId) {
|
|
41343
41372
|
const dir = pluginDataDirPath(pluginId);
|
|
@@ -41349,7 +41378,7 @@ async function getPluginDataDirSize(pluginId) {
|
|
|
41349
41378
|
let bytes = 0;
|
|
41350
41379
|
const walk = async (p) => {
|
|
41351
41380
|
for (const entry of await readdir2(p, { withFileTypes: true })) {
|
|
41352
|
-
const full =
|
|
41381
|
+
const full = join13(p, entry.name);
|
|
41353
41382
|
if (entry.isDirectory()) {
|
|
41354
41383
|
await walk(full);
|
|
41355
41384
|
} else {
|
|
@@ -41525,26 +41554,26 @@ var init_zip = __esm(() => {
|
|
|
41525
41554
|
});
|
|
41526
41555
|
|
|
41527
41556
|
// src/utils/systemDirectories.ts
|
|
41528
|
-
import { homedir as
|
|
41529
|
-
import { join as
|
|
41557
|
+
import { homedir as homedir7 } from "os";
|
|
41558
|
+
import { join as join14 } from "path";
|
|
41530
41559
|
function getSystemDirectories(options) {
|
|
41531
41560
|
const platform2 = options?.platform ?? getPlatform();
|
|
41532
|
-
const homeDir = options?.homedir ??
|
|
41561
|
+
const homeDir = options?.homedir ?? homedir7();
|
|
41533
41562
|
const env2 = options?.env ?? process.env;
|
|
41534
41563
|
const defaults = {
|
|
41535
41564
|
HOME: homeDir,
|
|
41536
|
-
DESKTOP:
|
|
41537
|
-
DOCUMENTS:
|
|
41538
|
-
DOWNLOADS:
|
|
41565
|
+
DESKTOP: join14(homeDir, "Desktop"),
|
|
41566
|
+
DOCUMENTS: join14(homeDir, "Documents"),
|
|
41567
|
+
DOWNLOADS: join14(homeDir, "Downloads")
|
|
41539
41568
|
};
|
|
41540
41569
|
switch (platform2) {
|
|
41541
41570
|
case "windows": {
|
|
41542
41571
|
const userProfile = env2.USERPROFILE || homeDir;
|
|
41543
41572
|
return {
|
|
41544
41573
|
HOME: homeDir,
|
|
41545
|
-
DESKTOP:
|
|
41546
|
-
DOCUMENTS:
|
|
41547
|
-
DOWNLOADS:
|
|
41574
|
+
DESKTOP: join14(userProfile, "Desktop"),
|
|
41575
|
+
DOCUMENTS: join14(userProfile, "Documents"),
|
|
41576
|
+
DOWNLOADS: join14(userProfile, "Downloads")
|
|
41548
41577
|
};
|
|
41549
41578
|
}
|
|
41550
41579
|
case "linux":
|
|
@@ -41573,7 +41602,7 @@ var init_systemDirectories = __esm(() => {
|
|
|
41573
41602
|
// src/utils/plugins/mcpbHandler.ts
|
|
41574
41603
|
import { createHash } from "crypto";
|
|
41575
41604
|
import { chmod, writeFile as writeFile3 } from "fs/promises";
|
|
41576
|
-
import { dirname as dirname8, join as
|
|
41605
|
+
import { dirname as dirname8, join as join15 } from "path";
|
|
41577
41606
|
function isMcpbSource(source) {
|
|
41578
41607
|
return source.endsWith(".mcpb") || source.endsWith(".dxt");
|
|
41579
41608
|
}
|
|
@@ -41584,11 +41613,11 @@ function generateContentHash(data) {
|
|
|
41584
41613
|
return createHash("sha256").update(data).digest("hex").substring(0, 16);
|
|
41585
41614
|
}
|
|
41586
41615
|
function getMcpbCacheDir(pluginPath) {
|
|
41587
|
-
return
|
|
41616
|
+
return join15(pluginPath, ".mcpb-cache");
|
|
41588
41617
|
}
|
|
41589
41618
|
function getMetadataPath(cacheDir, source) {
|
|
41590
41619
|
const sourceHash = createHash("md5").update(source).digest("hex").substring(0, 8);
|
|
41591
|
-
return
|
|
41620
|
+
return join15(cacheDir, `${sourceHash}.metadata.json`);
|
|
41592
41621
|
}
|
|
41593
41622
|
function serverSecretsKey(pluginId, serverName) {
|
|
41594
41623
|
return `${pluginId}/${serverName}`;
|
|
@@ -41808,7 +41837,7 @@ async function extractMcpbContents(unzipped, extractPath, modes, onProgress) {
|
|
|
41808
41837
|
const entries = Object.entries(unzipped).filter(([k2]) => !k2.endsWith("/"));
|
|
41809
41838
|
const totalFiles = entries.length;
|
|
41810
41839
|
for (const [filePath, fileData] of entries) {
|
|
41811
|
-
const fullPath =
|
|
41840
|
+
const fullPath = join15(extractPath, filePath);
|
|
41812
41841
|
const dir = dirname8(fullPath);
|
|
41813
41842
|
if (dir !== extractPath) {
|
|
41814
41843
|
await getFsImplementation().mkdir(dir);
|
|
@@ -41853,7 +41882,7 @@ async function checkMcpbChanged(source, pluginPath) {
|
|
|
41853
41882
|
return true;
|
|
41854
41883
|
}
|
|
41855
41884
|
if (!isUrl(source)) {
|
|
41856
|
-
const localPath =
|
|
41885
|
+
const localPath = join15(pluginPath, source);
|
|
41857
41886
|
let stats;
|
|
41858
41887
|
try {
|
|
41859
41888
|
stats = await fs6.stat(localPath);
|
|
@@ -41883,7 +41912,7 @@ async function loadMcpbFile(source, pluginPath, pluginId, onProgress, providedUs
|
|
|
41883
41912
|
const metadata = await loadCacheMetadata(cacheDir, source);
|
|
41884
41913
|
if (metadata && !await checkMcpbChanged(source, pluginPath)) {
|
|
41885
41914
|
logForDebugging(`Using cached MCPB from ${metadata.extractedPath} (hash: ${metadata.contentHash})`);
|
|
41886
|
-
const manifestPath =
|
|
41915
|
+
const manifestPath = join15(metadata.extractedPath, "manifest.json");
|
|
41887
41916
|
let manifestContent;
|
|
41888
41917
|
try {
|
|
41889
41918
|
manifestContent = await fs6.readFile(manifestPath, { encoding: "utf-8" });
|
|
@@ -41936,10 +41965,10 @@ async function loadMcpbFile(source, pluginPath, pluginId, onProgress, providedUs
|
|
|
41936
41965
|
let mcpbFilePath;
|
|
41937
41966
|
if (isUrl(source)) {
|
|
41938
41967
|
const sourceHash = createHash("md5").update(source).digest("hex").substring(0, 8);
|
|
41939
|
-
mcpbFilePath =
|
|
41968
|
+
mcpbFilePath = join15(cacheDir, `${sourceHash}.mcpb`);
|
|
41940
41969
|
mcpbData = await downloadMcpb(source, mcpbFilePath, onProgress);
|
|
41941
41970
|
} else {
|
|
41942
|
-
const localPath =
|
|
41971
|
+
const localPath = join15(pluginPath, source);
|
|
41943
41972
|
if (onProgress) {
|
|
41944
41973
|
onProgress(`Loading ${source}...`);
|
|
41945
41974
|
}
|
|
@@ -41975,7 +42004,7 @@ async function loadMcpbFile(source, pluginPath, pluginId, onProgress, providedUs
|
|
|
41975
42004
|
logError(error);
|
|
41976
42005
|
throw error;
|
|
41977
42006
|
}
|
|
41978
|
-
const extractPath =
|
|
42007
|
+
const extractPath = join15(cacheDir, contentHash);
|
|
41979
42008
|
await extractMcpbContents(unzipped, extractPath, modes, onProgress);
|
|
41980
42009
|
if (manifest.user_config && Object.keys(manifest.user_config).length > 0) {
|
|
41981
42010
|
const serverName = manifest.name;
|
|
@@ -42221,7 +42250,7 @@ var init_pluginOptionsStorage = __esm(() => {
|
|
|
42221
42250
|
});
|
|
42222
42251
|
|
|
42223
42252
|
// src/utils/plugins/walkPluginMarkdown.ts
|
|
42224
|
-
import { join as
|
|
42253
|
+
import { join as join16 } from "path";
|
|
42225
42254
|
async function walkPluginMarkdown(rootDir, onFile, opts = {}) {
|
|
42226
42255
|
const fs6 = getFsImplementation();
|
|
42227
42256
|
const label = opts.logLabel ?? "plugin";
|
|
@@ -42229,11 +42258,11 @@ async function walkPluginMarkdown(rootDir, onFile, opts = {}) {
|
|
|
42229
42258
|
try {
|
|
42230
42259
|
const entries = await fs6.readdir(dirPath);
|
|
42231
42260
|
if (opts.stopAtSkillDir && entries.some((e) => e.isFile() && SKILL_MD_RE.test(e.name))) {
|
|
42232
|
-
await Promise.all(entries.map((entry) => entry.isFile() && entry.name.toLowerCase().endsWith(".md") ? onFile(
|
|
42261
|
+
await Promise.all(entries.map((entry) => entry.isFile() && entry.name.toLowerCase().endsWith(".md") ? onFile(join16(dirPath, entry.name), namespace) : undefined));
|
|
42233
42262
|
return;
|
|
42234
42263
|
}
|
|
42235
42264
|
await Promise.all(entries.map((entry) => {
|
|
42236
|
-
const fullPath =
|
|
42265
|
+
const fullPath = join16(dirPath, entry.name);
|
|
42237
42266
|
if (entry.isDirectory()) {
|
|
42238
42267
|
return scan(fullPath, [...namespace, entry.name]);
|
|
42239
42268
|
}
|
|
@@ -42256,7 +42285,7 @@ var init_walkPluginMarkdown = __esm(() => {
|
|
|
42256
42285
|
});
|
|
42257
42286
|
|
|
42258
42287
|
// src/utils/plugins/loadPluginCommands.ts
|
|
42259
|
-
import { basename as basename4, dirname as dirname9, join as
|
|
42288
|
+
import { basename as basename4, dirname as dirname9, join as join17 } from "path";
|
|
42260
42289
|
function isSkillFile(filePath) {
|
|
42261
42290
|
return /^skill\.md$/i.test(basename4(filePath));
|
|
42262
42291
|
}
|
|
@@ -42435,7 +42464,7 @@ function clearPluginCommandCache() {
|
|
|
42435
42464
|
async function loadSkillsFromDirectory(skillsPath, pluginName, sourceName, pluginManifest, pluginPath, loadedPaths) {
|
|
42436
42465
|
const fs6 = getFsImplementation();
|
|
42437
42466
|
const skills = [];
|
|
42438
|
-
const directSkillPath =
|
|
42467
|
+
const directSkillPath = join17(skillsPath, "SKILL.md");
|
|
42439
42468
|
let directSkillContent = null;
|
|
42440
42469
|
try {
|
|
42441
42470
|
directSkillContent = await fs6.readFile(directSkillPath, {
|
|
@@ -42486,8 +42515,8 @@ async function loadSkillsFromDirectory(skillsPath, pluginName, sourceName, plugi
|
|
|
42486
42515
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
42487
42516
|
return;
|
|
42488
42517
|
}
|
|
42489
|
-
const skillDirPath =
|
|
42490
|
-
const skillFilePath =
|
|
42518
|
+
const skillDirPath = join17(skillsPath, entry.name);
|
|
42519
|
+
const skillFilePath = join17(skillDirPath, "SKILL.md");
|
|
42491
42520
|
let content;
|
|
42492
42521
|
try {
|
|
42493
42522
|
content = await fs6.readFile(skillFilePath, { encoding: "utf-8" });
|
|
@@ -42592,7 +42621,7 @@ var init_loadPluginCommands = __esm(() => {
|
|
|
42592
42621
|
if (plugin.commandsMetadata) {
|
|
42593
42622
|
for (const [name, metadata] of Object.entries(plugin.commandsMetadata)) {
|
|
42594
42623
|
if (metadata.source) {
|
|
42595
|
-
const fullMetadataPath =
|
|
42624
|
+
const fullMetadataPath = join17(plugin.path, metadata.source);
|
|
42596
42625
|
if (commandPath === fullMetadataPath) {
|
|
42597
42626
|
commandName = `${plugin.name}:${name}`;
|
|
42598
42627
|
metadataOverride = metadata;
|
|
@@ -43012,7 +43041,7 @@ import {
|
|
|
43012
43041
|
writeFile as writeFile4
|
|
43013
43042
|
} from "fs/promises";
|
|
43014
43043
|
import { tmpdir as tmpdir3 } from "os";
|
|
43015
|
-
import { basename as basename6, dirname as dirname10, join as
|
|
43044
|
+
import { basename as basename6, dirname as dirname10, join as join18 } from "path";
|
|
43016
43045
|
function isPluginZipCacheEnabled() {
|
|
43017
43046
|
return isEnvTruthy(process.env.CLAUDE_CODE_PLUGIN_USE_ZIP_CACHE);
|
|
43018
43047
|
}
|
|
@@ -43028,21 +43057,21 @@ function getZipCacheKnownMarketplacesPath() {
|
|
|
43028
43057
|
if (!cachePath) {
|
|
43029
43058
|
throw new Error("Plugin zip cache is not enabled");
|
|
43030
43059
|
}
|
|
43031
|
-
return
|
|
43060
|
+
return join18(cachePath, "known_marketplaces.json");
|
|
43032
43061
|
}
|
|
43033
43062
|
function getZipCacheMarketplacesDir() {
|
|
43034
43063
|
const cachePath = getPluginZipCachePath();
|
|
43035
43064
|
if (!cachePath) {
|
|
43036
43065
|
throw new Error("Plugin zip cache is not enabled");
|
|
43037
43066
|
}
|
|
43038
|
-
return
|
|
43067
|
+
return join18(cachePath, "marketplaces");
|
|
43039
43068
|
}
|
|
43040
43069
|
function getZipCachePluginsDir() {
|
|
43041
43070
|
const cachePath = getPluginZipCachePath();
|
|
43042
43071
|
if (!cachePath) {
|
|
43043
43072
|
throw new Error("Plugin zip cache is not enabled");
|
|
43044
43073
|
}
|
|
43045
|
-
return
|
|
43074
|
+
return join18(cachePath, "plugins");
|
|
43046
43075
|
}
|
|
43047
43076
|
async function getSessionPluginCachePath() {
|
|
43048
43077
|
if (sessionPluginCachePath) {
|
|
@@ -43051,7 +43080,7 @@ async function getSessionPluginCachePath() {
|
|
|
43051
43080
|
if (!sessionPluginCachePromise) {
|
|
43052
43081
|
sessionPluginCachePromise = (async () => {
|
|
43053
43082
|
const suffix = randomBytes3(8).toString("hex");
|
|
43054
|
-
const dir =
|
|
43083
|
+
const dir = join18(tmpdir3(), `claude-plugin-session-${suffix}`);
|
|
43055
43084
|
await getFsImplementation().mkdir(dir);
|
|
43056
43085
|
sessionPluginCachePath = dir;
|
|
43057
43086
|
logForDebugging(`Created session plugin cache at ${dir}`);
|
|
@@ -43078,7 +43107,7 @@ async function atomicWriteToZipCache(targetPath, data) {
|
|
|
43078
43107
|
const dir = dirname10(targetPath);
|
|
43079
43108
|
await getFsImplementation().mkdir(dir);
|
|
43080
43109
|
const tmpName = `.${basename6(targetPath)}.tmp.${randomBytes3(4).toString("hex")}`;
|
|
43081
|
-
const tmpPath =
|
|
43110
|
+
const tmpPath = join18(dir, tmpName);
|
|
43082
43111
|
try {
|
|
43083
43112
|
if (typeof data === "string") {
|
|
43084
43113
|
await writeFile4(tmpPath, data, { encoding: "utf-8" });
|
|
@@ -43103,7 +43132,7 @@ async function createZipFromDirectory(sourceDir) {
|
|
|
43103
43132
|
return zipData;
|
|
43104
43133
|
}
|
|
43105
43134
|
async function collectFilesForZip(baseDir, relativePath, files, visited) {
|
|
43106
|
-
const currentDir = relativePath ?
|
|
43135
|
+
const currentDir = relativePath ? join18(baseDir, relativePath) : baseDir;
|
|
43107
43136
|
let entries;
|
|
43108
43137
|
try {
|
|
43109
43138
|
entries = await readdir3(currentDir);
|
|
@@ -43127,7 +43156,7 @@ async function collectFilesForZip(baseDir, relativePath, files, visited) {
|
|
|
43127
43156
|
if (entry === ".git") {
|
|
43128
43157
|
continue;
|
|
43129
43158
|
}
|
|
43130
|
-
const fullPath =
|
|
43159
|
+
const fullPath = join18(currentDir, entry);
|
|
43131
43160
|
const relPath = relativePath ? `${relativePath}/${entry}` : entry;
|
|
43132
43161
|
let fileStat;
|
|
43133
43162
|
try {
|
|
@@ -43168,10 +43197,10 @@ async function extractZipToDirectory(zipPath, targetDir) {
|
|
|
43168
43197
|
await getFsImplementation().mkdir(targetDir);
|
|
43169
43198
|
for (const [relPath, data] of Object.entries(files)) {
|
|
43170
43199
|
if (relPath.endsWith("/")) {
|
|
43171
|
-
await getFsImplementation().mkdir(
|
|
43200
|
+
await getFsImplementation().mkdir(join18(targetDir, relPath));
|
|
43172
43201
|
continue;
|
|
43173
43202
|
}
|
|
43174
|
-
const fullPath =
|
|
43203
|
+
const fullPath = join18(targetDir, relPath);
|
|
43175
43204
|
await getFsImplementation().mkdir(dirname10(fullPath));
|
|
43176
43205
|
await writeFile4(fullPath, data);
|
|
43177
43206
|
const mode = modes[relPath];
|
|
@@ -43188,7 +43217,7 @@ async function convertDirectoryToZipInPlace(dirPath, zipPath) {
|
|
|
43188
43217
|
}
|
|
43189
43218
|
function getMarketplaceJsonRelativePath(marketplaceName) {
|
|
43190
43219
|
const sanitized = marketplaceName.replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
43191
|
-
return
|
|
43220
|
+
return join18("marketplaces", `${sanitized}.json`);
|
|
43192
43221
|
}
|
|
43193
43222
|
function isMarketplaceSourceSupportedByZipCache(source) {
|
|
43194
43223
|
return ["github", "git", "url", "settings"].includes(source.source);
|
|
@@ -43204,7 +43233,7 @@ var init_zipCache = __esm(() => {
|
|
|
43204
43233
|
|
|
43205
43234
|
// src/utils/plugins/cacheUtils.ts
|
|
43206
43235
|
import { readdir as readdir4, rm as rm3, stat as stat5, unlink, writeFile as writeFile5 } from "fs/promises";
|
|
43207
|
-
import { join as
|
|
43236
|
+
import { join as join19 } from "path";
|
|
43208
43237
|
function clearAllPluginCaches() {
|
|
43209
43238
|
clearPluginCache();
|
|
43210
43239
|
clearPluginCommandCache();
|
|
@@ -43241,11 +43270,11 @@ async function cleanupOrphanedPluginVersionsInBackground() {
|
|
|
43241
43270
|
const now = Date.now();
|
|
43242
43271
|
await Promise.all([...installedVersions].map((p) => removeOrphanedAtMarker(p)));
|
|
43243
43272
|
for (const marketplace of await readSubdirs(cachePath)) {
|
|
43244
|
-
const marketplacePath =
|
|
43273
|
+
const marketplacePath = join19(cachePath, marketplace);
|
|
43245
43274
|
for (const plugin of await readSubdirs(marketplacePath)) {
|
|
43246
|
-
const pluginPath =
|
|
43275
|
+
const pluginPath = join19(marketplacePath, plugin);
|
|
43247
43276
|
for (const version of await readSubdirs(pluginPath)) {
|
|
43248
|
-
const versionPath =
|
|
43277
|
+
const versionPath = join19(pluginPath, version);
|
|
43249
43278
|
if (installedVersions.has(versionPath))
|
|
43250
43279
|
continue;
|
|
43251
43280
|
await processOrphanedPluginVersion(versionPath, now);
|
|
@@ -43259,7 +43288,7 @@ async function cleanupOrphanedPluginVersionsInBackground() {
|
|
|
43259
43288
|
}
|
|
43260
43289
|
}
|
|
43261
43290
|
function getOrphanedAtPath(versionPath) {
|
|
43262
|
-
return
|
|
43291
|
+
return join19(versionPath, ORPHANED_AT_FILENAME);
|
|
43263
43292
|
}
|
|
43264
43293
|
async function removeOrphanedAtMarker(versionPath) {
|
|
43265
43294
|
const orphanedAtPath = getOrphanedAtPath(versionPath);
|
|
@@ -43662,7 +43691,7 @@ var init_marketplaceHelpers = __esm(() => {
|
|
|
43662
43691
|
|
|
43663
43692
|
// src/utils/plugins/officialMarketplaceGcs.ts
|
|
43664
43693
|
import { chmod as chmod3, mkdir as mkdir3, readFile as readFile5, rename as rename2, rm as rm4, writeFile as writeFile6 } from "fs/promises";
|
|
43665
|
-
import { dirname as dirname11, join as
|
|
43694
|
+
import { dirname as dirname11, join as join20, resolve as resolve6, sep as sep3 } from "path";
|
|
43666
43695
|
async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCacheDir) {
|
|
43667
43696
|
const cacheDir = resolve6(marketplacesCacheDir);
|
|
43668
43697
|
const resolvedLoc = resolve6(installLocation);
|
|
@@ -43685,7 +43714,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
43685
43714
|
if (!sha) {
|
|
43686
43715
|
throw new Error("latest pointer returned empty body");
|
|
43687
43716
|
}
|
|
43688
|
-
const sentinelPath =
|
|
43717
|
+
const sentinelPath = join20(installLocation, ".gcs-sha");
|
|
43689
43718
|
const currentSha = await readFile5(sentinelPath, "utf8").then((s) => s.trim(), () => null);
|
|
43690
43719
|
if (currentSha === sha) {
|
|
43691
43720
|
outcome = "noop";
|
|
@@ -43708,7 +43737,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
43708
43737
|
const rel = arcPath.slice(ARC_PREFIX.length);
|
|
43709
43738
|
if (!rel || rel.endsWith("/"))
|
|
43710
43739
|
continue;
|
|
43711
|
-
const dest =
|
|
43740
|
+
const dest = join20(staging, rel);
|
|
43712
43741
|
await mkdir3(dirname11(dest), { recursive: true });
|
|
43713
43742
|
await writeFile6(dest, data);
|
|
43714
43743
|
const mode = modes[arcPath];
|
|
@@ -43716,7 +43745,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
43716
43745
|
await chmod3(dest, mode & 511).catch(() => {});
|
|
43717
43746
|
}
|
|
43718
43747
|
}
|
|
43719
|
-
await writeFile6(
|
|
43748
|
+
await writeFile6(join20(staging, ".gcs-sha"), sha);
|
|
43720
43749
|
await rm4(installLocation, { recursive: true, force: true });
|
|
43721
43750
|
await rename2(staging, installLocation);
|
|
43722
43751
|
outcome = "updated";
|
|
@@ -43783,12 +43812,12 @@ var init_officialMarketplaceGcs = __esm(() => {
|
|
|
43783
43812
|
|
|
43784
43813
|
// src/utils/plugins/marketplaceManager.ts
|
|
43785
43814
|
import { writeFile as writeFile7 } from "fs/promises";
|
|
43786
|
-
import { basename as basename7, dirname as dirname12, isAbsolute as isAbsolute5, join as
|
|
43815
|
+
import { basename as basename7, dirname as dirname12, isAbsolute as isAbsolute5, join as join21, resolve as resolve7, sep as sep4 } from "path";
|
|
43787
43816
|
function getKnownMarketplacesFile() {
|
|
43788
|
-
return
|
|
43817
|
+
return join21(getPluginsDirectory(), "known_marketplaces.json");
|
|
43789
43818
|
}
|
|
43790
43819
|
function getMarketplacesCacheDir() {
|
|
43791
|
-
return
|
|
43820
|
+
return join21(getPluginsDirectory(), "marketplaces");
|
|
43792
43821
|
}
|
|
43793
43822
|
function clearMarketplacesCache() {
|
|
43794
43823
|
getMarketplace.cache?.clear?.();
|
|
@@ -43875,7 +43904,7 @@ async function saveKnownMarketplacesConfig(config2) {
|
|
|
43875
43904
|
throw new ConfigParseError(`Invalid marketplace config: ${parsed.error.message}`, configFile, config2);
|
|
43876
43905
|
}
|
|
43877
43906
|
const fs6 = getFsImplementation();
|
|
43878
|
-
const dir =
|
|
43907
|
+
const dir = join21(configFile, "..");
|
|
43879
43908
|
await fs6.mkdir(dir);
|
|
43880
43909
|
writeFileSync_DEPRECATED(configFile, jsonStringify(parsed.data, null, 2), {
|
|
43881
43910
|
encoding: "utf-8",
|
|
@@ -43922,7 +43951,7 @@ async function registerSeedMarketplaces() {
|
|
|
43922
43951
|
return false;
|
|
43923
43952
|
}
|
|
43924
43953
|
async function readSeedKnownMarketplaces(seedDir) {
|
|
43925
|
-
const seedJsonPath =
|
|
43954
|
+
const seedJsonPath = join21(seedDir, "known_marketplaces.json");
|
|
43926
43955
|
try {
|
|
43927
43956
|
const content = await getFsImplementation().readFile(seedJsonPath, {
|
|
43928
43957
|
encoding: "utf-8"
|
|
@@ -43941,8 +43970,8 @@ async function readSeedKnownMarketplaces(seedDir) {
|
|
|
43941
43970
|
}
|
|
43942
43971
|
}
|
|
43943
43972
|
async function findSeedMarketplaceLocation(seedDir, name) {
|
|
43944
|
-
const dirCandidate =
|
|
43945
|
-
const jsonCandidate =
|
|
43973
|
+
const dirCandidate = join21(seedDir, "marketplaces", name);
|
|
43974
|
+
const jsonCandidate = join21(seedDir, "marketplaces", `${name}.json`);
|
|
43946
43975
|
for (const candidate of [dirCandidate, jsonCandidate]) {
|
|
43947
43976
|
try {
|
|
43948
43977
|
await readCachedMarketplace(candidate);
|
|
@@ -43994,7 +44023,7 @@ async function gitPull(cwd, ref, options) {
|
|
|
43994
44023
|
async function gitSubmoduleUpdate(cwd, credentialArgs, env2, sparsePaths) {
|
|
43995
44024
|
if (sparsePaths && sparsePaths.length > 0)
|
|
43996
44025
|
return;
|
|
43997
|
-
const hasGitmodules = await getFsImplementation().stat(
|
|
44026
|
+
const hasGitmodules = await getFsImplementation().stat(join21(cwd, ".gitmodules")).then(() => true, () => false);
|
|
43998
44027
|
if (!hasGitmodules)
|
|
43999
44028
|
return;
|
|
44000
44029
|
const result = await execFileNoThrowWithCwd(gitExe(), [
|
|
@@ -44356,7 +44385,7 @@ Technical details: ${error.message}`);
|
|
|
44356
44385
|
}
|
|
44357
44386
|
logPluginFetch("marketplace_url", url2, "success", performance.now() - fetchStarted);
|
|
44358
44387
|
safeCallProgress(onProgress, "Saving marketplace to cache");
|
|
44359
|
-
const cacheDir =
|
|
44388
|
+
const cacheDir = join21(cachePath, "..");
|
|
44360
44389
|
await fs6.mkdir(cacheDir);
|
|
44361
44390
|
writeFileSync_DEPRECATED(cachePath, jsonStringify(result.data, null, 2), {
|
|
44362
44391
|
encoding: "utf-8",
|
|
@@ -44393,7 +44422,7 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
44393
44422
|
try {
|
|
44394
44423
|
switch (source.source) {
|
|
44395
44424
|
case "url": {
|
|
44396
|
-
temporaryCachePath =
|
|
44425
|
+
temporaryCachePath = join21(cacheDir, `${tempName}.json`);
|
|
44397
44426
|
cleanupNeeded = true;
|
|
44398
44427
|
await cacheMarketplaceFromUrl(source.url, temporaryCachePath, source.headers, onProgress);
|
|
44399
44428
|
marketplacePath = temporaryCachePath;
|
|
@@ -44402,7 +44431,7 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
44402
44431
|
case "github": {
|
|
44403
44432
|
const sshUrl = `git@github.com:${source.repo}.git`;
|
|
44404
44433
|
const httpsUrl = `https://github.com/${source.repo}.git`;
|
|
44405
|
-
temporaryCachePath =
|
|
44434
|
+
temporaryCachePath = join21(cacheDir, tempName);
|
|
44406
44435
|
cleanupNeeded = true;
|
|
44407
44436
|
let lastError = null;
|
|
44408
44437
|
const sshConfigured = await isGitHubSshLikelyConfigured();
|
|
@@ -44447,14 +44476,14 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
44447
44476
|
if (lastError) {
|
|
44448
44477
|
throw lastError;
|
|
44449
44478
|
}
|
|
44450
|
-
marketplacePath =
|
|
44479
|
+
marketplacePath = join21(temporaryCachePath, source.path || ".claude-plugin/marketplace.json");
|
|
44451
44480
|
break;
|
|
44452
44481
|
}
|
|
44453
44482
|
case "git": {
|
|
44454
|
-
temporaryCachePath =
|
|
44483
|
+
temporaryCachePath = join21(cacheDir, tempName);
|
|
44455
44484
|
cleanupNeeded = true;
|
|
44456
44485
|
await cacheMarketplaceFromGit(source.url, temporaryCachePath, source.ref, source.sparsePaths, onProgress);
|
|
44457
|
-
marketplacePath =
|
|
44486
|
+
marketplacePath = join21(temporaryCachePath, source.path || ".claude-plugin/marketplace.json");
|
|
44458
44487
|
break;
|
|
44459
44488
|
}
|
|
44460
44489
|
case "npm": {
|
|
@@ -44469,14 +44498,14 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
44469
44498
|
}
|
|
44470
44499
|
case "directory": {
|
|
44471
44500
|
const absPath = resolve7(source.path);
|
|
44472
|
-
marketplacePath =
|
|
44501
|
+
marketplacePath = join21(absPath, ".claude-plugin", "marketplace.json");
|
|
44473
44502
|
temporaryCachePath = absPath;
|
|
44474
44503
|
cleanupNeeded = false;
|
|
44475
44504
|
break;
|
|
44476
44505
|
}
|
|
44477
44506
|
case "settings": {
|
|
44478
|
-
temporaryCachePath =
|
|
44479
|
-
marketplacePath =
|
|
44507
|
+
temporaryCachePath = join21(cacheDir, source.name);
|
|
44508
|
+
marketplacePath = join21(temporaryCachePath, ".claude-plugin", "marketplace.json");
|
|
44480
44509
|
cleanupNeeded = false;
|
|
44481
44510
|
await fs6.mkdir(dirname12(marketplacePath));
|
|
44482
44511
|
await writeFile7(marketplacePath, jsonStringify({
|
|
@@ -44499,7 +44528,7 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
44499
44528
|
}
|
|
44500
44529
|
throw new Error(`Failed to parse marketplace file at ${marketplacePath}: ${errorMessage(e)}`);
|
|
44501
44530
|
}
|
|
44502
|
-
const finalCachePath =
|
|
44531
|
+
const finalCachePath = join21(cacheDir, marketplace.name);
|
|
44503
44532
|
const resolvedFinal = resolve7(finalCachePath);
|
|
44504
44533
|
const resolvedCacheDir = resolve7(cacheDir);
|
|
44505
44534
|
if (!resolvedFinal.startsWith(resolvedCacheDir + sep4)) {
|
|
@@ -44620,9 +44649,9 @@ async function removeMarketplaceSource(name) {
|
|
|
44620
44649
|
await saveKnownMarketplacesConfig(config2);
|
|
44621
44650
|
const fs6 = getFsImplementation();
|
|
44622
44651
|
const cacheDir = getMarketplacesCacheDir();
|
|
44623
|
-
const cachePath =
|
|
44652
|
+
const cachePath = join21(cacheDir, name);
|
|
44624
44653
|
await fs6.rm(cachePath, { recursive: true, force: true });
|
|
44625
|
-
const jsonCachePath =
|
|
44654
|
+
const jsonCachePath = join21(cacheDir, `${name}.json`);
|
|
44626
44655
|
await fs6.rm(jsonCachePath, { force: true });
|
|
44627
44656
|
const editableSources = ["userSettings", "projectSettings", "localSettings"];
|
|
44628
44657
|
for (const source of editableSources) {
|
|
@@ -44673,7 +44702,7 @@ async function removeMarketplaceSource(name) {
|
|
|
44673
44702
|
logForDebugging(`Removed marketplace source: ${name}`);
|
|
44674
44703
|
}
|
|
44675
44704
|
async function readCachedMarketplace(installLocation) {
|
|
44676
|
-
const nestedPath =
|
|
44705
|
+
const nestedPath = join21(installLocation, ".claude-plugin", "marketplace.json");
|
|
44677
44706
|
try {
|
|
44678
44707
|
return await parseFileWithSchema(nestedPath, PluginMarketplaceSchema());
|
|
44679
44708
|
} catch (e) {
|
|
@@ -44973,12 +45002,12 @@ var init_marketplaceManager = __esm(() => {
|
|
|
44973
45002
|
});
|
|
44974
45003
|
|
|
44975
45004
|
// src/utils/plugins/installedPluginsManager.ts
|
|
44976
|
-
import { dirname as dirname13, join as
|
|
45005
|
+
import { dirname as dirname13, join as join22 } from "path";
|
|
44977
45006
|
function getInstalledPluginsFilePath() {
|
|
44978
|
-
return
|
|
45007
|
+
return join22(getPluginsDirectory(), "installed_plugins.json");
|
|
44979
45008
|
}
|
|
44980
45009
|
function getInstalledPluginsV2FilePath() {
|
|
44981
|
-
return
|
|
45010
|
+
return join22(getPluginsDirectory(), "installed_plugins_v2.json");
|
|
44982
45011
|
}
|
|
44983
45012
|
function migrateToSinglePluginFile() {
|
|
44984
45013
|
if (migrationCompleted) {
|
|
@@ -45046,12 +45075,12 @@ function cleanupLegacyCache(v2Data) {
|
|
|
45046
45075
|
continue;
|
|
45047
45076
|
}
|
|
45048
45077
|
const entry = dirent.name;
|
|
45049
|
-
const entryPath =
|
|
45078
|
+
const entryPath = join22(cachePath, entry);
|
|
45050
45079
|
const subEntries = fs6.readdirSync(entryPath);
|
|
45051
45080
|
const hasVersionedStructure = subEntries.some((subDirent) => {
|
|
45052
45081
|
if (!subDirent.isDirectory())
|
|
45053
45082
|
return false;
|
|
45054
|
-
const subPath =
|
|
45083
|
+
const subPath = join22(entryPath, subDirent.name);
|
|
45055
45084
|
const versionEntries = fs6.readdirSync(subPath);
|
|
45056
45085
|
return versionEntries.some((vDirent) => vDirent.isDirectory());
|
|
45057
45086
|
});
|
|
@@ -45306,7 +45335,7 @@ async function getGitCommitSha(dirPath) {
|
|
|
45306
45335
|
}
|
|
45307
45336
|
function getPluginVersionFromManifest(pluginCachePath, pluginId) {
|
|
45308
45337
|
const fs6 = getFsImplementation();
|
|
45309
|
-
const manifestPath =
|
|
45338
|
+
const manifestPath = join22(pluginCachePath, ".claude-plugin", "plugin.json");
|
|
45310
45339
|
try {
|
|
45311
45340
|
const manifestContent = fs6.readFileSync(manifestPath, { encoding: "utf-8" });
|
|
45312
45341
|
const manifest = jsonParse(manifestContent);
|
|
@@ -45400,13 +45429,13 @@ async function migrateFromEnabledPlugins() {
|
|
|
45400
45429
|
let version = "unknown";
|
|
45401
45430
|
let gitCommitSha = undefined;
|
|
45402
45431
|
if (typeof entry.source === "string") {
|
|
45403
|
-
installPath =
|
|
45432
|
+
installPath = join22(marketplaceInstallLocation, entry.source);
|
|
45404
45433
|
version = getPluginVersionFromManifest(installPath, pluginId);
|
|
45405
45434
|
gitCommitSha = await getGitCommitSha(installPath);
|
|
45406
45435
|
} else {
|
|
45407
45436
|
const cachePath = getPluginCachePath();
|
|
45408
45437
|
const sanitizedName = pluginName.replace(/[^a-zA-Z0-9-_]/g, "-");
|
|
45409
|
-
const pluginCachePath =
|
|
45438
|
+
const pluginCachePath = join22(cachePath, sanitizedName);
|
|
45410
45439
|
let dirEntries;
|
|
45411
45440
|
try {
|
|
45412
45441
|
dirEntries = (await getFsImplementation().readdir(pluginCachePath)).map((e) => typeof e === "string" ? e : e.name);
|
|
@@ -45645,7 +45674,7 @@ var init_pluginVersioning = __esm(() => {
|
|
|
45645
45674
|
// src/utils/plugins/pluginInstallationHelpers.ts
|
|
45646
45675
|
import { randomBytes as randomBytes4 } from "crypto";
|
|
45647
45676
|
import { rename as rename3, rm as rm5 } from "fs/promises";
|
|
45648
|
-
import { dirname as dirname14, join as
|
|
45677
|
+
import { dirname as dirname14, join as join23, resolve as resolve8, sep as sep6 } from "path";
|
|
45649
45678
|
function getCurrentTimestamp() {
|
|
45650
45679
|
return new Date().toISOString();
|
|
45651
45680
|
}
|
|
@@ -45674,7 +45703,7 @@ async function cacheAndRegisterPlugin(pluginId, entry, scope = "user", projectPa
|
|
|
45674
45703
|
const normalizedCachePath = cacheResult.path.endsWith(sep6) ? cacheResult.path : cacheResult.path + sep6;
|
|
45675
45704
|
const isSubdirectory = versionedPath.startsWith(normalizedCachePath);
|
|
45676
45705
|
if (isSubdirectory) {
|
|
45677
|
-
const tempPath =
|
|
45706
|
+
const tempPath = join23(dirname14(cacheResult.path), `.claude-plugin-temp-${Date.now()}-${randomBytes4(4).toString("hex")}`);
|
|
45678
45707
|
await rename3(cacheResult.path, tempPath);
|
|
45679
45708
|
await getFsImplementation().mkdir(dirname14(versionedPath));
|
|
45680
45709
|
await rename3(tempPath, versionedPath);
|
|
@@ -45906,16 +45935,16 @@ import {
|
|
|
45906
45935
|
stat as stat6,
|
|
45907
45936
|
symlink as symlink2
|
|
45908
45937
|
} from "fs/promises";
|
|
45909
|
-
import { basename as basename8, dirname as dirname15, join as
|
|
45938
|
+
import { basename as basename8, dirname as dirname15, join as join24, relative as relative2, resolve as resolve9, sep as sep7 } from "path";
|
|
45910
45939
|
function getPluginCachePath() {
|
|
45911
|
-
return
|
|
45940
|
+
return join24(getPluginsDirectory(), "cache");
|
|
45912
45941
|
}
|
|
45913
45942
|
function getVersionedCachePathIn(baseDir, pluginId, version) {
|
|
45914
45943
|
const { name: pluginName, marketplace } = parsePluginIdentifier(pluginId);
|
|
45915
45944
|
const sanitizedMarketplace = (marketplace || "unknown").replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
45916
45945
|
const sanitizedPlugin = (pluginName || pluginId).replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
45917
45946
|
const sanitizedVersion = version.replace(/[^a-zA-Z0-9\-_.]/g, "-");
|
|
45918
|
-
return
|
|
45947
|
+
return join24(baseDir, "cache", sanitizedMarketplace, sanitizedPlugin, sanitizedVersion);
|
|
45919
45948
|
}
|
|
45920
45949
|
function getVersionedCachePath(pluginId, version) {
|
|
45921
45950
|
return getVersionedCachePathIn(getPluginsDirectory(), pluginId, version);
|
|
@@ -45941,7 +45970,7 @@ async function probeSeedCacheAnyVersion(pluginId) {
|
|
|
45941
45970
|
const versions = await readdir5(pluginDir);
|
|
45942
45971
|
if (versions.length !== 1)
|
|
45943
45972
|
continue;
|
|
45944
|
-
const versionDir =
|
|
45973
|
+
const versionDir = join24(pluginDir, versions[0]);
|
|
45945
45974
|
const entries = await readdir5(versionDir);
|
|
45946
45975
|
if (entries.length > 0)
|
|
45947
45976
|
return versionDir;
|
|
@@ -45953,8 +45982,8 @@ async function copyDir(src, dest) {
|
|
|
45953
45982
|
await getFsImplementation().mkdir(dest);
|
|
45954
45983
|
const entries = await readdir5(src, { withFileTypes: true });
|
|
45955
45984
|
for (const entry of entries) {
|
|
45956
|
-
const srcPath =
|
|
45957
|
-
const destPath =
|
|
45985
|
+
const srcPath = join24(src, entry.name);
|
|
45986
|
+
const destPath = join24(dest, entry.name);
|
|
45958
45987
|
if (entry.isDirectory()) {
|
|
45959
45988
|
await copyDir(srcPath, destPath);
|
|
45960
45989
|
} else if (entry.isFile()) {
|
|
@@ -45977,7 +46006,7 @@ async function copyDir(src, dest) {
|
|
|
45977
46006
|
const srcPrefix = resolvedSrc.endsWith(sep7) ? resolvedSrc : resolvedSrc + sep7;
|
|
45978
46007
|
if (resolvedTarget.startsWith(srcPrefix) || resolvedTarget === resolvedSrc) {
|
|
45979
46008
|
const targetRelativeToSrc = relative2(resolvedSrc, resolvedTarget);
|
|
45980
|
-
const destTargetPath =
|
|
46009
|
+
const destTargetPath = join24(dest, targetRelativeToSrc);
|
|
45981
46010
|
const relativeLinkPath = relative2(dirname15(destPath), destTargetPath);
|
|
45982
46011
|
await symlink2(relativeLinkPath, destPath);
|
|
45983
46012
|
} else {
|
|
@@ -46025,7 +46054,7 @@ async function copyPluginToVersionedCache(sourcePath, pluginId, version, entry,
|
|
|
46025
46054
|
logForDebugging(`Copying plugin ${pluginId} to versioned cache (fallback to full copy)`);
|
|
46026
46055
|
await copyDir(sourcePath, cachePath);
|
|
46027
46056
|
}
|
|
46028
|
-
const gitPath =
|
|
46057
|
+
const gitPath = join24(cachePath, ".git");
|
|
46029
46058
|
await rm6(gitPath, { recursive: true, force: true });
|
|
46030
46059
|
const cacheEntries = await readdir5(cachePath);
|
|
46031
46060
|
if (cacheEntries.length === 0) {
|
|
@@ -46056,10 +46085,10 @@ function validateGitUrl(url2) {
|
|
|
46056
46085
|
}
|
|
46057
46086
|
}
|
|
46058
46087
|
async function installFromNpm(packageName, targetPath, options = {}) {
|
|
46059
|
-
const npmCachePath =
|
|
46088
|
+
const npmCachePath = join24(getPluginsDirectory(), "npm-cache");
|
|
46060
46089
|
await getFsImplementation().mkdir(npmCachePath);
|
|
46061
46090
|
const packageSpec = options.version ? `${packageName}@${options.version}` : packageName;
|
|
46062
|
-
const packagePath =
|
|
46091
|
+
const packagePath = join24(npmCachePath, "node_modules", packageName);
|
|
46063
46092
|
const needsInstall = !await pathExists(packagePath);
|
|
46064
46093
|
if (needsInstall) {
|
|
46065
46094
|
logForDebugging(`Installing npm package ${packageSpec} to cache`);
|
|
@@ -46212,7 +46241,7 @@ async function installFromLocal(sourcePath, targetPath) {
|
|
|
46212
46241
|
throw new Error(`Source path does not exist: ${sourcePath}`);
|
|
46213
46242
|
}
|
|
46214
46243
|
await copyDir(sourcePath, targetPath);
|
|
46215
|
-
const gitPath =
|
|
46244
|
+
const gitPath = join24(targetPath, ".git");
|
|
46216
46245
|
await rm6(gitPath, { recursive: true, force: true });
|
|
46217
46246
|
}
|
|
46218
46247
|
function generateTemporaryCacheNameForPlugin(source) {
|
|
@@ -46248,7 +46277,7 @@ async function cachePlugin(source, options) {
|
|
|
46248
46277
|
const cachePath = getPluginCachePath();
|
|
46249
46278
|
await getFsImplementation().mkdir(cachePath);
|
|
46250
46279
|
const tempName = generateTemporaryCacheNameForPlugin(source);
|
|
46251
|
-
const tempPath =
|
|
46280
|
+
const tempPath = join24(cachePath, tempName);
|
|
46252
46281
|
let shouldCleanup = false;
|
|
46253
46282
|
let gitCommitSha;
|
|
46254
46283
|
try {
|
|
@@ -46292,8 +46321,8 @@ async function cachePlugin(source, options) {
|
|
|
46292
46321
|
}
|
|
46293
46322
|
throw error;
|
|
46294
46323
|
}
|
|
46295
|
-
const manifestPath =
|
|
46296
|
-
const legacyManifestPath =
|
|
46324
|
+
const manifestPath = join24(tempPath, ".claude-plugin", "plugin.json");
|
|
46325
|
+
const legacyManifestPath = join24(tempPath, "plugin.json");
|
|
46297
46326
|
let manifest;
|
|
46298
46327
|
if (await pathExists(manifestPath)) {
|
|
46299
46328
|
try {
|
|
@@ -46350,7 +46379,7 @@ async function cachePlugin(source, options) {
|
|
|
46350
46379
|
};
|
|
46351
46380
|
}
|
|
46352
46381
|
const finalName = manifest.name.replace(/[^a-zA-Z0-9-_]/g, "-");
|
|
46353
|
-
const finalPath =
|
|
46382
|
+
const finalPath = join24(cachePath, finalName);
|
|
46354
46383
|
if (await pathExists(finalPath)) {
|
|
46355
46384
|
logForDebugging(`Removing old cached version at ${finalPath}`);
|
|
46356
46385
|
await rm6(finalPath, { recursive: true, force: true });
|
|
@@ -46404,7 +46433,7 @@ async function loadPluginHooks2(hooksConfigPath, pluginName) {
|
|
|
46404
46433
|
}
|
|
46405
46434
|
async function validatePluginPaths(relPaths, pluginPath, pluginName, source, component, componentLabel, contextLabel, errors) {
|
|
46406
46435
|
const checks2 = await Promise.all(relPaths.map(async (relPath) => {
|
|
46407
|
-
const fullPath =
|
|
46436
|
+
const fullPath = join24(pluginPath, relPath);
|
|
46408
46437
|
return { relPath, fullPath, exists: await pathExists(fullPath) };
|
|
46409
46438
|
}));
|
|
46410
46439
|
const validPaths = [];
|
|
@@ -46427,7 +46456,7 @@ async function validatePluginPaths(relPaths, pluginPath, pluginName, source, com
|
|
|
46427
46456
|
}
|
|
46428
46457
|
async function createPluginFromPath(pluginPath, source, enabled, fallbackName, strict = true) {
|
|
46429
46458
|
const errors = [];
|
|
46430
|
-
const manifestPath =
|
|
46459
|
+
const manifestPath = join24(pluginPath, ".claude-plugin", "plugin.json");
|
|
46431
46460
|
const manifest = await loadPluginManifest(manifestPath, fallbackName, source);
|
|
46432
46461
|
const plugin = {
|
|
46433
46462
|
name: manifest.name,
|
|
@@ -46443,12 +46472,12 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
46443
46472
|
skillsDirExists,
|
|
46444
46473
|
outputStylesDirExists
|
|
46445
46474
|
] = await Promise.all([
|
|
46446
|
-
!manifest.commands ? pathExists(
|
|
46447
|
-
!manifest.agents ? pathExists(
|
|
46448
|
-
!manifest.skills ? pathExists(
|
|
46449
|
-
!manifest.outputStyles ? pathExists(
|
|
46475
|
+
!manifest.commands ? pathExists(join24(pluginPath, "commands")) : false,
|
|
46476
|
+
!manifest.agents ? pathExists(join24(pluginPath, "agents")) : false,
|
|
46477
|
+
!manifest.skills ? pathExists(join24(pluginPath, "skills")) : false,
|
|
46478
|
+
!manifest.outputStyles ? pathExists(join24(pluginPath, "output-styles")) : false
|
|
46450
46479
|
]);
|
|
46451
|
-
const commandsPath =
|
|
46480
|
+
const commandsPath = join24(pluginPath, "commands");
|
|
46452
46481
|
if (commandsDirExists) {
|
|
46453
46482
|
plugin.commandsPath = commandsPath;
|
|
46454
46483
|
}
|
|
@@ -46463,7 +46492,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
46463
46492
|
return { commandName, metadata, kind: "skip" };
|
|
46464
46493
|
}
|
|
46465
46494
|
if (metadata.source) {
|
|
46466
|
-
const fullPath =
|
|
46495
|
+
const fullPath = join24(pluginPath, metadata.source);
|
|
46467
46496
|
return {
|
|
46468
46497
|
commandName,
|
|
46469
46498
|
metadata,
|
|
@@ -46511,7 +46540,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
46511
46540
|
if (typeof cmdPath !== "string") {
|
|
46512
46541
|
return { cmdPath, kind: "invalid" };
|
|
46513
46542
|
}
|
|
46514
|
-
const fullPath =
|
|
46543
|
+
const fullPath = join24(pluginPath, cmdPath);
|
|
46515
46544
|
return {
|
|
46516
46545
|
cmdPath,
|
|
46517
46546
|
kind: "path",
|
|
@@ -46544,7 +46573,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
46544
46573
|
}
|
|
46545
46574
|
}
|
|
46546
46575
|
}
|
|
46547
|
-
const agentsPath =
|
|
46576
|
+
const agentsPath = join24(pluginPath, "agents");
|
|
46548
46577
|
if (agentsDirExists) {
|
|
46549
46578
|
plugin.agentsPath = agentsPath;
|
|
46550
46579
|
}
|
|
@@ -46555,7 +46584,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
46555
46584
|
plugin.agentsPaths = validPaths;
|
|
46556
46585
|
}
|
|
46557
46586
|
}
|
|
46558
|
-
const skillsPath =
|
|
46587
|
+
const skillsPath = join24(pluginPath, "skills");
|
|
46559
46588
|
if (skillsDirExists) {
|
|
46560
46589
|
plugin.skillsPath = skillsPath;
|
|
46561
46590
|
}
|
|
@@ -46566,7 +46595,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
46566
46595
|
plugin.skillsPaths = validPaths;
|
|
46567
46596
|
}
|
|
46568
46597
|
}
|
|
46569
|
-
const outputStylesPath =
|
|
46598
|
+
const outputStylesPath = join24(pluginPath, "output-styles");
|
|
46570
46599
|
if (outputStylesDirExists) {
|
|
46571
46600
|
plugin.outputStylesPath = outputStylesPath;
|
|
46572
46601
|
}
|
|
@@ -46579,7 +46608,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
46579
46608
|
}
|
|
46580
46609
|
let mergedHooks;
|
|
46581
46610
|
const loadedHookPaths = new Set;
|
|
46582
|
-
const standardHooksPath =
|
|
46611
|
+
const standardHooksPath = join24(pluginPath, "hooks", "hooks.json");
|
|
46583
46612
|
if (await pathExists(standardHooksPath)) {
|
|
46584
46613
|
try {
|
|
46585
46614
|
mergedHooks = await loadPluginHooks2(standardHooksPath, manifest.name);
|
|
@@ -46608,7 +46637,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
46608
46637
|
const manifestHooksArray = Array.isArray(manifest.hooks) ? manifest.hooks : [manifest.hooks];
|
|
46609
46638
|
for (const hookSpec of manifestHooksArray) {
|
|
46610
46639
|
if (typeof hookSpec === "string") {
|
|
46611
|
-
const hookFilePath =
|
|
46640
|
+
const hookFilePath = join24(pluginPath, hookSpec);
|
|
46612
46641
|
if (!await pathExists(hookFilePath)) {
|
|
46613
46642
|
logForDebugging(`Hooks file ${hookSpec} specified in manifest but not found at ${hookFilePath} for ${manifest.name}`, { level: "error" });
|
|
46614
46643
|
logError(new Error(`Plugin component file not found: ${hookFilePath} for ${manifest.name}`));
|
|
@@ -46698,7 +46727,7 @@ function parsePluginSettings(raw) {
|
|
|
46698
46727
|
return data;
|
|
46699
46728
|
}
|
|
46700
46729
|
async function loadPluginSettings(pluginPath, manifest) {
|
|
46701
|
-
const settingsJsonPath =
|
|
46730
|
+
const settingsJsonPath = join24(pluginPath, "settings.json");
|
|
46702
46731
|
try {
|
|
46703
46732
|
const content = await readFile6(settingsJsonPath, { encoding: "utf-8" });
|
|
46704
46733
|
const parsed = jsonParse(content);
|
|
@@ -46841,7 +46870,7 @@ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstall
|
|
|
46841
46870
|
if (typeof entry.source === "string") {
|
|
46842
46871
|
let marketplaceDir;
|
|
46843
46872
|
try {
|
|
46844
|
-
marketplaceDir = (await stat6(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation :
|
|
46873
|
+
marketplaceDir = (await stat6(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation : join24(marketplaceInstallLocation, "..");
|
|
46845
46874
|
} catch {
|
|
46846
46875
|
errorsOut.push({
|
|
46847
46876
|
type: "plugin-cache-miss",
|
|
@@ -46851,7 +46880,7 @@ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstall
|
|
|
46851
46880
|
});
|
|
46852
46881
|
return null;
|
|
46853
46882
|
}
|
|
46854
|
-
pluginPath =
|
|
46883
|
+
pluginPath = join24(marketplaceDir, entry.source);
|
|
46855
46884
|
} else {
|
|
46856
46885
|
if (!installPath || !await pathExists(installPath)) {
|
|
46857
46886
|
errorsOut.push({
|
|
@@ -46866,7 +46895,7 @@ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstall
|
|
|
46866
46895
|
}
|
|
46867
46896
|
if (isPluginZipCacheEnabled() && pluginPath.endsWith(".zip")) {
|
|
46868
46897
|
const sessionDir = await getSessionPluginCachePath();
|
|
46869
|
-
const extractDir =
|
|
46898
|
+
const extractDir = join24(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, "-"));
|
|
46870
46899
|
try {
|
|
46871
46900
|
await extractZipToDirectory(pluginPath, extractDir);
|
|
46872
46901
|
pluginPath = extractDir;
|
|
@@ -46889,8 +46918,8 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
46889
46918
|
logForDebugging(`Loading plugin ${entry.name} from source: ${jsonStringify(entry.source)}`);
|
|
46890
46919
|
let pluginPath;
|
|
46891
46920
|
if (typeof entry.source === "string") {
|
|
46892
|
-
const marketplaceDir = (await stat6(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation :
|
|
46893
|
-
const sourcePluginPath =
|
|
46921
|
+
const marketplaceDir = (await stat6(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation : join24(marketplaceInstallLocation, "..");
|
|
46922
|
+
const sourcePluginPath = join24(marketplaceDir, entry.source);
|
|
46894
46923
|
if (!await pathExists(sourcePluginPath)) {
|
|
46895
46924
|
const error = new Error(`Plugin path not found: ${sourcePluginPath}`);
|
|
46896
46925
|
logForDebugging(`Plugin path not found: ${sourcePluginPath}`, {
|
|
@@ -46905,7 +46934,7 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
46905
46934
|
return null;
|
|
46906
46935
|
}
|
|
46907
46936
|
try {
|
|
46908
|
-
const manifestPath =
|
|
46937
|
+
const manifestPath = join24(sourcePluginPath, ".claude-plugin", "plugin.json");
|
|
46909
46938
|
let pluginManifest;
|
|
46910
46939
|
try {
|
|
46911
46940
|
pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
|
|
@@ -46961,7 +46990,7 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
46961
46990
|
}
|
|
46962
46991
|
if (isPluginZipCacheEnabled() && pluginPath.endsWith(".zip")) {
|
|
46963
46992
|
const sessionDir = await getSessionPluginCachePath();
|
|
46964
|
-
const extractDir =
|
|
46993
|
+
const extractDir = join24(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, "-"));
|
|
46965
46994
|
try {
|
|
46966
46995
|
await extractZipToDirectory(pluginPath, extractDir);
|
|
46967
46996
|
logForDebugging(`Extracted plugin ZIP to session dir: ${extractDir}`);
|
|
@@ -46976,7 +47005,7 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
46976
47005
|
}
|
|
46977
47006
|
async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut, pluginPath) {
|
|
46978
47007
|
const errors = [];
|
|
46979
|
-
const manifestPath =
|
|
47008
|
+
const manifestPath = join24(pluginPath, ".claude-plugin", "plugin.json");
|
|
46980
47009
|
const hasManifest = await pathExists(manifestPath);
|
|
46981
47010
|
const { plugin, errors: pluginErrors } = await createPluginFromPath(pluginPath, pluginId, enabled, entry.name, entry.strict ?? true);
|
|
46982
47011
|
errors.push(...pluginErrors);
|
|
@@ -47001,7 +47030,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
47001
47030
|
if (!metadata || typeof metadata !== "object" || !metadata.source) {
|
|
47002
47031
|
return { commandName, metadata, skip: true };
|
|
47003
47032
|
}
|
|
47004
|
-
const fullPath =
|
|
47033
|
+
const fullPath = join24(pluginPath, metadata.source);
|
|
47005
47034
|
return {
|
|
47006
47035
|
commandName,
|
|
47007
47036
|
metadata,
|
|
@@ -47038,7 +47067,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
47038
47067
|
if (typeof cmdPath !== "string") {
|
|
47039
47068
|
return { cmdPath, kind: "invalid" };
|
|
47040
47069
|
}
|
|
47041
|
-
const fullPath =
|
|
47070
|
+
const fullPath = join24(pluginPath, cmdPath);
|
|
47042
47071
|
return {
|
|
47043
47072
|
cmdPath,
|
|
47044
47073
|
kind: "path",
|
|
@@ -47082,7 +47111,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
47082
47111
|
logForDebugging(`Processing ${Array.isArray(entry.skills) ? entry.skills.length : 1} skill paths for plugin ${entry.name}`);
|
|
47083
47112
|
const skillPaths = Array.isArray(entry.skills) ? entry.skills : [entry.skills];
|
|
47084
47113
|
const checks2 = await Promise.all(skillPaths.map(async (skillPath) => {
|
|
47085
|
-
const fullPath =
|
|
47114
|
+
const fullPath = join24(pluginPath, skillPath);
|
|
47086
47115
|
return { skillPath, fullPath, exists: await pathExists(fullPath) };
|
|
47087
47116
|
}));
|
|
47088
47117
|
const validPaths = [];
|
|
@@ -47142,7 +47171,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
47142
47171
|
if (!metadata || typeof metadata !== "object" || !metadata.source) {
|
|
47143
47172
|
return { commandName, metadata, skip: true };
|
|
47144
47173
|
}
|
|
47145
|
-
const fullPath =
|
|
47174
|
+
const fullPath = join24(pluginPath, metadata.source);
|
|
47146
47175
|
return {
|
|
47147
47176
|
commandName,
|
|
47148
47177
|
metadata,
|
|
@@ -47182,7 +47211,7 @@ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut,
|
|
|
47182
47211
|
if (typeof cmdPath !== "string") {
|
|
47183
47212
|
return { cmdPath, kind: "invalid" };
|
|
47184
47213
|
}
|
|
47185
|
-
const fullPath =
|
|
47214
|
+
const fullPath = join24(pluginPath, cmdPath);
|
|
47186
47215
|
return {
|
|
47187
47216
|
cmdPath,
|
|
47188
47217
|
kind: "path",
|
|
@@ -48746,7 +48775,7 @@ var init_promptCategory = __esm(() => {
|
|
|
48746
48775
|
// src/services/api/dumpPrompts.ts
|
|
48747
48776
|
import { createHash as createHash4 } from "crypto";
|
|
48748
48777
|
import { promises as fs6 } from "fs";
|
|
48749
|
-
import { dirname as dirname16, join as
|
|
48778
|
+
import { dirname as dirname16, join as join25 } from "path";
|
|
48750
48779
|
function hashString3(str2) {
|
|
48751
48780
|
return createHash4("sha256").update(str2).digest("hex");
|
|
48752
48781
|
}
|
|
@@ -48768,7 +48797,7 @@ function addApiRequestToCache(requestData) {
|
|
|
48768
48797
|
}
|
|
48769
48798
|
}
|
|
48770
48799
|
function getDumpPromptsPath(agentIdOrSessionId) {
|
|
48771
|
-
return
|
|
48800
|
+
return join25(getClaudeConfigHomeDir(), "dump-prompts", `${agentIdOrSessionId ?? getSessionId()}.jsonl`);
|
|
48772
48801
|
}
|
|
48773
48802
|
function appendToFile(filePath, entries) {
|
|
48774
48803
|
if (entries.length === 0)
|
|
@@ -48909,7 +48938,7 @@ function expandEnvVarsInString(value) {
|
|
|
48909
48938
|
var init_envExpansion = () => {};
|
|
48910
48939
|
|
|
48911
48940
|
// src/utils/plugins/mcpPluginIntegration.ts
|
|
48912
|
-
import { join as
|
|
48941
|
+
import { join as join26 } from "path";
|
|
48913
48942
|
async function loadMcpServersFromMcpb(plugin, mcpbPath, errors) {
|
|
48914
48943
|
try {
|
|
48915
48944
|
logForDebugging(`Loading MCP servers from MCPB: ${mcpbPath}`);
|
|
@@ -49008,7 +49037,7 @@ async function loadPluginMcpServers(plugin, errors = []) {
|
|
|
49008
49037
|
}
|
|
49009
49038
|
async function loadMcpServersFromFile(pluginPath, relativePath) {
|
|
49010
49039
|
const fs7 = getFsImplementation();
|
|
49011
|
-
const filePath =
|
|
49040
|
+
const filePath = join26(pluginPath, relativePath);
|
|
49012
49041
|
let content;
|
|
49013
49042
|
try {
|
|
49014
49043
|
content = await fs7.readFile(filePath, { encoding: "utf-8" });
|
|
@@ -49325,7 +49354,7 @@ var init_claudeai = __esm(() => {
|
|
|
49325
49354
|
|
|
49326
49355
|
// src/services/mcp/utils.ts
|
|
49327
49356
|
import { createHash as createHash5 } from "crypto";
|
|
49328
|
-
import { join as
|
|
49357
|
+
import { join as join27 } from "path";
|
|
49329
49358
|
function filterToolsByServer(tools, serverName) {
|
|
49330
49359
|
const prefix = `mcp__${normalizeNameForMCP(serverName)}__`;
|
|
49331
49360
|
return tools.filter((tool) => tool.name?.startsWith(prefix));
|
|
@@ -49403,7 +49432,7 @@ function describeMcpConfigFilePath(scope) {
|
|
|
49403
49432
|
case "user":
|
|
49404
49433
|
return getGlobalClaudeFile();
|
|
49405
49434
|
case "project":
|
|
49406
|
-
return
|
|
49435
|
+
return join27(getCwd(), ".mcp.json");
|
|
49407
49436
|
case "local":
|
|
49408
49437
|
return `${getGlobalClaudeFile()} [project: ${getCwd()}]`;
|
|
49409
49438
|
case "dynamic":
|
|
@@ -49599,9 +49628,9 @@ var init_utils2 = __esm(() => {
|
|
|
49599
49628
|
|
|
49600
49629
|
// src/services/mcp/config.ts
|
|
49601
49630
|
import { chmod as chmod4, open, rename as rename5, stat as stat7, unlink as unlink2 } from "fs/promises";
|
|
49602
|
-
import { dirname as dirname17, join as
|
|
49631
|
+
import { dirname as dirname17, join as join28, parse as parse4 } from "path";
|
|
49603
49632
|
function getEnterpriseMcpFilePath() {
|
|
49604
|
-
return
|
|
49633
|
+
return join28(getManagedFilePath(), "managed-mcp.json");
|
|
49605
49634
|
}
|
|
49606
49635
|
function addScopeToServers(servers, scope) {
|
|
49607
49636
|
if (!servers) {
|
|
@@ -49614,7 +49643,7 @@ function addScopeToServers(servers, scope) {
|
|
|
49614
49643
|
return scopedServers;
|
|
49615
49644
|
}
|
|
49616
49645
|
async function writeMcpjsonFile(config2) {
|
|
49617
|
-
const mcpJsonPath =
|
|
49646
|
+
const mcpJsonPath = join28(getCwd(), ".mcp.json");
|
|
49618
49647
|
let existingMode;
|
|
49619
49648
|
try {
|
|
49620
49649
|
const stats = await stat7(mcpJsonPath);
|
|
@@ -50065,7 +50094,7 @@ function getProjectMcpConfigsFromCwd() {
|
|
|
50065
50094
|
if (!isSettingSourceEnabled("projectSettings")) {
|
|
50066
50095
|
return { servers: {}, errors: [] };
|
|
50067
50096
|
}
|
|
50068
|
-
const mcpJsonPath =
|
|
50097
|
+
const mcpJsonPath = join28(getCwd(), ".mcp.json");
|
|
50069
50098
|
const { config: config2, errors } = parseMcpConfigFromFilePath({
|
|
50070
50099
|
filePath: mcpJsonPath,
|
|
50071
50100
|
expandVars: true,
|
|
@@ -50104,7 +50133,7 @@ function getMcpConfigsByScope(scope) {
|
|
|
50104
50133
|
currentDir = dirname17(currentDir);
|
|
50105
50134
|
}
|
|
50106
50135
|
for (const dir of dirs.reverse()) {
|
|
50107
|
-
const mcpJsonPath =
|
|
50136
|
+
const mcpJsonPath = join28(dir, ".mcp.json");
|
|
50108
50137
|
const { config: config2, errors } = parseMcpConfigFromFilePath({
|
|
50109
50138
|
filePath: mcpJsonPath,
|
|
50110
50139
|
expandVars: true,
|
|
@@ -51857,7 +51886,7 @@ async function* runAgent({
|
|
|
51857
51886
|
}
|
|
51858
51887
|
validSkills.push({ skillName, skill });
|
|
51859
51888
|
}
|
|
51860
|
-
const { formatSkillLoadingMetadata } = await import("./chunk-
|
|
51889
|
+
const { formatSkillLoadingMetadata } = await import("./chunk-e6pjm749.js");
|
|
51861
51890
|
const loaded = await Promise.all(validSkills.map(async ({ skillName, skill }) => ({
|
|
51862
51891
|
skillName,
|
|
51863
51892
|
skill,
|
|
@@ -52748,7 +52777,7 @@ async function gracefulShutdown(exitCode = 0, reason = "other", options) {
|
|
|
52748
52777
|
return;
|
|
52749
52778
|
}
|
|
52750
52779
|
shutdownInProgress = true;
|
|
52751
|
-
const { executeSessionEndHooks, getSessionEndHookTimeoutMs } = await import("./chunk-
|
|
52780
|
+
const { executeSessionEndHooks, getSessionEndHookTimeoutMs } = await import("./chunk-q2xjkbq6.js");
|
|
52752
52781
|
const sessionEndTimeoutMs = getSessionEndHookTimeoutMs();
|
|
52753
52782
|
failsafeTimer = setTimeout((code) => {
|
|
52754
52783
|
cleanupTerminalModes();
|
|
@@ -53898,12 +53927,12 @@ var init_oauth2 = __esm(() => {
|
|
|
53898
53927
|
|
|
53899
53928
|
// src/utils/localInstaller.ts
|
|
53900
53929
|
import { access, chmod as chmod5, writeFile as writeFile8 } from "fs/promises";
|
|
53901
|
-
import { join as
|
|
53930
|
+
import { join as join29 } from "path";
|
|
53902
53931
|
function getLocalInstallDir() {
|
|
53903
|
-
return
|
|
53932
|
+
return join29(getClaudeConfigHomeDir(), "local");
|
|
53904
53933
|
}
|
|
53905
53934
|
function getLocalClaudePath() {
|
|
53906
|
-
return
|
|
53935
|
+
return join29(getLocalInstallDir(), "claude");
|
|
53907
53936
|
}
|
|
53908
53937
|
function isRunningFromLocalInstallation() {
|
|
53909
53938
|
const execPath = process.argv[1] || "";
|
|
@@ -53923,8 +53952,8 @@ async function ensureLocalPackageEnvironment() {
|
|
|
53923
53952
|
try {
|
|
53924
53953
|
const localInstallDir = getLocalInstallDir();
|
|
53925
53954
|
await getFsImplementation().mkdir(localInstallDir);
|
|
53926
|
-
await writeIfMissing(
|
|
53927
|
-
const wrapperPath =
|
|
53955
|
+
await writeIfMissing(join29(localInstallDir, "package.json"), jsonStringify({ name: "claude-local", version: "0.0.1", private: true }, null, 2));
|
|
53956
|
+
const wrapperPath = join29(localInstallDir, "claude");
|
|
53928
53957
|
const created = await writeIfMissing(wrapperPath, `#!/bin/sh
|
|
53929
53958
|
exec "${localInstallDir}/node_modules/.bin/claude" "$@"`, 493);
|
|
53930
53959
|
if (created) {
|
|
@@ -53960,7 +53989,7 @@ async function installOrUpdateClaudePackage(channel, specificVersion) {
|
|
|
53960
53989
|
}
|
|
53961
53990
|
async function localInstallationExists() {
|
|
53962
53991
|
try {
|
|
53963
|
-
await access(
|
|
53992
|
+
await access(join29(getLocalInstallDir(), "node_modules", ".bin", "claude"));
|
|
53964
53993
|
return true;
|
|
53965
53994
|
} catch {
|
|
53966
53995
|
return false;
|
|
@@ -53989,15 +54018,15 @@ var init_localInstaller = __esm(() => {
|
|
|
53989
54018
|
// src/utils/shellConfig.ts
|
|
53990
54019
|
import { open as open3, readFile as readFile7, stat as stat8 } from "fs/promises";
|
|
53991
54020
|
import { homedir as osHomedir } from "os";
|
|
53992
|
-
import { join as
|
|
54021
|
+
import { join as join30 } from "path";
|
|
53993
54022
|
function getShellConfigPaths(options) {
|
|
53994
54023
|
const home = options?.homedir ?? osHomedir();
|
|
53995
54024
|
const env2 = options?.env ?? process.env;
|
|
53996
54025
|
const zshConfigDir = env2.ZDOTDIR || home;
|
|
53997
54026
|
return {
|
|
53998
|
-
zsh:
|
|
53999
|
-
bash:
|
|
54000
|
-
fish:
|
|
54027
|
+
zsh: join30(zshConfigDir, ".zshrc"),
|
|
54028
|
+
bash: join30(home, ".bashrc"),
|
|
54029
|
+
fish: join30(home, ".config/fish/config.fish")
|
|
54001
54030
|
};
|
|
54002
54031
|
}
|
|
54003
54032
|
function filterClaudeAliases(lines) {
|
|
@@ -54082,8 +54111,8 @@ var init_shellConfig = __esm(() => {
|
|
|
54082
54111
|
// src/utils/autoUpdater.ts
|
|
54083
54112
|
import { constants as fsConstants } from "fs";
|
|
54084
54113
|
import { access as access2, writeFile as writeFile9 } from "fs/promises";
|
|
54085
|
-
import { homedir as
|
|
54086
|
-
import { join as
|
|
54114
|
+
import { homedir as homedir8 } from "os";
|
|
54115
|
+
import { join as join31 } from "path";
|
|
54087
54116
|
async function assertMinVersion() {
|
|
54088
54117
|
if (false) {}
|
|
54089
54118
|
try {
|
|
@@ -54139,7 +54168,7 @@ function shouldSkipVersion(targetVersion) {
|
|
|
54139
54168
|
return shouldSkip;
|
|
54140
54169
|
}
|
|
54141
54170
|
function getLockFilePath() {
|
|
54142
|
-
return
|
|
54171
|
+
return join31(getClaudeConfigHomeDir(), ".update.lock");
|
|
54143
54172
|
}
|
|
54144
54173
|
async function acquireLock() {
|
|
54145
54174
|
const fs7 = getFsImplementation();
|
|
@@ -54219,10 +54248,10 @@ async function getInstallationPrefix() {
|
|
|
54219
54248
|
let prefixResult = null;
|
|
54220
54249
|
if (isBun) {
|
|
54221
54250
|
prefixResult = await execFileNoThrowWithCwd("bun", ["pm", "bin", "-g"], {
|
|
54222
|
-
cwd:
|
|
54251
|
+
cwd: homedir8()
|
|
54223
54252
|
});
|
|
54224
54253
|
} else {
|
|
54225
|
-
prefixResult = await execFileNoThrowWithCwd("npm", ["-g", "config", "get", "prefix"], { cwd:
|
|
54254
|
+
prefixResult = await execFileNoThrowWithCwd("npm", ["-g", "config", "get", "prefix"], { cwd: homedir8() });
|
|
54226
54255
|
}
|
|
54227
54256
|
if (prefixResult.code !== 0) {
|
|
54228
54257
|
logError(new Error(`Failed to check ${isBun ? "bun" : "npm"} permissions`));
|
|
@@ -54250,7 +54279,7 @@ async function checkGlobalInstallPermissions() {
|
|
|
54250
54279
|
}
|
|
54251
54280
|
async function getLatestVersion(channel) {
|
|
54252
54281
|
const npmTag = channel === "stable" ? "stable" : "latest";
|
|
54253
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", `${MACRO.PACKAGE_URL}@${npmTag}`, "version", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd:
|
|
54282
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", `${MACRO.PACKAGE_URL}@${npmTag}`, "version", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir8() });
|
|
54254
54283
|
if (result.code !== 0) {
|
|
54255
54284
|
logForDebugging(`npm view failed with code ${result.code}`);
|
|
54256
54285
|
if (result.stderr) {
|
|
@@ -54266,7 +54295,7 @@ async function getLatestVersion(channel) {
|
|
|
54266
54295
|
return result.stdout.trim();
|
|
54267
54296
|
}
|
|
54268
54297
|
async function getNpmDistTags() {
|
|
54269
|
-
const result = await execFileNoThrowWithCwd("npm", ["view", MACRO.PACKAGE_URL, "dist-tags", "--json", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd:
|
|
54298
|
+
const result = await execFileNoThrowWithCwd("npm", ["view", MACRO.PACKAGE_URL, "dist-tags", "--json", "--prefer-online"], { abortSignal: AbortSignal.timeout(5000), cwd: homedir8() });
|
|
54270
54299
|
if (result.code !== 0) {
|
|
54271
54300
|
logForDebugging(`npm view dist-tags failed with code ${result.code}`);
|
|
54272
54301
|
return { latest: null, stable: null };
|
|
@@ -54336,7 +54365,7 @@ To fix this issue:
|
|
|
54336
54365
|
}
|
|
54337
54366
|
const packageSpec = specificVersion ? `${MACRO.PACKAGE_URL}@${specificVersion}` : MACRO.PACKAGE_URL;
|
|
54338
54367
|
const packageManager = env.isRunningWithBun() ? "bun" : "npm";
|
|
54339
|
-
const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd:
|
|
54368
|
+
const installResult = await execFileNoThrowWithCwd(packageManager, ["install", "-g", packageSpec], { cwd: homedir8() });
|
|
54340
54369
|
if (installResult.code !== 0) {
|
|
54341
54370
|
const error = new AutoUpdaterError(`Failed to install new version of claude: ${installResult.stdout} ${installResult.stderr}`);
|
|
54342
54371
|
logError(error);
|
|
@@ -54574,7 +54603,7 @@ var init_packageManagers = __esm(() => {
|
|
|
54574
54603
|
|
|
54575
54604
|
// src/utils/ripgrep.ts
|
|
54576
54605
|
import { execFile, spawn as spawn5 } from "child_process";
|
|
54577
|
-
import { homedir as
|
|
54606
|
+
import { homedir as homedir9 } from "os";
|
|
54578
54607
|
import * as path4 from "path";
|
|
54579
54608
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
54580
54609
|
function ripgrepCommand() {
|
|
@@ -54846,7 +54875,7 @@ var init_ripgrep2 = __esm(() => {
|
|
|
54846
54875
|
}
|
|
54847
54876
|
};
|
|
54848
54877
|
countFilesRoundedRg = memoize_default(async (dirPath, abortSignal, ignorePatterns = []) => {
|
|
54849
|
-
if (path4.resolve(dirPath) === path4.resolve(
|
|
54878
|
+
if (path4.resolve(dirPath) === path4.resolve(homedir9())) {
|
|
54850
54879
|
return;
|
|
54851
54880
|
}
|
|
54852
54881
|
try {
|
|
@@ -54915,8 +54944,8 @@ var init_ripgrep2 = __esm(() => {
|
|
|
54915
54944
|
|
|
54916
54945
|
// src/utils/doctorDiagnostic.ts
|
|
54917
54946
|
import { readFile as readFile9, realpath as realpath2 } from "fs/promises";
|
|
54918
|
-
import { homedir as
|
|
54919
|
-
import { delimiter as delimiter2, join as
|
|
54947
|
+
import { homedir as homedir10 } from "os";
|
|
54948
|
+
import { delimiter as delimiter2, join as join33, posix, win32 } from "path";
|
|
54920
54949
|
function getNormalizedPaths() {
|
|
54921
54950
|
let invokedPath = process.argv[1] || "";
|
|
54922
54951
|
let execPath = process.execPath || process.argv[0] || "";
|
|
@@ -54979,8 +55008,8 @@ async function getInstallationPath() {
|
|
|
54979
55008
|
}
|
|
54980
55009
|
} catch {}
|
|
54981
55010
|
try {
|
|
54982
|
-
await getFsImplementation().stat(
|
|
54983
|
-
return
|
|
55011
|
+
await getFsImplementation().stat(join33(homedir10(), ".local/bin/claude"));
|
|
55012
|
+
return join33(homedir10(), ".local/bin/claude");
|
|
54984
55013
|
} catch {}
|
|
54985
55014
|
return "native";
|
|
54986
55015
|
}
|
|
@@ -55003,7 +55032,7 @@ function getInvokedBinary() {
|
|
|
55003
55032
|
async function detectMultipleInstallations() {
|
|
55004
55033
|
const fs7 = getFsImplementation();
|
|
55005
55034
|
const installations = [];
|
|
55006
|
-
const localPath =
|
|
55035
|
+
const localPath = join33(homedir10(), ".claude", "local");
|
|
55007
55036
|
if (await localInstallationExists()) {
|
|
55008
55037
|
installations.push({ type: "npm-local", path: localPath });
|
|
55009
55038
|
}
|
|
@@ -55020,7 +55049,7 @@ async function detectMultipleInstallations() {
|
|
|
55020
55049
|
if (npmResult.code === 0 && npmResult.stdout) {
|
|
55021
55050
|
const npmPrefix = npmResult.stdout.trim();
|
|
55022
55051
|
const isWindows = getPlatform() === "windows";
|
|
55023
|
-
const globalBinPath = isWindows ?
|
|
55052
|
+
const globalBinPath = isWindows ? join33(npmPrefix, "claude") : join33(npmPrefix, "bin", "claude");
|
|
55024
55053
|
let globalBinExists = false;
|
|
55025
55054
|
try {
|
|
55026
55055
|
await fs7.stat(globalBinPath);
|
|
@@ -55039,7 +55068,7 @@ async function detectMultipleInstallations() {
|
|
|
55039
55068
|
}
|
|
55040
55069
|
} else {
|
|
55041
55070
|
for (const packageName of packagesToCheck) {
|
|
55042
|
-
const globalPackagePath = isWindows ?
|
|
55071
|
+
const globalPackagePath = isWindows ? join33(npmPrefix, "node_modules", packageName) : join33(npmPrefix, "lib", "node_modules", packageName);
|
|
55043
55072
|
try {
|
|
55044
55073
|
await fs7.stat(globalPackagePath);
|
|
55045
55074
|
installations.push({
|
|
@@ -55050,14 +55079,14 @@ async function detectMultipleInstallations() {
|
|
|
55050
55079
|
}
|
|
55051
55080
|
}
|
|
55052
55081
|
}
|
|
55053
|
-
const nativeBinPath =
|
|
55082
|
+
const nativeBinPath = join33(homedir10(), ".local", "bin", "claude");
|
|
55054
55083
|
try {
|
|
55055
55084
|
await fs7.stat(nativeBinPath);
|
|
55056
55085
|
installations.push({ type: "native", path: nativeBinPath });
|
|
55057
55086
|
} catch {}
|
|
55058
55087
|
const config2 = getGlobalConfig();
|
|
55059
55088
|
if (config2.installMethod === "native") {
|
|
55060
|
-
const nativeDataPath =
|
|
55089
|
+
const nativeDataPath = join33(homedir10(), ".local", "share", "claude");
|
|
55061
55090
|
try {
|
|
55062
55091
|
await fs7.stat(nativeDataPath);
|
|
55063
55092
|
if (!installations.some((i) => i.type === "native")) {
|
|
@@ -55070,7 +55099,7 @@ async function detectMultipleInstallations() {
|
|
|
55070
55099
|
async function detectConfigurationIssues(type) {
|
|
55071
55100
|
const warnings = [];
|
|
55072
55101
|
try {
|
|
55073
|
-
const raw = await readFile9(
|
|
55102
|
+
const raw = await readFile9(join33(getManagedFilePath(), "managed-settings.json"), "utf-8");
|
|
55074
55103
|
const parsed = jsonParse(raw);
|
|
55075
55104
|
const field = parsed && typeof parsed === "object" ? parsed.strictPluginOnlyCustomization : undefined;
|
|
55076
55105
|
if (field !== undefined && typeof field !== "boolean") {
|
|
@@ -55097,8 +55126,8 @@ async function detectConfigurationIssues(type) {
|
|
|
55097
55126
|
if (type === "native") {
|
|
55098
55127
|
const path5 = process.env.PATH || "";
|
|
55099
55128
|
const pathDirectories = path5.split(delimiter2);
|
|
55100
|
-
const homeDir =
|
|
55101
|
-
const localBinPath =
|
|
55129
|
+
const homeDir = homedir10();
|
|
55130
|
+
const localBinPath = join33(homeDir, ".local", "bin");
|
|
55102
55131
|
let normalizedLocalBinPath = localBinPath;
|
|
55103
55132
|
if (getPlatform() === "windows") {
|
|
55104
55133
|
normalizedLocalBinPath = localBinPath.split(win32.sep).join(posix.sep);
|
|
@@ -55124,7 +55153,7 @@ async function detectConfigurationIssues(type) {
|
|
|
55124
55153
|
const shellType = getShellType();
|
|
55125
55154
|
const configPaths = getShellConfigPaths();
|
|
55126
55155
|
const configFile = configPaths[shellType];
|
|
55127
|
-
const displayPath = configFile ? configFile.replace(
|
|
55156
|
+
const displayPath = configFile ? configFile.replace(homedir10(), "~") : "your shell config file";
|
|
55128
55157
|
warnings.push({
|
|
55129
55158
|
issue: "Native installation exists but ~/.local/bin is not in your PATH",
|
|
55130
55159
|
fix: `Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${displayPath} then open a new terminal or run: source ${displayPath}`
|
|
@@ -55285,7 +55314,7 @@ var init_doctorDiagnostic = __esm(() => {
|
|
|
55285
55314
|
|
|
55286
55315
|
// src/utils/xdg.ts
|
|
55287
55316
|
import { homedir as osHomedir2 } from "os";
|
|
55288
|
-
import { join as
|
|
55317
|
+
import { join as join34 } from "path";
|
|
55289
55318
|
function resolveOptions(options) {
|
|
55290
55319
|
return {
|
|
55291
55320
|
env: options?.env ?? process.env,
|
|
@@ -55294,26 +55323,26 @@ function resolveOptions(options) {
|
|
|
55294
55323
|
}
|
|
55295
55324
|
function getXDGStateHome(options) {
|
|
55296
55325
|
const { env: env2, home } = resolveOptions(options);
|
|
55297
|
-
return env2.XDG_STATE_HOME ??
|
|
55326
|
+
return env2.XDG_STATE_HOME ?? join34(home, ".local", "state");
|
|
55298
55327
|
}
|
|
55299
55328
|
function getXDGCacheHome(options) {
|
|
55300
55329
|
const { env: env2, home } = resolveOptions(options);
|
|
55301
|
-
return env2.XDG_CACHE_HOME ??
|
|
55330
|
+
return env2.XDG_CACHE_HOME ?? join34(home, ".cache");
|
|
55302
55331
|
}
|
|
55303
55332
|
function getXDGDataHome(options) {
|
|
55304
55333
|
const { env: env2, home } = resolveOptions(options);
|
|
55305
|
-
return env2.XDG_DATA_HOME ??
|
|
55334
|
+
return env2.XDG_DATA_HOME ?? join34(home, ".local", "share");
|
|
55306
55335
|
}
|
|
55307
55336
|
function getUserBinDir(options) {
|
|
55308
55337
|
const { home } = resolveOptions(options);
|
|
55309
|
-
return
|
|
55338
|
+
return join34(home, ".local", "bin");
|
|
55310
55339
|
}
|
|
55311
55340
|
var init_xdg = () => {};
|
|
55312
55341
|
|
|
55313
55342
|
// src/utils/nativeInstaller/download.ts
|
|
55314
55343
|
import { createHash as createHash9 } from "crypto";
|
|
55315
55344
|
import { chmod as chmod6, writeFile as writeFile10 } from "fs/promises";
|
|
55316
|
-
import { join as
|
|
55345
|
+
import { join as join35 } from "path";
|
|
55317
55346
|
async function getLatestVersionFromArtifactory(tag = "latest") {
|
|
55318
55347
|
const startTime = Date.now();
|
|
55319
55348
|
const { stdout, code, stderr } = await execFileNoThrowWithCwd("npm", [
|
|
@@ -55455,8 +55484,8 @@ async function downloadVersionFromArtifactory(version, stagingPath) {
|
|
|
55455
55484
|
}
|
|
55456
55485
|
}
|
|
55457
55486
|
};
|
|
55458
|
-
writeFileSync_DEPRECATED(
|
|
55459
|
-
writeFileSync_DEPRECATED(
|
|
55487
|
+
writeFileSync_DEPRECATED(join35(stagingPath, "package.json"), jsonStringify(packageJson, null, 2), { encoding: "utf8", flush: true });
|
|
55488
|
+
writeFileSync_DEPRECATED(join35(stagingPath, "package-lock.json"), jsonStringify(packageLock, null, 2), { encoding: "utf8", flush: true });
|
|
55460
55489
|
const result = await execFileNoThrowWithCwd("npm", ["ci", "--prefer-online", "--registry", ARTIFACTORY_REGISTRY_URL], {
|
|
55461
55490
|
timeout: 60000,
|
|
55462
55491
|
preserveOutputOnError: true,
|
|
@@ -55562,7 +55591,7 @@ async function downloadVersionFromBinaryRepo(version, stagingPath, baseUrl, auth
|
|
|
55562
55591
|
const binaryName = getBinaryName(platform2);
|
|
55563
55592
|
const binaryUrl = `${baseUrl}/${version}/${platform2}/${binaryName}`;
|
|
55564
55593
|
await fs7.mkdir(stagingPath);
|
|
55565
|
-
const binaryPath =
|
|
55594
|
+
const binaryPath = join35(stagingPath, binaryName);
|
|
55566
55595
|
try {
|
|
55567
55596
|
await downloadAndVerifyBinary(binaryUrl, expectedChecksum, binaryPath, authConfig || {});
|
|
55568
55597
|
const latencyMs = Date.now() - startTime;
|
|
@@ -55616,7 +55645,7 @@ var init_download = __esm(() => {
|
|
|
55616
55645
|
});
|
|
55617
55646
|
|
|
55618
55647
|
// src/utils/nativeInstaller/pidLock.ts
|
|
55619
|
-
import { basename as basename11, join as
|
|
55648
|
+
import { basename as basename11, join as join36 } from "path";
|
|
55620
55649
|
function isPidBasedLockingEnabled() {
|
|
55621
55650
|
const envVar = process.env.ENABLE_PID_BASED_VERSION_LOCKING;
|
|
55622
55651
|
if (isEnvTruthy(envVar)) {
|
|
@@ -55784,7 +55813,7 @@ function getAllLockInfo(locksDir) {
|
|
|
55784
55813
|
try {
|
|
55785
55814
|
const lockFiles = fs7.readdirStringSync(locksDir).filter((f) => f.endsWith(".lock"));
|
|
55786
55815
|
for (const lockFile of lockFiles) {
|
|
55787
|
-
const lockFilePath =
|
|
55816
|
+
const lockFilePath = join36(locksDir, lockFile);
|
|
55788
55817
|
const content = readLockContent(lockFilePath);
|
|
55789
55818
|
if (content) {
|
|
55790
55819
|
lockInfos.push({
|
|
@@ -55811,7 +55840,7 @@ function cleanupStaleLocks(locksDir) {
|
|
|
55811
55840
|
try {
|
|
55812
55841
|
const lockEntries = fs7.readdirStringSync(locksDir).filter((f) => f.endsWith(".lock"));
|
|
55813
55842
|
for (const lockEntry of lockEntries) {
|
|
55814
|
-
const lockFilePath =
|
|
55843
|
+
const lockFilePath = join36(locksDir, lockEntry);
|
|
55815
55844
|
try {
|
|
55816
55845
|
const stats = fs7.lstatSync(lockFilePath);
|
|
55817
55846
|
if (stats.isDirectory()) {
|
|
@@ -55865,8 +55894,8 @@ import {
|
|
|
55865
55894
|
unlink as unlink4,
|
|
55866
55895
|
writeFile as writeFile11
|
|
55867
55896
|
} from "fs/promises";
|
|
55868
|
-
import { homedir as
|
|
55869
|
-
import { basename as basename12, delimiter as delimiter3, dirname as dirname18, join as
|
|
55897
|
+
import { homedir as homedir11 } from "os";
|
|
55898
|
+
import { basename as basename12, delimiter as delimiter3, dirname as dirname18, join as join37, resolve as resolve12 } from "path";
|
|
55870
55899
|
function getPlatform3() {
|
|
55871
55900
|
const os2 = env.platform;
|
|
55872
55901
|
const arch = process.arch === "x64" ? "x64" : process.arch === "arm64" ? "arm64" : null;
|
|
@@ -55887,10 +55916,10 @@ function getBaseDirectories() {
|
|
|
55887
55916
|
const platform2 = getPlatform3();
|
|
55888
55917
|
const executableName = getBinaryName(platform2);
|
|
55889
55918
|
return {
|
|
55890
|
-
versions:
|
|
55891
|
-
staging:
|
|
55892
|
-
locks:
|
|
55893
|
-
executable:
|
|
55919
|
+
versions: join37(getXDGDataHome(), "claude", "versions"),
|
|
55920
|
+
staging: join37(getXDGCacheHome(), "claude", "staging"),
|
|
55921
|
+
locks: join37(getXDGStateHome(), "claude", "locks"),
|
|
55922
|
+
executable: join37(getUserBinDir(), executableName)
|
|
55894
55923
|
};
|
|
55895
55924
|
}
|
|
55896
55925
|
async function isPossibleClaudeBinary(filePath) {
|
|
@@ -55911,14 +55940,14 @@ async function getVersionPaths(version) {
|
|
|
55911
55940
|
await Promise.all(dirsToCreate.map((dir) => mkdir4(dir, { recursive: true })));
|
|
55912
55941
|
const executableParentDir = dirname18(dirs.executable);
|
|
55913
55942
|
await mkdir4(executableParentDir, { recursive: true });
|
|
55914
|
-
const installPath =
|
|
55943
|
+
const installPath = join37(dirs.versions, version);
|
|
55915
55944
|
try {
|
|
55916
55945
|
await stat9(installPath);
|
|
55917
55946
|
} catch {
|
|
55918
55947
|
await writeFile11(installPath, "", { encoding: "utf8" });
|
|
55919
55948
|
}
|
|
55920
55949
|
return {
|
|
55921
|
-
stagingPath:
|
|
55950
|
+
stagingPath: join37(dirs.staging, version),
|
|
55922
55951
|
installPath
|
|
55923
55952
|
};
|
|
55924
55953
|
}
|
|
@@ -56019,7 +56048,7 @@ async function atomicMoveToInstallPath(stagedBinaryPath, installPath) {
|
|
|
56019
56048
|
}
|
|
56020
56049
|
async function installVersionFromPackage(stagingPath, installPath) {
|
|
56021
56050
|
try {
|
|
56022
|
-
const nodeModulesDir =
|
|
56051
|
+
const nodeModulesDir = join37(stagingPath, "node_modules", "@anthropic-ai");
|
|
56023
56052
|
const entries = await readdir6(nodeModulesDir);
|
|
56024
56053
|
const nativePackage = entries.find((entry) => entry.startsWith("claude-cli-native-"));
|
|
56025
56054
|
if (!nativePackage) {
|
|
@@ -56030,7 +56059,7 @@ async function installVersionFromPackage(stagingPath, installPath) {
|
|
|
56030
56059
|
const error = new Error("Could not find platform-specific native package");
|
|
56031
56060
|
throw error;
|
|
56032
56061
|
}
|
|
56033
|
-
const stagedBinaryPath =
|
|
56062
|
+
const stagedBinaryPath = join37(nodeModulesDir, nativePackage, "cli");
|
|
56034
56063
|
try {
|
|
56035
56064
|
await stat9(stagedBinaryPath);
|
|
56036
56065
|
} catch {
|
|
@@ -56060,7 +56089,7 @@ async function installVersionFromBinary(stagingPath, installPath) {
|
|
|
56060
56089
|
try {
|
|
56061
56090
|
const platform2 = getPlatform3();
|
|
56062
56091
|
const binaryName = getBinaryName(platform2);
|
|
56063
|
-
const stagedBinaryPath =
|
|
56092
|
+
const stagedBinaryPath = join37(stagingPath, binaryName);
|
|
56064
56093
|
try {
|
|
56065
56094
|
await stat9(stagedBinaryPath);
|
|
56066
56095
|
} catch {
|
|
@@ -56393,7 +56422,7 @@ async function checkInstall(force = false) {
|
|
|
56393
56422
|
const shellType = getShellType();
|
|
56394
56423
|
const configPaths = getShellConfigPaths();
|
|
56395
56424
|
const configFile = configPaths[shellType];
|
|
56396
|
-
const displayPath = configFile ? configFile.replace(
|
|
56425
|
+
const displayPath = configFile ? configFile.replace(homedir11(), "~") : "your shell config file";
|
|
56397
56426
|
messages.push({
|
|
56398
56427
|
message: `Native installation exists but ~/.local/bin is not in your PATH. Run:
|
|
56399
56428
|
|
|
@@ -56460,7 +56489,7 @@ async function getVersionFromSymlink(symlinkPath) {
|
|
|
56460
56489
|
}
|
|
56461
56490
|
function getLockFilePathFromVersionPath(dirs, versionPath) {
|
|
56462
56491
|
const versionName = basename12(versionPath);
|
|
56463
|
-
return
|
|
56492
|
+
return join37(dirs.locks, `${versionName}.lock`);
|
|
56464
56493
|
}
|
|
56465
56494
|
async function lockCurrentVersion() {
|
|
56466
56495
|
const dirs = getBaseDirectories();
|
|
@@ -56554,7 +56583,7 @@ async function cleanupOldVersions() {
|
|
|
56554
56583
|
if (!/^claude\.exe\.old\.\d+$/.test(file))
|
|
56555
56584
|
continue;
|
|
56556
56585
|
try {
|
|
56557
|
-
await unlink4(
|
|
56586
|
+
await unlink4(join37(executableDir, file));
|
|
56558
56587
|
cleanedCount++;
|
|
56559
56588
|
} catch {}
|
|
56560
56589
|
}
|
|
@@ -56571,7 +56600,7 @@ async function cleanupOldVersions() {
|
|
|
56571
56600
|
const stagingEntries = await readdir6(dirs.staging);
|
|
56572
56601
|
let stagingCleanedCount = 0;
|
|
56573
56602
|
for (const entry of stagingEntries) {
|
|
56574
|
-
const stagingPath =
|
|
56603
|
+
const stagingPath = join37(dirs.staging, entry);
|
|
56575
56604
|
try {
|
|
56576
56605
|
const stats = await stat9(stagingPath);
|
|
56577
56606
|
if (stats.mtime.getTime() < oneHourAgo) {
|
|
@@ -56613,7 +56642,7 @@ async function cleanupOldVersions() {
|
|
|
56613
56642
|
const versionFiles = [];
|
|
56614
56643
|
let tempFilesCleanedCount = 0;
|
|
56615
56644
|
for (const entry of versionEntries) {
|
|
56616
|
-
const entryPath =
|
|
56645
|
+
const entryPath = join37(dirs.versions, entry);
|
|
56617
56646
|
if (/\.tmp\.\d+\.\d+$/.test(entry)) {
|
|
56618
56647
|
try {
|
|
56619
56648
|
const stats = await stat9(entryPath);
|
|
@@ -56805,9 +56834,9 @@ async function manualRemoveNpmPackage(packageName) {
|
|
|
56805
56834
|
}
|
|
56806
56835
|
}
|
|
56807
56836
|
if (getPlatform3().startsWith("win32")) {
|
|
56808
|
-
const binCmd =
|
|
56809
|
-
const binPs1 =
|
|
56810
|
-
const binExe =
|
|
56837
|
+
const binCmd = join37(globalPrefix, "claude.cmd");
|
|
56838
|
+
const binPs1 = join37(globalPrefix, "claude.ps1");
|
|
56839
|
+
const binExe = join37(globalPrefix, "claude");
|
|
56811
56840
|
if (await tryRemove(binCmd, "bin script")) {
|
|
56812
56841
|
manuallyRemoved = true;
|
|
56813
56842
|
}
|
|
@@ -56818,14 +56847,14 @@ async function manualRemoveNpmPackage(packageName) {
|
|
|
56818
56847
|
manuallyRemoved = true;
|
|
56819
56848
|
}
|
|
56820
56849
|
} else {
|
|
56821
|
-
const binSymlink =
|
|
56850
|
+
const binSymlink = join37(globalPrefix, "bin", "claude");
|
|
56822
56851
|
if (await tryRemove(binSymlink, "bin symlink")) {
|
|
56823
56852
|
manuallyRemoved = true;
|
|
56824
56853
|
}
|
|
56825
56854
|
}
|
|
56826
56855
|
if (manuallyRemoved) {
|
|
56827
56856
|
logForDebugging(`Successfully removed ${packageName} manually`);
|
|
56828
|
-
const nodeModulesPath = getPlatform3().startsWith("win32") ?
|
|
56857
|
+
const nodeModulesPath = getPlatform3().startsWith("win32") ? join37(globalPrefix, "node_modules", packageName) : join37(globalPrefix, "lib", "node_modules", packageName);
|
|
56829
56858
|
return {
|
|
56830
56859
|
success: true,
|
|
56831
56860
|
warning: `${packageName} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${nodeModulesPath}`
|
|
@@ -56894,7 +56923,7 @@ async function cleanupNpmInstallations() {
|
|
|
56894
56923
|
errors.push(macroPackageResult.error);
|
|
56895
56924
|
}
|
|
56896
56925
|
}
|
|
56897
|
-
const localInstallDir =
|
|
56926
|
+
const localInstallDir = join37(homedir11(), ".claude", "local");
|
|
56898
56927
|
try {
|
|
56899
56928
|
await rm7(localInstallDir, { recursive: true });
|
|
56900
56929
|
removed++;
|
|
@@ -57704,15 +57733,15 @@ var init_use_declared_cursor = __esm(() => {
|
|
|
57704
57733
|
|
|
57705
57734
|
// src/utils/imagePaste.ts
|
|
57706
57735
|
import { randomBytes as randomBytes7 } from "crypto";
|
|
57707
|
-
import { basename as basename13, extname as extname2, isAbsolute as isAbsolute6, join as
|
|
57736
|
+
import { basename as basename13, extname as extname2, isAbsolute as isAbsolute6, join as join38 } from "path";
|
|
57708
57737
|
function getClipboardCommands() {
|
|
57709
57738
|
const platform2 = process.platform;
|
|
57710
57739
|
const baseTmpDir = process.env.CLAUDE_CODE_TMPDIR || (platform2 === "win32" ? process.env.TEMP || "C:\\Temp" : "/tmp");
|
|
57711
57740
|
const screenshotFilename = "claude_cli_latest_screenshot.png";
|
|
57712
57741
|
const tempPaths = {
|
|
57713
|
-
darwin:
|
|
57714
|
-
linux:
|
|
57715
|
-
win32:
|
|
57742
|
+
darwin: join38(baseTmpDir, screenshotFilename),
|
|
57743
|
+
linux: join38(baseTmpDir, screenshotFilename),
|
|
57744
|
+
win32: join38(baseTmpDir, screenshotFilename)
|
|
57716
57745
|
};
|
|
57717
57746
|
const screenshotPath = tempPaths[platform2] || tempPaths.linux;
|
|
57718
57747
|
const commands = {
|
|
@@ -57891,9 +57920,9 @@ var init_imagePaste = __esm(() => {
|
|
|
57891
57920
|
|
|
57892
57921
|
// src/utils/imageStore.ts
|
|
57893
57922
|
import { mkdir as mkdir5, open as open4 } from "fs/promises";
|
|
57894
|
-
import { join as
|
|
57923
|
+
import { join as join39 } from "path";
|
|
57895
57924
|
function getImageStoreDir() {
|
|
57896
|
-
return
|
|
57925
|
+
return join39(getClaudeConfigHomeDir(), IMAGE_STORE_DIR, getSessionId());
|
|
57897
57926
|
}
|
|
57898
57927
|
async function ensureImageStoreDir() {
|
|
57899
57928
|
const dir = getImageStoreDir();
|
|
@@ -57901,7 +57930,7 @@ async function ensureImageStoreDir() {
|
|
|
57901
57930
|
}
|
|
57902
57931
|
function getImagePath(imageId, mediaType) {
|
|
57903
57932
|
const extension = mediaType.split("/")[1] || "png";
|
|
57904
|
-
return
|
|
57933
|
+
return join39(getImageStoreDir(), `${imageId}.${extension}`);
|
|
57905
57934
|
}
|
|
57906
57935
|
function cacheImagePath(content) {
|
|
57907
57936
|
if (content.type !== "image") {
|
|
@@ -57965,7 +57994,7 @@ function evictOldestIfAtCap() {
|
|
|
57965
57994
|
}
|
|
57966
57995
|
async function cleanupOldImageCaches() {
|
|
57967
57996
|
const fsImpl = getFsImplementation();
|
|
57968
|
-
const baseDir =
|
|
57997
|
+
const baseDir = join39(getClaudeConfigHomeDir(), IMAGE_STORE_DIR);
|
|
57969
57998
|
const currentSessionId = getSessionId();
|
|
57970
57999
|
try {
|
|
57971
58000
|
let sessionDirs;
|
|
@@ -57978,7 +58007,7 @@ async function cleanupOldImageCaches() {
|
|
|
57978
58007
|
if (sessionDir.name === currentSessionId) {
|
|
57979
58008
|
continue;
|
|
57980
58009
|
}
|
|
57981
|
-
const sessionPath =
|
|
58010
|
+
const sessionPath = join39(baseDir, sessionDir.name);
|
|
57982
58011
|
try {
|
|
57983
58012
|
await fsImpl.rm(sessionPath, { recursive: true, force: true });
|
|
57984
58013
|
logForDebugging(`Cleaned up old image cache: ${sessionPath}`);
|
|
@@ -58869,15 +58898,15 @@ var init_inputModes = () => {};
|
|
|
58869
58898
|
// src/utils/pasteStore.ts
|
|
58870
58899
|
import { createHash as createHash10 } from "crypto";
|
|
58871
58900
|
import { mkdir as mkdir6, readdir as readdir7, readFile as readFile10, stat as stat10, unlink as unlink5, writeFile as writeFile12 } from "fs/promises";
|
|
58872
|
-
import { join as
|
|
58901
|
+
import { join as join40 } from "path";
|
|
58873
58902
|
function getPasteStoreDir() {
|
|
58874
|
-
return
|
|
58903
|
+
return join40(getClaudeConfigHomeDir(), PASTE_STORE_DIR);
|
|
58875
58904
|
}
|
|
58876
58905
|
function hashPastedText(content) {
|
|
58877
58906
|
return createHash10("sha256").update(content).digest("hex").slice(0, 16);
|
|
58878
58907
|
}
|
|
58879
58908
|
function getPastePath(hash) {
|
|
58880
|
-
return
|
|
58909
|
+
return join40(getPasteStoreDir(), `${hash}.txt`);
|
|
58881
58910
|
}
|
|
58882
58911
|
async function storePastedText(hash, content) {
|
|
58883
58912
|
try {
|
|
@@ -58914,7 +58943,7 @@ async function cleanupOldPastes(cutoffDate) {
|
|
|
58914
58943
|
if (!file.endsWith(".txt")) {
|
|
58915
58944
|
continue;
|
|
58916
58945
|
}
|
|
58917
|
-
const filePath =
|
|
58946
|
+
const filePath = join40(pasteDir, file);
|
|
58918
58947
|
try {
|
|
58919
58948
|
const stats = await stat10(filePath);
|
|
58920
58949
|
if (stats.mtimeMs < cutoffTime) {
|
|
@@ -58933,7 +58962,7 @@ var init_pasteStore = __esm(() => {
|
|
|
58933
58962
|
|
|
58934
58963
|
// src/history.ts
|
|
58935
58964
|
import { appendFile, writeFile as writeFile13 } from "fs/promises";
|
|
58936
|
-
import { join as
|
|
58965
|
+
import { join as join41 } from "path";
|
|
58937
58966
|
function getPastedTextRefNumLines(text2) {
|
|
58938
58967
|
return (text2.match(/\r\n|\r|\n/g) || []).length;
|
|
58939
58968
|
}
|
|
@@ -58975,7 +59004,7 @@ async function* makeLogEntryReader() {
|
|
|
58975
59004
|
for (let i = pendingEntries.length - 1;i >= 0; i--) {
|
|
58976
59005
|
yield pendingEntries[i];
|
|
58977
59006
|
}
|
|
58978
|
-
const historyPath =
|
|
59007
|
+
const historyPath = join41(getClaudeConfigHomeDir(), "history.jsonl");
|
|
58979
59008
|
try {
|
|
58980
59009
|
for await (const line of readLinesReverse(historyPath)) {
|
|
58981
59010
|
try {
|
|
@@ -59070,7 +59099,7 @@ async function immediateFlushHistory() {
|
|
|
59070
59099
|
}
|
|
59071
59100
|
let release;
|
|
59072
59101
|
try {
|
|
59073
|
-
const historyPath =
|
|
59102
|
+
const historyPath = join41(getClaudeConfigHomeDir(), "history.jsonl");
|
|
59074
59103
|
await writeFile13(historyPath, "", {
|
|
59075
59104
|
encoding: "utf8",
|
|
59076
59105
|
mode: 384,
|
|
@@ -69040,7 +69069,7 @@ import {
|
|
|
69040
69069
|
stat as stat11,
|
|
69041
69070
|
unlink as unlink6
|
|
69042
69071
|
} from "fs/promises";
|
|
69043
|
-
import { dirname as dirname19, isAbsolute as isAbsolute7, join as
|
|
69072
|
+
import { dirname as dirname19, isAbsolute as isAbsolute7, join as join42, relative as relative3 } from "path";
|
|
69044
69073
|
import { inspect } from "util";
|
|
69045
69074
|
function fileHistoryEnabled() {
|
|
69046
69075
|
if (getIsNonInteractiveSession()) {
|
|
@@ -69459,7 +69488,7 @@ function getBackupFileName(filePath, version) {
|
|
|
69459
69488
|
}
|
|
69460
69489
|
function resolveBackupPath(backupFileName, sessionId) {
|
|
69461
69490
|
const configDir = getClaudeConfigHomeDir();
|
|
69462
|
-
return
|
|
69491
|
+
return join42(configDir, "file-history", sessionId || getSessionId(), backupFileName);
|
|
69463
69492
|
}
|
|
69464
69493
|
async function createBackup(filePath, version) {
|
|
69465
69494
|
if (filePath === null) {
|
|
@@ -69541,7 +69570,7 @@ function maybeExpandFilePath(filePath) {
|
|
|
69541
69570
|
if (isAbsolute7(filePath)) {
|
|
69542
69571
|
return filePath;
|
|
69543
69572
|
}
|
|
69544
|
-
return
|
|
69573
|
+
return join42(getOriginalCwd(), filePath);
|
|
69545
69574
|
}
|
|
69546
69575
|
function fileHistoryRestoreStateFromLog(fileHistorySnapshots, onUpdateState) {
|
|
69547
69576
|
if (!fileHistoryEnabled()) {
|
|
@@ -69587,14 +69616,14 @@ async function copyFileHistoryForResume(log) {
|
|
|
69587
69616
|
return;
|
|
69588
69617
|
}
|
|
69589
69618
|
try {
|
|
69590
|
-
const newBackupDir =
|
|
69619
|
+
const newBackupDir = join42(getClaudeConfigHomeDir(), "file-history", sessionId);
|
|
69591
69620
|
await mkdir7(newBackupDir, { recursive: true });
|
|
69592
69621
|
let failedSnapshots = 0;
|
|
69593
69622
|
await Promise.allSettled(fileHistorySnapshots.map(async (snapshot2) => {
|
|
69594
69623
|
const backupEntries = Object.values(snapshot2.trackedFileBackups).filter((backup) => backup.backupFileName !== null);
|
|
69595
69624
|
const results = await Promise.allSettled(backupEntries.map(async ({ backupFileName }) => {
|
|
69596
69625
|
const oldBackupPath = resolveBackupPath(backupFileName, previousSessionId);
|
|
69597
|
-
const newBackupPath =
|
|
69626
|
+
const newBackupPath = join42(newBackupDir, backupFileName);
|
|
69598
69627
|
try {
|
|
69599
69628
|
await link(oldBackupPath, newBackupPath);
|
|
69600
69629
|
} catch (e) {
|
|
@@ -69692,21 +69721,21 @@ var init_fileHistory = __esm(() => {
|
|
|
69692
69721
|
|
|
69693
69722
|
// src/utils/sessionEnvironment.ts
|
|
69694
69723
|
import { mkdir as mkdir8, readdir as readdir8, readFile as readFile12, writeFile as writeFile14 } from "fs/promises";
|
|
69695
|
-
import { join as
|
|
69724
|
+
import { join as join43 } from "path";
|
|
69696
69725
|
async function getSessionEnvDirPath() {
|
|
69697
|
-
const sessionEnvDir =
|
|
69726
|
+
const sessionEnvDir = join43(getClaudeConfigHomeDir(), "session-env", getSessionId());
|
|
69698
69727
|
await mkdir8(sessionEnvDir, { recursive: true });
|
|
69699
69728
|
return sessionEnvDir;
|
|
69700
69729
|
}
|
|
69701
69730
|
async function getHookEnvFilePath(hookEvent, hookIndex) {
|
|
69702
69731
|
const prefix = hookEvent.toLowerCase();
|
|
69703
|
-
return
|
|
69732
|
+
return join43(await getSessionEnvDirPath(), `${prefix}-hook-${hookIndex}.sh`);
|
|
69704
69733
|
}
|
|
69705
69734
|
async function clearCwdEnvFiles() {
|
|
69706
69735
|
try {
|
|
69707
69736
|
const dir = await getSessionEnvDirPath();
|
|
69708
69737
|
const files = await readdir8(dir);
|
|
69709
|
-
await Promise.all(files.filter((f) => (f.startsWith("filechanged-hook-") || f.startsWith("cwdchanged-hook-")) && HOOK_ENV_REGEX.test(f)).map((f) => writeFile14(
|
|
69738
|
+
await Promise.all(files.filter((f) => (f.startsWith("filechanged-hook-") || f.startsWith("cwdchanged-hook-")) && HOOK_ENV_REGEX.test(f)).map((f) => writeFile14(join43(dir, f), "")));
|
|
69710
69739
|
} catch (e) {
|
|
69711
69740
|
const code = getErrnoCode(e);
|
|
69712
69741
|
if (code !== "ENOENT") {
|
|
@@ -69747,7 +69776,7 @@ async function getSessionEnvironmentScript() {
|
|
|
69747
69776
|
const files = await readdir8(sessionEnvDir);
|
|
69748
69777
|
const hookFiles = files.filter((f) => HOOK_ENV_REGEX.test(f)).sort(sortHookEnvFiles);
|
|
69749
69778
|
for (const file of hookFiles) {
|
|
69750
|
-
const filePath =
|
|
69779
|
+
const filePath = join43(sessionEnvDir, file);
|
|
69751
69780
|
try {
|
|
69752
69781
|
const content = (await readFile12(filePath, "utf8")).trim();
|
|
69753
69782
|
if (content) {
|
|
@@ -69808,7 +69837,7 @@ var init_sessionEnvironment = __esm(() => {
|
|
|
69808
69837
|
});
|
|
69809
69838
|
|
|
69810
69839
|
// src/utils/hooks/fileChangedWatcher.ts
|
|
69811
|
-
import { isAbsolute as isAbsolute8, join as
|
|
69840
|
+
import { isAbsolute as isAbsolute8, join as join44 } from "path";
|
|
69812
69841
|
function setEnvHookNotifier(cb) {
|
|
69813
69842
|
notifyCallback = cb;
|
|
69814
69843
|
}
|
|
@@ -69836,7 +69865,7 @@ function resolveWatchPaths(config2) {
|
|
|
69836
69865
|
for (const name of m2.matcher.split("|").map((s) => s.trim())) {
|
|
69837
69866
|
if (!name)
|
|
69838
69867
|
continue;
|
|
69839
|
-
staticPaths.push(isAbsolute8(name) ? name :
|
|
69868
|
+
staticPaths.push(isAbsolute8(name) ? name : join44(currentCwd, name));
|
|
69840
69869
|
}
|
|
69841
69870
|
}
|
|
69842
69871
|
return [...new Set([...staticPaths, ...dynamicWatchPaths])];
|
|
@@ -70667,10 +70696,10 @@ var init_filesApi = __esm(() => {
|
|
|
70667
70696
|
// src/utils/tempfile.ts
|
|
70668
70697
|
import { createHash as createHash12, randomUUID as randomUUID7 } from "crypto";
|
|
70669
70698
|
import { tmpdir as tmpdir4 } from "os";
|
|
70670
|
-
import { join as
|
|
70699
|
+
import { join as join46 } from "path";
|
|
70671
70700
|
function generateTempFilePath(prefix = "claude-prompt", extension = ".md", options) {
|
|
70672
70701
|
const id = options?.contentHash ? createHash12("sha256").update(options.contentHash).digest("hex").slice(0, 16) : randomUUID7();
|
|
70673
|
-
return
|
|
70702
|
+
return join46(tmpdir4(), `${prefix}-${id}${extension}`);
|
|
70674
70703
|
}
|
|
70675
70704
|
var init_tempfile = () => {};
|
|
70676
70705
|
|
|
@@ -73798,7 +73827,7 @@ var init_extra_usage = __esm(() => {
|
|
|
73798
73827
|
name: "extra-usage",
|
|
73799
73828
|
description: "Configure extra usage to keep working when limits are hit",
|
|
73800
73829
|
isEnabled: () => isExtraUsageAllowed() && !getIsNonInteractiveSession(),
|
|
73801
|
-
load: () => import("./chunk-
|
|
73830
|
+
load: () => import("./chunk-c556rt3q.js")
|
|
73802
73831
|
};
|
|
73803
73832
|
extraUsageNonInteractive = {
|
|
73804
73833
|
type: "local",
|
|
@@ -77808,20 +77837,20 @@ __export(exports_teammateMailbox, {
|
|
|
77808
77837
|
ModeSetRequestMessageSchema: () => ModeSetRequestMessageSchema
|
|
77809
77838
|
});
|
|
77810
77839
|
import { mkdir as mkdir10, readFile as readFile14, writeFile as writeFile16 } from "fs/promises";
|
|
77811
|
-
import { join as
|
|
77840
|
+
import { join as join47 } from "path";
|
|
77812
77841
|
function getInboxPath(agentName, teamName) {
|
|
77813
77842
|
const team = teamName || getTeamName() || "default";
|
|
77814
77843
|
const safeTeam = sanitizePathComponent(team);
|
|
77815
77844
|
const safeAgentName = sanitizePathComponent(agentName);
|
|
77816
|
-
const inboxDir =
|
|
77817
|
-
const fullPath =
|
|
77845
|
+
const inboxDir = join47(getTeamsDir(), safeTeam, "inboxes");
|
|
77846
|
+
const fullPath = join47(inboxDir, `${safeAgentName}.json`);
|
|
77818
77847
|
logForDebugging(`[TeammateMailbox] getInboxPath: agent=${agentName}, team=${team}, fullPath=${fullPath}`);
|
|
77819
77848
|
return fullPath;
|
|
77820
77849
|
}
|
|
77821
77850
|
async function ensureInboxDir(teamName) {
|
|
77822
77851
|
const team = teamName || getTeamName() || "default";
|
|
77823
77852
|
const safeTeam = sanitizePathComponent(team);
|
|
77824
|
-
const inboxDir =
|
|
77853
|
+
const inboxDir = join47(getTeamsDir(), safeTeam, "inboxes");
|
|
77825
77854
|
await mkdir10(inboxDir, { recursive: true });
|
|
77826
77855
|
logForDebugging(`[TeammateMailbox] Ensured inbox directory: ${inboxDir}`);
|
|
77827
77856
|
}
|
|
@@ -84279,7 +84308,7 @@ var init_SkillTool = __esm(() => {
|
|
|
84279
84308
|
if (command?.type === "prompt" && command.context === "fork") {
|
|
84280
84309
|
return executeForkedSkill(command, commandName, args, context, canUseTool, parentMessage, onProgress);
|
|
84281
84310
|
}
|
|
84282
|
-
const { processPromptSlashCommand } = await import("./chunk-
|
|
84311
|
+
const { processPromptSlashCommand } = await import("./chunk-e6pjm749.js");
|
|
84283
84312
|
const processedCommand = await processPromptSlashCommand(commandName, args || "", commands, context);
|
|
84284
84313
|
if (!processedCommand.shouldQuery) {
|
|
84285
84314
|
throw new Error("Command processing failed");
|
|
@@ -84638,7 +84667,7 @@ var init_LSPDiagnosticRegistry = __esm(() => {
|
|
|
84638
84667
|
|
|
84639
84668
|
// src/utils/plugins/lspPluginIntegration.ts
|
|
84640
84669
|
import { readFile as readFile15 } from "fs/promises";
|
|
84641
|
-
import { join as
|
|
84670
|
+
import { join as join48, relative as relative6, resolve as resolve13 } from "path";
|
|
84642
84671
|
function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
84643
84672
|
const resolvedPluginPath = resolve13(pluginPath);
|
|
84644
84673
|
const resolvedFilePath = resolve13(pluginPath, relativePath);
|
|
@@ -84650,7 +84679,7 @@ function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
|
84650
84679
|
}
|
|
84651
84680
|
async function loadPluginLspServers(plugin, errors = []) {
|
|
84652
84681
|
const servers = {};
|
|
84653
|
-
const lspJsonPath =
|
|
84682
|
+
const lspJsonPath = join48(plugin.path, ".lsp.json");
|
|
84654
84683
|
try {
|
|
84655
84684
|
const content = await readFile15(lspJsonPath, "utf-8");
|
|
84656
84685
|
const parsed = jsonParse(content);
|
|
@@ -89165,7 +89194,7 @@ var init_fileOperationAnalytics = __esm(() => {
|
|
|
89165
89194
|
|
|
89166
89195
|
// src/utils/gitDiff.ts
|
|
89167
89196
|
import { access as access4, readFile as readFile16 } from "fs/promises";
|
|
89168
|
-
import { dirname as dirname21, join as
|
|
89197
|
+
import { dirname as dirname21, join as join49, relative as relative7, sep as sep10 } from "path";
|
|
89169
89198
|
async function fetchGitDiff() {
|
|
89170
89199
|
const isGit = await getIsGit();
|
|
89171
89200
|
if (!isGit)
|
|
@@ -89316,7 +89345,7 @@ async function isInTransientGitState() {
|
|
|
89316
89345
|
"CHERRY_PICK_HEAD",
|
|
89317
89346
|
"REVERT_HEAD"
|
|
89318
89347
|
];
|
|
89319
|
-
const results = await Promise.all(transientFiles.map((file) => access4(
|
|
89348
|
+
const results = await Promise.all(transientFiles.map((file) => access4(join49(gitDir, file)).then(() => true).catch(() => false)));
|
|
89320
89349
|
return results.some(Boolean);
|
|
89321
89350
|
}
|
|
89322
89351
|
async function fetchUntrackedFiles(maxFiles) {
|
|
@@ -93395,9 +93424,9 @@ var init_FileWriteTool = __esm(() => {
|
|
|
93395
93424
|
});
|
|
93396
93425
|
|
|
93397
93426
|
// src/utils/plugins/orphanedPluginFilter.ts
|
|
93398
|
-
import { dirname as dirname24, isAbsolute as isAbsolute11, join as
|
|
93427
|
+
import { dirname as dirname24, isAbsolute as isAbsolute11, join as join50, normalize as normalize4, relative as relative10, sep as sep13 } from "path";
|
|
93399
93428
|
async function getGlobExclusionsForPluginCache(searchPath) {
|
|
93400
|
-
const cachePath = normalize4(
|
|
93429
|
+
const cachePath = normalize4(join50(getPluginsDirectory(), "cache"));
|
|
93401
93430
|
if (searchPath && !pathsOverlap(searchPath, cachePath)) {
|
|
93402
93431
|
return [];
|
|
93403
93432
|
}
|
|
@@ -93445,7 +93474,7 @@ var init_orphanedPluginFilter = __esm(() => {
|
|
|
93445
93474
|
});
|
|
93446
93475
|
|
|
93447
93476
|
// src/utils/glob.ts
|
|
93448
|
-
import { basename as basename21, dirname as dirname25, isAbsolute as isAbsolute12, join as
|
|
93477
|
+
import { basename as basename21, dirname as dirname25, isAbsolute as isAbsolute12, join as join51, sep as sep14 } from "path";
|
|
93449
93478
|
function extractGlobBaseDirectory(pattern) {
|
|
93450
93479
|
const globChars = /[*?[{]/;
|
|
93451
93480
|
const match = pattern.match(globChars);
|
|
@@ -93497,7 +93526,7 @@ async function glob(filePattern, cwd, { limit, offset }, abortSignal, toolPermis
|
|
|
93497
93526
|
args.push("--glob", exclusion);
|
|
93498
93527
|
}
|
|
93499
93528
|
const allPaths = await ripGrep2(args, searchDir, abortSignal);
|
|
93500
|
-
const absolutePaths = allPaths.map((p) => isAbsolute12(p) ? p :
|
|
93529
|
+
const absolutePaths = allPaths.map((p) => isAbsolute12(p) ? p : join51(searchDir, p));
|
|
93501
93530
|
const truncated = absolutePaths.length > offset + limit;
|
|
93502
93531
|
const files = absolutePaths.slice(offset, offset + limit);
|
|
93503
93532
|
return { files, truncated };
|
|
@@ -94861,7 +94890,7 @@ var init_bashPipeCommand = __esm(() => {
|
|
|
94861
94890
|
import { execFile as execFile2 } from "child_process";
|
|
94862
94891
|
import { mkdir as mkdir11, stat as stat13 } from "fs/promises";
|
|
94863
94892
|
import * as os2 from "os";
|
|
94864
|
-
import { join as
|
|
94893
|
+
import { join as join52 } from "path";
|
|
94865
94894
|
function createArgv0ShellFunction(funcName, argv0, binaryPath, prependArgs = []) {
|
|
94866
94895
|
const quotedPath = quote([binaryPath]);
|
|
94867
94896
|
const argSuffix = prependArgs.length > 0 ? `${prependArgs.join(" ")} "$@"` : '"$@"';
|
|
@@ -94917,7 +94946,7 @@ function createFindGrepShellIntegration() {
|
|
|
94917
94946
|
}
|
|
94918
94947
|
function getConfigFile(shellPath) {
|
|
94919
94948
|
const fileName = shellPath.includes("zsh") ? ".zshrc" : shellPath.includes("bash") ? ".bashrc" : ".profile";
|
|
94920
|
-
const configPath =
|
|
94949
|
+
const configPath = join52(os2.homedir(), fileName);
|
|
94921
94950
|
return configPath;
|
|
94922
94951
|
}
|
|
94923
94952
|
function getUserSnapshotContent(configFile) {
|
|
@@ -95071,9 +95100,9 @@ var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_T
|
|
|
95071
95100
|
}
|
|
95072
95101
|
const timestamp2 = Date.now();
|
|
95073
95102
|
const randomId = Math.random().toString(36).substring(2, 8);
|
|
95074
|
-
const snapshotsDir =
|
|
95103
|
+
const snapshotsDir = join52(getClaudeConfigHomeDir(), "shell-snapshots");
|
|
95075
95104
|
logForDebugging(`Snapshots directory: ${snapshotsDir}`);
|
|
95076
|
-
const shellSnapshotPath =
|
|
95105
|
+
const shellSnapshotPath = join52(snapshotsDir, `snapshot-${shellType}-${timestamp2}-${randomId}.sh`);
|
|
95077
95106
|
await mkdir11(snapshotsDir, { recursive: true });
|
|
95078
95107
|
const snapshotScript = await getSnapshotScript(binShell, shellSnapshotPath, configFileExists);
|
|
95079
95108
|
logForDebugging(`Creating snapshot at: ${shellSnapshotPath}`);
|
|
@@ -95628,7 +95657,7 @@ var init_powershellDetection = __esm(() => {
|
|
|
95628
95657
|
|
|
95629
95658
|
// src/utils/shell/powershellProvider.ts
|
|
95630
95659
|
import { tmpdir as tmpdir5 } from "os";
|
|
95631
|
-
import { join as
|
|
95660
|
+
import { join as join53 } from "path";
|
|
95632
95661
|
import { join as posixJoin2 } from "path/posix";
|
|
95633
95662
|
function buildPowerShellArgs(cmd) {
|
|
95634
95663
|
return ["-NoProfile", "-NonInteractive", "-Command", cmd];
|
|
@@ -95644,7 +95673,7 @@ function createPowerShellProvider(shellPath) {
|
|
|
95644
95673
|
detached: false,
|
|
95645
95674
|
async buildExecCommand(command, opts) {
|
|
95646
95675
|
currentSandboxTmpDir = opts.useSandbox ? opts.sandboxTmpDir : undefined;
|
|
95647
|
-
const cwdFilePath = opts.useSandbox && opts.sandboxTmpDir ? posixJoin2(opts.sandboxTmpDir, `claude-pwd-ps-${opts.id}`) :
|
|
95676
|
+
const cwdFilePath = opts.useSandbox && opts.sandboxTmpDir ? posixJoin2(opts.sandboxTmpDir, `claude-pwd-ps-${opts.id}`) : join53(tmpdir5(), `claude-pwd-ps-${opts.id}`);
|
|
95648
95677
|
const escapedCwdFilePath = cwdFilePath.replace(/'/g, "''");
|
|
95649
95678
|
const cwdTracking = `
|
|
95650
95679
|
; $_ec = if ($null -ne $LASTEXITCODE) { $LASTEXITCODE } elseif ($?) { 0 } else { 1 }
|
|
@@ -95682,7 +95711,7 @@ var init_powershellProvider = __esm(() => {
|
|
|
95682
95711
|
|
|
95683
95712
|
// src/utils/Shell.ts
|
|
95684
95713
|
import { execFileSync as execFileSync2, spawn as spawn7 } from "child_process";
|
|
95685
|
-
import { constants as fsConstants3, readFileSync as
|
|
95714
|
+
import { constants as fsConstants3, readFileSync as readFileSync6, unlinkSync as unlinkSync2 } from "fs";
|
|
95686
95715
|
import { mkdir as mkdir12, open as open6, realpath as realpath5 } from "fs/promises";
|
|
95687
95716
|
import { isAbsolute as isAbsolute13, resolve as resolve16 } from "path";
|
|
95688
95717
|
import { join as posixJoin3 } from "path/posix";
|
|
@@ -95843,7 +95872,7 @@ async function exec(command, abortSignal, shellType, options) {
|
|
|
95843
95872
|
}
|
|
95844
95873
|
if (result && !preventCwdChanges && !result.backgroundTaskId) {
|
|
95845
95874
|
try {
|
|
95846
|
-
let newCwd =
|
|
95875
|
+
let newCwd = readFileSync6(nativeCwdFilePath, {
|
|
95847
95876
|
encoding: "utf8"
|
|
95848
95877
|
}).trim();
|
|
95849
95878
|
if (getPlatform() === "windows") {
|
|
@@ -97071,7 +97100,7 @@ var init_UI8 = __esm(() => {
|
|
|
97071
97100
|
|
|
97072
97101
|
// src/utils/toolResultStorage.ts
|
|
97073
97102
|
import { mkdir as mkdir13, writeFile as writeFile17 } from "fs/promises";
|
|
97074
|
-
import { join as
|
|
97103
|
+
import { join as join54 } from "path";
|
|
97075
97104
|
function getPersistenceThreshold(toolName, declaredMaxResultSizeChars) {
|
|
97076
97105
|
if (!Number.isFinite(declaredMaxResultSizeChars)) {
|
|
97077
97106
|
return declaredMaxResultSizeChars;
|
|
@@ -97084,14 +97113,14 @@ function getPersistenceThreshold(toolName, declaredMaxResultSizeChars) {
|
|
|
97084
97113
|
return Math.min(declaredMaxResultSizeChars, DEFAULT_MAX_RESULT_SIZE_CHARS);
|
|
97085
97114
|
}
|
|
97086
97115
|
function getSessionDir() {
|
|
97087
|
-
return
|
|
97116
|
+
return join54(getProjectDir(getOriginalCwd()), getSessionId());
|
|
97088
97117
|
}
|
|
97089
97118
|
function getToolResultsDir() {
|
|
97090
|
-
return
|
|
97119
|
+
return join54(getSessionDir(), TOOL_RESULTS_SUBDIR);
|
|
97091
97120
|
}
|
|
97092
97121
|
function getToolResultPath(id, isJson) {
|
|
97093
97122
|
const ext = isJson ? "json" : "txt";
|
|
97094
|
-
return
|
|
97123
|
+
return join54(getToolResultsDir(), `${id}.${ext}`);
|
|
97095
97124
|
}
|
|
97096
97125
|
async function ensureToolResultsDir() {
|
|
97097
97126
|
try {
|
|
@@ -97509,7 +97538,7 @@ var init_toolResultStorage = __esm(() => {
|
|
|
97509
97538
|
|
|
97510
97539
|
// src/utils/mcpOutputStorage.ts
|
|
97511
97540
|
import { writeFile as writeFile18 } from "fs/promises";
|
|
97512
|
-
import { join as
|
|
97541
|
+
import { join as join55 } from "path";
|
|
97513
97542
|
function getFormatDescription(type, schema) {
|
|
97514
97543
|
switch (type) {
|
|
97515
97544
|
case "toolResult":
|
|
@@ -97606,7 +97635,7 @@ function isBinaryContentType(contentType) {
|
|
|
97606
97635
|
async function persistBinaryContent(bytes, mimeType, persistId) {
|
|
97607
97636
|
await ensureToolResultsDir();
|
|
97608
97637
|
const ext = extensionForMimeType(mimeType);
|
|
97609
|
-
const filepath =
|
|
97638
|
+
const filepath = join55(getToolResultsDir(), `${persistId}.${ext}`);
|
|
97610
97639
|
try {
|
|
97611
97640
|
await writeFile18(filepath, bytes);
|
|
97612
97641
|
} catch (error) {
|
|
@@ -98157,7 +98186,7 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
|
|
|
98157
98186
|
|
|
98158
98187
|
// src/utils/listSessionsImpl.ts
|
|
98159
98188
|
import { readdir as readdir9, stat as stat16 } from "fs/promises";
|
|
98160
|
-
import { basename as basename22, join as
|
|
98189
|
+
import { basename as basename22, join as join56 } from "path";
|
|
98161
98190
|
async function listCandidates(projectDir, doStat, projectPath) {
|
|
98162
98191
|
let names;
|
|
98163
98192
|
try {
|
|
@@ -98171,7 +98200,7 @@ async function listCandidates(projectDir, doStat, projectPath) {
|
|
|
98171
98200
|
const sessionId = validateUuid(name.slice(0, -6));
|
|
98172
98201
|
if (!sessionId)
|
|
98173
98202
|
return null;
|
|
98174
|
-
const filePath =
|
|
98203
|
+
const filePath = join56(projectDir, name);
|
|
98175
98204
|
if (!doStat)
|
|
98176
98205
|
return { sessionId, filePath, mtime: 0, projectPath };
|
|
98177
98206
|
try {
|
|
@@ -98190,9 +98219,9 @@ var init_listSessionsImpl = __esm(() => {
|
|
|
98190
98219
|
|
|
98191
98220
|
// src/services/autoDream/consolidationLock.ts
|
|
98192
98221
|
import { mkdir as mkdir14, readFile as readFile18, stat as stat17, unlink as unlink9, utimes as utimes2, writeFile as writeFile19 } from "fs/promises";
|
|
98193
|
-
import { join as
|
|
98222
|
+
import { join as join57 } from "path";
|
|
98194
98223
|
function lockPath() {
|
|
98195
|
-
return
|
|
98224
|
+
return join57(getAutoMemPath(), LOCK_FILE);
|
|
98196
98225
|
}
|
|
98197
98226
|
async function readLastConsolidatedAt() {
|
|
98198
98227
|
try {
|
|
@@ -111577,7 +111606,7 @@ var init_sedValidation = __esm(() => {
|
|
|
111577
111606
|
});
|
|
111578
111607
|
|
|
111579
111608
|
// src/tools/BashTool/pathValidation.ts
|
|
111580
|
-
import { homedir as
|
|
111609
|
+
import { homedir as homedir13 } from "os";
|
|
111581
111610
|
import { isAbsolute as isAbsolute15, resolve as resolve18 } from "path";
|
|
111582
111611
|
function checkDangerousRemovalPaths(command, args, cwd) {
|
|
111583
111612
|
const extractor = PATH_EXTRACTORS[command];
|
|
@@ -112026,7 +112055,7 @@ var init_pathValidation2 = __esm(() => {
|
|
|
112026
112055
|
init_bashPermissions();
|
|
112027
112056
|
init_sedValidation();
|
|
112028
112057
|
PATH_EXTRACTORS = {
|
|
112029
|
-
cd: (args) => args.length === 0 ? [
|
|
112058
|
+
cd: (args) => args.length === 0 ? [homedir13()] : [args.join(" ")],
|
|
112030
112059
|
ls: (args) => {
|
|
112031
112060
|
const paths = filterOutFlags(args);
|
|
112032
112061
|
return paths.length > 0 ? paths : ["."];
|
|
@@ -114386,7 +114415,7 @@ var init_InProcessBackend = __esm(() => {
|
|
|
114386
114415
|
});
|
|
114387
114416
|
|
|
114388
114417
|
// src/utils/swarm/backends/it2Setup.ts
|
|
114389
|
-
import { homedir as
|
|
114418
|
+
import { homedir as homedir14 } from "os";
|
|
114390
114419
|
async function detectPythonPackageManager() {
|
|
114391
114420
|
const uvResult = await execFileNoThrow("which", ["uv"]);
|
|
114392
114421
|
if (uvResult.code === 0) {
|
|
@@ -114421,18 +114450,18 @@ async function installIt2(packageManager) {
|
|
|
114421
114450
|
switch (packageManager) {
|
|
114422
114451
|
case "uvx":
|
|
114423
114452
|
result = await execFileNoThrowWithCwd("uv", ["tool", "install", "it2"], {
|
|
114424
|
-
cwd:
|
|
114453
|
+
cwd: homedir14()
|
|
114425
114454
|
});
|
|
114426
114455
|
break;
|
|
114427
114456
|
case "pipx":
|
|
114428
114457
|
result = await execFileNoThrowWithCwd("pipx", ["install", "it2"], {
|
|
114429
|
-
cwd:
|
|
114458
|
+
cwd: homedir14()
|
|
114430
114459
|
});
|
|
114431
114460
|
break;
|
|
114432
114461
|
case "pip":
|
|
114433
|
-
result = await execFileNoThrowWithCwd("pip", ["install", "--user", "it2"], { cwd:
|
|
114462
|
+
result = await execFileNoThrowWithCwd("pip", ["install", "--user", "it2"], { cwd: homedir14() });
|
|
114434
114463
|
if (result.code !== 0) {
|
|
114435
|
-
result = await execFileNoThrowWithCwd("pip3", ["install", "--user", "it2"], { cwd:
|
|
114464
|
+
result = await execFileNoThrowWithCwd("pip3", ["install", "--user", "it2"], { cwd: homedir14() });
|
|
114436
114465
|
}
|
|
114437
114466
|
break;
|
|
114438
114467
|
}
|
|
@@ -114810,8 +114839,8 @@ var init_PaneBackendExecutor = __esm(() => {
|
|
|
114810
114839
|
async function ensureBackendsRegistered() {
|
|
114811
114840
|
if (backendsRegistered)
|
|
114812
114841
|
return;
|
|
114813
|
-
await import("./chunk-
|
|
114814
|
-
await import("./chunk-
|
|
114842
|
+
await import("./chunk-cd0k0jnh.js");
|
|
114843
|
+
await import("./chunk-0sggm0er.js");
|
|
114815
114844
|
backendsRegistered = true;
|
|
114816
114845
|
}
|
|
114817
114846
|
function registerTmuxBackend(backendClass) {
|
|
@@ -115435,9 +115464,9 @@ var init_TeamDeleteTool = __esm(() => {
|
|
|
115435
115464
|
|
|
115436
115465
|
// src/utils/concurrentSessions.ts
|
|
115437
115466
|
import { chmod as chmod9, mkdir as mkdir15, readdir as readdir10, readFile as readFile19, unlink as unlink10, writeFile as writeFile21 } from "fs/promises";
|
|
115438
|
-
import { join as
|
|
115467
|
+
import { join as join58 } from "path";
|
|
115439
115468
|
function getSessionsDir() {
|
|
115440
|
-
return
|
|
115469
|
+
return join58(getClaudeConfigHomeDir(), "sessions");
|
|
115441
115470
|
}
|
|
115442
115471
|
function envSessionKind() {
|
|
115443
115472
|
if (false) {}
|
|
@@ -115448,7 +115477,7 @@ async function registerSession() {
|
|
|
115448
115477
|
return false;
|
|
115449
115478
|
const kind = envSessionKind() ?? "interactive";
|
|
115450
115479
|
const dir = getSessionsDir();
|
|
115451
|
-
const pidFile =
|
|
115480
|
+
const pidFile = join58(dir, `${process.pid}.json`);
|
|
115452
115481
|
registerCleanup(async () => {
|
|
115453
115482
|
try {
|
|
115454
115483
|
await unlink10(pidFile);
|
|
@@ -115477,7 +115506,7 @@ async function registerSession() {
|
|
|
115477
115506
|
}
|
|
115478
115507
|
}
|
|
115479
115508
|
async function updatePidFile(patch) {
|
|
115480
|
-
const pidFile =
|
|
115509
|
+
const pidFile = join58(getSessionsDir(), `${process.pid}.json`);
|
|
115481
115510
|
try {
|
|
115482
115511
|
const data = jsonParse(await readFile19(pidFile, "utf8"));
|
|
115483
115512
|
await writeFile21(pidFile, jsonStringify({ ...data, ...patch }));
|
|
@@ -115516,7 +115545,7 @@ async function countConcurrentSessions() {
|
|
|
115516
115545
|
if (isProcessRunning(pid)) {
|
|
115517
115546
|
count2++;
|
|
115518
115547
|
} else if (getPlatform() !== "wsl") {
|
|
115519
|
-
unlink10(
|
|
115548
|
+
unlink10(join58(dir, file)).catch(() => {});
|
|
115520
115549
|
}
|
|
115521
115550
|
}
|
|
115522
115551
|
return count2;
|
|
@@ -117460,7 +117489,7 @@ function trackGitOperations(command, exitCode, stdout) {
|
|
|
117460
117489
|
if (stdout) {
|
|
117461
117490
|
const prInfo = findPrInStdout(stdout);
|
|
117462
117491
|
if (prInfo) {
|
|
117463
|
-
import("./chunk-
|
|
117492
|
+
import("./chunk-nms0csv3.js").then(({ linkSessionToPR }) => {
|
|
117464
117493
|
import("./chunk-44fpr6jq.js").then(({ getSessionId: getSessionId2 }) => {
|
|
117465
117494
|
const sessionId = getSessionId2();
|
|
117466
117495
|
if (sessionId) {
|
|
@@ -119776,7 +119805,7 @@ var init_modeValidation2 = __esm(() => {
|
|
|
119776
119805
|
});
|
|
119777
119806
|
|
|
119778
119807
|
// src/tools/PowerShellTool/pathValidation.ts
|
|
119779
|
-
import { homedir as
|
|
119808
|
+
import { homedir as homedir15 } from "os";
|
|
119780
119809
|
import { isAbsolute as isAbsolute16, resolve as resolve20 } from "path";
|
|
119781
119810
|
function matchesParam(paramLower, paramList) {
|
|
119782
119811
|
for (const p of paramList) {
|
|
@@ -119799,7 +119828,7 @@ function formatDirectoryList2(directories) {
|
|
|
119799
119828
|
}
|
|
119800
119829
|
function expandTilde2(filePath) {
|
|
119801
119830
|
if (filePath === "~" || filePath.startsWith("~/") || filePath.startsWith("~\\")) {
|
|
119802
|
-
return
|
|
119831
|
+
return homedir15() + filePath.slice(1);
|
|
119803
119832
|
}
|
|
119804
119833
|
return filePath;
|
|
119805
119834
|
}
|
|
@@ -127467,7 +127496,7 @@ var init_messagePredicates = () => {};
|
|
|
127467
127496
|
// src/utils/pdf.ts
|
|
127468
127497
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
127469
127498
|
import { mkdir as mkdir16, readdir as readdir11, readFile as readFile20 } from "fs/promises";
|
|
127470
|
-
import { join as
|
|
127499
|
+
import { join as join59 } from "path";
|
|
127471
127500
|
async function readPDF(filePath) {
|
|
127472
127501
|
try {
|
|
127473
127502
|
const fs8 = getFsImplementation();
|
|
@@ -127577,9 +127606,9 @@ async function extractPDFPages(filePath, options) {
|
|
|
127577
127606
|
};
|
|
127578
127607
|
}
|
|
127579
127608
|
const uuid = randomUUID10();
|
|
127580
|
-
const outputDir =
|
|
127609
|
+
const outputDir = join59(getToolResultsDir(), `pdf-${uuid}`);
|
|
127581
127610
|
await mkdir16(outputDir, { recursive: true });
|
|
127582
|
-
const prefix =
|
|
127611
|
+
const prefix = join59(outputDir, "page");
|
|
127583
127612
|
const args = ["-jpeg", "-r", "100"];
|
|
127584
127613
|
if (options?.firstPage) {
|
|
127585
127614
|
args.push("-f", String(options.firstPage));
|
|
@@ -127787,13 +127816,13 @@ var init_memoryTypes = __esm(() => {
|
|
|
127787
127816
|
|
|
127788
127817
|
// src/memdir/memoryScan.ts
|
|
127789
127818
|
import { readdir as readdir12 } from "fs/promises";
|
|
127790
|
-
import { basename as basename24, join as
|
|
127819
|
+
import { basename as basename24, join as join60 } from "path";
|
|
127791
127820
|
async function scanMemoryFiles(memoryDir, signal) {
|
|
127792
127821
|
try {
|
|
127793
127822
|
const entries = await readdir12(memoryDir, { recursive: true });
|
|
127794
127823
|
const mdFiles = entries.filter((f) => f.endsWith(".md") && basename24(f) !== "MEMORY.md");
|
|
127795
127824
|
const headerResults = await Promise.allSettled(mdFiles.map(async (relativePath) => {
|
|
127796
|
-
const filePath =
|
|
127825
|
+
const filePath = join60(memoryDir, relativePath);
|
|
127797
127826
|
const { content, mtimeMs } = await readFileInRange(filePath, 0, FRONTMATTER_MAX_LINES, undefined, signal);
|
|
127798
127827
|
const { frontmatter } = parseFrontmatter(content, filePath);
|
|
127799
127828
|
return {
|
|
@@ -136174,12 +136203,12 @@ var init_queryHelpers = __esm(() => {
|
|
|
136174
136203
|
import { randomUUID as randomUUID14 } from "crypto";
|
|
136175
136204
|
import { rm as rm8 } from "fs";
|
|
136176
136205
|
import { appendFile as appendFile2, copyFile as copyFile7, mkdir as mkdir17 } from "fs/promises";
|
|
136177
|
-
import { dirname as dirname27, isAbsolute as isAbsolute17, join as
|
|
136206
|
+
import { dirname as dirname27, isAbsolute as isAbsolute17, join as join61, relative as relative14 } from "path";
|
|
136178
136207
|
function safeRemoveOverlay(overlayPath) {
|
|
136179
136208
|
rm8(overlayPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }, () => {});
|
|
136180
136209
|
}
|
|
136181
136210
|
function getOverlayPath(id) {
|
|
136182
|
-
return
|
|
136211
|
+
return join61(getClaudeTempDir(), "speculation", String(process.pid), id);
|
|
136183
136212
|
}
|
|
136184
136213
|
function denySpeculation(message, reason) {
|
|
136185
136214
|
return {
|
|
@@ -136191,8 +136220,8 @@ function denySpeculation(message, reason) {
|
|
|
136191
136220
|
async function copyOverlayToMain(overlayPath, writtenPaths, cwd) {
|
|
136192
136221
|
let allCopied = true;
|
|
136193
136222
|
for (const rel of writtenPaths) {
|
|
136194
|
-
const src =
|
|
136195
|
-
const dest =
|
|
136223
|
+
const src = join61(overlayPath, rel);
|
|
136224
|
+
const dest = join61(cwd, rel);
|
|
136196
136225
|
try {
|
|
136197
136226
|
await mkdir17(dirname27(dest), { recursive: true });
|
|
136198
136227
|
await copyFile7(src, dest);
|
|
@@ -136442,17 +136471,17 @@ async function startSpeculation(suggestionText, context, setAppState, isPipeline
|
|
|
136442
136471
|
}
|
|
136443
136472
|
if (isWriteTool) {
|
|
136444
136473
|
if (!writtenPathsRef.current.has(rel)) {
|
|
136445
|
-
const overlayFile =
|
|
136474
|
+
const overlayFile = join61(overlayPath, rel);
|
|
136446
136475
|
await mkdir17(dirname27(overlayFile), { recursive: true });
|
|
136447
136476
|
try {
|
|
136448
|
-
await copyFile7(
|
|
136477
|
+
await copyFile7(join61(cwd, rel), overlayFile);
|
|
136449
136478
|
} catch {}
|
|
136450
136479
|
writtenPathsRef.current.add(rel);
|
|
136451
136480
|
}
|
|
136452
|
-
input = { ...input, [pathKey]:
|
|
136481
|
+
input = { ...input, [pathKey]: join61(overlayPath, rel) };
|
|
136453
136482
|
} else {
|
|
136454
136483
|
if (writtenPathsRef.current.has(rel)) {
|
|
136455
|
-
input = { ...input, [pathKey]:
|
|
136484
|
+
input = { ...input, [pathKey]: join61(overlayPath, rel) };
|
|
136456
136485
|
}
|
|
136457
136486
|
}
|
|
136458
136487
|
logForDebugging(`[Speculation] ${isWriteTool ? "Write" : "Read"} ${filePath} -> ${input[pathKey]}`);
|
|
@@ -138927,16 +138956,16 @@ import {
|
|
|
138927
138956
|
basename as basename25,
|
|
138928
138957
|
dirname as dirname28,
|
|
138929
138958
|
isAbsolute as isAbsolute18,
|
|
138930
|
-
join as
|
|
138959
|
+
join as join62,
|
|
138931
138960
|
sep as pathSep,
|
|
138932
138961
|
relative as relative15
|
|
138933
138962
|
} from "path";
|
|
138934
138963
|
function getSkillsPath(source, dir) {
|
|
138935
138964
|
switch (source) {
|
|
138936
138965
|
case "policySettings":
|
|
138937
|
-
return
|
|
138966
|
+
return join62(getManagedFilePath(), ".claude", dir);
|
|
138938
138967
|
case "userSettings":
|
|
138939
|
-
return
|
|
138968
|
+
return join62(getClaudeConfigHomeDir(), dir);
|
|
138940
138969
|
case "projectSettings":
|
|
138941
138970
|
return `.claude/${dir}`;
|
|
138942
138971
|
case "plugin":
|
|
@@ -139106,8 +139135,8 @@ async function loadSkillsFromSkillsDir(basePath, source) {
|
|
|
139106
139135
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
139107
139136
|
return null;
|
|
139108
139137
|
}
|
|
139109
|
-
const skillDirPath =
|
|
139110
|
-
const skillFilePath =
|
|
139138
|
+
const skillDirPath = join62(basePath, entry.name);
|
|
139139
|
+
const skillFilePath = join62(skillDirPath, "SKILL.md");
|
|
139111
139140
|
let content;
|
|
139112
139141
|
try {
|
|
139113
139142
|
content = await fs8.readFile(skillFilePath, { encoding: "utf-8" });
|
|
@@ -139262,7 +139291,7 @@ async function discoverSkillDirsForPaths(filePaths, cwd) {
|
|
|
139262
139291
|
for (const filePath of filePaths) {
|
|
139263
139292
|
let currentDir = dirname28(filePath);
|
|
139264
139293
|
while (currentDir.startsWith(resolvedCwd + pathSep)) {
|
|
139265
|
-
const skillDir =
|
|
139294
|
+
const skillDir = join62(currentDir, ".claude", "skills");
|
|
139266
139295
|
if (!dynamicSkillDirs.has(skillDir)) {
|
|
139267
139296
|
dynamicSkillDirs.add(skillDir);
|
|
139268
139297
|
try {
|
|
@@ -139387,8 +139416,8 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
139387
139416
|
init_mcpSkillBuilders();
|
|
139388
139417
|
import_ignore3 = __toESM(require_ignore(), 1);
|
|
139389
139418
|
getSkillDirCommands = memoize_default(async (cwd) => {
|
|
139390
|
-
const userSkillsDir =
|
|
139391
|
-
const managedSkillsDir =
|
|
139419
|
+
const userSkillsDir = join62(getClaudeConfigHomeDir(), "skills");
|
|
139420
|
+
const managedSkillsDir = join62(getManagedFilePath(), ".claude", "skills");
|
|
139392
139421
|
const projectSkillsDirs = getProjectDirsUpToHome("skills", cwd);
|
|
139393
139422
|
logForDebugging(`Loading skills from: managed=${managedSkillsDir}, user=${userSkillsDir}, project=[${projectSkillsDirs.join(", ")}]`);
|
|
139394
139423
|
const additionalDirs = getAdditionalDirectoriesForClaudeMd();
|
|
@@ -139399,7 +139428,7 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
139399
139428
|
logForDebugging(`[bare] Skipping skill dir discovery (${additionalDirs.length === 0 ? "no --add-dir" : "projectSettings disabled or skillsLocked"})`);
|
|
139400
139429
|
return [];
|
|
139401
139430
|
}
|
|
139402
|
-
const additionalSkillsNested2 = await Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(
|
|
139431
|
+
const additionalSkillsNested2 = await Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(join62(dir, ".claude", "skills"), "projectSettings")));
|
|
139403
139432
|
return additionalSkillsNested2.flat().map((s) => s.skill);
|
|
139404
139433
|
}
|
|
139405
139434
|
const [
|
|
@@ -139412,7 +139441,7 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
139412
139441
|
isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_POLICY_SKILLS) ? Promise.resolve([]) : loadSkillsFromSkillsDir(managedSkillsDir, "policySettings"),
|
|
139413
139442
|
isSettingSourceEnabled("userSettings") && !skillsLocked ? loadSkillsFromSkillsDir(userSkillsDir, "userSettings") : Promise.resolve([]),
|
|
139414
139443
|
projectSettingsEnabled ? Promise.all(projectSkillsDirs.map((dir) => loadSkillsFromSkillsDir(dir, "projectSettings"))) : Promise.resolve([]),
|
|
139415
|
-
projectSettingsEnabled ? Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(
|
|
139444
|
+
projectSettingsEnabled ? Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(join62(dir, ".claude", "skills"), "projectSettings"))) : Promise.resolve([]),
|
|
139416
139445
|
skillsLocked ? Promise.resolve([]) : loadSkillsFromCommandsDir(cwd)
|
|
139417
139446
|
]);
|
|
139418
139447
|
const allSkillsWithPaths = [
|
|
@@ -141901,7 +141930,7 @@ var init_postCompactCleanup = __esm(() => {
|
|
|
141901
141930
|
|
|
141902
141931
|
// src/services/SessionMemory/prompts.ts
|
|
141903
141932
|
import { readFile as readFile22 } from "fs/promises";
|
|
141904
|
-
import { join as
|
|
141933
|
+
import { join as join64 } from "path";
|
|
141905
141934
|
function getDefaultUpdatePrompt() {
|
|
141906
141935
|
return `IMPORTANT: This message and these instructions are NOT part of the actual user conversation. Do NOT include any references to "note-taking", "session notes extraction", or these update instructions in the notes content.
|
|
141907
141936
|
|
|
@@ -141942,7 +141971,7 @@ You ONLY update the actual content that comes AFTER these two preserved lines. T
|
|
|
141942
141971
|
REMEMBER: Use the Edit tool in parallel and stop. Do not continue after the edits. Only include insights from the actual user conversation, never from these note-taking instructions. Do not delete or change section headers or italic _section descriptions_.`;
|
|
141943
141972
|
}
|
|
141944
141973
|
async function loadSessionMemoryTemplate() {
|
|
141945
|
-
const templatePath =
|
|
141974
|
+
const templatePath = join64(getClaudeConfigHomeDir(), "session-memory", "config", "template.md");
|
|
141946
141975
|
try {
|
|
141947
141976
|
return await readFile22(templatePath, { encoding: "utf-8" });
|
|
141948
141977
|
} catch (e) {
|
|
@@ -141955,7 +141984,7 @@ async function loadSessionMemoryTemplate() {
|
|
|
141955
141984
|
}
|
|
141956
141985
|
}
|
|
141957
141986
|
async function loadSessionMemoryPrompt() {
|
|
141958
|
-
const promptPath =
|
|
141987
|
+
const promptPath = join64(getClaudeConfigHomeDir(), "session-memory", "config", "prompt.md");
|
|
141959
141988
|
try {
|
|
141960
141989
|
return await readFile22(promptPath, { encoding: "utf-8" });
|
|
141961
141990
|
} catch (e) {
|
|
@@ -142667,7 +142696,7 @@ async function countBuiltInToolTokens(tools, getToolPermissionContext, agentInfo
|
|
|
142667
142696
|
systemToolDetails: []
|
|
142668
142697
|
};
|
|
142669
142698
|
}
|
|
142670
|
-
const { isToolSearchEnabled: isToolSearchEnabled2 } = await import("./chunk-
|
|
142699
|
+
const { isToolSearchEnabled: isToolSearchEnabled2 } = await import("./chunk-zb71mx14.js");
|
|
142671
142700
|
const { isDeferredTool: isDeferredTool2 } = await import("./chunk-dekk6f4c.js");
|
|
142672
142701
|
const isDeferred = await isToolSearchEnabled2(model ?? "", tools, getToolPermissionContext, agentInfo?.activeAgents ?? [], "analyzeBuiltIn");
|
|
142673
142702
|
const alwaysLoadedTools = builtInTools.filter((t) => !isDeferredTool2(t));
|
|
@@ -142802,7 +142831,7 @@ async function countMcpToolTokens(tools, getToolPermissionContext, agentInfo, mo
|
|
|
142802
142831
|
}))));
|
|
142803
142832
|
const estimateTotal = estimates.reduce((s, e) => s + e, 0) || 1;
|
|
142804
142833
|
const mcpToolTokensByTool = estimates.map((e) => Math.round(e / estimateTotal * totalTokens));
|
|
142805
|
-
const { isToolSearchEnabled: isToolSearchEnabled2 } = await import("./chunk-
|
|
142834
|
+
const { isToolSearchEnabled: isToolSearchEnabled2 } = await import("./chunk-zb71mx14.js");
|
|
142806
142835
|
const { isDeferredTool: isDeferredTool2 } = await import("./chunk-dekk6f4c.js");
|
|
142807
142836
|
const isDeferred = await isToolSearchEnabled2(model, tools, getToolPermissionContext, agentInfo?.activeAgents ?? [], "analyzeMcp");
|
|
142808
142837
|
const loadedMcpToolNames = new Set;
|
|
@@ -143563,7 +143592,7 @@ var init_toolSearch = __esm(() => {
|
|
|
143563
143592
|
// src/services/vcr.ts
|
|
143564
143593
|
import { createHash as createHash14, randomUUID as randomUUID16 } from "crypto";
|
|
143565
143594
|
import { mkdir as mkdir18, readFile as readFile23, writeFile as writeFile22 } from "fs/promises";
|
|
143566
|
-
import { dirname as dirname29, join as
|
|
143595
|
+
import { dirname as dirname29, join as join65 } from "path";
|
|
143567
143596
|
function shouldUseVCR() {
|
|
143568
143597
|
if (false) {}
|
|
143569
143598
|
if (process.env.USER_TYPE === "ant" && isEnvTruthy(process.env.FORCE_VCR)) {
|
|
@@ -143576,7 +143605,7 @@ async function withFixture(input, fixtureName, f) {
|
|
|
143576
143605
|
return await f();
|
|
143577
143606
|
}
|
|
143578
143607
|
const hash = createHash14("sha1").update(jsonStringify(input)).digest("hex").slice(0, 12);
|
|
143579
|
-
const filename =
|
|
143608
|
+
const filename = join65(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
|
|
143580
143609
|
try {
|
|
143581
143610
|
const cached2 = jsonParse(await readFile23(filename, { encoding: "utf8" }));
|
|
143582
143611
|
return cached2;
|
|
@@ -143610,7 +143639,7 @@ async function withVCR(messages, f) {
|
|
|
143610
143639
|
return true;
|
|
143611
143640
|
}));
|
|
143612
143641
|
const dehydratedInput = mapMessages(messagesForAPI.map((_2) => _2.message.content), dehydrateValue);
|
|
143613
|
-
const filename =
|
|
143642
|
+
const filename = join65(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_2) => createHash14("sha1").update(jsonStringify(_2)).digest("hex").slice(0, 6)).join("-")}.json`);
|
|
143614
143643
|
try {
|
|
143615
143644
|
const cached2 = jsonParse(await readFile23(filename, { encoding: "utf8" }));
|
|
143616
143645
|
cached2.output.forEach(addCachedCostToTotalSessionCost);
|
|
@@ -146426,7 +146455,7 @@ var init_xaaIdpLogin = __esm(() => {
|
|
|
146426
146455
|
import { createHash as createHash15, randomBytes as randomBytes12, randomUUID as randomUUID17 } from "crypto";
|
|
146427
146456
|
import { mkdir as mkdir19 } from "fs/promises";
|
|
146428
146457
|
import { createServer as createServer6 } from "http";
|
|
146429
|
-
import { join as
|
|
146458
|
+
import { join as join66 } from "path";
|
|
146430
146459
|
import { parse as parse7 } from "url";
|
|
146431
146460
|
function redactSensitiveUrlParams(url2) {
|
|
146432
146461
|
try {
|
|
@@ -147538,7 +147567,7 @@ class ClaudeAuthProvider {
|
|
|
147538
147567
|
const claudeDir = getClaudeConfigHomeDir();
|
|
147539
147568
|
await mkdir19(claudeDir, { recursive: true });
|
|
147540
147569
|
const sanitizedKey = serverKey.replace(/[^a-zA-Z0-9]/g, "_");
|
|
147541
|
-
const lockfilePath =
|
|
147570
|
+
const lockfilePath = join66(claudeDir, `mcp-refresh-${sanitizedKey}.lock`);
|
|
147542
147571
|
let release;
|
|
147543
147572
|
for (let retry = 0;retry < MAX_LOCK_RETRIES; retry++) {
|
|
147544
147573
|
try {
|
|
@@ -149161,7 +149190,7 @@ var init_toolRendering = __esm(() => {
|
|
|
149161
149190
|
|
|
149162
149191
|
// src/services/mcp/client.ts
|
|
149163
149192
|
import { mkdir as mkdir20, readFile as readFile24, unlink as unlink11, writeFile as writeFile23 } from "fs/promises";
|
|
149164
|
-
import { dirname as dirname30, join as
|
|
149193
|
+
import { dirname as dirname30, join as join67 } from "path";
|
|
149165
149194
|
function isMcpSessionExpiredError(error) {
|
|
149166
149195
|
const httpStatus = "code" in error ? error.code : undefined;
|
|
149167
149196
|
if (httpStatus !== 404) {
|
|
@@ -149173,7 +149202,7 @@ function getMcpToolTimeoutMs() {
|
|
|
149173
149202
|
return parseInt(process.env.MCP_TOOL_TIMEOUT || "", 10) || DEFAULT_MCP_TOOL_TIMEOUT_MS;
|
|
149174
149203
|
}
|
|
149175
149204
|
function getMcpAuthCachePath() {
|
|
149176
|
-
return
|
|
149205
|
+
return join67(getClaudeConfigHomeDir(), "mcp-needs-auth-cache.json");
|
|
149177
149206
|
}
|
|
149178
149207
|
function getMcpAuthCache() {
|
|
149179
149208
|
if (!authCachePromise) {
|
|
@@ -150324,7 +150353,7 @@ var init_client5 = __esm(() => {
|
|
|
150324
150353
|
transport = new StreamableHTTPClientTransport(new URL(proxyUrl), transportOptions);
|
|
150325
150354
|
logMCPDebug(name, `claude.ai proxy transport created successfully`);
|
|
150326
150355
|
} else if ((serverRef.type === "stdio" || !serverRef.type) && isClaudeInChromeMCPServer(name)) {
|
|
150327
|
-
const { createChromeContext } = await import("./chunk-
|
|
150356
|
+
const { createChromeContext } = await import("./chunk-6wdaz3qb.js");
|
|
150328
150357
|
const { createClaudeForChromeMcpServer } = await import("./chunk-bm1qb16p.js");
|
|
150329
150358
|
const { createLinkedTransportPair } = await import("./chunk-1h2famwb.js");
|
|
150330
150359
|
const context = createChromeContext(serverRef.env);
|
|
@@ -155392,8 +155421,8 @@ var init_permissionSetup = __esm(() => {
|
|
|
155392
155421
|
// src/utils/markdownConfigLoader.ts
|
|
155393
155422
|
import { statSync as statSync2 } from "fs";
|
|
155394
155423
|
import { lstat as lstat3, readdir as readdir15, readFile as readFile25, realpath as realpath7, stat as stat23 } from "fs/promises";
|
|
155395
|
-
import { homedir as
|
|
155396
|
-
import { dirname as dirname32, join as
|
|
155424
|
+
import { homedir as homedir16 } from "os";
|
|
155425
|
+
import { dirname as dirname32, join as join68, resolve as resolve25, sep as sep16 } from "path";
|
|
155397
155426
|
function extractDescriptionFromMarkdown(content, defaultDescription = "Custom item") {
|
|
155398
155427
|
const lines = content.split(`
|
|
155399
155428
|
`);
|
|
@@ -155475,7 +155504,7 @@ function resolveStopBoundary(cwd) {
|
|
|
155475
155504
|
return cwdGitRoot;
|
|
155476
155505
|
}
|
|
155477
155506
|
function getProjectDirsUpToHome(subdir, cwd) {
|
|
155478
|
-
const home = resolve25(
|
|
155507
|
+
const home = resolve25(homedir16()).normalize("NFC");
|
|
155479
155508
|
const gitRoot = resolveStopBoundary(cwd);
|
|
155480
155509
|
let current = resolve25(cwd);
|
|
155481
155510
|
const dirs = [];
|
|
@@ -155483,7 +155512,7 @@ function getProjectDirsUpToHome(subdir, cwd) {
|
|
|
155483
155512
|
if (normalizePathForComparison(current) === normalizePathForComparison(home)) {
|
|
155484
155513
|
break;
|
|
155485
155514
|
}
|
|
155486
|
-
const claudeSubdir =
|
|
155515
|
+
const claudeSubdir = join68(current, ".claude", subdir);
|
|
155487
155516
|
try {
|
|
155488
155517
|
statSync2(claudeSubdir);
|
|
155489
155518
|
dirs.push(claudeSubdir);
|
|
@@ -155530,7 +155559,7 @@ async function findMarkdownFilesNative(dir, signal) {
|
|
|
155530
155559
|
if (signal.aborted) {
|
|
155531
155560
|
break;
|
|
155532
155561
|
}
|
|
155533
|
-
const fullPath =
|
|
155562
|
+
const fullPath = join68(currentDir, entry.name);
|
|
155534
155563
|
try {
|
|
155535
155564
|
if (entry.isSymbolicLink()) {
|
|
155536
155565
|
try {
|
|
@@ -155616,16 +155645,16 @@ var init_markdownConfigLoader = __esm(() => {
|
|
|
155616
155645
|
];
|
|
155617
155646
|
loadMarkdownFilesForSubdir = memoize_default(async function(subdir, cwd) {
|
|
155618
155647
|
const searchStartTime = Date.now();
|
|
155619
|
-
const userDir =
|
|
155620
|
-
const managedDir =
|
|
155648
|
+
const userDir = join68(getClaudeConfigHomeDir(), subdir);
|
|
155649
|
+
const managedDir = join68(getManagedFilePath(), ".claude", subdir);
|
|
155621
155650
|
const projectDirs = getProjectDirsUpToHome(subdir, cwd);
|
|
155622
155651
|
const gitRoot = findGitRoot(cwd);
|
|
155623
155652
|
const canonicalRoot = findCanonicalGitRoot(cwd);
|
|
155624
155653
|
if (gitRoot && canonicalRoot && canonicalRoot !== gitRoot) {
|
|
155625
|
-
const worktreeSubdir = normalizePathForComparison(
|
|
155654
|
+
const worktreeSubdir = normalizePathForComparison(join68(gitRoot, ".claude", subdir));
|
|
155626
155655
|
const worktreeHasSubdir = projectDirs.some((dir) => normalizePathForComparison(dir) === worktreeSubdir);
|
|
155627
155656
|
if (!worktreeHasSubdir) {
|
|
155628
|
-
const mainClaudeSubdir =
|
|
155657
|
+
const mainClaudeSubdir = join68(canonicalRoot, ".claude", subdir);
|
|
155629
155658
|
if (!projectDirs.includes(mainClaudeSubdir)) {
|
|
155630
155659
|
projectDirs.push(mainClaudeSubdir);
|
|
155631
155660
|
}
|
|
@@ -159610,7 +159639,7 @@ var init_types13 = __esm(() => {
|
|
|
159610
159639
|
import { createHash as createHash17 } from "crypto";
|
|
159611
159640
|
import { readFileSync as fsReadFileSync } from "fs";
|
|
159612
159641
|
import { unlink as unlink12, writeFile as writeFile24 } from "fs/promises";
|
|
159613
|
-
import { join as
|
|
159642
|
+
import { join as join69 } from "path";
|
|
159614
159643
|
function isNodeError(e) {
|
|
159615
159644
|
return e instanceof Error;
|
|
159616
159645
|
}
|
|
@@ -159638,7 +159667,7 @@ function initializePolicyLimitsLoadingPromise() {
|
|
|
159638
159667
|
}
|
|
159639
159668
|
}
|
|
159640
159669
|
function getCachePath() {
|
|
159641
|
-
return
|
|
159670
|
+
return join69(getClaudeConfigHomeDir(), CACHE_FILENAME);
|
|
159642
159671
|
}
|
|
159643
159672
|
function getPolicyLimitsEndpoint() {
|
|
159644
159673
|
return `${getOauthConfig().BASE_API_URL}/api/claude_code/policy_limits`;
|
|
@@ -160017,7 +160046,7 @@ var init_feedback = __esm(() => {
|
|
|
160017
160046
|
description: `Submit feedback about Claude Code`,
|
|
160018
160047
|
argumentHint: "[report]",
|
|
160019
160048
|
isEnabled: () => !(isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) || isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) || isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY) || isEnvTruthy(process.env.DISABLE_FEEDBACK_COMMAND) || isEnvTruthy(process.env.DISABLE_BUG_COMMAND) || isEssentialTrafficOnly() || process.env.USER_TYPE === "ant" || !isPolicyAllowed("allow_product_feedback")),
|
|
160020
|
-
load: () => import("./chunk-
|
|
160049
|
+
load: () => import("./chunk-gby1m1pm.js")
|
|
160021
160050
|
};
|
|
160022
160051
|
feedback_default = feedback;
|
|
160023
160052
|
});
|
|
@@ -160031,7 +160060,7 @@ var init_clear = __esm(() => {
|
|
|
160031
160060
|
description: "Clear conversation history and free up context",
|
|
160032
160061
|
aliases: ["reset", "new"],
|
|
160033
160062
|
supportsNonInteractive: false,
|
|
160034
|
-
load: () => import("./chunk-
|
|
160063
|
+
load: () => import("./chunk-9nay76zd.js")
|
|
160035
160064
|
};
|
|
160036
160065
|
clear_default = clear;
|
|
160037
160066
|
});
|
|
@@ -160045,7 +160074,7 @@ var init_color2 = __esm(() => {
|
|
|
160045
160074
|
description: "Set the prompt bar color for this session",
|
|
160046
160075
|
immediate: true,
|
|
160047
160076
|
argumentHint: "<color|default>",
|
|
160048
|
-
load: () => import("./chunk-
|
|
160077
|
+
load: () => import("./chunk-90gr0yb3.js")
|
|
160049
160078
|
};
|
|
160050
160079
|
color_default = color2;
|
|
160051
160080
|
});
|
|
@@ -160145,7 +160174,7 @@ var init_copy = __esm(() => {
|
|
|
160145
160174
|
type: "local-jsx",
|
|
160146
160175
|
name: "copy",
|
|
160147
160176
|
description: "Copy Claude's last response to clipboard (or /copy N for the Nth-latest)",
|
|
160148
|
-
load: () => import("./chunk-
|
|
160177
|
+
load: () => import("./chunk-86xtb4mk.js")
|
|
160149
160178
|
};
|
|
160150
160179
|
copy_default = copy;
|
|
160151
160180
|
});
|
|
@@ -160172,7 +160201,7 @@ var init_desktop = __esm(() => {
|
|
|
160172
160201
|
get isHidden() {
|
|
160173
160202
|
return !isSupportedPlatform2();
|
|
160174
160203
|
},
|
|
160175
|
-
load: () => import("./chunk-
|
|
160204
|
+
load: () => import("./chunk-24ycwx7b.js")
|
|
160176
160205
|
};
|
|
160177
160206
|
desktop_default = desktop;
|
|
160178
160207
|
});
|
|
@@ -160335,7 +160364,7 @@ var init_compact2 = __esm(() => {
|
|
|
160335
160364
|
isEnabled: () => !isEnvTruthy(process.env.DISABLE_COMPACT),
|
|
160336
160365
|
supportsNonInteractive: true,
|
|
160337
160366
|
argumentHint: "<optional custom summarization instructions>",
|
|
160338
|
-
load: () => import("./chunk-
|
|
160367
|
+
load: () => import("./chunk-jfee6dt7.js")
|
|
160339
160368
|
};
|
|
160340
160369
|
compact_default = compact;
|
|
160341
160370
|
});
|
|
@@ -160348,7 +160377,7 @@ var init_config7 = __esm(() => {
|
|
|
160348
160377
|
type: "local-jsx",
|
|
160349
160378
|
name: "config",
|
|
160350
160379
|
description: "Open config panel",
|
|
160351
|
-
load: () => import("./chunk-
|
|
160380
|
+
load: () => import("./chunk-cqpvt0mt.js")
|
|
160352
160381
|
};
|
|
160353
160382
|
config_default = config2;
|
|
160354
160383
|
});
|
|
@@ -160362,7 +160391,7 @@ var init_context3 = __esm(() => {
|
|
|
160362
160391
|
description: "Visualize current context usage as a colored grid",
|
|
160363
160392
|
isEnabled: () => !getIsNonInteractiveSession(),
|
|
160364
160393
|
type: "local-jsx",
|
|
160365
|
-
load: () => import("./chunk-
|
|
160394
|
+
load: () => import("./chunk-2a1pbzv4.js")
|
|
160366
160395
|
};
|
|
160367
160396
|
contextNonInteractive = {
|
|
160368
160397
|
type: "local",
|
|
@@ -160375,7 +160404,7 @@ var init_context3 = __esm(() => {
|
|
|
160375
160404
|
isEnabled() {
|
|
160376
160405
|
return getIsNonInteractiveSession();
|
|
160377
160406
|
},
|
|
160378
|
-
load: () => import("./chunk-
|
|
160407
|
+
load: () => import("./chunk-ex2hdehn.js")
|
|
160379
160408
|
};
|
|
160380
160409
|
});
|
|
160381
160410
|
|
|
@@ -160394,7 +160423,7 @@ var init_cost = __esm(() => {
|
|
|
160394
160423
|
return isClaudeAISubscriber();
|
|
160395
160424
|
},
|
|
160396
160425
|
supportsNonInteractive: true,
|
|
160397
|
-
load: () => import("./chunk-
|
|
160426
|
+
load: () => import("./chunk-582kxtbh.js")
|
|
160398
160427
|
};
|
|
160399
160428
|
cost_default = cost;
|
|
160400
160429
|
});
|
|
@@ -160406,7 +160435,7 @@ var init_diff2 = __esm(() => {
|
|
|
160406
160435
|
type: "local-jsx",
|
|
160407
160436
|
name: "diff",
|
|
160408
160437
|
description: "View uncommitted changes and per-turn diffs",
|
|
160409
|
-
load: () => import("./chunk-
|
|
160438
|
+
load: () => import("./chunk-sc0fas5c.js")
|
|
160410
160439
|
};
|
|
160411
160440
|
});
|
|
160412
160441
|
|
|
@@ -160425,7 +160454,7 @@ var init_doctor = __esm(() => {
|
|
|
160425
160454
|
description: "Diagnose and verify your Claude Code installation and settings",
|
|
160426
160455
|
isEnabled: () => !isEnvTruthy(process.env.DISABLE_DOCTOR_COMMAND),
|
|
160427
160456
|
type: "local-jsx",
|
|
160428
|
-
load: () => import("./chunk-
|
|
160457
|
+
load: () => import("./chunk-nc9j5k7t.js")
|
|
160429
160458
|
};
|
|
160430
160459
|
doctor_default = doctor;
|
|
160431
160460
|
});
|
|
@@ -160437,7 +160466,7 @@ var init_memory = __esm(() => {
|
|
|
160437
160466
|
type: "local-jsx",
|
|
160438
160467
|
name: "memory",
|
|
160439
160468
|
description: "Edit Claude memory files",
|
|
160440
|
-
load: () => import("./chunk-
|
|
160469
|
+
load: () => import("./chunk-jvb1dp1x.js")
|
|
160441
160470
|
};
|
|
160442
160471
|
memory_default = memory;
|
|
160443
160472
|
});
|
|
@@ -160449,7 +160478,7 @@ var init_help = __esm(() => {
|
|
|
160449
160478
|
type: "local-jsx",
|
|
160450
160479
|
name: "help",
|
|
160451
160480
|
description: "Show help and available commands",
|
|
160452
|
-
load: () => import("./chunk-
|
|
160481
|
+
load: () => import("./chunk-k020eh12.js")
|
|
160453
160482
|
};
|
|
160454
160483
|
help_default = help;
|
|
160455
160484
|
});
|
|
@@ -160462,7 +160491,7 @@ var init_ide2 = __esm(() => {
|
|
|
160462
160491
|
name: "ide",
|
|
160463
160492
|
description: "Manage IDE integrations and show status",
|
|
160464
160493
|
argumentHint: "[open]",
|
|
160465
|
-
load: () => import("./chunk-
|
|
160494
|
+
load: () => import("./chunk-yhm5s26b.js")
|
|
160466
160495
|
};
|
|
160467
160496
|
ide_default = ide;
|
|
160468
160497
|
});
|
|
@@ -160787,7 +160816,7 @@ var init_keybindings = __esm(() => {
|
|
|
160787
160816
|
isEnabled: () => isKeybindingCustomizationEnabled(),
|
|
160788
160817
|
supportsNonInteractive: false,
|
|
160789
160818
|
type: "local",
|
|
160790
|
-
load: () => import("./chunk-
|
|
160819
|
+
load: () => import("./chunk-cgjs9cht.js")
|
|
160791
160820
|
};
|
|
160792
160821
|
keybindings_default = keybindings;
|
|
160793
160822
|
});
|
|
@@ -160798,7 +160827,7 @@ var login_default = () => ({
|
|
|
160798
160827
|
name: "login",
|
|
160799
160828
|
description: hasAnthropicApiKeyAuth() ? "Switch Anthropic accounts" : "Sign in with your Anthropic account",
|
|
160800
160829
|
isEnabled: () => !isEnvTruthy(process.env.DISABLE_LOGIN_COMMAND),
|
|
160801
|
-
load: () => import("./chunk-
|
|
160830
|
+
load: () => import("./chunk-tvhjf6ns.js")
|
|
160802
160831
|
});
|
|
160803
160832
|
var init_login = __esm(() => {
|
|
160804
160833
|
init_auth();
|
|
@@ -160814,7 +160843,7 @@ var init_logout2 = __esm(() => {
|
|
|
160814
160843
|
name: "logout",
|
|
160815
160844
|
description: "Sign out from your Anthropic account",
|
|
160816
160845
|
isEnabled: () => !isEnvTruthy(process.env.DISABLE_LOGOUT_COMMAND),
|
|
160817
|
-
load: () => import("./chunk-
|
|
160846
|
+
load: () => import("./chunk-ztjf67xg.js")
|
|
160818
160847
|
};
|
|
160819
160848
|
});
|
|
160820
160849
|
|
|
@@ -160828,7 +160857,7 @@ var init_install_github_app = __esm(() => {
|
|
|
160828
160857
|
description: "Set up Claude GitHub Actions for a repository",
|
|
160829
160858
|
availability: ["claude-ai", "console"],
|
|
160830
160859
|
isEnabled: () => !isEnvTruthy(process.env.DISABLE_INSTALL_GITHUB_APP_COMMAND),
|
|
160831
|
-
load: () => import("./chunk-
|
|
160860
|
+
load: () => import("./chunk-ty36dqav.js")
|
|
160832
160861
|
};
|
|
160833
160862
|
install_github_app_default = installGitHubApp;
|
|
160834
160863
|
});
|
|
@@ -160862,7 +160891,7 @@ var init_mcp = __esm(() => {
|
|
|
160862
160891
|
description: "Manage MCP servers",
|
|
160863
160892
|
immediate: true,
|
|
160864
160893
|
argumentHint: "[enable|disable [server-name]]",
|
|
160865
|
-
load: () => import("./chunk-
|
|
160894
|
+
load: () => import("./chunk-fv5aaq1q.js")
|
|
160866
160895
|
};
|
|
160867
160896
|
mcp_default = mcp;
|
|
160868
160897
|
});
|
|
@@ -161005,7 +161034,7 @@ var init_rename = __esm(() => {
|
|
|
161005
161034
|
description: "Rename the current conversation",
|
|
161006
161035
|
immediate: true,
|
|
161007
161036
|
argumentHint: "[name]",
|
|
161008
|
-
load: () => import("./chunk-
|
|
161037
|
+
load: () => import("./chunk-6ca83nk6.js")
|
|
161009
161038
|
};
|
|
161010
161039
|
rename_default = rename7;
|
|
161011
161040
|
});
|
|
@@ -161019,7 +161048,7 @@ var init_resume = __esm(() => {
|
|
|
161019
161048
|
description: "Resume a previous conversation",
|
|
161020
161049
|
aliases: ["continue"],
|
|
161021
161050
|
argumentHint: "[conversation id or search term]",
|
|
161022
|
-
load: () => import("./chunk-
|
|
161051
|
+
load: () => import("./chunk-x7kc9mgr.js")
|
|
161023
161052
|
};
|
|
161024
161053
|
resume_default = resume;
|
|
161025
161054
|
});
|
|
@@ -161075,7 +161104,7 @@ var init_review = __esm(() => {
|
|
|
161075
161104
|
name: "ultrareview",
|
|
161076
161105
|
description: `~10\u201320 min \xB7 Finds and verifies bugs in your branch. Runs in Claude Code on the web. See ${CCR_TERMS_URL}`,
|
|
161077
161106
|
isEnabled: () => isUltrareviewEnabled(),
|
|
161078
|
-
load: () => import("./chunk-
|
|
161107
|
+
load: () => import("./chunk-z30mkwed.js")
|
|
161079
161108
|
};
|
|
161080
161109
|
review_default = review;
|
|
161081
161110
|
});
|
|
@@ -161093,7 +161122,7 @@ var init_session = __esm(() => {
|
|
|
161093
161122
|
get isHidden() {
|
|
161094
161123
|
return !getIsRemoteMode();
|
|
161095
161124
|
},
|
|
161096
|
-
load: () => import("./chunk-
|
|
161125
|
+
load: () => import("./chunk-n010544z.js")
|
|
161097
161126
|
};
|
|
161098
161127
|
session_default = session;
|
|
161099
161128
|
});
|
|
@@ -161111,7 +161140,7 @@ var init_skills = __esm(() => {
|
|
|
161111
161140
|
type: "local-jsx",
|
|
161112
161141
|
name: "skills",
|
|
161113
161142
|
description: "List available skills",
|
|
161114
|
-
load: () => import("./chunk-
|
|
161143
|
+
load: () => import("./chunk-e0gs2a7d.js")
|
|
161115
161144
|
};
|
|
161116
161145
|
skills_default = skills;
|
|
161117
161146
|
});
|
|
@@ -161124,7 +161153,7 @@ var init_status2 = __esm(() => {
|
|
|
161124
161153
|
name: "status",
|
|
161125
161154
|
description: "Show Claude Code status including version, model, account, API connectivity, and tool statuses",
|
|
161126
161155
|
immediate: true,
|
|
161127
|
-
load: () => import("./chunk-
|
|
161156
|
+
load: () => import("./chunk-3t42tbak.js")
|
|
161128
161157
|
};
|
|
161129
161158
|
status_default = status;
|
|
161130
161159
|
});
|
|
@@ -161137,7 +161166,7 @@ var init_tasks3 = __esm(() => {
|
|
|
161137
161166
|
name: "tasks",
|
|
161138
161167
|
aliases: ["bashes"],
|
|
161139
161168
|
description: "List and manage background tasks",
|
|
161140
|
-
load: () => import("./chunk-
|
|
161169
|
+
load: () => import("./chunk-x8r2chc3.js")
|
|
161141
161170
|
};
|
|
161142
161171
|
tasks_default = tasks;
|
|
161143
161172
|
});
|
|
@@ -161414,7 +161443,7 @@ var init_usage = __esm(() => {
|
|
|
161414
161443
|
name: "usage",
|
|
161415
161444
|
description: "Show plan usage limits",
|
|
161416
161445
|
availability: ["claude-ai"],
|
|
161417
|
-
load: () => import("./chunk-
|
|
161446
|
+
load: () => import("./chunk-b2b1fr8t.js")
|
|
161418
161447
|
};
|
|
161419
161448
|
});
|
|
161420
161449
|
|
|
@@ -161425,7 +161454,7 @@ var init_theme2 = __esm(() => {
|
|
|
161425
161454
|
type: "local-jsx",
|
|
161426
161455
|
name: "theme",
|
|
161427
161456
|
description: "Change the theme",
|
|
161428
|
-
load: () => import("./chunk-
|
|
161457
|
+
load: () => import("./chunk-a4rm38km.js")
|
|
161429
161458
|
};
|
|
161430
161459
|
theme_default = theme;
|
|
161431
161460
|
});
|
|
@@ -161452,7 +161481,7 @@ var init_thinkback = __esm(() => {
|
|
|
161452
161481
|
name: "think-back",
|
|
161453
161482
|
description: "Your 2025 Claude Code Year in Review",
|
|
161454
161483
|
isEnabled: () => checkStatsigFeatureGate_CACHED_MAY_BE_STALE("tengu_thinkback"),
|
|
161455
|
-
load: () => import("./chunk-
|
|
161484
|
+
load: () => import("./chunk-r3cjy0fb.js")
|
|
161456
161485
|
};
|
|
161457
161486
|
thinkback_default = thinkback;
|
|
161458
161487
|
});
|
|
@@ -161468,7 +161497,7 @@ var init_thinkback_play = __esm(() => {
|
|
|
161468
161497
|
isEnabled: () => checkStatsigFeatureGate_CACHED_MAY_BE_STALE("tengu_thinkback"),
|
|
161469
161498
|
isHidden: true,
|
|
161470
161499
|
supportsNonInteractive: false,
|
|
161471
|
-
load: () => import("./chunk-
|
|
161500
|
+
load: () => import("./chunk-ygz3k4sq.js")
|
|
161472
161501
|
};
|
|
161473
161502
|
thinkback_play_default = thinkbackPlay;
|
|
161474
161503
|
});
|
|
@@ -161481,7 +161510,7 @@ var init_permissions3 = __esm(() => {
|
|
|
161481
161510
|
name: "permissions",
|
|
161482
161511
|
aliases: ["allowed-tools"],
|
|
161483
161512
|
description: "Manage allow & deny tool permission rules",
|
|
161484
|
-
load: () => import("./chunk-
|
|
161513
|
+
load: () => import("./chunk-g88tmqdn.js")
|
|
161485
161514
|
};
|
|
161486
161515
|
permissions_default = permissions;
|
|
161487
161516
|
});
|
|
@@ -161494,7 +161523,7 @@ var init_plan = __esm(() => {
|
|
|
161494
161523
|
name: "plan",
|
|
161495
161524
|
description: "Enable plan mode or view the current session plan",
|
|
161496
161525
|
argumentHint: "[open|<description>]",
|
|
161497
|
-
load: () => import("./chunk-
|
|
161526
|
+
load: () => import("./chunk-16rh2y4v.js")
|
|
161498
161527
|
};
|
|
161499
161528
|
plan_default = plan;
|
|
161500
161529
|
});
|
|
@@ -161527,7 +161556,7 @@ var init_fast = __esm(() => {
|
|
|
161527
161556
|
get immediate() {
|
|
161528
161557
|
return shouldInferenceConfigCommandBeImmediate();
|
|
161529
161558
|
},
|
|
161530
|
-
load: () => import("./chunk-
|
|
161559
|
+
load: () => import("./chunk-m3gybbxf.js")
|
|
161531
161560
|
};
|
|
161532
161561
|
fast_default = fast;
|
|
161533
161562
|
});
|
|
@@ -161565,7 +161594,7 @@ var init_privacy_settings = __esm(() => {
|
|
|
161565
161594
|
isEnabled: () => {
|
|
161566
161595
|
return isConsumerSubscriber();
|
|
161567
161596
|
},
|
|
161568
|
-
load: () => import("./chunk-
|
|
161597
|
+
load: () => import("./chunk-3n1npe6q.js")
|
|
161569
161598
|
};
|
|
161570
161599
|
privacy_settings_default = privacySettings;
|
|
161571
161600
|
});
|
|
@@ -161578,7 +161607,7 @@ var init_hooks = __esm(() => {
|
|
|
161578
161607
|
name: "hooks",
|
|
161579
161608
|
description: "View hook configurations for tool events",
|
|
161580
161609
|
immediate: true,
|
|
161581
|
-
load: () => import("./chunk-
|
|
161610
|
+
load: () => import("./chunk-5ch3c353.js")
|
|
161582
161611
|
};
|
|
161583
161612
|
hooks_default = hooks;
|
|
161584
161613
|
});
|
|
@@ -161606,7 +161635,7 @@ var init_branch = __esm(() => {
|
|
|
161606
161635
|
aliases: ["fork"],
|
|
161607
161636
|
description: "Create a branch of the current conversation at this point",
|
|
161608
161637
|
argumentHint: "[name]",
|
|
161609
|
-
load: () => import("./chunk-
|
|
161638
|
+
load: () => import("./chunk-psfw6zfd.js")
|
|
161610
161639
|
};
|
|
161611
161640
|
branch_default = branch;
|
|
161612
161641
|
});
|
|
@@ -161618,7 +161647,7 @@ var init_agents = __esm(() => {
|
|
|
161618
161647
|
type: "local-jsx",
|
|
161619
161648
|
name: "agents",
|
|
161620
161649
|
description: "Manage agent configurations",
|
|
161621
|
-
load: () => import("./chunk-
|
|
161650
|
+
load: () => import("./chunk-gpsx7zn5.js")
|
|
161622
161651
|
};
|
|
161623
161652
|
agents_default = agents;
|
|
161624
161653
|
});
|
|
@@ -161632,7 +161661,7 @@ var init_plugin2 = __esm(() => {
|
|
|
161632
161661
|
aliases: ["plugins", "marketplace"],
|
|
161633
161662
|
description: "Manage Claude Code plugins",
|
|
161634
161663
|
immediate: true,
|
|
161635
|
-
load: () => import("./chunk-
|
|
161664
|
+
load: () => import("./chunk-sfjm0eew.js")
|
|
161636
161665
|
};
|
|
161637
161666
|
plugin_default = plugin;
|
|
161638
161667
|
});
|
|
@@ -161645,7 +161674,7 @@ var init_reload_plugins = __esm(() => {
|
|
|
161645
161674
|
name: "reload-plugins",
|
|
161646
161675
|
description: "Activate pending plugin changes in the current session",
|
|
161647
161676
|
supportsNonInteractive: false,
|
|
161648
|
-
load: () => import("./chunk-
|
|
161677
|
+
load: () => import("./chunk-t89d72xr.js")
|
|
161649
161678
|
};
|
|
161650
161679
|
reload_plugins_default = reloadPlugins;
|
|
161651
161680
|
});
|
|
@@ -162236,7 +162265,7 @@ var init_sandbox_toggle = __esm(() => {
|
|
|
162236
162265
|
},
|
|
162237
162266
|
immediate: true,
|
|
162238
162267
|
type: "local-jsx",
|
|
162239
|
-
load: () => import("./chunk-
|
|
162268
|
+
load: () => import("./chunk-pd0kfhpc.js")
|
|
162240
162269
|
};
|
|
162241
162270
|
sandbox_toggle_default = command6;
|
|
162242
162271
|
});
|
|
@@ -162251,7 +162280,7 @@ var init_chrome = __esm(() => {
|
|
|
162251
162280
|
availability: ["claude-ai"],
|
|
162252
162281
|
isEnabled: () => !getIsNonInteractiveSession(),
|
|
162253
162282
|
type: "local-jsx",
|
|
162254
|
-
load: () => import("./chunk-
|
|
162283
|
+
load: () => import("./chunk-tnw04w60.js")
|
|
162255
162284
|
};
|
|
162256
162285
|
chrome_default = command7;
|
|
162257
162286
|
});
|
|
@@ -162364,7 +162393,7 @@ var init_advisor2 = __esm(() => {
|
|
|
162364
162393
|
// src/skills/bundledSkills.ts
|
|
162365
162394
|
import { constants as fsConstants4 } from "fs";
|
|
162366
162395
|
import { mkdir as mkdir21, open as open8 } from "fs/promises";
|
|
162367
|
-
import { dirname as dirname33, isAbsolute as isAbsolute19, join as
|
|
162396
|
+
import { dirname as dirname33, isAbsolute as isAbsolute19, join as join70, normalize as normalize7, sep as pathSep2 } from "path";
|
|
162368
162397
|
function registerBundledSkill(definition) {
|
|
162369
162398
|
const { files: files2 } = definition;
|
|
162370
162399
|
let skillRoot;
|
|
@@ -162412,7 +162441,7 @@ function getBundledSkills() {
|
|
|
162412
162441
|
return [...bundledSkills];
|
|
162413
162442
|
}
|
|
162414
162443
|
function getBundledSkillExtractDir(skillName) {
|
|
162415
|
-
return
|
|
162444
|
+
return join70(getBundledSkillsRoot(), skillName);
|
|
162416
162445
|
}
|
|
162417
162446
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
162418
162447
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -162454,7 +162483,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
162454
162483
|
if (isAbsolute19(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
162455
162484
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
162456
162485
|
}
|
|
162457
|
-
return
|
|
162486
|
+
return join70(baseDir, normalized);
|
|
162458
162487
|
}
|
|
162459
162488
|
function prependBaseDir(blocks, baseDir) {
|
|
162460
162489
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -162492,7 +162521,7 @@ var init_exit = __esm(() => {
|
|
|
162492
162521
|
aliases: ["quit"],
|
|
162493
162522
|
description: "Exit the REPL",
|
|
162494
162523
|
immediate: true,
|
|
162495
|
-
load: () => import("./chunk-
|
|
162524
|
+
load: () => import("./chunk-em1ba8ze.js")
|
|
162496
162525
|
};
|
|
162497
162526
|
exit_default = exit;
|
|
162498
162527
|
});
|
|
@@ -162505,7 +162534,7 @@ var init_export = __esm(() => {
|
|
|
162505
162534
|
name: "export",
|
|
162506
162535
|
description: "Export the current conversation to a file or clipboard",
|
|
162507
162536
|
argumentHint: "[filename]",
|
|
162508
|
-
load: () => import("./chunk-
|
|
162537
|
+
load: () => import("./chunk-ktkhm6h0.js")
|
|
162509
162538
|
};
|
|
162510
162539
|
export_default = exportCommand;
|
|
162511
162540
|
});
|
|
@@ -162525,7 +162554,7 @@ var init_model2 = __esm(() => {
|
|
|
162525
162554
|
get immediate() {
|
|
162526
162555
|
return shouldInferenceConfigCommandBeImmediate();
|
|
162527
162556
|
},
|
|
162528
|
-
load: () => import("./chunk-
|
|
162557
|
+
load: () => import("./chunk-erhdecnt.js")
|
|
162529
162558
|
};
|
|
162530
162559
|
});
|
|
162531
162560
|
|
|
@@ -162538,7 +162567,7 @@ var init_tag = __esm(() => {
|
|
|
162538
162567
|
description: "Toggle a searchable tag on the current session",
|
|
162539
162568
|
isEnabled: () => process.env.USER_TYPE === "ant",
|
|
162540
162569
|
argumentHint: "<tag-name>",
|
|
162541
|
-
load: () => import("./chunk-
|
|
162570
|
+
load: () => import("./chunk-pzfm2f50.js")
|
|
162542
162571
|
};
|
|
162543
162572
|
tag_default = tag;
|
|
162544
162573
|
});
|
|
@@ -162569,7 +162598,7 @@ var init_remote_env = __esm(() => {
|
|
|
162569
162598
|
get isHidden() {
|
|
162570
162599
|
return !isClaudeAISubscriber() || !isPolicyAllowed("allow_remote_sessions");
|
|
162571
162600
|
},
|
|
162572
|
-
load: () => import("./chunk-
|
|
162601
|
+
load: () => import("./chunk-bx34c1zb.js")
|
|
162573
162602
|
};
|
|
162574
162603
|
});
|
|
162575
162604
|
|
|
@@ -162584,7 +162613,7 @@ var init_upgrade = __esm(() => {
|
|
|
162584
162613
|
description: "Upgrade to Max for higher rate limits and more Opus",
|
|
162585
162614
|
availability: ["claude-ai"],
|
|
162586
162615
|
isEnabled: () => !isEnvTruthy(process.env.DISABLE_UPGRADE_COMMAND) && getSubscriptionType() !== "enterprise",
|
|
162587
|
-
load: () => import("./chunk-
|
|
162616
|
+
load: () => import("./chunk-75670gkp.js")
|
|
162588
162617
|
};
|
|
162589
162618
|
upgrade_default = upgrade;
|
|
162590
162619
|
});
|
|
@@ -162604,7 +162633,7 @@ var init_rate_limit_options = __esm(() => {
|
|
|
162604
162633
|
return true;
|
|
162605
162634
|
},
|
|
162606
162635
|
isHidden: true,
|
|
162607
|
-
load: () => import("./chunk-
|
|
162636
|
+
load: () => import("./chunk-wr8284h9.js")
|
|
162608
162637
|
};
|
|
162609
162638
|
rate_limit_options_default = rateLimitOptions;
|
|
162610
162639
|
});
|
|
@@ -162646,7 +162675,7 @@ var init_effort2 = __esm(() => {
|
|
|
162646
162675
|
get immediate() {
|
|
162647
162676
|
return shouldInferenceConfigCommandBeImmediate();
|
|
162648
162677
|
},
|
|
162649
|
-
load: () => import("./chunk-
|
|
162678
|
+
load: () => import("./chunk-vdbt37hp.js")
|
|
162650
162679
|
};
|
|
162651
162680
|
});
|
|
162652
162681
|
|
|
@@ -162657,7 +162686,7 @@ var init_stats = __esm(() => {
|
|
|
162657
162686
|
type: "local-jsx",
|
|
162658
162687
|
name: "stats",
|
|
162659
162688
|
description: "Show your Claude Code usage statistics and activity",
|
|
162660
|
-
load: () => import("./chunk-
|
|
162689
|
+
load: () => import("./chunk-k36x51dg.js")
|
|
162661
162690
|
};
|
|
162662
162691
|
stats_default = stats;
|
|
162663
162692
|
});
|
|
@@ -162952,7 +162981,7 @@ var init_commands2 = __esm(() => {
|
|
|
162952
162981
|
progressMessage: "analyzing your sessions",
|
|
162953
162982
|
source: "builtin",
|
|
162954
162983
|
async getPromptForCommand(args, context2) {
|
|
162955
|
-
const real = (await import("./chunk-
|
|
162984
|
+
const real = (await import("./chunk-2dpq8sne.js")).default;
|
|
162956
162985
|
if (real.type !== "prompt")
|
|
162957
162986
|
throw new Error("unreachable");
|
|
162958
162987
|
return real.getPromptForCommand(args, context2);
|
|
@@ -163278,7 +163307,7 @@ import {
|
|
|
163278
163307
|
unlink as unlink13,
|
|
163279
163308
|
writeFile as writeFile25
|
|
163280
163309
|
} from "fs/promises";
|
|
163281
|
-
import { basename as basename28, dirname as dirname34, join as
|
|
163310
|
+
import { basename as basename28, dirname as dirname34, join as join71 } from "path";
|
|
163282
163311
|
function isTranscriptMessage(entry) {
|
|
163283
163312
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
163284
163313
|
}
|
|
@@ -163292,18 +163321,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
163292
163321
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
163293
163322
|
}
|
|
163294
163323
|
function getProjectsDir2() {
|
|
163295
|
-
return
|
|
163324
|
+
return join71(getClaudeConfigHomeDir(), "projects");
|
|
163296
163325
|
}
|
|
163297
163326
|
function getTranscriptPath() {
|
|
163298
163327
|
const projectDir = getSessionProjectDir() ?? getProjectDir(getOriginalCwd());
|
|
163299
|
-
return
|
|
163328
|
+
return join71(projectDir, `${getSessionId()}.jsonl`);
|
|
163300
163329
|
}
|
|
163301
163330
|
function getTranscriptPathForSession(sessionId) {
|
|
163302
163331
|
if (sessionId === getSessionId()) {
|
|
163303
163332
|
return getTranscriptPath();
|
|
163304
163333
|
}
|
|
163305
163334
|
const projectDir = getProjectDir(getOriginalCwd());
|
|
163306
|
-
return
|
|
163335
|
+
return join71(projectDir, `${sessionId}.jsonl`);
|
|
163307
163336
|
}
|
|
163308
163337
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
163309
163338
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -163315,8 +163344,8 @@ function getAgentTranscriptPath(agentId) {
|
|
|
163315
163344
|
const projectDir = getSessionProjectDir() ?? getProjectDir(getOriginalCwd());
|
|
163316
163345
|
const sessionId = getSessionId();
|
|
163317
163346
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
163318
|
-
const base = subdir ?
|
|
163319
|
-
return
|
|
163347
|
+
const base = subdir ? join71(projectDir, sessionId, "subagents", subdir) : join71(projectDir, sessionId, "subagents");
|
|
163348
|
+
return join71(base, `agent-${agentId}.jsonl`);
|
|
163320
163349
|
}
|
|
163321
163350
|
function getAgentMetadataPath(agentId) {
|
|
163322
163351
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -163339,10 +163368,10 @@ async function readAgentMetadata(agentId) {
|
|
|
163339
163368
|
}
|
|
163340
163369
|
function getRemoteAgentsDir() {
|
|
163341
163370
|
const projectDir = getSessionProjectDir() ?? getProjectDir(getOriginalCwd());
|
|
163342
|
-
return
|
|
163371
|
+
return join71(projectDir, getSessionId(), "remote-agents");
|
|
163343
163372
|
}
|
|
163344
163373
|
function getRemoteAgentMetadataPath(taskId) {
|
|
163345
|
-
return
|
|
163374
|
+
return join71(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
163346
163375
|
}
|
|
163347
163376
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
163348
163377
|
const path10 = getRemoteAgentMetadataPath(taskId);
|
|
@@ -163385,7 +163414,7 @@ async function listRemoteAgentMetadata() {
|
|
|
163385
163414
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
163386
163415
|
continue;
|
|
163387
163416
|
try {
|
|
163388
|
-
const raw = await readFile26(
|
|
163417
|
+
const raw = await readFile26(join71(dir, entry.name), "utf-8");
|
|
163389
163418
|
results.push(JSON.parse(raw));
|
|
163390
163419
|
} catch (e) {
|
|
163391
163420
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -163395,7 +163424,7 @@ async function listRemoteAgentMetadata() {
|
|
|
163395
163424
|
}
|
|
163396
163425
|
function sessionIdExists(sessionId) {
|
|
163397
163426
|
const projectDir = getProjectDir(getOriginalCwd());
|
|
163398
|
-
const sessionFile =
|
|
163427
|
+
const sessionFile = join71(projectDir, `${sessionId}.jsonl`);
|
|
163399
163428
|
const fs8 = getFsImplementation();
|
|
163400
163429
|
try {
|
|
163401
163430
|
fs8.statSync(sessionFile);
|
|
@@ -165365,7 +165394,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
165365
165394
|
};
|
|
165366
165395
|
}
|
|
165367
165396
|
async function loadSessionFile(sessionId) {
|
|
165368
|
-
const sessionFile =
|
|
165397
|
+
const sessionFile = join71(getSessionProjectDir() ?? getProjectDir(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
165369
165398
|
return loadTranscriptFile(sessionFile);
|
|
165370
165399
|
}
|
|
165371
165400
|
function clearSessionMessagesCache() {
|
|
@@ -165433,7 +165462,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
165433
165462
|
} catch {
|
|
165434
165463
|
return [];
|
|
165435
165464
|
}
|
|
165436
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
165465
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join71(projectsDir, dirent.name));
|
|
165437
165466
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
165438
165467
|
const allLogs = logsPerProject.flat();
|
|
165439
165468
|
const deduped = new Map;
|
|
@@ -165458,7 +165487,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
165458
165487
|
} catch {
|
|
165459
165488
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
165460
165489
|
}
|
|
165461
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
165490
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join71(projectsDir, dirent.name));
|
|
165462
165491
|
const rawLogs = [];
|
|
165463
165492
|
for (const projectDir of projectDirs) {
|
|
165464
165493
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -165519,7 +165548,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
165519
165548
|
for (const { path: wtPath, prefix } of indexed) {
|
|
165520
165549
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
165521
165550
|
seenDirs.add(dirName);
|
|
165522
|
-
allLogs.push(...await getSessionFilesLite(
|
|
165551
|
+
allLogs.push(...await getSessionFilesLite(join71(projectsDir, dirent.name), undefined, wtPath));
|
|
165523
165552
|
break;
|
|
165524
165553
|
}
|
|
165525
165554
|
}
|
|
@@ -165588,7 +165617,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
165588
165617
|
return transcripts;
|
|
165589
165618
|
}
|
|
165590
165619
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
165591
|
-
const subagentsDir =
|
|
165620
|
+
const subagentsDir = join71(getSessionProjectDir() ?? getProjectDir(getOriginalCwd()), getSessionId(), "subagents");
|
|
165592
165621
|
let entries;
|
|
165593
165622
|
try {
|
|
165594
165623
|
entries = await readdir16(subagentsDir, { withFileTypes: true });
|
|
@@ -165716,7 +165745,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
165716
165745
|
const sessionId = validateUuid2(basename28(dirent.name, ".jsonl"));
|
|
165717
165746
|
if (!sessionId)
|
|
165718
165747
|
continue;
|
|
165719
|
-
candidates.push({ sessionId, filePath:
|
|
165748
|
+
candidates.push({ sessionId, filePath: join71(projectDir, dirent.name) });
|
|
165720
165749
|
}
|
|
165721
165750
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
165722
165751
|
try {
|
|
@@ -166116,7 +166145,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
166116
166145
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
166117
166146
|
agentTranscriptSubdirs = new Map;
|
|
166118
166147
|
getProjectDir = memoize_default((projectDir) => {
|
|
166119
|
-
return
|
|
166148
|
+
return join71(getProjectsDir2(), sanitizePath(projectDir));
|
|
166120
166149
|
});
|
|
166121
166150
|
METADATA_TYPE_MARKERS = [
|
|
166122
166151
|
'"type":"summary"',
|
|
@@ -166354,41 +166383,41 @@ var init_memdir = __esm(() => {
|
|
|
166354
166383
|
});
|
|
166355
166384
|
|
|
166356
166385
|
// src/tools/AgentTool/agentMemory.ts
|
|
166357
|
-
import { join as
|
|
166386
|
+
import { join as join72, normalize as normalize8, sep as sep18 } from "path";
|
|
166358
166387
|
function sanitizeAgentTypeForPath(agentType) {
|
|
166359
166388
|
return agentType.replace(/:/g, "-");
|
|
166360
166389
|
}
|
|
166361
166390
|
function getLocalAgentMemoryDir(dirName) {
|
|
166362
166391
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
166363
|
-
return
|
|
166392
|
+
return join72(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep18;
|
|
166364
166393
|
}
|
|
166365
|
-
return
|
|
166394
|
+
return join72(getCwd(), ".claude", "agent-memory-local", dirName) + sep18;
|
|
166366
166395
|
}
|
|
166367
166396
|
function getAgentMemoryDir(agentType, scope) {
|
|
166368
166397
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
166369
166398
|
switch (scope) {
|
|
166370
166399
|
case "project":
|
|
166371
|
-
return
|
|
166400
|
+
return join72(getCwd(), ".claude", "agent-memory", dirName) + sep18;
|
|
166372
166401
|
case "local":
|
|
166373
166402
|
return getLocalAgentMemoryDir(dirName);
|
|
166374
166403
|
case "user":
|
|
166375
|
-
return
|
|
166404
|
+
return join72(getMemoryBaseDir(), "agent-memory", dirName) + sep18;
|
|
166376
166405
|
}
|
|
166377
166406
|
}
|
|
166378
166407
|
function isAgentMemoryPath(absolutePath) {
|
|
166379
166408
|
const normalizedPath = normalize8(absolutePath);
|
|
166380
166409
|
const memoryBase = getMemoryBaseDir();
|
|
166381
|
-
if (normalizedPath.startsWith(
|
|
166410
|
+
if (normalizedPath.startsWith(join72(memoryBase, "agent-memory") + sep18)) {
|
|
166382
166411
|
return true;
|
|
166383
166412
|
}
|
|
166384
|
-
if (normalizedPath.startsWith(
|
|
166413
|
+
if (normalizedPath.startsWith(join72(getCwd(), ".claude", "agent-memory") + sep18)) {
|
|
166385
166414
|
return true;
|
|
166386
166415
|
}
|
|
166387
166416
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
166388
|
-
if (normalizedPath.includes(sep18 + "agent-memory-local" + sep18) && normalizedPath.startsWith(
|
|
166417
|
+
if (normalizedPath.includes(sep18 + "agent-memory-local" + sep18) && normalizedPath.startsWith(join72(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects") + sep18)) {
|
|
166389
166418
|
return true;
|
|
166390
166419
|
}
|
|
166391
|
-
} else if (normalizedPath.startsWith(
|
|
166420
|
+
} else if (normalizedPath.startsWith(join72(getCwd(), ".claude", "agent-memory-local") + sep18)) {
|
|
166392
166421
|
return true;
|
|
166393
166422
|
}
|
|
166394
166423
|
return false;
|
|
@@ -166396,7 +166425,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
166396
166425
|
function getMemoryScopeDisplay(memory2) {
|
|
166397
166426
|
switch (memory2) {
|
|
166398
166427
|
case "user":
|
|
166399
|
-
return `User (${
|
|
166428
|
+
return `User (${join72(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
166400
166429
|
case "project":
|
|
166401
166430
|
return "Project (.claude/agent-memory/)";
|
|
166402
166431
|
case "local":
|
|
@@ -166438,8 +166467,8 @@ var init_agentMemory = __esm(() => {
|
|
|
166438
166467
|
|
|
166439
166468
|
// src/utils/permissions/filesystem.ts
|
|
166440
166469
|
import { randomBytes as randomBytes14 } from "crypto";
|
|
166441
|
-
import { homedir as
|
|
166442
|
-
import { join as
|
|
166470
|
+
import { homedir as homedir17, tmpdir as tmpdir6 } from "os";
|
|
166471
|
+
import { join as join73, normalize as normalize9, posix as posix7, sep as sep19 } from "path";
|
|
166443
166472
|
function normalizeCaseForComparison2(path10) {
|
|
166444
166473
|
return path10.toLowerCase();
|
|
166445
166474
|
}
|
|
@@ -166448,11 +166477,11 @@ function getClaudeSkillScope(filePath) {
|
|
|
166448
166477
|
const absolutePathLower = normalizeCaseForComparison2(absolutePath);
|
|
166449
166478
|
const bases = [
|
|
166450
166479
|
{
|
|
166451
|
-
dir: expandPath(
|
|
166480
|
+
dir: expandPath(join73(getOriginalCwd(), ".claude", "skills")),
|
|
166452
166481
|
prefix: "/.claude/skills/"
|
|
166453
166482
|
},
|
|
166454
166483
|
{
|
|
166455
|
-
dir: expandPath(
|
|
166484
|
+
dir: expandPath(join73(homedir17(), ".claude", "skills")),
|
|
166456
166485
|
prefix: "~/.claude/skills/"
|
|
166457
166486
|
}
|
|
166458
166487
|
];
|
|
@@ -166507,21 +166536,21 @@ function isClaudeConfigFilePath(filePath) {
|
|
|
166507
166536
|
if (isClaudeSettingsPath(filePath)) {
|
|
166508
166537
|
return true;
|
|
166509
166538
|
}
|
|
166510
|
-
const commandsDir =
|
|
166511
|
-
const agentsDir =
|
|
166512
|
-
const skillsDir =
|
|
166539
|
+
const commandsDir = join73(getOriginalCwd(), ".claude", "commands");
|
|
166540
|
+
const agentsDir = join73(getOriginalCwd(), ".claude", "agents");
|
|
166541
|
+
const skillsDir = join73(getOriginalCwd(), ".claude", "skills");
|
|
166513
166542
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
166514
166543
|
}
|
|
166515
166544
|
function isSessionPlanFile(absolutePath) {
|
|
166516
|
-
const expectedPrefix =
|
|
166545
|
+
const expectedPrefix = join73(getPlansDirectory(), getPlanSlug());
|
|
166517
166546
|
const normalizedPath = normalize9(absolutePath);
|
|
166518
166547
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
166519
166548
|
}
|
|
166520
166549
|
function getSessionMemoryDir() {
|
|
166521
|
-
return
|
|
166550
|
+
return join73(getProjectDir(getCwd()), getSessionId(), "session-memory") + sep19;
|
|
166522
166551
|
}
|
|
166523
166552
|
function getSessionMemoryPath() {
|
|
166524
|
-
return
|
|
166553
|
+
return join73(getSessionMemoryDir(), "summary.md");
|
|
166525
166554
|
}
|
|
166526
166555
|
function isSessionMemoryPath(absolutePath) {
|
|
166527
166556
|
const normalizedPath = normalize9(absolutePath);
|
|
@@ -166543,10 +166572,10 @@ function getClaudeTempDirName() {
|
|
|
166543
166572
|
return `claude-${uid}`;
|
|
166544
166573
|
}
|
|
166545
166574
|
function getProjectTempDir() {
|
|
166546
|
-
return
|
|
166575
|
+
return join73(getClaudeTempDir(), sanitizePath(getOriginalCwd())) + sep19;
|
|
166547
166576
|
}
|
|
166548
166577
|
function getScratchpadDir() {
|
|
166549
|
-
return
|
|
166578
|
+
return join73(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
166550
166579
|
}
|
|
166551
166580
|
async function ensureScratchpadDir() {
|
|
166552
166581
|
if (!isScratchpadEnabled()) {
|
|
@@ -166766,7 +166795,7 @@ function patternWithRoot(pattern, source) {
|
|
|
166766
166795
|
} else if (pattern.startsWith(`~${DIR_SEP}`)) {
|
|
166767
166796
|
return {
|
|
166768
166797
|
relativePattern: pattern.slice(1),
|
|
166769
|
-
root:
|
|
166798
|
+
root: homedir17().normalize("NFC")
|
|
166770
166799
|
};
|
|
166771
166800
|
} else if (pattern.startsWith(DIR_SEP)) {
|
|
166772
166801
|
return {
|
|
@@ -167125,7 +167154,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
167125
167154
|
}
|
|
167126
167155
|
};
|
|
167127
167156
|
}
|
|
167128
|
-
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(
|
|
167157
|
+
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(join73(getOriginalCwd(), ".claude", "launch.json"))) {
|
|
167129
167158
|
return {
|
|
167130
167159
|
behavior: "allow",
|
|
167131
167160
|
updatedInput: input,
|
|
@@ -167222,7 +167251,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
167222
167251
|
}
|
|
167223
167252
|
};
|
|
167224
167253
|
}
|
|
167225
|
-
const tasksDir =
|
|
167254
|
+
const tasksDir = join73(getClaudeConfigHomeDir(), "tasks") + sep19;
|
|
167226
167255
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
167227
167256
|
return {
|
|
167228
167257
|
behavior: "allow",
|
|
@@ -167233,7 +167262,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
167233
167262
|
}
|
|
167234
167263
|
};
|
|
167235
167264
|
}
|
|
167236
|
-
const teamsReadDir =
|
|
167265
|
+
const teamsReadDir = join73(getClaudeConfigHomeDir(), "teams") + sep19;
|
|
167237
167266
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
167238
167267
|
return {
|
|
167239
167268
|
behavior: "allow",
|
|
@@ -167307,11 +167336,11 @@ var init_filesystem = __esm(() => {
|
|
|
167307
167336
|
try {
|
|
167308
167337
|
resolvedBaseTmpDir = fs8.realpathSync(baseTmpDir);
|
|
167309
167338
|
} catch {}
|
|
167310
|
-
return
|
|
167339
|
+
return join73(resolvedBaseTmpDir, getClaudeTempDirName()) + sep19;
|
|
167311
167340
|
});
|
|
167312
167341
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
167313
167342
|
const nonce = randomBytes14(16).toString("hex");
|
|
167314
|
-
return
|
|
167343
|
+
return join73(getClaudeTempDir(), "bundled-skills", MACRO.VERSION, nonce);
|
|
167315
167344
|
});
|
|
167316
167345
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
167317
167346
|
});
|
|
@@ -167325,10 +167354,10 @@ import {
|
|
|
167325
167354
|
symlink as symlink4,
|
|
167326
167355
|
unlink as unlink14
|
|
167327
167356
|
} from "fs/promises";
|
|
167328
|
-
import { join as
|
|
167357
|
+
import { join as join74 } from "path";
|
|
167329
167358
|
function getTaskOutputDir() {
|
|
167330
167359
|
if (_taskOutputDir === undefined) {
|
|
167331
|
-
_taskOutputDir =
|
|
167360
|
+
_taskOutputDir = join74(getProjectTempDir(), getSessionId(), "tasks");
|
|
167332
167361
|
}
|
|
167333
167362
|
return _taskOutputDir;
|
|
167334
167363
|
}
|
|
@@ -167336,7 +167365,7 @@ async function ensureOutputDir() {
|
|
|
167336
167365
|
await mkdir23(getTaskOutputDir(), { recursive: true });
|
|
167337
167366
|
}
|
|
167338
167367
|
function getTaskOutputPath(taskId) {
|
|
167339
|
-
return
|
|
167368
|
+
return join74(getTaskOutputDir(), `${taskId}.output`);
|
|
167340
167369
|
}
|
|
167341
167370
|
function track(p) {
|
|
167342
167371
|
_pendingOps.add(p);
|
|
@@ -168592,7 +168621,7 @@ var init_ssrfGuard = () => {};
|
|
|
168592
168621
|
|
|
168593
168622
|
// src/utils/hooks/execHttpHook.ts
|
|
168594
168623
|
async function getSandboxProxyConfig() {
|
|
168595
|
-
const { SandboxManager: SandboxManager3 } = await import("./chunk-
|
|
168624
|
+
const { SandboxManager: SandboxManager3 } = await import("./chunk-3md12xep.js");
|
|
168596
168625
|
if (!SandboxManager3.isSandboxingEnabled()) {
|
|
168597
168626
|
return;
|
|
168598
168627
|
}
|
|
@@ -171810,7 +171839,7 @@ var init_changeDetector = __esm(() => {
|
|
|
171810
171839
|
// src/utils/sandbox/sandbox-adapter.ts
|
|
171811
171840
|
import { rmSync as rmSync2, statSync as statSync3 } from "fs";
|
|
171812
171841
|
import { readFile as readFile27 } from "fs/promises";
|
|
171813
|
-
import { join as
|
|
171842
|
+
import { join as join75, resolve as resolve26, sep as sep21 } from "path";
|
|
171814
171843
|
function permissionRuleValueFromString2(ruleString) {
|
|
171815
171844
|
const matches = ruleString.match(/^([^(]+)\(([^)]+)\)$/);
|
|
171816
171845
|
if (!matches) {
|
|
@@ -171992,7 +172021,7 @@ function scrubBareGitRepoFiles() {
|
|
|
171992
172021
|
}
|
|
171993
172022
|
}
|
|
171994
172023
|
async function detectWorktreeMainRepoPath(cwd) {
|
|
171995
|
-
const gitPath =
|
|
172024
|
+
const gitPath = join75(cwd, ".git");
|
|
171996
172025
|
try {
|
|
171997
172026
|
const gitContent = await readFile27(gitPath, { encoding: "utf8" });
|
|
171998
172027
|
const gitdirMatch = gitContent.match(/^gitdir:\s*(.+)$/m);
|