@nodii/dev 0.6.151 → 0.6.153
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/README.md +9 -2
- package/dist/cli.js +2 -1
- package/dist/core.js +1 -1
- package/dist/lanes.js +26 -11
- package/dist/review.js +122 -19
- package/dist/surface.js +93 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,7 +103,8 @@ nodii-dev lane check KEY --gate 'pnpm typecheck' --gate 'pnpm lint' --gate 'nodi
|
|
|
103
103
|
- The graph is read from source: static and dynamic imports, re-exports, `require`, `vi.mock`, `jest.mock` and `mock.module`, `new URL("./x", import.meta.url)`, the nearest tsconfig's `paths`, and workspace packages by name. A data file (SQL, JSON, a template) reaches the code that names it.
|
|
104
104
|
- It fails closed. A manifest, lockfile, tsconfig, test or build config, a data file no source names, or a changed source file no test reaches selects the full suite (`full` lists why). Docs, `.github/` and the policy file select nothing.
|
|
105
105
|
- Each package runs its tests with its own `test` script's runner and flags, and the selected files replace the script's paths. A script that is not one runner call (`bun run gate && bun test`) runs whole.
|
|
106
|
-
- `lane check` refuses a full-suite gate (`GATE_FULL_SUITE`) unless `--full-suite` is passed.
|
|
106
|
+
- `lane check` refuses a full-suite gate (`GATE_FULL_SUITE`) unless `--full-suite` is passed. A whole suite also means one workspace's or project's whole suite (`npm test -w X`, `pnpm --filter X test`, `jest --selectProjects web`), a runner given no path (`node --test`, `npx playwright test`, `pytest`, `go test ./...`), and any of these inside `sh -c`. From a lane's own config, `--full-suite` is refused too (`FULL_SUITE_LANE_REFUSED`, hub-485).
|
|
107
|
+
- The review body carries the gates receipt (`gates`): each gate's command, exit code and commit for this head and base, so Dev can refuse a whole-suite gate itself (hub-485). A `gates` field in a hand-written review file is never sent.
|
|
107
108
|
|
|
108
109
|
## Heavy work: one machine-wide slot queue
|
|
109
110
|
|
|
@@ -593,7 +594,7 @@ nodii-dev lane resume KEY [--override --reason TEXT]
|
|
|
593
594
|
# running run or a lane-agent heartbeat since the death
|
|
594
595
|
# that is not yet old enough to be dead: one process per
|
|
595
596
|
# lane (the coordinator's own heartbeats do not count)
|
|
596
|
-
nodii-dev lane check KEY [--gate CMD ...] [--critical] [--max-iterations N]
|
|
597
|
+
nodii-dev lane check KEY [--gate CMD ...] [--critical] [--max-iterations N] [--picker agent]
|
|
597
598
|
# from the lane's worktree: the rules, Figma and code checks (DEV-REV) over
|
|
598
599
|
# the diff against origin/main, tracked and untracked; --gate runs the gates
|
|
599
600
|
# in order first, else a green gates receipt for this head and diff
|
|
@@ -1552,6 +1553,12 @@ own runtime (headless, no tools) makes that pick from Dev's shortlist and the
|
|
|
1552
1553
|
Delta gather is recorded as `picker: agent`; an answer that names no offered
|
|
1553
1554
|
document, or one Dev did not offer, is refused and nothing is recorded.
|
|
1554
1555
|
|
|
1556
|
+
Use `lane check KEY --picker agent` when the lane requires agent-only Gather
|
|
1557
|
+
(CLI-143). This requests Dev's shortlist immediately and uses the lane's runtime
|
|
1558
|
+
to pick and record the Delta gather, without warming or attempting the local
|
|
1559
|
+
model. If the agent pick fails, the rules check is unavailable; it does not try
|
|
1560
|
+
the local model. Omitting the flag keeps the local-first behavior above.
|
|
1561
|
+
|
|
1555
1562
|
`lane start` creates and starts a lane. It infers the repository (by short
|
|
1556
1563
|
name, as Dev compares it), branch and worktree from git unless overridden, and resolves `--issue` keys to the UUIDs
|
|
1557
1564
|
required by Dev. Lane keys are passed directly to every lane and Built
|
package/dist/cli.js
CHANGED
|
@@ -478,7 +478,7 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
478
478
|
# locked decision that settles it (MW4-27), deferred an open issue. Records the
|
|
479
479
|
# round once nothing blocks; Dev checks each citation and refuses code-check
|
|
480
480
|
# findings, blockers, and security, tenancy, PII and money findings (MW2-41)
|
|
481
|
-
lane check <key> [--gate CMD ...] [--critical] [--max-iterations N]
|
|
481
|
+
lane check <key> [--gate CMD ...] [--critical] [--max-iterations N] [--picker agent]
|
|
482
482
|
# from the lane's worktree: the rules, Figma and code checks over the
|
|
483
483
|
# diff against origin/main (DEV-REV); --gate runs gates 1-5 in order
|
|
484
484
|
# first (else a green gates receipt for this head is required); the
|
|
@@ -486,6 +486,7 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
486
486
|
# fix blocking findings and rerun until CLEAN, STUCK or the cap
|
|
487
487
|
# (default 5); then writes REVIEW.json in git's private dir and
|
|
488
488
|
# records it as lane review; --critical runs the code check (MW2-38.1)
|
|
489
|
+
# --picker agent gathers through the lane runtime without a local model attempt
|
|
489
490
|
lane reviews <key> # stored review history for the lane, with each run's checks
|
|
490
491
|
lane freeze add <key> --section SECTION --file ITEM.json --reason TEXT
|
|
491
492
|
lane freeze drop <key> --section SECTION --item ID --reason TEXT
|
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.153";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/lanes.js
CHANGED
|
@@ -19,7 +19,8 @@ import { SWAP_BOUNDARIES, componentsForScope, guidelineLookup, laneFigmaScope, l
|
|
|
19
19
|
import { designCheck } from "./design.js";
|
|
20
20
|
import { LANE_ENV_FIX, laneEnvProblem, laneEnvReport } from "./lane-env.js";
|
|
21
21
|
import { closeoutLane } from "./closeout.js";
|
|
22
|
-
import { GATES_RECEIPT, REVIEW_FILE, REVIEW_LAST, REVIEW_LOOP, checkLines, checkReviewChecks, citationText, diffDigest, findingId, laneDiff, privateStore, repoGeneratedPaths, runBody, runLaneCheck, runOutcome, treatChecks, treatable, worktreeCommitted } from "./review.js";
|
|
22
|
+
import { GATES_RECEIPT, REVIEW_FILE, REVIEW_LAST, REVIEW_LOOP, checkLines, checkReviewChecks, citationText, diffDigest, findingId, laneDiff, privateStore, repoGeneratedPaths, reviewGates, runBody, runLaneCheck, runOutcome, treatChecks, treatable, worktreeCommitted } from "./review.js";
|
|
23
|
+
import { isLaneConfig } from "./session-kind.js";
|
|
23
24
|
|
|
24
25
|
const execFileAsync = promisify(execFile);
|
|
25
26
|
const via = { via: "nodii-dev" };
|
|
@@ -139,7 +140,8 @@ function agentPickerFlags(flags) {
|
|
|
139
140
|
export const deltaGatherFlags = (paths, pick) => ({
|
|
140
141
|
delta: true,
|
|
141
142
|
paths: paths.join(","),
|
|
142
|
-
...(pick ? { picker: "agent"
|
|
143
|
+
...(pick ? { picker: "agent" } : {}),
|
|
144
|
+
...(pick?.shortlist ? { shortlist: pick.shortlist, documents: pick.documents.join(",") } : {}),
|
|
143
145
|
});
|
|
144
146
|
|
|
145
147
|
// hub-58: the reason is a fixed code (Dev stores its canonical text); a note may add context.
|
|
@@ -752,7 +754,11 @@ export async function laneCommand(action, args, flags, deps = {}) {
|
|
|
752
754
|
}
|
|
753
755
|
// MW2-45: `lane review` and a step's `--done --review` record through one path.
|
|
754
756
|
// `lane check` hands its own body over, already shaped.
|
|
755
|
-
|
|
757
|
+
// hub-401: the policy file names the full-suite script a gate may not run per lane.
|
|
758
|
+
const fullScriptOf = async (worktree) => checkDeps.fullScript ?? (worktree ? await readPolicy(worktree).then((policy) => policy?.tests?.full).catch(() => null) : null) ?? "test";
|
|
759
|
+
// RECEIPT: the stored gates receipt, when the caller has read it; otherwise it is read from this worktree.
|
|
760
|
+
// DIGEST: the digest of the content the caller checked; without it the worktree's diff is read.
|
|
761
|
+
const recordReview = async (reviewFlags = flags, prepared = null, receipt = undefined, cwd = null, digest = null) => {
|
|
756
762
|
// The input is checked before git is read, so a bad call never touches the worktree.
|
|
757
763
|
const notRequired = !prepared && reviewFlags["not-required"] ? notRequiredCitation(reviewFlags) : null;
|
|
758
764
|
const filed = prepared ?? (notRequired ? null : await reviewBody(reviewFlags, read));
|
|
@@ -764,11 +770,20 @@ export async function laneCommand(action, args, flags, deps = {}) {
|
|
|
764
770
|
`The review file covers base ${body.base ?? "(missing)"} and head ${body.head ?? "(missing)"}, but this worktree is base ${current.base} and head ${current.commit}. Review the current diff and write a new receipt.`,
|
|
765
771
|
2,
|
|
766
772
|
);
|
|
773
|
+
// hub-485: Dev reads the gates that ran from the review itself, and only from this tool's own
|
|
774
|
+
// receipt for this head and base: a `gates` field in a hand-written review file is never sent.
|
|
775
|
+
const worktree = cwd ?? (receipt === undefined ? await gitContext().then((context) => context.worktree).catch(() => null) : null);
|
|
776
|
+
const stored = receipt !== undefined ? receipt : worktree ? await (checkDeps.store ?? privateStore(worktree)).read(GATES_RECEIPT).catch(() => null) : null;
|
|
777
|
+
// The same content too: gates that ran before the worktree changed did not run on this review's content.
|
|
778
|
+
const sameContent = async () => worktree && stored.diff === (digest ?? diffDigest((await (checkDeps.diff ?? laneDiff)(worktree)).text));
|
|
779
|
+
const gates = stored?.commit === body.head && stored?.base === body.base && (await sameContent().catch(() => false)) ? reviewGates(stored) : null;
|
|
780
|
+
const { gates: _claimed, ...unclaimed } = body;
|
|
781
|
+
const sent = gates ? { ...unclaimed, gates } : unclaimed;
|
|
767
782
|
// Signed and attached first: no proof on Dev, no passed review on Dev (S06-53).
|
|
768
|
-
// Only gates this tool saw pass for this head:
|
|
783
|
+
// Only gates this tool saw pass for this head: the gates receipt's runs.
|
|
769
784
|
// A --gate flag on lane review is a claim, not a run, so it signs nothing. Their scope, stack and
|
|
770
785
|
// auth posture are unknown to this tool, so a test receipt comes from receipt write or the stack tool.
|
|
771
|
-
const gatesRun =
|
|
786
|
+
const gatesRun = (gates?.runs ?? []).map(({ command, exitCode }) => ({ command, exitCode }));
|
|
772
787
|
// A body with checks carries no exitReason (Dev computes it), so the receipt
|
|
773
788
|
// takes the outcome Dev will compute (NODII-DEV-CLI-66).
|
|
774
789
|
const exitReason = body.exitReason ?? (body.checks?.length ? runOutcome(body.checks) : undefined);
|
|
@@ -779,7 +794,7 @@ export async function laneCommand(action, args, flags, deps = {}) {
|
|
|
779
794
|
review: { exitReason, base: body.base, head: body.head, findings: body.findings?.length ?? 0 },
|
|
780
795
|
} });
|
|
781
796
|
await attachReceipt?.();
|
|
782
|
-
const payload = await request("POST", `/api/v1/lanes/${encode(id)}/review`,
|
|
797
|
+
const payload = await request("POST", `/api/v1/lanes/${encode(id)}/review`, sent);
|
|
783
798
|
try { await reviewReceipt(); }
|
|
784
799
|
catch (error) {
|
|
785
800
|
throw new CliError("REVIEW_RECEIPT_FAILED", `${ref}: Dev recorded the review, but the local push receipt could not be written (${error?.message ?? error}). Re-run nodii-dev lane review ${ref} --file REVIEW.json from its worktree.`, 1);
|
|
@@ -823,7 +838,9 @@ export async function laneCommand(action, args, flags, deps = {}) {
|
|
|
823
838
|
...(checkDeps.picker ? { picker: checkDeps.picker } : {}),
|
|
824
839
|
...(checkDeps.now ? { now: checkDeps.now } : {}),
|
|
825
840
|
// hub-401: the policy file names the full-suite script a gate may not run per lane.
|
|
826
|
-
fullScript:
|
|
841
|
+
fullScript: await fullScriptOf(context.worktree),
|
|
842
|
+
// hub-485: a lane's own config may not pass --full-suite.
|
|
843
|
+
laneAgent: checkDeps.laneAgent ?? isLaneConfig(),
|
|
827
844
|
});
|
|
828
845
|
// AGENT-HARNESS-61: an agent here without the lane's config gets no managed
|
|
829
846
|
// hooks. Reported, never blocking: the check itself cannot fix a process.
|
|
@@ -852,8 +869,7 @@ export async function laneCommand(action, args, flags, deps = {}) {
|
|
|
852
869
|
throw new CliError("REVIEW_WORKTREE_DIRTY", `${[...lines, `run: nothing recorded. ${committed ? "The worktree changed while the reviewers ran" : "The reviewed diff has uncommitted or untracked changes"}, and Dev records a review for commit ${run.body.head} only. Commit them (or drop them) and rerun nodii-dev lane check ${ref}; this round does not count.`].join("\n")}`, 1);
|
|
853
870
|
const file = await store.write(REVIEW_FILE, run.body);
|
|
854
871
|
const gates = await store.read(GATES_RECEIPT).catch(() => null);
|
|
855
|
-
const
|
|
856
|
-
const payload = await recordReview(flags, run.body, ranGates, context.worktree);
|
|
872
|
+
const payload = await recordReview(flags, run.body, gates, context.worktree, run.digest);
|
|
857
873
|
await run.saveLoop();
|
|
858
874
|
const outcome = runOutcome(run.body.checks);
|
|
859
875
|
return {
|
|
@@ -1129,9 +1145,8 @@ export async function laneCommand(action, args, flags, deps = {}) {
|
|
|
1129
1145
|
}
|
|
1130
1146
|
const body = runBody(checks, current);
|
|
1131
1147
|
const gates = await store.read(GATES_RECEIPT).catch(() => null);
|
|
1132
|
-
const ranGates = gates?.commit === body.head && gates?.base === body.base && Array.isArray(gates.commands) ? gates.commands : [];
|
|
1133
1148
|
// Dev checks every citation; nothing is written here unless it records the run.
|
|
1134
|
-
const payload = await recordReview(flags, body,
|
|
1149
|
+
const payload = await recordReview(flags, body, gates, context.worktree, digest);
|
|
1135
1150
|
const file = await store.write(REVIEW_FILE, body);
|
|
1136
1151
|
// A check the treatment made CLEAN starts a new loop, as any CLEAN does.
|
|
1137
1152
|
const loop = (await store.read(REVIEW_LOOP).catch(() => null)) ?? {};
|
package/dist/review.js
CHANGED
|
@@ -105,35 +105,118 @@ export function selfSizedGate(command) {
|
|
|
105
105
|
* hub-401: a gate that runs the repository's whole test suite. Per lane and per push only the affected
|
|
106
106
|
* tests run (`nodii-dev test affected --run`); the full suite runs in the twice-daily CI and the release gate.
|
|
107
107
|
* FULL_SCRIPT is the policy file's tests.full script.
|
|
108
|
+
*
|
|
109
|
+
* hub-485: Dev mirrors these rules on the gates receipt, so they are the contract, not a hint. A whole
|
|
110
|
+
* suite is also one workspace's or project's whole suite (`npm test -w X`, `pnpm --filter X test`,
|
|
111
|
+
* `jest --selectProjects web`), a direct runner call with no path (`node --test`, `npx playwright test`,
|
|
112
|
+
* `pytest`, `go test ./...`), a path that names the whole tree (`.`, `test/*.test.js`), and any of these
|
|
113
|
+
* inside `sh -c '…'`.
|
|
108
114
|
*/
|
|
109
115
|
export function fullSuiteGate(command, fullScript = "test") {
|
|
110
116
|
const text = String(command ?? "").trim();
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
// test:all and test:full are the full-suite scripts Dev's own check names too.
|
|
118
|
+
const scripts = new Set(["test", "t", "test:all", "test:full", fullScript]);
|
|
119
|
+
for (const part of shellCommands(text)) {
|
|
120
|
+
const nested = shellScript(part);
|
|
121
|
+
if (nested !== null) { if (fullSuiteGate(nested, fullScript)) return true; continue; }
|
|
122
|
+
let words = part.split(/\s+/).map((word) => word.replace(/^['"]+|['"]+$/g, "")).filter((word) => word && !/^[A-Z_][A-Z0-9_]*=/.test(word) && !/^(?:[0-9]?>|\|)/.test(word));
|
|
123
|
+
// `npx vitest`, `bunx jest`, `pnpm exec vitest run`, `python -m pytest`: the tool they start.
|
|
115
124
|
for (;;) {
|
|
116
125
|
const first = (words[0] ?? "").split("/").pop();
|
|
117
126
|
if (["npx", "bunx", "pnpx"].includes(first)) words = words.slice(1).filter((word, i) => i > 0 || !word.startsWith("-"));
|
|
118
127
|
else if (["npm", "pnpm", "yarn"].includes(first) && ["exec", "dlx"].includes(words.find((word, i) => i > 0 && !word.startsWith("-")))) words = words.slice(words.findIndex((word) => ["exec", "dlx"].includes(word)) + 1);
|
|
128
|
+
else if (/^python[0-9.]*$/.test(first) && words[1] === "-m") words = words.slice(2);
|
|
129
|
+
// `env CI=1 npm test`, `timeout 600 npm test`, `nice -n 10 jest`: the command they wrap.
|
|
130
|
+
else if (["env", "time", "nohup", "exec"].includes(first)) words = words.slice(1);
|
|
131
|
+
// `nodii-dev heavy run -- CMD`: the queue runs CMD.
|
|
132
|
+
else if (/^nodii-dev(?:\.js)?$/.test(first) && words[1] === "heavy" && words[2] === "run") words = words.slice(words.includes("--") ? words.indexOf("--") + 1 : 3);
|
|
133
|
+
else if (first === "timeout") { words = words.slice(1); while (words[0]?.startsWith("-")) words = words.slice(1); words = words.slice(1); }
|
|
134
|
+
else if (first === "nice") { words = words.slice(1); if (words[0] === "-n") words = words.slice(2); }
|
|
119
135
|
else break;
|
|
120
136
|
while (words[0]?.startsWith("-")) words = words.slice(1);
|
|
121
137
|
}
|
|
122
138
|
const [tool, ...args] = words;
|
|
123
139
|
const name = (tool ?? "").split("/").pop();
|
|
124
|
-
//
|
|
125
|
-
const operands = args
|
|
140
|
+
// A package manager's `-r` is --recursive, not node's --require: it takes no value.
|
|
141
|
+
const operands = operandsOf(args, { pm: ["npm", "pnpm", "yarn", "bun"].includes(name) });
|
|
142
|
+
// Paths that select something narrower than the whole tree.
|
|
143
|
+
const narrow = (list) => list.filter((word) => !broadPath(word));
|
|
126
144
|
if (["npm", "pnpm", "yarn", "bun"].includes(name)) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (
|
|
145
|
+
// `yarn workspace web test`: the workspace's own whole suite.
|
|
146
|
+
const [sub, script] = name === "yarn" && operands[0] === "workspace" ? operands.slice(2) : operands;
|
|
147
|
+
const count = name === "yarn" && operands[0] === "workspace" ? operands.length - 2 : operands.length;
|
|
148
|
+
if (["run", "run-script"].includes(sub) && scripts.has(script) && count === 2) return true;
|
|
149
|
+
if (sub === "test" && name === "bun") { if (narrow(operands.slice(1)).length === 0) return true; continue; }
|
|
150
|
+
if (scripts.has(sub) && count === 1) return true;
|
|
131
151
|
}
|
|
132
|
-
if (
|
|
152
|
+
if (name === "make" && operands.some((target) => scripts.has(target))) return true;
|
|
153
|
+
if (name === "turbo" && scripts.has(operands[0] === "run" ? operands[1] : operands[0])) return true;
|
|
154
|
+
if (["vitest", "jest"].includes(name) && !args.some((word) => CHANGED_FLAGS.has(word.split("=")[0])) && narrow(operands.filter((word) => !["run", "watch"].includes(word))).length === 0) return true;
|
|
155
|
+
if (name === "node" && args.includes("--test") && narrow(operands).every((word) => directory(word) && broadPath(`${word}/*`))) return true;
|
|
156
|
+
if (name === "playwright" && operands[0] === "test" && narrow(operands.slice(1)).length === 0) return true;
|
|
157
|
+
if (name === "pytest" && narrow(operands).length === 0) return true;
|
|
158
|
+
if (name === "go" && operands[0] === "test" && operands.slice(1).some((word) => word === "./..." || word === "...")) return true;
|
|
133
159
|
}
|
|
134
160
|
return false;
|
|
135
161
|
}
|
|
136
162
|
|
|
163
|
+
/**
|
|
164
|
+
* The simple commands of a shell line: split on `&&`, `||`, `;` and `|` outside quotes, so
|
|
165
|
+
* `sh -c 'a && b' && sh -c 'npm test'` is two commands, each with its own script.
|
|
166
|
+
*/
|
|
167
|
+
function shellCommands(text) {
|
|
168
|
+
const parts = [];
|
|
169
|
+
let current = "";
|
|
170
|
+
let quote = null;
|
|
171
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
172
|
+
const char = text[i];
|
|
173
|
+
if (quote) { if (char === quote) quote = null; current += char; continue; }
|
|
174
|
+
if (char === "'" || char === '"') { quote = char; current += char; continue; }
|
|
175
|
+
const two = text.slice(i, i + 2);
|
|
176
|
+
if (two === "&&" || two === "||") { parts.push(current); current = ""; i += 1; continue; }
|
|
177
|
+
// A lone `|` is a pipe and a lone `&` runs in the background; `>&`, `&>` and `2>&1` stay with the
|
|
178
|
+
// command they redirect. A newline and a subshell's parentheses end a command too.
|
|
179
|
+
if (char === ";" || char === "\n" || char === "(" || char === ")" || (char === "|" && text[i - 1] !== ">") || (char === "&" && text[i - 1] !== ">" && text[i + 1] !== ">")) { parts.push(current); current = ""; continue; }
|
|
180
|
+
current += char;
|
|
181
|
+
}
|
|
182
|
+
parts.push(current);
|
|
183
|
+
return parts.map((part) => part.trim()).filter(Boolean);
|
|
184
|
+
}
|
|
185
|
+
// jest's and vitest's own changed-files modes already run only the tests a change reaches.
|
|
186
|
+
const CHANGED_FLAGS = new Set(["--onlyChanged", "-o", "--changedSince", "--findRelatedTests", "--changed", "--related"]);
|
|
187
|
+
// `sh -c 'npm test'`, `bash -lc "…"`: the script the shell runs, or null.
|
|
188
|
+
const shellScript = (text) => text.match(/^(?:\S*\/)?(?:ba|z|da)?sh\s+-[a-z]*c[a-z]*\s+(['"])([\s\S]*)\1$/)?.[2] ?? null;
|
|
189
|
+
// A package manager's own flags that take a value: the workspace, filter or directory it runs in.
|
|
190
|
+
const SCOPE_FLAGS = new Set(["--workspace", "-w", "--filter", "-F", "--dir", "-C", "--prefix", "--cwd"]);
|
|
191
|
+
// jest's --selectProjects takes every word after it, up to the next flag.
|
|
192
|
+
const VARIADIC_FLAGS = new Set(["--selectProjects"]);
|
|
193
|
+
/** Operands: not a flag, and not the value of one (`--timeout 30000`, `--config ./jest.config.mjs`, `--filter web`). */
|
|
194
|
+
function operandsOf(args, { pm = false } = {}) {
|
|
195
|
+
const operands = [];
|
|
196
|
+
let variadic = false;
|
|
197
|
+
for (const [i, word] of args.entries()) {
|
|
198
|
+
if (word.startsWith("-")) { variadic = VARIADIC_FLAGS.has(word); continue; }
|
|
199
|
+
// A path ends a project list: `--selectProjects web src/a.test.ts` names one file of web.
|
|
200
|
+
if (variadic && !(word.includes("/") || /\.[A-Za-z0-9]+$/.test(word))) continue;
|
|
201
|
+
variadic = false;
|
|
202
|
+
const previous = args[i - 1];
|
|
203
|
+
if (i > 0 && ((VALUE_FLAGS.has(previous) && !(pm && previous === "-r")) || SCOPE_FLAGS.has(previous) || /^\d+$/.test(word))) continue;
|
|
204
|
+
operands.push(word);
|
|
205
|
+
}
|
|
206
|
+
return operands;
|
|
207
|
+
}
|
|
208
|
+
// The top-level directories a repository keeps its tests or sources in: one of them alone is the whole tree.
|
|
209
|
+
const TEST_ROOTS = new Set(["src", "test", "tests", "__tests__", "spec", "specs", "e2e", "lib", "app", "apps", "packages"]);
|
|
210
|
+
// `.`, a top-level test root (`tests`, `src/`), or a glob whose fixed part is at most one directory
|
|
211
|
+
// (`test/*.test.js`, `**/*.spec.ts`): the whole tree. Any other bare word is a path or a name filter.
|
|
212
|
+
const broadPath = (word) => {
|
|
213
|
+
if (word === "." || word === "./" || TEST_ROOTS.has(word.replace(/^\.\//, "").replace(/\/+$/, ""))) return true;
|
|
214
|
+
if (!/[*?[{]/.test(word)) return false;
|
|
215
|
+
return word.split(/[*?[{]/)[0].split("/").filter((segment) => segment && segment !== ".").length <= 1;
|
|
216
|
+
};
|
|
217
|
+
// A word with no file extension, as `node --test test/` names a directory.
|
|
218
|
+
const directory = (word) => !/\.[A-Za-z0-9]+$/.test(word.replace(/\/+$/, ""));
|
|
219
|
+
|
|
137
220
|
/** The content a receipt and a review cover: the diff itself, so uncommitted changes count too. */
|
|
138
221
|
export const diffDigest = (text) => createHash("sha256").update(text).digest("hex");
|
|
139
222
|
|
|
@@ -143,18 +226,20 @@ export const diffDigest = (text) => createHash("sha256").update(text).digest("he
|
|
|
143
226
|
* writes the receipt; without --gate only a receipt for this head, base and
|
|
144
227
|
* diff counts. Returns the diff the receipt covers, which is the one reviewed.
|
|
145
228
|
*/
|
|
146
|
-
export async function gatesReceipt(commands, { cwd, current, store, diff, run = runGate, now = () => new Date().toISOString() }) {
|
|
229
|
+
export async function gatesReceipt(commands, { cwd, current, store, diff, run = runGate, now = () => new Date().toISOString(), fullSuite = false }) {
|
|
147
230
|
const changed = await diff(cwd);
|
|
148
231
|
const digest = diffDigest(changed.text);
|
|
149
232
|
if (commands.length) {
|
|
233
|
+
const runs = [];
|
|
150
234
|
for (const command of commands) {
|
|
151
235
|
const { code, tail } = await run(command, cwd);
|
|
236
|
+
runs.push({ command, exitCode: code });
|
|
152
237
|
if (code !== 0)
|
|
153
238
|
throw new CliError("GATES_NOT_GREEN", `Gate \`${command}\` exited ${code}; nothing was reviewed or recorded. Make it green and rerun lane check.${tail ? `\n${tail.trimEnd().split("\n").slice(-20).join("\n")}` : ""}`, 1, { command, exitCode: code });
|
|
154
239
|
}
|
|
155
240
|
if (diffDigest((await diff(cwd)).text) !== digest)
|
|
156
241
|
throw new CliError("GATES_CHANGED_WORKTREE", "A gate changed the worktree, so the gates before it did not run on this content; nothing was reviewed or recorded. Keep or commit the change and rerun lane check.", 1);
|
|
157
|
-
await store.write(GATES_RECEIPT, { commit: current.commit, base: current.base, diff: digest, commands, at: now() });
|
|
242
|
+
await store.write(GATES_RECEIPT, { commit: current.commit, base: current.base, diff: digest, commands, runs, fullSuite, at: now() });
|
|
158
243
|
return changed;
|
|
159
244
|
}
|
|
160
245
|
const receipt = await store.read(GATES_RECEIPT);
|
|
@@ -163,6 +248,18 @@ export async function gatesReceipt(commands, { cwd, current, store, diff, run =
|
|
|
163
248
|
return changed;
|
|
164
249
|
}
|
|
165
250
|
|
|
251
|
+
/**
|
|
252
|
+
* hub-485: the gates receipt as Dev's review body carries it (`gates`), from the receipt stored for this
|
|
253
|
+
* head and base. Dev's object is strict and Dev classifies each command itself, so it carries only what
|
|
254
|
+
* Dev reads: base, the diff digest, and each run's command, exit code and commit. A receipt written
|
|
255
|
+
* before hub-485 has commands only, and each of them passed, or it was never written.
|
|
256
|
+
*/
|
|
257
|
+
export function reviewGates(receipt) {
|
|
258
|
+
if (!receipt || !Array.isArray(receipt.runs ?? receipt.commands)) return null;
|
|
259
|
+
const runs = receipt.runs ?? receipt.commands.map((command) => ({ command, exitCode: 0 }));
|
|
260
|
+
return { base: receipt.base, diff: receipt.diff, runs: runs.map(({ command, exitCode }) => ({ command, exitCode, commit: receipt.commit })) };
|
|
261
|
+
}
|
|
262
|
+
|
|
166
263
|
/**
|
|
167
264
|
* A-037: the repo's generated-artifact prefixes, as Dev serves them on its
|
|
168
265
|
* harness definition (`generatedPaths`, NODII-DEV-CLI-23). Dev is the only
|
|
@@ -545,12 +642,13 @@ async function inBatches(items, size, work) {
|
|
|
545
642
|
* gather over the changed paths, each with its full text. Any gap is an
|
|
546
643
|
* error: a partial set is never reviewed.
|
|
547
644
|
*/
|
|
548
|
-
export async function ruleClauses(ref, { request, freeze, paths, deltaGather, agentPicker }) {
|
|
645
|
+
export async function ruleClauses(ref, { request, freeze, paths, deltaGather, agentPicker, gatherPicker }) {
|
|
549
646
|
const mapped = [...(freeze?.clauseMap?.clauses ?? []), ...(freeze?.pinnedClauses ?? [])].map((x) => x.clauseId);
|
|
550
647
|
if (!freeze?.clauseMap) throw new ReviewerError(UNAVAILABLE, `${ref} has no Clause map: its Freeze was never written by Gather. Run nodii-dev lane gather ${ref} first.`);
|
|
551
648
|
if (paths.length > 5000) throw new ReviewerError(UNAVAILABLE, `the diff touches ${paths.length} paths; a Delta gather takes at most 5,000`);
|
|
552
649
|
let delta;
|
|
553
|
-
|
|
650
|
+
// CLI-143: an explicit agent pick requests the shortlist without warming a local model.
|
|
651
|
+
try { delta = await deltaGather(ref, paths, gatherPicker === "agent" ? { picker: "agent" } : undefined); }
|
|
554
652
|
catch (error) { throw new ReviewerError(UNAVAILABLE, `the Delta gather over the changed paths failed (${error?.code ?? "ERROR"}: ${error?.message ?? error})`); }
|
|
555
653
|
let data = delta?.payload?.data;
|
|
556
654
|
// hub-58: no usable local picker on this Mac, so the lane's own runtime picks
|
|
@@ -558,7 +656,7 @@ export async function ruleClauses(ref, { request, freeze, paths, deltaGather, ag
|
|
|
558
656
|
if (data?.recorded === false && data.shortlistId && data.triggers?.length && agentPicker) {
|
|
559
657
|
let documents;
|
|
560
658
|
try { documents = await agentPicker({ objective: data.objective, files: paths, triggers: data.triggers }); }
|
|
561
|
-
catch (error) { throw new ReviewerError(UNAVAILABLE, `the local picker fell back (${data.fallback ?? "no local pick"}) and the agent pick failed (${error?.outcome ?? error?.code ?? "ERROR"}: ${error?.message ?? error})`); }
|
|
659
|
+
catch (error) { throw new ReviewerError(UNAVAILABLE, `${gatherPicker === "agent" ? "agent-only gather was requested" : `the local picker fell back (${data.fallback ?? "no local pick"})`} and the agent pick failed (${error?.outcome ?? error?.code ?? "ERROR"}: ${error?.message ?? error})`); }
|
|
562
660
|
try { delta = await deltaGather(ref, paths, { shortlist: data.shortlistId, documents }); }
|
|
563
661
|
catch (error) { throw new ReviewerError(UNAVAILABLE, `recording the agent's Delta gather pick failed (${error?.code ?? "ERROR"}: ${error?.message ?? error})`); }
|
|
564
662
|
data = delta?.payload?.data;
|
|
@@ -975,17 +1073,22 @@ const errorCheck = (check, error, iterationCount, inputs) => ({ check, outcome:
|
|
|
975
1073
|
* caller saves the round (saveLoop) once it is kept: still looping, or
|
|
976
1074
|
* recorded; a run that records nothing leaves the loop where it was.
|
|
977
1075
|
*/
|
|
978
|
-
export async function runLaneCheck(ref, flags, { request, lane, freeze, current, cwd, store, diff, deltaGather, catalog, designCheck, gate, reviewer = runReviewer, picker = pickByAgent, now, exceptions = exceptionFiles, templates = codeConnectUnits, fullScript = "test" }) {
|
|
1076
|
+
export async function runLaneCheck(ref, flags, { request, lane, freeze, current, cwd, store, diff, deltaGather, catalog, designCheck, gate, reviewer = runReviewer, picker = pickByAgent, now, exceptions = exceptionFiles, templates = codeConnectUnits, fullScript = "test", laneAgent = false }) {
|
|
1077
|
+
if (flags.picker !== undefined && flags.picker !== "agent")
|
|
1078
|
+
throw new CliError("USAGE", "--picker accepts only agent; omit it to use the local picker first.", 2);
|
|
979
1079
|
const critical = flags.critical === true;
|
|
980
1080
|
const maxIterations = flags["max-iterations"] === undefined ? MAX_ITERATIONS : Number(flags["max-iterations"]);
|
|
981
1081
|
if (!Number.isInteger(maxIterations) || maxIterations < 1 || maxIterations > 100)
|
|
982
1082
|
throw new CliError("USAGE", "--max-iterations needs a whole number from 1 to 100.", 2);
|
|
983
1083
|
const gates = [flags.gate ?? []].flat();
|
|
984
1084
|
if (gates.some((x) => typeof x !== "string" || !x.trim())) throw new CliError("USAGE", "--gate needs a command, e.g. --gate 'nodii-dev test affected --run'.", 2);
|
|
1085
|
+
// hub-485: the operator's hard rule (15 Nov): every lane runs only the tests its change reaches.
|
|
1086
|
+
if (flags["full-suite"] === true && laneAgent)
|
|
1087
|
+
throw new CliError("FULL_SUITE_LANE_REFUSED", `${ref}: a lane runs only the tests its change reaches, so --full-suite is refused from a lane's config (MW2-20; hub-485). Use --gate 'nodii-dev test affected --run' or name the test files. A whole suite runs in the scheduled CI (MW3-15) and the release gate; staff, a steward or the coordinator runs it when a release or the test infrastructure needs it.`, 2);
|
|
985
1088
|
const whole = flags["full-suite"] === true ? [] : gates.filter((command) => fullSuiteGate(command, fullScript));
|
|
986
1089
|
if (whole.length)
|
|
987
1090
|
throw new CliError("GATE_FULL_SUITE", `Gate ${whole.map((command) => `\`${command}\``).join(", ")} runs the whole test suite. A lane runs only the tests its change reaches (MW2-20; hub-401): use --gate 'nodii-dev test affected --run', which also sizes the slot to the change. The full suite runs in the twice-daily CI and the release gate; pass --full-suite only when the change needs it (a release, or test infrastructure itself).`, 2, { gates: whole });
|
|
988
|
-
const changed = await gatesReceipt(gates, { cwd, current, store, diff, run: gate, ...(now ? { now } : {}) });
|
|
1091
|
+
const changed = await gatesReceipt(gates, { cwd, current, store, diff, run: gate, fullSuite: flags["full-suite"] === true, ...(now ? { now } : {}) });
|
|
989
1092
|
if (!changed.text.trim()) throw new CliError("LANE_DIFF_EMPTY", `${ref}: this worktree has no change against origin/main, so there is nothing to review.`, 1);
|
|
990
1093
|
const runtime = lane.launch?.runtime === "codex" ? "codex" : "claude";
|
|
991
1094
|
const runner = { runtime, model: lane.launch?.model, profile: lane.launch?.profile };
|
|
@@ -1011,7 +1114,7 @@ export async function runLaneCheck(ref, flags, { request, lane, freeze, current,
|
|
|
1011
1114
|
let gathered = null;
|
|
1012
1115
|
try {
|
|
1013
1116
|
if (tooLarge) throw tooLarge;
|
|
1014
|
-
gathered = await ruleClauses(ref, { request, freeze, paths: changed.paths, deltaGather, agentPicker: (input) => picker({ ...runner, ...input }) });
|
|
1117
|
+
gathered = await ruleClauses(ref, { request, freeze, paths: changed.paths, deltaGather, gatherPicker: flags.picker, agentPicker: (input) => picker({ ...runner, ...input }) });
|
|
1015
1118
|
} catch (error) {
|
|
1016
1119
|
if (!(error instanceof ReviewerError)) throw error;
|
|
1017
1120
|
rules = errorCheck("rules", error, firstRound("rules"), { clauseIds: [], deltaGatherId: null, clauseMapGatherId: freeze?.clauseMap?.gatherId ?? null });
|
package/dist/surface.js
CHANGED
|
@@ -564,12 +564,13 @@ export function emitSurface(tree, row, ds) {
|
|
|
564
564
|
if (emitted.trimStart().startsWith("{/*")) {
|
|
565
565
|
throw new CliError("SURFACE_VIEW_NOT_LAID_OUT", `${row.id}: view ${JSON.stringify(variant.name)} has no auto layout, so it would generate as an empty page; give the variant (or the App Frame's mainContent) auto layout in Figma, publish, and refetch`, 1);
|
|
566
566
|
}
|
|
567
|
-
return { state, fn, body: emitted };
|
|
567
|
+
return { state, fn, body: emitted, variant: variant.name };
|
|
568
568
|
});
|
|
569
569
|
const component = `${pascal(row.id)}Surface`;
|
|
570
570
|
const stateType = `${component}State`;
|
|
571
571
|
const propsType = `${component}Props`;
|
|
572
572
|
const named = resolveScopes(views, scopes, layers);
|
|
573
|
+
settlePiiColumns(views, unmapped);
|
|
573
574
|
const data = dataProps(views, propsType);
|
|
574
575
|
// A prop is optional when every template that draws it lists it in `metadata.optionalProps`.
|
|
575
576
|
const optionalNames = new Map();
|
|
@@ -1795,6 +1796,11 @@ function dataProps(views, propsType) {
|
|
|
1795
1796
|
const list = itemList(m.index, m[2]);
|
|
1796
1797
|
if (list) member(entry(list), m[3]).set("\u0000child", { raw: "ReactNode" });
|
|
1797
1798
|
}
|
|
1799
|
+
// A lifted row's PII column is PiiText's served pair (cli-140).
|
|
1800
|
+
for (const m of body.matchAll(PII_ROW_READ)) {
|
|
1801
|
+
const list = itemList(m.index, m[1]);
|
|
1802
|
+
if (list) member(entry(list), m[2]).set("\u0000pii", { raw: PII_ROW_FIELD });
|
|
1803
|
+
}
|
|
1798
1804
|
for (const m of body.matchAll(/(^|>)\s*\{([a-z][A-Za-z0-9]*)\}/gm)) {
|
|
1799
1805
|
if (JS_LITERALS.has(m[2])) continue;
|
|
1800
1806
|
entry(m[2]).child = true;
|
|
@@ -2426,6 +2432,69 @@ function tabStrip(run, ctx) {
|
|
|
2426
2432
|
].join("\n");
|
|
2427
2433
|
}
|
|
2428
2434
|
|
|
2435
|
+
/**
|
|
2436
|
+
* A lifted row's PII field: PiiText's served pair, as the page's own PiiText takes it
|
|
2437
|
+
* (`value`, `model`, `relation`, and the server's `maskHint` when it sent one). Nothing else of
|
|
2438
|
+
* PiiText's is offered, so a row can never force a value visible (U05; cli-140).
|
|
2439
|
+
*/
|
|
2440
|
+
const PII_KINDS = new Set(["name", "email", "phone", "address", "dob", "document", "text"]);
|
|
2441
|
+
const PII_ROW_FIELD = `{ ${["maskHint?", "model", "relation", "value"].map((k) => `${k}: ComponentProps<typeof PiiText>[${JSON.stringify(k.replace("?", ""))}]`).join("; ")} }`;
|
|
2442
|
+
const PII_ROW_READ = /<PiiText value=\{([a-z][A-Za-z0-9]*)\.([A-Za-z][A-Za-z0-9]*)\.value\} kind="/g;
|
|
2443
|
+
|
|
2444
|
+
/**
|
|
2445
|
+
* One list's rows are one type across the views and tables that share it. A column that is
|
|
2446
|
+
* PiiText in one of them and a node in another (two tables whose heads still show Figma's
|
|
2447
|
+
* placeholder, so both are `column1`) can be neither: it stays a node everywhere, as before
|
|
2448
|
+
* cli-140, and the report names it.
|
|
2449
|
+
*/
|
|
2450
|
+
function settlePiiColumns(views, unmapped) {
|
|
2451
|
+
const NODE_READ = /(^|>)\s*\{([a-z][A-Za-z0-9]*)\.([A-Za-z][A-Za-z0-9]*)\}/gm;
|
|
2452
|
+
const PII_CELL = />\n[ \t]*<PiiText value=\{([a-z][A-Za-z0-9]*)\.([A-Za-z][A-Za-z0-9]*)\.value\} kind="[^\n]*\/>\n[ \t]*<\/TableCell>/g;
|
|
2453
|
+
const reads = new Map();
|
|
2454
|
+
const count = (view, openers, at, param, key, how) => {
|
|
2455
|
+
const list = listAt(openers, at, param);
|
|
2456
|
+
if (!list) return;
|
|
2457
|
+
const id = `${list}.${key}`;
|
|
2458
|
+
const r = reads.get(id) ?? reads.set(id, { list, key, pii: 0, node: 0, variant: view.variant }).get(id);
|
|
2459
|
+
r[how]++;
|
|
2460
|
+
};
|
|
2461
|
+
for (const view of views) {
|
|
2462
|
+
const openers = listOpeners(view.body);
|
|
2463
|
+
for (const m of view.body.matchAll(PII_ROW_READ)) count(view, openers, m.index, m[1], m[2], "pii");
|
|
2464
|
+
for (const m of view.body.matchAll(NODE_READ)) count(view, openers, m.index, m[2], m[3], "node");
|
|
2465
|
+
}
|
|
2466
|
+
const mixed = new Map([...reads].filter(([, r]) => r.pii && r.node));
|
|
2467
|
+
if (!mixed.size) return;
|
|
2468
|
+
for (const view of views) {
|
|
2469
|
+
const openers = listOpeners(view.body);
|
|
2470
|
+
view.body = view.body.replace(PII_CELL, (all, param, key, at) => (mixed.has(`${listAt(openers, at, param)}.${key}`) ? `>{${param}.${key}}</TableCell>` : all));
|
|
2471
|
+
}
|
|
2472
|
+
for (const r of mixed.values()) {
|
|
2473
|
+
unmapped.push({ variant: r.variant, path: r.list, kind: LIFTED, detail: `column ${r.key} of ${r.list} is PiiText in ${r.pii} of the ${r.pii + r.node} tables that share its rows: it stays a ReactNode, and the page must draw its people through PiiText itself (U05; cli-140)` });
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
/** The attributes of the PiiText a body cell's template draws as its whole content (Table cell, Content=PII); null for any other cell. */
|
|
2478
|
+
function piiCellAttrs({ code, held }) {
|
|
2479
|
+
const own = (code ?? "").trim();
|
|
2480
|
+
if (held || !/^<TableCell\b/.test(own)) return null;
|
|
2481
|
+
const inner = own.slice(openTagEnd(own) + 1).replace(/<\/TableCell>$/, "").trim();
|
|
2482
|
+
return /^<PiiText\b([^<>]*?)\s*\/>$/.exec(inner)?.[1] ?? null;
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
function piiTreeKind(cell) {
|
|
2486
|
+
const exposed = Object.entries(cell.instance?.exposed ?? {}).find(([name]) => name.toLowerCase() === "piitext")?.[1];
|
|
2487
|
+
return exposed?.props?.kind;
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
/** That cell's PiiText, reading the served pair at `ref` (`row.employee`), with the kind the tree states for it. */
|
|
2491
|
+
function piiCellText({ cell, code }, ref) {
|
|
2492
|
+
const attrs = piiCellAttrs({ code }) ?? "";
|
|
2493
|
+
const kind = piiTreeKind(cell);
|
|
2494
|
+
const size = /\ssize="\w+"/.exec(attrs)?.[0] ?? "";
|
|
2495
|
+
return `<PiiText value={${ref}.value} kind="${kind}" model={${ref}.model} relation={${ref}.relation} maskHint={${ref}.maskHint}${size} />`;
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2429
2498
|
/**
|
|
2430
2499
|
* A table a Surface draws as frames: rows of Table-part instances (what the
|
|
2431
2500
|
* templates emit as TableHead or TableCell). Those parts are valid only inside
|
|
@@ -2683,6 +2752,27 @@ function tableOf(node, ctx) {
|
|
|
2683
2752
|
// A row is a door to its record when the page passes a handler (U03-7; NODII-DEV-CLI-83).
|
|
2684
2753
|
const rowClick = mark(ctx, listName, "onRowClick", null);
|
|
2685
2754
|
ctx.note(ctx.path, LIFTED, `${dataRows.length} body row${dataRows.length === 1 ? "" : "s"} lifted as data: rows of { id, ${keys.join(", ")} } (NODII-DEV-CLI-82)`);
|
|
2755
|
+
// A column whose every body cell is a PiiText is a person's value: its row field is the
|
|
2756
|
+
// served pair and the cell draws PiiText from it, never a node the page could fill with a
|
|
2757
|
+
// raw name (U05; cli-140). A column that is PiiText in only some rows stays a node, and
|
|
2758
|
+
// the report names it.
|
|
2759
|
+
const invalidPii = new Map();
|
|
2760
|
+
const piiColumn = keys.map((key, i) => {
|
|
2761
|
+
const drawn = dataRows.filter((p) => piiCellAttrs(p.cells[i]) !== null).length;
|
|
2762
|
+
if (drawn > 0 && drawn < dataRows.length) ctx.note(ctx.path, LIFTED, `column ${key} is PiiText in ${drawn} of ${dataRows.length} body rows: it stays a ReactNode, and the page must draw its people through PiiText itself (U05; cli-140)`);
|
|
2763
|
+
if (drawn === dataRows.length) {
|
|
2764
|
+
const kinds = dataRows.map((p) => piiTreeKind(p.cells[i].cell));
|
|
2765
|
+
const why = kinds.some((kind) => !PII_KINDS.has(kind))
|
|
2766
|
+
? `column ${key} has no recognised PiiText kind in one or more body rows`
|
|
2767
|
+
: new Set(kinds).size !== 1 ? `column ${key} has incompatible PiiText kinds` : null;
|
|
2768
|
+
if (why) {
|
|
2769
|
+
ctx.note(ctx.path, "table", `${why}: left unmapped (MW8-17.3; cli-140)`);
|
|
2770
|
+
invalidPii.set(i, why);
|
|
2771
|
+
return false;
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
return drawn === dataRows.length;
|
|
2775
|
+
});
|
|
2686
2776
|
const cells = first.cells.map((c, i) => {
|
|
2687
2777
|
const w = columnWidth(c.cell);
|
|
2688
2778
|
let open = `<TableCell${wrapperAttrs(w, first.row)}>`;
|
|
@@ -2694,6 +2784,8 @@ function tableOf(node, ctx) {
|
|
|
2694
2784
|
open = own.slice(0, end + 1).replace(/\s*\/>$/, ">");
|
|
2695
2785
|
close = `</${tag}>`;
|
|
2696
2786
|
}
|
|
2787
|
+
if (invalidPii.has(i)) return indent(`${open}${comment(`unmapped: ${invalidPii.get(i)}`)}${close}`, depth + 4);
|
|
2788
|
+
if (piiColumn[i]) return indent(`${open}\n ${piiCellText(c, `row.${keys[i]}`)}\n${close}`, depth + 4);
|
|
2697
2789
|
return indent(`${open}{row.${keys[i]}}${close}`, depth + 4);
|
|
2698
2790
|
});
|
|
2699
2791
|
return [
|