@paradigma-inc/flywheel 0.1.115 → 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 (623) hide show
  1. package/README.md +67 -10
  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/references/INTERFACES.md +2 -2
  8. package/skills/flywheel/references/experiment-design-protocol.md +32 -25
  9. package/skills/flywheel/references/flywheel-cli-tool-map.md +120 -76
  10. package/skills/flywheel/references/flywheel-mcp-tool-map.md +42 -32
  11. package/skills/flywheel/setting-up-flywheel/claude-code-cli-installation.md +1 -1
  12. package/skills/flywheel/setting-up-flywheel/codex-cli-installation.md +1 -1
  13. package/skills/flywheel/setting-up-flywheel/installation-overview.md +2 -6
  14. package/skills/flywheel/setting-up-flywheel/other-hosts-installation.md +45 -25
  15. package/skills/flywheel/setting-up-flywheel/updating-flywheel-mcp.md +34 -11
  16. package/skills/flywheel-auto/SKILL.md +40 -23
  17. package/skills/flywheel-auto/evals/evals.json +1 -1
  18. package/skills/flywheel-auto/references/INTERFACES.md +2 -2
  19. package/skills/flywheel-auto/references/experiment-design-protocol.md +31 -23
  20. package/skills/flywheel-auto/references/flywheel-cli-tool-map.md +172 -127
  21. package/skills/flywheel-auto/references/flywheel-mcp-tool-map.md +22 -24
  22. package/skills/flywheel-lookahead/SKILL.md +47 -28
  23. package/skills/flywheel-lookahead/agents/openai.yaml +1 -1
  24. package/skills/flywheel-lookahead/evals/evals.json +6 -6
  25. package/skills/flywheel-lookahead/references/INTERFACES.md +2 -2
  26. package/skills/flywheel-lookahead/references/flywheel-cli-tool-map.md +172 -127
  27. package/skills/flywheel-lookahead/references/flywheel-mcp-tool-map.md +22 -24
  28. package/skills/flywheel-prove/SKILL.md +2 -2
  29. package/skills/flywheel-prove/references/workflow.md +21 -2
  30. package/skills/flywheel-reproduce/SKILL.md +39 -19
  31. package/skills/flywheel-reproduce/evals/evals.json +1 -1
  32. package/skills/flywheel-reproduce/references/INTERFACES.md +2 -2
  33. package/skills/flywheel-reproduce/references/experiment-design-protocol.md +31 -23
  34. package/skills/flywheel-reproduce/references/flywheel-cli-tool-map.md +172 -127
  35. package/skills/flywheel-reproduce/references/flywheel-mcp-tool-map.md +22 -24
  36. package/skills/flywheel-to-graph/SKILL.md +37 -17
  37. package/skills/flywheel-to-graph/references/INTERFACES.md +2 -2
  38. package/skills/flywheel-to-graph/references/flywheel-cli-tool-map.md +172 -127
  39. package/skills/flywheel-to-graph/references/flywheel-mcp-tool-map.md +22 -24
  40. package/skills/flywheel-tree/references/workflow.md +6 -37
  41. package/src/cli.mjs +1145 -1141
  42. package/src/mcp-writer.mjs +413 -435
  43. package/src/public-command-metadata.mjs +28 -5
  44. package/src/runtime/delegate.mjs +2 -19
  45. package/src/runtime/required-runtime-commands.json +80 -28
  46. package/src/runtime/runtime-config.mjs +39 -60
  47. package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js +330 -0
  48. package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js.map +1 -0
  49. package/src/runtime/vendor/flywheel-cli-dist/auth/login.js +90 -139
  50. package/src/runtime/vendor/flywheel-cli-dist/auth/login.js.map +1 -1
  51. package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js +1 -1
  52. package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js.map +1 -1
  53. package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js +116 -0
  54. package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js.map +1 -0
  55. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js +248 -1
  56. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js.map +1 -1
  57. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js +65 -1
  58. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js.map +1 -1
  59. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js +17 -0
  60. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js.map +1 -0
  61. package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js +3 -7
  62. package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js.map +1 -1
  63. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js +12 -0
  64. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js.map +1 -0
  65. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js +29 -0
  66. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js.map +1 -0
  67. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js +12 -0
  68. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js.map +1 -1
  69. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js +46 -10
  70. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js.map +1 -1
  71. package/src/runtime/vendor/flywheel-cli-dist/commands/env.js +17 -40
  72. package/src/runtime/vendor/flywheel-cli-dist/commands/env.js.map +1 -1
  73. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js +305 -0
  74. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js.map +1 -0
  75. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js +72 -0
  76. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js.map +1 -0
  77. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js +286 -0
  78. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js.map +1 -0
  79. package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js +30 -5
  80. package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js.map +1 -1
  81. package/src/runtime/vendor/flywheel-cli-dist/commands/help.js +27 -12
  82. package/src/runtime/vendor/flywheel-cli-dist/commands/help.js.map +1 -1
  83. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js +284 -0
  84. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js.map +1 -0
  85. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js +169 -0
  86. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js.map +1 -0
  87. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js +13 -0
  88. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js.map +1 -0
  89. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js +227 -0
  90. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js.map +1 -0
  91. package/src/runtime/vendor/flywheel-cli-dist/commands/index.js +21 -51
  92. package/src/runtime/vendor/flywheel-cli-dist/commands/index.js.map +1 -1
  93. package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js +25 -0
  94. package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js.map +1 -0
  95. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js +11 -9
  96. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js.map +1 -1
  97. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js +38 -45
  98. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js.map +1 -1
  99. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js +14 -17
  100. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js.map +1 -1
  101. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js +13 -8
  102. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js.map +1 -1
  103. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js +34 -3
  104. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js.map +1 -1
  105. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js +9 -9
  106. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js.map +1 -1
  107. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js +76 -0
  108. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js.map +1 -0
  109. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js +4 -138
  110. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js.map +1 -1
  111. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js +8 -13
  112. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js.map +1 -1
  113. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js +362 -0
  114. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js.map +1 -0
  115. package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js +45 -183
  116. package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js.map +1 -1
  117. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js +47 -0
  118. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js.map +1 -0
  119. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js +181 -0
  120. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js.map +1 -0
  121. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js +163 -0
  122. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js.map +1 -0
  123. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js +79 -0
  124. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js.map +1 -0
  125. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js +80 -0
  126. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js.map +1 -0
  127. package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js +78 -0
  128. package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js.map +1 -0
  129. package/src/runtime/vendor/flywheel-cli-dist/commands/types.js.map +1 -1
  130. package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js +3 -2
  131. package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js.map +1 -1
  132. package/src/runtime/vendor/flywheel-cli-dist/config/index.js +5 -0
  133. package/src/runtime/vendor/flywheel-cli-dist/config/index.js.map +1 -0
  134. package/src/runtime/vendor/flywheel-cli-dist/config/io.js +139 -0
  135. package/src/runtime/vendor/flywheel-cli-dist/config/io.js.map +1 -0
  136. package/src/runtime/vendor/flywheel-cli-dist/config/migration.js +299 -0
  137. package/src/runtime/vendor/flywheel-cli-dist/config/migration.js.map +1 -0
  138. package/src/runtime/vendor/flywheel-cli-dist/config/model.js +214 -0
  139. package/src/runtime/vendor/flywheel-cli-dist/config/model.js.map +1 -0
  140. package/src/runtime/vendor/flywheel-cli-dist/config/path.js +30 -0
  141. package/src/runtime/vendor/flywheel-cli-dist/config/path.js.map +1 -0
  142. package/src/runtime/vendor/flywheel-cli-dist/credential-output.js +29 -0
  143. package/src/runtime/vendor/flywheel-cli-dist/credential-output.js.map +1 -0
  144. package/src/runtime/vendor/flywheel-cli-dist/errors.js +1 -16
  145. package/src/runtime/vendor/flywheel-cli-dist/errors.js.map +1 -1
  146. package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js +3 -3
  147. package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js.map +1 -1
  148. package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js +19 -9
  149. package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js.map +1 -1
  150. package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js +33 -4
  151. package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js.map +1 -1
  152. package/src/runtime/vendor/flywheel-cli-dist/http/client.js +322 -304
  153. package/src/runtime/vendor/flywheel-cli-dist/http/client.js.map +1 -1
  154. package/src/runtime/vendor/flywheel-cli-dist/http/debug.js +1 -21
  155. package/src/runtime/vendor/flywheel-cli-dist/http/debug.js.map +1 -1
  156. package/src/runtime/vendor/flywheel-cli-dist/http/retry.js +1 -0
  157. package/src/runtime/vendor/flywheel-cli-dist/http/retry.js.map +1 -1
  158. package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js +244 -0
  159. package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js.map +1 -0
  160. package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js +7 -0
  161. package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js.map +1 -0
  162. package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js +35 -0
  163. package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js.map +1 -0
  164. package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js +42 -0
  165. package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js.map +1 -0
  166. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js +179 -0
  167. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js.map +1 -0
  168. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js +152 -0
  169. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js.map +1 -0
  170. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js +71 -0
  171. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js.map +1 -0
  172. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js +73 -0
  173. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js.map +1 -0
  174. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js +82 -0
  175. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js.map +1 -0
  176. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js +345 -0
  177. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js.map +1 -0
  178. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js +57 -0
  179. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js.map +1 -0
  180. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js +149 -0
  181. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js.map +1 -0
  182. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js +115 -0
  183. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js.map +1 -0
  184. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js +44 -0
  185. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js.map +1 -0
  186. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js +159 -0
  187. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js.map +1 -0
  188. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js +346 -0
  189. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js.map +1 -0
  190. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js +37 -0
  191. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js.map +1 -0
  192. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js +203 -0
  193. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js.map +1 -0
  194. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js +207 -0
  195. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js.map +1 -0
  196. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js +109 -0
  197. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js.map +1 -0
  198. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js +61 -0
  199. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js.map +1 -0
  200. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js +46 -0
  201. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js.map +1 -0
  202. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js +203 -0
  203. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js.map +1 -0
  204. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js +44 -0
  205. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js.map +1 -0
  206. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js +188 -0
  207. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js.map +1 -0
  208. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js +54 -0
  209. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js.map +1 -0
  210. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js +25 -0
  211. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js.map +1 -0
  212. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js +2 -0
  213. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js.map +1 -0
  214. package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js +7 -0
  215. package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js.map +1 -0
  216. package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js +129 -0
  217. package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js.map +1 -0
  218. package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js +277 -0
  219. package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js.map +1 -0
  220. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js +183 -0
  221. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js.map +1 -0
  222. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js +2 -0
  223. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js.map +1 -0
  224. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js +121 -0
  225. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js.map +1 -0
  226. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js +16 -0
  227. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js.map +1 -0
  228. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js +72 -0
  229. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js.map +1 -0
  230. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js +59 -0
  231. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js.map +1 -0
  232. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js +125 -0
  233. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js.map +1 -0
  234. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js +129 -0
  235. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js.map +1 -0
  236. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js +31 -0
  237. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js.map +1 -0
  238. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js +49 -0
  239. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js.map +1 -0
  240. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js +30 -0
  241. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js.map +1 -0
  242. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js +12 -0
  243. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js.map +1 -0
  244. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js +18 -0
  245. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js.map +1 -0
  246. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js +125 -0
  247. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js.map +1 -0
  248. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js +37 -0
  249. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js.map +1 -0
  250. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js +44 -0
  251. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js.map +1 -0
  252. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js +58 -0
  253. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js.map +1 -0
  254. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js +118 -0
  255. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js.map +1 -0
  256. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js +277 -0
  257. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js.map +1 -0
  258. package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js +132 -0
  259. package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js.map +1 -0
  260. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js +372 -0
  261. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js.map +1 -0
  262. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js +210 -0
  263. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js.map +1 -0
  264. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js +278 -0
  265. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js.map +1 -0
  266. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js +192 -0
  267. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js.map +1 -0
  268. package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js +114 -0
  269. package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js.map +1 -0
  270. package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js +65 -0
  271. package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js.map +1 -0
  272. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js +145 -0
  273. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js.map +1 -0
  274. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js +218 -0
  275. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js.map +1 -0
  276. package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js +71 -0
  277. package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js.map +1 -0
  278. package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js +298 -0
  279. package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js.map +1 -0
  280. package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js +121 -0
  281. package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js.map +1 -0
  282. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js +69 -0
  283. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js.map +1 -0
  284. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js +49 -0
  285. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js.map +1 -0
  286. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js +424 -0
  287. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js.map +1 -0
  288. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js +10 -0
  289. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js.map +1 -0
  290. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/001_initial.sql +319 -0
  291. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/002_staged_latest_values.sql +8 -0
  292. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/003_remove_cli_editing_lease.sql +21 -0
  293. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/004_hosted_association.sql +7 -0
  294. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/005_artifact_properties.sql +68 -0
  295. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js +12 -0
  296. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js.map +1 -0
  297. package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js +410 -0
  298. package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js.map +1 -0
  299. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js +77 -0
  300. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js.map +1 -0
  301. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js +240 -0
  302. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js.map +1 -0
  303. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js +127 -0
  304. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js.map +1 -0
  305. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js +107 -0
  306. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js.map +1 -0
  307. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js +80 -0
  308. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js.map +1 -0
  309. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js +219 -0
  310. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js.map +1 -0
  311. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js +164 -0
  312. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js.map +1 -0
  313. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js +20 -0
  314. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js.map +1 -0
  315. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js +41 -0
  316. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js.map +1 -0
  317. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js +22 -0
  318. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js.map +1 -0
  319. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js +188 -0
  320. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js.map +1 -0
  321. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js +5 -0
  322. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js.map +1 -0
  323. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js +214 -0
  324. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js.map +1 -0
  325. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js +4 -0
  326. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js.map +1 -0
  327. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js +44 -0
  328. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js.map +1 -0
  329. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js +38 -0
  330. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js.map +1 -0
  331. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js +284 -0
  332. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js.map +1 -0
  333. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js +133 -0
  334. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js.map +1 -0
  335. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js +98 -0
  336. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js.map +1 -0
  337. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js +161 -0
  338. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js.map +1 -0
  339. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js +97 -0
  340. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js.map +1 -0
  341. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js +69 -0
  342. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js.map +1 -0
  343. package/src/runtime/vendor/flywheel-cli-dist/main.js +651 -376
  344. package/src/runtime/vendor/flywheel-cli-dist/main.js.map +1 -1
  345. package/src/runtime/vendor/flywheel-cli-dist/output/format.js +18 -11
  346. package/src/runtime/vendor/flywheel-cli-dist/output/format.js.map +1 -1
  347. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-arm64/node.napi.node +0 -0
  348. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-x64/node.napi.node +0 -0
  349. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.glibc.node +0 -0
  350. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.musl.node +0 -0
  351. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  352. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.musl.node +0 -0
  353. package/src/runtime/vendor/manifest.json +246 -257
  354. package/src/setup/command.mjs +5 -0
  355. package/src/setup/io/patchers/json.mjs +1 -1
  356. package/src/setup/io/patchers/toml.mjs +3 -1
  357. package/src/setup/io/patchers/yaml.mjs +1 -1
  358. package/src/setup/modes/cli.mjs +76 -7
  359. package/src/setup/modes/mcp-command.mjs +802 -793
  360. package/src/setup/modes/mcp.mjs +7 -3
  361. package/src/setup/shared/prior-mode-detect.mjs +18 -21
  362. package/src/setup/test-seams.mjs +25 -0
  363. package/src/setup-auth.mjs +76 -10
  364. package/src/toml-lines.mjs +52 -0
  365. package/src/unified-cli.mjs +31 -16
  366. package/skills/flywheel-llm-proof-paper/scripts/__pycache__/check_paper.cpython-312.pyc +0 -0
  367. package/src/runtime/vendor/flywheel-cli-dist/auth/active-key-id.d.ts +0 -1
  368. package/src/runtime/vendor/flywheel-cli-dist/auth/baseurl.d.ts +0 -35
  369. package/src/runtime/vendor/flywheel-cli-dist/auth/config.d.ts +0 -34
  370. package/src/runtime/vendor/flywheel-cli-dist/auth/config.js +0 -92
  371. package/src/runtime/vendor/flywheel-cli-dist/auth/config.js.map +0 -1
  372. package/src/runtime/vendor/flywheel-cli-dist/auth/fingerprint.d.ts +0 -5
  373. package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.d.ts +0 -4
  374. package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js +0 -31
  375. package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js.map +0 -1
  376. package/src/runtime/vendor/flywheel-cli-dist/auth/login.d.ts +0 -24
  377. package/src/runtime/vendor/flywheel-cli-dist/auth/profile.d.ts +0 -15
  378. package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js +0 -150
  379. package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js.map +0 -1
  380. package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.d.ts +0 -27
  381. package/src/runtime/vendor/flywheel-cli-dist/commands/_admin-auth.d.ts +0 -27
  382. package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.d.ts +0 -32
  383. package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js +0 -213
  384. package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js.map +0 -1
  385. package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.d.ts +0 -35
  386. package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.d.ts +0 -2
  387. package/src/runtime/vendor/flywheel-cli-dist/commands/_secret-param.d.ts +0 -7
  388. package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-file-out.d.ts +0 -39
  389. package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-writer.d.ts +0 -34
  390. package/src/runtime/vendor/flywheel-cli-dist/commands/_wait-polling.d.ts +0 -50
  391. package/src/runtime/vendor/flywheel-cli-dist/commands/account-detach.d.ts +0 -2
  392. package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-add.d.ts +0 -2
  393. package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-remove.d.ts +0 -2
  394. package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-set-primary.d.ts +0 -2
  395. package/src/runtime/vendor/flywheel-cli-dist/commands/account-get.d.ts +0 -2
  396. package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-preview.d.ts +0 -2
  397. package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-proof.d.ts +0 -2
  398. package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge.d.ts +0 -2
  399. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-get.d.ts +0 -2
  400. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-set.d.ts +0 -2
  401. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export-stream.d.ts +0 -2
  402. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export.d.ts +0 -2
  403. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-list.d.ts +0 -4
  404. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-nodes-audit-list.d.ts +0 -2
  405. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.d.ts +0 -2
  406. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-delete.d.ts +0 -2
  407. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.d.ts +0 -2
  408. package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.d.ts +0 -13
  409. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-create.d.ts +0 -2
  410. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-delete.d.ts +0 -2
  411. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-list.d.ts +0 -18
  412. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-rotate.d.ts +0 -2
  413. package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-expire.d.ts +0 -2
  414. package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-heartbeat.d.ts +0 -2
  415. package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-list.d.ts +0 -2
  416. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.d.ts +0 -2
  417. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js +0 -22
  418. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js.map +0 -1
  419. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.d.ts +0 -2
  420. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js +0 -8
  421. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js.map +0 -1
  422. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-get.d.ts +0 -2
  423. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-list.d.ts +0 -2
  424. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.d.ts +0 -2
  425. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js +0 -9
  426. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js.map +0 -1
  427. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.d.ts +0 -2
  428. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js +0 -7
  429. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js.map +0 -1
  430. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.d.ts +0 -2
  431. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js +0 -15
  432. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js.map +0 -1
  433. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.d.ts +0 -2
  434. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js +0 -5
  435. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js.map +0 -1
  436. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.d.ts +0 -2
  437. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js +0 -8
  438. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js.map +0 -1
  439. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.d.ts +0 -2
  440. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js +0 -30
  441. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js.map +0 -1
  442. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.d.ts +0 -2
  443. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-mode.d.ts +0 -4
  444. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.d.ts +0 -2
  445. package/src/runtime/vendor/flywheel-cli-dist/commands/blobs-get.d.ts +0 -2
  446. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-create.d.ts +0 -2
  447. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-list.d.ts +0 -1
  448. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-revoke.d.ts +0 -1
  449. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-update.d.ts +0 -2
  450. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-snapshot.d.ts +0 -1
  451. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-acquire.d.ts +0 -2
  452. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-budgets.d.ts +0 -2
  453. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-connection.d.ts +0 -2
  454. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-funding.d.ts +0 -2
  455. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-list.d.ts +0 -2
  456. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-request-approval.d.ts +0 -2
  457. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-options.d.ts +0 -2
  458. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release-all.d.ts +0 -2
  459. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release.d.ts +0 -2
  460. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-status.d.ts +0 -2
  461. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-balance.d.ts +0 -1
  462. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-billing-portal.d.ts +0 -2
  463. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-purchase.d.ts +0 -2
  464. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral-claim.d.ts +0 -2
  465. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral.d.ts +0 -1
  466. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscribe.d.ts +0 -2
  467. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscription.d.ts +0 -1
  468. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-transactions.d.ts +0 -2
  469. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-usage.d.ts +0 -2
  470. package/src/runtime/vendor/flywheel-cli-dist/commands/destructive-confirmation.d.ts +0 -2
  471. package/src/runtime/vendor/flywheel-cli-dist/commands/enums.d.ts +0 -22
  472. package/src/runtime/vendor/flywheel-cli-dist/commands/env.d.ts +0 -8
  473. package/src/runtime/vendor/flywheel-cli-dist/commands/executions-launch.d.ts +0 -2
  474. package/src/runtime/vendor/flywheel-cli-dist/commands/executions-list.d.ts +0 -1
  475. package/src/runtime/vendor/flywheel-cli-dist/commands/executions-terminate.d.ts +0 -2
  476. package/src/runtime/vendor/flywheel-cli-dist/commands/export-history.d.ts +0 -2
  477. package/src/runtime/vendor/flywheel-cli-dist/commands/export-subgraph.d.ts +0 -2
  478. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-pdf.d.ts +0 -2
  479. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-render-pdf.d.ts +0 -2
  480. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-stream.d.ts +0 -2
  481. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary.d.ts +0 -2
  482. package/src/runtime/vendor/flywheel-cli-dist/commands/feedback-create.d.ts +0 -2
  483. package/src/runtime/vendor/flywheel-cli-dist/commands/files-list.d.ts +0 -2
  484. package/src/runtime/vendor/flywheel-cli-dist/commands/github-disconnect.d.ts +0 -1
  485. package/src/runtime/vendor/flywheel-cli-dist/commands/github-link.d.ts +0 -2
  486. package/src/runtime/vendor/flywheel-cli-dist/commands/github-refresh-repos.d.ts +0 -1
  487. package/src/runtime/vendor/flywheel-cli-dist/commands/github-status.d.ts +0 -1
  488. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-get.d.ts +0 -2
  489. package/src/runtime/vendor/flywheel-cli-dist/commands/handler-factory.d.ts +0 -22
  490. package/src/runtime/vendor/flywheel-cli-dist/commands/help-format.d.ts +0 -31
  491. package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.d.ts +0 -36
  492. package/src/runtime/vendor/flywheel-cli-dist/commands/help.d.ts +0 -17
  493. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-create.d.ts +0 -2
  494. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-delete.d.ts +0 -1
  495. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-list.d.ts +0 -2
  496. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-runs-list.d.ts +0 -2
  497. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-create.d.ts +0 -2
  498. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-delete.d.ts +0 -1
  499. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-list.d.ts +0 -1
  500. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-update.d.ts +0 -2
  501. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-set-enabled.d.ts +0 -2
  502. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-update.d.ts +0 -2
  503. package/src/runtime/vendor/flywheel-cli-dist/commands/import-subgraph.d.ts +0 -2
  504. package/src/runtime/vendor/flywheel-cli-dist/commands/index.d.ts +0 -23
  505. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-remove.d.ts +0 -1
  506. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-set.d.ts +0 -2
  507. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-status.d.ts +0 -1
  508. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-remove.d.ts +0 -1
  509. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-set.d.ts +0 -2
  510. package/src/runtime/vendor/flywheel-cli-dist/commands/machines-list.d.ts +0 -1
  511. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.d.ts +0 -2
  512. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js +0 -15
  513. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js.map +0 -1
  514. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.d.ts +0 -2
  515. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js +0 -10
  516. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js.map +0 -1
  517. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.d.ts +0 -2
  518. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js +0 -8
  519. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js.map +0 -1
  520. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.d.ts +0 -2
  521. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js +0 -6
  522. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js.map +0 -1
  523. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.d.ts +0 -2
  524. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js +0 -7
  525. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js.map +0 -1
  526. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.d.ts +0 -2
  527. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js +0 -6
  528. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js.map +0 -1
  529. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.d.ts +0 -2
  530. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js +0 -16
  531. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js.map +0 -1
  532. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.d.ts +0 -2
  533. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js +0 -11
  534. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js.map +0 -1
  535. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-files.d.ts +0 -1
  536. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-get.d.ts +0 -2
  537. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-list.d.ts +0 -2
  538. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.d.ts +0 -2
  539. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js +0 -33
  540. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js.map +0 -1
  541. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.d.ts +0 -2
  542. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js +0 -8
  543. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js.map +0 -1
  544. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.d.ts +0 -2
  545. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js +0 -15
  546. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js.map +0 -1
  547. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-ancestry.d.ts +0 -2
  548. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-summary.d.ts +0 -2
  549. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-tree.d.ts +0 -2
  550. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-resolve-slug.d.ts +0 -2
  551. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-get.d.ts +0 -1
  552. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set-bulk.d.ts +0 -2
  553. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set.d.ts +0 -2
  554. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-summaries.d.ts +0 -2
  555. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-acquire.d.ts +0 -2
  556. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-heartbeat.d.ts +0 -2
  557. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-release.d.ts +0 -2
  558. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.d.ts +0 -2
  559. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.d.ts +0 -2
  560. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.d.ts +0 -2
  561. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.d.ts +0 -2
  562. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/account.d.ts +0 -2
  563. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.d.ts +0 -8
  564. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/api-keys.d.ts +0 -2
  565. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/approval.d.ts +0 -2
  566. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.d.ts +0 -2
  567. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js +0 -140
  568. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js.map +0 -1
  569. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.d.ts +0 -2
  570. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/budgets.d.ts +0 -2
  571. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/compute.d.ts +0 -2
  572. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/credits.d.ts +0 -2
  573. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/env.d.ts +0 -2
  574. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/executions.d.ts +0 -2
  575. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/export.d.ts +0 -2
  576. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/github.d.ts +0 -2
  577. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/graph.d.ts +0 -2
  578. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hooks.d.ts +0 -2
  579. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/integrations.d.ts +0 -2
  580. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.d.ts +0 -2
  581. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.d.ts +0 -2
  582. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/resources.d.ts +0 -2
  583. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/sharing.d.ts +0 -2
  584. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.d.ts +0 -2
  585. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js +0 -98
  586. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js.map +0 -1
  587. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/updates.d.ts +0 -2
  588. package/src/runtime/vendor/flywheel-cli-dist/commands/registry.d.ts +0 -27
  589. package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-refresh.d.ts +0 -2
  590. package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-resolve.d.ts +0 -2
  591. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.d.ts +0 -2
  592. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js +0 -25
  593. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js.map +0 -1
  594. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.d.ts +0 -2
  595. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js +0 -25
  596. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js.map +0 -1
  597. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.d.ts +0 -2
  598. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js +0 -11
  599. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js.map +0 -1
  600. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.d.ts +0 -2
  601. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js +0 -28
  602. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js.map +0 -1
  603. package/src/runtime/vendor/flywheel-cli-dist/commands/types.d.ts +0 -30
  604. package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide-all-active.d.ts +0 -1
  605. package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide.d.ts +0 -2
  606. package/src/runtime/vendor/flywheel-cli-dist/commands/updates-list.d.ts +0 -2
  607. package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.d.ts +0 -6
  608. package/src/runtime/vendor/flywheel-cli-dist/commands/utils.d.ts +0 -11
  609. package/src/runtime/vendor/flywheel-cli-dist/errors.d.ts +0 -86
  610. package/src/runtime/vendor/flywheel-cli-dist/exit-codes.d.ts +0 -8
  611. package/src/runtime/vendor/flywheel-cli-dist/generatedFeedbackContract.d.ts +0 -41
  612. package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.d.ts +0 -13
  613. package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.d.ts +0 -26
  614. package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.d.ts +0 -17
  615. package/src/runtime/vendor/flywheel-cli-dist/http/client.d.ts +0 -91
  616. package/src/runtime/vendor/flywheel-cli-dist/http/debug.d.ts +0 -5
  617. package/src/runtime/vendor/flywheel-cli-dist/http/poll.d.ts +0 -18
  618. package/src/runtime/vendor/flywheel-cli-dist/http/retry.d.ts +0 -30
  619. package/src/runtime/vendor/flywheel-cli-dist/main.d.ts +0 -33
  620. package/src/runtime/vendor/flywheel-cli-dist/output/format.d.ts +0 -9
  621. package/src/runtime/vendor/flywheel-cli-dist/runtime-entry.d.ts +0 -1
  622. package/src/runtime/vendor/flywheel-cli-dist/version.d.ts +0 -3
  623. package/src/secure-write.mjs +0 -43
