@staff0rd/assist 0.1065.1 → 0.1065.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +418 -418
- package/dist/index.js +110 -59
- 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.1065.
|
|
9
|
+
version: "0.1065.3",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -32099,9 +32099,33 @@ function persistedTreeRoots() {
|
|
|
32099
32099
|
import { copyFileSync, existsSync as existsSync67, mkdirSync as mkdirSync24 } from "fs";
|
|
32100
32100
|
import { dirname as dirname36, join as join81 } from "path";
|
|
32101
32101
|
|
|
32102
|
-
// src/commands/sessions/daemon/worktree/
|
|
32102
|
+
// src/commands/sessions/daemon/worktree/installPaths.ts
|
|
32103
32103
|
import { resolve as resolve22 } from "path";
|
|
32104
32104
|
|
|
32105
|
+
// src/commands/sessions/daemon/worktree/enclosingPaths.ts
|
|
32106
|
+
import { isAbsolute as isAbsolute4, relative as relative8 } from "path";
|
|
32107
|
+
function isWithin(dir, parent) {
|
|
32108
|
+
const rel = relative8(parent, dir);
|
|
32109
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute4(rel);
|
|
32110
|
+
}
|
|
32111
|
+
function enclosingPaths(dirs) {
|
|
32112
|
+
return dirs.map(
|
|
32113
|
+
(dir, i) => dirs.slice(0, i).flatMap((other, j) => isWithin(dir, other) ? [j] : [])
|
|
32114
|
+
);
|
|
32115
|
+
}
|
|
32116
|
+
|
|
32117
|
+
// src/commands/sessions/daemon/worktree/pendingPathAction.ts
|
|
32118
|
+
function pendingPathAction(enclosing, states, paths, stopped) {
|
|
32119
|
+
if (stopped) return { kind: "skip", reason: "install stopped" };
|
|
32120
|
+
const failed3 = enclosing.find(
|
|
32121
|
+
(j) => states[j] === "failed" || states[j] === "skipped"
|
|
32122
|
+
);
|
|
32123
|
+
if (failed3 !== void 0)
|
|
32124
|
+
return { kind: "skip", reason: `${paths[failed3]} failed` };
|
|
32125
|
+
if (enclosing.every((j) => states[j] === "ok")) return { kind: "start" };
|
|
32126
|
+
return { kind: "wait" };
|
|
32127
|
+
}
|
|
32128
|
+
|
|
32105
32129
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
32106
32130
|
import { existsSync as existsSync66 } from "fs";
|
|
32107
32131
|
import { join as join80 } from "path";
|
|
@@ -32114,13 +32138,6 @@ function detectInstallCommand(dir) {
|
|
|
32114
32138
|
return "npm install";
|
|
32115
32139
|
}
|
|
32116
32140
|
|
|
32117
|
-
// src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
|
|
32118
|
-
function resolveInstallCommand(repoRoot2, install) {
|
|
32119
|
-
if (install === false) return null;
|
|
32120
|
-
if (typeof install === "string") return install;
|
|
32121
|
-
return detectInstallCommand(repoRoot2);
|
|
32122
|
-
}
|
|
32123
|
-
|
|
32124
32141
|
// src/commands/sessions/daemon/worktree/spawnInstall.ts
|
|
32125
32142
|
import { spawn as spawn7 } from "child_process";
|
|
32126
32143
|
|
|
@@ -32151,21 +32168,26 @@ function quoteForPosixShell(value) {
|
|
|
32151
32168
|
import { execFile as execFile12 } from "child_process";
|
|
32152
32169
|
var running2 = /* @__PURE__ */ new Map();
|
|
32153
32170
|
function trackInstall(worktreePath, child) {
|
|
32154
|
-
running2.
|
|
32171
|
+
const children = running2.get(worktreePath) ?? /* @__PURE__ */ new Set();
|
|
32172
|
+
children.add(child);
|
|
32173
|
+
running2.set(worktreePath, children);
|
|
32155
32174
|
}
|
|
32156
32175
|
function untrackInstall(worktreePath, child) {
|
|
32157
|
-
|
|
32158
|
-
|
|
32176
|
+
const children = running2.get(worktreePath);
|
|
32177
|
+
if (!children?.delete(child)) return false;
|
|
32178
|
+
if (children.size === 0) running2.delete(worktreePath);
|
|
32159
32179
|
return true;
|
|
32160
32180
|
}
|
|
32161
32181
|
function stopInstall(worktreePath) {
|
|
32162
|
-
const
|
|
32182
|
+
const children = running2.get(worktreePath);
|
|
32163
32183
|
running2.delete(worktreePath);
|
|
32164
|
-
|
|
32165
|
-
|
|
32166
|
-
|
|
32167
|
-
|
|
32168
|
-
|
|
32184
|
+
for (const child of children ?? []) {
|
|
32185
|
+
if (!child.pid) continue;
|
|
32186
|
+
daemonLog(
|
|
32187
|
+
`worktree ${worktreePath} install still running at teardown; killing pid ${child.pid} so removal is not racing it`
|
|
32188
|
+
);
|
|
32189
|
+
killTree(child.pid);
|
|
32190
|
+
}
|
|
32169
32191
|
}
|
|
32170
32192
|
function killTree(pid) {
|
|
32171
32193
|
if (process.platform === "win32") {
|
|
@@ -32219,6 +32241,66 @@ function spawnInstall(worktreePath, cwd, command, where, onDone) {
|
|
|
32219
32241
|
);
|
|
32220
32242
|
}
|
|
32221
32243
|
|
|
32244
|
+
// src/commands/sessions/daemon/worktree/startPathInstall.ts
|
|
32245
|
+
function startPathInstall(worktreePath, rel, dir, onDone) {
|
|
32246
|
+
const command = detectInstallCommand(dir);
|
|
32247
|
+
if (!command) {
|
|
32248
|
+
daemonLog(
|
|
32249
|
+
`worktree ${worktreePath} install in ${rel} failed: no package.json at ${dir}`
|
|
32250
|
+
);
|
|
32251
|
+
return "failed";
|
|
32252
|
+
}
|
|
32253
|
+
spawnInstall(
|
|
32254
|
+
worktreePath,
|
|
32255
|
+
dir,
|
|
32256
|
+
command,
|
|
32257
|
+
` in ${rel}`,
|
|
32258
|
+
(outcome) => onDone(outcome.ok && !outcome.stopped, outcome.stopped)
|
|
32259
|
+
);
|
|
32260
|
+
return "running";
|
|
32261
|
+
}
|
|
32262
|
+
|
|
32263
|
+
// src/commands/sessions/daemon/worktree/installPaths.ts
|
|
32264
|
+
function installPaths(worktreePath, paths, onSeeded, onInstalling) {
|
|
32265
|
+
const dirs = paths.map((rel) => resolve22(worktreePath, rel));
|
|
32266
|
+
const enclosing = enclosingPaths(dirs);
|
|
32267
|
+
const states = paths.map(() => "pending");
|
|
32268
|
+
let stopped = false;
|
|
32269
|
+
const pump = () => {
|
|
32270
|
+
for (let i = 0; i < paths.length; i++) {
|
|
32271
|
+
if (states[i] !== "pending") continue;
|
|
32272
|
+
const action = pendingPathAction(enclosing[i], states, paths, stopped);
|
|
32273
|
+
if (action.kind === "start")
|
|
32274
|
+
states[i] = startPathInstall(
|
|
32275
|
+
worktreePath,
|
|
32276
|
+
paths[i],
|
|
32277
|
+
dirs[i],
|
|
32278
|
+
(ok, wasStopped) => {
|
|
32279
|
+
states[i] = ok ? "ok" : "failed";
|
|
32280
|
+
stopped ||= wasStopped;
|
|
32281
|
+
pump();
|
|
32282
|
+
}
|
|
32283
|
+
);
|
|
32284
|
+
if (action.kind !== "skip") continue;
|
|
32285
|
+
states[i] = "skipped";
|
|
32286
|
+
daemonLog(
|
|
32287
|
+
`worktree ${worktreePath} install skipping ${paths[i]}: ${action.reason}`
|
|
32288
|
+
);
|
|
32289
|
+
}
|
|
32290
|
+
const running3 = paths.filter((_, i) => states[i] === "running");
|
|
32291
|
+
if (running3.length > 0) onInstalling(running3.join(", "));
|
|
32292
|
+
else if (!states.includes("pending")) onSeeded();
|
|
32293
|
+
};
|
|
32294
|
+
pump();
|
|
32295
|
+
}
|
|
32296
|
+
|
|
32297
|
+
// src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
|
|
32298
|
+
function resolveInstallCommand(repoRoot2, install) {
|
|
32299
|
+
if (install === false) return null;
|
|
32300
|
+
if (typeof install === "string") return install;
|
|
32301
|
+
return detectInstallCommand(repoRoot2);
|
|
32302
|
+
}
|
|
32303
|
+
|
|
32222
32304
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
32223
32305
|
function runInstall(worktreePath, clone, install, onSeeded, onInstalling = () => {
|
|
32224
32306
|
}) {
|
|
@@ -32234,37 +32316,6 @@ function runInstall(worktreePath, clone, install, onSeeded, onInstalling = () =>
|
|
|
32234
32316
|
onInstalling();
|
|
32235
32317
|
spawnInstall(worktreePath, worktreePath, command, "", () => onSeeded());
|
|
32236
32318
|
}
|
|
32237
|
-
function installPaths(worktreePath, paths, onSeeded, onInstalling) {
|
|
32238
|
-
const next3 = (index3) => {
|
|
32239
|
-
const rel = paths[index3];
|
|
32240
|
-
if (rel === void 0) {
|
|
32241
|
-
onSeeded();
|
|
32242
|
-
return;
|
|
32243
|
-
}
|
|
32244
|
-
const dir = resolve22(worktreePath, rel);
|
|
32245
|
-
const command = detectInstallCommand(dir);
|
|
32246
|
-
if (!command) {
|
|
32247
|
-
daemonLog(
|
|
32248
|
-
`worktree ${worktreePath} install in ${rel} failed: no package.json at ${dir}; skipping remaining paths`
|
|
32249
|
-
);
|
|
32250
|
-
onSeeded();
|
|
32251
|
-
return;
|
|
32252
|
-
}
|
|
32253
|
-
onInstalling(rel);
|
|
32254
|
-
spawnInstall(worktreePath, dir, command, ` in ${rel}`, (outcome) => {
|
|
32255
|
-
if (outcome.ok && !outcome.stopped) {
|
|
32256
|
-
next3(index3 + 1);
|
|
32257
|
-
return;
|
|
32258
|
-
}
|
|
32259
|
-
if (index3 < paths.length - 1)
|
|
32260
|
-
daemonLog(
|
|
32261
|
-
`worktree ${worktreePath} install skipping remaining paths: ${paths.slice(index3 + 1).join(", ")}`
|
|
32262
|
-
);
|
|
32263
|
-
onSeeded();
|
|
32264
|
-
});
|
|
32265
|
-
};
|
|
32266
|
-
next3(0);
|
|
32267
|
-
}
|
|
32268
32319
|
|
|
32269
32320
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
32270
32321
|
function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
@@ -32942,18 +32993,18 @@ function emitExtract(out, header, texts) {
|
|
|
32942
32993
|
}
|
|
32943
32994
|
|
|
32944
32995
|
// src/commands/miro/resolveExtractPath.ts
|
|
32945
|
-
import { isAbsolute as
|
|
32996
|
+
import { isAbsolute as isAbsolute5, relative as relative9, resolve as resolve25 } from "path";
|
|
32946
32997
|
function extractRoot(cwd) {
|
|
32947
32998
|
return findConfigUp(cwd)?.rootDir ?? cwd;
|
|
32948
32999
|
}
|
|
32949
33000
|
function resolveExtractPath(value, cwd) {
|
|
32950
33001
|
if (value === void 0) return void 0;
|
|
32951
|
-
return
|
|
33002
|
+
return isAbsolute5(value) ? value : resolve25(extractRoot(cwd), value);
|
|
32952
33003
|
}
|
|
32953
33004
|
function storedExtractPath(value, cwd) {
|
|
32954
33005
|
if (value === void 0) return void 0;
|
|
32955
33006
|
const absolute2 = resolve25(cwd, value);
|
|
32956
|
-
const within2 =
|
|
33007
|
+
const within2 = relative9(extractRoot(cwd), absolute2);
|
|
32957
33008
|
return within2.startsWith("..") ? absolute2 : within2;
|
|
32958
33009
|
}
|
|
32959
33010
|
|
|
@@ -33540,7 +33591,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
33540
33591
|
}
|
|
33541
33592
|
|
|
33542
33593
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33543
|
-
import { isAbsolute as
|
|
33594
|
+
import { isAbsolute as isAbsolute6, join as join85, resolve as resolve26 } from "path";
|
|
33544
33595
|
|
|
33545
33596
|
// src/commands/netcap/defaultCapturePath.ts
|
|
33546
33597
|
import { homedir as homedir24 } from "os";
|
|
@@ -33552,7 +33603,7 @@ function defaultCapturePath() {
|
|
|
33552
33603
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33553
33604
|
function resolveNetcapOutPath(out) {
|
|
33554
33605
|
if (!out) return defaultCapturePath();
|
|
33555
|
-
const dir =
|
|
33606
|
+
const dir = isAbsolute6(out) ? out : resolve26(process.cwd(), out);
|
|
33556
33607
|
return join85(dir, "capture.jsonl");
|
|
33557
33608
|
}
|
|
33558
33609
|
|
|
@@ -38013,7 +38064,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
38013
38064
|
|
|
38014
38065
|
// src/commands/readGitBranch.ts
|
|
38015
38066
|
import { readFileSync as readFileSync54, statSync as statSync11 } from "fs";
|
|
38016
|
-
import { isAbsolute as
|
|
38067
|
+
import { isAbsolute as isAbsolute7, join as join91, resolve as resolve29 } from "path";
|
|
38017
38068
|
function resolveGitDir(cwd) {
|
|
38018
38069
|
const dotGit = join91(cwd, ".git");
|
|
38019
38070
|
let stat5;
|
|
@@ -38036,7 +38087,7 @@ function resolveGitDir(cwd) {
|
|
|
38036
38087
|
return null;
|
|
38037
38088
|
}
|
|
38038
38089
|
const gitDir = match[1].trim();
|
|
38039
|
-
return
|
|
38090
|
+
return isAbsolute7(gitDir) ? gitDir : resolve29(cwd, gitDir);
|
|
38040
38091
|
}
|
|
38041
38092
|
function readGitBranch(cwd) {
|
|
38042
38093
|
const gitDir = resolveGitDir(cwd);
|
|
@@ -45450,10 +45501,10 @@ function referencePatterns(path109, { home, cwd }) {
|
|
|
45450
45501
|
const underHome = within(file, normalise(home));
|
|
45451
45502
|
if (underHome) forms.push(`~/${escapeRegExp2(underHome)}`);
|
|
45452
45503
|
const patterns = forms.map((form) => new RegExp(`${form}${NOT_AFTER}`));
|
|
45453
|
-
const
|
|
45454
|
-
if (
|
|
45504
|
+
const relative10 = within(file, normalise(cwd));
|
|
45505
|
+
if (relative10)
|
|
45455
45506
|
patterns.push(
|
|
45456
|
-
new RegExp(`${NOT_BEFORE_RELATIVE}${escapeRegExp2(
|
|
45507
|
+
new RegExp(`${NOT_BEFORE_RELATIVE}${escapeRegExp2(relative10)}${NOT_AFTER}`)
|
|
45457
45508
|
);
|
|
45458
45509
|
return patterns;
|
|
45459
45510
|
}
|