openxiangda 1.0.92 → 1.0.93
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 +42 -0
- package/lib/cli.js +1129 -23
- package/lib/design-gates.js +449 -0
- package/openxiangda-skills/SKILL.md +23 -20
- package/openxiangda-skills/references/architecture-design.md +25 -0
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +36 -0
- package/openxiangda-skills/skills/openxiangda-architecture-design/SKILL.md +29 -0
- package/package.json +3 -1
- package/templates/openxiangda-react-spa/AGENTS.md +6 -0
- package/templates/sy-lowcode-app-workspace/AGENTS.md +7 -0
|
@@ -33,6 +33,33 @@ Be the technical architect. Do not passively accept product requirements when th
|
|
|
33
33
|
|
|
34
34
|
Keep the tone direct and critical about the design, but do not insult the person. Acceptable: "这个方案不能这样做,会把查询压力和权限风险推到前端。" Not acceptable: personal attacks.
|
|
35
35
|
|
|
36
|
+
## Plan-Gate Hard Rule
|
|
37
|
+
|
|
38
|
+
Architecture-class requests are planning-only until the user explicitly confirms the design.
|
|
39
|
+
|
|
40
|
+
This includes new apps, complex pages, login/register, public/no-login access, roles/data scopes, workflow/automation, App Function, connector, notification, and external integration work.
|
|
41
|
+
|
|
42
|
+
Before confirmation you may only:
|
|
43
|
+
|
|
44
|
+
- read files and docs
|
|
45
|
+
- inspect `.openxiangda/state.json`
|
|
46
|
+
- run read-only snapshots/doctor commands
|
|
47
|
+
- run `openxiangda design gates --topic <code> --json`
|
|
48
|
+
- run `openxiangda resource validate|plan` or other dry-run commands
|
|
49
|
+
- ask focused design-gate questions
|
|
50
|
+
- output or write the design artifact
|
|
51
|
+
|
|
52
|
+
Before confirmation you must not:
|
|
53
|
+
|
|
54
|
+
- edit app source files
|
|
55
|
+
- create/update/delete platform resources
|
|
56
|
+
- publish workspace/resources/runtime
|
|
57
|
+
- send notifications
|
|
58
|
+
- call live write/delete endpoints
|
|
59
|
+
- start implementation subskills
|
|
60
|
+
|
|
61
|
+
Once the user confirms, hand execution to the relevant implementation skill and use the resource commands documented in `references/resource-manifest-cheatsheet.md`.
|
|
62
|
+
|
|
36
63
|
## Non-Negotiable Rules
|
|
37
64
|
|
|
38
65
|
- Do not design list pages, option searches, linked-form choices, or report drill-downs that fetch 1000 rows and filter in local state. Use paginated queries, explicit filters, sort, and server-side search fields.
|
|
@@ -49,6 +76,7 @@ Keep the tone direct and critical about the design, but do not insult the person
|
|
|
49
76
|
- If a workspace exists, inspect `.openxiangda/state.json`, `app-workspace.config.ts`, and relevant `src/` resources before designing.
|
|
50
77
|
- If this is an existing app, use snapshots/read-only inspection before proposing changes.
|
|
51
78
|
- If this is a blank app, explicitly state that the design is greenfield.
|
|
79
|
+
- Run `openxiangda doctor --json` when the CLI/workspace is available.
|
|
52
80
|
2. Extract the domain:
|
|
53
81
|
- Actors and roles.
|
|
54
82
|
- Business objects that should become forms.
|
|
@@ -62,6 +90,7 @@ Keep the tone direct and critical about the design, but do not insult the person
|
|
|
62
90
|
- Data Views with mode, query shape, freshness, indexes, and permissions.
|
|
63
91
|
- Workflows, automations, JS_CODE nodes, App Functions, notifications, connectors, and settings.
|
|
64
92
|
4. Ask design-gate questions in rounds. Do not produce the final design while high-impact unknowns remain.
|
|
93
|
+
Use `openxiangda design gates --topic <code> --json` to get the current question matrix and recommended defaults.
|
|
65
94
|
5. Challenge bad assumptions. Give the cost, reject the unsafe implementation path, and propose the OpenXiangda-native alternative.
|
|
66
95
|
6. For frontend-heavy pages, ask whether a visual/interaction design pass is needed. If Product Design or another UI design skill is available, route design work there before page implementation.
|
|
67
96
|
7. Write the final artifact by default when a workspace exists:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openxiangda",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.93",
|
|
4
4
|
"description": "OpenXiangda CLI, workspace build tools, runtime SDK, and form components.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"bin": {
|
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
"prepack": "npm run build:sdk",
|
|
66
66
|
"test:profile-isolation": "bash scripts/profile-isolation-smoke.sh",
|
|
67
67
|
"test:resource-plan": "node scripts/resource-plan-smoke.mjs",
|
|
68
|
+
"test:design-gates": "node scripts/design-gates-smoke.mjs",
|
|
69
|
+
"test:resource-cli": "node scripts/resource-cli-smoke.mjs",
|
|
68
70
|
"test:app-function-fallback": "node scripts/app-function-source-fallback-smoke.mjs",
|
|
69
71
|
"test:runtime-deploy": "node scripts/runtime-deploy-smoke.mjs",
|
|
70
72
|
"test:skill-install": "bash scripts/skill-install-smoke.sh",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 开发原则
|
|
6
6
|
|
|
7
|
+
- 架构类需求默认只规划、不实现。新应用、复杂页面、登录注册、公开访问、权限数据范围、流程自动化、连接器/通知等需求,先运行 `openxiangda doctor --json` 和 `openxiangda design gates --topic <code> --json`,输出设计并等用户确认;确认前只允许读取、快照、dry-run、提问和写设计文档,不允许改源码、写平台、发布或发送通知。
|
|
7
8
|
- 默认用户界面保持克制:左侧应用导航、顶部账号信息、首页内容区域。
|
|
8
9
|
- 不在默认可见页面展示 SDK、Runtime、Cookie、Proxy、Playwright、AI 验证、调试上下文、构建号等开发语言。
|
|
9
10
|
- 使用 React Router 管理路由,路由定义在 `src/app/router.tsx`。
|
|
@@ -23,9 +24,12 @@ pnpm typecheck:js-code
|
|
|
23
24
|
pnpm build
|
|
24
25
|
pnpm build-js-code
|
|
25
26
|
openxiangda workspace publish --profile <name> --form <formCode>
|
|
27
|
+
openxiangda doctor --profile <name> --json
|
|
28
|
+
openxiangda design gates --topic public-access --json
|
|
26
29
|
openxiangda resource plan --profile <name>
|
|
27
30
|
openxiangda resource publish --profile <name>
|
|
28
31
|
openxiangda runtime deploy --profile <name>
|
|
32
|
+
openxiangda commands --json
|
|
29
33
|
```
|
|
30
34
|
|
|
31
35
|
完整发布顺序:
|
|
@@ -98,6 +102,8 @@ import { PermissionBoundary, useAppMenus, useRuntimeBootstrap } from "openxiangd
|
|
|
98
102
|
|
|
99
103
|
表单、dataView、function、connector 没有被 policy `grants` 显式列出时,公开 guest 默认无权访问。需要数据访问时,把同一个外部角色码加入对应后端权限组。
|
|
100
104
|
|
|
105
|
+
资源诊断或小步修复可以使用一等 CLI:`route`、`public-access`、`auth-config`、`function`、`connector`、`notification`、`data-view`、`menu`、`permission`。正式多资源开发仍优先写 `src/resources/**` 后走 `openxiangda resource validate|plan|publish`。直接 CLI 写平台资源时,先加 `--dry-run` 看 path/body;需要保持仓库为来源时加 `--write-manifest`;删除、发送、覆盖类高风险动作必须加 `--force`。
|
|
106
|
+
|
|
101
107
|
## 默认页与覆盖
|
|
102
108
|
|
|
103
109
|
- 表单提交:`/view/:appType/admin/forms/:formUuid/new`
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
**所有"发布 / 上线 / 部署 / publish / deploy / ship / release"请求,唯一正确入口是 `openxiangda workspace publish --profile <name>`,不要直接 `pnpm publish:all`。**
|
|
9
9
|
|
|
10
|
+
**架构类需求默认只规划、不实现。** 新应用、复杂页面、登录注册、公开访问、权限数据范围、流程自动化、连接器/通知等需求,先 `openxiangda doctor --json` + `openxiangda design gates --topic <code> --json`,输出设计并等待用户确认;确认前只允许读取、快照、dry-run、提问和写设计文档,不允许改源码、写平台、发布、部署或发送通知。
|
|
11
|
+
|
|
10
12
|
工作区内的 npm scripts(`publish:all` / `publish:oss` / `register`)已加 `_guard:publish` 守卫;缺少 `OPENXIANGDA_PROFILE` 环境变量时会立即 fail,提示重新走 CLI 入口。
|
|
11
13
|
|
|
12
14
|
## 路由表 — 用户意图 → 命令 / skill
|
|
@@ -26,10 +28,12 @@
|
|
|
26
28
|
| 登录 / 切平台 / token / whoami | `openxiangda-core` | `openxiangda env --profile <name>` / `openxiangda auth status` |
|
|
27
29
|
| 多表只读联表查询 / 报表数据源 | `openxiangda-form`(data view) | 在 `src/resources/data-views/<code>.json` 声明 → `resource publish` |
|
|
28
30
|
| 调外部 / 第三方 API / 钉钉 / 自建系统 | `openxiangda-page`(connector) | 在 `src/resources/connectors/<code>.json` 声明 → `sdk.connector.invoke()` |
|
|
31
|
+
| 资源诊断 / 小步修复 / 同步 manifest | 对应资源 skill | `openxiangda route|public-access|auth-config|function|connector|notification|data-view|menu|permission ... --dry-run` |
|
|
29
32
|
|
|
30
33
|
## 必须遵守
|
|
31
34
|
|
|
32
35
|
- ✅ 先 preflight:`openxiangda env --profile <name>` + `openxiangda auth status --profile <name>` + `openxiangda update check --json`。
|
|
36
|
+
- ✅ 架构类需求先 plan gate:`openxiangda doctor --profile <name> --json` + `openxiangda design gates --topic <code> --json`,用户确认后再实现。
|
|
33
37
|
- ✅ 单文件改动默认增量发布:`workspace publish --profile <name> --changed --dry-run` → `--changed` / `--page` / `--form`。
|
|
34
38
|
- ✅ 用户 token 在 `~/.openxiangda/profiles.json`;项目 state 在 `.openxiangda/state.json`(只存 ID)。
|
|
35
39
|
- ✅ 共享环境(`APP_OSS_*`、反馈机器人等)在 `~/.openxiangda/.env`,项目 `.env` 仅做 per-workspace override。
|
|
@@ -37,6 +41,7 @@
|
|
|
37
41
|
- ✅ 改已有应用前先 `openxiangda app snapshot APP_XXX --profile <name> --json`。
|
|
38
42
|
- ✅ 表单录入组件选择顺序:OpenXiangda 平台表单组件 → `antd` / `antd-mobile` 包装 → 只有两者都不满足时才写自定义业务组件。
|
|
39
43
|
- ✅ 发现平台缺陷、能力缺口、规则不清、反复 workaround、AI 不确定点、用户可见体验问题时,主动 `openxiangda feedback submit --yes`;发送后告诉用户反馈内容和 fingerprint。
|
|
44
|
+
- ✅ 正式多资源开发优先写 `src/resources/**` 后 `openxiangda resource validate|plan|publish`;直接 CLI 写平台资源时先 `--dry-run`,需要避免漂移就加 `--write-manifest`。
|
|
40
45
|
|
|
41
46
|
## 严禁
|
|
42
47
|
|
|
@@ -45,6 +50,7 @@
|
|
|
45
50
|
- ❌ 在没有本地 `.openxiangda/state.json` 绑定时,去平台搜索同名应用尝试"复用"。空目录 / 无绑定 → 直接 `workspace init --app-name` 创建新应用。
|
|
46
51
|
- ❌ 把 `openxiangda form create` / `form publish` / `page publish` 当作日常页面生成方式。它们仅作底层修复 / 诊断。
|
|
47
52
|
- ❌ 改一个文件就 `workspace publish` 全量。
|
|
53
|
+
- ❌ 用户确认架构设计前就实现、写平台资源、发布、部署或发送通知。
|
|
48
54
|
- ❌ 把 token、AK、SK、第三方密钥写进项目文件。
|
|
49
55
|
- ❌ `npm publish` —— 这个工作区是 `"private": true` 的应用工作区,不是要发到 npm 的 package。
|
|
50
56
|
- ❌ 在 AI 生成的 `src/forms/**` / `src/pages/**` 里直接写原生 `<input>` / `<select>` / `<textarea>` / `<input type="file">`、手写 picker、手写 uploader、手写人员/部门选择器。原生控件只允许出现在 OpenXiangda SDK / 平台组件内部。
|
|
@@ -60,6 +66,7 @@
|
|
|
60
66
|
- 列表页用 `DataManagementList` 模式 + 分页 + 结构化 `filterGroup`,不要 `pageSize=10000` 然后前端过滤。
|
|
61
67
|
- 正式入口(管理后台 / PC 门户 / 移动门户)必须是 app-shell:`page.config.ts` 里 `entry: { mode: "app-shell", hidePlatformNav: true, defaultRoute: "<home>" }`。
|
|
62
68
|
- 对外接口走 `src/resources/connectors/`;多表只读联表走 `src/resources/data-views/`;通知模板走 `src/resources/notifications/`。
|
|
69
|
+
- 新 React SPA 公开访问使用 `/view/:appType/public/*` + `src/resources/routes/` + `src/resources/public-access/` + `PublicAccessGate`。旧 `?publicAccess=guest` 只用于旧 `sy-lowcode-view` 兼容,新应用禁止采用。
|
|
63
70
|
|
|
64
71
|
## 工作区结构速查
|
|
65
72
|
|