@taptap/maker 0.0.14 → 0.0.15

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/README.md CHANGED
@@ -26,4 +26,4 @@ This package contains only the Maker CLI/MCP bundle and Maker workflow skills.
26
26
  It does not include the legacy TapTap Open API MCP server, proxy, native signer,
27
27
  or OpenClaw plugin package contents.
28
28
 
29
- Version: 0.0.14
29
+ Version: 0.0.15
package/dist/maker.js CHANGED
@@ -31293,6 +31293,16 @@ function checkMakerPythonEnvironment(options = {}) {
31293
31293
  if (fallbackEnvironment) {
31294
31294
  return fallbackEnvironment;
31295
31295
  }
31296
+ if ((saved == null ? void 0 : saved.status) === "setup_failed") {
31297
+ return {
31298
+ ...base,
31299
+ ready: false,
31300
+ status: "setup_failed",
31301
+ missing: ["python"],
31302
+ error: saved.error,
31303
+ nextAction: "上次 Python 环境准备失败。请检查网络、代理或目录权限后重试 `taptap-maker python setup`;也可以自行安装 Python 3.12 并确保 pip 可用。"
31304
+ };
31305
+ }
31296
31306
  const status = sawWindowsStoreAlias ? "store_alias_only" : "missing";
31297
31307
  return {
31298
31308
  ...base,
@@ -31300,7 +31310,7 @@ function checkMakerPythonEnvironment(options = {}) {
31300
31310
  status,
31301
31311
  missing: ["python"],
31302
31312
  error: status === "store_alias_only" ? "Only Windows Store Python app execution aliases were found." : unsupportedSystemPython ? `Apple/Xcode Python was found at ${unsupportedSystemPython}, but Maker needs a private or user-managed Python toolchain for diagnostics.` : void 0,
31303
- nextAction: status === "store_alias_only" ? "检测到 Windows Store Python alias,但这不是真实 Python。请运行 `taptap-maker python setup` 自动准备 Maker 私有 Python。" : "未检测到可用 Python。请运行 `taptap-maker python setup` 自动准备 Maker 私有 Python。"
31313
+ nextAction: status === "store_alias_only" ? "检测到 Windows Store Python alias,但这不是真实 Python。请运行 `taptap-maker python setup` 准备 Python 环境。" : "未检测到可用 Python。请运行 `taptap-maker python setup` 准备 Python 环境。"
31304
31314
  };
31305
31315
  }
31306
31316
  function setupMakerPythonEnvironment(options = {}) {
@@ -31311,44 +31321,52 @@ function setupMakerPythonEnvironment(options = {}) {
31311
31321
  }
31312
31322
  const platform = options.platform || process.platform;
31313
31323
  const runner = options.spawn || spawnSync4;
31314
- const uvPath = ensureUvInstalled(platform, runner);
31315
- const uvEnv = createUvPythonEnv();
31316
- const install = runner(
31317
- uvPath,
31318
- ["python", "install", DEFAULT_PYTHON_VERSION, "--managed-python"],
31319
- {
31324
+ try {
31325
+ const uvPath = ensureUvInstalled(platform, runner);
31326
+ const uvEnv = createUvPythonEnv();
31327
+ const install = runner(
31328
+ uvPath,
31329
+ ["python", "install", DEFAULT_PYTHON_VERSION, "--managed-python"],
31330
+ {
31331
+ encoding: "utf8",
31332
+ env: uvEnv
31333
+ }
31334
+ );
31335
+ if (install.status !== 0) {
31336
+ throw new Error(formatSetupFailure("uv python install failed", install));
31337
+ }
31338
+ const find = runner(uvPath, ["python", "find", DEFAULT_PYTHON_VERSION], {
31320
31339
  encoding: "utf8",
31321
31340
  env: uvEnv
31341
+ });
31342
+ if (find.status !== 0 || !find.stdout.trim()) {
31343
+ throw new Error(formatSetupFailure("uv python find failed", find));
31344
+ }
31345
+ const python = find.stdout.trim().split(/\r?\n/)[0];
31346
+ const result = inspectPythonCandidate({ provider: "uv-managed", command: python }, runner);
31347
+ if (!(result == null ? void 0 : result.pipVersion)) {
31348
+ throw new Error("Python 3.12 was installed, but pip is not available.");
31349
+ }
31350
+ const environment = resultToEnvironment(result, {
31351
+ platform,
31352
+ configPath: getMakerPythonConfigPath(),
31353
+ setupCommand: "taptap-maker python setup",
31354
+ pathCommand: "taptap-maker python path",
31355
+ uv: {
31356
+ path: uvPath,
31357
+ installed: true,
31358
+ version: readUvVersion(uvPath, runner)
31359
+ }
31360
+ });
31361
+ savePythonRuntimeConfig(environment);
31362
+ return { changed: true, environment, uvInstalled: true };
31363
+ } catch (error2) {
31364
+ try {
31365
+ savePythonSetupFailure(error2);
31366
+ } catch {
31322
31367
  }
31323
- );
31324
- if (install.status !== 0) {
31325
- throw new Error(formatSetupFailure("uv python install failed", install));
31326
- }
31327
- const find = runner(uvPath, ["python", "find", DEFAULT_PYTHON_VERSION], {
31328
- encoding: "utf8",
31329
- env: uvEnv
31330
- });
31331
- if (find.status !== 0 || !find.stdout.trim()) {
31332
- throw new Error(formatSetupFailure("uv python find failed", find));
31333
- }
31334
- const python = find.stdout.trim().split(/\r?\n/)[0];
31335
- const result = inspectPythonCandidate({ provider: "uv-managed", command: python }, runner);
31336
- if (!(result == null ? void 0 : result.pipVersion)) {
31337
- throw new Error("uv managed Python was installed, but pip is not available.");
31368
+ throw error2;
31338
31369
  }
31339
- const environment = resultToEnvironment(result, {
31340
- platform,
31341
- configPath: getMakerPythonConfigPath(),
31342
- setupCommand: "taptap-maker python setup",
31343
- pathCommand: "taptap-maker python path",
31344
- uv: {
31345
- path: uvPath,
31346
- installed: true,
31347
- version: readUvVersion(uvPath, runner)
31348
- }
31349
- });
31350
- savePythonRuntimeConfig(environment);
31351
- return { changed: true, environment, uvInstalled: true };
31352
31370
  }
31353
31371
  function formatMakerPythonEnvironmentStatus(environment) {
31354
31372
  return [
@@ -31429,7 +31447,7 @@ function resultToEnvironment(result, base) {
31429
31447
  pipVersion: result.pipVersion,
31430
31448
  missing: [`python>=${MINIMUM_PYTHON_VERSION}`],
31431
31449
  error: `Python ${result.version} is below the minimum supported ${MINIMUM_PYTHON_VERSION}.`,
31432
- nextAction: `当前 Python 版本低于 Maker Lua 诊断最低要求 ${MINIMUM_PYTHON_VERSION}。请运行 \`taptap-maker python setup\` 自动准备 Maker 私有 Python ${DEFAULT_PYTHON_VERSION}。`
31450
+ nextAction: `当前 Python 版本低于 Maker Lua 诊断最低要求 ${MINIMUM_PYTHON_VERSION}。请运行 \`taptap-maker python setup\` 准备 Python ${DEFAULT_PYTHON_VERSION} 环境。`
31433
31451
  };
31434
31452
  }
31435
31453
  const ready = Boolean(result.pipVersion);
@@ -31444,7 +31462,7 @@ function resultToEnvironment(result, base) {
31444
31462
  pipVersion: result.pipVersion,
31445
31463
  missing: ready ? [] : ["pip"],
31446
31464
  warning: shouldRecommendUpgrade ? `Python ${RECOMMENDED_PYTHON_VERSION} or newer is recommended for Maker Lua diagnostics; current version is ${result.version}.` : void 0,
31447
- nextAction: ready ? shouldRecommendUpgrade ? `本地 Python 满足最低要求 ${MINIMUM_PYTHON_VERSION},但推荐使用 ${RECOMMENDED_PYTHON_VERSION} 或更新版本;如需统一环境,可运行 \`taptap-maker python setup\` 准备 Maker 私有 Python ${DEFAULT_PYTHON_VERSION}。` : "本地 Python 运行时可用;Maker Lua 诊断脚本可以复用该解释器。" : "检测到 Python,但 pip 不可用。请运行 `taptap-maker python setup` 自动准备 Maker 私有 Python。"
31465
+ nextAction: ready ? shouldRecommendUpgrade ? `本地 Python 满足最低要求 ${MINIMUM_PYTHON_VERSION},但推荐使用 ${RECOMMENDED_PYTHON_VERSION} 或更新版本;如需统一环境,可运行 \`taptap-maker python setup\` 准备 Python ${DEFAULT_PYTHON_VERSION} 环境。` : "本地 Python 运行时可用;Maker Lua 诊断脚本可以复用该解释器。" : "检测到 Python,但 pip 不可用。请运行 `taptap-maker python setup` 准备 Python 环境。"
31448
31466
  };
31449
31467
  }
31450
31468
  function ensureUvInstalled(platform, runner) {
@@ -31554,7 +31572,10 @@ function loadPythonRuntimeConfig() {
31554
31572
  }
31555
31573
  try {
31556
31574
  const data = JSON.parse(fs6.readFileSync(configPath, "utf8"));
31557
- return typeof data.python === "string" ? data : void 0;
31575
+ if (typeof data.python === "string" || data.status === "setup_failed") {
31576
+ return data;
31577
+ }
31578
+ return void 0;
31558
31579
  } catch {
31559
31580
  return void 0;
31560
31581
  }
@@ -31572,6 +31593,15 @@ function savePythonRuntimeConfig(environment) {
31572
31593
  fs6.mkdirSync(path7.dirname(getMakerPythonConfigPath()), { recursive: true });
31573
31594
  fs6.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31574
31595
  }
31596
+ function savePythonSetupFailure(error2) {
31597
+ const config2 = {
31598
+ status: "setup_failed",
31599
+ error: error2 instanceof Error ? error2.message : String(error2),
31600
+ saved_at: (/* @__PURE__ */ new Date()).toISOString()
31601
+ };
31602
+ fs6.mkdirSync(path7.dirname(getMakerPythonConfigPath()), { recursive: true });
31603
+ fs6.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31604
+ }
31575
31605
  function formatSetupFailure(message, result) {
31576
31606
  var _a3, _b, _c;
31577
31607
  return [
@@ -32500,7 +32530,7 @@ function extensionFromUrl(url2) {
32500
32530
  }
32501
32531
 
32502
32532
  // src/maker/server/mcp.ts
32503
- var VERSION = true ? "0.0.14" : "dev";
32533
+ var VERSION = true ? "0.0.15" : "dev";
32504
32534
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
32505
32535
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
32506
32536
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -34622,6 +34652,7 @@ async function runInit(parsed, ctx) {
34622
34652
  });
34623
34653
  const git = ensureGitAvailable();
34624
34654
  emit(ctx, "doctor", "Git is available", { version: git.version });
34655
+ ensureInitPythonReady(ctx, targetDir, env);
34625
34656
  const pat = await resolvePat(parsed, ctx);
34626
34657
  emit(ctx, "pat", "Maker PAT ready", { saved: getPatPath() });
34627
34658
  const tapAuth = await requestTapAuthWithPat(pat, env).catch((error2) => {
@@ -34758,6 +34789,106 @@ async function runDoctor(parsed, ctx) {
34758
34789
  ].filter(Boolean).join("\n")
34759
34790
  );
34760
34791
  }
34792
+ function ensureInitPythonReady(ctx, targetDir, env) {
34793
+ const initial = checkMakerPythonEnvironment();
34794
+ if (initial.ready) {
34795
+ emit(ctx, "python", "Python environment is ready", {
34796
+ status: initial.status,
34797
+ version: initial.version,
34798
+ provider: initial.provider
34799
+ });
34800
+ return;
34801
+ }
34802
+ const maxAttempts = 3;
34803
+ let lastError;
34804
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
34805
+ try {
34806
+ if (!ctx.json && attempt === 1) {
34807
+ process.stderr.write("Maker 本地开发需要 Python 环境,正在自动准备 Python 3.12...\n");
34808
+ }
34809
+ const result = setupMakerPythonEnvironment();
34810
+ emit(ctx, "python", "Python environment is ready", {
34811
+ status: result.environment.status,
34812
+ version: result.environment.version,
34813
+ provider: result.environment.provider,
34814
+ attempts: attempt
34815
+ });
34816
+ return;
34817
+ } catch (error2) {
34818
+ lastError = error2;
34819
+ if (attempt < maxAttempts) {
34820
+ const retryIndex = attempt;
34821
+ if (ctx.json) {
34822
+ writeJson({
34823
+ step: "python",
34824
+ status: "retry",
34825
+ message: `Python environment setup failed; retrying ${retryIndex}/2.`,
34826
+ data: {
34827
+ attempt,
34828
+ max_attempts: maxAttempts,
34829
+ error: error2 instanceof Error ? error2.message : String(error2)
34830
+ }
34831
+ });
34832
+ } else {
34833
+ process.stderr.write(`Python 环境准备失败,正在重试 ${retryIndex}/2...
34834
+ `);
34835
+ }
34836
+ }
34837
+ }
34838
+ }
34839
+ const message = formatInitPythonBlockedMessage(lastError);
34840
+ saveInitState(targetDir, {
34841
+ status: "blocked",
34842
+ blocking_prerequisite: "python",
34843
+ target_dir: targetDir,
34844
+ env,
34845
+ python_status: "setup_failed"
34846
+ });
34847
+ if (ctx.json) {
34848
+ writeJson({
34849
+ step: "python",
34850
+ status: "blocked",
34851
+ message: "TapTap Maker initialization paused because Python setup failed.",
34852
+ data: {
34853
+ blocking_prerequisite: "python",
34854
+ python_status: "setup_failed",
34855
+ attempts: maxAttempts,
34856
+ next_commands: [
34857
+ "taptap-maker python setup",
34858
+ "taptap-maker python doctor",
34859
+ "taptap-maker init"
34860
+ ]
34861
+ }
34862
+ });
34863
+ }
34864
+ throw new Error(message);
34865
+ }
34866
+ function formatInitPythonBlockedMessage(error2) {
34867
+ const errorText = error2 instanceof Error ? error2.message : String(error2);
34868
+ return [
34869
+ "TapTap Maker 初始化已暂停:Python 环境准备失败。",
34870
+ "",
34871
+ "Maker 本地开发需要 Python 环境。已自动尝试 3 次,仍未成功,因此后续的登录、项目拉取和 MCP 配置还没有继续执行。",
34872
+ "",
34873
+ "原因:",
34874
+ `- Python 环境准备失败:${summarizeError(errorText)}`,
34875
+ "",
34876
+ "你可以选择:",
34877
+ "",
34878
+ "1. 让当前 AI 稍后重试自动准备 Python:",
34879
+ " taptap-maker python setup",
34880
+ "",
34881
+ "2. 自己安装 Python 3.12,并确保 pip 可用,然后检查:",
34882
+ " taptap-maker python doctor",
34883
+ "",
34884
+ "修复后重新运行:",
34885
+ "taptap-maker init"
34886
+ ].join("\n");
34887
+ }
34888
+ function summarizeError(errorText) {
34889
+ const lines = errorText.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
34890
+ return lines.slice(0, 4).join(" | ") || "unknown error";
34891
+ }
34761
34892
  async function runPython(parsed, ctx) {
34762
34893
  const [, subcommand] = parsed.command;
34763
34894
  if (!subcommand || subcommand === "doctor") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taptap/maker",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "description": "TapTap Maker local development CLI and MCP server",
6
6
  "main": "dist/maker.js",
@@ -180,7 +180,13 @@ Workflow:
180
180
  initialization/clone path. Continue with the user's current intent in that bound project. Do not
181
181
  ask which app to clone unless the user explicitly asks to switch or re-clone.
182
182
  3. If Git is missing, stop. Tell the user Git is required for clone/submit/build-side Git work.
183
- 4. Run `taptap-maker init` in the user's intended Maker directory. The CLI will request PAT if
183
+ 4. Python is a required prerequisite for Maker local development. `taptap-maker init` checks it
184
+ before PAT, app list, clone, and MCP config installation. If Python is not ready, init tries
185
+ `taptap-maker python setup` up to 3 total attempts. If setup still fails, explain that init has
186
+ paused before login/project clone/MCP config, then guide the user to retry
187
+ `taptap-maker python setup` with the current AI or install Python 3.12 manually and run
188
+ `taptap-maker python doctor`.
189
+ 5. Run `taptap-maker init` in the user's intended Maker directory. The CLI will request PAT if
184
190
  missing, fetch TapTap token, show a paged app preview, ask the user to choose, prepare the AI dev
185
191
  kit, clone the Maker project, and install/verify MCP config.
186
192
  The generated MCP config pins the selected Maker project directory as `cwd` when the target
@@ -189,11 +195,11 @@ Workflow:
189
195
  Tell the user that the first Maker clone can take 20+ seconds because the server may be
190
196
  preparing the repository, and that they should keep the command running while the CLI retries
191
197
  transient 503/5xx failures.
192
- 5. If the CLI reports ordinary local files or parent Git repository risk, explain the warning and
198
+ 6. If the CLI reports ordinary local files or parent Git repository risk, explain the warning and
193
199
  ask whether the user wants to continue in this directory or switch to a clean independent one.
194
- 6. After clone succeeds, run `taptap-maker doctor` again or explain that `.maker-mcp/config.json`
200
+ 7. After clone succeeds, run `taptap-maker doctor` again or explain that `.maker-mcp/config.json`
195
201
  now binds the directory to the Maker project.
196
- 7. Tell the local AI/Agent to use the `taptap-maker-dev-kit-guide` skill for the installed dev-kit
202
+ 8. Tell the local AI/Agent to use the `taptap-maker-dev-kit-guide` skill for the installed dev-kit
197
203
  resources, especially `CLAUDE.md`, `examples/`, `templates/`, and `urhox-libs/`.
198
204
 
199
205
  Keep the user-facing explanation short: