@paradigma-inc/flywheel 0.1.111 → 0.1.134

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 (628) hide show
  1. package/README.md +79 -13
  2. package/package.json +14 -6
  3. package/skills/flywheel/SKILL.md +9 -6
  4. package/skills/flywheel/example-workflows/organizing-exploring-and-iterating-on-a-research-topic.md +38 -46
  5. package/skills/flywheel/example-workflows/reproducing-papers-on-a-budget.md +34 -36
  6. package/skills/flywheel/getting-started/flywheel-quickstart.md +2 -5
  7. package/skills/flywheel/getting-started/flywheel-tutorial-overview.md +1 -1
  8. package/skills/flywheel/references/INTERFACES.md +2 -2
  9. package/skills/flywheel/references/experiment-design-protocol.md +32 -25
  10. package/skills/flywheel/references/flywheel-cli-tool-map.md +120 -76
  11. package/skills/flywheel/references/flywheel-mcp-tool-map.md +42 -32
  12. package/skills/flywheel/setting-up-flywheel/claude-code-cli-installation.md +1 -1
  13. package/skills/flywheel/setting-up-flywheel/codex-cli-installation.md +1 -1
  14. package/skills/flywheel/setting-up-flywheel/how-can-i-get-an-authorized-client_id-for-the-oauth-flow.md +12 -4
  15. package/skills/flywheel/setting-up-flywheel/installation-overview.md +2 -6
  16. package/skills/flywheel/setting-up-flywheel/other-hosts-installation.md +53 -26
  17. package/skills/flywheel/setting-up-flywheel/updating-flywheel-mcp.md +34 -11
  18. package/skills/flywheel-auto/SKILL.md +40 -23
  19. package/skills/flywheel-auto/evals/evals.json +1 -1
  20. package/skills/flywheel-auto/references/INTERFACES.md +2 -2
  21. package/skills/flywheel-auto/references/experiment-design-protocol.md +31 -23
  22. package/skills/flywheel-auto/references/flywheel-cli-tool-map.md +172 -127
  23. package/skills/flywheel-auto/references/flywheel-mcp-tool-map.md +22 -24
  24. package/skills/flywheel-lookahead/SKILL.md +47 -28
  25. package/skills/flywheel-lookahead/agents/openai.yaml +1 -1
  26. package/skills/flywheel-lookahead/evals/evals.json +6 -6
  27. package/skills/flywheel-lookahead/references/INTERFACES.md +2 -2
  28. package/skills/flywheel-lookahead/references/flywheel-cli-tool-map.md +172 -127
  29. package/skills/flywheel-lookahead/references/flywheel-mcp-tool-map.md +22 -24
  30. package/skills/flywheel-prove/SKILL.md +2 -2
  31. package/skills/flywheel-prove/references/workflow.md +21 -2
  32. package/skills/flywheel-reproduce/SKILL.md +39 -19
  33. package/skills/flywheel-reproduce/evals/evals.json +1 -1
  34. package/skills/flywheel-reproduce/references/INTERFACES.md +2 -2
  35. package/skills/flywheel-reproduce/references/experiment-design-protocol.md +31 -23
  36. package/skills/flywheel-reproduce/references/flywheel-cli-tool-map.md +172 -127
  37. package/skills/flywheel-reproduce/references/flywheel-mcp-tool-map.md +22 -24
  38. package/skills/flywheel-to-graph/SKILL.md +37 -17
  39. package/skills/flywheel-to-graph/references/INTERFACES.md +2 -2
  40. package/skills/flywheel-to-graph/references/flywheel-cli-tool-map.md +172 -127
  41. package/skills/flywheel-to-graph/references/flywheel-mcp-tool-map.md +22 -24
  42. package/skills/flywheel-tree/references/workflow.md +6 -37
  43. package/src/cli.mjs +1145 -1141
  44. package/src/mcp-writer.mjs +413 -435
  45. package/src/public-command-metadata.mjs +28 -5
  46. package/src/runtime/delegate.mjs +2 -19
  47. package/src/runtime/required-runtime-commands.json +83 -28
  48. package/src/runtime/runtime-config.mjs +39 -60
  49. package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js +330 -0
  50. package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js.map +1 -0
  51. package/src/runtime/vendor/flywheel-cli-dist/auth/login.js +90 -139
  52. package/src/runtime/vendor/flywheel-cli-dist/auth/login.js.map +1 -1
  53. package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js +1 -1
  54. package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js.map +1 -1
  55. package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js +116 -0
  56. package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js.map +1 -0
  57. package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.js +36 -14
  58. package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.js.map +1 -1
  59. package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.js +15 -6
  60. package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.js.map +1 -1
  61. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js +256 -0
  62. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js.map +1 -0
  63. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-delete.js +11 -0
  64. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-delete.js.map +1 -0
  65. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js +84 -0
  66. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js.map +1 -0
  67. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js +17 -0
  68. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js.map +1 -0
  69. package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js +3 -7
  70. package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js.map +1 -1
  71. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js +12 -0
  72. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js.map +1 -0
  73. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js +29 -0
  74. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js.map +1 -0
  75. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js +12 -0
  76. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js.map +1 -1
  77. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js +46 -10
  78. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js.map +1 -1
  79. package/src/runtime/vendor/flywheel-cli-dist/commands/env.js +17 -40
  80. package/src/runtime/vendor/flywheel-cli-dist/commands/env.js.map +1 -1
  81. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js +305 -0
  82. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js.map +1 -0
  83. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js +72 -0
  84. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js.map +1 -0
  85. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js +286 -0
  86. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js.map +1 -0
  87. package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js +30 -5
  88. package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js.map +1 -1
  89. package/src/runtime/vendor/flywheel-cli-dist/commands/help.js +27 -12
  90. package/src/runtime/vendor/flywheel-cli-dist/commands/help.js.map +1 -1
  91. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js +284 -0
  92. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js.map +1 -0
  93. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js +169 -0
  94. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js.map +1 -0
  95. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js +13 -0
  96. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js.map +1 -0
  97. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js +227 -0
  98. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js.map +1 -0
  99. package/src/runtime/vendor/flywheel-cli-dist/commands/index.js +239 -263
  100. package/src/runtime/vendor/flywheel-cli-dist/commands/index.js.map +1 -1
  101. package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js +25 -0
  102. package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js.map +1 -0
  103. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js +11 -9
  104. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js.map +1 -1
  105. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js +38 -45
  106. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js.map +1 -1
  107. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js +14 -17
  108. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js.map +1 -1
  109. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js +13 -8
  110. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js.map +1 -1
  111. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js +237 -66
  112. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js.map +1 -1
  113. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js +9 -9
  114. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js.map +1 -1
  115. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js +76 -0
  116. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js.map +1 -0
  117. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js +4 -138
  118. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js.map +1 -1
  119. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js +8 -13
  120. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js.map +1 -1
  121. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js +362 -0
  122. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js.map +1 -0
  123. package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js +45 -183
  124. package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js.map +1 -1
  125. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js +47 -0
  126. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js.map +1 -0
  127. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js +181 -0
  128. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js.map +1 -0
  129. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js +163 -0
  130. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js.map +1 -0
  131. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js +79 -0
  132. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js.map +1 -0
  133. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js +80 -0
  134. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js.map +1 -0
  135. package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js +78 -0
  136. package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js.map +1 -0
  137. package/src/runtime/vendor/flywheel-cli-dist/commands/types.js.map +1 -1
  138. package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js +3 -2
  139. package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js.map +1 -1
  140. package/src/runtime/vendor/flywheel-cli-dist/config/index.js +5 -0
  141. package/src/runtime/vendor/flywheel-cli-dist/config/index.js.map +1 -0
  142. package/src/runtime/vendor/flywheel-cli-dist/config/io.js +139 -0
  143. package/src/runtime/vendor/flywheel-cli-dist/config/io.js.map +1 -0
  144. package/src/runtime/vendor/flywheel-cli-dist/config/migration.js +299 -0
  145. package/src/runtime/vendor/flywheel-cli-dist/config/migration.js.map +1 -0
  146. package/src/runtime/vendor/flywheel-cli-dist/config/model.js +214 -0
  147. package/src/runtime/vendor/flywheel-cli-dist/config/model.js.map +1 -0
  148. package/src/runtime/vendor/flywheel-cli-dist/config/path.js +30 -0
  149. package/src/runtime/vendor/flywheel-cli-dist/config/path.js.map +1 -0
  150. package/src/runtime/vendor/flywheel-cli-dist/credential-output.js +29 -0
  151. package/src/runtime/vendor/flywheel-cli-dist/credential-output.js.map +1 -0
  152. package/src/runtime/vendor/flywheel-cli-dist/errors.js +1 -16
  153. package/src/runtime/vendor/flywheel-cli-dist/errors.js.map +1 -1
  154. package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js +3 -3
  155. package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js.map +1 -1
  156. package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js +19 -9
  157. package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js.map +1 -1
  158. package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js +33 -4
  159. package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js.map +1 -1
  160. package/src/runtime/vendor/flywheel-cli-dist/http/client.js +322 -302
  161. package/src/runtime/vendor/flywheel-cli-dist/http/client.js.map +1 -1
  162. package/src/runtime/vendor/flywheel-cli-dist/http/debug.js +1 -21
  163. package/src/runtime/vendor/flywheel-cli-dist/http/debug.js.map +1 -1
  164. package/src/runtime/vendor/flywheel-cli-dist/http/retry.js +1 -0
  165. package/src/runtime/vendor/flywheel-cli-dist/http/retry.js.map +1 -1
  166. package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js +244 -0
  167. package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js.map +1 -0
  168. package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js +7 -0
  169. package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js.map +1 -0
  170. package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js +35 -0
  171. package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js.map +1 -0
  172. package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js +42 -0
  173. package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js.map +1 -0
  174. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js +179 -0
  175. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js.map +1 -0
  176. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js +152 -0
  177. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js.map +1 -0
  178. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js +71 -0
  179. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js.map +1 -0
  180. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js +73 -0
  181. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js.map +1 -0
  182. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js +82 -0
  183. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js.map +1 -0
  184. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js +345 -0
  185. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js.map +1 -0
  186. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js +57 -0
  187. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js.map +1 -0
  188. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js +149 -0
  189. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js.map +1 -0
  190. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js +115 -0
  191. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js.map +1 -0
  192. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js +44 -0
  193. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js.map +1 -0
  194. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js +159 -0
  195. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js.map +1 -0
  196. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js +346 -0
  197. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js.map +1 -0
  198. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js +37 -0
  199. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js.map +1 -0
  200. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js +203 -0
  201. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js.map +1 -0
  202. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js +207 -0
  203. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js.map +1 -0
  204. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js +109 -0
  205. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js.map +1 -0
  206. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js +61 -0
  207. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js.map +1 -0
  208. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js +46 -0
  209. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js.map +1 -0
  210. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js +203 -0
  211. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js.map +1 -0
  212. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js +44 -0
  213. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js.map +1 -0
  214. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js +188 -0
  215. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js.map +1 -0
  216. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js +54 -0
  217. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js.map +1 -0
  218. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js +25 -0
  219. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js.map +1 -0
  220. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js +2 -0
  221. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js.map +1 -0
  222. package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js +7 -0
  223. package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js.map +1 -0
  224. package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js +129 -0
  225. package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js.map +1 -0
  226. package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js +277 -0
  227. package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js.map +1 -0
  228. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js +183 -0
  229. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js.map +1 -0
  230. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js +2 -0
  231. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js.map +1 -0
  232. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js +121 -0
  233. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js.map +1 -0
  234. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js +16 -0
  235. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js.map +1 -0
  236. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js +72 -0
  237. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js.map +1 -0
  238. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js +59 -0
  239. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js.map +1 -0
  240. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js +125 -0
  241. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js.map +1 -0
  242. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js +129 -0
  243. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js.map +1 -0
  244. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js +31 -0
  245. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js.map +1 -0
  246. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js +49 -0
  247. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js.map +1 -0
  248. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js +30 -0
  249. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js.map +1 -0
  250. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js +12 -0
  251. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js.map +1 -0
  252. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js +18 -0
  253. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js.map +1 -0
  254. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js +125 -0
  255. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js.map +1 -0
  256. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js +37 -0
  257. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js.map +1 -0
  258. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js +44 -0
  259. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js.map +1 -0
  260. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js +58 -0
  261. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js.map +1 -0
  262. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js +118 -0
  263. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js.map +1 -0
  264. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js +277 -0
  265. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js.map +1 -0
  266. package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js +132 -0
  267. package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js.map +1 -0
  268. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js +372 -0
  269. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js.map +1 -0
  270. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js +210 -0
  271. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js.map +1 -0
  272. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js +278 -0
  273. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js.map +1 -0
  274. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js +192 -0
  275. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js.map +1 -0
  276. package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js +114 -0
  277. package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js.map +1 -0
  278. package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js +65 -0
  279. package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js.map +1 -0
  280. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js +145 -0
  281. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js.map +1 -0
  282. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js +218 -0
  283. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js.map +1 -0
  284. package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js +71 -0
  285. package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js.map +1 -0
  286. package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js +298 -0
  287. package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js.map +1 -0
  288. package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js +121 -0
  289. package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js.map +1 -0
  290. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js +69 -0
  291. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js.map +1 -0
  292. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js +49 -0
  293. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js.map +1 -0
  294. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js +424 -0
  295. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js.map +1 -0
  296. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js +10 -0
  297. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js.map +1 -0
  298. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/001_initial.sql +319 -0
  299. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/002_staged_latest_values.sql +8 -0
  300. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/003_remove_cli_editing_lease.sql +21 -0
  301. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/004_hosted_association.sql +7 -0
  302. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/005_artifact_properties.sql +68 -0
  303. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js +12 -0
  304. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js.map +1 -0
  305. package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js +410 -0
  306. package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js.map +1 -0
  307. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js +77 -0
  308. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js.map +1 -0
  309. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js +240 -0
  310. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js.map +1 -0
  311. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js +127 -0
  312. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js.map +1 -0
  313. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js +107 -0
  314. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js.map +1 -0
  315. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js +80 -0
  316. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js.map +1 -0
  317. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js +219 -0
  318. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js.map +1 -0
  319. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js +164 -0
  320. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js.map +1 -0
  321. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js +20 -0
  322. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js.map +1 -0
  323. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js +41 -0
  324. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js.map +1 -0
  325. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js +22 -0
  326. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js.map +1 -0
  327. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js +188 -0
  328. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js.map +1 -0
  329. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js +5 -0
  330. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js.map +1 -0
  331. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js +214 -0
  332. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js.map +1 -0
  333. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js +4 -0
  334. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js.map +1 -0
  335. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js +44 -0
  336. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js.map +1 -0
  337. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js +38 -0
  338. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js.map +1 -0
  339. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js +284 -0
  340. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js.map +1 -0
  341. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js +133 -0
  342. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js.map +1 -0
  343. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js +98 -0
  344. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js.map +1 -0
  345. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js +161 -0
  346. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js.map +1 -0
  347. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js +97 -0
  348. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js.map +1 -0
  349. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js +69 -0
  350. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js.map +1 -0
  351. package/src/runtime/vendor/flywheel-cli-dist/main.js +651 -376
  352. package/src/runtime/vendor/flywheel-cli-dist/main.js.map +1 -1
  353. package/src/runtime/vendor/flywheel-cli-dist/output/format.js +18 -11
  354. package/src/runtime/vendor/flywheel-cli-dist/output/format.js.map +1 -1
  355. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-arm64/node.napi.node +0 -0
  356. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-x64/node.napi.node +0 -0
  357. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.glibc.node +0 -0
  358. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.musl.node +0 -0
  359. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  360. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.musl.node +0 -0
  361. package/src/runtime/vendor/manifest.json +252 -254
  362. package/src/setup/command.mjs +5 -0
  363. package/src/setup/io/patchers/json.mjs +1 -1
  364. package/src/setup/io/patchers/toml.mjs +3 -1
  365. package/src/setup/io/patchers/yaml.mjs +1 -1
  366. package/src/setup/modes/cli.mjs +76 -7
  367. package/src/setup/modes/mcp-command.mjs +802 -793
  368. package/src/setup/modes/mcp.mjs +7 -3
  369. package/src/setup/shared/prior-mode-detect.mjs +18 -21
  370. package/src/setup/test-seams.mjs +25 -0
  371. package/src/setup-auth.mjs +76 -10
  372. package/src/toml-lines.mjs +52 -0
  373. package/src/unified-cli.mjs +31 -16
  374. package/skills/flywheel-llm-proof-paper/scripts/__pycache__/check_paper.cpython-312.pyc +0 -0
  375. package/src/runtime/vendor/flywheel-cli-dist/auth/active-key-id.d.ts +0 -1
  376. package/src/runtime/vendor/flywheel-cli-dist/auth/baseurl.d.ts +0 -35
  377. package/src/runtime/vendor/flywheel-cli-dist/auth/config.d.ts +0 -34
  378. package/src/runtime/vendor/flywheel-cli-dist/auth/config.js +0 -92
  379. package/src/runtime/vendor/flywheel-cli-dist/auth/config.js.map +0 -1
  380. package/src/runtime/vendor/flywheel-cli-dist/auth/fingerprint.d.ts +0 -5
  381. package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.d.ts +0 -4
  382. package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js +0 -31
  383. package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js.map +0 -1
  384. package/src/runtime/vendor/flywheel-cli-dist/auth/login.d.ts +0 -24
  385. package/src/runtime/vendor/flywheel-cli-dist/auth/profile.d.ts +0 -15
  386. package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js +0 -150
  387. package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js.map +0 -1
  388. package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.d.ts +0 -27
  389. package/src/runtime/vendor/flywheel-cli-dist/commands/_admin-auth.d.ts +0 -27
  390. package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.d.ts +0 -32
  391. package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js +0 -213
  392. package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js.map +0 -1
  393. package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.d.ts +0 -21
  394. package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.d.ts +0 -2
  395. package/src/runtime/vendor/flywheel-cli-dist/commands/_secret-param.d.ts +0 -7
  396. package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-file-out.d.ts +0 -39
  397. package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-writer.d.ts +0 -34
  398. package/src/runtime/vendor/flywheel-cli-dist/commands/_wait-polling.d.ts +0 -50
  399. package/src/runtime/vendor/flywheel-cli-dist/commands/account-detach.d.ts +0 -2
  400. package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-add.d.ts +0 -2
  401. package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-remove.d.ts +0 -2
  402. package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-set-primary.d.ts +0 -2
  403. package/src/runtime/vendor/flywheel-cli-dist/commands/account-get.d.ts +0 -2
  404. package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-preview.d.ts +0 -2
  405. package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-proof.d.ts +0 -2
  406. package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge.d.ts +0 -2
  407. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-get.d.ts +0 -2
  408. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-set.d.ts +0 -2
  409. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export-stream.d.ts +0 -2
  410. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export.d.ts +0 -2
  411. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-list.d.ts +0 -4
  412. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-nodes-audit-list.d.ts +0 -2
  413. package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.d.ts +0 -13
  414. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-create.d.ts +0 -2
  415. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-delete.d.ts +0 -2
  416. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-list.d.ts +0 -18
  417. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-rotate.d.ts +0 -2
  418. package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-expire.d.ts +0 -2
  419. package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-heartbeat.d.ts +0 -2
  420. package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-list.d.ts +0 -2
  421. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.d.ts +0 -2
  422. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js +0 -22
  423. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js.map +0 -1
  424. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.d.ts +0 -2
  425. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js +0 -8
  426. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js.map +0 -1
  427. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-get.d.ts +0 -2
  428. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-list.d.ts +0 -2
  429. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.d.ts +0 -2
  430. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js +0 -9
  431. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js.map +0 -1
  432. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.d.ts +0 -2
  433. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js +0 -7
  434. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js.map +0 -1
  435. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.d.ts +0 -2
  436. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js +0 -15
  437. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js.map +0 -1
  438. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.d.ts +0 -2
  439. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js +0 -5
  440. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js.map +0 -1
  441. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.d.ts +0 -2
  442. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js +0 -8
  443. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js.map +0 -1
  444. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.d.ts +0 -2
  445. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js +0 -30
  446. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js.map +0 -1
  447. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.d.ts +0 -2
  448. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-mode.d.ts +0 -4
  449. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.d.ts +0 -2
  450. package/src/runtime/vendor/flywheel-cli-dist/commands/blobs-get.d.ts +0 -2
  451. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-create.d.ts +0 -2
  452. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-list.d.ts +0 -1
  453. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-revoke.d.ts +0 -1
  454. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-update.d.ts +0 -2
  455. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-snapshot.d.ts +0 -1
  456. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-acquire.d.ts +0 -2
  457. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-budgets.d.ts +0 -2
  458. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-connection.d.ts +0 -2
  459. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-funding.d.ts +0 -2
  460. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-list.d.ts +0 -2
  461. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-request-approval.d.ts +0 -2
  462. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-options.d.ts +0 -2
  463. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release-all.d.ts +0 -2
  464. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release.d.ts +0 -2
  465. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-status.d.ts +0 -2
  466. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-balance.d.ts +0 -1
  467. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-billing-portal.d.ts +0 -2
  468. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-purchase.d.ts +0 -2
  469. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral-claim.d.ts +0 -2
  470. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral.d.ts +0 -1
  471. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscribe.d.ts +0 -2
  472. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscription.d.ts +0 -1
  473. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-transactions.d.ts +0 -2
  474. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-usage.d.ts +0 -2
  475. package/src/runtime/vendor/flywheel-cli-dist/commands/destructive-confirmation.d.ts +0 -2
  476. package/src/runtime/vendor/flywheel-cli-dist/commands/enums.d.ts +0 -22
  477. package/src/runtime/vendor/flywheel-cli-dist/commands/env.d.ts +0 -8
  478. package/src/runtime/vendor/flywheel-cli-dist/commands/executions-launch.d.ts +0 -2
  479. package/src/runtime/vendor/flywheel-cli-dist/commands/executions-list.d.ts +0 -1
  480. package/src/runtime/vendor/flywheel-cli-dist/commands/executions-terminate.d.ts +0 -2
  481. package/src/runtime/vendor/flywheel-cli-dist/commands/export-history.d.ts +0 -2
  482. package/src/runtime/vendor/flywheel-cli-dist/commands/export-subgraph.d.ts +0 -2
  483. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-pdf.d.ts +0 -2
  484. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-render-pdf.d.ts +0 -2
  485. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-stream.d.ts +0 -2
  486. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary.d.ts +0 -2
  487. package/src/runtime/vendor/flywheel-cli-dist/commands/feedback-create.d.ts +0 -2
  488. package/src/runtime/vendor/flywheel-cli-dist/commands/files-list.d.ts +0 -2
  489. package/src/runtime/vendor/flywheel-cli-dist/commands/github-disconnect.d.ts +0 -1
  490. package/src/runtime/vendor/flywheel-cli-dist/commands/github-link.d.ts +0 -2
  491. package/src/runtime/vendor/flywheel-cli-dist/commands/github-refresh-repos.d.ts +0 -1
  492. package/src/runtime/vendor/flywheel-cli-dist/commands/github-status.d.ts +0 -1
  493. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-get.d.ts +0 -2
  494. package/src/runtime/vendor/flywheel-cli-dist/commands/handler-factory.d.ts +0 -22
  495. package/src/runtime/vendor/flywheel-cli-dist/commands/help-format.d.ts +0 -31
  496. package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.d.ts +0 -36
  497. package/src/runtime/vendor/flywheel-cli-dist/commands/help.d.ts +0 -17
  498. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-create.d.ts +0 -2
  499. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-delete.d.ts +0 -1
  500. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-list.d.ts +0 -2
  501. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-runs-list.d.ts +0 -2
  502. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-create.d.ts +0 -2
  503. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-delete.d.ts +0 -1
  504. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-list.d.ts +0 -1
  505. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-update.d.ts +0 -2
  506. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-set-enabled.d.ts +0 -2
  507. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-update.d.ts +0 -2
  508. package/src/runtime/vendor/flywheel-cli-dist/commands/import-subgraph.d.ts +0 -2
  509. package/src/runtime/vendor/flywheel-cli-dist/commands/index.d.ts +0 -23
  510. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-remove.d.ts +0 -1
  511. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-set.d.ts +0 -2
  512. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-status.d.ts +0 -1
  513. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-remove.d.ts +0 -1
  514. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-set.d.ts +0 -2
  515. package/src/runtime/vendor/flywheel-cli-dist/commands/machines-list.d.ts +0 -1
  516. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.d.ts +0 -2
  517. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js +0 -15
  518. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js.map +0 -1
  519. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.d.ts +0 -2
  520. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js +0 -10
  521. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js.map +0 -1
  522. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.d.ts +0 -2
  523. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js +0 -8
  524. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js.map +0 -1
  525. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.d.ts +0 -2
  526. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js +0 -6
  527. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js.map +0 -1
  528. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.d.ts +0 -2
  529. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js +0 -7
  530. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js.map +0 -1
  531. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.d.ts +0 -2
  532. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js +0 -6
  533. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js.map +0 -1
  534. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.d.ts +0 -2
  535. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js +0 -16
  536. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js.map +0 -1
  537. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.d.ts +0 -2
  538. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js +0 -11
  539. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js.map +0 -1
  540. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-files.d.ts +0 -1
  541. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-get.d.ts +0 -2
  542. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-list.d.ts +0 -2
  543. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.d.ts +0 -2
  544. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js +0 -33
  545. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js.map +0 -1
  546. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.d.ts +0 -2
  547. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js +0 -8
  548. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js.map +0 -1
  549. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.d.ts +0 -2
  550. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js +0 -15
  551. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js.map +0 -1
  552. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-ancestry.d.ts +0 -2
  553. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-summary.d.ts +0 -2
  554. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-tree.d.ts +0 -2
  555. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-resolve-slug.d.ts +0 -2
  556. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-get.d.ts +0 -1
  557. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set-bulk.d.ts +0 -2
  558. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set.d.ts +0 -2
  559. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-summaries.d.ts +0 -2
  560. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-acquire.d.ts +0 -2
  561. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-heartbeat.d.ts +0 -2
  562. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-release.d.ts +0 -2
  563. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.d.ts +0 -2
  564. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.d.ts +0 -2
  565. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.d.ts +0 -2
  566. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.d.ts +0 -2
  567. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/account.d.ts +0 -2
  568. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.d.ts +0 -8
  569. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/api-keys.d.ts +0 -2
  570. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/approval.d.ts +0 -2
  571. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.d.ts +0 -2
  572. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js +0 -140
  573. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js.map +0 -1
  574. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.d.ts +0 -2
  575. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/budgets.d.ts +0 -2
  576. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/compute.d.ts +0 -2
  577. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/credits.d.ts +0 -2
  578. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/env.d.ts +0 -2
  579. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/executions.d.ts +0 -2
  580. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/export.d.ts +0 -2
  581. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/github.d.ts +0 -2
  582. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/graph.d.ts +0 -2
  583. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hooks.d.ts +0 -2
  584. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/integrations.d.ts +0 -2
  585. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.d.ts +0 -2
  586. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.d.ts +0 -2
  587. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/resources.d.ts +0 -2
  588. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/sharing.d.ts +0 -2
  589. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.d.ts +0 -2
  590. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js +0 -98
  591. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js.map +0 -1
  592. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/updates.d.ts +0 -2
  593. package/src/runtime/vendor/flywheel-cli-dist/commands/registry.d.ts +0 -27
  594. package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-refresh.d.ts +0 -2
  595. package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-resolve.d.ts +0 -2
  596. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.d.ts +0 -2
  597. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js +0 -25
  598. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js.map +0 -1
  599. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.d.ts +0 -2
  600. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js +0 -25
  601. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js.map +0 -1
  602. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.d.ts +0 -2
  603. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js +0 -11
  604. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js.map +0 -1
  605. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.d.ts +0 -2
  606. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js +0 -28
  607. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js.map +0 -1
  608. package/src/runtime/vendor/flywheel-cli-dist/commands/types.d.ts +0 -30
  609. package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide-all-active.d.ts +0 -1
  610. package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide.d.ts +0 -2
  611. package/src/runtime/vendor/flywheel-cli-dist/commands/updates-list.d.ts +0 -2
  612. package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.d.ts +0 -6
  613. package/src/runtime/vendor/flywheel-cli-dist/commands/utils.d.ts +0 -11
  614. package/src/runtime/vendor/flywheel-cli-dist/errors.d.ts +0 -86
  615. package/src/runtime/vendor/flywheel-cli-dist/exit-codes.d.ts +0 -8
  616. package/src/runtime/vendor/flywheel-cli-dist/generatedFeedbackContract.d.ts +0 -41
  617. package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.d.ts +0 -13
  618. package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.d.ts +0 -26
  619. package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.d.ts +0 -17
  620. package/src/runtime/vendor/flywheel-cli-dist/http/client.d.ts +0 -91
  621. package/src/runtime/vendor/flywheel-cli-dist/http/debug.d.ts +0 -5
  622. package/src/runtime/vendor/flywheel-cli-dist/http/poll.d.ts +0 -18
  623. package/src/runtime/vendor/flywheel-cli-dist/http/retry.d.ts +0 -30
  624. package/src/runtime/vendor/flywheel-cli-dist/main.d.ts +0 -33
  625. package/src/runtime/vendor/flywheel-cli-dist/output/format.d.ts +0 -9
  626. package/src/runtime/vendor/flywheel-cli-dist/runtime-entry.d.ts +0 -1
  627. package/src/runtime/vendor/flywheel-cli-dist/version.d.ts +0 -3
  628. package/src/secure-write.mjs +0 -43
