mergeseal 0.0.0-stage → 0.2.0

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 (182) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/CONTRIBUTING.md +90 -0
  3. package/LICENSE +202 -0
  4. package/NOTICE +6 -0
  5. package/README.md +236 -2
  6. package/SECURITY.md +39 -0
  7. package/dist/biscuit.d.ts +14 -0
  8. package/dist/biscuit.js +61 -0
  9. package/dist/canonical.d.ts +7 -0
  10. package/dist/canonical.js +69 -0
  11. package/dist/cli-contract.d.ts +42 -0
  12. package/dist/cli-contract.js +110 -0
  13. package/dist/cli.d.ts +7 -0
  14. package/dist/cli.js +1044 -0
  15. package/dist/coding/checks.d.ts +24 -0
  16. package/dist/coding/checks.js +131 -0
  17. package/dist/coding/cli.d.ts +9 -0
  18. package/dist/coding/cli.js +450 -0
  19. package/dist/coding/deps.d.ts +5 -0
  20. package/dist/coding/deps.js +55 -0
  21. package/dist/coding/domain.d.ts +27 -0
  22. package/dist/coding/domain.js +67 -0
  23. package/dist/coding/exec.d.ts +14 -0
  24. package/dist/coding/exec.js +41 -0
  25. package/dist/coding/fast-ed25519.d.ts +5 -0
  26. package/dist/coding/fast-ed25519.js +57 -0
  27. package/dist/coding/fingerprint.d.ts +6 -0
  28. package/dist/coding/fingerprint.js +78 -0
  29. package/dist/coding/gate.d.ts +36 -0
  30. package/dist/coding/gate.js +536 -0
  31. package/dist/coding/git.d.ts +29 -0
  32. package/dist/coding/git.js +377 -0
  33. package/dist/coding/glob.d.ts +5 -0
  34. package/dist/coding/glob.js +62 -0
  35. package/dist/coding/hold.d.ts +65 -0
  36. package/dist/coding/hold.js +271 -0
  37. package/dist/coding/hook.d.ts +32 -0
  38. package/dist/coding/hook.js +428 -0
  39. package/dist/coding/index.d.ts +25 -0
  40. package/dist/coding/index.js +16 -0
  41. package/dist/coding/policy.d.ts +54 -0
  42. package/dist/coding/policy.js +397 -0
  43. package/dist/coding/record.d.ts +73 -0
  44. package/dist/coding/record.js +736 -0
  45. package/dist/coding/secrets.d.ts +5 -0
  46. package/dist/coding/secrets.js +31 -0
  47. package/dist/coding/signer.d.ts +12 -0
  48. package/dist/coding/signer.js +41 -0
  49. package/dist/coding/testfiles.d.ts +6 -0
  50. package/dist/coding/testfiles.js +38 -0
  51. package/dist/coding/verdict.d.ts +18 -0
  52. package/dist/coding/verdict.js +93 -0
  53. package/dist/compose.d.ts +2 -0
  54. package/dist/compose.js +79 -0
  55. package/dist/index.d.ts +7 -0
  56. package/dist/index.js +6 -0
  57. package/dist/init-seal.d.ts +47 -0
  58. package/dist/init-seal.js +1110 -0
  59. package/dist/init.d.ts +13 -0
  60. package/dist/init.js +35 -0
  61. package/dist/intoto.d.ts +77 -0
  62. package/dist/intoto.js +374 -0
  63. package/dist/issue.d.ts +5 -0
  64. package/dist/issue.js +70 -0
  65. package/dist/keyless/asn1.d.ts +26 -0
  66. package/dist/keyless/asn1.js +269 -0
  67. package/dist/keyless/bundle.d.ts +52 -0
  68. package/dist/keyless/bundle.js +163 -0
  69. package/dist/keyless/cli.d.ts +11 -0
  70. package/dist/keyless/cli.js +182 -0
  71. package/dist/keyless/errors.d.ts +17 -0
  72. package/dist/keyless/errors.js +29 -0
  73. package/dist/keyless/fulcio.d.ts +13 -0
  74. package/dist/keyless/fulcio.js +104 -0
  75. package/dist/keyless/index.d.ts +16 -0
  76. package/dist/keyless/index.js +12 -0
  77. package/dist/keyless/oidc.d.ts +29 -0
  78. package/dist/keyless/oidc.js +130 -0
  79. package/dist/keyless/x509.d.ts +91 -0
  80. package/dist/keyless/x509.js +670 -0
  81. package/dist/keys.d.ts +9 -0
  82. package/dist/keys.js +84 -0
  83. package/dist/mcp.d.ts +98 -0
  84. package/dist/mcp.js +430 -0
  85. package/dist/native/cert.d.ts +94 -0
  86. package/dist/native/cert.js +610 -0
  87. package/dist/native/cli.d.ts +10 -0
  88. package/dist/native/cli.js +344 -0
  89. package/dist/native/domain.d.ts +35 -0
  90. package/dist/native/domain.js +86 -0
  91. package/dist/native/hook.d.ts +49 -0
  92. package/dist/native/hook.js +283 -0
  93. package/dist/native/http.d.ts +15 -0
  94. package/dist/native/http.js +243 -0
  95. package/dist/native/index.d.ts +19 -0
  96. package/dist/native/index.js +12 -0
  97. package/dist/native/lookup.d.ts +19 -0
  98. package/dist/native/lookup.js +134 -0
  99. package/dist/native/registry.d.ts +33 -0
  100. package/dist/native/registry.js +346 -0
  101. package/dist/native/serve.d.ts +16 -0
  102. package/dist/native/serve.js +80 -0
  103. package/dist/native/view.d.ts +38 -0
  104. package/dist/native/view.js +97 -0
  105. package/dist/portable/cli.d.ts +7 -0
  106. package/dist/portable/cli.js +237 -0
  107. package/dist/portable/compact.d.ts +5 -0
  108. package/dist/portable/compact.js +24 -0
  109. package/dist/portable/domain.d.ts +20 -0
  110. package/dist/portable/domain.js +27 -0
  111. package/dist/portable/hook.d.ts +26 -0
  112. package/dist/portable/hook.js +120 -0
  113. package/dist/portable/http.d.ts +26 -0
  114. package/dist/portable/http.js +111 -0
  115. package/dist/portable/index.d.ts +21 -0
  116. package/dist/portable/index.js +15 -0
  117. package/dist/portable/receipt.d.ts +52 -0
  118. package/dist/portable/receipt.js +178 -0
  119. package/dist/portable/snippets.d.ts +14 -0
  120. package/dist/portable/snippets.js +22 -0
  121. package/dist/portable/trailer.d.ts +7 -0
  122. package/dist/portable/trailer.js +82 -0
  123. package/dist/preview/server.d.ts +21 -0
  124. package/dist/preview/server.js +360 -0
  125. package/dist/trust.d.ts +33 -0
  126. package/dist/trust.js +164 -0
  127. package/dist/types.d.ts +102 -0
  128. package/dist/types.js +62 -0
  129. package/dist/v1_1/b64.d.ts +6 -0
  130. package/dist/v1_1/b64.js +98 -0
  131. package/dist/v1_1/bytes.d.ts +9 -0
  132. package/dist/v1_1/bytes.js +59 -0
  133. package/dist/v1_1/cbor.d.ts +39 -0
  134. package/dist/v1_1/cbor.js +335 -0
  135. package/dist/v1_1/cert.d.ts +77 -0
  136. package/dist/v1_1/cert.js +559 -0
  137. package/dist/v1_1/didkey.d.ts +19 -0
  138. package/dist/v1_1/didkey.js +143 -0
  139. package/dist/v1_1/domain.d.ts +32 -0
  140. package/dist/v1_1/domain.js +94 -0
  141. package/dist/v1_1/ed25519.d.ts +29 -0
  142. package/dist/v1_1/ed25519.js +333 -0
  143. package/dist/v1_1/fixed.d.ts +18 -0
  144. package/dist/v1_1/fixed.js +75 -0
  145. package/dist/v1_1/golden.d.ts +55 -0
  146. package/dist/v1_1/golden.js +230 -0
  147. package/dist/v1_1/index.d.ts +28 -0
  148. package/dist/v1_1/index.js +20 -0
  149. package/dist/v1_1/jwks.d.ts +16 -0
  150. package/dist/v1_1/jwks.js +75 -0
  151. package/dist/v1_1/merkle.d.ts +23 -0
  152. package/dist/v1_1/merkle.js +443 -0
  153. package/dist/v1_1/pop.d.ts +57 -0
  154. package/dist/v1_1/pop.js +210 -0
  155. package/dist/v1_1/request.d.ts +50 -0
  156. package/dist/v1_1/request.js +174 -0
  157. package/dist/v1_1/revocation.d.ts +15 -0
  158. package/dist/v1_1/revocation.js +110 -0
  159. package/dist/v1_1/sha2.d.ts +7 -0
  160. package/dist/v1_1/sha2.js +272 -0
  161. package/dist/v1_1/types.d.ts +140 -0
  162. package/dist/v1_1/types.js +15 -0
  163. package/dist/v1_1/verify.d.ts +17 -0
  164. package/dist/v1_1/verify.js +316 -0
  165. package/dist/verify.d.ts +2 -0
  166. package/dist/verify.js +280 -0
  167. package/docs/aaif-sandbox-thesis.md +51 -0
  168. package/docs/cli-contract.md +163 -0
  169. package/docs/intoto-predicate-v1.md +155 -0
  170. package/docs/ucan-biscuit.md +55 -0
  171. package/llms-full.txt +254 -0
  172. package/llms.txt +63 -0
  173. package/package.json +99 -5
  174. package/skills/mergeseal/SKILL.md +74 -0
  175. package/spec/coding-gate.md +80 -0
  176. package/spec/intoto/mergeseal_receipt_v1.proto +47 -0
  177. package/spec/native.md +59 -0
  178. package/spec/portable.md +58 -0
  179. package/spec/quickstart.md +27 -0
  180. package/spec/v1.1.md +190 -0
  181. package/spec/v1.md +75 -0
  182. package/templates/cursor-mergeseal.mdc +24 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ Copyright 2026 MergeSeal. MergeSeal <team@mergeseal.dev>
