gitx.do 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/README.md +40 -353
  2. package/dist/do/logger.d.ts +50 -0
  3. package/dist/do/logger.d.ts.map +1 -0
  4. package/dist/do/logger.js +122 -0
  5. package/dist/do/logger.js.map +1 -0
  6. package/dist/{durable-object → do}/schema.d.ts +3 -3
  7. package/dist/do/schema.d.ts.map +1 -0
  8. package/dist/{durable-object → do}/schema.js +4 -3
  9. package/dist/do/schema.js.map +1 -0
  10. package/dist/do/types.d.ts +267 -0
  11. package/dist/do/types.d.ts.map +1 -0
  12. package/dist/do/types.js +62 -0
  13. package/dist/do/types.js.map +1 -0
  14. package/dist/index.d.ts +14 -469
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +31 -483
  17. package/dist/index.js.map +1 -1
  18. package/package.json +13 -21
  19. package/dist/cli/commands/add.d.ts +0 -176
  20. package/dist/cli/commands/add.d.ts.map +0 -1
  21. package/dist/cli/commands/add.js +0 -979
  22. package/dist/cli/commands/add.js.map +0 -1
  23. package/dist/cli/commands/blame.d.ts +0 -259
  24. package/dist/cli/commands/blame.d.ts.map +0 -1
  25. package/dist/cli/commands/blame.js +0 -609
  26. package/dist/cli/commands/blame.js.map +0 -1
  27. package/dist/cli/commands/branch.d.ts +0 -249
  28. package/dist/cli/commands/branch.d.ts.map +0 -1
  29. package/dist/cli/commands/branch.js +0 -693
  30. package/dist/cli/commands/branch.js.map +0 -1
  31. package/dist/cli/commands/checkout.d.ts +0 -73
  32. package/dist/cli/commands/checkout.d.ts.map +0 -1
  33. package/dist/cli/commands/checkout.js +0 -725
  34. package/dist/cli/commands/checkout.js.map +0 -1
  35. package/dist/cli/commands/commit.d.ts +0 -182
  36. package/dist/cli/commands/commit.d.ts.map +0 -1
  37. package/dist/cli/commands/commit.js +0 -457
  38. package/dist/cli/commands/commit.js.map +0 -1
  39. package/dist/cli/commands/diff.d.ts +0 -464
  40. package/dist/cli/commands/diff.d.ts.map +0 -1
  41. package/dist/cli/commands/diff.js +0 -959
  42. package/dist/cli/commands/diff.js.map +0 -1
  43. package/dist/cli/commands/log.d.ts +0 -239
  44. package/dist/cli/commands/log.d.ts.map +0 -1
  45. package/dist/cli/commands/log.js +0 -535
  46. package/dist/cli/commands/log.js.map +0 -1
  47. package/dist/cli/commands/merge.d.ts +0 -106
  48. package/dist/cli/commands/merge.d.ts.map +0 -1
  49. package/dist/cli/commands/merge.js +0 -852
  50. package/dist/cli/commands/merge.js.map +0 -1
  51. package/dist/cli/commands/review.d.ts +0 -457
  52. package/dist/cli/commands/review.d.ts.map +0 -1
  53. package/dist/cli/commands/review.js +0 -558
  54. package/dist/cli/commands/review.js.map +0 -1
  55. package/dist/cli/commands/stash.d.ts +0 -157
  56. package/dist/cli/commands/stash.d.ts.map +0 -1
  57. package/dist/cli/commands/stash.js +0 -655
  58. package/dist/cli/commands/stash.js.map +0 -1
  59. package/dist/cli/commands/status.d.ts +0 -269
  60. package/dist/cli/commands/status.d.ts.map +0 -1
  61. package/dist/cli/commands/status.js +0 -492
  62. package/dist/cli/commands/status.js.map +0 -1
  63. package/dist/cli/commands/web.d.ts +0 -199
  64. package/dist/cli/commands/web.d.ts.map +0 -1
  65. package/dist/cli/commands/web.js +0 -697
  66. package/dist/cli/commands/web.js.map +0 -1
  67. package/dist/cli/fs-adapter.d.ts +0 -656
  68. package/dist/cli/fs-adapter.d.ts.map +0 -1
  69. package/dist/cli/fs-adapter.js +0 -1177
  70. package/dist/cli/fs-adapter.js.map +0 -1
  71. package/dist/cli/fsx-cli-adapter.d.ts +0 -359
  72. package/dist/cli/fsx-cli-adapter.d.ts.map +0 -1
  73. package/dist/cli/fsx-cli-adapter.js +0 -619
  74. package/dist/cli/fsx-cli-adapter.js.map +0 -1
  75. package/dist/cli/index.d.ts +0 -387
  76. package/dist/cli/index.d.ts.map +0 -1
  77. package/dist/cli/index.js +0 -579
  78. package/dist/cli/index.js.map +0 -1
  79. package/dist/cli/ui/components/DiffView.d.ts +0 -12
  80. package/dist/cli/ui/components/DiffView.d.ts.map +0 -1
  81. package/dist/cli/ui/components/DiffView.js +0 -11
  82. package/dist/cli/ui/components/DiffView.js.map +0 -1
  83. package/dist/cli/ui/components/ErrorDisplay.d.ts +0 -10
  84. package/dist/cli/ui/components/ErrorDisplay.d.ts.map +0 -1
  85. package/dist/cli/ui/components/ErrorDisplay.js +0 -11
  86. package/dist/cli/ui/components/ErrorDisplay.js.map +0 -1
  87. package/dist/cli/ui/components/FuzzySearch.d.ts +0 -15
  88. package/dist/cli/ui/components/FuzzySearch.d.ts.map +0 -1
  89. package/dist/cli/ui/components/FuzzySearch.js +0 -12
  90. package/dist/cli/ui/components/FuzzySearch.js.map +0 -1
  91. package/dist/cli/ui/components/LoadingSpinner.d.ts +0 -10
  92. package/dist/cli/ui/components/LoadingSpinner.d.ts.map +0 -1
  93. package/dist/cli/ui/components/LoadingSpinner.js +0 -10
  94. package/dist/cli/ui/components/LoadingSpinner.js.map +0 -1
  95. package/dist/cli/ui/components/NavigationList.d.ts +0 -14
  96. package/dist/cli/ui/components/NavigationList.d.ts.map +0 -1
  97. package/dist/cli/ui/components/NavigationList.js +0 -11
  98. package/dist/cli/ui/components/NavigationList.js.map +0 -1
  99. package/dist/cli/ui/components/ScrollableContent.d.ts +0 -13
  100. package/dist/cli/ui/components/ScrollableContent.d.ts.map +0 -1
  101. package/dist/cli/ui/components/ScrollableContent.js +0 -11
  102. package/dist/cli/ui/components/ScrollableContent.js.map +0 -1
  103. package/dist/cli/ui/components/index.d.ts +0 -7
  104. package/dist/cli/ui/components/index.d.ts.map +0 -1
  105. package/dist/cli/ui/components/index.js +0 -9
  106. package/dist/cli/ui/components/index.js.map +0 -1
  107. package/dist/cli/ui/terminal-ui.d.ts +0 -85
  108. package/dist/cli/ui/terminal-ui.d.ts.map +0 -1
  109. package/dist/cli/ui/terminal-ui.js +0 -121
  110. package/dist/cli/ui/terminal-ui.js.map +0 -1
  111. package/dist/do/BashModule.d.ts +0 -871
  112. package/dist/do/BashModule.d.ts.map +0 -1
  113. package/dist/do/BashModule.js +0 -1143
  114. package/dist/do/BashModule.js.map +0 -1
  115. package/dist/do/FsModule.d.ts +0 -612
  116. package/dist/do/FsModule.d.ts.map +0 -1
  117. package/dist/do/FsModule.js +0 -1120
  118. package/dist/do/FsModule.js.map +0 -1
  119. package/dist/do/GitModule.d.ts +0 -635
  120. package/dist/do/GitModule.d.ts.map +0 -1
  121. package/dist/do/GitModule.js +0 -784
  122. package/dist/do/GitModule.js.map +0 -1
  123. package/dist/do/GitRepoDO.d.ts +0 -281
  124. package/dist/do/GitRepoDO.d.ts.map +0 -1
  125. package/dist/do/GitRepoDO.js +0 -479
  126. package/dist/do/GitRepoDO.js.map +0 -1
  127. package/dist/do/bash-ast.d.ts +0 -246
  128. package/dist/do/bash-ast.d.ts.map +0 -1
  129. package/dist/do/bash-ast.js +0 -888
  130. package/dist/do/bash-ast.js.map +0 -1
  131. package/dist/do/container-executor.d.ts +0 -491
  132. package/dist/do/container-executor.d.ts.map +0 -1
  133. package/dist/do/container-executor.js +0 -731
  134. package/dist/do/container-executor.js.map +0 -1
  135. package/dist/do/index.d.ts +0 -53
  136. package/dist/do/index.d.ts.map +0 -1
  137. package/dist/do/index.js +0 -91
  138. package/dist/do/index.js.map +0 -1
  139. package/dist/do/tiered-storage.d.ts +0 -403
  140. package/dist/do/tiered-storage.d.ts.map +0 -1
  141. package/dist/do/tiered-storage.js +0 -689
  142. package/dist/do/tiered-storage.js.map +0 -1
  143. package/dist/do/withBash.d.ts +0 -231
  144. package/dist/do/withBash.d.ts.map +0 -1
  145. package/dist/do/withBash.js +0 -244
  146. package/dist/do/withBash.js.map +0 -1
  147. package/dist/do/withFs.d.ts +0 -237
  148. package/dist/do/withFs.d.ts.map +0 -1
  149. package/dist/do/withFs.js +0 -387
  150. package/dist/do/withFs.js.map +0 -1
  151. package/dist/do/withGit.d.ts +0 -180
  152. package/dist/do/withGit.d.ts.map +0 -1
  153. package/dist/do/withGit.js +0 -271
  154. package/dist/do/withGit.js.map +0 -1
  155. package/dist/durable-object/object-store.d.ts +0 -633
  156. package/dist/durable-object/object-store.d.ts.map +0 -1
  157. package/dist/durable-object/object-store.js +0 -1164
  158. package/dist/durable-object/object-store.js.map +0 -1
  159. package/dist/durable-object/schema.d.ts.map +0 -1
  160. package/dist/durable-object/schema.js.map +0 -1
  161. package/dist/durable-object/wal.d.ts +0 -416
  162. package/dist/durable-object/wal.d.ts.map +0 -1
  163. package/dist/durable-object/wal.js +0 -445
  164. package/dist/durable-object/wal.js.map +0 -1
  165. package/dist/mcp/adapter.d.ts +0 -772
  166. package/dist/mcp/adapter.d.ts.map +0 -1
  167. package/dist/mcp/adapter.js +0 -895
  168. package/dist/mcp/adapter.js.map +0 -1
  169. package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -22
  170. package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
  171. package/dist/mcp/sandbox/miniflare-evaluator.js +0 -140
  172. package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
  173. package/dist/mcp/sandbox/object-store-proxy.d.ts +0 -32
  174. package/dist/mcp/sandbox/object-store-proxy.d.ts.map +0 -1
  175. package/dist/mcp/sandbox/object-store-proxy.js +0 -30
  176. package/dist/mcp/sandbox/object-store-proxy.js.map +0 -1
  177. package/dist/mcp/sandbox/template.d.ts +0 -17
  178. package/dist/mcp/sandbox/template.d.ts.map +0 -1
  179. package/dist/mcp/sandbox/template.js +0 -71
  180. package/dist/mcp/sandbox/template.js.map +0 -1
  181. package/dist/mcp/sandbox.d.ts +0 -764
  182. package/dist/mcp/sandbox.d.ts.map +0 -1
  183. package/dist/mcp/sandbox.js +0 -1362
  184. package/dist/mcp/sandbox.js.map +0 -1
  185. package/dist/mcp/sdk-adapter.d.ts +0 -835
  186. package/dist/mcp/sdk-adapter.d.ts.map +0 -1
  187. package/dist/mcp/sdk-adapter.js +0 -974
  188. package/dist/mcp/sdk-adapter.js.map +0 -1
  189. package/dist/mcp/tools/do.d.ts +0 -32
  190. package/dist/mcp/tools/do.d.ts.map +0 -1
  191. package/dist/mcp/tools/do.js +0 -117
  192. package/dist/mcp/tools/do.js.map +0 -1
  193. package/dist/mcp/tools.d.ts +0 -548
  194. package/dist/mcp/tools.d.ts.map +0 -1
  195. package/dist/mcp/tools.js +0 -3170
  196. package/dist/mcp/tools.js.map +0 -1
  197. package/dist/ops/blame.d.ts +0 -551
  198. package/dist/ops/blame.d.ts.map +0 -1
  199. package/dist/ops/blame.js +0 -1037
  200. package/dist/ops/blame.js.map +0 -1
  201. package/dist/ops/branch.d.ts +0 -766
  202. package/dist/ops/branch.d.ts.map +0 -1
  203. package/dist/ops/branch.js +0 -950
  204. package/dist/ops/branch.js.map +0 -1
  205. package/dist/ops/commit-traversal.d.ts +0 -349
  206. package/dist/ops/commit-traversal.d.ts.map +0 -1
  207. package/dist/ops/commit-traversal.js +0 -821
  208. package/dist/ops/commit-traversal.js.map +0 -1
  209. package/dist/ops/commit.d.ts +0 -555
  210. package/dist/ops/commit.d.ts.map +0 -1
  211. package/dist/ops/commit.js +0 -826
  212. package/dist/ops/commit.js.map +0 -1
  213. package/dist/ops/merge-base.d.ts +0 -397
  214. package/dist/ops/merge-base.d.ts.map +0 -1
  215. package/dist/ops/merge-base.js +0 -691
  216. package/dist/ops/merge-base.js.map +0 -1
  217. package/dist/ops/merge.d.ts +0 -855
  218. package/dist/ops/merge.d.ts.map +0 -1
  219. package/dist/ops/merge.js +0 -1551
  220. package/dist/ops/merge.js.map +0 -1
  221. package/dist/ops/tag.d.ts +0 -247
  222. package/dist/ops/tag.d.ts.map +0 -1
  223. package/dist/ops/tag.js +0 -649
  224. package/dist/ops/tag.js.map +0 -1
  225. package/dist/ops/tree-builder.d.ts +0 -178
  226. package/dist/ops/tree-builder.d.ts.map +0 -1
  227. package/dist/ops/tree-builder.js +0 -271
  228. package/dist/ops/tree-builder.js.map +0 -1
  229. package/dist/ops/tree-diff.d.ts +0 -291
  230. package/dist/ops/tree-diff.d.ts.map +0 -1
  231. package/dist/ops/tree-diff.js +0 -705
  232. package/dist/ops/tree-diff.js.map +0 -1
  233. package/dist/pack/delta.d.ts +0 -248
  234. package/dist/pack/delta.d.ts.map +0 -1
  235. package/dist/pack/delta.js +0 -740
  236. package/dist/pack/delta.js.map +0 -1
  237. package/dist/pack/format.d.ts +0 -446
  238. package/dist/pack/format.d.ts.map +0 -1
  239. package/dist/pack/format.js +0 -572
  240. package/dist/pack/format.js.map +0 -1
  241. package/dist/pack/full-generation.d.ts +0 -612
  242. package/dist/pack/full-generation.d.ts.map +0 -1
  243. package/dist/pack/full-generation.js +0 -1378
  244. package/dist/pack/full-generation.js.map +0 -1
  245. package/dist/pack/generation.d.ts +0 -441
  246. package/dist/pack/generation.d.ts.map +0 -1
  247. package/dist/pack/generation.js +0 -707
  248. package/dist/pack/generation.js.map +0 -1
  249. package/dist/pack/index.d.ts +0 -502
  250. package/dist/pack/index.d.ts.map +0 -1
  251. package/dist/pack/index.js +0 -833
  252. package/dist/pack/index.js.map +0 -1
  253. package/dist/refs/branch.d.ts +0 -683
  254. package/dist/refs/branch.d.ts.map +0 -1
  255. package/dist/refs/branch.js +0 -881
  256. package/dist/refs/branch.js.map +0 -1
  257. package/dist/refs/storage.d.ts +0 -833
  258. package/dist/refs/storage.d.ts.map +0 -1
  259. package/dist/refs/storage.js +0 -1023
  260. package/dist/refs/storage.js.map +0 -1
  261. package/dist/refs/tag.d.ts +0 -860
  262. package/dist/refs/tag.d.ts.map +0 -1
  263. package/dist/refs/tag.js +0 -996
  264. package/dist/refs/tag.js.map +0 -1
  265. package/dist/storage/backend.d.ts +0 -425
  266. package/dist/storage/backend.d.ts.map +0 -1
  267. package/dist/storage/backend.js +0 -41
  268. package/dist/storage/backend.js.map +0 -1
  269. package/dist/storage/fsx-adapter.d.ts +0 -204
  270. package/dist/storage/fsx-adapter.d.ts.map +0 -1
  271. package/dist/storage/fsx-adapter.js +0 -518
  272. package/dist/storage/fsx-adapter.js.map +0 -1
  273. package/dist/storage/lru-cache.d.ts +0 -691
  274. package/dist/storage/lru-cache.d.ts.map +0 -1
  275. package/dist/storage/lru-cache.js +0 -813
  276. package/dist/storage/lru-cache.js.map +0 -1
  277. package/dist/storage/object-index.d.ts +0 -585
  278. package/dist/storage/object-index.d.ts.map +0 -1
  279. package/dist/storage/object-index.js +0 -532
  280. package/dist/storage/object-index.js.map +0 -1
  281. package/dist/storage/r2-pack.d.ts +0 -1257
  282. package/dist/storage/r2-pack.d.ts.map +0 -1
  283. package/dist/storage/r2-pack.js +0 -1773
  284. package/dist/storage/r2-pack.js.map +0 -1
  285. package/dist/tiered/cdc-pipeline.d.ts +0 -1888
  286. package/dist/tiered/cdc-pipeline.d.ts.map +0 -1
  287. package/dist/tiered/cdc-pipeline.js +0 -1880
  288. package/dist/tiered/cdc-pipeline.js.map +0 -1
  289. package/dist/tiered/migration.d.ts +0 -1104
  290. package/dist/tiered/migration.d.ts.map +0 -1
  291. package/dist/tiered/migration.js +0 -1217
  292. package/dist/tiered/migration.js.map +0 -1
  293. package/dist/tiered/parquet-writer.d.ts +0 -1145
  294. package/dist/tiered/parquet-writer.d.ts.map +0 -1
  295. package/dist/tiered/parquet-writer.js +0 -1183
  296. package/dist/tiered/parquet-writer.js.map +0 -1
  297. package/dist/tiered/read-path.d.ts +0 -835
  298. package/dist/tiered/read-path.d.ts.map +0 -1
  299. package/dist/tiered/read-path.js +0 -487
  300. package/dist/tiered/read-path.js.map +0 -1
  301. package/dist/types/capability.d.ts +0 -1385
  302. package/dist/types/capability.d.ts.map +0 -1
  303. package/dist/types/capability.js +0 -36
  304. package/dist/types/capability.js.map +0 -1
  305. package/dist/types/index.d.ts +0 -13
  306. package/dist/types/index.d.ts.map +0 -1
  307. package/dist/types/index.js +0 -18
  308. package/dist/types/index.js.map +0 -1
  309. package/dist/types/interfaces.d.ts +0 -673
  310. package/dist/types/interfaces.d.ts.map +0 -1
  311. package/dist/types/interfaces.js +0 -26
  312. package/dist/types/interfaces.js.map +0 -1
  313. package/dist/types/objects.d.ts +0 -692
  314. package/dist/types/objects.d.ts.map +0 -1
  315. package/dist/types/objects.js +0 -837
  316. package/dist/types/objects.js.map +0 -1
  317. package/dist/types/storage.d.ts +0 -603
  318. package/dist/types/storage.d.ts.map +0 -1
  319. package/dist/types/storage.js +0 -191
  320. package/dist/types/storage.js.map +0 -1
  321. package/dist/types/worker-loader.d.ts +0 -60
  322. package/dist/types/worker-loader.d.ts.map +0 -1
  323. package/dist/types/worker-loader.js +0 -62
  324. package/dist/types/worker-loader.js.map +0 -1
  325. package/dist/utils/hash.d.ts +0 -198
  326. package/dist/utils/hash.d.ts.map +0 -1
  327. package/dist/utils/hash.js +0 -272
  328. package/dist/utils/hash.js.map +0 -1
  329. package/dist/utils/sha1.d.ts +0 -325
  330. package/dist/utils/sha1.d.ts.map +0 -1
  331. package/dist/utils/sha1.js +0 -635
  332. package/dist/utils/sha1.js.map +0 -1
  333. package/dist/wire/capabilities.d.ts +0 -1044
  334. package/dist/wire/capabilities.d.ts.map +0 -1
  335. package/dist/wire/capabilities.js +0 -941
  336. package/dist/wire/capabilities.js.map +0 -1
  337. package/dist/wire/path-security.d.ts +0 -157
  338. package/dist/wire/path-security.d.ts.map +0 -1
  339. package/dist/wire/path-security.js +0 -307
  340. package/dist/wire/path-security.js.map +0 -1
  341. package/dist/wire/pkt-line.d.ts +0 -345
  342. package/dist/wire/pkt-line.d.ts.map +0 -1
  343. package/dist/wire/pkt-line.js +0 -381
  344. package/dist/wire/pkt-line.js.map +0 -1
  345. package/dist/wire/receive-pack.d.ts +0 -1059
  346. package/dist/wire/receive-pack.d.ts.map +0 -1
  347. package/dist/wire/receive-pack.js +0 -1414
  348. package/dist/wire/receive-pack.js.map +0 -1
  349. package/dist/wire/smart-http.d.ts +0 -799
  350. package/dist/wire/smart-http.d.ts.map +0 -1
  351. package/dist/wire/smart-http.js +0 -945
  352. package/dist/wire/smart-http.js.map +0 -1
  353. package/dist/wire/upload-pack.d.ts +0 -727
  354. package/dist/wire/upload-pack.d.ts.map +0 -1
  355. package/dist/wire/upload-pack.js +0 -1141
  356. package/dist/wire/upload-pack.js.map +0 -1