@@ -5,345 +5,345 @@ import { rm } from "node:fs/promises";
5
5
  import path from "node:path";
6
6
 
7
7
  import {
8
- ALL_HOST_NAMES,
9
- SERVER_NAME,
10
- detectHosts,
11
- getHost,
12
- isSkillOnlyHost,
13
- normalizeHosts,
8
+ ALL_HOST_NAMES,
9
+ SERVER_NAME,
10
+ detectHosts,
11
+ getHost,
12
+ isSkillOnlyHost,
13
+ normalizeHosts,
14
14
  } from "../../agents.mjs";
15
15
  import {
16
- readEntryServerUrl,
17
- readNamedConfigEntry,
18
- readJsonConfig,
19
- readTomlServerEntry,
20
- readYamlConfig,
21
- resolveMcpPath,
16
+ readEntryServerUrl,
17
+ readNamedConfigEntry,
18
+ readJsonConfig,
19
+ readTomlServerEntry,
20
+ readYamlConfig,
21
+ resolveMcpPath,
22
22
  } from "../../mcp-writer.mjs";
23
23
  import { resolveSetupApiKey } from "../../setup-auth.mjs";
24
24
  import {
25
- cleanupInstalledSkillArtifactsForHosts,
26
- formatSupportedInstallSkillHosts,
27
- inspectInstalledSkillArtifactsForHosts,
28
- installBundledSkillForHosts,
29
- isDirectCopySkillHost,
30
- listBundledSkills,
31
- partitionInstallSkillHosts,
32
- resolveInstalledSkillDir,
33
- resolvePackageRoot,
34
- resolveSkillsAgentName,
25
+ cleanupInstalledSkillArtifactsForHosts,
26
+ formatSupportedInstallSkillHosts,
27
+ inspectInstalledSkillArtifactsForHosts,
28
+ installBundledSkillForHosts,
29
+ isDirectCopySkillHost,
30
+ listBundledSkills,
31
+ partitionInstallSkillHosts,
32
+ resolveInstalledSkillDir,
33
+ resolvePackageRoot,
34
+ resolveSkillsAgentName,
35
35
  } from "../../skill-installer.mjs";
