@git-stunts/git-warp 10.1.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/LICENSE +201 -0
- package/NOTICE +16 -0
- package/README.md +480 -0
- package/SECURITY.md +30 -0
- package/bin/git-warp +24 -0
- package/bin/warp-graph.js +1574 -0
- package/index.d.ts +2366 -0
- package/index.js +180 -0
- package/package.json +129 -0
- package/scripts/install-git-warp.sh +258 -0
- package/scripts/uninstall-git-warp.sh +139 -0
- package/src/domain/WarpGraph.js +3157 -0
- package/src/domain/crdt/Dot.js +160 -0
- package/src/domain/crdt/LWW.js +154 -0
- package/src/domain/crdt/ORSet.js +371 -0
- package/src/domain/crdt/VersionVector.js +222 -0
- package/src/domain/entities/GraphNode.js +60 -0
- package/src/domain/errors/EmptyMessageError.js +47 -0
- package/src/domain/errors/ForkError.js +30 -0
- package/src/domain/errors/IndexError.js +23 -0
- package/src/domain/errors/OperationAbortedError.js +22 -0
- package/src/domain/errors/QueryError.js +39 -0
- package/src/domain/errors/SchemaUnsupportedError.js +17 -0
- package/src/domain/errors/ShardCorruptionError.js +56 -0
- package/src/domain/errors/ShardLoadError.js +57 -0
- package/src/domain/errors/ShardValidationError.js +61 -0
- package/src/domain/errors/StorageError.js +57 -0
- package/src/domain/errors/SyncError.js +30 -0
- package/src/domain/errors/TraversalError.js +23 -0
- package/src/domain/errors/WarpError.js +31 -0
- package/src/domain/errors/WormholeError.js +28 -0
- package/src/domain/errors/WriterError.js +39 -0
- package/src/domain/errors/index.js +21 -0
- package/src/domain/services/AnchorMessageCodec.js +99 -0
- package/src/domain/services/BitmapIndexBuilder.js +225 -0
- package/src/domain/services/BitmapIndexReader.js +435 -0
- package/src/domain/services/BoundaryTransitionRecord.js +463 -0
- package/src/domain/services/CheckpointMessageCodec.js +147 -0
- package/src/domain/services/CheckpointSerializerV5.js +281 -0
- package/src/domain/services/CheckpointService.js +384 -0
- package/src/domain/services/CommitDagTraversalService.js +156 -0
- package/src/domain/services/DagPathFinding.js +712 -0
- package/src/domain/services/DagTopology.js +239 -0
- package/src/domain/services/DagTraversal.js +245 -0
- package/src/domain/services/Frontier.js +108 -0
- package/src/domain/services/GCMetrics.js +101 -0
- package/src/domain/services/GCPolicy.js +122 -0
- package/src/domain/services/GitLogParser.js +205 -0
- package/src/domain/services/HealthCheckService.js +246 -0
- package/src/domain/services/HookInstaller.js +326 -0
- package/src/domain/services/HttpSyncServer.js +262 -0
- package/src/domain/services/IndexRebuildService.js +426 -0
- package/src/domain/services/IndexStalenessChecker.js +103 -0
- package/src/domain/services/JoinReducer.js +582 -0
- package/src/domain/services/KeyCodec.js +113 -0
- package/src/domain/services/LegacyAnchorDetector.js +67 -0
- package/src/domain/services/LogicalTraversal.js +351 -0
- package/src/domain/services/MessageCodecInternal.js +132 -0
- package/src/domain/services/MessageSchemaDetector.js +145 -0
- package/src/domain/services/MigrationService.js +55 -0
- package/src/domain/services/ObserverView.js +265 -0
- package/src/domain/services/PatchBuilderV2.js +669 -0
- package/src/domain/services/PatchMessageCodec.js +140 -0
- package/src/domain/services/ProvenanceIndex.js +337 -0
- package/src/domain/services/ProvenancePayload.js +242 -0
- package/src/domain/services/QueryBuilder.js +835 -0
- package/src/domain/services/StateDiff.js +300 -0
- package/src/domain/services/StateSerializerV5.js +156 -0
- package/src/domain/services/StreamingBitmapIndexBuilder.js +709 -0
- package/src/domain/services/SyncProtocol.js +593 -0
- package/src/domain/services/TemporalQuery.js +201 -0
- package/src/domain/services/TranslationCost.js +221 -0
- package/src/domain/services/TraversalService.js +8 -0
- package/src/domain/services/WarpMessageCodec.js +29 -0
- package/src/domain/services/WarpStateIndexBuilder.js +127 -0
- package/src/domain/services/WormholeService.js +353 -0
- package/src/domain/types/TickReceipt.js +285 -0
- package/src/domain/types/WarpTypes.js +209 -0
- package/src/domain/types/WarpTypesV2.js +200 -0
- package/src/domain/utils/CachedValue.js +140 -0
- package/src/domain/utils/EventId.js +89 -0
- package/src/domain/utils/LRUCache.js +112 -0
- package/src/domain/utils/MinHeap.js +114 -0
- package/src/domain/utils/RefLayout.js +280 -0
- package/src/domain/utils/WriterId.js +205 -0
- package/src/domain/utils/cancellation.js +33 -0
- package/src/domain/utils/canonicalStringify.js +42 -0
- package/src/domain/utils/defaultClock.js +20 -0
- package/src/domain/utils/defaultCodec.js +51 -0
- package/src/domain/utils/nullLogger.js +21 -0
- package/src/domain/utils/roaring.js +181 -0
- package/src/domain/utils/shardVersion.js +9 -0
- package/src/domain/warp/PatchSession.js +217 -0
- package/src/domain/warp/Writer.js +181 -0
- package/src/hooks/post-merge.sh +60 -0
- package/src/infrastructure/adapters/BunHttpAdapter.js +225 -0
- package/src/infrastructure/adapters/ClockAdapter.js +57 -0
- package/src/infrastructure/adapters/ConsoleLogger.js +150 -0
- package/src/infrastructure/adapters/DenoHttpAdapter.js +230 -0
- package/src/infrastructure/adapters/GitGraphAdapter.js +787 -0
- package/src/infrastructure/adapters/GlobalClockAdapter.js +5 -0
- package/src/infrastructure/adapters/NoOpLogger.js +62 -0
- package/src/infrastructure/adapters/NodeCryptoAdapter.js +32 -0
- package/src/infrastructure/adapters/NodeHttpAdapter.js +98 -0
- package/src/infrastructure/adapters/PerformanceClockAdapter.js +5 -0
- package/src/infrastructure/adapters/WebCryptoAdapter.js +121 -0
- package/src/infrastructure/codecs/CborCodec.js +384 -0
- package/src/ports/BlobPort.js +30 -0
- package/src/ports/ClockPort.js +25 -0
- package/src/ports/CodecPort.js +25 -0
- package/src/ports/CommitPort.js +114 -0
- package/src/ports/ConfigPort.js +31 -0
- package/src/ports/CryptoPort.js +38 -0
- package/src/ports/GraphPersistencePort.js +57 -0
- package/src/ports/HttpServerPort.js +25 -0
- package/src/ports/IndexStoragePort.js +39 -0
- package/src/ports/LoggerPort.js +68 -0
- package/src/ports/RefPort.js +51 -0
- package/src/ports/TreePort.js +51 -0
- package/src/visualization/index.js +26 -0
- package/src/visualization/layouts/converters.js +75 -0
- package/src/visualization/layouts/elkAdapter.js +86 -0
- package/src/visualization/layouts/elkLayout.js +95 -0
- package/src/visualization/layouts/index.js +29 -0
- package/src/visualization/renderers/ascii/box.js +16 -0
- package/src/visualization/renderers/ascii/check.js +271 -0
- package/src/visualization/renderers/ascii/colors.js +13 -0
- package/src/visualization/renderers/ascii/formatters.js +73 -0
- package/src/visualization/renderers/ascii/graph.js +344 -0
- package/src/visualization/renderers/ascii/history.js +335 -0
- package/src/visualization/renderers/ascii/index.js +14 -0
- package/src/visualization/renderers/ascii/info.js +245 -0
- package/src/visualization/renderers/ascii/materialize.js +255 -0
- package/src/visualization/renderers/ascii/path.js +240 -0
- package/src/visualization/renderers/ascii/progress.js +32 -0
- package/src/visualization/renderers/ascii/symbols.js +33 -0
- package/src/visualization/renderers/ascii/table.js +19 -0
- package/src/visualization/renderers/browser/index.js +1 -0
- package/src/visualization/renderers/svg/index.js +159 -0
- package/src/visualization/utils/ansi.js +14 -0
- package/src/visualization/utils/time.js +40 -0
- package/src/visualization/utils/truncate.js +40 -0
- package/src/visualization/utils/unicode.js +52 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Facade for commit DAG traversal operations.
|
|
3
|
+
*
|
|
4
|
+
* Composes DagTraversal, DagPathFinding, and DagTopology services
|
|
5
|
+
* into a single backward-compatible API surface. All public methods
|
|
6
|
+
* delegate to the appropriate sub-service.
|
|
7
|
+
*
|
|
8
|
+
* @module domain/services/CommitDagTraversalService
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import nullLogger from '../utils/nullLogger.js';
|
|
12
|
+
import DagTraversal from './DagTraversal.js';
|
|
13
|
+
import DagPathFinding from './DagPathFinding.js';
|
|
14
|
+
import DagTopology from './DagTopology.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Facade for commit DAG traversal, path-finding, and topology operations.
|
|
18
|
+
*
|
|
19
|
+
* All traversal methods use async generators for memory efficiency,
|
|
20
|
+
* allowing processing of arbitrarily large graphs.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const traversal = new CommitDagTraversalService({ indexReader });
|
|
24
|
+
*
|
|
25
|
+
* // BFS traversal
|
|
26
|
+
* for await (const node of traversal.bfs({ start: sha })) {
|
|
27
|
+
* console.log(node.sha, node.depth);
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* // Find shortest path
|
|
31
|
+
* const result = await traversal.shortestPath({ from: a, to: b });
|
|
32
|
+
* console.log(result.path);
|
|
33
|
+
*/
|
|
34
|
+
export default class CommitDagTraversalService {
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new CommitDagTraversalService.
|
|
37
|
+
*
|
|
38
|
+
* @param {Object} options
|
|
39
|
+
* @param {import('./BitmapIndexReader.js').default} options.indexReader - Index reader for O(1) lookups
|
|
40
|
+
* @param {import('../../ports/LoggerPort.js').default} [options.logger] - Logger instance
|
|
41
|
+
*/
|
|
42
|
+
constructor({ indexReader, logger = nullLogger } = {}) {
|
|
43
|
+
if (!indexReader) {
|
|
44
|
+
throw new Error('CommitDagTraversalService requires an indexReader');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
this._traversal = new DagTraversal({ indexReader, logger });
|
|
48
|
+
this._pathFinding = new DagPathFinding({ indexReader, logger });
|
|
49
|
+
this._topology = new DagTopology({ indexReader, logger, traversal: this._traversal });
|
|
50
|
+
|
|
51
|
+
// Wire up cross-dependency: isReachable delegates to pathFinding.findPath
|
|
52
|
+
this._traversal._setPathFinder(this._pathFinding);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ── Traversal methods (delegated to DagTraversal) ───────────────────────
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Breadth-first traversal from a starting node.
|
|
59
|
+
* @see DagTraversal#bfs
|
|
60
|
+
*/
|
|
61
|
+
bfs(options) {
|
|
62
|
+
return this._traversal.bfs(options);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Depth-first pre-order traversal from a starting node.
|
|
67
|
+
* @see DagTraversal#dfs
|
|
68
|
+
*/
|
|
69
|
+
dfs(options) {
|
|
70
|
+
return this._traversal.dfs(options);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Yields all ancestors of a node.
|
|
75
|
+
* @see DagTraversal#ancestors
|
|
76
|
+
*/
|
|
77
|
+
ancestors(options) {
|
|
78
|
+
return this._traversal.ancestors(options);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Yields all descendants of a node.
|
|
83
|
+
* @see DagTraversal#descendants
|
|
84
|
+
*/
|
|
85
|
+
descendants(options) {
|
|
86
|
+
return this._traversal.descendants(options);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Checks if there is any path from one node to another.
|
|
91
|
+
* @see DagTraversal#isReachable
|
|
92
|
+
*/
|
|
93
|
+
isReachable(options) {
|
|
94
|
+
return this._traversal.isReachable(options);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ── Path-finding methods (delegated to DagPathFinding) ──────────────────
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Finds ANY path between two nodes using BFS.
|
|
101
|
+
* @see DagPathFinding#findPath
|
|
102
|
+
*/
|
|
103
|
+
findPath(options) {
|
|
104
|
+
return this._pathFinding.findPath(options);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Finds the shortest path using bidirectional BFS.
|
|
109
|
+
* @see DagPathFinding#shortestPath
|
|
110
|
+
*/
|
|
111
|
+
shortestPath(options) {
|
|
112
|
+
return this._pathFinding.shortestPath(options);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Finds shortest path using Dijkstra's algorithm.
|
|
117
|
+
* @see DagPathFinding#weightedShortestPath
|
|
118
|
+
*/
|
|
119
|
+
weightedShortestPath(options) {
|
|
120
|
+
return this._pathFinding.weightedShortestPath(options);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Finds shortest path using A* with heuristic guidance.
|
|
125
|
+
* @see DagPathFinding#aStarSearch
|
|
126
|
+
*/
|
|
127
|
+
aStarSearch(options) {
|
|
128
|
+
return this._pathFinding.aStarSearch(options);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Bi-directional A* search.
|
|
133
|
+
* @see DagPathFinding#bidirectionalAStar
|
|
134
|
+
*/
|
|
135
|
+
bidirectionalAStar(options) {
|
|
136
|
+
return this._pathFinding.bidirectionalAStar(options);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ── Topology methods (delegated to DagTopology) ─────────────────────────
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Finds common ancestors of multiple nodes.
|
|
143
|
+
* @see DagTopology#commonAncestors
|
|
144
|
+
*/
|
|
145
|
+
commonAncestors(options) {
|
|
146
|
+
return this._topology.commonAncestors(options);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Yields nodes in topological order using Kahn's algorithm.
|
|
151
|
+
* @see DagTopology#topologicalSort
|
|
152
|
+
*/
|
|
153
|
+
topologicalSort(options) {
|
|
154
|
+
return this._topology.topologicalSort(options);
|
|
155
|
+
}
|
|
156
|
+
}
|