@aigne/afs-cli 1.11.0-beta.5 → 1.11.0-beta.7

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 (318) hide show
  1. package/dist/cli.cjs +25 -328
  2. package/dist/cli.d.cts +2 -1
  3. package/dist/cli.d.mts +2 -1
  4. package/dist/cli.mjs +26 -328
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/config/afs-loader.cjs +123 -0
  7. package/dist/config/afs-loader.d.cts +14 -0
  8. package/dist/config/afs-loader.d.cts.map +1 -0
  9. package/dist/config/afs-loader.d.mts +14 -0
  10. package/dist/config/afs-loader.d.mts.map +1 -0
  11. package/dist/config/afs-loader.mjs +122 -0
  12. package/dist/config/afs-loader.mjs.map +1 -0
  13. package/dist/config/loader.cjs +14 -3
  14. package/dist/config/loader.mjs +14 -3
  15. package/dist/config/loader.mjs.map +1 -1
  16. package/dist/{commands/mount.cjs → config/mount-commands.cjs} +13 -49
  17. package/dist/config/mount-commands.d.cts +20 -0
  18. package/dist/config/mount-commands.d.cts.map +1 -0
  19. package/dist/config/mount-commands.d.mts +20 -0
  20. package/dist/config/mount-commands.d.mts.map +1 -0
  21. package/dist/{commands/mount.mjs → config/mount-commands.mjs} +14 -49
  22. package/dist/config/mount-commands.mjs.map +1 -0
  23. package/dist/config/schema.cjs +9 -1
  24. package/dist/config/schema.mjs +9 -1
  25. package/dist/config/schema.mjs.map +1 -1
  26. package/dist/core/commands/delete.cjs +41 -0
  27. package/dist/core/commands/delete.d.cts +18 -0
  28. package/dist/core/commands/delete.d.cts.map +1 -0
  29. package/dist/core/commands/delete.d.mts +18 -0
  30. package/dist/core/commands/delete.d.mts.map +1 -0
  31. package/dist/core/commands/delete.mjs +42 -0
  32. package/dist/core/commands/delete.mjs.map +1 -0
  33. package/dist/core/commands/exec.cjs +95 -0
  34. package/dist/core/commands/exec.d.cts +26 -0
  35. package/dist/core/commands/exec.d.cts.map +1 -0
  36. package/dist/core/commands/exec.d.mts +26 -0
  37. package/dist/core/commands/exec.d.mts.map +1 -0
  38. package/dist/core/commands/exec.mjs +96 -0
  39. package/dist/core/commands/exec.mjs.map +1 -0
  40. package/dist/core/commands/explain.cjs +254 -0
  41. package/dist/core/commands/explain.d.cts +25 -0
  42. package/dist/core/commands/explain.d.cts.map +1 -0
  43. package/dist/core/commands/explain.d.mts +25 -0
  44. package/dist/core/commands/explain.d.mts.map +1 -0
  45. package/dist/core/commands/explain.mjs +255 -0
  46. package/dist/core/commands/explain.mjs.map +1 -0
  47. package/dist/core/commands/explore.cjs +30 -0
  48. package/dist/core/commands/explore.d.mts +2 -0
  49. package/dist/core/commands/explore.mjs +31 -0
  50. package/dist/core/commands/explore.mjs.map +1 -0
  51. package/dist/core/commands/index.cjs +36 -0
  52. package/dist/core/commands/index.d.cts +21 -0
  53. package/dist/core/commands/index.d.cts.map +1 -0
  54. package/dist/core/commands/index.d.mts +24 -0
  55. package/dist/core/commands/index.d.mts.map +1 -0
  56. package/dist/core/commands/index.mjs +37 -0
  57. package/dist/core/commands/index.mjs.map +1 -0
  58. package/dist/core/commands/ls.cjs +57 -0
  59. package/dist/core/commands/ls.d.cts +21 -0
  60. package/dist/core/commands/ls.d.cts.map +1 -0
  61. package/dist/core/commands/ls.d.mts +21 -0
  62. package/dist/core/commands/ls.d.mts.map +1 -0
  63. package/dist/core/commands/ls.mjs +58 -0
  64. package/dist/core/commands/ls.mjs.map +1 -0
  65. package/dist/core/commands/mount.cjs +139 -0
  66. package/dist/core/commands/mount.d.cts +33 -0
  67. package/dist/core/commands/mount.d.cts.map +1 -0
  68. package/dist/core/commands/mount.d.mts +33 -0
  69. package/dist/core/commands/mount.d.mts.map +1 -0
  70. package/dist/core/commands/mount.mjs +140 -0
  71. package/dist/core/commands/mount.mjs.map +1 -0
  72. package/dist/core/commands/read.cjs +48 -0
  73. package/dist/core/commands/read.d.cts +17 -0
  74. package/dist/core/commands/read.d.cts.map +1 -0
  75. package/dist/core/commands/read.d.mts +17 -0
  76. package/dist/core/commands/read.d.mts.map +1 -0
  77. package/dist/core/commands/read.mjs +49 -0
  78. package/dist/core/commands/read.mjs.map +1 -0
  79. package/dist/core/commands/search.cjs +40 -0
  80. package/dist/core/commands/search.d.mts +2 -0
  81. package/dist/core/commands/search.mjs +41 -0
  82. package/dist/core/commands/search.mjs.map +1 -0
  83. package/dist/core/commands/serve.cjs +242 -0
  84. package/dist/core/commands/serve.d.mts +2 -0
  85. package/dist/core/commands/serve.mjs +242 -0
  86. package/dist/core/commands/serve.mjs.map +1 -0
  87. package/dist/core/commands/stat.cjs +53 -0
  88. package/dist/core/commands/stat.d.cts +17 -0
  89. package/dist/core/commands/stat.d.cts.map +1 -0
  90. package/dist/core/commands/stat.d.mts +17 -0
  91. package/dist/core/commands/stat.d.mts.map +1 -0
  92. package/dist/core/commands/stat.mjs +54 -0
  93. package/dist/core/commands/stat.mjs.map +1 -0
  94. package/dist/core/commands/types.cjs +13 -0
  95. package/dist/core/commands/types.d.cts +54 -0
  96. package/dist/core/commands/types.d.cts.map +1 -0
  97. package/dist/core/commands/types.d.mts +54 -0
  98. package/dist/core/commands/types.d.mts.map +1 -0
  99. package/dist/core/commands/types.mjs +14 -0
  100. package/dist/core/commands/types.mjs.map +1 -0
  101. package/dist/core/commands/write.cjs +70 -0
  102. package/dist/core/commands/write.d.cts +20 -0
  103. package/dist/core/commands/write.d.cts.map +1 -0
  104. package/dist/core/commands/write.d.mts +20 -0
  105. package/dist/core/commands/write.d.mts.map +1 -0
  106. package/dist/core/commands/write.mjs +71 -0
  107. package/dist/core/commands/write.mjs.map +1 -0
  108. package/dist/core/executor/index.cjs +196 -0
  109. package/dist/core/executor/index.d.cts +77 -0
  110. package/dist/core/executor/index.d.cts.map +1 -0
  111. package/dist/core/executor/index.d.mts +77 -0
  112. package/dist/core/executor/index.d.mts.map +1 -0
  113. package/dist/core/executor/index.mjs +195 -0
  114. package/dist/core/executor/index.mjs.map +1 -0
  115. package/dist/core/formatters/delete.cjs +37 -0
  116. package/dist/core/formatters/delete.d.cts +18 -0
  117. package/dist/core/formatters/delete.d.cts.map +1 -0
  118. package/dist/core/formatters/delete.d.mts +18 -0
  119. package/dist/core/formatters/delete.d.mts.map +1 -0
  120. package/dist/core/formatters/delete.mjs +37 -0
  121. package/dist/core/formatters/delete.mjs.map +1 -0
  122. package/dist/core/formatters/exec.cjs +60 -0
  123. package/dist/core/formatters/exec.d.cts +18 -0
  124. package/dist/core/formatters/exec.d.cts.map +1 -0
  125. package/dist/core/formatters/exec.d.mts +18 -0
  126. package/dist/core/formatters/exec.d.mts.map +1 -0
  127. package/dist/core/formatters/exec.mjs +60 -0
  128. package/dist/core/formatters/exec.mjs.map +1 -0
  129. package/dist/core/formatters/explain.cjs +97 -0
  130. package/dist/core/formatters/explain.d.cts +11 -0
  131. package/dist/core/formatters/explain.d.cts.map +1 -0
  132. package/dist/core/formatters/explain.d.mts +11 -0
  133. package/dist/core/formatters/explain.d.mts.map +1 -0
  134. package/dist/core/formatters/explain.mjs +96 -0
  135. package/dist/core/formatters/explain.mjs.map +1 -0
  136. package/dist/core/formatters/index.d.mts +9 -0
  137. package/dist/core/formatters/ls.cjs +179 -0
  138. package/dist/core/formatters/ls.d.cts +20 -0
  139. package/dist/core/formatters/ls.d.cts.map +1 -0
  140. package/dist/core/formatters/ls.d.mts +20 -0
  141. package/dist/core/formatters/ls.d.mts.map +1 -0
  142. package/dist/core/formatters/ls.mjs +179 -0
  143. package/dist/core/formatters/ls.mjs.map +1 -0
  144. package/dist/core/formatters/mount.cjs +55 -0
  145. package/dist/core/formatters/mount.d.cts +15 -0
  146. package/dist/core/formatters/mount.d.cts.map +1 -0
  147. package/dist/core/formatters/mount.d.mts +15 -0
  148. package/dist/core/formatters/mount.d.mts.map +1 -0
  149. package/dist/core/formatters/mount.mjs +55 -0
  150. package/dist/core/formatters/mount.mjs.map +1 -0
  151. package/dist/core/formatters/read.cjs +100 -0
  152. package/dist/core/formatters/read.d.cts +22 -0
  153. package/dist/core/formatters/read.d.cts.map +1 -0
  154. package/dist/core/formatters/read.d.mts +22 -0
  155. package/dist/core/formatters/read.d.mts.map +1 -0
  156. package/dist/core/formatters/read.mjs +100 -0
  157. package/dist/core/formatters/read.mjs.map +1 -0
  158. package/dist/core/formatters/search.cjs +44 -0
  159. package/dist/core/formatters/search.d.mts +1 -0
  160. package/dist/core/formatters/search.mjs +44 -0
  161. package/dist/core/formatters/search.mjs.map +1 -0
  162. package/dist/core/formatters/stat.cjs +155 -0
  163. package/dist/core/formatters/stat.d.cts +15 -0
  164. package/dist/core/formatters/stat.d.cts.map +1 -0
  165. package/dist/core/formatters/stat.d.mts +15 -0
  166. package/dist/core/formatters/stat.d.mts.map +1 -0
  167. package/dist/core/formatters/stat.mjs +155 -0
  168. package/dist/core/formatters/stat.mjs.map +1 -0
  169. package/dist/core/formatters/write.cjs +51 -0
  170. package/dist/core/formatters/write.d.cts +22 -0
  171. package/dist/core/formatters/write.d.cts.map +1 -0
  172. package/dist/core/formatters/write.d.mts +22 -0
  173. package/dist/core/formatters/write.d.mts.map +1 -0
  174. package/dist/core/formatters/write.mjs +51 -0
  175. package/dist/core/formatters/write.mjs.map +1 -0
  176. package/dist/core/helpers/exec-args.cjs +142 -0
  177. package/dist/core/helpers/exec-args.d.cts +46 -0
  178. package/dist/core/helpers/exec-args.d.cts.map +1 -0
  179. package/dist/core/helpers/exec-args.d.mts +46 -0
  180. package/dist/core/helpers/exec-args.d.mts.map +1 -0
  181. package/dist/core/helpers/exec-args.mjs +139 -0
  182. package/dist/core/helpers/exec-args.mjs.map +1 -0
  183. package/dist/core/helpers/stdin.cjs +41 -0
  184. package/dist/core/helpers/stdin.d.cts +15 -0
  185. package/dist/core/helpers/stdin.d.cts.map +1 -0
  186. package/dist/core/helpers/stdin.d.mts +15 -0
  187. package/dist/core/helpers/stdin.d.mts.map +1 -0
  188. package/dist/core/helpers/stdin.mjs +41 -0
  189. package/dist/core/helpers/stdin.mjs.map +1 -0
  190. package/dist/core/index.cjs +49 -0
  191. package/dist/core/index.d.cts +24 -0
  192. package/dist/core/index.d.mts +25 -0
  193. package/dist/core/index.mjs +24 -0
  194. package/dist/core/path-utils.cjs +1 -0
  195. package/dist/core/path-utils.mjs +3 -0
  196. package/dist/core/types.d.cts +24 -0
  197. package/dist/core/types.d.cts.map +1 -0
  198. package/dist/core/types.d.mts +24 -0
  199. package/dist/core/types.d.mts.map +1 -0
  200. package/dist/errors.cjs +0 -11
  201. package/dist/errors.mjs +1 -11
  202. package/dist/errors.mjs.map +1 -1
  203. package/dist/explorer/actions.cjs +113 -48
  204. package/dist/explorer/actions.mjs +113 -48
  205. package/dist/explorer/actions.mjs.map +1 -1
  206. package/dist/explorer/components/dialog.cjs +287 -10
  207. package/dist/explorer/components/dialog.mjs +287 -10
  208. package/dist/explorer/components/dialog.mjs.map +1 -1
  209. package/dist/explorer/components/file-list.mjs.map +1 -1
  210. package/dist/explorer/components/metadata-panel.cjs +121 -24
  211. package/dist/explorer/components/metadata-panel.mjs +121 -24
  212. package/dist/explorer/components/metadata-panel.mjs.map +1 -1
  213. package/dist/explorer/screen.cjs +72 -21
  214. package/dist/explorer/screen.d.cts +23 -0
  215. package/dist/explorer/screen.d.cts.map +1 -0
  216. package/dist/explorer/screen.d.mts +23 -0
  217. package/dist/explorer/screen.d.mts.map +1 -0
  218. package/dist/explorer/screen.mjs +73 -22
  219. package/dist/explorer/screen.mjs.map +1 -1
  220. package/dist/explorer/theme.cjs +4 -2
  221. package/dist/explorer/theme.mjs +4 -2
  222. package/dist/explorer/theme.mjs.map +1 -1
  223. package/dist/index.cjs +7 -1
  224. package/dist/index.d.cts +4 -1
  225. package/dist/index.d.mts +4 -1
  226. package/dist/index.mjs +4 -1
  227. package/dist/mcp/http-transport.cjs +68 -0
  228. package/dist/mcp/http-transport.mjs +68 -0
  229. package/dist/mcp/http-transport.mjs.map +1 -0
  230. package/dist/mcp/prompts.cjs +48 -0
  231. package/dist/mcp/prompts.mjs +48 -0
  232. package/dist/mcp/prompts.mjs.map +1 -0
  233. package/dist/mcp/resources.cjs +25 -0
  234. package/dist/mcp/resources.mjs +25 -0
  235. package/dist/mcp/resources.mjs.map +1 -0
  236. package/dist/mcp/server.cjs +30 -0
  237. package/dist/mcp/server.mjs +30 -0
  238. package/dist/mcp/server.mjs.map +1 -0
  239. package/dist/mcp/tools.cjs +196 -0
  240. package/dist/mcp/tools.mjs +196 -0
  241. package/dist/mcp/tools.mjs.map +1 -0
  242. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts +10 -0
  243. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts.map +1 -0
  244. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts +10 -0
  245. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts.map +1 -0
  246. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts +46 -0
  247. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts.map +1 -0
  248. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts +46 -0
  249. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts.map +1 -0
  250. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +902 -0
  251. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs +902 -0
  252. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs.map +1 -0
  253. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.cjs +6 -0
  254. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs +8 -0
  255. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs.map +1 -0
  256. package/dist/path-utils.cjs +2 -1
  257. package/dist/path-utils.d.cts +50 -0
  258. package/dist/path-utils.d.cts.map +1 -0
  259. package/dist/path-utils.d.mts +50 -0
  260. package/dist/path-utils.d.mts.map +1 -0
  261. package/dist/path-utils.mjs +1 -1
  262. package/dist/repl.cjs +485 -0
  263. package/dist/repl.d.cts +15 -0
  264. package/dist/repl.d.cts.map +1 -0
  265. package/dist/repl.d.mts +16 -0
  266. package/dist/repl.d.mts.map +1 -0
  267. package/dist/repl.mjs +485 -0
  268. package/dist/repl.mjs.map +1 -0
  269. package/dist/serve.cjs +146 -0
  270. package/dist/serve.d.cts +41 -0
  271. package/dist/serve.d.cts.map +1 -0
  272. package/dist/serve.d.mts +41 -0
  273. package/dist/serve.d.mts.map +1 -0
  274. package/dist/serve.mjs +146 -0
  275. package/dist/serve.mjs.map +1 -0
  276. package/dist/ui/header.cjs +1 -49
  277. package/dist/ui/header.mjs +1 -47
  278. package/dist/ui/header.mjs.map +1 -1
  279. package/dist/ui/index.cjs +2 -11
  280. package/dist/ui/index.mjs +2 -8
  281. package/dist/ui/index.mjs.map +1 -1
  282. package/dist/ui/terminal.cjs +1 -10
  283. package/dist/ui/terminal.mjs +1 -8
  284. package/dist/ui/terminal.mjs.map +1 -1
  285. package/package.json +32 -9
  286. package/dist/commands/exec.cjs +0 -46
  287. package/dist/commands/exec.mjs +0 -45
  288. package/dist/commands/exec.mjs.map +0 -1
  289. package/dist/commands/explain.cjs +0 -244
  290. package/dist/commands/explain.mjs +0 -242
  291. package/dist/commands/explain.mjs.map +0 -1
  292. package/dist/commands/index.cjs +0 -8
  293. package/dist/commands/index.mjs +0 -10
  294. package/dist/commands/ls.cjs +0 -143
  295. package/dist/commands/ls.mjs +0 -143
  296. package/dist/commands/ls.mjs.map +0 -1
  297. package/dist/commands/mount.mjs.map +0 -1
  298. package/dist/commands/read.cjs +0 -65
  299. package/dist/commands/read.mjs +0 -64
  300. package/dist/commands/read.mjs.map +0 -1
  301. package/dist/commands/serve.cjs +0 -144
  302. package/dist/commands/serve.mjs +0 -143
  303. package/dist/commands/serve.mjs.map +0 -1
  304. package/dist/commands/stat.cjs +0 -113
  305. package/dist/commands/stat.mjs +0 -112
  306. package/dist/commands/stat.mjs.map +0 -1
  307. package/dist/commands/write.cjs +0 -52
  308. package/dist/commands/write.mjs +0 -51
  309. package/dist/commands/write.mjs.map +0 -1
  310. package/dist/config/provider-factory.cjs +0 -93
  311. package/dist/config/provider-factory.mjs +0 -94
  312. package/dist/config/provider-factory.mjs.map +0 -1
  313. package/dist/config/uri-parser.cjs +0 -92
  314. package/dist/config/uri-parser.mjs +0 -92
  315. package/dist/config/uri-parser.mjs.map +0 -1
  316. package/dist/runtime.cjs +0 -96
  317. package/dist/runtime.mjs +0 -96
  318. package/dist/runtime.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/afs-cli",
