@wrongstack/tools 0.306.0 → 0.306.2

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/builtin.js CHANGED
@@ -24447,6 +24447,7 @@ function sourceStatus(task) {
24447
24447
  function todoStatus(task) {
24448
24448
  const status = sourceStatus(task);
24449
24449
  if (status === "completed") return "completed";
24450
+ if (status === "review" && task.assignment?.status === "completed") return "completed";
24450
24451
  if (status === "in_progress" || status === "review") return "in_progress";
24451
24452
  return "pending";
24452
24453
  }
@@ -26398,6 +26399,20 @@ async function synchronizeManagedKanban(items, board, ctx, signal) {
26398
26399
  }
26399
26400
  const task = board.tasks.find((candidate) => candidate.id === item.kanbanTaskId);
26400
26401
  if (!task || task.status === "completed") continue;
26402
+ const stage = task.lifecycle?.currentStage;
26403
+ if (stage === "backlog" || stage === "todo") {
26404
+ const started = await execute({
26405
+ action: "start_task",
26406
+ boardId: board.id,
26407
+ taskId: task.id,
26408
+ author: actor,
26409
+ agentId: actor,
26410
+ transitionComment: `Auto-started for completion: ${item.content}`
26411
+ });
26412
+ if (!started.ok) {
26413
+ continue;
26414
+ }
26415
+ }
26401
26416
  await execute({
26402
26417
  action: "mark_assignment",
26403
26418
  boardId: board.id,
@@ -2713,7 +2713,8 @@ import {
2713
2713
  useDaemonPerfDefaults,
2714
2714
  watchProjectTree
2715
2715
  } from "@wrongstack/core/utils";
2716
- import { bindProjectEndpoint } from "@wrongstack/persistence";
2716
+ import { restrictFilePermissions } from "@wrongstack/core/security";
2717
+ import { atomicWrite, bindProjectEndpoint } from "@wrongstack/persistence";
2717
2718
 
2718
2719
  // src/codebase-index/indexer.ts
2719
2720
  import { expectDefined as expectDefined5 } from "@wrongstack/core/utils";
@@ -7785,18 +7786,16 @@ function removeMetadataIfOwned() {
7785
7786
  } catch {
7786
7787
  }
7787
7788
  }
7788
- function writeMetadata() {
7789
+ async function writeMetadata() {
7789
7790
  fs11.mkdirSync(path14.dirname(metadataPath), { recursive: true });
7790
- const temporary = `${metadataPath}.${process.pid}.tmp`;
7791
7791
  const metadata = { ...serverInfo, authToken };
7792
- fs11.writeFileSync(temporary, `${JSON.stringify(metadata, null, 2)}
7792
+ await atomicWrite(metadataPath, `${JSON.stringify(metadata, null, 2)}
7793
7793
  `, { mode: 384 });
7794
- try {
7795
- fs11.renameSync(temporary, metadataPath);
7796
- } catch {
7797
- fs11.rmSync(metadataPath, { force: true });
7798
- fs11.renameSync(temporary, metadataPath);
7799
- }
7794
+ await restrictFilePermissions(metadataPath, {
7795
+ label: "codebase-index-metadata",
7796
+ warn: (message) => process.stderr.write(`${message}
7797
+ `)
7798
+ });
7800
7799
  }
7801
7800
  var server = net.createServer((socket) => {
7802
7801
  if (idleTimer) clearTimeout(idleTimer);
@@ -7893,7 +7892,7 @@ void (async () => {
7893
7892
  `);
7894
7893
  process.exitCode = 1;
7895
7894
  });
7896
- writeMetadata();
7895
+ await writeMetadata();
7897
7896
  markMetadataWritten?.();
7898
7897
  scheduleIdleStop();
7899
7898
  })();
