@adverant-nexus/cli 2.0.0

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 (541) hide show
  1. package/ARCHITECTURE.md +1366 -0
  2. package/LICENSE +21 -0
  3. package/README.md +593 -0
  4. package/completions/_nexus +452 -0
  5. package/completions/nexus.bash +329 -0
  6. package/completions/nexus.fish +187 -0
  7. package/dist/cli.d.ts +35 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +135 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/commands/agent/index.d.ts +9 -0
  12. package/dist/commands/agent/index.d.ts.map +1 -0
  13. package/dist/commands/agent/index.js +20 -0
  14. package/dist/commands/agent/index.js.map +1 -0
  15. package/dist/commands/agent/list.d.ts +9 -0
  16. package/dist/commands/agent/list.d.ts.map +1 -0
  17. package/dist/commands/agent/list.js +122 -0
  18. package/dist/commands/agent/list.js.map +1 -0
  19. package/dist/commands/agent/run.d.ts +10 -0
  20. package/dist/commands/agent/run.d.ts.map +1 -0
  21. package/dist/commands/agent/run.js +167 -0
  22. package/dist/commands/agent/run.js.map +1 -0
  23. package/dist/commands/agent/status.d.ts +9 -0
  24. package/dist/commands/agent/status.d.ts.map +1 -0
  25. package/dist/commands/agent/status.js +157 -0
  26. package/dist/commands/agent/status.js.map +1 -0
  27. package/dist/commands/compute/agent.d.ts +21 -0
  28. package/dist/commands/compute/agent.d.ts.map +1 -0
  29. package/dist/commands/compute/agent.js +158 -0
  30. package/dist/commands/compute/agent.js.map +1 -0
  31. package/dist/commands/compute/index.d.ts +10 -0
  32. package/dist/commands/compute/index.d.ts.map +1 -0
  33. package/dist/commands/compute/index.js +27 -0
  34. package/dist/commands/compute/index.js.map +1 -0
  35. package/dist/commands/compute/lib/hardware-detection.d.ts +52 -0
  36. package/dist/commands/compute/lib/hardware-detection.d.ts.map +1 -0
  37. package/dist/commands/compute/lib/hardware-detection.js +432 -0
  38. package/dist/commands/compute/lib/hardware-detection.js.map +1 -0
  39. package/dist/commands/compute/lib/local-compute-agent.d.ts +143 -0
  40. package/dist/commands/compute/lib/local-compute-agent.d.ts.map +1 -0
  41. package/dist/commands/compute/lib/local-compute-agent.js +1162 -0
  42. package/dist/commands/compute/lib/local-compute-agent.js.map +1 -0
  43. package/dist/commands/compute/lib/local-compute-client.d.ts +89 -0
  44. package/dist/commands/compute/lib/local-compute-client.d.ts.map +1 -0
  45. package/dist/commands/compute/lib/local-compute-client.js +388 -0
  46. package/dist/commands/compute/lib/local-compute-client.js.map +1 -0
  47. package/dist/commands/compute/list.d.ts +14 -0
  48. package/dist/commands/compute/list.d.ts.map +1 -0
  49. package/dist/commands/compute/list.js +164 -0
  50. package/dist/commands/compute/list.js.map +1 -0
  51. package/dist/commands/compute/logs.d.ts +14 -0
  52. package/dist/commands/compute/logs.d.ts.map +1 -0
  53. package/dist/commands/compute/logs.js +105 -0
  54. package/dist/commands/compute/logs.js.map +1 -0
  55. package/dist/commands/compute/resources.d.ts +14 -0
  56. package/dist/commands/compute/resources.d.ts.map +1 -0
  57. package/dist/commands/compute/resources.js +163 -0
  58. package/dist/commands/compute/resources.js.map +1 -0
  59. package/dist/commands/compute/status.d.ts +13 -0
  60. package/dist/commands/compute/status.d.ts.map +1 -0
  61. package/dist/commands/compute/status.js +223 -0
  62. package/dist/commands/compute/status.js.map +1 -0
  63. package/dist/commands/compute/submit.d.ts +19 -0
  64. package/dist/commands/compute/submit.d.ts.map +1 -0
  65. package/dist/commands/compute/submit.js +99 -0
  66. package/dist/commands/compute/submit.js.map +1 -0
  67. package/dist/commands/deploy.d.ts +11 -0
  68. package/dist/commands/deploy.d.ts.map +1 -0
  69. package/dist/commands/deploy.js +117 -0
  70. package/dist/commands/deploy.js.map +1 -0
  71. package/dist/commands/dynamic/graphrag-commands.d.ts +16 -0
  72. package/dist/commands/dynamic/graphrag-commands.d.ts.map +1 -0
  73. package/dist/commands/dynamic/graphrag-commands.js +562 -0
  74. package/dist/commands/dynamic/graphrag-commands.js.map +1 -0
  75. package/dist/commands/dynamic/index.d.ts +10 -0
  76. package/dist/commands/dynamic/index.d.ts.map +1 -0
  77. package/dist/commands/dynamic/index.js +17 -0
  78. package/dist/commands/dynamic/index.js.map +1 -0
  79. package/dist/commands/dynamic/mageagent-commands.d.ts +8 -0
  80. package/dist/commands/dynamic/mageagent-commands.d.ts.map +1 -0
  81. package/dist/commands/dynamic/mageagent-commands.js +86 -0
  82. package/dist/commands/dynamic/mageagent-commands.js.map +1 -0
  83. package/dist/commands/dynamic/mcp-tool-mapper.d.ts +97 -0
  84. package/dist/commands/dynamic/mcp-tool-mapper.d.ts.map +1 -0
  85. package/dist/commands/dynamic/mcp-tool-mapper.js +328 -0
  86. package/dist/commands/dynamic/mcp-tool-mapper.js.map +1 -0
  87. package/dist/commands/dynamic/nexus-commands.d.ts +78 -0
  88. package/dist/commands/dynamic/nexus-commands.d.ts.map +1 -0
  89. package/dist/commands/dynamic/nexus-commands.js +426 -0
  90. package/dist/commands/dynamic/nexus-commands.js.map +1 -0
  91. package/dist/commands/dynamic/sandbox-commands.d.ts +8 -0
  92. package/dist/commands/dynamic/sandbox-commands.d.ts.map +1 -0
  93. package/dist/commands/dynamic/sandbox-commands.js +80 -0
  94. package/dist/commands/dynamic/sandbox-commands.js.map +1 -0
  95. package/dist/commands/init.d.ts +11 -0
  96. package/dist/commands/init.d.ts.map +1 -0
  97. package/dist/commands/init.js +128 -0
  98. package/dist/commands/init.js.map +1 -0
  99. package/dist/commands/list.d.ts +10 -0
  100. package/dist/commands/list.d.ts.map +1 -0
  101. package/dist/commands/list.js +81 -0
  102. package/dist/commands/list.js.map +1 -0
  103. package/dist/commands/login.d.ts +10 -0
  104. package/dist/commands/login.d.ts.map +1 -0
  105. package/dist/commands/login.js +83 -0
  106. package/dist/commands/login.js.map +1 -0
  107. package/dist/commands/logs.d.ts +11 -0
  108. package/dist/commands/logs.d.ts.map +1 -0
  109. package/dist/commands/logs.js +79 -0
  110. package/dist/commands/logs.js.map +1 -0
  111. package/dist/commands/nexus/index.d.ts +69 -0
  112. package/dist/commands/nexus/index.d.ts.map +1 -0
  113. package/dist/commands/nexus/index.js +336 -0
  114. package/dist/commands/nexus/index.js.map +1 -0
  115. package/dist/commands/plugin/disable.d.ts +8 -0
  116. package/dist/commands/plugin/disable.d.ts.map +1 -0
  117. package/dist/commands/plugin/disable.js +31 -0
  118. package/dist/commands/plugin/disable.js.map +1 -0
  119. package/dist/commands/plugin/enable.d.ts +8 -0
  120. package/dist/commands/plugin/enable.d.ts.map +1 -0
  121. package/dist/commands/plugin/enable.js +37 -0
  122. package/dist/commands/plugin/enable.js.map +1 -0
  123. package/dist/commands/plugin/index.d.ts +8 -0
  124. package/dist/commands/plugin/index.d.ts.map +1 -0
  125. package/dist/commands/plugin/index.js +23 -0
  126. package/dist/commands/plugin/index.js.map +1 -0
  127. package/dist/commands/plugin/info.d.ts +8 -0
  128. package/dist/commands/plugin/info.d.ts.map +1 -0
  129. package/dist/commands/plugin/info.js +129 -0
  130. package/dist/commands/plugin/info.js.map +1 -0
  131. package/dist/commands/plugin/init.d.ts +8 -0
  132. package/dist/commands/plugin/init.d.ts.map +1 -0
  133. package/dist/commands/plugin/init.js +83 -0
  134. package/dist/commands/plugin/init.js.map +1 -0
  135. package/dist/commands/plugin/install.d.ts +8 -0
  136. package/dist/commands/plugin/install.d.ts.map +1 -0
  137. package/dist/commands/plugin/install.js +56 -0
  138. package/dist/commands/plugin/install.js.map +1 -0
  139. package/dist/commands/plugin/list.d.ts +8 -0
  140. package/dist/commands/plugin/list.d.ts.map +1 -0
  141. package/dist/commands/plugin/list.js +72 -0
  142. package/dist/commands/plugin/list.js.map +1 -0
  143. package/dist/commands/plugin/uninstall.d.ts +8 -0
  144. package/dist/commands/plugin/uninstall.d.ts.map +1 -0
  145. package/dist/commands/plugin/uninstall.js +49 -0
  146. package/dist/commands/plugin/uninstall.js.map +1 -0
  147. package/dist/commands/register.d.ts +10 -0
  148. package/dist/commands/register.d.ts.map +1 -0
  149. package/dist/commands/register.js +85 -0
  150. package/dist/commands/register.js.map +1 -0
  151. package/dist/commands/services/health.d.ts +7 -0
  152. package/dist/commands/services/health.d.ts.map +1 -0
  153. package/dist/commands/services/health.js +73 -0
  154. package/dist/commands/services/health.js.map +1 -0
  155. package/dist/commands/services/index.d.ts +16 -0
  156. package/dist/commands/services/index.d.ts.map +1 -0
  157. package/dist/commands/services/index.js +26 -0
  158. package/dist/commands/services/index.js.map +1 -0
  159. package/dist/commands/services/info.d.ts +7 -0
  160. package/dist/commands/services/info.d.ts.map +1 -0
  161. package/dist/commands/services/info.js +68 -0
  162. package/dist/commands/services/info.js.map +1 -0
  163. package/dist/commands/services/list.d.ts +9 -0
  164. package/dist/commands/services/list.d.ts.map +1 -0
  165. package/dist/commands/services/list.js +43 -0
  166. package/dist/commands/services/list.js.map +1 -0
  167. package/dist/commands/services/logs.d.ts +7 -0
  168. package/dist/commands/services/logs.d.ts.map +1 -0
  169. package/dist/commands/services/logs.js +107 -0
  170. package/dist/commands/services/logs.js.map +1 -0
  171. package/dist/commands/services/ports.d.ts +7 -0
  172. package/dist/commands/services/ports.d.ts.map +1 -0
  173. package/dist/commands/services/ports.js +65 -0
  174. package/dist/commands/services/ports.js.map +1 -0
  175. package/dist/commands/services/restart.d.ts +7 -0
  176. package/dist/commands/services/restart.d.ts.map +1 -0
  177. package/dist/commands/services/restart.js +67 -0
  178. package/dist/commands/services/restart.js.map +1 -0
  179. package/dist/commands/services/start.d.ts +7 -0
  180. package/dist/commands/services/start.d.ts.map +1 -0
  181. package/dist/commands/services/start.js +67 -0
  182. package/dist/commands/services/start.js.map +1 -0
  183. package/dist/commands/services/status.d.ts +9 -0
  184. package/dist/commands/services/status.d.ts.map +1 -0
  185. package/dist/commands/services/status.js +119 -0
  186. package/dist/commands/services/status.js.map +1 -0
  187. package/dist/commands/services/stop.d.ts +7 -0
  188. package/dist/commands/services/stop.d.ts.map +1 -0
  189. package/dist/commands/services/stop.js +67 -0
  190. package/dist/commands/services/stop.js.map +1 -0
  191. package/dist/commands/session/delete.d.ts +9 -0
  192. package/dist/commands/session/delete.d.ts.map +1 -0
  193. package/dist/commands/session/delete.js +51 -0
  194. package/dist/commands/session/delete.js.map +1 -0
  195. package/dist/commands/session/export.d.ts +9 -0
  196. package/dist/commands/session/export.d.ts.map +1 -0
  197. package/dist/commands/session/export.js +36 -0
  198. package/dist/commands/session/export.js.map +1 -0
  199. package/dist/commands/session/import.d.ts +9 -0
  200. package/dist/commands/session/import.d.ts.map +1 -0
  201. package/dist/commands/session/import.js +54 -0
  202. package/dist/commands/session/import.js.map +1 -0
  203. package/dist/commands/session/index.d.ts +9 -0
  204. package/dist/commands/session/index.d.ts.map +1 -0
  205. package/dist/commands/session/index.js +28 -0
  206. package/dist/commands/session/index.js.map +1 -0
  207. package/dist/commands/session/list.d.ts +9 -0
  208. package/dist/commands/session/list.d.ts.map +1 -0
  209. package/dist/commands/session/list.js +88 -0
  210. package/dist/commands/session/list.js.map +1 -0
  211. package/dist/commands/session/load.d.ts +9 -0
  212. package/dist/commands/session/load.d.ts.map +1 -0
  213. package/dist/commands/session/load.js +71 -0
  214. package/dist/commands/session/load.js.map +1 -0
  215. package/dist/commands/session/resume.d.ts +9 -0
  216. package/dist/commands/session/resume.d.ts.map +1 -0
  217. package/dist/commands/session/resume.js +49 -0
  218. package/dist/commands/session/resume.js.map +1 -0
  219. package/dist/commands/session/save.d.ts +9 -0
  220. package/dist/commands/session/save.d.ts.map +1 -0
  221. package/dist/commands/session/save.js +69 -0
  222. package/dist/commands/session/save.js.map +1 -0
  223. package/dist/commands/workspace/git-commit.d.ts +9 -0
  224. package/dist/commands/workspace/git-commit.d.ts.map +1 -0
  225. package/dist/commands/workspace/git-commit.js +156 -0
  226. package/dist/commands/workspace/git-commit.js.map +1 -0
  227. package/dist/commands/workspace/git-status.d.ts +9 -0
  228. package/dist/commands/workspace/git-status.d.ts.map +1 -0
  229. package/dist/commands/workspace/git-status.js +192 -0
  230. package/dist/commands/workspace/git-status.js.map +1 -0
  231. package/dist/commands/workspace/index.d.ts +9 -0
  232. package/dist/commands/workspace/index.d.ts.map +1 -0
  233. package/dist/commands/workspace/index.js +24 -0
  234. package/dist/commands/workspace/index.js.map +1 -0
  235. package/dist/commands/workspace/info.d.ts +10 -0
  236. package/dist/commands/workspace/info.d.ts.map +1 -0
  237. package/dist/commands/workspace/info.js +191 -0
  238. package/dist/commands/workspace/info.js.map +1 -0
  239. package/dist/commands/workspace/init.d.ts +9 -0
  240. package/dist/commands/workspace/init.d.ts.map +1 -0
  241. package/dist/commands/workspace/init.js +193 -0
  242. package/dist/commands/workspace/init.js.map +1 -0
  243. package/dist/commands/workspace/validate.d.ts +9 -0
  244. package/dist/commands/workspace/validate.d.ts.map +1 -0
  245. package/dist/commands/workspace/validate.js +140 -0
  246. package/dist/commands/workspace/validate.js.map +1 -0
  247. package/dist/core/agent-client.d.ts +49 -0
  248. package/dist/core/agent-client.d.ts.map +1 -0
  249. package/dist/core/agent-client.js +289 -0
  250. package/dist/core/agent-client.js.map +1 -0
  251. package/dist/core/config/config-manager.d.ts +75 -0
  252. package/dist/core/config/config-manager.d.ts.map +1 -0
  253. package/dist/core/config/config-manager.js +379 -0
  254. package/dist/core/config/config-manager.js.map +1 -0
  255. package/dist/core/config/profile-manager.d.ts +76 -0
  256. package/dist/core/config/profile-manager.d.ts.map +1 -0
  257. package/dist/core/config/profile-manager.js +250 -0
  258. package/dist/core/config/profile-manager.js.map +1 -0
  259. package/dist/core/config/workspace-detector.d.ts +66 -0
  260. package/dist/core/config/workspace-detector.d.ts.map +1 -0
  261. package/dist/core/config/workspace-detector.js +291 -0
  262. package/dist/core/config/workspace-detector.js.map +1 -0
  263. package/dist/core/discovery/docker-parser.d.ts +27 -0
  264. package/dist/core/discovery/docker-parser.d.ts.map +1 -0
  265. package/dist/core/discovery/docker-parser.js +361 -0
  266. package/dist/core/discovery/docker-parser.js.map +1 -0
  267. package/dist/core/discovery/index.d.ts +11 -0
  268. package/dist/core/discovery/index.d.ts.map +1 -0
  269. package/dist/core/discovery/index.js +16 -0
  270. package/dist/core/discovery/index.js.map +1 -0
  271. package/dist/core/discovery/mcp-discovery.d.ts +41 -0
  272. package/dist/core/discovery/mcp-discovery.d.ts.map +1 -0
  273. package/dist/core/discovery/mcp-discovery.js +439 -0
  274. package/dist/core/discovery/mcp-discovery.js.map +1 -0
  275. package/dist/core/discovery/openapi-parser.d.ts +95 -0
  276. package/dist/core/discovery/openapi-parser.d.ts.map +1 -0
  277. package/dist/core/discovery/openapi-parser.js +353 -0
  278. package/dist/core/discovery/openapi-parser.js.map +1 -0
  279. package/dist/core/discovery/plugin-discovery.d.ts +63 -0
  280. package/dist/core/discovery/plugin-discovery.d.ts.map +1 -0
  281. package/dist/core/discovery/plugin-discovery.js +333 -0
  282. package/dist/core/discovery/plugin-discovery.js.map +1 -0
  283. package/dist/core/discovery/service-discovery.d.ts +107 -0
  284. package/dist/core/discovery/service-discovery.d.ts.map +1 -0
  285. package/dist/core/discovery/service-discovery.js +349 -0
  286. package/dist/core/discovery/service-discovery.js.map +1 -0
  287. package/dist/core/nexus-client.d.ts +119 -0
  288. package/dist/core/nexus-client.d.ts.map +1 -0
  289. package/dist/core/nexus-client.js +292 -0
  290. package/dist/core/nexus-client.js.map +1 -0
  291. package/dist/core/nexus-tool-executor.d.ts +102 -0
  292. package/dist/core/nexus-tool-executor.d.ts.map +1 -0
  293. package/dist/core/nexus-tool-executor.js +386 -0
  294. package/dist/core/nexus-tool-executor.js.map +1 -0
  295. package/dist/core/react-handler.d.ts +17 -0
  296. package/dist/core/react-handler.d.ts.map +1 -0
  297. package/dist/core/react-handler.js +296 -0
  298. package/dist/core/react-handler.js.map +1 -0
  299. package/dist/core/router/command-registry.d.ts +61 -0
  300. package/dist/core/router/command-registry.d.ts.map +1 -0
  301. package/dist/core/router/command-registry.js +138 -0
  302. package/dist/core/router/command-registry.js.map +1 -0
  303. package/dist/core/router/command-router.d.ts +33 -0
  304. package/dist/core/router/command-router.d.ts.map +1 -0
  305. package/dist/core/router/command-router.js +111 -0
  306. package/dist/core/router/command-router.js.map +1 -0
  307. package/dist/core/router/index.d.ts +9 -0
  308. package/dist/core/router/index.d.ts.map +1 -0
  309. package/dist/core/router/index.js +8 -0
  310. package/dist/core/router/index.js.map +1 -0
  311. package/dist/core/session/context-manager.d.ts +69 -0
  312. package/dist/core/session/context-manager.d.ts.map +1 -0
  313. package/dist/core/session/context-manager.js +109 -0
  314. package/dist/core/session/context-manager.js.map +1 -0
  315. package/dist/core/session/history-manager.d.ts +72 -0
  316. package/dist/core/session/history-manager.d.ts.map +1 -0
  317. package/dist/core/session/history-manager.js +175 -0
  318. package/dist/core/session/history-manager.js.map +1 -0
  319. package/dist/core/session/index.d.ts +9 -0
  320. package/dist/core/session/index.d.ts.map +1 -0
  321. package/dist/core/session/index.js +9 -0
  322. package/dist/core/session/index.js.map +1 -0
  323. package/dist/core/session/session-manager.d.ts +50 -0
  324. package/dist/core/session/session-manager.d.ts.map +1 -0
  325. package/dist/core/session/session-manager.js +200 -0
  326. package/dist/core/session/session-manager.js.map +1 -0
  327. package/dist/core/session/session-storage.d.ts +59 -0
  328. package/dist/core/session/session-storage.d.ts.map +1 -0
  329. package/dist/core/session/session-storage.js +226 -0
  330. package/dist/core/session/session-storage.js.map +1 -0
  331. package/dist/core/transport/http-client.d.ts +27 -0
  332. package/dist/core/transport/http-client.d.ts.map +1 -0
  333. package/dist/core/transport/http-client.js +182 -0
  334. package/dist/core/transport/http-client.js.map +1 -0
  335. package/dist/core/transport/index.d.ts +11 -0
  336. package/dist/core/transport/index.d.ts.map +1 -0
  337. package/dist/core/transport/index.js +10 -0
  338. package/dist/core/transport/index.js.map +1 -0
  339. package/dist/core/transport/mcp-client.d.ts +69 -0
  340. package/dist/core/transport/mcp-client.d.ts.map +1 -0
  341. package/dist/core/transport/mcp-client.js +252 -0
  342. package/dist/core/transport/mcp-client.js.map +1 -0
  343. package/dist/core/transport/stream-handler.d.ts +51 -0
  344. package/dist/core/transport/stream-handler.d.ts.map +1 -0
  345. package/dist/core/transport/stream-handler.js +264 -0
  346. package/dist/core/transport/stream-handler.js.map +1 -0
  347. package/dist/core/transport/websocket-client.d.ts +66 -0
  348. package/dist/core/transport/websocket-client.d.ts.map +1 -0
  349. package/dist/core/transport/websocket-client.js +232 -0
  350. package/dist/core/transport/websocket-client.js.map +1 -0
  351. package/dist/index.d.ts +9 -0
  352. package/dist/index.d.ts.map +1 -0
  353. package/dist/index.js +106 -0
  354. package/dist/index.js.map +1 -0
  355. package/dist/output/formatters/index.d.ts +9 -0
  356. package/dist/output/formatters/index.d.ts.map +1 -0
  357. package/dist/output/formatters/index.js +9 -0
  358. package/dist/output/formatters/index.js.map +1 -0
  359. package/dist/output/formatters/json-formatter.d.ts +71 -0
  360. package/dist/output/formatters/json-formatter.d.ts.map +1 -0
  361. package/dist/output/formatters/json-formatter.js +236 -0
  362. package/dist/output/formatters/json-formatter.js.map +1 -0
  363. package/dist/output/formatters/stream-formatter.d.ts +107 -0
  364. package/dist/output/formatters/stream-formatter.d.ts.map +1 -0
  365. package/dist/output/formatters/stream-formatter.js +247 -0
  366. package/dist/output/formatters/stream-formatter.js.map +1 -0
  367. package/dist/output/formatters/table-formatter.d.ts +63 -0
  368. package/dist/output/formatters/table-formatter.d.ts.map +1 -0
  369. package/dist/output/formatters/table-formatter.js +294 -0
  370. package/dist/output/formatters/table-formatter.js.map +1 -0
  371. package/dist/output/formatters/text-formatter.d.ts +63 -0
  372. package/dist/output/formatters/text-formatter.d.ts.map +1 -0
  373. package/dist/output/formatters/text-formatter.js +202 -0
  374. package/dist/output/formatters/text-formatter.js.map +1 -0
  375. package/dist/output/formatters/yaml-formatter.d.ts +71 -0
  376. package/dist/output/formatters/yaml-formatter.d.ts.map +1 -0
  377. package/dist/output/formatters/yaml-formatter.js +239 -0
  378. package/dist/output/formatters/yaml-formatter.js.map +1 -0
  379. package/dist/output/index.d.ts +7 -0
  380. package/dist/output/index.d.ts.map +1 -0
  381. package/dist/output/index.js +7 -0
  382. package/dist/output/index.js.map +1 -0
  383. package/dist/output/output-manager.d.ts +156 -0
  384. package/dist/output/output-manager.d.ts.map +1 -0
  385. package/dist/output/output-manager.js +339 -0
  386. package/dist/output/output-manager.js.map +1 -0
  387. package/dist/output/renderers/index.d.ts +6 -0
  388. package/dist/output/renderers/index.d.ts.map +1 -0
  389. package/dist/output/renderers/index.js +6 -0
  390. package/dist/output/renderers/index.js.map +1 -0
  391. package/dist/output/renderers/progress-renderer.d.ts +56 -0
  392. package/dist/output/renderers/progress-renderer.d.ts.map +1 -0
  393. package/dist/output/renderers/progress-renderer.js +306 -0
  394. package/dist/output/renderers/progress-renderer.js.map +1 -0
  395. package/dist/output/renderers/terminal-renderer.d.ts +117 -0
  396. package/dist/output/renderers/terminal-renderer.d.ts.map +1 -0
  397. package/dist/output/renderers/terminal-renderer.js +294 -0
  398. package/dist/output/renderers/terminal-renderer.js.map +1 -0
  399. package/dist/plugins/index.d.ts +12 -0
  400. package/dist/plugins/index.d.ts.map +1 -0
  401. package/dist/plugins/index.js +18 -0
  402. package/dist/plugins/index.js.map +1 -0
  403. package/dist/plugins/plugin-loader.d.ts +37 -0
  404. package/dist/plugins/plugin-loader.d.ts.map +1 -0
  405. package/dist/plugins/plugin-loader.js +155 -0
  406. package/dist/plugins/plugin-loader.js.map +1 -0
  407. package/dist/plugins/plugin-manager.d.ts +78 -0
  408. package/dist/plugins/plugin-manager.d.ts.map +1 -0
  409. package/dist/plugins/plugin-manager.js +310 -0
  410. package/dist/plugins/plugin-manager.js.map +1 -0
  411. package/dist/plugins/plugin-sdk.d.ts +136 -0
  412. package/dist/plugins/plugin-sdk.d.ts.map +1 -0
  413. package/dist/plugins/plugin-sdk.js +260 -0
  414. package/dist/plugins/plugin-sdk.js.map +1 -0
  415. package/dist/plugins/plugin-storage.d.ts +109 -0
  416. package/dist/plugins/plugin-storage.d.ts.map +1 -0
  417. package/dist/plugins/plugin-storage.js +207 -0
  418. package/dist/plugins/plugin-storage.js.map +1 -0
  419. package/dist/plugins/plugin-validator.d.ts +44 -0
  420. package/dist/plugins/plugin-validator.d.ts.map +1 -0
  421. package/dist/plugins/plugin-validator.js +272 -0
  422. package/dist/plugins/plugin-validator.js.map +1 -0
  423. package/dist/plugins/template-generator.d.ts +35 -0
  424. package/dist/plugins/template-generator.d.ts.map +1 -0
  425. package/dist/plugins/template-generator.js +438 -0
  426. package/dist/plugins/template-generator.js.map +1 -0
  427. package/dist/repl/completer.d.ts +58 -0
  428. package/dist/repl/completer.d.ts.map +1 -0
  429. package/dist/repl/completer.js +198 -0
  430. package/dist/repl/completer.js.map +1 -0
  431. package/dist/repl/evaluator.d.ts +55 -0
  432. package/dist/repl/evaluator.d.ts.map +1 -0
  433. package/dist/repl/evaluator.js +299 -0
  434. package/dist/repl/evaluator.js.map +1 -0
  435. package/dist/repl/index.d.ts +10 -0
  436. package/dist/repl/index.d.ts.map +1 -0
  437. package/dist/repl/index.js +10 -0
  438. package/dist/repl/index.js.map +1 -0
  439. package/dist/repl/renderer.d.ts +77 -0
  440. package/dist/repl/renderer.d.ts.map +1 -0
  441. package/dist/repl/renderer.js +291 -0
  442. package/dist/repl/renderer.js.map +1 -0
  443. package/dist/repl/repl.d.ts +89 -0
  444. package/dist/repl/repl.d.ts.map +1 -0
  445. package/dist/repl/repl.js +339 -0
  446. package/dist/repl/repl.js.map +1 -0
  447. package/dist/templates/python.d.ts +15 -0
  448. package/dist/templates/python.d.ts.map +1 -0
  449. package/dist/templates/python.js +375 -0
  450. package/dist/templates/python.js.map +1 -0
  451. package/dist/templates/typescript.d.ts +15 -0
  452. package/dist/templates/typescript.d.ts.map +1 -0
  453. package/dist/templates/typescript.js +274 -0
  454. package/dist/templates/typescript.js.map +1 -0
  455. package/dist/types/agent.d.ts +109 -0
  456. package/dist/types/agent.d.ts.map +1 -0
  457. package/dist/types/agent.js +7 -0
  458. package/dist/types/agent.js.map +1 -0
  459. package/dist/types/api.d.ts +125 -0
  460. package/dist/types/api.d.ts.map +1 -0
  461. package/dist/types/api.js +53 -0
  462. package/dist/types/api.js.map +1 -0
  463. package/dist/types/command.d.ts +101 -0
  464. package/dist/types/command.d.ts.map +1 -0
  465. package/dist/types/command.js +7 -0
  466. package/dist/types/command.js.map +1 -0
  467. package/dist/types/compute.d.ts +317 -0
  468. package/dist/types/compute.d.ts.map +1 -0
  469. package/dist/types/compute.js +19 -0
  470. package/dist/types/compute.js.map +1 -0
  471. package/dist/types/config.d.ts +71 -0
  472. package/dist/types/config.d.ts.map +1 -0
  473. package/dist/types/config.js +7 -0
  474. package/dist/types/config.js.map +1 -0
  475. package/dist/types/errors.d.ts +56 -0
  476. package/dist/types/errors.d.ts.map +1 -0
  477. package/dist/types/errors.js +64 -0
  478. package/dist/types/errors.js.map +1 -0
  479. package/dist/types/index.d.ts +16 -0
  480. package/dist/types/index.d.ts.map +1 -0
  481. package/dist/types/index.js +16 -0
  482. package/dist/types/index.js.map +1 -0
  483. package/dist/types/nexus.d.ts +254 -0
  484. package/dist/types/nexus.d.ts.map +1 -0
  485. package/dist/types/nexus.js +7 -0
  486. package/dist/types/nexus.js.map +1 -0
  487. package/dist/types/output.d.ts +107 -0
  488. package/dist/types/output.d.ts.map +1 -0
  489. package/dist/types/output.js +7 -0
  490. package/dist/types/output.js.map +1 -0
  491. package/dist/types/plugin.d.ts +118 -0
  492. package/dist/types/plugin.d.ts.map +1 -0
  493. package/dist/types/plugin.js +7 -0
  494. package/dist/types/plugin.js.map +1 -0
  495. package/dist/types/service.d.ts +94 -0
  496. package/dist/types/service.d.ts.map +1 -0
  497. package/dist/types/service.js +15 -0
  498. package/dist/types/service.js.map +1 -0
  499. package/dist/types/session.d.ts +80 -0
  500. package/dist/types/session.d.ts.map +1 -0
  501. package/dist/types/session.js +7 -0
  502. package/dist/types/session.js.map +1 -0
  503. package/dist/types/transport.d.ts +96 -0
  504. package/dist/types/transport.d.ts.map +1 -0
  505. package/dist/types/transport.js +7 -0
  506. package/dist/types/transport.js.map +1 -0
  507. package/dist/utils/config.d.ts +47 -0
  508. package/dist/utils/config.d.ts.map +1 -0
  509. package/dist/utils/config.js +166 -0
  510. package/dist/utils/config.js.map +1 -0
  511. package/dist/utils/error-handler.d.ts +82 -0
  512. package/dist/utils/error-handler.d.ts.map +1 -0
  513. package/dist/utils/error-handler.js +238 -0
  514. package/dist/utils/error-handler.js.map +1 -0
  515. package/dist/utils/index.d.ts +9 -0
  516. package/dist/utils/index.d.ts.map +1 -0
  517. package/dist/utils/index.js +9 -0
  518. package/dist/utils/index.js.map +1 -0
  519. package/dist/utils/logger.d.ts +61 -0
  520. package/dist/utils/logger.d.ts.map +1 -0
  521. package/dist/utils/logger.js +200 -0
  522. package/dist/utils/logger.js.map +1 -0
  523. package/dist/utils/prompt.d.ts +57 -0
  524. package/dist/utils/prompt.d.ts.map +1 -0
  525. package/dist/utils/prompt.js +141 -0
  526. package/dist/utils/prompt.js.map +1 -0
  527. package/dist/utils/spinner.d.ts +47 -0
  528. package/dist/utils/spinner.d.ts.map +1 -0
  529. package/dist/utils/spinner.js +123 -0
  530. package/dist/utils/spinner.js.map +1 -0
  531. package/dist/utils/validation.d.ts +97 -0
  532. package/dist/utils/validation.d.ts.map +1 -0
  533. package/dist/utils/validation.js +289 -0
  534. package/dist/utils/validation.js.map +1 -0
  535. package/docs/COMPLETIONS.md +528 -0
  536. package/docs/REPL.md +466 -0
  537. package/docs/graphrag-commands.md +387 -0
  538. package/package.json +154 -0
  539. package/scripts/install-completions.sh +356 -0
  540. package/scripts/prepublish.js +522 -0
  541. package/scripts/verify-package.js +505 -0
