@aigne/cli 1.60.0-beta → 1.74.0-beta

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 (360) hide show
  1. package/README.md +12 -12
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  3. package/dist/bunwrapper.cjs +22 -0
  4. package/dist/bunwrapper.d.cts +1 -0
  5. package/dist/bunwrapper.d.mts +1 -0
  6. package/dist/bunwrapper.mjs +23 -0
  7. package/dist/bunwrapper.mjs.map +1 -0
  8. package/dist/cli.cjs +42 -0
  9. package/dist/cli.d.cts +9 -0
  10. package/dist/cli.d.cts.map +1 -0
  11. package/dist/cli.d.mts +10 -0
  12. package/dist/cli.d.mts.map +1 -0
  13. package/dist/cli.mjs +41 -0
  14. package/dist/cli.mjs.map +1 -0
  15. package/dist/commands/aigne.cjs +23 -0
  16. package/dist/commands/aigne.mjs +22 -0
  17. package/dist/commands/aigne.mjs.map +1 -0
  18. package/dist/commands/app/agent.cjs +117 -0
  19. package/dist/commands/app/agent.mjs +113 -0
  20. package/dist/commands/app/agent.mjs.map +1 -0
  21. package/dist/commands/app/app.cjs +92 -0
  22. package/dist/commands/app/app.mjs +90 -0
  23. package/dist/commands/app/app.mjs.map +1 -0
  24. package/dist/commands/app/cli.cjs +6 -0
  25. package/dist/commands/app/cli.d.cts +1 -0
  26. package/dist/commands/app/cli.d.mts +1 -0
  27. package/dist/commands/app/cli.mjs +8 -0
  28. package/dist/commands/app/cli.mjs.map +1 -0
  29. package/dist/commands/app/upgrade.cjs +243 -0
  30. package/dist/commands/app/upgrade.mjs +240 -0
  31. package/dist/commands/app/upgrade.mjs.map +1 -0
  32. package/dist/commands/app.cjs +53 -0
  33. package/dist/commands/app.mjs +53 -0
  34. package/dist/commands/app.mjs.map +1 -0
  35. package/dist/commands/create.cjs +66 -0
  36. package/dist/commands/create.mjs +65 -0
  37. package/dist/commands/create.mjs.map +1 -0
  38. package/dist/commands/deploy.cjs +237 -0
  39. package/dist/commands/deploy.mjs +237 -0
  40. package/dist/commands/deploy.mjs.map +1 -0
  41. package/dist/commands/eval.cjs +88 -0
  42. package/dist/commands/eval.mjs +88 -0
  43. package/dist/commands/eval.mjs.map +1 -0
  44. package/dist/commands/hub.cjs +297 -0
  45. package/dist/commands/hub.mjs +294 -0
  46. package/dist/commands/hub.mjs.map +1 -0
  47. package/dist/commands/observe.cjs +49 -0
  48. package/dist/commands/observe.mjs +46 -0
  49. package/dist/commands/observe.mjs.map +1 -0
  50. package/dist/commands/run-skill.cjs +84 -0
  51. package/dist/commands/run-skill.mjs +81 -0
  52. package/dist/commands/run-skill.mjs.map +1 -0
  53. package/dist/commands/run.cjs +172 -0
  54. package/dist/commands/run.mjs +171 -0
  55. package/dist/commands/run.mjs.map +1 -0
  56. package/dist/commands/serve-mcp.cjs +68 -0
  57. package/dist/commands/serve-mcp.mjs +67 -0
  58. package/dist/commands/serve-mcp.mjs.map +1 -0
  59. package/dist/commands/test.cjs +40 -0
  60. package/dist/commands/test.mjs +39 -0
  61. package/dist/commands/test.mjs.map +1 -0
  62. package/dist/constants.cjs +28 -0
  63. package/dist/constants.d.cts +9 -0
  64. package/dist/constants.d.cts.map +1 -0
  65. package/dist/constants.d.mts +9 -0
  66. package/dist/constants.d.mts.map +1 -0
  67. package/dist/constants.mjs +24 -0
  68. package/dist/constants.mjs.map +1 -0
  69. package/dist/global.d.cjs +0 -0
  70. package/dist/global.d.cts +6 -0
  71. package/dist/global.d.cts.map +1 -0
  72. package/dist/global.d.mts +6 -0
  73. package/dist/global.d.mts.map +1 -0
  74. package/dist/index.cjs +0 -0
  75. package/dist/index.d.cts +2 -0
  76. package/dist/index.d.mts +2 -0
  77. package/dist/index.mjs +1 -0
  78. package/dist/tracer/terminal.cjs +336 -0
  79. package/dist/tracer/terminal.mjs +332 -0
  80. package/dist/tracer/terminal.mjs.map +1 -0
  81. package/dist/type.cjs +0 -0
  82. package/dist/type.d.cts +10 -0
  83. package/dist/type.d.cts.map +1 -0
  84. package/dist/type.d.mts +10 -0
  85. package/dist/type.d.mts.map +1 -0
  86. package/dist/type.mjs +1 -0
  87. package/dist/ui/utils/terminal-input.cjs +145 -0
  88. package/dist/ui/utils/terminal-input.mjs +144 -0
  89. package/dist/ui/utils/terminal-input.mjs.map +1 -0
  90. package/dist/ui/utils/text-buffer.cjs +865 -0
  91. package/dist/ui/utils/text-buffer.mjs +865 -0
  92. package/dist/ui/utils/text-buffer.mjs.map +1 -0
  93. package/dist/ui/utils/text-utils.cjs +85 -0
  94. package/dist/ui/utils/text-utils.mjs +78 -0
  95. package/dist/ui/utils/text-utils.mjs.map +1 -0
  96. package/dist/utils/agent-v1.cjs +180 -0
  97. package/dist/utils/agent-v1.d.cts +138 -0
  98. package/dist/utils/agent-v1.d.cts.map +1 -0
  99. package/dist/utils/agent-v1.d.mts +138 -0
  100. package/dist/utils/agent-v1.d.mts.map +1 -0
  101. package/dist/utils/agent-v1.mjs +179 -0
  102. package/dist/utils/agent-v1.mjs.map +1 -0
  103. package/dist/utils/aigne-hub/constants.cjs +22 -0
  104. package/dist/utils/aigne-hub/constants.mjs +18 -0
  105. package/dist/utils/aigne-hub/constants.mjs.map +1 -0
  106. package/dist/utils/aigne-hub/credential.cjs +179 -0
  107. package/dist/utils/aigne-hub/credential.mjs +175 -0
  108. package/dist/utils/aigne-hub/credential.mjs.map +1 -0
  109. package/dist/utils/aigne-hub/crypto.cjs +41 -0
  110. package/dist/utils/aigne-hub/crypto.mjs +33 -0
  111. package/dist/utils/aigne-hub/crypto.mjs.map +1 -0
  112. package/dist/utils/aigne-hub/model.cjs +112 -0
  113. package/dist/utils/aigne-hub/model.d.cts +19 -0
  114. package/dist/utils/aigne-hub/model.d.cts.map +1 -0
  115. package/dist/utils/aigne-hub/model.d.mts +19 -0
  116. package/dist/utils/aigne-hub/model.d.mts.map +1 -0
  117. package/dist/utils/aigne-hub/model.mjs +106 -0
  118. package/dist/utils/aigne-hub/model.mjs.map +1 -0
  119. package/dist/utils/aigne-hub/store/file.cjs +64 -0
  120. package/dist/utils/aigne-hub/store/file.mjs +64 -0
  121. package/dist/utils/aigne-hub/store/file.mjs.map +1 -0
  122. package/dist/utils/aigne-hub/store/index.cjs +37 -0
  123. package/dist/utils/aigne-hub/store/index.mjs +37 -0
  124. package/dist/utils/aigne-hub/store/index.mjs.map +1 -0
  125. package/dist/utils/aigne-hub/store/keytar.cjs +61 -0
  126. package/dist/utils/aigne-hub/store/keytar.mjs +61 -0
  127. package/dist/utils/aigne-hub/store/keytar.mjs.map +1 -0
  128. package/dist/utils/aigne-hub/store/migrate.cjs +46 -0
  129. package/dist/utils/aigne-hub/store/migrate.mjs +45 -0
  130. package/dist/utils/aigne-hub/store/migrate.mjs.map +1 -0
  131. package/dist/utils/aigne-hub/type.d.cts +18 -0
  132. package/dist/utils/aigne-hub/type.d.cts.map +1 -0
  133. package/dist/utils/aigne-hub/type.d.mts +18 -0
  134. package/dist/utils/aigne-hub/type.d.mts.map +1 -0
  135. package/dist/utils/aigne-hub-user.cjs +11 -0
  136. package/dist/utils/aigne-hub-user.d.cts +23 -0
  137. package/dist/utils/aigne-hub-user.d.cts.map +1 -0
  138. package/dist/utils/aigne-hub-user.d.mts +23 -0
  139. package/dist/utils/aigne-hub-user.d.mts.map +1 -0
  140. package/dist/utils/aigne-hub-user.mjs +11 -0
  141. package/dist/utils/aigne-hub-user.mjs.map +1 -0
  142. package/dist/utils/ascii-logo.cjs +30 -0
  143. package/dist/utils/ascii-logo.d.cts +5 -0
  144. package/dist/utils/ascii-logo.d.cts.map +1 -0
  145. package/dist/utils/ascii-logo.d.mts +5 -0
  146. package/dist/utils/ascii-logo.d.mts.map +1 -0
  147. package/dist/utils/{ascii-logo.js → ascii-logo.mjs} +13 -3
  148. package/dist/utils/ascii-logo.mjs.map +1 -0
  149. package/dist/utils/download.cjs +25 -0
  150. package/dist/utils/download.d.cts +7 -0
  151. package/dist/utils/download.d.cts.map +1 -0
  152. package/dist/utils/download.d.mts +7 -0
  153. package/dist/utils/download.d.mts.map +1 -0
  154. package/dist/utils/download.mjs +25 -0
  155. package/dist/utils/download.mjs.map +1 -0
  156. package/dist/utils/evaluation/core.cjs +84 -0
  157. package/dist/utils/evaluation/core.mjs +84 -0
  158. package/dist/utils/evaluation/core.mjs.map +1 -0
  159. package/dist/utils/evaluation/dataset.cjs +47 -0
  160. package/dist/utils/evaluation/dataset.mjs +46 -0
  161. package/dist/utils/evaluation/dataset.mjs.map +1 -0
  162. package/dist/utils/evaluation/evaluator.cjs +109 -0
  163. package/dist/utils/evaluation/{evaluator.js → evaluator.mjs} +48 -45
  164. package/dist/utils/evaluation/evaluator.mjs.map +1 -0
  165. package/dist/utils/evaluation/reporter.cjs +225 -0
  166. package/dist/utils/evaluation/reporter.mjs +220 -0
  167. package/dist/utils/evaluation/reporter.mjs.map +1 -0
  168. package/dist/utils/evaluation/runner.cjs +85 -0
  169. package/dist/utils/evaluation/runner.mjs +85 -0
  170. package/dist/utils/evaluation/runner.mjs.map +1 -0
  171. package/dist/utils/get-url-origin.cjs +12 -0
  172. package/dist/utils/get-url-origin.d.cts +5 -0
  173. package/dist/utils/get-url-origin.d.cts.map +1 -0
  174. package/dist/utils/get-url-origin.d.mts +5 -0
  175. package/dist/utils/get-url-origin.d.mts.map +1 -0
  176. package/dist/utils/get-url-origin.mjs +12 -0
  177. package/dist/utils/get-url-origin.mjs.map +1 -0
  178. package/dist/utils/inquirer/checkbox.cjs +265 -0
  179. package/dist/utils/inquirer/checkbox.mjs +262 -0
  180. package/dist/utils/inquirer/checkbox.mjs.map +1 -0
  181. package/dist/utils/listr.cjs +226 -0
  182. package/dist/utils/listr.d.cts +71 -0
  183. package/dist/utils/listr.d.cts.map +1 -0
  184. package/dist/utils/listr.d.mts +71 -0
  185. package/dist/utils/listr.d.mts.map +1 -0
  186. package/dist/utils/listr.mjs +222 -0
  187. package/dist/utils/listr.mjs.map +1 -0
  188. package/dist/utils/load-aigne.cjs +77 -0
  189. package/dist/utils/load-aigne.d.cts +29 -0
  190. package/dist/utils/load-aigne.d.cts.map +1 -0
  191. package/dist/utils/load-aigne.d.mts +29 -0
  192. package/dist/utils/load-aigne.d.mts.map +1 -0
  193. package/dist/utils/load-aigne.mjs +74 -0
  194. package/dist/utils/load-aigne.mjs.map +1 -0
  195. package/dist/utils/run-chat-loop.cjs +90 -0
  196. package/dist/utils/run-chat-loop.d.cts +20 -0
  197. package/dist/utils/run-chat-loop.d.cts.map +1 -0
  198. package/dist/utils/run-chat-loop.d.mts +20 -0
  199. package/dist/utils/run-chat-loop.d.mts.map +1 -0
  200. package/dist/utils/run-chat-loop.mjs +89 -0
  201. package/dist/utils/run-chat-loop.mjs.map +1 -0
  202. package/dist/utils/run-with-aigne.cjs +131 -0
  203. package/dist/utils/run-with-aigne.d.cts +46 -0
  204. package/dist/utils/run-with-aigne.d.cts.map +1 -0
  205. package/dist/utils/run-with-aigne.d.mts +46 -0
  206. package/dist/utils/run-with-aigne.d.mts.map +1 -0
  207. package/dist/utils/run-with-aigne.mjs +126 -0
  208. package/dist/utils/run-with-aigne.mjs.map +1 -0
  209. package/dist/utils/serve-mcp.cjs +91 -0
  210. package/dist/utils/serve-mcp.d.cts +20 -0
  211. package/dist/utils/serve-mcp.d.cts.map +1 -0
  212. package/dist/utils/serve-mcp.d.mts +20 -0
  213. package/dist/utils/serve-mcp.d.mts.map +1 -0
  214. package/dist/utils/serve-mcp.mjs +89 -0
  215. package/dist/utils/serve-mcp.mjs.map +1 -0
  216. package/dist/utils/spinner.cjs +19 -0
  217. package/dist/utils/spinner.d.cts +5 -0
  218. package/dist/utils/spinner.d.cts.map +1 -0
  219. package/dist/utils/spinner.d.mts +5 -0
  220. package/dist/utils/spinner.d.mts.map +1 -0
  221. package/dist/utils/spinner.mjs +19 -0
  222. package/dist/utils/spinner.mjs.map +1 -0
  223. package/dist/utils/string-utils.cjs +11 -0
  224. package/dist/utils/string-utils.d.cts +5 -0
  225. package/dist/utils/string-utils.d.cts.map +1 -0
  226. package/dist/utils/string-utils.d.mts +5 -0
  227. package/dist/utils/string-utils.d.mts.map +1 -0
  228. package/dist/utils/string-utils.mjs +10 -0
  229. package/dist/utils/string-utils.mjs.map +1 -0
  230. package/dist/utils/time.cjs +14 -0
  231. package/dist/utils/time.d.cts +5 -0
  232. package/dist/utils/time.d.cts.map +1 -0
  233. package/dist/utils/time.d.mts +5 -0
  234. package/dist/utils/time.d.mts.map +1 -0
  235. package/dist/utils/time.mjs +14 -0
  236. package/dist/utils/time.mjs.map +1 -0
  237. package/dist/utils/url.cjs +8 -0
  238. package/dist/utils/url.d.cts +5 -0
  239. package/dist/utils/url.d.cts.map +1 -0
  240. package/dist/utils/url.d.mts +5 -0
  241. package/dist/utils/url.d.mts.map +1 -0
  242. package/dist/utils/url.mjs +8 -0
  243. package/dist/utils/url.mjs.map +1 -0
  244. package/dist/utils/yargs.cjs +191 -0
  245. package/dist/utils/yargs.d.cts +96 -0
  246. package/dist/utils/yargs.d.cts.map +1 -0
  247. package/dist/utils/yargs.d.mts +96 -0
  248. package/dist/utils/yargs.d.mts.map +1 -0
  249. package/dist/utils/yargs.mjs +186 -0
  250. package/dist/utils/yargs.mjs.map +1 -0
  251. package/package.json +122 -45
  252. package/CHANGELOG.md +0 -5019
  253. package/dist/bunwrapper.d.ts +0 -2
  254. package/dist/bunwrapper.js +0 -18
  255. package/dist/cli.d.ts +0 -7
  256. package/dist/cli.js +0 -42
  257. package/dist/commands/aigne.d.ts +0 -4
  258. package/dist/commands/aigne.js +0 -35
  259. package/dist/commands/app/agent.d.ts +0 -26
  260. package/dist/commands/app/agent.js +0 -122
  261. package/dist/commands/app/app.d.ts +0 -7
  262. package/dist/commands/app/app.js +0 -92
  263. package/dist/commands/app/cli.d.ts +0 -1
  264. package/dist/commands/app/cli.js +0 -2
  265. package/dist/commands/app/upgrade.d.ts +0 -54
  266. package/dist/commands/app/upgrade.js +0 -236
  267. package/dist/commands/app.d.ts +0 -4
  268. package/dist/commands/app.js +0 -54
  269. package/dist/commands/create.d.ts +0 -6
  270. package/dist/commands/create.js +0 -74
  271. package/dist/commands/deploy.d.ts +0 -11
  272. package/dist/commands/deploy.js +0 -255
  273. package/dist/commands/eval.d.ts +0 -11
  274. package/dist/commands/eval.js +0 -110
  275. package/dist/commands/hub.d.ts +0 -3
  276. package/dist/commands/hub.js +0 -323
  277. package/dist/commands/observe.d.ts +0 -7
  278. package/dist/commands/observe.js +0 -41
  279. package/dist/commands/run-skill.d.ts +0 -6
  280. package/dist/commands/run-skill.js +0 -102
  281. package/dist/commands/run.d.ts +0 -9
  282. package/dist/commands/run.js +0 -187
  283. package/dist/commands/serve-mcp.d.ts +0 -20
  284. package/dist/commands/serve-mcp.js +0 -67
  285. package/dist/commands/test.d.ts +0 -9
  286. package/dist/commands/test.js +0 -33
  287. package/dist/constants.d.ts +0 -7
  288. package/dist/constants.js +0 -21
  289. package/dist/index.d.ts +0 -1
  290. package/dist/index.js +0 -1
  291. package/dist/tracer/terminal.d.ts +0 -62
  292. package/dist/tracer/terminal.js +0 -404
  293. package/dist/type.d.ts +0 -5
  294. package/dist/type.js +0 -1
  295. package/dist/ui/utils/terminal-input.d.ts +0 -19
  296. package/dist/ui/utils/terminal-input.js +0 -123
  297. package/dist/ui/utils/text-buffer.d.ts +0 -87
  298. package/dist/ui/utils/text-buffer.js +0 -1059
  299. package/dist/ui/utils/text-utils.d.ts +0 -37
  300. package/dist/ui/utils/text-utils.js +0 -185
  301. package/dist/utils/agent-v1.d.ts +0 -134
  302. package/dist/utils/agent-v1.js +0 -213
  303. package/dist/utils/aigne-hub/constants.d.ts +0 -6
  304. package/dist/utils/aigne-hub/constants.js +0 -12
  305. package/dist/utils/aigne-hub/credential.d.ts +0 -20
  306. package/dist/utils/aigne-hub/credential.js +0 -182
  307. package/dist/utils/aigne-hub/crypto.d.ts +0 -4
  308. package/dist/utils/aigne-hub/crypto.js +0 -30
  309. package/dist/utils/aigne-hub/model.d.ts +0 -13
  310. package/dist/utils/aigne-hub/model.js +0 -122
  311. package/dist/utils/aigne-hub/store/file.d.ts +0 -15
  312. package/dist/utils/aigne-hub/store/file.js +0 -69
  313. package/dist/utils/aigne-hub/store/index.d.ts +0 -5
  314. package/dist/utils/aigne-hub/store/index.js +0 -43
  315. package/dist/utils/aigne-hub/store/keytar.d.ts +0 -15
  316. package/dist/utils/aigne-hub/store/keytar.js +0 -67
  317. package/dist/utils/aigne-hub/store/migrate.d.ts +0 -2
  318. package/dist/utils/aigne-hub/store/migrate.js +0 -57
  319. package/dist/utils/aigne-hub/type.d.ts +0 -38
  320. package/dist/utils/aigne-hub/type.js +0 -1
  321. package/dist/utils/aigne-hub-user.d.ts +0 -16
  322. package/dist/utils/aigne-hub-user.js +0 -10
  323. package/dist/utils/ascii-logo.d.ts +0 -1
  324. package/dist/utils/download.d.ts +0 -3
  325. package/dist/utils/download.js +0 -19
  326. package/dist/utils/evaluation/core.d.ts +0 -8
  327. package/dist/utils/evaluation/core.js +0 -83
  328. package/dist/utils/evaluation/dataset.d.ts +0 -15
  329. package/dist/utils/evaluation/dataset.js +0 -61
  330. package/dist/utils/evaluation/evaluator.d.ts +0 -9
  331. package/dist/utils/evaluation/reporter.d.ts +0 -28
  332. package/dist/utils/evaluation/reporter.js +0 -221
  333. package/dist/utils/evaluation/runner.d.ts +0 -16
  334. package/dist/utils/evaluation/runner.js +0 -129
  335. package/dist/utils/evaluation/type.d.ts +0 -69
  336. package/dist/utils/evaluation/type.js +0 -1
  337. package/dist/utils/get-url-origin.d.ts +0 -1
  338. package/dist/utils/get-url-origin.js +0 -8
  339. package/dist/utils/inquirer/checkbox.d.ts +0 -55
  340. package/dist/utils/inquirer/checkbox.js +0 -319
  341. package/dist/utils/listr.d.ts +0 -64
  342. package/dist/utils/listr.js +0 -265
  343. package/dist/utils/load-aigne.d.ts +0 -18
  344. package/dist/utils/load-aigne.js +0 -80
  345. package/dist/utils/run-chat-loop.d.ts +0 -15
  346. package/dist/utils/run-chat-loop.js +0 -87
  347. package/dist/utils/run-with-aigne.d.ts +0 -27
  348. package/dist/utils/run-with-aigne.js +0 -157
  349. package/dist/utils/serve-mcp.d.ts +0 -9
  350. package/dist/utils/serve-mcp.js +0 -93
  351. package/dist/utils/spinner.d.ts +0 -1
  352. package/dist/utils/spinner.js +0 -14
  353. package/dist/utils/string-utils.d.ts +0 -1
  354. package/dist/utils/string-utils.js +0 -4
  355. package/dist/utils/time.d.ts +0 -1
  356. package/dist/utils/time.js +0 -12
  357. package/dist/utils/url.d.ts +0 -1
  358. package/dist/utils/url.js +0 -3
  359. package/dist/utils/yargs.d.ts +0 -94
  360. package/dist/utils/yargs.js +0 -210
