8000 feat(cli): add reylo play, the playground on the project's database by colinhacks · Pull Request #110 · colinhacks/reylo · GitHub
[go: up one dir, main page]

Skip to content

feat(cli): add reylo play, the playground on the project's database - #110

Merged
colinhacks merged 8 commits into
mainfrom
reylo-play
Oct 24, 2026
Merged

colinhacks merged 8 commits into
mainfrom
reylo-play

Conversation

@colinhacks
@colinhacks colinhacks commented Oct 24, 2026 •
Copy link
Copy Markdown
Owner

npx reylo play serves the playground of reylo.dev/play on 127.0.0.1 against the project's own database, the one its type check reads: edit a query, and its params, return type and errors update as you type. Nothing is run. The page opens in the browser; --no-open leaves it closed for scripts and agents.

  • The database: the project's, through the type check's own session (direct_url or DATABASE_URL), on Postgres, MySQL or SQLite. Statements are analyzed with store: false, so nothing is written to .reylo/. A project that names no database is refused with the usual missing-URL message and a pointer to reylo.dev/play.
  • The page: the docs' playground, now site/lib/live/app.tsx, which both the docs' /play and the standalone page render. The standalone page is built with the site's own toolchain (site/vite.play.config.ts) into dist/reylo/play/ by nub run build, so CI's build job and the release install site/ first. ?q= opens a query. "View schema" shows the database's whole schema: SQLite's stored statements, MySQL's SHOW CREATE, and on Postgres one written from the catalog (types, tables with defaults and constraints, views, indexes).
  • The API: GET /api/analyze?q=<sql> (or POST with {"sql": "…", "width": n}) answers { params, returns, cardinality, diagnostics }, each diagnostic by line and column; GET /api/schema lists tables, columns, functions and types. The page uses the same endpoint.
  • Only this machine: it listens on 127.0.0.1 and refuses a request whose Host or Origin is not localhost, so neither a page on another site nor a DNS name rebound to 127.0.0.1 can read the schema through it.
  • Shared with the docs: the analysis-to-types step (src/play-result.ts), the catalog queries (src/play-catalog.ts, now with MySQL and SQLite) and the type formatter (src/type-format.ts) moved from site/ into src/.
  • Not documented yet.

Checked: tests/play.test.ts (SQLite through a project URL, the schema card, the Host and Origin refusals, nothing written to .reylo/, a project with no database refused); the whole suite with both test databases, 257 passing, none skipped; npm pack of dist/reylo and dist/postgres installed into an empty project, where npx reylo play served the page and the API; real Postgres (a schema on the search path) and MySQL 8.4 through DATABASE_URL.

Copilot AI balanced review requested due to automatic review settings October 24, 2026 01:56
@pullfrog
pullfrog Bot commented Oct 24, 2026 •
Copy link
Copy Markdown
Contributor

No configured credential can serve this run. Your Claude Pro/Max subscription has hit its usage limit, which resets at 2026-10-26 08:00 UTC. Re-trigger after it resets, or add an API key for this provider, which Pullfrog falls back to automatically.

The providers' responses
CLAUDE_CODE_OAUTH_TOKEN: 429: This request would exceed your account's rate limit. Please try again later.

Pick another model →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using claude-opus-5-5

@vercel
verce 8000 l Bot commented Oct 24, 2026 •
Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
reylo Ready Ready Preview Oct 24, 2026 3:48am UTC

Request Review

Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@pullfrog
pullfrog Bot commented Oct 24, 2026
Copy link
Copy Markdown
Contributor

No configured credential can serve this run. Your Claude Pro/Max subscription has hit its usage limit, which resets at 2026-10-26 08:00 UTC. Re-trigger after it resets, or add an API key for this provider, which Pullfrog falls back to automatically.

The providers' responses
CLAUDE_CODE_OAUTH_TOKEN: 429: This request would exceed your account's rate limit. Please try again later.

Pick another model →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using claude-opus-5-5

@pullfrog
pullfrog Bot commented Oct 24, 2026
Copy link
Copy Markdown
Contributor

No configured credential can serve this run. Your Claude Pro/Max subscription has hit its usage limit, which resets at 2026-10-26 08:00 UTC. Re-trigger after it resets, or add an API key for this provider, which Pullfrog falls back to automatically.

