@lovrabet/rabetbase-cli 2.5.13-beta.1 → 2.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/README.md +42 -17
  2. package/lib/api/api-doc.js +3 -1
  3. package/lib/api/api-group.js +3 -1
  4. package/lib/api/fetch-model-list.js +1 -1
  5. package/lib/api/generate-api-file.js +8 -1
  6. package/lib/api/generate-sdk-config-file.js +1 -1
  7. package/lib/api/legacy-api-file.js +2 -1
  8. package/lib/api/model-registry-file.js +11 -1
  9. package/lib/api/model-registry-scaffold.js +2 -1
  10. package/lib/api/model-source.js +3 -1
  11. package/lib/auth/auth-server-ui.js +2 -1
  12. package/lib/auth/auth-server.js +5 -1
  13. package/lib/auth/constant.js +1 -1
  14. package/lib/auth/get-cookie.js +1 -1
  15. package/lib/auth/get-session-user.js +1 -1
  16. package/lib/auth/is-session-valid.js +1 -1
  17. package/lib/auth/login-success-html.js +3 -1
  18. package/lib/auth/logout.js +1 -1
  19. package/lib/cli-flags.js +1 -1
  20. package/lib/cli.js +5 -1
  21. package/lib/commands/api/generate.js +4 -1
  22. package/lib/commands/api/index.js +1 -1
  23. package/lib/commands/api/list.js +2 -1
  24. package/lib/commands/api/pull.js +10 -1
  25. package/lib/commands/api/shared.js +1 -1
  26. package/lib/commands/app/detail.js +1 -1
  27. package/lib/commands/app/index.js +1 -1
  28. package/lib/commands/app/list.js +5 -1
  29. package/lib/commands/app/members-list.js +1 -1
  30. package/lib/commands/app/remote-directory.js +1 -1
  31. package/lib/commands/app/shared.js +4 -1
  32. package/lib/commands/app-config/delete.js +2 -1
  33. package/lib/commands/app-config/get.js +2 -1
  34. package/lib/commands/app-config/index.js +1 -1
  35. package/lib/commands/app-config/list.js +2 -1
  36. package/lib/commands/app-config/set.js +3 -1
  37. package/lib/commands/app-config/shared.d.ts +9 -2
  38. package/lib/commands/app-config/shared.js +6 -1
  39. package/lib/commands/auth/index.js +1 -1
  40. package/lib/commands/bff/create.js +11 -1
  41. package/lib/commands/bff/delete.js +6 -1
  42. package/lib/commands/bff/detail.js +1 -1
  43. package/lib/commands/bff/index.js +1 -1
  44. package/lib/commands/bff/list.js +1 -1
  45. package/lib/commands/bff/logs.js +4 -1
  46. package/lib/commands/bff/pull.js +22 -1
  47. package/lib/commands/bff/push.js +16 -1
  48. package/lib/commands/bff/status.js +3 -1
  49. package/lib/commands/cli-skill/index.js +2 -1
  50. package/lib/commands/cli-update.js +7 -1
  51. package/lib/commands/codegen/index.js +1 -1
  52. package/lib/commands/codegen/sdk.js +1 -1
  53. package/lib/commands/codegen/sql.js +1 -1
  54. package/lib/commands/common/app-registry.js +4 -1
  55. package/lib/commands/common/app-selector.js +4 -1
  56. package/lib/commands/common/async-task.js +2 -1
  57. package/lib/commands/common/dry-run.js +1 -1
  58. package/lib/commands/common/flags.js +3 -1
  59. package/lib/commands/common/local-file.js +1 -1
  60. package/lib/commands/common/validate.js +1 -1
  61. package/lib/commands/config/delete.js +2 -1
  62. package/lib/commands/config/get.js +1 -1
  63. package/lib/commands/config/index.js +1 -1
  64. package/lib/commands/config/init.js +5 -1
  65. package/lib/commands/config/list.js +1 -1
  66. package/lib/commands/config/set.js +4 -1
  67. package/lib/commands/config/shared.js +2 -1
  68. package/lib/commands/dataset/batch-design.js +9 -1
  69. package/lib/commands/dataset/business-group-update.js +10 -1
  70. package/lib/commands/dataset/business-groups.js +1 -1
  71. package/lib/commands/dataset/capability.js +3 -1
  72. package/lib/commands/dataset/cross-relation-create.js +2 -1
  73. package/lib/commands/dataset/cross-relation-delete.js +1 -1
  74. package/lib/commands/dataset/cross-relation-list.js +2 -1
  75. package/lib/commands/dataset/cross-relation-shared.js +10 -1
  76. package/lib/commands/dataset/cross-relation-update.js +2 -1
  77. package/lib/commands/dataset/delete.js +6 -1
  78. package/lib/commands/dataset/design-context.js +1 -1
  79. package/lib/commands/dataset/design-start.js +1 -1
  80. package/lib/commands/dataset/design-status.js +1 -1
  81. package/lib/commands/dataset/design-sync-retry.js +1 -1
  82. package/lib/commands/dataset/design-sync-status.js +1 -1
  83. package/lib/commands/dataset/design-validate.js +1 -1
  84. package/lib/commands/dataset/detail.js +5 -1
  85. package/lib/commands/dataset/extend-update.js +7 -1
  86. package/lib/commands/dataset/field-restore.js +7 -1
  87. package/lib/commands/dataset/field-update.js +7 -1
  88. package/lib/commands/dataset/generate.js +19 -1
  89. package/lib/commands/dataset/index.js +3 -1
  90. package/lib/commands/dataset/list.js +2 -1
  91. package/lib/commands/dataset/operations.js +2 -1
  92. package/lib/commands/dataset/relation-audit.js +7 -1
  93. package/lib/commands/dataset/relation-create.js +3 -1
  94. package/lib/commands/dataset/relation-delete.js +3 -1
  95. package/lib/commands/dataset/relation-shared.js +21 -1
  96. package/lib/commands/dataset/relation-update.js +4 -1
  97. package/lib/commands/dataset/relations.js +7 -1
  98. package/lib/commands/dataset/rename.js +4 -1
  99. package/lib/commands/dataset/restore.js +7 -1
  100. package/lib/commands/dataset/user-deleted-field-list.js +3 -1
  101. package/lib/commands/db/analysis-batching.js +3 -1
  102. package/lib/commands/db/analyze-batch-plan.js +2 -1
  103. package/lib/commands/db/analyze-cancel.js +1 -1
  104. package/lib/commands/db/analyze-start.js +3 -1
  105. package/lib/commands/db/analyze-status.js +6 -1
  106. package/lib/commands/db/create.js +4 -1
  107. package/lib/commands/db/cross-db-analysis-shared.js +3 -1
  108. package/lib/commands/db/cross-db-analyze-latest.js +1 -1
  109. package/lib/commands/db/cross-db-analyze-start.js +2 -1
  110. package/lib/commands/db/cross-db-analyze-status.js +1 -1
  111. package/lib/commands/db/delete.js +3 -1
  112. package/lib/commands/db/detail.js +1 -1
  113. package/lib/commands/db/diff-refresh-start.js +1 -1
  114. package/lib/commands/db/diff-refresh-status.js +2 -1
  115. package/lib/commands/db/diff.js +3 -1
  116. package/lib/commands/db/index.js +2 -1
  117. package/lib/commands/db/list.js +2 -1
  118. package/lib/commands/db/shared.js +3 -1
  119. package/lib/commands/db/table-diff-shared.js +2 -1
  120. package/lib/commands/db/tables.js +2 -1
  121. package/lib/commands/db/test.js +2 -1
  122. package/lib/commands/db/update.js +4 -1
  123. package/lib/commands/deployment/index.js +1 -1
  124. package/lib/commands/deployment/sync-all.js +3 -1
  125. package/lib/commands/deployment/sync-jobs.js +2 -1
  126. package/lib/commands/deployment/sync-status.js +2 -1
  127. package/lib/commands/doctor.js +12 -1
  128. package/lib/commands/file/index.js +3 -1
  129. package/lib/commands/flow/create.js +2 -1
  130. package/lib/commands/flow/detail.js +3 -1
  131. package/lib/commands/flow/index.js +1 -1
  132. package/lib/commands/flow/list.js +2 -1
  133. package/lib/commands/flow/page-list.js +2 -1
  134. package/lib/commands/flow/publish.js +2 -1
  135. package/lib/commands/flow/runtime-resources-shared.js +3 -1
  136. package/lib/commands/flow/runtime-role-list.js +2 -1
  137. package/lib/commands/flow/runtime-role-user-list.js +2 -1
  138. package/lib/commands/flow/runtime-user-search.js +2 -1
  139. package/lib/commands/flow/shared.js +6 -1
  140. package/lib/commands/flow/update.js +4 -1
  141. package/lib/commands/flow/validate.js +2 -1
  142. package/lib/commands/instant-api-policy/current.js +1 -1
  143. package/lib/commands/instant-api-policy/index.js +1 -1
  144. package/lib/commands/instant-api-policy/init.js +2 -1
  145. package/lib/commands/instant-api-policy/publish.js +5 -1
  146. package/lib/commands/instant-api-policy/pull.js +2 -1
  147. package/lib/commands/instant-api-policy/revision.js +1 -1
  148. package/lib/commands/instant-api-policy/revisions.js +1 -1
  149. package/lib/commands/instant-api-policy/rollback.js +5 -1
  150. package/lib/commands/instant-api-policy/shared.js +5 -1
  151. package/lib/commands/instant-api-policy/validate.js +1 -1
  152. package/lib/commands/issue/context.js +1 -1
  153. package/lib/commands/issue/index.js +1 -1
  154. package/lib/commands/issue/nudge.js +2 -1
  155. package/lib/commands/issue/report.js +5 -1
  156. package/lib/commands/kb/create.js +5 -1
  157. package/lib/commands/kb/delete.js +5 -1
  158. package/lib/commands/kb/detail.js +1 -1
  159. package/lib/commands/kb/import-api.d.ts +3 -0
  160. package/lib/commands/kb/import-api.js +1 -0
  161. package/lib/commands/kb/import-resume.d.ts +2 -0
  162. package/lib/commands/kb/import-resume.js +2 -0
  163. package/lib/commands/kb/import-shared.d.ts +69 -0
  164. package/lib/commands/kb/import-shared.js +9 -0
  165. package/lib/commands/kb/import-status.d.ts +2 -0
  166. package/lib/commands/kb/import-status.js +1 -0
  167. package/lib/commands/kb/import.d.ts +2 -0
  168. package/lib/commands/kb/import.js +3 -0
  169. package/lib/commands/kb/index.js +1 -1
  170. package/lib/commands/kb/list.js +1 -1
  171. package/lib/commands/kb/search.js +3 -1
  172. package/lib/commands/kb/shared.js +9 -1
  173. package/lib/commands/kb/update.js +7 -1
  174. package/lib/commands/logs/index.js +2 -1
  175. package/lib/commands/menu/asset-update.js +8 -1
  176. package/lib/commands/menu/delete.js +15 -1
  177. package/lib/commands/menu/external-link-create.js +16 -1
  178. package/lib/commands/menu/external-link-update.js +10 -1
  179. package/lib/commands/menu/group-create.js +8 -1
  180. package/lib/commands/menu/group-update.js +6 -1
  181. package/lib/commands/menu/index.js +2 -1
  182. package/lib/commands/menu/list.js +1 -1
  183. package/lib/commands/menu/move.js +6 -1
  184. package/lib/commands/menu/regroup-start.js +11 -1
  185. package/lib/commands/menu/rename.js +9 -1
  186. package/lib/commands/menu/shared/compare-table.js +2 -1
  187. package/lib/commands/menu/shared/delete-plan.js +13 -1
  188. package/lib/commands/menu/shared/facts.js +5 -1
  189. package/lib/commands/menu/shared/index.js +1 -1
  190. package/lib/commands/menu/shared/inquirer.js +4 -1
  191. package/lib/commands/menu/shared/local-pages.js +5 -1
  192. package/lib/commands/menu/shared/logic.js +3 -1
  193. package/lib/commands/menu/shared/mutations.js +9 -1
  194. package/lib/commands/menu/shared/path.js +1 -1
  195. package/lib/commands/menu/shared/service.js +4 -1
  196. package/lib/commands/menu/shared/subapp-assets.js +4 -1
  197. package/lib/commands/menu/shared/sync-core.js +7 -1
  198. package/lib/commands/menu/shared/types.js +1 -1
  199. package/lib/commands/menu/shared/update-core.js +8 -1
  200. package/lib/commands/menu/shared/valid-url.js +1 -1
  201. package/lib/commands/menu/subapp-assets-status.js +1 -1
  202. package/lib/commands/menu/subapp-assets-update.js +7 -1
  203. package/lib/commands/menu/sync.js +7 -1
  204. package/lib/commands/menu/visibility-update.js +13 -1
  205. package/lib/commands/metric/contract.d.ts +8 -0
  206. package/lib/commands/metric/contract.js +5 -0
  207. package/lib/commands/metric/definition.d.ts +43 -0
  208. package/lib/commands/metric/definition.js +4 -0
  209. package/lib/commands/metric/delete.d.ts +2 -0
  210. package/lib/commands/metric/delete.js +3 -0
  211. package/lib/commands/metric/detail.d.ts +2 -0
  212. package/lib/commands/metric/detail.js +1 -0
  213. package/lib/commands/metric/example.d.ts +2 -0
  214. package/lib/commands/metric/example.js +1 -0
  215. package/lib/commands/metric/index.d.ts +2 -0
  216. package/lib/commands/metric/index.js +1 -0
  217. package/lib/commands/metric/list.d.ts +2 -0
  218. package/lib/commands/metric/list.js +2 -0
  219. package/lib/commands/metric/publication-diff.d.ts +8 -0
  220. package/lib/commands/metric/publication-diff.js +1 -0
  221. package/lib/commands/metric/publish.d.ts +2 -0
  222. package/lib/commands/metric/publish.js +4 -0
  223. package/lib/commands/metric/schema.d.ts +2 -0
  224. package/lib/commands/metric/schema.js +1 -0
  225. package/lib/commands/metric/shared.d.ts +14 -0
  226. package/lib/commands/metric/shared.js +2 -0
  227. package/lib/commands/metric/validate.d.ts +2 -0
  228. package/lib/commands/metric/validate.js +1 -0
  229. package/lib/commands/notification/config-create.js +4 -1
  230. package/lib/commands/notification/config-delete.js +4 -1
  231. package/lib/commands/notification/config-list.js +2 -1
  232. package/lib/commands/notification/config-update.js +4 -1
  233. package/lib/commands/notification/index.js +1 -1
  234. package/lib/commands/notification/shared.js +18 -1
  235. package/lib/commands/ocr/index.js +4 -1
  236. package/lib/commands/page/create.js +6 -1
  237. package/lib/commands/page/custom/detail.js +2 -1
  238. package/lib/commands/page/custom/list.js +2 -1
  239. package/lib/commands/page/custom/publish.js +3 -1
  240. package/lib/commands/page/custom/shared.js +3 -1
  241. package/lib/commands/page/custom/syntax.js +2 -1
  242. package/lib/commands/page/custom/update.js +3 -1
  243. package/lib/commands/page/data-list-status.js +2 -1
  244. package/lib/commands/page/generate-start.js +5 -1
  245. package/lib/commands/page/generate-status.js +4 -1
  246. package/lib/commands/page/index.js +2 -1
  247. package/lib/commands/page/pull.js +6 -1
  248. package/lib/commands/page/push.js +11 -1
  249. package/lib/commands/page/relation-audit.js +15 -1
  250. package/lib/commands/page/restore.js +5 -1
  251. package/lib/commands/page/shared.js +16 -1
  252. package/lib/commands/page/sync.js +2 -1
  253. package/lib/commands/project/api-architecture-upgrade.js +11 -1
  254. package/lib/commands/project/create/enhanced-guided-create.js +2 -1
  255. package/lib/commands/project/create/format-elapsed.js +1 -1
  256. package/lib/commands/project/create/main.js +13 -1
  257. package/lib/commands/project/create/materialize-project-template.js +12 -1
  258. package/lib/commands/project/create/project-name.js +1 -1
  259. package/lib/commands/project/create/project-template-archive.js +5 -1
  260. package/lib/commands/project/create/project-template-path.js +1 -1
  261. package/lib/commands/project/create/use-copy-project-template.js +2 -1
  262. package/lib/commands/project/create/use-format-code.js +1 -1
  263. package/lib/commands/project/create/use-install-dependencies.js +1 -1
  264. package/lib/commands/project/domain-routing-sync.js +1 -1
  265. package/lib/commands/project/index.js +4 -1
  266. package/lib/commands/project/upgrade.js +7 -1
  267. package/lib/commands/registry.js +10 -1
  268. package/lib/commands/role/delete.js +2 -1
  269. package/lib/commands/role/detail.js +1 -1
  270. package/lib/commands/role/index.js +1 -1
  271. package/lib/commands/role/list.js +2 -1
  272. package/lib/commands/role/shared.js +8 -1
  273. package/lib/commands/role/update.js +3 -1
  274. package/lib/commands/role/user-add.js +2 -1
  275. package/lib/commands/role/user-remove.js +2 -1
  276. package/lib/commands/role/user-resolve.js +1 -1
  277. package/lib/commands/rule/get.js +1 -1
  278. package/lib/commands/rule/index.js +1 -1
  279. package/lib/commands/rule/list.js +1 -1
  280. package/lib/commands/rule/set.js +7 -1
  281. package/lib/commands/rule/shared.js +4 -1
  282. package/lib/commands/run/index.js +5 -1
  283. package/lib/commands/schema.js +1 -1
  284. package/lib/commands/sql/create.js +7 -1
  285. package/lib/commands/sql/delete.js +4 -1
  286. package/lib/commands/sql/detail.js +1 -1
  287. package/lib/commands/sql/exec.js +1 -1
  288. package/lib/commands/sql/index.js +1 -1
  289. package/lib/commands/sql/list.js +2 -1
  290. package/lib/commands/sql/pull.js +10 -1
  291. package/lib/commands/sql/push.js +9 -1
  292. package/lib/commands/sql/shared.js +5 -1
  293. package/lib/commands/sql/status.js +3 -1
  294. package/lib/commands/sql/validate.js +5 -1
  295. package/lib/commands/task/index.js +1 -1
  296. package/lib/commands/task/status.js +2 -1
  297. package/lib/commands/tenant/index.js +1 -1
  298. package/lib/commands/tenant/members-list.js +2 -1
  299. package/lib/commands/tenant/shared.js +2 -1
  300. package/lib/commands/user-account/dingding-sandbox-bind.js +2 -1
  301. package/lib/commands/user-account/feishu-bind.js +2 -1
  302. package/lib/commands/user-account/index.js +1 -1
  303. package/lib/commands/workspace/add.js +1 -1
  304. package/lib/commands/workspace/index.js +7 -1
  305. package/lib/commands/workspace/remove.js +1 -1
  306. package/lib/config/domain-config.js +8 -1
  307. package/lib/config/project-domain-routing.js +3 -1
  308. package/lib/config/region-config.js +2 -1
  309. package/lib/config/schema.js +7 -1
  310. package/lib/constant/cdn.js +2 -1
  311. package/lib/constant/cli.js +8 -1
  312. package/lib/constant/defaults.js +1 -1
  313. package/lib/constant/domain.js +4 -1
  314. package/lib/constant/env.js +1 -1
  315. package/lib/constant/output.js +1 -1
  316. package/lib/constant/paths.js +1 -1
  317. package/lib/constant/region.js +1 -1
  318. package/lib/constant/risk.js +1 -1
  319. package/lib/constant/routing-profile.js +1 -1
  320. package/lib/context/app-resolver.js +7 -1
  321. package/lib/context/auth-resolver.js +1 -1
  322. package/lib/context/config-loader.js +7 -1
  323. package/lib/context.js +9 -1
  324. package/lib/core/alias-resolver.js +5 -1
  325. package/lib/core/api-client.d.ts +14 -7
  326. package/lib/core/api-client.js +69 -1
  327. package/lib/core/bff/config.js +1 -1
  328. package/lib/core/bff/file-system.js +6 -1
  329. package/lib/core/bff/hash.js +1 -1
  330. package/lib/core/bff/hook-directory.js +9 -1
  331. package/lib/core/bff/lock.js +2 -1
  332. package/lib/core/bff/types.js +1 -1
  333. package/lib/core/bff/utils.js +3 -1
  334. package/lib/core/cross-db-analysis.js +1 -1
  335. package/lib/core/cross-db-relation.js +1 -1
  336. package/lib/core/db-resolver.js +2 -1
  337. package/lib/core/flow-config.js +49 -1
  338. package/lib/core/instant-api-policy/config.js +7 -1
  339. package/lib/core/instant-api-policy/endpoints.js +1 -1
  340. package/lib/core/kb-management-client.d.ts +11 -0
  341. package/lib/core/kb-management-client.js +4 -1
  342. package/lib/core/kb-search-client.js +3 -1
  343. package/lib/core/page/file-system.js +2 -1
  344. package/lib/core/page/hash.js +1 -1
  345. package/lib/core/page/lock.js +2 -1
  346. package/lib/core/page/lr-smart-jsx.js +4 -1
  347. package/lib/core/page/types.js +1 -1
  348. package/lib/core/sql-index-auditor.js +14 -1
  349. package/lib/core/sql-sync/config.js +1 -1
  350. package/lib/core/sql-sync/file-system.js +3 -1
  351. package/lib/core/sql-sync/hash.js +1 -1
  352. package/lib/core/sql-sync/lock.js +2 -1
  353. package/lib/core/sql-sync/types.js +1 -1
  354. package/lib/core/sql-sync/utils.js +2 -1
  355. package/lib/core/sql-validator.js +15 -1
  356. package/lib/errors.js +3 -1
  357. package/lib/framework/build-all-flags.js +1 -1
  358. package/lib/framework/error-output.js +1 -1
  359. package/lib/framework/explicit-yes.js +1 -1
  360. package/lib/framework/flags.js +1 -1
  361. package/lib/framework/help.js +2 -1
  362. package/lib/framework/index.js +1 -1
  363. package/lib/framework/output.js +2 -1
  364. package/lib/framework/response.js +1 -1
  365. package/lib/framework/runner-alias.js +2 -1
  366. package/lib/framework/runner.js +9 -1
  367. package/lib/framework/schema-export.js +1 -1
  368. package/lib/framework/supported-flags.js +2 -1
  369. package/lib/framework/types.js +1 -1
  370. package/lib/generated/build-info.d.ts +4 -4
  371. package/lib/generated/build-info.js +1 -1
  372. package/lib/generated/official-routing.js +3 -1
  373. package/lib/generated/routing-contract.js +1 -1
  374. package/lib/help.js +1 -1
  375. package/lib/runtime/confirmation.js +2 -1
  376. package/lib/runtime/event.js +1 -1
  377. package/lib/runtime/index.js +4 -1
  378. package/lib/runtime/queue.js +1 -1
  379. package/lib/runtime/resolve.js +2 -1
  380. package/lib/runtime/types.js +1 -1
  381. package/lib/services/dataset-design/checkpoint.js +2 -1
  382. package/lib/services/dataset-design/commands.js +14 -1
  383. package/lib/services/dataset-design/contract.js +8 -1
  384. package/lib/skills/builtin-skill.js +8 -1
  385. package/lib/skills/install-updated-skill.d.ts +8 -0
  386. package/lib/skills/install-updated-skill.js +3 -0
  387. package/lib/skills/local-skills-installer.d.ts +2 -0
  388. package/lib/skills/local-skills-installer.js +1 -0
  389. package/lib/skills/main.js +2 -1
  390. package/lib/skills/npx-skills-add.d.ts +6 -6
  391. package/lib/skills/npx-skills-add.js +5 -1
  392. package/lib/skills/skill-presence.d.ts +1 -30
  393. package/lib/skills/skill-presence.js +2 -1
  394. package/lib/telemetry/cli-command-trace.js +2 -1
  395. package/lib/telemetry/cli-help-trace.js +1 -1
  396. package/lib/telemetry/ensure-cli-otel-config.js +1 -1
  397. package/lib/telemetry/register-otel-exit-shutdown.js +1 -1
  398. package/lib/telemetry/send-cli-trace-log.js +1 -1
  399. package/lib/types/index.js +1 -1
  400. package/lib/utils/ai_config.js +3 -1
  401. package/lib/utils/apply-jq-filter.js +1 -1
  402. package/lib/utils/cdn-config.js +1 -1
  403. package/lib/utils/check-sdk-version.js +5 -1
  404. package/lib/utils/cli-version-check.js +4 -1
  405. package/lib/utils/cli-version-policy.js +3 -1
  406. package/lib/utils/config.js +1 -1
  407. package/lib/utils/entity-with-id.js +1 -1
  408. package/lib/utils/file-utils.js +1 -1
  409. package/lib/utils/guides-cdn.js +3 -1
  410. package/lib/utils/http-client.js +2 -1
  411. package/lib/utils/is-non-interactive.js +1 -1
  412. package/lib/utils/logger.js +3 -1
  413. package/lib/utils/params.js +1 -1
  414. package/lib/utils/platform.js +1 -1
  415. package/lib/utils/sleep.js +1 -1
  416. package/lib/utils/template-replacer.js +5 -1
  417. package/lib/utils/update-notice.js +3 -1
  418. package/lib/utils/version.js +1 -1
  419. package/lib/utils/with-active-cookie.js +1 -1
  420. package/lib/utils/write-cli-side-channel.js +1 -1
  421. package/package.json +10 -7
  422. package/skills/rabetbase/SKILL.md +11 -7
  423. package/skills/rabetbase/guides/backend-function.md +3 -1
  424. package/skills/rabetbase/guides/data-api-guidelines.md +1 -1
  425. package/skills/rabetbase/guides/frontend-development.md +1 -0
  426. package/skills/rabetbase/guides/metric-development.md +185 -0
  427. package/skills/rabetbase/references/rabetbase-app-config.md +4 -3
  428. package/skills/rabetbase/references/rabetbase-cli-skill-install.md +5 -5
  429. package/skills/rabetbase/references/rabetbase-dataset-design.md +1 -1
  430. package/skills/rabetbase/references/rabetbase-kb.md +16 -0
  431. package/skills/rabetbase/references/rabetbase-metric.md +119 -0
  432. package/skills/rabetbase/references/rabetbase-update.md +7 -5
  433. package/skills/rabetbase-dataset-generation/SKILL.md +1 -1
  434. package/skills/rabetbase-dataset-generation/references/workflow.md +1 -1
  435. package/skills/rabetbase-metrics-generation/SKILL.md +22 -0
  436. package/skills/rabetbase-metrics-generation/references/verification.md +19 -0
  437. package/skills/rabetbase-metrics-generation/references/workflow.md +41 -0
  438. package/skills/rabetbase-metrics-generation/templates/statistics-delivery.md +11 -0
  439. package/skills/rabetbase-page-generation/SKILL.md +1 -1
  440. package/skills/rabetbase-page-generation/references/generation.md +1 -1
  441. package/skills/rabetbase.manifest.json +5 -3
  442. package/templates/metrics/definition.json +78 -0
  443. package/templates/metrics/metric-definition.schema.json +136 -0
  444. package/lib/postinstall.d.ts +0 -3
  445. package/lib/postinstall.js +0 -1
  446. package/scripts/postinstall.mjs +0 -24
@@ -10,8 +10,8 @@ export declare const NPX_FLAG_YES: "-y";
10
10
  export declare const SKILLS_FLAG_GLOBAL: "-g";
11
11
  /** `skills add` 的非交互确认短参数 */
12
12
  export declare const SKILLS_FLAG_YES: "-y";
13
- /** 始终使用官方最新 Skills CLI,目录兼容规则由上游维护。 */
14
- export declare const NPX_SKILLS_CLI: "skills@latest";
13
+ /** 独立安装提示使用与 package.json 相同的固定版本;内部执行使用本地依赖。 */
14
+ export declare const NPX_SKILLS_CLI: "skills@1.8.1";
15
15
  /** `skills` 子命令:add */
16
16
  export declare const NPX_SKILLS_SUBCOMMAND_ADD: "add";
17
17
  /** `--skill` 长选项名 */
@@ -56,7 +56,7 @@ export interface RunNpxSkillsAddResult {
56
56
  count: number;
57
57
  output: string;
58
58
  };
59
- /** 未执行 npx(RABETBASE_SKIP_NPX_SKILLS=1),仅用于测试或离线假定已安装 */
59
+ /** 未执行安装器(RABETBASE_SKIP_NPX_SKILLS=1),仅用于测试或离线假定已安装 */
60
60
  skipped?: boolean;
61
61
  }
