@staff0rd/assist 0.1104.0 → 0.1105.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/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +162 -162
- package/dist/index.js +746 -631
- package/package.json +1 -1
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.
|
|
9
|
+
version: "0.1105.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5582,10 +5582,46 @@ function buildSlashCommand(slashCommand, description) {
|
|
|
5582
5582
|
return trimmed ? `/${slashCommand} ${trimmed}` : `/${slashCommand}`;
|
|
5583
5583
|
}
|
|
5584
5584
|
|
|
5585
|
+
// src/shared/harnessAdapters/carryTranscriptToTree.ts
|
|
5586
|
+
import { copyFileSync, existsSync as existsSync16, mkdirSync as mkdirSync4 } from "fs";
|
|
5587
|
+
import { join as join17 } from "path";
|
|
5588
|
+
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
5589
|
+
const dir = projectDirForCwd(toCwd);
|
|
5590
|
+
if (dir === projectDirForCwd(fromCwd)) {
|
|
5591
|
+
daemonLog(
|
|
5592
|
+
`transcript ${claudeSessionId} already lives in ${dir}: resuming in the original worktree path`
|
|
5593
|
+
);
|
|
5594
|
+
return;
|
|
5595
|
+
}
|
|
5596
|
+
const dest = join17(dir, `${claudeSessionId}.jsonl`);
|
|
5597
|
+
if (existsSync16(dest)) {
|
|
5598
|
+
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
5599
|
+
return;
|
|
5600
|
+
}
|
|
5601
|
+
const source = findTranscriptPathSync(fromCwd, claudeSessionId);
|
|
5602
|
+
if (!source) {
|
|
5603
|
+
daemonLog(
|
|
5604
|
+
`transcript ${claudeSessionId} not found under ${projectDirForCwd(fromCwd)}: resuming in ${toCwd} without it`
|
|
5605
|
+
);
|
|
5606
|
+
return;
|
|
5607
|
+
}
|
|
5608
|
+
try {
|
|
5609
|
+
mkdirSync4(dir, { recursive: true });
|
|
5610
|
+
copyFileSync(source, dest);
|
|
5611
|
+
daemonLog(
|
|
5612
|
+
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
5613
|
+
);
|
|
5614
|
+
} catch (error) {
|
|
5615
|
+
daemonLog(
|
|
5616
|
+
`transcript ${claudeSessionId} could not be copied to ${dir}: ${error instanceof Error ? error.message : String(error)}`
|
|
5617
|
+
);
|
|
5618
|
+
}
|
|
5619
|
+
}
|
|
5620
|
+
|
|
5585
5621
|
// src/shared/harnessAdapters/claudeConnectorProbe.ts
|
|
5586
5622
|
import { readFileSync as readFileSync7 } from "fs";
|
|
5587
5623
|
import { homedir as homedir8 } from "os";
|
|
5588
|
-
import { join as
|
|
5624
|
+
import { join as join18 } from "path";
|
|
5589
5625
|
|
|
5590
5626
|
// src/shared/harnessAdapters/unsupported.ts
|
|
5591
5627
|
var supported = { supported: true };
|
|
@@ -5598,7 +5634,7 @@ function knownConnectedConnectors() {
|
|
|
5598
5634
|
const dir = process.env.CLAUDE_CONFIG_DIR ?? homedir8();
|
|
5599
5635
|
try {
|
|
5600
5636
|
const state = JSON.parse(
|
|
5601
|
-
readFileSync7(
|
|
5637
|
+
readFileSync7(join18(dir, ".claude.json"), "utf8")
|
|
5602
5638
|
);
|
|
5603
5639
|
const list7 = state.claudeAiMcpEverConnected;
|
|
5604
5640
|
return Array.isArray(list7) ? list7.filter((name2) => typeof name2 === "string") : void 0;
|
|
@@ -6846,6 +6882,7 @@ var harnessCapabilityDeclarations = {
|
|
|
6846
6882
|
claude: {
|
|
6847
6883
|
"skills.native": supported,
|
|
6848
6884
|
"conversation.resume": supported,
|
|
6885
|
+
"conversation.relocate": supported,
|
|
6849
6886
|
"conversation.preassignId": supported,
|
|
6850
6887
|
"transcript.read": supported,
|
|
6851
6888
|
"oneShot.text": supported,
|
|
@@ -6862,6 +6899,7 @@ var harnessCapabilityDeclarations = {
|
|
|
6862
6899
|
codex: {
|
|
6863
6900
|
"skills.native": supported,
|
|
6864
6901
|
"conversation.resume": supported,
|
|
6902
|
+
"conversation.relocate": supported,
|
|
6865
6903
|
"conversation.preassignId": unsupported(
|
|
6866
6904
|
"Codex assigns its own conversation id when its rollout starts",
|
|
6867
6905
|
"assist binds the Codex conversation id from the rollout after launch"
|
|
@@ -6901,6 +6939,11 @@ var harnessCapabilityDeclarations = {
|
|
|
6901
6939
|
"restart starts a fresh pi conversation; pick Claude or Codex to keep the conversation across restarts",
|
|
6902
6940
|
"a696"
|
|
6903
6941
|
),
|
|
6942
|
+
"conversation.relocate": unsupported(
|
|
6943
|
+
"pi sessions cannot be resumed, so a pi conversation cannot continue in a replacement worktree",
|
|
6944
|
+
"start a fresh session in the replacement worktree; pick Claude or Codex to keep the conversation across worktree replacement",
|
|
6945
|
+
"a696"
|
|
6946
|
+
),
|
|
6904
6947
|
"conversation.preassignId": unsupported(
|
|
6905
6948
|
"pi does not accept a caller-assigned conversation id",
|
|
6906
6949
|
"the session card tracks pi without a conversation id"
|
|
@@ -6964,6 +7007,7 @@ var claudeAdapter = {
|
|
|
6964
7007
|
current: () => process.env.CLAUDE_CODE_SESSION_ID || void 0,
|
|
6965
7008
|
boundId: ({ claudeSessionId }) => claudeSessionId,
|
|
6966
7009
|
toRef: (claudeSessionId, cwd) => ({ cwd, claudeSessionId }),
|
|
7010
|
+
relocate: carryTranscriptToTree,
|
|
6967
7011
|
reader: claudeConversationReader
|
|
6968
7012
|
},
|
|
6969
7013
|
toolOperations: claudeToolOperations,
|
|
@@ -6979,10 +7023,19 @@ var claudeAdapter = {
|
|
|
6979
7023
|
allowEdits: allowEdits ?? true,
|
|
6980
7024
|
resumeSessionId: conversationId
|
|
6981
7025
|
}),
|
|
6982
|
-
interactive: ({
|
|
7026
|
+
interactive: ({
|
|
7027
|
+
sessionId: sessionId2,
|
|
7028
|
+
conversationId,
|
|
7029
|
+
resumeId,
|
|
7030
|
+
prompt,
|
|
7031
|
+
cwd,
|
|
7032
|
+
design,
|
|
7033
|
+
auto
|
|
7034
|
+
}) => spawnClaude({
|
|
6983
7035
|
prompt,
|
|
6984
7036
|
cwd,
|
|
6985
7037
|
sessionId: sessionId2,
|
|
7038
|
+
resumeSessionId: resumeId,
|
|
6986
7039
|
claudeSessionId: conversationId,
|
|
6987
7040
|
design,
|
|
6988
7041
|
auto
|
|
@@ -7101,13 +7154,13 @@ import * as fs4 from "fs";
|
|
|
7101
7154
|
import * as path11 from "path";
|
|
7102
7155
|
|
|
7103
7156
|
// src/commands/sessions/shared/codex/codexSessionsDir.ts
|
|
7104
|
-
import { existsSync as
|
|
7157
|
+
import { existsSync as existsSync17 } from "fs";
|
|
7105
7158
|
import * as path10 from "path";
|
|
7106
7159
|
function codexSessionsDir() {
|
|
7107
7160
|
return path10.join(harnesses.codex.homeDir, "sessions");
|
|
7108
7161
|
}
|
|
7109
7162
|
function hasCodexSessions() {
|
|
7110
|
-
return
|
|
7163
|
+
return existsSync17(codexSessionsDir());
|
|
7111
7164
|
}
|
|
7112
7165
|
|
|
7113
7166
|
// src/commands/sessions/shared/codex/discoverCodexRolloutPaths.ts
|
|
@@ -7251,7 +7304,12 @@ async function readCodexHeadLines(filePath, maxLines = DEFAULT_MAX_LINES) {
|
|
|
7251
7304
|
|
|
7252
7305
|
// src/commands/sessions/shared/codex/resolveCodexSessionId.ts
|
|
7253
7306
|
var META_LINES = 5;
|
|
7254
|
-
async function resolveCodexSessionId(
|
|
7307
|
+
async function resolveCodexSessionId({
|
|
7308
|
+
cwd,
|
|
7309
|
+
launchedAt,
|
|
7310
|
+
sinceMs,
|
|
7311
|
+
claimed
|
|
7312
|
+
}) {
|
|
7255
7313
|
if (!cwd) return null;
|
|
7256
7314
|
const paths = await discoverCodexRolloutPaths();
|
|
7257
7315
|
const touched = await Promise.all(
|
|
@@ -7260,14 +7318,17 @@ async function resolveCodexSessionId(cwd, sinceMs) {
|
|
|
7260
7318
|
const candidates = await Promise.all(
|
|
7261
7319
|
paths.filter((_, index3) => touched[index3]).map((file) => startedIn(file, cwd, sinceMs))
|
|
7262
7320
|
);
|
|
7263
|
-
return
|
|
7321
|
+
return firstUnclaimedRolloutAfterLaunch(
|
|
7322
|
+
candidates.filter(
|
|
7323
|
+
(candidate) => !!candidate && !claimed.has(candidate.sessionId)
|
|
7324
|
+
),
|
|
7325
|
+
launchedAt
|
|
7326
|
+
);
|
|
7264
7327
|
}
|
|
7265
|
-
function
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
best = candidate;
|
|
7270
|
-
return best?.sessionId ?? null;
|
|
7328
|
+
function firstUnclaimedRolloutAfterLaunch(rollouts, launchedAt) {
|
|
7329
|
+
const byStart = [...rollouts].sort((a, b) => a.startedAt - b.startedAt);
|
|
7330
|
+
const afterLaunch = byStart.find((r) => r.startedAt >= launchedAt);
|
|
7331
|
+
return (afterLaunch ?? byStart.at(-1))?.sessionId ?? null;
|
|
7271
7332
|
}
|
|
7272
7333
|
async function startedIn(file, cwd, sinceMs) {
|
|
7273
7334
|
const meta = codexRolloutMeta(await readCodexHeadLines(file, META_LINES));
|
|
@@ -7552,8 +7613,8 @@ var codexConversationReader = {
|
|
|
7552
7613
|
};
|
|
7553
7614
|
|
|
7554
7615
|
// src/shared/readCodexRulePerms.ts
|
|
7555
|
-
import { existsSync as
|
|
7556
|
-
import { join as
|
|
7616
|
+
import { existsSync as existsSync18, readdirSync as readdirSync5, readFileSync as readFileSync8 } from "fs";
|
|
7617
|
+
import { join as join23 } from "path";
|
|
7557
7618
|
|
|
7558
7619
|
// src/shared/readPatternList.ts
|
|
7559
7620
|
function readString(text19, start2) {
|
|
@@ -7631,17 +7692,17 @@ function parseCodexRules(text19) {
|
|
|
7631
7692
|
|
|
7632
7693
|
// src/shared/readCodexRulePerms.ts
|
|
7633
7694
|
function ruleFiles(dir) {
|
|
7634
|
-
if (!
|
|
7695
|
+
if (!existsSync18(dir)) return [];
|
|
7635
7696
|
try {
|
|
7636
|
-
return readdirSync5(dir).filter((name2) => name2.endsWith(".rules")).sort().map((name2) =>
|
|
7697
|
+
return readdirSync5(dir).filter((name2) => name2.endsWith(".rules")).sort().map((name2) => join23(dir, name2));
|
|
7637
7698
|
} catch {
|
|
7638
7699
|
return [];
|
|
7639
7700
|
}
|
|
7640
7701
|
}
|
|
7641
7702
|
function readCodexRulePerms(key) {
|
|
7642
7703
|
const dirs = [
|
|
7643
|
-
|
|
7644
|
-
|
|
7704
|
+
join23(harnesses.codex.homeDir, "rules"),
|
|
7705
|
+
join23(process.cwd(), ".codex", "rules")
|
|
7645
7706
|
];
|
|
7646
7707
|
return dirs.flatMap(ruleFiles).flatMap((file) => {
|
|
7647
7708
|
try {
|
|
@@ -7730,8 +7791,15 @@ async function codexOneShot(prompt, { timeout, effort = "low", cwd }) {
|
|
|
7730
7791
|
return (await run5).stdout;
|
|
7731
7792
|
}
|
|
7732
7793
|
|
|
7794
|
+
// src/shared/harnessAdapters/codexRelocate.ts
|
|
7795
|
+
function codexRelocate(conversationId, fromCwd, toCwd) {
|
|
7796
|
+
daemonLog(
|
|
7797
|
+
`Codex conversation ${conversationId} resumes in ${toCwd} from its rollout, which is stored by id rather than under ${fromCwd}`
|
|
7798
|
+
);
|
|
7799
|
+
}
|
|
7800
|
+
|
|
7733
7801
|
// src/commands/review/runCodexReviewer.ts
|
|
7734
|
-
import { existsSync as
|
|
7802
|
+
import { existsSync as existsSync19, unlinkSync as unlinkSync2 } from "fs";
|
|
7735
7803
|
|
|
7736
7804
|
// src/commands/review/parseCodexUsage.ts
|
|
7737
7805
|
function parseCodexUsage(usage) {
|
|
@@ -7820,7 +7888,7 @@ async function runCodexReviewer(spec) {
|
|
|
7820
7888
|
...override.args.length > 0 ? { env: override.env } : {},
|
|
7821
7889
|
onLine
|
|
7822
7890
|
});
|
|
7823
|
-
if (result.exitCode !== 0 &&
|
|
7891
|
+
if (result.exitCode !== 0 && existsSync19(spec.outputPath)) {
|
|
7824
7892
|
unlinkSync2(spec.outputPath);
|
|
7825
7893
|
}
|
|
7826
7894
|
const finalised = finaliseReviewerRun(
|
|
@@ -7938,6 +8006,7 @@ var codexAdapter = {
|
|
|
7938
8006
|
boundId: ({ harnessSessionId }) => harnessSessionId,
|
|
7939
8007
|
toRef: (harnessSessionId, cwd) => ({ cwd, harnessSessionId }),
|
|
7940
8008
|
discover: resolveCodexSessionId,
|
|
8009
|
+
relocate: codexRelocate,
|
|
7941
8010
|
reader: codexConversationReader
|
|
7942
8011
|
},
|
|
7943
8012
|
toolOperations: codexToolOperations,
|
|
@@ -7949,7 +8018,7 @@ var codexAdapter = {
|
|
|
7949
8018
|
sandbox: sandbox(allowEdits),
|
|
7950
8019
|
resumeSessionId: conversationId
|
|
7951
8020
|
}),
|
|
7952
|
-
interactive: ({ sessionId: sessionId2, prompt, cwd }) => spawnCodex({ prompt, cwd, sessionId: sessionId2 }),
|
|
8021
|
+
interactive: ({ sessionId: sessionId2, resumeId, prompt, cwd }) => spawnCodex({ prompt, cwd, sessionId: sessionId2, resumeSessionId: resumeId }),
|
|
7953
8022
|
oneShot: codexOneShot,
|
|
7954
8023
|
structured: codexStructuredRun,
|
|
7955
8024
|
connectorRun: rejectConnectorRun("Codex"),
|
|
@@ -8036,13 +8105,14 @@ var piAdapter = {
|
|
|
8036
8105
|
locate: () => Promise.resolve(null),
|
|
8037
8106
|
current: () => void 0,
|
|
8038
8107
|
boundId: () => void 0,
|
|
8039
|
-
toRef: (harnessSessionId, cwd) => ({ cwd, harnessSessionId })
|
|
8108
|
+
toRef: (harnessSessionId, cwd) => ({ cwd, harnessSessionId }),
|
|
8109
|
+
relocate: cannotResume
|
|
8040
8110
|
},
|
|
8041
8111
|
toolOperations: piToolOperations,
|
|
8042
8112
|
launchSkill: (skill, args, { cwd }) => spawnPi2(buildSlashCommand(skill, args), { cwd }),
|
|
8043
8113
|
launchPrompt: (prompt, { cwd }) => spawnPi2(prompt, { cwd }),
|
|
8044
8114
|
resume: cannotResume,
|
|
8045
|
-
interactive: ({ sessionId: sessionId2, prompt, cwd }) => spawnPi({ prompt, cwd, sessionId: sessionId2 }),
|
|
8115
|
+
interactive: ({ sessionId: sessionId2, resumeId, prompt, cwd }) => resumeId ? cannotResume() : spawnPi({ prompt, cwd, sessionId: sessionId2 }),
|
|
8046
8116
|
oneShot: noOneShot,
|
|
8047
8117
|
structured: noOneShot,
|
|
8048
8118
|
connectorRun: rejectConnectorRun("pi"),
|
|
@@ -8401,12 +8471,12 @@ async function diffScopes(req, res) {
|
|
|
8401
8471
|
}
|
|
8402
8472
|
|
|
8403
8473
|
// src/commands/sessions/daemon/recordPromptJournal.ts
|
|
8404
|
-
import { appendFileSync as appendFileSync2, mkdirSync as
|
|
8474
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync5 } from "fs";
|
|
8405
8475
|
import { dirname as dirname9 } from "path";
|
|
8406
8476
|
function recordPromptJournal(entry) {
|
|
8407
8477
|
const line = JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), ...entry });
|
|
8408
8478
|
try {
|
|
8409
|
-
|
|
8479
|
+
mkdirSync5(dirname9(daemonPaths.promptJournal), { recursive: true });
|
|
8410
8480
|
appendFileSync2(daemonPaths.promptJournal, `${line}
|
|
8411
8481
|
`);
|
|
8412
8482
|
} catch {
|
|
@@ -8579,11 +8649,11 @@ async function fileContent(req, res) {
|
|
|
8579
8649
|
import { basename as basename7 } from "path";
|
|
8580
8650
|
|
|
8581
8651
|
// src/commands/sessions/web/fromGithub/listClones.ts
|
|
8582
|
-
import { existsSync as
|
|
8583
|
-
import { join as
|
|
8652
|
+
import { existsSync as existsSync20, readdirSync as readdirSync6 } from "fs";
|
|
8653
|
+
import { join as join24 } from "path";
|
|
8584
8654
|
function listClones(baseDir) {
|
|
8585
|
-
if (!
|
|
8586
|
-
return readdirSync6(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
8655
|
+
if (!existsSync20(baseDir)) return [];
|
|
8656
|
+
return readdirSync6(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join24(baseDir, entry.name)).filter((dir) => existsSync20(join24(dir, ".git"))).sort();
|
|
8587
8657
|
}
|
|
8588
8658
|
|
|
8589
8659
|
// src/commands/sessions/web/fromGithub/getClones.ts
|
|
@@ -8742,8 +8812,8 @@ function azureDevopsRepoUrl({ org, project, repo }) {
|
|
|
8742
8812
|
}
|
|
8743
8813
|
|
|
8744
8814
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
8745
|
-
import { existsSync as
|
|
8746
|
-
import { join as
|
|
8815
|
+
import { existsSync as existsSync21, readdirSync as readdirSync7 } from "fs";
|
|
8816
|
+
import { join as join25 } from "path";
|
|
8747
8817
|
|
|
8748
8818
|
// src/shared/azureDevops/parseAzureDevopsRemote.ts
|
|
8749
8819
|
var HTTPS_DEV = /^https?:\/\/(?:[^@/]+@)?dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)$/i;
|
|
@@ -8764,15 +8834,15 @@ function sameAzureDevopsRepo(a, b) {
|
|
|
8764
8834
|
|
|
8765
8835
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
8766
8836
|
function clonesRepo(dir, repo) {
|
|
8767
|
-
if (!
|
|
8837
|
+
if (!existsSync21(join25(dir, ".git"))) return false;
|
|
8768
8838
|
const url = remoteUrl(dir).url;
|
|
8769
8839
|
const remote = url ? parseAzureDevopsRemote(url) : null;
|
|
8770
8840
|
return remote !== null && sameAzureDevopsRepo(remote, repo);
|
|
8771
8841
|
}
|
|
8772
8842
|
function findAzureDevopsClone(repo, baseDir) {
|
|
8773
|
-
if (!
|
|
8774
|
-
const named =
|
|
8775
|
-
const others = readdirSync7(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
8843
|
+
if (!existsSync21(baseDir)) return void 0;
|
|
8844
|
+
const named = join25(baseDir, repo.repo);
|
|
8845
|
+
const others = readdirSync7(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join25(baseDir, entry.name)).filter((dir) => dir !== named).sort();
|
|
8776
8846
|
return [named, ...others].find((dir) => clonesRepo(dir, repo));
|
|
8777
8847
|
}
|
|
8778
8848
|
|
|
@@ -10611,14 +10681,14 @@ function assertNoDuplicateRunNames(configs) {
|
|
|
10611
10681
|
}
|
|
10612
10682
|
|
|
10613
10683
|
// src/shared/findLinkedConfigPath.ts
|
|
10614
|
-
import { existsSync as
|
|
10615
|
-
import { join as
|
|
10684
|
+
import { existsSync as existsSync22 } from "fs";
|
|
10685
|
+
import { join as join26, resolve as resolve5 } from "path";
|
|
10616
10686
|
function findLinkedConfigPath(linkPath, fromDir) {
|
|
10617
10687
|
const resolved = resolve5(fromDir, linkPath);
|
|
10618
|
-
const claudePath =
|
|
10619
|
-
if (
|
|
10620
|
-
const rootPath =
|
|
10621
|
-
if (
|
|
10688
|
+
const claudePath = join26(resolved, ".claude", "assist.yml");
|
|
10689
|
+
if (existsSync22(claudePath)) return claudePath;
|
|
10690
|
+
const rootPath = join26(resolved, "assist.yml");
|
|
10691
|
+
if (existsSync22(rootPath)) return rootPath;
|
|
10622
10692
|
throw new Error(`No assist.yml found in linked project: ${resolved}`);
|
|
10623
10693
|
}
|
|
10624
10694
|
|
|
@@ -10708,18 +10778,18 @@ function handleServerRuns(req, res) {
|
|
|
10708
10778
|
import { execFile as execFile6 } from "child_process";
|
|
10709
10779
|
import { readFileSync as readFileSync9 } from "fs";
|
|
10710
10780
|
import { homedir as homedir10 } from "os";
|
|
10711
|
-
import { basename as basename10, join as
|
|
10781
|
+
import { basename as basename10, join as join28 } from "path";
|
|
10712
10782
|
import { promisify as promisify6 } from "util";
|
|
10713
10783
|
|
|
10714
10784
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
10715
|
-
import { existsSync as
|
|
10716
|
-
import { basename as basename9, dirname as dirname11, join as
|
|
10785
|
+
import { existsSync as existsSync23, readdirSync as readdirSync8, statSync as statSync6 } from "fs";
|
|
10786
|
+
import { basename as basename9, dirname as dirname11, join as join27 } from "path";
|
|
10717
10787
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
10718
|
-
const branchKeyPath =
|
|
10788
|
+
const branchKeyPath = join27(repoReviewsDir, `${branch2}-`);
|
|
10719
10789
|
const parent = dirname11(branchKeyPath);
|
|
10720
10790
|
const branchPrefix = basename9(branchKeyPath);
|
|
10721
|
-
if (!
|
|
10722
|
-
const synthesisFiles = readdirSync8(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) =>
|
|
10791
|
+
if (!existsSync23(parent)) return null;
|
|
10792
|
+
const synthesisFiles = readdirSync8(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) => join27(parent, name2, "synthesis.md")).filter((path110) => existsSync23(path110)).map((path110) => ({ path: path110, mtime: statSync6(path110).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
10723
10793
|
return synthesisFiles[0]?.path ?? null;
|
|
10724
10794
|
}
|
|
10725
10795
|
|
|
@@ -10737,7 +10807,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
10737
10807
|
runGit2(cwd, ["rev-parse", "--show-toplevel"]),
|
|
10738
10808
|
runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
10739
10809
|
]);
|
|
10740
|
-
const repoReviewsDir =
|
|
10810
|
+
const repoReviewsDir = join28(
|
|
10741
10811
|
homedir10(),
|
|
10742
10812
|
".assist",
|
|
10743
10813
|
"reviews",
|
|
@@ -11341,34 +11411,34 @@ function resolveRewindPlan(item) {
|
|
|
11341
11411
|
}
|
|
11342
11412
|
|
|
11343
11413
|
// src/commands/backlog/writeSignal.ts
|
|
11344
|
-
import { mkdirSync as
|
|
11414
|
+
import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
11345
11415
|
import { homedir as homedir12 } from "os";
|
|
11346
|
-
import { dirname as dirname13, join as
|
|
11416
|
+
import { dirname as dirname13, join as join30 } from "path";
|
|
11347
11417
|
import chalk10 from "chalk";
|
|
11348
11418
|
|
|
11349
11419
|
// src/commands/backlog/recordSignalOwner.ts
|
|
11350
11420
|
import {
|
|
11351
|
-
existsSync as
|
|
11352
|
-
mkdirSync as
|
|
11421
|
+
existsSync as existsSync24,
|
|
11422
|
+
mkdirSync as mkdirSync6,
|
|
11353
11423
|
readFileSync as readFileSync10,
|
|
11354
11424
|
rmSync as rmSync3,
|
|
11355
11425
|
writeFileSync as writeFileSync6
|
|
11356
11426
|
} from "fs";
|
|
11357
11427
|
import { homedir as homedir11 } from "os";
|
|
11358
|
-
import { dirname as dirname12, join as
|
|
11428
|
+
import { dirname as dirname12, join as join29 } from "path";
|
|
11359
11429
|
function getOwnerPath(itemId2) {
|
|
11360
|
-
return
|
|
11430
|
+
return join29(homedir11(), ".assist", "signals", `owner-${itemId2}.json`);
|
|
11361
11431
|
}
|
|
11362
11432
|
function recordSignalOwner(itemId2) {
|
|
11363
11433
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
11364
11434
|
if (!sessionId2) return;
|
|
11365
11435
|
const path110 = getOwnerPath(itemId2);
|
|
11366
|
-
|
|
11436
|
+
mkdirSync6(dirname12(path110), { recursive: true });
|
|
11367
11437
|
writeFileSync6(path110, JSON.stringify({ sessionId: sessionId2 }));
|
|
11368
11438
|
}
|
|
11369
11439
|
function readSignalOwner(itemId2) {
|
|
11370
11440
|
const path110 = getOwnerPath(itemId2);
|
|
11371
|
-
if (!
|
|
11441
|
+
if (!existsSync24(path110)) return void 0;
|
|
11372
11442
|
try {
|
|
11373
11443
|
const parsed = JSON.parse(readFileSync10(path110, "utf8"));
|
|
11374
11444
|
return parsed.sessionId;
|
|
@@ -11387,7 +11457,7 @@ function clearSignalOwner(itemId2) {
|
|
|
11387
11457
|
// src/commands/backlog/writeSignal.ts
|
|
11388
11458
|
function getSignalPath(sessionId2 = process.env.ASSIST_SESSION_ID) {
|
|
11389
11459
|
if (!sessionId2) return void 0;
|
|
11390
|
-
return
|
|
11460
|
+
return join30(homedir12(), ".assist", "signals", `signal-${sessionId2}.json`);
|
|
11391
11461
|
}
|
|
11392
11462
|
function resolveSignalTarget(event, data) {
|
|
11393
11463
|
const caller = process.env.ASSIST_SESSION_ID;
|
|
@@ -11419,7 +11489,7 @@ function writeSignal(event, data) {
|
|
|
11419
11489
|
const path110 = getSignalPath(target);
|
|
11420
11490
|
if (!path110) return;
|
|
11421
11491
|
const signal = { event, sessionId: target, ...data };
|
|
11422
|
-
|
|
11492
|
+
mkdirSync7(dirname13(path110), { recursive: true });
|
|
11423
11493
|
writeFileSync7(path110, JSON.stringify(signal));
|
|
11424
11494
|
}
|
|
11425
11495
|
|
|
@@ -11892,6 +11962,21 @@ var sessionFeature = {
|
|
|
11892
11962
|
label: "A new session",
|
|
11893
11963
|
requires: [...editEnforcement]
|
|
11894
11964
|
};
|
|
11965
|
+
var conversationResumeFeature = {
|
|
11966
|
+
id: "conversationResume",
|
|
11967
|
+
label: "Resuming a conversation",
|
|
11968
|
+
requires: ["conversation.resume"]
|
|
11969
|
+
};
|
|
11970
|
+
var conversationRecoveryFeature = {
|
|
11971
|
+
id: "conversationRecovery",
|
|
11972
|
+
label: "Resuming a conversation in a replacement worktree",
|
|
11973
|
+
requires: ["conversation.resume", "conversation.relocate"]
|
|
11974
|
+
};
|
|
11975
|
+
var divergenceEscalationFeature = {
|
|
11976
|
+
id: "divergenceEscalation",
|
|
11977
|
+
label: "Divergence escalation",
|
|
11978
|
+
requires: [...editEnforcement]
|
|
11979
|
+
};
|
|
11895
11980
|
var previewQuestionsFeature = {
|
|
11896
11981
|
id: "previewQuestions",
|
|
11897
11982
|
label: "Preview-pane questions",
|
|
@@ -11951,6 +12036,9 @@ var harnessFeatures = [
|
|
|
11951
12036
|
refineFeature,
|
|
11952
12037
|
buildFeature,
|
|
11953
12038
|
sessionFeature,
|
|
12039
|
+
conversationResumeFeature,
|
|
12040
|
+
conversationRecoveryFeature,
|
|
12041
|
+
divergenceEscalationFeature,
|
|
11954
12042
|
branchSlugFeature,
|
|
11955
12043
|
sessionTitleFeature,
|
|
11956
12044
|
messagePreviewsFeature,
|
|
@@ -13287,7 +13375,7 @@ async function nextPickup(req, res) {
|
|
|
13287
13375
|
import path18 from "path";
|
|
13288
13376
|
|
|
13289
13377
|
// src/commands/rules/readScopedRules.ts
|
|
13290
|
-
import { existsSync as
|
|
13378
|
+
import { existsSync as existsSync26, readFileSync as readFileSync11 } from "fs";
|
|
13291
13379
|
import path17 from "path";
|
|
13292
13380
|
|
|
13293
13381
|
// src/commands/rules/rulesSectionRange.ts
|
|
@@ -13336,11 +13424,11 @@ function parseRulesSection(content) {
|
|
|
13336
13424
|
}
|
|
13337
13425
|
|
|
13338
13426
|
// src/commands/rules/scopeDirectory.ts
|
|
13339
|
-
import { existsSync as
|
|
13427
|
+
import { existsSync as existsSync25, statSync as statSync7 } from "fs";
|
|
13340
13428
|
import path16 from "path";
|
|
13341
13429
|
function scopeDirectory(target) {
|
|
13342
13430
|
const resolved = path16.resolve(target);
|
|
13343
|
-
return
|
|
13431
|
+
return existsSync25(resolved) && statSync7(resolved).isDirectory() ? resolved : path16.dirname(resolved);
|
|
13344
13432
|
}
|
|
13345
13433
|
|
|
13346
13434
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -13351,7 +13439,7 @@ function scopedClaudeFiles(target) {
|
|
|
13351
13439
|
let current2 = startDir;
|
|
13352
13440
|
while (true) {
|
|
13353
13441
|
const candidate = path17.join(current2, "CLAUDE.md");
|
|
13354
|
-
if (
|
|
13442
|
+
if (existsSync26(candidate)) files.push(candidate);
|
|
13355
13443
|
if (current2 === root2 || current2 === path17.dirname(current2)) break;
|
|
13356
13444
|
current2 = path17.dirname(current2);
|
|
13357
13445
|
}
|
|
@@ -14705,7 +14793,7 @@ async function revertDiffFile(req, res) {
|
|
|
14705
14793
|
|
|
14706
14794
|
// src/commands/run/runCommandToCompletion.ts
|
|
14707
14795
|
import { spawn as spawn6 } from "child_process";
|
|
14708
|
-
import { existsSync as
|
|
14796
|
+
import { existsSync as existsSync28 } from "fs";
|
|
14709
14797
|
|
|
14710
14798
|
// src/shared/expandEnv.ts
|
|
14711
14799
|
import { homedir as homedir13 } from "os";
|
|
@@ -14720,15 +14808,15 @@ function expandEnv(env) {
|
|
|
14720
14808
|
|
|
14721
14809
|
// src/commands/run/resolveCommand.ts
|
|
14722
14810
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
14723
|
-
import { existsSync as
|
|
14724
|
-
import { dirname as dirname14, join as
|
|
14811
|
+
import { existsSync as existsSync27 } from "fs";
|
|
14812
|
+
import { dirname as dirname14, join as join31, resolve as resolve10 } from "path";
|
|
14725
14813
|
function resolveCommand(command) {
|
|
14726
14814
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
14727
14815
|
try {
|
|
14728
14816
|
const gitPath = execFileSync4("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
14729
14817
|
const gitRoot = resolve10(dirname14(gitPath), "..");
|
|
14730
|
-
const gitBash =
|
|
14731
|
-
if (
|
|
14818
|
+
const gitBash = join31(gitRoot, "bin", "bash.exe");
|
|
14819
|
+
if (existsSync27(gitBash)) return gitBash;
|
|
14732
14820
|
} catch {
|
|
14733
14821
|
return command;
|
|
14734
14822
|
}
|
|
@@ -14738,7 +14826,7 @@ function resolveCommand(command) {
|
|
|
14738
14826
|
// src/commands/run/runCommandToCompletion.ts
|
|
14739
14827
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
14740
14828
|
return new Promise((resolveResult) => {
|
|
14741
|
-
if (cwd && !
|
|
14829
|
+
if (cwd && !existsSync28(cwd)) {
|
|
14742
14830
|
resolveResult({
|
|
14743
14831
|
kind: "failed",
|
|
14744
14832
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -15980,11 +16068,11 @@ async function readUserConfig(orm) {
|
|
|
15980
16068
|
}
|
|
15981
16069
|
|
|
15982
16070
|
// src/shared/writeRepoConfigCache.ts
|
|
15983
|
-
import { mkdirSync as
|
|
16071
|
+
import { mkdirSync as mkdirSync8, renameSync as renameSync3, writeFileSync as writeFileSync8 } from "fs";
|
|
15984
16072
|
import { dirname as dirname15 } from "path";
|
|
15985
16073
|
function writeRepoConfigCache(repos2, user = {}) {
|
|
15986
16074
|
const path110 = repoConfigCachePath();
|
|
15987
|
-
|
|
16075
|
+
mkdirSync8(dirname15(path110), { recursive: true });
|
|
15988
16076
|
const cache7 = {
|
|
15989
16077
|
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
15990
16078
|
repos: repos2,
|
|
@@ -16490,17 +16578,17 @@ var autoRestartWait = {
|
|
|
16490
16578
|
|
|
16491
16579
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
16492
16580
|
import { readFile as readFile2 } from "fs/promises";
|
|
16493
|
-
import { join as
|
|
16581
|
+
import { join as join33 } from "path";
|
|
16494
16582
|
|
|
16495
16583
|
// src/commands/extension/extensionDir.ts
|
|
16496
|
-
import { existsSync as
|
|
16497
|
-
import { dirname as dirname16, join as
|
|
16584
|
+
import { existsSync as existsSync29 } from "fs";
|
|
16585
|
+
import { dirname as dirname16, join as join32 } from "path";
|
|
16498
16586
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
16499
16587
|
var moduleDir = dirname16(fileURLToPath3(import.meta.url));
|
|
16500
16588
|
function extensionDir() {
|
|
16501
|
-
const bundled =
|
|
16502
|
-
if (
|
|
16503
|
-
return
|
|
16589
|
+
const bundled = join32(moduleDir, "commands", "extension", "extension");
|
|
16590
|
+
if (existsSync29(bundled)) return bundled;
|
|
16591
|
+
return join32(moduleDir, "..", "..", "..", "extension");
|
|
16504
16592
|
}
|
|
16505
16593
|
|
|
16506
16594
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -16512,7 +16600,7 @@ function latestUpdate(manifest, updates2) {
|
|
|
16512
16600
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
16513
16601
|
async function fetchLatestSignedExtension() {
|
|
16514
16602
|
const manifest = await readFile2(
|
|
16515
|
-
|
|
16603
|
+
join33(extensionDir(), "manifest.json"),
|
|
16516
16604
|
"utf8"
|
|
16517
16605
|
);
|
|
16518
16606
|
const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
|
|
@@ -16539,7 +16627,7 @@ function latestSignedExtension(now = Date.now()) {
|
|
|
16539
16627
|
}
|
|
16540
16628
|
|
|
16541
16629
|
// src/commands/watch/isBuildPending.ts
|
|
16542
|
-
import { existsSync as
|
|
16630
|
+
import { existsSync as existsSync31 } from "fs";
|
|
16543
16631
|
|
|
16544
16632
|
// src/commands/watch/gitMarkerPath.ts
|
|
16545
16633
|
import { resolve as resolve11 } from "path";
|
|
@@ -16556,7 +16644,7 @@ function buildPendingPath(cwd) {
|
|
|
16556
16644
|
}
|
|
16557
16645
|
|
|
16558
16646
|
// src/commands/watch/readBuiltVersion.ts
|
|
16559
|
-
import { join as
|
|
16647
|
+
import { join as join35 } from "path";
|
|
16560
16648
|
|
|
16561
16649
|
// src/shared/readPackageJson.ts
|
|
16562
16650
|
import * as fs10 from "fs";
|
|
@@ -16606,7 +16694,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
16606
16694
|
function readBuiltVersion(cwd) {
|
|
16607
16695
|
try {
|
|
16608
16696
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
16609
|
-
return readPackageJson(
|
|
16697
|
+
return readPackageJson(join35(root2, "package.json")).version ?? "unknown";
|
|
16610
16698
|
} catch {
|
|
16611
16699
|
return "unknown";
|
|
16612
16700
|
}
|
|
@@ -16614,11 +16702,11 @@ function readBuiltVersion(cwd) {
|
|
|
16614
16702
|
|
|
16615
16703
|
// src/commands/watch/readDistVersion.ts
|
|
16616
16704
|
import { readFileSync as readFileSync13 } from "fs";
|
|
16617
|
-
import { join as
|
|
16705
|
+
import { join as join36 } from "path";
|
|
16618
16706
|
function readDistVersion(cwd) {
|
|
16619
16707
|
try {
|
|
16620
16708
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
16621
|
-
return readFileSync13(
|
|
16709
|
+
return readFileSync13(join36(root2, "dist", "built-version"), "utf8").trim();
|
|
16622
16710
|
} catch {
|
|
16623
16711
|
return void 0;
|
|
16624
16712
|
}
|
|
@@ -16633,7 +16721,7 @@ function isDistBehind(cwd) {
|
|
|
16633
16721
|
// src/commands/watch/isBuildPending.ts
|
|
16634
16722
|
function markedPending(cwd) {
|
|
16635
16723
|
try {
|
|
16636
|
-
return
|
|
16724
|
+
return existsSync31(buildPendingPath(cwd));
|
|
16637
16725
|
} catch {
|
|
16638
16726
|
return false;
|
|
16639
16727
|
}
|
|
@@ -16729,7 +16817,7 @@ function stripAnsi(text19) {
|
|
|
16729
16817
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
16730
16818
|
import { createHash } from "crypto";
|
|
16731
16819
|
import { homedir as homedir14 } from "os";
|
|
16732
|
-
import { basename as basename13, join as
|
|
16820
|
+
import { basename as basename13, join as join37 } from "path";
|
|
16733
16821
|
|
|
16734
16822
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
16735
16823
|
import { realpathSync } from "fs";
|
|
@@ -16746,8 +16834,8 @@ function canonicalTreePath(path110) {
|
|
|
16746
16834
|
function watcherLogPath(cwd) {
|
|
16747
16835
|
const clone = canonicalTreePath(cwd);
|
|
16748
16836
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
16749
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
16750
|
-
return
|
|
16837
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join37(homedir14(), ".assist", "watchers");
|
|
16838
|
+
return join37(dir, `${basename13(clone) || "root"}-${key}.log`);
|
|
16751
16839
|
}
|
|
16752
16840
|
|
|
16753
16841
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -16875,7 +16963,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
16875
16963
|
|
|
16876
16964
|
// src/commands/sessions/web/stageAttachment.ts
|
|
16877
16965
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
16878
|
-
import { extname as extname2, join as
|
|
16966
|
+
import { extname as extname2, join as join38 } from "path";
|
|
16879
16967
|
|
|
16880
16968
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
16881
16969
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -16907,9 +16995,9 @@ function safeBaseName(name2) {
|
|
|
16907
16995
|
async function stageAttachment(name2, contentType, body) {
|
|
16908
16996
|
const ext = pickExtension(name2, contentType);
|
|
16909
16997
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
16910
|
-
const dir = await mkdtemp(
|
|
16998
|
+
const dir = await mkdtemp(join38(stagedAttachmentsDir, "upload-"));
|
|
16911
16999
|
const alt = safeBaseName(name2);
|
|
16912
|
-
const filePath =
|
|
17000
|
+
const filePath = join38(dir, `${alt}.${ext}`);
|
|
16913
17001
|
await writeFile(filePath, body);
|
|
16914
17002
|
return { dir, filePath, alt };
|
|
16915
17003
|
}
|
|
@@ -16958,16 +17046,16 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
16958
17046
|
|
|
16959
17047
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
16960
17048
|
import { execFile as execFile12 } from "child_process";
|
|
16961
|
-
import { existsSync as
|
|
16962
|
-
import { dirname as dirname18, join as
|
|
17049
|
+
import { existsSync as existsSync32 } from "fs";
|
|
17050
|
+
import { dirname as dirname18, join as join39 } from "path";
|
|
16963
17051
|
import { promisify as promisify13 } from "util";
|
|
16964
17052
|
var execFileAsync11 = promisify13(execFile12);
|
|
16965
17053
|
var TIMEOUT_MS = 15e3;
|
|
16966
17054
|
function findOxfmtScript(root2) {
|
|
16967
17055
|
let dir = root2;
|
|
16968
17056
|
for (; ; ) {
|
|
16969
|
-
const candidate =
|
|
16970
|
-
if (
|
|
17057
|
+
const candidate = join39(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
17058
|
+
if (existsSync32(candidate)) return candidate;
|
|
16971
17059
|
const parent = dirname18(dir);
|
|
16972
17060
|
if (parent === dir) return void 0;
|
|
16973
17061
|
dir = parent;
|
|
@@ -17039,10 +17127,10 @@ async function writeFileContent(req, res) {
|
|
|
17039
17127
|
// src/shared/createBundleHandler.ts
|
|
17040
17128
|
import { createHash as createHash2 } from "crypto";
|
|
17041
17129
|
import { readFileSync as readFileSync14, statSync as statSync8 } from "fs";
|
|
17042
|
-
import { dirname as dirname19, join as
|
|
17130
|
+
import { dirname as dirname19, join as join40 } from "path";
|
|
17043
17131
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
17044
17132
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
17045
|
-
const file =
|
|
17133
|
+
const file = join40(dirname19(fileURLToPath4(importMetaUrl)), bundlePath);
|
|
17046
17134
|
let cache7;
|
|
17047
17135
|
return (req, res) => {
|
|
17048
17136
|
const mtimeMs = statSync8(file).mtimeMs;
|
|
@@ -17478,9 +17566,9 @@ function scheduleReconnect() {
|
|
|
17478
17566
|
}
|
|
17479
17567
|
|
|
17480
17568
|
// src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
|
|
17481
|
-
import { mkdirSync as
|
|
17482
|
-
import { dirname as dirname20, join as
|
|
17483
|
-
var defaultPath =
|
|
17569
|
+
import { mkdirSync as mkdirSync9, readFileSync as readFileSync16, writeFileSync as writeFileSync9 } from "fs";
|
|
17570
|
+
import { dirname as dirname20, join as join41 } from "path";
|
|
17571
|
+
var defaultPath = join41(daemonPaths.dir, "auto-restart-attempts.json");
|
|
17484
17572
|
function read(path110) {
|
|
17485
17573
|
try {
|
|
17486
17574
|
return JSON.parse(readFileSync16(path110, "utf8"));
|
|
@@ -17493,7 +17581,7 @@ function autoRestartAttempts(port, path110 = defaultPath) {
|
|
|
17493
17581
|
return {
|
|
17494
17582
|
get: () => read(path110)[key],
|
|
17495
17583
|
set: (built) => {
|
|
17496
|
-
|
|
17584
|
+
mkdirSync9(dirname20(path110), { recursive: true });
|
|
17497
17585
|
writeFileSync9(
|
|
17498
17586
|
path110,
|
|
17499
17587
|
`${JSON.stringify({ ...read(path110), [key]: built }, null, 2)}
|
|
@@ -17703,9 +17791,9 @@ function originForCwd(cwd) {
|
|
|
17703
17791
|
}
|
|
17704
17792
|
|
|
17705
17793
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
17706
|
-
import { existsSync as
|
|
17794
|
+
import { existsSync as existsSync33 } from "fs";
|
|
17707
17795
|
function repoDirExists(cwd) {
|
|
17708
|
-
return
|
|
17796
|
+
return existsSync33(cwd);
|
|
17709
17797
|
}
|
|
17710
17798
|
|
|
17711
17799
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
@@ -17806,7 +17894,7 @@ function gitCommonDir(cwd) {
|
|
|
17806
17894
|
var REGISTRY_FILE = "worktrees.json";
|
|
17807
17895
|
function readWorktreeRegistry() {
|
|
17808
17896
|
const data = loadJson(REGISTRY_FILE);
|
|
17809
|
-
return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([path110, record3]) => ({ path: path110, ...record3 }));
|
|
17897
|
+
return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([path110, { reaped: _reaped, ...record3 }]) => ({ path: path110, ...record3 }));
|
|
17810
17898
|
}
|
|
17811
17899
|
function worktreeAttributionIncludingReaped(path110) {
|
|
17812
17900
|
const record3 = loadJson(REGISTRY_FILE)[path110];
|
|
@@ -17817,6 +17905,13 @@ function recordWorktree(path110, clone, origin) {
|
|
|
17817
17905
|
data[path110] = { clone, origin };
|
|
17818
17906
|
saveJson(REGISTRY_FILE, data);
|
|
17819
17907
|
}
|
|
17908
|
+
function recordWorktreeHarness(path110, harness) {
|
|
17909
|
+
const data = loadJson(REGISTRY_FILE);
|
|
17910
|
+
const record3 = data[path110];
|
|
17911
|
+
if (!record3 || record3.reaped || record3.harness === harness) return;
|
|
17912
|
+
data[path110] = { ...record3, harness };
|
|
17913
|
+
saveJson(REGISTRY_FILE, data);
|
|
17914
|
+
}
|
|
17820
17915
|
function forgetWorktree(path110) {
|
|
17821
17916
|
const data = loadJson(REGISTRY_FILE);
|
|
17822
17917
|
const record3 = data[path110];
|
|
@@ -18197,17 +18292,17 @@ import * as path21 from "path";
|
|
|
18197
18292
|
import chalk21 from "chalk";
|
|
18198
18293
|
|
|
18199
18294
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
18200
|
-
import { existsSync as
|
|
18201
|
-
import { join as
|
|
18295
|
+
import { existsSync as existsSync34, readFileSync as readFileSync17, writeFileSync as writeFileSync11 } from "fs";
|
|
18296
|
+
import { join as join42 } from "path";
|
|
18202
18297
|
import chalk20 from "chalk";
|
|
18203
18298
|
function loadKnipConfig(knipJsonPath) {
|
|
18204
|
-
if (
|
|
18299
|
+
if (existsSync34(knipJsonPath)) {
|
|
18205
18300
|
return JSON.parse(readFileSync17(knipJsonPath, "utf8"));
|
|
18206
18301
|
}
|
|
18207
18302
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
18208
18303
|
}
|
|
18209
18304
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
18210
|
-
const knipJsonPath =
|
|
18305
|
+
const knipJsonPath = join42(cwd, "knip.json");
|
|
18211
18306
|
try {
|
|
18212
18307
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
18213
18308
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -18254,7 +18349,7 @@ import * as path23 from "path";
|
|
|
18254
18349
|
import chalk26 from "chalk";
|
|
18255
18350
|
|
|
18256
18351
|
// src/commands/format/init.ts
|
|
18257
|
-
import { existsSync as
|
|
18352
|
+
import { existsSync as existsSync35, readFileSync as readFileSync18, writeFileSync as writeFileSync12 } from "fs";
|
|
18258
18353
|
import chalk24 from "chalk";
|
|
18259
18354
|
|
|
18260
18355
|
// src/utils/printDiff.ts
|
|
@@ -18297,7 +18392,7 @@ async function init() {
|
|
|
18297
18392
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
18298
18393
|
`;
|
|
18299
18394
|
const configPath = ".oxfmtrc.json";
|
|
18300
|
-
const oldContent =
|
|
18395
|
+
const oldContent = existsSync35(configPath) ? readFileSync18(configPath, "utf8") : "";
|
|
18301
18396
|
if (oldContent === newContent) {
|
|
18302
18397
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
18303
18398
|
return;
|
|
@@ -18320,15 +18415,15 @@ async function init() {
|
|
|
18320
18415
|
}
|
|
18321
18416
|
|
|
18322
18417
|
// src/commands/lint/init.ts
|
|
18323
|
-
import { existsSync as
|
|
18418
|
+
import { existsSync as existsSync38, readFileSync as readFileSync20, writeFileSync as writeFileSync14 } from "fs";
|
|
18324
18419
|
import chalk25 from "chalk";
|
|
18325
18420
|
|
|
18326
18421
|
// src/shared/removeEslint.ts
|
|
18327
18422
|
import { execSync as execSync7 } from "child_process";
|
|
18328
|
-
import { existsSync as
|
|
18423
|
+
import { existsSync as existsSync37, readFileSync as readFileSync19, writeFileSync as writeFileSync13 } from "fs";
|
|
18329
18424
|
|
|
18330
18425
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
18331
|
-
import { existsSync as
|
|
18426
|
+
import { existsSync as existsSync36, unlinkSync as unlinkSync3 } from "fs";
|
|
18332
18427
|
var ESLINT_CONFIG_FILES = [
|
|
18333
18428
|
"eslint.config.js",
|
|
18334
18429
|
"eslint.config.mjs",
|
|
@@ -18344,7 +18439,7 @@ var ESLINT_CONFIG_FILES = [
|
|
|
18344
18439
|
function removeEslintConfigFiles() {
|
|
18345
18440
|
let removed = false;
|
|
18346
18441
|
for (const configFile of ESLINT_CONFIG_FILES) {
|
|
18347
|
-
if (
|
|
18442
|
+
if (existsSync36(configFile)) {
|
|
18348
18443
|
unlinkSync3(configFile);
|
|
18349
18444
|
console.log(`Removed ${configFile}`);
|
|
18350
18445
|
removed = true;
|
|
@@ -18366,7 +18461,7 @@ function removeEslint(options2 = {}) {
|
|
|
18366
18461
|
}
|
|
18367
18462
|
function removeEslintFromPackageJson(options2) {
|
|
18368
18463
|
const packageJsonPath = "package.json";
|
|
18369
|
-
if (!
|
|
18464
|
+
if (!existsSync37(packageJsonPath)) {
|
|
18370
18465
|
return false;
|
|
18371
18466
|
}
|
|
18372
18467
|
const packageJson = JSON.parse(readFileSync19(packageJsonPath, "utf8"));
|
|
@@ -18433,7 +18528,7 @@ async function writeOxlintConfig() {
|
|
|
18433
18528
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
18434
18529
|
`;
|
|
18435
18530
|
const configPath = ".oxlintrc.json";
|
|
18436
|
-
const oldContent =
|
|
18531
|
+
const oldContent = existsSync38(configPath) ? readFileSync20(configPath, "utf8") : "";
|
|
18437
18532
|
if (oldContent === newContent) {
|
|
18438
18533
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
18439
18534
|
return;
|
|
@@ -19161,7 +19256,7 @@ function initPackageJson(name2) {
|
|
|
19161
19256
|
}
|
|
19162
19257
|
|
|
19163
19258
|
// src/commands/new/registerNew/newCli/writeCliTemplate.ts
|
|
19164
|
-
import { mkdirSync as
|
|
19259
|
+
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync19 } from "fs";
|
|
19165
19260
|
function writeCliTemplate(name2) {
|
|
19166
19261
|
console.log("Writing tsconfig.json...");
|
|
19167
19262
|
writeFileSync19(
|
|
@@ -19202,7 +19297,7 @@ export default defineConfig({
|
|
|
19202
19297
|
`
|
|
19203
19298
|
);
|
|
19204
19299
|
console.log("Writing src/index.ts...");
|
|
19205
|
-
|
|
19300
|
+
mkdirSync11("src", { recursive: true });
|
|
19206
19301
|
writeFileSync19(
|
|
19207
19302
|
"src/index.ts",
|
|
19208
19303
|
`#!/usr/bin/env node
|
|
@@ -19231,7 +19326,7 @@ async function newCli() {
|
|
|
19231
19326
|
|
|
19232
19327
|
// src/commands/new/registerNew/newProject.ts
|
|
19233
19328
|
import { execSync as execSync14 } from "child_process";
|
|
19234
|
-
import { existsSync as
|
|
19329
|
+
import { existsSync as existsSync43, readFileSync as readFileSync24, writeFileSync as writeFileSync21 } from "fs";
|
|
19235
19330
|
|
|
19236
19331
|
// src/commands/deploy/init.ts
|
|
19237
19332
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -19239,14 +19334,14 @@ import chalk36 from "chalk";
|
|
|
19239
19334
|
import enquirer3 from "enquirer";
|
|
19240
19335
|
|
|
19241
19336
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
19242
|
-
import { existsSync as
|
|
19243
|
-
import { dirname as dirname28, join as
|
|
19337
|
+
import { existsSync as existsSync42, mkdirSync as mkdirSync12, readFileSync as readFileSync23, writeFileSync as writeFileSync20 } from "fs";
|
|
19338
|
+
import { dirname as dirname28, join as join49 } from "path";
|
|
19244
19339
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
19245
19340
|
import chalk35 from "chalk";
|
|
19246
19341
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
19247
19342
|
var __dirname4 = dirname28(fileURLToPath5(import.meta.url));
|
|
19248
19343
|
function getExistingSiteId() {
|
|
19249
|
-
if (!
|
|
19344
|
+
if (!existsSync42(WORKFLOW_PATH)) {
|
|
19250
19345
|
return null;
|
|
19251
19346
|
}
|
|
19252
19347
|
const content = readFileSync23(WORKFLOW_PATH, "utf8");
|
|
@@ -19254,17 +19349,17 @@ function getExistingSiteId() {
|
|
|
19254
19349
|
return match ? match[1] : null;
|
|
19255
19350
|
}
|
|
19256
19351
|
function getTemplateContent(siteId) {
|
|
19257
|
-
const templatePath =
|
|
19352
|
+
const templatePath = join49(__dirname4, "commands/deploy/build.yml");
|
|
19258
19353
|
const template = readFileSync23(templatePath, "utf8");
|
|
19259
19354
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
19260
19355
|
}
|
|
19261
19356
|
async function updateWorkflow(siteId) {
|
|
19262
19357
|
const newContent = getTemplateContent(siteId);
|
|
19263
19358
|
const workflowDir = ".github/workflows";
|
|
19264
|
-
if (!
|
|
19265
|
-
|
|
19359
|
+
if (!existsSync42(workflowDir)) {
|
|
19360
|
+
mkdirSync12(workflowDir, { recursive: true });
|
|
19266
19361
|
}
|
|
19267
|
-
if (
|
|
19362
|
+
if (existsSync42(WORKFLOW_PATH)) {
|
|
19268
19363
|
const oldContent = readFileSync23(WORKFLOW_PATH, "utf8");
|
|
19269
19364
|
if (oldContent === newContent) {
|
|
19270
19365
|
console.log(chalk35.green("build.yml is already up to date"));
|
|
@@ -19359,7 +19454,7 @@ async function newProject() {
|
|
|
19359
19454
|
}
|
|
19360
19455
|
function addViteBaseConfig() {
|
|
19361
19456
|
const viteConfigPath = "vite.config.ts";
|
|
19362
|
-
if (!
|
|
19457
|
+
if (!existsSync43(viteConfigPath)) {
|
|
19363
19458
|
console.log("No vite.config.ts found, skipping base config");
|
|
19364
19459
|
return;
|
|
19365
19460
|
}
|
|
@@ -19562,17 +19657,17 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
19562
19657
|
|
|
19563
19658
|
// src/commands/advise/loadAdviceFragments.ts
|
|
19564
19659
|
import { readdirSync as readdirSync9, readFileSync as readFileSync25 } from "fs";
|
|
19565
|
-
import { basename as basename15, join as
|
|
19660
|
+
import { basename as basename15, join as join51 } from "path";
|
|
19566
19661
|
|
|
19567
19662
|
// src/commands/advise/adviceDir.ts
|
|
19568
|
-
import { existsSync as
|
|
19569
|
-
import { dirname as dirname29, join as
|
|
19663
|
+
import { existsSync as existsSync44 } from "fs";
|
|
19664
|
+
import { dirname as dirname29, join as join50 } from "path";
|
|
19570
19665
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
19571
19666
|
function adviceDir() {
|
|
19572
19667
|
let current2 = dirname29(fileURLToPath6(import.meta.url));
|
|
19573
19668
|
while (current2 !== dirname29(current2)) {
|
|
19574
|
-
const candidate =
|
|
19575
|
-
if (
|
|
19669
|
+
const candidate = join50(current2, "claude", "advice");
|
|
19670
|
+
if (existsSync44(candidate)) return candidate;
|
|
19576
19671
|
current2 = dirname29(current2);
|
|
19577
19672
|
}
|
|
19578
19673
|
throw new Error("Could not locate the shipped claude/advice directory");
|
|
@@ -19604,7 +19699,7 @@ function loadAdviceFragments(dir = adviceDir()) {
|
|
|
19604
19699
|
return readdirSync9(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
19605
19700
|
(file) => parseAdviceFragment(
|
|
19606
19701
|
basename15(file, ".md"),
|
|
19607
|
-
readFileSync25(
|
|
19702
|
+
readFileSync25(join51(dir, file), "utf8")
|
|
19608
19703
|
)
|
|
19609
19704
|
);
|
|
19610
19705
|
}
|
|
@@ -19638,13 +19733,13 @@ function renderAdviceBody(fragment, context) {
|
|
|
19638
19733
|
}
|
|
19639
19734
|
|
|
19640
19735
|
// src/commands/advise/adviceConditions.ts
|
|
19641
|
-
import { existsSync as
|
|
19642
|
-
import { join as
|
|
19736
|
+
import { existsSync as existsSync45 } from "fs";
|
|
19737
|
+
import { join as join52 } from "path";
|
|
19643
19738
|
function repoFile(file, label) {
|
|
19644
19739
|
return {
|
|
19645
19740
|
whenMet: `the repo has ${label}`,
|
|
19646
19741
|
whenUnmet: `the repo has no ${label}`,
|
|
19647
|
-
matches: ({ rootDir }) =>
|
|
19742
|
+
matches: ({ rootDir }) => existsSync45(join52(rootDir, file))
|
|
19648
19743
|
};
|
|
19649
19744
|
}
|
|
19650
19745
|
var adviceConditions = {
|
|
@@ -19670,11 +19765,11 @@ var adviceConditions = {
|
|
|
19670
19765
|
},
|
|
19671
19766
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
19672
19767
|
filenameConvention: repoFile(
|
|
19673
|
-
|
|
19768
|
+
join52("oxlint-rules", "filenameConvention.ts"),
|
|
19674
19769
|
"oxlint-rules/filenameConvention.ts"
|
|
19675
19770
|
),
|
|
19676
19771
|
claudeSettings: repoFile(
|
|
19677
|
-
|
|
19772
|
+
join52("claude", "settings.json"),
|
|
19678
19773
|
"claude/settings.json"
|
|
19679
19774
|
),
|
|
19680
19775
|
verify: {
|
|
@@ -20590,7 +20685,7 @@ function registerAskQuestion(program) {
|
|
|
20590
20685
|
|
|
20591
20686
|
// src/commands/registerBackup.ts
|
|
20592
20687
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
20593
|
-
import { join as
|
|
20688
|
+
import { join as join54, resolve as resolve16 } from "path";
|
|
20594
20689
|
import chalk41 from "chalk";
|
|
20595
20690
|
|
|
20596
20691
|
// src/shared/db/recordBackup.ts
|
|
@@ -20604,7 +20699,7 @@ async function recordBackup(db, {
|
|
|
20604
20699
|
|
|
20605
20700
|
// src/commands/backup/scheduleBackup.ts
|
|
20606
20701
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
20607
|
-
import { join as
|
|
20702
|
+
import { join as join53 } from "path";
|
|
20608
20703
|
import chalk39 from "chalk";
|
|
20609
20704
|
|
|
20610
20705
|
// src/commands/backup/readCrontab.ts
|
|
@@ -20746,7 +20841,7 @@ async function scheduleBackup({
|
|
|
20746
20841
|
const cronExpr = durationToCron(every);
|
|
20747
20842
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
20748
20843
|
await mkdir2(dir, { recursive: true });
|
|
20749
|
-
const logPath2 =
|
|
20844
|
+
const logPath2 = join53(dir, "cron.log");
|
|
20750
20845
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
20751
20846
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
20752
20847
|
console.error(
|
|
@@ -20925,7 +21020,7 @@ async function backup({ out }) {
|
|
|
20925
21020
|
await mkdir3(dir, { recursive: true });
|
|
20926
21021
|
const start2 = Date.now();
|
|
20927
21022
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
20928
|
-
const filePath = resolve16(
|
|
21023
|
+
const filePath = resolve16(join54(dir, `backup-${timestamp9}.dump`));
|
|
20929
21024
|
await exportBacklog(filePath);
|
|
20930
21025
|
const { size } = await stat4(filePath);
|
|
20931
21026
|
const durationMs = Date.now() - start2;
|
|
@@ -21436,7 +21531,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
21436
21531
|
|
|
21437
21532
|
// src/commands/backlog/cloneRepo.ts
|
|
21438
21533
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
21439
|
-
import { existsSync as
|
|
21534
|
+
import { existsSync as existsSync47 } from "fs";
|
|
21440
21535
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
21441
21536
|
import chalk48 from "chalk";
|
|
21442
21537
|
|
|
@@ -21472,7 +21567,7 @@ async function cloneRepo(originRaw) {
|
|
|
21472
21567
|
if (!target) {
|
|
21473
21568
|
return fail3(`Could not derive a repository name from "${origin}".`);
|
|
21474
21569
|
}
|
|
21475
|
-
if (
|
|
21570
|
+
if (existsSync47(target)) {
|
|
21476
21571
|
return fail3(`Clone target already exists: ${target}`);
|
|
21477
21572
|
}
|
|
21478
21573
|
await mkdir4(baseDir, { recursive: true });
|
|
@@ -21818,7 +21913,7 @@ function ensureRemoteOrigin() {
|
|
|
21818
21913
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
21819
21914
|
import { mkdtempSync, readFileSync as readFileSync27, unlinkSync as unlinkSync4, writeFileSync as writeFileSync22 } from "fs";
|
|
21820
21915
|
import { tmpdir as tmpdir2 } from "os";
|
|
21821
|
-
import { join as
|
|
21916
|
+
import { join as join56 } from "path";
|
|
21822
21917
|
import enquirer4 from "enquirer";
|
|
21823
21918
|
async function promptType() {
|
|
21824
21919
|
const { type } = await enquirer4.prompt({
|
|
@@ -21858,8 +21953,8 @@ async function promptDescription() {
|
|
|
21858
21953
|
}
|
|
21859
21954
|
function openEditor() {
|
|
21860
21955
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
21861
|
-
const dir = mkdtempSync(
|
|
21862
|
-
const filePath =
|
|
21956
|
+
const dir = mkdtempSync(join56(tmpdir2(), "assist-"));
|
|
21957
|
+
const filePath = join56(dir, "description.md");
|
|
21863
21958
|
writeFileSync22(filePath, "");
|
|
21864
21959
|
const result = spawnSync6(editor, [filePath], { stdio: "inherit" });
|
|
21865
21960
|
if (result.status !== 0) {
|
|
@@ -22300,7 +22395,7 @@ function startProposedRun(id, startOn) {
|
|
|
22300
22395
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
22301
22396
|
|
|
22302
22397
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
22303
|
-
import { mkdirSync as
|
|
22398
|
+
import { mkdirSync as mkdirSync13, readFileSync as readFileSync28, renameSync as renameSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
22304
22399
|
import { dirname as dirname30 } from "path";
|
|
22305
22400
|
function readLedger(path110) {
|
|
22306
22401
|
try {
|
|
@@ -22313,7 +22408,7 @@ function readLedger(path110) {
|
|
|
22313
22408
|
function mutateLedger(path110, mutate) {
|
|
22314
22409
|
const ledger = readLedger(path110);
|
|
22315
22410
|
mutate(ledger);
|
|
22316
|
-
|
|
22411
|
+
mkdirSync13(dirname30(path110), { recursive: true });
|
|
22317
22412
|
const tmp = `${path110}.${process.pid}.tmp`;
|
|
22318
22413
|
writeFileSync23(tmp, JSON.stringify(ledger));
|
|
22319
22414
|
renameSync4(tmp, path110);
|
|
@@ -22344,9 +22439,9 @@ async function findPredecessor(path110, token, startedAt) {
|
|
|
22344
22439
|
|
|
22345
22440
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
22346
22441
|
import { homedir as homedir15 } from "os";
|
|
22347
|
-
import { join as
|
|
22442
|
+
import { join as join57 } from "path";
|
|
22348
22443
|
function proposalLedgerPath(sessionId2) {
|
|
22349
|
-
return
|
|
22444
|
+
return join57(homedir15(), ".assist", "proposals", `session-${sessionId2}.json`);
|
|
22350
22445
|
}
|
|
22351
22446
|
|
|
22352
22447
|
// src/commands/backlog/propose/trackProposal.ts
|
|
@@ -22702,7 +22797,7 @@ import chalk69 from "chalk";
|
|
|
22702
22797
|
|
|
22703
22798
|
// src/shared/waitForIndexUnlocked.ts
|
|
22704
22799
|
import { execSync as execSync18 } from "child_process";
|
|
22705
|
-
import { existsSync as
|
|
22800
|
+
import { existsSync as existsSync48 } from "fs";
|
|
22706
22801
|
import { resolve as resolve17 } from "path";
|
|
22707
22802
|
var POLL_MS2 = 200;
|
|
22708
22803
|
function indexLockPath() {
|
|
@@ -22723,7 +22818,7 @@ function waitForIndexUnlocked(timeoutMs) {
|
|
|
22723
22818
|
const lock2 = indexLockPath();
|
|
22724
22819
|
if (!lock2) return true;
|
|
22725
22820
|
const deadline = Date.now() + timeoutMs;
|
|
22726
|
-
while (
|
|
22821
|
+
while (existsSync48(lock2)) {
|
|
22727
22822
|
if (Date.now() >= deadline) return false;
|
|
22728
22823
|
sleepSync(POLL_MS2);
|
|
22729
22824
|
}
|
|
@@ -22839,14 +22934,14 @@ function hasLocalChanges() {
|
|
|
22839
22934
|
|
|
22840
22935
|
// src/commands/backlog/acquireLock.ts
|
|
22841
22936
|
import {
|
|
22842
|
-
existsSync as
|
|
22843
|
-
mkdirSync as
|
|
22937
|
+
existsSync as existsSync49,
|
|
22938
|
+
mkdirSync as mkdirSync14,
|
|
22844
22939
|
readFileSync as readFileSync30,
|
|
22845
22940
|
unlinkSync as unlinkSync5,
|
|
22846
22941
|
writeFileSync as writeFileSync24
|
|
22847
22942
|
} from "fs";
|
|
22848
22943
|
import { homedir as homedir16 } from "os";
|
|
22849
|
-
import { join as
|
|
22944
|
+
import { join as join58 } from "path";
|
|
22850
22945
|
|
|
22851
22946
|
// src/commands/backlog/bootedAt.ts
|
|
22852
22947
|
import { uptime } from "os";
|
|
@@ -22882,10 +22977,10 @@ function isStaleLock(pid, timestamp9) {
|
|
|
22882
22977
|
|
|
22883
22978
|
// src/commands/backlog/acquireLock.ts
|
|
22884
22979
|
function getLocksDir() {
|
|
22885
|
-
return
|
|
22980
|
+
return join58(homedir16(), ".assist", "locks");
|
|
22886
22981
|
}
|
|
22887
22982
|
function getLockPath(itemId2) {
|
|
22888
|
-
return
|
|
22983
|
+
return join58(getLocksDir(), `lock-${itemId2}.json`);
|
|
22889
22984
|
}
|
|
22890
22985
|
function isProcessAlive(pid) {
|
|
22891
22986
|
try {
|
|
@@ -22897,7 +22992,7 @@ function isProcessAlive(pid) {
|
|
|
22897
22992
|
}
|
|
22898
22993
|
function foreignLockHolder(itemId2) {
|
|
22899
22994
|
const lockPath = getLockPath(itemId2);
|
|
22900
|
-
if (!
|
|
22995
|
+
if (!existsSync49(lockPath)) return null;
|
|
22901
22996
|
try {
|
|
22902
22997
|
const lock2 = JSON.parse(readFileSync30(lockPath, "utf8"));
|
|
22903
22998
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
@@ -22912,7 +23007,7 @@ function isLockedByOther(itemId2) {
|
|
|
22912
23007
|
return foreignLockHolder(itemId2) !== null;
|
|
22913
23008
|
}
|
|
22914
23009
|
function acquireLock(itemId2) {
|
|
22915
|
-
|
|
23010
|
+
mkdirSync14(getLocksDir(), { recursive: true });
|
|
22916
23011
|
writeFileSync24(
|
|
22917
23012
|
getLockPath(itemId2),
|
|
22918
23013
|
JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
@@ -23343,24 +23438,24 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
23343
23438
|
}
|
|
23344
23439
|
|
|
23345
23440
|
// src/commands/backlog/consumePause.ts
|
|
23346
|
-
import { existsSync as
|
|
23441
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync15, unlinkSync as unlinkSync6, writeFileSync as writeFileSync25 } from "fs";
|
|
23347
23442
|
import { homedir as homedir17 } from "os";
|
|
23348
|
-
import { join as
|
|
23443
|
+
import { join as join59 } from "path";
|
|
23349
23444
|
function getControlsDir() {
|
|
23350
|
-
return
|
|
23445
|
+
return join59(homedir17(), ".assist", "controls");
|
|
23351
23446
|
}
|
|
23352
23447
|
function getPausePath(itemId2) {
|
|
23353
|
-
return
|
|
23448
|
+
return join59(getControlsDir(), `pause-${itemId2}.json`);
|
|
23354
23449
|
}
|
|
23355
23450
|
function requestPause(itemId2) {
|
|
23356
|
-
|
|
23451
|
+
mkdirSync15(getControlsDir(), { recursive: true });
|
|
23357
23452
|
writeFileSync25(
|
|
23358
23453
|
getPausePath(itemId2),
|
|
23359
23454
|
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
23360
23455
|
);
|
|
23361
23456
|
}
|
|
23362
23457
|
function isPausePending(itemId2) {
|
|
23363
|
-
return
|
|
23458
|
+
return existsSync50(getPausePath(itemId2));
|
|
23364
23459
|
}
|
|
23365
23460
|
function clearPause(itemId2) {
|
|
23366
23461
|
try {
|
|
@@ -23370,7 +23465,7 @@ function clearPause(itemId2) {
|
|
|
23370
23465
|
}
|
|
23371
23466
|
function consumePause(itemId2) {
|
|
23372
23467
|
const pausePath = getPausePath(itemId2);
|
|
23373
|
-
if (!
|
|
23468
|
+
if (!existsSync50(pausePath)) return false;
|
|
23374
23469
|
try {
|
|
23375
23470
|
unlinkSync6(pausePath);
|
|
23376
23471
|
} catch {
|
|
@@ -23530,13 +23625,13 @@ function logHookFired(status2, sessionId2, source) {
|
|
|
23530
23625
|
}
|
|
23531
23626
|
|
|
23532
23627
|
// src/commands/backlog/watchForMarker.ts
|
|
23533
|
-
import { existsSync as
|
|
23628
|
+
import { existsSync as existsSync52, unwatchFile, watchFile } from "fs";
|
|
23534
23629
|
|
|
23535
23630
|
// src/commands/backlog/readSignal.ts
|
|
23536
|
-
import { existsSync as
|
|
23631
|
+
import { existsSync as existsSync51, readFileSync as readFileSync31 } from "fs";
|
|
23537
23632
|
function readSignal() {
|
|
23538
23633
|
const path110 = getSignalPath();
|
|
23539
|
-
if (!path110 || !
|
|
23634
|
+
if (!path110 || !existsSync51(path110)) return void 0;
|
|
23540
23635
|
try {
|
|
23541
23636
|
return JSON.parse(readFileSync31(path110, "utf8"));
|
|
23542
23637
|
} catch {
|
|
@@ -23550,7 +23645,7 @@ function watchForMarker(child, options2) {
|
|
|
23550
23645
|
const statusPath = getSignalPath();
|
|
23551
23646
|
if (!statusPath) return { killedOnMarker: () => killed };
|
|
23552
23647
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
23553
|
-
if (!
|
|
23648
|
+
if (!existsSync52(statusPath)) return;
|
|
23554
23649
|
const signal = readSignal();
|
|
23555
23650
|
if (!signal) return;
|
|
23556
23651
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -23606,7 +23701,7 @@ function launchPhaseSession(item, phaseNumber, phase, phaseLabel2, claudeSession
|
|
|
23606
23701
|
}
|
|
23607
23702
|
|
|
23608
23703
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
23609
|
-
import { existsSync as
|
|
23704
|
+
import { existsSync as existsSync53, unlinkSync as unlinkSync7 } from "fs";
|
|
23610
23705
|
import chalk78 from "chalk";
|
|
23611
23706
|
|
|
23612
23707
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -23628,7 +23723,7 @@ async function handleIncompletePhase() {
|
|
|
23628
23723
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
23629
23724
|
function cleanupSignal() {
|
|
23630
23725
|
const statusPath = getSignalPath();
|
|
23631
|
-
if (statusPath &&
|
|
23726
|
+
if (statusPath && existsSync53(statusPath)) {
|
|
23632
23727
|
unlinkSync7(statusPath);
|
|
23633
23728
|
}
|
|
23634
23729
|
}
|
|
@@ -23639,7 +23734,7 @@ async function isTerminalStatus(itemId2) {
|
|
|
23639
23734
|
}
|
|
23640
23735
|
async function resolvePhaseResult(phaseIndex, itemId2) {
|
|
23641
23736
|
const signalPath = getSignalPath();
|
|
23642
|
-
if (!signalPath || !
|
|
23737
|
+
if (!signalPath || !existsSync53(signalPath)) {
|
|
23643
23738
|
if (await isTerminalStatus(itemId2)) return { kind: "abort" };
|
|
23644
23739
|
const action = await handleIncompletePhase();
|
|
23645
23740
|
if (action === "abort") return { kind: "abort" };
|
|
@@ -23724,9 +23819,9 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
23724
23819
|
}
|
|
23725
23820
|
|
|
23726
23821
|
// src/shared/emitActivity.ts
|
|
23727
|
-
import { mkdirSync as
|
|
23822
|
+
import { mkdirSync as mkdirSync16, readFileSync as readFileSync32, rmSync as rmSync4, writeFileSync as writeFileSync26 } from "fs";
|
|
23728
23823
|
import { homedir as homedir18 } from "os";
|
|
23729
|
-
import { dirname as dirname31, join as
|
|
23824
|
+
import { dirname as dirname31, join as join60 } from "path";
|
|
23730
23825
|
import { z as z17 } from "zod";
|
|
23731
23826
|
var activitySchema = z17.object({
|
|
23732
23827
|
kind: z17.enum(["command", "backlog"]),
|
|
@@ -23744,13 +23839,13 @@ var activitySchema = z17.object({
|
|
|
23744
23839
|
startedAt: z17.number()
|
|
23745
23840
|
});
|
|
23746
23841
|
function activityPath(sessionId2) {
|
|
23747
|
-
return
|
|
23842
|
+
return join60(homedir18(), ".assist", "activity", `activity-${sessionId2}.json`);
|
|
23748
23843
|
}
|
|
23749
23844
|
function emitActivity(activity2) {
|
|
23750
23845
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
23751
23846
|
if (!sessionId2) return;
|
|
23752
23847
|
const path110 = activityPath(sessionId2);
|
|
23753
|
-
|
|
23848
|
+
mkdirSync16(dirname31(path110), { recursive: true });
|
|
23754
23849
|
writeFileSync26(path110, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
23755
23850
|
}
|
|
23756
23851
|
function readActivity(path110) {
|
|
@@ -23766,12 +23861,12 @@ function reconcileActivity(sessionId2, activity2) {
|
|
|
23766
23861
|
return;
|
|
23767
23862
|
}
|
|
23768
23863
|
const path110 = activityPath(sessionId2);
|
|
23769
|
-
|
|
23864
|
+
mkdirSync16(dirname31(path110), { recursive: true });
|
|
23770
23865
|
writeFileSync26(path110, JSON.stringify(activity2));
|
|
23771
23866
|
}
|
|
23772
23867
|
function writeActivityIfAbsent(sessionId2, activity2) {
|
|
23773
23868
|
const path110 = activityPath(sessionId2);
|
|
23774
|
-
|
|
23869
|
+
mkdirSync16(dirname31(path110), { recursive: true });
|
|
23775
23870
|
try {
|
|
23776
23871
|
writeFileSync26(path110, JSON.stringify(activity2), { flag: "wx" });
|
|
23777
23872
|
return true;
|
|
@@ -26459,7 +26554,7 @@ function extractGraphqlQuery(args) {
|
|
|
26459
26554
|
}
|
|
26460
26555
|
|
|
26461
26556
|
// src/shared/loadCliReads.ts
|
|
26462
|
-
import { existsSync as
|
|
26557
|
+
import { existsSync as existsSync54, readFileSync as readFileSync34, writeFileSync as writeFileSync27 } from "fs";
|
|
26463
26558
|
import { dirname as dirname32, resolve as resolve18 } from "path";
|
|
26464
26559
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
26465
26560
|
var __filename4 = fileURLToPath7(import.meta.url);
|
|
@@ -26468,7 +26563,7 @@ function packageRoot() {
|
|
|
26468
26563
|
return __dirname5;
|
|
26469
26564
|
}
|
|
26470
26565
|
function readLines(path110) {
|
|
26471
|
-
if (!
|
|
26566
|
+
if (!existsSync54(path110)) return [];
|
|
26472
26567
|
return readFileSync34(path110, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
26473
26568
|
}
|
|
26474
26569
|
var cachedReads;
|
|
@@ -26515,14 +26610,14 @@ function findCliWrite(command) {
|
|
|
26515
26610
|
}
|
|
26516
26611
|
|
|
26517
26612
|
// src/shared/readSettingsPerms.ts
|
|
26518
|
-
import { existsSync as
|
|
26613
|
+
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "fs";
|
|
26519
26614
|
import { homedir as homedir19 } from "os";
|
|
26520
|
-
import { join as
|
|
26615
|
+
import { join as join61 } from "path";
|
|
26521
26616
|
function readSettingsPerms(key) {
|
|
26522
26617
|
const paths = [
|
|
26523
|
-
|
|
26524
|
-
|
|
26525
|
-
|
|
26618
|
+
join61(homedir19(), ".claude", "settings.json"),
|
|
26619
|
+
join61(process.cwd(), ".claude", "settings.json"),
|
|
26620
|
+
join61(process.cwd(), ".claude", "settings.local.json")
|
|
26526
26621
|
];
|
|
26527
26622
|
const entries = [];
|
|
26528
26623
|
for (const p of paths) {
|
|
@@ -26534,7 +26629,7 @@ function readSettingsPerms(key) {
|
|
|
26534
26629
|
return entries;
|
|
26535
26630
|
}
|
|
26536
26631
|
function readPermissionArray(filePath, key) {
|
|
26537
|
-
if (!
|
|
26632
|
+
if (!existsSync55(filePath)) return [];
|
|
26538
26633
|
try {
|
|
26539
26634
|
const data = JSON.parse(readFileSync35(filePath, "utf8"));
|
|
26540
26635
|
const arr = data?.permissions?.[key];
|
|
@@ -26888,32 +26983,32 @@ async function decideDocsGuard({
|
|
|
26888
26983
|
}
|
|
26889
26984
|
|
|
26890
26985
|
// src/commands/schema/isSchemaLocked.ts
|
|
26891
|
-
import { existsSync as
|
|
26986
|
+
import { existsSync as existsSync56, readFileSync as readFileSync37 } from "fs";
|
|
26892
26987
|
|
|
26893
26988
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
26894
|
-
import { join as
|
|
26989
|
+
import { join as join63 } from "path";
|
|
26895
26990
|
|
|
26896
26991
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
26897
26992
|
import { homedir as homedir20 } from "os";
|
|
26898
|
-
import { join as
|
|
26993
|
+
import { join as join62 } from "path";
|
|
26899
26994
|
function getRestrictedDir() {
|
|
26900
|
-
return
|
|
26995
|
+
return join62(homedir20(), ".assist", "restricted");
|
|
26901
26996
|
}
|
|
26902
26997
|
function getPinStatePath(pin2) {
|
|
26903
|
-
return
|
|
26998
|
+
return join62(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
26904
26999
|
}
|
|
26905
27000
|
|
|
26906
27001
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
26907
27002
|
var SESSION_ID = /^[\w-]+$/;
|
|
26908
27003
|
function getSchemaSessionApprovalDir() {
|
|
26909
|
-
return
|
|
27004
|
+
return join63(getRestrictedDir(), "schema-sessions");
|
|
26910
27005
|
}
|
|
26911
27006
|
function getSchemaSessionApprovalPath(scope) {
|
|
26912
27007
|
const { harness, conversationId } = scope;
|
|
26913
27008
|
if (!SESSION_ID.test(conversationId) || !SESSION_ID.test(harness))
|
|
26914
27009
|
return void 0;
|
|
26915
27010
|
const name2 = harness === legacyDefaultHarness ? conversationId : `${harness}-${conversationId}`;
|
|
26916
|
-
return
|
|
27011
|
+
return join63(getSchemaSessionApprovalDir(), `${name2}.json`);
|
|
26917
27012
|
}
|
|
26918
27013
|
|
|
26919
27014
|
// src/commands/schema/isSchemaLocked.ts
|
|
@@ -26934,7 +27029,7 @@ function hasSessionApproval(identity) {
|
|
|
26934
27029
|
const { harness, conversationId } = identity;
|
|
26935
27030
|
if (!conversationId) return false;
|
|
26936
27031
|
const path110 = getSchemaSessionApprovalPath({ harness, conversationId });
|
|
26937
|
-
return path110 !== void 0 &&
|
|
27032
|
+
return path110 !== void 0 && existsSync56(path110) && approvalMatches(path110, identity);
|
|
26938
27033
|
}
|
|
26939
27034
|
async function isSchemaLocked(identity = currentExecutionIdentity()) {
|
|
26940
27035
|
if (!identity) return false;
|
|
@@ -27006,13 +27101,13 @@ async function decideToolOperations(operations2, identity) {
|
|
|
27006
27101
|
import { basename as basename17 } from "path";
|
|
27007
27102
|
|
|
27008
27103
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
27009
|
-
import { mkdirSync as
|
|
27104
|
+
import { mkdirSync as mkdirSync17 } from "fs";
|
|
27010
27105
|
import { homedir as homedir21 } from "os";
|
|
27011
|
-
import { join as
|
|
27106
|
+
import { join as join64 } from "path";
|
|
27012
27107
|
import Database from "better-sqlite3";
|
|
27013
27108
|
var _db;
|
|
27014
27109
|
function getDbDir() {
|
|
27015
|
-
return
|
|
27110
|
+
return join64(homedir21(), ".assist");
|
|
27016
27111
|
}
|
|
27017
27112
|
function initSchema(db) {
|
|
27018
27113
|
db.exec(`
|
|
@@ -27030,8 +27125,8 @@ function initSchema(db) {
|
|
|
27030
27125
|
function openPromptsDb(dir) {
|
|
27031
27126
|
if (_db) return _db;
|
|
27032
27127
|
const dbDir = dir ?? getDbDir();
|
|
27033
|
-
|
|
27034
|
-
const db = new Database(
|
|
27128
|
+
mkdirSync17(dbDir, { recursive: true });
|
|
27129
|
+
const db = new Database(join64(dbDir, "assist.db"));
|
|
27035
27130
|
db.pragma("journal_mode = WAL");
|
|
27036
27131
|
initSchema(db);
|
|
27037
27132
|
_db = db;
|
|
@@ -27135,9 +27230,9 @@ ${reasons.join("\n")}`);
|
|
|
27135
27230
|
}
|
|
27136
27231
|
|
|
27137
27232
|
// src/commands/permitCliReads.ts
|
|
27138
|
-
import { existsSync as
|
|
27233
|
+
import { existsSync as existsSync57, mkdirSync as mkdirSync18, readFileSync as readFileSync38, writeFileSync as writeFileSync28 } from "fs";
|
|
27139
27234
|
import { homedir as homedir22 } from "os";
|
|
27140
|
-
import { join as
|
|
27235
|
+
import { join as join65 } from "path";
|
|
27141
27236
|
|
|
27142
27237
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
27143
27238
|
function assertCliExists(cli) {
|
|
@@ -27400,16 +27495,16 @@ function updateSettings(cli, commands) {
|
|
|
27400
27495
|
// src/commands/permitCliReads.ts
|
|
27401
27496
|
function logPath(cli) {
|
|
27402
27497
|
const safeName = cli.replace(/\s+/g, "-");
|
|
27403
|
-
return
|
|
27498
|
+
return join65(homedir22(), ".assist", `cli-discover-${safeName}.log`);
|
|
27404
27499
|
}
|
|
27405
27500
|
function readCache(cli) {
|
|
27406
27501
|
const path110 = logPath(cli);
|
|
27407
|
-
if (!
|
|
27502
|
+
if (!existsSync57(path110)) return void 0;
|
|
27408
27503
|
return readFileSync38(path110, "utf8");
|
|
27409
27504
|
}
|
|
27410
27505
|
function writeCache(cli, output) {
|
|
27411
|
-
const dir =
|
|
27412
|
-
|
|
27506
|
+
const dir = join65(homedir22(), ".assist");
|
|
27507
|
+
mkdirSync18(dir, { recursive: true });
|
|
27413
27508
|
writeFileSync28(logPath(cli), output);
|
|
27414
27509
|
}
|
|
27415
27510
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
@@ -27540,7 +27635,7 @@ function registerCliHook(program) {
|
|
|
27540
27635
|
}
|
|
27541
27636
|
|
|
27542
27637
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
27543
|
-
import { existsSync as
|
|
27638
|
+
import { existsSync as existsSync59, readFileSync as readFileSync40, unlinkSync as unlinkSync9, writeFileSync as writeFileSync29 } from "fs";
|
|
27544
27639
|
import chalk122 from "chalk";
|
|
27545
27640
|
|
|
27546
27641
|
// src/shared/isHashCommentFile.ts
|
|
@@ -27574,7 +27669,7 @@ function isHashCommentFile(filePath) {
|
|
|
27574
27669
|
|
|
27575
27670
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
27576
27671
|
import { readdirSync as readdirSync11, statSync as statSync9, unlinkSync as unlinkSync8 } from "fs";
|
|
27577
|
-
import { join as
|
|
27672
|
+
import { join as join66 } from "path";
|
|
27578
27673
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
27579
27674
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
27580
27675
|
let entries;
|
|
@@ -27585,7 +27680,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
27585
27680
|
}
|
|
27586
27681
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
27587
27682
|
for (const entry of entries) {
|
|
27588
|
-
const path110 =
|
|
27683
|
+
const path110 = join66(dir, entry);
|
|
27589
27684
|
try {
|
|
27590
27685
|
if (statSync9(path110).mtimeMs < cutoff) unlinkSync8(path110);
|
|
27591
27686
|
} catch {
|
|
@@ -27595,10 +27690,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
27595
27690
|
}
|
|
27596
27691
|
|
|
27597
27692
|
// src/commands/codeComment/readPinState.ts
|
|
27598
|
-
import { existsSync as
|
|
27693
|
+
import { existsSync as existsSync58, readFileSync as readFileSync39 } from "fs";
|
|
27599
27694
|
function readPinState(pin2) {
|
|
27600
27695
|
const path110 = getPinStatePath(pin2);
|
|
27601
|
-
if (!
|
|
27696
|
+
if (!existsSync58(path110)) return void 0;
|
|
27602
27697
|
try {
|
|
27603
27698
|
const state = JSON.parse(readFileSync39(path110, "utf8"));
|
|
27604
27699
|
if (state.pin !== pin2) return void 0;
|
|
@@ -27617,7 +27712,7 @@ function codeCommentConfirm(pin2) {
|
|
|
27617
27712
|
process.exitCode = 1;
|
|
27618
27713
|
return;
|
|
27619
27714
|
}
|
|
27620
|
-
if (!
|
|
27715
|
+
if (!existsSync59(state.file)) {
|
|
27621
27716
|
console.error(chalk122.red(`Target file no longer exists: ${state.file}`));
|
|
27622
27717
|
process.exitCode = 1;
|
|
27623
27718
|
return;
|
|
@@ -27676,7 +27771,7 @@ function validateCommentText(raw, isHash = false) {
|
|
|
27676
27771
|
}
|
|
27677
27772
|
|
|
27678
27773
|
// src/commands/codeComment/issuePin.ts
|
|
27679
|
-
import { mkdirSync as
|
|
27774
|
+
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync30 } from "fs";
|
|
27680
27775
|
import { randomInt } from "crypto";
|
|
27681
27776
|
|
|
27682
27777
|
// src/commands/notify/deliverPinNotification.ts
|
|
@@ -27761,7 +27856,7 @@ async function deliverPinNotification(notification) {
|
|
|
27761
27856
|
// src/commands/codeComment/issuePin.ts
|
|
27762
27857
|
function issuePin(file, lineNumber, text19) {
|
|
27763
27858
|
const pin2 = generatePin();
|
|
27764
|
-
|
|
27859
|
+
mkdirSync19(getRestrictedDir(), { recursive: true });
|
|
27765
27860
|
sweepRestrictedDir();
|
|
27766
27861
|
writeFileSync30(
|
|
27767
27862
|
getPinStatePath(pin2),
|
|
@@ -29847,16 +29942,16 @@ async function browserRun(options2) {
|
|
|
29847
29942
|
}
|
|
29848
29943
|
|
|
29849
29944
|
// src/commands/browser/browserSnapshot.ts
|
|
29850
|
-
import { mkdirSync as
|
|
29945
|
+
import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync31 } from "fs";
|
|
29851
29946
|
import { dirname as dirname33 } from "path";
|
|
29852
29947
|
|
|
29853
29948
|
// src/commands/browser/snapshotPath.ts
|
|
29854
29949
|
import { homedir as homedir23 } from "os";
|
|
29855
|
-
import { join as
|
|
29950
|
+
import { join as join67 } from "path";
|
|
29856
29951
|
function snapshotPath(tabUrl, now) {
|
|
29857
29952
|
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
29858
29953
|
const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
|
|
29859
|
-
return
|
|
29954
|
+
return join67(homedir23(), ".assist", "browser", `${host}-${timestamp9}.html`);
|
|
29860
29955
|
}
|
|
29861
29956
|
|
|
29862
29957
|
// src/commands/browser/browserSnapshot.ts
|
|
@@ -29866,7 +29961,7 @@ async function browserSnapshot(options2) {
|
|
|
29866
29961
|
url: options2.url
|
|
29867
29962
|
});
|
|
29868
29963
|
const path110 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
|
|
29869
|
-
|
|
29964
|
+
mkdirSync20(dirname33(path110), { recursive: true });
|
|
29870
29965
|
writeFileSync31(path110, result.html);
|
|
29871
29966
|
console.log(`snapshot: ${path110}`);
|
|
29872
29967
|
}
|
|
@@ -30063,28 +30158,28 @@ async function printExtensionUrl() {
|
|
|
30063
30158
|
// src/commands/extension/signExtension.ts
|
|
30064
30159
|
import { rm as rm2 } from "fs/promises";
|
|
30065
30160
|
import { homedir as homedir24, tmpdir as tmpdir4 } from "os";
|
|
30066
|
-
import { join as
|
|
30161
|
+
import { join as join73 } from "path";
|
|
30067
30162
|
import chalk156 from "chalk";
|
|
30068
30163
|
|
|
30069
30164
|
// src/commands/extension/copySignedXpi.ts
|
|
30070
30165
|
import { copyFile } from "fs/promises";
|
|
30071
|
-
import { join as
|
|
30166
|
+
import { join as join68 } from "path";
|
|
30072
30167
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
30073
30168
|
async function copySignedXpi(xpi, dir) {
|
|
30074
|
-
const fixed2 =
|
|
30169
|
+
const fixed2 = join68(dir, SIGNED_XPI_NAME);
|
|
30075
30170
|
if (fixed2 === xpi) return fixed2;
|
|
30076
30171
|
await copyFile(xpi, fixed2);
|
|
30077
30172
|
return fixed2;
|
|
30078
30173
|
}
|
|
30079
30174
|
|
|
30080
30175
|
// src/commands/extension/findSignedXpi.ts
|
|
30081
|
-
import { existsSync as
|
|
30176
|
+
import { existsSync as existsSync60 } from "fs";
|
|
30082
30177
|
import { readdir } from "fs/promises";
|
|
30083
|
-
import { join as
|
|
30178
|
+
import { join as join69 } from "path";
|
|
30084
30179
|
async function findSignedXpi(dir) {
|
|
30085
|
-
if (!
|
|
30180
|
+
if (!existsSync60(dir)) return null;
|
|
30086
30181
|
const name2 = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
30087
|
-
return name2 ?
|
|
30182
|
+
return name2 ? join69(dir, name2) : null;
|
|
30088
30183
|
}
|
|
30089
30184
|
|
|
30090
30185
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -30106,11 +30201,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
30106
30201
|
}
|
|
30107
30202
|
|
|
30108
30203
|
// src/commands/extension/signPreflightProblem.ts
|
|
30109
|
-
import { existsSync as
|
|
30110
|
-
import { join as
|
|
30204
|
+
import { existsSync as existsSync61 } from "fs";
|
|
30205
|
+
import { join as join70 } from "path";
|
|
30111
30206
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
30112
30207
|
function signPreflightProblem(source) {
|
|
30113
|
-
if (!
|
|
30208
|
+
if (!existsSync61(join70(source, "content.js")))
|
|
30114
30209
|
return {
|
|
30115
30210
|
message: `no content.js in ${source}`,
|
|
30116
30211
|
hint: "run npm run build to bundle the content script"
|
|
@@ -30125,7 +30220,7 @@ function signPreflightProblem(source) {
|
|
|
30125
30220
|
|
|
30126
30221
|
// src/commands/extension/stageExtension.ts
|
|
30127
30222
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
30128
|
-
import { basename as basename18, join as
|
|
30223
|
+
import { basename as basename18, join as join71 } from "path";
|
|
30129
30224
|
|
|
30130
30225
|
// src/commands/extension/stampManifestVersion.ts
|
|
30131
30226
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -30142,7 +30237,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
30142
30237
|
recursive: true,
|
|
30143
30238
|
filter: (path110) => basename18(path110) !== "updates.json"
|
|
30144
30239
|
});
|
|
30145
|
-
const manifest =
|
|
30240
|
+
const manifest = join71(staging, "manifest.json");
|
|
30146
30241
|
const stamped = stampManifestVersion(
|
|
30147
30242
|
await readFile5(manifest, "utf8"),
|
|
30148
30243
|
version2
|
|
@@ -30152,7 +30247,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
30152
30247
|
|
|
30153
30248
|
// src/commands/extension/writeUpdateManifest.ts
|
|
30154
30249
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
30155
|
-
import { join as
|
|
30250
|
+
import { join as join72 } from "path";
|
|
30156
30251
|
|
|
30157
30252
|
// src/commands/extension/buildUpdateManifest.ts
|
|
30158
30253
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -30177,17 +30272,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
30177
30272
|
// src/commands/extension/writeUpdateManifest.ts
|
|
30178
30273
|
async function writeUpdateManifest(source, dir, version2) {
|
|
30179
30274
|
await writeFile5(
|
|
30180
|
-
|
|
30275
|
+
join72(dir, "updates.json"),
|
|
30181
30276
|
buildUpdateManifest(
|
|
30182
|
-
await readFile6(
|
|
30277
|
+
await readFile6(join72(source, "manifest.json"), "utf8"),
|
|
30183
30278
|
version2
|
|
30184
30279
|
)
|
|
30185
30280
|
);
|
|
30186
30281
|
}
|
|
30187
30282
|
|
|
30188
30283
|
// src/commands/extension/signExtension.ts
|
|
30189
|
-
var ARTIFACTS_DIR =
|
|
30190
|
-
var STAGING_DIR =
|
|
30284
|
+
var ARTIFACTS_DIR = join73(homedir24(), ".assist", "extension");
|
|
30285
|
+
var STAGING_DIR = join73(tmpdir4(), "assist-extension");
|
|
30191
30286
|
async function signExtension() {
|
|
30192
30287
|
const source = extensionDir();
|
|
30193
30288
|
const problem = signPreflightProblem(source);
|
|
@@ -30371,7 +30466,7 @@ function registerDb(program) {
|
|
|
30371
30466
|
}
|
|
30372
30467
|
|
|
30373
30468
|
// src/commands/deploy/redirect.ts
|
|
30374
|
-
import { existsSync as
|
|
30469
|
+
import { existsSync as existsSync62, readFileSync as readFileSync42, writeFileSync as writeFileSync32 } from "fs";
|
|
30375
30470
|
import chalk159 from "chalk";
|
|
30376
30471
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
30377
30472
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -30380,7 +30475,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
30380
30475
|
</script>`;
|
|
30381
30476
|
function redirect() {
|
|
30382
30477
|
const indexPath = "index.html";
|
|
30383
|
-
if (!
|
|
30478
|
+
if (!existsSync62(indexPath)) {
|
|
30384
30479
|
console.log(chalk159.yellow("No index.html found"));
|
|
30385
30480
|
return;
|
|
30386
30481
|
}
|
|
@@ -30479,9 +30574,9 @@ import { readFileSync as readFileSync43 } from "fs";
|
|
|
30479
30574
|
import { parse as parseYaml3 } from "yaml";
|
|
30480
30575
|
|
|
30481
30576
|
// src/commands/devlog/devEntryPath.ts
|
|
30482
|
-
import { join as
|
|
30577
|
+
import { join as join74 } from "path";
|
|
30483
30578
|
function devEntryPath(repoName, week, devDir) {
|
|
30484
|
-
return
|
|
30579
|
+
return join74(devDir, repoName, `${week.toLowerCase()}.md`);
|
|
30485
30580
|
}
|
|
30486
30581
|
|
|
30487
30582
|
// src/commands/devlog/loadDevEntry.ts
|
|
@@ -30593,15 +30688,15 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
30593
30688
|
import chalk162 from "chalk";
|
|
30594
30689
|
|
|
30595
30690
|
// src/shared/getRepoName.ts
|
|
30596
|
-
import { existsSync as
|
|
30597
|
-
import { basename as basename19, join as
|
|
30691
|
+
import { existsSync as existsSync63, readFileSync as readFileSync44 } from "fs";
|
|
30692
|
+
import { basename as basename19, join as join75 } from "path";
|
|
30598
30693
|
function getRepoName() {
|
|
30599
30694
|
const config = loadConfig();
|
|
30600
30695
|
if (config.devlog?.name) {
|
|
30601
30696
|
return config.devlog.name;
|
|
30602
30697
|
}
|
|
30603
|
-
const packageJsonPath =
|
|
30604
|
-
if (
|
|
30698
|
+
const packageJsonPath = join75(process.cwd(), "package.json");
|
|
30699
|
+
if (existsSync63(packageJsonPath)) {
|
|
30605
30700
|
try {
|
|
30606
30701
|
const content = readFileSync44(packageJsonPath, "utf8");
|
|
30607
30702
|
const pkg = JSON.parse(content);
|
|
@@ -30679,7 +30774,7 @@ function list2(options2) {
|
|
|
30679
30774
|
|
|
30680
30775
|
// src/commands/devlog/loadDevWeeks.ts
|
|
30681
30776
|
import { readdirSync as readdirSync12 } from "fs";
|
|
30682
|
-
import { join as
|
|
30777
|
+
import { join as join76 } from "path";
|
|
30683
30778
|
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
30684
30779
|
function parseDevWeekFilename(filename) {
|
|
30685
30780
|
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
@@ -30693,7 +30788,7 @@ function readFilenames(dir) {
|
|
|
30693
30788
|
}
|
|
30694
30789
|
}
|
|
30695
30790
|
function loadDevWeeks(repoName, devDir) {
|
|
30696
|
-
return readFilenames(
|
|
30791
|
+
return readFilenames(join76(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
30697
30792
|
}
|
|
30698
30793
|
|
|
30699
30794
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
@@ -30958,14 +31053,14 @@ async function skip2(week, cwd = process.cwd()) {
|
|
|
30958
31053
|
}
|
|
30959
31054
|
|
|
30960
31055
|
// src/commands/devlog/slack/slack.ts
|
|
30961
|
-
import { mkdirSync as
|
|
31056
|
+
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync36 } from "fs";
|
|
30962
31057
|
import chalk168 from "chalk";
|
|
30963
31058
|
|
|
30964
31059
|
// src/commands/slack/postSlackMessage.ts
|
|
30965
|
-
import { mkdirSync as
|
|
31060
|
+
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync35 } from "fs";
|
|
30966
31061
|
|
|
30967
31062
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
30968
|
-
import { mkdirSync as
|
|
31063
|
+
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync34 } from "fs";
|
|
30969
31064
|
|
|
30970
31065
|
// src/commands/slack/readSlackParts.ts
|
|
30971
31066
|
import { readFileSync as readFileSync46 } from "fs";
|
|
@@ -31011,12 +31106,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
31011
31106
|
}
|
|
31012
31107
|
|
|
31013
31108
|
// src/commands/slack/slackWorkingFile.ts
|
|
31014
|
-
import { join as
|
|
31109
|
+
import { join as join77 } from "path";
|
|
31015
31110
|
function slackWorkingFile(channel, partIndex) {
|
|
31016
31111
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
31017
|
-
const dir =
|
|
31112
|
+
const dir = join77(getStoreDir(), "slack");
|
|
31018
31113
|
const name2 = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
31019
|
-
return { dir, bodyPath:
|
|
31114
|
+
return { dir, bodyPath: join77(dir, `${name2}.md`) };
|
|
31020
31115
|
}
|
|
31021
31116
|
|
|
31022
31117
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -31028,7 +31123,7 @@ async function previewSlackThreadParts({
|
|
|
31028
31123
|
}) {
|
|
31029
31124
|
const bodies = readSlackParts(partFiles);
|
|
31030
31125
|
const { dir } = slackWorkingFile(channel);
|
|
31031
|
-
|
|
31126
|
+
mkdirSync21(dir, { recursive: true });
|
|
31032
31127
|
const paths = bodies.map((body, index3) => {
|
|
31033
31128
|
const { bodyPath } = slackWorkingFile(channel, index3 + 1);
|
|
31034
31129
|
writeFileSync34(bodyPath, `${body}
|
|
@@ -31082,7 +31177,7 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
31082
31177
|
process.exit(1);
|
|
31083
31178
|
}
|
|
31084
31179
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
31085
|
-
|
|
31180
|
+
mkdirSync22(dir, { recursive: true });
|
|
31086
31181
|
writeFileSync35(bodyPath, `${body}
|
|
31087
31182
|
`);
|
|
31088
31183
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
@@ -31222,7 +31317,7 @@ function fail8(message4) {
|
|
|
31222
31317
|
process.exit(1);
|
|
31223
31318
|
}
|
|
31224
31319
|
function writeParts(channel, parts2) {
|
|
31225
|
-
|
|
31320
|
+
mkdirSync23(slackWorkingFile(channel).dir, { recursive: true });
|
|
31226
31321
|
return parts2.map((part, index3) => {
|
|
31227
31322
|
const { bodyPath } = slackWorkingFile(channel, index3 + 1);
|
|
31228
31323
|
writeFileSync36(bodyPath, `${part}
|
|
@@ -31266,7 +31361,7 @@ async function slack2(week) {
|
|
|
31266
31361
|
}
|
|
31267
31362
|
|
|
31268
31363
|
// src/commands/devlog/write.ts
|
|
31269
|
-
import { mkdirSync as
|
|
31364
|
+
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync37 } from "fs";
|
|
31270
31365
|
import { dirname as dirname34 } from "path";
|
|
31271
31366
|
import chalk169 from "chalk";
|
|
31272
31367
|
|
|
@@ -31361,7 +31456,7 @@ async function write() {
|
|
|
31361
31456
|
const devDir = resolveDevDir();
|
|
31362
31457
|
const repoName = getRepoName();
|
|
31363
31458
|
const path110 = devEntryPath(repoName, result.data.week, devDir);
|
|
31364
|
-
|
|
31459
|
+
mkdirSync24(dirname34(path110), { recursive: true });
|
|
31365
31460
|
writeFileSync37(path110, formatDevEntry(repoName, result.data));
|
|
31366
31461
|
console.log(chalk169.green(`Wrote ${path110}`));
|
|
31367
31462
|
}
|
|
@@ -31558,19 +31653,19 @@ async function findPhaseUnlockItem(itemId2, phase) {
|
|
|
31558
31653
|
}
|
|
31559
31654
|
|
|
31560
31655
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
31561
|
-
import { join as
|
|
31656
|
+
import { join as join78 } from "path";
|
|
31562
31657
|
function getDocsUnlockPinPath(pin2) {
|
|
31563
|
-
return
|
|
31658
|
+
return join78(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
31564
31659
|
}
|
|
31565
31660
|
|
|
31566
31661
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
31567
|
-
import { existsSync as
|
|
31662
|
+
import { existsSync as existsSync64, readFileSync as readFileSync48 } from "fs";
|
|
31568
31663
|
function isPositiveInteger(value) {
|
|
31569
31664
|
return Number.isInteger(value) && value > 0;
|
|
31570
31665
|
}
|
|
31571
31666
|
function readDocsUnlockPinState(pin2) {
|
|
31572
31667
|
const path110 = getDocsUnlockPinPath(pin2);
|
|
31573
|
-
if (!
|
|
31668
|
+
if (!existsSync64(path110)) return void 0;
|
|
31574
31669
|
try {
|
|
31575
31670
|
const state = JSON.parse(readFileSync48(path110, "utf8"));
|
|
31576
31671
|
if (state.pin !== pin2) return void 0;
|
|
@@ -31616,7 +31711,7 @@ import chalk174 from "chalk";
|
|
|
31616
31711
|
|
|
31617
31712
|
// src/commands/notify/issueUnlockPin.ts
|
|
31618
31713
|
import { randomInt as randomInt2 } from "crypto";
|
|
31619
|
-
import { mkdirSync as
|
|
31714
|
+
import { mkdirSync as mkdirSync25, unlinkSync as unlinkSync11, writeFileSync as writeFileSync38 } from "fs";
|
|
31620
31715
|
async function issueUnlockPin({
|
|
31621
31716
|
area,
|
|
31622
31717
|
label,
|
|
@@ -31624,7 +31719,7 @@ async function issueUnlockPin({
|
|
|
31624
31719
|
state
|
|
31625
31720
|
}) {
|
|
31626
31721
|
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
31627
|
-
|
|
31722
|
+
mkdirSync25(getRestrictedDir(), { recursive: true });
|
|
31628
31723
|
sweepRestrictedDir();
|
|
31629
31724
|
const path110 = pinPath(pin2);
|
|
31630
31725
|
writeFileSync38(path110, JSON.stringify({ ...state, pin: pin2 }));
|
|
@@ -31703,7 +31798,7 @@ import { unlinkSync as unlinkSync12 } from "fs";
|
|
|
31703
31798
|
import chalk176 from "chalk";
|
|
31704
31799
|
|
|
31705
31800
|
// src/commands/schema/approveSchemaUnlock.ts
|
|
31706
|
-
import { mkdirSync as
|
|
31801
|
+
import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync39 } from "fs";
|
|
31707
31802
|
import chalk175 from "chalk";
|
|
31708
31803
|
|
|
31709
31804
|
// src/commands/schema/schemaHarnessLabel.ts
|
|
@@ -31734,7 +31829,7 @@ function approveSession({ harness, conversationId }) {
|
|
|
31734
31829
|
const scope = { harness, conversationId };
|
|
31735
31830
|
const path110 = getSchemaSessionApprovalPath(scope);
|
|
31736
31831
|
if (!path110) return;
|
|
31737
|
-
|
|
31832
|
+
mkdirSync26(getSchemaSessionApprovalDir(), { recursive: true });
|
|
31738
31833
|
writeFileSync39(path110, JSON.stringify(scope));
|
|
31739
31834
|
console.log(
|
|
31740
31835
|
chalk175.green(
|
|
@@ -31748,13 +31843,13 @@ async function approveSchemaUnlock(state) {
|
|
|
31748
31843
|
}
|
|
31749
31844
|
|
|
31750
31845
|
// src/commands/schema/getSchemaUnlockPinPath.ts
|
|
31751
|
-
import { join as
|
|
31846
|
+
import { join as join79 } from "path";
|
|
31752
31847
|
function getSchemaUnlockPinPath(pin2) {
|
|
31753
|
-
return
|
|
31848
|
+
return join79(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
|
|
31754
31849
|
}
|
|
31755
31850
|
|
|
31756
31851
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
31757
|
-
import { existsSync as
|
|
31852
|
+
import { existsSync as existsSync65, readFileSync as readFileSync49 } from "fs";
|
|
31758
31853
|
function isPositiveInteger2(value) {
|
|
31759
31854
|
return Number.isInteger(value) && value > 0;
|
|
31760
31855
|
}
|
|
@@ -31779,7 +31874,7 @@ function toState(raw) {
|
|
|
31779
31874
|
}
|
|
31780
31875
|
function readSchemaUnlockPinState(pin2) {
|
|
31781
31876
|
const path110 = getSchemaUnlockPinPath(pin2);
|
|
31782
|
-
if (!
|
|
31877
|
+
if (!existsSync65(path110)) return void 0;
|
|
31783
31878
|
try {
|
|
31784
31879
|
const raw = JSON.parse(readFileSync49(path110, "utf8"));
|
|
31785
31880
|
if (raw.pin !== pin2) return void 0;
|
|
@@ -31909,7 +32004,7 @@ function registerSchema(parent) {
|
|
|
31909
32004
|
|
|
31910
32005
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
31911
32006
|
import { closeSync as closeSync6, openSync as openSync7, readdirSync as readdirSync14 } from "fs";
|
|
31912
|
-
import { join as
|
|
32007
|
+
import { join as join80 } from "path";
|
|
31913
32008
|
import chalk179 from "chalk";
|
|
31914
32009
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
31915
32010
|
function isLockedDll(debugDir) {
|
|
@@ -31921,7 +32016,7 @@ function isLockedDll(debugDir) {
|
|
|
31921
32016
|
}
|
|
31922
32017
|
for (const file of files) {
|
|
31923
32018
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
31924
|
-
const dllPath =
|
|
32019
|
+
const dllPath = join80(debugDir, file);
|
|
31925
32020
|
try {
|
|
31926
32021
|
const fd = openSync7(dllPath, "r+");
|
|
31927
32022
|
closeSync6(fd);
|
|
@@ -31939,13 +32034,13 @@ function findFirstLockedDll(dir) {
|
|
|
31939
32034
|
return null;
|
|
31940
32035
|
}
|
|
31941
32036
|
if (entries.includes("bin")) {
|
|
31942
|
-
const locked = isLockedDll(
|
|
32037
|
+
const locked = isLockedDll(join80(dir, "bin", "Debug"));
|
|
31943
32038
|
if (locked) return locked;
|
|
31944
32039
|
}
|
|
31945
32040
|
for (const entry of entries) {
|
|
31946
32041
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
31947
32042
|
continue;
|
|
31948
|
-
const found = findFirstLockedDll(
|
|
32043
|
+
const found = findFirstLockedDll(join80(dir, entry));
|
|
31949
32044
|
if (found) return found;
|
|
31950
32045
|
}
|
|
31951
32046
|
return null;
|
|
@@ -32113,12 +32208,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
32113
32208
|
}
|
|
32114
32209
|
|
|
32115
32210
|
// src/commands/dotnet/resolveCsproj.ts
|
|
32116
|
-
import { existsSync as
|
|
32211
|
+
import { existsSync as existsSync66 } from "fs";
|
|
32117
32212
|
import path42 from "path";
|
|
32118
32213
|
import chalk181 from "chalk";
|
|
32119
32214
|
function resolveCsproj(csprojPath) {
|
|
32120
32215
|
const resolved = path42.resolve(csprojPath);
|
|
32121
|
-
if (!
|
|
32216
|
+
if (!existsSync66(resolved)) {
|
|
32122
32217
|
console.error(chalk181.red(`File not found: ${resolved}`));
|
|
32123
32218
|
process.exit(1);
|
|
32124
32219
|
}
|
|
@@ -32286,17 +32381,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
32286
32381
|
}
|
|
32287
32382
|
|
|
32288
32383
|
// src/commands/dotnet/resolveSolution.ts
|
|
32289
|
-
import { existsSync as
|
|
32384
|
+
import { existsSync as existsSync67 } from "fs";
|
|
32290
32385
|
import path43 from "path";
|
|
32291
32386
|
import chalk185 from "chalk";
|
|
32292
32387
|
|
|
32293
32388
|
// src/commands/dotnet/findSolution.ts
|
|
32294
32389
|
import { readdirSync as readdirSync16 } from "fs";
|
|
32295
|
-
import { dirname as dirname35, join as
|
|
32390
|
+
import { dirname as dirname35, join as join81 } from "path";
|
|
32296
32391
|
import chalk184 from "chalk";
|
|
32297
32392
|
function findSlnInDir(dir) {
|
|
32298
32393
|
try {
|
|
32299
|
-
return readdirSync16(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
32394
|
+
return readdirSync16(dir).filter((f) => f.endsWith(".sln")).map((f) => join81(dir, f));
|
|
32300
32395
|
} catch {
|
|
32301
32396
|
return [];
|
|
32302
32397
|
}
|
|
@@ -32327,7 +32422,7 @@ function findSolution() {
|
|
|
32327
32422
|
function resolveSolution(sln) {
|
|
32328
32423
|
if (sln) {
|
|
32329
32424
|
const resolved = path43.resolve(sln);
|
|
32330
|
-
if (!
|
|
32425
|
+
if (!existsSync67(resolved)) {
|
|
32331
32426
|
console.error(chalk185.red(`Solution file not found: ${resolved}`));
|
|
32332
32427
|
process.exit(1);
|
|
32333
32428
|
}
|
|
@@ -32367,7 +32462,7 @@ function parseInspectReport(json) {
|
|
|
32367
32462
|
|
|
32368
32463
|
// src/commands/dotnet/runInspectCode.ts
|
|
32369
32464
|
import { execSync as execSync40 } from "child_process";
|
|
32370
|
-
import { existsSync as
|
|
32465
|
+
import { existsSync as existsSync68, readFileSync as readFileSync52, unlinkSync as unlinkSync13 } from "fs";
|
|
32371
32466
|
import { tmpdir as tmpdir5 } from "os";
|
|
32372
32467
|
import path44 from "path";
|
|
32373
32468
|
import chalk186 from "chalk";
|
|
@@ -32398,7 +32493,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
32398
32493
|
console.error(chalk186.red("jb inspectcode failed"));
|
|
32399
32494
|
process.exit(1);
|
|
32400
32495
|
}
|
|
32401
|
-
if (!
|
|
32496
|
+
if (!existsSync68(reportPath)) {
|
|
32402
32497
|
console.error(chalk186.red("Report file not generated"));
|
|
32403
32498
|
process.exit(1);
|
|
32404
32499
|
}
|
|
@@ -33304,7 +33399,7 @@ function aggregateCommitters(authorLists) {
|
|
|
33304
33399
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
33305
33400
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync40 } from "fs";
|
|
33306
33401
|
import { tmpdir as tmpdir6 } from "os";
|
|
33307
|
-
import { join as
|
|
33402
|
+
import { join as join82 } from "path";
|
|
33308
33403
|
function buildArgs3(queryFile, vars) {
|
|
33309
33404
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
33310
33405
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -33314,7 +33409,7 @@ function buildArgs3(queryFile, vars) {
|
|
|
33314
33409
|
return args;
|
|
33315
33410
|
}
|
|
33316
33411
|
function runGhGraphql(mutation, vars) {
|
|
33317
|
-
const queryFile =
|
|
33412
|
+
const queryFile = join82(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
33318
33413
|
writeFileSync40(queryFile, mutation);
|
|
33319
33414
|
try {
|
|
33320
33415
|
const result = spawnSync7("gh", buildArgs3(queryFile, vars), {
|
|
@@ -34753,24 +34848,24 @@ function slugFromUrl(url) {
|
|
|
34753
34848
|
}
|
|
34754
34849
|
|
|
34755
34850
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
34756
|
-
import { mkdirSync as
|
|
34851
|
+
import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync41 } from "fs";
|
|
34757
34852
|
|
|
34758
34853
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
34759
|
-
import { join as
|
|
34854
|
+
import { join as join83 } from "path";
|
|
34760
34855
|
function issueWorkingFile(slug2, number) {
|
|
34761
34856
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
34762
|
-
const dir =
|
|
34857
|
+
const dir = join83(getStoreDir(), "github-issues", owner, repo);
|
|
34763
34858
|
return {
|
|
34764
34859
|
dir,
|
|
34765
|
-
bodyPath:
|
|
34766
|
-
metaPath:
|
|
34860
|
+
bodyPath: join83(dir, `${number}.md`),
|
|
34861
|
+
metaPath: join83(dir, `${number}.json`)
|
|
34767
34862
|
};
|
|
34768
34863
|
}
|
|
34769
34864
|
|
|
34770
34865
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
34771
34866
|
function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
|
|
34772
34867
|
const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
34773
|
-
|
|
34868
|
+
mkdirSync27(dir, { recursive: true });
|
|
34774
34869
|
writeFileSync41(bodyPath, body);
|
|
34775
34870
|
writeFileSync41(
|
|
34776
34871
|
metaPath,
|
|
@@ -34798,10 +34893,10 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
34798
34893
|
}
|
|
34799
34894
|
|
|
34800
34895
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
34801
|
-
import { existsSync as
|
|
34896
|
+
import { existsSync as existsSync69, readFileSync as readFileSync53 } from "fs";
|
|
34802
34897
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
34803
34898
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
34804
|
-
if (!
|
|
34899
|
+
if (!existsSync69(bodyPath) || !existsSync69(metaPath)) return void 0;
|
|
34805
34900
|
try {
|
|
34806
34901
|
const meta = JSON.parse(readFileSync53(metaPath, "utf8"));
|
|
34807
34902
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -35945,15 +36040,15 @@ function clearStalePrBranch(cwd, branch2) {
|
|
|
35945
36040
|
}
|
|
35946
36041
|
|
|
35947
36042
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
35948
|
-
import { existsSync as
|
|
36043
|
+
import { existsSync as existsSync70 } from "fs";
|
|
35949
36044
|
import { basename as basename22, dirname as dirname37 } from "path";
|
|
35950
36045
|
|
|
35951
36046
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
35952
|
-
import { basename as basename21, join as
|
|
36047
|
+
import { basename as basename21, join as join84 } from "path";
|
|
35953
36048
|
function nextWorktreePath(clone, base, isTaken) {
|
|
35954
36049
|
const name2 = basename21(clone);
|
|
35955
36050
|
for (let n = 2; n < 1e3; n++) {
|
|
35956
|
-
const candidate =
|
|
36051
|
+
const candidate = join84(base, `${name2}-${n}`);
|
|
35957
36052
|
if (!isTaken(candidate)) return candidate;
|
|
35958
36053
|
}
|
|
35959
36054
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -35977,7 +36072,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
35977
36072
|
const base = strategy.root ? expandTilde(strategy.root) : dirname37(clone);
|
|
35978
36073
|
const registered = new Set(listWorktreePaths(clone));
|
|
35979
36074
|
const branches = new Set(listLocalBranches(clone));
|
|
35980
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
36075
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync70(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename22(candidate));
|
|
35981
36076
|
const path110 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
35982
36077
|
const ready = addWorktree(clone, path110, strategy.trunk);
|
|
35983
36078
|
ready.catch(() => {
|
|
@@ -36217,8 +36312,8 @@ function persistedTreeRoots() {
|
|
|
36217
36312
|
}
|
|
36218
36313
|
|
|
36219
36314
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
36220
|
-
import { copyFileSync, existsSync as
|
|
36221
|
-
import { dirname as dirname38, join as
|
|
36315
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync72, mkdirSync as mkdirSync28 } from "fs";
|
|
36316
|
+
import { dirname as dirname38, join as join86 } from "path";
|
|
36222
36317
|
|
|
36223
36318
|
// src/commands/sessions/daemon/worktree/installPaths.ts
|
|
36224
36319
|
import { resolve as resolve22 } from "path";
|
|
@@ -36248,14 +36343,14 @@ function pendingPathAction(enclosing, states2, paths, stopped) {
|
|
|
36248
36343
|
}
|
|
36249
36344
|
|
|
36250
36345
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
36251
|
-
import { existsSync as
|
|
36252
|
-
import { join as
|
|
36346
|
+
import { existsSync as existsSync71 } from "fs";
|
|
36347
|
+
import { join as join85 } from "path";
|
|
36253
36348
|
function detectInstallCommand(dir) {
|
|
36254
|
-
if (!
|
|
36255
|
-
if (
|
|
36256
|
-
if (
|
|
36257
|
-
if (
|
|
36258
|
-
if (
|
|
36349
|
+
if (!existsSync71(join85(dir, "package.json"))) return null;
|
|
36350
|
+
if (existsSync71(join85(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
36351
|
+
if (existsSync71(join85(dir, "yarn.lock"))) return "yarn install";
|
|
36352
|
+
if (existsSync71(join85(dir, "bun.lockb"))) return "bun install";
|
|
36353
|
+
if (existsSync71(join85(dir, "package-lock.json"))) return "npm ci";
|
|
36259
36354
|
return "npm install";
|
|
36260
36355
|
}
|
|
36261
36356
|
|
|
@@ -36447,12 +36542,12 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
36447
36542
|
}
|
|
36448
36543
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
36449
36544
|
for (const rel of copy) {
|
|
36450
|
-
const src =
|
|
36451
|
-
if (!
|
|
36452
|
-
const dest =
|
|
36545
|
+
const src = join86(clone, rel);
|
|
36546
|
+
if (!existsSync72(src)) continue;
|
|
36547
|
+
const dest = join86(worktreePath, rel);
|
|
36453
36548
|
try {
|
|
36454
|
-
|
|
36455
|
-
|
|
36549
|
+
mkdirSync28(dirname38(dest), { recursive: true });
|
|
36550
|
+
copyFileSync2(src, dest);
|
|
36456
36551
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
36457
36552
|
} catch (error) {
|
|
36458
36553
|
daemonLog(
|
|
@@ -36938,7 +37033,7 @@ function registerLitellm(program) {
|
|
|
36938
37033
|
}
|
|
36939
37034
|
|
|
36940
37035
|
// src/commands/mermaidExport.ts
|
|
36941
|
-
import { mkdirSync as
|
|
37036
|
+
import { mkdirSync as mkdirSync29, readdirSync as readdirSync17 } from "fs";
|
|
36942
37037
|
import { resolve as resolve24 } from "path";
|
|
36943
37038
|
import chalk204 from "chalk";
|
|
36944
37039
|
|
|
@@ -37007,7 +37102,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
37007
37102
|
async function mermaidExport(file, options2 = {}) {
|
|
37008
37103
|
const { mermaid } = loadConfig();
|
|
37009
37104
|
const outDir = resolve24(process.cwd(), options2.out ?? ".");
|
|
37010
|
-
|
|
37105
|
+
mkdirSync29(outDir, { recursive: true });
|
|
37011
37106
|
if (options2.index !== void 0) {
|
|
37012
37107
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
37013
37108
|
console.error(
|
|
@@ -37102,7 +37197,7 @@ function boardSource(raw, anchorId, options2) {
|
|
|
37102
37197
|
import { stringify as stringify2 } from "yaml";
|
|
37103
37198
|
|
|
37104
37199
|
// src/commands/miro/writeExtract.ts
|
|
37105
|
-
import { mkdirSync as
|
|
37200
|
+
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync43 } from "fs";
|
|
37106
37201
|
import { dirname as dirname39 } from "path";
|
|
37107
37202
|
import { stringify } from "yaml";
|
|
37108
37203
|
function headerLines(header) {
|
|
@@ -37116,7 +37211,7 @@ function headerLines(header) {
|
|
|
37116
37211
|
];
|
|
37117
37212
|
}
|
|
37118
37213
|
function writeExtract(file, header, texts) {
|
|
37119
|
-
|
|
37214
|
+
mkdirSync30(dirname39(file), { recursive: true });
|
|
37120
37215
|
writeFileSync43(file, `${headerLines(header).join("\n")}
|
|
37121
37216
|
${stringify(texts)}`);
|
|
37122
37217
|
}
|
|
@@ -37181,10 +37276,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
37181
37276
|
}
|
|
37182
37277
|
|
|
37183
37278
|
// src/commands/miro/readIgnoreList.ts
|
|
37184
|
-
import { existsSync as
|
|
37279
|
+
import { existsSync as existsSync73, readFileSync as readFileSync55 } from "fs";
|
|
37185
37280
|
import { parse as parse2 } from "yaml";
|
|
37186
37281
|
function readIgnoreList(file) {
|
|
37187
|
-
if (!
|
|
37282
|
+
if (!existsSync73(file))
|
|
37188
37283
|
throw new MiroExtractError(
|
|
37189
37284
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
37190
37285
|
);
|
|
@@ -37669,15 +37764,15 @@ function createNetcapHandler(options2) {
|
|
|
37669
37764
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
37670
37765
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
37671
37766
|
import { networkInterfaces } from "os";
|
|
37672
|
-
import { join as
|
|
37767
|
+
import { join as join88 } from "path";
|
|
37673
37768
|
import chalk207 from "chalk";
|
|
37674
37769
|
|
|
37675
37770
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
37676
|
-
import { dirname as dirname40, join as
|
|
37771
|
+
import { dirname as dirname40, join as join87 } from "path";
|
|
37677
37772
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
37678
37773
|
var moduleDir2 = dirname40(fileURLToPath8(import.meta.url));
|
|
37679
37774
|
function netcapExtensionDir() {
|
|
37680
|
-
return
|
|
37775
|
+
return join87(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
37681
37776
|
}
|
|
37682
37777
|
|
|
37683
37778
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -37692,7 +37787,7 @@ function lanIPv4() {
|
|
|
37692
37787
|
return void 0;
|
|
37693
37788
|
}
|
|
37694
37789
|
async function configureBackground(dir, host, port, filter) {
|
|
37695
|
-
const file =
|
|
37790
|
+
const file = join88(dir, "background.js");
|
|
37696
37791
|
const source = await readFile7(file, "utf8");
|
|
37697
37792
|
await writeFile6(
|
|
37698
37793
|
file,
|
|
@@ -37732,20 +37827,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
37732
37827
|
}
|
|
37733
37828
|
|
|
37734
37829
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
37735
|
-
import { isAbsolute as isAbsolute6, join as
|
|
37830
|
+
import { isAbsolute as isAbsolute6, join as join90, resolve as resolve26 } from "path";
|
|
37736
37831
|
|
|
37737
37832
|
// src/commands/netcap/defaultCapturePath.ts
|
|
37738
37833
|
import { homedir as homedir25 } from "os";
|
|
37739
|
-
import { join as
|
|
37834
|
+
import { join as join89 } from "path";
|
|
37740
37835
|
function defaultCapturePath() {
|
|
37741
|
-
return
|
|
37836
|
+
return join89(homedir25(), ".assist", "netcap", "capture.jsonl");
|
|
37742
37837
|
}
|
|
37743
37838
|
|
|
37744
37839
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
37745
37840
|
function resolveNetcapOutPath(out) {
|
|
37746
37841
|
if (!out) return defaultCapturePath();
|
|
37747
37842
|
const dir = isAbsolute6(out) ? out : resolve26(process.cwd(), out);
|
|
37748
|
-
return
|
|
37843
|
+
return join90(dir, "capture.jsonl");
|
|
37749
37844
|
}
|
|
37750
37845
|
|
|
37751
37846
|
// src/commands/netcap/netcap.ts
|
|
@@ -37792,7 +37887,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
37792
37887
|
|
|
37793
37888
|
// src/commands/netcap/netcapExtract.ts
|
|
37794
37889
|
import { writeFileSync as writeFileSync44 } from "fs";
|
|
37795
|
-
import { join as
|
|
37890
|
+
import { join as join91 } from "path";
|
|
37796
37891
|
import chalk209 from "chalk";
|
|
37797
37892
|
|
|
37798
37893
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -38237,7 +38332,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
38237
38332
|
function netcapExtract(file) {
|
|
38238
38333
|
const captureFile = file ?? defaultCapturePath();
|
|
38239
38334
|
const posts = extractPostsFromCapture(captureFile);
|
|
38240
|
-
const outFile =
|
|
38335
|
+
const outFile = join91(captureFile, "..", "posts.json");
|
|
38241
38336
|
writeFileSync44(outFile, `${JSON.stringify(posts, null, 2)}
|
|
38242
38337
|
`);
|
|
38243
38338
|
console.log(
|
|
@@ -38633,9 +38728,9 @@ async function comment2(path110, line, body, options2 = {}) {
|
|
|
38633
38728
|
|
|
38634
38729
|
// src/commands/prs/commentsCachePath.ts
|
|
38635
38730
|
import { homedir as homedir26 } from "os";
|
|
38636
|
-
import { join as
|
|
38731
|
+
import { join as join92 } from "path";
|
|
38637
38732
|
function commentsCachePath(org, repo, prNumber) {
|
|
38638
|
-
return
|
|
38733
|
+
return join92(
|
|
38639
38734
|
homedir26(),
|
|
38640
38735
|
".assist",
|
|
38641
38736
|
"pr-comments",
|
|
@@ -38646,16 +38741,16 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
38646
38741
|
}
|
|
38647
38742
|
|
|
38648
38743
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
38649
|
-
import { mkdirSync as
|
|
38744
|
+
import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync45 } from "fs";
|
|
38650
38745
|
import { dirname as dirname42 } from "path";
|
|
38651
38746
|
import { stringify as stringify3 } from "yaml";
|
|
38652
38747
|
|
|
38653
38748
|
// src/commands/prs/loadCommentsCache.ts
|
|
38654
|
-
import { existsSync as
|
|
38749
|
+
import { existsSync as existsSync74, readFileSync as readFileSync58, unlinkSync as unlinkSync15 } from "fs";
|
|
38655
38750
|
import { parse as parse3 } from "yaml";
|
|
38656
38751
|
function loadCommentsCache(org, repo, prNumber) {
|
|
38657
38752
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
38658
|
-
if (!
|
|
38753
|
+
if (!existsSync74(cachePath)) {
|
|
38659
38754
|
return null;
|
|
38660
38755
|
}
|
|
38661
38756
|
const content = readFileSync58(cachePath, "utf8");
|
|
@@ -38663,7 +38758,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
38663
38758
|
}
|
|
38664
38759
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
38665
38760
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
38666
|
-
if (
|
|
38761
|
+
if (existsSync74(cachePath)) {
|
|
38667
38762
|
unlinkSync15(cachePath);
|
|
38668
38763
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
38669
38764
|
}
|
|
@@ -38671,10 +38766,10 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
38671
38766
|
|
|
38672
38767
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
38673
38768
|
import { readdirSync as readdirSync18, unlinkSync as unlinkSync16 } from "fs";
|
|
38674
|
-
import { join as
|
|
38769
|
+
import { join as join93 } from "path";
|
|
38675
38770
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
38676
38771
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
38677
|
-
const dir =
|
|
38772
|
+
const dir = join93(cwd, ".assist");
|
|
38678
38773
|
let entries;
|
|
38679
38774
|
try {
|
|
38680
38775
|
entries = readdirSync18(dir);
|
|
@@ -38682,14 +38777,14 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
38682
38777
|
return;
|
|
38683
38778
|
}
|
|
38684
38779
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
38685
|
-
unlinkSync16(
|
|
38780
|
+
unlinkSync16(join93(dir, entry));
|
|
38686
38781
|
}
|
|
38687
38782
|
}
|
|
38688
38783
|
|
|
38689
38784
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
38690
38785
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
38691
38786
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
38692
|
-
|
|
38787
|
+
mkdirSync31(dirname42(cachePath), { recursive: true });
|
|
38693
38788
|
const cacheData = {
|
|
38694
38789
|
prNumber,
|
|
38695
38790
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -38800,7 +38895,7 @@ function failAzureDevops(error) {
|
|
|
38800
38895
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
38801
38896
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync46 } from "fs";
|
|
38802
38897
|
import { tmpdir as tmpdir7 } from "os";
|
|
38803
|
-
import { join as
|
|
38898
|
+
import { join as join94 } from "path";
|
|
38804
38899
|
function azDevopsInvokeArgs(request, inFile) {
|
|
38805
38900
|
return [
|
|
38806
38901
|
"devops",
|
|
@@ -38835,8 +38930,8 @@ function runAz2(args) {
|
|
|
38835
38930
|
}
|
|
38836
38931
|
function invokeAzDevops(request) {
|
|
38837
38932
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
38838
|
-
const dir = mkdtempSync2(
|
|
38839
|
-
const inFile =
|
|
38933
|
+
const dir = mkdtempSync2(join94(tmpdir7(), "assist-az-"));
|
|
38934
|
+
const inFile = join94(dir, "body.json");
|
|
38840
38935
|
try {
|
|
38841
38936
|
writeFileSync46(inFile, JSON.stringify(request.body));
|
|
38842
38937
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -41968,9 +42063,9 @@ async function notify() {
|
|
|
41968
42063
|
|
|
41969
42064
|
// src/commands/screenshot.ts
|
|
41970
42065
|
import { execSync as execSync54 } from "child_process";
|
|
41971
|
-
import { existsSync as
|
|
42066
|
+
import { existsSync as existsSync75, mkdirSync as mkdirSync32, unlinkSync as unlinkSync17, writeFileSync as writeFileSync47 } from "fs";
|
|
41972
42067
|
import { tmpdir as tmpdir8 } from "os";
|
|
41973
|
-
import { join as
|
|
42068
|
+
import { join as join95, resolve as resolve28 } from "path";
|
|
41974
42069
|
import chalk236 from "chalk";
|
|
41975
42070
|
|
|
41976
42071
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -42100,14 +42195,14 @@ Write-Output $OutputPath
|
|
|
42100
42195
|
|
|
42101
42196
|
// src/commands/screenshot.ts
|
|
42102
42197
|
function buildOutputPath(outputDir, processName) {
|
|
42103
|
-
if (!
|
|
42104
|
-
|
|
42198
|
+
if (!existsSync75(outputDir)) {
|
|
42199
|
+
mkdirSync32(outputDir, { recursive: true });
|
|
42105
42200
|
}
|
|
42106
42201
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
42107
42202
|
return resolve28(outputDir, `${processName}-${timestamp9}.png`);
|
|
42108
42203
|
}
|
|
42109
42204
|
function runPowerShellScript(processName, outputPath) {
|
|
42110
|
-
const scriptPath =
|
|
42205
|
+
const scriptPath = join95(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
42111
42206
|
writeFileSync47(scriptPath, captureWindowPs1, "utf8");
|
|
42112
42207
|
try {
|
|
42113
42208
|
execSync54(
|
|
@@ -42209,9 +42304,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
42209
42304
|
|
|
42210
42305
|
// src/commands/readGitBranch.ts
|
|
42211
42306
|
import { readFileSync as readFileSync61, statSync as statSync12 } from "fs";
|
|
42212
|
-
import { isAbsolute as isAbsolute7, join as
|
|
42307
|
+
import { isAbsolute as isAbsolute7, join as join96, resolve as resolve29 } from "path";
|
|
42213
42308
|
function resolveGitDir(cwd) {
|
|
42214
|
-
const dotGit =
|
|
42309
|
+
const dotGit = join96(cwd, ".git");
|
|
42215
42310
|
let stat5;
|
|
42216
42311
|
try {
|
|
42217
42312
|
stat5 = statSync12(dotGit);
|
|
@@ -42241,7 +42336,7 @@ function readGitBranch(cwd) {
|
|
|
42241
42336
|
}
|
|
42242
42337
|
let head;
|
|
42243
42338
|
try {
|
|
42244
|
-
head = readFileSync61(
|
|
42339
|
+
head = readFileSync61(join96(gitDir, "HEAD"), "utf8");
|
|
42245
42340
|
} catch {
|
|
42246
42341
|
return null;
|
|
42247
42342
|
}
|
|
@@ -45416,12 +45511,12 @@ function formatSlicingRequest(hunks) {
|
|
|
45416
45511
|
}
|
|
45417
45512
|
|
|
45418
45513
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
45419
|
-
import { join as
|
|
45514
|
+
import { join as join97 } from "path";
|
|
45420
45515
|
function slug(value) {
|
|
45421
45516
|
return value.replace(/[^\w.-]+/g, "-");
|
|
45422
45517
|
}
|
|
45423
45518
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
45424
|
-
return
|
|
45519
|
+
return join97(
|
|
45425
45520
|
getStoreDir(),
|
|
45426
45521
|
"high-level-reviews",
|
|
45427
45522
|
slug(repo),
|
|
@@ -45473,9 +45568,9 @@ function listHighLevelHunks(files) {
|
|
|
45473
45568
|
}
|
|
45474
45569
|
|
|
45475
45570
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
45476
|
-
import { existsSync as
|
|
45571
|
+
import { existsSync as existsSync76, readFileSync as readFileSync62 } from "fs";
|
|
45477
45572
|
function readJsonFile(path110) {
|
|
45478
|
-
if (!
|
|
45573
|
+
if (!existsSync76(path110)) return void 0;
|
|
45479
45574
|
try {
|
|
45480
45575
|
return JSON.parse(readFileSync62(path110, "utf8"));
|
|
45481
45576
|
} catch {
|
|
@@ -45556,10 +45651,10 @@ function resolveHighLevelSlices(raw, hunks) {
|
|
|
45556
45651
|
}
|
|
45557
45652
|
|
|
45558
45653
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
45559
|
-
import { mkdirSync as
|
|
45654
|
+
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync48 } from "fs";
|
|
45560
45655
|
import { dirname as dirname45 } from "path";
|
|
45561
45656
|
function writeJsonFile(path110, data) {
|
|
45562
|
-
|
|
45657
|
+
mkdirSync33(dirname45(path110), { recursive: true });
|
|
45563
45658
|
writeFileSync48(path110, `${JSON.stringify(data, null, 2)}
|
|
45564
45659
|
`);
|
|
45565
45660
|
return path110;
|
|
@@ -46583,8 +46678,8 @@ function renderEntry(entry, frame) {
|
|
|
46583
46678
|
import { format } from "util";
|
|
46584
46679
|
|
|
46585
46680
|
// src/commands/review/createReviewLogSink.ts
|
|
46586
|
-
import { appendFileSync as appendFileSync3, mkdirSync as
|
|
46587
|
-
import { join as
|
|
46681
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync34 } from "fs";
|
|
46682
|
+
import { join as join98 } from "path";
|
|
46588
46683
|
var LOG_FILE = "review.log";
|
|
46589
46684
|
function createReviewLogSink() {
|
|
46590
46685
|
let logPath2;
|
|
@@ -46600,8 +46695,8 @@ function createReviewLogSink() {
|
|
|
46600
46695
|
`);
|
|
46601
46696
|
},
|
|
46602
46697
|
attach(reviewDir) {
|
|
46603
|
-
|
|
46604
|
-
logPath2 =
|
|
46698
|
+
mkdirSync34(reviewDir, { recursive: true });
|
|
46699
|
+
logPath2 = join98(reviewDir, LOG_FILE);
|
|
46605
46700
|
const lines = [
|
|
46606
46701
|
"",
|
|
46607
46702
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -46940,7 +47035,7 @@ async function runReviewers(reviewers, context) {
|
|
|
46940
47035
|
}
|
|
46941
47036
|
|
|
46942
47037
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
46943
|
-
import { existsSync as
|
|
47038
|
+
import { existsSync as existsSync77, unlinkSync as unlinkSync18 } from "fs";
|
|
46944
47039
|
|
|
46945
47040
|
// src/commands/review/synthesise.ts
|
|
46946
47041
|
import { readFileSync as readFileSync64 } from "fs";
|
|
@@ -47174,7 +47269,7 @@ async function synthesise(paths, options2) {
|
|
|
47174
47269
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
47175
47270
|
async function synthesiseAfterReviewers(input) {
|
|
47176
47271
|
const { paths, failures } = input;
|
|
47177
|
-
if (input.anyFresh &&
|
|
47272
|
+
if (input.anyFresh && existsSync77(paths.synthesisPath)) {
|
|
47178
47273
|
unlinkSync18(paths.synthesisPath);
|
|
47179
47274
|
}
|
|
47180
47275
|
const synthesisResult = await synthesise(paths, { multi: input.multi });
|
|
@@ -47388,9 +47483,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
47388
47483
|
|
|
47389
47484
|
// src/commands/review/buildReviewPaths.ts
|
|
47390
47485
|
import { homedir as homedir27 } from "os";
|
|
47391
|
-
import { basename as basename27, join as
|
|
47486
|
+
import { basename as basename27, join as join99 } from "path";
|
|
47392
47487
|
function buildReviewPaths(repoRoot2, key) {
|
|
47393
|
-
const reviewDir =
|
|
47488
|
+
const reviewDir = join99(
|
|
47394
47489
|
homedir27(),
|
|
47395
47490
|
".assist",
|
|
47396
47491
|
"reviews",
|
|
@@ -47399,10 +47494,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
47399
47494
|
);
|
|
47400
47495
|
return {
|
|
47401
47496
|
reviewDir,
|
|
47402
|
-
requestPath:
|
|
47403
|
-
claudePath:
|
|
47404
|
-
codexPath:
|
|
47405
|
-
synthesisPath:
|
|
47497
|
+
requestPath: join99(reviewDir, "request.md"),
|
|
47498
|
+
claudePath: join99(reviewDir, "claude.md"),
|
|
47499
|
+
codexPath: join99(reviewDir, "codex.md"),
|
|
47500
|
+
synthesisPath: join99(reviewDir, "synthesis.md")
|
|
47406
47501
|
};
|
|
47407
47502
|
}
|
|
47408
47503
|
|
|
@@ -47440,14 +47535,14 @@ function fetchExistingComments() {
|
|
|
47440
47535
|
}
|
|
47441
47536
|
|
|
47442
47537
|
// src/commands/review/prepareReviewDir.ts
|
|
47443
|
-
import { existsSync as
|
|
47538
|
+
import { existsSync as existsSync78, mkdirSync as mkdirSync35, unlinkSync as unlinkSync19, writeFileSync as writeFileSync49 } from "fs";
|
|
47444
47539
|
function clearReviewFiles(paths) {
|
|
47445
47540
|
for (const path110 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
47446
|
-
if (
|
|
47541
|
+
if (existsSync78(path110)) unlinkSync19(path110);
|
|
47447
47542
|
}
|
|
47448
47543
|
}
|
|
47449
47544
|
function prepareReviewDir(paths, requestBody, force) {
|
|
47450
|
-
|
|
47545
|
+
mkdirSync35(paths.reviewDir, { recursive: true });
|
|
47451
47546
|
if (force) clearReviewFiles(paths);
|
|
47452
47547
|
writeFileSync49(paths.requestPath, requestBody);
|
|
47453
47548
|
}
|
|
@@ -48345,7 +48440,7 @@ import path92 from "path";
|
|
|
48345
48440
|
import chalk273 from "chalk";
|
|
48346
48441
|
|
|
48347
48442
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
48348
|
-
import { existsSync as
|
|
48443
|
+
import { existsSync as existsSync79, readFileSync as readFileSync67, writeFileSync as writeFileSync50 } from "fs";
|
|
48349
48444
|
import path91 from "path";
|
|
48350
48445
|
|
|
48351
48446
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -48415,7 +48510,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
48415
48510
|
function updateScopedRulesIndex(root2) {
|
|
48416
48511
|
const directories = scopedRuleDirectories(root2);
|
|
48417
48512
|
const rootFile = path91.join(root2, "CLAUDE.md");
|
|
48418
|
-
const before =
|
|
48513
|
+
const before = existsSync79(rootFile) ? readFileSync67(rootFile, "utf8") : "";
|
|
48419
48514
|
const after = upsertScopedRulesPointer(before, directories);
|
|
48420
48515
|
if (after !== before) writeFileSync50(rootFile, after);
|
|
48421
48516
|
return directories;
|
|
@@ -48468,7 +48563,7 @@ function listRules(target, options2 = {}) {
|
|
|
48468
48563
|
}
|
|
48469
48564
|
|
|
48470
48565
|
// src/commands/rules/addRule.ts
|
|
48471
|
-
import { existsSync as
|
|
48566
|
+
import { existsSync as existsSync81, readFileSync as readFileSync69, writeFileSync as writeFileSync51 } from "fs";
|
|
48472
48567
|
import path95 from "path";
|
|
48473
48568
|
import chalk275 from "chalk";
|
|
48474
48569
|
|
|
@@ -48505,7 +48600,7 @@ function nextRuleCode(root2) {
|
|
|
48505
48600
|
}
|
|
48506
48601
|
|
|
48507
48602
|
// src/commands/rules/resolveRuleScope.ts
|
|
48508
|
-
import { existsSync as
|
|
48603
|
+
import { existsSync as existsSync80 } from "fs";
|
|
48509
48604
|
import path94 from "path";
|
|
48510
48605
|
function resolveRuleScope(target) {
|
|
48511
48606
|
const resolved = path94.resolve(target);
|
|
@@ -48515,7 +48610,7 @@ function resolveRuleScope(target) {
|
|
|
48515
48610
|
let current2 = startDir;
|
|
48516
48611
|
while (true) {
|
|
48517
48612
|
const candidate = path94.join(current2, "CLAUDE.md");
|
|
48518
|
-
if (
|
|
48613
|
+
if (existsSync80(candidate)) return candidate;
|
|
48519
48614
|
if (current2 === root2 || current2 === path94.dirname(current2)) break;
|
|
48520
48615
|
current2 = path94.dirname(current2);
|
|
48521
48616
|
}
|
|
@@ -48524,7 +48619,7 @@ function resolveRuleScope(target) {
|
|
|
48524
48619
|
|
|
48525
48620
|
// src/commands/rules/addRule.ts
|
|
48526
48621
|
function read3(file) {
|
|
48527
|
-
return
|
|
48622
|
+
return existsSync81(file) ? readFileSync69(file, "utf8") : "";
|
|
48528
48623
|
}
|
|
48529
48624
|
function addRule(text19, options2) {
|
|
48530
48625
|
const rule = text19.trim();
|
|
@@ -49959,7 +50054,7 @@ function registerTestflight(program) {
|
|
|
49959
50054
|
}
|
|
49960
50055
|
|
|
49961
50056
|
// src/commands/transcript/clean.ts
|
|
49962
|
-
import { existsSync as
|
|
50057
|
+
import { existsSync as existsSync86 } from "fs";
|
|
49963
50058
|
|
|
49964
50059
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
49965
50060
|
function pad2(value, width2) {
|
|
@@ -50237,7 +50332,7 @@ function clean(file, options2 = {}) {
|
|
|
50237
50332
|
);
|
|
50238
50333
|
process.exit(1);
|
|
50239
50334
|
}
|
|
50240
|
-
if (!
|
|
50335
|
+
if (!existsSync86(file)) {
|
|
50241
50336
|
console.error(`Error: VTT file not found: ${file}`);
|
|
50242
50337
|
process.exit(1);
|
|
50243
50338
|
}
|
|
@@ -50320,21 +50415,21 @@ async function configure() {
|
|
|
50320
50415
|
}
|
|
50321
50416
|
|
|
50322
50417
|
// src/commands/transcript/list.ts
|
|
50323
|
-
import { existsSync as
|
|
50324
|
-
import { join as
|
|
50418
|
+
import { existsSync as existsSync87, readdirSync as readdirSync26, statSync as statSync14 } from "fs";
|
|
50419
|
+
import { join as join111 } from "path";
|
|
50325
50420
|
function list5() {
|
|
50326
50421
|
const { vttDir } = getTranscriptConfig();
|
|
50327
|
-
if (!
|
|
50422
|
+
if (!existsSync87(vttDir)) return;
|
|
50328
50423
|
for (const entry of readdirSync26(vttDir)) {
|
|
50329
50424
|
if (!entry.endsWith(".vtt")) continue;
|
|
50330
|
-
if (statSync14(
|
|
50425
|
+
if (statSync14(join111(vttDir, entry)).isDirectory()) continue;
|
|
50331
50426
|
console.log(entry);
|
|
50332
50427
|
}
|
|
50333
50428
|
}
|
|
50334
50429
|
|
|
50335
50430
|
// src/commands/transcript/move.ts
|
|
50336
|
-
import { existsSync as
|
|
50337
|
-
import { basename as basename31, join as
|
|
50431
|
+
import { existsSync as existsSync88, mkdirSync as mkdirSync41, renameSync as renameSync5, writeFileSync as writeFileSync56 } from "fs";
|
|
50432
|
+
import { basename as basename31, join as join112 } from "path";
|
|
50338
50433
|
|
|
50339
50434
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
50340
50435
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -50344,9 +50439,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
50344
50439
|
// src/commands/transcript/move.ts
|
|
50345
50440
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
50346
50441
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
50347
|
-
const processedDir =
|
|
50348
|
-
|
|
50349
|
-
renameSync5(sourcePath,
|
|
50442
|
+
const processedDir = join112(vttDir, "processed");
|
|
50443
|
+
mkdirSync41(processedDir, { recursive: true });
|
|
50444
|
+
renameSync5(sourcePath, join112(processedDir, filename));
|
|
50350
50445
|
}
|
|
50351
50446
|
function move(file, options2) {
|
|
50352
50447
|
const { date, client } = options2;
|
|
@@ -50356,25 +50451,25 @@ function move(file, options2) {
|
|
|
50356
50451
|
}
|
|
50357
50452
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
50358
50453
|
const filename = basename31(file);
|
|
50359
|
-
const sourcePath =
|
|
50360
|
-
if (!
|
|
50454
|
+
const sourcePath = join112(vttDir, filename);
|
|
50455
|
+
if (!existsSync88(sourcePath)) {
|
|
50361
50456
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
50362
50457
|
process.exit(1);
|
|
50363
50458
|
}
|
|
50364
50459
|
const base = basename31(filename, ".vtt").replace(/ Transcription$/, "");
|
|
50365
50460
|
const outputName = `${date} ${base}.md`;
|
|
50366
|
-
const formattedDir =
|
|
50367
|
-
|
|
50368
|
-
const formattedPath =
|
|
50461
|
+
const formattedDir = join112(transcriptsDir, client);
|
|
50462
|
+
mkdirSync41(formattedDir, { recursive: true });
|
|
50463
|
+
const formattedPath = join112(formattedDir, outputName);
|
|
50369
50464
|
writeFileSync56(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
50370
50465
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
50371
|
-
const summaryPath =
|
|
50466
|
+
const summaryPath = join112(summaryDir, client, outputName);
|
|
50372
50467
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
50373
50468
|
console.log(`Summary target: ${summaryPath}`);
|
|
50374
50469
|
}
|
|
50375
50470
|
|
|
50376
50471
|
// src/commands/transcript/merge.ts
|
|
50377
|
-
import { existsSync as
|
|
50472
|
+
import { existsSync as existsSync89, writeFileSync as writeFileSync57 } from "fs";
|
|
50378
50473
|
import { basename as basename32 } from "path";
|
|
50379
50474
|
|
|
50380
50475
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -50518,7 +50613,7 @@ function widenAudience(passages) {
|
|
|
50518
50613
|
|
|
50519
50614
|
// src/commands/transcript/merge.ts
|
|
50520
50615
|
function readSource3(file) {
|
|
50521
|
-
if (!
|
|
50616
|
+
if (!existsSync89(file)) failTranscript(`VTT file not found: ${file}`);
|
|
50522
50617
|
const cues = readCleanedCues(file);
|
|
50523
50618
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
50524
50619
|
return { path: file, name: basename32(file), cues };
|
|
@@ -50991,7 +51086,7 @@ function configKeys2() {
|
|
|
50991
51086
|
}
|
|
50992
51087
|
|
|
50993
51088
|
// src/commands/verify/forbiddenStrings.ts
|
|
50994
|
-
import { existsSync as
|
|
51089
|
+
import { existsSync as existsSync90, readFileSync as readFileSync76 } from "fs";
|
|
50995
51090
|
|
|
50996
51091
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
50997
51092
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -51032,7 +51127,7 @@ function forbiddenStrings() {
|
|
|
51032
51127
|
const cache7 = /* @__PURE__ */ new Map();
|
|
51033
51128
|
const readJson = (file) => {
|
|
51034
51129
|
if (cache7.has(file)) return cache7.get(file);
|
|
51035
|
-
if (!
|
|
51130
|
+
if (!existsSync90(file)) {
|
|
51036
51131
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
51037
51132
|
process.exit(1);
|
|
51038
51133
|
}
|
|
@@ -51463,7 +51558,7 @@ function clearBuildPending() {
|
|
|
51463
51558
|
}
|
|
51464
51559
|
|
|
51465
51560
|
// src/commands/watch/isSyncPending.ts
|
|
51466
|
-
import { existsSync as
|
|
51561
|
+
import { existsSync as existsSync91 } from "fs";
|
|
51467
51562
|
|
|
51468
51563
|
// src/commands/watch/syncPendingPath.ts
|
|
51469
51564
|
function syncPendingPath(cwd) {
|
|
@@ -51473,7 +51568,7 @@ function syncPendingPath(cwd) {
|
|
|
51473
51568
|
// src/commands/watch/isSyncPending.ts
|
|
51474
51569
|
function isSyncPending() {
|
|
51475
51570
|
try {
|
|
51476
|
-
return
|
|
51571
|
+
return existsSync91(syncPendingPath());
|
|
51477
51572
|
} catch {
|
|
51478
51573
|
return false;
|
|
51479
51574
|
}
|
|
@@ -51600,7 +51695,7 @@ function resolveParams(params, cliArgs) {
|
|
|
51600
51695
|
}
|
|
51601
51696
|
|
|
51602
51697
|
// src/commands/run/resolveRunCwd.ts
|
|
51603
|
-
import { existsSync as
|
|
51698
|
+
import { existsSync as existsSync92 } from "fs";
|
|
51604
51699
|
import { resolve as resolve31 } from "path";
|
|
51605
51700
|
var MissingRunCwdError = class extends Error {
|
|
51606
51701
|
constructor(runName, cwd) {
|
|
@@ -51615,7 +51710,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
51615
51710
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
51616
51711
|
if (!config.cwd) return void 0;
|
|
51617
51712
|
const cwd = resolve31(baseDir, config.cwd);
|
|
51618
|
-
if (!
|
|
51713
|
+
if (!existsSync92(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
51619
51714
|
return cwd;
|
|
51620
51715
|
}
|
|
51621
51716
|
|
|
@@ -51950,10 +52045,10 @@ ${buildWatchReport(from)}`);
|
|
|
51950
52045
|
}
|
|
51951
52046
|
|
|
51952
52047
|
// src/commands/watch/consumeMarker.ts
|
|
51953
|
-
import { existsSync as
|
|
52048
|
+
import { existsSync as existsSync93, rmSync as rmSync14 } from "fs";
|
|
51954
52049
|
function consumeMarker(path110) {
|
|
51955
52050
|
try {
|
|
51956
|
-
if (!
|
|
52051
|
+
if (!existsSync93(path110)) return false;
|
|
51957
52052
|
rmSync14(path110);
|
|
51958
52053
|
return true;
|
|
51959
52054
|
} catch {
|
|
@@ -52251,7 +52346,7 @@ function registerWatch(program) {
|
|
|
52251
52346
|
// src/commands/roam/postRoamActivity.ts
|
|
52252
52347
|
import { execFileSync as execFileSync31 } from "child_process";
|
|
52253
52348
|
import { readdirSync as readdirSync28, readFileSync as readFileSync78, statSync as statSync15 } from "fs";
|
|
52254
|
-
import { join as
|
|
52349
|
+
import { join as join113 } from "path";
|
|
52255
52350
|
function findPortFile(roamDir) {
|
|
52256
52351
|
let entries;
|
|
52257
52352
|
try {
|
|
@@ -52260,7 +52355,7 @@ function findPortFile(roamDir) {
|
|
|
52260
52355
|
return void 0;
|
|
52261
52356
|
}
|
|
52262
52357
|
const candidates = entries.filter((name2) => /^roam-local-api(-[^.]+)?\.port$/.test(name2)).map((name2) => {
|
|
52263
|
-
const path110 =
|
|
52358
|
+
const path110 = join113(roamDir, name2);
|
|
52264
52359
|
try {
|
|
52265
52360
|
return { path: path110, mtimeMs: statSync15(path110).mtimeMs };
|
|
52266
52361
|
} catch {
|
|
@@ -52277,7 +52372,7 @@ var PID_BY_APP = {
|
|
|
52277
52372
|
function postRoamActivity(app, event) {
|
|
52278
52373
|
const appData = process.env.APPDATA;
|
|
52279
52374
|
if (!appData) return;
|
|
52280
|
-
const portFile = findPortFile(
|
|
52375
|
+
const portFile = findPortFile(join113(appData, "Roam"));
|
|
52281
52376
|
if (!portFile) return;
|
|
52282
52377
|
let port;
|
|
52283
52378
|
try {
|
|
@@ -52460,7 +52555,7 @@ function link2() {
|
|
|
52460
52555
|
}
|
|
52461
52556
|
|
|
52462
52557
|
// src/commands/run/add.ts
|
|
52463
|
-
import { mkdirSync as
|
|
52558
|
+
import { mkdirSync as mkdirSync42, writeFileSync as writeFileSync61 } from "fs";
|
|
52464
52559
|
import { dirname as dirname49 } from "path";
|
|
52465
52560
|
|
|
52466
52561
|
// src/commands/run/editRepoRunList.ts
|
|
@@ -52636,11 +52731,11 @@ function requireParsedArgs() {
|
|
|
52636
52731
|
}
|
|
52637
52732
|
|
|
52638
52733
|
// src/commands/run/runCommandFilePath.ts
|
|
52639
|
-
import { join as
|
|
52734
|
+
import { join as join114 } from "path";
|
|
52640
52735
|
function runCommandFilePath(name2) {
|
|
52641
52736
|
const segments = name2.split(":");
|
|
52642
52737
|
const file = `${segments.pop()}.md`;
|
|
52643
|
-
return
|
|
52738
|
+
return join114(".claude", "commands", ...segments, file);
|
|
52644
52739
|
}
|
|
52645
52740
|
|
|
52646
52741
|
// src/commands/run/add.ts
|
|
@@ -52657,7 +52752,7 @@ function saveProjectRunConfig(entry) {
|
|
|
52657
52752
|
}
|
|
52658
52753
|
function createCommandFile(name2) {
|
|
52659
52754
|
const filePath = runCommandFilePath(name2);
|
|
52660
|
-
|
|
52755
|
+
mkdirSync42(dirname49(filePath), { recursive: true });
|
|
52661
52756
|
const content = `---
|
|
52662
52757
|
description: Run ${name2}
|
|
52663
52758
|
---
|
|
@@ -52784,8 +52879,8 @@ function registerRunAdd(runCommand) {
|
|
|
52784
52879
|
}
|
|
52785
52880
|
|
|
52786
52881
|
// src/commands/run/remove.ts
|
|
52787
|
-
import { existsSync as
|
|
52788
|
-
import { dirname as dirname50, join as
|
|
52882
|
+
import { existsSync as existsSync94, readdirSync as readdirSync29, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
52883
|
+
import { dirname as dirname50, join as join115 } from "path";
|
|
52789
52884
|
|
|
52790
52885
|
// src/commands/run/removeRepoRunConfig.ts
|
|
52791
52886
|
function isNamed(entry, name2) {
|
|
@@ -52803,17 +52898,17 @@ function removeRepoRunConfig(name2, repoName, cwd = process.cwd()) {
|
|
|
52803
52898
|
|
|
52804
52899
|
// src/commands/run/remove.ts
|
|
52805
52900
|
function removeEmptyNamespaceDirs(filePath) {
|
|
52806
|
-
const root2 =
|
|
52901
|
+
const root2 = join115(".claude", "commands");
|
|
52807
52902
|
for (let dir = dirname50(filePath); dir !== root2; dir = dirname50(dir)) {
|
|
52808
|
-
if (!
|
|
52903
|
+
if (!existsSync94(dir) || readdirSync29(dir).length > 0) return;
|
|
52809
52904
|
rmdirSync(dir);
|
|
52810
52905
|
}
|
|
52811
52906
|
}
|
|
52812
52907
|
function deleteCommandFile(name2) {
|
|
52813
52908
|
const filePath = runCommandFilePath(name2);
|
|
52814
|
-
const legacyPath =
|
|
52909
|
+
const legacyPath = join115(".claude", "commands", `${name2}.md`);
|
|
52815
52910
|
for (const path110 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
52816
|
-
if (
|
|
52911
|
+
if (existsSync94(path110)) {
|
|
52817
52912
|
unlinkSync20(path110);
|
|
52818
52913
|
console.log(`Deleted command file: ${path110}`);
|
|
52819
52914
|
}
|
|
@@ -53551,12 +53646,12 @@ function toSessionViewInfo({
|
|
|
53551
53646
|
}
|
|
53552
53647
|
|
|
53553
53648
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
53554
|
-
import { existsSync as
|
|
53649
|
+
import { existsSync as existsSync95 } from "fs";
|
|
53555
53650
|
function joinRefusal(session) {
|
|
53556
53651
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
53557
53652
|
if (session.closing === true) return "the session is closing";
|
|
53558
53653
|
if (!session.cwd) return "the session has no working directory";
|
|
53559
|
-
if (!
|
|
53654
|
+
if (!existsSync95(session.cwd))
|
|
53560
53655
|
return "the session's workspace no longer exists";
|
|
53561
53656
|
return void 0;
|
|
53562
53657
|
}
|
|
@@ -53646,8 +53741,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
53646
53741
|
}
|
|
53647
53742
|
|
|
53648
53743
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
53649
|
-
import { existsSync as
|
|
53650
|
-
import { join as
|
|
53744
|
+
import { existsSync as existsSync96 } from "fs";
|
|
53745
|
+
import { join as join116, resolve as resolve32 } from "path";
|
|
53651
53746
|
function isLive(session) {
|
|
53652
53747
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
53653
53748
|
}
|
|
@@ -53656,7 +53751,7 @@ function isLiveAgent(session) {
|
|
|
53656
53751
|
}
|
|
53657
53752
|
function serverRunDirs(sessions, file) {
|
|
53658
53753
|
return new Set(
|
|
53659
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) =>
|
|
53754
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync96(join116(dir, file)))
|
|
53660
53755
|
);
|
|
53661
53756
|
}
|
|
53662
53757
|
function findServerParents(sessions, file) {
|
|
@@ -54386,7 +54481,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
54386
54481
|
}
|
|
54387
54482
|
|
|
54388
54483
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
54389
|
-
import { existsSync as
|
|
54484
|
+
import { existsSync as existsSync97, rmSync as rmSync15, writeFileSync as writeFileSync62 } from "fs";
|
|
54390
54485
|
var paused;
|
|
54391
54486
|
var wake;
|
|
54392
54487
|
var holdReleased = false;
|
|
@@ -54399,7 +54494,7 @@ function persist2(value) {
|
|
|
54399
54494
|
}
|
|
54400
54495
|
var autoUpdateControl = {
|
|
54401
54496
|
paused: () => {
|
|
54402
|
-
paused ??=
|
|
54497
|
+
paused ??= existsSync97(daemonPaths.autoUpdatePaused);
|
|
54403
54498
|
return paused;
|
|
54404
54499
|
},
|
|
54405
54500
|
setPaused: (value) => {
|
|
@@ -54498,7 +54593,17 @@ var DIVERGED_EXIT_CODE = 3;
|
|
|
54498
54593
|
async function settleLap(lap, { end, tail }, deps2) {
|
|
54499
54594
|
const how = end.signal ? `killed by ${end.signal}` : `exited ${end.code}`;
|
|
54500
54595
|
if (end.code === DIVERGED_EXIT_CODE) {
|
|
54501
|
-
|
|
54596
|
+
let held;
|
|
54597
|
+
try {
|
|
54598
|
+
held = deps2.escalate(tail);
|
|
54599
|
+
} catch (error) {
|
|
54600
|
+
const reason4 = error instanceof Error ? error.message : String(error);
|
|
54601
|
+
await backOff(
|
|
54602
|
+
`lap ${lap} ${how} (divergence); escalation refused: ${reason4.replaceAll("\n", " ")}`,
|
|
54603
|
+
deps2
|
|
54604
|
+
);
|
|
54605
|
+
return void 0;
|
|
54606
|
+
}
|
|
54502
54607
|
deps2.note(`lap ${lap} ${how} (divergence); escalated to session ${held}`);
|
|
54503
54608
|
return held;
|
|
54504
54609
|
}
|
|
@@ -54556,12 +54661,12 @@ function trimWatcherLog(cwd) {
|
|
|
54556
54661
|
}
|
|
54557
54662
|
|
|
54558
54663
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
54559
|
-
import { appendFileSync as appendFileSync4, mkdirSync as
|
|
54664
|
+
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync43 } from "fs";
|
|
54560
54665
|
import { dirname as dirname51 } from "path";
|
|
54561
54666
|
function appendWatcherLog(cwd, data) {
|
|
54562
54667
|
try {
|
|
54563
54668
|
const path110 = watcherLogPath(cwd);
|
|
54564
|
-
|
|
54669
|
+
mkdirSync43(dirname51(path110), { recursive: true });
|
|
54565
54670
|
appendFileSync4(path110, data);
|
|
54566
54671
|
} catch {
|
|
54567
54672
|
}
|
|
@@ -54576,6 +54681,21 @@ function detectExistingWorktree(cwd) {
|
|
|
54576
54681
|
return void 0;
|
|
54577
54682
|
}
|
|
54578
54683
|
|
|
54684
|
+
// src/commands/sessions/daemon/worktree/noteWorktreeHarness.ts
|
|
54685
|
+
function noteWorktreeHarness(session) {
|
|
54686
|
+
const path110 = session.worktree?.path;
|
|
54687
|
+
if (!path110) return;
|
|
54688
|
+
const harness = session.commandType === "claude" ? resolveHarness(session.harness) : session.harness;
|
|
54689
|
+
if (!harness) return;
|
|
54690
|
+
try {
|
|
54691
|
+
recordWorktreeHarness(path110, harness);
|
|
54692
|
+
} catch (error) {
|
|
54693
|
+
daemonLog(
|
|
54694
|
+
`worktree ${path110} harness ${harness} not recorded for session ${session.id}: ${error instanceof Error ? error.message : String(error)}`
|
|
54695
|
+
);
|
|
54696
|
+
}
|
|
54697
|
+
}
|
|
54698
|
+
|
|
54579
54699
|
// src/commands/sessions/daemon/worktree/refuseUnallocatedStart.ts
|
|
54580
54700
|
function refuseUnallocatedStart(session, path110, error, startHeld) {
|
|
54581
54701
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
@@ -54594,6 +54714,7 @@ function bindNewWorktree(session, alloc, notify2, startHeld = () => {
|
|
|
54594
54714
|
if (alloc.kind !== "worktree" || !alloc.cwd || !alloc.clone || !session)
|
|
54595
54715
|
return;
|
|
54596
54716
|
session.worktree = { path: alloc.cwd, clone: alloc.clone };
|
|
54717
|
+
noteWorktreeHarness(session);
|
|
54597
54718
|
if (alloc.created) {
|
|
54598
54719
|
session.awaitingSeed = true;
|
|
54599
54720
|
const { cwd, clone } = alloc;
|
|
@@ -54634,13 +54755,13 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
54634
54755
|
}
|
|
54635
54756
|
|
|
54636
54757
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
54637
|
-
import { existsSync as
|
|
54758
|
+
import { existsSync as existsSync99 } from "fs";
|
|
54638
54759
|
|
|
54639
54760
|
// src/commands/sessions/daemon/worktree/holdsNoCheckout.ts
|
|
54640
|
-
import { existsSync as
|
|
54641
|
-
import { join as
|
|
54761
|
+
import { existsSync as existsSync98 } from "fs";
|
|
54762
|
+
import { join as join117 } from "path";
|
|
54642
54763
|
function holdsNoCheckout(path110) {
|
|
54643
|
-
return
|
|
54764
|
+
return existsSync98(path110) && !existsSync98(join117(path110, ".git"));
|
|
54644
54765
|
}
|
|
54645
54766
|
|
|
54646
54767
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
@@ -54678,14 +54799,14 @@ function notACheckout(cwd, error) {
|
|
|
54678
54799
|
return holdsNoCheckout(cwd) && /not a git repository/i.test(error);
|
|
54679
54800
|
}
|
|
54680
54801
|
async function checkDurability(cwd) {
|
|
54681
|
-
if (!
|
|
54802
|
+
if (!existsSync99(cwd)) return treeIsGone;
|
|
54682
54803
|
const probes = durabilityProbes(cwd);
|
|
54683
54804
|
let step3 = probes.next();
|
|
54684
54805
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
54685
54806
|
return step3.value;
|
|
54686
54807
|
}
|
|
54687
54808
|
function checkDurabilitySync(cwd) {
|
|
54688
|
-
if (!
|
|
54809
|
+
if (!existsSync99(cwd)) return treeIsGone;
|
|
54689
54810
|
const probes = durabilityProbes(cwd);
|
|
54690
54811
|
let step3 = probes.next();
|
|
54691
54812
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -54790,18 +54911,27 @@ function escalateDivergence(ctx, cwd, output) {
|
|
|
54790
54911
|
);
|
|
54791
54912
|
return live.id;
|
|
54792
54913
|
}
|
|
54914
|
+
const harness = loadConfigFrom(clone).harness.engine;
|
|
54915
|
+
const adapter = harnessAdapter(harness);
|
|
54916
|
+
const blocker = launchBlocker(adapter, divergenceEscalationFeature);
|
|
54917
|
+
if (blocker) {
|
|
54918
|
+
daemonLog(
|
|
54919
|
+
`auto-update diverged in the clone ${clone}: no escalation spawned, ${blocker.replaceAll("\n", " ")}`
|
|
54920
|
+
);
|
|
54921
|
+
throw new Error(blocker);
|
|
54922
|
+
}
|
|
54793
54923
|
const prompt = divergencePrompt(clone, output);
|
|
54794
54924
|
const id = allocateAndBind(
|
|
54795
54925
|
ctx,
|
|
54796
54926
|
clone,
|
|
54797
54927
|
(sid, resolvedCwd) => ({
|
|
54798
|
-
...createSession(sid, { prompt, cwd: resolvedCwd ?? clone }),
|
|
54928
|
+
...createSession(sid, { prompt, cwd: resolvedCwd ?? clone, harness }),
|
|
54799
54929
|
divergenceEscalation: true
|
|
54800
54930
|
}),
|
|
54801
54931
|
{ inPlace: true }
|
|
54802
54932
|
);
|
|
54803
54933
|
daemonLog(
|
|
54804
|
-
`auto-update diverged in the clone ${clone}: spawned escalation session ${id} to diagnose it`
|
|
54934
|
+
`auto-update diverged in the clone ${clone}: spawned ${adapter.label} escalation session ${id} to diagnose it`
|
|
54805
54935
|
);
|
|
54806
54936
|
return id;
|
|
54807
54937
|
}
|
|
@@ -54969,17 +55099,17 @@ function setStatus2(session, newStatus) {
|
|
|
54969
55099
|
}
|
|
54970
55100
|
|
|
54971
55101
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
54972
|
-
import { existsSync as
|
|
55102
|
+
import { existsSync as existsSync101 } from "fs";
|
|
54973
55103
|
import { basename as basename34 } from "path";
|
|
54974
55104
|
|
|
54975
55105
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
54976
|
-
import { existsSync as
|
|
54977
|
-
import { join as
|
|
55106
|
+
import { existsSync as existsSync100 } from "fs";
|
|
55107
|
+
import { join as join119 } from "path";
|
|
54978
55108
|
|
|
54979
55109
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
54980
55110
|
import { statSync as statSync16 } from "fs";
|
|
54981
55111
|
import { rm as rm3 } from "fs/promises";
|
|
54982
|
-
import { join as
|
|
55112
|
+
import { join as join118 } from "path";
|
|
54983
55113
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
54984
55114
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
54985
55115
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -55008,7 +55138,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
55008
55138
|
return { removed: true };
|
|
55009
55139
|
}
|
|
55010
55140
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
55011
|
-
return statSync16(
|
|
55141
|
+
return statSync16(join118(worktreePath, ".git"), {
|
|
55012
55142
|
throwIfNoEntry: false
|
|
55013
55143
|
})?.isDirectory() === true;
|
|
55014
55144
|
}
|
|
@@ -55049,7 +55179,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
55049
55179
|
);
|
|
55050
55180
|
}
|
|
55051
55181
|
function strandedReason(worktreePath, cause) {
|
|
55052
|
-
if (!
|
|
55182
|
+
if (!existsSync100(join119(worktreePath, ".git")))
|
|
55053
55183
|
return "its .git link is already gone";
|
|
55054
55184
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
55055
55185
|
return "git no longer recognises it as a working tree";
|
|
@@ -55101,7 +55231,7 @@ function reason3(error) {
|
|
|
55101
55231
|
|
|
55102
55232
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
55103
55233
|
async function reapWorktree(worktreePath, force = false) {
|
|
55104
|
-
if (!
|
|
55234
|
+
if (!existsSync101(worktreePath)) {
|
|
55105
55235
|
forgetWorktree(worktreePath);
|
|
55106
55236
|
daemonLog(
|
|
55107
55237
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -55126,7 +55256,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
55126
55256
|
}
|
|
55127
55257
|
function owningClone(worktreePath) {
|
|
55128
55258
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
55129
|
-
if (recorded &&
|
|
55259
|
+
if (recorded && existsSync101(recorded)) return recorded;
|
|
55130
55260
|
const detected = mainWorktree(worktreePath);
|
|
55131
55261
|
if (detected) return detected;
|
|
55132
55262
|
daemonLog(
|
|
@@ -55443,12 +55573,12 @@ async function closeBlockReason(sessionId2, tree) {
|
|
|
55443
55573
|
}
|
|
55444
55574
|
|
|
55445
55575
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
55446
|
-
import { existsSync as
|
|
55576
|
+
import { existsSync as existsSync102, watch } from "fs";
|
|
55447
55577
|
var DEBOUNCE_MS = 500;
|
|
55448
55578
|
var POLL_MS5 = 3e4;
|
|
55449
55579
|
function watchGitState(cwd, onChange) {
|
|
55450
55580
|
const common = gitCommonDir(cwd);
|
|
55451
|
-
if (!common || !
|
|
55581
|
+
if (!common || !existsSync102(common)) return void 0;
|
|
55452
55582
|
const watchers = [
|
|
55453
55583
|
watchGitDir(common, onChange),
|
|
55454
55584
|
pollGitState(cwd, onChange)
|
|
@@ -56189,10 +56319,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
56189
56319
|
}
|
|
56190
56320
|
|
|
56191
56321
|
// src/commands/sessions/daemon/exitReason.ts
|
|
56192
|
-
import { existsSync as
|
|
56322
|
+
import { existsSync as existsSync103 } from "fs";
|
|
56193
56323
|
import { resolve as resolve34 } from "path";
|
|
56194
56324
|
function exitDetail(session) {
|
|
56195
|
-
if (session.cwd && !
|
|
56325
|
+
if (session.cwd && !existsSync103(session.cwd))
|
|
56196
56326
|
return `working directory ${session.cwd} no longer exists`;
|
|
56197
56327
|
return missingRunConfigCwd(session);
|
|
56198
56328
|
}
|
|
@@ -56206,7 +56336,7 @@ function missingRunConfigCwd(session) {
|
|
|
56206
56336
|
const config = resolveRunConfig(session.runName, dir);
|
|
56207
56337
|
if (!config?.cwd) return void 0;
|
|
56208
56338
|
const configured = resolve34(runConfigBaseDirFrom(dir), config.cwd);
|
|
56209
|
-
if (
|
|
56339
|
+
if (existsSync103(configured)) return void 0;
|
|
56210
56340
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
56211
56341
|
}
|
|
56212
56342
|
|
|
@@ -56254,17 +56384,36 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
56254
56384
|
}
|
|
56255
56385
|
|
|
56256
56386
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
56257
|
-
import { existsSync as
|
|
56387
|
+
import { existsSync as existsSync104, mkdirSync as mkdirSync44, watch as watch2 } from "fs";
|
|
56258
56388
|
import { dirname as dirname52 } from "path";
|
|
56259
56389
|
|
|
56260
56390
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
56261
56391
|
function applyActivityToSession(session, activity2) {
|
|
56262
56392
|
session.activity = activity2;
|
|
56263
|
-
if (activity2.harness
|
|
56393
|
+
if (activity2.harness && activity2.harness !== session.harness) {
|
|
56394
|
+
session.harness = activity2.harness;
|
|
56395
|
+
noteWorktreeHarness(session);
|
|
56396
|
+
}
|
|
56264
56397
|
if (activity2.claudeSessionId)
|
|
56265
56398
|
session.claudeSessionId = activity2.claudeSessionId;
|
|
56266
56399
|
}
|
|
56267
56400
|
|
|
56401
|
+
// src/commands/sessions/daemon/claimedByOthers.ts
|
|
56402
|
+
var boundBy = /* @__PURE__ */ new Map();
|
|
56403
|
+
function claimedByOthers(session) {
|
|
56404
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
56405
|
+
for (const [conversationId, owner] of boundBy) {
|
|
56406
|
+
if (owner.harnessSessionId !== conversationId)
|
|
56407
|
+
boundBy.delete(conversationId);
|
|
56408
|
+
else if (owner !== session) claimed.add(conversationId);
|
|
56409
|
+
}
|
|
56410
|
+
return claimed;
|
|
56411
|
+
}
|
|
56412
|
+
function claimConversation(session, conversationId) {
|
|
56413
|
+
session.harnessSessionId = conversationId;
|
|
56414
|
+
boundBy.set(conversationId, session);
|
|
56415
|
+
}
|
|
56416
|
+
|
|
56268
56417
|
// src/commands/sessions/daemon/recordBoundPhaseSession.ts
|
|
56269
56418
|
import os6 from "os";
|
|
56270
56419
|
async function recordBoundPhaseSession(session, conversationId) {
|
|
@@ -56290,6 +56439,19 @@ async function recordBoundPhaseSession(session, conversationId) {
|
|
|
56290
56439
|
}
|
|
56291
56440
|
}
|
|
56292
56441
|
|
|
56442
|
+
// src/commands/sessions/daemon/completeBinding.ts
|
|
56443
|
+
function completeBinding(session, bound, notify2, onBound) {
|
|
56444
|
+
const { conversationId, harnessLabel: harnessLabel2 } = bound;
|
|
56445
|
+
claimConversation(session, conversationId);
|
|
56446
|
+
daemonLog(
|
|
56447
|
+
`session ${session.id} bound to ${harnessLabel2} conversation ${conversationId}`
|
|
56448
|
+
);
|
|
56449
|
+
rememberSessionTitle(session);
|
|
56450
|
+
void recordBoundPhaseSession(session, conversationId);
|
|
56451
|
+
onBound?.(session);
|
|
56452
|
+
notify2();
|
|
56453
|
+
}
|
|
56454
|
+
|
|
56293
56455
|
// src/commands/sessions/daemon/bindConversation.ts
|
|
56294
56456
|
var POLL_MS6 = 1e3;
|
|
56295
56457
|
var MAX_ATTEMPTS3 = 120;
|
|
@@ -56303,29 +56465,26 @@ function bindConversation(session, notify2, launchedAt = session.startedAt, onBo
|
|
|
56303
56465
|
const bind = (latestBind.get(session) ?? 0) + 1;
|
|
56304
56466
|
latestBind.set(session, bind);
|
|
56305
56467
|
const superseded = () => !!adapter.conversation.boundId(session) || latestBind.get(session) !== bind;
|
|
56306
|
-
const
|
|
56468
|
+
const sinceMs = launchedAt - START_SLACK_MS;
|
|
56307
56469
|
let attemptsLeft = MAX_ATTEMPTS3;
|
|
56308
56470
|
const schedule = () => setTimeout(() => void poll(), POLL_MS6).unref();
|
|
56309
56471
|
const poll = async () => {
|
|
56310
56472
|
if (superseded()) return;
|
|
56311
|
-
const conversationId = await discover(
|
|
56473
|
+
const conversationId = await discover({
|
|
56474
|
+
cwd,
|
|
56475
|
+
launchedAt,
|
|
56476
|
+
sinceMs,
|
|
56477
|
+
claimed: claimedByOthers(session)
|
|
56478
|
+
});
|
|
56312
56479
|
if (superseded()) return;
|
|
56313
|
-
if (!conversationId) {
|
|
56314
|
-
|
|
56315
|
-
|
|
56316
|
-
|
|
56317
|
-
|
|
56318
|
-
|
|
56319
|
-
|
|
56320
|
-
|
|
56321
|
-
session.harnessSessionId = conversationId;
|
|
56322
|
-
daemonLog(
|
|
56323
|
-
`session ${session.id} bound to ${adapter.label} conversation ${conversationId}`
|
|
56324
|
-
);
|
|
56325
|
-
rememberSessionTitle(session);
|
|
56326
|
-
void recordBoundPhaseSession(session, conversationId);
|
|
56327
|
-
onBound?.(session);
|
|
56328
|
-
notify2();
|
|
56480
|
+
if (conversationId && !claimedByOthers(session).has(conversationId)) {
|
|
56481
|
+
const bound = { conversationId, harnessLabel: adapter.label };
|
|
56482
|
+
completeBinding(session, bound, notify2, onBound);
|
|
56483
|
+
} else if (--attemptsLeft > 0) schedule();
|
|
56484
|
+
else
|
|
56485
|
+
daemonLog(
|
|
56486
|
+
`session ${session.id} found no ${adapter.label} conversation to bind`
|
|
56487
|
+
);
|
|
56329
56488
|
};
|
|
56330
56489
|
schedule();
|
|
56331
56490
|
}
|
|
@@ -56412,7 +56571,7 @@ function watchActivity(session, notify2, onConversation) {
|
|
|
56412
56571
|
const path110 = activityPath(session.id);
|
|
56413
56572
|
const dir = dirname52(path110);
|
|
56414
56573
|
try {
|
|
56415
|
-
|
|
56574
|
+
mkdirSync44(dir, { recursive: true });
|
|
56416
56575
|
} catch {
|
|
56417
56576
|
return;
|
|
56418
56577
|
}
|
|
@@ -56433,7 +56592,7 @@ function watchActivity(session, notify2, onConversation) {
|
|
|
56433
56592
|
if (timer) clearTimeout(timer);
|
|
56434
56593
|
timer = setTimeout(read4, DEBOUNCE_MS2);
|
|
56435
56594
|
});
|
|
56436
|
-
if (
|
|
56595
|
+
if (existsSync104(path110)) read4();
|
|
56437
56596
|
}
|
|
56438
56597
|
function refreshActivity(session) {
|
|
56439
56598
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -56516,10 +56675,10 @@ function reportSilentFailure(session, clients) {
|
|
|
56516
56675
|
import { watch as watch3 } from "fs";
|
|
56517
56676
|
|
|
56518
56677
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
56519
|
-
import { mkdirSync as
|
|
56678
|
+
import { mkdirSync as mkdirSync45 } from "fs";
|
|
56520
56679
|
function ensureProjectDirExists(dir, sessionId2) {
|
|
56521
56680
|
try {
|
|
56522
|
-
|
|
56681
|
+
mkdirSync45(dir, { recursive: true });
|
|
56523
56682
|
return true;
|
|
56524
56683
|
} catch (error) {
|
|
56525
56684
|
daemonLog(
|
|
@@ -57497,39 +57656,17 @@ function conversationResumeOutcome(session) {
|
|
|
57497
57656
|
};
|
|
57498
57657
|
}
|
|
57499
57658
|
|
|
57500
|
-
// src/shared/harnessResumesConversation.ts
|
|
57501
|
-
function harnessResumesConversation(harness) {
|
|
57502
|
-
return harnessCapability(harness, "conversation.resume").supported;
|
|
57503
|
-
}
|
|
57504
|
-
|
|
57505
|
-
// src/commands/sessions/daemon/codexRespawnPlan.ts
|
|
57506
|
-
function codexRespawnPlan(session) {
|
|
57507
|
-
const { harnessSessionId, cwd, initialPrompt } = session;
|
|
57508
|
-
if (harnessSessionId)
|
|
57509
|
-
return {
|
|
57510
|
-
spawn: () => spawnCodex({
|
|
57511
|
-
resumeSessionId: harnessSessionId,
|
|
57512
|
-
cwd,
|
|
57513
|
-
sessionId: session.id
|
|
57514
|
-
}),
|
|
57515
|
-
status: "waiting"
|
|
57516
|
-
};
|
|
57517
|
-
if (!cwd && !initialPrompt) return null;
|
|
57518
|
-
return {
|
|
57519
|
-
spawn: () => spawnCodex({ prompt: initialPrompt, cwd, sessionId: session.id }),
|
|
57520
|
-
status: initialPrompt ? "running" : "waiting"
|
|
57521
|
-
};
|
|
57522
|
-
}
|
|
57523
|
-
|
|
57524
57659
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
57525
|
-
|
|
57526
|
-
|
|
57527
|
-
|
|
57528
|
-
|
|
57529
|
-
|
|
57660
|
+
function interactiveRespawnPlan(session) {
|
|
57661
|
+
const adapter = harnessAdapter(session.harness);
|
|
57662
|
+
if (!resolveCapability(adapter.capabilities, "conversation.resume").supported)
|
|
57663
|
+
return null;
|
|
57664
|
+
const { cwd, initialPrompt, design, auto } = session;
|
|
57665
|
+
const resumeId = adapter.conversation.findResumable(session);
|
|
57666
|
+
if (resumeId)
|
|
57530
57667
|
return {
|
|
57531
|
-
spawn: () =>
|
|
57532
|
-
|
|
57668
|
+
spawn: () => adapter.interactive({
|
|
57669
|
+
resumeId,
|
|
57533
57670
|
cwd,
|
|
57534
57671
|
sessionId: session.id,
|
|
57535
57672
|
design,
|
|
@@ -57537,21 +57674,22 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
57537
57674
|
}),
|
|
57538
57675
|
status: "waiting"
|
|
57539
57676
|
};
|
|
57540
|
-
if (initialPrompt) return
|
|
57541
|
-
|
|
57542
|
-
return null;
|
|
57677
|
+
if (!initialPrompt && !cwd) return null;
|
|
57678
|
+
return freshPlan(session, adapter, initialPrompt);
|
|
57543
57679
|
}
|
|
57544
|
-
function
|
|
57545
|
-
const
|
|
57680
|
+
function freshPlan(session, adapter, prompt) {
|
|
57681
|
+
const conversationId = preassignedId(adapter);
|
|
57546
57682
|
return {
|
|
57547
57683
|
spawn: () => {
|
|
57548
|
-
session.claudeSessionId =
|
|
57684
|
+
session.claudeSessionId = void 0;
|
|
57685
|
+
session.harnessSessionId = void 0;
|
|
57686
|
+
Object.assign(session, adapter.activityIdentity(conversationId));
|
|
57549
57687
|
rememberSessionTitle(session);
|
|
57550
|
-
return
|
|
57688
|
+
return adapter.interactive({
|
|
57551
57689
|
prompt,
|
|
57552
|
-
cwd,
|
|
57690
|
+
cwd: session.cwd,
|
|
57553
57691
|
sessionId: session.id,
|
|
57554
|
-
|
|
57692
|
+
conversationId,
|
|
57555
57693
|
design: session.design,
|
|
57556
57694
|
auto: session.auto
|
|
57557
57695
|
});
|
|
@@ -57560,20 +57698,10 @@ function freshClaudePlan(session, prompt, cwd) {
|
|
|
57560
57698
|
};
|
|
57561
57699
|
}
|
|
57562
57700
|
|
|
57563
|
-
// src/commands/sessions/daemon/interactiveHarnessRespawn.ts
|
|
57564
|
-
function interactiveHarnessRespawn(session) {
|
|
57565
|
-
if (resolveHarness(session.harness) === "codex")
|
|
57566
|
-
return codexRespawnPlan(session);
|
|
57567
|
-
return interactiveRespawnPlan(
|
|
57568
|
-
session,
|
|
57569
|
-
harnessResumesConversation(session.harness)
|
|
57570
|
-
);
|
|
57571
|
-
}
|
|
57572
|
-
|
|
57573
57701
|
// src/commands/sessions/daemon/respawnPlan.ts
|
|
57574
57702
|
function respawnPlan(session) {
|
|
57575
57703
|
const { commandType, cwd, assistArgs } = session;
|
|
57576
|
-
if (commandType === "claude") return
|
|
57704
|
+
if (commandType === "claude") return interactiveRespawnPlan(session);
|
|
57577
57705
|
if (commandType === "assist" && assistArgs) {
|
|
57578
57706
|
const idle = session.status === "waiting";
|
|
57579
57707
|
let resume;
|
|
@@ -58130,15 +58258,47 @@ function relaunchWrapperSession(id, persisted, base, status2) {
|
|
|
58130
58258
|
return session;
|
|
58131
58259
|
}
|
|
58132
58260
|
|
|
58133
|
-
// src/
|
|
58134
|
-
function
|
|
58135
|
-
|
|
58261
|
+
// src/shared/harnessResumesConversation.ts
|
|
58262
|
+
function harnessResumesConversation(harness) {
|
|
58263
|
+
return harnessCapability(harness, "conversation.resume").supported;
|
|
58264
|
+
}
|
|
58265
|
+
|
|
58266
|
+
// src/commands/sessions/daemon/relaunchUnwrittenConversation.ts
|
|
58267
|
+
function relaunchUnwrittenConversation(adapter, { id, persisted, base }, plan2) {
|
|
58268
|
+
const conversationId = resolveCapability(
|
|
58269
|
+
adapter.capabilities,
|
|
58270
|
+
"conversation.preassignId"
|
|
58271
|
+
).supported ? adapter.conversation.boundId(persisted) : void 0;
|
|
58272
|
+
const pty2 = adapter.interactive({
|
|
58273
|
+
conversationId,
|
|
58274
|
+
prompt: persisted.initialPrompt,
|
|
58275
|
+
cwd: persisted.cwd,
|
|
58276
|
+
sessionId: id,
|
|
58277
|
+
design: persisted.design,
|
|
58278
|
+
auto: persisted.auto
|
|
58279
|
+
});
|
|
58280
|
+
const idle = persisted.initialPrompt ? false : plan2.idle;
|
|
58281
|
+
return {
|
|
58282
|
+
...idle ? waitingSession(base, persisted, pty2) : runningSession(base, persisted, pty2),
|
|
58283
|
+
claudeSessionId: void 0,
|
|
58284
|
+
harnessSessionId: void 0,
|
|
58285
|
+
...adapter.activityIdentity(conversationId)
|
|
58286
|
+
};
|
|
58287
|
+
}
|
|
58288
|
+
|
|
58289
|
+
// src/commands/sessions/daemon/restoreConversation.ts
|
|
58290
|
+
function restoreConversation(adapter, restored, status2) {
|
|
58291
|
+
const { id, persisted, base } = restored;
|
|
58136
58292
|
const plan2 = restoreResumePlan(persisted, status2);
|
|
58137
|
-
const
|
|
58138
|
-
|
|
58293
|
+
const resumeId = adapter.conversation.findResumable(persisted);
|
|
58294
|
+
if (!resumeId) return relaunchUnwrittenConversation(adapter, restored, plan2);
|
|
58295
|
+
const pty2 = adapter.interactive({
|
|
58296
|
+
resumeId,
|
|
58139
58297
|
prompt: resumePrompt(plan2),
|
|
58140
58298
|
cwd: persisted.cwd,
|
|
58141
|
-
sessionId: id
|
|
58299
|
+
sessionId: id,
|
|
58300
|
+
design: persisted.design,
|
|
58301
|
+
auto: persisted.auto
|
|
58142
58302
|
});
|
|
58143
58303
|
return plan2.idle ? waitingSession(base, persisted, pty2) : runningSession(base, persisted, pty2);
|
|
58144
58304
|
}
|
|
@@ -58184,42 +58344,11 @@ function unresumableReason(harness) {
|
|
|
58184
58344
|
return resume.supported ? `no ${adapter.conversation.idName} was recorded before the daemon stopped, so the conversation cannot be resumed` : `${resume.reason}, so the conversation cannot be restored`;
|
|
58185
58345
|
}
|
|
58186
58346
|
|
|
58187
|
-
// src/commands/sessions/daemon/resumeViaClaude.ts
|
|
58188
|
-
function resumeViaClaude(id, persisted, base, status2) {
|
|
58189
|
-
const mode = { design: persisted.design, auto: persisted.auto };
|
|
58190
|
-
const plan2 = restoreResumePlan(persisted, status2);
|
|
58191
|
-
const resumes = hasTranscriptOnDisk(persisted);
|
|
58192
|
-
const pty2 = spawnClaude(
|
|
58193
|
-
resumes ? {
|
|
58194
|
-
resumeSessionId: persisted.claudeSessionId,
|
|
58195
|
-
prompt: resumePrompt(plan2),
|
|
58196
|
-
cwd: persisted.cwd,
|
|
58197
|
-
sessionId: id,
|
|
58198
|
-
...mode
|
|
58199
|
-
} : {
|
|
58200
|
-
claudeSessionId: persisted.claudeSessionId,
|
|
58201
|
-
prompt: persisted.initialPrompt,
|
|
58202
|
-
cwd: persisted.cwd,
|
|
58203
|
-
sessionId: id,
|
|
58204
|
-
...mode
|
|
58205
|
-
}
|
|
58206
|
-
);
|
|
58207
|
-
const idle = resumes || !persisted.initialPrompt ? plan2.idle : false;
|
|
58208
|
-
return idle ? waitingSession(base, persisted, pty2) : runningSession(base, persisted, pty2);
|
|
58209
|
-
}
|
|
58210
|
-
|
|
58211
58347
|
// src/commands/sessions/daemon/restoreInteractiveSession.ts
|
|
58212
|
-
function isCodex2(harness) {
|
|
58213
|
-
return resolveHarness(harness) === "codex";
|
|
58214
|
-
}
|
|
58215
58348
|
function restoreInteractiveSession(id, persisted, base, status2) {
|
|
58216
|
-
|
|
58217
|
-
|
|
58218
|
-
|
|
58219
|
-
if (persisted.commandType !== "run" && isCodex2(persisted.harness)) {
|
|
58220
|
-
const resumed = restoreCodexSession(id, persisted, base, status2);
|
|
58221
|
-
if (resumed) return resumed;
|
|
58222
|
-
}
|
|
58349
|
+
const adapter = harnessAdapter(persisted.harness);
|
|
58350
|
+
if (persisted.commandType !== "run" && adapter.conversation.boundId(persisted) && harnessResumesConversation(persisted.harness))
|
|
58351
|
+
return restoreConversation(adapter, { id, persisted, base }, status2);
|
|
58223
58352
|
if (persisted.commandType === "claude") {
|
|
58224
58353
|
return unrecoverableClaude(id, persisted);
|
|
58225
58354
|
}
|
|
@@ -58372,7 +58501,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
58372
58501
|
}
|
|
58373
58502
|
|
|
58374
58503
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
58375
|
-
import { existsSync as
|
|
58504
|
+
import { existsSync as existsSync106 } from "fs";
|
|
58376
58505
|
import { basename as basename37 } from "path";
|
|
58377
58506
|
|
|
58378
58507
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -58393,9 +58522,9 @@ function accountedTrees(sessions) {
|
|
|
58393
58522
|
}
|
|
58394
58523
|
|
|
58395
58524
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
58396
|
-
import { existsSync as
|
|
58525
|
+
import { existsSync as existsSync105 } from "fs";
|
|
58397
58526
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
58398
|
-
if (!
|
|
58527
|
+
if (!existsSync105(clone)) {
|
|
58399
58528
|
for (const { path: path110 } of paths) forgetWorktree(path110);
|
|
58400
58529
|
daemonLog(
|
|
58401
58530
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -58494,7 +58623,7 @@ function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
|
58494
58623
|
return;
|
|
58495
58624
|
}
|
|
58496
58625
|
daemonLog(
|
|
58497
|
-
`orphaned worktree ${orphan.path} resurfaced as stopped session ${id}: ${reason4} (${held.summary})`
|
|
58626
|
+
`orphaned worktree ${orphan.path} resurfaced as stopped ${sessions.get(id)?.harness ?? "unknown-harness"} session ${id}: ${reason4} (${held.summary})`
|
|
58498
58627
|
);
|
|
58499
58628
|
const session = sessions.get(id);
|
|
58500
58629
|
if (session) armStoppedSession(sessions, session, notify2);
|
|
@@ -58507,6 +58636,7 @@ function orphanedSession(id, recovered) {
|
|
|
58507
58636
|
name: `recovered ${basename36(orphan.path)}`,
|
|
58508
58637
|
subtitle: `${held.summary} in ${orphan.path}`,
|
|
58509
58638
|
commandType: "claude",
|
|
58639
|
+
harness: orphan.harness ?? loadConfigFrom(orphan.clone).harness.engine,
|
|
58510
58640
|
pty: null,
|
|
58511
58641
|
cwd: orphan.path,
|
|
58512
58642
|
worktree: { path: orphan.path, clone: orphan.clone },
|
|
@@ -58553,7 +58683,7 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
58553
58683
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
58554
58684
|
const accounted = accountedTrees(sessions);
|
|
58555
58685
|
const vanished = /* @__PURE__ */ new Map();
|
|
58556
|
-
for (const { path: path110, clone } of readWorktreeRegistry()) {
|
|
58686
|
+
for (const { path: path110, clone, harness } of readWorktreeRegistry()) {
|
|
58557
58687
|
if (underTempRoot(path110)) {
|
|
58558
58688
|
forgetWorktree(path110);
|
|
58559
58689
|
daemonLog(
|
|
@@ -58561,7 +58691,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
58561
58691
|
);
|
|
58562
58692
|
continue;
|
|
58563
58693
|
}
|
|
58564
|
-
if (!
|
|
58694
|
+
if (!existsSync106(path110)) {
|
|
58565
58695
|
logVanishedTree(sessions, path110);
|
|
58566
58696
|
vanished.set(clone, [
|
|
58567
58697
|
...vanished.get(clone) ?? [],
|
|
@@ -58570,7 +58700,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
58570
58700
|
continue;
|
|
58571
58701
|
}
|
|
58572
58702
|
if (accounted.has(path110)) continue;
|
|
58573
|
-
await recoverOrphan(sessions, spawnWith, { path: path110, clone }, notify2);
|
|
58703
|
+
await recoverOrphan(sessions, spawnWith, { path: path110, clone, harness }, notify2);
|
|
58574
58704
|
}
|
|
58575
58705
|
for (const [clone, paths] of vanished)
|
|
58576
58706
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -59712,8 +59842,16 @@ function addAgentToStream(ctx, targetId, request) {
|
|
|
59712
59842
|
);
|
|
59713
59843
|
return joinable;
|
|
59714
59844
|
}
|
|
59845
|
+
const harness = request.harness ?? joinable.session.harness;
|
|
59846
|
+
const blocker = launchBlocker(harnessAdapter(harness), sessionFeature);
|
|
59847
|
+
if (blocker) {
|
|
59848
|
+
daemonLog(
|
|
59849
|
+
`create: cannot add an agent to session ${targetId}: ${blocker.replaceAll("\n", " ")}`
|
|
59850
|
+
);
|
|
59851
|
+
return { reason: blocker };
|
|
59852
|
+
}
|
|
59715
59853
|
return {
|
|
59716
|
-
sessionId: spawnIntoStream(ctx, joinable.session, request)
|
|
59854
|
+
sessionId: spawnIntoStream(ctx, joinable.session, { ...request, harness })
|
|
59717
59855
|
};
|
|
59718
59856
|
}
|
|
59719
59857
|
|
|
@@ -59826,7 +59964,7 @@ import { existsSync as existsSync108 } from "fs";
|
|
|
59826
59964
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
59827
59965
|
function resumeSession(id, sessionId2, cwd, name2, holdPty, harness) {
|
|
59828
59966
|
const startedAt = Date.now();
|
|
59829
|
-
const
|
|
59967
|
+
const adapter = harnessAdapter(harness);
|
|
59830
59968
|
return {
|
|
59831
59969
|
id,
|
|
59832
59970
|
name: name2 ? `${name2.slice(0, 36)} (R)` : `Resume ${sessionId2.slice(0, 8)}`,
|
|
@@ -59838,74 +59976,43 @@ function resumeSession(id, sessionId2, cwd, name2, holdPty, harness) {
|
|
|
59838
59976
|
runningSince: null,
|
|
59839
59977
|
waitingSince: startedAt,
|
|
59840
59978
|
...startOrHoldPty(
|
|
59841
|
-
() =>
|
|
59979
|
+
() => adapter.interactive({ resumeId: sessionId2, cwd, sessionId: id }),
|
|
59842
59980
|
holdPty
|
|
59843
59981
|
),
|
|
59844
59982
|
scrollback: "",
|
|
59845
|
-
cwd,
|
|
59846
59983
|
/* why: bind the card to the conversation it is resuming so a daemon restart
|
|
59847
59984
|
* re-resumes this same transcript, not whichever .jsonl a cwd poller would
|
|
59848
59985
|
* have re-discovered (#413). */
|
|
59849
|
-
|
|
59850
|
-
|
|
59986
|
+
...adapter.conversation.toRef(sessionId2),
|
|
59987
|
+
cwd
|
|
59851
59988
|
};
|
|
59852
59989
|
}
|
|
59853
59990
|
|
|
59854
59991
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
59855
59992
|
import { existsSync as existsSync107 } from "fs";
|
|
59856
|
-
|
|
59857
|
-
|
|
59858
|
-
|
|
59859
|
-
|
|
59860
|
-
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
59861
|
-
const dir = projectDirForCwd(toCwd);
|
|
59862
|
-
if (dir === projectDirForCwd(fromCwd)) {
|
|
59863
|
-
daemonLog(
|
|
59864
|
-
`transcript ${claudeSessionId} already lives in ${dir}: resuming in the original worktree path`
|
|
59865
|
-
);
|
|
59866
|
-
return;
|
|
59867
|
-
}
|
|
59868
|
-
const dest = join119(dir, `${claudeSessionId}.jsonl`);
|
|
59869
|
-
if (existsSync106(dest)) {
|
|
59870
|
-
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
59871
|
-
return;
|
|
59872
|
-
}
|
|
59873
|
-
const source = findTranscriptPathSync(fromCwd, claudeSessionId);
|
|
59874
|
-
if (!source) {
|
|
59875
|
-
daemonLog(
|
|
59876
|
-
`transcript ${claudeSessionId} not found under ${projectDirForCwd(fromCwd)}: resuming in ${toCwd} without it`
|
|
59877
|
-
);
|
|
59878
|
-
return;
|
|
59879
|
-
}
|
|
59880
|
-
try {
|
|
59881
|
-
mkdirSync45(dir, { recursive: true });
|
|
59882
|
-
copyFileSync4(source, dest);
|
|
59883
|
-
daemonLog(
|
|
59884
|
-
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
59885
|
-
);
|
|
59886
|
-
} catch (error) {
|
|
59993
|
+
function resumeInReplacementTree(ctx, conversationId, missingCwd, name2, harness) {
|
|
59994
|
+
const adapter = harnessAdapter(harness);
|
|
59995
|
+
const blocker = launchBlocker(adapter, conversationRecoveryFeature);
|
|
59996
|
+
if (blocker) {
|
|
59887
59997
|
daemonLog(
|
|
59888
|
-
`
|
|
59998
|
+
`resume ${conversationId} refused: its tree ${missingCwd} is gone and ${blocker.replaceAll("\n", " ")}`
|
|
59889
59999
|
);
|
|
60000
|
+
throw new Error(blocker);
|
|
59890
60001
|
}
|
|
59891
|
-
}
|
|
59892
|
-
|
|
59893
|
-
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
59894
|
-
function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name2, harness) {
|
|
59895
60002
|
const clone = cloneForReapedTree(missingCwd);
|
|
59896
60003
|
daemonLog(
|
|
59897
|
-
`resuming ${
|
|
60004
|
+
`resuming ${adapter.label} conversation ${conversationId}: its tree ${missingCwd} is gone, allocating from clone ${clone}`
|
|
59898
60005
|
);
|
|
59899
60006
|
return allocateAndBind(
|
|
59900
60007
|
ctx,
|
|
59901
60008
|
clone,
|
|
59902
60009
|
(id, resolvedCwd, holdUntilSeeded) => {
|
|
59903
60010
|
const cwd = resolvedCwd ?? clone;
|
|
59904
|
-
|
|
59905
|
-
daemonLog(`session ${id} resuming ${
|
|
60011
|
+
adapter.conversation.relocate(conversationId, missingCwd, cwd);
|
|
60012
|
+
daemonLog(`session ${id} resuming ${conversationId} in ${cwd}`);
|
|
59906
60013
|
return resumeSession(
|
|
59907
60014
|
id,
|
|
59908
|
-
|
|
60015
|
+
conversationId,
|
|
59909
60016
|
cwd,
|
|
59910
60017
|
name2,
|
|
59911
60018
|
holdUntilSeeded,
|
|
@@ -59928,6 +60035,14 @@ function cloneForReapedTree(missingCwd) {
|
|
|
59928
60035
|
function resumeInTree(ctx, sessionId2, cwd, name2, harness) {
|
|
59929
60036
|
if (!existsSync108(cwd))
|
|
59930
60037
|
return resumeInReplacementTree(ctx, sessionId2, cwd, name2, harness);
|
|
60038
|
+
const blocker = launchBlocker(
|
|
60039
|
+
harnessAdapter(harness),
|
|
60040
|
+
conversationResumeFeature
|
|
60041
|
+
);
|
|
60042
|
+
if (blocker) {
|
|
60043
|
+
daemonLog(`resume ${sessionId2} refused: ${blocker.replaceAll("\n", " ")}`);
|
|
60044
|
+
throw new Error(blocker);
|
|
60045
|
+
}
|
|
59931
60046
|
const id = ctx.spawnWith(
|
|
59932
60047
|
(sid) => resumeSession(sid, sessionId2, cwd, name2, void 0, harness)
|
|
59933
60048
|
);
|
|
@@ -60419,17 +60534,24 @@ function creator(isNew, spawn13) {
|
|
|
60419
60534
|
}
|
|
60420
60535
|
sendTo(client, { type: "created", sessionId: result, isNew, traceId });
|
|
60421
60536
|
};
|
|
60537
|
+
const fail15 = (client, d, error) => {
|
|
60538
|
+
const reason4 = error instanceof Error ? error.message : String(error);
|
|
60539
|
+
daemonLog(`${d.type} failed: ${reason4}`);
|
|
60540
|
+
reply2(client, d, { error: `${d.type} failed: ${reason4}` });
|
|
60541
|
+
};
|
|
60422
60542
|
return (client, m, d) => {
|
|
60423
60543
|
if (m.links.route(client, d)) return;
|
|
60424
|
-
|
|
60544
|
+
let result;
|
|
60545
|
+
try {
|
|
60546
|
+
result = spawn13(m, d);
|
|
60547
|
+
} catch (error) {
|
|
60548
|
+
fail15(client, d, error);
|
|
60549
|
+
return;
|
|
60550
|
+
}
|
|
60425
60551
|
if (result instanceof Promise)
|
|
60426
60552
|
result.then(
|
|
60427
60553
|
(resolved) => reply2(client, d, resolved),
|
|
60428
|
-
(error) =>
|
|
60429
|
-
const reason4 = error instanceof Error ? error.message : String(error);
|
|
60430
|
-
daemonLog(`${d.type} failed: ${reason4}`);
|
|
60431
|
-
reply2(client, d, { error: `${d.type} failed: ${reason4}` });
|
|
60432
|
-
}
|
|
60554
|
+
(error) => fail15(client, d, error)
|
|
60433
60555
|
);
|
|
60434
60556
|
else reply2(client, d, result);
|
|
60435
60557
|
};
|
|
@@ -61305,14 +61427,7 @@ function spawnAssistCreate(m, d) {
|
|
|
61305
61427
|
|
|
61306
61428
|
// src/commands/sessions/daemon/spawnCreate.ts
|
|
61307
61429
|
function sessionBlocker(harness) {
|
|
61308
|
-
|
|
61309
|
-
const resolution = resolveFeature(sessionFeature, adapter);
|
|
61310
|
-
if (resolution.available) return void 0;
|
|
61311
|
-
return formatUnavailable(
|
|
61312
|
-
sessionFeature.label,
|
|
61313
|
-
adapter.label,
|
|
61314
|
-
resolution.reasons
|
|
61315
|
-
);
|
|
61430
|
+
return launchBlocker(harnessAdapter(harness), sessionFeature);
|
|
61316
61431
|
}
|
|
61317
61432
|
function spawnCreate(m, d) {
|
|
61318
61433
|
const design = d.design === true;
|
|
@@ -61323,17 +61438,17 @@ function spawnCreate(m, d) {
|
|
|
61323
61438
|
daemonLog(`create: design session (cwd=${d.cwd ?? ""})`);
|
|
61324
61439
|
if (harness)
|
|
61325
61440
|
daemonLog(`create: ${harness} session (cwd=${d.cwd ?? ""})`);
|
|
61326
|
-
const blocker = sessionBlocker(harness);
|
|
61327
|
-
if (blocker) {
|
|
61328
|
-
daemonLog(`create: refused, ${blocker.replaceAll("\n", " ")}`);
|
|
61329
|
-
return { error: blocker };
|
|
61330
|
-
}
|
|
61331
61441
|
const joinSessionId = design ? void 0 : d.joinSessionId;
|
|
61332
61442
|
if (joinSessionId) {
|
|
61333
61443
|
const joined = m.addAgent(joinSessionId, { prompt, harness, auto });
|
|
61334
61444
|
if ("sessionId" in joined) return joined.sessionId;
|
|
61335
61445
|
return { error: `Can't add an agent: ${joined.reason}.` };
|
|
61336
61446
|
}
|
|
61447
|
+
const blocker = sessionBlocker(harness);
|
|
61448
|
+
if (blocker) {
|
|
61449
|
+
daemonLog(`create: refused, ${blocker.replaceAll("\n", " ")}`);
|
|
61450
|
+
return { error: blocker };
|
|
61451
|
+
}
|
|
61337
61452
|
return m.spawn(
|
|
61338
61453
|
{
|
|
61339
61454
|
prompt,
|