From e937b00dc55d04ad11a7e31c77bff324ce05f313 Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:13:17 +1100 Subject: [PATCH 01/37] Fix Forge CLI output and direct GUI launch --- src/cli.js | 44 ++++++++++++++++++++++---------------------- test/gui-cli.test.js | 30 +++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 23 deletions(-) diff --git a/src/cli.js b/src/cli.js index 61ca68e3..488dbb78 100644 --- a/src/cli.js +++ b/src/cli.js @@ -1037,7 +1037,7 @@ function verifyHook(positionals, flags, projectRoot, io, env = process.env) { ...(timestamped ? { timestamp: new Date(timestampMs).toISOString(), toleranceSeconds } : {}), }; if (flags.json) writeJson(io, result); - else io.stdout.write(`${valid ? 'VALID' : 'INVALID'} webhook signature (${result.algorithm}; ${reason})\\n`); + else io.stdout.write(`${valid ? 'VALID' : 'INVALID'} webhook signature (${result.algorithm}; ${reason})\n`); return valid ? 0 : 1; } @@ -1487,13 +1487,13 @@ export async function main(argv = process.argv.slice(2), overrides = {}) { const result = createTaskRecommendations(projectRoot); if (flags.json) writeJson(io, result); else { - io.stdout.write('FORGE next-step recommendations · ' + result.total + ' item(s)\\n'); + io.stdout.write('FORGE next-step recommendations · ' + result.total + ' item(s)\n'); for (const item of result.recommendations) { - io.stdout.write(' ' + item.priority.toUpperCase().padEnd(8) + item.title + '\\n'); - io.stdout.write(' ' + item.reason + '\\n'); - io.stdout.write(' ' + item.actionLabel + ' → ' + item.route + '\\n'); + io.stdout.write(' ' + item.priority.toUpperCase().padEnd(8) + item.title + '\n'); + io.stdout.write(' ' + item.reason + '\n'); + io.stdout.write(' ' + item.actionLabel + ' → ' + item.route + '\n'); } - io.stdout.write(' Recommendations are advisory; no action was executed.\\n'); + io.stdout.write(' Recommendations are advisory; no action was executed.\n'); } return 0; } @@ -1960,16 +1960,16 @@ export async function main(argv = process.argv.slice(2), overrides = {}) { if (positionals.length) throw new Error('usage: forge engine candidates'); const candidates = listReleaseCandidates(projectRoot, 20); if (flags.json) writeJson(io, { candidates }); - else if (!candidates.length) io.stdout.write('No local release candidates have been built.\\n'); + else if (!candidates.length) io.stdout.write('No local release candidates have been built.\n'); else { - io.stdout.write('FORGE local release candidates\\n'); + io.stdout.write('FORGE local release candidates\n'); for (const candidate of candidates) { io.stdout.write(' ' + candidate.package.version + ' ' + candidate.candidateId + ' ' - + candidate.generatedAt + '\\n'); + + candidate.generatedAt + '\n'); for (const artifact of candidate.artifacts) { - io.stdout.write(' ' + artifact.name + ' SHA-256 ' + artifact.sha256 + '\\n'); + io.stdout.write(' ' + artifact.name + ' SHA-256 ' + artifact.sha256 + '\n'); } - io.stdout.write(' Signed: no · Published: no · ' + candidate.outputDirectory + '\\n'); + io.stdout.write(' Signed: no · Published: no · ' + candidate.outputDirectory + '\n'); } } return 0; @@ -1980,11 +1980,11 @@ export async function main(argv = process.argv.slice(2), overrides = {}) { const plan = createReleaseCandidatePlan(projectRoot); if (flags.json) writeJson(io, plan); else { - io.stdout.write('FORGE release candidate · ' + (plan.ready ? 'READY TO BUILD' : 'BLOCKED') + '\\n'); + io.stdout.write('FORGE release candidate · ' + (plan.ready ? 'READY TO BUILD' : 'BLOCKED') + '\n'); for (const check of plan.checks) { - io.stdout.write(' ' + check.status.toUpperCase().padEnd(8) + check.label + ' — ' + check.detail + '\\n'); + io.stdout.write(' ' + check.status.toUpperCase().padEnd(8) + check.label + ' — ' + check.detail + '\n'); } - io.stdout.write('No artifacts were built. Review the checks, then pass --confirm.\\n'); + io.stdout.write('No artifacts were built. Review the checks, then pass --confirm.\n'); } return plan.ready ? 2 : 1; } @@ -1994,14 +1994,14 @@ export async function main(argv = process.argv.slice(2), overrides = {}) { }); if (flags.json) writeJson(io, result); else { - io.stdout.write('FORGE release candidate built · ' + result.package.version + '\\n'); - io.stdout.write(' Source commit: ' + result.source.commit + '\\n'); - io.stdout.write(' Output: ' + result.outputDirectory + '\\n'); + io.stdout.write('FORGE release candidate built · ' + result.package.version + '\n'); + io.stdout.write(' Source commit: ' + result.source.commit + '\n'); + io.stdout.write(' Output: ' + result.outputDirectory + '\n'); for (const artifact of result.artifacts) { - io.stdout.write(' ' + artifact.format + ' ' + artifact.name + ' SHA-256 ' + artifact.sha256 + '\\n'); + io.stdout.write(' ' + artifact.format + ' ' + artifact.name + ' SHA-256 ' + artifact.sha256 + '\n'); } - io.stdout.write(' Signed: no · Published: no\\n'); - io.stdout.write(' The signed release and APT Pages gates remain protected and separate.\\n'); + io.stdout.write(' Signed: no · Published: no\n'); + io.stdout.write(' The signed release and APT Pages gates remain protected and separate.\n'); } return 0; } @@ -2088,7 +2088,7 @@ export async function main(argv = process.argv.slice(2), overrides = {}) { } if (command === 'inspect') return runInspect(projectRoot, flags, io); if (command === 'gui') { - await startGui({ projectRoot, port: flags.port, stdout: io.stdout }); + await (overrides.startGui || startGui)({ projectRoot, port: flags.port, stdout: io.stdout }); return 0; } if (command === 'trace') { @@ -2105,7 +2105,7 @@ export async function main(argv = process.argv.slice(2), overrides = {}) { } const result = { command: 'trace prune', ...pruneEvidence(projectRoot, keep) }; if (flags.json) writeJson(io, result); - else io.stdout.write(`Pruned ${result.removed} event(s); retained ${result.retained} of ${result.total}.\\n`); + else io.stdout.write(`Pruned ${result.removed} event(s); retained ${result.retained} of ${result.total}.\n`); return 0; } throw new Error('usage: forge trace '); diff --git a/test/gui-cli.test.js b/test/gui-cli.test.js index ba0e1ac8..70b8332f 100644 --- a/test/gui-cli.test.js +++ b/test/gui-cli.test.js @@ -3,7 +3,8 @@ import assert from 'node:assert/strict'; import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { createGuiServer } from '../src/gui.js'; +import { main } from '../src/cli.js'; +import { createGuiServer, startGui } from '../src/gui.js'; function fixture() { const root = mkdtempSync(path.join(os.tmpdir(), 'forge-gui-cli-')); @@ -111,3 +112,30 @@ test('GUI CLI runner exposes only allowlisted native commands and no shell input f.cleanup(); } }); + + +test('forge gui starts the Control Center directly without npm start', async () => { + const f = fixture(); + let started; + const output = { value: '' }; + try { + const code = await main(['gui', '--port', '0'], { + cwd: f.root, + stdout: { write: (chunk) => { output.value += String(chunk); } }, + stderr: { write: () => {} }, + startGui: async (options) => { + started = await startGui(options); + return started; + }, + }); + assert.equal(code, 0); + assert.ok(started && started.port > 0); + assert.match(output.value, /FORGE Control Center: http:\/\/127\.0\.0\.1:/); + const response = await fetch(started.url); + assert.equal(response.status, 200); + assert.match(await response.text(), /FORGE/i); + } finally { + if (started?.server?.listening) await new Promise((resolve) => started.server.close(resolve)); + f.cleanup(); + } +}); From 92cd46892a19647fa3e0520e896d6ecf274efdfb Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:13:42 +1100 Subject: [PATCH 02/37] Secure privileged Pages deployment trust boundary --- .github/workflows/deploy-pages.yml | 33 ++++++++++++++++++++++-------- test/deploy-pages-workflow.test.js | 22 ++++++++++++++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 test/deploy-pages-workflow.test.js diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index 0349d833..8ae9f580 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -27,16 +27,13 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} env: FORGE_RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || '' }} + FORGE_RELEASE_SOURCE_SHA: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || '' }} FORGE_RELEASE_SIGNING_PUBLIC_KEY: ${{ vars.FORGE_RELEASE_SIGNING_PUBLIC_KEY }} FORGE_RELEASE_SIGNING_FINGERPRINT: ${{ vars.FORGE_RELEASE_SIGNING_FINGERPRINT }} - FORGE_APT_SIGNING_PRIVATE_KEY: ${{ secrets.FORGE_APT_SIGNING_PRIVATE_KEY }} - FORGE_APT_SIGNING_PASSPHRASE: ${{ secrets.FORGE_APT_SIGNING_PASSPHRASE }} - FORGE_APT_SIGNING_KEY_ID: ${{ vars.FORGE_APT_SIGNING_KEY_ID }} - FORGE_APT_KEY_FINGERPRINT: ${{ vars.FORGE_APT_KEY_FINGERPRINT }} steps: - uses: actions/checkout@v7.0.1 with: - ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || inputs.release_tag }} + ref: main fetch-depth: 0 - uses: actions/setup-node@v7.1.0 with: @@ -48,10 +45,15 @@ jobs: set -euo pipefail git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main git fetch --tags origin - if [[ -z "$FORGE_RELEASE_TAG" ]]; then - mapfile -t release_tags < <(git tag --points-at HEAD --list 'v*') + if [[ -n "$FORGE_RELEASE_SOURCE_SHA" ]]; then + [[ "$FORGE_RELEASE_SOURCE_SHA" =~ ^[a-f0-9]{40}$ ]] || { + echo "::error::The completed release workflow supplied an invalid source commit." >&2 + exit 1 + } + source_commit="$(git rev-parse --verify "${FORGE_RELEASE_SOURCE_SHA}^{commit}")" + mapfile -t release_tags < <(git tag --points-at "$source_commit" --list 'v*') if (( ${#release_tags[@]} != 1 )); then - echo "::error::Could not identify exactly one version tag for the release commit." >&2 + echo "::error::The release source commit must have exactly one version tag." >&2 exit 1 fi FORGE_RELEASE_TAG="${release_tags[0]}" @@ -61,12 +63,20 @@ jobs: echo "::error::APT deployment requires an exact semantic-version release tag." >&2 exit 1 } + release_commit="$(git rev-parse --verify "refs/tags/$FORGE_RELEASE_TAG^{commit}")" + if [[ -n "$FORGE_RELEASE_SOURCE_SHA" && "$release_commit" != "$FORGE_RELEASE_SOURCE_SHA" ]]; then + echo "::error::The published version tag does not identify the completed release workflow commit." >&2 + exit 1 + fi + git merge-base --is-ancestor "$release_commit" refs/remotes/origin/main || { + echo "::error::The release commit is not an ancestor of trusted main." >&2 + exit 1 + } test -n "$FORGE_RELEASE_SIGNING_PUBLIC_KEY" test -n "$FORGE_RELEASE_SIGNING_FINGERPRINT" export GNUPGHOME="$RUNNER_TEMP/forge-release-gnupg" install -d -m 700 "$GNUPGHOME" printf '%s' "$FORGE_RELEASE_SIGNING_PUBLIC_KEY" | gpg --batch --import - test "$(git rev-parse --verify "refs/tags/$FORGE_RELEASE_TAG^{commit}")" = "$(git rev-parse --verify HEAD)" node scripts/verify-release-tag.js "$FORGE_RELEASE_TAG" - name: Install Debian repository tooling run: | @@ -110,6 +120,11 @@ jobs: test "$(dpkg-deb -f "$deb" Architecture)" = "all" dpkg-deb -f "$deb" Depends | grep -F 'nodejs (>= 22.14.0)' - name: Build and sign the public APT repository + env: + FORGE_APT_SIGNING_PRIVATE_KEY: ${{ secrets.FORGE_APT_SIGNING_PRIVATE_KEY }} + FORGE_APT_SIGNING_PASSPHRASE: ${{ secrets.FORGE_APT_SIGNING_PASSPHRASE }} + FORGE_APT_SIGNING_KEY_ID: ${{ vars.FORGE_APT_SIGNING_KEY_ID }} + FORGE_APT_KEY_FINGERPRINT: ${{ vars.FORGE_APT_KEY_FINGERPRINT }} shell: bash run: | set -euo pipefail diff --git a/test/deploy-pages-workflow.test.js b/test/deploy-pages-workflow.test.js new file mode 100644 index 00000000..e070f3a2 --- /dev/null +++ b/test/deploy-pages-workflow.test.js @@ -0,0 +1,22 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); +const workflow = readFileSync(path.join(root, '.github/workflows/deploy-pages.yml'), 'utf8'); + +test('privileged Pages deployment executes trusted main-branch workflow code', () => { + assert.match(workflow, /actions\/checkout@[^\n]+\n\s+with:\n\s+ref: main/); + assert.doesNotMatch(workflow, /ref:\s*\$\{\{\s*github\.event\.workflow_run\.head_sha/); + assert.match(workflow, /FORGE_RELEASE_SOURCE_SHA: \$\{\{ github\.event_name == 'workflow_run' && github\.event\.workflow_run\.head_sha/); + assert.match(workflow, /git merge-base --is-ancestor "\$release_commit" refs\/remotes\/origin\/main/); +}); + +test('APT private signing credentials are scoped to the archive signing step', () => { + const deployEnvironment = workflow.match(/jobs:\s*\ndeploy:[\s\S]*?\n steps:/)?.[0] || ''; + assert.doesNotMatch(deployEnvironment, /FORGE_APT_SIGNING_PRIVATE_KEY:\s*\$\{\{\s*secrets\./); + assert.doesNotMatch(deployEnvironment, /FORGE_APT_SIGNING_PASSPHRASE:\s*\$\{\{\s*secrets\./); + assert.match(workflow, /- name: Build and sign the public APT repository\n env:\n FORGE_APT_SIGNING_PRIVATE_KEY:/); +}); From 009614d697f66a37d9317b87ff4fcf01b47e7e7f Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:14:13 +1100 Subject: [PATCH 03/37] Align FORGE APT installers on pinned binary keyrings --- .github/workflows/deploy-pages.yml | 7 ++++--- Website/apt/key-info.json | 2 +- docs/APT_ACTIVATION.md | 2 +- installers/apt.sh | 1 + scripts/install-apt.sh | 9 ++++----- src/apt-status.js | 4 +++- test/apt-status.test.js | 3 +++ 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index 8ae9f580..db4a6d08 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -140,11 +140,12 @@ jobs: [[ "$actual" == "$expected" ]] || { echo "::error::APT secret does not match the pinned archive fingerprint." >&2; exit 1; } bash scripts/build-apt-repo.sh "$RUNNER_TEMP/forge-release-assets" "$GITHUB_WORKSPACE/Website/apt" gpg --batch --armor --export "$FORGE_APT_SIGNING_KEY_ID" > "$GITHUB_WORKSPACE/Website/apt/forge-archive-keyring.asc" - exported="$(gpg --batch --show-keys --with-colons "$GITHUB_WORKSPACE/Website/apt/forge-archive-keyring.asc" | awk -F: '$1 == "fpr" { print toupper($10); exit }')" + gpg --batch --export "$FORGE_APT_SIGNING_KEY_ID" > "$GITHUB_WORKSPACE/Website/apt/forge-archive-keyring.gpg" + exported="$(gpg --batch --show-keys --with-colons "$GITHUB_WORKSPACE/Website/apt/forge-archive-keyring.gpg" | awk -F: '$1 == "fpr" { print toupper($10); exit }')" [[ "$exported" == "$expected" ]] || { echo "::error::Exported APT archive key fingerprint mismatch." >&2; exit 1; } gpg --batch --verify "$GITHUB_WORKSPACE/Website/apt/dists/stable/Release.gpg" "$GITHUB_WORKSPACE/Website/apt/dists/stable/Release" gpg --batch --verify "$GITHUB_WORKSPACE/Website/apt/dists/stable/InRelease" - key_sha256="$(sha256sum "$GITHUB_WORKSPACE/Website/apt/forge-archive-keyring.asc" | awk '{print $1}')" + key_sha256="$(sha256sum "$GITHUB_WORKSPACE/Website/apt/forge-archive-keyring.gpg" | awk '{print $1}')" node - "$FORGE_RELEASE_TAG" "$key_sha256" "$expected" <<'NODE' const fs = require('node:fs'); const [versionTag, keySha256, keyFingerprint] = process.argv.slice(2); @@ -153,7 +154,7 @@ jobs: status: 'active', releaseTag: versionTag, repository: 'https://netcore-technologies.github.io/FORGE/apt', - keyUrl: 'https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.asc', + keyUrl: 'https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.gpg', keySha256, keyFingerprint, suite: 'stable', diff --git a/Website/apt/key-info.json b/Website/apt/key-info.json index a4a147f4..f8bdd0f1 100644 --- a/Website/apt/key-info.json +++ b/Website/apt/key-info.json @@ -3,5 +3,5 @@ "status": "not-yet-published", "message": "The public APT archive is not active until a signed release and APT deployment pass all release gates.", "repository": "https://netcore-technologies.github.io/FORGE/apt", - "keyUrl": "https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.asc" + "keyUrl": "https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.gpg" } diff --git a/docs/APT_ACTIVATION.md b/docs/APT_ACTIVATION.md index ec86bab7..0b929c83 100644 --- a/docs/APT_ACTIVATION.md +++ b/docs/APT_ACTIVATION.md @@ -73,7 +73,7 @@ After the Deploy website and signed APT repository workflow completes successful curl -fsSL https://netcore-technologies.github.io/FORGE/apt/key-info.json ~~~ -Proceed only when the returned metadata has status active, a release tag, a 64-character key SHA-256 and the expected full key fingerprint. The installer independently verifies the downloaded public key against both pins before it writes the APT source. +Proceed only when the returned metadata has status active, a release tag, a 64-character key SHA-256 and the expected full key fingerprint. The installer independently verifies the downloaded binary keyring against both pins before it writes the APT source. ~~~bash sudo apt update diff --git a/installers/apt.sh b/installers/apt.sh index a0e30178..f1cd99e1 100644 --- a/installers/apt.sh +++ b/installers/apt.sh @@ -28,6 +28,7 @@ if (metadata.status !== 'active') { if (!/^[a-f0-9]{64}$/i.test(metadata.keySha256 || '')) throw new Error('APT key SHA-256 pin is missing or invalid.'); if (!/^[a-f0-9]{40,64}$/i.test(metadata.keyFingerprint || '')) throw new Error('APT key fingerprint is missing or invalid.'); if (metadata.suite !== 'stable' || metadata.component !== 'main') throw new Error('Unexpected APT repository suite or component.'); +if (metadata.keyUrl !== 'https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.gpg') throw new Error('Unexpected APT keyring URL.'); console.log(metadata.keySha256); console.log(metadata.keyFingerprint); NODE diff --git a/scripts/install-apt.sh b/scripts/install-apt.sh index d6af78c9..2b60ea81 100644 --- a/scripts/install-apt.sh +++ b/scripts/install-apt.sh @@ -3,7 +3,7 @@ set -Eeuo pipefail readonly DEFAULT_REPOSITORY="https://netcore-technologies.github.io/FORGE/apt" REPOSITORY="${FORGE_APT_BASE_URL:-$DEFAULT_REPOSITORY}" -KEY_URL="${FORGE_APT_KEY_URL:-https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.asc}" +KEY_URL="${FORGE_APT_KEY_URL:-https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.gpg}" EXPECTED_SHA256="${FORGE_APT_KEY_SHA256:-}" EXPECTED_FINGERPRINT="${FORGE_APT_KEY_FINGERPRINT:-}" @@ -31,19 +31,18 @@ ARCH="$(dpkg --print-architecture)" WORK_DIR="$(mktemp -d "${TMPDIR:-/tmp}/forge-apt.XXXXXXXX")" trap 'rm -rf -- "$WORK_DIR"' EXIT INT TERM curl --fail --silent --show-error --location --max-redirs 3 --proto '=https' --tlsv1.2 \ - "$KEY_URL" --output "$WORK_DIR/forge-archive-keyring.asc" + "$KEY_URL" --output "$WORK_DIR/forge-archive-keyring.gpg" -ACTUAL_SHA256="$(sha256sum "$WORK_DIR/forge-archive-keyring.asc" | awk '{print $1}')" +ACTUAL_SHA256="$(sha256sum "$WORK_DIR/forge-archive-keyring.gpg" | awk '{print $1}')" [[ "${ACTUAL_SHA256,,}" == "${EXPECTED_SHA256,,}" ]] || { echo "APT archive key checksum does not match the expected pin." >&2; exit 1; } -ACTUAL_FINGERPRINT="$(gpg --batch --show-keys --with-colons "$WORK_DIR/forge-archive-keyring.asc" \ +ACTUAL_FINGERPRINT="$(gpg --batch --show-keys --with-colons "$WORK_DIR/forge-archive-keyring.gpg" \ | awk -F: '$1 == "fpr" { print toupper($10); exit }')" [[ "$ACTUAL_FINGERPRINT" == "${EXPECTED_FINGERPRINT^^}" ]] || { echo "APT archive key fingerprint does not match the expected pin." >&2; exit 1; } -gpg --batch --yes --dearmor --output "$WORK_DIR/forge-archive-keyring.gpg" "$WORK_DIR/forge-archive-keyring.asc" install -o root -g root -m 0644 "$WORK_DIR/forge-archive-keyring.gpg" /usr/share/keyrings/forge-archive-keyring.gpg printf 'deb [arch=%s signed-by=/usr/share/keyrings/forge-archive-keyring.gpg] %s stable main\n' \ "$ARCH" "$REPOSITORY" > /etc/apt/sources.list.d/forge.list diff --git a/src/apt-status.js b/src/apt-status.js index 2adb7dcc..18ddb6a8 100644 --- a/src/apt-status.js +++ b/src/apt-status.js @@ -1,6 +1,7 @@ import { Buffer } from 'node:buffer'; export const APT_KEY_INFO_URL = 'https://netcore-technologies.github.io/FORGE/apt/key-info.json'; +export const APT_KEYRING_URL = 'https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.gpg'; const FINGERPRINT = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i; const SHA256 = /^[a-f0-9]{64}$/i; const MAX_BYTES = 64 * 1024; @@ -14,7 +15,8 @@ export function evaluateAptKeyMetadata(metadata, { expectedState = 'active' } = } if (metadata.status === 'active') { const valid = SHA256.test(metadata.keySha256 || '') - && FINGERPRINT.test(metadata.keyFingerprint || ''); + && FINGERPRINT.test(metadata.keyFingerprint || '') + && metadata.keyUrl === APT_KEYRING_URL; if (!valid) { return { ok: false, state: 'invalid', url: APT_KEY_INFO_URL, detail: 'Active APT metadata must publish a valid SHA-256 key pin and full fingerprint.', metadata }; } diff --git a/test/apt-status.test.js b/test/apt-status.test.js index 5aa20860..936ec316 100644 --- a/test/apt-status.test.js +++ b/test/apt-status.test.js @@ -4,18 +4,21 @@ import { APT_KEY_INFO_URL, checkAptRepositoryStatus, evaluateAptKeyMetadata, + APT_KEYRING_URL, } from '../src/apt-status.js'; const active = { status: 'active', keySha256: 'a'.repeat(64), keyFingerprint: 'b'.repeat(40), + keyUrl: APT_KEYRING_URL, }; test('APT key metadata requires a valid full fingerprint and SHA-256 pin before active status passes', () => { assert.equal(evaluateAptKeyMetadata(active).ok, true); assert.equal(evaluateAptKeyMetadata({ ...active, keySha256: 'bad' }).state, 'invalid'); assert.equal(evaluateAptKeyMetadata({ ...active, keyFingerprint: 'bad' }).state, 'invalid'); + assert.equal(evaluateAptKeyMetadata({ ...active, keyUrl: 'https://example.invalid/key.asc' }).state, 'invalid'); }); test('APT active metadata fails when the smoke plan expects the distribution to remain disabled', () => { From eefd30f42e65dc14c9691f9d57363c03869a311d Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:15:12 +1100 Subject: [PATCH 04/37] Add live FORGE release downloads and APT install guide --- Website/downloads.html | 43 ++++++++++++ Website/downloads.js | 125 +++++++++++++++++++++++++++++++++ Website/install.html | 6 ++ Website/styles.css | 20 ++++++ scripts/check-website.js | 20 +++++- test/website-downloads.test.js | 25 +++++++ 6 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 Website/downloads.html create mode 100644 Website/downloads.js create mode 100644 test/website-downloads.test.js diff --git a/Website/downloads.html b/Website/downloads.html new file mode 100644 index 00000000..dafb799f --- /dev/null +++ b/Website/downloads.html @@ -0,0 +1,43 @@ + + + + + + + +Downloads · FORGE + + + +
+
+
FORGE / RELEASE DOWNLOADS

Every release.
Every verified asset.

+

Browse actual files attached to official FORGE GitHub releases. The catalogue never invents desktop packages, checksums or versions.

+
LATEST RELEASECHECKING RELEASESSHA-256 / SIGNATURES
+
+
01 / RELEASE ASSETS

Choose your package.
Inspect what you install.

Linux, macOS and Windows packages, source archives, Debian packages, checksums, signatures and provenance appear only when actually published.

+
+
+

Loading official release assets…

+
02 / LINUX PACKAGE REPOSITORY

Signed APT.
Scoped trust.

The public archive stays fail-closed until its key, package indexes and signed Release metadata are deployed through the protected workflow.

+
RECOMMENDED / BOOTSTRAP

Install the verified repository helper

curl -fsSLo forge-apt.sh https://github.com/NetCore-Technologies/FORGE/releases/latest/download/forge-apt.sh
+less forge-apt.sh
+bash forge-apt.sh
+
MANUAL / BINARY KEYRING

Use the scoped signed-by key

Run only after APT metadata reports an active archive and its fingerprint has been checked independently.

curl -fsSLo /tmp/forge-archive-keyring.gpg https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.gpg
+gpg --show-keys --with-fingerprint /tmp/forge-archive-keyring.gpg
+sudo install -Dm0644 /tmp/forge-archive-keyring.gpg /usr/share/keyrings/forge-archive-keyring.gpg
+echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/forge-archive-keyring.gpg] https://netcore-technologies.github.io/FORGE/apt stable main' | sudo tee /etc/apt/sources.list.d/forge.list
+sudo apt update
+sudo apt install forge
+

The Debian package requires Node.js 22.14.0 or later. Repository activation remains protected by release signing and publishing checks.

+
03 / VERIFY BEFORE INSTALL

Trust the bytes.
Then run FORGE.

Verify detached OpenPGP signatures and signed checksum manifests against the independently published release-signing fingerprint.

gpg --import forge-release-signing-public-key.asc
+gpg --fingerprint
+gpg --verify SHA256SUMS.asc SHA256SUMS
+sha256sum --check SHA256SUMS
+gpg --verify SHA256SUMS-extra.asc SHA256SUMS-extra
+sha256sum --check SHA256SUMS-extra
+
diff --git a/Website/downloads.js b/Website/downloads.js new file mode 100644 index 00000000..044ccb0d --- /dev/null +++ b/Website/downloads.js @@ -0,0 +1,125 @@ +(() => { + 'use strict'; + const endpoint = 'https://api.github.com/repos/NetCore-Technologies/FORGE/releases/latest'; + const el = { + version: document.getElementById('downloads-version'), date: document.getElementById('downloads-date'), + status: document.getElementById('downloads-status'), count: document.getElementById('downloads-count'), + assets: document.getElementById('downloads-assets'), filter: document.getElementById('downloads-filter'), + search: document.getElementById('downloads-search'), refresh: document.getElementById('downloads-refresh'), + }; + let assets = []; + let digests = new Map(); + const classify = (name) => { + if (/SHA256SUMS|\.(asc|sig|spdx\.json|intoto\.json)$/i.test(name) || /provenance|attestation|sbom/i.test(name)) return 'Integrity'; + if (/windows|win32|\.exe$|\.msi$|\.ps1$|\.bat$/i.test(name)) return 'Windows'; + if (/macos|darwin|\.dmg$|\.pkg$/i.test(name)) return 'macOS'; + if (/linux|\.deb$|\.appimage$/i.test(name) || /forge-(install-apt|apt)\.sh$/i.test(name)) return 'Linux'; + if (/\.tgz$|\.tar\.gz$|\.zip$/i.test(name)) return 'Portable'; + return 'Other'; + }; + const sizeText = (size) => { + if (!Number.isFinite(size) || size < 0) return 'Size unavailable'; + if (!size) return '0 bytes'; + const unit = Math.min(Math.floor(Math.log(size) / Math.log(1024)), 3); + return (size / (1024 ** unit)).toFixed(unit ? 1 : 0) + ' ' + ['B','KB','MB','GB'][unit]; + }; + const node = (tag, cls, value) => { + const item = document.createElement(tag); + if (cls) item.className = cls; + item.textContent = value; + return item; + }; + const readManifests = async (items) => { + await Promise.all(items.filter((asset) => /^SHA256SUMS(?:-extra)?$/.test(asset.name)).map(async (asset) => { + try { + const response = await fetch(asset.browser_download_url, { cache: 'no-store' }); + if (!response.ok) return; + for (const line of (await response.text()).split(/\r?\n/)) { + const match = line.match(/^([a-f0-9]{64})\s+\*?(.+?)\s*$/i); + if (match) digests.set(match[2], match[1].toLowerCase()); + } + } catch { /* Fall back to GitHub's per-asset digest. */ } + })); + }; + const cardFor = (asset) => { + const category = classify(asset.name); + const card = node('article', 'download-card', ''); + card.dataset.category = category; + const header = document.createElement('div'); + header.className = 'download-card__header'; + header.append(node('span', 'tag', category), node('span', 'download-card__size', sizeText(asset.size))); + const updated = asset.updated_at ? new Date(asset.updated_at) : null; + const meta = node('p', 'download-card__meta', + updated && !Number.isNaN(updated.valueOf()) ? 'Updated ' + updated.toLocaleString() : 'Official release asset'); + const digestFromApi = typeof asset.digest === 'string' && /^sha256:[a-f0-9]{64}$/i.test(asset.digest) + ? asset.digest.slice(7).toLowerCase() : null; + const digest = digestFromApi || digests.get(asset.name); + const digestRow = document.createElement('div'); + digestRow.className = 'download-card__digest'; + digestRow.append(node('code', '', digest ? 'SHA-256 ' + digest : 'Digest unavailable')); + if (digest) { + const copy = node('button', 'download-copy', 'Copy digest'); + copy.type = 'button'; + copy.addEventListener('click', async () => { + try { await navigator.clipboard.writeText(digest); copy.textContent = 'Copied'; } + catch { copy.textContent = 'Copy unavailable'; } + }); + digestRow.append(copy); + } + const link = node('a', 'button primary download-card__link', 'Download asset ↗'); + link.href = asset.browser_download_url; + link.target = '_blank'; + link.rel = 'noopener noreferrer'; + card.append(header, node('h3', 'download-card__name', asset.name), meta, digestRow, link); + return card; + }; + const render = () => { + const filter = el.filter.value; + const query = el.search.value.trim().toLowerCase(); + const matches = assets.filter((asset) => + (filter === 'all' || classify(asset.name) === filter) && (!query || asset.name.toLowerCase().includes(query))); + el.assets.replaceChildren(); + if (!matches.length) el.assets.append(node('p', 'download-empty', + assets.length ? 'No published assets match this filter.' : 'No downloadable assets are attached to this release.')); + else for (const asset of matches) el.assets.append(cardFor(asset)); + el.count.textContent = 'Showing ' + matches.length + ' of ' + assets.length + ' published assets.'; + }; + const load = async () => { + el.refresh.disabled = true; + el.status.textContent = 'Checking the official GitHub Releases API…'; + try { + const response = await fetch(endpoint, { headers: { Accept: 'application/vnd.github+json' }, cache: 'no-store' }); + if (response.status === 404) { + el.version.textContent = 'NO PUBLISHED RELEASE'; + el.date.textContent = 'SOURCE INSTALL AVAILABLE'; + el.status.textContent = 'No release has been published yet. This catalogue will populate when one is available.'; + assets = []; + render(); + return; + } + if (!response.ok) throw new Error('GitHub returned HTTP ' + response.status + '.'); + const release = await response.json(); + assets = Array.isArray(release.assets) ? release.assets : []; + digests = new Map(); + await readManifests(assets); + el.version.textContent = release.tag_name || release.name || 'LATEST RELEASE'; + const published = release.published_at ? new Date(release.published_at) : null; + el.date.textContent = published && !Number.isNaN(published.valueOf()) + ? 'PUBLISHED ' + published.toLocaleDateString() : 'PUBLISHED RELEASE'; + el.status.textContent = (release.name || release.tag_name || 'Latest release') + ' · ' + + assets.length + ' actual asset(s) · ' + (release.prerelease ? 'pre-release' : 'release'); + render(); + } catch (error) { + el.status.textContent = 'Could not load releases: ' + (error instanceof Error ? error.message : 'Unknown error') + + ' Open the official GitHub Releases page to inspect downloads.'; + el.assets.replaceChildren(); + const link = node('a', 'text-link', 'Open FORGE releases ↗'); + link.href = 'https://github.com/NetCore-Technologies/FORGE/releases'; + el.assets.append(link); + } finally { el.refresh.disabled = false; } + }; + el.filter.addEventListener('change', render); + el.search.addEventListener('input', render); + el.refresh.addEventListener('click', load); + load(); +})(); diff --git a/Website/install.html b/Website/install.html index 119e18ec..50cbbace 100644 --- a/Website/install.html +++ b/Website/install.html @@ -69,6 +69,12 @@

One command.
Your environment.

gpg --verify forge_@@FORGE_RELEASE_VERSION@@_all.deb.asc forge_@@FORGE_RELEASE_VERSION@@_all.deb sudo apt install ./forge_@@FORGE_RELEASE_VERSION@@_all.deb +
MANUAL / BINARY KEYRING

Install with a scoped signing key

Use only after APT metadata reports an active archive and you have independently checked the full fingerprint.

curl -fsSLo /tmp/forge-archive-keyring.gpg https://netcore-technologies.github.io/FORGE/apt/forge-archive-keyring.gpg
+gpg --show-keys --with-fingerprint /tmp/forge-archive-keyring.gpg
+sudo install -Dm0644 /tmp/forge-archive-keyring.gpg /usr/share/keyrings/forge-archive-keyring.gpg
+echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/forge-archive-keyring.gpg] https://netcore-technologies.github.io/FORGE/apt stable main' | sudo tee /etc/apt/sources.list.d/forge.list
+sudo apt update
+sudo apt install forge

