openxiangda 1.0.265 → 2.0.0-alpha.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.
Files changed (537) hide show
  1. package/README.md +11 -675
  2. package/bin/run.js +11 -0
  3. package/dist/browser/AuthoritativeSelector.d.ts +37 -0
  4. package/dist/browser/AuthoritativeSelector.d.ts.map +1 -0
  5. package/dist/browser/AuthoritativeSelector.js +357 -0
  6. package/dist/browser/AuthoritativeSelector.js.map +1 -0
  7. package/dist/browser/FilePreviewPage.d.ts +2 -0
  8. package/dist/browser/FilePreviewPage.d.ts.map +1 -0
  9. package/dist/browser/FilePreviewPage.js +191 -0
  10. package/dist/browser/FilePreviewPage.js.map +1 -0
  11. package/dist/browser/Shell.d.ts +6 -0
  12. package/dist/browser/Shell.d.ts.map +1 -0
  13. package/dist/browser/Shell.js +198 -0
  14. package/dist/browser/Shell.js.map +1 -0
  15. package/dist/browser/appearance.d.ts +12 -0
  16. package/dist/browser/appearance.d.ts.map +1 -0
  17. package/dist/browser/appearance.js +100 -0
  18. package/dist/browser/appearance.js.map +1 -0
  19. package/dist/browser/application.d.ts +8 -0
  20. package/dist/browser/application.d.ts.map +1 -0
  21. package/dist/browser/application.js +42 -0
  22. package/dist/browser/application.js.map +1 -0
  23. package/dist/browser/components/platform-fields/AddressField.d.ts +12 -0
  24. package/dist/browser/components/platform-fields/AddressField.d.ts.map +1 -0
  25. package/dist/browser/components/platform-fields/AddressField.js +179 -0
  26. package/dist/browser/components/platform-fields/AddressField.js.map +1 -0
  27. package/dist/browser/components/platform-fields/AttachmentFileList.d.ts +9 -0
  28. package/dist/browser/components/platform-fields/AttachmentFileList.d.ts.map +1 -0
  29. package/dist/browser/components/platform-fields/AttachmentFileList.js +164 -0
  30. package/dist/browser/components/platform-fields/AttachmentFileList.js.map +1 -0
  31. package/dist/browser/components/platform-fields/CascadeField.d.ts +13 -0
  32. package/dist/browser/components/platform-fields/CascadeField.d.ts.map +1 -0
  33. package/dist/browser/components/platform-fields/CascadeField.js +14 -0
  34. package/dist/browser/components/platform-fields/CascadeField.js.map +1 -0
  35. package/dist/browser/components/platform-fields/DateTimeField.d.ts +16 -0
  36. package/dist/browser/components/platform-fields/DateTimeField.d.ts.map +1 -0
  37. package/dist/browser/components/platform-fields/DateTimeField.js +51 -0
  38. package/dist/browser/components/platform-fields/DateTimeField.js.map +1 -0
  39. package/dist/browser/components/platform-fields/JsonField.d.ts +11 -0
  40. package/dist/browser/components/platform-fields/JsonField.d.ts.map +1 -0
  41. package/dist/browser/components/platform-fields/JsonField.js +40 -0
  42. package/dist/browser/components/platform-fields/JsonField.js.map +1 -0
  43. package/dist/browser/components/platform-fields/LocationField.d.ts +11 -0
  44. package/dist/browser/components/platform-fields/LocationField.d.ts.map +1 -0
  45. package/dist/browser/components/platform-fields/LocationField.js +73 -0
  46. package/dist/browser/components/platform-fields/LocationField.js.map +1 -0
  47. package/dist/browser/components/platform-fields/PlatformDirectoryPicker.d.ts +12 -0
  48. package/dist/browser/components/platform-fields/PlatformDirectoryPicker.d.ts.map +1 -0
  49. package/dist/browser/components/platform-fields/PlatformDirectoryPicker.js +269 -0
  50. package/dist/browser/components/platform-fields/PlatformDirectoryPicker.js.map +1 -0
  51. package/dist/browser/components/platform-fields/ResourceReferenceField.d.ts +12 -0
  52. package/dist/browser/components/platform-fields/ResourceReferenceField.d.ts.map +1 -0
  53. package/dist/browser/components/platform-fields/ResourceReferenceField.js +22 -0
  54. package/dist/browser/components/platform-fields/ResourceReferenceField.js.map +1 -0
  55. package/dist/browser/components/platform-fields/RichTextField.d.ts +14 -0
  56. package/dist/browser/components/platform-fields/RichTextField.d.ts.map +1 -0
  57. package/dist/browser/components/platform-fields/RichTextField.js +214 -0
  58. package/dist/browser/components/platform-fields/RichTextField.js.map +1 -0
  59. package/dist/browser/components/platform-fields/SignatureField.d.ts +15 -0
  60. package/dist/browser/components/platform-fields/SignatureField.d.ts.map +1 -0
  61. package/dist/browser/components/platform-fields/SignatureField.js +179 -0
  62. package/dist/browser/components/platform-fields/SignatureField.js.map +1 -0
  63. package/dist/browser/components/platform-fields/SubtableField.d.ts +18 -0
  64. package/dist/browser/components/platform-fields/SubtableField.d.ts.map +1 -0
  65. package/dist/browser/components/platform-fields/SubtableField.js +236 -0
  66. package/dist/browser/components/platform-fields/SubtableField.js.map +1 -0
  67. package/dist/browser/components/platform-fields/address-value.d.ts +13 -0
  68. package/dist/browser/components/platform-fields/address-value.d.ts.map +1 -0
  69. package/dist/browser/components/platform-fields/address-value.js +70 -0
  70. package/dist/browser/components/platform-fields/address-value.js.map +1 -0
  71. package/dist/browser/components/platform-fields/cascade-value.d.ts +6 -0
  72. package/dist/browser/components/platform-fields/cascade-value.d.ts.map +1 -0
  73. package/dist/browser/components/platform-fields/cascade-value.js +47 -0
  74. package/dist/browser/components/platform-fields/cascade-value.js.map +1 -0
  75. package/dist/browser/components/platform-fields/directory-value.d.ts +7 -0
  76. package/dist/browser/components/platform-fields/directory-value.d.ts.map +1 -0
  77. package/dist/browser/components/platform-fields/directory-value.js +35 -0
  78. package/dist/browser/components/platform-fields/directory-value.js.map +1 -0
  79. package/dist/browser/components/platform-fields/field-form-codec.d.ts +10 -0
  80. package/dist/browser/components/platform-fields/field-form-codec.d.ts.map +1 -0
  81. package/dist/browser/components/platform-fields/field-form-codec.js +82 -0
  82. package/dist/browser/components/platform-fields/field-form-codec.js.map +1 -0
  83. package/dist/browser/components/platform-fields/location-value.d.ts +20 -0
  84. package/dist/browser/components/platform-fields/location-value.d.ts.map +1 -0
  85. package/dist/browser/components/platform-fields/location-value.js +57 -0
  86. package/dist/browser/components/platform-fields/location-value.js.map +1 -0
  87. package/dist/browser/components/platform-fields/resource-query.d.ts +14 -0
  88. package/dist/browser/components/platform-fields/resource-query.d.ts.map +1 -0
  89. package/dist/browser/components/platform-fields/resource-query.js +102 -0
  90. package/dist/browser/components/platform-fields/resource-query.js.map +1 -0
  91. package/dist/browser/components/platform-fields/rich-text-value.d.ts +12 -0
  92. package/dist/browser/components/platform-fields/rich-text-value.d.ts.map +1 -0
  93. package/dist/browser/components/platform-fields/rich-text-value.js +83 -0
  94. package/dist/browser/components/platform-fields/rich-text-value.js.map +1 -0
  95. package/dist/browser/components/platform-fields/subtable-value.d.ts +31 -0
  96. package/dist/browser/components/platform-fields/subtable-value.d.ts.map +1 -0
  97. package/dist/browser/components/platform-fields/subtable-value.js +120 -0
  98. package/dist/browser/components/platform-fields/subtable-value.js.map +1 -0
  99. package/dist/browser/components/resource/GeneratedResourceCrud.d.ts +8 -0
  100. package/dist/browser/components/resource/GeneratedResourceCrud.d.ts.map +1 -0
  101. package/dist/browser/components/resource/GeneratedResourceCrud.js +580 -0
  102. package/dist/browser/components/resource/GeneratedResourceCrud.js.map +1 -0
  103. package/dist/browser/components/resource/ResourceBatchActions.d.ts +25 -0
  104. package/dist/browser/components/resource/ResourceBatchActions.d.ts.map +1 -0
  105. package/dist/browser/components/resource/ResourceBatchActions.js +168 -0
  106. package/dist/browser/components/resource/ResourceBatchActions.js.map +1 -0
  107. package/dist/browser/components/resource/StandardResourcePages.d.ts +57 -0
  108. package/dist/browser/components/resource/StandardResourcePages.d.ts.map +1 -0
  109. package/dist/browser/components/resource/StandardResourcePages.js +89 -0
  110. package/dist/browser/components/resource/StandardResourcePages.js.map +1 -0
  111. package/dist/browser/components/resource/SurfaceFields.d.ts +88 -0
  112. package/dist/browser/components/resource/SurfaceFields.d.ts.map +1 -0
  113. package/dist/browser/components/resource/SurfaceFields.js +497 -0
  114. package/dist/browser/components/resource/SurfaceFields.js.map +1 -0
  115. package/dist/browser/components/resource/generated-resource-definition.d.ts +19 -0
  116. package/dist/browser/components/resource/generated-resource-definition.d.ts.map +1 -0
  117. package/dist/browser/components/resource/generated-resource-definition.js +2 -0
  118. package/dist/browser/components/resource/generated-resource-definition.js.map +1 -0
  119. package/dist/browser/components/resource/resource-import.d.ts +15 -0
  120. package/dist/browser/components/resource/resource-import.d.ts.map +1 -0
  121. package/dist/browser/components/resource/resource-import.js +197 -0
  122. package/dist/browser/components/resource/resource-import.js.map +1 -0
  123. package/dist/browser/data-provider.d.ts +4 -0
  124. package/dist/browser/data-provider.d.ts.map +1 -0
  125. package/dist/browser/data-provider.js +45 -0
  126. package/dist/browser/data-provider.js.map +1 -0
  127. package/dist/browser/platform-client.d.ts +81 -0
  128. package/dist/browser/platform-client.d.ts.map +1 -0
  129. package/dist/browser/platform-client.js +422 -0
  130. package/dist/browser/platform-client.js.map +1 -0
  131. package/dist/browser/resource-definitions.d.ts +8 -0
  132. package/dist/browser/resource-definitions.d.ts.map +1 -0
  133. package/dist/browser/resource-definitions.js +14 -0
  134. package/dist/browser/resource-definitions.js.map +1 -0
  135. package/dist/browser/runtime-meta.d.ts +22 -0
  136. package/dist/browser/runtime-meta.d.ts.map +1 -0
  137. package/dist/browser/runtime-meta.js +79 -0
  138. package/dist/browser/runtime-meta.js.map +1 -0
  139. package/dist/browser/runtime.d.ts +13 -0
  140. package/dist/browser/runtime.d.ts.map +1 -0
  141. package/dist/browser/runtime.js +47 -0
  142. package/dist/browser/runtime.js.map +1 -0
  143. package/dist/browser/styles.css +1941 -0
  144. package/dist/config.d.ts +2 -0
  145. package/dist/config.d.ts.map +1 -0
  146. package/dist/config.js +2 -0
  147. package/dist/config.js.map +1 -0
  148. package/dist/core.d.ts +6 -0
  149. package/dist/core.d.ts.map +1 -0
  150. package/dist/core.js +4 -0
  151. package/dist/core.js.map +1 -0
  152. package/dist/field-kit.d.ts +22 -0
  153. package/dist/field-kit.d.ts.map +1 -0
  154. package/dist/field-kit.js +22 -0
  155. package/dist/field-kit.js.map +1 -0
  156. package/dist/index.d.ts +2 -0
  157. package/dist/index.d.ts.map +1 -0
  158. package/dist/index.js +2 -0
  159. package/dist/index.js.map +1 -0
  160. package/dist/nest.d.ts +10 -0
  161. package/dist/nest.d.ts.map +1 -0
  162. package/dist/nest.js +9 -0
  163. package/dist/nest.js.map +1 -0
  164. package/dist/react.d.ts +12 -0
  165. package/dist/react.d.ts.map +1 -0
  166. package/dist/react.js +11 -0
  167. package/dist/react.js.map +1 -0
  168. package/dist/testing.d.ts +4 -0
  169. package/dist/testing.d.ts.map +1 -0
  170. package/dist/testing.js +4 -0
  171. package/dist/testing.js.map +1 -0
  172. package/package.json +95 -200
  173. package/skills/manifest.json +10 -0
  174. package/skills/openxiangda-v2/SKILL.md +55 -0
  175. package/skills/openxiangda-v2/references/architecture.md +7 -0
  176. package/skills/openxiangda-v2/references/backend.md +116 -0
  177. package/skills/openxiangda-v2/references/data-authz.md +93 -0
  178. package/skills/openxiangda-v2/references/delivery.md +11 -0
  179. package/skills/openxiangda-v2/references/discovery.md +15 -0
  180. package/skills/openxiangda-v2/references/frontend.md +10 -0
  181. package/skills/openxiangda-v2/references/testing.md +16 -0
  182. package/skills/openxiangda-v2/references/workflow-notification.md +69 -0
  183. package/skills/openxiangda-v2/references/workspace.md +21 -0
  184. package/bin/openxiangda.js +0 -26
  185. package/lib/app-function-invoke.js +0 -28
  186. package/lib/application-environments.js +0 -1134
  187. package/lib/change-baseline.js +0 -1359
  188. package/lib/cli.js +0 -31084
  189. package/lib/config.js +0 -450
  190. package/lib/content-cache.js +0 -97
  191. package/lib/delivery-v2-cli.js +0 -329
  192. package/lib/delivery-v2-executor.js +0 -1703
  193. package/lib/delivery-v2-package.js +0 -1176
  194. package/lib/dependency-capsule.js +0 -246
  195. package/lib/design-gates.js +0 -668
  196. package/lib/design-review.js +0 -220
  197. package/lib/developer-center.js +0 -160
  198. package/lib/form-field-contract.js +0 -79
  199. package/lib/form-schema-loader.js +0 -181
  200. package/lib/git-remote-identity.js +0 -89
  201. package/lib/http.js +0 -196
  202. package/lib/integration-bundle.js +0 -225
  203. package/lib/js-code-build.js +0 -175
  204. package/lib/open-api.js +0 -256
  205. package/lib/policy.js +0 -137
  206. package/lib/publish-context.js +0 -98
  207. package/lib/publish-lease-heartbeat.js +0 -182
  208. package/lib/publish-lease.js +0 -221
  209. package/lib/release-error-classification.js +0 -41
  210. package/lib/release-explain.js +0 -75
  211. package/lib/release-mainline.js +0 -654
  212. package/lib/release-plan.js +0 -550
  213. package/lib/release-telemetry.js +0 -182
  214. package/lib/resource-binding-contract.js +0 -210
  215. package/lib/role-resolution.js +0 -57
  216. package/lib/runtime-lineage.js +0 -326
  217. package/lib/sdd.js +0 -3306
  218. package/lib/skills.js +0 -453
  219. package/lib/source-dependencies.js +0 -921
  220. package/lib/task-status.js +0 -330
  221. package/lib/utils.js +0 -178
  222. package/lib/workspace-bootstrap.js +0 -268
  223. package/lib/workspace-init.js +0 -202
  224. package/lib/worktree-cleanup.js +0 -631
  225. package/lib/worktree-owner.js +0 -354
  226. package/openxiangda-skills/SKILL.md +0 -229
  227. package/openxiangda-skills/references/architecture-design.md +0 -409
  228. package/openxiangda-skills/references/architecture-patterns.md +0 -264
  229. package/openxiangda-skills/references/automation-v3.md +0 -349
  230. package/openxiangda-skills/references/best-practices.md +0 -272
  231. package/openxiangda-skills/references/component-guide.md +0 -287
  232. package/openxiangda-skills/references/connector-resources.md +0 -80
  233. package/openxiangda-skills/references/data-views.md +0 -360
  234. package/openxiangda-skills/references/forms/component-registry.md +0 -90
  235. package/openxiangda-skills/references/forms/form-schema.md +0 -146
  236. package/openxiangda-skills/references/forms/layout-and-rules.md +0 -24
  237. package/openxiangda-skills/references/notifications.md +0 -227
  238. package/openxiangda-skills/references/openxiangda-api.md +0 -971
  239. package/openxiangda-skills/references/pages/app-shell.md +0 -66
  240. package/openxiangda-skills/references/pages/page-sdk.md +0 -401
  241. package/openxiangda-skills/references/pages/publish-flow.md +0 -84
  242. package/openxiangda-skills/references/pages/workspace-structure.md +0 -41
  243. package/openxiangda-skills/references/permission-design-patterns.md +0 -313
  244. package/openxiangda-skills/references/permissions-settings.md +0 -468
  245. package/openxiangda-skills/references/platform-data-model.md +0 -340
  246. package/openxiangda-skills/references/resource-manifest-cheatsheet.md +0 -936
  247. package/openxiangda-skills/references/school-contact-relations.md +0 -242
  248. package/openxiangda-skills/references/style-system.md +0 -218
  249. package/openxiangda-skills/references/troubleshooting.md +0 -271
  250. package/openxiangda-skills/references/workflow-v3.md +0 -441
  251. package/openxiangda-skills/references/workspace-state.md +0 -115
  252. package/openxiangda-skills/skills/openxiangda-app/SKILL.md +0 -118
  253. package/openxiangda-skills/skills/openxiangda-architecture-design/SKILL.md +0 -137
  254. package/openxiangda-skills/skills/openxiangda-core/SKILL.md +0 -222
  255. package/openxiangda-skills/skills/openxiangda-form/SKILL.md +0 -184
  256. package/openxiangda-skills/skills/openxiangda-inspect/SKILL.md +0 -63
  257. package/openxiangda-skills/skills/openxiangda-open-api/SKILL.md +0 -57
  258. package/openxiangda-skills/skills/openxiangda-open-api/agents/openai.yaml +0 -4
  259. package/openxiangda-skills/skills/openxiangda-open-api/references/backend-authentication.md +0 -63
  260. package/openxiangda-skills/skills/openxiangda-open-api/references/dingtalk-api.openapi.json +0 -15653
  261. package/openxiangda-skills/skills/openxiangda-page/SKILL.md +0 -154
  262. package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +0 -209
  263. package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +0 -201
  264. package/packages/sdk/bin/lowcode-workspace.mjs +0 -4
  265. package/packages/sdk/dist/ProcessPreview-DSUIJi5V.d.mts +0 -1292
  266. package/packages/sdk/dist/ProcessPreview-DSUIJi5V.d.ts +0 -1292
  267. package/packages/sdk/dist/build/index.cjs +0 -1
  268. package/packages/sdk/dist/build/index.d.mts +0 -60
  269. package/packages/sdk/dist/build/index.d.ts +0 -60
  270. package/packages/sdk/dist/build/index.mjs +0 -1
  271. package/packages/sdk/dist/components/index.cjs +0 -148
  272. package/packages/sdk/dist/components/index.d.mts +0 -970
  273. package/packages/sdk/dist/components/index.d.ts +0 -970
  274. package/packages/sdk/dist/components/index.mjs +0 -148
  275. package/packages/sdk/dist/dataManagementApi-Ro9itwm8.d.ts +0 -142
  276. package/packages/sdk/dist/dataManagementApi-p_HOhQnA.d.mts +0 -142
  277. package/packages/sdk/dist/runtime/index.cjs +0 -148
  278. package/packages/sdk/dist/runtime/index.d.mts +0 -171
  279. package/packages/sdk/dist/runtime/index.d.ts +0 -171
  280. package/packages/sdk/dist/runtime/index.mjs +0 -148
  281. package/packages/sdk/dist/runtime/react.cjs +0 -148
  282. package/packages/sdk/dist/runtime/react.d.mts +0 -3209
  283. package/packages/sdk/dist/runtime/react.d.ts +0 -3209
  284. package/packages/sdk/dist/runtime/react.mjs +0 -148
  285. package/packages/sdk/dist/styles/antd-theme.cjs +0 -1
  286. package/packages/sdk/dist/styles/antd-theme.d.mts +0 -6
  287. package/packages/sdk/dist/styles/antd-theme.d.ts +0 -6
  288. package/packages/sdk/dist/styles/antd-theme.mjs +0 -1
  289. package/packages/sdk/dist/styles/tailwind-preset.cjs +0 -1
  290. package/packages/sdk/dist/styles/tailwind-preset.d.mts +0 -74
  291. package/packages/sdk/dist/styles/tailwind-preset.d.ts +0 -74
  292. package/packages/sdk/dist/styles/tailwind-preset.mjs +0 -1
  293. package/packages/sdk/dist/styles/tokens.css +0 -74
  294. package/packages/sdk/dist/workflow/index.cjs +0 -3
  295. package/packages/sdk/dist/workflow/index.d.mts +0 -291
  296. package/packages/sdk/dist/workflow/index.d.ts +0 -291
  297. package/packages/sdk/dist/workflow/index.mjs +0 -3
  298. package/packages/sdk/source/admin-list/AdminList.tsx +0 -1734
  299. package/packages/sdk/source/admin-list/README.md +0 -12
  300. package/packages/sdk/source/admin-list/dataSources.ts +0 -345
  301. package/packages/sdk/source/admin-list/index.ts +0 -42
  302. package/packages/sdk/source/admin-list/preferences.ts +0 -174
  303. package/packages/sdk/source/admin-list/types.ts +0 -273
  304. package/packages/sdk/src/build-source/README.md +0 -9
  305. package/packages/sdk/src/build-source/bin/lowcode-workspace.mjs +0 -7
  306. package/packages/sdk/src/build-source/package.json +0 -34
  307. package/packages/sdk/src/build-source/scripts/build-forms.mjs +0 -1129
  308. package/packages/sdk/src/build-source/scripts/build-pages.mjs +0 -897
  309. package/packages/sdk/src/build-source/scripts/build-workspace.mjs +0 -89
  310. package/packages/sdk/src/build-source/scripts/publish-all.mjs +0 -190
  311. package/packages/sdk/src/build-source/scripts/publish-oss.mjs +0 -144
  312. package/packages/sdk/src/build-source/scripts/register-bundle.mjs +0 -1
  313. package/packages/sdk/src/build-source/scripts/register.mjs +0 -362
  314. package/packages/sdk/src/build-source/scripts/sync-schema.mjs +0 -381
  315. package/packages/sdk/src/build-source/scripts/utils/form-api.mjs +0 -1058
  316. package/packages/sdk/src/build-source/scripts/utils/form-runtime-assets.mjs +0 -57
  317. package/packages/sdk/src/build-source/scripts/utils/incremental.mjs +0 -348
  318. package/packages/sdk/src/build-source/scripts/utils/load-config.mjs +0 -331
  319. package/packages/sdk/src/build-source/scripts/utils/mime-types.mjs +0 -70
  320. package/packages/sdk/src/build-source/scripts/utils/namespace-css.mjs +0 -77
  321. package/packages/sdk/src/build-source/scripts/utils/oss-client.mjs +0 -128
  322. package/packages/sdk/src/build-source/scripts/utils/pages.mjs +0 -150
  323. package/packages/sdk/src/build-source/scripts/utils/progress.mjs +0 -57
  324. package/packages/sdk/src/build-source/scripts/utils/publish-oss-patterns.mjs +0 -20
  325. package/packages/sdk/src/build-source/scripts/utils/register-payload.mjs +0 -90
  326. package/packages/sdk/src/build-source/scripts/utils/runtime-css-check.mjs +0 -44
  327. package/packages/sdk/src/build-source/scripts/utils/schema-transform.mjs +0 -142
  328. package/packages/sdk/src/build-source/scripts/utils/static-assets.mjs +0 -165
  329. package/packages/sdk/src/build-source/scripts/utils/tailwind-config.mjs +0 -283
  330. package/packages/sdk/src/build-source/scripts/utils/tailwind-token-warnings.mjs +0 -146
  331. package/packages/sdk/src/build-source/scripts/utils/workspace-style-entry.mjs +0 -29
  332. package/packages/sdk/src/build-source/src/cli.mjs +0 -735
  333. package/policy/openxiangda-policy.json +0 -72
  334. package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-form.mdc +0 -24
  335. package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-page.mdc +0 -25
  336. package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-resources.mdc +0 -32
  337. package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-workflow-automation.mdc +0 -26
  338. package/templates/openxiangda-react-spa/.cursor/rules/openxiangda.mdc +0 -68
  339. package/templates/openxiangda-react-spa/.env.example +0 -4
  340. package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-form.md +0 -37
  341. package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-page.md +0 -29
  342. package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-resources.md +0 -32
  343. package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-workflow-automation.md +0 -34
  344. package/templates/openxiangda-react-spa/.qoder/rules/openxiangda.md +0 -66
  345. package/templates/openxiangda-react-spa/AGENTS.md +0 -197
  346. package/templates/openxiangda-react-spa/DELIVERY.md +0 -43
  347. package/templates/openxiangda-react-spa/app-workspace.config.ts +0 -50
  348. package/templates/openxiangda-react-spa/index.html +0 -12
  349. package/templates/openxiangda-react-spa/package.json +0 -53
  350. package/templates/openxiangda-react-spa/postcss.config.cjs +0 -6
  351. package/templates/openxiangda-react-spa/scripts/build-js-code.mjs +0 -600
  352. package/templates/openxiangda-react-spa/scripts/deploy.mjs +0 -18
  353. package/templates/openxiangda-react-spa/scripts/guard-publish.mjs +0 -21
  354. package/templates/openxiangda-react-spa/src/app/navigation.ts +0 -73
  355. package/templates/openxiangda-react-spa/src/app/router.tsx +0 -146
  356. package/templates/openxiangda-react-spa/src/app/starter-content.ts +0 -144
  357. package/templates/openxiangda-react-spa/src/forms/.gitkeep +0 -1
  358. package/templates/openxiangda-react-spa/src/layouts/AdminShell.tsx +0 -570
  359. package/templates/openxiangda-react-spa/src/main.tsx +0 -21
  360. package/templates/openxiangda-react-spa/src/pages/admin/AdminDashboardPage.tsx +0 -170
  361. package/templates/openxiangda-react-spa/src/pages/admin/LoginLogPage.tsx +0 -425
  362. package/templates/openxiangda-react-spa/src/pages/defaults/DataRoutePage.tsx +0 -36
  363. package/templates/openxiangda-react-spa/src/pages/defaults/FilePreviewRoutePage.tsx +0 -65
  364. package/templates/openxiangda-react-spa/src/pages/defaults/FormRoutePage.tsx +0 -235
  365. package/templates/openxiangda-react-spa/src/pages/public/PublicRegisterPage.tsx +0 -15
  366. package/templates/openxiangda-react-spa/src/pages/states/NotFoundPage.tsx +0 -31
  367. package/templates/openxiangda-react-spa/src/resources/menus/menus.json +0 -22
  368. package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/app-admin.json +0 -8
  369. package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/public-visitor.json +0 -8
  370. package/templates/openxiangda-react-spa/src/resources/public-access/public-register.json +0 -14
  371. package/templates/openxiangda-react-spa/src/resources/roles/roles.json +0 -15
  372. package/templates/openxiangda-react-spa/src/resources/routes/public-register.json +0 -8
  373. package/templates/openxiangda-react-spa/src/runtime/default-page-overrides.tsx +0 -35
  374. package/templates/openxiangda-react-spa/src/runtime/default-routes.ts +0 -16
  375. package/templates/openxiangda-react-spa/src/shared/form-schema.ts +0 -135
  376. package/templates/openxiangda-react-spa/src/shared/mac-admin.tsx +0 -651
  377. package/templates/openxiangda-react-spa/src/shared/ui.tsx +0 -22
  378. package/templates/openxiangda-react-spa/src/styles/index.css +0 -105
  379. package/templates/openxiangda-react-spa/tailwind.config.cjs +0 -37
  380. package/templates/openxiangda-react-spa/tsconfig.app.json +0 -36
  381. package/templates/openxiangda-react-spa/tsconfig.js-code-nodes.json +0 -19
  382. package/templates/openxiangda-react-spa/tsconfig.json +0 -7
  383. package/templates/openxiangda-react-spa/tsconfig.node.json +0 -10
  384. package/templates/openxiangda-react-spa/vite.config.ts +0 -209
  385. package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-form.mdc +0 -24
  386. package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-page.mdc +0 -21
  387. package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-resources.mdc +0 -40
  388. package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-workflow-automation.mdc +0 -21
  389. package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda.mdc +0 -81
  390. package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-form.md +0 -38
  391. package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-page.md +0 -39
  392. package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-resources.md +0 -59
  393. package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-workflow-automation.md +0 -46
  394. package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda.md +0 -82
  395. package/templates/sy-lowcode-app-workspace/AGENTS.md +0 -159
  396. package/templates/sy-lowcode-app-workspace/DELIVERY.md +0 -43
  397. package/templates/sy-lowcode-app-workspace/app-workspace.config.ts +0 -51
  398. package/templates/sy-lowcode-app-workspace/examples/best-practices/README.md +0 -43
  399. package/templates/sy-lowcode-app-workspace/examples/best-practices/access-governance.md +0 -239
  400. package/templates/sy-lowcode-app-workspace/examples/best-practices/catalog.json +0 -99
  401. package/templates/sy-lowcode-app-workspace/examples/best-practices/decision-guide.md +0 -94
  402. package/templates/sy-lowcode-app-workspace/examples/best-practices/design-style.md +0 -91
  403. package/templates/sy-lowcode-app-workspace/examples/best-practices/module-structure.md +0 -48
  404. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/index.ts +0 -2
  405. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/permissions.test.ts +0 -52
  406. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/permissions.ts +0 -37
  407. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/types.ts +0 -19
  408. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/index.ts +0 -4
  409. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/permissions.test.ts +0 -42
  410. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/permissions.ts +0 -25
  411. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/state-machine.test.ts +0 -63
  412. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/state-machine.ts +0 -73
  413. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/ticket-query.test.ts +0 -34
  414. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/ticket-query.ts +0 -73
  415. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/types.ts +0 -66
  416. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/app-role/page.tsx +0 -1
  417. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/app-role/schema.ts +0 -109
  418. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/customer-profile/page.tsx +0 -1
  419. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/customer-profile/schema.ts +0 -92
  420. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/service-ticket/page.tsx +0 -1
  421. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/service-ticket/schema.ts +0 -153
  422. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/ticket-action-log/page.tsx +0 -1
  423. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/ticket-action-log/schema.ts +0 -65
  424. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/js-code-nodes/daily_ticket_digest/index.ts +0 -44
  425. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/js-code-nodes/sync_roles_to_platform/index.ts +0 -33
  426. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/App.tsx +0 -8
  427. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/GlassHomeDashboard.tsx +0 -232
  428. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/index.tsx +0 -10
  429. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/page.config.ts +0 -14
  430. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/styles.css +0 -196
  431. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/App.tsx +0 -7
  432. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/WorkbenchPage.tsx +0 -36
  433. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/components/ConfigPanel.tsx +0 -34
  434. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/components/PreviewPanel.tsx +0 -17
  435. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/index.tsx +0 -10
  436. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/page.config.ts +0 -9
  437. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/reducer.ts +0 -29
  438. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/styles.css +0 -24
  439. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/App.tsx +0 -8
  440. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/MintAnalyticsDashboard.tsx +0 -279
  441. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/index.tsx +0 -10
  442. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/page.config.ts +0 -14
  443. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/styles.css +0 -163
  444. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/App.tsx +0 -7
  445. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/MobilePortalShell.tsx +0 -31
  446. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/index.tsx +0 -10
  447. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/modules/MobileHome.tsx +0 -13
  448. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/page.config.ts +0 -14
  449. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/routes.ts +0 -13
  450. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/styles.css +0 -11
  451. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/App.tsx +0 -8
  452. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/OpsMonitorDashboard.tsx +0 -306
  453. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/index.tsx +0 -10
  454. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/page.config.ts +0 -14
  455. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/styles.css +0 -248
  456. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/App.tsx +0 -7
  457. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/PcPortalShell.tsx +0 -35
  458. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/components/PortalMetric.tsx +0 -11
  459. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/index.tsx +0 -10
  460. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/modules/HomeModule.tsx +0 -25
  461. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/modules/TicketsModule.tsx +0 -14
  462. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/page.config.ts +0 -14
  463. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/routes.ts +0 -19
  464. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/styles.css +0 -35
  465. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/App.tsx +0 -7
  466. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/TicketOpsPage.tsx +0 -105
  467. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketActionTimeline.tsx +0 -22
  468. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketDetailDrawer.tsx +0 -44
  469. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketTableActions.tsx +0 -57
  470. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/index.tsx +0 -10
  471. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/page.config.ts +0 -9
  472. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/styles.css +0 -35
  473. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/App.tsx +0 -8
  474. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/WorkOrderListDrawerPage.tsx +0 -371
  475. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/index.tsx +0 -10
  476. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/page.config.ts +0 -14
  477. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/styles.css +0 -182
  478. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/automations/daily-ticket-digest/automation.json +0 -25
  479. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/automations/daily-ticket-digest/trigger.json +0 -9
  480. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/notifications/daily-ticket-digest.json +0 -24
  481. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/permissions/form-groups/service-ticket-college.json +0 -21
  482. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/permissions/roles.json +0 -17
  483. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/workflows/expense-approval-workflow.json +0 -48
  484. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/ConfirmAction.tsx +0 -22
  485. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/QueryState.tsx +0 -37
  486. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/StatusTag.tsx +0 -20
  487. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/DashboardPrimitives.tsx +0 -832
  488. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/chartOptions.ts +0 -140
  489. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/sampleData.ts +0 -466
  490. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/styles.css +0 -874
  491. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/types.ts +0 -150
  492. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/hooks/useTicketOps.ts +0 -96
  493. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/services/role-governance.ts +0 -48
  494. package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/services/service-ticket.ts +0 -113
  495. package/templates/sy-lowcode-app-workspace/examples/forms/customer/page.tsx +0 -1
  496. package/templates/sy-lowcode-app-workspace/examples/forms/customer/schema.ts +0 -36
  497. package/templates/sy-lowcode-app-workspace/index.html +0 -12
  498. package/templates/sy-lowcode-app-workspace/package.json +0 -58
  499. package/templates/sy-lowcode-app-workspace/postcss.config.cjs +0 -9
  500. package/templates/sy-lowcode-app-workspace/scripts/build-js-code.mjs +0 -600
  501. package/templates/sy-lowcode-app-workspace/scripts/guard-publish.mjs +0 -29
  502. package/templates/sy-lowcode-app-workspace/src/dev/App.tsx +0 -820
  503. package/templates/sy-lowcode-app-workspace/src/forms/.gitkeep +0 -1
  504. package/templates/sy-lowcode-app-workspace/src/forms/README.md +0 -52
  505. package/templates/sy-lowcode-app-workspace/src/index.css +0 -26
  506. package/templates/sy-lowcode-app-workspace/src/js-code-nodes/.gitkeep +0 -1
  507. package/templates/sy-lowcode-app-workspace/src/js-code-nodes/types.d.ts +0 -3
  508. package/templates/sy-lowcode-app-workspace/src/main.tsx +0 -29
  509. package/templates/sy-lowcode-app-workspace/src/pages/.gitkeep +0 -1
  510. package/templates/sy-lowcode-app-workspace/src/runtime/builtin-overrides.tsx +0 -8
  511. package/templates/sy-lowcode-app-workspace/src/shared/form-schema.ts +0 -135
  512. package/templates/sy-lowcode-app-workspace/src/types/app-workspace.types.ts +0 -88
  513. package/templates/sy-lowcode-app-workspace/tailwind.config.cjs +0 -31
  514. package/templates/sy-lowcode-app-workspace/tsconfig.app.json +0 -40
  515. package/templates/sy-lowcode-app-workspace/tsconfig.examples.json +0 -24
  516. package/templates/sy-lowcode-app-workspace/tsconfig.js-code-nodes.json +0 -19
  517. package/templates/sy-lowcode-app-workspace/tsconfig.json +0 -7
  518. package/templates/sy-lowcode-app-workspace/tsconfig.node.json +0 -10
  519. package/templates/sy-lowcode-app-workspace/vite.config.ts +0 -85
  520. package/v2/README.md +0 -35
  521. package/v2/skills/manifest.json +0 -45
  522. package/v2/skills/openxiangda-v1-maintenance/SKILL.md +0 -21
  523. package/v2/skills/openxiangda-v1-maintenance/agents/openai.yaml +0 -4
  524. package/v2/skills/openxiangda-v2/SKILL.md +0 -38
  525. package/v2/skills/openxiangda-v2-architecture/SKILL.md +0 -29
  526. package/v2/skills/openxiangda-v2-architecture/agents/openai.yaml +0 -4
  527. package/v2/skills/openxiangda-v2-backend/SKILL.md +0 -28
  528. package/v2/skills/openxiangda-v2-backend/agents/openai.yaml +0 -4
  529. package/v2/skills/openxiangda-v2-data-authz/SKILL.md +0 -28
  530. package/v2/skills/openxiangda-v2-data-authz/agents/openai.yaml +0 -4
  531. package/v2/skills/openxiangda-v2-delivery/SKILL.md +0 -30
  532. package/v2/skills/openxiangda-v2-delivery/agents/openai.yaml +0 -4
  533. package/v2/skills/openxiangda-v2-frontend/SKILL.md +0 -21
  534. package/v2/skills/openxiangda-v2-frontend/agents/openai.yaml +0 -4
  535. package/v2/skills/openxiangda-v2-workflow-events/SKILL.md +0 -28
  536. package/v2/skills/openxiangda-v2-workflow-events/agents/openai.yaml +0 -4
  537. /package/{v2/skills → skills}/openxiangda-v2/agents/openai.yaml +0 -0
