openyida 0.1.2
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/.cache/.gitkeep +0 -0
- package/.eslintrc.json +25 -0
- package/.github/workflows/ci.yml +123 -0
- package/.github/workflows/publish.yml +105 -0
- package/.github/workflows/update-contributors.yml +151 -0
- package/.openclaw/skills/yida-issue/SKILL.md +27 -0
- package/.openclaw/skills/yida-issue/scripts/create-issue.js +317 -0
- package/CLAUDE.md +168 -0
- package/CONTRIBUTING.md +59 -0
- package/LICENSE +21 -0
- package/README.md +106 -0
- package/bin/yida.js +811 -0
- package/config.json +4 -0
- package/install-skills.ps1 +162 -0
- package/install-skills.sh +175 -0
- package/package.json +34 -0
- package/pages/dist/.gitkeep +0 -0
- package/pages/src/.gitkeep +0 -0
- package/prd/salary-calculator.md +15 -0
- package/tests/cli.test.js +930 -0
- package/tests/install.test.js +277 -0
- package/tests/yida-issue.test.js +314 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* yida-issue: 一句话给 OpenYida 提需求
|
|
4
|
+
*
|
|
5
|
+
* 用法:
|
|
6
|
+
* node create-issue.js <需求描述> [--repo openyida|yida-skills] [--type feature|bug] [--dry-run]
|
|
7
|
+
*
|
|
8
|
+
* 自动判断需求应该提到 openyida/openyida 还是 openyida/yida-skills,
|
|
9
|
+
* 并通过 gh CLI 创建格式规范的 GitHub Issue。
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
14
|
+
const { execSync } = require("child_process");
|
|
15
|
+
const fs = require("fs");
|
|
16
|
+
const os = require("os");
|
|
17
|
+
const path = require("path");
|
|
18
|
+
|
|
19
|
+
// ── 路由规则 ──────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* openyida/openyida 仓库的关键词(平台工具、CLI、CI/CD 等)
|
|
23
|
+
*/
|
|
24
|
+
const OPENYIDA_KEYWORDS = [
|
|
25
|
+
"cli", "命令行", "命令", "install", "安装脚本", "安装",
|
|
26
|
+
"workflow", "ci", "cd", "github action", "贡献者", "contributor",
|
|
27
|
+
"readme", "文档", "package", "npm", "发布工具", "版本管理",
|
|
28
|
+
"openclaw", "openyida", "bin/yida", "yida shell", "yida config",
|
|
29
|
+
"yida login命令", "yida logout命令",
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* openyida/yida-skills 仓库的关键词(宜搭操作能力)
|
|
34
|
+
*/
|
|
35
|
+
const YIDA_SKILLS_KEYWORDS = [
|
|
36
|
+
"登录", "登出", "login", "logout", "扫码", "cookie", "token", "csrf",
|
|
37
|
+
"创建应用", "创建页面", "创建表单", "发布页面", "发布", "publish",
|
|
38
|
+
"schema", "宜搭 api", "宜搭api", "skill", "表单", "应用", "页面",
|
|
39
|
+
"宜搭", "aliwork", "yida-create", "yida-publish", "yida-get",
|
|
40
|
+
"get-schema", "create-app", "create-page", "create-form",
|
|
41
|
+
"批量", "导出", "字段", "数据", "接口",
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 根据需求描述自动判断目标仓库
|
|
46
|
+
* @returns {'openyida/openyida' | 'openyida/yida-skills' | null} null 表示无法判断
|
|
47
|
+
*/
|
|
48
|
+
function detectTargetRepo(description) {
|
|
49
|
+
const lowerDesc = description.toLowerCase();
|
|
50
|
+
|
|
51
|
+
let openyidaScore = 0;
|
|
52
|
+
let yidaSkillsScore = 0;
|
|
53
|
+
|
|
54
|
+
for (const keyword of OPENYIDA_KEYWORDS) {
|
|
55
|
+
if (lowerDesc.includes(keyword.toLowerCase())) {
|
|
56
|
+
openyidaScore++;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (const keyword of YIDA_SKILLS_KEYWORDS) {
|
|
61
|
+
if (lowerDesc.includes(keyword.toLowerCase())) {
|
|
62
|
+
yidaSkillsScore++;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (openyidaScore === 0 && yidaSkillsScore === 0) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (openyidaScore > yidaSkillsScore) {
|
|
71
|
+
return "openyida/openyida";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (yidaSkillsScore > openyidaScore) {
|
|
75
|
+
return "openyida/yida-skills";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 平分时返回 null,让用户手动选择
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 判断 Issue 类型(feature 或 bug)
|
|
84
|
+
*/
|
|
85
|
+
function detectIssueType(description) {
|
|
86
|
+
const lowerDesc = description.toLowerCase();
|
|
87
|
+
const bugKeywords = ["bug", "错误", "报错", "失败", "异常", "不生效", "不显示", "崩溃", "修复", "fix"];
|
|
88
|
+
for (const keyword of bugKeywords) {
|
|
89
|
+
if (lowerDesc.includes(keyword)) {
|
|
90
|
+
return "bug";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return "feature";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 生成 Issue 标题
|
|
98
|
+
*/
|
|
99
|
+
function generateTitle(description, issueType) {
|
|
100
|
+
// 去掉开头的 bug:/feat:/feature: 前缀(如果有)
|
|
101
|
+
const cleanDesc = description
|
|
102
|
+
.replace(/^(bug|feat|feature|fix)\s*[::]\s*/i, "")
|
|
103
|
+
.trim();
|
|
104
|
+
|
|
105
|
+
if (issueType === "bug") {
|
|
106
|
+
return `bug: ${cleanDesc}`;
|
|
107
|
+
}
|
|
108
|
+
return `[Feature] ${cleanDesc}`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 生成 Issue body
|
|
113
|
+
*/
|
|
114
|
+
function generateBody(description, issueType, targetRepo) {
|
|
115
|
+
const repoLabel = targetRepo === "openyida/openyida"
|
|
116
|
+
? "平台工具(CLI / CI / 安装脚本等)"
|
|
117
|
+
: "宜搭操作能力(登录 / 创建应用 / 发布 / Schema 等)";
|
|
118
|
+
|
|
119
|
+
if (issueType === "bug") {
|
|
120
|
+
return `## Bug 描述
|
|
121
|
+
|
|
122
|
+
${description}
|
|
123
|
+
|
|
124
|
+
## 复现步骤
|
|
125
|
+
|
|
126
|
+
(请补充复现步骤)
|
|
127
|
+
|
|
128
|
+
1.
|
|
129
|
+
2.
|
|
130
|
+
3.
|
|
131
|
+
|
|
132
|
+
## 期望行为
|
|
133
|
+
|
|
134
|
+
(请描述期望的正确行为)
|
|
135
|
+
|
|
136
|
+
## 实际行为
|
|
137
|
+
|
|
138
|
+
(请描述实际发生的错误行为)
|
|
139
|
+
|
|
140
|
+
## 环境信息
|
|
141
|
+
|
|
142
|
+
- OS:
|
|
143
|
+
- Node.js 版本:
|
|
144
|
+
- 相关版本:
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
> 此 Issue 由 [yida-issue skill](https://github.com/openyida/openyida/tree/main/.openclaw/skills/yida-issue) 自动创建,路由到 **${repoLabel}**。`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return `## 需求描述
|
|
151
|
+
|
|
152
|
+
${description}
|
|
153
|
+
|
|
154
|
+
## 期望功能
|
|
155
|
+
|
|
156
|
+
(请补充详细的期望功能描述)
|
|
157
|
+
|
|
158
|
+
## 使用场景
|
|
159
|
+
|
|
160
|
+
(请描述此功能的使用场景和价值)
|
|
161
|
+
|
|
162
|
+
## 优先级
|
|
163
|
+
|
|
164
|
+
中
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
> 此 Issue 由 [yida-issue skill](https://github.com/openyida/openyida/tree/main/.openclaw/skills/yida-issue) 自动创建,路由到 **${repoLabel}**。`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// ── 参数解析 ──────────────────────────────────────────────────────────
|
|
171
|
+
|
|
172
|
+
function parseArgs(argv) {
|
|
173
|
+
const args = argv.slice(2);
|
|
174
|
+
const options = {
|
|
175
|
+
description: "",
|
|
176
|
+
repo: null,
|
|
177
|
+
type: null,
|
|
178
|
+
dryRun: false,
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const descParts = [];
|
|
182
|
+
|
|
183
|
+
for (let i = 0; i < args.length; i++) {
|
|
184
|
+
if (args[i] === "--repo" && args[i + 1]) {
|
|
185
|
+
const repoArg = args[++i].toLowerCase();
|
|
186
|
+
if (repoArg === "openyida") {
|
|
187
|
+
options.repo = "openyida/openyida";
|
|
188
|
+
} else if (repoArg === "yida-skills") {
|
|
189
|
+
options.repo = "openyida/yida-skills";
|
|
190
|
+
} else {
|
|
191
|
+
console.error(`❌ 无效的 --repo 参数:${repoArg},可选值:openyida | yida-skills`);
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
194
|
+
} else if (args[i] === "--type" && args[i + 1]) {
|
|
195
|
+
const typeArg = args[++i].toLowerCase();
|
|
196
|
+
if (typeArg === "bug" || typeArg === "feature" || typeArg === "feat") {
|
|
197
|
+
options.type = typeArg === "feat" ? "feature" : typeArg;
|
|
198
|
+
} else {
|
|
199
|
+
console.error(`❌ 无效的 --type 参数:${typeArg},可选值:feature | bug`);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
} else if (args[i] === "--dry-run") {
|
|
203
|
+
options.dryRun = true;
|
|
204
|
+
} else if (!args[i].startsWith("--")) {
|
|
205
|
+
descParts.push(args[i]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
options.description = descParts.join(" ").trim();
|
|
210
|
+
return options;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// ── 主流程 ────────────────────────────────────────────────────────────
|
|
214
|
+
|
|
215
|
+
function main() {
|
|
216
|
+
const options = parseArgs(process.argv);
|
|
217
|
+
|
|
218
|
+
if (!options.description) {
|
|
219
|
+
console.error("❌ 请提供需求描述");
|
|
220
|
+
console.error("");
|
|
221
|
+
console.error("用法:");
|
|
222
|
+
console.error(" node create-issue.js <需求描述> [--repo openyida|yida-skills] [--type feature|bug] [--dry-run]");
|
|
223
|
+
console.error("");
|
|
224
|
+
console.error("示例:");
|
|
225
|
+
console.error(' node create-issue.js "希望支持批量导出表单数据"');
|
|
226
|
+
console.error(' node create-issue.js "CLI 新增 yida list 命令" --repo openyida');
|
|
227
|
+
console.error(' node create-issue.js "bug: 创建应用时图标颜色不生效" --type bug');
|
|
228
|
+
process.exit(1);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
console.log("🔍 分析需求...");
|
|
232
|
+
console.log(` 需求:${options.description}`);
|
|
233
|
+
console.log("");
|
|
234
|
+
|
|
235
|
+
// 判断目标仓库
|
|
236
|
+
let targetRepo = options.repo;
|
|
237
|
+
if (!targetRepo) {
|
|
238
|
+
targetRepo = detectTargetRepo(options.description);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!targetRepo) {
|
|
242
|
+
console.log("⚠️ 无法自动判断目标仓库,请手动指定:");
|
|
243
|
+
console.log("");
|
|
244
|
+
console.log(" --repo openyida → openyida/openyida(CLI、CI/CD、安装脚本等平台工具)");
|
|
245
|
+
console.log(" --repo yida-skills → openyida/yida-skills(宜搭操作能力:登录/创建/发布/Schema)");
|
|
246
|
+
console.log("");
|
|
247
|
+
console.log("示例:");
|
|
248
|
+
console.log(` node create-issue.js "${options.description}" --repo yida-skills`);
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// 判断 Issue 类型
|
|
253
|
+
const issueType = options.type || detectIssueType(options.description);
|
|
254
|
+
|
|
255
|
+
// 生成标题和 body
|
|
256
|
+
const title = generateTitle(options.description, issueType);
|
|
257
|
+
const body = generateBody(options.description, issueType, targetRepo);
|
|
258
|
+
|
|
259
|
+
const repoLabel = targetRepo === "openyida/openyida"
|
|
260
|
+
? "平台工具(CLI / CI / 安装脚本等)"
|
|
261
|
+
: "宜搭操作能力(登录 / 创建应用 / 发布 / Schema 等)";
|
|
262
|
+
|
|
263
|
+
console.log(`📦 目标仓库:${targetRepo}(${repoLabel})`);
|
|
264
|
+
console.log(`📝 Issue 类型:${issueType === "bug" ? "🐛 Bug" : "✨ Feature"}`);
|
|
265
|
+
console.log(`📌 标题:${title}`);
|
|
266
|
+
console.log("");
|
|
267
|
+
|
|
268
|
+
if (options.dryRun) {
|
|
269
|
+
console.log("🔍 [dry-run 模式] Issue 内容预览:");
|
|
270
|
+
console.log("─".repeat(60));
|
|
271
|
+
console.log(body);
|
|
272
|
+
console.log("─".repeat(60));
|
|
273
|
+
console.log("");
|
|
274
|
+
console.log("✅ dry-run 完成,未实际创建 Issue");
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// 检查 gh CLI 是否可用
|
|
279
|
+
try {
|
|
280
|
+
execSync("gh --version", { stdio: "pipe" });
|
|
281
|
+
} catch {
|
|
282
|
+
console.error("❌ 未找到 gh CLI,请先安装:https://cli.github.com/");
|
|
283
|
+
process.exit(1);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// 创建 Issue(用临时文件传 body,避免 shell 转义导致换行符丢失)
|
|
287
|
+
console.log("🚀 正在创建 Issue...");
|
|
288
|
+
const bodyTempFile = path.join(os.tmpdir(), `yida-issue-body-${Date.now()}.md`);
|
|
289
|
+
try {
|
|
290
|
+
fs.writeFileSync(bodyTempFile, body, "utf-8");
|
|
291
|
+
const label = issueType === "bug" ? "bug" : "enhancement";
|
|
292
|
+
try {
|
|
293
|
+
const result = execSync(
|
|
294
|
+
`gh issue create --repo "${targetRepo}" --title "${title.replace(/"/g, '\\"')}" --body-file "${bodyTempFile}" --label "${label}"`,
|
|
295
|
+
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
296
|
+
);
|
|
297
|
+
console.log(`✅ Issue 创建成功:${result.trim()}`);
|
|
298
|
+
} catch {
|
|
299
|
+
// label 不存在时降级为不带 label 创建
|
|
300
|
+
const result = execSync(
|
|
301
|
+
`gh issue create --repo "${targetRepo}" --title "${title.replace(/"/g, '\\"')}" --body-file "${bodyTempFile}"`,
|
|
302
|
+
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
303
|
+
);
|
|
304
|
+
console.log(`✅ Issue 创建成功:${result.trim()}`);
|
|
305
|
+
}
|
|
306
|
+
} catch (error) {
|
|
307
|
+
console.error(`❌ 创建 Issue 失败:${error.message}`);
|
|
308
|
+
console.error("请确认:");
|
|
309
|
+
console.error(" 1. gh CLI 已登录(gh auth login)");
|
|
310
|
+
console.error(" 2. 你有对应仓库的访问权限");
|
|
311
|
+
process.exit(1);
|
|
312
|
+
} finally {
|
|
313
|
+
try { fs.unlinkSync(bodyTempFile); } catch {}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
main();
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# 宜搭 AI 应用开发指南
|
|
2
|
+
|
|
3
|
+
本项目通过 AI Coding 工具(Claude/Open Code 等)+ 宜搭低代码平台,实现一句话生成完整应用。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 项目结构
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
项目根目录/
|
|
11
|
+
├── CLAUDE.md # 本文档
|
|
12
|
+
├── README_zh.md # 项目说明
|
|
13
|
+
├── config.json # 全局配置(loginUrl、defaultBaseUrl)
|
|
14
|
+
├── .cache/
|
|
15
|
+
│ ├── cookies.json # 登录态缓存(运行时自动生成)
|
|
16
|
+
│ └── <项目名>-schema.json # 表单 Schema ID 缓存(运行时生成)
|
|
17
|
+
├── pages/
|
|
18
|
+
│ ├── src/<项目名>.js # 自定义页面 JSX 源码
|
|
19
|
+
│ └── dist/<项目名>.js # 编译后产物(自动生成)
|
|
20
|
+
├── prd/
|
|
21
|
+
│ └── <项目名>.md # 需求文档(含应用配置、字段设计)
|
|
22
|
+
└── .claude/
|
|
23
|
+
└── skills/ # AI 技能目录(通过 install-skills.sh 安装,来源:openyida/yida-skills)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 环境依赖
|
|
29
|
+
|
|
30
|
+
| 依赖 | 版本 | 用途 |
|
|
31
|
+
|------|------|------|
|
|
32
|
+
| Node.js | ≥ 16 | 页面编译与发布脚本 |
|
|
33
|
+
| Python | ≥ 3.8 | 登录态管理 |
|
|
34
|
+
| Playwright | latest | 浏览器自动化(扫码登录) |
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 安装 Python 依赖
|
|
38
|
+
pip install playwright && playwright install chromium
|
|
39
|
+
|
|
40
|
+
# 安装 Node 依赖(首次发布前执行)
|
|
41
|
+
cd .claude/skills/skills/yida-publish-page/scripts && npm install
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 完整开发流程
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
创建应用(yida-create-app)
|
|
50
|
+
↓
|
|
51
|
+
需求分析 → 写入 prd/<项目名>.md
|
|
52
|
+
↓
|
|
53
|
+
创建自定义页面(yida-create-page)
|
|
54
|
+
↓
|
|
55
|
+
(按需)创建表单(yida-create-form-page)→ 更新 prd 文档 + .cache/schema.json
|
|
56
|
+
↓
|
|
57
|
+
编写自定义页面代码(yida-custom-page 规范)→ pages/src/<项目名>.js
|
|
58
|
+
↓
|
|
59
|
+
发布代码(yida-publish-page)
|
|
60
|
+
↓
|
|
61
|
+
输出访问链接并用系统浏览器打开
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> **登录态说明**:所有脚本自动读取 `.cache/cookies.json`,首次运行或 Cookie 失效时自动弹出浏览器引导扫码登录,无需手动执行登录命令。
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 技能(Skills)速查
|
|
69
|
+
|
|
70
|
+
| 技能 | 调用命令 | 用途 |
|
|
71
|
+
|------|---------|------|
|
|
72
|
+
| `yida-login` | `python3 .claude/skills/skills/yida-login/scripts/login.py` | 登录态管理(通常自动触发) |
|
|
73
|
+
| `yida-logout` | `echo -n "" > .cache/cookies.json` | 退出登录 / 切换账号 |
|
|
74
|
+
| `yida-create-app` | `node .claude/skills/skills/yida-create-app/scripts/create-app.js "<名称>"` | 创建应用,获取 appType |
|
|
75
|
+
| `yida-create-page` | `node .claude/skills/skills/yida-create-page/scripts/create-page.js <appType> "<页面名>"` | 创建自定义页面,获取 pageId |
|
|
76
|
+
| `yida-create-form-page` | `node .claude/skills/skills/yida-create-form-page/scripts/create-form-page.js create <appType> "<表单名>" <字段JSON>` | 创建/更新表单页面 |
|
|
77
|
+
| `yida-get-schema` | `node .claude/skills/skills/yida-get-schema/scripts/get-schema.js <appType> <formUuid>` | 获取表单 Schema,确认字段 ID |
|
|
78
|
+
| `yida-custom-page` | 详见 `.claude/skills/skills/yida-custom-page/SKILL.md` | 编写自定义页面 JSX 代码(React 16 规范、状态管理、27 个 API) |
|
|
79
|
+
| `yida-publish-page` | `node .claude/skills/skills/yida-publish-page/scripts/publish.js <appType> <formUuid> <源文件路径>` | 编译并发布自定义页面 |
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 关键规则
|
|
84
|
+
|
|
85
|
+
### corpId 一致性检查(必须遵守)
|
|
86
|
+
|
|
87
|
+
在创建页面前,**必须对比 prd 文档中的 corpId 与 `.cache/cookies.json` 中的 corpId 是否一致**:
|
|
88
|
+
|
|
89
|
+
- **一致** → 继续执行
|
|
90
|
+
- **不一致** → 询问用户:重新登录到正确组织,还是在当前组织新建应用?
|
|
91
|
+
|
|
92
|
+
### 配置信息分两处存储
|
|
93
|
+
|
|
94
|
+
| 信息类型 | 存储位置 | 内容示例 |
|
|
95
|
+
|---------|---------|---------|
|
|
96
|
+
| 业务语义信息 | `prd/<项目名>.md` | 字段名称、字段类型、字段说明 |
|
|
97
|
+
| Schema ID | `.cache/<项目名>-schema.json` | `appType`、`formUuid`、`fieldId` |
|
|
98
|
+
|
|
99
|
+
> **prd 文档不记录 `formUuid`、`fieldId` 等 ID**,这些写入 `.cache/` 临时文件。
|
|
100
|
+
|
|
101
|
+
### 临时文件规范
|
|
102
|
+
|
|
103
|
+
所有临时文件(cookies、schema 缓存等)**必须写在项目根目录的 `.cache/` 文件夹中**,不要写在系统其他位置。
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 表单字段类型速查
|
|
110
|
+
|
|
111
|
+
| 类型 | 说明 | 特殊属性 |
|
|
112
|
+
|------|------|---------|
|
|
113
|
+
| `TextField` | 单行文本 | — |
|
|
114
|
+
| `TextareaField` | 多行文本 | — |
|
|
115
|
+
| `NumberField` | 数字 | `precision`(小数位)、`innerAfter`(单位) |
|
|
116
|
+
| `RadioField` | 单选 | `options` |
|
|
117
|
+
| `CheckboxField` | 多选 | `options` |
|
|
118
|
+
| `SelectField` | 下拉单选 | `options` |
|
|
119
|
+
| `MultiSelectField` | 下拉多选 | `options` |
|
|
120
|
+
| `DateField` | 日期 | `format`(如 `"YYYY-MM-DD"`) |
|
|
121
|
+
| `CascadeDateField` | 级联日期(范围) | `format` |
|
|
122
|
+
| `EmployeeField` | 成员选择 | `multiple` |
|
|
123
|
+
| `DepartmentSelectField` | 部门选择 | `multiple` |
|
|
124
|
+
| `AddressField` | 地址 | — |
|
|
125
|
+
| `AttachmentField` | 附件上传 | — |
|
|
126
|
+
| `ImageField` | 图片上传 | — |
|
|
127
|
+
| `TableField` | 子表格 | `children`(子字段列表) |
|
|
128
|
+
| `AssociationFormField` | 关联表单 | `associationForm` |
|
|
129
|
+
| `SerialNumberField` | 流水号 | `serialNumberRule` |
|
|
130
|
+
| `RateField` | 评分 | `count`(星级数) |
|
|
131
|
+
| `CountrySelectField` | 国家选择 | `multiple` |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 宜搭应用 URL 规则
|
|
136
|
+
|
|
137
|
+
| 页面类型 | URL 格式 |
|
|
138
|
+
|---------|---------|
|
|
139
|
+
| 应用首页 | `{base_url}/{appType}/workbench` |
|
|
140
|
+
| 表单提交页 | `{base_url}/{appType}/submission/{formUuid}` |
|
|
141
|
+
| 自定义页面 | `{base_url}/{appType}/custom/{formUuid}` |
|
|
142
|
+
| 自定义页面(隐藏导航) | `{base_url}/{appType}/custom/{formUuid}?isRenderNav=false` |
|
|
143
|
+
| 表单详情页 | `{base_url}/{appType}/formDetail/{formUuid}?formInstId={formInstId}` |
|
|
144
|
+
| 表单详情页(编辑模式) | `{base_url}/{appType}/formDetail/{formUuid}?formInstId={formInstId}&mode=edit` |
|
|
145
|
+
|
|
146
|
+
> 所有地址拼接 `&corpid={corpId}` 可自动切换到对应组织。
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 常见问题
|
|
151
|
+
|
|
152
|
+
**Q:发布时提示登录失效?**
|
|
153
|
+
```bash
|
|
154
|
+
echo -n "" > .cache/cookies.json
|
|
155
|
+
node .claude/skills/skills/yida-publish-page/scripts/publish.js <appType> <formUuid> <源文件路径>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Q:如何查看已有表单的字段 ID?**
|
|
159
|
+
使用 `yida-get-schema` 技能获取表单 Schema,从中读取各字段的 `fieldId`。
|
|
160
|
+
|
|
161
|
+
**Q:如何更新已有表单字段?**
|
|
162
|
+
使用 `yida-create-form-page` 的 update 模式:
|
|
163
|
+
```bash
|
|
164
|
+
node .claude/skills/skills/yida-create-form-page/scripts/create-form-page.js update <appType> <formUuid> '[{"action":"add","field":{"type":"TextField","label":"新字段"}}]'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Q:发布时提示 corpId 不匹配?**
|
|
168
|
+
询问用户是否在当前组织创建新应用发布。
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Contributing to OpenYiDA
|
|
2
|
+
|
|
3
|
+
Welcome! We're excited that you're interested in contributing. Please read this guide to get started.
|
|
4
|
+
|
|
5
|
+
## Ways to Contribute
|
|
6
|
+
|
|
7
|
+
- **Report bugs** - Open an issue with details about the problem
|
|
8
|
+
- **Suggest features** - Share your ideas in the issue tracker
|
|
9
|
+
- **Improve documentation** - Help make the docs clearer and more complete
|
|
10
|
+
- **Add new skills** - Extend the skill package for more capabilities
|
|
11
|
+
- **Submit code changes** - Fix bugs or add new features
|
|
12
|
+
|
|
13
|
+
## Development Setup
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Fork and clone the repository
|
|
17
|
+
git clone git@github.com:your-username/openyida.git
|
|
18
|
+
cd openyida
|
|
19
|
+
|
|
20
|
+
# 安装 Skills(无需 Node 环境,自动检测网络,国内自动使用加速源)
|
|
21
|
+
# Mac / Linux:
|
|
22
|
+
bash install-skills.sh
|
|
23
|
+
# Mac / Linux(强制使用国内加速源):
|
|
24
|
+
# bash install-skills.sh --cn
|
|
25
|
+
# Windows(PowerShell):
|
|
26
|
+
# .\install-skills.ps1
|
|
27
|
+
# Windows(强制使用国内加速源):
|
|
28
|
+
# .\install-skills.ps1 --cn
|
|
29
|
+
|
|
30
|
+
# 安装 Python 依赖
|
|
31
|
+
# 国内用户推荐使用阿里云镜像加速:
|
|
32
|
+
pip install playwright -i https://mirrors.aliyun.com/pypi/simple/
|
|
33
|
+
playwright install chromium
|
|
34
|
+
# 海外用户:
|
|
35
|
+
# pip install playwright && playwright install chromium
|
|
36
|
+
|
|
37
|
+
# 安装 Node 依赖(发布页面时需要)
|
|
38
|
+
# 国内用户推荐使用淘宝镜像加速:
|
|
39
|
+
cd .claude/skills/skills/yida-publish-page/scripts && npm install --registry https://registry.npmmirror.com
|
|
40
|
+
# 海外用户:
|
|
41
|
+
# cd .claude/skills/skills/yida-publish-page/scripts && npm install
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Submitting Changes
|
|
45
|
+
|
|
46
|
+
1. Create a feature branch: `git checkout -b feature/your-feature`
|
|
47
|
+
2. Make your changes and commit: `git commit -m "Add your feature"`
|
|
48
|
+
3. Push to your fork: `git push origin feature/your-feature`
|
|
49
|
+
4. Open a Pull Request
|
|
50
|
+
|
|
51
|
+
## Code Style
|
|
52
|
+
|
|
53
|
+
- Follow existing code conventions in the project
|
|
54
|
+
- Keep changes focused and minimal
|
|
55
|
+
- Write clear commit messages
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alibaba Group Holding Limited
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
## 快速开始
|
|
2
|
+
|
|
3
|
+
### 第一步:克隆仓库
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/openyida/openyida.git
|
|
7
|
+
cd openyida
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### 第二步:安装 Skills
|
|
11
|
+
|
|
12
|
+
脚本会**自动检测并安装**缺少的 Node.js / Python,国内网络自动切换阿里云加速源。
|
|
13
|
+
|
|
14
|
+
**Mac / Linux:**
|
|
15
|
+
```bash
|
|
16
|
+
bash install-skills.sh
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Windows(PowerShell):**
|
|
20
|
+
```powershell
|
|
21
|
+
.\install-skills.ps1
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
> 💡 **国内网络访问 GitHub 较慢?** 可手动强制使用国内加速源:
|
|
25
|
+
> ```bash
|
|
26
|
+
> bash install-skills.sh --cn # Mac / Linux
|
|
27
|
+
> .\install-skills.ps1 --cn # Windows
|
|
28
|
+
> ```
|
|
29
|
+
|
|
30
|
+
### 第三步:开始使用
|
|
31
|
+
|
|
32
|
+
用 Cursor / VS Code 等编辑器打开项目,启动 AI 编程工具后直接对话:
|
|
33
|
+
|
|
34
|
+
- `帮我搭建一个生日祝福小游戏应用`
|
|
35
|
+
- `帮我搭建个人薪资计算器应用`
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 依赖环境
|
|
40
|
+
|
|
41
|
+
> 安装脚本会自动处理以下依赖,通常无需手动安装。
|
|
42
|
+
|
|
43
|
+
| 依赖 | 版本要求 | 用途 |
|
|
44
|
+
|------|----------|------|
|
|
45
|
+
| Git | 任意版本 | 克隆仓库、安装 Skills |
|
|
46
|
+
| Node.js | ≥ 16 | yida-publish、yida-create-* 系列脚本 |
|
|
47
|
+
| Python | ≥ 3.10 | yida-login、yida-logout |
|
|
48
|
+
| Playwright | latest | 登录态管理 |
|
|
49
|
+
|
|
50
|
+
### CLI 工具(可选)
|
|
51
|
+
|
|
52
|
+
如需在任意目录使用 `openyida` / `yida` 命令(如 `openyida doctor` 检查环境),可通过 npm 全局安装:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm install -g openyida
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> 💡 `login`、`publish` 等依赖 Skills 的命令,仍需在克隆的项目目录下运行。
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## DEMO 展示
|
|
62
|
+
|
|
63
|
+
### 💰 小工具 - 个人薪资计算器
|
|
64
|
+
|
|
65
|
+

|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### 🌐 Landing Page - 智联协同
|
|
70
|
+
|
|
71
|
+
企业级产品介绍页,一句话生成完整 Landing Page。
|
|
72
|
+
|
|
73
|
+

|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### 🏮 运营场景 - 看图猜灯谜
|
|
78
|
+
|
|
79
|
+
AI 生成灯谜图片,用户猜答案,猜错了有 AI 幽默提示。
|
|
80
|
+
|
|
81
|
+

|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 常用问法([yida-skills](https://github.com/openyida/yida-skills))
|
|
86
|
+
1. 帮我搭建一个 xxx 应用
|
|
87
|
+
2. 根据需求文档生成应用
|
|
88
|
+
3. 帮我创建一个 xxx 表单页面
|
|
89
|
+
4. 帮我给 xxx 页面添加一个 xxx 字段,字段名称:字段类型 xxx
|
|
90
|
+
5. 帮我给 xxx 页面 xxx 字段改为必填
|
|
91
|
+
6. 帮我发布 xxx 页面
|
|
92
|
+
7. 重新登录
|
|
93
|
+
8. 退出登录
|
|
94
|
+
|
|
95
|
+
## 贡献者
|
|
96
|
+
|
|
97
|
+
感谢所有为 OpenYida 做出贡献的开发者!
|
|
98
|
+
|
|
99
|
+
### 贡献者
|
|
100
|
+
<p align="left">
|
|
101
|
+
<a href="https://github.com/yize"><img src="https://avatars.githubusercontent.com/u/1011681?v=4&s=48" width="48" height="48" alt="yize" title="yize"/></a> <a href="https://github.com/alex-mm"><img src="https://avatars.githubusercontent.com/u/3302053?v=4&s=48" width="48" height="48" alt="alex-mm" title="alex-mm"/></a> <a href="https://github.com/nicky1108"><img src="https://avatars.githubusercontent.com/u/4279283?v=4&s=48" width="48" height="48" alt="nicky1108" title="nicky1108"/></a>
|
|
102
|
+
</p>
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
[MIT](./LICENSE) © 2026 Alibaba Group
|