tickflow-assist 0.2.3 → 0.2.4

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.
@@ -593,17 +593,59 @@ function runOpenClaw(bin, args, description) {
593
593
  console.warn(`Warning: ${description} exited with status ${result.status}`);
594
594
  }
595
595
  }
596
- function setupPythonDeps(pythonWorkdir) {
596
+ async function setupPythonDeps(pythonWorkdir, nonInteractive) {
597
597
  let uvBin = "uv";
598
598
  try {
599
599
  const which = spawnSync("which", ["uv"], { encoding: "utf-8" });
600
600
  if (which.status !== 0) {
601
- console.warn("Warning: uv not found in PATH, skipping Python dependency setup.");
602
- console.warn("Please install uv (https://docs.astral.sh/uv/) and run 'uv sync' manually in:");
603
- console.warn(` ${pythonWorkdir}`);
604
- return;
601
+ console.log("\n ⚠️ 找不到 uv (Python 包管理工具)。");
602
+ let shouldInstall = false;
603
+ if (!nonInteractive) {
604
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
605
+ const answer = (await rl.question(" 是否自动下载并安装 uv?(y/n) [y]: ")).trim().toLowerCase();
606
+ rl.close();
607
+ if (!answer || ["y", "yes", "1", "true"].includes(answer)) {
608
+ shouldInstall = true;
609
+ }
610
+ }
611
+ if (shouldInstall) {
612
+ console.log(" 正在安装 uv...");
613
+ const installResult = spawnSync("sh", ["-c", "curl -LsSf https://astral.sh/uv/install.sh | sh"], { stdio: "inherit" });
614
+ if (installResult.status !== 0) {
615
+ console.warn(" uv 安装失败,跳过 Python 依赖安装。");
616
+ return;
617
+ }
618
+ let foundUv = false;
619
+ let installedLoc = "";
620
+ for (const loc of [path.join(os.homedir(), ".local", "bin", "uv"), path.join(os.homedir(), ".cargo", "bin", "uv")]) {
621
+ try {
622
+ await access(loc);
623
+ uvBin = loc;
624
+ installedLoc = loc;
625
+ foundUv = true;
626
+ break;
627
+ }
628
+ catch {
629
+ // ignore
630
+ }
631
+ }
632
+ if (!foundUv) {
633
+ uvBin = "uv";
634
+ }
635
+ else {
636
+ console.log(`\n ✅ uv 已自动安装到 ${installedLoc}`);
637
+ console.log(" ⚠️ 温馨提示:为了在终端能直接使用 uv 命令,您可能需要执行 `source $HOME/.local/bin/env` \n 或自行将其所在目录添加入系统的 PATH 环境变量中。\n");
638
+ }
639
+ }
640
+ else {
641
+ console.warn("\n ⚠️ 跳过 Python 依赖安装。请手动安装 uv (https://docs.astral.sh/uv/) 并执行 'uv sync',路径:");
642
+ console.warn(` ${pythonWorkdir}`);
643
+ return;
644
+ }
645
+ }
646
+ else {
647
+ uvBin = which.stdout.trim() || "uv";
605
648
  }
606
- uvBin = which.stdout.trim() || "uv";
607
649
  }
608
650
  catch {
609
651
  // fall through with default "uv"
@@ -635,7 +677,7 @@ async function configureOpenClaw(options) {
635
677
  await ensurePathNotice(config.calendarFile, "calendarFile");
636
678
  await ensurePathNotice(config.pythonWorkdir, "pythonWorkdir");
637
679
  if (options.pythonSetup) {
638
- setupPythonDeps(config.pythonWorkdir);
680
+ await setupPythonDeps(config.pythonWorkdir, options.nonInteractive);
639
681
  }
640
682
  applyPluginConfig(root, config, target);
641
683
  const backupPath = await writeConfig(configPath, root);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "tickflow-assist",
3
3
  "name": "TickFlow Assist",
4
- "version": "0.2.3",
4
+ "version": "0.2.4",
5
5
  "description": "A-share watchlist analysis, monitoring, and alert delivery powered by TickFlow and OpenClaw.",
6
6
  "skills": [
7
7
  "skills"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tickflow-assist",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "OpenClaw plugin for TickFlow-based A-share analysis, monitoring, and alerting.",
5
5
  "license": "MIT",
6
6
  "type": "module",