@chesterzhao/mini-agent 0.2.0

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 ADDED
@@ -0,0 +1,16 @@
1
+ # @chesterzhao/mini-agent
2
+
3
+ 终端里的编码 Agent:配置驱动,支持 OpenAI Chat / Responses 与 Anthropic 协议、MCP、Agent Skills。
4
+
5
+ 这个 npm 包只是启动器,实际运行的是 PyPI 上同版本的 [`mini-agent-cli`](https://pypi.org/project/mini-agent-cli/),
6
+ 由 [uv](https://docs.astral.sh/uv/) 自动准备 Python 3.13 和依赖。
7
+
8
+ ```bash
9
+ curl -LsSf https://astral.sh/uv/install.sh | sh # 没有 uv 的话先装
10
+ npm i -g @chesterzhao/mini-agent
11
+ mini-agent # 首次运行生成 ~/.config/mini-agent/mini-agent.json
12
+ ```
13
+
14
+ 不用 npm 也可以:`uv tool install mini-agent-cli` 或 `uvx --from mini-agent-cli mini-agent`。
15
+
16
+ 完整文档:https://github.com/zhaomo08/mini-agent
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ // npm 入口只是个启动器:用 uvx 跑 PyPI 上同版本的 mini-agent-cli(命令名 mini-agent)。
3
+ // uv 会自己准备 Python 3.13 和依赖,首次运行稍慢,之后走缓存。
4
+ // MINI_AGENT_SPEC 可以覆盖要跑的包(本地 wheel 路径、git 地址),测试用。
5
+
6
+ const { spawnSync } = require("node:child_process");
7
+ const { existsSync } = require("node:fs");
8
+ const { homedir } = require("node:os");
9
+ const { join } = require("node:path");
10
+ const { version } = require("../package.json");
11
+
12
+ function findUvx() {
13
+ const candidates = [
14
+ process.env.UV_INSTALL_DIR && join(process.env.UV_INSTALL_DIR, "uvx"),
15
+ join(homedir(), ".local", "bin", "uvx"),
16
+ join(homedir(), ".cargo", "bin", "uvx"),
17
+ "/opt/homebrew/bin/uvx",
18
+ "/usr/local/bin/uvx",
19
+ ].filter(Boolean);
20
+ const probe = spawnSync("uvx", ["--version"], { stdio: "ignore" });
21
+ if (probe.status === 0) return "uvx";
22
+ return candidates.find((p) => existsSync(p));
23
+ }
24
+
25
+ const uvx = findUvx();
26
+ if (!uvx) {
27
+ console.error(
28
+ "mini-agent 需要 uv(Python 包管理器,会自动准备 Python 3.13)。安装:\n" +
29
+ " curl -LsSf https://astral.sh/uv/install.sh | sh\n" +
30
+ " 或 brew install uv\n" +
31
+ "装好后重新运行 mini-agent。",
32
+ );
33
+ process.exit(1);
34
+ }
35
+
36
+ const spec = process.env.MINI_AGENT_SPEC || `mini-agent-cli==${version}`;
37
+ // Ctrl+C 由终端直接发给子进程(同一进程组),Node 这边忽略,等子进程自己收尾
38
+ process.on("SIGINT", () => {});
39
+ const result = spawnSync(uvx, ["--quiet", "--from", spec, "mini-agent", ...process.argv.slice(2)], {
40
+ stdio: "inherit",
41
+ });
42
+ if (result.error) {
43
+ console.error(`启动失败:${result.error.message}`);
44
+ process.exit(1);
45
+ }
46
+ process.exit(result.status ?? (result.signal ? 1 : 0));
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@chesterzhao/mini-agent",
3
+ "version": "0.2.0",
4
+ "description": "终端里的编码 Agent:配置驱动,支持 OpenAI Chat / Responses 与 Anthropic 协议、MCP、Agent Skills(通过 uv 运行 PyPI 上的 mini-agent)",
5
+ "bin": {
6
+ "mini-agent": "bin/mini-agent.js"
7
+ },
8
+ "files": [
9
+ "bin"
10
+ ],
11
+ "engines": {
12
+ "node": ">=18"
13
+ },
14
+ "os": [
15
+ "darwin",
16
+ "linux"
17
+ ],
18
+ "keywords": ["agent", "llm", "mcp", "cli", "coding-agent", "skills"],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/zhaomo08/mini-agent.git"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ }
26
+ }