From 778728183dc2fc2e9ef580ff5b16aa705a4160cb Mon Sep 17 00:00:00 2001 From: lcherone Date: Sat, 17 Oct 2026 22:34:15 +0100 Subject: [PATCH] feat: upgrade runtime schemas to Zod 4 --- CHANGELOG.md | 3 ++ README.md | 4 +- dist/index.d.cts | 78 +++++++++++++++++------------------ dist/index.d.ts | 78 +++++++++++++++++------------------ docs/ADOPTION.md | 2 +- package-lock.json | 12 +++--- package.json | 4 +- scripts/check-release-tag.mjs | 2 +- typedoc.json | 21 +++++++++- 9 files changed, 109 insertions(+), 95 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0127e8..b2f98d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,11 @@ All notable changes are documented here. This project follows [Semantic Versioni ## Unreleased +## 0.3.0 - 2026-10-17 + ### Changed +- Upgrade the public runtime schema dependency to Zod 4. The CTL task and wire formats are unchanged, while exported schema declaration types now follow Zod 4. - Group Vitest and its coverage provider into one compatible dependency update. - Keep TypeScript and Node.js type definitions on their currently supported major versions. diff --git a/README.md b/README.md index 0db9707..7a663c6 100644 --- a/README.md +++ b/README.md @@ -39,14 +39,14 @@ CTL2 is compact serialization, not a privacy boundary. Anyone who can read a pay Install directly from the immutable public GitHub release tag without registry authentication: ```bash -npm install github:lcherone/ctl2#v0.2.0 +npm install github:lcherone/ctl2#v0.3.0 ``` Or install from GitHub Packages after authenticating npm for `npm.pkg.github.com`: ```bash npm config set @lcherone:registry https://npm.pkg.github.com -npm install @lcherone/ctl2@0.2.0 +npm install @lcherone/ctl2@0.3.0 ``` The runtime supports Node.js 18 and later. The ESM build also works in modern browsers that provide `TextEncoder`. diff --git a/dist/index.d.cts b/dist/index.d.cts index ca12c1f..c1860dd 100644 --- a/dist/index.d.cts +++ b/dist/index.d.cts @@ -19,7 +19,13 @@ import { z } from 'zod'; * - `review`: inspect and report rather than mutate. * - `test`: add or execute verification work. */ -declare const operationSchema: z.ZodEnum<["implement", "fix", "refactor", "review", "test"]>; +declare const operationSchema: z.ZodEnum<{ + implement: "implement"; + fix: "fix"; + refactor: "refactor"; + review: "review"; + test: "test"; +}>; /** A supported task operation inferred from {@link operationSchema}. */ type Operation = z.infer; /** @@ -28,14 +34,22 @@ type Operation = z.infer; * This label is descriptive metadata. CTL2 does not enforce an organisation's * authorization policy and does not make restricted content private. */ -declare const classificationSchema: z.ZodEnum<["public", "internal-approved", "restricted"]>; +declare const classificationSchema: z.ZodEnum<{ + public: "public"; + "internal-approved": "internal-approved"; + restricted: "restricted"; +}>; /** A task-context classification inferred from {@link classificationSchema}. */ type ContextClassification = z.infer; /** * Runtime validator for payload representations supported by * {@link decodeTransferPayload}. */ -declare const transferFormatSchema: z.ZodEnum<["ctl", "ctl-abstract", "json"]>; +declare const transferFormatSchema: z.ZodEnum<{ + ctl: "ctl"; + "ctl-abstract": "ctl-abstract"; + json: "json"; +}>; /** A supported transfer representation inferred from {@link transferFormatSchema}. */ type TransferFormat = z.infer; /** @@ -91,44 +105,26 @@ declare const handoverTaskSchema: z.ZodObject<{ id: z.ZodString; title: z.ZodString; objective: z.ZodString; - operation: z.ZodEnum<["implement", "fix", "refactor", "review", "test"]>; - targets: z.ZodArray; - requirements: z.ZodArray; - acceptanceCriteria: z.ZodArray; - constraints: z.ZodArray; - verification: z.ZodArray; - assumptions: z.ZodArray; - exclusions: z.ZodArray; - contextClassification: z.ZodEnum<["public", "internal-approved", "restricted"]>; -}, "strict", z.ZodTypeAny, { - version: 1; - id: string; - title: string; - objective: string; - operation: "implement" | "fix" | "refactor" | "review" | "test"; - targets: string[]; - requirements: string[]; - acceptanceCriteria: string[]; - constraints: string[]; - verification: string[]; - assumptions: string[]; - exclusions: string[]; - contextClassification: "public" | "internal-approved" | "restricted"; -}, { - version: 1; - id: string; - title: string; - objective: string; - operation: "implement" | "fix" | "refactor" | "review" | "test"; - targets: string[]; - requirements: string[]; - acceptanceCriteria: string[]; - constraints: string[]; - verification: string[]; - assumptions: string[]; - exclusions: string[]; - contextClassification: "public" | "internal-approved" | "restricted"; -}>; + operation: z.ZodEnum<{ + implement: "implement"; + fix: "fix"; + refactor: "refactor"; + review: "review"; + test: "test"; + }>; + targets: z.ZodArray; + requirements: z.ZodArray; + acceptanceCriteria: z.ZodArray; + constraints: z.ZodArray; + verification: z.ZodArray; + assumptions: z.ZodArray; + exclusions: z.ZodArray; + contextClassification: z.ZodEnum<{ + public: "public"; + "internal-approved": "internal-approved"; + restricted: "restricted"; + }>; +}, z.core.$strict>; /** * Deterministic CTL2 encoding, strict CTL2/CTL1 decoding, and format helpers. diff --git a/dist/index.d.ts b/dist/index.d.ts index ca12c1f..c1860dd 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -19,7 +19,13 @@ import { z } from 'zod'; * - `review`: inspect and report rather than mutate. * - `test`: add or execute verification work. */ -declare const operationSchema: z.ZodEnum<["implement", "fix", "refactor", "review", "test"]>; +declare const operationSchema: z.ZodEnum<{ + implement: "implement"; + fix: "fix"; + refactor: "refactor"; + review: "review"; + test: "test"; +}>; /** A supported task operation inferred from {@link operationSchema}. */ type Operation = z.infer; /** @@ -28,14 +34,22 @@ type Operation = z.infer; * This label is descriptive metadata. CTL2 does not enforce an organisation's * authorization policy and does not make restricted content private. */ -declare const classificationSchema: z.ZodEnum<["public", "internal-approved", "restricted"]>; +declare const classificationSchema: z.ZodEnum<{ + public: "public"; + "internal-approved": "internal-approved"; + restricted: "restricted"; +}>; /** A task-context classification inferred from {@link classificationSchema}. */ type ContextClassification = z.infer; /** * Runtime validator for payload representations supported by * {@link decodeTransferPayload}. */ -declare const transferFormatSchema: z.ZodEnum<["ctl", "ctl-abstract", "json"]>; +declare const transferFormatSchema: z.ZodEnum<{ + ctl: "ctl"; + "ctl-abstract": "ctl-abstract"; + json: "json"; +}>; /** A supported transfer representation inferred from {@link transferFormatSchema}. */ type TransferFormat = z.infer; /** @@ -91,44 +105,26 @@ declare const handoverTaskSchema: z.ZodObject<{ id: z.ZodString; title: z.ZodString; objective: z.ZodString; - operation: z.ZodEnum<["implement", "fix", "refactor", "review", "test"]>; - targets: z.ZodArray; - requirements: z.ZodArray; - acceptanceCriteria: z.ZodArray; - constraints: z.ZodArray; - verification: z.ZodArray; - assumptions: z.ZodArray; - exclusions: z.ZodArray; - contextClassification: z.ZodEnum<["public", "internal-approved", "restricted"]>; -}, "strict", z.ZodTypeAny, { - version: 1; - id: string; - title: string; - objective: string; - operation: "implement" | "fix" | "refactor" | "review" | "test"; - targets: string[]; - requirements: string[]; - acceptanceCriteria: string[]; - constraints: string[]; - verification: string[]; - assumptions: string[]; - exclusions: string[]; - contextClassification: "public" | "internal-approved" | "restricted"; -}, { - version: 1; - id: string; - title: string; - objective: string; - operation: "implement" | "fix" | "refactor" | "review" | "test"; - targets: string[]; - requirements: string[]; - acceptanceCriteria: string[]; - constraints: string[]; - verification: string[]; - assumptions: string[]; - exclusions: string[]; - contextClassification: "public" | "internal-approved" | "restricted"; -}>; + operation: z.ZodEnum<{ + implement: "implement"; + fix: "fix"; + refactor: "refactor"; + review: "review"; + test: "test"; + }>; + targets: z.ZodArray; + requirements: z.ZodArray; + acceptanceCriteria: z.ZodArray; + constraints: z.ZodArray; + verification: z.ZodArray; + assumptions: z.ZodArray; + exclusions: z.ZodArray; + contextClassification: z.ZodEnum<{ + public: "public"; + "internal-approved": "internal-approved"; + restricted: "restricted"; + }>; +}, z.core.$strict>; /** * Deterministic CTL2 encoding, strict CTL2/CTL1 decoding, and format helpers. diff --git a/docs/ADOPTION.md b/docs/ADOPTION.md index e1cff2d..3daccf5 100644 --- a/docs/ADOPTION.md +++ b/docs/ADOPTION.md @@ -34,7 +34,7 @@ For public Git installation, pin an immutable tag: ```json { "dependencies": { - "@lcherone/ctl2": "github:lcherone/ctl2#v0.2.0" + "@lcherone/ctl2": "github:lcherone/ctl2#v0.3.0" } } ``` diff --git a/package-lock.json b/package-lock.json index ef0a708..0ea7582 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@lcherone/ctl2", - "version": "0.2.0", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@lcherone/ctl2", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "dependencies": { - "zod": "^3.24.2" + "zod": "^4.6.7" }, "devDependencies": { "@eslint/js": "^10.0.1", @@ -4452,9 +4452,9 @@ } }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.6.7", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", + "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index f237799..0e99b3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lcherone/ctl2", - "version": "0.2.0", + "version": "0.3.0", "description": "Deterministic, reversible Compact Task Language serialization for structured AI handovers.", "license": "MIT", "author": "Lawrence Cherone", @@ -70,7 +70,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "zod": "^3.24.2" + "zod": "^4.6.7" }, "devDependencies": { "@eslint/js": "^10.0.1", diff --git a/scripts/check-release-tag.mjs b/scripts/check-release-tag.mjs index b8904c6..e943b9a 100644 --- a/scripts/check-release-tag.mjs +++ b/scripts/check-release-tag.mjs @@ -3,7 +3,7 @@ * * The release workflow supplies `GITHUB_REF_NAME`. A positional argument is * also accepted for local verification, for example: - * node scripts/check-release-tag.mjs v0.2.0 + * node scripts/check-release-tag.mjs v0.3.0 */ import { readFileSync } from 'node:fs'; diff --git a/typedoc.json b/typedoc.json index 47a485d..fe6954e 100644 --- a/typedoc.json +++ b/typedoc.json @@ -3,11 +3,19 @@ "entryPoints": ["src/index.ts"], "excludeInternal": true, "intentionallyNotDocumented": [ + "classificationSchema.__type.public", + "classificationSchema.__type.internal-approved", + "classificationSchema.__type.restricted", "handoverTaskSchema.__type.version", "handoverTaskSchema.__type.id", "handoverTaskSchema.__type.title", "handoverTaskSchema.__type.objective", "handoverTaskSchema.__type.operation", + "handoverTaskSchema.__type.operation.__type.implement", + "handoverTaskSchema.__type.operation.__type.fix", + "handoverTaskSchema.__type.operation.__type.refactor", + "handoverTaskSchema.__type.operation.__type.review", + "handoverTaskSchema.__type.operation.__type.test", "handoverTaskSchema.__type.targets", "handoverTaskSchema.__type.requirements", "handoverTaskSchema.__type.acceptanceCriteria", @@ -15,7 +23,18 @@ "handoverTaskSchema.__type.verification", "handoverTaskSchema.__type.assumptions", "handoverTaskSchema.__type.exclusions", - "handoverTaskSchema.__type.contextClassification" + "handoverTaskSchema.__type.contextClassification", + "handoverTaskSchema.__type.contextClassification.__type.public", + "handoverTaskSchema.__type.contextClassification.__type.internal-approved", + "handoverTaskSchema.__type.contextClassification.__type.restricted", + "operationSchema.__type.implement", + "operationSchema.__type.fix", + "operationSchema.__type.refactor", + "operationSchema.__type.review", + "operationSchema.__type.test", + "transferFormatSchema.__type.ctl", + "transferFormatSchema.__type.ctl-abstract", + "transferFormatSchema.__type.json" ], "treatWarningsAsErrors": true, "treatValidationWarningsAsErrors": true,