Commit Graph
13 Commits
Author SHA1 Message Date
g-butandClaude Sonnet 4.6 3a56dbc748 chore: seed scripts, crons, sessions, docs, gitignore, package updates
- scripts/seed.ts + seed-goals.ts — updated entity/attribute seeding
- src/app/api/crons/route.ts — cron schedule updates
- src/app/api/sessions/route.ts — session handling fix
- docs/ — openclaw orchestration plan document
- .gitignore — added .next/logs to ignore list
- package.json/lock — dependency updates
- next-env.d.ts — auto-generated update

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:50:29 +02:00
g-butandClaude Sonnet 4.6 449f4d77fd feat(brain): brain-agnostic orchestration framework + agent registry + control panel UX
Replaces the Claude-only prompt loop with a neutral orchestration layer
that dispatches tasks to whichever agent is available. When one brain
runs out of tokens, switching to another requires one tap.

New infrastructure:
- src/lib/orchestration/ — contract, 10 task intents, adapter definitions,
  prompt renderer, OpenClaw runner, summary parser
- src/lib/agent-registry.ts — detects claude/codex/openclaw/gemini from
  PATH; reads configured model from dotfiles
- src/lib/agent-preferences.ts — persists selected brain to
  ~/.config/cockpit-agent.json; syncs model back to Claude settings
- src/lib/agent-catalog.ts, agent-runtime.ts, switch-agent.ts — catalog,
  zellij tab restart logic, agent switching action
- src/db/schema/orchestration-runs.ts + queries — DB-tracked runs

New API routes:
- /api/control/agent — GET brain config, POST to switch + restart zellij tabs
- /api/orchestration/run — brain-agnostic dispatch: claude/codex → inject
  rendered prompt into zellij tab; openclaw → fires detached worker
- /api/orchestration/run/execute — synchronous execute endpoint for worker

Control panel UX:
- Brain section collapsed to a single pill, expanding only when needed
- Intent buttons replace hardcoded "OpenClaw" buttons — Next best, Test & fix,
  Quality, Commit, +5 under More; each shows "via {adapter}"
- agentRunning detection uses /proc scan against configured agent matchers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 11:49:08 +02:00
g-butandClaude Sonnet 4.6 d47cc7a8cd perf(api): make /api/control non-blocking with async git queries
Replace 76 sequential execSync calls (19 projects × 4 git commands)
with Promise.all — all projects and the pgrep check now run in parallel.
Event loop no longer blocks on each request; response time drops from
~40s to ~2s.

Also: add /control and /api/control to smoke.sh route lists; bump
reachability probe timeout from 5s to 20s for dev-mode compilation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 18:51:54 +02:00
g-butandClaude Opus 4.7 00735be6a0 refactor(money): $type<> currency + frequency, drop "one-time" literal outlier
Final pair of text columns missing `.$type<>()`:

- subscriptions.currency: now $type<SubscriptionCurrency>(). The
  literal "CHF" default stays as-is — it's already the canonical
  default and the type is ["CHF","USD","EUR","GBP"], so the literal
  cannot drift.
- subscriptions.frequency: now $type<SubscriptionFrequency>() with
  the default routed through FREQUENCY.MONTHLY (SSOT).

Side-effects:
- Both subscriptions API routes' `CURRENCIES_ENUM` and
  `FREQUENCIES_ENUM` were typed `readonly [string, ...string[]]`,
  so z.enum widened to string and the tightened `.set()` rejected
  it. Tightened to the typed tuples — matches what every other
  enum cast in /api now does.
- scripts/seed.ts gains two boundary casts for sqlite legacy data.
- SubscriptionActions had `frequency === "one-time"` — the only
  literal outlier in that file (every other branch already used
  FREQUENCY.X). Now also goes through FREQUENCY.ONE_TIME.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 22:49:13 +02:00
g-butandClaude Opus 4.7 b0060a539c refactor(schema): finish $type<> coverage on the remaining 4 status columns
Last turn I claimed this lane was done — it wasn't. goals.status,
commitments.status, events.status, and actions.status were still
plain `text("status")` while their canonical unions sat next door
in lib/constants/statuses (GoalStatus, CommitmentStatus, EventStatus,
ActionStatus). Now consistent with the just-tightened entities.type
and subscriptions.status.

Each gains `.$type<XStatus>()` and the literal default ("active",
"draft") routes through the constant (XSTATUS.ACTIVE / .DRAFT) — so
the SSOT is the `as const` enum, not duplicated literals.

Two boundary follow-ups:
- scripts/seed.ts: two more `as XStatus` casts where sqlite legacy
  data crosses into Postgres.
- /api/events/[id]: `STATUSES = Object.values(EVENT_STATUS)` was
  typed `[string, ...string[]]` so z.enum produced `string` and
  drizzle's tightened .set() rejected it; tightened to
  `[EventStatus, ...EventStatus[]]`.

