@obh/forge 0.2.0
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/LICENSE +21 -0
- package/README.md +146 -0
- package/dist/capabilities/analytics.d.ts +3 -0
- package/dist/capabilities/analytics.d.ts.map +1 -0
- package/dist/capabilities/analytics.js +91 -0
- package/dist/capabilities/analytics.js.map +1 -0
- package/dist/capabilities/api-keys.d.ts +3 -0
- package/dist/capabilities/api-keys.d.ts.map +1 -0
- package/dist/capabilities/api-keys.js +90 -0
- package/dist/capabilities/api-keys.js.map +1 -0
- package/dist/capabilities/audit.d.ts +3 -0
- package/dist/capabilities/audit.d.ts.map +1 -0
- package/dist/capabilities/audit.js +74 -0
- package/dist/capabilities/audit.js.map +1 -0
- package/dist/capabilities/entitlements.d.ts +3 -0
- package/dist/capabilities/entitlements.d.ts.map +1 -0
- package/dist/capabilities/entitlements.js +94 -0
- package/dist/capabilities/entitlements.js.map +1 -0
- package/dist/capabilities/events.d.ts +3 -0
- package/dist/capabilities/events.d.ts.map +1 -0
- package/dist/capabilities/events.js +107 -0
- package/dist/capabilities/events.js.map +1 -0
- package/dist/capabilities/files.d.ts +3 -0
- package/dist/capabilities/files.d.ts.map +1 -0
- package/dist/capabilities/files.js +100 -0
- package/dist/capabilities/files.js.map +1 -0
- package/dist/capabilities/helpers.d.ts +27 -0
- package/dist/capabilities/helpers.d.ts.map +1 -0
- package/dist/capabilities/helpers.js +63 -0
- package/dist/capabilities/helpers.js.map +1 -0
- package/dist/capabilities/import-export.d.ts +3 -0
- package/dist/capabilities/import-export.d.ts.map +1 -0
- package/dist/capabilities/import-export.js +267 -0
- package/dist/capabilities/import-export.js.map +1 -0
- package/dist/capabilities/index.d.ts +16 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +71 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/jobs.d.ts +3 -0
- package/dist/capabilities/jobs.d.ts.map +1 -0
- package/dist/capabilities/jobs.js +117 -0
- package/dist/capabilities/jobs.js.map +1 -0
- package/dist/capabilities/notifications.d.ts +3 -0
- package/dist/capabilities/notifications.d.ts.map +1 -0
- package/dist/capabilities/notifications.js +113 -0
- package/dist/capabilities/notifications.js.map +1 -0
- package/dist/capabilities/search.d.ts +3 -0
- package/dist/capabilities/search.d.ts.map +1 -0
- package/dist/capabilities/search.js +121 -0
- package/dist/capabilities/search.js.map +1 -0
- package/dist/capabilities/settings.d.ts +3 -0
- package/dist/capabilities/settings.d.ts.map +1 -0
- package/dist/capabilities/settings.js +75 -0
- package/dist/capabilities/settings.js.map +1 -0
- package/dist/capabilities/types.d.ts +16 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capabilities/types.js +3 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/capabilities/webhooks.d.ts +3 -0
- package/dist/capabilities/webhooks.d.ts.map +1 -0
- package/dist/capabilities/webhooks.js +117 -0
- package/dist/capabilities/webhooks.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +60 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add.d.ts +3 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +88 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +94 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/generate.d.ts +3 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +41 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/inspect.d.ts +3 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +64 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/new.d.ts +18 -0
- package/dist/commands/new.d.ts.map +1 -0
- package/dist/commands/new.js +149 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/shared.d.ts +14 -0
- package/dist/commands/shared.d.ts.map +1 -0
- package/dist/commands/shared.js +36 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/commands/skill.d.ts +3 -0
- package/dist/commands/skill.d.ts.map +1 -0
- package/dist/commands/skill.js +59 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/commands/stack.d.ts +13 -0
- package/dist/commands/stack.d.ts.map +1 -0
- package/dist/commands/stack.js +192 -0
- package/dist/commands/stack.js.map +1 -0
- package/dist/generators/api.d.ts +16 -0
- package/dist/generators/api.d.ts.map +1 -0
- package/dist/generators/api.js +375 -0
- package/dist/generators/api.js.map +1 -0
- package/dist/generators/lwd.d.ts +12 -0
- package/dist/generators/lwd.d.ts.map +1 -0
- package/dist/generators/lwd.js +143 -0
- package/dist/generators/lwd.js.map +1 -0
- package/dist/generators/mobile.d.ts +16 -0
- package/dist/generators/mobile.d.ts.map +1 -0
- package/dist/generators/mobile.js +180 -0
- package/dist/generators/mobile.js.map +1 -0
- package/dist/generators/platform-package.d.ts +18 -0
- package/dist/generators/platform-package.d.ts.map +1 -0
- package/dist/generators/platform-package.js +568 -0
- package/dist/generators/platform-package.js.map +1 -0
- package/dist/generators/root.d.ts +15 -0
- package/dist/generators/root.d.ts.map +1 -0
- package/dist/generators/root.js +249 -0
- package/dist/generators/root.js.map +1 -0
- package/dist/generators/sdk.d.ts +14 -0
- package/dist/generators/sdk.d.ts.map +1 -0
- package/dist/generators/sdk.js +137 -0
- package/dist/generators/sdk.js.map +1 -0
- package/dist/generators/web.d.ts +15 -0
- package/dist/generators/web.d.ts.map +1 -0
- package/dist/generators/web.js +203 -0
- package/dist/generators/web.js.map +1 -0
- package/dist/generators/worker.d.ts +13 -0
- package/dist/generators/worker.d.ts.map +1 -0
- package/dist/generators/worker.js +148 -0
- package/dist/generators/worker.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/project/context.d.ts +24 -0
- package/dist/project/context.d.ts.map +1 -0
- package/dist/project/context.js +63 -0
- package/dist/project/context.js.map +1 -0
- package/dist/project/manifest.d.ts +26 -0
- package/dist/project/manifest.d.ts.map +1 -0
- package/dist/project/manifest.js +73 -0
- package/dist/project/manifest.js.map +1 -0
- package/dist/project/paths.d.ts +25 -0
- package/dist/project/paths.d.ts.map +1 -0
- package/dist/project/paths.js +51 -0
- package/dist/project/paths.js.map +1 -0
- package/dist/project/plan.d.ts +42 -0
- package/dist/project/plan.d.ts.map +1 -0
- package/dist/project/plan.js +251 -0
- package/dist/project/plan.js.map +1 -0
- package/dist/prompts/index.d.ts +24 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +111 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/recipes/index.d.ts +25 -0
- package/dist/recipes/index.d.ts.map +1 -0
- package/dist/recipes/index.js +77 -0
- package/dist/recipes/index.js.map +1 -0
- package/dist/stack/infer.d.ts +4 -0
- package/dist/stack/infer.d.ts.map +1 -0
- package/dist/stack/infer.js +165 -0
- package/dist/stack/infer.js.map +1 -0
- package/dist/stack/lwd.d.ts +24 -0
- package/dist/stack/lwd.d.ts.map +1 -0
- package/dist/stack/lwd.js +62 -0
- package/dist/stack/lwd.js.map +1 -0
- package/dist/stack/lwdtoml.d.ts +38 -0
- package/dist/stack/lwdtoml.d.ts.map +1 -0
- package/dist/stack/lwdtoml.js +57 -0
- package/dist/stack/lwdtoml.js.map +1 -0
- package/dist/stack/manifest.d.ts +15 -0
- package/dist/stack/manifest.d.ts.map +1 -0
- package/dist/stack/manifest.js +86 -0
- package/dist/stack/manifest.js.map +1 -0
- package/dist/stack/types.d.ts +48 -0
- package/dist/stack/types.d.ts.map +1 -0
- package/dist/stack/types.js +5 -0
- package/dist/stack/types.js.map +1 -0
- package/dist/stack/wire.d.ts +40 -0
- package/dist/stack/wire.d.ts.map +1 -0
- package/dist/stack/wire.js +192 -0
- package/dist/stack/wire.js.map +1 -0
- package/dist/types.d.ts +114 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/fs.d.ts +13 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +64 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/git.d.ts +17 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +49 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/logger.d.ts +16 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +21 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/shell.d.ts +21 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +40 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +40 -0
- package/skills/obh-add-events/SKILL.md +26 -0
- package/skills/obh-generate-audit-rules/SKILL.md +26 -0
- package/skills/obh-inspect-project/SKILL.md +26 -0
- package/skills/obh-lwd-manifest/SKILL.md +26 -0
- package/skills/obh-retrofit-files/SKILL.md +24 -0
- package/skills/obh-retrofit-jobs/SKILL.md +26 -0
- package/skills/obh-sdk-extraction/SKILL.md +24 -0
- package/skills/obh-settings-migration/SKILL.md +24 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webhooks = void 0;
|
|
4
|
+
const helpers_1 = require("./helpers");
|
|
5
|
+
exports.webhooks = {
|
|
6
|
+
name: "webhooks",
|
|
7
|
+
requires: ["events"],
|
|
8
|
+
describe: "Outbound webhook delivery — signed, retried, dead-lettered; endpoints managed per workspace",
|
|
9
|
+
apply(ctx, plan) {
|
|
10
|
+
(0, helpers_1.addPlatformPackage)(plan, ctx, "webhooks", { api: true, worker: true });
|
|
11
|
+
plan.create("scripts/migrations.d/webhooks.ts", (0, helpers_1.migrationModule)("webhooks"), "webhooks migrations wiring");
|
|
12
|
+
if (ctx.hasApp("api")) {
|
|
13
|
+
plan.create("apps/api/src/platform/webhooks.ts", CLIENT, "webhooks client");
|
|
14
|
+
plan.create("apps/api/src/routes/webhooks.ts", (0, helpers_1.apiFramework)(ctx) === "hono" ? ROUTE_HONO : ROUTE_EXPRESS, "manage webhook endpoints");
|
|
15
|
+
}
|
|
16
|
+
if (ctx.hasWorker()) {
|
|
17
|
+
plan.create("apps/worker/src/dispatch.d/webhooks.ts", `export const consumer = { name: "webhooks", events: ["*"] }\n`, "register webhooks as an event consumer");
|
|
18
|
+
plan.create("apps/worker/src/consumers.d/webhooks.ts", WORKER, "webhook ingest + delivery tick");
|
|
19
|
+
}
|
|
20
|
+
plan.addEnvVar({
|
|
21
|
+
name: "WEBHOOK_SECRET_ENCRYPTION_KEY",
|
|
22
|
+
example: "change-me-32-bytes-min",
|
|
23
|
+
comment: "encrypts per-endpoint signing secrets at rest",
|
|
24
|
+
secret: true,
|
|
25
|
+
});
|
|
26
|
+
plan.patchManifest({ platform: { webhooks: true } });
|
|
27
|
+
plan.nextStep("Run `pnpm migrate` and set WEBHOOK_SECRET_ENCRYPTION_KEY. Events fan out to endpoint deliveries, sent by the worker.");
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
// The client's endpoint methods each take a db handle as their first argument,
|
|
31
|
+
// so the platform module exports the adapter alongside the client.
|
|
32
|
+
const CLIENT = `import { createWebhooksClient, pgAdapter } from "@obh/webhooks"
|
|
33
|
+
import { pool } from "../db"
|
|
34
|
+
|
|
35
|
+
export const webhooksDb = pgAdapter(pool)
|
|
36
|
+
|
|
37
|
+
// secretEncryptionKey encrypts each endpoint's signing secret at rest.
|
|
38
|
+
export const webhooks = createWebhooksClient({
|
|
39
|
+
secretEncryptionKey: process.env.WEBHOOK_SECRET_ENCRYPTION_KEY,
|
|
40
|
+
})
|
|
41
|
+
`;
|
|
42
|
+
const ROUTE_HONO = `import type { Hono } from "hono"
|
|
43
|
+
import { webhooks, webhooksDb } from "../platform/webhooks"
|
|
44
|
+
import { WORKSPACE } from "../platform/events"
|
|
45
|
+
|
|
46
|
+
export function register(app: Hono): void {
|
|
47
|
+
// Register an endpoint. The plaintext signing secret is returned once, here.
|
|
48
|
+
app.post("/api/webhooks/endpoints", async (c) => {
|
|
49
|
+
const body = await c.req.json<{ name: string; url: string; eventPatterns: string[] }>()
|
|
50
|
+
const result = await webhooks.createEndpoint(webhooksDb, {
|
|
51
|
+
workspaceId: WORKSPACE,
|
|
52
|
+
name: body.name,
|
|
53
|
+
url: body.url,
|
|
54
|
+
eventPatterns: body.eventPatterns,
|
|
55
|
+
})
|
|
56
|
+
return c.json(result, 201)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
app.get("/api/webhooks/endpoints", async (c) => {
|
|
60
|
+
return c.json(await webhooks.listEndpoints(webhooksDb, { workspaceId: WORKSPACE }))
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
const ROUTE_EXPRESS = `import type { Express, Request, Response } from "express"
|
|
65
|
+
import { webhooks, webhooksDb } from "../platform/webhooks"
|
|
66
|
+
import { WORKSPACE } from "../platform/events"
|
|
67
|
+
|
|
68
|
+
export function register(app: Express): void {
|
|
69
|
+
app.post("/api/webhooks/endpoints", async (req: Request, res: Response) => {
|
|
70
|
+
const result = await webhooks.createEndpoint(webhooksDb, {
|
|
71
|
+
workspaceId: WORKSPACE,
|
|
72
|
+
name: req.body.name,
|
|
73
|
+
url: req.body.url,
|
|
74
|
+
eventPatterns: req.body.eventPatterns,
|
|
75
|
+
})
|
|
76
|
+
res.status(201).json(result)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
app.get("/api/webhooks/endpoints", async (_req: Request, res: Response) => {
|
|
80
|
+
res.json(await webhooks.listEndpoints(webhooksDb, { workspaceId: WORKSPACE }))
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
const WORKER = `// Two phases per tick: (1) claim the "webhooks" event deliveries and ingest each
|
|
85
|
+
// event into per-endpoint webhook deliveries; (2) deliver pending webhook rows
|
|
86
|
+
// (sign, POST, retry with backoff, auto-disable dead endpoints).
|
|
87
|
+
import { createConsumerRunner, pgAdapter as eventsPgAdapter } from "@obh/events"
|
|
88
|
+
import { createWebhooksClient, createWebhooksWorker, defineWebhookConsumer, pgAdapter } from "@obh/webhooks"
|
|
89
|
+
import type { WorkerContext } from "../context"
|
|
90
|
+
|
|
91
|
+
let runner: ReturnType<typeof createConsumerRunner>
|
|
92
|
+
let delivery: ReturnType<typeof createWebhooksWorker>
|
|
93
|
+
|
|
94
|
+
export function init(ctx: WorkerContext): void {
|
|
95
|
+
const client = createWebhooksClient({
|
|
96
|
+
secretEncryptionKey: process.env.WEBHOOK_SECRET_ENCRYPTION_KEY,
|
|
97
|
+
})
|
|
98
|
+
// The consumer's handler calls client.ingestEvent to fan an event out to
|
|
99
|
+
// matching endpoints (creating deliveries the delivery worker then sends).
|
|
100
|
+
runner = createConsumerRunner({
|
|
101
|
+
db: eventsPgAdapter(ctx.pool),
|
|
102
|
+
consumers: [defineWebhookConsumer({ client, db: pgAdapter(ctx.pool), name: "webhooks" })],
|
|
103
|
+
instanceId: "worker",
|
|
104
|
+
})
|
|
105
|
+
delivery = createWebhooksWorker({
|
|
106
|
+
db: pgAdapter(ctx.pool),
|
|
107
|
+
instanceId: "worker",
|
|
108
|
+
secretEncryptionKey: process.env.WEBHOOK_SECRET_ENCRYPTION_KEY,
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export async function tick(): Promise<void> {
|
|
113
|
+
await runner.tick()
|
|
114
|
+
await delivery.tick()
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.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AAI,CAAC,QAAQ,CAAC,sHAAsH,CAAC,CAAA;IACvI,CAAC;CACF,CAAA;AAED,+EAA+E;AAC/E,mEAAmE;AACnE,MAAM,MAAM,GAAG;;;;;;;;;CASd,CAAA;AAED,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBlB,CAAA;AAED,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;CAmBrB,CAAA;AAED,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCd,CAAA"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const version_1 = require("./version");
|
|
6
|
+
const new_1 = require("./commands/new");
|
|
7
|
+
const add_1 = require("./commands/add");
|
|
8
|
+
const inspect_1 = require("./commands/inspect");
|
|
9
|
+
const doctor_1 = require("./commands/doctor");
|
|
10
|
+
const generate_1 = require("./commands/generate");
|
|
11
|
+
const skill_1 = require("./commands/skill");
|
|
12
|
+
const stack_1 = require("./commands/stack");
|
|
13
|
+
function withFlags(cmd) {
|
|
14
|
+
return cmd
|
|
15
|
+
.option("--dry-run", "preview changes without writing")
|
|
16
|
+
.option("-y, --yes", "skip the confirmation prompt (non-interactive)")
|
|
17
|
+
.option("--force", "overwrite existing files that differ");
|
|
18
|
+
}
|
|
19
|
+
const program = new commander_1.Command();
|
|
20
|
+
program
|
|
21
|
+
.name("forge")
|
|
22
|
+
.description("OBH Forge — deterministic scaffolding & delivery tooling")
|
|
23
|
+
.version(version_1.FORGE_VERSION);
|
|
24
|
+
withFlags(program
|
|
25
|
+
.command("new <kind> [name]")
|
|
26
|
+
.description("scaffold a new project (kind: app | package)")
|
|
27
|
+
.option("--recipe <recipe>", "full-saas | api-web-worker | api-only | worker")
|
|
28
|
+
.option("--scope <scope>", "npm scope for internal packages (default @<name>; @obh for packages)")
|
|
29
|
+
.option("--topology <topology>", "small | split")
|
|
30
|
+
.option("--api-framework <framework>", "hono | express")
|
|
31
|
+
.option("--no-example", "skip the notes example domain (bare health-only app)")
|
|
32
|
+
.option("--no-sdk", "skip the shared SDK package")
|
|
33
|
+
.option("--mobile [name]", "include an Expo mobile app (default name: mobile)")
|
|
34
|
+
.option("--daemon", "for `new package`: also generate an admin/worker daemon")
|
|
35
|
+
.option("--repo <owner/repo>", "GitHub repo for deploy manifests (else auto-detected)")).action((kind, name, opts) => (0, new_1.newCommand)(kind, name, opts));
|
|
36
|
+
withFlags(program
|
|
37
|
+
.command("add <target> [name]")
|
|
38
|
+
.description("add a primitive (events|jobs|files|audit|settings|api-keys|webhooks|import-export|entitlements|search|analytics|notifications) or app (api|web|worker|sdk|mobile)")).action((target, name, opts) => (0, add_1.addCommand)(target, name, opts));
|
|
39
|
+
program.command("inspect").description("report project shape and detected conventions").action(() => (0, inspect_1.inspectCommand)());
|
|
40
|
+
program.command("doctor").description("check the project against OBH conventions").action(() => (0, doctor_1.doctorCommand)());
|
|
41
|
+
withFlags(program.command("generate <artifact>").description("regenerate an artifact (lwd | ci | env)")).action((artifact, opts) => (0, generate_1.generateCommand)(artifact, opts));
|
|
42
|
+
withFlags(program.command("skill <action> [name]").description("manage OBH Claude skills (list | install <name>)")).action((action, name, opts) => (0, skill_1.skillCommand)(action, name, opts));
|
|
43
|
+
// Repo → lwd delivery. `forge deploy` is an alias for `forge stack deploy`.
|
|
44
|
+
function stackFlags(cmd) {
|
|
45
|
+
return withFlags(cmd)
|
|
46
|
+
.option("--rotate <keys>", "regenerate secret(s) (comma-separated) and re-derive connections")
|
|
47
|
+
.option("--app <name>", "limit to one app")
|
|
48
|
+
.option("--no-wait", "don't gate on health between apps")
|
|
49
|
+
.option("--destroy-data", "for rm: attempt to remove named data volumes (lwd preserves them)");
|
|
50
|
+
}
|
|
51
|
+
function mapStack(opts) {
|
|
52
|
+
return { ...opts, noWait: opts.wait === false };
|
|
53
|
+
}
|
|
54
|
+
stackFlags(program.command("stack <action>").description("repo → lwd delivery (init | deploy | status | rm)")).action((action, opts) => (0, stack_1.stackCommand)(action, mapStack(opts)));
|
|
55
|
+
stackFlags(program.command("deploy").description("alias for `forge stack deploy`")).action((opts) => (0, stack_1.stackCommand)("deploy", mapStack(opts)));
|
|
56
|
+
program.parseAsync(process.argv).catch((err) => {
|
|
57
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
58
|
+
process.exit(1);
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AACA,yCAAmC;AACnC,uCAAyC;AACzC,wCAA2C;AAC3C,wCAA2C;AAC3C,gDAAmD;AACnD,8CAAiD;AACjD,kDAAqD;AACrD,4CAA+C;AAC/C,4CAA+C;AAE/C,SAAS,SAAS,CAAC,GAAY;IAC7B,OAAO,GAAG;SACP,MAAM,CAAC,WAAW,EAAE,iCAAiC,CAAC;SACtD,MAAM,CAAC,WAAW,EAAE,gDAAgD,CAAC;SACrE,MAAM,CAAC,SAAS,EAAE,sCAAsC,CAAC,CAAA;AAC9D,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;AAC7B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,0DAA0D,CAAC;KACvE,OAAO,CAAC,uBAAa,CAAC,CAAA;AAEzB,SAAS,CACP,OAAO;KACJ,OAAO,CAAC,mBAAmB,CAAC;KAC5B,WAAW,CAAC,8CAA8C,CAAC;KAC3D,MAAM,CAAC,mBAAmB,EAAE,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Y,EAAE,EAAE;IACtD,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAcA,yDAAyD;AACzD,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBvH"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addCommand = addCommand;
|
|
4
|
+
const plan_1 = require("../project/plan");
|
|
5
|
+
const context_1 = require("../project/context");
|
|
6
|
+
const capabilities_1 = require("../capabilities");
|
|
7
|
+
const api_1 = require("../generators/api");
|
|
8
|
+
const worker_1 = require("../generators/worker");
|
|
9
|
+
const sdk_1 = require("../generators/sdk");
|
|
10
|
+
const web_1 = require("../generators/web");
|
|
11
|
+
const mobile_1 = require("../generators/mobile");
|
|
12
|
+
const logger_1 = require("../utils/logger");
|
|
13
|
+
const shared_1 = require("./shared");
|
|
14
|
+
const APP_KINDS = ["api", "web", "worker", "sdk", "mobile"];
|
|
15
|
+
/** `forge add <capability|api|web|worker|sdk> [name]` */
|
|
16
|
+
async function addCommand(target, name, opts) {
|
|
17
|
+
const ctx = await context_1.ProjectContext.load(process.cwd());
|
|
18
|
+
if (!ctx.hasManifest()) {
|
|
19
|
+
logger_1.log.error("No forge.json found. Run inside a Forge project (or create one with `forge new app <name>`).");
|
|
20
|
+
process.exitCode = 1;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const flags = (0, shared_1.flagsFrom)(opts);
|
|
24
|
+
const plan = new plan_1.Plan();
|
|
25
|
+
const scope = `@${ctx.requireManifest().name}`;
|
|
26
|
+
if (APP_KINDS.includes(target)) {
|
|
27
|
+
addAppKind(ctx, plan, target, name, scope);
|
|
28
|
+
}
|
|
29
|
+
else if ((0, capabilities_1.isImplemented)(target)) {
|
|
30
|
+
addCapabilityChain(ctx, plan, target);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
logger_1.log.error(`Unknown target "${target}".`);
|
|
34
|
+
logger_1.log.plain(" apps: api | web <name> | worker | sdk");
|
|
35
|
+
logger_1.log.plain(" primitives: " + Object.keys(capabilities_1.CAPABILITIES).join(" | "));
|
|
36
|
+
process.exitCode = 1;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
await (0, shared_1.runPlan)(ctx.root, plan, flags);
|
|
40
|
+
}
|
|
41
|
+
function addAppKind(ctx, plan, kind, name, scope) {
|
|
42
|
+
const config = ctx.requireManifest().config;
|
|
43
|
+
switch (kind) {
|
|
44
|
+
case "api":
|
|
45
|
+
(0, api_1.addApiApp)(plan, { scope, framework: config.apiFramework, example: config.example });
|
|
46
|
+
plan.patchManifest({ apps: { api: { name: "api", path: "apps/api", framework: config.apiFramework, role: "api" } } });
|
|
47
|
+
break;
|
|
48
|
+
case "worker":
|
|
49
|
+
(0, worker_1.addWorkerApp)(plan, { scope });
|
|
50
|
+
plan.patchManifest({ apps: { worker: { name: "worker", path: "apps/worker", role: "worker" } } });
|
|
51
|
+
break;
|
|
52
|
+
case "sdk":
|
|
53
|
+
(0, sdk_1.addSdkPackage)(plan, { scope, example: config.example });
|
|
54
|
+
plan.patchManifest({ packages: { sdk: { name: "sdk", path: "packages/sdk" } } });
|
|
55
|
+
break;
|
|
56
|
+
case "web": {
|
|
57
|
+
const appName = name ?? "admin";
|
|
58
|
+
(0, web_1.addWebApp)(plan, { scope, name: appName, example: config.example });
|
|
59
|
+
plan.patchManifest({
|
|
60
|
+
apps: { [appName]: { name: appName, path: `apps/${appName}`, framework: "vite-react", role: "web" } },
|
|
61
|
+
});
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case "mobile": {
|
|
65
|
+
const appName = name ?? "mobile";
|
|
66
|
+
(0, mobile_1.addMobileApp)(plan, { scope, name: appName, example: config.example });
|
|
67
|
+
plan.patchManifest({ apps: { [appName]: { name: appName, path: `apps/${appName}`, role: "mobile" } } });
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
plan.nextStep("Regenerate deployment manifests if needed: forge generate lwd --force");
|
|
72
|
+
}
|
|
73
|
+
function addCapabilityChain(ctx, plan, target) {
|
|
74
|
+
const missing = (0, capabilities_1.missingPrerequisites)(target, (n) => ctx.hasCapability(n));
|
|
75
|
+
if (missing.length > 0) {
|
|
76
|
+
logger_1.log.info(`${target} requires ${missing.join(", ")} — adding ${missing.length > 1 ? "them" : "it"} too.`);
|
|
77
|
+
}
|
|
78
|
+
for (const capName of (0, capabilities_1.resolveOrder)([target])) {
|
|
79
|
+
if (ctx.hasCapability(capName) && capName !== target)
|
|
80
|
+
continue;
|
|
81
|
+
const cap = (0, capabilities_1.getCapability)(capName);
|
|
82
|
+
if (cap)
|
|
83
|
+
cap.apply(ctx, plan);
|
|
84
|
+
}
|
|
85
|
+
plan.nextStep("Run `pnpm migrate` to apply new platform migrations.");
|
|
86
|
+
plan.nextStep("Refresh secrets in deployment manifests: forge generate lwd --force");
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":";;AAeA,gCAyBC;AAvCD,0CAAsC;AACtC,gDAAmD;AACnD,kDAAgH;AAChH,2CAA6C;AAC7C,iDAAmD;AACnD,2CAAiD;AACjD,2CA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AI,CAAC,GAAG,MAAM,aAAa,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAA;IAC1G,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,IAAA,2BAAY,EAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAC7C,IAAI,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,OAAO,KAAK,MAAM;YAAE,SAAQ;QAC9D,MAAM,GAAG,GAAG,IAAA,4BAAa,EAAC,OAAO,CAAC,CAAA;QAClC,IAAI,GAAG;YAAE,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,sDAAsD,CAAC,CAAA;IACrE,IAAI,CAAC,QAAQ,CAAC,qEAAqE,CAAC,CAAA;AACtF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAwBA,8EAA8E;AAC9E,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA2EnD"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.doctorCommand = doctorCommand;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const context_1 = require("../project/context");
|
|
9
|
+
const fs_1 = require("../utils/fs");
|
|
10
|
+
const logger_1 = require("../utils/logger");
|
|
11
|
+
const WORKER_PRIMITIVES = [
|
|
12
|
+
"events",
|
|
13
|
+
"jobs",
|
|
14
|
+
"audit",
|
|
15
|
+
"webhooks",
|
|
16
|
+
"import-export",
|
|
17
|
+
"search",
|
|
18
|
+
"analytics",
|
|
19
|
+
"notifications",
|
|
20
|
+
];
|
|
21
|
+
/** `forge doctor` — check a project against OBH conventions. Reports only. */
|
|
22
|
+
async function doctorCommand() {
|
|
23
|
+
const ctx = await context_1.ProjectContext.load(process.cwd());
|
|
24
|
+
const checks = [];
|
|
25
|
+
const has = (rel) => (0, fs_1.exists)(node_path_1.default.join(ctx.root, rel));
|
|
26
|
+
checks.push({
|
|
27
|
+
label: "forge.json present and valid",
|
|
28
|
+
status: ctx.hasManifest() ? "pass" : "warn",
|
|
29
|
+
hint: ctx.hasManifest() ? undefined : "not a Forge project; some checks skipped",
|
|
30
|
+
});
|
|
31
|
+
if (ctx.hasApp("api")) {
|
|
32
|
+
checks.push({
|
|
33
|
+
label: "API health route",
|
|
34
|
+
status: (await has("apps/api/src/routes/health.ts")) ? "pass" : "fail",
|
|
35
|
+
hint: "expected apps/api/src/routes/health.ts",
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
checks.push({ label: "CI workflow", status: (await has(".github/workflows/ci.yml")) ? "pass" : "warn", hint: ".github/workflows/ci.yml" });
|
|
39
|
+
checks.push({ label: ".env.example", status: (await has(".env.example")) ? "pass" : "warn" });
|
|
40
|
+
checks.push({ label: "migration runner", status: (await has("scripts/migrate.ts")) ? "pass" : "fail", hint: "scripts/migrate.ts" });
|
|
41
|
+
// lwd manifests for each deployable app (mobile ships via EAS, not lwd).
|
|
42
|
+
for (const dir of ctx.appDirs) {
|
|
43
|
+
const role = ctx.manifest?.apps[dir]?.role;
|
|
44
|
+
if (role === "mobile")
|
|
45
|
+
continue;
|
|
46
|
+
const file = role === "web" ? "admin" : dir;
|
|
47
|
+
checks.push({
|
|
48
|
+
label: `lwd manifest for ${dir}`,
|
|
49
|
+
status: (await has(`deploy/${file}.lwd.toml`)) ? "pass" : "warn",
|
|
50
|
+
hint: `run \`forge generate lwd\``,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Each installed primitive must have migration wiring.
|
|
54
|
+
const installed = Object.entries(ctx.manifest?.platform ?? {}).filter(([, v]) => v).map(([k]) => k);
|
|
55
|
+
for (const cap of installed) {
|
|
56
|
+
checks.push({
|
|
57
|
+
label: `${cap}: migration wiring`,
|
|
58
|
+
status: (await has(`scripts/migrations.d/${cap}.ts`)) ? "pass" : "fail",
|
|
59
|
+
hint: `primitive installed but scripts/migrations.d/${cap}.ts missing`,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// Worker-bearing primitives need a worker app.
|
|
63
|
+
const needsWorker = installed.some((c) => WORKER_PRIMITIVES.includes(c));
|
|
64
|
+
if (needsWorker) {
|
|
65
|
+
checks.push({
|
|
66
|
+
label: "worker app for event/job/audit consumers",
|
|
67
|
+
status: ctx.hasWorker() ? "pass" : "fail",
|
|
68
|
+
hint: "run `forge add worker`",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
// Report.
|
|
72
|
+
logger_1.log.plain("");
|
|
73
|
+
let fails = 0;
|
|
74
|
+
for (const c of checks) {
|
|
75
|
+
if (c.status === "pass")
|
|
76
|
+
logger_1.log.success(c.label);
|
|
77
|
+
else if (c.status === "warn")
|
|
78
|
+
logger_1.log.warn(c.label + (c.hint ? ` — ${c.hint}` : ""));
|
|
79
|
+
else {
|
|
80
|
+
fails++;
|
|
81
|
+
logger_1.log.error(c.label + (c.hint ? ` — ${c.hint}` : ""));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
logger_1.log.plain("");
|
|
85
|
+
logger_1.log.dim("Note: generated projects assume @obh/* platform packages are installable (published to your npm registry).");
|
|
86
|
+
if (fails > 0) {
|
|
87
|
+
logger_1.log.error(`${fails} check(s) failed.`);
|
|
88
|
+
process.exitCode = 1;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
logger_1.log.success("All conventions satisfied.");
|
|
92
|
+
}
|
|
93
|
+
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AC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;aAC3E,CAAC;YACJ,KAAK,EAAE,CAAA;YACP,YAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;IAED,YAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACb,YAAG,CAAC,GAAG,CAAC,4GAA4G,CAAC,CAAA;IACrH,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,YAAG,CAAC,KAAK,CAAC,GAAG,KAAK,mBAAmB,CAAC,CAAA;QACtC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;IACtB,CAAC;SAAM,CAAC;QACN,YAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAA;IAC3C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AASA,sEAAsE;AACtE,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BpG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateCommand = generateCommand;
|
|
4
|
+
const plan_1 = require("../project/plan");
|
|
5
|
+
const context_1 = require("../project/context");
|
|
6
|
+
const lwd_1 = require("../generators/lwd");
|
|
7
|
+
const root_1 = require("../generators/root");
|
|
8
|
+
const logger_1 = require("../utils/logger");
|
|
9
|
+
const shared_1 = require("./shared");
|
|
10
|
+
const ARTIFACTS = ["lwd", "ci", "env"];
|
|
11
|
+
/** `forge generate <artifact>` — (re)generate a specific artifact. */
|
|
12
|
+
async function generateCommand(artifact, opts) {
|
|
13
|
+
const ctx = await context_1.ProjectContext.load(process.cwd());
|
|
14
|
+
if (!ctx.hasManifest()) {
|
|
15
|
+
logger_1.log.error("No forge.json found. Run inside a Forge project.");
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const manifest = ctx.requireManifest();
|
|
20
|
+
const flags = (0, shared_1.flagsFrom)(opts);
|
|
21
|
+
const plan = new plan_1.Plan();
|
|
22
|
+
switch (artifact) {
|
|
23
|
+
case "lwd":
|
|
24
|
+
(0, lwd_1.addLwdManifests)(plan, manifest);
|
|
25
|
+
logger_1.log.info("Regenerating lwd manifests (use --force to overwrite existing ones).");
|
|
26
|
+
break;
|
|
27
|
+
case "ci":
|
|
28
|
+
plan.overwrite(".github/workflows/ci.yml", (0, root_1.ciYaml)(manifest.name), "CI workflow");
|
|
29
|
+
break;
|
|
30
|
+
case "env":
|
|
31
|
+
// Only ensures the base file exists; capabilities own their own env keys.
|
|
32
|
+
plan.create(".env.example", (0, root_1.envBase)(manifest.name), "environment example (base)");
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
logger_1.log.error(`Unknown artifact "${artifact}". Available: ${ARTIFACTS.join(", ")}`);
|
|
36
|
+
process.exitCode = 1;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
await (0, shared_1.runPlan)(ctx.root, plan, flags);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":";;AAUA,0CA8BC;AAxCD,0CAAsC;AACtC,gDAAmD;AACnD,2CAAmD;AACnD,6CAAoD;AACpD,4CAAqC;AACrC,qCAA6C;AAE7C,MAAM,SAAS,GAAG,C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AI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;AACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":"AAKA,2EAA2E;AAC3E,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAoDpD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.inspectCommand = inspectCommand;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const context_1 = require("../project/context");
|
|
9
|
+
const fs_1 = require("../utils/fs");
|
|
10
|
+
const logger_1 = require("../utils/logger");
|
|
11
|
+
/** `forge inspect` — report the project shape and detected conventions. */
|
|
12
|
+
async function inspectCommand() {
|
|
13
|
+
const ctx = await context_1.ProjectContext.load(process.cwd());
|
|
14
|
+
logger_1.log.plain("");
|
|
15
|
+
logger_1.log.info(`Project root: ${ctx.root}`);
|
|
16
|
+
if (!ctx.hasManifest()) {
|
|
17
|
+
logger_1.log.warn("No forge.json — this project was not created by Forge (or predates it).");
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const m = ctx.requireManifest();
|
|
21
|
+
logger_1.log.plain(` name: ${m.name}`);
|
|
22
|
+
logger_1.log.plain(` forge: v${m.forgeVersion}`);
|
|
23
|
+
logger_1.log.plain(` deploy: ${m.deploy.target} (${m.deploy.topology} topology)`);
|
|
24
|
+
}
|
|
25
|
+
logger_1.log.plain("");
|
|
26
|
+
logger_1.log.info("Apps:");
|
|
27
|
+
if (ctx.appDirs.length === 0)
|
|
28
|
+
logger_1.log.dim(" (none)");
|
|
29
|
+
for (const dir of ctx.appDirs) {
|
|
30
|
+
const rec = ctx.manifest?.apps[dir];
|
|
31
|
+
const meta = rec ? `${rec.role}${rec.framework ? " / " + rec.framework : ""}` : "unrecorded";
|
|
32
|
+
logger_1.log.plain(` apps/${dir} (${meta})`);
|
|
33
|
+
}
|
|
34
|
+
logger_1.log.plain("");
|
|
35
|
+
logger_1.log.info("Packages:");
|
|
36
|
+
if (ctx.packageDirs.length === 0)
|
|
37
|
+
logger_1.log.dim(" (none)");
|
|
38
|
+
for (const dir of ctx.packageDirs)
|
|
39
|
+
logger_1.log.plain(` packages/${dir}`);
|
|
40
|
+
logger_1.log.plain("");
|
|
41
|
+
logger_1.log.info("Platform primitives:");
|
|
42
|
+
const installed = Object.entries(ctx.manifest?.platform ?? {}).filter(([, v]) => v);
|
|
43
|
+
if (installed.length === 0)
|
|
44
|
+
logger_1.log.dim(" (none installed)");
|
|
45
|
+
for (const [name] of installed) {
|
|
46
|
+
const wired = await (0, fs_1.exists)(node_path_1.default.join(ctx.root, `scripts/migrations.d/${name}.ts`));
|
|
47
|
+
logger_1.log.plain(` ${name}${wired ? "" : " (migration wiring MISSING)"}`);
|
|
48
|
+
}
|
|
49
|
+
logger_1.log.plain("");
|
|
50
|
+
logger_1.log.info("Deployment manifests:");
|
|
51
|
+
const deployFiles = ["api", "admin", "worker", "db"];
|
|
52
|
+
let anyDeploy = false;
|
|
53
|
+
for (const f of deployFiles) {
|
|
54
|
+
if (await (0, fs_1.exists)(node_path_1.default.join(ctx.root, `deploy/${f}.lwd.toml`))) {
|
|
55
|
+
logger_1.log.plain(` deploy/${f}.lwd.toml`);
|
|
56
|
+
anyDeploy = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!anyDeploy)
|
|
60
|
+
logger_1.log.dim(" (none — run `forge generate lwd`)");
|
|
61
|
+
logger_1.log.plain("");
|
|
62
|
+
logger_1.log.info("Run `forge doctor` to check conventions.");
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=inspect.js.map
|
|
@@ -0,0 +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EAAE,CAAC,CAAC,CAAC,8BAA8B,EAAE,CAAC,CAAA;IACtE,CAAC;IAED,YAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACb,YAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;IACjC,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;IACpD,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,IAAI,MAAM,IAAA,WAAM,EAAC,mBAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;YAC9D,YAAG,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;YACnC,SAAS,GAAG,IAAI,CAAA;QAClB,CAAC;IACH,CAAC;IACD,IAAI,CAAC,SAAS;QAAE,YAAG,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;IAE9D,YAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACb,YAAG,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAA;AACtD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface NewOptions {
|
|
2
|
+
recipe?: string;
|
|
3
|
+
scope?: string;
|
|
4
|
+
topology?: string;
|
|
5
|
+
apiFramework?: string;
|
|
6
|
+
example?: boolean;
|
|
7
|
+
sdk?: boolean;
|
|
8
|
+
mobile?: string | boolean;
|
|
9
|
+
daemon?: boolean;
|
|
10
|
+
repo?: string;
|
|
11
|
+
yes?: boolean;
|
|
12
|
+
dryRun?: boolean;
|
|
13
|
+
force?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** `forge new <app|package> [name]` — scaffold a new project directory. */
|
|
16
|
+
export declare function newCommand(kind: string, name: string | undefined, opts: NewOptions): Promise<void>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=new.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../src/commands/new.ts"],"names":[],"mappings":"AAeA,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACzB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,2EAA2E;AAC3E,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA2DxG"}
|