@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.
- package/README.md +67 -10
- package/package.json +14 -6
- package/skills/flywheel/SKILL.md +9 -6
- package/skills/flywheel/example-workflows/organizing-exploring-and-iterating-on-a-research-topic.md +38 -46
- package/skills/flywheel/example-workflows/reproducing-papers-on-a-budget.md +34 -36
- package/skills/flywheel/getting-started/flywheel-quickstart.md +2 -5
- package/skills/flywheel/references/INTERFACES.md +2 -2
- package/skills/flywheel/references/experiment-design-protocol.md +32 -25
- package/skills/flywheel/references/flywheel-cli-tool-map.md +120 -76
- package/skills/flywheel/references/flywheel-mcp-tool-map.md +42 -32
- package/skills/flywheel/setting-up-flywheel/claude-code-cli-installation.md +1 -1
- package/skills/flywheel/setting-up-flywheel/codex-cli-installation.md +1 -1
- package/skills/flywheel/setting-up-flywheel/installation-overview.md +2 -6
- package/skills/flywheel/setting-up-flywheel/other-hosts-installation.md +45 -25
- package/skills/flywheel/setting-up-flywheel/updating-flywheel-mcp.md +34 -11
- package/skills/flywheel-auto/SKILL.md +40 -23
- package/skills/flywheel-auto/evals/evals.json +1 -1
- package/skills/flywheel-auto/references/INTERFACES.md +2 -2
- package/skills/flywheel-auto/references/experiment-design-protocol.md +31 -23
- package/skills/flywheel-auto/references/flywheel-cli-tool-map.md +172 -127
- package/skills/flywheel-auto/references/flywheel-mcp-tool-map.md +22 -24
- package/skills/flywheel-lookahead/SKILL.md +47 -28
- package/skills/flywheel-lookahead/agents/openai.yaml +1 -1
- package/skills/flywheel-lookahead/evals/evals.json +6 -6
- package/skills/flywheel-lookahead/references/INTERFACES.md +2 -2
- package/skills/flywheel-lookahead/references/flywheel-cli-tool-map.md +172 -127
- package/skills/flywheel-lookahead/references/flywheel-mcp-tool-map.md +22 -24
- package/skills/flywheel-prove/SKILL.md +2 -2
- package/skills/flywheel-prove/references/workflow.md +21 -2
- package/skills/flywheel-reproduce/SKILL.md +39 -19
- package/skills/flywheel-reproduce/evals/evals.json +1 -1
- package/skills/flywheel-reproduce/references/INTERFACES.md +2 -2
- package/skills/flywheel-reproduce/references/experiment-design-protocol.md +31 -23
- package/skills/flywheel-reproduce/references/flywheel-cli-tool-map.md +172 -127
- package/skills/flywheel-reproduce/references/flywheel-mcp-tool-map.md +22 -24
- package/skills/flywheel-to-graph/SKILL.md +37 -17
- package/skills/flywheel-to-graph/references/INTERFACES.md +2 -2
- package/skills/flywheel-to-graph/references/flywheel-cli-tool-map.md +172 -127
- package/skills/flywheel-to-graph/references/flywheel-mcp-tool-map.md +22 -24
- package/skills/flywheel-tree/references/workflow.md +6 -37
- package/src/cli.mjs +1145 -1141
- package/src/mcp-writer.mjs +413 -435
- package/src/public-command-metadata.mjs +28 -5
- package/src/runtime/delegate.mjs +2 -19
- package/src/runtime/required-runtime-commands.json +80 -28
- package/src/runtime/runtime-config.mjs +39 -60
- package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js +330 -0
- package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/auth/login.js +90 -139
- package/src/runtime/vendor/flywheel-cli-dist/auth/login.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js +116 -0
- package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js +248 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js +65 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js +17 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js +3 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js +12 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js +29 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js +12 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js +46 -10
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/env.js +17 -40
- package/src/runtime/vendor/flywheel-cli-dist/commands/env.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js +305 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js +72 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js +286 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js +30 -5
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/help.js +27 -12
- package/src/runtime/vendor/flywheel-cli-dist/commands/help.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js +284 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js +169 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js +13 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js +227 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/index.js +21 -51
- package/src/runtime/vendor/flywheel-cli-dist/commands/index.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js +25 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js +11 -9
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js +38 -45
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js +14 -17
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js +13 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js +34 -3
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js +9 -9
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js +76 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js +4 -138
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js +8 -13
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js +362 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js +45 -183
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js +47 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js +181 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js +163 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js +79 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js +80 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js +78 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/types.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js +3 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/config/index.js +5 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/index.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/io.js +139 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/io.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/migration.js +299 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/migration.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/model.js +214 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/model.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/path.js +30 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/path.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/credential-output.js +29 -0
- package/src/runtime/vendor/flywheel-cli-dist/credential-output.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/errors.js +1 -16
- package/src/runtime/vendor/flywheel-cli-dist/errors.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js +3 -3
- package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js +19 -9
- package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js +33 -4
- package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/http/client.js +322 -304
- package/src/runtime/vendor/flywheel-cli-dist/http/client.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/http/debug.js +1 -21
- package/src/runtime/vendor/flywheel-cli-dist/http/debug.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/http/retry.js +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/http/retry.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js +244 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js +7 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js +35 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js +42 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js +179 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js +152 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js +71 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js +73 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js +82 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js +345 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js +57 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js +149 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js +115 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js +44 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js +159 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js +346 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js +37 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js +203 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js +207 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js +109 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js +61 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js +46 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js +203 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js +44 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js +188 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js +54 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js +25 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js +7 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js +129 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js +277 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js +183 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js +121 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js +16 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js +72 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js +59 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js +125 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js +129 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js +31 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js +49 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js +30 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js +12 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js +18 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js +125 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js +37 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js +44 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js +58 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js +118 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js +277 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js +132 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js +372 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js +210 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js +278 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js +192 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js +114 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js +65 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js +145 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js +218 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js +71 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js +298 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js +121 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js +69 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js +49 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js +424 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js +10 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/001_initial.sql +319 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/002_staged_latest_values.sql +8 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/003_remove_cli_editing_lease.sql +21 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/004_hosted_association.sql +7 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/005_artifact_properties.sql +68 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js +12 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js +410 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js +77 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js +240 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js +127 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js +107 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js +80 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js +219 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js +164 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js +20 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js +41 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js +22 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js +188 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js +5 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js +214 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js +4 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js +44 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js +38 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js +284 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js +133 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js +98 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js +161 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js +97 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js +69 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/main.js +651 -376
- package/src/runtime/vendor/flywheel-cli-dist/main.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/output/format.js +18 -11
- package/src/runtime/vendor/flywheel-cli-dist/output/format.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-x64/node.napi.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.glibc.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.musl.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/src/runtime/vendor/manifest.json +246 -257
- package/src/setup/command.mjs +5 -0
- package/src/setup/io/patchers/json.mjs +1 -1
- package/src/setup/io/patchers/toml.mjs +3 -1
- package/src/setup/io/patchers/yaml.mjs +1 -1
- package/src/setup/modes/cli.mjs +76 -7
- package/src/setup/modes/mcp-command.mjs +802 -793
- package/src/setup/modes/mcp.mjs +7 -3
- package/src/setup/shared/prior-mode-detect.mjs +18 -21
- package/src/setup/test-seams.mjs +25 -0
- package/src/setup-auth.mjs +76 -10
- package/src/toml-lines.mjs +52 -0
- package/src/unified-cli.mjs +31 -16
- package/skills/flywheel-llm-proof-paper/scripts/__pycache__/check_paper.cpython-312.pyc +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/auth/active-key-id.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/baseurl.d.ts +0 -35
- package/src/runtime/vendor/flywheel-cli-dist/auth/config.d.ts +0 -34
- package/src/runtime/vendor/flywheel-cli-dist/auth/config.js +0 -92
- package/src/runtime/vendor/flywheel-cli-dist/auth/config.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/fingerprint.d.ts +0 -5
- package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.d.ts +0 -4
- package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js +0 -31
- package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/login.d.ts +0 -24
- package/src/runtime/vendor/flywheel-cli-dist/auth/profile.d.ts +0 -15
- package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js +0 -150
- package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.d.ts +0 -27
- package/src/runtime/vendor/flywheel-cli-dist/commands/_admin-auth.d.ts +0 -27
- package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.d.ts +0 -32
- package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js +0 -213
- package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.d.ts +0 -35
- package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/_secret-param.d.ts +0 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-file-out.d.ts +0 -39
- package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-writer.d.ts +0 -34
- package/src/runtime/vendor/flywheel-cli-dist/commands/_wait-polling.d.ts +0 -50
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-detach.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-add.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-remove.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-set-primary.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-preview.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-proof.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export-stream.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-list.d.ts +0 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-nodes-audit-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.d.ts +0 -13
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-list.d.ts +0 -18
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-rotate.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-expire.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-heartbeat.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js +0 -22
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js +0 -9
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js +0 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js +0 -15
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js +0 -5
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js +0 -30
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-mode.d.ts +0 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/blobs-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-list.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-revoke.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-update.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-snapshot.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-acquire.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-budgets.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-connection.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-funding.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-request-approval.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-options.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release-all.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-status.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-balance.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-billing-portal.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-purchase.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral-claim.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscribe.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscription.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-transactions.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-usage.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/destructive-confirmation.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/enums.d.ts +0 -22
- package/src/runtime/vendor/flywheel-cli-dist/commands/env.d.ts +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/executions-launch.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/executions-list.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/executions-terminate.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-history.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-subgraph.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-pdf.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-render-pdf.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-stream.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/feedback-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/files-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-disconnect.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-link.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-refresh-repos.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-status.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/handler-factory.d.ts +0 -22
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-format.d.ts +0 -31
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.d.ts +0 -36
- package/src/runtime/vendor/flywheel-cli-dist/commands/help.d.ts +0 -17
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-delete.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-runs-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-delete.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-list.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-update.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-set-enabled.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-update.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/import-subgraph.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/index.d.ts +0 -23
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-remove.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-status.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-remove.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/machines-list.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js +0 -15
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js +0 -10
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js +0 -6
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js +0 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js +0 -6
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js +0 -16
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js +0 -11
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-files.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js +0 -33
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js +0 -15
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-ancestry.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-summary.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-tree.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-resolve-slug.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-get.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set-bulk.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-summaries.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-acquire.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-heartbeat.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-release.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/account.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.d.ts +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/api-keys.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/approval.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js +0 -140
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/budgets.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/compute.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/credits.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/env.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/executions.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/export.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/github.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/graph.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hooks.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/integrations.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/resources.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/sharing.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js +0 -98
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/updates.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry.d.ts +0 -27
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-refresh.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-resolve.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js +0 -25
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js +0 -25
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js +0 -11
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js +0 -28
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/types.d.ts +0 -30
- package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide-all-active.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/updates-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.d.ts +0 -6
- package/src/runtime/vendor/flywheel-cli-dist/commands/utils.d.ts +0 -11
- package/src/runtime/vendor/flywheel-cli-dist/errors.d.ts +0 -86
- package/src/runtime/vendor/flywheel-cli-dist/exit-codes.d.ts +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/generatedFeedbackContract.d.ts +0 -41
- package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.d.ts +0 -13
- package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.d.ts +0 -26
- package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.d.ts +0 -17
- package/src/runtime/vendor/flywheel-cli-dist/http/client.d.ts +0 -91
- package/src/runtime/vendor/flywheel-cli-dist/http/debug.d.ts +0 -5
- package/src/runtime/vendor/flywheel-cli-dist/http/poll.d.ts +0 -18
- package/src/runtime/vendor/flywheel-cli-dist/http/retry.d.ts +0 -30
- package/src/runtime/vendor/flywheel-cli-dist/main.d.ts +0 -33
- package/src/runtime/vendor/flywheel-cli-dist/output/format.d.ts +0 -9
- package/src/runtime/vendor/flywheel-cli-dist/runtime-entry.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/version.d.ts +0 -3
- package/src/secure-write.mjs +0 -43
package/src/mcp-writer.mjs
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
70
|
-
|
|
40
|
+
for (let index = 0; index < valueText.length; index += 1) {
|
|
41
|
+
const char = valueText[index];
|
|
71
42
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return null;
|
|
43
|
+
if (escapeNextChar) {
|
|
44
|
+
escapeNextChar = false;
|
|
45
|
+
continue;
|
|
76
46
|
}
|
|
77
47
|
|
|
78
|
-
if (
|
|
79
|
-
|
|
48
|
+
if (inDoubleQuotedString && char === "\\") {
|
|
49
|
+
escapeNextChar = true;
|
|
50
|
+
continue;
|
|
80
51
|
}
|
|
81
52
|
|
|
82
|
-
if (
|
|
83
|
-
|
|
53
|
+
if (!inDoubleQuotedString && char === "'") {
|
|
54
|
+
inSingleQuotedString = !inSingleQuotedString;
|
|
55
|
+
continue;
|
|
84
56
|
}
|
|
85
57
|
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
} catch {
|
|
90
|
-
return stripped.slice(1, -1);
|
|
91
|
-
}
|
|
58
|
+
if (!inSingleQuotedString && char === '"') {
|
|
59
|
+
inDoubleQuotedString = !inDoubleQuotedString;
|
|
60
|
+
continue;
|
|
92
61
|
}
|
|
93
62
|
|
|
94
|
-
if (
|
|
95
|
-
|
|
63
|
+
if (!inSingleQuotedString && !inDoubleQuotedString && char === "#") {
|
|
64
|
+
return valueText.slice(0, index).trim();
|
|
96
65
|
}
|
|
66
|
+
}
|
|
97
67
|
|
|
98
|
-
|
|
68
|
+
return valueText.trim();
|
|
99
69
|
}
|
|
100
70
|
|
|
101
|
-
export function
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return
|
|
105
|
-
}
|
|
71
|
+
export function parseTomlStringValue(valueText) {
|
|
72
|
+
const stripped = stripTomlInlineComment(valueText);
|
|
73
|
+
if (!stripped) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
106
76
|
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
87
|
+
return JSON.parse(stripped);
|
|
111
88
|
} catch {
|
|
112
|
-
|
|
89
|
+
return stripped.slice(1, -1);
|
|
113
90
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
114
|
+
await writeSecureFile(filePath, `${JSON.stringify(config, null, 2)}\n`);
|
|
121
115
|
}
|
|
122
116
|
|
|
123
117
|
export async function readYamlConfig(filePath) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
139
|
+
await writeSecureFile(filePath, dumpYaml(config, { noRefs: true }));
|
|
146
140
|
}
|
|
147
141
|
|
|
148
142
|
export async function resolveMcpPath(candidates) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
236
|
+
return Array.isArray(configKey) ? configKey : [configKey];
|
|
243
237
|
}
|
|
244
238
|
|
|
245
239
|
function readConfigSection(config, configKey) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
-
|
|
255
|
+
current = next;
|
|
256
|
+
}
|
|
257
|
+
return current;
|
|
264
258
|
}
|
|
265
259
|
|
|
266
260
|
export function readNamedConfigEntry(config, configKey, serverName) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
293
|
+
existing,
|
|
294
|
+
configKey,
|
|
295
|
+
serverName,
|
|
296
|
+
entry,
|
|
297
|
+
{ enforceAuthMode = false } = {},
|
|
304
298
|
) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
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
|
-
|
|
329
|
+
const section = { ...readConfigSection(config, configKey) };
|
|
336
330
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
331
|
+
if (!(serverName in section)) {
|
|
332
|
+
return { config: config || {}, changed: false };
|
|
333
|
+
}
|
|
340
334
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
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
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
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
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
412
|
+
return {
|
|
413
|
+
exists,
|
|
414
|
+
url,
|
|
415
|
+
authMode: hasAuthorizationHeader ? "api-key" : "oauth",
|
|
416
|
+
};
|
|
417
|
+
}
|
|
455
418
|
|
|
456
|
-
|
|
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
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
430
|
+
filePath,
|
|
431
|
+
serverName,
|
|
432
|
+
entry,
|
|
433
|
+
{ enforceAuthMode = false, privateConfig = false, replaceExisting = false } = {},
|
|
464
434
|
) {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
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
|
-
|
|
445
|
+
current = parseToml(existing).mcp_servers?.[serverName];
|
|
482
446
|
} catch {
|
|
483
|
-
|
|
447
|
+
throw new Error("Private credential configuration contains invalid TOML.");
|
|
484
448
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
existing
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
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
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
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
|
-
|
|
546
|
-
|
|
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
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
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
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
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
|
-
|
|
575
|
-
|
|
552
|
+
await writeSecureFile(filePath, stripped);
|
|
553
|
+
return { changed: true };
|
|
576
554
|
}
|