@h-ai/cli 1.0.0-beta.11 → 1.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.en.md +4 -0
  2. package/README.ja.md +4 -0
  3. package/README.md +4 -0
  4. package/dist/{chunk-5QTUI2S5.js → chunk-OGUA3OIS.js} +5 -4
  5. package/dist/chunk-OGUA3OIS.js.map +1 -0
  6. package/dist/cli-config-templates-TZSORUT6.js +5 -0
  7. package/dist/{cli-config-templates-H3EW2Y2W.js.map → cli-config-templates-TZSORUT6.js.map} +1 -1
  8. package/dist/index.js +175 -101
  9. package/dist/index.js.map +1 -1
  10. package/dist/metafile-esm.json +1 -1
  11. package/package.json +14 -14
  12. package/templates/README.md +6 -0
  13. package/templates/apps/fullstack/apps/{{projectName}}-app/README.md.hbs +3 -1
  14. package/templates/apps/fullstack/apps/{{projectName}}-app/capacitor.config.ts.hbs +5 -1
  15. package/templates/apps/fullstack/apps/{{projectName}}-desktop/README.md.hbs +4 -2
  16. package/templates/apps/fullstack/apps/{{projectName}}-desktop/package.json.hbs +3 -3
  17. package/templates/apps/fullstack/apps/{{projectName}}-desktop/src-tauri/tauri.conf.json.hbs +0 -2
  18. package/templates/apps/fullstack/package.json.hbs +1 -0
  19. package/templates/apps/mobile-app/capacitor.config.ts.hbs +5 -2
  20. package/templates/base/e2e/app.spec.ts.hbs +48 -24
  21. package/templates/base/package.json.hbs +1 -1
  22. package/templates/shared/native-name.d.mts +5 -0
  23. package/templates/shared/native-name.mjs +87 -0
  24. package/templates/shared/run-tauri.mjs +45 -0
  25. package/templates/skills/hai-app-create/development.md +2 -0
  26. package/templates/skills/hai-build/SKILL.md +8 -2
  27. package/templates/skills/hai-capacitor/reference.md +4 -0
  28. package/templates/skills/hai-storage/reference.md +4 -2
  29. package/templates/skills/hai-ui/reference.md +3 -1
  30. package/dist/chunk-5QTUI2S5.js.map +0 -1
  31. package/dist/cli-config-templates-H3EW2Y2W.js +0 -5
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { generateConfigFile, runtimeEnvironmentVariables, renderEnvironment, generateProductionEnvironment, moduleEnvironmentVariables, documentConfig, parameterizeConfig } from './chunk-5QTUI2S5.js';
2
+ import { generateConfigFile, runtimeEnvironmentVariables, renderEnvironment, generateProductionEnvironment, moduleEnvironmentVariables, documentConfig, parameterizeConfig } from './chunk-OGUA3OIS.js';
3
3
  import { cliM } from './chunk-EWTIVFHN.js';
4
4
  import { __commonJS, __export, __toESM } from './chunk-ZSDEVXZ7.js';
5
- import process13 from 'process';
5
+ import process14 from 'process';
6
6
  import { cac } from 'cac';
7
7
  import chalk from 'chalk';
8
- import path2, { resolve, dirname, join, relative, basename, sep, isAbsolute } from 'path';
8
+ import path2, { resolve, dirname, join, relative, basename, sep, isAbsolute, extname } from 'path';
9
9
  import { fileURLToPath, pathToFileURL } from 'url';
10
10
  import { wrapAnsi } from 'fast-wrap-ansi';
11
11
  import fse from 'fs-extra';
@@ -18,7 +18,7 @@ import { Buffer } from 'buffer';
18
18
  import { execSync, execFileSync, spawn } from 'child_process';
19
19
  import { randomBytes, createECDH, randomUUID, createHash } from 'crypto';
20
20
  import { readFileSync, existsSync, mkdirSync, mkdtempSync, appendFileSync, createReadStream, writeFileSync, renameSync, rmSync, statSync, cpSync, realpathSync, lstatSync, openSync, readSync, closeSync, readdirSync, copyFileSync } from 'fs';
21
- import { core, ok, err, HaiCommonError } from '@h-ai/core';
21
+ import { core, CoreConfigSchema, ok, err, HaiCommonError } from '@h-ai/core';
22
22
  import { tmpdir } from 'os';
23
23
  import 'https';
24
24
  import 'tls';
