@h-ai/cli 0.1.0-alpha.58 → 0.1.0-alpha.59

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/index.js CHANGED
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import { generateConfigFile } from './chunk-WUSFJFW5.js';
3
- import { cliM } from './chunk-F4IBPVZ5.js';
3
+ import { cliM } from './chunk-WWG3U5ZD.js';
4
4
  import './chunk-2H7UOFLK.js';
5
- import process3 from 'process';
6
- import { core } from '@h-ai/core';
5
+ import process4 from 'process';
7
6
  import { cac } from 'cac';
8
7
  import chalk from 'chalk';
9
8
  import path2, { resolve } from 'path';
10
9
  import { fileURLToPath } from 'url';
10
+ import { wrapAnsi } from 'fast-wrap-ansi';
11
11
  import fse from 'fs-extra';
12
12
  import Handlebars2 from 'handlebars';
13
+ import { core } from '@h-ai/core';
13
14
  import ora from 'ora';
14
15
  import prompts from 'prompts';
15
16
  import { Buffer } from 'buffer';
@@ -20,6 +21,20 @@ import { existsSync, readFileSync } from 'fs';
20
21
 
21
22
  var CAMEL_CASE_SEPARATOR_REGEX = /[-_\s]+(.)?/g;
22
23
  var LEADING_CHAR_REGEX = /^./;
24
+ function writeCliMessage(message) {
25
+ process4.stdout.write(`${message}
26
+ `);
27
+ }
28
+ function writeCliError(message, error) {
29
+ process4.stderr.write(`${message}
30
+ `);
31
+ if (error !== void 0)
32
+ process4.stderr.write(`${error instanceof Error ? error.message : String(error)}
33
+ `);
34
+ }
35
+ function formatPromptDescription(description) {
36
+ return wrapAnsi(description, Math.max(1, (process4.stdout.columns || 80) - 32), { hard: true });
37
+ }
23
38
  function toCamelCase(str) {
24
39
  return str.replace(CAMEL_CASE_SEPARATOR_REGEX, (_, c) => c ? c.toUpperCase() : "").replace(LEADING_CHAR_REGEX, (c) => c.toLowerCase());
25
40
  }
@@ -177,7 +192,7 @@ var IMPLEMENTED_FRONTENDS = ["web", "app", "desktop"];
177
192
  var DEFAULT_FULLSTACK_FRONTENDS = ["web", "app", "desktop"];
178
193
  var DEFAULT_THEMES = ["light", "dark"];
179
194
  var DEFAULT_THEME_NAME = "light";
180
- var HAI_PACKAGE_VERSION = `^${getCliVersion()}`;
195
+ var HAI_PACKAGE_VERSION = getCliVersion();
181
196
  var HAI_PACKAGE_SPECIFIER_CATALOG = "catalog:";
