zero-ai 0.3.25

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 (276) hide show
  1. package/CNAME +1 -0
  2. package/README.md +54 -0
  3. package/SUMMARY.md +15 -0
  4. package/_config.yml +1 -0
  5. package/_layouts/default.html +60 -0
  6. package/_sass/jekyll-theme-dinky.scss +440 -0
  7. package/_sass/rouge-github.scss +209 -0
  8. package/assets/css/style.scss +4 -0
  9. package/assets/images/arrow-down.png +0 -0
  10. package/assets/images/octocat-small.png +0 -0
  11. package/assets/js/scale.fix.js +20 -0
  12. package/configs/sorts.json +38 -0
  13. package/document/doc-config/jsdoc.json +89 -0
  14. package/document/doc-config/third-part/esdoc.json +9 -0
  15. package/document/doc-config/third-part/yuidoc-example.json +23 -0
  16. package/document/doc-config/third-part/yuidoc.json +11 -0
  17. package/document/doc-config/tpl/publish.js +778 -0
  18. package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  19. package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  20. package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  21. package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  22. package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  23. package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  24. package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  25. package/document/doc-config/tpl/static/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  26. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  27. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  28. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  29. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  30. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  31. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  32. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  33. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  34. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  35. package/document/doc-config/tpl/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  36. package/document/doc-config/tpl/static/scripts/collapse.js +20 -0
  37. package/document/doc-config/tpl/static/scripts/linenumber.js +25 -0
  38. package/document/doc-config/tpl/static/scripts/nav.js +12 -0
  39. package/document/doc-config/tpl/static/scripts/polyfill.js +4 -0
  40. package/document/doc-config/tpl/static/scripts/prettify/Apache-License-2.0.txt +202 -0
  41. package/document/doc-config/tpl/static/scripts/prettify/lang-css.js +2 -0
  42. package/document/doc-config/tpl/static/scripts/prettify/prettify.js +28 -0
  43. package/document/doc-config/tpl/static/scripts/search.js +83 -0
  44. package/document/doc-config/tpl/static/styles/jsdoc.css +765 -0
  45. package/document/doc-config/tpl/static/styles/prettify.css +79 -0
  46. package/document/doc-config/tpl/static/styles/zero.css +50 -0
  47. package/document/doc-config/tpl/tmpl/augments.tmpl +10 -0
  48. package/document/doc-config/tpl/tmpl/container.tmpl +197 -0
  49. package/document/doc-config/tpl/tmpl/details.tmpl +148 -0
  50. package/document/doc-config/tpl/tmpl/example.tmpl +2 -0
  51. package/document/doc-config/tpl/tmpl/examples.tmpl +13 -0
  52. package/document/doc-config/tpl/tmpl/exceptions.tmpl +32 -0
  53. package/document/doc-config/tpl/tmpl/layout.tmpl +98 -0
  54. package/document/doc-config/tpl/tmpl/mainpage.tmpl +15 -0
  55. package/document/doc-config/tpl/tmpl/members.tmpl +38 -0
  56. package/document/doc-config/tpl/tmpl/method.tmpl +138 -0
  57. package/document/doc-config/tpl/tmpl/modifies.tmpl +14 -0
  58. package/document/doc-config/tpl/tmpl/params.tmpl +132 -0
  59. package/document/doc-config/tpl/tmpl/properties.tmpl +107 -0
  60. package/document/doc-config/tpl/tmpl/returns.tmpl +19 -0
  61. package/document/doc-config/tpl/tmpl/source.tmpl +8 -0
  62. package/document/doc-config/tpl/tmpl/tutorial.tmpl +19 -0
  63. package/document/doc-config/tpl/tmpl/type.tmpl +7 -0
  64. package/document/doc-config/tpl/zero.css +0 -0
  65. package/document/doc-web/E.html +395 -0
  66. package/document/doc-web/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  67. package/document/doc-web/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  68. package/document/doc-web/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  69. package/document/doc-web/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  70. package/document/doc-web/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  71. package/document/doc-web/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  72. package/document/doc-web/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  73. package/document/doc-web/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  74. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  75. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  76. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  77. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  78. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  79. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  80. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  81. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  82. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  83. package/document/doc-web/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  84. package/document/doc-web/index.html +262 -0
  85. package/document/doc-web/module-_debug.html +1104 -0
  86. package/document/doc-web/module-_epic.html +1631 -0
  87. package/document/doc-web/module-ai.html +1701 -0
  88. package/document/doc-web/module-aj.html +1081 -0
  89. package/document/doc-web/scripts/collapse.js +20 -0
  90. package/document/doc-web/scripts/linenumber.js +25 -0
  91. package/document/doc-web/scripts/nav.js +12 -0
  92. package/document/doc-web/scripts/polyfill.js +4 -0
  93. package/document/doc-web/scripts/prettify/Apache-License-2.0.txt +202 -0
  94. package/document/doc-web/scripts/prettify/lang-css.js +2 -0
  95. package/document/doc-web/scripts/prettify/prettify.js +28 -0
  96. package/document/doc-web/scripts/search.js +83 -0
  97. package/document/doc-web/styles/jsdoc.css +765 -0
  98. package/document/doc-web/styles/prettify.css +79 -0
  99. package/document/doc-web/styles/zero.css +50 -0
  100. package/document/markdown/README.md +0 -0
  101. package/document/markdown/gong-cheng-chu-shi-hua.md +79 -0
  102. package/document/markdown/t0002-uuidsheng-cheng-qi.md +142 -0
  103. package/document/markdown/t0003-shu-ju-mo-ni-qi.md +135 -0
  104. package/document/markdown/t0004-zerode-fu-wu-tong-xun-fen-xi-qi.md +64 -0
  105. package/document/markdown/t0005-liquibaseshu-ju-zhuan-huan-qi.md +68 -0
  106. package/document/markdown/zt0001-pagecardchuang-jian.md +71 -0
  107. package/document/markdown/zt0002-formchuang-jian.md +81 -0
  108. package/document/markdown/zt0003-tian-jia-card-an-niu.md +115 -0
  109. package/document/markdown/zt0004-chu-li-modal-zhe-zhao-xiao-guo.md +105 -0
  110. package/document/markdown/ztgong-ju.md +0 -0
  111. package/install-local.sh +3 -0
  112. package/package.json +53 -0
  113. package/run-authorize.sh +32 -0
  114. package/run-doc.sh +16 -0
  115. package/run-update.sh +6 -0
  116. package/script/bootstrap +6 -0
  117. package/script/cibuild +9 -0
  118. package/script/release +42 -0
  119. package/script/validate-html +28 -0
  120. package/script/zrun-doc-generate.sh +18 -0
  121. package/script/zrun-doc-server.sh +13 -0
  122. package/src/ai.js +11 -0
  123. package/src/aj.js +11 -0
  124. package/src/art.js +11 -0
  125. package/src/cab/form/UI.js.tpl +50 -0
  126. package/src/cab/form/UI.json.tpl +38 -0
  127. package/src/cab/list/Op.js.tpl +42 -0
  128. package/src/cab/list/UI.Add.json.tpl +32 -0
  129. package/src/cab/list/UI.Edit.json.tpl +34 -0
  130. package/src/cab/list/UI.Filter.json.tpl +29 -0
  131. package/src/cab/list/UI.Form.js.tpl +64 -0
  132. package/src/cab/list/UI.js.tpl +49 -0
  133. package/src/cab/list/UI.json.tpl +208 -0
  134. package/src/cab/perm/falcon.app.xlsx +0 -0
  135. package/src/cab/perm/falcon.authority.resource.perm.xlsx +0 -0
  136. package/src/cab/perm/falcon.authority.resource.resource.xlsx +0 -0
  137. package/src/cab/perm/falcon.authority.role.action.xlsx +0 -0
  138. package/src/cab/perm/falcon.authority.view.xlsx +0 -0
  139. package/src/cab/perm/falcon.battery.module.xlsx +0 -0
  140. package/src/cab/perm/falcon.epic.form.xlsx +0 -0
  141. package/src/cab/perm/falcon.epic.integration.xlsx +0 -0
  142. package/src/cab/perm/falcon.epic.modeling.entity.xlsx +0 -0
  143. package/src/cab/perm/falcon.epic.modeling.field.xlsx +0 -0
  144. package/src/cab/perm/falcon.epic.modeling.global.xlsx +0 -0
  145. package/src/cab/perm/falcon.epic.modeling.model.xlsx +0 -0
  146. package/src/cab/perm/falcon.epic.page.xlsx +0 -0
  147. package/src/cab/perm/falcon.epic.topology.xlsx +0 -0
  148. package/src/cab/perm/falcon.fm.bank.xlsx +0 -0
  149. package/src/cab/perm/falcon.fm.bill.process.xlsx +0 -0
  150. package/src/cab/perm/falcon.fm.book.xlsx +0 -0
  151. package/src/cab/perm/falcon.fm.currency.xlsx +0 -0
  152. package/src/cab/perm/falcon.fm.debt.xlsx +0 -0
  153. package/src/cab/perm/falcon.fm.settlement.xlsx +0 -0
  154. package/src/cab/perm/falcon.fm.subject.xlsx +0 -0
  155. package/src/cab/perm/falcon.fm.term.xlsx +0 -0
  156. package/src/cab/perm/falcon.i.directory.xlsx +0 -0
  157. package/src/cab/perm/falcon.i.integration.xlsx +0 -0
  158. package/src/cab/perm/falcon.lbs.city.xlsx +0 -0
  159. package/src/cab/perm/falcon.lbs.floor.xlsx +0 -0
  160. package/src/cab/perm/falcon.lbs.query.xlsx +0 -0
  161. package/src/cab/perm/falcon.lbs.state.xlsx +0 -0
  162. package/src/cab/perm/falcon.lbs.tent.xlsx +0 -0
  163. package/src/cab/perm/falcon.login.index.xlsx +0 -0
  164. package/src/cab/perm/falcon.my.menu.xlsx +0 -0
  165. package/src/cab/perm/falcon.organization.brand.xlsx +0 -0
  166. package/src/cab/perm/falcon.organization.company.xlsx +0 -0
  167. package/src/cab/perm/falcon.organization.contract.xlsx +0 -0
  168. package/src/cab/perm/falcon.organization.customer.xlsx +0 -0
  169. package/src/cab/perm/falcon.organization.dept.team.xlsx +0 -0
  170. package/src/cab/perm/falcon.organization.dept.xlsx +0 -0
  171. package/src/cab/perm/falcon.organization.employee.identity.xlsx +0 -0
  172. package/src/cab/perm/falcon.organization.employee.xlsx +0 -0
  173. package/src/cab/perm/falcon.organization.project.xlsx +0 -0
  174. package/src/cab/perm/falcon.psi.pos.xlsx +0 -0
  175. package/src/cab/perm/falcon.psi.wh.xlsx +0 -0
  176. package/src/cab/perm/falcon.rbac.group.xlsx +0 -0
  177. package/src/cab/perm/falcon.rbac.role.xlsx +0 -0
  178. package/src/cab/perm/falcon.rbac.user.xlsx +0 -0
  179. package/src/cab/perm/falcon.system.document.xlsx +0 -0
  180. package/src/cab/perm/falcon.system.job.xlsx +0 -0
  181. package/src/cab/perm/falcon.system.report.xlsx +0 -0
  182. package/src/cab/perm/falcon.system.sync_log.xlsx +0 -0
  183. package/src/cab/perm/falcon.system.todo.xlsx +0 -0
  184. package/src/cab/perm/falcon.system.workflow.xlsx +0 -0
  185. package/src/cab/perm/falcon.ui.app.xlsx +0 -0
  186. package/src/cab/perm/falcon.view.personal.xlsx +0 -0
  187. package/src/cab/perm/falcon.x.activity.xlsx +0 -0
  188. package/src/cab/perm/falcon.x.attachment.xlsx +0 -0
  189. package/src/cab/perm/falcon.x.category.xlsx +0 -0
  190. package/src/cab/perm/falcon.x.integration.xlsx +0 -0
  191. package/src/cab/perm/falcon.x.linkage.xlsx +0 -0
  192. package/src/cab/perm/falcon.x.menu.xlsx +0 -0
  193. package/src/cab/perm/falcon.x.notice.xlsx +0 -0
  194. package/src/cab/perm/falcon.x.tabular.xlsx +0 -0
  195. package/src/cab/perm/falcon.x.tag.xlsx +0 -0
  196. package/src/cab/plugin/Component.java.tpl +52 -0
  197. package/src/cab/plugin/Cv.java.tpl +21 -0
  198. package/src/cab/plugin/ErrorIo.java.tpl +26 -0
  199. package/src/cab/plugin/In.Abstract.java.tpl +30 -0
  200. package/src/cab/plugin/In.java.tpl +25 -0
  201. package/src/cab/plugin/Io.Abstract.java.tpl +36 -0
  202. package/src/cab/plugin/Io.Impl.java.tpl +21 -0
  203. package/src/cab/plugin/Io.java.tpl +73 -0
  204. package/src/cab/plugin/Plugin.After.java.tpl +22 -0
  205. package/src/cab/plugin/Plugin.Before.java.tpl +22 -0
  206. package/src/cab/plugin/Refine.Log.java.tpl +47 -0
  207. package/src/cab/plugin/Refine.Pin.java.tpl +70 -0
  208. package/src/cab/plugin/Refine.java.tpl +67 -0
  209. package/src/cab/plugin/configuration.json.tpl +3 -0
  210. package/src/cab/plugin/infix.xml.tpl +22 -0
  211. package/src/cab/plugin/integration.json.tpl +20 -0
  212. package/src/cab/resource/falcon.resource.xlsx +0 -0
  213. package/src/cab/resource/resource.json +8 -0
  214. package/src/cab/resource/resource.xlsx +0 -0
  215. package/src/commander/ai.zero +10 -0
  216. package/src/commander/aj.zero +8 -0
  217. package/src/commander/ar.zero +4 -0
  218. package/src/commander/option.zero +21 -0
  219. package/src/commander-ai/fn.csv.js +105 -0
  220. package/src/commander-ai/fn.data.js +404 -0
  221. package/src/commander-ai/fn.init.js +106 -0
  222. package/src/commander-ai/fn.key.js +81 -0
  223. package/src/commander-ai/fn.md5.js +76 -0
  224. package/src/commander-ai/fn.random.js +84 -0
  225. package/src/commander-ai/fn.uk.js +70 -0
  226. package/src/commander-ai/fn.uuid.js +80 -0
  227. package/src/commander-ai/index.js +19 -0
  228. package/src/commander-aj/bundle/specification.txt +49 -0
  229. package/src/commander-aj/fn.i.mod.js +26 -0
  230. package/src/commander-aj/fn.i.resource.js +33 -0
  231. package/src/commander-aj/fn.j.bundle.js +51 -0
  232. package/src/commander-aj/fn.j.init.js +72 -0
  233. package/src/commander-aj/fn.j.permission.js +60 -0
  234. package/src/commander-aj/fn.j.plugin.js +120 -0
  235. package/src/commander-aj/fn.j.row.js +5 -0
  236. package/src/commander-aj/index.js +16 -0
  237. package/src/commander-ar/fn.i.complex.js +112 -0
  238. package/src/commander-ar/fn.i.form.js +91 -0
  239. package/src/commander-ar/index.js +7 -0
  240. package/src/epic/ai.economy.impl.fn.excel.js +128 -0
  241. package/src/epic/ai.economy.impl.fn.execute.js +162 -0
  242. package/src/epic/ai.economy.impl.fn.java.js +140 -0
  243. package/src/epic/ai.economy.impl.fn.json.js +23 -0
  244. package/src/epic/ai.economy.impl.fn.plugin.js +160 -0
  245. package/src/epic/ai.economy.impl.fn.react.js +219 -0
  246. package/src/epic/ai.export.impl.fn.parse.js +345 -0
  247. package/src/epic/ai.export.impl.fn.seek.js +42 -0
  248. package/src/epic/ai.export.interface.fn.string.js +5 -0
  249. package/src/epic/ai.export.interface.io.js +69 -0
  250. package/src/epic/ai.export.interface.util.js +17 -0
  251. package/src/epic/ai.path.fn.dir.operation.js +87 -0
  252. package/src/epic/ai.path.fn.io.command.js +43 -0
  253. package/src/epic/ai.path.fn.io.specification.js +59 -0
  254. package/src/epic/ai.path.fn.io.typed.js +63 -0
  255. package/src/epic/ai.path.fn.out.content.js +47 -0
  256. package/src/epic/ai.string.fn.str.util.js +56 -0
  257. package/src/epic/ai.uncork.fn.element.feature.js +52 -0
  258. package/src/epic/ai.uncork.fn.it.feature.js +118 -0
  259. package/src/epic/ai.uncork.fn.to.typed.js +74 -0
  260. package/src/epic/ai.under.fn.cx.evaluate.js +81 -0
  261. package/src/epic/ai.under.fn.fx.terminal.js +143 -0
  262. package/src/epic/ai.unified.fn._.logging.js +45 -0
  263. package/src/epic/ai.unified.fn.fn.error.code.js +114 -0
  264. package/src/epic/ai.unified.fn.is.decision.js +20 -0
  265. package/src/epic/ai.unified.fn.sorter.element.js +26 -0
  266. package/src/epic/index.js +216 -0
  267. package/src/epic/zero.__.fn.find.util.js +37 -0
  268. package/src/epic/zero.__.v.constant.js +5 -0
  269. package/test/csv.json +12 -0
  270. package/test/csv.zero +2 -0
  271. package/test/data.zero +56 -0
  272. package/test/key/key1.json +15 -0
  273. package/test/key/key2.json +12 -0
  274. package/test/key/key3.json +5 -0
  275. package/test/key.json +12 -0
  276. package/test/uk.json +19 -0