The public APT endpoint becomes installable only after the signed archive key, key fingerprint, key checksum and InRelease metadata are published. Never replace these pins with unverified values or use apt-key.

03 / macOS · APPLE SILICON + INTEL

One installer.
Both architectures.

FORGE is architecture-independent JavaScript. The POSIX installer supports Apple Silicon and Intel macOS with Git, npm and Node.js 22.14 or later.

No DMG is produced: FORGE is a terminal CLI and does not bundle a macOS application or Node runtime.

curl --fail --location --proto '=https' --tlsv1.2 \
diff --git a/Website/styles.css b/Website/styles.css
index 96acda1f..0f394ae5 100644
--- a/Website/styles.css
+++ b/Website/styles.css
@@ -211,3 +211,23 @@ main{animation:enter .7s ease both}
 .roadmap-cta{justify-content:center;margin:1.5rem 0 0}
 @media(max-width:920px){.roadmap-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}.roadmap-reset{width:100%}.roadmap-feature-list{grid-template-columns:1fr}}
 @media(max-width:600px){.roadmap-toolbar{grid-template-columns:minmax(0,1fr);padding:.9rem}.roadmap-domain-summary{align-items:flex-start;gap:.8rem;padding:1rem}.roadmap-domain-meter{grid-template-columns:1fr;gap:.35rem;min-width:110px;text-align:right}.roadmap-domain-meter progress{order:2}.roadmap-domain-progress{white-space:normal}.roadmap-domain-visible{display:none}.roadmap-feature-list{padding:0 .65rem .65rem}.roadmap-feature{grid-template-columns:4.2rem minmax(0,1fr);gap:.4rem}.roadmap-feature-status{grid-column:2}.roadmap-resultbar{align-items:flex-start;flex-direction:column;gap:.2rem}.roadmap-cta{flex-direction:column}}
