Commit Graph
4 Commits
Author SHA1 Message Date
g-butandClaude Opus 4.7 aeeaa466f7 feat(home): M2 — local Brain skeleton (tail event log → project state → /api/state)
Second milestone of the greenfield rewrite. A standalone Node HTTP server
in home/ that boots, tails ~/.<APP_SLUG>/events.jsonl, projects each event
into per-project state, and serves a minimal status UI at localhost:3001.
No external deps beyond node:* and the existing zod via @/lib/events.

  home/state.ts   pure applyEvent(state, event) → state — testable in
                  isolation; project view stays minimal (currentRun,
                  lastHandoff, recentOutcomes ≤ 5) for M2
  home/log.ts     tail one JSONL file via fs.watch + position tracking;
                  replays existing content on boot, recovers from file
                  truncation, returns parse errors via onError instead of
                  throwing (so a garbled line doesn't kill the daemon)
  home/server.ts  HTTP server with /control HTML view + /api/state +
                  /api/health + /api/events (manual append for testing).
                  Vanilla JS in the HTML, no React yet — that lands when
                  the brain replaces the existing /control surface.

End-to-end verification (against ~/.cockpit/events.jsonl):
  - worker.started     → project appears with running pill
  - worker.finished    → pill clears, outcome glyph ✓ in streak,
                         handoff text shown

tsconfig.json includes home/**/*.ts so the existing tsc + eslint gates
cover the new code. Runs separately from the Next.js app — no port
collision, no Vercel involvement, no DB needed.

What this commit deliberately does NOT do:
  - emit events (M4 — replace the agent stop-hook to append to the log)
  - decide (M5 — pure decide() function over state)
  - dispatch (M6 — wire bridge.dispatch back to a worker)
  - persist beyond the log (state rebuilds from log replay on boot)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 01:23:03 +02:00
g-butandClaude Sonnet 4.6 94107a3006 refactor: promote input variants to ui-* classes, eliminate DeleteCommitmentButton
- Add ui-input-compact and ui-input-tight to globals.css (visual SSOT)
- Remove FIELD_INPUT_CLASS_COMPACT / FIELD_INPUT_CLASS_TIGHT string constants from form.tsx
- Inline ui-input-compact/tight directly in all 17 components (no import needed)
- Delete DeleteCommitmentButton.tsx (52-line reimplementation of DeleteButton);
  CommitmentItem now uses DeleteButton directly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 06:44:46 +02:00
g-butandClaude Sonnet 4.6 70d1d6def4 feat(packaging): self-hosted distribution foundation
First-run flow:
- /setup page + /api/setup: creates first user with hashed password
  (Node crypto scrypt, no new deps). POST rejects if users already exist.
- Landing page redirects to /setup when DB has no users
- middleware.ts: protects app routes, passes public pages through

Auth:
- passwordHash column added to users schema (drizzle-kit push applied)
- src/lib/password.ts: hashPassword/verifyPassword via Node scrypt
- auth.ts Credentials: env var takes priority, falls back to DB hash
  so packaged installs work without LOCAL_AUTH_PASSWORD

Multi-tenancy groundwork:
- Replaced DEFAULT_USER_ID with getCurrentUserId() across all 12 API
  route files (people, subscriptions, events, goals, projects, commitments)

Docker:
- Dockerfile: multi-stage Node 22 alpine, standalone output
- docker-compose.yml: postgres + migrate + app services
- .dockerignore, .env.example with documented required vars
- next.config.ts: output: standalone
- package.json: added migrate script (drizzle-kit push)
- tsconfig.json: scope to src/ only, exclude .next generated files

Install: clone → cp .env.example .env.local → docker-compose up
First visit → /setup → create account → sign in → done.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 13:46:07 +02:00
g-but 0e0852330a feat: initial commit 2026-04-04 22:47:22 +02:00