[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-81518":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":13,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},81518,"BoneScript","Doorman11991\u002FBoneScript","Doorman11991","A declarative LLM friendly language that compiles system descriptions into complete, runnable Node.js backends.","",null,"TypeScript",31,1,27,0,3,4,0.9,"MIT License",false,"main",true,[],"2026-06-12 02:04:16","# BoneScript\n\n[![npm](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fbonescript-compiler)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fbonescript-compiler)\n[![license](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fl\u002Fbonescript-compiler)](https:\u002F\u002Fgithub.com\u002Fdantheman181\u002Fbonescript\u002Fblob\u002Fmain\u002Fcompiler\u002FLICENSE)\n\nA declarative language that compiles system descriptions into complete, runnable Node.js backends. Write the bones, get the whole skeleton.\n\n```bone\nsystem Shop {\n  entity Product {\n    owns: [name: string, price: uint, stock: uint]\n    constraints: [price > 0, stock >= 0]\n    states: available -> sold_out | archived\n  }\n\n  capability purchase(buyer: User, product: Product, qty: uint) {\n    requires: [product.stock >= qty, buyer.balance >= product.price * qty]\n    effects: [product.stock -= qty, buyer.balance -= product.price * qty]\n    emits: OrderPlaced\n    sync: transactional\n  }\n\n  event OrderPlaced {\n    payload: { order_id: uuid, buyer_id: uuid, total: uint }\n    delivery: exactly_once\n    ttl: 90d\n  }\n\n  policy api_security {\n    rate_limit: 100 per 1m\n    audit: true\n  }\n}\n```\n\nRun `bonec compile shop.bone` and get back a complete project: Express API, PostgreSQL migrations, JWT auth, state machine enforcement, transactional SQL, durable events, health checks, WebSocket support, OpenAPI spec, TypeScript SDK, Zod schemas, Postman collection, GraphQL schema, seed file, audit log, cron stubs, notification service, admin panel, Dockerfile, and GitHub Actions CI. No LLMs. Deterministic — same input always produces identical output.\n\n---\n\n## Install\n\n```bash\nnpm install -g bonescript-compiler\n```\n\nOr run without installing:\n\n```bash\nnpx bonescript-compiler compile shop.bone\n```\n\nRequires Node.js 18 or later.\n\n---\n\n## Quick Start\n\n```bash\n# 1. Scaffold a new project\nbonec init my-app --domain saas_platform\n\n# 2. Compile\nbonec compile my-app\u002Fmy-app.bone\n\n# 3. Configure\ncp my-app\u002Foutput\u002F.env.example my-app\u002Foutput\u002F.env\n# Edit .env — set JWT_SECRET:\n# node -e \"console.log(require('crypto').randomBytes(48).toString('hex'))\"\n\n# 4. Run\ncd my-app\u002Foutput\nnpm install\ndocker compose up -d   # starts Postgres + Redis\nnpm run migrate\nnpm run dev\n# → http:\u002F\u002Flocalhost:3000\n# → http:\u002F\u002Flocalhost:3000\u002Fadmin  (admin panel)\n```\n\n### Nakama target (game backends)\n\n```bash\nbonec compile game.bone --target nakama\ncd output-nakama && npm install && npm run build\n# Copy build\u002F to your Nakama runtime path\n```\n\n### Prisma target (schema only)\n\n```bash\nbonec compile shop.bone --target prisma\ncd output && npx prisma migrate dev --name init && npx prisma generate\n```\n\nProduces a standalone `prisma\u002Fschema.prisma` with proper type mappings, relations, indexes, and infrastructure models. Use this when you want BoneScript's modeling power with Prisma's migration and client tooling.\n\n### SQLite target (schema-only)\n\n```bash\nbonec compile shop.bone --target sqlite\ncd output-sqlite && npm install && npm run migrate\n```\n\nProduces SQLite-flavored migrations and a typed `better-sqlite3` DB client. **Schema-only** — no Express routes, no auth, no SDK. Use this when you want BoneScript's modeling layer over SQLite without the full backend. Full SQLite route generation is on the roadmap.\n\n---\n\n## What Gets Generated\n\nFrom a single `.bone` file, `bonec compile` produces a complete project:\n\n```\noutput\u002F\n├── src\u002F\n│   ├── index.ts            Express server, all routes wired\n│   ├── db.ts               Postgres connection pool\n│   ├── events.ts           Durable event bus (transactional outbox)\n│   ├── auth.ts             JWT middleware\n│   ├── audit.ts            Audit log middleware + query helper\n│   ├── notify.ts           Email notification service (Resend\u002FSendGrid\u002Flog)\n│   ├── cron.ts             Scheduled job stubs (node-cron)\n│   ├── schemas.ts          Zod v3 validation schemas\n│   ├── health.ts           \u002Fhealth\u002Flive, \u002Fhealth\u002Fready, \u002Fhealth\u002Fmetrics\n│   ├── logger.ts           Structured logging\n│   ├── metrics.ts          Prometheus-style counters\u002Fhistograms\n│   ├── failure_rules.ts    Rule-based remediation\n│   ├── flows.ts            Saga runtime with compensation\n│   ├── websocket.ts        WebSocket server (if channels declared)\n│   ├── seed.ts             Database seed script\n│   ├── routes\u002F             One file per entity — CRUD + capabilities\n│   └── state_machines\u002F     One file per entity with states\n├── sdk\u002F\n│   └── client.ts           Typed TypeScript fetch client\n├── admin\u002F\n│   └── index.html          Self-contained admin panel (no build step)\n├── migrations\u002F             SQL schemas, indexes, triggers, FK constraints\n│   ├── audit_log.sql       Audit log table\n│   └── event_outbox.sql    Durable event outbox\n├── openapi.yaml            OpenAPI 3.0.3 spec\n├── schema.graphql          GraphQL schema\n├── {Name}.postman_collection.json\n├── Dockerfile\n├── docker-compose.yaml     Postgres + Redis for local dev\n├── .github\u002Fworkflows\u002F      CI\u002FCD pipeline\n└── src\u002Ftests.ts            Generated regression tests\n```\n\n### Compile flags\n\n```bash\nbonec compile \u003Cfile> [options]\n\n--target express     Express\u002FPostgreSQL output (default — complete backend)\n--target nakama      Nakama TypeScript runtime output\n--target prisma      Prisma schema output (schema.prisma)\n--target sqlite      SQLite migrations + typed DB client (schema-only)\n\n--no-sdk             Skip sdk\u002Fclient.ts and sdk\u002Freact.ts generation\n--no-openapi         Skip openapi.yaml, schema.graphql, Postman collection\n--no-seed            Skip src\u002Fseed.ts generation\n```\n\n---\n\n## Language Features\n\n**Entities** — stateful data objects with fields, constraints, state machines, and relations\n\n```bone\nentity Order {\n  owns: [buyer_id: uuid, total: uint, status: string]\n  constraints: [total > 0, status in [\"pending\", \"paid\", \"shipped\"]]\n  states: pending -> paid -> shipped -> delivered | cancelled\n  auth: jwt\n  relation buyer: belongs_to User\n  index: [buyer_id, status]\n}\n```\n\n**Capabilities** — named operations with preconditions, effects, and event emissions\n\n```bone\ncapability ship_order(seller: Seller, order: Order) {\n  requires: [order.status == \"paid\", order.seller_id == seller.id]\n  effects: [order.status = \"shipped\"]\n  emits: OrderShipped\n  sync: transactional\n  timeout: 10s\n  retry: { max_attempts: 3, backoff: exponential, interval: 1s }\n}\n```\n\n**Events** — immutable records with delivery guarantees\n\n```bone\nevent OrderShipped {\n  payload: { order_id: uuid, shipped_at: timestamp }\n  delivery: exactly_once   \u002F\u002F transactional outbox + deduplication\n  ttl: 30d\n}\n```\n\n**Channels** — real-time WebSocket communication\n\n```bone\nchannel game_lobby {\n  transport: websocket\n  ordering: causal\n  participants: set\u003CPlayer>\n  persistence: last_100\n}\n```\n\n**Policies** — rate limiting and audit logging, wired automatically into routes\n\n```bone\npolicy api_security {\n  rate_limit: 100 per 1m\n  access: [user, admin]\n  audit: true\n  encryption: both\n}\n```\n\n**Pipelines** — multi-step operations with automatic rollback\n\n```bone\ncapability checkout(buyer: Buyer, cart: Cart) {\n  pipeline: {\n    validate_inventory(cart)\n    charge_payment(buyer, cart.total) as payment\n    create_order(buyer, cart, payment)\n    on_error: rollback\n  }\n  sync: transactional\n}\n```\n\n**Algorithms** — named implementations from a closed catalog\n\n```bone\ncapability find_route(start: string, end: string) {\n  algorithm: shortest_path using { graph: road_network, source: start, target: end }\n  returns: json\n}\n```\n\n**Extension points** — escape hatches for custom logic that survive recompilation\n\n```bone\nextension_point calculate_fee(order: Order) {\n  returns: uint\n  stable: true   \u002F\u002F compilation fails if not implemented\n}\n```\n\n---\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `bonec compile \u003Cfile>` | Full 7-stage compilation → runnable project |\n| `bonec compile \u003Cfile> --target nakama` | Compile to Nakama TypeScript runtime |\n| `bonec compile \u003Cfile> --target prisma` | Compile to Prisma schema |\n| `bonec compile \u003Cfile> --target sqlite` | Compile to SQLite migrations + DB client (schema-only) |\n| `bonec check \u003Cfile>` | Validate without generating code |\n| `bonec validate [output-dir]` | Type-check generated output (runs `tsc --noEmit`) |\n| `bonec fmt \u003Cfile>` | Format in place |\n| `bonec watch \u003Cfile>` | Recompile on save |\n| `bonec init \u003Cname>` | Scaffold from a domain template |\n| `bonec diff \u003Cold> \u003Cnew>` | Show schema migration diff |\n| `bonec test [output-dir]` | Run generated regression tests |\n| `bonec debug \u003Cfile>` | Generate source maps |\n| `bonec verify-determinism \u003Cfile>` | Confirm two compilations are identical |\n\n### Domain Templates\n\n`bonec init my-app --domain \u003Cname>`\n\n| Domain | Auth | DB | Sync |\n|--------|------|----|------|\n| `multiplayer_game` | JWT | Postgres + Redis | realtime \u002F nakama |\n| `saas_platform` | OAuth2 | Postgres | eventual |\n| `iot_system` | API key | DynamoDB | eventual |\n| `social_network` | OAuth2 | Postgres + Redis | eventual |\n| `marketplace` | OAuth2 | Postgres | transactional |\n| `realtime_collaboration` | JWT | Postgres + Redis | realtime |\n\n---\n\n## Generated Output Details\n\n### Admin Panel (`admin\u002Findex.html`)\n\nA self-contained admin UI — no build step, no dependencies beyond a Tailwind CDN link. Open it directly in a browser pointed at your running API. Features:\n\n- Sidebar navigation per entity\n- Paginated data table with type-aware column rendering\n- Create\u002FEdit modal with auto-generated form fields\n- Delete with confirmation\n- Capability buttons that POST to capability endpoints\n- Bearer token auth stored in localStorage\n- API URL configurable via `\u003Cmeta name=\"bonescript-api-url\">` tag\n\n### TypeScript SDK (`sdk\u002Fclient.ts`)\n\nA typed fetch client for your frontend. Zero dependencies.\n\n```typescript\nimport { ShopClient } from \".\u002Fsdk\u002Fclient\";\n\nconst client = new ShopClient(\"http:\u002F\u002Flocalhost:3000\", () => localStorage.getItem(\"token\"));\n\nconst products = await client.listProduct();\nconst product = await client.createProduct({ name: \"Widget\", price: 999, stock: 100 });\nawait client.purchase({ product_id: product.id, qty: 1 });\n```\n\n### React Hooks (`sdk\u002Freact.ts`)\n\nGenerated alongside the SDK. Typed hooks for every entity and capability, with no external dependencies (uses React's built-in `useState` \u002F `useEffect`).\n\n```tsx\nimport { ApiProvider, useListProduct, useCreateProduct, useCapabilityPurchase } from \".\u002Fsdk\u002Freact\";\n\nfunction App() {\n  return (\n    \u003CApiProvider client={{ baseUrl: \"http:\u002F\u002Flocalhost:3000\", getToken: () => localStorage.getItem(\"token\") }}>\n      \u003CProductList \u002F>\n    \u003C\u002FApiProvider>\n  );\n}\n\nfunction ProductList() {\n  const { data, loading, error, refetch } = useListProduct();\n  const createProduct = useCreateProduct();\n  const purchase = useCapabilityPurchase();\n\n  if (loading) return \u003Cp>Loading...\u003C\u002Fp>;\n  if (error) return \u003Cp>Error: {error.message}\u003C\u002Fp>;\n\n  return (\n    \u003Cul>\n      {data?.items.map(p => (\n        \u003Cli key={p.id}>{p.name} — ${p.price}\u003C\u002Fli>\n      ))}\n    \u003C\u002Ful>\n  );\n}\n```\n\n### Zod Schemas (`src\u002Fschemas.ts`)\n\nRuntime validation schemas for all models and capability inputs, with constraint mapping.\n\n```typescript\nimport { ProductSchema, ShopServicePurchaseInputSchema } from \".\u002Fschemas\";\n\nconst validated = ProductSchema.parse(req.body);\nconst input = ShopServicePurchaseInputSchema.parse(req.body);\n```\n\n### Notification Service (`src\u002Fnotify.ts`)\n\nPluggable email notifications on event emissions. Configure via env:\n\n- `NOTIFY_PROVIDER=log` (default — prints to console)\n- `NOTIFY_PROVIDER=resend` — sends through [Resend](https:\u002F\u002Fresend.com) (set `NOTIFY_API_KEY`)\n- `NOTIFY_PROVIDER=sendgrid` — sends through SendGrid (set `NOTIFY_API_KEY`)\n- `NOTIFY_PROVIDER=webhook` — POSTs JSON to `NOTIFY_WEBHOOK_URL`. Set `NOTIFY_WEBHOOK_SECRET` to enable HMAC-SHA256 signing in the `X-BoneScript-Signature` header.\n\n### Cron Jobs (`src\u002Fcron.ts`)\n\nCommented-out `node-cron` stubs for each `sync: batch` capability. Uncomment and configure schedules as needed.\n\n### Audit Log (`migrations\u002Faudit_log.sql` + `src\u002Faudit.ts`)\n\nAutomatically applied to routes on modules with `audit: true` in their policy. Records actor, action, entity type\u002Fid, payload, IP, and user agent.\n\n### Prisma Schema (`prisma\u002Fschema.prisma`)\n\nWhen compiled with `--target prisma`, produces a complete Prisma schema:\n\n```prisma\nmodel Product {\n  id          String   @id @default(uuid()) @db.Uuid\n  created_at  DateTime @default(now()) @db.Timestamptz\n  updated_at  DateTime @updatedAt @db.Timestamptz\n  name        String\n  price       Int      @db.BigInt\n  stock       Int      @db.BigInt\n  state       String\n\n  @@map(\"products\")\n}\n```\n\nIncludes all entities, relations (`@relation` with cascade deletes), indexes, junction tables for many-to-many, and infrastructure models (audit log, event outbox). Use with `npx prisma migrate dev` and `npx prisma generate`.\n\n---\n\n## Event Delivery\n\nTwo modes, switchable via environment variable:\n\n```bash\nEVENT_MODE=in_process   # default — in-memory, fast, no guarantees\nEVENT_MODE=durable      # Postgres-backed transactional outbox\n```\n\nIn durable mode:\n- `at_least_once` — retried with exponential backoff until acknowledged\n- `exactly_once` — deduplicated via `event_processed` table\n\n---\n\n## Algorithm Catalog\n\n| Name | Category | Complexity |\n|------|----------|------------|\n| `shortest_path` | graph | O((V+E) log V) |\n| `topological_sort` | graph | O(V+E) |\n| `binary_search` | search | O(log n) |\n| `bipartite_matching` | matching | O(E√V) |\n| `round_robin` | scheduling | O(n) |\n| `weighted_average` | stats | O(n) |\n| `percentile` | stats | O(n log n) |\n| `rank_by` | sort | O(n log n) |\n| `consistent_hash` | crypto | O(N log N) build |\n\n---\n\n## Compilation Pipeline\n\nEvery stage is deterministic — same `.bone` file always produces bitwise-identical output.\n\n```\n.bone source\n    ↓ Lex          tokens\n    ↓ Parse        AST (with error recovery)\n    ↓ Type Check   validated AST\n    ↓ Lower        Architecture IR\n    ↓ Optimize     dead module elimination, deduplication\n    ↓ Solve        constraint propagation → concrete decisions\n    ↓ Emit         TypeScript + SQL + YAML + JSON + HTML\n    ↓ Verify       IR consistency + generated code checks\n```\n\n---\n\n## VS Code Extension\n\n```bash\n.\\install-extension.ps1\n```\n\nOpen any `.bone` file and get real-time error highlighting, context-aware completions, hover docs, go-to-definition, document outline, signature help, and quick fixes.\n\n---\n\n## Tests\n\n```bash\ncd compiler\nnpm test\n```\n\n---\n\n## Project Structure\n\n```\nspec\u002F           Language specification (10 formal documents)\ncompiler\u002F       Reference compiler (TypeScript) — bonescript-compiler on npm\n  src\u002F          Lexer, parser, type checker, IR, 15+ emitters, CLI\n  dist\u002F         Compiled output\nlsp\u002F            Language Server Protocol server\nvscode-ext\u002F     VS Code extension\nexamples\u002F       Example .bone programs\n```\n\n---\n\n## Status\n\nPublished to npm as [`bonescript-compiler`](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fbonescript-compiler) v0.8.1.\n\nThe compiler pipeline is complete and deterministic. All generated code from the Express target compiles and runs. The SQLite target is currently schema-only. The VS Code extension provides real-time feedback.\n\nNot yet: VS Code marketplace listing, end-to-end tests with a live database, full SQLite route generation.\n","BoneScript 是一种声明式语言，能够将系统描述编译成完整的可运行 Node.js 后端。它支持定义实体、能力、事件和策略，并自动生成包括 Express API、PostgreSQL 迁移、JWT 认证、状态机强制执行、事务性 SQL、持久化事件处理等在内的全栈后端代码。此外，BoneScript 也提供了对 WebSocket 支持、OpenAPI 规范、TypeScript SDK 等的集成。该项目特别适用于需要快速构建复杂业务逻辑后端服务的场景，如电商系统或 SaaS 平台开发，通过简洁的语言描述即可生成高质量且结构化的应用程序骨架，极大地提高了开发效率。",2,"2026-06-11 04:05:22","CREATED_QUERY"]