Skip to content

feat: import Peregrine IDE from Peregrine.ai (history-preserving) — ecosystem decision D2 - #2

Merged
JaeTierce31 merged 167 commits into
mainfrom
claude/sovereign-ecosystem-review-upsg8u
Jul 7, 2026
Merged

JaeTierce31 merged 167 commits into
mainfrom
claude/sovereign-ecosystem-review-upsg8u

Conversation

@JaeTierce31

Copy link
Copy Markdown
Member

What this is

Executes decision D2 per the merged docs/MIGRATION.md: Peregrine.ai's main — the full 166-commit product history — is merged into this repo with --allow-unrelated-histories, so blame and commit history survive.

What changed beyond the raw import

  • README: the charter stays as the front page (status updated: code imported; deployment cutover pending); the product README moves to docs/PEREGRINE.md.
  • Stack reconciliation (review finding 4.4-2): docs/PEREGRINE.md and CLAUDE.md now describe the stack as built — Supabase Postgres via Drizzle, Clerk v7, yjs collab over a Cloudflare Worker — replacing the stale Turso/Codeium/ONNX/Fly.io claims. Noted that the typecheck script referenced in CLAUDE.md does not exist (npx tsc --noEmit is the actual command).
  • Secret hygiene (review finding 4.4-1): the Supabase anon key embedded in the imported CLAUDE.md is removed — replaced with an env-var pointer and a rotation note. The key still exists in Peregrine.ai's git history; rotation remains required.
  • The imported Peregrine.ai-specific ECOSYSTEM.md was dropped (superseded by the charter + the master map in Sovereign-Dominion).

Verification

  • npm ci — installs clean (.npmrc legacy-peer-deps preserved)
  • npx tsc --noEmit — no errors
  • npm run lint — passes (one pre-existing react-hooks/exhaustive-deps warning in DesktopIDE.tsx)

Deliberately NOT in this PR

  • Deployment cutover (MIGRATION.md §3): the Vercel project still builds from Peregrine.ai; re-pointing it, verifying auth/billing/collab, and archiving the source repos are the follow-up manual steps.
  • Supabase key rotation (dashboard action).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AaDVnrK5QYQJ42SG7ZzA9e


Generated by Claude Code

JaeTierce31 and others added 30 commits May 9, 2026 01:46
…flare Workers, CI

Full project scaffold: mobile-first cloud IDE with App Router route groups, xterm terminal, yjs CRDT collab layer, next-pwa, Clerk auth, Stripe billing stubs, Cloudflare Worker deploy scripts, GitHub Actions CI (tsc + lint), and all build-time errors resolved.
- Replace vercel.json with typed vercel.ts (@vercel/config/v1)
- Use key-value array format for headers (Vercel platform validation)
- Guard ClerkProvider against missing NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
  to prevent atob() DOMException during static generation of /_not-found

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
- Upgrade @clerk/nextjs ^5 → 7.3.3
- Move ClerkProvider inside <body> per v7 requirements
- Add <Show>, <SignInButton>, <SignUpButton>, <UserButton> to header
- Update middleware: async auth.protect() with v7-recommended matcher
- Fix lib/auth.ts: await auth() (v7 async API)
@clerk/[email protected] requires next@15+; project uses next@14.
legacy-peer-deps=true lets npm ci resolve the tree without upgrading Next.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
Captures architecture, env vars, git workflow, Vercel targets, known
pitfalls, and Claude Code collaboration patterns for future sessions.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Replaces @libsql/client with drizzle-orm/postgres-js backed by Supabase (zaeximrqiulvhzynnhfe). Schema migrated to pg-core, drizzle.config switched to postgresql dialect, migration SQL updated to Postgres syntax. Supabase project and tables already provisioned via MCP. Requires DATABASE_URL set in Vercel env vars (Supabase → Settings → Database → Transaction pooler, port 6543).
Connects the app end-to-end: Clerk auth → Supabase DB → UI. Adds project CRUD API routes with Clerk user sync, a /dashboard page for listing/creating projects, /project/[id] IDE route, and rewires DesktopIDE to load real files and auto-save on change (800ms debounce). Home page redirects signed-in users to dashboard.
Replaces eager module-level singletons with lazy Proxy wrappers. Both postgres() and new Stripe() were calling new URL() at import time, crashing Next.js during "Collecting page data" when DATABASE_URL contains special characters or isn't available at build time. Clients now only construct on first actual request.
Closes three UX gaps:
- Mobile: add /app/(mobile)/page.tsx project list — users can now browse
  and create projects on mobile without going through the desktop route
