@git-stunts/git-warp 10.7.0 → 11.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -32
- package/SECURITY.md +64 -0
- package/bin/cli/commands/check.js +168 -0
- package/bin/cli/commands/doctor/checks.js +422 -0
- package/bin/cli/commands/doctor/codes.js +46 -0
- package/bin/cli/commands/doctor/index.js +239 -0
- package/bin/cli/commands/doctor/types.js +89 -0
- package/bin/cli/commands/history.js +73 -0
- package/bin/cli/commands/info.js +139 -0
- package/bin/cli/commands/install-hooks.js +128 -0
- package/bin/cli/commands/materialize.js +99 -0
- package/bin/cli/commands/path.js +88 -0
- package/bin/cli/commands/query.js +194 -0
- package/bin/cli/commands/registry.js +28 -0
- package/bin/cli/commands/seek.js +592 -0
- package/bin/cli/commands/trust.js +154 -0
- package/bin/cli/commands/verify-audit.js +113 -0
- package/bin/cli/commands/view.js +45 -0
- package/bin/cli/infrastructure.js +336 -0
- package/bin/cli/schemas.js +177 -0
- package/bin/cli/shared.js +244 -0
- package/bin/cli/types.js +85 -0
- package/bin/presenters/index.js +214 -0
- package/bin/presenters/json.js +66 -0
- package/bin/presenters/text.js +543 -0
- package/bin/warp-graph.js +19 -2824
- package/index.d.ts +32 -2
- package/index.js +2 -0
- package/package.json +9 -7
- package/src/domain/WarpGraph.js +106 -3252
- package/src/domain/errors/QueryError.js +2 -2
- package/src/domain/errors/TrustError.js +29 -0
- package/src/domain/errors/index.js +1 -0
- package/src/domain/services/AuditMessageCodec.js +137 -0
- package/src/domain/services/AuditReceiptService.js +471 -0
- package/src/domain/services/AuditVerifierService.js +693 -0
- package/src/domain/services/HttpSyncServer.js +36 -22
- package/src/domain/services/MessageCodecInternal.js +3 -0
- package/src/domain/services/MessageSchemaDetector.js +2 -2
- package/src/domain/services/SyncAuthService.js +69 -3
- package/src/domain/services/WarpMessageCodec.js +4 -1
- package/src/domain/trust/TrustCanonical.js +42 -0
- package/src/domain/trust/TrustCrypto.js +111 -0
- package/src/domain/trust/TrustEvaluator.js +180 -0
- package/src/domain/trust/TrustRecordService.js +274 -0
- package/src/domain/trust/TrustStateBuilder.js +209 -0
- package/src/domain/trust/canonical.js +68 -0
- package/src/domain/trust/reasonCodes.js +64 -0
- package/src/domain/trust/schemas.js +160 -0
- package/src/domain/trust/verdict.js +42 -0
- package/src/domain/types/git-cas.d.ts +20 -0
- package/src/domain/utils/RefLayout.js +59 -0
- package/src/domain/warp/PatchSession.js +18 -0
- package/src/domain/warp/Writer.js +18 -3
- package/src/domain/warp/_internal.js +26 -0
- package/src/domain/warp/_wire.js +58 -0
- package/src/domain/warp/_wiredMethods.d.ts +100 -0
- package/src/domain/warp/checkpoint.methods.js +397 -0
- package/src/domain/warp/fork.methods.js +323 -0
- package/src/domain/warp/materialize.methods.js +188 -0
- package/src/domain/warp/materializeAdvanced.methods.js +339 -0
- package/src/domain/warp/patch.methods.js +529 -0
- package/src/domain/warp/provenance.methods.js +284 -0
- package/src/domain/warp/query.methods.js +279 -0
- package/src/domain/warp/subscribe.methods.js +272 -0
- package/src/domain/warp/sync.methods.js +549 -0
- package/src/infrastructure/adapters/GitGraphAdapter.js +67 -1
- package/src/infrastructure/adapters/InMemoryGraphAdapter.js +36 -0
- package/src/ports/CommitPort.js +10 -0
- package/src/ports/RefPort.js +17 -0
- package/src/hooks/post-merge.sh +0 -60
package/src/ports/CommitPort.js
CHANGED
|
@@ -90,6 +90,16 @@ export default class CommitPort {
|
|
|
90
90
|
throw new Error('CommitPort.nodeExists() not implemented');
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Retrieves the tree OID for a given commit SHA.
|
|
95
|
+
* @param {string} _sha - The commit SHA to query
|
|
96
|
+
* @returns {Promise<string>} The tree OID pointed to by the commit
|
|
97
|
+
* @throws {Error} If not implemented by a concrete adapter
|
|
98
|
+
*/
|
|
99
|
+
async getCommitTree(_sha) {
|
|
100
|
+
throw new Error('CommitPort.getCommitTree() not implemented');
|
|
101
|
+
}
|
|
102
|
+
|
|
93
103
|
/**
|
|
94
104
|
* Pings the repository to verify accessibility.
|
|
95
105
|
* @returns {Promise<{ok: boolean, latencyMs: number}>} Health check result with latency
|
package/src/ports/RefPort.js
CHANGED
|
@@ -48,4 +48,21 @@ export default class RefPort {
|
|
|
48
48
|
async listRefs(_prefix) {
|
|
49
49
|
throw new Error('RefPort.listRefs() not implemented');
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Atomically updates a ref using compare-and-swap semantics.
|
|
54
|
+
*
|
|
55
|
+
* The ref is updated to `_newOid` only if it currently points to `_expectedOid`.
|
|
56
|
+
* If `_expectedOid` is `null`, the ref must not exist (genesis CAS).
|
|
57
|
+
*
|
|
58
|
+
* @param {string} _ref - The ref name
|
|
59
|
+
* @param {string} _newOid - The new OID to set
|
|
60
|
+
* @param {string|null} _expectedOid - The expected current OID, or null if the ref must not exist
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
* @throws {Error} If the ref does not match the expected value (CAS mismatch)
|
|
63
|
+
* @throws {Error} If not implemented by a concrete adapter
|
|
64
|
+
*/
|
|
65
|
+
async compareAndSwapRef(_ref, _newOid, _expectedOid) {
|
|
66
|
+
throw new Error('RefPort.compareAndSwapRef() not implemented');
|
|
67
|
+
}
|
|
51
68
|
}
|
package/src/hooks/post-merge.sh
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
# --- @git-stunts/git-warp post-merge hook __WARP_HOOK_VERSION__ ---
|
|
3
|
-
# warp-hook-version: __WARP_HOOK_VERSION__
|
|
4
|
-
#
|
|
5
|
-
# Post-merge hook: notify (or auto-materialize) when warp refs changed.
|
|
6
|
-
#
|
|
7
|
-
# Compares refs/warp/ before and after merge by maintaining
|
|
8
|
-
# a snapshot file at .git/warp-ref-snapshot. If any warp writer refs
|
|
9
|
-
# changed and warp.autoMaterialize is true, runs `git warp materialize`.
|
|
10
|
-
# Otherwise prints an informational message advising re-materialization.
|
|
11
|
-
# Always exits 0 — never blocks a merge.
|
|
12
|
-
|
|
13
|
-
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) || exit 0
|
|
14
|
-
SNAPSHOT="${GIT_DIR}/warp-ref-snapshot"
|
|
15
|
-
|
|
16
|
-
# Capture current warp refs (sorted for stable comparison)
|
|
17
|
-
CURRENT=$(git for-each-ref --format='%(refname) %(objectname)' --sort=refname refs/warp/ 2>/dev/null) || true
|
|
18
|
-
|
|
19
|
-
if [ -z "$CURRENT" ]; then
|
|
20
|
-
# No warp refs exist — clean up any stale snapshot and exit
|
|
21
|
-
rm -f "$SNAPSHOT"
|
|
22
|
-
exit 0
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
CHANGED=0
|
|
26
|
-
|
|
27
|
-
if [ -f "$SNAPSHOT" ]; then
|
|
28
|
-
PREVIOUS=$(cat "$SNAPSHOT")
|
|
29
|
-
if [ "$CURRENT" != "$PREVIOUS" ]; then
|
|
30
|
-
CHANGED=1
|
|
31
|
-
fi
|
|
32
|
-
else
|
|
33
|
-
# First encounter — refs exist but no snapshot yet
|
|
34
|
-
CHANGED=1
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
# Save current state for next comparison
|
|
38
|
-
printf '%s\n' "$CURRENT" > "$SNAPSHOT"
|
|
39
|
-
|
|
40
|
-
if [ "$CHANGED" -eq 0 ]; then
|
|
41
|
-
exit 0
|
|
42
|
-
fi
|
|
43
|
-
|
|
44
|
-
AUTO_MAT=$(git config --bool warp.autoMaterialize 2>/dev/null) || true
|
|
45
|
-
|
|
46
|
-
if [ "$AUTO_MAT" = "true" ]; then
|
|
47
|
-
echo "[warp] Refs changed — auto-materializing..."
|
|
48
|
-
if command -v git-warp >/dev/null 2>&1; then
|
|
49
|
-
git-warp materialize || echo "[warp] Warning: auto-materialize failed."
|
|
50
|
-
elif command -v warp-graph >/dev/null 2>&1; then
|
|
51
|
-
warp-graph materialize || echo "[warp] Warning: auto-materialize failed."
|
|
52
|
-
else
|
|
53
|
-
echo "[warp] Warning: neither git-warp nor warp-graph found in PATH."
|
|
54
|
-
fi
|
|
55
|
-
else
|
|
56
|
-
echo "[warp] Writer refs changed during merge. Call materialize() to see updates."
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
exit 0
|
|
60
|
-
# --- end @git-stunts/git-warp ---
|