The providers' responses
CLAUDE_CODE_OAUTH_TOKEN: 429: This request would exceed your account's rate limit. Please try again later.

Pick another model →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using claude-opus-5-5

@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor
10BC8

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run covers a336522, which narrows reylo play to the project's own database and opens the browser by default.

  • Removed --schema: openBackend now uses the project's database whenever a URL is set. PGlite only stands in with SAMPLE_SCHEMA when no URL is set, and its label says why (no database URL is set).
  • Opened the browser by default: parseArgs now starts with open: true, and --no-open replaces --open. The usage text, the Setup docs and the skill's agent instructions all say --no-open for scripts and agents.
  • Cleaned up after the removal: schemaFiles and the readdirSync/relative/resolve imports are gone. The remaining imports (readFileSync, statSync, extname) are still used by the static file handler.
  • Updated the PGlite test: it now checks the sample schema's params and nullable single-row return through a project with no URL. It also drops the assertions for the missing --schema file.

Nothing in the repo still mentions --schema or --open for reylo play. The only --schema hits are in site/scripts/capture-types.ts, which is a different tool.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues. There are two small fixes inline for the Postgres schema query.

Reviewed changes

This run covers 6e7bca5, which fills the schema card with the database's own DDL in place of the column list taken from the catalog.

  • Added schemaDdl: on SQLite it reads the stored statements from sqlite_schema. On MySQL it runs SHOW CREATE TABLE/VIEW for each table in database() and strips AUTO_INCREMENT=n. On Postgres it runs POSTGRES_SCHEMA, a catalog query that writes enums, domains, tables with their defaults and constraints, views and standalone indexes for the schemas on the search path. If any of these fails, the card falls back to schemaText.
  • Extended the SQLite play test: /api/page must now return the table's original CREATE TABLE text.

I ran POSTGRES_SCHEMA against a local Postgres 16 with enums, domains, identity and stored generated columns, FKs across schemas, a view and indexes. It parsed and produced correct DDL, except for the index case noted inline.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread src/play.ts Resolved
Comment thread src/play.ts Resolved
@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run covers 7c9ad88, which applies both fixes from the last review to POSTGRES_SCHEMA.

  • Wrote virtual generated columns correctly: any column with a non-empty attgenerated now shows as generated always as (…), ending in stored or virtual. Before, a Postgres 18 virtual column was written as default (…).
  • Narrowed the index filter: only a primary key, unique or exclusion constraint now hides the index it owns. A plain unique index that a foreign key points at stays on the card.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues. Two small follow-ups inline from removing PGlite.

Reviewed changes

This run covers 4bb9b53, which drops the PGlite stand-in so reylo play only reads the project's own database.

  • Refused a project with no database: openBackend now closes the session and throws project.error, or project.missingUrl followed by a pointer to reylo.dev/play. It no longer starts PGlite with a sample schema.
  • Removed the PGlite path: pgliteBackend, src/play-sample.ts, the root @electric-sql/pglite dev dependency and the site/tsconfig.json path alias are gone. src/pglite-io.ts went back to site/lib/live/pg-io.ts as the docs' own module, and play-data.ts and worker.ts import it from there again.
  • Removed the docs and skill entries: took out the Setup page's "Playground" section and the skill's reylo play --no-open line. This matches "Not documented yet" in the PR body.
  • Replaced the PGlite test: it now checks the refusal message for a project with no URL. tests/play.test.ts passes locally (3/3).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread src/play.ts Resolved
Comment thread scripts/build.ts Resolved
@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

This run covers 8659a93, which applies both follow-ups from the last review.

  • Restored the url-alone notice: when .reylo.yaml sets only url, databaseBackend passes project.notice through Backend.notice and Playground.notice, and play() prints it in yellow before the banner. This is the same notice reylo generate prints. openBackend has already refused a project with no URL by then, so it matches reylo generate's project.notice && project.url guard.
  • Added a test for the notice: it checks that the label names DATABASE_URL and that the notice says the project file's url is not read. tests/play.test.ts passes locally (4/4).
  • Dropped pglite-io from the build check: the tooling regex in scripts/build.ts no longer lists a module that can't be in dist/reylo.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@colinhacks
colinhacks merged commit d75ed41 into main Oct 24, 2026
11 checks passed
@colinhacks
colinhacks deleted the reylo-play branch October 24, 2026 03:53
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

0