create-daloy 0.1.18 → 0.1.20

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.
@@ -1,68 +0,0 @@
1
- # SKILL.md
2
-
3
- Operational guidance for AI coding agents working in this DaloyJS Cloudflare Workers project.
4
-
5
- ## When to use this skill
6
-
7
- Use this skill when you need to:
8
-
9
- - Add, modify, or remove HTTP routes in this Worker.
10
- - Adjust middleware, validation, or error handling.
11
- - Change Worker bindings (KV, D1, R2, env vars) in `wrangler.toml`.
12
- - Run tests/typecheck or deploy the Worker.
13
-
14
- Do **not** use this skill for tasks unrelated to the API itself.
15
-
16
- ## Project shape
17
-
18
- - `src/index.ts` — the Worker entrypoint. Builds the `App`, registers routes/middleware, and exports `default { fetch: toFetchHandler(app) }` from `@daloyjs/core/cloudflare`.
19
- - `wrangler.toml` — Worker configuration (name, compatibility date, bindings, routes).
20
-
21
- ## Core workflows
22
-
23
- ### Add a new route
24
-
25
- 1. Open `src/index.ts`.
26
- 2. Define request/response Zod schemas.
27
- 3. Call `app.route({ method, path, request, response, handler })`. Return `{ status, body }`; preserve literal types (`status: 200 as const`, `ok: true as const`) so codegen sees narrow types.
28
-
29
- ### Run quality gates
30
-
31
- ```bash
32
- pnpm typecheck
33
- pnpm test
34
- ```
35
-
36
- Both must pass before considering a change done.
37
-
38
- ### Deploy
39
-
40
- ```bash
41
- pnpm deploy
42
- ```
43
-
44
- Wrangler will use the account/zone config from `wrangler.toml`. If the user has not run `wrangler login`, ask them to do so first — do not attempt to authenticate on their behalf.
45
-
46
- ### Add a binding
47
-
48
- 1. Add the binding (`[[kv_namespaces]]`, `[[d1_databases]]`, `[vars]`, etc.) to `wrangler.toml`.
49
- 2. Type the binding in the `Env` interface inside `src/index.ts` so handlers can read it from the second `fetch` argument.
50
- 3. Pass `env` into `buildApp(env)` if your factory needs it; never read bindings via globals.
51
-
52
- ## Decision rules
53
-
54
- - Use `toFetchHandler(app)` from `@daloyjs/core/cloudflare` — never hand-roll a `fetch(req, env, ctx)` adapter.
55
- - Stay on the Workers runtime: only Web Standards APIs and Cloudflare-specific bindings. No `node:` modules unless `nodejs_compat` is enabled in `wrangler.toml` and the user explicitly opts in.
56
- - Long-running work belongs in `ctx.waitUntil(...)`, not blocking the response.
57
-
58
- ## Pitfalls and guardrails
59
-
60
- - Do not import `@daloyjs/core/node`, `@daloyjs/core/bun`, etc. — only `@daloyjs/core` and `@daloyjs/core/cloudflare`.
61
- - Do not weaken response literal types (`as const`).
62
- - Keep `secureHeaders()`, `requestId()`, and `rateLimit()` enabled unless the user explicitly asks to remove them. (For `rateLimit`, prefer Cloudflare's native rate-limit binding for high traffic; the in-memory limiter resets per isolate.)
63
- - Workers have CPU and bundle-size limits — be cautious about adding heavy dependencies.
64
-
65
- ## More
66
-
67
- - Framework docs: <https://daloyjs.dev/docs>
68
- - Issues: <https://github.com/daloyjs/daloy/issues>
@@ -1,71 +0,0 @@
1
- # SKILL.md
2
-
3
- Operational guidance for AI coding agents working in this DaloyJS Deno project.
4
-
5
- ## When to use this skill
6
-
7
- Use this skill when you need to:
8
-
9
- - Add, modify, or remove HTTP routes in this project.
10
- - Regenerate the OpenAPI spec.
11
- - Wire up new middleware, validation, or error handling.
12
- - Run tests or typecheck the project under Deno.
13
-
14
- Do **not** use this skill for tasks unrelated to the API itself.
15
-
16
- ## Project shape
17
-
18
- - `src/build-app.ts` — exports `buildApp()`. All routes and middleware are registered here. **Pure function, no side effects.**
19
- - `src/main.ts` — calls `buildApp()` and starts the Deno HTTP listener via `@daloyjs/core/deno`.
20
- - `scripts/dump-openapi.ts` — imports `buildApp()` and writes `generated/openapi.json`.
21
- - `deno.json` — tasks, import map, and `npm:` specifiers (no `package.json`).
22
- - `tests/` — Deno test files (`*.test.ts`).
23
-
24
- ## Core workflows
25
-
26
- ### Add a new route
27
-
28
- 1. Open `src/build-app.ts`.
29
- 2. Define request/response Zod schemas.
30
- 3. Call `app.route({ method, path, request, response, handler })`. Return `{ status, body }`; preserve literal types (`status: 200 as const`, `ok: true as const`) so codegen sees narrow types.
31
- 4. Add a test under `tests/`.
32
- 5. Regenerate: `deno task gen:openapi`.
33
-
34
- ### Regenerate the OpenAPI spec
35
-
36
- ```bash
37
- deno task gen:openapi # → generated/openapi.json
38
- ```
39
-
40
- To produce the typed client, run Hey API via Node tooling against the generated spec — Hey API does not yet ship a Deno entrypoint:
41
-
42
- ```bash
43
- npx @hey-api/openapi-ts -i generated/openapi.json -o generated/client
44
- ```
45
-
46
- ### Run quality gates
47
-
48
- ```bash
49
- deno task typecheck
50
- deno task test
51
- ```
52
-
53
- Both must pass before considering a change done.
54
-
55
- ## Decision rules
56
-
57
- - Use `deno task ...`, not `npm`/`pnpm`. There is no `package.json` here.
58
- - Permissions for `dev` are intentionally narrow: `--allow-net --allow-env --allow-read`. If a change requires more permissions, add them explicitly to the relevant task in `deno.json` and call it out to the user.
59
- - If you need a new dependency, add it to `imports` in `deno.json` using a `npm:` or `jsr:` specifier; do not introduce a `package.json`.
60
-
61
- ## Pitfalls and guardrails
62
-
63
- - Never import `@daloyjs/core/deno` from `src/build-app.ts` or any script under `scripts/`. That would start an HTTP listener as a side effect of codegen.
64
- - Do not edit files under `generated/` by hand.
65
- - Keep `secureHeaders()`, `requestId()`, and `rateLimit()` enabled in `buildApp()` unless the user explicitly asks to remove them.
66
- - Do not weaken response literal types (`as const`).
67
-
68
- ## More
69
-
70
- - Framework docs: <https://daloyjs.dev/docs>
71
- - Issues: <https://github.com/daloyjs/daloy/issues>
@@ -1,70 +0,0 @@
1
- # SKILL.md
2
-
3
- Operational guidance for AI coding agents working in this DaloyJS Node.js project.
4
-
5
- ## When to use this skill
6
-
7
- Use this skill when you need to:
8
-
9
- - Add, modify, or remove HTTP routes in this project.
10
- - Regenerate the OpenAPI spec or the typed Hey API SDK in `generated/`.
11
- - Wire up new middleware, validation, or error handling.
12
- - Run tests, typecheck, or build the project.
13
-
14
- Do **not** use this skill for tasks unrelated to the API itself (e.g. infra, CI workflows, unrelated docs sites).
15
-
16
- ## Project shape
17
-
18
- - `src/build-app.ts` — exports `buildApp()`. All routes and middleware are registered here. **Pure function, no side effects.**
19
- - `src/index.ts` — calls `buildApp()` and starts the Node HTTP listener via `@daloyjs/core/node`.
20
- - `scripts/dump-openapi.ts` — imports `buildApp()` and writes `generated/openapi.json`.
21
- - `openapi-ts.config.ts` — Hey API config; reads `generated/openapi.json` and writes `generated/client/`.
22
- - `tests/` — Node test runner files (`*.test.ts`).
23
-
24
- ## Core workflows
25
-
26
- ### Add a new route
27
-
28
- 1. Open `src/build-app.ts`.
29
- 2. Define request/response Zod schemas inline or in a sibling module.
30
- 3. Call `app.route({ method, path, request, response, handler })`. Always return `{ status, body }`; preserve literal types (`status: 200 as const`, `ok: true as const`) so codegen sees narrow types.
31
- 4. Add a test under `tests/`.
32
- 5. Regenerate the spec + client: `pnpm gen`.
33
-
34
- ### Regenerate the OpenAPI spec and SDK
35
-
36
- ```bash
37
- pnpm gen
38
- # = pnpm gen:openapi → generated/openapi.json
39
- # pnpm gen:client → generated/client/
40
- ```
41
-
42
- If `pnpm gen:openapi` fails with a "server already listening" error, you imported `src/index.ts` (or `@daloyjs/core/node`) from somewhere it shouldn't be. Codegen must only touch `buildApp()`.
43
-
44
- ### Run quality gates
45
-
46
- ```bash
47
- pnpm typecheck
48
- pnpm test
49
- ```
50
-
51
- Both must pass before considering a change done.
52
-
53
- ## Decision rules
54
-
55
- - If the user asks to **change API behavior**, edit `src/build-app.ts`, then run `pnpm gen` and `pnpm test`.
56
- - If the user asks to **consume the API from a client**, import from `generated/client/` — do not handwrite fetch calls.
57
- - If the user asks for **new middleware**, register it on `app` inside `buildApp()` before route definitions so it applies globally.
58
-
59
- ## Pitfalls and guardrails
60
-
61
- - Never import `@daloyjs/core/node` (or any adapter that boots a server) from `src/build-app.ts` or any script under `scripts/`. That would start an HTTP listener as a side effect of codegen.
62
- - Do not edit files under `generated/` by hand — they are overwritten by `pnpm gen`.
63
- - Keep `secureHeaders()`, `requestId()`, and `rateLimit()` enabled in `buildApp()` unless the user explicitly asks to remove them; they are the project's secure defaults.
64
- - Do not weaken response literal types (`as const`); the typed client depends on them.
65
- - Do not add runtime dependencies without checking the hardened `.npmrc` (installs wait 24h after publish by default).
66
-
67
- ## More
68
-
69
- - Framework docs: <https://daloyjs.dev/docs>
70
- - Issues: <https://github.com/daloyjs/daloy/issues>
@@ -1,64 +0,0 @@
1
- # SKILL.md
2
-
3
- Operational guidance for AI coding agents working in this DaloyJS Vercel Edge project.
4
-
5
- ## When to use this skill
6
-
7
- Use this skill when you need to:
8
-
9
- - Add, modify, or remove HTTP routes in this project.
10
- - Adjust middleware, validation, or error handling.
11
- - Run tests or typecheck the project.
12
- - Deploy or troubleshoot the Edge runtime entrypoint.
13
-
14
- Do **not** use this skill for tasks unrelated to the API itself.
15
-
16
- ## Project shape
17
-
18
- - `api/[...path].ts` — the Edge entrypoint. Builds the `App`, registers routes/middleware, and exports `default toEdgeHandler(app)` plus `export const config = { runtime: "edge" }`.
19
- - `vercel.json` — Vercel build/runtime configuration.
20
- - `tests/` — test files (`*.test.ts`).
21
-
22
- ## Core workflows
23
-
24
- ### Add a new route
25
-
26
- 1. Open `api/[...path].ts`.
27
- 2. Define request/response Zod schemas.
28
- 3. Call `app.route({ method, path, request, response, handler })`. Return `{ status, body }`; preserve literal types (`status: 200 as const`, `ok: true as const`) so codegen sees narrow types.
29
- 4. Add a test under `tests/`.
30
-
31
- ### Run quality gates
32
-
33
- ```bash
34
- pnpm typecheck
35
- pnpm test
36
- ```
37
-
38
- Both must pass before considering a change done.
39
-
40
- ### Deploy
41
-
42
- ```bash
43
- pnpm deploy
44
- ```
45
-
46
- The `/docs` and `/openapi.json` routes registered in `api/[...path].ts` will be live at the deployed URL.
47
-
48
- ## Decision rules
49
-
50
- - The catch-all `api/[...path].ts` must remain a catch-all so DaloyJS handles routing. Do not split routes into multiple Vercel API files unless the user explicitly asks for that pattern (it disables shared middleware and unified OpenAPI).
51
- - Stay on the Edge runtime: only use APIs available in Web Standards (no `node:` modules, no `fs`, no `Buffer` reliance). If a feature requires Node, the user must choose a Node-runtime template instead.
52
- - Use `toEdgeHandler(app)` from `@daloyjs/core/vercel` — never hand-roll a `fetch(req)` adapter.
53
-
54
- ## Pitfalls and guardrails
55
-
56
- - Do not import `@daloyjs/core/node`, `@daloyjs/core/bun`, etc. — only `@daloyjs/core` and `@daloyjs/core/vercel`.
57
- - Do not weaken response literal types (`as const`).
58
- - Keep `secureHeaders()`, `requestId()`, and `rateLimit()` enabled unless the user explicitly asks to remove them.
59
- - Edge functions have small bundle and CPU limits; be cautious about adding heavy dependencies.
60
-
61
- ## More
62
-
63
- - Framework docs: <https://daloyjs.dev/docs>
64
- - Issues: <https://github.com/daloyjs/daloy/issues>