@lovrabet/lovrabet-cli 2.3.13-beta.1 → 2.4.0-beta.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 (208) hide show
  1. package/README.md +22 -14
  2. package/lib/cli.js +4 -1
  3. package/lib/commands/api-doc/index.js +11 -1
  4. package/lib/commands/app/cache.js +2 -1
  5. package/lib/commands/app/definitions.js +7 -1
  6. package/lib/commands/app/eligibility.js +2 -1
  7. package/lib/commands/app/mock-loader.js +1 -1
  8. package/lib/commands/app/remote-source.js +2 -1
  9. package/lib/commands/app/shared.js +1 -1
  10. package/lib/commands/app-config/get.js +1 -1
  11. package/lib/commands/app-config/index.js +1 -1
  12. package/lib/commands/approval/index.js +7 -1
  13. package/lib/commands/artifact/index.js +11 -1
  14. package/lib/commands/auth/device.js +8 -1
  15. package/lib/commands/auth/index.js +9 -1
  16. package/lib/commands/auth/prompt.js +2 -1
  17. package/lib/commands/bff/detail.js +1 -1
  18. package/lib/commands/bff/exec.js +1 -1
  19. package/lib/commands/bff/index.js +1 -1
  20. package/lib/commands/cli-skill/index.js +2 -1
  21. package/lib/commands/common/config-policy.js +2 -1
  22. package/lib/commands/common/constraints.js +2 -1
  23. package/lib/commands/common/flags.js +2 -1
  24. package/lib/commands/common/local-file.js +1 -1
  25. package/lib/commands/config/definitions.js +8 -1
  26. package/lib/commands/config/init.js +4 -1
  27. package/lib/commands/config/shared.js +1 -1
  28. package/lib/commands/data/import-excel.js +10 -1
  29. package/lib/commands/data/index.js +10 -1
  30. package/lib/commands/dataset/detail.js +6 -1
  31. package/lib/commands/dataset/index.js +1 -1
  32. package/lib/commands/dataset/list.js +2 -1
  33. package/lib/commands/dataset/sdk-doc.js +1 -1
  34. package/lib/commands/doctor.js +9 -1
  35. package/lib/commands/file/index.js +3 -1
  36. package/lib/commands/init.js +4 -1
  37. package/lib/commands/issue/context.js +1 -1
  38. package/lib/commands/issue/index.js +1 -1
  39. package/lib/commands/issue/report.js +5 -1
  40. package/lib/commands/kb/index.js +7 -1
  41. package/lib/commands/logs/index.js +1 -1
  42. package/lib/commands/metric/contract.js +5 -1
  43. package/lib/commands/metric/definition.js +4 -1
  44. package/lib/commands/metric/detail.js +1 -1
  45. package/lib/commands/metric/exec.js +3 -1
  46. package/lib/commands/metric/index.js +1 -1
  47. package/lib/commands/metric/list.js +2 -1
  48. package/lib/commands/metric/shared.js +2 -1
  49. package/lib/commands/notification/config-list.js +1 -1
  50. package/lib/commands/notification/index.js +1 -1
  51. package/lib/commands/notification/shared.js +2 -1
  52. package/lib/commands/ocr/index.js +4 -1
  53. package/lib/commands/permit/dataset-get.js +1 -1
  54. package/lib/commands/permit/dataset-set.js +5 -1
  55. package/lib/commands/permit/index.js +1 -1
  56. package/lib/commands/permit/page-get.js +1 -1
  57. package/lib/commands/permit/page-set.js +3 -1
  58. package/lib/commands/permit/role-menus-set.js +4 -1
  59. package/lib/commands/permit/role-menus.js +1 -1
  60. package/lib/commands/permit/shared.js +7 -1
  61. package/lib/commands/personal-bff/index.js +7 -1
  62. package/lib/commands/registry.js +6 -1
  63. package/lib/commands/role/create.js +2 -1
  64. package/lib/commands/role/delete.js +2 -1
  65. package/lib/commands/role/detail.js +1 -1
  66. package/lib/commands/role/index.js +1 -1
  67. package/lib/commands/role/list.js +2 -1
  68. package/lib/commands/role/shared.js +8 -1
  69. package/lib/commands/role/update.js +3 -1
  70. package/lib/commands/role/user-add.js +2 -1
  71. package/lib/commands/role/user-remove.js +2 -1
  72. package/lib/commands/schedule/index.js +7 -1
  73. package/lib/commands/schema.js +1 -1
  74. package/lib/commands/service/dynamic.js +10 -1
  75. package/lib/commands/service/function-name-adapter.js +3 -1
  76. package/lib/commands/service/index.js +8 -1
  77. package/lib/commands/service/registry.js +12 -1
  78. package/lib/commands/skill/commands/create.js +3 -1
  79. package/lib/commands/skill/commands/diagram.js +4 -1
  80. package/lib/commands/skill/commands/install.js +6 -1
  81. package/lib/commands/skill/commands/list.js +3 -1
  82. package/lib/commands/skill/commands/push.js +1 -1
  83. package/lib/commands/skill/commands/validate.js +1 -1
  84. package/lib/commands/skill/diagram.js +3 -1
  85. package/lib/commands/skill/flags.js +4 -1
  86. package/lib/commands/skill/index.js +1 -1
  87. package/lib/commands/skill/manifest-helpers.js +1 -1
  88. package/lib/commands/skill/push-execute.js +11 -1
  89. package/lib/commands/skill/push-flow-helpers.js +4 -1
  90. package/lib/commands/skill/push-retarget.js +1 -1
  91. package/lib/commands/skill/scopes.js +1 -1
  92. package/lib/commands/skill/summary.js +1 -1
  93. package/lib/commands/skill/templates.js +8 -1
  94. package/lib/commands/skill/validate.js +8 -1
  95. package/lib/commands/sql/detail.js +1 -1
  96. package/lib/commands/sql/exec.js +2 -1
  97. package/lib/commands/sql/index.js +1 -1
  98. package/lib/commands/update.d.ts +2 -1
  99. package/lib/commands/update.js +8 -1
  100. package/lib/commands/user-account/bind.js +3 -1
  101. package/lib/commands/user-account/index.js +1 -1
  102. package/lib/commands/workspace/index.js +7 -1
  103. package/lib/config/domain-config.js +6 -1
  104. package/lib/config/schema.js +5 -1
  105. package/lib/constant/app.js +1 -1
  106. package/lib/constant/auth-mode.js +1 -1
  107. package/lib/constant/cli.js +3 -1
  108. package/lib/constant/defaults.js +1 -1
  109. package/lib/constant/distribution.js +1 -1
  110. package/lib/constant/domain.js +2 -1
  111. package/lib/constant/env.js +1 -1
  112. package/lib/constant/output.js +1 -1
  113. package/lib/constant/product.js +2 -1
  114. package/lib/constant/region.js +2 -1
  115. package/lib/constant/risk.js +1 -1
  116. package/lib/constant/url.js +1 -1
  117. package/lib/context.js +11 -1
  118. package/lib/core/api-client.js +38 -1
  119. package/lib/core/db-resolver.js +1 -1
  120. package/lib/core/kb-management-client.js +6 -1
  121. package/lib/core/kb-sdk-errors.js +2 -1
  122. package/lib/core/kb-search-client.js +2 -1
  123. package/lib/core/sdk-client.js +5 -1
  124. package/lib/errors.js +2 -1
  125. package/lib/framework/access-error.js +1 -1
  126. package/lib/framework/build-all-flags.js +1 -1
  127. package/lib/framework/dryrun.js +1 -1
  128. package/lib/framework/flags.js +1 -1
  129. package/lib/framework/help.js +2 -1
  130. package/lib/framework/index.js +1 -1
  131. package/lib/framework/output.js +1 -1
  132. package/lib/framework/preparse.js +3 -1
  133. package/lib/framework/rate-limit.js +2 -1
  134. package/lib/framework/raw-flags.js +2 -1
  135. package/lib/framework/response.js +1 -1
  136. package/lib/framework/runner-confirmation.js +2 -1
  137. package/lib/framework/runner-error.js +2 -1
  138. package/lib/framework/runner.js +9 -1
  139. package/lib/framework/schema-export.js +2 -1
  140. package/lib/framework/service-order.js +1 -1
  141. package/lib/framework/types.js +1 -1
  142. package/lib/generated/build-info.d.ts +4 -4
  143. package/lib/generated/build-info.js +1 -1
  144. package/lib/generated/official-routing.js +2 -1
  145. package/lib/generated/routing-contract.js +1 -1
  146. package/lib/help.js +1 -1
  147. package/lib/runtime/confirmation.js +1 -1
  148. package/lib/runtime/event.js +1 -1
  149. package/lib/runtime/index.js +4 -1
  150. package/lib/runtime/queue.js +1 -1
  151. package/lib/runtime/resolve.js +2 -1
  152. package/lib/runtime/types.js +1 -1
  153. package/lib/services/dataset-import/auto-id-runner.js +9 -1
  154. package/lib/services/dataset-import/excel-reader.js +25 -1
  155. package/lib/services/dataset-import/image-bytes.js +6 -1
  156. package/lib/services/dataset-import/image-ooxml.js +15 -1
  157. package/lib/services/dataset-import/image-runner.js +9 -1
  158. package/lib/services/dataset-import/metadata.js +1 -1
  159. package/lib/services/dataset-import/preview.js +1 -1
  160. package/lib/services/dataset-import/runner.js +13 -1
  161. package/lib/services/dataset-import/types.js +1 -1
  162. package/lib/skills/builtin-skill.js +8 -1
  163. package/lib/skills/install-updated-skill.d.ts +8 -0
  164. package/lib/skills/install-updated-skill.js +3 -0
  165. package/lib/skills/local-skills-installer.d.ts +2 -0
  166. package/lib/skills/local-skills-installer.js +1 -0
  167. package/lib/skills/npx-skills-add.d.ts +2 -2
  168. package/lib/skills/npx-skills-add.js +4 -1
  169. package/lib/skills/runtime-skill-sync/constants.js +1 -1
  170. package/lib/skills/runtime-skill-sync/fs-utils.js +3 -1
  171. package/lib/skills/runtime-skill-sync/hashing.js +1 -1
  172. package/lib/skills/runtime-skill-sync/install-target.js +1 -1
  173. package/lib/skills/runtime-skill-sync/links.js +9 -1
  174. package/lib/skills/runtime-skill-sync/list-local.js +4 -1
  175. package/lib/skills/runtime-skill-sync/local-files.js +5 -1
  176. package/lib/skills/runtime-skill-sync/materialize.js +9 -1
  177. package/lib/skills/runtime-skill-sync/metadata.js +3 -1
  178. package/lib/skills/runtime-skill-sync/paths.js +2 -1
  179. package/lib/skills/runtime-skill-sync/push.js +8 -1
  180. package/lib/skills/runtime-skill-sync/scopes.js +1 -1
  181. package/lib/skills/runtime-skill-sync/types.js +1 -1
  182. package/lib/skills/runtime-skill-sync/zip-codec.js +2 -1
  183. package/lib/skills/runtime-skill-sync/zip-package.js +6 -1
  184. package/lib/skills/runtime-skill-sync.js +1 -1
  185. package/lib/skills/skill-presence.d.ts +1 -34
  186. package/lib/skills/skill-presence.js +2 -1
  187. package/lib/utils/access-key-redaction.js +2 -1
  188. package/lib/utils/apply-jq-filter.js +1 -1
  189. package/lib/utils/cli-version-check.js +2 -1
  190. package/lib/utils/cli-version-policy.js +3 -1
  191. package/lib/utils/logger.js +3 -1
  192. package/lib/utils/lossless-json.js +3 -1
  193. package/lib/utils/params.js +3 -1
  194. package/lib/utils/positive-safe-integer.js +1 -1
  195. package/lib/utils/redaction.js +2 -1
  196. package/lib/utils/runtime-user-id.js +1 -1
  197. package/lib/utils/update-notice.js +3 -1
  198. package/lib/utils/version.js +1 -1
  199. package/lib/utils/write-cli-side-channel.js +1 -1
  200. package/package.json +5 -7
  201. package/skills/lovrabet/SKILL.md +3 -3
  202. package/skills/lovrabet/references/lovrabet-skill-install.md +1 -1
  203. package/skills/lovrabet/references/lovrabet-update.md +6 -4
  204. package/skills/lovrabet-report-generation/SKILL.md +1 -1
  205. package/skills/lovrabet.manifest.json +3 -3
  206. package/lib/postinstall.d.ts +0 -2
  207. package/lib/postinstall.js +0 -1
  208. package/scripts/postinstall.mjs +0 -24
package/README.md CHANGED
@@ -17,26 +17,34 @@ repeatable workflows into agent-ready Skills.
17
17
 
18
18
  ## Install
19
19
 
20
- ```bash
21
- npm install -g @lovrabet/lovrabet-cli@latest
22
- lovrabet --version
23
- lovrabet --help
24
- ```
25
-
26
- The npm package automatically installs the same-version Built-in Skill. If the
27
- postinstall warning reports an external Skills CLI, network, or permission
28
- problem, repair it after resolving the cause:
20
+ Install the CLI, then explicitly install its matching Built-in Skill:
29
21
 
30
22
  ```bash
23
+ npm install -g @lovrabet/lovrabet-cli@latest --ignore-scripts
31
24
  lovrabet cli-skill install
25
+ lovrabet --version
32
26
  lovrabet doctor
33
27
  ```
34
28
 
35
- You can also run a specific version with npm tooling:
29
+ Use `@beta` for a beta preview, or pin an exact published version for a container
30
+ image. Run the Skill command as the user whose HOME the agent will use.
31
+ The npm package has no install lifecycle hooks. Help, version, and ordinary
32
+ commands do not install Skills automatically.
36
33
 
37
- ```bash
38
- npx @lovrabet/lovrabet-cli@latest --help
39
- ```
34
+ The CLI uses its exact-version local `skills` dependency to install the Built-in
35
+ Skill shipped in the same npm package. Once npm has installed the dependencies,
36
+ Skill installation needs no installer or Skill-content download. No npm script
37
+ approval is needed for this flow.
38
+
39
+ Treat installation as complete only when the explicit Skill command succeeds
40
+ and `doctor` reports the Built-in Skill as `current`. If the Skill step fails,
41
+ the CLI may already be installed; fix the reported cause and rerun
42
+ `lovrabet cli-skill install`. Do not substitute a remote repository's Skill.
43
+
44
+ `lovrabet update` installs the target CLI and invokes that new package's explicit
45
+ Skill installer before reporting success. A failed Skill step returns failure
46
+ without claiming that the CLI package was rolled back. With older updaters,
47
+ finish the transition by running `lovrabet cli-skill install` explicitly.
40
48
 
41
49
  ## Quick Start
42
50
 
@@ -152,7 +160,7 @@ An environment administrator installs it explicitly from the installed package:
152
160
  npx skills add /path/to/lovrabet-cli/skills/lovrabet-report-generation -g -y
