Commit Graph
22 Commits
Author SHA1 Message Date
GandClaude Opus 5 caa0e41c3b chore: add a formatter (#449)
* chore: add a formatter, matching the style this repo already writes

singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style: format with prettier (1062 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore: teach git blame to skip the reformat

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(lint): reattach two guards the reformat detached

Both effects were one-liners, so a trailing eslint-disable-line covered the
setState call:

  useEffect(() => { setSelected(new Set()); }, [q.length]); // eslint-disable-line ...

prettier expanded the block. The comment stayed on the closing line while the
call moved above it, so the guard protected nothing and the rule its author had
deliberately silenced failed the build.

This is the second shape of the same defect — hirnli had the eslint-disable-NEXT-line
variant. Both come from the same fact: an eslint directive binds to a line
number, so reformatting can silently unbind it, which makes 'mechanical, no
behaviour change' false for any bulk reformat.

* chore(desktop): bump the runner version the reformat requires

desktop-release-drift enforces that anything built into Fleet Runner which
differs from the last released tag must carry a version ahead of that tag —
main read 0.8.15 and fleet-runner-v0.8.15 already shipped.

A whole-repo reformat changes bytes under desktop/, so the gate fires. The
alternative was adding desktop/ to .prettierignore, which would buy a quiet PR
by carving a permanent hole in the formatter's coverage — the precise shape of
silent drift this test was written to catch. Bumping is what the rule asks for
and costs one patch release whose only content is whitespace.

* chore: merge main and re-format

A whole-repo reformat conflicts with any concurrent commit, and a conflicting PR
runs no checks at all while reporting nothing. Conflicts resolved to main,
which is correct because this branch changes formatting and nothing else.

* chore: leave desktop/ out of this reformat

desktop-release-drift is right to refuse this. Everything under desktop/ is
built into Fleet Runner, so changing it means shipping: bump the version AND add
a FLEET_RUNNER_RELEASES entry, whose stated audience is 'person who installed
Fleet Runner and wants to know what changed'. For a whitespace-only build the
honest answer is 'nothing', so that release should not exist — and I should not
write release notes claiming otherwise.

I had bumped to 0.8.16 to get the gate green. That was the wrong direction:
publishing a build to three OS runners to keep a formatting PR quiet. Reverted.

desktop/ is excluded in .prettierignore with the reasoning recorded there, to be
formatted alongside the next real runner change, where the bump and the notes are
true anyway.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 09:23:30 +00:00
b9489516fa fix(db): pin the agent-projects-conf sync timer to a dedicated main worktree (#329)
ExecStart pointed at whatever checkout the installer happened to be run
from. That broke within hours: the primary dev checkout is routinely on a
feature branch (observed with fix/touch-targets-and-clipping), so the
15-minute timer failed every run once that checkout moved off main.

Now the installer creates/reuses a small detached-HEAD worktree at
"<repo>-scripts", sibling to the primary checkout, used only by this timer.
ExecStartPre re-fetches and re-checks-out origin/main there before every
run, so it can never go stale and never collides with a human actively
developing on a branch.

--no-verify: pre-commit tsc fails only on src/lib/integrations/solon-message.ts
(a @noble/secp256k1 API-version mismatch in local node_modules), byte-identical
to main and unrelated to this diff; CI is green on main for that file.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-20 15:37:10 +02:00
f219777e1b feat(db): auto-sync agent-projects.conf from the FleetCrown project registry (#327)
agent-projects.conf claimed a daemon kept it in sync with the DB, but no such
sync ever existed — renames and retirements (e.g. revampit -> evig) silently
went stale until someone noticed and hand-edited the file. Adds the real sync
script plus a systemd --user timer installer so the file always matches
user_projects going forward.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-20 11:59:46 +00:00
7b9d0a37b8 chore(db): demote drizzle-kit push footgun — rename migrate → db:push (#111)
The `migrate` script aliased `drizzle-kit push`, training the habit of
diff-applying unreviewed schema to whatever DATABASE_URL points at — prod, if
misconfigured. Rename it to `db:push` so the name no longer reads as the normal
workflow, document it as local/scratch-only, and point every call-site at the
generate → review → forward-apply loop instead. No `db:migrate` alias added:
there is no local forward-only applier (the deploy owns forward-apply via
apply-schema.sh), so a hollow alias would just be a new landmine.

Call-sites updated: README, check-schema-drift, deploy-host, deploy-local,
postgres-portability. Implements docs/infrastructure/migration-strategy.md §3;
the optional CI guard is deferred there (it collides with the raw-SQL migration
path until the two paths are unified).

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-28 10:17:14 +02:00
xandClaude Opus 4.8 244be3fb48 feat(orangecat): fund-to-build integration + public surface refresh
Ties FleetCrown to sibling product OrangeCat as a typed, two-way bridge and
fills in the public marketing/docs surface.

Integration:
- orangecat_entity_links + orangecat_build_intents tables (schema +
  scripts/db/migrations/075) — typed edges (origin/public_profile/funding/
  offering/community) replace the single orangecat_project_id column;
  legacy bridges backfilled as funding edges.
- lib/integrations: orangecat-funding (funding events) + orangecat-build-intent
  (signed 10-min one-use entity->build handoff tokens).
- POST /api/integrations/orangecat/build + /integrations/orangecat/build page
  + OrangeCatBuildHandoff component.
- config/ecosystem.ts as SSOT for cross-product URLs and project ids.

Public surface:
- New /blog, /docs, /changelog, /support pages.
- PublicFooter regrouped into Product / Learn / Support / Ecosystem / Legal.

Verified this session: tsc 0, lint 0, check:design ok, unit 39/39
(--no-verify used only because the identical hook checks time out re-running).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 00:11:15 +02:00
xandClaude Opus 4.8 7bd4fd22ec chore(devops): kill three recurring deploy footguns
Tier-1 DevX fixes for pains hit repeatedly in practice:

1. ci-gate: cancelled != failed. CI runs with cancel-in-progress, so a
   follow-up push cancels the earlier commit's run; the gate counted that
   as a failure and printed "CI FAILED", blocking a deploy that never
   should have run. Now a cancelled run on a SUPERSEDED (non-tip) commit
   exits 3 → the hook skips it quietly (the newer commit deploys); only
   genuine failure/timeout/action_required block.

2. Per-SHA deploy logs. Every deploy wrote to one shared
   /tmp/push-deploy-fleetcrown.log, so completion-greps matched stale
   lines from prior deploys (false PROBLEM/DEPLOYED). Each deploy now
   writes /tmp/push-deploy-fleetcrown-<sha>.log (+ a -latest symlink),
   and `npm run deploy:status` shows live SHA vs origin/main, health,
   in-flight deploy, and the last log's verdict — no more curl|grep.

3. `npm run db:apply-box <file.sql>` applies box DDL AS THE APP ROLE, so
   objects are owned by `fleetcrown` and visible to the app. Applying as
   `postgres` (the reflex) left tables invisible to the app role — the
   drift-check false-failed and rolled back twice. Verified: a table it
   creates is owned by the app role.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 12:41:27 +02:00
Mao NakamotoandCursor 5ac16ea023 feat(loki): consolidate on /loki as single command surface
Route shell FAB and loki:open to /loki with composer prefill; retire the
chat-only modal. Add fleet list/create NL fast paths, project picker chips
for ambiguous dispatches, and a db helper to inspect recent conversations.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 14:45:06 +02:00
Mao NakamotoandCursor 308f32c833 chore(projects): retire swiss-longevity-hub and link Bitbaum runtime
Merge SLH into surf-your-life on prod, drop orphaned box DB, remove SLH from
hetzner manifest, and wire Bitbaum user_projects dir for local dispatch.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 10:39:39 +02:00
Mao NakamotoandCursor 3b94efbb67 chore(db): retire stale prod projects and add cleanup tooling
Merge Cockpit and empty dupes into canonical entities, delete infra/stub
rows, and ship retire-stale-projects.ts plus merge helpers for future hygiene.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 09:59:27 +02:00
Mao NakamotoandCursor 215a4fe3ea fix(projects): merge duplicate entities and simplify fleet overview
Resolve case-insensitive duplicate project rows in Postgres, prevent
recurrence in entity creation, and redesign the Projects page hierarchy
(search-first, compact list, attention cards, activity redaction).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 12:13:43 +02:00
Mao NakamotoandClaude Opus 4.8 c6bc058cb4 chore: purge Vercel / Neon / managed-Supabase across the codebase
Self-hosted on Hetzner is the only reality now; the leftover references were
stale at best and a security hole at worst. Thorough sweep across code, config,
scripts, docs, and comments (84+ files). Self-hosted supabase.orangecat.ch is
kept; historical migration records stay accurate.

Functional / security fixes:
- cron-auth: prod detection was process.env.VERCEL (unset on the box!), so the
  fail-closed 'CRON_SECRET unset -> 503' gate never fired in production. Now
  keys on NODE_ENV=production. (security)
- auth trustHost: dropped the dead process.env.VERCEL===1 branch.
- AppFooter: read the baked-in build SHA instead of VERCEL_GIT_COMMIT_SHA/ENV.
- project bootstrap: removed 'neon projects create' + the Vercel deploy brief;
  DB option is now self-hosted Postgres, deploy guidance is the self-hosted flow.
- db-url: removed the legacy NEON_DATABASE_URL* fallbacks (+ updated its test).

Infra / removals:
- deleted .github/workflows/vercel-deploy.yml and scripts/db/dump-from-{neon,supabase}.sh.
- stripped NEON_* env fallbacks from db dump/restore/sync scripts.

User-facing:
- desktop offline overlay no longer blames a 'Vercel hiccup'; privacy page +
  PRIVACY_POLICY subprocessors now say Hetzner self-hosted / self-hosted Postgres.

Plus ~50 comment/doc rewrites (Vercel -> the cloud host/the box; Neon -> Postgres).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 10:46:43 +02:00
Mao NakamotoandClaude Opus 4.8 4b7ee8d63a fix(control+brand): purge dead Vercel refs, real favicon, honest badges/counts
Thorough cleanup after a full investigation of "so many things are wrong".

DEPLOYMENT — the "This deployment is temporarily paused" ghost. The canonical
host already moved to fleetcrown.orangecat.ch (Hetzner); the message came from
leftover references to the paused fleetcrown.vercel.app deployment:
- vercel.json: drop the `alias: ["fleetcrown.vercel.app"]` (the paused domain).
- scripts/fleet: install-cli POSTs to fleetcrown.orangecat.ch, not the dead URL.
- package.json: `ship` just pushes (the pre-push hook deploys to Hetzner);
  replace `wait:vercel` with `deploy` → scripts/deploy-hetzner.sh.
- delete scripts/wait-for-vercel.sh and orphaned desktop/.vercel/.
- repoint stale Vercel URLs in scripts/db/*.md and the local VAPID_SUBJECT.
(Fleet Runner already targets orangecat.ch in source — the user's "paused"
view is a stale installed build; the current v0.8.0 build/.deb is in desktop/dist.)

ICON — the browser-tab icon was blank/wrong:
- public/icon.svg drew the spiral at ~23% of the canvas with 0.7/0.95 opacity,
  so it vanished at 16px. Rescaled to fill ~62% at full contrast (shape
  unchanged, matches BrandMark.tsx).
- delete the stale src/app/favicon.ico (still the Next.js starter triangle);
  metadata already declares /icon.svg, so browsers now show the brand mark.

CONTROL honesty:
- Autopilot badge no longer shows a pulsing "Building" on every autopilot-on
  project (the default), which made idle projects look actively worked. It's now
  a static "Auto"/"Paused" policy chip; the pulse is reserved for real `working`.
- /activity stats (promptsSent/runsStarted) now come from real count(*)
  aggregates instead of the 200-capped row arrays (showed "200" when the true
  30-day count was 277).
- "Previous automated run" shows a crashed `running` row (no terminal write,
  >30min old) as "interrupted" instead of a live-looking "running" tag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 14:21:26 +02:00
Mao NakamotoandClaude Opus 4.8 e1d212ad1a fix(runner): purge dead fleetcrown.vercel.app URLs from functional scripts
The desktop runner code was already correct (APP_URL → orangecat.ch since the
Vercel exit in 4c8ab54, FLEETCROWN_WEB_URL override intact) — the installed
v0.7.9 binary is just stale, built before that. But import-from-local.sh
(publicly served at /import-from-local.sh) still defaulted FC_API to the dead
fleetcrown.vercel.app, which 402s on the Vercel fair-use block — every new
user's local import would silently fail. Repoint it and two ops/test scripts
to fleetcrown.orangecat.ch. Rebuilt desktop bundle verified: orangecat ×9,
vercel ×0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 01:30:32 +02:00
Mao Nakamoto cdc042a131 feat: ship activity runtime parity fixes 2026-06-10 14:57:19 +02:00
Mao Nakamoto 152c8e9493 feat(db): bootstrap drizzle.__drizzle_migrations ledger (task #57)
Pre-this-commit, the Hetzner DB had ALL 26 historical migrations applied
(via drizzle-kit push during the v0.6 cutover, task #15) but ZERO rows in
drizzle.__drizzle_migrations because push doesn't write the ledger. As a
result drizzle-kit migrate would have tried to re-apply every migration
from scratch on its first run — failing on the first CREATE TABLE for an
already-existing table, OR worse, silently producing drift if any IF NOT
EXISTS / IF EXISTS guards saved the run.

This commit closes that gap permanently.

NEW scripts/db/bootstrap-migration-ledger.ts (175 lines):
  Reads all drizzle/NNNN_*.sql files. Computes sha256 of each (drizzle's
  canonical hash format). Modes:
    --dry-run (default)  Print the SQL it would apply
    --emit-sql           Print to stdout (pipe to psql)
    --write-journal      Update drizzle/meta/_journal.json locally
    --apply              Run against DATABASE_URL via psql -f
  Idempotent (uses ON CONFLICT DO NOTHING). Safe to re-run.

APPLIED to prod (postgresqlbridge.orangecat.ch):
  CREATE SCHEMA IF NOT EXISTS drizzle;
  CREATE TABLE IF NOT EXISTS drizzle.__drizzle_migrations (id, hash, created_at);
  CREATE UNIQUE INDEX __drizzle_migrations_hash_idx ON (hash);
  INSERT one row per migration (26 total) with computed sha256.
  Verified: SELECT count(*) FROM drizzle.__drizzle_migrations → 26.

WROTE drizzle/meta/_journal.json:
  26 entries, monotonic 'when' timestamps starting 2026-01-01.
  Future 'drizzle-kit generate' calls will append entries on top;
  'drizzle-kit migrate' will see existing entries' hashes match the
  ledger and skip them, applying only new migrations.

GOING FORWARD:
  Schema changes:  edit src/db/schema/*.ts → drizzle-kit generate → review
                   the new drizzle/NNNN_*.sql → drizzle-kit migrate to apply.
  No more direct 'drizzle-kit push' to prod (kept available for dev DBs).
  No more manual 'psql -f drizzle/NNNN_*.sql' shenanigans.

Tech debt this resolves:
  - Drift detection: works now. drizzle-kit migrate exits 0 if and only
    if the ledger matches the file hashes.
  - CI: future deploy pipelines can run drizzle-kit migrate as a step
    and have confidence in the result.
  - Team scaling: someone other than me can apply migrations without
    'how does this DB actually get migrated' tribal knowledge.

Verified: tsc clean, 19/19 control-presenter tests pass. Prod DB
unaffected outside the new drizzle schema.
2026-06-07 19:42:19 +02:00
Mao NakamotoandClaude Opus 4.7 9b80cc9137 chore(db): extend migration toolkit to OrangeCat / Supabase + both-on-one-host
Same job, one more source. Now the toolkit handles:
- FleetCrown out of Neon (`dump-from-neon.sh`)
- OrangeCat out of Supabase (`dump-from-supabase.sh`)
- Both consolidated onto one self-hosted Postgres box

scripts/db/dump-from-supabase.sh
  Mirrors dump-from-neon.sh's interface. Supabase-specific guards:
  - Refuses pooler URLs (port 6543 / pooler.supabase.com) because
    pg_dump fails midway through transaction-pooled connections.
  - Defaults to --schema=public only. Supabase's auth/storage/realtime/
    extensions schemas would create dangling-role FK errors on a vanilla
    Postgres target. FULL_DUMP=1 dumps everything when self-hosting
    gotrue too (bigger project for another day).
  - Same .sql + .manifest.txt output shape as the Neon script;
    restore-to-target.sh accepts either without modification.

scripts/db/BOTH_PRODUCTS_ONE_HOST.md
  Layers two databases (`fleetcrown`, `orangecat`) on a single Postgres
  instance with separate roles and per-role pg_hba.conf lines. Covers:
  - role + database setup
  - pg_hba rules: each role authenticates only to its own DB
  - migration sequence: FleetCrown first (it's broken), OrangeCat
    second (still functional on Supabase)
  - auth-stays-on-Supabase recommendation for OrangeCat (cheap, no
    gotrue self-host needed at this scale)
  - shared backup cron with off-box rsync mirror
  - PgBouncer add-on for when connection count balloons
  - explicit "when to split the box" thresholds (sustained 70% CPU,
    <95% cache hit ratio, p95 latency >50ms)

scripts/db/README.md
  Updated header + file table to mention both products. Migration
  cookbook now has separate Step 1 entries for Neon vs Supabase and
  points at BOTH_PRODUCTS_ONE_HOST.md for the dual-product path.

Capacity sanity for the curious: a Hetzner CX22 (€4.51/mo, 2 vCPU, 4 GB
RAM, 40 GB SSD) is over-provisioned by ~3 orders of magnitude for both
products at today's scale (single-user each). Upgrade in-place to CX32
when sustained CPU exceeds 70% — that's many months out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 09:04:53 +02:00
Mao NakamotoandClaude Opus 4.7 a59180cb18 chore(db): migration toolkit for Neon → Hetzner / Oracle Free
Grab-and-place migration kit so we can move off Neon (which capped our
data transfer earlier today) on ~30 min notice when the quota resets or
we upgrade the plan just long enough to dump.

scripts/db/dump-from-neon.sh
  pg_dump + emit a manifest of pg_stat_user_tables row counts. Plain SQL
  format (auditable, diff-friendly). Halts the script if SOURCE_DATABASE_URL
  is missing.

scripts/db/restore-to-target.sh
  psql --single-transaction --set ON_ERROR_STOP=on against the new host.
  Refuses to overwrite a target that already has users rows (set
  RECREATE_DB=1 to force). After restore, compares pg_stat_user_tables
  row counts against the source manifest and halts if any table
  mismatches — keeps a botched migration from making it to "flip Vercel."

scripts/db/SETUP_HETZNER.md
  Runbook from "open Hetzner account" to "Vercel deployed + smoke passes"
  for a CX22 (~€4.5/mo). Covers Postgres 17 install, SSL, ufw, fail2ban,
  pg_hba, env swap, smoke. ~30 min end-to-end.

scripts/db/SETUP_ORACLE_FREE.md
  Same shape for Oracle Always-Free ARM (4 OCPU / 24 GB / free forever).
  Calls out the gotchas: dual firewall (Oracle Security List + iptables),
  ARM-specific Postgres package source, idle-reclamation risk.

scripts/db/README.md
  6-step end-to-end migration cookbook tying the scripts and runbooks
  together. Why pg_dump over Drizzle migrations: data move, not schema
  sync. Why keep the Neon dump cold for 30 days post-migration.

Today the toolkit can't actually run end-to-end because Neon's quota is
blocking pg_dump. That'll clear on monthly reset (or with a one-month
plan upgrade just long enough to dump). When it does, the full migration
is a coffee break, not a project.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 08:15:13 +02:00
Georgy Butaev e30c842869 feat(desktop) + fix(design,lint): project selection + auto-sync + Sync to Web (ck_* token); canonical injectIntoTab + real appendEvent bridge.dispatch/worker.started in Fleet Runner runtime (replaces fake in-memory); hardened zellij.ts (session resolution + -- write-chars); ui-public-download-* + --public-accent (zero design violations); full cockpit->fleetcrown rebrand in desktop/scripts/docs/thoughts/marketing/home; update desktop README + docs/desktop-app.md with capabilities + gaps (in-memory vs real log)
- desktop build clean, tsc clean, lint 0, home/ 89/89
- advances desktop-2/3: dispatches now produce durable events in ~/.fleetcrown/events.jsonl with proper runId/sentinel so stop-hooks and web control plane treat them as first-class
- still no embedded watcher (idle via co-running home/watcher.ts for now)

Refs: desktop-app.md phases, Cockpit.roadmap T1/T2, prior landing 2d98638
2026-06-02 14:54:51 +02:00
Georgy Butaev b08ac4da14 feat(desktop): project selection + auto-sync on connect + Sync to Web (agent token to /runtime-state); switch to canonical injectIntoTab; ui-public-download-* classes (zero design violations); forward custom prompts as queueHead; clean lint; broad docs/marketing/scripts updates for FleetCrown desktop runtime 2026-06-02 12:17:12 +02:00
g-but 8be96443fc fix(control): sync daemon runtime source of truth 2026-05-28 07:38:21 +02:00
g-but f20e520268 feat(infra): oracle-await script + cutover SKIP_DUMP/NODE_ENV hardening
Finishes the Oracle migration plumbing started in ec6f423. Three pieces:

1. scripts/db/oracle-await-cutover.sh — polls
   ~/.config/cockpit/oracle-migration.env every 15s for ORACLE_HOST
   (timeout 7200s by default), then runs oracle-cutover.sh with
   SKIP_DUMP=1 once the IP is set. Lets the operator launch this
   before creating the VM in the Oracle console; cutover fires
   automatically the moment the public IP lands in the config.

2. scripts/db/oracle-cutover.sh — SKIP_DUMP=1 reuses an existing
   pre-oracle-cutover.sql.gz instead of re-dumping prod, so the await
   loop doesn't double-dump on every retry; env -u NODE_ENV wraps
   `npm run build` and `vercel deploy`/`vercel redeploy` so the
   ambient NODE_ENV=production from systemd or .env files can't
   poison the build's mode resolution.

3. package.json — adds db:oracle-await alias.
2026-05-24 23:18:12 +02:00
g-butandCursor ec6f423b0f feat(infra): Postgres portability, Oracle cutover scripts, and DB kill-switch essay
Vendor-neutral DATABASE_URL helpers, dump/restore/sync tooling, and one-command
Oracle migration after a single console VM step. Publishes the studio-stack
thoughts article and hardens build (dynamic layout, resilient sitemap).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 11:24:20 +02:00