@@ -1,180 +0,0 @@
1
- /**
2
- * @fileoverview withGit Mixin Function for DO Composition
3
- *
4
- * This module provides a mixin function that adds git capability to any
5
- * Durable Object class. The mixin supports lazy initialization of the
6
- * GitModule for optimal performance.
7
- *
8
- * @module do/withGit
9
- *
10
- * @example
11
- * ```typescript
12
- * import { withGit } from 'gitx.do/do'
13
- * import { DO } from 'dotdo'
14
- *
15
- * // Basic usage - adds this.git property
16
- * class MyDO extends withGit(DO, { repo: 'org/repo' }) {
17
- * async handleRequest() {
18
- * await this.git.sync()
19
- * const status = await this.git.status()
20
- * return new Response(JSON.stringify(status))
21
- * }
22
- * }
23
- *
24
- * // With $.git context integration
25
- * class WorkflowDO extends withGit(DO, {
26
- * repo: 'org/repo',
27
- * contextMode: true
28
- * }) {
29
- * async handleRequest() {
30
- * // Access via $.git when contextMode is enabled
31
- * await this.$.git.sync()
32
- * }
33
- * }
34
- * ```
35
- */
36
- import { GitModule, type GitModuleOptions, type GitBinding, type GitStatus, type SyncResult, type PushResult, type FsCapability, type R2BucketLike } from './GitModule';
37
- /**
38
- * Type for a class constructor.
39
- * @template T - The type that the constructor creates
40
- */
41
- export type Constructor<T = object> = new (...args: any[]) => T;
42
- /**
43
- * Interface for DOs that have git capability.
44
- * This is the shape of a class after applying the withGit mixin.
45
- */
46
- export interface WithGitCapability {
47
- /** The GitModule instance providing git operations */
48
- git: GitModule;
49
- }
50
- /**
51
- * Interface for the extended WorkflowContext with git capability.
52
- * Used when contextMode is enabled.
53
- */
54
- export interface WithGitContext {
55
- git: GitModule;
56
- [key: string]: unknown;
57
- }
58
- /**
59
- * Configuration options for the withGit mixin.
60
- */
61
- export interface WithGitOptions {
62
- /**
63
- * Repository identifier (e.g., 'org/repo' or full URL)
64
- */
65
- repo: string;
66
- /**
67
- * Branch to track
68
- * @default 'main'
69
- */
70
- branch?: string;
71
- /**
72
- * Path prefix within the repository
73
- */
74
- path?: string;
75
- /**
76
- * R2 binding name in env to use for object storage
77
- * @default 'R2_BUCKET'
78
- */
79
- r2Binding?: string;
80
- /**
81
- * Custom object key prefix in R2
82
- * @default 'git/objects'
83
- */
84
- objectPrefix?: string;
85
- /**
86
- * Whether to extend the $ WorkflowContext with git capability.
87
- * When true, this.$.git will be available in addition to this.git.
88
- * @default false
89
- */
90
- contextMode?: boolean;
91
- /**
92
- * Whether to auto-initialize the GitModule on construction.
93
- * When false (default), GitModule is lazily initialized on first access.
94
- * @default false
95
- */
96
- autoInit?: boolean;
97
- }
98
- /**
99
- * Mixin function to add git capability to a DO class.
100
- *
101
- * @description
102
- * Composes git functionality into a Durable Object class using the mixin pattern.
103
- * The resulting class will have a `git` property that provides GitModule functionality.
104
- *
105
- * Features:
106
- * - Lazy initialization: GitModule is only created when first accessed
107
- * - R2 integration: Automatically resolves R2 bucket from env bindings
108
- * - Context mode: Optionally extends the $ WorkflowContext with git capability
109
- * - Composable: Can be combined with other mixins like withBash
110
- *
111
- * @param Base - Base class to extend
112
- * @param options - Git configuration options
113
- * @returns Extended class with git capability
114
- *
115
- * @example
116
- * ```typescript
117
- * // Basic usage
118
- * import { withGit } from 'gitx.do/do'
119
- * import { DO } from 'dotdo'
120
- *
121
- * class MyDO extends withGit(DO, { repo: 'org/repo' }) {
122
- * async syncAndCommit() {
123
- * await this.git.sync()
124
- * await this.git.add('.')
125
- * await this.git.commit('Update files')
126
- * await this.git.push()
127
- * }
128
- * }
129
- * ```
130
- *
131
- * @example
132
- * ```typescript
133
- * // With custom R2 binding
134
- * class MyDO extends withGit(DO, {
135
- * repo: 'org/repo',
136
- * branch: 'develop',
137
- * r2Binding: 'GIT_OBJECTS'
138
- * }) {
139
- * async handleRequest() {
140
- * await this.git.sync()
141
- * return new Response('Synced!')
142
- * }
143
- * }
144
- * ```
145
- *
146
- * @example
147
- * ```typescript
148
- * // Composing with other mixins
149
- * import { withGit, withBash } from 'gitx.do/do'
150
- *
151
- * class DevDO extends withBash(withGit(DO, { repo: 'org/repo' }), {
152
- * cwd: '/workspace'
153
- * }) {
154
- * async buildAndPush() {
155
- * await this.git.sync()
156
- * await this.bash.exec('npm', ['run', 'build'])
157
- * await this.git.add('dist/')
158
- * await this.git.commit('Build: update dist')
159
- * await this.git.push()
160
- * }
161
- * }
162
- * ```
163
- */
164
- export declare function withGit<TBase extends Constructor>(Base: TBase, options: WithGitOptions): TBase & Constructor<WithGitCapability>;
165
- /**
166
- * Check if a value has git capability.
167
- *
168
- * @param value - Value to check
169
- * @returns True if value has the git property and it's a GitModule
170
- *
171
- * @example
172
- * ```typescript
173
- * if (hasGitCapability(instance)) {
174
- * await instance.git.sync()
175
- * }
176
- * ```
177
- */
178
- export declare function hasGitCapability(value: unknown): value is WithGitCapability;
179
- export { GitModule, type GitModuleOptions, type GitBinding, type GitStatus, type SyncResult, type PushResult, type FsCapability, type R2BucketLike, };
180
- //# sourceMappingURL=withGit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"withGit.d.ts","sourceRoot":"","sources":["../../src/do/withGit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,aAAa,CAAA;AAMpB;;;GAGG;AAEH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;AAE/D;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,GAAG,EAAE,SAAS,CAAA;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,SAAS,CAAA;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,wBAAgB,OAAO,CAAC,KAAK,SAAS,WAAW,EAC/C,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,cAAc,GACtB,KAAK,GAAG,WAAW,CAAC,iBAAiB,CAAC,CA+IxC;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAO3E;AAMD,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,CAAA"}
@@ -1,271 +0,0 @@
1
- /**
2
- * @fileoverview withGit Mixin Function for DO Composition
3
- *
4
- * This module provides a mixin function that adds git capability to any
5
- * Durable Object class. The mixin supports lazy initialization of the
6
- * GitModule for optimal performance.
7
- *
8
- * @module do/withGit
9
- *
10
- * @example
11
- * ```typescript
12
- * import { withGit } from 'gitx.do/do'
13
- * import { DO } from 'dotdo'
14
- *
15
- * // Basic usage - adds this.git property
16
- * class MyDO extends withGit(DO, { repo: 'org/repo' }) {
17
- * async handleRequest() {
18
- * await this.git.sync()
19
- * const status = await this.git.status()
20
- * return new Response(JSON.stringify(status))
21
- * }
22
- * }
23
- *
24
- * // With $.git context integration
25
- * class WorkflowDO extends withGit(DO, {
26
- * repo: 'org/repo',
27
- * contextMode: true
28
- * }) {
29
- * async handleRequest() {
30
- * // Access via $.git when contextMode is enabled
31
- * await this.$.git.sync()
32
- * }
33
- * }
34
- * ```
35
- */
36
- import { GitModule, } from './GitModule';
37
- // ============================================================================
38
- // Symbol for Lazy Initialization Cache
39
- // ============================================================================
40
- /**
41
- * Symbol key for caching the GitModule instance.
42
- * Using a symbol prevents property name collisions.
43
- */
44
- const GIT_MODULE_CACHE = Symbol('gitModuleCache');
45
- /**
46
- * Symbol key for storing resolved options.
47
- */
48
- const GIT_OPTIONS = Symbol('gitOptions');
49
- // ============================================================================
50
- // withGit Mixin Function
51
- // ============================================================================
52
- /**
53
- * Mixin function to add git capability to a DO class.
54
- *
55
- * @description
56
- * Composes git functionality into a Durable Object class using the mixin pattern.
57
- * The resulting class will have a `git` property that provides GitModule functionality.
58
- *
59
- * Features:
60
- * - Lazy initialization: GitModule is only created when first accessed
61
- * - R2 integration: Automatically resolves R2 bucket from env bindings
62
- * - Context mode: Optionally extends the $ WorkflowContext with git capability
63
- * - Composable: Can be combined with other mixins like withBash
64
- *
65
- * @param Base - Base class to extend
66
- * @param options - Git configuration options
67
- * @returns Extended class with git capability
68
- *
69
- * @example
70
- * ```typescript
71
- * // Basic usage
72
- * import { withGit } from 'gitx.do/do'
73
- * import { DO } from 'dotdo'
74
- *
75
- * class MyDO extends withGit(DO, { repo: 'org/repo' }) {
76
- * async syncAndCommit() {
77
- * await this.git.sync()
78
- * await this.git.add('.')
79
- * await this.git.commit('Update files')
80
- * await this.git.push()
81
- * }
82
- * }
83
- * ```
84
- *
85
- * @example
86
- * ```typescript
87
- * // With custom R2 binding
88
- * class MyDO extends withGit(DO, {
89
- * repo: 'org/repo',
90
- * branch: 'develop',
91
- * r2Binding: 'GIT_OBJECTS'
92
- * }) {
93
- * async handleRequest() {
94
- * await this.git.sync()
95
- * return new Response('Synced!')
96
- * }
97
- * }
98
- * ```
99
- *
100
- * @example
101
- * ```typescript
102
- * // Composing with other mixins
103
- * import { withGit, withBash } from 'gitx.do/do'
104
- *
105
- * class DevDO extends withBash(withGit(DO, { repo: 'org/repo' }), {
106
- * cwd: '/workspace'
107
- * }) {
108
- * async buildAndPush() {
109
- * await this.git.sync()
110
- * await this.bash.exec('npm', ['run', 'build'])
111
- * await this.git.add('dist/')
112
- * await this.git.commit('Build: update dist')
113
- * await this.git.push()
114
- * }
115
- * }
116
- * ```
117
- */
118
- export function withGit(Base, options) {
119
- // Validate required options
120
- if (!options.repo) {
121
- throw new Error('withGit: repo option is required');
122
- }
123
- return class WithGitMixin extends Base {
124
- /**
125
- * Static list of capabilities for introspection.
126
- */
127
- static capabilities = [...(Base.capabilities || []), 'git'];
128
- /**
129
- * Cached GitModule instance (lazy initialized).
130
- */
131
- [GIT_MODULE_CACHE];
132
- /**
133
- * Resolved options for GitModule creation.
134
- */
135
- [GIT_OPTIONS];
136
- /**
137
- * Whether the git module has been initialized.
138
- */
139
- gitInitialized = false;
140
- /**
141
- * The git property provides access to the GitModule.
142
- * Implements lazy initialization - the module is only created
143
- * when this property is first accessed.
144
- */
145
- get git() {
146
- if (!this[GIT_MODULE_CACHE]) {
147
- this[GIT_MODULE_CACHE] = this.createGitModule();
148
- }
149
- return this[GIT_MODULE_CACHE];
150
- }
151
- /**
152
- * Check if this DO class has a specific capability.
153
- * @param name - Capability name to check
154
- * @returns True if the capability is available
155
- */
156
- hasCapability(name) {
157
- if (name === 'git')
158
- return true;
159
- // Check if parent class has the hasCapability method
160
- const baseProto = Base.prototype;
161
- if (baseProto && typeof baseProto.hasCapability === 'function') {
162
- return baseProto.hasCapability.call(this, name);
163
- }
164
- return false;
165
- }
166
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
167
- constructor(...args) {
168
- super(...args);
169
- // Resolve R2 bucket from env if available
170
- const env = this.env;
171
- const r2BindingName = options.r2Binding ?? 'R2_BUCKET';
172
- const r2 = env?.[r2BindingName];
173
- // Get filesystem capability if available from $ context
174
- const dollarContext = this.$;
175
- const fs = dollarContext?.fs;
176
- // Store resolved options
177
- this[GIT_OPTIONS] = {
178
- ...options,
179
- r2,
180
- fs,
181
- };
182
- // Extend $ context if contextMode is enabled
183
- if (options.contextMode && dollarContext) {
184
- const self = this;
185
- const original$ = dollarContext;
186
- this.$ = new Proxy(original$, {
187
- get(target, prop) {
188
- if (prop === 'git') {
189
- return self.git;
190
- }
191
- // Forward to original context
192
- const value = target[prop];
193
- if (typeof value === 'function') {
194
- return value.bind(target);
195
- }
196
- return value;
197
- },
198
- });
199
- }
200
- // Auto-initialize if requested
201
- if (options.autoInit) {
202
- // Access git to trigger lazy initialization
203
- void this.git.initialize();
204
- this.gitInitialized = true;
205
- }
206
- }
207
- /**
208
- * Creates the GitModule instance with resolved options.
209
- * @returns A new GitModule instance
210
- */
211
- createGitModule() {
212
- const opts = this[GIT_OPTIONS];
213
- return new GitModule({
214
- repo: opts.repo,
215
- branch: opts.branch,
216
- path: opts.path,
217
- r2: opts.r2,
218
- fs: opts.fs,
219
- objectPrefix: opts.objectPrefix,
220
- });
221
- }
222
- /**
223
- * Initialize the git module explicitly.
224
- * This is useful when you need to ensure the module is ready
225
- * before performing operations.
226
- */
227
- async initializeGit() {
228
- if (!this.gitInitialized) {
229
- await this.git.initialize();
230
- this.gitInitialized = true;
231
- }
232
- }
233
- /**
234
- * Dispose the git module and clean up resources.
235
- */
236
- async disposeGit() {
237
- if (this[GIT_MODULE_CACHE]) {
238
- await this[GIT_MODULE_CACHE].dispose();
239
- this[GIT_MODULE_CACHE] = undefined;
240
- this.gitInitialized = false;
241
- }
242
- }
243
- };
244
- }
245
- // ============================================================================
246
- // Type Guards
247
- // ============================================================================
248
- /**
249
- * Check if a value has git capability.
250
- *
251
- * @param value - Value to check
252
- * @returns True if value has the git property and it's a GitModule
253
- *
254
- * @example
255
- * ```typescript
256
- * if (hasGitCapability(instance)) {
257
- * await instance.git.sync()
258
- * }
259
- * ```
260
- */
261
- export function hasGitCapability(value) {
262
- return (typeof value === 'object' &&
263
- value !== null &&
264
- 'git' in value &&
265
- value.git instanceof GitModule);
266
- }
267
- // ============================================================================
268
- // Re-exports for Convenience
269
- // ============================================================================
270
- export { GitModule, };
271
- //# sourceMappingURL=withGit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"withGit.js","sourceRoot":"","sources":["../../src/do/withGit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EACL,SAAS,GAQV,MAAM,aAAa,CAAA;AAuFpB,+EAA+E;AAC/E,uCAAuC;AACvC,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AAExC,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,UAAU,OAAO,CACrB,IAAW,EACX,OAAuB;IAEvB,4BAA4B;IAC5B,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,MAAM,YAAa,SAAQ,IAAI;QACpC;;WAEG;QACH,MAAM,CAAC,YAAY,GAAG,CAAC,GAAG,CAAE,IAAgC,CAAC,YAAwB,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;QAEpG;;WAEG;QACK,CAAC,gBAAgB,CAAC,CAAY;QAEtC;;WAEG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