@staff0rd/assist 0.354.2 → 0.355.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/claude/commands/devlog.md +10 -1
- package/dist/commands/sessions/web/bundle.js +79 -79
- package/dist/index.js +225 -195
- 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.355.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4087,23 +4087,70 @@ function buildArgs(prompt, options2) {
|
|
|
4087
4087
|
return [prompt];
|
|
4088
4088
|
}
|
|
4089
4089
|
|
|
4090
|
+
// src/commands/sessions/daemon/appendDaemonLog.ts
|
|
4091
|
+
import { appendFileSync } from "fs";
|
|
4092
|
+
function appendDaemonLog(message) {
|
|
4093
|
+
const line = `${(/* @__PURE__ */ new Date()).toISOString()} [${process.pid}] ${message}`;
|
|
4094
|
+
try {
|
|
4095
|
+
appendFileSync(daemonPaths.log, `${line}
|
|
4096
|
+
`);
|
|
4097
|
+
} catch {
|
|
4098
|
+
}
|
|
4099
|
+
}
|
|
4100
|
+
|
|
4101
|
+
// src/commands/backlog/consumePause.ts
|
|
4102
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync6, unlinkSync as unlinkSync3, writeFileSync as writeFileSync16 } from "fs";
|
|
4103
|
+
import { homedir as homedir6 } from "os";
|
|
4104
|
+
import { join as join14 } from "path";
|
|
4105
|
+
function getControlsDir() {
|
|
4106
|
+
return join14(homedir6(), ".assist", "controls");
|
|
4107
|
+
}
|
|
4108
|
+
function getPausePath(itemId) {
|
|
4109
|
+
return join14(getControlsDir(), `pause-${itemId}.json`);
|
|
4110
|
+
}
|
|
4111
|
+
function requestPause(itemId) {
|
|
4112
|
+
mkdirSync6(getControlsDir(), { recursive: true });
|
|
4113
|
+
writeFileSync16(
|
|
4114
|
+
getPausePath(itemId),
|
|
4115
|
+
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
4116
|
+
);
|
|
4117
|
+
}
|
|
4118
|
+
function isPausePending(itemId) {
|
|
4119
|
+
return existsSync17(getPausePath(itemId));
|
|
4120
|
+
}
|
|
4121
|
+
function clearPause(itemId) {
|
|
4122
|
+
try {
|
|
4123
|
+
unlinkSync3(getPausePath(itemId));
|
|
4124
|
+
} catch {
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
function consumePause(itemId) {
|
|
4128
|
+
const pausePath = getPausePath(itemId);
|
|
4129
|
+
if (!existsSync17(pausePath)) return false;
|
|
4130
|
+
try {
|
|
4131
|
+
unlinkSync3(pausePath);
|
|
4132
|
+
} catch {
|
|
4133
|
+
}
|
|
4134
|
+
return true;
|
|
4135
|
+
}
|
|
4136
|
+
|
|
4090
4137
|
// src/commands/backlog/shared.ts
|
|
4091
4138
|
import chalk37 from "chalk";
|
|
4092
4139
|
|
|
4093
4140
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
4094
|
-
import { existsSync as
|
|
4095
|
-
import { join as
|
|
4141
|
+
import { existsSync as existsSync19 } from "fs";
|
|
4142
|
+
import { join as join16 } from "path";
|
|
4096
4143
|
import chalk36 from "chalk";
|
|
4097
4144
|
|
|
4098
4145
|
// src/commands/backlog/backupLocalBacklogFiles.ts
|
|
4099
|
-
import { existsSync as
|
|
4100
|
-
import { join as
|
|
4146
|
+
import { existsSync as existsSync18, renameSync } from "fs";
|
|
4147
|
+
import { join as join15 } from "path";
|
|
4101
4148
|
var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
4102
4149
|
function backupLocalBacklogFiles(dir) {
|
|
4103
4150
|
const moved = [];
|
|
4104
4151
|
for (const name of LOCAL_FILES) {
|
|
4105
|
-
const path57 =
|
|
4106
|
-
if (
|
|
4152
|
+
const path57 = join15(dir, ".assist", name);
|
|
4153
|
+
if (existsSync18(path57)) {
|
|
4107
4154
|
renameSync(path57, `${path57}.bak`);
|
|
4108
4155
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
4109
4156
|
}
|
|
@@ -4486,7 +4533,7 @@ function parseBacklogJsonl(path57) {
|
|
|
4486
4533
|
|
|
4487
4534
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
4488
4535
|
function jsonlPath(dir) {
|
|
4489
|
-
return
|
|
4536
|
+
return join16(dir, ".assist", "backlog.jsonl");
|
|
4490
4537
|
}
|
|
4491
4538
|
async function verifyImport(orm, origin, items2, imported) {
|
|
4492
4539
|
const reloaded = await loadAllItems(orm, origin);
|
|
@@ -4502,7 +4549,7 @@ async function verifyImport(orm, origin, items2, imported) {
|
|
|
4502
4549
|
}
|
|
4503
4550
|
}
|
|
4504
4551
|
async function migrateLocalBacklog(orm, dir, origin) {
|
|
4505
|
-
if (!
|
|
4552
|
+
if (!existsSync19(jsonlPath(dir))) return;
|
|
4506
4553
|
const existing = (await loadAllItems(orm, origin)).length;
|
|
4507
4554
|
if (existing > 0) {
|
|
4508
4555
|
const moved2 = backupLocalBacklogFiles(dir);
|
|
@@ -4541,17 +4588,17 @@ async function deleteItem(orm, id2) {
|
|
|
4541
4588
|
}
|
|
4542
4589
|
|
|
4543
4590
|
// src/commands/backlog/findBacklogUp.ts
|
|
4544
|
-
import { existsSync as
|
|
4545
|
-
import { dirname as dirname13, join as
|
|
4591
|
+
import { existsSync as existsSync20 } from "fs";
|
|
4592
|
+
import { dirname as dirname13, join as join17 } from "path";
|
|
4546
4593
|
var BACKLOG_MARKERS = [
|
|
4547
|
-
|
|
4548
|
-
|
|
4594
|
+
join17(".assist", "backlog.db"),
|
|
4595
|
+
join17(".assist", "backlog.jsonl"),
|
|
4549
4596
|
"assist.backlog.yml"
|
|
4550
4597
|
];
|
|
4551
4598
|
function findBacklogUp(startDir) {
|
|
4552
4599
|
let current = startDir;
|
|
4553
4600
|
while (current !== dirname13(current)) {
|
|
4554
|
-
if (BACKLOG_MARKERS.some((marker) =>
|
|
4601
|
+
if (BACKLOG_MARKERS.some((marker) => existsSync20(join17(current, marker)))) {
|
|
4555
4602
|
return current;
|
|
4556
4603
|
}
|
|
4557
4604
|
current = dirname13(current);
|
|
@@ -4774,39 +4821,6 @@ async function prepareRun(id2) {
|
|
|
4774
4821
|
return { item, plan: plan2, startPhase };
|
|
4775
4822
|
}
|
|
4776
4823
|
|
|
4777
|
-
// src/commands/backlog/consumePause.ts
|
|
4778
|
-
import { existsSync as existsSync20, mkdirSync as mkdirSync6, unlinkSync as unlinkSync3, writeFileSync as writeFileSync16 } from "fs";
|
|
4779
|
-
import { homedir as homedir6 } from "os";
|
|
4780
|
-
import { join as join17 } from "path";
|
|
4781
|
-
function getControlsDir() {
|
|
4782
|
-
return join17(homedir6(), ".assist", "controls");
|
|
4783
|
-
}
|
|
4784
|
-
function getPausePath(itemId) {
|
|
4785
|
-
return join17(getControlsDir(), `pause-${itemId}.json`);
|
|
4786
|
-
}
|
|
4787
|
-
function requestPause(itemId) {
|
|
4788
|
-
mkdirSync6(getControlsDir(), { recursive: true });
|
|
4789
|
-
writeFileSync16(
|
|
4790
|
-
getPausePath(itemId),
|
|
4791
|
-
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
4792
|
-
);
|
|
4793
|
-
}
|
|
4794
|
-
function clearPause(itemId) {
|
|
4795
|
-
try {
|
|
4796
|
-
unlinkSync3(getPausePath(itemId));
|
|
4797
|
-
} catch {
|
|
4798
|
-
}
|
|
4799
|
-
}
|
|
4800
|
-
function consumePause(itemId) {
|
|
4801
|
-
const pausePath = getPausePath(itemId);
|
|
4802
|
-
if (!existsSync20(pausePath)) return false;
|
|
4803
|
-
try {
|
|
4804
|
-
unlinkSync3(pausePath);
|
|
4805
|
-
} catch {
|
|
4806
|
-
}
|
|
4807
|
-
return true;
|
|
4808
|
-
}
|
|
4809
|
-
|
|
4810
4824
|
// src/commands/backlog/executePhase.ts
|
|
4811
4825
|
import { randomUUID } from "crypto";
|
|
4812
4826
|
import chalk41 from "chalk";
|
|
@@ -4827,9 +4841,6 @@ Failed to launch Claude for ${context}: ${message}`)
|
|
|
4827
4841
|
}
|
|
4828
4842
|
}
|
|
4829
4843
|
|
|
4830
|
-
// src/commands/sessions/setSessionStatus.ts
|
|
4831
|
-
import { appendFileSync } from "fs";
|
|
4832
|
-
|
|
4833
4844
|
// src/commands/sessions/daemon/connectToDaemon.ts
|
|
4834
4845
|
import * as net from "net";
|
|
4835
4846
|
function connectToDaemon() {
|
|
@@ -4872,12 +4883,9 @@ async function setSessionStatus(status2) {
|
|
|
4872
4883
|
}
|
|
4873
4884
|
}
|
|
4874
4885
|
function logHookFired(status2, sessionId) {
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
`);
|
|
4879
|
-
} catch {
|
|
4880
|
-
}
|
|
4886
|
+
appendDaemonLog(
|
|
4887
|
+
`set-status hook fired: id=${sessionId ?? "none"} status=${status2}`
|
|
4888
|
+
);
|
|
4881
4889
|
}
|
|
4882
4890
|
|
|
4883
4891
|
// src/commands/backlog/buildCommentLines.ts
|
|
@@ -5230,7 +5238,12 @@ async function runPhases(item, startPhase, plan2, spawnOptions) {
|
|
|
5230
5238
|
);
|
|
5231
5239
|
phaseOptions = withoutResumeSession(phaseOptions);
|
|
5232
5240
|
if (phaseIndex < 0) return { kind: "fail" };
|
|
5233
|
-
if (consumePause(item.id))
|
|
5241
|
+
if (consumePause(item.id)) {
|
|
5242
|
+
appendDaemonLog(
|
|
5243
|
+
`backlog run ${item.id}: paused before phase ${phaseIndex + 1} \u2014 consumed pending pause request (Continue turned off)`
|
|
5244
|
+
);
|
|
5245
|
+
return { kind: "paused" };
|
|
5246
|
+
}
|
|
5234
5247
|
currentPlan = await reloadPlan(item.id) ?? currentPlan;
|
|
5235
5248
|
}
|
|
5236
5249
|
return { kind: "completed" };
|
|
@@ -5280,9 +5293,17 @@ async function run2(id2, spawnOptions) {
|
|
|
5280
5293
|
const prepared = await prepareRun(id2);
|
|
5281
5294
|
if (!prepared) return false;
|
|
5282
5295
|
await setStatus(id2, "in-progress");
|
|
5296
|
+
discardStalePause(prepared.item.id);
|
|
5283
5297
|
logProgress(id2, prepared);
|
|
5284
5298
|
return runPrepared(id2, prepared, spawnOptions);
|
|
5285
5299
|
}
|
|
5300
|
+
function discardStalePause(itemId) {
|
|
5301
|
+
if (!isPausePending(itemId)) return;
|
|
5302
|
+
clearPause(itemId);
|
|
5303
|
+
appendDaemonLog(
|
|
5304
|
+
`backlog run ${itemId}: discarded stale pause file at run start; this run starts auto-advancing (Continue on) regardless of a prior run's pause`
|
|
5305
|
+
);
|
|
5306
|
+
}
|
|
5286
5307
|
async function runPrepared(id2, prepared, spawnOptions) {
|
|
5287
5308
|
const { item } = prepared;
|
|
5288
5309
|
let { plan: plan2, startPhase } = prepared;
|
|
@@ -5900,7 +5921,8 @@ async function loadItemSummaries(orm, origin) {
|
|
|
5900
5921
|
type: items.type,
|
|
5901
5922
|
name: items.name,
|
|
5902
5923
|
status: items.status,
|
|
5903
|
-
starred: items.starred
|
|
5924
|
+
starred: items.starred,
|
|
5925
|
+
jiraKey: items.jiraKey
|
|
5904
5926
|
}).from(items).where(origin === void 0 ? void 0 : eq11(items.origin, origin)).orderBy(asc5(items.id));
|
|
5905
5927
|
return rows.map((row) => ({
|
|
5906
5928
|
id: row.id,
|
|
@@ -5908,7 +5930,8 @@ async function loadItemSummaries(orm, origin) {
|
|
|
5908
5930
|
type: row.type,
|
|
5909
5931
|
name: row.name,
|
|
5910
5932
|
status: row.status,
|
|
5911
|
-
starred: row.starred
|
|
5933
|
+
starred: row.starred,
|
|
5934
|
+
jiraKey: row.jiraKey ?? void 0
|
|
5912
5935
|
}));
|
|
5913
5936
|
}
|
|
5914
5937
|
|
|
@@ -6503,6 +6526,41 @@ function runGitStatus(cwd) {
|
|
|
6503
6526
|
}).then((r) => r.stdout);
|
|
6504
6527
|
}
|
|
6505
6528
|
|
|
6529
|
+
// src/shared/loadJson.ts
|
|
6530
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync18, writeFileSync as writeFileSync19 } from "fs";
|
|
6531
|
+
import { homedir as homedir10 } from "os";
|
|
6532
|
+
import { join as join23 } from "path";
|
|
6533
|
+
function getStoreDir() {
|
|
6534
|
+
return join23(homedir10(), ".assist");
|
|
6535
|
+
}
|
|
6536
|
+
function getStorePath(filename) {
|
|
6537
|
+
return join23(getStoreDir(), filename);
|
|
6538
|
+
}
|
|
6539
|
+
function loadJson(filename) {
|
|
6540
|
+
const path57 = getStorePath(filename);
|
|
6541
|
+
if (existsSync25(path57)) {
|
|
6542
|
+
try {
|
|
6543
|
+
return JSON.parse(readFileSync18(path57, "utf8"));
|
|
6544
|
+
} catch {
|
|
6545
|
+
return {};
|
|
6546
|
+
}
|
|
6547
|
+
}
|
|
6548
|
+
return {};
|
|
6549
|
+
}
|
|
6550
|
+
function saveJson(filename, data) {
|
|
6551
|
+
const dir = getStoreDir();
|
|
6552
|
+
if (!existsSync25(dir)) {
|
|
6553
|
+
mkdirSync10(dir, { recursive: true });
|
|
6554
|
+
}
|
|
6555
|
+
writeFileSync19(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
6556
|
+
}
|
|
6557
|
+
|
|
6558
|
+
// src/commands/sessions/web/jiraSite.ts
|
|
6559
|
+
function jiraSite(_req, res) {
|
|
6560
|
+
const config = loadJson("jira.json");
|
|
6561
|
+
respondJson(res, 200, { site: config.site ?? null });
|
|
6562
|
+
}
|
|
6563
|
+
|
|
6506
6564
|
// src/commands/news/shared.ts
|
|
6507
6565
|
import { decodeHTML } from "entities";
|
|
6508
6566
|
function extractText(xml, tag) {
|
|
@@ -6862,7 +6920,7 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
6862
6920
|
|
|
6863
6921
|
// src/commands/sessions/web/createCssHandler.ts
|
|
6864
6922
|
import { createHash as createHash2 } from "crypto";
|
|
6865
|
-
import { readFileSync as
|
|
6923
|
+
import { readFileSync as readFileSync19 } from "fs";
|
|
6866
6924
|
import { createRequire as createRequire2 } from "module";
|
|
6867
6925
|
var require3 = createRequire2(import.meta.url);
|
|
6868
6926
|
function createCssHandler(packageEntry) {
|
|
@@ -6870,7 +6928,7 @@ function createCssHandler(packageEntry) {
|
|
|
6870
6928
|
return (req, res) => {
|
|
6871
6929
|
if (!cache) {
|
|
6872
6930
|
const resolved = require3.resolve(packageEntry);
|
|
6873
|
-
const body =
|
|
6931
|
+
const body = readFileSync19(resolved, "utf8");
|
|
6874
6932
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
6875
6933
|
cache = { body, etag };
|
|
6876
6934
|
}
|
|
@@ -6902,6 +6960,7 @@ var routes2 = {
|
|
|
6902
6960
|
"POST /api/restart": restartWeb,
|
|
6903
6961
|
"GET /api/github-url": githubUrl,
|
|
6904
6962
|
"GET /api/git-status": gitStatus,
|
|
6963
|
+
"GET /api/jira-site": jiraSite,
|
|
6905
6964
|
"GET /api/pr-status": prStatus,
|
|
6906
6965
|
"GET /api/pr-list": prList,
|
|
6907
6966
|
"GET /api/news/items": listNewsItems,
|
|
@@ -7709,9 +7768,9 @@ function ensureRemoteOrigin() {
|
|
|
7709
7768
|
|
|
7710
7769
|
// src/commands/backlog/add/shared.ts
|
|
7711
7770
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
7712
|
-
import { mkdtempSync, readFileSync as
|
|
7771
|
+
import { mkdtempSync, readFileSync as readFileSync20, unlinkSync as unlinkSync6, writeFileSync as writeFileSync20 } from "fs";
|
|
7713
7772
|
import { tmpdir } from "os";
|
|
7714
|
-
import { join as
|
|
7773
|
+
import { join as join24 } from "path";
|
|
7715
7774
|
import enquirer6 from "enquirer";
|
|
7716
7775
|
async function promptType() {
|
|
7717
7776
|
const { type } = await enquirer6.prompt({
|
|
@@ -7751,15 +7810,15 @@ async function promptDescription() {
|
|
|
7751
7810
|
}
|
|
7752
7811
|
function openEditor() {
|
|
7753
7812
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
7754
|
-
const dir = mkdtempSync(
|
|
7755
|
-
const filePath =
|
|
7756
|
-
|
|
7813
|
+
const dir = mkdtempSync(join24(tmpdir(), "assist-"));
|
|
7814
|
+
const filePath = join24(dir, "description.md");
|
|
7815
|
+
writeFileSync20(filePath, "");
|
|
7757
7816
|
const result = spawnSync2(editor, [filePath], { stdio: "inherit" });
|
|
7758
7817
|
if (result.status !== 0) {
|
|
7759
7818
|
unlinkSync6(filePath);
|
|
7760
7819
|
return void 0;
|
|
7761
7820
|
}
|
|
7762
|
-
const content =
|
|
7821
|
+
const content = readFileSync20(filePath, "utf8").trim();
|
|
7763
7822
|
unlinkSync6(filePath);
|
|
7764
7823
|
return content || void 0;
|
|
7765
7824
|
}
|
|
@@ -9336,13 +9395,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
9336
9395
|
}
|
|
9337
9396
|
|
|
9338
9397
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
9339
|
-
import { mkdirSync as
|
|
9340
|
-
import { homedir as
|
|
9341
|
-
import { join as
|
|
9398
|
+
import { mkdirSync as mkdirSync11 } from "fs";
|
|
9399
|
+
import { homedir as homedir11 } from "os";
|
|
9400
|
+
import { join as join25 } from "path";
|
|
9342
9401
|
import Database from "better-sqlite3";
|
|
9343
9402
|
var _db;
|
|
9344
9403
|
function getDbDir() {
|
|
9345
|
-
return
|
|
9404
|
+
return join25(homedir11(), ".assist");
|
|
9346
9405
|
}
|
|
9347
9406
|
function initSchema2(db) {
|
|
9348
9407
|
db.exec(`
|
|
@@ -9360,8 +9419,8 @@ function initSchema2(db) {
|
|
|
9360
9419
|
function openPromptsDb(dir) {
|
|
9361
9420
|
if (_db) return _db;
|
|
9362
9421
|
const dbDir = dir ?? getDbDir();
|
|
9363
|
-
|
|
9364
|
-
const db = new Database(
|
|
9422
|
+
mkdirSync11(dbDir, { recursive: true });
|
|
9423
|
+
const db = new Database(join25(dbDir, "assist.db"));
|
|
9365
9424
|
db.pragma("journal_mode = WAL");
|
|
9366
9425
|
initSchema2(db);
|
|
9367
9426
|
_db = db;
|
|
@@ -9463,7 +9522,7 @@ function extractGraphqlQuery(args) {
|
|
|
9463
9522
|
}
|
|
9464
9523
|
|
|
9465
9524
|
// src/shared/loadCliReads.ts
|
|
9466
|
-
import { existsSync as
|
|
9525
|
+
import { existsSync as existsSync26, readFileSync as readFileSync21, writeFileSync as writeFileSync21 } from "fs";
|
|
9467
9526
|
import { dirname as dirname19, resolve as resolve8 } from "path";
|
|
9468
9527
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
9469
9528
|
var __filename3 = fileURLToPath4(import.meta.url);
|
|
@@ -9472,8 +9531,8 @@ function packageRoot() {
|
|
|
9472
9531
|
return __dirname4;
|
|
9473
9532
|
}
|
|
9474
9533
|
function readLines(path57) {
|
|
9475
|
-
if (!
|
|
9476
|
-
return
|
|
9534
|
+
if (!existsSync26(path57)) return [];
|
|
9535
|
+
return readFileSync21(path57, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
9477
9536
|
}
|
|
9478
9537
|
var cachedReads;
|
|
9479
9538
|
var cachedWrites;
|
|
@@ -9493,7 +9552,7 @@ function loadCliReads() {
|
|
|
9493
9552
|
return getCliReadsLines();
|
|
9494
9553
|
}
|
|
9495
9554
|
function saveCliReads(commands) {
|
|
9496
|
-
|
|
9555
|
+
writeFileSync21(
|
|
9497
9556
|
resolve8(packageRoot(), "allowed.cli-reads"),
|
|
9498
9557
|
`${commands.join("\n")}
|
|
9499
9558
|
`
|
|
@@ -9519,14 +9578,14 @@ function findCliWrite(command) {
|
|
|
9519
9578
|
}
|
|
9520
9579
|
|
|
9521
9580
|
// src/shared/readSettingsPerms.ts
|
|
9522
|
-
import { existsSync as
|
|
9523
|
-
import { homedir as
|
|
9524
|
-
import { join as
|
|
9581
|
+
import { existsSync as existsSync27, readFileSync as readFileSync22 } from "fs";
|
|
9582
|
+
import { homedir as homedir12 } from "os";
|
|
9583
|
+
import { join as join26 } from "path";
|
|
9525
9584
|
function readSettingsPerms(key) {
|
|
9526
9585
|
const paths = [
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9586
|
+
join26(homedir12(), ".claude", "settings.json"),
|
|
9587
|
+
join26(process.cwd(), ".claude", "settings.json"),
|
|
9588
|
+
join26(process.cwd(), ".claude", "settings.local.json")
|
|
9530
9589
|
];
|
|
9531
9590
|
const entries = [];
|
|
9532
9591
|
for (const p of paths) {
|
|
@@ -9535,9 +9594,9 @@ function readSettingsPerms(key) {
|
|
|
9535
9594
|
return entries;
|
|
9536
9595
|
}
|
|
9537
9596
|
function readPermissionArray(filePath, key) {
|
|
9538
|
-
if (!
|
|
9597
|
+
if (!existsSync27(filePath)) return [];
|
|
9539
9598
|
try {
|
|
9540
|
-
const data = JSON.parse(
|
|
9599
|
+
const data = JSON.parse(readFileSync22(filePath, "utf8"));
|
|
9541
9600
|
const arr = data?.permissions?.[key];
|
|
9542
9601
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
9543
9602
|
} catch {
|
|
@@ -9799,9 +9858,9 @@ ${reasons.join("\n")}`);
|
|
|
9799
9858
|
}
|
|
9800
9859
|
|
|
9801
9860
|
// src/commands/permitCliReads/index.ts
|
|
9802
|
-
import { existsSync as
|
|
9803
|
-
import { homedir as
|
|
9804
|
-
import { join as
|
|
9861
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync12, readFileSync as readFileSync23, writeFileSync as writeFileSync22 } from "fs";
|
|
9862
|
+
import { homedir as homedir13 } from "os";
|
|
9863
|
+
import { join as join27 } from "path";
|
|
9805
9864
|
|
|
9806
9865
|
// src/shared/checkCliAvailable.ts
|
|
9807
9866
|
import { execSync as execSync25 } from "child_process";
|
|
@@ -10090,17 +10149,17 @@ function updateSettings(cli, commands) {
|
|
|
10090
10149
|
// src/commands/permitCliReads/index.ts
|
|
10091
10150
|
function logPath(cli) {
|
|
10092
10151
|
const safeName = cli.replace(/\s+/g, "-");
|
|
10093
|
-
return
|
|
10152
|
+
return join27(homedir13(), ".assist", `cli-discover-${safeName}.log`);
|
|
10094
10153
|
}
|
|
10095
10154
|
function readCache(cli) {
|
|
10096
10155
|
const path57 = logPath(cli);
|
|
10097
|
-
if (!
|
|
10098
|
-
return
|
|
10156
|
+
if (!existsSync28(path57)) return void 0;
|
|
10157
|
+
return readFileSync23(path57, "utf8");
|
|
10099
10158
|
}
|
|
10100
10159
|
function writeCache(cli, output) {
|
|
10101
|
-
const dir =
|
|
10102
|
-
|
|
10103
|
-
|
|
10160
|
+
const dir = join27(homedir13(), ".assist");
|
|
10161
|
+
mkdirSync12(dir, { recursive: true });
|
|
10162
|
+
writeFileSync22(logPath(cli), output);
|
|
10104
10163
|
}
|
|
10105
10164
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
10106
10165
|
if (!cli) {
|
|
@@ -10227,22 +10286,22 @@ function registerCliHook(program2) {
|
|
|
10227
10286
|
}
|
|
10228
10287
|
|
|
10229
10288
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
10230
|
-
import { existsSync as
|
|
10289
|
+
import { existsSync as existsSync30, readFileSync as readFileSync25, unlinkSync as unlinkSync8, writeFileSync as writeFileSync23 } from "fs";
|
|
10231
10290
|
import chalk102 from "chalk";
|
|
10232
10291
|
|
|
10233
10292
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
10234
|
-
import { homedir as
|
|
10235
|
-
import { join as
|
|
10293
|
+
import { homedir as homedir14 } from "os";
|
|
10294
|
+
import { join as join28 } from "path";
|
|
10236
10295
|
function getRestrictedDir() {
|
|
10237
|
-
return
|
|
10296
|
+
return join28(homedir14(), ".assist", "restricted");
|
|
10238
10297
|
}
|
|
10239
10298
|
function getPinStatePath(pin) {
|
|
10240
|
-
return
|
|
10299
|
+
return join28(getRestrictedDir(), `code-comment-${pin}.json`);
|
|
10241
10300
|
}
|
|
10242
10301
|
|
|
10243
10302
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
10244
10303
|
import { readdirSync as readdirSync2, statSync as statSync3, unlinkSync as unlinkSync7 } from "fs";
|
|
10245
|
-
import { join as
|
|
10304
|
+
import { join as join29 } from "path";
|
|
10246
10305
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
10247
10306
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
10248
10307
|
let entries;
|
|
@@ -10253,7 +10312,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
10253
10312
|
}
|
|
10254
10313
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
10255
10314
|
for (const entry of entries) {
|
|
10256
|
-
const path57 =
|
|
10315
|
+
const path57 = join29(dir, entry);
|
|
10257
10316
|
try {
|
|
10258
10317
|
if (statSync3(path57).mtimeMs < cutoff) unlinkSync7(path57);
|
|
10259
10318
|
} catch {
|
|
@@ -10263,12 +10322,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
10263
10322
|
}
|
|
10264
10323
|
|
|
10265
10324
|
// src/commands/codeComment/readPinState.ts
|
|
10266
|
-
import { existsSync as
|
|
10325
|
+
import { existsSync as existsSync29, readFileSync as readFileSync24 } from "fs";
|
|
10267
10326
|
function readPinState(pin) {
|
|
10268
10327
|
const path57 = getPinStatePath(pin);
|
|
10269
|
-
if (!
|
|
10328
|
+
if (!existsSync29(path57)) return void 0;
|
|
10270
10329
|
try {
|
|
10271
|
-
const state = JSON.parse(
|
|
10330
|
+
const state = JSON.parse(readFileSync24(path57, "utf8"));
|
|
10272
10331
|
if (state.pin !== pin) return void 0;
|
|
10273
10332
|
return state;
|
|
10274
10333
|
} catch {
|
|
@@ -10285,12 +10344,12 @@ function codeCommentConfirm(pin) {
|
|
|
10285
10344
|
process.exitCode = 1;
|
|
10286
10345
|
return;
|
|
10287
10346
|
}
|
|
10288
|
-
if (!
|
|
10347
|
+
if (!existsSync30(state.file)) {
|
|
10289
10348
|
console.error(chalk102.red(`Target file no longer exists: ${state.file}`));
|
|
10290
10349
|
process.exitCode = 1;
|
|
10291
10350
|
return;
|
|
10292
10351
|
}
|
|
10293
|
-
const original =
|
|
10352
|
+
const original = readFileSync25(state.file, "utf8");
|
|
10294
10353
|
const lines = original.split("\n");
|
|
10295
10354
|
const index3 = state.line - 1;
|
|
10296
10355
|
if (index3 > lines.length) {
|
|
@@ -10306,7 +10365,7 @@ function codeCommentConfirm(pin) {
|
|
|
10306
10365
|
const indentSource = lines[index3] ?? "";
|
|
10307
10366
|
const indent2 = indentSource.match(/^\s*/)?.[0] ?? "";
|
|
10308
10367
|
lines.splice(index3, 0, `${indent2}${marker} ${state.text}`);
|
|
10309
|
-
|
|
10368
|
+
writeFileSync23(state.file, lines.join("\n"));
|
|
10310
10369
|
unlinkSync8(getPinStatePath(pin));
|
|
10311
10370
|
console.log(
|
|
10312
10371
|
chalk102.green(
|
|
@@ -10344,13 +10403,13 @@ function validateCommentText(raw, isYaml = false) {
|
|
|
10344
10403
|
}
|
|
10345
10404
|
|
|
10346
10405
|
// src/commands/codeComment/issuePin.ts
|
|
10347
|
-
import { mkdirSync as
|
|
10406
|
+
import { mkdirSync as mkdirSync13, writeFileSync as writeFileSync24 } from "fs";
|
|
10348
10407
|
import { randomInt } from "crypto";
|
|
10349
10408
|
function issuePin(file, lineNumber, text8) {
|
|
10350
10409
|
const pin = generatePin();
|
|
10351
|
-
|
|
10410
|
+
mkdirSync13(getRestrictedDir(), { recursive: true });
|
|
10352
10411
|
sweepRestrictedDir();
|
|
10353
|
-
|
|
10412
|
+
writeFileSync24(
|
|
10354
10413
|
getPinStatePath(pin),
|
|
10355
10414
|
JSON.stringify({ pin, file, line: lineNumber, text: text8 })
|
|
10356
10415
|
);
|
|
@@ -11140,7 +11199,7 @@ function registerConfig(program2) {
|
|
|
11140
11199
|
}
|
|
11141
11200
|
|
|
11142
11201
|
// src/commands/deploy/redirect.ts
|
|
11143
|
-
import { existsSync as
|
|
11202
|
+
import { existsSync as existsSync31, readFileSync as readFileSync26, writeFileSync as writeFileSync25 } from "fs";
|
|
11144
11203
|
import chalk115 from "chalk";
|
|
11145
11204
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
11146
11205
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -11149,11 +11208,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
11149
11208
|
</script>`;
|
|
11150
11209
|
function redirect() {
|
|
11151
11210
|
const indexPath = "index.html";
|
|
11152
|
-
if (!
|
|
11211
|
+
if (!existsSync31(indexPath)) {
|
|
11153
11212
|
console.log(chalk115.yellow("No index.html found"));
|
|
11154
11213
|
return;
|
|
11155
11214
|
}
|
|
11156
|
-
const content =
|
|
11215
|
+
const content = readFileSync26(indexPath, "utf8");
|
|
11157
11216
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
11158
11217
|
console.log(chalk115.dim("Trailing slash script already present"));
|
|
11159
11218
|
return;
|
|
@@ -11165,7 +11224,7 @@ function redirect() {
|
|
|
11165
11224
|
}
|
|
11166
11225
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
11167
11226
|
${content.slice(headCloseIndex)}`;
|
|
11168
|
-
|
|
11227
|
+
writeFileSync25(indexPath, newContent);
|
|
11169
11228
|
console.log(chalk115.green("Added trailing slash redirect to index.html"));
|
|
11170
11229
|
}
|
|
11171
11230
|
|
|
@@ -11181,11 +11240,11 @@ import { execFileSync as execFileSync2 } from "child_process";
|
|
|
11181
11240
|
import { basename as basename6 } from "path";
|
|
11182
11241
|
|
|
11183
11242
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
11184
|
-
import { homedir as
|
|
11185
|
-
import { join as
|
|
11186
|
-
var BLOG_REPO_ROOT =
|
|
11243
|
+
import { homedir as homedir15 } from "os";
|
|
11244
|
+
import { join as join30 } from "path";
|
|
11245
|
+
var BLOG_REPO_ROOT = join30(homedir15(), "git/blog");
|
|
11187
11246
|
function loadBlogSkipDays(repoName) {
|
|
11188
|
-
const config = loadRawYaml(
|
|
11247
|
+
const config = loadRawYaml(join30(BLOG_REPO_ROOT, "assist.yml"));
|
|
11189
11248
|
const devlog = config.devlog;
|
|
11190
11249
|
const skip2 = devlog?.skip;
|
|
11191
11250
|
return new Set(skip2?.[repoName]);
|
|
@@ -11196,17 +11255,17 @@ import { execSync as execSync26 } from "child_process";
|
|
|
11196
11255
|
import chalk116 from "chalk";
|
|
11197
11256
|
|
|
11198
11257
|
// src/shared/getRepoName.ts
|
|
11199
|
-
import { existsSync as
|
|
11200
|
-
import { basename as basename5, join as
|
|
11258
|
+
import { existsSync as existsSync32, readFileSync as readFileSync27 } from "fs";
|
|
11259
|
+
import { basename as basename5, join as join31 } from "path";
|
|
11201
11260
|
function getRepoName() {
|
|
11202
11261
|
const config = loadConfig();
|
|
11203
11262
|
if (config.devlog?.name) {
|
|
11204
11263
|
return config.devlog.name;
|
|
11205
11264
|
}
|
|
11206
|
-
const packageJsonPath =
|
|
11207
|
-
if (
|
|
11265
|
+
const packageJsonPath = join31(process.cwd(), "package.json");
|
|
11266
|
+
if (existsSync32(packageJsonPath)) {
|
|
11208
11267
|
try {
|
|
11209
|
-
const content =
|
|
11268
|
+
const content = readFileSync27(packageJsonPath, "utf8");
|
|
11210
11269
|
const pkg = JSON.parse(content);
|
|
11211
11270
|
if (pkg.name) {
|
|
11212
11271
|
return pkg.name;
|
|
@@ -11218,9 +11277,9 @@ function getRepoName() {
|
|
|
11218
11277
|
}
|
|
11219
11278
|
|
|
11220
11279
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
11221
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
11222
|
-
import { join as
|
|
11223
|
-
var DEVLOG_DIR =
|
|
11280
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync28 } from "fs";
|
|
11281
|
+
import { join as join32 } from "path";
|
|
11282
|
+
var DEVLOG_DIR = join32(BLOG_REPO_ROOT, "src/content/devlog");
|
|
11224
11283
|
function extractFrontmatter(content) {
|
|
11225
11284
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
11226
11285
|
return fm?.[1] ?? null;
|
|
@@ -11248,7 +11307,7 @@ function readDevlogFiles(callback) {
|
|
|
11248
11307
|
try {
|
|
11249
11308
|
const files = readdirSync3(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
11250
11309
|
for (const file of files) {
|
|
11251
|
-
const content =
|
|
11310
|
+
const content = readFileSync28(join32(DEVLOG_DIR, file), "utf8");
|
|
11252
11311
|
const parsed = parseFrontmatter(content, file);
|
|
11253
11312
|
if (parsed) callback(parsed);
|
|
11254
11313
|
}
|
|
@@ -11635,12 +11694,12 @@ function repos(options2) {
|
|
|
11635
11694
|
}
|
|
11636
11695
|
|
|
11637
11696
|
// src/commands/devlog/skip.ts
|
|
11638
|
-
import { writeFileSync as
|
|
11639
|
-
import { join as
|
|
11697
|
+
import { writeFileSync as writeFileSync26 } from "fs";
|
|
11698
|
+
import { join as join33 } from "path";
|
|
11640
11699
|
import chalk121 from "chalk";
|
|
11641
11700
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
11642
11701
|
function getBlogConfigPath() {
|
|
11643
|
-
return
|
|
11702
|
+
return join33(BLOG_REPO_ROOT, "assist.yml");
|
|
11644
11703
|
}
|
|
11645
11704
|
function skip(date) {
|
|
11646
11705
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -11664,7 +11723,7 @@ function skip(date) {
|
|
|
11664
11723
|
skip2[repoName] = skipDays;
|
|
11665
11724
|
devlog.skip = skip2;
|
|
11666
11725
|
config.devlog = devlog;
|
|
11667
|
-
|
|
11726
|
+
writeFileSync26(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
11668
11727
|
console.log(chalk121.green(`Added ${date} to skip list for ${repoName}`));
|
|
11669
11728
|
}
|
|
11670
11729
|
|
|
@@ -11701,16 +11760,16 @@ function registerDevlog(program2) {
|
|
|
11701
11760
|
|
|
11702
11761
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
11703
11762
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync4 } from "fs";
|
|
11704
|
-
import { join as
|
|
11763
|
+
import { join as join34 } from "path";
|
|
11705
11764
|
import chalk123 from "chalk";
|
|
11706
11765
|
|
|
11707
11766
|
// src/shared/findRepoRoot.ts
|
|
11708
|
-
import { existsSync as
|
|
11767
|
+
import { existsSync as existsSync33 } from "fs";
|
|
11709
11768
|
import path22 from "path";
|
|
11710
11769
|
function findRepoRoot(dir) {
|
|
11711
11770
|
let current = dir;
|
|
11712
11771
|
while (current !== path22.dirname(current)) {
|
|
11713
|
-
if (
|
|
11772
|
+
if (existsSync33(path22.join(current, ".git"))) {
|
|
11714
11773
|
return current;
|
|
11715
11774
|
}
|
|
11716
11775
|
current = path22.dirname(current);
|
|
@@ -11729,7 +11788,7 @@ function isLockedDll(debugDir) {
|
|
|
11729
11788
|
}
|
|
11730
11789
|
for (const file of files) {
|
|
11731
11790
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
11732
|
-
const dllPath =
|
|
11791
|
+
const dllPath = join34(debugDir, file);
|
|
11733
11792
|
try {
|
|
11734
11793
|
const fd = openSync2(dllPath, "r+");
|
|
11735
11794
|
closeSync2(fd);
|
|
@@ -11747,13 +11806,13 @@ function findFirstLockedDll(dir) {
|
|
|
11747
11806
|
return null;
|
|
11748
11807
|
}
|
|
11749
11808
|
if (entries.includes("bin")) {
|
|
11750
|
-
const locked = isLockedDll(
|
|
11809
|
+
const locked = isLockedDll(join34(dir, "bin", "Debug"));
|
|
11751
11810
|
if (locked) return locked;
|
|
11752
11811
|
}
|
|
11753
11812
|
for (const entry of entries) {
|
|
11754
11813
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
11755
11814
|
continue;
|
|
11756
|
-
const found = findFirstLockedDll(
|
|
11815
|
+
const found = findFirstLockedDll(join34(dir, entry));
|
|
11757
11816
|
if (found) return found;
|
|
11758
11817
|
}
|
|
11759
11818
|
return null;
|
|
@@ -11776,11 +11835,11 @@ async function checkBuildLocksCommand() {
|
|
|
11776
11835
|
}
|
|
11777
11836
|
|
|
11778
11837
|
// src/commands/dotnet/buildTree.ts
|
|
11779
|
-
import { readFileSync as
|
|
11838
|
+
import { readFileSync as readFileSync29 } from "fs";
|
|
11780
11839
|
import path23 from "path";
|
|
11781
11840
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
11782
11841
|
function getProjectRefs(csprojPath) {
|
|
11783
|
-
const content =
|
|
11842
|
+
const content = readFileSync29(csprojPath, "utf8");
|
|
11784
11843
|
const refs = [];
|
|
11785
11844
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
11786
11845
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -11797,7 +11856,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
11797
11856
|
for (const ref of getProjectRefs(abs)) {
|
|
11798
11857
|
const childAbs = path23.resolve(dir, ref);
|
|
11799
11858
|
try {
|
|
11800
|
-
|
|
11859
|
+
readFileSync29(childAbs);
|
|
11801
11860
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
11802
11861
|
} catch {
|
|
11803
11862
|
node.children.push({
|
|
@@ -11822,7 +11881,7 @@ function collectAllDeps(node) {
|
|
|
11822
11881
|
}
|
|
11823
11882
|
|
|
11824
11883
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
11825
|
-
import { readdirSync as readdirSync5, readFileSync as
|
|
11884
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync30, statSync as statSync4 } from "fs";
|
|
11826
11885
|
import path24 from "path";
|
|
11827
11886
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
11828
11887
|
if (depth > maxDepth) return [];
|
|
@@ -11857,7 +11916,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
11857
11916
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
11858
11917
|
for (const sln of slnFiles) {
|
|
11859
11918
|
try {
|
|
11860
|
-
const content =
|
|
11919
|
+
const content = readFileSync30(sln, "utf8");
|
|
11861
11920
|
if (pattern2.test(content)) {
|
|
11862
11921
|
matches.push(path24.relative(repoRoot, sln));
|
|
11863
11922
|
}
|
|
@@ -11921,12 +11980,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
11921
11980
|
}
|
|
11922
11981
|
|
|
11923
11982
|
// src/commands/dotnet/resolveCsproj.ts
|
|
11924
|
-
import { existsSync as
|
|
11983
|
+
import { existsSync as existsSync34 } from "fs";
|
|
11925
11984
|
import path25 from "path";
|
|
11926
11985
|
import chalk125 from "chalk";
|
|
11927
11986
|
function resolveCsproj(csprojPath) {
|
|
11928
11987
|
const resolved = path25.resolve(csprojPath);
|
|
11929
|
-
if (!
|
|
11988
|
+
if (!existsSync34(resolved)) {
|
|
11930
11989
|
console.error(chalk125.red(`File not found: ${resolved}`));
|
|
11931
11990
|
process.exit(1);
|
|
11932
11991
|
}
|
|
@@ -12094,17 +12153,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
12094
12153
|
}
|
|
12095
12154
|
|
|
12096
12155
|
// src/commands/dotnet/resolveSolution.ts
|
|
12097
|
-
import { existsSync as
|
|
12156
|
+
import { existsSync as existsSync35 } from "fs";
|
|
12098
12157
|
import path26 from "path";
|
|
12099
12158
|
import chalk129 from "chalk";
|
|
12100
12159
|
|
|
12101
12160
|
// src/commands/dotnet/findSolution.ts
|
|
12102
12161
|
import { readdirSync as readdirSync6 } from "fs";
|
|
12103
|
-
import { dirname as dirname20, join as
|
|
12162
|
+
import { dirname as dirname20, join as join35 } from "path";
|
|
12104
12163
|
import chalk128 from "chalk";
|
|
12105
12164
|
function findSlnInDir(dir) {
|
|
12106
12165
|
try {
|
|
12107
|
-
return readdirSync6(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
12166
|
+
return readdirSync6(dir).filter((f) => f.endsWith(".sln")).map((f) => join35(dir, f));
|
|
12108
12167
|
} catch {
|
|
12109
12168
|
return [];
|
|
12110
12169
|
}
|
|
@@ -12135,7 +12194,7 @@ function findSolution() {
|
|
|
12135
12194
|
function resolveSolution(sln) {
|
|
12136
12195
|
if (sln) {
|
|
12137
12196
|
const resolved = path26.resolve(sln);
|
|
12138
|
-
if (!
|
|
12197
|
+
if (!existsSync35(resolved)) {
|
|
12139
12198
|
console.error(chalk129.red(`Solution file not found: ${resolved}`));
|
|
12140
12199
|
process.exit(1);
|
|
12141
12200
|
}
|
|
@@ -12175,7 +12234,7 @@ function parseInspectReport(json) {
|
|
|
12175
12234
|
|
|
12176
12235
|
// src/commands/dotnet/runInspectCode.ts
|
|
12177
12236
|
import { execSync as execSync30 } from "child_process";
|
|
12178
|
-
import { existsSync as
|
|
12237
|
+
import { existsSync as existsSync36, readFileSync as readFileSync31, unlinkSync as unlinkSync9 } from "fs";
|
|
12179
12238
|
import { tmpdir as tmpdir3 } from "os";
|
|
12180
12239
|
import path27 from "path";
|
|
12181
12240
|
import chalk130 from "chalk";
|
|
@@ -12206,11 +12265,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
12206
12265
|
console.error(chalk130.red("jb inspectcode failed"));
|
|
12207
12266
|
process.exit(1);
|
|
12208
12267
|
}
|
|
12209
|
-
if (!
|
|
12268
|
+
if (!existsSync36(reportPath)) {
|
|
12210
12269
|
console.error(chalk130.red("Report file not generated"));
|
|
12211
12270
|
process.exit(1);
|
|
12212
12271
|
}
|
|
12213
|
-
const xml =
|
|
12272
|
+
const xml = readFileSync31(reportPath, "utf8");
|
|
12214
12273
|
unlinkSync9(reportPath);
|
|
12215
12274
|
return xml;
|
|
12216
12275
|
}
|
|
@@ -12533,9 +12592,9 @@ function aggregateCommitters(authorLists) {
|
|
|
12533
12592
|
|
|
12534
12593
|
// src/shared/runGhGraphql.ts
|
|
12535
12594
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
12536
|
-
import { unlinkSync as unlinkSync10, writeFileSync as
|
|
12595
|
+
import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync27 } from "fs";
|
|
12537
12596
|
import { tmpdir as tmpdir4 } from "os";
|
|
12538
|
-
import { join as
|
|
12597
|
+
import { join as join36 } from "path";
|
|
12539
12598
|
function buildArgs2(queryFile, vars) {
|
|
12540
12599
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
12541
12600
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -12560,8 +12619,8 @@ function throwOnGraphqlErrors(stdout) {
|
|
|
12560
12619
|
throw new Error(messages || "GraphQL request returned errors");
|
|
12561
12620
|
}
|
|
12562
12621
|
function runGhGraphql(mutation, vars) {
|
|
12563
|
-
const queryFile =
|
|
12564
|
-
|
|
12622
|
+
const queryFile = join36(tmpdir4(), `gh-query-${Date.now()}.graphql`);
|
|
12623
|
+
writeFileSync27(queryFile, mutation);
|
|
12565
12624
|
try {
|
|
12566
12625
|
const result = spawnSync3("gh", buildArgs2(queryFile, vars), {
|
|
12567
12626
|
encoding: "utf8"
|
|
@@ -12747,24 +12806,24 @@ async function countPendingHandovers(orm, origin) {
|
|
|
12747
12806
|
|
|
12748
12807
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
12749
12808
|
import {
|
|
12750
|
-
existsSync as
|
|
12809
|
+
existsSync as existsSync37,
|
|
12751
12810
|
readdirSync as readdirSync7,
|
|
12752
|
-
readFileSync as
|
|
12811
|
+
readFileSync as readFileSync32,
|
|
12753
12812
|
rmSync as rmSync2,
|
|
12754
12813
|
statSync as statSync5
|
|
12755
12814
|
} from "fs";
|
|
12756
|
-
import { basename as basename7, join as
|
|
12815
|
+
import { basename as basename7, join as join39 } from "path";
|
|
12757
12816
|
|
|
12758
12817
|
// src/commands/handover/getHandoverPath.ts
|
|
12759
|
-
import { join as
|
|
12818
|
+
import { join as join37 } from "path";
|
|
12760
12819
|
function getHandoverPath(cwd = process.cwd()) {
|
|
12761
|
-
return
|
|
12820
|
+
return join37(cwd, ".assist", "HANDOVER.md");
|
|
12762
12821
|
}
|
|
12763
12822
|
|
|
12764
12823
|
// src/commands/handover/getHandoversDir.ts
|
|
12765
|
-
import { join as
|
|
12824
|
+
import { join as join38 } from "path";
|
|
12766
12825
|
function getHandoversDir(cwd = process.cwd()) {
|
|
12767
|
-
return
|
|
12826
|
+
return join38(cwd, ".assist", "handovers");
|
|
12768
12827
|
}
|
|
12769
12828
|
|
|
12770
12829
|
// src/commands/handover/parseArchiveTimestamp.ts
|
|
@@ -12802,17 +12861,17 @@ function summariseHandoverContent(content) {
|
|
|
12802
12861
|
|
|
12803
12862
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
12804
12863
|
function collectMarkdown(dir) {
|
|
12805
|
-
if (!
|
|
12864
|
+
if (!existsSync37(dir)) return [];
|
|
12806
12865
|
const out = [];
|
|
12807
12866
|
for (const entry of readdirSync7(dir, { withFileTypes: true })) {
|
|
12808
|
-
const full =
|
|
12867
|
+
const full = join39(dir, entry.name);
|
|
12809
12868
|
if (entry.isDirectory()) out.push(...collectMarkdown(full));
|
|
12810
12869
|
else if (entry.isFile() && entry.name.endsWith(".md")) out.push(full);
|
|
12811
12870
|
}
|
|
12812
12871
|
return out;
|
|
12813
12872
|
}
|
|
12814
12873
|
async function migrateFile(orm, origin, file, createdAt) {
|
|
12815
|
-
const content =
|
|
12874
|
+
const content = readFileSync32(file, "utf8");
|
|
12816
12875
|
await saveHandover(orm, {
|
|
12817
12876
|
origin,
|
|
12818
12877
|
summary: summariseHandoverContent(content),
|
|
@@ -12829,7 +12888,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
12829
12888
|
migrated++;
|
|
12830
12889
|
}
|
|
12831
12890
|
const handoverPath = getHandoverPath(cwd);
|
|
12832
|
-
if (
|
|
12891
|
+
if (existsSync37(handoverPath)) {
|
|
12833
12892
|
await migrateFile(orm, origin, handoverPath, statSync5(handoverPath).mtime);
|
|
12834
12893
|
migrated++;
|
|
12835
12894
|
}
|
|
@@ -13044,35 +13103,6 @@ function acceptanceCriteria(issueKey) {
|
|
|
13044
13103
|
// src/commands/jira/jiraAuth.ts
|
|
13045
13104
|
import { execSync as execSync32 } from "child_process";
|
|
13046
13105
|
|
|
13047
|
-
// src/shared/loadJson.ts
|
|
13048
|
-
import { existsSync as existsSync37, mkdirSync as mkdirSync13, readFileSync as readFileSync32, writeFileSync as writeFileSync27 } from "fs";
|
|
13049
|
-
import { homedir as homedir15 } from "os";
|
|
13050
|
-
import { join as join39 } from "path";
|
|
13051
|
-
function getStoreDir() {
|
|
13052
|
-
return join39(homedir15(), ".assist");
|
|
13053
|
-
}
|
|
13054
|
-
function getStorePath(filename) {
|
|
13055
|
-
return join39(getStoreDir(), filename);
|
|
13056
|
-
}
|
|
13057
|
-
function loadJson(filename) {
|
|
13058
|
-
const path57 = getStorePath(filename);
|
|
13059
|
-
if (existsSync37(path57)) {
|
|
13060
|
-
try {
|
|
13061
|
-
return JSON.parse(readFileSync32(path57, "utf8"));
|
|
13062
|
-
} catch {
|
|
13063
|
-
return {};
|
|
13064
|
-
}
|
|
13065
|
-
}
|
|
13066
|
-
return {};
|
|
13067
|
-
}
|
|
13068
|
-
function saveJson(filename, data) {
|
|
13069
|
-
const dir = getStoreDir();
|
|
13070
|
-
if (!existsSync37(dir)) {
|
|
13071
|
-
mkdirSync13(dir, { recursive: true });
|
|
13072
|
-
}
|
|
13073
|
-
writeFileSync27(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
13074
|
-
}
|
|
13075
|
-
|
|
13076
13106
|
// src/shared/promptInput.ts
|
|
13077
13107
|
import Enquirer from "enquirer";
|
|
13078
13108
|
var prompts = Enquirer;
|