wherefore-build 0.5.1__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.
Files changed (67) hide show
  1. wherefore_build-0.5.1/CHANGELOG.md +282 -0
  2. wherefore_build-0.5.1/LICENSE +202 -0
  3. wherefore_build-0.5.1/MANIFEST.in +6 -0
  4. wherefore_build-0.5.1/PKG-INFO +147 -0
  5. wherefore_build-0.5.1/README.md +125 -0
  6. wherefore_build-0.5.1/pyproject.toml +48 -0
  7. wherefore_build-0.5.1/setup.cfg +4 -0
  8. wherefore_build-0.5.1/src/wherefore/__init__.py +10 -0
  9. wherefore_build-0.5.1/src/wherefore/__main__.py +5 -0
  10. wherefore_build-0.5.1/src/wherefore/_observe/sitecustomize.py +294 -0
  11. wherefore_build-0.5.1/src/wherefore/claims.py +134 -0
  12. wherefore_build-0.5.1/src/wherefore/cli.py +227 -0
  13. wherefore_build-0.5.1/src/wherefore/commands.json +57 -0
  14. wherefore_build-0.5.1/src/wherefore/compare.py +285 -0
  15. wherefore_build-0.5.1/src/wherefore/config.py +317 -0
  16. wherefore_build-0.5.1/src/wherefore/features.json +71 -0
  17. wherefore_build-0.5.1/src/wherefore/gate.py +711 -0
  18. wherefore_build-0.5.1/src/wherefore/generators.py +278 -0
  19. wherefore_build-0.5.1/src/wherefore/hook.py +134 -0
  20. wherefore_build-0.5.1/src/wherefore/principles.json +25 -0
  21. wherefore_build-0.5.1/src/wherefore/prove.py +295 -0
  22. wherefore_build-0.5.1/src/wherefore/reach.py +666 -0
  23. wherefore_build-0.5.1/src/wherefore/releases.json +145 -0
  24. wherefore_build-0.5.1/src/wherefore/retired.py +431 -0
  25. wherefore_build-0.5.1/src/wherefore/scan.py +358 -0
  26. wherefore_build-0.5.1/src/wherefore/skill.py +57 -0
  27. wherefore_build-0.5.1/src/wherefore/skills/wherefore/SKILL.md +159 -0
  28. wherefore_build-0.5.1/src/wherefore/skills/wherefore/start.md +220 -0
  29. wherefore_build-0.5.1/src/wherefore/sources.py +36 -0
  30. wherefore_build-0.5.1/src/wherefore/upstream.py +278 -0
  31. wherefore_build-0.5.1/src/wherefore_build.egg-info/PKG-INFO +147 -0
  32. wherefore_build-0.5.1/src/wherefore_build.egg-info/SOURCES.txt +65 -0
  33. wherefore_build-0.5.1/src/wherefore_build.egg-info/dependency_links.txt +1 -0
  34. wherefore_build-0.5.1/src/wherefore_build.egg-info/entry_points.txt +2 -0
  35. wherefore_build-0.5.1/src/wherefore_build.egg-info/requires.txt +7 -0
  36. wherefore_build-0.5.1/src/wherefore_build.egg-info/top_level.txt +1 -0
  37. wherefore_build-0.5.1/tests/_util.py +36 -0
  38. wherefore_build-0.5.1/tests/fixture/.gitignore +1 -0
  39. wherefore_build-0.5.1/tests/fixture/README.md +8 -0
  40. wherefore_build-0.5.1/tests/fixture/deck/one-pager.svg +8 -0
  41. wherefore_build-0.5.1/tests/fixture/deck/speaker-notes.txt +3 -0
  42. wherefore_build-0.5.1/tests/fixture/facts.json +28 -0
  43. wherefore_build-0.5.1/tests/fixture/gen/deck.py +20 -0
  44. wherefore_build-0.5.1/tests/fixture/gen/kit.py +23 -0
  45. wherefore_build-0.5.1/tests/fixture/gen/landing.py +24 -0
  46. wherefore_build-0.5.1/tests/fixture/gen/ledger.py +14 -0
  47. wherefore_build-0.5.1/tests/fixture/gen/notes.py +6 -0
  48. wherefore_build-0.5.1/tests/fixture/ledger.json +3 -0
  49. wherefore_build-0.5.1/tests/fixture/photos/hero.svg +6 -0
  50. wherefore_build-0.5.1/tests/fixture/proofs/origin_proof.py +22 -0
  51. wherefore_build-0.5.1/tests/fixture/site/index.html +11 -0
  52. wherefore_build-0.5.1/tests/fixture/wherefore.json +169 -0
  53. wherefore_build-0.5.1/tests/test_cli.py +53 -0
  54. wherefore_build-0.5.1/tests/test_commands.py +34 -0
  55. wherefore_build-0.5.1/tests/test_compare.py +47 -0
  56. wherefore_build-0.5.1/tests/test_config.py +116 -0
  57. wherefore_build-0.5.1/tests/test_false_passes.py +195 -0
  58. wherefore_build-0.5.1/tests/test_features.py +56 -0
  59. wherefore_build-0.5.1/tests/test_hook.py +105 -0
  60. wherefore_build-0.5.1/tests/test_package_data.py +35 -0
  61. wherefore_build-0.5.1/tests/test_phase5.py +44 -0
  62. wherefore_build-0.5.1/tests/test_prove.py +61 -0
  63. wherefore_build-0.5.1/tests/test_releases.py +104 -0
  64. wherefore_build-0.5.1/tests/test_scan.py +252 -0
  65. wherefore_build-0.5.1/tests/test_skill.py +82 -0
  66. wherefore_build-0.5.1/tests/test_upstream.py +213 -0
  67. wherefore_build-0.5.1/tests/test_version.py +23 -0
