diff --git a/README.md b/README.md index b82ec74..2e43071 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,26 @@ MySQL/SQL Server, mixed naming styles and singular/plural table names, columns that look like keys with no ref, isolated tables, missing timestamps, unused enums and wide tables. `GET /api/v1/rules` is the list. +## Ask (pay as you go) + +A person asks a database question in plain words at `/ask/` and +gets an answer grounded in the engine: the schema's summary, every review +finding and exact SQL go into the prompt, and the checker's exact output is +added to convert and review answers. 5 cents per answered question from a +prepaid balance; failures are free. Top up $5/$10/$20 through CoinPay's +hosted checkout (no subscriptions). Everything asked stays on the page, +newest first. Models: c0mpute first through `@profullstack/ai-providers`, +OpenAI/Anthropic fallback when keys are set. + +Operator (`ADMIN_KEY` from the vault): + +```sh +DBML_ADMIN_KEY=... node bin/admin.js create "Name" --credit 1000 # prints the personal link +node bin/admin.js list | credit | link | revoke | costs | backup +``` + +State is one SQLite file in `/data` (the c0mpute app state directory). + ## Run it ```sh diff --git a/cli/package.json b/cli/package.json index 9df8c7a..102fffe 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "@profullstack/dbml", - "version": "0.1.0", + "version": "0.2.0", "description": "CLI and MCP stdio bridge for dbml.db: validate, review and convert DBML database schemas (DBML to SQL and back) from the terminal or an AI agent.", "type": "module", "bin": { diff --git a/package.json b/package.json index cd74b60..eae8925 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dbml.db", - "version": "0.1.0", + "version": "0.2.0", "private": true, "description": "DBML as a service for AI agents: validate, parse, review and convert database schemas over an HTTP API, MCP server and CLI.", "type": "module", diff --git a/src/app.js b/src/app.js index c7a0c09..166dc7b 100644 --- a/src/app.js +++ b/src/app.js @@ -148,6 +148,9 @@ app.all('/mcp', async (c) => { app.all('/crawl', async (c) => (gateway && (await gateway.handle(c.req.raw))) || c.text('not found', 404)); +const FAVICON = ``; +app.get('/favicon.svg', (c) => c.body(FAVICON, 200, { 'content-type': 'image/svg+xml', 'cache-control': 'public, max-age=86400' })); +app.get('/favicon.ico', (c) => c.body(FAVICON, 200, { 'content-type': 'image/svg+xml', 'cache-control': 'public, max-age=86400' })); app.get('/health', (c) => c.json({ ok: true, version: VERSION })); app.get('/', async (c) => c.html(await homePage())); app.get('/docs', async (c) => c.html(await docsPage())); diff --git a/src/askpage.js b/src/askpage.js index a7ebbcb..2fdc5fc 100644 --- a/src/askpage.js +++ b/src/askpage.js @@ -114,7 +114,7 @@ const JS = `