3
- "version": "1.11.0-beta.5",
3
+ "version": "1.11.0-beta.7",
4
4
  "description": "AFS Command Line Interface",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -31,6 +31,10 @@
31
31
  "require": "./dist/cli.cjs",
32
32
  "import": "./dist/cli.mjs"
33
33
  },
34
+ "./core": {
35
+ "require": "./dist/core/index.cjs",
36
+ "import": "./dist/core/index.mjs"
37
+ },
34
38
  "./*": "./*"
35
39
  },
36
40
  "files": [
@@ -40,27 +44,46 @@
40
44
  "CHANGELOG.md"
41
45
  ],
42
46
  "dependencies": {
47
+ "@modelcontextprotocol/sdk": "^1.25.3",
43
48
  "blessed": "^0.1.81",
44
49
  "smol-toml": "^1.3.1",
50
+ "ufo": "^1.6.3",
51
+ "urlpattern-polyfill": "^10.1.0",
52
+ "yaml": "^2.8.2",
45
53
  "yargs": "^17.7.2",
54
+ "yargs-parser": "^22.0.0",
46
55
  "zod": "^3.24.1",
47
- "@aigne/afs": "1.11.0-beta.5",
48
- "@aigne/afs-git": "1.11.0-beta.5",
49
- "@aigne/afs-json": "1.11.0-beta.5",
50
- "@aigne/afs-fs": "1.11.0-beta.5",
51
- "@aigne/afs-sqlite": "1.11.0-beta.5",
52
- "@aigne/afs-http": "1.11.0-beta.5"
56
+ "@aigne/afs-dns": "1.11.0-beta.7",
57
+ "@aigne/afs-ec2": "1.11.0-beta.7",
58
+ "@aigne/afs": "1.11.0-beta.7",
59
+ "@aigne/afs-fs": "1.11.0-beta.7",
60
+ "@aigne/afs-gce": "1.11.0-beta.7",
61
+ "@aigne/afs-gcs": "1.11.0-beta.7",
62
+ "@aigne/afs-git": "1.11.0-beta.7",
63
+ "@aigne/afs-github": "1.11.0-beta.7",
64
+ "@aigne/afs-http": "1.11.0-beta.7",
65
+ "@aigne/afs-json": "1.11.0-beta.7",
66
+ "@aigne/afs-mcp": "1.11.0-beta.7",
67
+ "@aigne/afs-provider-registry": "1.11.0-beta.7",
68
+ "@aigne/afs-registry": "1.11.0-beta.7",
69
+ "@aigne/afs-s3": "1.11.0-beta.7",
70
+ "@aigne/afs-sandbox": "1.11.0-beta.7",
71
+ "@aigne/afs-sqlite": "1.11.0-beta.7",
72
+ "@aigne/afs-toml": "1.11.0-beta.7",
73
+ "@aigne/afs-workspace": "1.11.0-beta.7"
53
74
  },
