logicsrc/apps/logicsrc-web
Anthony Ettinger 3649f78fb6
feat(web): serve the CLI login flow from the apex (#106)
`logicsrc login` defaults to https://logicsrc.com (#104), but every path it
needs returns 404 there: the apex runs the marketing app, while /cli/* lives in
apps/pwa on its own service.

Proxy those paths from the app that owns the apex, the same way CommandBoard is
already proxied. No DNS record, no Railway custom domain, and no subdomain --
and it makes the CLI's existing default origin correct rather than requiring
another change to chase it.

Pointing the apex at the pwa instead was the obvious alternative and is wrong:
the pwa serves `/` too, so it would take the marketing site down with it.

Proxied:
  /cli/:path*            the device-code and loopback login flows
  /api/me                identity
  /api/credshare/:path*  the credential-sharing API used after login
  /auth/:path*           /cli/authorize and /cli/device are behind requireAuth,
                         so an unauthenticated visitor is redirected here; without
                         it the browser half of the flow dead-ends on a 404

Order matters and is asserted: CommandBoard owns a catch-all /api/:path*, so
/api/me and /api/credshare/* have to match first or CLI auth silently goes to
the wrong service.

Rewrite construction is factored into pure functions so the ordering is testable
without booting Next, and degrades cleanly: with CREDENTIALS_APP_URL unset the
output is byte-identical to what shipped before.

Requires CREDENTIALS_APP_URL on the logicsrc-web service, pointing at the
credentials app's origin.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 10:25:16 -07:00
..
contract feat(web): serve the CLI login flow from the apex (#106) 2026-07-30 10:25:16 -07:00
e2e feat(web): move Hire Us pricing to $400/hour metered billing (PRD 0002) (#102) 2026-07-28 10:34:49 -07:00
public fix(cli): make logicsrc update actually check for updates 2026-07-29 06:15:28 +00:00
src feat(web): move Hire Us pricing to $400/hour metered billing (PRD 0002) (#102) 2026-07-28 10:34:49 -07:00
.gitignore Migrate logicsrc-web from Vite SPA to Next.js 16 App Router 2026-06-07 03:41:48 +00:00
next.config.ts feat(web): serve the CLI login flow from the apex (#106) 2026-07-30 10:25:16 -07:00
package.json feat(openontology): Phase 2 + Phase 3 — storage, REST/SSE, MCP, RDF/SHACL, adapters, TUI, explorer (#101) 2026-07-28 05:10:33 -07:00
playwright.config.ts Migrate logicsrc-web from Vite SPA to Next.js 16 App Router 2026-06-07 03:41:48 +00:00
tsconfig.json Migrate logicsrc-web from Vite SPA to Next.js 16 App Router 2026-06-07 03:41:48 +00:00
vitest.config.ts Migrate logicsrc-web from Vite SPA to Next.js 16 App Router 2026-06-07 03:41:48 +00:00