36
36
  import { runMcpSetupMode } from "./mcp.mjs";
37
37
  import { SetupModeUsageError } from "../mode.mjs";
38
38
  import { recordResolvedHosts } from "../resolved-selection-record.mjs";
39
39
  import {
40
- detectPriorModeForSetup,
41
- formatPriorModeConflictError,
40
+ detectPriorModeForSetup,
41
+ formatPriorModeConflictError,
42
42
  } from "../shared/prior-mode-detect.mjs";
43
43
  import { renderSetupSummary } from "../shared/summary.mjs";
44
44
  import { resolveSetupBaseUrl } from "../base-url.mjs";
45
45
 
46
46
  const NON_INTERACTIVE_SKILL_DECISION_ERROR =
47
- "Non-interactive setup requires one of --install-skill or --skip-skill.";
47
+ "Non-interactive setup requires one of --install-skill or --skip-skill.";
48
48
  const MUTUALLY_EXCLUSIVE_SKILL_FLAGS_ERROR =
49
- "--install-skill and --skip-skill cannot be used together.";
49
+ "--install-skill and --skip-skill cannot be used together.";
50
50
  const GUIDED_SKILL_DECISION_TEST_ENV =
51
- "FLYWHEEL_GUIDED_SKILL_DECISION_FOR_TESTS";
51
+ "FLYWHEEL_GUIDED_SKILL_DECISION_FOR_TESTS";
52
52
  const ENABLE_TEST_SEAMS_ENV = "FLYWHEEL_ENABLE_TEST_SEAMS";
53
53
 
54
54
  const log = {
55
- info: (message) => console.log(pc.cyan(message)),
56
- warn: (message) => console.log(pc.yellow(`⚠ ${message}`)),
57
- error: (message) => console.log(pc.red(`✖ ${message}`)),
58
- plain: (message) => console.log(message),
59
- blank: () => console.log(""),
55
+ info: (message) => console.log(pc.cyan(message)),
56
+ warn: (message) => console.log(pc.yellow(`⚠ ${message}`)),
57
+ error: (message) => console.log(pc.red(`✖ ${message}`)),
58
+ plain: (message) => console.log(message),
59
+ blank: () => console.log(""),
60
60
  };
61
61
 
62
62
  const CHECKBOX_THEME = {
63
- style: {
64
- highlight: (text) => pc.green(text),
65
- disabledChoice: (text) => ` ${pc.dim("◯")} ${pc.dim(text)}`,
66
- },
63
+ style: {
64
+ highlight: (text) => pc.green(text),
65
+ disabledChoice: (text) => ` ${pc.dim("◯")} ${pc.dim(text)}`,
66
+ },
67
67
  };
68
68
 
69
69
  function hostChoiceDescription({ detected = false, configured = false } = {}) {
70
- if (configured) return "Already has a Flywheel entry for this scope.";
71
- if (detected) return "Detected on this machine.";
72
- return "Supported host; select it if you use it here.";
70
+ if (configured) return "Already has a Flywheel entry for this scope.";
71
+ if (detected) return "Detected on this machine.";
72
+ return "Supported host; select it if you use it here.";
73
73
  }
74
74
 
75
75
  function normalizeBaseUrl(value) {
76
- const normalized = String(value || "").trim();
77
- let parsedUrl;
78
- try {
79
- parsedUrl = new URL(normalized);
80
- } catch {
81
- throw new Error("Base URL must be a valid absolute URL.");
82
- }
83
-
84
- if (parsedUrl.pathname !== "/" || parsedUrl.search || parsedUrl.hash) {
85
- throw new Error(
86
- "Base URL must be a public Flywheel origin without a path, query, or hash.",
87
- );
88
- }
76
+ const normalized = String(value || "").trim();
77
+ let parsedUrl;
78
+ try {
79
+ parsedUrl = new URL(normalized);
80
+ } catch {
81
+ throw new Error("Base URL must be a valid absolute URL.");
82
+ }
83
+
84
+ if (parsedUrl.pathname !== "/" || parsedUrl.search || parsedUrl.hash) {
85
+ throw new Error(
86
+ "Base URL must be a public Flywheel origin without a path, query, or hash.",
87
+ );
88
+ }
89
89
 
90
- return parsedUrl.origin;
90
+ return parsedUrl.origin;
91
91
  }
92
92
 
93
93
  function normalizeServerName(value) {
94
- const normalized = String(value || "").trim();
95
- if (!normalized) {
96
- throw new Error("Server name cannot be empty.");
97
- }
98
- return normalized;
94
+ const normalized = String(value || "").trim();
95
+ if (!normalized) {
96
+ throw new Error("Server name cannot be empty.");
97
+ }
98
+ return normalized;
99
99
  }
