From 201f7ba7c1b326ee1aa83b1acd89e1d0a8de358d Mon Sep 17 00:00:00 2001 From: Brian McClain <10232151+b-mac-gs@users.noreply.github.com> Date: Wed, 30 Sep 2026 07:59:29 -0400 Subject: [PATCH 1/2] Check the OIC listing with OIC's own profile check oic:check now runs the website's profile:check (the importer and Charter preflight review uses) from a cached clone of the public website repo or OIC_WEBSITE, instead of a local schema-and-size check that read the schema from a sibling folder. CI runs the same check through the profile-check Action. Drops ajv and yaml. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 6 ++++ docs/OIC_LISTING.md | 4 +-- package.json | 4 +-- pnpm-lock.yaml | 40 ++-------------------- scripts/oic-check.ts | 71 +++++++++++++++++----------------------- 5 files changed, 41 insertions(+), 84 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76a5d52..16ec5c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,3 +35,9 @@ jobs: - run: pnpm privacy:check env: CHROME_PATH: /usr/bin/google-chrome + oic-profile: + # The listing, checked with OIC's own importer and Charter preflight. + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: open-industrial-collective/website/profile-check@main diff --git a/docs/OIC_LISTING.md b/docs/OIC_LISTING.md index e9c8fb5..1f200b7 100644 --- a/docs/OIC_LISTING.md +++ b/docs/OIC_LISTING.md @@ -15,10 +15,10 @@ Documentation Toolkit is listed the same way as Visual Toolkit: the profile live ```bash pnpm oic:media # regenerate the screenshots and logo (starts Vite, drives your Chrome) pnpm oic:media evidence # or only shots whose name matches -pnpm oic:check # validate the profile against the catalog schema and the image limits +pnpm oic:check # check the profile with OIC's importer and Charter preflight ``` -`oic:check` reads the schema from a sibling checkout of the website repo (`../open-industrial-collective/website/src/project-v2.schema.json`); set `OIC_SCHEMA` to use another path. +`oic:check` runs OIC's own profile check, the importer and Charter preflight a reviewer runs, from a cached clone of the public website repo (or the checkout in `OIC_WEBSITE`). `pnpm oic:check --ref HEAD` checks exactly what OIC would import, and its digest matches the reviewer's `fetch`. CI runs the same check through the `open-industrial-collective/website/profile-check` Action. A clean check is not an approval. Keep claims accurate: - Screenshots use the synthetic Riverbend sample. Say so; never use a customer's project. diff --git a/package.json b/package.json index 6430740..2f1e4fb 100644 --- a/package.json +++ b/package.json @@ -42,14 +42,12 @@ "@types/react": "^19.2.0", "@types/react-dom": "^19.2.0", "@vitejs/plugin-react": "^6.1.1", - "ajv": "^8.20.0", "esbuild": "^0.25.10", "puppeteer-core": "^25.12.0", "tsx": "^4.20.0", "typescript": "^5.9.3", "vite": "^8.3.1", - "vitest": "^3.2.4", - "yaml": "^2.9.1" + "vitest": "^3.2.4" }, "pnpm": { "onlyBuiltDependencies": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c70728a..db87d11 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,9 +36,6 @@ importers: '@vitejs/plugin-react': specifier: ^6.1.1 version: 6.1.1(vite@8.3.1(@types/node@22.20.4)(esbuild@0.25.12)(tsx@4.23.15)(yaml@2.9.1)) - ajv: - specifier: ^8.20.0 - version: 8.20.0 esbuild: specifier: ^0.25.10 version: 0.25.12 @@ -57,9 +54,6 @@ importers: vitest: specifier: ^3.2.4 version: 3.2.7(@types/node@22.20.4)(lightningcss@1.33.0)(tsx@4.23.15)(yaml@2.9.1) - yaml: - specifier: ^2.9.1 - version: 2.9.1 packages: @@ -689,9 +683,6 @@ packages: '@vitest/utils@3.2.7': resolution: {integrity: sha512-x6BDOd7dyo3PFLY3I9/HJ25X/6OurhGXk2/B9gOZNPF7XDVjeBK4k01lQE5uvDpbuheErh91qYuE1E2OEjK3Rw==} - ajv@8.20.0: - resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==} - ansi-regex@6.4.0: resolution: {integrity: sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw==} engines: {node: '>=12'} @@ -783,12 +774,6 @@ packages: resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} engines: {node: '>=12.0.0'} - fast-deep-equal@3.1.3: - resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - - fast-uri@3.1.8: - resolution: {integrity: sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==} - fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -829,9 +814,6 @@ packages: js-tokens@9.0.1: resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==} - json-schema-traverse@1.0.0: - resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - jszip@3.10.2: resolution: {integrity: sha512-3l+rb15IOWtUhU0H5MFqES/T6Kh7abYwjosBey/vD6hDt8zoEffkSC5Ws5SGtgVw3gBx2NEbhTeSW1+kWkpyTQ==} @@ -977,10 +959,6 @@ packages: readable-stream@2.3.8: resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} - require-from-string@2.0.2: - resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} - engines: {node: '>=0.10.0'} - rolldown@1.2.11: resolution: {integrity: sha512-qpSwIyz0jHQq5qXBTNxFmE6664rJ7O+4TvPFOiOaBSrz8IOHc1koKKSqTM2H6u1UG1+TveuC6vaDHKXFOvb1Kw==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1612,13 +1590,6 @@ snapshots: loupe: 3.2.1 tinyrainbow: 2.0.0 - ajv@8.20.0: - dependencies: - fast-deep-equal: 3.1.3 - fast-uri: 3.1.8 - json-schema-traverse: 1.0.0 - require-from-string: 2.0.2 - ansi-regex@6.4.0: {} ansi-styles@6.2.3: {} @@ -1742,10 +1713,6 @@ snapshots: expect-type@1.4.0: {} - fast-deep-equal@3.1.3: {} - - fast-uri@3.1.8: {} - fdir@6.5.0(picomatch@4.0.7): optionalDependencies: picomatch: 4.0.7 @@ -1772,8 +1739,6 @@ snapshots: js-tokens@9.0.1: {} - json-schema-traverse@1.0.0: {} - jszip@3.10.2: dependencies: lie: 3.3.0 @@ -1901,8 +1866,6 @@ snapshots: string_decoder: 1.1.1 util-deprecate: 1.0.2 - require-from-string@2.0.2: {} - rolldown@1.2.11: dependencies: '@oxc-project/types': 0.151.0 @@ -2140,7 +2103,8 @@ snapshots: y18n@5.0.8: {} - yaml@2.9.1: {} + yaml@2.9.1: + optional: true yargs-parser@22.0.0: {} diff --git a/scripts/oic-check.ts b/scripts/oic-check.ts index 3bd11c4..b7f5ab9 100644 --- a/scripts/oic-check.ts +++ b/scripts/oic-check.ts @@ -1,53 +1,42 @@ /** - * Check the OIC listing before pushing: the profile against the catalog's v2 - * schema, and every image against the catalog limits. + * Check the OIC listing with OIC's own importer and Charter preflight, the + * same code review runs (`profile:check` in open-industrial-collective/website). * - * pnpm oic:check + * pnpm oic:check # the working tree; flags files not committed yet + * pnpm oic:check --ref HEAD # exactly what OIC would import from that commit * - * The schema lives in the OIC website repo; point OIC_SCHEMA at a checkout's - * src/project-v2.schema.json if it isn't in the default sibling location. + * Uses the website checkout in OIC_WEBSITE if set, otherwise a cached shallow + * clone of the public website repo under node_modules/.cache. CI runs the same + * check through the profile-check Action. */ -import { existsSync, readFileSync, statSync } from "node:fs"; +import { execFileSync, spawnSync } from "node:child_process"; +import { createHash } from "node:crypto"; +import { existsSync, readFileSync, writeFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; -import Ajv from "ajv"; -import { parse } from "yaml"; -import { imageSize } from "../lib/render/image.ts"; -const root = fileURLToPath(new URL("../.oic/", import.meta.url)); -const schemaPath = process.env.OIC_SCHEMA ?? fileURLToPath(new URL("../../open-industrial-collective/website/src/project-v2.schema.json", import.meta.url)); -const problems: string[] = []; +const repo = fileURLToPath(new URL("..", import.meta.url)); +const run = (cmd: string, args: string[], cwd: string) => execFileSync(cmd, args, { cwd, stdio: ["ignore", "ignore", "inherit"] }); -const profile = parse(readFileSync(`${root}project.yaml`, "utf8")) as { description?: { file?: string }; branding?: { logo?: Record }; media?: { src?: string }[] }; - -if (existsSync(schemaPath)) { - const ajv = new Ajv({ allErrors: true, strict: false }); - ajv.addFormat("https-url", /^https:\/\/[^\s/@:]+(?::[0-9]+)?(?:[/?#][^\s]*)?$/); - const validate = ajv.compile(JSON.parse(readFileSync(schemaPath, "utf8"))); - if (!validate(profile)) for (const e of validate.errors ?? []) problems.push(`profile ${e.instancePath || "/"} ${e.message}`); -} else { - console.warn(`! Schema not found at ${schemaPath}; set OIC_SCHEMA to validate the profile.`); -} - -const overview = profile.description?.file; -if (overview && statSync(`${root}${overview}`).size > 20 * 1024) problems.push(`${overview} is over 20 KB`); - -const images = [profile.branding?.logo?.on_light, profile.branding?.logo?.on_dark, ...(profile.media ?? []).map((m) => m.src)].filter(Boolean) as string[]; -for (const src of new Set(images)) { - const path = `${root}${src}`; - if (!existsSync(path)) { - problems.push(`${src} is missing`); - continue; +let website = process.env.OIC_WEBSITE; +if (!website) { + website = fileURLToPath(new URL("../node_modules/.cache/oic-website", import.meta.url)); + if (!existsSync(`${website}/.git`)) run("git", ["clone", "-q", "--depth", "1", "https://github.com/open-industrial-collective/website.git", website], repo); + else { + run("git", ["fetch", "-q", "--depth", "1", "origin", "main"], website); + run("git", ["reset", "-q", "--hard", "FETCH_HEAD"], website); + } + // Install the importer's dependencies only when its lockfile changes. + const lock = createHash("sha256").update(readFileSync(`${website}/package-lock.json`)).digest("hex"); + const stamp = `${website}/node_modules/.lock-hash`; + if (!existsSync(stamp) || readFileSync(stamp, "utf8") !== lock) { + run("npm", ["ci", "--no-audit", "--no-fund", "--ignore-scripts"], website); + writeFileSync(stamp, lock); } - const bytes = new Uint8Array(readFileSync(path)); - const size = imageSize(bytes); - if (bytes.length > 2 * 1024 * 1024) problems.push(`${src} is over 2 MB`); - if (!size) problems.push(`${src} isn't a PNG, JPEG or WebP`); - else if (size.width * size.height > 12_000_000) problems.push(`${src} is over 12 MP (${size.width}×${size.height})`); } -if ((profile.media ?? []).length > 8) problems.push("more than 8 media items"); -if (problems.length) { - console.error(`✗ OIC listing problems:\n${problems.map((p) => ` - ${p}`).join("\n")}`); +if (!existsSync(`${website}/scripts/check-profile.ts`)) { + console.error(`✗ ${website} has no profile check (scripts/check-profile.ts). Update that checkout, or point OIC_WEBSITE at one that has it.`); process.exit(1); } -console.log(`✓ OIC profile valid; ${new Set(images).size} images within limits.`); +const r = spawnSync("npm", ["run", "-s", "profile:check", "--", repo, ...process.argv.slice(2)], { cwd: website, stdio: "inherit" }); +process.exit(r.status ?? 1); From 1902de26fa3d406189ddbf932da3bbea909a4b1e Mon Sep 17 00:00:00 2001 From: Brian McClain <10232151+b-mac-gs@users.noreply.github.com> Date: Wed, 30 Sep 2026 08:04:29 -0400 Subject: [PATCH 2/2] Use the shared Grindstone workflows for CI and Pages Same steps as before, from Grindstone-Systems/.github. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 44 ++++++++++-------------------- .github/workflows/deploy-pages.yml | 32 ++++------------------ 2 files changed, 19 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16ec5c7..1b5b8e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,37 +7,21 @@ permissions: contents: read jobs: check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile - - run: pnpm typecheck - - run: pnpm test - - run: pnpm build - - run: pnpm build:cli + uses: Grindstone-Systems/.github/.github/workflows/check.yml@main + with: + run: | + pnpm typecheck + pnpm test + pnpm build + pnpm build:cli privacy: # Plan acceptance: nothing leaves the origin, and processing and exports work offline. - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile - - run: pnpm build - - run: pnpm privacy:check - env: - CHROME_PATH: /usr/bin/google-chrome + uses: Grindstone-Systems/.github/.github/workflows/check.yml@main + with: + chrome: true + run: | + pnpm build + pnpm privacy:check oic-profile: # The listing, checked with OIC's own importer and Charter preflight. - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: open-industrial-collective/website/profile-check@main + uses: Grindstone-Systems/.github/.github/workflows/oic-profile.yml@main diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index ac97e4a..c0d85ef 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -13,30 +13,8 @@ concurrency: group: pages cancel-in-progress: true jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile - - run: pnpm test - # Served from https://.github.io// unless a custom domain is set. - - run: pnpm build - env: - BASE: ${{ vars.PAGES_BASE || format('/{0}/', github.event.repository.name) }} - - uses: actions/upload-pages-artifact@v3 - with: - path: dist - deploy: - needs: build - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - id: deployment - uses: actions/deploy-pages@v4 + pages: + uses: Grindstone-Systems/.github/.github/workflows/pages.yml@main + with: + test: pnpm test + build: pnpm build