openyida 2026.4.2-beta.12 → 2026.4.2-beta.13
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/lib/core/copy.js +1 -1
- package/lib/core/env.js +1 -1
- package/lib/core/utils.js +2 -2
- package/package.json +1 -1
- package/project/pages/src/demo-birthday-game.js +0 -1
- package/scripts/postinstall.js +58 -57
- package/yida-skills/SKILL.md +3 -3
package/lib/core/copy.js
CHANGED
|
@@ -194,7 +194,7 @@ function resolveDestBaseFromEnv(activeToolName, activeProjectRoot, envResults) {
|
|
|
194
194
|
if (isWukong) {
|
|
195
195
|
return activeProjectRoot
|
|
196
196
|
? path.dirname(activeProjectRoot)
|
|
197
|
-
: path.join(process.env.AGENT_WORK_ROOT || path.join(os.homedir(), '.real', 'workspace')
|
|
197
|
+
: path.join(process.env.AGENT_WORK_ROOT || path.join(os.homedir(), '.real'), 'workspace');
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
if (activeToolName) {
|
package/lib/core/env.js
CHANGED
|
@@ -55,7 +55,7 @@ function detectEnvironment() {
|
|
|
55
55
|
const isActive = activeTool && activeTool.dirName === dirName;
|
|
56
56
|
// path.join 在 Windows 上自动使用反斜杠,兼容所有平台
|
|
57
57
|
const workspaceRoot = isWukong
|
|
58
|
-
? path.join(process.env.AGENT_WORK_ROOT || path.join(home, '.real', 'workspace'
|
|
58
|
+
? path.join(process.env.AGENT_WORK_ROOT || path.join(home, '.real'), 'workspace', 'project')
|
|
59
59
|
: cwdProject;
|
|
60
60
|
const hasProject = fs.existsSync(workspaceRoot);
|
|
61
61
|
|
package/lib/core/utils.js
CHANGED
|
@@ -82,13 +82,13 @@ function detectActiveTool() {
|
|
|
82
82
|
|
|
83
83
|
// 悟空(Wukong)
|
|
84
84
|
// Windows 路径可能使用反斜杠,需同时兼容正斜杠和反斜杠
|
|
85
|
+
// AGENT_WORK_ROOT 指向 ~/.real/users/user-{uuid}/,workspace 在其下的 workspace/ 子目录
|
|
85
86
|
if (env.AGENT_WORK_ROOT && (env.AGENT_WORK_ROOT.includes('.real') || env.AGENT_WORK_ROOT.includes(path.join('.real')))) {
|
|
86
87
|
return {
|
|
87
88
|
tool: 'wukong',
|
|
88
89
|
displayName: '悟空(Wukong)',
|
|
89
90
|
dirName: '.real',
|
|
90
|
-
|
|
91
|
-
workspaceRoot: path.join(env.AGENT_WORK_ROOT, 'project'),
|
|
91
|
+
workspaceRoot: path.join(env.AGENT_WORK_ROOT, 'workspace', 'project'),
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* postinstall hook:
|
|
3
|
+
* postinstall hook: skills installation + welcome guide after `npm install -g openyida`
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* 职责:
|
|
6
|
+
* 1. 清理旧版本遗留的错误安装(~/.xxx/yida-skills/,缺少 skills/ 中间层级)
|
|
7
|
+
* 2. 将 yida-skills/ 安装到各 AI 工具的正确 skills 目录
|
|
8
|
+
* 3. 首次安装欢迎引导
|
|
7
9
|
*
|
|
8
|
-
*
|
|
10
|
+
* 正确的 skills 安装路径(所有工具统一使用 skills/ 子目录):
|
|
11
|
+
* ~/.claude/skills/yida-skills/ ← <package>/yida-skills (copy)
|
|
12
|
+
* ~/.opencode/skills/yida-skills/ ← <package>/yida-skills (copy)
|
|
13
|
+
* ~/.aone_copilot/skills/yida-skills/ ← <package>/yida-skills (copy)
|
|
14
|
+
* ~/.cursor/skills/yida-skills/ ← <package>/yida-skills (copy)
|
|
15
|
+
* ~/.qoder/skills/yida-skills/ ← <package>/yida-skills (copy)
|
|
9
16
|
*
|
|
10
|
-
*
|
|
11
|
-
* ~/.claude/yida-skills → <package>/yida-skills
|
|
12
|
-
* ~/.opencode/yida-skills → <package>/yida-skills
|
|
13
|
-
* ~/.aone_copilot/yida-skills → <package>/yida-skills
|
|
14
|
-
* ~/.cursor/yida-skills → <package>/yida-skills
|
|
15
|
-
* ~/.qoder/yida-skills → <package>/yida-skills
|
|
16
|
-
* ~/.real/yida-skills → <package>/yida-skills (Wukong)
|
|
17
|
+
* 悟空(Wukong)通过手动上传技能,不在此安装。
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
'use strict';
|
|
@@ -37,15 +38,6 @@ function safeExec(fn) {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
/**
|
|
41
|
-
* Ensure a directory exists (mkdir -p).
|
|
42
|
-
*/
|
|
43
|
-
function ensureDir(dirPath) {
|
|
44
|
-
if (!fs.existsSync(dirPath)) {
|
|
45
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
41
|
/**
|
|
50
42
|
* Recursively copy a directory, overwriting existing files.
|
|
51
43
|
*/
|
|
@@ -65,77 +57,86 @@ function copyDirRecursive(src, dest) {
|
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* Uses file copy instead of symlink to ensure AI tools can always
|
|
71
|
-
* discover skills on the first run (fixes #186).
|
|
72
|
-
*
|
|
73
|
-
* - If an old symlink exists → remove it first, then copy.
|
|
74
|
-
* - If a real directory exists → remove and do a clean copy.
|
|
60
|
+
* 清理旧版遗留的错误路径(软链接或目录)。
|
|
75
61
|
*/
|
|
76
|
-
function
|
|
77
|
-
const destPath = path.join(ideConfigDir, 'yida-skills');
|
|
78
|
-
|
|
79
|
-
ensureDir(ideConfigDir);
|
|
80
|
-
|
|
81
|
-
let existingStat = null;
|
|
62
|
+
function cleanupLegacy(dirPath) {
|
|
82
63
|
try {
|
|
83
|
-
|
|
64
|
+
const stat = fs.lstatSync(dirPath);
|
|
65
|
+
if (stat.isSymbolicLink()) {
|
|
66
|
+
fs.unlinkSync(dirPath);
|
|
67
|
+
} else if (stat.isDirectory()) {
|
|
68
|
+
fs.rmSync(dirPath, { recursive: true, force: true });
|
|
69
|
+
}
|
|
84
70
|
} catch {
|
|
85
|
-
/*
|
|
71
|
+
/* not exists, ok */
|
|
86
72
|
}
|
|
73
|
+
}
|
|
87
74
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
75
|
+
/**
|
|
76
|
+
* 将 yida-skills 安装到 AI 工具的 skills 目录。
|
|
77
|
+
* 正确路径:~/<tool-config>/skills/yida-skills/
|
|
78
|
+
*
|
|
79
|
+
* 同时清理旧版遗留在根目录的错误安装:~/<tool-config>/yida-skills/
|
|
80
|
+
*/
|
|
81
|
+
function installSkillsToTool(toolConfigDir) {
|
|
82
|
+
// 清理旧版遗留在根目录的错误安装(缺少 skills/ 中间层级)
|
|
83
|
+
cleanupLegacy(path.join(toolConfigDir, 'yida-skills'));
|
|
96
84
|
|
|
85
|
+
// 安装到正确路径:~/<tool-config>/skills/yida-skills/
|
|
86
|
+
const skillsDir = path.join(toolConfigDir, 'skills');
|
|
87
|
+
const destPath = path.join(skillsDir, 'yida-skills');
|
|
88
|
+
|
|
89
|
+
fs.mkdirSync(skillsDir, { recursive: true });
|
|
90
|
+
|
|
91
|
+
// 如果已存在,先清理(旧软链接或旧目录)
|
|
92
|
+
cleanupLegacy(destPath);
|
|
93
|
+
|
|
94
|
+
// 复制文件(不用软链接,确保 AI 工具首次扫描就能发现)
|
|
97
95
|
copyDirRecursive(SKILLS_DIR, destPath);
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
// ── 1. Skills
|
|
98
|
+
// ── 1. Skills 安装 ───────────────────────────────────────────────────
|
|
99
|
+
// 安装到各 AI 工具的正确 skills 目录(悟空跳过,悟空通过手动上传技能)
|
|
101
100
|
|
|
102
|
-
// Claude Code
|
|
101
|
+
// Claude Code — 始终安装(Claude Code 是主要目标用户)
|
|
103
102
|
safeExec(() => {
|
|
104
|
-
|
|
103
|
+
installSkillsToTool(path.join(HOME_DIR, '.claude'));
|
|
105
104
|
});
|
|
106
105
|
|
|
107
|
-
// OpenCode
|
|
106
|
+
// OpenCode — 仅在已安装时安装
|
|
108
107
|
safeExec(() => {
|
|
109
108
|
if (fs.existsSync(path.join(HOME_DIR, '.opencode'))) {
|
|
110
|
-
|
|
109
|
+
installSkillsToTool(path.join(HOME_DIR, '.opencode'));
|
|
111
110
|
}
|
|
112
111
|
});
|
|
113
112
|
|
|
114
|
-
// Aone Copilot
|
|
113
|
+
// Aone Copilot — 仅在已安装时安装
|
|
115
114
|
safeExec(() => {
|
|
116
115
|
if (fs.existsSync(path.join(HOME_DIR, '.aone_copilot'))) {
|
|
117
|
-
|
|
116
|
+
installSkillsToTool(path.join(HOME_DIR, '.aone_copilot'));
|
|
118
117
|
}
|
|
119
118
|
});
|
|
120
119
|
|
|
121
|
-
// Cursor
|
|
120
|
+
// Cursor — 仅在已安装时安装
|
|
122
121
|
safeExec(() => {
|
|
123
122
|
if (fs.existsSync(path.join(HOME_DIR, '.cursor'))) {
|
|
124
|
-
|
|
123
|
+
installSkillsToTool(path.join(HOME_DIR, '.cursor'));
|
|
125
124
|
}
|
|
126
125
|
});
|
|
127
126
|
|
|
128
|
-
// Qoder
|
|
127
|
+
// Qoder — 仅在已安装时安装
|
|
129
128
|
safeExec(() => {
|
|
130
129
|
if (fs.existsSync(path.join(HOME_DIR, '.qoder'))) {
|
|
131
|
-
|
|
130
|
+
installSkillsToTool(path.join(HOME_DIR, '.qoder'));
|
|
132
131
|
}
|
|
133
132
|
});
|
|
134
133
|
|
|
135
|
-
//
|
|
136
|
-
|
|
134
|
+
// 悟空(Wukong)— 跳过安装,只清理旧版遗留
|
|
135
|
+
safeExec(() => {
|
|
136
|
+
cleanupLegacy(path.join(HOME_DIR, '.real', 'yida-skills'));
|
|
137
|
+
});
|
|
137
138
|
|
|
138
|
-
// ──
|
|
139
|
+
// ── 2. 首次安装欢迎引导 ──────────────────────────────────────────────
|
|
139
140
|
|
|
140
141
|
safeExec(() => {
|
|
141
142
|
const FIRST_INSTALL_FLAG = path.join(HOME_DIR, '.openyida', 'installed');
|
package/yida-skills/SKILL.md
CHANGED
|
@@ -4,7 +4,7 @@ description: >
|
|
|
4
4
|
宜搭低代码平台 AI 开发入口。一句话生成完整应用:创建应用、表单设计、自定义页面、流程配置、数据管理。
|
|
5
5
|
当用户提到"宜搭"、"yida"、"低代码"、"创建应用"、"创建表单"、"发布页面"、"搭建"、"系统"、"应用"时触发。
|
|
6
6
|
metadata:
|
|
7
|
-
version: 2026.04.02-beta.
|
|
7
|
+
version: 2026.04.02-beta.13
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# 宜搭 AI 应用开发指南
|
|
@@ -30,10 +30,10 @@ metadata:
|
|
|
30
30
|
## ⚡ 首要步骤(每次必须先执行)
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
# 1. 确保 openyida
|
|
33
|
+
# 1. 确保 openyida 已安装(未安装则自动安装,已安装则跳过)
|
|
34
34
|
openyida -v 2>/dev/null || npm install -g openyida@latest
|
|
35
35
|
|
|
36
|
-
# 2.
|
|
36
|
+
# 2. 一键诊断并自动修复:环境检测 + project 目录初始化
|
|
37
37
|
openyida doctor --fix
|
|
38
38
|
```
|
|
39
39
|
|