62
62
  export interface RunNpxSkillsAddOptions {
@@ -75,13 +75,13 @@ export interface RunNpxSkillsAddOptions {
75
75
  * 失败分类。优先使用 OS / Node 层稳定信号与本地可解析的安装事实。
76
76
  * 外部输出仅识别安装器的 `Failed to install N` 汇总,其余文案只作为诊断信息。
77
77
  */
78
- export type NpxSkillsErrorCode = "NPX_NOT_FOUND" | "PERMISSION_DENIED" | "SPAWN_FAILED" | "CHILD_TERMINATED" | "CHILD_EXIT_NONZERO" | "INSTALL_PARTIAL" | "SKILL_NOT_INSTALLED";
78
+ export type NpxSkillsErrorCode = "NODE_NOT_FOUND" | "INSTALLER_UNAVAILABLE" | "PERMISSION_DENIED" | "SPAWN_FAILED" | "CHILD_TERMINATED" | "CHILD_EXIT_NONZERO" | "INSTALL_PARTIAL" | "SKILL_NOT_INSTALLED";
79
79
  /**
80
- * 若设置 RABETBASE_SKIP_NPX_SKILLS=1,跳过执行(供离线/测试注入;对 add / remove / add -g 均生效)
80
+ * 若设置 RABETBASE_SKIP_NPX_SKILLS=1,跳过执行(供离线/测试注入;对项目级与全局安装均生效)
81
81
  */
82
82
  export declare function shouldSkipNpxSkillsAdd(): boolean;
83
83
  /**
84
- * 在项目根目录执行与 {@link NPX_SKILLS_ADD_COMMAND_LINE} 等价的 npx 调用
84
+ * 在项目根目录通过本地安装器执行与独立安装提示等价的调用
85
85
  *
86
86
  * @param projectRoot 项目根目录
87
87
  * @param options.stdio - inherit(交互式终端)或 pipe(CI)
@@ -1 +1,5 @@
1
- const a347_0x450df9=a347_0x25fe;(function(_0x5e50bc,_0x58cbcd){const _0x24bec1=a347_0x25fe,_0x3bbbcf=_0x5e50bc();while(!![]){try{const _0x4e3e1c=-parseInt(_0x24bec1(0x11f))/0x1*(-parseInt(_0x24bec1(0xeb))/0x2)+parseInt(_0x24bec1(0x115))/0x3*(parseInt(_0x24bec1(0x112))/0x4)+parseInt(_0x24bec1(0x116))/0x5*(parseInt(_0x24bec1(0x10a))/0x6)+-parseInt(_0x24bec1(0xff))/0x7+-parseInt(_0x24bec1(0x105))/0x8*(-parseInt(_0x24bec1(0x10b))/0x9)+parseInt(_0x24bec1(0xf4))/0xa+-parseInt(_0x24bec1(0xf0))/0xb;if(_0x4e3e1c===_0x58cbcd)break;else _0x3bbbcf['push'](_0x3bbbcf['shift']());}catch(_0x3cbbcd){_0x3bbbcf['push'](_0x3bbbcf['shift']());}}}(a347_0x3346,0x95bdb));import{execaSync}from'execa';function a347_0x25fe(_0x142825,_0x2e7ea6){_0x142825=_0x142825-0xe9;const _0x334685=a347_0x3346();let _0x25fea1=_0x334685[_0x142825];return _0x25fea1;}import{resolveInstalledSkill}from'../skills/skill-presence.js';export const NPX_FLAG_YES='-y';export const SKILLS_FLAG_GLOBAL='-g';export const SKILLS_FLAG_YES='-y';export const NPX_SKILLS_CLI='skills@latest';export const NPX_SKILLS_SUBCOMMAND_ADD=a347_0x450df9(0x11b);export const NPX_SKILLS_FLAG_SKILL='--skill';export const RABETBASE_SKILL_SOURCE='lovrabet/rabetbase';export const RABETBASE_GLOBAL_SKILL_NAME=a347_0x450df9(0x10e);export const RABETBASE_SKILL_GIT_SOURCE=a347_0x450df9(0xf3);export function resolveGlobalSkillName(_0x63008c){const _0x5e8dcb=a347_0x450df9;switch(_0x63008c[_0x5e8dcb(0x11a)]()){case RABETBASE_SKILL_SOURCE:case RABETBASE_SKILL_GIT_SOURCE:return RABETBASE_GLOBAL_SKILL_NAME;default:return undefined;}}export function buildNpxSkillsAddArgv(_0x103b94){const _0x571ac4=a347_0x450df9,_0xb46d8=[NPX_FLAG_YES,NPX_SKILLS_CLI,NPX_SKILLS_SUBCOMMAND_ADD,RABETBASE_SKILL_SOURCE];return _0x103b94&&_0xb46d8[_0x571ac4(0xfe)](NPX_SKILLS_FLAG_SKILL,_0x103b94),_0xb46d8;}export const NPX_SKILLS_ADD_COMMAND_LINE=[a347_0x450df9(0x119),...buildNpxSkillsAddArgv()][a347_0x450df9(0xf6)]('\x20');export const NPX_SKILLS_ADD_GLOBAL_COMMAND_LINE=[a347_0x450df9(0x119),NPX_FLAG_YES,NPX_SKILLS_CLI,NPX_SKILLS_SUBCOMMAND_ADD,RABETBASE_SKILL_SOURCE,SKILLS_FLAG_GLOBAL,SKILLS_FLAG_YES]['join']('\x20');const CHILD_OUTPUT_MAX_BUFFER=0x10*0x400*0x400;function a347_0x3346(){const _0x2325a2=['!\x20Could\x20not\x20verify\x20\x22','stdout','shortMessage','4keNMBn','npx\x20terminated\x20by\x20signal\x20','checked','1665492aAhPiw','1355xnCLNO','stdio','npm_config_global','npx','trim','add','Installer\x20reported\x20','state','message','39GtIhQo','unknown','filter','19318CTBXbD','EPERM','match','NPX_NOT_FOUND','\x20failed\x20target(s)','18949909iMXIHo','ENOENT','expectedSkillName','git@codeup.aliyun.com:yuntoo/open/rabetbase-cli.git','2255830KCebPq','inherit','join','partialFailure','skill','warn','stderr','INSTALL_PARTIAL','EACCES','\x22\x20not\x20found\x20after\x20install\x20(checked\x20','push','1630062OKOeON','presence','Skill\x20\x22','CHILD_TERMINATED','log','SKILL_NOT_INSTALLED','7088056cmItXD','present','CHILD_EXIT_NONZERO','SPAWN_FAILED','code','11634AilpTv','9lQepuI','signal','pipe','rabetbase'];a347_0x3346=function(){return _0x2325a2;};return a347_0x3346();}function failure(_0x4442fc,_0x3bb4cc,_0x342878){return{'ok':![],'status':_0x3bb4cc,'code':_0x4442fc,'error':'['+_0x4442fc+']\x20'+_0x342878};}function execaOptions(_0x4e49f4,_0x5aa9f1){const _0x1a50b6=a347_0x450df9,_0x33fc81={...process.env};return delete _0x33fc81[_0x1a50b6(0x118)],delete _0x33fc81['NPM_CONFIG_GLOBAL'],{'cwd':_0x4e49f4,'stdio':_0x5aa9f1,'env':_0x33fc81,'extendEnv':![],'shell':![],'reject':![],..._0x5aa9f1===_0x1a50b6(0x10d)?{'maxBuffer':CHILD_OUTPUT_MAX_BUFFER}:{}};}function normalizeExecaResult(_0x1673cb,_0x1780aa,_0x502c33){const _0x1b7036=a347_0x450df9,_0xc176f5=[_0x1673cb[_0x1b7036(0x110)]?String(_0x1673cb[_0x1b7036(0x110)]):'',_0x1673cb['stderr']?String(_0x1673cb[_0x1b7036(0xfa)]):''][_0x1b7036(0xea)](Boolean)[_0x1b7036(0xf6)]('\x0a')[_0x1b7036(0x11a)](),_0x1e1adc=_0x1673cb['exitCode']??null;if(_0x1673cb[_0x1b7036(0x109)]){const _0x292cb0=_0x1673cb['code']===_0x1b7036(0xf1)?_0x1b7036(0xee):_0x1673cb[_0x1b7036(0x109)]===_0x1b7036(0xec)||_0x1673cb[_0x1b7036(0x109)]===_0x1b7036(0xfc)?'PERMISSION_DENIED':_0x1b7036(0x108);return failure(_0x292cb0,_0x1e1adc,_0x1673cb[_0x1b7036(0x111)]??_0x1673cb['message']??_0x1673cb[_0x1b7036(0x109)]);}if(_0x1673cb[_0x1b7036(0x10c)])return failure(_0x1b7036(0x102),_0x1e1adc,_0x1b7036(0x113)+_0x1673cb['signal']);if(_0x1673cb['failed']&&_0x1e1adc===null)return failure(_0x1b7036(0x108),_0x1e1adc,_0x1673cb['shortMessage']??_0x1673cb[_0x1b7036(0x11e)]??'npx\x20failed\x20to\x20start');if(_0x1e1adc!==0x0)return failure(_0x1b7036(0x107),_0x1e1adc,_0xc176f5||_0x1673cb['shortMessage']||'exit\x20'+(_0x1e1adc??_0x1b7036(0xe9)));const _0x3ed0d7=_0x1780aa?resolveInstalledSkill(_0x1780aa,_0x502c33):undefined,_0x1057a6=_0xc176f5[_0x1b7036(0xed)](/Failed to install\s+(\d+)/i);if(_0x1057a6&&Number(_0x1057a6[0x1])>0x0){const _0x192e44=_0x1b7036(0x11c)+_0x1057a6[0x1]+_0x1b7036(0xef)+(_0xc176f5?':\x0a'+_0xc176f5:'');if(_0x3ed0d7?.[_0x1b7036(0x11d)]===_0x1b7036(0x106))return{'ok':!![],'status':0x0,'partialFailure':{'count':Number(_0x1057a6[0x1]),'output':_0xc176f5}};return failure(_0x1b7036(0xfb),0x0,_0x192e44);}if(_0x3ed0d7){if(_0x3ed0d7[_0x1b7036(0x11d)]==='absent')return failure(_0x1b7036(0x104),0x0,_0x1b7036(0x101)+_0x1780aa+_0x1b7036(0xfd)+_0x3ed0d7[_0x1b7036(0x114)][_0x1b7036(0xf6)](',\x20')+')');_0x3ed0d7[_0x1b7036(0x11d)]==='unverifiable'&&console[_0x1b7036(0xf9)](_0x1b7036(0x10f)+_0x1780aa+'\x22\x20install\x20state:\x20'+_0x3ed0d7['reason']);}return{'ok':!![],'status':0x0};}export function shouldSkipNpxSkillsAdd(){return process.env.RABETBASE_SKIP_NPX_SKILLS==='1';}export function runNpxSkillsAdd(_0x27a44a,_0x1daa68){const _0x46bfa4=a347_0x450df9;if(shouldSkipNpxSkillsAdd())return{'ok':!![],'status':0x0,'skipped':!![]};const _0x22266b=_0x1daa68?.['stdio']??_0x46bfa4(0xf5),_0x2b2706=buildNpxSkillsAddArgv(_0x1daa68?.[_0x46bfa4(0xf8)]),_0x3d7a49=[_0x46bfa4(0x119),..._0x2b2706][_0x46bfa4(0xf6)]('\x20');console[_0x46bfa4(0x103)]('*\x20'+_0x3d7a49);const _0x28c2f8=execaSync(_0x46bfa4(0x119),_0x2b2706,execaOptions(_0x27a44a,_0x22266b));return normalizeExecaResult(_0x28c2f8);}export function runNpxSkillsAddGlobal(_0x31236b,_0x393152,_0x1c08bd){const _0x389356=a347_0x450df9;if(shouldSkipNpxSkillsAdd())return{'ok':!![],'status':0x0,'skipped':!![]};const _0x5a38f4=[NPX_FLAG_YES,NPX_SKILLS_CLI,NPX_SKILLS_SUBCOMMAND_ADD,_0x393152,SKILLS_FLAG_GLOBAL,SKILLS_FLAG_YES],_0x13903b=[_0x389356(0x119),NPX_FLAG_YES,NPX_SKILLS_CLI,NPX_SKILLS_SUBCOMMAND_ADD,_0x393152,SKILLS_FLAG_GLOBAL,SKILLS_FLAG_YES][_0x389356(0xf6)]('\x20');console['log']('*\x20'+_0x13903b);const _0x262099=execaSync(_0x389356(0x119),_0x5a38f4,execaOptions(_0x31236b,'pipe')),_0x456338=normalizeExecaResult(_0x262099,_0x1c08bd?.[_0x389356(0xf2)]??resolveGlobalSkillName(_0x393152),_0x1c08bd?.[_0x389356(0x100)]);if(_0x1c08bd?.[_0x389356(0x117)]!=='pipe'&&!_0x456338[_0x389356(0xf7)]){const _0x18c242=[_0x262099[_0x389356(0x110)],_0x262099[_0x389356(0xfa)]]['filter'](Boolean)['join']('\x0a')['trim']();if(_0x18c242)console[_0x389356(0x103)](_0x18c242);}return _0x456338;}
1
+ import{execaSync}from"execa";import{resolveLocalSkillsInstaller}from"../skills/local-skills-installer.js";import{resolveInstalledSkill}from"../skills/skill-presence.js";export const NPX_FLAG_YES="-y";export const SKILLS_FLAG_GLOBAL="-g";export const SKILLS_FLAG_YES="-y";export const NPX_SKILLS_CLI="skills@1.8.1";export const NPX_SKILLS_SUBCOMMAND_ADD="add";export const NPX_SKILLS_FLAG_SKILL="--skill";export const RABETBASE_SKILL_SOURCE="lovrabet/rabetbase";export const RABETBASE_GLOBAL_SKILL_NAME="rabetbase";export const RABETBASE_SKILL_GIT_SOURCE="git@codeup.aliyun.com:yuntoo/open/rabetbase-cli.git";export function resolveGlobalSkillName(source){switch(source.trim()){case RABETBASE_SKILL_SOURCE:case RABETBASE_SKILL_GIT_SOURCE:return RABETBASE_GLOBAL_SKILL_NAME;default:return undefined}}export function buildNpxSkillsAddArgv(skillName){const args=[NPX_FLAG_YES,NPX_SKILLS_CLI,NPX_SKILLS_SUBCOMMAND_ADD,RABETBASE_SKILL_SOURCE];if(skillName){args.push(NPX_SKILLS_FLAG_SKILL,skillName)}
2
+ return args}export const NPX_SKILLS_ADD_COMMAND_LINE=["npx",...buildNpxSkillsAddArgv()].join(" ");export const NPX_SKILLS_ADD_GLOBAL_COMMAND_LINE=["npx",NPX_FLAG_YES,NPX_SKILLS_CLI,NPX_SKILLS_SUBCOMMAND_ADD,RABETBASE_SKILL_SOURCE,SKILLS_FLAG_GLOBAL,SKILLS_FLAG_YES].join(" ");const CHILD_OUTPUT_MAX_BUFFER=16*1024*1024;function failure(code,status,detail){return{ok:false,status:status,code:code,error:`[${code}] ${detail}`}}function execaOptions(projectRoot,stdio){const env={...process.env,DISABLE_TELEMETRY:"1"};delete env.npm_config_global;delete env.NPM_CONFIG_GLOBAL;return{cwd:projectRoot,stdio:stdio,env:env,extendEnv:false,shell:false,reject:false,...stdio==="pipe"?{maxBuffer:CHILD_OUTPUT_MAX_BUFFER}:{}}}function normalizeExecaResult(result,skillName,presenceOptions){const output=[result.stdout?String(result.stdout):"",result.stderr?String(result.stderr):""].filter(Boolean).join("\n").trim();const status=result.exitCode??null;if(result.code){
3
+ const code=result.code==="ENOENT"?"NODE_NOT_FOUND":result.code==="EPERM"||result.code==="EACCES"?"PERMISSION_DENIED":"SPAWN_FAILED";return failure(code,status,result.shortMessage??result.message??result.code)}if(result.signal){return failure("CHILD_TERMINATED",status,`Skills installer terminated by signal ${result.signal}`)}if(result.failed&&status===null){return failure("SPAWN_FAILED",status,result.shortMessage??result.message??"Skills installer failed to start")}if(status!==0){return failure("CHILD_EXIT_NONZERO",status,output||result.shortMessage||`exit ${status??"unknown"}`)}const presence=skillName?resolveInstalledSkill(skillName,presenceOptions):undefined;const failedCount=output.match(/Failed to install\s+(\d+)/i);if(failedCount&&Number(failedCount[1])>0){const detail=`Installer reported ${failedCount[1]} failed target(s)${output?`:\n${output}`:""}`;if(presence?.state==="present"){return{ok:true,status:0,partialFailure:{count:Number(failedCount[1]),output:output}}}
4
+ return failure("INSTALL_PARTIAL",0,detail)}if(presence){if(presence.state==="absent"){return failure("SKILL_NOT_INSTALLED",0,`Skill "${skillName}" not listed as installed by Skills CLI`)}if(presence.state==="unverifiable"){console.warn(`! Could not verify "${skillName}" install state: ${presence.reason}`)}}return{ok:true,status:0}}export function shouldSkipNpxSkillsAdd(){return process.env.RABETBASE_SKIP_NPX_SKILLS==="1"}export function runNpxSkillsAdd(projectRoot,options){if(shouldSkipNpxSkillsAdd()){return{ok:true,status:0,skipped:true}}const stdio=options?.stdio??"inherit";let installer;try{installer=resolveLocalSkillsInstaller()}catch(error){return failure("INSTALLER_UNAVAILABLE",null,error instanceof Error?error.message:String(error))}const args=[installer,...buildNpxSkillsAddArgv(options?.skill).slice(2)];const displayCmd=["skills",...args.slice(1)].join(" ");console.log(`* ${displayCmd}`);const result=execaSync(process.execPath,args,execaOptions(projectRoot,stdio))
5
+ ;return normalizeExecaResult(result)}export function runNpxSkillsAddGlobal(projectRoot,source,options){if(shouldSkipNpxSkillsAdd()){return{ok:true,status:0,skipped:true}}let installer;try{installer=resolveLocalSkillsInstaller()}catch(error){return failure("INSTALLER_UNAVAILABLE",null,error instanceof Error?error.message:String(error))}const args=[installer,NPX_SKILLS_SUBCOMMAND_ADD,source,SKILLS_FLAG_GLOBAL,SKILLS_FLAG_YES];console.log(`* ${["skills",...args.slice(1)].join(" ")}`);const result=execaSync(process.execPath,args,execaOptions(projectRoot,"pipe"));const normalized=normalizeExecaResult(result,options?.expectedSkillName??resolveGlobalSkillName(source),options?.presence);if(options?.stdio!=="pipe"&&!normalized.partialFailure){const output=[result.stdout,result.stderr].filter(Boolean).join("\n").trim();if(output)console.log(output)}return normalized}
@@ -1,22 +1,3 @@
1
- /**
2
- * 全局 Skill 安装事实解析(与外部 skills CLI 解耦)
3
- *
4
- * 判定原则:只依据可信度较高的信号,且区分「确认未安装」与「无法确认」。
5
- * - 产物探测:消费方真正解析的 `<globalSkillsDir>/<name>/SKILL.md`
6
- * - 安装记账:skills CLI 自己维护的 `~/.agents/.skill-lock.json`
7
- *
8
- * 目录布局归外部工具所有,因此布局假设失效时必须落到 `unverifiable`(放行 + 说明原因),
9
- * 不能落到 `absent`(判失败)。只有产物与记账两个来源都表明没装,才是 `absent`。
10
- */
11
- /** skills CLI 安装记账文件(相对 HOME) */
12
- export declare const SKILL_LOCK_RELATIVE_PATH: string;
13
- /** 已知的全局 Skill 目录(相对 HOME),按探测优先级排列 */
14
- export declare const GLOBAL_SKILLS_DIR_RELATIVE_PATHS: string[];
15
- /**
16
- * 全局 Skill 的安装事实。
17
- *
18
- * `unverifiable` 是刻意保留的第三态:表示本地假设不足以判断,调用方应放行而非报错。
19
- */
20
1
  export type SkillPresence = {
21
2
  state: "present";
22
3
  path: string;
@@ -28,17 +9,7 @@ export type SkillPresence = {
28
9
  reason: string;
29
10
  };
30
11
  export interface ResolveSkillPresenceOptions {
31
- /** 覆盖候选全局 Skill 目录(隔离环境 / 测试用) */
32
- globalSkillsDirs?: string[];
33
- /** 覆盖 skills CLI 安装记账文件路径 */
34
- lockFile?: string;
35
- /** 覆盖 HOME,仅用于测试 */
12
+ /** Override the user home for isolated verification only. */
36
13
  home?: string;
37
14
  }
38
- /**
39
- * 解析指定全局 Skill 当前是否可被消费方解析到。
40
- *
41
- * @param skillName 全局 Skill 名(目录名),如 `rabetbase`
42
- * @returns `present` / `absent` / `unverifiable`
43
- */
44
15
  export declare function resolveInstalledSkill(skillName: string, options?: ResolveSkillPresenceOptions): SkillPresence;
@@ -1 +1,2 @@
1
- const a348_0x3a8167=a348_0x5c16;(function(_0x2fc523,_0x145244){const _0x43cb7c=a348_0x5c16,_0x5465e9=_0x2fc523();while(!![]){try{const _0x4044e3=-parseInt(_0x43cb7c(0xed))/0x1+-parseInt(_0x43cb7c(0xf3))/0x2+-parseInt(_0x43cb7c(0x101))/0x3+-parseInt(_0x43cb7c(0xe3))/0x4*(parseInt(_0x43cb7c(0xe4))/0x5)+-parseInt(_0x43cb7c(0xf9))/0x6*(-parseInt(_0x43cb7c(0xfe))/0x7)+-parseInt(_0x43cb7c(0x100))/0x8*(parseInt(_0x43cb7c(0xe1))/0x9)+-parseInt(_0x43cb7c(0xf8))/0xa*(-parseInt(_0x43cb7c(0xf2))/0xb);if(_0x4044e3===_0x145244)break;else _0x5465e9['push'](_0x5465e9['shift']());}catch(_0x1bcb95){_0x5465e9['push'](_0x5465e9['shift']());}}}(a348_0xdb36,0xd42ba));function a348_0x5c16(_0x1165bf,_0x2f6866){_0x1165bf=_0x1165bf-0xdd;const _0xdb3649=a348_0xdb36();let _0x5c16c3=_0xdb3649[_0x1165bf];return _0x5c16c3;}import{existsSync,readFileSync}from'node:fs';import{homedir}from'node:os';import{join}from'node:path';export const SKILL_LOCK_RELATIVE_PATH=join(a348_0x3a8167(0xf0),a348_0x3a8167(0xeb));function a348_0xdb36(){const _0x570f40=['919233Pkpqrj','includes','unusable','.agents','.claude','77QPcwnL','168272fgTFkV','number','utf8','find','recorded','5731970TKYCls','59802pbiEah','kind','reason','skills','absent','1043fjXrfK','\x20has\x20no\x20skills\x20map','2150168eucaIO','2362065UFpcWf','unverifiable','map','home','message','join','\x22\x20but\x20no\x20SKILL.md\x20was\x20found\x20in\x20known\x20layouts\x20','54FKbfBw','globalSkillsDirs','1633416hjzEQo','15efBVKo','version','present','\x20is\x20unreadable:\x20','not-recorded','lockFile','parse','.skill-lock.json','\x20uses\x20unsupported\x20version\x20'];a348_0xdb36=function(){return _0x570f40;};return a348_0xdb36();}export const GLOBAL_SKILLS_DIR_RELATIVE_PATHS=[join('.agents',a348_0x3a8167(0xfc)),join(a348_0x3a8167(0xf1),a348_0x3a8167(0xfc))];const SUPPORTED_LOCK_VERSIONS=[0x3];function readLockLookup(_0x30acf2,_0xb280e2){const _0x11b51d=a348_0x3a8167;if(!existsSync(_0x30acf2))return{'kind':_0x11b51d(0xe8)};let _0x7ad361;try{_0x7ad361=JSON[_0x11b51d(0xea)](readFileSync(_0x30acf2,_0x11b51d(0xf5)));}catch(_0x333ad3){return{'kind':_0x11b51d(0xef),'reason':_0x30acf2+_0x11b51d(0xe7)+_0x333ad3[_0x11b51d(0xde)]};}const _0x12114d=_0x7ad361;if(typeof _0x12114d?.[_0x11b51d(0xe5)]!==_0x11b51d(0xf4)||!SUPPORTED_LOCK_VERSIONS[_0x11b51d(0xee)](_0x12114d['version']))return{'kind':_0x11b51d(0xef),'reason':_0x30acf2+_0x11b51d(0xec)+String(_0x12114d?.['version'])};if(!_0x12114d[_0x11b51d(0xfc)]||typeof _0x12114d['skills']!=='object')return{'kind':_0x11b51d(0xef),'reason':_0x30acf2+_0x11b51d(0xff)};return _0x12114d[_0x11b51d(0xfc)][_0xb280e2]?{'kind':_0x11b51d(0xf7)}:{'kind':_0x11b51d(0xe8)};}export function resolveInstalledSkill(_0x50d7b4,_0x4f9ead){const _0xd82b43=a348_0x3a8167,_0x115b68=_0x4f9ead?.[_0xd82b43(0xdd)]??homedir(),_0x440aef=_0x4f9ead?.[_0xd82b43(0xe2)]??GLOBAL_SKILLS_DIR_RELATIVE_PATHS[_0xd82b43(0x103)](_0x3f65de=>join(_0x115b68,_0x3f65de)),_0xe2c5ba=_0x4f9ead?.[_0xd82b43(0xe9)]??join(_0x115b68,SKILL_LOCK_RELATIVE_PATH),_0x11895a=_0x440aef[_0xd82b43(0x103)](_0x23d588=>join(_0x23d588,_0x50d7b4,'SKILL.md')),_0x303a21=_0x11895a[_0xd82b43(0xf6)](_0x50f0d7=>existsSync(_0x50f0d7));if(_0x303a21)return{'state':_0xd82b43(0xe6),'path':_0x303a21};const _0x128a70=readLockLookup(_0xe2c5ba,_0x50d7b4);if(_0x128a70[_0xd82b43(0xfa)]===_0xd82b43(0xef))return{'state':_0xd82b43(0x102),'reason':_0x128a70[_0xd82b43(0xfb)]};if(_0x128a70[_0xd82b43(0xfa)]===_0xd82b43(0xf7))return{'state':_0xd82b43(0x102),'reason':_0xe2c5ba+'\x20records\x20\x22'+_0x50d7b4+_0xd82b43(0xe0)+('('+_0x11895a[_0xd82b43(0xdf)](',\x20')+')')};return{'state':_0xd82b43(0xfd),'checked':_0x11895a};}
1
+ import{spawnSync}from"node:child_process";import{isAbsolute,join}from"node:path";import{resolveLocalSkillsInstaller}from"../skills/local-skills-installer.js";export function resolveInstalledSkill(skillName,options){try{const env={...process.env,DISABLE_TELEMETRY:"1",DO_NOT_TRACK:"1",...options?.home?{HOME:options.home,USERPROFILE:options.home}:{}};const result=spawnSync(process.execPath,[resolveLocalSkillsInstaller(),"list","-g","--json"],{env:env,encoding:"utf8",shell:false,timeout:3e4,maxBuffer:16*1024*1024});if(result.error||result.status!==0){throw new Error(result.error?.message||result.stderr?.trim()||"Skills CLI listing failed")}const rows=JSON.parse(result.stdout);if(!Array.isArray(rows)||rows.some(row=>!row||typeof row.name!=="string"||row.scope!=="global")){throw new Error("Unsupported Skills CLI listing response")}const matches=rows.filter(row=>row.name===skillName);if(matches.length===0||matches.every(row=>row.status==="missing"&&row.path===null)){return{state:"absent",
2
+ checked:[]}}if(matches.some(row=>!["tracked","untracked","modified"].includes(row.status)||typeof row.path!=="string"||!isAbsolute(row.path))){throw new Error(`Skills CLI returned an invalid installation path or status for "${skillName}"`)}const paths=[...new Set(matches.map(row=>row.path))];if(paths.length!==1)throw new Error(`Skills CLI returned multiple installation paths for "${skillName}"`);return{state:"present",path:join(paths[0],"SKILL.md")}}catch(error){return{state:"unverifiable",reason:error instanceof Error?error.message:String(error)}}}
@@ -1 +1,2 @@
1
- (function(_0x4bb30a,_0x1d6d7d){const _0x2f8827=a349_0x29d1,_0x116a4a=_0x4bb30a();while(!![]){try{const _0x4e5c18=parseInt(_0x2f8827(0xe9))/0x1*(parseInt(_0x2f8827(0xf0))/0x2)+parseInt(_0x2f8827(0xec))/0x3*(-parseInt(_0x2f8827(0xea))/0x4)+parseInt(_0x2f8827(0xdd))/0x5+-parseInt(_0x2f8827(0xe3))/0x6+parseInt(_0x2f8827(0xf2))/0x7*(parseInt(_0x2f8827(0xdf))/0x8)+parseInt(_0x2f8827(0xdc))/0x9*(parseInt(_0x2f8827(0xf3))/0xa)+parseInt(_0x2f8827(0xe5))/0xb*(-parseInt(_0x2f8827(0xe6))/0xc);if(_0x4e5c18===_0x1d6d7d)break;else _0x116a4a['push'](_0x116a4a['shift']());}catch(_0x72ba82){_0x116a4a['push'](_0x116a4a['shift']());}}}(a349_0x521a,0xc0b85));function a349_0x521a(){const _0x334f31=['12XStDst','rabetbase.command','7NyhZjb','2930220YVCtMO','27XcfCKR','7814990BEAyhr','flags','2838952iOwTEw','stringify','durationMs','entries','3828426xqIuCT','test','517cWynjc','350580HlluuW','command','message','66881ZBeUZu','4584rbtAaV','service','1041kfwOyA','issue','error','[REDACTED]'];a349_0x521a=function(){return _0x334f31;};return a349_0x521a();}import{sendCliTraceLog}from'../telemetry/send-cli-trace-log.js';import{getCliVersion}from'../utils/version.js';const SENSITIVE_PATTERNS=[/cookie/i,/token/i,/password/i,/passwd/i,/secret/i,/auth/i,/session/i,/credential/i,/^value$/i];function isSensitiveKey(_0x54e31c){const _0xe59362=a349_0x29d1;return SENSITIVE_PATTERNS['some'](_0x304381=>_0x304381[_0xe59362(0xe4)](_0x54e31c));}function sanitizeFlags(_0x50376f){const _0x493815=a349_0x29d1,_0x5ea9b3={};for(const [_0x5e939b,_0x45a482]of Object[_0x493815(0xe2)](_0x50376f)){isSensitiveKey(_0x5e939b)?_0x5ea9b3[_0x5e939b]=_0x45a482!=null&&_0x45a482!==''?_0x493815(0xef):_0x45a482:_0x5ea9b3[_0x5e939b]=_0x45a482;}return _0x5ea9b3;}function a349_0x29d1(_0x4a0af9,_0x3db645){_0x4a0af9=_0x4a0af9-0xdc;const _0x521a02=a349_0x521a();let _0x29d1f5=_0x521a02[_0x4a0af9];return _0x29d1f5;}export async function reportCommandTrace(_0x367a3f){const _0x27ebb1=a349_0x29d1;if(_0x367a3f[_0x27ebb1(0xeb)]===_0x27ebb1(0xed)&&_0x367a3f[_0x27ebb1(0xe7)]==='report')return;try{const _0x73c9d=sanitizeFlags(_0x367a3f[_0x27ebb1(0xde)]);await sendCliTraceLog({'spanName':_0x27ebb1(0xf1),'logData':{'command.cli_version':getCliVersion(),'command.service':_0x367a3f[_0x27ebb1(0xeb)],'command.name':_0x367a3f[_0x27ebb1(0xe7)],'command.flags':JSON[_0x27ebb1(0xe0)](_0x73c9d),..._0x367a3f[_0x27ebb1(0xe1)]!=null?{'command.duration_ms':_0x367a3f[_0x27ebb1(0xe1)]}:{},..._0x367a3f['error']?{'command.error':_0x367a3f[_0x27ebb1(0xee)]instanceof Error?_0x367a3f[_0x27ebb1(0xee)][_0x27ebb1(0xe8)]:String(_0x367a3f[_0x27ebb1(0xee)])}:{}}});}catch{}}
1
+ import{sendCliTraceLog}from"../telemetry/send-cli-trace-log.js";import{getCliVersion}from"../utils/version.js";const SENSITIVE_PATTERNS=[/cookie/i,/token/i,/password/i,/passwd/i,/secret/i,/auth/i,/session/i,/credential/i,/^value$/i];function isSensitiveKey(key){return SENSITIVE_PATTERNS.some(p=>p.test(key))}function sanitizeFlags(flags){const safe={};for(const[key,value]of Object.entries(flags)){if(isSensitiveKey(key)){safe[key]=value!=null&&value!==""?"[REDACTED]":value}else{safe[key]=value}}return safe}export async function reportCommandTrace(params){if(params.service==="issue"&&params.command==="report")return;try{const safeFlags=sanitizeFlags(params.flags);await sendCliTraceLog({spanName:"rabetbase.command",logData:{"command.cli_version":getCliVersion(),"command.service":params.service,"command.name":params.command,"command.flags":JSON.stringify(safeFlags),...params.durationMs!=null?{"command.duration_ms":params.durationMs}:{},...params.error?{
2
+ "command.error":params.error instanceof Error?params.error.message:String(params.error)}:{}}})}catch{}}
@@ -1 +1 @@
1
- (function(_0x422a07,_0x55c905){var _0x30d57a=a350_0x5206,_0x5cfb29=_0x422a07();while(!![]){try{var _0x52c919=-parseInt(_0x30d57a(0x156))/0x1*(parseInt(_0x30d57a(0x155))/0x2)+-parseInt(_0x30d57a(0x163))/0x3*(parseInt(_0x30d57a(0x160))/0x4)+parseInt(_0x30d57a(0x161))/0x5+-parseInt(_0x30d57a(0x15d))/0x6+-parseInt(_0x30d57a(0x15b))/0x7*(-parseInt(_0x30d57a(0x15f))/0x8)+parseInt(_0x30d57a(0x158))/0x9*(parseInt(_0x30d57a(0x159))/0xa)+parseInt(_0x30d57a(0x162))/0xb*(parseInt(_0x30d57a(0x154))/0xc);if(_0x52c919===_0x55c905)break;else _0x5cfb29['push'](_0x5cfb29['shift']());}catch(_0x2371c7){_0x5cfb29['push'](_0x5cfb29['shift']());}}}(a350_0x422c,0x9f83b));function a350_0x422c(){var _0x11e269=['19064uFvfJK','2492JfmYRa','4124950lkphnN','385ujSvTB','4182NQbPvR','563844LvOzIh','2486120vtpRoU','1VEBfma','service','63LzizQZ','28630xgxcOo','error','3150kvuuer','cli.help','4782198QJWIRW','Failed\x20to\x20report\x20CLI\x20help\x20trace:'];a350_0x422c=function(){return _0x11e269;};return a350_0x422c();}function a350_0x5206(_0x39fbeb,_0xdc8840){_0x39fbeb=_0x39fbeb-0x154;var _0x422c43=a350_0x422c();var _0x52060c=_0x422c43[_0x39fbeb];return _0x52060c;}import{sendCliTraceLog}from'../telemetry/send-cli-trace-log.js';export async function reportCliHelpTrace(_0x492fc3,_0x55c94f){var _0x1e647e=a350_0x5206;try{await sendCliTraceLog({'spanName':_0x1e647e(0x15c),'logData':{'rabetbase.help.kind':_0x492fc3,..._0x55c94f?.[_0x1e647e(0x157)]&&{'rabetbase.help.service':_0x55c94f[_0x1e647e(0x157)]}}});}catch(_0x4cf4c2){console[_0x1e647e(0x15a)](_0x1e647e(0x15e),_0x4cf4c2);}}
1
+ import{sendCliTraceLog}from"../telemetry/send-cli-trace-log.js";export async function reportCliHelpTrace(kind,options){try{await sendCliTraceLog({spanName:"cli.help",logData:{"rabetbase.help.kind":kind,...options?.service&&{"rabetbase.help.service":options.service}}})}catch(err){console.error("Failed to report CLI help trace:",err)}}
@@ -1 +1 @@
1
- (function(_0x1c48df,_0x4e0c84){const _0x1b7fc2=a351_0x3daa,_0x6b4442=_0x1c48df();while(!![]){try{const _0x56466b=parseInt(_0x1b7fc2(0x142))/0x1*(parseInt(_0x1b7fc2(0x13f))/0x2)+-parseInt(_0x1b7fc2(0x139))/0x3*(-parseInt(_0x1b7fc2(0x143))/0x4)+parseInt(_0x1b7fc2(0x136))/0x5+-parseInt(_0x1b7fc2(0x132))/0x6*(parseInt(_0x1b7fc2(0x13b))/0x7)+-parseInt(_0x1b7fc2(0x13d))/0x8*(parseInt(_0x1b7fc2(0x144))/0x9)+-parseInt(_0x1b7fc2(0x13c))/0xa+parseInt(_0x1b7fc2(0x138))/0xb;if(_0x56466b===_0x4e0c84)break;else _0x6b4442['push'](_0x6b4442['shift']());}catch(_0xba1bbe){_0x6b4442['push'](_0x6b4442['shift']());}}}(a351_0x591c,0xb3610));import{VERSION,GIT_COMMIT}from'../generated/build-info.js';import{getSessionUserInfo}from'../auth/get-session-user.js';function a351_0x3daa(_0x2e7fb0,_0x187c23){_0x2e7fb0=_0x2e7fb0-0x132;const _0x591cce=a351_0x591c();let _0x3daa6d=_0x591cce[_0x2e7fb0];return _0x3daa6d;}function a351_0x591c(){const _0x2c4d99=['8754735eaQOjf','99zqYKWQ','production','7ektCVE','10261680ZaqPBA','392QrCnmc','user','8RYgNmO','email','tenant','300436FOfuGv','169604WxfvGQ','153297BqyLDg','5075796fyWTCk','username','tenant_code','daily','223125nPezmX','nickname'];a351_0x591c=function(){return _0x2c4d99;};return a351_0x591c();}import{setServiceConfig,setUserContext}from'@lovrabet/otel-logger';import{NPM_PACKAGE_NAME}from'../constant/cli.js';import{getConfigAppCode}from'../utils/config.js';let cliOtelTraceInitialized=![];export async function ensureCliOtelTraceConfig(){const _0x575421=a351_0x3daa,_0x3e4911=await getSessionUserInfo();if(!cliOtelTraceInitialized){const _0x358ea9=_0x3e4911?.[_0x575421(0x13e)];setServiceConfig({'serviceName':NPM_PACKAGE_NAME,'serviceVersion':GIT_COMMIT!=='unknown'?VERSION+'+'+GIT_COMMIT:VERSION,'serviceEnv':process.env.RABETBASE_ENV??(process.env.RABETBASE_E2E_DAILY==='1'?_0x575421(0x135):_0x575421(0x13a))}),setUserContext({'id':_0x358ea9?.['id'],'username':_0x358ea9?.[_0x575421(0x133)],'nickname':_0x358ea9?.[_0x575421(0x137)],'email':_0x358ea9?.[_0x575421(0x140)],'tenantCode':_0x358ea9?.[_0x575421(0x141)]?.[_0x575421(0x134)],'appCode':getConfigAppCode()}),cliOtelTraceInitialized=!![];}return _0x3e4911;}
1
+ import{VERSION,GIT_COMMIT}from"../generated/build-info.js";import{getSessionUserInfo}from"../auth/get-session-user.js";import{setServiceConfig,setUserContext}from"@lovrabet/otel-logger";import{NPM_PACKAGE_NAME}from"../constant/cli.js";import{getConfigAppCode}from"../utils/config.js";let cliOtelTraceInitialized=false;export async function ensureCliOtelTraceConfig(){const sessionInfo=await getSessionUserInfo();if(!cliOtelTraceInitialized){const u=sessionInfo?.user;setServiceConfig({serviceName:NPM_PACKAGE_NAME,serviceVersion:GIT_COMMIT!=="unknown"?`${VERSION}+${GIT_COMMIT}`:VERSION,serviceEnv:process.env.RABETBASE_ENV??(process.env.RABETBASE_E2E_DAILY==="1"?"daily":"production")});setUserContext({id:u?.id,username:u?.username,nickname:u?.nickname,email:u?.email,tenantCode:u?.tenant?.tenant_code,appCode:getConfigAppCode()});cliOtelTraceInitialized=true}return sessionInfo}
@@ -1 +1 @@
1
- (function(_0x63557b,_0x29c3db){const _0x4be004=a352_0x2106,_0x5e5edb=_0x63557b();while(!![]){try{const _0x513793=parseInt(_0x4be004(0xc0))/0x1*(-parseInt(_0x4be004(0xb7))/0x2)+-parseInt(_0x4be004(0xbb))/0x3*(-parseInt(_0x4be004(0xb1))/0x4)+-parseInt(_0x4be004(0xb2))/0x5*(-parseInt(_0x4be004(0xb5))/0x6)+-parseInt(_0x4be004(0xba))/0x7*(parseInt(_0x4be004(0xb6))/0x8)+parseInt(_0x4be004(0xb9))/0x9*(parseInt(_0x4be004(0xb3))/0xa)+-parseInt(_0x4be004(0xbd))/0xb+parseInt(_0x4be004(0xbf))/0xc;if(_0x513793===_0x29c3db)break;else _0x5e5edb['push'](_0x5e5edb['shift']());}catch(_0xd583ed){_0x5e5edb['push'](_0x5e5edb['shift']());}}}(a352_0x1810,0x1b8ce));import{shutdownTraces}from'@lovrabet/otel-logger';let shutdownPromise=null;export async function flushOtelNodeIfUsed(){if(shutdownPromise)return shutdownPromise;return shutdownPromise=((async()=>{try{await shutdownTraces();}catch{}})()),shutdownPromise;}export function registerOtelShutdownOnExit(){const _0x5de8db=a352_0x2106;process[_0x5de8db(0xb0)](_0x5de8db(0xbc),()=>{void flushOtelNodeIfUsed();});const _0x12921d=()=>{void flushOtelNodeIfUsed()['then'](()=>process['exit'](0x0));};process['once'](_0x5de8db(0xb8),_0x12921d),process[_0x5de8db(0xb0)](_0x5de8db(0xb4),_0x12921d);}function a352_0x2106(_0x25fb66,_0x3a1421){_0x25fb66=_0x25fb66-0xb0;const _0x1810f6=a352_0x1810();let _0x210650=_0x1810f6[_0x25fb66];return _0x210650;}export async function exitWithOtelShutdown(_0x5637fa){const _0x1d35d0=a352_0x2106;await flushOtelNodeIfUsed(),process[_0x1d35d0(0xbe)](_0x5637fa);}function a352_0x1810(){const _0x1a4fab=['155156Bpvrna','157020MQmbqO','10XqNekf','SIGTERM','42LlWcds','521968nQdXKt','17288RgnhiI','SIGINT','715923ssyTrT','14KvyHoY','9VVKSmG','beforeExit','2389233LqhxQs','exit','2923332jQDYBJ','23SLRBMZ','once'];a352_0x1810=function(){return _0x1a4fab;};return a352_0x1810();}
1
+ import{shutdownTraces}from"@lovrabet/otel-logger";let shutdownPromise=null;export async function flushOtelNodeIfUsed(){if(shutdownPromise){return shutdownPromise}shutdownPromise=(async()=>{try{await shutdownTraces()}catch{}})();return shutdownPromise}export function registerOtelShutdownOnExit(){process.once("beforeExit",()=>{void flushOtelNodeIfUsed()});const onSignal=()=>{void flushOtelNodeIfUsed().then(()=>process.exit(0))};process.once("SIGINT",onSignal);process.once("SIGTERM",onSignal)}export async function exitWithOtelShutdown(exitCode){await flushOtelNodeIfUsed();process.exit(exitCode)}
@@ -1 +1 @@
1
- (function(_0x2d939e,_0x173da0){const _0x6a77bd=a353_0x1b94,_0x2db2e1=_0x2d939e();while(!![]){try{const _0x132b5f=parseInt(_0x6a77bd(0x141))/0x1*(-parseInt(_0x6a77bd(0x14c))/0x2)+-parseInt(_0x6a77bd(0x144))/0x3*(parseInt(_0x6a77bd(0x14f))/0x4)+parseInt(_0x6a77bd(0x150))/0x5+parseInt(_0x6a77bd(0x14d))/0x6*(-parseInt(_0x6a77bd(0x14e))/0x7)+-parseInt(_0x6a77bd(0x142))/0x8+-parseInt(_0x6a77bd(0x146))/0x9*(parseInt(_0x6a77bd(0x145))/0xa)+parseInt(_0x6a77bd(0x14b))/0xb*(parseInt(_0x6a77bd(0x143))/0xc);if(_0x132b5f===_0x173da0)break;else _0x2db2e1['push'](_0x2db2e1['shift']());}catch(_0x40aa48){_0x2db2e1['push'](_0x2db2e1['shift']());}}}(a353_0x5c61,0x564dd));function a353_0x5c61(){const _0x5f3bda=['traceparent','logData','manual','traceName','130053JKDnjI','34wDhQJj','6480QpmbmK','1659AACtfP','21236DQPzlK','1321355FxCYGo','6971yIgxGV','4064240DJSIUU','1644oiHnYu','132XNzeGG','11480QoUEJV','3249tItlPZ'];a353_0x5c61=function(){return _0x5f3bda;};return a353_0x5c61();}import{sendTraceLog}from'@lovrabet/otel-logger';import{ensureCliOtelTraceConfig}from'../telemetry/ensure-cli-otel-config.js';import{getCliVersion}from'../utils/version.js';const DEFAULT_TRACE_NAME='rabetbase-cli';function a353_0x1b94(_0x3ef668,_0x517eb3){_0x3ef668=_0x3ef668-0x141;const _0x5c61a1=a353_0x5c61();let _0x1b946f=_0x5c61a1[_0x3ef668];return _0x1b946f;}export async function sendCliTraceLog(_0x3e37bb){const _0x43ad86=a353_0x1b94;await ensureCliOtelTraceConfig(),sendTraceLog({'traceName':_0x3e37bb[_0x43ad86(0x14a)]??DEFAULT_TRACE_NAME,'version':_0x3e37bb['version']??getCliVersion(),'spanName':_0x3e37bb['spanName'],'eventType':_0x43ad86(0x149),'logData':_0x3e37bb[_0x43ad86(0x148)],..._0x3e37bb[_0x43ad86(0x147)]&&{'traceparent':_0x3e37bb[_0x43ad86(0x147)]}});}
1
+ import{sendTraceLog}from"@lovrabet/otel-logger";import{ensureCliOtelTraceConfig}from"../telemetry/ensure-cli-otel-config.js";import{getCliVersion}from"../utils/version.js";const DEFAULT_TRACE_NAME="rabetbase-cli";export async function sendCliTraceLog(params){await ensureCliOtelTraceConfig();sendTraceLog({traceName:params.traceName??DEFAULT_TRACE_NAME,version:params.version??getCliVersion(),spanName:params.spanName,eventType:"manual",logData:params.logData,...params.traceparent&&{traceparent:params.traceparent}})}
@@ -1 +1 @@
1
- export{};
1
+ export{};
@@ -1 +1,3 @@
1
- const a355_0x20f7c8=a355_0x124b;(function(_0x146970,_0x1ce0ed){const _0xf76cff=a355_0x124b,_0x3f95a3=_0x146970();while(!![]){try{const _0x112376=parseInt(_0xf76cff(0x1f5))/0x1*(-parseInt(_0xf76cff(0x1f4))/0x2)+-parseInt(_0xf76cff(0x1fe))/0x3+parseInt(_0xf76cff(0x1f1))/0x4+parseInt(_0xf76cff(0x1ee))/0x5*(parseInt(_0xf76cff(0x1ef))/0x6)+-parseInt(_0xf76cff(0x20e))/0x7+parseInt(_0xf76cff(0x201))/0x8*(-parseInt(_0xf76cff(0x1fd))/0x9)+-parseInt(_0xf76cff(0x213))/0xa*(-parseInt(_0xf76cff(0x202))/0xb);if(_0x112376===_0x1ce0ed)break;else _0x3f95a3['push'](_0x3f95a3['shift']());}catch(_0x536407){_0x3f95a3['push'](_0x3f95a3['shift']());}}}(a355_0x2679,0xf2dfc));export const CORE_IDE_CONFIGS={'cursor':{'name':a355_0x20f7c8(0x1e9),'description':a355_0x20f7c8(0x1e5),'folders':[a355_0x20f7c8(0x214),'.cursor'],'files':[{'type':'file','path':a355_0x20f7c8(0x217)}]},'windsurf':{'name':a355_0x20f7c8(0x20b),'description':a355_0x20f7c8(0x200),'folders':['.windsurf'],'files':[{'type':a355_0x20f7c8(0x218),'path':a355_0x20f7c8(0x205)}]},'claude':{'name':a355_0x20f7c8(0x1e6),'description':'Claude\x20Code','folders':['.claude'],'files':[{'type':a355_0x20f7c8(0x218),'path':a355_0x20f7c8(0x20c)}]},'cline':{'name':a355_0x20f7c8(0x1f9),'description':a355_0x20f7c8(0x211),'folders':[a355_0x20f7c8(0x1f8)],'files':[{'type':'file','path':a355_0x20f7c8(0x209)}]},'codex':{'name':'Codex','description':'Codex\x20IDE','folders':[a355_0x20f7c8(0x1ec)],'files':[{'type':'file','path':a355_0x20f7c8(0x1e8)}]},'opencode':{'name':'OpenCode','description':a355_0x20f7c8(0x215),'folders':['.opencode'],'files':[{'type':'file','path':'.opencode/skills/lovrabet/SKILL.md'}]},'qoder':{'name':'Qoder','description':a355_0x20f7c8(0x20d),'folders':[a355_0x20f7c8(0x210)],'files':[{'type':a355_0x20f7c8(0x218),'path':a355_0x20f7c8(0x1e7)},{'type':a355_0x20f7c8(0x218),'path':'.qoder/skills/lovrabet/SKILL.md'}]},'codebuddy':{'name':a355_0x20f7c8(0x20a),'description':a355_0x20f7c8(0x216),'folders':[a355_0x20f7c8(0x204)],'files':[{'type':a355_0x20f7c8(0x218),'path':a355_0x20f7c8(0x1fc)}]},'trae':{'name':a355_0x20f7c8(0x203),'description':a355_0x20f7c8(0x1f3),'folders':['.trae'],'files':[{'type':a355_0x20f7c8(0x218),'path':a355_0x20f7c8(0x1fa)}]}};function a355_0x124b(_0x40eba2,_0x3fb1f1){_0x40eba2=_0x40eba2-0x1e5;const _0x26795f=a355_0x2679();let _0x124bc8=_0x26795f[_0x40eba2];return _0x124bc8;}export const IDE_CONFIGS={...CORE_IDE_CONFIGS,'agent':{'name':a355_0x20f7c8(0x212),'description':a355_0x20f7c8(0x208),'folders':[a355_0x20f7c8(0x206)],'files':[{'type':'file','path':a355_0x20f7c8(0x219)}]},'antigravity':{'name':a355_0x20f7c8(0x1f0),'description':a355_0x20f7c8(0x1f6),'folders':['.agent'],'files':[{'type':a355_0x20f7c8(0x218),'path':a355_0x20f7c8(0x219)}]}};function a355_0x2679(){const _0x2cdc6a=['12602191fqoxlJ','opencode','.qoder','Cline\x20IDE','Other\x20(generic\x20template)','36362230BBdUTC','.cursorrules','OpenCode\x20IDE','CodeBuddy\x20IDE','.cursor/skills/rabetbase.md','file','.agent/skills/lovrabet/SKILL.md','qoder','Cursor\x20IDE','Claude\x20Code','.qoder/rules/rabetbase.md','.codex/skills/lovrabet/SKILL.md','Cursor','codex','trae','.codex','cline','10YIbYNV','2273484NCcbxC','Antigravity','7311204AedxIL','cursor','Trae\x20IDE','4UqMbjX','615283UsAIqz','Antigravity\x20IDE','windsurf','.cline','Cline','.trae/skills/lovrabet/SKILL.md','antigravity','.codebuddy/skills/lovrabet/SKILL.md','9oHYSoV','4140897PdZdnV','claude','Windsurf\x20IDE','6526896gjwnbk','11CjodXC','Trae','.codebuddy','.windsurf/workflows/rabetbase.md','.agent','codebuddy','Generic\x20template\x20fallback','.cline/skills/lovrabet/SKILL.md','CodeBuddy','Windsurf','.claude/skills/lovrabet/SKILL.md','Qoder\x20IDE'];a355_0x2679=function(){return _0x2cdc6a;};return a355_0x2679();}export const CORE_IDE_LIST=['claude',a355_0x20f7c8(0x1ed),a355_0x20f7c8(0x207),'codex','cursor',a355_0x20f7c8(0x20f),a355_0x20f7c8(0x21a),a355_0x20f7c8(0x1eb),a355_0x20f7c8(0x1f7)];export const IDE_LIST=[a355_0x20f7c8(0x1fb),a355_0x20f7c8(0x1ff),a355_0x20f7c8(0x1ed),a355_0x20f7c8(0x207),a355_0x20f7c8(0x1ea),'cursor',a355_0x20f7c8(0x20f),'qoder',a355_0x20f7c8(0x1eb),a355_0x20f7c8(0x1f7),'agent'];export const ALL_CORE_IDES=[a355_0x20f7c8(0x1f2),a355_0x20f7c8(0x1f7),a355_0x20f7c8(0x1ff),'cline',a355_0x20f7c8(0x1ea),a355_0x20f7c8(0x20f),'qoder',a355_0x20f7c8(0x207),a355_0x20f7c8(0x1eb)];
1
+ export const CORE_IDE_CONFIGS={cursor:{name:"Cursor",description:"Cursor IDE",folders:[".cursorrules",".cursor"],files:[{type:"file",path:".cursor/skills/rabetbase.md"}]},windsurf:{name:"Windsurf",description:"Windsurf IDE",folders:[".windsurf"],files:[{type:"file",path:".windsurf/workflows/rabetbase.md"}]},claude:{name:"Claude Code",description:"Claude Code",folders:[".claude"],files:[{type:"file",path:".claude/skills/lovrabet/SKILL.md"}]},cline:{name:"Cline",description:"Cline IDE",folders:[".cline"],files:[{type:"file",path:".cline/skills/lovrabet/SKILL.md"}]},codex:{name:"Codex",description:"Codex IDE",folders:[".codex"],files:[{type:"file",path:".codex/skills/lovrabet/SKILL.md"}]},opencode:{name:"OpenCode",description:"OpenCode IDE",folders:[".opencode"],files:[{type:"file",path:".opencode/skills/lovrabet/SKILL.md"}]},qoder:{name:"Qoder",description:"Qoder IDE",folders:[".qoder"],files:[{type:"file",path:".qoder/rules/rabetbase.md"},{type:"file",
2
+ path:".qoder/skills/lovrabet/SKILL.md"}]},codebuddy:{name:"CodeBuddy",description:"CodeBuddy IDE",folders:[".codebuddy"],files:[{type:"file",path:".codebuddy/skills/lovrabet/SKILL.md"}]},trae:{name:"Trae",description:"Trae IDE",folders:[".trae"],files:[{type:"file",path:".trae/skills/lovrabet/SKILL.md"}]}};export const IDE_CONFIGS={...CORE_IDE_CONFIGS,agent:{name:"Other (generic template)",description:"Generic template fallback",folders:[".agent"],files:[{type:"file",path:".agent/skills/lovrabet/SKILL.md"}]},antigravity:{name:"Antigravity",description:"Antigravity IDE",folders:[".agent"],files:[{type:"file",path:".agent/skills/lovrabet/SKILL.md"}]}};export const CORE_IDE_LIST=["claude","cline","codebuddy","codex","cursor","opencode","qoder","trae","windsurf"];export const IDE_LIST=["antigravity","claude","cline","codebuddy","codex","cursor","opencode","qoder","trae","windsurf","agent"]
3
+ ;export const ALL_CORE_IDES=["cursor","windsurf","claude","cline","codex","opencode","qoder","codebuddy","trae"];
@@ -1 +1 @@
1
- function a356_0xa4cc(_0x5096cd,_0x1c15bc){_0x5096cd=_0x5096cd-0x7f;const _0x40c5d3=a356_0x40c5();let _0xa4cc71=_0x40c5d3[_0x5096cd];return _0xa4cc71;}(function(_0x2059ed,_0x1bc5df){const _0x44d574=a356_0xa4cc,_0x4e30ed=_0x2059ed();while(!![]){try{const _0x1e07c5=-parseInt(_0x44d574(0x80))/0x1+-parseInt(_0x44d574(0x82))/0x2*(parseInt(_0x44d574(0x8a))/0x3)+parseInt(_0x44d574(0x87))/0x4*(parseInt(_0x44d574(0x86))/0x5)+-parseInt(_0x44d574(0x83))/0x6*(-parseInt(_0x44d574(0x84))/0x7)+-parseInt(_0x44d574(0x85))/0x8*(parseInt(_0x44d574(0x81))/0x9)+-parseInt(_0x44d574(0x89))/0xa+parseInt(_0x44d574(0x88))/0xb*(parseInt(_0x44d574(0x7f))/0xc);if(_0x1e07c5===_0x1bc5df)break;else _0x4e30ed['push'](_0x4e30ed['shift']());}catch(_0x69166c){_0x4e30ed['push'](_0x4e30ed['shift']());}}}(a356_0x40c5,0x7afd5));import{createJqFilter,resolveBundledJqPaths}from'@lovrabet/cli-framework';import{CliErrors}from'../errors.js';export const applyJqFilter=createJqFilter(CliErrors,{'bundledJqPaths':resolveBundledJqPaths()});function a356_0x40c5(){const _0x51f80b=['5164340mtyZqK','13713BvCpWS','1668SbHJuF','304428YajLeO','3141ZtGKnB','214OKbIyy','918QOmvrP','36197gQdgqX','19288lkepLI','5dbcmTD','761204cxvdzQ','132451jsiBTv'];a356_0x40c5=function(){return _0x51f80b;};return a356_0x40c5();}
1
+ import{createJqFilter,resolveBundledJqPaths}from"@lovrabet/cli-framework";import{CliErrors}from"../errors.js";export const applyJqFilter=createJqFilter(CliErrors,{bundledJqPaths:resolveBundledJqPaths()});
@@ -1 +1 @@
1
- (function(_0x2012f5,_0x47fc04){const _0x318772=a357_0x1399,_0x5ac5d2=_0x2012f5();while(!![]){try{const _0x301e03=parseInt(_0x318772(0x16f))/0x1+-parseInt(_0x318772(0x174))/0x2+parseInt(_0x318772(0x173))/0x3*(parseInt(_0x318772(0x16a))/0x4)+-parseInt(_0x318772(0x16c))/0x5*(-parseInt(_0x318772(0x165))/0x6)+parseInt(_0x318772(0x172))/0x7*(parseInt(_0x318772(0x16e))/0x8)+-parseInt(_0x318772(0x169))/0x9*(-parseInt(_0x318772(0x167))/0xa)+-parseInt(_0x318772(0x170))/0xb;if(_0x301e03===_0x47fc04)break;else _0x5ac5d2['push'](_0x5ac5d2['shift']());}catch(_0x34fc1d){_0x5ac5d2['push'](_0x5ac5d2['shift']());}}}(a357_0x2cf9,0x1e382));import{getTemplateBaseUrl}from'../utils/config.js';export async function fetchCdnConfig(){const _0x443a8c=a357_0x1399,_0x107119=getTemplateBaseUrl(),_0xcb4f15=[_0x107119+_0x443a8c(0x16b),_0x107119+_0x443a8c(0x163)];for(const _0x38ad35 of _0xcb4f15){try{const _0x9ce933=await fetch(_0x38ad35,{'headers':{'Accept':'application/json'}});if(!_0x9ce933['ok'])continue;const _0x17a420=await _0x9ce933[_0x443a8c(0x162)]();if(!_0x17a420[_0x443a8c(0x171)]?.[_0x443a8c(0x168)]||!_0x17a420[_0x443a8c(0x164)]?.[_0x443a8c(0x166)]?.[_0x443a8c(0x168)])continue;return _0x17a420;}catch{}}return null;}let cachedConfig=null,cacheTime=0x0;function a357_0x2cf9(){const _0x183a41=['node','6610NrMgGS','stableVersion','1251LvCIRH','4GlPjEt','/config.json','75uhiKZv','now','201928vbKduZ','65334kHmbYw','2334376JtLMKu','cli','21YYYXGH','328017xHWGZM','208762WpnFTh','json','/config/index.json','sdk','39240fkFowl'];a357_0x2cf9=function(){return _0x183a41;};return a357_0x2cf9();}const CACHE_TTL=0x5*0x3c*0x3e8,FAILURE_CACHE_TTL=0x3c*0x3e8;let hasCachedConfig=![];function a357_0x1399(_0x437c10,_0x311974){_0x437c10=_0x437c10-0x162;const _0x2cf993=a357_0x2cf9();let _0x139998=_0x2cf993[_0x437c10];return _0x139998;}export async function getCdnConfig(){const _0x14362b=a357_0x1399,_0x45993c=Date[_0x14362b(0x16d)]();if(hasCachedConfig){const _0x53a675=cachedConfig?CACHE_TTL:FAILURE_CACHE_TTL;if(_0x45993c-cacheTime<_0x53a675)return cachedConfig;}const _0x4d73e0=await fetchCdnConfig();return cachedConfig=_0x4d73e0,cacheTime=_0x45993c,hasCachedConfig=!![],_0x4d73e0;}export function clearCdnConfigCache(){cachedConfig=null,cacheTime=0x0,hasCachedConfig=![];}
1
+ import{getTemplateBaseUrl}from"../utils/config.js";export async function fetchCdnConfig(){const baseUrl=getTemplateBaseUrl();const candidates=[`${baseUrl}/config.json`,`${baseUrl}/config/index.json`];for(const cdnUrl of candidates){try{const response=await fetch(cdnUrl,{headers:{Accept:"application/json"}});if(!response.ok){continue}const data=await response.json();if(!data.cli?.stableVersion||!data.sdk?.node?.stableVersion){continue}return data}catch{}}return null}let cachedConfig=null;let cacheTime=0;const CACHE_TTL=5*60*1e3;const FAILURE_CACHE_TTL=60*1e3;let hasCachedConfig=false;export async function getCdnConfig(){const now=Date.now();if(hasCachedConfig){const ttl=cachedConfig?CACHE_TTL:FAILURE_CACHE_TTL;if(now-cacheTime<ttl){return cachedConfig}}const config=await fetchCdnConfig();cachedConfig=config;cacheTime=now;hasCachedConfig=true;return config}export function clearCdnConfigCache(){cachedConfig=null;cacheTime=0;hasCachedConfig=false}
@@ -1 +1,5 @@
1
- (function(_0x2e84bb,_0x47ae3b){const _0x26cf47=a358_0x34f9,_0x564094=_0x2e84bb();while(!![]){try{const _0x1c9ec4=parseInt(_0x26cf47(0xd2))/0x1*(-parseInt(_0x26cf47(0xc7))/0x2)+parseInt(_0x26cf47(0xe9))/0x3*(-parseInt(_0x26cf47(0xe4))/0x4)+-parseInt(_0x26cf47(0xea))/0x5+-parseInt(_0x26cf47(0xdb))/0x6*(parseInt(_0x26cf47(0xde))/0x7)+-parseInt(_0x26cf47(0xec))/0x8*(parseInt(_0x26cf47(0xd1))/0x9)+parseInt(_0x26cf47(0xd6))/0xa*(parseInt(_0x26cf47(0xc6))/0xb)+parseInt(_0x26cf47(0xdf))/0xc;if(_0x1c9ec4===_0x47ae3b)break;else _0x564094['push'](_0x564094['shift']());}catch(_0x36bc25){_0x564094['push'](_0x564094['shift']());}}}(a358_0x5dc8,0xb1d40));import a358_0x1c809f from'node:fs';import a358_0xb21179 from'node:path';function a358_0x5dc8(){const _0x51cbbe=['11xJKQCD','devDependencies','package.json','utf8','27780Tpevok','\x20\x20\x20Upgrade\x20command:\x20','sdk','log','@lovrabet/sdk','89982nfOCOb','\x20\x20\x20Current\x20version:\x20','\x1b[33m','231ZoPYgc','21348684mndkcn','join','npm\x20install\x20','utf-8','test','718292HFKNHn','minVersion','version','parse','↪\x20SDK\x20update\x20available','3BWPFvm','2022650wmPUmL','needsUpgrade','24cLbOZx','\x1b[0m','existsSync','packageName','4961JESXrl','34996tEYHgW','node_modules','coerce','\x1b[1m','node','dependencies','stableVersion','all','readFileSync','\x20\x20\x20Stable\x20version:\x20','3096207BLmWlw'];a358_0x5dc8=function(){return _0x51cbbe;};return a358_0x5dc8();}function a358_0x34f9(_0x269ad2,_0x56a4e9){_0x269ad2=_0x269ad2-0xc3;const _0x5dc8fc=a358_0x5dc8();let _0x34f99c=_0x5dc8fc[_0x269ad2];return _0x34f99c;}import a358_0x345c50 from'semver';import{getCdnConfig}from'../utils/cdn-config.js';const FALLBACK_MIN_SDK_VERSION='1.2.0';function isNonNumericVersion(_0x2a2b5e){const _0xbfdb60=a358_0x34f9,_0x31c44e=[/^latest$/i,/^beta$/i,/^alpha$/i,/^canary$/i,/^\*$/,/^x$/];return _0x31c44e['some'](_0x4420fe=>_0x4420fe[_0xbfdb60(0xe3)](_0x2a2b5e));}function getInstalledVersion(_0x177db6,_0x265b86){const _0x46b9f3=a358_0x34f9;try{const _0x432c87=a358_0xb21179[_0x46b9f3(0xe0)](_0x177db6,_0x46b9f3(0xc8),_0x265b86,_0x46b9f3(0xd4));if(a358_0x1c809f[_0x46b9f3(0xc4)](_0x432c87)){const _0x595411=JSON[_0x46b9f3(0xe7)](a358_0x1c809f['readFileSync'](_0x432c87,_0x46b9f3(0xe2)));return _0x595411[_0x46b9f3(0xe6)]||null;}}catch{}return null;}async function getSdkStableVersion(){const _0x3a325a=a358_0x34f9;try{const _0x7a718f=await getCdnConfig();return _0x7a718f?.[_0x3a325a(0xd8)]?.[_0x3a325a(0xcb)]?.[_0x3a325a(0xcd)]||null;}catch{return null;}}async function getSdkPackageName(){const _0x8e99ab=a358_0x34f9;try{const _0xce3447=await getCdnConfig();return _0xce3447?.['sdk']?.[_0x8e99ab(0xcb)]?.['packageName']||'@lovrabet/sdk';}catch{return'@lovrabet/sdk';}}export async function checkSdkVersion(_0xb38c79){const _0xd3ea0f=a358_0x34f9,_0x4f3072=a358_0xb21179[_0xd3ea0f(0xe0)](_0xb38c79,'package.json'),[_0x348d5a,_0x4a3076]=await Promise[_0xd3ea0f(0xce)]([getSdkStableVersion(),getSdkPackageName()]),_0x5d8fa4=_0x348d5a||FALLBACK_MIN_SDK_VERSION;if(!a358_0x1c809f[_0xd3ea0f(0xc4)](_0x4f3072))return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':_0x5d8fa4,'packageName':_0x4a3076,'stableVersion':_0x348d5a};try{const _0x24ef88=JSON[_0xd3ea0f(0xe7)](a358_0x1c809f[_0xd3ea0f(0xcf)](_0x4f3072,_0xd3ea0f(0xd5))),_0x53d070=_0x24ef88[_0xd3ea0f(0xcc)]||{},_0x2a3846=_0x24ef88[_0xd3ea0f(0xd3)]||{},_0x1cac3a=_0x53d070[_0x4a3076]||_0x2a3846[_0x4a3076];if(!_0x1cac3a)return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':_0x5d8fa4,'packageName':_0x4a3076,'stableVersion':_0x348d5a};let _0x5ef7b7=getInstalledVersion(_0xb38c79,_0x4a3076);!_0x5ef7b7&&(_0x5ef7b7=_0x1cac3a);if(isNonNumericVersion(_0x1cac3a))return{'installed':!![],'version':_0x5ef7b7,'needsUpgrade':![],'minVersion':_0x5d8fa4,'packageName':_0x4a3076,'stableVersion':_0x348d5a};const _0x30c4f3=a358_0x345c50['coerce'](_0x5ef7b7),_0x37f1b5=a358_0x345c50['coerce'](_0x5d8fa4),_0x40ea7c=_0x30c4f3&&_0x37f1b5?a358_0x345c50['lt'](_0x30c4f3,_0x37f1b5):![];return{'installed':!![],'version':_0x5ef7b7,'needsUpgrade':_0x40ea7c,'minVersion':_0x5d8fa4,'packageName':_0x4a3076,'stableVersion':_0x348d5a};}catch{return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':_0x5d8fa4,'packageName':_0x4a3076,'stableVersion':_0x348d5a};}}export function checkSdkVersionSync(_0x23d2e4){const _0x414a2c=a358_0x34f9,_0x5381d0=a358_0xb21179[_0x414a2c(0xe0)](_0x23d2e4,_0x414a2c(0xd4)),_0x11ce43=_0x414a2c(0xda);if(!a358_0x1c809f['existsSync'](_0x5381d0))return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x11ce43,'stableVersion':null};try{const _0x2184ad=JSON[_0x414a2c(0xe7)](a358_0x1c809f[_0x414a2c(0xcf)](_0x5381d0,_0x414a2c(0xd5))),_0x5053fc=_0x2184ad[_0x414a2c(0xcc)]||{},_0x1362a=_0x2184ad[_0x414a2c(0xd3)]||{},_0x457f95=_0x5053fc[_0x11ce43]||_0x1362a[_0x11ce43];if(!_0x457f95)return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x11ce43,'stableVersion':null};let _0xa2ddc0=getInstalledVersion(_0x23d2e4,_0x11ce43);!_0xa2ddc0&&(_0xa2ddc0=_0x457f95);if(isNonNumericVersion(_0x457f95))return{'installed':!![],'version':_0xa2ddc0,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x11ce43,'stableVersion':null};const _0x2e8a39=a358_0x345c50[_0x414a2c(0xc9)](_0xa2ddc0),_0x77ffa5=_0x2e8a39?a358_0x345c50['lt'](_0x2e8a39,FALLBACK_MIN_SDK_VERSION):![];return{'installed':!![],'version':_0xa2ddc0,'needsUpgrade':_0x77ffa5,'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x11ce43,'stableVersion':null};}catch{return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x11ce43,'stableVersion':null};}}export function printSdkUpgradeWarning(_0x156ea4){const _0x2c814e=a358_0x34f9;if(!_0x156ea4[_0x2c814e(0xeb)])return;const _0x4d8725=_0x2c814e(0xdd),_0x43fa66=_0x2c814e(0xc3),_0xee4b00=_0x2c814e(0xca),_0x10111b=_0x156ea4[_0x2c814e(0xc5)]||_0x2c814e(0xda),_0x1001c5=_0x156ea4[_0x2c814e(0xcd)]||_0x156ea4[_0x2c814e(0xe5)],_0x281673=_0x2c814e(0xe1)+_0x10111b+'@'+(_0x1001c5||'latest');console[_0x2c814e(0xd9)](),console['log'](''+_0x4d8725+_0xee4b00+_0x2c814e(0xe8)+_0x43fa66),console[_0x2c814e(0xd9)](_0x4d8725+_0x2c814e(0xdc)+_0x10111b+'@'+_0x156ea4[_0x2c814e(0xe6)]+_0x43fa66),console[_0x2c814e(0xd9)](_0x4d8725+_0x2c814e(0xd0)+_0x1001c5+_0x43fa66),console[_0x2c814e(0xd9)](_0x4d8725+_0x2c814e(0xd7)+_0x281673+_0x43fa66),console[_0x2c814e(0xd9)]();}
1
+ import fs from"node:fs";import path from"node:path";import semver from"semver";import{getCdnConfig}from"../utils/cdn-config.js";const FALLBACK_MIN_SDK_VERSION="1.2.0";function isNonNumericVersion(version){const nonNumericPatterns=[/^latest$/i,/^beta$/i,/^alpha$/i,/^canary$/i,/^\*$/,/^x$/];return nonNumericPatterns.some(pattern=>pattern.test(version))}function getInstalledVersion(projectPath,packageName){try{const packagePath=path.join(projectPath,"node_modules",packageName,"package.json");if(fs.existsSync(packagePath)){const pkg=JSON.parse(fs.readFileSync(packagePath,"utf-8"));return pkg.version||null}}catch{}return null}async function getSdkStableVersion(){try{const cdnConfig=await getCdnConfig();return cdnConfig?.sdk?.node?.stableVersion||null}catch{return null}}async function getSdkPackageName(){try{const cdnConfig=await getCdnConfig();return cdnConfig?.sdk?.node?.packageName||"@lovrabet/sdk"}catch{return"@lovrabet/sdk"}}export async function checkSdkVersion(projectPath){
2
+ const packageJsonPath=path.join(projectPath,"package.json");const[stableVersion,packageName]=await Promise.all([getSdkStableVersion(),getSdkPackageName()]);const minVersion=stableVersion||FALLBACK_MIN_SDK_VERSION;if(!fs.existsSync(packageJsonPath)){return{installed:false,version:null,needsUpgrade:false,minVersion:minVersion,packageName:packageName,stableVersion:stableVersion}}try{const packageJson=JSON.parse(fs.readFileSync(packageJsonPath,"utf8"));const dependencies=packageJson.dependencies||{};const devDependencies=packageJson.devDependencies||{};const declaredVersion=dependencies[packageName]||devDependencies[packageName];if(!declaredVersion){return{installed:false,version:null,needsUpgrade:false,minVersion:minVersion,packageName:packageName,stableVersion:stableVersion}}let actualVersion=getInstalledVersion(projectPath,packageName);if(!actualVersion){actualVersion=declaredVersion}if(isNonNumericVersion(declaredVersion)){return{installed:true,version:actualVersion,needsUpgrade:false,
3
+ minVersion:minVersion,packageName:packageName,stableVersion:stableVersion}}const coercedVersion=semver.coerce(actualVersion);const coercedStable=semver.coerce(minVersion);const needsUpgrade=coercedVersion&&coercedStable?semver.lt(coercedVersion,coercedStable):false;return{installed:true,version:actualVersion,needsUpgrade:needsUpgrade,minVersion:minVersion,packageName:packageName,stableVersion:stableVersion}}catch{return{installed:false,version:null,needsUpgrade:false,minVersion:minVersion,packageName:packageName,stableVersion:stableVersion}}}export function checkSdkVersionSync(projectPath){const packageJsonPath=path.join(projectPath,"package.json");const packageName="@lovrabet/sdk";if(!fs.existsSync(packageJsonPath)){return{installed:false,version:null,needsUpgrade:false,minVersion:FALLBACK_MIN_SDK_VERSION,packageName:packageName,stableVersion:null}}try{const packageJson=JSON.parse(fs.readFileSync(packageJsonPath,"utf8"));const dependencies=packageJson.dependencies||{}
4
+ ;const devDependencies=packageJson.devDependencies||{};const declaredVersion=dependencies[packageName]||devDependencies[packageName];if(!declaredVersion){return{installed:false,version:null,needsUpgrade:false,minVersion:FALLBACK_MIN_SDK_VERSION,packageName:packageName,stableVersion:null}}let actualVersion=getInstalledVersion(projectPath,packageName);if(!actualVersion){actualVersion=declaredVersion}if(isNonNumericVersion(declaredVersion)){return{installed:true,version:actualVersion,needsUpgrade:false,minVersion:FALLBACK_MIN_SDK_VERSION,packageName:packageName,stableVersion:null}}const coercedVersion=semver.coerce(actualVersion);const needsUpgrade=coercedVersion?semver.lt(coercedVersion,FALLBACK_MIN_SDK_VERSION):false;return{installed:true,version:actualVersion,needsUpgrade:needsUpgrade,minVersion:FALLBACK_MIN_SDK_VERSION,packageName:packageName,stableVersion:null}}catch{return{installed:false,version:null,needsUpgrade:false,minVersion:FALLBACK_MIN_SDK_VERSION,packageName:packageName,
5
+ stableVersion:null}}}export function printSdkUpgradeWarning(result){if(!result.needsUpgrade)return;const yellow="";const reset="";const bold="";const packageName=result.packageName||"@lovrabet/sdk";const stableVersion=result.stableVersion||result.minVersion;const upgradeCommand=`npm install ${packageName}@${stableVersion||"latest"}`;console.log();console.log(`${yellow}${bold}↪ SDK update available${reset}`);console.log(`${yellow} Current version: ${packageName}@${result.version}${reset}`);console.log(`${yellow} Stable version: ${stableVersion}${reset}`);console.log(`${yellow} Upgrade command: ${upgradeCommand}${reset}`);console.log()}
@@ -1 +1,4 @@
1
- (function(_0x1833ce,_0x5355a9){const _0x5dd22f=a359_0x2e0d,_0xd32019=_0x1833ce();while(!![]){try{const _0x474ccb=-parseInt(_0x5dd22f(0x203))/0x1*(-parseInt(_0x5dd22f(0x1e3))/0x2)+-parseInt(_0x5dd22f(0x200))/0x3*(-parseInt(_0x5dd22f(0x1ea))/0x4)+-parseInt(_0x5dd22f(0x209))/0x5+parseInt(_0x5dd22f(0x1e2))/0x6*(-parseInt(_0x5dd22f(0x1f6))/0x7)+-parseInt(_0x5dd22f(0x206))/0x8*(-parseInt(_0x5dd22f(0x1ee))/0x9)+-parseInt(_0x5dd22f(0x1ed))/0xa*(parseInt(_0x5dd22f(0x1e9))/0xb)+parseInt(_0x5dd22f(0x1ff))/0xc*(parseInt(_0x5dd22f(0x1f1))/0xd);if(_0x474ccb===_0x5355a9)break;else _0xd32019['push'](_0xd32019['shift']());}catch(_0x3835b5){_0xd32019['push'](_0xd32019['shift']());}}}(a359_0xb3d6,0xadb87));import{readFileSync}from'node:fs';function a359_0xb3d6(){const _0x2ba510=['\x1b[0m','needsUpgrade','npm\x20install\x20-g\x20','package.json','15096301DOHJVE','68128irELyE','parse','Upgrade\x20command:\x20','10FfSMml','36tkWKKk','\x20\x20\x20Stable\x20version:\x20','\x20\x20\x20Upgrade\x20command:\x20','13RiphLF','belowMinimum','\x1b[1m','Current\x20CLI\x20version\x20is\x20below\x20the\x20service\x20compatibility\x20support\x20line.','stableVersion','259lJmJxs','validation','\x20\x20\x20Current\x20CLI\x20version:\x20','currentVersion','minimumVersionMessage','Current\x20version:\x20','upgradeMessage','version','minimumVersion','7793796dEIBTZ','219LFHfSA','1.0.0','↪\x20Critical\x20CLI\x20upgrade\x20required','208333nwTyuU','utf-8','../..','782616czOkFo','\x1b[33m','\x20\x20\x20','2019795AhlPKf','coerce','\x20\x20\x20Minimum\x20supported:\x20','738cUtrMM','2ZwmhLj','log'];a359_0xb3d6=function(){return _0x2ba510;};return a359_0xb3d6();}import{resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import a359_0x144073 from'semver';import{getCliVersionPolicy}from'../utils/cli-version-policy.js';function a359_0x2e0d(_0x5390a4,_0x561aad){_0x5390a4=_0x5390a4-0x1e0;const _0xb3d61f=a359_0xb3d6();let _0x2e0de1=_0xb3d61f[_0x5390a4];return _0x2e0de1;}import{NPM_PACKAGE_NAME}from'../constant/cli.js';import{CliErrors}from'../errors.js';export function getCliUpgradeCommand(_0x5dba97){const _0x4250ea=a359_0x2e0d,_0x4ffa8c=_0x5dba97[_0x4250ea(0x1f5)]||'latest';return _0x4250ea(0x1e7)+NPM_PACKAGE_NAME+'@'+_0x4ffa8c;}function getCurrentCliVersion(){const _0x43a260=a359_0x2e0d;try{const _0x4428d7=fileURLToPath(import.meta.url),_0x57e4bf=resolve(dirname(_0x4428d7),_0x43a260(0x205)),_0x3cd549=resolve(_0x57e4bf,_0x43a260(0x1e8)),_0x1a6fb2=JSON[_0x43a260(0x1eb)](readFileSync(_0x3cd549,_0x43a260(0x204)));return _0x1a6fb2[_0x43a260(0x1fd)]||_0x43a260(0x201);}catch{return _0x43a260(0x201);}}export async function checkCliVersion(){const _0x2aa622=a359_0x2e0d,_0x194356=getCurrentCliVersion(),_0x1e6783=await getCliVersionPolicy(),_0x4f78d7=_0x1e6783?.[_0x2aa622(0x1f5)]||null,_0x43ef48=_0x1e6783?.[_0x2aa622(0x1fe)]||null;let _0x2cbd0a=![],_0x53c0a3=![];const _0x5db7ef=a359_0x144073[_0x2aa622(0x1e0)](_0x194356);if(_0x5db7ef&&_0x4f78d7)try{const _0x2fbe80=a359_0x144073[_0x2aa622(0x1e0)](_0x4f78d7);if(_0x2fbe80)_0x2cbd0a=a359_0x144073['lt'](_0x5db7ef,_0x2fbe80);}catch{}if(_0x5db7ef&&_0x43ef48)try{const _0x42233d=a359_0x144073[_0x2aa622(0x1e0)](_0x43ef48);if(_0x42233d)_0x53c0a3=a359_0x144073['lt'](_0x5db7ef,_0x42233d);}catch{}return _0x53c0a3&&(_0x2cbd0a=!![]),{'currentVersion':_0x194356,'stableVersion':_0x4f78d7,'minimumVersion':_0x43ef48,'needsUpgrade':_0x2cbd0a,'belowMinimum':_0x53c0a3,'isPreRelease':![],'upgradeMessage':_0x1e6783?.[_0x2aa622(0x1fc)],'minimumVersionMessage':_0x1e6783?.['minimumVersionMessage']};}export function printCliUpgradeWarning(_0x3e3028){const _0x5d681e=a359_0x2e0d;if(!_0x3e3028[_0x5d681e(0x1e6)]&&!_0x3e3028[_0x5d681e(0x1f2)])return;const _0x28c1d5='\x1b[31m',_0x1d8ea4=_0x5d681e(0x207),_0xec4528=_0x5d681e(0x1e5),_0xec386b=_0x5d681e(0x1f3),_0x126cde=getCliUpgradeCommand(_0x3e3028);console[_0x5d681e(0x1e4)](),_0x3e3028[_0x5d681e(0x1f2)]?(console[_0x5d681e(0x1e4)](''+_0x28c1d5+_0xec386b+_0x5d681e(0x202)+_0xec4528),console['log'](_0x28c1d5+_0x5d681e(0x1f8)+_0x3e3028[_0x5d681e(0x1f9)]+_0xec4528),_0x3e3028[_0x5d681e(0x1fe)]&&console[_0x5d681e(0x1e4)](_0x28c1d5+_0x5d681e(0x1e1)+_0x3e3028[_0x5d681e(0x1fe)]+_0xec4528),_0x3e3028[_0x5d681e(0x1f5)]&&_0x3e3028[_0x5d681e(0x1f5)]!==_0x3e3028['minimumVersion']&&console['log'](_0x28c1d5+'\x20\x20\x20Recommended\x20stable:\x20'+_0x3e3028[_0x5d681e(0x1f5)]+_0xec4528),_0x3e3028['minimumVersionMessage']&&console[_0x5d681e(0x1e4)](_0x28c1d5+_0x5d681e(0x208)+_0x3e3028['minimumVersionMessage']+_0xec4528),console[_0x5d681e(0x1e4)](_0x28c1d5+_0x5d681e(0x1f0)+_0x126cde+_0xec4528)):(console['log'](''+_0x1d8ea4+_0xec386b+'↪\x20New\x20version\x20available'+_0xec4528),console[_0x5d681e(0x1e4)](_0x1d8ea4+_0x5d681e(0x1f8)+_0x3e3028[_0x5d681e(0x1f9)]+_0xec4528),console[_0x5d681e(0x1e4)](_0x1d8ea4+_0x5d681e(0x1ef)+_0x3e3028[_0x5d681e(0x1f5)]+_0xec4528),_0x3e3028[_0x5d681e(0x1fc)]&&console[_0x5d681e(0x1e4)](_0x1d8ea4+'\x20\x20\x20'+_0x3e3028['upgradeMessage']+_0xec4528),console[_0x5d681e(0x1e4)](_0x1d8ea4+_0x5d681e(0x1f0)+_0x126cde+_0xec4528)),console[_0x5d681e(0x1e4)]();}export function assertCliVersionSupported(_0x46d541){const _0x478f64=a359_0x2e0d;if(!_0x46d541[_0x478f64(0x1f2)])return;const _0x48db87=[_0x46d541[_0x478f64(0x1fa)],_0x478f64(0x1fb)+_0x46d541[_0x478f64(0x1f9)],_0x46d541[_0x478f64(0x1fe)]?'Minimum\x20supported:\x20'+_0x46d541[_0x478f64(0x1fe)]:null,_0x478f64(0x1ec)+getCliUpgradeCommand(_0x46d541)]['filter'](Boolean)['join']('\x0a');throw CliErrors[_0x478f64(0x1f7)](_0x478f64(0x1f4),_0x48db87);}
1
+ import{readFileSync}from"node:fs";import{resolve,dirname}from"node:path";import{fileURLToPath}from"node:url";import semver from"semver";import{getCliVersionPolicy}from"../utils/cli-version-policy.js";import{NPM_PACKAGE_NAME}from"../constant/cli.js";import{CliErrors}from"../errors.js";export function getCliUpgradeCommand(result){const targetVersion=result.stableVersion||"latest";return`npm install -g ${NPM_PACKAGE_NAME}@${targetVersion}`}function getCurrentCliVersion(){try{const currentFilePath=fileURLToPath(import.meta.url);const cliRootDir=resolve(dirname(currentFilePath),"../..");const cliPackageJsonPath=resolve(cliRootDir,"package.json");const packageJson=JSON.parse(readFileSync(cliPackageJsonPath,"utf-8"));return packageJson.version||"1.0.0"}catch{return"1.0.0"}}export async function checkCliVersion(){const currentVersion=getCurrentCliVersion();const policy=await getCliVersionPolicy();const stableVersion=policy?.stableVersion||null;const minimumVersion=policy?.minimumVersion||null
2
+ ;let needsUpgrade=false;let belowMinimum=false;const current=semver.coerce(currentVersion);if(current&&stableVersion){try{const stable=semver.coerce(stableVersion);if(stable)needsUpgrade=semver.lt(current,stable)}catch{}}if(current&&minimumVersion){try{const minimum=semver.coerce(minimumVersion);if(minimum)belowMinimum=semver.lt(current,minimum)}catch{}}if(belowMinimum){needsUpgrade=true}return{currentVersion:currentVersion,stableVersion:stableVersion,minimumVersion:minimumVersion,needsUpgrade:needsUpgrade,belowMinimum:belowMinimum,isPreRelease:false,upgradeMessage:policy?.upgradeMessage,minimumVersionMessage:policy?.minimumVersionMessage}}export function printCliUpgradeWarning(result){if(!result.needsUpgrade&&!result.belowMinimum)return;const red="";const yellow="";const reset="";const bold="";const upgradeCommand=getCliUpgradeCommand(result);console.log();if(result.belowMinimum){console.log(`${red}${bold}↪ Critical CLI upgrade required${reset}`)
3
+ ;console.log(`${red} Current CLI version: ${result.currentVersion}${reset}`);if(result.minimumVersion){console.log(`${red} Minimum supported: ${result.minimumVersion}${reset}`)}if(result.stableVersion&&result.stableVersion!==result.minimumVersion){console.log(`${red} Recommended stable: ${result.stableVersion}${reset}`)}if(result.minimumVersionMessage){console.log(`${red} ${result.minimumVersionMessage}${reset}`)}console.log(`${red} Upgrade command: ${upgradeCommand}${reset}`)}else{console.log(`${yellow}${bold}↪ New version available${reset}`);console.log(`${yellow} Current CLI version: ${result.currentVersion}${reset}`);console.log(`${yellow} Stable version: ${result.stableVersion}${reset}`);if(result.upgradeMessage){console.log(`${yellow} ${result.upgradeMessage}${reset}`)}console.log(`${yellow} Upgrade command: ${upgradeCommand}${reset}`)}console.log()}export function assertCliVersionSupported(result){if(!result.belowMinimum)return
4
+ ;const detail=[result.minimumVersionMessage,`Current version: ${result.currentVersion}`,result.minimumVersion?`Minimum supported: ${result.minimumVersion}`:null,`Upgrade command: ${getCliUpgradeCommand(result)}`].filter(Boolean).join("\n");throw CliErrors.validation("Current CLI version is below the service compatibility support line.",detail)}
@@ -1 +1,3 @@
1
- (function(_0x29ad69,_0x4d1422){const _0x4d4374=a360_0x3cfa,_0x1b277b=_0x29ad69();while(!![]){try{const _0x2efc60=-parseInt(_0x4d4374(0xe6))/0x1+parseInt(_0x4d4374(0xde))/0x2*(-parseInt(_0x4d4374(0xe2))/0x3)+-parseInt(_0x4d4374(0xd9))/0x4+-parseInt(_0x4d4374(0xd8))/0x5+parseInt(_0x4d4374(0xdc))/0x6+parseInt(_0x4d4374(0xdb))/0x7*(parseInt(_0x4d4374(0xdf))/0x8)+parseInt(_0x4d4374(0xf0))/0x9;if(_0x2efc60===_0x4d1422)break;else _0x1b277b['push'](_0x1b277b['shift']());}catch(_0x46624d){_0x1b277b['push'](_0x1b277b['shift']());}}}(a360_0x9584,0x63076));import{getCliVersionPolicyUrl,getProjectTemplateAssetBaseUrl,getProjectTemplateLegacyAssetBaseUrl}from'../constant/cdn.js';import a360_0x3ea680 from'semver';function a360_0x9584(){const _0x3cc78a=['8ribgmu','string','trim','3uDDRFC','object','cli','projectTemplate','316065Nfkeje','minimumVersionMessage','upgradeMessage','beta','minimumVersion','now','length','stableVersion','json','valid','24555195LgfqrT','latestVersion','3170675DmierP','3122340ZYrkZv','abort','849527JZxNeH','60462hLxrBu','recommendedVersion','1446772meBTKA'];a360_0x9584=function(){return _0x3cc78a;};return a360_0x9584();}const CACHE_TTL=0x5*0x3c*0x3e8,FAILURE_CACHE_TTL=0x3c*0x3e8,FETCH_TIMEOUT_MS=0xbb8;export function isBetaCliVersion(_0x2855be){const _0x14b03e=a360_0x3cfa,_0x5879ef=a360_0x3ea680[_0x14b03e(0xef)](_0x2855be);return _0x5879ef?a360_0x3ea680['prerelease'](_0x5879ef)?.[0x0]===_0x14b03e(0xe9):![];}export function resolveProjectTemplateDescriptor(_0x4597f9,_0x232906){const _0x2589da=a360_0x3cfa;if(isBetaCliVersion(_0x232906))return _0x4597f9[_0x2589da(0xe9)]?.[_0x2589da(0xe5)]??_0x4597f9['projectTemplate'];return _0x4597f9[_0x2589da(0xe5)];}function pickString(_0x566888){const _0x5d8f62=a360_0x3cfa;return typeof _0x566888===_0x5d8f62(0xe0)&&_0x566888[_0x5d8f62(0xe1)]()[_0x5d8f62(0xec)]>0x0?_0x566888[_0x5d8f62(0xe1)]():null;}function a360_0x3cfa(_0xce3f29,_0x362980){_0xce3f29=_0xce3f29-0xd7;const _0x9584af=a360_0x9584();let _0x3cfa42=_0x9584af[_0xce3f29];return _0x3cfa42;}function normalizeCliVersionPolicy(_0x2357aa){const _0x17f2ec=a360_0x3cfa;if(!_0x2357aa||typeof _0x2357aa!==_0x17f2ec(0xe3))return null;const _0x557cec=_0x2357aa,_0x48ed9e=_0x557cec['cli']&&typeof _0x557cec[_0x17f2ec(0xe4)]===_0x17f2ec(0xe3)?_0x557cec['cli']:_0x557cec,_0x4802fa=pickString(_0x48ed9e[_0x17f2ec(0xed)])||pickString(_0x48ed9e[_0x17f2ec(0xd7)])||pickString(_0x48ed9e[_0x17f2ec(0xdd)]),_0x325f0d=pickString(_0x48ed9e[_0x17f2ec(0xea)])||pickString(_0x48ed9e['minVersion']);if(!_0x4802fa&&!_0x325f0d)return null;return{'stableVersion':_0x4802fa,'minimumVersion':_0x325f0d,'upgradeMessage':pickString(_0x48ed9e[_0x17f2ec(0xe8)])||undefined,'minimumVersionMessage':pickString(_0x48ed9e[_0x17f2ec(0xe7)])||undefined};}async function fetchRabetbaseCdnConfigAt(_0x12f8f0){const _0x3e28d8=a360_0x3cfa,_0x54f82f=new AbortController(),_0x560398=setTimeout(()=>_0x54f82f[_0x3e28d8(0xda)](),FETCH_TIMEOUT_MS);try{const _0x211ff7=await fetch(_0x12f8f0,{'headers':{'Accept':'application/json'},'signal':_0x54f82f['signal']});if(!_0x211ff7['ok'])return null;const _0x28f4f6=await _0x211ff7[_0x3e28d8(0xee)]();return _0x28f4f6&&typeof _0x28f4f6==='object'?_0x28f4f6:null;}catch{return null;}finally{clearTimeout(_0x560398);}}export async function fetchRabetbaseCdnConfig(){return fetchRabetbaseCdnConfigAt(getCliVersionPolicyUrl());}export async function fetchProjectTemplateCdnConfig(){const _0x3ccd1b=await getRabetbaseCdnConfig();return _0x3ccd1b?{'config':_0x3ccd1b,'assetBaseUrl':getProjectTemplateAssetBaseUrl(),'legacyAssetBaseUrl':getProjectTemplateLegacyAssetBaseUrl()}:null;}export async function fetchCliVersionPolicy(){return normalizeCliVersionPolicy(await fetchRabetbaseCdnConfig());}let cachedConfig=null,cacheTime=0x0,hasCachedConfig=![];export async function getRabetbaseCdnConfig(){const _0x40623a=a360_0x3cfa,_0x11469f=Date[_0x40623a(0xeb)]();if(hasCachedConfig){const _0x4bba37=cachedConfig?CACHE_TTL:FAILURE_CACHE_TTL;if(_0x11469f-cacheTime<_0x4bba37)return cachedConfig;}return cachedConfig=await fetchRabetbaseCdnConfig(),cacheTime=_0x11469f,hasCachedConfig=!![],cachedConfig;}export async function getCliVersionPolicy(){return normalizeCliVersionPolicy(await getRabetbaseCdnConfig());}export function clearCliVersionPolicyCache(){cachedConfig=null,cacheTime=0x0,hasCachedConfig=![];}
1
+ import{getCliVersionPolicyUrl,getProjectTemplateAssetBaseUrl,getProjectTemplateLegacyAssetBaseUrl}from"../constant/cdn.js";import semver from"semver";const CACHE_TTL=5*60*1e3;const FAILURE_CACHE_TTL=60*1e3;const FETCH_TIMEOUT_MS=3e3;export function isBetaCliVersion(version){const parsed=semver.valid(version);return parsed?semver.prerelease(parsed)?.[0]==="beta":false}export function resolveProjectTemplateDescriptor(config,cliVersion){if(isBetaCliVersion(cliVersion)){return config.beta?.projectTemplate??config.projectTemplate}return config.projectTemplate}function pickString(value){return typeof value==="string"&&value.trim().length>0?value.trim():null}function normalizeCliVersionPolicy(raw){if(!raw||typeof raw!=="object")return null;const source=raw;const cliSource=source.cli&&typeof source.cli==="object"?source.cli:source;const stableVersion=pickString(cliSource.stableVersion)||pickString(cliSource.latestVersion)||pickString(cliSource.recommendedVersion)
2
+ ;const minimumVersion=pickString(cliSource.minimumVersion)||pickString(cliSource.minVersion);if(!stableVersion&&!minimumVersion)return null;return{stableVersion:stableVersion,minimumVersion:minimumVersion,upgradeMessage:pickString(cliSource.upgradeMessage)||undefined,minimumVersionMessage:pickString(cliSource.minimumVersionMessage)||undefined}}async function fetchRabetbaseCdnConfigAt(url){const controller=new AbortController;const timeoutId=setTimeout(()=>controller.abort(),FETCH_TIMEOUT_MS);try{const response=await fetch(url,{headers:{Accept:"application/json"},signal:controller.signal});if(!response.ok)return null;const parsed=await response.json();return parsed&&typeof parsed==="object"?parsed:null}catch{return null}finally{clearTimeout(timeoutId)}}export async function fetchRabetbaseCdnConfig(){return fetchRabetbaseCdnConfigAt(getCliVersionPolicyUrl())}export async function fetchProjectTemplateCdnConfig(){const config=await getRabetbaseCdnConfig();return config?{config:config,
3
+ assetBaseUrl:getProjectTemplateAssetBaseUrl(),legacyAssetBaseUrl:getProjectTemplateLegacyAssetBaseUrl()}:null}export async function fetchCliVersionPolicy(){return normalizeCliVersionPolicy(await fetchRabetbaseCdnConfig())}let cachedConfig=null;let cacheTime=0;let hasCachedConfig=false;export async function getRabetbaseCdnConfig(){const now=Date.now();if(hasCachedConfig){const ttl=cachedConfig?CACHE_TTL:FAILURE_CACHE_TTL;if(now-cacheTime<ttl)return cachedConfig}cachedConfig=await fetchRabetbaseCdnConfig();cacheTime=now;hasCachedConfig=true;return cachedConfig}export async function getCliVersionPolicy(){return normalizeCliVersionPolicy(await getRabetbaseCdnConfig())}export function clearCliVersionPolicyCache(){cachedConfig=null;cacheTime=0;hasCachedConfig=false}
@@ -1 +1 @@
1
- const a361_0x492723=a361_0xcb8d;(function(_0x56a22c,_0x244169){const _0xcbedd0=a361_0xcb8d,_0x2242d0=_0x56a22c();while(!![]){try{const _0x39908f=-parseInt(_0xcbedd0(0x135))/0x1+-parseInt(_0xcbedd0(0x13b))/0x2*(-parseInt(_0xcbedd0(0x138))/0x3)+parseInt(_0xcbedd0(0x13c))/0x4*(parseInt(_0xcbedd0(0x133))/0x5)+parseInt(_0xcbedd0(0x13d))/0x6+-parseInt(_0xcbedd0(0x137))/0x7+parseInt(_0xcbedd0(0x134))/0x8+-parseInt(_0xcbedd0(0x13a))/0x9*(parseInt(_0xcbedd0(0x139))/0xa);if(_0x39908f===_0x244169)break;else _0x2242d0['push'](_0x2242d0['shift']());}catch(_0x3c193f){_0x2242d0['push'](_0x2242d0['shift']());}}}(a361_0x487a,0xda2c5));import{initEnv}from'../constant/env.js';function a361_0xcb8d(_0x1bb5fb,_0x1cd1ed){_0x1bb5fb=_0x1bb5fb-0x132;const _0x487ad7=a361_0x487a();let _0xcb8d4e=_0x487ad7[_0x1bb5fb];return _0xcb8d4e;}import{readRawConfig,getConfigAppCode as a361_0x427d5f,getMultiAppConfigs as a361_0x56a9ea,getTemplateBaseUrl as a361_0x1b7946}from'../context.js';export{getProjectConfigPath,getGlobalConfigPath}from'../context.js';export{isInProject}from'../context.js';export function readConfig(_0x25376b){const _0x4e33c0=a361_0xcb8d,_0xbbd91=readRawConfig(_0x25376b);return _0xbbd91[_0x4e33c0(0x136)]&&typeof _0xbbd91[_0x4e33c0(0x136)]==='string'&&initEnv(_0xbbd91[_0x4e33c0(0x136)]),_0xbbd91;}function a361_0x487a(){const _0x127890=['1336eGDdZD','3737352OFVXQP','project','11665aKuarN','11513024JCnxoZ','692702WKyWvU','env','11253221kqWjtf','51sYfiKG','420OMYFRT','242676YbmZUb','174728qFDNyW'];a361_0x487a=function(){return _0x127890;};return a361_0x487a();}export function getConfigAppCode(){return a361_0x427d5f();}export function getMultiAppConfigs(_0x4abd00=a361_0x492723(0x132)){return a361_0x56a9ea(_0x4abd00);}export function getTemplateBaseUrl(){return a361_0x1b7946();}
1
+ import{initEnv}from"../constant/env.js";import{readRawConfig,getConfigAppCode as getConfigAppCodeFromContext,getMultiAppConfigs as getMultiAppConfigsFromContext,getTemplateBaseUrl as getTemplateBaseUrlFromContext}from"../context.js";export{getProjectConfigPath,getGlobalConfigPath}from"../context.js";export{isInProject}from"../context.js";export function readConfig(projectRoot){const config=readRawConfig(projectRoot);if(config.env&&typeof config.env==="string"){initEnv(config.env)}return config}export function getConfigAppCode(){return getConfigAppCodeFromContext()}export function getMultiAppConfigs(scope="project"){return getMultiAppConfigsFromContext(scope)}export function getTemplateBaseUrl(){return getTemplateBaseUrlFromContext()}
@@ -1 +1 @@
1
- function a362_0x4f81(){const _0x4cb387=['isFinite','72317QDeENA','358524oigcIa','object','225734PFPjYE','trim','579068VPGXrO','417024eBfkez','string','10vfjaoM','219790SBPPBq','189rfaSLv','2141670otYtQa','number','344hbzFbV'];a362_0x4f81=function(){return _0x4cb387;};return a362_0x4f81();}(function(_0x3acca8,_0x36fae4){const _0x252424=a362_0x48e6,_0x3c25c7=_0x3acca8();while(!![]){try{const _0x45aae1=parseInt(_0x252424(0xac))/0x1+parseInt(_0x252424(0xb8))/0x2+-parseInt(_0x252424(0xb6))/0x3+-parseInt(_0x252424(0xba))/0x4*(-parseInt(_0x252424(0xae))/0x5)+-parseInt(_0x252424(0xb1))/0x6+parseInt(_0x252424(0xb5))/0x7*(parseInt(_0x252424(0xb3))/0x8)+parseInt(_0x252424(0xb0))/0x9*(-parseInt(_0x252424(0xaf))/0xa);if(_0x45aae1===_0x36fae4)break;else _0x3c25c7['push'](_0x3c25c7['shift']());}catch(_0x254f0f){_0x3c25c7['push'](_0x3c25c7['shift']());}}}(a362_0x4f81,0x4f80e));function a362_0x48e6(_0x248e88,_0x52f629){_0x248e88=_0x248e88-0xac;const _0x4f81e2=a362_0x4f81();let _0x48e629=_0x4f81e2[_0x248e88];return _0x48e629;}function toFiniteNumber(_0x384412){const _0x25db72=a362_0x48e6;if(typeof _0x384412===_0x25db72(0xb2)&&Number[_0x25db72(0xb4)](_0x384412))return _0x384412;if(typeof _0x384412===_0x25db72(0xad)){const _0x4674f6=_0x384412[_0x25db72(0xb9)]();if(!_0x4674f6)return undefined;const _0x59421d=Number(_0x4674f6);if(Number[_0x25db72(0xb4)](_0x59421d))return _0x59421d;}return undefined;}export function normalizeEntityWithIdResponse(_0x4e4f37){const _0x5d148f=a362_0x48e6,_0x5add98=toFiniteNumber(_0x4e4f37);if(_0x5add98!==undefined)return{'id':_0x5add98,'entity':{'id':_0x5add98}};if(!_0x4e4f37||typeof _0x4e4f37!==_0x5d148f(0xb7))return{'id':undefined,'entity':{}};const _0x58edd5={..._0x4e4f37},_0x412001=toFiniteNumber(_0x58edd5['id']);return _0x412001!==undefined&&(_0x58edd5['id']=_0x412001),{'id':_0x412001,'entity':_0x58edd5};}
1
+ function toFiniteNumber(value){if(typeof value==="number"&&Number.isFinite(value)){return value}if(typeof value==="string"){const text=value.trim();if(!text)return undefined;const parsed=Number(text);if(Number.isFinite(parsed))return parsed}return undefined}export function normalizeEntityWithIdResponse(raw){const primitiveId=toFiniteNumber(raw);if(primitiveId!==undefined){return{id:primitiveId,entity:{id:primitiveId}}}if(!raw||typeof raw!=="object"){return{id:undefined,entity:{}}}const entity={...raw};const id=toFiniteNumber(entity.id);if(id!==undefined){entity.id=id}return{id:id,entity:entity}}
@@ -1 +1 @@
1
- (function(_0x477263,_0x1d02ba){const _0x50e5b3=a363_0x538c,_0x33c99c=_0x477263();while(!![]){try{const _0x3272ee=parseInt(_0x50e5b3(0x19d))/0x1*(parseInt(_0x50e5b3(0x1a4))/0x2)+-parseInt(_0x50e5b3(0x19e))/0x3*(parseInt(_0x50e5b3(0x19f))/0x4)+parseInt(_0x50e5b3(0x1a5))/0x5+-parseInt(_0x50e5b3(0x1a0))/0x6+parseInt(_0x50e5b3(0x19c))/0x7+parseInt(_0x50e5b3(0x1a1))/0x8*(parseInt(_0x50e5b3(0x1a2))/0x9)+-parseInt(_0x50e5b3(0x1a3))/0xa*(parseInt(_0x50e5b3(0x1a6))/0xb);if(_0x3272ee===_0x1d02ba)break;else _0x33c99c['push'](_0x33c99c['shift']());}catch(_0xc91df8){_0x33c99c['push'](_0x33c99c['shift']());}}}(a363_0x4678,0xb4832));function a363_0x4678(){const _0x285288=['32PdXwyF','1941417uVdkuq','20vvITXX','1107846SEDHWP','2012495rUHMeV','2286163FbZgDc','2907625iGdbbP','1USBCcn','851826eivllf','4Vttymk','4773978FmIByg'];a363_0x4678=function(){return _0x285288;};return a363_0x4678();}import{existsSync,mkdirSync,copyFileSync,readdirSync,statSync}from'node:fs';import{join}from'node:path';function a363_0x538c(_0x5cecfa,_0x4dbd12){_0x5cecfa=_0x5cecfa-0x19c;const _0x4678b2=a363_0x4678();let _0x538ce7=_0x4678b2[_0x5cecfa];return _0x538ce7;}export async function copyDir(_0x3c2a8b,_0x4d9781){const _0x1c30ef=statSync(_0x3c2a8b);if(_0x1c30ef['isDirectory']()){!existsSync(_0x4d9781)&&mkdirSync(_0x4d9781,{'recursive':!![]});const _0x2839dd=readdirSync(_0x3c2a8b);for(const _0x43116e of _0x2839dd){await copyDir(join(_0x3c2a8b,_0x43116e),join(_0x4d9781,_0x43116e));}}else copyFileSync(_0x3c2a8b,_0x4d9781);}export function ensureDir(_0x1cf3de){!existsSync(_0x1cf3de)&&mkdirSync(_0x1cf3de,{'recursive':!![]});}export function pathExists(_0x473c8e){return existsSync(_0x473c8e);}
1
+ import{existsSync,mkdirSync,copyFileSync,readdirSync,statSync}from"node:fs";import{join}from"node:path";export async function copyDir(src,dest){const stat=statSync(src);if(stat.isDirectory()){if(!existsSync(dest)){mkdirSync(dest,{recursive:true})}const files=readdirSync(src);for(const file of files){await copyDir(join(src,file),join(dest,file))}}else{copyFileSync(src,dest)}}export function ensureDir(dir){if(!existsSync(dir)){mkdirSync(dir,{recursive:true})}}export function pathExists(path){return existsSync(path)}
@@ -1 +1,3 @@
1
- const a364_0x3ed17a=a364_0x4580;(function(_0x456134,_0x1d87ff){const _0xc2adae=a364_0x4580,_0x16b141=_0x456134();while(!![]){try{const _0x467408=parseInt(_0xc2adae(0x1ff))/0x1*(-parseInt(_0xc2adae(0x1e6))/0x2)+parseInt(_0xc2adae(0x1f0))/0x3+-parseInt(_0xc2adae(0x1e2))/0x4*(-parseInt(_0xc2adae(0x1da))/0x5)+-parseInt(_0xc2adae(0x1f8))/0x6*(parseInt(_0xc2adae(0x1f9))/0x7)+-parseInt(_0xc2adae(0x1f5))/0x8+parseInt(_0xc2adae(0x1db))/0x9*(parseInt(_0xc2adae(0x1f1))/0xa)+parseInt(_0xc2adae(0x1e4))/0xb;if(_0x467408===_0x1d87ff)break;else _0x16b141['push'](_0x16b141['shift']());}catch(_0xfcc407){_0x16b141['push'](_0x16b141['shift']());}}}(a364_0x22d8,0x94d1b));import{mkdirSync,writeFileSync}from'node:fs';function a364_0x4580(_0x36b406,_0x47296a){_0x36b406=_0x36b406-0x1da;const _0x22d850=a364_0x22d8();let _0x4580ba=_0x22d850[_0x36b406];return _0x4580ba;}import{dirname,join}from'node:path';import{homedir}from'node:os';import{getTemplateBaseUrl}from'../utils/config.js';function getGuidesCdnUrl(){const _0x4129d8=getTemplateBaseUrl();return _0x4129d8+'/skills/guides.json';}const CACHE_DIR=join(homedir(),a364_0x3ed17a(0x1eb),a364_0x3ed17a(0x1f4));export async function fetchGuidesFromCDN(){const _0x3440ac=a364_0x3ed17a,_0x26e875=getGuidesCdnUrl(),_0x171f61=await fetch(_0x26e875,{'headers':{'Accept':_0x3440ac(0x1ee)}});if(!_0x171f61['ok'])throw new Error('CDN\x20request\x20failed:\x20'+_0x171f61[_0x3440ac(0x1f7)]+'\x20'+_0x171f61[_0x3440ac(0x1e5)]);const _0x349f57=await _0x171f61[_0x3440ac(0x1fd)]();if(!_0x349f57[_0x3440ac(0x1ef)]||typeof _0x349f57['guides']!==_0x3440ac(0x1f6))throw new Error(_0x3440ac(0x1ea));return _0x349f57;}function a364_0x22d8(){const _0x23f91b=['4167445YAiICQ','5499WDkHqr','lastUpdated','utf-8','CDN\x20data\x20is\x20missing\x20skillTemplate','path','title','.lovrabet/skill/guides','4LJyxke','keys','18528961QufMVL','statusText','10UrGRnE','skillTemplate','length','entries','CDN\x20returned\x20invalid\x20data','.lovrabet','extendContent','\x0a\x0a>更新时间:','application/json','guides','246708ZIUTro','11530IXBhUb','map','replace','cache','8064160CClHgP','object','status','7734CQvJEd','3878WmXFSu','trimEnd','.md','content','json','push','194594uKKgVL'];a364_0x22d8=function(){return _0x23f91b;};return a364_0x22d8();}export function writeGuidesToProject(_0x4dad38,_0x2542e0,_0x553be8=a364_0x3ed17a(0x1e1),_0x25f6c9){const _0x58f2a1=a364_0x3ed17a,_0x257f9c=join(_0x2542e0,_0x553be8);mkdirSync(_0x257f9c,{'recursive':!![]});for(const [_0x12f170,_0x3bbbb0]of Object[_0x58f2a1(0x1e9)](_0x4dad38[_0x58f2a1(0x1ef)])){let _0x12a54f=_0x3bbbb0[_0x58f2a1(0x1fc)];_0x3bbbb0[_0x58f2a1(0x1dc)]&&(_0x12a54f=appendUpdateTime(_0x12a54f,_0x3bbbb0['lastUpdated'])),writeFileSync(join(_0x257f9c,_0x12f170+_0x58f2a1(0x1fb)),_0x12a54f,_0x58f2a1(0x1dd));}}export function appendUpdateTime(_0x28e261,_0x4470a5){const _0x53650b=a364_0x3ed17a;return _0x28e261=_0x28e261['replace'](/\n*>更新时间:.*$/m,''),_0x28e261[_0x53650b(0x1fa)]()+(_0x53650b(0x1ed)+_0x4470a5);}export function getSkillTemplate(_0x369606){const _0x53f659=a364_0x3ed17a;return _0x369606['skillTemplate']?.[_0x53f659(0x1fc)]||'';}export function appendExtendContents(_0x4b5e94,_0xd50716,_0x456171){const _0x44334e=a364_0x3ed17a,_0x56f291=[];for(const [,_0x55e49d]of Object[_0x44334e(0x1e9)](_0xd50716[_0x44334e(0x1ef)])){_0x55e49d[_0x44334e(0x1ec)]&&_0x56f291[_0x44334e(0x1fe)](_0x55e49d[_0x44334e(0x1ec)][_0x44334e(0x1fa)]());}if(_0x56f291['length']===0x0)return _0x4b5e94;return _0x4b5e94['trimEnd']()+'\x0a\x0a'+_0x56f291['join']('\x0a\x0a')+'\x0a';}export function writeSkillFile(_0x324f19,_0xe6c009,_0x6ba2dc){const _0x101c90=a364_0x3ed17a,_0x1b37a0=getSkillTemplate(_0x324f19);if(!_0x1b37a0)throw new Error(_0x101c90(0x1de));const _0x26d3a2=dirname(_0xe6c009);mkdirSync(_0x26d3a2,{'recursive':!![]});let _0x32fa0a=_0x1b37a0[_0x101c90(0x1f3)](/\{\{IDE_NAME\}\}/g,_0x6ba2dc);_0x32fa0a=appendExtendContents(_0x32fa0a,_0x324f19),_0x324f19['skillTemplate']['lastUpdated']&&(_0x32fa0a=appendUpdateTime(_0x32fa0a,_0x324f19[_0x101c90(0x1e7)][_0x101c90(0x1dc)])),writeFileSync(_0xe6c009,_0x32fa0a,_0x101c90(0x1dd));}export async function installGuides(_0x5ad293){const _0x5b4a72=a364_0x3ed17a,_0x577b56=await fetchGuidesFromCDN();return writeGuidesToProject(_0x577b56,_0x5ad293),Object[_0x5b4a72(0x1e3)](_0x577b56['guides'])[_0x5b4a72(0x1e8)];}export function getGuidesSummary(_0x3b3989){const _0x25bf79=a364_0x3ed17a;return Object[_0x25bf79(0x1e9)](_0x3b3989[_0x25bf79(0x1ef)])[_0x25bf79(0x1f2)](([_0x355c7b,_0x1ca6c9])=>({'key':_0x355c7b,'title':_0x1ca6c9[_0x25bf79(0x1e0)],'path':_0x1ca6c9[_0x25bf79(0x1df)]}));}
1
+ import{mkdirSync,writeFileSync}from"node:fs";import{dirname,join}from"node:path";import{homedir}from"node:os";import{getTemplateBaseUrl}from"../utils/config.js";function getGuidesCdnUrl(){const baseUrl=getTemplateBaseUrl();return`${baseUrl}/skills/guides.json`}const CACHE_DIR=join(homedir(),".lovrabet","cache");export async function fetchGuidesFromCDN(){const cdnUrl=getGuidesCdnUrl();const response=await fetch(cdnUrl,{headers:{Accept:"application/json"}});if(!response.ok){throw new Error(`CDN request failed: ${response.status} ${response.statusText}`)}const data=await response.json();if(!data.guides||typeof data.guides!=="object"){throw new Error("CDN returned invalid data")}return data}export function writeGuidesToProject(guidesData,projectRoot,basePath=".lovrabet/skill/guides",_providedFlags){const guidesDestDir=join(projectRoot,basePath);mkdirSync(guidesDestDir,{recursive:true});for(const[key,guide]of Object.entries(guidesData.guides)){let content=guide.content
2
+ ;if(guide.lastUpdated){content=appendUpdateTime(content,guide.lastUpdated)}writeFileSync(join(guidesDestDir,`${key}.md`),content,"utf-8")}}export function appendUpdateTime(content,lastUpdated){content=content.replace(/\n*>更新时间:.*$/m,"");return content.trimEnd()+`\n\n>更新时间:${lastUpdated}`}export function getSkillTemplate(guidesData){return guidesData.skillTemplate?.content||""}export function appendExtendContents(content,guidesData,_providedFlags){const extendSections=[];for(const[,guide]of Object.entries(guidesData.guides)){if(guide.extendContent){extendSections.push(guide.extendContent.trimEnd())}}if(extendSections.length===0){return content}return content.trimEnd()+"\n\n"+extendSections.join("\n\n")+"\n"}export function writeSkillFile(guidesData,destPath,ideDisplayName){const template=getSkillTemplate(guidesData);if(!template){throw new Error("CDN data is missing skillTemplate")}const destDir=dirname(destPath);mkdirSync(destDir,{recursive:true})
3
+ ;let content=template.replace(/\{\{IDE_NAME\}\}/g,ideDisplayName);content=appendExtendContents(content,guidesData);if(guidesData.skillTemplate.lastUpdated){content=appendUpdateTime(content,guidesData.skillTemplate.lastUpdated)}writeFileSync(destPath,content,"utf-8")}export async function installGuides(projectRoot){const guidesData=await fetchGuidesFromCDN();writeGuidesToProject(guidesData,projectRoot);return Object.keys(guidesData.guides).length}export function getGuidesSummary(guidesData){return Object.entries(guidesData.guides).map(([key,guide])=>({key:key,title:guide.title,path:guide.path}))}
@@ -1 +1,2 @@
1
- function a365_0x51e5(){const _0x5cf1e3=['380052hrWLXe','name','14qQmTTg','Request\x20failed','get','77SAfMyL','application/json','message','statusText','ENOTFOUND','1176232IFNQIy','headers','includes','2800020jenljO','content-type','61118vSipCU','AbortError','42856495CVvaul','ECONNRESET','1769136JvvgCX','json','text','status','460FXNZso','signal','3221820uoOSYQ','fetch','15jcbhiV','log','\x20in\x20'];a365_0x51e5=function(){return _0x5cf1e3;};return a365_0x51e5();}(function(_0x49842e,_0x1ab6be){const _0x518b44=a365_0x34e2,_0xfc5099=_0x49842e();while(!![]){try{const _0x171f81=-parseInt(_0x518b44(0x1b9))/0x1*(-parseInt(_0x518b44(0x1ca))/0x2)+parseInt(_0x518b44(0x1c3))/0x3+-parseInt(_0x518b44(0x1bd))/0x4*(parseInt(_0x518b44(0x1c5))/0x5)+parseInt(_0x518b44(0x1b7))/0x6+-parseInt(_0x518b44(0x1cd))/0x7*(parseInt(_0x518b44(0x1b4))/0x8)+parseInt(_0x518b44(0x1c8))/0x9*(-parseInt(_0x518b44(0x1c1))/0xa)+parseInt(_0x518b44(0x1bb))/0xb;if(_0x171f81===_0x1ab6be)break;else _0xfc5099['push'](_0xfc5099['shift']());}catch(_0x1c9b36){_0xfc5099['push'](_0xfc5099['shift']());}}}(a365_0x51e5,0xeeb9e));export async function httpRequest(_0x580dea,_0x822081={}){const _0x554776=a365_0x34e2,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0x822081;let _0x239855=null;for(let _0x35aa1f=0x0;_0x35aa1f<=retries;_0x35aa1f++){try{const _0x4365ab=new AbortController(),_0x271968=setTimeout(()=>_0x4365ab['abort'](),timeout),_0x1eb44a=await fetch(_0x580dea,{'headers':headers,'signal':_0x4365ab[_0x554776(0x1c2)]});clearTimeout(_0x271968);let _0xbb312c;const _0x563c99=_0x1eb44a[_0x554776(0x1b5)][_0x554776(0x1cc)](_0x554776(0x1b8));return _0x563c99?.[_0x554776(0x1b6)](_0x554776(0x1ce))?_0xbb312c=await _0x1eb44a[_0x554776(0x1be)]():_0xbb312c=await _0x1eb44a['text'](),{'ok':_0x1eb44a['ok'],'status':_0x1eb44a[_0x554776(0x1c0)],'statusText':_0x1eb44a[_0x554776(0x1b2)],'data':_0xbb312c,'headers':_0x1eb44a[_0x554776(0x1b5)],'url':_0x1eb44a['url'],'text':()=>_0x1eb44a[_0x554776(0x1bf)]()};}catch(_0x5d3e0e){_0x239855=_0x5d3e0e instanceof Error?_0x5d3e0e:new Error(String(_0x5d3e0e));if(_0x35aa1f===retries)break;if(shouldRetry(_0x5d3e0e)){console[_0x554776(0x1c6)]('*\x20Request\x20failed;\x20retry\x20'+(_0x35aa1f+0x1)+_0x554776(0x1c7)+retryDelay+'ms...'),await sleep(retryDelay);continue;}else break;}}throw _0x239855||new Error(_0x554776(0x1cb));}function shouldRetry(_0x104a36){const _0x1dd9bf=a365_0x34e2;if(_0x104a36 instanceof Error){if(_0x104a36[_0x1dd9bf(0x1c9)]===_0x1dd9bf(0x1ba))return![];if(_0x104a36[_0x1dd9bf(0x1c9)]==='TypeError'&&_0x104a36['message'][_0x1dd9bf(0x1b6)](_0x1dd9bf(0x1c4)))return!![];if(_0x104a36[_0x1dd9bf(0x1cf)]['includes'](_0x1dd9bf(0x1bc)))return!![];if(_0x104a36['message']['includes'](_0x1dd9bf(0x1b3)))return![];}return![];}function a365_0x34e2(_0x2e677f,_0xe05c8b){_0x2e677f=_0x2e677f-0x1b2;const _0x51e59b=a365_0x51e5();let _0x34e2a8=_0x51e59b[_0x2e677f];return _0x34e2a8;}function sleep(_0x471b7a){return new Promise(_0x5f2fd=>setTimeout(_0x5f2fd,_0x471b7a));}export function validateUrl(_0x387faa){try{return new URL(_0x387faa),!![];}catch{return![];}}
1
+ export async function httpRequest(url,options={}){const{timeout:timeout=3e4,retries:retries=3,retryDelay:retryDelay=1e3,headers:headers={}}=options;let lastError=null;for(let attempt=0;attempt<=retries;attempt++){try{const controller=new AbortController;const timeoutId=setTimeout(()=>controller.abort(),timeout);const response=await fetch(url,{headers:headers,signal:controller.signal});clearTimeout(timeoutId);let data;const contentType=response.headers.get("content-type");if(contentType?.includes("application/json")){data=await response.json()}else{data=await response.text()}return{ok:response.ok,status:response.status,statusText:response.statusText,data:data,headers:response.headers,url:response.url,text:()=>response.text()}}catch(error){lastError=error instanceof Error?error:new Error(String(error));if(attempt===retries){break}if(shouldRetry(error)){console.log(`* Request failed; retry ${attempt+1} in ${retryDelay}ms...`);await sleep(retryDelay);continue}else{break}}}
2
+ throw lastError||new Error("Request failed")}function shouldRetry(error){if(error instanceof Error){if(error.name==="AbortError")return false;if(error.name==="TypeError"&&error.message.includes("fetch"))return true;if(error.message.includes("ECONNRESET"))return true;if(error.message.includes("ENOTFOUND"))return false}return false}function sleep(ms){return new Promise(resolve=>setTimeout(resolve,ms))}export function validateUrl(url){try{new URL(url);return true}catch{return false}}
@@ -1 +1 @@
1
- function a366_0x11c2(){const _0xa3447d=['32351VoCiAS','2400VEsPHA','nonInteractive','true','stdout','1965000FeLMqT','844LtLYeO','isTTY','stdin','7270205TpmRIr','12761448GxWWlB','43uFAijQ','24627PYAClU','6DzXeES','setRawMode','isRaw','18ugEWbI','1536017WjtLyp','12962PpYdKJ'];a366_0x11c2=function(){return _0xa3447d;};return a366_0x11c2();}function a366_0x3226(_0x55eeaf,_0x28baef){_0x55eeaf=_0x55eeaf-0x8b;const _0x11c296=a366_0x11c2();let _0x3226e5=_0x11c296[_0x55eeaf];return _0x3226e5;}(function(_0x35df48,_0x3b0b07){const _0x2c7a2e=a366_0x3226,_0x38aa2d=_0x35df48();while(!![]){try{const _0x155b1a=parseInt(_0x2c7a2e(0x8e))/0x1*(parseInt(_0x2c7a2e(0x95))/0x2)+parseInt(_0x2c7a2e(0x8f))/0x3*(parseInt(_0x2c7a2e(0x9c))/0x4)+parseInt(_0x2c7a2e(0x8c))/0x5*(-parseInt(_0x2c7a2e(0x90))/0x6)+-parseInt(_0x2c7a2e(0x94))/0x7+parseInt(_0x2c7a2e(0x8d))/0x8+-parseInt(_0x2c7a2e(0x93))/0x9*(parseInt(_0x2c7a2e(0x9b))/0xa)+parseInt(_0x2c7a2e(0x96))/0xb*(-parseInt(_0x2c7a2e(0x97))/0xc);if(_0x155b1a===_0x3b0b07)break;else _0x38aa2d['push'](_0x38aa2d['shift']());}catch(_0x54ffc7){_0x38aa2d['push'](_0x38aa2d['shift']());}}}(a366_0x11c2,0xe83fb));function env(_0x1b8353){return process.env[`RABETBASE_${_0x1b8353}`]||process.env[`LOVRABET_${_0x1b8353}`]||undefined;}export function isNonInteractive(_0x445759){const _0x226a5e=a366_0x3226;return!!(_0x445759[_0x226a5e(0x98)]||_0x445759['ci']||env('CI')==='true'||process.env.CI===_0x226a5e(0x99)||!process[_0x226a5e(0x9a)][_0x226a5e(0x9d)]||!isStdinRawModeSupported());}function isStdinRawModeSupported(){const _0x135c6c=a366_0x3226;if(!process['stdin']['isTTY'])return![];try{const _0x16ce2d=process['stdin'][_0x135c6c(0x92)];return process[_0x135c6c(0x8b)][_0x135c6c(0x91)](!![]),process[_0x135c6c(0x8b)][_0x135c6c(0x91)](_0x16ce2d??![]),!![];}catch{return![];}}
1
+ function env(name){return process.env[`RABETBASE_${name}`]||process.env[`LOVRABET_${name}`]||undefined}export function isNonInteractive(flags){return!!(flags.nonInteractive||flags.ci||env("CI")==="true"||process.env.CI==="true"||!process.stdout.isTTY||!isStdinRawModeSupported())}function isStdinRawModeSupported(){if(!process.stdin.isTTY)return false;try{const wasRaw=process.stdin.isRaw;process.stdin.setRawMode(true);process.stdin.setRawMode(wasRaw??false);return true}catch{return false}}
@@ -1 +1,3 @@
1
- const a367_0x3eab36=a367_0x708c;(function(_0x22fb6a,_0x13b284){const _0x142aa3=a367_0x708c,_0x12c2cf=_0x22fb6a();while(!![]){try{const _0x513314=-parseInt(_0x142aa3(0x115))/0x1*(parseInt(_0x142aa3(0x126))/0x2)+-parseInt(_0x142aa3(0x105))/0x3+-parseInt(_0x142aa3(0x106))/0x4+parseInt(_0x142aa3(0x10b))/0x5+-parseInt(_0x142aa3(0xf8))/0x6+-parseInt(_0x142aa3(0x109))/0x7+parseInt(_0x142aa3(0x110))/0x8;if(_0x513314===_0x13b284)break;else _0x12c2cf['push'](_0x12c2cf['shift']());}catch(_0x8d2552){_0x12c2cf['push'](_0x12c2cf['shift']());}}}(a367_0x382a,0x7703c));function a367_0x382a(){const _0x2226f3=['625486BbUVfY','setLogPath','logFilePath','dirname','utf8','4407558GjZNue','Starting:\x20','trim','createLogger','blue','existsSync','Failed:\x20','warn','timestamp','toISOString','command','details','setRawCommand','926025WouOeQ','489944hhUJfg','filter','mkdirSync','6530713ICkOjN','log','3830010pJgSKz','File','readFileSync','initWinstonLogger','errors','19565448roTwua','join','currentRawCommand','yellow','info','2ISRYvi','map','now','error','getWinstonInstance','success','format','Completed:\x20','stringify','.lovrabet.log','winstonLogger','combine','clearLogs','transports','addColors','level','Failed\x20to\x20read\x20logs:'];a367_0x382a=function(){return _0x2226f3;};return a367_0x382a();}import a367_0x2f1e34 from'winston';import a367_0x5eb829 from'node:fs';import a367_0x5df719 from'node:path';function a367_0x708c(_0x3d3ff0,_0x5c1fd2){_0x3d3ff0=_0x3d3ff0-0xf5;const _0x382a94=a367_0x382a();let _0x708c24=_0x382a94[_0x3d3ff0];return _0x708c24;}class Logger{['winstonLogger'];[a367_0x3eab36(0xf5)];[a367_0x3eab36(0x112)]='';constructor(){const _0x4e6594=a367_0x3eab36;this[_0x4e6594(0xf5)]='';}[a367_0x3eab36(0x104)](_0x5c1958){const _0x129ef8=a367_0x3eab36;this[_0x129ef8(0x112)]=_0x5c1958;}[a367_0x3eab36(0x10e)](){const _0x124918=a367_0x3eab36,_0x54d932=a367_0x5df719[_0x124918(0xf6)](this[_0x124918(0xf5)]);!a367_0x5eb829[_0x124918(0xfd)](_0x54d932)&&a367_0x5eb829[_0x124918(0x108)](_0x54d932,{'recursive':!![]});const _0x25d062=a367_0x2f1e34[_0x124918(0x11b)][_0x124918(0x120)](a367_0x2f1e34[_0x124918(0x11b)][_0x124918(0x100)](),a367_0x2f1e34['format'][_0x124918(0x10f)]({'stack':!![]}),a367_0x2f1e34[_0x124918(0x11b)]['printf'](_0x1e2780=>{const _0x18f624=_0x124918,_0x4cc412={'timestamp':_0x1e2780[_0x18f624(0x100)]||new Date()[_0x18f624(0x101)](),'level':_0x1e2780[_0x18f624(0x124)]||'info','command':_0x1e2780[_0x18f624(0x102)]||'unknown','rawCommand':_0x1e2780['rawCommand']||this[_0x18f624(0x112)]||undefined,'message':_0x1e2780['message']||'','duration':_0x1e2780['duration']||undefined,'details':_0x1e2780[_0x18f624(0x103)]||undefined};return JSON[_0x18f624(0x11d)](_0x4cc412);}));this[_0x124918(0x11f)]=a367_0x2f1e34[_0x124918(0xfb)]({'level':'info','format':_0x25d062,'transports':[new a367_0x2f1e34[(_0x124918(0x122))][(_0x124918(0x10c))]({'filename':this['logFilePath'],'level':_0x124918(0x114)})],'silent':![]}),a367_0x2f1e34[_0x124918(0x123)]({'success':'green','error':'red','warn':_0x124918(0x113),'info':_0x124918(0xfc)});}[a367_0x3eab36(0x127)](_0x358941){const _0x321b11=a367_0x3eab36;this[_0x321b11(0xf5)]=a367_0x5df719[_0x321b11(0x111)](_0x358941,_0x321b11(0x11e)),this[_0x321b11(0x11f)]&&this[_0x321b11(0x11f)]['clear'](),this[_0x321b11(0x10e)]();}[a367_0x3eab36(0x114)](_0x34e332,_0x4948c8,_0x92d4e0){const _0x404227=a367_0x3eab36;if(!this[_0x404227(0xf5)]||!this[_0x404227(0x11f)])return;this['winstonLogger'][_0x404227(0x114)](_0x4948c8,{'command':_0x34e332,'details':_0x92d4e0});}['success'](_0x245490,_0x285f8c,_0x497eab,_0x2c0097){const _0x47b54b=a367_0x3eab36;if(!this['logFilePath']||!this[_0x47b54b(0x11f)])return;this[_0x47b54b(0x11f)][_0x47b54b(0x10a)]('info',_0x285f8c,{'level':_0x47b54b(0x11a),'command':_0x245490,'duration':_0x497eab,'details':_0x2c0097});}['error'](_0x56ed86,_0x2d1bfe,_0x1f57ad){const _0x545803=a367_0x3eab36;if(!this[_0x545803(0xf5)]||!this['winstonLogger'])return;this['winstonLogger'][_0x545803(0x118)](_0x2d1bfe,{'command':_0x56ed86,'details':_0x1f57ad});}[a367_0x3eab36(0xff)](_0x55c952,_0x54d7c8,_0x2c738e){const _0xa3f30f=a367_0x3eab36;if(!this[_0xa3f30f(0xf5)]||!this[_0xa3f30f(0x11f)])return;this[_0xa3f30f(0x11f)][_0xa3f30f(0xff)](_0x54d7c8,{'command':_0x55c952,'details':_0x2c738e});}async['logTask'](_0x14141a,_0x51064d,_0x481d7a){const _0x2babe2=a367_0x3eab36,_0x51f898=Date[_0x2babe2(0x117)]();this['info'](_0x14141a,_0x2babe2(0xf9)+_0x51064d);try{const _0x47c52a=await _0x481d7a(),_0x309c56=Date['now']()-_0x51f898;return this[_0x2babe2(0x11a)](_0x14141a,_0x2babe2(0x11c)+_0x51064d,_0x309c56),_0x47c52a;}catch(_0x258ada){const _0x518d76=Date[_0x2babe2(0x117)]()-_0x51f898;this[_0x2babe2(0x118)](_0x14141a,_0x2babe2(0xfe)+_0x51064d,{'error':_0x258ada instanceof Error?_0x258ada['message']:String(_0x258ada),'duration':_0x518d76});throw _0x258ada;}}['readLogs'](){const _0x3b3c4c=a367_0x3eab36;try{if(!a367_0x5eb829['existsSync'](this[_0x3b3c4c(0xf5)]))return[];const _0x2de4d0=a367_0x5eb829[_0x3b3c4c(0x10d)](this[_0x3b3c4c(0xf5)],_0x3b3c4c(0xf7));return _0x2de4d0['split']('\x0a')[_0x3b3c4c(0x107)](_0x7ac346=>_0x7ac346[_0x3b3c4c(0xfa)]())[_0x3b3c4c(0x116)](_0x50273d=>JSON['parse'](_0x50273d));}catch(_0x4601dc){return console[_0x3b3c4c(0xff)](_0x3b3c4c(0x125),_0x4601dc),[];}}[a367_0x3eab36(0x121)](){const _0x3569e3=a367_0x3eab36;try{a367_0x5eb829[_0x3569e3(0xfd)](this[_0x3569e3(0xf5)])&&a367_0x5eb829['writeFileSync'](this[_0x3569e3(0xf5)],'',_0x3569e3(0xf7));}catch(_0x47500a){console[_0x3569e3(0xff)]('Failed\x20to\x20clear\x20logs:',_0x47500a);}}[a367_0x3eab36(0x119)](){const _0x303b58=a367_0x3eab36;return this[_0x303b58(0x11f)];}}export const logger=new Logger();
1
+ import winston from"winston";import fs from"node:fs";import path from"node:path";class Logger{winstonLogger;logFilePath;currentRawCommand="";constructor(){this.logFilePath=""}setRawCommand(rawCommand){this.currentRawCommand=rawCommand}initWinstonLogger(){const dir=path.dirname(this.logFilePath);if(!fs.existsSync(dir)){fs.mkdirSync(dir,{recursive:true})}const customFormat=winston.format.combine(winston.format.timestamp(),winston.format.errors({stack:true}),winston.format.printf(info=>{const logEntry={timestamp:info.timestamp||(new Date).toISOString(),level:info.level||"info",command:info.command||"unknown",rawCommand:info.rawCommand||this.currentRawCommand||undefined,message:info.message||"",duration:info.duration||undefined,details:info.details||undefined};return JSON.stringify(logEntry)}));this.winstonLogger=winston.createLogger({level:"info",format:customFormat,transports:[new winston.transports.File({filename:this.logFilePath,level:"info"})],silent:false});winston.addColors({
2
+ success:"green",error:"red",warn:"yellow",info:"blue"})}setLogPath(projectPath){this.logFilePath=path.join(projectPath,".lovrabet.log");if(this.winstonLogger){this.winstonLogger.clear()}this.initWinstonLogger()}info(command,message,details){if(!this.logFilePath||!this.winstonLogger)return;this.winstonLogger.info(message,{command:command,details:details})}success(command,message,duration,details){if(!this.logFilePath||!this.winstonLogger)return;this.winstonLogger.log("info",message,{level:"success",command:command,duration:duration,details:details})}error(command,message,details){if(!this.logFilePath||!this.winstonLogger)return;this.winstonLogger.error(message,{command:command,details:details})}warn(command,message,details){if(!this.logFilePath||!this.winstonLogger)return;this.winstonLogger.warn(message,{command:command,details:details})}async logTask(command,taskName,task){const startTime=Date.now();this.info(command,`Starting: ${taskName}`);try{const result=await task()
3
+ ;const duration=Date.now()-startTime;this.success(command,`Completed: ${taskName}`,duration);return result}catch(error){const duration=Date.now()-startTime;this.error(command,`Failed: ${taskName}`,{error:error instanceof Error?error.message:String(error),duration:duration});throw error}}readLogs(){try{if(!fs.existsSync(this.logFilePath)){return[]}const content=fs.readFileSync(this.logFilePath,"utf8");return content.split("\n").filter(line=>line.trim()).map(line=>JSON.parse(line))}catch(error){console.warn("Failed to read logs:",error);return[]}}clearLogs(){try{if(fs.existsSync(this.logFilePath)){fs.writeFileSync(this.logFilePath,"","utf8")}}catch(error){console.warn("Failed to clear logs:",error)}}getWinstonInstance(){return this.winstonLogger}}export const logger=new Logger;
@@ -1 +1 @@
1
- (function(_0x519e52,_0x46fec8){const _0x353b7d=a368_0x2f13,_0x16a403=_0x519e52();while(!![]){try{const _0x31a576=parseInt(_0x353b7d(0x111))/0x1*(parseInt(_0x353b7d(0x109))/0x2)+parseInt(_0x353b7d(0x103))/0x3+parseInt(_0x353b7d(0x114))/0x4*(parseInt(_0x353b7d(0x10f))/0x5)+-parseInt(_0x353b7d(0x10e))/0x6*(-parseInt(_0x353b7d(0x104))/0x7)+parseInt(_0x353b7d(0x10d))/0x8*(-parseInt(_0x353b7d(0x113))/0x9)+parseInt(_0x353b7d(0x106))/0xa*(-parseInt(_0x353b7d(0x112))/0xb)+parseInt(_0x353b7d(0x110))/0xc;if(_0x31a576===_0x46fec8)break;else _0x16a403['push'](_0x16a403['shift']());}catch(_0xae8be8){_0x16a403['push'](_0x16a403['shift']());}}}(a368_0x2791,0x4d6d5));import{CliErrors}from'../errors.js';function a368_0x2f13(_0x62f37c,_0x3773c1){_0x62f37c=_0x62f37c-0x103;const _0x2791b0=a368_0x2791();let _0x2f1339=_0x2791b0[_0x62f37c];return _0x2f1339;}function a368_0x2791(){const _0x119846=['9pSyzkD','4alNVOl','183864ohQLVd','541422pZVWbY','--params\x20must\x20be\x20a\x20JSON\x20object','791210sWcLBF','parse','object','6WYhddP','isArray','Example:\x20--params\x20\x27{\x22id\x22:123}\x27','validation','2398552ZxZOHU','24Bfdmvd','552535YqKJbZ','7241652MTcxhx','28719XAmjSX','77mcZbdq'];a368_0x2791=function(){return _0x119846;};return a368_0x2791();}export function parseJsonParams(_0x4b7c0d){const _0x4a4e85=a368_0x2f13;if(!_0x4b7c0d)return undefined;let _0x1cf9d9;try{_0x1cf9d9=JSON[_0x4a4e85(0x107)](_0x4b7c0d);}catch{throw CliErrors[_0x4a4e85(0x10c)]('Invalid\x20JSON\x20for\x20--params:\x20'+_0x4b7c0d);}if(!_0x1cf9d9||typeof _0x1cf9d9!==_0x4a4e85(0x108)||Array[_0x4a4e85(0x10a)](_0x1cf9d9))throw CliErrors[_0x4a4e85(0x10c)](_0x4a4e85(0x105),_0x4a4e85(0x10b));return _0x1cf9d9;}
1
+ import{CliErrors}from"../errors.js";export function parseJsonParams(paramsStr){if(!paramsStr)return undefined;let parsed;try{parsed=JSON.parse(paramsStr)}catch{throw CliErrors.validation(`Invalid JSON for --params: ${paramsStr}`)}if(!parsed||typeof parsed!=="object"||Array.isArray(parsed)){throw CliErrors.validation("--params must be a JSON object",`Example: --params '{"id":123}'`)}return parsed}
@@ -1 +1 @@
1
- const a369_0x30d124=a369_0x3ad3;function a369_0x5d53(){const _0x15a6b3=['platform','4kmKSgn','132MztPcc','1808254clZLFs','win32','.cmd','391725TZvLor','5060127ZHzQPx','88imBCEZ','117374ISAfYV','446562KpgAio','887635puFDHm','310oIKohe','69710190nxDmku'];a369_0x5d53=function(){return _0x15a6b3;};return a369_0x5d53();}(function(_0x1f0315,_0x1d8ff0){const _0x3db21a=a369_0x3ad3,_0x286208=_0x1f0315();while(!![]){try{const _0x4e5608=-parseInt(_0x3db21a(0x94))/0x1+-parseInt(_0x3db21a(0x8c))/0x2+-parseInt(_0x3db21a(0x8a))/0x3*(parseInt(_0x3db21a(0x92))/0x4)+-parseInt(_0x3db21a(0x89))/0x5*(parseInt(_0x3db21a(0x93))/0x6)+-parseInt(_0x3db21a(0x8e))/0x7*(-parseInt(_0x3db21a(0x8b))/0x8)+-parseInt(_0x3db21a(0x8d))/0x9*(parseInt(_0x3db21a(0x8f))/0xa)+parseInt(_0x3db21a(0x90))/0xb;if(_0x4e5608===_0x1d8ff0)break;else _0x286208['push'](_0x286208['shift']());}catch(_0x2b1cd5){_0x286208['push'](_0x286208['shift']());}}}(a369_0x5d53,0xdfd0b));function a369_0x3ad3(_0x1d5d90,_0xe91a13){_0x1d5d90=_0x1d5d90-0x89;const _0x5d53f9=a369_0x5d53();let _0x3ad370=_0x5d53f9[_0x1d5d90];return _0x3ad370;}export const isWindows=process[a369_0x30d124(0x91)]===a369_0x30d124(0x95);export function resolveNpmBin(_0x46fdec){const _0x2e152a=a369_0x30d124;return isWindows?_0x46fdec+_0x2e152a(0x96):_0x46fdec;}
1
+ export const isWindows=process.platform==="win32";export function resolveNpmBin(cmd){return isWindows?`${cmd}.cmd`:cmd}
@@ -1 +1 @@
1
- export function sleep(_0x56a06e){return new Promise(_0x244828=>setTimeout(_0x244828,_0x56a06e));}
1
+ export function sleep(ms){return new Promise(resolve=>setTimeout(resolve,ms))}
@@ -1 +1,5 @@
1
- const a371_0x132c99=a371_0x449f;(function(_0x32df1e,_0x126e23){const _0xb7b7a6=a371_0x449f,_0x339339=_0x32df1e();while(!![]){try{const _0x11252f=-parseInt(_0xb7b7a6(0x1f4))/0x1*(parseInt(_0xb7b7a6(0x1ff))/0x2)+-parseInt(_0xb7b7a6(0x1cb))/0x3+-parseInt(_0xb7b7a6(0x1c6))/0x4+parseInt(_0xb7b7a6(0x208))/0x5+parseInt(_0xb7b7a6(0x1d5))/0x6*(-parseInt(_0xb7b7a6(0x209))/0x7)+-parseInt(_0xb7b7a6(0x1d8))/0x8+parseInt(_0xb7b7a6(0x1d4))/0x9;if(_0x11252f===_0x126e23)break;else _0x339339['push'](_0x339339['shift']());}catch(_0x4932cf){_0x339339['push'](_0x339339['shift']());}}}(a371_0x17ac,0x39f21));function a371_0x17ac(){const _0x3ef8a2=['template','toComponentName','toISOString','.scss','isDirectory','promises','utf8','.css','join','alias:\x20\x22','2BWfwOF','getSeconds','writeFile','.jsx','toLowerCase','getDate','.md','datasetCode','LOVRABET','1122375aeDHKC','28LycIWZ','238004vgbyPp','getMonth','includes','split','toUpperCase','950850disgsK','alias','endsWith','pad','name','.js','mkdir','tableName','replaceContent','7395786mLDqDg','383532LwqNAu','getMinutes','padStart','776728GLEJgn','processTemplate','getHours','isFile','push','slice','Template\x20content\x20replacement\x20completed','name:\x20\x22','processFile','Starting\x20template\x20content\x20replacement','sdk-config','success','.json','processDirectory','charAt','pop','replace','tableName:\x20\x22','default','readdir','\x20},','map','datasetCode:\x20\x22','YourModel','formatLocalTimestamp','extname','.tpl','now','79654DtrgtE'];a371_0x17ac=function(){return _0x3ef8a2;};return a371_0x17ac();}function a371_0x449f(_0x23ba77,_0x5ee9ef){_0x23ba77=_0x23ba77-0x1c6;const _0x17acd8=a371_0x17ac();let _0x449f8a=_0x17acd8[_0x23ba77];return _0x449f8a;}import a371_0x3cc38d from'node:fs';import a371_0x53d91c from'node:path';import{logger}from'../utils/logger.js';import{getCliVersion}from'../utils/version.js';const CLI_VERSION=getCliVersion();export class TemplateReplacer{static['pad'](_0x484d50){const _0x27846d=a371_0x449f;return String(_0x484d50)[_0x27846d(0x1d7)](0x2,'0');}static[a371_0x132c99(0x1f0)](_0x24bc8a){const _0xf6e144=a371_0x132c99,_0x4ca2ce=_0x24bc8a['getFullYear'](),_0x3ae190=this[_0xf6e144(0x1ce)](_0x24bc8a[_0xf6e144(0x1c7)]()+0x1),_0xb5c2c8=this[_0xf6e144(0x1ce)](_0x24bc8a[_0xf6e144(0x204)]()),_0x4e20fb=this[_0xf6e144(0x1ce)](_0x24bc8a[_0xf6e144(0x1da)]()),_0x2a2ed0=this[_0xf6e144(0x1ce)](_0x24bc8a[_0xf6e144(0x1d6)]()),_0x1d55a7=this[_0xf6e144(0x1ce)](_0x24bc8a[_0xf6e144(0x200)]());return{'createdAt':_0x4ca2ce+'-'+_0x3ae190+'-'+_0xb5c2c8+'\x20'+_0x4e20fb+':'+_0x2a2ed0+':'+_0x1d55a7,'createdDate':_0x4ca2ce+'-'+_0x3ae190+'-'+_0xb5c2c8,'createdTime':_0x4e20fb+':'+_0x2a2ed0+':'+_0x1d55a7};}static[a371_0x132c99(0x1f6)](_0x543e81){const _0x297b21=a371_0x132c99,_0x28c5d0=_0x543e81['split']('/')[_0x297b21(0x1e7)]()||_0x543e81;return _0x28c5d0[_0x297b21(0x1c9)]('-')[_0x297b21(0x1ed)](_0x12c739=>_0x12c739['charAt'](0x0)[_0x297b21(0x1ca)]()+_0x12c739[_0x297b21(0x1dd)](0x1)['toLowerCase']())[_0x297b21(0x1fd)]('');}static['toDisplayTitle'](_0x2689f0){const _0x1bb69c=a371_0x132c99,_0x3a2916=_0x2689f0['split']('/')['pop']()||_0x2689f0;return _0x3a2916[_0x1bb69c(0x1c9)]('-')[_0x1bb69c(0x1ed)](_0x5e189f=>_0x5e189f[_0x1bb69c(0x1e6)](0x0)[_0x1bb69c(0x1ca)]()+_0x5e189f[_0x1bb69c(0x1dd)](0x1)[_0x1bb69c(0x203)]())[_0x1bb69c(0x1fd)]('\x20');}static[a371_0x132c99(0x1d3)](_0x107df,_0x1b71fd,_0x46b472){const _0x39ba1a=a371_0x132c99,_0x52cad6=this[_0x39ba1a(0x1f6)](_0x1b71fd),_0x26dacc=this['toDisplayTitle'](_0x1b71fd),{createdAt:_0x246792,createdDate:_0xac7a7e,createdTime:_0x2e664e}=this[_0x39ba1a(0x1f0)](new Date());let _0x1b3025=_0x107df[_0x39ba1a(0x1e8)](/\{CliVersion\}/g,CLI_VERSION)[_0x39ba1a(0x1e8)](/\{ComponentName\}/g,_0x52cad6)[_0x39ba1a(0x1e8)](/\{DisplayTitle\}/g,_0x26dacc)['replace'](/\{PageName\}/g,_0x1b71fd)['replace'](/\{TemplateName\}/g,_0x46b472)['replace'](/\{CreatedAt\}/g,_0x246792)['replace'](/\{CreatedDate\}/g,_0xac7a7e)[_0x39ba1a(0x1e8)](/\{CreatedTime\}/g,_0x2e664e);return _0x1b3025;}static['replaceApiContent'](_0x30bc57,_0x48d2be,_0x406f12,_0x1cf5ba,_0x255974,_0x14facd,_0x27b7ab,_0x1f7454,_0x3608e0){const _0x1fd585=a371_0x132c99,_0x5da7fa=new Date(),_0x51844d=_0x5da7fa[_0x1fd585(0x1f7)](),_0x12634d=_0x406f12['map'](_0x4a7aae=>{const _0x2b8f1f=_0x1fd585,_0xbaac16=[_0x2b8f1f(0x1ee)+_0x4a7aae[_0x2b8f1f(0x206)]+'\x22',_0x2b8f1f(0x1e9)+_0x4a7aae[_0x2b8f1f(0x1d2)]+'\x22',_0x2b8f1f(0x1df)+_0x4a7aae[_0x2b8f1f(0x1cf)]+'\x22'];return _0x4a7aae['alias']&&_0xbaac16[_0x2b8f1f(0x1dc)](_0x2b8f1f(0x1fe)+_0x4a7aae[_0x2b8f1f(0x1cc)]+'\x22'),'\x0a\x20\x20\x20\x20{\x20'+_0xbaac16['join'](',\x20')+_0x2b8f1f(0x1ec);})[_0x1fd585(0x1fd)](''),_0x27e757=_0x1cf5ba||_0x406f12[0x0]?.[_0x1fd585(0x1cc)]||_0x1fd585(0x1ef);let _0x153fd8=_0x30bc57[_0x1fd585(0x1e8)](/\{AppCode\}/g,_0x48d2be)[_0x1fd585(0x1e8)](/\{ModelConfigs\}/g,_0x12634d)[_0x1fd585(0x1e8)](/\{ExampleModelName\}/g,_0x27e757)[_0x1fd585(0x1e8)](/\{ApiFileName\}/g,_0x255974||'api')['replace'](/\{ConfigName\}/g,_0x14facd||_0x1fd585(0x1ea))[_0x1fd585(0x1e8)](/\{ClientConfigParam\}/g,_0x27b7ab||'')[_0x1fd585(0x1e8)](/\{SdkConfigFileName\}/g,_0x3608e0||_0x1fd585(0x1e2))['replace'](/\{VarPrefix\}/g,_0x1f7454||_0x1fd585(0x207))[_0x1fd585(0x1e8)](/\{CreatedAt\}/g,_0x51844d);return _0x153fd8;}static async[a371_0x132c99(0x1d9)](_0x1bf857,_0xcc7757,_0x5d597e,_0xd5a76f,_0xc51e7a=!![]){const _0x44bac5=a371_0x132c99,_0x36b926=Date[_0x44bac5(0x1f3)]();try{_0xc51e7a&&logger['info'](_0x44bac5(0x1f5),_0x44bac5(0x1e1),{'templatePath':_0x1bf857,'targetPath':_0xcc7757,'pageName':_0x5d597e,'templateName':_0xd5a76f});await a371_0x3cc38d['promises']['mkdir'](_0xcc7757,{'recursive':!![]}),await this[_0x44bac5(0x1e5)](_0x1bf857,_0xcc7757,_0x5d597e,_0xd5a76f);if(_0xc51e7a){const _0x154f66=Date['now']()-_0x36b926;logger[_0x44bac5(0x1e3)]('template',_0x44bac5(0x1de),_0x154f66,{'pageName':_0x5d597e,'templateName':_0xd5a76f});}}catch(_0x4306f6){if(_0xc51e7a){const _0xd84f4a=Date['now']()-_0x36b926;logger['error'](_0x44bac5(0x1f5),'Template\x20content\x20replacement\x20failed',{'templatePath':_0x1bf857,'targetPath':_0xcc7757,'pageName':_0x5d597e,'templateName':_0xd5a76f,'error':_0x4306f6 instanceof Error?_0x4306f6['message']:String(_0x4306f6),'duration':_0xd84f4a});}throw _0x4306f6;}}static async['processDirectory'](_0x30a1ea,_0x29ec4e,_0x548e09,_0x680fb3){const _0x17b93a=a371_0x132c99,_0x13b365=await a371_0x3cc38d['promises'][_0x17b93a(0x1eb)](_0x30a1ea,{'withFileTypes':!![]});for(const _0x24a5d5 of _0x13b365){const _0x21e7f0=a371_0x53d91c[_0x17b93a(0x1fd)](_0x30a1ea,_0x24a5d5[_0x17b93a(0x1cf)]);let _0xf3391f=a371_0x53d91c[_0x17b93a(0x1fd)](_0x29ec4e,_0x24a5d5['name']);_0x24a5d5['name'][_0x17b93a(0x1cd)](_0x17b93a(0x1f2))&&(_0xf3391f=a371_0x53d91c['join'](_0x29ec4e,_0x24a5d5[_0x17b93a(0x1cf)][_0x17b93a(0x1e8)](/\.tpl$/,'')));if(_0x24a5d5[_0x17b93a(0x1f9)]())await a371_0x3cc38d[_0x17b93a(0x1fa)][_0x17b93a(0x1d1)](_0xf3391f,{'recursive':!![]}),await this[_0x17b93a(0x1e5)](_0x21e7f0,_0xf3391f,_0x548e09,_0x680fb3);else _0x24a5d5[_0x17b93a(0x1db)]()&&await this[_0x17b93a(0x1e0)](_0x21e7f0,_0xf3391f,_0x548e09,_0x680fb3);}}static async[a371_0x132c99(0x1e0)](_0x3be99a,_0x2afe49,_0xca150c,_0x49103e){const _0x571cdf=a371_0x132c99,_0x2c319b=a371_0x53d91c[_0x571cdf(0x1f1)](_0x3be99a)['toLowerCase']();_0x3be99a[_0x571cdf(0x1cd)](_0x571cdf(0x1f2))&&(_0x2afe49=_0x2afe49[_0x571cdf(0x1e8)](/\.tpl$/,''));const _0x54f194=['.tsx','.ts',_0x571cdf(0x202),_0x571cdf(0x1d0),_0x571cdf(0x1e4),_0x571cdf(0x205),_0x571cdf(0x1fc),_0x571cdf(0x1f8),_0x571cdf(0x1f2)];if(_0x54f194[_0x571cdf(0x1c8)](_0x2c319b)||_0x3be99a['endsWith'](_0x571cdf(0x1f2))){const _0x16da24=await a371_0x3cc38d['promises']['readFile'](_0x3be99a,_0x571cdf(0x1fb)),_0x2a5f66=this[_0x571cdf(0x1d3)](_0x16da24,_0xca150c,_0x49103e);await a371_0x3cc38d[_0x571cdf(0x1fa)][_0x571cdf(0x201)](_0x2afe49,_0x2a5f66,_0x571cdf(0x1fb));}else await a371_0x3cc38d[_0x571cdf(0x1fa)]['copyFile'](_0x3be99a,_0x2afe49);}}
1
+ import fs from"node:fs";import path from"node:path";import{logger}from"../utils/logger.js";import{getCliVersion}from"../utils/version.js";const CLI_VERSION=getCliVersion();export class TemplateReplacer{static pad(value){return String(value).padStart(2,"0")}static formatLocalTimestamp(date){const year=date.getFullYear();const month=this.pad(date.getMonth()+1);const day=this.pad(date.getDate());const hour=this.pad(date.getHours());const minute=this.pad(date.getMinutes());const second=this.pad(date.getSeconds());return{createdAt:`${year}-${month}-${day} ${hour}:${minute}:${second}`,createdDate:`${year}-${month}-${day}`,createdTime:`${hour}:${minute}:${second}`}}static toComponentName(pageName){const lastSegment=pageName.split("/").pop()||pageName;return lastSegment.split("-").map(word=>word.charAt(0).toUpperCase()+word.slice(1).toLowerCase()).join("")}static toDisplayTitle(pageName){const lastSegment=pageName.split("/").pop()||pageName
2
+ ;return lastSegment.split("-").map(word=>word.charAt(0).toUpperCase()+word.slice(1).toLowerCase()).join(" ")}static replaceContent(content,pageName,templateName){const componentName=this.toComponentName(pageName);const displayTitle=this.toDisplayTitle(pageName);const{createdAt:createdAt,createdDate:createdDate,createdTime:createdTime}=this.formatLocalTimestamp(new Date);let replacedContent=content.replace(/\{CliVersion\}/g,CLI_VERSION).replace(/\{ComponentName\}/g,componentName).replace(/\{DisplayTitle\}/g,displayTitle).replace(/\{PageName\}/g,pageName).replace(/\{TemplateName\}/g,templateName).replace(/\{CreatedAt\}/g,createdAt).replace(/\{CreatedDate\}/g,createdDate).replace(/\{CreatedTime\}/g,createdTime);return replacedContent}static replaceApiContent(content,appCode,modelConfigs,exampleModelName,apiFileName,configName,clientConfigParam,varPrefix,sdkConfigFileName){const now=new Date;const createdAt=now.toISOString();const formattedModelConfigs=modelConfigs.map(config=>{
3
+ const parts=[`datasetCode: "${config.datasetCode}"`,`tableName: "${config.tableName}"`,`name: "${config.name}"`];if(config.alias){parts.push(`alias: "${config.alias}"`)}return`\n { ${parts.join(", ")} },`}).join("");const firstModelName=exampleModelName||modelConfigs[0]?.alias||"YourModel";let replacedContent=content.replace(/\{AppCode\}/g,appCode).replace(/\{ModelConfigs\}/g,formattedModelConfigs).replace(/\{ExampleModelName\}/g,firstModelName).replace(/\{ApiFileName\}/g,apiFileName||"api").replace(/\{ConfigName\}/g,configName||"default").replace(/\{ClientConfigParam\}/g,clientConfigParam||"").replace(/\{SdkConfigFileName\}/g,sdkConfigFileName||"sdk-config").replace(/\{VarPrefix\}/g,varPrefix||"LOVRABET").replace(/\{CreatedAt\}/g,createdAt);return replacedContent}static async processTemplate(templatePath,targetPath,pageName,templateName,enableLogging=true){const startTime=Date.now();try{if(enableLogging){logger.info("template","Starting template content replacement",{
4
+ templatePath:templatePath,targetPath:targetPath,pageName:pageName,templateName:templateName})}await fs.promises.mkdir(targetPath,{recursive:true});await this.processDirectory(templatePath,targetPath,pageName,templateName);if(enableLogging){const duration=Date.now()-startTime;logger.success("template","Template content replacement completed",duration,{pageName:pageName,templateName:templateName})}}catch(error){if(enableLogging){const duration=Date.now()-startTime;logger.error("template","Template content replacement failed",{templatePath:templatePath,targetPath:targetPath,pageName:pageName,templateName:templateName,error:error instanceof Error?error.message:String(error),duration:duration})}throw error}}static async processDirectory(sourceDir,targetDir,pageName,templateName){const entries=await fs.promises.readdir(sourceDir,{withFileTypes:true});for(const entry of entries){const sourcePath=path.join(sourceDir,entry.name);let targetPath=path.join(targetDir,entry.name)
5
+ ;if(entry.name.endsWith(".tpl")){targetPath=path.join(targetDir,entry.name.replace(/\.tpl$/,""))}if(entry.isDirectory()){await fs.promises.mkdir(targetPath,{recursive:true});await this.processDirectory(sourcePath,targetPath,pageName,templateName)}else if(entry.isFile()){await this.processFile(sourcePath,targetPath,pageName,templateName)}}}static async processFile(sourcePath,targetPath,pageName,templateName){const fileExtension=path.extname(sourcePath).toLowerCase();if(sourcePath.endsWith(".tpl")){targetPath=targetPath.replace(/\.tpl$/,"")}const textFileExtensions=[".tsx",".ts",".jsx",".js",".json",".md",".css",".scss",".tpl"];if(textFileExtensions.includes(fileExtension)||sourcePath.endsWith(".tpl")){const content=await fs.promises.readFile(sourcePath,"utf8");const replacedContent=this.replaceContent(content,pageName,templateName);await fs.promises.writeFile(targetPath,replacedContent,"utf8")}else{await fs.promises.copyFile(sourcePath,targetPath)}}}
@@ -1 +1,3 @@
1
- function a372_0xb4a1(_0x332f5a,_0x58c9fd){_0x332f5a=_0x332f5a-0x120;const _0x2df807=a372_0x2df8();let _0xb4a146=_0x2df807[_0x332f5a];return _0xb4a146;}(function(_0x1c3d31,_0x14517a){const _0xa6fba9=a372_0xb4a1,_0x366086=_0x1c3d31();while(!![]){try{const _0x4cf3b3=parseInt(_0xa6fba9(0x122))/0x1*(parseInt(_0xa6fba9(0x12c))/0x2)+-parseInt(_0xa6fba9(0x125))/0x3+parseInt(_0xa6fba9(0x12e))/0x4+parseInt(_0xa6fba9(0x124))/0x5+parseInt(_0xa6fba9(0x138))/0x6*(-parseInt(_0xa6fba9(0x134))/0x7)+parseInt(_0xa6fba9(0x133))/0x8+-parseInt(_0xa6fba9(0x132))/0x9;if(_0x4cf3b3===_0x14517a)break;else _0x366086['push'](_0x366086['shift']());}catch(_0x2a5d42){_0x366086['push'](_0x366086['shift']());}}}(a372_0x2df8,0x8a68a));import{mkdir,readFile,writeFile}from'node:fs/promises';import{homedir}from'node:os';import{dirname,join}from'node:path';import a372_0x498438 from'semver';import{CLI_BIN_NAME,NPM_PACKAGE_NAME}from'../constant/cli.js';import{getCliVersionPolicy}from'../utils/cli-version-policy.js';import{getCliVersion}from'../utils/version.js';const UPDATE_CHECK_TTL_MS=0xc*0x3c*0x3c*0x3e8,UPDATE_NOTICE_TTL_MS=0x18*0x3c*0x3c*0x3e8;function isUpdateNoticeDisabled(){const _0x254446=a372_0xb4a1,_0x1c3b8c=process.env.RABETBASE_NO_UPDATE_NOTICE?.[_0x254446(0x13b)]()['toLowerCase']();return _0x1c3b8c==='1'||_0x1c3b8c===_0x254446(0x130)||_0x1c3b8c===_0x254446(0x12a);}function cacheRoot(){const _0x363709=a372_0xb4a1;return process.env.XDG_CACHE_HOME||process.env.LOCALAPPDATA||join(homedir(),_0x363709(0x127));}export function getUpdateNoticeCachePath(){const _0x57edc7=a372_0xb4a1;return join(cacheRoot(),_0x57edc7(0x129),_0x57edc7(0x12d));}async function readUpdateNoticeCache(){const _0x2c61e4=a372_0xb4a1;try{const _0x28b424=await readFile(getUpdateNoticeCachePath(),_0x2c61e4(0x13a)),_0x51416b=JSON[_0x2c61e4(0x139)](_0x28b424);if(!_0x51416b||typeof _0x51416b!==_0x2c61e4(0x128))return{};return _0x51416b;}catch{return{};}}async function writeUpdateNoticeCache(_0x3bef67){const _0x2c4b53=a372_0xb4a1;try{const _0x1b6ae5=getUpdateNoticeCachePath();await mkdir(dirname(_0x1b6ae5),{'recursive':!![]}),await writeFile(_0x1b6ae5,JSON[_0x2c4b53(0x123)](_0x3bef67,null,0x2)+'\x0a',_0x2c4b53(0x13a));}catch{}}function a372_0x2df8(){const _0x33ab7d=['3002416wPwKEq','\x20available,\x20current\x20','true','number','10204245OzJyvZ','2802920pRyoBv','91iqGcXt','lastNotifiedAt','https://www.npmjs.com/package/','valid','185604FkQymp','parse','utf8','trim','lastNotifiedVersion','checkedAt','21KKacUt','stringify','2951750glBoiu','1610493gjkKBp','now','.cache','object','rabetbase-cli','yes','\x20update','90322VDlGvX','update-check.json'];a372_0x2df8=function(){return _0x33ab7d;};return a372_0x2df8();}function isFreshCheck(_0x4f5886,_0x328702){const _0x2f170e=a372_0xb4a1;return typeof _0x4f5886[_0x2f170e(0x121)]===_0x2f170e(0x131)&&_0x328702-_0x4f5886[_0x2f170e(0x121)]<UPDATE_CHECK_TTL_MS;}function isRecentlyNotified(_0x5119fc,_0x5044fb,_0xd8c7ce){const _0x1b09b7=a372_0xb4a1;return _0x5119fc[_0x1b09b7(0x120)]===_0x5044fb&&typeof _0x5119fc[_0x1b09b7(0x135)]===_0x1b09b7(0x131)&&_0xd8c7ce-_0x5119fc[_0x1b09b7(0x135)]<UPDATE_NOTICE_TTL_MS;}export function buildNpmVersionUrl(_0x148281){const _0x94b8be=a372_0xb4a1;return _0x94b8be(0x136)+NPM_PACKAGE_NAME+'/v/'+_0x148281;}export async function resolveLatestUpdateNotice(){const _0x305feb=a372_0xb4a1;if(isUpdateNoticeDisabled())return null;try{const _0x1bdf37=Date[_0x305feb(0x126)](),_0x25b6d8=getCliVersion(),_0x11c015=await readUpdateNoticeCache();let _0x1acc59=isFreshCheck(_0x11c015,_0x1bdf37)?_0x11c015['latest']?.[_0x305feb(0x13b)]():undefined;if(!_0x1acc59&&!isFreshCheck(_0x11c015,_0x1bdf37)){const _0x1d25c9=await getCliVersionPolicy();_0x1acc59=_0x1d25c9?.['stableVersion']?.[_0x305feb(0x13b)]()||undefined,await writeUpdateNoticeCache({..._0x11c015,'checkedAt':_0x1bdf37,'latest':_0x1acc59,'failed':!_0x1acc59});}if(!_0x1acc59||!a372_0x498438['valid'](_0x25b6d8)||!a372_0x498438[_0x305feb(0x137)](_0x1acc59))return null;if(a372_0x498438['gte'](_0x25b6d8,_0x1acc59))return null;if(isRecentlyNotified(_0x11c015,_0x1acc59,_0x1bdf37))return null;const _0x1ea2ed=CLI_BIN_NAME+_0x305feb(0x12b);return await writeUpdateNoticeCache({..._0x11c015,'checkedAt':isFreshCheck(_0x11c015,_0x1bdf37)?_0x11c015[_0x305feb(0x121)]:_0x1bdf37,'latest':_0x1acc59,'failed':![],'lastNotifiedVersion':_0x1acc59,'lastNotifiedAt':_0x1bdf37}),{'command':_0x1ea2ed,'current':_0x25b6d8,'latest':_0x1acc59,'url':buildNpmVersionUrl(_0x1acc59),'message':CLI_BIN_NAME+'\x20'+_0x1acc59+_0x305feb(0x12f)+_0x25b6d8+',\x20run:\x20'+_0x1ea2ed};}catch{return null;}}
1
+ import{mkdir,readFile,writeFile}from"node:fs/promises";import{homedir}from"node:os";import{dirname,join}from"node:path";import semver from"semver";import{CLI_BIN_NAME,NPM_PACKAGE_NAME}from"../constant/cli.js";import{getCliVersionPolicy}from"../utils/cli-version-policy.js";import{getCliVersion}from"../utils/version.js";const UPDATE_CHECK_TTL_MS=12*60*60*1e3;const UPDATE_NOTICE_TTL_MS=24*60*60*1e3;function isUpdateNoticeDisabled(){const raw=process.env.RABETBASE_NO_UPDATE_NOTICE?.trim().toLowerCase();return raw==="1"||raw==="true"||raw==="yes"}function cacheRoot(){return process.env.XDG_CACHE_HOME||process.env.LOCALAPPDATA||join(homedir(),".cache")}export function getUpdateNoticeCachePath(){return join(cacheRoot(),"rabetbase-cli","update-check.json")}async function readUpdateNoticeCache(){try{const content=await readFile(getUpdateNoticeCachePath(),"utf8");const parsed=JSON.parse(content);if(!parsed||typeof parsed!=="object")return{};return parsed}catch{return{}}}
2
+ async function writeUpdateNoticeCache(cache){try{const file=getUpdateNoticeCachePath();await mkdir(dirname(file),{recursive:true});await writeFile(file,`${JSON.stringify(cache,null,2)}\n`,"utf8")}catch{}}function isFreshCheck(cache,now){return typeof cache.checkedAt==="number"&&now-cache.checkedAt<UPDATE_CHECK_TTL_MS}function isRecentlyNotified(cache,latest,now){return cache.lastNotifiedVersion===latest&&typeof cache.lastNotifiedAt==="number"&&now-cache.lastNotifiedAt<UPDATE_NOTICE_TTL_MS}export function buildNpmVersionUrl(version){return`https://www.npmjs.com/package/${NPM_PACKAGE_NAME}/v/${version}`}export async function resolveLatestUpdateNotice(){if(isUpdateNoticeDisabled())return null;try{const now=Date.now();const current=getCliVersion();const cache=await readUpdateNoticeCache();let latest=isFreshCheck(cache,now)?cache.latest?.trim():undefined;if(!latest&&!isFreshCheck(cache,now)){const policy=await getCliVersionPolicy();latest=policy?.stableVersion?.trim()||undefined
3
+ ;await writeUpdateNoticeCache({...cache,checkedAt:now,latest:latest,failed:!latest})}if(!latest||!semver.valid(current)||!semver.valid(latest))return null;if(semver.gte(current,latest))return null;if(isRecentlyNotified(cache,latest,now))return null;const command=`${CLI_BIN_NAME} update`;await writeUpdateNoticeCache({...cache,checkedAt:isFreshCheck(cache,now)?cache.checkedAt:now,latest:latest,failed:false,lastNotifiedVersion:latest,lastNotifiedAt:now});return{command:command,current:current,latest:latest,url:buildNpmVersionUrl(latest),message:`${CLI_BIN_NAME} ${latest} available, current ${current}, run: ${command}`}}catch{return null}}