mano-coding 0.1.27 → 0.1.29

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 (2) hide show
  1. package/dist/bin.js +88 -40
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -3417,6 +3417,7 @@ var init_zh = __esm({
3417
3417
  "create.missingInputsHint": "\u7F3A\u5C11\u5FC5\u586B\u8F93\u5165\uFF1A{0}\u3002\u8BF7\u901A\u8FC7 --set <name>=<value> \u63D0\u4F9B",
3418
3418
  "create.chooseTargets": "\u9009\u62E9\u8981\u521D\u59CB\u5316\u7684 IDE \u76EE\u6807",
3419
3419
  "create.targetSelectionCancelled": "\u76EE\u6807\u9009\u62E9\u5DF2\u53D6\u6D88",
3420
+ "create.targetRequired": "\u7F3A\u5C11\u76EE\u6807 IDE \u53C2\u6570\uFF0C\u8BF7\u4F7F\u7528 --target <ide...>",
3420
3421
  "create.planConflict": "Plan \u5B58\u5728\u51B2\u7A81",
3421
3422
  "create.needsConfirmation": "\u6267\u884C Plan \u9700\u8981 --yes\u3002\u4F7F\u7528 --dry-run \u9884\u89C8\u3002",
3422
3423
  "create.userDeclined": "\u7528\u6237\u62D2\u7EDD\u4E86 Plan \u786E\u8BA4",
@@ -32036,6 +32037,22 @@ function resolveTaskExecutable(command, platform = process.platform, envPath) {
32036
32037
  }
32037
32038
  return command;
32038
32039
  }
32040
+ function prepareSpawnCommand(executable, args, platform = process.platform, comSpec = process.env.ComSpec ?? "cmd.exe") {
32041
+ const isWindowsBatch = platform === "win32" && /\.(cmd|bat)$/i.test(executable);
32042
+ if (!isWindowsBatch) {
32043
+ return {
32044
+ executable,
32045
+ args: [...args]
32046
+ };
32047
+ }
32048
+ const escapedArgs = args.map(
32049
+ (arg) => /[\s&|<>()^%!]/u.test(arg) ? `"${arg.replaceAll('"', '""')}"` : arg
32050
+ );
32051
+ return {
32052
+ executable: comSpec,
32053
+ args: ["/d", "/c", [executable, ...escapedArgs].join(" ")]
32054
+ };
32055
+ }
32039
32056
  async function executeTasks(tasks, ctx, options = {}) {
32040
32057
  if (tasks.length === 0) return;
32041
32058
  const stdio = options.stdio ?? "inherit";
@@ -32069,9 +32086,14 @@ async function executeTasks(tasks, ctx, options = {}) {
32069
32086
  if (options.onProgress) {
32070
32087
  options.onProgress(`\u6B63\u5728\u6267\u884C\u4EFB\u52A1 [${i + 1}/${tasks.length}] (${taskLabel}): ${command} ${effectiveArgs.join(" ")}`);
32071
32088
  }
32072
- const executable = resolveTaskExecutable(command, process.platform, env.PATH);
32089
+ const rawExecutable = resolveTaskExecutable(command, process.platform, env.PATH);
32090
+ const { executable, args: spawnArgs } = prepareSpawnCommand(
32091
+ rawExecutable,
32092
+ effectiveArgs,
32093
+ process.platform
32094
+ );
32073
32095
  await new Promise((resolve22, reject) => {
32074
- const child = spawn(executable, effectiveArgs, {
32096
+ const child = spawn(executable, spawnArgs, {
32075
32097
  cwd,
32076
32098
  env,
32077
32099
  stdio,
@@ -33676,6 +33698,7 @@ __export(src_exports, {
33676
33698
  parseTomlSelector: () => parseTomlSelector,
33677
33699
  planPluginDelivery: () => planPluginDelivery,
33678
33700
  prepareJournalRecovery: () => prepareJournalRecovery,
33701
+ prepareSpawnCommand: () => prepareSpawnCommand,
33679
33702
  prepareUserDataRecovery: () => prepareUserDataRecovery,
33680
33703
  readVariantJson: () => readVariantJson,
33681
33704
  recoverJournal: () => recoverJournal,
@@ -38656,23 +38679,16 @@ function printPlanSummary(s3) {
38656
38679
  \u63D2\u4EF6\uFF1A${s3.pluginCount}
38657
38680
  `);
38658
38681
  }
38659
- function computeProjectTargets(manifests, cliTargets) {
38660
- if (cliTargets.length > 0) {
38661
- return cliTargets.map((id) => ({ id, scope: "project" }));
38662
- }
38682
+ function computeProjectTargets(manifestsOrCliTargets, maybeCliTargets) {
38683
+ const cliTargets = Array.isArray(maybeCliTargets) ? maybeCliTargets : Array.isArray(manifestsOrCliTargets) && (manifestsOrCliTargets.length === 0 || typeof manifestsOrCliTargets[0] === "string") ? manifestsOrCliTargets : [];
38663
38684
  const seen = /* @__PURE__ */ new Set();
38664
38685
  const targets = [];
38665
- for (const m2 of manifests) {
38666
- for (const t2 of m2.targets ?? []) {
38667
- if (!seen.has(t2.id)) {
38668
- seen.add(t2.id);
38669
- targets.push({ id: t2.id, scope: "project" });
38670
- }
38686
+ for (const id of cliTargets) {
38687
+ if (id && !seen.has(id)) {
38688
+ seen.add(id);
38689
+ targets.push({ id, scope: "project" });
38671
38690
  }
38672
38691
  }
38673
- if (targets.length === 0) {
38674
- targets.push({ id: "cursor", scope: "project" });
38675
- }
38676
38692
  return targets;
38677
38693
  }
38678
38694
  function collectInputDefs(manifests) {
@@ -38832,12 +38848,22 @@ function toRequestedSource(resolution) {
38832
38848
  if (source.type === "npm") return { type: "npm", registry: source.registry };
38833
38849
  return { type: "git", url: source.url, ref: "commit" in source ? source.commit : source.ref, ...source.subdirectory ? { subdirectory: source.subdirectory } : {} };
38834
38850
  }
38851
+ var OFFICIAL_TARGET_CHOICES;
38835
38852
  var init_plan_execution = __esm({
38836
38853
  "packages/cli/src/commands/plan-execution.ts"() {
38837
38854
  "use strict";
38838
38855
  init_src2();
38839
38856
  init_cli_output();
38840
38857
  init_i18n();
38858
+ OFFICIAL_TARGET_CHOICES = [
38859
+ { id: "codebuddy", label: "CodeBuddy" },
38860
+ { id: "cursor", label: "Cursor" },
38861
+ { id: "claude-code", label: "Claude Code" },
38862
+ { id: "trae", label: "Trae" },
38863
+ { id: "opencode", label: "OpenCode" },
38864
+ { id: "codex", label: "Codex" },
38865
+ { id: "deepseek-harness", label: "DeepSeek Harness" }
38866
+ ];
38841
38867
  }
38842
38868
  });
38843
38869
 
@@ -39294,11 +39320,16 @@ ${taskValidation.missingInputs.map((k2) => `--set ${k2}=<value>`).join("\n")}`,
39294
39320
  }
39295
39321
  await recoverIncompleteJournals(service, output);
39296
39322
  let cliTargets = options.target;
39297
- if (cliTargets.length === 0 && isInteractive) {
39298
- const candidates = collectTargetCandidates(allResolutions.map((r) => r.manifest));
39299
- if (candidates.length > 1) {
39323
+ if (cliTargets.length === 0) {
39324
+ if (isInteractive) {
39300
39325
  try {
39301
- const selected = await selectSearchableMulti({ message: t("create.chooseTargets"), choices: candidates });
39326
+ const selected = await selectSearchableMulti({
39327
+ message: t("create.chooseTargets"),
39328
+ choices: OFFICIAL_TARGET_CHOICES
39329
+ });
39330
+ if (selected.length === 0) {
39331
+ throw new CliError(t("create.targetSelectionCancelled"), ExitCode.NeedsInputOrDenied, "PERMISSION_DENIED");
39332
+ }
39302
39333
  cliTargets = selected.map((choice) => choice.id);
39303
39334
  } catch (error) {
39304
39335
  if (error instanceof SearchableSelectCancelled) {
@@ -39306,12 +39337,11 @@ ${taskValidation.missingInputs.map((k2) => `--set ${k2}=<value>`).join("\n")}`,
39306
39337
  }
39307
39338
  throw error;
39308
39339
  }
39340
+ } else {
39341
+ cliTargets = ["codebuddy"];
39309
39342
  }
39310
39343
  }
39311
- const projectTargets = computeProjectTargets(
39312
- allResolutions.map((r) => r.manifest),
39313
- cliTargets
39314
- );
39344
+ const projectTargets = computeProjectTargets(cliTargets);
39315
39345
  await service.registerThirdPartyAdapters(
39316
39346
  allResolutions.map((r) => ({ manifest: r.manifest, resolution: r }))
39317
39347
  );
@@ -39619,19 +39649,6 @@ async function resolvePackageWith(service, spec, options, cliVersion) {
39619
39649
  throw err;
39620
39650
  });
39621
39651
  }
39622
- function collectTargetCandidates(manifests) {
39623
- const seen = /* @__PURE__ */ new Set();
39624
- const candidates = [];
39625
- for (const manifest of manifests) {
39626
- for (const target of manifest?.targets ?? []) {
39627
- if (target?.id && !seen.has(target.id)) {
39628
- seen.add(target.id);
39629
- candidates.push({ id: target.id, label: target.id });
39630
- }
39631
- }
39632
- }
39633
- return candidates;
39634
- }
39635
39652
  var init_create = __esm({
39636
39653
  "packages/cli/src/commands/create.ts"() {
39637
39654
  "use strict";
@@ -39680,6 +39697,7 @@ async function executeApply(packageSpec, options, cliVersion, events) {
39680
39697
  noColor: options.noColor
39681
39698
  };
39682
39699
  const jsonEvents = () => options.json && options.verbose ? getRedactedEvents(events) : void 0;
39700
+ const isInteractive = !options.noInput && !options.json && Boolean(process.stdin.isTTY);
39683
39701
  const service = new ServiceLocator({
39684
39702
  cliVersion,
39685
39703
  projectRoot: options.project,
@@ -39763,7 +39781,31 @@ async function executeApply(packageSpec, options, cliVersion, events) {
39763
39781
  { inputs: missingInputs }
39764
39782
  );
39765
39783
  }
39766
- const projectTargets = options.target.length > 0 ? computeProjectTargets(allResolutions.map((r) => r.manifest), options.target) : existingLock?.desired.targets ?? computeProjectTargets(allResolutions.map((r) => r.manifest), []);
39784
+ let cliTargets = options.target;
39785
+ if (cliTargets.length === 0) {
39786
+ if (existingLock?.desired.targets && existingLock.desired.targets.length > 0) {
39787
+ cliTargets = existingLock.desired.targets.map((t2) => t2.id);
39788
+ } else if (isInteractive) {
39789
+ try {
39790
+ const selected = await selectSearchableMulti({
39791
+ message: t("create.chooseTargets"),
39792
+ choices: OFFICIAL_TARGET_CHOICES
39793
+ });
39794
+ if (selected.length === 0) {
39795
+ throw new CliError(t("create.targetSelectionCancelled"), ExitCode.NeedsInputOrDenied, "PERMISSION_DENIED");
39796
+ }
39797
+ cliTargets = selected.map((choice) => choice.id);
39798
+ } catch (error) {
39799
+ if (error instanceof SearchableSelectCancelled) {
39800
+ throw new CliError(t("create.targetSelectionCancelled"), ExitCode.NeedsInputOrDenied, "PERMISSION_DENIED");
39801
+ }
39802
+ throw error;
39803
+ }
39804
+ } else {
39805
+ cliTargets = ["codebuddy"];
39806
+ }
39807
+ }
39808
+ const projectTargets = computeProjectTargets(cliTargets);
39767
39809
  await service.registerThirdPartyAdapters(
39768
39810
  allResolutions.map((r) => ({ manifest: r.manifest, resolution: r }))
39769
39811
  );
@@ -40049,6 +40091,7 @@ var init_apply = __esm({
40049
40091
  init_spinner();
40050
40092
  init_i18n();
40051
40093
  init_plan_execution();
40094
+ init_searchable_select();
40052
40095
  }
40053
40096
  });
40054
40097
 
@@ -41912,8 +41955,13 @@ async function executeLaunch(launcherArgs) {
41912
41955
  resolved.installation["version"]
41913
41956
  );
41914
41957
  const cmd = resolved.command;
41915
- const child = spawn2(cmd.executable, [...cmd.args, ...resolved.passthroughArgs], {
41916
- stdio: "inherit"
41958
+ const rawExecutable = resolveTaskExecutable(cmd.executable, process.platform);
41959
+ const rawArgs = [...cmd.args, ...resolved.passthroughArgs];
41960
+ const { executable, args } = prepareSpawnCommand(rawExecutable, rawArgs, process.platform);
41961
+ const child = spawn2(executable, args, {
41962
+ stdio: "inherit",
41963
+ shell: false,
41964
+ windowsHide: true
41917
41965
  });
41918
41966
  const heartbeatTimer = setInterval(() => {
41919
41967
  void heartbeatLease(lease).catch(() => {
@@ -42277,7 +42325,7 @@ import { createRequire as createRequire2 } from "node:module";
42277
42325
  import { readFileSync as readFileSync4 } from "node:fs";
42278
42326
  import { fileURLToPath as fileURLToPath5 } from "node:url";
42279
42327
  function resolveVersion() {
42280
- if (true) return "0.1.27";
42328
+ if (true) return "0.1.29";
42281
42329
  const candidates = [
42282
42330
  new URL("../package.json", import.meta.url),
42283
42331
  new URL("../../package.json", import.meta.url),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mano-coding",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "Mano Coding CLI and toolchain",
5
5
  "type": "module",
6
6
  "main": "index.js",