@@ -1,921 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const ts = require('typescript');
4
-
5
- const SOURCE_EXTENSIONS = new Set([
6
- '.ts',
7
- '.tsx',
8
- '.mts',
9
- '.cts',
10
- '.js',
11
- '.jsx',
12
- '.mjs',
13
- '.cjs',
14
- ]);
15
-
16
- const LOCAL_MODULE_EXTENSIONS = [
17
- '',
18
- '.ts',
19
- '.tsx',
20
- '.mts',
21
- '.cts',
22
- '.js',
23
- '.jsx',
24
- '.mjs',
25
- '.cjs',
26
- '.json',
27
- ];
28
-
29
- const RESOURCE_BUCKETS = [
30
- 'forms',
31
- 'dataViews',
32
- 'connectors',
33
- 'notifications',
34
- 'functions',
35
- 'storageConfigs',
36
- ];
37
-
38
- const RESOURCE_BUCKET_ALIASES = new Map([
39
- ['forms', 'forms'],
40
- ['form', 'forms'],
41
- ['dataviews', 'dataViews'],
42
- ['data-views', 'dataViews'],
43
- ['dataview', 'dataViews'],
44
- ['connectors', 'connectors'],
45
- ['connector', 'connectors'],
46
- ['notifications', 'notifications'],
47
- ['notification', 'notifications'],
48
- ['notificationtypes', 'notifications'],
49
- ['notification-types', 'notifications'],
50
- ['functions', 'functions'],
51
- ['function', 'functions'],
52
- ['storageconfigs', 'storageConfigs'],
53
- ['storage-configs', 'storageConfigs'],
54
- ['storage', 'storageConfigs'],
55
- ]);
56
-
57
- const TARGET_MANIFEST_KEYS = [
58
- ['functions', 'functions'],
59
- ['automations', 'automations'],
60
- ['workflows', 'workflows'],
61
- ['jsCodeNodes', 'jsCodeNodes'],
62
- ];
63
-
64
- function normalizeWorkspacePath(value) {
65
- return String(value || '')
66
- .split(path.sep)
67
- .join('/')
68
- .replace(/^\.\//, '');
69
- }
70
-
71
- function isPathInside(root, target) {
72
- const relative = path.relative(root, target);
73
- return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
74
- }
75
-
76
- function workspaceRelativePath(workspaceRoot, filePath) {
77
- return normalizeWorkspacePath(path.relative(workspaceRoot, filePath));
78
- }
79
-
80
- function getScriptKind(filePath) {
81
- switch (path.extname(filePath).toLowerCase()) {
82
- case '.tsx':
83
- return ts.ScriptKind.TSX;
84
- case '.jsx':
85
- return ts.ScriptKind.JSX;
86
- case '.js':
87
- case '.mjs':
88
- case '.cjs':
89
- return ts.ScriptKind.JS;
90
- default:
91
- return ts.ScriptKind.TS;
92
- }
93
- }
94
-
95
- function loadCompilerOptions(workspaceRoot) {
96
- const configPath = ts.findConfigFile(workspaceRoot, ts.sys.fileExists, 'tsconfig.json');
97
- if (!configPath) {
98
- return {
99
- allowJs: true,
100
- moduleResolution: ts.ModuleResolutionKind.Node10,
101
- resolveJsonModule: true,
102
- };
103
- }
104
- const config = ts.readConfigFile(configPath, ts.sys.readFile);
105
- if (config.error) return { allowJs: true, resolveJsonModule: true };
106
- const parsed = ts.parseJsonConfigFileContent(config.config, ts.sys, path.dirname(configPath));
107
- return {
108
- ...parsed.options,
109
- allowJs: true,
110
- resolveJsonModule: true,
111
- };
112
- }
113
-
114
- function resolveFileCandidate(basePath) {
115
- for (const extension of LOCAL_MODULE_EXTENSIONS) {
116
- const candidate = `${basePath}${extension}`;
117
- if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return path.resolve(candidate);
118
- }
119
- for (const extension of LOCAL_MODULE_EXTENSIONS.slice(1)) {
120
- const candidate = path.join(basePath, `index${extension}`);
121
- if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return path.resolve(candidate);
122
- }
123
- return null;
124
- }
125
-
126
- function resolveLocalModule(workspaceRoot, containingFile, specifier, compilerOptions) {
127
- const value = String(specifier || '').trim();
128
- if (!value) return null;
129
- const localLooking = value.startsWith('.') || value.startsWith('@/') || value.startsWith('~/');
130
- const resolved = ts.resolveModuleName(value, containingFile, compilerOptions, ts.sys).resolvedModule;
131
- if (resolved?.resolvedFileName) {
132
- const filePath = path.resolve(resolved.resolvedFileName);
133
- if (isPathInside(workspaceRoot, filePath) && !filePath.includes(`${path.sep}node_modules${path.sep}`)) {
134
- return filePath;
135
- }
136
- }
137
- if (!localLooking) return null;
138
- const fallbackBase = value.startsWith('@/') || value.startsWith('~/')
139
- ? path.join(workspaceRoot, 'src', value.slice(2))
140
- : path.resolve(path.dirname(containingFile), value);
141
- return resolveFileCandidate(fallbackBase);
142
- }
143
-
144
- function unwrapExpression(expression) {
145
- let current = expression;
146
- while (
147
- current &&
148
- (ts.isParenthesizedExpression(current) ||
149
- ts.isAsExpression(current) ||
150
- ts.isTypeAssertionExpression(current) ||
151
- ts.isNonNullExpression(current) ||
152
- ts.isSatisfiesExpression?.(current))
153
- ) {
154
- current = current.expression;
155
- }
156
- return current;
157
- }
158
-
159
- function propertyNameText(name) {
160
- if (!name) return '';
161
- if (ts.isIdentifier(name) || ts.isPrivateIdentifier(name)) return name.text;
162
- if (ts.isStringLiteralLike(name) || ts.isNumericLiteral(name)) return String(name.text);
163
- return '';
164
- }
165
-
166
- function collectConstInitializers(sourceFile) {
167
- const bindings = new Map();
168
- const visit = node => {
169
- if (
170
- ts.isVariableStatement(node) &&
171
- (node.declarationList.flags & ts.NodeFlags.Const) !== 0
172
- ) {
173
- for (const declaration of node.declarationList.declarations) {
174
- if (ts.isIdentifier(declaration.name) && declaration.initializer) {
175
- bindings.set(declaration.name.text, declaration.initializer);
176
- }
177
- }
178
- }
179
- ts.forEachChild(node, visit);
180
- };
181
- visit(sourceFile);
182
- return bindings;
183
- }
184
-
185
- function readStaticString(expression, bindings, seen = new Set()) {
186
- const value = unwrapExpression(expression);
187
- if (!value) return null;
188
- if (ts.isStringLiteralLike(value) || ts.isNoSubstitutionTemplateLiteral(value)) {
189
- return value.text;
190
- }
191
- if (ts.isIdentifier(value)) {
192
- if (seen.has(value.text)) return null;
193
- const initializer = bindings.get(value.text);
194
- if (!initializer) return null;
195
- const nextSeen = new Set(seen);
196
- nextSeen.add(value.text);
197
- return readStaticString(initializer, bindings, nextSeen);
198
- }
199
- if (ts.isPropertyAccessExpression(value) || ts.isElementAccessExpression(value)) {
200
- const owner = unwrapExpression(value.expression);
201
- const property = ts.isPropertyAccessExpression(value)
202
- ? value.name.text
203
- : readStaticString(value.argumentExpression, bindings, seen);
204
- if (!property) return null;
205
- const ownerValue = ts.isIdentifier(owner) && bindings.has(owner.text)
206
- ? unwrapExpression(bindings.get(owner.text))
207
- : owner;
208
- if (!ownerValue || !ts.isObjectLiteralExpression(ownerValue)) return null;
209
- const entry = ownerValue.properties.find(item =>
210
- (ts.isPropertyAssignment(item) || ts.isShorthandPropertyAssignment(item)) &&
211
- propertyNameText(item.name) === property
212
- );
213
- if (!entry) return null;
214
- if (ts.isPropertyAssignment(entry)) return readStaticString(entry.initializer, bindings, seen);
215
- return readStaticString(bindings.get(entry.name.text), bindings, seen);
216
- }
217
- return null;
218
- }
219
-
220
- function getPropertyPath(expression, bindings) {
221
- const value = unwrapExpression(expression);
222
- if (!value) return null;
223
- if (ts.isIdentifier(value)) return [value.text];
224
- if (ts.isPropertyAccessExpression(value)) {
225
- const parent = getPropertyPath(value.expression, bindings);
226
- return parent ? [...parent, value.name.text] : null;
227
- }
228
- if (ts.isElementAccessExpression(value)) {
229
- const parent = getPropertyPath(value.expression, bindings);
230
- const key = readStaticString(value.argumentExpression, bindings);
231
- return parent && key ? [...parent, key] : null;
232
- }
233
- return null;
234
- }
235
-
236
- function readStaticObjectProperty(expression, propertyNames, bindings) {
237
- const value = unwrapExpression(expression);
238
- if (!value || !ts.isObjectLiteralExpression(value)) return null;
239
- for (const property of value.properties) {
240
- if (!ts.isPropertyAssignment(property)) continue;
241
- if (!propertyNames.includes(propertyNameText(property.name))) continue;
242
- const result = readStaticString(property.initializer, bindings);
243
- if (result) return result;
244
- }
245
- return null;
246
- }
247
-
248
- function resolveStaticExpression(expression, bindings, seen = new Set()) {
249
- const value = unwrapExpression(expression);
250
- if (!value || !ts.isIdentifier(value)) return value;
251
- if (seen.has(value.text)) return value;
252
- const initializer = bindings.get(value.text);
253
- if (!initializer) return value;
254
- const nextSeen = new Set(seen);
255
- nextSeen.add(value.text);
256
- return resolveStaticExpression(initializer, bindings, nextSeen);
257
- }
258
-
259
- function readStaticObjectPropertyExpression(
260
- expression,
261
- propertyNames,
262
- bindings
263
- ) {
264
- const value = resolveStaticExpression(expression, bindings);
265
- if (!value || !ts.isObjectLiteralExpression(value)) return null;
266
- for (const property of value.properties) {
267
- if (!ts.isPropertyAssignment(property)) continue;
268
- if (!propertyNames.includes(propertyNameText(property.name))) continue;
269
- return property.initializer;
270
- }
271
- return null;
272
- }
273
-
274
- function collectStaticQueryFieldNodes(
275
- expression,
276
- bindings,
277
- result,
278
- fieldPropertyNames,
279
- seen = new Set()
280
- ) {
281
- const value = resolveStaticExpression(expression, bindings, seen);
282
- if (!value || seen.has(value)) return;
283
- seen.add(value);
284
- if (ts.isArrayLiteralExpression(value)) {
285
- for (const element of value.elements) {
286
- collectStaticQueryFieldNodes(
287
- element,
288
- bindings,
289
- result,
290
- fieldPropertyNames,
291
- seen
292
- );
293
- }
294
- return;
295
- }
296
- if (!ts.isObjectLiteralExpression(value)) return;
297
- for (const property of value.properties) {
298
- if (ts.isSpreadAssignment(property)) {
299
- collectStaticQueryFieldNodes(
300
- property.expression,
301
- bindings,
302
- result,
303
- fieldPropertyNames,
304
- seen
305
- );
306
- continue;
307
- }
308
- if (!ts.isPropertyAssignment(property)) continue;
309
- const name = propertyNameText(property.name);
310
- if (fieldPropertyNames.has(name)) {
311
- const field = readStaticString(property.initializer, bindings);
312
- if (field) result.push({ field, node: property.initializer });
313
- }
314
- collectStaticQueryFieldNodes(
315
- property.initializer,
316
- bindings,
317
- result,
318
- fieldPropertyNames,
319
- seen
320
- );
321
- }
322
- }
323
-
324
- function addFormFieldReferences(
325
- formFieldReferences,
326
- sourceFile,
327
- workspaceRoot,
328
- bindings,
329
- formCode,
330
- inputExpression,
331
- api
332
- ) {
333
- if (!formCode || !inputExpression) return;
334
- const fields = [];
335
- for (const propertyName of ['filters', 'order']) {
336
- const expression = readStaticObjectPropertyExpression(
337
- inputExpression,
338
- [propertyName],
339
- bindings
340
- );
341
- if (expression) {
342
- collectStaticQueryFieldNodes(
343
- expression,
344
- bindings,
345
- fields,
346
- new Set(
347
- propertyName === 'order'
348
- ? ['id', 'key', 'field', 'fieldId']
349
- : ['key', 'field', 'fieldId']
350
- )
351
- );
352
- }
353
- }
354
- for (const item of fields) {
355
- formFieldReferences.push({
356
- formCode,
357
- field: item.field,
358
- api,
359
- ...sourceLocation(sourceFile, item.node, workspaceRoot),
360
- });
361
- }
362
- }
363
-
364
- function sourceLocation(sourceFile, node, workspaceRoot) {
365
- const start = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
366
- return {
367
- file: workspaceRelativePath(workspaceRoot, sourceFile.fileName),
368
- line: start.line + 1,
369
- column: start.character + 1,
370
- };
371
- }
372
-
373
- function addReference(references, sourceFile, node, workspaceRoot, bucket, code, api) {
374
- const normalizedCode = String(code || '').trim();
375
- if (!normalizedCode) return;
376
- references.push({
377
- bucket,
378
- code: normalizedCode,
379
- api,
380
- ...sourceLocation(sourceFile, node, workspaceRoot),
381
- });
382
- }
383
-
384
- function addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, expected) {
385
- warnings.push({
386
- code: 'dynamic-resource-reference',
387
- api,
388
- message: `${api} 使用动态资源 code,无法静态核对 manifest;请确认 resources.${expected} 已完整声明`,
389
- ...sourceLocation(sourceFile, node, workspaceRoot),
390
- });
391
- }
392
-
393
- function inspectResourceCall(
394
- node,
395
- sourceFile,
396
- workspaceRoot,
397
- bindings,
398
- references,
399
- formFieldReferences,
400
- warnings
401
- ) {
402
- if (!ts.isCallExpression(node)) return;
403
- const callee = getPropertyPath(node.expression, bindings);
404
- if (!callee) return;
405
- if (
406
- callee.length === 1 &&
407
- callee[0] === 'queryAdvancedFormPage'
408
- ) {
409
- const formCode = readStaticString(node.arguments[1], bindings);
410
- if (formCode) {
411
- addReference(
412
- references,
413
- sourceFile,
414
- node,
415
- workspaceRoot,
416
- 'forms',
417
- formCode,
418
- 'queryAdvancedFormPage'
419
- );
420
- addFormFieldReferences(
421
- formFieldReferences,
422
- sourceFile,
423
- workspaceRoot,
424
- bindings,
425
- formCode,
426
- node.arguments[2],
427
- 'queryAdvancedFormPage'
428
- );
429
- }
430
- return;
431
- }
432
- if (callee[0] !== 'ctx' || callee.length < 3) return;
433
- const namespace = callee[1];
434
- const method = callee[2];
435
- const api = callee.join('.');
436
- const firstArgument = node.arguments[0];
437
-
438
- if (namespace === 'resources' && method.startsWith('resolve')) {
439
- const bucket = {
440
- resolveForm: 'forms',
441
- resolveDataView: 'dataViews',
442
- resolveConnector: 'connectors',
443
- resolveNotification: 'notifications',
444
- resolveNotificationType: 'notifications',
445
- resolveTemplate: 'notifications',
446
- resolveFunction: 'functions',
447
- resolveStorage: 'storageConfigs',
448
- }[method];
449
- if (!bucket) return;
450
- const code = readStaticString(firstArgument, bindings);
451
- if (code) addReference(references, sourceFile, node, workspaceRoot, bucket, code, api);
452
- else addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, bucket);
453
- return;
454
- }
455
-
456
- if (namespace === 'form') {
457
- const code = readStaticObjectProperty(firstArgument, ['formCode', 'code'], bindings) ||
458
- readStaticString(firstArgument, bindings);
459
- if (code) {
460
- addReference(references, sourceFile, node, workspaceRoot, 'forms', code, api);
461
- addFormFieldReferences(
462
- formFieldReferences,
463
- sourceFile,
464
- workspaceRoot,
465
- bindings,
466
- code,
467
- ts.isObjectLiteralExpression(
468
- resolveStaticExpression(firstArgument, bindings)
469
- )
470
- ? firstArgument
471
- : node.arguments[1],
472
- api
473
- );
474
- }
475
- else if (firstArgument) addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, 'forms');
476
- return;
477
- }
478
-
479
- if (namespace === 'dataView' && ['query', 'stats'].includes(method)) {
480
- const code = readStaticString(firstArgument, bindings) ||
481
- readStaticObjectProperty(firstArgument, ['dataViewCode', 'code'], bindings);
482
- if (code) addReference(references, sourceFile, node, workspaceRoot, 'dataViews', code, api);
483
- else if (firstArgument) addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, 'dataViews');
484
- return;
485
- }
486
-
487
- if (namespace === 'connector' && ['invoke', 'call'].includes(method)) {
488
- let code = readStaticObjectProperty(firstArgument, ['connector', 'connectorCode', 'code'], bindings);
489
- if (!code && method === 'call') {
490
- const callName = readStaticString(firstArgument, bindings);
491
- code = callName ? callName.split('.')[0] : null;
492
- }
493
- if (code) addReference(references, sourceFile, node, workspaceRoot, 'connectors', code, api);
494
- else if (firstArgument) addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, 'connectors');
495
- return;
496
- }
497
-
498
- if (
499
- namespace === 'notification' &&
500
- [
501
- 'sendByType',
502
- 'batchSendByType',
503
- 'findConfig',
504
- 'previewTemplate',
505
- 'previewDingTalk',
506
- 'sendDingTalk',
507
- 'updateDingTalkCard',
508
- ].includes(method)
509
- ) {
510
- const code = readStaticString(firstArgument, bindings) ||
511
- readStaticObjectProperty(firstArgument, ['notificationType', 'templateCode', 'code'], bindings);
512
- if (code) addReference(references, sourceFile, node, workspaceRoot, 'notifications', code, api);
513
- else if (firstArgument) addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, 'notifications');
514
- }
515
- }
516
-
517
- function collectModuleSpecifiers(sourceFile) {
518
- const result = [];
519
- const visit = node => {
520
- if (
521
- (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&
522
- node.moduleSpecifier &&
523
- ts.isStringLiteralLike(node.moduleSpecifier)
524
- ) {
525
- result.push({ value: node.moduleSpecifier.text, node: node.moduleSpecifier });
526
- } else if (
527
- ts.isImportEqualsDeclaration(node) &&
528
- ts.isExternalModuleReference(node.moduleReference) &&
529
- node.moduleReference.expression &&
530
- ts.isStringLiteralLike(node.moduleReference.expression)
531
- ) {
532
- result.push({ value: node.moduleReference.expression.text, node: node.moduleReference.expression });
533
- } else if (
534
- ts.isCallExpression(node) &&
535
- node.arguments.length > 0 &&
536
- (node.expression.kind === ts.SyntaxKind.ImportKeyword ||
537
- (ts.isIdentifier(node.expression) && node.expression.text === 'require')) &&
538
- ts.isStringLiteralLike(node.arguments[0])
539
- ) {
540
- result.push({ value: node.arguments[0].text, node: node.arguments[0] });
541
- }
542
- ts.forEachChild(node, visit);
543
- };
544
- visit(sourceFile);
545
- return result;
546
- }
547
-
548
- function dedupeDetails(values, keys) {
549
- const seen = new Set();
550
- return values.filter(value => {
551
- const key = keys.map(name => value[name] || '').join('\0');
552
- if (seen.has(key)) return false;
553
- seen.add(key);
554
- return true;
555
- });
556
- }
557
-
558
- function analyzeTypeScriptEntry(options = {}) {
559
- const workspaceRoot = path.resolve(options.workspaceRoot || process.cwd());
560
- const entryFile = path.resolve(workspaceRoot, options.entryFile || '');
561
- const compilerOptions = options.compilerOptions || loadCompilerOptions(workspaceRoot);
562
- const queue = [entryFile];
563
- const visited = new Set();
564
- const sourceDependencies = new Set();
565
- const references = [];
566
- const formFieldReferences = [];
567
- const warnings = [];
568
-
569
- while (queue.length > 0) {
570
- const current = path.resolve(queue.shift());
571
- if (visited.has(current)) continue;
572
- visited.add(current);
573
- if (!fs.existsSync(current) || !fs.statSync(current).isFile()) {
574
- warnings.push({
575
- code: 'missing-source-file',
576
- file: workspaceRelativePath(workspaceRoot, current),
577
- line: 1,
578
- column: 1,
579
- message: `本地 sourceFile 不存在: ${workspaceRelativePath(workspaceRoot, current)}`,
580
- });
581
- continue;
582
- }
583
- if (!isPathInside(workspaceRoot, current)) continue;
584
- sourceDependencies.add(workspaceRelativePath(workspaceRoot, current));
585
- if (!SOURCE_EXTENSIONS.has(path.extname(current).toLowerCase())) continue;
586
-
587
- const content = fs.readFileSync(current, 'utf8');
588
- const sourceFile = ts.createSourceFile(
589
- current,
590
- content,
591
- ts.ScriptTarget.Latest,
592
- true,
593
- getScriptKind(current)
594
- );
595
- for (const diagnostic of sourceFile.parseDiagnostics || []) {
596
- const position = diagnostic.start === undefined
597
- ? { line: 0, character: 0 }
598
- : sourceFile.getLineAndCharacterOfPosition(diagnostic.start);
599
- warnings.push({
600
- code: 'source-parse-diagnostic',
601
- file: workspaceRelativePath(workspaceRoot, current),
602
- line: position.line + 1,
603
- column: position.character + 1,
604
- message: ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
605
- });
606
- }
607
-
608
- const bindings = collectConstInitializers(sourceFile);
609
- const inspect = node => {
610
- inspectResourceCall(
611
- node,
612
- sourceFile,
613
- workspaceRoot,
614
- bindings,
615
- references,
616
- formFieldReferences,
617
- warnings
618
- );
619
- ts.forEachChild(node, inspect);
620
- };
621
- inspect(sourceFile);
622
-
623
- for (const imported of collectModuleSpecifiers(sourceFile)) {
624
- const localLooking = imported.value.startsWith('.') || imported.value.startsWith('@/') || imported.value.startsWith('~/');
625
- const resolved = resolveLocalModule(workspaceRoot, current, imported.value, compilerOptions);
626
- if (resolved) {
627
- queue.push(resolved);
628
- } else if (localLooking) {
629
- warnings.push({
630
- code: 'unresolved-local-import',
631
- specifier: imported.value,
632
- message: `无法解析本地 import: ${imported.value}`,
633
- ...sourceLocation(sourceFile, imported.node, workspaceRoot),
634
- });
635
- }
636
- }
637
- }
638
-
639
- const resourceReferenceDetails = dedupeDetails(
640
- references,
641
- ['bucket', 'code', 'file', 'line', 'column', 'api']
642
- ).sort((left, right) =>
643
- `${left.bucket}\0${left.code}\0${left.file}\0${left.line}`.localeCompare(
644
- `${right.bucket}\0${right.code}\0${right.file}\0${right.line}`
645
- )
646
- );
647
- const resourceReferences = Object.fromEntries(
648
- RESOURCE_BUCKETS.map(bucket => [
649
- bucket,
650
- Array.from(
651
- new Set(
652
- resourceReferenceDetails
653
- .filter(reference => reference.bucket === bucket)
654
- .map(reference => reference.code)
655
- )
656
- ).sort(),
657
- ])
658
- );
659
-
660
- return {
661
- entryFile: workspaceRelativePath(workspaceRoot, entryFile),
662
- sourceDependencies: Array.from(sourceDependencies).sort(),
663
- resourceReferences,
664
- resourceReferenceDetails,
665
- formFieldReferences: dedupeDetails(
666
- formFieldReferences,
667
- ['formCode', 'field', 'file', 'line', 'column', 'api']
668
- ),
669
- warnings: dedupeDetails(warnings, ['code', 'file', 'line', 'column', 'api', 'message']),
670
- };
671
- }
672
-
673
- function readJsonFile(filePath) {
674
- try {
675
- return JSON.parse(fs.readFileSync(filePath, 'utf8'));
676
- } catch {
677
- return null;
678
- }
679
- }
680
-
681
- function resolveManifestLocalPath(workspaceRoot, baseDir, localPath) {
682
- const fromBase = path.resolve(baseDir || workspaceRoot, localPath);
683
- if (fs.existsSync(fromBase)) return fromBase;
684
- return path.resolve(workspaceRoot, localPath);
685
- }
686
-
687
- function collectManifestStructures(workspaceRoot, item) {
688
- const sourceEntries = new Set();
689
- const resourceContainers = [];
690
- const visited = new Set();
691
- const externalFiles = new Set();
692
-
693
- const visit = (value, baseDir) => {
694
- if (!value || typeof value !== 'object' || visited.has(value)) return;
695
- visited.add(value);
696
- if (Array.isArray(value)) {
697
- for (const child of value) visit(child, baseDir);
698
- return;
699
- }
700
- if (value.sourceFile?.localPath) {
701
- sourceEntries.add(
702
- resolveManifestLocalPath(workspaceRoot, baseDir, String(value.sourceFile.localPath))
703
- );
704
- }
705
- if (value.resources && typeof value.resources === 'object') {
706
- resourceContainers.push(value.resources);
707
- }
708
- if (value.resourceBindings && typeof value.resourceBindings === 'object') {
709
- resourceContainers.push(value.resourceBindings);
710
- }
711
- for (const [key, child] of Object.entries(value)) {
712
- if (key.startsWith('__')) continue;
713
- if (key === 'definitionFile' && typeof child === 'string' && child.trim()) {
714
- const definitionPath = path.resolve(baseDir || workspaceRoot, child);
715
- if (!externalFiles.has(definitionPath) && fs.existsSync(definitionPath)) {
716
- externalFiles.add(definitionPath);
717
- const external = readJsonFile(definitionPath);
718
- if (external) visit(external, path.dirname(definitionPath));
719
- }
720
- continue;
721
- }
722
- if (child && typeof child === 'object') visit(child, baseDir);
723
- }
724
- };
725
-
726
- visit(item, item.__dir || workspaceRoot);
727
- return {
728
- sourceEntries: Array.from(sourceEntries).sort(),
729
- resourceContainers,
730
- };
731
- }
732
-
733
- function normalizeDeclaredCodes(value) {
734
- if (value === undefined || value === null || value === false) return [];
735
- if (Array.isArray(value)) {
736
- return value.flatMap(normalizeDeclaredCodes);
737
- }
738
- if (typeof value === 'object') {
739
- return Object.keys(value).map(key => String(key).trim()).filter(Boolean);
740
- }
741
- return String(value)
742
- .split(',')
743
- .map(item => item.trim())
744
- .filter(Boolean);
745
- }
746
-
747
- function collectDeclaredResources(item, resourceContainers) {
748
- const result = Object.fromEntries(RESOURCE_BUCKETS.map(bucket => [bucket, new Set()]));
749
- for (const container of resourceContainers) {
750
- for (const [rawBucket, value] of Object.entries(container || {})) {
751
- const normalizedBucket = RESOURCE_BUCKET_ALIASES.get(
752
- String(rawBucket).replace(/[_\s]+/g, '-').toLowerCase()
753
- );
754
- if (!normalizedBucket) continue;
755
- for (const code of normalizeDeclaredCodes(value)) result[normalizedBucket].add(code);
756
- }
757
- }
758
- if (item.formCode) result.forms.add(String(item.formCode));
759
- return Object.fromEntries(
760
- RESOURCE_BUCKETS.map(bucket => [bucket, Array.from(result[bucket]).sort()])
761
- );
762
- }
763
-
764
- function getManifestItemCode(item) {
765
- return String(
766
- item?.code || item?.resourceCode || item?.functionCode || item?.scriptCode || item?.methodName || ''
767
- ).trim();
768
- }
769
-
770
- function mergeAnalyses(workspaceRoot, entries) {
771
- const analyses = entries.map(entryFile =>
772
- analyzeTypeScriptEntry({ workspaceRoot, entryFile })
773
- );
774
- const sourceDependencies = Array.from(
775
- new Set(analyses.flatMap(analysis => analysis.sourceDependencies))
776
- ).sort();
777
- const resourceReferenceDetails = dedupeDetails(
778
- analyses.flatMap(analysis => analysis.resourceReferenceDetails),
779
- ['bucket', 'code', 'file', 'line', 'column', 'api']
780
- );
781
- const resourceReferences = Object.fromEntries(
782
- RESOURCE_BUCKETS.map(bucket => [
783
- bucket,
784
- Array.from(
785
- new Set(
786
- resourceReferenceDetails
787
- .filter(reference => reference.bucket === bucket)
788
- .map(reference => reference.code)
789
- )
790
- ).sort(),
791
- ])
792
- );
793
- const formFieldReferences = dedupeDetails(
794
- analyses.flatMap(analysis => analysis.formFieldReferences || []),
795
- ['formCode', 'field', 'file', 'line', 'column', 'api']
796
- );
797
- return {
798
- entryFiles: entries.map(entry => workspaceRelativePath(workspaceRoot, entry)).sort(),
799
- sourceDependencies,
800
- resourceReferences,
801
- resourceReferenceDetails,
802
- formFieldReferences,
803
- warnings: dedupeDetails(
804
- analyses.flatMap(analysis => analysis.warnings),
805
- ['code', 'file', 'line', 'column', 'api', 'message']
806
- ),
807
- };
808
- }
809
-
810
- function analyzeManifestSourceDependencies(options = {}) {
811
- const workspaceRoot = path.resolve(options.workspaceRoot || process.cwd());
812
- const manifest = options.manifest || {};
813
- const targets = [];
814
- const byDependency = new Map();
815
-
816
- for (const [manifestKey, targetKey] of TARGET_MANIFEST_KEYS) {
817
- for (const item of manifest[manifestKey] || []) {
818
- const code = getManifestItemCode(item);
819
- if (!code) continue;
820
- const structures = collectManifestStructures(workspaceRoot, item);
821
- if (structures.sourceEntries.length === 0) continue;
822
- const analysis = {
823
- targetKey,
824
- code,
825
- declaredResources: collectDeclaredResources(item, structures.resourceContainers),
826
- ...mergeAnalyses(workspaceRoot, structures.sourceEntries),
827
- };
828
- Object.defineProperty(item, '__sourceAnalysis', {
829
- value: analysis,
830
- configurable: true,
831
- enumerable: false,
832
- writable: true,
833
- });
834
- targets.push(analysis);
835
- for (const dependency of analysis.sourceDependencies) {
836
- if (!byDependency.has(dependency)) byDependency.set(dependency, []);
837
- byDependency.get(dependency).push({ targetKey, code });
838
- }
839
- }
840
- }
841
-
842
- return { workspaceRoot, targets, byDependency };
843
- }
844
-
845
- function validateManifestSourceBindings(options = {}) {
846
- const index = analyzeManifestSourceDependencies(options);
847
- const errors = [];
848
- const warnings = [];
849
-
850
- for (const target of index.targets) {
851
- const label = `${target.targetKey.replace(/s$/, '')} ${target.code}`;
852
- const undeclared = [];
853
- for (const reference of target.resourceReferenceDetails) {
854
- const declared = target.declaredResources[reference.bucket] || [];
855
- if (declared.includes(reference.code)) continue;
856
- if (reference.bucket === 'forms' && /^FORM[_-]/i.test(reference.code)) continue;
857
- undeclared.push(reference);
858
- }
859
- if (undeclared.length > 0) {
860
- const codes = Array.from(
861
- new Set(undeclared.map(reference => `${reference.bucket}.${reference.code}`))
862
- ).sort();
863
- const visible = codes.slice(0, 12);
864
- warnings.push(
865
- `${label}: 源码引用了未在逐资源清单声明的应用内资源: ${visible.join(', ')}` +
866
- `${codes.length > visible.length ? ` 等 ${codes.length} 项` : ''}。` +
867
- '平台运行时将按当前租户和应用自动解析;resources 仅用于显式映射、审计和影响分析'
868
- );
869
- }
870
- for (const warning of target.warnings) {
871
- if (
872
- warning.code === 'dynamic-resource-reference' &&
873
- !target.entryFiles.includes(warning.file)
874
- ) {
875
- continue;
876
- }
877
- warnings.push(
878
- `${label}: ${warning.file}:${warning.line} ${warning.message}`
879
- );
880
- }
881
- }
882
-
883
- return {
884
- index,
885
- errors: Array.from(new Set(errors)),
886
- warnings: Array.from(new Set(warnings)),
887
- sourceDependencies: index.targets.map(target => ({
888
- kind: target.targetKey,
889
- code: target.code,
890
- entryFiles: target.entryFiles,
891
- sourceDependencies: target.sourceDependencies,
892
- resourceReferences: target.resourceReferences,
893
- formFieldReferences: target.formFieldReferences,
894
- })),
895
- };
896
- }
897
-
898
- function getImpactedResourceTargets(index, changedFiles = []) {
899
- const result = {
900
- functions: new Set(),
901
- automations: new Set(),
902
- workflows: new Set(),
903
- jsCodeNodes: new Set(),
904
- };
905
- for (const rawFile of changedFiles) {
906
- const file = normalizeWorkspacePath(rawFile);
907
- for (const target of index?.byDependency?.get(file) || []) {
908
- if (result[target.targetKey]) result[target.targetKey].add(target.code);
909
- }
910
- }
911
- return Object.fromEntries(
912
- Object.entries(result).map(([key, values]) => [key, Array.from(values).sort()])
913
- );
914
- }
915
-
916
- module.exports = {
917
- analyzeManifestSourceDependencies,
918
- analyzeTypeScriptEntry,
919
- getImpactedResourceTargets,
920
- validateManifestSourceBindings,
921
- };