@@ -0,0 +1,522 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Pre-publish Validation Script for @adverant-nexus/cli
5
+ *
6
+ * This script validates that the package is ready for publication to npm.
7
+ * It checks compilation, files, metadata, and more.
8
+ */
9
+
10
+ import { execSync } from 'child_process';
11
+ import fs from 'fs';
12
+ import path from 'path';
13
+ import { fileURLToPath } from 'url';
14
+
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = path.dirname(__filename);
17
+ const rootDir = path.resolve(__dirname, '..');
18
+
19
+ // ANSI color codes
20
+ const colors = {
21
+ reset: '\x1b[0m',
22
+ red: '\x1b[31m',
23
+ green: '\x1b[32m',
24
+ yellow: '\x1b[33m',
25
+ blue: '\x1b[34m',
26
+ magenta: '\x1b[35m',
27
+ cyan: '\x1b[36m',
28
+ bold: '\x1b[1m',
29
+ };
30
+
31
+ const icons = {
32
+ success: '✓',
33
+ error: '✗',
34
+ warning: '⚠',
35
+ info: 'ℹ',
36
+ };
37
+
38
+ // Validation results tracking
39
+ const results = {
40
+ passed: [],
41
+ warnings: [],
42
+ errors: [],
43
+ };
44
+
45
+ /**
46
+ * Print colored output
47
+ */
48
+ function print(message, color = 'reset', icon = null) {
49
+ const colorCode = colors[color] || colors.reset;
50
+ const iconStr = icon ? `${icon} ` : '';
51
+ console.log(`${colorCode}${iconStr}${message}${colors.reset}`);
52
+ }
53
+
54
+ /**
55
+ * Print section header
56
+ */
57
+ function printSection(title) {
58
+ console.log('\n' + colors.bold + colors.cyan + `${'='.repeat(60)}` + colors.reset);
59
+ console.log(colors.bold + colors.cyan + title + colors.reset);
60
+ console.log(colors.bold + colors.cyan + `${'='.repeat(60)}` + colors.reset + '\n');
61
+ }
62
+
63
+ /**
64
+ * Print validation result
65
+ */
66
+ function printResult(passed, message, details = null) {
67
+ if (passed) {
68
+ print(message, 'green', icons.success);
69
+ results.passed.push(message);
70
+ } else {
71
+ print(message, 'red', icons.error);
72
+ results.errors.push(message);
73
+ }
74
+ if (details) {
75
+ console.log(colors.cyan + ` ${details}` + colors.reset);
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Print warning
81
+ */
82
+ function printWarning(message, details = null) {
83
+ print(message, 'yellow', icons.warning);
84
+ results.warnings.push(message);
85
+ if (details) {
86
+ console.log(colors.yellow + ` ${details}` + colors.reset);
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Execute command and return result
92
+ */
93
+ function execCommand(command, options = {}) {
94
+ try {
95
+ const output = execSync(command, {
96
+ cwd: rootDir,
97
+ encoding: 'utf8',
98
+ stdio: options.silent ? 'pipe' : 'inherit',
99
+ ...options,
100
+ });
101
+ return { success: true, output };
102
+ } catch (error) {
103
+ return {
104
+ success: false,
105
+ error: error.message,
106
+ stderr: error.stderr?.toString(),
107
+ stdout: error.stdout?.toString(),
108
+ };
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Check if file or directory exists
114
+ */
115
+ function fileExists(filePath) {
116
+ return fs.existsSync(path.resolve(rootDir, filePath));
117
+ }
118
+
119
+ /**
120
+ * Read package.json
121
+ */
122
+ function readPackageJson() {
123
+ const pkgPath = path.resolve(rootDir, 'package.json');
124
+ const content = fs.readFileSync(pkgPath, 'utf8');
125
+ return JSON.parse(content);
126
+ }
127
+
128
+ /**
129
+ * Check for sensitive patterns in files
130
+ */
131
+ function checkForSensitiveData() {
132
+ const sensitivePatterns = [
133
+ /(?:api[_-]?key|apikey)[\s]*[:=][\s]*['"][^'"]+['"]/gi,
134
+ /(?:secret|password|passwd|pwd)[\s]*[:=][\s]*['"][^'"]+['"]/gi,
135
+ /(?:token|auth)[\s]*[:=][\s]*['"][^'"]+['"]/gi,
136
+ /(?:private[_-]?key)[\s]*[:=][\s]*['"][^'"]+['"]/gi,
137
+ /-----BEGIN (?:RSA |DSA )?PRIVATE KEY-----/gi,
138
+ /sk_live_[a-zA-Z0-9]+/gi, // Stripe keys
139
+ /AIza[0-9A-Za-z-_]{35}/gi, // Google API keys
140
+ /ghp_[a-zA-Z0-9]{36}/gi, // GitHub Personal Access Tokens
141
+ ];
142
+
143
+ const filesToCheck = [];
144
+ const dirsToScan = ['dist', 'src'];
145
+
146
+ for (const dir of dirsToScan) {
147
+ const dirPath = path.resolve(rootDir, dir);
148
+ if (!fs.existsSync(dirPath)) continue;
149
+
150
+ const files = getAllFiles(dirPath);
151
+ filesToCheck.push(...files);
152
+ }
153
+
154
+ const findings = [];
155
+
156
+ for (const file of filesToCheck) {
157
+ // Skip large files and node_modules
158
+ if (file.includes('node_modules') || file.endsWith('.min.js')) continue;
159
+
160
+ try {
161
+ const content = fs.readFileSync(file, 'utf8');
162
+
163
+ for (const pattern of sensitivePatterns) {
164
+ const matches = content.match(pattern);
165
+ if (matches) {
166
+ findings.push({
167
+ file: path.relative(rootDir, file),
168
+ pattern: pattern.toString(),
169
+ matches: matches.length,
170
+ });
171
+ }
172
+ }
173
+ } catch (error) {
174
+ // Skip files that can't be read as text
175
+ continue;
176
+ }
177
+ }
178
+
179
+ return findings;
180
+ }
181
+
182
+ /**
183
+ * Get all files recursively
184
+ */
185
+ function getAllFiles(dir, fileList = []) {
186
+ const files = fs.readdirSync(dir);
187
+
188
+ for (const file of files) {
189
+ const filePath = path.join(dir, file);
190
+ const stat = fs.statSync(filePath);
191
+
192
+ if (stat.isDirectory()) {
193
+ getAllFiles(filePath, fileList);
194
+ } else {
195
+ fileList.push(filePath);
196
+ }
197
+ }
198
+
199
+ return fileList;
200
+ }
201
+
202
+ /**
203
+ * Check directory size
204
+ */
205
+ function getDirectorySize(dirPath) {
206
+ let size = 0;
207
+
208
+ if (!fs.existsSync(dirPath)) return 0;
209
+
210
+ const files = getAllFiles(dirPath);
211
+ for (const file of files) {
212
+ const stat = fs.statSync(file);
213
+ size += stat.size;
214
+ }
215
+
216
+ return size;
217
+ }
218
+
219
+ /**
220
+ * Format bytes to human readable
221
+ */
222
+ function formatBytes(bytes) {
223
+ if (bytes === 0) return '0 Bytes';
224
+ const k = 1024;
225
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
226
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
227
+ return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i];
228
+ }
229
+
230
+ /**
231
+ * Validate package.json metadata
232
+ */
233
+ function validatePackageJson(pkg) {
234
+ const requiredFields = [
235
+ 'name',
236
+ 'version',
237
+ 'description',
238
+ 'main',
239
+ 'bin',
240
+ 'author',
241
+ 'license',
242
+ 'repository',
243
+ 'keywords',
244
+ 'engines',
245
+ ];
246
+
247
+ for (const field of requiredFields) {
248
+ if (!pkg[field]) {
249
+ printResult(false, `Missing required field: ${field}`);
250
+ } else {
251
+ printResult(true, `Required field present: ${field}`);
252
+ }
253
+ }
254
+
255
+ // Check version format
256
+ const versionRegex = /^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?$/;
257
+ if (!versionRegex.test(pkg.version)) {
258
+ printResult(false, `Invalid version format: ${pkg.version}`, 'Should be semver (e.g., 1.0.0, 1.0.0-beta.1)');
259
+ } else {
260
+ printResult(true, `Valid version format: ${pkg.version}`);
261
+ }
262
+
263
+ // Check package name format
264
+ if (pkg.name.startsWith('@')) {
265
+ const scopedRegex = /^@[a-z0-9-~][a-z0-9-._~]*\/[a-z0-9-~][a-z0-9-._~]*$/;
266
+ if (!scopedRegex.test(pkg.name)) {
267
+ printResult(false, `Invalid scoped package name: ${pkg.name}`);
268
+ } else {
269
+ printResult(true, `Valid scoped package name: ${pkg.name}`);
270
+ }
271
+ }
272
+
273
+ // Check keywords
274
+ if (pkg.keywords && pkg.keywords.length > 0) {
275
+ printResult(true, `Keywords defined: ${pkg.keywords.length} keywords`);
276
+ } else {
277
+ printWarning('No keywords defined', 'Add keywords to improve discoverability');
278
+ }
279
+
280
+ // Check files field
281
+ if (pkg.files && pkg.files.length > 0) {
282
+ printResult(true, `Files field defined: ${pkg.files.length} patterns`);
283
+ } else {
284
+ printWarning('No files field defined', 'Consider adding a files field to control what gets published');
285
+ }
286
+
287
+ // Check engines
288
+ if (pkg.engines && pkg.engines.node) {
289
+ printResult(true, `Node.js version requirement: ${pkg.engines.node}`);
290
+ } else {
291
+ printWarning('No Node.js version specified in engines');
292
+ }
293
+
294
+ // Check publishConfig
295
+ if (pkg.publishConfig) {
296
+ printResult(true, 'publishConfig defined');
297
+ if (pkg.publishConfig.access === 'public') {
298
+ print(' Access: public', 'cyan');
299
+ }
300
+ }
301
+ }
302
+
303
+ /**
304
+ * Main validation runner
305
+ */
306
+ async function runValidation() {
307
+ print('\n' + colors.bold + colors.magenta + '🚀 Pre-Publish Validation for @adverant-nexus/cli' + colors.reset + '\n');
308
+
309
+ const pkg = readPackageJson();
310
+ print(`Package: ${colors.bold}${pkg.name}@${pkg.version}${colors.reset}\n`);
311
+
312
+ // 1. Check TypeScript compilation
313
+ printSection('1. TypeScript Compilation');
314
+ print('Running TypeScript compiler...');
315
+ const tscResult = execCommand('npm run typecheck', { silent: false });
316
+ if (tscResult.success) {
317
+ printResult(true, 'TypeScript compilation successful');
318
+ } else {
319
+ printResult(false, 'TypeScript compilation failed');
320
+ }
321
+
322
+ // 2. Check required files
323
+ printSection('2. Required Files Check');
324
+ const requiredFiles = [
325
+ { path: 'dist', type: 'directory', required: true },
326
+ { path: 'README.md', type: 'file', required: true },
327
+ { path: 'LICENSE', type: 'file', required: false },
328
+ { path: 'package.json', type: 'file', required: true },
329
+ { path: 'dist/index.js', type: 'file', required: true },
330
+ ];
331
+
332
+ for (const { path: filePath, type, required } of requiredFiles) {
333
+ const exists = fileExists(filePath);
334
+ if (required) {
335
+ printResult(exists, `${type}: ${filePath}`, exists ? 'Found' : 'Missing');
336
+ } else {
337
+ if (exists) {
338
+ printResult(true, `${type}: ${filePath}`, 'Found');
339
+ } else {
340
+ printWarning(`Optional ${type} not found: ${filePath}`);
341
+ }
342
+ }
343
+ }
344
+
345
+ // 3. Check build output
346
+ printSection('3. Build Output Validation');
347
+ const distPath = path.resolve(rootDir, 'dist');
348
+ if (fs.existsSync(distPath)) {
349
+ const distSize = getDirectorySize(distPath);
350
+ print(`Build size: ${formatBytes(distSize)}`, 'cyan', icons.info);
351
+
352
+ if (distSize > 10 * 1024 * 1024) { // 10MB
353
+ printWarning('Build size exceeds 10MB', 'Consider optimizing bundle size');
354
+ } else {
355
+ printResult(true, 'Build size is reasonable');
356
+ }
357
+
358
+ // Check for source maps
359
+ const hasSourceMaps = getAllFiles(distPath).some(f => f.endsWith('.map'));
360
+ if (hasSourceMaps) {
361
+ printWarning('Source maps found in dist/', 'Consider excluding .map files to reduce package size');
362
+ }
363
+ }
364
+
365
+ // 4. Validate package.json
366
+ printSection('4. Package.json Validation');
367
+ validatePackageJson(pkg);
368
+
369
+ // 5. Check for sensitive data
370
+ printSection('5. Sensitive Data Check');
371
+ print('Scanning for potential secrets...');
372
+ const sensitiveFindings = checkForSensitiveData();
373
+
374
+ if (sensitiveFindings.length > 0) {
375
+ printResult(false, 'Potential sensitive data found:');
376
+ sensitiveFindings.forEach(finding => {
377
+ print(` ${finding.file}: ${finding.matches} match(es)`, 'red');
378
+ });
379
+ } else {
380
+ printResult(true, 'No sensitive data patterns detected');
381
+ }
382
+
383
+ // 6. Verify dependencies
384
+ printSection('6. Dependencies Validation');
385
+
386
+ // Check for missing dependencies
387
+ print('Checking for missing dependencies...');
388
+ const depsCheck = execCommand('npm ls --depth=0', { silent: true });
389
+ if (depsCheck.success) {
390
+ printResult(true, 'All dependencies are installed');
391
+ } else {
392
+ if (depsCheck.stderr && depsCheck.stderr.includes('missing')) {
393
+ printResult(false, 'Missing dependencies detected', 'Run: npm install');
394
+ } else {
395
+ printWarning('Unable to verify dependencies');
396
+ }
397
+ }
398
+
399
+ // Check for outdated dependencies
400
+ print('Checking for outdated dependencies...');
401
+ const outdatedCheck = execCommand('npm outdated --json', { silent: true });
402
+ if (outdatedCheck.output) {
403
+ try {
404
+ const outdated = JSON.parse(outdatedCheck.output);
405
+ const outdatedCount = Object.keys(outdated).length;
406
+ if (outdatedCount > 0) {
407
+ printWarning(`${outdatedCount} outdated dependencies found`, 'Run: npm outdated');
408
+ } else {
409
+ printResult(true, 'All dependencies are up to date');
410
+ }
411
+ } catch (e) {
412
+ printResult(true, 'All dependencies are up to date');
413
+ }
414
+ }
415
+
416
+ // 7. Run tests
417
+ printSection('7. Test Suite');
418
+ if (pkg.scripts && pkg.scripts.test) {
419
+ print('Running test suite...');
420
+ const testResult = execCommand('npm test', { silent: true });
421
+ if (testResult.success) {
422
+ printResult(true, 'All tests passed');
423
+ } else {
424
+ // Check if it's a "no tests found" error
425
+ const stderr = testResult.stderr || '';
426
+ const stdout = testResult.stdout || '';
427
+ const noTestsFound = stderr.includes('No tests found') || stdout.includes('No tests found');
428
+
429
+ if (noTestsFound) {
430
+ printWarning('No test files found', 'Consider adding tests before publishing');
431
+ } else {
432
+ printResult(false, 'Some tests failed');
433
+ if (stderr) {
434
+ console.log(colors.red + ' Error output:' + colors.reset);
435
+ console.log(stderr);
436
+ }
437
+ }
438
+ }
439
+ } else {
440
+ printWarning('No test script defined', 'Consider adding tests before publishing');
441
+ }
442
+
443
+ // 8. Run linter
444
+ printSection('8. Code Quality');
445
+ if (pkg.scripts && pkg.scripts.lint) {
446
+ print('Running linter...');
447
+ const lintResult = execCommand('npm run lint', { silent: true });
448
+ if (lintResult.success) {
449
+ printResult(true, 'Linting passed');
450
+ } else {
451
+ printWarning('Linting issues found', 'Run: npm run lint:fix');
452
+ }
453
+ } else {
454
+ printWarning('No lint script defined');
455
+ }
456
+
457
+ // 9. Check .npmignore
458
+ printSection('9. Package Contents');
459
+ const npmignorePath = path.resolve(rootDir, '.npmignore');
460
+ if (fs.existsSync(npmignorePath)) {
461
+ printResult(true, '.npmignore file exists');
462
+ const npmignore = fs.readFileSync(npmignorePath, 'utf8');
463
+
464
+ const shouldIgnore = [
465
+ { pattern: 'src', name: 'source files' },
466
+ { pattern: 'test', name: 'test files' },
467
+ { pattern: '.git', name: 'git files' },
468
+ { pattern: 'tsconfig', name: 'TypeScript config' },
469
+ { pattern: '.env', name: 'environment files' },
470
+ ];
471
+
472
+ for (const { pattern, name } of shouldIgnore) {
473
+ if (npmignore.includes(pattern)) {
474
+ print(` ✓ Ignoring ${name}`, 'green');
475
+ } else {
476
+ printWarning(` Consider ignoring ${name}`);
477
+ }
478
+ }
479
+ } else {
480
+ printWarning('.npmignore not found', 'Will use .gitignore or files field');
481
+ }
482
+
483
+ // 10. Dry run pack
484
+ printSection('10. Package Simulation');
485
+ print('Running npm pack --dry-run...');
486
+ const packResult = execCommand('npm pack --dry-run', { silent: true });
487
+ if (packResult.success) {
488
+ printResult(true, 'Package simulation successful');
489
+ if (packResult.stdout) {
490
+ const lines = packResult.stdout.split('\n');
491
+ const fileCount = lines.filter(l => l.trim() && !l.includes('npm notice')).length;
492
+ print(` ${fileCount} files will be published`, 'cyan', icons.info);
493
+ }
494
+ } else {
495
+ printResult(false, 'Package simulation failed');
496
+ }
497
+
498
+ // Final summary
499
+ printSection('Validation Summary');
500
+ print(`${colors.bold}Results:${colors.reset}`);
501
+ print(` ${colors.green}${icons.success} Passed: ${results.passed.length}${colors.reset}`);
502
+ print(` ${colors.yellow}${icons.warning} Warnings: ${results.warnings.length}${colors.reset}`);
503
+ print(` ${colors.red}${icons.error} Errors: ${results.errors.length}${colors.reset}`);
504
+
505
+ if (results.errors.length > 0) {
506
+ print('\n' + colors.bold + colors.red + '❌ Validation failed. Please fix the errors above before publishing.' + colors.reset);
507
+ process.exit(1);
508
+ } else if (results.warnings.length > 0) {
509
+ print('\n' + colors.bold + colors.yellow + '⚠️ Validation passed with warnings. Review warnings before publishing.' + colors.reset);
510
+ process.exit(0);
511
+ } else {
512
+ print('\n' + colors.bold + colors.green + '✅ All validations passed! Package is ready to publish.' + colors.reset);
513
+ process.exit(0);
514
+ }
515
+ }
516
+
517
+ // Run validation
518
+ runValidation().catch(error => {
519
+ print('\n' + colors.bold + colors.red + '❌ Validation script failed:' + colors.reset);
520
+ console.error(error);
521
+ process.exit(1);
522
+ });