openxiangda 1.0.91 → 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 +54 -2
- package/lib/cli.js +1129 -23
- package/lib/design-gates.js +449 -0
- package/openxiangda-skills/SKILL.md +25 -22
- package/openxiangda-skills/references/architecture-design.md +26 -1
- package/openxiangda-skills/references/pages/page-sdk.md +8 -1
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +48 -2
- 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/openxiangda-react-spa/src/app/router.tsx +23 -1
- package/templates/sy-lowcode-app-workspace/AGENTS.md +7 -0
package/README.md
CHANGED
|
@@ -31,9 +31,12 @@ openxiangda permission role-list --profile dev
|
|
|
31
31
|
openxiangda settings get customer --profile dev
|
|
32
32
|
openxiangda data-view list --profile dev
|
|
33
33
|
openxiangda data-view status ticket_with_customer --profile dev
|
|
34
|
+
openxiangda doctor --profile dev --json
|
|
35
|
+
openxiangda design gates --topic public-access --json
|
|
34
36
|
openxiangda resource validate --profile dev
|
|
35
37
|
openxiangda resource plan --profile dev
|
|
36
38
|
openxiangda resource publish --profile dev
|
|
39
|
+
openxiangda resource explain public-access --json
|
|
37
40
|
openxiangda runtime deploy --profile dev
|
|
38
41
|
openxiangda inspect app --profile dev --json
|
|
39
42
|
openxiangda app snapshot APP_XXXX --profile dev --json
|
|
@@ -69,6 +72,45 @@ openxiangda update install
|
|
|
69
72
|
|
|
70
73
|
Domestic npm mirrors may lag and return an older OpenXiangda version. `openxiangda update check --json` is designed for AI agents: it returns the installed version, latest official npm version, whether an update is available, and the compatibility commands to run after updating. `openxiangda update install` installs from the official registry and refreshes OpenXiangda skills by default.
|
|
71
74
|
|
|
75
|
+
## AI design gate and resource CLI
|
|
76
|
+
|
|
77
|
+
Architecture-class requests are plan-gated by default. For new apps, complex pages, login/register, public/no-login access, role/data-scope design, workflow/automation, App Function, connector, notification, and external integration work, AI agents must plan first and implement only after the user confirms the design.
|
|
78
|
+
|
|
79
|
+
Before confirmation, agents may read, inspect, snapshot, dry-run, ask questions, and output/write the architecture document. They must not edit source files, mutate platform resources, publish, deploy, send notifications, or call live write/delete endpoints.
|
|
80
|
+
|
|
81
|
+
Use the discoverable gate commands:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
openxiangda doctor --profile dev --json
|
|
85
|
+
openxiangda design gates --topic new-app,public-access --json
|
|
86
|
+
openxiangda design template --topic auth,public-access
|
|
87
|
+
openxiangda commands --json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
For formal multi-resource development, keep the repository as the source of truth and use `src/resources/**`:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
openxiangda resource validate --profile dev
|
|
94
|
+
openxiangda resource plan --profile dev
|
|
95
|
+
openxiangda resource publish --profile dev
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
For small live fixes, diagnosis, or AI command discovery, use first-class resource commands. They all accept `--profile`, `--app-type`, `--json`, `--json-file`, `--dry-run`, and write commands can use `--write-manifest` to avoid repo/platform drift:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
openxiangda route upsert --json-file src/resources/routes/public_register.json --dry-run
|
|
102
|
+
openxiangda public-access upsert --json-file src/resources/public-access/public_register.json --write-manifest
|
|
103
|
+
openxiangda public-access session-test public_register --path /view/APP_XXX/public/register --json
|
|
104
|
+
openxiangda public-access grant-check public_register --form-code registration_form --json
|
|
105
|
+
openxiangda auth-config methods --json
|
|
106
|
+
openxiangda function invoke submit_public_registration --body-json '{"input":{}}'
|
|
107
|
+
openxiangda connector invoke sms.sendCode --body-json '{"body":{"phone":"13800000000"}}'
|
|
108
|
+
openxiangda notification preview public_register_notice --body-json '{"variables":{"title":"测试"}}'
|
|
109
|
+
openxiangda permission audit --json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
调用和测试类命令会检查 JSON envelope。HTTP 200 但 `code: "PUBLIC_GRANT_DENIED"`、`success: false` 或其他字符串业务错误码会被当作失败。
|
|
113
|
+
|
|
72
114
|
Codex skills are installed separately from login/profile state. Run `openxiangda skill install` after installing or linking the CLI. It installs the `openxiangda` root skill plus the 8 top-level subskills into `${CODEX_HOME:-~/.codex}/skills` by default:
|
|
73
115
|
|
|
74
116
|
- `openxiangda`
|
|
@@ -205,16 +247,26 @@ import {
|
|
|
205
247
|
PublicAccessGate,
|
|
206
248
|
} from "openxiangda/runtime/react"
|
|
207
249
|
|
|
250
|
+
const PublicLoading = () => <div role="status">正在进入公开页面</div>
|
|
251
|
+
const PublicAccessError = ({ error }: { error: { message?: string } }) => (
|
|
252
|
+
<div role="alert">{error.message || "公开链接不可用或已过期"}</div>
|
|
253
|
+
)
|
|
254
|
+
|
|
208
255
|
<OpenXiangdaProvider appType={appType} servicePrefix="/service">
|
|
209
256
|
<OpenXiangdaPageProvider>
|
|
210
|
-
<PublicAccessGate
|
|
257
|
+
<PublicAccessGate
|
|
258
|
+
errorFallback={error => <PublicAccessError error={error} />}
|
|
259
|
+
fallback={<PublicLoading />}
|
|
260
|
+
policyCode="public_register"
|
|
261
|
+
routeCode="public.register"
|
|
262
|
+
>
|
|
211
263
|
<PublicRegisterPage />
|
|
212
264
|
</PublicAccessGate>
|
|
213
265
|
</OpenXiangdaPageProvider>
|
|
214
266
|
</OpenXiangdaProvider>
|
|
215
267
|
```
|
|
216
268
|
|
|
217
|
-
不要把 `PublicAccessGate` 单独放在没有 `OpenXiangdaProvider` / `OpenXiangdaPageProvider` 的页面树下;否则 public session 不能注入后续 SDK 请求,`usePageSdk()` 也会抛出 `usePageSdkStore 必须在 PageProvider
|
|
269
|
+
不要把 `PublicAccessGate` 单独放在没有 `OpenXiangdaProvider` / `OpenXiangdaPageProvider` 的页面树下;否则 public session 不能注入后续 SDK 请求,`usePageSdk()` 也会抛出 `usePageSdkStore 必须在 PageProvider 内使用`。公开页面必须给 `PublicAccessGate` 配 `fallback` 和 `errorFallback`,避免慢网、缺 ticket、ticket 过期时出现空白页。
|
|
218
270
|
|
|
219
271
|
多表只读查询和固定口径统计优先声明 `src/resources/data-views/*.json` 数据视图,而不是在页面里手写多次单表查询再拼数据。默认 `storageMode: "materialized"` 会创建 PostgreSQL materialized view,适合读多写少和可接受刷新延迟的列表/报表;`storageMode: "live"` 每次查询实时编译逻辑视图,适合强实时但数据量可控的复杂查询。`viewType: "aggregate"` 是统计聚合视图,适合按客户、状态、月份等维度聚合 count/sum/avg/min/max。发布时 CLI 会把 `formCode` 解析为当前 profile 的 `formUuid`;页面通过 `sdk.dataView.query(code, params)` 查询行级视图,通过 `sdk.dataView.stats(code, params)` 查询聚合视图,也可以用 `sdk.dataSource.run()` 路由 `dataView.query` / `dataView.stats`。materialized 模式应为常用筛选、排序、统计维度和时间桶声明 `indexes`,并确认用户能接受的刷新延迟;live 模式忽略 `indexes`,不需要刷新。
|
|
220
272
|
|