@made-by-moonlight/athene-cli 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/LICENSE +22 -0
  2. package/dist/assets/plugin-registry.json +67 -0
  3. package/dist/assets/scripts/athene-doctor.ps1 +352 -0
  4. package/dist/assets/scripts/athene-doctor.sh +552 -0
  5. package/dist/assets/scripts/athene-update.ps1 +224 -0
  6. package/dist/assets/scripts/athene-update.sh +252 -0
  7. package/dist/commands/completion.d.ts +3 -0
  8. package/dist/commands/completion.d.ts.map +1 -0
  9. package/dist/commands/completion.js +26 -0
  10. package/dist/commands/completion.js.map +1 -0
  11. package/dist/commands/config.d.ts +11 -0
  12. package/dist/commands/config.d.ts.map +1 -0
  13. package/dist/commands/config.js +89 -0
  14. package/dist/commands/config.js.map +1 -0
  15. package/dist/commands/dashboard.d.ts +3 -0
  16. package/dist/commands/dashboard.d.ts.map +1 -0
  17. package/dist/commands/dashboard.js +103 -0
  18. package/dist/commands/dashboard.js.map +1 -0
  19. package/dist/commands/doctor.d.ts +3 -0
  20. package/dist/commands/doctor.d.ts.map +1 -0
  21. package/dist/commands/doctor.js +329 -0
  22. package/dist/commands/doctor.js.map +1 -0
  23. package/dist/commands/events.d.ts +3 -0
  24. package/dist/commands/events.d.ts.map +1 -0
  25. package/dist/commands/events.js +172 -0
  26. package/dist/commands/events.js.map +1 -0
  27. package/dist/commands/migrate-storage.d.ts +3 -0
  28. package/dist/commands/migrate-storage.d.ts.map +1 -0
  29. package/dist/commands/migrate-storage.js +78 -0
  30. package/dist/commands/migrate-storage.js.map +1 -0
  31. package/dist/commands/notify.d.ts +3 -0
  32. package/dist/commands/notify.d.ts.map +1 -0
  33. package/dist/commands/notify.js +143 -0
  34. package/dist/commands/notify.js.map +1 -0
  35. package/dist/commands/open.d.ts +3 -0
  36. package/dist/commands/open.d.ts.map +1 -0
  37. package/dist/commands/open.js +167 -0
  38. package/dist/commands/open.js.map +1 -0
  39. package/dist/commands/plugin.d.ts +3 -0
  40. package/dist/commands/plugin.d.ts.map +1 -0
  41. package/dist/commands/plugin.js +462 -0
  42. package/dist/commands/plugin.js.map +1 -0
  43. package/dist/commands/project.d.ts +3 -0
  44. package/dist/commands/project.d.ts.map +1 -0
  45. package/dist/commands/project.js +143 -0
  46. package/dist/commands/project.js.map +1 -0
  47. package/dist/commands/report.d.ts +19 -0
  48. package/dist/commands/report.d.ts.map +1 -0
  49. package/dist/commands/report.js +114 -0
  50. package/dist/commands/report.js.map +1 -0
  51. package/dist/commands/review-check.d.ts +3 -0
  52. package/dist/commands/review-check.d.ts.map +1 -0
  53. package/dist/commands/review-check.js +122 -0
  54. package/dist/commands/review-check.js.map +1 -0
  55. package/dist/commands/review.d.ts +3 -0
  56. package/dist/commands/review.d.ts.map +1 -0
  57. package/dist/commands/review.js +215 -0
  58. package/dist/commands/review.js.map +1 -0
  59. package/dist/commands/send.d.ts +3 -0
  60. package/dist/commands/send.d.ts.map +1 -0
  61. package/dist/commands/send.js +187 -0
  62. package/dist/commands/send.js.map +1 -0
  63. package/dist/commands/session.d.ts +3 -0
  64. package/dist/commands/session.d.ts.map +1 -0
  65. package/dist/commands/session.js +439 -0
  66. package/dist/commands/session.js.map +1 -0
  67. package/dist/commands/setup.d.ts +5 -0
  68. package/dist/commands/setup.d.ts.map +1 -0
  69. package/dist/commands/setup.js +297 -0
  70. package/dist/commands/setup.js.map +1 -0
  71. package/dist/commands/spawn.d.ts +4 -0
  72. package/dist/commands/spawn.d.ts.map +1 -0
  73. package/dist/commands/spawn.js +436 -0
  74. package/dist/commands/spawn.js.map +1 -0
  75. package/dist/commands/start.d.ts +21 -0
  76. package/dist/commands/start.d.ts.map +1 -0
  77. package/dist/commands/start.js +1836 -0
  78. package/dist/commands/start.js.map +1 -0
  79. package/dist/commands/status.d.ts +3 -0
  80. package/dist/commands/status.d.ts.map +1 -0
  81. package/dist/commands/status.js +556 -0
  82. package/dist/commands/status.js.map +1 -0
  83. package/dist/commands/update.d.ts +15 -0
  84. package/dist/commands/update.d.ts.map +1 -0
  85. package/dist/commands/update.js +652 -0
  86. package/dist/commands/update.js.map +1 -0
  87. package/dist/commands/verify.d.ts +3 -0
  88. package/dist/commands/verify.d.ts.map +1 -0
  89. package/dist/commands/verify.js +131 -0
  90. package/dist/commands/verify.js.map +1 -0
  91. package/dist/index.d.ts +3 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +24 -0
  94. package/dist/index.js.map +1 -0
  95. package/dist/lib/bun-tmp-janitor.d.ts +18 -0
  96. package/dist/lib/bun-tmp-janitor.d.ts.map +1 -0
  97. package/dist/lib/bun-tmp-janitor.js +127 -0
  98. package/dist/lib/bun-tmp-janitor.js.map +1 -0
  99. package/dist/lib/caller-context.d.ts +13 -0
  100. package/dist/lib/caller-context.d.ts.map +1 -0
  101. package/dist/lib/caller-context.js +20 -0
  102. package/dist/lib/caller-context.js.map +1 -0
  103. package/dist/lib/cli-errors.d.ts +8 -0
  104. package/dist/lib/cli-errors.d.ts.map +1 -0
  105. package/dist/lib/cli-errors.js +20 -0
  106. package/dist/lib/cli-errors.js.map +1 -0
  107. package/dist/lib/completion.d.ts +13 -0
  108. package/dist/lib/completion.d.ts.map +1 -0
  109. package/dist/lib/completion.js +428 -0
  110. package/dist/lib/completion.js.map +1 -0
  111. package/dist/lib/composio-setup.d.ts +65 -0
  112. package/dist/lib/composio-setup.d.ts.map +1 -0
  113. package/dist/lib/composio-setup.js +3255 -0
  114. package/dist/lib/composio-setup.js.map +1 -0
  115. package/dist/lib/config-instruction.d.ts +2 -0
  116. package/dist/lib/config-instruction.d.ts.map +1 -0
  117. package/dist/lib/config-instruction.js +193 -0
  118. package/dist/lib/config-instruction.js.map +1 -0
  119. package/dist/lib/constants.d.ts +3 -0
  120. package/dist/lib/constants.d.ts.map +1 -0
  121. package/dist/lib/constants.js +3 -0
  122. package/dist/lib/constants.js.map +1 -0
  123. package/dist/lib/create-session-manager.d.ts +26 -0
  124. package/dist/lib/create-session-manager.d.ts.map +1 -0
  125. package/dist/lib/create-session-manager.js +55 -0
  126. package/dist/lib/create-session-manager.js.map +1 -0
  127. package/dist/lib/credential-resolver.d.ts +37 -0
  128. package/dist/lib/credential-resolver.d.ts.map +1 -0
  129. package/dist/lib/credential-resolver.js +105 -0
  130. package/dist/lib/credential-resolver.js.map +1 -0
  131. package/dist/lib/daemon.d.ts +69 -0
  132. package/dist/lib/daemon.d.ts.map +1 -0
  133. package/dist/lib/daemon.js +77 -0
  134. package/dist/lib/daemon.js.map +1 -0
  135. package/dist/lib/dashboard-rebuild.d.ts +53 -0
  136. package/dist/lib/dashboard-rebuild.d.ts.map +1 -0
  137. package/dist/lib/dashboard-rebuild.js +188 -0
  138. package/dist/lib/dashboard-rebuild.js.map +1 -0
  139. package/dist/lib/dashboard-setup.d.ts +14 -0
  140. package/dist/lib/dashboard-setup.d.ts.map +1 -0
  141. package/dist/lib/dashboard-setup.js +192 -0
  142. package/dist/lib/dashboard-setup.js.map +1 -0
  143. package/dist/lib/dashboard-url.d.ts +19 -0
  144. package/dist/lib/dashboard-url.d.ts.map +1 -0
  145. package/dist/lib/dashboard-url.js +25 -0
  146. package/dist/lib/dashboard-url.js.map +1 -0
  147. package/dist/lib/desktop-setup.d.ts +21 -0
  148. package/dist/lib/desktop-setup.d.ts.map +1 -0
  149. package/dist/lib/desktop-setup.js +556 -0
  150. package/dist/lib/desktop-setup.js.map +1 -0
  151. package/dist/lib/detect-agent.d.ts +24 -0
  152. package/dist/lib/detect-agent.d.ts.map +1 -0
  153. package/dist/lib/detect-agent.js +69 -0
  154. package/dist/lib/detect-agent.js.map +1 -0
  155. package/dist/lib/detect-env.d.ts +14 -0
  156. package/dist/lib/detect-env.d.ts.map +1 -0
  157. package/dist/lib/detect-env.js +46 -0
  158. package/dist/lib/detect-env.js.map +1 -0
  159. package/dist/lib/discord-setup.d.ts +20 -0
  160. package/dist/lib/discord-setup.d.ts.map +1 -0
  161. package/dist/lib/discord-setup.js +584 -0
  162. package/dist/lib/discord-setup.js.map +1 -0
  163. package/dist/lib/format.d.ts +11 -0
  164. package/dist/lib/format.d.ts.map +1 -0
  165. package/dist/lib/format.js +116 -0
  166. package/dist/lib/format.js.map +1 -0
  167. package/dist/lib/git-utils.d.ts +14 -0
  168. package/dist/lib/git-utils.d.ts.map +1 -0
  169. package/dist/lib/git-utils.js +45 -0
  170. package/dist/lib/git-utils.js.map +1 -0
  171. package/dist/lib/install-helpers.d.ts +24 -0
  172. package/dist/lib/install-helpers.d.ts.map +1 -0
  173. package/dist/lib/install-helpers.js +76 -0
  174. package/dist/lib/install-helpers.js.map +1 -0
  175. package/dist/lib/lifecycle-service.d.ts +11 -0
  176. package/dist/lib/lifecycle-service.d.ts.map +1 -0
  177. package/dist/lib/lifecycle-service.js +65 -0
  178. package/dist/lib/lifecycle-service.js.map +1 -0
  179. package/dist/lib/notifier-routing.d.ts +35 -0
  180. package/dist/lib/notifier-routing.d.ts.map +1 -0
  181. package/dist/lib/notifier-routing.js +133 -0
  182. package/dist/lib/notifier-routing.js.map +1 -0
  183. package/dist/lib/notify-test.d.ts +72 -0
  184. package/dist/lib/notify-test.d.ts.map +1 -0
  185. package/dist/lib/notify-test.js +674 -0
  186. package/dist/lib/notify-test.js.map +1 -0
  187. package/dist/lib/openclaw-probe.d.ts +38 -0
  188. package/dist/lib/openclaw-probe.d.ts.map +1 -0
  189. package/dist/lib/openclaw-probe.js +146 -0
  190. package/dist/lib/openclaw-probe.js.map +1 -0
  191. package/dist/lib/openclaw-setup.d.ts +19 -0
  192. package/dist/lib/openclaw-setup.d.ts.map +1 -0
  193. package/dist/lib/openclaw-setup.js +684 -0
  194. package/dist/lib/openclaw-setup.js.map +1 -0
  195. package/dist/lib/path-equality.d.ts +29 -0
  196. package/dist/lib/path-equality.d.ts.map +1 -0
  197. package/dist/lib/path-equality.js +52 -0
  198. package/dist/lib/path-equality.js.map +1 -0
  199. package/dist/lib/plugin-marketplace.d.ts +24 -0
  200. package/dist/lib/plugin-marketplace.d.ts.map +1 -0
  201. package/dist/lib/plugin-marketplace.js +175 -0
  202. package/dist/lib/plugin-marketplace.js.map +1 -0
  203. package/dist/lib/plugin-scaffold.d.ts +14 -0
  204. package/dist/lib/plugin-scaffold.d.ts.map +1 -0
  205. package/dist/lib/plugin-scaffold.js +174 -0
  206. package/dist/lib/plugin-scaffold.js.map +1 -0
  207. package/dist/lib/plugin-store.d.ts +9 -0
  208. package/dist/lib/plugin-store.d.ts.map +1 -0
  209. package/dist/lib/plugin-store.js +121 -0
  210. package/dist/lib/plugin-store.js.map +1 -0
  211. package/dist/lib/plugins.d.ts +17 -0
  212. package/dist/lib/plugins.d.ts.map +1 -0
  213. package/dist/lib/plugins.js +65 -0
  214. package/dist/lib/plugins.js.map +1 -0
  215. package/dist/lib/portfolio-display.d.ts +10 -0
  216. package/dist/lib/portfolio-display.d.ts.map +1 -0
  217. package/dist/lib/portfolio-display.js +17 -0
  218. package/dist/lib/portfolio-display.js.map +1 -0
  219. package/dist/lib/preflight.d.ts +27 -0
  220. package/dist/lib/preflight.d.ts.map +1 -0
  221. package/dist/lib/preflight.js +77 -0
  222. package/dist/lib/preflight.js.map +1 -0
  223. package/dist/lib/prevent-sleep.d.ts +34 -0
  224. package/dist/lib/prevent-sleep.d.ts.map +1 -0
  225. package/dist/lib/prevent-sleep.js +65 -0
  226. package/dist/lib/prevent-sleep.js.map +1 -0
  227. package/dist/lib/project-detection.d.ts +11 -0
  228. package/dist/lib/project-detection.d.ts.map +1 -0
  229. package/dist/lib/project-detection.js +206 -0
  230. package/dist/lib/project-detection.js.map +1 -0
  231. package/dist/lib/project-resolution.d.ts +10 -0
  232. package/dist/lib/project-resolution.d.ts.map +1 -0
  233. package/dist/lib/project-resolution.js +17 -0
  234. package/dist/lib/project-resolution.js.map +1 -0
  235. package/dist/lib/project-supervisor.d.ts +28 -0
  236. package/dist/lib/project-supervisor.d.ts.map +1 -0
  237. package/dist/lib/project-supervisor.js +167 -0
  238. package/dist/lib/project-supervisor.js.map +1 -0
  239. package/dist/lib/prompts.d.ts +7 -0
  240. package/dist/lib/prompts.d.ts.map +1 -0
  241. package/dist/lib/prompts.js +37 -0
  242. package/dist/lib/prompts.js.map +1 -0
  243. package/dist/lib/repo-utils.d.ts +16 -0
  244. package/dist/lib/repo-utils.d.ts.map +1 -0
  245. package/dist/lib/repo-utils.js +26 -0
  246. package/dist/lib/repo-utils.js.map +1 -0
  247. package/dist/lib/resolve-project.d.ts +113 -0
  248. package/dist/lib/resolve-project.d.ts.map +1 -0
  249. package/dist/lib/resolve-project.js +433 -0
  250. package/dist/lib/resolve-project.js.map +1 -0
  251. package/dist/lib/routes.d.ts +2 -0
  252. package/dist/lib/routes.d.ts.map +1 -0
  253. package/dist/lib/routes.js +5 -0
  254. package/dist/lib/routes.js.map +1 -0
  255. package/dist/lib/running-state.d.ts +76 -0
  256. package/dist/lib/running-state.d.ts.map +1 -0
  257. package/dist/lib/running-state.js +338 -0
  258. package/dist/lib/running-state.js.map +1 -0
  259. package/dist/lib/script-runner.d.ts +10 -0
  260. package/dist/lib/script-runner.d.ts.map +1 -0
  261. package/dist/lib/script-runner.js +189 -0
  262. package/dist/lib/script-runner.js.map +1 -0
  263. package/dist/lib/session-utils.d.ts +14 -0
  264. package/dist/lib/session-utils.d.ts.map +1 -0
  265. package/dist/lib/session-utils.js +58 -0
  266. package/dist/lib/session-utils.js.map +1 -0
  267. package/dist/lib/shell.d.ts +17 -0
  268. package/dist/lib/shell.d.ts.map +1 -0
  269. package/dist/lib/shell.js +90 -0
  270. package/dist/lib/shell.js.map +1 -0
  271. package/dist/lib/shutdown.d.ts +30 -0
  272. package/dist/lib/shutdown.d.ts.map +1 -0
  273. package/dist/lib/shutdown.js +177 -0
  274. package/dist/lib/shutdown.js.map +1 -0
  275. package/dist/lib/slack-setup.d.ts +17 -0
  276. package/dist/lib/slack-setup.d.ts.map +1 -0
  277. package/dist/lib/slack-setup.js +485 -0
  278. package/dist/lib/slack-setup.js.map +1 -0
  279. package/dist/lib/startup-preflight.d.ts +36 -0
  280. package/dist/lib/startup-preflight.d.ts.map +1 -0
  281. package/dist/lib/startup-preflight.js +273 -0
  282. package/dist/lib/startup-preflight.js.map +1 -0
  283. package/dist/lib/update-channel-onboarding.d.ts +52 -0
  284. package/dist/lib/update-channel-onboarding.d.ts.map +1 -0
  285. package/dist/lib/update-channel-onboarding.js +107 -0
  286. package/dist/lib/update-channel-onboarding.js.map +1 -0
  287. package/dist/lib/update-check.d.ts +161 -0
  288. package/dist/lib/update-check.d.ts.map +1 -0
  289. package/dist/lib/update-check.js +504 -0
  290. package/dist/lib/update-check.js.map +1 -0
  291. package/dist/lib/web-dir.d.ts +47 -0
  292. package/dist/lib/web-dir.d.ts.map +1 -0
  293. package/dist/lib/web-dir.js +179 -0
  294. package/dist/lib/web-dir.js.map +1 -0
  295. package/dist/lib/webhook-setup.d.ts +16 -0
  296. package/dist/lib/webhook-setup.d.ts.map +1 -0
  297. package/dist/lib/webhook-setup.js +383 -0
  298. package/dist/lib/webhook-setup.js.map +1 -0
  299. package/dist/options/version.d.ts +2 -0
  300. package/dist/options/version.d.ts.map +1 -0
  301. package/dist/options/version.js +7 -0
  302. package/dist/options/version.js.map +1 -0
  303. package/dist/program.d.ts +3 -0
  304. package/dist/program.d.ts.map +1 -0
  305. package/dist/program.js +63 -0
  306. package/dist/program.js.map +1 -0
  307. package/package.json +80 -0
  308. package/templates/rules/base.md +4 -0
  309. package/templates/rules/go.md +8 -0
  310. package/templates/rules/javascript.md +4 -0
  311. package/templates/rules/nextjs.md +7 -0
  312. package/templates/rules/pnpm-workspaces.md +4 -0
  313. package/templates/rules/python.md +8 -0
  314. package/templates/rules/react.md +8 -0
  315. package/templates/rules/typescript.md +6 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Composio, Inc.
