Files
loki/scripts/templates/refresh-starter-lock.ts
CatoandClaude Fable 5.1 a1aed85daa fix(cold-start): a brief becomes a repo and a live site through the normal path (#569)
* fix(cold-start): the starter ships a lockfile, so its first Deploy can install

selfhost-deploy.yml refuses to install without a lockfile and installs with
--frozen-lockfile; the Next starter declared pnpm and shipped no lock, so every
fresh site failed before building. The lock is resolved once by
scripts/templates/refresh-starter-lock.ts into a generated asset and seeded
with the starter (one Git tree call, no pnpm on the app box).
scripts/test/starter-lock.ts fails on drift, missing standalone output, a
missing packageManager, or starter docs that point at npm.

Seeding failures are recoverable: provision on a linked but bare repo re-seeds
it instead of refusing with 409. The starter embeds the project-scoped
feedback widget from its first commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0118cLNxoB3dt2w74vU1PH6w

* fix(cold-start): liveUrl means a Deploy on the current commit and a public 200

Registration persisted liveUrl because register-site.sh exited 0 with
--no-deploy. Now: strict setup, then a workflow dispatch; GET reports
pending/failed/live and the UI polls it. describeSiteDeployment (pure, tested)
treats a queued run or a just-sent dispatch as starting, closing the race where
the first poll after dispatch read as "no deployment exists". A status the
client cannot read is shown as a failure, not swallowed.

The deploy workflow resolves a freshly registered slug from the box register
and proves the checkout belongs to the caller; deploy.sh builds with the same
package manager that installed; register-site.sh runs release siblings, locks
the register, fails without a deploy secret, and seeds a runtime env.

check:deploy-ready no longer reads a box-registered checkout as laptop drift.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0118cLNxoB3dt2w74vU1PH6w

* fix(feedback): Implement addresses the project id, never a same-named tab

Feedback and kickoff dispatch resolve user_projects by stable entity id; a
renamed project or a same-named sibling can no longer redirect a run, and the
hosted fallback is off for actions tied to a tracked run. Batch Implement only
advances when a run was accepted. Fix prompts require the normal ship path and
live evidence; Resolve stays with the operator.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0118cLNxoB3dt2w74vU1PH6w

* docs: FleetCrown builds independently; tab names are transport, not identity

Product copy and agent docs describe FleetCrown as an independent product with
optional OrangeCat linking that is not publication consent. Control drops the
Focus terminal chip (Open terminal stays). Adds the cold-start handoff.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0118cLNxoB3dt2w74vU1PH6w

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 12:51:11 -07:00

54 lines
2.7 KiB
TypeScript

// Regenerate the pnpm lockfile shipped inside the nextjs-tailwind starter.
//
// Why a lockfile is part of the starter at all: selfhost-deploy.yml refuses to
// install without one ("no lockfile at the repo root — cannot install
// reproducibly"), and it installs with --frozen-lockfile. A starter that
// declares pnpm but ships no lock therefore cannot deploy on its first push —
// which is exactly the cold-start bar (brief → repo → live site) this starter
// exists for. Generating the lock at provision time would need pnpm + network
// on the app box for every kickoff; resolving it once here and committing the
// result keeps provisioning a pure GitHub API call.
//
// Run after changing the starter's package.json:
// pnpm exec tsx scripts/templates/refresh-starter-lock.ts
// scripts/test/starter-lock.ts fails when the two drift.
import { execFileSync } from "child_process";
import fs from "fs";
import os from "os";
import path from "path";
import { fileURLToPath } from "url";
import { renderTemplate, TEMPLATES } from "@/lib/project-templates";
import { STARTER_LOCK_FILE, STARTER_LOCK_TEMPLATE } from "@/lib/starter-locks/config";
const HERE = path.dirname(fileURLToPath(import.meta.url));
const OUT = path.join(HERE, "../../src/lib/starter-locks", `${STARTER_LOCK_TEMPLATE}.generated.ts`);
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "fc-starter-lock-"));
try {
const files = TEMPLATES[STARTER_LOCK_TEMPLATE].files;
for (const [rel, body] of Object.entries(files)) {
if (rel === STARTER_LOCK_FILE) continue;
const dest = path.join(tmp, rel);
fs.mkdirSync(path.dirname(dest), { recursive: true });
fs.writeFileSync(dest, renderTemplate(body, { name: "starter", description: "starter" }));
}
execFileSync("pnpm", ["install", "--lockfile-only", "--ignore-scripts"], {
cwd: tmp,
stdio: "inherit",
});
const lock = fs.readFileSync(path.join(tmp, STARTER_LOCK_FILE), "utf8");
const escaped = lock.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
const banner = [
"// GENERATED by scripts/templates/refresh-starter-lock.ts — do not edit by hand.",
`// The ${STARTER_LOCK_TEMPLATE} starter's package.json, resolved once with`,
"// `pnpm install --lockfile-only`. selfhost-deploy installs starters with",
"// --frozen-lockfile, so this must match that package.json exactly;",
"// scripts/test/starter-lock.ts enforces it.",
"",
].join("\n");
fs.writeFileSync(OUT, `${banner}export const NEXTJS_TAILWIND_PNPM_LOCK = \`${escaped}\`;\n`);
console.log(`wrote ${path.relative(process.cwd(), OUT)} (${lock.split("\n").length} lines)`);
} finally {
fs.rmSync(tmp, { recursive: true, force: true });
}