@lukoweb/apitogo 0.2.17 → 0.2.18

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/dist/cli/cli.js CHANGED
@@ -836,7 +836,7 @@ import { stat as stat4 } from "node:fs/promises";
836
836
  var fileExists;
837
837
  var init_file_exists = __esm({
838
838
  "src/config/file-exists.ts"() {
839
- fileExists = (path101) => stat4(path101).then(() => true).catch(() => false);
839
+ fileExists = (path102) => stat4(path102).then(() => true).catch(() => false);
840
840
  }
841
841
  });
842
842
 
@@ -5809,7 +5809,7 @@ init_package_json();
5809
5809
  import yargs from "yargs/yargs";
5810
5810
 
5811
5811
  // src/cli/services/handler.ts
5812
- import path50 from "node:path";
5812
+ import path52 from "node:path";
5813
5813
  import { createInterface as createInterface2 } from "node:readline/promises";
5814
5814
 
5815
5815
  // src/config/v2/errors.ts
@@ -6189,8 +6189,8 @@ var ConfigV2Schema = z.strictObject({
6189
6189
  var REMOVED_KEYS = {
6190
6190
  "plans.provider": "plans.provider was removed. Only plans.billing.provider (stripe or none) is selectable."
6191
6191
  };
6192
- function pathToString(path101) {
6193
- return path101.reduce(
6192
+ function pathToString(path102) {
6193
+ return path102.reduce(
6194
6194
  (acc, segment) => typeof segment === "number" ? `${acc}[${segment}]` : acc === "" ? String(segment) : `${acc}.${String(segment)}`,
6195
6195
  ""
6196
6196
  );
@@ -6210,9 +6210,9 @@ function step(schema2, segment) {
6210
6210
  }
6211
6211
  return void 0;
6212
6212
  }
6213
- function knownKeysAt(path101) {
6213
+ function knownKeysAt(path102) {
6214
6214
  let current = ConfigV2Schema;
6215
- for (const segment of path101) {
6215
+ for (const segment of path102) {
6216
6216
  if (!current) return [];
6217
6217
  current = step(current, segment);
6218
6218
  }
@@ -6248,7 +6248,7 @@ function unknownKeyHint(fullPath, key, known) {
6248
6248
  return known.length > 0 ? `Allowed keys: ${known.join(", ")}.` : void 0;
6249
6249
  }
6250
6250
  function mapIssue(issue3) {
6251
- const path101 = pathToString(issue3.path);
6251
+ const path102 = pathToString(issue3.path);
6252
6252
  switch (issue3.code) {
6253
6253
  case "unrecognized_keys":
6254
6254
  return issue3.keys.map((key) => {
@@ -6264,20 +6264,20 @@ function mapIssue(issue3) {
6264
6264
  return [
6265
6265
  {
6266
6266
  code: "CONFIG_INVALID_VALUE",
6267
- path: path101,
6267
+ path: path102,
6268
6268
  message: `must be one of: ${issue3.values.map((v) => JSON.stringify(v)).join(", ")}.`
6269
6269
  }
6270
6270
  ];
6271
6271
  case "custom": {
6272
6272
  const code = typeof issue3.params?.code === "string" ? issue3.params.code : "CONFIG_INVALID_VALUE";
6273
- return [{ code, path: path101, message: issue3.message ?? "is invalid." }];
6273
+ return [{ code, path: path102, message: issue3.message ?? "is invalid." }];
6274
6274
  }
6275
6275
  case "invalid_type":
6276
6276
  return [
6277
- /received undefined/.test(issue3.message) ? { code: "CONFIG_MISSING_FIELD", path: path101, message: "is required." } : { code: "CONFIG_INVALID_VALUE", path: path101, message: issue3.message }
6277
+ /received undefined/.test(issue3.message) ? { code: "CONFIG_MISSING_FIELD", path: path102, message: "is required." } : { code: "CONFIG_INVALID_VALUE", path: path102, message: issue3.message }
6278
6278
  ];
6279
6279
  default:
6280
- return [{ code: "CONFIG_INVALID_VALUE", path: path101, message: issue3.message }];
6280
+ return [{ code: "CONFIG_INVALID_VALUE", path: path102, message: issue3.message }];
6281
6281
  }
6282
6282
  }
6283
6283
  function isRecord(value) {
@@ -7301,7 +7301,7 @@ var ServiceManifestSchema = z3.looseObject({
7301
7301
  }).optional()
7302
7302
  }).default({})
7303
7303
  });
7304
- var issue = (code, path101, message, hint) => ({ code, path: path101, message, hint });
7304
+ var issue = (code, path102, message, hint) => ({ code, path: path102, message, hint });
7305
7305
  function parseManifest(raw, file = "services.json") {
7306
7306
  const version = typeof raw === "object" && raw !== null && "schemaVersion" in raw ? raw.schemaVersion : void 0;
7307
7307
  if (typeof version === "number" && version > SUPPORTED_MANIFEST_SCHEMA) {
@@ -7504,8 +7504,8 @@ var METHODS = [
7504
7504
  "trace"
7505
7505
  ];
7506
7506
  var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
7507
- function actionKey(method, path101) {
7508
- const trimmed = path101.trim();
7507
+ function actionKey(method, path102) {
7508
+ const trimmed = path102.trim();
7509
7509
  const withSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
7510
7510
  const normalized = withSlash.length > 1 ? withSlash.replace(/\/+$/, "") || "/" : withSlash;
7511
7511
  return `${method.trim().toLowerCase()}:${normalized}`;
@@ -7542,8 +7542,8 @@ var ReferenceSpecError = class extends Error {
7542
7542
  };
7543
7543
  function operationsOf(paths) {
7544
7544
  return Object.entries(paths).flatMap(
7545
- ([path101, item]) => isObject(item) ? METHODS.filter((method) => isObject(item[method])).map(
7546
- (method) => [path101, item, method]
7545
+ ([path102, item]) => isObject(item) ? METHODS.filter((method) => isObject(item[method])).map(
7546
+ (method) => [path102, item, method]
7547
7547
  ) : []
7548
7548
  );
7549
7549
  }
@@ -7558,14 +7558,14 @@ function buildReferenceSpec(specText, options) {
7558
7558
  throw new ReferenceSpecError("The OpenAPI file could not be read.");
7559
7559
  const doc = structuredClone(root);
7560
7560
  const paths = isObject(doc.paths) ? doc.paths : {};
7561
- for (const [path101, item, method] of operationsOf(paths))
7562
- if (options.deniedOperations.has(actionKey(method, path101)))
7561
+ for (const [path102, item, method] of operationsOf(paths))
7562
+ if (options.deniedOperations.has(actionKey(method, path102)))
7563
7563
  delete item[method];
7564
- for (const [path101, item] of Object.entries(paths))
7564
+ for (const [path102, item] of Object.entries(paths))
7565
7565
  if (!isObject(item) || !METHODS.some((method) => method in item))
7566
- delete paths[path101];
7567
- for (const [path101, item, method] of operationsOf(paths))
7568
- if (options.publicOperations.has(actionKey(method, path101)))
7566
+ delete paths[path102];
7567
+ for (const [path102, item, method] of operationsOf(paths))
7568
+ if (options.publicOperations.has(actionKey(method, path102)))
7569
7569
  item[method].security = [];
7570
7570
  doc.servers = [{ url: options.gatewayBaseUrl.replace(/\/+$/, "") }];
7571
7571
  for (const item of Object.values(paths)) {
@@ -8836,8 +8836,8 @@ init_invariant();
8836
8836
 
8837
8837
  // src/cli/check/v2.ts
8838
8838
  init_apitogo_config_core();
8839
- import { readFile as readFile13 } from "node:fs/promises";
8840
- import path47 from "node:path";
8839
+ import { readFile as readFile14 } from "node:fs/promises";
8840
+ import path48 from "node:path";
8841
8841
 
8842
8842
  // src/cli/platform/client/platform-api.ts
8843
8843
  import { basename } from "node:path";
@@ -8950,8 +8950,8 @@ var PlatformApiClient = class {
8950
8950
  constructor(config2) {
8951
8951
  this.config = config2;
8952
8952
  }
8953
- url(path101) {
8954
- return `${this.config.apiUrl}${path101.startsWith("/") ? path101 : `/${path101}`}`;
8953
+ url(path102) {
8954
+ return `${this.config.apiUrl}${path102.startsWith("/") ? path102 : `/${path102}`}`;
8955
8955
  }
8956
8956
  headers(extra) {
8957
8957
  return {
@@ -8961,9 +8961,9 @@ var PlatformApiClient = class {
8961
8961
  ...extra
8962
8962
  };
8963
8963
  }
8964
- async request(method, path101, init4) {
8964
+ async request(method, path102, init4) {
8965
8965
  const response = await fetchWithRetry(
8966
- this.url(path101),
8966
+ this.url(path102),
8967
8967
  {
8968
8968
  method,
8969
8969
  ...init4,
@@ -9326,15 +9326,15 @@ var PlatformApiClient = class {
9326
9326
  }
9327
9327
  );
9328
9328
  }
9329
- deleteDevPortalPage(projectId, path101) {
9330
- const query = new URLSearchParams({ path: path101 });
9329
+ deleteDevPortalPage(projectId, path102) {
9330
+ const query = new URLSearchParams({ path: path102 });
9331
9331
  return this.request(
9332
9332
  "DELETE",
9333
9333
  `/api/v1/projects/${projectId}/dev-portal/pages/files?${query.toString()}`
9334
9334
  );
9335
9335
  }
9336
- renameDevPortalPage(projectId, path101, newName) {
9337
- const query = new URLSearchParams({ path: path101 });
9336
+ renameDevPortalPage(projectId, path102, newName) {
9337
+ const query = new URLSearchParams({ path: path102 });
9338
9338
  return this.request(
9339
9339
  "POST",
9340
9340
  `/api/v1/projects/${projectId}/dev-portal/pages/files/rename?${query.toString()}`,
@@ -9450,8 +9450,8 @@ var PlatformApiClient = class {
9450
9450
  * the project-less endpoint is used; `planTier` overrides the tier used for paid-plan checks.
9451
9451
  */
9452
9452
  validateGatewayPlans(plans, options = {}) {
9453
- const path101 = options.projectId ? `/api/v1/projects/${options.projectId}/gateway/plans/validate` : "/api/v1/gateway/plans/validate";
9454
- return this.request("POST", path101, {
9453
+ const path102 = options.projectId ? `/api/v1/projects/${options.projectId}/gateway/plans/validate` : "/api/v1/gateway/plans/validate";
9454
+ return this.request("POST", path102, {
9455
9455
  headers: { "Content-Type": "application/json" },
9456
9456
  body: JSON.stringify({ plans, planTier: options.planTier })
9457
9457
  });
@@ -9552,8 +9552,8 @@ var PlatformApiClient = class {
9552
9552
  }
9553
9553
  };
9554
9554
  async function readFileBytes(filePath) {
9555
- const { readFile: readFile30 } = await import("node:fs/promises");
9556
- const buffer = await readFile30(filePath);
9555
+ const { readFile: readFile31 } = await import("node:fs/promises");
9556
+ const buffer = await readFile31(filePath);
9557
9557
  const arrayBuffer = new ArrayBuffer(buffer.byteLength);
9558
9558
  new Uint8Array(arrayBuffer).set(buffer);
9559
9559
  return arrayBuffer;
@@ -9650,13 +9650,13 @@ function resolveProjectId(explicit, config2) {
9650
9650
  import {
9651
9651
  access as access4,
9652
9652
  mkdir as mkdir12,
9653
- readFile as readFile11,
9653
+ readFile as readFile12,
9654
9654
  rename as rename6,
9655
9655
  rm as rm8,
9656
- writeFile as writeFile13
9656
+ writeFile as writeFile14
9657
9657
  } from "node:fs/promises";
9658
9658
  import { createRequire as createRequire2 } from "node:module";
9659
- import path46 from "node:path";
9659
+ import path47 from "node:path";
9660
9660
 
9661
9661
  // src/vite/build.ts
9662
9662
  import { mkdir as mkdir11, readFile as readFile10, rename as rename5, rm as rm7, writeFile as writeFile12 } from "node:fs/promises";
@@ -9807,7 +9807,7 @@ import {
9807
9807
  // package.json
9808
9808
  var package_default = {
9809
9809
  name: "@lukoweb/apitogo",
9810
- version: "0.2.17",
9810
+ version: "0.2.18",
9811
9811
  type: "module",
9812
9812
  sideEffects: [
9813
9813
  "**/*.css",
@@ -10589,14 +10589,14 @@ var flattenAllOf = (schema2) => {
10589
10589
  };
10590
10590
 
10591
10591
  // src/lib/util/traverse.ts
10592
- var traverse = (specification, transform, path101 = []) => {
10593
- const transformed = transform(specification, path101);
10592
+ var traverse = (specification, transform, path102 = []) => {
10593
+ const transformed = transform(specification, path102);
10594
10594
  if (typeof transformed !== "object" || transformed === null) {
10595
10595
  return transformed;
10596
10596
  }
10597
10597
  const result = Array.isArray(transformed) ? [] : {};
10598
10598
  for (const [key, value] of Object.entries(transformed)) {
10599
- const currentPath = [...path101, key];
10599
+ const currentPath = [...path102, key];
10600
10600
  if (Array.isArray(value)) {
10601
10601
  result[key] = value.map(
10602
10602
  (item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
@@ -10624,9 +10624,9 @@ var resolveLocalRef = (schema2, ref) => {
10624
10624
  if (schemaCache?.has(ref)) {
10625
10625
  return schemaCache.get(ref);
10626
10626
  }
10627
- const path101 = ref.split("/").slice(1);
10627
+ const path102 = ref.split("/").slice(1);
10628
10628
  let current = schema2;
10629
- for (const segment of path101) {
10629
+ for (const segment of path102) {
10630
10630
  if (!current || typeof current !== "object") {
10631
10631
  current = null;
10632
10632
  }
@@ -10645,7 +10645,7 @@ var dereference = async (schema2, resolvers = []) => {
10645
10645
  }
10646
10646
  const cloned = structuredClone(schema2);
10647
10647
  const visited = /* @__PURE__ */ new Set();
10648
- const resolve = async (current, path101) => {
10648
+ const resolve = async (current, path102) => {
10649
10649
  if (isIndexableObject(current)) {
10650
10650
  if (visited.has(current)) {
10651
10651
  return CIRCULAR_REF;
@@ -10653,7 +10653,7 @@ var dereference = async (schema2, resolvers = []) => {
10653
10653
  visited.add(current);
10654
10654
  if (Array.isArray(current)) {
10655
10655
  for (let index = 0; index < current.length; index++) {
10656
- current[index] = await resolve(current[index], `${path101}/${index}`);
10656
+ current[index] = await resolve(current[index], `${path102}/${index}`);
10657
10657
  }
10658
10658
  } else {
10659
10659
  if ("$ref" in current && typeof current.$ref === "string") {
@@ -10664,13 +10664,13 @@ var dereference = async (schema2, resolvers = []) => {
10664
10664
  for (const resolver of resolvers) {
10665
10665
  const resolved = await resolver($ref);
10666
10666
  if (resolved) {
10667
- result2 = await resolve(resolved, path101);
10667
+ result2 = await resolve(resolved, path102);
10668
10668
  break;
10669
10669
  }
10670
10670
  }
10671
10671
  if (result2 === void 0) {
10672
10672
  const resolved = await resolveLocalRef(cloned, $ref);
10673
- result2 = await resolve(resolved, path101);
10673
+ result2 = await resolve(resolved, path102);
10674
10674
  }
10675
10675
  if (hasSiblings) {
10676
10676
  if (result2 === CIRCULAR_REF) {
@@ -10683,7 +10683,7 @@ var dereference = async (schema2, resolvers = []) => {
10683
10683
  return result2;
10684
10684
  }
10685
10685
  for (const key in current) {
10686
- current[key] = await resolve(current[key], `${path101}/${key}`);
10686
+ current[key] = await resolve(current[key], `${path102}/${key}`);
10687
10687
  }
10688
10688
  }
10689
10689
  visited.delete(current);
@@ -10722,9 +10722,9 @@ var upgradeSchema = (schema2) => {
10722
10722
  }
10723
10723
  return sub;
10724
10724
  });
10725
- schema2 = traverse(schema2, (sub, path101) => {
10725
+ schema2 = traverse(schema2, (sub, path102) => {
10726
10726
  if (sub.example !== void 0) {
10727
- if (isSchemaPath(path101 ?? [])) {
10727
+ if (isSchemaPath(path102 ?? [])) {
10728
10728
  sub.examples = [sub.example];
10729
10729
  } else {
10730
10730
  sub.examples = {
@@ -10737,11 +10737,11 @@ var upgradeSchema = (schema2) => {
10737
10737
  }
10738
10738
  return sub;
10739
10739
  });
10740
- schema2 = traverse(schema2, (schema3, path101) => {
10740
+ schema2 = traverse(schema2, (schema3, path102) => {
10741
10741
  if (schema3.type === "object" && schema3.properties !== void 0) {
10742
- const parentPath = path101?.slice(0, -1);
10742
+ const parentPath = path102?.slice(0, -1);
10743
10743
  const isMultipart = parentPath?.some((segment, index) => {
10744
- return segment === "content" && path101?.[index + 1] === "multipart/form-data";
10744
+ return segment === "content" && path102?.[index + 1] === "multipart/form-data";
10745
10745
  });
10746
10746
  if (isMultipart) {
10747
10747
  const entries = Object.entries(schema3.properties);
@@ -10755,8 +10755,8 @@ var upgradeSchema = (schema2) => {
10755
10755
  }
10756
10756
  return schema3;
10757
10757
  });
10758
- schema2 = traverse(schema2, (schema3, path101) => {
10759
- if (path101?.includes("content") && path101.includes("application/octet-stream")) {
10758
+ schema2 = traverse(schema2, (schema3, path102) => {
10759
+ if (path102?.includes("content") && path102.includes("application/octet-stream")) {
10760
10760
  return {};
10761
10761
  }
10762
10762
  if (schema3.type === "string" && schema3.format === "binary") {
@@ -10782,11 +10782,11 @@ var upgradeSchema = (schema2) => {
10782
10782
  }
10783
10783
  return sub;
10784
10784
  });
10785
- schema2 = traverse(schema2, (schema3, path101) => {
10785
+ schema2 = traverse(schema2, (schema3, path102) => {
10786
10786
  if (schema3.type === "string" && schema3.format === "byte") {
10787
- const parentPath = path101?.slice(0, -1);
10787
+ const parentPath = path102?.slice(0, -1);
10788
10788
  const contentMediaType = parentPath?.find(
10789
- (_, index) => path101?.[index - 1] === "content"
10789
+ (_, index) => path102?.[index - 1] === "content"
10790
10790
  );
10791
10791
  return {
10792
10792
  type: "string",
@@ -10798,7 +10798,7 @@ var upgradeSchema = (schema2) => {
10798
10798
  });
10799
10799
  return schema2;
10800
10800
  };
10801
- function isSchemaPath(path101) {
10801
+ function isSchemaPath(path102) {
10802
10802
  const schemaLocations = [
10803
10803
  ["components", "schemas"],
10804
10804
  "properties",
@@ -10811,10 +10811,10 @@ function isSchemaPath(path101) {
10811
10811
  ];
10812
10812
  return schemaLocations.some((location) => {
10813
10813
  if (Array.isArray(location)) {
10814
- return location.every((segment, index) => path101[index] === segment);
10814
+ return location.every((segment, index) => path102[index] === segment);
10815
10815
  }
10816
- return path101.includes(location);
10817
- }) || path101.includes("schema") || path101.some((segment) => segment.endsWith("Schema"));
10816
+ return path102.includes(location);
10817
+ }) || path102.includes("schema") || path102.some((segment) => segment.endsWith("Schema"));
10818
10818
  }
10819
10819
 
10820
10820
  // src/lib/oas/parser/index.ts
@@ -10896,13 +10896,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
10896
10896
  "anyOf",
10897
10897
  "oneOf"
10898
10898
  ]);
10899
- var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path101 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
10899
+ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path102 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
10900
10900
  if (obj === null || typeof obj !== "object") return obj;
10901
10901
  const refPath = obj.__$ref;
10902
10902
  const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
10903
10903
  if (isCircular) {
10904
10904
  if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
10905
- const circularProp = path101.find((p) => !OPENAPI_PROPS.has(p)) || path101[0];
10905
+ const circularProp = path102.find((p) => !OPENAPI_PROPS.has(p)) || path102[0];
10906
10906
  return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
10907
10907
  }
10908
10908
  if (refs.has(obj)) return refs.get(obj);
@@ -10912,7 +10912,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
10912
10912
  value,
10913
10913
  currentPath,
10914
10914
  refs,
10915
- [...path101, key],
10915
+ [...path102, key],
10916
10916
  currentRefPaths
10917
10917
  );
10918
10918
  const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
@@ -10947,7 +10947,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
10947
10947
  var getAllTags = (schema2) => {
10948
10948
  const rootTags = schema2.tags ?? [];
10949
10949
  const operations = Object.values(schema2.paths ?? {}).flatMap(
10950
- (path101) => HttpMethods.map((k) => path101?.[k]).filter((op) => op != null)
10950
+ (path102) => HttpMethods.map((k) => path102?.[k]).filter((op) => op != null)
10951
10951
  );
10952
10952
  const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
10953
10953
  const hasUntaggedOperations = operations.some(
@@ -11002,7 +11002,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
11002
11002
  var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
11003
11003
  var getAllOperations = (paths) => {
11004
11004
  const operations = Object.entries(paths ?? {}).flatMap(
11005
- ([path101, value]) => HttpMethods.flatMap((method) => {
11005
+ ([path102, value]) => HttpMethods.flatMap((method) => {
11006
11006
  if (!value?.[method]) return [];
11007
11007
  const operation = value[method];
11008
11008
  const pathParameters = value.parameters ?? [];
@@ -11022,7 +11022,7 @@ var getAllOperations = (paths) => {
11022
11022
  return {
11023
11023
  ...operation,
11024
11024
  method,
11025
- path: path101,
11025
+ path: path102,
11026
11026
  parameters,
11027
11027
  servers,
11028
11028
  tags: operation.tags ?? []
@@ -11380,8 +11380,8 @@ var Schema = builder.objectRef("Schema").implement({
11380
11380
  }),
11381
11381
  paths: t.field({
11382
11382
  type: [PathItem],
11383
- resolve: (root) => Object.entries(root.paths ?? {}).map(([path101, value]) => ({
11384
- path: path101,
11383
+ resolve: (root) => Object.entries(root.paths ?? {}).map(([path102, value]) => ({
11384
+ path: path102,
11385
11385
  // biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
11386
11386
  methods: Object.keys(value)
11387
11387
  }))
@@ -11546,7 +11546,7 @@ init_joinUrl();
11546
11546
 
11547
11547
  // src/vite/api/schema-codegen.ts
11548
11548
  var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
11549
- var getSegmentsFromPath = (path101) => path101.split("/").slice(1).map(unescapeJsonPointer);
11549
+ var getSegmentsFromPath = (path102) => path102.split("/").slice(1).map(unescapeJsonPointer);
11550
11550
  var createLocalRefMap = (obj) => {
11551
11551
  const refMap = /* @__PURE__ */ new Map();
11552
11552
  const siblingsMap = /* @__PURE__ */ new Map();
@@ -11577,16 +11577,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
11577
11577
  /"__refMap\+Siblings:(.*?)"/g,
11578
11578
  (_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
11579
11579
  );
11580
- var lookup = (schema2, path101, filePath) => {
11581
- const parts = getSegmentsFromPath(path101);
11580
+ var lookup = (schema2, path102, filePath) => {
11581
+ const parts = getSegmentsFromPath(path102);
11582
11582
  let val = schema2;
11583
11583
  for (const part of parts) {
11584
11584
  while (val.$ref?.startsWith("#/")) {
11585
- val = val.$ref === path101 ? val : lookup(schema2, val.$ref, filePath);
11585
+ val = val.$ref === path102 ? val : lookup(schema2, val.$ref, filePath);
11586
11586
  }
11587
11587
  if (val[part] === void 0) {
11588
11588
  throw new Error(
11589
- `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path101}`
11589
+ `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path102}`
11590
11590
  );
11591
11591
  }
11592
11592
  val = val[part];
@@ -11831,8 +11831,8 @@ var SchemaManager = class {
11831
11831
  }
11832
11832
  }
11833
11833
  };
11834
- getLatestSchema = (path101) => this.processedSchemas[path101]?.at(0);
11835
- getSchemasForPath = (path101) => this.processedSchemas[path101];
11834
+ getLatestSchema = (path102) => this.processedSchemas[path102]?.at(0);
11835
+ getSchemasForPath = (path102) => this.processedSchemas[path102];
11836
11836
  getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
11837
11837
  getUrlToFilePathMap = () => {
11838
11838
  const map = /* @__PURE__ */ new Map();
@@ -14252,14 +14252,14 @@ async function generateSitemap({
14252
14252
 
14253
14253
  // src/vite/prerender/utils.ts
14254
14254
  init_joinUrl();
14255
- var resolveRoutePath = (path101) => {
14256
- const segments = path101.split("/");
14255
+ var resolveRoutePath = (path102) => {
14256
+ const segments = path102.split("/");
14257
14257
  if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
14258
14258
  return void 0;
14259
14259
  }
14260
14260
  return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
14261
14261
  };
14262
- var isSkipped = (path101) => path101.includes("*") || /^\d+$/.test(path101);
14262
+ var isSkipped = (path102) => path102.includes("*") || /^\d+$/.test(path102);
14263
14263
  var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
14264
14264
  if (route.path && isSkipped(route.path)) return [];
14265
14265
  const routePath = route.path ? resolveRoutePath(route.path) : void 0;
@@ -14615,8 +14615,60 @@ var bundleSSREntry = async (options) => {
14615
14615
 
14616
14616
  // src/cli/portal/v2.ts
14617
14617
  init_package_json();
14618
+
14619
+ // src/cli/init/v2-packages.ts
14620
+ import { existsSync as existsSync5 } from "node:fs";
14621
+ import { readFile as readFile11, writeFile as writeFile13 } from "node:fs/promises";
14622
+ import path46 from "node:path";
14623
+ var CORE_PACKAGES = [
14624
+ "@lukoweb/apitogo",
14625
+ "react",
14626
+ "react-dom"
14627
+ ];
14628
+ var portalPackageSpecs = (version) => [
14629
+ `@lukoweb/apitogo@${version}`,
14630
+ "react@19",
14631
+ "react-dom@19"
14632
+ ];
14633
+ var installCommand = (version) => `npm install --save-dev ${portalPackageSpecs(version).join(" ")}`;
14634
+ function packageNameFrom(name) {
14635
+ const slug = name.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[._-]+|[._-]+$/g, "");
14636
+ return slug || "portal";
14637
+ }
14638
+ async function ensurePackageJson(dir, name) {
14639
+ const file = path46.join(dir, "package.json");
14640
+ if (existsSync5(file)) return false;
14641
+ await writeFile13(
14642
+ file,
14643
+ `${JSON.stringify(
14644
+ {
14645
+ name: packageNameFrom(name),
14646
+ version: "0.0.1",
14647
+ private: true,
14648
+ type: "module"
14649
+ },
14650
+ null,
14651
+ 2
14652
+ )}
14653
+ `
14654
+ );
14655
+ return true;
14656
+ }
14657
+ function isPackageInstalled(startDir, name) {
14658
+ let dir = path46.resolve(startDir);
14659
+ for (; ; ) {
14660
+ if (existsSync5(path46.join(dir, "node_modules", name, "package.json")))
14661
+ return true;
14662
+ const parent = path46.dirname(dir);
14663
+ if (parent === dir) return false;
14664
+ dir = parent;
14665
+ }
14666
+ }
14667
+ var missingCorePackages = (dir) => CORE_PACKAGES.filter((name) => !isPackageInstalled(dir, name));
14668
+
14669
+ // src/cli/portal/v2.ts
14618
14670
  function assertPackagesInstalled(resolved, prepared) {
14619
- const require2 = createRequire2(path46.join(resolved.configDir, "package.json"));
14671
+ const require2 = createRequire2(path47.join(resolved.configDir, "package.json"));
14620
14672
  const missing = requiredPackages(prepared.plan).filter((name) => {
14621
14673
  try {
14622
14674
  require2.resolve(name);
@@ -14625,16 +14677,22 @@ function assertPackagesInstalled(resolved, prepared) {
14625
14677
  return true;
14626
14678
  }
14627
14679
  });
14628
- if (missing.length === 0) return;
14629
- throw new ConfigError(
14630
- resolved.configPath,
14631
- missing.map((name) => ({
14680
+ const missingCore = missingCorePackages(resolved.configDir);
14681
+ if (missing.length === 0 && missingCore.length === 0) return;
14682
+ throw new ConfigError(resolved.configPath, [
14683
+ ...missingCore.map((name) => ({
14684
+ code: "PORTAL_PACKAGE_MISSING",
14685
+ path: "",
14686
+ message: `the portal is built with ${name}, which is not installed in this project.`,
14687
+ hint: `Run \`${installCommand(getZudokuPackageJson().version)}\` in ${resolved.configDir}.`
14688
+ })),
14689
+ ...missing.map((name) => ({
14632
14690
  code: "PORTAL_PACKAGE_MISSING",
14633
14691
  path: "",
14634
14692
  message: `the portal registers a feature that needs ${name}, which is not installed.`,
14635
14693
  hint: `Run \`npm install ${name}\` in ${resolved.configDir}.`
14636
14694
  }))
14637
- );
14695
+ ]);
14638
14696
  }
14639
14697
  async function preparePortalWorkspace(dir, mode) {
14640
14698
  const { resolved } = loadConfigV2(dir);
@@ -14663,7 +14721,7 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
14663
14721
  return {
14664
14722
  name: "build",
14665
14723
  hash: () => hash2,
14666
- stillValid: () => access4(path46.join(buildDir, "index.html")).then(
14724
+ stillValid: () => access4(path47.join(buildDir, "index.html")).then(
14667
14725
  () => true,
14668
14726
  () => false
14669
14727
  ),
@@ -14676,11 +14734,11 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
14676
14734
  process.chdir(originalCwd);
14677
14735
  }
14678
14736
  await rm8(buildDir, { recursive: true, force: true });
14679
- await mkdir12(path46.dirname(buildDir), { recursive: true });
14680
- await rename6(path46.join(root, "dist"), buildDir);
14737
+ await mkdir12(path47.dirname(buildDir), { recursive: true });
14738
+ await rename6(path47.join(root, "dist"), buildDir);
14681
14739
  if (prepared.publishedManifest) {
14682
- await writeFile13(
14683
- path46.join(buildDir, MANIFEST_FILE),
14740
+ await writeFile14(
14741
+ path47.join(buildDir, MANIFEST_FILE),
14684
14742
  `${JSON.stringify(prepared.publishedManifest, null, 2)}
14685
14743
  `
14686
14744
  );
@@ -14709,17 +14767,17 @@ async function buildV2(options) {
14709
14767
  }
14710
14768
 
14711
14769
  // src/cli/check/gateway-online.ts
14712
- import { readFile as readFile12 } from "node:fs/promises";
14770
+ import { readFile as readFile13 } from "node:fs/promises";
14713
14771
  var SPEC_SEND_LIMIT = 5 * 1024 * 1024 + 64 * 1024;
14714
- var issue2 = (code, path101, message, hint) => ({ code, path: path101, message, hint });
14772
+ var issue2 = (code, path102, message, hint) => ({ code, path: path102, message, hint });
14715
14773
  function capabilityIssues(gateway, answer) {
14716
14774
  const can = answer.capabilities;
14717
14775
  const plan2 = `your ${answer.tier} plan`;
14718
14776
  const found = [];
14719
- const unsupported = (path101, what, hint) => found.push(
14777
+ const unsupported = (path102, what, hint) => found.push(
14720
14778
  issue2(
14721
14779
  "GATEWAY_CAPABILITY_UNSUPPORTED",
14722
- path101,
14780
+ path102,
14723
14781
  `${what} is not available on ${plan2}.`,
14724
14782
  hint
14725
14783
  )
@@ -14765,7 +14823,7 @@ async function onlineGatewayRules(gateway, projectId, api, derivedCors = []) {
14765
14823
  const specFile = gateway.specs[0];
14766
14824
  if (specFile) {
14767
14825
  try {
14768
- const text = await readFile12(specFile, "utf8");
14826
+ const text = await readFile13(specFile, "utf8");
14769
14827
  if (text.length <= SPEC_SEND_LIMIT) spec = text;
14770
14828
  } catch {
14771
14829
  }
@@ -14795,7 +14853,7 @@ async function onlineGatewayRules(gateway, projectId, api, derivedCors = []) {
14795
14853
  async function isConfigV2(dir) {
14796
14854
  try {
14797
14855
  return /"version"\s*:\s*2\b/.test(
14798
- await readFile13(path47.join(dir, APITOGO_CONFIG_FILENAME), "utf8")
14856
+ await readFile14(path48.join(dir, APITOGO_CONFIG_FILENAME), "utf8")
14799
14857
  );
14800
14858
  } catch {
14801
14859
  return false;
@@ -14889,7 +14947,7 @@ async function validatePortalBuild(dir) {
14889
14947
  }
14890
14948
  }
14891
14949
  async function runCheckV2(dir, args = {}, deps = {}) {
14892
- const configPath = path47.join(dir, APITOGO_CONFIG_FILENAME);
14950
+ const configPath = path48.join(dir, APITOGO_CONFIG_FILENAME);
14893
14951
  let report;
14894
14952
  let layout;
14895
14953
  try {
@@ -14978,8 +15036,155 @@ async function checkV2(dir, args, deps = platformDependencies(args)) {
14978
15036
  init_package_json();
14979
15037
 
14980
15038
  // src/cli/init/v2-handler.ts
14981
- import path48 from "node:path";
15039
+ import path50 from "node:path";
14982
15040
  import { createInterface } from "node:readline/promises";
15041
+ init_package_json();
15042
+
15043
+ // src/cli/platform/helpers/npm-build.ts
15044
+ import { spawn } from "node:child_process";
15045
+ import { access as access5, readFile as readFile15 } from "node:fs/promises";
15046
+ import path49 from "node:path";
15047
+ var BUILD_LOG_TAIL_BYTES = 8192;
15048
+ var MIN_NODE_MAJOR = 20;
15049
+ var NpmBuildError = class extends Error {
15050
+ buildLog;
15051
+ exitCode;
15052
+ constructor(message, buildLog, exitCode) {
15053
+ super(message);
15054
+ this.name = "NpmBuildError";
15055
+ this.buildLog = buildLog;
15056
+ this.exitCode = exitCode;
15057
+ }
15058
+ };
15059
+ function parseNodeMajor(version) {
15060
+ const match = /^v?(\d+)/.exec(version.trim());
15061
+ return match ? Number.parseInt(match[1], 10) : Number.NaN;
15062
+ }
15063
+ function assertNodeVersion(required) {
15064
+ const major = parseNodeMajor(process.version);
15065
+ if (Number.isNaN(major) || major < MIN_NODE_MAJOR) {
15066
+ throw new Error(
15067
+ `Node.js ${MIN_NODE_MAJOR}+ is required (current: ${process.version}).`
15068
+ );
15069
+ }
15070
+ if (required) {
15071
+ const requiredMajor = parseNodeMajor(required);
15072
+ if (!Number.isNaN(requiredMajor) && major < requiredMajor) {
15073
+ throw new Error(
15074
+ `Node.js ${requiredMajor}+ is required by nodeVersion option (current: ${process.version}).`
15075
+ );
15076
+ }
15077
+ }
15078
+ }
15079
+ function truncateBuildLog(log, success) {
15080
+ if (success && log.length > BUILD_LOG_TAIL_BYTES) {
15081
+ return log.slice(-BUILD_LOG_TAIL_BYTES);
15082
+ }
15083
+ return log;
15084
+ }
15085
+ async function pathExists(filePath) {
15086
+ try {
15087
+ await access5(filePath);
15088
+ return true;
15089
+ } catch {
15090
+ return false;
15091
+ }
15092
+ }
15093
+ function runCommand(command2, args, cwd, env) {
15094
+ return new Promise((resolve, reject) => {
15095
+ const child = spawn(command2, args, {
15096
+ cwd,
15097
+ env: env ? { ...process.env, ...env } : process.env,
15098
+ shell: process.platform === "win32"
15099
+ });
15100
+ let output4 = "";
15101
+ child.stdout.on("data", (chunk) => {
15102
+ output4 += chunk.toString();
15103
+ });
15104
+ child.stderr.on("data", (chunk) => {
15105
+ output4 += chunk.toString();
15106
+ });
15107
+ child.on("error", reject);
15108
+ child.on("close", (exitCode) => resolve({ exitCode, output: output4 }));
15109
+ });
15110
+ }
15111
+ async function runNpmCommand(args, cwd) {
15112
+ assertNodeVersion();
15113
+ const startedAt = Date.now();
15114
+ const result = await runCommand("npm", args, path49.resolve(cwd));
15115
+ if (result.exitCode !== 0) {
15116
+ throw new NpmBuildError(
15117
+ `npm ${args.join(" ")} exited ${result.exitCode ?? "unknown"}`,
15118
+ result.output,
15119
+ result.exitCode
15120
+ );
15121
+ }
15122
+ return {
15123
+ durationMs: Date.now() - startedAt,
15124
+ log: truncateBuildLog(result.output, true)
15125
+ };
15126
+ }
15127
+ async function runNpmInstall(sourceDirectory, options) {
15128
+ assertNodeVersion(options?.nodeVersion);
15129
+ const cwd = path49.resolve(sourceDirectory);
15130
+ const packageJsonPath = path49.join(cwd, "package.json");
15131
+ if (!await pathExists(packageJsonPath)) {
15132
+ throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
15133
+ }
15134
+ const startedAt = Date.now();
15135
+ const lockPath = path49.join(cwd, "package-lock.json");
15136
+ const installArgs = await pathExists(lockPath) ? ["ci"] : ["install"];
15137
+ const install = await runCommand("npm", installArgs, cwd);
15138
+ const installLog = install.output;
15139
+ if (install.exitCode !== 0) {
15140
+ throw new NpmBuildError(
15141
+ `npm ${installArgs.join(" ")} exited ${install.exitCode ?? "unknown"}`,
15142
+ installLog,
15143
+ install.exitCode
15144
+ );
15145
+ }
15146
+ return {
15147
+ durationMs: Date.now() - startedAt,
15148
+ installLog: truncateBuildLog(installLog, true)
15149
+ };
15150
+ }
15151
+ async function runNpmBuild(sourceDirectory, options) {
15152
+ assertNodeVersion(options?.nodeVersion);
15153
+ const cwd = path49.resolve(sourceDirectory);
15154
+ const packageJsonPath = path49.join(cwd, "package.json");
15155
+ if (!await pathExists(packageJsonPath)) {
15156
+ throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
15157
+ }
15158
+ const startedAt = Date.now();
15159
+ let buildLog = "";
15160
+ const install = await runNpmInstall(sourceDirectory, options);
15161
+ buildLog += install.installLog;
15162
+ const build2 = await runCommand("npm", ["run", "build"], cwd, options?.env);
15163
+ buildLog += build2.output;
15164
+ if (build2.exitCode !== 0) {
15165
+ throw new NpmBuildError(
15166
+ `npm run build exited ${build2.exitCode ?? "unknown"}`,
15167
+ buildLog,
15168
+ build2.exitCode
15169
+ );
15170
+ }
15171
+ const distPath = path49.join(cwd, "dist");
15172
+ const indexPath = path49.join(distPath, "index.html");
15173
+ if (!await pathExists(indexPath)) {
15174
+ throw new NpmBuildError(
15175
+ `Build completed but dist/index.html was not found at ${indexPath}`,
15176
+ buildLog,
15177
+ build2.exitCode
15178
+ );
15179
+ }
15180
+ return {
15181
+ distPath,
15182
+ durationMs: Date.now() - startedAt,
15183
+ buildLog: truncateBuildLog(buildLog, true)
15184
+ };
15185
+ }
15186
+
15187
+ // src/cli/init/v2-handler.ts
14983
15188
  function parseOnlyFlag(value) {
14984
15189
  const services = (value ?? "portal").split(",").map((name) => name.trim()).filter(Boolean);
14985
15190
  const unsupported = services.filter((name) => name !== "portal");
@@ -15031,17 +15236,34 @@ function describePlan(plan2) {
15031
15236
  layoutReason: plan2.layoutReason,
15032
15237
  docsIncluded: plan2.docsIncluded,
15033
15238
  willCreate: plan2.entries.map(
15034
- (entry) => path48.relative(plan2.dir, entry.path)
15239
+ (entry) => path50.relative(plan2.dir, entry.path)
15035
15240
  ),
15036
- willKeep: plan2.keep.map((target) => path48.relative(plan2.dir, target)),
15241
+ willKeep: plan2.keep.map((target) => path50.relative(plan2.dir, target)),
15037
15242
  replacesConfig: plan2.replacesConfig
15038
15243
  };
15039
15244
  }
15245
+ async function setUpPackages(options) {
15246
+ const version = getZudokuPackageJson().version;
15247
+ const command2 = installCommand(version);
15248
+ if (options.layout !== "standalone" || !options.install) {
15249
+ return { packageJsonCreated: false, installed: false, command: command2 };
15250
+ }
15251
+ const packageJsonCreated = await ensurePackageJson(options.dir, options.name);
15252
+ await withSpinner(
15253
+ "Installing @lukoweb/apitogo, react and react-dom\u2026",
15254
+ () => runNpmCommand(
15255
+ ["install", "--save-dev", ...portalPackageSpecs(version)],
15256
+ options.dir
15257
+ ),
15258
+ { silent: options.quiet }
15259
+ );
15260
+ return { packageJsonCreated, installed: true, command: command2 };
15261
+ }
15040
15262
  async function initV2(argv) {
15041
15263
  const json = argv.json === true;
15042
15264
  try {
15043
15265
  parseOnlyFlag(argv.only);
15044
- const dir = path48.resolve(process.cwd(), argv.dir ?? ".");
15266
+ const dir = path50.resolve(process.cwd(), argv.dir ?? ".");
15045
15267
  const options = {
15046
15268
  dir,
15047
15269
  layout: argv.layout,
@@ -15091,6 +15313,13 @@ async function initV2(argv) {
15091
15313
  }
15092
15314
  }
15093
15315
  const result = await applyInitPlan(plan2);
15316
+ const packages = await setUpPackages({
15317
+ dir,
15318
+ layout: plan2.layout,
15319
+ name: argv.name ?? path50.basename(dir),
15320
+ install: argv.install === true,
15321
+ quiet: json
15322
+ });
15094
15323
  if (json) {
15095
15324
  console.log(
15096
15325
  JSON.stringify(
@@ -15098,8 +15327,9 @@ async function initV2(argv) {
15098
15327
  status: "created",
15099
15328
  dir,
15100
15329
  ...describePlan(plan2),
15101
- created: result.created.map((p) => path48.relative(dir, p)),
15102
- kept: result.kept.map((p) => path48.relative(dir, p))
15330
+ created: result.created.map((p) => path50.relative(dir, p)),
15331
+ kept: result.kept.map((p) => path50.relative(dir, p)),
15332
+ packages
15103
15333
  },
15104
15334
  null,
15105
15335
  2
@@ -15108,8 +15338,16 @@ async function initV2(argv) {
15108
15338
  return;
15109
15339
  }
15110
15340
  printResultToConsole(
15111
- `Created ${path48.basename(plan2.configPath)} (config version 2, ${plan2.layout} layout) in ${dir}.`
15341
+ `Created ${path50.basename(plan2.configPath)} (config version 2, ${plan2.layout} layout) in ${dir}.`
15112
15342
  );
15343
+ if (packages.installed)
15344
+ printResultToConsole(
15345
+ "Installed @lukoweb/apitogo, react and react-dom (package.json was created for them)."
15346
+ );
15347
+ else
15348
+ printHintToConsole(
15349
+ `The portal needs @lukoweb/apitogo, react and react-dom in this project. Run: ${packages.command}`
15350
+ );
15113
15351
  printHintToConsole(
15114
15352
  "Config version 2 is a preview: add, remove, check, run, build, plan, status, deploy and secrets read it."
15115
15353
  );
@@ -15134,9 +15372,9 @@ async function initV2(argv) {
15134
15372
  }
15135
15373
 
15136
15374
  // src/cli/services/packages.ts
15137
- import { spawn } from "node:child_process";
15138
- import { existsSync as existsSync5 } from "node:fs";
15139
- import path49 from "node:path";
15375
+ import { spawn as spawn2 } from "node:child_process";
15376
+ import { existsSync as existsSync6 } from "node:fs";
15377
+ import path51 from "node:path";
15140
15378
  var USER_PANEL_PACKAGE = "@lukoweb/apitogo-module-user-panel";
15141
15379
  var BILLING_PLUGIN_PACKAGE = "@lukoweb/apitogo-plugin-dev-portal-billing";
15142
15380
  function packagesForConfig(config2) {
@@ -15151,26 +15389,26 @@ function packagesForConfig(config2) {
15151
15389
  ];
15152
15390
  }
15153
15391
  function isInstalled(dir, name) {
15154
- for (let current = path49.resolve(dir); ; current = path49.dirname(current)) {
15155
- if (existsSync5(path49.join(current, "node_modules", name, "package.json")))
15392
+ for (let current = path51.resolve(dir); ; current = path51.dirname(current)) {
15393
+ if (existsSync6(path51.join(current, "node_modules", name, "package.json")))
15156
15394
  return true;
15157
- if (path49.dirname(current) === current) return false;
15395
+ if (path51.dirname(current) === current) return false;
15158
15396
  }
15159
15397
  }
15160
15398
  function missingPackages(dir, names) {
15161
15399
  return names.filter((name) => !isInstalled(dir, name));
15162
15400
  }
15163
15401
  function detectPackageManager(dir) {
15164
- if (existsSync5(path49.join(dir, "pnpm-lock.yaml"))) return "pnpm";
15165
- if (existsSync5(path49.join(dir, "yarn.lock"))) return "yarn";
15402
+ if (existsSync6(path51.join(dir, "pnpm-lock.yaml"))) return "pnpm";
15403
+ if (existsSync6(path51.join(dir, "yarn.lock"))) return "yarn";
15166
15404
  return "npm";
15167
15405
  }
15168
- function installCommand(manager, names, version) {
15406
+ function installCommand2(manager, names, version) {
15169
15407
  const specs = names.map((name) => `${name}@${version}`);
15170
15408
  return manager === "npm" ? { command: "npm", args: ["install", ...specs] } : { command: manager, args: ["add", ...specs] };
15171
15409
  }
15172
15410
  var runInstaller = (dir, { command: command2, args }) => new Promise((resolve, reject) => {
15173
- const child = spawn(command2, args, {
15411
+ const child = spawn2(command2, args, {
15174
15412
  cwd: dir,
15175
15413
  stdio: "inherit",
15176
15414
  shell: process.platform === "win32"
@@ -15188,7 +15426,7 @@ var runInstaller = (dir, { command: command2, args }) => new Promise((resolve, r
15188
15426
  async function installMissingPackages(dir, config2, version, options) {
15189
15427
  const missing = missingPackages(dir, packagesForConfig(config2));
15190
15428
  if (missing.length === 0) return void 0;
15191
- const command2 = installCommand(detectPackageManager(dir), missing, version);
15429
+ const command2 = installCommand2(detectPackageManager(dir), missing, version);
15192
15430
  const shown = `${command2.command} ${command2.args.join(" ")}`;
15193
15431
  if (!options.install)
15194
15432
  return {
@@ -15197,7 +15435,7 @@ async function installMissingPackages(dir, config2, version, options) {
15197
15435
  reason: "--no-install was given",
15198
15436
  command: shown
15199
15437
  };
15200
- if (!existsSync5(path49.join(dir, "package.json")))
15438
+ if (!existsSync6(path51.join(dir, "package.json")))
15201
15439
  return {
15202
15440
  status: "skipped",
15203
15441
  packages: missing,
@@ -15216,7 +15454,7 @@ var list = (value) => {
15216
15454
  return items.length > 0 ? items : void 0;
15217
15455
  };
15218
15456
  function addOptionsFromArguments(service, argv) {
15219
- const dir = path50.resolve(process.cwd(), argv.dir ?? ".");
15457
+ const dir = path52.resolve(process.cwd(), argv.dir ?? ".");
15220
15458
  const issuers = list(argv.issuer);
15221
15459
  return {
15222
15460
  dir,
@@ -15275,8 +15513,8 @@ function describe(edit, dir) {
15275
15513
  return {
15276
15514
  service: edit.service,
15277
15515
  action: edit.action,
15278
- willCreate: edit.files.map((file) => path50.relative(dir, file.path)),
15279
- keep: edit.keep.map((file) => path50.relative(dir, file)),
15516
+ willCreate: edit.files.map((file) => path52.relative(dir, file.path)),
15517
+ keep: edit.keep.map((file) => path52.relative(dir, file)),
15280
15518
  notes: edit.notes
15281
15519
  };
15282
15520
  }
@@ -15289,7 +15527,7 @@ async function run(action, argv, plan2, deps = {}) {
15289
15527
  `Choose one of ${SERVICES.join(", ")}.`
15290
15528
  );
15291
15529
  }
15292
- const dir = path50.resolve(process.cwd(), argv.dir ?? ".");
15530
+ const dir = path52.resolve(process.cwd(), argv.dir ?? ".");
15293
15531
  if (!await isConfigV2(dir)) {
15294
15532
  throw new ServiceEditError(
15295
15533
  `${action} works with a config version 2 project, and there is none in ${dir}.`,
@@ -15336,7 +15574,7 @@ async function run(action, argv, plan2, deps = {}) {
15336
15574
  {
15337
15575
  status: action === "add" ? "added" : "removed",
15338
15576
  ...describe(edit, dir),
15339
- created: created.map((file) => path50.relative(dir, file)),
15577
+ created: created.map((file) => path52.relative(dir, file)),
15340
15578
  ...install ? { packages: install } : {}
15341
15579
  },
15342
15580
  null,
@@ -15346,7 +15584,7 @@ async function run(action, argv, plan2, deps = {}) {
15346
15584
  return;
15347
15585
  }
15348
15586
  printResultToConsole(
15349
- `${action === "add" ? "Added" : "Removed"} ${edit.service} in ${path50.basename(edit.configPath)}.`
15587
+ `${action === "add" ? "Added" : "Removed"} ${edit.service} in ${path52.basename(edit.configPath)}.`
15350
15588
  );
15351
15589
  } catch (error) {
15352
15590
  const message = error instanceof Error ? error.message : String(error);
@@ -15404,7 +15642,7 @@ var removeService = (argv) => run(
15404
15642
  "remove",
15405
15643
  argv,
15406
15644
  (service) => planRemoveService(service, {
15407
- dir: path50.resolve(process.cwd(), argv.dir ?? ".")
15645
+ dir: path52.resolve(process.cwd(), argv.dir ?? ".")
15408
15646
  })
15409
15647
  );
15410
15648
 
@@ -15552,16 +15790,16 @@ var add_default = {
15552
15790
  };
15553
15791
 
15554
15792
  // src/cli/build/handler.ts
15555
- import path52 from "node:path";
15793
+ import path54 from "node:path";
15556
15794
  init_logger();
15557
15795
  init_package_json();
15558
15796
 
15559
15797
  // src/cli/preview/handler.ts
15560
- import path51 from "node:path";
15798
+ import path53 from "node:path";
15561
15799
  import { preview as vitePreview } from "vite";
15562
15800
  var DEFAULT_PREVIEW_PORT = 4e3;
15563
15801
  async function preview(argv) {
15564
- const dir = path51.resolve(process.cwd(), argv.dir);
15802
+ const dir = path53.resolve(process.cwd(), argv.dir);
15565
15803
  const viteConfig = await getViteConfig(dir, {
15566
15804
  command: "serve",
15567
15805
  mode: "production",
@@ -15604,7 +15842,7 @@ async function build(argv) {
15604
15842
  printDiagnosticsToConsole("");
15605
15843
  printDiagnosticsToConsole("");
15606
15844
  }
15607
- const dir = path52.resolve(process.cwd(), argv.dir);
15845
+ const dir = path54.resolve(process.cwd(), argv.dir);
15608
15846
  try {
15609
15847
  if (await isConfigV2(dir)) {
15610
15848
  const result = await buildV2({ dir, jsonOnly });
@@ -15669,10 +15907,10 @@ var build_default = {
15669
15907
  };
15670
15908
 
15671
15909
  // src/cli/check/handler.ts
15672
- import path59 from "node:path";
15910
+ import path60 from "node:path";
15673
15911
 
15674
15912
  // src/cli/platform/tools/check-publish-readiness.ts
15675
- import path58 from "node:path";
15913
+ import path59 from "node:path";
15676
15914
 
15677
15915
  // src/cli/platform/helpers/dev-portal-backend.ts
15678
15916
  function deriveProvisioningState(backend) {
@@ -15755,12 +15993,12 @@ function formatDevPortalBackendResponse(projectId, backend) {
15755
15993
 
15756
15994
  // src/cli/platform/helpers/dev-portal-manifest.ts
15757
15995
  init_gateway_limits();
15758
- import { existsSync as existsSync6 } from "node:fs";
15759
- import { access as access5, mkdir as mkdir13, readFile as readFile14, writeFile as writeFile14 } from "node:fs/promises";
15760
- import path54 from "node:path";
15996
+ import { existsSync as existsSync7 } from "node:fs";
15997
+ import { access as access6, mkdir as mkdir13, readFile as readFile16, writeFile as writeFile15 } from "node:fs/promises";
15998
+ import path56 from "node:path";
15761
15999
 
15762
16000
  // src/cli/make-config/json-config.ts
15763
- import path53 from "node:path";
16001
+ import path55 from "node:path";
15764
16002
 
15765
16003
  // src/cli/make-config/branding-assets.ts
15766
16004
  var LOGO_LIGHT = '<svg xmlns="http://www.w3.org/2000/svg" width="201.57" height="72.66" viewBox="-0.09 -46.99 201.57 72.66">\n <path d="M13.5 0.39Q8.03 0.39 4.76 -2.09Q1.48 -4.57 1.41 -9.61H8.03Q8.14 -7.48 9.6 -6.41Q11.05 -5.33 13.42 -5.33Q15.57 -5.33 16.8 -6.2Q18.03 -7.07 18.03 -8.46Q18.03 -9.71 16.87 -10.44Q15.7 -11.17 13.32 -11.72L10.23 -12.44Q6.46 -13.3 4.32 -15.25Q2.17 -17.21 2.17 -20.49Q2.17 -23.18 3.62 -25.21Q5.08 -27.23 7.64 -28.36Q10.2 -29.49 13.5 -29.49Q16.88 -29.49 19.36 -28.35Q21.84 -27.21 23.2 -25.17Q24.57 -23.12 24.61 -20.43H17.99Q17.85 -22.01 16.7 -22.89Q15.55 -23.77 13.48 -23.77Q11.41 -23.77 10.35 -22.97Q9.3 -22.17 9.3 -20.96Q9.3 -19.61 10.47 -18.88Q11.64 -18.14 13.59 -17.71L16.11 -17.13Q20.33 -16.19 22.67 -14.06Q25 -11.93 25 -8.44Q25 -4.3 21.95 -1.95Q18.91 0.39 13.5 0.39Z M32.97 0.39Q29.82 0.39 27.8 -1.21Q25.78 -2.81 25.78 -6.05Q25.78 -8.48 26.89 -9.9Q28 -11.33 29.85 -12.01Q31.7 -12.7 33.9 -12.89Q36.68 -13.12 37.88 -13.47Q39.08 -13.81 39.08 -14.82V-14.9Q39.08 -16.04 38.29 -16.65Q37.5 -17.27 36.11 -17.27Q34.68 -17.27 33.77 -16.66Q32.85 -16.05 32.58 -15.02L26.4 -15.82Q27.05 -18.61 29.56 -20.36Q32.07 -22.11 36.17 -22.11Q38.88 -22.11 41.08 -21.27Q43.28 -20.43 44.58 -18.8Q45.88 -17.17 45.88 -14.82V0H39.47V-3.07H39.29Q37.48 0.39 32.97 0.39ZM35.04 -4.12Q36.75 -4.12 37.95 -5.14Q39.14 -6.15 39.14 -7.77V-9.86Q38.55 -9.55 37.44 -9.34Q36.33 -9.12 35.37 -8.96Q32.22 -8.5 32.22 -6.37Q32.22 -5.27 33.01 -4.7Q33.81 -4.12 35.04 -4.12Z M48.59 0V-21.84H54.86L55.17 -17.5Q56.07 -19.96 57.78 -21.04Q59.49 -22.13 61.46 -22.13Q63.53 -22.13 64.91 -20.94Q66.28 -19.75 67.08 -17.07Q68.08 -19.77 70.02 -20.95Q71.97 -22.13 74.17 -22.13Q77.24 -22.13 79.2 -20.16Q81.17 -18.18 81.17 -14.73V0H74.37V-13.18Q74.37 -14.84 73.5 -15.7Q72.63 -16.56 71.28 -16.56Q69.84 -16.56 69 -15.62Q68.16 -14.67 68.16 -13.11V0H61.61V-13.28Q61.61 -14.79 60.77 -15.67Q59.92 -16.56 58.57 -16.56Q57.18 -16.56 56.29 -15.62Q55.4 -14.69 55.4 -12.97V0Z M83.88 8.16V-21.84H90.62V-18.09H90.85Q91.26 -19.06 92.04 -19.99Q92.82 -20.92 94.05 -21.51Q95.28 -22.11 97.02 -22.11Q99.33 -22.11 101.31 -20.9Q103.29 -19.69 104.51 -17.21Q105.73 -14.73 105.73 -10.9Q105.73 -7.19 104.55 -4.7Q103.37 -2.21 101.39 -0.95Q99.4 0.31 96.98 0.31Q94.48 0.31 92.99 -0.87Q91.49 -2.05 90.85 -3.54H90.69V8.16ZM94.66 -5Q96.63 -5 97.68 -6.62Q98.72 -8.24 98.72 -10.9Q98.72 -13.55 97.68 -15.17Q96.63 -16.78 94.66 -16.78Q92.71 -16.78 91.62 -15.2Q90.54 -13.61 90.54 -10.9Q90.54 -8.22 91.62 -6.61Q92.71 -5 94.66 -5Z M114.4 -29.1V0H107.59V-29.1Z M127.29 0.41Q122.15 0.41 119.21 -2.59Q116.27 -5.59 116.27 -10.84Q116.27 -14.2 117.59 -16.74Q118.91 -19.28 121.33 -20.69Q123.75 -22.11 127.04 -22.11Q130.1 -22.11 132.47 -20.83Q134.85 -19.55 136.21 -17.06Q137.56 -14.57 137.56 -10.98V-9.26H122.97Q123.07 -6.89 124.27 -5.71Q125.47 -4.53 127.41 -4.53Q128.77 -4.53 129.77 -5.11Q130.77 -5.68 131.18 -6.78L137.25 -5.78Q136.43 -2.95 133.84 -1.27Q131.25 0.41 127.29 0.41ZM123.01 -13.22H131.1Q130.9 -15.08 129.89 -16.12Q128.87 -17.17 127.09 -17.17Q125.3 -17.17 124.25 -16.1Q123.21 -15.04 123.01 -13.22Z" fill="#202633"/>\n <path d="M138.48 0 148.19 -29.1H157.43L167.43 0H159.69L157.72 -6.19H148.03L146.14 0ZM149.65 -11.46H156.04L155.65 -12.71Q154.89 -15.21 154.16 -17.95Q153.44 -20.68 152.74 -23.61Q152.07 -20.66 151.42 -17.93Q150.77 -15.2 150.04 -12.71Z M168.81 0V-29.1H180.72Q184 -29.1 186.39 -27.83Q188.77 -26.56 190.05 -24.3Q191.33 -22.03 191.33 -19.04Q191.33 -16.04 190.02 -13.8Q188.71 -11.56 186.29 -10.32Q183.87 -9.08 180.53 -9.08H175.7V0ZM175.7 -14.53H179.28Q181.7 -14.53 182.94 -15.77Q184.18 -17.01 184.18 -19.04Q184.18 -21.09 182.93 -22.3Q181.68 -23.52 179.26 -23.52H175.7Z M199.98 -29.1V0H193.08V-29.1Z" fill="#008A7D"/>\n</svg>\n';
@@ -16230,9 +16468,9 @@ function openapiInputForConfig(specRelativePosix) {
16230
16468
  return `./${specRelativePosix}`;
16231
16469
  }
16232
16470
  function toRelativeOpenApiInput(projectDir, inputPath) {
16233
- const resolved = path53.isAbsolute(inputPath) ? inputPath : path53.resolve(projectDir, inputPath);
16234
- const relative = path53.relative(projectDir, resolved);
16235
- const posix = relative.split(path53.sep).join(path53.posix.sep);
16471
+ const resolved = path55.isAbsolute(inputPath) ? inputPath : path55.resolve(projectDir, inputPath);
16472
+ const relative = path55.relative(projectDir, resolved);
16473
+ const posix = relative.split(path55.sep).join(path55.posix.sep);
16236
16474
  if (!posix) {
16237
16475
  throw new Error("OpenAPI path must point to a file.");
16238
16476
  }
@@ -16512,7 +16750,7 @@ function isPlanFree(plan2) {
16512
16750
  return (plan2.priceAmount ?? 0) <= 0;
16513
16751
  }
16514
16752
  function manifestFilePath(siteDirectory) {
16515
- return path54.join(path54.resolve(siteDirectory), APITOGO_CONFIG_FILENAME2);
16753
+ return path56.join(path56.resolve(siteDirectory), APITOGO_CONFIG_FILENAME2);
16516
16754
  }
16517
16755
  var STORED_MANIFEST_KEYS = [
16518
16756
  "authentication",
@@ -16737,9 +16975,9 @@ function applyManifestToConfig(config2, manifest) {
16737
16975
  async function readLegacyManifest(_siteDirectory) {
16738
16976
  return null;
16739
16977
  }
16740
- async function pathExists(filePath) {
16978
+ async function pathExists2(filePath) {
16741
16979
  try {
16742
- await access5(filePath);
16980
+ await access6(filePath);
16743
16981
  return true;
16744
16982
  } catch {
16745
16983
  return false;
@@ -16985,39 +17223,39 @@ function resolveBackendSourceDirectory(siteDirectory, sourceDirectory) {
16985
17223
  if (!trimmed) {
16986
17224
  return void 0;
16987
17225
  }
16988
- return path54.resolve(siteDirectory, trimmed);
17226
+ return path56.resolve(siteDirectory, trimmed);
16989
17227
  }
16990
17228
  function resolveBackendOpenApiPath(openApiPath, options) {
16991
17229
  const trimmed = openApiPath?.trim();
16992
17230
  if (!trimmed) {
16993
17231
  return void 0;
16994
17232
  }
16995
- if (path54.isAbsolute(trimmed)) {
17233
+ if (path56.isAbsolute(trimmed)) {
16996
17234
  return trimmed;
16997
17235
  }
16998
- const siteResolved = path54.resolve(options.siteDirectory, trimmed);
16999
- if (existsSync6(siteResolved)) {
17236
+ const siteResolved = path56.resolve(options.siteDirectory, trimmed);
17237
+ if (existsSync7(siteResolved)) {
17000
17238
  return siteResolved;
17001
17239
  }
17002
17240
  const backendDir = options.backendSourceDirectory?.trim();
17003
17241
  if (backendDir) {
17004
- const backendResolved = path54.resolve(backendDir, trimmed);
17005
- if (existsSync6(backendResolved)) {
17242
+ const backendResolved = path56.resolve(backendDir, trimmed);
17243
+ if (existsSync7(backendResolved)) {
17006
17244
  return backendResolved;
17007
17245
  }
17008
17246
  }
17009
17247
  return siteResolved;
17010
17248
  }
17011
17249
  function toSiteRelativeOpenApiInput(siteDirectory, openApiAbsolutePath) {
17012
- const relative = path54.relative(
17013
- path54.resolve(siteDirectory),
17014
- path54.resolve(openApiAbsolutePath)
17250
+ const relative = path56.relative(
17251
+ path56.resolve(siteDirectory),
17252
+ path56.resolve(openApiAbsolutePath)
17015
17253
  );
17016
- const posix = relative.split(path54.sep).join("/");
17254
+ const posix = relative.split(path56.sep).join("/");
17017
17255
  if (!posix || posix === ".") {
17018
17256
  return "./";
17019
17257
  }
17020
- if (path54.isAbsolute(posix) || posix.startsWith("..")) {
17258
+ if (path56.isAbsolute(posix) || posix.startsWith("..")) {
17021
17259
  return posix;
17022
17260
  }
17023
17261
  return posix.startsWith("./") ? posix : `./${posix}`;
@@ -17055,8 +17293,8 @@ function applyOpenApiToSiteConfig(config2, options) {
17055
17293
  }
17056
17294
  async function readManifest2(siteDirectory) {
17057
17295
  const filePath = manifestFilePath(siteDirectory);
17058
- if (await pathExists(filePath)) {
17059
- const raw = await readFile14(filePath, "utf8");
17296
+ if (await pathExists2(filePath)) {
17297
+ const raw = await readFile16(filePath, "utf8");
17060
17298
  const config2 = JSON.parse(raw);
17061
17299
  return extractManifestFromConfig(config2);
17062
17300
  }
@@ -17064,10 +17302,10 @@ async function readManifest2(siteDirectory) {
17064
17302
  }
17065
17303
  async function writeManifest2(siteDirectory, manifest) {
17066
17304
  const filePath = manifestFilePath(siteDirectory);
17067
- await mkdir13(path54.dirname(filePath), { recursive: true });
17305
+ await mkdir13(path56.dirname(filePath), { recursive: true });
17068
17306
  let config2 = {};
17069
- if (await pathExists(filePath)) {
17070
- const raw = await readFile14(filePath, "utf8");
17307
+ if (await pathExists2(filePath)) {
17308
+ const raw = await readFile16(filePath, "utf8");
17071
17309
  config2 = JSON.parse(raw);
17072
17310
  }
17073
17311
  const {
@@ -17076,21 +17314,21 @@ async function writeManifest2(siteDirectory, manifest) {
17076
17314
  ...safeManifest
17077
17315
  } = manifest;
17078
17316
  config2 = applyManifestToConfig(config2, safeManifest);
17079
- await writeFile14(filePath, `${JSON.stringify(config2, null, 2)}
17317
+ await writeFile15(filePath, `${JSON.stringify(config2, null, 2)}
17080
17318
  `, "utf8");
17081
17319
  return filePath;
17082
17320
  }
17083
17321
 
17084
17322
  // src/cli/platform/helpers/dev-portal-secrets.ts
17085
17323
  import {
17086
- access as access6,
17324
+ access as access7,
17087
17325
  appendFile,
17088
17326
  mkdir as mkdir14,
17089
- readFile as readFile15,
17327
+ readFile as readFile17,
17090
17328
  unlink,
17091
- writeFile as writeFile15
17329
+ writeFile as writeFile16
17092
17330
  } from "node:fs/promises";
17093
- import path55 from "node:path";
17331
+ import path57 from "node:path";
17094
17332
  var ENV_FILENAME = ".env";
17095
17333
  var COLLAPSED_UPPERCASE_ALIASES2 = {
17096
17334
  SECRETKEY: "secretKey",
@@ -17192,7 +17430,7 @@ function applyEnvOverrides2(config2, env) {
17192
17430
  }
17193
17431
  async function readEnvFile(filePath) {
17194
17432
  try {
17195
- const raw = await readFile15(filePath, "utf8");
17433
+ const raw = await readFile17(filePath, "utf8");
17196
17434
  const env = {};
17197
17435
  for (const line2 of raw.split("\n")) {
17198
17436
  const trimmed = line2.trim();
@@ -17209,12 +17447,12 @@ async function readEnvFile(filePath) {
17209
17447
  }
17210
17448
  }
17211
17449
  async function loadSiteEnv(siteDirectory) {
17212
- const resolvedDirectory = path55.resolve(siteDirectory);
17450
+ const resolvedDirectory = path57.resolve(siteDirectory);
17213
17451
  const merged = { ...process.env };
17214
17452
  for (const fileName of [ENV_FILENAME, ".env.local"]) {
17215
17453
  Object.assign(
17216
17454
  merged,
17217
- await readEnvFile(path55.join(resolvedDirectory, fileName))
17455
+ await readEnvFile(path57.join(resolvedDirectory, fileName))
17218
17456
  );
17219
17457
  }
17220
17458
  return merged;
@@ -17251,7 +17489,7 @@ function buildAuthSecretsJson(secrets2, options) {
17251
17489
  return payload;
17252
17490
  }
17253
17491
  function envFilePath(siteDirectory) {
17254
- return path55.join(path55.resolve(siteDirectory), ENV_FILENAME);
17492
+ return path57.join(path57.resolve(siteDirectory), ENV_FILENAME);
17255
17493
  }
17256
17494
  function createEnvContent() {
17257
17495
  return [
@@ -17315,7 +17553,7 @@ function validateSecretsForPublish(manifest, secrets2, emailOptions) {
17315
17553
  }
17316
17554
  async function siteEnvFileHasEntries(siteDirectory) {
17317
17555
  for (const fileName of [ENV_FILENAME, ".env.local"]) {
17318
- const loaded = await readEnvFile(path55.join(siteDirectory, fileName));
17556
+ const loaded = await readEnvFile(path57.join(siteDirectory, fileName));
17319
17557
  if (Object.keys(loaded).length > 0) {
17320
17558
  return true;
17321
17559
  }
@@ -17323,7 +17561,7 @@ async function siteEnvFileHasEntries(siteDirectory) {
17323
17561
  return false;
17324
17562
  }
17325
17563
  async function resolvePublishConfig(siteDirectory, emailOptions) {
17326
- const resolvedDirectory = path55.resolve(siteDirectory);
17564
+ const resolvedDirectory = path57.resolve(siteDirectory);
17327
17565
  const manifestRaw = await readManifest2(resolvedDirectory);
17328
17566
  if (!manifestRaw) {
17329
17567
  throw new Error("apitogo.config.json not found in sourceDirectory.");
@@ -17356,20 +17594,20 @@ function envFileHasActiveAssignments(content) {
17356
17594
  });
17357
17595
  }
17358
17596
  async function writeScaffoldEnv(siteDirectory) {
17359
- const resolvedDirectory = path55.resolve(siteDirectory);
17597
+ const resolvedDirectory = path57.resolve(siteDirectory);
17360
17598
  const filesWritten = [];
17361
17599
  const envPath = envFilePath(resolvedDirectory);
17362
17600
  try {
17363
- await access6(envPath);
17601
+ await access7(envPath);
17364
17602
  } catch {
17365
17603
  await mkdir14(resolvedDirectory, { recursive: true });
17366
- await writeFile15(envPath, createEnvContent(), "utf8");
17604
+ await writeFile16(envPath, createEnvContent(), "utf8");
17367
17605
  filesWritten.push(ENV_FILENAME);
17368
17606
  }
17369
17607
  for (const legacyName of [".env.example"]) {
17370
- const legacyPath = path55.join(resolvedDirectory, legacyName);
17608
+ const legacyPath = path57.join(resolvedDirectory, legacyName);
17371
17609
  try {
17372
- const legacy = await readFile15(legacyPath, "utf8");
17610
+ const legacy = await readFile17(legacyPath, "utf8");
17373
17611
  if (!envFileHasActiveAssignments(legacy)) {
17374
17612
  await unlink(legacyPath);
17375
17613
  filesWritten.push(`removed:${legacyName}`);
@@ -17377,10 +17615,10 @@ async function writeScaffoldEnv(siteDirectory) {
17377
17615
  } catch {
17378
17616
  }
17379
17617
  }
17380
- const gitignorePath = path55.join(resolvedDirectory, ".gitignore");
17618
+ const gitignorePath = path57.join(resolvedDirectory, ".gitignore");
17381
17619
  let gitignore = "";
17382
17620
  try {
17383
- gitignore = await readFile15(gitignorePath, "utf8");
17621
+ gitignore = await readFile17(gitignorePath, "utf8");
17384
17622
  } catch {
17385
17623
  gitignore = "";
17386
17624
  }
@@ -17392,7 +17630,7 @@ async function writeScaffoldEnv(siteDirectory) {
17392
17630
  if (!hasEntry) {
17393
17631
  const suffix = gitignore.length === 0 ? "" : gitignore.endsWith("\n") ? "" : "\n";
17394
17632
  if (gitignore.length === 0) {
17395
- await writeFile15(gitignorePath, `${entry}
17633
+ await writeFile16(gitignorePath, `${entry}
17396
17634
  `, "utf8");
17397
17635
  } else {
17398
17636
  await appendFile(gitignorePath, `${suffix}${entry}
@@ -17412,13 +17650,13 @@ var SECRETS_COLLECTION_INSTRUCTION = "For go-live, plans must already be in apit
17412
17650
 
17413
17651
  // src/cli/platform/helpers/dev-portal-site-validation.ts
17414
17652
  init_gateway_limits();
17415
- import { readFile as readFile16 } from "node:fs/promises";
17653
+ import { readFile as readFile18 } from "node:fs/promises";
17416
17654
  import { createRequire as createRequire3 } from "node:module";
17417
- import path56 from "node:path";
17655
+ import path58 from "node:path";
17418
17656
  var cachedFallbackTs;
17419
17657
  async function loadTypeScriptForSite(sourceDirectory) {
17420
17658
  const require2 = createRequire3(
17421
- path56.join(path56.resolve(sourceDirectory), "package.json")
17659
+ path58.join(path58.resolve(sourceDirectory), "package.json")
17422
17660
  );
17423
17661
  try {
17424
17662
  return require2("typescript");
@@ -17464,8 +17702,8 @@ async function referencedFileExists(sourceDirectory, reference) {
17464
17702
  if (/^https?:\/\//i.test(reference)) {
17465
17703
  return true;
17466
17704
  }
17467
- return pathExists(
17468
- path56.resolve(sourceDirectory, reference.replace(/^\.\//, ""))
17705
+ return pathExists2(
17706
+ path58.resolve(sourceDirectory, reference.replace(/^\.\//, ""))
17469
17707
  );
17470
17708
  }
17471
17709
  async function validateSiteConfigStructure(config2, sourceDirectory) {
@@ -17580,17 +17818,17 @@ var DEFAULT_TSX_CANDIDATES = [
17580
17818
  "landing/LandingPage.tsx"
17581
17819
  ];
17582
17820
  async function validateDevPortalSiteConfig(sourceDirectory, options) {
17583
- const resolvedDir = path56.resolve(sourceDirectory);
17821
+ const resolvedDir = path58.resolve(sourceDirectory);
17584
17822
  const issues = [];
17585
17823
  const checkedFiles = [];
17586
17824
  const skippedChecks = [];
17587
- const jsonPath = path56.join(resolvedDir, APITOGO_CONFIG_FILENAME2);
17588
- if (await pathExists(jsonPath)) {
17825
+ const jsonPath = path58.join(resolvedDir, APITOGO_CONFIG_FILENAME2);
17826
+ if (await pathExists2(jsonPath)) {
17589
17827
  checkedFiles.push(APITOGO_CONFIG_FILENAME2);
17590
17828
  let parsed;
17591
17829
  let parseFailed = false;
17592
17830
  try {
17593
- parsed = JSON.parse(await readFile16(jsonPath, "utf8"));
17831
+ parsed = JSON.parse(await readFile18(jsonPath, "utf8"));
17594
17832
  } catch (error) {
17595
17833
  parseFailed = true;
17596
17834
  issues.push({
@@ -17616,7 +17854,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
17616
17854
  );
17617
17855
  const existingTsxFiles = [];
17618
17856
  for (const relativeFile of tsxFiles) {
17619
- if (await pathExists(path56.join(resolvedDir, relativeFile))) {
17857
+ if (await pathExists2(path58.join(resolvedDir, relativeFile))) {
17620
17858
  existingTsxFiles.push(relativeFile);
17621
17859
  }
17622
17860
  }
@@ -17629,8 +17867,8 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
17629
17867
  } else {
17630
17868
  for (const relativeFile of existingTsxFiles) {
17631
17869
  checkedFiles.push(relativeFile);
17632
- const content = await readFile16(
17633
- path56.join(resolvedDir, relativeFile),
17870
+ const content = await readFile18(
17871
+ path58.join(resolvedDir, relativeFile),
17634
17872
  "utf8"
17635
17873
  );
17636
17874
  issues.push(
@@ -17665,134 +17903,6 @@ function buildSiteValidationResponseFields(result) {
17665
17903
  };
17666
17904
  }
17667
17905
 
17668
- // src/cli/platform/helpers/npm-build.ts
17669
- import { spawn as spawn2 } from "node:child_process";
17670
- import { access as access7, readFile as readFile17 } from "node:fs/promises";
17671
- import path57 from "node:path";
17672
- var BUILD_LOG_TAIL_BYTES = 8192;
17673
- var MIN_NODE_MAJOR = 20;
17674
- var NpmBuildError = class extends Error {
17675
- buildLog;
17676
- exitCode;
17677
- constructor(message, buildLog, exitCode) {
17678
- super(message);
17679
- this.name = "NpmBuildError";
17680
- this.buildLog = buildLog;
17681
- this.exitCode = exitCode;
17682
- }
17683
- };
17684
- function parseNodeMajor(version) {
17685
- const match = /^v?(\d+)/.exec(version.trim());
17686
- return match ? Number.parseInt(match[1], 10) : Number.NaN;
17687
- }
17688
- function assertNodeVersion(required) {
17689
- const major = parseNodeMajor(process.version);
17690
- if (Number.isNaN(major) || major < MIN_NODE_MAJOR) {
17691
- throw new Error(
17692
- `Node.js ${MIN_NODE_MAJOR}+ is required (current: ${process.version}).`
17693
- );
17694
- }
17695
- if (required) {
17696
- const requiredMajor = parseNodeMajor(required);
17697
- if (!Number.isNaN(requiredMajor) && major < requiredMajor) {
17698
- throw new Error(
17699
- `Node.js ${requiredMajor}+ is required by nodeVersion option (current: ${process.version}).`
17700
- );
17701
- }
17702
- }
17703
- }
17704
- function truncateBuildLog(log, success) {
17705
- if (success && log.length > BUILD_LOG_TAIL_BYTES) {
17706
- return log.slice(-BUILD_LOG_TAIL_BYTES);
17707
- }
17708
- return log;
17709
- }
17710
- async function pathExists2(filePath) {
17711
- try {
17712
- await access7(filePath);
17713
- return true;
17714
- } catch {
17715
- return false;
17716
- }
17717
- }
17718
- function runCommand(command2, args, cwd, env) {
17719
- return new Promise((resolve, reject) => {
17720
- const child = spawn2(command2, args, {
17721
- cwd,
17722
- env: env ? { ...process.env, ...env } : process.env,
17723
- shell: process.platform === "win32"
17724
- });
17725
- let output4 = "";
17726
- child.stdout.on("data", (chunk) => {
17727
- output4 += chunk.toString();
17728
- });
17729
- child.stderr.on("data", (chunk) => {
17730
- output4 += chunk.toString();
17731
- });
17732
- child.on("error", reject);
17733
- child.on("close", (exitCode) => resolve({ exitCode, output: output4 }));
17734
- });
17735
- }
17736
- async function runNpmInstall(sourceDirectory, options) {
17737
- assertNodeVersion(options?.nodeVersion);
17738
- const cwd = path57.resolve(sourceDirectory);
17739
- const packageJsonPath = path57.join(cwd, "package.json");
17740
- if (!await pathExists2(packageJsonPath)) {
17741
- throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
17742
- }
17743
- const startedAt = Date.now();
17744
- const lockPath = path57.join(cwd, "package-lock.json");
17745
- const installArgs = await pathExists2(lockPath) ? ["ci"] : ["install"];
17746
- const install = await runCommand("npm", installArgs, cwd);
17747
- const installLog = install.output;
17748
- if (install.exitCode !== 0) {
17749
- throw new NpmBuildError(
17750
- `npm ${installArgs.join(" ")} exited ${install.exitCode ?? "unknown"}`,
17751
- installLog,
17752
- install.exitCode
17753
- );
17754
- }
17755
- return {
17756
- durationMs: Date.now() - startedAt,
17757
- installLog: truncateBuildLog(installLog, true)
17758
- };
17759
- }
17760
- async function runNpmBuild(sourceDirectory, options) {
17761
- assertNodeVersion(options?.nodeVersion);
17762
- const cwd = path57.resolve(sourceDirectory);
17763
- const packageJsonPath = path57.join(cwd, "package.json");
17764
- if (!await pathExists2(packageJsonPath)) {
17765
- throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
17766
- }
17767
- const startedAt = Date.now();
17768
- let buildLog = "";
17769
- const install = await runNpmInstall(sourceDirectory, options);
17770
- buildLog += install.installLog;
17771
- const build2 = await runCommand("npm", ["run", "build"], cwd, options?.env);
17772
- buildLog += build2.output;
17773
- if (build2.exitCode !== 0) {
17774
- throw new NpmBuildError(
17775
- `npm run build exited ${build2.exitCode ?? "unknown"}`,
17776
- buildLog,
17777
- build2.exitCode
17778
- );
17779
- }
17780
- const distPath = path57.join(cwd, "dist");
17781
- const indexPath = path57.join(distPath, "index.html");
17782
- if (!await pathExists2(indexPath)) {
17783
- throw new NpmBuildError(
17784
- `Build completed but dist/index.html was not found at ${indexPath}`,
17785
- buildLog,
17786
- build2.exitCode
17787
- );
17788
- }
17789
- return {
17790
- distPath,
17791
- durationMs: Date.now() - startedAt,
17792
- buildLog: truncateBuildLog(buildLog, true)
17793
- };
17794
- }
17795
-
17796
17906
  // src/cli/platform/helpers/paid-gateway-platform-compat.ts
17797
17907
  function listPaidManifestPlans(plans) {
17798
17908
  return (plans ?? []).filter((plan2) => !isPlanFree(plan2)).map((plan2) => ({
@@ -18162,7 +18272,7 @@ function validateManifestForPlatformPublish(manifest) {
18162
18272
 
18163
18273
  // src/cli/platform/tools/check-publish-readiness.ts
18164
18274
  async function checkPublishReadiness(client, _config, args) {
18165
- const sourceDirectory = path58.resolve(args.sourceDirectory);
18275
+ const sourceDirectory = path59.resolve(args.sourceDirectory);
18166
18276
  const manifest = await readManifest2(sourceDirectory) ?? createScaffoldManifest();
18167
18277
  const emailOptions = await resolveEmailOptionsForPublish(
18168
18278
  client,
@@ -18240,7 +18350,7 @@ async function checkPublishReadiness(client, _config, args) {
18240
18350
 
18241
18351
  // src/cli/check/handler.ts
18242
18352
  async function check(argv) {
18243
- const sourceDirectory = path59.resolve(process.cwd(), argv.dir);
18353
+ const sourceDirectory = path60.resolve(process.cwd(), argv.dir);
18244
18354
  if (await isConfigV2(sourceDirectory)) {
18245
18355
  await checkV2(sourceDirectory, argv);
18246
18356
  return;
@@ -18304,14 +18414,14 @@ var check_default = {
18304
18414
 
18305
18415
  // src/cli/make-config/handler.ts
18306
18416
  import { constants as constants2 } from "node:fs";
18307
- import { access as access12, mkdir as mkdir17, readFile as readFile22, writeFile as writeFile20 } from "node:fs/promises";
18308
- import path69 from "node:path";
18417
+ import { access as access12, mkdir as mkdir17, readFile as readFile23, writeFile as writeFile21 } from "node:fs/promises";
18418
+ import path70 from "node:path";
18309
18419
  import { stdin as input2 } from "node:process";
18310
18420
  import { glob as glob8 } from "glob";
18311
18421
 
18312
18422
  // src/cli/platform/helpers/openapi-action-keys.ts
18313
- import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
18314
- import path60 from "node:path";
18423
+ import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
18424
+ import path61 from "node:path";
18315
18425
  import YAML from "yaml";
18316
18426
  var HTTP_METHODS = [
18317
18427
  "get",
@@ -18380,7 +18490,7 @@ function extractGatewayActionKeysFromOpenApiDocument(document) {
18380
18490
  function extractGatewayActionKeysFromOpenApiFile(filePath) {
18381
18491
  try {
18382
18492
  const raw = readFileSync4(filePath, "utf8");
18383
- const ext = path60.extname(filePath).toLowerCase();
18493
+ const ext = path61.extname(filePath).toLowerCase();
18384
18494
  const parsed = ext === ".json" ? JSON.parse(raw) : YAML.parse(raw);
18385
18495
  return extractGatewayActionKeysFromOpenApiDocument(parsed);
18386
18496
  } catch {
@@ -18401,8 +18511,8 @@ function resolveConfigOpenApiFilePath(siteDirectory, config2) {
18401
18511
  }
18402
18512
  }
18403
18513
  for (const candidate of candidates) {
18404
- const resolved = path60.isAbsolute(candidate) ? candidate : path60.resolve(siteDirectory, candidate);
18405
- if (existsSync7(resolved)) {
18514
+ const resolved = path61.isAbsolute(candidate) ? candidate : path61.resolve(siteDirectory, candidate);
18515
+ if (existsSync8(resolved)) {
18406
18516
  return resolved;
18407
18517
  }
18408
18518
  }
@@ -18416,8 +18526,8 @@ function loadOpenApiActionKeysForSite(siteDirectory, config2) {
18416
18526
  return extractGatewayActionKeysFromOpenApiFile(filePath);
18417
18527
  }
18418
18528
  function loadOpenApiActionKeysFromSiteDirectory(siteDirectory) {
18419
- const configPath = path60.join(siteDirectory, "apitogo.config.json");
18420
- if (!existsSync7(configPath)) {
18529
+ const configPath = path61.join(siteDirectory, "apitogo.config.json");
18530
+ if (!existsSync8(configPath)) {
18421
18531
  return [];
18422
18532
  }
18423
18533
  try {
@@ -18444,12 +18554,12 @@ function withDefaultIncludedActionKeys(plan2, actionKeys) {
18444
18554
  }
18445
18555
 
18446
18556
  // src/cli/scaffold/dev-portal-config-pages.ts
18447
- import { access as access8, readFile as readFile18, rename as rename7, rm as rm9, writeFile as writeFile16 } from "node:fs/promises";
18448
- import path61 from "node:path";
18557
+ import { access as access8, readFile as readFile19, rename as rename7, rm as rm9, writeFile as writeFile17 } from "node:fs/promises";
18558
+ import path62 from "node:path";
18449
18559
  async function writeConfigAtomically(filePath, content) {
18450
18560
  const temporaryPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
18451
18561
  try {
18452
- await writeFile16(temporaryPath, content, "utf8");
18562
+ await writeFile17(temporaryPath, content, "utf8");
18453
18563
  await rename7(temporaryPath, filePath);
18454
18564
  } catch (error) {
18455
18565
  await rm9(temporaryPath, { force: true });
@@ -18458,7 +18568,7 @@ async function writeConfigAtomically(filePath, content) {
18458
18568
  }
18459
18569
  async function resolveApitogoConfigPath(sourceDirectory) {
18460
18570
  for (const filename of ["apitogo.config.tsx", "apitogo.config.jsx"]) {
18461
- const configPath = path61.join(sourceDirectory, filename);
18571
+ const configPath = path62.join(sourceDirectory, filename);
18462
18572
  try {
18463
18573
  await access8(configPath);
18464
18574
  return configPath;
@@ -19209,7 +19319,7 @@ async function wireNewDevPortalPageInConfig(sourceDirectory, slug, label) {
19209
19319
  if (!configPath) {
19210
19320
  return { updated: false };
19211
19321
  }
19212
- const original = await readFile18(configPath, "utf8");
19322
+ const original = await readFile19(configPath, "utf8");
19213
19323
  const patched = patchApitogoConfigForNewPage(original, slug, label, {
19214
19324
  typescript: configPath.endsWith(".tsx")
19215
19325
  });
@@ -19221,18 +19331,18 @@ async function wireNewDevPortalPageInConfig(sourceDirectory, slug, label) {
19221
19331
  }
19222
19332
 
19223
19333
  // src/cli/scaffold/wire-openapi.ts
19224
- import { access as access10, readFile as readFile20, writeFile as writeFile18 } from "node:fs/promises";
19225
- import path66 from "node:path";
19334
+ import { access as access10, readFile as readFile21, writeFile as writeFile19 } from "node:fs/promises";
19335
+ import path67 from "node:path";
19226
19336
 
19227
19337
  // src/cli/platform/helpers/openapi.ts
19228
19338
  import { promises as fs6 } from "node:fs";
19229
- import path63 from "node:path";
19339
+ import path64 from "node:path";
19230
19340
  import SwaggerParser from "@apidevtools/swagger-parser";
19231
19341
  import YAML2 from "yaml";
19232
19342
 
19233
19343
  // src/cli/scaffold/discover-openapi-files.ts
19234
19344
  import { promises as fs5 } from "node:fs";
19235
- import path62 from "node:path";
19345
+ import path63 from "node:path";
19236
19346
  var OPENAPI_BASENAMES = [
19237
19347
  "openapi.yaml",
19238
19348
  "openapi.yml",
@@ -19254,13 +19364,13 @@ var SKIP_OPENAPI_SEARCH_DIRS = /* @__PURE__ */ new Set([
19254
19364
  ".apitogo"
19255
19365
  ]);
19256
19366
  async function collectFromDir(dir, searchedDirectories, candidates) {
19257
- const resolved = path62.resolve(dir);
19367
+ const resolved = path63.resolve(dir);
19258
19368
  if (searchedDirectories.includes(resolved)) {
19259
19369
  return;
19260
19370
  }
19261
19371
  searchedDirectories.push(resolved);
19262
19372
  for (const name of OPENAPI_BASENAMES) {
19263
- const candidate = path62.join(resolved, name);
19373
+ const candidate = path63.join(resolved, name);
19264
19374
  try {
19265
19375
  await fs5.access(candidate);
19266
19376
  candidates.push(candidate);
@@ -19275,8 +19385,8 @@ async function collectSiteOpenApiFiles(siteDirectory) {
19275
19385
  return { candidates: [...new Set(candidates)], searchedDirectories };
19276
19386
  }
19277
19387
  async function collectNearbyOpenApiFiles(siteDirectory) {
19278
- const site = path62.resolve(siteDirectory);
19279
- const parent = path62.dirname(site);
19388
+ const site = path63.resolve(siteDirectory);
19389
+ const parent = path63.dirname(site);
19280
19390
  const searchedDirectories = [];
19281
19391
  const candidates = [];
19282
19392
  if (parent && parent !== site) {
@@ -19287,8 +19397,8 @@ async function collectNearbyOpenApiFiles(siteDirectory) {
19287
19397
  if (!entry.isDirectory() || SKIP_OPENAPI_SEARCH_DIRS.has(entry.name)) {
19288
19398
  continue;
19289
19399
  }
19290
- const sibling = path62.join(parent, entry.name);
19291
- if (path62.resolve(sibling) === site) {
19400
+ const sibling = path63.join(parent, entry.name);
19401
+ if (path63.resolve(sibling) === site) {
19292
19402
  continue;
19293
19403
  }
19294
19404
  await collectFromDir(sibling, searchedDirectories, candidates);
@@ -19316,7 +19426,7 @@ function parseOpenApiObject(doc) {
19316
19426
  };
19317
19427
  }
19318
19428
  function liteParseOpenApi(content, filePath) {
19319
- const ext = path62.extname(filePath).toLowerCase();
19429
+ const ext = path63.extname(filePath).toLowerCase();
19320
19430
  if (ext === ".json") {
19321
19431
  try {
19322
19432
  const parsed = JSON.parse(content);
@@ -19381,9 +19491,9 @@ async function discoverNearbyOpenApi(siteDirectory) {
19381
19491
  };
19382
19492
  }
19383
19493
  async function validateOpenApiFile(filePath) {
19384
- const resolved = path63.resolve(filePath);
19494
+ const resolved = path64.resolve(filePath);
19385
19495
  const content = await fs6.readFile(resolved, "utf8");
19386
- const ext = path63.extname(resolved).toLowerCase();
19496
+ const ext = path64.extname(resolved).toLowerCase();
19387
19497
  let parsed;
19388
19498
  try {
19389
19499
  parsed = ext === ".json" ? JSON.parse(content) : YAML2.parse(content);
@@ -19425,8 +19535,8 @@ async function validateOpenApiFile(filePath) {
19425
19535
  }
19426
19536
 
19427
19537
  // src/cli/scaffold/scaffold-dev-portal-site.ts
19428
- import { mkdir as mkdir15, readFile as readFile19, writeFile as writeFile17 } from "node:fs/promises";
19429
- import path65 from "node:path";
19538
+ import { mkdir as mkdir15, readFile as readFile20, writeFile as writeFile18 } from "node:fs/promises";
19539
+ import path66 from "node:path";
19430
19540
 
19431
19541
  // src/cli/scaffold/apitogo-npm-packages.ts
19432
19542
  var DEFAULT_CREATE_APITOGO_PACKAGE2 = "@lukoweb/create-apitogo@latest";
@@ -19514,7 +19624,7 @@ var DOC_TOOL_LOCAL_PACKAGE_PATHS = {
19514
19624
  // src/cli/scaffold/create-apitogo-cli.ts
19515
19625
  import { spawn as spawn3 } from "node:child_process";
19516
19626
  import { access as access9, rm as rm10 } from "node:fs/promises";
19517
- import path64 from "node:path";
19627
+ import path65 from "node:path";
19518
19628
  var SKIP_NEARBY_DISCOVERY_ENV = "APITOGO_SKIP_NEARBY_DISCOVERY";
19519
19629
  var CreateApitogoCliError = class extends Error {
19520
19630
  exitCode;
@@ -19531,9 +19641,9 @@ function resolveDocToolPath(explicit) {
19531
19641
  return value || void 0;
19532
19642
  }
19533
19643
  function splitOutputDirectory(outputDirectory) {
19534
- const resolvedOutputDirectory = path64.resolve(outputDirectory);
19535
- const projectName = path64.basename(resolvedOutputDirectory);
19536
- const parentDirectory = path64.dirname(resolvedOutputDirectory);
19644
+ const resolvedOutputDirectory = path65.resolve(outputDirectory);
19645
+ const projectName = path65.basename(resolvedOutputDirectory);
19646
+ const parentDirectory = path65.dirname(resolvedOutputDirectory);
19537
19647
  if (!projectName || projectName === "." || projectName === "..") {
19538
19648
  throw new Error(
19539
19649
  "outputDirectory must be a named folder (e.g. ./dev-portal-site), not the current directory."
@@ -19559,7 +19669,7 @@ async function directoryHasEntries(dir) {
19559
19669
  }
19560
19670
  }
19561
19671
  function resolveLocalCreateApitogoEntry(docToolPath) {
19562
- return path64.resolve(docToolPath, "packages/create-zudoku/dist/index.js");
19672
+ return path65.resolve(docToolPath, "packages/create-zudoku/dist/index.js");
19563
19673
  }
19564
19674
  async function resolveCreateApitogoInvocation(options) {
19565
19675
  const docToolPath = resolveDocToolPath(options.docToolPath);
@@ -19641,7 +19751,7 @@ async function runCreateApitogoDevPortal(options) {
19641
19751
  result.exitCode
19642
19752
  );
19643
19753
  }
19644
- if (!await pathExists3(path64.join(resolvedOutputDirectory, "package.json"))) {
19754
+ if (!await pathExists3(path65.join(resolvedOutputDirectory, "package.json"))) {
19645
19755
  throw new CreateApitogoCliError(
19646
19756
  `create-apitogo completed but package.json was not found at ${resolvedOutputDirectory}`,
19647
19757
  result.output,
@@ -19700,7 +19810,7 @@ function ensureRequiredApitogoModules(pkg, options) {
19700
19810
  ]
19701
19811
  ]) {
19702
19812
  if (options.docToolPath) {
19703
- deps[moduleName] = `file:${path65.join(options.docToolPath, localPath)}`;
19813
+ deps[moduleName] = `file:${path66.join(options.docToolPath, localPath)}`;
19704
19814
  continue;
19705
19815
  }
19706
19816
  deps[moduleName] = `npm:${moduleName}@${moduleAliasVersion}`;
@@ -19731,7 +19841,7 @@ function rewritePackageJson(raw, options) {
19731
19841
  DOC_TOOL_LOCAL_PACKAGE_PATHS
19732
19842
  )) {
19733
19843
  if (dep in deps) {
19734
- deps[dep] = `file:${path65.join(options.docToolPath, relativePath)}`;
19844
+ deps[dep] = `file:${path66.join(options.docToolPath, relativePath)}`;
19735
19845
  linkedWorkspacePackage = true;
19736
19846
  }
19737
19847
  }
@@ -19831,24 +19941,24 @@ function patchDashboardPageConfig(content) {
19831
19941
  );
19832
19942
  }
19833
19943
  async function ensureAccountPlansPage(outputDirectory) {
19834
- const pagePath = path65.join(outputDirectory, ACCOUNT_PLANS_PAGE_PATH);
19944
+ const pagePath = path66.join(outputDirectory, ACCOUNT_PLANS_PAGE_PATH);
19835
19945
  try {
19836
- await readFile19(pagePath, "utf8");
19946
+ await readFile20(pagePath, "utf8");
19837
19947
  return void 0;
19838
19948
  } catch {
19839
- await mkdir15(path65.dirname(pagePath), { recursive: true });
19840
- await writeFile17(pagePath, ACCOUNT_PLANS_PAGE);
19949
+ await mkdir15(path66.dirname(pagePath), { recursive: true });
19950
+ await writeFile18(pagePath, ACCOUNT_PLANS_PAGE);
19841
19951
  return ACCOUNT_PLANS_PAGE_PATH;
19842
19952
  }
19843
19953
  }
19844
19954
  async function ensureDashboardPage(outputDirectory) {
19845
- const pagePath = path65.join(outputDirectory, DASHBOARD_PAGE_PATH);
19955
+ const pagePath = path66.join(outputDirectory, DASHBOARD_PAGE_PATH);
19846
19956
  try {
19847
- await readFile19(pagePath, "utf8");
19957
+ await readFile20(pagePath, "utf8");
19848
19958
  return void 0;
19849
19959
  } catch {
19850
- await mkdir15(path65.dirname(pagePath), { recursive: true });
19851
- await writeFile17(pagePath, DASHBOARD_PAGE);
19960
+ await mkdir15(path66.dirname(pagePath), { recursive: true });
19961
+ await writeFile18(pagePath, DASHBOARD_PAGE);
19852
19962
  return DASHBOARD_PAGE_PATH;
19853
19963
  }
19854
19964
  }
@@ -19904,10 +20014,10 @@ function patchApitogoConfig(content, options) {
19904
20014
  async function patchScaffoldedSite(outputDirectory, options) {
19905
20015
  const title = options.branding?.title ?? options.siteName;
19906
20016
  const filesWritten = [];
19907
- const packageJsonPath = path65.join(outputDirectory, "package.json");
20017
+ const packageJsonPath = path66.join(outputDirectory, "package.json");
19908
20018
  if (options.patchPackageJson !== false) {
19909
- const packageJson3 = await readFile19(packageJsonPath, "utf8");
19910
- await writeFile17(
20019
+ const packageJson3 = await readFile20(packageJsonPath, "utf8");
20020
+ await writeFile18(
19911
20021
  packageJsonPath,
19912
20022
  rewritePackageJson(packageJson3, {
19913
20023
  siteName: options.siteName,
@@ -19917,9 +20027,9 @@ async function patchScaffoldedSite(outputDirectory, options) {
19917
20027
  );
19918
20028
  filesWritten.push("package.json");
19919
20029
  }
19920
- const configPath = path65.join(outputDirectory, "apitogo.config.tsx");
19921
- const configContent = await readFile19(configPath, "utf8");
19922
- await writeFile17(
20030
+ const configPath = path66.join(outputDirectory, "apitogo.config.tsx");
20031
+ const configContent = await readFile20(configPath, "utf8");
20032
+ await writeFile18(
19923
20033
  configPath,
19924
20034
  patchDashboardPageConfig(
19925
20035
  patchAccountPlansPageConfig(
@@ -20012,8 +20122,8 @@ async function discoverOpenApiByMode(siteDirectory, mode) {
20012
20122
  return discoverNearbyOpenApi(siteDirectory);
20013
20123
  }
20014
20124
  async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
20015
- const resolvedSource = path66.resolve(sourceDirectory);
20016
- const resolvedOpenApi = path66.resolve(openApiPath);
20125
+ const resolvedSource = path67.resolve(sourceDirectory);
20126
+ const resolvedOpenApi = path67.resolve(openApiPath);
20017
20127
  const input5 = toSiteRelativeOpenApiInput(resolvedSource, resolvedOpenApi);
20018
20128
  const validation = await validateOpenApiFile(resolvedOpenApi);
20019
20129
  if (!validation.valid) {
@@ -20025,24 +20135,24 @@ async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
20025
20135
  }
20026
20136
  const jsonConfigPath = manifestFilePath(resolvedSource);
20027
20137
  if (await pathExists4(jsonConfigPath)) {
20028
- const raw = await readFile20(jsonConfigPath, "utf8");
20138
+ const raw = await readFile21(jsonConfigPath, "utf8");
20029
20139
  const siteConfig = JSON.parse(raw);
20030
20140
  const updated = applyOpenApiToSiteConfig(siteConfig, {
20031
20141
  input: input5,
20032
20142
  apiPath: "api"
20033
20143
  });
20034
- await writeFile18(
20144
+ await writeFile19(
20035
20145
  jsonConfigPath,
20036
20146
  `${JSON.stringify(updated, null, 2)}
20037
20147
  `,
20038
20148
  "utf8"
20039
20149
  );
20040
20150
  } else {
20041
- const tsxConfigPath = path66.join(resolvedSource, "apitogo.config.tsx");
20042
- const configContent = await readFile20(tsxConfigPath, "utf8");
20151
+ const tsxConfigPath = path67.join(resolvedSource, "apitogo.config.tsx");
20152
+ const configContent = await readFile21(tsxConfigPath, "utf8");
20043
20153
  try {
20044
20154
  const patched = patchApitogoConfigOpenApiToFile(configContent, input5);
20045
- await writeFile18(tsxConfigPath, patched);
20155
+ await writeFile19(tsxConfigPath, patched);
20046
20156
  } catch (error) {
20047
20157
  return {
20048
20158
  status: "failed",
@@ -20124,7 +20234,7 @@ async function discoverAndWireOpenApi(siteDirectory, mode) {
20124
20234
  }
20125
20235
 
20126
20236
  // src/cli/make-config/interactive.ts
20127
- import path67 from "node:path";
20237
+ import path68 from "node:path";
20128
20238
  import { stdin as input, stdout as output } from "node:process";
20129
20239
  import { createInterface as createInterface3 } from "node:readline/promises";
20130
20240
 
@@ -20300,7 +20410,7 @@ async function promptMakeConfigInteractive(options) {
20300
20410
  continue;
20301
20411
  }
20302
20412
  const routePath = `/${slug}`;
20303
- const relativePath = path67.posix.join(options.pagesDir, `${slug}.tsx`);
20413
+ const relativePath = path68.posix.join(options.pagesDir, `${slug}.tsx`);
20304
20414
  const page = {
20305
20415
  slug,
20306
20416
  title: pageTitle.trim(),
@@ -20395,8 +20505,8 @@ export default function ${componentName}() {
20395
20505
  // src/cli/make-config/scaffold-project.ts
20396
20506
  init_package_json();
20397
20507
  import { constants } from "node:fs";
20398
- import { access as access11, mkdir as mkdir16, readFile as readFile21, writeFile as writeFile19 } from "node:fs/promises";
20399
- import path68 from "node:path";
20508
+ import { access as access11, mkdir as mkdir16, readFile as readFile22, writeFile as writeFile20 } from "node:fs/promises";
20509
+ import path69 from "node:path";
20400
20510
  import { glob as glob7 } from "glob";
20401
20511
 
20402
20512
  // src/cli/make-config/favicon-png.ts
@@ -20411,9 +20521,9 @@ var OPENAPI_GLOBS = [
20411
20521
  "openapi.yaml",
20412
20522
  "openapi.yml"
20413
20523
  ];
20414
- var toPosix2 = (p) => p.split(path68.sep).join("/");
20524
+ var toPosix2 = (p) => p.split(path69.sep).join("/");
20415
20525
  var sanitizePackageName = (dir) => {
20416
- const base = path68.basename(path68.resolve(dir));
20526
+ const base = path69.basename(path69.resolve(dir));
20417
20527
  const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
20418
20528
  return s || "apitogo-site";
20419
20529
  };
@@ -20423,7 +20533,7 @@ var apitogoVersionRange = () => {
20423
20533
  };
20424
20534
  async function findOpenApiSpecPath(dir) {
20425
20535
  for (const rel2 of OPENAPI_GLOBS) {
20426
- const full = path68.join(dir, rel2);
20536
+ const full = path69.join(dir, rel2);
20427
20537
  try {
20428
20538
  await access11(full, constants.R_OK);
20429
20539
  return toPosix2(rel2);
@@ -20437,8 +20547,8 @@ async function findOpenApiSpecPath(dir) {
20437
20547
  });
20438
20548
  return extra[0] ? toPosix2(extra[0]) : null;
20439
20549
  }
20440
- async function ensurePackageJson(dir) {
20441
- const pkgPath = path68.join(dir, "package.json");
20550
+ async function ensurePackageJson2(dir) {
20551
+ const pkgPath = path69.join(dir, "package.json");
20442
20552
  const apitogoVer = apitogoVersionRange();
20443
20553
  const baseDeps = {
20444
20554
  react: ">=19.0.0",
@@ -20473,11 +20583,11 @@ async function ensurePackageJson(dir) {
20473
20583
  typescript: "^5"
20474
20584
  }
20475
20585
  };
20476
- await writeFile19(pkgPath, `${JSON.stringify(pkg2, null, 2)}
20586
+ await writeFile20(pkgPath, `${JSON.stringify(pkg2, null, 2)}
20477
20587
  `, "utf8");
20478
20588
  return true;
20479
20589
  }
20480
- const raw = await readFile21(pkgPath, "utf8");
20590
+ const raw = await readFile22(pkgPath, "utf8");
20481
20591
  let pkg;
20482
20592
  try {
20483
20593
  pkg = JSON.parse(raw);
@@ -20500,12 +20610,12 @@ async function ensurePackageJson(dir) {
20500
20610
  for (const [k, v] of Object.entries(baseDeps)) {
20501
20611
  if (!deps[k]) deps[k] = v;
20502
20612
  }
20503
- await writeFile19(pkgPath, `${JSON.stringify(pkg, null, 2)}
20613
+ await writeFile20(pkgPath, `${JSON.stringify(pkg, null, 2)}
20504
20614
  `, "utf8");
20505
20615
  return false;
20506
20616
  }
20507
20617
  async function ensureTsconfigJson(dir) {
20508
- const tsPath = path68.join(dir, "tsconfig.json");
20618
+ const tsPath = path69.join(dir, "tsconfig.json");
20509
20619
  try {
20510
20620
  await access11(tsPath, constants.R_OK);
20511
20621
  return false;
@@ -20535,7 +20645,7 @@ async function ensureTsconfigJson(dir) {
20535
20645
  "user-panel"
20536
20646
  ]
20537
20647
  };
20538
- await writeFile19(tsPath, `${JSON.stringify(tsconfig, null, 2)}
20648
+ await writeFile20(tsPath, `${JSON.stringify(tsconfig, null, 2)}
20539
20649
  `, "utf8");
20540
20650
  return true;
20541
20651
  }
@@ -20554,49 +20664,49 @@ var fileExists2 = async (filePath) => {
20554
20664
  }
20555
20665
  };
20556
20666
  async function ensurePortalStubFiles(dir) {
20557
- const landingPath = path68.join(dir, "landing", "LandingPage.tsx");
20667
+ const landingPath = path69.join(dir, "landing", "LandingPage.tsx");
20558
20668
  if (!await fileExists2(landingPath)) {
20559
- await mkdir16(path68.join(dir, "landing"), { recursive: true });
20560
- await writeFile19(landingPath, LANDING_PAGE_SOURCE, "utf8");
20669
+ await mkdir16(path69.join(dir, "landing"), { recursive: true });
20670
+ await writeFile20(landingPath, LANDING_PAGE_SOURCE, "utf8");
20561
20671
  }
20562
- const plansPath = path68.join(dir, "user-panel", "AccountPlansPage.tsx");
20672
+ const plansPath = path69.join(dir, "user-panel", "AccountPlansPage.tsx");
20563
20673
  if (!await fileExists2(plansPath)) {
20564
- await mkdir16(path68.join(dir, "user-panel"), { recursive: true });
20565
- await writeFile19(plansPath, ACCOUNT_PLANS_PAGE_SOURCE, "utf8");
20674
+ await mkdir16(path69.join(dir, "user-panel"), { recursive: true });
20675
+ await writeFile20(plansPath, ACCOUNT_PLANS_PAGE_SOURCE, "utf8");
20566
20676
  }
20567
- const dashboardPath = path68.join(dir, "user-panel", "DashboardPage.tsx");
20677
+ const dashboardPath = path69.join(dir, "user-panel", "DashboardPage.tsx");
20568
20678
  if (!await fileExists2(dashboardPath)) {
20569
- await mkdir16(path68.join(dir, "user-panel"), { recursive: true });
20570
- await writeFile19(dashboardPath, DASHBOARD_PAGE_SOURCE, "utf8");
20679
+ await mkdir16(path69.join(dir, "user-panel"), { recursive: true });
20680
+ await writeFile20(dashboardPath, DASHBOARD_PAGE_SOURCE, "utf8");
20571
20681
  }
20572
20682
  await ensurePublicBrandingFiles(dir);
20573
20683
  }
20574
20684
  async function ensurePublicBrandingFiles(dir) {
20575
- const destDir = path68.join(dir, "public");
20685
+ const destDir = path69.join(dir, "public");
20576
20686
  await mkdir16(destDir, { recursive: true });
20577
20687
  for (const { name, content } of BRANDING_ASSETS) {
20578
- const dest = path68.join(destDir, name);
20688
+ const dest = path69.join(destDir, name);
20579
20689
  if (await fileExists2(dest)) {
20580
20690
  continue;
20581
20691
  }
20582
- await writeFile19(dest, content, "utf8");
20692
+ await writeFile20(dest, content, "utf8");
20583
20693
  }
20584
- const faviconDest = path68.join(destDir, "Icon.png");
20694
+ const faviconDest = path69.join(destDir, "Icon.png");
20585
20695
  if (!await fileExists2(faviconDest)) {
20586
- await writeFile19(faviconDest, Buffer.from(FAVICON_PNG_BASE64, "base64"));
20696
+ await writeFile20(faviconDest, Buffer.from(FAVICON_PNG_BASE64, "base64"));
20587
20697
  }
20588
20698
  }
20589
20699
  async function ensureThinConfigTsx(dir) {
20590
- const tsxPath = path68.join(dir, "apitogo.config.tsx");
20700
+ const tsxPath = path69.join(dir, "apitogo.config.tsx");
20591
20701
  if (await fileExists2(tsxPath)) {
20592
20702
  return false;
20593
20703
  }
20594
- await writeFile19(tsxPath, THIN_WRAPPER_SOURCE, "utf8");
20704
+ await writeFile20(tsxPath, THIN_WRAPPER_SOURCE, "utf8");
20595
20705
  return true;
20596
20706
  }
20597
20707
 
20598
20708
  // src/cli/make-config/handler.ts
20599
- var toPosixPath2 = (value) => value.split(path69.sep).join(path69.posix.sep);
20709
+ var toPosixPath2 = (value) => value.split(path70.sep).join(path70.posix.sep);
20600
20710
  var fileExists3 = async (filePath) => {
20601
20711
  try {
20602
20712
  await access12(filePath, constants2.F_OK);
@@ -20606,7 +20716,7 @@ var fileExists3 = async (filePath) => {
20606
20716
  }
20607
20717
  };
20608
20718
  var readJsonConfig = async (filePath) => {
20609
- const raw = await readFile22(filePath, "utf8");
20719
+ const raw = await readFile23(filePath, "utf8");
20610
20720
  const parsed = JSON.parse(raw);
20611
20721
  if (!isPlainObject3(parsed)) {
20612
20722
  throw new Error(`${APITOGO_JSON_FILENAME} must be a JSON object.`);
@@ -20652,13 +20762,13 @@ async function persistConfig(config2, ctx) {
20652
20762
  force: ctx.force
20653
20763
  })
20654
20764
  };
20655
- await writeFile20(ctx.jsonPath, `${JSON.stringify(next, null, 2)}
20765
+ await writeFile21(ctx.jsonPath, `${JSON.stringify(next, null, 2)}
20656
20766
  `, "utf8");
20657
- const tsxPath = path69.join(ctx.dir, "apitogo.config.tsx");
20767
+ const tsxPath = path70.join(ctx.dir, "apitogo.config.tsx");
20658
20768
  if (await fileExists3(tsxPath) && tsxRoutes.length > 0) {
20659
- const tsxSource = await readFile22(tsxPath, "utf8");
20769
+ const tsxSource = await readFile23(tsxPath, "utf8");
20660
20770
  if (isManagedConfigWrapper(tsxSource)) {
20661
- await writeFile20(
20771
+ await writeFile21(
20662
20772
  tsxPath,
20663
20773
  buildThinWrapperWithCustomPages(tsxRoutes),
20664
20774
  "utf8"
@@ -20681,7 +20791,7 @@ function mergeBackendFlag(config2, backend) {
20681
20791
  return next;
20682
20792
  }
20683
20793
  async function makeConfig(argv) {
20684
- const dir = path69.resolve(process.cwd(), argv.dir);
20794
+ const dir = path70.resolve(process.cwd(), argv.dir);
20685
20795
  const pagesDir = toPosixPath2(
20686
20796
  argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
20687
20797
  );
@@ -20690,7 +20800,7 @@ async function makeConfig(argv) {
20690
20800
  const changes = [];
20691
20801
  try {
20692
20802
  const discoveredOpenApi = await findOpenApiSpecPath(dir);
20693
- const createdPackageJson = await ensurePackageJson(dir);
20803
+ const createdPackageJson = await ensurePackageJson2(dir);
20694
20804
  const createdTsconfig = await ensureTsconfigJson(dir);
20695
20805
  if (createdPackageJson && !json) {
20696
20806
  printSuccessToConsole(
@@ -20701,14 +20811,14 @@ async function makeConfig(argv) {
20701
20811
  printSuccessToConsole("Created tsconfig.json.");
20702
20812
  }
20703
20813
  await ensurePortalStubFiles(dir);
20704
- const jsonPath = path69.join(dir, APITOGO_JSON_FILENAME);
20814
+ const jsonPath = path70.join(dir, APITOGO_JSON_FILENAME);
20705
20815
  let createdJson = false;
20706
20816
  let config2;
20707
20817
  if (await fileExists3(jsonPath)) {
20708
20818
  config2 = await readJsonConfig(jsonPath);
20709
20819
  } else {
20710
20820
  config2 = createDefaultApitogoJsonConfig({
20711
- title: titleFromDirectoryName(path69.basename(dir)),
20821
+ title: titleFromDirectoryName(path70.basename(dir)),
20712
20822
  pagesDir
20713
20823
  });
20714
20824
  createdJson = true;
@@ -20760,9 +20870,9 @@ async function makeConfig(argv) {
20760
20870
  return;
20761
20871
  }
20762
20872
  if (action2.kind === "page") {
20763
- const pagePath = path69.join(dir, action2.page.relativePath);
20764
- await mkdir17(path69.dirname(pagePath), { recursive: true });
20765
- await writeFile20(
20873
+ const pagePath = path70.join(dir, action2.page.relativePath);
20874
+ await mkdir17(path70.dirname(pagePath), { recursive: true });
20875
+ await writeFile21(
20766
20876
  pagePath,
20767
20877
  buildStarterDocsPageTsx(action2.page.slug, action2.page.title),
20768
20878
  "utf8"
@@ -20828,7 +20938,7 @@ async function makeConfig(argv) {
20828
20938
  if (argv.openapi) {
20829
20939
  const wire = await wireDevPortalOpenApi(
20830
20940
  dir,
20831
- path69.resolve(dir, argv.openapi)
20941
+ path70.resolve(dir, argv.openapi)
20832
20942
  );
20833
20943
  if (wire.status !== "succeeded") {
20834
20944
  throw new Error(
@@ -20857,7 +20967,7 @@ async function makeConfig(argv) {
20857
20967
  const slug = normalizePageSlug2(argv.pageSlug);
20858
20968
  const pageTemplate = normalizePageTemplate(argv.pageTemplate);
20859
20969
  const relativePagePath = pageComponentRelativePath(slug);
20860
- const filePath = path69.join(dir, relativePagePath);
20970
+ const filePath = path70.join(dir, relativePagePath);
20861
20971
  const isUpdate = argv.pageUpdate === true;
20862
20972
  if (isUpdate) {
20863
20973
  if (!await fileExists3(filePath)) {
@@ -20871,7 +20981,7 @@ async function makeConfig(argv) {
20871
20981
  argv.pageContent,
20872
20982
  pageTemplate
20873
20983
  );
20874
- await writeFile20(filePath, tsx, "utf8");
20984
+ await writeFile21(filePath, tsx, "utf8");
20875
20985
  pageResult = {
20876
20986
  action: "updated",
20877
20987
  slug,
@@ -20890,8 +21000,8 @@ async function makeConfig(argv) {
20890
21000
  argv.pageContent,
20891
21001
  pageTemplate
20892
21002
  );
20893
- await mkdir17(path69.dirname(filePath), { recursive: true });
20894
- await writeFile20(filePath, tsx, "utf8");
21003
+ await mkdir17(path70.dirname(filePath), { recursive: true });
21004
+ await writeFile21(filePath, tsx, "utf8");
20895
21005
  const configResult = await wireNewDevPortalPageInConfig(
20896
21006
  dir,
20897
21007
  slug,
@@ -20903,7 +21013,7 @@ async function makeConfig(argv) {
20903
21013
  pagePath: relativePagePath,
20904
21014
  pageTemplate,
20905
21015
  configUpdated: configResult.updated,
20906
- configPath: configResult.configPath ? path69.relative(dir, configResult.configPath) : null
21016
+ configPath: configResult.configPath ? path70.relative(dir, configResult.configPath) : null
20907
21017
  };
20908
21018
  changes.push("page_add");
20909
21019
  }
@@ -21028,10 +21138,10 @@ var config_default = {
21028
21138
  };
21029
21139
 
21030
21140
  // src/cli/cmds/deploy.ts
21031
- import path83 from "node:path";
21141
+ import path84 from "node:path";
21032
21142
 
21033
21143
  // src/cli/apply/handler.ts
21034
- import path80 from "node:path";
21144
+ import path81 from "node:path";
21035
21145
 
21036
21146
  // src/cli/platform/helpers/gateway-plan-validation.ts
21037
21147
  init_gateway_limits();
@@ -21226,11 +21336,11 @@ init_gateway_limits();
21226
21336
  // src/cli/platform/helpers/deploy-artifact-hash.ts
21227
21337
  import { createHash as createHash3 } from "node:crypto";
21228
21338
  import { createReadStream, promises as fs8 } from "node:fs";
21229
- import path71 from "node:path";
21339
+ import path72 from "node:path";
21230
21340
 
21231
21341
  // src/cli/platform/helpers/package-files.ts
21232
21342
  import { promises as fs7 } from "node:fs";
21233
- import path70 from "node:path";
21343
+ import path71 from "node:path";
21234
21344
  import ignore from "ignore";
21235
21345
  var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
21236
21346
  "node_modules",
@@ -21243,7 +21353,7 @@ var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
21243
21353
  async function loadGitignore(rootDir) {
21244
21354
  const ig = ignore();
21245
21355
  ig.add(["node_modules/", ".git/", "dist/", "bin/", "obj/"]);
21246
- const gitignorePath = path70.join(rootDir, ".gitignore");
21356
+ const gitignorePath = path71.join(rootDir, ".gitignore");
21247
21357
  try {
21248
21358
  const content = await fs7.readFile(gitignorePath, "utf8");
21249
21359
  ig.add(content);
@@ -21252,11 +21362,11 @@ async function loadGitignore(rootDir) {
21252
21362
  return ig;
21253
21363
  }
21254
21364
  async function collectFiles(rootDir, relativeDir, ig, files) {
21255
- const absDir = path70.join(rootDir, relativeDir);
21365
+ const absDir = path71.join(rootDir, relativeDir);
21256
21366
  const entries = await fs7.readdir(absDir, { withFileTypes: true });
21257
21367
  for (const entry of entries) {
21258
- const rel2 = relativeDir ? path70.join(relativeDir, entry.name) : entry.name;
21259
- const relPosix = rel2.split(path70.sep).join("/");
21368
+ const rel2 = relativeDir ? path71.join(relativeDir, entry.name) : entry.name;
21369
+ const relPosix = rel2.split(path71.sep).join("/");
21260
21370
  if (DEFAULT_EXCLUDES.has(entry.name) && !relativeDir) {
21261
21371
  continue;
21262
21372
  }
@@ -21271,7 +21381,7 @@ async function collectFiles(rootDir, relativeDir, ig, files) {
21271
21381
  }
21272
21382
  }
21273
21383
  async function collectPackageableFiles(sourceDirectory) {
21274
- const resolved = path70.resolve(sourceDirectory);
21384
+ const resolved = path71.resolve(sourceDirectory);
21275
21385
  const stat7 = await fs7.stat(resolved).catch(() => null);
21276
21386
  if (!stat7?.isDirectory()) {
21277
21387
  throw new Error(`sourceDirectory is not a directory: ${resolved}`);
@@ -21297,7 +21407,7 @@ async function sha256File(filePath) {
21297
21407
  return hash2.digest("hex");
21298
21408
  }
21299
21409
  async function hashDirectoryContents(rootDirectory) {
21300
- const resolved = path71.resolve(rootDirectory);
21410
+ const resolved = path72.resolve(rootDirectory);
21301
21411
  const files = (await collectPackageableFiles(resolved)).sort(
21302
21412
  (a, b) => a.localeCompare(b)
21303
21413
  );
@@ -21305,13 +21415,13 @@ async function hashDirectoryContents(rootDirectory) {
21305
21415
  for (const rel2 of files) {
21306
21416
  hash2.update(rel2);
21307
21417
  hash2.update("\0");
21308
- hash2.update(await fs8.readFile(path71.join(resolved, rel2)));
21418
+ hash2.update(await fs8.readFile(path72.join(resolved, rel2)));
21309
21419
  hash2.update("\0");
21310
21420
  }
21311
21421
  return hash2.digest("hex");
21312
21422
  }
21313
21423
  async function hashDevPortalSiteSources(siteDirectory, options) {
21314
- const resolved = path71.resolve(siteDirectory);
21424
+ const resolved = path72.resolve(siteDirectory);
21315
21425
  const hash2 = createHash3("sha256");
21316
21426
  const candidates = [
21317
21427
  "apitogo.config.json",
@@ -21321,7 +21431,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
21321
21431
  "zudoku.config.tsx"
21322
21432
  ];
21323
21433
  for (const name of candidates) {
21324
- const full = path71.join(resolved, name);
21434
+ const full = path72.join(resolved, name);
21325
21435
  try {
21326
21436
  hash2.update(name);
21327
21437
  hash2.update("\0");
@@ -21331,7 +21441,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
21331
21441
  }
21332
21442
  }
21333
21443
  for (const dir of ["pages", "landing", "src"]) {
21334
- const full = path71.join(resolved, dir);
21444
+ const full = path72.join(resolved, dir);
21335
21445
  try {
21336
21446
  const st = await fs8.stat(full);
21337
21447
  if (!st.isDirectory()) continue;
@@ -21560,8 +21670,8 @@ function normalizeActionKey(actionKey2) {
21560
21670
  const trimmed = actionKey2.trim();
21561
21671
  if (trimmed.includes(":")) {
21562
21672
  const [method2, ...pathParts] = trimmed.split(":");
21563
- const path102 = pathParts.join(":").trim();
21564
- return `${method2?.toLowerCase()}:${path102.startsWith("/") ? path102 : `/${path102}`}`;
21673
+ const path103 = pathParts.join(":").trim();
21674
+ return `${method2?.toLowerCase()}:${path103.startsWith("/") ? path103 : `/${path103}`}`;
21565
21675
  }
21566
21676
  const spaceIndex = trimmed.indexOf(" ");
21567
21677
  if (spaceIndex <= 0) {
@@ -21570,8 +21680,8 @@ function normalizeActionKey(actionKey2) {
21570
21680
  );
21571
21681
  }
21572
21682
  const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
21573
- const path101 = trimmed.slice(spaceIndex + 1).trim();
21574
- return `${method}:${path101.startsWith("/") ? path101 : `/${path101}`}`;
21683
+ const path102 = trimmed.slice(spaceIndex + 1).trim();
21684
+ return `${method}:${path102.startsWith("/") ? path102 : `/${path102}`}`;
21575
21685
  }
21576
21686
  async function applyGatewayPublicRoutes(client, projectId, routes, options) {
21577
21687
  const applied = [];
@@ -22049,8 +22159,8 @@ async function upsertGatewayPlansFromManifest(client, config2, projectId, plans,
22049
22159
  }
22050
22160
 
22051
22161
  // src/cli/platform/helpers/openapi-gateway-servers.ts
22052
- import { mkdir as mkdir18, readFile as readFile23, writeFile as writeFile21 } from "node:fs/promises";
22053
- import path72 from "node:path";
22162
+ import { mkdir as mkdir18, readFile as readFile24, writeFile as writeFile22 } from "node:fs/promises";
22163
+ import path73 from "node:path";
22054
22164
  import YAML3 from "yaml";
22055
22165
  var GATEWAY_URL_ENV_KEY = "APITOGO_GATEWAY_URL";
22056
22166
  var PUBLISH_OPENAPI_RELATIVE = ".apitogo/openapi-publish.json";
@@ -22081,8 +22191,8 @@ async function resolveProjectGatewayUrl(client, projectId) {
22081
22191
  return null;
22082
22192
  }
22083
22193
  async function readOpenApiDocument(filePath) {
22084
- const content = await readFile23(filePath, "utf8");
22085
- const ext = path72.extname(filePath).toLowerCase();
22194
+ const content = await readFile24(filePath, "utf8");
22195
+ const ext = path73.extname(filePath).toLowerCase();
22086
22196
  const parsed = ext === ".json" ? JSON.parse(content) : YAML3.parse(content);
22087
22197
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
22088
22198
  throw new Error(`OpenAPI document must be an object: ${filePath}`);
@@ -22090,14 +22200,14 @@ async function readOpenApiDocument(filePath) {
22090
22200
  return parsed;
22091
22201
  }
22092
22202
  async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApiPath, gatewayUrl) {
22093
- const site = path72.resolve(siteDirectory);
22094
- const source = path72.resolve(sourceOpenApiPath);
22203
+ const site = path73.resolve(siteDirectory);
22204
+ const source = path73.resolve(sourceOpenApiPath);
22095
22205
  const relativeInput = PUBLISH_OPENAPI_RELATIVE;
22096
- const outputPath = path72.join(site, ...relativeInput.split("/"));
22206
+ const outputPath = path73.join(site, ...relativeInput.split("/"));
22097
22207
  const doc = await readOpenApiDocument(source);
22098
22208
  const rewritten = withGatewayServers(doc, gatewayUrl);
22099
- await mkdir18(path72.dirname(outputPath), { recursive: true });
22100
- await writeFile21(
22209
+ await mkdir18(path73.dirname(outputPath), { recursive: true });
22210
+ await writeFile22(
22101
22211
  outputPath,
22102
22212
  `${JSON.stringify(rewritten, null, 2)}
22103
22213
  `,
@@ -22106,11 +22216,11 @@ async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApi
22106
22216
  return { outputPath, relativeInput };
22107
22217
  }
22108
22218
  async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
22109
- const configPath = path72.join(
22110
- path72.resolve(siteDirectory),
22219
+ const configPath = path73.join(
22220
+ path73.resolve(siteDirectory),
22111
22221
  APITOGO_CONFIG_FILENAME2
22112
22222
  );
22113
- const raw = await readFile23(configPath, "utf8");
22223
+ const raw = await readFile24(configPath, "utf8");
22114
22224
  const config2 = JSON.parse(raw);
22115
22225
  const previousApis = config2.apis;
22116
22226
  const previousBackend = config2.backend;
@@ -22123,11 +22233,11 @@ async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
22123
22233
  const backend = config2.backend && typeof config2.backend === "object" ? { ...config2.backend } : {};
22124
22234
  backend.openApiPath = relativeInput;
22125
22235
  config2.backend = backend;
22126
- await writeFile21(configPath, `${JSON.stringify(config2, null, 2)}
22236
+ await writeFile22(configPath, `${JSON.stringify(config2, null, 2)}
22127
22237
  `, "utf8");
22128
22238
  return {
22129
22239
  restore: async () => {
22130
- const currentRaw = await readFile23(configPath, "utf8");
22240
+ const currentRaw = await readFile24(configPath, "utf8");
22131
22241
  const current = JSON.parse(currentRaw);
22132
22242
  if (previousApis === void 0) {
22133
22243
  delete current.apis;
@@ -22139,7 +22249,7 @@ async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
22139
22249
  } else {
22140
22250
  current.backend = previousBackend;
22141
22251
  }
22142
- await writeFile21(
22252
+ await writeFile22(
22143
22253
  configPath,
22144
22254
  `${JSON.stringify(current, null, 2)}
22145
22255
  `,
@@ -22149,7 +22259,7 @@ async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
22149
22259
  };
22150
22260
  }
22151
22261
  async function prepareOpenApiServersForGatewayBuild(options) {
22152
- const siteDirectory = path72.resolve(options.siteDirectory);
22262
+ const siteDirectory = path73.resolve(options.siteDirectory);
22153
22263
  let openApiPath = resolveBackendOpenApiPath(
22154
22264
  options.manifest?.backend?.openApiPath,
22155
22265
  {
@@ -22162,8 +22272,8 @@ async function prepareOpenApiServersForGatewayBuild(options) {
22162
22272
  );
22163
22273
  if (!openApiPath) {
22164
22274
  try {
22165
- const raw = await readFile23(
22166
- path72.join(siteDirectory, APITOGO_CONFIG_FILENAME2),
22275
+ const raw = await readFile24(
22276
+ path73.join(siteDirectory, APITOGO_CONFIG_FILENAME2),
22167
22277
  "utf8"
22168
22278
  );
22169
22279
  const config2 = JSON.parse(raw);
@@ -22192,8 +22302,8 @@ function normalizeActionKeyFormat(actionKey2) {
22192
22302
  const trimmed = actionKey2.trim();
22193
22303
  if (trimmed.includes(":")) {
22194
22304
  const [method2, ...pathParts] = trimmed.split(":");
22195
- const path102 = pathParts.join(":").trim();
22196
- return `${method2.toLowerCase()}:${path102.startsWith("/") ? path102 : `/${path102}`}`;
22305
+ const path103 = pathParts.join(":").trim();
22306
+ return `${method2.toLowerCase()}:${path103.startsWith("/") ? path103 : `/${path103}`}`;
22197
22307
  }
22198
22308
  const spaceIndex = trimmed.indexOf(" ");
22199
22309
  if (spaceIndex <= 0) {
@@ -22202,8 +22312,8 @@ function normalizeActionKeyFormat(actionKey2) {
22202
22312
  );
22203
22313
  }
22204
22314
  const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
22205
- const path101 = trimmed.slice(spaceIndex + 1).trim();
22206
- return `${method}:${path101.startsWith("/") ? path101 : `/${path101}`}`;
22315
+ const path102 = trimmed.slice(spaceIndex + 1).trim();
22316
+ return `${method}:${path102.startsWith("/") ? path102 : `/${path102}`}`;
22207
22317
  }
22208
22318
  function normalizePublicRoute(route) {
22209
22319
  const trimmed = route.trim();
@@ -22236,16 +22346,16 @@ function collectManifestPublicActionKeys(gateway) {
22236
22346
  }
22237
22347
 
22238
22348
  // src/cli/platform/helpers/publish-ledger.ts
22239
- import { mkdir as mkdir19, readFile as readFile24, writeFile as writeFile22 } from "node:fs/promises";
22240
- import path73 from "node:path";
22349
+ import { mkdir as mkdir19, readFile as readFile25, writeFile as writeFile23 } from "node:fs/promises";
22350
+ import path74 from "node:path";
22241
22351
  var PUBLISH_LEDGER_RELATIVE_PATH = ".apitogo/publish-state.json";
22242
22352
  function publishLedgerPath(siteDirectory) {
22243
- return path73.join(path73.resolve(siteDirectory), PUBLISH_LEDGER_RELATIVE_PATH);
22353
+ return path74.join(path74.resolve(siteDirectory), PUBLISH_LEDGER_RELATIVE_PATH);
22244
22354
  }
22245
22355
  async function readPublishLedger(siteDirectory) {
22246
22356
  const filePath = publishLedgerPath(siteDirectory);
22247
22357
  try {
22248
- const raw = await readFile24(filePath, "utf8");
22358
+ const raw = await readFile25(filePath, "utf8");
22249
22359
  const parsed = JSON.parse(raw);
22250
22360
  if (parsed?.version !== 1 || !Array.isArray(parsed.steps)) {
22251
22361
  return null;
@@ -22257,13 +22367,13 @@ async function readPublishLedger(siteDirectory) {
22257
22367
  }
22258
22368
  async function writePublishLedger(siteDirectory, ledger) {
22259
22369
  const filePath = publishLedgerPath(siteDirectory);
22260
- await mkdir19(path73.dirname(filePath), { recursive: true });
22370
+ await mkdir19(path74.dirname(filePath), { recursive: true });
22261
22371
  const next = {
22262
22372
  ...ledger,
22263
22373
  version: 1,
22264
22374
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
22265
22375
  };
22266
- await writeFile22(filePath, `${JSON.stringify(next, null, 2)}
22376
+ await writeFile23(filePath, `${JSON.stringify(next, null, 2)}
22267
22377
  `, "utf8");
22268
22378
  return filePath;
22269
22379
  }
@@ -22779,9 +22889,9 @@ async function createProjectWithWarmPoolRetry(client, body, options) {
22779
22889
  import { spawn as spawn4 } from "node:child_process";
22780
22890
  import { mkdtemp, readdir as readdir2, rm as rm11 } from "node:fs/promises";
22781
22891
  import { tmpdir } from "node:os";
22782
- import path74 from "node:path";
22892
+ import path75 from "node:path";
22783
22893
  async function directoryHasRuntimeConfig(dir) {
22784
- if (!await pathExists(dir)) {
22894
+ if (!await pathExists2(dir)) {
22785
22895
  return false;
22786
22896
  }
22787
22897
  const entries = await readdir2(dir);
@@ -22822,20 +22932,20 @@ function runDotnetPublish(projectDir, outputDir) {
22822
22932
  async function findCsproj(projectDir) {
22823
22933
  const entries = await readdir2(projectDir);
22824
22934
  const csproj = entries.find((name) => name.endsWith(".csproj"));
22825
- return csproj ? path74.join(projectDir, csproj) : null;
22935
+ return csproj ? path75.join(projectDir, csproj) : null;
22826
22936
  }
22827
22937
  async function prepareBackendPackagingDirectory(args) {
22828
- const sourceDirectory = path74.resolve(args.sourceDirectory);
22938
+ const sourceDirectory = path75.resolve(args.sourceDirectory);
22829
22939
  if (args.publishDirectory?.trim()) {
22830
22940
  return {
22831
- directory: path74.resolve(args.publishDirectory),
22941
+ directory: path75.resolve(args.publishDirectory),
22832
22942
  packagingMode: "published"
22833
22943
  };
22834
22944
  }
22835
22945
  if (await directoryHasRuntimeConfig(sourceDirectory)) {
22836
22946
  return { directory: sourceDirectory, packagingMode: "published" };
22837
22947
  }
22838
- const publishSubdir = path74.join(sourceDirectory, "publish");
22948
+ const publishSubdir = path75.join(sourceDirectory, "publish");
22839
22949
  if (await directoryHasRuntimeConfig(publishSubdir)) {
22840
22950
  return { directory: publishSubdir, packagingMode: "published" };
22841
22951
  }
@@ -22847,9 +22957,9 @@ async function prepareBackendPackagingDirectory(args) {
22847
22957
  return { directory: sourceDirectory, packagingMode: "source" };
22848
22958
  }
22849
22959
  const tempRoot = await mkdtemp(
22850
- path74.join(tmpdir(), "apitogo-dotnet-publish-")
22960
+ path75.join(tmpdir(), "apitogo-dotnet-publish-")
22851
22961
  );
22852
- const outputDir = path74.join(tempRoot, "publish");
22962
+ const outputDir = path75.join(tempRoot, "publish");
22853
22963
  const result = await runDotnetPublish(sourceDirectory, outputDir);
22854
22964
  if (result.exitCode !== 0) {
22855
22965
  await rm11(tempRoot, { recursive: true, force: true });
@@ -22895,12 +23005,12 @@ function formatJobStatusResponse(options) {
22895
23005
  // src/cli/platform/helpers/zip.ts
22896
23006
  import { createReadStream as createReadStream2, createWriteStream as createWriteStream2, promises as fs9 } from "node:fs";
22897
23007
  import { tmpdir as tmpdir2 } from "node:os";
22898
- import path75 from "node:path";
23008
+ import path76 from "node:path";
22899
23009
  import { ZipArchive } from "archiver";
22900
23010
  async function packageBackendDirectory(sourceDirectory) {
22901
- const resolved = path75.resolve(sourceDirectory);
23011
+ const resolved = path76.resolve(sourceDirectory);
22902
23012
  const files = await collectPackageableFiles(resolved);
22903
- const zipPath = path75.join(
23013
+ const zipPath = path76.join(
22904
23014
  tmpdir2(),
22905
23015
  `apitogo-backend-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`
22906
23016
  );
@@ -22912,8 +23022,8 @@ async function packageBackendDirectory(sourceDirectory) {
22912
23022
  output4.on("error", reject);
22913
23023
  archive.pipe(output4);
22914
23024
  for (const rel2 of files) {
22915
- archive.append(createReadStream2(path75.join(resolved, rel2)), {
22916
- name: rel2.split(path75.sep).join("/")
23025
+ archive.append(createReadStream2(path76.join(resolved, rel2)), {
23026
+ name: rel2.split(path76.sep).join("/")
22917
23027
  });
22918
23028
  }
22919
23029
  void archive.finalize();
@@ -24414,11 +24524,11 @@ async function resolveProjectIdForPublish(client, config2, args, wait, progress,
24414
24524
  }
24415
24525
 
24416
24526
  // src/cli/platform/tools/dev-portal-site-build.ts
24417
- import path79 from "node:path";
24527
+ import path80 from "node:path";
24418
24528
 
24419
24529
  // src/cli/platform/helpers/dev-portal-site-api-url.ts
24420
- import { readdir as readdir3, readFile as readFile25, writeFile as writeFile23 } from "node:fs/promises";
24421
- import path76 from "node:path";
24530
+ import { readdir as readdir3, readFile as readFile26, writeFile as writeFile24 } from "node:fs/promises";
24531
+ import path77 from "node:path";
24422
24532
  var SITE_API_BASE_URL_ENV_KEY = "VITE_APITOGO_AUTHENTICATION_API_BASE_URL";
24423
24533
  var PLACEHOLDER_HOST_MARKERS = [
24424
24534
  "dp-example.azurecontainerapps.io",
@@ -24439,10 +24549,10 @@ function isPlaceholderDevPortalApiUrl(apiBaseUrl) {
24439
24549
  return PLACEHOLDER_HOST_MARKERS.some((marker) => normalized.includes(marker));
24440
24550
  }
24441
24551
  async function readSiteApiBaseUrl(sourceDirectory) {
24442
- const resolved = path76.resolve(sourceDirectory);
24552
+ const resolved = path77.resolve(sourceDirectory);
24443
24553
  for (const envFile of [".env", ".env.production"]) {
24444
24554
  try {
24445
- const content = await readFile25(path76.join(resolved, envFile), "utf8");
24555
+ const content = await readFile26(path77.join(resolved, envFile), "utf8");
24446
24556
  const lines = [...content.matchAll(ENV_LINE_GLOBAL_RE)];
24447
24557
  if (lines.length === 0) {
24448
24558
  continue;
@@ -24467,25 +24577,25 @@ async function readSiteApiBaseUrl(sourceDirectory) {
24467
24577
  return null;
24468
24578
  }
24469
24579
  async function patchSiteApiBaseUrl(sourceDirectory, apiBaseUrl) {
24470
- const resolved = path76.resolve(sourceDirectory);
24580
+ const resolved = path77.resolve(sourceDirectory);
24471
24581
  const line2 = `${SITE_API_BASE_URL_ENV_KEY}=${apiBaseUrl}`;
24472
24582
  let patchedExisting = false;
24473
24583
  for (const envFile of [".env.production", ".env"]) {
24474
- const envPath = path76.join(resolved, envFile);
24584
+ const envPath = path77.join(resolved, envFile);
24475
24585
  try {
24476
- const content = await readFile25(envPath, "utf8");
24586
+ const content = await readFile26(envPath, "utf8");
24477
24587
  const withoutAssignments = content.replace(ENV_LINE_GLOBAL_RE, "").replace(/\n{3,}/g, "\n\n").trimEnd();
24478
24588
  const patched = withoutAssignments ? `${withoutAssignments}
24479
24589
  ${line2}
24480
24590
  ` : `${line2}
24481
24591
  `;
24482
- await writeFile23(envPath, patched);
24592
+ await writeFile24(envPath, patched);
24483
24593
  patchedExisting = true;
24484
24594
  } catch {
24485
24595
  }
24486
24596
  }
24487
24597
  if (!patchedExisting) {
24488
- await writeFile23(path76.join(resolved, ".env"), `${line2}
24598
+ await writeFile24(path77.join(resolved, ".env"), `${line2}
24489
24599
  `);
24490
24600
  }
24491
24601
  }
@@ -24493,7 +24603,7 @@ function tryProjectId(explicit, manifestProjectId, config2) {
24493
24603
  return explicit?.trim() || manifestProjectId?.trim() || config2.defaultProjectId?.trim() || void 0;
24494
24604
  }
24495
24605
  async function ensureLiveSiteApiBaseUrlForBuild(_client, config2, args, resolveFromProject) {
24496
- const sourceDirectory = path76.resolve(args.sourceDirectory);
24606
+ const sourceDirectory = path77.resolve(args.sourceDirectory);
24497
24607
  const explicit = args.apiBaseUrl?.trim();
24498
24608
  if (explicit && !isPlaceholderDevPortalApiUrl(explicit)) {
24499
24609
  await patchSiteApiBaseUrl(sourceDirectory, explicit);
@@ -24529,7 +24639,7 @@ async function* walkFiles(root) {
24529
24639
  return;
24530
24640
  }
24531
24641
  for (const entry of entries) {
24532
- const full = path76.join(root, entry.name);
24642
+ const full = path77.join(root, entry.name);
24533
24643
  if (entry.isDirectory()) {
24534
24644
  if (entry.name === "node_modules" || entry.name === ".git") {
24535
24645
  continue;
@@ -24541,8 +24651,8 @@ async function* walkFiles(root) {
24541
24651
  }
24542
24652
  }
24543
24653
  async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiBaseUrl) {
24544
- const dist = path76.resolve(distDirectory);
24545
- const siteRoot = path76.dirname(dist);
24654
+ const dist = path77.resolve(distDirectory);
24655
+ const siteRoot = path77.dirname(dist);
24546
24656
  const fromEnv = expectedApiBaseUrl?.trim() || await readSiteApiBaseUrl(siteRoot) || await readSiteApiBaseUrl(dist);
24547
24657
  if (!fromEnv || isPlaceholderDevPortalApiUrl(fromEnv)) {
24548
24658
  throw new Error(
@@ -24553,7 +24663,7 @@ async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiB
24553
24663
  let found = false;
24554
24664
  let foundPlaceholder = false;
24555
24665
  for await (const file of walkFiles(dist)) {
24556
- const content = await readFile25(file, "utf8");
24666
+ const content = await readFile26(file, "utf8");
24557
24667
  if (content.includes(needle)) {
24558
24668
  found = true;
24559
24669
  }
@@ -24578,7 +24688,7 @@ async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiB
24578
24688
 
24579
24689
  // src/cli/platform/tools/dev-portal.ts
24580
24690
  import { promises as fs11 } from "node:fs";
24581
- import path78 from "node:path";
24691
+ import path79 from "node:path";
24582
24692
 
24583
24693
  // src/cli/platform/helpers/dev-portal-backend-job.ts
24584
24694
  var DEV_PORTAL_BACKEND_UPDATE_RESOURCE_TYPE = "DevPortalBackendUpdate";
@@ -24688,7 +24798,7 @@ async function snapshotBackendUpdateJobIds(client, projectId) {
24688
24798
  // src/cli/platform/helpers/tarball.ts
24689
24799
  import { createReadStream as createReadStream3, createWriteStream as createWriteStream3, promises as fs10 } from "node:fs";
24690
24800
  import { tmpdir as tmpdir3 } from "node:os";
24691
- import path77 from "node:path";
24801
+ import path78 from "node:path";
24692
24802
  import { TarArchive } from "archiver";
24693
24803
  var DEV_PORTAL_DEPLOY_ARCHIVE_ROOT = "dist";
24694
24804
  function normalizeArchiveRoot(archiveRoot) {
@@ -24699,10 +24809,10 @@ function normalizeArchiveRoot(archiveRoot) {
24699
24809
  return `${trimmed}/`;
24700
24810
  }
24701
24811
  async function packageDirectoryAsTarGz(sourceDirectory, options) {
24702
- const resolved = path77.resolve(sourceDirectory);
24812
+ const resolved = path78.resolve(sourceDirectory);
24703
24813
  const files = await collectPackageableFiles(resolved);
24704
24814
  const entryPrefix = options?.archiveRoot ? normalizeArchiveRoot(options.archiveRoot) : "";
24705
- const archivePath = path77.join(
24815
+ const archivePath = path78.join(
24706
24816
  tmpdir3(),
24707
24817
  `apitogo-docs-${Date.now()}-${Math.random().toString(36).slice(2)}.tgz`
24708
24818
  );
@@ -24714,8 +24824,8 @@ async function packageDirectoryAsTarGz(sourceDirectory, options) {
24714
24824
  output4.on("error", reject);
24715
24825
  archive.pipe(output4);
24716
24826
  for (const rel2 of files) {
24717
- const entryName = entryPrefix + rel2.split(path77.sep).join("/");
24718
- archive.append(createReadStream3(path77.join(resolved, rel2)), {
24827
+ const entryName = entryPrefix + rel2.split(path78.sep).join("/");
24828
+ archive.append(createReadStream3(path78.join(resolved, rel2)), {
24719
24829
  name: entryName
24720
24830
  });
24721
24831
  }
@@ -24957,7 +25067,7 @@ function validateDeployArchiveInput(args) {
24957
25067
  async function resolveDevPortalArchive(args) {
24958
25068
  validateDeployArchiveInput(args);
24959
25069
  if (args.archivePath?.trim()) {
24960
- const archivePath = path78.resolve(args.archivePath.trim());
25070
+ const archivePath = path79.resolve(args.archivePath.trim());
24961
25071
  const stat7 = await fs11.stat(archivePath).catch(() => null);
24962
25072
  if (!stat7?.isFile()) {
24963
25073
  throw new Error(`archivePath is not a file: ${archivePath}`);
@@ -25022,7 +25132,7 @@ async function handleDeployDevPortal(client, config2, args, progress) {
25022
25132
  // src/cli/platform/tools/dev-portal-site-build.ts
25023
25133
  async function handleBuildDevPortalSite(client, config2, args, progress) {
25024
25134
  const buildProgress = progress?.child("Build dev portal site");
25025
- const sourceDirectory = path79.resolve(args.sourceDirectory);
25135
+ const sourceDirectory = path80.resolve(args.sourceDirectory);
25026
25136
  await buildProgress?.onStep("Ensuring live portal API URL");
25027
25137
  const apiBaseUrl = await ensureLiveSiteApiBaseUrlForBuild(
25028
25138
  client,
@@ -26518,7 +26628,7 @@ function resultLooksFailed(payload) {
26518
26628
  return parsed.status === "failed" || parsed.status === "blocked";
26519
26629
  }
26520
26630
  async function apply(argv) {
26521
- const sourceDirectory = path80.resolve(process.cwd(), argv.dir);
26631
+ const sourceDirectory = path81.resolve(process.cwd(), argv.dir);
26522
26632
  let config2;
26523
26633
  try {
26524
26634
  config2 = loadConfig();
@@ -26588,7 +26698,7 @@ async function apply(argv) {
26588
26698
  if (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_not_found") {
26589
26699
  const resolution = await resolveProjectNotFoundInteractively(
26590
26700
  parsed,
26591
- path80.basename(sourceDirectory)
26701
+ path81.basename(sourceDirectory)
26592
26702
  );
26593
26703
  if (resolution) {
26594
26704
  effectiveProjectId = void 0;
@@ -26608,7 +26718,7 @@ async function apply(argv) {
26608
26718
  while (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_name_exists") {
26609
26719
  const resolution = await resolveProjectNameExistsInteractively(
26610
26720
  parsed,
26611
- effectiveProjectName ?? path80.basename(sourceDirectory)
26721
+ effectiveProjectName ?? path81.basename(sourceDirectory)
26612
26722
  );
26613
26723
  if (!resolution) {
26614
26724
  break;
@@ -26680,7 +26790,7 @@ async function apply(argv) {
26680
26790
 
26681
26791
  // src/cli/deploy/command.ts
26682
26792
  init_invariant();
26683
- import path82 from "node:path";
26793
+ import path83 from "node:path";
26684
26794
 
26685
26795
  // src/cli/deploy/v2.ts
26686
26796
  import { rm as rm12 } from "node:fs/promises";
@@ -26688,11 +26798,11 @@ init_invariant();
26688
26798
 
26689
26799
  // src/cli/portal/report.ts
26690
26800
  import { access as access13 } from "node:fs/promises";
26691
- import path81 from "node:path";
26801
+ import path82 from "node:path";
26692
26802
 
26693
26803
  // src/cli/deploy/gateway.ts
26694
26804
  import { createHash as createHash4 } from "node:crypto";
26695
- import { readFile as readFile26 } from "node:fs/promises";
26805
+ import { readFile as readFile27 } from "node:fs/promises";
26696
26806
  init_invariant();
26697
26807
  var GatewayDeployError = class extends ApitogoError {
26698
26808
  constructor(code, message, developerHint) {
@@ -26732,7 +26842,7 @@ async function readSpec(gateway) {
26732
26842
  "Add one to gateway.specs in the config."
26733
26843
  );
26734
26844
  try {
26735
- return await readFile26(file);
26845
+ return await readFile27(file);
26736
26846
  } catch {
26737
26847
  throw new GatewayDeployError(
26738
26848
  "GATEWAY_SPEC_UNREADABLE",
@@ -26967,7 +27077,7 @@ async function planPortalService(resolved, ledger) {
26967
27077
  const hash2 = await portalBuildHash(resolved, prepared);
26968
27078
  const previous = stepOf(ledger, "portal", "build");
26969
27079
  const built = await exists4(
26970
- path81.join(resolved.state.buildDir, "index.html")
27080
+ path82.join(resolved.state.buildDir, "index.html")
26971
27081
  );
26972
27082
  if (previous?.status === "succeeded" && previous.hash === hash2 && built) {
26973
27083
  return {
@@ -27274,7 +27384,7 @@ async function statusV2(dir, only, options = {}) {
27274
27384
  if (service === "portal") {
27275
27385
  const build2 = stepOf(ledger, "portal", "build");
27276
27386
  const built = await exists4(
27277
- path81.join(resolved.state.buildDir, "index.html")
27387
+ path82.join(resolved.state.buildDir, "index.html")
27278
27388
  );
27279
27389
  const state = build2?.status === "failed" ? "build-failed" : build2?.status === "succeeded" && built ? "built" : "not-built";
27280
27390
  services.push({
@@ -27285,7 +27395,7 @@ async function statusV2(dir, only, options = {}) {
27285
27395
  ...build2?.finishedAt ? [`last build: ${build2.finishedAt}`] : [],
27286
27396
  ...build2?.status === "failed" ? [`error: ${build2.error ?? "unknown"}`] : [],
27287
27397
  ...state === "built" ? [
27288
- `output: ${path81.relative(resolved.configDir, resolved.state.buildDir)}`
27398
+ `output: ${path82.relative(resolved.configDir, resolved.state.buildDir)}`
27289
27399
  ] : [],
27290
27400
  ...url2 ? [`url: ${url2}`] : ["url: not known (portal is not deployed yet)"]
27291
27401
  ]
@@ -27553,7 +27663,7 @@ async function deployProject(argv) {
27553
27663
  const config2 = loadConfig();
27554
27664
  const output4 = await deployV2(
27555
27665
  {
27556
- dir: path82.resolve(process.cwd(), argv.dir),
27666
+ dir: path83.resolve(process.cwd(), argv.dir),
27557
27667
  only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
27558
27668
  projectId: argv.projectId,
27559
27669
  env: argv.env,
@@ -27634,7 +27744,7 @@ var deploy_default = {
27634
27744
  }),
27635
27745
  handler: async (argv) => {
27636
27746
  await captureEvent({ argv, event: "apitogo deploy" });
27637
- if (await isConfigV2(path83.resolve(process.cwd(), argv.dir))) {
27747
+ if (await isConfigV2(path84.resolve(process.cwd(), argv.dir))) {
27638
27748
  await deployProject(argv);
27639
27749
  return;
27640
27750
  }
@@ -27643,8 +27753,8 @@ var deploy_default = {
27643
27753
  };
27644
27754
 
27645
27755
  // src/cli/export/handler.ts
27646
- import { mkdir as mkdir20, writeFile as writeFile24 } from "node:fs/promises";
27647
- import path84 from "node:path";
27756
+ import { mkdir as mkdir20, writeFile as writeFile25 } from "node:fs/promises";
27757
+ import path85 from "node:path";
27648
27758
  init_invariant();
27649
27759
  var ExportError = class extends ApitogoError {
27650
27760
  constructor(message, developerHint) {
@@ -27658,7 +27768,7 @@ async function exportOpenApi(args, deps) {
27658
27768
  `Cannot export "${args.target}".`,
27659
27769
  "Only `apitogo export openapi` exists."
27660
27770
  );
27661
- const dir = path84.resolve(process.cwd(), args.dir ?? ".");
27771
+ const dir = path85.resolve(process.cwd(), args.dir ?? ".");
27662
27772
  if (!await isConfigV2(dir))
27663
27773
  throw new ExportError(
27664
27774
  "This command needs a config version 2 project.",
@@ -27683,9 +27793,9 @@ async function exportOpenApi(args, deps) {
27683
27793
  throw error;
27684
27794
  }
27685
27795
  if (!args.out) return { text };
27686
- const file = path84.resolve(process.cwd(), args.out);
27687
- await mkdir20(path84.dirname(file), { recursive: true });
27688
- await writeFile24(file, text);
27796
+ const file = path85.resolve(process.cwd(), args.out);
27797
+ await mkdir20(path85.dirname(file), { recursive: true });
27798
+ await writeFile25(file, text);
27689
27799
  return { text, file };
27690
27800
  }
27691
27801
  async function exportCommand(args) {
@@ -27735,15 +27845,15 @@ var export_default = {
27735
27845
  };
27736
27846
 
27737
27847
  // src/cli/init/handler.ts
27738
- import path88 from "node:path";
27848
+ import path89 from "node:path";
27739
27849
 
27740
27850
  // src/cli/scaffold/run-scaffold-discovery.ts
27741
- import { access as access15, readFile as readFile29, writeFile as writeFile26 } from "node:fs/promises";
27742
- import path87 from "node:path";
27851
+ import { access as access15, readFile as readFile30, writeFile as writeFile27 } from "node:fs/promises";
27852
+ import path88 from "node:path";
27743
27853
 
27744
27854
  // src/cli/scaffold/detect-backend.ts
27745
- import { readdir as readdir4, readFile as readFile27 } from "node:fs/promises";
27746
- import path85 from "node:path";
27855
+ import { readdir as readdir4, readFile as readFile28 } from "node:fs/promises";
27856
+ import path86 from "node:path";
27747
27857
  var DEFAULT_RUNTIME_VERSION = {
27748
27858
  dotnet: "DOTNET_10",
27749
27859
  nodejs: "NODE_22_LTS",
@@ -27760,7 +27870,7 @@ async function listFiles(directory) {
27760
27870
  }
27761
27871
  async function readText(filePath) {
27762
27872
  try {
27763
- return await readFile27(filePath, "utf8");
27873
+ return await readFile28(filePath, "utf8");
27764
27874
  } catch {
27765
27875
  return void 0;
27766
27876
  }
@@ -27789,15 +27899,15 @@ function isRunnableNodePackage(pkg) {
27789
27899
  return typeof scripts.start === "string" || typeof pkg.main === "string";
27790
27900
  }
27791
27901
  async function detectParentBackend(siteDirectory) {
27792
- const site = path85.resolve(siteDirectory);
27793
- const directory = path85.dirname(site);
27902
+ const site = path86.resolve(siteDirectory);
27903
+ const directory = path86.dirname(site);
27794
27904
  if (directory === site) {
27795
27905
  return void 0;
27796
27906
  }
27797
27907
  const files = await listFiles(directory);
27798
27908
  const toResult = (runtime, runtimeVersion, marker) => ({
27799
27909
  directory,
27800
- sourceDirectory: path85.relative(site, directory).split(path85.sep).join("/") || ".",
27910
+ sourceDirectory: path86.relative(site, directory).split(path86.sep).join("/") || ".",
27801
27911
  runtime,
27802
27912
  runtimeVersion,
27803
27913
  marker
@@ -27805,7 +27915,7 @@ async function detectParentBackend(siteDirectory) {
27805
27915
  const csproj = files.find((f) => f.endsWith(".csproj"));
27806
27916
  const solution = files.find((f) => /\.slnx?$/.test(f));
27807
27917
  if (csproj || solution) {
27808
- const content = csproj ? await readText(path85.join(directory, csproj)) : void 0;
27918
+ const content = csproj ? await readText(path86.join(directory, csproj)) : void 0;
27809
27919
  return toResult(
27810
27920
  "dotnet",
27811
27921
  dotnetVersionFromCsproj(content),
@@ -27813,7 +27923,7 @@ async function detectParentBackend(siteDirectory) {
27813
27923
  );
27814
27924
  }
27815
27925
  if (files.includes("package.json")) {
27816
- const raw = await readText(path85.join(directory, "package.json"));
27926
+ const raw = await readText(path86.join(directory, "package.json"));
27817
27927
  try {
27818
27928
  const pkg = JSON.parse(raw ?? "");
27819
27929
  if (isRunnableNodePackage(pkg)) {
@@ -27828,7 +27938,7 @@ async function detectParentBackend(siteDirectory) {
27828
27938
  }
27829
27939
  const pythonMarker = PYTHON_MARKERS.find((m) => files.includes(m));
27830
27940
  if (pythonMarker) {
27831
- const versionSource = await readText(path85.join(directory, ".python-version")) ?? (pythonMarker === "pyproject.toml" ? (await readText(path85.join(directory, pythonMarker)))?.match(
27941
+ const versionSource = await readText(path86.join(directory, ".python-version")) ?? (pythonMarker === "pyproject.toml" ? (await readText(path86.join(directory, pythonMarker)))?.match(
27832
27942
  /requires-python\s*=\s*"([^"]+)"/
27833
27943
  )?.[1] : void 0);
27834
27944
  return toResult(
@@ -27846,12 +27956,12 @@ import {
27846
27956
  lstat as lstat2,
27847
27957
  mkdir as mkdir21,
27848
27958
  readdir as readdir5,
27849
- readFile as readFile28,
27959
+ readFile as readFile29,
27850
27960
  readlink,
27851
27961
  symlink as symlink2,
27852
- writeFile as writeFile25
27962
+ writeFile as writeFile26
27853
27963
  } from "node:fs/promises";
27854
- import path86 from "node:path";
27964
+ import path87 from "node:path";
27855
27965
  var DOCS_DIR_WHITELIST = [
27856
27966
  "docs",
27857
27967
  "documents",
@@ -27888,14 +27998,14 @@ async function isDirectory2(filePath) {
27888
27998
  }
27889
27999
  }
27890
28000
  function toPosix3(value) {
27891
- return value.split(path86.sep).join(path86.posix.sep);
28001
+ return value.split(path87.sep).join(path87.posix.sep);
27892
28002
  }
27893
28003
  function isWhitelistedDirName(name) {
27894
28004
  return DOCS_DIR_WHITELIST.includes(name.toLowerCase());
27895
28005
  }
27896
28006
  function isInside2(parent, child) {
27897
- const relative = path86.relative(parent, child);
27898
- return relative === "" || !relative.startsWith("..") && !path86.isAbsolute(relative);
28007
+ const relative = path87.relative(parent, child);
28008
+ return relative === "" || !relative.startsWith("..") && !path87.isAbsolute(relative);
27899
28009
  }
27900
28010
  async function collectMarkdownFiles(dir, excludeDir) {
27901
28011
  const files = [];
@@ -27909,9 +28019,9 @@ async function collectMarkdownFiles(dir, excludeDir) {
27909
28019
  if (entry.name.startsWith(".")) {
27910
28020
  continue;
27911
28021
  }
27912
- const full = path86.join(dir, entry.name);
28022
+ const full = path87.join(dir, entry.name);
27913
28023
  if (entry.isDirectory()) {
27914
- if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir && path86.resolve(full) === excludeDir) {
28024
+ if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir && path87.resolve(full) === excludeDir) {
27915
28025
  continue;
27916
28026
  }
27917
28027
  files.push(...await collectMarkdownFiles(full, excludeDir));
@@ -27924,11 +28034,11 @@ async function collectMarkdownFiles(dir, excludeDir) {
27924
28034
  return files;
27925
28035
  }
27926
28036
  async function collectSearchRoots(siteDirectory) {
27927
- const site = path86.resolve(siteDirectory);
27928
- const parent = path86.dirname(site);
28037
+ const site = path87.resolve(siteDirectory);
28038
+ const parent = path87.dirname(site);
27929
28039
  const roots = [];
27930
28040
  const add = (dir) => {
27931
- const resolved = path86.resolve(dir);
28041
+ const resolved = path87.resolve(dir);
27932
28042
  if (!roots.includes(resolved)) {
27933
28043
  roots.push(resolved);
27934
28044
  }
@@ -27941,7 +28051,7 @@ async function collectSearchRoots(siteDirectory) {
27941
28051
  if (!entry.isDirectory() || SKIP_SEARCH_DIRS.has(entry.name)) {
27942
28052
  continue;
27943
28053
  }
27944
- add(path86.join(parent, entry.name));
28054
+ add(path87.join(parent, entry.name));
27945
28055
  }
27946
28056
  } catch {
27947
28057
  }
@@ -27950,13 +28060,13 @@ async function collectSearchRoots(siteDirectory) {
27950
28060
  return roots;
27951
28061
  }
27952
28062
  async function discoverNearbyDocsDirectories(siteDirectory) {
27953
- const site = path86.resolve(siteDirectory);
27954
- const sitePages = path86.join(site, PAGES_DIR);
28063
+ const site = path87.resolve(siteDirectory);
28064
+ const sitePages = path87.join(site, PAGES_DIR);
27955
28065
  const searchedDirectories = await collectSearchRoots(site);
27956
28066
  const directories = [];
27957
28067
  const seen = /* @__PURE__ */ new Set();
27958
28068
  const consider = async (dir) => {
27959
- const resolved = path86.resolve(dir);
28069
+ const resolved = path87.resolve(dir);
27960
28070
  if (resolved === site || seen.has(resolved) || isInside2(sitePages, resolved)) {
27961
28071
  return;
27962
28072
  }
@@ -27973,7 +28083,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
27973
28083
  directories.push({ sourceDirectory: resolved, files });
27974
28084
  };
27975
28085
  for (const root of searchedDirectories) {
27976
- if (isWhitelistedDirName(path86.basename(root))) {
28086
+ if (isWhitelistedDirName(path87.basename(root))) {
27977
28087
  await consider(root);
27978
28088
  }
27979
28089
  try {
@@ -27985,7 +28095,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
27985
28095
  if (!isWhitelistedDirName(entry.name)) {
27986
28096
  continue;
27987
28097
  }
27988
- await consider(path86.join(root, entry.name));
28098
+ await consider(path87.join(root, entry.name));
27989
28099
  }
27990
28100
  } catch {
27991
28101
  }
@@ -28004,8 +28114,8 @@ function slugifyDirName(name) {
28004
28114
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
28005
28115
  }
28006
28116
  async function allocateLinkName(pagesDir, sourceDirectory, used) {
28007
- const base = slugifyDirName(path86.basename(sourceDirectory));
28008
- const parent = slugifyDirName(path86.basename(path86.dirname(sourceDirectory)));
28117
+ const base = slugifyDirName(path87.basename(sourceDirectory));
28118
+ const parent = slugifyDirName(path87.basename(path87.dirname(sourceDirectory)));
28009
28119
  const candidates = [base, `${parent}-${base}`];
28010
28120
  let index = 2;
28011
28121
  while (true) {
@@ -28013,7 +28123,7 @@ async function allocateLinkName(pagesDir, sourceDirectory, used) {
28013
28123
  if (used.has(name)) {
28014
28124
  continue;
28015
28125
  }
28016
- const target = path86.join(pagesDir, name);
28126
+ const target = path87.join(pagesDir, name);
28017
28127
  if (await pathExists5(target)) {
28018
28128
  const stat7 = await lstat2(target);
28019
28129
  if (!stat7.isDirectory() || !await isManagedLinkDir(target)) {
@@ -28044,8 +28154,8 @@ async function alreadyLinked(linkPath, sourcePath) {
28044
28154
  return false;
28045
28155
  }
28046
28156
  const current = await readlink(linkPath);
28047
- const resolved = path86.resolve(path86.dirname(linkPath), current);
28048
- return resolved === path86.resolve(sourcePath);
28157
+ const resolved = path87.resolve(path87.dirname(linkPath), current);
28158
+ return resolved === path87.resolve(sourcePath);
28049
28159
  } catch {
28050
28160
  return false;
28051
28161
  }
@@ -28057,8 +28167,8 @@ async function linkMarkdownFile(sourcePath, linkPath) {
28057
28167
  if (await pathExists5(linkPath)) {
28058
28168
  return "skipped";
28059
28169
  }
28060
- await mkdir21(path86.dirname(linkPath), { recursive: true });
28061
- const relativeTarget = path86.relative(path86.dirname(linkPath), sourcePath);
28170
+ await mkdir21(path87.dirname(linkPath), { recursive: true });
28171
+ const relativeTarget = path87.relative(path87.dirname(linkPath), sourcePath);
28062
28172
  await symlink2(
28063
28173
  relativeTarget,
28064
28174
  linkPath,
@@ -28073,11 +28183,11 @@ async function applyDocsNavigation(siteDirectory, routes) {
28073
28183
  if (routes.length === 0) {
28074
28184
  return;
28075
28185
  }
28076
- const configPath = path86.join(siteDirectory, CONFIG_FILENAME);
28186
+ const configPath = path87.join(siteDirectory, CONFIG_FILENAME);
28077
28187
  if (!await pathExists5(configPath)) {
28078
28188
  return;
28079
28189
  }
28080
- const raw = await readFile28(configPath, "utf8");
28190
+ const raw = await readFile29(configPath, "utf8");
28081
28191
  const parsed = JSON.parse(raw);
28082
28192
  if (!isPlainObject5(parsed)) {
28083
28193
  return;
@@ -28086,12 +28196,12 @@ async function applyDocsNavigation(siteDirectory, routes) {
28086
28196
  force: false
28087
28197
  });
28088
28198
  const updated = ensureHeaderDocsNavigation(parsed, routes);
28089
- await writeFile25(configPath, `${JSON.stringify(updated, null, 2)}
28199
+ await writeFile26(configPath, `${JSON.stringify(updated, null, 2)}
28090
28200
  `, "utf8");
28091
28201
  }
28092
28202
  async function discoverAndWireDocs(siteDirectory) {
28093
- const site = path86.resolve(siteDirectory);
28094
- const pagesDir = path86.join(site, PAGES_DIR);
28203
+ const site = path87.resolve(siteDirectory);
28204
+ const pagesDir = path87.join(site, PAGES_DIR);
28095
28205
  const { directories, searchedDirectories } = await discoverNearbyDocsDirectories(site);
28096
28206
  if (directories.length === 0) {
28097
28207
  return {
@@ -28113,15 +28223,15 @@ async function discoverAndWireDocs(siteDirectory) {
28113
28223
  directory.sourceDirectory,
28114
28224
  usedNames
28115
28225
  );
28116
- const linkDirectory = path86.join(pagesDir, linkName);
28226
+ const linkDirectory = path87.join(pagesDir, linkName);
28117
28227
  const linked = [];
28118
28228
  const skipped = [];
28119
28229
  for (const sourcePath of directory.files) {
28120
28230
  const relativeSource = toPosix3(
28121
- path86.relative(directory.sourceDirectory, sourcePath)
28231
+ path87.relative(directory.sourceDirectory, sourcePath)
28122
28232
  );
28123
- const linkPath = path86.join(linkDirectory, relativeSource);
28124
- const relativeLink = toPosix3(path86.relative(site, linkPath));
28233
+ const linkPath = path87.join(linkDirectory, relativeSource);
28234
+ const relativeLink = toPosix3(path87.relative(site, linkPath));
28125
28235
  const route = toRoutePath(relativeLink, PAGES_DIR);
28126
28236
  if (routes.includes(route)) {
28127
28237
  skipped.push({
@@ -28169,11 +28279,11 @@ async function discoverAndWireDocs(siteDirectory) {
28169
28279
  };
28170
28280
  }
28171
28281
  function siteRelative(siteDirectory, filePath) {
28172
- const relative = toPosix3(path86.relative(siteDirectory, filePath));
28282
+ const relative = toPosix3(path87.relative(siteDirectory, filePath));
28173
28283
  if (!relative) {
28174
28284
  return ".";
28175
28285
  }
28176
- if (path86.isAbsolute(relative)) {
28286
+ if (path87.isAbsolute(relative)) {
28177
28287
  return toPosix3(filePath);
28178
28288
  }
28179
28289
  if (relative.startsWith("..")) {
@@ -28261,8 +28371,8 @@ async function pathExists6(filePath) {
28261
28371
  }
28262
28372
  async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
28263
28373
  const input5 = toSiteRelativeOpenApiInput(siteDirectory, openApiPath);
28264
- const jsonConfigPath = path87.join(siteDirectory, "apitogo.config.json");
28265
- const raw = await readFile29(jsonConfigPath, "utf8");
28374
+ const jsonConfigPath = path88.join(siteDirectory, "apitogo.config.json");
28375
+ const raw = await readFile30(jsonConfigPath, "utf8");
28266
28376
  const siteConfig = JSON.parse(raw);
28267
28377
  const updated = applyOpenApiToSiteConfig(siteConfig, {
28268
28378
  input: input5,
@@ -28270,7 +28380,7 @@ async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
28270
28380
  });
28271
28381
  const backend = updated.backend && typeof updated.backend === "object" && !Array.isArray(updated.backend) ? { ...updated.backend } : {};
28272
28382
  updated.backend = { ...backend, openApiPath: input5 };
28273
- await writeFile26(
28383
+ await writeFile27(
28274
28384
  jsonConfigPath,
28275
28385
  `${JSON.stringify(updated, null, 2)}
28276
28386
  `,
@@ -28289,7 +28399,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
28289
28399
  const invalidCandidates = [];
28290
28400
  let selected;
28291
28401
  for (const candidate of search.candidates) {
28292
- const content = await readFile29(candidate, "utf8");
28402
+ const content = await readFile30(candidate, "utf8");
28293
28403
  const parsed = liteParseOpenApi(content, candidate);
28294
28404
  if (parsed.valid) {
28295
28405
  selected = {
@@ -28313,7 +28423,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
28313
28423
  wired: false
28314
28424
  };
28315
28425
  }
28316
- const jsonConfigPath = path87.join(siteDirectory, "apitogo.config.json");
28426
+ const jsonConfigPath = path88.join(siteDirectory, "apitogo.config.json");
28317
28427
  if (!await pathExists6(jsonConfigPath)) {
28318
28428
  return {
28319
28429
  openApiDiscovery: {
@@ -28363,13 +28473,13 @@ async function discoverAndWireBackend(siteDirectory, mode) {
28363
28473
  if (mode !== "nearby") {
28364
28474
  return { status: "skipped", mode };
28365
28475
  }
28366
- const jsonConfigPath = path87.join(siteDirectory, "apitogo.config.json");
28476
+ const jsonConfigPath = path88.join(siteDirectory, "apitogo.config.json");
28367
28477
  if (!await pathExists6(jsonConfigPath)) {
28368
28478
  return { status: "not_found" };
28369
28479
  }
28370
28480
  try {
28371
28481
  const siteConfig = JSON.parse(
28372
- await readFile29(jsonConfigPath, "utf8")
28482
+ await readFile30(jsonConfigPath, "utf8")
28373
28483
  );
28374
28484
  const existing = siteConfig.backend && typeof siteConfig.backend === "object" && !Array.isArray(siteConfig.backend) ? siteConfig.backend : {};
28375
28485
  if (typeof existing.sourceDirectory === "string" && existing.sourceDirectory.trim()) {
@@ -28390,7 +28500,7 @@ async function discoverAndWireBackend(siteDirectory, mode) {
28390
28500
  runtime: detected.runtime,
28391
28501
  runtimeVersion: detected.runtimeVersion
28392
28502
  };
28393
- await writeFile26(
28503
+ await writeFile27(
28394
28504
  jsonConfigPath,
28395
28505
  `${JSON.stringify(siteConfig, null, 2)}
28396
28506
  `,
@@ -28430,8 +28540,8 @@ function slugifyName2(name) {
28430
28540
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "dev-portal-site";
28431
28541
  }
28432
28542
  function resolveInitOutputDirectory(dirArg, name) {
28433
- const resolved = path88.resolve(process.cwd(), dirArg);
28434
- const base = path88.basename(resolved);
28543
+ const resolved = path89.resolve(process.cwd(), dirArg);
28544
+ const base = path89.basename(resolved);
28435
28545
  const isDot = dirArg === "." || dirArg === "./" || base === "." || resolved === process.cwd();
28436
28546
  if (isDot) {
28437
28547
  const fromName = name?.trim();
@@ -28441,7 +28551,7 @@ function resolveInitOutputDirectory(dirArg, name) {
28441
28551
  );
28442
28552
  }
28443
28553
  return {
28444
- outputDirectory: path88.resolve(process.cwd(), slugifyName2(fromName)),
28554
+ outputDirectory: path89.resolve(process.cwd(), slugifyName2(fromName)),
28445
28555
  siteName: fromName
28446
28556
  };
28447
28557
  }
@@ -28624,8 +28734,8 @@ import open2 from "open";
28624
28734
  import colors14 from "picocolors";
28625
28735
 
28626
28736
  // src/cli/platform/device-auth.ts
28627
- function url(apiUrl, path101) {
28628
- return `${apiUrl}${path101.startsWith("/") ? path101 : `/${path101}`}`;
28737
+ function url(apiUrl, path102) {
28738
+ return `${apiUrl}${path102.startsWith("/") ? path102 : `/${path102}`}`;
28629
28739
  }
28630
28740
  async function requestDeviceCode(apiUrl) {
28631
28741
  const response = await fetchWithRetry(
@@ -28807,7 +28917,7 @@ var logout_default = {
28807
28917
  };
28808
28918
 
28809
28919
  // src/cli/portal/commands.ts
28810
- import path89 from "node:path";
28920
+ import path90 from "node:path";
28811
28921
  init_invariant();
28812
28922
  function parseOnly(value) {
28813
28923
  if (value === void 0) return void 0;
@@ -28824,7 +28934,7 @@ function parseOnly(value) {
28824
28934
  async function run2(command2, argv, compute, format) {
28825
28935
  const json = argv.json === true;
28826
28936
  try {
28827
- const dir = path89.resolve(process.cwd(), argv.dir ?? ".");
28937
+ const dir = path90.resolve(process.cwd(), argv.dir ?? ".");
28828
28938
  if (!await isConfigV2(dir)) {
28829
28939
  throw new ServiceEditError(
28830
28940
  `${command2} works with a config version 2 project, and there is none in ${dir}.`,
@@ -28908,7 +29018,7 @@ var plan_default = {
28908
29018
 
28909
29019
  // src/cli/project/create-handler.ts
28910
29020
  init_invariant();
28911
- import path90 from "node:path";
29021
+ import path91 from "node:path";
28912
29022
 
28913
29023
  // src/cli/project/v2.ts
28914
29024
  init_invariant();
@@ -29055,7 +29165,7 @@ async function createLinkedProject(argv, dir) {
29055
29165
  }
29056
29166
  }
29057
29167
  async function createProject(argv) {
29058
- const dir = path90.resolve(process.cwd(), argv.dir ?? ".");
29168
+ const dir = path91.resolve(process.cwd(), argv.dir ?? ".");
29059
29169
  if (await isConfigV2(dir)) {
29060
29170
  await createLinkedProject(argv, dir);
29061
29171
  return;
@@ -29179,14 +29289,14 @@ var remove_default = {
29179
29289
 
29180
29290
  // src/cli/dev/handler.ts
29181
29291
  init_joinUrl();
29182
- import path93 from "node:path";
29292
+ import path94 from "node:path";
29183
29293
 
29184
29294
  // src/vite/dev-server.ts
29185
29295
  init_logger();
29186
29296
  import fs12 from "node:fs/promises";
29187
29297
  import http from "node:http";
29188
29298
  import https from "node:https";
29189
- import path92 from "node:path";
29299
+ import path93 from "node:path";
29190
29300
  import { createHttpTerminator } from "http-terminator";
29191
29301
  import {
29192
29302
  createServer as createViteServer,
@@ -29219,7 +29329,7 @@ init_loader();
29219
29329
  // src/vite/pagefind-dev-index.ts
29220
29330
  init_invariant();
29221
29331
  init_joinUrl();
29222
- import path91 from "node:path";
29332
+ import path92 from "node:path";
29223
29333
  import { createIndex as createIndex2 } from "pagefind";
29224
29334
  import { isRunnableDevEnvironment } from "vite";
29225
29335
  async function* buildPagefindDevIndex(vite, config2) {
@@ -29272,7 +29382,7 @@ async function* buildPagefindDevIndex(vite, config2) {
29272
29382
  path: urlPath
29273
29383
  };
29274
29384
  }
29275
- const outputPath = path91.join(vite.config.publicDir, "pagefind");
29385
+ const outputPath = path92.join(vite.config.publicDir, "pagefind");
29276
29386
  await pagefindIndex.writeFiles({ outputPath });
29277
29387
  yield { type: "complete", success: true, indexed };
29278
29388
  }
@@ -29291,9 +29401,9 @@ var DevServer = class {
29291
29401
  this.protocol = "https";
29292
29402
  const { dir } = this.options;
29293
29403
  const [key, cert, ca] = await Promise.all([
29294
- fs12.readFile(path92.resolve(dir, config2.https.key)),
29295
- fs12.readFile(path92.resolve(dir, config2.https.cert)),
29296
- config2.https.ca ? fs12.readFile(path92.resolve(dir, config2.https.ca)) : void 0
29404
+ fs12.readFile(path93.resolve(dir, config2.https.key)),
29405
+ fs12.readFile(path93.resolve(dir, config2.https.cert)),
29406
+ config2.https.ca ? fs12.readFile(path93.resolve(dir, config2.https.ca)) : void 0
29297
29407
  ]);
29298
29408
  return https.createServer({ key, cert, ca });
29299
29409
  }
@@ -29310,7 +29420,7 @@ var DevServer = class {
29310
29420
  );
29311
29421
  const server = await this.createNodeServer(config2);
29312
29422
  if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
29313
- const publicRoot = path92.resolve(
29423
+ const publicRoot = path93.resolve(
29314
29424
  this.options.dir,
29315
29425
  typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
29316
29426
  );
@@ -29327,7 +29437,7 @@ var DevServer = class {
29327
29437
  // built-in transform middleware which would treat the path as a static asset.
29328
29438
  name: "apitogo:entry-client",
29329
29439
  configureServer(server2) {
29330
- const entryPath = path92.posix.join(
29440
+ const entryPath = path93.posix.join(
29331
29441
  server2.config.base,
29332
29442
  "/__z/entry.client.tsx"
29333
29443
  );
@@ -29492,7 +29602,7 @@ init_package_json();
29492
29602
  async function dev(argv) {
29493
29603
  const packageJson3 = getZudokuPackageJson();
29494
29604
  process.env.NODE_ENV = "development";
29495
- let dir = path93.resolve(process.cwd(), argv.dir);
29605
+ let dir = path94.resolve(process.cwd(), argv.dir);
29496
29606
  if (await isConfigV2(dir)) {
29497
29607
  const { root, prepared } = await preparePortalWorkspace(dir, "development");
29498
29608
  dir = root;
@@ -29591,7 +29701,7 @@ var run_default = {
29591
29701
  };
29592
29702
 
29593
29703
  // src/cli/secrets/handler.ts
29594
- import path94 from "node:path";
29704
+ import path95 from "node:path";
29595
29705
  init_invariant();
29596
29706
 
29597
29707
  // src/cli/secrets/input.ts
@@ -29656,7 +29766,7 @@ var SecretsError = class extends ApitogoError {
29656
29766
  async function resolveProjectId2(argv, deps) {
29657
29767
  const explicit = argv.projectId?.trim();
29658
29768
  if (explicit) return explicit;
29659
- const dir = path94.resolve(process.cwd(), argv.dir ?? ".");
29769
+ const dir = path95.resolve(process.cwd(), argv.dir ?? ".");
29660
29770
  if (await isConfigV2(dir)) {
29661
29771
  const id = loadConfigV2(dir).resolved.project.id;
29662
29772
  if (id) return id;
@@ -29816,12 +29926,12 @@ var secrets_default = {
29816
29926
  };
29817
29927
 
29818
29928
  // src/cli/cmds/status.ts
29819
- import path96 from "node:path";
29929
+ import path97 from "node:path";
29820
29930
 
29821
29931
  // src/cli/status/handler.ts
29822
- import path95 from "node:path";
29932
+ import path96 from "node:path";
29823
29933
  async function status(argv) {
29824
- const sourceDirectory = path95.resolve(process.cwd(), argv.dir);
29934
+ const sourceDirectory = path96.resolve(process.cwd(), argv.dir);
29825
29935
  let config2;
29826
29936
  try {
29827
29937
  config2 = loadConfig();
@@ -29919,7 +30029,7 @@ var status_default = {
29919
30029
  }),
29920
30030
  handler: async (argv) => {
29921
30031
  await captureEvent({ argv, event: "apitogo status" });
29922
- if (await isConfigV2(path96.resolve(process.cwd(), argv.dir))) {
30032
+ if (await isConfigV2(path97.resolve(process.cwd(), argv.dir))) {
29923
30033
  await statusOfProject(argv);
29924
30034
  return;
29925
30035
  }
@@ -29928,11 +30038,11 @@ var status_default = {
29928
30038
  };
29929
30039
 
29930
30040
  // src/cli/cmds/teardown.ts
29931
- import path99 from "node:path";
30041
+ import path100 from "node:path";
29932
30042
 
29933
30043
  // src/cli/teardown/command.ts
29934
30044
  init_invariant();
29935
- import path97 from "node:path";
30045
+ import path98 from "node:path";
29936
30046
  import { createInterface as createInterface7 } from "node:readline/promises";
29937
30047
 
29938
30048
  // src/cli/teardown/v2.ts
@@ -30149,7 +30259,7 @@ async function teardownProject(argv) {
30149
30259
  const progress = createConsoleProgressReporter();
30150
30260
  const result = await teardownV2(
30151
30261
  {
30152
- dir: path97.resolve(process.cwd(), argv.dir),
30262
+ dir: path98.resolve(process.cwd(), argv.dir),
30153
30263
  projectId: argv.projectId,
30154
30264
  only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
30155
30265
  yes: argv.yes === true,
@@ -30208,7 +30318,7 @@ async function teardownProject(argv) {
30208
30318
  }
30209
30319
 
30210
30320
  // src/cli/teardown/handler.ts
30211
- import path98 from "node:path";
30321
+ import path99 from "node:path";
30212
30322
  function resultLooksFailed3(payload) {
30213
30323
  try {
30214
30324
  const parsed = JSON.parse(payload);
@@ -30224,7 +30334,7 @@ async function teardown(argv) {
30224
30334
  );
30225
30335
  return;
30226
30336
  }
30227
- const sourceDirectory = path98.resolve(process.cwd(), argv.dir);
30337
+ const sourceDirectory = path99.resolve(process.cwd(), argv.dir);
30228
30338
  let config2;
30229
30339
  try {
30230
30340
  config2 = loadConfig();
@@ -30302,7 +30412,7 @@ var teardown_default = {
30302
30412
  }),
30303
30413
  handler: async (argv) => {
30304
30414
  await captureEvent({ argv, event: "apitogo teardown" });
30305
- if (await isConfigV2(path99.resolve(process.cwd(), argv.dir))) {
30415
+ if (await isConfigV2(path100.resolve(process.cwd(), argv.dir))) {
30306
30416
  await teardownProject(argv);
30307
30417
  return;
30308
30418
  }
@@ -30379,37 +30489,37 @@ function createApitogoCli(argv) {
30379
30489
 
30380
30490
  // src/cli/local-handoff.ts
30381
30491
  import { spawn as spawn5 } from "node:child_process";
30382
- import { existsSync as existsSync8, realpathSync } from "node:fs";
30383
- import path100 from "node:path";
30492
+ import { existsSync as existsSync9, realpathSync } from "node:fs";
30493
+ import path101 from "node:path";
30384
30494
  var LOCAL_HANDOFF_ENV = "APITOGO_LOCAL_CLI";
30385
30495
  var PACKAGE_NAME = "@lukoweb/apitogo";
30386
30496
  var resolveProjectDir = (argv, cwd) => {
30387
30497
  for (let i = 0; i < argv.length; i++) {
30388
30498
  const arg = argv[i];
30389
30499
  const next = argv[i + 1];
30390
- if (arg === "--dir" && next) return path100.resolve(cwd, next);
30500
+ if (arg === "--dir" && next) return path101.resolve(cwd, next);
30391
30501
  if (arg?.startsWith("--dir=")) {
30392
- return path100.resolve(cwd, arg.slice("--dir=".length));
30502
+ return path101.resolve(cwd, arg.slice("--dir=".length));
30393
30503
  }
30394
30504
  }
30395
30505
  return cwd;
30396
30506
  };
30397
30507
  var findLocalCli = (projectDir, runningRoot) => {
30398
- let dir = path100.resolve(projectDir);
30508
+ let dir = path101.resolve(projectDir);
30399
30509
  let localPackageRoot;
30400
30510
  while (!localPackageRoot) {
30401
- const candidate = path100.join(dir, "node_modules", PACKAGE_NAME);
30402
- if (existsSync8(path100.join(candidate, "package.json"))) {
30511
+ const candidate = path101.join(dir, "node_modules", PACKAGE_NAME);
30512
+ if (existsSync9(path101.join(candidate, "package.json"))) {
30403
30513
  localPackageRoot = candidate;
30404
- } else if (dir === path100.dirname(dir)) {
30514
+ } else if (dir === path101.dirname(dir)) {
30405
30515
  return void 0;
30406
30516
  } else {
30407
- dir = path100.dirname(dir);
30517
+ dir = path101.dirname(dir);
30408
30518
  }
30409
30519
  }
30410
30520
  const localRoot = realpathSync(localPackageRoot);
30411
30521
  if (localRoot === realpathSync(runningRoot)) return void 0;
30412
- return path100.join(localRoot, "cli.js");
30522
+ return path101.join(localRoot, "cli.js");
30413
30523
  };
30414
30524
  var handoffToLocalCli = async (argv, runningRoot) => {
30415
30525
  if (process.env[LOCAL_HANDOFF_ENV] || process.env.ZUDOKU_ENV === "internal") {
@@ -30421,7 +30531,7 @@ var handoffToLocalCli = async (argv, runningRoot) => {
30421
30531
  );
30422
30532
  if (!localCli) return void 0;
30423
30533
  printDiagnosticsToConsole(
30424
- `Using the project's local ${PACKAGE_NAME} (${path100.dirname(localCli)})`
30534
+ `Using the project's local ${PACKAGE_NAME} (${path101.dirname(localCli)})`
30425
30535
  );
30426
30536
  const child = spawn5(process.execPath, [localCli, ...argv], {
30427
30537
  stdio: "inherit",