@@ -0,0 +1,282 @@
1
+ # Changelog
2
+
3
+ Every release of the engine, newest first. A client pins one commit (its
4
+ `requirements-engine.txt`), and moving that pin is a pull request its own full
5
+ suite judges, so a release reaches no client by itself.
6
+
7
+ The version is stated in `pyproject.toml`, in `wherefore.__version__` and here,
8
+ and `tests/test_version.py` holds the three together until they are one fact.
9
+
10
+ ## 0.5.1 (2026-11-03)
11
+
12
+ **What a pre-publication review found.** The first release meant for PyPI.
13
+ Nothing a corpus declares changes; what changes is how the engine behaves when
14
+ what it reads is not what it expected.
15
+
16
+ - `wherefore check upstream`:
17
+ - a server that closes before the body it promised now "did not answer",
18
+ instead of a traceback - and is never read as a shorter body;
19
+ - `true`, `false` and `null` read from a source and recorded in the corpus are
20
+ compared as the same JSON, so equal values no longer report MOVED;
21
+ - a `json` pointer must be `""` or start with `/` (RFC 6901), and anything
22
+ else is refused in words;
23
+ - it reads at most 10 MB of an answer, and refuses one past that in words;
24
+ - a MOVED line prints at most 80 characters of each value;
25
+ - a recorded-values file that is not JSON is refused naming it.
26
+ - A section included from its own file (`"inventory": "checks/inventory.json"`)
27
+ that is not JSON is refused naming the file, instead of a traceback.
28
+ - `wherefore scan` on a live address:
29
+ - `--max-pages` caps every address fetched, not only the HTML pages, so a page
30
+ linking to hundreds of downloads costs no more than the limit;
31
+ - an answer that is not HTML is not read past its headers;
32
+ - a redirect to another host is refused, and reported as not read.
33
+ - The package: `pip install wherefore-build` (or `uv tool install` / `pipx
34
+ install`) in the README; the licence as an SPDX expression; the project's
35
+ addresses and author; and an sdist that carries its tests' helpers, fixture
36
+ and changelog, so its tests run.
37
+ - The README opens with what Wherefore is for - your company, compiled - and
38
+ the hardware company it was built alongside, and the install section says
39
+ what it needs: Python 3.10 or later, and nothing else.
40
+ - Contributions from outside are welcome: `CONTRIBUTING.md` says how (an issue
41
+ first for anything bigger than a fix; Apache-2.0, section 5; each commit
42
+ signed off under the Developer Certificate of Origin), and
43
+ `CODE_OF_CONDUCT.md` adopts the Contributor Covenant 2.1. CI runs on every
44
+ pull request, a fork's included, and on pushes to `main`; a new `sign-off`
45
+ job checks each commit of a fork's pull request is signed off by its author.
46
+
47
+ ## 0.5.0 (2026-11-03)
48
+
49
+ **Every surface, held to the source.** The skill's `start.md` gains a step for
50
+ after the first fact compiles: ask where else the product is described - the
51
+ site, the docs, the app's strings, a changelog, often each in its own
52
+ repository - which repository decides each fact, and which may read from
53
+ which. Then set every other surface up the same way: it pins the source, reads
54
+ what the source ships as data instead of typing its own list, and fails its
55
+ build on a feature it does not say, with a deliberate omission written down
56
+ like any exemption. `wherefore init` ends by pointing there.
57
+
58
+ **Derived from elsewhere: `wherefore check upstream`.** A captured group can
59
+ say where it was taken from when that is outside the repository - another
60
+ company's published file, counts taken from another product's public site - in
61
+ an `upstream`: the address, what to read there (a JSON pointer, a meta tag, or
62
+ a pattern, optionally base64-decoded), and what must still match - the group's
63
+ one file byte for byte, or a version the corpus records once, in a tracked
64
+ JSON file. `wherefore check upstream` reads each one now, and fails:
65
+
66
+ - **MOVED** when the source says something else: take the copy again, and
67
+ record the new version in the same change - never the number alone;
68
+ - **no longer says** when the source answered without what `read` looks for:
69
+ it changed shape, which is a change too;
70
+ - **did not answer**, unless the upstream gives the reason a source being down
71
+ should not stop this corpus.
72
+
73
+ It is the one command that goes to the network, so it is never part of the
74
+ gate, the build or the pre-push hook: the gate stays offline, and the same
75
+ tree always gives the same answer. Run it where the corpus is compiled for a
76
+ deploy. The skill says what to do when it fails.
77
+
78
+ **One skill, one feature.** "The skill, for Claude Code" and "The skill, for
79
+ Codex" were two features in 0.4.0, for one skill written in two places. They
80
+ are one now - "The skill, for Claude Code and Codex", since 0.2.0 - so a page
81
+ that lists what the engine does says it once. A client with words for `codex`
82
+ is told the release no longer ships it, and drops them.
83
+
84
+ **Every release, said once as data: `releases.json`.** Each release's version,
85
+ date, title, one sentence, and a picture of it working - the command it is
86
+ best shown by and what it printed. It ships in the package, so the company's
87
+ changelog page is built from the release it pins: it lists every release, and
88
+ cannot list one that was never cut. `tests/test_releases.py` holds it to this
89
+ file's headings, every feature to a release that was cut, and the newest
90
+ release to the version `pyproject.toml` states, so a version cannot move
91
+ without its entry. The newest release's picture is run again on every change,
92
+ so it cannot drift from what the engine prints. The pictures of earlier
93
+ releases were made by running each tagged release.
94
+
95
+ ## 0.4.0 (2026-11-03)
96
+
97
+ **The skill reaches Codex.** Codex reads a repository's skills from
98
+ `.agents/skills/<name>/SKILL.md` - the open Agent Skills format, the same one
99
+ Claude Code reads from `.claude/skills/` - so the skill generator now writes
100
+ the one skill the release ships to both places:
101
+
102
+ - `wherefore init` writes `.claude/skills/wherefore/` and
103
+ `.agents/skills/wherefore/`, and says which agent reads which;
104
+ - the `wherefore.skill` generator writes both on every build, and the gate
105
+ holds each copy to the release: an edit by hand to either is named;
106
+ - `start.md` says where both live.
107
+
108
+ **What the engine does, as data: `features.json`.** Each feature, the release
109
+ it arrived in, and its commands - whose words stay in `commands.json` - or its
110
+ own words if it has none. It ships in the package, so a client that describes
111
+ the product (the company's site) reads it from the release it pins and must
112
+ say something about every feature, or its build stops: a release that adds a
113
+ feature fails every page that does not yet tell people about it. Every command
114
+ belongs to exactly one feature, and a test fails a command that belongs to
115
+ none. The README's "What it does" is generated from it.
116
+
117
+ A corpus that already declares the generator writes the Codex copy at its next
118
+ build after moving its pin. That copy is generated, so a rule that claims
119
+ `*.md` as authored needs `.agents/skills/wherefore/*` excepted, as it already
120
+ excepts the Claude Code copy.
121
+
122
+ ## 0.3.0 (2026-11-03)
123
+
124
+ **`wherefore scan`, the first win with no setup.** Point it at what a company
125
+ publishes - a built site, a docs folder, exported notes, or a live site's
126
+ address - and it reports every value stated more than one way:
127
+
128
+ "start your {} day free trial" - said 4 times, 2 ways
129
+ 14 3x site/index.html:2, docs/start.md:3, site/pricing.html:1
130
+ 30 1x help/billing.md:1
131
+
132
+ - It needs no `wherefore.json`: the scan comes before there is a corpus.
133
+ - A statement is a value with real words on both sides, keyed by the words
134
+ around it; a version is keyed by the name in front of it.
135
+ - What it reports is a stale copy - the same statement in more than one file,
136
+ saying at most three things, the commonest at least as often as the rest.
137
+ It leaves alone identifiers (P-005, V83), dates, history ("since 2.1"),
138
+ tables of different things, numbered lists, code, and files that are history
139
+ by name unless `--all` asks for them. It would rather miss a disagreement
140
+ than invent one.
141
+ - Pages are read the way a person reads them: sentences across inline tags,
142
+ a picture's alt text, a page's description; script, style and code are not.
143
+ - A live address is read page by page on its own host, up to `--max-pages`
144
+ (50). `--json` lists every statement and every place.
145
+ - Exit status 1 when copies disagree, so it can stand in CI before a corpus
146
+ does.
147
+ - The skill's `start.md` begins the count with it.
148
+
149
+ Run on `chaotic-pendulums-co`'s docs, pack and brand - 152 files - its one
150
+ report was real: two brand documents give the swing's damping as viscous x60
151
+ and x8.
152
+
153
+ ## 0.2.1 (2026-10-30)
154
+
155
+ What a fresh review found, fixed, and ready to be published. Every fault
156
+ below was reproduced on the fixture company first, and each now has a test
157
+ that plants it (`tests/test_false_passes.py`, `tests/test_hook.py`).
158
+
159
+ **The gate no longer passes when it should fail:**
160
+ - a generator that succeeds on the first pass and throws on the second is a
161
+ failure, not "the corpus settles";
162
+ - a tracked file missing from the working tree is said, not compared with
163
+ nothing - the pre-push hook passed a stale tree that way - and the gate
164
+ leaves it missing, as it found it;
165
+ - `--restamp` takes exactly one group: re-stamping every group at once would
166
+ certify captures nobody re-made;
167
+ - a captured group must say what it was made from (`shot_from`,
168
+ `spec_values`) or why there is nothing (`no_stamp`, with the reason), and
169
+ must name its `files`. A group with neither stamped the hash of nothing and
170
+ passed for ever.
171
+
172
+ **`check retired` and `check claims` read what they missed:**
173
+ - a page whose name is not plain ASCII (`précis.html`) was never read: git
174
+ quoted the name and it matched no file;
175
+ - a retired number is searched for written out in full - a million was
176
+ searched for as `1e+06` - with a thousands comma and trailing zeros allowed,
177
+ so 12.5 finds "$12.50" and 1000000 finds "1,000,000".
178
+
179
+ **The pre-push hook:**
180
+ - when git cannot say what a push changes - the first push of a new
181
+ repository, or a remote tip this clone has not fetched - it rolls the corpus
182
+ rather than assume nothing moved;
183
+ - nothing is skipped unless `hook.skip` says so. Prose was skipped by default,
184
+ which excused a Markdown template a generator reads;
185
+ - it runs with the interpreter the engine is installed in, not whatever
186
+ `python3` is on PATH, which blocked every push from a virtual environment.
187
+
188
+ **Commands:**
189
+ - it runs on Python 3.10 and 3.11, as it says: a backslash inside an
190
+ f-string made `generators.py` a syntax error before 3.12, and CI now tests
191
+ 3.10 to 3.13;
192
+ - `wherefore init` and then `wherefore gate` does what init says - names every
193
+ file nobody has accounted for - instead of refusing a corpus with no source
194
+ yet;
195
+ - `wherefore prove` with a `proofs` glob that matches nothing fails: "0/0
196
+ proofs held" passed;
197
+ - a flag a command does not take is refused, not ignored (`gate --kep` ran
198
+ the whole gate), and `--help` prints the usage and runs nothing;
199
+ - a generator `cwd` that does not exist, a directory that is not a git
200
+ repository, an inventory with no `captured` section, and a capture reading
201
+ `spec_values` from an untracked source each say so, instead of a traceback;
202
+ - `wherefore list` says that what it wrote is left in the working tree.
203
+
204
+ Ready to be published, not published. The owner decided on 2026-10-30 that the
205
+ engine is open source.
206
+
207
+ - **Apache-2.0** (`LICENSE`), and the distribution is renamed
208
+ **`wherefore-build`**: `wherefore` on PyPI is another project's. The import
209
+ name and the command are still `wherefore`. A pin that names a commit after
210
+ this one must say `wherefore-build @ git+...`.
211
+ - **`release.yml` can publish to PyPI** by trusted publishing, with no token
212
+ stored - but only while the repository variable `PUBLISH_TO_PYPI` is `true`,
213
+ which the owner sets when it is time.
214
+ - **`PUBLISHING.md`:** what the public repository leaves out (the pendulum's
215
+ patch series and the design records about its internals), and the steps.
216
+ **`CONTRIBUTING.md`** and **`SECURITY.md`**.
217
+
218
+ ## 0.2.0 (2026-10-30)
219
+
220
+ The skill ships with the engine, and starts a corpus as well as working in one.
221
+
222
+ - **A second half of the skill, `start.md`:** the first session in a
223
+ repository with no corpus yet, for a coding agent. It interviews the owner
224
+ (what the company says in more than one place, where, and which systems
225
+ already own a fact), counts every copy before changing anything, and takes
226
+ one fact end to end - source, generator, reach, the hook and CI - before a
227
+ second asset is touched. `SKILL.md` sends an agent there when there is
228
+ nothing to work in yet.
229
+ - **The skill is in the package** (`src/wherefore/skills/wherefore/`), so each
230
+ release carries the skill that matches its commands, and
231
+ `corpus/commands_named.py` reads both files.
232
+ - **A corpus's copy is generated, not kept.** `wherefore init` now declares one
233
+ generator, `python -m wherefore.skill`, which writes the release's skill into
234
+ `.claude/skills/wherefore/` on every build. The gate holds that copy to the
235
+ pinned release: move the pin and the skill moves with it, or the gate names
236
+ the file that did not.
237
+ - **A generator's `script` may be `-m MODULE`,** run as `python -m` runs it, so
238
+ a corpus can declare a module of an installed package without a copy of it.
239
+
240
+ ## 0.1.1 (2026-10-28)
241
+
242
+ Wherefore on Wherefore: this repository becomes a client of its own engine.
243
+
244
+ - **The commands are said once,** in `src/wherefore/commands.json`:
245
+ - `wherefore --help` prints them from there;
246
+ - the README's list is generated from them (`corpus/readme.py`);
247
+ - `tests/test_commands.py` holds the CLI's own dispatch to them.
248
+
249
+ The three hand-typed lists had already drifted: the README's was missing
250
+ both `hook` commands.
251
+ - **So are the principles,** in `src/wherefore/principles.json`. The README
252
+ states them from there, and so can a client: both files ship in the
253
+ package, so the company's site reads them from the release it pins.
254
+ `tests/test_package_data.py` fails a data file the wheel would leave out.
255
+ - **This repository's own corpus is gated** (`wherefore.json`), by the
256
+ previous release (`requirements-engine.txt`), never by the code being
257
+ edited, the way a compiler builds itself. `corpus/commands_named.py` fails
258
+ any user-facing document that tells a person to type a command the CLI does
259
+ not have.
260
+ - **The version moves whenever the engine does** (`corpus/version_moves.py`,
261
+ #32), and a release is tagged and published from `CHANGELOG.md` by
262
+ `.github/workflows/release.yml`, never by hand.
263
+
264
+ ## 0.1.0 (2026-10-28)
265
+
266
+ The first release: the machinery extracted from chaotic-pendulums-co, moved
267
+ rather than rewritten, with the pendulum as its first client.
268
+
269
+ - **Moved, byte for byte but for recorded edits** (`tools/moved/`): the
270
+ generator runner and the roll, the write observer, the coverage gate, the
271
+ comparators (pictures, numbers, workbook cells, inlined pictures), the proof
272
+ harness, the retired-facts sweep and the source-reach probe.
273
+ - **New:**
274
+ - `wherefore.json`, with includes and a required `why` for every
275
+ exemption;
276
+ - `entry`, for a client that configures the engine in Python;
277
+ - the CLI: `init`, `list`, `build`, `gate`, `prove`, `check retired`,
278
+ `check reach`, `check claims` and `hook install`;
279
+ - two source adapters (`params`, `leaves`);
280
+ - the claim rule.
281
+ - **Proved** against a fictional client, `tests/fixture/`. Each proof breaks it
282
+ one way and requires the right failure, in the right words.
@@ -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 [yyyy] [name of copyright owner]
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.
@@ -0,0 +1,6 @@
1
+ # The sdist carries what its tests need to run: the shared helpers, the
2
+ # fictional company they prove the engine against, and the changelog the
3
+ # version and release tests hold the package to.
4
+ include CHANGELOG.md
5
+ include tests/_util.py
6
+ recursive-include tests/fixture *
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: wherefore-build
3
+ Version: 0.5.1
4
+ Summary: A company that compiles: every asset generated from one source of truth, every change proven.
5
+ Author-email: Wherefore <hello@wherefore.build>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://wherefore.build
8
+ Project-URL: Repository, https://github.com/wherefore-build/wherefore
9
+ Keywords: build,documentation,single source of truth,ci,agents
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Environment :: Console
12
+ Classifier: Topic :: Software Development :: Build Tools
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Provides-Extra: pictures
17
+ Requires-Dist: pillow; extra == "pictures"
18
+ Requires-Dist: numpy; extra == "pictures"
19
+ Provides-Extra: xlsx
20
+ Requires-Dist: openpyxl; extra == "xlsx"
21
+ Dynamic: license-file
22
+
23
+ <!-- Generated by corpus/readme.py from docs/README.template.md, src/wherefore/commands.json, features.json and principles.json. Edit those, not this. -->
24
+ # Wherefore
25
+
26
+ **Your company, compiled.**
27
+
28
+ Code has one source of truth: change it once, and everything built from it
29
+ follows. Everything else a company makes - the website, the docs, the pricing
30
+ page, the app's own words - is a copy of a copy, kept by hand, and it drifts.
31
+
32
+ Wherefore gives everything else what code has. Say each fact once. Generate
33
+ every asset from it. Anything left stale stops the change before it ships. AI
34
+ writes the rules; the build never improvises.
35
+
36
+ ## A hardware company, compiled from one spec file
37
+
38
+ Wherefore was built alongside Chaotic Pendulums, a small hardware company
39
+ started to test the idea on something with more surface area than software. If
40
+ one source can hold machined parts, physics, suppliers and a storefront, it can
41
+ hold your app, website and docs. [How it is built](https://wherefore.build/#case).
42
+
43
+ ## What it does
44
+
45
+ - **Scan** (since 0.3.0): where each stated value appears, and where the copies disagree; needs no setup. `wherefore scan PATH|URL ...`
46
+ - **Start a corpus** (since 0.1.0): write a wherefore.json that declares nothing yet. `wherefore init [DIR]`
47
+ - **The gate** (since 0.1.0): every tracked file classified, every generated one current; puts the tree back unless --keep. `wherefore gate [--keep]`, `wherefore gate --restamp GROUP`
48
+ - **The build** (since 0.1.0): the roll: every generator, twice, compared with what is committed, and the results left in place. `wherefore build`, `wherefore list`
49
+ - **Proofs** (since 0.1.0): run the client's proofs, one at a time, in place. `wherefore prove [SCRIPT ...]`
50
+ - **Retired facts** (since 0.1.0): nothing a person reads still claims a retired value or phrase. `wherefore check retired`
51
+ - **Reach** (since 0.1.0): every fact, moved one at a time, reaches what it should. `wherefore check reach`
52
+ - **Claims** (since 0.1.0): every claim says only what its rule allows. `wherefore check claims`
53
+ - **Derived from elsewhere** (since 0.5.0): every copy taken from elsewhere still matches where it was taken from, read there now. `wherefore check upstream`
54
+ - **The pre-push hook** (since 0.1.0): a pre-push hook: no push leaves the corpus stale. `wherefore hook install`, `wherefore hook pre-push`
55
+ - **The skill, for Claude Code and Codex** (since 0.2.0): teaches your coding agent the rules, and starts a corpus with you: one fact, end to end. One skill, written where each agent reads it, and held to the release
56
+
57
+ ## The principles it enforces
58
+
59
+ 1. **A fact exists in exactly one place.** Everything else is generated from it or checked against it.
60
+ 2. **The build is deterministic.** Nothing in the build path calls a model.
61
+ 3. **Fail loudly.** A change the build cannot handle stops it; nothing improvises.
62
+ 4. **A check is not trusted until it has been shown to fail.**
63
+ 5. **Sources versus outputs.** Every tracked file is *generated*, *authored* or *captured*. Generated files are never hand-edited, and a capture is stamped with what it was made from.
64
+
65
+ ## Install
66
+
67
+ ```
68
+ pip install wherefore-build # Python 3.10+, standard library only
69
+ uv tool install wherefore-build # or, as a command of its own
70
+ pipx install wherefore-build # the same, with pipx
71
+ pip install 'wherefore-build[pictures,xlsx]' # for picture and workbook comparison
72
+ ```
73
+
74
+ It needs Python 3.10 or later and nothing else. Your project can be in any
75
+ language: Wherefore reads and checks files, whatever made them. With no Python
76
+ on the machine, `uv tool install` fetches one. Generators are Python scripts
77
+ today, and one can call anything - a CAD export, a Node build, a shell command.
78
+
79
+ The distribution is `wherefore-build`, because `wherefore` on PyPI is another
80
+ project's. What you import and what you type are `wherefore`.
81
+
82
+ ## Use
83
+
84
+ ```
85
+ pip install -e . # from a checkout of this repository
86
+ pip install -e '.[pictures,xlsx]' # with picture and workbook comparison
87
+
88
+ wherefore scan PATH|URL ... # where each stated value appears, and where the copies disagree; needs no setup
89
+ wherefore init [DIR] # write a wherefore.json that declares nothing yet
90
+ wherefore gate [--keep] # every tracked file classified, every generated one current; puts the tree back unless --keep
91
+ wherefore gate --restamp GROUP # record a re-made capture against its sources
92
+ wherefore build # the roll: every generator, twice, compared with what is committed, and the results left in place
93
+ wherefore list # run every generator once and say what each wrote
94
+ wherefore prove [SCRIPT ...] # run the client's proofs, one at a time, in place
95
+ wherefore check retired # nothing a person reads still claims a retired value or phrase
96
+ wherefore check reach # every fact, moved one at a time, reaches what it should
97
+ wherefore check claims # every claim says only what its rule allows
98
+ wherefore check upstream # every copy taken from elsewhere still matches where it was taken from, read there now
99
+ wherefore hook install # a pre-push hook: no push leaves the corpus stale
100
+ wherefore hook pre-push # what the installed hook runs before a push; not for typing
101
+ ```
102
+
103
+ **Start with a scan.** `wherefore scan` needs no setup and no `wherefore.json`:
104
+ point it at a built site, a docs folder or a live address, and it reports every
105
+ value the company states more than one way - "start your {} day free trial", 14
106
+ in three places and 30 in one. Each is a fact to say once, in a source, and
107
+ build every copy from; the rest of Wherefore is how.
108
+
109
+ A client describes its corpus in `wherefore.json`: its sources, its generators
110
+ in order, its inventory of authored and captured files, and every exception to
111
+ byte-identity. Every exemption carries a `why`, and the engine refuses an entry
112
+ that has none. `tests/fixture/` is a complete, fictional example.
113
+
114
+ A client that configures the engine in Python instead, in the scripts its
115
+ proofs plant faults into, names those scripts in `entry`, and each command runs
116
+ the client's own script exactly as its CI does. The engine refuses a command
117
+ that is handed over and configured in `wherefore.json` as well, because that is
118
+ one fact in two places. Chaotic Pendulums is that kind of client.
119
+
120
+ ## This repository
121
+
122
+ | path | what |
123
+ |---|---|
124
+ | `src/wherefore/` | the engine |
125
+ | `tests/fixture/` | Fernhollow Kettles, a fictional company the engine proves itself against |
126
+ | `proofs/` | the engine's proofs: each breaks the fixture one way and requires the right failure, in the right words |
127
+ | `tests/` | unit tests, and `test_phase5.py`: the fixture compiled from its sources alone |
128
+ | `tools/moved/` | the exact edits that turned each pendulum original into an engine module; `verify.py` re-runs them |
129
+ | `src/wherefore/skills/wherefore/` | the skill, shipped in the package: how a coding agent works in a corpus (`SKILL.md`) and starts one (`start.md`). A corpus's own copies are generated from the release it pins, by the `wherefore.skill` generator `wherefore init` declares: `.claude/skills/wherefore/` for Claude Code and `.agents/skills/wherefore/` for Codex, the same files in the open Agent Skills format |
130
+ | `CHANGELOG.md` | every release, newest first; a client upgrades only by moving its pin |
131
+ | `src/wherefore/releases.json` | every release again, as data - version, date, a title, a sentence and a picture of it working - for the company's changelog page; `tests/test_releases.py` holds it to `CHANGELOG.md` and runs the newest picture again |
132
+ | `corpus/`, `wherefore.json` | this repository as a client of its own engine: the README's generator, the corpus's checks and their proofs |
133
+ | `docs/README.template.md` | the README's text; the README is generated from it, `src/wherefore/commands.json` and `src/wherefore/principles.json` |
134
+ | `requirements-engine.txt` | the previous release, which judges this repository's own corpus |
135
+ | `LICENSE` | Apache-2.0 |
136
+ | `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md` | how to work on the engine and contribute to it, how everyone taking part behaves, and how to report a vulnerability |
137
+ | `PUBLISHING.md` | how a release reaches PyPI, and what this repository's history leaves out |
138
+
139
+ ```
140
+ python3 -m unittest discover tests
141
+ for p in proofs/*_proof.py; do python3 "$p" || exit 1; done
142
+ ```
143
+
144
+ ## Licence
145
+
146
+ Apache-2.0 (`LICENSE`). The package is published as `wherefore-build`; what you
147
+ import and what you type are `wherefore`.