From b7049145a4ed3717a5dfc352d2168328fe968184 Mon Sep 17 00:00:00 2001 From: john-the-dev <52230987+john-the-dev@users.noreply.github.com> Date: Mon, 31 Aug 2026 02:51:33 -0700 Subject: [PATCH] fix(scripts): decode file:// URLs so a path with spaces resolves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `new URL(...).pathname` returns a percent-encoded path, so any checkout whose directory contains a space resolves to a name that does not exist. Both entry points hit it: scripts/lib.mjs:12 ENTRIES_DIR = new URL("../entries/", import.meta.url).pathname scripts/build.mjs:10 DIST = new URL("../dist/", import.meta.url).pathname `fileURLToPath()` is the API that decodes, and is what Node documents for this conversion. Measured from a checkout under ".../Application Support/...": before validate.mjs rc=1 ENOENT ... /Application%20Support/... build.mjs rc=1 ENOENT ... /Application%20Support/... after validate.mjs rc=0 59 entries valid, 48 warnings build.mjs rc=0 Built dist/kb.json — 59 entries CI is unaffected either way — its checkout path has no spaces — so this only ever showed up locally, which is also why it survived. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/build.mjs | 3 ++- scripts/lib.mjs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/build.mjs b/scripts/build.mjs index 5607ce9..1ab1f4d 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -6,8 +6,9 @@ import { createHash } from "node:crypto"; import { mkdirSync, writeFileSync } from "node:fs"; import { loadAll } from "./lib.mjs"; +import { fileURLToPath } from "node:url"; -const DIST = new URL("../dist/", import.meta.url).pathname; +const DIST = fileURLToPath(new URL("../dist/", import.meta.url)); const SOURCE = "The Agent Loop"; const HOMEPAGE = "https://agent-loop.xyz"; diff --git a/scripts/lib.mjs b/scripts/lib.mjs index bb4ef25..fc45e81 100644 --- a/scripts/lib.mjs +++ b/scripts/lib.mjs @@ -1,6 +1,7 @@ // Zero-dependency front-matter parser for entries/*.md import { readdirSync, readFileSync } from "node:fs"; import { join } from "node:path"; +import { fileURLToPath } from "node:url"; export const ENUMS = { category: ["frameworks", "orchestration", "evaluation", "memory", "tools", "protocols", "security", "infra", "research", "lessons", "general"], @@ -9,7 +10,7 @@ export const ENUMS = { grade: ["A", "B", "C", "D", "unrated"], }; export const REQUIRED = ["id", "title", "url", "category", "source_type", "status", "grade", "added", "last_verified", "evidence"]; -export const ENTRIES_DIR = new URL("../entries/", import.meta.url).pathname; +export const ENTRIES_DIR = fileURLToPath(new URL("../entries/", import.meta.url)); export const STALE_DAYS = 90; function stripComment(v) {