gitx.do 0.1.1 → 0.1.3
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 +40 -353
- package/dist/do/logger.d.ts +50 -0
- package/dist/do/logger.d.ts.map +1 -0
- package/dist/do/logger.js +122 -0
- package/dist/do/logger.js.map +1 -0
- package/dist/{durable-object → do}/schema.d.ts +3 -3
- package/dist/do/schema.d.ts.map +1 -0
- package/dist/{durable-object → do}/schema.js +4 -3
- package/dist/do/schema.js.map +1 -0
- package/dist/do/types.d.ts +267 -0
- package/dist/do/types.d.ts.map +1 -0
- package/dist/do/types.js +62 -0
- package/dist/do/types.js.map +1 -0
- package/dist/index.d.ts +15 -469
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -481
- package/dist/index.js.map +1 -1
- package/dist/mcp/auth.d.ts +77 -0
- package/dist/mcp/auth.d.ts.map +1 -0
- package/dist/mcp/auth.js +278 -0
- package/dist/mcp/auth.js.map +1 -0
- package/dist/mcp/index.d.ts +13 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +19 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +200 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +275 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +47 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -0
- package/dist/mcp/tool-registry.js +284 -0
- package/dist/mcp/tool-registry.js.map +1 -0
- package/dist/mcp/tools.d.ts +103 -515
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +676 -3087
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts +124 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +9 -0
- package/dist/mcp/types.js.map +1 -0
- package/package.json +19 -21
- package/dist/cli/commands/add.d.ts +0 -176
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -979
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/blame.d.ts +0 -259
- package/dist/cli/commands/blame.d.ts.map +0 -1
- package/dist/cli/commands/blame.js +0 -609
- package/dist/cli/commands/blame.js.map +0 -1
- package/dist/cli/commands/branch.d.ts +0 -249
- package/dist/cli/commands/branch.d.ts.map +0 -1
- package/dist/cli/commands/branch.js +0 -693
- package/dist/cli/commands/branch.js.map +0 -1
- package/dist/cli/commands/checkout.d.ts +0 -73
- package/dist/cli/commands/checkout.d.ts.map +0 -1
- package/dist/cli/commands/checkout.js +0 -725
- package/dist/cli/commands/checkout.js.map +0 -1
- package/dist/cli/commands/commit.d.ts +0 -182
- package/dist/cli/commands/commit.d.ts.map +0 -1
- package/dist/cli/commands/commit.js +0 -457
- package/dist/cli/commands/commit.js.map +0 -1
- package/dist/cli/commands/diff.d.ts +0 -464
- package/dist/cli/commands/diff.d.ts.map +0 -1
- package/dist/cli/commands/diff.js +0 -959
- package/dist/cli/commands/diff.js.map +0 -1
- package/dist/cli/commands/log.d.ts +0 -239
- package/dist/cli/commands/log.d.ts.map +0 -1
- package/dist/cli/commands/log.js +0 -535
- package/dist/cli/commands/log.js.map +0 -1
- package/dist/cli/commands/merge.d.ts +0 -106
- package/dist/cli/commands/merge.d.ts.map +0 -1
- package/dist/cli/commands/merge.js +0 -852
- package/dist/cli/commands/merge.js.map +0 -1
- package/dist/cli/commands/review.d.ts +0 -457
- package/dist/cli/commands/review.d.ts.map +0 -1
- package/dist/cli/commands/review.js +0 -558
- package/dist/cli/commands/review.js.map +0 -1
- package/dist/cli/commands/stash.d.ts +0 -157
- package/dist/cli/commands/stash.d.ts.map +0 -1
- package/dist/cli/commands/stash.js +0 -655
- package/dist/cli/commands/stash.js.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -269
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/status.js +0 -492
- package/dist/cli/commands/status.js.map +0 -1
- package/dist/cli/commands/web.d.ts +0 -199
- package/dist/cli/commands/web.d.ts.map +0 -1
- package/dist/cli/commands/web.js +0 -697
- package/dist/cli/commands/web.js.map +0 -1
- package/dist/cli/fs-adapter.d.ts +0 -656
- package/dist/cli/fs-adapter.d.ts.map +0 -1
- package/dist/cli/fs-adapter.js +0 -1177
- package/dist/cli/fs-adapter.js.map +0 -1
- package/dist/cli/fsx-cli-adapter.d.ts +0 -359
- package/dist/cli/fsx-cli-adapter.d.ts.map +0 -1
- package/dist/cli/fsx-cli-adapter.js +0 -619
- package/dist/cli/fsx-cli-adapter.js.map +0 -1
- package/dist/cli/index.d.ts +0 -387
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -579
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/ui/components/DiffView.d.ts +0 -12
- package/dist/cli/ui/components/DiffView.d.ts.map +0 -1
- package/dist/cli/ui/components/DiffView.js +0 -11
- package/dist/cli/ui/components/DiffView.js.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.d.ts +0 -10
- package/dist/cli/ui/components/ErrorDisplay.d.ts.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.js +0 -11
- package/dist/cli/ui/components/ErrorDisplay.js.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.d.ts +0 -15
- package/dist/cli/ui/components/FuzzySearch.d.ts.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.js +0 -12
- package/dist/cli/ui/components/FuzzySearch.js.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.d.ts +0 -10
- package/dist/cli/ui/components/LoadingSpinner.d.ts.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.js +0 -10
- package/dist/cli/ui/components/LoadingSpinner.js.map +0 -1
- package/dist/cli/ui/components/NavigationList.d.ts +0 -14
- package/dist/cli/ui/components/NavigationList.d.ts.map +0 -1
- package/dist/cli/ui/components/NavigationList.js +0 -11
- package/dist/cli/ui/components/NavigationList.js.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.d.ts +0 -13
- package/dist/cli/ui/components/ScrollableContent.d.ts.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.js +0 -11
- package/dist/cli/ui/components/ScrollableContent.js.map +0 -1
- package/dist/cli/ui/components/index.d.ts +0 -7
- package/dist/cli/ui/components/index.d.ts.map +0 -1
- package/dist/cli/ui/components/index.js +0 -9
- package/dist/cli/ui/components/index.js.map +0 -1
- package/dist/cli/ui/terminal-ui.d.ts +0 -85
- package/dist/cli/ui/terminal-ui.d.ts.map +0 -1
- package/dist/cli/ui/terminal-ui.js +0 -121
- package/dist/cli/ui/terminal-ui.js.map +0 -1
- package/dist/do/BashModule.d.ts +0 -871
- package/dist/do/BashModule.d.ts.map +0 -1
- package/dist/do/BashModule.js +0 -1143
- package/dist/do/BashModule.js.map +0 -1
- package/dist/do/FsModule.d.ts +0 -612
- package/dist/do/FsModule.d.ts.map +0 -1
- package/dist/do/FsModule.js +0 -1120
- package/dist/do/FsModule.js.map +0 -1
- package/dist/do/GitModule.d.ts +0 -635
- package/dist/do/GitModule.d.ts.map +0 -1
- package/dist/do/GitModule.js +0 -784
- package/dist/do/GitModule.js.map +0 -1
- package/dist/do/GitRepoDO.d.ts +0 -281
- package/dist/do/GitRepoDO.d.ts.map +0 -1
- package/dist/do/GitRepoDO.js +0 -479
- package/dist/do/GitRepoDO.js.map +0 -1
- package/dist/do/bash-ast.d.ts +0 -246
- package/dist/do/bash-ast.d.ts.map +0 -1
- package/dist/do/bash-ast.js +0 -888
- package/dist/do/bash-ast.js.map +0 -1
- package/dist/do/container-executor.d.ts +0 -491
- package/dist/do/container-executor.d.ts.map +0 -1
- package/dist/do/container-executor.js +0 -731
- package/dist/do/container-executor.js.map +0 -1
- package/dist/do/index.d.ts +0 -53
- package/dist/do/index.d.ts.map +0 -1
- package/dist/do/index.js +0 -91
- package/dist/do/index.js.map +0 -1
- package/dist/do/tiered-storage.d.ts +0 -403
- package/dist/do/tiered-storage.d.ts.map +0 -1
- package/dist/do/tiered-storage.js +0 -689
- package/dist/do/tiered-storage.js.map +0 -1
- package/dist/do/withBash.d.ts +0 -231
- package/dist/do/withBash.d.ts.map +0 -1
- package/dist/do/withBash.js +0 -244
- package/dist/do/withBash.js.map +0 -1
- package/dist/do/withFs.d.ts +0 -237
- package/dist/do/withFs.d.ts.map +0 -1
- package/dist/do/withFs.js +0 -387
- package/dist/do/withFs.js.map +0 -1
- package/dist/do/withGit.d.ts +0 -180
- package/dist/do/withGit.d.ts.map +0 -1
- package/dist/do/withGit.js +0 -271
- package/dist/do/withGit.js.map +0 -1
- package/dist/durable-object/object-store.d.ts +0 -633
- package/dist/durable-object/object-store.d.ts.map +0 -1
- package/dist/durable-object/object-store.js +0 -1164
- package/dist/durable-object/object-store.js.map +0 -1
- package/dist/durable-object/schema.d.ts.map +0 -1
- package/dist/durable-object/schema.js.map +0 -1
- package/dist/durable-object/wal.d.ts +0 -416
- package/dist/durable-object/wal.d.ts.map +0 -1
- package/dist/durable-object/wal.js +0 -445
- package/dist/durable-object/wal.js.map +0 -1
- package/dist/mcp/adapter.d.ts +0 -772
- package/dist/mcp/adapter.d.ts.map +0 -1
- package/dist/mcp/adapter.js +0 -895
- package/dist/mcp/adapter.js.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -22
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.js +0 -140
- package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.d.ts +0 -32
- package/dist/mcp/sandbox/object-store-proxy.d.ts.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.js +0 -30
- package/dist/mcp/sandbox/object-store-proxy.js.map +0 -1
- package/dist/mcp/sandbox/template.d.ts +0 -17
- package/dist/mcp/sandbox/template.d.ts.map +0 -1
- package/dist/mcp/sandbox/template.js +0 -71
- package/dist/mcp/sandbox/template.js.map +0 -1
- package/dist/mcp/sandbox.d.ts +0 -764
- package/dist/mcp/sandbox.d.ts.map +0 -1
- package/dist/mcp/sandbox.js +0 -1362
- package/dist/mcp/sandbox.js.map +0 -1
- package/dist/mcp/sdk-adapter.d.ts +0 -835
- package/dist/mcp/sdk-adapter.d.ts.map +0 -1
- package/dist/mcp/sdk-adapter.js +0 -974
- package/dist/mcp/sdk-adapter.js.map +0 -1
- package/dist/mcp/tools/do.d.ts +0 -32
- package/dist/mcp/tools/do.d.ts.map +0 -1
- package/dist/mcp/tools/do.js +0 -117
- package/dist/mcp/tools/do.js.map +0 -1
- package/dist/ops/blame.d.ts +0 -551
- package/dist/ops/blame.d.ts.map +0 -1
- package/dist/ops/blame.js +0 -1037
- package/dist/ops/blame.js.map +0 -1
- package/dist/ops/branch.d.ts +0 -766
- package/dist/ops/branch.d.ts.map +0 -1
- package/dist/ops/branch.js +0 -950
- package/dist/ops/branch.js.map +0 -1
- package/dist/ops/commit-traversal.d.ts +0 -349
- package/dist/ops/commit-traversal.d.ts.map +0 -1
- package/dist/ops/commit-traversal.js +0 -821
- package/dist/ops/commit-traversal.js.map +0 -1
- package/dist/ops/commit.d.ts +0 -555
- package/dist/ops/commit.d.ts.map +0 -1
- package/dist/ops/commit.js +0 -826
- package/dist/ops/commit.js.map +0 -1
- package/dist/ops/merge-base.d.ts +0 -397
- package/dist/ops/merge-base.d.ts.map +0 -1
- package/dist/ops/merge-base.js +0 -691
- package/dist/ops/merge-base.js.map +0 -1
- package/dist/ops/merge.d.ts +0 -855
- package/dist/ops/merge.d.ts.map +0 -1
- package/dist/ops/merge.js +0 -1551
- package/dist/ops/merge.js.map +0 -1
- package/dist/ops/tag.d.ts +0 -247
- package/dist/ops/tag.d.ts.map +0 -1
- package/dist/ops/tag.js +0 -649
- package/dist/ops/tag.js.map +0 -1
- package/dist/ops/tree-builder.d.ts +0 -178
- package/dist/ops/tree-builder.d.ts.map +0 -1
- package/dist/ops/tree-builder.js +0 -271
- package/dist/ops/tree-builder.js.map +0 -1
- package/dist/ops/tree-diff.d.ts +0 -291
- package/dist/ops/tree-diff.d.ts.map +0 -1
- package/dist/ops/tree-diff.js +0 -705
- package/dist/ops/tree-diff.js.map +0 -1
- package/dist/pack/delta.d.ts +0 -248
- package/dist/pack/delta.d.ts.map +0 -1
- package/dist/pack/delta.js +0 -740
- package/dist/pack/delta.js.map +0 -1
- package/dist/pack/format.d.ts +0 -446
- package/dist/pack/format.d.ts.map +0 -1
- package/dist/pack/format.js +0 -572
- package/dist/pack/format.js.map +0 -1
- package/dist/pack/full-generation.d.ts +0 -612
- package/dist/pack/full-generation.d.ts.map +0 -1
- package/dist/pack/full-generation.js +0 -1378
- package/dist/pack/full-generation.js.map +0 -1
- package/dist/pack/generation.d.ts +0 -441
- package/dist/pack/generation.d.ts.map +0 -1
- package/dist/pack/generation.js +0 -707
- package/dist/pack/generation.js.map +0 -1
- package/dist/pack/index.d.ts +0 -502
- package/dist/pack/index.d.ts.map +0 -1
- package/dist/pack/index.js +0 -833
- package/dist/pack/index.js.map +0 -1
- package/dist/refs/branch.d.ts +0 -683
- package/dist/refs/branch.d.ts.map +0 -1
- package/dist/refs/branch.js +0 -881
- package/dist/refs/branch.js.map +0 -1
- package/dist/refs/storage.d.ts +0 -833
- package/dist/refs/storage.d.ts.map +0 -1
- package/dist/refs/storage.js +0 -1023
- package/dist/refs/storage.js.map +0 -1
- package/dist/refs/tag.d.ts +0 -860
- package/dist/refs/tag.d.ts.map +0 -1
- package/dist/refs/tag.js +0 -996
- package/dist/refs/tag.js.map +0 -1
- package/dist/storage/backend.d.ts +0 -425
- package/dist/storage/backend.d.ts.map +0 -1
- package/dist/storage/backend.js +0 -41
- package/dist/storage/backend.js.map +0 -1
- package/dist/storage/fsx-adapter.d.ts +0 -204
- package/dist/storage/fsx-adapter.d.ts.map +0 -1
- package/dist/storage/fsx-adapter.js +0 -518
- package/dist/storage/fsx-adapter.js.map +0 -1
- package/dist/storage/lru-cache.d.ts +0 -691
- package/dist/storage/lru-cache.d.ts.map +0 -1
- package/dist/storage/lru-cache.js +0 -813
- package/dist/storage/lru-cache.js.map +0 -1
- package/dist/storage/object-index.d.ts +0 -585
- package/dist/storage/object-index.d.ts.map +0 -1
- package/dist/storage/object-index.js +0 -532
- package/dist/storage/object-index.js.map +0 -1
- package/dist/storage/r2-pack.d.ts +0 -1257
- package/dist/storage/r2-pack.d.ts.map +0 -1
- package/dist/storage/r2-pack.js +0 -1773
- package/dist/storage/r2-pack.js.map +0 -1
- package/dist/tiered/cdc-pipeline.d.ts +0 -1888
- package/dist/tiered/cdc-pipeline.d.ts.map +0 -1
- package/dist/tiered/cdc-pipeline.js +0 -1880
- package/dist/tiered/cdc-pipeline.js.map +0 -1
- package/dist/tiered/migration.d.ts +0 -1104
- package/dist/tiered/migration.d.ts.map +0 -1
- package/dist/tiered/migration.js +0 -1217
- package/dist/tiered/migration.js.map +0 -1
- package/dist/tiered/parquet-writer.d.ts +0 -1145
- package/dist/tiered/parquet-writer.d.ts.map +0 -1
- package/dist/tiered/parquet-writer.js +0 -1183
- package/dist/tiered/parquet-writer.js.map +0 -1
- package/dist/tiered/read-path.d.ts +0 -835
- package/dist/tiered/read-path.d.ts.map +0 -1
- package/dist/tiered/read-path.js +0 -487
- package/dist/tiered/read-path.js.map +0 -1
- package/dist/types/capability.d.ts +0 -1385
- package/dist/types/capability.d.ts.map +0 -1
- package/dist/types/capability.js +0 -36
- package/dist/types/capability.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -18
- package/dist/types/index.js.map +0 -1
- package/dist/types/interfaces.d.ts +0 -673
- package/dist/types/interfaces.d.ts.map +0 -1
- package/dist/types/interfaces.js +0 -26
- package/dist/types/interfaces.js.map +0 -1
- package/dist/types/objects.d.ts +0 -692
- package/dist/types/objects.d.ts.map +0 -1
- package/dist/types/objects.js +0 -837
- package/dist/types/objects.js.map +0 -1
- package/dist/types/storage.d.ts +0 -603
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js +0 -191
- package/dist/types/storage.js.map +0 -1
- package/dist/types/worker-loader.d.ts +0 -60
- package/dist/types/worker-loader.d.ts.map +0 -1
- package/dist/types/worker-loader.js +0 -62
- package/dist/types/worker-loader.js.map +0 -1
- package/dist/utils/hash.d.ts +0 -198
- package/dist/utils/hash.d.ts.map +0 -1
- package/dist/utils/hash.js +0 -272
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/sha1.d.ts +0 -325
- package/dist/utils/sha1.d.ts.map +0 -1
- package/dist/utils/sha1.js +0 -635
- package/dist/utils/sha1.js.map +0 -1
- package/dist/wire/capabilities.d.ts +0 -1044
- package/dist/wire/capabilities.d.ts.map +0 -1
- package/dist/wire/capabilities.js +0 -941
- package/dist/wire/capabilities.js.map +0 -1
- package/dist/wire/path-security.d.ts +0 -157
- package/dist/wire/path-security.d.ts.map +0 -1
- package/dist/wire/path-security.js +0 -307
- package/dist/wire/path-security.js.map +0 -1
- package/dist/wire/pkt-line.d.ts +0 -345
- package/dist/wire/pkt-line.d.ts.map +0 -1
- package/dist/wire/pkt-line.js +0 -381
- package/dist/wire/pkt-line.js.map +0 -1
- package/dist/wire/receive-pack.d.ts +0 -1059
- package/dist/wire/receive-pack.d.ts.map +0 -1
- package/dist/wire/receive-pack.js +0 -1414
- package/dist/wire/receive-pack.js.map +0 -1
- package/dist/wire/smart-http.d.ts +0 -799
- package/dist/wire/smart-http.d.ts.map +0 -1
- package/dist/wire/smart-http.js +0 -945
- package/dist/wire/smart-http.js.map +0 -1
- package/dist/wire/upload-pack.d.ts +0 -727
- package/dist/wire/upload-pack.d.ts.map +0 -1
- package/dist/wire/upload-pack.js +0 -1141
- package/dist/wire/upload-pack.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,507 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview gitx.do -
|
|
2
|
+
* @fileoverview gitx.do - Git on Cloudflare Durable Objects
|
|
3
3
|
*
|
|
4
|
-
* This
|
|
5
|
-
*
|
|
6
|
-
* and R2 storage.
|
|
7
|
-
*
|
|
8
|
-
* **Architecture Overview**:
|
|
9
|
-
* - **Types**: Core Git object types (blob, tree, commit, tag)
|
|
10
|
-
* - **Pack Operations**: Packfile format handling and index management
|
|
11
|
-
* - **Git Operations**: Core commands (merge, blame, commit, branch)
|
|
12
|
-
* - **MCP Integration**: Model Context Protocol for AI assistant integration
|
|
13
|
-
* - **Wire Protocol**: Git Smart HTTP protocol implementation
|
|
14
|
-
* - **Storage**: R2 packfile storage and object indexing
|
|
15
|
-
* - **Tiered Storage**: Hot/Warm/Cold storage with migration
|
|
4
|
+
* This package provides the Cloudflare Workers/Durable Objects integration
|
|
5
|
+
* for gitx. It depends on @dotdo/gitx for the pure git implementation.
|
|
16
6
|
*
|
|
17
7
|
* @module gitx.do
|
|
18
8
|
*
|
|
19
9
|
* @example
|
|
20
10
|
* ```typescript
|
|
21
|
-
* import {
|
|
22
|
-
* // Types
|
|
23
|
-
* type CommitObject,
|
|
24
|
-
* parseCommit,
|
|
25
|
-
* serializeCommit,
|
|
26
|
-
*
|
|
27
|
-
* // Operations
|
|
28
|
-
* createCommit,
|
|
29
|
-
* merge,
|
|
30
|
-
* blame,
|
|
31
|
-
*
|
|
32
|
-
* // Storage
|
|
33
|
-
* R2PackStorage,
|
|
34
|
-
* ObjectIndex,
|
|
11
|
+
* import { GitRepoDO, GitModule, withGit } from 'gitx.do'
|
|
35
12
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* handleUploadPack,
|
|
39
|
-
* } from 'gitx.do'
|
|
13
|
+
* // Use GitRepoDO for full repository management
|
|
14
|
+
* export { GitRepoDO }
|
|
40
15
|
*
|
|
41
|
-
* //
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* author: { name: 'Alice', email: 'alice@example.com' }
|
|
47
|
-
* })
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
// =============================================================================
|
|
51
|
-
// Types - Core Git object types and interfaces
|
|
52
|
-
// =============================================================================
|
|
53
|
-
/**
|
|
54
|
-
* Git object types and serialization.
|
|
55
|
-
*
|
|
56
|
-
* @description
|
|
57
|
-
* Core types for Git objects (blob, tree, commit, tag) including:
|
|
58
|
-
* - Type definitions for each object type
|
|
59
|
-
* - Type guard functions for runtime type checking
|
|
60
|
-
* - Serialization functions for converting to Git format
|
|
61
|
-
* - Deserialization functions for parsing Git format
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* import { isCommit, parseCommit, serializeCommit } from 'gitx.do'
|
|
66
|
-
*
|
|
67
|
-
* // Parse raw commit data
|
|
68
|
-
* const commit = parseCommit(rawData)
|
|
69
|
-
*
|
|
70
|
-
* // Check type at runtime
|
|
71
|
-
* if (isCommit(obj)) {
|
|
72
|
-
* console.log(obj.message)
|
|
16
|
+
* // Or use mixins for custom DOs
|
|
17
|
+
* class MyDO extends withGit(DurableObject) {
|
|
18
|
+
* async doSomething() {
|
|
19
|
+
* await this.git.clone('https://github.com/org/repo')
|
|
20
|
+
* }
|
|
73
21
|
* }
|
|
74
22
|
* ```
|
|
75
23
|
*/
|
|
76
|
-
export {
|
|
77
|
-
// Type guards
|
|
78
|
-
isBlob, isTree, isCommit, isTag,
|
|
79
|
-
// Validation constants
|
|
80
|
-
SHA_PATTERN, VALID_MODES,
|
|
81
|
-
// Validation functions
|
|
82
|
-
isValidSha, isValidObjectType, isValidMode, validateTreeEntry, validateAuthor, validateCommit, validateTag,
|
|
83
|
-
// Serialization
|
|
84
|
-
serializeBlob, serializeTree, serializeCommit, serializeTag,
|
|
85
|
-
// Deserialization
|
|
86
|
-
parseBlob, parseTree, parseCommit, parseTag, } from './types/objects';
|
|
87
|
-
/**
|
|
88
|
-
* Storage interface types and validation.
|
|
89
|
-
*
|
|
90
|
-
* @description
|
|
91
|
-
* Core storage interfaces for Git object stores and commit providers:
|
|
92
|
-
* - {@link ObjectStore}: Full-featured object storage with refs
|
|
93
|
-
* - {@link BasicObjectStore}: Minimal object CRUD
|
|
94
|
-
* - {@link RefObjectStore}: Object store with ref management
|
|
95
|
-
* - {@link TreeDiffObjectStore}: Specialized for tree operations
|
|
96
|
-
* - {@link CommitProvider}: Commit retrieval interface
|
|
97
|
-
* - {@link BasicCommitProvider}: Minimal commit access
|
|
98
|
-
*
|
|
99
|
-
* Plus validation helpers for storage operations.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* import {
|
|
104
|
-
* type ObjectStore,
|
|
105
|
-
* validateRefName,
|
|
106
|
-
* assertValidSha
|
|
107
|
-
* } from 'gitx.do'
|
|
108
|
-
*
|
|
109
|
-
* // Validate before storing
|
|
110
|
-
* assertValidSha(treeSha, 'tree')
|
|
111
|
-
* const refResult = validateRefName('refs/heads/main')
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
export {
|
|
115
|
-
// Validation functions
|
|
116
|
-
validateRefName, validateRefUpdate, validateStoreParams, assertValidSha, assertValidRefName, } from './types/storage';
|
|
117
24
|
// =============================================================================
|
|
118
|
-
//
|
|
25
|
+
// Re-export core git types from @dotdo/gitx
|
|
119
26
|
// =============================================================================
|
|
120
|
-
|
|
121
|
-
* Packfile format handling.
|
|
122
|
-
*
|
|
123
|
-
* @description
|
|
124
|
-
* Functions for reading and writing Git packfiles including:
|
|
125
|
-
* - Pack header parsing and creation
|
|
126
|
-
* - Variable-length integer encoding/decoding
|
|
127
|
-
* - Object type and size encoding
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* import { createPackfile, parsePackHeader } from 'gitx.do'
|
|
132
|
-
*
|
|
133
|
-
* // Create a packfile from objects
|
|
134
|
-
* const packData = await createPackfile(objects)
|
|
135
|
-
*
|
|
136
|
-
* // Parse pack header
|
|
137
|
-
* const header = parsePackHeader(packData)
|
|
138
|
-
* console.log(`Pack contains ${header.objectCount} objects`)
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
export {
|
|
142
|
-
// Constants
|
|
143
|
-
PACK_SIGNATURE, PACK_VERSION,
|
|
144
|
-
// Enums
|
|
145
|
-
PackObjectType,
|
|
146
|
-
// Type conversions
|
|
147
|
-
packObjectTypeToString, stringToPackObjectType,
|
|
148
|
-
// Variable-length encoding
|
|
149
|
-
encodeVarint, decodeVarint, encodeTypeAndSize, decodeTypeAndSize,
|
|
150
|
-
// Pack header
|
|
151
|
-
parsePackHeader, parsePackObject, createPackfile, } from './pack/format';
|
|
152
|
-
/**
|
|
153
|
-
* Pack index operations.
|
|
154
|
-
*
|
|
155
|
-
* @description
|
|
156
|
-
* Functions for reading and writing pack index files (.idx) including:
|
|
157
|
-
* - Index parsing and creation
|
|
158
|
-
* - Object lookup by SHA
|
|
159
|
-
* - CRC32 calculation for verification
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```typescript
|
|
163
|
-
* import { createPackIndex, lookupObject } from 'gitx.do'
|
|
164
|
-
*
|
|
165
|
-
* // Create index for a packfile
|
|
166
|
-
* const index = await createPackIndex(packData)
|
|
167
|
-
*
|
|
168
|
-
* // Look up an object
|
|
169
|
-
* const result = lookupObject(index, sha)
|
|
170
|
-
* if (result) {
|
|
171
|
-
* console.log(`Object at offset ${result.offset}`)
|
|
172
|
-
* }
|
|
173
|
-
* ```
|
|
174
|
-
*/
|
|
175
|
-
export {
|
|
176
|
-
// Constants
|
|
177
|
-
PACK_INDEX_SIGNATURE, PACK_INDEX_MAGIC, PACK_INDEX_VERSION, LARGE_OFFSET_THRESHOLD,
|
|
178
|
-
// Main functions
|
|
179
|
-
parsePackIndex, createPackIndex, lookupObject, verifyPackIndex, serializePackIndex,
|
|
180
|
-
// Utility functions
|
|
181
|
-
getFanoutRange, calculateCRC32, binarySearchObjectId, binarySearchSha, parseFanoutTable, readPackOffset, } from './pack/index';
|
|
27
|
+
export * from '@dotdo/gitx';
|
|
182
28
|
// =============================================================================
|
|
183
|
-
//
|
|
29
|
+
// Cloudflare-specific Schema Management
|
|
184
30
|
// =============================================================================
|
|
185
|
-
|
|
186
|
-
* Merge operations.
|
|
187
|
-
*
|
|
188
|
-
* @description
|
|
189
|
-
* Functions for performing Git merges including:
|
|
190
|
-
* - Three-way merge algorithm
|
|
191
|
-
* - Merge base finding
|
|
192
|
-
* - Conflict detection and resolution
|
|
193
|
-
* - Content merging for text files
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* ```typescript
|
|
197
|
-
* import { merge, findMergeBase, resolveConflict } from 'gitx.do'
|
|
198
|
-
*
|
|
199
|
-
* // Find merge base
|
|
200
|
-
* const base = await findMergeBase(storage, commit1, commit2)
|
|
201
|
-
*
|
|
202
|
-
* // Perform merge
|
|
203
|
-
* const result = await merge(storage, {
|
|
204
|
-
* ours: 'main',
|
|
205
|
-
* theirs: 'feature',
|
|
206
|
-
* strategy: 'recursive'
|
|
207
|
-
* })
|
|
208
|
-
*
|
|
209
|
-
* if (result.conflicts.length > 0) {
|
|
210
|
-
* // Handle conflicts
|
|
211
|
-
* }
|
|
212
|
-
* ```
|
|
213
|
-
*/
|
|
214
|
-
export { merge, findMergeBase, resolveConflict, abortMerge, continueMerge, getMergeState, isMergeInProgress, mergeContent, isBinaryFile, } from './ops/merge';
|
|
215
|
-
/**
|
|
216
|
-
* Blame operations.
|
|
217
|
-
*
|
|
218
|
-
* @description
|
|
219
|
-
* Functions for git blame functionality including:
|
|
220
|
-
* - Line-by-line attribution
|
|
221
|
-
* - Rename tracking across history
|
|
222
|
-
* - Range-based blame
|
|
223
|
-
* - Blame output formatting
|
|
224
|
-
*
|
|
225
|
-
* @example
|
|
226
|
-
* ```typescript
|
|
227
|
-
* import { blame, blameFile, formatBlame } from 'gitx.do'
|
|
228
|
-
*
|
|
229
|
-
* // Get blame for a file
|
|
230
|
-
* const result = await blameFile(storage, 'src/index.ts', { commit: 'HEAD' })
|
|
231
|
-
*
|
|
232
|
-
* // Format for display
|
|
233
|
-
* const output = formatBlame(result, { showEmail: true })
|
|
234
|
-
* ```
|
|
235
|
-
*/
|
|
236
|
-
export { blame, blameFile, blameLine, blameRange, getBlameForCommit, trackContentAcrossRenames, detectRenames, buildBlameHistory, formatBlame, parseBlameOutput, } from './ops/blame';
|
|
237
|
-
/**
|
|
238
|
-
* Commit operations.
|
|
239
|
-
*
|
|
240
|
-
* @description
|
|
241
|
-
* Functions for creating and working with commits including:
|
|
242
|
-
* - Commit creation and amendment
|
|
243
|
-
* - Commit message formatting and validation
|
|
244
|
-
* - Signature handling (GPG)
|
|
245
|
-
* - Author/timestamp utilities
|
|
246
|
-
*
|
|
247
|
-
* @example
|
|
248
|
-
* ```typescript
|
|
249
|
-
* import { createCommit, createAuthor, formatTimestamp } from 'gitx.do'
|
|
250
|
-
*
|
|
251
|
-
* const author = createAuthor('Alice', 'alice@example.com')
|
|
252
|
-
* const commit = await createCommit(storage, {
|
|
253
|
-
* tree: treeSha,
|
|
254
|
-
* parents: [parentSha],
|
|
255
|
-
* author,
|
|
256
|
-
* message: 'Add new feature'
|
|
257
|
-
* })
|
|
258
|
-
* ```
|
|
259
|
-
*/
|
|
260
|
-
export { createCommit, amendCommit, buildCommitObject, formatCommitMessage, parseCommitMessage, validateCommitMessage, isCommitSigned, extractCommitSignature, addSignatureToCommit, isEmptyCommit, getCurrentTimezone, formatTimestamp, parseTimestamp, createAuthor, } from './ops/commit';
|
|
261
|
-
/**
|
|
262
|
-
* Branch operations.
|
|
263
|
-
*
|
|
264
|
-
* @description
|
|
265
|
-
* Functions for branch management including:
|
|
266
|
-
* - Branch creation, deletion, and renaming
|
|
267
|
-
* - Branch listing and filtering
|
|
268
|
-
* - Upstream tracking configuration
|
|
269
|
-
* - Branch validation
|
|
270
|
-
*
|
|
271
|
-
* @example
|
|
272
|
-
* ```typescript
|
|
273
|
-
* import { createBranch, listBranches, getCurrentBranch } from 'gitx.do'
|
|
274
|
-
*
|
|
275
|
-
* // Create a new branch
|
|
276
|
-
* await createBranch(storage, 'feature/new-thing', { startPoint: 'main' })
|
|
277
|
-
*
|
|
278
|
-
* // List all branches
|
|
279
|
-
* const branches = await listBranches(storage, { includeRemotes: true })
|
|
280
|
-
*
|
|
281
|
-
* // Get current branch
|
|
282
|
-
* const current = await getCurrentBranch(storage)
|
|
283
|
-
* ```
|
|
284
|
-
*/
|
|
285
|
-
export { createBranch, deleteBranch, listBranches, renameBranch, checkoutBranch, getCurrentBranch, getBranchInfo, branchExists, setBranchTracking, getBranchTracking, removeBranchTracking, getDefaultBranch, setDefaultBranch, isValidBranchName, normalizeBranchName, } from './ops/branch';
|
|
31
|
+
export { SchemaManager, SCHEMA_VERSION, SCHEMA_SQL, } from './do/schema';
|
|
286
32
|
// =============================================================================
|
|
287
|
-
//
|
|
33
|
+
// Cloudflare-specific Types
|
|
288
34
|
// =============================================================================
|
|
289
|
-
/**
|
|
290
|
-
* MCP tool definitions.
|
|
291
|
-
*
|
|
292
|
-
* @description
|
|
293
|
-
* Tools for integrating with AI assistants via MCP including:
|
|
294
|
-
* - Tool registration and discovery
|
|
295
|
-
* - Input validation
|
|
296
|
-
* - Tool invocation
|
|
297
|
-
*
|
|
298
|
-
* @example
|
|
299
|
-
* ```typescript
|
|
300
|
-
* import { gitTools, invokeTool, validateToolInput } from 'gitx.do'
|
|
301
|
-
*
|
|
302
|
-
* // List available tools
|
|
303
|
-
* const tools = gitTools
|
|
304
|
-
*
|
|
305
|
-
* // Validate and invoke a tool
|
|
306
|
-
* if (validateToolInput('git_status', input)) {
|
|
307
|
-
* const result = await invokeTool('git_status', input, context)
|
|
308
|
-
* }
|
|
309
|
-
* ```
|
|
310
|
-
*/
|
|
311
35
|
export {
|
|
312
|
-
//
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
*
|
|
317
|
-
* @description
|
|
318
|
-
* Adapter for MCP protocol communication including:
|
|
319
|
-
* - Request/response handling
|
|
320
|
-
* - Capability negotiation
|
|
321
|
-
* - Error handling
|
|
322
|
-
*
|
|
323
|
-
* @example
|
|
324
|
-
* ```typescript
|
|
325
|
-
* import { createMCPAdapter, MCPError, MCPErrorCode } from 'gitx.do'
|
|
326
|
-
*
|
|
327
|
-
* const adapter = createMCPAdapter({
|
|
328
|
-
* name: 'gitx.do',
|
|
329
|
-
* version: '1.0.0'
|
|
330
|
-
* })
|
|
331
|
-
*
|
|
332
|
-
* const response = await adapter.handleRequest(request)
|
|
333
|
-
* ```
|
|
334
|
-
*/
|
|
335
|
-
export {
|
|
336
|
-
// Adapter
|
|
337
|
-
MCPAdapter, createMCPAdapter, MCPError, MCPErrorCode, } from './mcp/adapter';
|
|
36
|
+
// Error types
|
|
37
|
+
GitRepoDOErrorCode, GitRepoDOError,
|
|
38
|
+
// Logging types
|
|
39
|
+
LogLevel, } from './do/types';
|
|
338
40
|
// =============================================================================
|
|
339
|
-
//
|
|
41
|
+
// Logger utilities
|
|
340
42
|
// =============================================================================
|
|
341
|
-
|
|
342
|
-
* Smart HTTP protocol handlers.
|
|
343
|
-
*
|
|
344
|
-
* @description
|
|
345
|
-
* Functions for handling Git Smart HTTP protocol including:
|
|
346
|
-
* - Info/refs endpoint handling
|
|
347
|
-
* - Upload-pack (fetch/clone)
|
|
348
|
-
* - Receive-pack (push)
|
|
349
|
-
* - Capability negotiation
|
|
350
|
-
*
|
|
351
|
-
* @example
|
|
352
|
-
* ```typescript
|
|
353
|
-
* import { handleInfoRefs, handleUploadPack, handleReceivePack } from 'gitx.do'
|
|
354
|
-
*
|
|
355
|
-
* // Handle info/refs request
|
|
356
|
-
* const refs = await handleInfoRefs(request, { service: 'git-upload-pack' })
|
|
357
|
-
*
|
|
358
|
-
* // Handle fetch request
|
|
359
|
-
* const pack = await handleUploadPack(request, storage)
|
|
360
|
-
* ```
|
|
361
|
-
*/
|
|
362
|
-
export {
|
|
363
|
-
// Request handlers
|
|
364
|
-
handleInfoRefs, handleUploadPack, handleReceivePack,
|
|
365
|
-
// Formatting
|
|
366
|
-
formatRefAdvertisement, formatUploadPackResponse, formatReceivePackResponse,
|
|
367
|
-
// Parsing
|
|
368
|
-
parseUploadPackRequest, parseReceivePackRequest, parseCapabilities, capabilitiesToStrings,
|
|
369
|
-
// Utilities
|
|
370
|
-
validateContentType, createErrorResponse,
|
|
371
|
-
// Constants
|
|
372
|
-
CONTENT_TYPE_UPLOAD_PACK_ADVERTISEMENT, CONTENT_TYPE_RECEIVE_PACK_ADVERTISEMENT, CONTENT_TYPE_UPLOAD_PACK_REQUEST, CONTENT_TYPE_UPLOAD_PACK_RESULT, CONTENT_TYPE_RECEIVE_PACK_REQUEST, CONTENT_TYPE_RECEIVE_PACK_RESULT, ZERO_SHA, } from './wire/smart-http';
|
|
373
|
-
/**
|
|
374
|
-
* Pkt-line encoding/decoding.
|
|
375
|
-
*
|
|
376
|
-
* @description
|
|
377
|
-
* Functions for Git pkt-line format handling including:
|
|
378
|
-
* - Line encoding/decoding
|
|
379
|
-
* - Flush and delimiter packets
|
|
380
|
-
* - Stream processing
|
|
381
|
-
*
|
|
382
|
-
* @example
|
|
383
|
-
* ```typescript
|
|
384
|
-
* import { encodePktLine, decodePktLine, FLUSH_PKT } from 'gitx.do'
|
|
385
|
-
*
|
|
386
|
-
* // Encode a line
|
|
387
|
-
* const encoded = encodePktLine('want abc123')
|
|
388
|
-
*
|
|
389
|
-
* // Decode a line
|
|
390
|
-
* const { line, remaining } = decodePktLine(data)
|
|
391
|
-
* ```
|
|
392
|
-
*/
|
|
393
|
-
export {
|
|
394
|
-
// Encoding/decoding
|
|
395
|
-
encodePktLine, decodePktLine, encodeFlushPkt, encodeDelimPkt, pktLineStream,
|
|
396
|
-
// Constants
|
|
397
|
-
FLUSH_PKT, DELIM_PKT, MAX_PKT_LINE_DATA, } from './wire/pkt-line';
|
|
43
|
+
export { createLogger, createChildLogger, noopLogger, } from './do/logger';
|
|
398
44
|
// =============================================================================
|
|
399
|
-
//
|
|
45
|
+
// MCP Server
|
|
400
46
|
// =============================================================================
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
* - Pack locking for concurrent access
|
|
409
|
-
*
|
|
410
|
-
* @example
|
|
411
|
-
* ```typescript
|
|
412
|
-
* import { R2PackStorage, uploadPackfile, listPackfiles } from 'gitx.do'
|
|
413
|
-
*
|
|
414
|
-
* const storage = new R2PackStorage(r2Bucket, { prefix: 'git/packs' })
|
|
415
|
-
*
|
|
416
|
-
* // Upload a packfile
|
|
417
|
-
* const result = await uploadPackfile(storage, packData, { withIndex: true })
|
|
418
|
-
*
|
|
419
|
-
* // List all packfiles
|
|
420
|
-
* const packs = await listPackfiles(storage)
|
|
421
|
-
* ```
|
|
422
|
-
*/
|
|
423
|
-
export {
|
|
424
|
-
// Class
|
|
425
|
-
R2PackStorage, R2PackError,
|
|
426
|
-
// Standalone functions
|
|
427
|
-
uploadPackfile, downloadPackfile, getPackfileMetadata, listPackfiles, deletePackfile, createMultiPackIndex, parseMultiPackIndex, lookupObjectInMultiPack, acquirePackLock, releasePackLock, } from './storage/r2-pack';
|
|
428
|
-
/**
|
|
429
|
-
* Object index.
|
|
430
|
-
*
|
|
431
|
-
* @description
|
|
432
|
-
* Functions for tracking object locations across storage tiers including:
|
|
433
|
-
* - Location recording and lookup
|
|
434
|
-
* - Batch operations
|
|
435
|
-
* - Statistics
|
|
436
|
-
*
|
|
437
|
-
* @example
|
|
438
|
-
* ```typescript
|
|
439
|
-
* import { ObjectIndex, recordLocation, lookupLocation } from 'gitx.do'
|
|
440
|
-
*
|
|
441
|
-
* const index = new ObjectIndex(storage)
|
|
442
|
-
*
|
|
443
|
-
* // Record object location
|
|
444
|
-
* await recordLocation(index, sha, { tier: 'hot', location: 'local' })
|
|
445
|
-
*
|
|
446
|
-
* // Look up location
|
|
447
|
-
* const location = await lookupLocation(index, sha)
|
|
448
|
-
* ```
|
|
449
|
-
*/
|
|
450
|
-
export {
|
|
451
|
-
// Class
|
|
452
|
-
ObjectIndex,
|
|
453
|
-
// Standalone functions
|
|
454
|
-
recordLocation, lookupLocation, batchLookup, getStats, } from './storage/object-index';
|
|
47
|
+
export { registerTool, unregisterTool, invokeTool, getToolRegistry, clearToolRegistry, useMiddleware, clearMiddleware,
|
|
48
|
+
// Git tools
|
|
49
|
+
gitTools, gitStatusToolSchema, gitLogToolSchema, gitDiffToolSchema, gitShowToolSchema, gitCommitToolSchema, gitBranchToolSchema, gitCheckoutToolSchema, gitAddToolSchema, gitResetToolSchema, gitMergeToolSchema, gitRebaseToolSchema, gitStashToolSchema, gitTagToolSchema, gitRemoteToolSchema, gitFetchToolSchema, gitPushToolSchema, gitPullToolSchema, gitCloneToolSchema, gitInitToolSchema, gitBlameToolSchema,
|
|
50
|
+
// Auth
|
|
51
|
+
gitAuthMiddleware, requireGitAuth, requireGitWrite, requireGitAdmin,
|
|
52
|
+
// Server
|
|
53
|
+
createGitMCPServer, } from './mcp/index';
|
|
455
54
|
// =============================================================================
|
|
456
|
-
//
|
|
55
|
+
// TODO: Additional exports to be added as migration continues
|
|
457
56
|
// =============================================================================
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
*
|
|
467
|
-
* @example
|
|
468
|
-
* ```typescript
|
|
469
|
-
* import { TierMigrator, AccessTracker } from 'gitx.do'
|
|
470
|
-
*
|
|
471
|
-
* const tracker = new AccessTracker(storage)
|
|
472
|
-
* await tracker.recordAccess(sha)
|
|
473
|
-
*
|
|
474
|
-
* const migrator = new TierMigrator(storage, { policy: 'lru' })
|
|
475
|
-
* await migrator.migrate(sha, 'hot', 'warm')
|
|
476
|
-
* ```
|
|
477
|
-
*/
|
|
478
|
-
export {
|
|
479
|
-
// Classes
|
|
480
|
-
TierMigrator, AccessTracker, MigrationError, MigrationRollback, ConcurrentAccessHandler, } from './tiered/migration';
|
|
481
|
-
/**
|
|
482
|
-
* Tiered read path.
|
|
483
|
-
*
|
|
484
|
-
* @description
|
|
485
|
-
* Functions for reading objects across storage tiers including:
|
|
486
|
-
* - Automatic tier traversal
|
|
487
|
-
* - Caching strategies
|
|
488
|
-
* - Read optimization
|
|
489
|
-
*
|
|
490
|
-
* @example
|
|
491
|
-
* ```typescript
|
|
492
|
-
* import { TieredReader, type TieredStorageConfig } from 'gitx.do'
|
|
493
|
-
*
|
|
494
|
-
* const config: TieredStorageConfig = {
|
|
495
|
-
* hot: { backend: hotBackend, maxSize: 1_000_000 },
|
|
496
|
-
* warm: { backend: warmBackend },
|
|
497
|
-
* cold: { backend: coldBackend }
|
|
498
|
-
* }
|
|
499
|
-
*
|
|
500
|
-
* const reader = new TieredReader(config)
|
|
501
|
-
* const result = await reader.read(sha)
|
|
502
|
-
* ```
|
|
503
|
-
*/
|
|
504
|
-
export {
|
|
505
|
-
// Class
|
|
506
|
-
TieredReader, TieredObjectStoreStub, } from './tiered/read-path';
|
|
57
|
+
// - GitRepoDO
|
|
58
|
+
// - GitModule
|
|
59
|
+
// - FsModule
|
|
60
|
+
// - withGit, withFs mixins
|
|
61
|
+
// - TieredStorage
|
|
62
|
+
// - ObjectStore
|
|
63
|
+
// - WAL
|
|
64
|
+
// - Container executor
|
|
507
65
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,gFAAgF;AAChF,4CAA4C;AAC5C,gFAAgF;AAEhF,cAAc,aAAa,CAAA;AAE3B,gFAAgF;AAChF,wCAAwC;AACxC,gFAAgF;AAEhF,OAAO,EACL,aAAa,EACb,cAAc,EACd,UAAU,GAEX,MAAM,aAAa,CAAA;AAEpB,gFAAgF;AAChF,4BAA4B;AAC5B,gFAAgF;AAEhF,OAAO;AA8BL,cAAc;AACd,kBAAkB,EAClB,cAAc;AAEd,gBAAgB;AAChB,QAAQ,GAMT,MAAM,YAAY,CAAA;AAEnB,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,UAAU,GAEX,MAAM,aAAa,CAAA;AAEpB,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,OAAO,EAUL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe;AACf,YAAY;AACZ,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB;AAClB,OAAO;AACP,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,eAAe;AAGf,SAAS;AACT,kBAAkB,GAEnB,MAAM,aAAa,CAAA;AAEpB,gFAAgF;AAChF,8DAA8D;AAC9D,gFAAgF;AAChF,cAAc;AACd,cAAc;AACd,aAAa;AACb,2BAA2B;AAC3B,kBAAkB;AAClB,gBAAgB;AAChB,QAAQ;AACR,uBAAuB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git MCP Authentication Middleware
|
|
3
|
+
*
|
|
4
|
+
* Provides OAuth 2.1 authentication via oauth.do for MCP git operations.
|
|
5
|
+
* Implements token introspection (RFC 7662) for access control.
|
|
6
|
+
*
|
|
7
|
+
* ## Authentication Flow
|
|
8
|
+
*
|
|
9
|
+
* 1. MCP client sends request with Bearer token
|
|
10
|
+
* 2. Middleware introspects token via oauth.do
|
|
11
|
+
* 3. Scopes determine access level:
|
|
12
|
+
* - `read` or `git:read` - read-only access
|
|
13
|
+
* - `write` or `git:write` - full access
|
|
14
|
+
* - `admin` or `git:admin` - admin access
|
|
15
|
+
*
|
|
16
|
+
* ## Usage with Hono
|
|
17
|
+
*
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { Hono } from 'hono'
|
|
20
|
+
* import { gitAuthMiddleware, requireGitWrite } from 'gitx.do/mcp'
|
|
21
|
+
*
|
|
22
|
+
* const app = new Hono()
|
|
23
|
+
*
|
|
24
|
+
* // Apply auth middleware to all routes
|
|
25
|
+
* app.use('/*', gitAuthMiddleware({
|
|
26
|
+
* introspectionUrl: 'https://oauth.do/introspect',
|
|
27
|
+
* clientId: env.OAUTH_CLIENT_ID,
|
|
28
|
+
* clientSecret: env.OAUTH_CLIENT_SECRET,
|
|
29
|
+
* }))
|
|
30
|
+
*
|
|
31
|
+
* // Protect write operations
|
|
32
|
+
* app.post('/git/commit', requireGitWrite(), async (c) => {
|
|
33
|
+
* const auth = c.get('gitAuth')
|
|
34
|
+
* // ...
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @module mcp/auth
|
|
39
|
+
*/
|
|
40
|
+
import type { MiddlewareHandler } from 'hono';
|
|
41
|
+
import type { GitAuthContext, GitAuthConfig } from './types';
|
|
42
|
+
export type { GitAuthContext, GitAuthConfig } from './types';
|
|
43
|
+
/**
|
|
44
|
+
* Extend Hono's ContextVariableMap with gitAuth
|
|
45
|
+
*/
|
|
46
|
+
declare module 'hono' {
|
|
47
|
+
interface ContextVariableMap {
|
|
48
|
+
gitAuth: GitAuthContext;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create authentication middleware for Hono
|
|
53
|
+
*/
|
|
54
|
+
export declare function gitAuthMiddleware(config: GitAuthConfig): MiddlewareHandler;
|
|
55
|
+
/**
|
|
56
|
+
* Middleware that requires authentication
|
|
57
|
+
*/
|
|
58
|
+
export declare function requireGitAuth(): MiddlewareHandler;
|
|
59
|
+
/**
|
|
60
|
+
* Middleware that requires write access
|
|
61
|
+
*/
|
|
62
|
+
export declare function requireGitWrite(): MiddlewareHandler;
|
|
63
|
+
/**
|
|
64
|
+
* Middleware that requires admin access
|
|
65
|
+
*/
|
|
66
|
+
export declare function requireGitAdmin(): MiddlewareHandler;
|
|
67
|
+
/**
|
|
68
|
+
* Authenticate a standalone request (for non-Hono use)
|
|
69
|
+
*/
|
|
70
|
+
export declare function authenticateRequest(request: Request, config: GitAuthConfig): Promise<{
|
|
71
|
+
success: true;
|
|
72
|
+
context: GitAuthContext;
|
|
73
|
+
} | {
|
|
74
|
+
success: false;
|
|
75
|
+
error: string;
|
|
76
|
+
}>;
|
|
77
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/mcp/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,MAAM,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG5D,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5D;;GAEG;AACH,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAU,kBAAkB;QAC1B,OAAO,EAAE,cAAc,CAAA;KACxB;CACF;AAyJD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,iBAAiB,CAkD1E;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,iBAAiB,CAalD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,iBAAiB,CAanD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,iBAAiB,CAoBnD;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAiCzF"}
|