@@ -0,0 +1,120 @@
1
+ const Ec = require('../epic');
2
+
3
+ module.exports = () => {
4
+ const actual = Ec.executeInput(
5
+ [
6
+ ["-m", "--module"]
7
+ ],
8
+ [
9
+ ["-m", "--module"],
10
+ ['-p', "--path"],
11
+ ['-c', '--config', 'workspace.json']
12
+ ]
13
+ );
14
+ Ec.cxExist(actual.config);
15
+ // 基本环境
16
+ const configuration = Ec.javaConfig({
17
+ filename: actual.config,
18
+ module: actual.module,
19
+ tpl:{
20
+ type: 'plugin'
21
+ }
22
+ },
23
+ "." === actual.path ? process.cwd(): actual.path,
24
+ Ec.Cfg.detectPlugin
25
+ );
26
+ if(configuration) Ec.pluginRun(configuration);
27
+ }
28
+
29
+ /**
30
+ * ## `aj jplugin`
31
+ *
32
+ * ### 1. 命令
33
+ *
34
+ * 使用该命令执行插件项目初始化,设置第三方集成项目模板专用。
35
+ *
36
+ * ### 2. 执行
37
+ *
38
+ * #### 2.1. 基本介绍
39
+ *
40
+ * ```shell
41
+ * # 2.1.1. 命令语法
42
+ * aj jplugin -m pbc
43
+ *
44
+ * # 2.1.2. 执行测试
45
+ * aj jplugin -m pbc
46
+ * # ...省略部分...
47
+ * [Zero AI] Zero AI 系统启动......
48
+ * [Zero AI] Zero AI 加载输入参数:
49
+ * {
50
+ * "module": "pbc",
51
+ * "config": "workspace.json"
52
+ * }
53
+ * [Zero AI] 「Java环境」,后端工作路径:<工作目录>。
54
+ * [Zero AI] Zero AI 0. 基础环境......
55
+ * [Zero AI] Zero AI 工作目录:<工作目录>
56
+ * [Zero AI] Zero AI 1. 执行Plugin命令......
57
+ * [Zero AI] Zero AI 1.1. 初始化源代码目录......
58
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn
59
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn/originx
60
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn/originx/pbc
61
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn/originx/pbc/component
62
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn/originx/pbc/cv
63
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn/originx/pbc/error
64
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn/originx/pbc/input
65
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn/originx/pbc/output
66
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn/originx/pbc/refine
67
+ * [Zero AI] 创建目录:<工作目录>/src/main/java/cn/originx/pbc/plugin
68
+ * [Zero AI] Zero AI 1.2. 初始化资源目录......
69
+ * [Zero AI] 创建目录:<工作目录>/src/main/resources/plugin
70
+ * [Zero AI] 创建目录:<工作目录>/src/main/resources/plugin/pbc
71
+ * [Zero AI] 创建目录:<工作目录>/src/main/resources/plugin/pbc/annal
72
+ * [Zero AI] Zero AI 2. 生成代码......
73
+ * [Zero AI] Zero AI 2.1. backlog日志配置......
74
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/resources/plugin/pbc/annal/infix.xml!
75
+ * [Zero AI] Zero AI 2.2.1. 「默认」集成配置......
76
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/resources/plugin/pbc/integration.json!
77
+ * [Zero AI] Zero AI 2.2.2. 「开发」集成配置......
78
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/resources/plugin/pbc/integration-dev.json!
79
+ * [Zero AI] Zero AI 2.2.3. 「生产」集成配置......
80
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/resources/plugin/pbc/integration-prod.json!
81
+ * [Zero AI] Zero AI 2.2.4. 基础配置......
82
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/resources/plugin/pbc/configuration.json!
83
+ * [Zero AI] Zero AI 2.3.1. 常量处理......
84
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/cv/PbCv.java!
85
+ * [Zero AI] Zero AI 2.3.2. Before/After 插件处理......
86
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/plugin/AbstractPbBefore.java!
87
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/plugin/AbstractPbAfter.java!
88
+ * [Zero AI] Zero AI 2.3.3. Refine 工具处理......
89
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/refine/PbLog.java!
90
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/refine/PbPin.java!
91
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/refine/Pb.java!
92
+ * [Zero AI] Zero AI 2.3.4. Error 异常类处理......
93
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/error/_501PbIoNullException.java!
94
+ * [Zero AI] Zero AI 2.3.5. Component 通道组件......
95
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/component/AbstractPbComponent.java!
96
+ * [Zero AI] Zero AI 2.3.6. In 组件处理......
97
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/input/PbIn.java!
98
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/input/AbstractPbIn.java!
99
+ * [Zero AI] Zero AI 2.3.7. Out 组件处理......
100
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/output/PbIo.java!
101
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/output/AbstractPbIo.java!
102
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/output/PbIoAdd.java!
103
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/output/PbIoUpdate.java!
104
+ * [Zero AI] (Sync)成功将数据写入到文件:<工作目录>/src/main/java/cn/originx/pbc/output/PbIoDelete.java!
105
+ * [Zero AI] Zero AI 3. 执行完成......
106
+ * ```
107
+ *
108
+ * ### 3. 选项
109
+ *
110
+ * #### 3.1. 基本说明
111
+ *
112
+ * |短参|全参|类型|默认|含义|
113
+ * |---|---|---|---|:---|
114
+ * |-p|--path|String|无|根据传入路径设置,如果是`.`则是当前目录,如果不传则从`workspace.json`中读取。|
115
+ * |-m|--module|String|无|模块名称,通常是`infix-xxx`中的`xxx`名称。|
116
+ * |-c|--config|String|`workspace.json`|配置文件路径。|
117
+ *
118
+ * @memberOf module:aj
119
+ * @method jplugin
120
+ **/
@@ -0,0 +1,5 @@
1
+
2
+
3
+ module.exports = () => {
4
+
5
+ }
@@ -0,0 +1,16 @@
1
+
2
+ const javaPermission = require('./fn.j.permission');
3
+ const javaResource = require('./fn.i.resource');
4
+ const javaPlugin = require('./fn.j.plugin');
5
+ const javaMod = require('./fn.i.mod');
6
+ const javaInit = require('./fn.j.init');
7
+ const javaBundle = require('./fn.j.bundle');
8
+ const exported = {
9
+ javaPermission,
10
+ javaResource,
11
+ javaPlugin,
12
+ javaMod,
13
+ javaInit, // aj jinit
14
+ javaBundle,
15
+ };
16
+ module.exports = exported;
@@ -0,0 +1,112 @@
1
+ const Ec = require('../epic');
2
+
3
+ module.exports = () => {
4
+ const actual = Ec.executeInput(
5
+ [],
6
+ [
7
+ ['-c', '--config', 'ui.json']
8
+ ]
9
+ );
10
+ // 基本环境监察,得到基础配置信息
11
+ const configuration = Ec.reactConfig({
12
+ filename: actual.config,
13
+ tpl: {
14
+ type: 'list',
15
+ },
16
+ resource: [
17
+ "UI.Add", // 添加表单资源文件
18
+ "UI.Edit", // 编程表单资源文件
19
+ "UI.Filter", // 过滤表单资源文件
20
+ "UI" // 主界面资源文件
21
+ ],
22
+ ui: [
23
+ "UI", // 主界面Js
24
+ "Op", // 主界面事件Js
25
+ "UI.Form", // 合并过后的Js(三个Form)
26
+ ]
27
+ });
28
+ if (configuration) Ec.reactRun(configuration);
29
+ }
30
+ /**
31
+ * ## `aj icomplex`
32
+ *
33
+ * ### 1. 命令
34
+ *
35
+ * 使用该命令生成完整的`ExListComplex`完整组件页。
36
+ *
37
+ * ### 2. 执行
38
+ *
39
+ * #### 2.1. 基本介绍
40
+ *
41
+ * ```shell
42
+ * # 2.1.1. 命令语法
43
+ * aj icomplex
44
+ *
45
+ * # 2.1.2. 执行测试
46
+ * aj icomplex
47
+ * # ...省略部分...
48
+ * [Zero AI] Zero AI 系统启动......
49
+ * [Zero AI] Zero AI 加载输入参数:
50
+ * {
51
+ * "config": "ui.json"
52
+ * }
53
+ * [Zero AI] 「启用ZT环境」,当前模块:generated/test,特殊命令只能在ZT环境使用。
54
+ * [Zero AI] Zero AI 0. 基础环境......
55
+ * [Zero AI] 环境变量:ZT = generated/test
56
+ * [Zero AI] 模块信息:generated/test
57
+ * [Zero AI] 语言信息:cn
58
+ * [Zero AI] 项目目录:<项目根目录>
59
+ * [Zero AI] Zero AI 1. 目录检查......
60
+ * [Zero AI] Zero AI 2. 文件表:
61
+ * [Zero AI] UI.Add = <项目根目录>/src/cab/cn/components/generated/test/UI.Add.json
62
+ * [Zero AI] UI.Edit = <项目根目录>/src/cab/cn/components/generated/test/UI.Edit.json
63
+ * [Zero AI] UI.Filter = <项目根目录>/src/cab/cn/components/generated/test/UI.Filter.json
64
+ * [Zero AI] UI = <项目根目录>/src/cab/cn/components/generated/test/UI.json
65
+ * [Zero AI] UI = <项目根目录>/src/components/generated/test/UI.js
66
+ * [Zero AI] Op = <项目根目录>/src/components/generated/test/Op.js
67
+ * [Zero AI] UI.Form = <项目根目录>/src/components/generated/test/UI.Form.js
68
+ * [Zero AI] Zero AI 3. 执行React命令......
69
+ * [Zero AI] Zero AI 3.1. 创建名空间文件......
70
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/components/generated/test/Cab.json!
71
+ * [Zero AI] Zero AI 3.2. 构造资源文件......
72
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/cab/cn/components/generated/test/UI.Add.json!
73
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/cab/cn/components/generated/test/UI.Edit.json!
74
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/cab/cn/components/generated/test/UI.Filter.json!
75
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/cab/cn/components/generated/test/UI.json!
76
+ * [Zero AI] Zero AI 3.3. 构造界面文件......
77
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/components/generated/test/UI.js!
78
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/components/generated/test/Op.js!
79
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/components/generated/test/UI.Form.js!
80
+ * [Zero AI] Zero AI 4. 命令执行完成!!!
81
+ * ```
82
+ *
83
+ * 代码执行完成后会在项目中生成Zero UI专用模块`generated/test`的所有页面以及组件。
84
+ *
85
+ * * 执行代码之前先执行`export ZT=generated/test`确保`ZT`环境变量有值。
86
+ * * 执行位置可以是当前项目中的任意一个路径,脚本会自己计算当前项目的根目录(Zero UI专用)。
87
+ * * 该命令执行时模板文件位置位于`src/cab/list`目录中,且模板文件以`tpl`结尾。
88
+ *
89
+ * #### 2.2. 生成的文件说明
90
+ *
91
+ * |文件名|模板|含义|
92
+ * |:---|:---|:---|
93
+ * |Cab.json|无|名空间关联文件,计算得来。|
94
+ * |UI.Add.json|UI.Add.json.tpl|「无字段」添加表单专用资源文件。|
95
+ * |UI.Edit.json|UI.Edit.json.tpl|「无字段」编辑表单专用资源文件。|
96
+ * |UI.Filter.json|UI.Filter.json.tpl|过滤表单专用资源文件(高级搜索用)。|
97
+ * |UI.json|UI.json.tpl|主界面资源文件。|
98
+ * |UI.js|UI.js.tpl|主界面脚本文件。|
99
+ * |Op.js|Op.js.tpl|Action/Callback专用Js事件脚本。|
100
+ * |UI.Form.js|UI.Form.js.tpl|三个表单合一的专用Js脚本。|
101
+ *
102
+ * ### 3. 选项
103
+ *
104
+ * #### 3.1. 基本说明
105
+ *
106
+ * |短参|全参|类型|默认|含义|
107
+ * |---|---|---|---|:---|
108
+ * |-c|--config|String|`ui.json`|配置文件路径。|
109
+ *
110
+ * @memberOf module:aj
111
+ * @method icomplex
112
+ */
@@ -0,0 +1,91 @@
1
+ const Ec = require('../epic');
2
+
3
+ module.exports = () => {
4
+ const actual = Ec.executeInput(
5
+ [
6
+ ['-u', '--ui']
7
+ ],
8
+ [
9
+ ['-c', '--config', 'ui.json'],
10
+ ['-u', '--ui']
11
+ ]
12
+ );
13
+ // 基本环境监察,得到基础配置信息
14
+ const configuration = Ec.reactConfig({
15
+ filename: actual.config,
16
+ tpl: {
17
+ type: 'form',
18
+ source: 'UI',
19
+ target: actual.ui,
20
+ }
21
+ });
22
+ if (configuration) Ec.reactRun(configuration);
23
+ }
24
+ /**
25
+ * ## `aj iform`
26
+ *
27
+ * ### 1. 命令
28
+ *
29
+ * 使用该命令生成完整的`ExForm`完整表单组件页。
30
+ *
31
+ * ### 2. 执行
32
+ *
33
+ * #### 2.1. 基本介绍
34
+ *
35
+ * ```shell
36
+ * # 2.1.1. 命令语法
37
+ * ai iform -u <ui>
38
+ *
39
+ * # 2.1.2. 执行测试
40
+ * aj iform -u UI.Basic
41
+ * # ...省略部分...
42
+ * [Zero AI] Zero AI 系统启动......
43
+ * [Zero AI] Zero AI 加载输入参数:
44
+ * {
45
+ * "config": "ui.json",
46
+ * "ui": "UI.Basic"
47
+ * }
48
+ * [Zero AI] 「启用ZT环境」,当前模块:generated/test,特殊命令只能在ZT环境使用。
49
+ * [Zero AI] Zero AI 0. 基础环境......
50
+ * [Zero AI] 环境变量:ZT = generated/test
51
+ * [Zero AI] 模块信息:generated/test
52
+ * [Zero AI] 语言信息:cn
53
+ * [Zero AI] 项目目录:<项目根目录>
54
+ * [Zero AI] Zero AI 1. 目录检查......
55
+ * [Zero AI] Zero AI 2. 文件表:
56
+ * [Zero AI] Zero AI 3. 执行React命令......
57
+ * [Zero AI] Zero AI 3.1. 创建名空间文件......
58
+ * [Zero AI] Zero AI 3.2. 构造资源文件......
59
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/cab/cn/components/generated/test/UI.Basic.json!
60
+ * [Zero AI] Zero AI 3.3. 构造界面文件......
61
+ * [Zero AI] (Sync)成功将数据写入到文件:<项目根目录>/src/components/generated/test/UI.Basic.js!
62
+ * [Zero AI] Zero AI 4. 命令执行完成!!!
63
+ * ```
64
+ *
65
+ * 代码执行完成后会在项目中生成Zero UI专用模块`generated/test`中唯一的两个页面。
66
+ *
67
+ * * 执行代码之前先执行`export ZT=generated/test`确保`ZT`环境变量有值。
68
+ * * 该命令执行时模板文件位置位于`src/cab/form`目录中,且模板文件以`tpl`结尾。
69
+ * * 生成的`UI.js`的按钮部分直接位于当前文件中,并且默认包含了`ADD, EDIT, DELETE`三个核心按钮。
70
+ *
71
+ * #### 2.2. 生成的文件说明
72
+ *
73
+ * |文件名|模板|含义|
74
+ * |:---|:---|:---|
75
+ * |Cab.json|无|名空间关联文件,计算得来。|
76
+ * |`<Name>.json`|UI.json.tpl|当前表单专用资源文件。|
77
+ * |`<Name>.js`|UI.js.tpl|当前表单源代码专用文件。|
78
+ *
79
+ *
80
+ * ### 3. 选项
81
+ *
82
+ * #### 3.1. 基本说明
83
+ *
84
+ * |短参|全参|类型|默认|含义|
85
+ * |---|---|---|---|:---|
86
+ * |-u|--ui|String|无|生成的文件名,最终生成`<Name>.json/<Name>.js`|
87
+ * |-c|--config|String|`ui.json`|配置文件路径。|
88
+ *
89
+ * @memberOf module:aj
90
+ * @method iform
91
+ */
@@ -0,0 +1,7 @@
1
+ const reactComplex = require('./fn.i.complex');
2
+ const reactForm = require('./fn.i.form');
3
+ const exported = {
4
+ reactComplex,
5
+ reactForm,
6
+ }
7
+ module.exports = exported;
@@ -0,0 +1,128 @@
1
+ const __LOG = require('./ai.unified.fn._.logging');
2
+ const __STR = require('./ai.export.interface.fn.string');
3
+ const __IO = require('./ai.export.interface.io');
4
+ const Excel = require('exceljs');
5
+ const path = require("path");
6
+ // ==========================================================
7
+ // Excel
8
+ // ==========================================================
9
+
10
+ const excelLog = (index, message) => __LOG.info(`Zero AI `.cyan + `「${index}」`.red + message)
11
+ const excelGenerate = async (config = {}, file, index, prefix) => {
12
+ const {role, out} = config;
13
+ excelLog(index, ` -> 加载数据中`);
14
+ const workbook = new Excel.Workbook();
15
+ await workbook.xlsx.readFile(file);
16
+ excelLog(index, ` 读取原始文件:${file.blue}`)
17
+ if (workbook) {
18
+ const worksheetRef = workbook.getWorksheet("DATA-PERM");
19
+ if (worksheetRef) {
20
+ const maxRow = worksheetRef['_rows'].length;
21
+ const maxColumn = worksheetRef['_columns'].length;
22
+ excelLog(index, ` 分析结果:最大行 - ${maxRow.toString().blue},最大列 - ${maxColumn.toString().blue}。`);
23
+ worksheetRef.eachRow((rowRef, rowNumber) => {
24
+ rowRef.eachCell((cellRef, cellNumber) => {
25
+ const original = cellRef.value;
26
+ if ("#ROLE_ID#" === original) {
27
+ cellRef.value = role;
28
+ } else if ("e501b47a-c08b-4c83-b12b-95ad82873e96" === original) {
29
+ cellRef.value = role;
30
+ }
31
+ })
32
+ })
33
+ const segment = file.split(path.sep);
34
+ const filename = segment[segment.length - 1];
35
+ const target = prefix ? `${out}${path.sep}${prefix}.${filename}` : `${out}${path.sep}${filename}`;
36
+ excelLog(index, `创建新数据文件 ${target}`);
37
+ await workbook.xlsx.writeFile(target);
38
+ } else {
39
+ excelLog(index, `文件读取有问题:${file}`.red);
40
+ }
41
+ }
42
+ }
43
+ const excelRun = (config = {}) => {
44
+ __LOG.info(`Zero AI `.cyan + ` 1. 准备生成角色对应权限:ID = "${config.role.green}" ...`);
45
+ __IO.dirCreate(`${process.cwd()}${path.sep}${config.out}`);
46
+ // 1. 执行替换
47
+ const {files = [], filesInput = []} = config;
48
+ __LOG.info(`Zero AI `.cyan + ` 2. 生成 Zero Extension 权限...`.yellow);
49
+ files.forEach((file, index) => excelGenerate(config, file, index))
50
+ __LOG.info(`Zero AI `.cyan + ` 3. 生成 输入文件 权限...`.yellow);
51
+ filesInput.forEach((file, index) => excelGenerate(config, file, index, "input"))
52
+ }
53
+ const excelResource = async (config = {}, parameters = {}, pid = [], sheetName = "DATA-RES") => {
54
+ const workbook = new Excel.Workbook();
55
+ await workbook.xlsx.readFile(config.resource);
56
+ __LOG.info(`Zero AI `.cyan + ` 2.1. 数据加载中,替换原始文件……`);
57
+ if (workbook) {
58
+ const worksheetRef = workbook.getWorksheet(sheetName);
59
+ if (worksheetRef) {
60
+ const maxRow = worksheetRef['_rows'].length;
61
+ const maxColumn = worksheetRef['_columns'].length;
62
+ __LOG.info(`Zero AI `.cyan + ` 2.2. 分析结果:最大行 - ${maxRow.toString().blue},最大列 - ${maxColumn.toString().blue}。`);
63
+ const pidSet = new Set();
64
+ const generate = 0 === pid.length
65
+ worksheetRef.eachRow((rowRef, rowNumber) => {
66
+ rowRef.eachCell((cellRef, cellNumber) => {
67
+ const original = cellRef.value;
68
+ if ("string" === typeof original) {
69
+ if ("#GUID#" === original) {
70
+ cellRef.value = __STR.strUuid();
71
+ } else if ("#PID#" === original) {
72
+ if (generate) {
73
+ const permId = __STR.strUuid();
74
+ cellRef.value = permId;
75
+ pid.push(permId)
76
+ } else {
77
+ let found;
78
+ for (let idx = 0; idx < pid.length; idx++) {
79
+ if (!pidSet.has(pid[idx])) {
80
+ pidSet.add(pid[idx]);
81
+ found = pid[idx];
82
+ break;
83
+ }
84
+ }
85
+ cellRef.value = found;
86
+ }
87
+ } else {
88
+ cellRef.value = __STR.strExpr(original, parameters)
89
+ }
90
+ }
91
+ })
92
+ });
93
+ __LOG.info(`Zero AI `.cyan + ` 1.3. 创建新数据文件......`.rainbow);
94
+ const targetFile = `./${config.identifier}.xlsx`;
95
+ __LOG.info(`Zero AI `.cyan + ` 执行Worksheet:${targetFile.blue}。`);
96
+ await workbook.xlsx.writeFile(targetFile);
97
+ } else {
98
+ __LOG.info(`Zero AI `.cyan + ` ERROR,文件读取有错!!`.red);
99
+ }
100
+ }
101
+ }
102
+ const excelRes = (file = {}, parameters = {}) => {
103
+ __LOG.info(`Zero AI `.cyan + ` 1. 准备生成资源信息..., ${JSON.stringify(parameters)}`);
104
+ __LOG.info(`Zero AI `.cyan + ` 2. 生成 Zero Extension 资源文件...`.yellow);
105
+ const pid = []
106
+ excelResource(file, parameters, pid).then(result => {
107
+ __LOG.info(`Zero AI `.cyan + ` 3. 资源生成完成...`.green);
108
+ return Promise.resolve(result)
109
+ }).then(nil => {
110
+ __LOG.info(`Zero AI `.cyan + ` 4. 准备生成权限信息..., ${JSON.stringify(parameters)}`);
111
+ const res = {};
112
+ res.resource = file.auth;
113
+ res.identifier = "falcon." + file.identifier;
114
+ return excelResource(res, parameters, pid, "DATA-PERM");
115
+ }).then(nil => {
116
+ __LOG.info(`Zero AI `.cyan + ` 5. 权限文件生成完成...`.green);
117
+ const viewJson = __IO.ioJObject(file.json);
118
+ viewJson.data.identifier = file.identifier;
119
+ const targetFile = `./${file.identifier}.json`;
120
+ __IO.outJson(targetFile, viewJson);
121
+ __LOG.info(`Zero AI `.cyan + ` 执行完成...`.green);
122
+
123
+ });
124
+ }
125
+ module.exports = {
126
+ excelRun,
127
+ excelRes
128
+ };
@@ -0,0 +1,162 @@
1
+ const program = require('commander');
2
+ const U = require('underscore');
3
+ const co = require('co');
4
+ const Immutable = require('immutable');
5
+ const __LOG = require('./ai.unified.fn._.logging');
6
+ const __IT = require('./ai.uncork.fn.it.feature');
7
+ const __FX = require('./ai.under.fn.fx.terminal');
8
+ const __PR = require('./ai.export.impl.fn.parse');
9
+
10
+
11
+ const _buildOption = (options = []) => {
12
+ let optionStr = "";
13
+ const optionItem = [];
14
+ options.forEach((option, index) => {
15
+ const keys = Object.keys(option);
16
+ const key0 = keys[0].toString();
17
+ const key1 = keys[1] ? keys[1].toString() : undefined;
18
+ if (key1) {
19
+ const short = key0.length < key1.length ? key0 : key1;
20
+ const long = key0.length > key1.length ? key0 : key1;
21
+ const key = `-${short}, --${long}`;
22
+ const opt = {};
23
+ opt.key = key;
24
+ opt.desc = option[short] ? option[short] : option[long];
25
+ optionItem.push(opt);
26
+ optionStr += key;
27
+ if (index < options.length - 1) {
28
+ optionStr += ' | ';
29
+ }
30
+ }
31
+ });
32
+ return {
33
+ item: optionItem,
34
+ usage: optionStr
35
+ };
36
+ };
37
+
38
+ const _validateArgs = (keys = []) => {
39
+ const commandArg = process.argv[2];
40
+ const skip = Immutable.fromJS(["-h", '-V', '--version', '--help']);
41
+ if (!skip.contains(commandArg)) {
42
+ const $keys = Immutable.fromJS(keys.concat(['help']));
43
+ const isError = !$keys.contains(commandArg);
44
+ // 检测未通过时,打印错误信息
45
+ __FX.fxError(isError, 10005, commandArg, keys);
46
+ return !isError;
47
+ } else {
48
+ // 直接跳过,检测未通过
49
+ return false;
50
+ }
51
+ };
52
+ /**
53
+ * ## `Ec.executeHeader`
54
+ *
55
+ * 执行命令时打印头信息
56
+ *
57
+ * @memberOf module:_epic
58
+ * @param {String} app 应用程序名
59
+ */
60
+ const executeHeader = (app) => {
61
+ const appInfo = require('../../package.json');
62
+ program.allowUnknownOption();
63
+ program.version(appInfo.version);
64
+ __LOG.info(`Zero Ecotope AI工具项 : `.rainbow + app.yellow);
65
+ __LOG.info('HomePage : '.bold + appInfo.homepage.blue);
66
+ __LOG.info('Github : '.bold + appInfo.github.blue);
67
+ __LOG.info(`Version : ` + `${appInfo.version}`.red + ' ' + `「确认您的Node版本 ( >= 18.x ) 支持ES6, ES7.」`.yellow);
68
+ __LOG.info("AI 系统启动......".cyan);
69
+ if (3 > process.argv.length) {
70
+ __LOG.error("命令缺失,请输入正确的命令!");
71
+ }
72
+ };
73
+ /**
74
+ * ## `Ec.executeBody`
75
+ *
76
+ * 执行命令的主方法
77
+ *
78
+ * @memberOf module:_epic
79
+ * @param {Array} commanders 指令集
80
+ * @param {Object} Executor 指令执行集`field = Function`格式
81
+ */
82
+ const executeBody = (commanders = [], Executor = {}) => {
83
+ if (_validateArgs(commanders.map(commander => commander.command))) {
84
+ __IT.itArray(commanders, (commander) => {
85
+ if (!commander.options) commander.options = [];
86
+ const executor = Executor[commander.executor];
87
+ __FX.fxError(!U.isFunction(executor), 10004, commander.command);
88
+ const option = _buildOption(commander.options);
89
+ const cmd = program.command(commander.command)
90
+ .description(commander.description)
91
+ .usage(`[options] [${option.usage}]`);
92
+ __FX.fxContinue(0 < commander.options.length, () => {
93
+ __IT.itArray(commander.options, (item, index) => {
94
+ const optionItem = option.item[index];
95
+ if (optionItem) {
96
+ cmd.option(optionItem.key, optionItem.desc);
97
+ }
98
+ })
99
+ });
100
+ cmd.action(() => co(executor));
101
+ });
102
+ }
103
+ };
104
+ /**
105
+ * ## `Ec.executeEnd`
106
+ *
107
+ * @memberOf module:_epic
108
+ * 执行命令时打印尾信息
109
+ */
110
+ const executeEnd = () => {
111
+ program.parse(process.argv);
112
+ };
113
+ /**
114
+ * ## `Ec.executeInput`
115
+ *
116
+ * ### 1. 基本介绍
117
+ *
118
+ * ```js
119
+ * const actual = Ec.executeInput(
120
+ * [],
121
+ * [
122
+ * ['-n', '--number', 20]
123
+ * ]
124
+ * );
125
+ * ```
126
+ *
127
+ * ### 2. 参数列表
128
+ *
129
+ * #### 2.1. required 参数格式:
130
+ *
131
+ * ```js
132
+ * // 索引1:短参数
133
+ * // 索引2:长参数
134
+ * ["-h", "--help"]
135
+ * ```
136
+ *
137
+ * #### 2.2. optional 参数格式:
138
+ *
139
+ * ```js
140
+ * // 索引1:短参数
141
+ * // 索引2:长参数
142
+ * // 索引3:参数的默认值
143
+ * ['-n', '--number', 20]
144
+ * ```
145
+ *
146
+ * @memberOf module:_epic
147
+ * @param {Array} required 必须参数设置
148
+ * @param {Array} optional 可选参数设置
149
+ * @returns {Object} 生成最终的参数集
150
+ */
151
+ const executeInput = (required = [], optional = []) => {
152
+ const elementArray = required.filter(item => U.isArray(item));
153
+ const isMatrix = 1 <= elementArray.length;
154
+ const args = isMatrix ? __PR.parseInput(required) : __PR.parseInput([required]);
155
+ return __PR.parseFormat(args, optional)
156
+ };
157
+ module.exports = {
158
+ executeHeader,
159
+ executeBody,
160
+ executeEnd,
161
+ executeInput,
162
+ };