@staff0rd/assist 0.172.3 → 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 -200
- 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,41 +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
|
-
const id = await selectItem(todo);
|
|
1025
|
+
const id = await pickItem(loadBacklog());
|
|
1026
|
+
if (id === void 0) return;
|
|
1018
1027
|
const completed = await run(id, options2);
|
|
1019
1028
|
if (!completed) return;
|
|
1020
1029
|
}
|
|
@@ -1082,9 +1091,6 @@ function plan(id) {
|
|
|
1082
1091
|
console.log(`${chalk9.bold(`Phase ${i + 1}:`)} ${phase.name}`);
|
|
1083
1092
|
for (const task of phase.tasks) {
|
|
1084
1093
|
console.log(` - ${task.task}`);
|
|
1085
|
-
if (task.verify) {
|
|
1086
|
-
console.log(` ${chalk9.dim(`verify: ${task.verify}`)}`);
|
|
1087
|
-
}
|
|
1088
1094
|
}
|
|
1089
1095
|
console.log();
|
|
1090
1096
|
}
|
|
@@ -1130,9 +1136,6 @@ import chalk12 from "chalk";
|
|
|
1130
1136
|
function printPhaseTasks(phase) {
|
|
1131
1137
|
for (const task of phase.tasks) {
|
|
1132
1138
|
console.log(` - ${task.task}`);
|
|
1133
|
-
if (task.verify) {
|
|
1134
|
-
console.log(` ${chalk12.dim(`verify: ${task.verify}`)}`);
|
|
1135
|
-
}
|
|
1136
1139
|
}
|
|
1137
1140
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
1138
1141
|
console.log(` ${chalk12.dim("Manual checks:")}`);
|
|
@@ -3701,7 +3704,7 @@ function registerCommentCommands(cmd) {
|
|
|
3701
3704
|
}
|
|
3702
3705
|
|
|
3703
3706
|
// src/commands/backlog/add/index.ts
|
|
3704
|
-
import
|
|
3707
|
+
import chalk44 from "chalk";
|
|
3705
3708
|
|
|
3706
3709
|
// src/commands/backlog/commitBacklog.ts
|
|
3707
3710
|
import { execSync as execSync14 } from "child_process";
|
|
@@ -3718,58 +3721,9 @@ function commitBacklog(id, name) {
|
|
|
3718
3721
|
}
|
|
3719
3722
|
}
|
|
3720
3723
|
|
|
3721
|
-
// src/commands/backlog/add/parseItemFile.ts
|
|
3722
|
-
import { existsSync as existsSync18, readFileSync as readFileSync15 } from "fs";
|
|
3723
|
-
import chalk44 from "chalk";
|
|
3724
|
-
import { ZodError } from "zod";
|
|
3725
|
-
var addItemSchema = backlogItemSchema.omit({ id: true, status: true });
|
|
3726
|
-
function readJsonFile(filePath) {
|
|
3727
|
-
if (!existsSync18(filePath)) {
|
|
3728
|
-
console.log(chalk44.red(`File not found: ${filePath}`));
|
|
3729
|
-
process.exitCode = 1;
|
|
3730
|
-
return void 0;
|
|
3731
|
-
}
|
|
3732
|
-
let raw;
|
|
3733
|
-
try {
|
|
3734
|
-
raw = readFileSync15(filePath, "utf-8");
|
|
3735
|
-
} catch {
|
|
3736
|
-
console.log(chalk44.red(`Failed to read file: ${filePath}`));
|
|
3737
|
-
process.exitCode = 1;
|
|
3738
|
-
return void 0;
|
|
3739
|
-
}
|
|
3740
|
-
try {
|
|
3741
|
-
return JSON.parse(raw);
|
|
3742
|
-
} catch {
|
|
3743
|
-
console.log(chalk44.red(`Invalid JSON in file: ${filePath}`));
|
|
3744
|
-
process.exitCode = 1;
|
|
3745
|
-
return void 0;
|
|
3746
|
-
}
|
|
3747
|
-
}
|
|
3748
|
-
function formatZodError(err) {
|
|
3749
|
-
if (err instanceof ZodError) {
|
|
3750
|
-
console.log(chalk44.red("Invalid backlog item schema:"));
|
|
3751
|
-
for (const issue of err.issues) {
|
|
3752
|
-
console.log(chalk44.red(` - ${issue.path.join(".")}: ${issue.message}`));
|
|
3753
|
-
}
|
|
3754
|
-
} else {
|
|
3755
|
-
console.log(chalk44.red("Invalid backlog item schema."));
|
|
3756
|
-
}
|
|
3757
|
-
}
|
|
3758
|
-
function parseItemFile(filePath) {
|
|
3759
|
-
const parsed = readJsonFile(filePath);
|
|
3760
|
-
if (parsed === void 0) return void 0;
|
|
3761
|
-
try {
|
|
3762
|
-
return addItemSchema.parse(parsed);
|
|
3763
|
-
} catch (err) {
|
|
3764
|
-
formatZodError(err);
|
|
3765
|
-
process.exitCode = 1;
|
|
3766
|
-
return void 0;
|
|
3767
|
-
}
|
|
3768
|
-
}
|
|
3769
|
-
|
|
3770
3724
|
// src/commands/backlog/add/shared.ts
|
|
3771
3725
|
import { spawnSync } from "child_process";
|
|
3772
|
-
import { mkdtempSync, readFileSync as
|
|
3726
|
+
import { mkdtempSync, readFileSync as readFileSync15, unlinkSync as unlinkSync4, writeFileSync as writeFileSync14 } from "fs";
|
|
3773
3727
|
import { tmpdir } from "os";
|
|
3774
3728
|
import { join as join15 } from "path";
|
|
3775
3729
|
import enquirer6 from "enquirer";
|
|
@@ -3819,7 +3773,7 @@ function openEditor() {
|
|
|
3819
3773
|
unlinkSync4(filePath);
|
|
3820
3774
|
return void 0;
|
|
3821
3775
|
}
|
|
3822
|
-
const content =
|
|
3776
|
+
const content = readFileSync15(filePath, "utf-8").trim();
|
|
3823
3777
|
unlinkSync4(filePath);
|
|
3824
3778
|
return content || void 0;
|
|
3825
3779
|
}
|
|
@@ -3838,49 +3792,70 @@ async function promptAcceptanceCriteria() {
|
|
|
3838
3792
|
}
|
|
3839
3793
|
|
|
3840
3794
|
// src/commands/backlog/add/index.ts
|
|
3841
|
-
function
|
|
3842
|
-
const
|
|
3843
|
-
|
|
3844
|
-
const
|
|
3845
|
-
const
|
|
3846
|
-
items.push({ ...data, id, status: "todo" });
|
|
3847
|
-
saveBacklog(items);
|
|
3848
|
-
commitBacklog(id, data.name);
|
|
3849
|
-
console.log(chalk45.green(`Added item #${id}: ${data.name}`));
|
|
3850
|
-
}
|
|
3851
|
-
async function addInteractive() {
|
|
3852
|
-
const type = await promptType();
|
|
3853
|
-
const name = await promptName();
|
|
3854
|
-
const description = await promptDescription();
|
|
3855
|
-
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();
|
|
3856
3800
|
const items = loadBacklog();
|
|
3857
3801
|
const id = getNextId(items);
|
|
3858
3802
|
items.push({
|
|
3859
3803
|
id,
|
|
3860
3804
|
type,
|
|
3861
3805
|
name,
|
|
3862
|
-
description,
|
|
3806
|
+
description: description || void 0,
|
|
3863
3807
|
acceptanceCriteria: acceptanceCriteria2,
|
|
3864
3808
|
status: "todo"
|
|
3865
3809
|
});
|
|
3866
3810
|
saveBacklog(items);
|
|
3867
3811
|
commitBacklog(id, name);
|
|
3868
|
-
console.log(
|
|
3812
|
+
console.log(chalk44.green(`Added item #${id}: ${name}`));
|
|
3869
3813
|
}
|
|
3870
3814
|
async function add(options2) {
|
|
3871
3815
|
if (!backlogExists()) {
|
|
3872
3816
|
console.log(
|
|
3873
|
-
|
|
3817
|
+
chalk44.yellow(
|
|
3874
3818
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3875
3819
|
)
|
|
3876
3820
|
);
|
|
3877
3821
|
return;
|
|
3878
3822
|
}
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
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;
|
|
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]);
|
|
3883
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
|
+
);
|
|
3884
3859
|
}
|
|
3885
3860
|
|
|
3886
3861
|
// src/commands/backlog/init/index.ts
|
|
@@ -3911,14 +3886,15 @@ async function list2(options2) {
|
|
|
3911
3886
|
);
|
|
3912
3887
|
return;
|
|
3913
3888
|
}
|
|
3914
|
-
const
|
|
3889
|
+
const allItems = loadBacklog();
|
|
3890
|
+
const items = filterItems(allItems, options2);
|
|
3915
3891
|
if (items.length === 0) {
|
|
3916
3892
|
console.log(chalk47.dim("Backlog is empty."));
|
|
3917
3893
|
return;
|
|
3918
3894
|
}
|
|
3919
3895
|
for (const item of items) {
|
|
3920
3896
|
console.log(
|
|
3921
|
-
`${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)}`
|
|
3922
3898
|
);
|
|
3923
3899
|
if (options2.verbose) {
|
|
3924
3900
|
printVerboseDetails(item);
|
|
@@ -3933,7 +3909,11 @@ function registerItemCommands(cmd) {
|
|
|
3933
3909
|
"--status <type>",
|
|
3934
3910
|
"Filter by status (todo, in-progress, done, wontdo)"
|
|
3935
3911
|
).option("-a, --all", "Include done/wontdo items").option("-v, --verbose", "Show all item details").action(list2);
|
|
3936
|
-
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);
|
|
3937
3917
|
}
|
|
3938
3918
|
|
|
3939
3919
|
// src/commands/backlog/link.ts
|
|
@@ -4227,7 +4207,7 @@ function extractGraphqlQuery(args) {
|
|
|
4227
4207
|
}
|
|
4228
4208
|
|
|
4229
4209
|
// src/shared/loadCliReads.ts
|
|
4230
|
-
import { existsSync as
|
|
4210
|
+
import { existsSync as existsSync18, readFileSync as readFileSync16, writeFileSync as writeFileSync15 } from "fs";
|
|
4231
4211
|
import { dirname as dirname14, resolve as resolve2 } from "path";
|
|
4232
4212
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4233
4213
|
var __filename2 = fileURLToPath4(import.meta.url);
|
|
@@ -4236,8 +4216,8 @@ function packageRoot() {
|
|
|
4236
4216
|
return __dirname4;
|
|
4237
4217
|
}
|
|
4238
4218
|
function readLines(path50) {
|
|
4239
|
-
if (!
|
|
4240
|
-
return
|
|
4219
|
+
if (!existsSync18(path50)) return [];
|
|
4220
|
+
return readFileSync16(path50, "utf-8").split("\n").filter((line) => line.trim() !== "");
|
|
4241
4221
|
}
|
|
4242
4222
|
var cachedReads;
|
|
4243
4223
|
var cachedWrites;
|
|
@@ -4283,7 +4263,7 @@ function findCliWrite(command) {
|
|
|
4283
4263
|
}
|
|
4284
4264
|
|
|
4285
4265
|
// src/shared/readSettingsPerms.ts
|
|
4286
|
-
import { existsSync as
|
|
4266
|
+
import { existsSync as existsSync19, readFileSync as readFileSync17 } from "fs";
|
|
4287
4267
|
import { homedir as homedir3 } from "os";
|
|
4288
4268
|
import { join as join16 } from "path";
|
|
4289
4269
|
function readSettingsPerms(key) {
|
|
@@ -4299,9 +4279,9 @@ function readSettingsPerms(key) {
|
|
|
4299
4279
|
return entries;
|
|
4300
4280
|
}
|
|
4301
4281
|
function readPermissionArray(filePath, key) {
|
|
4302
|
-
if (!
|
|
4282
|
+
if (!existsSync19(filePath)) return [];
|
|
4303
4283
|
try {
|
|
4304
|
-
const data = JSON.parse(
|
|
4284
|
+
const data = JSON.parse(readFileSync17(filePath, "utf-8"));
|
|
4305
4285
|
const arr = data?.permissions?.[key];
|
|
4306
4286
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
4307
4287
|
} catch {
|
|
@@ -4392,6 +4372,18 @@ function matchesConfigDeny(command) {
|
|
|
4392
4372
|
|
|
4393
4373
|
// src/shared/splitCompound.ts
|
|
4394
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
|
|
4395
4387
|
var SEPARATOR_OPS = /* @__PURE__ */ new Set(["|", "&&", "||", ";"]);
|
|
4396
4388
|
var UNSAFE_OPS = /* @__PURE__ */ new Set(["(", ")", ">", ">>", "<", "<&", "|&", ">&"]);
|
|
4397
4389
|
var FD_REDIRECT_RE = /\d+>&\d+/g;
|
|
@@ -4407,12 +4399,9 @@ function splitCompound(command) {
|
|
|
4407
4399
|
function tokenizeCommand(command) {
|
|
4408
4400
|
const trimmed = command.trim().replace(FD_DEVNULL_RE, "").replace(FD_REDIRECT_RE, "");
|
|
4409
4401
|
if (!trimmed) return void 0;
|
|
4402
|
+
if (hasUnquotedBackticks(trimmed)) return void 0;
|
|
4410
4403
|
try {
|
|
4411
|
-
|
|
4412
|
-
const hasBacktick = tokens.some(
|
|
4413
|
-
(t) => typeof t === "string" && /`.+`/.test(t)
|
|
4414
|
-
);
|
|
4415
|
-
return hasBacktick ? void 0 : tokens;
|
|
4404
|
+
return parse(trimmed);
|
|
4416
4405
|
} catch {
|
|
4417
4406
|
return void 0;
|
|
4418
4407
|
}
|
|
@@ -4586,7 +4575,7 @@ function denyRemove(pattern2) {
|
|
|
4586
4575
|
}
|
|
4587
4576
|
|
|
4588
4577
|
// src/commands/permitCliReads/index.ts
|
|
4589
|
-
import { existsSync as
|
|
4578
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync5, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
4590
4579
|
import { homedir as homedir4 } from "os";
|
|
4591
4580
|
import { join as join17 } from "path";
|
|
4592
4581
|
|
|
@@ -4894,8 +4883,8 @@ function logPath(cli) {
|
|
|
4894
4883
|
}
|
|
4895
4884
|
function readCache(cli) {
|
|
4896
4885
|
const path50 = logPath(cli);
|
|
4897
|
-
if (!
|
|
4898
|
-
return
|
|
4886
|
+
if (!existsSync20(path50)) return void 0;
|
|
4887
|
+
return readFileSync18(path50, "utf-8");
|
|
4899
4888
|
}
|
|
4900
4889
|
function writeCache(cli, output) {
|
|
4901
4890
|
const dir = join17(homedir4(), ".assist");
|
|
@@ -5447,7 +5436,7 @@ function registerComplexity(program2) {
|
|
|
5447
5436
|
}
|
|
5448
5437
|
|
|
5449
5438
|
// src/commands/deploy/redirect.ts
|
|
5450
|
-
import { existsSync as
|
|
5439
|
+
import { existsSync as existsSync21, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
5451
5440
|
import chalk65 from "chalk";
|
|
5452
5441
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5453
5442
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -5456,11 +5445,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5456
5445
|
</script>`;
|
|
5457
5446
|
function redirect() {
|
|
5458
5447
|
const indexPath = "index.html";
|
|
5459
|
-
if (!
|
|
5448
|
+
if (!existsSync21(indexPath)) {
|
|
5460
5449
|
console.log(chalk65.yellow("No index.html found"));
|
|
5461
5450
|
return;
|
|
5462
5451
|
}
|
|
5463
|
-
const content =
|
|
5452
|
+
const content = readFileSync19(indexPath, "utf-8");
|
|
5464
5453
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5465
5454
|
console.log(chalk65.dim("Trailing slash script already present"));
|
|
5466
5455
|
return;
|
|
@@ -5502,7 +5491,7 @@ import { execSync as execSync17 } from "child_process";
|
|
|
5502
5491
|
import chalk66 from "chalk";
|
|
5503
5492
|
|
|
5504
5493
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5505
|
-
import { readdirSync, readFileSync as
|
|
5494
|
+
import { readdirSync, readFileSync as readFileSync20 } from "fs";
|
|
5506
5495
|
import { join as join19 } from "path";
|
|
5507
5496
|
var DEVLOG_DIR = join19(BLOG_REPO_ROOT, "src/content/devlog");
|
|
5508
5497
|
function extractFrontmatter(content) {
|
|
@@ -5532,7 +5521,7 @@ function readDevlogFiles(callback) {
|
|
|
5532
5521
|
try {
|
|
5533
5522
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
5534
5523
|
for (const file of files) {
|
|
5535
|
-
const content =
|
|
5524
|
+
const content = readFileSync20(join19(DEVLOG_DIR, file), "utf-8");
|
|
5536
5525
|
const parsed = parseFrontmatter(content, file);
|
|
5537
5526
|
if (parsed) callback(parsed);
|
|
5538
5527
|
}
|
|
@@ -5988,12 +5977,12 @@ import { join as join21 } from "path";
|
|
|
5988
5977
|
import chalk73 from "chalk";
|
|
5989
5978
|
|
|
5990
5979
|
// src/shared/findRepoRoot.ts
|
|
5991
|
-
import { existsSync as
|
|
5980
|
+
import { existsSync as existsSync22 } from "fs";
|
|
5992
5981
|
import path21 from "path";
|
|
5993
5982
|
function findRepoRoot(dir) {
|
|
5994
5983
|
let current = dir;
|
|
5995
5984
|
while (current !== path21.dirname(current)) {
|
|
5996
|
-
if (
|
|
5985
|
+
if (existsSync22(path21.join(current, ".git"))) {
|
|
5997
5986
|
return current;
|
|
5998
5987
|
}
|
|
5999
5988
|
current = path21.dirname(current);
|
|
@@ -6059,11 +6048,11 @@ async function checkBuildLocksCommand() {
|
|
|
6059
6048
|
}
|
|
6060
6049
|
|
|
6061
6050
|
// src/commands/dotnet/buildTree.ts
|
|
6062
|
-
import { readFileSync as
|
|
6051
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
6063
6052
|
import path22 from "path";
|
|
6064
6053
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
6065
6054
|
function getProjectRefs(csprojPath) {
|
|
6066
|
-
const content =
|
|
6055
|
+
const content = readFileSync21(csprojPath, "utf-8");
|
|
6067
6056
|
const refs = [];
|
|
6068
6057
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
6069
6058
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -6080,7 +6069,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
6080
6069
|
for (const ref of getProjectRefs(abs)) {
|
|
6081
6070
|
const childAbs = path22.resolve(dir, ref);
|
|
6082
6071
|
try {
|
|
6083
|
-
|
|
6072
|
+
readFileSync21(childAbs);
|
|
6084
6073
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
6085
6074
|
} catch {
|
|
6086
6075
|
node.children.push({
|
|
@@ -6105,7 +6094,7 @@ function collectAllDeps(node) {
|
|
|
6105
6094
|
}
|
|
6106
6095
|
|
|
6107
6096
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
6108
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
6097
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync22, statSync as statSync3 } from "fs";
|
|
6109
6098
|
import path23 from "path";
|
|
6110
6099
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
6111
6100
|
if (depth > maxDepth) return [];
|
|
@@ -6140,7 +6129,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
6140
6129
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
6141
6130
|
for (const sln of slnFiles) {
|
|
6142
6131
|
try {
|
|
6143
|
-
const content =
|
|
6132
|
+
const content = readFileSync22(sln, "utf-8");
|
|
6144
6133
|
if (pattern2.test(content)) {
|
|
6145
6134
|
matches.push(path23.relative(repoRoot, sln));
|
|
6146
6135
|
}
|
|
@@ -6204,12 +6193,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6204
6193
|
}
|
|
6205
6194
|
|
|
6206
6195
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6207
|
-
import { existsSync as
|
|
6196
|
+
import { existsSync as existsSync23 } from "fs";
|
|
6208
6197
|
import path24 from "path";
|
|
6209
6198
|
import chalk75 from "chalk";
|
|
6210
6199
|
function resolveCsproj(csprojPath) {
|
|
6211
6200
|
const resolved = path24.resolve(csprojPath);
|
|
6212
|
-
if (!
|
|
6201
|
+
if (!existsSync23(resolved)) {
|
|
6213
6202
|
console.error(chalk75.red(`File not found: ${resolved}`));
|
|
6214
6203
|
process.exit(1);
|
|
6215
6204
|
}
|
|
@@ -6377,7 +6366,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6377
6366
|
}
|
|
6378
6367
|
|
|
6379
6368
|
// src/commands/dotnet/resolveSolution.ts
|
|
6380
|
-
import { existsSync as
|
|
6369
|
+
import { existsSync as existsSync24 } from "fs";
|
|
6381
6370
|
import path25 from "path";
|
|
6382
6371
|
import chalk79 from "chalk";
|
|
6383
6372
|
|
|
@@ -6418,7 +6407,7 @@ function findSolution() {
|
|
|
6418
6407
|
function resolveSolution(sln) {
|
|
6419
6408
|
if (sln) {
|
|
6420
6409
|
const resolved = path25.resolve(sln);
|
|
6421
|
-
if (!
|
|
6410
|
+
if (!existsSync24(resolved)) {
|
|
6422
6411
|
console.error(chalk79.red(`Solution file not found: ${resolved}`));
|
|
6423
6412
|
process.exit(1);
|
|
6424
6413
|
}
|
|
@@ -6458,7 +6447,7 @@ function parseInspectReport(json) {
|
|
|
6458
6447
|
|
|
6459
6448
|
// src/commands/dotnet/runInspectCode.ts
|
|
6460
6449
|
import { execSync as execSync23 } from "child_process";
|
|
6461
|
-
import { existsSync as
|
|
6450
|
+
import { existsSync as existsSync25, readFileSync as readFileSync23, unlinkSync as unlinkSync5 } from "fs";
|
|
6462
6451
|
import { tmpdir as tmpdir2 } from "os";
|
|
6463
6452
|
import path26 from "path";
|
|
6464
6453
|
import chalk80 from "chalk";
|
|
@@ -6489,11 +6478,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6489
6478
|
console.error(chalk80.red("jb inspectcode failed"));
|
|
6490
6479
|
process.exit(1);
|
|
6491
6480
|
}
|
|
6492
|
-
if (!
|
|
6481
|
+
if (!existsSync25(reportPath)) {
|
|
6493
6482
|
console.error(chalk80.red("Report file not generated"));
|
|
6494
6483
|
process.exit(1);
|
|
6495
6484
|
}
|
|
6496
|
-
const xml =
|
|
6485
|
+
const xml = readFileSync23(reportPath, "utf-8");
|
|
6497
6486
|
unlinkSync5(reportPath);
|
|
6498
6487
|
return xml;
|
|
6499
6488
|
}
|
|
@@ -6721,7 +6710,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6721
6710
|
import { execSync as execSync26 } from "child_process";
|
|
6722
6711
|
|
|
6723
6712
|
// src/shared/loadJson.ts
|
|
6724
|
-
import { existsSync as
|
|
6713
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync6, readFileSync as readFileSync24, writeFileSync as writeFileSync19 } from "fs";
|
|
6725
6714
|
import { homedir as homedir6 } from "os";
|
|
6726
6715
|
import { join as join23 } from "path";
|
|
6727
6716
|
function getStoreDir() {
|
|
@@ -6732,9 +6721,9 @@ function getStorePath(filename) {
|
|
|
6732
6721
|
}
|
|
6733
6722
|
function loadJson(filename) {
|
|
6734
6723
|
const path50 = getStorePath(filename);
|
|
6735
|
-
if (
|
|
6724
|
+
if (existsSync26(path50)) {
|
|
6736
6725
|
try {
|
|
6737
|
-
return JSON.parse(
|
|
6726
|
+
return JSON.parse(readFileSync24(path50, "utf-8"));
|
|
6738
6727
|
} catch {
|
|
6739
6728
|
return {};
|
|
6740
6729
|
}
|
|
@@ -6743,7 +6732,7 @@ function loadJson(filename) {
|
|
|
6743
6732
|
}
|
|
6744
6733
|
function saveJson(filename, data) {
|
|
6745
6734
|
const dir = getStoreDir();
|
|
6746
|
-
if (!
|
|
6735
|
+
if (!existsSync26(dir)) {
|
|
6747
6736
|
mkdirSync6(dir, { recursive: true });
|
|
6748
6737
|
}
|
|
6749
6738
|
writeFileSync19(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
@@ -7180,7 +7169,7 @@ import { tmpdir as tmpdir4 } from "os";
|
|
|
7180
7169
|
import { join as join26 } from "path";
|
|
7181
7170
|
|
|
7182
7171
|
// src/commands/prs/loadCommentsCache.ts
|
|
7183
|
-
import { existsSync as
|
|
7172
|
+
import { existsSync as existsSync27, readFileSync as readFileSync25, unlinkSync as unlinkSync7 } from "fs";
|
|
7184
7173
|
import { join as join25 } from "path";
|
|
7185
7174
|
import { parse as parse2 } from "yaml";
|
|
7186
7175
|
function getCachePath(prNumber) {
|
|
@@ -7188,15 +7177,15 @@ function getCachePath(prNumber) {
|
|
|
7188
7177
|
}
|
|
7189
7178
|
function loadCommentsCache(prNumber) {
|
|
7190
7179
|
const cachePath = getCachePath(prNumber);
|
|
7191
|
-
if (!
|
|
7180
|
+
if (!existsSync27(cachePath)) {
|
|
7192
7181
|
return null;
|
|
7193
7182
|
}
|
|
7194
|
-
const content =
|
|
7183
|
+
const content = readFileSync25(cachePath, "utf-8");
|
|
7195
7184
|
return parse2(content);
|
|
7196
7185
|
}
|
|
7197
7186
|
function deleteCommentsCache(prNumber) {
|
|
7198
7187
|
const cachePath = getCachePath(prNumber);
|
|
7199
|
-
if (
|
|
7188
|
+
if (existsSync27(cachePath)) {
|
|
7200
7189
|
unlinkSync7(cachePath);
|
|
7201
7190
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
7202
7191
|
}
|
|
@@ -7293,7 +7282,7 @@ function fixed(commentId, sha) {
|
|
|
7293
7282
|
}
|
|
7294
7283
|
|
|
7295
7284
|
// src/commands/prs/listComments/index.ts
|
|
7296
|
-
import { existsSync as
|
|
7285
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync7, writeFileSync as writeFileSync23 } from "fs";
|
|
7297
7286
|
import { join as join28 } from "path";
|
|
7298
7287
|
import { stringify } from "yaml";
|
|
7299
7288
|
|
|
@@ -7419,7 +7408,7 @@ function printComments2(result) {
|
|
|
7419
7408
|
// src/commands/prs/listComments/index.ts
|
|
7420
7409
|
function writeCommentsCache(prNumber, comments2) {
|
|
7421
7410
|
const assistDir = join28(process.cwd(), ".assist");
|
|
7422
|
-
if (!
|
|
7411
|
+
if (!existsSync28(assistDir)) {
|
|
7423
7412
|
mkdirSync7(assistDir, { recursive: true });
|
|
7424
7413
|
}
|
|
7425
7414
|
const cacheData = {
|
|
@@ -9854,7 +9843,7 @@ function registerSeq(program2) {
|
|
|
9854
9843
|
}
|
|
9855
9844
|
|
|
9856
9845
|
// src/commands/transcript/shared.ts
|
|
9857
|
-
import { existsSync as
|
|
9846
|
+
import { existsSync as existsSync29, readdirSync as readdirSync5, statSync as statSync4 } from "fs";
|
|
9858
9847
|
import { basename as basename4, join as join29, relative } from "path";
|
|
9859
9848
|
import * as readline2 from "readline";
|
|
9860
9849
|
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -9870,7 +9859,7 @@ function isValidDatePrefix(filename) {
|
|
|
9870
9859
|
return DATE_PREFIX_REGEX.test(filename);
|
|
9871
9860
|
}
|
|
9872
9861
|
function collectFiles(dir, extension) {
|
|
9873
|
-
if (!
|
|
9862
|
+
if (!existsSync29(dir)) return [];
|
|
9874
9863
|
const results = [];
|
|
9875
9864
|
for (const entry of readdirSync5(dir)) {
|
|
9876
9865
|
const fullPath = join29(dir, entry);
|
|
@@ -9967,7 +9956,7 @@ async function configure() {
|
|
|
9967
9956
|
}
|
|
9968
9957
|
|
|
9969
9958
|
// src/commands/transcript/format/index.ts
|
|
9970
|
-
import { existsSync as
|
|
9959
|
+
import { existsSync as existsSync31 } from "fs";
|
|
9971
9960
|
|
|
9972
9961
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
9973
9962
|
import { dirname as dirname18, join as join31 } from "path";
|
|
@@ -10041,7 +10030,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
10041
10030
|
}
|
|
10042
10031
|
|
|
10043
10032
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
10044
|
-
import { existsSync as
|
|
10033
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync8, readFileSync as readFileSync26, writeFileSync as writeFileSync24 } from "fs";
|
|
10045
10034
|
import { basename as basename5, dirname as dirname19, join as join32 } from "path";
|
|
10046
10035
|
|
|
10047
10036
|
// src/commands/transcript/cleanText.ts
|
|
@@ -10266,7 +10255,7 @@ function logSkipped(relativeDir, mdFile) {
|
|
|
10266
10255
|
return "skipped";
|
|
10267
10256
|
}
|
|
10268
10257
|
function ensureDirectory(dir, label2) {
|
|
10269
|
-
if (!
|
|
10258
|
+
if (!existsSync30(dir)) {
|
|
10270
10259
|
mkdirSync8(dir, { recursive: true });
|
|
10271
10260
|
console.log(`Created ${label2}: ${dir}`);
|
|
10272
10261
|
}
|
|
@@ -10289,7 +10278,7 @@ function logReduction(cueCount, messageCount) {
|
|
|
10289
10278
|
}
|
|
10290
10279
|
function readAndParseCues(inputPath) {
|
|
10291
10280
|
console.log(`Reading: ${inputPath}`);
|
|
10292
|
-
return processCues(
|
|
10281
|
+
return processCues(readFileSync26(inputPath, "utf-8"));
|
|
10293
10282
|
}
|
|
10294
10283
|
function writeFormatted(outputPath, content) {
|
|
10295
10284
|
writeFileSync24(outputPath, content, "utf-8");
|
|
@@ -10302,7 +10291,7 @@ function convertVttToMarkdown(inputPath, outputPath) {
|
|
|
10302
10291
|
logReduction(cues.length, chatMessages.length);
|
|
10303
10292
|
}
|
|
10304
10293
|
function tryProcessVtt(vttFile, paths) {
|
|
10305
|
-
if (
|
|
10294
|
+
if (existsSync30(paths.outputPath))
|
|
10306
10295
|
return logSkipped(paths.relativeDir, paths.mdFile);
|
|
10307
10296
|
convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
|
|
10308
10297
|
return "processed";
|
|
@@ -10328,7 +10317,7 @@ function processAllFiles(vttFiles, transcriptsDir) {
|
|
|
10328
10317
|
logSummary(counts);
|
|
10329
10318
|
}
|
|
10330
10319
|
function requireVttDir(vttDir) {
|
|
10331
|
-
if (!
|
|
10320
|
+
if (!existsSync31(vttDir)) {
|
|
10332
10321
|
console.error(`VTT directory not found: ${vttDir}`);
|
|
10333
10322
|
process.exit(1);
|
|
10334
10323
|
}
|
|
@@ -10360,14 +10349,14 @@ async function format() {
|
|
|
10360
10349
|
}
|
|
10361
10350
|
|
|
10362
10351
|
// src/commands/transcript/summarise/index.ts
|
|
10363
|
-
import { existsSync as
|
|
10352
|
+
import { existsSync as existsSync33 } from "fs";
|
|
10364
10353
|
import { basename as basename6, dirname as dirname21, join as join34, relative as relative2 } from "path";
|
|
10365
10354
|
|
|
10366
10355
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
10367
10356
|
import {
|
|
10368
|
-
existsSync as
|
|
10357
|
+
existsSync as existsSync32,
|
|
10369
10358
|
mkdirSync as mkdirSync9,
|
|
10370
|
-
readFileSync as
|
|
10359
|
+
readFileSync as readFileSync27,
|
|
10371
10360
|
renameSync as renameSync3,
|
|
10372
10361
|
rmSync
|
|
10373
10362
|
} from "fs";
|
|
@@ -10402,7 +10391,7 @@ function validateStagedContent(filename, content) {
|
|
|
10402
10391
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
10403
10392
|
var STAGING_DIR = join33(process.cwd(), ".assist", "transcript");
|
|
10404
10393
|
function processStagedFile() {
|
|
10405
|
-
if (!
|
|
10394
|
+
if (!existsSync32(STAGING_DIR)) {
|
|
10406
10395
|
return false;
|
|
10407
10396
|
}
|
|
10408
10397
|
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -10411,7 +10400,7 @@ function processStagedFile() {
|
|
|
10411
10400
|
}
|
|
10412
10401
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
10413
10402
|
const stagedFile = stagedFiles[0];
|
|
10414
|
-
const content =
|
|
10403
|
+
const content = readFileSync27(stagedFile.absolutePath, "utf-8");
|
|
10415
10404
|
validateStagedContent(stagedFile.filename, content);
|
|
10416
10405
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
10417
10406
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -10426,7 +10415,7 @@ function processStagedFile() {
|
|
|
10426
10415
|
}
|
|
10427
10416
|
const destPath = join33(summaryDir, matchingTranscript.relativePath);
|
|
10428
10417
|
const destDir = dirname20(destPath);
|
|
10429
|
-
if (!
|
|
10418
|
+
if (!existsSync32(destDir)) {
|
|
10430
10419
|
mkdirSync9(destDir, { recursive: true });
|
|
10431
10420
|
}
|
|
10432
10421
|
renameSync3(stagedFile.absolutePath, destPath);
|
|
@@ -10453,7 +10442,7 @@ function buildSummaryIndex(summaryDir) {
|
|
|
10453
10442
|
function summarise2() {
|
|
10454
10443
|
processStagedFile();
|
|
10455
10444
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
10456
|
-
if (!
|
|
10445
|
+
if (!existsSync33(transcriptsDir)) {
|
|
10457
10446
|
console.log("No transcripts directory found.");
|
|
10458
10447
|
return;
|
|
10459
10448
|
}
|
|
@@ -10557,14 +10546,14 @@ function devices() {
|
|
|
10557
10546
|
}
|
|
10558
10547
|
|
|
10559
10548
|
// src/commands/voice/logs.ts
|
|
10560
|
-
import { existsSync as
|
|
10549
|
+
import { existsSync as existsSync34, readFileSync as readFileSync28 } from "fs";
|
|
10561
10550
|
function logs(options2) {
|
|
10562
|
-
if (!
|
|
10551
|
+
if (!existsSync34(voicePaths.log)) {
|
|
10563
10552
|
console.log("No voice log file found");
|
|
10564
10553
|
return;
|
|
10565
10554
|
}
|
|
10566
10555
|
const count = Number.parseInt(options2.lines ?? "150", 10);
|
|
10567
|
-
const content =
|
|
10556
|
+
const content = readFileSync28(voicePaths.log, "utf-8").trim();
|
|
10568
10557
|
if (!content) {
|
|
10569
10558
|
console.log("Voice log is empty");
|
|
10570
10559
|
return;
|
|
@@ -10591,7 +10580,7 @@ import { join as join38 } from "path";
|
|
|
10591
10580
|
|
|
10592
10581
|
// src/commands/voice/checkLockFile.ts
|
|
10593
10582
|
import { execSync as execSync37 } from "child_process";
|
|
10594
|
-
import { existsSync as
|
|
10583
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync10, readFileSync as readFileSync29, writeFileSync as writeFileSync25 } from "fs";
|
|
10595
10584
|
import { join as join37 } from "path";
|
|
10596
10585
|
function isProcessAlive2(pid) {
|
|
10597
10586
|
try {
|
|
@@ -10603,9 +10592,9 @@ function isProcessAlive2(pid) {
|
|
|
10603
10592
|
}
|
|
10604
10593
|
function checkLockFile() {
|
|
10605
10594
|
const lockFile = getLockFile();
|
|
10606
|
-
if (!
|
|
10595
|
+
if (!existsSync35(lockFile)) return;
|
|
10607
10596
|
try {
|
|
10608
|
-
const lock = JSON.parse(
|
|
10597
|
+
const lock = JSON.parse(readFileSync29(lockFile, "utf-8"));
|
|
10609
10598
|
if (lock.pid && isProcessAlive2(lock.pid)) {
|
|
10610
10599
|
console.error(
|
|
10611
10600
|
`Voice daemon already running (PID ${lock.pid}, env: ${lock.env}). Stop it first with: assist voice stop`
|
|
@@ -10616,7 +10605,7 @@ function checkLockFile() {
|
|
|
10616
10605
|
}
|
|
10617
10606
|
}
|
|
10618
10607
|
function bootstrapVenv() {
|
|
10619
|
-
if (
|
|
10608
|
+
if (existsSync35(getVenvPython())) return;
|
|
10620
10609
|
console.log("Setting up Python environment...");
|
|
10621
10610
|
const pythonDir = getPythonDir();
|
|
10622
10611
|
execSync37(
|
|
@@ -10707,7 +10696,7 @@ function start2(options2) {
|
|
|
10707
10696
|
}
|
|
10708
10697
|
|
|
10709
10698
|
// src/commands/voice/status.ts
|
|
10710
|
-
import { existsSync as
|
|
10699
|
+
import { existsSync as existsSync36, readFileSync as readFileSync30 } from "fs";
|
|
10711
10700
|
function isProcessAlive3(pid) {
|
|
10712
10701
|
try {
|
|
10713
10702
|
process.kill(pid, 0);
|
|
@@ -10717,16 +10706,16 @@ function isProcessAlive3(pid) {
|
|
|
10717
10706
|
}
|
|
10718
10707
|
}
|
|
10719
10708
|
function readRecentLogs(count) {
|
|
10720
|
-
if (!
|
|
10721
|
-
const lines =
|
|
10709
|
+
if (!existsSync36(voicePaths.log)) return [];
|
|
10710
|
+
const lines = readFileSync30(voicePaths.log, "utf-8").trim().split("\n");
|
|
10722
10711
|
return lines.slice(-count);
|
|
10723
10712
|
}
|
|
10724
10713
|
function status() {
|
|
10725
|
-
if (!
|
|
10714
|
+
if (!existsSync36(voicePaths.pid)) {
|
|
10726
10715
|
console.log("Voice daemon: not running (no PID file)");
|
|
10727
10716
|
return;
|
|
10728
10717
|
}
|
|
10729
|
-
const pid = Number.parseInt(
|
|
10718
|
+
const pid = Number.parseInt(readFileSync30(voicePaths.pid, "utf-8").trim(), 10);
|
|
10730
10719
|
const alive = isProcessAlive3(pid);
|
|
10731
10720
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
10732
10721
|
const recent = readRecentLogs(5);
|
|
@@ -10745,13 +10734,13 @@ function status() {
|
|
|
10745
10734
|
}
|
|
10746
10735
|
|
|
10747
10736
|
// src/commands/voice/stop.ts
|
|
10748
|
-
import { existsSync as
|
|
10737
|
+
import { existsSync as existsSync37, readFileSync as readFileSync31, unlinkSync as unlinkSync10 } from "fs";
|
|
10749
10738
|
function stop() {
|
|
10750
|
-
if (!
|
|
10739
|
+
if (!existsSync37(voicePaths.pid)) {
|
|
10751
10740
|
console.log("Voice daemon is not running (no PID file)");
|
|
10752
10741
|
return;
|
|
10753
10742
|
}
|
|
10754
|
-
const pid = Number.parseInt(
|
|
10743
|
+
const pid = Number.parseInt(readFileSync31(voicePaths.pid, "utf-8").trim(), 10);
|
|
10755
10744
|
try {
|
|
10756
10745
|
process.kill(pid, "SIGTERM");
|
|
10757
10746
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -10764,7 +10753,7 @@ function stop() {
|
|
|
10764
10753
|
}
|
|
10765
10754
|
try {
|
|
10766
10755
|
const lockFile = getLockFile();
|
|
10767
|
-
if (
|
|
10756
|
+
if (existsSync37(lockFile)) unlinkSync10(lockFile);
|
|
10768
10757
|
} catch {
|
|
10769
10758
|
}
|
|
10770
10759
|
console.log("Voice daemon stopped");
|
|
@@ -10985,7 +10974,7 @@ async function auth() {
|
|
|
10985
10974
|
}
|
|
10986
10975
|
|
|
10987
10976
|
// src/commands/roam/showClaudeCodeIcon.ts
|
|
10988
|
-
import { readFileSync as
|
|
10977
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
10989
10978
|
import { join as join40 } from "path";
|
|
10990
10979
|
async function showClaudeCodeIcon() {
|
|
10991
10980
|
const appData = process.env.APPDATA;
|
|
@@ -10993,7 +10982,7 @@ async function showClaudeCodeIcon() {
|
|
|
10993
10982
|
const portFile = join40(appData, "Roam", "roam-local-api.port");
|
|
10994
10983
|
let port;
|
|
10995
10984
|
try {
|
|
10996
|
-
port =
|
|
10985
|
+
port = readFileSync32(portFile, "utf-8").trim();
|
|
10997
10986
|
} catch {
|
|
10998
10987
|
return;
|
|
10999
10988
|
}
|
|
@@ -11190,7 +11179,7 @@ function run3(name, args) {
|
|
|
11190
11179
|
|
|
11191
11180
|
// src/commands/screenshot/index.ts
|
|
11192
11181
|
import { execSync as execSync40 } from "child_process";
|
|
11193
|
-
import { existsSync as
|
|
11182
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
11194
11183
|
import { tmpdir as tmpdir6 } from "os";
|
|
11195
11184
|
import { join as join42, resolve as resolve5 } from "path";
|
|
11196
11185
|
import chalk121 from "chalk";
|
|
@@ -11322,7 +11311,7 @@ Write-Output $OutputPath
|
|
|
11322
11311
|
|
|
11323
11312
|
// src/commands/screenshot/index.ts
|
|
11324
11313
|
function buildOutputPath(outputDir, processName) {
|
|
11325
|
-
if (!
|
|
11314
|
+
if (!existsSync38(outputDir)) {
|
|
11326
11315
|
mkdirSync14(outputDir, { recursive: true });
|
|
11327
11316
|
}
|
|
11328
11317
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|