@@ -1,161 +1,155 @@
1
1
  import { access, readFile } from "node:fs/promises";
2
2
  import { load as loadYaml, dump as dumpYaml } from "js-yaml";
3
- import { secureFileMode, writeSecureFile } from "./secure-write.mjs";
3
+ import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
4
+ import { preparePrivateConfigPath, secureFileMode, writeSecureFile } from "./runtime/vendor/flywheel-cli-dist/auth/secure-write.js";
5
+ import { scanTomlLines } from "./toml-lines.mjs";
4
6
 
5
7
  function stripJsonComments(text) {
6
- let result = "";
7
- let i = 0;
8
- while (i < text.length) {
9
- if (text[i] === '"') {
10
- const start = i++;
11
- while (i < text.length && text[i] !== '"') {
12
- if (text[i] === "\\") i += 1;
13
- i += 1;
14
- }
15
- result += text.slice(start, ++i);
16
- } else if (text[i] === "/" && text[i + 1] === "/") {
17
- i += 2;
18
- while (i < text.length && text[i] !== "\n") i += 1;
19
- } else if (text[i] === "/" && text[i + 1] === "*") {
20
- i += 2;
21
- while (i < text.length && !(text[i] === "*" && text[i + 1] === "/"))
22
- i += 1;
23
- i += 2;
24
- } else {
25
- result += text[i];
26
- i += 1;
27
- }
8
+ let result = "";
9
+ let i = 0;
10
+ while (i < text.length) {
11
+ if (text[i] === '"') {
12
+ const start = i++;
13
+ while (i < text.length && text[i] !== '"') {
14
+ if (text[i] === "\\") i += 1;
15
+ i += 1;
16
+ }
17
+ result += text.slice(start, ++i);
18
+ } else if (text[i] === "/" && text[i + 1] === "/") {
19
+ i += 2;
20
+ while (i < text.length && text[i] !== "\n") i += 1;
21
+ } else if (text[i] === "/" && text[i + 1] === "*") {
22
+ i += 2;
23
+ while (i < text.length && !(text[i] === "*" && text[i + 1] === "/"))
24
+ i += 1;
25
+ i += 2;
26
+ } else {
27
+ result += text[i];
28
+ i += 1;
28
29
  }
29
- return result;
30
+ }
31
+ return result;
30
32
  }
31
33
 
32
- function normalizeLineEndings(text) {
33
- return text.replace(/\r\n/g, "\n");
34
- }
35
34
 
36
35
  function stripTomlInlineComment(valueText) {
37
- let inSingleQuotedString = false;
38
- let inDoubleQuotedString = false;
39
- let escapeNextChar = false;
40
-
41
- for (let index = 0; index < valueText.length; index += 1) {
42
- const char = valueText[index];
43
-
44
- if (escapeNextChar) {
45
- escapeNextChar = false;
46
- continue;
47
- }
48
-
49
- if (inDoubleQuotedString && char === "\\") {
50
- escapeNextChar = true;
51
- continue;
52
- }
53
-
54
- if (!inDoubleQuotedString && char === "'") {
55
- inSingleQuotedString = !inSingleQuotedString;
56
- continue;
57
- }
58
-
59
- if (!inSingleQuotedString && char === '"') {
60
- inDoubleQuotedString = !inDoubleQuotedString;
61
- continue;
62
- }
63
-
64
- if (!inSingleQuotedString && !inDoubleQuotedString && char === "#") {
65
- return valueText.slice(0, index).trim();
66
- }
67
- }
36
+ let inSingleQuotedString = false;
37
+ let inDoubleQuotedString = false;
38
+ let escapeNextChar = false;
68
39
 
69
- return valueText.trim();
70
- }
40
+ for (let index = 0; index < valueText.length; index += 1) {
41
+ const char = valueText[index];
71
42
 
72
- export function parseTomlStringValue(valueText) {
73
- const stripped = stripTomlInlineComment(valueText);
74
- if (!stripped) {
75
- return null;
43
+ if (escapeNextChar) {
44
+ escapeNextChar = false;
45
+ continue;
76
46
  }
77
47
 
78
- if (stripped.startsWith('"""') && stripped.endsWith('"""') && stripped.length >= 6) {
79
- return stripped.slice(3, -3);
48
+ if (inDoubleQuotedString && char === "\\") {
49
+ escapeNextChar = true;
50
+ continue;
80
51
  }
81
52
 
82
- if (stripped.startsWith("'''") && stripped.endsWith("'''") && stripped.length >= 6) {
83
- return stripped.slice(3, -3);
53
+ if (!inDoubleQuotedString && char === "'") {
54
+ inSingleQuotedString = !inSingleQuotedString;
55
+ continue;
84
56
  }
85
57
 
86
- if (stripped.startsWith('"') && stripped.endsWith('"')) {
87
- try {
88
- return JSON.parse(stripped);
89
- } catch {
90
- return stripped.slice(1, -1);
91
- }
58
+ if (!inSingleQuotedString && char === '"') {
59
+ inDoubleQuotedString = !inDoubleQuotedString;
60
+ continue;
92
61
  }
93
62
 
94
- if (stripped.startsWith("'") && stripped.endsWith("'")) {
95
- return stripped.slice(1, -1);
63
+ if (!inSingleQuotedString && !inDoubleQuotedString && char === "#") {
64
+ return valueText.slice(0, index).trim();
96
65
  }
66
+ }
97
67
 
98
- return stripped;
68
+ return valueText.trim();
99
69
  }
100
70
 
101
- export function parseTomlSectionName(lineText) {
102
- const withoutComment = stripTomlInlineComment(String(lineText || "").trim());
103
- const sectionMatch = withoutComment.match(/^\[(.+)\]$/);
104
- return sectionMatch ? sectionMatch[1] : null;
105
- }
71
+ export function parseTomlStringValue(valueText) {
72
+ const stripped = stripTomlInlineComment(valueText);
73
+ if (!stripped) {
74
+ return null;
75
+ }
106
76
 
107
- export async function readJsonConfig(filePath) {
108
- let raw;
77
+ if (stripped.startsWith('"""') && stripped.endsWith('"""') && stripped.length >= 6) {
78
+ return stripped.slice(3, -3);
79
+ }
80
+
81
+ if (stripped.startsWith("'''") && stripped.endsWith("'''") && stripped.length >= 6) {
82
+ return stripped.slice(3, -3);
83
+ }
84
+
85
+ if (stripped.startsWith('"') && stripped.endsWith('"')) {
109
86
  try {
110
- raw = await readFile(filePath, "utf8");
87
+ return JSON.parse(stripped);
111
88
  } catch {
112
- return {};
89
+ return stripped.slice(1, -1);
113
90
  }
114
- const trimmed = raw.trim();
115
- if (!trimmed) return {};
116
- return JSON.parse(stripJsonComments(trimmed));
91
+ }
92
+
93
+ if (stripped.startsWith("'") && stripped.endsWith("'")) {
94
+ return stripped.slice(1, -1);
95
+ }
96
+
97
+ return stripped;
98
+ }
99
+
100
+
101
+ export async function readJsonConfig(filePath) {
102
+ let raw;
103
+ try {
104
+ raw = await readFile(filePath, "utf8");
105
+ } catch {
106
+ return {};
107
+ }
108
+ const trimmed = raw.trim();
109
+ if (!trimmed) return {};
110
+ return JSON.parse(stripJsonComments(trimmed));
117
111
  }
118
112
 
119
113
  export async function writeJsonConfig(filePath, config) {
120
- await writeSecureFile(filePath, `${JSON.stringify(config, null, 2)}\n`);
114
+ await writeSecureFile(filePath, `${JSON.stringify(config, null, 2)}\n`);
121
115
  }
122
116
 
123
117
  export async function readYamlConfig(filePath) {
124
- let raw;
125
- try {
126
- raw = await readFile(filePath, "utf8");
127
- } catch {
128
- return {};
129
- }
130
- const trimmed = raw.trim();
131
- if (!trimmed) return {};
132
-
133
- try {
134
- const parsed = loadYaml(trimmed);
135
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
136
- return parsed;
137
- }
138
- return {};
139
- } catch {
140
- return {};
118
+ let raw;
119
+ try {
120
+ raw = await readFile(filePath, "utf8");
121
+ } catch {
122
+ return {};
123
+ }
124
+ const trimmed = raw.trim();
125
+ if (!trimmed) return {};
126
+
127
+ try {
128
+ const parsed = loadYaml(trimmed);
129
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
130
+ return parsed;
141
131
  }
132
+ return {};
133
+ } catch {
134
+ return {};
135
+ }
142
136
  }
143
137
 
144
138
  export async function writeYamlConfig(filePath, config) {
145
- await writeSecureFile(filePath, dumpYaml(config, { noRefs: true }));
139
+ await writeSecureFile(filePath, dumpYaml(config, { noRefs: true }));
146
140
  }
147
141
 
148
142
  export async function resolveMcpPath(candidates) {
149
- for (const candidate of candidates) {
150
- try {
151
- // eslint-disable-next-line no-await-in-loop
152
- await access(candidate);
153
- return candidate;
154
- } catch {
155
- // keep searching
156
- }
143
+ for (const candidate of candidates) {
144
+ try {
145
+ // eslint-disable-next-line no-await-in-loop
146
+ await access(candidate);
147
+ return candidate;
148
+ } catch {
149
+ // keep searching
157
150
  }
158
- return candidates[0];
151
+ }
152
+ return candidates[0];
159
153
  }
160
154
 
161
155
  /**
@@ -182,28 +176,28 @@ export async function resolveMcpPath(candidates) {
182
176
  * Returns null when no recognizable URL key is present.
183
177
  */
184
178
  export function readEntryServerUrl(entry) {
185
- if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
186
- return null;
187
- }
188
- // Empty / whitespace-only strings are placeholder shapes (half-populated
189
- // host writers, hand-edited configs). Returning "" from here would satisfy
190
- // downstream `typeof === "string"` checks but break equality comparisons in
191
- // idempotent setup, drift detection, and uninstall enumeration — the live
192
- // entry would be misclassified as missing. Only non-blank strings count.
193
- //
194
- // Trim-and-return-trimmed: callers compare the result against a canonical
195
- // target via strict equality. Returning the raw field would re-introduce
196
- // the false mismatch on hand-edited configs that carry leading/trailing
197
- // whitespace or a trailing newline around the value.
198
- const httpUrl = typeof entry.httpUrl === "string" ? entry.httpUrl.trim() : "";
199
- if (httpUrl.length > 0) {
200
- return httpUrl;
201
- }
202
- const url = typeof entry.url === "string" ? entry.url.trim() : "";
203
- if (url.length > 0) {
204
- return url;
205
- }
179
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
206
180
  return null;
181
+ }
182
+ // Empty / whitespace-only strings are placeholder shapes (half-populated
183
+ // host writers, hand-edited configs). Returning "" from here would satisfy
184
+ // downstream `typeof === "string"` checks but break equality comparisons in
185
+ // idempotent setup, drift detection, and uninstall enumeration — the live
186
+ // entry would be misclassified as missing. Only non-blank strings count.
187
+ //
188
+ // Trim-and-return-trimmed: callers compare the result against a canonical
189
+ // target via strict equality. Returning the raw field would re-introduce
190
+ // the false mismatch on hand-edited configs that carry leading/trailing
191
+ // whitespace or a trailing newline around the value.
192
+ const httpUrl = typeof entry.httpUrl === "string" ? entry.httpUrl.trim() : "";
193
+ if (httpUrl.length > 0) {
194
+ return httpUrl;
195
+ }
196
+ const url = typeof entry.url === "string" ? entry.url.trim() : "";
197
+ if (url.length > 0) {
198
+ return url;
199
+ }
200
+ return null;
207
201
  }
208
202
 
209
203
  /**
@@ -223,354 +217,338 @@ export function readEntryServerUrl(entry) {
223
217
  * circuit would leave the stale Authorization header behind.
224
218
  */
225
219
  export function readEntryAuthMode(entry) {
226
- if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
227
- return "oauth";
228
- }
229
- const headers = entry.headers;
230
- if (
231
- headers &&
232
- typeof headers === "object" &&
233
- !Array.isArray(headers) &&
234
- typeof headers.Authorization === "string"
235
- ) {
236
- return "api-key";
237
- }
220
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
238
221
  return "oauth";
222
+ }
223
+ const headers = entry.headers;
224
+ if (
225
+ headers &&
226
+ typeof headers === "object" &&
227
+ !Array.isArray(headers) &&
228
+ typeof headers.Authorization === "string"
229
+ ) {
230
+ return "api-key";
231
+ }
232
+ return "oauth";
239
233
  }
240
234
 
241
235
  function keyPath(configKey) {
242
- return Array.isArray(configKey) ? configKey : [configKey];
236
+ return Array.isArray(configKey) ? configKey : [configKey];
243
237
  }
244
238
 
245
239
  function readConfigSection(config, configKey) {
246
- const pathParts = keyPath(configKey);
247
- let current = config && typeof config === "object" ? config : {};
248
- for (const part of pathParts) {
249
- if (
250
- !current ||
251
- typeof current !== "object" ||
252
- Array.isArray(current) ||
253
- !(part in current)
254
- ) {
255
- return {};
256
- }
257
- const next = current[part];
258
- if (!next || typeof next !== "object" || Array.isArray(next)) {
259
- return {};
260
- }
261
- current = next;
240
+ const pathParts = keyPath(configKey);
241
+ let current = config && typeof config === "object" ? config : {};
242
+ for (const part of pathParts) {
243
+ if (
244
+ !current ||
245
+ typeof current !== "object" ||
246
+ Array.isArray(current) ||
247
+ !(part in current)
248
+ ) {
249
+ return {};
250
+ }
251
+ const next = current[part];
252
+ if (!next || typeof next !== "object" || Array.isArray(next)) {
253
+ return {};
262
254
  }
263
- return current;
255
+ current = next;
256
+ }
257
+ return current;
264
258
  }
265
259
 
266
260
  export function readNamedConfigEntry(config, configKey, serverName) {
267
- const section = readConfigSection(config, configKey);
268
- const entry = section[serverName];
269
- if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
270
- return null;
271
- }
272
- return entry;
261
+ const section = readConfigSection(config, configKey);
262
+ const entry = section[serverName];
263
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
264
+ return null;
265
+ }
266
+ return entry;
273
267
  }
274
268
 
275
269
  function writeConfigSection(config, configKey, section) {
276
- const pathParts = keyPath(configKey);
277
- if (pathParts.length === 0) return config || {};
278
-
279
- const root =
280
- config && typeof config === "object" && !Array.isArray(config)
281
- ? { ...config }
282
- : {};
283
- let cursor = root;
284
-
285
- for (let index = 0; index < pathParts.length - 1; index += 1) {
286
- const part = pathParts[index];
287
- const existing = cursor[part];
288
- cursor[part] =
289
- existing && typeof existing === "object" && !Array.isArray(existing)
290
- ? { ...existing }
291
- : {};
292
- cursor = cursor[part];
293
- }
294
- cursor[pathParts[pathParts.length - 1]] = section;
295
- return root;
270
+ const pathParts = keyPath(configKey);
271
+ if (pathParts.length === 0) return config || {};
272
+
273
+ const root =
274
+ config && typeof config === "object" && !Array.isArray(config)
275
+ ? { ...config }
276
+ : {};
277
+ let cursor = root;
278
+
279
+ for (let index = 0; index < pathParts.length - 1; index += 1) {
280
+ const part = pathParts[index];
281
+ const existing = cursor[part];
282
+ cursor[part] =
283
+ existing && typeof existing === "object" && !Array.isArray(existing)
284
+ ? { ...existing }
285
+ : {};
286
+ cursor = cursor[part];
287
+ }
288
+ cursor[pathParts[pathParts.length - 1]] = section;
289
+ return root;
296
290
  }
297
291
 
298
292
  export function mergeServerEntry(
299
- existing,
300
- configKey,
301
- serverName,
302
- entry,
303
- { enforceAuthMode = false } = {},
293
+ existing,
294
+ configKey,
295
+ serverName,
296
+ entry,
297
+ { enforceAuthMode = false } = {},
304
298
  ) {
305
- const section = readConfigSection(existing, configKey);
306
-
307
- if (serverName in section) {
308
- // `enforceAuthMode` is opt-in and signals that the caller holds explicit
309
- // auth intent (`--oauth` or `--api-key ...` on the command line). Only
310
- // then do we reclassify on auth-mode mismatch and rewrite: the caller
311
- // explicitly wants the Authorization header added or removed. Without
312
- // that signal, setup is in the idempotent "re-run with no auth flags"
313
- // mode and must preserve the existing entry byte-for-byte — otherwise
314
- // a benign rerun would wipe the minted bearer key, because the ambient
315
- // rebuild path constructs a headerless entry (apiKey omitted when the
316
- // CLI did not resolve a new key).
317
- if (
318
- !enforceAuthMode ||
319
- readEntryAuthMode(section[serverName]) === readEntryAuthMode(entry)
320
- ) {
321
- return { config: existing, alreadyExists: true };
322
- }
299
+ const section = readConfigSection(existing, configKey);
300
+
301
+ if (serverName in section) {
302
+ // `enforceAuthMode` is opt-in and signals that the caller holds explicit
303
+ // auth intent (`--oauth` or `--api-key ...` on the command line). Only
304
+ // then do we reclassify on auth-mode mismatch and rewrite: the caller
305
+ // explicitly wants the Authorization header added or removed. Without
306
+ // that signal, setup is in the idempotent "re-run with no auth flags"
307
+ // mode and must preserve the existing entry byte-for-byte — otherwise
308
+ // a benign rerun would wipe the minted bearer key, because the ambient
309
+ // rebuild path constructs a headerless entry (apiKey omitted when the
310
+ // CLI did not resolve a new key).
311
+ if (
312
+ !enforceAuthMode ||
313
+ readEntryAuthMode(section[serverName]) === readEntryAuthMode(entry)
314
+ ) {
315
+ return { config: existing, alreadyExists: true };
323
316
  }
324
-
325
- return {
326
- config: writeConfigSection(existing, configKey, {
327
- ...section,
328
- [serverName]: entry,
329
- }),
330
- alreadyExists: false,
331
- };
317
+ }
318
+
319
+ return {
320
+ config: writeConfigSection(existing, configKey, {
321
+ ...section,
322
+ [serverName]: entry,
323
+ }),
324
+ alreadyExists: false,
325
+ };
332
326
  }
333
327
 
334
328
  export function removeJsonServerEntry({ config, configKey, serverName }) {
335
- const section = { ...readConfigSection(config, configKey) };
329
+ const section = { ...readConfigSection(config, configKey) };
336
330
 
337
- if (!(serverName in section)) {
338
- return { config: config || {}, changed: false };
339
- }
331
+ if (!(serverName in section)) {
332
+ return { config: config || {}, changed: false };
333
+ }
340
334
 
341
- delete section[serverName];
342
- return {
343
- config: writeConfigSection(config, configKey, section),
344
- changed: true,
345
- };
335
+ delete section[serverName];
336
+ return {
337
+ config: writeConfigSection(config, configKey, section),
338
+ changed: true,
339
+ };
346
340
  }
347
341
 
348
- export async function readTomlServerExists(filePath, serverName) {
349
- try {
350
- const raw = await readFile(filePath, "utf8");
351
- return raw.includes(`[mcp_servers.${serverName}]`);
352
- } catch {
353
- return false;
354
- }
355
- }
356
342
 
357
343
  export async function readTomlServerEntry(filePath, serverName) {
358
- let raw = "";
359
- try {
360
- raw = await readFile(filePath, "utf8");
361
- } catch {
362
- return { exists: false, url: null, authMode: "oauth" };
344
+ let raw = "";
345
+ try {
346
+ raw = await readFile(filePath, "utf8");
347
+ } catch {
348
+ return { exists: false, url: null, authMode: "oauth" };
349
+ }
350
+
351
+ let inTargetSection = false;
352
+ let inHeadersSection = false;
353
+ let exists = false;
354
+ let url = null;
355
+ let hasAuthorizationHeader = false;
356
+
357
+ for (const { line, inString, sectionPath: sectionName } of scanTomlLines(raw)) {
358
+ if (inString) continue;
359
+ const trimmed = line.trim();
360
+
361
+ if (sectionName) {
362
+ const isTargetServer = sectionName[0] === "mcp_servers" && sectionName[1] === serverName;
363
+ if (isTargetServer && sectionName.length === 2) {
364
+ exists = true;
365
+ inTargetSection = true;
366
+ inHeadersSection = false;
367
+ continue;
368
+ }
369
+
370
+ if (isTargetServer && sectionName.length === 3 && sectionName[2] === "http_headers") {
371
+ // The http_headers block is a nested child of the parent
372
+ // `[mcp_servers.<name>]` section. Its presence alone does NOT imply a
373
+ // usable entry exists — a partially-edited config can leave the
374
+ // child behind after the parent is deleted, and treating the orphan
375
+ // as "exists" would make appendTomlServer short-circuit and refuse
376
+ // to recreate the missing parent block on the next setup rerun. Only
377
+ // the parent header toggles `exists`; here we just capture the
378
+ // headers subsection for auth-mode detection.
379
+ inTargetSection = false;
380
+ inHeadersSection = true;
381
+ continue;
382
+ }
383
+
384
+ // Never break out of the scan loop: TOML permits declaring tables in
385
+ // any order, so `[mcp_servers.<name>.http_headers]` is free to appear
386
+ // after an unrelated intermediate table. Breaking at the first
387
+ // non-target sibling would miss the headers subsection in that
388
+ // layout, causing auth-mode misclassification (oauth when the entry
389
+ // actually carries a Bearer header) and silently defeating the
390
+ // enforceAuthMode contract on `--oauth` reruns.
391
+ inTargetSection = false;
392
+ inHeadersSection = false;
393
+ continue;
363
394
  }
364
395
 
365
- const normalized = normalizeLineEndings(raw);
366
- const lines = normalized.split("\n");
367
- const targetSection = `mcp_servers.${serverName}`;
368
- const headersSection = `${targetSection}.http_headers`;
369
- let inTargetSection = false;
370
- let inHeadersSection = false;
371
- let exists = false;
372
- let url = null;
373
- let hasAuthorizationHeader = false;
374
-
375
- for (const line of lines) {
376
- const trimmed = line.trim();
377
- const sectionName = parseTomlSectionName(trimmed);
378
-
379
- if (sectionName) {
380
- if (sectionName === targetSection) {
381
- exists = true;
382
- inTargetSection = true;
383
- inHeadersSection = false;
384
- continue;
385
- }
386
-
387
- if (sectionName === headersSection) {
388
- // The http_headers block is a nested child of the parent
389
- // `[mcp_servers.<name>]` section. Its presence alone does NOT imply a
390
- // usable entry exists — a partially-edited config can leave the
391
- // child behind after the parent is deleted, and treating the orphan
392
- // as "exists" would make appendTomlServer short-circuit and refuse
393
- // to recreate the missing parent block on the next setup rerun. Only
394
- // the parent header toggles `exists`; here we just capture the
395
- // headers subsection for auth-mode detection.
396
- inTargetSection = false;
397
- inHeadersSection = true;
398
- continue;
399
- }
400
-
401
- // Never break out of the scan loop: TOML permits declaring tables in
402
- // any order, so `[mcp_servers.<name>.http_headers]` is free to appear
403
- // after an unrelated intermediate table. Breaking at the first
404
- // non-target sibling would miss the headers subsection in that
405
- // layout, causing auth-mode misclassification (oauth when the entry
406
- // actually carries a Bearer header) and silently defeating the
407
- // enforceAuthMode contract on `--oauth` reruns.
408
- inTargetSection = false;
409
- inHeadersSection = false;
410
- continue;
411
- }
412
-
413
- if (inTargetSection) {
414
- const withoutComment = stripTomlInlineComment(trimmed);
415
- const urlMatch = withoutComment.match(/^url\s*=\s*(.+)$/);
416
- if (urlMatch) {
417
- url = parseTomlStringValue(urlMatch[1]);
418
- }
419
- }
420
-
421
- if (inHeadersSection) {
422
- const withoutComment = stripTomlInlineComment(trimmed);
423
- if (/^Authorization\s*=\s*/.test(withoutComment)) {
424
- hasAuthorizationHeader = true;
425
- }
426
- }
396
+ if (inTargetSection) {
397
+ const withoutComment = stripTomlInlineComment(trimmed);
398
+ const urlMatch = withoutComment.match(/^url\s*=\s*(.+)$/);
399
+ if (urlMatch) {
400
+ url = parseTomlStringValue(urlMatch[1]);
401
+ }
427
402
  }
428
403
 
429
- return {
430
- exists,
431
- url,
432
- authMode: hasAuthorizationHeader ? "api-key" : "oauth",
433
- };
434
- }
435
-
436
- export function buildTomlServerBlock(serverName, entry) {
437
- const lines = [`[mcp_servers.${serverName}]`];
438
- const headers =
439
- entry && typeof entry.headers === "object" && entry.headers !== null
440
- ? entry.headers
441
- : null;
442
-
443
- for (const [key, value] of Object.entries(entry || {})) {
444
- if (key === "headers") continue;
445
- lines.push(`${key} = ${JSON.stringify(value)}`);
404
+ if (inHeadersSection) {
405
+ const withoutComment = stripTomlInlineComment(trimmed);
406
+ if (/^Authorization\s*=\s*/.test(withoutComment)) {
407
+ hasAuthorizationHeader = true;
408
+ }
446
409
  }
410
+ }
447
411
 
448
- if (headers && Object.keys(headers).length > 0) {
449
- lines.push("");
450
- lines.push(`[mcp_servers.${serverName}.http_headers]`);
451
- for (const [headerKey, headerValue] of Object.entries(headers)) {
452
- lines.push(`${headerKey} = ${JSON.stringify(String(headerValue))}`);
453
- }
454
- }
412
+ return {
413
+ exists,
414
+ url,
415
+ authMode: hasAuthorizationHeader ? "api-key" : "oauth",
416
+ };
417
+ }
455
418
 
456
- return `${lines.join("\n")}\n`;
419
+ export function buildTomlServerBlock(serverName, entry) {
420
+ const { headers, ...properties } = entry || {};
421
+ if (headers && typeof headers === "object" && Object.keys(headers).length > 0) {
422
+ properties.http_headers = Object.fromEntries(
423
+ Object.entries(headers).map(([key, value]) => [key, String(value)]),
424
+ );
425
+ }
426
+ return `${stringifyToml({ mcp_servers: { [serverName]: properties } }).trimEnd()}\n`;
457
427
  }
458
428
 
459
429
  export async function appendTomlServer(
460
- filePath,
461
- serverName,
462
- entry,
463
- { enforceAuthMode = false } = {},
430
+ filePath,
431
+ serverName,
432
+ entry,
433
+ { enforceAuthMode = false, privateConfig = false, replaceExisting = false } = {},
464
434
  ) {
465
- const existingEntry = await readTomlServerEntry(filePath, serverName);
466
- const newAuthMode = readEntryAuthMode(entry);
467
-
468
- if (existingEntry.exists) {
469
- // Mirror `mergeServerEntry`'s `enforceAuthMode` contract: preserve the
470
- // existing block on passive reruns, and only reconcile the Authorization
471
- // header when the caller explicitly toggled auth mode via `--oauth` or
472
- // `--api-key`.
473
- if (!enforceAuthMode || existingEntry.authMode === newAuthMode) {
474
- await secureFileMode(filePath);
475
- return { alreadyExists: true };
476
- }
477
- }
478
-
479
- let existing = "";
435
+ if (privateConfig) await preparePrivateConfigPath(filePath);
436
+ let existing = "";
437
+ try {
438
+ existing = await readFile(filePath, "utf8");
439
+ } catch (error) {
440
+ if (error?.code !== "ENOENT") throw error;
441
+ }
442
+ if (privateConfig) {
443
+ let current;
480
444
  try {
481
- existing = await readFile(filePath, "utf8");
445
+ current = parseToml(existing).mcp_servers?.[serverName];
482
446
  } catch {
483
- existing = "";
447
+ throw new Error("Private credential configuration contains invalid TOML.");
484
448
  }
485
-
486
- // Always strip before appending on the write path. Two cases motivate an
487
- // unconditional strip:
488
- // 1. Auth-mode toggle (api-key ↔ oauth) with the parent section present:
489
- // without this, the prior block stays and we'd produce duplicate
490
- // `[mcp_servers.<name>]` sections.
491
- // 2. Partially-edited config with an orphan
492
- // `[mcp_servers.<name>.http_headers]` subsection but no parent: the
493
- // orphan would otherwise coexist with the freshly-appended parent,
494
- // carrying stale Authorization headers into the rewritten entry.
495
- // `stripCodexTomlServerBlock` is a no-op when neither the parent nor any
496
- // child is present (returns `removed: false`), so it is safe to call
497
- // unconditionally on the append path.
498
- const { stripped } = stripCodexTomlServerBlock({
499
- tomlText: existing,
500
- serverName,
501
- });
502
- existing = stripped;
503
-
504
- const block = buildTomlServerBlock(serverName, entry);
505
- const separator =
506
- existing.length > 0 && !existing.endsWith("\n")
507
- ? "\n\n"
508
- : existing.length > 0
509
- ? "\n"
510
- : "";
511
- await writeSecureFile(filePath, `${existing}${separator}${block}`);
512
- return { alreadyExists: false };
449
+ if (current) {
450
+ if (current.url === entry.url &&
451
+ current.http_headers?.Authorization === entry.headers?.Authorization) {
452
+ return { alreadyExists: true };
453
+ }
454
+ if (!replaceExisting) {
455
+ throw new Error("A different Flywheel Codex entry exists; reconcile it or explicitly use --force. Revoke the unused issued key before retrying.");
456
+ }
457
+ }
458
+ }
459
+ const existingEntry = privateConfig
460
+ ? { exists: false }
461
+ : await readTomlServerEntry(filePath, serverName);
462
+ const newAuthMode = readEntryAuthMode(entry);
463
+
464
+ if (existingEntry.exists) {
465
+ // Mirror `mergeServerEntry`'s `enforceAuthMode` contract: preserve the
466
+ // existing block on passive reruns, and only reconcile the Authorization
467
+ // header when the caller explicitly toggled auth mode via `--oauth` or
468
+ // `--api-key`.
469
+ if (!enforceAuthMode || existingEntry.authMode === newAuthMode) {
470
+ await secureFileMode(filePath);
471
+ return { alreadyExists: true };
472
+ }
473
+ }
474
+
475
+
476
+ // Always strip before appending on the write path. Two cases motivate an
477
+ // unconditional strip:
478
+ // 1. Auth-mode toggle (api-key ↔ oauth) with the parent section present:
479
+ // without this, the prior block stays and we'd produce duplicate
480
+ // `[mcp_servers.<name>]` sections.
481
+ // 2. Partially-edited config with an orphan
482
+ // `[mcp_servers.<name>.http_headers]` subsection but no parent: the
483
+ // orphan would otherwise coexist with the freshly-appended parent,
484
+ // carrying stale Authorization headers into the rewritten entry.
485
+ // `stripCodexTomlServerBlock` is a no-op when neither the parent nor any
486
+ // child is present (returns `removed: false`), so it is safe to call
487
+ // unconditionally on the append path.
488
+ const { stripped } = stripCodexTomlServerBlock({
489
+ tomlText: existing,
490
+ serverName,
491
+ });
492
+ existing = stripped;
493
+
494
+ const block = buildTomlServerBlock(serverName, entry);
495
+ const separator =
496
+ existing.length > 0 && !existing.endsWith("\n")
497
+ ? "\n\n"
498
+ : existing.length > 0
499
+ ? "\n"
500
+ : "";
501
+ await writeSecureFile(filePath, `${existing}${separator}${block}`, undefined, undefined, {
502
+ atomic: privateConfig,
503
+ });
504
+ return { alreadyExists: false };
513
505
  }
514
506
 
515
507
  function stripCodexTomlServerBlock({ tomlText, serverName }) {
516
- const normalized = normalizeLineEndings(tomlText || "");
517
- const lines = normalized.split("\n");
518
- const output = [];
519
- let skipping = false;
520
- let removed = false;
521
-
522
- for (const line of lines) {
523
- const trimmed = line.trim();
524
- const sectionName = parseTomlSectionName(trimmed);
525
-
526
- if (sectionName) {
527
- const isTargetSection =
528
- sectionName === `mcp_servers.${serverName}` ||
529
- sectionName.startsWith(`mcp_servers.${serverName}.`);
530
- if (isTargetSection) {
531
- skipping = true;
532
- removed = true;
533
- continue;
534
- }
535
- if (skipping) {
536
- skipping = false;
537
- }
538
- }
539
-
540
- if (!skipping) {
541
- output.push(line);
542
- }
508
+ const output = [];
509
+ let skipping = false;
510
+ let removed = false;
511
+
512
+ for (const { line, sectionPath: sectionName } of scanTomlLines(tomlText || "")) {
513
+
514
+ if (sectionName) {
515
+ const isTargetSection = sectionName[0] === "mcp_servers" && sectionName[1] === serverName;
516
+ if (isTargetSection) {
517
+ skipping = true;
518
+ removed = true;
519
+ continue;
520
+ }
521
+ if (skipping) {
522
+ skipping = false;
523
+ }
543
524
  }
544
525
 
545
- // Lossless when nothing matched: callers invoke this on the append path
546
- // unconditionally, and the compaction below (blank-line collapsing +
547
- // trimEnd + trailing newline) would otherwise mutate unrelated TOML —
548
- // most notably the blank lines inside multiline `"""..."""` values and
549
- // any trailing whitespace a user deliberately kept.
550
- if (!removed) {
551
- return { stripped: tomlText || "", removed: false };
526
+ if (!skipping) {
527
+ output.push(line);
552
528
  }
529
+ }
553
530
 
554
- let stripped = output.join("\n");
555
- stripped = stripped.replace(/\n{3,}/g, "\n\n").trimEnd();
556
- if (stripped.length > 0) stripped += "\n";
557
- return { stripped, removed };
531
+ if (!removed) {
532
+ return { stripped: tomlText || "", removed: false };
533
+ }
534
+
535
+ return { stripped: output.join("\n"), removed };
558
536
  }
559
537
 
560
538
  export async function removeCodexTomlServer({ filePath, serverName }) {
561
- let existing = "";
562
- try {
563
- existing = await readFile(filePath, "utf8");
564
- } catch {
565
- return { changed: false };
566
- }
567
-
568
- const { stripped, removed } = stripCodexTomlServerBlock({
569
- tomlText: existing,
570
- serverName,
571
- });
572
- if (!removed) return { changed: false };
539
+ let existing = "";
540
+ try {
541
+ existing = await readFile(filePath, "utf8");
542
+ } catch {
543
+ return { changed: false };
544
+ }
545
+
546
+ const { stripped, removed } = stripCodexTomlServerBlock({
547
+ tomlText: existing,
548
+ serverName,
549
+ });
550
+ if (!removed) return { changed: false };
573
551
 
574
- await writeSecureFile(filePath, stripped);
575
- return { changed: true };
552
+ await writeSecureFile(filePath, stripped);
553
+ return { changed: true };
576
554
  }