@pattern-stack/codegen 0.7.2 → 0.7.3
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/CHANGELOG.md +47 -0
- package/dist/src/cli/index.js +731 -568
- package/dist/src/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/src/cli/index.js
CHANGED
|
@@ -1047,8 +1047,8 @@ var icons = {
|
|
|
1047
1047
|
};
|
|
1048
1048
|
|
|
1049
1049
|
// src/cli/commands/entity.ts
|
|
1050
|
-
import
|
|
1051
|
-
import
|
|
1050
|
+
import fs9 from "fs";
|
|
1051
|
+
import path13 from "path";
|
|
1052
1052
|
import { Command as Command2, Option as Option2 } from "clipanion";
|
|
1053
1053
|
|
|
1054
1054
|
// src/utils/yaml-loader.ts
|
|
@@ -2917,8 +2917,8 @@ function loadEntityFromYaml(filePath) {
|
|
|
2917
2917
|
}
|
|
2918
2918
|
function formatZodErrors(error) {
|
|
2919
2919
|
return error.errors.map((err) => {
|
|
2920
|
-
const
|
|
2921
|
-
const location =
|
|
2920
|
+
const path31 = err.path.join(".");
|
|
2921
|
+
const location = path31 ? `at '${path31}'` : "at root";
|
|
2922
2922
|
return `${err.message} ${location}`;
|
|
2923
2923
|
});
|
|
2924
2924
|
}
|
|
@@ -3516,19 +3516,19 @@ function findCircularDependencies(graph) {
|
|
|
3516
3516
|
const cycles = [];
|
|
3517
3517
|
const visited = /* @__PURE__ */ new Set();
|
|
3518
3518
|
const recursionStack = /* @__PURE__ */ new Set();
|
|
3519
|
-
function dfs(node,
|
|
3519
|
+
function dfs(node, path31) {
|
|
3520
3520
|
visited.add(node);
|
|
3521
3521
|
recursionStack.add(node);
|
|
3522
3522
|
const outgoingEdges = graph.edges.filter((e) => e.from === node);
|
|
3523
3523
|
for (const edge of outgoingEdges) {
|
|
3524
3524
|
if (!visited.has(edge.to)) {
|
|
3525
|
-
dfs(edge.to, [...
|
|
3525
|
+
dfs(edge.to, [...path31, edge.to]);
|
|
3526
3526
|
} else if (recursionStack.has(edge.to)) {
|
|
3527
|
-
const cycleStart =
|
|
3527
|
+
const cycleStart = path31.indexOf(edge.to);
|
|
3528
3528
|
if (cycleStart !== -1) {
|
|
3529
|
-
cycles.push([...
|
|
3529
|
+
cycles.push([...path31.slice(cycleStart), edge.to]);
|
|
3530
3530
|
} else {
|
|
3531
|
-
cycles.push([...
|
|
3531
|
+
cycles.push([...path31, edge.to]);
|
|
3532
3532
|
}
|
|
3533
3533
|
}
|
|
3534
3534
|
}
|
|
@@ -4125,8 +4125,8 @@ function suggestTransitiveRelationships(graph, options) {
|
|
|
4125
4125
|
for (const [entityName, entity] of graph.entities) {
|
|
4126
4126
|
if (shouldExcludeEntity(entityName, opts)) continue;
|
|
4127
4127
|
const paths = findTransitivePaths(graph, entityName, opts);
|
|
4128
|
-
for (const
|
|
4129
|
-
suggestions.push(createSuggestion(
|
|
4128
|
+
for (const path31 of paths) {
|
|
4129
|
+
suggestions.push(createSuggestion(path31));
|
|
4130
4130
|
}
|
|
4131
4131
|
}
|
|
4132
4132
|
return suggestions;
|
|
@@ -4157,7 +4157,7 @@ function findTransitivePaths(graph, sourceEntity, opts) {
|
|
|
4157
4157
|
while (queue.length > 0) {
|
|
4158
4158
|
const current = queue.shift();
|
|
4159
4159
|
if (!current) continue;
|
|
4160
|
-
const { entity, depth, path:
|
|
4160
|
+
const { entity, depth, path: path31, visited } = current;
|
|
4161
4161
|
if (depth >= opts.maxDepth) continue;
|
|
4162
4162
|
const currentEntity = graph.entities.get(entity);
|
|
4163
4163
|
if (!currentEntity) continue;
|
|
@@ -4168,7 +4168,7 @@ function findTransitivePaths(graph, sourceEntity, opts) {
|
|
|
4168
4168
|
if (shouldExcludeEntity(target, opts)) continue;
|
|
4169
4169
|
if (visited.has(target)) continue;
|
|
4170
4170
|
const newPath = [
|
|
4171
|
-
...
|
|
4171
|
+
...path31,
|
|
4172
4172
|
{
|
|
4173
4173
|
via: entity,
|
|
4174
4174
|
relationship: relName,
|
|
@@ -4236,15 +4236,15 @@ function generateYamlSnippet(name, target, throughPath) {
|
|
|
4236
4236
|
target: ${target}
|
|
4237
4237
|
through: "${throughPath}"`;
|
|
4238
4238
|
}
|
|
4239
|
-
function createSuggestion(
|
|
4240
|
-
const pathDescription = [
|
|
4239
|
+
function createSuggestion(path31) {
|
|
4240
|
+
const pathDescription = [path31.source, ...path31.hops.map((h) => h.via), path31.target].join(" -> ");
|
|
4241
4241
|
return {
|
|
4242
4242
|
severity: "info",
|
|
4243
4243
|
type: "transitive_suggestion",
|
|
4244
|
-
entity:
|
|
4244
|
+
entity: path31.source,
|
|
4245
4245
|
message: `Potential transitive relationship: ${pathDescription}`,
|
|
4246
|
-
suggestion: `Add "${
|
|
4247
|
-
path:
|
|
4246
|
+
suggestion: `Add "${path31.suggestedName}" relationship via "${path31.throughPath}"`,
|
|
4247
|
+
path: path31
|
|
4248
4248
|
};
|
|
4249
4249
|
}
|
|
4250
4250
|
|
|
@@ -5875,11 +5875,357 @@ async function generateScopeEntityType(opts) {
|
|
|
5875
5875
|
return { outputPath, scopeableNames, written, content };
|
|
5876
5876
|
}
|
|
5877
5877
|
|
|
5878
|
-
// src/cli/shared/
|
|
5878
|
+
// src/cli/shared/subsystem-barrel-generator.ts
|
|
5879
|
+
import fs5 from "fs";
|
|
5880
|
+
import path8 from "path";
|
|
5881
|
+
|
|
5882
|
+
// src/cli/shared/subsystem-detect.ts
|
|
5879
5883
|
import fs4 from "fs";
|
|
5880
5884
|
import path6 from "path";
|
|
5885
|
+
var SUBSYSTEMS = [
|
|
5886
|
+
{
|
|
5887
|
+
name: "events",
|
|
5888
|
+
description: "Domain event bus (transactional outbox)",
|
|
5889
|
+
backends: ["drizzle", "memory"],
|
|
5890
|
+
defaultBackend: "drizzle"
|
|
5891
|
+
},
|
|
5892
|
+
{
|
|
5893
|
+
name: "jobs",
|
|
5894
|
+
description: "Background job queue",
|
|
5895
|
+
backends: ["drizzle", "memory"],
|
|
5896
|
+
defaultBackend: "drizzle"
|
|
5897
|
+
},
|
|
5898
|
+
{
|
|
5899
|
+
name: "cache",
|
|
5900
|
+
description: "Key-value cache with TTL",
|
|
5901
|
+
backends: ["drizzle", "memory"],
|
|
5902
|
+
defaultBackend: "drizzle"
|
|
5903
|
+
},
|
|
5904
|
+
{
|
|
5905
|
+
name: "storage",
|
|
5906
|
+
description: "File/object storage",
|
|
5907
|
+
backends: ["local", "memory"],
|
|
5908
|
+
defaultBackend: "local"
|
|
5909
|
+
},
|
|
5910
|
+
{
|
|
5911
|
+
name: "sync",
|
|
5912
|
+
description: "External-system sync engine (IChangeSource<T> + orchestrator + audit log)",
|
|
5913
|
+
backends: ["drizzle", "memory"],
|
|
5914
|
+
defaultBackend: "drizzle"
|
|
5915
|
+
},
|
|
5916
|
+
{
|
|
5917
|
+
name: "bridge",
|
|
5918
|
+
description: "Event-to-job bridge (durable async fanout via @JobHandler.triggers)",
|
|
5919
|
+
backends: ["drizzle", "memory"],
|
|
5920
|
+
defaultBackend: "drizzle"
|
|
5921
|
+
},
|
|
5922
|
+
{
|
|
5923
|
+
// OPENAPI-4. "Config-only" pseudo-subsystem — the runtime helpers
|
|
5924
|
+
// (OpenApiRegistry, ErrorResponseDto) are already vendored by
|
|
5925
|
+
// `codegen project init`. Installing this subsystem just injects the
|
|
5926
|
+
// `openapi:` block into codegen.config.yaml.
|
|
5927
|
+
name: "openapi-config",
|
|
5928
|
+
description: "OpenAPI/Swagger config block (registry is vendored at init)",
|
|
5929
|
+
backends: ["config-only"],
|
|
5930
|
+
defaultBackend: "config-only"
|
|
5931
|
+
},
|
|
5932
|
+
{
|
|
5933
|
+
// OBS-7 / ADR-025. Combiner subsystem — no schema, no worker, no
|
|
5934
|
+
// generated/ dir. `ObservabilityModule` composes sibling read ports
|
|
5935
|
+
// (events/jobs/bridge/sync) via @Optional() DI. The `combiner`
|
|
5936
|
+
// pseudo-backend is parallel to `openapi-config`'s `config-only`.
|
|
5937
|
+
name: "observability",
|
|
5938
|
+
description: "Observability combiner \u2014 composes sibling read ports via @Optional() DI (ADR-025)",
|
|
5939
|
+
backends: ["combiner"],
|
|
5940
|
+
defaultBackend: "combiner"
|
|
5941
|
+
},
|
|
5942
|
+
{
|
|
5943
|
+
// #287. Auth subsystem (PR #289) — AuthModule + ports + OAuth state
|
|
5944
|
+
// store + AuthController. Backends: drizzle (prod, persists OAuth
|
|
5945
|
+
// state in `auth_oauth_state`) or memory (dev/tests). Detection in
|
|
5946
|
+
// `detectInstalledSubsystems` is a special case: auth's protocols
|
|
5947
|
+
// live under `protocols/`, not at the subsystem root, so we look
|
|
5948
|
+
// for `auth.module.ts` instead of `*.protocol.ts`.
|
|
5949
|
+
name: "auth",
|
|
5950
|
+
description: "OAuth integration auth (AuthModule + ports + state store)",
|
|
5951
|
+
backends: ["drizzle", "memory"],
|
|
5952
|
+
defaultBackend: "drizzle"
|
|
5953
|
+
},
|
|
5954
|
+
{
|
|
5955
|
+
// #287. Auth-integrations starter (PR #290) — vendored from
|
|
5956
|
+
// `examples/auth-integrations/`, NOT from `runtime/subsystems/`.
|
|
5957
|
+
// Bundles a canonical `integration` entity yaml + the three
|
|
5958
|
+
// integration-store-port adapters + the `IntegrationsService`
|
|
5959
|
+
// facade. Single-backend (drizzle); the runtime adapters call
|
|
5960
|
+
// directly into the codegen-emitted `IntegrationService` from the
|
|
5961
|
+
// entity layer. Detection: presence of
|
|
5962
|
+
// `<sharedRoot>/integrations/integrations-auth.module.ts`.
|
|
5963
|
+
name: "auth-integrations",
|
|
5964
|
+
description: "Vendored integrations entity + adapters (consumes auth subsystem)",
|
|
5965
|
+
backends: ["drizzle"],
|
|
5966
|
+
defaultBackend: "drizzle"
|
|
5967
|
+
}
|
|
5968
|
+
];
|
|
5969
|
+
var KNOWN_NAMES = SUBSYSTEMS.map((s) => s.name);
|
|
5970
|
+
function candidateRoots(cwd, configured) {
|
|
5971
|
+
const roots = [
|
|
5972
|
+
...configured ? [path6.resolve(cwd, configured)] : [],
|
|
5973
|
+
path6.resolve(cwd, "src/shared/subsystems"),
|
|
5974
|
+
path6.resolve(cwd, "src/subsystems"),
|
|
5975
|
+
path6.resolve(cwd, "shared/subsystems")
|
|
5976
|
+
];
|
|
5977
|
+
return Array.from(new Set(roots));
|
|
5978
|
+
}
|
|
5979
|
+
function inferBackend(dir, name) {
|
|
5980
|
+
if (name === "observability") return "combiner";
|
|
5981
|
+
if (name === "auth") return "drizzle";
|
|
5982
|
+
if (name === "auth-integrations") return "drizzle";
|
|
5983
|
+
const hasDrizzle = fs4.existsSync(path6.join(dir, `${name.replace(/s$/, "")}-bus.drizzle-backend.ts`)) || fs4.readdirSync(dir).some((f) => f.endsWith(".drizzle-backend.ts"));
|
|
5984
|
+
const hasMemory = fs4.readdirSync(dir).some((f) => f.endsWith(".memory-backend.ts"));
|
|
5985
|
+
const hasLocal = fs4.readdirSync(dir).some((f) => f.includes("local"));
|
|
5986
|
+
if (hasDrizzle && hasMemory) return "drizzle";
|
|
5987
|
+
if (hasDrizzle) return "drizzle";
|
|
5988
|
+
if (hasLocal) return "local";
|
|
5989
|
+
if (hasMemory) return "memory";
|
|
5990
|
+
return "unknown";
|
|
5991
|
+
}
|
|
5992
|
+
async function detectInstalledSubsystems(ctx) {
|
|
5993
|
+
const configured = ctx.config?.paths?.subsystems;
|
|
5994
|
+
const roots = candidateRoots(ctx.cwd, configured);
|
|
5995
|
+
const found = [];
|
|
5996
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5997
|
+
for (const root of roots) {
|
|
5998
|
+
if (!fs4.existsSync(root)) continue;
|
|
5999
|
+
for (const name of KNOWN_NAMES) {
|
|
6000
|
+
if (seen.has(name)) continue;
|
|
6001
|
+
if (name === "openapi-config") continue;
|
|
6002
|
+
if (name === "auth-integrations") continue;
|
|
6003
|
+
const dir = path6.join(root, name);
|
|
6004
|
+
if (!fs4.existsSync(dir) || !fs4.statSync(dir).isDirectory()) continue;
|
|
6005
|
+
const files = fs4.readdirSync(dir);
|
|
6006
|
+
let hasProtocol = files.some((f) => f.endsWith(".protocol.ts"));
|
|
6007
|
+
if (name === "auth") {
|
|
6008
|
+
hasProtocol = files.includes("auth.module.ts");
|
|
6009
|
+
}
|
|
6010
|
+
if (!hasProtocol) continue;
|
|
6011
|
+
seen.add(name);
|
|
6012
|
+
found.push({
|
|
6013
|
+
name,
|
|
6014
|
+
path: dir,
|
|
6015
|
+
backend: inferBackend(dir, name)
|
|
6016
|
+
});
|
|
6017
|
+
}
|
|
6018
|
+
}
|
|
6019
|
+
if (!seen.has("openapi-config")) {
|
|
6020
|
+
const configPath = path6.resolve(
|
|
6021
|
+
ctx.cwd,
|
|
6022
|
+
ctx.config ? "codegen.config.yaml" : "codegen.config.yaml"
|
|
6023
|
+
);
|
|
6024
|
+
if (fs4.existsSync(configPath)) {
|
|
6025
|
+
try {
|
|
6026
|
+
const source = fs4.readFileSync(configPath, "utf-8");
|
|
6027
|
+
if (/^openapi\s*:/m.test(source)) {
|
|
6028
|
+
found.push({
|
|
6029
|
+
name: "openapi-config",
|
|
6030
|
+
path: configPath,
|
|
6031
|
+
backend: "config-only"
|
|
6032
|
+
});
|
|
6033
|
+
}
|
|
6034
|
+
} catch {
|
|
6035
|
+
}
|
|
6036
|
+
}
|
|
6037
|
+
}
|
|
6038
|
+
if (!seen.has("auth-integrations")) {
|
|
6039
|
+
const backendSrc = ctx.config?.paths?.backend_src ?? "src";
|
|
6040
|
+
const pathsAny = ctx.config?.paths;
|
|
6041
|
+
const modulesConfigured = pathsAny?.modules_dir;
|
|
6042
|
+
const vendorRoot = typeof modulesConfigured === "string" && modulesConfigured.length > 0 ? path6.resolve(ctx.cwd, modulesConfigured) : path6.resolve(ctx.cwd, backendSrc, "modules");
|
|
6043
|
+
const sharedConfigured = pathsAny?.shared;
|
|
6044
|
+
const sharedRoot = typeof sharedConfigured === "string" && sharedConfigured.length > 0 ? path6.resolve(ctx.cwd, sharedConfigured) : path6.resolve(ctx.cwd, backendSrc, "shared");
|
|
6045
|
+
const candidates = [
|
|
6046
|
+
path6.join(vendorRoot, "integrations", "integrations-auth.module.ts"),
|
|
6047
|
+
path6.join(sharedRoot, "integrations", "integrations-auth.module.ts")
|
|
6048
|
+
];
|
|
6049
|
+
for (const moduleFile of candidates) {
|
|
6050
|
+
if (fs4.existsSync(moduleFile)) {
|
|
6051
|
+
found.push({
|
|
6052
|
+
name: "auth-integrations",
|
|
6053
|
+
path: path6.dirname(moduleFile),
|
|
6054
|
+
backend: "drizzle"
|
|
6055
|
+
});
|
|
6056
|
+
break;
|
|
6057
|
+
}
|
|
6058
|
+
}
|
|
6059
|
+
}
|
|
6060
|
+
return found;
|
|
6061
|
+
}
|
|
6062
|
+
|
|
6063
|
+
// src/cli/shared/subsystems-path.ts
|
|
6064
|
+
import path7 from "path";
|
|
6065
|
+
var FALLBACK_BACKEND_SRC = "src";
|
|
6066
|
+
function resolveSubsystemsRootFromConfig(cwd, config) {
|
|
6067
|
+
const configured = config?.paths?.subsystems;
|
|
6068
|
+
if (typeof configured === "string" && configured.length > 0) {
|
|
6069
|
+
return path7.resolve(cwd, configured);
|
|
6070
|
+
}
|
|
6071
|
+
const backendSrc = config?.paths?.backend_src;
|
|
6072
|
+
const base = typeof backendSrc === "string" && backendSrc.length > 0 ? backendSrc : FALLBACK_BACKEND_SRC;
|
|
6073
|
+
return path7.resolve(cwd, base, "shared", "subsystems");
|
|
6074
|
+
}
|
|
6075
|
+
function resolveSubsystemsRoot(ctx, overrideTarget) {
|
|
6076
|
+
if (overrideTarget) return path7.resolve(ctx.cwd, overrideTarget);
|
|
6077
|
+
return resolveSubsystemsRootFromConfig(ctx.cwd, ctx.config);
|
|
6078
|
+
}
|
|
6079
|
+
|
|
6080
|
+
// src/cli/shared/subsystem-barrel-generator.ts
|
|
6081
|
+
function quoteOpts(opts) {
|
|
6082
|
+
const entries = Object.entries(opts).filter(([, v]) => v !== void 0);
|
|
6083
|
+
if (entries.length === 0) return "";
|
|
6084
|
+
return "{ " + entries.map(([k, v]) => `${k}: ${typeof v === "string" ? `'${v}'` : String(v)}`).join(", ") + " }";
|
|
6085
|
+
}
|
|
6086
|
+
var COMPOSERS = {
|
|
6087
|
+
events: ({ subsystemsRel, cfg }) => {
|
|
6088
|
+
const backend = cfg?.backend ?? "drizzle";
|
|
6089
|
+
const multiTenant = Boolean(cfg?.multi_tenant);
|
|
6090
|
+
return {
|
|
6091
|
+
imports: [
|
|
6092
|
+
`import { EventsModule } from '${subsystemsRel}/events/events.module';`
|
|
6093
|
+
],
|
|
6094
|
+
calls: [
|
|
6095
|
+
` EventsModule.forRoot(${quoteOpts({ backend, multiTenant })}),`
|
|
6096
|
+
]
|
|
6097
|
+
};
|
|
6098
|
+
},
|
|
6099
|
+
jobs: ({ subsystemsRel, cfg }) => {
|
|
6100
|
+
const backend = cfg?.backend ?? "drizzle";
|
|
6101
|
+
const multiTenant = Boolean(cfg?.multi_tenant);
|
|
6102
|
+
const workerMode = (cfg?.worker_mode ?? "standalone").trim();
|
|
6103
|
+
const imports = [
|
|
6104
|
+
`import { JobsDomainModule } from '${subsystemsRel}/jobs/jobs-domain.module';`
|
|
6105
|
+
];
|
|
6106
|
+
const calls = [
|
|
6107
|
+
` JobsDomainModule.forRoot(${quoteOpts({ backend, multiTenant })}),`
|
|
6108
|
+
];
|
|
6109
|
+
if (workerMode === "embedded") {
|
|
6110
|
+
imports.push(
|
|
6111
|
+
`import { JobWorkerModule } from '${subsystemsRel}/jobs/job-worker.module';`
|
|
6112
|
+
);
|
|
6113
|
+
calls.push(` JobWorkerModule.forRoot({ mode: 'embedded' }),`);
|
|
6114
|
+
}
|
|
6115
|
+
return { imports, calls };
|
|
6116
|
+
},
|
|
6117
|
+
bridge: ({ subsystemsRel, cfg }) => {
|
|
6118
|
+
const backend = cfg?.backend ?? "drizzle";
|
|
6119
|
+
const multiTenant = Boolean(cfg?.multi_tenant);
|
|
6120
|
+
return {
|
|
6121
|
+
imports: [
|
|
6122
|
+
`import { BridgeModule } from '${subsystemsRel}/bridge/bridge.module';`
|
|
6123
|
+
],
|
|
6124
|
+
calls: [
|
|
6125
|
+
` BridgeModule.forRoot(${quoteOpts({ backend, multiTenant })}),`
|
|
6126
|
+
]
|
|
6127
|
+
};
|
|
6128
|
+
},
|
|
6129
|
+
sync: ({ subsystemsRel, cfg }) => {
|
|
6130
|
+
const backend = cfg?.backend ?? "drizzle";
|
|
6131
|
+
const multiTenant = Boolean(cfg?.multi_tenant);
|
|
6132
|
+
return {
|
|
6133
|
+
imports: [
|
|
6134
|
+
`import { SyncModule } from '${subsystemsRel}/sync/sync.module';`
|
|
6135
|
+
],
|
|
6136
|
+
calls: [
|
|
6137
|
+
` SyncModule.forRoot(${quoteOpts({ backend, multiTenant })}),`
|
|
6138
|
+
]
|
|
6139
|
+
};
|
|
6140
|
+
}
|
|
6141
|
+
};
|
|
6142
|
+
var COMPOSABLE_ORDER = ["events", "jobs", "bridge", "sync"];
|
|
6143
|
+
var HEADER3 = `// AUTO-GENERATED by @pattern-stack/codegen. DO NOT EDIT.
|
|
6144
|
+
// Subsystem composition barrel \u2014 reflects \`subsystems.install\` in
|
|
6145
|
+
// codegen.config.yaml and the per-subsystem option blocks
|
|
6146
|
+
// (\`events:\`, \`jobs:\`, \`bridge:\`, \`sync:\`).
|
|
6147
|
+
//
|
|
6148
|
+
// Wire into AppModule once:
|
|
6149
|
+
//
|
|
6150
|
+
// import { SUBSYSTEM_MODULES } from './generated/subsystems';
|
|
6151
|
+
// @Module({ imports: [DatabaseModule, ...SUBSYSTEM_MODULES, ...GENERATED_MODULES] })
|
|
6152
|
+
//
|
|
6153
|
+
// Regenerated by every \`codegen entity new\` / \`codegen subsystem install\`.
|
|
6154
|
+
|
|
6155
|
+
`;
|
|
6156
|
+
function buildSubsystemBarrel(installed, config, subsystemsRel) {
|
|
6157
|
+
const installedNames = new Set(installed.map((i) => i.name));
|
|
6158
|
+
const emitted = [];
|
|
6159
|
+
const skipped = [];
|
|
6160
|
+
const allImports = [`import type { DynamicModule } from '@nestjs/common';`];
|
|
6161
|
+
const allCalls = [];
|
|
6162
|
+
for (const name of COMPOSABLE_ORDER) {
|
|
6163
|
+
if (!installedNames.has(name)) continue;
|
|
6164
|
+
const composer = COMPOSERS[name];
|
|
6165
|
+
if (!composer) {
|
|
6166
|
+
skipped.push(name);
|
|
6167
|
+
continue;
|
|
6168
|
+
}
|
|
6169
|
+
const cfg = config?.[name] ?? void 0;
|
|
6170
|
+
const out = composer({ subsystemsRel, cfg });
|
|
6171
|
+
allImports.push(...out.imports);
|
|
6172
|
+
allCalls.push(...out.calls);
|
|
6173
|
+
emitted.push(name);
|
|
6174
|
+
}
|
|
6175
|
+
for (const inst of installed) {
|
|
6176
|
+
if (!COMPOSABLE_ORDER.includes(inst.name) && !COMPOSERS[inst.name]) {
|
|
6177
|
+
skipped.push(inst.name);
|
|
6178
|
+
}
|
|
6179
|
+
}
|
|
6180
|
+
if (allCalls.length === 0) {
|
|
6181
|
+
return {
|
|
6182
|
+
content: HEADER3 + `export const SUBSYSTEM_MODULES: DynamicModule[] = [];
|
|
6183
|
+
`,
|
|
6184
|
+
emitted,
|
|
6185
|
+
skipped
|
|
6186
|
+
};
|
|
6187
|
+
}
|
|
6188
|
+
const body = allImports.join("\n") + `
|
|
6189
|
+
|
|
6190
|
+
export const SUBSYSTEM_MODULES: DynamicModule[] = [
|
|
6191
|
+
${allCalls.join("\n")}
|
|
6192
|
+
];
|
|
6193
|
+
`;
|
|
6194
|
+
return { content: HEADER3 + body, emitted, skipped };
|
|
6195
|
+
}
|
|
6196
|
+
async function regenerateSubsystemBarrel(opts) {
|
|
6197
|
+
const { ctx, dryRun = false } = opts;
|
|
6198
|
+
const generatedDir = opts.generatedDir ?? resolveGeneratedDir(ctx);
|
|
6199
|
+
const installed = await detectInstalledSubsystems(ctx);
|
|
6200
|
+
const subsystemsAbs = resolveSubsystemsRoot(ctx);
|
|
6201
|
+
const barrelAbs = path8.resolve(generatedDir, "subsystems.ts");
|
|
6202
|
+
let subsystemsRel = path8.relative(path8.dirname(barrelAbs), subsystemsAbs).split(path8.sep).join("/");
|
|
6203
|
+
if (!subsystemsRel.startsWith(".")) subsystemsRel = "./" + subsystemsRel;
|
|
6204
|
+
const { content, emitted, skipped } = buildSubsystemBarrel(
|
|
6205
|
+
installed,
|
|
6206
|
+
ctx.config,
|
|
6207
|
+
subsystemsRel
|
|
6208
|
+
);
|
|
6209
|
+
let written = false;
|
|
6210
|
+
if (!dryRun) {
|
|
6211
|
+
fs5.mkdirSync(path8.dirname(barrelAbs), { recursive: true });
|
|
6212
|
+
fs5.writeFileSync(barrelAbs, content);
|
|
6213
|
+
written = true;
|
|
6214
|
+
}
|
|
6215
|
+
return {
|
|
6216
|
+
subsystemBarrel: barrelAbs,
|
|
6217
|
+
emitted,
|
|
6218
|
+
skipped,
|
|
6219
|
+
content,
|
|
6220
|
+
written
|
|
6221
|
+
};
|
|
6222
|
+
}
|
|
6223
|
+
|
|
6224
|
+
// src/cli/shared/bridge-registry-generator.ts
|
|
6225
|
+
import fs6 from "fs";
|
|
6226
|
+
import path9 from "path";
|
|
5881
6227
|
import ts from "typescript";
|
|
5882
|
-
var
|
|
6228
|
+
var HEADER4 = `// AUTO-GENERATED by @pattern-stack/codegen. Do not edit.
|
|
5883
6229
|
// Run \`codegen entity new --all\` to refresh.
|
|
5884
6230
|
`;
|
|
5885
6231
|
var DuplicateTriggerError = class extends Error {
|
|
@@ -5937,12 +6283,12 @@ var UnknownTriggerEventError = class extends Error {
|
|
|
5937
6283
|
name = "UnknownTriggerEventError";
|
|
5938
6284
|
};
|
|
5939
6285
|
function findHandlerFiles(dir) {
|
|
5940
|
-
if (!
|
|
6286
|
+
if (!fs6.existsSync(dir)) return [];
|
|
5941
6287
|
const out = [];
|
|
5942
|
-
for (const entry of
|
|
6288
|
+
for (const entry of fs6.readdirSync(dir, { withFileTypes: true })) {
|
|
5943
6289
|
if (entry.name.startsWith(".")) continue;
|
|
5944
6290
|
if (entry.name === "node_modules" || entry.name === "generated") continue;
|
|
5945
|
-
const full =
|
|
6291
|
+
const full = path9.join(dir, entry.name);
|
|
5946
6292
|
if (entry.isDirectory()) {
|
|
5947
6293
|
out.push(...findHandlerFiles(full));
|
|
5948
6294
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -6005,7 +6351,7 @@ function scanHandlerFiles(handlersDir) {
|
|
|
6005
6351
|
const files = findHandlerFiles(handlersDir);
|
|
6006
6352
|
const out = [];
|
|
6007
6353
|
for (const filePath of files) {
|
|
6008
|
-
const text2 =
|
|
6354
|
+
const text2 = fs6.readFileSync(filePath, "utf8");
|
|
6009
6355
|
const sourceFile = ts.createSourceFile(
|
|
6010
6356
|
filePath,
|
|
6011
6357
|
text2,
|
|
@@ -6020,9 +6366,9 @@ function scanHandlerFiles(handlersDir) {
|
|
|
6020
6366
|
}
|
|
6021
6367
|
function readKnownEventTypes(eventsGeneratedDir) {
|
|
6022
6368
|
if (!eventsGeneratedDir) return [];
|
|
6023
|
-
const registryPath =
|
|
6024
|
-
if (!
|
|
6025
|
-
const text2 =
|
|
6369
|
+
const registryPath = path9.join(eventsGeneratedDir, "registry.ts");
|
|
6370
|
+
if (!fs6.existsSync(registryPath)) return [];
|
|
6371
|
+
const text2 = fs6.readFileSync(registryPath, "utf8");
|
|
6026
6372
|
const out = /* @__PURE__ */ new Set();
|
|
6027
6373
|
const re = /^\s*'([a-zA-Z0-9_.-]+)':\s*\{/gm;
|
|
6028
6374
|
let m;
|
|
@@ -6034,9 +6380,9 @@ function readKnownEventTypes(eventsGeneratedDir) {
|
|
|
6034
6380
|
function readEventTiers(eventsGeneratedDir) {
|
|
6035
6381
|
const out = /* @__PURE__ */ new Map();
|
|
6036
6382
|
if (!eventsGeneratedDir) return out;
|
|
6037
|
-
const registryPath =
|
|
6038
|
-
if (!
|
|
6039
|
-
const text2 =
|
|
6383
|
+
const registryPath = path9.join(eventsGeneratedDir, "registry.ts");
|
|
6384
|
+
if (!fs6.existsSync(registryPath)) return out;
|
|
6385
|
+
const text2 = fs6.readFileSync(registryPath, "utf8");
|
|
6040
6386
|
const re = /'([a-zA-Z0-9_.-]+)':\s*\{[^}]*?tier:\s*'(domain|audit)'/g;
|
|
6041
6387
|
let m;
|
|
6042
6388
|
while ((m = re.exec(text2)) !== null) {
|
|
@@ -6093,7 +6439,7 @@ function validateAgainstEventRegistry(triggers, knownEventTypes) {
|
|
|
6093
6439
|
}
|
|
6094
6440
|
function buildBridgeRegistryContent(triggers) {
|
|
6095
6441
|
const chunks = [];
|
|
6096
|
-
chunks.push(
|
|
6442
|
+
chunks.push(HEADER4);
|
|
6097
6443
|
chunks.push("");
|
|
6098
6444
|
chunks.push(`import type { BridgeRegistry } from '../bridge.protocol';`);
|
|
6099
6445
|
chunks.push("");
|
|
@@ -6131,11 +6477,11 @@ function buildBridgeRegistryContent(triggers) {
|
|
|
6131
6477
|
var OUTPUT_FILE_NAME = "registry.ts";
|
|
6132
6478
|
async function generateBridgeRegistry(opts) {
|
|
6133
6479
|
const { handlersDir, eventsGeneratedDir, outputDir, dryRun = false } = opts;
|
|
6134
|
-
const bridgeProtocolPath =
|
|
6135
|
-
if (!
|
|
6136
|
-
const strayPath =
|
|
6137
|
-
if (!dryRun &&
|
|
6138
|
-
|
|
6480
|
+
const bridgeProtocolPath = path9.resolve(outputDir, "..", "bridge.protocol.ts");
|
|
6481
|
+
if (!fs6.existsSync(bridgeProtocolPath)) {
|
|
6482
|
+
const strayPath = path9.join(outputDir, OUTPUT_FILE_NAME);
|
|
6483
|
+
if (!dryRun && fs6.existsSync(strayPath)) {
|
|
6484
|
+
fs6.rmSync(strayPath);
|
|
6139
6485
|
}
|
|
6140
6486
|
return {
|
|
6141
6487
|
outputDir,
|
|
@@ -6156,13 +6502,13 @@ async function generateBridgeRegistry(opts) {
|
|
|
6156
6502
|
const content = buildBridgeRegistryContent(triggers);
|
|
6157
6503
|
const file = {
|
|
6158
6504
|
name: OUTPUT_FILE_NAME,
|
|
6159
|
-
outputPath:
|
|
6505
|
+
outputPath: path9.join(outputDir, OUTPUT_FILE_NAME),
|
|
6160
6506
|
content
|
|
6161
6507
|
};
|
|
6162
6508
|
let written = false;
|
|
6163
6509
|
if (!dryRun) {
|
|
6164
|
-
|
|
6165
|
-
|
|
6510
|
+
fs6.mkdirSync(outputDir, { recursive: true });
|
|
6511
|
+
fs6.writeFileSync(file.outputPath, file.content);
|
|
6166
6512
|
written = true;
|
|
6167
6513
|
}
|
|
6168
6514
|
const eventTypeCount = new Set(triggers.map((t) => t.event)).size;
|
|
@@ -6178,8 +6524,8 @@ async function generateBridgeRegistry(opts) {
|
|
|
6178
6524
|
}
|
|
6179
6525
|
|
|
6180
6526
|
// src/cli/shared/orchestration-generator.ts
|
|
6181
|
-
import
|
|
6182
|
-
import
|
|
6527
|
+
import fs7 from "fs";
|
|
6528
|
+
import path10 from "path";
|
|
6183
6529
|
var OrchestrationEmissionError = class extends Error {
|
|
6184
6530
|
constructor(issueType, patternName, message) {
|
|
6185
6531
|
super(`[${issueType}] ${patternName}: ${message}`);
|
|
@@ -6190,7 +6536,7 @@ var OrchestrationEmissionError = class extends Error {
|
|
|
6190
6536
|
patternName;
|
|
6191
6537
|
name = "OrchestrationEmissionError";
|
|
6192
6538
|
};
|
|
6193
|
-
var
|
|
6539
|
+
var HEADER5 = `// AUTO-GENERATED by @pattern-stack/codegen. Do not edit.
|
|
6194
6540
|
// See ADR-032 \u2014 Orchestration Patterns.
|
|
6195
6541
|
`;
|
|
6196
6542
|
function splitWords(str) {
|
|
@@ -6354,7 +6700,7 @@ function buildTokensTs(pattern) {
|
|
|
6354
6700
|
typeImports.push({ specifier: reg.valueTypeImport, name: reg.valueType });
|
|
6355
6701
|
}
|
|
6356
6702
|
const lines = [];
|
|
6357
|
-
lines.push(
|
|
6703
|
+
lines.push(HEADER5.trimEnd());
|
|
6358
6704
|
lines.push("");
|
|
6359
6705
|
for (const i of emitTypeImports(typeImports)) lines.push(i);
|
|
6360
6706
|
lines.push("");
|
|
@@ -6387,7 +6733,7 @@ function buildProvidersTs(pattern) {
|
|
|
6387
6733
|
}
|
|
6388
6734
|
const optsType = forRootOptionsTypeName(pattern);
|
|
6389
6735
|
const lines = [];
|
|
6390
|
-
lines.push(
|
|
6736
|
+
lines.push(HEADER5.trimEnd());
|
|
6391
6737
|
lines.push("");
|
|
6392
6738
|
lines.push(`import type { Provider } from '@nestjs/common';`);
|
|
6393
6739
|
for (const i of emitTypeImports(typeImports)) lines.push(i);
|
|
@@ -6454,7 +6800,7 @@ function buildDispatcherTs(pattern) {
|
|
|
6454
6800
|
const tokenValues = registries.map(({ names }) => names.tokenConst);
|
|
6455
6801
|
const mapTypes = registries.map(({ names }) => names.mapType);
|
|
6456
6802
|
const lines = [];
|
|
6457
|
-
lines.push(
|
|
6803
|
+
lines.push(HEADER5.trimEnd());
|
|
6458
6804
|
lines.push("");
|
|
6459
6805
|
lines.push(`import { Inject, Injectable } from '@nestjs/common';`);
|
|
6460
6806
|
for (const i of emitTypeImports(typeImports)) lines.push(i);
|
|
@@ -6528,7 +6874,7 @@ function buildModuleTs(pattern) {
|
|
|
6528
6874
|
}
|
|
6529
6875
|
const tokenValues = registries.map(({ names }) => names.tokenConst);
|
|
6530
6876
|
const lines = [];
|
|
6531
|
-
lines.push(
|
|
6877
|
+
lines.push(HEADER5.trimEnd());
|
|
6532
6878
|
lines.push("");
|
|
6533
6879
|
lines.push(`import { type DynamicModule, Module } from '@nestjs/common';`);
|
|
6534
6880
|
for (const i of emitTypeImports(typeImports)) lines.push(i);
|
|
@@ -6562,7 +6908,7 @@ function buildModuleTs(pattern) {
|
|
|
6562
6908
|
}
|
|
6563
6909
|
function buildIndexTs(pattern) {
|
|
6564
6910
|
const lines = [];
|
|
6565
|
-
lines.push(
|
|
6911
|
+
lines.push(HEADER5.trimEnd());
|
|
6566
6912
|
lines.push("");
|
|
6567
6913
|
lines.push(`export * from './tokens.js';`);
|
|
6568
6914
|
lines.push(`export * from './dispatcher.js';`);
|
|
@@ -6573,7 +6919,7 @@ function buildIndexTs(pattern) {
|
|
|
6573
6919
|
}
|
|
6574
6920
|
function buildRootBarrelTs(patterns) {
|
|
6575
6921
|
const lines = [];
|
|
6576
|
-
lines.push(
|
|
6922
|
+
lines.push(HEADER5.trimEnd());
|
|
6577
6923
|
lines.push("");
|
|
6578
6924
|
if (patterns.length === 0) {
|
|
6579
6925
|
lines.push("// No orchestration patterns registered.");
|
|
@@ -6591,11 +6937,11 @@ function buildRootBarrelTs(patterns) {
|
|
|
6591
6937
|
function buildPatternFiles(pattern, outputRoot) {
|
|
6592
6938
|
assertEmittable(pattern);
|
|
6593
6939
|
const slug = toKebabCase2(pattern.name);
|
|
6594
|
-
const outputDir =
|
|
6940
|
+
const outputDir = path10.join(outputRoot, slug);
|
|
6595
6941
|
const make = (name, content) => ({
|
|
6596
6942
|
name,
|
|
6597
|
-
outputPath:
|
|
6598
|
-
relativePath:
|
|
6943
|
+
outputPath: path10.join(outputDir, name),
|
|
6944
|
+
relativePath: path10.join(slug, name),
|
|
6599
6945
|
content
|
|
6600
6946
|
});
|
|
6601
6947
|
const files = [
|
|
@@ -6623,21 +6969,21 @@ function generateOrchestrationModules(opts) {
|
|
|
6623
6969
|
}
|
|
6624
6970
|
const rootBarrel = {
|
|
6625
6971
|
name: "index.ts",
|
|
6626
|
-
outputPath:
|
|
6972
|
+
outputPath: path10.join(outputRoot, "index.ts"),
|
|
6627
6973
|
relativePath: "index.ts",
|
|
6628
6974
|
content: buildRootBarrelTs(patterns)
|
|
6629
6975
|
};
|
|
6630
6976
|
allFiles.push(rootBarrel);
|
|
6631
6977
|
let written = false;
|
|
6632
6978
|
if (!dryRun && patterns.length > 0) {
|
|
6633
|
-
|
|
6979
|
+
fs7.mkdirSync(outputRoot, { recursive: true });
|
|
6634
6980
|
for (const r of perPattern) {
|
|
6635
|
-
|
|
6981
|
+
fs7.mkdirSync(r.outputDir, { recursive: true });
|
|
6636
6982
|
for (const f of r.files) {
|
|
6637
|
-
|
|
6983
|
+
fs7.writeFileSync(f.outputPath, f.content);
|
|
6638
6984
|
}
|
|
6639
6985
|
}
|
|
6640
|
-
|
|
6986
|
+
fs7.writeFileSync(rootBarrel.outputPath, rootBarrel.content);
|
|
6641
6987
|
written = true;
|
|
6642
6988
|
}
|
|
6643
6989
|
return {
|
|
@@ -6649,8 +6995,8 @@ function generateOrchestrationModules(opts) {
|
|
|
6649
6995
|
}
|
|
6650
6996
|
|
|
6651
6997
|
// src/cli/shared/event-codegen-generator.ts
|
|
6652
|
-
import
|
|
6653
|
-
import
|
|
6998
|
+
import fs8 from "fs";
|
|
6999
|
+
import path11 from "path";
|
|
6654
7000
|
|
|
6655
7001
|
// src/parser/load-events.ts
|
|
6656
7002
|
import { readdirSync as readdirSync7 } from "fs";
|
|
@@ -6781,7 +7127,7 @@ function isEventFieldType(s) {
|
|
|
6781
7127
|
}
|
|
6782
7128
|
|
|
6783
7129
|
// src/cli/shared/event-codegen-generator.ts
|
|
6784
|
-
var
|
|
7130
|
+
var HEADER6 = `// AUTO-GENERATED by @pattern-stack/codegen. Do not edit.
|
|
6785
7131
|
// Run \`codegen entity new --all\` to refresh.
|
|
6786
7132
|
`;
|
|
6787
7133
|
function toCamelCase2(input) {
|
|
@@ -6835,10 +7181,10 @@ function aggregateTypeLiteral(ev) {
|
|
|
6835
7181
|
function collectEntityEvents(entitiesDir) {
|
|
6836
7182
|
const events = [];
|
|
6837
7183
|
const issues = [];
|
|
6838
|
-
if (!
|
|
7184
|
+
if (!fs8.existsSync(entitiesDir)) {
|
|
6839
7185
|
return { events, issues };
|
|
6840
7186
|
}
|
|
6841
|
-
const files =
|
|
7187
|
+
const files = fs8.readdirSync(entitiesDir).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml")).map((f) => path11.join(entitiesDir, f)).sort();
|
|
6842
7188
|
for (const filePath of files) {
|
|
6843
7189
|
const result = loadEntityFromYaml(filePath);
|
|
6844
7190
|
if (!result.success) continue;
|
|
@@ -6879,8 +7225,8 @@ function mergeEvents(topLevel, entitySugar) {
|
|
|
6879
7225
|
function collectMergedEvents(opts) {
|
|
6880
7226
|
const { entitiesDir, eventsDir } = opts;
|
|
6881
7227
|
const entityNames = [];
|
|
6882
|
-
if (
|
|
6883
|
-
const entityFiles =
|
|
7228
|
+
if (fs8.existsSync(entitiesDir)) {
|
|
7229
|
+
const entityFiles = fs8.readdirSync(entitiesDir).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml")).map((f) => path11.join(entitiesDir, f)).sort();
|
|
6884
7230
|
for (const f of entityFiles) {
|
|
6885
7231
|
const result = loadEntityFromYaml(f);
|
|
6886
7232
|
if (result.success) entityNames.push(result.definition.entity.name);
|
|
@@ -6902,7 +7248,7 @@ function collectMergedEvents(opts) {
|
|
|
6902
7248
|
function buildTypesContent(events) {
|
|
6903
7249
|
const sorted = [...events].sort((a, b) => a.type.localeCompare(b.type));
|
|
6904
7250
|
if (sorted.length === 0) {
|
|
6905
|
-
return
|
|
7251
|
+
return HEADER6 + `
|
|
6906
7252
|
import type { DomainEvent } from '../event-bus.protocol';
|
|
6907
7253
|
|
|
6908
7254
|
export type AppDomainEvent = never;
|
|
@@ -6913,7 +7259,7 @@ export type PayloadOfType<T extends EventTypeName> = never;
|
|
|
6913
7259
|
`;
|
|
6914
7260
|
}
|
|
6915
7261
|
const chunks = [];
|
|
6916
|
-
chunks.push(
|
|
7262
|
+
chunks.push(HEADER6);
|
|
6917
7263
|
chunks.push("");
|
|
6918
7264
|
chunks.push(`import type { DomainEvent } from '../event-bus.protocol';`);
|
|
6919
7265
|
chunks.push("");
|
|
@@ -6961,7 +7307,7 @@ export type PayloadOfType<T extends EventTypeName> = never;
|
|
|
6961
7307
|
function buildSchemasContent(events) {
|
|
6962
7308
|
const sorted = [...events].sort((a, b) => a.type.localeCompare(b.type));
|
|
6963
7309
|
if (sorted.length === 0) {
|
|
6964
|
-
return
|
|
7310
|
+
return HEADER6 + `
|
|
6965
7311
|
import { z } from 'zod';
|
|
6966
7312
|
import type { EventTypeName } from './types';
|
|
6967
7313
|
|
|
@@ -6969,7 +7315,7 @@ export const eventPayloadSchemas = {} as Record<EventTypeName, z.ZodType>;
|
|
|
6969
7315
|
`;
|
|
6970
7316
|
}
|
|
6971
7317
|
const chunks = [];
|
|
6972
|
-
chunks.push(
|
|
7318
|
+
chunks.push(HEADER6);
|
|
6973
7319
|
chunks.push("");
|
|
6974
7320
|
chunks.push(`import { z } from 'zod';`);
|
|
6975
7321
|
chunks.push(`import type { EventTypeName } from './types';`);
|
|
@@ -7024,7 +7370,7 @@ var REGISTRY_GETTER = [
|
|
|
7024
7370
|
function buildRegistryContent(events) {
|
|
7025
7371
|
const sorted = [...events].sort((a, b) => a.type.localeCompare(b.type));
|
|
7026
7372
|
const chunks = [];
|
|
7027
|
-
chunks.push(
|
|
7373
|
+
chunks.push(HEADER6);
|
|
7028
7374
|
chunks.push("");
|
|
7029
7375
|
chunks.push(`import type { EventTypeName } from './types';`);
|
|
7030
7376
|
chunks.push("");
|
|
@@ -7204,10 +7550,10 @@ export class TypedEventBus {
|
|
|
7204
7550
|
}
|
|
7205
7551
|
`;
|
|
7206
7552
|
function buildBusContent(_events) {
|
|
7207
|
-
return
|
|
7553
|
+
return HEADER6 + "\n" + BUS_BODY;
|
|
7208
7554
|
}
|
|
7209
7555
|
function buildIndexContent(_events) {
|
|
7210
|
-
return
|
|
7556
|
+
return HEADER6 + `
|
|
7211
7557
|
export * from './types';
|
|
7212
7558
|
export * from './schemas';
|
|
7213
7559
|
export * from './registry';
|
|
@@ -7236,15 +7582,15 @@ async function generateEventCodegen(opts) {
|
|
|
7236
7582
|
};
|
|
7237
7583
|
const files = OUTPUT_FILE_NAMES.map((name) => ({
|
|
7238
7584
|
name,
|
|
7239
|
-
outputPath:
|
|
7585
|
+
outputPath: path11.join(outputDir, name),
|
|
7240
7586
|
content: builders[name](merged)
|
|
7241
7587
|
}));
|
|
7242
7588
|
const hasError = issues.some((i) => i.severity === "error");
|
|
7243
7589
|
let written = false;
|
|
7244
7590
|
if (!dryRun && !hasError) {
|
|
7245
|
-
|
|
7591
|
+
fs8.mkdirSync(outputDir, { recursive: true });
|
|
7246
7592
|
for (const file of files) {
|
|
7247
|
-
|
|
7593
|
+
fs8.writeFileSync(file.outputPath, file.content);
|
|
7248
7594
|
}
|
|
7249
7595
|
written = true;
|
|
7250
7596
|
}
|
|
@@ -7326,32 +7672,15 @@ function validateEntityEmits(entities, events) {
|
|
|
7326
7672
|
return issues;
|
|
7327
7673
|
}
|
|
7328
7674
|
|
|
7329
|
-
// src/cli/shared/subsystems-path.ts
|
|
7330
|
-
import path9 from "path";
|
|
7331
|
-
var FALLBACK_BACKEND_SRC = "src";
|
|
7332
|
-
function resolveSubsystemsRootFromConfig(cwd, config) {
|
|
7333
|
-
const configured = config?.paths?.subsystems;
|
|
7334
|
-
if (typeof configured === "string" && configured.length > 0) {
|
|
7335
|
-
return path9.resolve(cwd, configured);
|
|
7336
|
-
}
|
|
7337
|
-
const backendSrc = config?.paths?.backend_src;
|
|
7338
|
-
const base = typeof backendSrc === "string" && backendSrc.length > 0 ? backendSrc : FALLBACK_BACKEND_SRC;
|
|
7339
|
-
return path9.resolve(cwd, base, "shared", "subsystems");
|
|
7340
|
-
}
|
|
7341
|
-
function resolveSubsystemsRoot(ctx, overrideTarget) {
|
|
7342
|
-
if (overrideTarget) return path9.resolve(ctx.cwd, overrideTarget);
|
|
7343
|
-
return resolveSubsystemsRootFromConfig(ctx.cwd, ctx.config);
|
|
7344
|
-
}
|
|
7345
|
-
|
|
7346
7675
|
// src/cli/shared/events-path.ts
|
|
7347
|
-
import
|
|
7676
|
+
import path12 from "path";
|
|
7348
7677
|
var FALLBACK = "events";
|
|
7349
7678
|
function resolveEventsDirFromConfig(cwd, config) {
|
|
7350
7679
|
const configured = config?.paths?.events_dir;
|
|
7351
7680
|
if (typeof configured === "string" && configured.length > 0) {
|
|
7352
|
-
return
|
|
7681
|
+
return path12.resolve(cwd, configured);
|
|
7353
7682
|
}
|
|
7354
|
-
return
|
|
7683
|
+
return path12.resolve(cwd, FALLBACK);
|
|
7355
7684
|
}
|
|
7356
7685
|
function resolveEventsDir(ctx) {
|
|
7357
7686
|
return resolveEventsDirFromConfig(ctx.cwd, ctx.config);
|
|
@@ -7379,8 +7708,8 @@ function printInfo(msg) {
|
|
|
7379
7708
|
|
|
7380
7709
|
// src/cli/commands/entity.ts
|
|
7381
7710
|
function listEntityYamls2(dir) {
|
|
7382
|
-
if (!
|
|
7383
|
-
return
|
|
7711
|
+
if (!fs9.existsSync(dir)) return [];
|
|
7712
|
+
return fs9.readdirSync(dir).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml")).map((f) => path13.join(dir, f));
|
|
7384
7713
|
}
|
|
7385
7714
|
function summarizePatternLabel(entity) {
|
|
7386
7715
|
if (typeof entity.pattern === "string" && entity.pattern.length > 0) {
|
|
@@ -7490,14 +7819,14 @@ var EntityNewCommand = class extends Command2 {
|
|
|
7490
7819
|
}
|
|
7491
7820
|
let targets = [];
|
|
7492
7821
|
if (this.all) {
|
|
7493
|
-
const dir = ctx.entitiesDir ??
|
|
7822
|
+
const dir = ctx.entitiesDir ?? path13.resolve(ctx.cwd, "entities");
|
|
7494
7823
|
targets = listEntityYamls2(dir);
|
|
7495
7824
|
if (targets.length === 0) {
|
|
7496
7825
|
printError(`No entity YAML files found in ${dir}`);
|
|
7497
7826
|
return 1;
|
|
7498
7827
|
}
|
|
7499
7828
|
} else if (this.yaml) {
|
|
7500
|
-
targets = [
|
|
7829
|
+
targets = [path13.resolve(ctx.cwd, this.yaml)];
|
|
7501
7830
|
} else {
|
|
7502
7831
|
printError("Missing YAML path. Pass a file or --all.");
|
|
7503
7832
|
return 2;
|
|
@@ -7514,13 +7843,13 @@ var EntityNewCommand = class extends Command2 {
|
|
|
7514
7843
|
}
|
|
7515
7844
|
if (invalid.length > 0 && !this.continueOnError) {
|
|
7516
7845
|
for (const i of invalid) {
|
|
7517
|
-
printError(`${
|
|
7846
|
+
printError(`${path13.basename(i.file)} \u2014 ${i.message}`);
|
|
7518
7847
|
}
|
|
7519
7848
|
if (!isJsonMode()) {
|
|
7520
7849
|
return 1;
|
|
7521
7850
|
}
|
|
7522
7851
|
}
|
|
7523
|
-
const entitiesDirForEmits = ctx.entitiesDir ??
|
|
7852
|
+
const entitiesDirForEmits = ctx.entitiesDir ?? path13.resolve(ctx.cwd, "entities");
|
|
7524
7853
|
const eventsDirForEmits = resolveEventsDir(ctx);
|
|
7525
7854
|
const allEntitiesForEmits = loadEntities(entitiesDirForEmits).entities;
|
|
7526
7855
|
const validatedNames = new Set(validated.map((v) => v.name));
|
|
@@ -7567,34 +7896,34 @@ var EntityNewCommand = class extends Command2 {
|
|
|
7567
7896
|
if (!isJsonMode()) return 1;
|
|
7568
7897
|
}
|
|
7569
7898
|
}
|
|
7570
|
-
const entitiesDir = ctx.entitiesDir ??
|
|
7571
|
-
const relationshipsDir =
|
|
7899
|
+
const entitiesDir = ctx.entitiesDir ?? path13.resolve(ctx.cwd, "entities");
|
|
7900
|
+
const relationshipsDir = path13.resolve(ctx.cwd, "relationships");
|
|
7572
7901
|
const generatedDir = resolveGeneratedDir(ctx);
|
|
7573
7902
|
const architecture = resolveArchitecture(ctx);
|
|
7574
7903
|
const subsystemsRoot = resolveSubsystemsRoot(ctx);
|
|
7575
|
-
const scopeEntityTypePath =
|
|
7904
|
+
const scopeEntityTypePath = path13.resolve(
|
|
7576
7905
|
subsystemsRoot,
|
|
7577
7906
|
"jobs/generated/scope-entity-type.ts"
|
|
7578
7907
|
);
|
|
7579
7908
|
const eventsDir = resolveEventsDir(ctx);
|
|
7580
|
-
const eventCodegenOutputDir =
|
|
7909
|
+
const eventCodegenOutputDir = path13.resolve(
|
|
7581
7910
|
subsystemsRoot,
|
|
7582
7911
|
"events/generated"
|
|
7583
7912
|
);
|
|
7584
|
-
const bridgeRegistryOutputDir =
|
|
7913
|
+
const bridgeRegistryOutputDir = path13.resolve(
|
|
7585
7914
|
subsystemsRoot,
|
|
7586
7915
|
"bridge/generated"
|
|
7587
7916
|
);
|
|
7588
7917
|
const backendSrcForHandlers = ctx.config?.paths?.backend_src ?? "src";
|
|
7589
|
-
const bridgeHandlersDir =
|
|
7918
|
+
const bridgeHandlersDir = path13.resolve(
|
|
7590
7919
|
ctx.cwd,
|
|
7591
7920
|
backendSrcForHandlers,
|
|
7592
7921
|
"jobs"
|
|
7593
7922
|
);
|
|
7594
7923
|
const orchestrationConfigured = ctx.config?.paths?.orchestration_src;
|
|
7595
|
-
const orchestrationOutputRoot =
|
|
7924
|
+
const orchestrationOutputRoot = path13.resolve(
|
|
7596
7925
|
ctx.cwd,
|
|
7597
|
-
typeof orchestrationConfigured === "string" && orchestrationConfigured.length > 0 ? orchestrationConfigured :
|
|
7926
|
+
typeof orchestrationConfigured === "string" && orchestrationConfigured.length > 0 ? orchestrationConfigured : path13.join(backendSrcForHandlers, "orchestration")
|
|
7598
7927
|
);
|
|
7599
7928
|
const orchestrationGlobs = (() => {
|
|
7600
7929
|
const fromCfg = ctx.config?.patterns;
|
|
@@ -7722,7 +8051,7 @@ var EntityNewCommand = class extends Command2 {
|
|
|
7722
8051
|
}
|
|
7723
8052
|
if (invalid.length > 0) {
|
|
7724
8053
|
for (const i of invalid) {
|
|
7725
|
-
printWarning(`${
|
|
8054
|
+
printWarning(`${path13.basename(i.file)} \u2014 ${i.message}`);
|
|
7726
8055
|
}
|
|
7727
8056
|
}
|
|
7728
8057
|
console.log("");
|
|
@@ -7740,7 +8069,7 @@ var EntityNewCommand = class extends Command2 {
|
|
|
7740
8069
|
}
|
|
7741
8070
|
const succeeded = [];
|
|
7742
8071
|
const failed = [
|
|
7743
|
-
...invalid.map((i) => ({ name:
|
|
8072
|
+
...invalid.map((i) => ({ name: path13.basename(i.file), file: i.file, message: i.message }))
|
|
7744
8073
|
];
|
|
7745
8074
|
for (const v of validated) {
|
|
7746
8075
|
if (!isJsonMode()) {
|
|
@@ -7775,6 +8104,14 @@ var EntityNewCommand = class extends Command2 {
|
|
|
7775
8104
|
printWarning(`barrel regeneration failed \u2014 ${msg}`);
|
|
7776
8105
|
}
|
|
7777
8106
|
}
|
|
8107
|
+
try {
|
|
8108
|
+
await regenerateSubsystemBarrel({ ctx, generatedDir });
|
|
8109
|
+
} catch (err) {
|
|
8110
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
8111
|
+
if (!isJsonMode()) {
|
|
8112
|
+
printWarning(`subsystem barrel regeneration failed \u2014 ${msg}`);
|
|
8113
|
+
}
|
|
8114
|
+
}
|
|
7778
8115
|
let scopeResult = null;
|
|
7779
8116
|
try {
|
|
7780
8117
|
scopeResult = await generateScopeEntityType({
|
|
@@ -7914,22 +8251,22 @@ var EntityNewCommand = class extends Command2 {
|
|
|
7914
8251
|
}
|
|
7915
8252
|
if (barrelResult) {
|
|
7916
8253
|
printInfo(
|
|
7917
|
-
`barrels regenerated (${barrelResult.entityCount} entities) \u2192 ${
|
|
8254
|
+
`barrels regenerated (${barrelResult.entityCount} entities) \u2192 ${path13.relative(ctx.cwd, barrelResult.modulesBarrel)}, ${path13.relative(ctx.cwd, barrelResult.schemaBarrel)}`
|
|
7918
8255
|
);
|
|
7919
8256
|
}
|
|
7920
8257
|
if (scopeResult) {
|
|
7921
8258
|
printInfo(
|
|
7922
|
-
`scope-entity-type regenerated (${scopeResult.scopeableNames.length} scopeable) \u2192 ${
|
|
8259
|
+
`scope-entity-type regenerated (${scopeResult.scopeableNames.length} scopeable) \u2192 ${path13.relative(ctx.cwd, scopeResult.outputPath)}`
|
|
7923
8260
|
);
|
|
7924
8261
|
}
|
|
7925
8262
|
if (eventCodegenResult) {
|
|
7926
8263
|
printInfo(
|
|
7927
|
-
`event codegen regenerated (${eventCodegenResult.eventCount} events) \u2192 ${
|
|
8264
|
+
`event codegen regenerated (${eventCodegenResult.eventCount} events) \u2192 ${path13.relative(ctx.cwd, eventCodegenResult.outputDir)}`
|
|
7928
8265
|
);
|
|
7929
8266
|
}
|
|
7930
8267
|
if (orchestrationResult && orchestrationResult.patterns.length > 0) {
|
|
7931
8268
|
printInfo(
|
|
7932
|
-
`orchestration regenerated (${orchestrationResult.patterns.length} patterns, ${orchestrationResult.files.length} files) \u2192 ${
|
|
8269
|
+
`orchestration regenerated (${orchestrationResult.patterns.length} patterns, ${orchestrationResult.files.length} files) \u2192 ${path13.relative(ctx.cwd, orchestrationResult.outputRoot)}`
|
|
7933
8270
|
);
|
|
7934
8271
|
}
|
|
7935
8272
|
}
|
|
@@ -8015,8 +8352,8 @@ var EntityValidateCommand = class extends Command2 {
|
|
|
8015
8352
|
json: this.json,
|
|
8016
8353
|
skipDetection: true
|
|
8017
8354
|
});
|
|
8018
|
-
const targetDir = this.dir ?
|
|
8019
|
-
if (!
|
|
8355
|
+
const targetDir = this.dir ? path13.resolve(ctx.cwd, this.dir) : ctx.entitiesDir ?? path13.resolve(ctx.cwd, "entities");
|
|
8356
|
+
if (!fs9.existsSync(targetDir)) {
|
|
8020
8357
|
printError(`Directory not found: ${targetDir}`);
|
|
8021
8358
|
return 1;
|
|
8022
8359
|
}
|
|
@@ -8067,8 +8404,8 @@ var entityNoun = {
|
|
|
8067
8404
|
var entity_default = entityNoun;
|
|
8068
8405
|
|
|
8069
8406
|
// src/cli/commands/subsystem.ts
|
|
8070
|
-
import
|
|
8071
|
-
import
|
|
8407
|
+
import fs11 from "fs";
|
|
8408
|
+
import path22 from "path";
|
|
8072
8409
|
import { Command as Command3, Option as Option3 } from "clipanion";
|
|
8073
8410
|
|
|
8074
8411
|
// src/cli/shared/config-block-detect.ts
|
|
@@ -8101,26 +8438,26 @@ function stripConfigBlock(yamlSource, subsystem) {
|
|
|
8101
8438
|
}
|
|
8102
8439
|
|
|
8103
8440
|
// src/cli/shared/events-scaffold-locals.ts
|
|
8104
|
-
import
|
|
8441
|
+
import path14 from "path";
|
|
8105
8442
|
function resolveEventsScaffoldLocals(input) {
|
|
8106
8443
|
const { cwd, config } = input;
|
|
8107
8444
|
void input.fileExists;
|
|
8108
8445
|
const eventsBlock = config?.events ?? {};
|
|
8109
8446
|
const subsystemsRoot = resolveSubsystemsRootFromConfig(cwd, config);
|
|
8110
|
-
const configPath =
|
|
8111
|
-
const schemaPath =
|
|
8447
|
+
const configPath = path14.resolve(cwd, "codegen.config.yaml");
|
|
8448
|
+
const schemaPath = path14.resolve(
|
|
8112
8449
|
subsystemsRoot,
|
|
8113
8450
|
"events",
|
|
8114
8451
|
"domain-events.schema.ts"
|
|
8115
8452
|
);
|
|
8116
|
-
const generatedKeepPath =
|
|
8453
|
+
const generatedKeepPath = path14.resolve(
|
|
8117
8454
|
subsystemsRoot,
|
|
8118
8455
|
"events",
|
|
8119
8456
|
"generated",
|
|
8120
8457
|
".gitkeep"
|
|
8121
8458
|
);
|
|
8122
8459
|
return {
|
|
8123
|
-
appName:
|
|
8460
|
+
appName: path14.basename(cwd),
|
|
8124
8461
|
multiTenant: normaliseMultiTenant(eventsBlock.multi_tenant),
|
|
8125
8462
|
configPath,
|
|
8126
8463
|
schemaPath,
|
|
@@ -8146,7 +8483,7 @@ function localsToHygenArgs(locals) {
|
|
|
8146
8483
|
}
|
|
8147
8484
|
|
|
8148
8485
|
// src/cli/shared/jobs-scaffold-locals.ts
|
|
8149
|
-
import
|
|
8486
|
+
import path15 from "path";
|
|
8150
8487
|
var MAIN_HOOK_SENTINEL = "JOBS \u2014 Embedded worker mode (optional)";
|
|
8151
8488
|
function workerSkipValue(exists) {
|
|
8152
8489
|
return exists ? "true" : "";
|
|
@@ -8155,10 +8492,10 @@ function resolveJobsScaffoldLocals(input) {
|
|
|
8155
8492
|
const { cwd, config, fileExists, readFile } = input;
|
|
8156
8493
|
const jobsBlock = config?.jobs ?? {};
|
|
8157
8494
|
const subsystemsRoot = resolveSubsystemsRootFromConfig(cwd, config);
|
|
8158
|
-
const workerPath =
|
|
8159
|
-
const mainTsPath =
|
|
8160
|
-
const configPath =
|
|
8161
|
-
const schemaPath =
|
|
8495
|
+
const workerPath = path15.resolve(cwd, "worker.ts");
|
|
8496
|
+
const mainTsPath = path15.resolve(cwd, "src/main.ts");
|
|
8497
|
+
const configPath = path15.resolve(cwd, "codegen.config.yaml");
|
|
8498
|
+
const schemaPath = path15.resolve(
|
|
8162
8499
|
subsystemsRoot,
|
|
8163
8500
|
"jobs",
|
|
8164
8501
|
"job-orchestration.schema.ts"
|
|
@@ -8166,7 +8503,7 @@ function resolveJobsScaffoldLocals(input) {
|
|
|
8166
8503
|
const mainContent = readFile(mainTsPath);
|
|
8167
8504
|
const mainHookInjected = mainContent !== null && mainContent.includes(MAIN_HOOK_SENTINEL);
|
|
8168
8505
|
return {
|
|
8169
|
-
appName:
|
|
8506
|
+
appName: path15.basename(cwd),
|
|
8170
8507
|
workerMode: normaliseWorkerMode(jobsBlock.worker_mode),
|
|
8171
8508
|
multiTenant: normaliseMultiTenant2(jobsBlock.multi_tenant),
|
|
8172
8509
|
mainTsPath,
|
|
@@ -8208,20 +8545,20 @@ function localsToHygenArgs2(locals) {
|
|
|
8208
8545
|
}
|
|
8209
8546
|
|
|
8210
8547
|
// src/cli/shared/sync-scaffold-locals.ts
|
|
8211
|
-
import
|
|
8548
|
+
import path16 from "path";
|
|
8212
8549
|
function resolveSyncScaffoldLocals(input) {
|
|
8213
8550
|
const { cwd, config } = input;
|
|
8214
8551
|
void input.fileExists;
|
|
8215
8552
|
const syncBlock = config?.sync ?? {};
|
|
8216
8553
|
const subsystemsRoot = resolveSubsystemsRootFromConfig(cwd, config);
|
|
8217
|
-
const configPath =
|
|
8218
|
-
const schemaPath =
|
|
8554
|
+
const configPath = path16.resolve(cwd, "codegen.config.yaml");
|
|
8555
|
+
const schemaPath = path16.resolve(
|
|
8219
8556
|
subsystemsRoot,
|
|
8220
8557
|
"sync",
|
|
8221
8558
|
"sync-audit.schema.ts"
|
|
8222
8559
|
);
|
|
8223
8560
|
return {
|
|
8224
|
-
appName:
|
|
8561
|
+
appName: path16.basename(cwd),
|
|
8225
8562
|
multiTenant: normaliseMultiTenant3(syncBlock.multi_tenant),
|
|
8226
8563
|
configPath,
|
|
8227
8564
|
schemaPath
|
|
@@ -8244,21 +8581,21 @@ function localsToHygenArgs3(locals) {
|
|
|
8244
8581
|
}
|
|
8245
8582
|
|
|
8246
8583
|
// src/cli/shared/bridge-scaffold-locals.ts
|
|
8247
|
-
import
|
|
8584
|
+
import path17 from "path";
|
|
8248
8585
|
function resolveBridgeScaffoldLocals(input) {
|
|
8249
8586
|
const { cwd, config } = input;
|
|
8250
8587
|
void input.fileExists;
|
|
8251
8588
|
const bridgeBlock = config?.bridge ?? {};
|
|
8252
8589
|
const subsystemsRoot = resolveSubsystemsRootFromConfig(cwd, config);
|
|
8253
|
-
const configPath =
|
|
8254
|
-
const generatedKeepPath =
|
|
8590
|
+
const configPath = path17.resolve(cwd, "codegen.config.yaml");
|
|
8591
|
+
const generatedKeepPath = path17.resolve(
|
|
8255
8592
|
subsystemsRoot,
|
|
8256
8593
|
"bridge",
|
|
8257
8594
|
"generated",
|
|
8258
8595
|
".gitkeep"
|
|
8259
8596
|
);
|
|
8260
8597
|
return {
|
|
8261
|
-
appName:
|
|
8598
|
+
appName: path17.basename(cwd),
|
|
8262
8599
|
multiTenant: normaliseMultiTenant4(bridgeBlock.multi_tenant),
|
|
8263
8600
|
configPath,
|
|
8264
8601
|
generatedKeepPath
|
|
@@ -8281,19 +8618,19 @@ function localsToHygenArgs4(locals) {
|
|
|
8281
8618
|
}
|
|
8282
8619
|
|
|
8283
8620
|
// src/cli/shared/observability-scaffold-locals.ts
|
|
8284
|
-
import
|
|
8621
|
+
import path18 from "path";
|
|
8285
8622
|
var FALLBACK_BACKEND_SRC2 = "src";
|
|
8286
8623
|
function resolveObservabilityScaffoldLocals(input) {
|
|
8287
8624
|
const { cwd, config } = input;
|
|
8288
8625
|
void input.fileExists;
|
|
8289
8626
|
const backendSrc = typeof config?.paths?.backend_src === "string" && config.paths.backend_src.length > 0 ? config.paths.backend_src : FALLBACK_BACKEND_SRC2;
|
|
8290
|
-
const appModulePath =
|
|
8291
|
-
const configPath =
|
|
8627
|
+
const appModulePath = path18.resolve(cwd, backendSrc, "app.module.ts");
|
|
8628
|
+
const configPath = path18.resolve(cwd, "codegen.config.yaml");
|
|
8292
8629
|
const obsBlock = config?.observability ?? {};
|
|
8293
8630
|
const reporters = obsBlock.reporters ?? {};
|
|
8294
8631
|
const bridgeMetrics = reporters.bridgeMetrics ?? {};
|
|
8295
8632
|
return {
|
|
8296
|
-
appName:
|
|
8633
|
+
appName: path18.basename(cwd),
|
|
8297
8634
|
appModulePath,
|
|
8298
8635
|
configPath,
|
|
8299
8636
|
bridgeMetricsEnabled: bridgeMetrics.enabled === true
|
|
@@ -8314,7 +8651,7 @@ function localsToHygenArgs5(locals) {
|
|
|
8314
8651
|
|
|
8315
8652
|
// src/cli/shared/auth-scaffold-locals.ts
|
|
8316
8653
|
import crypto2 from "crypto";
|
|
8317
|
-
import
|
|
8654
|
+
import path19 from "path";
|
|
8318
8655
|
var FALLBACK_BACKEND_SRC3 = "src";
|
|
8319
8656
|
var DEFAULT_REDIRECT_URI_BASE = "http://localhost:3000";
|
|
8320
8657
|
function resolveAuthScaffoldLocals(input) {
|
|
@@ -8326,15 +8663,15 @@ function resolveAuthScaffoldLocals(input) {
|
|
|
8326
8663
|
const redirectUriBase = typeof redirectRaw === "string" && redirectRaw.length > 0 ? redirectRaw : DEFAULT_REDIRECT_URI_BASE;
|
|
8327
8664
|
const tokenEncryptionKey = crypto2.randomBytes(32).toString("base64");
|
|
8328
8665
|
return {
|
|
8329
|
-
appName:
|
|
8330
|
-
configPath:
|
|
8331
|
-
schemaPath:
|
|
8666
|
+
appName: path19.basename(cwd),
|
|
8667
|
+
configPath: path19.resolve(cwd, "codegen.config.yaml"),
|
|
8668
|
+
schemaPath: path19.resolve(
|
|
8332
8669
|
subsystemsRoot,
|
|
8333
8670
|
"auth",
|
|
8334
8671
|
"auth-oauth-state.schema.ts"
|
|
8335
8672
|
),
|
|
8336
|
-
appModulePath:
|
|
8337
|
-
envConfigPath:
|
|
8673
|
+
appModulePath: path19.resolve(cwd, backendSrc, "app.module.ts"),
|
|
8674
|
+
envConfigPath: path19.resolve(cwd, ".env.config"),
|
|
8338
8675
|
redirectUriBase,
|
|
8339
8676
|
tokenEncryptionKey
|
|
8340
8677
|
};
|
|
@@ -8359,7 +8696,7 @@ function localsToHygenArgs6(locals) {
|
|
|
8359
8696
|
}
|
|
8360
8697
|
|
|
8361
8698
|
// src/cli/shared/auth-integrations-scaffold-locals.ts
|
|
8362
|
-
import
|
|
8699
|
+
import path20 from "path";
|
|
8363
8700
|
var FALLBACK_BACKEND_SRC4 = "src";
|
|
8364
8701
|
var SHARED_DIR_NAME = "shared";
|
|
8365
8702
|
var DEFAULT_MODULES_DIR = "modules";
|
|
@@ -8369,19 +8706,19 @@ function resolveAuthIntegrationsScaffoldLocals(input) {
|
|
|
8369
8706
|
const backendSrc = typeof config?.paths?.backend_src === "string" && config.paths.backend_src.length > 0 ? config.paths.backend_src : FALLBACK_BACKEND_SRC4;
|
|
8370
8707
|
const pathsAny = config?.paths;
|
|
8371
8708
|
const sharedConfigured = pathsAny?.shared;
|
|
8372
|
-
const sharedRoot = typeof sharedConfigured === "string" && sharedConfigured.length > 0 ?
|
|
8709
|
+
const sharedRoot = typeof sharedConfigured === "string" && sharedConfigured.length > 0 ? path20.resolve(cwd, sharedConfigured) : path20.resolve(cwd, backendSrc, SHARED_DIR_NAME);
|
|
8373
8710
|
const modulesConfigured = pathsAny?.modules_dir;
|
|
8374
|
-
const vendorRoot = typeof modulesConfigured === "string" && modulesConfigured.length > 0 ?
|
|
8711
|
+
const vendorRoot = typeof modulesConfigured === "string" && modulesConfigured.length > 0 ? path20.resolve(cwd, modulesConfigured) : path20.resolve(cwd, backendSrc, DEFAULT_MODULES_DIR);
|
|
8375
8712
|
const entitiesConfigured = typeof pathsAny?.entities === "string" && pathsAny.entities.length > 0 ? pathsAny.entities : typeof pathsAny?.entities_dir === "string" && pathsAny.entities_dir.length > 0 ? pathsAny.entities_dir : null;
|
|
8376
|
-
const definitionsPath = entitiesConfigured !== null ?
|
|
8377
|
-
const appModulePath =
|
|
8713
|
+
const definitionsPath = entitiesConfigured !== null ? path20.resolve(cwd, entitiesConfigured, "integration.yaml") : path20.resolve(cwd, DEFAULT_DEFINITIONS_DIR, "integration.yaml");
|
|
8714
|
+
const appModulePath = path20.resolve(cwd, backendSrc, "app.module.ts");
|
|
8378
8715
|
let authModuleRegistered = false;
|
|
8379
8716
|
const appModuleSource = input.readFile(appModulePath);
|
|
8380
8717
|
if (appModuleSource && appModuleSource.includes("AuthModule.forRoot")) {
|
|
8381
8718
|
authModuleRegistered = true;
|
|
8382
8719
|
}
|
|
8383
8720
|
return {
|
|
8384
|
-
appName:
|
|
8721
|
+
appName: path20.basename(cwd),
|
|
8385
8722
|
appModulePath,
|
|
8386
8723
|
sharedRoot,
|
|
8387
8724
|
vendorRoot,
|
|
@@ -8399,11 +8736,11 @@ function localsToHygenArgs7(locals) {
|
|
|
8399
8736
|
}
|
|
8400
8737
|
|
|
8401
8738
|
// src/cli/shared/runtime-copier.ts
|
|
8402
|
-
import
|
|
8403
|
-
import
|
|
8739
|
+
import fs10 from "fs";
|
|
8740
|
+
import path21 from "path";
|
|
8404
8741
|
function readIfExists(p) {
|
|
8405
8742
|
try {
|
|
8406
|
-
return
|
|
8743
|
+
return fs10.readFileSync(p, "utf-8");
|
|
8407
8744
|
} catch {
|
|
8408
8745
|
return null;
|
|
8409
8746
|
}
|
|
@@ -8411,8 +8748,8 @@ function readIfExists(p) {
|
|
|
8411
8748
|
function writeFile(target, content) {
|
|
8412
8749
|
const existing = readIfExists(target);
|
|
8413
8750
|
if (existing === content) return "unchanged";
|
|
8414
|
-
|
|
8415
|
-
|
|
8751
|
+
fs10.mkdirSync(path21.dirname(target), { recursive: true });
|
|
8752
|
+
fs10.writeFileSync(target, content);
|
|
8416
8753
|
return existing === null ? "written" : "updated";
|
|
8417
8754
|
}
|
|
8418
8755
|
function extractRelativeImports(source) {
|
|
@@ -8425,20 +8762,20 @@ function extractRelativeImports(source) {
|
|
|
8425
8762
|
return out;
|
|
8426
8763
|
}
|
|
8427
8764
|
function resolveSourceImport(sourceFile, specifier) {
|
|
8428
|
-
const base =
|
|
8429
|
-
const candidates = [base + ".ts", base + ".tsx",
|
|
8765
|
+
const base = path21.resolve(path21.dirname(sourceFile), specifier);
|
|
8766
|
+
const candidates = [base + ".ts", base + ".tsx", path21.join(base, "index.ts")];
|
|
8430
8767
|
for (const c of candidates) {
|
|
8431
|
-
if (
|
|
8768
|
+
if (fs10.existsSync(c)) return c;
|
|
8432
8769
|
}
|
|
8433
8770
|
return null;
|
|
8434
8771
|
}
|
|
8435
8772
|
async function copyRuntime(opts) {
|
|
8436
8773
|
const { sourceDir, targetDir, filter, resolveDeps, dryRun } = opts;
|
|
8437
|
-
if (!
|
|
8774
|
+
if (!fs10.existsSync(sourceDir) || !fs10.statSync(sourceDir).isDirectory()) {
|
|
8438
8775
|
throw new Error(`runtime source directory not found: ${sourceDir}`);
|
|
8439
8776
|
}
|
|
8440
|
-
const runtimeRoot4 = opts.runtimeRoot ?
|
|
8441
|
-
const depsTargetRoot = opts.depsTargetRoot ??
|
|
8777
|
+
const runtimeRoot4 = opts.runtimeRoot ? path21.resolve(opts.runtimeRoot) : path21.resolve(sourceDir, "..", "..");
|
|
8778
|
+
const depsTargetRoot = opts.depsTargetRoot ?? path21.resolve(targetDir, "..");
|
|
8442
8779
|
const result = {
|
|
8443
8780
|
written: [],
|
|
8444
8781
|
updated: [],
|
|
@@ -8448,9 +8785,9 @@ async function copyRuntime(opts) {
|
|
|
8448
8785
|
};
|
|
8449
8786
|
const queue = [];
|
|
8450
8787
|
function walk(dir) {
|
|
8451
|
-
for (const entry of
|
|
8452
|
-
const src =
|
|
8453
|
-
const stat =
|
|
8788
|
+
for (const entry of fs10.readdirSync(dir)) {
|
|
8789
|
+
const src = path21.join(dir, entry);
|
|
8790
|
+
const stat = fs10.statSync(src);
|
|
8454
8791
|
if (stat.isDirectory()) {
|
|
8455
8792
|
if (entry === "generated") continue;
|
|
8456
8793
|
walk(src);
|
|
@@ -8458,9 +8795,9 @@ async function copyRuntime(opts) {
|
|
|
8458
8795
|
}
|
|
8459
8796
|
if (!stat.isFile()) continue;
|
|
8460
8797
|
if (!entry.endsWith(".ts") && !entry.endsWith(".tsx")) continue;
|
|
8461
|
-
const rel =
|
|
8798
|
+
const rel = path21.relative(sourceDir, src);
|
|
8462
8799
|
if (filter && !filter(rel) && !filter(entry)) continue;
|
|
8463
|
-
queue.push({ src, dest:
|
|
8800
|
+
queue.push({ src, dest: path21.join(targetDir, rel), isDep: false });
|
|
8464
8801
|
}
|
|
8465
8802
|
}
|
|
8466
8803
|
walk(sourceDir);
|
|
@@ -8469,7 +8806,7 @@ async function copyRuntime(opts) {
|
|
|
8469
8806
|
const next = queue.shift();
|
|
8470
8807
|
if (visited.has(next.src)) continue;
|
|
8471
8808
|
visited.add(next.src);
|
|
8472
|
-
const content =
|
|
8809
|
+
const content = fs10.readFileSync(next.src, "utf-8");
|
|
8473
8810
|
result.planned.push(next.dest);
|
|
8474
8811
|
if (!dryRun) {
|
|
8475
8812
|
const status = writeFile(next.dest, content);
|
|
@@ -8482,11 +8819,11 @@ async function copyRuntime(opts) {
|
|
|
8482
8819
|
for (const spec of extractRelativeImports(content)) {
|
|
8483
8820
|
const resolvedSrc = resolveSourceImport(next.src, spec);
|
|
8484
8821
|
if (!resolvedSrc) continue;
|
|
8485
|
-
const relToRuntime =
|
|
8486
|
-
if (relToRuntime.startsWith("..") ||
|
|
8487
|
-
const relToSource =
|
|
8488
|
-
if (!relToSource.startsWith("..") && !
|
|
8489
|
-
const depDest =
|
|
8822
|
+
const relToRuntime = path21.relative(runtimeRoot4, resolvedSrc);
|
|
8823
|
+
if (relToRuntime.startsWith("..") || path21.isAbsolute(relToRuntime)) continue;
|
|
8824
|
+
const relToSource = path21.relative(sourceDir, resolvedSrc);
|
|
8825
|
+
if (!relToSource.startsWith("..") && !path21.isAbsolute(relToSource)) continue;
|
|
8826
|
+
const depDest = path21.join(depsTargetRoot, relToRuntime);
|
|
8490
8827
|
queue.push({ src: resolvedSrc, dest: depDest, isDep: true });
|
|
8491
8828
|
}
|
|
8492
8829
|
}
|
|
@@ -8494,196 +8831,15 @@ async function copyRuntime(opts) {
|
|
|
8494
8831
|
return result;
|
|
8495
8832
|
}
|
|
8496
8833
|
|
|
8497
|
-
// src/cli/shared/subsystem-detect.ts
|
|
8498
|
-
import fs9 from "fs";
|
|
8499
|
-
import path20 from "path";
|
|
8500
|
-
var SUBSYSTEMS = [
|
|
8501
|
-
{
|
|
8502
|
-
name: "events",
|
|
8503
|
-
description: "Domain event bus (transactional outbox)",
|
|
8504
|
-
backends: ["drizzle", "memory"],
|
|
8505
|
-
defaultBackend: "drizzle"
|
|
8506
|
-
},
|
|
8507
|
-
{
|
|
8508
|
-
name: "jobs",
|
|
8509
|
-
description: "Background job queue",
|
|
8510
|
-
backends: ["drizzle", "memory"],
|
|
8511
|
-
defaultBackend: "drizzle"
|
|
8512
|
-
},
|
|
8513
|
-
{
|
|
8514
|
-
name: "cache",
|
|
8515
|
-
description: "Key-value cache with TTL",
|
|
8516
|
-
backends: ["drizzle", "memory"],
|
|
8517
|
-
defaultBackend: "drizzle"
|
|
8518
|
-
},
|
|
8519
|
-
{
|
|
8520
|
-
name: "storage",
|
|
8521
|
-
description: "File/object storage",
|
|
8522
|
-
backends: ["local", "memory"],
|
|
8523
|
-
defaultBackend: "local"
|
|
8524
|
-
},
|
|
8525
|
-
{
|
|
8526
|
-
name: "sync",
|
|
8527
|
-
description: "External-system sync engine (IChangeSource<T> + orchestrator + audit log)",
|
|
8528
|
-
backends: ["drizzle", "memory"],
|
|
8529
|
-
defaultBackend: "drizzle"
|
|
8530
|
-
},
|
|
8531
|
-
{
|
|
8532
|
-
name: "bridge",
|
|
8533
|
-
description: "Event-to-job bridge (durable async fanout via @JobHandler.triggers)",
|
|
8534
|
-
backends: ["drizzle", "memory"],
|
|
8535
|
-
defaultBackend: "drizzle"
|
|
8536
|
-
},
|
|
8537
|
-
{
|
|
8538
|
-
// OPENAPI-4. "Config-only" pseudo-subsystem — the runtime helpers
|
|
8539
|
-
// (OpenApiRegistry, ErrorResponseDto) are already vendored by
|
|
8540
|
-
// `codegen project init`. Installing this subsystem just injects the
|
|
8541
|
-
// `openapi:` block into codegen.config.yaml.
|
|
8542
|
-
name: "openapi-config",
|
|
8543
|
-
description: "OpenAPI/Swagger config block (registry is vendored at init)",
|
|
8544
|
-
backends: ["config-only"],
|
|
8545
|
-
defaultBackend: "config-only"
|
|
8546
|
-
},
|
|
8547
|
-
{
|
|
8548
|
-
// OBS-7 / ADR-025. Combiner subsystem — no schema, no worker, no
|
|
8549
|
-
// generated/ dir. `ObservabilityModule` composes sibling read ports
|
|
8550
|
-
// (events/jobs/bridge/sync) via @Optional() DI. The `combiner`
|
|
8551
|
-
// pseudo-backend is parallel to `openapi-config`'s `config-only`.
|
|
8552
|
-
name: "observability",
|
|
8553
|
-
description: "Observability combiner \u2014 composes sibling read ports via @Optional() DI (ADR-025)",
|
|
8554
|
-
backends: ["combiner"],
|
|
8555
|
-
defaultBackend: "combiner"
|
|
8556
|
-
},
|
|
8557
|
-
{
|
|
8558
|
-
// #287. Auth subsystem (PR #289) — AuthModule + ports + OAuth state
|
|
8559
|
-
// store + AuthController. Backends: drizzle (prod, persists OAuth
|
|
8560
|
-
// state in `auth_oauth_state`) or memory (dev/tests). Detection in
|
|
8561
|
-
// `detectInstalledSubsystems` is a special case: auth's protocols
|
|
8562
|
-
// live under `protocols/`, not at the subsystem root, so we look
|
|
8563
|
-
// for `auth.module.ts` instead of `*.protocol.ts`.
|
|
8564
|
-
name: "auth",
|
|
8565
|
-
description: "OAuth integration auth (AuthModule + ports + state store)",
|
|
8566
|
-
backends: ["drizzle", "memory"],
|
|
8567
|
-
defaultBackend: "drizzle"
|
|
8568
|
-
},
|
|
8569
|
-
{
|
|
8570
|
-
// #287. Auth-integrations starter (PR #290) — vendored from
|
|
8571
|
-
// `examples/auth-integrations/`, NOT from `runtime/subsystems/`.
|
|
8572
|
-
// Bundles a canonical `integration` entity yaml + the three
|
|
8573
|
-
// integration-store-port adapters + the `IntegrationsService`
|
|
8574
|
-
// facade. Single-backend (drizzle); the runtime adapters call
|
|
8575
|
-
// directly into the codegen-emitted `IntegrationService` from the
|
|
8576
|
-
// entity layer. Detection: presence of
|
|
8577
|
-
// `<sharedRoot>/integrations/integrations-auth.module.ts`.
|
|
8578
|
-
name: "auth-integrations",
|
|
8579
|
-
description: "Vendored integrations entity + adapters (consumes auth subsystem)",
|
|
8580
|
-
backends: ["drizzle"],
|
|
8581
|
-
defaultBackend: "drizzle"
|
|
8582
|
-
}
|
|
8583
|
-
];
|
|
8584
|
-
var KNOWN_NAMES = SUBSYSTEMS.map((s) => s.name);
|
|
8585
|
-
function candidateRoots(cwd, configured) {
|
|
8586
|
-
const roots = [
|
|
8587
|
-
...configured ? [path20.resolve(cwd, configured)] : [],
|
|
8588
|
-
path20.resolve(cwd, "src/shared/subsystems"),
|
|
8589
|
-
path20.resolve(cwd, "src/subsystems"),
|
|
8590
|
-
path20.resolve(cwd, "shared/subsystems")
|
|
8591
|
-
];
|
|
8592
|
-
return Array.from(new Set(roots));
|
|
8593
|
-
}
|
|
8594
|
-
function inferBackend(dir, name) {
|
|
8595
|
-
if (name === "observability") return "combiner";
|
|
8596
|
-
if (name === "auth") return "drizzle";
|
|
8597
|
-
if (name === "auth-integrations") return "drizzle";
|
|
8598
|
-
const hasDrizzle = fs9.existsSync(path20.join(dir, `${name.replace(/s$/, "")}-bus.drizzle-backend.ts`)) || fs9.readdirSync(dir).some((f) => f.endsWith(".drizzle-backend.ts"));
|
|
8599
|
-
const hasMemory = fs9.readdirSync(dir).some((f) => f.endsWith(".memory-backend.ts"));
|
|
8600
|
-
const hasLocal = fs9.readdirSync(dir).some((f) => f.includes("local"));
|
|
8601
|
-
if (hasDrizzle && hasMemory) return "drizzle";
|
|
8602
|
-
if (hasDrizzle) return "drizzle";
|
|
8603
|
-
if (hasLocal) return "local";
|
|
8604
|
-
if (hasMemory) return "memory";
|
|
8605
|
-
return "unknown";
|
|
8606
|
-
}
|
|
8607
|
-
async function detectInstalledSubsystems(ctx) {
|
|
8608
|
-
const configured = ctx.config?.paths?.subsystems;
|
|
8609
|
-
const roots = candidateRoots(ctx.cwd, configured);
|
|
8610
|
-
const found = [];
|
|
8611
|
-
const seen = /* @__PURE__ */ new Set();
|
|
8612
|
-
for (const root of roots) {
|
|
8613
|
-
if (!fs9.existsSync(root)) continue;
|
|
8614
|
-
for (const name of KNOWN_NAMES) {
|
|
8615
|
-
if (seen.has(name)) continue;
|
|
8616
|
-
if (name === "openapi-config") continue;
|
|
8617
|
-
if (name === "auth-integrations") continue;
|
|
8618
|
-
const dir = path20.join(root, name);
|
|
8619
|
-
if (!fs9.existsSync(dir) || !fs9.statSync(dir).isDirectory()) continue;
|
|
8620
|
-
const files = fs9.readdirSync(dir);
|
|
8621
|
-
let hasProtocol = files.some((f) => f.endsWith(".protocol.ts"));
|
|
8622
|
-
if (name === "auth") {
|
|
8623
|
-
hasProtocol = files.includes("auth.module.ts");
|
|
8624
|
-
}
|
|
8625
|
-
if (!hasProtocol) continue;
|
|
8626
|
-
seen.add(name);
|
|
8627
|
-
found.push({
|
|
8628
|
-
name,
|
|
8629
|
-
path: dir,
|
|
8630
|
-
backend: inferBackend(dir, name)
|
|
8631
|
-
});
|
|
8632
|
-
}
|
|
8633
|
-
}
|
|
8634
|
-
if (!seen.has("openapi-config")) {
|
|
8635
|
-
const configPath = path20.resolve(
|
|
8636
|
-
ctx.cwd,
|
|
8637
|
-
ctx.config ? "codegen.config.yaml" : "codegen.config.yaml"
|
|
8638
|
-
);
|
|
8639
|
-
if (fs9.existsSync(configPath)) {
|
|
8640
|
-
try {
|
|
8641
|
-
const source = fs9.readFileSync(configPath, "utf-8");
|
|
8642
|
-
if (/^openapi\s*:/m.test(source)) {
|
|
8643
|
-
found.push({
|
|
8644
|
-
name: "openapi-config",
|
|
8645
|
-
path: configPath,
|
|
8646
|
-
backend: "config-only"
|
|
8647
|
-
});
|
|
8648
|
-
}
|
|
8649
|
-
} catch {
|
|
8650
|
-
}
|
|
8651
|
-
}
|
|
8652
|
-
}
|
|
8653
|
-
if (!seen.has("auth-integrations")) {
|
|
8654
|
-
const backendSrc = ctx.config?.paths?.backend_src ?? "src";
|
|
8655
|
-
const pathsAny = ctx.config?.paths;
|
|
8656
|
-
const modulesConfigured = pathsAny?.modules_dir;
|
|
8657
|
-
const vendorRoot = typeof modulesConfigured === "string" && modulesConfigured.length > 0 ? path20.resolve(ctx.cwd, modulesConfigured) : path20.resolve(ctx.cwd, backendSrc, "modules");
|
|
8658
|
-
const sharedConfigured = pathsAny?.shared;
|
|
8659
|
-
const sharedRoot = typeof sharedConfigured === "string" && sharedConfigured.length > 0 ? path20.resolve(ctx.cwd, sharedConfigured) : path20.resolve(ctx.cwd, backendSrc, "shared");
|
|
8660
|
-
const candidates = [
|
|
8661
|
-
path20.join(vendorRoot, "integrations", "integrations-auth.module.ts"),
|
|
8662
|
-
path20.join(sharedRoot, "integrations", "integrations-auth.module.ts")
|
|
8663
|
-
];
|
|
8664
|
-
for (const moduleFile of candidates) {
|
|
8665
|
-
if (fs9.existsSync(moduleFile)) {
|
|
8666
|
-
found.push({
|
|
8667
|
-
name: "auth-integrations",
|
|
8668
|
-
path: path20.dirname(moduleFile),
|
|
8669
|
-
backend: "drizzle"
|
|
8670
|
-
});
|
|
8671
|
-
break;
|
|
8672
|
-
}
|
|
8673
|
-
}
|
|
8674
|
-
}
|
|
8675
|
-
return found;
|
|
8676
|
-
}
|
|
8677
|
-
|
|
8678
8834
|
// src/cli/commands/subsystem.ts
|
|
8679
8835
|
function runtimeRoot() {
|
|
8680
|
-
const pkgRoot =
|
|
8681
|
-
const topLevel =
|
|
8682
|
-
if (
|
|
8683
|
-
return
|
|
8836
|
+
const pkgRoot = path22.resolve(import.meta.dirname, "..", "..", "..");
|
|
8837
|
+
const topLevel = path22.join(pkgRoot, "runtime");
|
|
8838
|
+
if (fs11.existsSync(topLevel)) return topLevel;
|
|
8839
|
+
return path22.join(pkgRoot, "dist", "runtime");
|
|
8684
8840
|
}
|
|
8685
8841
|
function subsystemSource(name) {
|
|
8686
|
-
return
|
|
8842
|
+
return path22.join(runtimeRoot(), "subsystems", name);
|
|
8687
8843
|
}
|
|
8688
8844
|
function describeSubsystem(name) {
|
|
8689
8845
|
return SUBSYSTEMS.find((s) => s.name === name) ?? null;
|
|
@@ -8710,7 +8866,7 @@ async function summary2(ctx) {
|
|
|
8710
8866
|
}
|
|
8711
8867
|
body.push(theme.muted("Installed:"));
|
|
8712
8868
|
for (const i of installed) {
|
|
8713
|
-
const rel =
|
|
8869
|
+
const rel = path22.relative(ctx.cwd, i.path) || i.path;
|
|
8714
8870
|
body.push(
|
|
8715
8871
|
` ${theme.success(icons.check)} ${i.name.padEnd(10)} ${theme.muted(
|
|
8716
8872
|
`${i.backend} backend`
|
|
@@ -8848,14 +9004,14 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
8848
9004
|
return 0;
|
|
8849
9005
|
}
|
|
8850
9006
|
const targetRoot = resolveSubsystemsRoot(ctx, this.target);
|
|
8851
|
-
const subsystemTarget =
|
|
9007
|
+
const subsystemTarget = path22.join(targetRoot, desc3.name);
|
|
8852
9008
|
const source = subsystemSource(desc3.name);
|
|
8853
|
-
if (!
|
|
9009
|
+
if (!fs11.existsSync(source)) {
|
|
8854
9010
|
printError(`Runtime subsystem source missing: ${source}`);
|
|
8855
9011
|
return 1;
|
|
8856
9012
|
}
|
|
8857
9013
|
if (!this.force) {
|
|
8858
|
-
const gitCheck = checkGitSafety([
|
|
9014
|
+
const gitCheck = checkGitSafety([path22.relative(ctx.cwd, subsystemTarget) || subsystemTarget], ctx.cwd);
|
|
8859
9015
|
if (gitCheck.inRepo && !gitCheck.clean) {
|
|
8860
9016
|
printWarning(
|
|
8861
9017
|
`Uncommitted changes under ${subsystemTarget}. Pass --force to overwrite.`
|
|
@@ -8864,7 +9020,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
8864
9020
|
}
|
|
8865
9021
|
}
|
|
8866
9022
|
if (!isJsonMode()) {
|
|
8867
|
-
printInfo(`target = ${
|
|
9023
|
+
printInfo(`target = ${path22.relative(ctx.cwd, subsystemTarget) || subsystemTarget}`);
|
|
8868
9024
|
printInfo(`backend = ${backend}`);
|
|
8869
9025
|
}
|
|
8870
9026
|
const result = await copyRuntime({
|
|
@@ -8873,7 +9029,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
8873
9029
|
filter: backendFileFilter(backend, desc3.name),
|
|
8874
9030
|
resolveDeps: true,
|
|
8875
9031
|
runtimeRoot: runtimeRoot(),
|
|
8876
|
-
depsTargetRoot:
|
|
9032
|
+
depsTargetRoot: path22.resolve(targetRoot, ".."),
|
|
8877
9033
|
dryRun: this.dryRun
|
|
8878
9034
|
});
|
|
8879
9035
|
const jobsScaffold = desc3.name === "jobs" ? runJobsScaffold(ctx.cwd, ctx.config, {
|
|
@@ -8968,14 +9124,14 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
8968
9124
|
if (this.dryRun) {
|
|
8969
9125
|
printInfo(`Dry run \u2014 ${result.planned.length} files would be written`);
|
|
8970
9126
|
for (const p of result.planned) {
|
|
8971
|
-
console.log(` ${theme.muted(icons.arrow)} ${
|
|
9127
|
+
console.log(` ${theme.muted(icons.arrow)} ${path22.relative(ctx.cwd, p) || p}`);
|
|
8972
9128
|
}
|
|
8973
9129
|
if (jobsScaffold?.planned?.length) {
|
|
8974
9130
|
printInfo(
|
|
8975
9131
|
`Jobs scaffold \u2014 ${jobsScaffold.planned.length} template targets`
|
|
8976
9132
|
);
|
|
8977
9133
|
for (const p of jobsScaffold.planned) {
|
|
8978
|
-
console.log(` ${theme.muted(icons.arrow)} ${
|
|
9134
|
+
console.log(` ${theme.muted(icons.arrow)} ${path22.relative(ctx.cwd, p) || p}`);
|
|
8979
9135
|
}
|
|
8980
9136
|
}
|
|
8981
9137
|
if (eventsScaffold?.planned?.length) {
|
|
@@ -8983,7 +9139,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
8983
9139
|
`Events scaffold \u2014 ${eventsScaffold.planned.length} template targets`
|
|
8984
9140
|
);
|
|
8985
9141
|
for (const p of eventsScaffold.planned) {
|
|
8986
|
-
console.log(` ${theme.muted(icons.arrow)} ${
|
|
9142
|
+
console.log(` ${theme.muted(icons.arrow)} ${path22.relative(ctx.cwd, p) || p}`);
|
|
8987
9143
|
}
|
|
8988
9144
|
}
|
|
8989
9145
|
if (syncScaffold?.planned?.length) {
|
|
@@ -8991,7 +9147,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
8991
9147
|
`Sync scaffold \u2014 ${syncScaffold.planned.length} template targets`
|
|
8992
9148
|
);
|
|
8993
9149
|
for (const p of syncScaffold.planned) {
|
|
8994
|
-
console.log(` ${theme.muted(icons.arrow)} ${
|
|
9150
|
+
console.log(` ${theme.muted(icons.arrow)} ${path22.relative(ctx.cwd, p) || p}`);
|
|
8995
9151
|
}
|
|
8996
9152
|
}
|
|
8997
9153
|
if (bridgeScaffold?.planned?.length) {
|
|
@@ -8999,7 +9155,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
8999
9155
|
`Bridge scaffold \u2014 ${bridgeScaffold.planned.length} template targets`
|
|
9000
9156
|
);
|
|
9001
9157
|
for (const p of bridgeScaffold.planned) {
|
|
9002
|
-
console.log(` ${theme.muted(icons.arrow)} ${
|
|
9158
|
+
console.log(` ${theme.muted(icons.arrow)} ${path22.relative(ctx.cwd, p) || p}`);
|
|
9003
9159
|
}
|
|
9004
9160
|
}
|
|
9005
9161
|
if (observabilityScaffold?.planned?.length) {
|
|
@@ -9007,7 +9163,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
9007
9163
|
`Observability scaffold \u2014 ${observabilityScaffold.planned.length} template targets`
|
|
9008
9164
|
);
|
|
9009
9165
|
for (const p of observabilityScaffold.planned) {
|
|
9010
|
-
console.log(` ${theme.muted(icons.arrow)} ${
|
|
9166
|
+
console.log(` ${theme.muted(icons.arrow)} ${path22.relative(ctx.cwd, p) || p}`);
|
|
9011
9167
|
}
|
|
9012
9168
|
}
|
|
9013
9169
|
if (authScaffold?.planned?.length) {
|
|
@@ -9015,7 +9171,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
9015
9171
|
`Auth scaffold \u2014 ${authScaffold.planned.length} template targets`
|
|
9016
9172
|
);
|
|
9017
9173
|
for (const p of authScaffold.planned) {
|
|
9018
|
-
console.log(` ${theme.muted(icons.arrow)} ${
|
|
9174
|
+
console.log(` ${theme.muted(icons.arrow)} ${path22.relative(ctx.cwd, p) || p}`);
|
|
9019
9175
|
}
|
|
9020
9176
|
}
|
|
9021
9177
|
return 0;
|
|
@@ -9094,6 +9250,13 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
9094
9250
|
}
|
|
9095
9251
|
}
|
|
9096
9252
|
printSuccess(`${desc3.name} subsystem installed with ${backend} backend.`);
|
|
9253
|
+
try {
|
|
9254
|
+
const generatedDir = resolveGeneratedDir(ctx);
|
|
9255
|
+
await regenerateSubsystemBarrel({ ctx, generatedDir });
|
|
9256
|
+
} catch (err) {
|
|
9257
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
9258
|
+
printWarning(`subsystem barrel regeneration failed \u2014 ${msg}`);
|
|
9259
|
+
}
|
|
9097
9260
|
if (desc3.name === "observability") {
|
|
9098
9261
|
printInfo(
|
|
9099
9262
|
"Register `ObservabilityModule.forRoot()` AFTER Events/Jobs/Bridge/Sync in app.module.ts"
|
|
@@ -9128,7 +9291,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
9128
9291
|
* semantics as jobs/events/sync/bridge.
|
|
9129
9292
|
*/
|
|
9130
9293
|
async executeOpenApiConfig(ctx) {
|
|
9131
|
-
const configPath =
|
|
9294
|
+
const configPath = path22.join(ctx.cwd, "codegen.config.yaml");
|
|
9132
9295
|
const outcome = planConfigBlockAction(configPath, "openapi", this.forceConfig);
|
|
9133
9296
|
if (outcome === "parse-error") {
|
|
9134
9297
|
printError(
|
|
@@ -9147,7 +9310,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
9147
9310
|
});
|
|
9148
9311
|
} else {
|
|
9149
9312
|
printInfo(`Dry run \u2014 openapi config block would be ${outcome}`);
|
|
9150
|
-
console.log(` ${theme.muted(icons.arrow)} ${
|
|
9313
|
+
console.log(` ${theme.muted(icons.arrow)} ${path22.relative(ctx.cwd, configPath) || configPath}`);
|
|
9151
9314
|
}
|
|
9152
9315
|
return 0;
|
|
9153
9316
|
}
|
|
@@ -9242,7 +9405,7 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
9242
9405
|
);
|
|
9243
9406
|
for (const p of scaffold.planned) {
|
|
9244
9407
|
console.log(
|
|
9245
|
-
` ${theme.muted(icons.arrow)} ${
|
|
9408
|
+
` ${theme.muted(icons.arrow)} ${path22.relative(ctx.cwd, p) || p}`
|
|
9246
9409
|
);
|
|
9247
9410
|
}
|
|
9248
9411
|
return 0;
|
|
@@ -9266,10 +9429,10 @@ var SubsystemInstallCommand = class extends Command3 {
|
|
|
9266
9429
|
}
|
|
9267
9430
|
};
|
|
9268
9431
|
function planConfigBlockAction(configPath, subsystem, forceConfig) {
|
|
9269
|
-
if (!
|
|
9432
|
+
if (!fs11.existsSync(configPath)) {
|
|
9270
9433
|
return "inject";
|
|
9271
9434
|
}
|
|
9272
|
-
const source =
|
|
9435
|
+
const source = fs11.readFileSync(configPath, "utf-8");
|
|
9273
9436
|
const state = detectConfigBlock(source, subsystem);
|
|
9274
9437
|
if (state === "parse-error") return "parse-error";
|
|
9275
9438
|
if (state === "missing") return "inject";
|
|
@@ -9292,9 +9455,9 @@ function runConfigBlockAction(input) {
|
|
|
9292
9455
|
);
|
|
9293
9456
|
}
|
|
9294
9457
|
try {
|
|
9295
|
-
const source =
|
|
9458
|
+
const source = fs11.readFileSync(input.configPath, "utf-8");
|
|
9296
9459
|
const stripped = stripConfigBlock(source, input.subsystem);
|
|
9297
|
-
|
|
9460
|
+
fs11.writeFileSync(input.configPath, stripped, "utf-8");
|
|
9298
9461
|
} catch (err) {
|
|
9299
9462
|
const message = err instanceof Error ? err.message : String(err);
|
|
9300
9463
|
return { ok: false, error: `strip failed: ${message}` };
|
|
@@ -9332,8 +9495,8 @@ function runJobsScaffold(cwd, config, opts) {
|
|
|
9332
9495
|
const locals = resolveJobsScaffoldLocals({
|
|
9333
9496
|
cwd,
|
|
9334
9497
|
config,
|
|
9335
|
-
fileExists: (p) =>
|
|
9336
|
-
readFile: (p) =>
|
|
9498
|
+
fileExists: (p) => fs11.existsSync(p),
|
|
9499
|
+
readFile: (p) => fs11.existsSync(p) ? fs11.readFileSync(p, "utf-8") : null
|
|
9337
9500
|
});
|
|
9338
9501
|
const planned = [
|
|
9339
9502
|
...!locals.workerExists ? [locals.workerPath] : [],
|
|
@@ -9390,7 +9553,7 @@ function runEventsScaffold(cwd, config, opts) {
|
|
|
9390
9553
|
const locals = resolveEventsScaffoldLocals({
|
|
9391
9554
|
cwd,
|
|
9392
9555
|
config,
|
|
9393
|
-
fileExists: (p) =>
|
|
9556
|
+
fileExists: (p) => fs11.existsSync(p)
|
|
9394
9557
|
});
|
|
9395
9558
|
const planned = [
|
|
9396
9559
|
locals.configPath,
|
|
@@ -9446,7 +9609,7 @@ function runSyncScaffold(cwd, config, opts) {
|
|
|
9446
9609
|
const locals = resolveSyncScaffoldLocals({
|
|
9447
9610
|
cwd,
|
|
9448
9611
|
config,
|
|
9449
|
-
fileExists: (p) =>
|
|
9612
|
+
fileExists: (p) => fs11.existsSync(p)
|
|
9450
9613
|
});
|
|
9451
9614
|
const planned = [
|
|
9452
9615
|
locals.configPath,
|
|
@@ -9501,7 +9664,7 @@ function runBridgeScaffold(cwd, config, opts) {
|
|
|
9501
9664
|
const locals = resolveBridgeScaffoldLocals({
|
|
9502
9665
|
cwd,
|
|
9503
9666
|
config,
|
|
9504
|
-
fileExists: (p) =>
|
|
9667
|
+
fileExists: (p) => fs11.existsSync(p)
|
|
9505
9668
|
});
|
|
9506
9669
|
const planned = [
|
|
9507
9670
|
locals.configPath,
|
|
@@ -9555,7 +9718,7 @@ function runObservabilityScaffold(cwd, config, opts) {
|
|
|
9555
9718
|
const locals = resolveObservabilityScaffoldLocals({
|
|
9556
9719
|
cwd,
|
|
9557
9720
|
config,
|
|
9558
|
-
fileExists: (p) =>
|
|
9721
|
+
fileExists: (p) => fs11.existsSync(p)
|
|
9559
9722
|
});
|
|
9560
9723
|
const planned = [locals.configPath, locals.appModulePath];
|
|
9561
9724
|
const configBlockOutcome = planConfigBlockAction(
|
|
@@ -9624,9 +9787,9 @@ function runAuthScaffold(cwd, config, opts) {
|
|
|
9624
9787
|
if (opts.dryRun) {
|
|
9625
9788
|
return { ok: true, planned, configBlockOutcome };
|
|
9626
9789
|
}
|
|
9627
|
-
if (!
|
|
9628
|
-
|
|
9629
|
-
|
|
9790
|
+
if (!fs11.existsSync(locals.envConfigPath)) {
|
|
9791
|
+
fs11.mkdirSync(path22.dirname(locals.envConfigPath), { recursive: true });
|
|
9792
|
+
fs11.writeFileSync(locals.envConfigPath, "", "utf-8");
|
|
9630
9793
|
}
|
|
9631
9794
|
const result = invokeHygen({
|
|
9632
9795
|
generator: "subsystem",
|
|
@@ -9662,57 +9825,57 @@ function runAuthScaffold(cwd, config, opts) {
|
|
|
9662
9825
|
return { ok: true, planned, configBlockOutcome };
|
|
9663
9826
|
}
|
|
9664
9827
|
function authIntegrationsExamplesRoot() {
|
|
9665
|
-
const pkgRoot =
|
|
9666
|
-
const topLevel =
|
|
9667
|
-
if (
|
|
9668
|
-
return
|
|
9828
|
+
const pkgRoot = path22.resolve(import.meta.dirname, "..", "..", "..");
|
|
9829
|
+
const topLevel = path22.join(pkgRoot, "examples", "auth-integrations");
|
|
9830
|
+
if (fs11.existsSync(topLevel)) return topLevel;
|
|
9831
|
+
return path22.join(pkgRoot, "dist", "examples", "auth-integrations");
|
|
9669
9832
|
}
|
|
9670
9833
|
function copyTreeIdempotent(srcDir, destDir, force, transform) {
|
|
9671
9834
|
const written = [];
|
|
9672
9835
|
const skipped = [];
|
|
9673
9836
|
const walk = (src, dest) => {
|
|
9674
|
-
const entries =
|
|
9837
|
+
const entries = fs11.readdirSync(src, { withFileTypes: true });
|
|
9675
9838
|
for (const entry of entries) {
|
|
9676
|
-
const srcPath =
|
|
9677
|
-
const destPath =
|
|
9839
|
+
const srcPath = path22.join(src, entry.name);
|
|
9840
|
+
const destPath = path22.join(dest, entry.name);
|
|
9678
9841
|
if (entry.isDirectory()) {
|
|
9679
|
-
|
|
9842
|
+
fs11.mkdirSync(destPath, { recursive: true });
|
|
9680
9843
|
walk(srcPath, destPath);
|
|
9681
9844
|
continue;
|
|
9682
9845
|
}
|
|
9683
9846
|
if (!entry.isFile()) continue;
|
|
9684
|
-
if (
|
|
9847
|
+
if (fs11.existsSync(destPath) && !force) {
|
|
9685
9848
|
skipped.push(destPath);
|
|
9686
9849
|
continue;
|
|
9687
9850
|
}
|
|
9688
|
-
|
|
9851
|
+
fs11.mkdirSync(path22.dirname(destPath), { recursive: true });
|
|
9689
9852
|
const isTextSource = transform && (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx"));
|
|
9690
9853
|
if (isTextSource && transform) {
|
|
9691
|
-
const raw =
|
|
9692
|
-
|
|
9854
|
+
const raw = fs11.readFileSync(srcPath, "utf-8");
|
|
9855
|
+
fs11.writeFileSync(destPath, transform(raw, destPath), "utf-8");
|
|
9693
9856
|
} else {
|
|
9694
|
-
|
|
9857
|
+
fs11.copyFileSync(srcPath, destPath);
|
|
9695
9858
|
}
|
|
9696
9859
|
written.push(destPath);
|
|
9697
9860
|
}
|
|
9698
9861
|
};
|
|
9699
|
-
if (!
|
|
9700
|
-
|
|
9862
|
+
if (!fs11.existsSync(srcDir)) return { written, skipped };
|
|
9863
|
+
fs11.mkdirSync(destDir, { recursive: true });
|
|
9701
9864
|
walk(srcDir, destDir);
|
|
9702
9865
|
return { written, skipped };
|
|
9703
9866
|
}
|
|
9704
9867
|
var AUTH_BARE_IMPORT_RE = /(['"])@pattern-stack\/codegen\/runtime\/subsystems\/auth\1/g;
|
|
9705
9868
|
function buildAuthImportRewriter(subsystemsRoot) {
|
|
9706
|
-
const authRoot =
|
|
9869
|
+
const authRoot = path22.join(subsystemsRoot, "auth");
|
|
9707
9870
|
return (content, destPath) => {
|
|
9708
9871
|
if (!AUTH_BARE_IMPORT_RE.test(content)) {
|
|
9709
9872
|
AUTH_BARE_IMPORT_RE.lastIndex = 0;
|
|
9710
9873
|
return content;
|
|
9711
9874
|
}
|
|
9712
9875
|
AUTH_BARE_IMPORT_RE.lastIndex = 0;
|
|
9713
|
-
let rel =
|
|
9876
|
+
let rel = path22.relative(path22.dirname(destPath), authRoot);
|
|
9714
9877
|
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
9715
|
-
const relPosix = rel.split(
|
|
9878
|
+
const relPosix = rel.split(path22.sep).join("/");
|
|
9716
9879
|
return content.replace(
|
|
9717
9880
|
AUTH_BARE_IMPORT_RE,
|
|
9718
9881
|
(_match, quote) => `${quote}${relPosix}${quote}`
|
|
@@ -9723,20 +9886,20 @@ function runAuthIntegrationsScaffold(cwd, config, opts) {
|
|
|
9723
9886
|
const locals = resolveAuthIntegrationsScaffoldLocals({
|
|
9724
9887
|
cwd,
|
|
9725
9888
|
config,
|
|
9726
|
-
fileExists: (p) =>
|
|
9727
|
-
readFile: (p) =>
|
|
9889
|
+
fileExists: (p) => fs11.existsSync(p),
|
|
9890
|
+
readFile: (p) => fs11.existsSync(p) ? fs11.readFileSync(p, "utf-8") : null
|
|
9728
9891
|
});
|
|
9729
9892
|
const examplesRoot = authIntegrationsExamplesRoot();
|
|
9730
|
-
if (!
|
|
9893
|
+
if (!fs11.existsSync(examplesRoot)) {
|
|
9731
9894
|
return {
|
|
9732
9895
|
ok: false,
|
|
9733
9896
|
planned: [],
|
|
9734
9897
|
error: `auth-integrations starter source missing: ${examplesRoot}`
|
|
9735
9898
|
};
|
|
9736
9899
|
}
|
|
9737
|
-
const adaptersSrc =
|
|
9738
|
-
const adaptersDest =
|
|
9739
|
-
const integrationYamlSrc =
|
|
9900
|
+
const adaptersSrc = path22.join(examplesRoot, "runtime", "integrations");
|
|
9901
|
+
const adaptersDest = path22.join(locals.vendorRoot, "integrations");
|
|
9902
|
+
const integrationYamlSrc = path22.join(
|
|
9740
9903
|
examplesRoot,
|
|
9741
9904
|
"definitions",
|
|
9742
9905
|
"entities",
|
|
@@ -9765,11 +9928,11 @@ function runAuthIntegrationsScaffold(cwd, config, opts) {
|
|
|
9765
9928
|
let yamlWritten = false;
|
|
9766
9929
|
let yamlSkipped = false;
|
|
9767
9930
|
try {
|
|
9768
|
-
if (
|
|
9931
|
+
if (fs11.existsSync(integrationYamlDest) && !opts.force) {
|
|
9769
9932
|
yamlSkipped = true;
|
|
9770
|
-
} else if (
|
|
9771
|
-
|
|
9772
|
-
|
|
9933
|
+
} else if (fs11.existsSync(integrationYamlSrc)) {
|
|
9934
|
+
fs11.mkdirSync(path22.dirname(integrationYamlDest), { recursive: true });
|
|
9935
|
+
fs11.copyFileSync(integrationYamlSrc, integrationYamlDest);
|
|
9773
9936
|
yamlWritten = true;
|
|
9774
9937
|
}
|
|
9775
9938
|
} catch (err) {
|
|
@@ -9834,7 +9997,7 @@ var SubsystemListCommand = class extends Command3 {
|
|
|
9834
9997
|
name: s.name,
|
|
9835
9998
|
status: inst ? "installed" : "available",
|
|
9836
9999
|
backend: inst ? inst.backend : null,
|
|
9837
|
-
path: inst ?
|
|
10000
|
+
path: inst ? path22.relative(ctx.cwd, inst.path) || inst.path : null
|
|
9838
10001
|
};
|
|
9839
10002
|
});
|
|
9840
10003
|
if (isJsonMode()) {
|
|
@@ -9894,28 +10057,28 @@ var subsystemNoun = {
|
|
|
9894
10057
|
var subsystem_default = subsystemNoun;
|
|
9895
10058
|
|
|
9896
10059
|
// src/cli/commands/project.ts
|
|
9897
|
-
import
|
|
9898
|
-
import
|
|
10060
|
+
import fs14 from "fs";
|
|
10061
|
+
import path25 from "path";
|
|
9899
10062
|
import readline from "readline";
|
|
9900
10063
|
import { Command as Command5, Option as Option5 } from "clipanion";
|
|
9901
10064
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
9902
10065
|
|
|
9903
10066
|
// src/cli/shared/init-scaffold.ts
|
|
9904
|
-
import
|
|
9905
|
-
import
|
|
10067
|
+
import fs12 from "fs";
|
|
10068
|
+
import path23 from "path";
|
|
9906
10069
|
import { stringify as stringifyYaml } from "yaml";
|
|
9907
10070
|
function runtimeRoot2() {
|
|
9908
|
-
const pkgRoot =
|
|
9909
|
-
const topLevel =
|
|
9910
|
-
if (
|
|
9911
|
-
return
|
|
10071
|
+
const pkgRoot = path23.resolve(import.meta.dirname, "..", "..", "..");
|
|
10072
|
+
const topLevel = path23.join(pkgRoot, "runtime");
|
|
10073
|
+
if (fs12.existsSync(topLevel)) return topLevel;
|
|
10074
|
+
return path23.join(pkgRoot, "dist", "runtime");
|
|
9912
10075
|
}
|
|
9913
10076
|
function resolveRuntimePath(cwd) {
|
|
9914
|
-
const shimDir =
|
|
9915
|
-
return
|
|
10077
|
+
const shimDir = path23.join(cwd, "src", "shared", "base-classes");
|
|
10078
|
+
return path23.relative(shimDir, runtimeRoot2());
|
|
9916
10079
|
}
|
|
9917
10080
|
function loadRuntimeFile(relPath2) {
|
|
9918
|
-
return
|
|
10081
|
+
return fs12.readFileSync(path23.join(runtimeRoot2(), relPath2), "utf-8");
|
|
9919
10082
|
}
|
|
9920
10083
|
var VENDORED_RUNTIME_FILES = [
|
|
9921
10084
|
// base-classes — consumer-facing inheritance targets
|
|
@@ -10312,10 +10475,10 @@ function mergeTsconfig(raw) {
|
|
|
10312
10475
|
};
|
|
10313
10476
|
}
|
|
10314
10477
|
function relOf(cwd, abs) {
|
|
10315
|
-
return
|
|
10478
|
+
return path23.relative(cwd, abs) || abs;
|
|
10316
10479
|
}
|
|
10317
10480
|
function fileEntry(cwd, absPath, content, opts) {
|
|
10318
|
-
const exists =
|
|
10481
|
+
const exists = fs12.existsSync(absPath);
|
|
10319
10482
|
let action;
|
|
10320
10483
|
let reason = opts.skipReason;
|
|
10321
10484
|
if (!exists) {
|
|
@@ -10330,7 +10493,7 @@ function fileEntry(cwd, absPath, content, opts) {
|
|
|
10330
10493
|
return { path: absPath, relPath: relOf(cwd, absPath), action, content, reason };
|
|
10331
10494
|
}
|
|
10332
10495
|
function dirEntry(cwd, absPath) {
|
|
10333
|
-
const exists =
|
|
10496
|
+
const exists = fs12.existsSync(absPath);
|
|
10334
10497
|
return {
|
|
10335
10498
|
path: absPath,
|
|
10336
10499
|
relPath: relOf(cwd, absPath),
|
|
@@ -10362,7 +10525,7 @@ async function buildInitPlan(ctx, options) {
|
|
|
10362
10525
|
const runtimePath = options.runtimePath ?? resolveRuntimePath(cwd);
|
|
10363
10526
|
const entries = [];
|
|
10364
10527
|
{
|
|
10365
|
-
const configPath =
|
|
10528
|
+
const configPath = path23.join(cwd, "codegen.config.yaml");
|
|
10366
10529
|
const config = {
|
|
10367
10530
|
paths: {
|
|
10368
10531
|
backend_src: "src",
|
|
@@ -10392,9 +10555,9 @@ async function buildInitPlan(ctx, options) {
|
|
|
10392
10555
|
entries.push(fileEntry(cwd, configPath, content, { force }));
|
|
10393
10556
|
}
|
|
10394
10557
|
{
|
|
10395
|
-
const tsconfigPath =
|
|
10396
|
-
if (
|
|
10397
|
-
const raw =
|
|
10558
|
+
const tsconfigPath = path23.join(cwd, "tsconfig.json");
|
|
10559
|
+
if (fs12.existsSync(tsconfigPath)) {
|
|
10560
|
+
const raw = fs12.readFileSync(tsconfigPath, "utf-8");
|
|
10398
10561
|
const merged = mergeTsconfig(raw);
|
|
10399
10562
|
if (merged.parseError) {
|
|
10400
10563
|
entries.push({
|
|
@@ -10439,20 +10602,20 @@ async function buildInitPlan(ctx, options) {
|
|
|
10439
10602
|
entries.push(
|
|
10440
10603
|
fileEntry(
|
|
10441
10604
|
cwd,
|
|
10442
|
-
|
|
10605
|
+
path23.join(cwd, "src", "shared", "database", "database.module.ts"),
|
|
10443
10606
|
databaseModuleContent(),
|
|
10444
10607
|
{ force }
|
|
10445
10608
|
)
|
|
10446
10609
|
);
|
|
10447
10610
|
for (const v of VENDORED_RUNTIME_FILES) {
|
|
10448
10611
|
entries.push(
|
|
10449
|
-
fileEntry(cwd,
|
|
10612
|
+
fileEntry(cwd, path23.join(cwd, v.target), loadRuntimeFile(v.runtime), { force })
|
|
10450
10613
|
);
|
|
10451
10614
|
}
|
|
10452
10615
|
entries.push(
|
|
10453
10616
|
fileEntry(
|
|
10454
10617
|
cwd,
|
|
10455
|
-
|
|
10618
|
+
path23.join(cwd, "src", "generated", "modules.ts"),
|
|
10456
10619
|
emptyModulesBarrel(),
|
|
10457
10620
|
{ force }
|
|
10458
10621
|
)
|
|
@@ -10460,14 +10623,14 @@ async function buildInitPlan(ctx, options) {
|
|
|
10460
10623
|
entries.push(
|
|
10461
10624
|
fileEntry(
|
|
10462
10625
|
cwd,
|
|
10463
|
-
|
|
10626
|
+
path23.join(cwd, "src", "generated", "schema.ts"),
|
|
10464
10627
|
emptySchemaBarrel(),
|
|
10465
10628
|
{ force }
|
|
10466
10629
|
)
|
|
10467
10630
|
);
|
|
10468
10631
|
{
|
|
10469
|
-
const appModulePath =
|
|
10470
|
-
if (!
|
|
10632
|
+
const appModulePath = path23.join(cwd, "src", "app.module.ts");
|
|
10633
|
+
if (!fs12.existsSync(appModulePath)) {
|
|
10471
10634
|
entries.push({
|
|
10472
10635
|
path: appModulePath,
|
|
10473
10636
|
relPath: relOf(cwd, appModulePath),
|
|
@@ -10484,8 +10647,8 @@ async function buildInitPlan(ctx, options) {
|
|
|
10484
10647
|
}
|
|
10485
10648
|
}
|
|
10486
10649
|
{
|
|
10487
|
-
const mainPath =
|
|
10488
|
-
if (!
|
|
10650
|
+
const mainPath = path23.join(cwd, "src", "main.ts");
|
|
10651
|
+
if (!fs12.existsSync(mainPath)) {
|
|
10489
10652
|
entries.push({
|
|
10490
10653
|
path: mainPath,
|
|
10491
10654
|
relPath: relOf(cwd, mainPath),
|
|
@@ -10502,8 +10665,8 @@ async function buildInitPlan(ctx, options) {
|
|
|
10502
10665
|
}
|
|
10503
10666
|
}
|
|
10504
10667
|
{
|
|
10505
|
-
const schemaPath =
|
|
10506
|
-
if (!
|
|
10668
|
+
const schemaPath = path23.join(cwd, "src", "schema.ts");
|
|
10669
|
+
if (!fs12.existsSync(schemaPath)) {
|
|
10507
10670
|
entries.push({
|
|
10508
10671
|
path: schemaPath,
|
|
10509
10672
|
relPath: relOf(cwd, schemaPath),
|
|
@@ -10519,14 +10682,14 @@ async function buildInitPlan(ctx, options) {
|
|
|
10519
10682
|
});
|
|
10520
10683
|
}
|
|
10521
10684
|
}
|
|
10522
|
-
entries.push(dirEntry(cwd,
|
|
10685
|
+
entries.push(dirEntry(cwd, path23.join(cwd, "entities")));
|
|
10523
10686
|
{
|
|
10524
|
-
const entitiesDir =
|
|
10525
|
-
const examplePath =
|
|
10526
|
-
const hasOtherYamls =
|
|
10687
|
+
const entitiesDir = path23.join(cwd, "entities");
|
|
10688
|
+
const examplePath = path23.join(entitiesDir, "example.yaml");
|
|
10689
|
+
const hasOtherYamls = fs12.existsSync(entitiesDir) && fs12.readdirSync(entitiesDir).some(
|
|
10527
10690
|
(f) => (f.endsWith(".yaml") || f.endsWith(".yml")) && f !== "example.yaml"
|
|
10528
10691
|
);
|
|
10529
|
-
if (
|
|
10692
|
+
if (fs12.existsSync(examplePath)) {
|
|
10530
10693
|
entries.push({
|
|
10531
10694
|
path: examplePath,
|
|
10532
10695
|
relPath: relOf(cwd, examplePath),
|
|
@@ -10572,7 +10735,7 @@ function writePlan(plan) {
|
|
|
10572
10735
|
continue;
|
|
10573
10736
|
}
|
|
10574
10737
|
if (e.directory) {
|
|
10575
|
-
|
|
10738
|
+
fs12.mkdirSync(e.path, { recursive: true });
|
|
10576
10739
|
created.push(e);
|
|
10577
10740
|
continue;
|
|
10578
10741
|
}
|
|
@@ -10580,8 +10743,8 @@ function writePlan(plan) {
|
|
|
10580
10743
|
skipped.push(e);
|
|
10581
10744
|
continue;
|
|
10582
10745
|
}
|
|
10583
|
-
|
|
10584
|
-
|
|
10746
|
+
fs12.mkdirSync(path23.dirname(e.path), { recursive: true });
|
|
10747
|
+
fs12.writeFileSync(e.path, e.content, "utf-8");
|
|
10585
10748
|
if (e.action === "create") created.push(e);
|
|
10586
10749
|
else if (e.action === "merge") merged.push(e);
|
|
10587
10750
|
else if (e.action === "overwrite") overwritten.push(e);
|
|
@@ -10590,8 +10753,8 @@ function writePlan(plan) {
|
|
|
10590
10753
|
}
|
|
10591
10754
|
|
|
10592
10755
|
// src/cli/commands/project-upgrade-openapi.ts
|
|
10593
|
-
import
|
|
10594
|
-
import
|
|
10756
|
+
import fs13 from "fs";
|
|
10757
|
+
import path24 from "path";
|
|
10595
10758
|
import { Command as Command4, Option as Option4 } from "clipanion";
|
|
10596
10759
|
import { Project, IndentationText, QuoteKind, NewLineKind } from "ts-morph";
|
|
10597
10760
|
|
|
@@ -10830,35 +10993,35 @@ var MAIN_SWAGGER_IMPORTS = [
|
|
|
10830
10993
|
"import { OPENAPI_REGISTRY, OpenApiRegistry } from './shared/openapi';"
|
|
10831
10994
|
];
|
|
10832
10995
|
function runtimeRoot3() {
|
|
10833
|
-
const pkgRoot =
|
|
10834
|
-
const topLevel =
|
|
10835
|
-
if (
|
|
10836
|
-
return
|
|
10996
|
+
const pkgRoot = path24.resolve(import.meta.dirname, "..", "..", "..");
|
|
10997
|
+
const topLevel = path24.join(pkgRoot, "runtime");
|
|
10998
|
+
if (fs13.existsSync(topLevel)) return topLevel;
|
|
10999
|
+
return path24.join(pkgRoot, "dist", "runtime");
|
|
10837
11000
|
}
|
|
10838
11001
|
function loadRuntimeFile2(rel) {
|
|
10839
|
-
return
|
|
11002
|
+
return fs13.readFileSync(path24.join(runtimeRoot3(), rel), "utf-8");
|
|
10840
11003
|
}
|
|
10841
11004
|
function resolveProjectRoot(startDir) {
|
|
10842
|
-
let dir =
|
|
11005
|
+
let dir = path24.resolve(startDir);
|
|
10843
11006
|
for (let i = 0; i < 16; i++) {
|
|
10844
|
-
if (
|
|
11007
|
+
if (fs13.existsSync(path24.join(dir, "codegen.config.yaml")) || fs13.existsSync(path24.join(dir, "package.json"))) {
|
|
10845
11008
|
return dir;
|
|
10846
11009
|
}
|
|
10847
|
-
const parent =
|
|
11010
|
+
const parent = path24.dirname(dir);
|
|
10848
11011
|
if (parent === dir) break;
|
|
10849
11012
|
dir = parent;
|
|
10850
11013
|
}
|
|
10851
|
-
return
|
|
11014
|
+
return path24.resolve(startDir);
|
|
10852
11015
|
}
|
|
10853
11016
|
async function runUpgradeOpenapi(opts) {
|
|
10854
11017
|
const { projectRoot, dryRun, force } = opts;
|
|
10855
11018
|
const changes = [];
|
|
10856
11019
|
for (const v of OPENAPI_VENDORED_FILES) {
|
|
10857
|
-
const target =
|
|
10858
|
-
const exists =
|
|
11020
|
+
const target = path24.join(projectRoot, v.target);
|
|
11021
|
+
const exists = fs13.existsSync(target);
|
|
10859
11022
|
const newContent = loadRuntimeFile2(v.runtime);
|
|
10860
11023
|
if (exists && !force) {
|
|
10861
|
-
const existing =
|
|
11024
|
+
const existing = fs13.readFileSync(target, "utf-8");
|
|
10862
11025
|
if (existing === newContent) {
|
|
10863
11026
|
changes.push({ path: v.target, action: "unchanged" });
|
|
10864
11027
|
} else {
|
|
@@ -10870,8 +11033,8 @@ async function runUpgradeOpenapi(opts) {
|
|
|
10870
11033
|
}
|
|
10871
11034
|
} else {
|
|
10872
11035
|
if (!dryRun) {
|
|
10873
|
-
|
|
10874
|
-
|
|
11036
|
+
fs13.mkdirSync(path24.dirname(target), { recursive: true });
|
|
11037
|
+
fs13.writeFileSync(target, newContent);
|
|
10875
11038
|
}
|
|
10876
11039
|
changes.push({
|
|
10877
11040
|
path: v.target,
|
|
@@ -10879,8 +11042,8 @@ async function runUpgradeOpenapi(opts) {
|
|
|
10879
11042
|
});
|
|
10880
11043
|
}
|
|
10881
11044
|
}
|
|
10882
|
-
const appModulePath =
|
|
10883
|
-
if (!
|
|
11045
|
+
const appModulePath = path24.join(projectRoot, "src", "app.module.ts");
|
|
11046
|
+
if (!fs13.existsSync(appModulePath)) {
|
|
10884
11047
|
return {
|
|
10885
11048
|
projectRoot,
|
|
10886
11049
|
changes,
|
|
@@ -10963,8 +11126,8 @@ async function runUpgradeOpenapi(opts) {
|
|
|
10963
11126
|
} else {
|
|
10964
11127
|
changes.push({ path: "src/app.module.ts", action: "unchanged" });
|
|
10965
11128
|
}
|
|
10966
|
-
const mainPath =
|
|
10967
|
-
if (
|
|
11129
|
+
const mainPath = path24.join(projectRoot, "src", "main.ts");
|
|
11130
|
+
if (fs13.existsSync(mainPath)) {
|
|
10968
11131
|
const mainSource = project.addSourceFileAtPath(mainPath);
|
|
10969
11132
|
const mainBefore = mainSource.getFullText();
|
|
10970
11133
|
const result = ensureMainSwaggerBlock(mainSource, {
|
|
@@ -11044,8 +11207,8 @@ var ProjectUpgradeOpenapiCommand = class extends Command4 {
|
|
|
11044
11207
|
json = Option4.Boolean("--json", false);
|
|
11045
11208
|
async execute() {
|
|
11046
11209
|
if (this.json) setJsonMode(true);
|
|
11047
|
-
const startDir = this.pathOpt ?
|
|
11048
|
-
if (!
|
|
11210
|
+
const startDir = this.pathOpt ? path24.resolve(this.pathOpt) : process.cwd();
|
|
11211
|
+
if (!fs13.existsSync(startDir)) {
|
|
11049
11212
|
printError(`Directory not found: ${startDir}`);
|
|
11050
11213
|
return 1;
|
|
11051
11214
|
}
|
|
@@ -11329,9 +11492,9 @@ var ProjectScanCommand = class extends Command5 {
|
|
|
11329
11492
|
cwd = Option5.String("--cwd", { required: false });
|
|
11330
11493
|
async execute() {
|
|
11331
11494
|
if (this.json) setJsonMode(true);
|
|
11332
|
-
const baseCwd = this.cwd ?
|
|
11333
|
-
const target = this.directory ?
|
|
11334
|
-
if (!
|
|
11495
|
+
const baseCwd = this.cwd ? path25.resolve(this.cwd) : process.cwd();
|
|
11496
|
+
const target = this.directory ? path25.resolve(baseCwd, this.directory) : baseCwd;
|
|
11497
|
+
if (!fs14.existsSync(target)) {
|
|
11335
11498
|
printError(`Directory not found: ${target}`);
|
|
11336
11499
|
return 1;
|
|
11337
11500
|
}
|
|
@@ -11381,8 +11544,8 @@ var ProjectScanCommand = class extends Command5 {
|
|
|
11381
11544
|
`architecture: ${profile.architecture.evidence.join(", ") || "\u2014"}`
|
|
11382
11545
|
]);
|
|
11383
11546
|
}
|
|
11384
|
-
const outPath =
|
|
11385
|
-
const existsNow =
|
|
11547
|
+
const outPath = path25.join(target, "codegen.config.yaml");
|
|
11548
|
+
const existsNow = fs14.existsSync(outPath);
|
|
11386
11549
|
if (this.dryRun) {
|
|
11387
11550
|
console.log("");
|
|
11388
11551
|
printInfo("Dry run \u2014 proposed codegen.config.yaml:");
|
|
@@ -11395,7 +11558,7 @@ var ProjectScanCommand = class extends Command5 {
|
|
|
11395
11558
|
printWarning(`${outPath} already exists \u2014 pass --force via edit; skipping.`);
|
|
11396
11559
|
return 0;
|
|
11397
11560
|
}
|
|
11398
|
-
|
|
11561
|
+
fs14.writeFileSync(outPath, yamlText);
|
|
11399
11562
|
printSuccess(`wrote ${outPath}`);
|
|
11400
11563
|
return 0;
|
|
11401
11564
|
}
|
|
@@ -11502,12 +11665,12 @@ var ProjectInspectCommand = class extends Command5 {
|
|
|
11502
11665
|
return 2;
|
|
11503
11666
|
}
|
|
11504
11667
|
resolveEntitiesDir(ctx) {
|
|
11505
|
-
if (this.dir) return
|
|
11506
|
-
return ctx.entitiesDir ??
|
|
11668
|
+
if (this.dir) return path25.resolve(ctx.cwd, this.dir);
|
|
11669
|
+
return ctx.entitiesDir ?? path25.resolve(ctx.cwd, "entities");
|
|
11507
11670
|
}
|
|
11508
11671
|
async runAnalysis(ctx, kind) {
|
|
11509
11672
|
const entitiesDir = this.resolveEntitiesDir(ctx);
|
|
11510
|
-
if (!entitiesDir || !
|
|
11673
|
+
if (!entitiesDir || !fs14.existsSync(entitiesDir)) {
|
|
11511
11674
|
printError(`Directory not found: ${entitiesDir ?? "(no entities/ dir)"}`);
|
|
11512
11675
|
return 1;
|
|
11513
11676
|
}
|
|
@@ -11537,7 +11700,7 @@ var ProjectInspectCommand = class extends Command5 {
|
|
|
11537
11700
|
out = formatConsole(filtered);
|
|
11538
11701
|
}
|
|
11539
11702
|
if (this.output) {
|
|
11540
|
-
|
|
11703
|
+
fs14.writeFileSync(this.output, out);
|
|
11541
11704
|
if (!isJsonMode()) printSuccess(`wrote ${this.output}`);
|
|
11542
11705
|
} else {
|
|
11543
11706
|
console.log(out);
|
|
@@ -11550,7 +11713,7 @@ var ProjectInspectCommand = class extends Command5 {
|
|
|
11550
11713
|
}
|
|
11551
11714
|
async runManifest(ctx) {
|
|
11552
11715
|
const entitiesDir = this.resolveEntitiesDir(ctx);
|
|
11553
|
-
if (!entitiesDir || !
|
|
11716
|
+
if (!entitiesDir || !fs14.existsSync(entitiesDir)) {
|
|
11554
11717
|
printError(`Directory not found: ${entitiesDir ?? "(no entities/ dir)"}`);
|
|
11555
11718
|
return 1;
|
|
11556
11719
|
}
|
|
@@ -11706,17 +11869,17 @@ var ProjectGraphCommand = class extends Command5 {
|
|
|
11706
11869
|
json: this.json,
|
|
11707
11870
|
skipDetection: true
|
|
11708
11871
|
});
|
|
11709
|
-
const entitiesDir = this.dir ?
|
|
11710
|
-
if (!
|
|
11872
|
+
const entitiesDir = this.dir ? path25.resolve(ctx.cwd, this.dir) : ctx.entitiesDir ?? path25.resolve(ctx.cwd, "entities");
|
|
11873
|
+
if (!fs14.existsSync(entitiesDir)) {
|
|
11711
11874
|
printError(`Entity directory not found: ${entitiesDir}`);
|
|
11712
11875
|
return 1;
|
|
11713
11876
|
}
|
|
11714
11877
|
const relCandidates = [
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11878
|
+
path25.resolve(path25.dirname(entitiesDir), "relationships"),
|
|
11879
|
+
path25.resolve(entitiesDir, "relationships"),
|
|
11880
|
+
path25.resolve(ctx.cwd, "relationships")
|
|
11718
11881
|
];
|
|
11719
|
-
const relationshipsDir = relCandidates.find((d) =>
|
|
11882
|
+
const relationshipsDir = relCandidates.find((d) => fs14.existsSync(d));
|
|
11720
11883
|
const result = await analyzeDomain(entitiesDir, relationshipsDir);
|
|
11721
11884
|
const serialized = serializeDomainGraph(result.graph);
|
|
11722
11885
|
if (isJsonMode()) {
|
|
@@ -11730,20 +11893,20 @@ var ProjectGraphCommand = class extends Command5 {
|
|
|
11730
11893
|
return 0;
|
|
11731
11894
|
}
|
|
11732
11895
|
if (this.output) {
|
|
11733
|
-
const outPath =
|
|
11734
|
-
|
|
11896
|
+
const outPath = path25.resolve(ctx.cwd, this.output);
|
|
11897
|
+
fs14.writeFileSync(outPath, JSON.stringify(serialized, null, 2));
|
|
11735
11898
|
printSuccess(`Graph written to ${outPath}`);
|
|
11736
11899
|
printInfo(`${result.entities.length} entities, ${result.relationshipDefinitions.length} relationships, ${result.graph.edges.length} edges`);
|
|
11737
11900
|
return 0;
|
|
11738
11901
|
}
|
|
11739
11902
|
const os = await import("os");
|
|
11740
|
-
const tmpDir =
|
|
11741
|
-
const graphPath =
|
|
11742
|
-
|
|
11743
|
-
const viewerDir =
|
|
11744
|
-
const viewerDist =
|
|
11745
|
-
if (
|
|
11746
|
-
|
|
11903
|
+
const tmpDir = fs14.mkdtempSync(path25.join(os.default.tmpdir(), "codegen-graph-"));
|
|
11904
|
+
const graphPath = path25.join(tmpDir, "graph.json");
|
|
11905
|
+
fs14.writeFileSync(graphPath, JSON.stringify(serialized, null, 2));
|
|
11906
|
+
const viewerDir = path25.resolve(import.meta.dirname, "..", "..", "..", "tools", "schema-graph-viewer");
|
|
11907
|
+
const viewerDist = path25.join(viewerDir, "dist", "index.html");
|
|
11908
|
+
if (fs14.existsSync(viewerDist)) {
|
|
11909
|
+
fs14.copyFileSync(graphPath, path25.join(viewerDir, "dist", "graph.json"));
|
|
11747
11910
|
printSuccess("Graph exported");
|
|
11748
11911
|
printInfo(`${result.entities.length} entities, ${result.relationshipDefinitions.length} relationships, ${result.graph.edges.length} edges`);
|
|
11749
11912
|
printInfo(`Graph JSON: ${graphPath}`);
|
|
@@ -11773,8 +11936,8 @@ var projectNoun = {
|
|
|
11773
11936
|
var project_default = projectNoun;
|
|
11774
11937
|
|
|
11775
11938
|
// src/cli/commands/dev.ts
|
|
11776
|
-
import
|
|
11777
|
-
import
|
|
11939
|
+
import fs15 from "fs";
|
|
11940
|
+
import path26 from "path";
|
|
11778
11941
|
import { execSync as execSync3, spawn, spawnSync } from "child_process";
|
|
11779
11942
|
import { Command as Command6, Option as Option6 } from "clipanion";
|
|
11780
11943
|
var DEFAULT_APP_PORT = 3e3;
|
|
@@ -11807,33 +11970,33 @@ function getRedisPort(_ctx) {
|
|
|
11807
11970
|
return Number(process.env.DEV_REDIS_PORT ?? DEFAULT_REDIS_PORT);
|
|
11808
11971
|
}
|
|
11809
11972
|
function composeFilePath(cwd) {
|
|
11810
|
-
const devPath =
|
|
11811
|
-
if (
|
|
11812
|
-
const rootPath =
|
|
11813
|
-
if (
|
|
11973
|
+
const devPath = path26.join(cwd, COMPOSE_FILE);
|
|
11974
|
+
if (fs15.existsSync(devPath)) return devPath;
|
|
11975
|
+
const rootPath = path26.join(cwd, "docker-compose.yml");
|
|
11976
|
+
if (fs15.existsSync(rootPath)) return rootPath;
|
|
11814
11977
|
return devPath;
|
|
11815
11978
|
}
|
|
11816
11979
|
function pidFilePath(cwd) {
|
|
11817
|
-
return
|
|
11980
|
+
return path26.join(cwd, PID_FILE);
|
|
11818
11981
|
}
|
|
11819
11982
|
function readAppPid(cwd) {
|
|
11820
11983
|
const p = pidFilePath(cwd);
|
|
11821
|
-
if (!
|
|
11822
|
-
const pid = parseInt(
|
|
11984
|
+
if (!fs15.existsSync(p)) return null;
|
|
11985
|
+
const pid = parseInt(fs15.readFileSync(p, "utf-8").trim(), 10);
|
|
11823
11986
|
if (isNaN(pid)) return null;
|
|
11824
11987
|
try {
|
|
11825
11988
|
process.kill(pid, 0);
|
|
11826
11989
|
return pid;
|
|
11827
11990
|
} catch {
|
|
11828
|
-
|
|
11991
|
+
fs15.rmSync(p, { force: true });
|
|
11829
11992
|
return null;
|
|
11830
11993
|
}
|
|
11831
11994
|
}
|
|
11832
11995
|
function writeAppPid(cwd, pid) {
|
|
11833
|
-
|
|
11996
|
+
fs15.writeFileSync(pidFilePath(cwd), String(pid));
|
|
11834
11997
|
}
|
|
11835
11998
|
function clearAppPid(cwd) {
|
|
11836
|
-
|
|
11999
|
+
fs15.rmSync(pidFilePath(cwd), { force: true });
|
|
11837
12000
|
}
|
|
11838
12001
|
function checkPostgres(cwd, port) {
|
|
11839
12002
|
const r = runCmd(`docker exec codegen-dev-postgres pg_isready -U postgres`, cwd, {
|
|
@@ -11873,8 +12036,8 @@ function checkApp(cwd, port) {
|
|
|
11873
12036
|
};
|
|
11874
12037
|
}
|
|
11875
12038
|
function listEntityNames(ctx) {
|
|
11876
|
-
if (!ctx.entitiesDir || !
|
|
11877
|
-
return
|
|
12039
|
+
if (!ctx.entitiesDir || !fs15.existsSync(ctx.entitiesDir)) return [];
|
|
12040
|
+
return fs15.readdirSync(ctx.entitiesDir).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml")).map((f) => f.replace(/\.ya?ml$/, ""));
|
|
11878
12041
|
}
|
|
11879
12042
|
function formatServiceLine(svc) {
|
|
11880
12043
|
const icon = svc.healthy ? theme.success(icons.check) : theme.error(icons.error);
|
|
@@ -11883,8 +12046,8 @@ function formatServiceLine(svc) {
|
|
|
11883
12046
|
return `${icon} ${svc.name.padEnd(12)} ${theme.muted(`${svc.host}:${svc.port}`)} ${status}${pidStr}`;
|
|
11884
12047
|
}
|
|
11885
12048
|
function ensureComposeFile(cwd, pgPort, redisPort) {
|
|
11886
|
-
const composePath =
|
|
11887
|
-
if (
|
|
12049
|
+
const composePath = path26.join(cwd, COMPOSE_FILE);
|
|
12050
|
+
if (fs15.existsSync(composePath)) return composePath;
|
|
11888
12051
|
const content = `# Auto-generated by codegen dev
|
|
11889
12052
|
# Ports offset from defaults to avoid conflicts with other local services.
|
|
11890
12053
|
services:
|
|
@@ -11919,7 +12082,7 @@ services:
|
|
|
11919
12082
|
volumes:
|
|
11920
12083
|
codegen-dev-pgdata:
|
|
11921
12084
|
`;
|
|
11922
|
-
|
|
12085
|
+
fs15.writeFileSync(composePath, content);
|
|
11923
12086
|
return composePath;
|
|
11924
12087
|
}
|
|
11925
12088
|
var DevUpCommand = class extends Command6 {
|
|
@@ -11968,7 +12131,7 @@ var DevUpCommand = class extends Command6 {
|
|
|
11968
12131
|
if (!pgReady) printWarning("postgres did not become healthy in time");
|
|
11969
12132
|
if (!redisReady) printWarning("redis did not become healthy in time");
|
|
11970
12133
|
const drizzleConfig = ["drizzle.config.ts", "drizzle.config.js"].find(
|
|
11971
|
-
(f) =>
|
|
12134
|
+
(f) => fs15.existsSync(path26.join(ctx.cwd, f))
|
|
11972
12135
|
);
|
|
11973
12136
|
if (drizzleConfig) {
|
|
11974
12137
|
if (!isJsonMode()) printInfo("pushing database schema...");
|
|
@@ -11988,8 +12151,8 @@ var DevUpCommand = class extends Command6 {
|
|
|
11988
12151
|
if (!isJsonMode()) printInfo("starting NestJS app...");
|
|
11989
12152
|
const dbUrl = `postgres://postgres:postgres@localhost:${pgPort}/codegen_dev`;
|
|
11990
12153
|
const redisUrl = `redis://localhost:${redisPort}`;
|
|
11991
|
-
const logFile =
|
|
11992
|
-
const logFd =
|
|
12154
|
+
const logFile = path26.join(ctx.cwd, ".dev-app.log");
|
|
12155
|
+
const logFd = fs15.openSync(logFile, "a");
|
|
11993
12156
|
const child = spawn("bun", ["src/main.ts"], {
|
|
11994
12157
|
cwd: ctx.cwd,
|
|
11995
12158
|
detached: true,
|
|
@@ -12002,7 +12165,7 @@ var DevUpCommand = class extends Command6 {
|
|
|
12002
12165
|
}
|
|
12003
12166
|
});
|
|
12004
12167
|
child.unref();
|
|
12005
|
-
|
|
12168
|
+
fs15.closeSync(logFd);
|
|
12006
12169
|
if (child.pid) {
|
|
12007
12170
|
writeAppPid(ctx.cwd, child.pid);
|
|
12008
12171
|
spawnSync("sleep", ["2"]);
|
|
@@ -12146,8 +12309,8 @@ var DevLogsCommand = class extends Command6 {
|
|
|
12146
12309
|
}
|
|
12147
12310
|
return 0;
|
|
12148
12311
|
}
|
|
12149
|
-
const logFile =
|
|
12150
|
-
if (!
|
|
12312
|
+
const logFile = path26.join(ctx.cwd, ".dev-app.log");
|
|
12313
|
+
if (!fs15.existsSync(logFile)) {
|
|
12151
12314
|
printInfo("no app logs found \u2014 is the app running?");
|
|
12152
12315
|
return 0;
|
|
12153
12316
|
}
|
|
@@ -12190,8 +12353,8 @@ var DevRestartCommand = class extends Command6 {
|
|
|
12190
12353
|
spawnSync("sleep", ["1"]);
|
|
12191
12354
|
const dbUrl = `postgres://postgres:postgres@localhost:${pgPort}/codegen_dev`;
|
|
12192
12355
|
const redisUrl = `redis://localhost:${redisPort}`;
|
|
12193
|
-
const logFile =
|
|
12194
|
-
const logFd =
|
|
12356
|
+
const logFile = path26.join(ctx.cwd, ".dev-app.log");
|
|
12357
|
+
const logFd = fs15.openSync(logFile, "a");
|
|
12195
12358
|
const child = spawn("bun", ["src/main.ts"], {
|
|
12196
12359
|
cwd: ctx.cwd,
|
|
12197
12360
|
detached: true,
|
|
@@ -12204,7 +12367,7 @@ var DevRestartCommand = class extends Command6 {
|
|
|
12204
12367
|
}
|
|
12205
12368
|
});
|
|
12206
12369
|
child.unref();
|
|
12207
|
-
|
|
12370
|
+
fs15.closeSync(logFd);
|
|
12208
12371
|
if (child.pid) {
|
|
12209
12372
|
writeAppPid(ctx.cwd, child.pid);
|
|
12210
12373
|
spawnSync("sleep", ["2"]);
|
|
@@ -12319,15 +12482,15 @@ var devNoun = {
|
|
|
12319
12482
|
var dev_default = devNoun;
|
|
12320
12483
|
|
|
12321
12484
|
// src/cli/commands/relationship.ts
|
|
12322
|
-
import
|
|
12323
|
-
import
|
|
12485
|
+
import fs16 from "fs";
|
|
12486
|
+
import path27 from "path";
|
|
12324
12487
|
import { Command as Command7, Option as Option7 } from "clipanion";
|
|
12325
12488
|
function listRelationshipYamls2(dir) {
|
|
12326
|
-
if (!
|
|
12327
|
-
return
|
|
12328
|
-
const fullPath =
|
|
12489
|
+
if (!fs16.existsSync(dir)) return [];
|
|
12490
|
+
return fs16.readdirSync(dir).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml")).filter((f) => {
|
|
12491
|
+
const fullPath = path27.join(dir, f);
|
|
12329
12492
|
return detectYamlType(fullPath) === "relationship";
|
|
12330
|
-
}).map((f) =>
|
|
12493
|
+
}).map((f) => path27.join(dir, f));
|
|
12331
12494
|
}
|
|
12332
12495
|
function summarizeRelationshipFile(filePath) {
|
|
12333
12496
|
const result = loadRelationshipFromYaml(filePath);
|
|
@@ -12348,7 +12511,7 @@ function padRight2(s, n) {
|
|
|
12348
12511
|
return s.length >= n ? s : s + " ".repeat(n - s.length);
|
|
12349
12512
|
}
|
|
12350
12513
|
async function summary5(ctx) {
|
|
12351
|
-
const relDir =
|
|
12514
|
+
const relDir = path27.resolve(ctx.cwd, "relationships");
|
|
12352
12515
|
const files = listRelationshipYamls2(relDir);
|
|
12353
12516
|
if (files.length === 0) {
|
|
12354
12517
|
return {
|
|
@@ -12418,14 +12581,14 @@ var RelationshipNewCommand = class extends Command7 {
|
|
|
12418
12581
|
}
|
|
12419
12582
|
let targets = [];
|
|
12420
12583
|
if (this.all) {
|
|
12421
|
-
const dir =
|
|
12584
|
+
const dir = path27.resolve(ctx.cwd, "relationships");
|
|
12422
12585
|
targets = listRelationshipYamls2(dir);
|
|
12423
12586
|
if (targets.length === 0) {
|
|
12424
12587
|
printError(`No relationship YAML files found in ${dir}`);
|
|
12425
12588
|
return 1;
|
|
12426
12589
|
}
|
|
12427
12590
|
} else if (this.yaml) {
|
|
12428
|
-
targets = [
|
|
12591
|
+
targets = [path27.resolve(ctx.cwd, this.yaml)];
|
|
12429
12592
|
} else {
|
|
12430
12593
|
printError("Missing YAML path. Pass a file or --all.");
|
|
12431
12594
|
return 2;
|
|
@@ -12442,7 +12605,7 @@ var RelationshipNewCommand = class extends Command7 {
|
|
|
12442
12605
|
}
|
|
12443
12606
|
if (invalid.length > 0) {
|
|
12444
12607
|
for (const i of invalid) {
|
|
12445
|
-
printError(`${
|
|
12608
|
+
printError(`${path27.basename(i.file)} \u2014 ${i.message}`);
|
|
12446
12609
|
}
|
|
12447
12610
|
if (!isJsonMode()) return 1;
|
|
12448
12611
|
}
|
|
@@ -12473,7 +12636,7 @@ var RelationshipNewCommand = class extends Command7 {
|
|
|
12473
12636
|
}
|
|
12474
12637
|
const succeeded = [];
|
|
12475
12638
|
const failed = [
|
|
12476
|
-
...invalid.map((i) => ({ name:
|
|
12639
|
+
...invalid.map((i) => ({ name: path27.basename(i.file), file: i.file, message: i.message }))
|
|
12477
12640
|
];
|
|
12478
12641
|
for (const v of validated) {
|
|
12479
12642
|
if (!isJsonMode()) {
|
|
@@ -12492,8 +12655,8 @@ var RelationshipNewCommand = class extends Command7 {
|
|
|
12492
12655
|
if (!isJsonMode()) printError(`${v.name} \u2014 ${res.stderr ?? "failed"}`);
|
|
12493
12656
|
}
|
|
12494
12657
|
}
|
|
12495
|
-
const entitiesDir = ctx.entitiesDir ??
|
|
12496
|
-
const relationshipsDir =
|
|
12658
|
+
const entitiesDir = ctx.entitiesDir ?? path27.resolve(ctx.cwd, "entities");
|
|
12659
|
+
const relationshipsDir = path27.resolve(ctx.cwd, "relationships");
|
|
12497
12660
|
const generatedDir = resolveGeneratedDir(ctx);
|
|
12498
12661
|
const architecture = resolveArchitecture(ctx);
|
|
12499
12662
|
let barrelResult = null;
|
|
@@ -12538,7 +12701,7 @@ var RelationshipNewCommand = class extends Command7 {
|
|
|
12538
12701
|
}
|
|
12539
12702
|
if (barrelResult) {
|
|
12540
12703
|
printInfo(
|
|
12541
|
-
`barrels regenerated (${barrelResult.entityCount} modules) \u2192 ${
|
|
12704
|
+
`barrels regenerated (${barrelResult.entityCount} modules) \u2192 ${path27.relative(ctx.cwd, barrelResult.modulesBarrel)}, ${path27.relative(ctx.cwd, barrelResult.schemaBarrel)}`
|
|
12542
12705
|
);
|
|
12543
12706
|
}
|
|
12544
12707
|
}
|
|
@@ -12561,7 +12724,7 @@ var RelationshipListCommand = class extends Command7 {
|
|
|
12561
12724
|
json: this.json,
|
|
12562
12725
|
skipDetection: true
|
|
12563
12726
|
});
|
|
12564
|
-
const relDir =
|
|
12727
|
+
const relDir = path27.resolve(ctx.cwd, "relationships");
|
|
12565
12728
|
const files = listRelationshipYamls2(relDir);
|
|
12566
12729
|
if (files.length === 0) {
|
|
12567
12730
|
printInfo("No relationship definitions found.");
|
|
@@ -12601,7 +12764,7 @@ var relationshipNoun = {
|
|
|
12601
12764
|
var relationship_default = relationshipNoun;
|
|
12602
12765
|
|
|
12603
12766
|
// src/cli/commands/junction.ts
|
|
12604
|
-
import
|
|
12767
|
+
import path28 from "path";
|
|
12605
12768
|
import { Command as Command8, Option as Option8 } from "clipanion";
|
|
12606
12769
|
function summarizeJunctionFile(filePath) {
|
|
12607
12770
|
const result = loadJunctionFromYaml(filePath);
|
|
@@ -12624,7 +12787,7 @@ function padRight3(s, n) {
|
|
|
12624
12787
|
return s.length >= n ? s : s + " ".repeat(n - s.length);
|
|
12625
12788
|
}
|
|
12626
12789
|
async function summary6(ctx) {
|
|
12627
|
-
const junctionDir =
|
|
12790
|
+
const junctionDir = path28.resolve(ctx.cwd, "junctions");
|
|
12628
12791
|
const files = listJunctionYamls(junctionDir);
|
|
12629
12792
|
if (files.length === 0) {
|
|
12630
12793
|
return {
|
|
@@ -12694,14 +12857,14 @@ var JunctionNewCommand = class extends Command8 {
|
|
|
12694
12857
|
}
|
|
12695
12858
|
let targets = [];
|
|
12696
12859
|
if (this.all) {
|
|
12697
|
-
const dir =
|
|
12860
|
+
const dir = path28.resolve(ctx.cwd, "junctions");
|
|
12698
12861
|
targets = listJunctionYamls(dir);
|
|
12699
12862
|
if (targets.length === 0) {
|
|
12700
12863
|
printError(`No junction YAML files found in ${dir}`);
|
|
12701
12864
|
return 1;
|
|
12702
12865
|
}
|
|
12703
12866
|
} else if (this.yaml) {
|
|
12704
|
-
targets = [
|
|
12867
|
+
targets = [path28.resolve(ctx.cwd, this.yaml)];
|
|
12705
12868
|
} else {
|
|
12706
12869
|
printError("Missing YAML path. Pass a file or --all.");
|
|
12707
12870
|
return 2;
|
|
@@ -12720,7 +12883,7 @@ var JunctionNewCommand = class extends Command8 {
|
|
|
12720
12883
|
}
|
|
12721
12884
|
if (invalid.length > 0) {
|
|
12722
12885
|
for (const i of invalid) {
|
|
12723
|
-
printError(`${
|
|
12886
|
+
printError(`${path28.basename(i.file)} \u2014 ${i.message}`);
|
|
12724
12887
|
}
|
|
12725
12888
|
if (!isJsonMode()) return 1;
|
|
12726
12889
|
}
|
|
@@ -12751,7 +12914,7 @@ var JunctionNewCommand = class extends Command8 {
|
|
|
12751
12914
|
}
|
|
12752
12915
|
const succeeded = [];
|
|
12753
12916
|
const failed = [
|
|
12754
|
-
...invalid.map((i) => ({ name:
|
|
12917
|
+
...invalid.map((i) => ({ name: path28.basename(i.file), file: i.file, message: i.message }))
|
|
12755
12918
|
];
|
|
12756
12919
|
for (const v of validated) {
|
|
12757
12920
|
if (!isJsonMode()) {
|
|
@@ -12770,9 +12933,9 @@ var JunctionNewCommand = class extends Command8 {
|
|
|
12770
12933
|
if (!isJsonMode()) printError(`${v.name} \u2014 ${res.stderr ?? "failed"}`);
|
|
12771
12934
|
}
|
|
12772
12935
|
}
|
|
12773
|
-
const entitiesDir = ctx.entitiesDir ??
|
|
12774
|
-
const relationshipsDir =
|
|
12775
|
-
const junctionsDir =
|
|
12936
|
+
const entitiesDir = ctx.entitiesDir ?? path28.resolve(ctx.cwd, "entities");
|
|
12937
|
+
const relationshipsDir = path28.resolve(ctx.cwd, "relationships");
|
|
12938
|
+
const junctionsDir = path28.resolve(ctx.cwd, "junctions");
|
|
12776
12939
|
const generatedDir = resolveGeneratedDir(ctx);
|
|
12777
12940
|
const architecture = resolveArchitecture(ctx);
|
|
12778
12941
|
let barrelResult = null;
|
|
@@ -12818,7 +12981,7 @@ var JunctionNewCommand = class extends Command8 {
|
|
|
12818
12981
|
}
|
|
12819
12982
|
if (barrelResult) {
|
|
12820
12983
|
printInfo(
|
|
12821
|
-
`barrels regenerated (${barrelResult.entityCount} modules) \u2192 ${
|
|
12984
|
+
`barrels regenerated (${barrelResult.entityCount} modules) \u2192 ${path28.relative(ctx.cwd, barrelResult.modulesBarrel)}, ${path28.relative(ctx.cwd, barrelResult.schemaBarrel)}`
|
|
12822
12985
|
);
|
|
12823
12986
|
}
|
|
12824
12987
|
}
|
|
@@ -12841,7 +13004,7 @@ var JunctionListCommand = class extends Command8 {
|
|
|
12841
13004
|
json: this.json,
|
|
12842
13005
|
skipDetection: true
|
|
12843
13006
|
});
|
|
12844
|
-
const junctionDir =
|
|
13007
|
+
const junctionDir = path28.resolve(ctx.cwd, "junctions");
|
|
12845
13008
|
const files = listJunctionYamls(junctionDir);
|
|
12846
13009
|
if (files.length === 0) {
|
|
12847
13010
|
printInfo("No junction definitions found.");
|
|
@@ -12881,8 +13044,8 @@ var junctionNoun = {
|
|
|
12881
13044
|
var junction_default = junctionNoun;
|
|
12882
13045
|
|
|
12883
13046
|
// src/cli/commands/events.ts
|
|
12884
|
-
import
|
|
12885
|
-
import
|
|
13047
|
+
import fs17 from "fs";
|
|
13048
|
+
import path29 from "path";
|
|
12886
13049
|
import ts2 from "typescript";
|
|
12887
13050
|
import { Command as Command9, Option as Option9 } from "clipanion";
|
|
12888
13051
|
function scanSourceFileForConsumers(sourceFile, filePath, eventType) {
|
|
@@ -12981,7 +13144,7 @@ function scanDirectoryForConsumers(rootDir, eventType) {
|
|
|
12981
13144
|
const tier1 = [];
|
|
12982
13145
|
let hasEventFlowImport = false;
|
|
12983
13146
|
for (const filePath of files) {
|
|
12984
|
-
const text2 =
|
|
13147
|
+
const text2 = fs17.readFileSync(filePath, "utf8");
|
|
12985
13148
|
const sourceFile = ts2.createSourceFile(
|
|
12986
13149
|
filePath,
|
|
12987
13150
|
text2,
|
|
@@ -13018,7 +13181,7 @@ function suggestEventTypes(target, known, limit = 3) {
|
|
|
13018
13181
|
return known.map((t) => ({ t, d: levenshtein(target, t) })).sort((a, b) => a.d - b.d).slice(0, limit).map((x) => x.t);
|
|
13019
13182
|
}
|
|
13020
13183
|
function renderConsumerReport(result, cwd) {
|
|
13021
|
-
const rel = (p) =>
|
|
13184
|
+
const rel = (p) => path29.relative(cwd, p) || p;
|
|
13022
13185
|
const lines = [];
|
|
13023
13186
|
const total = result.tier3.length + result.tier2.length + result.tier1.length;
|
|
13024
13187
|
lines.push(`Event: ${result.eventType}`);
|
|
@@ -13054,7 +13217,7 @@ function renderConsumerReport(result, cwd) {
|
|
|
13054
13217
|
return lines;
|
|
13055
13218
|
}
|
|
13056
13219
|
function runConsumersScan(opts) {
|
|
13057
|
-
const scanRoot = opts.scanRoot ??
|
|
13220
|
+
const scanRoot = opts.scanRoot ?? path29.join(opts.cwd, "src");
|
|
13058
13221
|
const handlersDir = opts.handlersDir ?? scanRoot;
|
|
13059
13222
|
const allTriggers = scanHandlerFiles(handlersDir);
|
|
13060
13223
|
const tier3 = allTriggers.filter((t) => t.event === opts.eventType).map((t) => ({
|
|
@@ -13063,8 +13226,8 @@ function runConsumersScan(opts) {
|
|
|
13063
13226
|
sourceFile: t.sourceFile,
|
|
13064
13227
|
sourceLine: t.sourceLine
|
|
13065
13228
|
}));
|
|
13066
|
-
const tier21 =
|
|
13067
|
-
const eventsGeneratedDir = opts.eventsGeneratedDir ??
|
|
13229
|
+
const tier21 = fs17.existsSync(scanRoot) ? scanDirectoryForConsumers(scanRoot, opts.eventType) : { tier2: [], tier1: [], hasEventFlowImport: false };
|
|
13230
|
+
const eventsGeneratedDir = opts.eventsGeneratedDir ?? path29.join(
|
|
13068
13231
|
resolveSubsystemsRootFromContext(opts.cwd, opts.config),
|
|
13069
13232
|
"events",
|
|
13070
13233
|
"generated"
|
|
@@ -13085,11 +13248,11 @@ function runConsumersScan(opts) {
|
|
|
13085
13248
|
function resolveSubsystemsRootFromContext(cwd, config) {
|
|
13086
13249
|
const configured = config?.paths?.subsystems;
|
|
13087
13250
|
if (typeof configured === "string" && configured.length > 0) {
|
|
13088
|
-
return
|
|
13251
|
+
return path29.resolve(cwd, configured);
|
|
13089
13252
|
}
|
|
13090
13253
|
const backendSrc = config?.paths?.backend_src;
|
|
13091
13254
|
const base = typeof backendSrc === "string" && backendSrc.length > 0 ? backendSrc : "src";
|
|
13092
|
-
return
|
|
13255
|
+
return path29.resolve(cwd, base, "shared", "subsystems");
|
|
13093
13256
|
}
|
|
13094
13257
|
var EventsConsumersCommand = class extends Command9 {
|
|
13095
13258
|
static paths = [["events", "consumers"]];
|
|
@@ -13178,7 +13341,7 @@ var eventsNoun = {
|
|
|
13178
13341
|
var events_default = eventsNoun;
|
|
13179
13342
|
|
|
13180
13343
|
// src/cli/commands/orchestration.ts
|
|
13181
|
-
import
|
|
13344
|
+
import path30 from "path";
|
|
13182
13345
|
import { Command as Command10, Option as Option10 } from "clipanion";
|
|
13183
13346
|
var DEFAULT_PATTERN_GLOBS = ["src/patterns/*.pattern.ts"];
|
|
13184
13347
|
function resolvePatternGlobs(ctx) {
|
|
@@ -13192,10 +13355,10 @@ function resolveOrchestrationOutputRoot(ctx) {
|
|
|
13192
13355
|
const paths = ctx.config?.paths;
|
|
13193
13356
|
const explicit = paths?.orchestration_src;
|
|
13194
13357
|
if (typeof explicit === "string" && explicit.length > 0) {
|
|
13195
|
-
return
|
|
13358
|
+
return path30.resolve(ctx.cwd, explicit);
|
|
13196
13359
|
}
|
|
13197
13360
|
const backendSrc = typeof paths?.backend_src === "string" && paths.backend_src.length > 0 ? paths.backend_src : "app/backend/src";
|
|
13198
|
-
return
|
|
13361
|
+
return path30.resolve(ctx.cwd, backendSrc, "orchestration");
|
|
13199
13362
|
}
|
|
13200
13363
|
async function reloadRegistry(ctx) {
|
|
13201
13364
|
_resetRegistryForTests({ includeLibrary: false });
|
|
@@ -13284,12 +13447,12 @@ var OrchestrationGenCommand = class extends Command10 {
|
|
|
13284
13447
|
);
|
|
13285
13448
|
for (const f of result.files) {
|
|
13286
13449
|
console.log(
|
|
13287
|
-
` ${theme.muted(icons.arrow)} ${
|
|
13450
|
+
` ${theme.muted(icons.arrow)} ${path30.relative(ctx.cwd, f.outputPath)}`
|
|
13288
13451
|
);
|
|
13289
13452
|
}
|
|
13290
13453
|
} else {
|
|
13291
13454
|
printSuccess(
|
|
13292
|
-
`Emitted ${result.files.length} file(s) across ${targets.length} pattern(s) \u2192 ${
|
|
13455
|
+
`Emitted ${result.files.length} file(s) across ${targets.length} pattern(s) \u2192 ${path30.relative(ctx.cwd, outputRoot)}`
|
|
13293
13456
|
);
|
|
13294
13457
|
}
|
|
13295
13458
|
return 0;
|