- Mobile: wire MobileEditor to real DB (same load/auto-save as DesktopIDE,
  file picker overlay, ← Projects nav); was previously a blank Monaco stub
- Desktop: add /settings page with account info (UserButton) and billing
  section — Upgrade to Pro → Stripe Checkout, Manage subscription → Portal
- Add /api/billing/status, /api/billing/checkout, /api/billing/portal routes
- Dashboard: add Settings link and UserButton in header

Requires STRIPE_PRO_PRICE_ID env var for the checkout flow (optional — page
degrades gracefully if not set).

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Stripe webhook:
- Replace eager new Stripe() (build crash) with lazy proxy from lib/stripe
- Handle checkout.session.completed: set stripeCustomerId + tier='pro'
- Handle customer.subscription.updated: toggle pro/free based on status
- Handle customer.subscription.deleted: set tier='free'
- Guard missing sig/secret instead of crashing

CollabProvider + DesktopIDE:
- Expose onPeerJoin/onPeerLeave/destroy from lib/collab.ts
- CollabProvider tracks connected peers and exposes via context
- DesktopIDE wraps IDECore in CollabProvider when NEXT_PUBLIC_CF_WORKER_URL
  is set and Clerk user is loaded; degrades to no-collab when not configured
- CursorPresence avatars appear in sidebar header when peers are connected

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds a streaming AI chat panel powered by Claude claude-sonnet-4-6:
- /api/ai/assist: POST route with streaming response via Vercel AI SDK
  (streamText → toTextStreamResponse). Requires ANTHROPIC_API_KEY; returns
  503 with helpful message if not set.
- AiPanel component: collapsible right panel (320px) with message history,
  suggestion chips, stop-streaming button, and auto-resize textarea.
  Streams response chunks directly with fetch + ReadableStream (no client
  SDK dependency).
- DesktopIDE: ✦ AI toggle button in editor tab bar; panel opens alongside
  Monaco editor. Passes current file content + language as context.
- Shows "Add ANTHROPIC_API_KEY to Vercel" prompt when unconfigured.

Install: ai@6, @ai-sdk/anthropic@3, @ai-sdk/react@3, zod@4 (AI SDK peer dep)

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds inline new-file creation (+ button → input → POST) and per-file
delete (hover × → confirm → DELETE) to the desktop IDE sidebar.
Wires the corresponding POST and DELETE route handlers in the files API
with ownership checks and language inference from extension.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds a resizable terminal panel to the desktop IDE backed by
WebContainers (browser-native Node.js). The active file runs with
the appropriate interpreter: node for .js, npx tsx for .ts/.tsx,
python3 for .py, sh for .sh. A ▶ Run button appears in the editor
toolbar for runnable file types; ⌨ Terminal for all others.
WebContainer boots on first run and is reused across executions
within the same session.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Routes AI assist requests through Groq (llama-3.3-70b-versatile)
when GROQ_API_KEY is present but ANTHROPIC_API_KEY is not.
Anthropic remains preferred when both keys are set.
Both providers are lazy-imported to avoid build-time issues.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
- PATCH/DELETE /api/projects/:id for rename and project deletion
- Dashboard: hover-to-reveal rename (✎) and delete (×) per project card;
  inline rename input on the card itself