4
+ Copyright (c) 2026 slievr (Athene fork)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,67 @@
1
+ [
2
+ {
3
+ "id": "agent-codex",
4
+ "package": "@made-by-moonlight/athene-plugin-agent-codex",
5
+ "slot": "agent",
6
+ "description": "Agent plugin: OpenAI Codex CLI",
7
+ "source": "registry",
8
+ "latestVersion": "0.2.0"
9
+ },
10
+ {
11
+ "id": "agent-aider",
12
+ "package": "@made-by-moonlight/athene-plugin-agent-aider",
13
+ "slot": "agent",
14
+ "description": "Agent plugin: Aider CLI",
15
+ "source": "registry",
16
+ "latestVersion": "0.2.0"
17
+ },
18
+ {
19
+ "id": "agent-opencode",
20
+ "package": "@made-by-moonlight/athene-plugin-agent-opencode",
21
+ "slot": "agent",
22
+ "description": "Agent plugin: OpenCode CLI",
23
+ "source": "registry",
24
+ "latestVersion": "0.2.0"
25
+ },
26
+ {
27
+ "id": "agent-kimicode",
28
+ "package": "@made-by-moonlight/athene-plugin-agent-kimicode",
29
+ "slot": "agent",
30
+ "description": "Agent plugin: Kimi Code CLI (MoonshotAI)",
31
+ "source": "registry",
32
+ "latestVersion": "0.1.0"
33
+ },
34
+ {
35
+ "id": "notifier-openclaw",
36
+ "package": "@made-by-moonlight/athene-plugin-notifier-openclaw",
37
+ "slot": "notifier",
38
+ "description": "Notifier plugin: OpenClaw webhook notifications",
39
+ "source": "registry",
40
+ "setupAction": "openclaw-setup",
41
+ "latestVersion": "0.1.1"
42
+ },
43
+ {
44
+ "id": "notifier-discord",
45
+ "package": "@made-by-moonlight/athene-plugin-notifier-discord",
46
+ "slot": "notifier",
47
+ "description": "Notifier plugin: Discord notifications",
48
+ "source": "registry",
49
+ "latestVersion": "0.1.0"
50
+ },
51
+ {
52
+ "id": "tracker-gitlab",
53
+ "package": "@made-by-moonlight/athene-plugin-tracker-gitlab",
54
+ "slot": "tracker",
55
+ "description": "Tracker plugin: GitLab issues",
56
+ "source": "registry",
57
+ "latestVersion": "0.1.1"
58
+ },
59
+ {
60
+ "id": "scm-gitlab",
61
+ "package": "@made-by-moonlight/athene-plugin-scm-gitlab",
62
+ "slot": "scm",
63
+ "description": "SCM plugin: GitLab pull/merge requests",
64
+ "source": "registry",
65
+ "latestVersion": "0.1.1"
66
+ }
67
+ ]
@@ -0,0 +1,352 @@
1
+ # PowerShell port of athene-doctor.sh — Windows-native health checks for AO.
2
+ # Invoked by `athene doctor` on Windows via runRepoScript().
3
+
4
+ $ErrorActionPreference = 'Continue'
5
+
6
+ # Manual arg parsing — matches athene-doctor.sh's `--fix` / `-h` / `--help` flags
7
+ # rather than PowerShell's `-Fix` convention, so the calling contract is
8
+ # identical on Linux/macOS/Windows.
9
+ $Fix = $false
10
+ $Help = $false
11
+ foreach ($a in $args) {
12
+ switch ($a) {
13
+ '--fix' { $Fix = $true }
14
+ '-h' { $Help = $true }
15
+ '--help' { $Help = $true }
16
+ default {
17
+ Write-Error "Unknown option: $a"
18
+ exit 1
19
+ }
20
+ }
21
+ }
22
+
23
+ if ($Help) {
24
+ @'
25
+ Usage: athene doctor [--fix]
26
+
27
+ Checks install, PATH, binaries, service health, stale temp files, and runtime sanity.
28
+
29
+ Options:
30
+ --fix Apply safe fixes for missing launcher links, missing support dirs, and stale temp files
31
+ '@ | Write-Host
32
+ exit 0
33
+ }
34
+
35
+ # AO_REPO_ROOT and AO_SCRIPT_LAYOUT are exported by runRepoScript().
36
+ $RepoRoot = if ($env:AO_REPO_ROOT) { $env:AO_REPO_ROOT } else { (Resolve-Path (Join-Path $PSScriptRoot '..')).Path }
37
+ $ScriptLayout = $env:AO_SCRIPT_LAYOUT
38
+ if (-not $ScriptLayout) {
39
+ if ((Test-Path (Join-Path $RepoRoot 'package.json')) -and
40
+ (Test-Path (Join-Path $RepoRoot 'dist/index.js')) -and
41
+ -not (Test-Path (Join-Path $RepoRoot 'packages'))) {
42
+ $ScriptLayout = 'package-install'
43
+ } else {
44
+ $ScriptLayout = 'source-checkout'
45
+ }
46
+ }
47
+
48
+ $DefaultConfigHome = if ($env:USERPROFILE) { $env:USERPROFILE } else { $RepoRoot }
49
+
50
+ $script:PassCount = 0
51
+ $script:WarnCount = 0
52
+ $script:FailCount = 0
53
+ $script:FixCount = 0
54
+
55
+ function Write-Pass($msg) { $script:PassCount++; Write-Host "PASS $msg" }
56
+ function Write-Warn2($msg) { $script:WarnCount++; Write-Host "WARN $msg" }
57
+ function Write-Fail($msg) { $script:FailCount++; Write-Host "FAIL $msg" }
58
+ function Write-Fixed($msg) { $script:FixCount++; Write-Host "FIXED $msg" }
59
+
60
+ function Expand-HomePath([string]$p) {
61
+ if ($p -like '~/*' -or $p -like '~\*') {
62
+ return Join-Path $DefaultConfigHome $p.Substring(2)
63
+ }
64
+ if ($p -eq '~') { return $DefaultConfigHome }
65
+ return $p
66
+ }
67
+
68
+ function Find-AoConfig {
69
+ if ($env:AO_CONFIG_PATH -and (Test-Path $env:AO_CONFIG_PATH)) {
70
+ return $env:AO_CONFIG_PATH
71
+ }
72
+ $current = Get-Location | Select-Object -ExpandProperty Path
73
+ while ($current) {
74
+ foreach ($name in @('agent-orchestrator.yaml', 'agent-orchestrator.yml')) {
75
+ $candidate = Join-Path $current $name
76
+ if (Test-Path $candidate) { return $candidate }
77
+ }
78
+ $parent = Split-Path $current -Parent
79
+ if (-not $parent -or $parent -eq $current) { break }
80
+ $current = $parent
81
+ }
82
+ foreach ($candidate in @(
83
+ (Join-Path $RepoRoot 'agent-orchestrator.yaml'),
84
+ (Join-Path $DefaultConfigHome '.agent-orchestrator.yaml')
85
+ )) {
86
+ if (Test-Path $candidate) { return $candidate }
87
+ }
88
+ return $null
89
+ }
90
+
91
+ function Read-ConfigValue([string]$key, [string]$file) {
92
+ $line = Get-Content $file -ErrorAction SilentlyContinue |
93
+ Where-Object { $_ -match "^\s*${key}:" } |
94
+ Select-Object -First 1
95
+ if (-not $line) { return '' }
96
+ # Strip key, comments, quotes, surrounding whitespace.
97
+ $val = ($line -replace "^\s*${key}:", '').Trim()
98
+ $val = ($val -split '#', 2)[0].Trim()
99
+ $val = $val.Trim('"').Trim("'").Trim()
100
+ return $val
101
+ }
102
+
103
+ function Ensure-Dir([string]$dir, [string]$label, [string]$fixHint) {
104
+ if (Test-Path $dir -PathType Container) {
105
+ Write-Pass "$label exists at $dir"
106
+ return
107
+ }
108
+ if ($Fix) {
109
+ try {
110
+ New-Item -ItemType Directory -Path $dir -Force | Out-Null
111
+ Write-Fixed "$label created at $dir"
112
+ } catch {
113
+ Write-Fail "$label could not be created at $dir. Fix: $fixHint"
114
+ }
115
+ return
116
+ }
117
+ Write-Warn2 "$label is missing at $dir. Fix: $fixHint"
118
+ }
119
+
120
+ function Check-Command([string]$name, [string]$required, [string]$fixHint) {
121
+ $resolved = Get-Command $name -ErrorAction SilentlyContinue
122
+ if (-not $resolved) {
123
+ if ($required -eq 'required') {
124
+ Write-Fail "$name is not in PATH. Fix: $fixHint"
125
+ } else {
126
+ Write-Warn2 "$name is not in PATH. Fix: $fixHint"
127
+ }
128
+ return $false
129
+ }
130
+ Write-Pass "$name resolves to $($resolved.Source)"
131
+ return $true
132
+ }
133
+
134
+ function Check-Node {
135
+ if (-not (Check-Command 'node' 'required' 'install Node.js 20+ and reopen your shell')) { return }
136
+ $version = (& node --version 2>$null)
137
+ if (-not $version) { return }
138
+ $major = [int](($version.TrimStart('v')) -split '\.')[0]
139
+ if ($major -lt 20) {
140
+ Write-Fail "Node.js 20+ is required, found $version. Fix: install Node.js 20+"
141
+ return
142
+ }
143
+ Write-Pass "Node.js version $version is supported"
144
+ }
145
+
146
+ function Check-Git {
147
+ if (-not (Check-Command 'git' 'required' 'install git 2.25+ and reopen your shell')) { return }
148
+ $out = (& git --version 2>$null)
149
+ if (-not $out) { return }
150
+ $match = [regex]::Match($out, '(\d+)\.(\d+)')
151
+ if (-not $match.Success) {
152
+ Write-Fail "git 2.25+ is required, could not parse '$out'. Fix: upgrade git"
153
+ return
154
+ }
155
+ $major = [int]$match.Groups[1].Value
156
+ $minor = [int]$match.Groups[2].Value
157
+ if ($major -lt 2 -or ($major -eq 2 -and $minor -lt 25)) {
158
+ Write-Fail "git 2.25+ is required, found $major.$minor. Fix: upgrade git"
159
+ return
160
+ }
161
+ Write-Pass "git version $major.$minor supports worktrees"
162
+ }
163
+
164
+ function Check-Pnpm {
165
+ $required = 'required'
166
+ $hint = 'enable corepack or run npm install -g pnpm'
167
+ if ($ScriptLayout -eq 'package-install') {
168
+ $required = 'optional'
169
+ $hint = 'install pnpm if you plan to use pnpm-managed repos with AO'
170
+ }
171
+ if (-not (Check-Command 'pnpm' $required $hint)) { return }
172
+ $version = (& pnpm --version 2>$null)
173
+ $shown = if ($version) { $version } else { 'unknown' }
174
+ Write-Pass "pnpm version $shown is available"
175
+ }
176
+
177
+ function Check-Launcher {
178
+ $resolved = Get-Command 'athene' -ErrorAction SilentlyContinue
179
+ if ($resolved) {
180
+ Write-Pass "ao launcher resolves to $($resolved.Source)"
181
+ return
182
+ }
183
+ if ($ScriptLayout -eq 'source-checkout' -and $Fix -and (Get-Command npm -ErrorAction SilentlyContinue) -and (Test-Path (Join-Path $RepoRoot 'packages/athene'))) {
184
+ Push-Location (Join-Path $RepoRoot 'packages/athene')
185
+ try {
186
+ $null = & npm link --force 2>&1
187
+ if ($LASTEXITCODE -eq 0 -and (Get-Command 'athene' -ErrorAction SilentlyContinue)) {
188
+ Write-Fixed "ao launcher refreshed with npm link --force"
189
+ return
190
+ }
191
+ } finally { Pop-Location }
192
+ Write-Warn2 "ao launcher refresh failed. Fix: cd $RepoRoot\packages\ao; npm link --force"
193
+ return
194
+ }
195
+ if ($ScriptLayout -eq 'package-install') {
196
+ Write-Warn2 "ao launcher is not in PATH. Fix: reinstall with npm install -g @made-by-moonlight/athene@latest"
197
+ return
198
+ }
199
+ Write-Warn2 "ao launcher is not in PATH. Fix: cd $RepoRoot; pwsh scripts/setup.ps1 (or run npm link --force in packages/athene)"
200
+ }
201
+
202
+ function Check-Tmux {
203
+ # tmux is not native on Windows. The default Windows runtime is `process`,
204
+ # so tmux is informational only.
205
+ if (Get-Command 'tmux' -ErrorAction SilentlyContinue) {
206
+ Write-Pass "tmux is installed (note: Windows default runtime is 'process')"
207
+ return
208
+ }
209
+ Write-Pass "tmux not installed (Windows default runtime is 'process' — tmux not required)"
210
+ }
211
+
212
+ function Check-Gh {
213
+ if (-not (Get-Command 'gh' -ErrorAction SilentlyContinue)) {
214
+ Write-Warn2 "GitHub CLI is not installed. Fix: install gh from https://cli.github.com/"
215
+ return
216
+ }
217
+ & gh auth status *> $null
218
+ if ($LASTEXITCODE -eq 0) {
219
+ Write-Pass "gh is installed and authenticated"
220
+ return
221
+ }
222
+ Write-Warn2 "gh is installed but not authenticated. Fix: run gh auth login"
223
+ }
224
+
225
+ function Check-InstallLayout {
226
+ if ($ScriptLayout -eq 'package-install') {
227
+ $checks = @(
228
+ @{ Path = 'package.json'; Label = 'CLI package metadata is present' }
229
+ @{ Path = 'dist/index.js'; Label = 'packaged CLI entrypoint exists' }
230
+ @{ Path = 'dist/assets/scripts/athene-doctor.ps1'; Label = 'bundled doctor script is available' }
231
+ @{ Path = 'dist/assets/scripts/athene-update.ps1'; Label = 'bundled update script is available' }
232
+ )
233
+ foreach ($c in $checks) {
234
+ $full = Join-Path $RepoRoot $c.Path
235
+ if (Test-Path $full) { Write-Pass $c.Label } else { Write-Fail "$($c.Label) (missing $full). Fix: reinstall @made-by-moonlight/athene" }
236
+ }
237
+ return
238
+ }
239
+ if (Test-Path (Join-Path $RepoRoot 'node_modules')) {
240
+ Write-Pass "dependencies are installed at $RepoRoot\node_modules"
241
+ } else {
242
+ Write-Fail "dependencies are missing at $RepoRoot\node_modules. Fix: run pnpm install"
243
+ }
244
+ if (Test-Path (Join-Path $RepoRoot 'packages/core/dist/index.js')) {
245
+ Write-Pass "core package is built"
246
+ } else {
247
+ Write-Fail "core package is not built. Fix: run pnpm --filter @made-by-moonlight/athene-core build"
248
+ }
249
+ if (Test-Path (Join-Path $RepoRoot 'packages/cli/dist/index.js')) {
250
+ Write-Pass "CLI package is built"
251
+ } else {
252
+ Write-Fail "CLI package is not built. Fix: run pnpm --filter @made-by-moonlight/athene-cli build"
253
+ }
254
+ }
255
+
256
+ function Check-RuntimeSanity {
257
+ if ($ScriptLayout -eq 'package-install') {
258
+ $entry = Join-Path $RepoRoot 'dist/index.js'
259
+ if (-not (Test-Path $entry)) {
260
+ Write-Fail "packaged CLI entrypoint is missing. Fix: reinstall @made-by-moonlight/athene"
261
+ return
262
+ }
263
+ & node $entry --version *> $null
264
+ if ($LASTEXITCODE -eq 0) {
265
+ Write-Pass "packaged CLI runtime sanity check passed (athene --version)"
266
+ } else {
267
+ Write-Fail "packaged CLI runtime sanity check failed. Fix: reinstall @made-by-moonlight/athene"
268
+ }
269
+ return
270
+ }
271
+ $entry = Join-Path $RepoRoot 'packages/athene/bin/athene.js'
272
+ if (-not (Test-Path $entry)) {
273
+ Write-Fail "launcher entrypoint is missing. Fix: reinstall from a clean checkout"
274
+ return
275
+ }
276
+ & node $entry --version *> $null
277
+ if ($LASTEXITCODE -eq 0) {
278
+ Write-Pass "launcher runtime sanity check passed (athene --version)"
279
+ } else {
280
+ Write-Fail "launcher runtime sanity check failed. Fix: run pnpm build and refresh the launcher"
281
+ }
282
+ }
283
+
284
+ function Check-ConfigDirs {
285
+ $configPath = Find-AoConfig
286
+ if (-not $configPath) {
287
+ Write-Warn2 "No agent-orchestrator config was found. Fix: run ao init --auto in a target repo"
288
+ return
289
+ }
290
+ Write-Pass "config found at $configPath"
291
+ $dataDir = Read-ConfigValue 'dataDir' $configPath
292
+ $worktreeDir = Read-ConfigValue 'worktreeDir' $configPath
293
+ if (-not $dataDir) { $dataDir = Join-Path $DefaultConfigHome '.agent-orchestrator' }
294
+ if (-not $worktreeDir) { $worktreeDir = Join-Path $DefaultConfigHome '.worktrees' }
295
+ $dataDir = Expand-HomePath $dataDir
296
+ $worktreeDir = Expand-HomePath $worktreeDir
297
+ Ensure-Dir $dataDir 'metadata directory' "New-Item -ItemType Directory -Path $dataDir -Force"
298
+ Ensure-Dir $worktreeDir 'worktree directory' "New-Item -ItemType Directory -Path $worktreeDir -Force"
299
+ }
300
+
301
+ function Check-StaleTempFiles {
302
+ $tempRoot = if ($env:AO_DOCTOR_TMP_ROOT) { $env:AO_DOCTOR_TMP_ROOT } else { Join-Path $env:TEMP 'agent-orchestrator' }
303
+ if (-not (Test-Path $tempRoot)) {
304
+ Write-Pass "temp root exists check skipped because $tempRoot does not exist"
305
+ return
306
+ }
307
+ $cutoff = (Get-Date).AddMinutes(-60)
308
+ $stale = Get-ChildItem -Path $tempRoot -File -ErrorAction SilentlyContinue |
309
+ Where-Object { $_.LastWriteTime -lt $cutoff -and ($_.Name -like 'ao-*.tmp' -or $_.Name -like 'ao-*.pid' -or $_.Name -like 'ao-*.lock') }
310
+
311
+ if (-not $stale -or $stale.Count -eq 0) {
312
+ Write-Pass "no stale temp files were detected under $tempRoot"
313
+ return
314
+ }
315
+ if ($Fix) {
316
+ $deleted = 0
317
+ foreach ($f in $stale) {
318
+ try { Remove-Item $f.FullName -Force; $deleted++ } catch { }
319
+ }
320
+ if ($deleted -eq $stale.Count) {
321
+ Write-Fixed "$deleted stale temp files removed from $tempRoot"
322
+ } else {
323
+ Write-Warn2 "Only removed $deleted of $($stale.Count) stale temp files from $tempRoot. Fix: inspect that directory manually"
324
+ }
325
+ return
326
+ }
327
+ Write-Warn2 "$($stale.Count) stale temp files older than 60 minutes found under $tempRoot. Fix: rerun athene doctor --fix"
328
+ }
329
+
330
+ Write-Host "Athene Doctor`n"
331
+
332
+ Check-Node
333
+ Check-Git
334
+ Check-Pnpm
335
+ Check-Launcher
336
+ Check-Tmux
337
+ Check-Gh
338
+ Check-ConfigDirs
339
+ Check-StaleTempFiles
340
+ Check-InstallLayout
341
+ Check-RuntimeSanity
342
+
343
+ Write-Host ""
344
+ Write-Host "Results: $script:PassCount PASS, $script:WarnCount WARN, $script:FailCount FAIL, $script:FixCount FIXED"
345
+
346
+ if ($script:FailCount -gt 0) {
347
+ Write-Error "Environment needs attention before AO is safe to update or run."
348
+ exit 1
349
+ }
350
+
351
+ Write-Host "Environment looks healthy enough to run Athene."
352
+ exit 0