@@ -2873,20 +2873,20 @@ var require_src = __commonJS({
2873
2873
  var CAMEL_CASE_SEPARATOR_REGEX = /[-_\s]+(.)?/g;
2874
2874
  var LEADING_CHAR_REGEX = /^./;
2875
2875
  function writeCliMessage(message) {
2876
- process13.stdout.write(`${message}
2876
+ process14.stdout.write(`${message}
2877
2877
  `);
2878
2878
  }
2879
2879
  function writeCliError(message, error62) {
2880
- process13.stderr.write(`${message}
2880
+ process14.stderr.write(`${message}
2881
2881
  `);
2882
2882
  if (error62 && typeof error62 === "object" && "error" in error62)
2883
2883
  error62 = error62.error;
2884
2884
  if (error62 !== void 0)
2885
- process13.stderr.write(`${error62 instanceof Error ? error62.message : String(error62)}
2885
+ process14.stderr.write(`${error62 instanceof Error ? error62.message : String(error62)}
2886
2886
  `);
2887
2887
  }
2888
2888
  function formatPromptDescription(description) {
2889
- return wrapAnsi(description, Math.max(1, (process13.stdout.columns || 80) - 32), { hard: true });
2889
+ return wrapAnsi(description, Math.max(1, (process14.stdout.columns || 80) - 32), { hard: true });
2890
2890
  }
2891
2891
  function toCamelCase(str) {
2892
2892
  return str.replace(CAMEL_CASE_SEPARATOR_REGEX, (_, c) => c ? c.toUpperCase() : "").replace(LEADING_CHAR_REGEX, (c) => c.toLowerCase());
@@ -3679,6 +3679,12 @@ async function generateFromTemplates(projectPath, context) {
3679
3679
  await fse.copy(path2.join(root, "shared", "run-node.mjs"), path2.join(projectPath, "scripts", "run-node.mjs"));
3680
3680
  await fse.copy(path2.join(root, "shared", "e2e-env.ts"), path2.join(projectPath, "scripts", "e2e-env.ts"));
3681
3681
  await fse.copy(path2.join(root, "shared", "build-metadata.ts"), path2.join(projectPath, "scripts", "build-metadata.ts"));
3682
+ if (context.isCapacitorApp || context.fullstack?.frontends.app || context.fullstack?.frontends.desktop) {
3683
+ for (const file2 of ["native-name.mjs", "native-name.d.mts"])
3684
+ await fse.copy(path2.join(root, "shared", file2), path2.join(projectPath, "scripts", file2));
3685
+ }
3686
+ if (context.fullstack?.frontends.desktop)
3687
+ await fse.copy(path2.join(root, "shared", "run-tauri.mjs"), path2.join(projectPath, "scripts", "run-tauri.mjs"));
3682
3688
  await fse.copy(path2.join(root, "shared", "public-base-path.mjs"), path2.join(projectPath, "scripts", "public-base-path.mjs"));
3683
3689
  await fse.ensureDir(path2.join(projectPath, "images", "dependencies"));
3684
3690
  await fse.writeFile(path2.join(projectPath, "images", "dependencies", ".gitkeep"), "");
@@ -4122,7 +4128,7 @@ async function createProject(options) {
4122
4128
  });
4123
4129
  await generateFromTemplates(projectPath, context);
4124
4130
  {
4125
- const { generateConfigFile: generateConfigFile2, generateEnvExample, generateProductionEnvironment: generateProductionEnvironment2 } = await import('./cli-config-templates-H3EW2Y2W.js');
4131
+ const { generateConfigFile: generateConfigFile2, generateEnvExample, generateProductionEnvironment: generateProductionEnvironment2 } = await import('./cli-config-templates-TZSORUT6.js');
4126
4132
  const configs = resolvedOptions.moduleConfigs;
4127
4133
  const isApiWorkspace = resolvedOptions.appType === "api";
4128
4134
  const isFullstack = resolvedOptions.appType === "fullstack";
@@ -4254,7 +4260,7 @@ async function resolveOptions(options) {
4254
4260
  writeCliMessage("");
4255
4261
  const onCancel = () => {
4256
4262
  writeCliMessage(chalk.red(cliM("cli_cancelledLine")));
4257
- process13.exit(1);
4263
+ process14.exit(1);
4258
4264
  };
4259
4265
  let projectName = options.name;
4260
4266
  if (!projectName && useDefaults) {
@@ -4458,7 +4464,7 @@ async function promptModuleConfigs(features, projectName) {
4458
4464
  const configs = {};
4459
4465
  const onCancel = () => {
4460
4466
  writeCliMessage(chalk.red(cliM("cli_cancelledLine")));
4461
- process13.exit(1);
4467
+ process14.exit(1);
4462
4468
  };
4463
4469
  writeCliMessage("");
4464
4470
  writeCliMessage(chalk.bold(cliM("cli_createModuleConfig")));
@@ -4742,7 +4748,7 @@ ${pm} build --target image --images web
4742
4748
  ${pm} exec hai deploy ${appDir} --env prod --services web
4743
4749
  \`\`\`
4744
4750
 
4745
- \u6784\u5EFA\u4E0D\u8BFB\u53D6\u90E8\u7F72\u73AF\u5883\uFF1B\u4EA7\u7269\u4F4D\u4E8E .hai/build/docker/<buildId>\uFF0C\u7528 --artifact-dir \u7CBE\u786E\u9009\u62E9\u3002
4751
+ \u6E90\u7801\u4E0E\u955C\u50CF\u6784\u5EFA\u4E0D\u8BFB\u53D6\u90E8\u7F72\u73AF\u5883\uFF1B\u4EA7\u7269\u4F4D\u4E8E .hai/build/docker/build-<\u5DE5\u7A0B>-image-YYYYMMDD-HHmmss-<\u968F\u673A\u4E32>-<\u7248\u672C>\uFF0C\u7528 --artifact-dir \u7CBE\u786E\u9009\u62E9\u3002latest \u4FDD\u5B58\u6279\u6B21\u76F8\u5BF9\u76EE\u5F55\uFF0C\u65E7\u5236\u54C1\u4ECD\u53EF\u8BFB\u53D6\u3002
4746
4752
  \u5E94\u7528\u6839 package.json.version \u9A71\u52A8\u7248\u672C\uFF0C\u540C\u7248\u672C\u5141\u8BB8\u91CD\u65B0\u6784\u5EFA\u548C\u53D1\u5E03\uFF1B\u6E05\u5355\u8BB0\u5F55\u72EC\u7ACB\u6784\u5EFA\u7F16\u53F7\u4E0E\u6821\u9A8C\u548C\u3002
4747
4753
  \u5B8C\u6574\u79BB\u7EBF\u5305\u81EA\u52A8\u643A\u5E26\u81EA\u5EFA\u4E2D\u95F4\u4EF6\u955C\u50CF\uFF1B\u51C6\u5907\u4E2D\u95F4\u4EF6\u955C\u50CF\u9700\u8981\u6784\u5EFA\u673A\u6709\u53EF\u7528 Podman/Docker\uFF0C\u7F3A\u955C\u50CF\u65F6\u5728\u6253\u5305\u9636\u6BB5\u62C9\u53D6\u3002
4748
4754
  \u670D\u52A1\u5668\u9700\u8981 Linux\u3001Docker/Podman\u3001Docker Compose v2 \u6216 podman-compose 1.6.0 \u53CA\u4EE5\u4E0A\u3001sh\u3001tar\u3001sha256sum\u3001awk\u3001curl\u3001util-linux flock \u548C\u652F\u6301 flock \u7684\u6587\u4EF6\u7CFB\u7EDF\uFF0C\u542F\u52A8\u9636\u6BB5\u4E0D\u8054\u7F51\u62C9\u53D6\u3002
@@ -25665,7 +25671,7 @@ function resolveImageReference(reference, source) {
25665
25671
  return `${url2.host}${url2.pathname.replace(/\/$/, "")}/${parts.join("/")}`;
25666
25672
  }
25667
25673
  function systemProxy() {
25668
- if (process13.platform === "win32") {
25674
+ if (process14.platform === "win32") {
25669
25675
  const script = "$p=Get-ItemProperty -LiteralPath 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'; @{enabled=($p.ProxyEnable -eq 1);server=$p.ProxyServer;bypass=$p.ProxyOverride;pac=$p.AutoConfigURL}|ConvertTo-Json -Compress";
25670
25676
  const value = JSON.parse(execFileSync("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", script], { encoding: "utf8", windowsHide: true, timeout: 5e3 }));
25671
25677
  if (value.pac)
@@ -25675,7 +25681,7 @@ function systemProxy() {
25675
25681
  const entries = Object.fromEntries(value.server.split(";").map((item) => item.includes("=") ? item.split("=", 2) : ["all", item]));
25676
25682
  return { http: entries.http ?? entries.all, https: entries.https ?? entries.http ?? entries.all, bypass: value.bypass?.split(";").filter((item) => item !== "<local>").join(",") };
25677
25683
  }
25678
- if (process13.platform === "darwin") {
25684
+ if (process14.platform === "darwin") {
25679
25685
  const output2 = execFileSync("/usr/sbin/scutil", ["--proxy"], { encoding: "utf8", timeout: 5e3 });
25680
25686
  const get = (key) => output2.match(new RegExp(`^\\s*${key}\\s*:\\s*(.+)$`, "m"))?.[1]?.trim();
25681
25687
  if (get("ProxyAutoConfigEnable") === "1" || get("ProxyAutoDiscoveryEnable") === "1")
@@ -25688,7 +25694,7 @@ function resolveDownloadProxy(config2) {
25688
25694
  const mode = config2?.mode ?? "inherit";
25689
25695
  if (!["inherit", "system", "custom", "none"].includes(mode) || config2?.url !== void 0 && mode !== "custom")
25690
25696
  throw new Error(deployM("deploy_downloadInvalid"));
25691
- const values = mode === "system" ? systemProxy() : mode === "custom" ? { http: config2?.url, https: config2?.url } : mode === "inherit" ? { http: process13.env.HTTP_PROXY ?? process13.env.http_proxy, https: process13.env.HTTPS_PROXY ?? process13.env.https_proxy, bypass: process13.env.NO_PROXY ?? process13.env.no_proxy } : {};
25697
+ const values = mode === "system" ? systemProxy() : mode === "custom" ? { http: config2?.url, https: config2?.url } : mode === "inherit" ? { http: process14.env.HTTP_PROXY ?? process14.env.http_proxy, https: process14.env.HTTPS_PROXY ?? process14.env.https_proxy, bypass: process14.env.NO_PROXY ?? process14.env.no_proxy } : {};
25692
25698
  if (mode === "custom" && !config2?.url)
25693
25699
  throw new Error(deployM("deploy_downloadInvalid"));
25694
25700
  const normalize = (value) => {
@@ -25708,7 +25714,7 @@ function resolveDownloadProxy(config2) {
25708
25714
  const bypass = mode === "none" ? "" : config2?.bypass ?? values.bypass ?? "";
25709
25715
  if (/[\r\n\0]/.test(bypass))
25710
25716
  throw new Error(deployM("deploy_downloadInvalid"));
25711
- return { HTTP_PROXY: http, http_proxy: http, HTTPS_PROXY: https, https_proxy: https, NO_PROXY: bypass, no_proxy: bypass, ALL_PROXY: mode === "inherit" ? process13.env.ALL_PROXY ?? process13.env.all_proxy ?? "" : "", all_proxy: mode === "inherit" ? process13.env.ALL_PROXY ?? process13.env.all_proxy ?? "" : "", FTP_PROXY: mode === "inherit" ? process13.env.FTP_PROXY ?? process13.env.ftp_proxy ?? "" : "", ftp_proxy: mode === "inherit" ? process13.env.FTP_PROXY ?? process13.env.ftp_proxy ?? "" : "" };
25717
+ return { HTTP_PROXY: http, http_proxy: http, HTTPS_PROXY: https, https_proxy: https, NO_PROXY: bypass, no_proxy: bypass, ALL_PROXY: mode === "inherit" ? process14.env.ALL_PROXY ?? process14.env.all_proxy ?? "" : "", all_proxy: mode === "inherit" ? process14.env.ALL_PROXY ?? process14.env.all_proxy ?? "" : "", FTP_PROXY: mode === "inherit" ? process14.env.FTP_PROXY ?? process14.env.ftp_proxy ?? "" : "", ftp_proxy: mode === "inherit" ? process14.env.FTP_PROXY ?? process14.env.ftp_proxy ?? "" : "" };
25712
25718
  }
25713
25719
  function normalizeProjectName(name) {
25714
25720
  const normalized = name.trim().replace(/^@[^/]+\//, "").toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "");
@@ -26759,6 +26765,46 @@ external_exports.strictObject({
26759
26765
  bindDn: external_exports.string().min(1).max(512).default("cn=admin,dc=example,dc=org")
26760
26766
  })).min(1).max(4)
26761
26767
  });
26768
+ function resolveCoreInputs(environment) {
26769
+ const resolved = core.config.resolve({ name: "core", value: {}, schema: CoreConfigSchema, environment });
26770
+ if (!resolved.success)
26771
+ throw new Error(resolved.error.message);
26772
+ const { data } = resolved;
26773
+ if (data === null || typeof data !== "object" || Array.isArray(data))
26774
+ throw new Error("Invalid HAI_CORE: expected a JSON object");
26775
+ return (
26776
+ /** @type {Record<string, unknown>} */
26777
+ data
26778
+ );
26779
+ }
26780
+ function nativeNameEnvironment(envDir) {
26781
+ let inputs = process14.env;
26782
+ let selectedMode;
26783
+ if (envDir) {
26784
+ selectedMode = /** @type {string | undefined} */
26785
+ resolveCoreInputs().env ?? "production";
26786
+ const loaded = core.config.loadEnvFiles({ envDir, mode: selectedMode });
26787
+ if (!loaded.success)
26788
+ throw new Error(loaded.error.message);
26789
+ inputs = loaded.data;
26790
+ }
26791
+ const value = resolveCoreInputs(inputs);
26792
+ if (inputs.HAI_CORE !== void 0 && value.name === void 0)
26793
+ value.name = CoreConfigSchema.shape.name.parse(void 0);
26794
+ const environment = {};
26795
+ for (const key of ["name", "env"]) {
26796
+ if (value[key] === void 0)
26797
+ continue;
26798
+ const schema = key === "name" ? CoreConfigSchema.shape.name : CoreConfigSchema.shape.env;
26799
+ const parsed2 = schema.safeParse(value[key]);
26800
+ if (!parsed2.success)
26801
+ throw new Error(`Invalid HAI_CORE_${key.toUpperCase()}`);
26802
+ environment[`HAI_CORE_${key.toUpperCase()}`] = parsed2.data;
26803
+ }
26804
+ if (selectedMode)
26805
+ environment.HAI_CORE_ENV = selectedMode;
26806
+ return environment;
26807
+ }
26762
26808
  function object2(value) {
26763
26809
  if (value === void 0)
26764
26810
  return {};
@@ -26786,7 +26832,7 @@ async function resolveBuildDownloads(directory, options) {
26786
26832
  const savedImage = object2(sources.image);
26787
26833
  const savedNpm = object2(sources.npm);
26788
26834
  const savedProxy = object2(build.proxy);
26789
- const interactive = !!process13.stdin.isTTY && !options.yes;
26835
+ const interactive = !!process14.stdin.isTTY && !options.yes;
26790
26836
  const choose = async (message, values) => {
26791
26837
  const answer = await prompts({ type: "select", name: "value", message, choices: values.map((value) => ({ title: cliM(`cli_download_${value}`), value })) });
26792
26838
  if (typeof answer.value !== "string")
@@ -26927,6 +26973,22 @@ function validateDownloadDockerfile(file2, downloads) {
26927
26973
  throw new Error(cliM("cli_download_template_required", { params: { path: file2 } }));
26928
26974
  }
26929
26975
  }
26976
+ function createBuildId(version2) {
26977
+ return `${core.time.formatDate(/* @__PURE__ */ new Date(), "YYYYMMDD-HHmmss")}-${randomBytes(3).toString("hex")}-${version2}`;
26978
+ }
26979
+ function buildBatchName(project, target, buildId) {
26980
+ return `build-${project}-${target}-${buildId}`;
26981
+ }
26982
+ function nativePackageFile(project, platform, debug, version2, file2, arch) {
26983
+ const extension = extname(file2);
26984
+ const variant = debug ? "debug" : "release";
26985
+ const qualifier = platform === "android" ? basename(file2, extension).replace(/^app(?:-|$)/, "").replace(/(?:^|-)(?:debug|release)(?:-unsigned)?$/, "").replace(/[^\w.-]+/g, "-").replace(/^-+|-+$/g, "") : "";
26986
+ const target = [platform, arch, qualifier, variant].filter(Boolean).join("-");
26987
+ const installer = platform === "windows" && extension.toLowerCase() === ".exe" ? "-setup" : "";
26988
+ return `${project}-${target}-${version2}${installer}${extension}`;
26989
+ }
26990
+
26991
+ // src/commands/cli-build-native.ts
26930
26992
  function nativeProjectDirectory(root, item) {
26931
26993
  const directory = resolve(root, item);
26932
26994
  const inside = (parent, path10) => {
@@ -26968,20 +27030,22 @@ function isNativeZip(path10) {
26968
27030
  closeSync(fd2);
26969
27031
  }
26970
27032
  }
26971
- async function publishNativeArtifacts(root, kind, platform, debug, identity, artifacts) {
27033
+ async function publishNativeArtifacts(root, project, kind, platform, debug, identity, artifacts, arch) {
26972
27034
  const variant = debug ? "debug" : "release";
26973
27035
  const parent = join(root, ".hai", "build", kind, platform, variant);
26974
27036
  mkdirSync(parent, { recursive: true });
26975
27037
  const staging = mkdtempSync(join(parent, ".building-"));
26976
27038
  const latest = join(parent, `latest-${identity.buildId}`);
26977
- const batch = join(parent, identity.buildId);
27039
+ const name = buildBatchName(project, [kind, platform, arch, variant].filter(Boolean).join("-"), identity.buildId);
27040
+ const batch = join(parent, name);
26978
27041
  try {
26979
27042
  const files = [];
26980
27043
  for (const artifact of artifacts) {
26981
- const output2 = join(staging, artifact.file);
27044
+ const namedFile = join(dirname(artifact.file), nativePackageFile(project, platform, debug, identity.appVersion, artifact.file, arch));
27045
+ const output2 = join(staging, namedFile);
26982
27046
  mkdirSync(dirname(output2), { recursive: true });
26983
27047
  cpSync(artifact.source, output2, { recursive: true, force: false, errorOnExist: true, verbatimSymlinks: true });
26984
- const file2 = artifact.file.split(sep).join("/");
27048
+ const file2 = namedFile.split(sep).join("/");
26985
27049
  if (lstatSync(output2).isDirectory()) {
26986
27050
  files.push({ file: file2 });
26987
27051
  continue;
@@ -26991,10 +27055,10 @@ async function publishNativeArtifacts(root, kind, platform, debug, identity, art
26991
27055
  hash2.update(chunk);
26992
27056
  files.push({ file: file2, sha256: hash2.digest("hex") });
26993
27057
  }
26994
- writeFileSync(join(staging, "manifest.json"), `${JSON.stringify({ ...identity, kind, platform, variant, files }, null, 2)}
27058
+ writeFileSync(join(staging, "manifest.json"), `${JSON.stringify({ ...identity, kind, platform, ...arch ? { arch } : {}, variant, files }, null, 2)}
26995
27059
  `);
26996
27060
  renameSync(staging, batch);
26997
- writeFileSync(latest, `${identity.buildId}
27061
+ writeFileSync(latest, `${name}
26998
27062
  `);
26999
27063
  renameSync(latest, join(parent, "latest"));
27000
27064
  return files.map(({ file: file2 }) => join(batch, file2));
@@ -27014,19 +27078,22 @@ variant=$1
27014
27078
  shift
27015
27079
  cd /workspace
27016
27080
  pnpm install --frozen-lockfile --prefer-offline --prod=false --store-dir /cache/pnpm
27017
- export GRADLE_OPTS="$(node -e '
27081
+ mapfile -d '' gradleProxyArguments < <(node -e '
27018
27082
  for (const protocol of ["http", "https"]) {
27019
27083
  const value = process.env[protocol.toUpperCase() + "_PROXY"];
27020
27084
  if (value) {
27021
27085
  const url = new URL(value);
27022
- process.stdout.write("-D" + protocol + ".proxyHost=" + url.hostname + " -D" + protocol + ".proxyPort=" + (url.port || (url.protocol === "https:" ? "443" : "80")) + " ");
27086
+ process.stdout.write("-D" + protocol + ".proxyHost=" + url.hostname + "\0");
27087
+ process.stdout.write("-D" + protocol + ".proxyPort=" + (url.port || (url.protocol === "https:" ? "443" : "80")) + "\0");
27023
27088
  }
27024
27089
  }
27025
27090
  if (process.env.NO_PROXY) {
27026
27091
  const exclusions = process.env.NO_PROXY.split(",").map(value => value.trim().replace(/^\./, "*.").replace(/:\d+$/, ""));
27027
- process.stdout.write("-Dhttp.nonProxyHosts=" + exclusions.join("|"));
27092
+ process.stdout.write("-Dhttp.nonProxyHosts=" + exclusions.join("|") + "\0");
27028
27093
  }
27029
- ')"
27094
+ ')
27095
+ # Wrapper 客户端与后台构建都需要代理;GRADLE_OPTS 本身不保证传递给 Daemon。
27096
+ export GRADLE_OPTS="${"$"}{gradleProxyArguments[*]}"
27030
27097
  for app in "$@"; do
27031
27098
  cd /workspace
27032
27099
  pnpm --filter "{./$app}^..." --if-present run build
@@ -27047,7 +27114,7 @@ for app in "$@"; do
27047
27114
  fi
27048
27115
  node -e 'if (require("./android/app/src/main/assets/capacitor.config.json").server?.url) throw new Error("APK requires bundled WebView assets")'
27049
27116
  cd android
27050
- bash ./gradlew --no-daemon "assemble$variant"
27117
+ bash ./gradlew --no-daemon "assemble$variant" "${"$"}{gradleProxyArguments[@]}"
27051
27118
  done
27052
27119
  `;
27053
27120
  var verifyAndroid = String.raw`
@@ -27101,16 +27168,16 @@ async function buildContainerAndroid(root, apps, options, publish) {
27101
27168
  let keystore;
27102
27169
  if (!debug) {
27103
27170
  const values = {
27104
- HAI_ANDROID_STORE_PASSWORD: process13.env.HAI_ANDROID_STORE_PASSWORD,
27105
- HAI_ANDROID_KEY_ALIAS: process13.env.HAI_ANDROID_KEY_ALIAS,
27106
- HAI_ANDROID_KEY_PASSWORD: process13.env.HAI_ANDROID_KEY_PASSWORD
27171
+ HAI_ANDROID_STORE_PASSWORD: process14.env.HAI_ANDROID_STORE_PASSWORD,
27172
+ HAI_ANDROID_KEY_ALIAS: process14.env.HAI_ANDROID_KEY_ALIAS,
27173
+ HAI_ANDROID_KEY_PASSWORD: process14.env.HAI_ANDROID_KEY_PASSWORD
27107
27174
  };
27108
27175
  for (const [key, value] of Object.entries(values)) {
27109
27176
  if (!value)
27110
27177
  throw new Error(cliM("cli_build_android_signing"));
27111
27178
  signing[key] = value;
27112
27179
  }
27113
- const path10 = process13.env.HAI_ANDROID_KEYSTORE;
27180
+ const path10 = process14.env.HAI_ANDROID_KEYSTORE;
27114
27181
  if (!path10 || !existsSync(resolve(root, path10)) || !statSync(resolve(root, path10)).isFile())
27115
27182
  throw new Error(cliM("cli_build_android_signing"));
27116
27183
  keystore = resolve(root, path10);
@@ -27127,7 +27194,7 @@ async function buildContainerAndroid(root, apps, options, publish) {
27127
27194
  const proxyArgs = buildProxyArguments(downloads.proxy, runtime, network);
27128
27195
  const engineArgs = [
27129
27196
  ...network === void 0 ? [] : ["--network", network],
27130
- ...runtime === "docker" && process13.platform === "linux" && network !== "host" ? ["--add-host", "host.docker.internal:host-gateway"] : [],
27197
+ ...runtime === "docker" && process14.platform === "linux" && network !== "host" ? ["--add-host", "host.docker.internal:host-gateway"] : [],
27131
27198
  ...runtime === "podman" && downloads.proxy.mode === "none" ? ["--http-proxy=false"] : []
27132
27199
  ];
27133
27200
  try {
@@ -27159,15 +27226,15 @@ async function buildContainerAndroid(root, apps, options, publish) {
27159
27226
  const equals = argument.indexOf("=");
27160
27227
  return [argument.slice(0, equals), argument.slice(equals + 1)];
27161
27228
  }));
27162
- const uid = process13.getuid?.();
27163
- const gid = process13.getgid?.();
27229
+ const uid = process14.getuid?.();
27230
+ const gid = process14.getgid?.();
27164
27231
  const userArgs = uid === void 0 || gid === void 0 ? [] : [
27165
27232
  ...runtime === "podman" && uid !== 0 ? ["--userns=keep-id"] : [],
27166
27233
  "--user",
27167
27234
  `${uid}:${gid}`
27168
27235
  ];
27169
27236
  const relativeApps = directories.map((path10) => relative(dependencies, path10).split(sep).join("/") || ".");
27170
- const environment = { ...proxy, npm_config_registry: downloads.npmRegistry, npm_config_nodedir: "/usr/local" };
27237
+ const environment = { ...proxy, ...options.environment, npm_config_registry: downloads.npmRegistry, npm_config_nodedir: "/usr/local" };
27171
27238
  const workspaceMount = bindMount(workspace, "/workspace");
27172
27239
  await run2([
27173
27240
  "run",
@@ -27238,7 +27305,7 @@ async function buildContainerAndroid(root, apps, options, publish) {
27238
27305
  }
27239
27306
  function gradleCommand(debug) {
27240
27307
  const task = debug ? "assembleDebug" : "assembleRelease";
27241
- return process13.platform === "win32" ? ["cmd.exe", "/d", "/c", "gradlew.bat", task, "--no-daemon"] : ["bash", "./gradlew", task, "--no-daemon"];
27308
+ return process14.platform === "win32" ? ["cmd.exe", "/d", "/c", "gradlew.bat", task, "--no-daemon"] : ["bash", "./gradlew", task, "--no-daemon"];
27242
27309
  }
27243
27310
  function isAppPackage(path10, platform, debug) {
27244
27311
  if (platform === "ios")
@@ -27247,7 +27314,7 @@ function isAppPackage(path10, platform, debug) {
27247
27314
  return parts.at(-2) === (debug ? "debug" : "release") && path10.endsWith(".apk") && !path10.endsWith("-unsigned.apk");
27248
27315
  }
27249
27316
  async function buildMobileApp(root, directories, platform, run2, debug = false, runGradle) {
27250
- if (!directories.length || platform === "ios" && process13.platform !== "darwin")
27317
+ if (!directories.length || platform === "ios" && process14.platform !== "darwin")
27251
27318
  throw new Error(cliM("cli_build_app_platform"));
27252
27319
  const outputs = [];
27253
27320
  for (const item of directories) {
@@ -27304,27 +27371,27 @@ async function forwardWindowsBuildOutput(source, destination) {
27304
27371
  // src/commands/cli-build.ts
27305
27372
  async function run(command, args, cwd, quiet = false, identity, compileEnvironment) {
27306
27373
  await new Promise((resolve16, reject) => {
27307
- const env = Object.fromEntries(Object.entries(process13.env).filter(([key]) => !/^(?:HAI_|PUBLIC_|VITE_)/.test(key)));
27374
+ const env = Object.fromEntries(Object.entries(process14.env).filter(([key]) => !/^(?:HAI_|PUBLIC_|VITE_)/.test(key)));
27308
27375
  Object.assign(env, compileEnvironment);
27309
27376
  if (identity) {
27310
27377
  env.HAI_BUILD_ID = identity.buildId;
27311
27378
  env.HAI_BUILD_COMMIT = identity.commit;
27312
27379
  }
27313
27380
  env.NODE_ENV = "production";
27314
- if (process13.platform === "win32") {
27381
+ if (process14.platform === "win32") {
27315
27382
  env.npm_config_reporter = "append-only";
27316
27383
  env.pnpm_config_reporter = "append-only";
27317
27384
  }
27318
27385
  delete env.CAPACITOR_SERVER_URL;
27319
27386
  if (env.CI === "1" || env.CI === "0")
27320
27387
  env.CI = env.CI === "1" ? "true" : "false";
27321
- const windowsOutput = !quiet && process13.platform === "win32";
27388
+ const windowsOutput = !quiet && process14.platform === "win32";
27322
27389
  const child = spawn(command, args, { cwd, env, windowsHide: true, stdio: quiet ? "ignore" : windowsOutput ? ["inherit", "pipe", "pipe"] : "inherit", shell: false });
27323
27390
  let output2 = Promise.resolve();
27324
27391
  if (windowsOutput && child.stdout && child.stderr) {
27325
27392
  output2 = Promise.all([
27326
- forwardWindowsBuildOutput(child.stdout, process13.stdout),
27327
- forwardWindowsBuildOutput(child.stderr, process13.stderr)
27393
+ forwardWindowsBuildOutput(child.stdout, process14.stdout),
27394
+ forwardWindowsBuildOutput(child.stderr, process14.stderr)
27328
27395
  ]).then(() => void 0);
27329
27396
  void output2.catch(() => child.kill());
27330
27397
  }
@@ -27335,11 +27402,11 @@ async function run(command, args, cwd, quiet = false, identity, compileEnvironme
27335
27402
  });
27336
27403
  }
27337
27404
  async function pnpm(args, cwd, identity, compileEnvironment) {
27338
- const entry = process13.env.npm_execpath;
27405
+ const entry = process14.env.npm_execpath;
27339
27406
  if (entry && /(?:^|[/\\])pnpm(?:-native)?(?:\.exe|\.[cm]?js)?$/i.test(entry))
27340
- return /\.[cm]?js$/i.test(entry) ? run(process13.execPath, [entry, ...args], cwd, false, identity, compileEnvironment) : run(entry, args, cwd, false, identity, compileEnvironment);
27341
- if (process13.platform === "win32") {
27342
- const directories = (process13.env.PATH ?? "").split(";");
27407
+ return /\.[cm]?js$/i.test(entry) ? run(process14.execPath, [entry, ...args], cwd, false, identity, compileEnvironment) : run(entry, args, cwd, false, identity, compileEnvironment);
27408
+ if (process14.platform === "win32") {
27409
+ const directories = (process14.env.PATH ?? "").split(";");
27343
27410
  for (const directory of directories) {
27344
27411
  const executable = join(directory, "pnpm.exe");
27345
27412
  if (existsSync(executable))
@@ -27347,7 +27414,7 @@ async function pnpm(args, cwd, identity, compileEnvironment) {
27347
27414
  for (const relative8 of ["node_modules/pnpm/bin/pnpm.cjs", "pnpm.cjs"]) {
27348
27415
  const candidate = join(directory, relative8);
27349
27416
  if (existsSync(candidate))
27350
- return run(process13.execPath, [candidate, ...args], cwd, false, identity, compileEnvironment);
27417
+ return run(process14.execPath, [candidate, ...args], cwd, false, identity, compileEnvironment);
27351
27418
  }
27352
27419
  }
27353
27420
  throw new Error(cliM("cli_build_use_pnpm"));
@@ -27355,8 +27422,8 @@ async function pnpm(args, cwd, identity, compileEnvironment) {
27355
27422
  return run("pnpm", args, cwd, false, identity, compileEnvironment);
27356
27423
  }
27357
27424
  function staticCompileEnvironment(target) {
27358
- const flag = process13.env.HAI_BUILD_STATIC;
27359
- const base = process13.env.PUBLIC_BASE_PATH;
27425
+ const flag = process14.env.HAI_BUILD_STATIC;
27426
+ const base = process14.env.PUBLIC_BASE_PATH;
27360
27427
  if (flag !== void 0 && flag !== "" && flag !== "0" && flag !== "1")
27361
27428
  throw new Error(cliM("cli_build_static_flag"));
27362
27429
  if (base && (!/^\/[\w.-]+(?:\/[\w.-]+)*$/.test(base) || base.split("/").some((segment) => segment === "." || segment === "..")))
@@ -27392,7 +27459,7 @@ async function buildRuntime(cwd, choice) {
27392
27459
  throw new Error(cliM("cli_build_runtime_missing"));
27393
27460
  }
27394
27461
  async function buildCommand(options) {
27395
- const directory = resolve(options.cwd ?? process13.cwd());
27462
+ const directory = resolve(options.cwd ?? process14.cwd());
27396
27463
  const target = options.target ?? "compile";
27397
27464
  const concurrency = Number(options.concurrency ?? 2);
27398
27465
  if (![1, 2].includes(concurrency))
@@ -27417,13 +27484,17 @@ async function buildCommand(options) {
27417
27484
  throw new Error(cliM("cli_build_version_invalid"));
27418
27485
  const project = readProjectConfig(join(cwd, "hai.json"));
27419
27486
  const config2 = project.build ?? {};
27487
+ if (typeof metadata.name !== "string" || !metadata.name.trim())
27488
+ throw new Error(cliM("cli_build_project_name_required"));
27489
+ const projectName = normalizeProjectName(metadata.name);
27420
27490
  const debug = options.debug === true;
27421
- const identity = { buildId: `${appVersion}-${Date.now()}-${randomBytes(3).toString("hex")}`, commit: sourceCommit(cwd), appVersion };
27491
+ const identity = { buildId: createBuildId(appVersion), commit: sourceCommit(cwd), appVersion };
27422
27492
  if (target === "app") {
27423
27493
  const platform = options.platform;
27424
27494
  if (platform !== "android" && platform !== "ios")
27425
27495
  throw new Error(cliM("cli_build_app_platform"));
27426
- const publish = (artifacts) => publishNativeArtifacts(cwd, "app", platform, debug, identity, artifacts);
27496
+ const publish = (artifacts) => publishNativeArtifacts(cwd, projectName, "app", platform, debug, identity, artifacts);
27497
+ const nativeEnvironment = nativeNameEnvironment(cwd);
27427
27498
  let files;
27428
27499
  if (containerAndroid) {
27429
27500
  const runtime2 = await buildRuntime(cwd, options.runtime);
@@ -27434,20 +27505,21 @@ async function buildCommand(options) {
27434
27505
  network: options.network,
27435
27506
  debug,
27436
27507
  downloads: downloads2,
27508
+ environment: nativeEnvironment,
27437
27509
  run: (args, quiet, environment) => run(runtime2, args, cwd, quiet, identity, environment)
27438
27510
  }, publish);
27439
27511
  } else {
27440
27512
  const [gradle, ...gradleArgs] = gradleCommand(debug);
27441
- files = await publish(await buildMobileApp(cwd, config2.app ?? [], platform, (args, directory2) => pnpm(args, directory2, identity), debug, (directory2) => run(gradle, gradleArgs, directory2, false, identity)));
27513
+ files = await publish(await buildMobileApp(cwd, config2.app ?? [], platform, (args, directory2) => pnpm(args, directory2, identity, nativeEnvironment), debug, (directory2) => run(gradle, gradleArgs, directory2, false, identity)));
27442
27514
  }
27443
27515
  for (const file2 of files) writeCliMessage(file2);
27444
27516
  return;
27445
27517
  }
27446
27518
  if (target === "desktop") {
27447
27519
  const platforms = { win32: "windows", linux: "linux", darwin: "macos" };
27448
- const host = platforms[process13.platform];
27520
+ const host = platforms[process14.platform];
27449
27521
  const platform = options.platform ?? host;
27450
- const arch = options.arch ?? process13.arch;
27522
+ const arch = options.arch ?? process14.arch;
27451
27523
  if (!platform || platform !== host || !["x64", "arm64"].includes(arch))
27452
27524
  throw new Error(cliM("cli_build_native_host"));
27453
27525
  if (!config2.desktop?.length)
@@ -27455,25 +27527,26 @@ async function buildCommand(options) {
27455
27527
  const rustTarget = `${arch === "x64" ? "x86_64" : "aarch64"}-${platform === "windows" ? "pc-windows-msvc" : platform === "macos" ? "apple-darwin" : "unknown-linux-gnu"}`;
27456
27528
  const bundles = platform === "windows" ? "nsis" : platform === "macos" ? "app,dmg" : "deb,appimage";
27457
27529
  const artifacts = [];
27530
+ const nativeEnvironment = nativeNameEnvironment(cwd);
27458
27531
  for (const item of config2.desktop) {
27459
27532
  const directory2 = nativeProjectDirectory(cwd, item);
27460
- const cargo = resolve(directory2, "src-tauri", process13.env.CARGO_TARGET_DIR || "target");
27533
+ const cargo = resolve(directory2, "src-tauri", process14.env.CARGO_TARGET_DIR || "target");
27461
27534
  const output2 = join(cargo, rustTarget, debug ? "debug" : "release", "bundle");
27462
27535
  const bundlesOnDisk = () => nativeFiles(output2, (path10, isDirectory) => isDirectory ? platform === "macos" && path10.endsWith(".app") : platform === "windows" ? path10.endsWith(".exe") : platform === "macos" ? path10.endsWith(".dmg") : /\.(?:deb|AppImage)$/.test(path10));
27463
27536
  const before = bundlesOnDisk();
27464
- await pnpm(["exec", "tauri", "build", "--target", rustTarget, "--bundles", bundles, ...debug ? ["--debug"] : [], "--config", JSON.stringify({ version: appVersion })], directory2, identity);
27537
+ const manifestFile = join(directory2, "package.json");
27538
+ const manifest = existsSync(manifestFile) ? JSON.parse(readFileSync(manifestFile, "utf8")) : {};
27539
+ const entry = manifest.scripts?.tauri ? "run" : "exec";
27540
+ await pnpm([entry, "tauri", "build", "--target", rustTarget, "--bundles", bundles, ...debug ? ["--debug"] : [], "--config", JSON.stringify({ version: appVersion })], directory2, identity, nativeEnvironment);
27465
27541
  const files = [...bundlesOnDisk()].filter(([file2, stamp]) => before.get(file2) !== stamp);
27466
27542
  if (!files.length)
27467
27543
  throw new Error(cliM("cli_build_desktop_artifact"));
27468
27544
  artifacts.push(...files.map(([source]) => ({ source, file: join(relative(cwd, directory2), relative(output2, source)) })));
27469
27545
  }
27470
- for (const file2 of await publishNativeArtifacts(cwd, "desktop", platform, debug, identity, artifacts))
27546
+ for (const file2 of await publishNativeArtifacts(cwd, projectName, "desktop", platform, debug, identity, artifacts, arch))
27471
27547
  writeCliMessage(file2);
27472
27548
  return;
27473
27549
  }
27474
- if (typeof metadata.name !== "string" || !metadata.name.trim())
27475
- throw new Error(cliM("cli_build_project_name_required"));
27476
- const projectName = normalizeProjectName(metadata.name);
27477
27550
  if (!Array.isArray(config2.images) || !config2.images.length || config2.images.some((image) => !image || typeof image !== "object") || config2.images.length > 2 || new Set(config2.images.map((image) => image.name)).size !== config2.images.length || config2.images.some((image) => !["serv", "web"].includes(image.name) || typeof image.dockerfile !== "string" || !image.dockerfile || "target" in image || image.containerPort !== void 0 && (!Number.isInteger(image.containerPort) || image.containerPort < 1 || image.containerPort > 65535))) {
27478
27551
  throw new Error(cliM("cli_build_images_missing"));
27479
27552
  }
@@ -27520,8 +27593,8 @@ async function buildCommand(options) {
27520
27593
  const context = resolve(cwd, image.context ?? ".");
27521
27594
  const imageRef = `localhost/hai-${projectName}-${image.name}:${buildId.toLowerCase().replaceAll("+", "_")}`;
27522
27595
  const args = ["build", "-f", resolve(cwd, image.dockerfile), "-t", imageRef];
27523
- const testRun = process13.env.HAI_TEST_IMAGE_RUN;
27524
- const testLedger = process13.env.HAI_TEST_IMAGE_LEDGER;
27596
+ const testRun = process14.env.HAI_TEST_IMAGE_RUN;
27597
+ const testLedger = process14.env.HAI_TEST_IMAGE_LEDGER;
27525
27598
  if (testLedger && /^[a-f0-9-]{36}$/.test(testRun ?? "")) {
27526
27599
  const label = `org.h-ai.test.image-run=${testRun}`;
27527
27600
  args.push("--label", label);
@@ -27535,7 +27608,7 @@ async function buildCommand(options) {
27535
27608
  for (const match of dockerfile.matchAll(/^ARG (HAI_(?:NODE|NGINX)_IMAGE)=(\S+)\s*$/gm))
27536
27609
  args.push("--build-arg", `${match[1]}=${resolveImageReference(match[2], downloads.imageSource)}`);
27537
27610
  args.push("--build-arg", `HAI_NPM_REGISTRY=${downloads.npmRegistry}`, ...buildProxyArguments(downloads.proxy, runtime, options.network));
27538
- if (runtime === "docker" && process13.platform === "linux" && options.network !== "host")
27611
+ if (runtime === "docker" && process14.platform === "linux" && options.network !== "host")
27539
27612
  args.push("--add-host", "host.docker.internal:host-gateway");
27540
27613
  if (options.network !== void 0)
27541
27614
  args.push("--network", options.network);
@@ -27566,11 +27639,12 @@ async function buildCommand(options) {
27566
27639
  artifact.images.push(result.value);
27567
27640
  }
27568
27641
  }
27569
- const output2 = join(parent, buildId);
27642
+ const batch = buildBatchName(projectName, "image", buildId);
27643
+ const output2 = join(parent, batch);
27570
27644
  writeFileSync(join(staging, "manifest.json"), `${JSON.stringify(artifact, null, 2)}
27571
27645
  `);
27572
27646
  renameSync(staging, output2);
27573
- writeFileSync(join(parent, `latest-${buildId}`), `${buildId}
27647
+ writeFileSync(join(parent, `latest-${buildId}`), `${batch}
27574
27648
  `);
27575
27649
  renameSync(join(parent, `latest-${buildId}`), join(parent, "latest"));
27576
27650
  writeCliMessage(cliM("cli_build_ready", { params: { path: output2, runtime } }));
@@ -27625,7 +27699,7 @@ function prepareDependencyInputs(cwd) {
27625
27699
  async function deploySecretsCommand(directory, options) {
27626
27700
  if (!options.import || !["docker", "podman"].includes(options.runtime ?? "docker"))
27627
27701
  throw new Error(cliM("cli_deploy_secrets_options"));
27628
- const cwd = resolve(options.cwd ?? process13.cwd());
27702
+ const cwd = resolve(options.cwd ?? process14.cwd());
27629
27703
  const local = createRequire(resolve(cwd, "package.json"));
27630
27704
  let module;
27631
27705
  try {
@@ -27994,11 +28068,11 @@ async function configureDeployHttps(module, config2, environment, nonInteractive
27994
28068
  }
27995
28069
  async function deployCommand(options) {
27996
28070
  const spinner = ora();
27997
- const cwd = options.cwd ?? process13.cwd();
28071
+ const cwd = options.cwd ?? process14.cwd();
27998
28072
  let appDir = resolve(cwd, options.appDir ?? ".");
27999
28073
  let closeDeploy = null;
28000
28074
  let restoreProjectLogger;
28001
- const originalEnv = { ...process13.env };
28075
+ const originalEnv = { ...process14.env };
28002
28076
  const previousLogLevel = core.logger.getLevel();
28003
28077
  core.logger.setLevel("fatal");
28004
28078
  try {
@@ -28015,14 +28089,14 @@ async function deployCommand(options) {
28015
28089
  throw new Error(cliM("cli_build_selection_invalid"));
28016
28090
  let environmentName = options.env;
28017
28091
  if (!environmentName) {
28018
- if (!process13.stdin.isTTY)
28092
+ if (!process14.stdin.isTTY)
28019
28093
  throw new Error(cliM("cli_deploy_environment_hint"));
28020
28094
  const answer = await prompts({ type: "text", name: "environment", message: cliM("cli_deploy_environment"), initial: "prod" });
28021
28095
  environmentName = answer.environment;
28022
28096
  if (!environmentName)
28023
28097
  throw new Error(cliM("cli_deploy_cancelled"));
28024
28098
  }
28025
- if (!options.plan && !options.yes && !process13.stdin.isTTY)
28099
+ if (!options.plan && !options.yes && !process14.stdin.isTTY)
28026
28100
  throw new Error(cliM("cli_deploy_environment_hint"));
28027
28101
  let deployModule;
28028
28102
  try {
@@ -28072,7 +28146,7 @@ async function deployCommand(options) {
28072
28146
  if (options.plan) {
28073
28147
  if (options.build || options.bundleOnly || options.output || options.imageSource !== void 0 || options.imageMirrors !== void 0 || options.npmSource !== void 0 || options.npmRegistry !== void 0 || options.proxyMode !== void 0 || options.proxyUrl !== void 0 || options.proxyBypass !== void 0 || options.httpProxy === false)
28074
28148
  throw new Error(cliM("cli_deploy_plan_options"));
28075
- const loaded = deployModule.loadDeploymentConfig("deploy", buildFile, { ...process13.env, ...environment.data.values });
28149
+ const loaded = deployModule.loadDeploymentConfig("deploy", buildFile, { ...process14.env, ...environment.data.values });
28076
28150
  if (!loaded.success)
28077
28151
  throw new Error(loaded.error.message);
28078
28152
  const validated = deployModule.DeployConfigSchema.safeParse(loaded.data);
@@ -28084,7 +28158,7 @@ async function deployCommand(options) {
28084
28158
  writeCliMessage(JSON.stringify(plan.data, null, 2));
28085
28159
  return;
28086
28160
  }
28087
- Object.assign(process13.env, environment.data.values);
28161
+ Object.assign(process14.env, environment.data.values);
28088
28162
  spinner.start(cliM("cli_deploy_load_credentials"));
28089
28163
  const credResult = deploy.credentials.load();
28090
28164
  if (!credResult.success) {
@@ -28098,7 +28172,7 @@ async function deployCommand(options) {
28098
28172
  writeCliMessage(chalk.cyan(cliM("cli_deploy_config_hint")));
28099
28173
  throw new Error(cliM("cli_deploy_config_missing", { params: { path: configPath } }));
28100
28174
  }
28101
- const loadedConfig = deployModule.loadDeploymentConfig("deploy", configPath, process13.env);
28175
+ const loadedConfig = deployModule.loadDeploymentConfig("deploy", configPath, process14.env);
28102
28176
  if (!loadedConfig.success)
28103
28177
  throw new Error(loadedConfig.error.message);
28104
28178
  const deployConfig = loadedConfig.data;
@@ -28180,15 +28254,15 @@ async function deployCommand(options) {
28180
28254
  if (options.bundleOnly)
28181
28255
  await configureDeployTarget(deployModule, deployConfig, environment.data, options.yes, true);
28182
28256
  await configureDeployHttps(deployModule, deployConfig, environment.data, options.yes, selectedServices !== void 0);
28183
- for (const key of Object.keys(process13.env)) {
28257
+ for (const key of Object.keys(process14.env)) {
28184
28258
  if (originalEnv[key] === void 0)
28185
- delete process13.env[key];
28259
+ delete process14.env[key];
28186
28260
  }
28187
- Object.assign(process13.env, originalEnv);
28261
+ Object.assign(process14.env, originalEnv);
28188
28262
  const refreshed = deployModule.loadDeploymentEnvironment({ environment: environment.data.environment, envDir: environment.data.envDir });
28189
28263
  if (!refreshed.success)
28190
28264
  throw new Error(refreshed.error.message);
28191
- Object.assign(process13.env, refreshed.data.values);
28265
+ Object.assign(process14.env, refreshed.data.values);
28192
28266
  spinner.start(cliM("cli_deploy_initializing"));
28193
28267
  const validatedConfig = deployModule.DeployConfigSchema.safeParse(deployConfig);
28194
28268
  if (!validatedConfig.success)
@@ -28266,14 +28340,14 @@ async function deployCommand(options) {
28266
28340
  await closeDeploy();
28267
28341
  } catch (error62) {
28268
28342
  writeCliError("Failed to close deploy module", error62);
28269
- process13.exitCode = 1;
28343
+ process14.exitCode = 1;
28270
28344
  }
28271
28345
  }
28272
- for (const key of Object.keys(process13.env)) {
28346
+ for (const key of Object.keys(process14.env)) {
28273
28347
  if (originalEnv[key] === void 0)
28274
- delete process13.env[key];
28348
+ delete process14.env[key];
28275
28349
  }
28276
- Object.assign(process13.env, originalEnv);
28350
+ Object.assign(process14.env, originalEnv);
28277
28351
  core.logger.setLevel(previousLogLevel);
28278
28352
  restoreProjectLogger?.();
28279
28353
  }
@@ -29107,7 +29181,7 @@ async function startFeedbackViewer(bundle, options = {}) {
29107
29181
  async function feedbackCommand(action, bundlePath, options = {}) {
29108
29182
  if (!["inspect", "summary", "evidence", "view"].includes(action))
29109
29183
  throw new Error(cliM("cli_feedback_invalidAction"));
29110
- const filePath = path2.resolve(options.cwd ?? process13.cwd(), bundlePath);
29184
+ const filePath = path2.resolve(options.cwd ?? process14.cwd(), bundlePath);
29111
29185
  const metadata = await stat(filePath);
29112
29186
  if (!metadata.isFile() || metadata.size > 64 * 1024 * 1024)
29113
29187
  throw new Error(cliM("cli_feedback_invalidBundle"));
@@ -29141,12 +29215,12 @@ async function feedbackCommand(action, bundlePath, options = {}) {
29141
29215
  writeCliMessage(cliM("cli_feedback_viewerStarted", { params: { url: viewer.url } }));
29142
29216
  await new Promise((resolve16, reject) => {
29143
29217
  const stop = () => {
29144
- process13.off("SIGINT", stop);
29145
- process13.off("SIGTERM", stop);
29218
+ process14.off("SIGINT", stop);
29219
+ process14.off("SIGTERM", stop);
29146
29220
  viewer.close().then(resolve16, reject);
29147
29221
  };
29148
- process13.once("SIGINT", stop);
29149
- process13.once("SIGTERM", stop);
29222
+ process14.once("SIGINT", stop);
29223
+ process14.once("SIGTERM", stop);
29150
29224
  });
29151
29225
  }
29152
29226
  function appendAt(source, marker, entry) {
@@ -29887,7 +29961,7 @@ async function inspectFrameworkUpgrade(directory, version2) {
29887
29961
  for await (const manifest of glob(`${pattern}/package.json`, { cwd: root, exclude })) {
29888
29962
  const location = realpathSync(dirname(join(root, manifest)));
29889
29963
  const fromRoot = relative(root, location);
29890
- if (!isAbsolute(fromRoot) && fromRoot !== ".." && !fromRoot.startsWith(`..${process13.platform === "win32" ? "\\" : "/"}`))
29964
+ if (!isAbsolute(fromRoot) && fromRoot !== ".." && !fromRoot.startsWith(`..${process14.platform === "win32" ? "\\" : "/"}`))
29891
29965
  directories.add(location);
29892
29966
  }
29893
29967
  }
@@ -29931,7 +30005,7 @@ async function inspectFrameworkUpgrade(directory, version2) {
29931
30005
  drift.push({ package: name, source: relative(root, join(location, "package.json")).replaceAll("\\", "/"), declared, installed, issues });
29932
30006
  }
29933
30007
  }
29934
- const registry2 = new URL(process13.env.npm_config_registry ?? "https://registry.npmjs.org/");
30008
+ const registry2 = new URL(process14.env.npm_config_registry ?? "https://registry.npmjs.org/");
29935
30009
  if (registry2.username || registry2.password || registry2.protocol !== "https:")
29936
30010
  throw new Error(cliM("cli_upgrade_registry"));
29937
30011
  const releases = [];
@@ -30004,10 +30078,10 @@ async function inspectFrameworkUpgrade(directory, version2) {
30004
30078
  return { version: version2, releaseComplete: releases.every((item) => item.available), modified: false, releases, drift, skills, dirtyFiles, customizations: { overrides: [.../* @__PURE__ */ new Set([...Object.keys(object3(workspace.overrides)), ...Object.keys(object3(rootManifest.overrides)), ...Object.keys(object3(object3(rootManifest.pnpm).overrides))])], patches: [.../* @__PURE__ */ new Set([...Object.keys(object3(workspace.patchedDependencies)), ...Object.keys(object3(object3(rootManifest.pnpm).patchedDependencies))])] }, migration: { preflight: migrationPreflight, inspectModuleReadmes: true, exclusiveAccess: true, backup: ["database", "shared-session-cache"], rollback: "restore-compatible-database-and-binaries", sessions: "legacy-credential-sessions-require-login" } };
30005
30079
  }
30006
30080
  async function upgradeCommand(version2, options = {}) {
30007
- const report = await inspectFrameworkUpgrade(options.cwd ?? process13.cwd(), version2);
30081
+ const report = await inspectFrameworkUpgrade(options.cwd ?? process14.cwd(), version2);
30008
30082
  writeCliMessage(JSON.stringify(report, null, 2));
30009
30083
  if (!report.releaseComplete)
30010
- process13.exitCode = 1;
30084
+ process14.exitCode = 1;
30011
30085
  }
30012
30086
 
30013
30087
  // src/cli-main.ts
@@ -30032,7 +30106,7 @@ cli.command("create [name]", cliM("cli_help_create")).option("--type <type>", cl
30032
30106
  cwd: options.cwd
30033
30107
  });
30034
30108
  } catch {
30035
- process13.exitCode = 1;
30109
+ process14.exitCode = 1;
30036
30110
  }
30037
30111
  });
30038
30112
  cli.command("add [module]", cliM("cli_help_add")).option("--no-install", cliM("cli_help_noInstall")).action(async (module, options) => {
@@ -30044,7 +30118,7 @@ cli.command("add [module]", cliM("cli_help_add")).option("--no-install", cliM("c
30044
30118
  cwd: options.cwd
30045
30119
  });
30046
30120
  } catch {
30047
- process13.exit(1);
30121
+ process14.exit(1);
30048
30122
  }
30049
30123
  });
30050
30124
  cli.command("init", cliM("cli_help_init")).option("-f, --force", cliM("cli_help_forceConfig")).action(async (options) => {
@@ -30055,7 +30129,7 @@ cli.command("init", cliM("cli_help_init")).option("-f, --force", cliM("cli_help_
30055
30129
  cwd: options.cwd
30056
30130
  });
30057
30131
  } catch {
30058
- process13.exit(1);
30132
+ process14.exit(1);
30059
30133
  }
30060
30134
  });
30061
30135
  cli.command("generate [type] [name]", cliM("cli_help_generate")).option("-w, --workspace <name>", cliM("cli_help_workspace")).alias("g").option("-o, --output <path>", cliM("cli_help_output")).option("-f, --force", cliM("cli_help_force")).action(async (type, name, options) => {
@@ -30070,7 +30144,7 @@ cli.command("generate [type] [name]", cliM("cli_help_generate")).option("-w, --w
30070
30144
  cwd: options.cwd
30071
30145
  });
30072
30146
  } catch {
30073
- process13.exit(1);
30147
+ process14.exit(1);
30074
30148
  }
30075
30149
  });
30076
30150
  cli.command("build", cliM("cli_help_build")).option("--target <target>", cliM("cli_help_target")).option("--images <names>", cliM("cli_help_images")).option("--concurrency <count>", cliM("cli_help_buildConcurrency")).option("--runtime <runtime>", cliM("cli_help_buildRuntime")).option("--network <network>", cliM("cli_help_buildNetwork")).option("--platform <platform>", cliM("cli_help_platform")).option("--arch <arch>", cliM("cli_help_arch")).option("--debug", cliM("cli_help_buildDebug")).option("--sqlite-prebuild-mirror <url>", cliM("cli_help_sqliteMirror")).option("--no-http-proxy", cliM("cli_help_noHttpProxy")).option("-y, --yes", cliM("cli_help_deployYes")).option("--image-source <source>", cliM("cli_help_imageSource")).option("--image-mirrors <mappings>", cliM("cli_help_imageMirrors")).option("--npm-source <source>", cliM("cli_help_npmSource")).option("--npm-registry <url>", cliM("cli_help_npmRegistry")).option("--proxy-mode <mode>", cliM("cli_help_proxyMode")).option("--proxy-url <url>", cliM("cli_help_proxyUrl")).option("--proxy-bypass <hosts>", cliM("cli_help_proxyBypass")).action(async (options) => {
@@ -30078,7 +30152,7 @@ cli.command("build", cliM("cli_help_build")).option("--target <target>", cliM("c
30078
30152
  await buildCommand(options);
30079
30153
  } catch (error62) {
30080
30154
  writeCliMessage(error62 instanceof Error ? error62.message : String(error62));
30081
- process13.exitCode = 1;
30155
+ process14.exitCode = 1;
30082
30156
  }
30083
30157
  });
30084
30158
  cli.command("upgrade <version>", cliM("cli_help_upgrade")).action(async (version2, options) => {
@@ -30086,7 +30160,7 @@ cli.command("upgrade <version>", cliM("cli_help_upgrade")).action(async (version
30086
30160
  await upgradeCommand(version2, options);
30087
30161
  } catch (error62) {
30088
30162
  writeCliMessage(error62 instanceof Error ? error62.message : String(error62));
30089
- process13.exitCode = 1;
30163
+ process14.exitCode = 1;
30090
30164
  }
30091
30165
  });
30092
30166
  cli.command("deploy [appDir]", cliM("cli_help_deploy")).option("--plan", cliM("cli_help_deployPlan")).option("--inspect-remote", cliM("cli_help_inspectRemote")).option("--env <environment>", cliM("cli_help_environment")).option("--env-dir <path>", cliM("cli_help_envDir")).option("-y, --yes", cliM("cli_help_deployYes")).option("--skip-middleware", cliM("cli_help_skipMiddleware")).option("--artifact-dir <path>", cliM("cli_help_artifactDir")).option("--services <names>", cliM("cli_help_services")).option("--build", cliM("cli_help_deployBuild")).option("--concurrency <count>", cliM("cli_help_buildConcurrency")).option("--network <network>", cliM("cli_help_deployNetwork")).option("--sqlite-prebuild-mirror <url>", cliM("cli_help_deploySqliteMirror")).option("--no-http-proxy", cliM("cli_help_deployNoProxy")).option("--image-source <source>", cliM("cli_help_imageSource")).option("--image-mirrors <mappings>", cliM("cli_help_imageMirrors")).option("--npm-source <source>", cliM("cli_help_npmSource")).option("--npm-registry <url>", cliM("cli_help_npmRegistry")).option("--proxy-mode <mode>", cliM("cli_help_proxyMode")).option("--proxy-url <url>", cliM("cli_help_proxyUrl")).option("--proxy-bypass <hosts>", cliM("cli_help_proxyBypass")).option("--runtime <runtime>", cliM("cli_help_deployRuntime")).option("--bundle-only", cliM("cli_help_bundleOnly")).option("--output <path>", cliM("cli_help_bundleOutput")).action(async (appDir, options) => {
@@ -30120,7 +30194,7 @@ cli.command("deploy [appDir]", cliM("cli_help_deploy")).option("--plan", cliM("c
30120
30194
  cwd: options.cwd
30121
30195
  });
30122
30196
  } catch {
30123
- process13.exitCode = 1;
30197
+ process14.exitCode = 1;
30124
30198
  }
30125
30199
  });
30126
30200
  cli.command("deploy-secrets <directory>", cliM("cli_help_deploySecrets")).option("--import <file>", cliM("cli_help_secretImport")).option("--apply", cliM("cli_help_secretApply")).option("--runtime <runtime>", cliM("cli_help_deployRuntime")).action(async (directory, options) => {
@@ -30128,7 +30202,7 @@ cli.command("deploy-secrets <directory>", cliM("cli_help_deploySecrets")).option
30128
30202
  await deploySecretsCommand(directory, options);
30129
30203
  } catch (error62) {
30130
30204
  writeCliMessage(error62 instanceof Error ? error62.message : String(error62));
30131
- process13.exitCode = 1;
30205
+ process14.exitCode = 1;
30132
30206
  }
30133
30207
  });
30134
30208
  cli.command("feedback <action> <bundle>", cliM("cli_help_feedback")).option("--page <number>", cliM("cli_feedback_page")).option("--page-size <number>", cliM("cli_feedback_pageSize")).option("--kind <kind>", cliM("cli_feedback_kind")).option("--request-id <id>", cliM("cli_feedback_requestId")).option("--error-id <id>", cliM("cli_feedback_errorId")).option("--from <timestamp>", cliM("cli_feedback_from")).option("--to <timestamp>", cliM("cli_feedback_to")).option("--port <number>", cliM("cli_feedback_port")).action(async (action, bundle, options) => {
@@ -30147,7 +30221,7 @@ cli.command("feedback <action> <bundle>", cliM("cli_help_feedback")).option("--p
30147
30221
  });
30148
30222
  } catch (error62) {
30149
30223
  writeCliMessage(error62 instanceof Error ? error62.message : String(error62));
30150
- process13.exitCode = 1;
30224
+ process14.exitCode = 1;
30151
30225
  }
30152
30226
  });
30153
30227
  cli.command("g:page <name>", cliM("cli_help_generatePage")).option("-w, --workspace <name>", cliM("cli_help_workspace")).action(async (name, options) => {