- FileFinder: Cmd+P (or Ctrl+P) opens a fuzzy file picker modal with
  keyboard navigation (↑↓ Enter Esc)
- Keyboard shortcuts in the IDE:
  Ctrl/Cmd+S → flush debounced save immediately
  Ctrl/Cmd+\` → toggle terminal panel
  Ctrl/Cmd+P → toggle file finder
  Escape → close finder → AI panel → terminal (priority order)

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Share toggle in IDE sidebar, copy-link toast, /share/:projectId read-only viewer, GET/POST share APIs.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
Fix missing / route — server-side redirect for signed-in users, hero section, 6-feature grid, Clerk sign-up/sign-in CTAs.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
… (#19)

6 starter templates, mobile AI bottom sheet, wired action bar, AI panel code blocks with copy, mobile nav fix.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
Tab bar above editor, active tab blue border, close tabs without deleting files, ? key opens shortcuts modal.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
…ix (#21)

Search API, GlobalSearch component, project duplicate endpoint + dashboard button, custom 404, manifest start_url fix.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
* feat: unsaved file dots, Ctrl+W close tab, Ctrl+Shift+F search shortcut

- Blue dot on tab when file has unsaved changes; clears on auto-save or Ctrl+S
- Ctrl/Cmd+W closes the current active tab (switches to adjacent)
- Ctrl/Cmd+Shift+F keybinding reserved for global search (GlobalSearch component
  wired after search-and-polish PR merges)
- Shortcuts modal updated with new bindings

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

* wire GlobalSearch into DesktopIDE (Ctrl+Shift+F)

Now that GlobalSearch component is in main, connect it to the Ctrl+Shift+F
shortcut already registered in the previous commit.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

---------

Co-authored-by: Claude <[email protected]>
Adds per-user editor settings (font size, tab size, word wrap, minimap,
theme) saved to localStorage so they survive page reloads. Opens via ⚙
button in toolbar or Ctrl/Cmd+, shortcut.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Double-clicking a file name in the explorer shows an inline input pre-filled
with the current path. Enter/blur commits the rename (PATCH /api/.../files/:id),
Escape cancels. Tab renaming in the header updates automatically since it reads
from files state.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds two IDE quality-of-life improvements:

- Export: "↓ ZIP" button in toolbar uses jszip to bundle all project files
  into a downloadable archive; works entirely client-side from the already-
  loaded files state so no round-trip needed.

- Collapsible sidebar: a thin toggle tab sits at the left edge; clicking it
  collapses/expands the 56-char file explorer. Frees horizontal space when
  working on narrow screens or when the sidebar isn't needed.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Mobile: adds a "+" button to the header bar that reveals an inline
filename input. Submitting creates the file via POST and switches to
it immediately. Empty-state view also shows a "Create first file" CTA.

Desktop: typing triggers a "Saving…" label in the toolbar; once the
800ms debounce fires and the PUT succeeds it briefly shows "Saved ✓"
then clears. Ctrl+S flush also updates the indicator.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds a VS Code-style status bar at the bottom of the editor pane
showing language, line count, encoding, and live cursor line/column.
Cursor position updates via Monaco's onDidChangeCursorPosition event
and resets to 1:1 on file switch.

Also adds Ctrl/Cmd+N as a shortcut to open the new-file input, and
updates the shortcuts modal with the new binding.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds POST /api/projects/import that accepts a multipart ZIP upload,
strips common top-level prefixes, skips binary/oversized files, and
creates a project + file rows in one transaction. Dashboard gets an
Import ZIP button in the header and in the empty-state CTA.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Replace the flat file list with a recursive tree view that groups files
by directory prefix. Folders auto-expand when the active file changes,
sort before files alphabetically, and collapse/expand on click. File
operations (open, rename, delete) work identically to before.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds a Preview toggle button to the toolbar when a .md file is active.
Clicking it splits the editor 50/50 with a live-rendered markdown panel
powered by marked + Tailwind Typography. Preview hides automatically
when switching to a non-markdown file. Installs marked and
@tailwindcss/typography.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
JaeTierce31 and others added 28 commits May 30, 2026 23:58
Adds ImportMap panel that parses ES imports and require() calls, groups them by local/npm/built-in, and lets users navigate to local files. Implements spec section 6.14 architecture infographics.
Adds microphone button and Ctrl+Shift+V shortcut for continuous speech recognition. Final transcripts insert at cursor via executeEdits; interim results show as a pulsing overlay. Gracefully degrades on unsupported browsers.
Adds 🍅 status bar button for a Pomodoro cycle: 25 min focus → 5 min break, long break after 4 rounds. Live mm:ss countdown, browser notifications on phase transitions, command palette entry.
…tepad)

Adds a pencil-icon sidebar tab for a per-project freeform notepad persisted in localStorage. Preview toggle renders minimal Markdown. Char/word count in footer; clear button with confirm guard.
Adds ColorSwatchPanel showing all hex/rgb/hsl color literals in the active file as swatches with click-to-copy. Luminance-aware text contrast. Triggered by Ctrl+Shift+C, toolbar button, or command palette.
… capture groups

Opens a modal where developers can write regex patterns with flag toggles
(g/i/m), test against editable sample text, see matches highlighted and
capture groups listed, and preview find-and-replace output. Accessible
via Ctrl+Shift+R or command palette.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
…lidate

Adds a split-pane JSON utility modal accessible from Ctrl+Shift+X or the
command palette. Provides format (2/4-space indent), minify, and sort-keys
modes with live validation, copy, and apply-output buttons — removing the
need to reach for a browser extension or external site.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
…es, Hex, JWT

Adds a split-pane encode/decode utility covering the most common dev
encoding needs without leaving the IDE: Base64, URL percent-encoding,
HTML entities, and hex byte encoding. JWT mode decodes any token into
its header and payload sections with formatted JSON, expiry status,
and per-section copy buttons.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
…xt diff

Adds a text diff utility with a Myers diff implementation running in the
browser — no network call needed. Supports split and unified views,
line numbering, +/- counts, swap-sides, and copy-as-unified-patch. Useful
for comparing configs, API responses, or clipboard pastes without switching
to an external tool.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
…ption + next run times

Adds a developer utility for understanding and validating cron expressions.
Parses all 5-field expressions, shows a plain-English description, lists the
next 5 scheduled run times in the user's local timezone, breaks out each field
with its range label, and includes common presets and a quick-reference table.
No external deps — entirely client-side.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds a modal Timestamp Converter accessible via Ctrl+Shift+I, command
palette, or Escape chain. Supports epoch→date (s/ms/μs/ns input) and
date→epoch directions, showing ISO 8601, UTC, local, and relative
formats alongside all four epoch units and a UTC breakdown grid.
Includes a "Use Now" button and hover-to-reveal copy buttons per row.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds a modal Unit Converter covering 7 categories: length, mass,
temperature, data size, time, speed, and area. Shows all units for the
selected category at once so the user can compare every conversion in
one view, with hover-to-reveal copy buttons per row and a primary
from/to picker with swap button.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds a ColorPicker modal with a hue bar, saturation/lightness gradient
picker, live hex/RGB/HSL inputs that sync bidirectionally, a preview
swatch, WCAG contrast ratios against white and black, and a preset
palette. All conversion math runs client-side with no dependencies.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Adds a LoremGenerator modal that produces paragraphs, sentences, or
word lists using a seeded LCG so output is deterministic per render but
refreshable with "New". Outputs plain text, HTML <p> tags, or Markdown.
Optional "classic start" replaces the first paragraph with the canonical
Lorem ipsum opener. Shows word and character count.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
SHA-1/256/384/512 hashing via Web Crypto API, verify/compare mode, uppercase toggle, and fixes color picker shortcut collision (was Ctrl+Shift+P, moved to Ctrl+Shift+G).

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
Binary/octal/decimal/hex conversion with BigInt, two's complement at 8/16/32/64-bit widths, custom base 2-36, click-to-use-as-input. Bumps tsconfig target to ES2020.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
Interactive GFM table editor with add/remove rows/columns, per-column alignment cycling, compact/padded output toggle, and CSV paste-to-import.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
Decodes JWT header/payload/signature, shows expiry countdown, formats timestamp claims, per-claim copy buttons, and signature-not-verified disclaimer.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
WCAG 2.1 AA/AAA checker with live preview, ratio display, per-level pass/fail grid, auto-suggestions for AA-passing lightness adjustments, and 6 color presets.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
Browse 19 Unicode blocks, search by name/char/codepoint, click-to-copy in char/hex/decimal/escape modes, detail sidebar with full encoding info.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY
Char/byte/word/line/sentence/paragraph stats, 13 one-click transforms
(trim, case variants, slug/camel/pascal/snake, reverse, escape), and
collapsible character frequency bar chart with top-20 chars.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Browse all 60 HTTP status codes (1xx–5xx) with searchable descriptions,
category filters, expandable details, RFC references, and one-click copy.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Generate v4 (random), v7 (time-ordered), v1 (time-based), or Nil UUIDs.
Bulk generation up to 100, format options (standard/uppercase/no-dashes),
copy individual or all, plus an inline inspector that decodes version,
variant, and embedded timestamp from v1/v7 UUIDs.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Cryptographically secure password generation with configurable character
sets (upper/lower/digits/symbols), ambiguous-char exclusion, length slider
with presets, entropy meter with strength label, bulk generation up to 20,
and per-password or copy-all.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
Generate color palettes from any base color across 7 harmony schemes:
complementary, analogous, triadic, tetradic, split-complementary,
monochromatic, and shades. Live swatch preview bar, copy in hex/rgb/hsl,
copy-all, preset base colors, and HSL readout.

https://claude.ai/code/session_017oxKBUuQGbVmiLwxtrxMHY

Co-authored-by: Claude <[email protected]>
…n into Sovereign-Development

Adds ECOSYSTEM.md and a README notice: Peregrine is the developer
platform of the Sovereign Ecosystem (the IDE developer platform for
Sovereign Dominion), consolidating into Sovereign-Development per
ecosystem decision D2. Records the pre-migration findings (rotate the
committed Supabase key, reconcile README/CLAUDE.md stack drift, migrate
main only) and labels kernel integration as planned, not built.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AaDVnrK5QYQJ42SG7ZzA9e
…eview-upsg8u

docs: place Peregrine in the Sovereign Ecosystem; record consolidation into Sovereign-Development
Executes ecosystem decision D2 per docs/MIGRATION.md: merges
Peregrine.ai's main (full 166-commit history) into this repo.
Conflict resolution and doc reconciliation in this merge commit:
- charter README stays as the front page; product README moves to
  docs/PEREGRINE.md with the stack table corrected to what is built
  (Supabase Postgres via Drizzle, Clerk v7, yjs/CF Worker collab)
- CLAUDE.md: committed Supabase anon key removed (rotation still
  required in the source project), Turso references corrected,
  repo references updated to sovereign-development
- stale Peregrine.ai-specific ECOSYSTEM.md dropped (the map lives in
  Sovereign-Dominion/docs/ECOSYSTEM.md)

Verified: npm ci, npx tsc --noEmit (clean), next lint (warnings only).
Deployment cutover (Vercel/DNS) is deliberately NOT part of this
change - MIGRATION.md section 3 remains to be executed.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AaDVnrK5QYQJ42SG7ZzA9e
@JaeTierce31
JaeTierce31 marked this pull request as ready for review July 7, 2026 21:11
@JaeTierce31
JaeTierce31 merged commit 233fe0e into main Jul 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants