@waniwani/kit 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +39 -39
  2. package/dist/cli/codegen.js +1105 -0
  3. package/dist/cli/codegen.js.map +1 -0
  4. package/{cli/env.mjs → dist/cli/env.js} +5 -6
  5. package/dist/cli/env.js.map +1 -0
  6. package/{cli/framework.mjs → dist/cli/framework.js} +112 -115
  7. package/dist/cli/framework.js.map +1 -0
  8. package/dist/cli/index.js +378 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/{cli/init.mjs → dist/cli/init.js} +218 -259
  11. package/dist/cli/init.js.map +1 -0
  12. package/dist/cli/log.js +156 -0
  13. package/dist/cli/log.js.map +1 -0
  14. package/dist/cli/manifest.js +57 -0
  15. package/dist/cli/manifest.js.map +1 -0
  16. package/{cli/peers.mjs → dist/cli/peers.js} +77 -88
  17. package/dist/cli/peers.js.map +1 -0
  18. package/dist/cli/scan.js +100 -0
  19. package/dist/cli/scan.js.map +1 -0
  20. package/dist/cli/template.js +173 -0
  21. package/dist/cli/template.js.map +1 -0
  22. package/dist/cli/types.js +14 -0
  23. package/dist/cli/types.js.map +1 -0
  24. package/dist/cli/validate.js +328 -0
  25. package/dist/cli/validate.js.map +1 -0
  26. package/dist/cli/vercel.js +103 -0
  27. package/dist/cli/vercel.js.map +1 -0
  28. package/dist/server.d.ts +1 -1
  29. package/dist/server.d.ts.map +1 -1
  30. package/dist/server.js +0 -1
  31. package/dist/server.js.map +1 -1
  32. package/dist/web.d.ts +8 -7
  33. package/dist/web.d.ts.map +1 -1
  34. package/dist/web.js +7 -6
  35. package/dist/web.js.map +1 -1
  36. package/package.json +13 -9
  37. package/src/server.ts +7 -9
  38. package/src/web.tsx +12 -13
  39. package/cli/codegen.mjs +0 -1267
  40. package/cli/index.mjs +0 -409
  41. package/cli/log.mjs +0 -178
  42. package/cli/scan.mjs +0 -112
  43. package/cli/template.mjs +0 -190
  44. package/cli/validate.mjs +0 -391
package/README.md CHANGED
@@ -54,7 +54,7 @@ await server.connect(new StreamableHTTPServerTransport(/* … */));
54
54
  ```
55
55
 
56
56
  Around that file you also own a `tsconfig.json`, a bundler config for any widget
57
- UI, a `Dockerfile` and a `vercel.json`.
57
+ UI, a `Dockerfile` and the deploy config each host wants.
58
58
 
59
59
  With the kit, you write the part that answers the question and nothing around
60
60
  it:
@@ -234,7 +234,7 @@ npm run dev
234
234
  `dev` watches the folder, mirrors changes into `.waniwani/`, and leaves nodemon
235
235
  and Vite HMR to do the rest. An edit to `tools/check-eligibility.ts` reaches the
236
236
  MCP endpoint in about a second. Point a client at `/mcp`, or run
237
- [scripts/probe.mjs](https://github.com/WaniWani-AI/kit/blob/main/scripts/probe.mjs) against it to exercise the server without
237
+ [scripts/probe.ts](https://github.com/WaniWani-AI/kit/blob/main/scripts/probe.ts) against it to exercise the server without
238
238
  a chat client.
239
239
 
240
240
  ## The folder convention
@@ -492,7 +492,7 @@ flowchart LR
492
492
  end
493
493
 
494
494
  subgraph tpl["WaniWani-AI/mcp-distribution-template (public, separate repo)"]
495
- raw["vite.config.ts · package.json · tsconfig.json<br/>src/index.css (Tailwind) · vercel.json<br/>alpic.json · Dockerfile"]
495
+ raw["vite.config.ts · package.json · tsconfig.json<br/>src/index.css (Tailwind)<br/>alpic.json · Dockerfile"]
496
496
  end
497
497
 
498
498
  subgraph cli["@waniwani/kit (what we own)"]
@@ -506,7 +506,7 @@ flowchart LR
506
506
  server["src/server.ts · src/waniwani.ts"]
507
507
  views["src/views/*.tsx"]
508
508
  appsrc["src/app/ (your source, copied)"]
509
- deployfiles["vercel.json · Dockerfile"]
509
+ deployfiles["Dockerfile · alpic.json"]
510
510
  end
511
511
 
512
512
  app --> scan --> check --> gen --> out
@@ -525,52 +525,51 @@ flowchart LR
525
525
  4. **run** hands the result to Skybridge's `dev`, `build` or `start`, with the
526
526
  output rewritten in WaniWani's voice.
527
527
 
528
- `.waniwani/` is disposable and safe to delete. It is also an ordinary npm
529
- project carrying a `vercel.json`, which is what lets `vercel deploy` inside it
530
- work with no special support.
528
+ `.waniwani/` is disposable and safe to delete.
531
529
 
532
- ### Deploying is a git push
530
+ ### Deploying is a git push, with no deploy config
533
531
 
534
- `waniwani build` writes a Vercel Build Output tree inside `.waniwani/`: the
535
- bundled function, the static assets, the routing config. A git-connected project
536
- builds that tree itself on push, and the first build writes the config it needs
537
- into the app repo:
532
+ `waniwani build` writes a Vercel Build Output tree: the bundled function, the
533
+ static assets, the routing config. The framework emits it inside `.waniwani/`,
534
+ and the build's last step moves it to `.vercel/output` at the app root, which is
535
+ the one path where Vercel adopts a Build Output tree. Nothing else is needed to
536
+ deploy, and an app repo carries no `vercel.json`:
538
537
 
539
- ```json
540
- // vercel.json, generated once, yours to edit afterwards
541
- {
542
- "framework": null,
543
- "buildCommand": "waniwani build && rm -rf .vercel/output && cp -R .waniwani/.vercel/output .vercel/output",
544
- "routes": [{ "src": "/api(/.*)?", "dest": "/mcp" }]
545
- }
538
+ ```bash
539
+ git push # a git-connected project builds and serves it
540
+ vercel deploy --prebuilt # or upload the tree a local build produced
546
541
  ```
