@supacloud/cli 0.48.0 → 0.48.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +273 -81
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -183699,8 +183699,8 @@ function registerAiTools(server2) {
183699
183699
 
183700
183700
  // src/shared/tools/app-tools.ts
183701
183701
  import { existsSync as existsSync9 } from "node:fs";
183702
- import { mkdir as mkdir2, readFile, writeFile as writeFile2 } from "node:fs/promises";
183703
- import { dirname as dirname4, join as join7, resolve as resolve8 } from "node:path";
183702
+ import { mkdir as mkdir2, readFile, writeFile } from "node:fs/promises";
183703
+ import { dirname as dirname5, join as join7, resolve as resolve8 } from "node:path";
183704
183704
 
183705
183705
  // node_modules/@supacloud/compiler/dist/index.js
183706
183706
  var ts3 = __toESM(require_typescript(), 1);
@@ -183712,14 +183712,16 @@ import { createHash as createHash22 } from "node:crypto";
183712
183712
  import { existsSync as existsSync8, readFileSync as readFileSync6 } from "node:fs";
183713
183713
  import { dirname as dirname3, join as join6, resolve as resolve7 } from "node:path";
183714
183714
  import { createHash as createHash4 } from "node:crypto";
183715
+ var ts4 = __toESM(require_typescript(), 1);
183715
183716
  import { createHash as createHash42 } from "node:crypto";
183716
- import { access, mkdir, rename, unlink, writeFile } from "node:fs/promises";
183717
+ import { access, mkdir, rename as rename2, unlink as unlink2, writeFile as writeFile2 } from "node:fs/promises";
183717
183718
  import { join as join22 } from "node:path";
183718
- var ts4 = __toESM(require_typescript(), 1);
183719
+ import { dirname as dirname32, relative as relative32, sep as sep32 } from "node:path";
183720
+ var ts5 = __toESM(require_typescript(), 1);
183719
183721
  import { existsSync as existsSync22, readFileSync as readFileSync22 } from "node:fs";
183720
- import { dirname as dirname22, join as join32, relative as relative22, resolve as resolve22, sep as sep22 } from "node:path";
183722
+ import { dirname as dirname4, join as join32, relative as relative4, resolve as resolve32, sep as sep4 } from "node:path";
183721
183723
  import { existsSync as existsSync52 } from "node:fs";
183722
- import { join as join62, resolve as resolve52 } from "node:path";
183724
+ import { join as join62, resolve as resolve62 } from "node:path";
183723
183725
  import { pathToFileURL } from "node:url";
183724
183726
 
183725
183727
  class TraitCompiler {
@@ -183811,6 +183813,15 @@ function createDefaultTraitHandlers() {
183811
183813
  return initializer && ts.isCallExpression(initializer) && expressionName(initializer.expression) === "defineModule" ? node.name.text : undefined;
183812
183814
  }
183813
183815
  },
183816
+ {
183817
+ kind: "defineFeatureSlice",
183818
+ detect: (node) => {
183819
+ if (!ts.isVariableDeclaration(node) || !ts.isIdentifier(node.name))
183820
+ return;
183821
+ const initializer = node.initializer;
183822
+ return initializer && ts.isCallExpression(initializer) && expressionName(initializer.expression) === "defineFeatureSlice" ? node.name.text : undefined;
183823
+ }
183824
+ },
183814
183825
  {
183815
183826
  kind: "injectionToken",
183816
183827
  detect: (node) => {
@@ -184153,6 +184164,7 @@ async function analyzeProject(rootDir, include, cache, changedPaths) {
184153
184164
  checker,
184154
184165
  tokensByName: new Map,
184155
184166
  classesByName: new Map,
184167
+ variablesByName: new Map,
184156
184168
  diagnostics: []
184157
184169
  };
184158
184170
  const nativeTraitFiles = new Map;
@@ -184187,9 +184199,9 @@ async function analyzeProject(rootDir, include, cache, changedPaths) {
184187
184199
  });
184188
184200
  }
184189
184201
  }
