build(server): lint:mcp-zod counts a z. call that a line break splits from its dot

Prettier breaks a long schema into z on one line and .object( on the next,
which the count read as nothing: formatting the tool files would have taken
134 hand-written fields out of the tally. Whitespace before the dot counts
now. Four files already held such a split call, so their entries rise to
what they really hold (atlas 23, doc-sync 1, help 4, transit 16).
This commit is contained in:
Maurice
2026-10-10 20:49:22 +02:00
parent 0903dcd5ab
commit 5c198f2848
3 changed files with 13 additions and 4 deletions
+4 -3
View File
@@ -3,14 +3,15 @@
"src/nest/accommodations/accommodations.mcp.ts": 28,
"src/nest/airports/airports.mcp.ts": 3,
"src/nest/assignments/assignments.mcp.ts": 10,
"src/nest/atlas/atlas.mcp.ts": 22,
"src/nest/atlas/atlas.mcp.ts": 23,
"src/nest/budget/budget.mcp.ts": 36,
"src/nest/collab/collab.mcp.ts": 20,
"src/nest/collections/collections.mcp.ts": 14,
"src/nest/day-notes/day-notes.mcp.ts": 10,
"src/nest/days/days.mcp.ts": 2,
"src/nest/doc-sync/doc-sync.mcp.ts": 1,
"src/nest/files/files.mcp.ts": 4,
"src/nest/help/help.mcp.ts": 3,
"src/nest/help/help.mcp.ts": 4,
"src/nest/integrations/airtrail.mcp.ts": 2,
"src/nest/integrations/dawarich.mcp.ts": 13,
"src/nest/journey/journey.mcp.ts": 66,
@@ -30,7 +31,7 @@
"src/nest/share/share.mcp.ts": 7,
"src/nest/tags/tags.mcp.ts": 4,
"src/nest/todo/todo.mcp.ts": 14,
"src/nest/transit/transit.mcp.ts": 14,
"src/nest/transit/transit.mcp.ts": 16,
"src/nest/trips/trips.mcp.ts": 24,
"src/nest/vacay/vacay.mcp.ts": 25,
"src/nest/weather/weather.mcp.ts": 8
+3 -1
View File
@@ -18,7 +18,9 @@
*/
import { cliMain } from './lib/count-ratchet.mjs';
const ZOD_CALL = /\bz\./g;
// Whitespace before the dot counts too: Prettier breaks a long chain into `z`
// on one line and `.object(` on the next.
const ZOD_CALL = /\bz\s*\./g;
/** The inline zod calls in one file's text, comments included. */
export function countInlineZod(text) {
@@ -65,6 +65,12 @@ describe('the counters', () => {
expect(countInlineZod(`${Z}object({ a: ${Z}string(), b: idSchema, c: fizz.x })`)).toBe(2);
});
it('ENV-RATCHET-001b: counts a z. call Prettier broke across lines', () => {
expect(countInlineZod(`const s = z
.object({ a: idSchema })
.strict();`)).toBe(1);
});
it('ENV-RATCHET-002: counts the result envelope and HTTP in a service, not a 2xx status', () => {
expect(
countServiceIdioms(`return { error: 'x', ${STATUS} };\nthrow ${HTTP}{}, 400);\nreturn { status: 200 };`),