@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.
Files changed (71) hide show
  1. package/README.md +53 -32
  2. package/SECURITY.md +64 -0
  3. package/bin/cli/commands/check.js +168 -0
  4. package/bin/cli/commands/doctor/checks.js +422 -0
  5. package/bin/cli/commands/doctor/codes.js +46 -0
  6. package/bin/cli/commands/doctor/index.js +239 -0
  7. package/bin/cli/commands/doctor/types.js +89 -0
  8. package/bin/cli/commands/history.js +73 -0
  9. package/bin/cli/commands/info.js +139 -0
  10. package/bin/cli/commands/install-hooks.js +128 -0
  11. package/bin/cli/commands/materialize.js +99 -0
  12. package/bin/cli/commands/path.js +88 -0
  13. package/bin/cli/commands/query.js +194 -0
  14. package/bin/cli/commands/registry.js +28 -0
  15. package/bin/cli/commands/seek.js +592 -0
  16. package/bin/cli/commands/trust.js +154 -0
  17. package/bin/cli/commands/verify-audit.js +113 -0
  18. package/bin/cli/commands/view.js +45 -0
  19. package/bin/cli/infrastructure.js +336 -0
  20. package/bin/cli/schemas.js +177 -0
  21. package/bin/cli/shared.js +244 -0
  22. package/bin/cli/types.js +85 -0
  23. package/bin/presenters/index.js +214 -0
  24. package/bin/presenters/json.js +66 -0
  25. package/bin/presenters/text.js +543 -0
  26. package/bin/warp-graph.js +19 -2824
  27. package/index.d.ts +32 -2
  28. package/index.js +2 -0
  29. package/package.json +9 -7
  30. package/src/domain/WarpGraph.js +106 -3252
  31. package/src/domain/errors/QueryError.js +2 -2
  32. package/src/domain/errors/TrustError.js +29 -0
  33. package/src/domain/errors/index.js +1 -0
  34. package/src/domain/services/AuditMessageCodec.js +137 -0
  35. package/src/domain/services/AuditReceiptService.js +471 -0
  36. package/src/domain/services/AuditVerifierService.js +693 -0
  37. package/src/domain/services/HttpSyncServer.js +36 -22
  38. package/src/domain/services/MessageCodecInternal.js +3 -0
  39. package/src/domain/services/MessageSchemaDetector.js +2 -2
  40. package/src/domain/services/SyncAuthService.js +69 -3
  41. package/src/domain/services/WarpMessageCodec.js +4 -1
  42. package/src/domain/trust/TrustCanonical.js +42 -0
  43. package/src/domain/trust/TrustCrypto.js +111 -0
  44. package/src/domain/trust/TrustEvaluator.js +180 -0
  45. package/src/domain/trust/TrustRecordService.js +274 -0
  46. package/src/domain/trust/TrustStateBuilder.js +209 -0
  47. package/src/domain/trust/canonical.js +68 -0
  48. package/src/domain/trust/reasonCodes.js +64 -0
  49. package/src/domain/trust/schemas.js +160 -0
  50. package/src/domain/trust/verdict.js +42 -0
  51. package/src/domain/types/git-cas.d.ts +20 -0
  52. package/src/domain/utils/RefLayout.js +59 -0
  53. package/src/domain/warp/PatchSession.js +18 -0
  54. package/src/domain/warp/Writer.js +18 -3
  55. package/src/domain/warp/_internal.js +26 -0
  56. package/src/domain/warp/_wire.js +58 -0
  57. package/src/domain/warp/_wiredMethods.d.ts +100 -0
  58. package/src/domain/warp/checkpoint.methods.js +397 -0
  59. package/src/domain/warp/fork.methods.js +323 -0
  60. package/src/domain/warp/materialize.methods.js +188 -0
  61. package/src/domain/warp/materializeAdvanced.methods.js +339 -0
  62. package/src/domain/warp/patch.methods.js +529 -0
  63. package/src/domain/warp/provenance.methods.js +284 -0
  64. package/src/domain/warp/query.methods.js +279 -0
  65. package/src/domain/warp/subscribe.methods.js +272 -0
  66. package/src/domain/warp/sync.methods.js +549 -0
  67. package/src/infrastructure/adapters/GitGraphAdapter.js +67 -1
  68. package/src/infrastructure/adapters/InMemoryGraphAdapter.js +36 -0
  69. package/src/ports/CommitPort.js +10 -0
  70. package/src/ports/RefPort.js +17 -0
  71. package/src/hooks/post-merge.sh +0 -60
@@ -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
@@ -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
  }
@@ -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 ---