182
197
  var HAI_CATALOG_PACKAGE_NAMES = [
183
198
  "@h-ai/ai",
@@ -1069,7 +1084,7 @@ async function createProject(options) {
1069
1084
  try {
1070
1085
  const resolvedOptions = await resolveOptions(options);
1071
1086
  if (!PROJECT_NAME_REGEX.test(resolvedOptions.name)) {
1072
- core.logger.error(chalk.red(`\u9879\u76EE\u540D\u79F0\u4E0D\u5408\u6CD5: "${resolvedOptions.name}"\uFF0C\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26`));
1087
+ writeCliError(chalk.red(`\u9879\u76EE\u540D\u79F0\u4E0D\u5408\u6CD5: "${resolvedOptions.name}"\uFF0C\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26`));
1073
1088
  return;
1074
1089
  }
1075
1090
  const projectPath = path2.resolve(resolvedOptions.cwd ?? ".", resolvedOptions.name);
@@ -1081,7 +1096,7 @@ async function createProject(options) {
1081
1096
  initial: false
1082
1097
  });
1083
1098
  if (!overwrite) {
1084
- core.logger.info(chalk.yellow("\u5DF2\u53D6\u6D88"));
1099
+ writeCliMessage(chalk.yellow("\u5DF2\u53D6\u6D88"));
1085
1100
  return;
1086
1101
  }
1087
1102
  await fse.remove(projectPath);
@@ -1138,7 +1153,7 @@ PUBLIC_API_BASE=http://127.0.0.1:3000
1138
1153
  `), { mode: 384 });
1139
1154
  }
1140
1155
  }
1141
- const { generateSkillFiles } = await import('./cli-skill-templates-45CK4RQ2.js');
1156
+ const { generateSkillFiles } = await import('./cli-skill-templates-2KDUACT6.js');
1142
1157
  await generateSkillFiles(
1143
1158
  projectPath,
1144
1159
  resolvedOptions.features,
@@ -1173,19 +1188,19 @@ PUBLIC_API_BASE=http://127.0.0.1:3000
1173
1188
  printCompletionMessage(resolvedOptions);
1174
1189
  } catch (error) {
1175
1190
  spinner.fail();
1176
- core.logger.error(chalk.red("\u521B\u5EFA\u9879\u76EE\u5931\u8D25:"), { error });
1191
+ writeCliError(chalk.red(cliM("cli_createFailed")), error);
1177
1192
  throw error;
1178
1193
  }
1179
1194
  }
1180
1195
  async function resolveOptions(options) {
1181
1196
  const useDefaults = options.yes ?? false;
1182
- core.logger.info("", {});
1183
- core.logger.info(chalk.bold.cyan(" \u{1F680} hai Agent Framework"));
1184
- core.logger.info(chalk.gray(" AI-Native \xB7 Configuration-Driven \xB7 Security-First"));
1185
- core.logger.info("", {});
1197
+ writeCliMessage("");
1198
+ writeCliMessage(chalk.bold.cyan(" \u{1F680} hai Agent Framework"));
1199
+ writeCliMessage(chalk.gray(" AI-Native \xB7 Configuration-Driven \xB7 Security-First"));
1200
+ writeCliMessage("");
1186
1201
  const onCancel = () => {
1187
- core.logger.info(chalk.red("\n\u5DF2\u53D6\u6D88"));
1188
- process3.exit(1);
1202
+ writeCliMessage(chalk.red("\n\u5DF2\u53D6\u6D88"));
1203
+ process4.exit(1);
1189
1204
  };
1190
1205
  let projectName = options.name;
1191
1206
  if (!projectName && useDefaults) {
@@ -1214,8 +1229,10 @@ async function resolveOptions(options) {
1214
1229
  type: "select",
1215
1230
  name: "appType",
1216
1231
  message: "\u5E94\u7528\u7C7B\u578B:",
1232
+ hint: cliM("cli_selectHint"),
1217
1233
  choices: Object.entries(APP_TYPES).map(([key, t]) => ({
1218
- title: `${chalk.bold(t.name.padEnd(10))} ${chalk.gray(t.description)}`,
1234
+ title: t.name,
1235
+ description: formatPromptDescription(t.description),
1219
1236
  value: key
1220
1237
  })),
1221
1238
  initial: 0
@@ -1235,8 +1252,10 @@ async function resolveOptions(options) {
1235
1252
  type: "select",
1236
1253
  name: "template",
1237
1254
  message: "\u9009\u62E9\u6A21\u677F:",
1255
+ hint: cliM("cli_selectHint"),
1238
1256
  choices: Object.values(PROJECT_TEMPLATES).map((t) => ({
1239
- title: `${chalk.bold(t.name.padEnd(10))} ${chalk.gray(t.description)}`,
1257
+ title: t.name,
1258
+ description: formatPromptDescription(t.description),
1240
1259
  value: t.name
1241
1260
  })),
1242
1261
  initial: 1
@@ -1252,16 +1271,17 @@ async function resolveOptions(options) {
1252
1271
  selectedFeatures = resolveFeatureDependencies(appTypeDefaults);
1253
1272
  } else if (selectedTemplate === "custom" && !options.features) {
1254
1273
  const featureChoices = SELECTABLE_FEATURES.map((id) => ({
1255
- title: `${chalk.bold(FEATURES[id].name.padEnd(10))} ${chalk.gray(FEATURES[id].description)}`,
1274
+ title: FEATURES[id].name,
1275
+ description: formatPromptDescription(FEATURES[id].description),
1256
1276
  value: id,
1257
1277
  selected: appTypeDefaults.includes(id)
1258
1278
  }));
1259
1279
  const { features } = await prompts({
1260
1280
  type: "multiselect",
1261
1281
  name: "features",
1262
- message: "\u9009\u62E9\u529F\u80FD (\u7A7A\u683C\u9009\u62E9\uFF0C\u56DE\u8F66\u786E\u8BA4):",
1282
+ message: cliM("cli_featuresPrompt"),
1263
1283
  choices: featureChoices,
1264
- hint: "- \u7A7A\u683C\u9009\u62E9\uFF0C\u56DE\u8F66\u786E\u8BA4",
1284
+ hint: cliM("cli_multiselectHint"),
1265
1285
  instructions: false
1266
1286
  }, { onCancel });
1267
1287
  selectedFeatures = features || [];
@@ -1396,13 +1416,14 @@ async function resolveFrontendTargets(frontends, useDefaults, onCancel) {
1396
1416
  const { selectedFrontends } = await prompts({
1397
1417
  type: "multiselect",
1398
1418
  name: "selectedFrontends",
1399
- message: "\u9009\u62E9\u524D\u7AEF\u76EE\u6807 (\u7A7A\u683C\u9009\u62E9\uFF0C\u56DE\u8F66\u786E\u8BA4):",
1419
+ message: cliM("cli_frontendsPrompt"),
1400
1420
  choices: Object.entries(FRONTEND_TARGETS).map(([id, target]) => ({
1401
- title: `${chalk.bold(target.name.padEnd(8))} ${chalk.gray(target.description)}`,
1421
+ title: target.name,
1422
+ description: formatPromptDescription(target.description),
1402
1423
  value: id,
1403
1424
  selected: DEFAULT_FULLSTACK_FRONTENDS2.includes(id)
1404
1425
  })),
1405
- hint: "- \u5C0F\u7A0B\u5E8F\u5F53\u524D\u4E3A\u9884\u7559\u5360\u4F4D\uFF0C\u4E0D\u751F\u6210\u53EF\u8FD0\u884C\u5DE5\u7A0B",
1426
+ hint: cliM("cli_multiselectHint"),
1406
1427
  instructions: false
1407
1428
  }, { onCancel });
1408
1429
  return normalizeFrontendTargets(selectedFrontends ?? DEFAULT_FULLSTACK_FRONTENDS2);
@@ -1434,13 +1455,13 @@ function resolveFeatureDependencies(features) {
1434
1455
  async function promptModuleConfigs(features, projectName) {
1435
1456
  const configs = {};
1436
1457
  const onCancel = () => {
1437
- core.logger.info(chalk.red("\n\u5DF2\u53D6\u6D88"));
1438
- process3.exit(1);
1458
+ writeCliMessage(chalk.red("\n\u5DF2\u53D6\u6D88"));
1459
+ process4.exit(1);
1439
1460
  };
1440
- core.logger.info("");
1441
- core.logger.info(chalk.bold(" \u2699 \u6A21\u5757\u914D\u7F6E"));
1442
- core.logger.info(chalk.gray(" \u8BBE\u7F6E\u5173\u952E\u914D\u7F6E\u9879\uFF08\u56DE\u8F66\u4F7F\u7528\u9ED8\u8BA4\u503C\uFF09"));
1443
- core.logger.info("");
1461
+ writeCliMessage("");
1462
+ writeCliMessage(chalk.bold(" \u2699 \u6A21\u5757\u914D\u7F6E"));
1463
+ writeCliMessage(chalk.gray(" \u8BBE\u7F6E\u5173\u952E\u914D\u7F6E\u9879\uFF08\u56DE\u8F66\u4F7F\u7528\u9ED8\u8BA4\u503C\uFF09"));
1464
+ writeCliMessage("");
1444
1465
  configs.core = await promptCoreConfig(projectName, onCancel);
1445
1466
  if (features.includes("db")) {
1446
1467
  configs.db = await promptDbConfig(projectName, onCancel);
@@ -1460,7 +1481,7 @@ async function promptModuleConfigs(features, projectName) {
1460
1481
  return configs;
1461
1482
  }
1462
1483
  async function promptCoreConfig(projectName, onCancel) {
1463
- core.logger.info(chalk.cyan(" [core] \u5E94\u7528\u57FA\u7840\u914D\u7F6E"));
1484
+ writeCliMessage(chalk.cyan(" [core] \u5E94\u7528\u57FA\u7840\u914D\u7F6E"));
1464
1485
  const { defaultLocale } = await prompts({
1465
1486
  type: "select",
1466
1487
  name: "defaultLocale",
@@ -1474,7 +1495,7 @@ async function promptCoreConfig(projectName, onCancel) {
1474
1495
  return { name: projectName, defaultLocale };
1475
1496
  }
1476
1497
  async function promptDbConfig(projectName, onCancel) {
1477
- core.logger.info(chalk.cyan(" [db] \u6570\u636E\u5E93\u914D\u7F6E"));
1498
+ writeCliMessage(chalk.cyan(" [db] \u6570\u636E\u5E93\u914D\u7F6E"));
1478
1499
  const { type } = await prompts({
1479
1500
  type: "select",
1480
1501
  name: "type",
@@ -1503,7 +1524,7 @@ async function promptDbConfig(projectName, onCancel) {
1503
1524
  return { type, host: answers.host, port: answers.port, database: answers.database };
1504
1525
  }
1505
1526
  async function promptCacheConfig(onCancel) {
1506
- core.logger.info(chalk.cyan(" [cache] \u7F13\u5B58\u914D\u7F6E"));
1527
+ writeCliMessage(chalk.cyan(" [cache] \u7F13\u5B58\u914D\u7F6E"));
1507
1528
  const { type } = await prompts({
1508
1529
  type: "select",
1509
1530
  name: "type",
@@ -1523,7 +1544,7 @@ async function promptCacheConfig(onCancel) {
1523
1544
  return { type, host: answers.host, port: answers.port };
1524
1545
  }
1525
1546
  async function promptIamConfig(onCancel) {
1526
- core.logger.info(chalk.cyan(" [iam] \u8BA4\u8BC1\u6388\u6743\u914D\u7F6E"));
1547
+ writeCliMessage(chalk.cyan(" [iam] \u8BA4\u8BC1\u6388\u6743\u914D\u7F6E"));
1527
1548
  const answers = await prompts([
1528
1549
  { type: "confirm", name: "loginPassword", message: "\u542F\u7528\u5BC6\u7801\u767B\u5F55?", initial: true },
1529
1550
  { type: "confirm", name: "loginOtp", message: "\u542F\u7528 OTP \u9A8C\u8BC1\u7801\u767B\u5F55?", initial: false }
@@ -1531,7 +1552,7 @@ async function promptIamConfig(onCancel) {
1531
1552
  return { loginPassword: answers.loginPassword, loginOtp: answers.loginOtp };
1532
1553
  }
1533
1554
  async function promptStorageConfig(onCancel) {
1534
- core.logger.info(chalk.cyan(" [storage] \u6587\u4EF6\u5B58\u50A8\u914D\u7F6E"));
1555
+ writeCliMessage(chalk.cyan(" [storage] \u6587\u4EF6\u5B58\u50A8\u914D\u7F6E"));
1535
1556
  const { type } = await prompts({
1536
1557
  type: "select",
1537
1558
  name: "type",
@@ -1554,7 +1575,7 @@ async function promptStorageConfig(onCancel) {
1554
1575
  return { type };
1555
1576
  }
1556
1577
  async function promptAiConfig(onCancel) {
1557
- core.logger.info(chalk.cyan(" [ai] AI \u96C6\u6210\u914D\u7F6E"));
1578
+ writeCliMessage(chalk.cyan(" [ai] AI \u96C6\u6210\u914D\u7F6E"));
1558
1579
  const { defaultProvider } = await prompts({
1559
1580
  type: "select",
1560
1581
  name: "defaultProvider",
@@ -1615,21 +1636,21 @@ function installDependencies(projectPath, pm) {
1615
1636
  });
1616
1637
  } catch (error) {
1617
1638
  const details = formatCommandFailure(installCmd, error);
1618
- throw new Error(`\u5B89\u88C5\u4F9D\u8D56\u5931\u8D25\uFF08${pm}\uFF09\u3002
1639
+ throw new Error(`${cliM("cli_installFailed", { params: { pm } })}
1619
1640
  ${details}`);
1620
1641
  }
1621
1642
  }
