@staff0rd/assist 0.886.4 → 0.886.5
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/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.886.
|
|
9
|
+
version: "0.886.5",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -353,7 +353,8 @@ var daemonPaths = {
|
|
|
353
353
|
autoUpdatePaused: join3(DAEMON_DIR, "auto-update-paused"),
|
|
354
354
|
spawnLock: join3(DAEMON_DIR, "spawn.lock"),
|
|
355
355
|
hooksSettings: join3(DAEMON_DIR, "hooks-settings.json"),
|
|
356
|
-
viewerSize: join3(DAEMON_DIR, "viewer-size.json")
|
|
356
|
+
viewerSize: join3(DAEMON_DIR, "viewer-size.json"),
|
|
357
|
+
promptJournal: join3(DAEMON_DIR, "prompt-journal.jsonl")
|
|
357
358
|
};
|
|
358
359
|
|
|
359
360
|
// src/commands/sessions/daemon/connectToDaemon.ts
|
|
@@ -4966,6 +4967,19 @@ async function diffScopes(req, res) {
|
|
|
4966
4967
|
respondJson(res, 200, { commits: commits2, branchBase: base });
|
|
4967
4968
|
}
|
|
4968
4969
|
|
|
4970
|
+
// src/commands/sessions/daemon/recordPromptJournal.ts
|
|
4971
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync5 } from "fs";
|
|
4972
|
+
import { dirname as dirname8 } from "path";
|
|
4973
|
+
function recordPromptJournal(entry) {
|
|
4974
|
+
const line = JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), ...entry });
|
|
4975
|
+
try {
|
|
4976
|
+
mkdirSync5(dirname8(daemonPaths.promptJournal), { recursive: true });
|
|
4977
|
+
appendFileSync2(daemonPaths.promptJournal, `${line}
|
|
4978
|
+
`);
|
|
4979
|
+
} catch {
|
|
4980
|
+
}
|
|
4981
|
+
}
|
|
4982
|
+
|
|
4969
4983
|
// src/commands/sessions/daemon/requestDaemonReply.ts
|
|
4970
4984
|
import { createInterface as createInterface3 } from "readline";
|
|
4971
4985
|
var QUERY_TIMEOUT_MS = 3e3;
|
|
@@ -5045,6 +5059,14 @@ var docsFeedbackSchema = z7.object({
|
|
|
5045
5059
|
|
|
5046
5060
|
// src/commands/sessions/web/docsFeedback/docsFeedback.ts
|
|
5047
5061
|
var DOCS_DIR = "docs/guide/";
|
|
5062
|
+
function respond(res, text18, status2, message3) {
|
|
5063
|
+
recordPromptJournal({
|
|
5064
|
+
event: "outcome",
|
|
5065
|
+
text: text18,
|
|
5066
|
+
message: `${status2} ${message3}`
|
|
5067
|
+
});
|
|
5068
|
+
respondJson(res, status2, status2 === 200 ? { message: message3 } : { error: message3 });
|
|
5069
|
+
}
|
|
5048
5070
|
async function docsFeedback(req, res) {
|
|
5049
5071
|
allowExtensionOrigin(req, res);
|
|
5050
5072
|
const parsed = docsFeedbackSchema.safeParse(
|
|
@@ -5054,24 +5076,19 @@ async function docsFeedback(req, res) {
|
|
|
5054
5076
|
respondJson(res, 400, { error: "Invalid docs feedback body" });
|
|
5055
5077
|
return;
|
|
5056
5078
|
}
|
|
5079
|
+
const text18 = docsFeedbackPrompt(parsed.data);
|
|
5080
|
+
recordPromptJournal({ event: "received", text: text18 });
|
|
5057
5081
|
const reply2 = await requestDaemonReply(
|
|
5058
5082
|
{
|
|
5059
5083
|
type: "type-prompt-to-writer",
|
|
5060
5084
|
file: parsed.data.source,
|
|
5061
5085
|
within: DOCS_DIR,
|
|
5062
|
-
text:
|
|
5086
|
+
text: text18
|
|
5063
5087
|
},
|
|
5064
5088
|
"type-prompt-result"
|
|
5065
5089
|
);
|
|
5066
|
-
if (!reply2)
|
|
5067
|
-
|
|
5068
|
-
return;
|
|
5069
|
-
}
|
|
5070
|
-
if (!reply2.ok) {
|
|
5071
|
-
respondJson(res, 404, { error: reply2.message });
|
|
5072
|
-
return;
|
|
5073
|
-
}
|
|
5074
|
-
respondJson(res, 200, { message: reply2.message });
|
|
5090
|
+
if (!reply2) respond(res, text18, 504, "assist daemon did not answer");
|
|
5091
|
+
else respond(res, text18, reply2.ok ? 200 : 404, reply2.message);
|
|
5075
5092
|
}
|
|
5076
5093
|
|
|
5077
5094
|
// src/commands/sessions/web/fileContent.ts
|
|
@@ -6695,7 +6712,7 @@ function getHtml() {
|
|
|
6695
6712
|
}
|
|
6696
6713
|
|
|
6697
6714
|
// src/shared/resolveRunConfigs.ts
|
|
6698
|
-
import { dirname as
|
|
6715
|
+
import { dirname as dirname9, relative as relative2, resolve as resolve7 } from "path";
|
|
6699
6716
|
|
|
6700
6717
|
// src/shared/assertNoDuplicateRunNames.ts
|
|
6701
6718
|
function findDuplicateNames(configs) {
|
|
@@ -6766,7 +6783,7 @@ function loadAndResolveLink(linkPath, configDir, ctx) {
|
|
|
6766
6783
|
const entries = loadLinkedEntries(configPath, ctx.visited);
|
|
6767
6784
|
const defaultCwd = relativeToRoot(ctx, resolve7(configDir, linkPath));
|
|
6768
6785
|
return setDefaultCwd(
|
|
6769
|
-
resolveRecursive(entries,
|
|
6786
|
+
resolveRecursive(entries, dirname9(configPath), ctx),
|
|
6770
6787
|
defaultCwd
|
|
6771
6788
|
);
|
|
6772
6789
|
}
|
|
@@ -6838,10 +6855,10 @@ import { promisify as promisify4 } from "util";
|
|
|
6838
6855
|
|
|
6839
6856
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
6840
6857
|
import { existsSync as existsSync16, readdirSync as readdirSync3, statSync as statSync4 } from "fs";
|
|
6841
|
-
import { basename as basename6, dirname as
|
|
6858
|
+
import { basename as basename6, dirname as dirname10, join as join20 } from "path";
|
|
6842
6859
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
6843
6860
|
const branchKeyPath = join20(repoReviewsDir, `${branch2}-`);
|
|
6844
|
-
const parent =
|
|
6861
|
+
const parent = dirname10(branchKeyPath);
|
|
6845
6862
|
const branchPrefix = basename6(branchKeyPath);
|
|
6846
6863
|
if (!existsSync16(parent)) return null;
|
|
6847
6864
|
const synthesisFiles = readdirSync3(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join20(parent, name, "synthesis.md")).filter((path109) => existsSync16(path109)).map((path109) => ({ path: path109, mtime: statSync4(path109).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
@@ -9703,12 +9720,12 @@ function expandEnv(env) {
|
|
|
9703
9720
|
// src/commands/run/resolveCommand.ts
|
|
9704
9721
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
9705
9722
|
import { existsSync as existsSync19 } from "fs";
|
|
9706
|
-
import { dirname as
|
|
9723
|
+
import { dirname as dirname11, join as join22, resolve as resolve10 } from "path";
|
|
9707
9724
|
function resolveCommand(command) {
|
|
9708
9725
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
9709
9726
|
try {
|
|
9710
9727
|
const gitPath = execFileSync3("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
9711
|
-
const gitRoot = resolve10(
|
|
9728
|
+
const gitRoot = resolve10(dirname11(gitPath), "..");
|
|
9712
9729
|
const gitBash = join22(gitRoot, "bin", "bash.exe");
|
|
9713
9730
|
if (existsSync19(gitBash)) return gitBash;
|
|
9714
9731
|
} catch {
|
|
@@ -10568,11 +10585,11 @@ async function saveRepoConfig(orm, repoKey, config) {
|
|
|
10568
10585
|
}
|
|
10569
10586
|
|
|
10570
10587
|
// src/shared/writeRepoConfigCache.ts
|
|
10571
|
-
import { mkdirSync as
|
|
10572
|
-
import { dirname as
|
|
10588
|
+
import { mkdirSync as mkdirSync6, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
10589
|
+
import { dirname as dirname12 } from "path";
|
|
10573
10590
|
function writeRepoConfigCache(repos2) {
|
|
10574
10591
|
const path109 = repoConfigCachePath();
|
|
10575
|
-
|
|
10592
|
+
mkdirSync6(dirname12(path109), { recursive: true });
|
|
10576
10593
|
const cache6 = {
|
|
10577
10594
|
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10578
10595
|
repos: repos2
|
|
@@ -11207,7 +11224,7 @@ import { readFile as readFile2, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
11207
11224
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
11208
11225
|
import { execFile as execFile9 } from "child_process";
|
|
11209
11226
|
import { existsSync as existsSync22 } from "fs";
|
|
11210
|
-
import { dirname as
|
|
11227
|
+
import { dirname as dirname14, join as join27 } from "path";
|
|
11211
11228
|
import { promisify as promisify10 } from "util";
|
|
11212
11229
|
var execFileAsync9 = promisify10(execFile9);
|
|
11213
11230
|
var TIMEOUT_MS = 15e3;
|
|
@@ -11216,7 +11233,7 @@ function findOxfmtScript(root2) {
|
|
|
11216
11233
|
for (; ; ) {
|
|
11217
11234
|
const candidate = join27(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
11218
11235
|
if (existsSync22(candidate)) return candidate;
|
|
11219
|
-
const parent =
|
|
11236
|
+
const parent = dirname14(dir);
|
|
11220
11237
|
if (parent === dir) return void 0;
|
|
11221
11238
|
dir = parent;
|
|
11222
11239
|
}
|
|
@@ -11287,10 +11304,10 @@ async function writeFileContent(req, res) {
|
|
|
11287
11304
|
// src/shared/createBundleHandler.ts
|
|
11288
11305
|
import { createHash as createHash2 } from "crypto";
|
|
11289
11306
|
import { readFileSync as readFileSync10, statSync as statSync6 } from "fs";
|
|
11290
|
-
import { dirname as
|
|
11307
|
+
import { dirname as dirname15, join as join28 } from "path";
|
|
11291
11308
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
11292
11309
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
11293
|
-
const file = join28(
|
|
11310
|
+
const file = join28(dirname15(fileURLToPath2(importMetaUrl)), bundlePath);
|
|
11294
11311
|
let cache6;
|
|
11295
11312
|
return (req, res) => {
|
|
11296
11313
|
const mtimeMs = statSync6(file).mtimeMs;
|
|
@@ -13188,7 +13205,7 @@ function initPackageJson(name) {
|
|
|
13188
13205
|
}
|
|
13189
13206
|
|
|
13190
13207
|
// src/commands/new/registerNew/newCli/writeCliTemplate.ts
|
|
13191
|
-
import { mkdirSync as
|
|
13208
|
+
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync15 } from "fs";
|
|
13192
13209
|
function writeCliTemplate(name) {
|
|
13193
13210
|
console.log("Writing tsconfig.json...");
|
|
13194
13211
|
writeFileSync15(
|
|
@@ -13229,7 +13246,7 @@ export default defineConfig({
|
|
|
13229
13246
|
`
|
|
13230
13247
|
);
|
|
13231
13248
|
console.log("Writing src/index.ts...");
|
|
13232
|
-
|
|
13249
|
+
mkdirSync8("src", { recursive: true });
|
|
13233
13250
|
writeFileSync15(
|
|
13234
13251
|
"src/index.ts",
|
|
13235
13252
|
`#!/usr/bin/env node
|
|
@@ -13266,12 +13283,12 @@ import chalk35 from "chalk";
|
|
|
13266
13283
|
import enquirer3 from "enquirer";
|
|
13267
13284
|
|
|
13268
13285
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
13269
|
-
import { existsSync as existsSync32, mkdirSync as
|
|
13270
|
-
import { dirname as
|
|
13286
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
13287
|
+
import { dirname as dirname23, join as join36 } from "path";
|
|
13271
13288
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
13272
13289
|
import chalk34 from "chalk";
|
|
13273
13290
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
13274
|
-
var __dirname3 =
|
|
13291
|
+
var __dirname3 = dirname23(fileURLToPath3(import.meta.url));
|
|
13275
13292
|
function getExistingSiteId() {
|
|
13276
13293
|
if (!existsSync32(WORKFLOW_PATH)) {
|
|
13277
13294
|
return null;
|
|
@@ -13289,7 +13306,7 @@ async function updateWorkflow(siteId) {
|
|
|
13289
13306
|
const newContent = getTemplateContent(siteId);
|
|
13290
13307
|
const workflowDir = ".github/workflows";
|
|
13291
13308
|
if (!existsSync32(workflowDir)) {
|
|
13292
|
-
|
|
13309
|
+
mkdirSync9(workflowDir, { recursive: true });
|
|
13293
13310
|
}
|
|
13294
13311
|
if (existsSync32(WORKFLOW_PATH)) {
|
|
13295
13312
|
const oldContent = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
@@ -13592,14 +13609,14 @@ import { basename as basename10, join as join38 } from "path";
|
|
|
13592
13609
|
|
|
13593
13610
|
// src/commands/advise/adviceDir.ts
|
|
13594
13611
|
import { existsSync as existsSync34 } from "fs";
|
|
13595
|
-
import { dirname as
|
|
13612
|
+
import { dirname as dirname24, join as join37 } from "path";
|
|
13596
13613
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
13597
13614
|
function adviceDir() {
|
|
13598
|
-
let current =
|
|
13599
|
-
while (current !==
|
|
13615
|
+
let current = dirname24(fileURLToPath4(import.meta.url));
|
|
13616
|
+
while (current !== dirname24(current)) {
|
|
13600
13617
|
const candidate = join37(current, "claude", "advice");
|
|
13601
13618
|
if (existsSync34(candidate)) return candidate;
|
|
13602
|
-
current =
|
|
13619
|
+
current = dirname24(current);
|
|
13603
13620
|
}
|
|
13604
13621
|
throw new Error("Could not locate the shipped claude/advice directory");
|
|
13605
13622
|
}
|
|
@@ -16246,7 +16263,7 @@ function hasLocalChanges() {
|
|
|
16246
16263
|
// src/commands/backlog/acquireLock.ts
|
|
16247
16264
|
import {
|
|
16248
16265
|
existsSync as existsSync38,
|
|
16249
|
-
mkdirSync as
|
|
16266
|
+
mkdirSync as mkdirSync10,
|
|
16250
16267
|
readFileSync as readFileSync24,
|
|
16251
16268
|
unlinkSync as unlinkSync4,
|
|
16252
16269
|
writeFileSync as writeFileSync19
|
|
@@ -16318,7 +16335,7 @@ function isLockedByOther(itemId2) {
|
|
|
16318
16335
|
return foreignLockHolder(itemId2) !== null;
|
|
16319
16336
|
}
|
|
16320
16337
|
function acquireLock(itemId2) {
|
|
16321
|
-
|
|
16338
|
+
mkdirSync10(getLocksDir(), { recursive: true });
|
|
16322
16339
|
writeFileSync19(
|
|
16323
16340
|
getLockPath(itemId2),
|
|
16324
16341
|
JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
@@ -16361,8 +16378,8 @@ function findUnblockedTodos(items2) {
|
|
|
16361
16378
|
import chalk77 from "chalk";
|
|
16362
16379
|
|
|
16363
16380
|
// src/commands/sessions/daemon/ensureHooksSettings.ts
|
|
16364
|
-
import { mkdirSync as
|
|
16365
|
-
import { dirname as
|
|
16381
|
+
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync20 } from "fs";
|
|
16382
|
+
import { dirname as dirname25 } from "path";
|
|
16366
16383
|
var SET_STATUS = "assist sessions set-status";
|
|
16367
16384
|
function running(source) {
|
|
16368
16385
|
return `${SET_STATUS} running --source ${source}`;
|
|
@@ -16394,7 +16411,7 @@ var hooksSettings = {
|
|
|
16394
16411
|
};
|
|
16395
16412
|
function ensureHooksSettings() {
|
|
16396
16413
|
const path109 = daemonPaths.hooksSettings;
|
|
16397
|
-
|
|
16414
|
+
mkdirSync11(dirname25(path109), { recursive: true });
|
|
16398
16415
|
writeFileSync20(path109, JSON.stringify(hooksSettings, null, 2));
|
|
16399
16416
|
return path109;
|
|
16400
16417
|
}
|
|
@@ -16775,7 +16792,7 @@ function reportDuplicateRun(itemId2, holder) {
|
|
|
16775
16792
|
}
|
|
16776
16793
|
|
|
16777
16794
|
// src/commands/backlog/consumePause.ts
|
|
16778
|
-
import { existsSync as existsSync39, mkdirSync as
|
|
16795
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync12, unlinkSync as unlinkSync5, writeFileSync as writeFileSync21 } from "fs";
|
|
16779
16796
|
import { homedir as homedir15 } from "os";
|
|
16780
16797
|
import { join as join47 } from "path";
|
|
16781
16798
|
function getControlsDir() {
|
|
@@ -16785,7 +16802,7 @@ function getPausePath(itemId2) {
|
|
|
16785
16802
|
return join47(getControlsDir(), `pause-${itemId2}.json`);
|
|
16786
16803
|
}
|
|
16787
16804
|
function requestPause(itemId2) {
|
|
16788
|
-
|
|
16805
|
+
mkdirSync12(getControlsDir(), { recursive: true });
|
|
16789
16806
|
writeFileSync21(
|
|
16790
16807
|
getPausePath(itemId2),
|
|
16791
16808
|
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
@@ -17217,9 +17234,9 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
17217
17234
|
}
|
|
17218
17235
|
|
|
17219
17236
|
// src/shared/emitActivity.ts
|
|
17220
|
-
import { mkdirSync as
|
|
17237
|
+
import { mkdirSync as mkdirSync13, readFileSync as readFileSync26, rmSync as rmSync4, writeFileSync as writeFileSync22 } from "fs";
|
|
17221
17238
|
import { homedir as homedir16 } from "os";
|
|
17222
|
-
import { dirname as
|
|
17239
|
+
import { dirname as dirname26, join as join48 } from "path";
|
|
17223
17240
|
import { z as z9 } from "zod";
|
|
17224
17241
|
var activitySchema = z9.object({
|
|
17225
17242
|
kind: z9.enum(["command", "backlog"]),
|
|
@@ -17241,7 +17258,7 @@ function emitActivity(activity2) {
|
|
|
17241
17258
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
17242
17259
|
if (!sessionId) return;
|
|
17243
17260
|
const path109 = activityPath(sessionId);
|
|
17244
|
-
|
|
17261
|
+
mkdirSync13(dirname26(path109), { recursive: true });
|
|
17245
17262
|
writeFileSync22(path109, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
17246
17263
|
}
|
|
17247
17264
|
function readActivity(path109) {
|
|
@@ -17257,7 +17274,7 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
17257
17274
|
return;
|
|
17258
17275
|
}
|
|
17259
17276
|
const path109 = activityPath(sessionId);
|
|
17260
|
-
|
|
17277
|
+
mkdirSync13(dirname26(path109), { recursive: true });
|
|
17261
17278
|
writeFileSync22(path109, JSON.stringify(activity2));
|
|
17262
17279
|
}
|
|
17263
17280
|
function removeActivity(sessionId) {
|
|
@@ -20103,10 +20120,10 @@ function extractGraphqlQuery(args) {
|
|
|
20103
20120
|
|
|
20104
20121
|
// src/shared/loadCliReads.ts
|
|
20105
20122
|
import { existsSync as existsSync43, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
20106
|
-
import { dirname as
|
|
20123
|
+
import { dirname as dirname27, resolve as resolve16 } from "path";
|
|
20107
20124
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
20108
20125
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
20109
|
-
var __dirname4 =
|
|
20126
|
+
var __dirname4 = dirname27(__filename3);
|
|
20110
20127
|
function packageRoot() {
|
|
20111
20128
|
return __dirname4;
|
|
20112
20129
|
}
|
|
@@ -20387,7 +20404,7 @@ function decideCommand(toolName, rawCommand) {
|
|
|
20387
20404
|
}
|
|
20388
20405
|
|
|
20389
20406
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
20390
|
-
import { mkdirSync as
|
|
20407
|
+
import { mkdirSync as mkdirSync14 } from "fs";
|
|
20391
20408
|
import { homedir as homedir18 } from "os";
|
|
20392
20409
|
import { join as join50 } from "path";
|
|
20393
20410
|
import Database from "better-sqlite3";
|
|
@@ -20411,7 +20428,7 @@ function initSchema(db) {
|
|
|
20411
20428
|
function openPromptsDb(dir) {
|
|
20412
20429
|
if (_db) return _db;
|
|
20413
20430
|
const dbDir = dir ?? getDbDir();
|
|
20414
|
-
|
|
20431
|
+
mkdirSync14(dbDir, { recursive: true });
|
|
20415
20432
|
const db = new Database(join50(dbDir, "assist.db"));
|
|
20416
20433
|
db.pragma("journal_mode = WAL");
|
|
20417
20434
|
initSchema(db);
|
|
@@ -20531,7 +20548,7 @@ ${reasons.join("\n")}`);
|
|
|
20531
20548
|
}
|
|
20532
20549
|
|
|
20533
20550
|
// src/commands/permitCliReads.ts
|
|
20534
|
-
import { existsSync as existsSync45, mkdirSync as
|
|
20551
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync15, readFileSync as readFileSync30, writeFileSync as writeFileSync24 } from "fs";
|
|
20535
20552
|
import { homedir as homedir19 } from "os";
|
|
20536
20553
|
import { join as join51 } from "path";
|
|
20537
20554
|
|
|
@@ -20805,7 +20822,7 @@ function readCache(cli) {
|
|
|
20805
20822
|
}
|
|
20806
20823
|
function writeCache(cli, output) {
|
|
20807
20824
|
const dir = join51(homedir19(), ".assist");
|
|
20808
|
-
|
|
20825
|
+
mkdirSync15(dir, { recursive: true });
|
|
20809
20826
|
writeFileSync24(logPath(cli), output);
|
|
20810
20827
|
}
|
|
20811
20828
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
@@ -21081,7 +21098,7 @@ function validateCommentText(raw, isHash = false) {
|
|
|
21081
21098
|
}
|
|
21082
21099
|
|
|
21083
21100
|
// src/commands/codeComment/issuePin.ts
|
|
21084
|
-
import { mkdirSync as
|
|
21101
|
+
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync26 } from "fs";
|
|
21085
21102
|
import { randomInt } from "crypto";
|
|
21086
21103
|
|
|
21087
21104
|
// src/commands/notify/showNotification.ts
|
|
@@ -21142,7 +21159,7 @@ function showNotification(options2) {
|
|
|
21142
21159
|
// src/commands/codeComment/issuePin.ts
|
|
21143
21160
|
function issuePin(file, lineNumber, text18) {
|
|
21144
21161
|
const pin2 = generatePin();
|
|
21145
|
-
|
|
21162
|
+
mkdirSync16(getRestrictedDir(), { recursive: true });
|
|
21146
21163
|
sweepRestrictedDir();
|
|
21147
21164
|
writeFileSync26(
|
|
21148
21165
|
getPinStatePath(pin2),
|
|
@@ -22772,9 +22789,9 @@ import chalk142 from "chalk";
|
|
|
22772
22789
|
|
|
22773
22790
|
// src/commands/extension/extensionDir.ts
|
|
22774
22791
|
import { existsSync as existsSync48 } from "fs";
|
|
22775
|
-
import { dirname as
|
|
22792
|
+
import { dirname as dirname28, join as join54 } from "path";
|
|
22776
22793
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22777
|
-
var moduleDir =
|
|
22794
|
+
var moduleDir = dirname28(fileURLToPath6(import.meta.url));
|
|
22778
22795
|
function extensionDir() {
|
|
22779
22796
|
const bundled = join54(moduleDir, "commands", "extension", "extension");
|
|
22780
22797
|
if (existsSync48(bundled)) return bundled;
|
|
@@ -23195,7 +23212,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
23195
23212
|
}
|
|
23196
23213
|
|
|
23197
23214
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
23198
|
-
import { mkdirSync as
|
|
23215
|
+
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync28 } from "fs";
|
|
23199
23216
|
import { randomInt as randomInt2 } from "crypto";
|
|
23200
23217
|
import chalk149 from "chalk";
|
|
23201
23218
|
|
|
@@ -23208,7 +23225,7 @@ function nextMigrationId() {
|
|
|
23208
23225
|
function dbMigrationUnlock() {
|
|
23209
23226
|
const migrationId = nextMigrationId();
|
|
23210
23227
|
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
23211
|
-
|
|
23228
|
+
mkdirSync17(getRestrictedDir(), { recursive: true });
|
|
23212
23229
|
sweepRestrictedDir();
|
|
23213
23230
|
writeFileSync28(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
23214
23231
|
console.error(
|
|
@@ -24196,7 +24213,7 @@ import chalk164 from "chalk";
|
|
|
24196
24213
|
|
|
24197
24214
|
// src/commands/dotnet/findSolution.ts
|
|
24198
24215
|
import { readdirSync as readdirSync11 } from "fs";
|
|
24199
|
-
import { dirname as
|
|
24216
|
+
import { dirname as dirname29, join as join68 } from "path";
|
|
24200
24217
|
import chalk163 from "chalk";
|
|
24201
24218
|
function findSlnInDir(dir) {
|
|
24202
24219
|
try {
|
|
@@ -24221,7 +24238,7 @@ function findSolution() {
|
|
|
24221
24238
|
process.exit(1);
|
|
24222
24239
|
}
|
|
24223
24240
|
if (current === ceiling) break;
|
|
24224
|
-
current =
|
|
24241
|
+
current = dirname29(current);
|
|
24225
24242
|
}
|
|
24226
24243
|
console.error(chalk163.red("No .sln file found between cwd and repo root"));
|
|
24227
24244
|
process.exit(1);
|
|
@@ -26495,10 +26512,10 @@ import { basename as basename18 } from "path";
|
|
|
26495
26512
|
|
|
26496
26513
|
// src/shared/removeStagedAttachments.ts
|
|
26497
26514
|
import { rmSync as rmSync5 } from "fs";
|
|
26498
|
-
import { dirname as
|
|
26515
|
+
import { dirname as dirname30 } from "path";
|
|
26499
26516
|
function removeStagedAttachments(attachments) {
|
|
26500
26517
|
for (const { path: path109 } of attachments) {
|
|
26501
|
-
const dir =
|
|
26518
|
+
const dir = dirname30(path109);
|
|
26502
26519
|
if (!isStagedAttachmentPath(dir)) continue;
|
|
26503
26520
|
rmSync5(dir, { recursive: true, force: true });
|
|
26504
26521
|
}
|
|
@@ -26665,7 +26682,7 @@ function slugFromUrl(url) {
|
|
|
26665
26682
|
}
|
|
26666
26683
|
|
|
26667
26684
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
26668
|
-
import { mkdirSync as
|
|
26685
|
+
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync32 } from "fs";
|
|
26669
26686
|
|
|
26670
26687
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
26671
26688
|
import { join as join70 } from "path";
|
|
@@ -26682,7 +26699,7 @@ function issueWorkingFile(slug2, number) {
|
|
|
26682
26699
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
26683
26700
|
function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
|
|
26684
26701
|
const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
26685
|
-
|
|
26702
|
+
mkdirSync18(dir, { recursive: true });
|
|
26686
26703
|
writeFileSync32(bodyPath, body);
|
|
26687
26704
|
writeFileSync32(
|
|
26688
26705
|
metaPath,
|
|
@@ -27363,7 +27380,7 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
27363
27380
|
|
|
27364
27381
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
27365
27382
|
import { existsSync as existsSync59 } from "fs";
|
|
27366
|
-
import { basename as basename20, dirname as
|
|
27383
|
+
import { basename as basename20, dirname as dirname31 } from "path";
|
|
27367
27384
|
|
|
27368
27385
|
// src/commands/watch/fetchQuietly.ts
|
|
27369
27386
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
@@ -27409,7 +27426,7 @@ function cloneTrunkBranch(clone) {
|
|
|
27409
27426
|
|
|
27410
27427
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
27411
27428
|
function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
27412
|
-
const base = strategy.root ? expandTilde(strategy.root) :
|
|
27429
|
+
const base = strategy.root ? expandTilde(strategy.root) : dirname31(clone);
|
|
27413
27430
|
const registered = new Set(listWorktreePaths(clone));
|
|
27414
27431
|
const branches = new Set(listLocalBranches(clone));
|
|
27415
27432
|
const isTaken = (candidate) => registered.has(candidate) || existsSync59(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
|
|
@@ -27626,6 +27643,7 @@ var persistedSessionSchema = z11.object({
|
|
|
27626
27643
|
autoApprove: z11.boolean().optional(),
|
|
27627
27644
|
reviewStarted: z11.boolean().optional(),
|
|
27628
27645
|
launchedFrom: z11.string().optional(),
|
|
27646
|
+
pendingPrompts: z11.array(z11.string()).optional(),
|
|
27629
27647
|
interrupted: z11.object({ reason: z11.string(), at: z11.number() }).optional(),
|
|
27630
27648
|
awaitingSeed: z11.boolean().optional(),
|
|
27631
27649
|
undurable: z11.object({ reason: z11.string(), removesTree: z11.boolean().optional() }).optional()
|
|
@@ -27660,6 +27678,7 @@ function toPersistedSession(session) {
|
|
|
27660
27678
|
autoApprove: session.autoApprove,
|
|
27661
27679
|
reviewStarted: session.reviewStarted,
|
|
27662
27680
|
launchedFrom: session.launchedFrom,
|
|
27681
|
+
pendingPrompts: session.pendingPrompts,
|
|
27663
27682
|
interrupted: session.interrupted,
|
|
27664
27683
|
undurable: session.undurable,
|
|
27665
27684
|
awaitingSeed: session.awaitingSeed
|
|
@@ -27728,8 +27747,8 @@ function persistedTreeRoots() {
|
|
|
27728
27747
|
}
|
|
27729
27748
|
|
|
27730
27749
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
27731
|
-
import { copyFileSync, existsSync as existsSync62, mkdirSync as
|
|
27732
|
-
import { dirname as
|
|
27750
|
+
import { copyFileSync, existsSync as existsSync62, mkdirSync as mkdirSync19 } from "fs";
|
|
27751
|
+
import { dirname as dirname32, join as join73 } from "path";
|
|
27733
27752
|
|
|
27734
27753
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
27735
27754
|
import { resolve as resolve18 } from "path";
|
|
@@ -27910,7 +27929,7 @@ function copyConfigFiles(worktreePath, clone, copy) {
|
|
|
27910
27929
|
if (!existsSync62(src)) continue;
|
|
27911
27930
|
const dest = join73(worktreePath, rel);
|
|
27912
27931
|
try {
|
|
27913
|
-
|
|
27932
|
+
mkdirSync19(dirname32(dest), { recursive: true });
|
|
27914
27933
|
copyFileSync(src, dest);
|
|
27915
27934
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
27916
27935
|
} catch (error) {
|
|
@@ -28254,7 +28273,7 @@ function registerLitellm(program) {
|
|
|
28254
28273
|
}
|
|
28255
28274
|
|
|
28256
28275
|
// src/commands/mermaidExport.ts
|
|
28257
|
-
import { mkdirSync as
|
|
28276
|
+
import { mkdirSync as mkdirSync20, readdirSync as readdirSync12 } from "fs";
|
|
28258
28277
|
import { resolve as resolve20 } from "path";
|
|
28259
28278
|
import chalk180 from "chalk";
|
|
28260
28279
|
|
|
@@ -28323,7 +28342,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
28323
28342
|
async function mermaidExport(file, options2 = {}) {
|
|
28324
28343
|
const { mermaid } = loadConfig();
|
|
28325
28344
|
const outDir = resolve20(process.cwd(), options2.out ?? ".");
|
|
28326
|
-
|
|
28345
|
+
mkdirSync20(outDir, { recursive: true });
|
|
28327
28346
|
if (options2.index !== void 0) {
|
|
28328
28347
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
28329
28348
|
console.error(
|
|
@@ -28418,8 +28437,8 @@ function boardSource(raw, anchorId, options2) {
|
|
|
28418
28437
|
import { stringify as stringify2 } from "yaml";
|
|
28419
28438
|
|
|
28420
28439
|
// src/commands/miro/writeExtract.ts
|
|
28421
|
-
import { mkdirSync as
|
|
28422
|
-
import { dirname as
|
|
28440
|
+
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync34 } from "fs";
|
|
28441
|
+
import { dirname as dirname33 } from "path";
|
|
28423
28442
|
import { stringify } from "yaml";
|
|
28424
28443
|
function headerLines(header) {
|
|
28425
28444
|
const { rect } = header;
|
|
@@ -28432,7 +28451,7 @@ function headerLines(header) {
|
|
|
28432
28451
|
];
|
|
28433
28452
|
}
|
|
28434
28453
|
function writeExtract(file, header, texts) {
|
|
28435
|
-
|
|
28454
|
+
mkdirSync21(dirname33(file), { recursive: true });
|
|
28436
28455
|
writeFileSync34(file, `${headerLines(header).join("\n")}
|
|
28437
28456
|
${stringify(texts)}`);
|
|
28438
28457
|
}
|
|
@@ -28903,7 +28922,7 @@ function registerMiro(program) {
|
|
|
28903
28922
|
// src/commands/netcap/netcap.ts
|
|
28904
28923
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
28905
28924
|
import { createServer as createServer2 } from "http";
|
|
28906
|
-
import { dirname as
|
|
28925
|
+
import { dirname as dirname35 } from "path";
|
|
28907
28926
|
import chalk184 from "chalk";
|
|
28908
28927
|
|
|
28909
28928
|
// src/commands/netcap/corsHeaders.ts
|
|
@@ -28986,9 +29005,9 @@ import { join as join75 } from "path";
|
|
|
28986
29005
|
import chalk183 from "chalk";
|
|
28987
29006
|
|
|
28988
29007
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
28989
|
-
import { dirname as
|
|
29008
|
+
import { dirname as dirname34, join as join74 } from "path";
|
|
28990
29009
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
28991
|
-
var moduleDir2 =
|
|
29010
|
+
var moduleDir2 = dirname34(fileURLToPath7(import.meta.url));
|
|
28992
29011
|
function netcapExtensionDir() {
|
|
28993
29012
|
return join74(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
28994
29013
|
}
|
|
@@ -29066,7 +29085,7 @@ async function netcap(options2) {
|
|
|
29066
29085
|
const port = Number(options2.port);
|
|
29067
29086
|
const outPath = resolveNetcapOutPath(options2.out);
|
|
29068
29087
|
const filter = options2.filter ?? "";
|
|
29069
|
-
await mkdir6(
|
|
29088
|
+
await mkdir6(dirname35(outPath), { recursive: true });
|
|
29070
29089
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
29071
29090
|
let count10 = 0;
|
|
29072
29091
|
const handler = createNetcapHandler({
|
|
@@ -30124,8 +30143,8 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
30124
30143
|
}
|
|
30125
30144
|
|
|
30126
30145
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
30127
|
-
import { mkdirSync as
|
|
30128
|
-
import { dirname as
|
|
30146
|
+
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync36 } from "fs";
|
|
30147
|
+
import { dirname as dirname36 } from "path";
|
|
30129
30148
|
import { stringify as stringify3 } from "yaml";
|
|
30130
30149
|
|
|
30131
30150
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
@@ -30148,7 +30167,7 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
30148
30167
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
30149
30168
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
30150
30169
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30151
|
-
|
|
30170
|
+
mkdirSync22(dirname36(cachePath), { recursive: true });
|
|
30152
30171
|
const cacheData = {
|
|
30153
30172
|
prNumber,
|
|
30154
30173
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -32849,7 +32868,7 @@ async function notify() {
|
|
|
32849
32868
|
|
|
32850
32869
|
// src/commands/screenshot.ts
|
|
32851
32870
|
import { execSync as execSync49 } from "child_process";
|
|
32852
|
-
import { existsSync as existsSync65, mkdirSync as
|
|
32871
|
+
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as writeFileSync37 } from "fs";
|
|
32853
32872
|
import { tmpdir as tmpdir6 } from "os";
|
|
32854
32873
|
import { join as join81, resolve as resolve24 } from "path";
|
|
32855
32874
|
import chalk210 from "chalk";
|
|
@@ -32982,7 +33001,7 @@ Write-Output $OutputPath
|
|
|
32982
33001
|
// src/commands/screenshot.ts
|
|
32983
33002
|
function buildOutputPath(outputDir, processName) {
|
|
32984
33003
|
if (!existsSync65(outputDir)) {
|
|
32985
|
-
|
|
33004
|
+
mkdirSync23(outputDir, { recursive: true });
|
|
32986
33005
|
}
|
|
32987
33006
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
32988
33007
|
return resolve24(outputDir, `${processName}-${timestamp6}.png`);
|
|
@@ -35643,7 +35662,7 @@ function readGlobs(value) {
|
|
|
35643
35662
|
|
|
35644
35663
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
35645
35664
|
import { execFileSync as execFileSync24 } from "child_process";
|
|
35646
|
-
import { dirname as
|
|
35665
|
+
import { dirname as dirname38, extname as extname6 } from "path";
|
|
35647
35666
|
var MAX_DIRECTORIES = 200;
|
|
35648
35667
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
35649
35668
|
function summariseRepoTree(cwd = process.cwd()) {
|
|
@@ -35670,7 +35689,7 @@ function listTrackedFiles(cwd) {
|
|
|
35670
35689
|
function countByDirectory(files) {
|
|
35671
35690
|
const directories = /* @__PURE__ */ new Map();
|
|
35672
35691
|
for (const file of files) {
|
|
35673
|
-
const directory =
|
|
35692
|
+
const directory = dirname38(file) === "." ? "(repo root)" : dirname38(file);
|
|
35674
35693
|
const extensions = directories.get(directory) ?? /* @__PURE__ */ new Map();
|
|
35675
35694
|
const extension2 = extname6(file) === "" ? "(no extension)" : extname6(file);
|
|
35676
35695
|
extensions.set(extension2, (extensions.get(extension2) ?? 0) + 1);
|
|
@@ -36576,10 +36595,10 @@ function clearHighLevelDraft(repo, headRef, headSha) {
|
|
|
36576
36595
|
}
|
|
36577
36596
|
|
|
36578
36597
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
36579
|
-
import { mkdirSync as
|
|
36580
|
-
import { dirname as
|
|
36598
|
+
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync38 } from "fs";
|
|
36599
|
+
import { dirname as dirname39 } from "path";
|
|
36581
36600
|
function writeJsonFile(path109, data) {
|
|
36582
|
-
|
|
36601
|
+
mkdirSync24(dirname39(path109), { recursive: true });
|
|
36583
36602
|
writeFileSync38(path109, `${JSON.stringify(data, null, 2)}
|
|
36584
36603
|
`);
|
|
36585
36604
|
return path109;
|
|
@@ -37068,7 +37087,7 @@ async function runHighLevelReview(number, options2 = {}) {
|
|
|
37068
37087
|
}
|
|
37069
37088
|
|
|
37070
37089
|
// src/commands/review/ci/writeJobSummary.ts
|
|
37071
|
-
import { appendFileSync as
|
|
37090
|
+
import { appendFileSync as appendFileSync3, readFileSync as readFileSync50 } from "fs";
|
|
37072
37091
|
|
|
37073
37092
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
37074
37093
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -37447,7 +37466,7 @@ function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
|
|
|
37447
37466
|
const markdown = readFileSync50(synthesisPath, "utf8");
|
|
37448
37467
|
const { unanchored } = selectPostableFindings(markdown, prInfo);
|
|
37449
37468
|
const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
|
|
37450
|
-
|
|
37469
|
+
appendFileSync3(
|
|
37451
37470
|
summaryPath,
|
|
37452
37471
|
`${buildReviewSummary(markdown, unanchored)}
|
|
37453
37472
|
|
|
@@ -37562,7 +37581,7 @@ function renderEntry(entry, frame) {
|
|
|
37562
37581
|
import { format as format2 } from "util";
|
|
37563
37582
|
|
|
37564
37583
|
// src/commands/review/createReviewLogSink.ts
|
|
37565
|
-
import { appendFileSync as
|
|
37584
|
+
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync25 } from "fs";
|
|
37566
37585
|
import { join as join84 } from "path";
|
|
37567
37586
|
var LOG_FILE = "review.log";
|
|
37568
37587
|
function createReviewLogSink() {
|
|
@@ -37575,11 +37594,11 @@ function createReviewLogSink() {
|
|
|
37575
37594
|
buffered.push(stripped);
|
|
37576
37595
|
return;
|
|
37577
37596
|
}
|
|
37578
|
-
|
|
37597
|
+
appendFileSync4(logPath2, `${stripped}
|
|
37579
37598
|
`);
|
|
37580
37599
|
},
|
|
37581
37600
|
attach(reviewDir) {
|
|
37582
|
-
|
|
37601
|
+
mkdirSync25(reviewDir, { recursive: true });
|
|
37583
37602
|
logPath2 = join84(reviewDir, LOG_FILE);
|
|
37584
37603
|
const lines2 = [
|
|
37585
37604
|
"",
|
|
@@ -37588,7 +37607,7 @@ function createReviewLogSink() {
|
|
|
37588
37607
|
...buffered
|
|
37589
37608
|
];
|
|
37590
37609
|
buffered = [];
|
|
37591
|
-
|
|
37610
|
+
appendFileSync4(logPath2, `${lines2.join("\n")}
|
|
37592
37611
|
`);
|
|
37593
37612
|
}
|
|
37594
37613
|
};
|
|
@@ -38847,14 +38866,14 @@ function fetchExistingComments() {
|
|
|
38847
38866
|
}
|
|
38848
38867
|
|
|
38849
38868
|
// src/commands/review/prepareReviewDir.ts
|
|
38850
|
-
import { existsSync as existsSync69, mkdirSync as
|
|
38869
|
+
import { existsSync as existsSync69, mkdirSync as mkdirSync26, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
|
|
38851
38870
|
function clearReviewFiles(paths) {
|
|
38852
38871
|
for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
38853
38872
|
if (existsSync69(path109)) unlinkSync18(path109);
|
|
38854
38873
|
}
|
|
38855
38874
|
}
|
|
38856
38875
|
function prepareReviewDir(paths, requestBody, force) {
|
|
38857
|
-
|
|
38876
|
+
mkdirSync26(paths.reviewDir, { recursive: true });
|
|
38858
38877
|
if (force) clearReviewFiles(paths);
|
|
38859
38878
|
writeFileSync40(paths.requestPath, requestBody);
|
|
38860
38879
|
}
|
|
@@ -40163,10 +40182,10 @@ function parseSlackThreadRef(value) {
|
|
|
40163
40182
|
}
|
|
40164
40183
|
|
|
40165
40184
|
// src/commands/slack/postSlackMessage.ts
|
|
40166
|
-
import { mkdirSync as
|
|
40185
|
+
import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync44 } from "fs";
|
|
40167
40186
|
|
|
40168
40187
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
40169
|
-
import { mkdirSync as
|
|
40188
|
+
import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync43 } from "fs";
|
|
40170
40189
|
|
|
40171
40190
|
// src/commands/slack/readSlackParts.ts
|
|
40172
40191
|
import { readFileSync as readFileSync57 } from "fs";
|
|
@@ -40229,7 +40248,7 @@ async function previewSlackThreadParts({
|
|
|
40229
40248
|
}) {
|
|
40230
40249
|
const bodies = readSlackParts(partFiles);
|
|
40231
40250
|
const { dir } = slackWorkingFile(channel);
|
|
40232
|
-
|
|
40251
|
+
mkdirSync27(dir, { recursive: true });
|
|
40233
40252
|
const paths = bodies.map((body, index2) => {
|
|
40234
40253
|
const { bodyPath } = slackWorkingFile(channel, index2 + 1);
|
|
40235
40254
|
writeFileSync43(bodyPath, `${body}
|
|
@@ -40283,7 +40302,7 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
40283
40302
|
process.exit(1);
|
|
40284
40303
|
}
|
|
40285
40304
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
40286
|
-
|
|
40305
|
+
mkdirSync28(dir, { recursive: true });
|
|
40287
40306
|
writeFileSync44(bodyPath, `${body}
|
|
40288
40307
|
`);
|
|
40289
40308
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
@@ -41411,7 +41430,7 @@ function list3() {
|
|
|
41411
41430
|
}
|
|
41412
41431
|
|
|
41413
41432
|
// src/commands/transcript/move.ts
|
|
41414
|
-
import { existsSync as existsSync79, mkdirSync as
|
|
41433
|
+
import { existsSync as existsSync79, mkdirSync as mkdirSync34, renameSync as renameSync4, writeFileSync as writeFileSync49 } from "fs";
|
|
41415
41434
|
import { basename as basename28, join as join99 } from "path";
|
|
41416
41435
|
|
|
41417
41436
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
@@ -41423,7 +41442,7 @@ function convertVttToMarkdown(inputPath) {
|
|
|
41423
41442
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
41424
41443
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
41425
41444
|
const processedDir = join99(vttDir, "processed");
|
|
41426
|
-
|
|
41445
|
+
mkdirSync34(processedDir, { recursive: true });
|
|
41427
41446
|
renameSync4(sourcePath, join99(processedDir, filename));
|
|
41428
41447
|
}
|
|
41429
41448
|
function move(file, options2) {
|
|
@@ -41442,7 +41461,7 @@ function move(file, options2) {
|
|
|
41442
41461
|
const base = basename28(filename, ".vtt").replace(/ Transcription$/, "");
|
|
41443
41462
|
const outputName = `${date} ${base}.md`;
|
|
41444
41463
|
const formattedDir = join99(transcriptsDir, client);
|
|
41445
|
-
|
|
41464
|
+
mkdirSync34(formattedDir, { recursive: true });
|
|
41446
41465
|
const formattedPath = join99(formattedDir, outputName);
|
|
41447
41466
|
writeFileSync49(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
41448
41467
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
@@ -43575,7 +43594,7 @@ function link2() {
|
|
|
43575
43594
|
}
|
|
43576
43595
|
|
|
43577
43596
|
// src/commands/run/add.ts
|
|
43578
|
-
import { mkdirSync as
|
|
43597
|
+
import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync52 } from "fs";
|
|
43579
43598
|
import { join as join101 } from "path";
|
|
43580
43599
|
|
|
43581
43600
|
// src/commands/run/editRepoRunList.ts
|
|
@@ -43748,7 +43767,7 @@ function saveProjectRunConfig(entry) {
|
|
|
43748
43767
|
}
|
|
43749
43768
|
function createCommandFile(name) {
|
|
43750
43769
|
const dir = join101(".claude", "commands");
|
|
43751
|
-
|
|
43770
|
+
mkdirSync35(dir, { recursive: true });
|
|
43752
43771
|
const content = `---
|
|
43753
43772
|
description: Run ${name}
|
|
43754
43773
|
---
|
|
@@ -44160,7 +44179,7 @@ function requestDrain(socket, lines2) {
|
|
|
44160
44179
|
}
|
|
44161
44180
|
|
|
44162
44181
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
44163
|
-
import { mkdirSync as
|
|
44182
|
+
import { mkdirSync as mkdirSync40 } from "fs";
|
|
44164
44183
|
|
|
44165
44184
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
44166
44185
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -44716,14 +44735,16 @@ function pasteAndSubmit(sendInput, sessionId, text18) {
|
|
|
44716
44735
|
|
|
44717
44736
|
// src/commands/sessions/daemon/flushPendingPrompts.ts
|
|
44718
44737
|
function flushPendingPrompts(session, write) {
|
|
44719
|
-
if (!session?.pendingPrompts?.length || session.permissionActive)
|
|
44720
|
-
|
|
44738
|
+
if (!session?.pendingPrompts?.length || session.permissionActive)
|
|
44739
|
+
return false;
|
|
44740
|
+
if (session.status === "done" || !session.pty) return false;
|
|
44721
44741
|
const text18 = session.pendingPrompts.join("\n\n");
|
|
44722
44742
|
daemonLog(
|
|
44723
44743
|
`session ${session.id} typed ${session.pendingPrompts.length} queued prompt(s)`
|
|
44724
44744
|
);
|
|
44725
44745
|
session.pendingPrompts = void 0;
|
|
44726
44746
|
pasteAndSubmit(write, session.id, text18);
|
|
44747
|
+
return true;
|
|
44727
44748
|
}
|
|
44728
44749
|
|
|
44729
44750
|
// src/commands/sessions/daemon/typePromptIntoSession.ts
|
|
@@ -44879,10 +44900,14 @@ var SessionIo = class {
|
|
|
44879
44900
|
});
|
|
44880
44901
|
}
|
|
44881
44902
|
typePrompt(id, text18) {
|
|
44882
|
-
|
|
44903
|
+
const result = typePromptIntoSession(
|
|
44904
|
+
this.sessions,
|
|
44883
44905
|
id,
|
|
44884
|
-
|
|
44906
|
+
text18,
|
|
44907
|
+
this.writeAsDaemon
|
|
44885
44908
|
);
|
|
44909
|
+
if ("queued" in result && result.queued) this.notify();
|
|
44910
|
+
return typePromptReply(id, result);
|
|
44886
44911
|
}
|
|
44887
44912
|
async typePromptToLastWriter(target, text18) {
|
|
44888
44913
|
const id = await findDocsSession(this.sessions, target);
|
|
@@ -44894,7 +44919,8 @@ var SessionIo = class {
|
|
|
44894
44919
|
return this.typePrompt(id, text18);
|
|
44895
44920
|
}
|
|
44896
44921
|
flushPendingPrompts(id) {
|
|
44897
|
-
flushPendingPrompts(this.sessions.get(id), this.writeAsDaemon)
|
|
44922
|
+
if (flushPendingPrompts(this.sessions.get(id), this.writeAsDaemon))
|
|
44923
|
+
this.notify();
|
|
44898
44924
|
}
|
|
44899
44925
|
writeAsDaemon = (id, data) => this.write(id, data, {});
|
|
44900
44926
|
resize(id, cols, rows, viewer) {
|
|
@@ -45425,13 +45451,13 @@ function trimWatcherLog(cwd) {
|
|
|
45425
45451
|
}
|
|
45426
45452
|
|
|
45427
45453
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
45428
|
-
import { appendFileSync as
|
|
45429
|
-
import { dirname as
|
|
45454
|
+
import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync36 } from "fs";
|
|
45455
|
+
import { dirname as dirname44 } from "path";
|
|
45430
45456
|
function appendWatcherLog(cwd, data) {
|
|
45431
45457
|
try {
|
|
45432
45458
|
const path109 = watcherLogPath(cwd);
|
|
45433
|
-
|
|
45434
|
-
|
|
45459
|
+
mkdirSync36(dirname44(path109), { recursive: true });
|
|
45460
|
+
appendFileSync5(path109, data);
|
|
45435
45461
|
} catch {
|
|
45436
45462
|
}
|
|
45437
45463
|
}
|
|
@@ -45951,6 +45977,24 @@ function killPtyTree(pty2) {
|
|
|
45951
45977
|
}
|
|
45952
45978
|
}
|
|
45953
45979
|
|
|
45980
|
+
// src/commands/sessions/daemon/reportUndeliveredPrompts.ts
|
|
45981
|
+
function reportUndeliveredPrompts(session, why) {
|
|
45982
|
+
const pending = session.pendingPrompts;
|
|
45983
|
+
if (!pending?.length) return;
|
|
45984
|
+
session.pendingPrompts = void 0;
|
|
45985
|
+
for (const text18 of pending) {
|
|
45986
|
+
daemonLog(
|
|
45987
|
+
`session ${session.id} ${why}; queued prompt undelivered: ${JSON.stringify(text18)}`
|
|
45988
|
+
);
|
|
45989
|
+
recordPromptJournal({
|
|
45990
|
+
event: "undelivered",
|
|
45991
|
+
sessionId: session.id,
|
|
45992
|
+
text: text18,
|
|
45993
|
+
message: why
|
|
45994
|
+
});
|
|
45995
|
+
}
|
|
45996
|
+
}
|
|
45997
|
+
|
|
45954
45998
|
// src/commands/sessions/daemon/worktree/treeUnderClose.ts
|
|
45955
45999
|
function treeUnderClose(session) {
|
|
45956
46000
|
if (session.worktree) return { path: session.worktree.path, removable: true };
|
|
@@ -45979,6 +46023,7 @@ function dismissSession(sessions, id) {
|
|
|
45979
46023
|
s.closeGrace?.cancel();
|
|
45980
46024
|
removeActivity(s.id);
|
|
45981
46025
|
if (s.activity?.itemId != null) releaseLock(s.activity.itemId);
|
|
46026
|
+
reportUndeliveredPrompts(s, "dismissed");
|
|
45982
46027
|
sessions.delete(id);
|
|
45983
46028
|
daemonLog(`session ${id} dismissed (${s.name})`);
|
|
45984
46029
|
if (!s.worktree) return true;
|
|
@@ -46814,8 +46859,8 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
46814
46859
|
}
|
|
46815
46860
|
|
|
46816
46861
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
46817
|
-
import { existsSync as existsSync95, mkdirSync as
|
|
46818
|
-
import { dirname as
|
|
46862
|
+
import { existsSync as existsSync95, mkdirSync as mkdirSync37, watch as watch2 } from "fs";
|
|
46863
|
+
import { dirname as dirname45 } from "path";
|
|
46819
46864
|
|
|
46820
46865
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
46821
46866
|
function applyActivityToSession(session, activity2) {
|
|
@@ -46877,9 +46922,9 @@ var DEBOUNCE_MS2 = 50;
|
|
|
46877
46922
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
46878
46923
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
46879
46924
|
const path109 = activityPath(session.id);
|
|
46880
|
-
const dir =
|
|
46925
|
+
const dir = dirname45(path109);
|
|
46881
46926
|
try {
|
|
46882
|
-
|
|
46927
|
+
mkdirSync37(dir, { recursive: true });
|
|
46883
46928
|
} catch {
|
|
46884
46929
|
return;
|
|
46885
46930
|
}
|
|
@@ -47044,10 +47089,10 @@ function bindCodexSession(session, notify2) {
|
|
|
47044
47089
|
import { watch as watch3 } from "fs";
|
|
47045
47090
|
|
|
47046
47091
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
47047
|
-
import { mkdirSync as
|
|
47092
|
+
import { mkdirSync as mkdirSync38 } from "fs";
|
|
47048
47093
|
function ensureProjectDirExists(dir, sessionId) {
|
|
47049
47094
|
try {
|
|
47050
|
-
|
|
47095
|
+
mkdirSync38(dir, { recursive: true });
|
|
47051
47096
|
return true;
|
|
47052
47097
|
} catch (error) {
|
|
47053
47098
|
daemonLog(
|
|
@@ -47773,6 +47818,15 @@ function endsStreamLife(session, status2, sharedWithOtherAgents) {
|
|
|
47773
47818
|
return false;
|
|
47774
47819
|
}
|
|
47775
47820
|
|
|
47821
|
+
// src/commands/sessions/daemon/SessionInterruption.ts
|
|
47822
|
+
var DAEMON_RESTART = "daemon-restart";
|
|
47823
|
+
function daemonRestartInterruption() {
|
|
47824
|
+
return { reason: DAEMON_RESTART, at: Date.now() };
|
|
47825
|
+
}
|
|
47826
|
+
function killedByDaemonRestart(interrupted) {
|
|
47827
|
+
return interrupted?.reason === DAEMON_RESTART;
|
|
47828
|
+
}
|
|
47829
|
+
|
|
47776
47830
|
// src/commands/sessions/daemon/shouldAutoDismiss.ts
|
|
47777
47831
|
function shouldAutoDismiss(session, exitCode) {
|
|
47778
47832
|
if (session.status !== "done" || exitCode !== 0) {
|
|
@@ -47788,6 +47842,9 @@ function shouldAutoDismiss(session, exitCode) {
|
|
|
47788
47842
|
}
|
|
47789
47843
|
|
|
47790
47844
|
// src/commands/sessions/daemon/finishStatusChange.ts
|
|
47845
|
+
function endsWithoutRestart(session, status2) {
|
|
47846
|
+
return (status2 === "done" || status2 === "error") && !killedByDaemonRestart(session.interrupted);
|
|
47847
|
+
}
|
|
47791
47848
|
function finishStatusChange(session, status2, exitCode, deps2) {
|
|
47792
47849
|
daemonLog(`session ${session.id} status: ${session.status} -> ${status2}`);
|
|
47793
47850
|
void flushPhaseActiveMs(session);
|
|
@@ -47795,6 +47852,8 @@ function finishStatusChange(session, status2, exitCode, deps2) {
|
|
|
47795
47852
|
if (status2 === "waiting")
|
|
47796
47853
|
startTranscriptTitleGeneration(session, deps2.notify);
|
|
47797
47854
|
if (status2 !== "stopped") session.undurable = void 0;
|
|
47855
|
+
if (endsWithoutRestart(session, status2))
|
|
47856
|
+
reportUndeliveredPrompts(session, `ended (${status2})`);
|
|
47798
47857
|
if (shouldAutoDismiss(session, exitCode)) deps2.dismiss(session.id);
|
|
47799
47858
|
else deps2.notify();
|
|
47800
47859
|
}
|
|
@@ -47830,6 +47889,10 @@ function makeStatusChangeHandler(sessions, deps2) {
|
|
|
47830
47889
|
}
|
|
47831
47890
|
|
|
47832
47891
|
// src/commands/sessions/daemon/applySetStatus.ts
|
|
47892
|
+
function opensPrompt(status2, source) {
|
|
47893
|
+
const askUserQuestion = source === "pretool" && status2 === "waiting";
|
|
47894
|
+
return source === "permission" || askUserQuestion;
|
|
47895
|
+
}
|
|
47833
47896
|
function applySetStatus(sessions, id, status2, source, onStatusChange, rebind) {
|
|
47834
47897
|
const session = sessions.get(id);
|
|
47835
47898
|
if (!session) {
|
|
@@ -47845,7 +47908,7 @@ function applySetStatus(sessions, id, status2, source, onStatusChange, rebind) {
|
|
|
47845
47908
|
return;
|
|
47846
47909
|
}
|
|
47847
47910
|
rebind?.(session);
|
|
47848
|
-
if (source
|
|
47911
|
+
if (opensPrompt(status2, source)) session.permissionActive = true;
|
|
47849
47912
|
if (status2 === "running" || source === "stop")
|
|
47850
47913
|
session.permissionActive = false;
|
|
47851
47914
|
onStatusChange(session, status2);
|
|
@@ -48283,7 +48346,8 @@ function restoreBase(id, persisted) {
|
|
|
48283
48346
|
autoAdvance: restoredAutoAdvance(id, persisted),
|
|
48284
48347
|
autoApprove: persisted.autoApprove,
|
|
48285
48348
|
reviewStarted: persisted.reviewStarted,
|
|
48286
|
-
launchedFrom: persisted.launchedFrom
|
|
48349
|
+
launchedFrom: persisted.launchedFrom,
|
|
48350
|
+
pendingPrompts: persisted.pendingPrompts
|
|
48287
48351
|
};
|
|
48288
48352
|
}
|
|
48289
48353
|
|
|
@@ -48575,15 +48639,6 @@ function interruptedBackgroundTasks(persisted) {
|
|
|
48575
48639
|
return unfinishedBackgroundTasks(readTranscriptTailSync(filePath));
|
|
48576
48640
|
}
|
|
48577
48641
|
|
|
48578
|
-
// src/commands/sessions/daemon/SessionInterruption.ts
|
|
48579
|
-
var DAEMON_RESTART = "daemon-restart";
|
|
48580
|
-
function daemonRestartInterruption() {
|
|
48581
|
-
return { reason: DAEMON_RESTART, at: Date.now() };
|
|
48582
|
-
}
|
|
48583
|
-
function killedByDaemonRestart(interrupted) {
|
|
48584
|
-
return interrupted?.reason === DAEMON_RESTART;
|
|
48585
|
-
}
|
|
48586
|
-
|
|
48587
48642
|
// src/commands/sessions/daemon/pendingQuestionPrompt.ts
|
|
48588
48643
|
function pendingQuestionPrompt() {
|
|
48589
48644
|
return "A restart interrupted this conversation while your AskUserQuestion was waiting for an answer. The user never saw it and it is no longer on screen. Ask the same question again with AskUserQuestion.";
|
|
@@ -50184,7 +50239,7 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
50184
50239
|
import { existsSync as existsSync99 } from "fs";
|
|
50185
50240
|
|
|
50186
50241
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
50187
|
-
import { copyFileSync as copyFileSync4, existsSync as existsSync98, mkdirSync as
|
|
50242
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync98, mkdirSync as mkdirSync39 } from "fs";
|
|
50188
50243
|
import { join as join108 } from "path";
|
|
50189
50244
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
50190
50245
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -50207,7 +50262,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
50207
50262
|
return;
|
|
50208
50263
|
}
|
|
50209
50264
|
try {
|
|
50210
|
-
|
|
50265
|
+
mkdirSync39(dir, { recursive: true });
|
|
50211
50266
|
copyFileSync4(source, dest);
|
|
50212
50267
|
daemonLog(
|
|
50213
50268
|
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
@@ -51536,7 +51591,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
51536
51591
|
|
|
51537
51592
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
51538
51593
|
async function runDaemon() {
|
|
51539
|
-
|
|
51594
|
+
mkdirSync40(daemonPaths.dir, { recursive: true });
|
|
51540
51595
|
daemonLog(
|
|
51541
51596
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
51542
51597
|
);
|