funcoding-cli 0.2.1 → 0.4.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 +41 -13
- package/dist/auth.js +16 -18
- package/dist/cli.js +8 -214
- package/dist/commands.js +238 -0
- package/dist/content.js +36 -26
- package/dist/info.js +6 -3
- package/dist/install.js +36 -38
- package/dist/lists.js +42 -0
- package/dist/mcp.js +25 -28
- package/dist/setup.js +110 -48
- package/dist/skill-docs.js +36 -0
- package/dist/sync.js +30 -17
- package/dist/ui.js +43 -2
- package/package.json +3 -2
- package/skill/funcoding-cli/SKILL.md +67 -0
- package/skill/funcoding-cli/references/auth.md +21 -0
- package/skill/funcoding-cli/references/cli.md +27 -0
- package/skill/funcoding-cli/references/docs.md +26 -0
- package/skill/funcoding-cli/references/favorites.md +19 -0
- package/skill/funcoding-cli/references/lists.md +27 -0
- package/skill/funcoding-cli/references/mcp.md +73 -0
- package/skill/funcoding-cli/references/news.md +21 -0
- package/skill/funcoding-cli/references/skills.md +86 -0
- package/dist/init.js +0 -90
- package/skill/funcoding/SKILL.md +0 -96
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: funcoding-cli
|
|
3
|
+
version: 0.4.0
|
|
4
|
+
description: 用 funcoding 命令行(funcoding-cli)从 funcoding.ai 查找并安装 Agent Skills 和 MCP Server,管理已安装的 Skill,同步用户在网站上的收藏和别人分享的清单,查看 AI 热点和日报,搜索和阅读 Claude Code、Codex、Cursor 等智能体的中文文档。当用户想找某类 Skill 或 MCP Server、安装或更新 Skill、配置 MCP、同步收藏,了解最近的 AI 新闻,或查阅 AI 编程工具的中文文档时使用。
|
|
5
|
+
requires:
|
|
6
|
+
bins: ["funcoding"]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# funcoding-cli
|
|
10
|
+
|
|
11
|
+
`funcoding` 命令(npm 包 `funcoding-cli`,简写 `fun`)连接 funcoding.ai:Skill 和 MCP Server 目录、用户的收藏、AI 热点、中文文档。
|
|
12
|
+
|
|
13
|
+
> **核心规则:直接运行命令,始终加 `--json`。** 不要自己拼网站接口、不要去 GitHub 上找文件、不要手改各智能体的配置文件,这些 CLI 都会做,并且会先备份。
|
|
14
|
+
|
|
15
|
+
## 约定
|
|
16
|
+
|
|
17
|
+
- **`--json`**:stdout 只有一个 JSON 对象。成功 `{ "ok": true, ... }`;失败 `{ "ok": false, "error": { "code", "message", "hint" } }`。过程提示在 stderr,可以忽略。
|
|
18
|
+
- **出错先看 `error.hint`**:通常是下一步该运行的命令或该补的参数。
|
|
19
|
+
- **退出码**:0 成功,1 一般错误,2 参数错误或缺少必填项,3 未找到,4 目标已存在(需要 `--force`),5 未登录或登录已过期。
|
|
20
|
+
- **`--agent=<name>`**:`claude-code`、`codex`、`cursor`,多个用逗号分隔,`all` 是本机检测到的全部。不写时在 Claude Code 里默认 `claude-code`,**在其他智能体里必须写**。
|
|
21
|
+
- **`--project`**:安装到当前项目(可以随仓库提交);不加时安装到用户目录。
|
|
22
|
+
- **不确定参数时**:先读 `references/` 下对应的文件,或运行 `funcoding <命令> --help`。
|
|
23
|
+
- **环境**:`funcoding info --json` 返回版本、登录状态、本机检测到的智能体和各自的 Skill 目录。
|
|
24
|
+
|
|
25
|
+
没有 `funcoding` 命令时运行 `npx --yes funcoding-cli@latest cli setup --json`;`cli.status` 为 `failed` 时把 `cli.hint` 告诉用户,在那之前用 `npx --yes funcoding-cli@latest <命令>` 代替。
|
|
26
|
+
|
|
27
|
+
## 安装 Skill
|
|
28
|
+
|
|
29
|
+
1. `funcoding skills find <关键词> --json`:结果的 `skills[].id` 形如 `owner/repo/skill`。
|
|
30
|
+
2. **安装前检查**:`funcoding skills info <id> --json` 返回 SKILL.md 全文(`skill.content`)和文件清单(`skill.files`,可执行脚本在 `skill.scripts`)。用一两句话告诉用户它做什么;有执行任意命令、读取或外传密钥和个人数据、修改系统设置等操作时要明确指出。**得到用户确认后再安装。**
|
|
31
|
+
3. `funcoding skills add <id> --json`:目录已存在时以退出码 4 停下,向用户确认后再加 `--force`(旧版本会先备份)。
|
|
32
|
+
4. 告诉用户安装位置(`installed[].dir`)和调用方式:Claude Code、Cursor 输入 `/<目录名>`,Codex 输入 `$<目录名>`,也可以直接描述任务。新开会话后生效。
|
|
33
|
+
|
|
34
|
+
`skills list` 列出已安装的 Skill(`source` 不为空的是 funcoding 安装的);`skills update [--check]` 检查或更新;`skills remove` 删除前会备份,删除其他来源的 Skill 要 `--force`,先征得用户同意。
|
|
35
|
+
|
|
36
|
+
## 配置 MCP Server
|
|
37
|
+
|
|
38
|
+
1. `funcoding mcp find <关键词> --json`,再用 `funcoding mcp info <id> --json` 看启动方式(`server.launches`)和需要的环境变量(`env`)或请求头(`headers`)。
|
|
39
|
+
2. `funcoding mcp add <id> --env=KEY=VALUE --header=KEY=VALUE --json`:
|
|
40
|
+
- 缺少必填项时以退出码 2 返回,`error.missing` 列出缺少的项。**向用户索取,不要编造**;密钥只通过参数传入,不要写进别的文件。
|
|
41
|
+
- 没有标准安装包时以退出码 3 返回,`error.readme` 是 README 地址,按 README 手动配置。
|
|
42
|
+
3. 重启智能体或新开会话后生效。Claude Code 当前项目的 Server 需要用户在 Claude Code 里确认。
|
|
43
|
+
|
|
44
|
+
## 收藏和清单
|
|
45
|
+
|
|
46
|
+
- 收藏需要登录:`funcoding auth status --json` 退出码 5 表示未登录;`funcoding auth login` 会在 stderr 输出验证码和链接,并尝试打开浏览器,把链接和验证码告诉用户,命令会等到用户确认后才返回。
|
|
47
|
+
- `funcoding favorites sync --dry-run --json` 先给用户看会安装什么,再去掉 `--dry-run` 执行。
|
|
48
|
+
- 用户发来 `https://funcoding.ai/share/<id>/` 时:`funcoding lists info <链接> --json` 查看,`funcoding lists add <链接> --dry-run --json` 预览后安装。不需要登录。
|
|
49
|
+
- 两者结果的 `items[].status`:`installed` 已安装,`present` 已存在,`skipped` 跳过(附 `reason` 和 `hint`,多半是 MCP 缺少必填的环境变量),`planned` 待安装(`--dry-run`)。
|
|
50
|
+
|
|
51
|
+
## 热点和文档
|
|
52
|
+
|
|
53
|
+
- `funcoding news list --json`:当前 AI 热榜;`funcoding news daily [YYYY-MM-DD] --json`:AI 日报。数据来自 AIHOT,转述时保留来源。
|
|
54
|
+
- `funcoding docs search <关键词> [--agent=<slug>] --json`,`funcoding docs fetch <智能体>/<路径> --json`:中文文档全文,附官方来源和核实日期;命令、配置和价格以官方文档为准。
|
|
55
|
+
|
|
56
|
+
## 命令参考
|
|
57
|
+
|
|
58
|
+
| 文件 | 命令 |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| [references/cli.md](references/cli.md) | `cli setup`、`cli upgrade` |
|
|
61
|
+
| [references/skills.md](references/skills.md) | `skills find / info / add / list / update / remove` |
|
|
62
|
+
| [references/mcp.md](references/mcp.md) | `mcp find / info / add / list / remove` |
|
|
63
|
+
| [references/favorites.md](references/favorites.md) | `favorites list / sync` |
|
|
64
|
+
| [references/lists.md](references/lists.md) | `lists info / add` |
|
|
65
|
+
| [references/auth.md](references/auth.md) | `auth login / logout / status` |
|
|
66
|
+
| [references/news.md](references/news.md) | `news list / daily` |
|
|
67
|
+
| [references/docs.md](references/docs.md) | `docs search / fetch` |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# funcoding auth
|
|
2
|
+
|
|
3
|
+
登录 funcoding.ai
|
|
4
|
+
|
|
5
|
+
所有命令都支持 `--json`、`-h, --help`、`-V, --version`。本文件由 scripts/gen-skill.ts 根据命令表生成。
|
|
6
|
+
|
|
7
|
+
## funcoding auth login
|
|
8
|
+
|
|
9
|
+
在浏览器中授权登录(设备码)
|
|
10
|
+
|
|
11
|
+
选项:
|
|
12
|
+
|
|
13
|
+
- `--no-browser`:不自动打开浏览器
|
|
14
|
+
|
|
15
|
+
## funcoding auth logout
|
|
16
|
+
|
|
17
|
+
退出登录,并使登录凭证失效
|
|
18
|
+
|
|
19
|
+
## funcoding auth status
|
|
20
|
+
|
|
21
|
+
查看当前登录的账号
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# funcoding cli
|
|
2
|
+
|
|
3
|
+
安装、升级本工具
|
|
4
|
+
|
|
5
|
+
所有命令都支持 `--json`、`-h, --help`、`-V, --version`。本文件由 scripts/gen-skill.ts 根据命令表生成。
|
|
6
|
+
|
|
7
|
+
## funcoding cli setup
|
|
8
|
+
|
|
9
|
+
全局安装本工具,并为本机的智能体安装 funcoding-cli Skill
|
|
10
|
+
|
|
11
|
+
选项:
|
|
12
|
+
|
|
13
|
+
- `--no-global`:不全局安装
|
|
14
|
+
- `--no-agent-skills`:不为智能体安装 funcoding-cli Skill
|
|
15
|
+
- `-f, --force`:目标已存在时覆盖(原内容先备份到配置目录)
|
|
16
|
+
- `-q, --quiet`:不输出给人看的文字(脚本里用)
|
|
17
|
+
|
|
18
|
+
示例:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx --yes funcoding-cli@latest cli setup
|
|
22
|
+
funcoding cli setup --no-agent-skills
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## funcoding cli upgrade
|
|
26
|
+
|
|
27
|
+
升级到最新版本,并刷新已安装的 funcoding-cli Skill
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# funcoding docs
|
|
2
|
+
|
|
3
|
+
AI 编程智能体的中文文档
|
|
4
|
+
|
|
5
|
+
所有命令都支持 `--json`、`-h, --help`、`-V, --version`。本文件由 scripts/gen-skill.ts 根据命令表生成。
|
|
6
|
+
|
|
7
|
+
## funcoding docs search <query>
|
|
8
|
+
|
|
9
|
+
搜索文档
|
|
10
|
+
|
|
11
|
+
参数:
|
|
12
|
+
|
|
13
|
+
- `<query>`:关键词
|
|
14
|
+
|
|
15
|
+
选项:
|
|
16
|
+
|
|
17
|
+
- `-a, --agent=<slug>`:只搜这个智能体的文档,比如 claude-code、codex、gemini-cli
|
|
18
|
+
- `--limit=<n>`:返回条数(1–30,默认 10)
|
|
19
|
+
|
|
20
|
+
## funcoding docs fetch <path>
|
|
21
|
+
|
|
22
|
+
读取文档全文(Markdown),开头附官方来源和核实日期
|
|
23
|
+
|
|
24
|
+
参数:
|
|
25
|
+
|
|
26
|
+
- `<path>`:<智能体>/<路径>,比如 claude-code/build/hooks;也可以是网站上的文档地址
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# funcoding favorites
|
|
2
|
+
|
|
3
|
+
网站上收藏的 Skill 和 MCP Server(需要登录)
|
|
4
|
+
|
|
5
|
+
所有命令都支持 `--json`、`-h, --help`、`-V, --version`。本文件由 scripts/gen-skill.ts 根据命令表生成。
|
|
6
|
+
|
|
7
|
+
## funcoding favorites list
|
|
8
|
+
|
|
9
|
+
列出收藏
|
|
10
|
+
|
|
11
|
+
## funcoding favorites sync
|
|
12
|
+
|
|
13
|
+
安装全部收藏,已安装的跳过
|
|
14
|
+
|
|
15
|
+
选项:
|
|
16
|
+
|
|
17
|
+
- `-a, --agent=<name>`:目标智能体:claude-code、codex、cursor,多个用逗号分隔,all 表示本机检测到的全部(默认:当前所在的智能体,否则 claude-code)
|
|
18
|
+
- `-p, --project`:安装到当前项目(可随仓库提交),不加时安装到用户目录
|
|
19
|
+
- `--dry-run`:只列出将要执行的操作
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# funcoding lists
|
|
2
|
+
|
|
3
|
+
别人分享的 Skill 和 MCP 清单(不需要登录)
|
|
4
|
+
|
|
5
|
+
所有命令都支持 `--json`、`-h, --help`、`-V, --version`。本文件由 scripts/gen-skill.ts 根据命令表生成。
|
|
6
|
+
|
|
7
|
+
## funcoding lists info <link>
|
|
8
|
+
|
|
9
|
+
查看清单里的 Skill 和 MCP Server
|
|
10
|
+
|
|
11
|
+
参数:
|
|
12
|
+
|
|
13
|
+
- `<link>`:清单链接(https://funcoding.ai/share/<id>/)或 id
|
|
14
|
+
|
|
15
|
+
## funcoding lists add <link>
|
|
16
|
+
|
|
17
|
+
安装清单里的全部 Skill 和 MCP Server,已安装的跳过
|
|
18
|
+
|
|
19
|
+
参数:
|
|
20
|
+
|
|
21
|
+
- `<link>`:清单链接(https://funcoding.ai/share/<id>/)或 id
|
|
22
|
+
|
|
23
|
+
选项:
|
|
24
|
+
|
|
25
|
+
- `-a, --agent=<name>`:目标智能体:claude-code、codex、cursor,多个用逗号分隔,all 表示本机检测到的全部(默认:当前所在的智能体,否则 claude-code)
|
|
26
|
+
- `-p, --project`:安装到当前项目(可随仓库提交),不加时安装到用户目录
|
|
27
|
+
- `--dry-run`:只列出将要执行的操作
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# funcoding mcp
|
|
2
|
+
|
|
3
|
+
查找 MCP Server,并写入各智能体的 MCP 配置
|
|
4
|
+
|
|
5
|
+
所有命令都支持 `--json`、`-h, --help`、`-V, --version`。本文件由 scripts/gen-skill.ts 根据命令表生成。
|
|
6
|
+
|
|
7
|
+
## funcoding mcp find <query>
|
|
8
|
+
|
|
9
|
+
按关键词查找 MCP Server
|
|
10
|
+
|
|
11
|
+
参数:
|
|
12
|
+
|
|
13
|
+
- `<query>`:关键词
|
|
14
|
+
|
|
15
|
+
选项:
|
|
16
|
+
|
|
17
|
+
- `--limit=<n>`:返回条数(1–30,默认 10)
|
|
18
|
+
|
|
19
|
+
## funcoding mcp info <id>
|
|
20
|
+
|
|
21
|
+
查看启动方式,以及需要提供的环境变量或请求头
|
|
22
|
+
|
|
23
|
+
参数:
|
|
24
|
+
|
|
25
|
+
- `<id>`:owner/repo 或 owner/repo/sub,或网站上的详情页地址
|
|
26
|
+
|
|
27
|
+
## funcoding mcp add <id>
|
|
28
|
+
|
|
29
|
+
把 MCP Server 写入智能体的配置
|
|
30
|
+
|
|
31
|
+
参数:
|
|
32
|
+
|
|
33
|
+
- `<id>`:owner/repo 或 owner/repo/sub,或网站上的详情页地址
|
|
34
|
+
|
|
35
|
+
选项:
|
|
36
|
+
|
|
37
|
+
- `-a, --agent=<name>`:目标智能体:claude-code、codex、cursor,多个用逗号分隔,all 表示本机检测到的全部(默认:当前所在的智能体,否则 claude-code)
|
|
38
|
+
- `-p, --project`:安装到当前项目(可随仓库提交),不加时安装到用户目录
|
|
39
|
+
- `-f, --force`:目标已存在时覆盖(原内容先备份到配置目录)
|
|
40
|
+
- `-e, --env=<KEY=VALUE>`:stdio Server 的环境变量,可重复
|
|
41
|
+
- `--header=<KEY=VALUE>`:远程 Server 的请求头,可重复
|
|
42
|
+
- `--via=<kind>`:指定启动方式:remote、npm 或 pypi
|
|
43
|
+
- `--name=<name>`:自定义配置名(默认取自 Server 名称)
|
|
44
|
+
|
|
45
|
+
示例:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
funcoding mcp add vexa-ai/vexa --header=Authorization="Bearer <key>" --agent=cursor
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## funcoding mcp list
|
|
52
|
+
|
|
53
|
+
列出已配置的 MCP Server
|
|
54
|
+
|
|
55
|
+
选项:
|
|
56
|
+
|
|
57
|
+
- `-a, --agent=<name>`:只看这些智能体:claude-code、codex、cursor,多个用逗号分隔(默认全部)
|
|
58
|
+
- `-p, --project`:只看当前项目
|
|
59
|
+
- `-u, --user`:只看用户目录(默认用户目录和当前项目都看)
|
|
60
|
+
|
|
61
|
+
## funcoding mcp remove <name>...
|
|
62
|
+
|
|
63
|
+
删除 MCP Server 配置(先备份原文件)
|
|
64
|
+
|
|
65
|
+
参数:
|
|
66
|
+
|
|
67
|
+
- `<name>...`:配置名,见 mcp list
|
|
68
|
+
|
|
69
|
+
选项:
|
|
70
|
+
|
|
71
|
+
- `-a, --agent=<name>`:只看这些智能体:claude-code、codex、cursor,多个用逗号分隔(默认全部)
|
|
72
|
+
- `-p, --project`:只看当前项目
|
|
73
|
+
- `-u, --user`:只看用户目录(默认用户目录和当前项目都看)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# funcoding news
|
|
2
|
+
|
|
3
|
+
AI 热点
|
|
4
|
+
|
|
5
|
+
所有命令都支持 `--json`、`-h, --help`、`-V, --version`。本文件由 scripts/gen-skill.ts 根据命令表生成。
|
|
6
|
+
|
|
7
|
+
## funcoding news list
|
|
8
|
+
|
|
9
|
+
当前 AI 热榜:过去 48 小时被多个来源共同报道的事件,前 10 名
|
|
10
|
+
|
|
11
|
+
选项:
|
|
12
|
+
|
|
13
|
+
- `--limit=<n>`:返回条数(1–30,默认 10)
|
|
14
|
+
|
|
15
|
+
## funcoding news daily <date>
|
|
16
|
+
|
|
17
|
+
某一天的 AI 日报
|
|
18
|
+
|
|
19
|
+
参数:
|
|
20
|
+
|
|
21
|
+
- `<date>`:YYYY-MM-DD;不写时为最新一期
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# funcoding skills
|
|
2
|
+
|
|
3
|
+
查找、安装和管理 Agent Skills
|
|
4
|
+
|
|
5
|
+
所有命令都支持 `--json`、`-h, --help`、`-V, --version`。本文件由 scripts/gen-skill.ts 根据命令表生成。
|
|
6
|
+
|
|
7
|
+
## funcoding skills find <query>
|
|
8
|
+
|
|
9
|
+
按关键词查找 Skill
|
|
10
|
+
|
|
11
|
+
参数:
|
|
12
|
+
|
|
13
|
+
- `<query>`:关键词
|
|
14
|
+
|
|
15
|
+
选项:
|
|
16
|
+
|
|
17
|
+
- `--limit=<n>`:返回条数(1–30,默认 10)
|
|
18
|
+
|
|
19
|
+
## funcoding skills info <id>
|
|
20
|
+
|
|
21
|
+
查看 Skill 的描述、文件清单和 SKILL.md 全文(安装前检查用)
|
|
22
|
+
|
|
23
|
+
参数:
|
|
24
|
+
|
|
25
|
+
- `<id>`:owner/repo/skill,或网站上的详情页地址
|
|
26
|
+
|
|
27
|
+
## funcoding skills add <id>...
|
|
28
|
+
|
|
29
|
+
安装一个或多个 Skill
|
|
30
|
+
|
|
31
|
+
参数:
|
|
32
|
+
|
|
33
|
+
- `<id>...`:owner/repo/skill,或网站上的详情页地址
|
|
34
|
+
|
|
35
|
+
选项:
|
|
36
|
+
|
|
37
|
+
- `-a, --agent=<name>`:目标智能体:claude-code、codex、cursor,多个用逗号分隔,all 表示本机检测到的全部(默认:当前所在的智能体,否则 claude-code)
|
|
38
|
+
- `-p, --project`:安装到当前项目(可随仓库提交),不加时安装到用户目录
|
|
39
|
+
- `-f, --force`:目标已存在时覆盖(原内容先备份到配置目录)
|
|
40
|
+
|
|
41
|
+
示例:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
funcoding skills add anthropics/skills/pdf
|
|
45
|
+
funcoding skills add anthropics/skills/pdf --agent=codex,cursor --project
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## funcoding skills list
|
|
49
|
+
|
|
50
|
+
列出已安装的 Skill
|
|
51
|
+
|
|
52
|
+
选项:
|
|
53
|
+
|
|
54
|
+
- `-a, --agent=<name>`:只看这些智能体:claude-code、codex、cursor,多个用逗号分隔(默认全部)
|
|
55
|
+
- `-p, --project`:只看当前项目
|
|
56
|
+
- `-u, --user`:只看用户目录(默认用户目录和当前项目都看)
|
|
57
|
+
|
|
58
|
+
## funcoding skills update <name>
|
|
59
|
+
|
|
60
|
+
按原来源重新安装由 funcoding 安装的 Skill
|
|
61
|
+
|
|
62
|
+
参数:
|
|
63
|
+
|
|
64
|
+
- `<name>`:目录名或 Skill id;不写时更新全部
|
|
65
|
+
|
|
66
|
+
选项:
|
|
67
|
+
|
|
68
|
+
- `--check`:只检查远端有没有更新,不安装
|
|
69
|
+
- `-a, --agent=<name>`:只看这些智能体:claude-code、codex、cursor,多个用逗号分隔(默认全部)
|
|
70
|
+
- `-p, --project`:只看当前项目
|
|
71
|
+
- `-u, --user`:只看用户目录(默认用户目录和当前项目都看)
|
|
72
|
+
|
|
73
|
+
## funcoding skills remove <name>...
|
|
74
|
+
|
|
75
|
+
删除由 funcoding 安装的 Skill(先备份)
|
|
76
|
+
|
|
77
|
+
参数:
|
|
78
|
+
|
|
79
|
+
- `<name>...`:目录名或 Skill id
|
|
80
|
+
|
|
81
|
+
选项:
|
|
82
|
+
|
|
83
|
+
- `-f, --force`:目标已存在时覆盖(原内容先备份到配置目录)
|
|
84
|
+
- `-a, --agent=<name>`:只看这些智能体:claude-code、codex、cursor,多个用逗号分隔(默认全部)
|
|
85
|
+
- `-p, --project`:只看当前项目
|
|
86
|
+
- `-u, --user`:只看用户目录(默认用户目录和当前项目都看)
|
package/dist/init.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* init:
|
|
3
|
-
* 1. 没有全局安装时用 npm 全局安装本 CLI,之后终端里可以直接用 funcoding 或简写 fun(--no-global 跳过)
|
|
4
|
-
* 2. 把随 CLI 发布的 funcoding Skill(skill/funcoding/SKILL.md)装到智能体,让它知道什么时候、怎么用这个 CLI。
|
|
5
|
-
* 这个 Skill 不在网站目录里,来源记录标成 builtin,update 时从当前版本的 CLI 重新复制
|
|
6
|
-
*/
|
|
7
|
-
import { spawnSync } from 'node:child_process';
|
|
8
|
-
import { randomBytes } from 'node:crypto';
|
|
9
|
-
import { existsSync } from 'node:fs';
|
|
10
|
-
import { mkdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';
|
|
11
|
-
import { delimiter, dirname, join } from 'node:path';
|
|
12
|
-
import { AGENTS, skillsRoot } from './agents.js';
|
|
13
|
-
import { USER_AGENT, VERSION } from './api.js';
|
|
14
|
-
import { META_FILE, moveAway } from './install.js';
|
|
15
|
-
import { cyan, dim, done, fail, green, info, warn } from './ui.js';
|
|
16
|
-
const isWindows = process.platform === 'win32';
|
|
17
|
-
/** PATH 上能不能找到这个命令;npx 运行时会把临时目录加进 PATH,那些目录不算 */
|
|
18
|
-
export function onPath(command, env = process.env) {
|
|
19
|
-
const exts = isWindows ? ['.cmd', '.exe', ''] : [''];
|
|
20
|
-
return (env.PATH ?? '')
|
|
21
|
-
.split(delimiter)
|
|
22
|
-
.filter((dir) => dir && !/[\\/]_npx[\\/]/.test(dir))
|
|
23
|
-
.some((dir) => exts.some((ext) => existsSync(join(dir, command + ext))));
|
|
24
|
-
}
|
|
25
|
-
const EACCES_DOC = '权限不足时参考 https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally';
|
|
26
|
-
/** 全局安装当前版本;npm 的输出写到 stderr,不影响 --json 的 stdout */
|
|
27
|
-
function installGlobal() {
|
|
28
|
-
if (onPath('funcoding'))
|
|
29
|
-
return { status: 'present' };
|
|
30
|
-
const pkg = `funcoding-cli@${VERSION}`;
|
|
31
|
-
info(dim(`正在全局安装 ${pkg},之后可以直接使用 funcoding 或 fun 命令…`));
|
|
32
|
-
const r = spawnSync('npm', ['install', '--global', pkg], { stdio: ['ignore', process.stderr, process.stderr], shell: isWindows });
|
|
33
|
-
if (r.status === 0)
|
|
34
|
-
return { status: 'installed' };
|
|
35
|
-
return { status: 'failed', hint: `手动运行 npm install -g ${pkg}(${EACCES_DOC})` };
|
|
36
|
-
}
|
|
37
|
-
/** update:全局安装最新版,再用新版刷新已安装的 funcoding Skill */
|
|
38
|
-
export function selfUpdate() {
|
|
39
|
-
info(dim('正在用 npm 全局安装 funcoding-cli@latest…'));
|
|
40
|
-
const r = spawnSync('npm', ['install', '--global', 'funcoding-cli@latest'], { stdio: ['ignore', process.stderr, process.stderr], shell: isWindows });
|
|
41
|
-
if (r.status !== 0)
|
|
42
|
-
fail('error', '更新失败。', `手动运行 npm install -g funcoding-cli@latest(${EACCES_DOC})`);
|
|
43
|
-
const version = spawnSync('funcoding', ['--version'], { encoding: 'utf8', shell: isWindows }).stdout?.trim() || null;
|
|
44
|
-
// 让新版本把随包的 funcoding Skill 复制过去;没装过这个 Skill 时会报未找到,忽略
|
|
45
|
-
spawnSync('funcoding', ['skills', 'update', BUILTIN_ID, '--json'], { stdio: 'ignore', shell: isWindows });
|
|
46
|
-
done({ from: VERSION, to: version }, () => info(green(version && version !== VERSION ? `✓ 已从 ${VERSION} 更新到 ${version}` : `✓ 已是最新版本 ${version ?? VERSION}`)));
|
|
47
|
-
}
|
|
48
|
-
export const BUILTIN_ID = 'funcoding';
|
|
49
|
-
const SOURCE = new URL('../skill/funcoding/SKILL.md', import.meta.url);
|
|
50
|
-
export const builtinContent = () => readFile(SOURCE, 'utf8');
|
|
51
|
-
export async function installBuiltin(targets, force) {
|
|
52
|
-
const content = await builtinContent();
|
|
53
|
-
const dirs = targets.map((t) => ({ ...t, dir: join(skillsRoot(t.agent, t.scope), BUILTIN_ID) }));
|
|
54
|
-
const foreign = [];
|
|
55
|
-
for (const d of dirs) {
|
|
56
|
-
const meta = await readFile(join(d.dir, META_FILE), 'utf8').catch(() => null);
|
|
57
|
-
const present = meta !== null || (await stat(d.dir).then(() => true, () => false));
|
|
58
|
-
// 之前 init 装的直接换成新版;同名的其他 Skill 要 --force,并且先备份
|
|
59
|
-
if (present && !(meta && JSON.parse(meta).builtin))
|
|
60
|
-
foreign.push(d);
|
|
61
|
-
}
|
|
62
|
-
if (foreign.length > 0 && !force)
|
|
63
|
-
fail('exists', `${foreign.map((d) => d.dir).join('、')} 已存在,且不是 funcoding init 安装的。`, '确认要覆盖就加 --force(会先备份到配置目录)');
|
|
64
|
-
for (const d of dirs) {
|
|
65
|
-
const tmp = join(dirname(d.dir), `.funcoding-tmp-${randomBytes(4).toString('hex')}`);
|
|
66
|
-
await mkdir(tmp, { recursive: true });
|
|
67
|
-
await writeFile(join(tmp, 'SKILL.md'), content);
|
|
68
|
-
await writeFile(join(tmp, META_FILE), `${JSON.stringify({ id: BUILTIN_ID, name: BUILTIN_ID, builtin: true, installedAt: new Date().toISOString(), cli: USER_AGENT }, null, 2)}\n`);
|
|
69
|
-
if (foreign.includes(d))
|
|
70
|
-
await moveAway(d.dir, d.agent, BUILTIN_ID);
|
|
71
|
-
else
|
|
72
|
-
await rm(d.dir, { recursive: true, force: true });
|
|
73
|
-
await rename(tmp, d.dir);
|
|
74
|
-
}
|
|
75
|
-
return dirs;
|
|
76
|
-
}
|
|
77
|
-
export async function init(targets, force, global) {
|
|
78
|
-
const cli = global ? installGlobal() : { status: 'skipped' };
|
|
79
|
-
const dirs = await installBuiltin(targets, force);
|
|
80
|
-
done({ cli, installed: dirs.map((d) => ({ id: BUILTIN_ID, agent: d.agent, scope: d.scope, dir: d.dir })) }, () => {
|
|
81
|
-
if (cli.status === 'installed')
|
|
82
|
-
info(green(`✓ 已全局安装 funcoding-cli,在终端里输入 ${cyan('funcoding')} 或 ${cyan('fun')} 即可使用`));
|
|
83
|
-
if (cli.status === 'failed')
|
|
84
|
-
warn(`全局安装失败,${cli.hint}`);
|
|
85
|
-
for (const d of dirs)
|
|
86
|
-
info(green(`✓ 已把 funcoding Skill 装到 ${d.dir}`));
|
|
87
|
-
info(`之后可以直接让 ${dirs.map((d) => AGENTS[d.agent].label).join('、')} 帮你查找和安装 Skill、配置 MCP,例如「找一个处理 PDF 的 Skill 装上」。`);
|
|
88
|
-
info(dim(`也可以输入 ${[...new Set(dirs.map((d) => cyan(AGENTS[d.agent].invoke(BUILTIN_ID))))].join(' / ')} 主动调用。新开会话后生效。`));
|
|
89
|
-
});
|
|
90
|
-
}
|
package/skill/funcoding/SKILL.md
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: funcoding
|
|
3
|
-
description: 用 funcoding 命令行(funcoding-cli)从 funcoding.ai 查找并安装 Agent Skills 和 MCP Server,管理已安装的 Skill,同步用户在网站上的收藏,查看 AI 热点和日报,搜索和阅读 Claude Code、Codex、Cursor 等智能体的中文文档。当用户想找某类 Skill 或 MCP Server、安装或更新 Skill、配置 MCP、同步收藏、了解 AI 圈最近的新闻,或查阅 AI 编程工具的中文文档时使用。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# funcoding
|
|
7
|
-
|
|
8
|
-
本 Skill 说明如何使用 `funcoding` 命令行(npm 包 `funcoding-cli`,命令可简写为 `fun`)。
|
|
9
|
-
|
|
10
|
-
## 安装
|
|
11
|
-
|
|
12
|
-
如果 PATH 里找不到 `funcoding` 命令,运行下面的命令安装(需要 Node.js 18.17 及以上):
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npx --yes funcoding-cli@latest init --json
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
`init` 会全局安装本工具,并装上本 Skill。返回结果里 `cli.status` 为 `failed` 时(比如没有权限),把 `cli.hint` 告诉用户;在用户处理好之前,可以用 `npx --yes funcoding-cli@latest <命令>` 临时代替 `funcoding <命令>`。
|
|
19
|
-
|
|
20
|
-
`funcoding update` 会把本工具更新到最新版本,并同时更新本 Skill。
|
|
21
|
-
|
|
22
|
-
## 使用约定
|
|
23
|
-
|
|
24
|
-
- **始终加 `--json`**:stdout 只输出一个 JSON 对象。成功时是 `{ "ok": true, ... }`,失败时是 `{ "ok": false, "error": { "code", "message", "hint" } }`。过程提示写在 stderr,可以忽略。
|
|
25
|
-
- 出错时先看 `error.hint`,里面通常是下一步该运行的命令或该补的参数。
|
|
26
|
-
- 退出码:0 成功,1 一般错误,2 参数错误或缺少必填项,3 未找到,4 目标已存在(需要 `--force`),5 未登录或登录已过期。
|
|
27
|
-
- `--agent=<name>` 指定装给哪个智能体:`claude-code`、`codex`、`cursor`,多个用逗号分隔;`all` 表示本机检测到的全部智能体。不指定时默认装给 Claude Code。**如果你不是 Claude Code,请显式加上 `--agent`。**
|
|
28
|
-
- `--project` 装到当前项目(可以随仓库提交,团队共用);不加时装到用户目录,对所有项目生效。
|
|
29
|
-
- 不确定某条命令的参数时,运行 `funcoding <命令> --help`,比如 `funcoding skills add --help`。
|
|
30
|
-
- `funcoding info --json` 返回本机环境:已安装的智能体、各自的 Skill 目录、登录状态。
|
|
31
|
-
|
|
32
|
-
## Skill 管理
|
|
33
|
-
|
|
34
|
-
使用 `skills` 命令:
|
|
35
|
-
|
|
36
|
-
1. `funcoding skills find <query>`:查找 Skill。结果里的 `skills[].id` 形如 `owner/repo/skill`。
|
|
37
|
-
2. **安装前先检查**:`funcoding skills info <id>` 返回 SKILL.md 全文(`skill.content`)和文件清单(`skill.files`,其中的可执行脚本列在 `skill.scripts`)。用一两句话告诉用户这个 Skill 做什么;如果有执行任意命令、读取或外传密钥和个人数据、修改系统设置等危险操作,要明确指出。**得到用户确认后再安装。**
|
|
38
|
-
3. `funcoding skills add <id>... [--agent=<name>] [--project]`:安装。目录已存在时会以退出码 4 停下;向用户确认后再加 `--force`,旧版本会备份到配置目录。
|
|
39
|
-
4. 告诉用户装到了哪个目录(`installed[].dir`),以及如何调用:Claude Code 和 Cursor 输入 `/<目录名>`,Codex 输入 `$<目录名>`,也可以直接描述任务,让智能体自动选用。新装的 Skill 可能需要新开会话才会加载。
|
|
40
|
-
|
|
41
|
-
管理已安装的 Skill:
|
|
42
|
-
|
|
43
|
-
- `funcoding skills list`:列出所有智能体在用户目录和当前项目里的 Skill。`source` 不为空的是通过 funcoding 安装的。
|
|
44
|
-
- `funcoding skills update --check`:检查远端 SKILL.md 是否有变化,不安装。`funcoding skills update [<name>]`:按原来源重新安装。
|
|
45
|
-
- `funcoding skills remove <name>...`:删除前会先备份。只能删除通过 funcoding 安装的 Skill;删除其他 Skill 需要加 `--force`,务必先征得用户同意。
|
|
46
|
-
|
|
47
|
-
## MCP 配置
|
|
48
|
-
|
|
49
|
-
使用 `mcp` 命令:
|
|
50
|
-
|
|
51
|
-
1. `funcoding mcp find <query>`:查找 MCP Server。结果里的 `servers[].id` 形如 `owner/repo`。
|
|
52
|
-
2. `funcoding mcp info <id>`:查看可用的启动方式(`server.launches`),每种方式需要的环境变量(`env`)或请求头(`headers`),以及是否必填。
|
|
53
|
-
3. `funcoding mcp add <id> [--agent=<name>] [--project] [--env=KEY=VALUE ...] [--header=KEY=VALUE ...] [--via=remote|npm|pypi]`:
|
|
54
|
-
- 缺少必填项时,会以退出码 2 返回,`error.missing` 列出缺少的项。**向用户索取这些值,不要编造。** 密钥只通过参数传入,不要写进其他文件。
|
|
55
|
-
- 没有登记标准安装包时,会以退出码 3 返回,`error.readme` 是 README 地址。这时按 README 手动配置。
|
|
56
|
-
4. 配置在重启智能体或新开会话后生效。Claude Code 项目范围的 Server 需要用户在 Claude Code 里确认后才会启用。
|
|
57
|
-
5. `funcoding mcp list` 列出已配置的 Server;`funcoding mcp remove <name>...` 删除,删除前会备份原文件。
|
|
58
|
-
|
|
59
|
-
## 收藏
|
|
60
|
-
|
|
61
|
-
用户在 funcoding.ai 上收藏的 Skill 和 MCP Server,需要先登录:
|
|
62
|
-
|
|
63
|
-
- `funcoding auth status`:查看是否已登录。返回退出码 5 表示未登录。
|
|
64
|
-
- `funcoding auth login`:会显示验证码和授权地址(在 stderr 中),并尝试打开浏览器。把地址和验证码告诉用户,请用户在浏览器中确认;命令会一直等到用户确认后才返回。
|
|
65
|
-
- `funcoding favorites list`:列出收藏。
|
|
66
|
-
- `funcoding favorites sync [--agent=<name>] [--project] [--dry-run]`:安装全部收藏,已装的跳过。建议先用 `--dry-run` 给用户看将要安装什么。`items[]` 里 `status` 为 `skipped` 的条目附有原因和提示,通常是 MCP 缺少必填的环境变量。
|
|
67
|
-
|
|
68
|
-
## AI 热点
|
|
69
|
-
|
|
70
|
-
- `funcoding news list [--limit=<n>]`:当前 AI 热榜(多家来源报道的事件,按热度排序,附中文标题和摘要)。
|
|
71
|
-
- `funcoding news daily [<YYYY-MM-DD>]`:某一天的 AI 日报,不写日期时为最新一期。
|
|
72
|
-
|
|
73
|
-
## 文档
|
|
74
|
-
|
|
75
|
-
`docs` 命令用来查阅 AI 编程智能体的中文文档。这些文档按官方文档的章节结构整理,并标注了官方来源和核实日期。
|
|
76
|
-
|
|
77
|
-
- `funcoding docs search <query> [--agent=<slug>]`:搜索文档。这里的 `--agent` 可以是站内任意智能体,比如 `claude-code`、`codex`、`cursor`、`gemini-cli`。
|
|
78
|
-
- `funcoding docs fetch <agent>/<path>`:读取文档全文(Markdown),开头附官方来源链接和核实日期。命令、配置和价格以官方文档为准。
|
|
79
|
-
|
|
80
|
-
## `funcoding help` 输出
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
Usage: funcoding [-hV] [--json] <command>
|
|
84
|
-
|
|
85
|
-
Commands:
|
|
86
|
-
init 初始化:全局安装本工具(之后可用 funcoding 或 fun),并给智能体装上 funcoding Skill
|
|
87
|
-
update 把本工具更新到最新版本,并刷新已安装的 funcoding Skill
|
|
88
|
-
info 环境信息:版本、站点、登录状态、本机的智能体和 Skill 目录、配置目录
|
|
89
|
-
help 显示帮助
|
|
90
|
-
skills 查找、安装和管理 Agent Skills(find / info / add / list / update / remove)
|
|
91
|
-
mcp 查找 MCP Server,并写入各智能体的 MCP 配置(find / info / add / list / remove)
|
|
92
|
-
favorites 网站上收藏的 Skill 和 MCP Server(list / sync)
|
|
93
|
-
auth 登录 funcoding.ai(login / logout / status)
|
|
94
|
-
news AI 热点(list / daily)
|
|
95
|
-
docs AI 编程智能体的中文文档(search / fetch)
|
|
96
|
-
```
|