@tulipes/core 0.1.3 → 0.1.5
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.
- package/README.md +25 -10
- package/dist/boot/boot.d.ts +3 -3
- package/dist/boot/boot.js +12 -9
- package/dist/boot/boot.js.map +1 -1
- package/dist/boot/contracts.d.ts +2 -2
- package/dist/cli/init.d.ts +9 -7
- package/dist/cli/init.js +464 -67
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/main.js +1 -1
- package/dist/http/error-handler.js +21 -0
- package/dist/http/error-handler.js.map +1 -1
- package/dist/queues/queue-manager.d.ts +1 -1
- package/dist/queues/queue-manager.js +1 -1
- package/dist/sockets/load-sockets.d.ts +2 -2
- package/dist/sockets/load-sockets.js +1 -1
- package/dist/sockets/socket-manager.d.ts +1 -1
- package/dist/sockets/socket-manager.js +1 -1
- package/package.json +3 -2
- package/templates/CLAUDE.md +72 -0
- package/templates/claude/skills/tulipes-boot-errors/SKILL.md +64 -0
- package/templates/claude/skills/tulipes-endpoint/SKILL.md +82 -0
- package/templates/claude/skills/tulipes-env-variable/SKILL.md +78 -0
- package/templates/claude/skills/tulipes-model/SKILL.md +75 -0
- package/templates/claude/skills/tulipes-module/SKILL.md +60 -0
- package/templates/claude/skills/tulipes-permissions/SKILL.md +61 -0
- package/templates/claude/skills/tulipes-queue/SKILL.md +62 -0
- package/templates/claude/skills/tulipes-socket/SKILL.md +55 -0
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@ Tulipes exists so you never rewrite Express boilerplate again. You write **modul
|
|
|
8
8
|
// app.ts — the whole entrypoint
|
|
9
9
|
import { boot } from "@tulipes/core/boot";
|
|
10
10
|
|
|
11
|
-
await boot({ rootDir: import.meta.dirname, mode: "
|
|
11
|
+
await boot({ rootDir: import.meta.dirname, mode: "backend" });
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
```
|
|
15
|
-
▲ my-api development ·
|
|
15
|
+
▲ my-api development · backend mode
|
|
16
16
|
|
|
17
17
|
➜ Server http://localhost:4000 ● listening
|
|
18
18
|
➜ Database mongodb://127.0.0.1:27017/my-api ● connected
|
|
@@ -29,7 +29,7 @@ await boot({ rootDir: import.meta.dirname, mode: "web" });
|
|
|
29
29
|
|
|
30
30
|
- **Modules, not layers.** A feature lives in one folder: its routes, models, config, permissions, background jobs, and env contract. Delete the folder, the feature is gone.
|
|
31
31
|
- **Fail-closed everywhere.** Missing env vars, dependency cycles, duplicate ACL grants, colliding queue names — all crash the boot with a full report. Reading an undeclared variable or model throws at the call site. Unknown roles deny. Unrouted requests 404. Unexpected errors never leak internals outside development.
|
|
32
|
-
- **One process, two modes.** The same codebase boots as a `
|
|
32
|
+
- **One process, two modes.** The same codebase boots as a `backend` server or a queue-consuming `worker` — same modules, same config, forked at the last pipeline phase.
|
|
33
33
|
- **Types generated, not hand-written.** `tulipes sync` reads your modules and emits a `config.d.ts` that types every env variable and every config namespace — enum variables become literal unions, config shapes are inferred from your factories' return types.
|
|
34
34
|
- **The framework stays out of your request path.** Core mounts *no* middleware. Your sys-tier modules own the pipeline head; core only guarantees the tail (404 + terminal error handler).
|
|
35
35
|
|
|
@@ -49,7 +49,7 @@ yarn add @tulipes/core
|
|
|
49
49
|
|
|
50
50
|
```
|
|
51
51
|
my-api/
|
|
52
|
-
├── app.ts # boot({ mode: "
|
|
52
|
+
├── app.ts # boot({ mode: "backend" })
|
|
53
53
|
├── worker.ts # boot({ mode: "worker" })
|
|
54
54
|
├── config/
|
|
55
55
|
│ └── app.config.ts # optional: seeds global config before any module
|
|
@@ -148,7 +148,7 @@ ctx.Environment.get("TYPO_NAME"); // throws: never declared by any modul
|
|
|
148
148
|
6. Database connect Mongoose → model store → bootstrap tasks
|
|
149
149
|
7. Queues every *.queues.ts registers in BOTH modes
|
|
150
150
|
8. ── mode fork ──
|
|
151
|
-
|
|
151
|
+
backend module routers (load order) → 404 → error handler → listen
|
|
152
152
|
worker start a BullMQ worker per registered processor
|
|
153
153
|
9. onReady hooks in load order → startup banner
|
|
154
154
|
shutdown SIGTERM/SIGINT → onShutdown hooks in REVERSE order →
|
|
@@ -168,8 +168,8 @@ interface Ctx {
|
|
|
168
168
|
acl?: Acl; // after phase 5
|
|
169
169
|
models?: ModelStore; // after phase 6
|
|
170
170
|
queues?: QueueManager; // after phase 7
|
|
171
|
-
sockets?: SocketManager; //
|
|
172
|
-
app?: Express; //
|
|
171
|
+
sockets?: SocketManager; // backend only
|
|
172
|
+
app?: Express; // backend only
|
|
173
173
|
}
|
|
174
174
|
```
|
|
175
175
|
|
|
@@ -242,18 +242,33 @@ router.get("/users/:id", async (req) => {
|
|
|
242
242
|
});
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
-
`HttpError` renders `{ error, details? }` with its status.
|
|
245
|
+
`HttpError` renders `{ error, details? }` with its status. Errors raised by express middleware that carry a 4xx `status` are honored too — an oversized body stays a `413`, malformed JSON a `400` — since those describe the caller's request, not your internals. Everything else becomes an anonymous `500 internal server error`, with the real message only in `development`/`test`.
|
|
246
246
|
|
|
247
247
|
## The CLI
|
|
248
248
|
|
|
249
249
|
```
|
|
250
|
-
tulipes init [dir] scaffold a new application
|
|
250
|
+
tulipes init [dir] scaffold a new application (needs mongo + redis)
|
|
251
251
|
tulipes sync regenerate types/config.d.ts and .env.example
|
|
252
252
|
tulipes env:check validate env against every meta contract — CI gate, exit 1 on failure
|
|
253
253
|
tulipes new module <name> scaffold a module (scope auto-detected from siblings)
|
|
254
254
|
tulipes dev [entry] sync, then run the entry under tsx watch
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
+
The scaffolded `modules/hello` is a worked example of every module
|
|
258
|
+
contract — config factory with lifecycle hooks, ACL grants, routes with
|
|
259
|
+
`HttpError` and permission checks, a controller, a pure helper, a model,
|
|
260
|
+
an idempotent bootstrap task, a queue with its processor, and a socket
|
|
261
|
+
namespace. The generated app expects mongo and redis to be running.
|
|
262
|
+
|
|
263
|
+
### Built for AI-assisted work
|
|
264
|
+
|
|
265
|
+
`tulipes init` also writes a `CLAUDE.md` and eight task-scoped skills under
|
|
266
|
+
`.claude/skills/` — module, env variable, endpoint, model, queue, socket,
|
|
267
|
+
permissions, and reading boot errors. They encode the conventions an agent
|
|
268
|
+
would otherwise guess wrong: declaring variables instead of reaching for
|
|
269
|
+
`process.env`, where global middleware belongs, why `mongoose.model()` is
|
|
270
|
+
never called directly, and how to read an aggregate boot report.
|
|
271
|
+
|
|
257
272
|
`sync` output — committed, marked generated:
|
|
258
273
|
|
|
259
274
|
- **`types/config.d.ts`** — augments `KnownVariables` (every variable typed from its spec) and `GlobalConfig` (each namespace typed as its factory's return type via `typeof import(...)` — inference, never execution).
|
|
@@ -281,4 +296,4 @@ Express 5 · Mongoose 8 · BullMQ 5 · ioredis 5 · Socket.IO 4 · Zod. Delibera
|
|
|
281
296
|
|
|
282
297
|
## Well-known variables
|
|
283
298
|
|
|
284
|
-
Core reads three variable names when present (declare them in your sys core module): `PORT` (
|
|
299
|
+
Core reads three variable names when present (declare them in your sys core module): `PORT` (backend listen port, default 3000), `MONGO_URI` (required if any module ships models), `REDIS_URL` (required if any module ships queues). No models and no `MONGO_URI` is a valid database-less app; models without `MONGO_URI` is a boot refusal.
|
package/dist/boot/boot.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import type { Connection } from "mongoose";
|
|
|
3
3
|
import { type Express } from "express";
|
|
4
4
|
import { Environment, type AppEnv } from "../env/environment.js";
|
|
5
5
|
import type { Ctx } from "./contracts.js";
|
|
6
|
-
export declare const processModes: readonly ["
|
|
6
|
+
export declare const processModes: readonly ["backend", "worker"];
|
|
7
7
|
export type ProcessMode = (typeof processModes)[number];
|
|
8
8
|
export interface BootOptions {
|
|
9
9
|
/** App root — the directory containing `modules/` and `.envs/`. */
|
|
10
10
|
rootDir: string;
|
|
11
|
-
/** Defaults to process.env.PROCESS_MODE, then "
|
|
11
|
+
/** Defaults to process.env.PROCESS_MODE, then "backend". */
|
|
12
12
|
mode?: ProcessMode;
|
|
13
13
|
appEnv?: AppEnv;
|
|
14
14
|
/** Skip SIGTERM/SIGINT wiring — for tests that manage shutdown themselves. */
|
|
@@ -26,7 +26,7 @@ export interface BootHandle {
|
|
|
26
26
|
/**
|
|
27
27
|
* The whole run workflow, in the order the POC pins down:
|
|
28
28
|
* environment → module graph → exploration → global config → (acl, db —
|
|
29
|
-
* future steps) → mode fork (
|
|
29
|
+
* future steps) → mode fork (backend | worker) → onReady. Each phase crashes
|
|
30
30
|
* with its aggregate report before the next begins.
|
|
31
31
|
*/
|
|
32
32
|
export declare function boot(options: BootOptions): Promise<BootHandle>;
|
package/dist/boot/boot.js
CHANGED
|
@@ -15,11 +15,11 @@ import { errorHandler, notFoundHandler } from "../http/error-handler.js";
|
|
|
15
15
|
import { loadAppConfigSeed } from "./app-files.js";
|
|
16
16
|
import { printStartupBanner } from "./banner.js";
|
|
17
17
|
import { importFile } from "./import-file.js";
|
|
18
|
-
export const processModes = ["
|
|
18
|
+
export const processModes = ["backend", "worker"];
|
|
19
19
|
/**
|
|
20
20
|
* The whole run workflow, in the order the POC pins down:
|
|
21
21
|
* environment → module graph → exploration → global config → (acl, db —
|
|
22
|
-
* future steps) → mode fork (
|
|
22
|
+
* future steps) → mode fork (backend | worker) → onReady. Each phase crashes
|
|
23
23
|
* with its aggregate report before the next begins.
|
|
24
24
|
*/
|
|
25
25
|
export async function boot(options) {
|
|
@@ -64,8 +64,8 @@ export async function boot(options) {
|
|
|
64
64
|
const queueReport = new BootReport();
|
|
65
65
|
await initQueues(explored, ctx, queueReport);
|
|
66
66
|
queueReport.throwIfAny("queues");
|
|
67
|
-
if (mode === "
|
|
68
|
-
await
|
|
67
|
+
if (mode === "backend") {
|
|
68
|
+
await startBackend(handle, explored);
|
|
69
69
|
}
|
|
70
70
|
else {
|
|
71
71
|
const workerReport = new BootReport();
|
|
@@ -104,14 +104,17 @@ export async function boot(options) {
|
|
|
104
104
|
return handle;
|
|
105
105
|
}
|
|
106
106
|
function resolveMode(override) {
|
|
107
|
-
const raw = override ?? process.env.PROCESS_MODE ?? "
|
|
107
|
+
const raw = override ?? process.env.PROCESS_MODE ?? "backend";
|
|
108
108
|
if (!processModes.includes(raw)) {
|
|
109
|
-
|
|
109
|
+
// "web" was this mode's name before 0.1.5; name the replacement rather
|
|
110
|
+
// than leaving an upgrader to guess from the valid-values list.
|
|
111
|
+
const hint = raw === "web" ? ' — "web" was renamed to "backend"' : "";
|
|
112
|
+
throw new Error(`PROCESS_MODE "${raw}" is invalid — expected one of: ${processModes.join(", ")}${hint}`);
|
|
110
113
|
}
|
|
111
114
|
return raw;
|
|
112
115
|
}
|
|
113
116
|
/**
|
|
114
|
-
* Phases
|
|
117
|
+
* Phases 9b–11b: express, module routes, http server.
|
|
115
118
|
*
|
|
116
119
|
* The request pipeline, in order:
|
|
117
120
|
* 1. every module router (load order — sys modules first, so their
|
|
@@ -128,7 +131,7 @@ function resolveMode(override) {
|
|
|
128
131
|
* escapes unrouted or unhandled. @tulipes/core/http ships only that tail's
|
|
129
132
|
* building blocks (HttpError, notFoundHandler, errorHandler).
|
|
130
133
|
*/
|
|
131
|
-
async function
|
|
134
|
+
async function startBackend(handle, explored) {
|
|
132
135
|
const app = express();
|
|
133
136
|
handle.app = app;
|
|
134
137
|
handle.ctx.app = app;
|
|
@@ -171,7 +174,7 @@ async function startWeb(handle, explored) {
|
|
|
171
174
|
: 3000;
|
|
172
175
|
const server = createServer(app);
|
|
173
176
|
handle.server = server;
|
|
174
|
-
// Phase
|
|
177
|
+
// Phase 11b — sockets attach before listen() so no client can connect
|
|
175
178
|
// to a namespace that isn't wired yet.
|
|
176
179
|
const socketReport = new BootReport();
|
|
177
180
|
await initSockets(explored, handle.ctx, server, socketReport);
|
package/dist/boot/boot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../../src/boot/boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AAEtD,OA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,EAAE,EAAE;YAC1C,MAAM,CAAC,MAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,yEAAyE;IACzE,yEAAyE;IACzE,+CAA+C;IAC/C,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;IACjC,MAAM,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;IAEjC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
|
package/dist/boot/contracts.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { SocketManager } from "../sockets/socket-manager.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* The context object threaded through every module-authored function.
|
|
10
10
|
* Later-phase members only exist once their phase has run: config factories
|
|
11
|
-
* (phase 6) see neither `acl` (phase 7) nor `app` (
|
|
11
|
+
* (phase 6) see neither `acl` (phase 7) nor `app` (backend branch, phase 9).
|
|
12
12
|
*/
|
|
13
13
|
export interface Ctx {
|
|
14
14
|
Environment: Environment;
|
|
@@ -40,7 +40,7 @@ export interface ModuleLifecycle {
|
|
|
40
40
|
onShutdown?: LifecycleHook;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* Default export of `routes/*.routes.ts` (
|
|
43
|
+
* Default export of `routes/*.routes.ts` (backend branch only). May mount
|
|
44
44
|
* directly on `ctx.app`, or return a Router for core to `app.use()` —
|
|
45
45
|
* returning one is the recommended style.
|
|
46
46
|
*/
|
package/dist/cli/init.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `tulipes init [dir]` — scaffold a complete application
|
|
3
|
-
* ZERO infrastructure: the generated core module declares no MONGO_URI or
|
|
4
|
-
* REDIS_URL, and with no models and no queue files the pipeline skips both
|
|
5
|
-
* engines legitimately. `yarn install && yarn dev` must always succeed on a
|
|
6
|
-
* bare machine; databases arrive later as one meta.variables.json entry.
|
|
2
|
+
* `tulipes init [dir]` — scaffold a complete application.
|
|
7
3
|
*
|
|
8
4
|
* Three modules ship: core (sys 0 — env contract, roles, request ids),
|
|
9
|
-
* security (sys 10 —
|
|
10
|
-
*
|
|
5
|
+
* security (sys 10 — helmet, cors, logging, body parsing) and hello, a
|
|
6
|
+
* worked example of EVERY module contract: config with lifecycle hooks,
|
|
7
|
+
* ACL grants, routes, a controller, a helper, a model, a bootstrap task,
|
|
8
|
+
* a queue with its processor, and a socket namespace.
|
|
9
|
+
*
|
|
10
|
+
* The generated app therefore needs mongo and redis running — models and
|
|
11
|
+
* queues cannot work without them, and the boot refuses rather than
|
|
12
|
+
* degrading quietly.
|
|
11
13
|
*/
|
|
12
14
|
export declare function runInit(rootDir: string, target?: string): Promise<void>;
|