No description
  • TypeScript 88.9%
  • CSS 9.8%
  • JavaScript 1.3%
Find a file
Dustin Gohlke ed7fb82330
Some checks failed
/ ci-1 (push) Failing after 57s
/ ci (push) Failing after 0s
octoforge/step Scanning for vulnerabilities
blueprint 0.9.30: three connections, idle ones given back; runner takes three builds at once
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 15:38:48 +01:00
.cursor/rules one Spark can publish an API to another: provides.api and uses, the OpenAPI file as the allowlist, per-consumer Cilium rules that delete forged identity and set the caller, the approvals file, forge generate, callerOf and the agent rule, proved against a cluster 2026-10-31 15:25:59 +01:00
.forgejo/workflows next had six CRITICAL findings and nothing told us, and the portal carried the same version 2026-10-09 09:35:35 +02:00
migrations release: 0.1.84 - the second Windows friction log, worked 2026-08-24 10:21:45 +02:00
src blueprint 0.9.30: three connections, idle ones given back; runner takes three builds at once 2026-11-03 15:38:48 +01:00
tests one Spark can publish an API to another: provides.api and uses, the OpenAPI file as the allowlist, per-consumer Cilium rules that delete forged identity and set the caller, the approvals file, forge generate, callerOf and the agent rule, proved against a cluster 2026-10-31 15:25:59 +01:00
.dockerignore rename: the platform is OctoForge, an app is a Spark, an agent is a Crucible 2026-08-05 23:55:01 +02:00
.gitignore blueprint: .env.local was documented as gitignored and was not 2026-08-09 13:51:01 +02:00
.npmrc a lockfile is written by one npm and judged by another, and the alert store never existed 2026-10-09 09:08:48 +02:00
CLAUDE.md one Spark can publish an API to another: provides.api and uses, the OpenAPI file as the allowlist, per-consumer Cilium rules that delete forged identity and set the caller, the approvals file, forge generate, callerOf and the agent rule, proved against a cluster 2026-10-31 15:25:59 +01:00
components.json feat: vendor shadcn/ui into the blueprint 2026-08-02 01:55:39 +02:00
Dockerfile rename: the platform is OctoForge, an app is a Spark, an agent is a Crucible 2026-08-05 23:55:01 +02:00
drizzle.config.ts feat: the fullstack-ts blueprint (1.10) 2026-08-02 01:49:09 +02:00
next.config.ts release: 0.1.84 - the second Windows friction log, worked 2026-08-24 10:21:45 +02:00
package-lock.json blueprint 0.9.29: every minor and patch release, the audit's fixes, and OpenTelemetry 0.300 with the API package listed directly 2026-11-02 14:38:39 +01:00
package.json blueprint 0.9.29: every minor and patch release, the audit's fixes, and OpenTelemetry 0.300 with the API package listed directly 2026-11-02 14:38:39 +01:00
postcss.config.mjs feat: the fullstack-ts blueprint (1.10) 2026-08-02 01:49:09 +02:00
README.md guidance: the four findings a first-time Spark author paid for 2026-08-18 01:32:47 +02:00
spark.yaml blueprint 0.9.30: three connections, idle ones given back; runner takes three builds at once 2026-11-03 15:38:48 +01:00
tsconfig.json the second friction log: stop that lied, publish that guessed, and four generated defects 2026-08-18 02:24:16 +02:00
vitest.config.ts feat: the fullstack-ts blueprint (1.10) 2026-08-02 01:49:09 +02:00

Leave

This repository is also the fullstack-ts reference Spark. It is deployed and smoke-tested like any other Spark on every change, which is what stops the blueprint rotting (ADR-0013). If its pipeline is red, the blueprint is broken and every new Spark inherits it - that is the signal to watch. A Spark created with forge new gets this file with the paragraph removed.

Request and approve leave. Everyone sees their own requests; anyone in octoforge-approvers sees all of them and can decide the ones that are not their own.

Running it

npm install
forge dev

npm install first: a clone has no node_modules. Every dependency here is public, so it needs nothing configured. forge itself is installed once per machine - the portal prints that line with the platform's registry address already in it.

forge stop takes the local database down again. forge dev leaves it running on purpose, so the next start is quick.

Making it yours

This started as the fullstack-ts blueprint, and the leave example is here to show the shape of a feature - not because your Spark needs it.

To replace it, delete what belongs to it and point the homepage somewhere else:

src/app/leave/        the pages, the form, the server actions
src/data/leave.ts     the data facade, and where authorisation is decided
src/db/schema/leave.ts
tests/leave.test.ts
src/app/jobs/expire-old-leave/   the example of recurring work - a route the platform calls
src/app/page.tsx      the home page, which links to the example
src/db/seed.ts        the sample rows - it imports the schema above, so `npm test`
                      stops compiling if you delete the schema and leave this

That last line was missing, and following this list exactly used to break the build - found by somebody doing precisely what it said.

Delete the jobs: entry in spark.yaml with the route, or forge doctor will point out that a declared job has nothing to call.

Then create your own:

forge add entity Booking

which writes the same five files, with the permission check already in place.

What it actually writes, because you cannot judge a generator you have not seen. One table with a name column, and the layers around it:

// src/db/schema/booking.ts
export const bookings = pgTable('bookings', {
  id: uuid('id').primaryKey().defaultRandom(),
  name: text('name').notNull(),
  createdBy: text('created_by').notNull(),      // the row's owner
  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
})

// src/data/booking.ts - the part worth having written for you
export async function removeBooking(actor: Actor, id: string): Promise<Result<void>> {
  const [existing] = await db.select().from(bookings).where(eq(bookings.id, id)).limit(1)
  if (!existing || existing.createdBy !== actor.user) {
    return problem('booking.not-found', 'That booking does not exist.')
  }
  ...
}

Then you add your own columns. The first author on this blueprint wrote all six files by hand because they could not tell from the documentation whether a generator meant for one name column was a sensible start for three tables with their own types - it is, and the ready-made ownership check is the reason.

forge add dataset Project is the other shape: table, facade and test, no page, no createdBy, and a replaceAll that is whole-table, transactional and batched.

Migrations. npm run db:generate names them itself - 0000_wakeful_flatman.sql - and the name does not matter to anything. Renaming one means hand-editing migrations/meta/_journal.json, which is not worth doing. A Spark that has never been published may delete migrations/ entirely and regenerate, which is cleaner than shipping a first migration full of DROP TABLE for tables nobody ever had; once it is published, never edit or delete one, because the database has a record of what it already ran.

What you do not have to build

Authentication is not in this repository and must not be added. The platform signs people in before a request arrives, and hands this Spark four headers - src/lib/identity.ts is the only file that reads them. There is no login page, no session, and no password anywhere.

The database is not configured here either. needs.postgres: true in spark.yaml is the whole declaration; the platform creates the database, the role and the credential, and injects DATABASE_URL. Nobody types a password and none exists in this repository.

If you build this with Claude or Cursor

CLAUDE.md and .cursor/rules/ in this repository are the rules for doing that: what the platform already provides, what must never be added, where code goes, and which command runs what. Both are generated from one source in the blueprint, so they cannot disagree, and forge update keeps them current. Do not edit them here - the change belongs in the blueprint.

Where things go

src/app/ Pages, and server actions. Never talks to the database directly
src/data/ The only place that queries the database, and where "who may see this" is decided
src/db/ Connection and schema. One file per table
src/lib/ Identity, errors, logging

Why it is arranged this way: docs/adr/0026-data-access-is-a-server-only-facade.md in the platform repository. The short version is that a permission check needs one place to live, so a generator can write it and a reviewer can find it.

The second example: a dataset

leave shows a person's own records. Most applications brought to OctoForge are the other shape - something outside is fetched on a schedule, kept in a table nobody owns, and shown on a page. That one is here too, end to end:

src/app/jobs/refresh-rates/route.ts   the scheduled fetch, through @/lib/source
src/data/exchange-rate.ts             replaceAll: whole-table, one transaction, batched
src/db/schema/exchange-rate.ts        no createdBy - nobody owns a row from outside
src/app/rates/page.tsx                what it shows, and both kinds of empty

tests/source.test.ts is not part of the example and does not go with it. It covers src/lib/source.ts, which is platform code every Spark keeps: the four ways a hand-written fetch goes wrong, a rate limit waited out rather than treated as a failure, and a missing credential told apart from a broken one. Deleting it removes the cover and leaves the code.

Its manifest entries are the refresh-rates job and the egress.allow line beside it. The source needs no credential, which is deliberate: it shows auth: 'none', and a blueprint that declared a secret would not start until somebody entered a value for it.

Delete all four when you no longer need the example.