openyida 2026.11.3-beta.0 → 2026.11.4-1
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 +21 -14
- package/bin/yida.js +2 -26
- package/lib/agent/mutation-receipt.js +1 -1
- package/lib/app/application-entry-urls.js +35 -1
- package/lib/app/application-style.js +2 -3
- package/lib/app/check-prd-completeness.js +27 -6
- package/lib/app/create-app.js +17 -9
- package/lib/app/create-form.js +48 -39
- package/lib/app/fast-build.js +151 -0
- package/lib/app/fast-theme.js +87 -0
- package/lib/app/form-data-contract.js +264 -0
- package/lib/app/form-data-response-guard.js +122 -19
- package/lib/app/publish.js +32 -6
- package/lib/app/services/canvas-page-schema-builder.js +10 -0
- package/lib/app/services/form-compiler.js +1 -1
- package/lib/app/subform-readback.js +60 -0
- package/lib/app/theme-source.js +2 -7
- package/lib/asset/ai-image.js +8 -5
- package/lib/asset/asset-cmd.js +24 -4
- package/lib/asset/asset-execution.js +25 -4
- package/lib/asset/asset-plan.js +4 -2
- package/lib/asset/asset-resolve.js +21 -7
- package/lib/core/agent-capabilities.js +9 -2
- package/lib/core/batch.js +71 -122
- package/lib/core/chalk.js +2 -1
- package/lib/core/command-manifest.js +89 -108
- package/lib/core/data-seed.js +254 -0
- package/lib/core/env-cmd.js +0 -1
- package/lib/core/env-manager.js +4 -4
- package/lib/core/locales/en.js +26 -10
- package/lib/core/locales/zh.js +26 -10
- package/lib/core/permission-guidance.js +25 -9
- package/lib/core/query-data.js +121 -43
- package/lib/core/sample.js +73 -0
- package/lib/core/task-concurrency.js +96 -0
- package/lib/core/update.js +1 -1
- package/lib/core/utils.js +14 -7
- package/lib/corp-efficiency/corp-efficiency.js +15 -8
- package/lib/design/document.js +5 -0
- package/lib/design/fast-document.js +118 -0
- package/lib/design-plan/design-plan.js +3 -3
- package/lib/design-plan/init.js +90 -5
- package/lib/design-plan/materialize.js +2 -2
- package/lib/design-plan/themes.js +30 -1
- package/lib/design-plan/validate.js +64 -9
- package/lib/flash-note/build-flash-note-prompt.js +1 -1
- package/lib/samples/openyida-scaffold/canvas-data-source.jsx +255 -0
- package/lib/samples/openyida-scaffold/canvas-file-upload.jsx +106 -0
- package/lib/samples/openyida-scaffold/file-upload-client.jsx +160 -0
- package/lib/samples/yida-app/fast-app.json +64 -0
- package/lib/samples/yida-design/fast-design.json +38 -0
- package/package.json +4 -4
- package/scripts/postinstall.js +41 -32
- package/yida-skills/SKILL.md +15 -12
- package/yida-skills/references/official-example-schema-patterns.md +3 -3
- package/yida-skills/references/qwenwork-link-presentation.md +10 -17
- package/yida-skills/references/setup-and-env.md +6 -0
- package/yida-skills/references/user-facing-summary.md +1 -1
- package/yida-skills/references/yida-api.md +4 -4
- package/yida-skills/skills/yida-app/SKILL.md +30 -13
- package/yida-skills/skills/yida-app/references/common-issues.md +3 -3
- package/yida-skills/skills/yida-app/references/entry-navigation.md +1 -1
- package/yida-skills/skills/yida-app/references/fast-context.md +7 -0
- package/yida-skills/skills/yida-app/workflow/fast-build.md +70 -0
- package/yida-skills/skills/yida-app/workflow/parallel-work.md +15 -5
- package/yida-skills/skills/yida-app/workflow/plan/step-4-deliver.md +1 -1
- package/yida-skills/skills/yida-app/workflow/plan/workflow.md +5 -1
- package/yida-skills/skills/yida-app/workflow/step-1-resource-context.md +6 -5
- package/yida-skills/skills/yida-app/workflow/step-2-design.md +15 -8
- package/yida-skills/skills/yida-app/workflow/step-3-create-or-reuse-app.md +7 -2
- package/yida-skills/skills/yida-app/workflow/step-4-forms-processes.md +4 -1
- package/yida-skills/skills/yida-app/workflow/step-5-seed-records.md +7 -4
- package/yida-skills/skills/yida-app/workflow/step-6-main-page.md +3 -0
- package/yida-skills/skills/yida-app/workflow/step-7-page-code.md +5 -2
- package/yida-skills/skills/yida-app/workflow/step-8-publish-navigation.md +10 -5
- package/yida-skills/skills/yida-app/workflow/step-9-output-finish.md +11 -6
- package/yida-skills/skills/yida-canvas-custom-page/SKILL.md +14 -4
- package/yida-skills/skills/yida-canvas-custom-page/references/data-bridge-guide.md +2 -0
- package/yida-skills/skills/yida-canvas-custom-page/references/file-upload.md +75 -0
- package/yida-skills/skills/yida-canvas-custom-page/references/native-components-bridge.md +4 -3
- package/yida-skills/skills/yida-canvas-custom-page/references/navigation-and-entry-guide.md +1 -1
- package/yida-skills/skills/yida-canvas-custom-page/references/page-generation-guide.md +1 -1
- package/yida-skills/skills/yida-canvas-data-binding/SKILL.md +52 -82
- package/yida-skills/skills/yida-cool-card/references/configuration.md +1 -1
- package/yida-skills/skills/yida-corp-efficiency/SKILL.md +3 -3
- package/yida-skills/skills/yida-create-app/SKILL.md +12 -10
- package/yida-skills/skills/yida-create-form-page/SKILL.md +5 -4
- package/yida-skills/skills/yida-create-form-page/references/association-form-field.md +3 -0
- package/yida-skills/skills/yida-create-form-page/references/field-definition-guide.md +1 -1
- package/yida-skills/skills/yida-create-form-page/references/form-field-properties.md +13 -17
- package/yida-skills/skills/yida-custom-page/SKILL.md +2 -0
- package/yida-skills/skills/yida-custom-page/references/attachment-upload-guide.md +4 -0
- package/yida-skills/skills/yida-data-management/SKILL.md +83 -110
- package/yida-skills/skills/yida-data-management/references/data-format-guide.md +54 -6
- package/yida-skills/skills/yida-design/SKILL.md +19 -14
- package/yida-skills/skills/yida-design/references/application-style-library.md +5 -3
- package/yida-skills/skills/yida-design/references/application-theme-consistency.md +11 -11
- package/yida-skills/skills/yida-design/references/ask-human-interaction-contract.md +2 -2
- package/yida-skills/skills/yida-design/references/design-mode.md +8 -3
- package/yida-skills/skills/yida-design/references/fast-design-spec.md +32 -0
- package/yida-skills/skills/yida-design/references/native-form-styles.md +6 -6
- package/yida-skills/skills/yida-design/references/page-quality-gates.md +2 -2
- package/yida-skills/skills/yida-design/references/reference-visual-dna.md +2 -2
- package/yida-skills/skills/yida-design/references/responsive-layout.md +1 -1
- package/yida-skills/skills/yida-design/references/theme-selection.md +11 -3
- package/yida-skills/skills/yida-design/sub_skill/yida-design-plan/SKILL.md +1 -1
- package/yida-skills/skills/yida-design/sub_skill/yida-design-plan/references/build-plan-compact-schema.md +1 -1
- package/yida-skills/skills/yida-design/templates/design-themes/app-teal/design.md +4 -4
- package/yida-skills/skills/yida-design/templates/design-themes/app-terminal/design.md +4 -4
- package/yida-skills/skills/yida-design/workflow/output-design.md +13 -13
- package/yida-skills/skills/yida-design/workflow/step-1-read-brief.md +3 -3
- package/yida-skills/skills/yida-design/workflow/step-4-wireframe-interaction.md +1 -1
- package/yida-skills/skills/yida-design/workflow/step-5-visual-states.md +1 -1
- package/yida-skills/skills/yida-design/workflow/step-6-handoff.md +3 -3
- package/yida-skills/skills/yida-dingtalk-openapi/references/api-contract.md +1 -1
- package/yida-skills/skills/yida-flash-note-to-prd/references/flash-note-prompt.md +1 -1
- package/yida-skills/skills/yida-image-assets/SKILL.md +11 -5
- package/yida-skills/skills/yida-image-assets/references/manifest-contract.md +6 -3
- package/yida-skills/skills/yida-login/SKILL.md +2 -0
- package/yida-skills/skills/yida-nav-group/SKILL.md +9 -1
- package/yida-skills/skills/yida-ppt-slider/references/examples.md +3 -3
- package/yida-skills/skills/yida-prd/SKILL.md +7 -3
- package/yida-skills/skills/yida-publish-page/SKILL.md +3 -0
- package/yida-skills/skills/yida-requirement-analysis/SKILL.md +4 -1
- package/yida-skills/skills/yida-requirement-analysis/references/handoff.md +7 -2
- package/yida-skills/skills/yida-requirement-analysis/workflow/prepare-brief.md +6 -3
- package/yida-skills/skills-index.json +9 -10
- package/lib/a2a/cmd.js +0 -98
- package/lib/a2a/server.js +0 -370
- package/lib/bridge/bridge.js +0 -1292
- package/lib/dws/dws-wrapper.js +0 -230
- package/lib/mcp/server.js +0 -274
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
# OpenYida
|
|
6
6
|
|
|
7
|
-
**AI-native CLI for building
|
|
7
|
+
**AI-native CLI for building applications with AI Yida.**
|
|
8
8
|
|
|
9
|
-
OpenYida connects AI coding agents with Yida
|
|
9
|
+
OpenYida connects AI coding agents with AI Yida, so developers can create apps, forms, workflows, custom pages, reports, integrations, and deployment configuration from a normal chat-driven development workflow.
|
|
10
10
|
|
|
11
11
|
[Quick Start](#quick-start) · [帮助网站&文档](https://demo.aliwork.com/o/openyida/helpCenter) · [Capabilities](#capabilities) · [Full Capability List](https://demo.aliwork.com/o/openyida/helpCenter?openyidaPath=capabilities) · [CLI Reference](https://demo.aliwork.com/o/openyida/helpCenter?openyidaPath=features/skills) · [Examples](https://demo.aliwork.com/o/openyida/helpCenter?openyidaRoute=showcase) · [Contributing](./CONTRIBUTING.md) · [Changelog](https://demo.aliwork.com/o/openyida/helpCenter?openyidaRoute=changelog) · [Application Previews](#application-previews)
|
|
12
12
|
|
|
@@ -105,7 +105,7 @@ npm install -g dingtalk-workspace-cli
|
|
|
105
105
|
dws version
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
Run the installed `dws <command> [args]` directly. Check `dws --help` and the relevant subcommand's help for supported options.
|
|
109
109
|
|
|
110
110
|
OpenYida does not bundle or automatically install dws. Dws manages its own version, updates and login. Use `dws auth login` for DingTalk business access and verify the target organization and account. Native YiDA cool-card creation, reads and editor links work without dws; updating a chat card through dws does not save a YiDA template. See the official instructions for other installation methods and check the installed command's `--help` before use.
|
|
111
111
|
|
|
@@ -261,7 +261,9 @@ openyida publish pages/src/home.canvas.jsx APP_XXX FORM_XXX
|
|
|
261
261
|
|
|
262
262
|
Custom page source is authored directly from PRD and design guidance. Custom page development uses `yida-canvas-custom-page` and `.canvas.jsx`.
|
|
263
263
|
|
|
264
|
-
For member
|
|
264
|
+
For member and department components, `.canvas.jsx` pages should follow `yida-canvas-custom-page/references/native-components-bridge.md` for feature detection, fallback, and value normalization. Attachment and image uploads use the automatically installed `window.__OPENYIDA_FILE_API__` bridge (`upload`, `getDownloadUrl`, `bindFiles`): obtain credentials, upload to OSS, confirm, get private URLs, then bind to the saved instance. This requires a signed-in browser session and does not support anonymous uploads. See `yida-canvas-custom-page/references/file-upload.md`.
|
|
265
|
+
|
|
266
|
+
Extract the upload control with `openyida sample openyida-page-template canvas-file-upload`. Legacy JSX pages can extract the shared client with `openyida sample openyida-page-template file-upload-client` and call `createYidaFileClient(window)`.
|
|
265
267
|
|
|
266
268
|
For the current custom page native-component support matrix, see [Yida native components supported by custom pages](https://demo.aliwork.com/o/openyida/sample/canvas-native-components).
|
|
267
269
|
|
|
@@ -275,11 +277,20 @@ openyida data query form APP_XXX FORM_XXX --page 1 --size 20
|
|
|
275
277
|
openyida data query form APP_XXX FORM_XXX --dynamic-order '{"dateField_xxx":"-"}'
|
|
276
278
|
openyida data query process APP_XXX FORM_XXX --current-approver USER_ID --count
|
|
277
279
|
openyida data create form APP_XXX FORM_XXX --expect-form-name 客户 --expect-form-type receipt --data-file .cache/openyida/data-import/record.json
|
|
280
|
+
openyida data seed form APP_XXX FORM_XXX --expect-form-name 客户 --records-file .cache/openyida/data-import/customers.json --timezone +08:00 --json
|
|
278
281
|
openyida get-permission APP_XXX FORM_XXX
|
|
279
282
|
```
|
|
280
283
|
|
|
281
284
|
`--current-approver` takes an exact userId, not a display name. It scans running instances and their current TODO records, counts each matching instance once, and respects the current login's server-authorized data scope. Omit `--count` to include matching instance data. An incomplete scan or permission failure is reported as an error; the result does not claim application-wide visibility.
|
|
282
285
|
|
|
286
|
+
`data seed form` accepts one JSON array of 1–30 business records using real field IDs (or configured aliases with `--resolve-aliases`). It checks the whole batch against the live schema, then creates and reads back each record, returning `formInstIds`. Use `--check` to preview converted records without writing. `DateField` and date-range endpoints accept millisecond numbers, `YYYY-MM-DD`, or ISO date-times; date-times without an offset use `--timezone` (a fixed UTC offset, default `+08:00`). Subform dates are converted recursively. Invalid dates, reversed ranges and unknown fields/options fail before any write. Business values and real member/department/file/association IDs come from the caller; this command does not invent them or start workflows.
|
|
287
|
+
|
|
288
|
+
Seed supports the 18 writable business components created by default with `create-form`, including associations, subforms, countries, domestic addresses, attachments and images. Serial numbers are server-generated. Addresses support the default domestic `ADDRESS` mode; location/international modes and unknown components follow the CLI's actual diagnostics. Unsupported fields proven optional with no validation are omitted and listed in `skippedFields`, with `requestedFieldsVerified=false`; all-omitted input returns `skipped=true` without creating empty records. Server defaults may still apply. Required or uncertain unsupported fields and invalid supported values fail before writes. Recover pending/unknown writes from the receipt. See [support and recovery](yida-skills/skills/yida-data-management/SKILL.md#组件支持与未适配配置).
|
|
289
|
+
|
|
290
|
+
The input file gets a sibling `.seed-receipt.json`. Rerunning the unchanged command reuses verified records and reads back known pending IDs before continuing. An uncertain write without a trusted ID stops for inspection. Keep the receipt: changing the input, target, identity, schema or omission policy rejects reuse instead of silently creating duplicates. A `.lock` prevents concurrent use of the same receipt; after a process crash, confirm it has stopped and inspect its pending writes before removing the stale lock. Field verification covers submitted values; server-side permissions and business rules still apply.
|
|
291
|
+
|
|
292
|
+
Keep the complete JSON result. After `success=true` and `readbackVerified=true`, match each verified `items[].formInstId` to the input by its zero-based `recordIndex`; `formInstIds` also preserves input order. Create referenced records first, then use those IDs in dependent association values. Avoid `tail/head/grep` on the JSON or list queries whose only purpose is rediscovering returned IDs. Keep the required business spot-check, using `data query form APP_XXX FORM_XXX --inst-id <verified-id> --json`. If output is truncated, read the current command's `receiptFile`; uncertain or cross-session recovery uses the unchanged seed command. Check-only output, pending entries and candidate IDs are not verified association targets. See the [receipt workflow](yida-skills/skills/yida-data-management/SKILL.md#直接消费回执与关联-id).
|
|
293
|
+
|
|
283
294
|
Append and forward permissions are configured in the process definition through `nodes[].actions.normalActions/appendActions`. Both `create-process` and `configure-process` compile these settings into matching designer and runtime properties. See [approval action configuration](yida-skills/skills/yida-flow-node-config/references/actions.md) for the JSON example, defaults, and verification limits.
|
|
284
295
|
|
|
285
296
|
`configure-process` 的流程 JSON 中,审批人可配置为发起人、指定成员、指定角色、部门主管或直属主管,例如:
|
|
@@ -488,8 +499,8 @@ When preparing a PR that needs a personal Fork, or when you ask how to support t
|
|
|
488
499
|
| `openyida app-list [--type managed\|created] [--page N] [--size N]` | Page through apps I manage or created |
|
|
489
500
|
| `openyida solution-template <search\|detail\|prepare\|ai-build\|enable\|status> [templateId\|requestId] [options] [--json]` | Solution templates for independent local agents: discovery, cloud AI handoff and direct enable |
|
|
490
501
|
| `openyida corp-efficiency [overview\|details\|detail\|groups\|notify] [options] [--open\|--no-open]` | Query enterprise efficiency overview and detail reports |
|
|
491
|
-
| `openyida create-app "<name>"\|--name <name> [options] [--locale zh_CN\|en_US\|ja_JP] [--open\|--no-open]` | Create a Yida app |
|
|
492
|
-
| `openyida design-plan catalog [--json]` | List available planning themes and page patterns |
|
|
502
|
+
| `openyida create-app "<name>"\|--name <name> [options] [--locale zh_CN\|en_US\|ja_JP] [--open\|--no-open] [--json]` | Create a Yida app |
|
|
503
|
+
| `openyida design-plan catalog [--compact] [--json]` | List available planning themes and page patterns |
|
|
493
504
|
| `openyida design-plan init <requirement-brief.json> [--theme-id <id>] [--output-dir <dir>] [--json]` | Initialize a plan draft from confirmed requirements |
|
|
494
505
|
| `openyida design-plan preview <build-plan.json> --part-file <module.json> [--json]` | Update plan drafts by module |
|
|
495
506
|
| `openyida design-plan materialize <build-plan.json> [--from-preview \| --business-file <json> --visual-file <json>] [--output-dir <dir>] [--rebase-parts] [--check] [--json]` | Generate or update plan documents and theme with consistency checks |
|
|
@@ -532,7 +543,7 @@ When preparing a PR that needs a personal Fork, or when you ask how to support t
|
|
|
532
543
|
| `openyida custom-button <list\|inspect\|options\|create\|update\|delete> <appType> <formUuid> [buttonUuid] [--config <file>] [--expected-hash <hash>] [--backup <file>] [--yes] [--json]` | Native custom buttons: inspect and configure form edits, automation flows and page links |
|
|
533
544
|
| `openyida form-message <list\|inspect\|options\|create\|update\|delete> <appType> <formUuid> [messageId] [--config <file>] [--expected-hash <hash>] [--backup <file>] [--yes] [--json]` | Native form notifications: inspect triggers, recipients and templates, then safely maintain bindings |
|
|
534
545
|
| `openyida get-schema <appType> <formUuid\|--all> [--summary-json\|--field-map-json\|--analysis-json]` | Get one form Schema or all form Schemas |
|
|
535
|
-
| `openyida check-prd-completeness <prd.md> --
|
|
546
|
+
| `openyida check-prd-completeness (<prd.md> [--build-manifest <file>] \| --build-spec <build-context.json> [--build-manifest <file>] \| --manifest-only --build-manifest <file>) --app-type <appType> [--json]` | Check resources, frontend menu hiding and application theme delivery |
|
|
536
547
|
| `openyida check-design <design.md> [--prd <prd.md>] [--base-dir <dir>] [--json]` | Validate design documents, theme tokens and PRD handoff |
|
|
537
548
|
| `openyida er <appType> [--format mermaid\|json] [--output file] [--include-system] [--include-pages]` | Export app entity relationship diagram |
|
|
538
549
|
| `openyida create-page <appType> "<name>" [--mode dashboard] [--hide-nav] [--locale zh_CN\|en_US\|ja_JP] [--open\|--no-open]` | Create a custom display page |
|
|
@@ -547,7 +558,7 @@ When preparing a PR that needs a personal Fork, or when you ask how to support t
|
|
|
547
558
|
|
|
548
559
|
| Command | Description |
|
|
549
560
|
|---------|-------------|
|
|
550
|
-
| `openyida data <query\|get\|create\|update\|transfer> <resource> ... \| delete form <appType> <formUuid> --inst-id <id> --expect-form-name <name> --expect-form-type receipt --confirm [--json]` | Unified data management (form/process/task/subform) |
|
|
561
|
+
| `openyida data <query\|get\|create\|update\|transfer\|seed> <resource> ... \| delete form <appType> <formUuid> --inst-id <id> --expect-form-name <name> --expect-form-type receipt --confirm [--json]` | Unified data management (form/process/task/subform) |
|
|
551
562
|
| `openyida task-center <todo\|created\|done\|cc\|proxy\|capabilities\|link\|scaffold\|options\|inspect\|count> [--spec <file.json> --output <file.canvas.jsx>] [options]` | Global task center (todo/processed/cc etc.) |
|
|
552
563
|
| `openyida basic-info <overview\|commodity\|grant\|capacity\|quota\|abs-path\|dataflow\|i18n\|domain>` | Query organization basic info, capacity, quotas, and domain settings |
|
|
553
564
|
| `openyida read-dingtalk-doc <docUrl> [--output <file>] [--json]` | Fetch Markdown content from a DingTalk document |
|
|
@@ -622,8 +633,6 @@ When preparing a PR that needs a personal Fork, or when you ask how to support t
|
|
|
622
633
|
| `openyida integration check <appType...>` | Check abnormal integration automation run logs |
|
|
623
634
|
| `openyida integration detail-log <appType> <procInstId> [--json] [--include-params]` | View integration automation run log details |
|
|
624
635
|
| `openyida integration diagnose (--text <text>\|--file <path>\|--rules) [--json]` | Diagnose integration automation tickets and common pitfalls |
|
|
625
|
-
| `openyida dws <command> [args]` | DingTalk CLI (contacts/calendar/todo/approval etc.) |
|
|
626
|
-
| `openyida dws contact user search --keyword <text>` | DingTalk CLI (contacts/calendar/todo/approval etc.) |
|
|
627
636
|
| `openyida dingtalk-link <url> [--target fullScreen] [--legacy-scheme] [--json]` | Generate DingTalk AppLink / legacy dingtalk:// page links |
|
|
628
637
|
|
|
629
638
|
### Utility
|
|
@@ -633,10 +642,8 @@ When preparing a PR that needs a personal Fork, or when you ask how to support t
|
|
|
633
642
|
| `openyida commands [--json]` | Output machine-readable command manifest |
|
|
634
643
|
| `openyida agent-capabilities [--json] [--summary-json\|--compact]` | Output one-shot agent capability snapshot |
|
|
635
644
|
| `openyida agent <doctor\|diagnose\|status\|connect\|run\|disconnect\|logout\|logs> [options]` | Connect a local Agent (Go runtime, development preview) |
|
|
636
|
-
| `openyida a2a <serve\|agent-card> [options]` | Start local read-only A2A adapter or print Agent Card |
|
|
637
|
-
| `openyida bridge start [--token <pair-token>] [--port 6736] [--origin https://demo.aliwork.com] [--open\|--no-open]` | Start OpenYida local web bridge service |
|
|
638
645
|
| `openyida copy [--force]` | Copy project working directory |
|
|
639
|
-
| `openyida sample [--list] [<skill> <name>] [--output <file-or-directory>] [--var KEY=VALUE ...] [--design-file <design.md>] [--style-id <themeId\|free-creative>] [--theme-ids <id,...>] [--pop-art-context <explicit-request\|showcase>]` | Output code samples/templates |
|
|
646
|
+
| `openyida sample [--list] [<skill> <name>] [--output <file-or-directory>] [--var KEY=VALUE ...] [--design-file <design.md>] [--spec-file <spec.json>] [--primary-color <color>] [--tokens-file <theme.json>] [--nav-theme light\|dark] [--check] [--style-id <themeId\|free-creative>] [--theme-ids <id,...>] [--pop-art-context <explicit-request\|showcase>]` | Output code samples/templates |
|
|
640
647
|
| `openyida doctor [--fix]` | Environment diagnostics & auto-fix |
|
|
641
648
|
| `openyida db-seq-fix [--fix]` | Detect and repair PostgreSQL sequence drift |
|
|
642
649
|
| `openyida formula evaluate <formula\|file> [--schema file] [--contract field-value\|validation-rule\|business-action\|node-expression] [--context form\|validation\|automation\|business] [--target-type NumberField] [--metadata file] [--strict] [--json]` | Static-check Yida formula syntax and field refs |
|
|
@@ -649,7 +656,7 @@ When preparing a PR that needs a personal Fork, or when you ask how to support t
|
|
|
649
656
|
| `openyida update` | Check and update to latest version |
|
|
650
657
|
| `openyida export-conversation [options]` | Export AI conversation records |
|
|
651
658
|
| `openyida feedback <report\|github\|setup\|url\|dismiss\|status> [options]` | Prepare local issue reports, configure feedback forms and reminders |
|
|
652
|
-
| `openyida batch <file>\|--commands "cmd1 ; cmd2" [--stop-on-error] [--json]` | Run OpenYida commands in batch |
|
|
659
|
+
| `openyida batch <file>\|--commands "cmd1 ; cmd2" [--concurrency 1..4] [--stop-on-error] [--json]` | Run OpenYida commands in batch |
|
|
653
660
|
| `openyida flash-to-prd --file <path> --name "<project>"` | Convert flash notes or meeting notes to a PRD prompt |
|
|
654
661
|
| `openyida ai <text\|image> [options]` | Call Yida AI text and image recognition APIs |
|
|
655
662
|
| `openyida asset <status\|resolve\|sources> [options]` | Detect asset capability / resolve materials |
|
package/bin/yida.js
CHANGED
|
@@ -86,7 +86,6 @@ function printHelp() {
|
|
|
86
86
|
console.log(` ${DIM}${RESET} openyida login`);
|
|
87
87
|
console.log(` ${DIM}${RESET} openyida create-app "${t('help.quickstart_app_name')}"`);
|
|
88
88
|
console.log(` ${DIM}${RESET} openyida create-form create APP_XXX "${t('help.quickstart_form_name')}" .cache/openyida/forms/fields.json`);
|
|
89
|
-
console.log(` ${DIM}${RESET} openyida dws contact user search --keyword "张三"`);
|
|
90
89
|
console.log('');
|
|
91
90
|
console.log(` ${DIM}${t('help.docs')} https://demo.aliwork.com/o/openyida/helpCenter · https://github.com/openyida/openyida${RESET}`);
|
|
92
91
|
console.log('');
|
|
@@ -667,24 +666,6 @@ async function main() {
|
|
|
667
666
|
break;
|
|
668
667
|
}
|
|
669
668
|
|
|
670
|
-
case 'mcp': {
|
|
671
|
-
const { runStdioServer } = require('../lib/mcp/server');
|
|
672
|
-
runStdioServer();
|
|
673
|
-
break;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
case 'a2a': {
|
|
677
|
-
const { run } = require('../lib/a2a/cmd');
|
|
678
|
-
await run(args);
|
|
679
|
-
break;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
case 'bridge': {
|
|
683
|
-
const { run } = require('../lib/bridge/bridge');
|
|
684
|
-
await run(args);
|
|
685
|
-
break;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
669
|
case 'env': {
|
|
689
670
|
if (shouldUseEnvManagement(args)) {
|
|
690
671
|
const { run } = require('../lib/core/env-cmd');
|
|
@@ -1346,12 +1327,6 @@ async function main() {
|
|
|
1346
1327
|
break;
|
|
1347
1328
|
}
|
|
1348
1329
|
|
|
1349
|
-
case 'dws': {
|
|
1350
|
-
const { run: runDws } = require('../lib/dws/dws-wrapper');
|
|
1351
|
-
await runDws(args);
|
|
1352
|
-
break;
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
1330
|
case 'dingtalk-link': {
|
|
1356
1331
|
const { run: runDingTalkLink } = require('../lib/dingtalk/dingtalk-link');
|
|
1357
1332
|
await runDingTalkLink(args);
|
|
@@ -1395,7 +1370,8 @@ async function main() {
|
|
|
1395
1370
|
|
|
1396
1371
|
case 'batch': {
|
|
1397
1372
|
const { run: runBatch } = require('../lib/core/batch');
|
|
1398
|
-
await runBatch(args);
|
|
1373
|
+
const summary = await runBatch(args);
|
|
1374
|
+
if (summary?.success === false) { process.exitCode = 1; }
|
|
1399
1375
|
break;
|
|
1400
1376
|
}
|
|
1401
1377
|
|
|
@@ -49,7 +49,7 @@ function beginManagedMutationCapture({ command, args, env = process.env, console
|
|
|
49
49
|
return {
|
|
50
50
|
commit() {
|
|
51
51
|
restore();
|
|
52
|
-
if (explicitFailure || !latest) {return null;}
|
|
52
|
+
if (explicitFailure || !latest || latest.mutationPerformed === false) {return null;}
|
|
53
53
|
const isReport = command === 'create-report' || command === 'append-chart';
|
|
54
54
|
const formUuid = resourceId(latest?.formUuid, latest?.pageId,
|
|
55
55
|
isReport ? latest?.reportId : undefined, classification.formUuid);
|
|
@@ -62,4 +62,38 @@ function buildDisplayPageEntryUrls({ appType, formUuid, baseUrl, config, formTyp
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
function preferredLinkPresentationTool(runtime = {}) {
|
|
66
|
+
return runtime.subtype === 'qwenwork_web' ? 'show_link'
|
|
67
|
+
: runtime.subtype === 'qwenwork_desktop' ? 'artifact_show_link' : null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// A host action contract; CLI output cannot prove host tool execution.
|
|
71
|
+
function buildLinkPresentationCompletionGate() {
|
|
72
|
+
return {
|
|
73
|
+
host: 'qwenwork',
|
|
74
|
+
required_when: 'verified_target_and_available_host_link_tool_unless_user_excludes_target',
|
|
75
|
+
order: ['verify_business_result', 'select_verified_entry', 'call_host_link_tool', 'inspect_tool_result', 'final_reply'],
|
|
76
|
+
evidence: 'actual_host_tool_result_for_selected_url_in_current_turn',
|
|
77
|
+
not_evidence: ['create_app_success', 'resource_readback', 'markdown_link', 'sidebar_open', 'browser_handoff', 'previous_turn_tool_result'],
|
|
78
|
+
fallback: 'Only declared tool absence or an actual call failure permits clickable-link fallback. Record the evidence internally; an omitted call is not tool absence.',
|
|
79
|
+
enforcement_owner: 'host_agent',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function buildCreatedAppLinkPresentation(entry, runtime = {}) {
|
|
84
|
+
if (runtime.tool !== 'qwenwork' || !entry.adminUrl || !entry.appType) { return null; }
|
|
85
|
+
try {
|
|
86
|
+
const url = new URL(entry.adminUrl);
|
|
87
|
+
if (!['https:', 'http:'].includes(url.protocol) || url.pathname !== `/${entry.appType}/admin`) { return null; }
|
|
88
|
+
} catch { return null; }
|
|
89
|
+
return {
|
|
90
|
+
status: 'pending', timing: 'before_final_reply',
|
|
91
|
+
preferredTool: preferredLinkPresentationTool(runtime), toolAvailability: 'check_host_tool_inventory',
|
|
92
|
+
url: entry.adminUrl, title: entry.appName || entry.appType, maxCallsPerTurn: 1,
|
|
93
|
+
completionGate: buildLinkPresentationCompletionGate(),
|
|
94
|
+
instruction: 'Keep pending while building. Before final summary or delivery completion, call the host link tool once with this exact URL using its declared parameters, then inspect its result. App shells and partial deliveries also require this. --no-open does not cancel it. Honor user exclusions; never recreate the app for presentation.',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = { buildApplicationEntryUrls, buildApplicationSettingsUrls, buildDisplayPageEntryUrls, readRenderNav,
|
|
99
|
+
preferredLinkPresentationTool, buildLinkPresentationCompletionGate, buildCreatedAppLinkPresentation };
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { CliError } = require('../core/cli-error');
|
|
6
6
|
const { t } = require('../core/i18n');
|
|
7
|
-
const { DESIGN_SKILL_ROOT,
|
|
7
|
+
const { DESIGN_SKILL_ROOT, resolveTheme } = require('../design-plan/themes');
|
|
8
8
|
const START = '/* OPENYIDA APPLICATION STYLE RECIPES START';
|
|
9
9
|
const END = '/* OPENYIDA APPLICATION STYLE RECIPES END */';
|
|
10
10
|
const CREATIVE_TOKENS = [
|
|
@@ -46,8 +46,7 @@ function applyApplicationStyle(css, metadata, tokens) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function exportApplicationStyle(id, outputDirectory) {
|
|
49
|
-
const theme =
|
|
50
|
-
if (!theme) {throw new CliError(t('design_document.invalid', id || '--style-id', 'APPLICATION_STYLE_UNKNOWN'), { code: 'APPLICATION_STYLE_UNKNOWN' });}
|
|
49
|
+
const theme = resolveTheme(id, '--style-id');
|
|
51
50
|
const directory = path.resolve(outputDirectory);
|
|
52
51
|
const assets = [['design.md', theme.templatePath], ['app_theme.css', theme.cssTemplatePath], ['form-layout.json', theme.formLayoutPath]];
|
|
53
52
|
const outputs = assets.map(([name, relative]) => {
|
|
@@ -31,6 +31,8 @@ function parseArgs(args = [], options = {}) {
|
|
|
31
31
|
if (options.strict && arg.startsWith('-')) {seen.add(key);}
|
|
32
32
|
if (arg === '--help' || arg === '-h') {
|
|
33
33
|
parsed.help = true;
|
|
34
|
+
} else if (arg === '--manifest-only') {
|
|
35
|
+
parsed.manifestOnly = true;
|
|
34
36
|
} else if (arg === '--json') {
|
|
35
37
|
parsed.json = true;
|
|
36
38
|
} else if (APP_TYPE_OPTIONS.includes(arg) && args[index + 1] && (!options.strict || !args[index + 1].startsWith('-'))) {
|
|
@@ -39,6 +41,8 @@ function parseArgs(args = [], options = {}) {
|
|
|
39
41
|
} else if ((arg === '--build-manifest' || arg === '--manifest') && args[index + 1] && (!options.strict || !args[index + 1].startsWith('-'))) {
|
|
40
42
|
parsed.buildManifestPath = args[index + 1];
|
|
41
43
|
index++;
|
|
44
|
+
} else if (arg === '--build-spec' && args[index + 1] && !args[index + 1].startsWith('-')) {
|
|
45
|
+
parsed.buildSpecPath = args[++index];
|
|
42
46
|
} else if (!arg.startsWith(options.strict ? '-' : '--') && !parsed.prdPath) {
|
|
43
47
|
parsed.prdPath = arg;
|
|
44
48
|
} else if (options.strict) {
|
|
@@ -458,7 +462,15 @@ function matchResource(expected, actualResources) {
|
|
|
458
462
|
async function evaluatePrdCompleteness(markdown, options = {}, deps = {}) {
|
|
459
463
|
const appType = options.appType;
|
|
460
464
|
const authRef = options.authRef || {};
|
|
461
|
-
const
|
|
465
|
+
const fast = options.fastSpec;
|
|
466
|
+
const parsedPrd = fast ? {
|
|
467
|
+
resources: [...fast.resources, ...fast.pages.map(page => ({ ...page, type: 'display-page' }))]
|
|
468
|
+
.map(resource => ({ name: resource.name, type: resource.type, kind: resource.type, source: 'fast.resources' }))
|
|
469
|
+
.filter(resource => CHECKABLE_RESOURCE_KINDS.has(resource.kind)),
|
|
470
|
+
navigationVisibility: fast.navigationVisibility || [],
|
|
471
|
+
...(fast.applicationTheme ? { applicationTheme: fast.applicationTheme } : {}),
|
|
472
|
+
} : options.manifestOnly ? { resources: [], navigationVisibility: options.buildManifest?.navigationVisibility || [],
|
|
473
|
+
...(options.buildManifest?.applicationTheme ? { applicationTheme: options.buildManifest.applicationTheme } : {}) } : parsePrdMarkdown(markdown);
|
|
462
474
|
const parsedManifest = parseBuildManifest(options.buildManifest);
|
|
463
475
|
const items = [];
|
|
464
476
|
const assetExecution = auditAssetExecution(options.buildManifest?.assetExecution, options.buildManifest?.assetTasks);
|
|
@@ -482,10 +494,11 @@ async function evaluatePrdCompleteness(markdown, options = {}, deps = {}) {
|
|
|
482
494
|
prdPath: options.prdPath || '',
|
|
483
495
|
buildManifestPath: options.buildManifestPath || '',
|
|
484
496
|
sources: {
|
|
485
|
-
prd: {
|
|
497
|
+
prd: fast || options.manifestOnly ? null : {
|
|
486
498
|
mode: 'best_effort_hints',
|
|
487
499
|
resources: parsedPrd.resources.length,
|
|
488
500
|
},
|
|
501
|
+
...(fast ? { buildSpec: { mode: 'execution_contract', path: options.buildSpecPath || '', resources: parsedPrd.resources.length } } : {}),
|
|
489
502
|
buildManifest: options.buildManifest ? {
|
|
490
503
|
mode: 'build_facts',
|
|
491
504
|
path: options.buildManifestPath || '',
|
|
@@ -665,14 +678,19 @@ async function run(args = []) {
|
|
|
665
678
|
if (parsed.help) {
|
|
666
679
|
console.error(t('check_prd_completeness.usage'));
|
|
667
680
|
console.error(t('check_prd_completeness.example'));
|
|
681
|
+
console.error('openyida check-prd-completeness --manifest-only --build-manifest <file> --app-type <appType> --json');
|
|
682
|
+
console.error('openyida check-prd-completeness --build-spec <build-context.json> --app-type <appType> [--build-manifest <file>] [--json]');
|
|
668
683
|
return;
|
|
669
684
|
}
|
|
670
|
-
if (
|
|
685
|
+
if ([!!parsed.prdPath, !!parsed.buildSpecPath, !!parsed.manifestOnly].filter(Boolean).length !== 1
|
|
686
|
+
|| !parsed.appType || (parsed.manifestOnly && !parsed.buildManifestPath)) {
|
|
671
687
|
throwUsage(t('check_prd_completeness.usage'), t('check_prd_completeness.example'));
|
|
672
688
|
}
|
|
673
689
|
|
|
674
|
-
const prdPath = path.resolve(parsed.prdPath);
|
|
675
|
-
|
|
690
|
+
const prdPath = parsed.prdPath ? path.resolve(parsed.prdPath) : '';
|
|
691
|
+
const buildSpecPath = parsed.buildSpecPath ? path.resolve(parsed.buildSpecPath) : '';
|
|
692
|
+
const fastSpec = buildSpecPath ? require('./fast-build').readFastBuild(buildSpecPath) : undefined;
|
|
693
|
+
if (prdPath && !fs.existsSync(prdPath)) {
|
|
676
694
|
throwCommandError(t('check_prd_completeness.prd_not_found', prdPath), {
|
|
677
695
|
code: 'PRD_COMPLETENESS_FILE_NOT_FOUND',
|
|
678
696
|
});
|
|
@@ -686,11 +704,14 @@ async function run(args = []) {
|
|
|
686
704
|
}
|
|
687
705
|
|
|
688
706
|
console.error(t('check_prd_completeness.checking', parsed.appType));
|
|
689
|
-
const markdown = fs.readFileSync(prdPath, 'utf8');
|
|
707
|
+
const markdown = prdPath ? fs.readFileSync(prdPath, 'utf8') : '';
|
|
690
708
|
const buildManifest = loadBuildManifest(parsed.buildManifestPath);
|
|
691
709
|
const result = await evaluatePrdCompleteness(markdown, {
|
|
692
710
|
appType: parsed.appType,
|
|
693
711
|
prdPath,
|
|
712
|
+
fastSpec,
|
|
713
|
+
manifestOnly: parsed.manifestOnly === true,
|
|
714
|
+
buildSpecPath,
|
|
694
715
|
buildManifestPath: buildManifest ? buildManifest.path : '',
|
|
695
716
|
buildManifest: buildManifest ? buildManifest.content : null,
|
|
696
717
|
authRef,
|
package/lib/app/create-app.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* create-app.js - 宜搭应用创建命令
|
|
3
3
|
*
|
|
4
|
-
* 用法:openyida create-app "<appName>" [description] [icon] [iconColor]
|
|
5
|
-
* openyida create-app --name "<appName>" [--desc "<description>"]
|
|
4
|
+
* 用法:openyida create-app "<appName>" [description] [icon] [iconColor] [--json]
|
|
5
|
+
* openyida create-app --name "<appName>" [--desc "<description>"] [--json]
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
@@ -13,10 +13,11 @@ const querystring = require('querystring');
|
|
|
13
13
|
const {
|
|
14
14
|
httpPost,
|
|
15
15
|
requestWithAutoLogin,
|
|
16
|
+
detectRuntimeCapabilities,
|
|
16
17
|
} = require('../core/utils');
|
|
17
18
|
const { createAuthRef } = require('../core/yida-client');
|
|
18
19
|
const { t } = require('../core/i18n');
|
|
19
|
-
const { buildApplicationEntryUrls } = require('./application-entry-urls');
|
|
20
|
+
const { buildApplicationEntryUrls, buildCreatedAppLinkPresentation } = require('./application-entry-urls');
|
|
20
21
|
const { buildYidaI18n, normalizeYidaLocale, resolveContentLocale } = require('../core/yida-i18n');
|
|
21
22
|
const { parseOpenOption, withBrowserHandoff } = require('../core/browser-handoff');
|
|
22
23
|
const { throwCommandError } = require('../core/command-errors');
|
|
@@ -192,6 +193,9 @@ function parseCreateAppArgs(args, random = Math.random) {
|
|
|
192
193
|
const arg = args[index];
|
|
193
194
|
|
|
194
195
|
switch (arg) {
|
|
196
|
+
case '--json':
|
|
197
|
+
// Success already emits JSON on stdout; accept the explicit format flag.
|
|
198
|
+
break;
|
|
195
199
|
case '--name':
|
|
196
200
|
case '-n':
|
|
197
201
|
params.appName = readOptionValue(args, index, arg);
|
|
@@ -316,16 +320,15 @@ async function run(args) {
|
|
|
316
320
|
try {
|
|
317
321
|
params = parseCreateAppArgs(args);
|
|
318
322
|
} catch (err) {
|
|
319
|
-
|
|
320
|
-
chalkError(err.message, { hint: t('create_app.usage') });
|
|
323
|
+
throwCommandError(`${err.message}\n${t('create_app.usage')}`, { code: 'INVALID_ARGUMENTS' });
|
|
321
324
|
}
|
|
322
325
|
|
|
323
326
|
if (!params.appName) {
|
|
324
|
-
|
|
325
|
-
chalkError(t('create_app.usage'), { hint: t('create_app.example') });
|
|
327
|
+
throwCommandError(`${t('create_app.usage')}\n${t('create_app.example')}`, { code: 'INVALID_ARGUMENTS' });
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
const { appName, description, icon, iconColor } = params;
|
|
331
|
+
const runtime = typeof detectRuntimeCapabilities === 'function' ? detectRuntimeCapabilities() : {};
|
|
329
332
|
|
|
330
333
|
const { c, banner, step, label, success: chalkSuccess, result: chalkResult } = require('../core/chalk');
|
|
331
334
|
|
|
@@ -374,6 +377,7 @@ async function run(args) {
|
|
|
374
377
|
if (response && response.success && response.content) {
|
|
375
378
|
const appType = response.content;
|
|
376
379
|
const entryUrls = buildApplicationEntryUrls({ appType, baseUrl: authRef.baseUrl });
|
|
380
|
+
const linkPresentation = buildCreatedAppLinkPresentation({ appType, appName, ...entryUrls }, runtime);
|
|
377
381
|
const appUrl = entryUrls.appUrl;
|
|
378
382
|
const corpId = authRef.corpId || (authRef.authData && authRef.authData.corp_id) || '';
|
|
379
383
|
|
|
@@ -389,7 +393,8 @@ async function run(args) {
|
|
|
389
393
|
themeVerification = { verified: true, appThemeMode: 'modern', source: theme.source,
|
|
390
394
|
scope: 'configuration_readback', runtimeVerified: false };
|
|
391
395
|
} catch (error) {
|
|
392
|
-
const created = { appCreated: true, appType, corpId, url: appUrl,
|
|
396
|
+
const created = { appCreated: true, appType, corpId, url: appUrl, ...entryUrls,
|
|
397
|
+
...(linkPresentation ? { linkPresentation } : {}), retryCreate: false,
|
|
393
398
|
partial: true, residual: { appType, corpId }, retrySafe: false, mutationPerformed: true,
|
|
394
399
|
sideEffectState: 'applied', readbackAllowed: true };
|
|
395
400
|
if (isPermissionGuidanceError(error)) {
|
|
@@ -424,6 +429,7 @@ async function run(args) {
|
|
|
424
429
|
themeVerification,
|
|
425
430
|
url: appUrl,
|
|
426
431
|
...entryUrls,
|
|
432
|
+
...(linkPresentation ? { linkPresentation } : {}),
|
|
427
433
|
},
|
|
428
434
|
appUrl,
|
|
429
435
|
{ stage: 'create_app_success', title: appName },
|
|
@@ -432,7 +438,9 @@ async function run(args) {
|
|
|
432
438
|
} else {
|
|
433
439
|
const errorMsg = response ? response.errorMsg || t('common.unknown_error') : t('common.request_failed');
|
|
434
440
|
chalkResult(false, t('create_app.failed', errorMsg));
|
|
435
|
-
|
|
441
|
+
if (!args.includes('--json')) {
|
|
442
|
+
console.log(JSON.stringify({ success: false, error: errorMsg }));
|
|
443
|
+
}
|
|
436
444
|
throwCommandError(errorMsg);
|
|
437
445
|
}
|
|
438
446
|
}
|
package/lib/app/create-form.js
CHANGED
|
@@ -1125,7 +1125,7 @@ function buildFieldComponent(field) {
|
|
|
1125
1125
|
|
|
1126
1126
|
// 关联表单核心配置
|
|
1127
1127
|
props.associationForm = {
|
|
1128
|
-
formType: 'receipt',
|
|
1128
|
+
formType: assocConfig.formType || 'receipt',
|
|
1129
1129
|
formUuid: assocConfig.formUuid || '',
|
|
1130
1130
|
appType: assocConfig.appType || '',
|
|
1131
1131
|
appName: assocConfig.appName || '',
|
|
@@ -4317,27 +4317,25 @@ function applySmartValidations(schema, rawRules) {
|
|
|
4317
4317
|
};
|
|
4318
4318
|
}
|
|
4319
4319
|
|
|
4320
|
-
function collectSmartValidationRulesFromFields(fields,
|
|
4321
|
-
const
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
});
|
|
4340
|
-
}
|
|
4320
|
+
function collectSmartValidationRulesFromFields(fields, schema) {
|
|
4321
|
+
const root = schema.pages[0].componentsTree?.[0];
|
|
4322
|
+
const container = root ? findFormContainer(root) : null;
|
|
4323
|
+
const evidence = collectResumeFieldEvidence(container?.children);
|
|
4324
|
+
const rules = [];
|
|
4325
|
+
collectResumeDesiredFields(fields, { verifyNestedFields: true }).forEach(function ({ field, tablePath }) {
|
|
4326
|
+
const identity = desiredResumeFieldIdentity(field);
|
|
4327
|
+
const key = JSON.stringify([...tablePath, identity.label]);
|
|
4328
|
+
const matches = evidence.filter(item => JSON.stringify([...item.tablePath, item.label]) === key);
|
|
4329
|
+
// Inline rules belong to this definition's field, even when another table
|
|
4330
|
+
// uses the same label. Keep ambiguous definitions on the existing error path.
|
|
4331
|
+
const reference = matches.length === 1 && matches[0].componentName === identity.componentName
|
|
4332
|
+
? matches[0].fieldId : field.label;
|
|
4333
|
+
collectInputValidationRules(field, { includeAdvanced: true }).forEach(function (rule) {
|
|
4334
|
+
if (rule.type === 'required' && !field.required && !field.validation && !field.validations) {
|
|
4335
|
+
return;
|
|
4336
|
+
}
|
|
4337
|
+
rules.push(Object.assign({ field: reference }, rule));
|
|
4338
|
+
});
|
|
4341
4339
|
});
|
|
4342
4340
|
return rules;
|
|
4343
4341
|
}
|
|
@@ -5036,7 +5034,7 @@ async function mainCreate(parsedArgs, authRef) {
|
|
|
5036
5034
|
|
|
5037
5035
|
postCreateStage = 'buildFormSchema';
|
|
5038
5036
|
const schema = buildFormSchema(formTitle, fields, formUuid, corpId, appType, layout, theme, labelAlign);
|
|
5039
|
-
const createValidationRules = collectSmartValidationRulesFromFields(fields).concat(validations || []);
|
|
5037
|
+
const createValidationRules = collectSmartValidationRulesFromFields(fields, schema).concat(validations || []);
|
|
5040
5038
|
if (createValidationRules.length > 0) {
|
|
5041
5039
|
const appliedValidations = applySmartValidations(schema, createValidationRules);
|
|
5042
5040
|
info('已为创建表单写入 ' + appliedValidations.appliedRules.length + ' 条字段校验');
|
|
@@ -5154,7 +5152,7 @@ async function createFormForLegacyProcessQuiet(context, input) {
|
|
|
5154
5152
|
const serverRevision = extractSchemaServerRevision(shellSchemaResult);
|
|
5155
5153
|
const corpId = resolveCorpId(authRef.authData || authRef);
|
|
5156
5154
|
const schema = buildFormSchema(formTitle, fields, formUuid, corpId, appType, layout, theme, labelAlign);
|
|
5157
|
-
const createValidationRules = collectSmartValidationRulesFromFields(fields).concat(validations || []);
|
|
5155
|
+
const createValidationRules = collectSmartValidationRulesFromFields(fields, schema).concat(validations || []);
|
|
5158
5156
|
if (createValidationRules.length > 0) {
|
|
5159
5157
|
applySmartValidations(schema, createValidationRules);
|
|
5160
5158
|
}
|
|
@@ -5984,7 +5982,7 @@ async function mainValidation(parsedArgs, authRef) {
|
|
|
5984
5982
|
|
|
5985
5983
|
// ── update 模式主流程 ─────────────────────────────────
|
|
5986
5984
|
|
|
5987
|
-
function collectResumeFieldEvidence(fields, output) {
|
|
5985
|
+
function collectResumeFieldEvidence(fields, output, tablePath = []) {
|
|
5988
5986
|
const evidence = output || [];
|
|
5989
5987
|
(fields || []).forEach(function (field) {
|
|
5990
5988
|
if (!field || typeof field !== 'object') {
|
|
@@ -5996,10 +5994,12 @@ function collectResumeFieldEvidence(fields, output) {
|
|
|
5996
5994
|
label: labelText,
|
|
5997
5995
|
componentName: field.componentName,
|
|
5998
5996
|
fieldId: field.props && field.props.fieldId ? field.props.fieldId : null,
|
|
5997
|
+
tablePath,
|
|
5999
5998
|
});
|
|
6000
5999
|
}
|
|
6001
6000
|
if (Array.isArray(field.children)) {
|
|
6002
|
-
collectResumeFieldEvidence(field.children.flat(), evidence
|
|
6001
|
+
collectResumeFieldEvidence(field.children.flat(), evidence,
|
|
6002
|
+
field.componentName === 'TableField' ? tablePath.concat(labelText) : tablePath);
|
|
6003
6003
|
}
|
|
6004
6004
|
});
|
|
6005
6005
|
return evidence;
|
|
@@ -6020,9 +6020,9 @@ function collectResumeDesiredFields(fields, options) {
|
|
|
6020
6020
|
const output = [];
|
|
6021
6021
|
const verifyNestedFields = Boolean(options && options.verifyNestedFields);
|
|
6022
6022
|
|
|
6023
|
-
function visit(value) {
|
|
6023
|
+
function visit(value, tablePath) {
|
|
6024
6024
|
if (Array.isArray(value)) {
|
|
6025
|
-
value.forEach(visit);
|
|
6025
|
+
value.forEach(field => visit(field, tablePath));
|
|
6026
6026
|
return;
|
|
6027
6027
|
}
|
|
6028
6028
|
if (!value || typeof value !== 'object') {
|
|
@@ -6030,17 +6030,18 @@ function collectResumeDesiredFields(fields, options) {
|
|
|
6030
6030
|
}
|
|
6031
6031
|
const componentName = normalizeFormDefinitionType(value);
|
|
6032
6032
|
if (isSupportedBusinessFieldType(componentName)) {
|
|
6033
|
-
output.push(value);
|
|
6033
|
+
output.push({ field: value, tablePath });
|
|
6034
6034
|
if (!verifyNestedFields) {
|
|
6035
6035
|
return;
|
|
6036
6036
|
}
|
|
6037
6037
|
}
|
|
6038
6038
|
if (Array.isArray(value.children)) {
|
|
6039
|
-
value.children
|
|
6039
|
+
visit(value.children, componentName === 'TableField'
|
|
6040
|
+
? tablePath.concat(desiredResumeFieldIdentity(value).label) : tablePath);
|
|
6040
6041
|
}
|
|
6041
6042
|
}
|
|
6042
6043
|
|
|
6043
|
-
visit(fields);
|
|
6044
|
+
visit(fields, []);
|
|
6044
6045
|
return output;
|
|
6045
6046
|
}
|
|
6046
6047
|
|
|
@@ -6068,28 +6069,34 @@ function isRecoverableBlankResumeSchema(schema) {
|
|
|
6068
6069
|
}
|
|
6069
6070
|
|
|
6070
6071
|
function buildResumeChanges(existingFields, desiredFields) {
|
|
6071
|
-
|
|
6072
|
+
// Layout containers do not change identity. A table creates a new namespace;
|
|
6073
|
+
// JSON tuples preserve punctuation in labels without path collisions.
|
|
6074
|
+
const scopedKey = (tablePath, label) => JSON.stringify([...tablePath, label]);
|
|
6075
|
+
const existingByScope = new Map();
|
|
6072
6076
|
existingFields.forEach(function (field) {
|
|
6073
|
-
const
|
|
6077
|
+
const key = scopedKey(field.tablePath, field.label);
|
|
6078
|
+
const bucket = existingByScope.get(key) || [];
|
|
6074
6079
|
bucket.push(field);
|
|
6075
|
-
|
|
6080
|
+
existingByScope.set(key, bucket);
|
|
6076
6081
|
});
|
|
6077
6082
|
|
|
6078
6083
|
const desiredLabels = new Set();
|
|
6079
6084
|
const missing = [];
|
|
6080
6085
|
const existing = [];
|
|
6081
6086
|
const conflicts = [];
|
|
6082
|
-
desiredFields.forEach(function (field) {
|
|
6087
|
+
desiredFields.forEach(function ({ field, tablePath }) {
|
|
6083
6088
|
const identity = desiredResumeFieldIdentity(field);
|
|
6084
|
-
|
|
6089
|
+
const key = scopedKey(tablePath, identity.label);
|
|
6090
|
+
if (!identity.label || desiredLabels.has(key)) {
|
|
6085
6091
|
conflicts.push({
|
|
6086
6092
|
code: identity.label ? 'CREATE_FORM_RESUME_DUPLICATE_DESIRED_FIELD' : 'CREATE_FORM_RESUME_FIELD_LABEL_REQUIRED',
|
|
6087
6093
|
label: identity.label || null,
|
|
6094
|
+
tablePath,
|
|
6088
6095
|
});
|
|
6089
6096
|
return;
|
|
6090
6097
|
}
|
|
6091
|
-
desiredLabels.add(
|
|
6092
|
-
const matches =
|
|
6098
|
+
desiredLabels.add(key);
|
|
6099
|
+
const matches = existingByScope.get(key) || [];
|
|
6093
6100
|
if (matches.length === 0) {
|
|
6094
6101
|
missing.push(field);
|
|
6095
6102
|
return;
|
|
@@ -6098,6 +6105,7 @@ function buildResumeChanges(existingFields, desiredFields) {
|
|
|
6098
6105
|
conflicts.push({
|
|
6099
6106
|
code: 'CREATE_FORM_RESUME_FIELD_CONFLICT',
|
|
6100
6107
|
label: identity.label,
|
|
6108
|
+
tablePath,
|
|
6101
6109
|
requestedType: identity.componentName,
|
|
6102
6110
|
observedTypes: matches.map(function (item) { return item.componentName; }),
|
|
6103
6111
|
});
|
|
@@ -6107,6 +6115,7 @@ function buildResumeChanges(existingFields, desiredFields) {
|
|
|
6107
6115
|
label: identity.label,
|
|
6108
6116
|
componentName: identity.componentName,
|
|
6109
6117
|
fieldId: matches[0].fieldId,
|
|
6118
|
+
tablePath,
|
|
6110
6119
|
});
|
|
6111
6120
|
});
|
|
6112
6121
|
return { missing, existing, conflicts };
|
|
@@ -6258,7 +6267,7 @@ async function mainResume(parsedArgs, authRef) {
|
|
|
6258
6267
|
const corpId = resolveCorpId(authRef.authData);
|
|
6259
6268
|
const formTitle = firstRead.schemaResult.formTitle || firstRead.schemaResult.title || formUuid;
|
|
6260
6269
|
firstRead.schema = buildFormSchema(formTitle, fields, formUuid, corpId, appType, 'single', 'default', 'top');
|
|
6261
|
-
const resumeValidationRules = collectSmartValidationRulesFromFields(fields).concat(validations || []);
|
|
6270
|
+
const resumeValidationRules = collectSmartValidationRulesFromFields(fields, firstRead.schema).concat(validations || []);
|
|
6262
6271
|
if (resumeValidationRules.length > 0) {
|
|
6263
6272
|
applySmartValidations(firstRead.schema, resumeValidationRules);
|
|
6264
6273
|
}
|