100
100
 
101
101
  function selectedHostsFromOptions(options) {
102
- const hosts = [];
103
- if (options.claude) hosts.push("claude");
104
- if (options.cursor) hosts.push("cursor");
105
- if (options.universal) hosts.push("universal");
106
- if (options.antigravity) hosts.push("antigravity");
107
- if (options.opencode) hosts.push("opencode");
108
- if (options.codex) hosts.push("codex");
109
- if (options.gemini) hosts.push("gemini");
110
- if (options.piMono) hosts.push("pi-mono");
111
- if (options.hermesAgent) hosts.push("hermes-agent");
112
- if (options.openclaw) hosts.push("openclaw");
113
- return hosts;
102
+ const hosts = [];
103
+ if (options.claude) hosts.push("claude");
104
+ if (options.cursor) hosts.push("cursor");
105
+ if (options.universal) hosts.push("universal");
106
+ if (options.antigravity) hosts.push("antigravity");
107
+ if (options.opencode) hosts.push("opencode");
108
+ if (options.codex) hosts.push("codex");
109
+ if (options.gemini) hosts.push("gemini");
110
+ if (options.piMono) hosts.push("pi-mono");
111
+ if (options.hermesAgent) hosts.push("hermes-agent");
112
+ if (options.openclaw) hosts.push("openclaw");
113
+ return hosts;
114
114
  }
115
115
 
116
116
  function mcpCandidatesForScope(host, scope) {
117
- if (scope === "global") return host.mcp.globalPaths;
118
- return host.mcp.projectPaths.map((candidate) =>
119
- path.join(process.cwd(), candidate),
120
- );
117
+ if (scope === "global") return host.mcp.globalPaths;
118
+ return host.mcp.projectPaths.map((candidate) =>
119
+ path.join(process.cwd(), candidate),
120
+ );
121
121
  }
122
122
 
123
123
  async function readExistingServerState(hostName, scope, serverName) {
124
- const host = getHost(hostName);
125
- if (isSkillOnlyHost(host)) {
126
- return { exists: false, url: null, mcpPath: null };
127
- }
128
- const mcpPath = await resolveMcpPath(mcpCandidatesForScope(host, scope));
129
-
130
- if (host.mcp.configType === "toml") {
131
- const { exists, url } = await readTomlServerEntry(mcpPath, serverName);
132
- return { exists, url, mcpPath };
133
- }
134
-
135
- const existing =
136
- host.mcp.configType === "yaml"
137
- ? await readYamlConfig(mcpPath)
138
- : await readJsonConfig(mcpPath);
139
- const entry = readNamedConfigEntry(existing, host.mcp.configKey, serverName);
140
- return {
141
- exists: entry !== null,
142
- url: readEntryServerUrl(entry),
143
- mcpPath,
144
- };
124
+ const host = getHost(hostName);
125
+ if (isSkillOnlyHost(host)) {
126
+ return { exists: false, url: null, mcpPath: null };
127
+ }
128
+ const mcpPath = await resolveMcpPath(mcpCandidatesForScope(host, scope));
129
+
130
+ if (host.mcp.configType === "toml") {
131
+ const { exists, url } = await readTomlServerEntry(mcpPath, serverName);
132
+ return { exists, url, mcpPath };
133
+ }
134
+
135
+ const existing =
136
+ host.mcp.configType === "yaml"
137
+ ? await readYamlConfig(mcpPath)
138
+ : await readJsonConfig(mcpPath);
139
+ const entry = readNamedConfigEntry(existing, host.mcp.configKey, serverName);
140
+ return {
141
+ exists: entry !== null,
142
+ url: readEntryServerUrl(entry),
143
+ mcpPath,
144
+ };
145
145
  }
146
146
 
147
147
  async function isAlreadyConfigured(hostName, scope, serverName) {
148
- const existingState = await readExistingServerState(
149
- hostName,
150
- scope,
151
- serverName,
152
- );
153
- return existingState.exists;
148
+ const existingState = await readExistingServerState(
149
+ hostName,
150
+ scope,
151
+ serverName,
152
+ );
153
+ return existingState.exists;
154
154
  }
155
155
 