1622
1643
  function formatCommandFailure(command, error) {
1623
1644
  if (!error || typeof error !== "object") {
1624
- return `\u547D\u4EE4: ${command}`;
1645
+ return cliM("cli_commandLabel", { params: { command } });
1625
1646
  }
1626
1647
  const failure = error;
1627
1648
  const stdout = normalizeChildOutput(failure.stdout);
1628
1649
  const stderr = normalizeChildOutput(failure.stderr);
1629
- const status = typeof failure.status === "number" ? `\u9000\u51FA\u7801: ${failure.status}` : "";
1630
- const signal = typeof failure.signal === "string" ? `\u4FE1\u53F7: ${failure.signal}` : "";
1650
+ const status = typeof failure.status === "number" ? cliM("cli_exitCode", { params: { code: failure.status } }) : "";
1651
+ const signal = typeof failure.signal === "string" ? cliM("cli_signal", { params: { signal: failure.signal } }) : "";
1631
1652
  const output = [
1632
- `\u547D\u4EE4: ${command}`,
1653
+ cliM("cli_commandLabel", { params: { command } }),
1633
1654
  status,
1634
1655
  signal,
1635
1656
  stderr ? `stderr:
@@ -1964,35 +1985,35 @@ ${generateAiDevelopmentReadme()}## \u6587\u6863
1964
1985
  `;
1965
1986
  }
1966
1987
  function printCompletionMessage(options) {
1967
- core.logger.info("", {});
1968
- core.logger.info(chalk.green("\u2714 \u9879\u76EE\u521B\u5EFA\u6210\u529F\uFF01"));
1969
- core.logger.info("", {});
1988
+ writeCliMessage("");
1989
+ writeCliMessage(chalk.green("\u2714 \u9879\u76EE\u521B\u5EFA\u6210\u529F\uFF01"));
1990
+ writeCliMessage("");
1970
1991
  if (options.features.length > 0) {
1971
- core.logger.info(chalk.bold("\u5DF2\u542F\u7528\u529F\u80FD:"));
1992
+ writeCliMessage(chalk.bold("\u5DF2\u542F\u7528\u529F\u80FD:"));
1972
1993
  for (const featureId of options.features) {
1973
1994
  const feature = FEATURES[featureId];
1974
1995
  if (feature) {
1975
- core.logger.info(chalk.gray(` \u2022 ${feature.name} (${featureId})`));
1996
+ writeCliMessage(chalk.gray(` \u2022 ${feature.name} (${featureId})`));
1976
1997
  }
1977
1998
  }
1978
- core.logger.info("", {});
1999
+ writeCliMessage("");
1979
2000
  }
1980
- core.logger.info("\u4E0B\u4E00\u6B65\uFF1A");
1981
- core.logger.info(chalk.cyan(` cd ${options.name}`));
2001
+ writeCliMessage("\u4E0B\u4E00\u6B65\uFF1A");
2002
+ writeCliMessage(chalk.cyan(` cd ${options.name}`));
1982
2003
  if (options.appType === "fullstack")
1983
- core.logger.info(chalk.cyan(cliM("cli_adminPasswordSaved")));
2004
+ writeCliMessage(chalk.cyan(cliM("cli_adminPasswordSaved")));
1984
2005
  if (!options.install) {
1985
- core.logger.info(chalk.cyan(` ${getInstallCommand(options.packageManager)}`));
2006
+ writeCliMessage(chalk.cyan(` ${getInstallCommand(options.packageManager)}`));
1986
2007
  }
1987
2008
  if (options.appType === "fullstack" || options.appType === "api") {
1988
- core.logger.info(chalk.cyan(` ${getRunCommand(options.packageManager, "dev")}`));
1989
- core.logger.info(chalk.cyan(` ${getRunCommand(options.packageManager, "typecheck")}`));
1990
- core.logger.info(chalk.cyan(` ${getRunCommand(options.packageManager, "test")}`));
1991
- core.logger.info(chalk.cyan(` ${getRunCommand(options.packageManager, "test:e2e")}`));
2009
+ writeCliMessage(chalk.cyan(` ${getRunCommand(options.packageManager, "dev")}`));
2010
+ writeCliMessage(chalk.cyan(` ${getRunCommand(options.packageManager, "typecheck")}`));
2011
+ writeCliMessage(chalk.cyan(` ${getRunCommand(options.packageManager, "test")}`));
2012
+ writeCliMessage(chalk.cyan(` ${getRunCommand(options.packageManager, "test:e2e")}`));
1992
2013
  } else {
1993
- core.logger.info(chalk.cyan(` ${getRunCommand(options.packageManager, "dev")}`));
2014
+ writeCliMessage(chalk.cyan(` ${getRunCommand(options.packageManager, "dev")}`));
1994
2015
  }
1995
- core.logger.info("", {});
2016
+ writeCliMessage("");
1996
2017
  }
1997
2018
  async function detectProject(cwd) {
1998
2019
  const pkgPath = path2.join(cwd, "package.json");
@@ -2074,7 +2095,7 @@ async function addModule(options) {
2074
2095
  core.logger.info(`\u53EF\u7528\u6A21\u5757: ${Object.keys(MODULE_MAP).join(", ")}`);
2075
2096
  return;
2076
2097
  }
2077
- const { generateProjectAiSupport, resolveSkillNamesForPackages } = await import('./cli-skill-templates-45CK4RQ2.js');
2098
+ const { generateProjectAiSupport, resolveSkillNamesForPackages } = await import('./cli-skill-templates-2KDUACT6.js');
2078
2099
  if (moduleDef.packages.every((p) => project.haiPackages.includes(p))) {
2079
2100
  const generatedFiles2 = await generateProjectAiSupport(
2080
2101
  cwd,
@@ -2111,7 +2132,7 @@ async function addModule(options) {
2111
2132
  if (!pkg.dependencies)
2112
2133
  pkg.dependencies = {};
2113
2134
  const existingHaiSpecifier = Object.entries(pkg.dependencies).find(([pkgName]) => pkgName.startsWith("@h-ai/"))?.[1];
2114
- const depVersion = existingHaiSpecifier === "catalog:" ? "catalog:" : `^${getCliVersion()}`;
2135
+ const depVersion = existingHaiSpecifier === "catalog:" ? "catalog:" : getCliVersion();
2115
2136
  for (const pkgName of allPackages) {
2116
2137
  if (!pkg.dependencies[pkgName]) {
2117
2138
  pkg.dependencies[pkgName] = depVersion;
@@ -2182,7 +2203,7 @@ async function addModule(options) {
2182
2203
  }
2183
2204
  async function deployCommand(options) {
2184
2205
  const spinner = ora();
2185
- const cwd = options.cwd ?? process3.cwd();
2206
+ const cwd = options.cwd ?? process4.cwd();
2186
2207
  const appDir = resolve(cwd, options.appDir ?? ".");
2187
2208
  let closeDeploy = null;
2188
2209
  try {
@@ -2258,14 +2279,14 @@ async function deployCommand(options) {
2258
2279
  await closeDeploy();
2259
2280
  } catch (error) {
2260
2281
  core.logger.error("Failed to close deploy module", { error });
2261
- process3.exitCode = 1;
2282
+ process4.exitCode = 1;
2262
2283
  }
2263
2284
  }
2264
2285
  }
2265
2286
  }
2266
2287
  function interpolateEnvFallback(content) {
2267
2288
  return content.replace(/\$\{([^:}]+)(?::([^}]*))?\}/g, (_match, key, defaultValue) => {
2268
- return process3.env[key] ?? defaultValue ?? "";
2289
+ return process4.env[key] ?? defaultValue ?? "";
2269
2290
  });
2270
2291
  }
2271
2292
  var GENERATORS = {
@@ -2609,7 +2630,7 @@ async function initProject(options) {
2609
2630
  const { project, existing, missing } = result;
2610
2631
  spinner.succeed(`\u68C0\u6D4B\u5230\u9879\u76EE: ${chalk.cyan(project.name)}`);
2611
2632
  if (project.isHaiProject) {
2612
- const { generateProjectAiSupport, resolveSkillNamesForPackages } = await import('./cli-skill-templates-45CK4RQ2.js');
2633
+ const { generateProjectAiSupport, resolveSkillNamesForPackages } = await import('./cli-skill-templates-2KDUACT6.js');
2613
2634
  const generatedFiles = await generateProjectAiSupport(cwd, resolveSkillNamesForPackages(project.haiPackages), {
2614
2635
  overwriteSkills: false,
2615
2636
  overwriteBridgeFiles: false
@@ -2713,7 +2734,7 @@ cli.command("create [name]", "\u521B\u5EFA\u65B0\u7684 hai \u9879\u76EE").option
2713
2734
  cwd: options.cwd
2714
2735
  });
2715
2736
  } catch {
2716
- process3.exit(1);
2737
+ process4.exitCode = 1;
2717
2738
  }
2718
2739
  });
2719
2740
  cli.command("add [module]", "\u5411\u73B0\u6709\u9879\u76EE\u6DFB\u52A0\u6A21\u5757").option("--no-install", "\u4E0D\u5B89\u88C5\u4F9D\u8D56").action(async (module, options) => {
@@ -2725,7 +2746,7 @@ cli.command("add [module]", "\u5411\u73B0\u6709\u9879\u76EE\u6DFB\u52A0\u6A21\u5
2725
2746
  cwd: options.cwd
2726
2747
  });
2727
2748
  } catch {
2728
- process3.exit(1);
2749
+ process4.exit(1);
2729
2750
  }
2730
2751
  });
2731
2752
  cli.command("init", "\u521D\u59CB\u5316/\u6821\u9A8C\u9879\u76EE\u914D\u7F6E").option("-f, --force", "\u5F3A\u5236\u91CD\u65B0\u751F\u6210\u914D\u7F6E").action(async (options) => {
@@ -2736,7 +2757,7 @@ cli.command("init", "\u521D\u59CB\u5316/\u6821\u9A8C\u9879\u76EE\u914D\u7F6E").o
2736
2757
  cwd: options.cwd
2737
2758
  });
2738
2759
  } catch {
2739
- process3.exit(1);
2760
+ process4.exit(1);
2740
2761
  }
2741
2762
  });
