@bgicli/bgicli 2.2.3 → 2.2.5

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/bgi.js +49 -7
  2. package/package.json +1 -1
package/dist/bgi.js CHANGED
@@ -13762,21 +13762,35 @@ function executeTool(name, args) {
13762
13762
  return { output: "", error: String(err) };
13763
13763
  }
13764
13764
  }
13765
+ function decodeBuffer(buf) {
13766
+ if (!buf) return "";
13767
+ if (typeof buf === "string") return buf;
13768
+ try {
13769
+ return new TextDecoder("utf-8", { fatal: true }).decode(buf);
13770
+ } catch {
13771
+ try {
13772
+ return new TextDecoder("gbk").decode(buf);
13773
+ } catch {
13774
+ return buf.toString("latin1");
13775
+ }
13776
+ }
13777
+ }
13765
13778
  function toolBash(command, workdir, timeoutMs = 3e4) {
13766
13779
  try {
13767
- const out = (0, import_child_process.execSync)(command, {
13780
+ const buf = (0, import_child_process.execSync)(command, {
13768
13781
  cwd: workdir ?? process.cwd(),
13769
13782
  timeout: timeoutMs,
13770
- encoding: "utf8",
13783
+ encoding: "buffer",
13771
13784
  stdio: ["pipe", "pipe", "pipe"],
13772
- maxBuffer: 10 * 1024 * 1024
13773
- // 10 MB
13785
+ maxBuffer: 10 * 1024 * 1024,
13786
+ env: { ...process.env, PYTHONIOENCODING: "utf-8" }
13774
13787
  });
13775
- return { output: out.trim() };
13788
+ return { output: decodeBuffer(buf).trim() };
13776
13789
  } catch (err) {
13777
13790
  const e2 = err;
13778
- const out = ((e2.stdout ?? "") + "\n" + (e2.stderr ?? "")).trim();
13779
- return { output: out, error: e2.message ?? String(err) };
13791
+ const out = (decodeBuffer(e2.stdout) + "\n" + decodeBuffer(e2.stderr)).trim();
13792
+ const cmdLine = (e2.message ?? "Command failed").split("\n")[0];
13793
+ return { output: out, error: cmdLine };
13780
13794
  }
13781
13795
  }
13782
13796
  function toolReadFile(path, maxLines, offset) {
@@ -14103,6 +14117,34 @@ cat ${SKILLS_DIR}/<skill-id>/SKILL.md
14103
14117
 
14104
14118
  ---
14105
14119
 
14120
+ ## Environment Awareness
14121
+
14122
+ **\u9996\u6B21\u8FD0\u884C\u4EFB\u4F55 R/Python/\u751F\u4FE1\u5DE5\u5177\u4E4B\u524D\uFF0C\u5148\u68C0\u67E5\u5B83\u662F\u5426\u5DF2\u5B89\u88C5\uFF1A**
14123
+
14124
+ \`\`\`bash
14125
+ # \u68C0\u67E5 R
14126
+ R --version 2>&1 | head -1
14127
+
14128
+ # \u68C0\u67E5 Python
14129
+ python --version 2>&1 || python3 --version 2>&1
14130
+
14131
+ # \u68C0\u67E5\u5E38\u7528\u751F\u4FE1\u5DE5\u5177
14132
+ samtools --version 2>&1 | head -1
14133
+ \`\`\`
14134
+
14135
+ **\u5DE5\u5177\u672A\u5B89\u88C5\u65F6\u7684\u5904\u7406\u89C4\u5219\uFF08\u6309\u4F18\u5148\u7EA7\uFF09\uFF1A**
14136
+ 1. \u660E\u786E\u544A\u77E5\u7528\u6237\u8BE5\u5DE5\u5177\u672A\u5B89\u88C5\uFF08\u4E0D\u8981\u7EE7\u7EED\u5047\u8BBE\u53EF\u7528\uFF09
14137
+ 2. \u7ED9\u51FA\u5BF9\u5E94\u7CFB\u7EDF\u7684\u5B89\u88C5\u547D\u4EE4\uFF1A
14138
+ - R\uFF1Ahttps://cran.r-project.org/ \uFF0CWindows \u63A8\u8350 \`winget install RProject.R\`
14139
+ - Python\uFF1A\`winget install Python.Python.3\` \u6216 https://www.python.org/downloads/
14140
+ - Conda/Mamba\uFF1A\`winget install Anaconda.Miniconda3\`\uFF08\u751F\u4FE1\u5305\u7BA1\u7406\u9996\u9009\uFF09
14141
+ - samtools/STAR \u7B49\uFF1A\u5728 Linux/macOS \u7528 \`conda install -c bioconda <tool>\`
14142
+ 3. \u8BE2\u95EE\u7528\u6237\u662F\u5426\u9700\u8981\u5E2E\u52A9\u5B8C\u6210\u5B89\u88C5\uFF0C\u6216\u6539\u7528\u5176\u4ED6\u5DF2\u5B89\u88C5\u7684\u5DE5\u5177\u66FF\u4EE3
14143
+
14144
+ **\u4E0D\u8981\u5728\u5DE5\u5177\u7F3A\u5931\u65F6\u7EE7\u7EED\u6267\u884C\u4F9D\u8D56\u8BE5\u5DE5\u5177\u7684\u6B65\u9AA4\u3002**
14145
+
14146
+ ---
14147
+
14106
14148
  ## Script Execution Rules
14107
14149
 
14108
14150
  \u{1F6A8} **\u5173\u952E\u89C4\u5219\uFF1A**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgicli/bgicli",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "BGI CLI — Bioinformatics AI terminal for Chinese researchers (百炼/DeepSeek/Kimi/Qwen)",
5
5
  "bin": {
6
6
  "bgi": "dist/bgi.js"