156
156
  async function inspectInstallSkillHosts({
157
- hostNames,
158
- scope,
159
- serverName,
160
- serverUrl,
157
+ hostNames,
158
+ scope,
159
+ serverName,
160
+ serverUrl,
161
161
  }) {
162
- const hostStates = new Map();
163
- const needsSetupHosts = [];
164
- const driftHosts = [];
165
-
166
- for (const hostName of hostNames) {
167
- const host = getHost(hostName);
168
- // Skill-only hosts (universal, antigravity) never write an MCP config, so
169
- // they are not candidates for "needs setup" / "drift" / "matching"
170
- // classification. Skipping them here is what keeps the auth-resolution
171
- // gate downstream accurate: without this branch they would land in
172
- // `needsSetupHosts` and force an API-key mint on `setup --mode mcp
173
- // --universal --skip-skill`, which is a pure no-op path that must stay
174
- // hermetic (no browser, no blocking prompt).
175
- if (isSkillOnlyHost(host)) {
176
- hostStates.set(hostName, {
177
- classification: "skill-only",
178
- mcpPath: null,
179
- });
180
- continue;
181
- }
182
- // eslint-disable-next-line no-await-in-loop
183
- const existingState = await readExistingServerState(
184
- hostName,
185
- scope,
186
- serverName,
187
- );
188
- if (!existingState.exists) {
189
- needsSetupHosts.push(hostName);
190
- hostStates.set(hostName, {
191
- classification: "needs-setup",
192
- mcpPath: existingState.mcpPath,
193
- });
194
- continue;
195
- }
162
+ const hostStates = new Map();
163
+ const needsSetupHosts = [];
164
+ const driftHosts = [];
196
165
 
197
- if (existingState.url === serverUrl) {
198
- hostStates.set(hostName, {
199
- classification: "matching",
200
- mcpPath: existingState.mcpPath,
201
- });
202
- continue;
203
- }
204
-
205
- driftHosts.push({
206
- hostName,
207
- mcpPath: existingState.mcpPath,
208
- existingUrl: existingState.url ?? "(missing URL)",
209
- });
210
- hostStates.set(hostName, {
211
- classification: "drift",
212
- mcpPath: existingState.mcpPath,
213
- });
166
+ for (const hostName of hostNames) {
167
+ const host = getHost(hostName);
168
+ // Skill-only hosts (universal, antigravity) never write an MCP config, so
169
+ // they are not candidates for "needs setup" / "drift" / "matching"
170
+ // classification. Skipping them here is what keeps the auth-resolution
171
+ // gate downstream accurate: without this branch they would land in
172
+ // `needsSetupHosts` and force an API-key mint on `setup --mode mcp
173
+ // --universal --skip-skill`, which is a pure no-op path that must stay
174
+ // hermetic (no browser, no blocking prompt).
175
+ if (isSkillOnlyHost(host)) {
176
+ hostStates.set(hostName, {
177
+ classification: "skill-only",
178
+ mcpPath: null,
179
+ });
180
+ continue;
214
181
  }
182
+ // eslint-disable-next-line no-await-in-loop
183
+ const existingState = await readExistingServerState(
184
+ hostName,
185
+ scope,
186
+ serverName,
187
+ );
188
+ if (!existingState.exists) {
189
+ needsSetupHosts.push(hostName);
190
+ hostStates.set(hostName, {
191
+ classification: "needs-setup",
192
+ mcpPath: existingState.mcpPath,
193
+ });
194
+ continue;
195
+ }
196
+
197
+ if (existingState.url === serverUrl) {
198
+ hostStates.set(hostName, {
199
+ classification: "matching",
200
+ mcpPath: existingState.mcpPath,
201
+ });
202
+ continue;
203
+ }
204
+
205
+ driftHosts.push({
206
+ hostName,
207
+ mcpPath: existingState.mcpPath,
208
+ existingUrl: existingState.url ?? "(missing URL)",
209
+ });
210
+ hostStates.set(hostName, {
211
+ classification: "drift",
212
+ mcpPath: existingState.mcpPath,
213
+ });
214
+ }
215
215
 
216
- return { hostStates, needsSetupHosts, driftHosts };
216
+ return { hostStates, needsSetupHosts, driftHosts };
217
217
  }
218
218
 
219
219
  function formatInstallSkillDriftError({
220
- hostName,
221
- scope,
222
- serverName,
223
- existingUrl,
224
- requestedUrl,
220
+ hostName,
221
+ scope,
222
+ serverName,
223
+ existingUrl,
224
+ requestedUrl,
225
225
  }) {
226
- const host = getHost(hostName);
227
- const scopeFlag = scope === "project" ? "--scope project" : "--scope global";
228
- return `Flywheel MCP entry '${serverName}' for ${host.displayName} already points to ${existingUrl}, not ${requestedUrl}. Run 'flywheel uninstall ${scopeFlag} --${hostName} --name ${serverName}' first or choose a different --name.`;
226
+ const host = getHost(hostName);
227
+ const scopeFlag = scope === "project" ? "--scope project" : "--scope global";
228
+ return `Flywheel MCP entry '${serverName}' for ${host.displayName} already points to ${existingUrl}, not ${requestedUrl}. Run 'flywheel uninstall ${scopeFlag} --${hostName} --name ${serverName}' first or choose a different --name.`;
229
229
  }
230
230
 
231
231
  function getGuidedSkillDecisionOverrideForTests() {
232
- const testSeamsEnabled =
233
- String(process.env[ENABLE_TEST_SEAMS_ENV] || "").trim() === "1";
234
- if (!testSeamsEnabled) {
235
- return "";
236
- }
237
-
238
- const normalizedGuidedDecisionOverride = String(
239
- process.env[GUIDED_SKILL_DECISION_TEST_ENV] || "",
240
- )
241
- .trim()
242
- .toLowerCase();
243
- if (normalizedGuidedDecisionOverride.length === 0) {
244
- return "";
245
- }
246
- if (
247
- normalizedGuidedDecisionOverride === "accept" ||
248
- normalizedGuidedDecisionOverride === "decline" ||
249
- normalizedGuidedDecisionOverride === "abort"
250
- ) {
251
- return normalizedGuidedDecisionOverride;
252
- }
253
-
254
- throw new Error(
255
- `${GUIDED_SKILL_DECISION_TEST_ENV} must be one of: accept, decline, abort`,
256
- );
232
+ const testSeamsEnabled =
233
+ String(process.env[ENABLE_TEST_SEAMS_ENV] || "").trim() === "1";
234
+ if (!testSeamsEnabled) {
235
+ return "";
236
+ }
237
+
238
+ const normalizedGuidedDecisionOverride = String(
239
+ process.env[GUIDED_SKILL_DECISION_TEST_ENV] || "",
240
+ )
241
+ .trim()
242
+ .toLowerCase();
243
+ if (normalizedGuidedDecisionOverride.length === 0) {
244
+ return "";
245
+ }
246
+ if (
247
+ normalizedGuidedDecisionOverride === "accept" ||
248
+ normalizedGuidedDecisionOverride === "decline" ||
249
+ normalizedGuidedDecisionOverride === "abort"
250
+ ) {
251
+ return normalizedGuidedDecisionOverride;
252
+ }
253
+
254
+ throw new Error(
255
+ `${GUIDED_SKILL_DECISION_TEST_ENV} must be one of: accept, decline, abort`,
256
+ );
257
257
  }
258
258
 
259
259
  async function promptHosts(scope, detected, serverName) {
260
- const choices = [];
261
- for (const hostName of ALL_HOST_NAMES) {
262
- // eslint-disable-next-line no-await-in-loop
263
- const configured = await isAlreadyConfigured(
264
- hostName,
265
- scope,
266
- serverName,
267
- ).catch(() => false);
268
- choices.push({
269
- name: getHost(hostName).displayName,
270
- value: hostName,
271
- short: getHost(hostName).displayName,
272
- description: hostChoiceDescription({
273
- detected: detected.includes(hostName),
274
- configured,
275
- }),
276
- checked: detected.includes(hostName),
277
- disabled: configured ? "(already configured)" : false,
278
- });
279
- }
280
-
281
- try {
282
- return await checkbox({
283
- message: "Which hosts do you want to set up?",
284
- choices,
285
- loop: false,
286
- theme: CHECKBOX_THEME,
287
- validate: (selected) =>
288
- selected.length > 0 || "Select at least one host.",
289
- });
290
- } catch {
291
- return null;
292
- }
260
+ const choices = [];
261
+ for (const hostName of ALL_HOST_NAMES) {
262
+ // eslint-disable-next-line no-await-in-loop
263
+ const configured = await isAlreadyConfigured(
264
+ hostName,
265
+ scope,
266
+ serverName,
267
+ ).catch(() => false);
268
+ choices.push({
269
+ name: getHost(hostName).displayName,
270
+ value: hostName,
271
+ short: getHost(hostName).displayName,
272
+ description: hostChoiceDescription({
273
+ detected: detected.includes(hostName),
274
+ configured,
275
+ }),
276
+ checked: detected.includes(hostName),
277
+ disabled: configured ? "(already configured)" : false,
278
+ });
279
+ }
280
+
281
+ try {
282
+ return await checkbox({
283
+ message: "Which hosts do you want to set up?",
284
+ choices,
285
+ loop: false,
286
+ theme: CHECKBOX_THEME,
287
+ validate: (selected) =>
288
+ selected.length > 0 || "Select at least one host.",
289
+ });
290
+ } catch {
291
+ return null;
292
+ }
293
293
  }
294
294
 
295
295
  async function resolveHosts(options, scope, serverName, allowPrompt = true) {
296
- const explicit = selectedHostsFromOptions(options);
297
- if (explicit.length > 0) return explicit;
298
-
299
- const detected = await detectHosts(scope);
300
- const promptDisabled =
301
- options.yes || process.stdout.isTTY !== true || !allowPrompt;
302
- if (detected.length > 0 && promptDisabled) {
303
- return detected;
304
- }
305
-
306
- if (promptDisabled) {
307
- log.warn(
308
- "No hosts were detected for prompt-free setup. Pass explicit host flags such as --codex.",
309
- );
310
- return [];
311
- }
312
-
313
- log.blank();
314
- const selected = await promptHosts(scope, detected, serverName);
315
- if (!selected) {
316
- log.warn("Setup cancelled");
317
- return [];
318
- }
319
- return selected;
296
+ const explicit = selectedHostsFromOptions(options);
297
+ if (explicit.length > 0) return explicit;
298
+
299
+ const detected = await detectHosts(scope);
300
+ const promptDisabled =
301
+ options.yes || process.stdout.isTTY !== true || !allowPrompt;
302
+ if (detected.length > 0 && promptDisabled) {
303
+ return detected;
304
+ }
305
+
306
+ if (promptDisabled) {
307
+ log.warn(
308
+ "No hosts were detected for prompt-free setup. Pass explicit host flags such as --codex.",
309
+ );
310
+ return [];
311
+ }
312
+
313
+ log.blank();
314
+ const selected = await promptHosts(scope, detected, serverName);
315
+ if (!selected) {
316
+ log.warn("Setup cancelled");
317
+ return [];
318
+ }
319
+ return selected;
320
320
  }
321
321
 
322
322
  async function resolveApiKey(options, baseUrl) {
323
- if (Object.hasOwn(options, "apiKey")) {
324
- const resolved = await resolveSetupApiKey({
325
- options,
326
- baseUrl,
327
- });
328
- return resolved.apiKey;
329
- }
330
-
331
- const spinner = ora("Configuring authentication...").start();
332
- try {
333
- const resolved = await resolveSetupApiKey({
334
- options,
335
- baseUrl,
336
- });
337
- spinner.succeed(`Authenticated (${resolved.authMode})`);
338
- return resolved.apiKey;
339
- } catch (error) {
340
- spinner.fail("Authentication failed");
341
- const message = error instanceof Error ? error.message : String(error);
342
- if (/cancelled/i.test(message)) {
343
- return null;
344
- }
345
- throw new Error(message);
346
- }
323
+ if (Object.hasOwn(options, "apiKey")) {
324
+ const resolved = await resolveSetupApiKey({
325
+ options,
326
+ baseUrl,
327
+ });
328
+ return resolved.apiKey;
329
+ }
330
+
331
+ const spinner = ora("Configuring authentication...").start();
332
+ try {
333
+ const resolved = await resolveSetupApiKey({
334
+ options,
335
+ baseUrl,
336
+ });
337
+ spinner.succeed(`Authenticated (${resolved.authMode})`);
338
+ return resolved.apiKey;
339
+ } catch (error) {
340
+ spinner.fail("Authentication failed");
341
+ const message = error instanceof Error ? error.message : String(error);
342
+ if (/cancelled/i.test(message)) {
343
+ return null;
344
+ }
345
+ throw new Error(message);
346
+ }
347
347
  }
348
348
 
349
349
  /**
@@ -366,593 +366,602 @@ async function resolveApiKey(options, baseUrl) {
366
366
  * a Bearer token into the host config.
367
367
  */
368
368
  function classifyAgentOutcome(agentResult, { oauthMode = false } = {}) {
369
- if (agentResult.success === false) {
370
- return "failed";
371
- }
372
- if (
373
- agentResult.success === null ||
374
- agentResult.status === "skipped" ||
375
- (Array.isArray(agentResult.skippedSteps) &&
376
- (agentResult.skippedSteps.includes("skill-only-host") ||
377
- agentResult.skippedSteps.includes("unsupported-host")))
378
- ) {
379
- return "skipped";
380
- }
381
- const alreadyConfigured =
382
- Array.isArray(agentResult.skippedSteps) &&
383
- agentResult.skippedSteps.includes("already-configured");
384
- if (alreadyConfigured) {
385
- return "already configured";
386
- }
387
- return oauthMode ? "configured (OAuth)" : "configured with API Key";
369
+ if (agentResult.success === false) {
370
+ return "failed";
371
+ }
372
+ if (
373
+ agentResult.success === null ||
374
+ agentResult.status === "skipped" ||
375
+ (Array.isArray(agentResult.skippedSteps) &&
376
+ (agentResult.skippedSteps.includes("skill-only-host") ||
377
+ agentResult.skippedSteps.includes("unsupported-host")))
378
+ ) {
379
+ return "skipped";
380
+ }
381
+ const alreadyConfigured =
382
+ Array.isArray(agentResult.skippedSteps) &&
383
+ agentResult.skippedSteps.includes("already-configured");
384
+ if (alreadyConfigured) {
385
+ return "already configured";
386
+ }
387
+ return oauthMode ? "configured (OAuth)" : "configured with API Key";
388
388
  }
389
389
 
390
390
  function buildSetupResultRows({
391
- selectedHosts,
392
- hostStates,
393
- setupResult,
394
- oauthMode = false,
391
+ selectedHosts,
392
+ hostStates,
393
+ setupResult,
394
+ oauthMode = false,
395
395
  }) {
396
- const byAgent = new Map(
397
- setupResult.agentResults.map((result) => [result.agent, result]),
398
- );
396
+ const byAgent = new Map(
397
+ setupResult.agentResults.map((result) => [result.agent, result]),
398
+ );
399
399
 
400
- return selectedHosts.map((hostName) => {
401
- const host = getHost(hostName);
402
- const agentResult = byAgent.get(hostName);
403
- if (!agentResult) {
404
- return {
405
- host: host.displayName,
406
- status: "unknown",
407
- filePath: hostStates.get(hostName)?.mcpPath || "(unknown)",
408
- };
409
- }
400
+ return selectedHosts.map((hostName) => {
401
+ const host = getHost(hostName);
402
+ const agentResult = byAgent.get(hostName);
403
+ if (!agentResult) {
404
+ return {
405
+ host: host.displayName,
406
+ status: "unknown",
407
+ filePath: hostStates.get(hostName)?.mcpPath || "(unknown)",
408
+ };
409
+ }
410
410
 
411
- const status = classifyAgentOutcome(agentResult, { oauthMode });
412
- return {
413
- host: host.displayName,
414
- status,
415
- filePath:
416
- agentResult.touchedFiles?.[0] ||
417
- hostStates.get(hostName)?.mcpPath ||
418
- "(unknown)",
419
- };
420
- });
411
+ const status = classifyAgentOutcome(agentResult, { oauthMode });
412
+ return {
413
+ host: host.displayName,
414
+ status,
415
+ filePath:
416
+ agentResult.touchedFiles?.[0] ||
417
+ hostStates.get(hostName)?.mcpPath ||
418
+ "(unknown)",
419
+ };
420
+ });
421
421
  }
422
422
 
423
423
  function printSetupResults(
424
- results,
425
- scope,
426
- serverUrl,
427
- { showSkillRefreshGuidance = false, experimentalSyncAgents = [] } = {},
424
+ results,
425
+ scope,
426
+ serverUrl,
427
+ { showSkillRefreshGuidance = false, experimentalSyncAgents = [] } = {},
428
428
  ) {
429
+ log.blank();
430
+ log.plain(pc.green("✔ Flywheel setup complete"));
431
+ log.blank();
432
+ log.plain(` Scope: ${pc.bold(scope)}`);
433
+ log.plain(` Server URL: ${pc.bold(serverUrl)}`);
434
+ for (const result of results) {
435
+ const icon = result.status.startsWith("configured")
436
+ ? pc.green("+")
437
+ : pc.dim("~");
438
+ log.plain(` ${pc.bold(result.host)}`);
439
+ log.plain(` ${icon} ${result.status}`);
440
+ log.plain(` ${pc.dim(result.filePath)}`);
441
+ }
442
+ if (showSkillRefreshGuidance) {
429
443
  log.blank();
430
- log.plain(pc.green(" Flywheel setup complete"));
431
- log.blank();
432
- log.plain(` Scope: ${pc.bold(scope)}`);
433
- log.plain(` Server URL: ${pc.bold(serverUrl)}`);
434
- for (const result of results) {
435
- const icon = result.status.startsWith("configured")
436
- ? pc.green("+")
437
- : pc.dim("~");
438
- log.plain(` ${pc.bold(result.host)}`);
439
- log.plain(` ${icon} ${result.status}`);
440
- log.plain(` ${pc.dim(result.filePath)}`);
441
- }
442
- if (showSkillRefreshGuidance) {
443
- log.blank();
444
- log.plain(" Bundled skill refresh guidance");
445
- log.plain(
446
- ` Preferred: ${pc.bold("npx --yes @paradigma-inc/flywheel@latest setup --mode mcp --install-skill --project")}`,
447
- );
444
+ log.plain(" Bundled skill refresh guidance");
445
+ log.plain(
446
+ ` Preferred: ${pc.bold("npx --yes @paradigma-inc/flywheel@latest setup --mode mcp --install-skill --project")}`,
447
+ );
448
+ log.plain(
449
+ ` ${pc.bold("npm install --save-dev @paradigma-inc/flywheel@latest")}`,
450
+ );
451
+ if (experimentalSyncAgents.length === 1) {
452
+ log.plain(" Optional path via skills experimental_sync:");
453
+ log.plain(
454
+ ` ${pc.bold(`npx skills experimental_sync --agent ${experimentalSyncAgents[0]} -y`)}`,
455
+ );
456
+ } else if (experimentalSyncAgents.length > 1) {
457
+ log.plain(
458
+ " Optional path via skills experimental_sync for selected hosts:",
459
+ );
460
+ for (const agentName of experimentalSyncAgents) {
448
461
  log.plain(
449
- ` ${pc.bold("npm install --save-dev @paradigma-inc/flywheel@latest")}`,
462
+ ` ${pc.bold(`npx skills experimental_sync --agent ${agentName} -y`)}`,
450
463
  );
451
- if (experimentalSyncAgents.length === 1) {
452
- log.plain(" Optional path via skills experimental_sync:");
453
- log.plain(
454
- ` ${pc.bold(`npx skills experimental_sync --agent ${experimentalSyncAgents[0]} -y`)}`,
455
- );
456
- } else if (experimentalSyncAgents.length > 1) {
457
- log.plain(
458
- " Optional path via skills experimental_sync for selected hosts:",
459
- );
460
- for (const agentName of experimentalSyncAgents) {
461
- log.plain(
462
- ` ${pc.bold(`npx skills experimental_sync --agent ${agentName} -y`)}`,
463
- );
464
- }
465
- }
464
+ }
466
465
  }
467
- log.blank();
466
+ }
467
+ log.blank();
468
468
  }
469
469
 
470
470
  function resolveExperimentalSyncAgentsForHosts(supportedHosts) {
471
- const agentNames = [];
472
- const seenAgentNames = new Set();
473
-
474
- for (const hostName of supportedHosts) {
475
- // Direct-copy hosts (gemini, universal, antigravity) bypass the `skills`
476
- // CLI entirely, so they have no agent name to sync with. Skip them from
477
- // the experimental_sync guidance block.
478
- if (isDirectCopySkillHost(hostName)) {
479
- continue;
480
- }
481
- const agentName = resolveSkillsAgentName(hostName);
482
- if (seenAgentNames.has(agentName)) {
483
- continue;
484
- }
485
- seenAgentNames.add(agentName);
486
- agentNames.push(agentName);
471
+ const agentNames = [];
472
+ const seenAgentNames = new Set();
473
+
474
+ for (const hostName of supportedHosts) {
475
+ // Direct-copy hosts (gemini, universal, antigravity) bypass the `skills`
476
+ // CLI entirely, so they have no agent name to sync with. Skip them from
477
+ // the experimental_sync guidance block.
478
+ if (isDirectCopySkillHost(hostName)) {
479
+ continue;
487
480
  }
481
+ const agentName = resolveSkillsAgentName(hostName);
482
+ if (seenAgentNames.has(agentName)) {
483
+ continue;
484
+ }
485
+ seenAgentNames.add(agentName);
486
+ agentNames.push(agentName);
487
+ }
488
488
 
489
- return agentNames;
489
+ return agentNames;
490
490
  }
491
491
 
492
492
  export function buildGuidedSkillInstallPrompt({
493
- unsupportedHosts,
494
- bundledSkillNames,
493
+ unsupportedHosts,
494
+ bundledSkillNames,
495
495
  }) {
496
- const usesPlural = bundledSkillNames.length > 1;
497
- if (unsupportedHosts.length > 0) {
498
- return usesPlural
499
- ? `Also install or refresh the bundled Flywheel skills for supported hosts? Unsupported hosts (${unsupportedHosts.join(", ")}) will remain MCP-only.`
500
- : `Also install or refresh the bundled Flywheel skill for supported hosts? Unsupported hosts (${unsupportedHosts.join(", ")}) will remain MCP-only.`;
501
- }
496
+ const usesPlural = bundledSkillNames.length > 1;
497
+ if (unsupportedHosts.length > 0) {
502
498
  return usesPlural
503
- ? "Also install or refresh the bundled Flywheel skills?"
504
- : "Also install or refresh the bundled Flywheel skill?";
499
+ ? `Also install or refresh the bundled Flywheel skills for supported hosts? Unsupported hosts (${unsupportedHosts.join(", ")}) will remain MCP-only.`
500
+ : `Also install or refresh the bundled Flywheel skill for supported hosts? Unsupported hosts (${unsupportedHosts.join(", ")}) will remain MCP-only.`;
501
+ }
502
+ return usesPlural
503
+ ? "Also install or refresh the bundled Flywheel skills?"
504
+ : "Also install or refresh the bundled Flywheel skill?";
505
505
  }
506
506
 
507
507
  async function promptGuidedSkillInstall(
508
- bundledSkillNames,
509
- unsupportedHosts,
510
- guidedSkillDecisionOverride,
508
+ bundledSkillNames,
509
+ unsupportedHosts,
510
+ guidedSkillDecisionOverride,
511
511
  ) {
512
- if (guidedSkillDecisionOverride === "accept") {
513
- return true;
514
- }
515
- if (
516
- guidedSkillDecisionOverride === "decline" ||
517
- guidedSkillDecisionOverride === "abort"
518
- ) {
519
- return false;
520
- }
512
+ if (guidedSkillDecisionOverride === "accept") {
513
+ return true;
514
+ }
515
+ if (
516
+ guidedSkillDecisionOverride === "decline" ||
517
+ guidedSkillDecisionOverride === "abort"
518
+ ) {
519
+ return false;
520
+ }
521
+
522
+ log.blank();
523
+ const message = buildGuidedSkillInstallPrompt({
524
+ unsupportedHosts,
525
+ bundledSkillNames,
526
+ });
521
527
 
522
- log.blank();
523
- const message = buildGuidedSkillInstallPrompt({
524
- unsupportedHosts,
525
- bundledSkillNames,
528
+ try {
529
+ return await confirm({
530
+ message,
531
+ default: true,
532
+ theme: CHECKBOX_THEME,
526
533
  });
527
-
528
- try {
529
- return await confirm({
530
- message,
531
- default: true,
532
- theme: CHECKBOX_THEME,
533
- });
534
- } catch {
535
- return false;
536
- }
534
+ } catch {
535
+ return false;
536
+ }
537
537
  }
538
538
 
539
539
  function logBundledSkillInstallPlan({
540
- bundledSkillNames,
541
- projectRoot,
542
- scope,
543
- supportedHosts,
540
+ bundledSkillNames,
541
+ projectRoot,
542
+ scope,
543
+ supportedHosts,
544
544
  }) {
545
- for (const hostName of supportedHosts) {
546
- const hostDisplayName = getHost(hostName).displayName;
547
- const resolvedSkillRoot = path.dirname(
548
- resolveInstalledSkillDir(
549
- projectRoot,
550
- hostName,
551
- scope,
552
- bundledSkillNames[0],
553
- ),
554
- );
555
- log.plain(
556
- `Installing bundled skills for ${hostDisplayName} (${scope}: ${resolvedSkillRoot}): ${bundledSkillNames.join(", ")}`,
557
- );
558
- }
545
+ for (const hostName of supportedHosts) {
546
+ const hostDisplayName = getHost(hostName).displayName;
547
+ const resolvedSkillRoot = path.dirname(
548
+ resolveInstalledSkillDir(
549
+ projectRoot,
550
+ hostName,
551
+ scope,
552
+ bundledSkillNames[0],
553
+ ),
554
+ );
555
+ log.plain(
556
+ `Installing bundled skills for ${hostDisplayName} (${scope}: ${resolvedSkillRoot}): ${bundledSkillNames.join(", ")}`,
557
+ );
558
+ }
559
559
  }
560
560
 
561
561
  function normalizeSkillDecisionMode(options) {
562
- if (options.installSkill && options.skipSkill) {
563
- throw new Error(MUTUALLY_EXCLUSIVE_SKILL_FLAGS_ERROR);
564
- }
565
- if (options.installSkill) return "install";
566
- if (options.skipSkill) return "skip";
567
- return "guided";
562
+ if (options.installSkill && options.skipSkill) {
563
+ throw new Error(MUTUALLY_EXCLUSIVE_SKILL_FLAGS_ERROR);
564
+ }
565
+ if (options.installSkill) return "install";
566
+ if (options.skipSkill) return "skip";
567
+ return "guided";
568
568
  }
569
569
 
570
570
  async function discardInstallSkillCleanupState(cleanupState) {
571
- if (!cleanupState?.backupRoot) {
572
- return null;
573
- }
574
- await rm(cleanupState.backupRoot, { force: true, recursive: true });
571
+ if (!cleanupState?.backupRoot) {
575
572
  return null;
573
+ }
574
+ await rm(cleanupState.backupRoot, { force: true, recursive: true });
575
+ return null;
576
576
  }
577
577
 
578
578
  function printSetupResultSummary(setupResult) {
579
- const lines = renderSetupSummary(setupResult);
580
- log.blank();
581
- for (const line of lines) {
582
- log.plain(` ${line}`);
583
- }
584
- log.blank();
579
+ const lines = renderSetupSummary(setupResult);
580
+ log.blank();
581
+ for (const line of lines) {
582
+ log.plain(` ${line}`);
583
+ }
584
+ log.blank();
585
585
  }
586
586
 
587
587
  export async function runMcpModeCommand(options, deps = {}) {
588
- const projectRoot = process.cwd();
589
- const skillDecisionMode = normalizeSkillDecisionMode(options);
590
- const guidedSkillDecisionOverride = getGuidedSkillDecisionOverrideForTests();
591
- const nonInteractive = process.stdout.isTTY !== true;
592
- const hasGuidedDecisionOverride = guidedSkillDecisionOverride.length > 0;
593
- if (
594
- nonInteractive &&
595
- skillDecisionMode === "guided" &&
596
- !hasGuidedDecisionOverride
597
- ) {
598
- throw new Error(NON_INTERACTIVE_SKILL_DECISION_ERROR);
599
- }
600
-
601
- const oauthMode = options.oauth === true;
602
- if (oauthMode && Object.hasOwn(options, "apiKey")) {
603
- throw new SetupModeUsageError(
604
- "--api-key and --oauth are mutually exclusive: choose one.",
588
+ const projectRoot = process.cwd();
589
+ const skillDecisionMode = normalizeSkillDecisionMode(options);
590
+ const guidedSkillDecisionOverride = getGuidedSkillDecisionOverrideForTests();
591
+ const nonInteractive = process.stdout.isTTY !== true;
592
+ const hasGuidedDecisionOverride = guidedSkillDecisionOverride.length > 0;
593
+ if (
594
+ nonInteractive &&
595
+ skillDecisionMode === "guided" &&
596
+ !hasGuidedDecisionOverride
597
+ ) {
598
+ throw new Error(NON_INTERACTIVE_SKILL_DECISION_ERROR);
599
+ }
600
+
601
+ const oauthMode = options.oauth === true;
602
+ if (oauthMode && (Object.hasOwn(options, "apiKey") || options.apiKeyStdin === true)) {
603
+ throw new SetupModeUsageError(
604
+ "--api-key and --oauth are mutually exclusive: choose one.",
605
+ );
606
+ }
607
+
608
+ const scope = options.project ? "project" : "global";
609
+ const baseUrl = normalizeBaseUrl(
610
+ resolveSetupBaseUrl({ explicitBaseUrl: options.baseUrl }),
611
+ );
612
+ const serverUrl = `${baseUrl}/mcp-server`;
613
+ const serverName = normalizeServerName(options.name || SERVER_NAME);
614
+ const resolveHostsForSetup =
615
+ deps.resolveHostsForSetup ||
616
+ (async ({
617
+ options: hostOptions,
618
+ scope: hostScope,
619
+ serverName: hostServerName,
620
+ allowPrompt,
621
+ }) =>
622
+ await resolveHosts(hostOptions, hostScope, hostServerName, allowPrompt));
623
+ const hosts = await resolveHostsForSetup({
624
+ options,
625
+ scope,
626
+ serverName,
627
+ // `--install-skill` is an explicit refresh request. Keep the advertised
628
+ // no-host update command prompt-free on detected hosts; `--skip-skill`
629
+ // remains guided unless host flags or --yes are provided.
630
+ allowPrompt: skillDecisionMode !== "install",
631
+ });
632
+ recordResolvedHosts(hosts);
633
+ if (options.apiKeyStdin === true &&
634
+ (scope !== "global" || hosts.length !== 1 || hosts[0] !== "codex")) {
635
+ throw new SetupModeUsageError(
636
+ "--api-key-stdin in MCP mode requires only Codex in the home directory. Use --codex without --project.",
637
+ );
638
+ }
639
+ const authResult = options.apiKeyStdin === true ? await deps.readStdinAuth() : undefined;
640
+ if (hosts.length === 0) {
641
+ return { exitCode: 0 };
642
+ }
643
+
644
+ const { supportedHosts, unsupportedHosts } =
645
+ partitionInstallSkillHosts(hosts);
646
+ const packageRoot = resolvePackageRoot();
647
+ const bundledSkillNames =
648
+ skillDecisionMode === "skip" || supportedHosts.length === 0
649
+ ? []
650
+ : await listBundledSkills(packageRoot);
651
+
652
+ if (skillDecisionMode === "install" && supportedHosts.length === 0) {
653
+ if (options.allowUnsupportedSkillInstall !== true) {
654
+ throw new Error(
655
+ `--install-skill is not supported for: ${unsupportedHosts.join(", ")}. Supported hosts: ${formatSupportedInstallSkillHosts()}.`,
656
+ );
657
+ }
658
+ log.plain(
659
+ `Bundled skill install skipped (unsupported-only host selection: ${unsupportedHosts.join(", ")}).`,
660
+ );
661
+ }
662
+ if (
663
+ skillDecisionMode !== "skip" &&
664
+ supportedHosts.length > 0 &&
665
+ bundledSkillNames.length === 0
666
+ ) {
667
+ throw new Error(
668
+ `No bundled skills found under ${path.join(packageRoot, "skills")}.`,
669
+ );
670
+ }
671
+
672
+ const {
673
+ hostStates = new Map(),
674
+ needsSetupHosts = [],
675
+ driftHosts = [],
676
+ } = await inspectInstallSkillHosts({
677
+ hostNames: hosts,
678
+ scope,
679
+ serverName,
680
+ serverUrl,
681
+ });
682
+
683
+ // Capture prior-mode state before any install/auth side effects so the
684
+ // detector does not classify artifacts created by this same command as
685
+ // pre-existing CLI-mode installs, and so a refuse or reconcile decision
686
+ // happens before we touch disk or start a browser auth flow. Running this
687
+ // inside runMcpSetupMode (the prior placement) meant --force would uninstall
688
+ // the freshly installed bundled skills, and the non-force path would still
689
+ // have run auth before surfacing the conflict.
690
+ const priorModeSnapshot = await detectPriorModeForSetup({
691
+ targetMode: "mcp",
692
+ selectedHosts: hosts,
693
+ scope,
694
+ cwd: projectRoot,
695
+ serverName,
696
+ serverUrl,
697
+ });
698
+ const reconciled = [];
699
+ if (
700
+ priorModeSnapshot.priorMode &&
701
+ priorModeSnapshot.affectedHosts.length > 0
702
+ ) {
703
+ if (deps.force !== true) {
704
+ throw new SetupModeUsageError(
705
+ formatPriorModeConflictError(priorModeSnapshot),
706
+ );
707
+ }
708
+ if (typeof deps.reconcilePriorMode !== "function") {
709
+ throw new Error(
710
+ "reconcilePriorMode dependency is required when --force is used.",
711
+ );
712
+ }
713
+ const reconcileEntries = Array.isArray(priorModeSnapshot.entries)
714
+ ? priorModeSnapshot.entries
715
+ : priorModeSnapshot.affectedHosts.map((hostName) => ({
716
+ hostName,
717
+ serverNames: [],
718
+ }));
719
+ for (const entry of reconcileEntries) {
720
+ try {
721
+ // eslint-disable-next-line no-await-in-loop
722
+ await deps.reconcilePriorMode({
723
+ priorMode: priorModeSnapshot.priorMode,
724
+ targetMode: "mcp",
725
+ hostNames: [entry.hostName],
726
+ serverNames: entry.serverNames,
727
+ scope,
728
+ cwd: projectRoot,
729
+ serverName,
730
+ serverUrl,
731
+ });
732
+ } catch (error) {
733
+ const message = error instanceof Error ? error.message : String(error);
734
+ const reconcileError = new Error(
735
+ `Failed to reconcile prior --mode ${priorModeSnapshot.priorMode} artifacts for host ${entry.hostName}: ${message}`,
605
736
  );
737
+ reconcileError.exitCode = 4;
738
+ throw reconcileError;
739
+ }
606
740
  }
607
-
608
- const scope = options.project ? "project" : "global";
609
- const baseUrl = normalizeBaseUrl(
610
- resolveSetupBaseUrl({ explicitBaseUrl: options.baseUrl }),
741
+ reconciled.push(
742
+ `removed prior --mode ${priorModeSnapshot.priorMode} artifacts for host(s): ${priorModeSnapshot.affectedHosts.join(", ")}`,
611
743
  );
612
- const serverUrl = `${baseUrl}/mcp-server`;
613
- const serverName = normalizeServerName(options.name || SERVER_NAME);
614
- const resolveHostsForSetup =
615
- deps.resolveHostsForSetup ||
616
- (async ({
617
- options: hostOptions,
618
- scope: hostScope,
619
- serverName: hostServerName,
620
- allowPrompt,
621
- }) =>
622
- await resolveHosts(hostOptions, hostScope, hostServerName, allowPrompt));
623
- const hosts = await resolveHostsForSetup({
624
- options,
625
- scope,
626
- serverName,
627
- // `--install-skill` is an explicit refresh request. Keep the advertised
628
- // no-host update command prompt-free on detected hosts; `--skip-skill`
629
- // remains guided unless host flags or --yes are provided.
630
- allowPrompt: skillDecisionMode !== "install",
631
- });
632
- recordResolvedHosts(hosts);
633
- if (hosts.length === 0) {
634
- return { exitCode: 0 };
635
- }
744
+ }
636
745
 
637
- const { supportedHosts, unsupportedHosts } =
638
- partitionInstallSkillHosts(hosts);
639
- const packageRoot = resolvePackageRoot();
640
- const bundledSkillNames =
641
- skillDecisionMode === "skip" || supportedHosts.length === 0
642
- ? []
643
- : await listBundledSkills(packageRoot);
644
-
645
- if (skillDecisionMode === "install" && supportedHosts.length === 0) {
646
- if (options.allowUnsupportedSkillInstall !== true) {
647
- throw new Error(
648
- `--install-skill is not supported for: ${unsupportedHosts.join(", ")}. Supported hosts: ${formatSupportedInstallSkillHosts()}.`,
649
- );
650
- }
651
- log.plain(
652
- `Bundled skill install skipped (unsupported-only host selection: ${unsupportedHosts.join(", ")}).`,
653
- );
654
- }
655
- if (
656
- skillDecisionMode !== "skip" &&
657
- supportedHosts.length > 0 &&
658
- bundledSkillNames.length === 0
659
- ) {
660
- throw new Error(
661
- `No bundled skills found under ${path.join(packageRoot, "skills")}.`,
662
- );
663
- }
746
+ const installDriftHosts = driftHosts;
664
747
 
665
- const {
666
- hostStates = new Map(),
667
- needsSetupHosts = [],
668
- driftHosts = [],
669
- } = await inspectInstallSkillHosts({
670
- hostNames: hosts,
748
+ if (skillDecisionMode === "install" && installDriftHosts.length > 0) {
749
+ throw new Error(
750
+ formatInstallSkillDriftError({
751
+ hostName: installDriftHosts[0].hostName,
671
752
  scope,
672
753
  serverName,
673
- serverUrl,
674
- });
754
+ existingUrl: installDriftHosts[0].existingUrl,
755
+ requestedUrl: serverUrl,
756
+ }),
757
+ );
758
+ }
675
759
 
676
- // Capture prior-mode state before any install/auth side effects so the
677
- // detector does not classify artifacts created by this same command as
678
- // pre-existing CLI-mode installs, and so a refuse or reconcile decision
679
- // happens before we touch disk or start a browser auth flow. Running this
680
- // inside runMcpSetupMode (the prior placement) meant --force would uninstall
681
- // the freshly installed bundled skills, and the non-force path would still
682
- // have run auth before surfacing the conflict.
683
- const priorModeSnapshot = await detectPriorModeForSetup({
684
- targetMode: "mcp",
685
- selectedHosts: hosts,
760
+ let cleanupState = null;
761
+ try {
762
+ if (skillDecisionMode === "install") {
763
+ logBundledSkillInstallPlan({
764
+ bundledSkillNames,
765
+ projectRoot,
766
+ scope,
767
+ supportedHosts,
768
+ });
769
+ cleanupState = await inspectInstalledSkillArtifactsForHosts({
770
+ projectRoot,
771
+ hostNames: supportedHosts,
772
+ scope,
773
+ skillNames: bundledSkillNames,
774
+ });
775
+ await installBundledSkillForHosts({
776
+ projectRoot,
777
+ hostNames: supportedHosts,
686
778
  scope,
687
- cwd: projectRoot,
688
779
  serverName,
689
780
  serverUrl,
690
- });
691
- const reconciled = [];
692
- if (
693
- priorModeSnapshot.priorMode &&
694
- priorModeSnapshot.affectedHosts.length > 0
695
- ) {
696
- if (deps.force !== true) {
697
- throw new SetupModeUsageError(
698
- formatPriorModeConflictError(priorModeSnapshot),
699
- );
700
- }
701
- if (typeof deps.reconcilePriorMode !== "function") {
702
- throw new Error(
703
- "reconcilePriorMode dependency is required when --force is used.",
704
- );
705
- }
706
- const reconcileEntries = Array.isArray(priorModeSnapshot.entries)
707
- ? priorModeSnapshot.entries
708
- : priorModeSnapshot.affectedHosts.map((hostName) => ({
709
- hostName,
710
- serverNames: [],
711
- }));
712
- for (const entry of reconcileEntries) {
713
- try {
714
- // eslint-disable-next-line no-await-in-loop
715
- await deps.reconcilePriorMode({
716
- priorMode: priorModeSnapshot.priorMode,
717
- targetMode: "mcp",
718
- hostNames: [entry.hostName],
719
- serverNames: entry.serverNames,
720
- scope,
721
- cwd: projectRoot,
722
- serverName,
723
- serverUrl,
724
- });
725
- } catch (error) {
726
- const message = error instanceof Error ? error.message : String(error);
727
- const reconcileError = new Error(
728
- `Failed to reconcile prior --mode ${priorModeSnapshot.priorMode} artifacts for host ${entry.hostName}: ${message}`,
729
- );
730
- reconcileError.exitCode = 4;
731
- throw reconcileError;
732
- }
733
- }
734
- reconciled.push(
735
- `removed prior --mode ${priorModeSnapshot.priorMode} artifacts for host(s): ${priorModeSnapshot.affectedHosts.join(", ")}`,
736
- );
737
- }
738
-
739
- const installDriftHosts = driftHosts;
740
-
741
- if (skillDecisionMode === "install" && installDriftHosts.length > 0) {
742
- throw new Error(
743
- formatInstallSkillDriftError({
744
- hostName: installDriftHosts[0].hostName,
745
- scope,
746
- serverName,
747
- existingUrl: installDriftHosts[0].existingUrl,
748
- requestedUrl: serverUrl,
749
- }),
781
+ skillNames: bundledSkillNames,
782
+ });
783
+ if (unsupportedHosts.length > 0) {
784
+ log.plain(
785
+ `--install-skill skipped unsupported hosts (MCP-only): ${unsupportedHosts.join(", ")}.`,
750
786
  );
787
+ }
751
788
  }
752
789
 
753
- let cleanupState = null;
754
- try {
755
- if (skillDecisionMode === "install") {
756
- logBundledSkillInstallPlan({
757
- bundledSkillNames,
758
- projectRoot,
759
- scope,
760
- supportedHosts,
761
- });
762
- cleanupState = await inspectInstalledSkillArtifactsForHosts({
763
- projectRoot,
764
- hostNames: supportedHosts,
765
- scope,
766
- skillNames: bundledSkillNames,
767
- });
768
- await installBundledSkillForHosts({
769
- projectRoot,
770
- hostNames: supportedHosts,
771
- scope,
772
- serverName,
773
- serverUrl,
774
- skillNames: bundledSkillNames,
775
- });
776
- if (unsupportedHosts.length > 0) {
777
- log.plain(
778
- `--install-skill skipped unsupported hosts (MCP-only): ${unsupportedHosts.join(", ")}.`,
779
- );
780
- }
781
- }
782
-
783
- let apiKey = null;
784
- const explicitApiKeyProvided = Object.hasOwn(options, "apiKey");
785
- const shouldResolveApiKey =
786
- !oauthMode && (needsSetupHosts.length > 0 || explicitApiKeyProvided);
787
- if (shouldResolveApiKey) {
788
- apiKey = await resolveApiKey(options, baseUrl);
789
- if (!apiKey) {
790
- if (cleanupState) {
791
- await cleanupInstalledSkillArtifactsForHosts({
792
- projectRoot,
793
- hostNames: supportedHosts,
794
- priorState: cleanupState,
795
- scope,
796
- skillNames: bundledSkillNames,
797
- });
798
- cleanupState = null;
799
- }
800
- log.warn("Setup cancelled");
801
- return { exitCode: 0 };
802
- }
803
- }
804
-
805
- const setupResult = await runMcpSetupMode({
806
- selectedHosts: hosts,
807
- scope,
808
- cwd: projectRoot,
809
- // Prior-mode enforcement already ran before install/auth (above); skip
810
- // the inner detector so a --force reconcile cannot re-uninstall the
811
- // skills this command just installed, and so the non-force conflict
812
- // path short-circuits before we reach this point.
813
- force: false,
814
- serverName,
815
- serverUrl,
816
- apiKey,
817
- // Tell the writers to reconcile auth-mode mismatches (Authorization
818
- // header added/removed) only when the user explicitly set `--oauth` or
819
- // `--api-key`. Without that, a passive rerun must stay idempotent and
820
- // preserve the existing bearer header on disk rather than stripping it.
821
- enforceAuthMode: oauthMode || explicitApiKeyProvided,
822
- detectPriorMode: async () => ({
823
- priorMode: null,
824
- affectedHosts: [],
825
- entries: [],
826
- }),
827
- reconcilePriorMode: deps.reconcilePriorMode,
828
- });
829
- if (reconciled.length > 0) {
830
- setupResult.reconciled = [
831
- ...(Array.isArray(setupResult.reconciled)
832
- ? setupResult.reconciled
833
- : []),
834
- ...reconciled,
835
- ];
836
- }
837
-
838
- if (setupResult.exitCode !== 0) {
839
- printSetupResultSummary(setupResult);
840
- const failureDetails = setupResult.agentResults
841
- .filter((result) => result.success !== true)
842
- .flatMap((result) =>
843
- Array.isArray(result.warnings) ? result.warnings : [],
844
- )
845
- .join(" | ");
846
- const error = new Error(
847
- failureDetails.length > 0
848
- ? `MCP setup encountered host-level failures: ${failureDetails}`
849
- : "MCP setup encountered host-level failures.",
850
- );
851
- error.exitCode = setupResult.exitCode;
852
- throw error;
853
- }
854
-
855
- const setupRows = buildSetupResultRows({
856
- selectedHosts: hosts,
857
- hostStates,
858
- setupResult,
859
- oauthMode,
860
- });
861
-
862
- if (skillDecisionMode !== "guided") {
863
- const completedCleanupState = cleanupState;
864
- cleanupState = null;
865
- await discardInstallSkillCleanupState(completedCleanupState);
866
- const showSkillRefreshGuidance =
867
- scope === "project" &&
868
- skillDecisionMode === "install" &&
869
- supportedHosts.length > 0;
870
- printSetupResults(setupRows, scope, serverUrl, {
871
- showSkillRefreshGuidance,
872
- experimentalSyncAgents: showSkillRefreshGuidance
873
- ? resolveExperimentalSyncAgentsForHosts(supportedHosts)
874
- : [],
875
- });
876
- return setupResult;
877
- }
878
-
879
- if (supportedHosts.length === 0) {
880
- log.plain(
881
- `Bundled skill installation is unavailable for the selected hosts (${hosts.join(", ")}). Continuing with MCP-only setup.`,
882
- );
883
- printSetupResults(setupRows, scope, serverUrl);
884
- return setupResult;
885
- }
886
-
887
- const shouldInstallSkill = await promptGuidedSkillInstall(
888
- bundledSkillNames,
889
- unsupportedHosts,
890
- guidedSkillDecisionOverride,
891
- );
892
- if (!shouldInstallSkill) {
893
- printSetupResults(setupRows, scope, serverUrl);
894
- return setupResult;
895
- }
896
-
897
- if (installDriftHosts.length > 0) {
898
- throw new Error(
899
- formatInstallSkillDriftError({
900
- hostName: installDriftHosts[0].hostName,
901
- scope,
902
- serverName,
903
- existingUrl: installDriftHosts[0].existingUrl,
904
- requestedUrl: serverUrl,
905
- }),
906
- );
907
- }
908
-
909
- logBundledSkillInstallPlan({
910
- bundledSkillNames,
911
- projectRoot,
912
- scope,
913
- supportedHosts,
914
- });
915
- cleanupState = await inspectInstalledSkillArtifactsForHosts({
916
- projectRoot,
917
- hostNames: supportedHosts,
918
- scope,
919
- skillNames: bundledSkillNames,
920
- });
921
- await installBundledSkillForHosts({
790
+ let apiKey = null;
791
+ const explicitApiKeyProvided = Object.hasOwn(options, "apiKey") || options.apiKeyStdin === true;
792
+ const shouldResolveApiKey =
793
+ !oauthMode && (needsSetupHosts.length > 0 || explicitApiKeyProvided);
794
+ if (shouldResolveApiKey) {
795
+ apiKey = authResult?.apiKey ?? await resolveApiKey(options, baseUrl);
796
+ if (!apiKey) {
797
+ if (cleanupState) {
798
+ await cleanupInstalledSkillArtifactsForHosts({
922
799
  projectRoot,
923
800
  hostNames: supportedHosts,
801
+ priorState: cleanupState,
924
802
  scope,
925
- serverName,
926
- serverUrl,
927
803
  skillNames: bundledSkillNames,
928
- });
929
- if (unsupportedHosts.length > 0) {
930
- log.plain(
931
- `Guided skill install skipped unsupported hosts (MCP-only): ${unsupportedHosts.join(", ")}.`,
932
- );
933
- }
934
- const completedCleanupState = cleanupState;
935
- cleanupState = null;
936
- await discardInstallSkillCleanupState(completedCleanupState);
937
- const showSkillRefreshGuidance =
938
- scope === "project" && supportedHosts.length > 0;
939
- printSetupResults(setupRows, scope, serverUrl, {
940
- showSkillRefreshGuidance,
941
- experimentalSyncAgents: showSkillRefreshGuidance
942
- ? resolveExperimentalSyncAgentsForHosts(supportedHosts)
943
- : [],
944
- });
945
- return setupResult;
946
- } catch (error) {
947
- if (cleanupState) {
948
- await cleanupInstalledSkillArtifactsForHosts({
949
- projectRoot,
950
- hostNames: supportedHosts,
951
- priorState: cleanupState,
952
- scope,
953
- skillNames: bundledSkillNames,
954
- });
804
+ });
805
+ cleanupState = null;
955
806
  }
956
- throw error;
807
+ log.warn("Setup cancelled");
808
+ return { exitCode: 0 };
809
+ }
810
+ }
811
+
812
+ const setupResult = await runMcpSetupMode({
813
+ selectedHosts: hosts,
814
+ scope,
815
+ cwd: projectRoot,
816
+ // Prior-mode enforcement already ran before install/auth (above); skip
817
+ // the inner detector so a --force reconcile cannot re-uninstall the
818
+ // skills this command just installed, and so the non-force conflict
819
+ // path short-circuits before we reach this point.
820
+ force: false,
821
+ serverName,
822
+ serverUrl,
823
+ apiKey,
824
+ privateCodexConfig: options.apiKeyStdin === true,
825
+ replaceExisting: options.force === true,
826
+ // Tell the writers to reconcile auth-mode mismatches (Authorization
827
+ // header added/removed) only when the user explicitly set `--oauth` or
828
+ // `--api-key`. Without that, a passive rerun must stay idempotent and
829
+ // preserve the existing bearer header on disk rather than stripping it.
830
+ enforceAuthMode: oauthMode || explicitApiKeyProvided,
831
+ detectPriorMode: async () => ({
832
+ priorMode: null,
833
+ affectedHosts: [],
834
+ entries: [],
835
+ }),
836
+ reconcilePriorMode: deps.reconcilePriorMode,
837
+ });
838
+ if (reconciled.length > 0) {
839
+ setupResult.reconciled = [
840
+ ...(Array.isArray(setupResult.reconciled)
841
+ ? setupResult.reconciled
842
+ : []),
843
+ ...reconciled,
844
+ ];
845
+ }
846
+
847
+ if (setupResult.exitCode !== 0) {
848
+ printSetupResultSummary(setupResult);
849
+ const failureDetails = setupResult.agentResults
850
+ .filter((result) => result.success !== true)
851
+ .flatMap((result) =>
852
+ Array.isArray(result.warnings) ? result.warnings : [],
853
+ )
854
+ .join(" | ");
855
+ const error = new Error(
856
+ failureDetails.length > 0
857
+ ? `MCP setup encountered host-level failures: ${failureDetails}`
858
+ : "MCP setup encountered host-level failures.",
859
+ );
860
+ error.exitCode = setupResult.exitCode;
861
+ throw error;
862
+ }
863
+
864
+ const setupRows = buildSetupResultRows({
865
+ selectedHosts: hosts,
866
+ hostStates,
867
+ setupResult,
868
+ oauthMode,
869
+ });
870
+
871
+ if (skillDecisionMode !== "guided") {
872
+ const completedCleanupState = cleanupState;
873
+ cleanupState = null;
874
+ await discardInstallSkillCleanupState(completedCleanupState);
875
+ const showSkillRefreshGuidance =
876
+ scope === "project" &&
877
+ skillDecisionMode === "install" &&
878
+ supportedHosts.length > 0;
879
+ printSetupResults(setupRows, scope, serverUrl, {
880
+ showSkillRefreshGuidance,
881
+ experimentalSyncAgents: showSkillRefreshGuidance
882
+ ? resolveExperimentalSyncAgentsForHosts(supportedHosts)
883
+ : [],
884
+ });
885
+ return setupResult;
886
+ }
887
+
888
+ if (supportedHosts.length === 0) {
889
+ log.plain(
890
+ `Bundled skill installation is unavailable for the selected hosts (${hosts.join(", ")}). Continuing with MCP-only setup.`,
891
+ );
892
+ printSetupResults(setupRows, scope, serverUrl);
893
+ return setupResult;
894
+ }
895
+
896
+ const shouldInstallSkill = await promptGuidedSkillInstall(
897
+ bundledSkillNames,
898
+ unsupportedHosts,
899
+ guidedSkillDecisionOverride,
900
+ );
901
+ if (!shouldInstallSkill) {
902
+ printSetupResults(setupRows, scope, serverUrl);
903
+ return setupResult;
904
+ }
905
+
906
+ if (installDriftHosts.length > 0) {
907
+ throw new Error(
908
+ formatInstallSkillDriftError({
909
+ hostName: installDriftHosts[0].hostName,
910
+ scope,
911
+ serverName,
912
+ existingUrl: installDriftHosts[0].existingUrl,
913
+ requestedUrl: serverUrl,
914
+ }),
915
+ );
916
+ }
917
+
918
+ logBundledSkillInstallPlan({
919
+ bundledSkillNames,
920
+ projectRoot,
921
+ scope,
922
+ supportedHosts,
923
+ });
924
+ cleanupState = await inspectInstalledSkillArtifactsForHosts({
925
+ projectRoot,
926
+ hostNames: supportedHosts,
927
+ scope,
928
+ skillNames: bundledSkillNames,
929
+ });
930
+ await installBundledSkillForHosts({
931
+ projectRoot,
932
+ hostNames: supportedHosts,
933
+ scope,
934
+ serverName,
935
+ serverUrl,
936
+ skillNames: bundledSkillNames,
937
+ });
938
+ if (unsupportedHosts.length > 0) {
939
+ log.plain(
940
+ `Guided skill install skipped unsupported hosts (MCP-only): ${unsupportedHosts.join(", ")}.`,
941
+ );
942
+ }
943
+ const completedCleanupState = cleanupState;
944
+ cleanupState = null;
945
+ await discardInstallSkillCleanupState(completedCleanupState);
946
+ const showSkillRefreshGuidance =
947
+ scope === "project" && supportedHosts.length > 0;
948
+ printSetupResults(setupRows, scope, serverUrl, {
949
+ showSkillRefreshGuidance,
950
+ experimentalSyncAgents: showSkillRefreshGuidance
951
+ ? resolveExperimentalSyncAgentsForHosts(supportedHosts)
952
+ : [],
953
+ });
954
+ return setupResult;
955
+ } catch (error) {
956
+ if (cleanupState) {
957
+ await cleanupInstalledSkillArtifactsForHosts({
958
+ projectRoot,
959
+ hostNames: supportedHosts,
960
+ priorState: cleanupState,
961
+ scope,
962
+ skillNames: bundledSkillNames,
963
+ });
957
964
  }
965
+ throw error;
966
+ }
958
967
  }