teamix-evo 0.18.0 → 0.18.1

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
@@ -8615,9 +8615,17 @@ var STATE_TO_COMMAND = {
8615
8615
  "teamix-evo": "update",
8616
8616
  other: "graft"
8617
8617
  };
8618
- function assertCommandPrecondition(command, state) {
8618
+ var FORCE_BYPASSABLE = {
8619
+ init: /* @__PURE__ */ new Set(["shadcn"]),
8620
+ migrate: /* @__PURE__ */ new Set([]),
8621
+ update: /* @__PURE__ */ new Set([]),
8622
+ graft: /* @__PURE__ */ new Set([])
8623
+ };
8624
+ function assertCommandPrecondition(command, state, options) {
8619
8625
  const expected = VALID_STATES[command];
8620
8626
  if (state === expected) return;
8627
+ const canForce = FORCE_BYPASSABLE[command].has(state);
8628
+ if (options?.force && canForce) return;
8621
8629
  const stateLabel = STATE_LABELS[state];
8622
8630
  const commandLabel = COMMAND_LABELS[command];
8623
8631
  logger.error(
@@ -8628,6 +8636,9 @@ function assertCommandPrecondition(command, state) {
8628
8636
  const suggestionLabel = COMMAND_LABELS[suggestion];
8629
8637
  logger.info(`\u5EFA\u8BAE\u4F7F\u7528\uFF1Ateamix-evo ${suggestion}\uFF08${suggestionLabel}\uFF09`);
8630
8638
  }
8639
+ if (!canForce) {
8640
+ logger.info("--force \u4E0D\u80FD\u7ED5\u8FC7\u6B64\u9650\u5236\u3002");
8641
+ }
8631
8642
  process.exitCode = 1;
8632
8643
  }
8633
8644
 
@@ -9342,10 +9353,8 @@ var initCommand5 = new Command36("init").description(
9342
9353
  "\u5982\u9700\u5347\u7EA7\u5DF2\u5B89\u88C5\u8D44\u4EA7\u5230\u65B0\u7248\u672C\uFF0C\u8BF7\u4F7F\u7528 teamix-evo update\u3002"
9343
9354
  );
9344
9355
  } else if (state.state !== "empty") {
9345
- if (!opts.force) {
9346
- assertCommandPrecondition("init", state.state);
9347
- return;
9348
- }
9356
+ assertCommandPrecondition("init", state.state, { force: opts.force });
9357
+ if (process.exitCode) return;
9349
9358
  }
9350
9359
  const isInteractive = Boolean(process.stdin.isTTY);
9351
9360
  const answers = await runInitWizard({
@@ -10234,14 +10243,19 @@ async function analyzeProject(cwd) {
10234
10243
  const state = await detectProjectState(cwd);
10235
10244
  if (state.state !== "other") {
10236
10245
  assertCommandPrecondition("graft", state.state);
10237
- throw new Error("unreachable");
10246
+ throw new Error("precondition-failed");
10238
10247
  }
10239
10248
  const legacyLib = state.legacyLib ?? "unknown";
10240
10249
  const buildTool = state.buildTool ?? "unknown";
10241
10250
  const legacyVersion = await getLegacyLibVersion(cwd, legacyLib);
10242
10251
  const BUILD_TOOL_CONFIG_CANDIDATES = {
10243
10252
  ice: ["build.json"],
10244
- vite: ["vite.config.ts", "vite.config.js", "vite.config.mts", "vite.config.mjs"],
10253
+ vite: [
10254
+ "vite.config.ts",
10255
+ "vite.config.js",
10256
+ "vite.config.mts",
10257
+ "vite.config.mjs"
10258
+ ],
10245
10259
  webpack: ["webpack.config.js", "webpack.config.ts", "webpack.config.cjs"]
10246
10260
  };
10247
10261
  const buildToolConfig = await findFirst(
@@ -10271,9 +10285,7 @@ function printReport(report) {
10271
10285
  ` \u65E7\u7EC4\u4EF6\u5E93\uFF1A${report.legacyLib.name} (${report.legacyLib.version})`
10272
10286
  );
10273
10287
  logger.info(` \u6784\u5EFA\u5DE5\u5177\uFF1A${report.buildTool.type}`);
10274
- logger.info(
10275
- ` PostCSS \u914D\u7F6E\uFF1A${report.postcssConfig.path ?? "\u672A\u68C0\u6D4B\u5230"}`
10276
- );
10288
+ logger.info(` PostCSS \u914D\u7F6E\uFF1A${report.postcssConfig.path ?? "\u672A\u68C0\u6D4B\u5230"}`);
10277
10289
  logger.info(` App \u5165\u53E3\uFF1A${report.appEntry ?? "\u672A\u68C0\u6D4B\u5230"}`);
10278
10290
  if (report.conflicts.length > 0) {
10279
10291
  logger.info("");
@@ -10283,9 +10295,7 @@ function printReport(report) {
10283
10295
  }
10284
10296
  }
10285
10297
  }
10286
- var graftCommand = new Command39("graft").description(
10287
- "\u53E0\u52A0 Teamix Evo AICoding \u80FD\u529B\u5230\u73B0\u6709\u9879\u76EE\uFF08\u53CC\u6808\u5171\u5B58\uFF0CADR 0047\uFF09"
10288
- ).option("--variant <name>", "\u6307\u5B9A tokens variant\uFF08\u5982 opentrek\uFF09").option("--cwd <dir>", "\u6307\u5B9A\u5DE5\u7A0B\u6839\u76EE\u5F55\uFF08\u9ED8\u8BA4\uFF1A\u5F53\u524D\u76EE\u5F55\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F\u7684\u5206\u6790\u62A5\u544A\uFF08\u4F9B AI skill \u6D88\u8D39\uFF09").option("--apply", "\u6267\u884C graft pipeline\uFF08\u9ED8\u8BA4\u4EC5\u524D\u7F6E\u68C0\u67E5\uFF09").option("-y, --yes", "\u8DF3\u8FC7 --apply \u4E8C\u6B21\u786E\u8BA4").action(async (opts) => {
10298
+ var graftCommand = new Command39("graft").description("\u53E0\u52A0 Teamix Evo AICoding \u80FD\u529B\u5230\u73B0\u6709\u9879\u76EE\uFF08\u53CC\u6808\u5171\u5B58\uFF0CADR 0047\uFF09").option("--variant <name>", "\u6307\u5B9A tokens variant\uFF08\u5982 opentrek\uFF09").option("--cwd <dir>", "\u6307\u5B9A\u5DE5\u7A0B\u6839\u76EE\u5F55\uFF08\u9ED8\u8BA4\uFF1A\u5F53\u524D\u76EE\u5F55\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F\u7684\u5206\u6790\u62A5\u544A\uFF08\u4F9B AI skill \u6D88\u8D39\uFF09").option("--apply", "\u6267\u884C graft pipeline\uFF08\u9ED8\u8BA4\u4EC5\u524D\u7F6E\u68C0\u67E5\uFF09").option("-y, --yes", "\u8DF3\u8FC7 --apply \u4E8C\u6B21\u786E\u8BA4").action(async (opts) => {
10289
10299
  const cwd = path45.resolve(opts.cwd ?? process.cwd());
10290
10300
  const apply = opts.apply ?? false;
10291
10301
  try {
@@ -10357,9 +10367,11 @@ var graftCommand = new Command39("graft").description(
10357
10367
  process.exitCode = 1;
10358
10368
  }
10359
10369
  } catch (err) {
10360
- logger.error(`graft \u5931\u8D25\uFF1A${getErrorMessage(err)}`);
10361
- logger.debug(err.stack ?? "");
10362
- process.exitCode = 1;
10370
+ if (getErrorMessage(err) !== "precondition-failed") {
10371
+ logger.error(`graft \u5931\u8D25\uFF1A${getErrorMessage(err)}`);
10372
+ logger.debug(err.stack ?? "");
10373
+ process.exitCode = 1;
10374
+ }
10363
10375
  }
10364
10376
  });
10365
10377