+
+
+/* FORGE release downloads catalogue */
+.download-toolbar{display:flex;align-items:end;gap:14px;flex-wrap:wrap;margin:24px 0}
+.download-control{display:grid;gap:8px;min-width:210px;color:#9aa9aa;font-size:.82rem}
+.download-control input,.download-control select{width:100%;min-height:46px;padding:10px 13px;border:1px solid rgba(145,170,165,.22);border-radius:12px;background:rgba(255,255,255,.035);color:inherit;font:inherit}
+.download-control option{background:#101719;color:#fff}
+.download-status{padding:16px 18px;border:1px solid rgba(145,170,165,.22);border-radius:14px;color:#aebbbc;background:rgba(255,255,255,.025)}
+.download-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,310px),1fr));gap:15px;margin-top:18px}
+.download-card{display:flex;flex-direction:column;gap:12px;min-width:0;padding:20px;border:1px solid rgba(145,170,165,.22);border-radius:18px;background:rgba(255,255,255,.025)}
+.download-card__header{display:flex;justify-content:space-between;align-items:center;gap:12px}
+.download-card__size,.download-card__meta{color:#9aa9aa;font-size:.8rem}
+.download-card__name{margin:0;overflow-wrap:anywhere;font-size:1rem;line-height:1.45}
+.download-card__meta{margin:0}
+.download-card__digest{display:flex;align-items:start;gap:9px;justify-content:space-between;padding:10px;background:rgba(0,0,0,.16);border:1px solid rgba(145,170,165,.18);border-radius:10px}
+.download-card__digest code{min-width:0;overflow-wrap:anywhere;color:#aebbbc;font-size:.7rem;line-height:1.5}
+.download-copy{flex:0 0 auto;border:0;background:transparent;color:#8ee2c4;font:inherit;font-size:.75rem;cursor:pointer}
+.download-card__link{align-self:flex-start;margin-top:auto}
+.download-empty{grid-column:1/-1;padding:28px;border:1px dashed rgba(145,170,165,.3);border-radius:16px;color:#aebbbc;text-align:center}
+@media(max-width:640px){.download-toolbar{align-items:stretch}.download-control{width:100%;min-width:0}.download-card{padding:16px}}
diff --git a/scripts/check-website.js b/scripts/check-website.js
index 37a688e1..992291b8 100644
--- a/scripts/check-website.js
+++ b/scripts/check-website.js
@@ -2,7 +2,7 @@ import { existsSync, readFileSync, readdirSync } from 'node:fs';
 import path from 'node:path';
 
 const root = path.resolve('Website');
-const required = ['index', 'platform', 'cli', 'install', 'integrations', 'security', 'docs', 'roadmap', 'community'];
+const required = ['index', 'platform', 'cli', 'install', 'downloads', 'integrations', 'security', 'docs', 'roadmap', 'community'];
 const extra = ['404'];
 let failed = false;
 for (const page of required) {
@@ -46,6 +46,24 @@ if (htmlFiles.length !== required.length + extra.length) {
   failed = true;
 }
 
+const downloadsHtml = readFileSync(path.join(root, 'downloads.html'), 'utf8');
+for (const id of ['downloads-version', 'downloads-date', 'downloads-status', 'downloads-count', 'downloads-filter', 'downloads-search', 'downloads-refresh', 'downloads-assets']) {
+  if (!downloadsHtml.includes('id="' + id + '"')) {
+    process.stderr.write('Website/downloads.html is missing release catalogue control ' + id + '\\n');
+    failed = true;
+  }
+}
+if (!downloadsHtml.includes('src="downloads.js"')) {
+  process.stderr.write('Website/downloads.html does not load the release catalogue.\\n');
+  failed = true;
+}
+const downloadsScript = readFileSync(path.join(root, 'downloads.js'), 'utf8');
+if (!downloadsScript.includes('api.github.com/repos/NetCore-Technologies/FORGE/releases/latest')
+  || !downloadsScript.includes('browser_download_url')) {
+  process.stderr.write('Website/downloads.js must load actual GitHub release assets.\\n');
+  failed = true;
+}
+
 const roadmapHtml = readFileSync(path.join(root, 'roadmap.html'), 'utf8');
 const roadmapRequiredIds = [
   'roadmap-total', 'roadmap-complete', 'roadmap-pending', 'roadmap-percent',
diff --git a/test/website-downloads.test.js b/test/website-downloads.test.js
new file mode 100644
index 00000000..45c205ff
--- /dev/null
+++ b/test/website-downloads.test.js
@@ -0,0 +1,25 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const html = readFileSync(path.join(root, 'Website/downloads.html'), 'utf8');
+const script = readFileSync(path.join(root, 'Website/downloads.js'), 'utf8');
+
+test('downloads page exposes accessible filters backed by the official release API', () => {
+  for (const id of ['downloads-status', 'downloads-filter', 'downloads-search', 'downloads-assets']) {
+    assert.match(html, new RegExp('id="' + id + '"'));
+  }
+  assert.match(html, /src="downloads\.js"/);
+  assert.match(script, /api\.github\.com\/repos\/NetCore-Technologies\/FORGE\/releases\/latest/);
+  assert.match(script, /browser_download_url/);
+  assert.match(script, /asset\.digest/);
+  assert.match(script, /SHA256SUMS/);
+});
+
+test('downloads catalogue renders only release assets returned by GitHub', () => {
+  assert.match(html, /actual files attached to official FORGE GitHub releases/i);
+  assert.match(script, /Array\.isArray\(release\.assets\)/);
+});

From e6af6c03a6e1c0a180862e593c4c56f19672686b Mon Sep 17 00:00:00 2001
From: Manit Arora 
Date: Tue, 1 Dec 2026 15:15:54 +1100
Subject: [PATCH 05/37] Build production GUI in installers and Debian package

---
 .github/workflows/release-assets.yml | 3 ++-
 installers/install.ps1               | 4 ++++
 installers/install.sh                | 3 +++
 scripts/build-deb.sh                 | 6 ++++--
 scripts/install.ps1                  | 4 ++++
 scripts/install.sh                   | 3 +++
 6 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/release-assets.yml b/.github/workflows/release-assets.yml
index 6aba1048..ca595396 100644
--- a/.github/workflows/release-assets.yml
+++ b/.github/workflows/release-assets.yml
@@ -143,6 +143,7 @@ jobs:
           install -m 0755 scripts/install.sh release-assets/forge-install.sh
           install -m 0644 scripts/install.ps1 release-assets/forge-install.ps1
           install -m 0755 scripts/install-apt.sh release-assets/forge-install-apt.sh
+          install -m 0755 installers/apt.sh release-assets/forge-apt.sh
           install -m 0644 docs/INSTALLATION.md release-assets/INSTALLATION.md
           install -m 0644 support/keys/forge-release-signing-public-key.asc release-assets/forge-release-signing-public-key.asc
           node scripts/pin-release-installers.js release-assets "$FORGE_RELEASE_TAG"
@@ -216,7 +217,7 @@ jobs:
           expected="$(printf '%s' "$FORGE_RELEASE_SIGNING_FINGERPRINT" | tr -d '[:space:]' | tr '[:lower:]' '[:upper:]')"
           [[ "$expected" =~ ^([A-F0-9]{40}|[A-F0-9]{64})$ ]]
           cd release-assets
-          files=(forge_*.deb forge-install.sh forge-install.ps1 forge-install-apt.sh INSTALLATION.md forge-release-signing-public-key.asc)
+          files=(forge_*.deb forge-install.sh forge-install.ps1 forge-install-apt.sh forge-apt.sh INSTALLATION.md forge-release-signing-public-key.asc)
           for file in "${files[@]}"; do
             test -f "$file"
           done
diff --git a/installers/install.ps1 b/installers/install.ps1
index b6215f26..69624865 100644
--- a/installers/install.ps1
+++ b/installers/install.ps1
@@ -51,6 +51,10 @@ try {
     Write-Host "Fetching FORGE ref $installRef…"
     & git clone --depth 1 --single-branch --branch $installRef https://github.com/NetCore-Technologies/FORGE.git (Join-Path $tempRoot 'FORGE')
     if ($LASTEXITCODE -ne 0) { throw 'Git clone failed.' }
+    $repository = Join-Path $tempRoot 'FORGE'
+    Write-Host 'Building the FORGE Control Center…'
+    & npm --prefix $repository run build
+    if ($LASTEXITCODE -ne 0) { throw 'Control Center asset build failed.' }
     Write-Host "Installing FORGE under $prefix…"
     & npm install --global --prefix $prefix (Join-Path $tempRoot 'FORGE')
     if ($LASTEXITCODE -ne 0) { throw 'npm installation failed.' }
diff --git a/installers/install.sh b/installers/install.sh
index 88032c43..dc08389f 100644
--- a/installers/install.sh
+++ b/installers/install.sh
@@ -59,6 +59,9 @@ trap cleanup EXIT INT TERM
 
 printf '\nFetching FORGE ref %s…\n' "$INSTALL_REF"
 git clone --depth 1 --single-branch --branch "$INSTALL_REF" "$REPOSITORY" "$WORK_DIR/FORGE"
+printf '\nBuilding the FORGE Control Center…\n'
+(cd "$WORK_DIR/FORGE" && npm run build)
+
 printf '\nInstalling FORGE under %s…\n' "$PREFIX"
 npm install --global --prefix "$PREFIX" "$WORK_DIR/FORGE"
 
diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh
index 8bccc1fe..a6175c7d 100644
--- a/scripts/build-deb.sh
+++ b/scripts/build-deb.sh
@@ -3,7 +3,9 @@ set -Eeuo pipefail
 OUTPUT_DIR="${1:-dist}"
 ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
 command -v dpkg-deb >/dev/null 2>&1 || { echo "dpkg-deb is required to build a Debian package." >&2; exit 1; }
-command -v node >/dev/null 2>&1 || { echo "Node.js is required to read package metadata." >&2; exit 1; }
+command -v node >/dev/null 2>&1 || { echo "Node.js is required to build the FORGE package." >&2; exit 1; }
+command -v npm >/dev/null 2>&1 || { echo "npm is required to build the FORGE Control Center." >&2; exit 1; }
+(cd "$ROOT_DIR" && npm run build)
 VERSION="$(cd "$ROOT_DIR" && node -p "require('./package.json').version" 2>/dev/null)"
 if [[ ! "$VERSION" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then
   echo "package.json contains an invalid Debian-compatible semantic version." >&2
@@ -16,7 +18,7 @@ WORK_DIR="$(mktemp -d "${TMPDIR:-/tmp}/forge-deb.XXXXXXXX")"
 trap 'rm -rf -- "$WORK_DIR"' EXIT INT TERM
 PACKAGE_ROOT="$WORK_DIR/package"
 install -d "$PACKAGE_ROOT/DEBIAN" "$PACKAGE_ROOT/usr/lib/forge" "$PACKAGE_ROOT/usr/bin"
-cp -R "$ROOT_DIR/bin" "$ROOT_DIR/src" "$ROOT_DIR/ui" "$PACKAGE_ROOT/usr/lib/forge/"
+cp -R "$ROOT_DIR/bin" "$ROOT_DIR/src" "$ROOT_DIR/ui" "$ROOT_DIR/build" "$PACKAGE_ROOT/usr/lib/forge/"
 install -m 0644 "$ROOT_DIR/package.json" "$PACKAGE_ROOT/usr/lib/forge/package.json"
 install -m 0644 "$ROOT_DIR/README.md" "$PACKAGE_ROOT/usr/lib/forge/README.md"
 install -m 0644 "$ROOT_DIR/docs/LICENSE" "$PACKAGE_ROOT/usr/lib/forge/LICENSE"
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index b6215f26..69624865 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -51,6 +51,10 @@ try {
     Write-Host "Fetching FORGE ref $installRef…"
     & git clone --depth 1 --single-branch --branch $installRef https://github.com/NetCore-Technologies/FORGE.git (Join-Path $tempRoot 'FORGE')
     if ($LASTEXITCODE -ne 0) { throw 'Git clone failed.' }
+    $repository = Join-Path $tempRoot 'FORGE'
+    Write-Host 'Building the FORGE Control Center…'
+    & npm --prefix $repository run build
+    if ($LASTEXITCODE -ne 0) { throw 'Control Center asset build failed.' }
     Write-Host "Installing FORGE under $prefix…"
     & npm install --global --prefix $prefix (Join-Path $tempRoot 'FORGE')
     if ($LASTEXITCODE -ne 0) { throw 'npm installation failed.' }
diff --git a/scripts/install.sh b/scripts/install.sh
index 88032c43..dc08389f 100644
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -59,6 +59,9 @@ trap cleanup EXIT INT TERM
 
 printf '\nFetching FORGE ref %s…\n' "$INSTALL_REF"
 git clone --depth 1 --single-branch --branch "$INSTALL_REF" "$REPOSITORY" "$WORK_DIR/FORGE"
+printf '\nBuilding the FORGE Control Center…\n'
+(cd "$WORK_DIR/FORGE" && npm run build)
+
 printf '\nInstalling FORGE under %s…\n' "$PREFIX"
 npm install --global --prefix "$PREFIX" "$WORK_DIR/FORGE"
 

From e8cb5355024e58905d8fce639b730fb6b70fd73b Mon Sep 17 00:00:00 2001
From: Manit Arora 
Date: Tue, 1 Dec 2026 15:16:59 +1100
Subject: [PATCH 06/37] Link release downloads from the main website navigation

---
 Website/cli.html      | 2 +-
 Website/index.html    | 2 +-
 Website/install.html  | 2 +-
 Website/platform.html | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Website/cli.html b/Website/cli.html
index c76c6367..e8103cbe 100644
--- a/Website/cli.html
+++ b/Website/cli.html
@@ -1,4 +1,4 @@
-CLI · FORGE
FORGE logo
The FORGE CLI / 02

Real commands. Real workflows.

A dependency-free Node.js CLI for local project checks, default-deny tool policy, webhook signature validation and execution history.

  • NODE.JS 22.14+
  • ES MODULES
  • ZERO RUNTIME DEPS
  • INSTALL FROM SOURCE
Install from source

Try the current CLI.

The npm package is configured, but the public registry release is pending publisher credentials and the first release run.

git clone https://github.com/NetCore-Technologies/FORGE.git
+CLI · FORGE
FORGE logo
The FORGE CLI / 02

Real commands. Real workflows.

A dependency-free Node.js CLI for local project checks, default-deny tool policy, webhook signature validation and execution history.

  • NODE.JS 22.14+
  • ES MODULES
  • ZERO RUNTIME DEPS
  • INSTALL FROM SOURCE
Install from source

Try the current CLI.

The npm package is configured, but the public registry release is pending publisher credentials and the first release run.

git clone https://github.com/NetCore-Technologies/FORGE.git
 cd FORGE
 npm install
 npm link
diff --git a/Website/index.html b/Website/index.html
index 900b776b..e94789df 100644
--- a/Website/index.html
+++ b/Website/index.html
@@ -1 +1 @@
-FORGE — Developer Workbench
FORGE logo
Open source · NetCore Technologies

Make good work happen.

A local-first developer workbench for the work around software. Verify projects, make tool access explicit, validate webhook signatures and keep a trail of what happened.

  • NODE.JS 22.14+
  • ZERO RUNTIME DEPENDENCIES
  • MIT LICENSE
SCROLL TO EXPLORE ↓
01 / The workbench

One place for the work around code.

Less tool sprawl. More signal. FORGE starts with workflows you can run locally today, then grows around the same project and evidence model.

02 / Built for your machine

Local-first. No black boxes.

The current command-line workflows need no hosted service, account or remote inference endpoint. Your configuration and event records live inside the project you choose.

forge · terminal
# initialise a workspaceforge init✓ local workspace created# inspect the environmentforge doctor✓ Node.js · Git · project config# inspect recent evidenceforge trace list --limit 5✓ local events loaded
By the numbers

Small surface. Clear limits.

0CLI workflows
0runtime dependencies
0webhook payload limit
0telemetry endpoints
03 / The principles

Forged for clear decisions.

01

Local by default

Current workflows run on your machine without a required hosted control plane.

02

Safe defaults

Tool policy starts at deny. Access is explicit and denials take precedence.

03

Evidence over guesses

Commands produce inspectable outcomes and bounded local records.

Build in the open

Make the work work better.

Try the CLI, inspect the implementation and help shape what comes next.

\ No newline at end of file +FORGE — Developer Workbench
FORGE logo
Open source · NetCore Technologies

Make good work happen.

A local-first developer workbench for the work around software. Verify projects, make tool access explicit, validate webhook signatures and keep a trail of what happened.

  • NODE.JS 22.14+
  • ZERO RUNTIME DEPENDENCIES
  • MIT LICENSE
SCROLL TO EXPLORE ↓
01 / The workbench

One place for the work around code.

Less tool sprawl. More signal. FORGE starts with workflows you can run locally today, then grows around the same project and evidence model.

02 / Built for your machine

Local-first. No black boxes.

The current command-line workflows need no hosted service, account or remote inference endpoint. Your configuration and event records live inside the project you choose.

forge · terminal
# initialise a workspaceforge init✓ local workspace created# inspect the environmentforge doctor✓ Node.js · Git · project config# inspect recent evidenceforge trace list --limit 5✓ local events loaded
By the numbers

Small surface. Clear limits.

0CLI workflows
0runtime dependencies
0webhook payload limit
0telemetry endpoints
03 / The principles

Forged for clear decisions.

01

Local by default

Current workflows run on your machine without a required hosted control plane.

02

Safe defaults

Tool policy starts at deny. Access is explicit and denials take precedence.

03

Evidence over guesses

Commands produce inspectable outcomes and bounded local records.

Build in the open

Make the work work better.

Try the CLI, inspect the implementation and help shape what comes next.

\ No newline at end of file diff --git a/Website/install.html b/Website/install.html index 50cbbace..0835ee79 100644 --- a/Website/install.html +++ b/Website/install.html @@ -19,7 +19,7 @@
diff --git a/Website/platform.html b/Website/platform.html index 11d7eaa5..dbed50ad 100644 --- a/Website/platform.html +++ b/Website/platform.html @@ -1 +1 @@ -Platform · FORGE
FORGE logo
The platform / 01

Focused tools. Shared foundations.

FORGE brings everyday engineering workflows together through one CLI, a local project model and a consistent evidence format. The current release is CLI-first; the visual control centre and team services remain planned work.

  • CLI FOUNDATION · IN SOURCE
  • LOCAL-FIRST
  • OPEN SOURCE
Current capabilities

Useful workflows. Already executable.

AVAILABLEVERIFY

Project verification

Run discovered npm, pnpm, Yarn or Bun scripts for lint, typecheck, test and build. Each result is recorded locally.

AVAILABLEGUARD

Tool policy

Manage explicit allow/deny rules with default-deny semantics and deny-overrides behaviour.

AVAILABLETRACE

Execution evidence

Review recent verification, webhook validation and guard-decision events in JSONL format.

AVAILABLEHOOKS

Webhook signatures

Verify raw payload bytes using HMAC-SHA256 and constant-time digest comparison.

AVAILABLEINSPECT

Repository readiness

Audit open-source readiness without executing project scripts or making network calls.

PLANNEDCONTROL CENTRE

Project interface

A visual workspace for projects, check results, policy management and run history.

PLANNEDEXTENSIONS

Integration framework

Documented extension contracts for CI, Git providers, MCP clients and community adapters.

The design

One project. A shared context.

Commands share a local configuration directory, policy file and concise event history. New capabilities should extend those foundations instead of creating another disconnected dashboard.

Developer / CI
FORGE CLI + local project
VERIFY
GUARD
HOOKS
Local evidence · .forge/
\ No newline at end of file +Platform · FORGE
FORGE logo
The platform / 01

Focused tools. Shared foundations.

FORGE brings everyday engineering workflows together through one CLI, a local project model and a consistent evidence format. The current release is CLI-first; the visual control centre and team services remain planned work.

  • CLI FOUNDATION · IN SOURCE
  • LOCAL-FIRST
  • OPEN SOURCE
Current capabilities

Useful workflows. Already executable.

AVAILABLEVERIFY

Project verification

Run discovered npm, pnpm, Yarn or Bun scripts for lint, typecheck, test and build. Each result is recorded locally.

AVAILABLEGUARD

Tool policy

Manage explicit allow/deny rules with default-deny semantics and deny-overrides behaviour.

AVAILABLETRACE

Execution evidence

Review recent verification, webhook validation and guard-decision events in JSONL format.

AVAILABLEHOOKS

Webhook signatures

Verify raw payload bytes using HMAC-SHA256 and constant-time digest comparison.

AVAILABLEINSPECT

Repository readiness

Audit open-source readiness without executing project scripts or making network calls.

PLANNEDCONTROL CENTRE

Project interface

A visual workspace for projects, check results, policy management and run history.

PLANNEDEXTENSIONS

Integration framework

Documented extension contracts for CI, Git providers, MCP clients and community adapters.

The design

One project. A shared context.

Commands share a local configuration directory, policy file and concise event history. New capabilities should extend those foundations instead of creating another disconnected dashboard.

Developer / CI
FORGE CLI + local project
VERIFY
GUARD
HOOKS
Local evidence · .forge/
\ No newline at end of file From a42cb54147cfc29f8b6e01ab1280963a7aa476dd Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:18:43 +1100 Subject: [PATCH 07/37] Add language percentage and Python Rust adapter report --- docs/CLI.md | 13 +++ src/cli.js | 24 +++++- src/language-report.js | 153 +++++++++++++++++++++++++++++++++++ test/language-report.test.js | 85 +++++++++++++++++++ 4 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 src/language-report.js create mode 100644 test/language-report.test.js diff --git a/docs/CLI.md b/docs/CLI.md index d4eb51cf..2938d248 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -20,6 +20,7 @@ The npm package is not yet published. Do not rely on a global registry install u | `forge --version` | Show version | | `forge init [directory]` | Initialise local configuration and event history | | `forge doctor [--json]` | Inspect Node.js, Git, Python, Go, Rust, Docker and local FORGE configuration | +| `forge languages [directory] [--json]` | Report source-language percentages, file/byte totals and each supported verification adapter's available checks | | `forge roadmap [--search TEXT] [--status all|complete|planned] [--domain 1..20] [--limit N] [--json]` | Search and filter the canonical 1,000-feature roadmap | | `forge backends [directory] [--profile quick|standard|release] [--json]` | Show detected project backends and the exact checks each profile will execute | | `forge profiles list [directory]` | List saved execution profiles for a workspace | @@ -510,3 +511,15 @@ The Control Center can query read-only deployment history for an HTTPS/SSH/SCP o ## Target-specific deployment preflight \`forge engine deploy --dry-run\` reports separate npm, Debian, OCI and signed APT readiness summaries. Every target lists the gates it requires, blockers and pending configuration or human approval. The JSON result exposes these under \`targets\`. This command remains strictly preflight-only: it does not log in to registries, create tags, upload artifacts, sign packages or publish anything. Continue only through the reviewed protected publication workflow. + + +## Language composition and native verification adapters + +Use `forge languages` to inspect the source footprint of a workspace. Percentages are calculated from the bytes of recognised source files (not dependency directories, generated output or binary files). The scan is bounded and never follows symbolic links. + +~~~bash +forge languages +forge languages . --json +~~~ + +Python and Rust are first-class verification adapters. A Python project receives bounded AST syntax validation and detected pytest/unittest checks; release profiles also enable Ruff and mypy when the project config declares them. A Rust project receives `cargo test --all-targets`, `cargo fmt --all -- --check`, and (for release profiles) strict Clippy checks. The language report shows the actual adapter check set next to the percentage, and keeps Python/Rust rows visible even in a workspace that currently contains zero files for one of them. diff --git a/src/cli.js b/src/cli.js index 488dbb78..1b271131 100644 --- a/src/cli.js +++ b/src/cli.js @@ -34,6 +34,7 @@ import { runLocalInference } from './inference.js'; import { evaluateLocalModel } from './evaluation.js'; import { createTaskRecommendations } from './recommendations.js'; import { readProductRoadmap } from './roadmap.js'; +import { scanProjectLanguages } from './language-report.js'; import { listExecutionProfiles, getExecutionProfile, saveExecutionProfile, deleteExecutionProfile } from './profiles.js'; import { serializeExecutionPlan, serializeExecutionTrace } from './exports.js'; import { getProjectResourceBudget } from './resource-budget.js'; @@ -57,6 +58,7 @@ Core commands: Search the canonical 1,000-feature product roadmap init [directory] Create local FORGE configuration and policy doctor [--json] Inspect the runtime and project environment + languages [directory] [--json] Report source-language percentages and verification adapter coverage backends [directory] [--profile quick|standard|release] [--json] List project-detected verification adapters and exact checks profiles list [directory] List saved workspace execution profiles @@ -1450,7 +1452,7 @@ export async function main(argv = process.argv.slice(2), overrides = {}) { ? (positionals[0] === 'list' ? (positionals[1] || '.') : (positionals[2] || '.')) : '.'; const exportDirectory = command === 'export' ? (positionals[0] === 'plan' ? (positionals[1] || '.') : (positionals[2] || '.')) : '.'; - const requestedProject = flags.project || (['init', 'verify', 'inspect', 'gui', 'backends', 'recommend'].includes(command) + const requestedProject = flags.project || (['init', 'verify', 'inspect', 'gui', 'backends', 'recommend', 'languages'].includes(command) ? positionals[0] : command === 'profiles' ? profileDirectory : command === 'export' ? exportDirectory @@ -2086,6 +2088,26 @@ export async function main(argv = process.argv.slice(2), overrides = {}) { } throw new Error('usage: forge files '); } + if (command === 'languages') { + if (positionals.length > 1) throw new Error('usage: forge languages [directory] [--json]'); + const report = scanProjectLanguages(projectRoot); + if (flags.json) writeJson(io, report); + else { + io.stdout.write('FORGE language composition · ' + report.sourceFiles + ' source file(s) · ' + report.sourceBytes + ' bytes\n'); + for (const language of report.languages) { + const percentage = language.percentage.toFixed(1).padStart(5) + '%'; + const adapter = language.verificationAdapter + ? ' · adapter ' + (language.verificationAdapter.available ? 'ready' : 'unavailable') + + ' (' + language.verificationAdapter.checks.length + ' checks)' + : ''; + io.stdout.write(' ' + language.name.padEnd(14) + percentage + ' · ' + language.files + + ' file(s) · ' + language.bytes + ' bytes' + adapter + '\n'); + } + io.stdout.write(' Python and Rust adapters run real project checks when their manifests are detected.\n'); + if (report.truncated) io.stdout.write(' Scan reached a safety limit; percentages describe the scanned source files only.\n'); + } + return 0; + } if (command === 'inspect') return runInspect(projectRoot, flags, io); if (command === 'gui') { await (overrides.startGui || startGui)({ projectRoot, port: flags.port, stdout: io.stdout }); diff --git a/src/language-report.js b/src/language-report.js new file mode 100644 index 00000000..328e77b8 --- /dev/null +++ b/src/language-report.js @@ -0,0 +1,153 @@ +import { lstatSync, readdirSync } from 'node:fs'; +import path from 'node:path'; +import { listVerificationBackends } from './adapters/index.js'; + +const LANGUAGE_BY_EXTENSION = new Map([ + ['.js', ['javascript', 'JavaScript']], ['.jsx', ['javascript', 'JavaScript']], + ['.mjs', ['javascript', 'JavaScript']], ['.cjs', ['javascript', 'JavaScript']], + ['.ts', ['typescript', 'TypeScript']], ['.tsx', ['typescript', 'TypeScript']], + ['.mts', ['typescript', 'TypeScript']], ['.cts', ['typescript', 'TypeScript']], + ['.py', ['python', 'Python']], ['.pyw', ['python', 'Python']], + ['.rs', ['rust', 'Rust']], ['.go', ['go', 'Go']], ['.java', ['java', 'Java']], + ['.sh', ['shell', 'Shell']], ['.bash', ['shell', 'Shell']], ['.zsh', ['shell', 'Shell']], + ['.ps1', ['powershell', 'PowerShell']], ['.psm1', ['powershell', 'PowerShell']], + ['.bat', ['powershell', 'PowerShell']], ['.cmd', ['powershell', 'PowerShell']], + ['.c', ['c', 'C']], ['.h', ['c', 'C']], + ['.cc', ['cpp', 'C++']], ['.cpp', ['cpp', 'C++']], ['.cxx', ['cpp', 'C++']], + ['.hpp', ['cpp', 'C++']], ['.hh', ['cpp', 'C++']], + ['.rb', ['ruby', 'Ruby']], ['.php', ['php', 'PHP']], + ['.swift', ['swift', 'Swift']], ['.kt', ['kotlin', 'Kotlin']], ['.kts', ['kotlin', 'Kotlin']], + ['.cs', ['csharp', 'C#']], ['.scala', ['scala', 'Scala']], +]); + +const IGNORED_DIRECTORIES = new Set([ + '.git', '.forge', '.venv', 'venv', '__pycache__', '.pytest_cache', '.mypy_cache', + '.ruff_cache', 'node_modules', 'vendor', 'site-packages', 'dist', 'build', + 'coverage', 'target', '.next', '.cache', 'out', 'bin', 'obj', +]); +const REQUIRED_LANGUAGE_ROWS = [ + ['python', 'Python'], + ['rust', 'Rust'], +]; +const DEFAULT_LIMITS = Object.freeze({ + maxEntries: 20000, + maxDepth: 8, + maxFileBytes: 4 * 1024 * 1024, + maxTotalBytes: 64 * 1024 * 1024, +}); + +function boundedLimit(value, fallback, name, maximum) { + if (value === undefined) return fallback; + if (!Number.isSafeInteger(value) || value < 1 || value > maximum) { + throw new RangeError(name + ' must be an integer from 1 to ' + maximum + '.'); + } + return value; +} + +export function scanProjectLanguages(projectRoot, options = {}) { + if (typeof projectRoot !== 'string' || !projectRoot.trim()) { + throw new TypeError('projectRoot must be a non-empty path.'); + } + if (!options || typeof options !== 'object' || Array.isArray(options)) { + throw new TypeError('Language scan options must be an object.'); + } + const root = path.resolve(projectRoot); + const rootInfo = lstatSync(root); + if (rootInfo.isSymbolicLink() || !rootInfo.isDirectory()) { + throw new Error('Language scan root must be a real directory.'); + } + + const limits = { + maxEntries: boundedLimit(options.maxEntries, DEFAULT_LIMITS.maxEntries, 'maxEntries', 100000), + maxDepth: boundedLimit(options.maxDepth, DEFAULT_LIMITS.maxDepth, 'maxDepth', 32), + maxFileBytes: boundedLimit(options.maxFileBytes, DEFAULT_LIMITS.maxFileBytes, 'maxFileBytes', 64 * 1024 * 1024), + maxTotalBytes: boundedLimit(options.maxTotalBytes, DEFAULT_LIMITS.maxTotalBytes, 'maxTotalBytes', 512 * 1024 * 1024), + }; + const counts = new Map(REQUIRED_LANGUAGE_ROWS.map(([id, name]) => [id, { id, name, files: 0, bytes: 0 }])); + const pending = [{ directory: root, depth: 0 }]; + let inspectedEntries = 0; + let skippedLargeFiles = 0; + let truncated = false; + let sourceFiles = 0; + let sourceBytes = 0; + + while (pending.length) { + const current = pending.pop(); + let entries; + try { + entries = readdirSync(current.directory, { withFileTypes: true }) + .sort((left, right) => left.name.localeCompare(right.name)); + } catch { + continue; + } + for (const entry of entries) { + inspectedEntries += 1; + if (inspectedEntries > limits.maxEntries) { + truncated = true; + break; + } + const absolute = path.join(current.directory, entry.name); + if (entry.isSymbolicLink()) continue; + if (entry.isDirectory()) { + if (current.depth < limits.maxDepth && !IGNORED_DIRECTORIES.has(entry.name)) { + pending.push({ directory: absolute, depth: current.depth + 1 }); + } + continue; + } + if (!entry.isFile()) continue; + const type = LANGUAGE_BY_EXTENSION.get(path.extname(entry.name).toLowerCase()); + if (!type) continue; + let info; + try { info = lstatSync(absolute); } catch { continue; } + if (info.isSymbolicLink() || !info.isFile()) continue; + if (info.size > limits.maxFileBytes || sourceBytes + info.size > limits.maxTotalBytes) { + skippedLargeFiles += 1; + truncated = true; + continue; + } + const [id, name] = type; + if (!counts.has(id)) counts.set(id, { id, name, files: 0, bytes: 0 }); + const item = counts.get(id); + item.files += 1; + item.bytes += info.size; + sourceFiles += 1; + sourceBytes += info.size; + } + if (truncated && inspectedEntries > limits.maxEntries) break; + } + + const backends = new Map(listVerificationBackends().map((backend) => [backend.id, backend])); + const languages = [...counts.values()].map((language) => { + const backendId = language.id === 'javascript' || language.id === 'typescript' ? 'node' : language.id; + const backend = backends.get(backendId); + return { + ...language, + percentage: sourceBytes ? Number((language.bytes / sourceBytes * 100).toFixed(2)) : 0, + verificationAdapter: backend ? { + id: backend.id, + available: true, + checks: [...backend.checks], + } : null, + }; + }).filter((language) => language.files > 0 || REQUIRED_LANGUAGE_ROWS.some(([id]) => id === language.id)) + .sort((left, right) => right.bytes - left.bytes || left.name.localeCompare(right.name)); + + return { + schemaVersion: 1, + project: root, + metric: 'recognised-source-file-bytes', + sourceFiles, + sourceBytes, + inspectedEntries, + skippedLargeFiles, + truncated, + languages, + adapters: [...backends.values()].map((backend) => ({ + id: backend.id, + name: backend.name, + checks: [...backend.checks], + detected: languages.some((language) => language.id === backend.id && language.files > 0), + })), + limits, + }; +} diff --git a/test/language-report.test.js b/test/language-report.test.js new file mode 100644 index 00000000..62dc92d0 --- /dev/null +++ b/test/language-report.test.js @@ -0,0 +1,85 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { mkdtempSync, mkdirSync, rmSync, writeFileSync, symlinkSync } from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import { scanProjectLanguages } from '../src/language-report.js'; +import { main } from '../src/cli.js'; + +function fixture() { + const root = mkdtempSync(path.join(os.tmpdir(), 'forge-language-report-')); + return { root, cleanup: () => rmSync(root, { recursive: true, force: true }) }; +} + +test('language report calculates percentages from recognised source bytes and keeps Python/Rust visible', () => { + const f = fixture(); + try { + mkdirSync(path.join(f.root, 'src')); + writeFileSync(path.join(f.root, 'src', 'main.js'), 'x'.repeat(100)); + writeFileSync(path.join(f.root, 'src', 'main.py'), 'p'.repeat(50)); + writeFileSync(path.join(f.root, 'src', 'lib.rs'), 'r'.repeat(25)); + const result = scanProjectLanguages(f.root); + const byId = new Map(result.languages.map((language) => [language.id, language])); + assert.equal(result.sourceFiles, 3); + assert.equal(result.sourceBytes, 175); + assert.equal(byId.get('javascript').percentage, 57.14); + assert.equal(byId.get('python').percentage, 28.57); + assert.equal(byId.get('rust').percentage, 14.29); + assert.equal(byId.get('python').verificationAdapter.available, true); + assert.ok(byId.get('python').verificationAdapter.checks.includes('syntax')); + assert.ok(byId.get('rust').verificationAdapter.checks.includes('clippy')); + } finally { f.cleanup(); } +}); + +test('language report excludes dependencies, generated output and symbolic links', () => { + const f = fixture(); + const external = path.join(os.tmpdir(), 'forge-outside-rust-' + process.pid + '.rs'); + try { + mkdirSync(path.join(f.root, 'node_modules', 'nested'), { recursive: true }); + mkdirSync(path.join(f.root, 'target'), { recursive: true }); + writeFileSync(path.join(f.root, 'node_modules', 'nested', 'dependency.py'), 'x'.repeat(200)); + writeFileSync(path.join(f.root, 'target', 'generated.rs'), 'x'.repeat(200)); + writeFileSync(external, 'x'.repeat(100)); + symlinkSync(external, path.join(f.root, 'linked.rs')); + const result = scanProjectLanguages(f.root); + const byId = new Map(result.languages.map((language) => [language.id, language])); + assert.equal(result.sourceFiles, 0); + assert.equal(byId.get('python').percentage, 0); + assert.equal(byId.get('rust').percentage, 0); + assert.equal(byId.get('python').verificationAdapter.available, true); + assert.equal(byId.get('rust').verificationAdapter.available, true); + } finally { + f.cleanup(); + rmSync(external, { force: true }); + } +}); + +test('language report is bounded and flags truncated scans', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'a.js'), '123'); + writeFileSync(path.join(f.root, 'b.py'), '456'); + const result = scanProjectLanguages(f.root, { maxEntries: 1 }); + assert.equal(result.truncated, true); + assert.ok(result.inspectedEntries >= 2); + } finally { f.cleanup(); } +}); + +test('forge languages command returns the same percentage report as JSON', async () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'app.py'), 'print("hello")\n'); + writeFileSync(path.join(f.root, 'main.rs'), 'fn main() {}\n'); + const stdout = { value: '' }; + const code = await main(['languages', '--json'], { + cwd: f.root, + stdout: { write: (chunk) => { stdout.value += String(chunk); } }, + stderr: { write: () => {} }, + }); + assert.equal(code, 0); + const report = JSON.parse(stdout.value); + assert.equal(report.sourceFiles, 2); + assert.ok(report.languages.some((language) => language.id === 'python' && language.percentage > 0)); + assert.ok(report.languages.some((language) => language.id === 'rust' && language.percentage > 0)); + } finally { f.cleanup(); } +}); From 550ab65c794627491af6ddca4b3ae8cc80a12f24 Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:19:15 +1100 Subject: [PATCH 08/37] Complete language adapter coverage and APT candidate keyring --- .github/workflows/apt-repository-candidate.yml | 1 + src/language-report.js | 2 +- test/language-report.test.js | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/apt-repository-candidate.yml b/.github/workflows/apt-repository-candidate.yml index 116cfbc5..dd5a274b 100644 --- a/.github/workflows/apt-repository-candidate.yml +++ b/.github/workflows/apt-repository-candidate.yml @@ -46,6 +46,7 @@ jobs: printf '%s' "$FORGE_APT_SIGNING_PRIVATE_KEY" | gpg --batch --import bash scripts/build-apt-repo.sh dist dist/apt gpg --batch --armor --export "$FORGE_APT_SIGNING_KEY_ID" > dist/apt/forge-archive-keyring.asc + gpg --batch --export "$FORGE_APT_SIGNING_KEY_ID" > dist/apt/forge-archive-keyring.gpg (cd dist && find apt -type f ! -name SHA256SUMS -print0 | sort -z | xargs -0 sha256sum > apt/SHA256SUMS) (cd dist && sha256sum forge_*.deb >> apt/SHA256SUMS) (cd dist && sha256sum --check apt/SHA256SUMS) diff --git a/src/language-report.js b/src/language-report.js index 328e77b8..2b172e4d 100644 --- a/src/language-report.js +++ b/src/language-report.js @@ -146,7 +146,7 @@ export function scanProjectLanguages(projectRoot, options = {}) { id: backend.id, name: backend.name, checks: [...backend.checks], - detected: languages.some((language) => language.id === backend.id && language.files > 0), + detected: languages.some((language) => (language.id === 'javascript' || language.id === 'typescript' ? 'node' : language.id) === backend.id && language.files > 0), })), limits, }; diff --git a/test/language-report.test.js b/test/language-report.test.js index 62dc92d0..46488a84 100644 --- a/test/language-report.test.js +++ b/test/language-report.test.js @@ -28,6 +28,9 @@ test('language report calculates percentages from recognised source bytes and ke assert.equal(byId.get('python').verificationAdapter.available, true); assert.ok(byId.get('python').verificationAdapter.checks.includes('syntax')); assert.ok(byId.get('rust').verificationAdapter.checks.includes('clippy')); + assert.equal(result.adapters.find((adapter) => adapter.id === 'node').detected, true); + assert.equal(result.adapters.find((adapter) => adapter.id === 'python').detected, true); + assert.equal(result.adapters.find((adapter) => adapter.id === 'rust').detected, true); } finally { f.cleanup(); } }); From 22fb48cf51af785f62a76a044b55eca5e2e86a1c Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:21:02 +1100 Subject: [PATCH 09/37] Expose language report in Control Center CLI and fix APT checksum summary --- .github/workflows/deploy-pages.yml | 2 +- src/gui.js | 2 ++ test/gui-cli.test.js | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index db4a6d08..9dc204ba 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -231,6 +231,6 @@ jobs: echo "- Release: $FORGE_RELEASE_TAG" echo "- Repository: https://netcore-technologies.github.io/FORGE/apt" echo "- APT key fingerprint: $FORGE_APT_KEY_FINGERPRINT" - echo "- APT key SHA-256: $(sha256sum Website/apt/forge-archive-keyring.asc | awk '{print $1}')" + echo "- APT key SHA-256: $(sha256sum Website/apt/forge-archive-keyring.gpg | awk '{print $1}')" echo "- Metadata: https://netcore-technologies.github.io/FORGE/apt/key-info.json" } >> "$GITHUB_STEP_SUMMARY" diff --git a/src/gui.js b/src/gui.js index b64d9f22..40760e5d 100644 --- a/src/gui.js +++ b/src/gui.js @@ -680,6 +680,7 @@ const GUI_CLI_ACTIONS = Object.freeze([ { id: 'doctor', label: 'Runtime diagnostics', description: 'Inspect Node.js, operating system and local runtime readiness.' }, { id: 'inspect', label: 'Workspace inspection', description: 'Audit the selected workspace and its project manifests.' }, { id: 'backends', label: 'Detected verification adapters', description: 'List project-aware checks for a selected profile.' }, + { id: 'languages', label: 'Language composition', description: 'Report source-language percentages and the Python/Rust verification adapter coverage.' }, { id: 'engine-plan', label: 'Infer execution plan', description: 'Build the execution plan without running checks.' }, { id: 'engine-run', label: 'Run execution engine', description: 'Execute selected project checks and write a trace; explicit confirmation required.' }, { id: 'engine-deploy', label: 'Deployment preflight', description: 'Inspect release and APT gates without publishing.' }, @@ -1288,6 +1289,7 @@ export function createGuiServer(projectRoot, options = {}) { doctor: ['doctor', '--json'], inspect: ['inspect', root, '--deep', '--json'], backends: ['backends', root, '--profile', profile, '--json'], + languages: ['languages', root, '--json'], 'engine-plan': ['engine', 'plan', root, '--profile', profile, '--timeout', String(timeoutSeconds), '--concurrency', String(concurrency), '--json'], 'engine-run': ['engine', 'run', root, '--profile', profile, '--timeout', String(timeoutSeconds), '--concurrency', String(concurrency), '--json'], 'engine-deploy': ['engine', 'deploy', root, '--dry-run', '--json'], diff --git a/test/gui-cli.test.js b/test/gui-cli.test.js index 70b8332f..0ca15861 100644 --- a/test/gui-cli.test.js +++ b/test/gui-cli.test.js @@ -63,6 +63,19 @@ test('GUI CLI runner exposes only allowlisted native commands and no shell input const data = await actions.json(); assert.equal(data.arbitraryShell, false); assert.ok(data.actions.some((item) => item.id === 'engine-run')); + assert.ok(data.actions.some((item) => item.id === 'languages')); + + const languageReport = await request(origin + '/api/cli/execute', { + method: 'POST', + headers: { Origin: origin, 'Content-Type': 'application/json' }, + body: JSON.stringify({ action: 'languages' }), + }); + assert.equal(languageReport.status, 200); + const languageResult = await languageReport.json(); + assert.equal(languageResult.exitCode, 0); + const composition = JSON.parse(languageResult.stdout); + assert.ok(composition.languages.some((item) => item.id === 'python')); + assert.ok(composition.languages.some((item) => item.id === 'rust')); const rejected = await request(origin + '/api/cli/execute', { method: 'POST', From 8c009c5be0e65bc762c0cdcd94e6a24e768f3888 Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:27:38 +1100 Subject: [PATCH 10/37] Implement Node test and ESLint adapter discovery --- Website/roadmap-data.json | 6 +-- docs/CLI.md | 11 +++++ docs/ROADMAP.md | 4 +- src/adapters/index.js | 2 +- src/adapters/node.js | 76 ++++++++++++++++++++++++++-------- test/language-adapters.test.js | 56 +++++++++++++++++++++++++ 6 files changed, 131 insertions(+), 24 deletions(-) diff --git a/Website/roadmap-data.json b/Website/roadmap-data.json index fc6eca90..f2fa5d63 100644 --- a/Website/roadmap-data.json +++ b/Website/roadmap-data.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "totalFeatures": 1000, - "completedFeatures": 94, + "completedFeatures": 96, "domains": [ { "number": 1, @@ -526,12 +526,12 @@ }, { "id": 102, - "complete": false, + "complete": true, "title": "JavaScript runtime test adapter" }, { "id": 103, - "complete": false, + "complete": true, "title": "ESLint configuration discovery" }, { diff --git a/docs/CLI.md b/docs/CLI.md index 2938d248..a19d1b0b 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -57,6 +57,17 @@ The npm package is not yet published. Do not rely on a global registry install u See [Installation](INSTALLATION.md) for the Unix, Windows and Debian candidate workflows. +## JavaScript test and ESLint discovery + +For Node.js workspaces, FORGE discovers Node's built-in test files when the package does not declare its own `test` script. When a flat, legacy, or `package.json` ESLint configuration is present, it adds a bounded `eslint --max-warnings 0 .` verification step. A project-local `node_modules/.bin/eslint` executable is preferred; otherwise the normal platform command lookup is used. + +~~~bash +forge backends . --profile standard +forge verify . --profile standard +~~~ + +The discovery is configuration-driven: FORGE does not run ESLint in projects that have no ESLint configuration, and it does not replace a package's declared test script with a duplicate Node test invocation. + ## Local model inference and evaluation FORGE connects to Ollama at `127.0.0.1:11434`; inference does not use a hosted model service. Requests have bounded timeouts, a bounded response size and validated generation options. The result includes duration and token telemetry when the local model provider reports it. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index f2627d4f..5e46e806 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -130,8 +130,8 @@ Deterministic plans, dependency graphs, scheduling and execution safety First-class project understanding and tested adapters for real development stacks - [x] **F0101 —** TypeScript compiler adapter -- [ ] **F0102 —** JavaScript runtime test adapter -- [ ] **F0103 —** ESLint configuration discovery +- [x] **F0102 —** JavaScript runtime test adapter +- [x] **F0103 —** ESLint configuration discovery - [ ] **F0104 —** Prettier formatting adapter - [ ] **F0105 —** Biome lint and format adapter - [ ] **F0106 —** Vitest test adapter diff --git a/src/adapters/index.js b/src/adapters/index.js index 258efc8b..3624f196 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -37,7 +37,7 @@ const ADAPTERS = Object.freeze([ id: 'node', name: 'Node.js', manifests: Object.freeze(['package.json']), - checks: Object.freeze(['test']), + checks: Object.freeze(['test', 'eslint']), createChecks: createNodeChecks, }), ]); diff --git a/src/adapters/node.js b/src/adapters/node.js index 98b0f905..c79f3b27 100644 --- a/src/adapters/node.js +++ b/src/adapters/node.js @@ -1,4 +1,4 @@ -import { existsSync, readFileSync, readdirSync } from 'node:fs'; +import { existsSync, lstatSync, readFileSync, readdirSync } from 'node:fs'; import path from 'node:path'; import { makeVerificationStep } from './step.js'; @@ -7,6 +7,12 @@ const IGNORED_DIRECTORIES = new Set([ '.git', '.forge', '.next', '.turbo', '.cache', 'node_modules', 'coverage', 'dist', 'build', 'target', 'vendor', ]); +const ESLINT_CONFIG_FILES = Object.freeze([ + 'eslint.config.js', 'eslint.config.mjs', 'eslint.config.cjs', + 'eslint.config.ts', 'eslint.config.mts', 'eslint.config.cts', + '.eslintrc', '.eslintrc.js', '.eslintrc.cjs', '.eslintrc.json', + '.eslintrc.yaml', '.eslintrc.yml', +]); const MAX_DISCOVERY_ENTRIES = 20_000; const MAX_TEST_FILES = 200; @@ -59,28 +65,62 @@ export function discoverNodeTestFiles(projectRoot) { return discovered.sort(); } +function isRegularConfigFile(projectRoot, name) { + try { + const info = lstatSync(path.join(projectRoot, name)); + return info.isFile() && !info.isSymbolicLink(); + } catch (cause) { + if (cause?.code === 'ENOENT' || cause?.code === 'EACCES' || cause?.code === 'EPERM') return false; + throw cause; + } +} + +export function hasEslintConfiguration(projectRoot, manifest) { + const root = path.resolve(projectRoot); + if (ESLINT_CONFIG_FILES.some((name) => isRegularConfigFile(root, name))) return true; + return Boolean(manifest?.eslintConfig + && typeof manifest.eslintConfig === 'object' + && !Array.isArray(manifest.eslintConfig)); +} + export function createNodeChecks(projectRoot, { runtime = process.execPath, + platform = process.platform, } = {}) { - const packagePath = path.join(projectRoot, 'package.json'); - if (!existsSync(packagePath)) return []; - let manifest; - try { - manifest = JSON.parse(readFileSync(packagePath, 'utf8')); - } catch (cause) { - throw new Error('package.json is not valid JSON (' + cause.message + ')'); + const root = path.resolve(projectRoot); + const packagePath = path.join(root, 'package.json'); + let manifest = null; + if (existsSync(packagePath)) { + try { + manifest = JSON.parse(readFileSync(packagePath, 'utf8')); + } catch (cause) { + throw new Error('package.json is not valid JSON (' + cause.message + ')'); + } + if (!manifest || typeof manifest !== 'object' || Array.isArray(manifest)) { + throw new Error('package.json must contain a JSON object.'); + } } - if (!manifest || typeof manifest !== 'object' || Array.isArray(manifest)) { - throw new Error('package.json must contain a JSON object.'); + + const steps = []; + const testScript = manifest?.scripts?.test; + if (typeof testScript !== 'string' || !testScript.trim()) { + const testFiles = discoverNodeTestFiles(root); + if (testFiles.length) { + steps.push(makeVerificationStep('node', 'test', runtime, ['--test', ...testFiles], { + timeoutMs: 180_000, + })); + } } - const testScript = manifest.scripts?.test; - if (typeof testScript === 'string' && testScript.trim()) return []; - const testFiles = discoverNodeTestFiles(projectRoot); - if (!testFiles.length) return []; - return [ - makeVerificationStep('node', 'test', runtime, ['--test', ...testFiles], { + if (hasEslintConfiguration(root, manifest)) { + const executableName = platform === 'win32' ? 'eslint.cmd' : 'eslint'; + const localExecutable = path.join(root, 'node_modules', '.bin', executableName); + const command = existsSync(localExecutable) ? localExecutable : executableName; + steps.push(makeVerificationStep('node', 'eslint', command, ['--max-warnings', '0', '.'], { + shell: platform === 'win32', timeoutMs: 180_000, - }), - ]; + })); + } + + return steps; } diff --git a/test/language-adapters.test.js b/test/language-adapters.test.js index 24e5e609..2790bce7 100644 --- a/test/language-adapters.test.js +++ b/test/language-adapters.test.js @@ -28,6 +28,7 @@ test('backend registry exposes stable language identities and native manifests', assert.ok(catalog.find((item) => item.id === 'java').manifests.includes('pom.xml')); assert.ok(catalog.find((item) => item.id === 'node').manifests.includes('package.json')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('test')); + assert.ok(catalog.find((item) => item.id === 'node').checks.includes('eslint')); }); test('Python backend detects source tests and release-configured static analysis', (t) => { @@ -117,6 +118,61 @@ test('Node backend discovers built-in tests without duplicating a declared packa } }); +test('Node backend discovers flat ESLint config and runs the project-local linter', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'eslint.config.mjs'), 'export default [];\\n'); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'eslint'); + writeFileSync(executable, '#!/bin/sh\\nexit 0\\n'); + const checks = createLanguageVerificationChecks(f.root, { profile: 'standard' }); + assert.deepEqual(checks.map((step) => step.name), ['node:eslint']); + assert.equal(checks[0].command, executable); + assert.deepEqual(checks[0].args, ['--max-warnings', '0', '.']); + assert.equal(checks[0].shell, false); + assert.equal(checks[0].timeoutMs, 180_000); + } finally { + f.cleanup(); + } +}); + +test('Node backend recognises legacy and package.json ESLint configuration', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, '.eslintrc.json'), JSON.stringify({ root: true })); + const legacy = createLanguageVerificationChecks(f.root); + assert.deepEqual(legacy.map((step) => step.name), ['node:eslint']); + assert.equal(legacy[0].command, 'eslint'); + + rmSync(path.join(f.root, '.eslintrc.json')); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-eslint-inline-config', + version: '1.0.0', + eslintConfig: { root: true, env: { node: true } }, + })); + const inline = createLanguageVerificationChecks(f.root); + assert.deepEqual(inline.map((step) => step.name), ['node:eslint']); + } finally { + f.cleanup(); + } +}); + +test('Node backend uses the Windows ESLint command shim', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'eslint.config.js'), 'export default [];\\n'); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'eslint.cmd'); + writeFileSync(executable, '@echo off\\r\\nexit /b 0\\r\\n'); + const checks = createLanguageVerificationChecks(f.root, { platform: 'win32' }); + assert.deepEqual(checks.map((step) => step.name), ['node:eslint']); + assert.equal(checks[0].command, executable); + assert.equal(checks[0].shell, true); + } finally { + f.cleanup(); + } +}); + test('Go backend adds vetting and race instrumentation to the release profile', () => { const f = fixture(); try { From dd227b95161734ea8de61f261b2d8ffaa296a97f Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:29:25 +1100 Subject: [PATCH 11/37] Make roadmap completion assertions follow canonical data --- e2e/gui.playwright.mjs | 5 ++++- test/cli.test.js | 4 +++- test/gui-execution.test.js | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/e2e/gui.playwright.mjs b/e2e/gui.playwright.mjs index df973cc2..106d2e0f 100644 --- a/e2e/gui.playwright.mjs +++ b/e2e/gui.playwright.mjs @@ -7,6 +7,9 @@ import { setTimeout as delay } from 'node:timers/promises'; import { chromium } from 'playwright'; const project = await mkdtemp(path.join(os.tmpdir(), 'forge-browser-e2e-')); +const canonicalRoadmap = await readFile(path.resolve('docs/ROADMAP.md'), 'utf8'); +const canonicalCompletedFeatureCount = canonicalRoadmap.split(/\\r?\\n/) + .filter((line) => /^- \\[x\\] \\*\\*F\\d{4}/.test(line)).length; async function existingRunIds(page) { return page.evaluate(async () => { const response = await fetch('/api/verification-runs', { cache: 'no-store' }); @@ -300,7 +303,7 @@ try { await page.waitForURL('**/roadmap'); await page.locator('#roadmap-total').waitFor(); assert.equal(await page.locator('.roadmap-feature').count(), 1000); - assert.equal(await page.locator('.roadmap-feature.is-complete').count(), 94); + assert.equal(await page.locator('.roadmap-feature.is-complete').count(), canonicalCompletedFeatureCount); await page.locator('#roadmap-search').fill('F0136'); await page.waitForFunction(() => document.querySelector('#roadmap-match-count')?.textContent.includes('1 of 1')); await page.locator('[data-feature-id="F0136"]').waitFor(); diff --git a/test/cli.test.js b/test/cli.test.js index 2b0c7c12..41126fa9 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -7,6 +7,8 @@ import os from 'node:os'; import path from 'node:path'; import { request as httpRequest } from 'node:http'; import { main } from '../src/cli.js'; +const CANONICAL_ROADMAP_COMPLETED_COUNT = readFileSync(new URL('../docs/ROADMAP.md', import.meta.url), 'utf8') + .split(/\\r?\\n/).filter((line) => /^- \\[x\\] \\*\\*F\\d{4}/.test(line)).length; const PACKAGE_VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version; import { createGuiServer, getGuiOverview } from '../src/gui.js'; @@ -84,7 +86,7 @@ test('roadmap command searches the canonical feature catalogue without running p assert.equal(code, 0); const result = JSON.parse(f.out.value.trim()); assert.equal(result.totalFeatures, 1000); - assert.equal(result.completedFeatures, 94); + assert.equal(result.completedFeatures, CANONICAL_ROADMAP_COMPLETED_COUNT); assert.equal(result.matchedFeatures, 1); assert.equal(result.domains[0].features[0].featureId, 'F0136'); assert.equal(result.domains[0].features[0].title, 'Java Maven test adapter'); diff --git a/test/gui-execution.test.js b/test/gui-execution.test.js index 2bbc2d1a..ca2b8c49 100644 --- a/test/gui-execution.test.js +++ b/test/gui-execution.test.js @@ -7,6 +7,8 @@ import os from 'node:os'; import path from 'node:path'; import { setTimeout as delay } from 'node:timers/promises'; import { createGuiServer } from '../src/gui.js'; +const CANONICAL_ROADMAP_COMPLETED_COUNT = readFileSync(new URL('../docs/ROADMAP.md', import.meta.url), 'utf8') + .split(/\\r?\\n/).filter((line) => /^- \\[x\\] \\*\\*F\\d{4}/.test(line)).length; function fixture(script) { const root = mkdtempSync(path.join(os.tmpdir(), 'forge-gui-run-')); @@ -231,7 +233,7 @@ test('Control Center exposes the same authenticated, searchable 1,000-feature ro assert.equal(response.status, 200); const result = await response.json(); assert.equal(result.totalFeatures, 1000); - assert.equal(result.completedFeatures, 94); + assert.equal(result.completedFeatures, CANONICAL_ROADMAP_COMPLETED_COUNT); assert.equal(result.matchedFeatures, 1); assert.equal(result.domains.length, 1); assert.equal(result.domains[0].number, 3); From 9ca684a3800bcc82de891f5729874a42c6a6498a Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:30:14 +1100 Subject: [PATCH 12/37] Fix canonical roadmap completion counting in tests --- e2e/gui.playwright.mjs | 4 ++-- test/cli.test.js | 2 +- test/gui-execution.test.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/gui.playwright.mjs b/e2e/gui.playwright.mjs index 106d2e0f..e943b353 100644 --- a/e2e/gui.playwright.mjs +++ b/e2e/gui.playwright.mjs @@ -8,8 +8,8 @@ import { chromium } from 'playwright'; const project = await mkdtemp(path.join(os.tmpdir(), 'forge-browser-e2e-')); const canonicalRoadmap = await readFile(path.resolve('docs/ROADMAP.md'), 'utf8'); -const canonicalCompletedFeatureCount = canonicalRoadmap.split(/\\r?\\n/) - .filter((line) => /^- \\[x\\] \\*\\*F\\d{4}/.test(line)).length; +const canonicalCompletedFeatureCount = canonicalRoadmap.split(String.fromCharCode(10)) + .filter((line) => line.startsWith('- [x] **F')).length; async function existingRunIds(page) { return page.evaluate(async () => { const response = await fetch('/api/verification-runs', { cache: 'no-store' }); diff --git a/test/cli.test.js b/test/cli.test.js index 41126fa9..1e6e1d71 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -8,7 +8,7 @@ import path from 'node:path'; import { request as httpRequest } from 'node:http'; import { main } from '../src/cli.js'; const CANONICAL_ROADMAP_COMPLETED_COUNT = readFileSync(new URL('../docs/ROADMAP.md', import.meta.url), 'utf8') - .split(/\\r?\\n/).filter((line) => /^- \\[x\\] \\*\\*F\\d{4}/.test(line)).length; + .split(String.fromCharCode(10)).filter((line) => line.startsWith('- [x] **F')); const PACKAGE_VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version; import { createGuiServer, getGuiOverview } from '../src/gui.js'; diff --git a/test/gui-execution.test.js b/test/gui-execution.test.js index ca2b8c49..b71eecd3 100644 --- a/test/gui-execution.test.js +++ b/test/gui-execution.test.js @@ -8,7 +8,7 @@ import path from 'node:path'; import { setTimeout as delay } from 'node:timers/promises'; import { createGuiServer } from '../src/gui.js'; const CANONICAL_ROADMAP_COMPLETED_COUNT = readFileSync(new URL('../docs/ROADMAP.md', import.meta.url), 'utf8') - .split(/\\r?\\n/).filter((line) => /^- \\[x\\] \\*\\*F\\d{4}/.test(line)).length; + .split(String.fromCharCode(10)).filter((line) => line.startsWith('- [x] **F')); function fixture(script) { const root = mkdtempSync(path.join(os.tmpdir(), 'forge-gui-run-')); From 91e11eda4d20687b1d9c15c513304f35abe64a29 Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:31:01 +1100 Subject: [PATCH 13/37] ci(codeql): add deterministic SARIF finding inventory --- scripts/codeql-report.mjs | 127 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 scripts/codeql-report.mjs diff --git a/scripts/codeql-report.mjs b/scripts/codeql-report.mjs new file mode 100644 index 00000000..9db9bf7a --- /dev/null +++ b/scripts/codeql-report.mjs @@ -0,0 +1,127 @@ +import { lstatSync, readdirSync, readFileSync } from 'node:fs'; +import path from 'node:path'; + +const MAX_DEPTH = 4; +const MAX_FILE_BYTES = 16 * 1024 * 1024; +const MAX_RESULTS = 2000; + +function fail(message) { + process.stderr.write(message + '\n'); + process.exitCode = 1; +} + +function sarifFiles(directory, depth = 0) { + if (depth > MAX_DEPTH) throw new Error('SARIF output directory exceeds the supported nesting depth.'); + const info = lstatSync(directory); + if (info.isSymbolicLink() || !info.isDirectory()) { + throw new Error('SARIF output must be a real directory, not a symbolic link.'); + } + const files = []; + for (const entry of readdirSync(directory, { withFileTypes: true })) { + const fullPath = path.join(directory, entry.name); + const entryInfo = lstatSync(fullPath); + if (entryInfo.isSymbolicLink()) continue; + if (entryInfo.isDirectory()) { + files.push(...sarifFiles(fullPath, depth + 1)); + } else if (entryInfo.isFile() && entry.name.toLowerCase().endsWith('.sarif')) { + if (entryInfo.size > MAX_FILE_BYTES) { + throw new Error('SARIF file exceeds the 16 MiB safety limit: ' + entry.name); + } + files.push(fullPath); + } + } + return files; +} + +function physicalLocation(location) { + const physical = location?.physicalLocation; + const artifact = physical?.artifactLocation; + const region = physical?.region; + return { + uri: typeof artifact?.uri === 'string' ? artifact.uri : null, + startLine: Number.isSafeInteger(region?.startLine) ? region.startLine : null, + startColumn: Number.isSafeInteger(region?.startColumn) ? region.startColumn : null, + endLine: Number.isSafeInteger(region?.endLine) ? region.endLine : null, + }; +} + +function flowLocations(result) { + const flows = []; + for (const codeFlow of result.codeFlows || []) { + for (const threadFlow of codeFlow.threadFlows || []) { + const locations = (threadFlow.locations || []).map((item) => ({ + ...physicalLocation(item.location), + message: item.location?.message?.text || null, + })); + if (locations.length) flows.push(locations); + } + } + return flows; +} + +function severityScore(value) { + if (typeof value === 'number' && Number.isFinite(value)) return value; + if (typeof value === 'string' && value.trim() && Number.isFinite(Number(value))) { + return Number(value); + } + return 0; +} + +function collectResults(filename) { + const document = JSON.parse(readFileSync(filename, 'utf8')); + if (document.version !== '2.1.0' || !Array.isArray(document.runs)) { + throw new Error('Unsupported or malformed SARIF document: ' + path.basename(filename)); + } + const findings = []; + for (const run of document.runs) { + const rules = new Map( + (run.tool?.driver?.rules || []).map((rule) => [rule.id, rule]), + ); + for (const result of run.results || []) { + const rule = rules.get(result.ruleId) || {}; + const properties = { ...(rule.properties || {}), ...(result.properties || {}) }; + const securitySeverity = properties['security-severity'] ?? properties.securitySeverity ?? null; + const locations = (result.locations || []).map(physicalLocation); + findings.push({ + ruleId: result.ruleId || 'unknown', + ruleName: rule.name || rule.shortDescription?.text || result.ruleId || 'Unknown CodeQL rule', + level: result.level || rule.defaultConfiguration?.level || 'warning', + securitySeverity, + severityScore: severityScore(securitySeverity), + message: (result.message?.text || result.message?.markdown || 'No message supplied by CodeQL.').slice(0, 4000), + locations, + codeFlows: flowLocations(result), + partialFingerprints: result.partialFingerprints || {}, + }); + } + } + return findings; +} + +try { + const directory = path.resolve(process.cwd(), '..', 'codeql-results'); + const files = sarifFiles(directory).sort(); + if (!files.length) throw new Error('No SARIF files were produced by CodeQL.'); + const findings = files.flatMap(collectResults); + findings.sort((left, right) => ( + right.severityScore - left.severityScore + || left.ruleId.localeCompare(right.ruleId) + || String(left.locations[0]?.uri || '').localeCompare(String(right.locations[0]?.uri || '')) + || (left.locations[0]?.startLine || 0) - (right.locations[0]?.startLine || 0) + )); + const rules = [...new Set(findings.map((finding) => finding.ruleId))].sort(); + const output = { + schemaVersion: 1, + scannedAt: new Date().toISOString(), + sarifFiles: files.map((file) => path.relative(directory, file).split(path.sep).join('/')), + findingsCount: findings.length, + uniqueRuleCount: rules.length, + rules, + findings: findings.slice(0, MAX_RESULTS), + truncated: findings.length > MAX_RESULTS, + }; + process.stdout.write(JSON.stringify(output, null, 2) + '\n'); + if (output.truncated) process.exitCode = 2; +} catch (cause) { + fail(cause instanceof Error ? cause.message : String(cause)); +} From 58d01a7950a397fa03838c46d0394f732be2174b Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:31:09 +1100 Subject: [PATCH 14/37] ci(codeql): add latest development findings inventory --- .github/workflows/codeql-inventory.yml | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/codeql-inventory.yml diff --git a/.github/workflows/codeql-inventory.yml b/.github/workflows/codeql-inventory.yml new file mode 100644 index 00000000..13b4d850 --- /dev/null +++ b/.github/workflows/codeql-inventory.yml @@ -0,0 +1,35 @@ +name: CodeQL finding inventory + +on: + push: + branches: [latest/development] + workflow_dispatch: + +permissions: + contents: read + +jobs: + inventory: + name: CodeQL security and quality inventory + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: npm + - run: npm ci + - name: Initialize CodeQL for all repository source languages + uses: github/codeql-action/init@915412ff23e8b7659517e607487dbeae018f2934 # v4 + with: + languages: javascript, actions, python + queries: security-and-quality + - name: Analyze without changing GitHub alert state + uses: github/codeql-action/analyze@915412ff23e8b7659517e607487dbeae018f2934 # v4 + with: + output: ../codeql-results + upload: never + - name: Print every finding with rule, severity, location and fingerprint + run: node scripts/codeql-report.mjs From 0fc1ebf5e225be035cf67c8fe42f247294b2ef3f Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:32:40 +1100 Subject: [PATCH 15/37] Return canonical roadmap completion counts in tests --- test/cli.test.js | 2 +- test/gui-execution.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cli.test.js b/test/cli.test.js index 1e6e1d71..535c1f5f 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -8,7 +8,7 @@ import path from 'node:path'; import { request as httpRequest } from 'node:http'; import { main } from '../src/cli.js'; const CANONICAL_ROADMAP_COMPLETED_COUNT = readFileSync(new URL('../docs/ROADMAP.md', import.meta.url), 'utf8') - .split(String.fromCharCode(10)).filter((line) => line.startsWith('- [x] **F')); + .split(String.fromCharCode(10)).filter((line) => line.startsWith('- [x] **F')).length; const PACKAGE_VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version; import { createGuiServer, getGuiOverview } from '../src/gui.js'; diff --git a/test/gui-execution.test.js b/test/gui-execution.test.js index b71eecd3..6bfd8841 100644 --- a/test/gui-execution.test.js +++ b/test/gui-execution.test.js @@ -8,7 +8,7 @@ import path from 'node:path'; import { setTimeout as delay } from 'node:timers/promises'; import { createGuiServer } from '../src/gui.js'; const CANONICAL_ROADMAP_COMPLETED_COUNT = readFileSync(new URL('../docs/ROADMAP.md', import.meta.url), 'utf8') - .split(String.fromCharCode(10)).filter((line) => line.startsWith('- [x] **F')); + .split(String.fromCharCode(10)).filter((line) => line.startsWith('- [x] **F')).length; function fixture(script) { const root = mkdtempSync(path.join(os.tmpdir(), 'forge-gui-run-')); From 06ff1c6d2788de081a38f1ca0a76ddc7894c4016 Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:34:45 +1100 Subject: [PATCH 16/37] Implement Prettier configuration discovery and formatting checks --- Website/roadmap-data.json | 4 +-- docs/CLI.md | 11 +++++++ docs/ROADMAP.md | 2 +- src/adapters/index.js | 2 +- src/adapters/node.js | 25 ++++++++++++++++ test/language-adapters.test.js | 55 ++++++++++++++++++++++++++++++++++ 6 files changed, 95 insertions(+), 4 deletions(-) diff --git a/Website/roadmap-data.json b/Website/roadmap-data.json index f2fa5d63..e7b77538 100644 --- a/Website/roadmap-data.json +++ b/Website/roadmap-data.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "totalFeatures": 1000, - "completedFeatures": 96, + "completedFeatures": 97, "domains": [ { "number": 1, @@ -536,7 +536,7 @@ }, { "id": 104, - "complete": false, + "complete": true, "title": "Prettier formatting adapter" }, { diff --git a/docs/CLI.md b/docs/CLI.md index a19d1b0b..c0808826 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -68,6 +68,17 @@ forge verify . --profile standard The discovery is configuration-driven: FORGE does not run ESLint in projects that have no ESLint configuration, and it does not replace a package's declared test script with a duplicate Node test invocation. +## JavaScript formatting discovery + +For Node.js workspaces, FORGE detects Prettier configuration in `prettier.config.*`, `.prettierrc*`, and `package.json#prettier`. It adds a bounded `prettier --check .` step only when configuration is present, preferring the project-local executable and using the Windows command shim when required. + +~~~bash +forge backends . --profile standard +forge verify . --profile standard +~~~ + +The check validates formatting without modifying project files. FORGE does not silently run Prettier or reformat user source when a project has not opted into it. + ## Local model inference and evaluation FORGE connects to Ollama at `127.0.0.1:11434`; inference does not use a hosted model service. Requests have bounded timeouts, a bounded response size and validated generation options. The result includes duration and token telemetry when the local model provider reports it. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 5e46e806..f43d48d3 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -132,7 +132,7 @@ First-class project understanding and tested adapters for real development stack - [x] **F0101 —** TypeScript compiler adapter - [x] **F0102 —** JavaScript runtime test adapter - [x] **F0103 —** ESLint configuration discovery -- [ ] **F0104 —** Prettier formatting adapter +- [x] **F0104 —** Prettier formatting adapter - [ ] **F0105 —** Biome lint and format adapter - [ ] **F0106 —** Vitest test adapter - [ ] **F0107 —** Jest test adapter diff --git a/src/adapters/index.js b/src/adapters/index.js index 3624f196..0415f64d 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -37,7 +37,7 @@ const ADAPTERS = Object.freeze([ id: 'node', name: 'Node.js', manifests: Object.freeze(['package.json']), - checks: Object.freeze(['test', 'eslint']), + checks: Object.freeze(['test', 'eslint', 'prettier']), createChecks: createNodeChecks, }), ]); diff --git a/src/adapters/node.js b/src/adapters/node.js index c79f3b27..7947175f 100644 --- a/src/adapters/node.js +++ b/src/adapters/node.js @@ -13,6 +13,13 @@ const ESLINT_CONFIG_FILES = Object.freeze([ '.eslintrc', '.eslintrc.js', '.eslintrc.cjs', '.eslintrc.json', '.eslintrc.yaml', '.eslintrc.yml', ]); +const PRETTIER_CONFIG_FILES = Object.freeze([ + 'prettier.config.js', 'prettier.config.mjs', 'prettier.config.cjs', + 'prettier.config.ts', 'prettier.config.mts', 'prettier.config.cts', + '.prettierrc', '.prettierrc.json', '.prettierrc.json5', + '.prettierrc.yaml', '.prettierrc.yml', '.prettierrc.js', + '.prettierrc.mjs', '.prettierrc.cjs', '.prettierrc.toml', +]); const MAX_DISCOVERY_ENTRIES = 20_000; const MAX_TEST_FILES = 200; @@ -83,6 +90,14 @@ export function hasEslintConfiguration(projectRoot, manifest) { && !Array.isArray(manifest.eslintConfig)); } +export function hasPrettierConfiguration(projectRoot, manifest) { + const root = path.resolve(projectRoot); + if (PRETTIER_CONFIG_FILES.some((name) => isRegularConfigFile(root, name))) return true; + return Boolean(manifest?.prettier + && typeof manifest.prettier === 'object' + && !Array.isArray(manifest.prettier)); +} + export function createNodeChecks(projectRoot, { runtime = process.execPath, platform = process.platform, @@ -122,5 +137,15 @@ export function createNodeChecks(projectRoot, { })); } + if (hasPrettierConfiguration(root, manifest)) { + const executableName = platform === 'win32' ? 'prettier.cmd' : 'prettier'; + const localExecutable = path.join(root, 'node_modules', '.bin', executableName); + const command = existsSync(localExecutable) ? localExecutable : executableName; + steps.push(makeVerificationStep('node', 'prettier', command, ['--check', '.'], { + shell: platform === 'win32', + timeoutMs: 180_000, + })); + } + return steps; } diff --git a/test/language-adapters.test.js b/test/language-adapters.test.js index 2790bce7..18cf723f 100644 --- a/test/language-adapters.test.js +++ b/test/language-adapters.test.js @@ -29,6 +29,7 @@ test('backend registry exposes stable language identities and native manifests', assert.ok(catalog.find((item) => item.id === 'node').manifests.includes('package.json')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('test')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('eslint')); + assert.ok(catalog.find((item) => item.id === 'node').checks.includes('prettier')); }); test('Python backend detects source tests and release-configured static analysis', (t) => { @@ -173,6 +174,60 @@ test('Node backend uses the Windows ESLint command shim', () => { } }); +test('Node backend discovers Prettier configuration and runs the local formatter check', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'prettier.config.mjs'), 'export default {};\\n'); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'prettier'); + writeFileSync(executable, '#!/bin/sh\\nexit 0\\n'); + const checks = createLanguageVerificationChecks(f.root, { profile: 'standard' }); + assert.deepEqual(checks.map((step) => step.name), ['node:prettier']); + assert.equal(checks[0].command, executable); + assert.deepEqual(checks[0].args, ['--check', '.']); + assert.equal(checks[0].shell, false); + assert.equal(checks[0].timeoutMs, 180_000); + } finally { + f.cleanup(); + } +}); + +test('Node backend discovers package.json and legacy Prettier configuration', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, '.prettierrc.yaml'), 'singleQuote: true\\n'); + assert.deepEqual(createLanguageVerificationChecks(f.root).map((step) => step.name), ['node:prettier']); + + rmSync(path.join(f.root, '.prettierrc.yaml')); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-prettier-inline-config', + version: '1.0.0', + prettier: { singleQuote: true }, + })); + const inline = createLanguageVerificationChecks(f.root); + assert.deepEqual(inline.map((step) => step.name), ['node:prettier']); + assert.equal(inline[0].command, 'prettier'); + } finally { + f.cleanup(); + } +}); + +test('Node backend uses the Windows Prettier command shim', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, '.prettierrc'), '{}\\n'); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'prettier.cmd'); + writeFileSync(executable, '@echo off\\r\\nexit /b 0\\r\\n'); + const checks = createLanguageVerificationChecks(f.root, { platform: 'win32' }); + assert.deepEqual(checks.map((step) => step.name), ['node:prettier']); + assert.equal(checks[0].command, executable); + assert.equal(checks[0].shell, true); + } finally { + f.cleanup(); + } +}); + test('Go backend adds vetting and race instrumentation to the release profile', () => { const f = fixture(); try { From e87ac8a18634bd862058b77d8b686496dec9c39e Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:36:37 +1100 Subject: [PATCH 17/37] Implement Biome lint and formatting adapter --- Website/roadmap-data.json | 4 +-- docs/CLI.md | 11 +++++++ docs/ROADMAP.md | 2 +- src/adapters/index.js | 4 +-- src/adapters/node.js | 16 ++++++++++ test/language-adapters.test.js | 53 ++++++++++++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 5 deletions(-) diff --git a/Website/roadmap-data.json b/Website/roadmap-data.json index e7b77538..7c18802c 100644 --- a/Website/roadmap-data.json +++ b/Website/roadmap-data.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "totalFeatures": 1000, - "completedFeatures": 97, + "completedFeatures": 98, "domains": [ { "number": 1, @@ -541,7 +541,7 @@ }, { "id": 105, - "complete": false, + "complete": true, "title": "Biome lint and format adapter" }, { diff --git a/docs/CLI.md b/docs/CLI.md index c0808826..cab77522 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -79,6 +79,17 @@ forge verify . --profile standard The check validates formatting without modifying project files. FORGE does not silently run Prettier or reformat user source when a project has not opted into it. +## Biome lint and formatting discovery + +For JavaScript and TypeScript workspaces, FORGE detects root `biome.json` and `biome.jsonc` configuration files. It adds a read-only `biome check .` verification step, which combines Biome's enabled lint and formatting checks without applying changes. A project-local `node_modules/.bin/biome` executable is preferred; the Windows command shim is supported. + +~~~bash +forge backends . --profile standard +forge verify . --profile standard +~~~ + +FORGE does not invoke Biome when a workspace has no Biome configuration, and it does not install tools or change source files automatically. + ## Local model inference and evaluation FORGE connects to Ollama at `127.0.0.1:11434`; inference does not use a hosted model service. Requests have bounded timeouts, a bounded response size and validated generation options. The result includes duration and token telemetry when the local model provider reports it. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index f43d48d3..594bdf08 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -133,7 +133,7 @@ First-class project understanding and tested adapters for real development stack - [x] **F0102 —** JavaScript runtime test adapter - [x] **F0103 —** ESLint configuration discovery - [x] **F0104 —** Prettier formatting adapter -- [ ] **F0105 —** Biome lint and format adapter +- [x] **F0105 —** Biome lint and format adapter - [ ] **F0106 —** Vitest test adapter - [ ] **F0107 —** Jest test adapter - [ ] **F0108 —** Playwright test adapter diff --git a/src/adapters/index.js b/src/adapters/index.js index 0415f64d..953d6a0e 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -36,8 +36,8 @@ const ADAPTERS = Object.freeze([ Object.freeze({ id: 'node', name: 'Node.js', - manifests: Object.freeze(['package.json']), - checks: Object.freeze(['test', 'eslint', 'prettier']), + manifests: Object.freeze(['package.json', 'biome.json', 'biome.jsonc']), + checks: Object.freeze(['test', 'eslint', 'prettier', 'biome']), createChecks: createNodeChecks, }), ]); diff --git a/src/adapters/node.js b/src/adapters/node.js index 7947175f..2d8cb057 100644 --- a/src/adapters/node.js +++ b/src/adapters/node.js @@ -13,6 +13,7 @@ const ESLINT_CONFIG_FILES = Object.freeze([ '.eslintrc', '.eslintrc.js', '.eslintrc.cjs', '.eslintrc.json', '.eslintrc.yaml', '.eslintrc.yml', ]); +const BIOME_CONFIG_FILES = Object.freeze(['biome.json', 'biome.jsonc']); const PRETTIER_CONFIG_FILES = Object.freeze([ 'prettier.config.js', 'prettier.config.mjs', 'prettier.config.cjs', 'prettier.config.ts', 'prettier.config.mts', 'prettier.config.cts', @@ -98,6 +99,11 @@ export function hasPrettierConfiguration(projectRoot, manifest) { && !Array.isArray(manifest.prettier)); } +export function hasBiomeConfiguration(projectRoot) { + const root = path.resolve(projectRoot); + return BIOME_CONFIG_FILES.some((name) => isRegularConfigFile(root, name)); +} + export function createNodeChecks(projectRoot, { runtime = process.execPath, platform = process.platform, @@ -147,5 +153,15 @@ export function createNodeChecks(projectRoot, { })); } + if (hasBiomeConfiguration(root)) { + const executableName = platform === 'win32' ? 'biome.cmd' : 'biome'; + const localExecutable = path.join(root, 'node_modules', '.bin', executableName); + const command = existsSync(localExecutable) ? localExecutable : executableName; + steps.push(makeVerificationStep('node', 'biome', command, ['check', '.'], { + shell: platform === 'win32', + timeoutMs: 180_000, + })); + } + return steps; } diff --git a/test/language-adapters.test.js b/test/language-adapters.test.js index 18cf723f..8367e965 100644 --- a/test/language-adapters.test.js +++ b/test/language-adapters.test.js @@ -30,6 +30,8 @@ test('backend registry exposes stable language identities and native manifests', assert.ok(catalog.find((item) => item.id === 'node').checks.includes('test')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('eslint')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('prettier')); + assert.ok(catalog.find((item) => item.id === 'node').checks.includes('biome')); + assert.ok(catalog.find((item) => item.id === 'node').manifests.includes('biome.jsonc')); }); test('Python backend detects source tests and release-configured static analysis', (t) => { @@ -228,6 +230,57 @@ test('Node backend uses the Windows Prettier command shim', () => { } }); +test('Node backend discovers Biome config and runs the local combined check', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'biome.json'), JSON.stringify({ + '$schema': 'https://biomejs.dev/schemas/2.0.0/schema.json', + formatter: { enabled: true }, + linter: { enabled: true }, + })); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'biome'); + writeFileSync(executable, '#!/bin/sh\\nexit 0\\n'); + const checks = createLanguageVerificationChecks(f.root, { profile: 'standard' }); + assert.deepEqual(checks.map((step) => step.name), ['node:biome']); + assert.equal(checks[0].command, executable); + assert.deepEqual(checks[0].args, ['check', '.']); + assert.equal(checks[0].shell, false); + assert.equal(checks[0].timeoutMs, 180_000); + } finally { + f.cleanup(); + } +}); + +test('Node backend accepts Biome JSONC configuration and falls back to platform lookup', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'biome.jsonc'), '{ // local configuration\\n "formatter": { "enabled": true }\\n}\\n'); + const checks = createLanguageVerificationChecks(f.root); + assert.deepEqual(checks.map((step) => step.name), ['node:biome']); + assert.equal(checks[0].command, 'biome'); + assert.equal(checks[0].shell, false); + } finally { + f.cleanup(); + } +}); + +test('Node backend uses the Windows Biome command shim', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'biome.json'), '{}\\n'); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'biome.cmd'); + writeFileSync(executable, '@echo off\\r\\nexit /b 0\\r\\n'); + const checks = createLanguageVerificationChecks(f.root, { platform: 'win32' }); + assert.deepEqual(checks.map((step) => step.name), ['node:biome']); + assert.equal(checks[0].command, executable); + assert.equal(checks[0].shell, true); + } finally { + f.cleanup(); + } +}); + test('Go backend adds vetting and race instrumentation to the release profile', () => { const f = fixture(); try { From cde7cd9850174a949cea0dbf8ff7072570696c6b Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:38:51 +1100 Subject: [PATCH 18/37] Implement Vitest-aware Node test adapter --- Website/roadmap-data.json | 4 +- docs/CLI.md | 9 +++++ docs/ROADMAP.md | 2 +- src/adapters/index.js | 2 +- src/adapters/node.js | 8 +++- src/adapters/vitest.js | 55 ++++++++++++++++++++++++++ test/language-adapters.test.js | 71 ++++++++++++++++++++++++++++++++++ 7 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 src/adapters/vitest.js diff --git a/Website/roadmap-data.json b/Website/roadmap-data.json index 7c18802c..ab4f5bbd 100644 --- a/Website/roadmap-data.json +++ b/Website/roadmap-data.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "totalFeatures": 1000, - "completedFeatures": 98, + "completedFeatures": 99, "domains": [ { "number": 1, @@ -546,7 +546,7 @@ }, { "id": 106, - "complete": false, + "complete": true, "title": "Vitest test adapter" }, { diff --git a/docs/CLI.md b/docs/CLI.md index cab77522..c7e086e9 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -90,6 +90,15 @@ forge verify . --profile standard FORGE does not invoke Biome when a workspace has no Biome configuration, and it does not install tools or change source files automatically. +## Vitest project detection + +When a workspace has a root `vitest.config.*` or `vitest.workspace.*` file, or declares Vitest in its dependencies, FORGE runs `vitest run` as the Node test adapter. It prefers the local executable and uses a bounded timeout. The generic Node built-in test scanner is suppressed for that workspace, preventing duplicate test execution. An explicit package `scripts.test` remains authoritative and is never replaced. + +~~~bash +forge backends . --profile standard +forge verify . --profile standard +~~~ + ## Local model inference and evaluation FORGE connects to Ollama at `127.0.0.1:11434`; inference does not use a hosted model service. Requests have bounded timeouts, a bounded response size and validated generation options. The result includes duration and token telemetry when the local model provider reports it. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 594bdf08..87f119bc 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -134,7 +134,7 @@ First-class project understanding and tested adapters for real development stack - [x] **F0103 —** ESLint configuration discovery - [x] **F0104 —** Prettier formatting adapter - [x] **F0105 —** Biome lint and format adapter -- [ ] **F0106 —** Vitest test adapter +- [x] **F0106 —** Vitest test adapter - [ ] **F0107 —** Jest test adapter - [ ] **F0108 —** Playwright test adapter - [ ] **F0109 —** Cypress test adapter diff --git a/src/adapters/index.js b/src/adapters/index.js index 953d6a0e..8ad36148 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -37,7 +37,7 @@ const ADAPTERS = Object.freeze([ id: 'node', name: 'Node.js', manifests: Object.freeze(['package.json', 'biome.json', 'biome.jsonc']), - checks: Object.freeze(['test', 'eslint', 'prettier', 'biome']), + checks: Object.freeze(['test', 'eslint', 'prettier', 'biome', 'vitest']), createChecks: createNodeChecks, }), ]); diff --git a/src/adapters/node.js b/src/adapters/node.js index 2d8cb057..cd741661 100644 --- a/src/adapters/node.js +++ b/src/adapters/node.js @@ -1,6 +1,7 @@ import { existsSync, lstatSync, readFileSync, readdirSync } from 'node:fs'; import path from 'node:path'; import { makeVerificationStep } from './step.js'; +import { createVitestChecks } from './vitest.js'; const NODE_TEST_EXTENSIONS = new Set(['.js', '.cjs', '.mjs']); const IGNORED_DIRECTORIES = new Set([ @@ -124,7 +125,12 @@ export function createNodeChecks(projectRoot, { const steps = []; const testScript = manifest?.scripts?.test; - if (typeof testScript !== 'string' || !testScript.trim()) { + const vitestChecks = typeof testScript === 'string' && testScript.trim() + ? [] + : createVitestChecks(root, { manifest, platform }); + if (vitestChecks.length) { + steps.push(...vitestChecks); + } else if (typeof testScript !== 'string' || !testScript.trim()) { const testFiles = discoverNodeTestFiles(root); if (testFiles.length) { steps.push(makeVerificationStep('node', 'test', runtime, ['--test', ...testFiles], { diff --git a/src/adapters/vitest.js b/src/adapters/vitest.js new file mode 100644 index 00000000..26cb79f7 --- /dev/null +++ b/src/adapters/vitest.js @@ -0,0 +1,55 @@ +import { existsSync, lstatSync } from 'node:fs'; +import path from 'node:path'; +import { makeVerificationStep } from './step.js'; + +const VITEST_CONFIG_FILES = Object.freeze([ + 'vitest.config.js', 'vitest.config.mjs', 'vitest.config.cjs', + 'vitest.config.ts', 'vitest.config.mts', 'vitest.config.cts', + 'vitest.workspace.js', 'vitest.workspace.mjs', 'vitest.workspace.cjs', + 'vitest.workspace.ts', 'vitest.workspace.mts', 'vitest.workspace.cts', +]); + +function hasRegularConfig(projectRoot) { + for (const name of VITEST_CONFIG_FILES) { + try { + const info = lstatSync(path.join(projectRoot, name)); + if (info.isFile() && !info.isSymbolicLink()) return true; + } catch (cause) { + if (cause?.code === 'ENOENT' || cause?.code === 'EACCES' || cause?.code === 'EPERM') continue; + throw cause; + } + } + return false; +} + +function declaresVitest(manifest) { + for (const section of ['dependencies', 'devDependencies', 'optionalDependencies']) { + const dependencies = manifest?.[section]; + if (dependencies && typeof dependencies === 'object' && !Array.isArray(dependencies) + && typeof dependencies.vitest === 'string' && dependencies.vitest.trim()) { + return true; + } + } + return false; +} + +export function hasVitestConfiguration(projectRoot, manifest) { + return hasRegularConfig(path.resolve(projectRoot)) || declaresVitest(manifest); +} + +export function createVitestChecks(projectRoot, { + manifest, + platform = process.platform, +} = {}) { + const root = path.resolve(projectRoot); + if (!manifest || !hasVitestConfiguration(root, manifest)) return []; + const executableName = platform === 'win32' ? 'vitest.cmd' : 'vitest'; + const localExecutable = path.join(root, 'node_modules', '.bin', executableName); + const command = existsSync(localExecutable) ? localExecutable : executableName; + return [ + makeVerificationStep('node', 'vitest', command, ['run'], { + shell: platform === 'win32', + timeoutMs: 240_000, + }), + ]; +} diff --git a/test/language-adapters.test.js b/test/language-adapters.test.js index 8367e965..8ebc3211 100644 --- a/test/language-adapters.test.js +++ b/test/language-adapters.test.js @@ -31,6 +31,7 @@ test('backend registry exposes stable language identities and native manifests', assert.ok(catalog.find((item) => item.id === 'node').checks.includes('eslint')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('prettier')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('biome')); + assert.ok(catalog.find((item) => item.id === 'node').checks.includes('vitest')); assert.ok(catalog.find((item) => item.id === 'node').manifests.includes('biome.jsonc')); }); @@ -281,6 +282,76 @@ test('Node backend uses the Windows Biome command shim', () => { } }); +test('Vitest config invokes vitest run and suppresses duplicate Node built-in test discovery', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'vitest.config.ts'), 'import { defineConfig } from "vitest/config";\\nexport default defineConfig({ test: { environment: "node" } });\\n'); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-vitest-fixture', + version: '1.0.0', + devDependencies: { vitest: '^3.0.0' }, + })); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'vitest'); + writeFileSync(executable, '#!/bin/sh\\nexit 0\\n'); + mkdirSync(path.join(f.root, 'test')); + writeFileSync(path.join(f.root, 'test', 'legacy.test.js'), 'import test from "node:test";\\n'); + const checks = createLanguageVerificationChecks(f.root); + assert.deepEqual(checks.map((step) => step.name), ['node:vitest']); + assert.equal(checks[0].command, executable); + assert.deepEqual(checks[0].args, ['run']); + assert.equal(checks[0].shell, false); + assert.equal(checks[0].timeoutMs, 240_000); + } finally { + f.cleanup(); + } +}); + +test('Vitest detection supports workspace config and dependency-only setups without local CLI installs', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'vitest.workspace.mjs'), 'export default [];\\n'); + const workspace = createLanguageVerificationChecks(f.root); + assert.deepEqual(workspace.map((step) => step.name), ['node:vitest']); + assert.equal(workspace[0].command, 'vitest'); + + rmSync(path.join(f.root, 'vitest.workspace.mjs')); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-vitest-dependency-only', + version: '1.0.0', + dependencies: { vitest: '^3.0.0' }, + })); + const dependencyOnly = createLanguageVerificationChecks(f.root); + assert.deepEqual(dependencyOnly.map((step) => step.name), ['node:vitest']); + } finally { + f.cleanup(); + } +}); + +test('Vitest backend uses the Windows command shim and respects a declared test script', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'vitest.config.js'), 'export default {};\\n'); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'vitest.cmd'); + writeFileSync(executable, '@echo off\\r\\nexit /b 0\\r\\n'); + const checks = createLanguageVerificationChecks(f.root, { platform: 'win32' }); + assert.deepEqual(checks.map((step) => step.name), ['node:vitest']); + assert.equal(checks[0].command, executable); + assert.equal(checks[0].shell, true); + + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-vitest-user-script', + version: '1.0.0', + scripts: { test: 'vitest run --passWithNoTests' }, + devDependencies: { vitest: '^3.0.0' }, + })); + assert.deepEqual(createLanguageVerificationChecks(f.root, { platform: 'win32' }), []); + } finally { + f.cleanup(); + } +}); + test('Go backend adds vetting and race instrumentation to the release profile', () => { const f = fixture(); try { From 43dfe2d6503e3f728a99518e6bca61b5df09468b Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:39:19 +1100 Subject: [PATCH 19/37] Allow Vitest config without a package manifest --- src/adapters/vitest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapters/vitest.js b/src/adapters/vitest.js index 26cb79f7..701d5c51 100644 --- a/src/adapters/vitest.js +++ b/src/adapters/vitest.js @@ -42,7 +42,7 @@ export function createVitestChecks(projectRoot, { platform = process.platform, } = {}) { const root = path.resolve(projectRoot); - if (!manifest || !hasVitestConfiguration(root, manifest)) return []; + if (!hasVitestConfiguration(root, manifest)) return []; const executableName = platform === 'win32' ? 'vitest.cmd' : 'vitest'; const localExecutable = path.join(root, 'node_modules', '.bin', executableName); const command = existsSync(localExecutable) ? localExecutable : executableName; From 5dc84eba1d60144e930a6715b082310b268bdaa6 Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:41:40 +1100 Subject: [PATCH 20/37] Implement Jest-aware Node test adapter --- Website/roadmap-data.json | 4 +- docs/CLI.md | 11 +++++ docs/ROADMAP.md | 2 +- src/adapters/index.js | 2 +- src/adapters/jest.js | 57 ++++++++++++++++++++++ src/adapters/node.js | 12 +++-- test/language-adapters.test.js | 88 ++++++++++++++++++++++++++++++++++ 7 files changed, 168 insertions(+), 8 deletions(-) create mode 100644 src/adapters/jest.js diff --git a/Website/roadmap-data.json b/Website/roadmap-data.json index ab4f5bbd..b9dfcb2e 100644 --- a/Website/roadmap-data.json +++ b/Website/roadmap-data.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "totalFeatures": 1000, - "completedFeatures": 99, + "completedFeatures": 100, "domains": [ { "number": 1, @@ -551,7 +551,7 @@ }, { "id": 107, - "complete": false, + "complete": true, "title": "Jest test adapter" }, { diff --git a/docs/CLI.md b/docs/CLI.md index c7e086e9..92c57e19 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -99,6 +99,17 @@ forge backends . --profile standard forge verify . --profile standard ~~~ +## Jest project detection + +FORGE detects root `jest.config.*`, `package.json#jest`, or a declared Jest dependency. It runs `jest --runInBand` with a bounded timeout, preferring the project-local executable and supporting the Windows command shim. As with Vitest, the generic Node built-in test scanner is suppressed when a configured test framework is detected. An explicit `scripts.test` remains authoritative. + +~~~bash +forge backends . --profile standard +forge verify . --profile standard +~~~ + +Projects that explicitly configure both Jest and Vitest receive separate framework checks; FORGE does not guess which runner should be removed. + ## Local model inference and evaluation FORGE connects to Ollama at `127.0.0.1:11434`; inference does not use a hosted model service. Requests have bounded timeouts, a bounded response size and validated generation options. The result includes duration and token telemetry when the local model provider reports it. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 87f119bc..c5e4ae8b 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -135,7 +135,7 @@ First-class project understanding and tested adapters for real development stack - [x] **F0104 —** Prettier formatting adapter - [x] **F0105 —** Biome lint and format adapter - [x] **F0106 —** Vitest test adapter -- [ ] **F0107 —** Jest test adapter +- [x] **F0107 —** Jest test adapter - [ ] **F0108 —** Playwright test adapter - [ ] **F0109 —** Cypress test adapter - [x] **F0110 —** Node.js built-in test adapter diff --git a/src/adapters/index.js b/src/adapters/index.js index 8ad36148..ca0ad915 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -37,7 +37,7 @@ const ADAPTERS = Object.freeze([ id: 'node', name: 'Node.js', manifests: Object.freeze(['package.json', 'biome.json', 'biome.jsonc']), - checks: Object.freeze(['test', 'eslint', 'prettier', 'biome', 'vitest']), + checks: Object.freeze(['test', 'eslint', 'prettier', 'biome', 'vitest', 'jest']), createChecks: createNodeChecks, }), ]); diff --git a/src/adapters/jest.js b/src/adapters/jest.js new file mode 100644 index 00000000..6ba62a06 --- /dev/null +++ b/src/adapters/jest.js @@ -0,0 +1,57 @@ +import { existsSync, lstatSync } from 'node:fs'; +import path from 'node:path'; +import { makeVerificationStep } from './step.js'; + +const JEST_CONFIG_FILES = Object.freeze([ + 'jest.config.js', 'jest.config.mjs', 'jest.config.cjs', + 'jest.config.ts', 'jest.config.mts', 'jest.config.cts', + 'jest.config.json', +]); + +function hasRegularJestConfig(projectRoot) { + for (const name of JEST_CONFIG_FILES) { + try { + const info = lstatSync(path.join(projectRoot, name)); + if (info.isFile() && !info.isSymbolicLink()) return true; + } catch (cause) { + if (cause?.code === 'ENOENT' || cause?.code === 'EACCES' || cause?.code === 'EPERM') continue; + throw cause; + } + } + return false; +} + +function declaresJest(manifest) { + for (const section of ['dependencies', 'devDependencies', 'optionalDependencies']) { + const dependencies = manifest?.[section]; + if (dependencies && typeof dependencies === 'object' && !Array.isArray(dependencies) + && typeof dependencies.jest === 'string' && dependencies.jest.trim()) { + return true; + } + } + return false; +} + +export function hasJestConfiguration(projectRoot, manifest) { + const root = path.resolve(projectRoot); + return hasRegularJestConfig(root) + || Boolean(manifest?.jest && typeof manifest.jest === 'object' && !Array.isArray(manifest.jest)) + || declaresJest(manifest); +} + +export function createJestChecks(projectRoot, { + manifest, + platform = process.platform, +} = {}) { + const root = path.resolve(projectRoot); + if (!hasJestConfiguration(root, manifest)) return []; + const executableName = platform === 'win32' ? 'jest.cmd' : 'jest'; + const localExecutable = path.join(root, 'node_modules', '.bin', executableName); + const command = existsSync(localExecutable) ? localExecutable : executableName; + return [ + makeVerificationStep('node', 'jest', command, ['--runInBand'], { + shell: platform === 'win32', + timeoutMs: 240_000, + }), + ]; +} diff --git a/src/adapters/node.js b/src/adapters/node.js index cd741661..7484f7e5 100644 --- a/src/adapters/node.js +++ b/src/adapters/node.js @@ -2,6 +2,7 @@ import { existsSync, lstatSync, readFileSync, readdirSync } from 'node:fs'; import path from 'node:path'; import { makeVerificationStep } from './step.js'; import { createVitestChecks } from './vitest.js'; +import { createJestChecks } from './jest.js'; const NODE_TEST_EXTENSIONS = new Set(['.js', '.cjs', '.mjs']); const IGNORED_DIRECTORIES = new Set([ @@ -125,11 +126,14 @@ export function createNodeChecks(projectRoot, { const steps = []; const testScript = manifest?.scripts?.test; - const vitestChecks = typeof testScript === 'string' && testScript.trim() + const frameworkChecks = typeof testScript === 'string' && testScript.trim() ? [] - : createVitestChecks(root, { manifest, platform }); - if (vitestChecks.length) { - steps.push(...vitestChecks); + : [ + ...createVitestChecks(root, { manifest, platform }), + ...createJestChecks(root, { manifest, platform }), + ]; + if (frameworkChecks.length) { + steps.push(...frameworkChecks); } else if (typeof testScript !== 'string' || !testScript.trim()) { const testFiles = discoverNodeTestFiles(root); if (testFiles.length) { diff --git a/test/language-adapters.test.js b/test/language-adapters.test.js index 8ebc3211..61369a20 100644 --- a/test/language-adapters.test.js +++ b/test/language-adapters.test.js @@ -32,6 +32,7 @@ test('backend registry exposes stable language identities and native manifests', assert.ok(catalog.find((item) => item.id === 'node').checks.includes('prettier')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('biome')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('vitest')); + assert.ok(catalog.find((item) => item.id === 'node').checks.includes('jest')); assert.ok(catalog.find((item) => item.id === 'node').manifests.includes('biome.jsonc')); }); @@ -352,6 +353,93 @@ test('Vitest backend uses the Windows command shim and respects a declared test } }); +test('Jest config invokes Jest in-band and prevents duplicate Node/Vitest test runs', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'jest.config.cjs'), 'module.exports = { testEnvironment: "node" };\\n'); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-jest-fixture', + version: '1.0.0', + devDependencies: { jest: '^30.0.0' }, + })); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'jest'); + writeFileSync(executable, '#!/bin/sh\\nexit 0\\n'); + mkdirSync(path.join(f.root, 'test')); + writeFileSync(path.join(f.root, 'test', 'legacy.test.js'), 'throw new Error("must not run with Jest");\\n'); + const checks = createLanguageVerificationChecks(f.root); + assert.deepEqual(checks.map((step) => step.name), ['node:jest']); + assert.equal(checks[0].command, executable); + assert.deepEqual(checks[0].args, ['--runInBand']); + assert.equal(checks[0].shell, false); + assert.equal(checks[0].timeoutMs, 240_000); + } finally { + f.cleanup(); + } +}); + +test('Jest detection supports package.json configuration and dependency-only setups', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-jest-inline-config', + version: '1.0.0', + jest: { testEnvironment: 'node' }, + })); + const inline = createLanguageVerificationChecks(f.root); + assert.deepEqual(inline.map((step) => step.name), ['node:jest']); + + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-jest-dependency-only', + version: '1.0.0', + dependencies: { jest: '^30.0.0' }, + })); + assert.deepEqual(createLanguageVerificationChecks(f.root).map((step) => step.name), ['node:jest']); + } finally { + f.cleanup(); + } +}); + +test('Jest config uses the Windows command shim and explicit package test scripts remain authoritative', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'jest.config.js'), 'module.exports = {};\\n'); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'jest.cmd'); + writeFileSync(executable, '@echo off\\r\\nexit /b 0\\r\\n'); + const checks = createLanguageVerificationChecks(f.root, { platform: 'win32' }); + assert.deepEqual(checks.map((step) => step.name), ['node:jest']); + assert.equal(checks[0].command, executable); + assert.equal(checks[0].shell, true); + + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-jest-user-script', + version: '1.0.0', + scripts: { test: 'jest --runInBand' }, + devDependencies: { jest: '^30.0.0' }, + })); + assert.deepEqual(createLanguageVerificationChecks(f.root, { platform: 'win32' }), []); + } finally { + f.cleanup(); + } +}); + +test('Vitest and Jest adapters can coexist when both are explicitly configured', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'vitest.config.ts'), 'export default {};\\n'); + writeFileSync(path.join(f.root, 'jest.config.cjs'), 'module.exports = {};\\n'); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-multi-runner-fixture', + version: '1.0.0', + devDependencies: { vitest: '^3.0.0', jest: '^30.0.0' }, + })); + assert.deepEqual(createLanguageVerificationChecks(f.root).map((step) => step.name), ['node:vitest', 'node:jest']); + } finally { + f.cleanup(); + } +}); + test('Go backend adds vetting and race instrumentation to the release profile', () => { const f = fixture(); try { From 42e03e4c6505cf254e9c8602dba1d66d1097e938 Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:43:56 +1100 Subject: [PATCH 21/37] Implement Playwright-aware Node test adapter --- Website/roadmap-data.json | 4 +- docs/CLI.md | 11 ++++++ docs/ROADMAP.md | 2 +- src/adapters/index.js | 4 +- src/adapters/node.js | 2 + src/adapters/playwright.js | 55 +++++++++++++++++++++++++++ test/language-adapters.test.js | 69 ++++++++++++++++++++++++++++++++++ 7 files changed, 142 insertions(+), 5 deletions(-) create mode 100644 src/adapters/playwright.js diff --git a/Website/roadmap-data.json b/Website/roadmap-data.json index b9dfcb2e..34c8fa5d 100644 --- a/Website/roadmap-data.json +++ b/Website/roadmap-data.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "totalFeatures": 1000, - "completedFeatures": 100, + "completedFeatures": 101, "domains": [ { "number": 1, @@ -556,7 +556,7 @@ }, { "id": 108, - "complete": false, + "complete": true, "title": "Playwright test adapter" }, { diff --git a/docs/CLI.md b/docs/CLI.md index 92c57e19..90fa96ad 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -110,6 +110,17 @@ forge verify . --profile standard Projects that explicitly configure both Jest and Vitest receive separate framework checks; FORGE does not guess which runner should be removed. +## Playwright test discovery + +FORGE detects root `playwright.config.*` files or a declared `@playwright/test` dependency. It runs the Playwright test runner with `playwright test`, using the project-local executable when available and the Windows command shim where required. A bounded timeout is applied, and generic Node built-in test discovery is suppressed to prevent duplicate test execution. An explicit `scripts.test` remains authoritative. + +~~~bash +forge backends . --profile standard +forge verify . --profile standard +~~~ + +Browser binaries remain the project's responsibility; FORGE does not download browsers or modify the Playwright configuration automatically. + ## Local model inference and evaluation FORGE connects to Ollama at `127.0.0.1:11434`; inference does not use a hosted model service. Requests have bounded timeouts, a bounded response size and validated generation options. The result includes duration and token telemetry when the local model provider reports it. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index c5e4ae8b..1f92d761 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -136,7 +136,7 @@ First-class project understanding and tested adapters for real development stack - [x] **F0105 —** Biome lint and format adapter - [x] **F0106 —** Vitest test adapter - [x] **F0107 —** Jest test adapter -- [ ] **F0108 —** Playwright test adapter +- [x] **F0108 —** Playwright test adapter - [ ] **F0109 —** Cypress test adapter - [x] **F0110 —** Node.js built-in test adapter - [ ] **F0111 —** pnpm workspace adapter diff --git a/src/adapters/index.js b/src/adapters/index.js index ca0ad915..16f3817a 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -36,8 +36,8 @@ const ADAPTERS = Object.freeze([ Object.freeze({ id: 'node', name: 'Node.js', - manifests: Object.freeze(['package.json', 'biome.json', 'biome.jsonc']), - checks: Object.freeze(['test', 'eslint', 'prettier', 'biome', 'vitest', 'jest']), + manifests: Object.freeze(['package.json', 'biome.json', 'biome.jsonc', 'playwright.config.ts']), + checks: Object.freeze(['test', 'eslint', 'prettier', 'biome', 'vitest', 'jest', 'playwright']), createChecks: createNodeChecks, }), ]); diff --git a/src/adapters/node.js b/src/adapters/node.js index 7484f7e5..120085ca 100644 --- a/src/adapters/node.js +++ b/src/adapters/node.js @@ -3,6 +3,7 @@ import path from 'node:path'; import { makeVerificationStep } from './step.js'; import { createVitestChecks } from './vitest.js'; import { createJestChecks } from './jest.js'; +import { createPlaywrightChecks } from './playwright.js'; const NODE_TEST_EXTENSIONS = new Set(['.js', '.cjs', '.mjs']); const IGNORED_DIRECTORIES = new Set([ @@ -131,6 +132,7 @@ export function createNodeChecks(projectRoot, { : [ ...createVitestChecks(root, { manifest, platform }), ...createJestChecks(root, { manifest, platform }), + ...createPlaywrightChecks(root, { manifest, platform }), ]; if (frameworkChecks.length) { steps.push(...frameworkChecks); diff --git a/src/adapters/playwright.js b/src/adapters/playwright.js new file mode 100644 index 00000000..70222684 --- /dev/null +++ b/src/adapters/playwright.js @@ -0,0 +1,55 @@ +import { existsSync, lstatSync } from 'node:fs'; +import path from 'node:path'; +import { makeVerificationStep } from './step.js'; + +const PLAYWRIGHT_CONFIG_FILES = Object.freeze([ + 'playwright.config.js', 'playwright.config.mjs', 'playwright.config.cjs', + 'playwright.config.ts', 'playwright.config.mts', 'playwright.config.cts', +]); + +function hasRegularPlaywrightConfig(projectRoot) { + for (const name of PLAYWRIGHT_CONFIG_FILES) { + try { + const info = lstatSync(path.join(projectRoot, name)); + if (info.isFile() && !info.isSymbolicLink()) return true; + } catch (cause) { + if (cause?.code === 'ENOENT' || cause?.code === 'EACCES' || cause?.code === 'EPERM') continue; + throw cause; + } + } + return false; +} + +function declaresPlaywrightTest(manifest) { + for (const section of ['dependencies', 'devDependencies', 'optionalDependencies']) { + const dependencies = manifest?.[section]; + if (dependencies && typeof dependencies === 'object' && !Array.isArray(dependencies) + && typeof dependencies['@playwright/test'] === 'string' + && dependencies['@playwright/test'].trim()) { + return true; + } + } + return false; +} + +export function hasPlaywrightConfiguration(projectRoot, manifest) { + const root = path.resolve(projectRoot); + return hasRegularPlaywrightConfig(root) || declaresPlaywrightTest(manifest); +} + +export function createPlaywrightChecks(projectRoot, { + manifest, + platform = process.platform, +} = {}) { + const root = path.resolve(projectRoot); + if (!hasPlaywrightConfiguration(root, manifest)) return []; + const executableName = platform === 'win32' ? 'playwright.cmd' : 'playwright'; + const localExecutable = path.join(root, 'node_modules', '.bin', executableName); + const command = existsSync(localExecutable) ? localExecutable : executableName; + return [ + makeVerificationStep('node', 'playwright', command, ['test'], { + shell: platform === 'win32', + timeoutMs: 300_000, + }), + ]; +} diff --git a/test/language-adapters.test.js b/test/language-adapters.test.js index 61369a20..c88030c8 100644 --- a/test/language-adapters.test.js +++ b/test/language-adapters.test.js @@ -33,6 +33,7 @@ test('backend registry exposes stable language identities and native manifests', assert.ok(catalog.find((item) => item.id === 'node').checks.includes('biome')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('vitest')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('jest')); + assert.ok(catalog.find((item) => item.id === 'node').checks.includes('playwright')); assert.ok(catalog.find((item) => item.id === 'node').manifests.includes('biome.jsonc')); }); @@ -440,6 +441,74 @@ test('Vitest and Jest adapters can coexist when both are explicitly configured', } }); +test('Playwright config invokes the test runner and suppresses duplicate Node tests', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'playwright.config.ts'), 'import { defineConfig } from "@playwright/test";\\nexport default defineConfig({ testDir: "./e2e" });\\n'); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-playwright-fixture', + version: '1.0.0', + devDependencies: { '@playwright/test': '^1.52.0' }, + })); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'playwright'); + writeFileSync(executable, '#!/bin/sh\\nexit 0\\n'); + mkdirSync(path.join(f.root, 'test')); + writeFileSync(path.join(f.root, 'test', 'old.test.js'), 'throw new Error("must not run twice");\\n'); + const checks = createLanguageVerificationChecks(f.root); + assert.deepEqual(checks.map((step) => step.name), ['node:playwright']); + assert.equal(checks[0].command, executable); + assert.deepEqual(checks[0].args, ['test']); + assert.equal(checks[0].shell, false); + assert.equal(checks[0].timeoutMs, 300_000); + } finally { + f.cleanup(); + } +}); + +test('Playwright detection supports config-only and dependency-only projects', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'playwright.config.mjs'), 'export default {};\\n'); + assert.deepEqual(createLanguageVerificationChecks(f.root).map((step) => step.name), ['node:playwright']); + + rmSync(path.join(f.root, 'playwright.config.mjs')); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-playwright-dependency-only', + version: '1.0.0', + dependencies: { '@playwright/test': '^1.52.0' }, + })); + assert.deepEqual(createLanguageVerificationChecks(f.root).map((step) => step.name), ['node:playwright']); + assert.equal(createLanguageVerificationChecks(f.root)[0].command, 'playwright'); + } finally { + f.cleanup(); + } +}); + +test('Playwright adapter uses the Windows command shim and respects declared test scripts', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'playwright.config.js'), 'module.exports = {};\\n'); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'playwright.cmd'); + writeFileSync(executable, '@echo off\\r\\nexit /b 0\\r\\n'); + const checks = createLanguageVerificationChecks(f.root, { platform: 'win32' }); + assert.deepEqual(checks.map((step) => step.name), ['node:playwright']); + assert.equal(checks[0].command, executable); + assert.equal(checks[0].shell, true); + + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-playwright-user-script', + version: '1.0.0', + scripts: { test: 'playwright test' }, + devDependencies: { '@playwright/test': '^1.52.0' }, + })); + assert.deepEqual(createLanguageVerificationChecks(f.root, { platform: 'win32' }), []); + } finally { + f.cleanup(); + } +}); + test('Go backend adds vetting and race instrumentation to the release profile', () => { const f = fixture(); try { From f129e628e96f7b281dc97d39b0e7caf14b23a375 Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:47:21 +1100 Subject: [PATCH 22/37] Implement Cypress-aware Node test adapter --- Website/roadmap-data.json | 4 +- docs/CLI.md | 11 ++++++ docs/ROADMAP.md | 2 +- src/adapters/cypress.js | 53 ++++++++++++++++++++++++++ src/adapters/index.js | 4 +- src/adapters/node.js | 2 + test/language-adapters.test.js | 69 ++++++++++++++++++++++++++++++++++ 7 files changed, 140 insertions(+), 5 deletions(-) create mode 100644 src/adapters/cypress.js diff --git a/Website/roadmap-data.json b/Website/roadmap-data.json index 34c8fa5d..1a82e163 100644 --- a/Website/roadmap-data.json +++ b/Website/roadmap-data.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "totalFeatures": 1000, - "completedFeatures": 101, + "completedFeatures": 102, "domains": [ { "number": 1, @@ -561,7 +561,7 @@ }, { "id": 109, - "complete": false, + "complete": true, "title": "Cypress test adapter" }, { diff --git a/docs/CLI.md b/docs/CLI.md index 90fa96ad..69f44326 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -121,6 +121,17 @@ forge verify . --profile standard Browser binaries remain the project's responsibility; FORGE does not download browsers or modify the Playwright configuration automatically. +## Cypress test discovery + +FORGE detects root `cypress.config.*` files or a declared Cypress dependency. It runs the non-interactive `cypress run` command, preferring the project-local executable and supporting the Windows command shim. A bounded timeout is applied and generic Node built-in test discovery is suppressed to avoid duplicate test execution. An explicit `scripts.test` remains authoritative. + +~~~bash +forge backends . --profile standard +forge verify . --profile standard +~~~ + +Cypress browser/runtime installation remains managed by the project; FORGE does not download browser binaries or change the Cypress configuration. + ## Local model inference and evaluation FORGE connects to Ollama at `127.0.0.1:11434`; inference does not use a hosted model service. Requests have bounded timeouts, a bounded response size and validated generation options. The result includes duration and token telemetry when the local model provider reports it. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 1f92d761..e58a286f 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -137,7 +137,7 @@ First-class project understanding and tested adapters for real development stack - [x] **F0106 —** Vitest test adapter - [x] **F0107 —** Jest test adapter - [x] **F0108 —** Playwright test adapter -- [ ] **F0109 —** Cypress test adapter +- [x] **F0109 —** Cypress test adapter - [x] **F0110 —** Node.js built-in test adapter - [ ] **F0111 —** pnpm workspace adapter - [ ] **F0112 —** Yarn workspace adapter diff --git a/src/adapters/cypress.js b/src/adapters/cypress.js new file mode 100644 index 00000000..e9af5769 --- /dev/null +++ b/src/adapters/cypress.js @@ -0,0 +1,53 @@ +import { existsSync, lstatSync } from 'node:fs'; +import path from 'node:path'; +import { makeVerificationStep } from './step.js'; + +const CYPRESS_CONFIG_FILES = Object.freeze([ + 'cypress.config.js', 'cypress.config.mjs', 'cypress.config.cjs', + 'cypress.config.ts', 'cypress.config.mts', 'cypress.config.cts', +]); + +function hasRegularCypressConfig(projectRoot) { + for (const name of CYPRESS_CONFIG_FILES) { + try { + const info = lstatSync(path.join(projectRoot, name)); + if (info.isFile() && !info.isSymbolicLink()) return true; + } catch (cause) { + if (cause?.code === 'ENOENT' || cause?.code === 'EACCES' || cause?.code === 'EPERM') continue; + throw cause; + } + } + return false; +} + +function declaresCypress(manifest) { + for (const section of ['dependencies', 'devDependencies', 'optionalDependencies']) { + const dependencies = manifest?.[section]; + if (dependencies && typeof dependencies === 'object' && !Array.isArray(dependencies) + && typeof dependencies.cypress === 'string' && dependencies.cypress.trim()) { + return true; + } + } + return false; +} + +export function hasCypressConfiguration(projectRoot, manifest) { + return hasRegularCypressConfig(path.resolve(projectRoot)) || declaresCypress(manifest); +} + +export function createCypressChecks(projectRoot, { + manifest, + platform = process.platform, +} = {}) { + const root = path.resolve(projectRoot); + if (!hasCypressConfiguration(root, manifest)) return []; + const executableName = platform === 'win32' ? 'cypress.cmd' : 'cypress'; + const localExecutable = path.join(root, 'node_modules', '.bin', executableName); + const command = existsSync(localExecutable) ? localExecutable : executableName; + return [ + makeVerificationStep('node', 'cypress', command, ['run'], { + shell: platform === 'win32', + timeoutMs: 300_000, + }), + ]; +} diff --git a/src/adapters/index.js b/src/adapters/index.js index 16f3817a..96771179 100644 --- a/src/adapters/index.js +++ b/src/adapters/index.js @@ -36,8 +36,8 @@ const ADAPTERS = Object.freeze([ Object.freeze({ id: 'node', name: 'Node.js', - manifests: Object.freeze(['package.json', 'biome.json', 'biome.jsonc', 'playwright.config.ts']), - checks: Object.freeze(['test', 'eslint', 'prettier', 'biome', 'vitest', 'jest', 'playwright']), + manifests: Object.freeze(['package.json', 'biome.json', 'biome.jsonc', 'playwright.config.ts', 'cypress.config.ts']), + checks: Object.freeze(['test', 'eslint', 'prettier', 'biome', 'vitest', 'jest', 'playwright', 'cypress']), createChecks: createNodeChecks, }), ]); diff --git a/src/adapters/node.js b/src/adapters/node.js index 120085ca..23856ecc 100644 --- a/src/adapters/node.js +++ b/src/adapters/node.js @@ -4,6 +4,7 @@ import { makeVerificationStep } from './step.js'; import { createVitestChecks } from './vitest.js'; import { createJestChecks } from './jest.js'; import { createPlaywrightChecks } from './playwright.js'; +import { createCypressChecks } from './cypress.js'; const NODE_TEST_EXTENSIONS = new Set(['.js', '.cjs', '.mjs']); const IGNORED_DIRECTORIES = new Set([ @@ -133,6 +134,7 @@ export function createNodeChecks(projectRoot, { ...createVitestChecks(root, { manifest, platform }), ...createJestChecks(root, { manifest, platform }), ...createPlaywrightChecks(root, { manifest, platform }), + ...createCypressChecks(root, { manifest, platform }), ]; if (frameworkChecks.length) { steps.push(...frameworkChecks); diff --git a/test/language-adapters.test.js b/test/language-adapters.test.js index c88030c8..6b1b7281 100644 --- a/test/language-adapters.test.js +++ b/test/language-adapters.test.js @@ -34,6 +34,7 @@ test('backend registry exposes stable language identities and native manifests', assert.ok(catalog.find((item) => item.id === 'node').checks.includes('vitest')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('jest')); assert.ok(catalog.find((item) => item.id === 'node').checks.includes('playwright')); + assert.ok(catalog.find((item) => item.id === 'node').checks.includes('cypress')); assert.ok(catalog.find((item) => item.id === 'node').manifests.includes('biome.jsonc')); }); @@ -509,6 +510,74 @@ test('Playwright adapter uses the Windows command shim and respects declared tes } }); +test('Cypress config invokes cypress run and suppresses duplicate Node tests', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'cypress.config.ts'), 'export default { e2e: { specPattern: "cypress/e2e/**/*.cy.ts" } };\\n'); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-cypress-fixture', + version: '1.0.0', + devDependencies: { cypress: '^14.0.0' }, + })); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'cypress'); + writeFileSync(executable, '#!/bin/sh\\nexit 0\\n'); + mkdirSync(path.join(f.root, 'test')); + writeFileSync(path.join(f.root, 'test', 'legacy.test.js'), 'throw new Error("must not run twice");\\n'); + const checks = createLanguageVerificationChecks(f.root); + assert.deepEqual(checks.map((step) => step.name), ['node:cypress']); + assert.equal(checks[0].command, executable); + assert.deepEqual(checks[0].args, ['run']); + assert.equal(checks[0].shell, false); + assert.equal(checks[0].timeoutMs, 300_000); + } finally { + f.cleanup(); + } +}); + +test('Cypress detection supports config-only and dependency-only projects', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'cypress.config.mjs'), 'export default {};\\n'); + assert.deepEqual(createLanguageVerificationChecks(f.root).map((step) => step.name), ['node:cypress']); + + rmSync(path.join(f.root, 'cypress.config.mjs')); + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-cypress-dependency-only', + version: '1.0.0', + dependencies: { cypress: '^14.0.0' }, + })); + assert.deepEqual(createLanguageVerificationChecks(f.root).map((step) => step.name), ['node:cypress']); + assert.equal(createLanguageVerificationChecks(f.root)[0].command, 'cypress'); + } finally { + f.cleanup(); + } +}); + +test('Cypress adapter uses the Windows command shim and respects declared test scripts', () => { + const f = fixture(); + try { + writeFileSync(path.join(f.root, 'cypress.config.js'), 'module.exports = {};\\n'); + mkdirSync(path.join(f.root, 'node_modules', '.bin'), { recursive: true }); + const executable = path.join(f.root, 'node_modules', '.bin', 'cypress.cmd'); + writeFileSync(executable, '@echo off\\r\\nexit /b 0\\r\\n'); + const checks = createLanguageVerificationChecks(f.root, { platform: 'win32' }); + assert.deepEqual(checks.map((step) => step.name), ['node:cypress']); + assert.equal(checks[0].command, executable); + assert.equal(checks[0].shell, true); + + writeFileSync(path.join(f.root, 'package.json'), JSON.stringify({ + name: 'forge-cypress-user-script', + version: '1.0.0', + scripts: { test: 'cypress run' }, + devDependencies: { cypress: '^14.0.0' }, + })); + assert.deepEqual(createLanguageVerificationChecks(f.root, { platform: 'win32' }), []); + } finally { + f.cleanup(); + } +}); + test('Go backend adds vetting and race instrumentation to the release profile', () => { const f = fixture(); try { From 341e6d49049fbc2f20d31bbe2c2a5401bb314591 Mon Sep 17 00:00:00 2001 From: Manit Arora Date: Tue, 1 Dec 2026 15:51:22 +1100 Subject: [PATCH 23/37] Add recursive pnpm workspace verification --- Website/roadmap-data.json | 6 +-- docs/CLI.md | 11 +++++ docs/ROADMAP.md | 2 +- src/verify.js | 31 ++++++++++--- test/verify.test.js | 95 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 135 insertions(+), 10 deletions(-) diff --git a/Website/roadmap-data.json b/Website/roadmap-data.json index 1a82e163..b5dfc816 100644 --- a/Website/roadmap-data.json +++ b/Website/roadmap-data.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "totalFeatures": 1000, - "completedFeatures": 102, + "completedFeatures": 103, "domains": [ { "number": 1, @@ -571,7 +571,7 @@ }, { "id": 111, - "complete": false, + "complete": true, "title": "pnpm workspace adapter" }, { @@ -5124,4 +5124,4 @@ ] } ] -} +}\n \ No newline at end of file diff --git a/docs/CLI.md b/docs/CLI.md index 69f44326..5e405b02 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -57,6 +57,17 @@ The npm package is not yet published. Do not rely on a global registry install u See [Installation](INSTALLATION.md) for the Unix, Windows and Debian candidate workflows. +## pnpm workspace verification + +A root `pnpm-workspace.yaml` activates recursive pnpm verification. FORGE plans the selected profile checks as `pnpm --recursive --include-workspace-root --if-present run