153
161
  ```
154
162
 
155
- Replace the path with the actual package location. CLI postinstall, repair and
163
+ Replace the path with the actual package location. CLI explicit installation, repair and
156
164
  doctor continue to manage only the main `lovrabet` Skill. After a CLI upgrade,
157
165
  explicitly update the companion and verify its name, version, references and
158
166
  discovery in the intended host. A current main Skill does not certify the companion.
package/lib/cli.js CHANGED
@@ -1,2 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x384b0d=a0_0x5b94;(function(_0x388e95,_0x2cb695){const _0xc21610=a0_0x5b94,_0xcf320b=_0x388e95();while(!![]){try{const _0x375468=parseInt(_0xc21610(0x8a))/0x1*(-parseInt(_0xc21610(0x74))/0x2)+parseInt(_0xc21610(0x7c))/0x3*(-parseInt(_0xc21610(0x82))/0x4)+parseInt(_0xc21610(0x77))/0x5+-parseInt(_0xc21610(0x73))/0x6*(parseInt(_0xc21610(0x75))/0x7)+parseInt(_0xc21610(0x9a))/0x8*(parseInt(_0xc21610(0x84))/0x9)+parseInt(_0xc21610(0x71))/0xa*(parseInt(_0xc21610(0x9b))/0xb)+parseInt(_0xc21610(0x8c))/0xc;if(_0x375468===_0x2cb695)break;else _0xcf320b['push'](_0xcf320b['shift']());}catch(_0x1b60ac){_0xcf320b['push'](_0xcf320b['shift']());}}}(a0_0x5352,0xd861b));import{jsx as a0_0x5005f1}from'react/jsx-runtime';import a0_0x49985d from'meow';import{render}from'ink';import{Help}from'./help.js';import{CliError,CliErrors}from'./errors.js';import{buildConfigFromFlags,initGlobalEnvironment}from'./context.js';import{isKnownService,getServiceEntry,findDefinition,getAllDefinitions,resolveRemovedCommand}from'./commands/registry.js';import{generateDynamicServiceHelp,resolveDynamicServiceCommand}from'./commands/service/dynamic.js';import{runCommand,createPipelineEnv}from'./framework/runner.js';import{generateCommandHelp,generateServiceHelp,generateFullHelp}from'./framework/help.js';import{buildMeowFlags}from'./constant/cli.js';import{getCliVersionDisplay}from'./utils/version.js';const helpText=generateFullHelp(),cli=a0_0x49985d(helpText,{'importMeta':import.meta,'flags':buildMeowFlags(),'version':getCliVersionDisplay()});function a0_0x5b94(_0x3f025f,_0x30979d){_0x3f025f=_0x3f025f-0x71;const _0x5352e9=a0_0x5352();let _0x5b942e=_0x5352e9[_0x3f025f];return _0x5b942e;}void main()[a0_0x384b0d(0x8b)](handleError);function a0_0x5352(){const _0x161d2c=['2445311AnSJHX','stderr',':\x20--','definition','Unexpected\x20error:','corrected','30nChaDV','code','296754boTdYf','1527118ElsaiA','91xbQrzS','./framework/preparse.js','166815EfXyKG','exitCode','[preparse]\x20','config','defaultCommand','4215594gHyyFq','doctor','Error:\x20','Hint:\x20','\x0aCancelled.\x0a','error','4kRUMlA','assign','3611133rHjNoB','slice','message','ExitPromptError','log','exit','1zxfCqv','catch','31158240UzfMHP','args','original','cancelled','handler','write','validation','unknownCommand','input','ERR_STREAM_DESTROYED','help','\x20->\x20--','ERR_USE_AFTER_CLOSE','hint','8RwQzeW'];a0_0x5352=function(){return _0x161d2c;};return a0_0x5352();}async function main(){try{await run();}catch(_0x4f9627){handleError(_0x4f9627);}}async function run(){const _0x19b2ea=a0_0x384b0d;let _0x319e33=cli[_0x19b2ea(0x94)][0x0],_0x5e5bfe=cli['input'][0x1];const _0x5afe11=cli['flags'];try{const {correctFlags:_0x43491d}=await import(_0x19b2ea(0x76)),_0xd982f1=getAllDefinitions()['flatMap'](_0x3c5e2d=>_0x3c5e2d['flags']??[]),{flags:_0x2fb182,corrections:_0x5a3a4f}=_0x43491d(_0x5afe11,_0xd982f1);if(_0x5a3a4f['length']>0x0){for(const _0x503093 of _0x5a3a4f){process[_0x19b2ea(0x9c)][_0x19b2ea(0x91)](_0x19b2ea(0x79)+_0x503093[_0x19b2ea(0x90)]+_0x19b2ea(0x9d)+_0x503093[_0x19b2ea(0x8e)]+_0x19b2ea(0x97)+_0x503093[_0x19b2ea(0xa0)]+'\x0a');}Object[_0x19b2ea(0x83)](_0x5afe11,_0x2fb182);}}catch{}if(!_0x319e33){const {waitUntilExit:_0x3c6179}=render(a0_0x5005f1(Help,{}));await _0x3c6179();return;}const _0x393584=resolveRemovedCommand(_0x319e33,_0x5e5bfe);if(_0x393584)throw CliErrors[_0x19b2ea(0x92)](_0x393584['message'],_0x393584['hint']);if(!isKnownService(_0x319e33)){const _0x248bc1=resolveDynamicServiceCommand(cli['input'],_0x5afe11);if(_0x248bc1){if(_0x5afe11[_0x19b2ea(0x96)]){console['log'](generateCommandHelp(_0x248bc1[_0x19b2ea(0x9e)]));return;}Object[_0x19b2ea(0x83)](_0x5afe11,_0x248bc1['flags']);const _0x3d3e26=buildConfigFromFlags(_0x5afe11);await initGlobalEnvironment(_0x3d3e26);const _0x143b85=createPipelineEnv(_0x3d3e26,_0x5afe11);_0x143b85[_0x19b2ea(0x8d)]=_0x248bc1[_0x19b2ea(0x8d)],await runCommand(_0x248bc1[_0x19b2ea(0x9e)],_0x143b85);return;}if(_0x5afe11[_0x19b2ea(0x96)]){const _0xcaa4b3=generateDynamicServiceHelp(_0x319e33);if(_0xcaa4b3){console[_0x19b2ea(0x88)](_0xcaa4b3);return;}}const {waitUntilExit:_0x5e0191}=render(a0_0x5005f1(Help,{}));await _0x5e0191();return;}const _0xeb7b35=getServiceEntry(_0x319e33);if(!_0x5e5bfe){if(_0x5afe11['help']){console[_0x19b2ea(0x88)](generateServiceHelp(_0x319e33));return;}if(_0xeb7b35[_0x19b2ea(0x7b)])_0x5e5bfe=_0xeb7b35[_0x19b2ea(0x7b)];else{console[_0x19b2ea(0x88)](generateServiceHelp(_0x319e33));return;}}const _0xa32c6c=findDefinition(_0x319e33,_0x5e5bfe);!_0xa32c6c&&(console[_0x19b2ea(0x88)](generateServiceHelp(_0x319e33)),handleError(CliErrors[_0x19b2ea(0x93)](_0x319e33+'\x20'+_0x5e5bfe)));if(_0x5afe11[_0x19b2ea(0x96)]){console['log'](generateCommandHelp(_0xa32c6c));return;}const _0x985622=buildConfigFromFlags(_0x5afe11);_0x319e33!==_0x19b2ea(0x7a)&&_0x319e33!==_0x19b2ea(0x7d)&&await initGlobalEnvironment(_0x985622);const _0x26fcc9=createPipelineEnv(_0x985622,_0x5afe11);_0x26fcc9[_0x19b2ea(0x8d)]=cli[_0x19b2ea(0x94)][_0x19b2ea(0x85)](0x2),await runCommand(_0xa32c6c,_0x26fcc9);}function handleError(_0xd29b9c){const _0x2e3200=a0_0x384b0d;if(_0xd29b9c instanceof CliError){_0xd29b9c[_0x2e3200(0x72)]===_0x2e3200(0x8f)&&(process[_0x2e3200(0x9c)]['write'](_0x2e3200(0x80)),process[_0x2e3200(0x89)](0x0));console['error'](_0x2e3200(0x7e)+_0xd29b9c[_0x2e3200(0x86)]);if(_0xd29b9c[_0x2e3200(0x99)])console[_0x2e3200(0x81)](_0x2e3200(0x7f)+_0xd29b9c['hint']);process['exit'](_0xd29b9c[_0x2e3200(0x78)]);}isUserCancellation(_0xd29b9c)&&(process[_0x2e3200(0x9c)]['write']('\x0aCancelled.\x0a'),process['exit'](0x0)),console[_0x2e3200(0x81)](_0x2e3200(0x9f),_0xd29b9c),process[_0x2e3200(0x89)](0x1);}function isUserCancellation(_0x518a98){const _0x49e1db=a0_0x384b0d;if(!(_0x518a98 instanceof Error))return![];if(_0x518a98['name']===_0x49e1db(0x87))return!![];if(_0x518a98[_0x49e1db(0x72)]===_0x49e1db(0x98))return!![];if(_0x518a98[_0x49e1db(0x72)]===_0x49e1db(0x95))return!![];return![];}
2
+ import{jsx as _jsx}from"react/jsx-runtime";import meow from"meow";import{render}from"ink";import{Help}from"./help.js";import{CliError,CliErrors}from"./errors.js";import{buildConfigFromFlags,initGlobalEnvironment}from"./context.js";import{isKnownService,getServiceEntry,findDefinition,getAllDefinitions,resolveRemovedCommand}from"./commands/registry.js";import{generateDynamicServiceHelp,resolveDynamicServiceCommand}from"./commands/service/dynamic.js";import{runCommand,createPipelineEnv}from"./framework/runner.js";import{generateCommandHelp,generateServiceHelp,generateFullHelp}from"./framework/help.js";import{buildMeowFlags}from"./constant/cli.js";import{getCliVersionDisplay}from"./utils/version.js";const helpText=generateFullHelp();const cli=meow(helpText,{importMeta:import.meta,flags:buildMeowFlags(),version:getCliVersionDisplay()});void main().catch(handleError);async function main(){try{await run()}catch(err){handleError(err)}}async function run(){let service=cli.input[0]
3
+ ;let command=cli.input[1];const flags=cli.flags;try{const{correctFlags:correctFlags}=await(import("./framework/preparse.js"));const allFlagDefs=getAllDefinitions().flatMap(d=>d.flags??[]);const{flags:corrected,corrections:corrections}=correctFlags(flags,allFlagDefs);if(corrections.length>0){for(const c of corrections){process.stderr.write(`[preparse] ${c.handler}: --${c.original} -> --${c.corrected}\n`)}Object.assign(flags,corrected)}}catch{}if(!service){const{waitUntilExit:waitUntilExit}=render(_jsx(Help,{}));await waitUntilExit();return}const removedCommand=resolveRemovedCommand(service,command);if(removedCommand){throw CliErrors.validation(removedCommand.message,removedCommand.hint)}if(!isKnownService(service)){const dynamic=resolveDynamicServiceCommand(cli.input,flags);if(dynamic){if(flags.help){console.log(generateCommandHelp(dynamic.definition));return}Object.assign(flags,dynamic.flags);const cliConfig=buildConfigFromFlags(flags);await initGlobalEnvironment(cliConfig)
4
+ ;const env=createPipelineEnv(cliConfig,flags);env.args=dynamic.args;await runCommand(dynamic.definition,env);return}if(flags.help){const help=generateDynamicServiceHelp(service);if(help){console.log(help);return}}const{waitUntilExit:waitUntilExit}=render(_jsx(Help,{}));await waitUntilExit();return}const entry=getServiceEntry(service);if(!command){if(flags.help){console.log(generateServiceHelp(service));return}if(entry.defaultCommand){command=entry.defaultCommand}else{console.log(generateServiceHelp(service));return}}const def=findDefinition(service,command);if(!def){console.log(generateServiceHelp(service));handleError(CliErrors.unknownCommand(`${service} ${command}`))}if(flags.help){console.log(generateCommandHelp(def));return}const cliConfig=buildConfigFromFlags(flags);if(service!=="config"&&service!=="doctor"){await initGlobalEnvironment(cliConfig)}const env=createPipelineEnv(cliConfig,flags);env.args=cli.input.slice(2);await runCommand(def,env)}function handleError(err){
5
+ if(err instanceof CliError){if(err.code==="cancelled"){process.stderr.write("\nCancelled.\n");process.exit(0)}console.error(`Error: ${err.message}`);if(err.hint)console.error(`Hint: ${err.hint}`);process.exit(err.exitCode)}if(isUserCancellation(err)){process.stderr.write("\nCancelled.\n");process.exit(0)}console.error("Unexpected error:",err);process.exit(1)}function isUserCancellation(err){if(!(err instanceof Error))return false;if(err.name==="ExitPromptError")return true;if(err.code==="ERR_USE_AFTER_CLOSE")return true;if(err.code==="ERR_STREAM_DESTROYED")return true;return false}
@@ -1 +1,11 @@
1
- const a1_0x394560=a1_0x5006;(function(_0x286e11,_0x1133dc){const _0x245a36=a1_0x5006,_0x54f086=_0x286e11();while(!![]){try{const _0x3efecc=-parseInt(_0x245a36(0x221))/0x1+-parseInt(_0x245a36(0x22a))/0x2*(-parseInt(_0x245a36(0x239))/0x3)+parseInt(_0x245a36(0x273))/0x4*(-parseInt(_0x245a36(0x249))/0x5)+parseInt(_0x245a36(0x209))/0x6+parseInt(_0x245a36(0x253))/0x7+-parseInt(_0x245a36(0x25b))/0x8*(-parseInt(_0x245a36(0x274))/0x9)+parseInt(_0x245a36(0x232))/0xa*(parseInt(_0x245a36(0x218))/0xb);if(_0x3efecc===_0x1133dc)break;else _0x54f086['push'](_0x54f086['shift']());}catch(_0x2761d5){_0x54f086['push'](_0x54f086['shift']());}}}(a1_0x225b,0x45330));import{CliErrors}from'../../errors.js';const CATEGORY_FLAG={'name':'category','type':a1_0x394560(0x205),'description':'Filter\x20docs\x20by\x20category,\x20for\x20example\x20dataset'},KEYWORD_FLAG={'name':a1_0x394560(0x27b),'type':a1_0x394560(0x205),'description':'Search\x20docs\x20by\x20code,\x20summary,\x20path,\x20or\x20usage\x20text'},DOC_CODE_FLAG={'name':'code','type':a1_0x394560(0x205),'required':!![],'description':'API\x20doc\x20code,\x20for\x20example\x20dataset_list'},DOCS=[{'code':a1_0x394560(0x1f4),'category':a1_0x394560(0x25e),'title':a1_0x394560(0x211),'method':'POST','path':a1_0x394560(0x216),'summary':a1_0x394560(0x1fc),'whenToUse':a1_0x394560(0x252),'pathParams':[],'queryParams':[],'bodySchema':a1_0x394560(0x200),'responseHighlights':[a1_0x394560(0x23b),a1_0x394560(0x20f)],'examples':[a1_0x394560(0x217)],'notes':[a1_0x394560(0x23a)],'markdown':[a1_0x394560(0x222),'',a1_0x394560(0x257)][a1_0x394560(0x238)]('\x0a')},{'code':a1_0x394560(0x26b),'category':a1_0x394560(0x25e),'title':a1_0x394560(0x254),'method':a1_0x394560(0x27c),'path':a1_0x394560(0x26f),'summary':a1_0x394560(0x224),'whenToUse':a1_0x394560(0x21a),'pathParams':[],'queryParams':[{'name':'code','description':a1_0x394560(0x244)}],'bodySchema':a1_0x394560(0x229),'responseHighlights':[a1_0x394560(0x1f9),a1_0x394560(0x23c),a1_0x394560(0x24c)],'examples':[a1_0x394560(0x228)],'notes':[a1_0x394560(0x220)],'markdown':[a1_0x394560(0x231),'',a1_0x394560(0x247)]['join']('\x0a')},{'code':a1_0x394560(0x265),'category':a1_0x394560(0x25e),'title':'Filter\x20dataset\x20data','method':a1_0x394560(0x266),'path':a1_0x394560(0x26d),'summary':a1_0x394560(0x248),'whenToUse':a1_0x394560(0x20e),'pathParams':[{'name':a1_0x394560(0x264),'description':a1_0x394560(0x245)},{'name':a1_0x394560(0x1f7),'description':a1_0x394560(0x244)}],'queryParams':[],'bodySchema':a1_0x394560(0x25f),'responseHighlights':['tableData\x20contains\x20records',a1_0x394560(0x202)],'examples':[a1_0x394560(0x214),a1_0x394560(0x237)],'notes':[a1_0x394560(0x1f8),a1_0x394560(0x272),a1_0x394560(0x263),a1_0x394560(0x255)],'markdown':[a1_0x394560(0x275),'',a1_0x394560(0x278)]['join']('\x0a')},{'code':a1_0x394560(0x226),'category':'dataset','title':a1_0x394560(0x24d),'method':a1_0x394560(0x266),'path':a1_0x394560(0x25c),'summary':a1_0x394560(0x230),'whenToUse':a1_0x394560(0x207),'pathParams':[{'name':'appCode','description':'Current\x20app\x20code'},{'name':a1_0x394560(0x1f7),'description':a1_0x394560(0x244)}],'queryParams':[],'bodySchema':a1_0x394560(0x233),'responseHighlights':[a1_0x394560(0x26a),a1_0x394560(0x26c)],'examples':[a1_0x394560(0x269)],'notes':[a1_0x394560(0x24f),'`field`\x20is\x20accepted\x20as\x20a\x20deprecated\x20alias\x20for\x20`column`;\x20new\x20calls\x20should\x20use\x20`column`.'],'markdown':['##\x20Aggregate\x20dataset\x20data','',a1_0x394560(0x21d)][a1_0x394560(0x238)]('\x0a')},{'code':'dataset_data_get_one','category':'dataset','title':a1_0x394560(0x20b),'method':a1_0x394560(0x266),'path':a1_0x394560(0x206),'summary':'Get\x20one\x20dataset\x20record','whenToUse':a1_0x394560(0x1fa),'pathParams':[{'name':a1_0x394560(0x264),'description':a1_0x394560(0x245)},{'name':a1_0x394560(0x1f7),'description':'32-character\x20dataset\x20code'}],'queryParams':[],'bodySchema':a1_0x394560(0x25d),'responseHighlights':[a1_0x394560(0x21c)],'examples':[a1_0x394560(0x1fd)],'notes':['Prefer\x20`filter`\x20when\x20the\x20record\x20id\x20is\x20unknown.'],'markdown':a1_0x394560(0x23e)},{'code':'dataset_data_create','category':a1_0x394560(0x25e),'title':a1_0x394560(0x262),'method':a1_0x394560(0x266),'path':a1_0x394560(0x241),'summary':a1_0x394560(0x213),'whenToUse':a1_0x394560(0x21e),'pathParams':[{'name':'appCode','description':a1_0x394560(0x245)},{'name':a1_0x394560(0x1f7),'description':a1_0x394560(0x244)}],'queryParams':[],'bodySchema':a1_0x394560(0x22d),'responseHighlights':[a1_0x394560(0x21b)],'examples':[a1_0x394560(0x243)],'notes':[a1_0x394560(0x240)],'markdown':a1_0x394560(0x251)},{'code':a1_0x394560(0x20a),'category':'bf','title':a1_0x394560(0x210),'method':a1_0x394560(0x27c),'path':a1_0x394560(0x236),'summary':a1_0x394560(0x1ff),'whenToUse':'Use\x20when\x20the\x20function\x20name\x20is\x20already\x20confirmed\x20and\x20you\x20need\x20that\x20ENDPOINT\x27s\x20runtime\x20metadata','pathParams':[{'name':a1_0x394560(0x264),'description':a1_0x394560(0x245)},{'name':a1_0x394560(0x225),'description':a1_0x394560(0x203)}],'queryParams':[],'bodySchema':a1_0x394560(0x229),'responseHighlights':['CLI\x20returns\x20appCode/functionName/description/version/gmtModified'],'examples':[a1_0x394560(0x256)],'notes':['This\x20is\x20an\x20exact\x20lookup\x20by\x20appCode\x20+\x20functionName.\x20The\x20CLI\x20does\x20not\x20enumerate\x20Backend\x20Function\x20definitions\x20or\x20expose\x20platform-only\x20fields.'],'markdown':'##\x20Get\x20BF\x20endpoint\x20function\x20contract\x0a\x0aInspect\x20one\x20known\x20endpoint\x20function\x20through\x20the\x20AK-authenticated\x20exact\x20detail\x20API.'},{'code':a1_0x394560(0x277),'category':'bf','title':a1_0x394560(0x27a),'method':a1_0x394560(0x266),'path':a1_0x394560(0x219),'summary':a1_0x394560(0x20d),'whenToUse':'Use\x20when\x20the\x20target\x20BF\x20functionName\x20is\x20confirmed\x20and\x20you\x20need\x20to\x20call\x20that\x20ENDPOINT','pathParams':[{'name':a1_0x394560(0x264),'description':a1_0x394560(0x245)},{'name':a1_0x394560(0x225),'description':a1_0x394560(0x268)}],'queryParams':[],'bodySchema':'{\x22param\x22:\x22value\x22}','responseHighlights':[a1_0x394560(0x24e)],'examples':[a1_0x394560(0x22f)],'notes':['Script\x20behavior\x20may\x20have\x20side\x20effects;\x20inspect\x20detail\x20first.'],'markdown':a1_0x394560(0x208)},{'code':'personal_bf_execute','category':'bf','title':a1_0x394560(0x22c),'method':a1_0x394560(0x266),'path':a1_0x394560(0x23f),'summary':a1_0x394560(0x270),'whenToUse':'Use\x20when\x20the\x20target\x20Personal\x20BFF\x20script\x20id\x20is\x20confirmed\x20under\x20the\x20current\x20user\x20and\x20you\x20need\x20to\x20execute\x20that\x20personal\x20script\x20with\x20optional\x20JSON\x20params','pathParams':[{'name':'id','description':a1_0x394560(0x215)}],'queryParams':[{'name':a1_0x394560(0x264),'description':a1_0x394560(0x245)}],'bodySchema':'{\x22param\x22:\x22value\x22}','responseHighlights':[a1_0x394560(0x24e)],'examples':[a1_0x394560(0x1f5)],'notes':[a1_0x394560(0x26e),a1_0x394560(0x279)],'markdown':[a1_0x394560(0x25a),'',a1_0x394560(0x242)][a1_0x394560(0x238)]('\x0a')},{'code':a1_0x394560(0x27e),'category':a1_0x394560(0x267),'title':a1_0x394560(0x20c),'method':a1_0x394560(0x266),'path':'/api/custom/executeSql','summary':a1_0x394560(0x20c),'whenToUse':'Use\x20when\x20the\x20target\x20sqlCode\x20exists\x20and\x20you\x20need\x20to\x20execute\x20that\x20custom\x20SQL','pathParams':[],'queryParams':[],'bodySchema':a1_0x394560(0x212),'responseHighlights':[a1_0x394560(0x271)],'examples':[a1_0x394560(0x201)],'notes':[a1_0x394560(0x235)],'markdown':a1_0x394560(0x21f)}];function entrySummary(_0x4cd3cb){const _0x2e0960=a1_0x394560;return{'code':_0x4cd3cb[_0x2e0960(0x259)],'category':_0x4cd3cb[_0x2e0960(0x246)],'method':_0x4cd3cb[_0x2e0960(0x27d)],'path':_0x4cd3cb[_0x2e0960(0x24b)],'summary':_0x4cd3cb[_0x2e0960(0x23d)],'whenToUse':_0x4cd3cb[_0x2e0960(0x227)]};}function a1_0x225b(){const _0x2b44a5=['/api/runtime-bff/personal/{id}/execute','This\x20is\x20a\x20write\x20operation;\x20use\x20dry-run\x20when\x20available\x20and\x20safe\x20fixtures\x20for\x20smoke\x20tests.','/api/{appCode}/{datasetCode}/create','Execute\x20a\x20known\x20Personal\x20Backend\x20Function\x20script\x20through\x20its\x20runtime\x20execute\x20endpoint.','lovrabet\x20data\x20create\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22name\x22:\x22demo\x22}\x27','32-character\x20dataset\x20code','Current\x20app\x20code','category','Inspect\x20field\x20names,\x20relations,\x20and\x20operation\x20metadata\x20for\x20a\x20known\x20dataset\x20code.','Filter\x20dataset\x20records','182795BBoDJb','length','path','operations\x20describes\x20runtime\x20APIs','Aggregate\x20dataset\x20data','Returns\x20script\x20business\x20payload','Use\x20`having`\x20only\x20for\x20post-aggregation\x20filters.','List\x20available\x20runtime\x20API\x20documentation\x20entries','##\x20Create\x20dataset\x20record\x0a\x0aCreate\x20one\x20data\x20record\x20in\x20a\x20dataset.','Use\x20when\x20you\x20need\x20a\x20paginated\x20runtime\x20dataset\x20list\x20by\x20appCode\x20and\x20want\x20to\x20collect\x20available\x20datasetCode\x20values','459984tfKfza','Dataset\x20detail','Use\x20read-only\x20data\x20commands\x20before\x20writing\x20Artifacts\x20that\x20display\x20real\x20data.','lovrabet\x20bff\x20detail\x20--name\x20<functionName>','Use\x20this\x20API\x20or\x20`lovrabet\x20dataset\x20list`\x20to\x20discover\x20available\x20dataset\x20codes\x20before\x20reading\x20data.','toLowerCase','code','##\x20Execute\x20Personal\x20Backend\x20Function','1232816Nmqqkv','/api/{appCode}/{datasetCode}/aggregate','{\x22id\x22:123}','dataset','{\x22where\x22:{},\x22currentPage\x22:1,\x22pageSize\x22:20}','map','API\x20doc\x20code\x20not\x20found:\x20','Create\x20dataset\x20record','Verify\x20tableData\x20and\x20paging\x20before\x20treating\x20the\x20response\x20as\x20a\x20business\x20fact.','appCode','dataset_data_filter','POST','custom_sql','Endpoint\x20function\x20name','lovrabet\x20data\x20aggregate\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22aggregate\x22:[{\x22column\x22:\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}]}\x27','result\x20rows\x20contain\x20aggregate\x20aliases','dataset_detail','where\x20filters\x20before\x20aggregation','/api/{appCode}/{datasetCode}/filter','Personal\x20BFF\x20scripts\x20are\x20user-owned\x20and\x20scoped\x20per\x20app.','/api/dataset/getOneByCode?code={datasetCode}','Execute\x20a\x20Personal\x20Backend\x20Function\x20by\x20script\x20ID','Returns\x20SQL\x20execution\x20payload','For\x20the\x20next\x20page,\x20keep\x20where/select/orderBy/pageSize\x20unchanged\x20and\x20increment\x20only\x20currentPage,\x20which\x20starts\x20at\x201.','12kJpwOT','9RsJyLK','##\x20Filter\x20dataset\x20data','str','bf_execute','Use\x20`where`,\x20`select`,\x20`orderBy`,\x20`currentPage`,\x20and\x20`pageSize`\x20to\x20inspect\x20live\x20data\x20shape.','Function\x20execution\x20may\x20have\x20business\x20side\x20effects;\x20inspect\x20detail\x20before\x20execution.','Execute\x20BF\x20endpoint\x20function','keyword','GET','method','custom_sql_execute','dataset_list','lovrabet\x20personal-bff\x20exec\x20--id\x20<id>\x20--params\x20\x27{}\x27','title','datasetCode','where,\x20select,\x20orderBy,\x20currentPage,\x20and\x20pageSize\x20belong\x20inside\x20one\x20--params\x20JSON\x20object;\x20they\x20are\x20not\x20standalone\x20CLI\x20flags.','fields/properties\x20describe\x20data\x20shape','Use\x20when\x20you\x20already\x20know\x20the\x20record\x20id\x20and\x20need\x20one\x20business\x20row\x20from\x20a\x20dataset','read','List\x20datasets\x20with\x20pagination','lovrabet\x20data\x20getOne\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22id\x22:123}\x27','api-doc','Get\x20a\x20BF\x20endpoint\x20contract\x20by\x20app\x20and\x20function\x20name','{\x22appCode\x22:\x22app-aa63b188\x22,\x22currentPage\x22:1,\x22pageSize\x22:100}','lovrabet\x20sql\x20exec\x20--sqlcode\x20<sqlCode>\x20--params\x20\x27{}\x27','paging\x20contains\x20pagination','Exact\x20endpoint\x20function\x20name','find','string','/api/{appCode}/{datasetCode}/getOne','Use\x20when\x20you\x20need\x20groupBy\x20plus\x20count,\x20sum,\x20avg,\x20max,\x20or\x20min\x20aggregates','##\x20Execute\x20BF\x20endpoint\x20function\x0a\x0aExecute\x20a\x20known\x20endpoint\x20script.','12780sCRUQj','bf_detail','Get\x20one\x20dataset\x20record','Execute\x20custom\x20SQL','Execute\x20a\x20BF\x20endpoint\x20function','Use\x20when\x20you\x20need\x20to\x20read\x20business\x20data\x20with\x20where,\x20orderBy,\x20pagination,\x20or\x20similar\x20filters','paging.totalCount\x20gives\x20total\x20rows','Get\x20BF\x20endpoint\x20function\x20contract','List\x20datasets','{\x22appCode\x22:\x22app-aa63b188\x22,\x22sqlCode\x22:\x22xxxxxxxx-xxxxxxxx\x22,\x22params\x22:{}}','Create\x20a\x20dataset\x20record','lovrabet\x20data\x20filter\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22where\x22:{\x22status\x22:{\x22$eq\x22:\x22active\x22}},\x22orderBy\x22:[{\x22id\x22:\x22asc\x22}],\x22currentPage\x22:1,\x22pageSize\x22:20}\x27','Personal\x20Backend\x20Function\x20script\x20ID,\x20for\x20example\x20123','/api/dataset/get-dataset-list-by-app-code','lovrabet\x20dataset\x20list\x20--appcode\x20<appCode>\x20--format\x20compress','143nkwrVe','/api/endpoint/{appCode}/{functionName}','Use\x20when\x20you\x20need\x20fields,\x20table\x20info,\x20relations,\x20or\x20operation\x20definitions\x20for\x20a\x20dataset\x20code','Returns\x20the\x20created\x20record\x20or\x20backend\x20operation\x20result','Returns\x20one\x20matching\x20business\x20record','Aggregate\x20supports\x20COUNT,\x20SUM,\x20AVG,\x20MAX,\x20and\x20MIN\x20definitions\x20in\x20the\x20`aggregate`\x20array.','Use\x20when\x20you\x20need\x20to\x20insert\x20one\x20business\x20record\x20into\x20a\x20dataset','##\x20Execute\x20custom\x20SQL\x0a\x0aExecute\x20a\x20configured\x20SQL\x20script\x20by\x20sqlCode.','If\x20SDK\x20usage\x20is\x20needed,\x20follow\x20with\x20`lovrabet\x20dataset\x20sdk-doc\x20--code\x20<datasetCode>`.','347688afpnly','##\x20List\x20datasets','includes','Get\x20dataset\x20detail','functionName','dataset_data_aggregate','whenToUse','lovrabet\x20dataset\x20detail\x20--code\x20<datasetCode>\x20--appcode\x20<appCode>','None','2614jOXJac','list','Execute\x20Personal\x20Backend\x20Function','{\x22fieldName\x22:\x22value\x22}','validation','lovrabet\x20bff\x20exec\x20--name\x20<functionName>\x20--params\x20\x27{}\x27','Aggregate\x20dataset\x20records','##\x20Dataset\x20detail','219160ncjLIV','{\x22aggregate\x22:[{\x22column\x22:\x20\x22id\x22,\x22type\x22:\x22COUNT\x22,\x22alias\x22:\x22cnt\x22}],\x22groupBy\x22:[]}','trim','Use\x20`lovrabet\x20sql\x20detail`\x20before\x20execution.','/client/bff/endpoint/{appCode}/{functionName}','lovrabet\x20data\x20filter\x20--code\x20<datasetCode>\x20--params\x20\x27{\x22where\x22:{\x22status\x22:{\x22$eq\x22:\x22active\x22}},\x22orderBy\x22:[{\x22id\x22:\x22asc\x22}],\x22currentPage\x22:2,\x22pageSize\x22:20}\x27','join','537kSqsNg','CLI\x20users\x20should\x20prefer\x20`lovrabet\x20dataset\x20list`\x20for\x20this\x20workflow.','tableData\x20contains\x20dataset\x20id/code/name','relations\x20contains\x20the\x20object-shaped\x20API\x20relations\x20value\x20when\x20returned','summary','##\x20Get\x20one\x20dataset\x20record\x0a\x0aRead\x20one\x20record\x20by\x20id.'];a1_0x225b=function(){return _0x2b44a5;};return a1_0x225b();}export function listApiDocEntries(_0x3e6b4c={}){const _0x3b18a1=a1_0x394560,_0x2118fe=String(_0x3e6b4c[_0x3b18a1(0x246)]||'')[_0x3b18a1(0x234)](),_0x1eb73b=String(_0x3e6b4c[_0x3b18a1(0x27b)]||'')[_0x3b18a1(0x234)]()[_0x3b18a1(0x258)]();return DOCS['filter'](_0x42a236=>{const _0x8bcda5=_0x3b18a1;if(_0x2118fe&&_0x42a236['category']!==_0x2118fe)return![];if(!_0x1eb73b)return!![];return[_0x42a236[_0x8bcda5(0x259)],_0x42a236[_0x8bcda5(0x246)],_0x42a236[_0x8bcda5(0x27d)],_0x42a236[_0x8bcda5(0x24b)],_0x42a236[_0x8bcda5(0x23d)],_0x42a236[_0x8bcda5(0x227)],_0x42a236[_0x8bcda5(0x1f6)]]['join']('\x20')['toLowerCase']()[_0x8bcda5(0x223)](_0x1eb73b);})[_0x3b18a1(0x260)](entrySummary);}export function getApiDocDetail(_0x1a5613){const _0xac1f70=a1_0x394560,_0x5c728c=DOCS[_0xac1f70(0x204)](_0x4353e9=>_0x4353e9[_0xac1f70(0x259)]===_0x1a5613);if(!_0x5c728c)throw CliErrors[_0xac1f70(0x22e)](_0xac1f70(0x261)+_0x1a5613);return{..._0x5c728c};}const apiDocList={'service':'api-doc','command':a1_0x394560(0x22b),'description':a1_0x394560(0x250),'risk':a1_0x394560(0x1fb),'requiresAppCode':![],'flags':[CATEGORY_FLAG,KEYWORD_FLAG],async 'execute'(_0x560078){const _0x7e5db8=a1_0x394560,_0x296fb2=listApiDocEntries({'category':_0x560078['str'](_0x7e5db8(0x246)),'keyword':_0x560078['str']('keyword')});return{'ok':!![],'data':{'total':_0x296fb2[_0x7e5db8(0x24a)],'items':_0x296fb2}};}},apiDocDetail={'service':a1_0x394560(0x1fe),'command':'detail','description':'Show\x20runtime\x20API\x20documentation\x20by\x20code','risk':a1_0x394560(0x1fb),'requiresAppCode':![],'flags':[DOC_CODE_FLAG],async 'execute'(_0x1314a7){const _0x35c5cf=a1_0x394560;return{'ok':!![],'data':getApiDocDetail(_0x1314a7[_0x35c5cf(0x276)](_0x35c5cf(0x259)))};}};function a1_0x5006(_0x45d837,_0x5c06ec){_0x45d837=_0x45d837-0x1f4;const _0x225be0=a1_0x225b();let _0x500613=_0x225be0[_0x45d837];return _0x500613;}export const apiDocDefinitions=[apiDocList,apiDocDetail];
1
+ import{CliErrors}from"../../errors.js";const CATEGORY_FLAG={name:"category",type:"string",description:"Filter docs by category, for example dataset"};const KEYWORD_FLAG={name:"keyword",type:"string",description:"Search docs by code, summary, path, or usage text"};const DOC_CODE_FLAG={name:"code",type:"string",required:true,description:"API doc code, for example dataset_list"};const DOCS=[{code:"dataset_list",category:"dataset",title:"List datasets",method:"POST",path:"/api/dataset/get-dataset-list-by-app-code",summary:"List datasets with pagination",whenToUse:"Use when you need a paginated runtime dataset list by appCode and want to collect available datasetCode values",pathParams:[],queryParams:[],bodySchema:'{"appCode":"app-aa63b188","currentPage":1,"pageSize":100}',responseHighlights:["tableData contains dataset id/code/name","paging.totalCount gives total rows"],examples:["lovrabet dataset list --appcode <appCode> --format compress"],
2
+ notes:["CLI users should prefer `lovrabet dataset list` for this workflow."],markdown:["## List datasets","","Use this API or `lovrabet dataset list` to discover available dataset codes before reading data."].join("\n")},{code:"dataset_detail",category:"dataset",title:"Dataset detail",method:"GET",path:"/api/dataset/getOneByCode?code={datasetCode}",summary:"Get dataset detail",whenToUse:"Use when you need fields, table info, relations, or operation definitions for a dataset code",pathParams:[],queryParams:[{name:"code",description:"32-character dataset code"}],bodySchema:"None",responseHighlights:["fields/properties describe data shape","relations contains the object-shaped API relations value when returned","operations describes runtime APIs"],examples:["lovrabet dataset detail --code <datasetCode> --appcode <appCode>"],notes:["If SDK usage is needed, follow with `lovrabet dataset sdk-doc --code <datasetCode>`."],
3
+ markdown:["## Dataset detail","","Inspect field names, relations, and operation metadata for a known dataset code."].join("\n")},{code:"dataset_data_filter",category:"dataset",title:"Filter dataset data",method:"POST",path:"/api/{appCode}/{datasetCode}/filter",summary:"Filter dataset records",whenToUse:"Use when you need to read business data with where, orderBy, pagination, or similar filters",pathParams:[{name:"appCode",description:"Current app code"},{name:"datasetCode",description:"32-character dataset code"}],queryParams:[],bodySchema:'{"where":{},"currentPage":1,"pageSize":20}',responseHighlights:["tableData contains records","paging contains pagination"],examples:['lovrabet data filter --code <datasetCode> --params \'{"where":{"status":{"$eq":"active"}},"orderBy":[{"id":"asc"}],"currentPage":1,"pageSize":20}\'','lovrabet data filter --code <datasetCode> --params \'{"where":{"status":{"$eq":"active"}},"orderBy":[{"id":"asc"}],"currentPage":2,"pageSize":20}\''],
4
+ notes:["where, select, orderBy, currentPage, and pageSize belong inside one --params JSON object; they are not standalone CLI flags.","For the next page, keep where/select/orderBy/pageSize unchanged and increment only currentPage, which starts at 1.","Verify tableData and paging before treating the response as a business fact.","Use read-only data commands before writing Artifacts that display real data."],markdown:["## Filter dataset data","","Use `where`, `select`, `orderBy`, `currentPage`, and `pageSize` to inspect live data shape."].join("\n")},{code:"dataset_data_aggregate",category:"dataset",title:"Aggregate dataset data",method:"POST",path:"/api/{appCode}/{datasetCode}/aggregate",summary:"Aggregate dataset records",whenToUse:"Use when you need groupBy plus count, sum, avg, max, or min aggregates",pathParams:[{name:"appCode",description:"Current app code"},{name:"datasetCode",description:"32-character dataset code"}],queryParams:[],
5
+ bodySchema:'{"aggregate":[{"column": "id","type":"COUNT","alias":"cnt"}],"groupBy":[]}',responseHighlights:["result rows contain aggregate aliases","where filters before aggregation"],examples:['lovrabet data aggregate --code <datasetCode> --params \'{"aggregate":[{"column":"id","type":"COUNT","alias":"cnt"}]}\''],notes:["Use `having` only for post-aggregation filters.","`field` is accepted as a deprecated alias for `column`; new calls should use `column`."],markdown:["## Aggregate dataset data","","Aggregate supports COUNT, SUM, AVG, MAX, and MIN definitions in the `aggregate` array."].join("\n")},{code:"dataset_data_get_one",category:"dataset",title:"Get one dataset record",method:"POST",path:"/api/{appCode}/{datasetCode}/getOne",summary:"Get one dataset record",whenToUse:"Use when you already know the record id and need one business row from a dataset",pathParams:[{name:"appCode",description:"Current app code"},{name:"datasetCode",description:"32-character dataset code"}],
6
+ queryParams:[],bodySchema:'{"id":123}',responseHighlights:["Returns one matching business record"],examples:["lovrabet data getOne --code <datasetCode> --params '{\"id\":123}'"],notes:["Prefer `filter` when the record id is unknown."],markdown:"## Get one dataset record\n\nRead one record by id."},{code:"dataset_data_create",category:"dataset",title:"Create dataset record",method:"POST",path:"/api/{appCode}/{datasetCode}/create",summary:"Create a dataset record",whenToUse:"Use when you need to insert one business record into a dataset",pathParams:[{name:"appCode",description:"Current app code"},{name:"datasetCode",description:"32-character dataset code"}],queryParams:[],bodySchema:'{"fieldName":"value"}',responseHighlights:["Returns the created record or backend operation result"],examples:['lovrabet data create --code <datasetCode> --params \'{"name":"demo"}\''],notes:["This is a write operation; use dry-run when available and safe fixtures for smoke tests."],
7
+ markdown:"## Create dataset record\n\nCreate one data record in a dataset."},{code:"bf_detail",category:"bf",title:"Get BF endpoint function contract",method:"GET",path:"/client/bff/endpoint/{appCode}/{functionName}",summary:"Get a BF endpoint contract by app and function name",whenToUse:"Use when the function name is already confirmed and you need that ENDPOINT's runtime metadata",pathParams:[{name:"appCode",description:"Current app code"},{name:"functionName",description:"Exact endpoint function name"}],queryParams:[],bodySchema:"None",responseHighlights:["CLI returns appCode/functionName/description/version/gmtModified"],examples:["lovrabet bff detail --name <functionName>"],notes:["This is an exact lookup by appCode + functionName. The CLI does not enumerate Backend Function definitions or expose platform-only fields."],markdown:"## Get BF endpoint function contract\n\nInspect one known endpoint function through the AK-authenticated exact detail API."},{code:"bf_execute",
8
+ category:"bf",title:"Execute BF endpoint function",method:"POST",path:"/api/endpoint/{appCode}/{functionName}",summary:"Execute a BF endpoint function",whenToUse:"Use when the target BF functionName is confirmed and you need to call that ENDPOINT",pathParams:[{name:"appCode",description:"Current app code"},{name:"functionName",description:"Endpoint function name"}],queryParams:[],bodySchema:'{"param":"value"}',responseHighlights:["Returns script business payload"],examples:["lovrabet bff exec --name <functionName> --params '{}'"],notes:["Script behavior may have side effects; inspect detail first."],markdown:"## Execute BF endpoint function\n\nExecute a known endpoint script."},{code:"personal_bf_execute",category:"bf",title:"Execute Personal Backend Function",method:"POST",path:"/api/runtime-bff/personal/{id}/execute",summary:"Execute a Personal Backend Function by script ID",
9
+ whenToUse:"Use when the target Personal BFF script id is confirmed under the current user and you need to execute that personal script with optional JSON params",pathParams:[{name:"id",description:"Personal Backend Function script ID, for example 123"}],queryParams:[{name:"appCode",description:"Current app code"}],bodySchema:'{"param":"value"}',responseHighlights:["Returns script business payload"],examples:["lovrabet personal-bff exec --id <id> --params '{}'"],notes:["Personal BFF scripts are user-owned and scoped per app.","Function execution may have business side effects; inspect detail before execution."],markdown:["## Execute Personal Backend Function","","Execute a known Personal Backend Function script through its runtime execute endpoint."].join("\n")},{code:"custom_sql_execute",category:"custom_sql",title:"Execute custom SQL",method:"POST",path:"/api/custom/executeSql",summary:"Execute custom SQL",
10
+ whenToUse:"Use when the target sqlCode exists and you need to execute that custom SQL",pathParams:[],queryParams:[],bodySchema:'{"appCode":"app-aa63b188","sqlCode":"xxxxxxxx-xxxxxxxx","params":{}}',responseHighlights:["Returns SQL execution payload"],examples:["lovrabet sql exec --sqlcode <sqlCode> --params '{}'"],notes:["Use `lovrabet sql detail` before execution."],markdown:"## Execute custom SQL\n\nExecute a configured SQL script by sqlCode."}];function entrySummary(doc){return{code:doc.code,category:doc.category,method:doc.method,path:doc.path,summary:doc.summary,whenToUse:doc.whenToUse}}export function listApiDocEntries(filters={}){const category=String(filters.category||"").trim();const keyword=String(filters.keyword||"").trim().toLowerCase();return DOCS.filter(doc=>{if(category&&doc.category!==category){return false}if(!keyword){return true}return[doc.code,doc.category,doc.method,doc.path,doc.summary,doc.whenToUse,doc.title].join(" ").toLowerCase().includes(keyword)
11
+ }).map(entrySummary)}export function getApiDocDetail(code){const doc=DOCS.find(item=>item.code===code);if(!doc){throw CliErrors.validation(`API doc code not found: ${code}`)}return{...doc}}const apiDocList={service:"api-doc",command:"list",description:"List available runtime API documentation entries",risk:"read",requiresAppCode:false,flags:[CATEGORY_FLAG,KEYWORD_FLAG],async execute(ctx){const items=listApiDocEntries({category:ctx.str("category"),keyword:ctx.str("keyword")});return{ok:true,data:{total:items.length,items:items}}}};const apiDocDetail={service:"api-doc",command:"detail",description:"Show runtime API documentation by code",risk:"read",requiresAppCode:false,flags:[DOC_CODE_FLAG],async execute(ctx){return{ok:true,data:getApiDocDetail(ctx.str("code"))}}};export const apiDocDefinitions=[apiDocList,apiDocDetail];
@@ -1 +1,2 @@
1
- function a2_0x4909(_0x5cf9eb,_0x34c506){_0x5cf9eb=_0x5cf9eb-0x1d3;const _0x55b52f=a2_0x55b5();let _0x4909e8=_0x55b52f[_0x5cf9eb];return _0x4909e8;}(function(_0x5bf976,_0x19e906){const _0x587b19=a2_0x4909,_0xbf20f6=_0x5bf976();while(!![]){try{const _0x51afb2=-parseInt(_0x587b19(0x1e7))/0x1*(-parseInt(_0x587b19(0x1e9))/0x2)+parseInt(_0x587b19(0x1f0))/0x3*(-parseInt(_0x587b19(0x1dc))/0x4)+-parseInt(_0x587b19(0x1e4))/0x5*(-parseInt(_0x587b19(0x1df))/0x6)+parseInt(_0x587b19(0x1d5))/0x7+parseInt(_0x587b19(0x1f1))/0x8+-parseInt(_0x587b19(0x1ec))/0x9+-parseInt(_0x587b19(0x1eb))/0xa*(parseInt(_0x587b19(0x1d4))/0xb);if(_0x51afb2===_0x19e906)break;else _0xbf20f6['push'](_0xbf20f6['shift']());}catch(_0x57dc45){_0xbf20f6['push'](_0xbf20f6['shift']());}}}(a2_0x55b5,0x5ea56));import{createHash}from'node:crypto';import{existsSync,mkdirSync,readFileSync,renameSync,unlinkSync,writeFileSync}from'node:fs';import{homedir}from'node:os';import{dirname,resolve}from'node:path';import{PRODUCT_CONFIG}from'../../constant/product.js';import{isRuntimeAccessibleApp}from'../../commands/app/eligibility.js';export function fingerprintAccessKey(_0x1753d2){const _0x41b132=a2_0x4909,_0x4f38cd=_0x1753d2[_0x41b132(0x1db)](),_0x41e911=_0x4f38cd['slice'](-0x6)||'unknown',_0x52e3ec=createHash(_0x41b132(0x1e0))[_0x41b132(0x1ef)](_0x4f38cd)[_0x41b132(0x1d8)](_0x41b132(0x1d7))[_0x41b132(0x1ea)](0x0,0xc);return _0x41b132(0x1e8)+_0x41e911+'_'+_0x52e3ec;}export function getAppCacheFilePath(_0x12705c,_0x20fe0a){const _0x37e470=a2_0x4909;return resolve(homedir(),PRODUCT_CONFIG[_0x37e470(0x1e6)],_0x37e470(0x1d3),_0x12705c,fingerprintAccessKey(_0x20fe0a),'my-apps.json');}function a2_0x55b5(){const _0x45131d=['hex','digest','find','EACCES','trim','4rDrrWB','utf8','items','96HlAgAk','sha256','.tmp','appCode','code','202465HlZDpk','stringify','homeDirName','1KBfzLL','ak_','657130TBdqZp','slice','40eRJxUW','3767247KLbAOX','EPERM','EXDEV','update','67479BtItlR','5196496zyOstl','cache','3860329Qjloca','4245409ubUKva','appName'];a2_0x55b5=function(){return _0x45131d;};return a2_0x55b5();}export function readCachedAppList(_0x2c3bde,_0x5ead92){const _0x1d293c=a2_0x4909;if(!_0x5ead92?.['trim']())return null;const _0x32d6a9=getAppCacheFilePath(_0x2c3bde,_0x5ead92);if(!existsSync(_0x32d6a9))return null;try{const _0x4435d9=readFileSync(_0x32d6a9,'utf8');if(!_0x4435d9['trim']())return null;const _0x73c186=JSON['parse'](_0x4435d9);if(!Array['isArray'](_0x73c186[_0x1d293c(0x1de)]))return null;return _0x73c186;}catch{return null;}}export function writeCachedAppList(_0x47b236,_0x4b7d8c,_0x5393f4){const _0x340770=a2_0x4909,_0x540056=getAppCacheFilePath(_0x47b236,_0x4b7d8c),_0x2c3d89=dirname(_0x540056);!existsSync(_0x2c3d89)&&mkdirSync(_0x2c3d89,{'recursive':!![]});const _0x189f78=_0x540056+_0x340770(0x1e1);try{writeFileSync(_0x189f78,JSON[_0x340770(0x1e5)](_0x5393f4,null,0x2)+'\x0a',{'encoding':'utf8','mode':0x180});try{renameSync(_0x189f78,_0x540056);}catch(_0x307efc){if(_0x307efc[_0x340770(0x1e3)]===_0x340770(0x1ed)||_0x307efc['code']===_0x340770(0x1ee)||_0x307efc['code']===_0x340770(0x1da)){writeFileSync(_0x540056,JSON[_0x340770(0x1e5)](_0x5393f4,null,0x2)+'\x0a',{'encoding':_0x340770(0x1dd)});try{unlinkSync(_0x189f78);}catch{}}else throw _0x307efc;}}catch(_0x53e55b){try{unlinkSync(_0x189f78);}catch{}throw _0x53e55b;}return _0x540056;}export function resolveCachedAppCode(_0x5f506c,_0x26101a,_0x101c6c){const _0x2f494e=a2_0x4909;if(!_0x5f506c)return undefined;const _0x391062=readCachedAppList(_0x26101a,_0x101c6c),_0x473aba=_0x391062?.[_0x2f494e(0x1de)][_0x2f494e(0x1d9)](_0x294b58=>_0x294b58[_0x2f494e(0x1d6)]===_0x5f506c&&isRuntimeAccessibleApp(_0x294b58));return _0x473aba?.[_0x2f494e(0x1e2)]?.[_0x2f494e(0x1db)]()||undefined;}
1
+ import{createHash}from"node:crypto";import{existsSync,mkdirSync,readFileSync,renameSync,unlinkSync,writeFileSync}from"node:fs";import{homedir}from"node:os";import{dirname,resolve}from"node:path";import{PRODUCT_CONFIG}from"../../constant/product.js";import{isRuntimeAccessibleApp}from"../../commands/app/eligibility.js";export function fingerprintAccessKey(accessKey){const trimmed=accessKey.trim();const suffix=trimmed.slice(-6)||"unknown";const digest=createHash("sha256").update(trimmed).digest("hex").slice(0,12);return`ak_${suffix}_${digest}`}export function getAppCacheFilePath(env,accessKey){return resolve(homedir(),PRODUCT_CONFIG.homeDirName,"cache",env,fingerprintAccessKey(accessKey),"my-apps.json")}export function readCachedAppList(env,accessKey){if(!accessKey?.trim())return null;const filePath=getAppCacheFilePath(env,accessKey);if(!existsSync(filePath))return null;try{const raw=readFileSync(filePath,"utf8");if(!raw.trim())return null;const parsed=JSON.parse(raw)
2
+ ;if(!Array.isArray(parsed.items))return null;return parsed}catch{return null}}export function writeCachedAppList(env,accessKey,payload){const filePath=getAppCacheFilePath(env,accessKey);const parent=dirname(filePath);if(!existsSync(parent)){mkdirSync(parent,{recursive:true})}const tempPath=`${filePath}.tmp`;try{writeFileSync(tempPath,JSON.stringify(payload,null,2)+"\n",{encoding:"utf8",mode:384});try{renameSync(tempPath,filePath)}catch(renameErr){if(renameErr.code==="EPERM"||renameErr.code==="EXDEV"||renameErr.code==="EACCES"){writeFileSync(filePath,JSON.stringify(payload,null,2)+"\n",{encoding:"utf8"});try{unlinkSync(tempPath)}catch{}}else{throw renameErr}}}catch(err){try{unlinkSync(tempPath)}catch{}throw err}return filePath}export function resolveCachedAppCode(name,env,accessKey){if(!name)return undefined;const cached=readCachedAppList(env,accessKey);const match=cached?.items.find(item=>item.appName===name&&isRuntimeAccessibleApp(item));return match?.appCode?.trim()||undefined}
@@ -1 +1,7 @@
1
- const a3_0x190680=a3_0x3eed;(function(_0x459d14,_0x5449dd){const _0x5175cb=a3_0x3eed,_0x23372b=_0x459d14();while(!![]){try{const _0x5766fb=parseInt(_0x5175cb(0x1d4))/0x1*(-parseInt(_0x5175cb(0x1cf))/0x2)+-parseInt(_0x5175cb(0x1ed))/0x3*(parseInt(_0x5175cb(0x1e5))/0x4)+-parseInt(_0x5175cb(0x1fb))/0x5+parseInt(_0x5175cb(0x1f0))/0x6*(parseInt(_0x5175cb(0x20f))/0x7)+-parseInt(_0x5175cb(0x1ce))/0x8*(parseInt(_0x5175cb(0x1df))/0x9)+-parseInt(_0x5175cb(0x1fd))/0xa*(parseInt(_0x5175cb(0x203))/0xb)+parseInt(_0x5175cb(0x207))/0xc*(parseInt(_0x5175cb(0x202))/0xd);if(_0x5766fb===_0x5449dd)break;else _0x23372b['push'](_0x23372b['shift']());}catch(_0xffd3a5){_0x23372b['push'](_0x23372b['shift']());}}}(a3_0x2a8b,0xbb603));import{appImportFlagDefs,runAppImport}from'../../commands/init.js';import{getEnv,RUNTIME_ENV_VALUES}from'../../constant/env.js';import{buildAppProfileListFields}from'../../config/schema.js';function a3_0x2a8b(){const _0x23b453=['pull','accessKey','486249mCERYC','config','Read\x20app\x20list\x20from\x20local\x20cache\x20only','1948872enrrHk','source','trim','local','Reads\x20the\x20given\x20.rabetbase.json\x20and\x20imports\x20a\x20usable\x20default\x20app\x20into\x20local\x20.lovrabet.json.\x20Matching\x20keys\x20may\x20be\x20updated.','appcode','nonInteractive','include-unpublished','Refresh\x20the\x20local\x20app\x20cache\x20from\x20the\x20platform','Target\x20environment\x20(default:\x20current\x20env)','Import\x20the\x20default\x20app\x20selection\x20from\x20a\x20.rabetbase.json\x20file','5609220glvwPN','filter','2735450UahQGn','type','fetchedAt','app','\x20cached\x20app(s)\x20for\x20env=\x22','247xDczbM','44xOyAHX','appName','projectPath','isCurrent','2925828jVnpqC','globalPath','No\x20cached\x20apps\x20found.','no-cache','appPublishStatus','isArray','write','production','28NInMHY','items','Loaded\x20','cachePath','Read\x20from\x20local\x20cache\x20only','16BoThXd','244018ZjTnra','Force\x20remote\x20fetch\x20and\x20refresh\x20local\x20cache','str','enableI18n','string','6aLqqQF','name','length','cache','envName','entries','Include\x20unpublished\x20apps\x20for\x20diagnostics','../../context.js','No\x20apps\x20found\x20on\x20the\x20platform.','boolean','push','5596839kHIRtH','../../commands/app/remote-source.js','env','map','mergedCli','i18nInfo','24pjjuPq','list','Reads\x20the\x20apps\x20available\x20to\x20the\x20current\x20account\x20and\x20overwrites\x20the\x20local\x20app\x20cache\x20for\x20that\x20environment.\x20Platform\x20apps\x20are\x20not\x20modified.','Filter\x20by\x20environment\x20(default:\x20current\x20env)','bool','Refreshed\x20app\x20cache\x20with\x20'];a3_0x2a8b=function(){return _0x23b453;};return a3_0x2a8b();}import{enrichAppListItemsWithMergedSelection}from'../../commands/app/shared.js';import{filterRuntimeAccessibleApps,findAppByCode,isRuntimeAccessibleApp}from'../../commands/app/eligibility.js';function collectFlags(_0x31438c,_0x354189){const _0x1b81ca=a3_0x3eed,_0x307ecc={};for(const _0x2d057f of _0x354189){const _0x4af51d=_0x2d057f[_0x1b81ca(0x1fe)]===_0x1b81ca(0x1dd)?_0x31438c[_0x1b81ca(0x1e9)](_0x2d057f['name']):_0x31438c[_0x1b81ca(0x1d1)](_0x2d057f['name']);if(_0x4af51d!==''&&_0x4af51d!==![])_0x307ecc[_0x2d057f[_0x1b81ca(0x1d5)]]=_0x4af51d;}if(_0x31438c[_0x1b81ca(0x1f6)])_0x307ecc[_0x1b81ca(0x1f6)]=!![];return _0x307ecc;}function normalizeLanguages(_0x3723df){const _0x19182c=a3_0x3eed;if(!Array[_0x19182c(0x20c)](_0x3723df))return[];return _0x3723df[_0x19182c(0x1fc)](_0x576cb1=>typeof _0x576cb1===_0x19182c(0x1d3))[_0x19182c(0x1e2)](_0x26ba2c=>_0x26ba2c[_0x19182c(0x1f2)]())[_0x19182c(0x1fc)](Boolean);}function a3_0x3eed(_0x4f74ac,_0x54bbef){_0x4f74ac=_0x4f74ac-0x1ce;const _0x2a8b82=a3_0x2a8b();let _0x3eed31=_0x2a8b82[_0x4f74ac];return _0x3eed31;}function buildRemoteAppI18nFields(_0x58b330){const _0x24b6c3=a3_0x3eed,_0xdb35f2=normalizeLanguages(_0x58b330[_0x24b6c3(0x1e4)]?.['langs']);return{'enableI18n':typeof _0x58b330['enableI18n']==='boolean'?_0x58b330[_0x24b6c3(0x1d2)]:null,'languages':_0xdb35f2,'i18nInfo':_0x58b330[_0x24b6c3(0x1e4)]?{..._0x58b330['i18nInfo'],'langs':_0xdb35f2['length']?_0xdb35f2:null}:null};}const listDef={'service':a3_0x190680(0x200),'command':a3_0x190680(0x1e6),'description':'List\x20apps\x20available\x20to\x20the\x20current\x20access\x20key','risk':'read','requiresAuth':!![],'requiresAppCode':![],'hasFormat':!![],'flags':[{'name':a3_0x190680(0x1e1),'type':a3_0x190680(0x1d3),'description':a3_0x190680(0x1e8),'enum':[...RUNTIME_ENV_VALUES]},{'name':'local','type':a3_0x190680(0x1dd),'description':a3_0x190680(0x1ef),'default':![]},{'name':'no-cache','type':a3_0x190680(0x1dd),'description':a3_0x190680(0x1d0),'default':![]},{'name':a3_0x190680(0x1f7),'type':a3_0x190680(0x1dd),'description':a3_0x190680(0x1da),'default':![]}],async 'execute'(_0x392af7){const _0x416699=a3_0x190680,_0x3fa429=_0x392af7[_0x416699(0x1d1)](_0x416699(0x1e1))||_0x392af7[_0x416699(0x1d8)]||getEnv()||_0x416699(0x20e),_0xe6f1b4=_0x392af7['bool'](_0x416699(0x1f3)),_0x4c2c6b=_0x392af7[_0x416699(0x1e9)](_0x416699(0x20a)),_0x11df52=_0x392af7['bool']('include-unpublished'),{readRawConfigWithLayers:_0x270117,resolveDefaultAppSource:_0x3af126,getLocalAppAliases:_0x108fe8}=await import(_0x416699(0x1db)),{getRemoteAppList:_0x6d4319}=await import('../../commands/app/remote-source.js'),{config:_0x43c5de,layers:_0x2c410a}=_0x270117(),_0x17fd10=_0x3af126(_0x2c410a),{defaultApp:_0x27cb08}=_0x43c5de,_0x4aab7c=await _0x6d4319({'env':_0x3fa429,'accessKey':_0x392af7['accessKey'],'localOnly':_0xe6f1b4,'noCache':_0x4c2c6b}),_0x1c0b78=_0x11df52?_0x4aab7c[_0x416699(0x210)]:filterRuntimeAccessibleApps(_0x4aab7c[_0x416699(0x210)]),_0x333266=_0x4aab7c[_0x416699(0x210)][_0x416699(0x1d6)]-_0x1c0b78[_0x416699(0x1d6)],_0x3daf76=_0x1c0b78[_0x416699(0x1e2)](_0x4022fa=>{const _0x6478a=_0x416699;return{'name':_0x4022fa[_0x6478a(0x204)],'appcode':_0x4022fa['appCode'],'named':!![],'definedIn':'remote','isDefault':_0x4022fa[_0x6478a(0x204)]===_0x27cb08,...buildAppProfileListFields(_0x3fa429),...buildRemoteAppI18nFields(_0x4022fa),'source':_0x4aab7c[_0x6478a(0x1f1)],'owner':_0x4022fa['appOwnerName']??null,'status':_0x4022fa[_0x6478a(0x20b)]??null,'cachedAt':_0x4aab7c[_0x6478a(0x1ff)]};}),_0x2a6239=_0x108fe8(_0x43c5de);let _0x39c6c7=0x0;for(const [_0x3eac88,_0x5825bd]of Object[_0x416699(0x1d9)](_0x2a6239)){const _0x22d7ad=typeof _0x5825bd['appcode']===_0x416699(0x1d3)?_0x5825bd[_0x416699(0x1f5)][_0x416699(0x1f2)]():'';if(!_0x22d7ad)continue;const _0x580093=findAppByCode(_0x4aab7c['items'],_0x22d7ad);if(!_0x11df52&&_0x580093&&!isRuntimeAccessibleApp(_0x580093))continue;_0x39c6c7+=0x1,_0x3daf76[_0x416699(0x1de)]({'name':_0x3eac88,'appcode':_0x22d7ad,'named':!![],'definedIn':'local','isDefault':_0x3eac88===_0x27cb08,...buildAppProfileListFields(_0x3fa429),'source':_0x416699(0x1ee),'owner':null,'status':null,'cachedAt':null});}enrichAppListItemsWithMergedSelection(_0x3daf76,_0x392af7[_0x416699(0x1e3)]);const _0x17791e=_0x3daf76['find'](_0x588925=>_0x588925[_0x416699(0x206)]===!![]),_0x38b884=_0x27cb08??_0x17791e?.['name']??null,_0x4f5b49={'env':_0x3fa429,'source':_0x4aab7c['source'],'fetchedAt':_0x4aab7c['fetchedAt'],'cachePath':_0x4aab7c[_0x416699(0x212)],'globalPath':_0x2c410a[_0x416699(0x208)]??null,'projectPath':_0x2c410a[_0x416699(0x205)]??null,'defaultApp':_0x38b884,'defaultAppSource':_0x27cb08!=null?_0x17fd10:null,'localAliasCount':_0x39c6c7,'remoteTotal':_0x4aab7c['items'][_0x416699(0x1d6)],'hiddenUnpublishedCount':_0x333266,'includeUnpublished':_0x11df52};if(_0x3daf76[_0x416699(0x1d6)]===0x0)return{'ok':!![],'data':{'items':_0x3daf76,'meta':_0x4f5b49},'message':_0x4aab7c[_0x416699(0x1f1)]===_0x416699(0x1d7)?_0x416699(0x209):_0x416699(0x1dc)};return{'ok':!![],'data':{'items':_0x3daf76,'meta':_0x4f5b49}};}},pullDef={'service':a3_0x190680(0x200),'command':a3_0x190680(0x1eb),'description':a3_0x190680(0x1f8),'risk':a3_0x190680(0x20d),'confirmationDescription':a3_0x190680(0x1e7),'requiresAuth':!![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a3_0x190680(0x1e1),'type':a3_0x190680(0x1d3),'description':a3_0x190680(0x1f9),'enum':[...RUNTIME_ENV_VALUES]},{'name':a3_0x190680(0x1f3),'type':a3_0x190680(0x1dd),'description':a3_0x190680(0x213),'default':![]},{'name':a3_0x190680(0x20a),'type':a3_0x190680(0x1dd),'description':a3_0x190680(0x1d0),'default':![]}],async 'execute'(_0x30a39e){const _0x368faf=a3_0x190680,_0x4a755c=_0x30a39e[_0x368faf(0x1d1)]('env')||_0x30a39e[_0x368faf(0x1d8)]||getEnv()||'production',_0x2f3ae8=_0x30a39e[_0x368faf(0x1e9)](_0x368faf(0x1f3)),_0x295fdc=_0x30a39e[_0x368faf(0x1e9)]('no-cache'),{getRemoteAppList:_0x1710c3}=await import(_0x368faf(0x1e0)),_0x539835=await _0x1710c3({'env':_0x4a755c,'accessKey':_0x30a39e[_0x368faf(0x1ec)],'localOnly':_0x2f3ae8,'noCache':_0x295fdc});return{'ok':!![],'data':{'total':_0x539835[_0x368faf(0x210)][_0x368faf(0x1d6)],'env':_0x4a755c,'source':_0x539835[_0x368faf(0x1f1)],'fetchedAt':_0x539835[_0x368faf(0x1ff)],'cachePath':_0x539835[_0x368faf(0x212)]},'message':_0x539835[_0x368faf(0x1f1)]===_0x368faf(0x1d7)?_0x368faf(0x211)+_0x539835['items'][_0x368faf(0x1d6)]+_0x368faf(0x201)+_0x4a755c+'\x22.':_0x368faf(0x1ea)+_0x539835[_0x368faf(0x210)][_0x368faf(0x1d6)]+'\x20app(s)\x20for\x20env=\x22'+_0x4a755c+'\x22.'};}},importDef={'service':'app','command':'import','description':a3_0x190680(0x1fa),'risk':a3_0x190680(0x20d),'confirmationDescription':a3_0x190680(0x1f4),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':appImportFlagDefs,async 'execute'(_0x48bc39){return await runAppImport(collectFlags(_0x48bc39,appImportFlagDefs)),{'ok':!![]};}};export const appDefinitions=[listDef,pullDef,importDef];
1
+ import{appImportFlagDefs,runAppImport}from"../../commands/init.js";import{getEnv,RUNTIME_ENV_VALUES}from"../../constant/env.js";import{buildAppProfileListFields}from"../../config/schema.js";import{enrichAppListItemsWithMergedSelection}from"../../commands/app/shared.js";import{filterRuntimeAccessibleApps,findAppByCode,isRuntimeAccessibleApp}from"../../commands/app/eligibility.js";function collectFlags(ctx,defs){const flags={};for(const f of defs){const val=f.type==="boolean"?ctx.bool(f.name):ctx.str(f.name);if(val!==""&&val!==false)flags[f.name]=val}if(ctx.nonInteractive)flags.nonInteractive=true;return flags}function normalizeLanguages(langs){if(!Array.isArray(langs))return[];return langs.filter(lang=>typeof lang==="string").map(lang=>lang.trim()).filter(Boolean)}function buildRemoteAppI18nFields(item){const languages=normalizeLanguages(item.i18nInfo?.langs);return{enableI18n:typeof item.enableI18n==="boolean"?item.enableI18n:null,languages:languages,i18nInfo:item.i18nInfo?{
2
+ ...item.i18nInfo,langs:languages.length?languages:null}:null}}const listDef={service:"app",command:"list",description:"List apps available to the current access key",risk:"read",requiresAuth:true,requiresAppCode:false,hasFormat:true,flags:[{name:"env",type:"string",description:"Filter by environment (default: current env)",enum:[...RUNTIME_ENV_VALUES]},{name:"local",type:"boolean",description:"Read app list from local cache only",default:false},{name:"no-cache",type:"boolean",description:"Force remote fetch and refresh local cache",default:false},{name:"include-unpublished",type:"boolean",description:"Include unpublished apps for diagnostics",default:false}],async execute(ctx){const env=ctx.str("env")||ctx.envName||getEnv()||"production";const localOnly=ctx.bool("local");const noCache=ctx.bool("no-cache");const includeUnpublished=ctx.bool("include-unpublished")
3
+ ;const{readRawConfigWithLayers:readRawConfigWithLayers,resolveDefaultAppSource:resolveDefaultAppSource,getLocalAppAliases:getLocalAppAliases}=await(import("../../context.js"));const{getRemoteAppList:getRemoteAppList}=await(import("../../commands/app/remote-source.js"));const{config:config,layers:layers}=readRawConfigWithLayers();const defaultAppSource=resolveDefaultAppSource(layers);const{defaultApp:defaultApp}=config;const remote=await getRemoteAppList({env:env,accessKey:ctx.accessKey,localOnly:localOnly,noCache:noCache});const remoteItems=includeUnpublished?remote.items:filterRuntimeAccessibleApps(remote.items);const hiddenUnpublishedCount=remote.items.length-remoteItems.length;const items=remoteItems.map(item=>({name:item.appName,appcode:item.appCode,named:true,definedIn:"remote",isDefault:item.appName===defaultApp,...buildAppProfileListFields(env),...buildRemoteAppI18nFields(item),source:remote.source,owner:item.appOwnerName??null,status:item.appPublishStatus??null,
4
+ cachedAt:remote.fetchedAt}));const localAliases=getLocalAppAliases(config);let localAliasCount=0;for(const[name,profile]of Object.entries(localAliases)){const appcode=typeof profile.appcode==="string"?profile.appcode.trim():"";if(!appcode)continue;const remoteByCode=findAppByCode(remote.items,appcode);if(!includeUnpublished&&remoteByCode&&!isRuntimeAccessibleApp(remoteByCode)){continue}localAliasCount+=1;items.push({name:name,appcode:appcode,named:true,definedIn:"local",isDefault:name===defaultApp,...buildAppProfileListFields(env),source:"config",owner:null,status:null,cachedAt:null})}enrichAppListItemsWithMergedSelection(items,ctx.mergedCli);const currentItem=items.find(i=>i.isCurrent===true);const effectiveDefault=defaultApp??currentItem?.name??null;const meta={env:env,source:remote.source,fetchedAt:remote.fetchedAt,cachePath:remote.cachePath,globalPath:layers.globalPath??null,projectPath:layers.projectPath??null,defaultApp:effectiveDefault,
5
+ defaultAppSource:defaultApp!=null?defaultAppSource:null,localAliasCount:localAliasCount,remoteTotal:remote.items.length,hiddenUnpublishedCount:hiddenUnpublishedCount,includeUnpublished:includeUnpublished};if(items.length===0){return{ok:true,data:{items:items,meta:meta},message:remote.source==="cache"?"No cached apps found.":"No apps found on the platform."}}return{ok:true,data:{items:items,meta:meta}}}};const pullDef={service:"app",command:"pull",description:"Refresh the local app cache from the platform",risk:"write",confirmationDescription:"Reads the apps available to the current account and overwrites the local app cache for that environment. Platform apps are not modified.",requiresAuth:true,requiresAppCode:false,hasFormat:false,flags:[{name:"env",type:"string",description:"Target environment (default: current env)",enum:[...RUNTIME_ENV_VALUES]},{name:"local",type:"boolean",description:"Read from local cache only",default:false},{name:"no-cache",type:"boolean",
6
+ description:"Force remote fetch and refresh local cache",default:false}],async execute(ctx){const env=ctx.str("env")||ctx.envName||getEnv()||"production";const localOnly=ctx.bool("local");const noCache=ctx.bool("no-cache");const{getRemoteAppList:getRemoteAppList}=await(import("../../commands/app/remote-source.js"));const result=await getRemoteAppList({env:env,accessKey:ctx.accessKey,localOnly:localOnly,noCache:noCache});return{ok:true,data:{total:result.items.length,env:env,source:result.source,fetchedAt:result.fetchedAt,cachePath:result.cachePath},message:result.source==="cache"?`Loaded ${result.items.length} cached app(s) for env="${env}".`:`Refreshed app cache with ${result.items.length} app(s) for env="${env}".`}}};const importDef={service:"app",command:"import",description:"Import the default app selection from a .rabetbase.json file",risk:"write",
7
+ confirmationDescription:"Reads the given .rabetbase.json and imports a usable default app into local .lovrabet.json. Matching keys may be updated.",requiresAuth:false,requiresAppCode:false,hasFormat:false,flags:appImportFlagDefs,async execute(ctx){await runAppImport(collectFlags(ctx,appImportFlagDefs));return{ok:true}}};export const appDefinitions=[listDef,pullDef,importDef];
@@ -1 +1,2 @@
1
- function a4_0x4cba(){const _0x2fa679=['appCode','find','App\x20','.\x20Publish\x20the\x20app\x20before\x20using\x20','340296fdgedt','10AlIeZy','6WSlkgo','11KSduQm','UNKNOWN','5799280qdsAqk','936XgEsNo','141661SUPRXS','\x20dataset/data/sql/bff\x20commands,\x20or\x20choose\x20a\x20published\x20app.','11948209BimINa','19256EfZLZh','30rvJEDN','toUpperCase','\x20is\x20not\x20available\x20for\x20runtime\x20AI\x20access.','60oQvHQl','validation','trim','appPublishStatus','7990090Fmised','string','18170ZMSxWb','appName'];a4_0x4cba=function(){return _0x2fa679;};return a4_0x4cba();}function a4_0x4aaf(_0x1c9094,_0x28343e){_0x1c9094=_0x1c9094-0x106;const _0x4cba7e=a4_0x4cba();let _0x4aaf4c=_0x4cba7e[_0x1c9094];return _0x4aaf4c;}(function(_0x304356,_0x89344){const _0x47a3c0=a4_0x4aaf,_0x396d16=_0x304356();while(!![]){try{const _0x59e743=parseInt(_0x47a3c0(0x115))/0x1*(parseInt(_0x47a3c0(0x11c))/0x2)+parseInt(_0x47a3c0(0x10c))/0x3*(parseInt(_0x47a3c0(0x11b))/0x4)+parseInt(_0x47a3c0(0x106))/0x5*(-parseInt(_0x47a3c0(0x11d))/0x6)+parseInt(_0x47a3c0(0x10a))/0x7+-parseInt(_0x47a3c0(0x10b))/0x8*(-parseInt(_0x47a3c0(0x107))/0x9)+-parseInt(_0x47a3c0(0x113))/0xa*(parseInt(_0x47a3c0(0x11e))/0xb)+-parseInt(_0x47a3c0(0x10f))/0xc*(parseInt(_0x47a3c0(0x108))/0xd);if(_0x59e743===_0x89344)break;else _0x396d16['push'](_0x396d16['shift']());}catch(_0x2dd137){_0x396d16['push'](_0x396d16['shift']());}}}(a4_0x4cba,0xd82cf));import{CLI_BIN_NAME}from'../../constant/cli.js';import{RUNTIME_ACCESSIBLE_APP_STATUS}from'../../constant/app.js';import{CliErrors}from'../../errors.js';export function normalizeAppPublishStatus(_0x5b8dda){const _0x4ad937=a4_0x4aaf;if(typeof _0x5b8dda!==_0x4ad937(0x114))return null;const _0x5841f0=_0x5b8dda[_0x4ad937(0x111)]();return _0x5841f0?_0x5841f0[_0x4ad937(0x10d)]():null;}export function isRuntimeAccessibleApp(_0x37bd54){const _0x3d3534=a4_0x4aaf;return normalizeAppPublishStatus(_0x37bd54[_0x3d3534(0x112)])===RUNTIME_ACCESSIBLE_APP_STATUS;}export function filterRuntimeAccessibleApps(_0x32816a){return _0x32816a['filter'](isRuntimeAccessibleApp);}export function findAppByName(_0x634a89,_0x4cf39b){const _0x4df316=a4_0x4aaf;return _0x634a89[_0x4df316(0x118)](_0x2085eb=>_0x2085eb[_0x4df316(0x116)]===_0x4cf39b);}export function findAppByCode(_0x2b65b5,_0x4a9013){const _0x5e2d18=a4_0x4aaf,_0x4b1716=_0x4a9013[_0x5e2d18(0x111)]();if(!_0x4b1716)return undefined;return _0x2b65b5[_0x5e2d18(0x118)](_0x4f5d5e=>_0x4f5d5e[_0x5e2d18(0x117)]?.['trim']()===_0x4b1716);}export function runtimeInaccessibleAppError(_0x1cba97,_0x2b51ef){const _0x496efd=a4_0x4aaf,_0x70e98d=normalizeAppPublishStatus(_0x1cba97[_0x496efd(0x112)])??_0x496efd(0x11f);return CliErrors[_0x496efd(0x110)](_0x496efd(0x119)+_0x2b51ef+_0x496efd(0x10e),'Current\x20status:\x20'+_0x70e98d+_0x496efd(0x11a)+CLI_BIN_NAME+_0x496efd(0x109));}
1
+ import{CLI_BIN_NAME}from"../../constant/cli.js";import{RUNTIME_ACCESSIBLE_APP_STATUS}from"../../constant/app.js";import{CliErrors}from"../../errors.js";export function normalizeAppPublishStatus(status){if(typeof status!=="string")return null;const trimmed=status.trim();return trimmed?trimmed.toUpperCase():null}export function isRuntimeAccessibleApp(item){return normalizeAppPublishStatus(item.appPublishStatus)===RUNTIME_ACCESSIBLE_APP_STATUS}export function filterRuntimeAccessibleApps(items){return items.filter(isRuntimeAccessibleApp)}export function findAppByName(items,name){return items.find(item=>item.appName===name)}export function findAppByCode(items,appCode){const normalized=appCode.trim();if(!normalized)return undefined;return items.find(item=>item.appCode?.trim()===normalized)}export function runtimeInaccessibleAppError(item,selector){const status=normalizeAppPublishStatus(item.appPublishStatus)??"UNKNOWN"
2
+ ;return CliErrors.validation(`App ${selector} is not available for runtime AI access.`,`Current status: ${status}. Publish the app before using ${CLI_BIN_NAME} dataset/data/sql/bff commands, or choose a published app.`)}
@@ -1 +1 @@
1
- function a5_0x1b5c(_0x17e7bd,_0x285133){_0x17e7bd=_0x17e7bd-0x16b;const _0x4952ed=a5_0x4952();let _0x1b5c45=_0x4952ed[_0x17e7bd];return _0x1b5c45;}(function(_0x120ae7,_0x17d315){const _0xce94e8=a5_0x1b5c,_0x2c2740=_0x120ae7();while(!![]){try{const _0xdccc75=-parseInt(_0xce94e8(0x17a))/0x1*(parseInt(_0xce94e8(0x171))/0x2)+parseInt(_0xce94e8(0x178))/0x3*(-parseInt(_0xce94e8(0x176))/0x4)+-parseInt(_0xce94e8(0x16b))/0x5+parseInt(_0xce94e8(0x16f))/0x6+parseInt(_0xce94e8(0x17b))/0x7*(-parseInt(_0xce94e8(0x16d))/0x8)+parseInt(_0xce94e8(0x16c))/0x9+parseInt(_0xce94e8(0x179))/0xa*(parseInt(_0xce94e8(0x16e))/0xb);if(_0xdccc75===_0x17d315)break;else _0x2c2740['push'](_0x2c2740['shift']());}catch(_0x49809f){_0x2c2740['push'](_0x2c2740['shift']());}}}(a5_0x4952,0xc8da0));import{fileURLToPath}from'url';import{dirname,join}from'path';import{readFileSync}from'fs';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);function a5_0x4952(){const _0x786cb8=['3MdwUey','260fJCvOR','433995lYapVN','70bbFgwT','4681310enUiWk','3095073WEUWXb','819976HVhMzT','1166814WGgsWT','2611986hTMJti','errorCode','2KyqEcu','errorMsg','success','Mock\x20API\x20error:\x20','tableData','1276948lFOLSX','utf-8'];a5_0x4952=function(){return _0x786cb8;};return a5_0x4952();}function loadMockAppList(){const _0x2f6637=a5_0x1b5c,_0x411a7=join(__dirname,'../../../mock/app-list.json'),_0x19b7fe=readFileSync(_0x411a7,_0x2f6637(0x177));return JSON['parse'](_0x19b7fe);}let _cached=null;export function getMockAppList(){return!_cached&&(_cached=loadMockAppList()),_cached;}export function getMockRemoteAppItems(){const _0xbdb1c6=a5_0x1b5c,_0x1f590a=getMockAppList();if(!_0x1f590a[_0xbdb1c6(0x173)])throw new Error(_0xbdb1c6(0x174)+_0x1f590a[_0xbdb1c6(0x172)]+'\x20('+_0x1f590a[_0xbdb1c6(0x170)]+')');return _0x1f590a['data'][_0xbdb1c6(0x175)];}
1
+ import{fileURLToPath}from"url";import{dirname,join}from"path";import{readFileSync}from"fs";const __filename=fileURLToPath(import.meta.url);const __dirname=dirname(__filename);function loadMockAppList(){const mockPath=join(__dirname,"../../../mock/app-list.json");const raw=readFileSync(mockPath,"utf-8");return JSON.parse(raw)}let _cached=null;export function getMockAppList(){if(!_cached){_cached=loadMockAppList()}return _cached}export function getMockRemoteAppItems(){const response=getMockAppList();if(!response.success){throw new Error(`Mock API error: ${response.errorMsg} (${response.errorCode})`)}return response.data.tableData}
@@ -1 +1,2 @@
1
- function a6_0x3a31(_0x678c85,_0x143b1e){_0x678c85=_0x678c85-0x18a;const _0x1bae8b=a6_0x1bae();let _0x3a3194=_0x1bae8b[_0x678c85];return _0x3a3194;}(function(_0x5dfe0c,_0x5f375a){const _0x4c9e91=a6_0x3a31,_0xdf7368=_0x5dfe0c();while(!![]){try{const _0x5cfb1c=parseInt(_0x4c9e91(0x195))/0x1*(-parseInt(_0x4c9e91(0x18d))/0x2)+-parseInt(_0x4c9e91(0x191))/0x3+parseInt(_0x4c9e91(0x19b))/0x4*(-parseInt(_0x4c9e91(0x18e))/0x5)+parseInt(_0x4c9e91(0x199))/0x6*(-parseInt(_0x4c9e91(0x18c))/0x7)+-parseInt(_0x4c9e91(0x197))/0x8+parseInt(_0x4c9e91(0x18a))/0x9+parseInt(_0x4c9e91(0x193))/0xa;if(_0x5cfb1c===_0x5f375a)break;else _0xdf7368['push'](_0xdf7368['shift']());}catch(_0xb16623){_0xdf7368['push'](_0xdf7368['shift']());}}}(a6_0x1bae,0x43b6e));import{getMyApps}from'../../core/api-client.js';import{getMockRemoteAppItems}from'../../commands/app/mock-loader.js';import{getAppCacheFilePath,readCachedAppList,writeCachedAppList}from'../../commands/app/cache.js';import{productEnv}from'../../constant/product.js';function a6_0x1bae(){const _0xa079e8=['1607276HVROwq','313317ElrYFx','trim','49tcQuLS','2ouWKHB','5SrLWdg','toLowerCase','toISOString','1613892KsMroA','cache','20833160HHLono','APP_LIST_SOURCE','470318jSNsMz','remote','3411592wILbzx','fetchedAt','3618wwkPsK','mock'];a6_0x1bae=function(){return _0xa079e8;};return a6_0x1bae();}export function shouldUseMockRemoteApps(){const _0x33d6df=a6_0x3a31,_0x545e6e=(productEnv(_0x33d6df(0x194))||'')[_0x33d6df(0x18b)]()[_0x33d6df(0x18f)]();return _0x545e6e===_0x33d6df(0x19a);}export async function getRemoteAppItems(){if(shouldUseMockRemoteApps())return getMockRemoteAppItems();return getMyApps();}export async function getRemoteAppList(_0x363674){const _0x1965f9=a6_0x3a31,{env:_0x560f91,accessKey:_0x5c5bf9,localOnly:localOnly=![],noCache:noCache=![]}=_0x363674,_0xfdb627=readCachedAppList(_0x560f91,_0x5c5bf9),_0x480633=_0x5c5bf9?.[_0x1965f9(0x18b)]()?getAppCacheFilePath(_0x560f91,_0x5c5bf9):null;if(localOnly)return{'items':_0xfdb627?.['items']??[],'source':_0x1965f9(0x192),'fetchedAt':_0xfdb627?.[_0x1965f9(0x198)]??null,'cachePath':_0x480633};try{const _0xaf9deb=await getRemoteAppItems(),_0x373a57=shouldUseMockRemoteApps()?_0x1965f9(0x19a):_0x1965f9(0x196),_0x182cf6=new Date()[_0x1965f9(0x190)](),_0x3fc857=_0x5c5bf9?.[_0x1965f9(0x18b)]()?writeCachedAppList(_0x560f91,_0x5c5bf9,{'env':_0x560f91,'fetchedAt':_0x182cf6,'source':_0x373a57,'items':_0xaf9deb}):null;return{'items':_0xaf9deb,'source':_0x373a57,'fetchedAt':_0x182cf6,'cachePath':_0x3fc857};}catch(_0xb67ab5){if(!noCache&&_0xfdb627)return{'items':_0xfdb627['items'],'source':_0x1965f9(0x192),'fetchedAt':_0xfdb627[_0x1965f9(0x198)],'cachePath':_0x480633};throw _0xb67ab5;}}
1
+ import{getMyApps}from"../../core/api-client.js";import{getMockRemoteAppItems}from"../../commands/app/mock-loader.js";import{getAppCacheFilePath,readCachedAppList,writeCachedAppList}from"../../commands/app/cache.js";import{productEnv}from"../../constant/product.js";export function shouldUseMockRemoteApps(){const source=(productEnv("APP_LIST_SOURCE")||"").trim().toLowerCase();return source==="mock"}export async function getRemoteAppItems(){if(shouldUseMockRemoteApps()){return getMockRemoteAppItems()}return getMyApps()}export async function getRemoteAppList(options){const{env:env,accessKey:accessKey,localOnly:localOnly=false,noCache:noCache=false}=options;const cached=readCachedAppList(env,accessKey);const resolvedCachePath=accessKey?.trim()?getAppCacheFilePath(env,accessKey):null;if(localOnly){return{items:cached?.items??[],source:"cache",fetchedAt:cached?.fetchedAt??null,cachePath:resolvedCachePath}}try{const items=await getRemoteAppItems()
2
+ ;const source=shouldUseMockRemoteApps()?"mock":"remote";const fetchedAt=(new Date).toISOString();const cachePath=accessKey?.trim()?writeCachedAppList(env,accessKey,{env:env,fetchedAt:fetchedAt,source:source,items:items}):null;return{items:items,source:source,fetchedAt:fetchedAt,cachePath:cachePath}}catch(error){if(!noCache&&cached){return{items:cached.items,source:"cache",fetchedAt:cached.fetchedAt,cachePath:resolvedCachePath}}throw error}}
@@ -1 +1 @@
1
- (function(_0x287d70,_0x327722){const _0x8aa200=a7_0x298d,_0x3a7d35=_0x287d70();while(!![]){try{const _0xae403a=-parseInt(_0x8aa200(0x1e9))/0x1*(-parseInt(_0x8aa200(0x1ee))/0x2)+parseInt(_0x8aa200(0x1df))/0x3+parseInt(_0x8aa200(0x1ea))/0x4*(-parseInt(_0x8aa200(0x1e7))/0x5)+-parseInt(_0x8aa200(0x1e8))/0x6*(-parseInt(_0x8aa200(0x1e3))/0x7)+parseInt(_0x8aa200(0x1e5))/0x8*(-parseInt(_0x8aa200(0x1ec))/0x9)+-parseInt(_0x8aa200(0x1e1))/0xa+parseInt(_0x8aa200(0x1f1))/0xb;if(_0xae403a===_0x327722)break;else _0x3a7d35['push'](_0x3a7d35['shift']());}catch(_0x55a9d0){_0x3a7d35['push'](_0x3a7d35['shift']());}}}(a7_0x542e,0x9a25a));function a7_0x542e(){const _0x37eb95=['find','1724961ZssxwG','name','50300uZjJej','defaultApp','53921BWVTDW','named','1383064CqYbqT','appcode','460ZWUeXF','126bkgIGa','380714cdwOcD','28376tWBuKJ','currentApp','63VSxJqk','isCurrent','4pDkRpJ','appCode','trim','11011737CDloaq','definedIn'];a7_0x542e=function(){return _0x37eb95;};return a7_0x542e();}function a7_0x298d(_0x58fc51,_0x1eea4a){_0x58fc51=_0x58fc51-0x1de;const _0x542e2c=a7_0x542e();let _0x298dc1=_0x542e2c[_0x58fc51];return _0x298dc1;}export function enrichAppListItemsWithMergedSelection(_0x5df931,_0x4c607c){const _0x88ab34=a7_0x298d;if(!_0x4c607c)return;const _0x358802=!!(_0x4c607c['currentApp']??_0x4c607c[_0x88ab34(0x1e2)]);for(const _0x1cce27 of _0x5df931){_0x1cce27[_0x88ab34(0x1ed)]=![];}const _0x2e83eb=_0x4c607c[_0x88ab34(0x1ef)]!=null?String(_0x4c607c['appCode'])[_0x88ab34(0x1f0)]():'';if(_0x358802){const _0x12f2f7=_0x4c607c[_0x88ab34(0x1eb)]??_0x4c607c[_0x88ab34(0x1e2)];if(_0x12f2f7){const _0x4d2c21=_0x5df931['find'](_0x35cc23=>_0x35cc23[_0x88ab34(0x1e4)]===!![]&&_0x35cc23['name']===_0x12f2f7&&_0x35cc23[_0x88ab34(0x1f2)]==='local'),_0x3b32fc=_0x4d2c21??_0x5df931[_0x88ab34(0x1de)](_0x3156fd=>_0x3156fd[_0x88ab34(0x1e4)]===!![]&&_0x3156fd[_0x88ab34(0x1e0)]===_0x12f2f7);if(_0x3b32fc){const _0x48d91d=String(_0x3b32fc[_0x88ab34(0x1e6)]??'')[_0x88ab34(0x1f0)]();if(!_0x2e83eb||_0x48d91d===_0x2e83eb){_0x3b32fc[_0x88ab34(0x1ed)]=!![];return;}}}if(_0x2e83eb){const _0x529858=_0x5df931[_0x88ab34(0x1de)](_0x38e90e=>String(_0x38e90e['appcode']??'')[_0x88ab34(0x1f0)]()===_0x2e83eb);_0x529858&&(_0x529858[_0x88ab34(0x1ed)]=!![]);}return;}if(!_0x2e83eb)return;for(const _0x24accf of _0x5df931){String(_0x24accf[_0x88ab34(0x1e6)]??'')[_0x88ab34(0x1f0)]()===_0x2e83eb&&(_0x24accf[_0x88ab34(0x1ed)]=!![]);}}
1
+ export function enrichAppListItemsWithMergedSelection(items,merged){if(!merged)return;const hasNamedSelection=!!(merged.currentApp??merged.defaultApp);for(const item of items){item.isCurrent=false}const appCodeStr=merged.appCode!=null?String(merged.appCode).trim():"";if(hasNamedSelection){const eff=merged.currentApp??merged.defaultApp;if(eff){const localMatch=items.find(item=>item.named===true&&item.name===eff&&item.definedIn==="local");const match=localMatch??items.find(item=>item.named===true&&item.name===eff);if(match){const matchAppCode=String(match.appcode??"").trim();if(!appCodeStr||matchAppCode===appCodeStr){match.isCurrent=true;return}}}if(appCodeStr){const codeMatch=items.find(item=>String(item.appcode??"").trim()===appCodeStr);if(codeMatch){codeMatch.isCurrent=true}}return}if(!appCodeStr)return;for(const item of items){if(String(item.appcode??"").trim()===appCodeStr){item.isCurrent=true}}}
@@ -1 +1 @@
1
- const a8_0x53019e=a8_0x3a61;function a8_0x3a61(_0x429ed4,_0x4c6076){_0x429ed4=_0x429ed4-0x89;const _0x19477c=a8_0x1947();let _0x3a614=_0x19477c[_0x429ed4];return _0x3a614;}(function(_0x121a17,_0x5d6a52){const _0xd76d94=a8_0x3a61,_0x427c5b=_0x121a17();while(!![]){try{const _0x3d9e9c=parseInt(_0xd76d94(0x96))/0x1*(parseInt(_0xd76d94(0x95))/0x2)+parseInt(_0xd76d94(0x98))/0x3+parseInt(_0xd76d94(0x89))/0x4*(parseInt(_0xd76d94(0x9b))/0x5)+parseInt(_0xd76d94(0x9d))/0x6*(-parseInt(_0xd76d94(0x8e))/0x7)+-parseInt(_0xd76d94(0x9c))/0x8*(parseInt(_0xd76d94(0x8a))/0x9)+-parseInt(_0xd76d94(0x91))/0xa*(parseInt(_0xd76d94(0xa0))/0xb)+parseInt(_0xd76d94(0x93))/0xc*(parseInt(_0xd76d94(0x8c))/0xd);if(_0x3d9e9c===_0x5d6a52)break;else _0x427c5b['push'](_0x427c5b['shift']());}catch(_0x4393f8){_0x427c5b['push'](_0x427c5b['shift']());}}}(a8_0x1947,0xe6dfd));import{getRuntimeAppConfigByKey}from'../../core/api-client.js';function a8_0x1947(){const _0x8e4be3=['Get\x20one\x20runtime\x20app-config\x20value\x20by\x20key','app-config','111700TqvIXw','read','252eHhtRH','get','215626LXcsAc','7JonuXD',',\x20appCode=','1382841kUSzRY','App\x20config\x20key','key','61340SfugnP','104VQmOxH','467466AtdMnp','\x20app-config\x20get\x20<key>','args','1518BdfoXT','Usage:\x20','appCode','Unable\x20to\x20get\x20app-config\x20value:\x20key=','trim','36QAunlB','1178559bkGShN','Missing\x20app-config\x20key.','2785445OYBhOe','validation','147JqLSks'];a8_0x1947=function(){return _0x8e4be3;};return a8_0x1947();}import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const appConfigGet={'service':a8_0x53019e(0x90),'command':a8_0x53019e(0x94),'description':a8_0x53019e(0x8f),'risk':a8_0x53019e(0x92),'args':[{'name':a8_0x53019e(0x9a),'description':a8_0x53019e(0x99),'required':!![]}],'flags':[],async 'execute'(_0x1b5a06){const _0xb85379=a8_0x53019e,_0x497be0=_0x1b5a06[_0xb85379(0x9f)][0x0]?.[_0xb85379(0xa4)]();if(!_0x497be0)throw CliErrors[_0xb85379(0x8d)](_0xb85379(0x8b),_0xb85379(0xa1)+CLI_BIN_NAME+_0xb85379(0x9e));try{const _0x4ff508=await getRuntimeAppConfigByKey(_0x1b5a06[_0xb85379(0xa2)],_0x497be0);return{'ok':!![],'data':_0x4ff508};}catch{throw CliErrors['apiError'](_0xb85379(0xa3)+_0x497be0+_0xb85379(0x97)+_0x1b5a06['appCode'],'Check\x20that\x20the\x20key\x20exists,\x20the\x20current\x20AccessKey\x20has\x20permission,\x20and\x20the\x20runtime\x20app-config\x20endpoint\x20is\x20available.');}}};
1
+ import{getRuntimeAppConfigByKey}from"../../core/api-client.js";import{CliErrors}from"../../errors.js";import{CLI_BIN_NAME}from"../../constant/cli.js";export const appConfigGet={service:"app-config",command:"get",description:"Get one runtime app-config value by key",risk:"read",args:[{name:"key",description:"App config key",required:true}],flags:[],async execute(ctx){const key=ctx.args[0]?.trim();if(!key){throw CliErrors.validation("Missing app-config key.",`Usage: ${CLI_BIN_NAME} app-config get <key>`)}try{const value=await getRuntimeAppConfigByKey(ctx.appCode,key);return{ok:true,data:value}}catch{throw CliErrors.apiError(`Unable to get app-config value: key=${key}, appCode=${ctx.appCode}`,"Check that the key exists, the current AccessKey has permission, and the runtime app-config endpoint is available.")}}};
@@ -1 +1 @@
1
- function a9_0x3b55(_0x19d7a4,_0x19deca){_0x19d7a4=_0x19d7a4-0x1ce;const _0x8d95a7=a9_0x8d95();let _0x3b55d6=_0x8d95a7[_0x19d7a4];return _0x3b55d6;}(function(_0x501ef8,_0x4fe701){const _0x2f0808=a9_0x3b55,_0x398fd8=_0x501ef8();while(!![]){try{const _0x9f331a=parseInt(_0x2f0808(0x1ce))/0x1+parseInt(_0x2f0808(0x1cf))/0x2+parseInt(_0x2f0808(0x1d5))/0x3+-parseInt(_0x2f0808(0x1d6))/0x4+parseInt(_0x2f0808(0x1d2))/0x5*(-parseInt(_0x2f0808(0x1d7))/0x6)+parseInt(_0x2f0808(0x1d1))/0x7*(parseInt(_0x2f0808(0x1d0))/0x8)+parseInt(_0x2f0808(0x1d4))/0x9*(-parseInt(_0x2f0808(0x1d3))/0xa);if(_0x9f331a===_0x4fe701)break;else _0x398fd8['push'](_0x398fd8['shift']());}catch(_0x1f3767){_0x398fd8['push'](_0x398fd8['shift']());}}}(a9_0x8d95,0x68b60));import{appConfigGet}from'../../commands/app-config/get.js';export const appConfigDefinitions=[appConfigGet];function a9_0x8d95(){const _0x146336=['1527498kxoIjB','1330914QHUugL','1913912xWvpAG','6BabOpF','350492qFpkPz','1247070oGoFTR','98144BuJmET','245THIWnl','3849745nQlmup','10xxtxaf'];a9_0x8d95=function(){return _0x146336;};return a9_0x8d95();}
1
+ import{appConfigGet}from"../../commands/app-config/get.js";export const appConfigDefinitions=[appConfigGet];
@@ -1 +1,7 @@
1
- const a10_0x4f9aa8=a10_0x1684;(function(_0x2d238e,_0x120d65){const _0x26d9ba=a10_0x1684,_0x565eba=_0x2d238e();while(!![]){try{const _0x3170e6=-parseInt(_0x26d9ba(0x125))/0x1*(-parseInt(_0x26d9ba(0x138))/0x2)+-parseInt(_0x26d9ba(0x122))/0x3+-parseInt(_0x26d9ba(0x11c))/0x4+parseInt(_0x26d9ba(0x11d))/0x5*(parseInt(_0x26d9ba(0x127))/0x6)+parseInt(_0x26d9ba(0x11f))/0x7+parseInt(_0x26d9ba(0x13d))/0x8+-parseInt(_0x26d9ba(0x157))/0x9*(-parseInt(_0x26d9ba(0x14d))/0xa);if(_0x3170e6===_0x120d65)break;else _0x565eba['push'](_0x565eba['shift']());}catch(_0x32eeb5){_0x565eba['push'](_0x565eba['shift']());}}}(a10_0x55ce,0x21bfa));import{readFileSync}from'node:fs';import{resolve}from'node:path';import{approveApprovalTask,getApprovalTaskDetail,listApprovalTodo,transferApprovalTask}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';function a10_0x1684(_0x5f1fbf,_0x318a2f){_0x5f1fbf=_0x5f1fbf-0x112;const _0x55ce75=a10_0x55ce();let _0x168477=_0x55ce75[_0x5f1fbf];return _0x168477;}import{dryRun as a10_0x2ec575}from'../../framework/dryrun.js';import{redactSensitiveValue}from'../../utils/redaction.js';import{parseLosslessJson}from'../../utils/lossless-json.js';const APP_CODE_FLAG={'name':'app-code','type':a10_0x4f9aa8(0x140),'description':a10_0x4f9aa8(0x120)},PAGE_FLAG={'name':a10_0x4f9aa8(0x143),'type':'number','default':0x1,'description':a10_0x4f9aa8(0x14f)},PAGE_SIZE_FLAG={'name':a10_0x4f9aa8(0x136),'type':'number','default':0x14,'description':a10_0x4f9aa8(0x14e)},TASK_ID_FLAG={'name':a10_0x4f9aa8(0x139),'type':'string','required':!![],'description':a10_0x4f9aa8(0x132)},COMMENT_FLAG={'name':a10_0x4f9aa8(0x152),'type':a10_0x4f9aa8(0x140),'description':a10_0x4f9aa8(0x119)},VARIABLES_FLAG={'name':a10_0x4f9aa8(0x116),'type':a10_0x4f9aa8(0x140),'description':a10_0x4f9aa8(0x112)},TARGET_USER_ID_FLAG={'name':a10_0x4f9aa8(0x14a),'type':'string','required':!![],'description':a10_0x4f9aa8(0x12a)};function requireApprovalAppCode(_0x11b0cf){const _0xd10368=a10_0x4f9aa8,_0x18663e=(_0x11b0cf[_0xd10368(0x134)](_0xd10368(0x142))||_0x11b0cf[_0xd10368(0x123)]?.[_0xd10368(0x14c)]||_0x11b0cf['appCode']||'')[_0xd10368(0x156)]();if(!_0x18663e)throw CliErrors[_0xd10368(0x11b)](_0xd10368(0x155));return _0x18663e;}function requireTaskId(_0x3b886b){const _0x322f7f=a10_0x4f9aa8,_0x39e05d=_0x3b886b[_0x322f7f(0x134)](_0x322f7f(0x139))[_0x322f7f(0x156)]();if(!_0x39e05d)throw CliErrors[_0x322f7f(0x11e)](_0x322f7f(0x147));return _0x39e05d;}function validatePage(_0x2ce7ce){const _0x260d6a=a10_0x4f9aa8,_0x19a2d6=_0x2ce7ce['num'](_0x260d6a(0x143),0x1),_0x28b6f0=_0x2ce7ce[_0x260d6a(0x146)]('page-size',0x14);if(!Number[_0x260d6a(0x150)](_0x19a2d6)||_0x19a2d6<0x1)throw CliErrors[_0x260d6a(0x11e)](_0x260d6a(0x11a));if(!Number['isSafeInteger'](_0x28b6f0)||_0x28b6f0<0x1)throw CliErrors[_0x260d6a(0x11e)](_0x260d6a(0x128));}function readVariables(_0x24cabb){const _0x1ca33c=a10_0x4f9aa8,_0x3ee18f=_0x24cabb[_0x1ca33c(0x134)](_0x1ca33c(0x116))['trim']();if(!_0x3ee18f)return undefined;let _0x5211ae=_0x3ee18f;if(_0x3ee18f['startsWith']('@')){const _0x4a9c20=_0x3ee18f[_0x1ca33c(0x13a)](0x1)['trim']();if(!_0x4a9c20)throw CliErrors[_0x1ca33c(0x11e)](_0x1ca33c(0x129));try{_0x5211ae=readFileSync(resolve(_0x4a9c20),_0x1ca33c(0x118));}catch{throw CliErrors[_0x1ca33c(0x11e)](_0x1ca33c(0x144));}}let _0x4879c7;try{_0x4879c7=parseLosslessJson(_0x5211ae);}catch{throw CliErrors[_0x1ca33c(0x11e)](_0x1ca33c(0x148));}if(!_0x4879c7||typeof _0x4879c7!==_0x1ca33c(0x124)||Array[_0x1ca33c(0x114)](_0x4879c7))throw CliErrors[_0x1ca33c(0x11e)](_0x1ca33c(0x113));return _0x4879c7;}function approvalBody(_0x1b3d24,_0x3f1664){const _0x7181d1=a10_0x4f9aa8,_0x5eb82a={'appCode':requireApprovalAppCode(_0x1b3d24),'taskId':requireTaskId(_0x1b3d24),'approved':_0x3f1664},_0x33b753=_0x1b3d24[_0x7181d1(0x134)](_0x7181d1(0x152)),_0xbd95da=readVariables(_0x1b3d24);if(_0x33b753)_0x5eb82a[_0x7181d1(0x152)]=_0x33b753;if(_0xbd95da!==undefined)_0x5eb82a[_0x7181d1(0x116)]=_0xbd95da;return _0x5eb82a;}function transferBody(_0x499f10){const _0xd6b65d=a10_0x4f9aa8,_0x2f1962=requireTaskId(_0x499f10),_0xa84ad1=_0x499f10[_0xd6b65d(0x134)](_0xd6b65d(0x14a))[_0xd6b65d(0x156)]();if(!_0xa84ad1)throw CliErrors[_0xd6b65d(0x11e)](_0xd6b65d(0x13c));const _0x56072d={'appCode':requireApprovalAppCode(_0x499f10),'taskId':_0x2f1962,'targetUserId':_0xa84ad1},_0x3fa1e4=_0x499f10['str']('comment');if(_0x3fa1e4)_0x56072d['comment']=_0x3fa1e4;return _0x56072d;}function sanitized(_0x561b3e){return redactSensitiveValue(_0x561b3e);}const approvalTodo={'service':a10_0x4f9aa8(0x154),'command':'todo','description':'List\x20the\x20current\x20user\x27s\x20approval\x20todo\x20tasks','risk':a10_0x4f9aa8(0x12d),'requiresAppCode':![],'flags':[APP_CODE_FLAG,PAGE_FLAG,PAGE_SIZE_FLAG],async 'validate'(_0x74ced0){requireApprovalAppCode(_0x74ced0),validatePage(_0x74ced0);},async 'execute'(_0x2ac497){const _0x7d8326=a10_0x4f9aa8,_0x440db2=requireApprovalAppCode(_0x2ac497),_0x126518=await listApprovalTodo(_0x440db2,_0x2ac497[_0x7d8326(0x146)]('page',0x1),_0x2ac497[_0x7d8326(0x146)]('page-size',0x14));return{'ok':!![],'data':sanitized(_0x126518)};}},approvalTaskDetail={'service':a10_0x4f9aa8(0x154),'command':a10_0x4f9aa8(0x12b),'description':a10_0x4f9aa8(0x117),'risk':a10_0x4f9aa8(0x12d),'requiresAppCode':![],'flags':[APP_CODE_FLAG,TASK_ID_FLAG],async 'validate'(_0x46ae67){requireApprovalAppCode(_0x46ae67),requireTaskId(_0x46ae67);},async 'execute'(_0x2aef){const _0xff6149=requireTaskId(_0x2aef),_0x8d9c79=await getApprovalTaskDetail(_0xff6149,requireApprovalAppCode(_0x2aef));return{'ok':!![],'data':sanitized(_0x8d9c79)};}},approvalApprove={'service':a10_0x4f9aa8(0x154),'command':'approve','description':a10_0x4f9aa8(0x13f),'risk':a10_0x4f9aa8(0x141),'confirmationDescription':a10_0x4f9aa8(0x13e),'requiresAppCode':![],'flags':[APP_CODE_FLAG,TASK_ID_FLAG,COMMENT_FLAG,VARIABLES_FLAG],async 'validate'(_0x392088){approvalBody(_0x392088,!![]);},async 'execute'(_0x2bf23c){const _0x35376e=approvalBody(_0x2bf23c,!![]),_0x41a0de=await approveApprovalTask(_0x35376e);return{'ok':!![],'data':sanitized(_0x41a0de),'message':'Approved\x20approval\x20task\x20'+_0x35376e['taskId']};},async 'dryRun'(_0x37e3fd){const _0x434b33=a10_0x4f9aa8,_0x4a58bd=approvalBody(_0x37e3fd,!![]);return a10_0x2ec575(_0x434b33(0x149),_0x434b33(0x135))['body'](sanitized(_0x4a58bd))[_0x434b33(0x153)](_0x434b33(0x12e))[_0x434b33(0x151)]();}},approvalReject={'service':a10_0x4f9aa8(0x154),'command':a10_0x4f9aa8(0x14b),'description':a10_0x4f9aa8(0x137),'risk':a10_0x4f9aa8(0x141),'confirmationDescription':a10_0x4f9aa8(0x130),'requiresAppCode':![],'flags':[APP_CODE_FLAG,TASK_ID_FLAG,COMMENT_FLAG,VARIABLES_FLAG],async 'validate'(_0x3e4d09){approvalBody(_0x3e4d09,![]);},async 'execute'(_0x46641d){const _0x43c5cc=a10_0x4f9aa8,_0x1dbb46=approvalBody(_0x46641d,![]),_0x1ca27a=await approveApprovalTask(_0x1dbb46);return{'ok':!![],'data':sanitized(_0x1ca27a),'message':_0x43c5cc(0x131)+_0x1dbb46[_0x43c5cc(0x133)]};},async 'dryRun'(_0x5c06da){const _0x167e96=a10_0x4f9aa8,_0x414ccc=approvalBody(_0x5c06da,![]);return a10_0x2ec575(_0x167e96(0x149),'/client/flow/approve')[_0x167e96(0x12f)](sanitized(_0x414ccc))['description'](_0x167e96(0x121))[_0x167e96(0x151)]();}},approvalTransfer={'service':'approval','command':a10_0x4f9aa8(0x158),'description':a10_0x4f9aa8(0x13b),'risk':'high-risk-write','confirmationDescription':a10_0x4f9aa8(0x145),'requiresAppCode':![],'flags':[APP_CODE_FLAG,TASK_ID_FLAG,TARGET_USER_ID_FLAG,COMMENT_FLAG],async 'validate'(_0x31446c){transferBody(_0x31446c);},async 'execute'(_0x50383d){const _0x2231fd=a10_0x4f9aa8,_0x1ad96d=transferBody(_0x50383d),_0x2ca1a8=await transferApprovalTask(_0x1ad96d);return{'ok':!![],'data':sanitized(_0x2ca1a8),'message':_0x2231fd(0x115)+_0x1ad96d[_0x2231fd(0x133)]};},async 'dryRun'(_0x30dcbf){const _0x1d394e=a10_0x4f9aa8,_0x361a36=transferBody(_0x30dcbf);return a10_0x2ec575(_0x1d394e(0x149),_0x1d394e(0x12c))[_0x1d394e(0x12f)](sanitized(_0x361a36))['description'](_0x1d394e(0x126))['build']();}};export const approvalDefinitions=[approvalTodo,approvalTaskDetail,approvalApprove,approvalReject,approvalTransfer];function a10_0x55ce(){const _0x13a810=['object','6greQpV','Preview:\x20transfer\x20an\x20approval\x20task','48BzJzmz','--page-size\x20must\x20be\x20a\x20positive\x20integer.','--variables\x20@file\x20path\x20must\x20not\x20be\x20blank.','Target\x20user\x20ID\x20selected\x20from\x20Runtime\x20transfer\x20candidates','task-detail','/client/flow/task/transfer','read','Preview:\x20approve\x20an\x20approval\x20task','body','Rejects\x20the\x20pending\x20Runtime\x20task\x20and\x20applies\x20the\x20workflow\x20rejection\x20path.\x20This\x20action\x20may\x20end\x20the\x20workflow\x20or\x20trigger\x20downstream\x20business\x20side\x20effects.','Rejected\x20approval\x20task\x20','Runtime\x20approval\x20task\x20ID','taskId','str','/client/flow/approve','page-size','Reject\x20a\x20pending\x20Runtime\x20task','6246ZTOJXN','task-id','slice','Transfer\x20a\x20pending\x20Runtime\x20task\x20to\x20an\x20allowed\x20user','--target-user-id\x20must\x20not\x20be\x20blank.','305256yzCIEV','Approves\x20the\x20pending\x20Runtime\x20task\x20and\x20advances\x20its\x20workflow.\x20This\x20action\x20may\x20trigger\x20downstream\x20nodes\x20and\x20business\x20side\x20effects.','Approve\x20a\x20pending\x20Runtime\x20task','string','high-risk-write','app-code','page','Unable\x20to\x20read\x20--variables\x20file.','Transfers\x20the\x20pending\x20Runtime\x20task\x20to\x20the\x20selected\x20eligible\x20user.\x20The\x20current\x20handler\x20may\x20lose\x20permission\x20to\x20process\x20the\x20task.','num','--task-id\x20must\x20not\x20be\x20blank.','--variables\x20must\x20contain\x20valid\x20JSON.','POST','target-user-id','reject','appCode','513710UUakRL','Number\x20of\x20todo\x20records\x20per\x20page','One-based\x20todo\x20page\x20number','isSafeInteger','build','comment','description','approval','Set\x20--app-code,\x20--appcode,\x20or\x20an\x20active\x20app\x20in\x20the\x20workspace\x20configuration.','trim','27FPMVEm','transfer','Workflow\x20variables\x20as\x20JSON\x20or\x20@path/to/variables.json','--variables\x20must\x20be\x20a\x20JSON\x20object.','isArray','Transferred\x20approval\x20task\x20','variables','Show\x20an\x20approval\x20task\x20and\x20its\x20current\x20handling\x20permissions','utf8','Approval\x20or\x20transfer\x20comment','--page\x20must\x20be\x20a\x20positive\x20integer.','configMissing','581388KoaFSS','138455bMrmXo','validation','114814qbFKlb','Application\x20code\x20(falls\x20back\x20to\x20the\x20active\x20workspace\x20app)','Preview:\x20reject\x20an\x20approval\x20task','496071nNdQuH','mergedCli'];a10_0x55ce=function(){return _0x13a810;};return a10_0x55ce();}export{approvalApprove,approvalReject,approvalTaskDetail,approvalTodo,approvalTransfer};
1
+ import{readFileSync}from"node:fs";import{resolve}from"node:path";import{approveApprovalTask,getApprovalTaskDetail,listApprovalTodo,transferApprovalTask}from"../../core/api-client.js";import{CliErrors}from"../../errors.js";import{dryRun as buildDryRun}from"../../framework/dryrun.js";import{redactSensitiveValue}from"../../utils/redaction.js";import{parseLosslessJson}from"../../utils/lossless-json.js";const APP_CODE_FLAG={name:"app-code",type:"string",description:"Application code (falls back to the active workspace app)"};const PAGE_FLAG={name:"page",type:"number",default:1,description:"One-based todo page number"};const PAGE_SIZE_FLAG={name:"page-size",type:"number",default:20,description:"Number of todo records per page"};const TASK_ID_FLAG={name:"task-id",type:"string",required:true,description:"Runtime approval task ID"};const COMMENT_FLAG={name:"comment",type:"string",description:"Approval or transfer comment"};const VARIABLES_FLAG={name:"variables",type:"string",
2
+ description:"Workflow variables as JSON or @path/to/variables.json"};const TARGET_USER_ID_FLAG={name:"target-user-id",type:"string",required:true,description:"Target user ID selected from Runtime transfer candidates"};function requireApprovalAppCode(ctx){const appCode=(ctx.str("app-code")||ctx.mergedCli?.appCode||ctx.appCode||"").trim();if(!appCode){throw CliErrors.configMissing("Set --app-code, --appcode, or an active app in the workspace configuration.")}return appCode}function requireTaskId(ctx){const taskId=ctx.str("task-id").trim();if(!taskId){throw CliErrors.validation("--task-id must not be blank.")}return taskId}function validatePage(ctx){const page=ctx.num("page",1);const pageSize=ctx.num("page-size",20);if(!Number.isSafeInteger(page)||page<1){throw CliErrors.validation("--page must be a positive integer.")}if(!Number.isSafeInteger(pageSize)||pageSize<1){throw CliErrors.validation("--page-size must be a positive integer.")}}function readVariables(ctx){
3
+ const raw=ctx.str("variables").trim();if(!raw)return undefined;let source=raw;if(raw.startsWith("@")){const filePath=raw.slice(1).trim();if(!filePath){throw CliErrors.validation("--variables @file path must not be blank.")}try{source=readFileSync(resolve(filePath),"utf8")}catch{throw CliErrors.validation("Unable to read --variables file.")}}let parsed;try{parsed=parseLosslessJson(source)}catch{throw CliErrors.validation("--variables must contain valid JSON.")}if(!parsed||typeof parsed!=="object"||Array.isArray(parsed)){throw CliErrors.validation("--variables must be a JSON object.")}return parsed}function approvalBody(ctx,approved){const body={appCode:requireApprovalAppCode(ctx),taskId:requireTaskId(ctx),approved:approved};const comment=ctx.str("comment");const variables=readVariables(ctx);if(comment)body.comment=comment;if(variables!==undefined)body.variables=variables;return body}function transferBody(ctx){const taskId=requireTaskId(ctx)
4
+ ;const targetUserId=ctx.str("target-user-id").trim();if(!targetUserId){throw CliErrors.validation("--target-user-id must not be blank.")}const body={appCode:requireApprovalAppCode(ctx),taskId:taskId,targetUserId:targetUserId};const comment=ctx.str("comment");if(comment)body.comment=comment;return body}function sanitized(value){return redactSensitiveValue(value)}const approvalTodo={service:"approval",command:"todo",description:"List the current user's approval todo tasks",risk:"read",requiresAppCode:false,flags:[APP_CODE_FLAG,PAGE_FLAG,PAGE_SIZE_FLAG],async validate(ctx){requireApprovalAppCode(ctx);validatePage(ctx)},async execute(ctx){const appCode=requireApprovalAppCode(ctx);const page=await listApprovalTodo(appCode,ctx.num("page",1),ctx.num("page-size",20));return{ok:true,data:sanitized(page)}}};const approvalTaskDetail={service:"approval",command:"task-detail",description:"Show an approval task and its current handling permissions",risk:"read",requiresAppCode:false,
5
+ flags:[APP_CODE_FLAG,TASK_ID_FLAG],async validate(ctx){requireApprovalAppCode(ctx);requireTaskId(ctx)},async execute(ctx){const taskId=requireTaskId(ctx);const detail=await getApprovalTaskDetail(taskId,requireApprovalAppCode(ctx));return{ok:true,data:sanitized(detail)}}};const approvalApprove={service:"approval",command:"approve",description:"Approve a pending Runtime task",risk:"high-risk-write",confirmationDescription:"Approves the pending Runtime task and advances its workflow. This action may trigger downstream nodes and business side effects.",requiresAppCode:false,flags:[APP_CODE_FLAG,TASK_ID_FLAG,COMMENT_FLAG,VARIABLES_FLAG],async validate(ctx){approvalBody(ctx,true)},async execute(ctx){const body=approvalBody(ctx,true);const result=await approveApprovalTask(body);return{ok:true,data:sanitized(result),message:`Approved approval task ${body.taskId}`}},async dryRun(ctx){const body=approvalBody(ctx,true)
6
+ ;return buildDryRun("POST","/client/flow/approve").body(sanitized(body)).description("Preview: approve an approval task").build()}};const approvalReject={service:"approval",command:"reject",description:"Reject a pending Runtime task",risk:"high-risk-write",confirmationDescription:"Rejects the pending Runtime task and applies the workflow rejection path. This action may end the workflow or trigger downstream business side effects.",requiresAppCode:false,flags:[APP_CODE_FLAG,TASK_ID_FLAG,COMMENT_FLAG,VARIABLES_FLAG],async validate(ctx){approvalBody(ctx,false)},async execute(ctx){const body=approvalBody(ctx,false);const result=await approveApprovalTask(body);return{ok:true,data:sanitized(result),message:`Rejected approval task ${body.taskId}`}},async dryRun(ctx){const body=approvalBody(ctx,false);return buildDryRun("POST","/client/flow/approve").body(sanitized(body)).description("Preview: reject an approval task").build()}};const approvalTransfer={service:"approval",command:"transfer",
7
+ description:"Transfer a pending Runtime task to an allowed user",risk:"high-risk-write",confirmationDescription:"Transfers the pending Runtime task to the selected eligible user. The current handler may lose permission to process the task.",requiresAppCode:false,flags:[APP_CODE_FLAG,TASK_ID_FLAG,TARGET_USER_ID_FLAG,COMMENT_FLAG],async validate(ctx){transferBody(ctx)},async execute(ctx){const body=transferBody(ctx);const result=await transferApprovalTask(body);return{ok:true,data:sanitized(result),message:`Transferred approval task ${body.taskId}`}},async dryRun(ctx){const body=transferBody(ctx);return buildDryRun("POST","/client/flow/task/transfer").body(sanitized(body)).description("Preview: transfer an approval task").build()}};export const approvalDefinitions=[approvalTodo,approvalTaskDetail,approvalApprove,approvalReject,approvalTransfer];export{approvalApprove,approvalReject,approvalTaskDetail,approvalTodo,approvalTransfer};
@@ -1 +1,11 @@
1
- const a11_0x39cebc=a11_0x2370;(function(_0x24ec1e,_0x5ecb03){const _0x2ba0f1=a11_0x2370,_0x371c02=_0x24ec1e();while(!![]){try{const _0x57925a=parseInt(_0x2ba0f1(0x135))/0x1+-parseInt(_0x2ba0f1(0x103))/0x2+parseInt(_0x2ba0f1(0x148))/0x3*(-parseInt(_0x2ba0f1(0x118))/0x4)+parseInt(_0x2ba0f1(0x120))/0x5+-parseInt(_0x2ba0f1(0xfc))/0x6+parseInt(_0x2ba0f1(0x10f))/0x7*(-parseInt(_0x2ba0f1(0x153))/0x8)+parseInt(_0x2ba0f1(0xfa))/0x9;if(_0x57925a===_0x5ecb03)break;else _0x371c02['push'](_0x371c02['shift']());}catch(_0x3f7ad3){_0x371c02['push'](_0x371c02['shift']());}}}(a11_0x1abf,0x390a8));import{existsSync,readFileSync,statSync}from'node:fs';function a11_0x2370(_0x354e9b,_0x2e362f){_0x354e9b=_0x354e9b-0xfa;const _0x1abf73=a11_0x1abf();let _0x237066=_0x1abf73[_0x354e9b];return _0x237066;}import{createRuntimeArtifact,getRuntimeArtifact,listRuntimeArtifacts,updateRuntimeArtifact}from'../../core/api-client.js';import{ID_FLAG,VERBOSE_FLAG}from'../../commands/common/flags.js';import{CliErrors}from'../../errors.js';import{dryRun}from'../../framework/dryrun.js';const ARTIFACT_TYPE_REACT_MODULE=a11_0x39cebc(0x121),ARTIFACT_TYPE_REACT_PAGE=a11_0x39cebc(0x115),ARTIFACT_SOURCE_AGENT=a11_0x39cebc(0x129),SUPPORTED_ARTIFACT_TYPES=[ARTIFACT_TYPE_REACT_MODULE,ARTIFACT_TYPE_REACT_PAGE],ALLOWED_REACT_MODULE_IMPORTS=['react',a11_0x39cebc(0x14c),'lodash',a11_0x39cebc(0x125),a11_0x39cebc(0x146),'@ant-design/icons'];export const ALLOWED_REACT_MODULE_IMPORTS_TEXT=ALLOWED_REACT_MODULE_IMPORTS['join'](',\x20');const IMPORT_SOURCE_PATTERNS=[/\bimport\s+(?:type\s+)?(?:[^'";]*?\s+from\s+)?["']([^"']+)["']/g,/\bexport\s+(?:type\s+)?[^'";]*?\s+from\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g],PAGE_LEVEL_PATTERNS=[/<!doctype\s+html/i,/<\s*html\b/i,/\bcreateRoot\s*\(/,/\bReactDOM\s*\.\s*render\s*\(/,/\bReactDOM\s*\.\s*createRoot\s*\(/],FILE_FLAG={'name':'file','type':a11_0x39cebc(0x13c),'required':!![],'description':a11_0x39cebc(0x12c)},OPTIONAL_FILE_FLAG={...FILE_FLAG,'required':![],'description':a11_0x39cebc(0x147)},TYPE_FLAG={'name':a11_0x39cebc(0x127),'type':a11_0x39cebc(0x13c),'description':a11_0x39cebc(0x144)},CREATE_TYPE_FLAG={...TYPE_FLAG,'required':!![]},ARTIFACT_NAME_MAX_LENGTH=0xc8,ARTIFACT_NAME_FLAG={'name':a11_0x39cebc(0x13d),'type':a11_0x39cebc(0x13c),'description':a11_0x39cebc(0x11b)+ARTIFACT_NAME_MAX_LENGTH+'\x20characters)'},METADATA_FLAG={'name':a11_0x39cebc(0x11a),'type':a11_0x39cebc(0x13c),'description':'Artifact\x20metadata\x20as\x20JSON\x20object;\x20compiledContent\x20is\x20stripped'};function isPlainObject(_0x10b729){const _0x41ebe3=a11_0x39cebc;return typeof _0x10b729===_0x41ebe3(0x142)&&_0x10b729!==null&&!Array[_0x41ebe3(0x107)](_0x10b729);}function optionalArtifactType(_0x3a5c1c){const _0x592b3e=a11_0x39cebc,_0x1d42ad=(_0x3a5c1c??'')[_0x592b3e(0x117)]();if(!_0x1d42ad)return undefined;if(!SUPPORTED_ARTIFACT_TYPES[_0x592b3e(0x150)](_0x1d42ad))throw CliErrors[_0x592b3e(0x122)](_0x592b3e(0x10a)+SUPPORTED_ARTIFACT_TYPES[_0x592b3e(0x149)](',\x20')+'.\x20Received:\x20'+_0x1d42ad);return _0x1d42ad;}function requireArtifactType(_0x594fa1){const _0x4403d3=a11_0x39cebc,_0x4ab324=optionalArtifactType(_0x594fa1);if(!_0x4ab324)throw CliErrors[_0x4403d3(0x122)](_0x4403d3(0xfb)+SUPPORTED_ARTIFACT_TYPES[_0x4403d3(0x149)](',\x20'));return _0x4ab324;}function normalizeExistingArtifactType(_0x520e66,_0x12a4b1){const _0x1ccf44=a11_0x39cebc,_0x3a6d70=(_0x520e66??'')['trim']();if(!SUPPORTED_ARTIFACT_TYPES['includes'](_0x3a6d70))throw CliErrors[_0x1ccf44(0x122)](_0x1ccf44(0x134)+_0x12a4b1+_0x1ccf44(0x14d)+(_0x3a6d70?'\x22'+_0x3a6d70+'\x22':_0x1ccf44(0x10c))+_0x1ccf44(0x102)+SUPPORTED_ARTIFACT_TYPES[_0x1ccf44(0x149)](',\x20')+_0x1ccf44(0x109));return _0x3a6d70;}function readSourceText(_0x5b4fe6){const _0x4149cd=a11_0x39cebc;if(!_0x5b4fe6)throw CliErrors[_0x4149cd(0x122)](_0x4149cd(0x155));if(!existsSync(_0x5b4fe6))throw CliErrors['validation'](_0x4149cd(0x116)+_0x5b4fe6);if(!statSync(_0x5b4fe6)[_0x4149cd(0x138)]())throw CliErrors[_0x4149cd(0x122)](_0x4149cd(0x113)+_0x5b4fe6);return readFileSync(_0x5b4fe6,_0x4149cd(0x11f));}function readSourceFile(_0x53ce4b,_0x577ddd){const _0x2b3ea9=readSourceText(_0x53ce4b);return validateArtifactSource(_0x2b3ea9,_0x577ddd),_0x2b3ea9;}function parseMetadata(_0x80dc21){const _0x58670d=a11_0x39cebc;if(!_0x80dc21)return undefined;let _0x40a961;try{_0x40a961=JSON[_0x58670d(0x133)](_0x80dc21);}catch{throw CliErrors[_0x58670d(0x122)](_0x58670d(0x10e)+_0x80dc21);}if(!isPlainObject(_0x40a961))throw CliErrors[_0x58670d(0x122)]('--metadata\x20must\x20be\x20a\x20JSON\x20object.');const _0x168ecd={..._0x40a961};return delete _0x168ecd['compiledContent'],_0x168ecd;}function getPackageName(_0x5b9318){const _0x3e342e=a11_0x39cebc;if(_0x5b9318['startsWith']('@')){const [_0x351ff1,_0xeea4a3]=_0x5b9318['split']('/');return _0x351ff1&&_0xeea4a3?_0x351ff1+'/'+_0xeea4a3:_0x5b9318;}return _0x5b9318[_0x3e342e(0x13f)]('/')[0x0]||_0x5b9318;}function validateAllowedImports(_0x118454,_0x52b3bf){const _0x17b11a=a11_0x39cebc,_0x4674fc=new Set();for(const _0x420c43 of IMPORT_SOURCE_PATTERNS){_0x420c43['lastIndex']=0x0;let _0x2727d2;while((_0x2727d2=_0x420c43['exec'](_0x118454))!==null){const _0x47d1e9=_0x2727d2[0x1]?.['trim']();_0x47d1e9&&_0x4674fc['add'](_0x47d1e9);}}const _0x3694d8=[..._0x4674fc][_0x17b11a(0xfd)](getPackageName)[_0x17b11a(0x128)](_0x2f0082=>!ALLOWED_REACT_MODULE_IMPORTS[_0x17b11a(0x150)](_0x2f0082));if(_0x3694d8[_0x17b11a(0x13b)]>0x0)throw CliErrors[_0x17b11a(0x122)]((_0x52b3bf??_0x17b11a(0x108))+_0x17b11a(0x12f)+ALLOWED_REACT_MODULE_IMPORTS_TEXT+'.\x20Unsupported:\x20'+[...new Set(_0x3694d8)][_0x17b11a(0x149)](',\x20'));}export function validateArtifactSource(_0x580fe0,_0x2718ce){const _0x4b79bc=a11_0x39cebc;if(!_0x580fe0[_0x4b79bc(0x117)]())throw CliErrors[_0x4b79bc(0x122)](_0x4b79bc(0x14f));if(_0x2718ce===ARTIFACT_TYPE_REACT_MODULE&&PAGE_LEVEL_PATTERNS[_0x4b79bc(0x130)](_0x57b0f7=>_0x57b0f7[_0x4b79bc(0x13a)](_0x580fe0)))throw CliErrors['validation'](_0x4b79bc(0x136));validateAllowedImports(_0x580fe0,_0x2718ce);}export function validateReactModuleSource(_0x533967){validateArtifactSource(_0x533967,ARTIFACT_TYPE_REACT_MODULE);}function buildCreateInput(_0x29ab33){const _0x5e68e1=a11_0x39cebc,_0x3452f7=requireArtifactType(_0x29ab33[_0x5e68e1(0x151)](_0x5e68e1(0x127))),_0x3cb797=readSourceFile(_0x29ab33[_0x5e68e1(0x151)](_0x5e68e1(0x100)),_0x3452f7),_0x30cdb3=_0x29ab33[_0x5e68e1(0x151)](_0x5e68e1(0x13d))[_0x5e68e1(0x117)](),_0x3dcc56=parseMetadata(_0x29ab33[_0x5e68e1(0x151)](_0x5e68e1(0x11a)));return{'artifactType':_0x3452f7,..._0x30cdb3?{'name':_0x30cdb3}:{},'content':_0x3cb797,..._0x3dcc56?{'metadata':_0x3dcc56}:{},'source':ARTIFACT_SOURCE_AGENT};}function summarizeArtifact(_0x5f5f76){const _0x499fa2=a11_0x39cebc;return{'id':_0x5f5f76['id'],'name':_0x5f5f76[_0x499fa2(0x13d)],'artifactType':_0x5f5f76[_0x499fa2(0x139)],'source':_0x5f5f76[_0x499fa2(0x12e)],'favorite':_0x5f5f76[_0x499fa2(0x152)],'deleted':_0x5f5f76['deleted'],'createTime':_0x5f5f76['createTime'],'updateTime':_0x5f5f76['updateTime']};}function detailArtifact(_0x21c525){const _0x9cfd00=a11_0x39cebc;return{'id':_0x21c525['id'],'appCode':_0x21c525[_0x9cfd00(0x12d)],'name':_0x21c525['name'],'artifactType':_0x21c525['artifactType'],'source':_0x21c525[_0x9cfd00(0x12e)],'favorite':_0x21c525[_0x9cfd00(0x152)],'deleted':_0x21c525[_0x9cfd00(0x14e)],'content':_0x21c525[_0x9cfd00(0x123)]??'','compiledContent':_0x21c525[_0x9cfd00(0x12b)],'metadata':_0x21c525[_0x9cfd00(0x11a)]??{},'createTime':_0x21c525['createTime'],'updateTime':_0x21c525[_0x9cfd00(0x14b)]};}function readFavoriteFlag(_0x3e3084){const _0x3213e4=a11_0x39cebc,_0x1c27bd=_0x3e3084['flag']('favorite');return _0x1c27bd===undefined||_0x1c27bd===null||_0x1c27bd===''?undefined:_0x3e3084[_0x3213e4(0x119)](_0x3213e4(0x152));}function a11_0x1abf(){const _0x5de343=['deleted','Artifact\x20source\x20file\x20is\x20blank.','includes','str','favorite','12328EHOunr','body','File\x20path\x20is\x20required.','6665634jJkRXx','--type\x20is\x20required.\x20Allowed\x20values:\x20','1240764TbXXpJ','map','verbose','boolean','file','num',';\x20supported\x20types:\x20','172586VvCTRn','Artifact\x20ID','/client/artifact/create','keys','isArray','Artifact','.\x20Pass\x20--type\x20explicitly\x20to\x20change\x20it.','--type\x20must\x20be\x20one\x20of:\x20','/update','(empty)','build','Invalid\x20JSON\x20for\x20--metadata:\x20','1631vzOEpC','POST','Preview:\x20update\x20Artifact\x20','/client/artifact/','File\x20is\x20not\x20a\x20regular\x20file:\x20','List\x20current-app\x20Artifacts\x20of\x20all\x20types','react_page','File\x20not\x20found:\x20','trim','4eOWHSS','bool','metadata','Artifact\x20display\x20name\x20in\x20the\x20user\x27s\x20preferred\x20language\x20(server\x20limit:\x20','Created\x20Artifact\x20','Preview:\x20create\x20','\x20unchanged','utf8','78130HfOaij','react_module','validation','content','create','dayjs','\x20has\x20no\x20source\x20content;\x20pass\x20--file\x20to\x20set\x20it.','type','filter','AGENT','read','compiledContent','Path\x20to\x20a\x20local\x20UTF-8\x20Artifact\x20source\x20file','appCode','source','\x20imports\x20are\x20limited\x20to:\x20','some','Updated\x20Artifact\x20','Create\x20an\x20Artifact\x20from\x20a\x20local\x20source\x20file','parse','Artifact\x20','280962QDaMIG','react_module\x20must\x20be\x20an\x20embeddable\x20React\x20module,\x20not\x20full\x20HTML\x20or\x20a\x20ReactDOM/createRoot\x20mount\x20entry.\x20Use\x20--type\x20react_page\x20for\x20a\x20page\x20entry.','Optional\x20favorite-state\x20filter','isFile','artifactType','test','length','string','name','artifact','split',';\x20omitted\x20artifactType,\x20content,\x20name\x20and\x20metadata\x20are\x20inherited\x20from\x20the\x20current\x20Artifact','list','object','detail','Artifact\x20type:\x20react_module\x20or\x20react_page','description','antd','Path\x20to\x20a\x20local\x20UTF-8\x20Artifact\x20source\x20file;\x20omit\x20to\x20keep\x20current\x20content','454302sQNQjn','join','Update\x20an\x20Artifact\x20by\x20id;\x20omitted\x20fields\x20keep\x20current\x20values','updateTime','react-dom','\x20has\x20unsupported\x20type\x20'];a11_0x1abf=function(){return _0x5de343;};return a11_0x1abf();}const artifactList={'service':'artifact','command':a11_0x39cebc(0x141),'description':a11_0x39cebc(0x114),'risk':'read','flags':[TYPE_FLAG,{'name':'source','type':a11_0x39cebc(0x13c),'description':'Optional\x20source\x20filter,\x20for\x20example\x20AGENT'},{'name':'favorite','type':a11_0x39cebc(0xff),'description':a11_0x39cebc(0x137)},VERBOSE_FLAG],async 'execute'(_0x5e6947){const _0x3d760e=a11_0x39cebc,_0xff4ce3=optionalArtifactType(_0x5e6947['str'](_0x3d760e(0x127))),_0x139f2d=await listRuntimeArtifacts(_0x5e6947[_0x3d760e(0x12d)],{..._0xff4ce3?{'artifactType':_0xff4ce3}:{},..._0x5e6947[_0x3d760e(0x151)]('source')?{'source':_0x5e6947[_0x3d760e(0x151)]('source')}:{},...readFavoriteFlag(_0x5e6947)!==undefined?{'favorite':readFavoriteFlag(_0x5e6947)}:{}});return{'ok':!![],'data':{'total':_0x139f2d[_0x3d760e(0x13b)],'items':_0x5e6947[_0x3d760e(0x119)](_0x3d760e(0xfe))?_0x139f2d:_0x139f2d[_0x3d760e(0xfd)](summarizeArtifact)}};}},artifactDetail={'service':a11_0x39cebc(0x13e),'command':a11_0x39cebc(0x143),'description':'Show\x20one\x20Artifact\x20by\x20id','risk':a11_0x39cebc(0x12a),'flags':[{...ID_FLAG,'description':a11_0x39cebc(0x104)}],async 'execute'(_0x489d63){const _0x4bd534=a11_0x39cebc,_0x2fcbae=await getRuntimeArtifact(_0x489d63['num']('id'),_0x489d63[_0x4bd534(0x12d)]);return{'ok':!![],'data':detailArtifact(_0x2fcbae)};}},artifactCreate={'service':a11_0x39cebc(0x13e),'command':a11_0x39cebc(0x124),'description':a11_0x39cebc(0x132),'risk':a11_0x39cebc(0x12a),'flags':[CREATE_TYPE_FLAG,FILE_FLAG,ARTIFACT_NAME_FLAG,METADATA_FLAG],async 'execute'(_0x483c3d){const _0x14f0dc=a11_0x39cebc,_0x528578=buildCreateInput(_0x483c3d),_0x58a717=await createRuntimeArtifact(_0x483c3d['appCode'],_0x528578);return{'ok':!![],'data':detailArtifact(_0x58a717),'message':_0x14f0dc(0x11c)+_0x58a717['id']+(_0x58a717[_0x14f0dc(0x13d)]?'\x20('+_0x58a717[_0x14f0dc(0x13d)]+')':'')};},async 'dryRun'(_0x125100){const _0x354b9e=a11_0x39cebc,_0x1cf784=buildCreateInput(_0x125100);return dryRun('POST',_0x354b9e(0x105))[_0x354b9e(0x154)]({'appCode':_0x125100[_0x354b9e(0x12d)],..._0x1cf784})[_0x354b9e(0x145)](_0x354b9e(0x11d)+_0x1cf784['artifactType']+'\x20Artifact')[_0x354b9e(0x10d)]();}},artifactUpdate={'service':a11_0x39cebc(0x13e),'command':'update','description':a11_0x39cebc(0x14a),'risk':a11_0x39cebc(0x12a),'flags':[{...ID_FLAG,'description':'Artifact\x20ID'},TYPE_FLAG,OPTIONAL_FILE_FLAG,ARTIFACT_NAME_FLAG,METADATA_FLAG],async 'execute'(_0x373db8){const _0x187b3c=a11_0x39cebc,_0x1d1d7e=_0x373db8[_0x187b3c(0x101)]('id'),_0x3884ad=optionalArtifactType(_0x373db8[_0x187b3c(0x151)]('type')),_0x57c4db=_0x373db8[_0x187b3c(0x151)](_0x187b3c(0x100))[_0x187b3c(0x117)](),_0x13f06a=_0x57c4db?readSourceText(_0x57c4db):undefined,_0x54df3f=_0x373db8[_0x187b3c(0x151)]('name')[_0x187b3c(0x117)](),_0x5be8b5=parseMetadata(_0x373db8[_0x187b3c(0x151)](_0x187b3c(0x11a))),_0x27d778=await getRuntimeArtifact(_0x1d1d7e,_0x373db8[_0x187b3c(0x12d)]);if(_0x13f06a===undefined&&!_0x3884ad&&!_0x54df3f&&!_0x5be8b5)return{'ok':!![],'data':detailArtifact(_0x27d778),'message':_0x187b3c(0x134)+_0x1d1d7e+_0x187b3c(0x11e)};const _0x3abdec=_0x3884ad??normalizeExistingArtifactType(_0x27d778[_0x187b3c(0x139)],_0x1d1d7e);_0x13f06a!==undefined&&validateArtifactSource(_0x13f06a,_0x3abdec);const _0x2f3ae7=_0x13f06a??_0x27d778[_0x187b3c(0x123)];if(!_0x2f3ae7||!_0x2f3ae7[_0x187b3c(0x117)]())throw CliErrors[_0x187b3c(0x122)](_0x187b3c(0x134)+_0x1d1d7e+_0x187b3c(0x126));const _0x46c4ed=_0x5be8b5??(isPlainObject(_0x27d778['metadata'])?_0x27d778[_0x187b3c(0x11a)]:undefined),_0x4e0aca={'artifactType':_0x3abdec,'content':_0x2f3ae7,'source':ARTIFACT_SOURCE_AGENT,..._0x54df3f?{'name':_0x54df3f}:_0x27d778[_0x187b3c(0x13d)]?{'name':_0x27d778[_0x187b3c(0x13d)]}:{},..._0x46c4ed&&Object[_0x187b3c(0x106)](_0x46c4ed)[_0x187b3c(0x13b)]>0x0?{'metadata':_0x46c4ed}:{}},_0x5c80d7=await updateRuntimeArtifact(_0x1d1d7e,_0x373db8['appCode'],_0x4e0aca);return{'ok':!![],'data':detailArtifact(_0x5c80d7),'message':_0x187b3c(0x131)+_0x5c80d7['id']+(_0x5c80d7[_0x187b3c(0x13d)]?'\x20('+_0x5c80d7['name']+')':'')};},async 'dryRun'(_0x5a2947){const _0x472fb1=a11_0x39cebc,_0x1b6355=_0x5a2947[_0x472fb1(0x101)]('id'),_0x34c769=optionalArtifactType(_0x5a2947[_0x472fb1(0x151)](_0x472fb1(0x127))),_0x411ec3=_0x5a2947[_0x472fb1(0x151)](_0x472fb1(0x100))['trim'](),_0x59e6db=_0x411ec3?readSourceText(_0x411ec3):undefined;_0x59e6db!==undefined&&validateArtifactSource(_0x59e6db,_0x34c769);const _0x2bb3a6=_0x5a2947[_0x472fb1(0x151)](_0x472fb1(0x13d))[_0x472fb1(0x117)](),_0x4f3083=parseMetadata(_0x5a2947[_0x472fb1(0x151)]('metadata'));return dryRun(_0x472fb1(0x110),_0x472fb1(0x112)+_0x1b6355+_0x472fb1(0x10b))['body']({'appCode':_0x5a2947[_0x472fb1(0x12d)],..._0x34c769?{'artifactType':_0x34c769}:{},..._0x2bb3a6?{'name':_0x2bb3a6}:{},..._0x59e6db!==undefined?{'content':_0x59e6db}:{},..._0x4f3083?{'metadata':_0x4f3083}:{},'source':ARTIFACT_SOURCE_AGENT})['description'](_0x472fb1(0x111)+_0x1b6355+_0x472fb1(0x140))[_0x472fb1(0x10d)]();}};export const artifactDefinitions=[artifactList,artifactDetail,artifactCreate,artifactUpdate];
1
+ import{existsSync,readFileSync,statSync}from"node:fs";import{createRuntimeArtifact,getRuntimeArtifact,listRuntimeArtifacts,updateRuntimeArtifact}from"../../core/api-client.js";import{ID_FLAG,VERBOSE_FLAG}from"../../commands/common/flags.js";import{CliErrors}from"../../errors.js";import{dryRun}from"../../framework/dryrun.js";const ARTIFACT_TYPE_REACT_MODULE="react_module";const ARTIFACT_TYPE_REACT_PAGE="react_page";const ARTIFACT_SOURCE_AGENT="AGENT";const SUPPORTED_ARTIFACT_TYPES=[ARTIFACT_TYPE_REACT_MODULE,ARTIFACT_TYPE_REACT_PAGE];const ALLOWED_REACT_MODULE_IMPORTS=["react","react-dom","lodash","dayjs","antd","@ant-design/icons"];export const ALLOWED_REACT_MODULE_IMPORTS_TEXT=ALLOWED_REACT_MODULE_IMPORTS.join(", ");const IMPORT_SOURCE_PATTERNS=[/\bimport\s+(?:type\s+)?(?:[^'";]*?\s+from\s+)?["']([^"']+)["']/g,/\bexport\s+(?:type\s+)?[^'";]*?\s+from\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g]
2
+ ;const PAGE_LEVEL_PATTERNS=[/<!doctype\s+html/i,/<\s*html\b/i,/\bcreateRoot\s*\(/,/\bReactDOM\s*\.\s*render\s*\(/,/\bReactDOM\s*\.\s*createRoot\s*\(/];const FILE_FLAG={name:"file",type:"string",required:true,description:"Path to a local UTF-8 Artifact source file"};const OPTIONAL_FILE_FLAG={...FILE_FLAG,required:false,description:"Path to a local UTF-8 Artifact source file; omit to keep current content"};const TYPE_FLAG={name:"type",type:"string",description:"Artifact type: react_module or react_page"};const CREATE_TYPE_FLAG={...TYPE_FLAG,required:true};const ARTIFACT_NAME_MAX_LENGTH=200;const ARTIFACT_NAME_FLAG={name:"name",type:"string",description:`Artifact display name in the user's preferred language (server limit: ${ARTIFACT_NAME_MAX_LENGTH} characters)`};const METADATA_FLAG={name:"metadata",type:"string",description:"Artifact metadata as JSON object; compiledContent is stripped"};function isPlainObject(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}
3
+ function optionalArtifactType(raw){const value=(raw??"").trim();if(!value){return undefined}if(!SUPPORTED_ARTIFACT_TYPES.includes(value)){throw CliErrors.validation(`--type must be one of: ${SUPPORTED_ARTIFACT_TYPES.join(", ")}. Received: ${value}`)}return value}function requireArtifactType(raw){const artifactType=optionalArtifactType(raw);if(!artifactType){throw CliErrors.validation(`--type is required. Allowed values: ${SUPPORTED_ARTIFACT_TYPES.join(", ")}`)}return artifactType}function normalizeExistingArtifactType(raw,id){const value=(raw??"").trim();if(!SUPPORTED_ARTIFACT_TYPES.includes(value)){throw CliErrors.validation(`Artifact ${id} has unsupported type ${value?`"${value}"`:"(empty)"}; supported types: ${SUPPORTED_ARTIFACT_TYPES.join(", ")}. Pass --type explicitly to change it.`)}return value}function readSourceText(path){if(!path){throw CliErrors.validation("File path is required.")}if(!existsSync(path)){throw CliErrors.validation(`File not found: ${path}`)}
4
+ if(!statSync(path).isFile()){throw CliErrors.validation(`File is not a regular file: ${path}`)}return readFileSync(path,"utf8")}function readSourceFile(path,artifactType){const content=readSourceText(path);validateArtifactSource(content,artifactType);return content}function parseMetadata(metadata){if(!metadata){return undefined}let parsed;try{parsed=JSON.parse(metadata)}catch{throw CliErrors.validation(`Invalid JSON for --metadata: ${metadata}`)}if(!isPlainObject(parsed)){throw CliErrors.validation("--metadata must be a JSON object.")}const sanitized={...parsed};delete sanitized.compiledContent;return sanitized}function getPackageName(importSource){if(importSource.startsWith("@")){const[scope,name]=importSource.split("/");return scope&&name?`${scope}/${name}`:importSource}return importSource.split("/")[0]||importSource}function validateAllowedImports(content,artifactType){const imports=new Set;for(const pattern of IMPORT_SOURCE_PATTERNS){pattern.lastIndex=0;let match
5
+ ;while((match=pattern.exec(content))!==null){const source=match[1]?.trim();if(source){imports.add(source)}}}const unsupported=[...imports].map(getPackageName).filter(pkg=>!ALLOWED_REACT_MODULE_IMPORTS.includes(pkg));if(unsupported.length>0){throw CliErrors.validation(`${artifactType??"Artifact"} imports are limited to: ${ALLOWED_REACT_MODULE_IMPORTS_TEXT}. Unsupported: ${[...new Set(unsupported)].join(", ")}`)}}export function validateArtifactSource(content,artifactType){if(!content.trim()){throw CliErrors.validation("Artifact source file is blank.")}if(artifactType===ARTIFACT_TYPE_REACT_MODULE&&PAGE_LEVEL_PATTERNS.some(pattern=>pattern.test(content))){throw CliErrors.validation("react_module must be an embeddable React module, not full HTML or a ReactDOM/createRoot mount entry. Use --type react_page for a page entry.")}validateAllowedImports(content,artifactType)}export function validateReactModuleSource(content){validateArtifactSource(content,ARTIFACT_TYPE_REACT_MODULE)}
6
+ function buildCreateInput(ctx){const artifactType=requireArtifactType(ctx.str("type"));const content=readSourceFile(ctx.str("file"),artifactType);const name=ctx.str("name").trim();const metadata=parseMetadata(ctx.str("metadata"));return{artifactType:artifactType,...name?{name:name}:{},content:content,...metadata?{metadata:metadata}:{},source:ARTIFACT_SOURCE_AGENT}}function summarizeArtifact(item){return{id:item.id,name:item.name,artifactType:item.artifactType,source:item.source,favorite:item.favorite,deleted:item.deleted,createTime:item.createTime,updateTime:item.updateTime}}function detailArtifact(item){return{id:item.id,appCode:item.appCode,name:item.name,artifactType:item.artifactType,source:item.source,favorite:item.favorite,deleted:item.deleted,content:item.content??"",compiledContent:item.compiledContent,metadata:item.metadata??{},createTime:item.createTime,updateTime:item.updateTime}}function readFavoriteFlag(ctx){const value=ctx.flag("favorite")
7
+ ;return value===undefined||value===null||value===""?undefined:ctx.bool("favorite")}const artifactList={service:"artifact",command:"list",description:"List current-app Artifacts of all types",risk:"read",flags:[TYPE_FLAG,{name:"source",type:"string",description:"Optional source filter, for example AGENT"},{name:"favorite",type:"boolean",description:"Optional favorite-state filter"},VERBOSE_FLAG],async execute(ctx){const artifactType=optionalArtifactType(ctx.str("type"));const items=await listRuntimeArtifacts(ctx.appCode,{...artifactType?{artifactType:artifactType}:{},...ctx.str("source")?{source:ctx.str("source")}:{},...readFavoriteFlag(ctx)!==undefined?{favorite:readFavoriteFlag(ctx)}:{}});return{ok:true,data:{total:items.length,items:ctx.bool("verbose")?items:items.map(summarizeArtifact)}}}};const artifactDetail={service:"artifact",command:"detail",description:"Show one Artifact by id",risk:"read",flags:[{...ID_FLAG,description:"Artifact ID"}],async execute(ctx){
8
+ const item=await getRuntimeArtifact(ctx.num("id"),ctx.appCode);return{ok:true,data:detailArtifact(item)}}};const artifactCreate={service:"artifact",command:"create",description:"Create an Artifact from a local source file",risk:"read",flags:[CREATE_TYPE_FLAG,FILE_FLAG,ARTIFACT_NAME_FLAG,METADATA_FLAG],async execute(ctx){const input=buildCreateInput(ctx);const item=await createRuntimeArtifact(ctx.appCode,input);return{ok:true,data:detailArtifact(item),message:`Created Artifact ${item.id}${item.name?` (${item.name})`:""}`}},async dryRun(ctx){const input=buildCreateInput(ctx);return dryRun("POST","/client/artifact/create").body({appCode:ctx.appCode,...input}).description(`Preview: create ${input.artifactType} Artifact`).build()}};const artifactUpdate={service:"artifact",command:"update",description:"Update an Artifact by id; omitted fields keep current values",risk:"read",flags:[{...ID_FLAG,description:"Artifact ID"},TYPE_FLAG,OPTIONAL_FILE_FLAG,ARTIFACT_NAME_FLAG,METADATA_FLAG],
9
+ async execute(ctx){const id=ctx.num("id");const requestedType=optionalArtifactType(ctx.str("type"));const filePath=ctx.str("file").trim();const fileContent=filePath?readSourceText(filePath):undefined;const name=ctx.str("name").trim();const metadata=parseMetadata(ctx.str("metadata"));const existing=await getRuntimeArtifact(id,ctx.appCode);if(fileContent===undefined&&!requestedType&&!name&&!metadata){return{ok:true,data:detailArtifact(existing),message:`Artifact ${id} unchanged`}}const artifactType=requestedType??normalizeExistingArtifactType(existing.artifactType,id);if(fileContent!==undefined){validateArtifactSource(fileContent,artifactType)}const content=fileContent??existing.content;if(!content||!content.trim()){throw CliErrors.validation(`Artifact ${id} has no source content; pass --file to set it.`)}const mergedMetadata=metadata??(isPlainObject(existing.metadata)?existing.metadata:undefined);const input={artifactType:artifactType,content:content,source:ARTIFACT_SOURCE_AGENT,
10
+ ...name?{name:name}:existing.name?{name:existing.name}:{},...mergedMetadata&&Object.keys(mergedMetadata).length>0?{metadata:mergedMetadata}:{}};const item=await updateRuntimeArtifact(id,ctx.appCode,input);return{ok:true,data:detailArtifact(item),message:`Updated Artifact ${item.id}${item.name?` (${item.name})`:""}`}},async dryRun(ctx){const id=ctx.num("id");const requestedType=optionalArtifactType(ctx.str("type"));const filePath=ctx.str("file").trim();const fileContent=filePath?readSourceText(filePath):undefined;if(fileContent!==undefined){validateArtifactSource(fileContent,requestedType)}const name=ctx.str("name").trim();const metadata=parseMetadata(ctx.str("metadata"));return dryRun("POST",`/client/artifact/${id}/update`).body({appCode:ctx.appCode,...requestedType?{artifactType:requestedType}:{},...name?{name:name}:{},...fileContent!==undefined?{content:fileContent}:{},...metadata?{metadata:metadata}:{},source:ARTIFACT_SOURCE_AGENT
11
+ }).description(`Preview: update Artifact ${id}; omitted artifactType, content, name and metadata are inherited from the current Artifact`).build()}};export const artifactDefinitions=[artifactList,artifactDetail,artifactCreate,artifactUpdate];
@@ -1 +1,8 @@
1
- function a12_0x327b(_0x5154ec,_0x1683fa){_0x5154ec=_0x5154ec-0x158;const _0x384f47=a12_0x384f();let _0x327b62=_0x384f47[_0x5154ec];return _0x327b62;}const a12_0x11f068=a12_0x327b;(function(_0x2430ac,_0x73cb6e){const _0x4e0c77=a12_0x327b,_0x51674b=_0x2430ac();while(!![]){try{const _0x3e3992=-parseInt(_0x4e0c77(0x195))/0x1*(parseInt(_0x4e0c77(0x18e))/0x2)+parseInt(_0x4e0c77(0x17c))/0x3*(-parseInt(_0x4e0c77(0x18a))/0x4)+parseInt(_0x4e0c77(0x184))/0x5+-parseInt(_0x4e0c77(0x182))/0x6*(-parseInt(_0x4e0c77(0x176))/0x7)+parseInt(_0x4e0c77(0x173))/0x8*(-parseInt(_0x4e0c77(0x16c))/0x9)+-parseInt(_0x4e0c77(0x1ab))/0xa*(parseInt(_0x4e0c77(0x1a0))/0xb)+parseInt(_0x4e0c77(0x17a))/0xc;if(_0x3e3992===_0x73cb6e)break;else _0x51674b['push'](_0x51674b['shift']());}catch(_0x7a2ce0){_0x51674b['push'](_0x51674b['shift']());}}}(a12_0x384f,0x8f327));import{existsSync,mkdirSync,readFileSync,unlinkSync,writeFileSync}from'node:fs';import{dirname}from'node:path';import{homedir}from'node:os';import{readScopedConfig,writeScopedConfig}from'../../context.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{PRODUCT_CONFIG}from'../../constant/product.js';import{getUserDomain}from'../../constant/domain.js';import{CliErrors}from'../../errors.js';import{resolveConfigScope,toScopeFlags}from'../../commands/common/config-policy.js';import{writeCliSideChannelLine}from'../../utils/write-cli-side-channel.js';function resolveAuthScopeFlags(_0x1be922){const _0x2f517c=a12_0x327b;return toScopeFlags(resolveConfigScope({'explicitGlobal':_0x1be922[_0x2f517c(0x179)](_0x2f517c(0x1a2)),'explicitProject':_0x1be922[_0x2f517c(0x179)](_0x2f517c(0x196)),'policy':_0x2f517c(0x170)}));}const ACCESS_KEY_PATTERN=/^ak_[A-Za-z0-9]{16,}$/,DEVICE_CODE_TTL_MS=0x927c0,POLL_INTERVAL_MS=0xbb8,MAX_POLLS=0xc8,MAX_CONSECUTIVE_NETWORK_ERRORS=0x5;export function generateDeviceCode(){return crypto['randomUUID']();}export function buildDeviceAuthUrl(_0x1435e4,_0x55b03b,_0x3daa71='lovrabet-cli'){const _0x3c276b=a12_0x327b;return _0x1435e4+_0x3c276b(0x19c)+encodeURIComponent(_0x55b03b)+_0x3c276b(0x18c)+encodeURIComponent(_0x3daa71);}export function getDeviceCodePath(){const _0x28b750=a12_0x327b;return homedir()+'/'+PRODUCT_CONFIG[_0x28b750(0x197)]+'/.device-auth';}export function readStoredDeviceCode(){const _0x17f558=a12_0x327b,_0x485bdd=getDeviceCodePath();if(!existsSync(_0x485bdd))return null;try{const _0x51cfdc=readFileSync(_0x485bdd,{'encoding':_0x17f558(0x18d)}),_0x3398b5=JSON[_0x17f558(0x190)](_0x51cfdc);if(_0x3398b5&&typeof _0x3398b5[_0x17f558(0x15a)]===_0x17f558(0x191)&&typeof _0x3398b5[_0x17f558(0x19d)]===_0x17f558(0x191)&&(_0x3398b5['scope']==='global'||_0x3398b5[_0x17f558(0x174)]===_0x17f558(0x196)))return _0x3398b5;}catch{}return null;}export function writeStoredDeviceCode(_0x4adf9c,_0x5c13f5){const _0x423b56=a12_0x327b,_0x2e47ce=getDeviceCodePath(),_0x126f18=dirname(_0x2e47ce);!existsSync(_0x126f18)&&mkdirSync(_0x126f18,{'recursive':!![]});const _0x44a27d={'code':_0x4adf9c,'createdAt':new Date()[_0x423b56(0x160)](),'scope':_0x5c13f5};writeFileSync(_0x2e47ce,JSON[_0x423b56(0x185)](_0x44a27d),{'encoding':'utf8','mode':0x180});}export function deleteStoredDeviceCode(){const _0xea8dc8=getDeviceCodePath();try{unlinkSync(_0xea8dc8);}catch{}}export function isStoredDeviceCodeExpired(_0x538add){return Date['now']()-new Date(_0x538add['createdAt'])['getTime']()>DEVICE_CODE_TTL_MS;}export async function fetchDeviceToken(_0x20e8e5,_0x11b756){const _0x2f051e=a12_0x327b,_0x377ae9=_0x20e8e5+_0x2f051e(0x167),_0x2b6491=new AbortController(),_0x490c1c=setTimeout(()=>_0x2b6491['abort'](),0x2710),_0x33302a=await fetch(_0x377ae9,{'method':_0x2f051e(0x169),'headers':{'Content-Type':_0x2f051e(0x1a4)},'body':JSON[_0x2f051e(0x185)]({'code':_0x11b756}),'signal':_0x2b6491[_0x2f051e(0x15d)]});clearTimeout(_0x490c1c);if(!_0x33302a['ok'])throw CliErrors[_0x2f051e(0x178)](_0x2f051e(0x164)+_0x33302a[_0x2f051e(0x19b)]);const _0x21a849=await _0x33302a[_0x2f051e(0x175)](),_0x387df5=_0x21a849['data']&&typeof _0x21a849[_0x2f051e(0x163)]==='object'?_0x21a849[_0x2f051e(0x163)]:_0x21a849;if(!_0x387df5||typeof _0x387df5[_0x2f051e(0x19b)]!==_0x2f051e(0x191))throw CliErrors[_0x2f051e(0x15b)]('Invalid\x20device\x20auth\x20response');return{'status':_0x387df5[_0x2f051e(0x19b)],'access_key':typeof _0x387df5[_0x2f051e(0x15f)]===_0x2f051e(0x191)?_0x387df5['access_key']:undefined};}export async function pollDeviceToken(_0x46aa6d,_0x38323a,_0x4a75fe){const _0x17cbf6=a12_0x327b;let _0x4a15f3=0x0;for(let _0x58d050=0x0;_0x58d050<MAX_POLLS;_0x58d050++){if(_0x4a75fe[_0x17cbf6(0x188)])throw CliErrors['cancelled'](_0x17cbf6(0x17f));let _0x476976;try{_0x476976=await fetchDeviceToken(_0x46aa6d,_0x38323a);}catch(_0x1651f6){if(_0x1651f6 instanceof Error&&_0x1651f6[_0x17cbf6(0x161)]===_0x17cbf6(0x19f))throw CliErrors[_0x17cbf6(0x1aa)]('Device\x20authorization\x20cancelled.');_0x4a15f3++;if(_0x4a15f3>=MAX_CONSECUTIVE_NETWORK_ERRORS)throw CliErrors['networkError'](_0x17cbf6(0x17d));writeCliSideChannelLine(_0x17cbf6(0x1a1)+_0x4a15f3+'/'+MAX_CONSECUTIVE_NETWORK_ERRORS+_0x17cbf6(0x198)),await sleep(POLL_INTERVAL_MS);continue;}_0x4a15f3=0x0;if(_0x476976[_0x17cbf6(0x19b)]===_0x17cbf6(0x18b)){if(!_0x476976[_0x17cbf6(0x15f)])throw CliErrors[_0x17cbf6(0x15b)](_0x17cbf6(0x168));return _0x476976[_0x17cbf6(0x15f)];}if(_0x476976[_0x17cbf6(0x19b)]===_0x17cbf6(0x193)){deleteStoredDeviceCode();throw CliErrors['validation'](_0x17cbf6(0x19a));}const _0x4a8491=(_0x58d050+0x1)*POLL_INTERVAL_MS,_0x756e0e=DEVICE_CODE_TTL_MS-_0x4a8491,_0x163079=Math[_0x17cbf6(0x15e)](_0x756e0e/0xea60),_0x3e7078=Math[_0x17cbf6(0x15e)](_0x756e0e%0xea60/0x3e8);process[_0x17cbf6(0x1a9)][_0x17cbf6(0x19e)](_0x17cbf6(0x158)+_0x163079+':'+String(_0x3e7078)[_0x17cbf6(0x180)](0x2,'0')+_0x17cbf6(0x17e)),await sleep(POLL_INTERVAL_MS);}deleteStoredDeviceCode();throw CliErrors[_0x17cbf6(0x177)](_0x17cbf6(0x16f));}function sleep(_0x3832fc){return new Promise(_0x180a0b=>setTimeout(_0x180a0b,_0x3832fc));}function a12_0x384f(){const _0x230c60=['scope','json','1017723NVyHmh','validation','networkError','bool','28780596XgAiiI','removeListener','6HgMwGS','Device\x20auth\x20API\x20unreachable\x20after\x20multiple\x20retries.','\x20remaining','Device\x20authorization\x20cancelled.','padStart','nonInteractive','6uchvtP','AccessKey\x20saved\x20to\x20','5474125SJHzgO','stringify','Authorize\x20with\x20the\x20device-code\x20flow\x20(complete\x20in\x20the\x20browser;\x20no\x20copy-paste\x20required)','once','aborted','auth','2291048FXrSkB','success','&source=','utf8','4aLxOgx','trim','parse','string','log','expired','boolean','47537JkSjEI','project','homeDirName','),\x20retrying...','Waiting\x20for\x20authorization\x20(timeout:\x2010\x20minutes,\x20Ctrl+C\x20to\x20cancel)...','Device\x20code\x20expired.\x20Run\x20`lovrabet\x20auth\x20device`\x20to\x20get\x20a\x20new\x20code.','status','/device-auth?code=','createdAt','write','AbortError','4112471zkfqvE','Device\x20auth\x20API\x20error\x20(','global','Device\x20authorization\x20URL\x20printed.\x20Complete\x20authorization\x20in\x20browser,\x20then\x20re-run.','application/json','\x20auth\x20status','test','lovrabet-cli','device','stderr','cancelled','30ItJHDB','\x0dWaiting\x20for\x20authorization...\x20','SIGINT','code','apiError','The\x20device\x20code\x20is\x20valid\x20for\x2010\x20minutes.','signal','floor','access_key','toISOString','name','accessKey','data','Device\x20auth\x20API\x20returned\x20HTTP\x20','Verify:\x20','After\x20authorizing,\x20re-run:\x20','/api/device-auth/token','Invalid\x20access_key\x20returned\x20by\x20server.','POST','App\x20name\x20shown\x20on\x20authorization\x20page\x20(default:\x20lovrabet)','\x20config.','261pcOFdu','url-only','\x20auth\x20device','Device\x20authorization\x20timed\x20out\x20after\x2010\x20minutes.\x20Run\x20`lovrabet\x20auth\x20device`\x20to\x20get\x20a\x20new\x20code.','global-default','str','source','190312uPoYXX'];a12_0x384f=function(){return _0x230c60;};return a12_0x384f();}export const authDeviceDefinition={'service':a12_0x11f068(0x189),'command':a12_0x11f068(0x1a8),'description':a12_0x11f068(0x186),'risk':a12_0x11f068(0x19e),'confirmationDescription':'Starts\x20the\x20device-code\x20login\x20flow.\x20On\x20success,\x20the\x20AccessKey\x20is\x20saved\x20to\x20the\x20selected\x20Lovrabet\x20config.\x20The\x20confirmation\x20UI\x20does\x20not\x20show\x20the\x20device\x20code\x20or\x20secret.','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a12_0x11f068(0x1a2),'type':a12_0x11f068(0x194),'description':'Write\x20to\x20global\x20config\x20(default)','default':!![]},{'name':a12_0x11f068(0x196),'type':a12_0x11f068(0x194),'description':'Write\x20to\x20project\x20config','default':![]},{'name':a12_0x11f068(0x172),'type':a12_0x11f068(0x191),'description':a12_0x11f068(0x16a),'default':a12_0x11f068(0x1a7)},{'name':a12_0x11f068(0x16d),'type':a12_0x11f068(0x194),'description':'Print\x20URL\x20to\x20stdout\x20and\x20exit\x20(for\x20WorkBuddy\x20integration)','default':![]}],async 'execute'(_0x3234c2){const _0x2cbc20=a12_0x11f068,_0x72560=resolveAuthScopeFlags(_0x3234c2),_0x453d21=_0x72560['global']?_0x2cbc20(0x1a2):_0x2cbc20(0x196),_0x42ee49=readScopedConfig(_0x72560);if(_0x42ee49['accessKey'])return{'ok':!![],'message':'Already\x20authorized.\x20Use\x20`lovrabet\x20auth\x20status`\x20to\x20verify.'};const _0x128bc0=(_0x3234c2[_0x2cbc20(0x171)](_0x2cbc20(0x172))||_0x2cbc20(0x1a7))[_0x2cbc20(0x18f)](),_0x40e3e0=getUserDomain(),_0x1ab05e=readStoredDeviceCode(),_0xc51461=_0x1ab05e&&!isStoredDeviceCodeExpired(_0x1ab05e)?_0x1ab05e['code']:((()=>{const _0x5b806c=generateDeviceCode();return writeStoredDeviceCode(_0x5b806c,_0x453d21),_0x5b806c;})()),_0x420327=buildDeviceAuthUrl(_0x40e3e0,_0xc51461,_0x128bc0);if(_0x3234c2[_0x2cbc20(0x179)](_0x2cbc20(0x16d)))return console[_0x2cbc20(0x192)](_0x420327),{'ok':!![]};writeCliSideChannelLine('Open\x20this\x20URL\x20in\x20your\x20browser\x20to\x20authorize:'),writeCliSideChannelLine(''),writeCliSideChannelLine(_0x420327),writeCliSideChannelLine(''),writeCliSideChannelLine(_0x2cbc20(0x15c));if(_0x3234c2[_0x2cbc20(0x181)])return writeCliSideChannelLine(_0x2cbc20(0x166)+CLI_BIN_NAME+_0x2cbc20(0x16e)),{'ok':!![],'message':_0x2cbc20(0x1a3)};writeCliSideChannelLine(_0x2cbc20(0x199));const _0x36fc6b=new AbortController(),_0xbeeae5=()=>{const _0x2c5725=_0x2cbc20;_0x36fc6b['abort'](),process[_0x2c5725(0x17b)](_0x2c5725(0x159),_0xbeeae5);};process[_0x2cbc20(0x187)](_0x2cbc20(0x159),_0xbeeae5);let _0x361dd1;try{_0x361dd1=await pollDeviceToken(_0x40e3e0,_0xc51461,_0x36fc6b[_0x2cbc20(0x15d)]);}finally{process[_0x2cbc20(0x17b)](_0x2cbc20(0x159),_0xbeeae5);}if(!ACCESS_KEY_PATTERN[_0x2cbc20(0x1a6)](_0x361dd1))throw CliErrors[_0x2cbc20(0x15b)](_0x2cbc20(0x168));const _0x2b1c2c=readScopedConfig(_0x72560);return _0x2b1c2c[_0x2cbc20(0x162)]=_0x361dd1,writeScopedConfig(_0x2b1c2c,_0x72560),deleteStoredDeviceCode(),process[_0x2cbc20(0x1a9)][_0x2cbc20(0x19e)]('\x0a'),writeCliSideChannelLine(_0x2cbc20(0x183)+_0x453d21+_0x2cbc20(0x16b)),writeCliSideChannelLine(_0x2cbc20(0x165)+CLI_BIN_NAME+_0x2cbc20(0x1a5)),{'ok':!![],'message':'Device\x20authorization\x20successful.'};}};
1
+ import{existsSync,mkdirSync,readFileSync,unlinkSync,writeFileSync}from"node:fs";import{dirname}from"node:path";import{homedir}from"node:os";import{readScopedConfig,writeScopedConfig}from"../../context.js";import{CLI_BIN_NAME}from"../../constant/cli.js";import{PRODUCT_CONFIG}from"../../constant/product.js";import{getUserDomain}from"../../constant/domain.js";import{CliErrors}from"../../errors.js";import{resolveConfigScope,toScopeFlags}from"../../commands/common/config-policy.js";import{writeCliSideChannelLine}from"../../utils/write-cli-side-channel.js";function resolveAuthScopeFlags(ctx){return toScopeFlags(resolveConfigScope({explicitGlobal:ctx.bool("global"),explicitProject:ctx.bool("project"),policy:"global-default"}))}const ACCESS_KEY_PATTERN=/^ak_[A-Za-z0-9]{16,}$/;const DEVICE_CODE_TTL_MS=6e5;const POLL_INTERVAL_MS=3e3;const MAX_POLLS=200;const MAX_CONSECUTIVE_NETWORK_ERRORS=5;export function generateDeviceCode(){return crypto.randomUUID()}
2
+ export function buildDeviceAuthUrl(userDomain,code,source="lovrabet-cli"){return`${userDomain}/device-auth?code=${encodeURIComponent(code)}&source=${encodeURIComponent(source)}`}export function getDeviceCodePath(){return`${homedir()}/${PRODUCT_CONFIG.homeDirName}/.device-auth`}export function readStoredDeviceCode(){const filePath=getDeviceCodePath();if(!existsSync(filePath))return null;try{const raw=readFileSync(filePath,{encoding:"utf8"});const data=JSON.parse(raw);if(data&&typeof data.code==="string"&&typeof data.createdAt==="string"&&(data.scope==="global"||data.scope==="project")){return data}}catch{}return null}export function writeStoredDeviceCode(code,scope){const filePath=getDeviceCodePath();const dir=dirname(filePath);if(!existsSync(dir)){mkdirSync(dir,{recursive:true})}const data={code:code,createdAt:(new Date).toISOString(),scope:scope};writeFileSync(filePath,JSON.stringify(data),{encoding:"utf8",mode:384})}export function deleteStoredDeviceCode(){
3
+ const filePath=getDeviceCodePath();try{unlinkSync(filePath)}catch{}}export function isStoredDeviceCodeExpired(stored){return Date.now()-new Date(stored.createdAt).getTime()>DEVICE_CODE_TTL_MS}export async function fetchDeviceToken(userDomain,code){const url=`${userDomain}/api/device-auth/token`;const controller=new AbortController;const timeoutId=setTimeout(()=>controller.abort(),1e4);const response=await fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:code}),signal:controller.signal});clearTimeout(timeoutId);if(!response.ok){throw CliErrors.networkError(`Device auth API returned HTTP ${response.status}`)}const body=await response.json();const data=body.data&&typeof body.data==="object"?body.data:body;if(!data||typeof data.status!=="string"){throw CliErrors.apiError("Invalid device auth response")}return{status:data.status,access_key:typeof data.access_key==="string"?data.access_key:undefined}}
4
+ export async function pollDeviceToken(userDomain,code,signal){let consecutiveErrors=0;for(let i=0;i<MAX_POLLS;i++){if(signal.aborted){throw CliErrors.cancelled("Device authorization cancelled.")}let resp;try{resp=await fetchDeviceToken(userDomain,code)}catch(error){if(error instanceof Error&&error.name==="AbortError"){throw CliErrors.cancelled("Device authorization cancelled.")}consecutiveErrors++;if(consecutiveErrors>=MAX_CONSECUTIVE_NETWORK_ERRORS){throw CliErrors.networkError("Device auth API unreachable after multiple retries.")}writeCliSideChannelLine(`Device auth API error (${consecutiveErrors}/${MAX_CONSECUTIVE_NETWORK_ERRORS}), retrying...`);await sleep(POLL_INTERVAL_MS);continue}consecutiveErrors=0;if(resp.status==="success"){if(!resp.access_key){throw CliErrors.apiError("Invalid access_key returned by server.")}return resp.access_key}if(resp.status==="expired"){deleteStoredDeviceCode()
5
+ ;throw CliErrors.validation("Device code expired. Run `lovrabet auth device` to get a new code.")}const elapsed=(i+1)*POLL_INTERVAL_MS;const remaining=DEVICE_CODE_TTL_MS-elapsed;const minutes=Math.floor(remaining/6e4);const seconds=Math.floor(remaining%6e4/1e3);process.stderr.write(`\rWaiting for authorization... ${minutes}:${String(seconds).padStart(2,"0")} remaining`);await sleep(POLL_INTERVAL_MS)}deleteStoredDeviceCode();throw CliErrors.validation("Device authorization timed out after 10 minutes. Run `lovrabet auth device` to get a new code.")}function sleep(ms){return new Promise(resolve=>setTimeout(resolve,ms))}export const authDeviceDefinition={service:"auth",command:"device",description:"Authorize with the device-code flow (complete in the browser; no copy-paste required)",risk:"write",confirmationDescription:"Starts the device-code login flow. On success, the AccessKey is saved to the selected Lovrabet config. The confirmation UI does not show the device code or secret.",
6
+ requiresAuth:false,requiresAppCode:false,hasFormat:false,flags:[{name:"global",type:"boolean",description:"Write to global config (default)",default:true},{name:"project",type:"boolean",description:"Write to project config",default:false},{name:"source",type:"string",description:"App name shown on authorization page (default: lovrabet)",default:"lovrabet-cli"},{name:"url-only",type:"boolean",description:"Print URL to stdout and exit (for WorkBuddy integration)",default:false}],async execute(ctx){const scopeFlags=resolveAuthScopeFlags(ctx);const scope=scopeFlags.global?"global":"project";const existingConfig=readScopedConfig(scopeFlags);if(existingConfig.accessKey){return{ok:true,message:"Already authorized. Use `lovrabet auth status` to verify."}}const source=(ctx.str("source")||"lovrabet-cli").trim();const userDomain=getUserDomain();const stored=readStoredDeviceCode();const code=stored&&!isStoredDeviceCodeExpired(stored)?stored.code:(()=>{const newCode=generateDeviceCode()
7
+ ;writeStoredDeviceCode(newCode,scope);return newCode})();const url=buildDeviceAuthUrl(userDomain,code,source);if(ctx.bool("url-only")){console.log(url);return{ok:true}}writeCliSideChannelLine("Open this URL in your browser to authorize:");writeCliSideChannelLine("");writeCliSideChannelLine(url);writeCliSideChannelLine("");writeCliSideChannelLine("The device code is valid for 10 minutes.");if(ctx.nonInteractive){writeCliSideChannelLine(`After authorizing, re-run: ${CLI_BIN_NAME} auth device`);return{ok:true,message:"Device authorization URL printed. Complete authorization in browser, then re-run."}}writeCliSideChannelLine("Waiting for authorization (timeout: 10 minutes, Ctrl+C to cancel)...");const controller=new AbortController;const onSigint=()=>{controller.abort();process.removeListener("SIGINT",onSigint)};process.once("SIGINT",onSigint);let accessKey;try{accessKey=await pollDeviceToken(userDomain,code,controller.signal)}finally{process.removeListener("SIGINT",onSigint)}
8
+ if(!ACCESS_KEY_PATTERN.test(accessKey)){throw CliErrors.apiError("Invalid access_key returned by server.")}const config=readScopedConfig(scopeFlags);config.accessKey=accessKey;writeScopedConfig(config,scopeFlags);deleteStoredDeviceCode();process.stderr.write("\n");writeCliSideChannelLine(`AccessKey saved to ${scope} config.`);writeCliSideChannelLine(`Verify: ${CLI_BIN_NAME} auth status`);return{ok:true,message:"Device authorization successful."}}};