@staff0rd/assist 0.1157.0 → 0.1158.0
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/agent/commands/bug.md +1 -1
- package/agent/commands/design.md +2 -2
- package/agent/commands/draft.md +1 -1
- package/agent/commands/refine.md +5 -5
- package/dist/.build-files +93 -92
- package/dist/{add-LM2C4OO4.js → add-4IT4FODS.js} +3 -3
- package/dist/{addActivity-QEU4PLVN.js → addActivity-RJVSLFDF.js} +2 -2
- package/dist/{addPhase-OFF3RW5D.js → addPhase-TFDHIVTD.js} +3 -3
- package/dist/{advise-JRADZKQR.js → advise-E2MH3ASH.js} +3 -3
- package/dist/{askCheck-FLUI57QN.js → askCheck-X46HT6RS.js} +7 -7
- package/dist/{askDesign-EWXKHCVA.js → askDesign-EHNQSAJ3.js} +1 -1
- package/dist/{branch-LUHZD3IU.js → branch-C7YXWJAX.js} +3 -3
- package/dist/built-version +1 -1
- package/dist/{chunk-7PWLD6IY.js → chunk-42WIJCMO.js} +2 -2
- package/dist/{chunk-SFS7VNHJ.js → chunk-4ATDZEUZ.js} +1 -1
- package/dist/{chunk-VF2SKQIN.js → chunk-4NMVLSNH.js} +1 -1
- package/dist/{chunk-2O7TIRCQ.js → chunk-4WMCOPQR.js} +1 -1
- package/dist/{chunk-XMO43DYP.js → chunk-5LFLGW4K.js} +1 -1
- package/dist/{chunk-MY4TNZNI.js → chunk-62GEKLQ6.js} +1 -1
- package/dist/{chunk-6ZGNASPH.js → chunk-6LOIHOC4.js} +1 -1
- package/dist/{chunk-FWASEJGF.js → chunk-6PDLUNA3.js} +4 -4
- package/dist/{chunk-XALALTCY.js → chunk-7NZNP3P5.js} +1 -1
- package/dist/{chunk-453NQ2TY.js → chunk-7Z3OPAJZ.js} +1 -1
- package/dist/{chunk-6EYCU3MQ.js → chunk-ABKHSOPR.js} +1 -1
- package/dist/{chunk-TQ27W53S.js → chunk-ADKYCC33.js} +6 -6
- package/dist/{chunk-2HMODVGE.js → chunk-APW3X2QM.js} +1 -1
- package/dist/{chunk-4NTFUBFL.js → chunk-DFQMUYMO.js} +1 -1
- package/dist/{chunk-JCLEKSPZ.js → chunk-E55ZAU6M.js} +1 -1
- package/dist/{chunk-NEEYSYRR.js → chunk-EWMORVWN.js} +1 -1
- package/dist/{chunk-GVFVEKA7.js → chunk-FTAHEOIU.js} +1 -1
- package/dist/{chunk-EKCSLPJ5.js → chunk-G7P3ZDRT.js} +1 -1
- package/dist/{chunk-HVZV7BSZ.js → chunk-GUCGXHC3.js} +2 -2
- package/dist/{chunk-6D6ZXYN2.js → chunk-GZD5ET6I.js} +1 -1
- package/dist/{chunk-G26L5KYU.js → chunk-I5Y4E2A2.js} +3 -3
- package/dist/chunk-IZZJUZZY.js +21 -0
- package/dist/{chunk-6BTWAPO7.js → chunk-JJTRIIUM.js} +1 -1
- package/dist/{chunk-I3TEQBTO.js → chunk-K3JNJGLB.js} +7 -25
- package/dist/{chunk-DEUXVBDA.js → chunk-MFIBGF6C.js} +1 -1
- package/dist/{chunk-BBXEZVRL.js → chunk-NTWNDSCD.js} +1 -1
- package/dist/{chunk-6UL5A2WG.js → chunk-ODWSNE5E.js} +1 -1
- package/dist/{chunk-47342FQ6.js → chunk-P7PDEW72.js} +1 -1
- package/dist/{chunk-PJHWN6XE.js → chunk-PALO62N5.js} +1 -1
- package/dist/{chunk-HWIPF4RO.js → chunk-Q2AD3HF2.js} +1 -1
- package/dist/{chunk-NG5NGQ5N.js → chunk-Q2XZ6PPO.js} +1 -1
- package/dist/{chunk-XOVL4YJQ.js → chunk-SGKMAXMO.js} +1 -1
- package/dist/{chunk-R3GZTWTX.js → chunk-SVYJ35KO.js} +2 -2
- package/dist/{chunk-IYTAHYEL.js → chunk-SYV6FBQJ.js} +2 -2
- package/dist/{chunk-7OPKFWV7.js → chunk-T4TBIMEO.js} +228 -114
- package/dist/{chunk-GLXPJNQA.js → chunk-TTDSFM3C.js} +1 -1
- package/dist/{chunk-3AYMOUTH.js → chunk-TYE72SBM.js} +1 -1
- package/dist/{chunk-DMNI6R3V.js → chunk-UF6V6BOC.js} +1 -1
- package/dist/{chunk-6NX42FE5.js → chunk-ULVCJV3K.js} +2 -2
- package/dist/{chunk-QKXWKMP3.js → chunk-YSLPUZ3O.js} +1 -1
- package/dist/{chunk-PPTQQIP3.js → chunk-YXHK5EWG.js} +1 -1
- package/dist/{chunk-KDXONARI.js → chunk-ZSFB3YY3.js} +3 -3
- package/dist/{cliHook-YDREH6Q2.js → cliHook-NGRJETLU.js} +5 -5
- package/dist/{cliHookCheck-T372AQGS.js → cliHookCheck-G7W5M3NI.js} +2 -2
- package/dist/{codexHook-BDEZFV6I.js → codexHook-QPCI2T7J.js} +7 -7
- package/dist/commands/sessions/web/bundle.js +485 -484
- package/dist/{commit-OJNH2ZT7.js → commit-SL4Y6OO6.js} +3 -3
- package/dist/{configImportRepos-ZIUYOKHH.js → configImportRepos-PY6JQLJ6.js} +1 -1
- package/dist/{configImportUser-NWUPLRQE.js → configImportUser-KJ2P5JL5.js} +1 -1
- package/dist/{configSet-3UHHWKDP.js → configSet-QBZONRDW.js} +4 -4
- package/dist/{configUnset-LYGRTYB3.js → configUnset-U4QVA7DY.js} +3 -3
- package/dist/{doctorNodes-X65BKJTV.js → doctorNodes-CJZWC2QU.js} +3 -3
- package/dist/{done-VE3V5YKS.js → done-HUEB6VZT.js} +4 -4
- package/dist/{editHook-X2PWV2ZY.js → editHook-S2ARHIQS.js} +5 -5
- package/dist/{fixConflict-GDI5DRMU.js → fixConflict-VH23UVUA.js} +2 -2
- package/dist/index.js +57 -57
- package/dist/{indexRules-65H3IE33.js → indexRules-4M2TAWOE.js} +2 -1
- package/dist/{launchMode-GSOMPV7G.js → launchMode-YUWJYQ62.js} +13 -13
- package/dist/{list-GGQGPDMK.js → list-X2F6ZWKD.js} +5 -5
- package/dist/{next-OBSLNBNQ.js → next-V5SMYMDJ.js} +12 -12
- package/dist/{piHook-TDLUFLAX.js → piHook-FLULHFIM.js} +5 -5
- package/dist/{propose-5563C4VU.js → propose-TWOXTJQW.js} +4 -4
- package/dist/{refine-UDAX2EJO.js → refine-2B4SYG4A.js} +14 -14
- package/dist/{releasesConfigure-JA7QNAJF.js → releasesConfigure-CLIC4ZJK.js} +3 -3
- package/dist/{remove-CSUOZRGT.js → remove-IQYHZGAI.js} +3 -3
- package/dist/{restartNode-BS54KMDE.js → restartNode-KTVDTXVC.js} +5 -5
- package/dist/{review-LIGFHQUT.js → review-AB4XDAWI.js} +5 -5
- package/dist/{reviewPrComments-5UGXLCP2.js → reviewPrComments-XJHEL65Z.js} +2 -2
- package/dist/{rewindPhase-M56REXTY.js → rewindPhase-LOOHSIPC.js} +8 -8
- package/dist/{rulesAdd-BY3QLX3M.js → rulesAdd-QI27Q4JE.js} +8 -6
- package/dist/{run-U6FTOWVL.js → run-4QEL6OOQ.js} +10 -10
- package/dist/{run-KSZAMSBT.js → run-WYIZVHCV.js} +10 -10
- package/dist/{runDaemon-NHDXRPTA.js → runDaemon-RYMQEJW7.js} +30 -18
- package/dist/{runExtract-HCHT2Z6A.js → runExtract-VK32OSQH.js} +3 -3
- package/dist/{runRefine-Q6GPUW2O.js → runRefine-MTCXRUVM.js} +14 -14
- package/dist/{scan-HYKQSOX6.js → scan-LDSE2MHJ.js} +2 -2
- package/dist/{schemaConfirm-7RXINN7E.js → schemaConfirm-LM4PK76B.js} +2 -2
- package/dist/{schemaUnlock-HMIX54JF.js → schemaUnlock-FKZPTVNF.js} +2 -2
- package/dist/{search-SVPLY43J.js → search-CXYHC2UR.js} +5 -5
- package/dist/{show-WMXEI4AG.js → show-3UYNNVB3.js} +3 -3
- package/dist/{show-5SPRXCHW.js → show-DMADGGAX.js} +3 -3
- package/dist/{signExtension-AKNHXLIK.js → signExtension-NAZ56PXM.js} +1 -1
- package/dist/{skip-ZZHUH3MU.js → skip-PRE2V5HC.js} +3 -3
- package/dist/{updateNode-PUE4TL5Q.js → updateNode-5637N2P7.js} +5 -5
- package/dist/{updatePlan-H6WWSTM3.js → updatePlan-BCPFFG3Y.js} +4 -4
- package/dist/{web-7FYUCPQU.js → web-ELPZ3DLG.js} +22 -21
- package/dist/{web-DDPTXXOY.js → web-Z2X7OC3Z.js} +22 -21
- package/package.json +1 -1
- package/dist/{chunk-HSWDSL22.js → chunk-VLZHSD52.js} +7 -7
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
resolveLinkTarget,
|
|
12
12
|
usageWindowKey,
|
|
13
13
|
watcherLogPath
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TYE72SBM.js";
|
|
15
15
|
import {
|
|
16
16
|
readLogTail
|
|
17
17
|
} from "./chunk-JNCFHWBK.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "./chunk-3NPVVAAT.js";
|
|
27
27
|
import {
|
|
28
28
|
firstBrokenHop
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-FTAHEOIU.js";
|
|
30
30
|
import {
|
|
31
31
|
TRACE_HEADER,
|
|
32
32
|
newTraceId
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
import {
|
|
35
35
|
ASSIST_VERSION,
|
|
36
36
|
PROTOCOL_VERSION
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-6LOIHOC4.js";
|
|
38
38
|
import {
|
|
39
39
|
queryNodes
|
|
40
40
|
} from "./chunk-OD7CMDGZ.js";
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
} from "./chunk-UJBW7FVI.js";
|
|
80
80
|
import {
|
|
81
81
|
targetConversationEvents
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-42WIJCMO.js";
|
|
83
83
|
import {
|
|
84
84
|
configEntryLayers,
|
|
85
85
|
ghFailure,
|
|
@@ -92,6 +92,13 @@ import {
|
|
|
92
92
|
import {
|
|
93
93
|
readScopedRules
|
|
94
94
|
} from "./chunk-W5FPQALS.js";
|
|
95
|
+
import {
|
|
96
|
+
findClaudeFiles
|
|
97
|
+
} from "./chunk-IZZJUZZY.js";
|
|
98
|
+
import {
|
|
99
|
+
parseRulesSection,
|
|
100
|
+
rulesSectionRange
|
|
101
|
+
} from "./chunk-ADLCDG2V.js";
|
|
95
102
|
import {
|
|
96
103
|
requestPromptSession
|
|
97
104
|
} from "./chunk-WP7S72JJ.js";
|
|
@@ -157,13 +164,13 @@ import {
|
|
|
157
164
|
} from "./chunk-IV7Z4UVQ.js";
|
|
158
165
|
import {
|
|
159
166
|
applyUserConfigSet
|
|
160
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-4WMCOPQR.js";
|
|
161
168
|
import {
|
|
162
169
|
applyConfigSet
|
|
163
170
|
} from "./chunk-5WQDLREX.js";
|
|
164
171
|
import {
|
|
165
172
|
applySharedRepoConfigSet
|
|
166
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-62GEKLQ6.js";
|
|
167
174
|
import {
|
|
168
175
|
getNestedValue
|
|
169
176
|
} from "./chunk-OU6Q5ZS3.js";
|
|
@@ -174,13 +181,16 @@ import {
|
|
|
174
181
|
applyConfigUnset,
|
|
175
182
|
applySharedRepoConfigUnset,
|
|
176
183
|
applyUserConfigUnset
|
|
177
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-SYV6FBQJ.js";
|
|
178
185
|
import {
|
|
179
186
|
configScopeNames
|
|
180
187
|
} from "./chunk-ADIYP3KC.js";
|
|
181
188
|
import {
|
|
182
189
|
isGlobalOnlyConfigKey
|
|
183
190
|
} from "./chunk-VPMI4LV2.js";
|
|
191
|
+
import {
|
|
192
|
+
resolveSharedRepoBlock
|
|
193
|
+
} from "./chunk-NTWNDSCD.js";
|
|
184
194
|
import {
|
|
185
195
|
isNodeOnlyConfigKey
|
|
186
196
|
} from "./chunk-YOFY27RM.js";
|
|
@@ -192,6 +202,9 @@ import {
|
|
|
192
202
|
configEntryNode,
|
|
193
203
|
configKeyNode
|
|
194
204
|
} from "./chunk-7TT6C4IC.js";
|
|
205
|
+
import {
|
|
206
|
+
readUserConfig
|
|
207
|
+
} from "./chunk-VLZHSD52.js";
|
|
195
208
|
import {
|
|
196
209
|
mapConfigSecrets
|
|
197
210
|
} from "./chunk-YNHPTUHS.js";
|
|
@@ -215,7 +228,7 @@ import {
|
|
|
215
228
|
} from "./chunk-AOTNNZPH.js";
|
|
216
229
|
import {
|
|
217
230
|
rewindItemToPhase
|
|
218
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-SGKMAXMO.js";
|
|
219
232
|
import {
|
|
220
233
|
loadBacklogSummaries,
|
|
221
234
|
searchBacklogSummaries
|
|
@@ -242,7 +255,7 @@ import {
|
|
|
242
255
|
} from "./chunk-IZBQH3LW.js";
|
|
243
256
|
import {
|
|
244
257
|
resolveRewindPlan
|
|
245
|
-
} from "./chunk-
|
|
258
|
+
} from "./chunk-GUCGXHC3.js";
|
|
246
259
|
import {
|
|
247
260
|
deleteItem,
|
|
248
261
|
getOrigin,
|
|
@@ -291,7 +304,7 @@ import {
|
|
|
291
304
|
discoverSessionJsonlPaths,
|
|
292
305
|
harnessAdapter,
|
|
293
306
|
parseSessionFile
|
|
294
|
-
} from "./chunk-
|
|
307
|
+
} from "./chunk-ZSFB3YY3.js";
|
|
295
308
|
import {
|
|
296
309
|
harnessLabel
|
|
297
310
|
} from "./chunk-AWIOBY7Q.js";
|
|
@@ -320,7 +333,8 @@ import {
|
|
|
320
333
|
setBacklogDir
|
|
321
334
|
} from "./chunk-7O466DJY.js";
|
|
322
335
|
import {
|
|
323
|
-
loadConfig
|
|
336
|
+
loadConfig,
|
|
337
|
+
loadGlobalConfigRaw
|
|
324
338
|
} from "./chunk-KGFZYUE2.js";
|
|
325
339
|
import {
|
|
326
340
|
getGlobalConfigPath,
|
|
@@ -337,6 +351,9 @@ import {
|
|
|
337
351
|
import {
|
|
338
352
|
loadJson
|
|
339
353
|
} from "./chunk-CGYVYHMM.js";
|
|
354
|
+
import {
|
|
355
|
+
findRepoRoot
|
|
356
|
+
} from "./chunk-WXQ3EA5H.js";
|
|
340
357
|
import {
|
|
341
358
|
assistConfigSchema
|
|
342
359
|
} from "./chunk-YXXKT6LL.js";
|
|
@@ -381,10 +398,10 @@ function sweepStagedAttachments(dir = stagedAttachmentsDir, now = Date.now()) {
|
|
|
381
398
|
}
|
|
382
399
|
for (const name of entries2) {
|
|
383
400
|
if (!name.startsWith("upload-")) continue;
|
|
384
|
-
const
|
|
401
|
+
const path6 = join(dir, name);
|
|
385
402
|
try {
|
|
386
|
-
if (now - statSync(
|
|
387
|
-
rmSync(
|
|
403
|
+
if (now - statSync(path6).mtimeMs > PANE_PERSIST_TTL_MS)
|
|
404
|
+
rmSync(path6, { recursive: true, force: true });
|
|
388
405
|
} catch {
|
|
389
406
|
}
|
|
390
407
|
}
|
|
@@ -1723,8 +1740,8 @@ async function loadCommittedPaths(key, cwd, session) {
|
|
|
1723
1740
|
for (const commit of commits) {
|
|
1724
1741
|
const resolved2 = await resolveCommitCached(key, cwd, commit.sha);
|
|
1725
1742
|
if (!resolved2) continue;
|
|
1726
|
-
for (const
|
|
1727
|
-
if (!bases.has(
|
|
1743
|
+
for (const path6 of resolved2.paths) {
|
|
1744
|
+
if (!bases.has(path6)) bases.set(path6, resolved2.base);
|
|
1728
1745
|
}
|
|
1729
1746
|
}
|
|
1730
1747
|
return { commits, bases };
|
|
@@ -1770,16 +1787,16 @@ async function itemChangeSet(cwd, session) {
|
|
|
1770
1787
|
}
|
|
1771
1788
|
function groupByBase(bases) {
|
|
1772
1789
|
const groups = /* @__PURE__ */ new Map();
|
|
1773
|
-
for (const [
|
|
1790
|
+
for (const [path6, base] of bases) {
|
|
1774
1791
|
const paths = groups.get(base);
|
|
1775
|
-
if (paths) paths.push(
|
|
1776
|
-
else groups.set(base, [
|
|
1792
|
+
if (paths) paths.push(path6);
|
|
1793
|
+
else groups.set(base, [path6]);
|
|
1777
1794
|
}
|
|
1778
1795
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
1779
1796
|
}
|
|
1780
1797
|
async function dirtyPaths(cwd, bases) {
|
|
1781
1798
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
1782
|
-
return output.split("\n").filter((
|
|
1799
|
+
return output.split("\n").filter((path6) => path6 && !bases.has(path6)).sort();
|
|
1783
1800
|
}
|
|
1784
1801
|
|
|
1785
1802
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -1788,8 +1805,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
1788
1805
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
1789
1806
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
1790
1807
|
}
|
|
1791
|
-
async function untrackedFileDiff(cwd,
|
|
1792
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
1808
|
+
async function untrackedFileDiff(cwd, path6) {
|
|
1809
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path6], {
|
|
1793
1810
|
maxBuffer: MAX_DIFF_BYTES,
|
|
1794
1811
|
allowFailure: true
|
|
1795
1812
|
});
|
|
@@ -1802,7 +1819,7 @@ async function untrackedDiff(cwd) {
|
|
|
1802
1819
|
]);
|
|
1803
1820
|
const paths = list.split("\n").filter(Boolean);
|
|
1804
1821
|
const diffs = await Promise.all(
|
|
1805
|
-
paths.map((
|
|
1822
|
+
paths.map((path6) => untrackedFileDiff(cwd, path6))
|
|
1806
1823
|
);
|
|
1807
1824
|
return diffs.join("");
|
|
1808
1825
|
}
|
|
@@ -1965,8 +1982,8 @@ import { readFile, stat } from "fs/promises";
|
|
|
1965
1982
|
// src/commands/sessions/web/fileContent/respondCommitFile.ts
|
|
1966
1983
|
import { relative, sep } from "path";
|
|
1967
1984
|
var MAX_FILE_BYTES = 2 * 1024 * 1024;
|
|
1968
|
-
async function commitBlob(cwd, sha,
|
|
1969
|
-
const line = await execGit(cwd, ["ls-tree", "-l", sha, "--",
|
|
1985
|
+
async function commitBlob(cwd, sha, path6) {
|
|
1986
|
+
const line = await execGit(cwd, ["ls-tree", "-l", sha, "--", path6]);
|
|
1970
1987
|
const match = /^\d+ blob ([0-9a-f]+)\s+(\d+)\t/.exec(line);
|
|
1971
1988
|
if (!match) return void 0;
|
|
1972
1989
|
return { hash: match[1], size: Number(match[2]) };
|
|
@@ -1982,8 +1999,8 @@ async function respondCommitFile(req, res, { cwd, target }, commit) {
|
|
|
1982
1999
|
respondJson(res, 400, { error: "Invalid commit" });
|
|
1983
2000
|
return;
|
|
1984
2001
|
}
|
|
1985
|
-
const
|
|
1986
|
-
const blob = await commitBlob(cwd, scope.sha,
|
|
2002
|
+
const path6 = relative(cwd, target).split(sep).join("/");
|
|
2003
|
+
const blob = await commitBlob(cwd, scope.sha, path6);
|
|
1987
2004
|
if (!blob) {
|
|
1988
2005
|
respondJson(res, 404, { error: "File not found" });
|
|
1989
2006
|
return;
|
|
@@ -2006,9 +2023,9 @@ import { isAbsolute, relative as relative2, resolve } from "path";
|
|
|
2006
2023
|
function repoRoot(cwd) {
|
|
2007
2024
|
return resolve(cwd);
|
|
2008
2025
|
}
|
|
2009
|
-
function resolveWithinCwd(cwd,
|
|
2026
|
+
function resolveWithinCwd(cwd, path6) {
|
|
2010
2027
|
const root = repoRoot(cwd);
|
|
2011
|
-
const target = resolve(root,
|
|
2028
|
+
const target = resolve(root, path6);
|
|
2012
2029
|
const rel = relative2(root, target);
|
|
2013
2030
|
if (rel === "" || rel.startsWith("..") || isAbsolute(rel)) return null;
|
|
2014
2031
|
return target;
|
|
@@ -2018,14 +2035,14 @@ function resolveWithinCwd(cwd, path5) {
|
|
|
2018
2035
|
function getFileTarget(req, res) {
|
|
2019
2036
|
const cwd = getCwdParam(req, res);
|
|
2020
2037
|
if (!cwd) return null;
|
|
2021
|
-
const
|
|
2038
|
+
const path6 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
2022
2039
|
"path"
|
|
2023
2040
|
);
|
|
2024
|
-
if (!
|
|
2041
|
+
if (!path6) {
|
|
2025
2042
|
respondJson(res, 400, { error: "Missing path" });
|
|
2026
2043
|
return null;
|
|
2027
2044
|
}
|
|
2028
|
-
const target = resolveWithinCwd(cwd,
|
|
2045
|
+
const target = resolveWithinCwd(cwd, path6);
|
|
2029
2046
|
if (!target) {
|
|
2030
2047
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
2031
2048
|
return null;
|
|
@@ -2664,7 +2681,7 @@ function findSynthesisForBranch(repoReviewsDir, branch) {
|
|
|
2664
2681
|
const parent = dirname(branchKeyPath);
|
|
2665
2682
|
const branchPrefix = basename3(branchKeyPath);
|
|
2666
2683
|
if (!existsSync4(parent)) return null;
|
|
2667
|
-
const synthesisFiles = readdirSync5(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join5(parent, name, "synthesis.md")).filter((
|
|
2684
|
+
const synthesisFiles = readdirSync5(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join5(parent, name, "synthesis.md")).filter((path6) => existsSync4(path6)).map((path6) => ({ path: path6, mtime: statSync3(path6).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
2668
2685
|
return synthesisFiles[0]?.path ?? null;
|
|
2669
2686
|
}
|
|
2670
2687
|
|
|
@@ -2694,12 +2711,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
2694
2711
|
const cwd = getCwdParam(req, res);
|
|
2695
2712
|
if (!cwd) return;
|
|
2696
2713
|
try {
|
|
2697
|
-
const
|
|
2698
|
-
if (!
|
|
2714
|
+
const path6 = await resolveSynthesisPath(cwd);
|
|
2715
|
+
if (!path6) {
|
|
2699
2716
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
2700
2717
|
return;
|
|
2701
2718
|
}
|
|
2702
|
-
respondJson(res, 200, { synthesis: readFileSync(
|
|
2719
|
+
respondJson(res, 200, { synthesis: readFileSync(path6, "utf8") });
|
|
2703
2720
|
} catch {
|
|
2704
2721
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
2705
2722
|
}
|
|
@@ -2712,19 +2729,19 @@ var execFileAsync4 = promisify4(execFile4);
|
|
|
2712
2729
|
var MAX_FILE_BYTES2 = 2 * 1024 * 1024;
|
|
2713
2730
|
var REPO = /^[\w.-]+\/[\w.-]+$/;
|
|
2714
2731
|
var SHA = /^[0-9a-f]{7,40}$/i;
|
|
2715
|
-
function validPath(
|
|
2716
|
-
return
|
|
2732
|
+
function validPath(path6) {
|
|
2733
|
+
return path6.length > 0 && !path6.startsWith("/") && path6.split("/").every((part) => part !== "" && part !== "..");
|
|
2717
2734
|
}
|
|
2718
2735
|
async function githubFileContent(req, res) {
|
|
2719
2736
|
const params = new URL(req.url ?? "/", "http://localhost").searchParams;
|
|
2720
2737
|
const repo = params.get("repo") ?? "";
|
|
2721
2738
|
const sha = params.get("sha") ?? "";
|
|
2722
|
-
const
|
|
2723
|
-
if (!REPO.test(repo) || !SHA.test(sha) || !validPath(
|
|
2739
|
+
const path6 = params.get("path") ?? "";
|
|
2740
|
+
if (!REPO.test(repo) || !SHA.test(sha) || !validPath(path6)) {
|
|
2724
2741
|
respondJson(res, 400, { error: "Invalid repo, sha or path" });
|
|
2725
2742
|
return;
|
|
2726
2743
|
}
|
|
2727
|
-
const encodedPath =
|
|
2744
|
+
const encodedPath = path6.split("/").map(encodeURIComponent).join("/");
|
|
2728
2745
|
try {
|
|
2729
2746
|
const { stdout } = await execFileAsync4(
|
|
2730
2747
|
"gh",
|
|
@@ -2819,8 +2836,8 @@ function parseDiffNameStatus(output) {
|
|
|
2819
2836
|
if (!status || fields.length < 2) continue;
|
|
2820
2837
|
const category = categorize(status[0]);
|
|
2821
2838
|
if (!category) continue;
|
|
2822
|
-
const
|
|
2823
|
-
if (
|
|
2839
|
+
const path6 = fields[fields.length - 1];
|
|
2840
|
+
if (path6) result[category].push(path6);
|
|
2824
2841
|
}
|
|
2825
2842
|
return result;
|
|
2826
2843
|
}
|
|
@@ -2862,7 +2879,7 @@ async function headCommit3(cwd) {
|
|
|
2862
2879
|
}
|
|
2863
2880
|
async function dirtyItemContents(cwd, groups, uncommitted) {
|
|
2864
2881
|
const dirty = /* @__PURE__ */ new Set([...uncommitted.modified, ...uncommitted.new]);
|
|
2865
|
-
const paths = groups.flatMap((group) => group.paths).filter((
|
|
2882
|
+
const paths = groups.flatMap((group) => group.paths).filter((path6) => dirty.has(path6));
|
|
2866
2883
|
if (paths.length === 0) return "";
|
|
2867
2884
|
try {
|
|
2868
2885
|
return await execGit(cwd, ["hash-object", "--", ...paths]);
|
|
@@ -3356,11 +3373,11 @@ function logLinkedRequest(req, res) {
|
|
|
3356
3373
|
const started = Date.now();
|
|
3357
3374
|
const from = req.headers[LINKED_FROM_HEADER2];
|
|
3358
3375
|
const trace = req.headers[TRACE_HEADER] ?? "none";
|
|
3359
|
-
const
|
|
3376
|
+
const path6 = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
3360
3377
|
res.once("finish", () => {
|
|
3361
|
-
if (isQuietPoll(
|
|
3378
|
+
if (isQuietPoll(path6, res.statusCode)) return;
|
|
3362
3379
|
console.log(
|
|
3363
|
-
`link-from ${from} http: ${req.method} ${
|
|
3380
|
+
`link-from ${from} http: ${req.method} ${path6} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
|
|
3364
3381
|
);
|
|
3365
3382
|
});
|
|
3366
3383
|
}
|
|
@@ -3777,21 +3794,21 @@ function subsequenceScore(text, query) {
|
|
|
3777
3794
|
}
|
|
3778
3795
|
return score - Math.min(text.length, MAX_LENGTH_PENALTY);
|
|
3779
3796
|
}
|
|
3780
|
-
function scoreFilePath(
|
|
3797
|
+
function scoreFilePath(path6, query) {
|
|
3781
3798
|
const needle = query.trim().toLowerCase();
|
|
3782
3799
|
if (!needle) return 0;
|
|
3783
|
-
const basename6 =
|
|
3800
|
+
const basename6 = path6.slice(path6.lastIndexOf("/") + 1);
|
|
3784
3801
|
const inBasename = subsequenceScore(basename6, needle);
|
|
3785
3802
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
3786
|
-
return subsequenceScore(
|
|
3803
|
+
return subsequenceScore(path6, needle);
|
|
3787
3804
|
}
|
|
3788
3805
|
|
|
3789
3806
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
3790
3807
|
function rankFilePaths(paths, query, limit) {
|
|
3791
3808
|
const scored = [];
|
|
3792
|
-
for (const
|
|
3793
|
-
const score = scoreFilePath(
|
|
3794
|
-
if (score !== null) scored.push({ path:
|
|
3809
|
+
for (const path6 of paths) {
|
|
3810
|
+
const score = scoreFilePath(path6, query);
|
|
3811
|
+
if (score !== null) scored.push({ path: path6, score });
|
|
3795
3812
|
}
|
|
3796
3813
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
3797
3814
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -4579,8 +4596,104 @@ async function nextPickup(req, res) {
|
|
|
4579
4596
|
}
|
|
4580
4597
|
}
|
|
4581
4598
|
|
|
4582
|
-
// src/commands/
|
|
4599
|
+
// src/commands/rules/adviceRulesOf.ts
|
|
4600
|
+
function isAdviceRule(value) {
|
|
4601
|
+
const rule = value;
|
|
4602
|
+
return typeof rule?.title === "string" && typeof rule.text === "string";
|
|
4603
|
+
}
|
|
4604
|
+
function adviceRulesOf(raw) {
|
|
4605
|
+
const advice = raw.advice;
|
|
4606
|
+
return Array.isArray(advice?.rules) ? advice.rules.filter(isAdviceRule) : [];
|
|
4607
|
+
}
|
|
4608
|
+
|
|
4609
|
+
// src/commands/rules/claudeMdRuleScopes.ts
|
|
4610
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
4583
4611
|
import path2 from "path";
|
|
4612
|
+
function relativeDir(root, file) {
|
|
4613
|
+
const rel = path2.relative(root, path2.dirname(file)).split(path2.sep).join("/");
|
|
4614
|
+
return rel === "" ? "" : `${rel}/`;
|
|
4615
|
+
}
|
|
4616
|
+
function claudeMdRuleScopes(root) {
|
|
4617
|
+
const scopes = findClaudeFiles(root).map((file) => ({ file, content: readFileSync2(file, "utf8") })).filter(({ content }) => rulesSectionRange(content.split(/\r?\n/))).map(({ file, content }) => ({
|
|
4618
|
+
dir: relativeDir(root, file),
|
|
4619
|
+
rules: parseRulesSection(content)
|
|
4620
|
+
})).sort((a, b) => a.dir.localeCompare(b.dir));
|
|
4621
|
+
return scopes.map(({ dir, rules }) => ({
|
|
4622
|
+
id: `claude-md:${dir}`,
|
|
4623
|
+
kind: "claude-md",
|
|
4624
|
+
name: `${dir}CLAUDE.md`,
|
|
4625
|
+
dir,
|
|
4626
|
+
depth: scopes.filter(
|
|
4627
|
+
(other) => other.dir !== dir && dir.startsWith(other.dir)
|
|
4628
|
+
).length,
|
|
4629
|
+
rules
|
|
4630
|
+
}));
|
|
4631
|
+
}
|
|
4632
|
+
|
|
4633
|
+
// src/commands/rules/readRuleScopes.ts
|
|
4634
|
+
async function dbScopes(cwd) {
|
|
4635
|
+
const userDb = {
|
|
4636
|
+
id: "user-db",
|
|
4637
|
+
kind: "user-db",
|
|
4638
|
+
name: "User (db)",
|
|
4639
|
+
depth: 0,
|
|
4640
|
+
rules: []
|
|
4641
|
+
};
|
|
4642
|
+
const repoDb = {
|
|
4643
|
+
id: "repo-db",
|
|
4644
|
+
kind: "repo-db",
|
|
4645
|
+
name: "Repo (db)",
|
|
4646
|
+
depth: 0,
|
|
4647
|
+
rules: []
|
|
4648
|
+
};
|
|
4649
|
+
try {
|
|
4650
|
+
const orm = await getDb();
|
|
4651
|
+
const { label, block } = await resolveSharedRepoBlock(orm, void 0, cwd);
|
|
4652
|
+
return [
|
|
4653
|
+
{ ...userDb, rules: adviceRulesOf(await readUserConfig(orm)) },
|
|
4654
|
+
{ ...repoDb, label, rules: adviceRulesOf(block) }
|
|
4655
|
+
];
|
|
4656
|
+
} catch (error) {
|
|
4657
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
4658
|
+
return [
|
|
4659
|
+
{ ...userDb, error: message },
|
|
4660
|
+
{ ...repoDb, error: message }
|
|
4661
|
+
];
|
|
4662
|
+
}
|
|
4663
|
+
}
|
|
4664
|
+
async function readRuleScopes(cwd, globalConfigPath = getGlobalConfigPath()) {
|
|
4665
|
+
const [userDb, repoDb] = await dbScopes(cwd);
|
|
4666
|
+
const userNode = {
|
|
4667
|
+
id: "user-node",
|
|
4668
|
+
kind: "user-node",
|
|
4669
|
+
name: "User (node)",
|
|
4670
|
+
label: globalConfigFileLabel(globalConfigPath),
|
|
4671
|
+
depth: 0,
|
|
4672
|
+
rules: adviceRulesOf(loadGlobalConfigRaw(globalConfigPath))
|
|
4673
|
+
};
|
|
4674
|
+
return [
|
|
4675
|
+
userDb,
|
|
4676
|
+
userNode,
|
|
4677
|
+
repoDb,
|
|
4678
|
+
...claudeMdRuleScopes(findRepoRoot(cwd) ?? cwd)
|
|
4679
|
+
];
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4682
|
+
// src/commands/sessions/web/getRuleScopes.ts
|
|
4683
|
+
async function getRuleScopes(req, res) {
|
|
4684
|
+
const cwd = getCwdParam(req, res);
|
|
4685
|
+
if (!cwd) return;
|
|
4686
|
+
try {
|
|
4687
|
+
respondJson(res, 200, { scopes: await readRuleScopes(cwd) });
|
|
4688
|
+
} catch (error) {
|
|
4689
|
+
respondJson(res, 500, {
|
|
4690
|
+
error: error instanceof Error ? error.message : "Failed to read rules"
|
|
4691
|
+
});
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
|
|
4695
|
+
// src/commands/sessions/web/listScopedRules.ts
|
|
4696
|
+
import path3 from "path";
|
|
4584
4697
|
function listScopedRules(req, res) {
|
|
4585
4698
|
const cwd = getCwdParam(req, res);
|
|
4586
4699
|
if (!cwd) return;
|
|
@@ -4598,7 +4711,7 @@ function listScopedRules(req, res) {
|
|
|
4598
4711
|
respondJson(res, 200, {
|
|
4599
4712
|
rules: readScopedRules(target).map((rule) => ({
|
|
4600
4713
|
...rule,
|
|
4601
|
-
source:
|
|
4714
|
+
source: path3.relative(root, rule.source) || rule.source
|
|
4602
4715
|
}))
|
|
4603
4716
|
});
|
|
4604
4717
|
} catch {
|
|
@@ -4607,11 +4720,11 @@ function listScopedRules(req, res) {
|
|
|
4607
4720
|
}
|
|
4608
4721
|
|
|
4609
4722
|
// src/commands/sessions/web/slashCommands/listSlashCommands.ts
|
|
4610
|
-
import
|
|
4723
|
+
import path5 from "path";
|
|
4611
4724
|
|
|
4612
4725
|
// src/commands/sessions/web/slashCommands/readSlashCommands.ts
|
|
4613
4726
|
import fs from "fs";
|
|
4614
|
-
import
|
|
4727
|
+
import path4 from "path";
|
|
4615
4728
|
function readEntries(dir) {
|
|
4616
4729
|
try {
|
|
4617
4730
|
return fs.readdirSync(dir, { withFileTypes: true });
|
|
@@ -4627,22 +4740,22 @@ function describe(file) {
|
|
|
4627
4740
|
}
|
|
4628
4741
|
}
|
|
4629
4742
|
function readSkills(dir) {
|
|
4630
|
-
return readEntries(dir).filter((entry) => entry.isDirectory() || entry.isSymbolicLink()).map((entry) =>
|
|
4631
|
-
name:
|
|
4743
|
+
return readEntries(dir).filter((entry) => entry.isDirectory() || entry.isSymbolicLink()).map((entry) => path4.join(dir, entry.name, "SKILL.md")).filter((file) => fs.existsSync(file)).map((file) => ({
|
|
4744
|
+
name: path4.basename(path4.dirname(file)),
|
|
4632
4745
|
description: describe(file)
|
|
4633
4746
|
}));
|
|
4634
4747
|
}
|
|
4635
4748
|
function readCommands(dir) {
|
|
4636
4749
|
return readEntries(dir).filter((entry) => !entry.isDirectory() && entry.name.endsWith(".md")).map((entry) => ({
|
|
4637
4750
|
name: entry.name.slice(0, -".md".length),
|
|
4638
|
-
description: describe(
|
|
4751
|
+
description: describe(path4.join(dir, entry.name))
|
|
4639
4752
|
}));
|
|
4640
4753
|
}
|
|
4641
4754
|
function readSlashCommands(home, scope) {
|
|
4642
4755
|
const byName = /* @__PURE__ */ new Map();
|
|
4643
4756
|
for (const command of [
|
|
4644
|
-
...readCommands(
|
|
4645
|
-
...readSkills(
|
|
4757
|
+
...readCommands(path4.join(home, "commands")),
|
|
4758
|
+
...readSkills(path4.join(home, "skills"))
|
|
4646
4759
|
])
|
|
4647
4760
|
byName.set(command.name, { ...command, scope });
|
|
4648
4761
|
return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -4652,7 +4765,7 @@ function readSlashCommands(home, scope) {
|
|
|
4652
4765
|
function listSlashCommands(claudeHome, cwd) {
|
|
4653
4766
|
const user = readSlashCommands(claudeHome, "user");
|
|
4654
4767
|
const userNames = new Set(user.map((command) => command.name));
|
|
4655
|
-
const project = readSlashCommands(
|
|
4768
|
+
const project = readSlashCommands(path5.join(cwd, ".claude"), "project");
|
|
4656
4769
|
return [
|
|
4657
4770
|
...user,
|
|
4658
4771
|
...project.filter((command) => !userNames.has(command.name))
|
|
@@ -5063,22 +5176,22 @@ import { createReadStream } from "fs";
|
|
|
5063
5176
|
import { stat as stat2 } from "fs/promises";
|
|
5064
5177
|
async function previewImage(req, res) {
|
|
5065
5178
|
const url = new URL(req.url ?? "/", "http://localhost");
|
|
5066
|
-
const
|
|
5067
|
-
if (!isStagedAttachmentPath(
|
|
5179
|
+
const path6 = url.searchParams.get("path") ?? "";
|
|
5180
|
+
if (!isStagedAttachmentPath(path6)) {
|
|
5068
5181
|
respondJson(res, 400, { error: "Not a staged attachment." });
|
|
5069
5182
|
return;
|
|
5070
5183
|
}
|
|
5071
|
-
const info = await stat2(
|
|
5184
|
+
const info = await stat2(path6).catch(() => null);
|
|
5072
5185
|
if (!info?.isFile()) {
|
|
5073
5186
|
respondJson(res, 404, { error: "Attachment is no longer staged." });
|
|
5074
5187
|
return;
|
|
5075
5188
|
}
|
|
5076
5189
|
res.writeHead(200, {
|
|
5077
|
-
"Content-Type": attachmentContentType(
|
|
5190
|
+
"Content-Type": attachmentContentType(path6),
|
|
5078
5191
|
"Content-Length": info.size,
|
|
5079
5192
|
"Cache-Control": "no-store"
|
|
5080
5193
|
});
|
|
5081
|
-
createReadStream(
|
|
5194
|
+
createReadStream(path6).pipe(res);
|
|
5082
5195
|
}
|
|
5083
5196
|
|
|
5084
5197
|
// src/commands/sessions/web/getCurrentBranch.ts
|
|
@@ -5515,8 +5628,8 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
5515
5628
|
|
|
5516
5629
|
// src/commands/sessions/web/releases/latestRun.ts
|
|
5517
5630
|
async function latestRun(cwd, repo, workflow) {
|
|
5518
|
-
const
|
|
5519
|
-
const response = await ghJson(cwd, ["api",
|
|
5631
|
+
const path6 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
|
|
5632
|
+
const response = await ghJson(cwd, ["api", path6]);
|
|
5520
5633
|
const run = response.workflow_runs?.[0];
|
|
5521
5634
|
if (!run) return null;
|
|
5522
5635
|
return {
|
|
@@ -5770,36 +5883,36 @@ import { relative as relative3 } from "path";
|
|
|
5770
5883
|
function git(cwd, args) {
|
|
5771
5884
|
return execGit(cwd, ["--literal-pathspecs", ...args]);
|
|
5772
5885
|
}
|
|
5773
|
-
async function isTracked(cwd,
|
|
5886
|
+
async function isTracked(cwd, path6) {
|
|
5774
5887
|
try {
|
|
5775
|
-
await git(cwd, ["ls-files", "--error-unmatch", "--",
|
|
5888
|
+
await git(cwd, ["ls-files", "--error-unmatch", "--", path6]);
|
|
5776
5889
|
return true;
|
|
5777
5890
|
} catch {
|
|
5778
5891
|
return false;
|
|
5779
5892
|
}
|
|
5780
5893
|
}
|
|
5781
|
-
async function isInHead(cwd,
|
|
5782
|
-
const listing = await git(cwd, ["ls-tree", "HEAD", "--",
|
|
5894
|
+
async function isInHead(cwd, path6) {
|
|
5895
|
+
const listing = await git(cwd, ["ls-tree", "HEAD", "--", path6]);
|
|
5783
5896
|
return listing.trim().length > 0;
|
|
5784
5897
|
}
|
|
5785
|
-
async function hasChanges(cwd,
|
|
5898
|
+
async function hasChanges(cwd, path6) {
|
|
5786
5899
|
const status = await git(cwd, [
|
|
5787
5900
|
"status",
|
|
5788
5901
|
"--porcelain",
|
|
5789
5902
|
"-z",
|
|
5790
5903
|
"--untracked-files=all",
|
|
5791
5904
|
"--",
|
|
5792
|
-
|
|
5905
|
+
path6
|
|
5793
5906
|
]);
|
|
5794
5907
|
return status.length > 0;
|
|
5795
5908
|
}
|
|
5796
|
-
async function renameSources(cwd,
|
|
5909
|
+
async function renameSources(cwd, path6) {
|
|
5797
5910
|
const fields = (await git(cwd, ["diff", "HEAD", "--name-status", "-z"])).split("\0");
|
|
5798
5911
|
const sources = [];
|
|
5799
5912
|
for (let i = 0; i < fields.length; ) {
|
|
5800
5913
|
const status = fields[i];
|
|
5801
5914
|
if (status.startsWith("R")) {
|
|
5802
|
-
if (fields[i + 2] ===
|
|
5915
|
+
if (fields[i + 2] === path6) sources.push(fields[i + 1]);
|
|
5803
5916
|
i += 3;
|
|
5804
5917
|
} else {
|
|
5805
5918
|
i += status.startsWith("C") ? 3 : 2;
|
|
@@ -5807,34 +5920,34 @@ async function renameSources(cwd, path5) {
|
|
|
5807
5920
|
}
|
|
5808
5921
|
return sources;
|
|
5809
5922
|
}
|
|
5810
|
-
async function restorePath(cwd,
|
|
5811
|
-
if (await isInHead(cwd,
|
|
5812
|
-
await git(cwd, ["checkout", "HEAD", "--",
|
|
5923
|
+
async function restorePath(cwd, path6) {
|
|
5924
|
+
if (await isInHead(cwd, path6)) {
|
|
5925
|
+
await git(cwd, ["checkout", "HEAD", "--", path6]);
|
|
5813
5926
|
return;
|
|
5814
5927
|
}
|
|
5815
|
-
if (await isTracked(cwd,
|
|
5816
|
-
await git(cwd, ["rm", "-f", "--",
|
|
5928
|
+
if (await isTracked(cwd, path6)) {
|
|
5929
|
+
await git(cwd, ["rm", "-f", "--", path6]);
|
|
5817
5930
|
return;
|
|
5818
5931
|
}
|
|
5819
|
-
await git(cwd, ["clean", "-f", "--",
|
|
5932
|
+
await git(cwd, ["clean", "-f", "--", path6]);
|
|
5820
5933
|
}
|
|
5821
|
-
async function revertPathChanges(cwd,
|
|
5822
|
-
if (!await hasChanges(cwd,
|
|
5823
|
-
throw new Error(`No uncommitted changes found for ${
|
|
5824
|
-
for (const target of [...await renameSources(cwd,
|
|
5934
|
+
async function revertPathChanges(cwd, path6) {
|
|
5935
|
+
if (!await hasChanges(cwd, path6))
|
|
5936
|
+
throw new Error(`No uncommitted changes found for ${path6}`);
|
|
5937
|
+
for (const target of [...await renameSources(cwd, path6), path6])
|
|
5825
5938
|
await restorePath(cwd, target);
|
|
5826
|
-
if (await hasChanges(cwd,
|
|
5827
|
-
throw new Error(`${
|
|
5939
|
+
if (await hasChanges(cwd, path6))
|
|
5940
|
+
throw new Error(`${path6} still has uncommitted changes`);
|
|
5828
5941
|
}
|
|
5829
5942
|
|
|
5830
5943
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
5831
5944
|
async function revertDiffFile(req, res) {
|
|
5832
5945
|
const resolved2 = getFileTarget(req, res);
|
|
5833
5946
|
if (!resolved2) return;
|
|
5834
|
-
const
|
|
5947
|
+
const path6 = relative3(repoRoot(resolved2.cwd), resolved2.target);
|
|
5835
5948
|
try {
|
|
5836
|
-
await revertPathChanges(resolved2.cwd,
|
|
5837
|
-
respondJson(res, 200, { reverted:
|
|
5949
|
+
await revertPathChanges(resolved2.cwd, path6);
|
|
5950
|
+
respondJson(res, 200, { reverted: path6 });
|
|
5838
5951
|
} catch (error) {
|
|
5839
5952
|
respondJson(res, 500, {
|
|
5840
5953
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -5878,7 +5991,7 @@ import { relative as relative4 } from "path";
|
|
|
5878
5991
|
function requestedPaths(body) {
|
|
5879
5992
|
const paths = body.paths;
|
|
5880
5993
|
if (!Array.isArray(paths)) return null;
|
|
5881
|
-
if (paths.some((
|
|
5994
|
+
if (paths.some((path6) => typeof path6 !== "string")) return null;
|
|
5882
5995
|
return paths;
|
|
5883
5996
|
}
|
|
5884
5997
|
async function revertDiffPaths(req, res) {
|
|
@@ -5898,10 +6011,10 @@ async function revertDiffPaths(req, res) {
|
|
|
5898
6011
|
const root = repoRoot(cwd);
|
|
5899
6012
|
const reverted = [];
|
|
5900
6013
|
const failed = [];
|
|
5901
|
-
for (const
|
|
5902
|
-
const target = resolveWithinCwd(cwd,
|
|
6014
|
+
for (const path6 of paths) {
|
|
6015
|
+
const target = resolveWithinCwd(cwd, path6);
|
|
5903
6016
|
if (!target) {
|
|
5904
|
-
failed.push({ path:
|
|
6017
|
+
failed.push({ path: path6, error: "Path outside cwd" });
|
|
5905
6018
|
continue;
|
|
5906
6019
|
}
|
|
5907
6020
|
const relativePath = relative4(root, target);
|
|
@@ -6169,9 +6282,9 @@ async function applyDbBackedConfigWrite(key, scope, write) {
|
|
|
6169
6282
|
}
|
|
6170
6283
|
|
|
6171
6284
|
// src/shared/valueAtConfigPath.ts
|
|
6172
|
-
function valueAtConfigPath(value,
|
|
6285
|
+
function valueAtConfigPath(value, path6) {
|
|
6173
6286
|
let current2 = value;
|
|
6174
|
-
for (const key of
|
|
6287
|
+
for (const key of path6) {
|
|
6175
6288
|
if (typeof key === "number") {
|
|
6176
6289
|
if (!Array.isArray(current2)) return void 0;
|
|
6177
6290
|
current2 = current2[key];
|
|
@@ -6188,7 +6301,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
6188
6301
|
return mapConfigSecrets(
|
|
6189
6302
|
value,
|
|
6190
6303
|
node,
|
|
6191
|
-
(secret,
|
|
6304
|
+
(secret, path6) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path6) : secret
|
|
6192
6305
|
);
|
|
6193
6306
|
}
|
|
6194
6307
|
|
|
@@ -6297,8 +6410,8 @@ function seesApp(item, appId) {
|
|
|
6297
6410
|
const linked = item.relationships?.visibleApps?.data;
|
|
6298
6411
|
return Array.isArray(linked) && linked.some((app) => app.id === appId);
|
|
6299
6412
|
}
|
|
6300
|
-
async function listEmails(client,
|
|
6301
|
-
const { data } = await client.get(
|
|
6413
|
+
async function listEmails(client, path6, type, emailAttribute, appId) {
|
|
6414
|
+
const { data } = await client.get(path6, {
|
|
6302
6415
|
include: "visibleApps",
|
|
6303
6416
|
[`fields[${type}]`]: `${emailAttribute},allAppsVisible,visibleApps`,
|
|
6304
6417
|
"fields[apps]": "bundleId",
|
|
@@ -6791,7 +6904,7 @@ async function writeFileContent(req, res) {
|
|
|
6791
6904
|
|
|
6792
6905
|
// src/shared/createBundleHandler.ts
|
|
6793
6906
|
import { createHash } from "crypto";
|
|
6794
|
-
import { readFileSync as
|
|
6907
|
+
import { readFileSync as readFileSync3, statSync as statSync4 } from "fs";
|
|
6795
6908
|
import { dirname as dirname3, join as join8 } from "path";
|
|
6796
6909
|
import { fileURLToPath } from "url";
|
|
6797
6910
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
@@ -6800,7 +6913,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
6800
6913
|
return (req, res) => {
|
|
6801
6914
|
const mtimeMs = statSync4(file).mtimeMs;
|
|
6802
6915
|
if (cache5?.mtimeMs !== mtimeMs) {
|
|
6803
|
-
const body =
|
|
6916
|
+
const body = readFileSync3(file);
|
|
6804
6917
|
const etag = `"${createHash("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
6805
6918
|
cache5 = { body, etag, mtimeMs };
|
|
6806
6919
|
}
|
|
@@ -6823,7 +6936,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
6823
6936
|
|
|
6824
6937
|
// src/commands/sessions/web/createCssHandler.ts
|
|
6825
6938
|
import { createHash as createHash2 } from "crypto";
|
|
6826
|
-
import { readFileSync as
|
|
6939
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
6827
6940
|
import { createRequire } from "module";
|
|
6828
6941
|
var require2 = createRequire(import.meta.url);
|
|
6829
6942
|
function createCssHandler(packageEntry) {
|
|
@@ -6831,7 +6944,7 @@ function createCssHandler(packageEntry) {
|
|
|
6831
6944
|
return (req, res) => {
|
|
6832
6945
|
if (!cache5) {
|
|
6833
6946
|
const resolved2 = require2.resolve(packageEntry);
|
|
6834
|
-
const body =
|
|
6947
|
+
const body = readFileSync4(resolved2, "utf8");
|
|
6835
6948
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
6836
6949
|
cache5 = { body, etag };
|
|
6837
6950
|
}
|
|
@@ -6931,6 +7044,7 @@ var routes2 = {
|
|
|
6931
7044
|
"GET /api/files": listFiles,
|
|
6932
7045
|
"GET /api/history/search": historySearch,
|
|
6933
7046
|
"GET /api/rules": listScopedRules,
|
|
7047
|
+
"GET /api/rules/scopes": getRuleScopes,
|
|
6934
7048
|
"GET /api/slash-commands": slashCommands,
|
|
6935
7049
|
"GET /api/jira-site": jiraSite,
|
|
6936
7050
|
"GET /api/harness": harnessCapabilities,
|
|
@@ -7239,25 +7353,25 @@ function scheduleReconnect() {
|
|
|
7239
7353
|
}
|
|
7240
7354
|
|
|
7241
7355
|
// src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
|
|
7242
|
-
import { mkdirSync, readFileSync as
|
|
7356
|
+
import { mkdirSync, readFileSync as readFileSync5, writeFileSync } from "fs";
|
|
7243
7357
|
import { dirname as dirname4, join as join9 } from "path";
|
|
7244
7358
|
var defaultPath = join9(daemonPaths.dir, "auto-restart-attempts.json");
|
|
7245
|
-
function read(
|
|
7359
|
+
function read(path6) {
|
|
7246
7360
|
try {
|
|
7247
|
-
return JSON.parse(
|
|
7361
|
+
return JSON.parse(readFileSync5(path6, "utf8"));
|
|
7248
7362
|
} catch {
|
|
7249
7363
|
return {};
|
|
7250
7364
|
}
|
|
7251
7365
|
}
|
|
7252
|
-
function autoRestartAttempts(port,
|
|
7366
|
+
function autoRestartAttempts(port, path6 = defaultPath) {
|
|
7253
7367
|
const key = String(port);
|
|
7254
7368
|
return {
|
|
7255
|
-
get: () => read(
|
|
7369
|
+
get: () => read(path6)[key],
|
|
7256
7370
|
set: (built) => {
|
|
7257
|
-
mkdirSync(dirname4(
|
|
7371
|
+
mkdirSync(dirname4(path6), { recursive: true });
|
|
7258
7372
|
writeFileSync(
|
|
7259
|
-
|
|
7260
|
-
`${JSON.stringify({ ...read(
|
|
7373
|
+
path6,
|
|
7374
|
+
`${JSON.stringify({ ...read(path6), [key]: built }, null, 2)}
|
|
7261
7375
|
`
|
|
7262
7376
|
);
|
|
7263
7377
|
}
|