@blueking/bkui-knowledge 0.0.1-beta.2 → 0.0.1-beta.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.
- package/README.md +18 -3
- package/bin/bkui-knowledge.js +19 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,19 +10,34 @@
|
|
|
10
10
|
|
|
11
11
|
只需添加 MCP 服务配置:
|
|
12
12
|
|
|
13
|
+
**方式一:npx(推荐)**
|
|
14
|
+
|
|
13
15
|
```json
|
|
14
16
|
{
|
|
15
17
|
"mcpServers": {
|
|
16
18
|
"bkui-knowledge": {
|
|
17
19
|
"command": "npx",
|
|
18
|
-
"args": ["-y", "@blueking/bkui-knowledge"]
|
|
19
|
-
|
|
20
|
+
"args": ["-y", "@blueking/bkui-knowledge", "${workspaceFolder}"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**方式二:本地开发**
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"bkui-knowledge": {
|
|
32
|
+
"command": "node",
|
|
33
|
+
"args": ["/path/to/bkui-knowledge/bin/bkui-knowledge.js"],
|
|
34
|
+
"cwd": "/path/to/your-project"
|
|
20
35
|
}
|
|
21
36
|
}
|
|
22
37
|
}
|
|
23
38
|
```
|
|
24
39
|
|
|
25
|
-
> ⚠️
|
|
40
|
+
> ⚠️ 必须传递项目路径,否则 skills 无法同步到正确位置
|
|
26
41
|
|
|
27
42
|
**特性:**
|
|
28
43
|
- ✅ 首次启动自动同步推荐 skills 到 `.cursor/skills/`
|
package/bin/bkui-knowledge.js
CHANGED
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
* "mcpServers": {
|
|
12
12
|
* "bkui-knowledge": {
|
|
13
13
|
* "command": "npx",
|
|
14
|
-
* "args": ["-y", "@blueking/bkui-knowledge"]
|
|
15
|
-
* "cwd": "${workspaceFolder}"
|
|
14
|
+
* "args": ["-y", "@blueking/bkui-knowledge", "${workspaceFolder}"]
|
|
16
15
|
* }
|
|
17
16
|
* }
|
|
18
17
|
* }
|
|
19
18
|
*
|
|
20
|
-
*
|
|
19
|
+
* 项目路径传递方式(优先级从高到低):
|
|
20
|
+
* 1. 命令行参数: npx @blueking/bkui-knowledge /path/to/project
|
|
21
|
+
* 2. 环境变量: BKUI_PROJECT_ROOT=/path/to/project
|
|
22
|
+
* 3. 当前工作目录 (cwd)
|
|
21
23
|
*
|
|
22
24
|
* 更新机制:
|
|
23
25
|
* - skills 内置在 npm 包中
|
|
@@ -45,9 +47,19 @@ function log(msg) {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
/**
|
|
48
|
-
*
|
|
50
|
+
* 获取用户项目根目录
|
|
51
|
+
* 优先级:命令行参数 > 环境变量 > cwd
|
|
49
52
|
*/
|
|
50
53
|
function getProjectRoot() {
|
|
54
|
+
// 1. 命令行参数: node bkui-knowledge.js /path/to/project
|
|
55
|
+
if (process.argv[2] && !process.argv[2].startsWith('-')) {
|
|
56
|
+
return process.argv[2];
|
|
57
|
+
}
|
|
58
|
+
// 2. 环境变量: BKUI_PROJECT_ROOT=/path/to/project
|
|
59
|
+
if (process.env.BKUI_PROJECT_ROOT) {
|
|
60
|
+
return process.env.BKUI_PROJECT_ROOT;
|
|
61
|
+
}
|
|
62
|
+
// 3. 默认使用 cwd
|
|
51
63
|
return process.cwd();
|
|
52
64
|
}
|
|
53
65
|
|
|
@@ -311,6 +323,9 @@ async function startMcpServer() {
|
|
|
311
323
|
async function main() {
|
|
312
324
|
const projectRoot = getProjectRoot();
|
|
313
325
|
|
|
326
|
+
// 调试:输出实际的工作目录
|
|
327
|
+
log(`工作目录: ${projectRoot}`);
|
|
328
|
+
|
|
314
329
|
// 1. 同步 skills(同步执行,从 npm 包读取)
|
|
315
330
|
syncSkills(projectRoot);
|
|
316
331
|
|