4
+
5
+ ## Unreleased
6
+
7
+ - The in-toto receipt predicate writes the seal's issuance time as RFC 3339 (`YYYY-MM-DDTHH:mm:ss.sssZ`). `signDsseEnvelope` is an opt-in DSSE wrapper. The export command still prints the bare statement. The compact trailer bytes are unchanged.
8
+ - The coding-gate action can set one pull request label from the offline checks: `sealed: tests ran, no test files modified`, `unsealed / tests touched`, or `unsealed`. Create, attach, and delete send the full name, so a comma in the sealed label stays part of that name.
9
+ - `npx mergeseal init` writes the Cursor rule and skill. No account, no API key, no network call.
10
+ - `mergeseal init` installs opt-in local sealing for `--claude-code`, `--cursor`, `--codex`, and `--git-hook`. `--yes` installs the hosts it detects. `--dry-run` writes nothing. `--uninstall` removes only MergeSeal's entries.
11
+ - `mergeseal mcp` is a local stdio JSON-RPC server with `mergeseal_verify`, `mergeseal_inspect`, and `mergeseal_seal`.
12
+ - Bare `mergeseal init` on a terminal still writes the Cursor rule and skill when the prompt is left empty. `--uninstall` removes editor entries and `.mergeseal/git-seal.mjs` when the directory is not a git checkout, and it does not write a git hook. Worktree hooks are installed in the common git dir. Hook scripts keep `MERGESEAL_KEY` in the environment. `mergeseal mcp` flushes stdout before it exits.
13
+ - `llms.txt` and `llms-full.txt` list install, commands, flags, exit codes, the `--json` object, and the next command.
14
+ - `--json` on exit 1 and exit 2 includes `error`, `exit`, and `next`.
15
+ - Text-mode check failures print `mergeseal: <error>` and `next: <command>`.
16
+ - The Rust crates list at most five crates.io keywords.
17
+ - Trust roots and verifiers accept an Ed25519 `did:key:z6Mk...` beside hex.
18
+ - `toBiscuitFacts` writes Datalog facts for a verified result. `gate --biscuit-facts` prints them.
19
+ - `mergeseal export --format in-toto` verifies a compact seal, then prints an in-toto Statement v1.
20
+
21
+ ## 0.2.0 - 2026-11-30
22
+
23
+ - Opt-in keyless signing for GitHub Actions. `mergeseal keyless seal` and `mergeseal seal --keyless` (or `--oidc`) request an OIDC token from `ACTIONS_ID_TOKEN_REQUEST_URL` with `ACTIONS_ID_TOKEN_REQUEST_TOKEN`, generate an ephemeral Ed25519 key, and ask Sigstore Fulcio for a short-lived code-signing certificate. The private key is not written. This path does not read `MERGESEAL_KEY`.
24
+ - `mergeseal keyless verify` checks the certificate chain against `--fulcio-root`, the SAN against `--certificate-identity` or `--certificate-identity-regexp`, and the issuer extension against `--certificate-oidc-issuer`. The default issuer is `https://token.actions.githubusercontent.com`. Verification does not open a socket.
25
+ - The coding-gate action takes `keyless: true`. The workflow needs `permissions: id-token: write`. The default action does not request a token. Keyless signing runs only when the gate JSON has `ok: true`. `--warn-only` with a failed gate does not call Fulcio.
26
+ - Keyless verification requires `basicConstraints` `cA` true, `keyUsage` `keyCertSign`, and any `pathLenConstraint` on every issuer. A leaf with `cA` true is rejected. A non-CA certificate cannot sign another certificate in the chain.
27
+ - Static `MERGESEAL_KEY` signing and the 192-byte `Agent-Certificate-Portable:` trailer are unchanged.
28
+
29
+ ## 0.1.0 - 2026-11-29
30
+
31
+ First open-source release of MergeSeal.
32
+
33
+ - The `mergeseal` command issues and verifies certificates on the machine that holds them.
34
+ - The MergeSeal GitHub Action runs the same offline coding gate.
35
+ - Rust crates `mergeseal` and `mergeseal-wasm` verify the compact Ed25519 seal. The core plus one seal is at most 192 bytes.
36
+ - Verification does not upload source, prompts, diffs, or claim values.
37
+ - Licensed under Apache-2.0.
@@ -0,0 +1,90 @@
1
+ # Contributing
2
+
3
+ MergeSeal is licensed under Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
4
+
5
+ Copyright 2026 MergeSeal. MergeSeal <team@mergeseal.dev>. MergeSeal Contributors.
6
+
7
+ Governance is in [GOVERNANCE.md](GOVERNANCE.md). Conduct is in [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). Maintainers are in [MAINTAINERS.md](MAINTAINERS.md).
8
+
9
+ ## Developer Certificate of Origin
10
+
11
+ Every commit must include a `Signed-off-by` trailer. That trailer is the [Developer Certificate of Origin](https://developercertificate.org/), version 1.1. `git commit -s` writes it from your Git identity. Use your own name and email. Do not sign for someone else.
12
+
13
+ The certificate text follows. It is included verbatim.
14
+
15
+ ```
16
+ Developer Certificate of Origin
17
+ Version 1.1
18
+
19
+ Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
20
+
21
+ Everyone is permitted to copy and distribute verbatim copies of this
22
+ license document, but changing it is not allowed.
23
+
24
+
25
+ Developer's Certificate of Origin 1.1
26
+
27
+ By making a contribution to this project, I certify that:
28
+
29
+ (a) The contribution was created in whole or in part by me and I
30
+ have the right to submit it under the open source license
31
+ indicated in the file; or
32
+
33
+ (b) The contribution is based upon previous work that, to the best
34
+ of my knowledge, is covered under an appropriate open source
35
+ license and I have the right under that license to submit that
36
+ work with modifications, whether created in whole or in part
37
+ by me, under the same open source license (unless I am
38
+ permitted to submit under a different license), as indicated
39
+ in the file; or
40
+
41
+ (c) The contribution was provided directly to me by some other
42
+ person who certified (a), (b) or (c) and I have not modified
43
+ it.
44
+
45
+ (d) I understand and agree that this project and the contribution
46
+ are public and that a record of the contribution (including all
47
+ personal information I submit with it, including my sign-off) is
48
+ maintained indefinitely and may be redistributed consistent with
49
+ this project or the open source license(s) involved.
50
+ ```
51
+
52
+ ## Commits
53
+
54
+ - Write the subject in the imperative, and say why in the body when the subject is not enough.
55
+ - Keep one change in one commit when you can.
56
+ - Add `Signed-off-by` on every commit.
57
+ - Do not commit source, prompts, diffs of private code, or claim values as test fixtures unless they are synthetic and already in this repository.
58
+ - Do not change domain-separation tags, the `ac1.` encoding, or a trailer key inside an unrelated commit.
59
+
60
+ ## Pull requests
61
+
62
+ - Open the pull request against `main`.
63
+ - Describe what changed and how you checked it.
64
+ - Run the checks below for the code you touched. `npm run check` covers the TypeScript suite.
65
+ - If you change Rust, also run `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test`.
66
+ - A pull request does not bump the version, publish to a registry, or file an upstream issue. Maintainers do those as separate steps.
67
+ - Review comments stay on the pull request. [GOVERNANCE.md](GOVERNANCE.md) says how a disagreement is decided.
68
+
69
+ ## Checks
70
+
71
+ Node.js 22 or newer, and Rust 1.83.
72
+
73
+ ```sh
74
+ npm ci
75
+ npm run check
76
+ cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test
77
+ npm run wasm
78
+ npm run build:site
79
+ npm run smoke:site
80
+ ```
81
+
82
+ `npm run check` is the Biome check and the node:test suite. `npm run wasm` checks that `mergeseal-wasm` returns the same status word as `mergeseal-portable`. `npm run build:site` writes `site/dist`. `npm run smoke:site` loads that bundle, accepts the sample seal, rejects a tampered seal, and checks that verification makes no network call.
83
+
84
+ ## Wire format
85
+
86
+ Do not change domain-separation tags, the `ac1.` encoding, or the `Agent-Certificate` and `Agent-Certificate-Portable` trailer keys in a patch release. Those bytes are the seal. The core plus one seal is at most 192 bytes. The in-toto predicate in [docs/intoto-predicate-v1.md](docs/intoto-predicate-v1.md) is a statement about a seal that has already verified. It is not a new trailer.
87
+
88
+ Questions and issues: https://github.com/mergeseal/mergeseal/issues
89
+
90
+ https://mergeseal.dev
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 MergeSeal
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ MergeSeal
2
+ Copyright 2026 MergeSeal
3
+
4
+ MergeSeal Contributors
5
+ https://mergeseal.dev
6
+ https://github.com/mergeseal/mergeseal
package/README.md CHANGED
@@ -1,3 +1,237 @@
1
- # Temporary Holding Version
1
+ # MergeSeal
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Don't trust the agent's "all tests pass." Verify it.
4
+
5
+ The runner holds the signing key; the agent never sees it.
6
+
7
+ Flags agent PRs that weakened tests or skipped checks.
8
+
9
+ MergeSeal gives every agent code change a signed receipt: which checks ran, which passed, on exactly which code. Change one line and the seal breaks. Verify offline in under 0.5 ms.
10
+
11
+ Signed receipts for agent code changes · <0.5 ms offline verify
12
+
13
+ | Tier | Runner | Signing |
14
+ | ------ | ------------------ | ------------------------------------------------------------- |
15
+ | Tier 1 | Developer machine | Static `MERGESEAL_KEY` on that machine |
16
+ | Tier 2 | Isolated CI runner | Static `MERGESEAL_KEY`, or opt-in keyless GitHub Actions OIDC |
17
+
18
+ Tier 1 and the default Tier 2 path sign with `MERGESEAL_KEY`. That path does not open a socket. Opt-in keyless signing is Tier 2 on GitHub Actions only: `mergeseal keyless seal` (or `mergeseal seal --keyless` / `--oidc`) requests an OIDC token, generates an ephemeral key, and gets a short-lived Sigstore Fulcio certificate. There is no static `MERGESEAL_KEY`. Verify that bundle with `--certificate-identity` or `--certificate-identity-regexp` and `--certificate-oidc-issuer` (default `https://token.actions.githubusercontent.com`). Verification checks the certificate chain, the SAN, and the signature locally. The 192-byte `Agent-Certificate-Portable:` trailer is unchanged.
19
+
20
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
21
+
22
+ Offline Ed25519 seals for agent and merge trust. The check stays on the machine that already has the commit.
23
+
24
+ ```sh
25
+ npx mergeseal
26
+ cargo install mergeseal
27
+ npx mergeseal init
28
+ ```
29
+
30
+ `npx mergeseal` is the CLI (Node.js 22 or newer). `cargo install mergeseal` installs the offline verifier `mergeseal-portable`. `npx mergeseal init` writes the Cursor rule and the skill. That command does not create an account, read an API key, or open a network connection.
31
+
32
+ | Exit | Meaning |
33
+ | ---- | ----------------------- |
34
+ | 0 | verified |
35
+ | 1 | policy or verify failed |
36
+ | 2 | usage or config error |
37
+
38
+ With `--json`, exit 1 and exit 2 print one object with `ok`, `error`, `exit`, and `next`. Run the `next` command.
39
+
40
+ - [llms.txt](llms.txt)
41
+ - [llms-full.txt](llms-full.txt)
42
+ - [skills/mergeseal/SKILL.md](skills/mergeseal/SKILL.md)
43
+ - [templates/cursor-mergeseal.mdc](templates/cursor-mergeseal.mdc)
44
+ - [docs/cli-contract.md](docs/cli-contract.md)
45
+ - [docs/ucan-biscuit.md](docs/ucan-biscuit.md)
46
+
47
+ The core plus one seal is at most 192 bytes. Nothing in that check uploads source, prompts, diffs, or claim values.
48
+
49
+ The normative rules are in [spec/v1.md](spec/v1.md), [spec/v1.1.md](spec/v1.1.md), [spec/native.md](spec/native.md), [spec/portable.md](spec/portable.md), and [spec/coding-gate.md](spec/coding-gate.md).
50
+
51
+ ## Preview in 60 seconds
52
+
53
+ This is an offline test preview. The demo key is not a secret and it is not a production credential. The page issues a certificate, verifies it in the browser, and shows a stale or revoked denial. It has no payment path and it cannot move money.
54
+
55
+ ```sh
56
+ npm ci
57
+ npm run preview
58
+ ```
59
+
60
+ Open http://127.0.0.1:8787 and enter the test key `ac-demo-preview`.
61
+
62
+ The same key works as a header or a query parameter:
63
+
64
+ ```sh
65
+ curl -H "X-Demo-Key: ac-demo-preview" http://127.0.0.1:8787/
66
+ curl "http://127.0.0.1:8787/?key=ac-demo-preview"
67
+ ```
68
+
69
+ A missing or unknown key gets the lock page. `GET /healthz` stays open so a host can probe the process. `render.yaml` is a free web service for that preview (`plan: free`, health check `/healthz`). Applying the Blueprint is a separate step. This repository does not deploy it. `DEMO_ACCESS_KEYS` accepts only `ac-demo-preview`.
70
+
71
+ Copyright 2026 MergeSeal. MergeSeal Contributors.
72
+ https://mergeseal.dev
73
+ https://github.com/mergeseal/mergeseal
74
+
75
+ ## Offline-first
76
+
77
+ Verification is a local signature check. It does not open a socket, and it does not send the repository anywhere. The one signing path that opens a connection is opt-in `mergeseal keyless seal`. A static `MERGESEAL_KEY` command does not take that path.
78
+
79
+ - Source, prompts, diffs, and claim values stay on the machine.
80
+ - The coding gate stores a diff digest and one secret-scan bit, not the line.
81
+ - `mergeseal registry serve` binds `127.0.0.1` only.
82
+ - If you do not pass a registry URL, the check never looks one up.
83
+
84
+ A seal that needs a network to mean anything is not a MergeSeal seal.
85
+
86
+ ## 60-second quickstart
87
+
88
+ Requires Node.js 22 or newer. From a checkout of https://github.com/mergeseal/mergeseal:
89
+
90
+ ```sh
91
+ npm ci
92
+ npm run build
93
+ npx mergeseal native quickstart --json
94
+ ```
95
+
96
+ Exit 0 and `"network": false`, `"withinBudget": true`, `"authenticated": true`. The canonical core plus one seal is at most 192 bytes. The same walk-through is in [spec/quickstart.md](spec/quickstart.md).
97
+
98
+ ### CLI
99
+
100
+ ```sh
101
+ npx mergeseal init
102
+ npx mergeseal keygen --json
103
+ npx mergeseal native quickstart --json
104
+ npx mergeseal portable verify ac1.... --now 1700000000000 --public-key HEX
105
+ npx mergeseal gate --rev HEAD --json --warn-only
106
+ ```
107
+
108
+ Exit 0 is verified, exit 1 is a policy or verify failure, and exit 2 is a usage or config error. `--json` writes one object to stdout. On exit 1 and exit 2 that object includes `error`, `exit`, and `next`. See [docs/cli-contract.md](docs/cli-contract.md).
109
+
110
+ `npx mergeseal init --cursor`, `--claude-code`, `--codex`, or `--git-hook` installs opt-in local sealing for that host. `--yes` installs the hosts it detects. The install merges into the existing config. `--dry-run` writes nothing. `--uninstall` removes only MergeSeal's entries. `npx mergeseal mcp` is a local stdio server with `mergeseal_verify`, `mergeseal_inspect`, and `mergeseal_seal`. None of these commands open a socket.
111
+
112
+ ### GitHub Action
113
+
114
+ The action's display name is MergeSeal. It runs the offline coding gate and does not upload source.
115
+
116
+ ```yaml
117
+ name: MergeSeal
118
+ on: pull_request
119
+ jobs:
120
+ seal:
121
+ runs-on: ubuntu-latest
122
+ steps:
123
+ - uses: actions/checkout@v4
124
+ - uses: actions/setup-node@v4
125
+ with:
126
+ node-version: "22"
127
+ - run: npm ci
128
+ - run: npm run build
129
+ - uses: ./.github/actions/coding-gate
130
+ with:
131
+ warn-only: "true"
132
+ ```
133
+
134
+ On GitHub that action is `mergeseal/mergeseal/.github/actions/coding-gate@v0.2.0`. The step reads `dist/cli.js` from the checkout, so build first. Set `hold: "true"` to label and draft an uncertified pull request until a receipt is attached.
135
+
136
+ Opt-in keyless signing sets `keyless: "true"`. The workflow needs `id-token: write`. The action still runs the offline gate first. It requests an OIDC token only after that gate passes, then writes a Fulcio-backed bundle. The default `keyless: "false"` does not request a token.
137
+
138
+ ```yaml
139
+ permissions:
140
+ id-token: write
141
+ contents: read
142
+ jobs:
143
+ seal:
144
+ runs-on: ubuntu-latest
145
+ steps:
146
+ - uses: actions/checkout@v4
147
+ - uses: actions/setup-node@v4
148
+ with:
149
+ node-version: "22"
150
+ - run: npm ci
151
+ - run: npm run build
152
+ - uses: ./.github/actions/coding-gate
153
+ with:
154
+ keyless: "true"
155
+ ```
156
+
157
+ ### Cursor, Claude Code, Codex, and Windsurf
158
+
159
+ Each host shim emits one compact certificate. The payload is the host's agent id and nothing else. A payload that contains code, a prompt, a diff, or a claim value is rejected.
160
+
161
+ ```sh
162
+ npx mergeseal keygen --json
163
+ # use the privateKey field as MERGESEAL_KEY
164
+ npx mergeseal portable hook emit \
165
+ --host cursor \
166
+ --agent-id "$COMPOSER_ID" \
167
+ --issued-at 1700000000000 \
168
+ --fresh-until 1800000000000 \
169
+ --expires-at 1900000000000 \
170
+ --key "$MERGESEAL_KEY" \
171
+ --json
172
+ ```
173
+
174
+ Use the same command with `--host claude-code` and a `sessionId`, `--host codex` and a `threadId`, or `--host windsurf` and a `cascadeId`. The subject is `SHA-256` of the host name and that id.
175
+
176
+ Install the local git hook with `npx mergeseal hook install` inside a repository. It refuses `git commit --no-verify`.
177
+
178
+ ### WASM verifier
179
+
180
+ ```sh
181
+ npm run wasm
182
+ ```
183
+
184
+ That builds `mergeseal-portable` and the `mergeseal-wasm` module, then checks they return the same status word. `portable_verify` is the export. A passing run prints `wasm bit-parity ok 7 cases`.
185
+
186
+ ## Library
187
+
188
+ ```ts
189
+ import { compose, generateKeyPair, issue, verify } from "mergeseal/v1";
190
+ ```
191
+
192
+ `issue` runs a held-out suite and returns an Ed25519-signed certificate. `verify` fails closed on a bad signature, a tampered payload, expiry, staleness, and a timestamp downgrade. `compose` signs a two-agent swarm certificate: capabilities are the intersection, the evidence score is the minimum, and freshness and expiry are the older issuance and the earlier expiry.
193
+
194
+ ```ts
195
+ import {
196
+ createHttpMiddleware,
197
+ createMcpMiddleware,
198
+ delegateCertificate,
199
+ issueAgentCertificate,
200
+ verifyAgentRequest,
201
+ verifyCertificate,
202
+ } from "mergeseal/v1.1";
203
+ ```
204
+
205
+ v1.1 certificates are `ac1.` tokens: unpadded base64url of deterministic CBOR. The HTTP header names on that surface are `agent-certificate`, `agent-proof`, and `agent-action`. Those names are the wire format.
206
+
207
+ `mergeseal/native` is the compact certificate. `mergeseal/portable` keeps that core plus one seal, at most 192 bytes. `Agent-Certificate-Portable:` is the commit trailer for the compact token. The coding gate keeps `Agent-Certificate:` for its bundle. Both trailers can sit on one commit. Do not rename them: existing seals and commits use those keys.
208
+
209
+ `mergeseal/coding` is the offline policy, hook, and merge gate. `mergeseal policy sign` writes an `acp.` policy. `mergeseal hook run` mints an `acg.` bundle only after the configured command exits 0. `mergeseal gate` recomputes a canonical fingerprint of the changed files, so the same patch still verifies after a squash or rebase.
210
+
211
+ ## Site
212
+
213
+ `npm run build:site` writes a static bundle to `site/dist`. Serve that directory at the root of a host. The pages are `/`, `/verify`, `/llms.txt`, and `/llms-full.txt`. `llms.txt` and `llms-full.txt` are copied from this repository at build time. `/verify` runs the `mergeseal-wasm` module in the browser. Build that module first with `npm run wasm`.
214
+
215
+ `npm run smoke:site` opens the built `/verify` page, accepts the sample seal, rejects a tampered seal, and checks that the check itself makes no network call.
216
+
217
+ ## Develop
218
+
219
+ ```sh
220
+ npm ci
221
+ npm test
222
+ npm run check
223
+ cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test
224
+ npm run wasm
225
+ npm run build:site
226
+ npm run smoke:site
227
+ ```
228
+
229
+ `crates/mergeseal` has no `unsafe` and no floating-point arithmetic. It checks `vectors/v1.1-golden.json` byte for byte. `npm test` also builds `playground/dist/` and runs the preview demo-key gate. `npm run preview` serves that gate. `render.yaml` is the hosted preview config and is not applied by the test run. See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
230
+
231
+ ## License
232
+
233
+ Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
234
+
235
+ Copyright 2026 MergeSeal. MergeSeal Contributors.
236
+ https://mergeseal.dev
237
+ https://github.com/mergeseal/mergeseal
package/SECURITY.md ADDED
@@ -0,0 +1,39 @@
1
+ # Security
2
+
3
+ MergeSeal checks a signature locally. It does not send the repository, the prompt, the diff, or a claim value anywhere to do that check.
4
+
5
+ ## Threat model
6
+
7
+ The compact certificate is canonical CBOR plus one Ed25519 seal, at most 192 bytes. The seal covers the subject and the core. A verifier with the public key can accept or reject that seal with no network.
8
+
9
+ These stay on the machine:
10
+
11
+ - source
12
+ - prompts
13
+ - diffs
14
+ - claim values
15
+
16
+ The coding gate stores a digest of the diff and one bit for a secret-pattern scan. It does not store the line. The status registry refuses a payload that contains code, a prompt, a diff, or a claim value. `mergeseal registry serve` binds `127.0.0.1` and does not open an outbound socket.
17
+
18
+ What a valid seal means:
19
+
20
+ - the signature matches a key the verifier was given, or a key in the local trust root
21
+ - the certificate is inside its fresh window at the time you pass
22
+ - the recorded diff fingerprint matches the commit under review, when the coding gate is the check
23
+
24
+ What a valid seal does not mean:
25
+
26
+ - the private key was safe from whoever can read it on that machine
27
+ - a human co-signature was a careful review
28
+ - a test command that exited 0 tested the right thing
29
+ - an opted-in registry you cannot reach has the latest undo, unless you pass `--fail-closed`
30
+
31
+ Domain-separation tags and the git trailer keys are part of the signed bytes. Changing them breaks verification of existing seals.
32
+
33
+ ## Reporting
34
+
35
+ Report a vulnerability through [GitHub private advisories](https://github.com/mergeseal/mergeseal/security/advisories). Do not open a public issue for a vulnerability, and do not include source, prompts, diffs, or claim values in the report.
36
+
37
+ MergeSeal Contributors
38
+ https://mergeseal.dev
39
+ https://github.com/mergeseal/mergeseal
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Biscuit Datalog facts for a result that has already verified.
3
+ * The function refuses a result whose `verified` flag is not true.
4
+ * String terms are escaped so a key id cannot close the fact.
5
+ */
6
+ export type VerifiedFacts = {
7
+ readonly verified: true;
8
+ readonly testsPassed: boolean;
9
+ readonly secretsClean: boolean;
10
+ readonly humanCosigned: boolean;
11
+ readonly issuerId: string;
12
+ readonly keyId: string;
13
+ };
14
+ export declare function toBiscuitFacts(result: VerifiedFacts): string;