@@ -1,54 +0,0 @@
1
- import { fork } from "node:child_process";
2
- import { dirname, join } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import { NeedReinstallBetaError, NeedReinstallError } from "./app/upgrade.js";
5
- const builtinApps = [
6
- {
7
- name: "doc-smith",
8
- packageName: "@aigne/doc-smith",
9
- describe: "Generate and maintain project docs — powered by agents.",
10
- aliases: ["docsmith", "doc"],
11
- },
12
- {
13
- name: "web-smith",
14
- packageName: "@aigne/web-smith",
15
- describe: "Generate and maintain project website pages — powered by agents.",
16
- aliases: ["websmith", "web"],
17
- },
18
- ];
19
- export function createAppCommands({ argv } = {}) {
20
- return builtinApps.map((app) => ({
21
- command: app.name,
22
- describe: app.describe,
23
- aliases: app.aliases,
24
- builder: async (y) => y.help(false).version(false).strict(false),
25
- handler: async () => {
26
- let retried = false;
27
- let retryWithBeta = false;
28
- while (true) {
29
- const child = fork(join(dirname(fileURLToPath(import.meta.url)), "./app/cli.js"), argv, {
30
- stdio: "inherit",
31
- env: {
32
- ...process.env,
33
- AIGNE_APP_NAME: app.name,
34
- AIGNE_APP_PACKAGE_NAME: app.packageName,
35
- AIGNE_APP_DESCRIPTION: app.describe,
36
- AIGNE_APP_USE_BETA_APPS: retryWithBeta ? "1" : "0",
37
- },
38
- });
39
- const code = await new Promise((resolve) => {
40
- child.on("exit", (code) => resolve(code));
41
- });
42
- if (code === NeedReinstallError.code || code === NeedReinstallBetaError.code) {
43
- if (retried)
44
- process.exit(1);
45
- retryWithBeta = code === NeedReinstallBetaError.code;
46
- retried = true;
47
- }
48
- else {
49
- process.exit(code);
50
- }
51
- }
52
- },
53
- }));
54
- }
@@ -1,6 +0,0 @@
1
- import type { CommandModule } from "yargs";
2
- interface CreateOptions {
3
- path: string;
4
- }
5
- export declare function createCreateCommand(): CommandModule<unknown, CreateOptions>;
6
- export {};
@@ -1,74 +0,0 @@
1
- import { existsSync, mkdirSync, readdirSync } from "node:fs";
2
- import { cp } from "node:fs/promises";
3
- import { dirname, isAbsolute, join, relative, resolve } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import inquirer from "inquirer";
6
- export function createCreateCommand() {
7
- return {
8
- command: "create [path]",
9
- describe: "Create a new aigne project with agent config files",
10
- builder: (yargs) => {
11
- return yargs.positional("path", {
12
- describe: "Path to create the project directory",
13
- type: "string",
14
- default: ".",
15
- });
16
- },
17
- handler: async ({ path }) => {
18
- if (path === ".") {
19
- const answers = await inquirer.prompt([
20
- {
21
- type: "input",
22
- name: "projectName",
23
- message: "Project name:",
24
- default: path !== "." ? path : "my-aigne-project",
25
- validate: (input) => {
26
- if (input.trim() === "")
27
- return "Project name cannot be empty.";
28
- return true;
29
- },
30
- },
31
- ]);
32
- path = answers.projectName;
33
- }
34
- path = isAbsolute(path) ? path : resolve(process.cwd(), path);
35
- const isPathNotEmpty = existsSync(path) && readdirSync(path).length > 0;
36
- if (isPathNotEmpty) {
37
- const answers = await inquirer.prompt([
38
- {
39
- type: "confirm",
40
- name: "overwrite",
41
- message: `The directory "${path}" is not empty. Do you want to remove its contents?`,
42
- default: false,
43
- },
44
- ]);
45
- if (!answers.overwrite) {
46
- console.log("Operation cancelled.");
47
- process.exit(0);
48
- }
49
- }
50
- const templates = [{ name: "default" }];
51
- const { template } = await inquirer.prompt([
52
- {
53
- type: "list",
54
- name: "template",
55
- message: "Select a template:",
56
- choices: templates.map((t) => t.name),
57
- default: "default",
58
- },
59
- ]);
60
- mkdirSync(path, { recursive: true });
61
- const templatePath = join(dirname(fileURLToPath(import.meta.url)), "../../templates", template);
62
- if (!existsSync(templatePath))
63
- throw new Error(`Template "${template}" not found.`);
64
- const files = readdirSync(templatePath);
65
- for (const file of files) {
66
- const source = join(templatePath, file);
67
- const destination = join(path, file);
68
- await cp(source, destination, { recursive: true, force: true });
69
- }
70
- console.log("\n✅ AIGNE project created successfully!");
71
- console.log(`\nTo use your new agent, run:\n cd ${relative(process.cwd(), path)} && aigne run`);
72
- },
73
- };
74
- }
@@ -1,11 +0,0 @@
1
- import type { CommandModule } from "yargs";
2
- interface DeployOptions {
3
- path?: string;
4
- endpoint?: string;
5
- }
6
- export declare function fileExists(p: string): Promise<boolean>;
7
- export declare const DEPLOYED_FILE: string;
8
- export declare function run(cmd: string, args?: string[], opts?: any): Promise<string>;
9
- export declare function createDeployCommands(): CommandModule<unknown, DeployOptions>;
10
- export declare const deploy: (path: string, endpoint: string) => Promise<void>;
11
- export {};
@@ -1,255 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- import { constants } from "node:fs";
3
- import { access, copyFile, mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
4
- import { homedir } from "node:os";
5
- import { basename, dirname, isAbsolute, join, resolve } from "node:path";
6
- import { fileURLToPath } from "node:url";
7
- import { Listr } from "@aigne/listr2";
8
- import { input as inputInquirer, select as selectInquirer } from "@inquirer/prompts";
9
- import { ListrInquirerPromptAdapter } from "@listr2/prompt-adapter-inquirer";
10
- import { parse, stringify } from "yaml";
11
- import { isTest } from "../utils/aigne-hub/constants.js";
12
- export async function fileExists(p) {
13
- try {
14
- await access(p, constants.F_OK);
15
- return true;
16
- }
17
- catch {
18
- return false;
19
- }
20
- }
21
- export const DEPLOYED_FILE = isTest ? "deployed.test.yaml" : "deployed.yaml";
22
- export async function run(cmd, args = [], opts = {}) {
23
- return new Promise((resolve, reject) => {
24
- const { catchOutput = true, ...rest } = opts;
25
- const spawnOpts = { shell: true, ...rest, stdio: catchOutput ? "pipe" : "inherit" };
26
- const child = spawn(cmd, args, spawnOpts);
27
- if (catchOutput) {
28
- let stdout = "";
29
- let stderr = "";
30
- child.stdout?.on("data", (data) => {
31
- stdout += data.toString();
32
- });
33
- child.stderr?.on("data", (data) => {
34
- stderr += data.toString();
35
- });
36
- child.on("close", (code) => {
37
- if (code === 0) {
38
- resolve(stdout.trim());
39
- }
40
- else {
41
- reject(new Error(stderr.trim() || `Process failed with code ${code}`));
42
- }
43
- });
44
- }
45
- else {
46
- child.on("close", (code) => {
47
- if (code === 0) {
48
- resolve("");
49
- }
50
- else {
51
- reject(new Error(`${cmd} ${args.join(" ")} failed with code ${code}`));
52
- }
53
- });
54
- }
55
- });
56
- }
57
- export function createDeployCommands() {
58
- return {
59
- command: "deploy",
60
- describe: "Deploy an aigne application",
61
- builder: (yargs) => {
62
- return yargs
63
- .option("path", {
64
- type: "string",
65
- })
66
- .option("endpoint", {
67
- type: "string",
68
- describe: "Deploy an aigne application to a specified endpoint.",
69
- });
70
- },
71
- handler: async (argv) => {
72
- const path = argv.path;
73
- const endpoint = argv.endpoint;
74
- if (!path) {
75
- console.error("path is required");
76
- process.exit(1);
77
- }
78
- if (!endpoint) {
79
- console.error("endpoint is required");
80
- process.exit(1);
81
- }
82
- const absolutePath = isAbsolute(path) ? path : resolve(process.cwd(), path);
83
- await deploy(absolutePath, endpoint);
84
- },
85
- };
86
- }
87
- async function copyDir(src, dest) {
88
- await mkdir(dest, { recursive: true });
89
- const entries = await readdir(src, { withFileTypes: true });
90
- const skip = [".deploy", "node_modules"];
91
- for (const entry of entries) {
92
- const srcPath = join(src, entry.name);
93
- const destPath = join(dest, entry.name);
94
- if (skip.includes(entry.name))
95
- continue;
96
- if (entry.isDirectory()) {
97
- await copyDir(srcPath, destPath);
98
- }
99
- else {
100
- await copyFile(srcPath, destPath);
101
- }
102
- }
103
- }
104
- export const deploy = async (path, endpoint) => {
105
- const aigneHomeDir = join(homedir(), ".aigne");
106
- if (!(await fileExists(aigneHomeDir))) {
107
- await mkdir(aigneHomeDir, { recursive: true });
108
- }
109
- const deployRoot = join(path, ".deploy");
110
- const agentDest = join(deployRoot, "agent");
111
- const tasks = new Listr([
112
- {
113
- title: "Prepare deploy environment",
114
- task: async (ctx, task) => {
115
- ctx.logs = [];
116
- task.output = "Preparing deploy environment...";
117
- const entryFile = join(path, "aigne.yaml");
118
- if (!(await fileExists(entryFile))) {
119
- throw new Error(`Entry file not found: ${entryFile}`);
120
- }
121
- await rm(deployRoot, { recursive: true, force: true });
122
- task.output = "Copying template files...";
123
- const templatePath = join(dirname(fileURLToPath(import.meta.url)), "../../templates/blocklet");
124
- await copyDir(templatePath, deployRoot);
125
- await copyDir(path, agentDest);
126
- const specialFiles = [
127
- "package.json",
128
- "package-lock.json",
129
- "README.md",
130
- "CHANGELOG.md",
131
- "biome.json",
132
- ];
133
- for (const file of specialFiles) {
134
- const srcFile = join(path, file);
135
- if (await fileExists(srcFile)) {
136
- await copyFile(srcFile, join(deployRoot, file));
137
- await rm(join(deployRoot, file), { force: true });
138
- }
139
- }
140
- if (await fileExists(join(deployRoot, "package.json"))) {
141
- task.output = "Running npm install...";
142
- await run("npm", ["install"], { cwd: deployRoot });
143
- }
144
- },
145
- },
146
- {
147
- title: "Check Blocklet CLI",
148
- task: async (_, task) => {
149
- try {
150
- task.output = "Checking Blocklet CLI Version...";
151
- await run("blocklet", ["--version"], { cwd: deployRoot });
152
- }
153
- catch {
154
- task.output = "Blocklet CLI not installed, asking to install...";
155
- const { install } = await task
156
- .prompt(ListrInquirerPromptAdapter)
157
- .run(selectInquirer, {
158
- type: "list",
159
- name: "install",
160
- message: "Install Blocklet CLI?",
161
- choices: ["yes", "no"],
162
- default: "yes",
163
- });
164
- if (install === "yes") {
165
- task.output = "Installing Blocklet CLI...";
166
- await run("npm", ["install", "-g", "@blocklet/cli"], { cwd: deployRoot });
167
- }
168
- else {
169
- throw new Error("Blocklet CLI not found, please install manually: npm install -g @blocklet/cli");
170
- }
171
- }
172
- },
173
- },
174
- {
175
- title: "Configure Blocklet",
176
- task: async (ctx, task) => {
177
- task.output = "Configuring Blocklet...";
178
- if (await fileExists(join(deployRoot, "blocklet.yml"))) {
179
- const entryFile = join(path, "aigne.yaml");
180
- const aigneFile = await readFile(entryFile, "utf-8");
181
- const aigneData = parse(aigneFile);
182
- const agentName = aigneData.name;
183
- const deployed = parse(await readFile(join(aigneHomeDir, DEPLOYED_FILE), "utf-8").catch(() => stringify({})));
184
- let blockletName = deployed[path]?.name;
185
- if (!blockletName) {
186
- task.output = "Asking for Blocklet name...";
187
- blockletName = await task
188
- .prompt(ListrInquirerPromptAdapter)
189
- .run(inputInquirer, {
190
- type: "input",
191
- name: "blockletName",
192
- message: "Please input agent blocklet name:",
193
- default: deployed[path]?.name || agentName || basename(path),
194
- validate: (input) => {
195
- if (input.trim() === "")
196
- return "Blocklet name cannot be empty.";
197
- return true;
198
- },
199
- });
200
- }
201
- let did = deployed[path]?.did;
202
- if (!did) {
203
- task.output = "Creating DID...";
204
- const info = await run("blocklet", ["create", "--did-only"], {
205
- cwd: deployRoot,
206
- catchOutput: true,
207
- });
208
- const match = info.match(/Created Blocklet DID:\s+(\S+)/);
209
- if (match?.[1]) {
210
- did = match[1];
211
- }
212
- else {
213
- throw new Error(`DID not found. Output content: ${info}`);
214
- }
215
- }
216
- task.output = `Blocklet name: ${blockletName}, DID: ${did}`;
217
- ctx.logs.push(task.output);
218
- const yml = await readFile(join(deployRoot, "blocklet.yml"), "utf-8");
219
- const data = parse(yml);
220
- data.name = blockletName;
221
- data.title = blockletName;
222
- data.did = did;
223
- await writeFile(join(deployRoot, "blocklet.yml"), stringify(data));
224
- await writeFile(join(aigneHomeDir, DEPLOYED_FILE), stringify({ ...deployed, [path]: { name: blockletName, did } }));
225
- }
226
- },
227
- },
228
- {
229
- title: "Bundle Blocklet",
230
- task: async (_, task) => {
231
- task.output = "Running blocklet bundle...";
232
- await run("blocklet", ["bundle", "--create-release"], { cwd: deployRoot });
233
- },
234
- },
235
- ], {
236
- concurrent: false,
237
- exitOnError: true,
238
- rendererOptions: {
239
- collapseSubtasks: false,
240
- },
241
- });
242
- try {
243
- await tasks.run();
244
- await run("blocklet", ["deploy", "--endpoint", endpoint, ".blocklet/bundle"], {
245
- cwd: deployRoot,
246
- catchOutput: false,
247
- });
248
- await rm(deployRoot, { recursive: true, force: true });
249
- console.log(`✅ Deploy completed: ${path} -> ${endpoint}`);
250
- }
251
- catch (error) {
252
- console.error(`❌ Deploy failed: ${error instanceof Error ? error.message : String(error)}`);
253
- process.exit(1);
254
- }
255
- };
@@ -1,11 +0,0 @@
1
- import type { CommandModule } from "yargs";
2
- export declare function createEvalCommand({ aigneFilePath, }?: {
3
- aigneFilePath?: string;
4
- }): CommandModule<unknown, {
5
- path?: string;
6
- agent?: string;
7
- dataset?: string;
8
- evaluator?: string;
9
- concurrency?: number;
10
- output?: string;
11
- }>;
@@ -1,110 +0,0 @@
1
- import { isAbsolute, resolve } from "node:path";
2
- import { exists } from "@aigne/agent-library/utils/fs.js";
3
- import { findCliAgent } from "@aigne/core/utils/agent-utils.js";
4
- import { z } from "zod";
5
- import { runEvaluationPipeline } from "../utils/evaluation/core.js";
6
- import { FileDataset } from "../utils/evaluation/dataset.js";
7
- import { LLMEvaluator } from "../utils/evaluation/evaluator.js";
8
- import { ConsoleReporter, CsvReporter } from "../utils/evaluation/reporter.js";
9
- import { DefaultRunnerWithConcurrency } from "../utils/evaluation/runner.js";
10
- import { loadAIGNE } from "../utils/load-aigne.js";
11
- const schema = z.object({
12
- path: z.string().optional(),
13
- agent: z.string(),
14
- dataset: z.string(),
15
- evaluator: z.string().optional(),
16
- concurrency: z.number().optional(),
17
- output: z.string().optional(),
18
- });
19
- const getResolvePath = (path) => {
20
- return isAbsolute(path) ? path : resolve(process.cwd(), path);
21
- };
22
- export function createEvalCommand({ aigneFilePath, } = {}) {
23
- return {
24
- command: "eval [path] [agent]",
25
- describe: "Evaluate AIGNE for the specified path",
26
- builder: async (yargs) => {
27
- return yargs
28
- .positional("path", {
29
- type: "string",
30
- describe: "Path to the agents directory or URL to an aigne project",
31
- default: ".",
32
- })
33
- .positional("agent", {
34
- type: "string",
35
- describe: "Name of the agent to evaluate",
36
- })
37
- .positional("dataset", {
38
- type: "string",
39
- describe: "Path to the dataset file",
40
- })
41
- .positional("evaluator", {
42
- type: "string",
43
- describe: "Name of the evaluator to use",
44
- })
45
- .positional("output", {
46
- alias: "o",
47
- type: "string",
48
- describe: "Path to the output file",
49
- })
50
- .positional("concurrency", {
51
- type: "number",
52
- describe: "Concurrency level",
53
- default: 1,
54
- })
55
- .help(false)
56
- .version(false)
57
- .strict(false);
58
- },
59
- handler: async (options) => {
60
- const parsedOptions = await schema.safeParseAsync(options);
61
- if (!parsedOptions.success) {
62
- throw new Error(`Invalid options: ${JSON.stringify(parsedOptions.error.format())}`);
63
- }
64
- const { agent: entryAgent, dataset: datasetPath, evaluator: evaluatorName, concurrency, } = parsedOptions.data;
65
- const path = parsedOptions.data?.path;
66
- const aigne = await loadAIGNE({ path: aigneFilePath || path || "." });
67
- const resolvedDatasetPath = getResolvePath(datasetPath);
68
- if (!(await exists(resolvedDatasetPath))) {
69
- throw new Error("Dataset file does not exist");
70
- }
71
- const { chat } = aigne.cli;
72
- const agent = chat && chat.name === entryAgent
73
- ? chat
74
- : findCliAgent(aigne.cli, "*", entryAgent) ||
75
- aigne.agents[entryAgent] ||
76
- aigne.skills[entryAgent] ||
77
- aigne.mcpServer.agents[entryAgent];
78
- if (!agent)
79
- throw new Error("Entry agent does not exist");
80
- agent.model = agent.model ?? aigne.model;
81
- let evaluatorAgent;
82
- if (evaluatorName) {
83
- evaluatorAgent =
84
- findCliAgent(aigne.cli, "*", evaluatorName) ||
85
- aigne.agents[evaluatorName] ||
86
- aigne.skills[evaluatorName] ||
87
- aigne.mcpServer.agents[evaluatorName];
88
- }
89
- if (evaluatorAgent) {
90
- evaluatorAgent.model = evaluatorAgent.model ?? aigne.model;
91
- }
92
- const dataset = new FileDataset(resolvedDatasetPath);
93
- const runner = new DefaultRunnerWithConcurrency(agent, aigne);
94
- const evaluator = new LLMEvaluator(aigne, evaluatorAgent);
95
- const reporters = [new ConsoleReporter()];
96
- if (options.output) {
97
- const resolvedReporterPath = getResolvePath(options.output);
98
- const reporter = new CsvReporter(resolvedReporterPath);
99
- reporters.push(reporter);
100
- }
101
- await runEvaluationPipeline({
102
- dataset,
103
- runner,
104
- evaluators: [evaluator],
105
- reporters: reporters,
106
- options: { concurrency },
107
- });
108
- },
109
- };
110
- }
@@ -1,3 +0,0 @@
1
- import type { CommandModule } from "yargs";
2
- export declare const formatNumber: (balance: string) => string;
3
- export declare function createHubCommand(): CommandModule;