@tulipes/core 0.1.2 → 0.1.4
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 +17 -1
- package/dist/cli/init.d.ts +17 -8
- package/dist/cli/init.js +651 -70
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/main.js +6 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/http/error-handler.js +21 -0
- package/dist/http/error-handler.js.map +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
|
@@ -242,18 +242,34 @@ 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
250
|
tulipes init [dir] scaffold a new application — boots with zero infrastructure
|
|
251
|
+
tulipes init [dir] --full ...plus models, bootstrap tasks and queues (needs mongo + redis)
|
|
251
252
|
tulipes sync regenerate types/config.d.ts and .env.example
|
|
252
253
|
tulipes env:check validate env against every meta contract — CI gate, exit 1 on failure
|
|
253
254
|
tulipes new module <name> scaffold a module (scope auto-detected from siblings)
|
|
254
255
|
tulipes dev [entry] sync, then run the entry under tsx watch
|
|
255
256
|
```
|
|
256
257
|
|
|
258
|
+
The scaffolded `modules/hello` is a worked example of every module
|
|
259
|
+
contract — config factory with lifecycle hooks, ACL grants, routes with
|
|
260
|
+
`HttpError` and permission checks, a controller, a pure helper, and a
|
|
261
|
+
socket namespace. `--full` adds the three that need infrastructure: a
|
|
262
|
+
model, an idempotent bootstrap task, and a queue with its processor.
|
|
263
|
+
|
|
264
|
+
### Built for AI-assisted work
|
|
265
|
+
|
|
266
|
+
`tulipes init` also writes a `CLAUDE.md` and eight task-scoped skills under
|
|
267
|
+
`.claude/skills/` — module, env variable, endpoint, model, queue, socket,
|
|
268
|
+
permissions, and reading boot errors. They encode the conventions an agent
|
|
269
|
+
would otherwise guess wrong: declaring variables instead of reaching for
|
|
270
|
+
`process.env`, where global middleware belongs, why `mongoose.model()` is
|
|
271
|
+
never called directly, and how to read an aggregate boot report.
|
|
272
|
+
|
|
257
273
|
`sync` output — committed, marked generated:
|
|
258
274
|
|
|
259
275
|
- **`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).
|
package/dist/cli/init.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
export interface InitOptions {
|
|
2
|
+
/** Also scaffold the contracts that need mongo and redis. */
|
|
3
|
+
full?: boolean;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
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.
|
|
6
|
+
* `tulipes init [dir] [--full]` — scaffold a complete application.
|
|
7
7
|
*
|
|
8
8
|
* Three modules ship: core (sys 0 — env contract, roles, request ids),
|
|
9
|
-
* security (sys 10 —
|
|
10
|
-
*
|
|
9
|
+
* security (sys 10 — helmet, cors, logging, body parsing) and hello, a
|
|
10
|
+
* worked example of every module contract.
|
|
11
|
+
*
|
|
12
|
+
* By default the app boots with ZERO infrastructure: no MONGO_URI or
|
|
13
|
+
* REDIS_URL is declared, and with no models and no queue files the
|
|
14
|
+
* pipeline skips both engines legitimately, so `yarn install && yarn dev`
|
|
15
|
+
* always succeeds on a bare machine.
|
|
16
|
+
*
|
|
17
|
+
* `--full` adds the contracts that cannot work without infrastructure —
|
|
18
|
+
* models, bootstrap tasks and queues — along with the variables they
|
|
19
|
+
* require. That app needs mongo and redis running to boot.
|
|
11
20
|
*/
|
|
12
|
-
export declare function runInit(rootDir: string, target?: string): Promise<void>;
|
|
21
|
+
export declare function runInit(rootDir: string, target?: string, options?: InitOptions): Promise<void>;
|