@staff0rd/assist 0.261.0 → 0.262.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +229 -219
- 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.262.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -2721,11 +2721,153 @@ function blockedByHandover(cwd = process.cwd()) {
|
|
|
2721
2721
|
}
|
|
2722
2722
|
|
|
2723
2723
|
// src/commands/backlog/acquireLock.ts
|
|
2724
|
-
import {
|
|
2725
|
-
|
|
2724
|
+
import {
|
|
2725
|
+
existsSync as existsSync14,
|
|
2726
|
+
mkdirSync as mkdirSync4,
|
|
2727
|
+
readFileSync as readFileSync9,
|
|
2728
|
+
unlinkSync as unlinkSync2,
|
|
2729
|
+
writeFileSync as writeFileSync11
|
|
2730
|
+
} from "fs";
|
|
2731
|
+
import { homedir as homedir3 } from "os";
|
|
2732
|
+
import { join as join10 } from "path";
|
|
2733
|
+
function getLocksDir() {
|
|
2734
|
+
return join10(homedir3(), ".assist", "locks");
|
|
2735
|
+
}
|
|
2736
|
+
function getLockPath(itemId) {
|
|
2737
|
+
return join10(getLocksDir(), `lock-${itemId}.json`);
|
|
2738
|
+
}
|
|
2739
|
+
function isProcessAlive(pid) {
|
|
2740
|
+
try {
|
|
2741
|
+
process.kill(pid, 0);
|
|
2742
|
+
return true;
|
|
2743
|
+
} catch {
|
|
2744
|
+
return false;
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
function isLockedByOther(itemId) {
|
|
2748
|
+
const lockPath = getLockPath(itemId);
|
|
2749
|
+
if (!existsSync14(lockPath)) return false;
|
|
2750
|
+
try {
|
|
2751
|
+
const lock = JSON.parse(readFileSync9(lockPath, "utf-8"));
|
|
2752
|
+
if (lock.pid === process.pid) return false;
|
|
2753
|
+
return isProcessAlive(lock.pid);
|
|
2754
|
+
} catch {
|
|
2755
|
+
return false;
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
function acquireLock(itemId) {
|
|
2759
|
+
mkdirSync4(getLocksDir(), { recursive: true });
|
|
2760
|
+
writeFileSync11(
|
|
2761
|
+
getLockPath(itemId),
|
|
2762
|
+
JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
2763
|
+
);
|
|
2764
|
+
}
|
|
2765
|
+
function releaseLock(itemId) {
|
|
2766
|
+
const lockPath = getLockPath(itemId);
|
|
2767
|
+
try {
|
|
2768
|
+
unlinkSync2(lockPath);
|
|
2769
|
+
} catch {
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
// src/commands/backlog/list/shared.ts
|
|
2774
|
+
import chalk27 from "chalk";
|
|
2775
|
+
function statusIcon(status2) {
|
|
2776
|
+
switch (status2) {
|
|
2777
|
+
case "todo":
|
|
2778
|
+
return chalk27.dim("[ ]");
|
|
2779
|
+
case "in-progress":
|
|
2780
|
+
return chalk27.yellow("[~]");
|
|
2781
|
+
case "done":
|
|
2782
|
+
return chalk27.green("[x]");
|
|
2783
|
+
case "wontdo":
|
|
2784
|
+
return chalk27.dim("[-]");
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
function typeLabel(type) {
|
|
2788
|
+
switch (type) {
|
|
2789
|
+
case "bug":
|
|
2790
|
+
return chalk27.magenta("Bug");
|
|
2791
|
+
case "story":
|
|
2792
|
+
return chalk27.cyan("Story");
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
function phaseLabel(item) {
|
|
2796
|
+
if (!item.plan) return "";
|
|
2797
|
+
return chalk27.dim(` (phase ${item.currentPhase ?? 1}/${item.plan.length})`);
|
|
2798
|
+
}
|
|
2799
|
+
function isBlocked(item, items2) {
|
|
2800
|
+
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
2801
|
+
return deps2.some((dep) => {
|
|
2802
|
+
const target = items2.find((i) => i.id === dep.targetId);
|
|
2803
|
+
return target !== void 0 && target.status !== "done";
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
function dependencyLabel(item, items2) {
|
|
2807
|
+
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
2808
|
+
if (deps2.length === 0) return "";
|
|
2809
|
+
if (isBlocked(item, items2)) return chalk27.red(" [blocked]");
|
|
2810
|
+
return chalk27.dim(` [${deps2.length} dep${deps2.length > 1 ? "s" : ""}]`);
|
|
2811
|
+
}
|
|
2812
|
+
function printVerboseDetails(item) {
|
|
2813
|
+
if (item.description) {
|
|
2814
|
+
console.log(` ${chalk27.dim("Description:")} ${item.description}`);
|
|
2815
|
+
}
|
|
2816
|
+
if (item.acceptanceCriteria.length > 0) {
|
|
2817
|
+
console.log(` ${chalk27.dim("Acceptance criteria:")}`);
|
|
2818
|
+
for (const [i, criterion] of item.acceptanceCriteria.entries()) {
|
|
2819
|
+
console.log(` ${i + 1}. ${criterion}`);
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
console.log();
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
// src/commands/backlog/findResumable.ts
|
|
2826
|
+
function findResumable(items2) {
|
|
2827
|
+
return items2.find(
|
|
2828
|
+
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id) && !isBlocked(i, items2)
|
|
2829
|
+
);
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
// src/commands/backlog/findUnblockedTodos.ts
|
|
2833
|
+
import chalk28 from "chalk";
|
|
2834
|
+
function findUnblockedTodos(items2) {
|
|
2835
|
+
const todo = items2.filter((i) => i.status === "todo");
|
|
2836
|
+
if (todo.length === 0) {
|
|
2837
|
+
console.log(chalk28.green("All backlog items complete."));
|
|
2838
|
+
return void 0;
|
|
2839
|
+
}
|
|
2840
|
+
const unblocked = todo.filter((i) => !isBlocked(i, items2));
|
|
2841
|
+
if (unblocked.length === 0) {
|
|
2842
|
+
console.log(
|
|
2843
|
+
chalk28.yellow("All remaining todo items are blocked by dependencies.")
|
|
2844
|
+
);
|
|
2845
|
+
return void 0;
|
|
2846
|
+
}
|
|
2847
|
+
return unblocked;
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
// src/commands/backlog/run.ts
|
|
2851
|
+
import chalk35 from "chalk";
|
|
2852
|
+
|
|
2853
|
+
// src/commands/backlog/prepareRun.ts
|
|
2854
|
+
import chalk32 from "chalk";
|
|
2855
|
+
|
|
2856
|
+
// src/commands/backlog/resolvePlan.ts
|
|
2857
|
+
function resolvePlan(item) {
|
|
2858
|
+
if (item.plan && item.plan.length > 0) {
|
|
2859
|
+
return item.plan;
|
|
2860
|
+
}
|
|
2861
|
+
return [
|
|
2862
|
+
{
|
|
2863
|
+
name: "Implement",
|
|
2864
|
+
tasks: item.acceptanceCriteria.map((ac) => ({ task: ac }))
|
|
2865
|
+
}
|
|
2866
|
+
];
|
|
2867
|
+
}
|
|
2726
2868
|
|
|
2727
2869
|
// src/commands/backlog/shared.ts
|
|
2728
|
-
import
|
|
2870
|
+
import chalk31 from "chalk";
|
|
2729
2871
|
|
|
2730
2872
|
// src/commands/backlog/deleteItem.ts
|
|
2731
2873
|
import { eq } from "drizzle-orm";
|
|
@@ -2735,19 +2877,19 @@ async function deleteItem(orm, id) {
|
|
|
2735
2877
|
}
|
|
2736
2878
|
|
|
2737
2879
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
2738
|
-
import { existsSync as
|
|
2739
|
-
import { join as
|
|
2740
|
-
import
|
|
2880
|
+
import { existsSync as existsSync16 } from "fs";
|
|
2881
|
+
import { join as join12 } from "path";
|
|
2882
|
+
import chalk30 from "chalk";
|
|
2741
2883
|
|
|
2742
2884
|
// src/commands/backlog/backupLocalBacklogFiles.ts
|
|
2743
|
-
import { existsSync as
|
|
2744
|
-
import { join as
|
|
2885
|
+
import { existsSync as existsSync15, renameSync } from "fs";
|
|
2886
|
+
import { join as join11 } from "path";
|
|
2745
2887
|
var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
2746
2888
|
function backupLocalBacklogFiles(dir) {
|
|
2747
2889
|
const moved = [];
|
|
2748
2890
|
for (const name of LOCAL_FILES) {
|
|
2749
|
-
const path53 =
|
|
2750
|
-
if (
|
|
2891
|
+
const path53 = join11(dir, ".assist", name);
|
|
2892
|
+
if (existsSync15(path53)) {
|
|
2751
2893
|
renameSync(path53, `${path53}.bak`);
|
|
2752
2894
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
2753
2895
|
}
|
|
@@ -2757,7 +2899,7 @@ function backupLocalBacklogFiles(dir) {
|
|
|
2757
2899
|
|
|
2758
2900
|
// src/commands/backlog/gitPullBacklog.ts
|
|
2759
2901
|
import { execSync as execSync16 } from "child_process";
|
|
2760
|
-
import
|
|
2902
|
+
import chalk29 from "chalk";
|
|
2761
2903
|
function gitPullBacklog(dir) {
|
|
2762
2904
|
try {
|
|
2763
2905
|
execSync16("git pull --ff-only", {
|
|
@@ -2766,7 +2908,7 @@ function gitPullBacklog(dir) {
|
|
|
2766
2908
|
});
|
|
2767
2909
|
} catch {
|
|
2768
2910
|
console.error(
|
|
2769
|
-
|
|
2911
|
+
chalk29.yellow(
|
|
2770
2912
|
"backlog migrate: git pull skipped (no upstream or pull failed); using the local file."
|
|
2771
2913
|
)
|
|
2772
2914
|
);
|
|
@@ -2995,7 +3137,7 @@ async function loadAllItems(orm, origin) {
|
|
|
2995
3137
|
}
|
|
2996
3138
|
|
|
2997
3139
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
2998
|
-
import { readFileSync as
|
|
3140
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
2999
3141
|
|
|
3000
3142
|
// src/commands/backlog/types.ts
|
|
3001
3143
|
import { z as z3 } from "zod";
|
|
@@ -3039,14 +3181,14 @@ var backlogFileSchema = z3.array(backlogItemSchema);
|
|
|
3039
3181
|
|
|
3040
3182
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
3041
3183
|
function parseBacklogJsonl(path53) {
|
|
3042
|
-
const content =
|
|
3184
|
+
const content = readFileSync10(path53, "utf-8").trim();
|
|
3043
3185
|
if (content.length === 0) return [];
|
|
3044
3186
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
3045
3187
|
}
|
|
3046
3188
|
|
|
3047
3189
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
3048
3190
|
function jsonlPath(dir) {
|
|
3049
|
-
return
|
|
3191
|
+
return join12(dir, ".assist", "backlog.jsonl");
|
|
3050
3192
|
}
|
|
3051
3193
|
async function verifyImport(orm, origin, items2, imported) {
|
|
3052
3194
|
const reloaded = await loadAllItems(orm, origin);
|
|
@@ -3062,12 +3204,12 @@ async function verifyImport(orm, origin, items2, imported) {
|
|
|
3062
3204
|
}
|
|
3063
3205
|
}
|
|
3064
3206
|
async function migrateLocalBacklog(orm, dir, origin) {
|
|
3065
|
-
if (!
|
|
3207
|
+
if (!existsSync16(jsonlPath(dir))) return;
|
|
3066
3208
|
const existing = (await loadAllItems(orm, origin)).length;
|
|
3067
3209
|
if (existing > 0) {
|
|
3068
3210
|
const moved2 = backupLocalBacklogFiles(dir);
|
|
3069
3211
|
console.error(
|
|
3070
|
-
|
|
3212
|
+
chalk30.yellow(
|
|
3071
3213
|
`backlog migrate: Postgres already has ${existing} item(s) for ${origin}; skipped import to avoid duplicates and archived the local file (${moved2.join(", ")}).`
|
|
3072
3214
|
)
|
|
3073
3215
|
);
|
|
@@ -3079,7 +3221,7 @@ async function migrateLocalBacklog(orm, dir, origin) {
|
|
|
3079
3221
|
await verifyImport(orm, origin, items2, imported);
|
|
3080
3222
|
const moved = backupLocalBacklogFiles(dir);
|
|
3081
3223
|
console.error(
|
|
3082
|
-
|
|
3224
|
+
chalk30.green(
|
|
3083
3225
|
`backlog migrate: imported ${imported} item(s) into Postgres (${moved.join(", ")}).`
|
|
3084
3226
|
)
|
|
3085
3227
|
);
|
|
@@ -3094,17 +3236,17 @@ async function ensureMigrated(orm, dir, origin) {
|
|
|
3094
3236
|
}
|
|
3095
3237
|
|
|
3096
3238
|
// src/commands/backlog/findBacklogUp.ts
|
|
3097
|
-
import { existsSync as
|
|
3098
|
-
import { dirname as dirname13, join as
|
|
3239
|
+
import { existsSync as existsSync17 } from "fs";
|
|
3240
|
+
import { dirname as dirname13, join as join13 } from "path";
|
|
3099
3241
|
var BACKLOG_MARKERS = [
|
|
3100
|
-
|
|
3101
|
-
|
|
3242
|
+
join13(".assist", "backlog.db"),
|
|
3243
|
+
join13(".assist", "backlog.jsonl"),
|
|
3102
3244
|
"assist.backlog.yml"
|
|
3103
3245
|
];
|
|
3104
3246
|
function findBacklogUp(startDir) {
|
|
3105
3247
|
let current = startDir;
|
|
3106
3248
|
while (current !== dirname13(current)) {
|
|
3107
|
-
if (BACKLOG_MARKERS.some((marker) =>
|
|
3249
|
+
if (BACKLOG_MARKERS.some((marker) => existsSync17(join13(current, marker)))) {
|
|
3108
3250
|
return current;
|
|
3109
3251
|
}
|
|
3110
3252
|
current = dirname13(current);
|
|
@@ -3241,7 +3383,7 @@ async function findOneItem(id) {
|
|
|
3241
3383
|
const { orm } = await getReady();
|
|
3242
3384
|
const item = Number.isNaN(numId) ? void 0 : await loadItem(orm, numId);
|
|
3243
3385
|
if (!item) {
|
|
3244
|
-
console.log(
|
|
3386
|
+
console.log(chalk31.red(`Item #${id} not found.`));
|
|
3245
3387
|
return void 0;
|
|
3246
3388
|
}
|
|
3247
3389
|
return { orm, item };
|
|
@@ -3249,7 +3391,7 @@ async function findOneItem(id) {
|
|
|
3249
3391
|
async function setStatus(id, status2) {
|
|
3250
3392
|
const { orm } = await getReady();
|
|
3251
3393
|
const name = await updateStatus(orm, Number.parseInt(id, 10), status2);
|
|
3252
|
-
if (name === void 0) console.log(
|
|
3394
|
+
if (name === void 0) console.log(chalk31.red(`Item #${id} not found.`));
|
|
3253
3395
|
return name;
|
|
3254
3396
|
}
|
|
3255
3397
|
async function setCurrentPhase(id, phase) {
|
|
@@ -3259,143 +3401,10 @@ async function setCurrentPhase(id, phase) {
|
|
|
3259
3401
|
async function removeItem(id) {
|
|
3260
3402
|
const { orm } = await getReady();
|
|
3261
3403
|
const name = await deleteItem(orm, Number.parseInt(id, 10));
|
|
3262
|
-
if (name === void 0) console.log(
|
|
3404
|
+
if (name === void 0) console.log(chalk31.red(`Item #${id} not found.`));
|
|
3263
3405
|
return name;
|
|
3264
3406
|
}
|
|
3265
3407
|
|
|
3266
|
-
// src/commands/backlog/acquireLock.ts
|
|
3267
|
-
function getLockPath(itemId) {
|
|
3268
|
-
return join13(getBacklogDir(), `.assist-lock-${itemId}.json`);
|
|
3269
|
-
}
|
|
3270
|
-
function isProcessAlive(pid) {
|
|
3271
|
-
try {
|
|
3272
|
-
process.kill(pid, 0);
|
|
3273
|
-
return true;
|
|
3274
|
-
} catch {
|
|
3275
|
-
return false;
|
|
3276
|
-
}
|
|
3277
|
-
}
|
|
3278
|
-
function isLockedByOther(itemId) {
|
|
3279
|
-
const lockPath = getLockPath(itemId);
|
|
3280
|
-
if (!existsSync17(lockPath)) return false;
|
|
3281
|
-
try {
|
|
3282
|
-
const lock = JSON.parse(readFileSync10(lockPath, "utf-8"));
|
|
3283
|
-
if (lock.pid === process.pid) return false;
|
|
3284
|
-
return isProcessAlive(lock.pid);
|
|
3285
|
-
} catch {
|
|
3286
|
-
return false;
|
|
3287
|
-
}
|
|
3288
|
-
}
|
|
3289
|
-
function acquireLock(itemId) {
|
|
3290
|
-
writeFileSync11(
|
|
3291
|
-
getLockPath(itemId),
|
|
3292
|
-
JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
3293
|
-
);
|
|
3294
|
-
}
|
|
3295
|
-
function releaseLock(itemId) {
|
|
3296
|
-
const lockPath = getLockPath(itemId);
|
|
3297
|
-
try {
|
|
3298
|
-
unlinkSync2(lockPath);
|
|
3299
|
-
} catch {
|
|
3300
|
-
}
|
|
3301
|
-
}
|
|
3302
|
-
|
|
3303
|
-
// src/commands/backlog/list/shared.ts
|
|
3304
|
-
import chalk30 from "chalk";
|
|
3305
|
-
function statusIcon(status2) {
|
|
3306
|
-
switch (status2) {
|
|
3307
|
-
case "todo":
|
|
3308
|
-
return chalk30.dim("[ ]");
|
|
3309
|
-
case "in-progress":
|
|
3310
|
-
return chalk30.yellow("[~]");
|
|
3311
|
-
case "done":
|
|
3312
|
-
return chalk30.green("[x]");
|
|
3313
|
-
case "wontdo":
|
|
3314
|
-
return chalk30.dim("[-]");
|
|
3315
|
-
}
|
|
3316
|
-
}
|
|
3317
|
-
function typeLabel(type) {
|
|
3318
|
-
switch (type) {
|
|
3319
|
-
case "bug":
|
|
3320
|
-
return chalk30.magenta("Bug");
|
|
3321
|
-
case "story":
|
|
3322
|
-
return chalk30.cyan("Story");
|
|
3323
|
-
}
|
|
3324
|
-
}
|
|
3325
|
-
function phaseLabel(item) {
|
|
3326
|
-
if (!item.plan) return "";
|
|
3327
|
-
return chalk30.dim(` (phase ${item.currentPhase ?? 1}/${item.plan.length})`);
|
|
3328
|
-
}
|
|
3329
|
-
function isBlocked(item, items2) {
|
|
3330
|
-
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
3331
|
-
return deps2.some((dep) => {
|
|
3332
|
-
const target = items2.find((i) => i.id === dep.targetId);
|
|
3333
|
-
return target !== void 0 && target.status !== "done";
|
|
3334
|
-
});
|
|
3335
|
-
}
|
|
3336
|
-
function dependencyLabel(item, items2) {
|
|
3337
|
-
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
3338
|
-
if (deps2.length === 0) return "";
|
|
3339
|
-
if (isBlocked(item, items2)) return chalk30.red(" [blocked]");
|
|
3340
|
-
return chalk30.dim(` [${deps2.length} dep${deps2.length > 1 ? "s" : ""}]`);
|
|
3341
|
-
}
|
|
3342
|
-
function printVerboseDetails(item) {
|
|
3343
|
-
if (item.description) {
|
|
3344
|
-
console.log(` ${chalk30.dim("Description:")} ${item.description}`);
|
|
3345
|
-
}
|
|
3346
|
-
if (item.acceptanceCriteria.length > 0) {
|
|
3347
|
-
console.log(` ${chalk30.dim("Acceptance criteria:")}`);
|
|
3348
|
-
for (const [i, criterion] of item.acceptanceCriteria.entries()) {
|
|
3349
|
-
console.log(` ${i + 1}. ${criterion}`);
|
|
3350
|
-
}
|
|
3351
|
-
}
|
|
3352
|
-
console.log();
|
|
3353
|
-
}
|
|
3354
|
-
|
|
3355
|
-
// src/commands/backlog/findResumable.ts
|
|
3356
|
-
function findResumable(items2) {
|
|
3357
|
-
return items2.find(
|
|
3358
|
-
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id) && !isBlocked(i, items2)
|
|
3359
|
-
);
|
|
3360
|
-
}
|
|
3361
|
-
|
|
3362
|
-
// src/commands/backlog/findUnblockedTodos.ts
|
|
3363
|
-
import chalk31 from "chalk";
|
|
3364
|
-
function findUnblockedTodos(items2) {
|
|
3365
|
-
const todo = items2.filter((i) => i.status === "todo");
|
|
3366
|
-
if (todo.length === 0) {
|
|
3367
|
-
console.log(chalk31.green("All backlog items complete."));
|
|
3368
|
-
return void 0;
|
|
3369
|
-
}
|
|
3370
|
-
const unblocked = todo.filter((i) => !isBlocked(i, items2));
|
|
3371
|
-
if (unblocked.length === 0) {
|
|
3372
|
-
console.log(
|
|
3373
|
-
chalk31.yellow("All remaining todo items are blocked by dependencies.")
|
|
3374
|
-
);
|
|
3375
|
-
return void 0;
|
|
3376
|
-
}
|
|
3377
|
-
return unblocked;
|
|
3378
|
-
}
|
|
3379
|
-
|
|
3380
|
-
// src/commands/backlog/run.ts
|
|
3381
|
-
import chalk35 from "chalk";
|
|
3382
|
-
|
|
3383
|
-
// src/commands/backlog/prepareRun.ts
|
|
3384
|
-
import chalk32 from "chalk";
|
|
3385
|
-
|
|
3386
|
-
// src/commands/backlog/resolvePlan.ts
|
|
3387
|
-
function resolvePlan(item) {
|
|
3388
|
-
if (item.plan && item.plan.length > 0) {
|
|
3389
|
-
return item.plan;
|
|
3390
|
-
}
|
|
3391
|
-
return [
|
|
3392
|
-
{
|
|
3393
|
-
name: "Implement",
|
|
3394
|
-
tasks: item.acceptanceCriteria.map((ac) => ({ task: ac }))
|
|
3395
|
-
}
|
|
3396
|
-
];
|
|
3397
|
-
}
|
|
3398
|
-
|
|
3399
3408
|
// src/commands/backlog/prepareRun.ts
|
|
3400
3409
|
async function prepareRun(id) {
|
|
3401
3410
|
const found = await findOneItem(id);
|
|
@@ -3428,16 +3437,17 @@ async function reloadPlan(id) {
|
|
|
3428
3437
|
import chalk34 from "chalk";
|
|
3429
3438
|
|
|
3430
3439
|
// src/shared/emitActivity.ts
|
|
3431
|
-
import { mkdirSync as
|
|
3440
|
+
import { mkdirSync as mkdirSync5, readFileSync as readFileSync11, rmSync, writeFileSync as writeFileSync12 } from "fs";
|
|
3441
|
+
import { homedir as homedir4 } from "os";
|
|
3432
3442
|
import { dirname as dirname14, join as join14 } from "path";
|
|
3433
|
-
function activityPath(
|
|
3434
|
-
return join14(
|
|
3443
|
+
function activityPath(sessionId) {
|
|
3444
|
+
return join14(homedir4(), ".assist", "activity", `activity-${sessionId}.json`);
|
|
3435
3445
|
}
|
|
3436
3446
|
function emitActivity(activity2) {
|
|
3437
3447
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
3438
3448
|
if (!sessionId) return;
|
|
3439
|
-
const path53 = activityPath(
|
|
3440
|
-
|
|
3449
|
+
const path53 = activityPath(sessionId);
|
|
3450
|
+
mkdirSync5(dirname14(path53), { recursive: true });
|
|
3441
3451
|
writeFileSync12(path53, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
3442
3452
|
}
|
|
3443
3453
|
function readActivity(path53) {
|
|
@@ -3447,9 +3457,9 @@ function readActivity(path53) {
|
|
|
3447
3457
|
return void 0;
|
|
3448
3458
|
}
|
|
3449
3459
|
}
|
|
3450
|
-
function removeActivity(
|
|
3460
|
+
function removeActivity(sessionId) {
|
|
3451
3461
|
try {
|
|
3452
|
-
rmSync(activityPath(
|
|
3462
|
+
rmSync(activityPath(sessionId));
|
|
3453
3463
|
} catch {
|
|
3454
3464
|
}
|
|
3455
3465
|
}
|
|
@@ -4145,7 +4155,7 @@ function startWebServer(label2, port, handler, initialPath) {
|
|
|
4145
4155
|
import { spawn as spawn4 } from "child_process";
|
|
4146
4156
|
import {
|
|
4147
4157
|
closeSync,
|
|
4148
|
-
mkdirSync as
|
|
4158
|
+
mkdirSync as mkdirSync6,
|
|
4149
4159
|
openSync,
|
|
4150
4160
|
statSync,
|
|
4151
4161
|
unlinkSync as unlinkSync4,
|
|
@@ -4156,9 +4166,9 @@ import {
|
|
|
4156
4166
|
import * as net from "net";
|
|
4157
4167
|
|
|
4158
4168
|
// src/commands/sessions/daemon/daemonPaths.ts
|
|
4159
|
-
import { homedir as
|
|
4169
|
+
import { homedir as homedir5 } from "os";
|
|
4160
4170
|
import { join as join16 } from "path";
|
|
4161
|
-
var DAEMON_DIR = join16(
|
|
4171
|
+
var DAEMON_DIR = join16(homedir5(), ".assist", "daemon");
|
|
4162
4172
|
var daemonPaths = {
|
|
4163
4173
|
dir: DAEMON_DIR,
|
|
4164
4174
|
socket: process.platform === "win32" ? "\\\\.\\pipe\\assist-sessions-daemon" : join16(DAEMON_DIR, "daemon.sock"),
|
|
@@ -4190,7 +4200,7 @@ var RETRY_DELAY_MS = 200;
|
|
|
4190
4200
|
var STALE_LOCK_MS = SPAWN_TIMEOUT_MS + 5e3;
|
|
4191
4201
|
async function ensureDaemonRunning(reason = "unspecified") {
|
|
4192
4202
|
if (await isDaemonRunning()) return;
|
|
4193
|
-
|
|
4203
|
+
mkdirSync6(daemonPaths.dir, { recursive: true });
|
|
4194
4204
|
const holdsLock = acquireSpawnLock();
|
|
4195
4205
|
if (holdsLock) spawnDaemon(reason);
|
|
4196
4206
|
try {
|
|
@@ -6454,13 +6464,13 @@ function stripEnvPrefix(parts) {
|
|
|
6454
6464
|
}
|
|
6455
6465
|
|
|
6456
6466
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
6457
|
-
import { mkdirSync as
|
|
6458
|
-
import { homedir as
|
|
6467
|
+
import { mkdirSync as mkdirSync7 } from "fs";
|
|
6468
|
+
import { homedir as homedir6 } from "os";
|
|
6459
6469
|
import { join as join19 } from "path";
|
|
6460
6470
|
import Database from "better-sqlite3";
|
|
6461
6471
|
var _db;
|
|
6462
6472
|
function getDbDir() {
|
|
6463
|
-
return join19(
|
|
6473
|
+
return join19(homedir6(), ".assist");
|
|
6464
6474
|
}
|
|
6465
6475
|
function initSchema(db) {
|
|
6466
6476
|
db.exec(`
|
|
@@ -6478,7 +6488,7 @@ function initSchema(db) {
|
|
|
6478
6488
|
function openPromptsDb(dir) {
|
|
6479
6489
|
if (_db) return _db;
|
|
6480
6490
|
const dbDir = dir ?? getDbDir();
|
|
6481
|
-
|
|
6491
|
+
mkdirSync7(dbDir, { recursive: true });
|
|
6482
6492
|
const db = new Database(join19(dbDir, "assist.db"));
|
|
6483
6493
|
db.pragma("journal_mode = WAL");
|
|
6484
6494
|
initSchema(db);
|
|
@@ -6638,11 +6648,11 @@ function findCliWrite(command) {
|
|
|
6638
6648
|
|
|
6639
6649
|
// src/shared/readSettingsPerms.ts
|
|
6640
6650
|
import { existsSync as existsSync22, readFileSync as readFileSync17 } from "fs";
|
|
6641
|
-
import { homedir as
|
|
6651
|
+
import { homedir as homedir7 } from "os";
|
|
6642
6652
|
import { join as join20 } from "path";
|
|
6643
6653
|
function readSettingsPerms(key) {
|
|
6644
6654
|
const paths = [
|
|
6645
|
-
join20(
|
|
6655
|
+
join20(homedir7(), ".claude", "settings.json"),
|
|
6646
6656
|
join20(process.cwd(), ".claude", "settings.json"),
|
|
6647
6657
|
join20(process.cwd(), ".claude", "settings.local.json")
|
|
6648
6658
|
];
|
|
@@ -6935,8 +6945,8 @@ ${reasons.join("\n")}`);
|
|
|
6935
6945
|
}
|
|
6936
6946
|
|
|
6937
6947
|
// src/commands/permitCliReads/index.ts
|
|
6938
|
-
import { existsSync as existsSync23, mkdirSync as
|
|
6939
|
-
import { homedir as
|
|
6948
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync8, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
6949
|
+
import { homedir as homedir8 } from "os";
|
|
6940
6950
|
import { join as join21 } from "path";
|
|
6941
6951
|
|
|
6942
6952
|
// src/shared/checkCliAvailable.ts
|
|
@@ -7226,7 +7236,7 @@ function updateSettings(cli, commands) {
|
|
|
7226
7236
|
// src/commands/permitCliReads/index.ts
|
|
7227
7237
|
function logPath(cli) {
|
|
7228
7238
|
const safeName = cli.replace(/\s+/g, "-");
|
|
7229
|
-
return join21(
|
|
7239
|
+
return join21(homedir8(), ".assist", `cli-discover-${safeName}.log`);
|
|
7230
7240
|
}
|
|
7231
7241
|
function readCache(cli) {
|
|
7232
7242
|
const path53 = logPath(cli);
|
|
@@ -7234,8 +7244,8 @@ function readCache(cli) {
|
|
|
7234
7244
|
return readFileSync18(path53, "utf-8");
|
|
7235
7245
|
}
|
|
7236
7246
|
function writeCache(cli, output) {
|
|
7237
|
-
const dir = join21(
|
|
7238
|
-
|
|
7247
|
+
const dir = join21(homedir8(), ".assist");
|
|
7248
|
+
mkdirSync8(dir, { recursive: true });
|
|
7239
7249
|
writeFileSync16(logPath(cli), output);
|
|
7240
7250
|
}
|
|
7241
7251
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
@@ -8061,9 +8071,9 @@ import { execFileSync } from "child_process";
|
|
|
8061
8071
|
import { basename as basename4 } from "path";
|
|
8062
8072
|
|
|
8063
8073
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
8064
|
-
import { homedir as
|
|
8074
|
+
import { homedir as homedir9 } from "os";
|
|
8065
8075
|
import { join as join22 } from "path";
|
|
8066
|
-
var BLOG_REPO_ROOT = join22(
|
|
8076
|
+
var BLOG_REPO_ROOT = join22(homedir9(), "git/blog");
|
|
8067
8077
|
function loadBlogSkipDays(repoName) {
|
|
8068
8078
|
const config = loadRawYaml(join22(BLOG_REPO_ROOT, "assist.yml"));
|
|
8069
8079
|
const devlog = config.devlog;
|
|
@@ -9407,7 +9417,7 @@ function registerGithub(program2) {
|
|
|
9407
9417
|
}
|
|
9408
9418
|
|
|
9409
9419
|
// src/commands/handover/archive.ts
|
|
9410
|
-
import { existsSync as existsSync30, mkdirSync as
|
|
9420
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync9, renameSync as renameSync2 } from "fs";
|
|
9411
9421
|
import { join as join30 } from "path";
|
|
9412
9422
|
|
|
9413
9423
|
// src/commands/handover/formatArchiveTimestamp.ts
|
|
@@ -9454,7 +9464,7 @@ function archive(options2 = {}) {
|
|
|
9454
9464
|
const handoverPath = getHandoverPath(cwd);
|
|
9455
9465
|
if (!existsSync30(handoverPath)) return void 0;
|
|
9456
9466
|
const archiveDir = getHandoverArchiveDir(cwd);
|
|
9457
|
-
|
|
9467
|
+
mkdirSync9(archiveDir, { recursive: true });
|
|
9458
9468
|
const timestamp = formatArchiveTimestamp(options2.now);
|
|
9459
9469
|
const destination = resolveCollisionPath(
|
|
9460
9470
|
archiveDir,
|
|
@@ -9749,11 +9759,11 @@ function acceptanceCriteria(issueKey) {
|
|
|
9749
9759
|
import { execSync as execSync28 } from "child_process";
|
|
9750
9760
|
|
|
9751
9761
|
// src/shared/loadJson.ts
|
|
9752
|
-
import { existsSync as existsSync32, mkdirSync as
|
|
9753
|
-
import { homedir as
|
|
9762
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync10, readFileSync as readFileSync27, writeFileSync as writeFileSync20 } from "fs";
|
|
9763
|
+
import { homedir as homedir10 } from "os";
|
|
9754
9764
|
import { join as join31 } from "path";
|
|
9755
9765
|
function getStoreDir() {
|
|
9756
|
-
return join31(
|
|
9766
|
+
return join31(homedir10(), ".assist");
|
|
9757
9767
|
}
|
|
9758
9768
|
function getStorePath(filename) {
|
|
9759
9769
|
return join31(getStoreDir(), filename);
|
|
@@ -9772,7 +9782,7 @@ function loadJson(filename) {
|
|
|
9772
9782
|
function saveJson(filename, data) {
|
|
9773
9783
|
const dir = getStoreDir();
|
|
9774
9784
|
if (!existsSync32(dir)) {
|
|
9775
|
-
|
|
9785
|
+
mkdirSync10(dir, { recursive: true });
|
|
9776
9786
|
}
|
|
9777
9787
|
writeFileSync20(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
9778
9788
|
}
|
|
@@ -9907,7 +9917,7 @@ function registerList(program2) {
|
|
|
9907
9917
|
}
|
|
9908
9918
|
|
|
9909
9919
|
// src/commands/mermaid/index.ts
|
|
9910
|
-
import { mkdirSync as
|
|
9920
|
+
import { mkdirSync as mkdirSync11, readdirSync as readdirSync5 } from "fs";
|
|
9911
9921
|
import { resolve as resolve10 } from "path";
|
|
9912
9922
|
import chalk114 from "chalk";
|
|
9913
9923
|
|
|
@@ -9976,7 +9986,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
9976
9986
|
async function mermaidExport(file, options2 = {}) {
|
|
9977
9987
|
const { mermaid } = loadConfig();
|
|
9978
9988
|
const outDir = resolve10(process.cwd(), options2.out ?? ".");
|
|
9979
|
-
|
|
9989
|
+
mkdirSync11(outDir, { recursive: true });
|
|
9980
9990
|
if (options2.index !== void 0) {
|
|
9981
9991
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
9982
9992
|
console.error(
|
|
@@ -10589,7 +10599,7 @@ function fixed(commentId, sha) {
|
|
|
10589
10599
|
}
|
|
10590
10600
|
|
|
10591
10601
|
// src/commands/prs/listComments/index.ts
|
|
10592
|
-
import { existsSync as existsSync34, mkdirSync as
|
|
10602
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync12, writeFileSync as writeFileSync24 } from "fs";
|
|
10593
10603
|
import { join as join35 } from "path";
|
|
10594
10604
|
import { stringify } from "yaml";
|
|
10595
10605
|
|
|
@@ -10716,7 +10726,7 @@ function printComments2(result) {
|
|
|
10716
10726
|
function writeCommentsCache(prNumber, comments3) {
|
|
10717
10727
|
const assistDir = join35(process.cwd(), ".assist");
|
|
10718
10728
|
if (!existsSync34(assistDir)) {
|
|
10719
|
-
|
|
10729
|
+
mkdirSync12(assistDir, { recursive: true });
|
|
10720
10730
|
}
|
|
10721
10731
|
const cacheData = {
|
|
10722
10732
|
prNumber,
|
|
@@ -13528,14 +13538,14 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
13528
13538
|
}
|
|
13529
13539
|
|
|
13530
13540
|
// src/commands/review/prepareReviewDir.ts
|
|
13531
|
-
import { existsSync as existsSync36, mkdirSync as
|
|
13541
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync13, unlinkSync as unlinkSync11, writeFileSync as writeFileSync26 } from "fs";
|
|
13532
13542
|
function clearReviewFiles(paths) {
|
|
13533
13543
|
for (const path53 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
13534
13544
|
if (existsSync36(path53)) unlinkSync11(path53);
|
|
13535
13545
|
}
|
|
13536
13546
|
}
|
|
13537
13547
|
function prepareReviewDir(paths, requestBody, force) {
|
|
13538
|
-
|
|
13548
|
+
mkdirSync13(paths.reviewDir, { recursive: true });
|
|
13539
13549
|
if (force) clearReviewFiles(paths);
|
|
13540
13550
|
writeFileSync26(paths.requestPath, requestBody);
|
|
13541
13551
|
}
|
|
@@ -15399,7 +15409,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
15399
15409
|
}
|
|
15400
15410
|
|
|
15401
15411
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
15402
|
-
import { existsSync as existsSync40, mkdirSync as
|
|
15412
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync14, readFileSync as readFileSync33, writeFileSync as writeFileSync28 } from "fs";
|
|
15403
15413
|
import { basename as basename7, dirname as dirname21, join as join41 } from "path";
|
|
15404
15414
|
|
|
15405
15415
|
// src/commands/transcript/cleanText.ts
|
|
@@ -15625,7 +15635,7 @@ function logSkipped(relativeDir, mdFile) {
|
|
|
15625
15635
|
}
|
|
15626
15636
|
function ensureDirectory(dir, label2) {
|
|
15627
15637
|
if (!existsSync40(dir)) {
|
|
15628
|
-
|
|
15638
|
+
mkdirSync14(dir, { recursive: true });
|
|
15629
15639
|
console.log(`Created ${label2}: ${dir}`);
|
|
15630
15640
|
}
|
|
15631
15641
|
}
|
|
@@ -15724,7 +15734,7 @@ import { basename as basename8, dirname as dirname23, join as join43, relative a
|
|
|
15724
15734
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
15725
15735
|
import {
|
|
15726
15736
|
existsSync as existsSync42,
|
|
15727
|
-
mkdirSync as
|
|
15737
|
+
mkdirSync as mkdirSync15,
|
|
15728
15738
|
readFileSync as readFileSync34,
|
|
15729
15739
|
renameSync as renameSync4,
|
|
15730
15740
|
rmSync as rmSync2
|
|
@@ -15785,7 +15795,7 @@ function processStagedFile() {
|
|
|
15785
15795
|
const destPath = join42(summaryDir, matchingTranscript.relativePath);
|
|
15786
15796
|
const destDir = dirname22(destPath);
|
|
15787
15797
|
if (!existsSync42(destDir)) {
|
|
15788
|
-
|
|
15798
|
+
mkdirSync15(destDir, { recursive: true });
|
|
15789
15799
|
}
|
|
15790
15800
|
renameSync4(stagedFile.absolutePath, destPath);
|
|
15791
15801
|
const remaining = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -15885,11 +15895,11 @@ import { spawnSync as spawnSync4 } from "child_process";
|
|
|
15885
15895
|
import { join as join45 } from "path";
|
|
15886
15896
|
|
|
15887
15897
|
// src/commands/voice/shared.ts
|
|
15888
|
-
import { homedir as
|
|
15898
|
+
import { homedir as homedir11 } from "os";
|
|
15889
15899
|
import { dirname as dirname24, join as join44 } from "path";
|
|
15890
15900
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
15891
15901
|
var __dirname6 = dirname24(fileURLToPath6(import.meta.url));
|
|
15892
|
-
var VOICE_DIR = join44(
|
|
15902
|
+
var VOICE_DIR = join44(homedir11(), ".assist", "voice");
|
|
15893
15903
|
var voicePaths = {
|
|
15894
15904
|
dir: VOICE_DIR,
|
|
15895
15905
|
pid: join44(VOICE_DIR, "voice.pid"),
|
|
@@ -15947,12 +15957,12 @@ function logs(options2) {
|
|
|
15947
15957
|
|
|
15948
15958
|
// src/commands/voice/setup.ts
|
|
15949
15959
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
15950
|
-
import { mkdirSync as
|
|
15960
|
+
import { mkdirSync as mkdirSync17 } from "fs";
|
|
15951
15961
|
import { join as join47 } from "path";
|
|
15952
15962
|
|
|
15953
15963
|
// src/commands/voice/checkLockFile.ts
|
|
15954
15964
|
import { execSync as execSync44 } from "child_process";
|
|
15955
|
-
import { existsSync as existsSync45, mkdirSync as
|
|
15965
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync16, readFileSync as readFileSync36, writeFileSync as writeFileSync29 } from "fs";
|
|
15956
15966
|
import { join as join46 } from "path";
|
|
15957
15967
|
function isProcessAlive2(pid) {
|
|
15958
15968
|
try {
|
|
@@ -15990,7 +16000,7 @@ function bootstrapVenv() {
|
|
|
15990
16000
|
}
|
|
15991
16001
|
function writeLockFile(pid) {
|
|
15992
16002
|
const lockFile = getLockFile();
|
|
15993
|
-
|
|
16003
|
+
mkdirSync16(join46(lockFile, ".."), { recursive: true });
|
|
15994
16004
|
writeFileSync29(
|
|
15995
16005
|
lockFile,
|
|
15996
16006
|
JSON.stringify({
|
|
@@ -16003,7 +16013,7 @@ function writeLockFile(pid) {
|
|
|
16003
16013
|
|
|
16004
16014
|
// src/commands/voice/setup.ts
|
|
16005
16015
|
function setup() {
|
|
16006
|
-
|
|
16016
|
+
mkdirSync17(voicePaths.dir, { recursive: true });
|
|
16007
16017
|
bootstrapVenv();
|
|
16008
16018
|
console.log("\nDownloading models...\n");
|
|
16009
16019
|
const script = join47(getPythonDir(), "setup_models.py");
|
|
@@ -16019,7 +16029,7 @@ function setup() {
|
|
|
16019
16029
|
|
|
16020
16030
|
// src/commands/voice/start.ts
|
|
16021
16031
|
import { spawn as spawn7 } from "child_process";
|
|
16022
|
-
import { mkdirSync as
|
|
16032
|
+
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync30 } from "fs";
|
|
16023
16033
|
import { join as join48 } from "path";
|
|
16024
16034
|
|
|
16025
16035
|
// src/commands/voice/buildDaemonEnv.ts
|
|
@@ -16053,7 +16063,7 @@ function spawnBackground(python, script, env) {
|
|
|
16053
16063
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
16054
16064
|
}
|
|
16055
16065
|
function start2(options2) {
|
|
16056
|
-
|
|
16066
|
+
mkdirSync18(voicePaths.dir, { recursive: true });
|
|
16057
16067
|
checkLockFile();
|
|
16058
16068
|
bootstrapVenv();
|
|
16059
16069
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
@@ -16608,7 +16618,7 @@ async function run3(name, args) {
|
|
|
16608
16618
|
}
|
|
16609
16619
|
|
|
16610
16620
|
// src/commands/run/add.ts
|
|
16611
|
-
import { mkdirSync as
|
|
16621
|
+
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync31 } from "fs";
|
|
16612
16622
|
import { join as join51 } from "path";
|
|
16613
16623
|
|
|
16614
16624
|
// src/commands/run/extractOption.ts
|
|
@@ -16671,7 +16681,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
16671
16681
|
}
|
|
16672
16682
|
function createCommandFile(name) {
|
|
16673
16683
|
const dir = join51(".claude", "commands");
|
|
16674
|
-
|
|
16684
|
+
mkdirSync19(dir, { recursive: true });
|
|
16675
16685
|
const content = `---
|
|
16676
16686
|
description: Run ${name}
|
|
16677
16687
|
---
|
|
@@ -16790,7 +16800,7 @@ function registerRun(program2) {
|
|
|
16790
16800
|
|
|
16791
16801
|
// src/commands/screenshot/index.ts
|
|
16792
16802
|
import { execSync as execSync47 } from "child_process";
|
|
16793
|
-
import { existsSync as existsSync50, mkdirSync as
|
|
16803
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync20, unlinkSync as unlinkSync16, writeFileSync as writeFileSync32 } from "fs";
|
|
16794
16804
|
import { tmpdir as tmpdir7 } from "os";
|
|
16795
16805
|
import { join as join53, resolve as resolve13 } from "path";
|
|
16796
16806
|
import chalk157 from "chalk";
|
|
@@ -16923,7 +16933,7 @@ Write-Output $OutputPath
|
|
|
16923
16933
|
// src/commands/screenshot/index.ts
|
|
16924
16934
|
function buildOutputPath(outputDir, processName) {
|
|
16925
16935
|
if (!existsSync50(outputDir)) {
|
|
16926
|
-
|
|
16936
|
+
mkdirSync20(outputDir, { recursive: true });
|
|
16927
16937
|
}
|
|
16928
16938
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
16929
16939
|
return resolve13(outputDir, `${processName}-${timestamp}.png`);
|
|
@@ -17105,7 +17115,7 @@ async function restartDaemon() {
|
|
|
17105
17115
|
}
|
|
17106
17116
|
|
|
17107
17117
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
17108
|
-
import { mkdirSync as
|
|
17118
|
+
import { mkdirSync as mkdirSync22 } from "fs";
|
|
17109
17119
|
|
|
17110
17120
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
17111
17121
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -17559,15 +17569,15 @@ function clearIdle(session) {
|
|
|
17559
17569
|
}
|
|
17560
17570
|
|
|
17561
17571
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
17562
|
-
import { existsSync as existsSync52, mkdirSync as
|
|
17572
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync21, watch } from "fs";
|
|
17563
17573
|
import { dirname as dirname27 } from "path";
|
|
17564
17574
|
var DEBOUNCE_MS = 50;
|
|
17565
17575
|
function watchActivity(session, notify2) {
|
|
17566
17576
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
17567
|
-
const path53 = activityPath(session.
|
|
17577
|
+
const path53 = activityPath(session.id);
|
|
17568
17578
|
const dir = dirname27(path53);
|
|
17569
17579
|
try {
|
|
17570
|
-
|
|
17580
|
+
mkdirSync21(dir, { recursive: true });
|
|
17571
17581
|
} catch {
|
|
17572
17582
|
return;
|
|
17573
17583
|
}
|
|
@@ -17588,7 +17598,7 @@ function watchActivity(session, notify2) {
|
|
|
17588
17598
|
}
|
|
17589
17599
|
function refreshActivity(session) {
|
|
17590
17600
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
17591
|
-
const activity2 = readActivity(activityPath(session.
|
|
17601
|
+
const activity2 = readActivity(activityPath(session.id));
|
|
17592
17602
|
if (activity2) session.activity = activity2;
|
|
17593
17603
|
}
|
|
17594
17604
|
|
|
@@ -17729,7 +17739,7 @@ function dismissSession(sessions, id) {
|
|
|
17729
17739
|
if (s.status !== "done") s.pty?.kill();
|
|
17730
17740
|
clearIdle(s);
|
|
17731
17741
|
s.activityWatcher?.close();
|
|
17732
|
-
|
|
17742
|
+
removeActivity(s.id);
|
|
17733
17743
|
sessions.delete(id);
|
|
17734
17744
|
return true;
|
|
17735
17745
|
}
|
|
@@ -18020,7 +18030,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
18020
18030
|
|
|
18021
18031
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
18022
18032
|
async function runDaemon() {
|
|
18023
|
-
|
|
18033
|
+
mkdirSync22(daemonPaths.dir, { recursive: true });
|
|
18024
18034
|
daemonLog(
|
|
18025
18035
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
18026
18036
|
);
|