@wrongstack/cli 1.0.11 → 1.0.12

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.
@@ -11230,10 +11230,10 @@ function buildCodebaseMapCommand(opts) {
11230
11230
  const check = /(^|\s)--check(\s|$)/.test(text);
11231
11231
  const enrich = /(^|\s)--enrich(\s|$)/.test(text);
11232
11232
  const embed = /(^|\s)--embed(\s|$)/.test(text);
11233
- const exportMatch = /(^|\s)--export(?:[= ]([^\s]+))?(\s|$)/.exec(text);
11233
+ const exportMatch = /(^|\s)--export(?:[= ]([^\s-][^\s]*))?(\s|$)/.exec(text);
11234
11234
  const maxFilesMatch = /--max-files[= ](\d+)/.exec(text);
11235
11235
  const tokensMatch = /--tokens[= ](\d+)/.exec(text);
11236
- const maxTokens = tokensMatch ? Number(tokensMatch[1]) : void 0;
11236
+ const maxTokens = tokensMatch ? Math.min(Math.max(Number(tokensMatch[1]), MIN_MAP_TOKENS), MAX_MAP_TOKENS) : void 0;
11237
11237
  const projectRoot = opts.projectRoot;
11238
11238
  try {
11239
11239
  if (embed) {
@@ -11321,6 +11321,8 @@ function buildCodebaseMapCommand(opts) {
11321
11321
  };
11322
11322
  }
11323
11323
  var DEFAULT_EXPORT_FILE = "atlas.html";
11324
+ var MIN_MAP_TOKENS = 100;
11325
+ var MAX_MAP_TOKENS = 2e4;
11324
11326
  function noIndexMessage() {
11325
11327
  return color17.yellow(
11326
11328
  `No codebase index for this project yet. Run ${color17.bold("/codebase-reindex")} first.`
@@ -11405,14 +11407,17 @@ function buildCodebaseReindexCommand(opts) {
11405
11407
  "refresh \u2014 e.g. after a large branch switch, merge, or external edit."
11406
11408
  ].join("\n"),
11407
11409
  async run(args, _ctx) {
11408
- const force = /\b(force|--force|-f)\b/.test(args.trim());
11410
+ const force = /(^|\s)(force|--force|-f)(\s|$)/.test(args.trim());
11409
11411
  opts.renderer.write(color18.dim(`${force ? "Rebuilding" : "Reindexing"} codebase index\u2026
11410
11412
  `));
11411
11413
  try {
11412
11414
  resetIndexCircuitBreaker();
11413
11415
  const r = await runStartupIndex({ projectRoot: opts.projectRoot, force });
11414
- const summary = `${color18.green("\u2713")} codebase index ${force ? "rebuilt" : "updated"} ` + color18.dim(`\u2014 ${r.symbolsIndexed} symbols \xB7 ${r.filesIndexed} files \xB7 ${r.durationMs}ms`) + (r.errors.length ? `
11415
- ${color18.yellow(` ${r.errors.length} file(s) had errors`)}` : "");
11416
+ const outcomes = r.fileOutcomes;
11417
+ const fileSummary = outcomes ? `${outcomes.parsed} parsed \xB7 ${outcomes.skipped} unchanged` + (outcomes.failed > 0 ? ` \xB7 ${outcomes.failed} failed` : "") : `${r.filesIndexed} files`;
11418
+ const summary = `${color18.green("\u2713")} codebase index ${force || r.autoRecovered ? "rebuilt" : "updated"} ` + color18.dim(`\u2014 ${r.symbolsIndexed} symbols \xB7 ${fileSummary} \xB7 ${r.durationMs}ms`) + (r.autoRecovered ? `
11419
+ ${color18.yellow(" corrupt index detected \u2014 rebuilt from scratch")}` : "") + (r.errors.length ? `
11420
+ ${color18.yellow(` ${r.errors.length} error(s) reported`)}` : "");
11416
11421
  return { message: summary };
11417
11422
  } catch (err) {
11418
11423
  const msg = `${color18.red("Codebase reindex failed:")} ${toErrorMessage7(err)}`;
@@ -36688,7 +36693,38 @@ import {
36688
36693
  setContextQueryEmbedder,
36689
36694
  shutdownCodebaseIndexHost
36690
36695
  } from "@wrongstack/tools";
36691
- var FILE_EDIT_TOOLS = /* @__PURE__ */ new Set(["write", "edit"]);
36696
+ function editedFilePaths(toolName2, input, cwd) {
36697
+ const args = input ?? {};
36698
+ const resolve9 = (value, base = cwd) => typeof value === "string" && value.length > 0 ? [path30.resolve(base, value)] : [];
36699
+ switch (toolName2) {
36700
+ case "write":
36701
+ case "edit":
36702
+ return resolve9(args["path"]);
36703
+ case "codebase-ast-replace":
36704
+ return resolve9(args["file"]);
36705
+ case "format": {
36706
+ if (args["check"] === true) return [];
36707
+ const files = args["files"];
36708
+ const base = typeof args["cwd"] === "string" ? path30.resolve(cwd, args["cwd"]) : cwd;
36709
+ return (Array.isArray(files) ? files : [files]).flatMap((file) => resolve9(file, base));
36710
+ }
36711
+ case "patch": {
36712
+ if (args["dry_run"] === true || typeof args["patch"] !== "string") return [];
36713
+ const base = typeof args["directory"] === "string" ? path30.resolve(cwd, args["directory"]) : cwd;
36714
+ const strip = typeof args["strip"] === "number" ? args["strip"] : 1;
36715
+ const out = /* @__PURE__ */ new Set();
36716
+ for (const match of args["patch"].matchAll(/^(?:\+\+\+|---) ([^\t\r\n]+)/gm)) {
36717
+ const header = (match[1] ?? "").trim().replace(/^"(.*)"$/, "$1");
36718
+ if (!header || header === "/dev/null") continue;
36719
+ const stripped = header.split("/").slice(strip).join("/");
36720
+ if (stripped) out.add(path30.resolve(base, stripped));
36721
+ }
36722
+ return [...out];
36723
+ }
36724
+ default:
36725
+ return [];
36726
+ }
36727
+ }
36692
36728
  async function setupCodebaseIndexing(deps) {
36693
36729
  const { config, context, pipelines, projectRoot, logger } = deps;
36694
36730
  const idx = config.indexing;
@@ -36727,16 +36763,17 @@ async function setupCodebaseIndexing(deps) {
36727
36763
  handler: async (payload, next) => {
36728
36764
  try {
36729
36765
  const tool = payload.tool;
36730
- if (tool?.mutating && FILE_EDIT_TOOLS.has(tool.name) && !payload.result.is_error) {
36731
- const fp = payload.toolUse.input?.path;
36732
- if (typeof fp === "string" && fp.length > 0) {
36733
- const activeRoot = payload.ctx.projectRoot;
36734
- const abs = path30.resolve(payload.ctx.cwd, fp);
36735
- const rel = path30.relative(activeRoot, abs);
36736
- const inside = rel !== ".." && !rel.startsWith(`..${path30.sep}`) && !path30.isAbsolute(rel);
36737
- if (inside && isIndexableFile(abs)) {
36738
- enqueueReindex({ projectRoot: activeRoot, files: [abs], debounceMs, onError });
36766
+ if (tool && !payload.result.is_error) {
36767
+ const activeRoot = payload.ctx.projectRoot;
36768
+ const files = editedFilePaths(tool.name, payload.toolUse.input, payload.ctx.cwd).filter(
36769
+ (abs) => {
36770
+ const rel = path30.relative(activeRoot, abs);
36771
+ const inside = rel !== ".." && !rel.startsWith(`..${path30.sep}`) && !path30.isAbsolute(rel);
36772
+ return inside && isIndexableFile(abs);
36739
36773
  }
36774
+ );
36775
+ if (files.length > 0) {
36776
+ enqueueReindex({ projectRoot: activeRoot, files, debounceMs, onError });
36740
36777
  }
36741
36778
  }
36742
36779
  } catch {
@@ -38955,4 +38992,4 @@ export {
38955
38992
  CLI_VERSION,
38956
38993
  runInteractive
38957
38994
  };
38958
- //# sourceMappingURL=cli-main-WC5JNIWY.js.map
38995
+ //# sourceMappingURL=cli-main-6LMQSS66.js.map
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ async function main(argv) {
23
23
  const { initializeCli } = await import("./cli-context-5IF7ZYEY.js");
24
24
  const cliCtx = await initializeCli(argv);
25
25
  if (typeof cliCtx === "number") return cliCtx;
26
- const { runInteractive } = await import("./cli-main-WC5JNIWY.js");
26
+ const { runInteractive } = await import("./cli-main-6LMQSS66.js");
27
27
  return runInteractive(cliCtx);
28
28
  }
29
29
 
@@ -17,6 +17,14 @@
17
17
  */
18
18
  import type { AgentPipelines, Context } from '@wrongstack/core/agent';
19
19
  import type { IndexingConfig, Logger } from '@wrongstack/core/types';
20
+ /**
21
+ * Project files a successful file-changing tool call wrote, resolved against
22
+ * `cwd`. Only `write`/`edit` were handled, so `codebase-ast-replace`, `patch`
23
+ * and `format` left the index describing the pre-edit code until a restart
24
+ * (external watching is off by default) — incoming calls and impact analysis
25
+ * then answered for a function body that no longer existed.
26
+ */
27
+ export declare function editedFilePaths(toolName: string, input: unknown, cwd: string): string[];
20
28
  interface CodebaseIndexingDeps {
21
29
  config: {
22
30
  indexing?: IndexingConfig | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/cli",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack CLI — terminal AI coding agent with provider catalog from models.dev. Provides `wrongstack` and `wstack` binaries.",
6
6
  "keywords": [
@@ -41,36 +41,36 @@
41
41
  "data"
42
42
  ],
43
43
  "dependencies": {
44
- "@wrongstack/acp": "1.0.11",
45
- "@wrongstack/bench": "1.0.11",
46
- "@wrongstack/core": "1.0.11",
47
- "@wrongstack/kanban": "1.0.11",
48
- "@wrongstack/mcp": "1.0.11",
49
- "@wrongstack/persistence": "1.0.11",
50
- "@wrongstack/plug-lsp": "1.0.11",
51
- "@wrongstack/plugins": "1.0.11",
52
- "@wrongstack/primitives": "1.0.11",
53
- "@wrongstack/providers": "1.0.11",
54
- "@wrongstack/requirement-intake": "1.0.11",
55
- "@wrongstack/runtime": "1.0.11",
56
- "@wrongstack/sage": "1.0.11",
57
- "@wrongstack/sdd": "1.0.11",
58
- "@wrongstack/security-scanner": "1.0.11",
59
- "@wrongstack/simpleui": "1.0.11",
60
- "@wrongstack/techstack": "1.0.11",
61
- "@wrongstack/telegram": "1.0.11",
62
- "@wrongstack/tools": "1.0.11",
63
- "@wrongstack/tui": "1.0.11",
64
- "@wrongstack/vector-memory": "1.0.11",
65
- "@wrongstack/webui": "1.0.11",
66
- "@wrongstack/webui-hq": "1.0.11",
67
- "@wrongstack/webui-protocol": "1.0.11",
68
- "@wrongstack/webui-server": "1.0.11",
69
- "@wrongstack/wrongtrace": "1.0.11",
44
+ "@wrongstack/acp": "1.0.12",
45
+ "@wrongstack/bench": "1.0.12",
46
+ "@wrongstack/core": "1.0.12",
47
+ "@wrongstack/kanban": "1.0.12",
48
+ "@wrongstack/mcp": "1.0.12",
49
+ "@wrongstack/persistence": "1.0.12",
50
+ "@wrongstack/plug-lsp": "1.0.12",
51
+ "@wrongstack/plugins": "1.0.12",
52
+ "@wrongstack/primitives": "1.0.12",
53
+ "@wrongstack/providers": "1.0.12",
54
+ "@wrongstack/requirement-intake": "1.0.12",
55
+ "@wrongstack/runtime": "1.0.12",
56
+ "@wrongstack/sage": "1.0.12",
57
+ "@wrongstack/sdd": "1.0.12",
58
+ "@wrongstack/security-scanner": "1.0.12",
59
+ "@wrongstack/simpleui": "1.0.12",
60
+ "@wrongstack/techstack": "1.0.12",
61
+ "@wrongstack/telegram": "1.0.12",
62
+ "@wrongstack/tools": "1.0.12",
63
+ "@wrongstack/tui": "1.0.12",
64
+ "@wrongstack/vector-memory": "1.0.12",
65
+ "@wrongstack/webui": "1.0.12",
66
+ "@wrongstack/webui-hq": "1.0.12",
67
+ "@wrongstack/webui-protocol": "1.0.12",
68
+ "@wrongstack/webui-server": "1.0.12",
69
+ "@wrongstack/wrongtrace": "1.0.12",
70
70
  "ws": "^8.21.3"
71
71
  },
72
72
  "optionalDependencies": {
73
- "@wrongstack/desktop": "1.0.11"
73
+ "@wrongstack/desktop": "1.0.12"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@types/node": "^26.5.1",