@nodii/dev 0.6.92 → 0.6.94

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/cli.js CHANGED
@@ -26,6 +26,7 @@ import { setupCommand } from "./setup.js";
26
26
  import { harnessCommand } from "./harness.js";
27
27
  import { repoCommand } from "./repo-policy.js";
28
28
  import { hookRuntime, recordHookFire, safetyContext, safetyPostHook, safetyPreHook } from "./safety.js";
29
+ import { isReviewSession } from "./review-session.js";
29
30
  import { SUBMIT_CHECK_FLAGS, changedPaths, nudgeCandidate, nudgePre, nudgeStop, recordGathered, recordGuidelineRead, recordSubmitChecks, steerAct, stewardSteerNudges, surfaceGenPre } from "./nudges.js";
30
31
  import { activeSteward, firstPromptText, isLaneConfig, sessionStartText, stewardCommand } from "./session-kind.js";
31
32
  import { doctorCommand } from "./doctor.js";
@@ -119,6 +120,8 @@ import {
119
120
  import { superviseLane } from "./lane-supervisor.js";
120
121
  import { awsCli, superviseRemoteRun } from "./remote.js";
121
122
 
123
+ const LANE_RUN_HOOKS = new Set(["nudge-pre", "nudge-stop", "lane-heartbeat", "session-start", "session-kind", "workflow-post"]);
124
+
122
125
  const HELP = `nodii-dev ${VERSION}
123
126
 
124
127
  Usage: nodii-dev <command> [options] [--json]
@@ -1367,6 +1370,8 @@ export async function main(argv = process.argv.slice(2)) {
1367
1370
  );
1368
1371
  }
1369
1372
  if (command === "hook") {
1373
+ // hub-284: silent in a spawned reviewer. The safety hooks still run.
1374
+ if (LANE_RUN_HOOKS.has(action) && (await isReviewSession())) return;
1370
1375
  if (action === "print-settings")
1371
1376
  return console.log(JSON.stringify(settingsSnippet(), null, 2));
1372
1377
  if (action === "managed-dispatch") {
package/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.92";
7
+ export const VERSION = "0.6.94";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");
@@ -0,0 +1,39 @@
1
+ // hub-284: lane hooks act only in the lane's own run. A reviewer the
2
+ // push hook or `lane check` spawns inherits the lane's environment, so a Stop
3
+ // nudge would reach it, and it would answer in prose instead of its JSON verdict.
4
+ import { execFile } from "node:child_process";
5
+ import { promisify } from "node:util";
6
+
7
+ const execFileAsync = promisify(execFile);
8
+
9
+ export const REVIEW_SESSION_ENV = "NODII_REVIEW_SESSION";
10
+
11
+ // Only a reviewer runs with a required output schema: Claude's --json-schema or
12
+ // Codex's --output-schema. A repository's vendored ai-review.mjs may predate the
13
+ // marker, so its process is recognised this way.
14
+ const REVIEWER_FLAG = /(?:^|\s)--(?:json-schema|output-schema)(?:\s|=|$)/;
15
+ // The runtime's own process, directly or through its node launcher. A shell
16
+ // whose command line only mentions the flag is not a reviewer.
17
+ const RUNTIME = /^(?:\S*\/)?(?:node\s+\S*\/)?(?:claude|codex)(?:\.js|\.mjs)?(?:\s|$)/;
18
+ const MAX_ANCESTORS = 8;
19
+
20
+ const readProcess = async (pid) => {
21
+ const { stdout } = await execFileAsync("ps", ["-o", "ppid=,command=", "-p", String(pid)], { encoding: "utf8", timeout: 1500 });
22
+ const match = /^\s*(\d+)\s+(.*)$/s.exec(stdout);
23
+ return match ? { parent: Number(match[1]), command: match[2] } : null;
24
+ };
25
+
26
+ /** True in a spawned reviewer. A process table it cannot read counts as the lane's own run. */
27
+ export async function isReviewSession({ env = process.env, pid = process.ppid, read = readProcess } = {}) {
28
+ if (env[REVIEW_SESSION_ENV]) return true;
29
+ try {
30
+ let current = pid;
31
+ for (let depth = 0; depth < MAX_ANCESTORS && current > 1; depth += 1) {
32
+ const entry = await read(current);
33
+ if (!entry) return false;
34
+ if (RUNTIME.test(entry.command) && REVIEWER_FLAG.test(entry.command)) return true;
35
+ current = entry.parent;
36
+ }
37
+ } catch {}
38
+ return false;
39
+ }
package/dist/review.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // runtime, headless and without tools (DEV-REV-2); it sees the diff and the
4
4
  // clauses that judge it, nothing else.
5
5
  import { execFile, spawn } from "node:child_process";
6
+ import { REVIEW_SESSION_ENV } from "./review-session.js";
6
7
  import { createHash } from "node:crypto";
7
8
  import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
8
9
  import { tmpdir } from "node:os";
@@ -224,12 +225,12 @@ export function reviewerInvocation({ runtime, model, profile, schema, workdir, s
224
225
  args: ["exec", "--sandbox", "read-only", "--skip-git-repo-check", "--ephemeral", "--ignore-user-config", "--ignore-rules",
225
226
  ...["shell_tool", "unified_exec", "apps", "plugins", "browser_use", "in_app_browser", "computer_use"].flatMap((feature) => ["--disable", feature]),
226
227
  "-c", "web_search=\"disabled\"", "--cd", workdir, "--output-schema", schemaFile, "--output-last-message", outFile, ...(model ? ["--model", model] : []), "-"],
227
- env: profile ? { CODEX_HOME: profile } : {},
228
+ env: { [REVIEW_SESSION_ENV]: "1", ...(profile ? { CODEX_HOME: profile } : {}) },
228
229
  };
229
230
  return {
230
231
  command: "claude",
231
232
  args: ["-p", "--output-format", "json", "--json-schema", JSON.stringify(schema), "--tools", "", "--safe-mode", "--strict-mcp-config", "--no-session-persistence", ...(model ? ["--model", model] : [])],
232
- env: profile ? { CLAUDE_CONFIG_DIR: profile } : {},
233
+ env: { [REVIEW_SESSION_ENV]: "1", ...(profile ? { CLAUDE_CONFIG_DIR: profile } : {}) },
233
234
  };
234
235
  }
235
236
 
package/dist/surface.js CHANGED
@@ -723,7 +723,12 @@ function withWidth(code, w) {
723
723
  return code.replace(m[1], `${m[1]}${widthAttr(w)}`);
724
724
  }
725
725
  function tableOf(node, ctx) {
726
- const rows = (node.children ?? []).filter((c) => c.visible !== false);
726
+ const shown = (node.children ?? []).filter((c) => c.visible !== false);
727
+ // A DS instance after the rows (a table's Empty State) follows the Table: it must not undo it.
728
+ let end = shown.length;
729
+ while (end > 0 && shown[end - 1].instance?.remote) end -= 1;
730
+ const rows = shown.slice(0, end);
731
+ const after = shown.slice(end);
727
732
  if (!rows.length || rows.some((r) => r.instance?.remote || r.type === "TEXT" || r.layout?.mode !== "HORIZONTAL")) return null;
728
733
  const imports = [];
729
734
  const parsed = [];
@@ -793,8 +798,10 @@ function tableOf(node, ctx) {
793
798
  };
794
799
  const sizing = sizeClasses(node, ctx.parent, ctx.root);
795
800
  const table = [indent(fixed ? '<Table layout="fixed">' : "<Table>", depth), ...section("head", "TableHeader"), ...section("body", "TableBody"), indent("</Table>", depth)];
796
- if (!sizing.length) return table.join("\n");
797
- return [indent(`<div className="${cls(["flex", "flex-col", ...sizing])}">`, depth), ...table.map((line) => indent(line, 1)), indent("</div>", depth)].join("\n");
801
+ const following = after.map((c) => emitNode(c, { ...ctx, depth, parent: node, path: `${ctx.path} › ${c.name}`, root: false })).filter((x) => x !== null);
802
+ if (!sizing.length && !following.length) return table.join("\n");
803
+ const lines = [...table, ...following.flatMap((code) => code.split("\n"))];
804
+ return [indent(`<div className="${cls(["flex", "flex-col", ...sizing])}">`, depth), ...lines.map((line) => indent(line, 1)), indent("</div>", depth)].join("\n");
798
805
  }
799
806
 
800
807
  // ---------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodii/dev",
3
- "version": "0.6.92",
3
+ "version": "0.6.94",
4
4
  "description": "Agent CLI for Nodii Dev, reached through the platform edge",
5
5
  "type": "module",
6
6
  "bin": {