2742
2763
  cli.command("generate [type] [name]", "\u751F\u6210\u4EE3\u7801").alias("g").option("-o, --output <path>", "\u8F93\u51FA\u8DEF\u5F84").option("-f, --force", "\u8986\u76D6\u73B0\u6709\u6587\u4EF6").action(async (type, name, options) => {
@@ -2750,7 +2771,7 @@ cli.command("generate [type] [name]", "\u751F\u6210\u4EE3\u7801").alias("g").opt
2750
2771
  cwd: options.cwd
2751
2772
  });
2752
2773
  } catch {
2753
- process3.exit(1);
2774
+ process4.exit(1);
2754
2775
  }
2755
2776
  });
2756
2777
  cli.command("deploy [appDir]", "\u90E8\u7F72\u5E94\u7528\u5230\u4E91\u5E73\u53F0").option("--project-name <name>", "\u9879\u76EE\u540D\u79F0\uFF08\u9ED8\u8BA4\u4ECE package.json \u8BFB\u53D6\uFF09").option("--skip-provision", "\u8DF3\u8FC7\u57FA\u7840\u8BBE\u65BD\u5F00\u901A").option("--skip-build", "\u8DF3\u8FC7\u6784\u5EFA").action(async (appDir, options) => {
@@ -2764,7 +2785,7 @@ cli.command("deploy [appDir]", "\u90E8\u7F72\u5E94\u7528\u5230\u4E91\u5E73\u53F0
2764
2785
  cwd: options.cwd
2765
2786
  });
2766
2787
  } catch {
2767
- process3.exit(1);
2788
+ process4.exit(1);
2768
2789
  }
2769
2790
  });
2770
2791
  cli.command("g:page <name>", "\u751F\u6210\u9875\u9762").action(async (name, options) => {
@@ -2783,9 +2804,9 @@ cli.version(VERSION);
2783
2804
  cli.help();
2784
2805
  var parsed = cli.parse();
2785
2806
  if (!cli.matchedCommand && !parsed.options.help && !parsed.options.version) {
2786
- core.logger.info("", {});
2787
- core.logger.info(chalk.cyan("hai Agent Framework CLI"));
2788
- core.logger.info("", {});
2807
+ writeCliMessage("");
2808
+ writeCliMessage(chalk.cyan("hai Agent Framework CLI"));
2809
+ writeCliMessage("");
2789
2810
  cli.outputHelp();
2790
2811
  }
2791
2812
  //# sourceMappingURL=index.js.map