547
542
 
548
- Each line answers something Vercel would otherwise get wrong.
543
+ Zero config works because every question Vercel would ask has an answer already
544
+ in the repo. The framework preset resolves to `Other`, since an app folder holds
545
+ no framework dependency to detect. The `Other` preset's build command is the
546
+ `build` script from `package.json`, which is `waniwani build`. And the output is
547
+ adopted as built rather than served as static files, because the tree is where
548
+ Vercel looks for one.
549
549
 
550
- `framework: null` stops the project's preset from hunting for a dependency the
551
- repo does not have, which is what produces `No Next.js version detected` on a
552
- repo holding no framework at all.
550
+ One thing the kit decides on the app's behalf, in that tree's own routing table:
553
551
 
554
- The `buildCommand` moves the tree from `.waniwani/`, which is gitignored and
555
- absent from the clone, up to the one path where Vercel adopts the Build Output
556
- API and serves the function as built.
552
+ ```json
553
+ { "src": "/api(/.*)?", "dest": "/mcp" }
554
+ ```
557
555
 
558
- The `routes` entry exists because Vercel reserves a root `api/` directory: it
559
- compiles every file under one into a serverless function of its own, and an
560
- endpoint module is not a Vercel handler. That entry is emitted ahead of Vercel's
561
- filesystem layer, so `/api/*` reaches the server the kit built and the functions
562
- Vercel made are never routed to. Deleting the directory during the build is not
563
- an alternative, since the file list is read before the build command runs:
556
+ Vercel reserves a root `api/` directory. It compiles every file under one into a
557
+ serverless function of its own, and an endpoint module is not a Vercel handler —
558
+ `defineEndpoint({ ... })` is an object. The reservation cannot be waived, since
559
+ the file list is read before the build command runs:
564
560
 
565
561
  ```
566
562
  Error: File not found: /vercel/path0/api/cal/book.ts
567
563
  ```
568
564
 
569
- Deploying without a build works too, once `build` has run:
565
+ So the route goes in ahead of the tree's `filesystem` handler, which is the
566
+ phase those functions sit in. `/api/*` reaches the server the kit built, and the
567
+ ones Vercel made are never routed to. They still cost build time, two dead
568
+ functions per app.
570
569
 
571
- ```bash
572
- cd .waniwani && vercel deploy --prebuilt
573
- ```
570
+ An app that carries a `vercel.json` from an earlier kit has to delete it. Its
571
+ build command stages the tree by hand, from a path the build no longer writes to,
572
+ so it deletes what the build just placed. `waniwani check` says so by name.
574
573
 
575
574
  Environment variables live on the platform for both, since `.env` is read from
576
575
  disk and a hosted build has no such file. A project that sets its variables for
@@ -666,7 +665,7 @@ oney/
666
665
  ├── src/_runtime/ the runtime, vendored as source
667
666
  ├── src/{server,waniwani}.ts entry and registration
668
667
  ├── src/views/<widget>.tsx view entries
669
- ├── vite.config.ts vercel.json alpic.json bundling and deploy
668
+ ├── vite.config.ts alpic.json vercel.json bundling and deploy
670
669
  ├── Dockerfile .dockerignore container deploy
671
670
  └── tsconfig.json package.json
672
671
  ```
@@ -704,8 +703,9 @@ What an ejected repo gives up is the generator, and with it:
704
703
  collides.
705
704
  - **`waniwani init` scaffolds one shape of app**, a tool with the widget that
706
705
  displays it. A flow is not among the files it writes.
707
- - **Deploying is manual.** `.waniwani/` carries a `vercel.json`, so
708
- `vercel deploy` inside it works, but no command wraps that.
706
+ - **Deploying is manual.** A build leaves a tree `vercel deploy --prebuilt`
707
+ uploads as it is, and a git push builds it on the platform, but no command
708
+ wraps either.
709
709
  - **`useWidget` does not track yet.** Emitting `widget_render` and click events
710
710
  through `useWaniwani` automatically is the next step.
711
711