@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
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
2
|
+
import { close, fstat, openDirectory, openDirectoryAt, statAt, } from "./native.js";
|
|
3
|
+
const DIRECTORY_TYPE = 0o040000;
|
|
4
|
+
const FILE_TYPE_MASK = 0o170000;
|
|
5
|
+
function invalidState() {
|
|
6
|
+
return new Error("repository_runtime_state_invalid");
|
|
7
|
+
}
|
|
8
|
+
function matchesIdentity(actual, expected) {
|
|
9
|
+
return actual.dev === expected.dev && actual.ino === expected.ino;
|
|
10
|
+
}
|
|
11
|
+
function assertDirectoryEntry(parentFd, name, expected) {
|
|
12
|
+
const current = statAt(parentFd, name);
|
|
13
|
+
if ((current.mode & FILE_TYPE_MASK) !== DIRECTORY_TYPE || !matchesIdentity(current, expected)) {
|
|
14
|
+
throw invalidState();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Retains one repository root and its `.flywheel` directory for one command. */
|
|
18
|
+
export class RetainedRepositoryState {
|
|
19
|
+
rootPath;
|
|
20
|
+
statePath;
|
|
21
|
+
rootFd;
|
|
22
|
+
stateFd;
|
|
23
|
+
#parentFd;
|
|
24
|
+
#parentIdentity;
|
|
25
|
+
#rootIdentity;
|
|
26
|
+
#stateIdentity;
|
|
27
|
+
#completion;
|
|
28
|
+
deferCompletion(callbacks) {
|
|
29
|
+
if (this.#completion !== undefined)
|
|
30
|
+
throw new Error("repository command completion is already registered");
|
|
31
|
+
this.#completion = callbacks;
|
|
32
|
+
}
|
|
33
|
+
async complete(success) {
|
|
34
|
+
const callbacks = this.#completion;
|
|
35
|
+
this.#completion = undefined;
|
|
36
|
+
if (callbacks !== undefined)
|
|
37
|
+
await (success ? callbacks.success() : callbacks.failure());
|
|
38
|
+
}
|
|
39
|
+
constructor(rootPath, parentFd, rootFd, stateFd) {
|
|
40
|
+
this.rootPath = rootPath;
|
|
41
|
+
this.statePath = join(rootPath, ".flywheel");
|
|
42
|
+
this.#parentFd = parentFd;
|
|
43
|
+
this.rootFd = rootFd;
|
|
44
|
+
this.stateFd = stateFd;
|
|
45
|
+
this.#parentIdentity = fstat(parentFd);
|
|
46
|
+
this.#rootIdentity = fstat(rootFd);
|
|
47
|
+
this.#stateIdentity = fstat(stateFd);
|
|
48
|
+
}
|
|
49
|
+
static open(rootPath) {
|
|
50
|
+
const absoluteRoot = resolve(rootPath);
|
|
51
|
+
const rootName = basename(absoluteRoot);
|
|
52
|
+
if (rootName.length === 0)
|
|
53
|
+
throw invalidState();
|
|
54
|
+
let parentFd = -1;
|
|
55
|
+
let rootFd = -1;
|
|
56
|
+
let stateFd = -1;
|
|
57
|
+
try {
|
|
58
|
+
parentFd = openDirectory(dirname(absoluteRoot));
|
|
59
|
+
rootFd = openDirectoryAt(parentFd, rootName);
|
|
60
|
+
stateFd = openDirectoryAt(rootFd, ".flywheel");
|
|
61
|
+
const state = new RetainedRepositoryState(absoluteRoot, parentFd, rootFd, stateFd);
|
|
62
|
+
state.assertValid();
|
|
63
|
+
return state;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
for (const fd of [stateFd, rootFd, parentFd]) {
|
|
67
|
+
try {
|
|
68
|
+
if (fd >= 0)
|
|
69
|
+
close(fd);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// The original state-open failure is the public error.
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (error instanceof Error && error.message === "repository_runtime_state_invalid")
|
|
76
|
+
throw error;
|
|
77
|
+
throw invalidState();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
assertValid() {
|
|
81
|
+
let currentParentFd = -1;
|
|
82
|
+
let validationFailed = false;
|
|
83
|
+
let validationError;
|
|
84
|
+
try {
|
|
85
|
+
currentParentFd = openDirectory(dirname(this.rootPath));
|
|
86
|
+
if (!matchesIdentity(fstat(currentParentFd), this.#parentIdentity))
|
|
87
|
+
throw invalidState();
|
|
88
|
+
assertDirectoryEntry(this.#parentFd, basename(this.rootPath), this.#rootIdentity);
|
|
89
|
+
assertDirectoryEntry(this.rootFd, ".flywheel", this.#stateIdentity);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
validationFailed = true;
|
|
93
|
+
validationError = error instanceof Error && error.message === "repository_runtime_state_invalid"
|
|
94
|
+
? error
|
|
95
|
+
: invalidState();
|
|
96
|
+
}
|
|
97
|
+
let closeFailed = false;
|
|
98
|
+
try {
|
|
99
|
+
if (currentParentFd >= 0)
|
|
100
|
+
close(currentParentFd);
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
closeFailed = true;
|
|
104
|
+
}
|
|
105
|
+
if (validationFailed)
|
|
106
|
+
throw validationError;
|
|
107
|
+
if (closeFailed)
|
|
108
|
+
throw invalidState();
|
|
109
|
+
}
|
|
110
|
+
close() {
|
|
111
|
+
let closeFailed = false;
|
|
112
|
+
let closeError;
|
|
113
|
+
// Close every retained descriptor, but report only the first failure.
|
|
114
|
+
for (const fd of [this.stateFd, this.rootFd, this.#parentFd]) {
|
|
115
|
+
try {
|
|
116
|
+
close(fd);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
if (!closeFailed) {
|
|
120
|
+
closeFailed = true;
|
|
121
|
+
closeError = error;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (closeFailed)
|
|
126
|
+
throw closeError;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/local/fs/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EACL,KAAK,EACL,KAAK,EACL,aAAa,EACb,eAAe,EACf,MAAM,GAEP,MAAM,aAAa,CAAC;AAErB,MAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,MAAM,cAAc,GAAG,QAAQ,CAAC;AAOhC,SAAS,YAAY;IACnB,OAAO,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,eAAe,CAAC,MAAsB,EAAE,QAA4B;IAC3E,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC,GAAG,CAAC;AACpE,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAgB,EAAE,IAAY,EAAE,QAA4B;IACxF,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,cAAc,CAAC,KAAK,cAAc,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC9F,MAAM,YAAY,EAAE,CAAC;IACvB,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,MAAM,OAAO,uBAAuB;IACzB,QAAQ,CAAS;IACjB,SAAS,CAAS;IAClB,MAAM,CAAS;IACf,OAAO,CAAS;IAEhB,SAAS,CAAS;IAClB,eAAe,CAAqB;IACpC,aAAa,CAAqB;IAClC,cAAc,CAAqB;IAC5C,WAAW,CAA6E;IAExF,eAAe,CAAC,SAA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ypto";
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
+
import { close, fchmod, flockExclusiveNonblocking, flockUnlock, fstat, mkdirAt, openDirectory, openDirectoryAt, openLockAt, statAt, } from "./native.js";
|
|
5
|
+
import { RetainedRepositoryState } from "./state.js";
|
|
6
|
+
const DIRECTORY_TYPE = 0o040000;
|
|
7
|
+
const REGULAR_FILE_TYPE = 0o100000;
|
|
8
|
+
const FILE_TYPE_MASK = 0o170000;
|
|
9
|
+
const PRIVATE_DIRECTORY_MODE = 0o700;
|
|
10
|
+
const PRIVATE_FILE_MODE = 0o600;
|
|
11
|
+
export class RepositoryWriteGateBusyError extends Error {
|
|
12
|
+
constructor(cause) {
|
|
13
|
+
super("repository_locked", cause === undefined ? undefined : { cause });
|
|
14
|
+
this.name = "RepositoryWriteGateBusyError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function invalidLock(cause) {
|
|
18
|
+
return cause === undefined
|
|
19
|
+
? new Error("repository runtime lock is invalid")
|
|
20
|
+
: new Error("repository runtime lock is invalid", { cause });
|
|
21
|
+
}
|
|
22
|
+
function hasCode(error, ...codes) {
|
|
23
|
+
return typeof error === "object"
|
|
24
|
+
&& error !== null
|
|
25
|
+
&& "code" in error
|
|
26
|
+
&& typeof error.code === "string"
|
|
27
|
+
&& codes.includes(error.code);
|
|
28
|
+
}
|
|
29
|
+
function lockIdentity(stat) {
|
|
30
|
+
return { dev: stat.dev, ino: stat.ino };
|
|
31
|
+
}
|
|
32
|
+
function assertDirectoryIdentity(parentFd, name, expected) {
|
|
33
|
+
const current = statAt(parentFd, name);
|
|
34
|
+
if ((current.mode & FILE_TYPE_MASK) !== DIRECTORY_TYPE || current.dev !== expected.dev || current.ino !== expected.ino) {
|
|
35
|
+
throw new Error("repository_runtime_state_invalid");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function assertRegularLockIdentity(parentFd, name, expected) {
|
|
39
|
+
const current = statAt(parentFd, name);
|
|
40
|
+
if ((current.mode & FILE_TYPE_MASK) !== REGULAR_FILE_TYPE || current.dev !== expected.dev || current.ino !== expected.ino) {
|
|
41
|
+
throw invalidLock();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function openPrivateRun(state) {
|
|
45
|
+
try {
|
|
46
|
+
mkdirAt(state.stateFd, "run", PRIVATE_DIRECTORY_MODE);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (!hasCode(error, "EEXIST"))
|
|
50
|
+
throw new Error("repository_runtime_state_invalid", { cause: error });
|
|
51
|
+
}
|
|
52
|
+
let runFd = -1;
|
|
53
|
+
try {
|
|
54
|
+
runFd = openDirectoryAt(state.stateFd, "run");
|
|
55
|
+
fchmod(runFd, PRIVATE_DIRECTORY_MODE);
|
|
56
|
+
return runFd;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (runFd >= 0)
|
|
60
|
+
close(runFd);
|
|
61
|
+
throw new Error("repository_runtime_state_invalid", { cause: error });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function openPrivateLock(parentFd, name) {
|
|
65
|
+
let fd = -1;
|
|
66
|
+
try {
|
|
67
|
+
fd = openLockAt(parentFd, name);
|
|
68
|
+
fchmod(fd, PRIVATE_FILE_MODE);
|
|
69
|
+
const metadata = fstat(fd);
|
|
70
|
+
if ((metadata.mode & FILE_TYPE_MASK) !== REGULAR_FILE_TYPE)
|
|
71
|
+
throw invalidLock();
|
|
72
|
+
return { fd, identity: lockIdentity(metadata) };
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (fd >= 0)
|
|
76
|
+
close(fd);
|
|
77
|
+
if (hasCode(error, "EISDIR"))
|
|
78
|
+
throw invalidLock(error);
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function acquireLock(fd) {
|
|
83
|
+
try {
|
|
84
|
+
flockExclusiveNonblocking(fd);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (hasCode(error, "EAGAIN", "EWOULDBLOCK"))
|
|
88
|
+
throw new RepositoryWriteGateBusyError(error);
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Holds the existing repository state-directory and writer-file locks across one mutation. */
|
|
93
|
+
export async function withRepositoryWriter(rootPath, callback) {
|
|
94
|
+
const state = RetainedRepositoryState.open(rootPath);
|
|
95
|
+
let stateLocked = false;
|
|
96
|
+
let runFd = -1;
|
|
97
|
+
let writerFd = -1;
|
|
98
|
+
let writerLocked = false;
|
|
99
|
+
let runIdentity;
|
|
100
|
+
let writerIdentity;
|
|
101
|
+
let operationFailed = false;
|
|
102
|
+
let operationError;
|
|
103
|
+
let result;
|
|
104
|
+
try {
|
|
105
|
+
acquireLock(state.stateFd);
|
|
106
|
+
stateLocked = true;
|
|
107
|
+
runFd = openPrivateRun(state);
|
|
108
|
+
runIdentity = lockIdentity(fstat(runFd));
|
|
109
|
+
const writer = openPrivateLock(runFd, "writer.lock");
|
|
110
|
+
writerFd = writer.fd;
|
|
111
|
+
writerIdentity = writer.identity;
|
|
112
|
+
acquireLock(writerFd);
|
|
113
|
+
writerLocked = true;
|
|
114
|
+
assertRegularLockIdentity(runFd, "writer.lock", writerIdentity);
|
|
115
|
+
state.assertValid();
|
|
116
|
+
result = await callback(state);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
operationFailed = true;
|
|
120
|
+
operationError = error;
|
|
121
|
+
}
|
|
122
|
+
let cleanupFailed = false;
|
|
123
|
+
let cleanupError;
|
|
124
|
+
const captureCleanupError = (error) => {
|
|
125
|
+
if (!cleanupFailed) {
|
|
126
|
+
cleanupFailed = true;
|
|
127
|
+
cleanupError = error;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
if (writerLocked && writerIdentity !== undefined) {
|
|
131
|
+
try {
|
|
132
|
+
state.assertValid();
|
|
133
|
+
assertRegularLockIdentity(runFd, "writer.lock", writerIdentity);
|
|
134
|
+
if (runIdentity !== undefined)
|
|
135
|
+
assertDirectoryIdentity(state.stateFd, "run", runIdentity);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
captureCleanupError(error);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
await state.complete(!operationFailed && !cleanupFailed);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
captureCleanupError(error);
|
|
146
|
+
}
|
|
147
|
+
if (writerLocked) {
|
|
148
|
+
try {
|
|
149
|
+
flockUnlock(writerFd);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
captureCleanupError(error);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
for (const fd of [writerFd, runFd]) {
|
|
156
|
+
if (fd >= 0) {
|
|
157
|
+
try {
|
|
158
|
+
close(fd);
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
captureCleanupError(error);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (stateLocked) {
|
|
166
|
+
try {
|
|
167
|
+
flockUnlock(state.stateFd);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
captureCleanupError(error);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
state.close();
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
captureCleanupError(error);
|
|
178
|
+
}
|
|
179
|
+
if (operationFailed)
|
|
180
|
+
throw operationError;
|
|
181
|
+
if (cleanupFailed)
|
|
182
|
+
throw cleanupError;
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
185
|
+
/** Holds the persistent sidecar writer lock used before a repository state directory exists. */
|
|
186
|
+
export async function withBootstrapWriter(rootPath, callback) {
|
|
187
|
+
const requestedRoot = resolve(rootPath);
|
|
188
|
+
const rootName = basename(requestedRoot);
|
|
189
|
+
if (rootName.length === 0)
|
|
190
|
+
throw new Error("repository_runtime_state_invalid");
|
|
191
|
+
const parentPath = realpathSync(dirname(requestedRoot));
|
|
192
|
+
const absoluteRoot = join(parentPath, rootName);
|
|
193
|
+
const lockName = `${createHash("sha256").update(absoluteRoot, "utf8").digest("hex")}.lock`;
|
|
194
|
+
let parentFd = -1;
|
|
195
|
+
let lockDirectoryFd = -1;
|
|
196
|
+
let lockFd = -1;
|
|
197
|
+
let lockLocked = false;
|
|
198
|
+
let lockIdentity;
|
|
199
|
+
let lockDirectoryIdentity;
|
|
200
|
+
let operationFailed = false;
|
|
201
|
+
let operationError;
|
|
202
|
+
let result;
|
|
203
|
+
try {
|
|
204
|
+
parentFd = openDirectory(parentPath);
|
|
205
|
+
try {
|
|
206
|
+
mkdirAt(parentFd, ".flywheel-runtime-locks", PRIVATE_DIRECTORY_MODE);
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
if (!hasCode(error, "EEXIST"))
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
lockDirectoryFd = openDirectoryAt(parentFd, ".flywheel-runtime-locks");
|
|
213
|
+
fchmod(lockDirectoryFd, PRIVATE_DIRECTORY_MODE);
|
|
214
|
+
lockDirectoryIdentity = fstat(lockDirectoryFd);
|
|
215
|
+
assertDirectoryIdentity(parentFd, ".flywheel-runtime-locks", lockDirectoryIdentity);
|
|
216
|
+
const lock = openPrivateLock(lockDirectoryFd, lockName);
|
|
217
|
+
lockFd = lock.fd;
|
|
218
|
+
lockIdentity = lock.identity;
|
|
219
|
+
acquireLock(lockFd);
|
|
220
|
+
lockLocked = true;
|
|
221
|
+
assertRegularLockIdentity(lockDirectoryFd, lockName, lockIdentity);
|
|
222
|
+
assertDirectoryIdentity(parentFd, ".flywheel-runtime-locks", lockDirectoryIdentity);
|
|
223
|
+
result = await callback();
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
operationFailed = true;
|
|
227
|
+
operationError = error;
|
|
228
|
+
}
|
|
229
|
+
let cleanupFailed = false;
|
|
230
|
+
let cleanupError;
|
|
231
|
+
const captureCleanupError = (error) => {
|
|
232
|
+
if (!cleanupFailed) {
|
|
233
|
+
cleanupFailed = true;
|
|
234
|
+
cleanupError = error;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
if (lockDirectoryIdentity !== undefined) {
|
|
238
|
+
try {
|
|
239
|
+
assertDirectoryIdentity(parentFd, ".flywheel-runtime-locks", lockDirectoryIdentity);
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
captureCleanupError(error);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (lockLocked && lockIdentity !== undefined) {
|
|
246
|
+
try {
|
|
247
|
+
assertRegularLockIdentity(lockDirectoryFd, lockName, lockIdentity);
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
captureCleanupError(error);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (lockLocked) {
|
|
254
|
+
try {
|
|
255
|
+
flockUnlock(lockFd);
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
captureCleanupError(error);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
for (const fd of [lockFd, lockDirectoryFd, parentFd]) {
|
|
262
|
+
if (fd >= 0) {
|
|
263
|
+
try {
|
|
264
|
+
close(fd);
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
captureCleanupError(error);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (operationFailed)
|
|
272
|
+
throw operationError;
|
|
273
|
+
if (cleanupFailed)
|
|
274
|
+
throw cleanupError;
|
|
275
|
+
return result;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=writer-lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer-lock.js","sourceRoot":"","sources":["../../../src/local/fs/writer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C;IACD,IAAI,eAAe;QAAE,MAAM,cAAc,CAAC;IAC1C,IAAI,aAAa;QAAE,MAAM,YAAY,CAAC;IACtC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdirSync, realpathSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, isAbsolute, join } from "node:path";
|
|
4
|
+
import { close, fstat, fsync, listDirectory, mkdirAt, openDirectoryAt, renameNoReplaceAt, statAt } from "../fs/native.js";
|
|
5
|
+
import { RetainedRepositoryState } from "../fs/state.js";
|
|
6
|
+
import { withBootstrapWriter, withRepositoryWriter } from "../fs/writer-lock.js";
|
|
7
|
+
import { RetainedPrivateDirectory } from "../store/backup/retained-directory.js";
|
|
8
|
+
import { restoreRepositoryArchive } from "../store/backup/restore.js";
|
|
9
|
+
import { readRepositoryIdentity } from "../store/migration/steps.js";
|
|
10
|
+
import { withReadConnection } from "../store/sqlite/connection.js";
|
|
11
|
+
import { migrateLocalRepository } from "../store/migrate.js";
|
|
12
|
+
import { RepositoryObjectStorage } from "../store/objects.js";
|
|
13
|
+
import { SQLiteRepositoryStore } from "../store/sqlite/store.js";
|
|
14
|
+
import { isUuid } from "../domain/models/constants.js";
|
|
15
|
+
import { cloneIntoStore } from "./remote/clone.js";
|
|
16
|
+
import { localRuntimeIdentity } from "./identity.js";
|
|
17
|
+
function hasCode(error, code) {
|
|
18
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
19
|
+
}
|
|
20
|
+
export async function bootstrapRepository(operation, args, connection) {
|
|
21
|
+
await localRuntimeIdentity();
|
|
22
|
+
if (operation === "restore")
|
|
23
|
+
return restoreBootstrap(args);
|
|
24
|
+
const clone = operation === "clone";
|
|
25
|
+
const allowed = clone ? ["directory", "repository_id", "object_mode"] : ["directory", "adopt"];
|
|
26
|
+
if ((operation !== "init" && !clone) || Object.keys(args).some(key => !allowed.includes(key)) ||
|
|
27
|
+
typeof args.directory !== "string" || !isAbsolute(args.directory) ||
|
|
28
|
+
(clone ? !isUuid(args.repository_id) || (args.object_mode !== "lazy" && args.object_mode !== "all") : args.adopt !== undefined && typeof args.adopt !== "boolean")) {
|
|
29
|
+
throw new Error("repository_bootstrap_request_invalid");
|
|
30
|
+
}
|
|
31
|
+
if (clone && connection === undefined)
|
|
32
|
+
throw new Error("repository credential is unavailable");
|
|
33
|
+
const requestedTarget = args.directory;
|
|
34
|
+
mkdirSync(dirname(requestedTarget), { recursive: true, mode: 0o700 });
|
|
35
|
+
const target = requestedTarget;
|
|
36
|
+
return withBootstrapWriter(target, async () => {
|
|
37
|
+
const lockRoot = join(realpathSync(dirname(target)), basename(target));
|
|
38
|
+
const bootstrapLock = { path: join(dirname(lockRoot), ".flywheel-runtime-locks", `${createHash("sha256").update(lockRoot).digest("hex")}.lock`), retained: true };
|
|
39
|
+
const staging = RetainedPrivateDirectory.create(dirname(target), ".flywheel-bootstrap-");
|
|
40
|
+
let targetFd = -1;
|
|
41
|
+
try {
|
|
42
|
+
try {
|
|
43
|
+
const entry = statAt(staging.parentFd, basename(target));
|
|
44
|
+
if ((entry.mode & 0o170000) !== 0o040000)
|
|
45
|
+
throw new Error("repository_target_not_empty");
|
|
46
|
+
targetFd = openDirectoryAt(staging.parentFd, basename(target));
|
|
47
|
+
const opened = fstat(targetFd);
|
|
48
|
+
if (entry.dev !== opened.dev || entry.ino !== opened.ino)
|
|
49
|
+
throw new Error("repository_target_not_empty");
|
|
50
|
+
if (clone && listDirectory(targetFd).length !== 0)
|
|
51
|
+
throw new Error("repository_target_not_empty");
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (!hasCode(error, "ENOENT"))
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
if (targetFd >= 0) {
|
|
58
|
+
let initialized = false;
|
|
59
|
+
try {
|
|
60
|
+
statAt(targetFd, ".flywheel");
|
|
61
|
+
initialized = true;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (!hasCode(error, "ENOENT"))
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
if (initialized) {
|
|
68
|
+
if (args.adopt !== true)
|
|
69
|
+
throw new Error("repository_already_initialized");
|
|
70
|
+
try {
|
|
71
|
+
const identity = await withRepositoryWriter(target, state => migrateLocalRepository(state));
|
|
72
|
+
return { path: target, repository_id: identity.repositoryId, client_id: identity.clientId, adopted: true, bootstrap_lock: bootstrapLock };
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
throw new Error("repository_adoption_invalid", { cause: error });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
mkdirAt(staging.fd, ".flywheel", 0o700);
|
|
80
|
+
const state = RetainedRepositoryState.open(staging.path);
|
|
81
|
+
const repositoryId = clone ? args.repository_id : randomUUID();
|
|
82
|
+
const clientId = randomUUID();
|
|
83
|
+
let cloneResult = {};
|
|
84
|
+
try {
|
|
85
|
+
const objects = new RepositoryObjectStorage(state);
|
|
86
|
+
const store = new SQLiteRepositoryStore(state, objects);
|
|
87
|
+
store.initialize(repositoryId, clientId);
|
|
88
|
+
if (clone)
|
|
89
|
+
cloneResult = await cloneIntoStore({ state, objects, store, repositoryId, clientId }, { object_mode: args.object_mode }, connection);
|
|
90
|
+
state.assertValid();
|
|
91
|
+
fsync(state.stateFd);
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
state.close();
|
|
95
|
+
}
|
|
96
|
+
staging.assertCurrent("repository_bootstrap_target_replaced");
|
|
97
|
+
try {
|
|
98
|
+
if (targetFd < 0) {
|
|
99
|
+
renameNoReplaceAt(staging.parentFd, staging.name, staging.parentFd, basename(target));
|
|
100
|
+
const installed = statAt(staging.parentFd, basename(target));
|
|
101
|
+
const original = fstat(staging.fd);
|
|
102
|
+
if (installed.dev !== original.dev || installed.ino !== original.ino)
|
|
103
|
+
throw new Error("repository_bootstrap_target_replaced");
|
|
104
|
+
staging.transfer();
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const named = statAt(staging.parentFd, basename(target));
|
|
108
|
+
const retained = fstat(targetFd);
|
|
109
|
+
if (named.dev !== retained.dev || named.ino !== retained.ino)
|
|
110
|
+
throw new Error("repository_bootstrap_target_replaced");
|
|
111
|
+
if (clone && listDirectory(targetFd).length !== 0)
|
|
112
|
+
throw new Error("repository_target_not_empty");
|
|
113
|
+
renameNoReplaceAt(staging.fd, ".flywheel", targetFd, ".flywheel");
|
|
114
|
+
fsync(targetFd);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (hasCode(error, "EEXIST") || hasCode(error, "ENOTEMPTY"))
|
|
119
|
+
throw new Error("repository_target_not_empty", { cause: error });
|
|
120
|
+
if (hasCode(error, "ENOSYS") || hasCode(error, "EINVAL"))
|
|
121
|
+
throw new Error("repository_bootstrap_target_install_unsupported", { cause: error });
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
fsync(staging.parentFd);
|
|
125
|
+
staging.assertParentCurrent("repository_bootstrap_target_replaced");
|
|
126
|
+
return { path: target, repository_id: repositoryId, client_id: clientId, ...cloneResult, bootstrap_lock: bootstrapLock };
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
try {
|
|
130
|
+
if (targetFd >= 0)
|
|
131
|
+
close(targetFd);
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
staging.finish();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async function restoreBootstrap(args) {
|
|
140
|
+
if (Object.keys(args).length !== 2 ||
|
|
141
|
+
typeof args.archive !== "string" || !isAbsolute(args.archive) ||
|
|
142
|
+
typeof args.empty_directory !== "string" || !isAbsolute(args.empty_directory)) {
|
|
143
|
+
throw new Error("repository_bootstrap_request_invalid");
|
|
144
|
+
}
|
|
145
|
+
const target = args.empty_directory;
|
|
146
|
+
const archive = args.archive;
|
|
147
|
+
mkdirSync(dirname(target), { recursive: true, mode: 0o700 });
|
|
148
|
+
return withBootstrapWriter(target, async () => {
|
|
149
|
+
const result = await restoreRepositoryArchive(archive, target, {
|
|
150
|
+
databaseRelativePath: ".flywheel/db.sqlite",
|
|
151
|
+
objectsRelativePath: ".flywheel/objects",
|
|
152
|
+
prepareExtractedRepository: async (path) => {
|
|
153
|
+
const state = RetainedRepositoryState.open(path);
|
|
154
|
+
const backups = RetainedPrivateDirectory.create(path, ".flywheel-migration-");
|
|
155
|
+
try {
|
|
156
|
+
await migrateLocalRepository(state, { migrationBackupDirectory: backups.path });
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
try {
|
|
160
|
+
state.close();
|
|
161
|
+
}
|
|
162
|
+
finally {
|
|
163
|
+
backups.finish();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
const state = RetainedRepositoryState.open(target);
|
|
169
|
+
try {
|
|
170
|
+
const identity = readRepositoryIdentity(join(state.statePath, "db.sqlite"));
|
|
171
|
+
const head = withReadConnection(state, database => database.prepare("SELECT workspace_head_commit_id FROM repository_heads WHERE repository_id = ?").get(identity.repositoryId)?.workspace_head_commit_id);
|
|
172
|
+
const lockRoot = join(realpathSync(dirname(target)), basename(target));
|
|
173
|
+
return {
|
|
174
|
+
path: result.path, repository_id: identity.repositoryId, client_id: identity.clientId, head,
|
|
175
|
+
bootstrap_lock: { path: join(dirname(lockRoot), ".flywheel-runtime-locks", `${createHash("sha256").update(lockRoot).digest("hex")}.lock`), retained: true },
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
state.close();
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["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