shipwright-check 0.1.0__tar.gz

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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may accept and charge a
167
+ fee for acceptance of support, warranty, indemnity, or other liability
168
+ obligations and/or rights consistent with this License. However, in
169
+ accepting such obligations, You may act only on Your own behalf and on
170
+ Your sole responsibility, not on behalf of any other Contributor, and
171
+ only if You agree to indemnify, defend, and hold each Contributor
172
+ harmless for any liability incurred by, or claims asserted against,
173
+ such Contributor by reason of your accepting any such warranty or
174
+ additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 StellarRequiem
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: shipwright-check
3
+ Version: 0.1.0
4
+ Summary: Pre-ship reliability check for an AI build's claims, docs, and citations — composes verity, firewall, and grounded over your own project (bring-your-own, consent-first). Checks what your AI ships in text, not its runtime behavior.
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Dynamic: license-file
10
+
11
+ # Shipwright
12
+
13
+ **Catch it before your users do.** A pre-ship reliability check for your AI build's **claims, docs, and
14
+ citations** — run it on your own project, privately, before you ship.
15
+
16
+ It composes three deterministic verification gates over the text your build produces and ships:
17
+
18
+ | Check | What it catches | Powered by |
19
+ |---|---|---|
20
+ | Doc/output over-claims | factual claims in your README/output that contradict your declared ground truth | `firewall` |
21
+ | Result-claim hygiene | result-claims (accuracy/win-rate) with no sample size, no holdout, or possible leakage | `verity` |
22
+ | Citation grounding | cited claims whose source doesn't actually support them (fabricated/mismatched citations) | `grounded` |
23
+
24
+ It reports a transparent **1–5 reliability level** and names each unearned point next to the fix.
25
+
26
+ ## Honest scope (what it does and doesn't do)
27
+ Shipwright checks what your build **claims and ships in text**. It does **not** test your code's runtime
28
+ behavior, and a 5/5 means *these specific deterministic checks pass* — not "provably reliable AI." It runs
29
+ **only on the path you give it** and sends nothing anywhere (consent-first). A gate that isn't installed,
30
+ or a check with no matching content, is reported as `n/a` — never a fake pass. MCP/tool *authorization*
31
+ is deliberately **not** a dimension: our `mcp-bench` is a benchmark *of scanners*, not a scanner you point
32
+ at your repo, so claiming an MCP-authz check here would be an over-claim of our own.
33
+
34
+ ## Install
35
+ Shipwright itself has no dependencies. Install it and the three gates (the gates are published from the
36
+ StellarRequiem repos, not under their generic PyPI names):
37
+
38
+ ```sh
39
+ pip install -e . # shipwright (this repo)
40
+ pip install git+https://github.com/StellarRequiem/verity-core \
41
+ git+https://github.com/StellarRequiem/firewall \
42
+ git+https://github.com/StellarRequiem/grounded
43
+ ```
44
+
45
+ ## Use
46
+ ```sh
47
+ shipwright init # scaffold a starter truth.yaml + a CI workflow
48
+ shipwright check . # check the current project
49
+ shipwright check . --truth truth.yaml # declare your ground truth for the over-claim check
50
+ ```
51
+ Writes `shipwright-report.md` and prints the level. Exit code is CI-gateable: `0` pass · `1` review · `2` refuse.
52
+ Each gap is linked to the lesson that closes it, in the *Building Verifiable Software* course.
53
+
54
+ Agents can self-check over MCP: `verity-mcp` (installed with verity-core) is a Model Context Protocol
55
+ server — point your agent at it to gate its own claims.
56
+
57
+ ## Status
58
+ Early (v0.1.0), single author, no users yet — the leading hypothesis is that teams ship LLM apps whose
59
+ *claims* outrun what they can support, and there's no cheap, honest, local way to catch that before users
60
+ do. This is the free, local tier; a hosted progress/badge surface is a later build.
@@ -0,0 +1,50 @@
1
+ # Shipwright
2
+
3
+ **Catch it before your users do.** A pre-ship reliability check for your AI build's **claims, docs, and
4
+ citations** — run it on your own project, privately, before you ship.
5
+
6
+ It composes three deterministic verification gates over the text your build produces and ships:
7
+
8
+ | Check | What it catches | Powered by |
9
+ |---|---|---|
10
+ | Doc/output over-claims | factual claims in your README/output that contradict your declared ground truth | `firewall` |
11
+ | Result-claim hygiene | result-claims (accuracy/win-rate) with no sample size, no holdout, or possible leakage | `verity` |
12
+ | Citation grounding | cited claims whose source doesn't actually support them (fabricated/mismatched citations) | `grounded` |
13
+
14
+ It reports a transparent **1–5 reliability level** and names each unearned point next to the fix.
15
+
16
+ ## Honest scope (what it does and doesn't do)
17
+ Shipwright checks what your build **claims and ships in text**. It does **not** test your code's runtime
18
+ behavior, and a 5/5 means *these specific deterministic checks pass* — not "provably reliable AI." It runs
19
+ **only on the path you give it** and sends nothing anywhere (consent-first). A gate that isn't installed,
20
+ or a check with no matching content, is reported as `n/a` — never a fake pass. MCP/tool *authorization*
21
+ is deliberately **not** a dimension: our `mcp-bench` is a benchmark *of scanners*, not a scanner you point
22
+ at your repo, so claiming an MCP-authz check here would be an over-claim of our own.
23
+
24
+ ## Install
25
+ Shipwright itself has no dependencies. Install it and the three gates (the gates are published from the
26
+ StellarRequiem repos, not under their generic PyPI names):
27
+
28
+ ```sh
29
+ pip install -e . # shipwright (this repo)
30
+ pip install git+https://github.com/StellarRequiem/verity-core \
31
+ git+https://github.com/StellarRequiem/firewall \
32
+ git+https://github.com/StellarRequiem/grounded
33
+ ```
34
+
35
+ ## Use
36
+ ```sh
37
+ shipwright init # scaffold a starter truth.yaml + a CI workflow
38
+ shipwright check . # check the current project
39
+ shipwright check . --truth truth.yaml # declare your ground truth for the over-claim check
40
+ ```
41
+ Writes `shipwright-report.md` and prints the level. Exit code is CI-gateable: `0` pass · `1` review · `2` refuse.
42
+ Each gap is linked to the lesson that closes it, in the *Building Verifiable Software* course.
43
+
44
+ Agents can self-check over MCP: `verity-mcp` (installed with verity-core) is a Model Context Protocol
45
+ server — point your agent at it to gate its own claims.
46
+
47
+ ## Status
48
+ Early (v0.1.0), single author, no users yet — the leading hypothesis is that teams ship LLM apps whose
49
+ *claims* outrun what they can support, and there's no cheap, honest, local way to catch that before users
50
+ do. This is the free, local tier; a hosted progress/badge surface is a later build.
@@ -0,0 +1,20 @@
1
+ [project]
2
+ name = "shipwright-check"
3
+ version = "0.1.0"
4
+ description = "Pre-ship reliability check for an AI build's claims, docs, and citations — composes verity, firewall, and grounded over your own project (bring-your-own, consent-first). Checks what your AI ships in text, not its runtime behavior."
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = { text = "Apache-2.0" }
8
+ # No Python dependencies: Shipwright composes the gate CLIs as subprocesses (never re-vendors them).
9
+ # Install the gates separately from the StellarRequiem repos (see README).
10
+ dependencies = []
11
+
12
+ [project.scripts]
13
+ shipwright = "shipwright.cli:main"
14
+
15
+ [build-system]
16
+ requires = ["setuptools>=61"]
17
+ build-backend = "setuptools.build_meta"
18
+
19
+ [tool.setuptools]
20
+ packages = ["shipwright"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ """Shipwright — a pre-ship reliability check for an AI build's claims, docs, and citations.
2
+
3
+ Composes the verification gates (verity / firewall / grounded) over a path you point it at
4
+ (bring-your-own, consent-first) and reports a transparent 1–5 reliability level. It checks what your
5
+ build *claims and ships in text*, not its runtime code behavior.
6
+ """
7
+ __version__ = "0.1.0"
@@ -0,0 +1,86 @@
1
+ """shipwright CLI — `shipwright check <path>` runs the reliability check and writes a local report.
2
+
3
+ Exit code is CI-gateable, mirroring the gates: 0 = pass (or nothing applicable) · 1 = review (warn) ·
4
+ 2 = refuse. Consent-first: only ever reads the path you give it.
5
+ """
6
+ from __future__ import annotations
7
+
8
+ import argparse
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ from . import __version__
13
+ from .core import DIMENSIONS, gate_available, run_check, score
14
+ from .report import render_markdown
15
+ from .scaffold import init_project
16
+
17
+ _EXIT = {"pass": 0, "warn": 1, "refuse": 2, None: 0}
18
+
19
+
20
+ def _cmd_check(args) -> int:
21
+ root = Path(args.path).expanduser().resolve()
22
+ if not root.exists():
23
+ print(f"shipwright: path not found: {root}", file=sys.stderr)
24
+ return 3
25
+ truth = Path(args.truth).expanduser().resolve() if args.truth else None
26
+
27
+ missing = [cli for _, (_, cli) in DIMENSIONS.items() if not gate_available(cli)]
28
+ if missing:
29
+ print(f"shipwright: note — gates not installed: {', '.join(sorted(set(missing)))} "
30
+ f"(those dimensions report n/a; install from the StellarRequiem repos)", file=sys.stderr)
31
+
32
+ results = run_check(root, truth)
33
+ scored = score(results)
34
+ report = render_markdown(results, scored, str(root), truth_given=bool(truth))
35
+
36
+ out = Path(args.out).expanduser() if args.out else root / "shipwright-report.md"
37
+ out.write_text(report, encoding="utf-8")
38
+
39
+ lvl = scored.get("level")
40
+ if lvl is None:
41
+ print(f"Reliability level: n/a — {scored.get('note','')}")
42
+ else:
43
+ print(f"Reliability level: {lvl}/5 · {scored['passed']}/{scored['applicable']} applicable checks passed "
44
+ f"· worst: {scored.get('worst')}")
45
+ print(f"Report: {out}")
46
+ return _EXIT.get(scored.get("worst"), 0)
47
+
48
+
49
+ def _cmd_init(args) -> int:
50
+ root = Path(args.path).expanduser().resolve()
51
+ if not root.exists():
52
+ print(f"shipwright: path not found: {root}", file=sys.stderr)
53
+ return 3
54
+ res = init_project(root, force=args.force)
55
+ for w in res["wrote"]:
56
+ print(f" wrote {w}")
57
+ for s in res["skipped"]:
58
+ print(f" skipped {s} (already exists — use --force to overwrite)")
59
+ if res["wrote"]:
60
+ print("Next: edit truth.yaml with your project's real facts, then run "
61
+ "`shipwright check . --truth truth.yaml`.")
62
+ return 0
63
+
64
+
65
+ def main(argv=None) -> int:
66
+ ap = argparse.ArgumentParser(
67
+ prog="shipwright",
68
+ description="Pre-ship reliability check for your AI build's claims, docs, and citations "
69
+ "(composes verity + firewall + grounded; bring-your-own, consent-first).")
70
+ ap.add_argument("--version", action="version", version=f"shipwright {__version__}")
71
+ sub = ap.add_subparsers(dest="cmd", required=True)
72
+ c = sub.add_parser("check", help="run the reliability check over a project path")
73
+ c.add_argument("path", help="path to your project (read-only; nothing is sent anywhere)")
74
+ c.add_argument("--truth", help="ground-truth YAML for the doc/output over-claim check")
75
+ c.add_argument("--out", help="report output path (default: <path>/shipwright-report.md)")
76
+ c.set_defaults(fn=_cmd_check)
77
+ i = sub.add_parser("init", help="scaffold a starter truth.yaml + a CI workflow")
78
+ i.add_argument("path", nargs="?", default=".", help="project path (default: current dir)")
79
+ i.add_argument("--force", action="store_true", help="overwrite existing files")
80
+ i.set_defaults(fn=_cmd_init)
81
+ args = ap.parse_args(argv)
82
+ return args.fn(args)
83
+
84
+
85
+ if __name__ == "__main__":
86
+ sys.exit(main())
@@ -0,0 +1,186 @@
1
+ """shipwright.core — compose the verification gates over a project's own claims/docs/citations.
2
+
3
+ HONEST SCOPE: Shipwright checks the reliability of what an AI build *claims and ships in text* — over-
4
+ claims in docs/output (via the AI-Output Claim Checker, `firewall`), statistically-unsound result-claims
5
+ (via the Claim Verification Gate, `verity`), and fabricated/mismatched citations (via the Citation
6
+ Grounding Checker, `grounded`). It does NOT test runtime code behavior. It runs ONLY on a path you point
7
+ it at (bring-your-own, consent-first) and never sends your code anywhere.
8
+
9
+ Design: Shipwright COMPOSES the gate CLIs as subprocesses (never re-vendors them) and has zero Python
10
+ dependencies of its own. If a gate isn't installed, that dimension is reported as 'not available' — never
11
+ a fake pass.
12
+ """
13
+ from __future__ import annotations
14
+
15
+ import shutil
16
+ import subprocess
17
+ import sys
18
+ from dataclasses import dataclass, field
19
+ from pathlib import Path
20
+
21
+ # ── dimensions (plain names) → the gate CLI that powers each ──────────────────
22
+ DIMENSIONS = {
23
+ "docs_claims": ("Doc/output over-claims", "firewall"),
24
+ "result_claims": ("Result-claim hygiene", "verity"),
25
+ "citations": ("Citation grounding", "grounded"),
26
+ }
27
+ _RANK = {"pass": 0, "warn": 1, "refuse": 2} # worst-wins ordering; na/error sit outside the ladder
28
+
29
+
30
+ @dataclass
31
+ class Verdict:
32
+ dimension: str
33
+ artifact: str
34
+ status: str # pass | warn | refuse | na | error
35
+ detail: str = ""
36
+ exit_code: int | None = None
37
+
38
+
39
+ @dataclass
40
+ class DimensionResult:
41
+ key: str
42
+ label: str
43
+ cli: str
44
+ available: bool
45
+ verdicts: list = field(default_factory=list)
46
+
47
+ @property
48
+ def applicable(self) -> bool:
49
+ return self.available and bool(self.verdicts)
50
+
51
+ @property
52
+ def status(self) -> str:
53
+ if not self.available:
54
+ return "na" # gate not installed
55
+ if not self.verdicts:
56
+ return "na" # no checkable artifacts of this kind
57
+ return max((v.status for v in self.verdicts), key=lambda s: _RANK.get(s, 0))
58
+
59
+
60
+ def _resolve(cli: str) -> str | None:
61
+ # Gates are installed in the SAME venv as shipwright (co-located) — check that bin first (running a
62
+ # venv script directly does NOT put the venv bin on PATH), then fall back to PATH.
63
+ cand = Path(sys.executable).parent / cli
64
+ if cand.exists():
65
+ return str(cand)
66
+ return shutil.which(cli)
67
+
68
+
69
+ def gate_available(cli: str) -> bool:
70
+ return _resolve(cli) is not None
71
+
72
+
73
+ def _run(cmd: list, stdin_path: Path | None = None, timeout: int = 120) -> tuple[int, str]:
74
+ try:
75
+ with (open(stdin_path, "rb") if stdin_path else _null()) as fh:
76
+ p = subprocess.run(cmd, stdin=fh, capture_output=True, text=True, timeout=timeout)
77
+ return p.returncode, (p.stdout + p.stderr).strip()
78
+ except FileNotFoundError:
79
+ return -1, "gate CLI not found"
80
+ except subprocess.TimeoutExpired:
81
+ return -1, "gate timed out"
82
+ except Exception as e: # noqa: BLE001 — a gate failure must never crash the orchestrator
83
+ return -1, f"gate error: {str(e)[:160]}"
84
+
85
+
86
+ class _null:
87
+ def __enter__(self): return subprocess.DEVNULL
88
+ def __exit__(self, *a): return False
89
+
90
+
91
+ def _status_from_exit(code: int, verity: bool = False) -> str:
92
+ # verity documents exit 0/1/2 = PASS/WARN/REFUSE. Other gates: 0 = clean, non-zero = needs review.
93
+ if code == -1:
94
+ return "error"
95
+ if verity:
96
+ return {0: "pass", 1: "warn", 2: "refuse"}.get(code, "warn")
97
+ return "pass" if code == 0 else "warn"
98
+
99
+
100
+ # ── per-dimension runners ─────────────────────────────────────────────────────
101
+ def run_docs_claims(doc: Path, truth: Path | None) -> Verdict:
102
+ cmd = [_resolve("firewall") or "firewall"]
103
+ if truth:
104
+ cmd += ["--truth", str(truth)]
105
+ cmd += [str(doc)]
106
+ code, out = _run(cmd)
107
+ status = _status_from_exit(code)
108
+ # A claim that CONTRADICTS your declared truth is the dangerous class — escalate it to refuse.
109
+ if status != "error" and ("CONTRADICTS" in out or "⛔" in out or "contradict" in out.lower()):
110
+ status = "refuse"
111
+ return Verdict("docs_claims", str(doc), status, out[:600], code)
112
+
113
+
114
+ def run_result_claims(doc: Path) -> Verdict:
115
+ code, out = _run([_resolve("verity") or "verity", "verify-markdown", str(doc)])
116
+ return Verdict("result_claims", str(doc), _status_from_exit(code, verity=True), out[:600], code)
117
+
118
+
119
+ def run_citations(doc: Path, no_net: bool = True) -> Verdict:
120
+ cmd = [_resolve("grounded") or "grounded"] + (["--no-net"] if no_net else []) + [str(doc)]
121
+ code, out = _run(cmd)
122
+ return Verdict("citations", str(doc), _status_from_exit(code), out[:600], code)
123
+
124
+
125
+ # ── artifact discovery (consent-first: only under the given path) ─────────────
126
+ def _markdown_files(root: Path, limit: int = 200) -> list:
127
+ out = []
128
+ for p in sorted(root.rglob("*.md")):
129
+ if any(seg in {".venv", "node_modules", ".git", "site-packages"} for seg in p.parts):
130
+ continue
131
+ out.append(p)
132
+ if len(out) >= limit:
133
+ break
134
+ return out
135
+
136
+
137
+ def discover(root: Path) -> dict:
138
+ """Find the project's own checkable text artifacts. README + docs -> docs_claims; markdown holding
139
+ ```json claim blocks -> result_claims; markdown with citation/reference markers -> citations."""
140
+ mds = _markdown_files(root)
141
+ docs, claims, cites = [], [], []
142
+ for p in mds:
143
+ try:
144
+ text = p.read_text(encoding="utf-8", errors="replace")
145
+ except Exception: # noqa: BLE001
146
+ continue
147
+ low = p.name.lower()
148
+ if low == "readme.md" or "/docs/" in str(p).replace("\\", "/").lower():
149
+ docs.append(p)
150
+ if "```json" in text:
151
+ claims.append(p)
152
+ if "](http" in text or "\n[1]" in text or "references" in text.lower():
153
+ cites.append(p)
154
+ return {"docs_claims": docs, "result_claims": claims, "citations": cites}
155
+
156
+
157
+ def run_check(root: Path, truth: Path | None = None) -> list:
158
+ """Run every available dimension over the discovered artifacts. Returns DimensionResults."""
159
+ found = discover(root)
160
+ results = []
161
+ for key, (label, cli) in DIMENSIONS.items():
162
+ dr = DimensionResult(key=key, label=label, cli=cli, available=gate_available(cli))
163
+ if dr.available:
164
+ for art in found.get(key, []):
165
+ if key == "docs_claims":
166
+ dr.verdicts.append(run_docs_claims(art, truth))
167
+ elif key == "result_claims":
168
+ dr.verdicts.append(run_result_claims(art))
169
+ elif key == "citations":
170
+ dr.verdicts.append(run_citations(art))
171
+ results.append(dr)
172
+ return results
173
+
174
+
175
+ # ── transparent 1–5 reliability level ─────────────────────────────────────────
176
+ def score(results: list) -> dict:
177
+ """Level = round(1 + 4 * passed/applicable) over APPLICABLE dimensions (a gate that's absent or has no
178
+ artifacts is 'n/a' and never counted — no fake pass). Returns the level + the inspectable fractions."""
179
+ applicable = [r for r in results if r.applicable]
180
+ passed = [r for r in applicable if r.status == "pass"]
181
+ if not applicable:
182
+ return {"level": None, "passed": 0, "applicable": 0,
183
+ "note": "Nothing checkable found — add result-claims, a truth.yaml, or cited reports to get a level."}
184
+ level = round(1 + 4 * (len(passed) / len(applicable)))
185
+ worst = max((r.status for r in applicable), key=lambda s: _RANK.get(s, 0))
186
+ return {"level": max(1, min(5, level)), "passed": len(passed), "applicable": len(applicable), "worst": worst}
@@ -0,0 +1,67 @@
1
+ """shipwright.report — render the local reliability report (markdown). No data leaves the machine."""
2
+ from __future__ import annotations
3
+
4
+ from .core import DimensionResult
5
+
6
+ _ICON = {"pass": "PASS", "warn": "REVIEW", "refuse": "REFUSE", "na": "n/a", "error": "ERROR"}
7
+
8
+ # Each gap maps to the lesson that closes it (the teach-at-the-moment loop). Lessons are real lessons in
9
+ # the "Building Verifiable Software" course (StellarRequiem/classroom · courses/verifiable-software).
10
+ _COURSE = "Building Verifiable Software (StellarRequiem/classroom · courses/verifiable-software)"
11
+ _LESSON = {
12
+ "docs_claims": "l1-claim-vs-proof — state only what your declared truth supports",
13
+ "result_claims": "l3-tested + l4-calibrated — a result-claim needs a test that can fail, a sample size, and calibration",
14
+ "citations": "l1-claim-vs-proof — every cited claim must be supported by the source it cites",
15
+ }
16
+
17
+
18
+ def render_markdown(results: list, scored: dict, root: str, truth_given: bool = False) -> str:
19
+ lvl = scored.get("level")
20
+ lines = ["# Reliability check — " + str(root), ""]
21
+ if lvl is None:
22
+ lines += ["**Reliability level: n/a** — " + scored.get("note", ""), ""]
23
+ else:
24
+ lines += [f"**Reliability level: {lvl} / 5** · "
25
+ f"{scored['passed']} of {scored['applicable']} applicable checks passed"
26
+ f" · worst verdict: {_ICON.get(scored.get('worst'),'?')}", ""]
27
+
28
+ lines += ["## Dimensions", "", "| Check | Verdict | Artifacts | Powered by |", "|---|---|---|---|"]
29
+ for r in results:
30
+ n = len(r.verdicts)
31
+ powered = f"`{r.cli}`" + ("" if r.available else " — not installed")
32
+ lines.append(f"| {r.label} | {_ICON.get(r.status,'?')} | {n if r.available else '—'} | {powered} |")
33
+ lines.append("")
34
+ docs_dim = next((r for r in results if r.key == "docs_claims"), None)
35
+ if docs_dim and docs_dim.applicable and not truth_given:
36
+ lines += ["> Note: the over-claim check ran **without a declared `--truth` file**, so it only compares "
37
+ "against the gate's default ground truth — a `PASS` here is weak. Declare your own "
38
+ "`truth.yaml` to actually check your project's claims.", ""]
39
+
40
+ # named gaps + the lesson that closes each (forward-pointing, never a grade)
41
+ gaps = [(r, v) for r in results for v in r.verdicts if v.status in ("warn", "refuse")]
42
+ if gaps:
43
+ lines += ["## What to look at next (each is an unearned point + its fix)", "",
44
+ f"_Lessons are from the course: {_COURSE}._", ""]
45
+ for r, v in gaps[:40]:
46
+ lines += [f"- **{r.label}** in `{v.artifact}` → {_ICON.get(v.status)} "
47
+ f"({_LESSON.get(r.key,'')})"]
48
+ if v.detail:
49
+ snippet = v.detail.splitlines()[0][:140] if v.detail.splitlines() else ""
50
+ if snippet:
51
+ lines.append(f" - {snippet}")
52
+ lines.append("")
53
+
54
+ lines += [
55
+ "## How the level is computed (inspect it)",
56
+ "Level = round(1 + 4 × passed / applicable), over only the dimensions that *apply* to your project "
57
+ "(a gate that isn't installed, or a check with no matching artifacts, is `n/a` and is never counted — "
58
+ "there is no fake pass). 5/5 = every applicable check is green.",
59
+ "",
60
+ "## What this does NOT check (honest scope)",
61
+ "Shipwright checks the reliability of what your build **claims and ships in text** — doc/output "
62
+ "over-claims, result-claim hygiene, and citation grounding. It does **not** test your code's runtime "
63
+ "behavior, and a 5/5 means *these specific deterministic checks pass*, not 'provably reliable AI'. "
64
+ "It runs only on the path you gave it and sends nothing anywhere.",
65
+ "",
66
+ ]
67
+ return "\n".join(lines)
@@ -0,0 +1,61 @@
1
+ """shipwright.scaffold — `shipwright init` writes a starter truth.yaml + a CI workflow.
2
+
3
+ Never overwrites an existing file unless --force; reports exactly what it wrote.
4
+ """
5
+ from __future__ import annotations
6
+
7
+ from pathlib import Path
8
+
9
+ TRUTH_TEMPLATE = """\
10
+ # truth.yaml — your project's declared ground truth, used by the doc/output over-claim check.
11
+ # Each fact declares what is TRUE. Any claim in your README/docs/output that uses a `forbidden_terms`
12
+ # phrase within a matching `domain_keywords` context is flagged as contradicting your ground truth.
13
+ # Edit these to your project and delete the example. (Without this file the over-claim check is weak.)
14
+ facts:
15
+ - id: capability_honesty
16
+ severity: HIGH
17
+ domain_keywords: ["accuracy", "reliable", "fast", "secure", "tested"]
18
+ canonical_terms: ["measured on a held-out set", "see the benchmark", "as tested"]
19
+ forbidden_terms: ["100% accurate", "never fails", "perfectly reliable", "always correct", "unhackable"]
20
+ """
21
+
22
+ WORKFLOW_TEMPLATE = """\
23
+ name: shipwright reliability check
24
+ on: [pull_request, workflow_dispatch]
25
+ jobs:
26
+ reliability:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.11"
33
+ - name: install shipwright + the verification gates
34
+ # Gates install from the StellarRequiem repos (not PyPI — the generic names are namesakes).
35
+ # The shipwright line works once this tool is published; until then, vendor it however you install it.
36
+ run: |
37
+ pip install git+https://github.com/StellarRequiem/shipwright \\
38
+ git+https://github.com/StellarRequiem/verity-core \\
39
+ git+https://github.com/StellarRequiem/firewall \\
40
+ git+https://github.com/StellarRequiem/grounded
41
+ - name: reliability check (fails the PR on a REFUSE)
42
+ run: shipwright check . --truth truth.yaml
43
+ """
44
+
45
+
46
+ def init_project(root: Path, force: bool = False) -> dict:
47
+ root = Path(root)
48
+ targets = {
49
+ "truth.yaml": root / "truth.yaml",
50
+ ".github/workflows/shipwright.yml": root / ".github" / "workflows" / "shipwright.yml",
51
+ }
52
+ contents = {"truth.yaml": TRUTH_TEMPLATE, ".github/workflows/shipwright.yml": WORKFLOW_TEMPLATE}
53
+ wrote, skipped = [], []
54
+ for label, path in targets.items():
55
+ if path.exists() and not force:
56
+ skipped.append(label)
57
+ continue
58
+ path.parent.mkdir(parents=True, exist_ok=True)
59
+ path.write_text(contents[label], encoding="utf-8")
60
+ wrote.append(label)
61
+ return {"wrote": wrote, "skipped": skipped}
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: shipwright-check
3
+ Version: 0.1.0
4
+ Summary: Pre-ship reliability check for an AI build's claims, docs, and citations — composes verity, firewall, and grounded over your own project (bring-your-own, consent-first). Checks what your AI ships in text, not its runtime behavior.
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Dynamic: license-file
10
+
11
+ # Shipwright
12
+
13
+ **Catch it before your users do.** A pre-ship reliability check for your AI build's **claims, docs, and
14
+ citations** — run it on your own project, privately, before you ship.
15
+
16
+ It composes three deterministic verification gates over the text your build produces and ships:
17
+
18
+ | Check | What it catches | Powered by |
19
+ |---|---|---|
20
+ | Doc/output over-claims | factual claims in your README/output that contradict your declared ground truth | `firewall` |
21
+ | Result-claim hygiene | result-claims (accuracy/win-rate) with no sample size, no holdout, or possible leakage | `verity` |
22
+ | Citation grounding | cited claims whose source doesn't actually support them (fabricated/mismatched citations) | `grounded` |
23
+
24
+ It reports a transparent **1–5 reliability level** and names each unearned point next to the fix.
25
+
26
+ ## Honest scope (what it does and doesn't do)
27
+ Shipwright checks what your build **claims and ships in text**. It does **not** test your code's runtime
28
+ behavior, and a 5/5 means *these specific deterministic checks pass* — not "provably reliable AI." It runs
29
+ **only on the path you give it** and sends nothing anywhere (consent-first). A gate that isn't installed,
30
+ or a check with no matching content, is reported as `n/a` — never a fake pass. MCP/tool *authorization*
31
+ is deliberately **not** a dimension: our `mcp-bench` is a benchmark *of scanners*, not a scanner you point
32
+ at your repo, so claiming an MCP-authz check here would be an over-claim of our own.
33
+
34
+ ## Install
35
+ Shipwright itself has no dependencies. Install it and the three gates (the gates are published from the
36
+ StellarRequiem repos, not under their generic PyPI names):
37
+
38
+ ```sh
39
+ pip install -e . # shipwright (this repo)
40
+ pip install git+https://github.com/StellarRequiem/verity-core \
41
+ git+https://github.com/StellarRequiem/firewall \
42
+ git+https://github.com/StellarRequiem/grounded
43
+ ```
44
+
45
+ ## Use
46
+ ```sh
47
+ shipwright init # scaffold a starter truth.yaml + a CI workflow
48
+ shipwright check . # check the current project
49
+ shipwright check . --truth truth.yaml # declare your ground truth for the over-claim check
50
+ ```
51
+ Writes `shipwright-report.md` and prints the level. Exit code is CI-gateable: `0` pass · `1` review · `2` refuse.
52
+ Each gap is linked to the lesson that closes it, in the *Building Verifiable Software* course.
53
+
54
+ Agents can self-check over MCP: `verity-mcp` (installed with verity-core) is a Model Context Protocol
55
+ server — point your agent at it to gate its own claims.
56
+
57
+ ## Status
58
+ Early (v0.1.0), single author, no users yet — the leading hypothesis is that teams ship LLM apps whose
59
+ *claims* outrun what they can support, and there's no cheap, honest, local way to catch that before users
60
+ do. This is the free, local tier; a hosted progress/badge surface is a later build.
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ shipwright/__init__.py
5
+ shipwright/cli.py
6
+ shipwright/core.py
7
+ shipwright/report.py
8
+ shipwright/scaffold.py
9
+ shipwright_check.egg-info/PKG-INFO
10
+ shipwright_check.egg-info/SOURCES.txt
11
+ shipwright_check.egg-info/dependency_links.txt
12
+ shipwright_check.egg-info/entry_points.txt
13
+ shipwright_check.egg-info/top_level.txt
14
+ tests/test_core.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ shipwright = shipwright.cli:main
@@ -0,0 +1,72 @@
1
+ """Host-safe unit tests for shipwright.core — discovery + the level math. No gates required."""
2
+ import sys
3
+ from pathlib import Path
4
+
5
+ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
6
+ from shipwright.core import DimensionResult, Verdict, discover, score # noqa: E402
7
+
8
+ _p = 0
9
+ _f = 0
10
+
11
+
12
+ def ok(cond, msg):
13
+ global _p, _f
14
+ if cond:
15
+ _p += 1
16
+ else:
17
+ _f += 1
18
+ print(" FAIL:", msg)
19
+
20
+
21
+ def test_discover(tmp: Path):
22
+ (tmp / "README.md").write_text("# Proj\nThis is fast and reliable.\n")
23
+ (tmp / "docs").mkdir()
24
+ (tmp / "docs" / "claims.md").write_text("# Results\n```json\n{\"metric\":\"acc\",\"value\":0.985}\n```\n")
25
+ (tmp / "report.md").write_text("# R\nThe sky is green [1].\n\n[1] https://example.com\n")
26
+ (tmp / ".venv").mkdir()
27
+ (tmp / ".venv" / "junk.md").write_text("```json\n{}\n```\n[1] http://x\n") # must be ignored
28
+ d = discover(tmp)
29
+ ok(any(p.name == "README.md" for p in d["docs_claims"]), "README found as docs_claims")
30
+ ok(any("claims.md" in str(p) for p in d["result_claims"]), "json-claim md found as result_claims")
31
+ ok(any("report.md" in str(p) for p in d["citations"]), "cited md found as citations")
32
+ ok(all(".venv" not in str(p) for v in d.values() for p in v), ".venv excluded from discovery")
33
+
34
+
35
+ def test_score():
36
+ def dim(key, available, statuses):
37
+ r = DimensionResult(key=key, label=key, cli="x", available=available)
38
+ r.verdicts = [Verdict(key, "a", s) for s in statuses]
39
+ return r
40
+ # all 3 applicable, all pass -> 5
41
+ s = score([dim("docs_claims", True, ["pass"]), dim("result_claims", True, ["pass"]), dim("citations", True, ["pass"])])
42
+ ok(s["level"] == 5, f"all-pass -> 5 (got {s.get('level')})")
43
+ # 1 of 2 applicable pass (third gate absent = n/a, not counted) -> round(1+4*0.5)=3
44
+ s = score([dim("docs_claims", True, ["pass"]), dim("result_claims", True, ["refuse"]), dim("citations", False, [])])
45
+ ok(s["applicable"] == 2 and s["level"] == 3, f"1/2 -> level 3 (got {s})")
46
+ ok(s["worst"] == "refuse", "worst verdict surfaced")
47
+ # nothing applicable -> n/a, no fake score
48
+ s = score([dim("docs_claims", False, []), dim("result_claims", True, [])])
49
+ ok(s["level"] is None, "nothing applicable -> n/a")
50
+
51
+
52
+ def test_init(tmp: Path):
53
+ from shipwright.scaffold import init_project
54
+ r1 = init_project(tmp)
55
+ ok("truth.yaml" in r1["wrote"] and ".github/workflows/shipwright.yml" in r1["wrote"], "init writes both files")
56
+ ok((tmp / "truth.yaml").exists() and (tmp / ".github/workflows/shipwright.yml").exists(), "files on disk")
57
+ ok("facts:" in (tmp / "truth.yaml").read_text(), "truth.yaml carries the facts schema")
58
+ r2 = init_project(tmp)
59
+ ok(r2["wrote"] == [] and len(r2["skipped"]) == 2, "init skips existing files without --force")
60
+ r3 = init_project(tmp, force=True)
61
+ ok(len(r3["wrote"]) == 2, "init --force overwrites")
62
+
63
+
64
+ if __name__ == "__main__":
65
+ import tempfile
66
+ with tempfile.TemporaryDirectory() as t:
67
+ test_discover(Path(t))
68
+ with tempfile.TemporaryDirectory() as t:
69
+ test_init(Path(t))
70
+ test_score()
71
+ print(f"--- {_p} passed, {_f} failed ---")
72
+ sys.exit(1 if _f else 0)