@staff0rd/assist 0.172.2 → 0.172.4
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/README.md +2 -1
- package/allowed.cli-writes +1 -0
- package/claude/commands/bug.md +2 -13
- package/claude/commands/draft.md +8 -21
- package/dist/allowed.cli-writes +1 -0
- package/dist/commands/backlog/web/bundle.js +13 -13
- package/dist/index.js +189 -207
- 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.172.
|
|
9
|
+
version: "0.172.4",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -148,14 +148,11 @@ function loadComments(db, itemId) {
|
|
|
148
148
|
// src/commands/backlog/loadPlan.ts
|
|
149
149
|
function toPhase(db, itemId, p) {
|
|
150
150
|
const tasks = db.prepare(
|
|
151
|
-
"SELECT task
|
|
151
|
+
"SELECT task FROM plan_tasks WHERE item_id = ? AND phase_idx = ? ORDER BY idx"
|
|
152
152
|
).all(itemId, p.idx);
|
|
153
153
|
const phase = {
|
|
154
154
|
name: p.name,
|
|
155
|
-
tasks: tasks.map((t) => ({
|
|
156
|
-
task: t.task,
|
|
157
|
-
...t.verify != null ? { verify: t.verify } : {}
|
|
158
|
-
}))
|
|
155
|
+
tasks: tasks.map((t) => ({ task: t.task }))
|
|
159
156
|
};
|
|
160
157
|
if (p.manual_checks) {
|
|
161
158
|
phase.manualChecks = JSON.parse(p.manual_checks);
|
|
@@ -242,7 +239,7 @@ function insertPlan(db, item) {
|
|
|
242
239
|
"INSERT INTO plan_phases (item_id, idx, name, manual_checks) VALUES (?, ?, ?, ?)"
|
|
243
240
|
);
|
|
244
241
|
const taskStmt = db.prepare(
|
|
245
|
-
"INSERT INTO plan_tasks (item_id, phase_idx, idx, task
|
|
242
|
+
"INSERT INTO plan_tasks (item_id, phase_idx, idx, task) VALUES (?, ?, ?, ?)"
|
|
246
243
|
);
|
|
247
244
|
for (let pi = 0; pi < item.plan.length; pi++) {
|
|
248
245
|
const phase = item.plan[pi];
|
|
@@ -254,7 +251,7 @@ function insertPlan(db, item) {
|
|
|
254
251
|
);
|
|
255
252
|
for (let ti = 0; ti < phase.tasks.length; ti++) {
|
|
256
253
|
const task = phase.tasks[ti];
|
|
257
|
-
taskStmt.run(item.id, pi, ti, task.task
|
|
254
|
+
taskStmt.run(item.id, pi, ti, task.task);
|
|
258
255
|
}
|
|
259
256
|
}
|
|
260
257
|
}
|
|
@@ -310,8 +307,7 @@ import { z } from "zod";
|
|
|
310
307
|
var backlogStatusSchema = z.enum(["todo", "in-progress", "done", "wontdo"]);
|
|
311
308
|
var backlogTypeSchema = z.enum(["story", "bug"]);
|
|
312
309
|
var planTaskSchema = z.strictObject({
|
|
313
|
-
task: z.string()
|
|
314
|
-
verify: z.string().optional()
|
|
310
|
+
task: z.string()
|
|
315
311
|
});
|
|
316
312
|
var planPhaseSchema = z.strictObject({
|
|
317
313
|
name: z.string(),
|
|
@@ -446,7 +442,6 @@ function initSchema(db) {
|
|
|
446
442
|
phase_idx INTEGER NOT NULL,
|
|
447
443
|
idx INTEGER NOT NULL,
|
|
448
444
|
task TEXT NOT NULL,
|
|
449
|
-
verify TEXT,
|
|
450
445
|
PRIMARY KEY (item_id, phase_idx, idx),
|
|
451
446
|
FOREIGN KEY (item_id, phase_idx) REFERENCES plan_phases(item_id, idx) ON DELETE CASCADE
|
|
452
447
|
);
|
|
@@ -618,9 +613,17 @@ function phaseLabel(item) {
|
|
|
618
613
|
` (phase ${(item.currentPhase ?? 0) + 1}/${item.plan.length})`
|
|
619
614
|
);
|
|
620
615
|
}
|
|
621
|
-
function
|
|
616
|
+
function isBlocked(item, items) {
|
|
617
|
+
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
618
|
+
return deps2.some((dep) => {
|
|
619
|
+
const target = items.find((i) => i.id === dep.targetId);
|
|
620
|
+
return target !== void 0 && target.status !== "done";
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
function dependencyLabel(item, items) {
|
|
622
624
|
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
623
625
|
if (deps2.length === 0) return "";
|
|
626
|
+
if (isBlocked(item, items)) return chalk2.red(" [blocked]");
|
|
624
627
|
return chalk2.dim(` [${deps2.length} dep${deps2.length > 1 ? "s" : ""}]`);
|
|
625
628
|
}
|
|
626
629
|
function printVerboseDetails(item) {
|
|
@@ -698,11 +701,7 @@ function buildManualCheckLines(manualChecks) {
|
|
|
698
701
|
return [];
|
|
699
702
|
}
|
|
700
703
|
function formatTasks(phase) {
|
|
701
|
-
return phase.tasks.map((t) => {
|
|
702
|
-
let line = `- ${t.task}`;
|
|
703
|
-
if (t.verify) line += ` (verify: ${t.verify})`;
|
|
704
|
-
return line;
|
|
705
|
-
}).join("\n");
|
|
704
|
+
return phase.tasks.map((t) => `- ${t.task}`).join("\n");
|
|
706
705
|
}
|
|
707
706
|
|
|
708
707
|
// src/commands/backlog/buildReviewPrompt.ts
|
|
@@ -980,48 +979,51 @@ async function runReview(item, plan2, spawnOptions) {
|
|
|
980
979
|
// src/commands/backlog/next.ts
|
|
981
980
|
function findResumable(items) {
|
|
982
981
|
return items.find(
|
|
983
|
-
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id)
|
|
982
|
+
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id) && !isBlocked(i, items)
|
|
984
983
|
);
|
|
985
984
|
}
|
|
986
|
-
|
|
987
|
-
const
|
|
985
|
+
function toChoice(item, items) {
|
|
986
|
+
const name = `${typeLabel(item.type)} #${item.id}: ${item.name}`;
|
|
987
|
+
return isBlocked(item, items) ? { name, disabled: chalk7.red("[blocked]") } : { name };
|
|
988
|
+
}
|
|
989
|
+
async function selectItem(todo, items) {
|
|
988
990
|
const { selected } = await exitOnCancel(
|
|
989
991
|
enquirer2.prompt({
|
|
990
992
|
type: "select",
|
|
991
993
|
name: "selected",
|
|
992
994
|
message: "Choose a backlog item to start:",
|
|
993
|
-
choices
|
|
995
|
+
choices: todo.map((i) => toChoice(i, items))
|
|
994
996
|
})
|
|
995
997
|
);
|
|
996
998
|
return selected.match(/#(\d+)/)?.[1] ?? "";
|
|
997
999
|
}
|
|
1000
|
+
async function pickItem(items) {
|
|
1001
|
+
const resumable = findResumable(items);
|
|
1002
|
+
if (resumable) {
|
|
1003
|
+
console.log(
|
|
1004
|
+
chalk7.bold(
|
|
1005
|
+
`Resuming in-progress item #${resumable.id}: ${resumable.name}`
|
|
1006
|
+
)
|
|
1007
|
+
);
|
|
1008
|
+
return String(resumable.id);
|
|
1009
|
+
}
|
|
1010
|
+
const todo = items.filter((i) => i.status === "todo");
|
|
1011
|
+
if (todo.length === 0) {
|
|
1012
|
+
console.log(chalk7.green("All backlog items complete."));
|
|
1013
|
+
return void 0;
|
|
1014
|
+
}
|
|
1015
|
+
if (todo.every((i) => isBlocked(i, items))) {
|
|
1016
|
+
console.log(
|
|
1017
|
+
chalk7.yellow("All remaining todo items are blocked by dependencies.")
|
|
1018
|
+
);
|
|
1019
|
+
return void 0;
|
|
1020
|
+
}
|
|
1021
|
+
return selectItem(todo, items);
|
|
1022
|
+
}
|
|
998
1023
|
async function next(options2) {
|
|
999
1024
|
while (true) {
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1002
|
-
if (inProgress) {
|
|
1003
|
-
console.log(
|
|
1004
|
-
chalk7.bold(
|
|
1005
|
-
`Resuming in-progress item #${inProgress.id}: ${inProgress.name}`
|
|
1006
|
-
)
|
|
1007
|
-
);
|
|
1008
|
-
const completed2 = await run(String(inProgress.id), options2);
|
|
1009
|
-
if (!completed2) return;
|
|
1010
|
-
continue;
|
|
1011
|
-
}
|
|
1012
|
-
const todo = items.filter((i) => i.status === "todo");
|
|
1013
|
-
if (todo.length === 0) {
|
|
1014
|
-
console.log(chalk7.green("All backlog items complete."));
|
|
1015
|
-
return;
|
|
1016
|
-
}
|
|
1017
|
-
let id;
|
|
1018
|
-
if (todo.length === 1) {
|
|
1019
|
-
const only = todo[0];
|
|
1020
|
-
console.log(chalk7.bold(`Starting #${only.id}: ${only.name}`));
|
|
1021
|
-
id = String(only.id);
|
|
1022
|
-
} else {
|
|
1023
|
-
id = await selectItem(todo);
|
|
1024
|
-
}
|
|
1025
|
+
const id = await pickItem(loadBacklog());
|
|
1026
|
+
if (id === void 0) return;
|
|
1025
1027
|
const completed = await run(id, options2);
|
|
1026
1028
|
if (!completed) return;
|
|
1027
1029
|
}
|
|
@@ -1089,9 +1091,6 @@ function plan(id) {
|
|
|
1089
1091
|
console.log(`${chalk9.bold(`Phase ${i + 1}:`)} ${phase.name}`);
|
|
1090
1092
|
for (const task of phase.tasks) {
|
|
1091
1093
|
console.log(` - ${task.task}`);
|
|
1092
|
-
if (task.verify) {
|
|
1093
|
-
console.log(` ${chalk9.dim(`verify: ${task.verify}`)}`);
|
|
1094
|
-
}
|
|
1095
1094
|
}
|
|
1096
1095
|
console.log();
|
|
1097
1096
|
}
|
|
@@ -1137,9 +1136,6 @@ import chalk12 from "chalk";
|
|
|
1137
1136
|
function printPhaseTasks(phase) {
|
|
1138
1137
|
for (const task of phase.tasks) {
|
|
1139
1138
|
console.log(` - ${task.task}`);
|
|
1140
|
-
if (task.verify) {
|
|
1141
|
-
console.log(` ${chalk12.dim(`verify: ${task.verify}`)}`);
|
|
1142
|
-
}
|
|
1143
1139
|
}
|
|
1144
1140
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
1145
1141
|
console.log(` ${chalk12.dim("Manual checks:")}`);
|
|
@@ -3708,7 +3704,7 @@ function registerCommentCommands(cmd) {
|
|
|
3708
3704
|
}
|
|
3709
3705
|
|
|
3710
3706
|
// src/commands/backlog/add/index.ts
|
|
3711
|
-
import
|
|
3707
|
+
import chalk44 from "chalk";
|
|
3712
3708
|
|
|
3713
3709
|
// src/commands/backlog/commitBacklog.ts
|
|
3714
3710
|
import { execSync as execSync14 } from "child_process";
|
|
@@ -3725,58 +3721,9 @@ function commitBacklog(id, name) {
|
|
|
3725
3721
|
}
|
|
3726
3722
|
}
|
|
3727
3723
|
|
|
3728
|
-
// src/commands/backlog/add/parseItemFile.ts
|
|
3729
|
-
import { existsSync as existsSync18, readFileSync as readFileSync15 } from "fs";
|
|
3730
|
-
import chalk44 from "chalk";
|
|
3731
|
-
import { ZodError } from "zod";
|
|
3732
|
-
var addItemSchema = backlogItemSchema.omit({ id: true, status: true });
|
|
3733
|
-
function readJsonFile(filePath) {
|
|
3734
|
-
if (!existsSync18(filePath)) {
|
|
3735
|
-
console.log(chalk44.red(`File not found: ${filePath}`));
|
|
3736
|
-
process.exitCode = 1;
|
|
3737
|
-
return void 0;
|
|
3738
|
-
}
|
|
3739
|
-
let raw;
|
|
3740
|
-
try {
|
|
3741
|
-
raw = readFileSync15(filePath, "utf-8");
|
|
3742
|
-
} catch {
|
|
3743
|
-
console.log(chalk44.red(`Failed to read file: ${filePath}`));
|
|
3744
|
-
process.exitCode = 1;
|
|
3745
|
-
return void 0;
|
|
3746
|
-
}
|
|
3747
|
-
try {
|
|
3748
|
-
return JSON.parse(raw);
|
|
3749
|
-
} catch {
|
|
3750
|
-
console.log(chalk44.red(`Invalid JSON in file: ${filePath}`));
|
|
3751
|
-
process.exitCode = 1;
|
|
3752
|
-
return void 0;
|
|
3753
|
-
}
|
|
3754
|
-
}
|
|
3755
|
-
function formatZodError(err) {
|
|
3756
|
-
if (err instanceof ZodError) {
|
|
3757
|
-
console.log(chalk44.red("Invalid backlog item schema:"));
|
|
3758
|
-
for (const issue of err.issues) {
|
|
3759
|
-
console.log(chalk44.red(` - ${issue.path.join(".")}: ${issue.message}`));
|
|
3760
|
-
}
|
|
3761
|
-
} else {
|
|
3762
|
-
console.log(chalk44.red("Invalid backlog item schema."));
|
|
3763
|
-
}
|
|
3764
|
-
}
|
|
3765
|
-
function parseItemFile(filePath) {
|
|
3766
|
-
const parsed = readJsonFile(filePath);
|
|
3767
|
-
if (parsed === void 0) return void 0;
|
|
3768
|
-
try {
|
|
3769
|
-
return addItemSchema.parse(parsed);
|
|
3770
|
-
} catch (err) {
|
|
3771
|
-
formatZodError(err);
|
|
3772
|
-
process.exitCode = 1;
|
|
3773
|
-
return void 0;
|
|
3774
|
-
}
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
3724
|
// src/commands/backlog/add/shared.ts
|
|
3778
3725
|
import { spawnSync } from "child_process";
|
|
3779
|
-
import { mkdtempSync, readFileSync as
|
|
3726
|
+
import { mkdtempSync, readFileSync as readFileSync15, unlinkSync as unlinkSync4, writeFileSync as writeFileSync14 } from "fs";
|
|
3780
3727
|
import { tmpdir } from "os";
|
|
3781
3728
|
import { join as join15 } from "path";
|
|
3782
3729
|
import enquirer6 from "enquirer";
|
|
@@ -3826,7 +3773,7 @@ function openEditor() {
|
|
|
3826
3773
|
unlinkSync4(filePath);
|
|
3827
3774
|
return void 0;
|
|
3828
3775
|
}
|
|
3829
|
-
const content =
|
|
3776
|
+
const content = readFileSync15(filePath, "utf-8").trim();
|
|
3830
3777
|
unlinkSync4(filePath);
|
|
3831
3778
|
return content || void 0;
|
|
3832
3779
|
}
|
|
@@ -3845,49 +3792,70 @@ async function promptAcceptanceCriteria() {
|
|
|
3845
3792
|
}
|
|
3846
3793
|
|
|
3847
3794
|
// src/commands/backlog/add/index.ts
|
|
3848
|
-
function
|
|
3849
|
-
const
|
|
3850
|
-
|
|
3851
|
-
const
|
|
3852
|
-
const
|
|
3853
|
-
items.push({ ...data, id, status: "todo" });
|
|
3854
|
-
saveBacklog(items);
|
|
3855
|
-
commitBacklog(id, data.name);
|
|
3856
|
-
console.log(chalk45.green(`Added item #${id}: ${data.name}`));
|
|
3857
|
-
}
|
|
3858
|
-
async function addInteractive() {
|
|
3859
|
-
const type = await promptType();
|
|
3860
|
-
const name = await promptName();
|
|
3861
|
-
const description = await promptDescription();
|
|
3862
|
-
const acceptanceCriteria2 = await promptAcceptanceCriteria();
|
|
3795
|
+
async function addFromOptions(options2) {
|
|
3796
|
+
const type = options2.type ?? await promptType();
|
|
3797
|
+
const name = options2.name ?? await promptName();
|
|
3798
|
+
const description = options2.desc ?? await promptDescription();
|
|
3799
|
+
const acceptanceCriteria2 = options2.ac ?? await promptAcceptanceCriteria();
|
|
3863
3800
|
const items = loadBacklog();
|
|
3864
3801
|
const id = getNextId(items);
|
|
3865
3802
|
items.push({
|
|
3866
3803
|
id,
|
|
3867
3804
|
type,
|
|
3868
3805
|
name,
|
|
3869
|
-
description,
|
|
3806
|
+
description: description || void 0,
|
|
3870
3807
|
acceptanceCriteria: acceptanceCriteria2,
|
|
3871
3808
|
status: "todo"
|
|
3872
3809
|
});
|
|
3873
3810
|
saveBacklog(items);
|
|
3874
3811
|
commitBacklog(id, name);
|
|
3875
|
-
console.log(
|
|
3812
|
+
console.log(chalk44.green(`Added item #${id}: ${name}`));
|
|
3876
3813
|
}
|
|
3877
3814
|
async function add(options2) {
|
|
3878
3815
|
if (!backlogExists()) {
|
|
3879
3816
|
console.log(
|
|
3880
|
-
|
|
3817
|
+
chalk44.yellow(
|
|
3881
3818
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3882
3819
|
)
|
|
3883
3820
|
);
|
|
3884
3821
|
return;
|
|
3885
3822
|
}
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3823
|
+
await addFromOptions(options2);
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
// src/commands/backlog/addPhase.ts
|
|
3827
|
+
import chalk45 from "chalk";
|
|
3828
|
+
function addPhase(id, name, options2) {
|
|
3829
|
+
const result = loadAndFindItem(id);
|
|
3830
|
+
if (!result) return;
|
|
3831
|
+
const tasks = options2.task ?? [];
|
|
3832
|
+
if (tasks.length === 0) {
|
|
3833
|
+
console.log(chalk45.red("At least one --task is required."));
|
|
3834
|
+
process.exitCode = 1;
|
|
3835
|
+
return;
|
|
3890
3836
|
}
|
|
3837
|
+
const dir = getBacklogDir();
|
|
3838
|
+
const db = openDb(dir);
|
|
3839
|
+
const itemId = result.item.id;
|
|
3840
|
+
const existing = db.prepare("SELECT COUNT(*) as cnt FROM plan_phases WHERE item_id = ?").get(itemId);
|
|
3841
|
+
const phaseIdx = existing.cnt;
|
|
3842
|
+
const manualChecks = options2.manualCheck && options2.manualCheck.length > 0 ? JSON.stringify(options2.manualCheck) : null;
|
|
3843
|
+
db.prepare(
|
|
3844
|
+
"INSERT INTO plan_phases (item_id, idx, name, manual_checks) VALUES (?, ?, ?, ?)"
|
|
3845
|
+
).run(itemId, phaseIdx, name, manualChecks);
|
|
3846
|
+
const taskStmt = db.prepare(
|
|
3847
|
+
"INSERT INTO plan_tasks (item_id, phase_idx, idx, task) VALUES (?, ?, ?, ?)"
|
|
3848
|
+
);
|
|
3849
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
3850
|
+
taskStmt.run(itemId, phaseIdx, i, tasks[i]);
|
|
3851
|
+
}
|
|
3852
|
+
exportToJsonl(db, dir);
|
|
3853
|
+
commitBacklog(itemId, result.item.name);
|
|
3854
|
+
console.log(
|
|
3855
|
+
chalk45.green(
|
|
3856
|
+
`Added phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
3857
|
+
)
|
|
3858
|
+
);
|
|
3891
3859
|
}
|
|
3892
3860
|
|
|
3893
3861
|
// src/commands/backlog/init/index.ts
|
|
@@ -3918,14 +3886,15 @@ async function list2(options2) {
|
|
|
3918
3886
|
);
|
|
3919
3887
|
return;
|
|
3920
3888
|
}
|
|
3921
|
-
const
|
|
3889
|
+
const allItems = loadBacklog();
|
|
3890
|
+
const items = filterItems(allItems, options2);
|
|
3922
3891
|
if (items.length === 0) {
|
|
3923
3892
|
console.log(chalk47.dim("Backlog is empty."));
|
|
3924
3893
|
return;
|
|
3925
3894
|
}
|
|
3926
3895
|
for (const item of items) {
|
|
3927
3896
|
console.log(
|
|
3928
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk47.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item)}`
|
|
3897
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk47.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
3929
3898
|
);
|
|
3930
3899
|
if (options2.verbose) {
|
|
3931
3900
|
printVerboseDetails(item);
|
|
@@ -3940,7 +3909,11 @@ function registerItemCommands(cmd) {
|
|
|
3940
3909
|
"--status <type>",
|
|
3941
3910
|
"Filter by status (todo, in-progress, done, wontdo)"
|
|
3942
3911
|
).option("-a, --all", "Include done/wontdo items").option("-v, --verbose", "Show all item details").action(list2);
|
|
3943
|
-
cmd.command("add").description("Add a new backlog item").option("--
|
|
3912
|
+
cmd.command("add").description("Add a new backlog item").option("--name <name>", "Item name").option("--type <type>", "Item type (story or bug)").option("--desc <description>", "Item description").option("--ac <criterion...>", "Acceptance criteria (repeatable)").action(add);
|
|
3913
|
+
cmd.command("add-phase <id> <name>").description("Add a phase to an existing backlog item").option("--task <task...>", "Task description (repeatable)").option(
|
|
3914
|
+
"--manual-check <check...>",
|
|
3915
|
+
"Manual check description (repeatable)"
|
|
3916
|
+
).action(addPhase);
|
|
3944
3917
|
}
|
|
3945
3918
|
|
|
3946
3919
|
// src/commands/backlog/link.ts
|
|
@@ -4234,7 +4207,7 @@ function extractGraphqlQuery(args) {
|
|
|
4234
4207
|
}
|
|
4235
4208
|
|
|
4236
4209
|
// src/shared/loadCliReads.ts
|
|
4237
|
-
import { existsSync as
|
|
4210
|
+
import { existsSync as existsSync18, readFileSync as readFileSync16, writeFileSync as writeFileSync15 } from "fs";
|
|
4238
4211
|
import { dirname as dirname14, resolve as resolve2 } from "path";
|
|
4239
4212
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4240
4213
|
var __filename2 = fileURLToPath4(import.meta.url);
|
|
@@ -4243,8 +4216,8 @@ function packageRoot() {
|
|
|
4243
4216
|
return __dirname4;
|
|
4244
4217
|
}
|
|
4245
4218
|
function readLines(path50) {
|
|
4246
|
-
if (!
|
|
4247
|
-
return
|
|
4219
|
+
if (!existsSync18(path50)) return [];
|
|
4220
|
+
return readFileSync16(path50, "utf-8").split("\n").filter((line) => line.trim() !== "");
|
|
4248
4221
|
}
|
|
4249
4222
|
var cachedReads;
|
|
4250
4223
|
var cachedWrites;
|
|
@@ -4290,7 +4263,7 @@ function findCliWrite(command) {
|
|
|
4290
4263
|
}
|
|
4291
4264
|
|
|
4292
4265
|
// src/shared/readSettingsPerms.ts
|
|
4293
|
-
import { existsSync as
|
|
4266
|
+
import { existsSync as existsSync19, readFileSync as readFileSync17 } from "fs";
|
|
4294
4267
|
import { homedir as homedir3 } from "os";
|
|
4295
4268
|
import { join as join16 } from "path";
|
|
4296
4269
|
function readSettingsPerms(key) {
|
|
@@ -4306,9 +4279,9 @@ function readSettingsPerms(key) {
|
|
|
4306
4279
|
return entries;
|
|
4307
4280
|
}
|
|
4308
4281
|
function readPermissionArray(filePath, key) {
|
|
4309
|
-
if (!
|
|
4282
|
+
if (!existsSync19(filePath)) return [];
|
|
4310
4283
|
try {
|
|
4311
|
-
const data = JSON.parse(
|
|
4284
|
+
const data = JSON.parse(readFileSync17(filePath, "utf-8"));
|
|
4312
4285
|
const arr = data?.permissions?.[key];
|
|
4313
4286
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
4314
4287
|
} catch {
|
|
@@ -4399,6 +4372,18 @@ function matchesConfigDeny(command) {
|
|
|
4399
4372
|
|
|
4400
4373
|
// src/shared/splitCompound.ts
|
|
4401
4374
|
import { parse } from "shell-quote";
|
|
4375
|
+
|
|
4376
|
+
// src/shared/hasUnquotedBackticks.ts
|
|
4377
|
+
var QUOTED_OR_BACKTICK_RE = /\\.|'[^']*'|"[^"]*"|(`)/g;
|
|
4378
|
+
function hasUnquotedBackticks(command) {
|
|
4379
|
+
QUOTED_OR_BACKTICK_RE.lastIndex = 0;
|
|
4380
|
+
for (let m = QUOTED_OR_BACKTICK_RE.exec(command); m !== null; m = QUOTED_OR_BACKTICK_RE.exec(command)) {
|
|
4381
|
+
if (m[1] !== void 0) return true;
|
|
4382
|
+
}
|
|
4383
|
+
return false;
|
|
4384
|
+
}
|
|
4385
|
+
|
|
4386
|
+
// src/shared/splitCompound.ts
|
|
4402
4387
|
var SEPARATOR_OPS = /* @__PURE__ */ new Set(["|", "&&", "||", ";"]);
|
|
4403
4388
|
var UNSAFE_OPS = /* @__PURE__ */ new Set(["(", ")", ">", ">>", "<", "<&", "|&", ">&"]);
|
|
4404
4389
|
var FD_REDIRECT_RE = /\d+>&\d+/g;
|
|
@@ -4414,12 +4399,9 @@ function splitCompound(command) {
|
|
|
4414
4399
|
function tokenizeCommand(command) {
|
|
4415
4400
|
const trimmed = command.trim().replace(FD_DEVNULL_RE, "").replace(FD_REDIRECT_RE, "");
|
|
4416
4401
|
if (!trimmed) return void 0;
|
|
4402
|
+
if (hasUnquotedBackticks(trimmed)) return void 0;
|
|
4417
4403
|
try {
|
|
4418
|
-
|
|
4419
|
-
const hasBacktick = tokens.some(
|
|
4420
|
-
(t) => typeof t === "string" && /`.+`/.test(t)
|
|
4421
|
-
);
|
|
4422
|
-
return hasBacktick ? void 0 : tokens;
|
|
4404
|
+
return parse(trimmed);
|
|
4423
4405
|
} catch {
|
|
4424
4406
|
return void 0;
|
|
4425
4407
|
}
|
|
@@ -4593,7 +4575,7 @@ function denyRemove(pattern2) {
|
|
|
4593
4575
|
}
|
|
4594
4576
|
|
|
4595
4577
|
// src/commands/permitCliReads/index.ts
|
|
4596
|
-
import { existsSync as
|
|
4578
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync5, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
4597
4579
|
import { homedir as homedir4 } from "os";
|
|
4598
4580
|
import { join as join17 } from "path";
|
|
4599
4581
|
|
|
@@ -4901,8 +4883,8 @@ function logPath(cli) {
|
|
|
4901
4883
|
}
|
|
4902
4884
|
function readCache(cli) {
|
|
4903
4885
|
const path50 = logPath(cli);
|
|
4904
|
-
if (!
|
|
4905
|
-
return
|
|
4886
|
+
if (!existsSync20(path50)) return void 0;
|
|
4887
|
+
return readFileSync18(path50, "utf-8");
|
|
4906
4888
|
}
|
|
4907
4889
|
function writeCache(cli, output) {
|
|
4908
4890
|
const dir = join17(homedir4(), ".assist");
|
|
@@ -5454,7 +5436,7 @@ function registerComplexity(program2) {
|
|
|
5454
5436
|
}
|
|
5455
5437
|
|
|
5456
5438
|
// src/commands/deploy/redirect.ts
|
|
5457
|
-
import { existsSync as
|
|
5439
|
+
import { existsSync as existsSync21, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
5458
5440
|
import chalk65 from "chalk";
|
|
5459
5441
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5460
5442
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -5463,11 +5445,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5463
5445
|
</script>`;
|
|
5464
5446
|
function redirect() {
|
|
5465
5447
|
const indexPath = "index.html";
|
|
5466
|
-
if (!
|
|
5448
|
+
if (!existsSync21(indexPath)) {
|
|
5467
5449
|
console.log(chalk65.yellow("No index.html found"));
|
|
5468
5450
|
return;
|
|
5469
5451
|
}
|
|
5470
|
-
const content =
|
|
5452
|
+
const content = readFileSync19(indexPath, "utf-8");
|
|
5471
5453
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5472
5454
|
console.log(chalk65.dim("Trailing slash script already present"));
|
|
5473
5455
|
return;
|
|
@@ -5509,7 +5491,7 @@ import { execSync as execSync17 } from "child_process";
|
|
|
5509
5491
|
import chalk66 from "chalk";
|
|
5510
5492
|
|
|
5511
5493
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5512
|
-
import { readdirSync, readFileSync as
|
|
5494
|
+
import { readdirSync, readFileSync as readFileSync20 } from "fs";
|
|
5513
5495
|
import { join as join19 } from "path";
|
|
5514
5496
|
var DEVLOG_DIR = join19(BLOG_REPO_ROOT, "src/content/devlog");
|
|
5515
5497
|
function extractFrontmatter(content) {
|
|
@@ -5539,7 +5521,7 @@ function readDevlogFiles(callback) {
|
|
|
5539
5521
|
try {
|
|
5540
5522
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
5541
5523
|
for (const file of files) {
|
|
5542
|
-
const content =
|
|
5524
|
+
const content = readFileSync20(join19(DEVLOG_DIR, file), "utf-8");
|
|
5543
5525
|
const parsed = parseFrontmatter(content, file);
|
|
5544
5526
|
if (parsed) callback(parsed);
|
|
5545
5527
|
}
|
|
@@ -5995,12 +5977,12 @@ import { join as join21 } from "path";
|
|
|
5995
5977
|
import chalk73 from "chalk";
|
|
5996
5978
|
|
|
5997
5979
|
// src/shared/findRepoRoot.ts
|
|
5998
|
-
import { existsSync as
|
|
5980
|
+
import { existsSync as existsSync22 } from "fs";
|
|
5999
5981
|
import path21 from "path";
|
|
6000
5982
|
function findRepoRoot(dir) {
|
|
6001
5983
|
let current = dir;
|
|
6002
5984
|
while (current !== path21.dirname(current)) {
|
|
6003
|
-
if (
|
|
5985
|
+
if (existsSync22(path21.join(current, ".git"))) {
|
|
6004
5986
|
return current;
|
|
6005
5987
|
}
|
|
6006
5988
|
current = path21.dirname(current);
|
|
@@ -6066,11 +6048,11 @@ async function checkBuildLocksCommand() {
|
|
|
6066
6048
|
}
|
|
6067
6049
|
|
|
6068
6050
|
// src/commands/dotnet/buildTree.ts
|
|
6069
|
-
import { readFileSync as
|
|
6051
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
6070
6052
|
import path22 from "path";
|
|
6071
6053
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
6072
6054
|
function getProjectRefs(csprojPath) {
|
|
6073
|
-
const content =
|
|
6055
|
+
const content = readFileSync21(csprojPath, "utf-8");
|
|
6074
6056
|
const refs = [];
|
|
6075
6057
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
6076
6058
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -6087,7 +6069,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
6087
6069
|
for (const ref of getProjectRefs(abs)) {
|
|
6088
6070
|
const childAbs = path22.resolve(dir, ref);
|
|
6089
6071
|
try {
|
|
6090
|
-
|
|
6072
|
+
readFileSync21(childAbs);
|
|
6091
6073
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
6092
6074
|
} catch {
|
|
6093
6075
|
node.children.push({
|
|
@@ -6112,7 +6094,7 @@ function collectAllDeps(node) {
|
|
|
6112
6094
|
}
|
|
6113
6095
|
|
|
6114
6096
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
6115
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
6097
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync22, statSync as statSync3 } from "fs";
|
|
6116
6098
|
import path23 from "path";
|
|
6117
6099
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
6118
6100
|
if (depth > maxDepth) return [];
|
|
@@ -6147,7 +6129,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
6147
6129
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
6148
6130
|
for (const sln of slnFiles) {
|
|
6149
6131
|
try {
|
|
6150
|
-
const content =
|
|
6132
|
+
const content = readFileSync22(sln, "utf-8");
|
|
6151
6133
|
if (pattern2.test(content)) {
|
|
6152
6134
|
matches.push(path23.relative(repoRoot, sln));
|
|
6153
6135
|
}
|
|
@@ -6211,12 +6193,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6211
6193
|
}
|
|
6212
6194
|
|
|
6213
6195
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6214
|
-
import { existsSync as
|
|
6196
|
+
import { existsSync as existsSync23 } from "fs";
|
|
6215
6197
|
import path24 from "path";
|
|
6216
6198
|
import chalk75 from "chalk";
|
|
6217
6199
|
function resolveCsproj(csprojPath) {
|
|
6218
6200
|
const resolved = path24.resolve(csprojPath);
|
|
6219
|
-
if (!
|
|
6201
|
+
if (!existsSync23(resolved)) {
|
|
6220
6202
|
console.error(chalk75.red(`File not found: ${resolved}`));
|
|
6221
6203
|
process.exit(1);
|
|
6222
6204
|
}
|
|
@@ -6384,7 +6366,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6384
6366
|
}
|
|
6385
6367
|
|
|
6386
6368
|
// src/commands/dotnet/resolveSolution.ts
|
|
6387
|
-
import { existsSync as
|
|
6369
|
+
import { existsSync as existsSync24 } from "fs";
|
|
6388
6370
|
import path25 from "path";
|
|
6389
6371
|
import chalk79 from "chalk";
|
|
6390
6372
|
|
|
@@ -6425,7 +6407,7 @@ function findSolution() {
|
|
|
6425
6407
|
function resolveSolution(sln) {
|
|
6426
6408
|
if (sln) {
|
|
6427
6409
|
const resolved = path25.resolve(sln);
|
|
6428
|
-
if (!
|
|
6410
|
+
if (!existsSync24(resolved)) {
|
|
6429
6411
|
console.error(chalk79.red(`Solution file not found: ${resolved}`));
|
|
6430
6412
|
process.exit(1);
|
|
6431
6413
|
}
|
|
@@ -6465,7 +6447,7 @@ function parseInspectReport(json) {
|
|
|
6465
6447
|
|
|
6466
6448
|
// src/commands/dotnet/runInspectCode.ts
|
|
6467
6449
|
import { execSync as execSync23 } from "child_process";
|
|
6468
|
-
import { existsSync as
|
|
6450
|
+
import { existsSync as existsSync25, readFileSync as readFileSync23, unlinkSync as unlinkSync5 } from "fs";
|
|
6469
6451
|
import { tmpdir as tmpdir2 } from "os";
|
|
6470
6452
|
import path26 from "path";
|
|
6471
6453
|
import chalk80 from "chalk";
|
|
@@ -6496,11 +6478,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6496
6478
|
console.error(chalk80.red("jb inspectcode failed"));
|
|
6497
6479
|
process.exit(1);
|
|
6498
6480
|
}
|
|
6499
|
-
if (!
|
|
6481
|
+
if (!existsSync25(reportPath)) {
|
|
6500
6482
|
console.error(chalk80.red("Report file not generated"));
|
|
6501
6483
|
process.exit(1);
|
|
6502
6484
|
}
|
|
6503
|
-
const xml =
|
|
6485
|
+
const xml = readFileSync23(reportPath, "utf-8");
|
|
6504
6486
|
unlinkSync5(reportPath);
|
|
6505
6487
|
return xml;
|
|
6506
6488
|
}
|
|
@@ -6728,7 +6710,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6728
6710
|
import { execSync as execSync26 } from "child_process";
|
|
6729
6711
|
|
|
6730
6712
|
// src/shared/loadJson.ts
|
|
6731
|
-
import { existsSync as
|
|
6713
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync6, readFileSync as readFileSync24, writeFileSync as writeFileSync19 } from "fs";
|
|
6732
6714
|
import { homedir as homedir6 } from "os";
|
|
6733
6715
|
import { join as join23 } from "path";
|
|
6734
6716
|
function getStoreDir() {
|
|
@@ -6739,9 +6721,9 @@ function getStorePath(filename) {
|
|
|
6739
6721
|
}
|
|
6740
6722
|
function loadJson(filename) {
|
|
6741
6723
|
const path50 = getStorePath(filename);
|
|
6742
|
-
if (
|
|
6724
|
+
if (existsSync26(path50)) {
|
|
6743
6725
|
try {
|
|
6744
|
-
return JSON.parse(
|
|
6726
|
+
return JSON.parse(readFileSync24(path50, "utf-8"));
|
|
6745
6727
|
} catch {
|
|
6746
6728
|
return {};
|
|
6747
6729
|
}
|
|
@@ -6750,7 +6732,7 @@ function loadJson(filename) {
|
|
|
6750
6732
|
}
|
|
6751
6733
|
function saveJson(filename, data) {
|
|
6752
6734
|
const dir = getStoreDir();
|
|
6753
|
-
if (!
|
|
6735
|
+
if (!existsSync26(dir)) {
|
|
6754
6736
|
mkdirSync6(dir, { recursive: true });
|
|
6755
6737
|
}
|
|
6756
6738
|
writeFileSync19(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
@@ -7187,7 +7169,7 @@ import { tmpdir as tmpdir4 } from "os";
|
|
|
7187
7169
|
import { join as join26 } from "path";
|
|
7188
7170
|
|
|
7189
7171
|
// src/commands/prs/loadCommentsCache.ts
|
|
7190
|
-
import { existsSync as
|
|
7172
|
+
import { existsSync as existsSync27, readFileSync as readFileSync25, unlinkSync as unlinkSync7 } from "fs";
|
|
7191
7173
|
import { join as join25 } from "path";
|
|
7192
7174
|
import { parse as parse2 } from "yaml";
|
|
7193
7175
|
function getCachePath(prNumber) {
|
|
@@ -7195,15 +7177,15 @@ function getCachePath(prNumber) {
|
|
|
7195
7177
|
}
|
|
7196
7178
|
function loadCommentsCache(prNumber) {
|
|
7197
7179
|
const cachePath = getCachePath(prNumber);
|
|
7198
|
-
if (!
|
|
7180
|
+
if (!existsSync27(cachePath)) {
|
|
7199
7181
|
return null;
|
|
7200
7182
|
}
|
|
7201
|
-
const content =
|
|
7183
|
+
const content = readFileSync25(cachePath, "utf-8");
|
|
7202
7184
|
return parse2(content);
|
|
7203
7185
|
}
|
|
7204
7186
|
function deleteCommentsCache(prNumber) {
|
|
7205
7187
|
const cachePath = getCachePath(prNumber);
|
|
7206
|
-
if (
|
|
7188
|
+
if (existsSync27(cachePath)) {
|
|
7207
7189
|
unlinkSync7(cachePath);
|
|
7208
7190
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
7209
7191
|
}
|
|
@@ -7300,7 +7282,7 @@ function fixed(commentId, sha) {
|
|
|
7300
7282
|
}
|
|
7301
7283
|
|
|
7302
7284
|
// src/commands/prs/listComments/index.ts
|
|
7303
|
-
import { existsSync as
|
|
7285
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync7, writeFileSync as writeFileSync23 } from "fs";
|
|
7304
7286
|
import { join as join28 } from "path";
|
|
7305
7287
|
import { stringify } from "yaml";
|
|
7306
7288
|
|
|
@@ -7426,7 +7408,7 @@ function printComments2(result) {
|
|
|
7426
7408
|
// src/commands/prs/listComments/index.ts
|
|
7427
7409
|
function writeCommentsCache(prNumber, comments2) {
|
|
7428
7410
|
const assistDir = join28(process.cwd(), ".assist");
|
|
7429
|
-
if (!
|
|
7411
|
+
if (!existsSync28(assistDir)) {
|
|
7430
7412
|
mkdirSync7(assistDir, { recursive: true });
|
|
7431
7413
|
}
|
|
7432
7414
|
const cacheData = {
|
|
@@ -9861,7 +9843,7 @@ function registerSeq(program2) {
|
|
|
9861
9843
|
}
|
|
9862
9844
|
|
|
9863
9845
|
// src/commands/transcript/shared.ts
|
|
9864
|
-
import { existsSync as
|
|
9846
|
+
import { existsSync as existsSync29, readdirSync as readdirSync5, statSync as statSync4 } from "fs";
|
|
9865
9847
|
import { basename as basename4, join as join29, relative } from "path";
|
|
9866
9848
|
import * as readline2 from "readline";
|
|
9867
9849
|
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -9877,7 +9859,7 @@ function isValidDatePrefix(filename) {
|
|
|
9877
9859
|
return DATE_PREFIX_REGEX.test(filename);
|
|
9878
9860
|
}
|
|
9879
9861
|
function collectFiles(dir, extension) {
|
|
9880
|
-
if (!
|
|
9862
|
+
if (!existsSync29(dir)) return [];
|
|
9881
9863
|
const results = [];
|
|
9882
9864
|
for (const entry of readdirSync5(dir)) {
|
|
9883
9865
|
const fullPath = join29(dir, entry);
|
|
@@ -9974,7 +9956,7 @@ async function configure() {
|
|
|
9974
9956
|
}
|
|
9975
9957
|
|
|
9976
9958
|
// src/commands/transcript/format/index.ts
|
|
9977
|
-
import { existsSync as
|
|
9959
|
+
import { existsSync as existsSync31 } from "fs";
|
|
9978
9960
|
|
|
9979
9961
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
9980
9962
|
import { dirname as dirname18, join as join31 } from "path";
|
|
@@ -10048,7 +10030,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
10048
10030
|
}
|
|
10049
10031
|
|
|
10050
10032
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
10051
|
-
import { existsSync as
|
|
10033
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync8, readFileSync as readFileSync26, writeFileSync as writeFileSync24 } from "fs";
|
|
10052
10034
|
import { basename as basename5, dirname as dirname19, join as join32 } from "path";
|
|
10053
10035
|
|
|
10054
10036
|
// src/commands/transcript/cleanText.ts
|
|
@@ -10273,7 +10255,7 @@ function logSkipped(relativeDir, mdFile) {
|
|
|
10273
10255
|
return "skipped";
|
|
10274
10256
|
}
|
|
10275
10257
|
function ensureDirectory(dir, label2) {
|
|
10276
|
-
if (!
|
|
10258
|
+
if (!existsSync30(dir)) {
|
|
10277
10259
|
mkdirSync8(dir, { recursive: true });
|
|
10278
10260
|
console.log(`Created ${label2}: ${dir}`);
|
|
10279
10261
|
}
|
|
@@ -10296,7 +10278,7 @@ function logReduction(cueCount, messageCount) {
|
|
|
10296
10278
|
}
|
|
10297
10279
|
function readAndParseCues(inputPath) {
|
|
10298
10280
|
console.log(`Reading: ${inputPath}`);
|
|
10299
|
-
return processCues(
|
|
10281
|
+
return processCues(readFileSync26(inputPath, "utf-8"));
|
|
10300
10282
|
}
|
|
10301
10283
|
function writeFormatted(outputPath, content) {
|
|
10302
10284
|
writeFileSync24(outputPath, content, "utf-8");
|
|
@@ -10309,7 +10291,7 @@ function convertVttToMarkdown(inputPath, outputPath) {
|
|
|
10309
10291
|
logReduction(cues.length, chatMessages.length);
|
|
10310
10292
|
}
|
|
10311
10293
|
function tryProcessVtt(vttFile, paths) {
|
|
10312
|
-
if (
|
|
10294
|
+
if (existsSync30(paths.outputPath))
|
|
10313
10295
|
return logSkipped(paths.relativeDir, paths.mdFile);
|
|
10314
10296
|
convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
|
|
10315
10297
|
return "processed";
|
|
@@ -10335,7 +10317,7 @@ function processAllFiles(vttFiles, transcriptsDir) {
|
|
|
10335
10317
|
logSummary(counts);
|
|
10336
10318
|
}
|
|
10337
10319
|
function requireVttDir(vttDir) {
|
|
10338
|
-
if (!
|
|
10320
|
+
if (!existsSync31(vttDir)) {
|
|
10339
10321
|
console.error(`VTT directory not found: ${vttDir}`);
|
|
10340
10322
|
process.exit(1);
|
|
10341
10323
|
}
|
|
@@ -10367,14 +10349,14 @@ async function format() {
|
|
|
10367
10349
|
}
|
|
10368
10350
|
|
|
10369
10351
|
// src/commands/transcript/summarise/index.ts
|
|
10370
|
-
import { existsSync as
|
|
10352
|
+
import { existsSync as existsSync33 } from "fs";
|
|
10371
10353
|
import { basename as basename6, dirname as dirname21, join as join34, relative as relative2 } from "path";
|
|
10372
10354
|
|
|
10373
10355
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
10374
10356
|
import {
|
|
10375
|
-
existsSync as
|
|
10357
|
+
existsSync as existsSync32,
|
|
10376
10358
|
mkdirSync as mkdirSync9,
|
|
10377
|
-
readFileSync as
|
|
10359
|
+
readFileSync as readFileSync27,
|
|
10378
10360
|
renameSync as renameSync3,
|
|
10379
10361
|
rmSync
|
|
10380
10362
|
} from "fs";
|
|
@@ -10409,7 +10391,7 @@ function validateStagedContent(filename, content) {
|
|
|
10409
10391
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
10410
10392
|
var STAGING_DIR = join33(process.cwd(), ".assist", "transcript");
|
|
10411
10393
|
function processStagedFile() {
|
|
10412
|
-
if (!
|
|
10394
|
+
if (!existsSync32(STAGING_DIR)) {
|
|
10413
10395
|
return false;
|
|
10414
10396
|
}
|
|
10415
10397
|
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -10418,7 +10400,7 @@ function processStagedFile() {
|
|
|
10418
10400
|
}
|
|
10419
10401
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
10420
10402
|
const stagedFile = stagedFiles[0];
|
|
10421
|
-
const content =
|
|
10403
|
+
const content = readFileSync27(stagedFile.absolutePath, "utf-8");
|
|
10422
10404
|
validateStagedContent(stagedFile.filename, content);
|
|
10423
10405
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
10424
10406
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -10433,7 +10415,7 @@ function processStagedFile() {
|
|
|
10433
10415
|
}
|
|
10434
10416
|
const destPath = join33(summaryDir, matchingTranscript.relativePath);
|
|
10435
10417
|
const destDir = dirname20(destPath);
|
|
10436
|
-
if (!
|
|
10418
|
+
if (!existsSync32(destDir)) {
|
|
10437
10419
|
mkdirSync9(destDir, { recursive: true });
|
|
10438
10420
|
}
|
|
10439
10421
|
renameSync3(stagedFile.absolutePath, destPath);
|
|
@@ -10460,7 +10442,7 @@ function buildSummaryIndex(summaryDir) {
|
|
|
10460
10442
|
function summarise2() {
|
|
10461
10443
|
processStagedFile();
|
|
10462
10444
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
10463
|
-
if (!
|
|
10445
|
+
if (!existsSync33(transcriptsDir)) {
|
|
10464
10446
|
console.log("No transcripts directory found.");
|
|
10465
10447
|
return;
|
|
10466
10448
|
}
|
|
@@ -10564,14 +10546,14 @@ function devices() {
|
|
|
10564
10546
|
}
|
|
10565
10547
|
|
|
10566
10548
|
// src/commands/voice/logs.ts
|
|
10567
|
-
import { existsSync as
|
|
10549
|
+
import { existsSync as existsSync34, readFileSync as readFileSync28 } from "fs";
|
|
10568
10550
|
function logs(options2) {
|
|
10569
|
-
if (!
|
|
10551
|
+
if (!existsSync34(voicePaths.log)) {
|
|
10570
10552
|
console.log("No voice log file found");
|
|
10571
10553
|
return;
|
|
10572
10554
|
}
|
|
10573
10555
|
const count = Number.parseInt(options2.lines ?? "150", 10);
|
|
10574
|
-
const content =
|
|
10556
|
+
const content = readFileSync28(voicePaths.log, "utf-8").trim();
|
|
10575
10557
|
if (!content) {
|
|
10576
10558
|
console.log("Voice log is empty");
|
|
10577
10559
|
return;
|
|
@@ -10598,7 +10580,7 @@ import { join as join38 } from "path";
|
|
|
10598
10580
|
|
|
10599
10581
|
// src/commands/voice/checkLockFile.ts
|
|
10600
10582
|
import { execSync as execSync37 } from "child_process";
|
|
10601
|
-
import { existsSync as
|
|
10583
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync10, readFileSync as readFileSync29, writeFileSync as writeFileSync25 } from "fs";
|
|
10602
10584
|
import { join as join37 } from "path";
|
|
10603
10585
|
function isProcessAlive2(pid) {
|
|
10604
10586
|
try {
|
|
@@ -10610,9 +10592,9 @@ function isProcessAlive2(pid) {
|
|
|
10610
10592
|
}
|
|
10611
10593
|
function checkLockFile() {
|
|
10612
10594
|
const lockFile = getLockFile();
|
|
10613
|
-
if (!
|
|
10595
|
+
if (!existsSync35(lockFile)) return;
|
|
10614
10596
|
try {
|
|
10615
|
-
const lock = JSON.parse(
|
|
10597
|
+
const lock = JSON.parse(readFileSync29(lockFile, "utf-8"));
|
|
10616
10598
|
if (lock.pid && isProcessAlive2(lock.pid)) {
|
|
10617
10599
|
console.error(
|
|
10618
10600
|
`Voice daemon already running (PID ${lock.pid}, env: ${lock.env}). Stop it first with: assist voice stop`
|
|
@@ -10623,7 +10605,7 @@ function checkLockFile() {
|
|
|
10623
10605
|
}
|
|
10624
10606
|
}
|
|
10625
10607
|
function bootstrapVenv() {
|
|
10626
|
-
if (
|
|
10608
|
+
if (existsSync35(getVenvPython())) return;
|
|
10627
10609
|
console.log("Setting up Python environment...");
|
|
10628
10610
|
const pythonDir = getPythonDir();
|
|
10629
10611
|
execSync37(
|
|
@@ -10714,7 +10696,7 @@ function start2(options2) {
|
|
|
10714
10696
|
}
|
|
10715
10697
|
|
|
10716
10698
|
// src/commands/voice/status.ts
|
|
10717
|
-
import { existsSync as
|
|
10699
|
+
import { existsSync as existsSync36, readFileSync as readFileSync30 } from "fs";
|
|
10718
10700
|
function isProcessAlive3(pid) {
|
|
10719
10701
|
try {
|
|
10720
10702
|
process.kill(pid, 0);
|
|
@@ -10724,16 +10706,16 @@ function isProcessAlive3(pid) {
|
|
|
10724
10706
|
}
|
|
10725
10707
|
}
|
|
10726
10708
|
function readRecentLogs(count) {
|
|
10727
|
-
if (!
|
|
10728
|
-
const lines =
|
|
10709
|
+
if (!existsSync36(voicePaths.log)) return [];
|
|
10710
|
+
const lines = readFileSync30(voicePaths.log, "utf-8").trim().split("\n");
|
|
10729
10711
|
return lines.slice(-count);
|
|
10730
10712
|
}
|
|
10731
10713
|
function status() {
|
|
10732
|
-
if (!
|
|
10714
|
+
if (!existsSync36(voicePaths.pid)) {
|
|
10733
10715
|
console.log("Voice daemon: not running (no PID file)");
|
|
10734
10716
|
return;
|
|
10735
10717
|
}
|
|
10736
|
-
const pid = Number.parseInt(
|
|
10718
|
+
const pid = Number.parseInt(readFileSync30(voicePaths.pid, "utf-8").trim(), 10);
|
|
10737
10719
|
const alive = isProcessAlive3(pid);
|
|
10738
10720
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
10739
10721
|
const recent = readRecentLogs(5);
|
|
@@ -10752,13 +10734,13 @@ function status() {
|
|
|
10752
10734
|
}
|
|
10753
10735
|
|
|
10754
10736
|
// src/commands/voice/stop.ts
|
|
10755
|
-
import { existsSync as
|
|
10737
|
+
import { existsSync as existsSync37, readFileSync as readFileSync31, unlinkSync as unlinkSync10 } from "fs";
|
|
10756
10738
|
function stop() {
|
|
10757
|
-
if (!
|
|
10739
|
+
if (!existsSync37(voicePaths.pid)) {
|
|
10758
10740
|
console.log("Voice daemon is not running (no PID file)");
|
|
10759
10741
|
return;
|
|
10760
10742
|
}
|
|
10761
|
-
const pid = Number.parseInt(
|
|
10743
|
+
const pid = Number.parseInt(readFileSync31(voicePaths.pid, "utf-8").trim(), 10);
|
|
10762
10744
|
try {
|
|
10763
10745
|
process.kill(pid, "SIGTERM");
|
|
10764
10746
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -10771,7 +10753,7 @@ function stop() {
|
|
|
10771
10753
|
}
|
|
10772
10754
|
try {
|
|
10773
10755
|
const lockFile = getLockFile();
|
|
10774
|
-
if (
|
|
10756
|
+
if (existsSync37(lockFile)) unlinkSync10(lockFile);
|
|
10775
10757
|
} catch {
|
|
10776
10758
|
}
|
|
10777
10759
|
console.log("Voice daemon stopped");
|
|
@@ -10992,7 +10974,7 @@ async function auth() {
|
|
|
10992
10974
|
}
|
|
10993
10975
|
|
|
10994
10976
|
// src/commands/roam/showClaudeCodeIcon.ts
|
|
10995
|
-
import { readFileSync as
|
|
10977
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
10996
10978
|
import { join as join40 } from "path";
|
|
10997
10979
|
async function showClaudeCodeIcon() {
|
|
10998
10980
|
const appData = process.env.APPDATA;
|
|
@@ -11000,7 +10982,7 @@ async function showClaudeCodeIcon() {
|
|
|
11000
10982
|
const portFile = join40(appData, "Roam", "roam-local-api.port");
|
|
11001
10983
|
let port;
|
|
11002
10984
|
try {
|
|
11003
|
-
port =
|
|
10985
|
+
port = readFileSync32(portFile, "utf-8").trim();
|
|
11004
10986
|
} catch {
|
|
11005
10987
|
return;
|
|
11006
10988
|
}
|
|
@@ -11197,7 +11179,7 @@ function run3(name, args) {
|
|
|
11197
11179
|
|
|
11198
11180
|
// src/commands/screenshot/index.ts
|
|
11199
11181
|
import { execSync as execSync40 } from "child_process";
|
|
11200
|
-
import { existsSync as
|
|
11182
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
11201
11183
|
import { tmpdir as tmpdir6 } from "os";
|
|
11202
11184
|
import { join as join42, resolve as resolve5 } from "path";
|
|
11203
11185
|
import chalk121 from "chalk";
|
|
@@ -11329,7 +11311,7 @@ Write-Output $OutputPath
|
|
|
11329
11311
|
|
|
11330
11312
|
// src/commands/screenshot/index.ts
|
|
11331
11313
|
function buildOutputPath(outputDir, processName) {
|
|
11332
|
-
if (!
|
|
11314
|
+
if (!existsSync38(outputDir)) {
|
|
11333
11315
|
mkdirSync14(outputDir, { recursive: true });
|
|
11334
11316
|
}
|
|
11335
11317
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|