package/dist/index.js CHANGED
@@ -25035,6 +25035,7 @@ function sourceStatus(task) {
25035
25035
  function todoStatus(task) {
25036
25036
  const status = sourceStatus(task);
25037
25037
  if (status === "completed") return "completed";
25038
+ if (status === "review" && task.assignment?.status === "completed") return "completed";
25038
25039
  if (status === "in_progress" || status === "review") return "in_progress";
25039
25040
  return "pending";
25040
25041
  }
@@ -25156,11 +25157,12 @@ async function applySessionKanbanTaskToSource(context, task, options = {}) {
25156
25157
  const graphId = task.origin?.graphId ?? "";
25157
25158
  if (!originId) return { source: null };
25158
25159
  if (task.origin?.system === "session-todo" || graphId.startsWith("todo:")) {
25160
+ const mappedStatus = todoStatus(task);
25159
25161
  const next = options.remove ? context.todos.filter((todo) => todo.id !== originId) : context.todos.map(
25160
25162
  (todo) => todo.id === originId ? {
25161
25163
  ...todo,
25162
25164
  content: task.title,
25163
- status: sourceStatus(task) === "completed" ? "completed" : sourceStatus(task) === "in_progress" || sourceStatus(task) === "review" ? "in_progress" : "pending"
25165
+ status: mappedStatus
25164
25166
  } : todo
25165
25167
  );
25166
25168
  suppressedTodoMirrors.add(context);
@@ -27077,6 +27079,20 @@ async function synchronizeManagedKanban(items, board, ctx, signal) {
27077
27079
  }
27078
27080
  const task = board.tasks.find((candidate) => candidate.id === item.kanbanTaskId);
27079
27081
  if (!task || task.status === "completed") continue;
27082
+ const stage = task.lifecycle?.currentStage;
27083
+ if (stage === "backlog" || stage === "todo") {
27084
+ const started = await execute({
27085
+ action: "start_task",
27086
+ boardId: board.id,
27087
+ taskId: task.id,
27088
+ author: actor,
27089
+ agentId: actor,
27090
+ transitionComment: `Auto-started for completion: ${item.content}`
27091
+ });
27092
+ if (!started.ok) {
27093
+ continue;
27094
+ }
27095
+ }
27080
27096
  await execute({
27081
27097
  action: "mark_assignment",
27082
27098
  boardId: board.id,
package/dist/pack.js CHANGED
@@ -24447,6 +24447,7 @@ function sourceStatus(task) {
24447
24447
  function todoStatus(task) {
24448
24448
  const status = sourceStatus(task);
24449
24449
  if (status === "completed") return "completed";
24450
+ if (status === "review" && task.assignment?.status === "completed") return "completed";
24450
24451
  if (status === "in_progress" || status === "review") return "in_progress";
24451
24452
  return "pending";
24452
24453
  }
@@ -26398,6 +26399,20 @@ async function synchronizeManagedKanban(items, board, ctx, signal) {
26398
26399
  }
26399
26400
  const task = board.tasks.find((candidate) => candidate.id === item.kanbanTaskId);
26400
26401
  if (!task || task.status === "completed") continue;
26402
+ const stage = task.lifecycle?.currentStage;
26403
+ if (stage === "backlog" || stage === "todo") {
26404
+ const started = await execute({
26405
+ action: "start_task",
26406
+ boardId: board.id,
26407
+ taskId: task.id,
26408
+ author: actor,
26409
+ agentId: actor,
26410
+ transitionComment: `Auto-started for completion: ${item.content}`
26411
+ });
26412
+ if (!started.ok) {
26413
+ continue;
26414
+ }
26415
+ }
26401
26416
  await execute({
26402
26417
  action: "mark_assignment",
26403
26418
  boardId: board.id,
package/dist/plan.js CHANGED
@@ -426,6 +426,7 @@ function sourceStatus(task) {
426
426
  function todoStatus(task) {
427
427
  const status = sourceStatus(task);
428
428
  if (status === "completed") return "completed";
429
+ if (status === "review" && task.assignment?.status === "completed") return "completed";
429
430
  if (status === "in_progress" || status === "review") return "in_progress";
430
431
  return "pending";
431
432
  }
@@ -2599,6 +2600,20 @@ async function synchronizeManagedKanban(items, board, ctx, signal) {
2599
2600
  }
2600
2601
  const task = board.tasks.find((candidate) => candidate.id === item.kanbanTaskId);
2601
2602
  if (!task || task.status === "completed") continue;
2603
+ const stage = task.lifecycle?.currentStage;
2604
+ if (stage === "backlog" || stage === "todo") {
2605
+ const started = await execute({
2606
+ action: "start_task",
2607
+ boardId: board.id,
2608
+ taskId: task.id,
2609
+ author: actor,
2610
+ agentId: actor,
2611
+ transitionComment: `Auto-started for completion: ${item.content}`
2612
+ });
2613
+ if (!started.ok) {
2614
+ continue;
2615
+ }
2616
+ }
2602
2617
  await execute({
2603
2618
  action: "mark_assignment",
2604
2619
  boardId: board.id,
@@ -770,6 +770,7 @@ function sourceStatus(task) {
770
770
  function todoStatus(task) {
771
771
  const status = sourceStatus(task);
772
772
  if (status === "completed") return "completed";
773
+ if (status === "review" && task.assignment?.status === "completed") return "completed";
773
774
  if (status === "in_progress" || status === "review") return "in_progress";
774
775
  return "pending";
775
776
  }
@@ -891,11 +892,12 @@ async function applySessionKanbanTaskToSource(context, task, options = {}) {
891
892
  const graphId = task.origin?.graphId ?? "";
892
893
  if (!originId) return { source: null };
893
894
  if (task.origin?.system === "session-todo" || graphId.startsWith("todo:")) {
895
+ const mappedStatus = todoStatus(task);
894
896
  const next = options.remove ? context.todos.filter((todo) => todo.id !== originId) : context.todos.map(
895
897
  (todo) => todo.id === originId ? {
896
898
  ...todo,
897
899
  content: task.title,
898
- status: sourceStatus(task) === "completed" ? "completed" : sourceStatus(task) === "in_progress" || sourceStatus(task) === "review" ? "in_progress" : "pending"
900
+ status: mappedStatus
899
901
  } : todo
900
902
  );
901
903
  suppressedTodoMirrors.add(context);
package/dist/task.js CHANGED
@@ -386,6 +386,7 @@ function sourceStatus(task) {
386
386
  function todoStatus(task) {
387
387
  const status = sourceStatus(task);
388
388
  if (status === "completed") return "completed";
389
+ if (status === "review" && task.assignment?.status === "completed") return "completed";
389
390
  if (status === "in_progress" || status === "review") return "in_progress";
390
391
  return "pending";
391
392
  }
@@ -2559,6 +2560,20 @@ async function synchronizeManagedKanban(items, board, ctx, signal) {
2559
2560
  }
2560
2561
  const task = board.tasks.find((candidate) => candidate.id === item.kanbanTaskId);
2561
2562
  if (!task || task.status === "completed") continue;
2563
+ const stage = task.lifecycle?.currentStage;
2564
+ if (stage === "backlog" || stage === "todo") {
2565
+ const started = await execute({
2566
+ action: "start_task",
2567
+ boardId: board.id,
2568
+ taskId: task.id,
2569
+ author: actor,
2570
+ agentId: actor,
2571
+ transitionComment: `Auto-started for completion: ${item.content}`
2572
+ });
2573
+ if (!started.ok) {
2574
+ continue;
2575
+ }
2576
+ }
2562
2577
  await execute({
2563
2578
  action: "mark_assignment",
2564
2579
  boardId: board.id,
package/dist/todo.js CHANGED
@@ -1437,6 +1437,7 @@ function sourceStatus(task) {
1437
1437
  function todoStatus(task) {
1438
1438
  const status = sourceStatus(task);
1439
1439
  if (status === "completed") return "completed";
1440
+ if (status === "review" && task.assignment?.status === "completed") return "completed";
1440
1441
  if (status === "in_progress" || status === "review") return "in_progress";
1441
1442
  return "pending";
1442
1443
  }
@@ -2546,6 +2547,20 @@ async function synchronizeManagedKanban(items, board, ctx, signal) {
2546
2547
  }
2547
2548
  const task = board.tasks.find((candidate) => candidate.id === item.kanbanTaskId);
2548
2549
  if (!task || task.status === "completed") continue;
2550
+ const stage = task.lifecycle?.currentStage;
2551
+ if (stage === "backlog" || stage === "todo") {
2552
+ const started = await execute({
2553
+ action: "start_task",
2554
+ boardId: board.id,
2555
+ taskId: task.id,
2556
+ author: actor,
2557
+ agentId: actor,
2558
+ transitionComment: `Auto-started for completion: ${item.content}`
2559
+ });
2560
+ if (!started.ok) {
2561
+ continue;
2562
+ }
2563
+ }
2549
2564
  await execute({
2550
2565
  action: "mark_assignment",
2551
2566
  boardId: board.id,
package/dist/tool-tier.js CHANGED
@@ -24447,6 +24447,7 @@ function sourceStatus(task) {
24447
24447
  function todoStatus(task) {
24448
24448
  const status = sourceStatus(task);
24449
24449
  if (status === "completed") return "completed";
24450
+ if (status === "review" && task.assignment?.status === "completed") return "completed";
24450
24451
  if (status === "in_progress" || status === "review") return "in_progress";
24451
24452
  return "pending";
24452
24453
  }
@@ -26398,6 +26399,20 @@ async function synchronizeManagedKanban(items, board, ctx, signal) {
26398
26399
  }
26399
26400
  const task = board.tasks.find((candidate) => candidate.id === item.kanbanTaskId);
26400
26401
  if (!task || task.status === "completed") continue;
26402
+ const stage = task.lifecycle?.currentStage;
26403
+ if (stage === "backlog" || stage === "todo") {
26404
+ const started = await execute({
26405
+ action: "start_task",
26406
+ boardId: board.id,
26407
+ taskId: task.id,
26408
+ author: actor,
26409
+ agentId: actor,
26410
+ transitionComment: `Auto-started for completion: ${item.content}`
26411
+ });
26412
+ if (!started.ok) {
26413
+ continue;
26414
+ }
26415
+ }
26401
26416
  await execute({
26402
26417
  action: "mark_assignment",
26403
26418
  boardId: board.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/tools",
3
- "version": "0.306.0",
3
+ "version": "0.306.2",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack built-in tools: read/write/edit, bash/exec, grep/glob, git, fetch, test, lint, and more.",
6
6
  "repository": {
@@ -253,9 +253,9 @@
253
253
  "turndown": "^7.2.4",
254
254
  "undici": "^8.9.0",
255
255
  "web-tree-sitter": "0.26.12",
256
- "@wrongstack/core": "0.306.0",
257
- "@wrongstack/persistence": "0.306.0",
258
- "@wrongstack/kanban": "0.306.0"
256
+ "@wrongstack/core": "0.306.2",
257
+ "@wrongstack/kanban": "0.306.2",
258
+ "@wrongstack/persistence": "0.306.2"
259
259
  },
260
260
  "devDependencies": {
261
261
  "@types/node": "^26.1.2",