184190
- if (!cache || traits?.has("defineModule")) {
184202
+ if (!cache || traits?.has("defineModule") || traits?.has("defineFeatureSlice")) {
184191
184203
  for (const call of descendantsOfKind(sf, ts3.isCallExpression)) {
184192
- if (nodeText(call.expression) !== "defineModule")
184204
+ if (!["defineModule", "defineFeatureSlice"].includes(nodeText(call.expression)))
184193
184205
  continue;
184194
184206
  const parent = call.parent;
184195
184207
  if (!parent || !ts3.isVariableDeclaration(parent))
@@ -184495,6 +184507,9 @@ function indexFile(sf, ctx) {
184495
184507
  }
184496
184508
  for (const statement of sf.statements.filter(ts3.isVariableStatement)) {
184497
184509
  for (const decl of statement.declarationList.declarations) {
184510
+ if (ts3.isIdentifier(decl.name) && !ctx.variablesByName.has(decl.name.text)) {
184511
+ ctx.variablesByName.set(decl.name.text, decl);
184512
+ }
184498
184513
  const info = parseTokenVariable(decl, sf.fileName);
184499
184514
  if (info && !ctx.tokensByName.has(info.name)) {
184500
184515
  ctx.tokensByName.set(info.name, info);
@@ -184522,8 +184537,8 @@ function parseTokenVariable(decl, file) {
184522
184537
  if (providedIn === "root") {
184523
184538
  info.providedIn = "root";
184524
184539
  }
184525
- const factory = getProp(optionsArg, "factory");
184526
- if (factory) {
184540
+ const factory2 = getProp(optionsArg, "factory");
184541
+ if (factory2) {
184527
184542
  info.hasFactory = true;
184528
184543
  }
184529
184544
  }
@@ -184532,6 +184547,7 @@ function parseTokenVariable(decl, file) {
184532
184547
  function parseModule(candidate, nameByNode, ctx) {
184533
184548
  const { options, className, file, line } = candidate;
184534
184549
  const name = nameByNode.get(candidate.node) ?? className;
184550
+ const featureSpec = parseFeatureSpec(getProp(options, "spec"), ctx);
184535
184551
  const tags = arrayProp(options, "tags").map((el) => ts3.isStringLiteral(el) ? el.text : nodeText(el).replace(/['"]/g, "")).filter(Boolean);
184536
184552
  const aspects = parseAspectRefs(getProp(options, "aspects"), ctx, `module ${name}`);
184537
184553
  const imports = arrayProp(options, "imports").map((el) => {
@@ -184706,8 +184722,71 @@ function parseModule(candidate, nameByNode, ctx) {
184706
184722
  jobs,
184707
184723
  queries,
184708
184724
  ...aspects.length > 0 ? { aspects } : {},
184709
- exports
184725
+ exports,
184726
+ ...featureSpec ? { featureSpec } : {}
184727
+ };
184728
+ }
184729
+ function parseFeatureSpec(input, ctx, seen = new Set) {
184730
+ if (!input)
184731
+ return;
184732
+ if (seen.has(input))
184733
+ return;
184734
+ seen.add(input);
184735
+ if (ts3.isIdentifier(input)) {
184736
+ const local = input.getSourceFile().statements.flatMap((statement) => ts3.isVariableStatement(statement) ? [...statement.declarationList.declarations] : []);
184737
+ const resolved = resolveDeclaration(input, ctx)[0];
184738
+ const decl = (resolved && ts3.isVariableDeclaration(resolved) ? resolved : undefined) ?? ctx.variablesByName.get(input.text) ?? local.find((candidate) => ts3.isIdentifier(candidate.name) && candidate.name.text === input.text) ?? descendantsOfKind(input.getSourceFile(), ts3.isVariableDeclaration).find((candidate) => ts3.isIdentifier(candidate.name) && candidate.name.text === input.text);
184739
+ if (decl && ts3.isVariableDeclaration(decl))
184740
+ return parseFeatureSpec(decl.initializer, ctx, seen);
184741
+ }
184742
+ if (ts3.isCallExpression(input) && nodeText(input.expression) === "defineFeatureSpec") {
184743
+ return parseFeatureSpec(input.arguments[0], ctx, seen);
184744
+ }
184745
+ if (ts3.isAsExpression(input) || ts3.isSatisfiesExpression(input) || ts3.isParenthesizedExpression(input)) {
184746
+ return parseFeatureSpec(input.expression, ctx, seen);
184747
+ }
184748
+ const invalid = () => {
184749
+ ctx.diagnostics.push({
184750
+ severity: "error",
184751
+ code: "invalid-feature-spec",
184752
+ message: "Feature spec must use static name, states and transition objects.",
184753
+ file: sourcePath(ctx.rootDir, input.getSourceFile().fileName),
184754
+ line: lineOf(input)
184755
+ });
184756
+ return;
184710
184757
  };
184758
+ if (!ts3.isObjectLiteralExpression(input))
184759
+ return invalid();
184760
+ const name = stringLiteralProp(input, "name");
184761
+ const statesExpr = getProp(input, "states");
184762
+ const transitionObject = getProp(input, "transitions");
184763
+ if (!name || !statesExpr || !ts3.isArrayLiteralExpression(statesExpr) || statesExpr.elements.some((state) => !ts3.isStringLiteral(state)) || !transitionObject || !ts3.isObjectLiteralExpression(transitionObject) || input.properties.some((property) => !ts3.isPropertyAssignment(property))) {
184764
+ return invalid();
184765
+ }
184766
+ const states = statesExpr.elements.map((state) => state.text);
184767
+ const transitions = [];
184768
+ for (const property of transitionObject.properties) {
184769
+ if (!ts3.isPropertyAssignment(property) || ts3.isComputedPropertyName(property.name) || !ts3.isObjectLiteralExpression(property.initializer))
184770
+ return invalid();
184771
+ const options = property.initializer;
184772
+ const from = stringLiteralProp(options, "from");
184773
+ const to = stringLiteralProp(options, "to");
184774
+ if (!from || !to || options.properties.some((prop) => !ts3.isPropertyAssignment(prop)) || ["permission", "command", "route", "audit"].some((key) => getProp(options, key) && !stringLiteralProp(options, key)) || ["transaction", "idempotency"].some((key) => getProp(options, key) && !commandModeProp(options, key))) {
184775
+ return invalid();
184776
+ }
184777
+ transitions.push({
184778
+ name: propertyName(property.name),
184779
+ from,
184780
+ to,
184781
+ permission: stringLiteralProp(options, "permission"),
184782
+ command: stringLiteralProp(options, "command"),
184783
+ route: stringLiteralProp(options, "route"),
184784
+ transaction: commandModeProp(options, "transaction"),
184785
+ idempotency: commandModeProp(options, "idempotency"),
184786
+ audit: stringLiteralProp(options, "audit")
184787
+ });
184788
+ }
184789
+ return { name, states, transitions, file: sourcePath(ctx.rootDir, input.getSourceFile().fileName), line: lineOf(input) };
184711
184790
  }
184712
184791
  function commandModeProp(object, name) {
184713
184792
  const value = stringLiteralProp(object, name);
@@ -185878,6 +185957,54 @@ function sourcePath(rootDir, absFile) {
185878
185957
  function warn(ctx, code, message, file, line) {
185879
185958
  ctx.diagnostics.push({ severity: "warn", code, message, file, line });
185880
185959
  }
185960
+ function validateFeatureSpec(spec, module) {
185961
+ const diagnostics = [];
185962
+ const error = (code, message) => {
185963
+ diagnostics.push({ severity: "error", code, message, file: spec.file, line: spec.line });
185964
+ };
185965
+ if (!spec.name.trim() || spec.states.length === 0 || spec.states.some((state) => !state.trim()) || new Set(spec.states).size !== spec.states.length) {
185966
+ error("invalid-feature-states", "Feature name and states must be non-empty; states must be unique.");
185967
+ }
185968
+ const names = new Set;
185969
+ for (const transition of spec.transitions) {
185970
+ if (!transition.name.trim() || names.has(transition.name)) {
185971
+ error("duplicate-feature-transition", `Feature ${spec.name} has duplicate/empty transition '${transition.name}'.`);
185972
+ }
185973
+ names.add(transition.name);
185974
+ if (!spec.states.includes(transition.from) || !spec.states.includes(transition.to)) {
185975
+ error("invalid-feature-transition", `Transition ${transition.name} references an undeclared state.`);
185976
+ }
185977
+ if (transition.permission !== undefined && !transition.permission.trim()) {
185978
+ error("feature-governance-drift", `Transition ${transition.name} declares an empty permission.`);
185979
+ }
185980
+ if (!module)
185981
+ continue;
185982
+ const commands = module.commands.filter((command2) => command2.className === transition.command || command2.name === transition.command);
185983
+ const command = commands[0];
185984
+ if (transition.command && commands.length !== 1) {
185985
+ error("feature-command-unresolved", `Transition ${transition.name} must reference exactly one command in module ${module.name}.`);
185986
+ }
185987
+ if (!transition.command && [transition.permission, transition.transaction, transition.idempotency, transition.audit].some((value) => value !== undefined)) {
185988
+ error("feature-command-unresolved", `Transition ${transition.name} declares governance without a command binding.`);
185989
+ }
185990
+ if (command) {
185991
+ for (const key of ["permission", "transaction", "idempotency", "audit"]) {
185992
+ if (transition[key] !== undefined && transition[key] !== command[key]) {
185993
+ error("feature-governance-drift", `Transition ${transition.name} ${key} differs from command ${command.className}.`);
185994
+ }
185995
+ }
185996
+ }
185997
+ if (transition.route) {
185998
+ const routes = module.controllers.flatMap((controller) => controller.routes.filter((route) => `${route.method} ${joinRoutePaths(controller.path, route.path)}` === transition.route));
185999
+ if (routes.length !== 1) {
186000
+ error("feature-route-unresolved", `Transition ${transition.name} must reference exactly one route '${transition.route}' in module ${module.name}.`);
186001
+ } else if (command && routes[0].command !== command.className) {
186002
+ error("feature-route-drift", `Route ${transition.route} is not bound to ${command.className}.`);
186003
+ }
186004
+ }
186005
+ }
186006
+ return diagnostics;
186007
+ }
185881
186008
  var HEADER = "// GENERATED BY @supacloud/compiler — do not edit";
185882
186009
  var INTERFACES = `export interface CompiledRoute {
185883
186010
  method: string;
@@ -186177,10 +186304,10 @@ async function writeFileIfChanged(path, content, hashes) {
186177
186304
  async function writeFileAtomic(path, content) {
186178
186305
  const temporaryPath = `${path}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;
186179
186306
  try {
186180
- await writeFile(temporaryPath, content, "utf8");
186181
- await rename(temporaryPath, path);
186307
+ await writeFile2(temporaryPath, content, "utf8");
186308
+ await rename2(temporaryPath, path);
186182
186309
  } catch (error) {
186183
- await unlink(temporaryPath).catch(() => {
186310
+ await unlink2(temporaryPath).catch(() => {
186184
186311
  return;
186185
186312
  });
186186
186313
  throw error;
@@ -186585,10 +186712,10 @@ ${indent(item, 2)}`).join(",")}
186585
186712
  const constLine = `const ${local2} = resolveFactoryValue(${tokenIdent});`;
186586
186713
  return { constLine, key, expr: local2 };
186587
186714
  }
186588
- const factory = this.imports.add(provider.useFactoryName ?? "", provider.importPath, provider.importModule);
186715
+ const factory2 = this.imports.add(provider.useFactoryName ?? "", provider.importPath, provider.importModule);
186589
186716
  const args = provider.deps.map((dep) => this.depExpr(dep, kind, this.depOptions(provider, dep))).join(", ");
186590
186717
  const local = this.localVar(isMulti ? provider.useFactoryName ?? `${provider.token}Item` : provider.token, kind);
186591
- return { constLine: `const ${local} = ${factory}(${args});`, key, expr: local };
186718
+ return { constLine: `const ${local} = ${factory2}(${args});`, key, expr: local };
186592
186719
  }
186593
186720
  case "existing": {
186594
186721
  return {
@@ -187165,6 +187292,7 @@ var COMPILER_DIAGNOSTIC_CODES = {
187165
187292
  "invalid-http-method-body": { code: "SC3004", docsUrl: "https://supacloud.dev/errors/SC3004" },
187166
187293
  "unmatched-route-parameter": { code: "SC3005", docsUrl: "https://supacloud.dev/errors/SC3005" },
187167
187294
  "missing-route-parameter-binding": { code: "SC3006", docsUrl: "https://supacloud.dev/errors/SC3006" },
187295
+ "missing-path-param": { code: "SC3006", docsUrl: "https://supacloud.dev/errors/SC3006" },
187168
187296
  "duplicate-route": { code: "SC3007", docsUrl: "https://supacloud.dev/errors/SC3007" },
187169
187297
  "missing-body-schema": { code: "SC3008", docsUrl: "https://supacloud.dev/errors/SC3008" },
187170
187298
  "unused-route-schema": { code: "SC3009", docsUrl: "https://supacloud.dev/errors/SC3009" },
@@ -187175,6 +187303,7 @@ var COMPILER_DIAGNOSTIC_CODES = {
187175
187303
  "unmatched-path-param-decorator": { code: "SC3014", docsUrl: "https://supacloud.dev/errors/SC3014" },
187176
187304
  "invalid-query-default-type": { code: "SC3015", docsUrl: "https://supacloud.dev/errors/SC3015" },
187177
187305
  "disallowed-body-on-get-delete": { code: "SC3016", docsUrl: "https://supacloud.dev/errors/SC3016" },
187306
+ "invalid-body-binding": { code: "SC3016", docsUrl: "https://supacloud.dev/errors/SC3016" },
187178
187307
  "duplicate-query-param-binding": { code: "SC3017", docsUrl: "https://supacloud.dev/errors/SC3017" },
187179
187308
  "conflicting-route-method": { code: "SC3018", docsUrl: "https://supacloud.dev/errors/SC3018" },
187180
187309
  "missing-param-colon": { code: "SC3019", docsUrl: "https://supacloud.dev/errors/SC3019" },
@@ -187190,7 +187319,15 @@ var COMPILER_DIAGNOSTIC_CODES = {
187190
187319
  "invalid-job-scope": { code: "SC4007", docsUrl: "https://supacloud.dev/errors/SC4007" },
187191
187320
  "dynamic-aspect-reference": { code: "SC4010", docsUrl: "https://supacloud.dev/errors/SC4010" },
187192
187321
  "invalid-aspect-reference": { code: "SC4011", docsUrl: "https://supacloud.dev/errors/SC4011" },
187193
- "unused-root-provider": { code: "SC5001", docsUrl: "https://supacloud.dev/errors/SC5001" }
187322
+ "unused-root-provider": { code: "SC5001", docsUrl: "https://supacloud.dev/errors/SC5001" },
187323
+ "invalid-feature-states": { code: "SC6001", docsUrl: "https://supacloud.dev/errors/SC6001" },
187324
+ "duplicate-feature-transition": { code: "SC6002", docsUrl: "https://supacloud.dev/errors/SC6002" },
187325
+ "invalid-feature-transition": { code: "SC6003", docsUrl: "https://supacloud.dev/errors/SC6003" },
187326
+ "feature-command-unresolved": { code: "SC6004", docsUrl: "https://supacloud.dev/errors/SC6004" },
187327
+ "feature-governance-drift": { code: "SC6005", docsUrl: "https://supacloud.dev/errors/SC6005" },
187328
+ "feature-route-unresolved": { code: "SC6006", docsUrl: "https://supacloud.dev/errors/SC6006" },
187329
+ "feature-route-drift": { code: "SC6007", docsUrl: "https://supacloud.dev/errors/SC6007" },
187330
+ "invalid-feature-spec": { code: "SC6008", docsUrl: "https://supacloud.dev/errors/SC6008" }
187194
187331
  };
187195
187332
  function validateGraph(graph, options = false) {
187196
187333
  const strict = typeof options === "boolean" ? options : options.strict ?? false;
@@ -187246,7 +187383,7 @@ function validateGraph(graph, options = false) {
187246
187383
  }
187247
187384
  return;
187248
187385
  }
187249
- const error = (code, message, file, line, suggestion) => {
187386
+ const error = (code, message, file, line, suggestion, fix) => {
187250
187387
  const meta = COMPILER_DIAGNOSTIC_CODES[code];
187251
187388
  diagnostics.push({
187252
187389
  severity: "error",
@@ -187256,10 +187393,11 @@ function validateGraph(graph, options = false) {
187256
187393
  line,
187257
187394
  suggestion,
187258
187395
  errorCode: meta?.code,
187259
- docsUrl: meta?.docsUrl
187396
+ docsUrl: meta?.docsUrl,
187397
+ fix
187260
187398
  });
187261
187399
  };
187262
- const warn2 = (code, message, file, line, suggestion) => {
187400
+ const warn2 = (code, message, file, line, suggestion, fix) => {
187263
187401
  const meta = COMPILER_DIAGNOSTIC_CODES[code];
187264
187402
  diagnostics.push({
187265
187403
  severity: strict ? "error" : "warn",
@@ -187269,7 +187407,8 @@ function validateGraph(graph, options = false) {
187269
187407
  line,
187270
187408
  suggestion,
187271
187409
  errorCode: meta?.code,
187272
- docsUrl: meta?.docsUrl
187410
+ docsUrl: meta?.docsUrl,
187411
+ fix
187273
187412
  });
187274
187413
  };
187275
187414
  const modulesByName = new Map;
@@ -187277,6 +187416,12 @@ function validateGraph(graph, options = false) {
187277
187416
  const routesByKey = new Map;
187278
187417
  const declaredRoutes = [];
187279
187418
  for (const module of graph.modules) {
187419
+ if (module.featureSpec) {
187420
+ for (const diagnostic of validateFeatureSpec(module.featureSpec, module)) {
187421
+ const meta = COMPILER_DIAGNOSTIC_CODES[diagnostic.code];
187422
+ diagnostics.push({ ...diagnostic, errorCode: meta?.code, docsUrl: meta?.docsUrl });
187423
+ }
187424
+ }
187280
187425
  const previousModule = modulesByName.get(module.name);
187281
187426
  if (previousModule) {
187282
187427
  error("duplicate-module", `模块名 ${module.name} 重复(首次声明于 ${previousModule.file}:${previousModule.line})`, module.file, module.line);
@@ -187369,7 +187514,14 @@ function validateGraph(graph, options = false) {
187369
187514
  if (paramBindings.length > 0) {
187370
187515
  for (const param of pathParams) {
187371
187516
  if (!paramBindings.includes(param)) {
187372
- warn2("missing-path-param", `Route path '${route.path}' defines parameter ':${param}', but handler ${controller.className}.${route.handler} does not bind it with @Param('${param}').`, controller.file, undefined, `Add @Param('${param}') to ${route.handler} arguments.`);
187517
+ warn2("missing-path-param", `Route path '${route.path}' defines parameter ':${param}', but handler ${controller.className}.${route.handler} does not bind it with @Param('${param}').`, controller.file, undefined, `Add @Param('${param}') to ${route.handler} arguments.`, {
187518
+ type: "add_route_parameter_binding",
187519
+ targetFile: controller.file,
187520
+ controller: controller.className,
187521
+ route: route.handler,
187522
+ parameter: param,
187523
+ binding: "param"
187524
+ });
187373
187525
  }
187374
187526
  }
187375
187527
  }
@@ -187396,10 +187548,20 @@ function validateGraph(graph, options = false) {
187396
187548
  }
187397
187549
  }
187398
187550
  if ((route.method === "GET" || route.method === "HEAD" || route.method === "OPTIONS" || route.method === "DELETE") && (route.hasBodyBinding || route.body)) {
187399
- error("disallowed-body-on-get-delete", `Route handler ${controller.className}.${route.handler} binds @Body() or declares body schema on HTTP ${route.method} route '${route.path}'. Request bodies are not supported on ${route.method} requests.`, controller.file, undefined, `Use POST, PUT, or PATCH for routes accepting a request body, or bind parameters via @Query() / @Param().`);
187551
+ error("disallowed-body-on-get-delete", `Route handler ${controller.className}.${route.handler} binds @Body() or declares body schema on HTTP ${route.method} route '${route.path}'. Request bodies are not supported on ${route.method} requests.`, controller.file, undefined, `Use POST, PUT, or PATCH for routes accepting a request body, or bind parameters via @Query() / @Param().`, {
187552
+ type: "remove_route_body_binding",
187553
+ targetFile: controller.file,
187554
+ controller: controller.className,
187555
+ route: route.handler
187556
+ });
187400
187557
  }
187401
187558
  if (route.hasBodyBinding && (route.method === "GET" || route.method === "HEAD" || route.method === "OPTIONS")) {
187402
- error("invalid-body-binding", `Route handler ${controller.className}.${route.handler} binds @Body() on HTTP ${route.method} route '${route.path}'. Request bodies are not supported on ${route.method} requests.`, controller.file, undefined, `Use POST, PUT, or PATCH for routes accepting a request body, or bind parameters via @Query() / @Param().`);
187559
+ error("invalid-body-binding", `Route handler ${controller.className}.${route.handler} binds @Body() on HTTP ${route.method} route '${route.path}'. Request bodies are not supported on ${route.method} requests.`, controller.file, undefined, `Use POST, PUT, or PATCH for routes accepting a request body, or bind parameters via @Query() / @Param().`, {
187560
+ type: "remove_route_body_binding",
187561
+ targetFile: controller.file,
187562
+ controller: controller.className,
187563
+ route: route.handler
187564
+ });
187403
187565
  } else if (route.hasBodyBinding && !route.body) {
187404
187566
  warn2("missing-body-schema", `Route handler ${controller.className}.${route.handler} binds @Body() on route '${route.path}', but route definition does not specify a body validation schema.`, controller.file, undefined, `Add schema to route options (e.g. body: Schema) for compile-time and runtime validation.`);
187405
187567
  } else if (route.body && !route.hasBodyBinding && !route.command) {
@@ -187540,23 +187702,51 @@ function validateGraph(graph, options = false) {
187540
187702
  const owner = globalProviders.get(dep);
187541
187703
  if (!owner)
187542
187704
  continue;
187543
- error("module-boundary", `模块 ${module.name} 的 provider ${provider.token} 依赖 ${dep},该 token 由模块 ${owner.module.name} 提供但未被 import`, provider.file, provider.line, `Import module '${owner.module.name}' in '${module.name}', add '${dep}' to '${owner.module.name}' exports, or mark @Injectable({ providedIn: 'root' }).`);
187705
+ error("module-boundary", `模块 ${module.name} 的 provider ${provider.token} 依赖 ${dep},该 token 由模块 ${owner.module.name} 提供但未被 import`, provider.file, provider.line, `Import module '${owner.module.name}' in '${module.name}', add '${dep}' to '${owner.module.name}' exports, or mark @Injectable({ providedIn: 'root' }).`, {
187706
+ type: "add_module_import",
187707
+ targetFile: module.file,
187708
+ module: owner.module.name,
187709
+ provider: dep,
187710
+ symbol: owner.module.className,
187711
+ targetModule: module.name,
187712
+ importPath: (() => {
187713
+ const value = relative32(dirname32(module.file), owner.module.file).replace(/\.(tsx?|mts|cts)$/, "").split(sep32).join("/");
187714
+ return value.startsWith(".") ? value : `./${value}`;
187715
+ })()
187716
+ });
187544
187717
  } else if (dep.includes("TOKEN") || dep.endsWith("Token") || dep.length > 2 && dep === dep.toUpperCase()) {
187545
187718
  error("missing-token-factory", `InjectionToken '${dep}' referenced by provider '${provider.token}' has no provider in module '${module.name}' and no default factory function.`, provider.file, provider.line, `Provide '${dep}' in @Module({ providers: [...] }) or declare it with new InjectionToken('${dep}', { factory: () => ... }).`);
187546
187719
  } else {
187547
- error("unresolved-token", `模块 ${module.name} 的 provider ${provider.token} 依赖的 token ${dep} 无法解析`, provider.file, provider.line, `Provide '${dep}' in a module, mark constructor parameter @Optional(), or define @Injectable({ providedIn: 'root' }).`);
187720
+ error("unresolved-token", `模块 ${module.name} 的 provider ${provider.token} 依赖的 token ${dep} 无法解析`, provider.file, provider.line, `Provide '${dep}' in a module, mark constructor parameter @Optional(), or define @Injectable({ providedIn: 'root' }).`, {
187721
+ type: "add_provider",
187722
+ targetFile: module.file,
187723
+ token: dep,
187724
+ module: module.name
187725
+ });
187548
187726
  }
187549
187727
  }
187550
187728
  continue;
187551
187729
  }
187552
187730
  if (SCOPE_LIFETIME_RANK[resolved.provider.scope] > SCOPE_LIFETIME_RANK[provider.scope]) {
187553
- error("scope-violation", `模块 ${module.name} 的 ${provider.scope} provider ${provider.token} 不能依赖 ${resolved.provider.scope} provider ${dep}`, provider.file, provider.line, `Change provider '${provider.token}' scope to '${resolved.provider.scope}', or inject a factory/context instead.`);
187731
+ error("scope-violation", `模块 ${module.name} 的 ${provider.scope} provider ${provider.token} 不能依赖 ${resolved.provider.scope} provider ${dep}`, provider.file, provider.line, `Change provider '${provider.token}' scope to '${resolved.provider.scope}', or inject a factory/context instead.`, {
187732
+ type: "change_provider_scope",
187733
+ targetFile: provider.file,
187734
+ provider: provider.token,
187735
+ from: provider.scope,
187736
+ to: resolved.provider.scope
187737
+ });
187554
187738
  }
187555
187739
  }
187556
187740
  }
187557
187741
  for (const command of module.commands) {
187558
187742
  if (!command.permission) {
187559
- error("command-missing-permission", `模块 ${module.name} 的 command ${command.name} (${command.className}) 未声明 permission`, module.file, module.line, "Add 'permission: string' to @Command({ ... }) or configure command execution capabilities permission=false.");
187743
+ error("command-missing-permission", `模块 ${module.name} 的 command ${command.name} (${command.className}) 未声明 permission`, module.file, module.line, "Add 'permission: string' to @Command({ ... }) or configure command execution capabilities permission=false.", {
187744
+ type: "add_command_permission",
187745
+ targetFile: module.providers.find((provider) => provider.useClass === command.className || provider.token === command.className)?.file ?? module.file,
187746
+ command: command.className,
187747
+ module: module.name,
187748
+ permission: `${module.name}.${command.name}`
187749
+ });
187560
187750
  }
187561
187751
  if (typeof options === "object" && options.commandCapabilities) {
187562
187752
  const caps = options.commandCapabilities;
@@ -187926,7 +188116,7 @@ function scanGeneratedArtifacts(artifacts, strict = true) {
187926
188116
  for (const [file, content] of Object.entries(artifacts)) {
187927
188117
  if (content === undefined)
187928
188118
  continue;
187929
- const sourceFile = ts4.createSourceFile(file, content, ts4.ScriptTarget.Latest, true, ts4.ScriptKind.TS);
188119
+ const sourceFile = ts5.createSourceFile(file, content, ts5.ScriptTarget.Latest, true, ts5.ScriptKind.TS);
187930
188120
  for (const node of descendantsOfKind2(sourceFile, isAnyKeyword)) {
187931
188121
  diagnostics.push(makeDiagnostic("generated-any", `生成产物 ${file} 包含 any;严格生成模式要求使用 unknown、具体接口或泛型约束。`, sourceFile, node, strict));
187932
188122
  }
@@ -187934,30 +188124,30 @@ function scanGeneratedArtifacts(artifacts, strict = true) {
187934
188124
  return diagnostics;
187935
188125
  }
187936
188126
  function scanProductionSource(options) {
187937
- const rootDir = resolve22(options.rootDir);
188127
+ const rootDir = resolve32(options.rootDir);
187938
188128
  const configPath = join32(rootDir, "tsconfig.json");
187939
188129
  const projectConfig = existsSync22(configPath) ? readProjectConfig2(configPath) : {
187940
188130
  options: {
187941
188131
  strict: true,
187942
188132
  skipLibCheck: true,
187943
- target: ts4.ScriptTarget.ES2022,
187944
- module: ts4.ModuleKind.ESNext
188133
+ target: ts5.ScriptTarget.ES2022,
188134
+ module: ts5.ModuleKind.ESNext
187945
188135
  },
187946
188136
  errors: []
187947
188137
  };
187948
188138
  const include = options.include ?? ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"];
187949
- const rootNames = ts4.sys.readDirectory(rootDir, [".ts", ".tsx", ".mts", ".cts"], ["node_modules", "dist"], include).filter((file) => isProductionSourcePath(rootDir, file, [...DEFAULT_EXCLUDES, ...options.exclude ?? []]));
188139
+ const rootNames = ts5.sys.readDirectory(rootDir, [".ts", ".tsx", ".mts", ".cts"], ["node_modules", "dist"], include).filter((file) => isProductionSourcePath(rootDir, file, [...DEFAULT_EXCLUDES, ...options.exclude ?? []]));
187950
188140
  const compilerOptions = { ...projectConfig.options, noEmit: true };
187951
- const host = ts4.createCompilerHost(compilerOptions);
188141
+ const host = ts5.createCompilerHost(compilerOptions);
187952
188142
  host.getCurrentDirectory = () => rootDir;
187953
- const program = ts4.createProgram(rootNames, compilerOptions, host);
188143
+ const program = ts5.createProgram(rootNames, compilerOptions, host);
187954
188144
  const outDir = options.outDir ? normalizeRelative(rootDir, options.outDir) : undefined;
187955
188145
  const excludes = [...DEFAULT_EXCLUDES, ...options.exclude ?? []];
187956
188146
  const sourceFiles = program.getSourceFiles().filter((sourceFile) => isProductionSource(rootDir, sourceFile, excludes, outDir));
187957
188147
  const diagnostics = [...projectConfig.errors, ...program.getOptionsDiagnostics()].map((diagnostic) => ({
187958
188148
  severity: "error",
187959
188149
  code: "source-config",
187960
- message: ts4.flattenDiagnosticMessageText(diagnostic.messageText, `
188150
+ message: ts5.flattenDiagnosticMessageText(diagnostic.messageText, `
187961
188151
  `),
187962
188152
  file: diagnostic.file ? normalizeRelative(rootDir, diagnostic.file.fileName) : normalizeRelative(rootDir, configPath),
187963
188153
  line: diagnostic.file && diagnostic.start !== undefined ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start).line + 1 : undefined,
@@ -187974,22 +188164,22 @@ function scanSourceFile(sourceFile, checker, rootDir, diagnostics, strict) {
187974
188164
  diagnostics.push(makeDiagnostic("source-any", "生产源码使用了显式 any;请改用 unknown、具体接口或泛型约束。", sourceFile, node, strict, rootDir));
187975
188165
  }
187976
188166
  for (const node of descendants(sourceFile)) {
187977
- if (ts4.isAsExpression(node)) {
187978
- if (ts4.isAsExpression(node.parent) || ts4.isTypeAssertionExpression(node.parent))
188167
+ if (ts5.isAsExpression(node)) {
188168
+ if (ts5.isAsExpression(node.parent) || ts5.isTypeAssertionExpression(node.parent))
187979
188169
  continue;
187980
188170
  const assertedType = node.type.getText(sourceFile);
187981
188171
  if (assertedType === "const")
187982
188172
  continue;
187983
188173
  diagnostics.push(makeDiagnostic("source-type-assertion", `生产源码包含类型断言 ${node.getText(sourceFile)};请优先使用类型守卫、satisfies 或显式边界解析。`, sourceFile, node, strict, rootDir));
187984
- } else if (ts4.isTypeAssertionExpression(node)) {
187985
- if (ts4.isAsExpression(node.parent) || ts4.isTypeAssertionExpression(node.parent))
188174
+ } else if (ts5.isTypeAssertionExpression(node)) {
188175
+ if (ts5.isAsExpression(node.parent) || ts5.isTypeAssertionExpression(node.parent))
187986
188176
  continue;
187987
188177
  diagnostics.push(makeDiagnostic("source-type-assertion", `生产源码包含类型断言 ${node.getText(sourceFile)};请优先使用类型守卫、satisfies 或显式边界解析。`, sourceFile, node, strict, rootDir));
187988
- } else if (ts4.isNonNullExpression(node)) {
188178
+ } else if (ts5.isNonNullExpression(node)) {
187989
188179
  diagnostics.push(makeDiagnostic("source-non-null-assertion", `生产源码包含非空断言 ${node.getText(sourceFile)};请显式处理 null/undefined。`, sourceFile, node, strict, rootDir));
187990
188180
  }
187991
188181
  }
187992
- for (const declaration of descendantsOfKind2(sourceFile, ts4.isVariableDeclaration)) {
188182
+ for (const declaration of descendantsOfKind2(sourceFile, ts5.isVariableDeclaration)) {
187993
188183
  const initializer = declaration.initializer;
187994
188184
  if (!initializer || declaration.type)
187995
188185
  continue;
@@ -188005,11 +188195,11 @@ function scanSourceFile(sourceFile, checker, rootDir, diagnostics, strict) {
188005
188195
  if (isLetDeclaration(declaration) && isLiteralSyntax(initializer) && !isLiteralType(declarationType)) {
188006
188196
  diagnostics.push(makeDiagnostic("source-implicit-widening", `变量 ${declaration.name.getText(sourceFile)} 的字面量类型从 ${checker.typeToString(initializerType, initializer)} 隐式宽化为 ${checker.typeToString(declarationType, declaration)};请补充类型或使用 const。`, sourceFile, declaration, strict, rootDir));
188007
188197
  }
188008
- if (ts4.isObjectLiteralExpression(initializer) && isConstDeclaration(declaration) && initializer.getText(sourceFile).length > 0 && initializer.properties.some((property) => ts4.isPropertyAssignment(property) && property.initializer !== undefined && !ts4.isAsExpression(property.initializer) && isLiteralExpression(property.initializer))) {
188198
+ if (ts5.isObjectLiteralExpression(initializer) && isConstDeclaration(declaration) && initializer.getText(sourceFile).length > 0 && initializer.properties.some((property2) => ts5.isPropertyAssignment(property2) && property2.initializer !== undefined && !ts5.isAsExpression(property2.initializer) && isLiteralExpression(property2.initializer))) {
188009
188199
  diagnostics.push(makeDiagnostic("source-implicit-widening", `常量对象 ${declaration.name.getText(sourceFile)} 的字面量属性会隐式宽化;请补充对象类型或使用 as const。`, sourceFile, declaration, strict, rootDir));
188010
188200
  }
188011
188201
  }
188012
- for (const parameter of descendantsOfKind2(sourceFile, ts4.isParameter)) {
188202
+ for (const parameter of descendantsOfKind2(sourceFile, ts5.isParameter)) {
188013
188203
  if (parameter.type)
188014
188204
  continue;
188015
188205
  for (const name of bindingNames(parameter.name)) {
@@ -188020,10 +188210,10 @@ function scanSourceFile(sourceFile, checker, rootDir, diagnostics, strict) {
188020
188210
  }
188021
188211
  }
188022
188212
  function readProjectConfig2(configPath) {
188023
- const config = ts4.readConfigFile(configPath, (file) => readFileSync22(file, "utf8"));
188213
+ const config = ts5.readConfigFile(configPath, (file) => readFileSync22(file, "utf8"));
188024
188214
  if (config.error)
188025
188215
  return { options: {}, errors: [config.error] };
188026
- const parsed = ts4.parseJsonConfigFileContent(config.config, ts4.sys, dirname22(configPath));
188216
+ const parsed = ts5.parseJsonConfigFileContent(config.config, ts5.sys, dirname4(configPath));
188027
188217
  return { options: parsed.options, errors: parsed.errors };
188028
188218
  }
188029
188219
  function isProductionSource(rootDir, sourceFile, excludes, outDir) {
@@ -188043,42 +188233,42 @@ function globMatches(value, pattern) {
188043
188233
  return new RegExp(`^${escaped}$`).test(value);
188044
188234
  }
188045
188235
  function bindingNames(name) {
188046
- if (ts4.isIdentifier(name))
188236
+ if (ts5.isIdentifier(name))
188047
188237
  return [name];
188048
- return name.elements.flatMap((element) => ts4.isBindingElement(element) ? bindingNames(element.name) : []);
188238
+ return name.elements.flatMap((element) => ts5.isBindingElement(element) ? bindingNames(element.name) : []);
188049
188239
  }
188050
188240
  function isLiteralExpression(node) {
188051
188241
  if (!node)
188052
188242
  return false;
188053
188243
  return [
188054
- ts4.SyntaxKind.StringLiteral,
188055
- ts4.SyntaxKind.NumericLiteral,
188056
- ts4.SyntaxKind.TrueKeyword,
188057
- ts4.SyntaxKind.FalseKeyword
188244
+ ts5.SyntaxKind.StringLiteral,
188245
+ ts5.SyntaxKind.NumericLiteral,
188246
+ ts5.SyntaxKind.TrueKeyword,
188247
+ ts5.SyntaxKind.FalseKeyword
188058
188248
  ].includes(node.kind);
188059
188249
  }
188060
188250
  function isLiteralSyntax(node) {
188061
- return ts4.isStringLiteral(node) || ts4.isNumericLiteral(node) || node.kind === ts4.SyntaxKind.TrueKeyword || node.kind === ts4.SyntaxKind.FalseKeyword;
188251
+ return ts5.isStringLiteral(node) || ts5.isNumericLiteral(node) || node.kind === ts5.SyntaxKind.TrueKeyword || node.kind === ts5.SyntaxKind.FalseKeyword;
188062
188252
  }
188063
188253
  function isLiteralType(type) {
188064
- return (type.flags & (ts4.TypeFlags.StringLiteral | ts4.TypeFlags.NumberLiteral | ts4.TypeFlags.BooleanLiteral | ts4.TypeFlags.BigIntLiteral)) !== 0;
188254
+ return (type.flags & (ts5.TypeFlags.StringLiteral | ts5.TypeFlags.NumberLiteral | ts5.TypeFlags.BooleanLiteral | ts5.TypeFlags.BigIntLiteral)) !== 0;
188065
188255
  }
188066
188256
  function isAnyType(type) {
188067
- return (type.flags & ts4.TypeFlags.Any) !== 0;
188257
+ return (type.flags & ts5.TypeFlags.Any) !== 0;
188068
188258
  }
188069
188259
  function isLetDeclaration(declaration) {
188070
- return ts4.isVariableDeclarationList(declaration.parent) && (declaration.parent.flags & ts4.NodeFlags.Let) !== 0;
188260
+ return ts5.isVariableDeclarationList(declaration.parent) && (declaration.parent.flags & ts5.NodeFlags.Let) !== 0;
188071
188261
  }
188072
188262
  function isConstDeclaration(declaration) {
188073
- return ts4.isVariableDeclarationList(declaration.parent) && (declaration.parent.flags & ts4.NodeFlags.Const) !== 0;
188263
+ return ts5.isVariableDeclarationList(declaration.parent) && (declaration.parent.flags & ts5.NodeFlags.Const) !== 0;
188074
188264
  }
188075
188265
  function descendants(root) {
188076
188266
  const result = [];
188077
188267
  const visit = (node) => {
188078
188268
  result.push(node);
188079
- ts4.forEachChild(node, visit);
188269
+ ts5.forEachChild(node, visit);
188080
188270
  };
188081
- ts4.forEachChild(root, visit);
188271
+ ts5.forEachChild(root, visit);
188082
188272
  return result;
188083
188273
  }
188084
188274
  function descendantsOfKind2(root, predicate) {
@@ -188086,9 +188276,9 @@ function descendantsOfKind2(root, predicate) {
188086
188276
  const visit = (node) => {
188087
188277
  if (predicate(node))
188088
188278
  result.push(node);
188089
- ts4.forEachChild(node, visit);
188279
+ ts5.forEachChild(node, visit);
188090
188280
  };
188091
- ts4.forEachChild(root, visit);
188281
+ ts5.forEachChild(root, visit);
188092
188282
  return result;
188093
188283
  }
188094
188284
  function makeDiagnostic(code, message, fileOrSourceFile, node, strict, rootDir) {
@@ -188106,10 +188296,10 @@ function makeDiagnostic(code, message, fileOrSourceFile, node, strict, rootDir)
188106
188296
  };
188107
188297
  }
188108
188298
  function normalizeRelative(rootDir, filePath) {
188109
- return relative22(rootDir, filePath).split(sep22).join("/").replace(/^\.\//, "");
188299
+ return relative4(rootDir, filePath).split(sep4).join("/").replace(/^\.\//, "");
188110
188300
  }
188111
188301
  function isAnyKeyword(node) {
188112
- return node.kind === ts4.SyntaxKind.AnyKeyword;
188302
+ return node.kind === ts5.SyntaxKind.AnyKeyword;
188113
188303
  }
188114
188304
  async function compileProject(options) {
188115
188305
  const graph = await analyzeProject(options.rootDir, options.include, options.cache, options.changedPaths);
@@ -188201,13 +188391,14 @@ function defineSupacloudConfig(config = {}) {
188201
188391
  function resolveSupacloudConfig(config = {}, cwd = process.cwd()) {
188202
188392
  const resolved = defineSupacloudConfig(config);
188203
188393
  return {
188204
- rootDir: resolve52(cwd, resolved.root ?? DEFAULT_SUPACLOUD_CONFIG.root),
188205
- outDir: resolve52(cwd, resolved.outDir ?? DEFAULT_SUPACLOUD_CONFIG.outDir),
188394
+ rootDir: resolve62(cwd, resolved.root ?? DEFAULT_SUPACLOUD_CONFIG.root),
188395
+ outDir: resolve62(cwd, resolved.outDir ?? DEFAULT_SUPACLOUD_CONFIG.outDir),
188206
188396
  include: resolved.include ?? [...DEFAULT_SUPACLOUD_CONFIG.include],
188207
188397
  strict: resolved.strict ?? DEFAULT_SUPACLOUD_CONFIG.strict,
188208
188398
  generateClient: resolved.generateClient ?? DEFAULT_SUPACLOUD_CONFIG.generateClient,
188209
188399
  generatePermissions: resolved.generatePermissions ?? DEFAULT_SUPACLOUD_CONFIG.generatePermissions,
188210
188400
  moduleBoundaryPreset: resolved.moduleBoundaryPreset ?? DEFAULT_SUPACLOUD_CONFIG.moduleBoundaryPreset,
188401
+ commandCapabilities: resolved.commandCapabilities,
188211
188402
  treeShakeUnusedProviders: resolved.treeShakeUnusedProviders ?? DEFAULT_SUPACLOUD_CONFIG.treeShakeUnusedProviders
188212
188403
  };
188213
188404
  }
@@ -188234,6 +188425,7 @@ function compileOptionsFromConfig(config, cwd = process.cwd()) {
188234
188425
  generateClient: resolved.generateClient,
188235
188426
  generatePermissions: resolved.generatePermissions,
188236
188427
  moduleBoundaryPreset: resolved.moduleBoundaryPreset,
188428
+ commandCapabilities: resolved.commandCapabilities,
188237
188429
  treeShakeUnusedProviders: resolved.treeShakeUnusedProviders
188238
188430
  };
188239
188431
  }
@@ -188378,11 +188570,11 @@ async function writeScaffold(path, content, force) {
188378
188570
  if (!force) {
188379
188571
  throw new Error(`File already exists: ${path}(使用 --force 覆盖)`);
188380
188572
  }
188381
- await writeFile2(path, content, "utf8");
188573
+ await writeFile(path, content, "utf8");
188382
188574
  return "overwritten";
188383
188575
  }
188384
- await mkdir2(dirname4(path), { recursive: true });
188385
- await writeFile2(path, content, "utf8");
188576
+ await mkdir2(dirname5(path), { recursive: true });
188577
+ await writeFile(path, content, "utf8");
188386
188578
  return "created";
188387
188579
  }
188388
188580
  function moduleScaffold(name) {
@@ -188683,8 +188875,8 @@ async function runExportTools(args) {
188683
188875
  }
188684
188876
  const openaiPath = join7(outDir, "tool-definitions.openai.json");
188685
188877
  const mcpPath = join7(outDir, "tool-definitions.mcp.json");
188686
- await writeFile2(openaiPath, JSON.stringify(definitions.openai, null, 2), "utf8");
188687
- await writeFile2(mcpPath, JSON.stringify(definitions.mcp, null, 2), "utf8");
188878
+ await writeFile(openaiPath, JSON.stringify(definitions.openai, null, 2), "utf8");
188879
+ await writeFile(mcpPath, JSON.stringify(definitions.mcp, null, 2), "utf8");
188688
188880
  const summary = [
188689
188881
  `exported ${definitions.openai.length} tool(s):`,
188690
188882
  ` openai → ${openaiPath}`,
@@ -190389,7 +190581,7 @@ function registerReleaseTools(server2, http, options = {}) {
190389
190581
  import { access as access2, lstat, mkdtemp, opendir, readFile as readFile2, rm, writeFile as writeFile3 } from "node:fs/promises";
190390
190582
  import { createHash as createHash5 } from "node:crypto";
190391
190583
  import { tmpdir as tmpdir2 } from "node:os";
190392
- import { basename as basename4, dirname as dirname5, join as join9, relative as relative4, resolve as resolve11, sep as sep4 } from "node:path";
190584
+ import { basename as basename4, dirname as dirname7, join as join9, relative as relative5, resolve as resolve11, sep as sep5 } from "node:path";
190393
190585
  import { spawn as spawn3 } from "node:child_process";
190394
190586
 
190395
190587
  // node_modules/fflate/esm/index.mjs
@@ -191085,7 +191277,7 @@ async function findDeployConfigRoot(startDirectory) {
191085
191277
  while (true) {
191086
191278
  if (await pathExists(join9(directory, "supacloud.json")))
191087
191279
  return directory;
191088
- const parent = dirname5(directory);
191280
+ const parent = dirname7(directory);
191089
191281
  if (parent === directory)
191090
191282
  return resolve11(startDirectory);
191091
191283
  directory = parent;
@@ -191174,8 +191366,8 @@ async function defaultBuildCommand(projectDirectory, configRoot) {
191174
191366
  return "yarn build";
191175
191367
  if (directory === configRoot)
191176
191368
  break;
191177
- const parent = dirname5(directory);
191178
- if (parent === directory || !directory.startsWith(`${configRoot}${sep4}`))
191369
+ const parent = dirname7(directory);
191370
+ if (parent === directory || !directory.startsWith(`${configRoot}${sep5}`))
191179
191371
  break;
191180
191372
  directory = parent;
191181
191373
  }
@@ -191206,7 +191398,7 @@ function selectDeployment(deployments, requestedId, projectName) {
191206
191398
  }
191207
191399
  function targetRoot(configRoot, target, name) {
191208
191400
  const root = resolve11(configRoot, target.root || (name === "frontend" ? "." : name));
191209
- const prefix = `${resolve11(configRoot)}${sep4}`;
191401
+ const prefix = `${resolve11(configRoot)}${sep5}`;
191210
191402
  if (root !== resolve11(configRoot) && !root.startsWith(prefix)) {
191211
191403
  throw new Error(`Deploy target '${name}' root must stay inside the repository root`);
191212
191404
  }
@@ -191228,7 +191420,7 @@ function selectTarget(configRoot, invocationDirectory, config, requestedName) {
191228
191420
  throw new Error(`Deploy target '${requestedName}' was not found in supacloud.json`);
191229
191421
  return { name: selected[0], config: selected[1], root: targetRoot(configRoot, selected[1], selected[0]) };
191230
191422
  }
191231
- const containing = targets.map(([name, target]) => ({ name, target, root: targetRoot(configRoot, target, name) })).filter((candidate) => invocationDirectory === candidate.root || invocationDirectory.startsWith(`${candidate.root}${sep4}`)).sort((left, right) => right.root.length - left.root.length);
191423
+ const containing = targets.map(([name, target]) => ({ name, target, root: targetRoot(configRoot, target, name) })).filter((candidate) => invocationDirectory === candidate.root || invocationDirectory.startsWith(`${candidate.root}${sep5}`)).sort((left, right) => right.root.length - left.root.length);
191232
191424
  if (containing.length === 1 || containing.length > 1 && containing[0].root !== containing[1].root) {
191233
191425
  const selected = containing[0];
191234
191426
  return { name: selected.name, config: selected.target, root: selected.root };
@@ -191260,7 +191452,7 @@ function defaultOutputDirectory(framework) {
191260
191452
  function resolveInsideProject(projectDirectory, candidate, allowRoot = false) {
191261
191453
  const resolved = resolve11(projectDirectory, candidate);
191262
191454
  const projectRoot = resolve11(projectDirectory);
191263
- const projectPrefix = `${projectRoot}${sep4}`;
191455
+ const projectPrefix = `${projectRoot}${sep5}`;
191264
191456
  if (!allowRoot && resolved === projectRoot || resolved !== projectRoot && !resolved.startsWith(projectPrefix)) {
191265
191457
  throw new Error("Frontend output directory must stay inside the project directory");
191266
191458
  }
@@ -191312,7 +191504,7 @@ async function collectArchiveFiles(root) {
191312
191504
  bytes += data.byteLength;
191313
191505
  if (bytes > MAX_SOURCE_BYTES)
191314
191506
  throw new Error(`Frontend output exceeds ${MAX_SOURCE_BYTES} bytes`);
191315
- const archivePath = relative4(root, path).split(sep4).join("/");
191507
+ const archivePath = relative5(root, path).split(sep5).join("/");
191316
191508
  files[archivePath] = [data, { mtime: FIXED_ZIP_MTIME }];
191317
191509
  }
191318
191510
  return { files, bytes, count: paths.length };
@@ -191484,7 +191676,7 @@ function registerDeployTools(server2, http, options = {}) {
191484
191676
  } else {
191485
191677
  report("build", "skipped");
191486
191678
  }
191487
- report("package", relative4(projectDirectory, outputDirectory) || ".");
191679
+ report("package", relative5(projectDirectory, outputDirectory) || ".");
191488
191680
  const archive = await createFrontendArchive(outputDirectory);
191489
191681
  try {
191490
191682
  const inventory = payload(await listFrontendReleases(http, projectRef2, selected.id, undefined, 100));
@@ -191815,7 +192007,7 @@ function registerRemoteDevTools(server2, options = {}) {
191815
192007
  // package.json
191816
192008
  var package_default = {
191817
192009
  name: "@supacloud/cli",
191818
- version: "0.48.0",
192010
+ version: "0.48.2",
191819
192011
  description: "Project-scoped CLI for SupaCloud users",
191820
192012
  type: "module",
191821
192013
  main: "./dist/index.js",
@@ -191848,7 +192040,7 @@ var package_default = {
191848
192040
  },
191849
192041
  dependencies: {
191850
192042
  "@sinclair/typebox": "^0.34.52",
191851
- "@supacloud/compiler": "^0.7.0",
192043
+ "@supacloud/compiler": "^0.9.0",
191852
192044
  "@supacloud/db": "^0.2.0",
191853
192045
  fflate: "^0.8.3"
191854
192046
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/cli",
3
- "version": "0.48.0",
3
+ "version": "0.48.2",
4
4
  "description": "Project-scoped CLI for SupaCloud users",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@sinclair/typebox": "^0.34.52",
36
- "@supacloud/compiler": "^0.7.0",
36
+ "@supacloud/compiler": "^0.9.0",
37
37
  "@supacloud/db": "^0.2.0",
38
38
  "fflate": "^0.8.3"
39
39
  },