54
75
  "devDependencies": {
76
+ "@modelcontextprotocol/server-everything": "^2026.1.26",
55
77
  "@types/blessed": "^0.1.25",
56
78
  "@types/bun": "^1.3.6",
57
79
  "@types/yargs": "^17.0.33",
80
+ "@types/yargs-parser": "^21.0.3",
58
81
  "npm-run-all": "^4.1.5",
59
82
  "rimraf": "^6.1.2",
60
83
  "tsdown": "0.20.0-beta.3",
61
84
  "typescript": "5.9.2",
62
- "@aigne/scripts": "0.0.0",
63
- "@aigne/typescript-config": "0.0.0"
85
+ "@aigne/typescript-config": "0.0.0",
86
+ "@aigne/scripts": "0.0.0"
64
87
  },
65
88
  "scripts": {
66
89
  "build": "tsdown",
@@ -1,46 +0,0 @@
1
-
2
- //#region src/commands/exec.ts
3
- /**
4
- * Execute an action on an AFS path
5
- *
6
- * Note: exec is not widely implemented by providers yet.
7
- * This is a placeholder for future functionality.
8
- */
9
- async function execCommand(_runtime, path, _action, _params = {}) {
10
- return {
11
- path,
12
- success: false,
13
- message: "exec operation is not yet implemented"
14
- };
15
- }
16
- /**
17
- * Format exec output for different views
18
- */
19
- function formatExecOutput(result, view) {
20
- switch (view) {
21
- case "json": return JSON.stringify(result, null, 2);
22
- case "llm": return formatLlm(result);
23
- case "human": return formatHuman(result);
24
- default: return formatDefault(result);
25
- }
26
- }
27
- function formatDefault(result) {
28
- if (result.success) return `OK ${result.path}`;
29
- return `ERROR ${result.path} ${result.message}`;
30
- }
31
- function formatLlm(result) {
32
- const lines = [];
33
- lines.push(`EXEC ${result.path}`);
34
- lines.push(`STATUS ${result.success ? "SUCCESS" : "FAILED"}`);
35
- if (result.data) lines.push(`DATA ${JSON.stringify(result.data)}`);
36
- if (result.message) lines.push(`MESSAGE ${result.message}`);
37
- return lines.join("\n");
38
- }
39
- function formatHuman(result) {
40
- if (result.success) return `Executed on ${result.path}\n${result.data ? JSON.stringify(result.data, null, 2) : ""}`;
41
- return `Failed to execute on ${result.path}: ${result.message}`;
42
- }
43
-
44
- //#endregion
45
- exports.execCommand = execCommand;
46
- exports.formatExecOutput = formatExecOutput;
@@ -1,45 +0,0 @@
1
- //#region src/commands/exec.ts
2
- /**
3
- * Execute an action on an AFS path
4
- *
5
- * Note: exec is not widely implemented by providers yet.
6
- * This is a placeholder for future functionality.
7
- */
8
- async function execCommand(_runtime, path, _action, _params = {}) {
9
- return {
10
- path,
11
- success: false,
12
- message: "exec operation is not yet implemented"
13
- };
14
- }
15
- /**
16
- * Format exec output for different views
17
- */
18
- function formatExecOutput(result, view) {
19
- switch (view) {
20
- case "json": return JSON.stringify(result, null, 2);
21
- case "llm": return formatLlm(result);
22
- case "human": return formatHuman(result);
23
- default: return formatDefault(result);
24
- }
25
- }
26
- function formatDefault(result) {
27
- if (result.success) return `OK ${result.path}`;
28
- return `ERROR ${result.path} ${result.message}`;
29
- }
30
- function formatLlm(result) {
31
- const lines = [];
32
- lines.push(`EXEC ${result.path}`);
33
- lines.push(`STATUS ${result.success ? "SUCCESS" : "FAILED"}`);
34
- if (result.data) lines.push(`DATA ${JSON.stringify(result.data)}`);
35
- if (result.message) lines.push(`MESSAGE ${result.message}`);
36
- return lines.join("\n");
37
- }
38
- function formatHuman(result) {
39
- if (result.success) return `Executed on ${result.path}\n${result.data ? JSON.stringify(result.data, null, 2) : ""}`;
40
- return `Failed to execute on ${result.path}: ${result.message}`;
41
- }
42
-
43
- //#endregion
44
- export { execCommand, formatExecOutput };
45
- //# sourceMappingURL=exec.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exec.mjs","names":[],"sources":["../../src/commands/exec.ts"],"sourcesContent":["import type { AFSRuntime } from \"../runtime.js\";\nimport type { ViewType } from \"./ls.js\";\n\nexport interface ExecResult {\n path: string;\n success: boolean;\n data?: Record<string, unknown>;\n message?: string;\n}\n\n/**\n * Execute an action on an AFS path\n *\n * Note: exec is not widely implemented by providers yet.\n * This is a placeholder for future functionality.\n */\nexport async function execCommand(\n _runtime: AFSRuntime,\n path: string,\n _action: string,\n _params: Record<string, unknown> = {},\n): Promise<ExecResult> {\n // exec is not yet implemented in the runtime\n // This is a placeholder that returns an error\n\n return {\n path,\n success: false,\n message: \"exec operation is not yet implemented\",\n };\n}\n\n/**\n * Format exec output for different views\n */\nexport function formatExecOutput(result: ExecResult, view: ViewType): string {\n switch (view) {\n case \"json\":\n return JSON.stringify(result, null, 2);\n case \"llm\":\n return formatLlm(result);\n case \"human\":\n return formatHuman(result);\n default:\n return formatDefault(result);\n }\n}\n\nfunction formatDefault(result: ExecResult): string {\n if (result.success) {\n return `OK ${result.path}`;\n }\n return `ERROR ${result.path} ${result.message}`;\n}\n\nfunction formatLlm(result: ExecResult): string {\n const lines: string[] = [];\n\n lines.push(`EXEC ${result.path}`);\n lines.push(`STATUS ${result.success ? \"SUCCESS\" : \"FAILED\"}`);\n\n if (result.data) {\n lines.push(`DATA ${JSON.stringify(result.data)}`);\n }\n\n if (result.message) {\n lines.push(`MESSAGE ${result.message}`);\n }\n\n return lines.join(\"\\n\");\n}\n\nfunction formatHuman(result: ExecResult): string {\n if (result.success) {\n return `Executed on ${result.path}\\n${result.data ? JSON.stringify(result.data, null, 2) : \"\"}`;\n }\n return `Failed to execute on ${result.path}: ${result.message}`;\n}\n"],"mappings":";;;;;;;AAgBA,eAAsB,YACpB,UACA,MACA,SACA,UAAmC,EAAE,EAChB;AAIrB,QAAO;EACL;EACA,SAAS;EACT,SAAS;EACV;;;;;AAMH,SAAgB,iBAAiB,QAAoB,MAAwB;AAC3E,SAAQ,MAAR;EACE,KAAK,OACH,QAAO,KAAK,UAAU,QAAQ,MAAM,EAAE;EACxC,KAAK,MACH,QAAO,UAAU,OAAO;EAC1B,KAAK,QACH,QAAO,YAAY,OAAO;EAC5B,QACE,QAAO,cAAc,OAAO;;;AAIlC,SAAS,cAAc,QAA4B;AACjD,KAAI,OAAO,QACT,QAAO,MAAM,OAAO;AAEtB,QAAO,SAAS,OAAO,KAAK,GAAG,OAAO;;AAGxC,SAAS,UAAU,QAA4B;CAC7C,MAAM,QAAkB,EAAE;AAE1B,OAAM,KAAK,QAAQ,OAAO,OAAO;AACjC,OAAM,KAAK,UAAU,OAAO,UAAU,YAAY,WAAW;AAE7D,KAAI,OAAO,KACT,OAAM,KAAK,QAAQ,KAAK,UAAU,OAAO,KAAK,GAAG;AAGnD,KAAI,OAAO,QACT,OAAM,KAAK,WAAW,OAAO,UAAU;AAGzC,QAAO,MAAM,KAAK,KAAK;;AAGzB,SAAS,YAAY,QAA4B;AAC/C,KAAI,OAAO,QACT,QAAO,eAAe,OAAO,KAAK,IAAI,OAAO,OAAO,KAAK,UAAU,OAAO,MAAM,MAAM,EAAE,GAAG;AAE7F,QAAO,wBAAwB,OAAO,KAAK,IAAI,OAAO"}
@@ -1,244 +0,0 @@
1
- const require_mount = require('./mount.cjs');
2
-
3
- //#region src/commands/explain.ts
4
- /**
5
- * Explain AFS concepts or current configuration
6
- */
7
- async function explainCommand(cwd, topic) {
8
- switch (topic) {
9
- case "mount":
10
- case "mounts": return explainMounts(cwd);
11
- case "path":
12
- case "paths": return explainPaths();
13
- case "uri": return explainUri();
14
- default: return explainOverview();
15
- }
16
- }
17
- /**
18
- * Explain an AFS object at a given path
19
- */
20
- async function explainPathCommand(runtime, path) {
21
- const entry = (await runtime.read(path)).data;
22
- if (!entry) return {
23
- path,
24
- type: "unknown"
25
- };
26
- const metadata = entry.metadata || {};
27
- const entryType = metadata.type || "file";
28
- const result = {
29
- path: entry.path,
30
- type: entryType,
31
- description: metadata.description,
32
- metadata: {}
33
- };
34
- if (metadata.provider) result.metadata.provider = String(metadata.provider);
35
- if (metadata.permissions) {
36
- const perms = metadata.permissions;
37
- result.metadata.permissions = Array.isArray(perms) ? perms.join(", ") : String(perms);
38
- }
39
- if (entryType === "exec") {
40
- if (metadata.inputs) result.inputs = Array.isArray(metadata.inputs) ? metadata.inputs : [String(metadata.inputs)];
41
- if (metadata.outputs) result.outputs = Array.isArray(metadata.outputs) ? metadata.outputs : [String(metadata.outputs)];
42
- if (metadata.errors) result.errors = Array.isArray(metadata.errors) ? metadata.errors : [String(metadata.errors)];
43
- if (metadata.sideEffects) result.sideEffects = Array.isArray(metadata.sideEffects) ? metadata.sideEffects : [String(metadata.sideEffects)];
44
- }
45
- if (Object.keys(result.metadata).length === 0) delete result.metadata;
46
- return result;
47
- }
48
- function explainOverview() {
49
- return {
50
- topic: "AFS Overview",
51
- explanation: `AFS (Abstract File System) is a virtual filesystem that unifies different data sources into a single namespace.
52
-
53
- Core Concepts:
54
- - mount: Mount a data source to a virtual path
55
- - path: Virtual path, e.g., /src, /data
56
- - uri: Data source address, e.g., fs://, git://, sqlite://
57
-
58
- Data Flow:
59
- User Path -> AFS -> /modules/{name} -> Provider -> Actual Data`,
60
- examples: [
61
- "afs mount add /src fs:///path/to/source",
62
- "afs ls /modules/src",
63
- "afs read /modules/src/file.txt"
64
- ]
65
- };
66
- }
67
- async function explainMounts(cwd) {
68
- const result = await require_mount.mountListCommand(cwd);
69
- if (result.mounts.length === 0) return {
70
- topic: "Mounts",
71
- explanation: `No mounts configured.
72
-
73
- Use mount add to add a mount:
74
- afs mount add <path> <uri>
75
-
76
- path: Virtual path for accessing data in AFS
77
- uri: Data source URI specifying the data origin`,
78
- examples: ["afs mount add /src fs:///Users/me/project", "afs mount add /data sqlite:///data.db"]
79
- };
80
- return {
81
- topic: "Mounts",
82
- explanation: `Current mount configuration:
83
-
84
- ${result.mounts.map((m) => ` ${m.path} → ${m.uri}${m.description ? ` (${m.description})` : ""}`).join("\n")}
85
-
86
- After mounting, data is accessed via /modules/{name}:
87
- path="/src" -> /modules/src`,
88
- examples: result.mounts.map((m) => {
89
- return `afs ls /modules/${m.path.slice(1).replace(/\//g, "-") || "root"}`;
90
- })
91
- };
92
- }
93
- function explainPaths() {
94
- return {
95
- topic: "Paths",
96
- explanation: `AFS Path Structure:
97
-
98
- / Root directory
99
- /modules All mounted modules
100
- /modules/{name} Specific module, name derived from mount path
101
-
102
- Path Mapping:
103
- config: path="/src" -> access: /modules/src
104
- config: path="/data" -> access: /modules/data
105
-
106
- Note: The path configured by user is transformed to /modules/{name}`
107
- };
108
- }
109
- function explainUri() {
110
- return {
111
- topic: "URI",
112
- explanation: `AFS URI Schemes and Objects:
113
-
114
- fs:// Local Filesystem Provider
115
- Format: fs:///absolute/path or fs://./relative/path
116
- Objects:
117
- - directory: folder entries, supports list
118
- - file: file entries, supports read/write
119
- Operations: list, read, write, delete
120
-
121
- git:// Git Repository Provider
122
- Format: git:///local/repo or git://github.com/user/repo?branch=main
123
- Objects:
124
- - directory: tree entries
125
- - file: blob entries, read-only
126
- Operations: list, read
127
-
128
- sqlite:// SQLite Database Provider
129
- Format: sqlite:///path/to/db.sqlite
130
- Objects:
131
- - directory: database root, tables list
132
- - exec: table entries, supports query operations
133
- Operations: list, read, exec (SQL queries)
134
-
135
- json:// JSON Data Provider
136
- Format: json:///path/to/data.json
137
- Objects:
138
- - directory: object/array entries
139
- - file: primitive values
140
- Operations: list, read, write`,
141
- examples: [
142
- "afs mount add /src fs:///Users/me/project",
143
- "afs mount add /repo git://github.com/user/repo",
144
- "afs mount add /db sqlite:///data.sqlite"
145
- ]
146
- };
147
- }
148
- /**
149
- * Format explain output for different views
150
- */
151
- function formatExplainOutput(result, view) {
152
- switch (view) {
153
- case "json": return JSON.stringify(result, null, 2);
154
- case "llm": return formatLlm(result);
155
- default: return formatDefault(result);
156
- }
157
- }
158
- function formatDefault(result) {
159
- let output = `${result.topic}\n${"=".repeat(result.topic.length)}\n\n${result.explanation}`;
160
- if (result.examples && result.examples.length > 0) output += `\n\nExamples:\n${result.examples.map((e) => ` $ ${e}`).join("\n")}`;
161
- return output;
162
- }
163
- function formatLlm(result) {
164
- const lines = [
165
- `TOPIC ${result.topic}`,
166
- "",
167
- result.explanation
168
- ];
169
- if (result.examples && result.examples.length > 0) {
170
- lines.push("", "EXAMPLES");
171
- for (const example of result.examples) lines.push(`CMD ${example}`);
172
- }
173
- return lines.join("\n");
174
- }
175
- /**
176
- * Format object explain output for different views
177
- */
178
- function formatPathExplainOutput(result, view) {
179
- switch (view) {
180
- case "json": return JSON.stringify(result, null, 2);
181
- case "llm": return formatPathLlm(result);
182
- default: return formatPathDefault(result);
183
- }
184
- }
185
- function formatPathDefault(result) {
186
- const lines = [];
187
- lines.push(`PATH ${result.path}`);
188
- lines.push("");
189
- lines.push("TYPE");
190
- lines.push(result.type);
191
- if (result.description) {
192
- lines.push("");
193
- lines.push("DESCRIPTION");
194
- lines.push(result.description);
195
- }
196
- if (result.inputs && result.inputs.length > 0) {
197
- lines.push("");
198
- lines.push("INPUTS");
199
- for (const input of result.inputs) lines.push(`- ${input}`);
200
- }
201
- if (result.outputs && result.outputs.length > 0) {
202
- lines.push("");
203
- lines.push("OUTPUTS");
204
- for (const output of result.outputs) lines.push(`- ${output}`);
205
- }
206
- if (result.errors && result.errors.length > 0) {
207
- lines.push("");
208
- lines.push("ERRORS");
209
- for (const error of result.errors) lines.push(`- ${error}`);
210
- }
211
- if (result.sideEffects && result.sideEffects.length > 0) {
212
- lines.push("");
213
- lines.push("SIDE EFFECTS");
214
- for (const effect of result.sideEffects) lines.push(`- ${effect}`);
215
- } else {
216
- lines.push("");
217
- lines.push("SIDE EFFECTS");
218
- lines.push("- none");
219
- }
220
- if (result.metadata && Object.keys(result.metadata).length > 0) {
221
- lines.push("");
222
- lines.push("METADATA");
223
- for (const [key, value] of Object.entries(result.metadata)) lines.push(`- ${key}: ${value}`);
224
- }
225
- return lines.join("\n");
226
- }
227
- function formatPathLlm(result) {
228
- const lines = [];
229
- lines.push(`PATH ${result.path}`);
230
- lines.push(`TYPE ${result.type.toUpperCase()}`);
231
- if (result.description) lines.push(`DESC ${result.description}`);
232
- if (result.inputs && result.inputs.length > 0) lines.push(`INPUTS ${result.inputs.join(", ")}`);
233
- if (result.outputs && result.outputs.length > 0) lines.push(`OUTPUTS ${result.outputs.join(", ")}`);
234
- if (result.errors && result.errors.length > 0) lines.push(`ERRORS ${result.errors.join(", ")}`);
235
- lines.push(`SIDE_EFFECTS ${result.sideEffects?.join(", ") || "none"}`);
236
- if (result.metadata) for (const [key, value] of Object.entries(result.metadata)) lines.push(`${key.toUpperCase()} ${value}`);
237
- return lines.join("\n");
238
- }
239
-
240
- //#endregion
241
- exports.explainCommand = explainCommand;
242
- exports.explainPathCommand = explainPathCommand;
243
- exports.formatExplainOutput = formatExplainOutput;
244
- exports.formatPathExplainOutput = formatPathExplainOutput;
@@ -1,242 +0,0 @@
1
- import { mountListCommand } from "./mount.mjs";
2
-
3
- //#region src/commands/explain.ts
4
- /**
5
- * Explain AFS concepts or current configuration
6
- */
7
- async function explainCommand(cwd, topic) {
8
- switch (topic) {
9
- case "mount":
10
- case "mounts": return explainMounts(cwd);
11
- case "path":
12
- case "paths": return explainPaths();
13
- case "uri": return explainUri();
14
- default: return explainOverview();
15
- }
16
- }
17
- /**
18
- * Explain an AFS object at a given path
19
- */
20
- async function explainPathCommand(runtime, path) {
21
- const entry = (await runtime.read(path)).data;
22
- if (!entry) return {
23
- path,
24
- type: "unknown"
25
- };
26
- const metadata = entry.metadata || {};
27
- const entryType = metadata.type || "file";
28
- const result = {
29
- path: entry.path,
30
- type: entryType,
31
- description: metadata.description,
32
- metadata: {}
33
- };
34
- if (metadata.provider) result.metadata.provider = String(metadata.provider);
35
- if (metadata.permissions) {
36
- const perms = metadata.permissions;
37
- result.metadata.permissions = Array.isArray(perms) ? perms.join(", ") : String(perms);
38
- }
39
- if (entryType === "exec") {
40
- if (metadata.inputs) result.inputs = Array.isArray(metadata.inputs) ? metadata.inputs : [String(metadata.inputs)];
41
- if (metadata.outputs) result.outputs = Array.isArray(metadata.outputs) ? metadata.outputs : [String(metadata.outputs)];
42
- if (metadata.errors) result.errors = Array.isArray(metadata.errors) ? metadata.errors : [String(metadata.errors)];
43
- if (metadata.sideEffects) result.sideEffects = Array.isArray(metadata.sideEffects) ? metadata.sideEffects : [String(metadata.sideEffects)];
44
- }
45
- if (Object.keys(result.metadata).length === 0) delete result.metadata;
46
- return result;
47
- }
48
- function explainOverview() {
49
- return {
50
- topic: "AFS Overview",
51
- explanation: `AFS (Abstract File System) is a virtual filesystem that unifies different data sources into a single namespace.
52
-
53
- Core Concepts:
54
- - mount: Mount a data source to a virtual path
55
- - path: Virtual path, e.g., /src, /data
56
- - uri: Data source address, e.g., fs://, git://, sqlite://
57
-
58
- Data Flow:
59
- User Path -> AFS -> /modules/{name} -> Provider -> Actual Data`,
60
- examples: [
61
- "afs mount add /src fs:///path/to/source",
62
- "afs ls /modules/src",
63
- "afs read /modules/src/file.txt"
64
- ]
65
- };
66
- }
67
- async function explainMounts(cwd) {
68
- const result = await mountListCommand(cwd);
69
- if (result.mounts.length === 0) return {
70
- topic: "Mounts",
71
- explanation: `No mounts configured.
72
-
73
- Use mount add to add a mount:
74
- afs mount add <path> <uri>
75
-
76
- path: Virtual path for accessing data in AFS
77
- uri: Data source URI specifying the data origin`,
78
- examples: ["afs mount add /src fs:///Users/me/project", "afs mount add /data sqlite:///data.db"]
79
- };
80
- return {
81
- topic: "Mounts",
82
- explanation: `Current mount configuration:
83
-
84
- ${result.mounts.map((m) => ` ${m.path} → ${m.uri}${m.description ? ` (${m.description})` : ""}`).join("\n")}
85
-
86
- After mounting, data is accessed via /modules/{name}:
87
- path="/src" -> /modules/src`,
88
- examples: result.mounts.map((m) => {
89
- return `afs ls /modules/${m.path.slice(1).replace(/\//g, "-") || "root"}`;
90
- })
91
- };
92
- }
93
- function explainPaths() {
94
- return {
95
- topic: "Paths",
96
- explanation: `AFS Path Structure:
97
-
98
- / Root directory
99
- /modules All mounted modules
100
- /modules/{name} Specific module, name derived from mount path
101
-
102
- Path Mapping:
103
- config: path="/src" -> access: /modules/src
104
- config: path="/data" -> access: /modules/data
105
-
106
- Note: The path configured by user is transformed to /modules/{name}`
107
- };
108
- }
109
- function explainUri() {
110
- return {
111
- topic: "URI",
112
- explanation: `AFS URI Schemes and Objects:
113
-
114
- fs:// Local Filesystem Provider
115
- Format: fs:///absolute/path or fs://./relative/path
116
- Objects:
117
- - directory: folder entries, supports list
118
- - file: file entries, supports read/write
119
- Operations: list, read, write, delete
120
-
121
- git:// Git Repository Provider
122
- Format: git:///local/repo or git://github.com/user/repo?branch=main
123
- Objects:
124
- - directory: tree entries
125
- - file: blob entries, read-only
126
- Operations: list, read
127
-
128
- sqlite:// SQLite Database Provider
129
- Format: sqlite:///path/to/db.sqlite
130
- Objects:
131
- - directory: database root, tables list
132
- - exec: table entries, supports query operations
133
- Operations: list, read, exec (SQL queries)
134
-
135
- json:// JSON Data Provider
136
- Format: json:///path/to/data.json
137
- Objects:
138
- - directory: object/array entries
139
- - file: primitive values
140
- Operations: list, read, write`,
141
- examples: [
142
- "afs mount add /src fs:///Users/me/project",
143
- "afs mount add /repo git://github.com/user/repo",
144
- "afs mount add /db sqlite:///data.sqlite"
145
- ]
146
- };
147
- }
148
- /**
149
- * Format explain output for different views
150
- */
151
- function formatExplainOutput(result, view) {
152
- switch (view) {
153
- case "json": return JSON.stringify(result, null, 2);
154
- case "llm": return formatLlm(result);
155
- default: return formatDefault(result);
156
- }
157
- }
158
- function formatDefault(result) {
159
- let output = `${result.topic}\n${"=".repeat(result.topic.length)}\n\n${result.explanation}`;
160
- if (result.examples && result.examples.length > 0) output += `\n\nExamples:\n${result.examples.map((e) => ` $ ${e}`).join("\n")}`;
161
- return output;
162
- }
163
- function formatLlm(result) {
164
- const lines = [
165
- `TOPIC ${result.topic}`,
166
- "",
167
- result.explanation
168
- ];
169
- if (result.examples && result.examples.length > 0) {
170
- lines.push("", "EXAMPLES");
171
- for (const example of result.examples) lines.push(`CMD ${example}`);
172
- }
173
- return lines.join("\n");
174
- }
175
- /**
176
- * Format object explain output for different views
177
- */
178
- function formatPathExplainOutput(result, view) {
179
- switch (view) {
180
- case "json": return JSON.stringify(result, null, 2);
181
- case "llm": return formatPathLlm(result);
182
- default: return formatPathDefault(result);
183
- }
184
- }
185
- function formatPathDefault(result) {
186
- const lines = [];
187
- lines.push(`PATH ${result.path}`);
188
- lines.push("");
189
- lines.push("TYPE");
190
- lines.push(result.type);
191
- if (result.description) {
192
- lines.push("");
193
- lines.push("DESCRIPTION");
194
- lines.push(result.description);
195
- }
196
- if (result.inputs && result.inputs.length > 0) {
197
- lines.push("");
198
- lines.push("INPUTS");
199
- for (const input of result.inputs) lines.push(`- ${input}`);
200
- }
201
- if (result.outputs && result.outputs.length > 0) {
202
- lines.push("");
203
- lines.push("OUTPUTS");
204
- for (const output of result.outputs) lines.push(`- ${output}`);
205
- }
206
- if (result.errors && result.errors.length > 0) {
207
- lines.push("");
208
- lines.push("ERRORS");
209
- for (const error of result.errors) lines.push(`- ${error}`);
210
- }
211
- if (result.sideEffects && result.sideEffects.length > 0) {
212
- lines.push("");
213
- lines.push("SIDE EFFECTS");
214
- for (const effect of result.sideEffects) lines.push(`- ${effect}`);
215
- } else {
216
- lines.push("");
217
- lines.push("SIDE EFFECTS");
218
- lines.push("- none");
219
- }
220
- if (result.metadata && Object.keys(result.metadata).length > 0) {
221
- lines.push("");
222
- lines.push("METADATA");
223
- for (const [key, value] of Object.entries(result.metadata)) lines.push(`- ${key}: ${value}`);
224
- }
225
- return lines.join("\n");
226
- }
227
- function formatPathLlm(result) {
228
- const lines = [];
229
- lines.push(`PATH ${result.path}`);
230
- lines.push(`TYPE ${result.type.toUpperCase()}`);
231
- if (result.description) lines.push(`DESC ${result.description}`);
232
- if (result.inputs && result.inputs.length > 0) lines.push(`INPUTS ${result.inputs.join(", ")}`);
233
- if (result.outputs && result.outputs.length > 0) lines.push(`OUTPUTS ${result.outputs.join(", ")}`);
234
- if (result.errors && result.errors.length > 0) lines.push(`ERRORS ${result.errors.join(", ")}`);
235
- lines.push(`SIDE_EFFECTS ${result.sideEffects?.join(", ") || "none"}`);
236
- if (result.metadata) for (const [key, value] of Object.entries(result.metadata)) lines.push(`${key.toUpperCase()} ${value}`);
237
- return lines.join("\n");
238
- }
239
-
240
- //#endregion
241
- export { explainCommand, explainPathCommand, formatExplainOutput, formatPathExplainOutput };
242
- //# sourceMappingURL=explain.mjs.map