@vibesdotdev/storage 0.0.1
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 +75 -0
- package/SPEC.md +60 -0
- package/dist/adapters/index.d.ts +14 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +15 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/bridge/index.d.ts +3 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +2 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge/storage-kind-bridge.d.ts +27 -0
- package/dist/bridge/storage-kind-bridge.d.ts.map +1 -0
- package/dist/bridge/storage-kind-bridge.js +110 -0
- package/dist/bridge/storage-kind-bridge.js.map +1 -0
- package/dist/bridge/types.d.ts +45 -0
- package/dist/bridge/types.d.ts.map +1 -0
- package/dist/bridge/types.js +8 -0
- package/dist/bridge/types.js.map +1 -0
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.js +18 -0
- package/dist/cli/commands/list/storage.list.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/list/storage.list.cli-command.impl.d.ts +11 -0
- package/dist/cli/commands/list/storage.list.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/list/storage.list.cli-command.impl.js +48 -0
- package/dist/cli/commands/list/storage.list.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.js +26 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.d.ts +13 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.js +136 -0
- package/dist/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.js +26 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.d.ts +13 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.js +165 -0
- package/dist/cli/commands/sync/push/storage.sync.push.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.js +20 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.d.ts +12 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.js +95 -0
- package/dist/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.js.map +1 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.d.ts +4 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.d.ts.map +1 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.js +15 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.js.map +1 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.d.ts +13 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.d.ts.map +1 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.js +150 -0
- package/dist/cli/commands/sync/status/storage.sync.status.cli-command.impl.js.map +1 -0
- package/dist/cli/context.consumer.d.ts +26 -0
- package/dist/cli/context.consumer.d.ts.map +1 -0
- package/dist/cli/context.consumer.js +164 -0
- package/dist/cli/context.consumer.js.map +1 -0
- package/dist/cli/storage.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/storage.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/storage.cli-group.descriptor.js +11 -0
- package/dist/cli/storage.cli-group.descriptor.js.map +1 -0
- package/dist/cli/storage.sync.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/storage.sync.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/storage.sync.cli-group.descriptor.js +12 -0
- package/dist/cli/storage.sync.cli-group.descriptor.js.map +1 -0
- package/dist/cli/types.d.ts +26 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +11 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +10 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/list-browsable-adapters.d.ts +31 -0
- package/dist/client/list-browsable-adapters.d.ts.map +1 -0
- package/dist/client/list-browsable-adapters.js +40 -0
- package/dist/client/list-browsable-adapters.js.map +1 -0
- package/dist/daemon/commands/sync.d.ts +23 -0
- package/dist/daemon/commands/sync.d.ts.map +1 -0
- package/dist/daemon/commands/sync.js +169 -0
- package/dist/daemon/commands/sync.js.map +1 -0
- package/dist/docs/adapters.docs.descriptor.d.ts +4 -0
- package/dist/docs/adapters.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/adapters.docs.descriptor.js +223 -0
- package/dist/docs/adapters.docs.descriptor.js.map +1 -0
- package/dist/docs/manifests.docs.descriptor.d.ts +4 -0
- package/dist/docs/manifests.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/manifests.docs.descriptor.js +316 -0
- package/dist/docs/manifests.docs.descriptor.js.map +1 -0
- package/dist/docs/records.docs.descriptor.d.ts +4 -0
- package/dist/docs/records.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/records.docs.descriptor.js +269 -0
- package/dist/docs/records.docs.descriptor.js.map +1 -0
- package/dist/docs/sync.docs.descriptor.d.ts +4 -0
- package/dist/docs/sync.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/sync.docs.descriptor.js +279 -0
- package/dist/docs/sync.docs.descriptor.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/adapter.d.ts +382 -0
- package/dist/interfaces/adapter.d.ts.map +1 -0
- package/dist/interfaces/adapter.js +11 -0
- package/dist/interfaces/adapter.js.map +1 -0
- package/dist/interfaces/document-store.d.ts +62 -0
- package/dist/interfaces/document-store.d.ts.map +1 -0
- package/dist/interfaces/document-store.js +8 -0
- package/dist/interfaces/document-store.js.map +1 -0
- package/dist/interfaces/index.d.ts +17 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +24 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/key-value.d.ts +95 -0
- package/dist/interfaces/key-value.d.ts.map +1 -0
- package/dist/interfaces/key-value.js +8 -0
- package/dist/interfaces/key-value.js.map +1 -0
- package/dist/interfaces/query-builder.d.ts +31 -0
- package/dist/interfaces/query-builder.d.ts.map +1 -0
- package/dist/interfaces/query-builder.js +11 -0
- package/dist/interfaces/query-builder.js.map +1 -0
- package/dist/interfaces/record/index.d.ts +7 -0
- package/dist/interfaces/record/index.d.ts.map +1 -0
- package/dist/interfaces/record/index.js +7 -0
- package/dist/interfaces/record/index.js.map +1 -0
- package/dist/interfaces/record/interface.d.ts +593 -0
- package/dist/interfaces/record/interface.d.ts.map +1 -0
- package/dist/interfaces/record/interface.js +49 -0
- package/dist/interfaces/record/interface.js.map +1 -0
- package/dist/interfaces/repository.d.ts +262 -0
- package/dist/interfaces/repository.d.ts.map +1 -0
- package/dist/interfaces/repository.js +8 -0
- package/dist/interfaces/repository.js.map +1 -0
- package/dist/interfaces/schema/index.d.ts +8 -0
- package/dist/interfaces/schema/index.d.ts.map +1 -0
- package/dist/interfaces/schema/index.js +10 -0
- package/dist/interfaces/schema/index.js.map +1 -0
- package/dist/interfaces/schema/schema-interface.d.ts +516 -0
- package/dist/interfaces/schema/schema-interface.d.ts.map +1 -0
- package/dist/interfaces/schema/schema-interface.js +31 -0
- package/dist/interfaces/schema/schema-interface.js.map +1 -0
- package/dist/interfaces/schema/table-interface.d.ts +250 -0
- package/dist/interfaces/schema/table-interface.d.ts.map +1 -0
- package/dist/interfaces/schema/table-interface.js +31 -0
- package/dist/interfaces/schema/table-interface.js.map +1 -0
- package/dist/interfaces/storage-consumer-fs.d.ts +40 -0
- package/dist/interfaces/storage-consumer-fs.d.ts.map +1 -0
- package/dist/interfaces/storage-consumer-fs.js +42 -0
- package/dist/interfaces/storage-consumer-fs.js.map +1 -0
- package/dist/manifest/base.d.ts +187 -0
- package/dist/manifest/base.d.ts.map +1 -0
- package/dist/manifest/base.js +516 -0
- package/dist/manifest/base.js.map +1 -0
- package/dist/manifest/cloud-sync.consumer.d.ts +7 -0
- package/dist/manifest/cloud-sync.consumer.d.ts.map +1 -0
- package/dist/manifest/cloud-sync.consumer.js +82 -0
- package/dist/manifest/cloud-sync.consumer.js.map +1 -0
- package/dist/manifest/index.d.ts +7 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +7 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/manifest/source-policy.d.ts +8 -0
- package/dist/manifest/source-policy.d.ts.map +1 -0
- package/dist/manifest/source-policy.js +62 -0
- package/dist/manifest/source-policy.js.map +1 -0
- package/dist/paths.d.ts +6 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +152 -0
- package/dist/paths.js.map +1 -0
- package/dist/policy/context.d.ts +9 -0
- package/dist/policy/context.d.ts.map +1 -0
- package/dist/policy/context.js +29 -0
- package/dist/policy/context.js.map +1 -0
- package/dist/policy/index.d.ts +4 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +4 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/overrides.d.ts +40 -0
- package/dist/policy/overrides.d.ts.map +1 -0
- package/dist/policy/overrides.js +37 -0
- package/dist/policy/overrides.js.map +1 -0
- package/dist/policy/persistence.d.ts +38 -0
- package/dist/policy/persistence.d.ts.map +1 -0
- package/dist/policy/persistence.js +65 -0
- package/dist/policy/persistence.js.map +1 -0
- package/dist/policy/types.d.ts +21 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +7 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/record/base.d.ts +186 -0
- package/dist/record/base.d.ts.map +1 -0
- package/dist/record/base.js +1437 -0
- package/dist/record/base.js.map +1 -0
- package/dist/record/events.d.ts +71 -0
- package/dist/record/events.d.ts.map +1 -0
- package/dist/record/events.js +52 -0
- package/dist/record/events.js.map +1 -0
- package/dist/record/extensions.d.ts +51 -0
- package/dist/record/extensions.d.ts.map +1 -0
- package/dist/record/extensions.js +222 -0
- package/dist/record/extensions.js.map +1 -0
- package/dist/record/index.d.ts +7 -0
- package/dist/record/index.d.ts.map +1 -0
- package/dist/record/index.js +7 -0
- package/dist/record/index.js.map +1 -0
- package/dist/resolver/storage-backed-resolver.d.ts +23 -0
- package/dist/resolver/storage-backed-resolver.d.ts.map +1 -0
- package/dist/resolver/storage-backed-resolver.js +187 -0
- package/dist/resolver/storage-backed-resolver.js.map +1 -0
- package/dist/schemas/adapter-descriptor.d.ts +108 -0
- package/dist/schemas/adapter-descriptor.d.ts.map +1 -0
- package/dist/schemas/adapter-descriptor.js +101 -0
- package/dist/schemas/adapter-descriptor.js.map +1 -0
- package/dist/schemas/index.d.ts +14 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +12 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/manifest-descriptor.d.ts +110 -0
- package/dist/schemas/manifest-descriptor.d.ts.map +1 -0
- package/dist/schemas/manifest-descriptor.js +114 -0
- package/dist/schemas/manifest-descriptor.js.map +1 -0
- package/dist/schemas/record/descriptor.d.ts +570 -0
- package/dist/schemas/record/descriptor.d.ts.map +1 -0
- package/dist/schemas/record/descriptor.js +389 -0
- package/dist/schemas/record/descriptor.js.map +1 -0
- package/dist/schemas/record/index.d.ts +8 -0
- package/dist/schemas/record/index.d.ts.map +1 -0
- package/dist/schemas/record/index.js +7 -0
- package/dist/schemas/record/index.js.map +1 -0
- package/dist/schemas/record/relation.d.ts +36 -0
- package/dist/schemas/record/relation.d.ts.map +1 -0
- package/dist/schemas/record/relation.js +37 -0
- package/dist/schemas/record/relation.js.map +1 -0
- package/dist/schemas/schema/descriptor.d.ts +231 -0
- package/dist/schemas/schema/descriptor.d.ts.map +1 -0
- package/dist/schemas/schema/descriptor.js +205 -0
- package/dist/schemas/schema/descriptor.js.map +1 -0
- package/dist/schemas/schema/index.d.ts +7 -0
- package/dist/schemas/schema/index.d.ts.map +1 -0
- package/dist/schemas/schema/index.js +7 -0
- package/dist/schemas/schema/index.js.map +1 -0
- package/dist/schemas/sync-bridge-descriptor.d.ts +124 -0
- package/dist/schemas/sync-bridge-descriptor.d.ts.map +1 -0
- package/dist/schemas/sync-bridge-descriptor.js +67 -0
- package/dist/schemas/sync-bridge-descriptor.js.map +1 -0
- package/dist/server/manifest-route.d.ts +92 -0
- package/dist/server/manifest-route.d.ts.map +1 -0
- package/dist/server/manifest-route.js +226 -0
- package/dist/server/manifest-route.js.map +1 -0
- package/dist/storage-policy.context.descriptor.d.ts +16 -0
- package/dist/storage-policy.context.descriptor.d.ts.map +1 -0
- package/dist/storage-policy.context.descriptor.js +16 -0
- package/dist/storage-policy.context.descriptor.js.map +1 -0
- package/dist/storage-policy.context.server.d.ts +14 -0
- package/dist/storage-policy.context.server.d.ts.map +1 -0
- package/dist/storage-policy.context.server.js +27 -0
- package/dist/storage-policy.context.server.js.map +1 -0
- package/dist/storage.plugin.d.ts +38 -0
- package/dist/storage.plugin.d.ts.map +1 -0
- package/dist/storage.plugin.js +204 -0
- package/dist/storage.plugin.js.map +1 -0
- package/dist/sync/cloud-pull.d.ts +15 -0
- package/dist/sync/cloud-pull.d.ts.map +1 -0
- package/dist/sync/cloud-pull.js +130 -0
- package/dist/sync/cloud-pull.js.map +1 -0
- package/dist/sync/cloud-record-crud-config.d.ts +19 -0
- package/dist/sync/cloud-record-crud-config.d.ts.map +1 -0
- package/dist/sync/cloud-record-crud-config.js +22 -0
- package/dist/sync/cloud-record-crud-config.js.map +1 -0
- package/dist/sync/record-sync-bridge.d.ts +5 -0
- package/dist/sync/record-sync-bridge.d.ts.map +1 -0
- package/dist/sync/record-sync-bridge.js +121 -0
- package/dist/sync/record-sync-bridge.js.map +1 -0
- package/dist/sync/resolve-sync-target.d.ts +23 -0
- package/dist/sync/resolve-sync-target.d.ts.map +1 -0
- package/dist/sync/resolve-sync-target.js +45 -0
- package/dist/sync/resolve-sync-target.js.map +1 -0
- package/dist/sync/schemas/cloud-pull.d.ts +25 -0
- package/dist/sync/schemas/cloud-pull.d.ts.map +1 -0
- package/dist/sync/schemas/cloud-pull.js +7 -0
- package/dist/sync/schemas/cloud-pull.js.map +1 -0
- package/dist/sync/schemas/index.d.ts +9 -0
- package/dist/sync/schemas/index.d.ts.map +1 -0
- package/dist/sync/schemas/index.js +9 -0
- package/dist/sync/schemas/index.js.map +1 -0
- package/dist/sync/schemas/sync-helpers.d.ts +17 -0
- package/dist/sync/schemas/sync-helpers.d.ts.map +1 -0
- package/dist/sync/schemas/sync-helpers.js +7 -0
- package/dist/sync/schemas/sync-helpers.js.map +1 -0
- package/dist/sync/schemas/sync-state.d.ts +65 -0
- package/dist/sync/schemas/sync-state.d.ts.map +1 -0
- package/dist/sync/schemas/sync-state.js +32 -0
- package/dist/sync/schemas/sync-state.js.map +1 -0
- package/dist/sync/sync-bridge.d.ts +80 -0
- package/dist/sync/sync-bridge.d.ts.map +1 -0
- package/dist/sync/sync-bridge.js +617 -0
- package/dist/sync/sync-bridge.js.map +1 -0
- package/dist/sync/sync-manifest.d.ts +20 -0
- package/dist/sync/sync-manifest.d.ts.map +1 -0
- package/dist/sync/sync-manifest.js +140 -0
- package/dist/sync/sync-manifest.js.map +1 -0
- package/dist/sync/sync-state.consumer.d.ts +23 -0
- package/dist/sync/sync-state.consumer.d.ts.map +1 -0
- package/dist/sync/sync-state.consumer.js +111 -0
- package/dist/sync/sync-state.consumer.js.map +1 -0
- package/dist/transform/index.d.ts +75 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/index.js +81 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/transform-descriptor.d.ts +51 -0
- package/dist/transform/transform-descriptor.d.ts.map +1 -0
- package/dist/transform/transform-descriptor.js +30 -0
- package/dist/transform/transform-descriptor.js.map +1 -0
- package/dist/tui/storage-explorer.descriptor.d.ts +14 -0
- package/dist/tui/storage-explorer.descriptor.d.ts.map +1 -0
- package/dist/tui/storage-explorer.descriptor.js +29 -0
- package/dist/tui/storage-explorer.descriptor.js.map +1 -0
- package/dist/tui/storage-explorer.impl.consumer.d.ts +11 -0
- package/dist/tui/storage-explorer.impl.consumer.d.ts.map +1 -0
- package/dist/tui/storage-explorer.impl.consumer.js +13 -0
- package/dist/tui/storage-explorer.impl.consumer.js.map +1 -0
- package/dist/tui/storage-open.descriptor.d.ts +14 -0
- package/dist/tui/storage-open.descriptor.d.ts.map +1 -0
- package/dist/tui/storage-open.descriptor.js +28 -0
- package/dist/tui/storage-open.descriptor.js.map +1 -0
- package/dist/tui/storage-open.impl.consumer.d.ts +11 -0
- package/dist/tui/storage-open.impl.consumer.d.ts.map +1 -0
- package/dist/tui/storage-open.impl.consumer.js +13 -0
- package/dist/tui/storage-open.impl.consumer.js.map +1 -0
- package/dist/utils/error-context.d.ts +2 -0
- package/dist/utils/error-context.d.ts.map +1 -0
- package/dist/utils/error-context.js +17 -0
- package/dist/utils/error-context.js.map +1 -0
- package/package.json +241 -0
- package/src/adapters/index.ts +13 -0
- package/src/bridge/index.ts +2 -0
- package/src/bridge/storage-kind-bridge.ts +131 -0
- package/src/bridge/types.ts +46 -0
- package/src/cli/commands/list/storage.list.cli-command.descriptor.ts +20 -0
- package/src/cli/commands/list/storage.list.cli-command.impl.ts +72 -0
- package/src/cli/commands/sync/pull/storage.sync.pull.cli-command.descriptor.ts +28 -0
- package/src/cli/commands/sync/pull/storage.sync.pull.cli-command.impl.ts +171 -0
- package/src/cli/commands/sync/push/storage.sync.push.cli-command.descriptor.ts +28 -0
- package/src/cli/commands/sync/push/storage.sync.push.cli-command.impl.ts +213 -0
- package/src/cli/commands/sync/resolve/storage.sync.resolve.cli-command.descriptor.ts +22 -0
- package/src/cli/commands/sync/resolve/storage.sync.resolve.cli-command.impl.ts +129 -0
- package/src/cli/commands/sync/status/storage.sync.status.cli-command.descriptor.ts +17 -0
- package/src/cli/commands/sync/status/storage.sync.status.cli-command.impl.ts +192 -0
- package/src/cli/context.consumer.ts +195 -0
- package/src/cli/storage.cli-group.descriptor.ts +13 -0
- package/src/cli/storage.sync.cli-group.descriptor.ts +14 -0
- package/src/cli/types.ts +25 -0
- package/src/client/index.ts +10 -0
- package/src/client/list-browsable-adapters.ts +42 -0
- package/src/daemon/commands/sync.ts +225 -0
- package/src/docs/adapters.docs.descriptor.ts +225 -0
- package/src/docs/manifests.docs.descriptor.ts +318 -0
- package/src/docs/records.docs.descriptor.ts +271 -0
- package/src/docs/sync.docs.descriptor.ts +281 -0
- package/src/index.ts +109 -0
- package/src/interfaces/adapter.ts +451 -0
- package/src/interfaces/document-store.ts +74 -0
- package/src/interfaces/index.ts +117 -0
- package/src/interfaces/key-value.ts +112 -0
- package/src/interfaces/query-builder.ts +31 -0
- package/src/interfaces/record/index.ts +58 -0
- package/src/interfaces/record/interface.ts +723 -0
- package/src/interfaces/repository.ts +300 -0
- package/src/interfaces/schema/index.ts +37 -0
- package/src/interfaces/schema/schema-interface.ts +586 -0
- package/src/interfaces/schema/table-interface.ts +314 -0
- package/src/interfaces/storage-consumer-fs.ts +66 -0
- package/src/manifest/base.ts +594 -0
- package/src/manifest/cloud-sync.consumer.ts +120 -0
- package/src/manifest/index.ts +7 -0
- package/src/manifest/source-policy.ts +74 -0
- package/src/paths.ts +171 -0
- package/src/policy/context.ts +30 -0
- package/src/policy/index.ts +20 -0
- package/src/policy/overrides.ts +46 -0
- package/src/policy/persistence.ts +117 -0
- package/src/policy/types.ts +28 -0
- package/src/record/base.ts +1872 -0
- package/src/record/events.ts +56 -0
- package/src/record/extensions.ts +308 -0
- package/src/record/index.ts +7 -0
- package/src/resolver/storage-backed-resolver.ts +255 -0
- package/src/schemas/adapter-descriptor.ts +128 -0
- package/src/schemas/index.ts +104 -0
- package/src/schemas/manifest-descriptor.ts +143 -0
- package/src/schemas/record/descriptor.ts +621 -0
- package/src/schemas/record/index.ts +60 -0
- package/src/schemas/record/relation.ts +49 -0
- package/src/schemas/schema/descriptor.ts +278 -0
- package/src/schemas/schema/index.ts +14 -0
- package/src/schemas/sync-bridge-descriptor.ts +143 -0
- package/src/server/manifest-route.ts +319 -0
- package/src/storage-policy.context.descriptor.ts +17 -0
- package/src/storage-policy.context.server.ts +34 -0
- package/src/storage.plugin.ts +264 -0
- package/src/sync/cloud-pull.ts +202 -0
- package/src/sync/cloud-record-crud-config.ts +41 -0
- package/src/sync/record-sync-bridge.ts +183 -0
- package/src/sync/resolve-sync-target.ts +57 -0
- package/src/sync/schemas/cloud-pull.ts +26 -0
- package/src/sync/schemas/index.ts +18 -0
- package/src/sync/schemas/sync-helpers.ts +18 -0
- package/src/sync/schemas/sync-state.ts +41 -0
- package/src/sync/sync-bridge.ts +763 -0
- package/src/sync/sync-manifest.ts +212 -0
- package/src/sync/sync-state.consumer.ts +144 -0
- package/src/transform/index.ts +130 -0
- package/src/transform/transform-descriptor.ts +53 -0
- package/src/tui/storage-explorer.descriptor.ts +32 -0
- package/src/tui/storage-explorer.impl.consumer.ts +14 -0
- package/src/tui/storage-open.descriptor.ts +31 -0
- package/src/tui/storage-open.impl.consumer.ts +14 -0
- package/src/utils/error-context.ts +19 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vibes storage sync status
|
|
3
|
+
*
|
|
4
|
+
* Displays the sync state for all cloud-eligible storage manifests
|
|
5
|
+
* AND all registered sync-bridge descriptors.
|
|
6
|
+
* Shows the current environment's sync target URL, per-item sync status,
|
|
7
|
+
* last sync time, direction, and any errors.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { getVibesRuntime } from '@vibesdotdev/runtime';
|
|
11
|
+
import type { StorageCliUIContext as UIContext } from '../../../types';
|
|
12
|
+
import { loadSyncState, getManifestSyncState } from '../../../../sync/sync-state.consumer';
|
|
13
|
+
import type { ManifestSyncState } from '../../../../sync/schemas/sync-state';
|
|
14
|
+
import type { SyncBridgeDescriptor } from '../../../../schemas/sync-bridge-descriptor';
|
|
15
|
+
import type { StorageRecordDescriptor } from '../../../../schemas/record';
|
|
16
|
+
import { resolveSyncTarget } from '../../../../sync/resolve-sync-target';
|
|
17
|
+
import {
|
|
18
|
+
createRecordSyncBridgeDescriptor,
|
|
19
|
+
isSyncableStorageRecord
|
|
20
|
+
} from '../../../../sync/record-sync-bridge';
|
|
21
|
+
|
|
22
|
+
interface ManifestDescriptor {
|
|
23
|
+
id: string;
|
|
24
|
+
namespace: string;
|
|
25
|
+
allowedAdapters?: string[];
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function formatTimeAgo(isoString: string | null): string {
|
|
30
|
+
if (!isoString) return '—';
|
|
31
|
+
const diff = Date.now() - new Date(isoString).getTime();
|
|
32
|
+
const seconds = Math.floor(diff / 1000);
|
|
33
|
+
if (seconds < 60) return `${seconds}s ago`;
|
|
34
|
+
const minutes = Math.floor(seconds / 60);
|
|
35
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
36
|
+
const hours = Math.floor(minutes / 60);
|
|
37
|
+
if (hours < 24) return `${hours}h ago`;
|
|
38
|
+
const days = Math.floor(hours / 24);
|
|
39
|
+
return `${days}d ago`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function statusIcon(status: ManifestSyncState['syncStatus']): string {
|
|
43
|
+
switch (status) {
|
|
44
|
+
case 'in-sync':
|
|
45
|
+
return 'in-sync';
|
|
46
|
+
case 'local-ahead':
|
|
47
|
+
return 'local-ahead';
|
|
48
|
+
case 'remote-ahead':
|
|
49
|
+
return 'remote-ahead';
|
|
50
|
+
case 'conflict':
|
|
51
|
+
return 'CONFLICT';
|
|
52
|
+
case 'paused':
|
|
53
|
+
return 'paused';
|
|
54
|
+
case 'never-synced':
|
|
55
|
+
default:
|
|
56
|
+
return 'never-synced';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
async execute(_args: Record<string, unknown>, opts: Record<string, unknown>): Promise<void> {
|
|
62
|
+
const runtime = getVibesRuntime();
|
|
63
|
+
const ui = (await runtime.context('cli/ui')) as UIContext;
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
// Resolve current environment for sync target display
|
|
67
|
+
const { syncTarget, envName } = await resolveSyncTarget();
|
|
68
|
+
|
|
69
|
+
// Load sync state
|
|
70
|
+
const syncState = await loadSyncState();
|
|
71
|
+
|
|
72
|
+
// ── Storage Manifests ──
|
|
73
|
+
const descriptors = runtime
|
|
74
|
+
.query('storage/manifest')
|
|
75
|
+
.descriptors() as unknown as ManifestDescriptor[];
|
|
76
|
+
|
|
77
|
+
const eligible = descriptors.filter(
|
|
78
|
+
(d) => d.enabled !== false && d.allowedAdapters?.includes('storage.cloud-api')
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// ── Sync Bridges / Records ──
|
|
82
|
+
const bridges = runtime.query('storage/sync-bridge').descriptors() as SyncBridgeDescriptor[];
|
|
83
|
+
const records = (runtime.query('storage/record').descriptors() as StorageRecordDescriptor[])
|
|
84
|
+
.filter(isSyncableStorageRecord)
|
|
85
|
+
.map(createRecordSyncBridgeDescriptor);
|
|
86
|
+
const syncTargets = [...records, ...bridges];
|
|
87
|
+
|
|
88
|
+
if (opts.json) {
|
|
89
|
+
const manifestData = eligible.map((d) => {
|
|
90
|
+
const state = getManifestSyncState(syncState, d.id);
|
|
91
|
+
return {
|
|
92
|
+
type: 'manifest',
|
|
93
|
+
namespace: d.namespace,
|
|
94
|
+
...state,
|
|
95
|
+
syncTarget
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
const bridgeData = syncTargets.map((b) => {
|
|
99
|
+
// Bridges use composite keys: bridgeId:entityId
|
|
100
|
+
// For status overview, show the bridge-level summary
|
|
101
|
+
const stateKeys = Object.keys(syncState.manifests).filter((k) =>
|
|
102
|
+
k.startsWith(`${b.id}:`)
|
|
103
|
+
);
|
|
104
|
+
const entityCount = stateKeys.length;
|
|
105
|
+
const synced = stateKeys.filter(
|
|
106
|
+
(k) => syncState.manifests[k]?.syncStatus === 'in-sync'
|
|
107
|
+
).length;
|
|
108
|
+
return {
|
|
109
|
+
type: 'bridge',
|
|
110
|
+
bridgeId: b.id,
|
|
111
|
+
sourceKind: b.source.runtimeKind,
|
|
112
|
+
apiPath: b.target.apiPath,
|
|
113
|
+
direction: b.sync.direction,
|
|
114
|
+
entities: entityCount,
|
|
115
|
+
synced,
|
|
116
|
+
syncTarget
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
ui.render(
|
|
120
|
+
{ syncTarget, envName, manifests: manifestData, bridges: bridgeData },
|
|
121
|
+
{ format: 'json' }
|
|
122
|
+
);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
ui.info(`Sync Target: ${syncTarget} (${envName})`);
|
|
127
|
+
ui.log('');
|
|
128
|
+
|
|
129
|
+
// Show storage manifests
|
|
130
|
+
if (eligible.length > 0) {
|
|
131
|
+
ui.info('Storage Manifests:');
|
|
132
|
+
ui.table(
|
|
133
|
+
eligible.map((d) => {
|
|
134
|
+
const state = getManifestSyncState(syncState, d.id);
|
|
135
|
+
return {
|
|
136
|
+
Manifest: d.id,
|
|
137
|
+
Status: statusIcon(state.syncStatus),
|
|
138
|
+
'Last Sync': formatTimeAgo(state.lastSyncAt),
|
|
139
|
+
Dir: state.lastSyncDirection ?? '—',
|
|
140
|
+
Error: state.errorMessage ? state.errorMessage.slice(0, 40) : '—'
|
|
141
|
+
};
|
|
142
|
+
}),
|
|
143
|
+
{ columns: ['Manifest', 'Status', 'Last Sync', 'Dir', 'Error'] }
|
|
144
|
+
);
|
|
145
|
+
} else {
|
|
146
|
+
ui.info('No storage manifests have cloud sync enabled.');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Show sync bridges
|
|
150
|
+
if (syncTargets.length > 0) {
|
|
151
|
+
ui.log('');
|
|
152
|
+
ui.info('Record / Bridge Sync Targets:');
|
|
153
|
+
ui.table(
|
|
154
|
+
syncTargets.map((b) => {
|
|
155
|
+
const stateKeys = Object.keys(syncState.manifests).filter((k) =>
|
|
156
|
+
k.startsWith(`${b.id}:`)
|
|
157
|
+
);
|
|
158
|
+
const entityCount = stateKeys.length;
|
|
159
|
+
const synced = stateKeys.filter(
|
|
160
|
+
(k) => syncState.manifests[k]?.syncStatus === 'in-sync'
|
|
161
|
+
).length;
|
|
162
|
+
const errors = stateKeys.filter((k) => syncState.manifests[k]?.errorMessage).length;
|
|
163
|
+
const lastSync =
|
|
164
|
+
stateKeys
|
|
165
|
+
.map((k) => syncState.manifests[k]?.lastSyncAt)
|
|
166
|
+
.filter(Boolean)
|
|
167
|
+
.sort()
|
|
168
|
+
.pop() ?? null;
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
Target: b.id,
|
|
172
|
+
Source: b.source.runtimeKind,
|
|
173
|
+
API: b.target.apiPath,
|
|
174
|
+
Dir: b.sync.direction.replace('bidirectional', 'both'),
|
|
175
|
+
Synced: entityCount > 0 ? `${synced}/${entityCount}` : 'never',
|
|
176
|
+
'Last Sync': formatTimeAgo(lastSync),
|
|
177
|
+
Errors: errors > 0 ? String(errors) : '—'
|
|
178
|
+
};
|
|
179
|
+
}),
|
|
180
|
+
{ columns: ['Target', 'Source', 'API', 'Dir', 'Synced', 'Last Sync', 'Errors'] }
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (eligible.length === 0 && syncTargets.length === 0) {
|
|
185
|
+
ui.warn('No syncable targets found.');
|
|
186
|
+
}
|
|
187
|
+
} catch (e) {
|
|
188
|
+
ui.error(`Failed to get sync status: ${e}`);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Context Consumer
|
|
3
|
+
*
|
|
4
|
+
* Provides storage context for consumer hardware scope.
|
|
5
|
+
* Uses runtime-injected fs/crypto/path abstraction to avoid
|
|
6
|
+
* universal core importing Node.js built-ins directly.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { getConsumerFs, type ConsumerFileSystem } from '../interfaces/storage-consumer-fs';
|
|
10
|
+
import { resolveWorkspacePath } from '../paths';
|
|
11
|
+
|
|
12
|
+
const STORAGE_ROOT = '.vibes/storage';
|
|
13
|
+
const PROJECT_JSON_PREFIX = 'project/json/';
|
|
14
|
+
|
|
15
|
+
function sanitizeNamespace(namespace: string): string {
|
|
16
|
+
return namespace.replace(/[^a-zA-Z0-9._-]/g, '-');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function getProjectJsonDir(fs: ConsumerFileSystem): Promise<string> {
|
|
20
|
+
return fs.join(await resolveWorkspaceRoot(fs), STORAGE_ROOT, 'project', 'json');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function getProjectJsonFile(fs: ConsumerFileSystem, namespace: string): Promise<string> {
|
|
24
|
+
return fs.join(await getProjectJsonDir(fs), `${sanitizeNamespace(namespace)}.json`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function resolveWorkspaceRoot(fs: ConsumerFileSystem): Promise<string> {
|
|
28
|
+
const fromContextPath = await findWorkspaceRoot(fs, resolveWorkspacePath());
|
|
29
|
+
if (fromContextPath) {
|
|
30
|
+
return fromContextPath;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const fromCwd = await findWorkspaceRoot(fs, fs.resolve('.'));
|
|
34
|
+
if (fromCwd) {
|
|
35
|
+
return fromCwd;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const fromModulePath = await findWorkspaceRoot(fs, fs.resolve(import.meta.dir, '../../../../../'));
|
|
39
|
+
if (fromModulePath) {
|
|
40
|
+
return fromModulePath;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return resolveWorkspacePath();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function findWorkspaceRoot(fs: ConsumerFileSystem, startPath: string): Promise<string | null> {
|
|
47
|
+
let current = fs.resolve(startPath);
|
|
48
|
+
let previous = '';
|
|
49
|
+
|
|
50
|
+
while (current !== previous) {
|
|
51
|
+
const hasPackage = fs.existsSync(fs.join(current, 'package.json'));
|
|
52
|
+
const hasVibesBin = fs.existsSync(fs.join(current, 'src', 'bin', 'vibes.ts'));
|
|
53
|
+
if (hasPackage && hasVibesBin) {
|
|
54
|
+
return current;
|
|
55
|
+
}
|
|
56
|
+
previous = current;
|
|
57
|
+
current = fs.dirname(current);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function readJson<T>(fs: ConsumerFileSystem, filePath: string): Promise<T | null> {
|
|
64
|
+
try {
|
|
65
|
+
const raw = await fs.readFile(filePath, 'utf8');
|
|
66
|
+
if (!raw.trim()) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return JSON.parse(raw) as T;
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function writeJson<T>(fs: ConsumerFileSystem, filePath: string, value: T): Promise<void> {
|
|
79
|
+
const dir = fs.dirname(filePath);
|
|
80
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
81
|
+
|
|
82
|
+
const payload = `${JSON.stringify(value, null, 2)}\n`;
|
|
83
|
+
const tmpFile = `${filePath}.tmp.${process.pid}.${Date.now()}.${fs.randomUUID()}`;
|
|
84
|
+
await fs.writeFile(tmpFile, payload, 'utf8');
|
|
85
|
+
try {
|
|
86
|
+
await fs.rename(tmpFile, filePath);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
89
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
90
|
+
await fs.writeFile(filePath, payload, 'utf8');
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function getStorageContext(): Promise<{
|
|
98
|
+
project: {
|
|
99
|
+
json: <T>(namespace: string) => {
|
|
100
|
+
read: () => Promise<T | null>;
|
|
101
|
+
write: (value: T) => Promise<void>;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
}> {
|
|
105
|
+
const fs = await getConsumerFs();
|
|
106
|
+
const dir = await getProjectJsonDir(fs);
|
|
107
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
project: {
|
|
111
|
+
json: <T>(namespace: string) => {
|
|
112
|
+
const filePathPromise = getProjectJsonFile(fs, namespace);
|
|
113
|
+
return {
|
|
114
|
+
read: async () => {
|
|
115
|
+
const filePath = await filePathPromise;
|
|
116
|
+
return readJson<T>(fs, filePath);
|
|
117
|
+
},
|
|
118
|
+
write: async (value: T) => {
|
|
119
|
+
const filePath = await filePathPromise;
|
|
120
|
+
return writeJson(fs, filePath, value);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export async function subscribeStorage<T>(
|
|
129
|
+
resource: string,
|
|
130
|
+
handler: (event: { value: T | null }) => void,
|
|
131
|
+
options?: { delivery?: { type: 'debounce'; ms: number } }
|
|
132
|
+
): Promise<{ unsubscribe: () => void }> {
|
|
133
|
+
if (!resource.startsWith(PROJECT_JSON_PREFIX)) {
|
|
134
|
+
return { unsubscribe: () => undefined };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const fs = await getConsumerFs();
|
|
138
|
+
const namespace = resource.slice(PROJECT_JSON_PREFIX.length);
|
|
139
|
+
const filePath = await getProjectJsonFile(fs, namespace);
|
|
140
|
+
const dir = fs.dirname(filePath);
|
|
141
|
+
const targetFile = fs.basename(filePath);
|
|
142
|
+
const debounceMs = options?.delivery?.type === 'debounce' ? options.delivery.ms : 0;
|
|
143
|
+
|
|
144
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
145
|
+
|
|
146
|
+
let timer: NodeJS.Timeout | null = null;
|
|
147
|
+
let watcher: { close(): void } | null = null;
|
|
148
|
+
|
|
149
|
+
const emitChange = async () => {
|
|
150
|
+
try {
|
|
151
|
+
const value = await readJson<T>(fs, filePath);
|
|
152
|
+
handler({ value });
|
|
153
|
+
} catch {
|
|
154
|
+
// ignore read errors
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const scheduleEmit = () => {
|
|
159
|
+
if (debounceMs <= 0) {
|
|
160
|
+
void emitChange();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (timer) {
|
|
164
|
+
clearTimeout(timer);
|
|
165
|
+
}
|
|
166
|
+
timer = setTimeout(() => {
|
|
167
|
+
timer = null;
|
|
168
|
+
void emitChange();
|
|
169
|
+
}, debounceMs);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
try {
|
|
173
|
+
watcher = fs.watch(dir, (eventType, filename) => {
|
|
174
|
+
const name = filename?.toString ? filename.toString() : filename;
|
|
175
|
+
if (!name || name !== targetFile) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (eventType === 'change' || eventType === 'rename') {
|
|
179
|
+
scheduleEmit();
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
} catch {
|
|
183
|
+
watcher = null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
unsubscribe: () => {
|
|
188
|
+
if (timer) {
|
|
189
|
+
clearTimeout(timer);
|
|
190
|
+
timer = null;
|
|
191
|
+
}
|
|
192
|
+
watcher?.close();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CLIGroupAssetDescriptor } from '@vibesdotdev/runtime/schemas/asset';
|
|
2
|
+
|
|
3
|
+
const descriptor: CLIGroupAssetDescriptor = {
|
|
4
|
+
kind: 'cli/group',
|
|
5
|
+
id: 'storage',
|
|
6
|
+
name: 'storage',
|
|
7
|
+
description: 'Storage and sync management',
|
|
8
|
+
surfaces: ['cli'],
|
|
9
|
+
hardware: ['consumer'],
|
|
10
|
+
enabled: true
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default descriptor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CLIGroupAssetDescriptor } from '@vibesdotdev/runtime/schemas/asset';
|
|
2
|
+
|
|
3
|
+
const descriptor: CLIGroupAssetDescriptor = {
|
|
4
|
+
kind: 'cli/group',
|
|
5
|
+
id: 'storage.sync',
|
|
6
|
+
name: 'sync',
|
|
7
|
+
description: 'Cloud synchronization for storage manifests',
|
|
8
|
+
parent: 'storage',
|
|
9
|
+
surfaces: ['cli'],
|
|
10
|
+
hardware: ['consumer'],
|
|
11
|
+
enabled: true
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default descriptor;
|
package/src/cli/types.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local CLI Types (storage)
|
|
3
|
+
*
|
|
4
|
+
* Storage's CLI command implementations consume the runtime context `cli/ui`,
|
|
5
|
+
* whose canonical shape lives in `@vibesdotdev/cli/providers`. To avoid a
|
|
6
|
+
* back-import on `@vibesdotdev/cli` (which itself depends on storage), this
|
|
7
|
+
* module declares a structural subset that matches the methods the storage
|
|
8
|
+
* commands actually use. The full UIContext lives in `@vibesdotdev/cli`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface StorageCliUIContext {
|
|
12
|
+
info(message: string): void;
|
|
13
|
+
success(message: string): void;
|
|
14
|
+
warn(message: string): void;
|
|
15
|
+
error(message: string): void;
|
|
16
|
+
log(message: string): void;
|
|
17
|
+
table(data: unknown[], options?: { columns?: string[] } | string | string[]): void;
|
|
18
|
+
json(data: unknown): void;
|
|
19
|
+
yaml(data: unknown): void;
|
|
20
|
+
keyValue(data: Record<string, unknown>): void;
|
|
21
|
+
render(
|
|
22
|
+
data: unknown,
|
|
23
|
+
options?: { format?: 'json' | 'yaml' | 'table' | 'markdown' | 'text' }
|
|
24
|
+
): void | Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Client Surface
|
|
3
|
+
*
|
|
4
|
+
* Consumer-facing query helpers that read storage runtime kinds —
|
|
5
|
+
* thin wrappers over `runtime.query('storage/adapter')`, exposed so
|
|
6
|
+
* UI/orchestration packages can build pickers without re-implementing
|
|
7
|
+
* the descriptor-shape understanding.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { listBrowsableStorageAdapters } from './list-browsable-adapters';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browsable Storage Adapters Query Helper
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper over `runtime.query('storage/adapter')` that filters
|
|
5
|
+
* registered storage adapters down to the ones declaring the `'browse'`
|
|
6
|
+
* capability — i.e. adapters that implement `listDrives()` +
|
|
7
|
+
* `list(driveId, path)` and are therefore suitable for cloud-storage
|
|
8
|
+
* picker UIs (model sources, knowledge corpora, etc.).
|
|
9
|
+
*
|
|
10
|
+
* Lives in `@vibesdotdev/storage/client` because it is consumer-facing
|
|
11
|
+
* (UIs and orchestration code) — not part of the kind core. The helper
|
|
12
|
+
* does not load adapter implementations; it only inspects descriptors.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { getVibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
16
|
+
import type { StorageAdapterDescriptor } from '../schemas/adapter-descriptor';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Return every `storage/adapter` descriptor whose declared
|
|
20
|
+
* `capabilities[]` includes `'browse'`.
|
|
21
|
+
*
|
|
22
|
+
* Synchronous descriptor read — no implementation loading. Safe to call
|
|
23
|
+
* from server endpoints that build picker payloads.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { listBrowsableStorageAdapters } from '@vibesdotdev/storage/client';
|
|
28
|
+
*
|
|
29
|
+
* const browsable = listBrowsableStorageAdapters();
|
|
30
|
+
* // → [{ id: 'sharepoint', name: 'SharePoint Storage', ... }, ...]
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function listBrowsableStorageAdapters(): StorageAdapterDescriptor[] {
|
|
34
|
+
const runtime = getVibesRuntime();
|
|
35
|
+
return runtime
|
|
36
|
+
.query('storage/adapter')
|
|
37
|
+
.filter((d) => {
|
|
38
|
+
const caps = (d as StorageAdapterDescriptor).capabilities;
|
|
39
|
+
return Array.isArray(caps) && caps.includes('browse');
|
|
40
|
+
})
|
|
41
|
+
.descriptors() as StorageAdapterDescriptor[];
|
|
42
|
+
}
|