@tulipes/cli 0.1.1 → 0.2.0-rc.2
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 +10 -7
- package/dist/agent.d.ts +12 -0
- package/dist/agent.js +29 -0
- package/dist/agent.js.map +1 -0
- package/dist/app-core.d.ts +8 -6
- package/dist/app-core.js +23 -14
- package/dist/app-core.js.map +1 -1
- package/dist/bin.js +3 -3
- package/dist/bin.js.map +1 -1
- package/dist/config-check.d.ts +8 -0
- package/dist/config-check.js +43 -0
- package/dist/config-check.js.map +1 -0
- package/dist/config-import.d.ts +20 -0
- package/dist/config-import.js +133 -0
- package/dist/config-import.js.map +1 -0
- package/dist/dev.d.ts +4 -4
- package/dist/dev.js +7 -10
- package/dist/dev.js.map +1 -1
- package/dist/init.d.ts +6 -11
- package/dist/init.js +11 -6422
- package/dist/init.js.map +1 -1
- package/dist/inspection.d.ts +9 -8
- package/dist/inspection.js +10 -11
- package/dist/inspection.js.map +1 -1
- package/dist/main.js +82 -11
- package/dist/main.js.map +1 -1
- package/dist/migrate.d.ts +30 -0
- package/dist/migrate.js +772 -0
- package/dist/migrate.js.map +1 -0
- package/dist/new-module.js +84 -43
- package/dist/new-module.js.map +1 -1
- package/dist/routes.d.ts +3 -5
- package/dist/routes.js +4 -6
- package/dist/routes.js.map +1 -1
- package/dist/spec.d.ts +2 -5
- package/dist/spec.js +13 -6
- package/dist/spec.js.map +1 -1
- package/dist/sync.d.ts +3 -11
- package/dist/sync.js +81 -20
- package/dist/sync.js.map +1 -1
- package/dist/template.d.ts +58 -0
- package/dist/template.js +244 -0
- package/dist/template.js.map +1 -0
- package/dist/update.d.ts +8 -3
- package/dist/update.js +111 -38
- package/dist/update.js.map +1 -1
- package/package.json +17 -16
- package/templates/AGENTS.md +68 -31
- package/templates/CLAUDE.md +5 -4
- package/templates/app/.envs/.env.development +18 -0
- package/templates/app/.envs/.env.production +19 -0
- package/templates/app/.envs/.env.staging +19 -0
- package/templates/app/README.md +327 -0
- package/templates/app/app.ts +3 -0
- package/templates/app/config/app.config.ts +73 -0
- package/templates/app/docs/agent-manifest.json +724 -0
- package/templates/app/ecosystem.config.cjs +60 -0
- package/templates/app/modules/agent/controllers/agent.controllers.ts +31 -0
- package/templates/app/modules/agent/i18n/en.json +5 -0
- package/templates/app/modules/agent/i18n/fr.json +5 -0
- package/templates/app/modules/agent/module.acl.ts +14 -0
- package/templates/app/modules/agent/package.json +21 -0
- package/templates/app/modules/agent/routes/agent.routes.ts +29 -0
- package/templates/app/modules/agent/schemas/agent.schemas.ts +9 -0
- package/templates/app/modules/auth/bootstrap/credentials.bootstrap.ts +26 -0
- package/templates/app/modules/auth/bootstrap/seed-admin.bootstrap.ts +44 -0
- package/templates/app/modules/auth/controllers/auth.controllers.ts +312 -0
- package/templates/app/modules/auth/helpers/access-check.ts +42 -0
- package/templates/app/modules/auth/helpers/auth.ts +48 -0
- package/templates/app/modules/auth/helpers/documents.ts +57 -0
- package/templates/app/modules/auth/helpers/passport.ts +180 -0
- package/templates/app/modules/auth/helpers/passwords.ts +58 -0
- package/templates/app/modules/auth/helpers/session-cache.ts +67 -0
- package/templates/app/modules/auth/helpers/tokens.ts +329 -0
- package/templates/app/modules/auth/i18n/en.json +19 -0
- package/templates/app/modules/auth/i18n/fr.json +19 -0
- package/templates/app/modules/auth/lib/index.ts +12 -0
- package/templates/app/modules/auth/models/credential.model.ts +31 -0
- package/templates/app/modules/auth/models/revoked-token.model.ts +20 -0
- package/templates/app/modules/auth/models/session.model.ts +42 -0
- package/templates/app/modules/auth/module.acl.ts +41 -0
- package/templates/app/modules/auth/module.config.ts +30 -0
- package/templates/app/modules/auth/package.json +61 -0
- package/templates/app/modules/auth/routes/auth.routes.ts +94 -0
- package/templates/app/modules/auth/schemas/auth.schemas.ts +37 -0
- package/templates/app/modules/auth/tests/auth.test.ts +1079 -0
- package/templates/app/modules/config/controllers/config.controllers.ts +89 -0
- package/templates/app/modules/config/helpers/audit.ts +41 -0
- package/templates/app/modules/config/helpers/describe.ts +72 -0
- package/templates/app/modules/config/i18n/en.json +6 -0
- package/templates/app/modules/config/i18n/fr.json +6 -0
- package/templates/app/modules/config/models/config-audit.model.ts +26 -0
- package/templates/app/modules/config/module.acl.ts +12 -0
- package/templates/app/modules/config/package.json +23 -0
- package/templates/app/modules/config/routes/config.routes.ts +37 -0
- package/templates/app/modules/config/schemas/config.schemas.ts +13 -0
- package/templates/app/modules/config/tests/config.test.ts +126 -0
- package/templates/app/modules/core/bootstrap/cache.bootstrap.ts +12 -0
- package/templates/app/modules/core/helpers/cache/index.ts +60 -0
- package/templates/app/modules/core/helpers/cache/memory-cache.ts +53 -0
- package/templates/app/modules/core/helpers/cache/redis-cache.ts +68 -0
- package/templates/app/modules/core/helpers/cache/types.ts +37 -0
- package/templates/app/modules/core/helpers/lazy.ts +13 -0
- package/templates/app/modules/core/helpers/logger/index.ts +115 -0
- package/templates/app/modules/core/helpers/mongoose/index.ts +27 -0
- package/templates/app/modules/core/helpers/mongoose/plugins/base.plugin.ts +14 -0
- package/templates/app/modules/core/helpers/mongoose/plugins/soft-delete.plugin.ts +124 -0
- package/templates/app/modules/core/helpers/mongoose/plugins/timestamps.plugin.ts +13 -0
- package/templates/app/modules/core/helpers/mongoose/plugins/types.ts +45 -0
- package/templates/app/modules/core/helpers/mongoose/register.ts +20 -0
- package/templates/app/modules/core/lib/index.ts +34 -0
- package/templates/app/modules/core/module.config.ts +24 -0
- package/templates/app/modules/core/package.json +80 -0
- package/templates/app/modules/core/routes/core.routes.ts +24 -0
- package/templates/app/modules/core/tests/core.test.ts +19 -0
- package/templates/app/modules/hello/agent/hello.agent.ts +33 -0
- package/templates/app/modules/hello/bootstrap/seed-greetings.bootstrap.ts +27 -0
- package/templates/app/modules/hello/controllers/greetings.controllers.ts +43 -0
- package/templates/app/modules/hello/controllers/hello.controllers.ts +50 -0
- package/templates/app/modules/hello/helpers/greeting.ts +8 -0
- package/templates/app/modules/hello/i18n/en.json +8 -0
- package/templates/app/modules/hello/i18n/fr.json +8 -0
- package/templates/app/modules/hello/models/greeting.model.ts +24 -0
- package/templates/app/modules/hello/module.acl.ts +16 -0
- package/templates/app/modules/hello/module.config.ts +14 -0
- package/templates/app/modules/hello/package.json +24 -0
- package/templates/app/modules/hello/queues/hello.queues.ts +38 -0
- package/templates/app/modules/hello/routes/greetings.routes.ts +25 -0
- package/templates/app/modules/hello/routes/hello.routes.ts +44 -0
- package/templates/app/modules/hello/sockets/hello.sockets.ts +21 -0
- package/templates/app/modules/hello/tests/hello.test.ts +19 -0
- package/templates/app/modules/security/bootstrap/rate-limit.bootstrap.ts +8 -0
- package/templates/app/modules/security/helpers/hardening.ts +65 -0
- package/templates/app/modules/security/helpers/proxy.ts +16 -0
- package/templates/app/modules/security/helpers/rate-limit.ts +150 -0
- package/templates/app/modules/security/module.config.ts +59 -0
- package/templates/app/modules/security/package.json +26 -0
- package/templates/app/modules/security/routes/security.routes.ts +42 -0
- package/templates/app/modules/security/tests/security.test.ts +174 -0
- package/templates/app/modules/settings/bootstrap/log-streams.bootstrap.ts +12 -0
- package/templates/app/modules/settings/controllers/settings.controllers.ts +58 -0
- package/templates/app/modules/settings/helpers/access-lease.ts +99 -0
- package/templates/app/modules/settings/helpers/log-stream.ts +272 -0
- package/templates/app/modules/settings/helpers/log-tail.ts +253 -0
- package/templates/app/modules/settings/i18n/en.json +3 -0
- package/templates/app/modules/settings/i18n/fr.json +3 -0
- package/templates/app/modules/settings/module.acl.ts +12 -0
- package/templates/app/modules/settings/package.json +21 -0
- package/templates/app/modules/settings/routes/settings.routes.ts +33 -0
- package/templates/app/modules/settings/schemas/settings.schemas.ts +8 -0
- package/templates/app/modules/settings/tests/settings.test.ts +409 -0
- package/templates/app/modules/users/controllers/users.controllers.ts +113 -0
- package/templates/app/modules/users/i18n/en.json +14 -0
- package/templates/app/modules/users/i18n/fr.json +14 -0
- package/templates/app/modules/users/models/user.model.ts +18 -0
- package/templates/app/modules/users/module.acl.ts +10 -0
- package/templates/app/modules/users/module.config.ts +11 -0
- package/templates/app/modules/users/package.json +24 -0
- package/templates/app/modules/users/queues/users.queues.ts +31 -0
- package/templates/app/modules/users/routes/users.routes.ts +60 -0
- package/templates/app/modules/users/schemas/users.schemas.ts +30 -0
- package/templates/app/modules/users/sockets/users.sockets.ts +18 -0
- package/templates/app/nginx/development.conf +44 -0
- package/templates/app/nginx/production.conf +75 -0
- package/templates/app/nginx/staging.conf +51 -0
- package/templates/app/package.json +58 -0
- package/templates/app/scripts/count-greetings.ts +29 -0
- package/templates/app/scripts/deploy-nginx.ts +143 -0
- package/templates/app/scripts/list-users.ts +34 -0
- package/templates/app/tests/app.test.ts +28 -0
- package/templates/app/tests/support.ts +36 -0
- package/templates/app/tsconfig.json +28 -0
- package/templates/app/vitest.config.ts +6 -0
- package/templates/app/worker.ts +6 -0
- package/templates/claude/skills/tulipes-agent-tool/SKILL.md +87 -0
- package/templates/claude/skills/tulipes-boot-errors/SKILL.md +11 -5
- package/templates/claude/skills/tulipes-config/SKILL.md +74 -0
- package/templates/claude/skills/tulipes-endpoint/SKILL.md +38 -25
- package/templates/claude/skills/tulipes-env-variable/SKILL.md +54 -26
- package/templates/claude/skills/tulipes-model/SKILL.md +11 -4
- package/templates/claude/skills/tulipes-module/SKILL.md +11 -10
- package/templates/claude/skills/tulipes-queue/SKILL.md +20 -6
- package/templates/claude/skills/tulipes-settings/SKILL.md +49 -100
- package/templates/claude/skills/tulipes-spec/SKILL.md +10 -12
- package/templates/minimal/README.md +21 -0
- package/templates/minimal/app.ts +3 -0
- package/templates/minimal/config/app.config.ts +16 -0
- package/templates/minimal/modules/agent/module.acl.ts +3 -0
- package/templates/minimal/modules/agent/package.json +14 -0
- package/templates/minimal/modules/agent/routes/agent.routes.ts +20 -0
- package/templates/minimal/modules/core/module.acl.ts +4 -0
- package/templates/minimal/modules/core/package.json +21 -0
- package/templates/minimal/modules/hello/i18n/en.json +3 -0
- package/templates/minimal/modules/hello/module.acl.ts +2 -0
- package/templates/minimal/modules/hello/package.json +11 -0
- package/templates/minimal/modules/hello/routes/health.routes.ts +9 -0
- package/templates/minimal/modules/hello/routes/hello.routes.ts +10 -0
- package/templates/minimal/modules/security/package.json +15 -0
- package/templates/minimal/modules/security/routes/security.routes.ts +8 -0
- package/templates/minimal/package.json +38 -0
- package/templates/minimal/tests/app.test.ts +52 -0
- package/templates/minimal/tsconfig.json +22 -0
- package/templates/minimal/vitest.config.ts +5 -0
- package/templates/overlays/no-queues/ecosystem.config.cjs +52 -0
- package/templates/overlays/no-queues/modules/hello/controllers/greetings.controllers.ts +41 -0
- package/templates/overlays/no-queues/modules/users/controllers/users.controllers.ts +107 -0
- package/templates/versions.json +11 -0
- package/dist/minimal.d.ts +0 -2
- package/dist/minimal.js +0 -2200
- package/dist/minimal.js.map +0 -1
- /package/templates/{browser-auth.md → app/docs/browser-auth.md} +0 -0
package/dist/update.js
CHANGED
|
@@ -14,10 +14,12 @@ const REGISTRY = "https://registry.npmjs.org";
|
|
|
14
14
|
* the CLI the globally installed `tulipes` on your PATH (@tulipes/cli)
|
|
15
15
|
* the app @tulipes/core in the app root and in every module, since
|
|
16
16
|
* modules are workspace packages that declare it themselves,
|
|
17
|
-
* plus the app
|
|
17
|
+
* plus every other @tulipes package the app declares — the
|
|
18
|
+
* CLI devDependency, spec, testing, the providers
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* The packages are released in lockstep (docs/releasing.md), so each one's
|
|
21
|
+
* `latest` is the version paired with core's `latest`: raising core alone
|
|
22
|
+
* would leave a provider whose peer range refuses the new core.
|
|
21
23
|
*
|
|
22
24
|
* Updating only the app leaves you typing an old CLI against a new
|
|
23
25
|
* framework; updating only the CLI leaves the app behind. This does both,
|
|
@@ -26,16 +28,22 @@ const REGISTRY = "https://registry.npmjs.org";
|
|
|
26
28
|
*/
|
|
27
29
|
export async function runUpdate(rootDir) {
|
|
28
30
|
const current = cliVersion();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
const manifests = findManifests(rootDir);
|
|
32
|
+
const rootManifest = join(rootDir, "package.json");
|
|
33
|
+
const targets = [...new Set([PACKAGE, CLI, ...declaredPackages([...manifests.map(({ path }) => path), rootManifest])])];
|
|
34
|
+
// Every version is known before any manifest is written, so a registry
|
|
35
|
+
// failure halfway through leaves the app as it was.
|
|
36
|
+
let versions;
|
|
31
37
|
try {
|
|
32
|
-
|
|
38
|
+
versions = new Map(await Promise.all(targets.map(async (name) => [name, await fetchLatest(name)])));
|
|
33
39
|
}
|
|
34
40
|
catch (error) {
|
|
35
41
|
console.error(`could not reach the npm registry: ${error.message}`);
|
|
36
42
|
process.exitCode = 1;
|
|
37
43
|
return;
|
|
38
44
|
}
|
|
45
|
+
const latest = versions.get(PACKAGE);
|
|
46
|
+
const latestCli = versions.get(CLI);
|
|
39
47
|
const cliRoot = packageRoot();
|
|
40
48
|
// Updatable-as-a-CLI means: an installed package (it lives under some
|
|
41
49
|
// node_modules) that is NOT this app's own copy — the app's copy is
|
|
@@ -46,20 +54,21 @@ export async function runUpdate(rootDir) {
|
|
|
46
54
|
let didSomething = false;
|
|
47
55
|
if (cliIsGlobal) {
|
|
48
56
|
didSomething = true;
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
// `latest` can be behind a candidate installed from `next`; an update
|
|
58
|
+
// never moves backwards.
|
|
59
|
+
if (atOrAhead(current, latestCli)) {
|
|
60
|
+
console.log(`cli already on ${current}${current === latestCli ? "" : ` (latest is ${latestCli})`}`);
|
|
51
61
|
}
|
|
52
62
|
else {
|
|
53
63
|
await updateGlobalCli(cliRoot, current, latestCli);
|
|
54
64
|
}
|
|
55
65
|
}
|
|
56
|
-
const manifests = findManifests(rootDir);
|
|
57
66
|
if (manifests.length > 0) {
|
|
58
67
|
didSomething = true;
|
|
59
68
|
// The app's installed version, not the CLI's — they are separate
|
|
60
69
|
// installs, and reporting one as the other is how this whole confusion
|
|
61
70
|
// started.
|
|
62
|
-
await updateApp(rootDir, manifests, appCoreVersion(rootDir),
|
|
71
|
+
await updateApp(rootDir, manifests, appCoreVersion(rootDir), versions);
|
|
63
72
|
}
|
|
64
73
|
if (!didSomething) {
|
|
65
74
|
console.error(`no package.json in ${rootDir} depends on ${PACKAGE}, and this CLI is not a global install — run it from an app root`);
|
|
@@ -94,19 +103,21 @@ function globalPrefixOf(cliRoot) {
|
|
|
94
103
|
// let npm pick its own, which is right for a plain npm install.
|
|
95
104
|
return index === -1 ? undefined : cliRoot.slice(0, index);
|
|
96
105
|
}
|
|
97
|
-
async function updateApp(rootDir, manifests, current,
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
// The
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
async function updateApp(rootDir, manifests, current, versions) {
|
|
107
|
+
const latest = versions.get(PACKAGE);
|
|
108
|
+
const ranges = new Map([...versions].map(([name, version]) => [name, `^${version}`]));
|
|
109
|
+
// The root is rewritten even when only modules depend on core: the app's
|
|
110
|
+
// own CLI devDependency moves with it, so `pnpm dev` and friends keep
|
|
111
|
+
// matching the framework they generate for.
|
|
112
|
+
const root = join(rootDir, "package.json");
|
|
113
|
+
const paths = [...new Set([...(existsSync(root) ? [root] : []), ...manifests.map(({ path }) => path)])];
|
|
114
|
+
const changed = paths.map((path) => ({ path, names: rewrite(path, ranges) })).filter(({ names }) => names.length > 0);
|
|
104
115
|
if (changed.length === 0) {
|
|
105
|
-
console.log(`app already on ${PACKAGE}
|
|
116
|
+
console.log(`app already on ${PACKAGE} ${current ?? ranges.get(PACKAGE)}${current && current !== latest ? ` (latest is ${latest})` : ""}`);
|
|
106
117
|
return;
|
|
107
118
|
}
|
|
108
|
-
for (const { path } of changed) {
|
|
109
|
-
console.log(` update ${relative(rootDir, path) || "package.json"}
|
|
119
|
+
for (const { path, names } of changed) {
|
|
120
|
+
console.log(` update ${relative(rootDir, path) || "package.json"}: ${names.map((name) => `${name} ${ranges.get(name)}`).join(", ")}`);
|
|
110
121
|
}
|
|
111
122
|
console.log(`\napp: ${current ?? "not installed"} → ${latest}\n`);
|
|
112
123
|
// Rewriting manifests without installing would leave the app claiming a
|
|
@@ -157,11 +168,11 @@ async function fetchLatest(name) {
|
|
|
157
168
|
// The scoped name has to be encoded for the registry's document route.
|
|
158
169
|
const response = await fetch(`${REGISTRY}/${name.replace("/", "%2f")}/latest`);
|
|
159
170
|
if (!response.ok) {
|
|
160
|
-
throw new Error(
|
|
171
|
+
throw new Error(`${name}: registry responded ${response.status}`);
|
|
161
172
|
}
|
|
162
173
|
const body = (await response.json());
|
|
163
174
|
if (typeof body.version !== "string") {
|
|
164
|
-
throw new Error(
|
|
175
|
+
throw new Error(`${name}: registry returned no version`);
|
|
165
176
|
}
|
|
166
177
|
return body.version;
|
|
167
178
|
}
|
|
@@ -192,21 +203,47 @@ function dependsOnCore(path) {
|
|
|
192
203
|
return false;
|
|
193
204
|
}
|
|
194
205
|
}
|
|
195
|
-
/**
|
|
196
|
-
function
|
|
206
|
+
/** Every @tulipes package the manifests declare as a dependency. */
|
|
207
|
+
function declaredPackages(paths) {
|
|
208
|
+
const names = new Set();
|
|
209
|
+
for (const path of paths) {
|
|
210
|
+
let manifest;
|
|
211
|
+
try {
|
|
212
|
+
manifest = JSON.parse(readFileSync(path, "utf8"));
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
for (const deps of [manifest.dependencies, manifest.devDependencies]) {
|
|
218
|
+
for (const name of Object.keys(deps ?? {}))
|
|
219
|
+
if (name.startsWith("@tulipes/"))
|
|
220
|
+
names.add(name);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return [...names];
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Raises each package to its range wherever the manifest declares it, and
|
|
227
|
+
* returns the names that changed. Only a plain version range (`^x.y.z`,
|
|
228
|
+
* `~x.y.z`, `x.y.z`) whose floor is below the target is rewritten: a floor
|
|
229
|
+
* at or above it is a candidate ahead of `latest`, and anything else —
|
|
230
|
+
* `workspace:*`, `file:`, a compound range — is the app's own choice.
|
|
231
|
+
*/
|
|
232
|
+
function rewrite(path, ranges) {
|
|
197
233
|
const manifest = JSON.parse(readFileSync(path, "utf8"));
|
|
198
|
-
|
|
199
|
-
for (const
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
deps
|
|
203
|
-
|
|
234
|
+
const changed = new Set();
|
|
235
|
+
for (const deps of [manifest.dependencies, manifest.devDependencies]) {
|
|
236
|
+
for (const [name, range] of ranges) {
|
|
237
|
+
const floor = deps?.[name] === undefined ? undefined : floorOf(deps[name]);
|
|
238
|
+
if (deps && floor && compareVersions(floor, floorOf(range)) < 0) {
|
|
239
|
+
deps[name] = range;
|
|
240
|
+
changed.add(name);
|
|
241
|
+
}
|
|
204
242
|
}
|
|
205
243
|
}
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return true;
|
|
244
|
+
if (changed.size > 0)
|
|
245
|
+
writeFileSync(path, JSON.stringify(manifest, null, 2) + "\n");
|
|
246
|
+
return [...changed];
|
|
210
247
|
}
|
|
211
248
|
/** Resolves to the exit code, or -1 when the command could not be spawned. */
|
|
212
249
|
async function run(command, args, cwd) {
|
|
@@ -216,7 +253,43 @@ async function run(command, args, cwd) {
|
|
|
216
253
|
child.on("exit", (status) => resolve_(status ?? 1));
|
|
217
254
|
});
|
|
218
255
|
}
|
|
219
|
-
|
|
256
|
+
const VERSION = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
257
|
+
/** The lowest version a plain range admits, or undefined for any other range. */
|
|
258
|
+
function floorOf(range) {
|
|
259
|
+
const version = range.trim().replace(/^[\^~]|^=/, "").replace(/^v/, "");
|
|
260
|
+
return VERSION.test(version) ? version : undefined;
|
|
261
|
+
}
|
|
262
|
+
/** True when `version` is a version at or above `latest`; an unknown version is never ahead. */
|
|
263
|
+
function atOrAhead(version, latest) {
|
|
264
|
+
return VERSION.test(version) && VERSION.test(latest) && compareVersions(version, latest) >= 0;
|
|
265
|
+
}
|
|
266
|
+
/** Semver precedence: negative, zero or positive as `a` sorts before, with or after `b`. */
|
|
267
|
+
export function compareVersions(a, b) {
|
|
268
|
+
const [, ...left] = VERSION.exec(a);
|
|
269
|
+
const [, ...right] = VERSION.exec(b);
|
|
270
|
+
for (let i = 0; i < 3; i++) {
|
|
271
|
+
const difference = Number(left[i]) - Number(right[i]);
|
|
272
|
+
if (difference !== 0)
|
|
273
|
+
return Math.sign(difference);
|
|
274
|
+
}
|
|
275
|
+
const [preA, preB] = [left[3], right[3]];
|
|
276
|
+
if (preA === undefined || preB === undefined)
|
|
277
|
+
return preA === preB ? 0 : preA === undefined ? 1 : -1;
|
|
278
|
+
const [idsA, idsB] = [preA.split("."), preB.split(".")];
|
|
279
|
+
for (let i = 0; i < Math.min(idsA.length, idsB.length); i++) {
|
|
280
|
+
const [x, y] = [idsA[i], idsB[i]];
|
|
281
|
+
if (x === y)
|
|
282
|
+
continue;
|
|
283
|
+
const [numX, numY] = [/^\d+$/.test(x), /^\d+$/.test(y)];
|
|
284
|
+
if (numX && numY)
|
|
285
|
+
return Math.sign(Number(x) - Number(y));
|
|
286
|
+
if (numX !== numY)
|
|
287
|
+
return numX ? -1 : 1;
|
|
288
|
+
return x < y ? -1 : 1;
|
|
289
|
+
}
|
|
290
|
+
return Math.sign(idsA.length - idsB.length);
|
|
291
|
+
}
|
|
292
|
+
export function detectManager(rootDir) {
|
|
220
293
|
if (existsSync(join(rootDir, "yarn.lock")))
|
|
221
294
|
return "yarn";
|
|
222
295
|
if (existsSync(join(rootDir, "pnpm-lock.yaml")))
|
|
@@ -227,14 +300,14 @@ function detectManager(rootDir) {
|
|
|
227
300
|
try {
|
|
228
301
|
const manifest = JSON.parse(readFileSync(join(rootDir, "package.json"), "utf8"));
|
|
229
302
|
const pinned = manifest.packageManager ?? "";
|
|
230
|
-
if (pinned.startsWith("
|
|
231
|
-
return "
|
|
303
|
+
if (pinned.startsWith("yarn"))
|
|
304
|
+
return "yarn";
|
|
232
305
|
if (pinned.startsWith("npm"))
|
|
233
306
|
return "npm";
|
|
234
307
|
}
|
|
235
308
|
catch {
|
|
236
309
|
// fall through
|
|
237
310
|
}
|
|
238
|
-
return "
|
|
311
|
+
return "pnpm";
|
|
239
312
|
}
|
|
240
313
|
//# sourceMappingURL=update.js.map
|
package/dist/update.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5E,MAAM,OAAO,GAAG,eAAe,CAAC;AAChC,MAAM,GAAG,GAAG,cAAc,CAAC;AAC3B,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAQ9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,IAAI,MAAc,CAAC;IACnB,IAAI,SAAiB,CAAC;IACtB,IAAI,CAAC;QACH,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACpF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,qCAAsC,KAAe,CAAC,OAAO,EAA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E,cAAc,CAAC,EAAE,MAAM,CAAC,CACxC,CAAC;QACd,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,IAAI,EAAE,CAAC;QAC7C,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;QAC7C,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tulipes/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-rc.2",
|
|
4
4
|
"description": "The tulipes command line: scaffold, sync, inspect, describe and run Tulipes apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,27 +15,16 @@
|
|
|
15
15
|
"README.md",
|
|
16
16
|
"LICENSE"
|
|
17
17
|
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"typecheck": "tsc --noEmit",
|
|
20
|
-
"build": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
21
|
-
"prepack": "yarn build"
|
|
22
|
-
},
|
|
23
18
|
"publishConfig": {
|
|
24
|
-
"access": "public"
|
|
25
|
-
"bin": {
|
|
26
|
-
"tulipes": "./dist/bin.js"
|
|
27
|
-
},
|
|
28
|
-
"exports": {
|
|
29
|
-
".": "./dist/main.js"
|
|
30
|
-
}
|
|
19
|
+
"access": "public"
|
|
31
20
|
},
|
|
32
21
|
"dependencies": {
|
|
33
|
-
"@tulipes/core": "^0.
|
|
34
|
-
"tsx": "^4"
|
|
22
|
+
"@tulipes/core": "^0.11.0-rc.2"
|
|
35
23
|
},
|
|
36
24
|
"devDependencies": {
|
|
37
25
|
"@types/node": "^24.2.0",
|
|
38
|
-
"typescript": "^7.0.2"
|
|
26
|
+
"typescript": "^7.0.2",
|
|
27
|
+
"@tulipes/spec": "0.3.2-rc.2"
|
|
39
28
|
},
|
|
40
29
|
"repository": {
|
|
41
30
|
"type": "git",
|
|
@@ -55,5 +44,17 @@
|
|
|
55
44
|
"homepage": "https://github.com/kemora13conf/bp-backend-express/tree/master/packages/cli#readme",
|
|
56
45
|
"bugs": {
|
|
57
46
|
"url": "https://github.com/kemora13conf/bp-backend-express/issues"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@tulipes/spec": "^0.3.1 || ^0.3.2-rc.1"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@tulipes/spec": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"typecheck": "tsc --noEmit",
|
|
58
|
+
"build": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json"
|
|
58
59
|
}
|
|
59
60
|
}
|
package/templates/AGENTS.md
CHANGED
|
@@ -16,22 +16,32 @@ one contract in depth.
|
|
|
16
16
|
## Preset scope
|
|
17
17
|
|
|
18
18
|
Read the installed modules and package scripts before applying integration examples.
|
|
19
|
-
The minimal preset has core, security and
|
|
20
|
-
MongoDB, Redis, queues, sockets, shared logger/cache helpers
|
|
21
|
-
below apply when those modules are installed (the production
|
|
19
|
+
The minimal preset has core, security, hello and agent only. Auth, users,
|
|
20
|
+
config, settings, MongoDB, Redis, queues, sockets, shared logger/cache helpers
|
|
21
|
+
and PM2 examples below apply when those modules are installed (the production
|
|
22
|
+
preset). Minimal
|
|
22
23
|
requests use the framework guest identity. Grant permissions to roles the app
|
|
23
24
|
actually defines. Use the generated Vitest suite for changes; production tests
|
|
24
25
|
require dedicated TEST_MONGO_URI and TEST_REDIS_URL services.
|
|
25
26
|
|
|
26
27
|
## Non-negotiable rules
|
|
27
28
|
|
|
28
|
-
1. **Never read `process.env` directly
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
1. **Never read `process.env` directly, and keep the environment small.**
|
|
30
|
+
A value is an environment variable only if boot needs it before the
|
|
31
|
+
database answers (connection strings, the port, log destination) or it
|
|
32
|
+
is a secret: declared under `tulipes.env` in the module's `package.json`, read with
|
|
33
|
+
`ctx.Environment.get("NAME")`. Everything else is a *setting*: declared
|
|
34
|
+
with a zod schema in that module's `module.config.ts`, stored in the
|
|
35
|
+
settings store (the `settings` collection here; a JSON file under
|
|
36
|
+
`config/` in an app without the Mongo store), edited through the
|
|
37
|
+
console, read live at `ctx.config.<module>`. → skill `tulipes-env-variable`
|
|
32
38
|
2. **A feature is a module, not a layer.** Everything a feature needs —
|
|
33
39
|
routes, models, config, permissions, jobs — lives in one folder under
|
|
34
40
|
`modules/`. Never add a top-level `services/` or `middlewares/` folder.
|
|
41
|
+
A module's root holds exactly `package.json`, `module.config.ts` and
|
|
42
|
+
`module.acl.ts`; everything else has a folder (`routes/`, `controllers/`,
|
|
43
|
+
`models/`, `schemas/`, `helpers/`, `bootstrap/`, `queues/`, `sockets/`,
|
|
44
|
+
`i18n/`, `agent/`, `lib/`, `tests/`), and the boot refuses a stray root file.
|
|
35
45
|
→ skill `tulipes-module`
|
|
36
46
|
3. **Never call `mongoose.model()` yourself.** Models are declarations
|
|
37
47
|
picked up by the framework and read from `ctx.models`. Persisted and
|
|
@@ -39,16 +49,23 @@ require dedicated TEST_MONGO_URI and TEST_REDIS_URL services.
|
|
|
39
49
|
camelCase is for TypeScript-only names. → skill `tulipes-model`
|
|
40
50
|
4. **Global middleware belongs to a sys-tier module**, not to the
|
|
41
51
|
entrypoint. `app.ts` stays three lines. → skill `tulipes-endpoint`
|
|
42
|
-
5. **Run `
|
|
43
|
-
`module.config.ts
|
|
44
|
-
|
|
52
|
+
5. **Run `pnpm sync` after touching a module's `tulipes.env`, a
|
|
53
|
+
settings schema in `module.config.ts`, a model file or a queue file's
|
|
54
|
+
`jobs` export.** It regenerates `types/tulipes.d.ts` and `.env.example`;
|
|
55
|
+
stale generated types are a lie. With it, `ctx.models.get("User")` is
|
|
56
|
+
typed from the model's schema and `queues.add("users.welcome", …)` from
|
|
57
|
+
the queue's job schema, so a wrong name or payload does not compile. `module.config.ts`
|
|
58
|
+
has exactly one export, `defineConfig({ schema })`; initialization and
|
|
59
|
+
cleanup belong to `bootstrap/*.bootstrap.ts`, which may return the
|
|
60
|
+
function that closes what it opened, and long-lived work ends on
|
|
61
|
+
`ctx.signal`.
|
|
45
62
|
6. **Every response is `res.respond({ data, meta })`** — never `res.json`,
|
|
46
63
|
which ships a raw body outside the envelope. Failures are **thrown**:
|
|
47
64
|
`throw new HttpError(404, "notFound")`, where the message is an i18n
|
|
48
65
|
key and the code derives from it. Never hand-roll an error shape.
|
|
49
66
|
→ skill `tulipes-response`
|
|
50
67
|
7. **Every route declares a RAI**: put `rai({ id: "x:read" })` first in
|
|
51
|
-
each endpoint handler chain, including routes
|
|
68
|
+
each endpoint handler chain, including routes on a nested router.
|
|
52
69
|
The id is also the ACL permission, and core refuses to boot if a route
|
|
53
70
|
is missing one. Public is `acl.allow("guest", "x:read")`, never a
|
|
54
71
|
missing check. → skill `tulipes-endpoint`
|
|
@@ -68,30 +85,47 @@ require dedicated TEST_MONGO_URI and TEST_REDIS_URL services.
|
|
|
68
85
|
the auth module's `Credential` model, which is `select: false`.
|
|
69
86
|
12. **When auth is installed, a new feature module's namespace goes in BOTH the `admin` and
|
|
70
87
|
`sysadmin` grants** in `modules/auth/module.acl.ts`. Neither role holds
|
|
71
|
-
`*` — a wildcard would reach `settings:*` and make
|
|
72
|
-
boundary a label rather than a rule. →
|
|
88
|
+
`*` — a wildcard would reach `config:write` and `settings:*` and make
|
|
89
|
+
the sysadmin boundary a label rather than a rule. → skills
|
|
90
|
+
`tulipes-config`, `tulipes-settings`
|
|
73
91
|
13. **Cross-module imports use the package name** (`@app/users`,
|
|
74
92
|
`@app/core`), never a relative path that climbs out of the module. The
|
|
75
93
|
workspace boundary is what keeps modules independent, and a package
|
|
76
94
|
name makes the dependency visible in package.json — declare it there
|
|
77
95
|
and in `dependsOn`.
|
|
96
|
+
14. **Every endpoint is a tool an agent can call; describe it as one.** The
|
|
97
|
+
`rai()` name, description and schemas are what the manifest shows, so a
|
|
98
|
+
bare `id` is a tool with no description. A module's `agent/*.agent.ts`
|
|
99
|
+
adds a summary, curates the routes and declares actions that are not
|
|
100
|
+
endpoints; `agent: false` on a `rai()` hides one. → skill
|
|
101
|
+
`tulipes-agent-tool`
|
|
102
|
+
15. **A module's tests live in `modules/<name>/tests/` and boot the app
|
|
103
|
+
through `@tulipes/testing`**: `useTestApp({ rootDir }, { beforeAll,
|
|
104
|
+
afterAll })` once per file, `app.get(app.api("/x"))` with the envelope
|
|
105
|
+
decoded, `app.as("admin")` for a signed-in role. Never boot per test, and
|
|
106
|
+
never reach into another module's files from a test.
|
|
78
107
|
|
|
79
108
|
For endpoint changes, read `tulipes-endpoint`: native routers live in
|
|
80
|
-
`routes/*.routes.ts
|
|
81
|
-
|
|
109
|
+
`routes/*.routes.ts`, plain `(ctx) => Router` functions: build the router from
|
|
110
|
+
the context, return it for the configured prefix, and read models, settings
|
|
111
|
+
and the environment inside handlers, never while building — `tulipes routes`
|
|
112
|
+
and `tulipes spec` build every router with nothing acquired. Global
|
|
113
|
+
middleware that needs the environment is built on its first request with
|
|
114
|
+
`lazy()` from `@app/core`.
|
|
82
115
|
|
|
83
116
|
## Where things go
|
|
84
117
|
|
|
85
118
|
| Decision | Location |
|
|
86
119
|
|---|---|
|
|
87
|
-
|
|
|
88
|
-
| Policy shared by ≥2 modules (pagination,
|
|
89
|
-
|
|
|
120
|
+
| Connection string, secret, or anything boot needs before the database answers | `tulipes.env` in that module's `package.json` |
|
|
121
|
+
| Policy shared by ≥2 modules and the same everywhere (pagination, locales) | `config/app.config.ts` |
|
|
122
|
+
| A value an operator may change at runtime (limits, modes, toggles, lifetimes) | a field in that module's `module.config.ts` schema, read at `ctx.config.<module>` |
|
|
123
|
+
| Opening a client, seeding rows, ensuring indexes, and closing them again | that module's `bootstrap/*.bootstrap.ts`, returning the cleanup |
|
|
90
124
|
| A string a user will read | that module's `i18n/<locale>.json`, reached with `req.t` |
|
|
91
125
|
| The shape of a request body/query | a zod schema on the route's `rai()` |
|
|
92
126
|
| Middleware for every request | a sys-tier module's routes file |
|
|
93
127
|
| Middleware for one feature's routes | that module's own `Router` |
|
|
94
|
-
| Helper used by ≥2 modules | the sys core module, exported from its `index.ts` and imported as `@app/core` |
|
|
128
|
+
| Helper used by ≥2 modules | the sys core module, exported from its `lib/index.ts` and imported as `@app/core` |
|
|
95
129
|
| Helper used by one module | that module's `helpers/` |
|
|
96
130
|
| One-off task (backfill, export, admin chore) | `scripts/`, booted with `mode: "script"` |
|
|
97
131
|
| Anything you would `console.log` | `moduleLogger(ctx.Environment, "<module>", ctx.mode)` from `@app/core` |
|
|
@@ -99,27 +133,30 @@ keep shared middleware and param callbacks beside their endpoints.
|
|
|
99
133
|
## Boot order (why load order matters)
|
|
100
134
|
|
|
101
135
|
`sys` modules load before `app` modules; within a tier, lower `priority`
|
|
102
|
-
first; then `dependsOn` topological order.
|
|
103
|
-
|
|
104
|
-
provides, declare `dependsOn` — do not rely on
|
|
136
|
+
first; then `dependsOn` topological order. Declarations → models →
|
|
137
|
+
settings → translations → ACL → bootstrap → queues → routes. If code needs
|
|
138
|
+
something another module provides, declare `dependsOn` — do not rely on
|
|
139
|
+
luck.
|
|
105
140
|
|
|
106
141
|
## Commands
|
|
107
142
|
|
|
108
143
|
| Command | Use |
|
|
109
144
|
|---|---|
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
145
|
+
| `pnpm dev` | run the backend process (regenerates types first) |
|
|
146
|
+
| `pnpm worker` | run the queue-consumer process |
|
|
147
|
+
| `pnpm sync` | regenerate `types/tulipes.d.ts` + `.env.example` |
|
|
148
|
+
| `pnpm tulipes agent manifest [--role r]` | print every tool the app exposes to agents, offline |
|
|
149
|
+
| `pnpm test` | every `tests/` and `modules/*/tests/` file; each boots the app once through `@tulipes/testing` |
|
|
150
|
+
| `pnpm check` | validate the environment without booting |
|
|
151
|
+
| `pnpm typecheck` | typecheck the whole app |
|
|
152
|
+
| `pnpm tulipes new module <name>` | scaffold a module |
|
|
116
153
|
| `tulipes update` | upgrade the global cli and the framework in every manifest |
|
|
117
|
-
| `
|
|
154
|
+
| `pnpm script scripts/x.ts` | run a one-off script against the real app |
|
|
118
155
|
|
|
119
156
|
## Verifying your work
|
|
120
157
|
|
|
121
|
-
A change is not done until the app boots. Run `
|
|
122
|
-
`
|
|
158
|
+
A change is not done until the app boots. Run `pnpm typecheck`, then
|
|
159
|
+
`pnpm dev` and confirm the startup banner lists what you added (modules,
|
|
123
160
|
queues, sockets, roles). Boot failures print an aggregate report naming
|
|
124
161
|
every problem at once — read all of it before fixing anything. → skill
|
|
125
162
|
`tulipes-boot-errors`
|
package/templates/CLAUDE.md
CHANGED
|
@@ -6,7 +6,8 @@ here; it holds the non-negotiable rules, where each kind of code belongs, the
|
|
|
6
6
|
boot order and the commands.
|
|
7
7
|
|
|
8
8
|
This file exists so Claude Code picks that up automatically. The other
|
|
9
|
-
Claude-specific piece is `.claude/skills/`:
|
|
10
|
-
environment variable, endpoint, model, queue, socket, permissions
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
Claude-specific piece is `.claude/skills/`: task-scoped guides — module,
|
|
10
|
+
environment variable, endpoint, response, model, queue, socket, permissions,
|
|
11
|
+
settings (the config module and the log stream), i18n, spec, agent tools and
|
|
12
|
+
reading boot errors — loaded on demand when a task matches one. AGENTS.md
|
|
13
|
+
points at them by name.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Development. NOT committed — .gitignore excludes .envs/, because a
|
|
2
|
+
# file holding working credentials does not belong in a repository.
|
|
3
|
+
# The committed contract is .env.example at the root: copy it here and
|
|
4
|
+
# fill it in. Real deployments inject variables through the container
|
|
5
|
+
# environment, which always wins over this file.
|
|
6
|
+
|
|
7
|
+
PORT=3000
|
|
8
|
+
LOG_LEVEL=debug
|
|
9
|
+
|
|
10
|
+
MONGO_URI=mongodb://127.0.0.1:27017/tulipes-example
|
|
11
|
+
REDIS_URL=redis://127.0.0.1:6379
|
|
12
|
+
|
|
13
|
+
# Auth. Separate keys, so leaking one cannot mint the other.
|
|
14
|
+
JWT_ACCESS_SECRET=dev-only-access-secret-change-me
|
|
15
|
+
JWT_REFRESH_SECRET=dev-only-refresh-secret-change-me
|
|
16
|
+
AUTH_ADMIN_EMAIL=admin@example.com
|
|
17
|
+
AUTH_ADMIN_PASSWORD=dev-admin-password
|
|
18
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Production. NOT committed — .gitignore excludes .envs/. Recreate it
|
|
2
|
+
# on the deployment host from .env.example, or leave it out entirely
|
|
3
|
+
# and inject everything through the container environment.
|
|
4
|
+
#
|
|
5
|
+
# The blanks below are intentional. Real deployments inject MONGO_URI,
|
|
6
|
+
# REDIS_URL and any secret through the container environment, which
|
|
7
|
+
# always wins over this file. Booting without them fails closed with a
|
|
8
|
+
# report naming every missing variable — run `pnpm check` to see it
|
|
9
|
+
# without starting the app.
|
|
10
|
+
|
|
11
|
+
PORT=3000
|
|
12
|
+
LOG_LEVEL=info
|
|
13
|
+
|
|
14
|
+
# MONGO_URI=
|
|
15
|
+
# REDIS_URL=
|
|
16
|
+
# JWT_ACCESS_SECRET=
|
|
17
|
+
# JWT_REFRESH_SECRET=
|
|
18
|
+
# AUTH_ADMIN_EMAIL=
|
|
19
|
+
# AUTH_ADMIN_PASSWORD=
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Staging. NOT committed — .gitignore excludes .envs/. Recreate it on
|
|
2
|
+
# the deployment host from .env.example, or leave it out entirely and
|
|
3
|
+
# inject everything through the container environment.
|
|
4
|
+
#
|
|
5
|
+
# The blanks below are intentional. Real deployments inject MONGO_URI,
|
|
6
|
+
# REDIS_URL and any secret through the container environment, which
|
|
7
|
+
# always wins over this file. Booting without them fails closed with a
|
|
8
|
+
# report naming every missing variable — run `pnpm check` to see it
|
|
9
|
+
# without starting the app.
|
|
10
|
+
|
|
11
|
+
PORT=3000
|
|
12
|
+
LOG_LEVEL=info
|
|
13
|
+
|
|
14
|
+
# MONGO_URI=
|
|
15
|
+
# REDIS_URL=
|
|
16
|
+
# JWT_ACCESS_SECRET=
|
|
17
|
+
# JWT_REFRESH_SECRET=
|
|
18
|
+
# AUTH_ADMIN_EMAIL=
|
|
19
|
+
# AUTH_ADMIN_PASSWORD=
|