@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
package/dist/languages/index.js
CHANGED
|
@@ -1360,13 +1360,14 @@ async function detectLanguageWorkspaces(options) {
|
|
|
1360
1360
|
const target = options.target ? await canonicalInside(resolveFrom(cwd, options.target), projectRoot, "target") : void 0;
|
|
1361
1361
|
const profiles = (options.profiles ?? languageProfileRegistry.list()).filter((profile) => !options.language || profile.id === options.language).slice().sort((a, b) => a.id.localeCompare(b.id));
|
|
1362
1362
|
const limits = normalizeLimits(options.limits);
|
|
1363
|
+
const extraIgnores = new Set(options.ignoredDirectories ?? []);
|
|
1363
1364
|
const state = {
|
|
1364
1365
|
entries: 0,
|
|
1365
1366
|
truncated: false,
|
|
1366
1367
|
sourcePaths: /* @__PURE__ */ new Map(),
|
|
1367
1368
|
candidates: /* @__PURE__ */ new Map()
|
|
1368
1369
|
};
|
|
1369
|
-
await scanDirectory(projectRoot, 0, profiles, limits, state, options.signal);
|
|
1370
|
+
await scanDirectory(projectRoot, 0, profiles, limits, state, extraIgnores, options.signal);
|
|
1370
1371
|
addSourceFallbacks(projectRoot, profiles, state);
|
|
1371
1372
|
if (target) addTargetEvidence(target, projectRoot, profiles, state);
|
|
1372
1373
|
const workspaces = await Promise.all(
|
|
@@ -1380,7 +1381,7 @@ async function detectLanguageWorkspaces(options) {
|
|
|
1380
1381
|
workspaces
|
|
1381
1382
|
};
|
|
1382
1383
|
}
|
|
1383
|
-
async function scanDirectory(directory, depth, profiles, limits, state, signal) {
|
|
1384
|
+
async function scanDirectory(directory, depth, profiles, limits, state, extraIgnores, signal) {
|
|
1384
1385
|
signal?.throwIfAborted();
|
|
1385
1386
|
if (depth > limits.maxDepth || state.entries >= limits.maxEntries) {
|
|
1386
1387
|
state.truncated = true;
|
|
@@ -1403,12 +1404,12 @@ async function scanDirectory(directory, depth, profiles, limits, state, signal)
|
|
|
1403
1404
|
const fullPath = path.join(directory, entry.name);
|
|
1404
1405
|
if (entry.isSymbolicLink()) continue;
|
|
1405
1406
|
if (entry.isDirectory()) {
|
|
1406
|
-
if (shouldIgnoreDirectory(entry.name, profiles)) continue;
|
|
1407
|
+
if (shouldIgnoreDirectory(entry.name, profiles, extraIgnores)) continue;
|
|
1407
1408
|
if (depth >= limits.maxDepth) {
|
|
1408
1409
|
state.truncated = true;
|
|
1409
1410
|
continue;
|
|
1410
1411
|
}
|
|
1411
|
-
await scanDirectory(fullPath, depth + 1, profiles, limits, state, signal);
|
|
1412
|
+
await scanDirectory(fullPath, depth + 1, profiles, limits, state, extraIgnores, signal);
|
|
1412
1413
|
continue;
|
|
1413
1414
|
}
|
|
1414
1415
|
if (!entry.isFile()) continue;
|
|
@@ -1537,8 +1538,8 @@ function getCandidate(state, profile, root) {
|
|
|
1537
1538
|
}
|
|
1538
1539
|
return candidate;
|
|
1539
1540
|
}
|
|
1540
|
-
function shouldIgnoreDirectory(name, profiles) {
|
|
1541
|
-
if (GLOBAL_IGNORES.has(name) || name.startsWith(".")) return true;
|
|
1541
|
+
function shouldIgnoreDirectory(name, profiles, extraIgnores) {
|
|
1542
|
+
if (GLOBAL_IGNORES.has(name) || extraIgnores.has(name) || name.startsWith(".")) return true;
|
|
1542
1543
|
return profiles.some((profile) => profile.ignoredDirectories.includes(name));
|
|
1543
1544
|
}
|
|
1544
1545
|
function normalizeLimits(input) {
|
|
@@ -2078,7 +2079,12 @@ import * as path7 from "node:path";
|
|
|
2078
2079
|
|
|
2079
2080
|
// src/_spawn-stream.ts
|
|
2080
2081
|
import { spawn as spawn2 } from "node:child_process";
|
|
2081
|
-
import {
|
|
2082
|
+
import {
|
|
2083
|
+
buildChildEnv,
|
|
2084
|
+
emitProcessCompleted,
|
|
2085
|
+
emitProcessOutput,
|
|
2086
|
+
emitProcessStarted
|
|
2087
|
+
} from "@wrongstack/core";
|
|
2082
2088
|
|
|
2083
2089
|
// src/_output-spool.ts
|
|
2084
2090
|
import { createWriteStream, mkdirSync } from "node:fs";
|
|
@@ -2388,9 +2394,14 @@ import { expectDefined } from "@wrongstack/core";
|
|
|
2388
2394
|
var SENSITIVE_FLAG_PATTERNS = [
|
|
2389
2395
|
// --flag=value or --flag "value" (value captured up to next space or comma)
|
|
2390
2396
|
/--(?: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,
|
|
2391
|
-
// -
|
|
2392
|
-
|
|
2393
|
-
/
|
|
2397
|
+
// -t short flag (token): attached (-tVALUE), separated (-t VALUE), or -t=VALUE.
|
|
2398
|
+
// (?<![-\w]) anchors to a token start so we don't match the `-t` inside `--token`.
|
|
2399
|
+
// NOTE: synced with @wrongstack/core observability/redact-command.ts.
|
|
2400
|
+
/(?<![-\w])-t(?:[=\s]+)?[^\s,-]+/,
|
|
2401
|
+
// -p|-password|-a (redis auth) short flags: attached + separated + =value.
|
|
2402
|
+
// Same token-start anchor; over-redaction is an accepted tradeoff for a
|
|
2403
|
+
// redaction function. Synced with core copy.
|
|
2404
|
+
/(?<![-\w])-(?:password|p|a)(?:[=\s]+)?[^\s,-]+/gi,
|
|
2394
2405
|
// env var–style secrets: TOKEN=x, API_KEY=y, etc.
|
|
2395
2406
|
/(?:TOKEN|API_KEY|API_SECRET|AUTH_TOKEN|GITHUB_TOKEN|GH_TOKEN|BEARER|JWT|OAUTH|CREDENTIAL|SECRET|PRIVATE_KEY|PASSWORD|PASSWD)\s*[=:]\s*[^\s,]+/gi,
|
|
2396
2407
|
// Generic high-entropy look: base64 strings >32 chars or hex strings >32 digits — but only
|
|
@@ -2408,8 +2419,10 @@ function redactCommand(cmd) {
|
|
|
2408
2419
|
const flag = match.slice(0, match.indexOf(expectDefined(delim)) + 1);
|
|
2409
2420
|
return `${flag}[REDACTED]`;
|
|
2410
2421
|
}
|
|
2411
|
-
|
|
2412
|
-
|
|
2422
|
+
if (match.startsWith("--")) {
|
|
2423
|
+
return match;
|
|
2424
|
+
}
|
|
2425
|
+
return `${match.slice(0, 2)}[REDACTED]`;
|
|
2413
2426
|
});
|
|
2414
2427
|
}
|
|
2415
2428
|
return result;
|
|
@@ -2846,6 +2859,19 @@ async function* spawnStream(opts) {
|
|
|
2846
2859
|
});
|
|
2847
2860
|
const registry = getProcessRegistry();
|
|
2848
2861
|
const pid = child.pid;
|
|
2862
|
+
const processStartedAt = Date.now();
|
|
2863
|
+
let stdoutBytes = 0;
|
|
2864
|
+
let stderrBytes = 0;
|
|
2865
|
+
let telemetryCompleted = false;
|
|
2866
|
+
emitProcessStarted({
|
|
2867
|
+
...pid !== void 0 ? { pid } : {},
|
|
2868
|
+
parentPid: process.pid,
|
|
2869
|
+
command: redactCommand(`${opts.cmd} ${opts.args.join(" ")}`),
|
|
2870
|
+
args: redactCommand(opts.args.join(" ")).split(" ").filter(Boolean),
|
|
2871
|
+
cwd: opts.cwd,
|
|
2872
|
+
background: false,
|
|
2873
|
+
startedAt: new Date(processStartedAt).toISOString()
|
|
2874
|
+
});
|
|
2849
2875
|
if (typeof pid === "number") {
|
|
2850
2876
|
registry.register({
|
|
2851
2877
|
pid,
|
|
@@ -2874,6 +2900,8 @@ async function* spawnStream(opts) {
|
|
|
2874
2900
|
};
|
|
2875
2901
|
const onOut = (c) => {
|
|
2876
2902
|
const s = c.toString();
|
|
2903
|
+
stdoutBytes += c.byteLength;
|
|
2904
|
+
emitProcessOutput({ pid, stream: "stdout", chunk: c });
|
|
2877
2905
|
if (stdout.length < max) stdout += s;
|
|
2878
2906
|
spool.write(s);
|
|
2879
2907
|
queue.push({ kind: "out", data: s });
|
|
@@ -2886,6 +2914,8 @@ async function* spawnStream(opts) {
|
|
|
2886
2914
|
};
|
|
2887
2915
|
const onErr = (c) => {
|
|
2888
2916
|
const s = c.toString();
|
|
2917
|
+
stderrBytes += c.byteLength;
|
|
2918
|
+
emitProcessOutput({ pid, stream: "stderr", chunk: c });
|
|
2889
2919
|
if (stderr.length < max) stderr += s;
|
|
2890
2920
|
spool.write(s);
|
|
2891
2921
|
queue.push({ kind: "err", data: s });
|
|
@@ -2903,9 +2933,25 @@ async function* spawnStream(opts) {
|
|
|
2903
2933
|
queue.push({ kind: "error", data: e.message });
|
|
2904
2934
|
wake();
|
|
2905
2935
|
});
|
|
2906
|
-
|
|
2936
|
+
const completeTelemetry = (code, signal, timedOut = false) => {
|
|
2937
|
+
if (telemetryCompleted) return;
|
|
2938
|
+
telemetryCompleted = true;
|
|
2939
|
+
emitProcessCompleted({
|
|
2940
|
+
...pid !== void 0 ? { pid } : {},
|
|
2941
|
+
exitCode: code,
|
|
2942
|
+
...signal ? { signal } : {},
|
|
2943
|
+
durationMs: Date.now() - processStartedAt,
|
|
2944
|
+
stdoutBytes,
|
|
2945
|
+
stderrBytes,
|
|
2946
|
+
timedOut,
|
|
2947
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2948
|
+
});
|
|
2949
|
+
};
|
|
2950
|
+
child.on("close", (code, signal) => {
|
|
2907
2951
|
if (typeof pid === "number") registry.unregister(pid);
|
|
2908
|
-
|
|
2952
|
+
const exitCode2 = code ?? (signal ? 1 : 0);
|
|
2953
|
+
completeTelemetry(exitCode2, signal ?? void 0);
|
|
2954
|
+
queue.push({ kind: "close", data: "", code: exitCode2, ...signal ? { signal } : {} });
|
|
2909
2955
|
wake();
|
|
2910
2956
|
});
|
|
2911
2957
|
const onAbort = () => {
|
|
@@ -2918,6 +2964,7 @@ async function* spawnStream(opts) {
|
|
|
2918
2964
|
}
|
|
2919
2965
|
}
|
|
2920
2966
|
queue.push({ kind: "close", data: "", code: 124 });
|
|
2967
|
+
completeTelemetry(124, "SIGKILL", true);
|
|
2921
2968
|
wake();
|
|
2922
2969
|
};
|
|
2923
2970
|
if (isWin) {
|