@nodii/dev 0.6.93 → 0.6.95
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 +5 -0
- package/dist/core.js +1 -1
- package/dist/figma.js +5 -3
- package/dist/review-session.js +39 -0
- package/dist/review.js +3 -2
- package/package.json +1 -1
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.
|
|
7
|
+
export const VERSION = "0.6.95";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/figma.js
CHANGED
|
@@ -194,7 +194,7 @@ export function submitMode(f) {
|
|
|
194
194
|
return Boolean(f.sync);
|
|
195
195
|
}
|
|
196
196
|
const DONE = new Set(["succeeded", "failed"]);
|
|
197
|
-
const jobName = (job) => (job.kind === "conformance" ? "dry run" : job.kind === "resubmit" ? "re-submit" : "submit");
|
|
197
|
+
const jobName = (job) => (job.kind === "conformance" ? "dry run" : job.kind === "resubmit" ? "re-submit" : job.kind === "log_write" ? "logged write" : "submit");
|
|
198
198
|
|
|
199
199
|
export const submitJobPath = (job) => `/api/v1/design/change-sets/${encode(job.changeSetId)}/submit-jobs/${encode(job.id)}`;
|
|
200
200
|
|
|
@@ -744,8 +744,10 @@ export const figmaConformance = (id, body = {}, { request = devRequest, sync = f
|
|
|
744
744
|
changeSetCall(id, (method, path, b) => (sync ? request(method, path, b) : changeSetJob(method, path, b, { changeSetId: id, kind: "conformance", request, ...options })))(
|
|
745
745
|
"POST", `/api/v1/design/change-sets/${encode(id)}/conformance`, body);
|
|
746
746
|
|
|
747
|
-
|
|
748
|
-
|
|
747
|
+
/** A large write's placement reads run as a job on Dev (hub-237): this polls it and answers as the plain call does. */
|
|
748
|
+
export const figmaLogWrite = (id, tool, nodeIds, { request, pollRequest, ...options } = {}) =>
|
|
749
|
+
changeSetCall(id, (method, path, body) => (request ? request(method, path, body) : changeSetJob(method, path, body, { changeSetId: id, kind: "log_write", ...(pollRequest ? { request: pollRequest } : {}), ...options })))(
|
|
750
|
+
"POST", `/api/v1/design/change-sets/${encode(id)}/writes`, { tool, nodeIds });
|
|
749
751
|
|
|
750
752
|
/** One publish for the file: every awaiting_publish set on it (MW1-57.8). */
|
|
751
753
|
export async function figmaFilePublished(value, payload, { request = devRequest } = {}) {
|
|
@@ -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
|
|