mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 05:57:09 +01:00
dependabot/github_actions/actions/setup-node-7
29
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e2915bf6dd |
fix(auth): OrangeCat sign-in on AccountKit works, and keeps its tokens (#1528)
* fix(auth): OrangeCat sign-in on AccountKit works, and keeps its tokens AccountKit 0.19.0 fixes a first OrangeCat sign-in failing with unable_to_create_user (Loki's mirror recorded the link before better-auth stored its own) and hands the provider's tokens to onAccountCreated. ensureLokiUser now keeps OrangeCat's token set in Loki's accounts, where publish, promote and the wallet read it; on AccountKit nothing reached them before, because AccountKit stores no provider token. Migration 0131 drops the trigger that was meant to copy them out of auth_accounts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML * style: format the generated migration meta Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
f82e076fc6 |
refactor(auth): use AccountKit's compat layer instead of a local copy (#1508)
The next-auth/react bridge, its call helper, the session plumbing, the AUTH_RUNTIME switch, the import rehearsal script and the journey-test cookie client were copies of code five products each carried. They now come from AccountKit 0.18.0: - @bitbaum/accountkit/auth/nextauth-compat answers next-auth/react. The product's compat.ts holds only what is its own: the session shape, how each password form signs in, its login codes and hooks. - @bitbaum/accountkit/auth/switch: sharedRuntimeEnabled(). - `pnpm run db:rehearse-import` runs AccountKit's accountkit-rehearse-import on this product's import SQL. - The journeys use @bitbaum/accountkit/auth/compat-testing. Behaviour is unchanged with the switch off. With it on, a signed-out session reads as null, and a resolver or hook failure is a readable refusal rather than a 500. The real-database journeys pass unchanged. Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
0adea245cc |
feat(auth): stage AccountKit beside Auth.js, switch off (#1503)
Loki moves from Auth.js to @bitbaum/accountkit one reversible step at a time, as evig, kivvi, petvity and surf-your-life do. Nothing changes while AUTH_RUNTIME is unset. - Migration 0130: AccountKit's tables under `auth_`, and the mirror functions: users <-> auth_users, and AccountKit's OrangeCat token set into Loki's `accounts`, where publish, promote and the wallet read it. - scripts/db/accountkit-import.sql + a rollback-only rehearsal: ids, Loki's own scrypt hashes (read through AccountKit 0.17.0's legacyPassword), verification, OrangeCat links, a placeholder address for people with none; collisions, drift and a live shared runtime refused. - src/lib/auth/shared/: the runtime, the session re-read from `users` on every request, and a bridge for next-auth/react: email, the invite's user-password and the owner key (stored hash only), OrangeCat sign-in or link, and the studio's server signIn by redirect. GitHub, Google and X are not offered on this runtime (getEnabledAuthProviders knows it). - src/lib/auth/bootstrap.ts: onboarding heal and personal org, now one function both runtimes call. - The proxy reads the shared session and asks the same authorized(). - /api/me/password keeps the caller's shared session. - scripts/test/accountkit-journeys.ts joins `test:db` (16 journeys and the rehearsal on CI's Postgres). docs/architecture/accountkit-migration.md records what blocks the switch, chiefly GitHub/Google sign-in and the GitHub repository token. Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
5f1e283117 |
fix(scripts): grep -q is never the reader of a pipe under pipefail (#874)
`echo "$x" | grep -q PAT` under `set -o pipefail` can report "not found" for text that IS there: grep -q exits on its first match and closes the pipe, the writer takes SIGPIPE (141), and pipefail makes the pipeline status 141. An `if` then takes the else branch on a successful match. #587 found this in one file and noted it "only fires when the payload exceeds the ~4KB pipe buffer". That is not so, and the belief is why 82 copies in 22 scripts survived. Measured today on retire-site's real 1,158-byte plan output with has()'s exact pattern, 3,000 calls each: 'DRY RUN' line 3 of 20 echo|grep -q 2/3000 false misses 'apps.conf row' line 11 of 20 echo|grep -q 2/3000 false misses last phrase line 20 of 20 echo|grep -q 0/3000 'DRY RUN' here-string 0/3000 Rare per call, but verify makes hundreds of these calls, and the retire-site suite went red on those two exact phrases twice this week, passing every rerun. It is worse in a NEGATIVE check - hasnt() read a false miss as a PASS. And several copies are not tests: deploy-hetzner.sh exits 1 on a false miss, and the sshd drift watch would raise a false security alert. All 82 rewritten to `grep -q PAT <<<"$x"` (a here-string is not a pipeline, so there is no writer to signal) by a script that only touched the simple quoted-variable form and reported anything else. Checked: all 22 files pass `bash -n`, every file is a 1:1 line swap (82 lines), and the 20 line-continuation sites keep the here-string before the trailing backslash (the first draft of the rewrite got those wrong; caught in a dry-run diff before anything was written). #587's comment is corrected so it stops teaching the wrong threshold. Gate: scripts/test/no-grep-q-in-a-pipe.ts ratchets it repo-wide, including forms the rewrite skipped (e.g. "$(cmd)" | grep -q), and self-tests that its detector still fires. Proven by restoring the original deploy-hetzner.sh line. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
04cedba195 |
Loki's public face belongs to the tenants who agreed to be on it (#798)
* fix(setup): the documented local setup produced a broken app Followed README.md and .env.example exactly on a clean checkout and got an app that renders but cannot read a session. Three separate gaps, each on the documented path: - AUTH_TRUST_HOST was undocumented. src/auth.ts gates trustHost on it, and scripts/hetzner/gen-env.sh writes it on the box — but .env.example, the README's "minimum local .env.local", docker-compose.yml and loki-app.sh all omitted it. Unset, Auth.js answers EVERY /api/auth/session with 500 UntrustedHost. Verified: 500 before, 200 after, nothing else changed. The auth.ts comment claimed the local production server set it; it did not. - The compose db image has no pgvector. knowledge-embeddings.ts declares vector(384), so `drizzle-kit push` dies on the first table with `type "vector" does not exist` and leaves an EMPTY database — which reads like a broken checkout rather than a missing extension. Switched to pgvector/pgvector:pg17 and added an initdb script that creates it before the migrate service runs. - drizzle.config.ts never loaded .env.local, though a dozen scripts under scripts/db and scripts/test do. `pnpm run db:push` therefore threw "DATABASE_URL is required" at someone who had just set DATABASE_URL where the README told them to. An exported variable still wins, so CI and the box are unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(projects): the empty state named a button that does not exist A new account with no projects is told to "Register your first project with 'New project' above". There is no "New project" control on the page — the button reads "Add", and the dialog it opens is titled "Add Project". The component file is called NewProjectButton.tsx, which is most likely where the copy came from. Found by signing up as a new user and following the onboarding instruction literally: the first thing the product asks you to do names a control you cannot find. Now says "Add", matching what is rendered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * feat(fleet): a project reaches Loki's public catalogue only by consent /fleet is unauthenticated and speaks for the PRODUCT, not for a user. It resolved a single account — getSelfImprovementTarget(), "whoever owns the oldest entity named loki" — and published every project that account had. Two things were wrong with that in a multi-tenant product: 1. No decision was ever recorded. A project was on a public page because it existed. Every other public surface here already goes through getPublicProjects (the landing hero, /u/[username]); /fleet was the only one reading the unfiltered query. 2. WHICH account got published was a side effect of the self-improvement loop's notion of "which product am I improving". Reseed that entity and the next-oldest match's whole project list becomes Loki's front page. So consent is now a stored property of the project: - user_projects.listed_publicly, DEFAULT FALSE. The default is the point — signing up must never enrol a tenant in the product's shop window. - getPubliclyListedProjects() reads consent instead of ownership, across all accounts, which is also what makes the page meaningful with more than one user. /fleet no longer selects by owner at all. - A per-project toggle on the project workspace, beside the existing "Publish to OrangeCat" opt-in and reversible from the same control. - 0075 backfills the account publishing the catalogue today, so the live page is unchanged for it while everyone else starts at false. Also: FleetRegisterNote told EVERY account "19 sites are hosted on the box with no project here" — apps.conf describes one box and is a file in this repo, so a brand-new user was being told about sites they do not own. It now renders only for the account that operates that box. A user's own profile (/u/[username]) is deliberately untouched: that page is the user speaking about themselves, and it was already scoped. scripts/test/public-catalogue-consent.ts pins all of it — swapping the query back is a one-word change, and a comment cannot hold that line. Verified against a real database: consent false -> absent from /fleet, true -> present, toggled both ways through the UI. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * feat(public): what a signed-out visitor sees is a decision, not an accident Answers "whose projects does a stranger see on Loki?" — with three tiers instead of three different hardcoded owner lookups. THE PROBLEM. Loki is multi-tenant and the founder is tenant #1, but every public surface resolved an owner and published whatever that account held: - the landing hero → getHeroFleetSnapshot(getDefaultUser()) - /fleet → getSelfImprovementTarget() (fixed in the last commit) - the /projects note→ nothing at all Three answers to one question is three chances to be wrong, and the landing was the worst of them: it never consulted consent at all. Verified locally — a project with listed_publicly = false was rendering in the hero console. It also ordered by a hardcoded FLAGSHIPS = ["loki", "orangecat"], the ad-hoc version of "featured", which could only ever name the founder's own projects. The same list sat in /u/[username], where it reordered EVERY tenant's profile by two names they will never have. THE MODEL. src/db/queries/public-visibility.ts is now the one place that says what a signed-out visitor may see: 1. AGGREGATE — fleet-wide counts. Identify nobody, need no consent, and grow honestly as Loki gains users. 2. CATALOGUE — /fleet: projects whose OWNER opted in (listed_publicly). 3. SHOWCASE — landing hero: the catalogue narrowed to what the OPERATOR featured (featured_at). Curated space cannot be first-come. Two gates because they answer to different people: consent is the tenant's and may be withdrawn; featuring is the operator's editorial act. The showcase predicate is BUILT ON the catalogue predicate, so revoking consent drops a project off the homepage immediately even while it is still featured — verified all three ways against a real database. This is the doctrine site_feedback.featured_at already had ("raw visitor text NEVER auto-publishes"). Projects now work the way feedback already did. Featuring is authorized by isSiteOperator (users.is_default — the account made at /setup, so it means "runs this instance" for self-hosters too) and lives on its own query rather than riding patchProject, because it is the one project field a tenant must not set for themselves. It also refuses to feature a project whose owner has not consented. UI: two separate controls on the project workspace, deliberately not merged — "List publicly" (owner) and "Feature" (operator, shown only to them, and explaining itself when consent is missing). ALSO, from auditing the public pages at 320/390/768/1440: - /fleet had 19 sub-44px tap targets — every one the site address that is the whole point of the row, and the only sub-44px targets left on any public route. .ui-public-fleet-site was missing from the touch floor AND was an inline box, where min-height does nothing. Both fixed; now zero. - The responsive auditor EXCLUDED public routes, deferring to `smoke` "which already covers them" — smoke asserts HTTP status, which says nothing about a layout. So the pages a stranger sees first were the only ones with no responsive coverage. They are in the auditor now and need no session, so a session is required only when authenticated pages are requested. No horizontal overflow at any width, before or after. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(fleet): a phone spent a screenful on filters before the catalogue Measured at 390x844: the first project row sat at y=1020px. Four facet rows (Where / Kind / For / Missing) took 366px of that, so you scrolled past more than a screen of controls before seeing any of the thing they control — on a page whose entire job is to show a catalogue. The rows now live in a <details> that is collapsed below md and forced open from md up, so desktop is unchanged and the phone leads with content: first row y=1020 -> 699. The summary carries a count of active facets, because a filter you cannot see is one you forget you set — and then an empty result reads as a broken page rather than a narrowed one. <details> rather than state, because this page deliberately ships no JavaScript ("the address bar is the state") and a filter panel that needed a bundle to open would be the one thing on it that did. One trap worth recording: hiding the closed panel has to be EXPLICIT. The UA sheet hides a closed <details>'s children with display:none, but author styles outrank the UA sheet and .ui-fleet-facet-row is `@apply flex` — so the first version rendered a toggle that changed nothing, with the element correctly reporting open=false while all four rows stayed visible. Verified both states at both widths after the fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * feat(public): credit the builder, ask before publishing, stop renting the box Four things, all following from the same rule: Loki is multi-tenant, so its public face belongs to the tenants who agreed to be on it. 1. ATTRIBUTION. A showcased project now carries a byline — @handle linked to /u/[handle], display name when there is no handle, and NOTHING when there is neither, because a stand-in label is a name we would be inventing for somebody. Showing a tenant's work unattributed reads as "our projects", which is untrue and is the opposite of why a showcase exists; being credited and linked is also most of what a tenant gets back for consenting. Joined in the query rather than fetched per row. 2. LOKI ASKS. Consent was reachable only from a toggle nobody knew about, and a control nobody finds collects exactly one answer. The empty catalogue that follows is what gets "fixed" by widening the query again — the bug 0075 removed. So the project workspace now invites the owner once, and listing_prompt_dismissed_at takes no for an answer: per project (declining for a client build says nothing about the open-source one beside it) and in the database (a refusal that resets on a new device is a product that nags). The rule lives in src/lib/listing-invitation.ts, pure and unit-tested. The bar is repo + active, deliberately NOT a live URL: /fleet's own facets list "Being built" beside "Live", so requiring a deployment would ask only the projects that least need the exposure. 3. THE BOX IS NOT THE FLEET. apps.conf describes ONE box and is a file in this repo, and unmatched entries MINTED rows — so a Loki with one consented project still published 19 sites belonging to someone the viewer has never heard of. buildFleetRegister now takes includeUnlinkedSites, true only for the operator, for whom those rows are the entire point (the register read sideways is a to-do list). A hosted app still ENRICHES a project that exists, so a consented project keeps its real address either way; only row creation is gated, because only row creation publishes something nobody asked to publish. Verified: operator sees 20 projects / 19 sites, the public sees 1 / 0. 4. THE COPY. "This is the studio's whole catalogue" was true when one account was the whole fleet. It now says what the page is: projects their owners chose to show. Also, from re-auditing: .ui-public-fleet-name (the row's PRIMARY link) measured 21px tall on a phone. It had been invisible to every previous audit because while the page listed hosted sites alone, nothing in a row was a link at all — the fix in 3 is what made a real project row render and the gap appear. Same cause as .ui-public-fleet-site last time: the coarse-pointer floor sets min-height, which does nothing to an inline box. Every public page: zero horizontal overflow and zero sub-44px targets at 320/390/768/1440. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(home): the hero console had an empty third column Making the hero tenant-agnostic dropped "runs this week", because the old one counted getRecentOrchestrationRuns(userId) — one account's week, which is not a number a visitor should be shown. But the console's metric row is grid-cols-3, so removing it left a visibly empty third of the panel. Caught by looking at the rendered page rather than the diff. Restored fleet-wide, counted the same way as the other two: it is the metric that answers "is anything actually happening here", and an aggregate across every tenant identifies nobody, so it needs no consent and grows with the product instead of describing one account. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(footer): the studio's sites were labelled as Loki's fleet Every public page's footer lists 14 sites generated from apps.conf under "Part of the fleet — 14 more sites". apps.conf describes ONE box, the studio's, and several of those sites belong to clients — so on a multi-tenant Loki the label told every visitor that one account's client work was what Loki is. Same error as the /fleet lede, and the same fix: say whose they are. "Built by the studio" now, and the link beside it points at the tenants' catalogue by its real name rather than calling it "the whole register". Deliberately a COPY change and nothing more. The links themselves stay, all 14 of them: they are real work, several had no inbound link from anywhere before this block existed, and the cross-linking is the entire reason it is here. Removing them would trade a genuine asset to fix a sentence. Only the claim was wrong. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(home): the hero console looked broken with nothing featured 0076 deliberately does not backfill a feature stamp — featuring is an editorial act nobody has performed yet — so the live hero will really render with zero project rows until someone features something. I had asserted that was fine without looking at it. It was not. The bar carries mb-4 + border-b and the metrics carry mt-4 + border-t, so with no rows between them the panel drew TWO horizontal lines with 32px of nothing in between: the shape of content that failed to load, on the first screen of the product. The metrics now sit flush under the bar's own border in that state, which is a panel with nothing to list rather than a panel that broke. Verified in both states: with rows the divider is back and the flush class is absent. Not fixed by falling back to showing consented-but-unfeatured projects, which was the tempting option: the invitation asks permission for the public fleet page specifically, so putting those projects in the hero would take more than the owner agreed to. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A * fix(fleet): an empty catalogue told visitors to clear filters they never set With nothing listed, /fleet rendered "Nothing matches that. Clear the filters →" — to a visitor who had set no filters, offering a link that changes nothing. That is the FIRST thing a freshly self-hosted Loki ever says on that page, and it reads as a fault rather than an empty shelf. Two states now, told apart by `rows` (the whole catalogue, before the query) rather than `result.rows` (after it): nothing listed at all → says so, and says why: owners choose which of their projects appear, and nothing is published without them saying so. Links to what Loki does. filtered away → unchanged: "Nothing matches that" + clear the filters. Found by putting the local database into the state a new install starts in, rather than only the state mine happened to be in. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJkpuZ2F3GWrB6TLycwy4A --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
58174f45ef |
fix(hardcoded): give every duplicated constant one home (#758)
* fix(hardcoded): give every duplicated constant one home A sweep of all 44 repos' default branches for literals that duplicate an existing source of truth. Loki's share, in four groups. WRONG, and live on the public footer. src/config/fleet-site-copy.ts still called the Zürich clinic "VitaReBa", a name retired on 2026-09-10 — its own title says "Vita · Metabolische Psychiatrie & Systemische Longevity". The generated fleet-sites.ts carried it onto loki.orangecat.ch, where it was serving until this commit. Fixed at the copy file, which is the one place that owns a site's own words, and the footer regenerated from it. WOULD HAVE WRITTEN STALE DATA. scripts/seed-fleet-site-urls.ts kept a hand-typed slug → URL map "read 2026-08-06". Two of its fifteen entries pointed at hosts retired since (aoz-wohnen.orangecat.ch, revampit.orangecat.ch), so running it would have filled empty live_url columns with addresses that only 308. It now derives the map from apps.conf — the same register the footer is generated from — which also fixes the six live sites the hand list never had. Verified: 19 sites, zero retired hosts. THE BOX ADDRESS, in seven places. scripts/hetzner/_box-env.sh has been the SSOT for it all along and sixteen scripts source it; four did not, and the shared deploy workflow — reused by ~20 repos — had the IP inline twice, so moving the box meant twenty edits. The workflow now reads the org-level Actions variable HETZNER_IP and fails loudly if it is unset, rather than ssh-ing to an empty string. loki's own deploy.yml had `vars.HETZNER_IP || '<literal>'`, a fallback that guaranteed the variable was never needed and so never noticed if wrong. ONE LAPTOP, baked into shipped code. site-cd-local.ts listed /home/g/.ssh and /home/ubuntu/.ssh as deploy-key candidates beside os.homedir() — which already IS those paths, since loki-app runs as `ubuntu` and a laptop runs as its owner; both spelled one homedir for one named person. install-push-deploy.sh wired hooks to /home/g/dev/loki, link-prod-runtime.ts to /home/g/dev/bitbaum, and scripts/fleet printed an install line only true on one machine: all now DEV_ROOT or the script's own resolved path. The two scripts in scripts/local are INSTALLED BY COPY into ~/.local/bin and run there by systemd timers, so they resolve _box-env.sh beside the real file first, then under DEV_ROOT, and exit loudly if neither exists — a security check that cannot find its target must not look like one that found nothing. Deliberately unchanged: the slug alias map (the mechanism that makes a rename safe), an executed migration's data row, the retired-handle detector's own handle list, and test fixtures reproducing past incidents. Verified: fleet-sites-derived in sync (14 sites), bash -n on every edited script, and the branch's only remaining literals are in scripts/test fixtures. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(push-deploy): the generated hook must not bake one laptop's path install-push-deploy.sh writes the hook body through an UNQUOTED heredoc, so $HERE expanded at generation time and the absolute path of one machine was committed into every repo's .husky/pre-push. kivvi and botsmann both carried it; anyone cloning those repos got a hook pointing into a stranger's home directory, and re-running the installer would have put it straight back after those repos were cleaned. The hook now resolves ${DEV_ROOT:-$HOME/dev}/loki/... at RUN time, so the generator stops re-introducing what the cleanup just removed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
95c40a9cd8 |
refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now share one name. 638 files, ~3,000 mentions: UI copy, config, env keys (FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs, articles, the deploy workflow other repos reuse, and nine file names. - Three article slugs carried the old name and had been shared; permanent redirects keep those links alive (next.config.ts). - test-no-retired-name.sh now also forbids the old product name across the whole repo, so the rename cannot creep back through templates and examples. - ASSISTANT_STACK collapses the product and the assistant into one entry, because they are now the same name. Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki` database and role, loki.orangecat.ch (old host 308s to it; /api, /widget, /embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases. The Resend sending domain stays fleetcrown.orangecat.ch until the new domain is verified in DNS. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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>
|
||
|
|
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> |
||
|
|
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
|
||
|
|
cdc042a131 | feat: ship activity runtime parity fixes | ||
|
|
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. |
||
|
|
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>
|
||
|
|
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> |
||
|
|
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
|
||
|
|
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 | ||
|
|
8be96443fc | fix(control): sync daemon runtime source of truth | ||
|
|
f20e520268 |
feat(infra): oracle-await script + cutover SKIP_DUMP/NODE_ENV hardening
Finishes the Oracle migration plumbing started in
|
||
|
|
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> |