@wrongstack/tools 0.287.0 → 0.289.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/_fetch-guard.d.ts.map +1 -1
- package/dist/_redact-command.d.ts.map +1 -1
- package/dist/_spawn-stream.d.ts.map +1 -1
- package/dist/audit.js +61 -14
- package/dist/audit.js.map +3 -3
- package/dist/bash.d.ts +1 -1
- package/dist/bash.d.ts.map +1 -1
- package/dist/bash.js +97 -19
- package/dist/bash.js.map +3 -3
- package/dist/builtin.d.ts +12 -10
- package/dist/builtin.d.ts.map +1 -1
- package/dist/builtin.js +1620 -803
- package/dist/builtin.js.map +3 -3
- package/dist/codebase-index/background-indexer.d.ts.map +1 -1
- package/dist/codebase-index/bm25.d.ts +1 -2
- package/dist/codebase-index/bm25.d.ts.map +1 -1
- package/dist/codebase-index/codebase-index-tool.d.ts.map +1 -1
- package/dist/codebase-index/codebase-search-tool.d.ts.map +1 -1
- package/dist/codebase-index/codebase-stats-tool.d.ts +7 -0
- package/dist/codebase-index/codebase-stats-tool.d.ts.map +1 -1
- package/dist/codebase-index/index-service.d.ts +11 -1
- package/dist/codebase-index/index-service.d.ts.map +1 -1
- package/dist/codebase-index/index.d.ts +2 -1
- package/dist/codebase-index/index.d.ts.map +1 -1
- package/dist/codebase-index/index.js +749 -192
- package/dist/codebase-index/index.js.map +3 -3
- package/dist/codebase-index/indexer.d.ts.map +1 -1
- package/dist/codebase-index/schema.d.ts +43 -1
- package/dist/codebase-index/schema.d.ts.map +1 -1
- package/dist/codebase-index/ts-parser.d.ts.map +1 -1
- package/dist/codebase-index/worker-protocol.d.ts +1 -0
- package/dist/codebase-index/worker-protocol.d.ts.map +1 -1
- package/dist/codebase-index/worker.js +610 -152
- package/dist/codebase-index/worker.js.map +3 -3
- package/dist/codebase-index/writer.d.ts +27 -1
- package/dist/codebase-index/writer.d.ts.map +1 -1
- package/dist/e2e.js +477 -0
- package/dist/e2e.js.map +7 -0
- package/dist/exec.d.ts +1 -1
- package/dist/exec.d.ts.map +1 -1
- package/dist/exec.js +60 -5
- package/dist/exec.js.map +3 -3
- package/dist/fetch.js +2 -2
- package/dist/fetch.js.map +2 -2
- package/dist/format.js +61 -14
- package/dist/format.js.map +3 -3
- package/dist/glob.js +2 -2
- package/dist/glob.js.map +1 -1
- package/dist/grep.d.ts.map +1 -1
- package/dist/grep.js +2 -2
- package/dist/grep.js.map +2 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1786 -809
- package/dist/index.js.map +3 -3
- package/dist/install.js +61 -14
- package/dist/install.js.map +3 -3
- package/dist/kanban.d.ts +11 -2
- package/dist/kanban.d.ts.map +1 -1
- package/dist/kanban.js +695 -571
- package/dist/kanban.js.map +3 -3
- package/dist/languages/detect.d.ts.map +1 -1
- package/dist/languages/index.js +61 -14
- package/dist/languages/index.js.map +3 -3
- package/dist/languages/types.d.ts +7 -0
- package/dist/languages/types.d.ts.map +1 -1
- package/dist/lint.js +61 -14
- package/dist/lint.js.map +3 -3
- package/dist/outdated.js +61 -14
- package/dist/outdated.js.map +3 -3
- package/dist/pack.js +1617 -800
- package/dist/pack.js.map +3 -3
- package/dist/plan.js +4 -0
- package/dist/plan.js.map +2 -2
- package/dist/process-registry.js +12 -5
- package/dist/process-registry.js.map +2 -2
- package/dist/search.js +2 -2
- package/dist/search.js.map +2 -2
- package/dist/session-kanban.d.ts +9 -0
- package/dist/session-kanban.d.ts.map +1 -1
- package/dist/session-kanban.js +137 -0
- package/dist/session-kanban.js.map +2 -2
- package/dist/task.js +4 -0
- package/dist/task.js.map +2 -2
- package/dist/test.js +61 -14
- package/dist/test.js.map +3 -3
- package/dist/todo.js +4 -0
- package/dist/todo.js.map +2 -2
- package/dist/tree.js +2 -2
- package/dist/tree.js.map +1 -1
- package/dist/typecheck.js +61 -14
- package/dist/typecheck.js.map +3 -3
- package/package.json +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_fetch-guard.d.ts","sourceRoot":"","sources":["../src/_fetch-guard.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,aAAa,SAAwD,CAAC;AAUnF,KAAK,cAAc,GAAG,CACpB,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EACjC,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACzE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,KACxB,IAAI,CAAC;AAEV;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EACnE,QAAQ,EAAE,cAAc,GACvB,IAAI,CAsCN;
|
|
1
|
+
{"version":3,"file":"_fetch-guard.d.ts","sourceRoot":"","sources":["../src/_fetch-guard.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,aAAa,SAAwD,CAAC;AAUnF,KAAK,cAAc,GAAG,CACpB,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EACjC,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACzE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,KACxB,IAAI,CAAC;AAEV;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,EACnE,QAAQ,EAAE,cAAc,GACvB,IAAI,CAsCN;AA6CD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG7B,GACA,OAAO,CAAC,QAAQ,CAAC,CAuDnB;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoDtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_redact-command.d.ts","sourceRoot":"","sources":["../src/_redact-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_redact-command.d.ts","sourceRoot":"","sources":["../src/_redact-command.ts"],"names":[],"mappings":"AA4BA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA6BjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_spawn-stream.d.ts","sourceRoot":"","sources":["../src/_spawn-stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_spawn-stream.d.ts","sourceRoot":"","sources":["../src/_spawn-stream.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAS1D,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,yFAAyF;IACzF,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAuB,WAAW,CAChC,IAAI,EAAE,kBAAkB,GACvB,cAAc,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAyPtD"}
|
package/dist/audit.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// src/_spawn-stream.ts
|
|
2
2
|
import { spawn as spawn2 } from "node:child_process";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
buildChildEnv,
|
|
5
|
+
emitProcessCompleted,
|
|
6
|
+
emitProcessOutput,
|
|
7
|
+
emitProcessStarted
|
|
8
|
+
} from "@wrongstack/core";
|
|
4
9
|
|
|
5
10
|
// src/_output-spool.ts
|
|
6
11
|
import { createWriteStream, mkdirSync } from "node:fs";
|
|
@@ -310,9 +315,14 @@ import { expectDefined } from "@wrongstack/core";
|
|
|
310
315
|
var SENSITIVE_FLAG_PATTERNS = [
|
|
311
316
|
// --flag=value or --flag "value" (value captured up to next space or comma)
|
|
312
317
|
/--(?:token|password|passwd|pwd|secret|api[-_]?key|api[-_]?secret|auth|credential|private[-_]?key|access[-_]?key|github[-_]?token|gh[-_]?token|bearer|jwt|oauth|pin|pincode|passphrase|access[-_]?token)(?:[=\s,][^\s]*)?/gi,
|
|
313
|
-
// -
|
|
314
|
-
|
|
315
|
-
/
|
|
318
|
+
// -t short flag (token): attached (-tVALUE), separated (-t VALUE), or -t=VALUE.
|
|
319
|
+
// (?<![-\w]) anchors to a token start so we don't match the `-t` inside `--token`.
|
|
320
|
+
// NOTE: synced with @wrongstack/core observability/redact-command.ts.
|
|
321
|
+
/(?<![-\w])-t(?:[=\s]+)?[^\s,-]+/,
|
|
322
|
+
// -p|-password|-a (redis auth) short flags: attached + separated + =value.
|
|
323
|
+
// Same token-start anchor; over-redaction is an accepted tradeoff for a
|
|
324
|
+
// redaction function. Synced with core copy.
|
|
325
|
+
/(?<![-\w])-(?:password|p|a)(?:[=\s]+)?[^\s,-]+/gi,
|
|
316
326
|
// env var–style secrets: TOKEN=x, API_KEY=y, etc.
|
|
317
327
|
/(?:TOKEN|API_KEY|API_SECRET|AUTH_TOKEN|GITHUB_TOKEN|GH_TOKEN|BEARER|JWT|OAUTH|CREDENTIAL|SECRET|PRIVATE_KEY|PASSWORD|PASSWD)\s*[=:]\s*[^\s,]+/gi,
|
|
318
328
|
// Generic high-entropy look: base64 strings >32 chars or hex strings >32 digits — but only
|
|
@@ -330,8 +340,10 @@ function redactCommand(cmd) {
|
|
|
330
340
|
const flag = match.slice(0, match.indexOf(expectDefined(delim)) + 1);
|
|
331
341
|
return `${flag}[REDACTED]`;
|
|
332
342
|
}
|
|
333
|
-
|
|
334
|
-
|
|
343
|
+
if (match.startsWith("--")) {
|
|
344
|
+
return match;
|
|
345
|
+
}
|
|
346
|
+
return `${match.slice(0, 2)}[REDACTED]`;
|
|
335
347
|
});
|
|
336
348
|
}
|
|
337
349
|
return result;
|
|
@@ -768,6 +780,19 @@ async function* spawnStream(opts) {
|
|
|
768
780
|
});
|
|
769
781
|
const registry = getProcessRegistry();
|
|
770
782
|
const pid = child.pid;
|
|
783
|
+
const processStartedAt = Date.now();
|
|
784
|
+
let stdoutBytes = 0;
|
|
785
|
+
let stderrBytes = 0;
|
|
786
|
+
let telemetryCompleted = false;
|
|
787
|
+
emitProcessStarted({
|
|
788
|
+
...pid !== void 0 ? { pid } : {},
|
|
789
|
+
parentPid: process.pid,
|
|
790
|
+
command: redactCommand(`${opts.cmd} ${opts.args.join(" ")}`),
|
|
791
|
+
args: redactCommand(opts.args.join(" ")).split(" ").filter(Boolean),
|
|
792
|
+
cwd: opts.cwd,
|
|
793
|
+
background: false,
|
|
794
|
+
startedAt: new Date(processStartedAt).toISOString()
|
|
795
|
+
});
|
|
771
796
|
if (typeof pid === "number") {
|
|
772
797
|
registry.register({
|
|
773
798
|
pid,
|
|
@@ -796,6 +821,8 @@ async function* spawnStream(opts) {
|
|
|
796
821
|
};
|
|
797
822
|
const onOut = (c) => {
|
|
798
823
|
const s = c.toString();
|
|
824
|
+
stdoutBytes += c.byteLength;
|
|
825
|
+
emitProcessOutput({ pid, stream: "stdout", chunk: c });
|
|
799
826
|
if (stdout.length < max) stdout += s;
|
|
800
827
|
spool.write(s);
|
|
801
828
|
queue.push({ kind: "out", data: s });
|
|
@@ -808,6 +835,8 @@ async function* spawnStream(opts) {
|
|
|
808
835
|
};
|
|
809
836
|
const onErr = (c) => {
|
|
810
837
|
const s = c.toString();
|
|
838
|
+
stderrBytes += c.byteLength;
|
|
839
|
+
emitProcessOutput({ pid, stream: "stderr", chunk: c });
|
|
811
840
|
if (stderr.length < max) stderr += s;
|
|
812
841
|
spool.write(s);
|
|
813
842
|
queue.push({ kind: "err", data: s });
|
|
@@ -825,9 +854,25 @@ async function* spawnStream(opts) {
|
|
|
825
854
|
queue.push({ kind: "error", data: e.message });
|
|
826
855
|
wake();
|
|
827
856
|
});
|
|
828
|
-
|
|
857
|
+
const completeTelemetry = (code, signal, timedOut = false) => {
|
|
858
|
+
if (telemetryCompleted) return;
|
|
859
|
+
telemetryCompleted = true;
|
|
860
|
+
emitProcessCompleted({
|
|
861
|
+
...pid !== void 0 ? { pid } : {},
|
|
862
|
+
exitCode: code,
|
|
863
|
+
...signal ? { signal } : {},
|
|
864
|
+
durationMs: Date.now() - processStartedAt,
|
|
865
|
+
stdoutBytes,
|
|
866
|
+
stderrBytes,
|
|
867
|
+
timedOut,
|
|
868
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
869
|
+
});
|
|
870
|
+
};
|
|
871
|
+
child.on("close", (code, signal) => {
|
|
829
872
|
if (typeof pid === "number") registry.unregister(pid);
|
|
830
|
-
|
|
873
|
+
const exitCode2 = code ?? (signal ? 1 : 0);
|
|
874
|
+
completeTelemetry(exitCode2, signal ?? void 0);
|
|
875
|
+
queue.push({ kind: "close", data: "", code: exitCode2, ...signal ? { signal } : {} });
|
|
831
876
|
wake();
|
|
832
877
|
});
|
|
833
878
|
const onAbort = () => {
|
|
@@ -840,6 +885,7 @@ async function* spawnStream(opts) {
|
|
|
840
885
|
}
|
|
841
886
|
}
|
|
842
887
|
queue.push({ kind: "close", data: "", code: 124 });
|
|
888
|
+
completeTelemetry(124, "SIGKILL", true);
|
|
843
889
|
wake();
|
|
844
890
|
};
|
|
845
891
|
if (isWin) {
|
|
@@ -2382,13 +2428,14 @@ async function detectLanguageWorkspaces(options) {
|
|
|
2382
2428
|
const target = options.target ? await canonicalInside(resolveFrom(cwd, options.target), projectRoot, "target") : void 0;
|
|
2383
2429
|
const profiles = (options.profiles ?? languageProfileRegistry.list()).filter((profile) => !options.language || profile.id === options.language).slice().sort((a, b) => a.id.localeCompare(b.id));
|
|
2384
2430
|
const limits = normalizeLimits(options.limits);
|
|
2431
|
+
const extraIgnores = new Set(options.ignoredDirectories ?? []);
|
|
2385
2432
|
const state = {
|
|
2386
2433
|
entries: 0,
|
|
2387
2434
|
truncated: false,
|
|
2388
2435
|
sourcePaths: /* @__PURE__ */ new Map(),
|
|
2389
2436
|
candidates: /* @__PURE__ */ new Map()
|
|
2390
2437
|
};
|
|
2391
|
-
await scanDirectory(projectRoot, 0, profiles, limits, state, options.signal);
|
|
2438
|
+
await scanDirectory(projectRoot, 0, profiles, limits, state, extraIgnores, options.signal);
|
|
2392
2439
|
addSourceFallbacks(projectRoot, profiles, state);
|
|
2393
2440
|
if (target) addTargetEvidence(target, projectRoot, profiles, state);
|
|
2394
2441
|
const workspaces = await Promise.all(
|
|
@@ -2402,7 +2449,7 @@ async function detectLanguageWorkspaces(options) {
|
|
|
2402
2449
|
workspaces
|
|
2403
2450
|
};
|
|
2404
2451
|
}
|
|
2405
|
-
async function scanDirectory(directory, depth, profiles, limits, state, signal) {
|
|
2452
|
+
async function scanDirectory(directory, depth, profiles, limits, state, extraIgnores, signal) {
|
|
2406
2453
|
signal?.throwIfAborted();
|
|
2407
2454
|
if (depth > limits.maxDepth || state.entries >= limits.maxEntries) {
|
|
2408
2455
|
state.truncated = true;
|
|
@@ -2425,12 +2472,12 @@ async function scanDirectory(directory, depth, profiles, limits, state, signal)
|
|
|
2425
2472
|
const fullPath = path4.join(directory, entry.name);
|
|
2426
2473
|
if (entry.isSymbolicLink()) continue;
|
|
2427
2474
|
if (entry.isDirectory()) {
|
|
2428
|
-
if (shouldIgnoreDirectory(entry.name, profiles)) continue;
|
|
2475
|
+
if (shouldIgnoreDirectory(entry.name, profiles, extraIgnores)) continue;
|
|
2429
2476
|
if (depth >= limits.maxDepth) {
|
|
2430
2477
|
state.truncated = true;
|
|
2431
2478
|
continue;
|
|
2432
2479
|
}
|
|
2433
|
-
await scanDirectory(fullPath, depth + 1, profiles, limits, state, signal);
|
|
2480
|
+
await scanDirectory(fullPath, depth + 1, profiles, limits, state, extraIgnores, signal);
|
|
2434
2481
|
continue;
|
|
2435
2482
|
}
|
|
2436
2483
|
if (!entry.isFile()) continue;
|
|
@@ -2559,8 +2606,8 @@ function getCandidate(state, profile, root) {
|
|
|
2559
2606
|
}
|
|
2560
2607
|
return candidate;
|
|
2561
2608
|
}
|
|
2562
|
-
function shouldIgnoreDirectory(name, profiles) {
|
|
2563
|
-
if (GLOBAL_IGNORES.has(name) || name.startsWith(".")) return true;
|
|
2609
|
+
function shouldIgnoreDirectory(name, profiles, extraIgnores) {
|
|
2610
|
+
if (GLOBAL_IGNORES.has(name) || extraIgnores.has(name) || name.startsWith(".")) return true;
|
|
2564
2611
|
return profiles.some((profile) => profile.ignoredDirectories.includes(name));
|
|
2565
2612
|
}
|
|
2566
2613
|
function normalizeLimits(input) {
|