Net: every text-status column in the codebase is now `.$type<>`-
typed, and the literal defaults all derive from the enums.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 22:13:12 +02:00
g-butandClaude Opus 4.7 20dda22aa1 refactor(schema): type entities.type and subscriptions.status with their unions
Same pattern as the just-shipped habit-frequency tightening — two more
text columns with canonical union enums in lib/constants/statuses but
no `.$type<>()` annotation, so Drizzle inferred plain string and the
unions only existed in display/comparison code.

- entities.type: now $type<EntityType>(). Drops the `type as EntityType`
  cast inside TypeBadge in memory/page.tsx — TypeBadge prop is now
  EntityType directly.
- subscriptions.status: now $type<SubStatus>(). Drops the `as SubStatus`
  cast in money/page.tsx; the literal `"active"` default also now
  routes through SUB_STATUS.ACTIVE (SSOT).

scripts/seed.ts gains two boundary casts (`as EntityType`, `as SubStatus`)
for the legacy sqlite import — sqlite is the system boundary where
unvalidated string data enters, so casting there is appropriate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 22:08:38 +02:00
g-butandClaude Opus 4.7 2df42d77e3 chore(smoke): also fail when error.tsx boundary renders inside a 200
Status-only smoke missed a real failure mode: when a Server Component
throws, Next.js renders src/app/error.tsx ("Something went wrong")
INSIDE a 200 response. The page is broken from the user's perspective,
but smoke would mark it ok.

Refactor into a check_route helper that pages call with body-content
checking enabled. Greps the response body for the error-boundary
marker; failing-when-found means the run page doubles as a sanity
check on every server component, not just the route resolver.

API routes skip the body check (the marker is HTML-only and an API
that returned the literal string would be unusual).

Verified: all 18 routes still pass; the grep would catch a fake
error response if one were served.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 20:53:04 +02:00
g-butandClaude Opus 4.7 8d22c160e4 chore(smoke): add dynamic /api/people/<id> coverage via id discovery
Static-list smoke caught compile + db breakage but missed regressions
specific to [id] route handlers — readIdParam errors, per-row drizzle
queries, the parameter-handling lifecycle, etc.

Discover the first person id from /api/people (already smoked), then
GET /api/people/<id> and assert 2xx/3xx. Skipped silently if jq isn't
installed or the list is empty, so the script stays portable.

Other dynamic GETs (/api/projects/<id>) aren't smoked because no list
endpoint exists to derive an id without an extra DB roundtrip.

18 routes total now pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 10:43:11 +02:00
g-butandClaude Opus 4.7 b2cbe5adb7 chore(scripts): smoke also hits the 6 DB-backed GET API endpoints
Page-only smoke caught compile-time route breakage but missed
server-side regressions: a broken Drizzle query would render every
page as "Error" yet still return 200. Add the DB-backed API GETs:

  /api/goals, /api/habits, /api/people, /api/events, /api/crons,
  /api/system

Tool-dependent endpoints (/api/calendar, /api/weather, /api/github)
stay out of the default run because they need the local Ivy gateway
and would flake on machines that don't have it.

Verified: all 17 routes (11 pages + 6 APIs) return 200 against the
running dev server.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 18:32:46 +02:00
g-butandClaude Opus 4.7 b9aa7e657c chore(scripts): add npm run smoke — route-level regression check
Until now the codebase had zero automated coverage; every refactor
relied on a manual curl loop. scripts/smoke.sh runs that loop in one
command: probe BASE/, then GET every page route and assert 2xx/3xx.

- Routes match config/navigation.ts NAV_ITEMS plus the / redirect
- BASE env var override for prod smoke (defaults to localhost:3000)
- Fast-fails with a clear "start the dev server first" message if
  the base is unreachable, instead of dribbling 11 curl errors
- No new dependencies — bash + curl only

Verified: all 11 routes return 200 against the running dev server.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 18:30:20 +02:00
g-butandClaude Opus 4.6 afcc318468 feat: CLAUDE.md, real goals, zellij tab mapping
- CLAUDE.md with full project conventions, architecture, SSOT rules
- Seed 10 real goals: God Mode, Financial Independence, Civilizational Stack, Health, Relationships + 5 sub-goals with milestones
- Add Cockpit to ~/.config/claude-projects.conf for zellij auto-detect

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 00:36:24 +02:00
g-butandClaude Opus 4.6 102c35c3e3 feat: Cockpit Phase 1 — full app with 6 active views
- Next.js 16 + Tailwind 4 + shadcn/ui + Drizzle ORM + PostgreSQL 17
- 9-table knowledge graph schema with UUIDs, JSONB, multi-user prep
- Seed script: knowledge.sqlite (33 entities) + contacts (1,278 people)
- Today: calendar (gog), weather, commitments, upcoming bills
- People: searchable grid of 1,286 contacts, detail panel
- Money: subscription tracker, monthly burn calculation
- Projects: project list + GitHub CI status
- System: gateway health, memory, disk, uptime
- Memory: knowledge graph stats and entity distribution
- Goals: placeholder (Phase 2)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 23:31:14 +02:00
g-but 0e0852330a feat: initial commit 2026-04-04 22:47:22 +02:00