@geonosis/ledger 1.0.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.
- package/LICENSE +202 -0
- package/README.md +387 -0
- package/bin/geonosis-ledger.mjs +4 -0
- package/dist/chunk-WI3N5B3J.js +1538 -0
- package/dist/index.d.ts +469 -0
- package/dist/index.js +110 -0
- package/dist/ledger-cli.js +339 -0
- package/package.json +43 -0
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 [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.
|
package/README.md
ADDED
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# @geonosis/ledger
|
|
2
|
+
|
|
3
|
+
The tick ledger. It **validates, refuses, and appends one row**. It authors nothing else.
|
|
4
|
+
|
|
5
|
+
That restraint is the point. The kit survey found Spec Kit writing 2,100 lines of specification for
|
|
6
|
+
600 lines of TypeScript, and this repo's own plans 002–016 were written and never used; the plans
|
|
7
|
+
that shipped were written the day the work happened. So `plan new` writes a skeleton whose one
|
|
8
|
+
criterion is a placeholder that `plan check` **refuses** until a person replaces it, and no command
|
|
9
|
+
here generates a document.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm i -D @geonosis/ledger
|
|
13
|
+
npx geonosis-ledger plan check
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Exit codes are the same everywhere: **0** passed · **1** a refusal, with its reason on stdout ·
|
|
17
|
+
**2** the run could not be made at all (bad config, unknown flag), with the reason on stderr.
|
|
18
|
+
|
|
19
|
+
## `plan check [<file>|<dir>] [--since <NNN>]`
|
|
20
|
+
|
|
21
|
+
A plan needs three things, and every violation is printed as `<file>: <what is missing>`:
|
|
22
|
+
|
|
23
|
+
| Refusal | What it means |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `no status header` | nothing in the file matches `plan.statusHeader` |
|
|
26
|
+
| `no "Acceptance criteria" heading` | no heading matches `plan.criteriaHeading` |
|
|
27
|
+
| `no EARS criterion under "Acceptance criteria"` | the heading is there and nothing under it — **under it**, bounded by the next heading of the same depth — matches `plan.criteria` |
|
|
28
|
+
| `no "Verification" heading` | no heading matches `plan.verificationHeading` |
|
|
29
|
+
|
|
30
|
+
`--since <NNN>` exempts every lower-numbered plan: they print as `<file>: legacy` and hold nothing
|
|
31
|
+
up. A gate that refuses the whole back catalogue on the day it is installed is a gate that gets
|
|
32
|
+
uninstalled.
|
|
33
|
+
|
|
34
|
+
Only `NNN-slug.md` files are read. A `README.md` in the plans directory is not a plan.
|
|
35
|
+
|
|
36
|
+
## `plan new <slug>`
|
|
37
|
+
|
|
38
|
+
Writes `<plans>/<next NNN>-<slug>.md` — twelve lines: the title, the status header, the two
|
|
39
|
+
headings, and two HTML comments. The number is one past the **highest** on disk, never the count,
|
|
40
|
+
because counting reuses a number after a delete. It refuses a slug that is not kebab-case, and a
|
|
41
|
+
slug some existing plan already carries (naming that file).
|
|
42
|
+
|
|
43
|
+
## `tick --plan <NNN> --commit <hash> --proof <path> [--note "…"]`
|
|
44
|
+
|
|
45
|
+
The gate. Four refusals, checked in this order, each exit 1 with its reason on stdout:
|
|
46
|
+
|
|
47
|
+
| Refusal | Why it exists |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `<ref> is not a commit` | a ledger row that names a hash nobody can resolve is a claim |
|
|
50
|
+
| `plan <NNN> does not pass plan check: …` (every violation listed) | a tick against a plan with no criteria has nothing to have satisfied |
|
|
51
|
+
| `no plan <NNN> in <plans>` | the row would point at nothing |
|
|
52
|
+
| `<path> does not exist` | musa's rule and dielime's G3: the proof is the evidence, not the summary |
|
|
53
|
+
| `<hash> ships no runtime code (G0). Its diff: …` | **dielime's G0, returned** (D-025): "a tick MUST deliver real runtime code". Docs, tests and ledger updates may **ride along**; they may never stand alone. The whole diff is printed so the refusal is checkable |
|
|
54
|
+
|
|
55
|
+
On success it appends **one** row to `ledger.progress` — `| tick | date | plan | commit | proof |
|
|
56
|
+
note |` — creating the file with its header when absent. **That append is the only write it makes,
|
|
57
|
+
and a refused tick makes none at all.** The tick number is one past the highest already in the
|
|
58
|
+
table, never the row count, because counting reuses a number after a delete.
|
|
59
|
+
|
|
60
|
+
G0 reads `git diff --name-only <hash>~1 <hash>`, which is dielime's own spelling. A root commit has
|
|
61
|
+
no `~1`, so that one case diffs the tree against the empty tree instead — otherwise a repo's first
|
|
62
|
+
commit could never be ticked. This is the only place the kit runs git, and only where it was
|
|
63
|
+
pointed.
|
|
64
|
+
|
|
65
|
+
## `proof capture <slug> --command "<cmd>" [--url <url>]`
|
|
66
|
+
|
|
67
|
+
Runs the command in the repo root and writes `<proofs>/<next NNN>-<slug>.md`: the HEAD hash and
|
|
68
|
+
subject, the command, the URL if given, the exit code, and the combined stdout/stderr bounded to
|
|
69
|
+
`ledger.maxLines` (default 200) with `… N more lines` stating what was dropped.
|
|
70
|
+
|
|
71
|
+
**The process exits with the command's own exit code.** A failing proof is recorded *and* still
|
|
72
|
+
fails; a capture that swallowed the red would be a gate reporting green over a run it had just
|
|
73
|
+
watched break.
|
|
74
|
+
|
|
75
|
+
## `journal --kind stub|mock|guess|skip --where <path:line> --why "…"`
|
|
76
|
+
|
|
77
|
+
Appends a dated row to `ledger.journal`. The four kinds are the four ways a delivery is not the
|
|
78
|
+
thing it claims to be, and no kit in the 2026 survey asked an agent to record where it stubbed —
|
|
79
|
+
which is why a stub reads as done in every report after it. An unknown kind is refused (exit 2), as
|
|
80
|
+
is a `--where` without a line number and an empty `--why`. Pipes inside a `why` are escaped, so
|
|
81
|
+
prose cannot break the table.
|
|
82
|
+
|
|
83
|
+
## `decide --id D-NNN --text "…" --why "…" --evidence "…" --revisit "…" [--status "…"]`
|
|
84
|
+
|
|
85
|
+
Appends one row to `ledger.decisions`. Values go under the column that **names** them, not under a
|
|
86
|
+
fixed position — during.day's register has no `Status` column and this repo's had no
|
|
87
|
+
`Revisit trigger`, and both are legitimate. A column the flags do not fill gets `—`.
|
|
88
|
+
|
|
89
|
+
| Refusal | Why |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `a decision needs a revisit trigger …` | **C10.** A register whose entries carry no event that would reopen them is a diary. `PROPOSED` with no stated trigger is a decision nobody ever has to make |
|
|
92
|
+
| `<file> has no "Revisit trigger" column (C10). Its header has to become: <the exact line>` | the tool **prints** the header the register needs and **never writes it**. A tool that rewrites the shape it validates has become the source of truth for that shape |
|
|
93
|
+
| `<file> already carries D-NNN` | ids are unique or the register cannot be cited |
|
|
94
|
+
| `"<id>" is not an id of the form D-NNN` · `<file> does not exist` · `<file> has no table in it` | |
|
|
95
|
+
|
|
96
|
+
A blank line inside a long register splits the table for a markdown renderer, but the rows after it
|
|
97
|
+
are still the register. `decide` steps over the gap, so a new row lands after the **last** row rather
|
|
98
|
+
than in the hole. (This repo's own register had exactly that gap, at D-039/D-040.)
|
|
99
|
+
|
|
100
|
+
## `handoff [--dry-run]`
|
|
101
|
+
|
|
102
|
+
Rewrites the `## SESSION CLOSE` block of `ledger.handoff`, between
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
<!-- geonosis-ledger:session-close --> … <!-- /geonosis-ledger:session-close -->
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
creating the marked block at the end of the file when the markers are absent, and **leaving
|
|
109
|
+
everything outside them exactly as it was**. The block holds HEAD, uncommitted files, the last tick
|
|
110
|
+
row, the last gate report (`.geonosis/gate-report.json`: tier, ok, finishedAt), and every plan whose
|
|
111
|
+
status is not `DONE`/`SHIPPED`/`CLOSED`/`ABANDONED`.
|
|
112
|
+
|
|
113
|
+
It is a **pure function of the tree** — no clock, no run id. Two runs over one tree are byte-identical,
|
|
114
|
+
which is a test. The handoff file is excluded from its own uncommitted list: writing the block
|
|
115
|
+
dirties the file, and without that exclusion the second run reports the first run's write.
|
|
116
|
+
|
|
117
|
+
`--dry-run` prints the block and writes nothing.
|
|
118
|
+
|
|
119
|
+
## `status [--json]`
|
|
120
|
+
|
|
121
|
+
The digest: **six lines, always the same six**, whatever the size of the repo behind them — a
|
|
122
|
+
hundred plans and a hundred ticks print six lines. A digest is a perception surface, and an
|
|
123
|
+
unbounded one is the context window it exists to protect. A contract test pins the exact shape.
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
HEAD feat(ledger): tick, proof capture and journal
|
|
127
|
+
plans ACTIVE 2 · DONE 1
|
|
128
|
+
last tick | 1 | 2026-08-30 | 002 | abc12345 | proofs/001-a.md | — |
|
|
129
|
+
gate full — FAILED at 2026-08-30T10:55:00.000Z
|
|
130
|
+
baseline 6 counter(s)
|
|
131
|
+
journal 0 fallback(s)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Nothing here re-runs or re-judges a gate; it reports what the gate report and the baseline already
|
|
135
|
+
say. A line whose fact is missing says so (`no tick yet`, `no gate report`) rather than disappearing,
|
|
136
|
+
so the shape never moves. The baseline is located from `geonosis.json`'s `ratchet.baseline`, then
|
|
137
|
+
`geonosis.ratchet.json`, then `gate-baseline.json`, and read **as JSON** — the ledger never imports
|
|
138
|
+
the ratchet, so it is never one call from rewriting the number it reports.
|
|
139
|
+
|
|
140
|
+
## The delivery gates — `commit-msg` and `delivery check`
|
|
141
|
+
|
|
142
|
+
Two ways a delivery can be nothing while looking like something: the narration outgrows the work,
|
|
143
|
+
and the diff is all comments. Both refuse with exit 1, and **`tick` runs both** on the commit it is
|
|
144
|
+
given.
|
|
145
|
+
|
|
146
|
+
### `commit-msg <file> | --message "<text>" | --commit <hash>`
|
|
147
|
+
|
|
148
|
+
Refuses a message longer than `ledger.commitMessageLines` — **default 4: a subject and three body
|
|
149
|
+
lines**. A message that needs a fifth is a delivery that should have been two commits, or a paragraph
|
|
150
|
+
that belongs in a proof file.
|
|
151
|
+
|
|
152
|
+
What is **not** counted, and why:
|
|
153
|
+
|
|
154
|
+
| Not counted | Why |
|
|
155
|
+
|---|---|
|
|
156
|
+
| blank lines | they are the format, not the message |
|
|
157
|
+
| lines beginning `#` | a `commit-msg` hook is handed the raw editor file, git's whole `# Please enter…` template included |
|
|
158
|
+
| everything past `# --- >8 ---` | `commit -v` puts the entire diff below the scissors |
|
|
159
|
+
| a **trailing block** of `Token: value` trailers | `Co-authored-by:`, `Signed-off-by:`, `Refs:` are metadata git appends; counting them would ration the body by how much tooling a repo runs |
|
|
160
|
+
|
|
161
|
+
The trailing block is git's own definition, so a `Note: …` in the *middle* of a body is counted. The
|
|
162
|
+
**subject is never stripped**, even though `feat: a thing` is character-for-character a trailer —
|
|
163
|
+
that bug read every one-line message as empty, and it has a test.
|
|
164
|
+
|
|
165
|
+
Usable directly as a hook:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# .husky/commit-msg or lefthook commit-msg
|
|
169
|
+
npx geonosis-ledger commit-msg "$1"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### `delivery check --cached | --commit <hash>`
|
|
173
|
+
|
|
174
|
+
Refuses a diff whose **every** changed line is a comment or whitespace. Comment tokens are per
|
|
175
|
+
language, chosen by extension — `#` opens a comment in a shell script and a heading in markdown, so
|
|
176
|
+
the token alone cannot decide:
|
|
177
|
+
|
|
178
|
+
| Extensions | Comment tokens |
|
|
179
|
+
|---|---|
|
|
180
|
+
| `ts tsx js jsx mjs cjs mts cts go rs java kt swift c cc cpp h scss less` | `//` `/*` `*/` `*` `{/*` `*/}` |
|
|
181
|
+
| `css` | `/*` `*/` `*` |
|
|
182
|
+
| `sh bash zsh py rb toml ini cfg conf env properties mk gitignore`, `Dockerfile`, `Makefile` | `#` |
|
|
183
|
+
| `yml yaml` | `#` |
|
|
184
|
+
| `md mdx html xml svg vue svelte astro` | `<!--` `-->` |
|
|
185
|
+
| `sql` | `--` `/*` `*/` `*` |
|
|
186
|
+
|
|
187
|
+
A blank changed line counts as commentary too, so a whitespace-only change is refused. A file whose
|
|
188
|
+
language is not in the table has its changed lines treated as **code** — the safe direction for a
|
|
189
|
+
gate that refuses.
|
|
190
|
+
|
|
191
|
+
**Deleting comments counts as a comments-only delivery.** A comment sweep is real work, and it rides
|
|
192
|
+
along with runtime code exactly the way G0 lets docs ride along; it does not stand alone.
|
|
193
|
+
|
|
194
|
+
### `--prove`
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
PROVEN commit-msg: refuses a 40-line commit message
|
|
198
|
+
PROVEN delivery check: refuses a diff whose every changed line is a comment
|
|
199
|
+
|
|
200
|
+
prove PASS — every delivery gate refused the thing it forbids.
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
It plants both forbidden shapes for real — the comments-only diff into a throwaway git repo it
|
|
204
|
+
initialises and deletes — and requires both to be refused. A probe that comes back clean prints
|
|
205
|
+
`CANNOT FAIL` and exits **2**, the same status as a measurement that could not be made: a gate that
|
|
206
|
+
has never been shown refusing is a claim, not a gate.
|
|
207
|
+
|
|
208
|
+
## `architecture check [--no-workspace]` and `sync` — one table, three spellings (C8)
|
|
209
|
+
|
|
210
|
+
An allowed-edges table is typically written **three times** in a monorepo's tooling: turbo's
|
|
211
|
+
`boundaries.tags`, per-package `no-restricted-imports`, and `layer-walls`. Three spellings of one
|
|
212
|
+
fact is an SSOT violation inside the enforcement itself. So the table is the source and the three
|
|
213
|
+
configs are generated from it.
|
|
214
|
+
|
|
215
|
+
`ledger.architecture` must contain a table whose header is `| tag | packages | may depend on |`
|
|
216
|
+
(whitespace- and emphasis-insensitive):
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
| tag | packages | may depend on |
|
|
220
|
+
| ------------- | --------------- | ------------------------------- |
|
|
221
|
+
| `domain` | domains, utils | — |
|
|
222
|
+
| `storage` | db | domain |
|
|
223
|
+
| `sdk` | client | host-worker (TYPE only), domain |
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
`architecture check` exits 1 listing: a `packages` cell that names no workspace directory (matched
|
|
227
|
+
against the directory, its basename, or the package name — repos write all three), a `may depend on`
|
|
228
|
+
entry that is not a declared tag, and a tag declared twice. `--no-workspace` skips the first of those.
|
|
229
|
+
|
|
230
|
+
A parenthetical like `(TYPE only)` is a **note**, not a violation: the tag is taken and the
|
|
231
|
+
annotation reported, because none of the three generated spellings can express "type-only" and a
|
|
232
|
+
fact the tooling silently discards is a fact the tooling has decided is untrue.
|
|
233
|
+
|
|
234
|
+
### `sync --target turbo|layer-walls|restricted-imports [--write <file>] [--check <file>] [--package <name>]`
|
|
235
|
+
|
|
236
|
+
| Target | Generated | Written into |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| `turbo` | `{ tags: { <tag>: { dependencies: { allow: [...] } } } }` | the `boundaries` key |
|
|
239
|
+
| `layer-walls` | `[{ name: <tag>, paths: ['^<pkgname>', '<dir>/'], mayImport: [...] }]` | the `layers` of the `biological-architecture/layer-walls` rule |
|
|
240
|
+
| `restricted-imports` | per package, every package its tag may **not** depend on | the `paths` of that package's `no-restricted-imports` rule |
|
|
241
|
+
|
|
242
|
+
`restricted-imports` is per package, so `--write packages/db/.oxlintrc.json` infers the package from
|
|
243
|
+
the file's directory; `--package` overrides it.
|
|
244
|
+
|
|
245
|
+
**Nothing is inferred.** If a tag may depend on `storage` and `storage` may depend on `domain`, that
|
|
246
|
+
does *not* make `domain` reachable — the table is spelled in full or it does not say what it says. A
|
|
247
|
+
computed transitive closure would silently widen an edge no author wrote.
|
|
248
|
+
|
|
249
|
+
`--write` **splices only the named fragment.** `JSON.parse` → `JSON.stringify` would reformat the
|
|
250
|
+
whole file, which turns a one-key sync into an unreviewable diff and a fight with the repo's
|
|
251
|
+
formatter. The value's byte span is located by scanning and replaced in place, so `$schema`, `tasks`,
|
|
252
|
+
and every other rule come out identical. `--check` exits 1 and prints what is committed beside what
|
|
253
|
+
is generated.
|
|
254
|
+
|
|
255
|
+
A key that is **not there yet is created** — a `turbo.json` with no `boundaries`, a config that has
|
|
256
|
+
never named `layer-walls`, a package whose `no-restricted-imports` has not been written. Still only
|
|
257
|
+
that fragment: everything already in the file stays where it was, and a rule is created as
|
|
258
|
+
`["error", { … }]`, the severity being the one thing a generator cannot read off the table. A repo
|
|
259
|
+
adopting this starts from its own config, not from a shape hand-copied out of these docs.
|
|
260
|
+
|
|
261
|
+
The adoption evidence is in [`proofs/022-W4-during-day-sync/`](../../proofs/022-W4-during-day-sync/):
|
|
262
|
+
run read-only over a copy of during.day, `architecture check` found a `may depend on` cell naming a
|
|
263
|
+
package instead of a tag, and `sync --target turbo --check` showed a config with five tags against a
|
|
264
|
+
document with seven — sharing one name, `sdk`, which means different things on the two sides.
|
|
265
|
+
|
|
266
|
+
### `sync --target agents-md|cursor [--write <path>] [--check <path>]` — the law, in the other tools' vocabularies
|
|
267
|
+
|
|
268
|
+
Skills and `AGENTS.md` port between agents; hooks, subagent definitions and plan pipelines do not.
|
|
269
|
+
These two targets take the half that ports and stop it going stale by hand.
|
|
270
|
+
|
|
271
|
+
`agents-md` writes the file every agent on the standard reads and Claude Code does not: **the law's
|
|
272
|
+
rules section** (the section matching `ledger.lawSection`, not the whole file — a copy of the law is
|
|
273
|
+
a second law), **one line per skill** taken from that skill's own frontmatter, and **one row per
|
|
274
|
+
glob-scoped rule** saying which files it binds to. Claude Code reads it through the `@AGENTS.md`
|
|
275
|
+
import at the top of `CLAUDE.md`, so the two cannot disagree.
|
|
276
|
+
|
|
277
|
+
`cursor` writes one `.cursor/rules/geonosis-<area>.mdc` per `.claude/rules/<area>.md`, translating
|
|
278
|
+
the frontmatter: Cursor's `globs` is ONE comma-separated string rather than a YAML list, and a rule
|
|
279
|
+
scoped to `**` becomes `alwaysApply: true` with no `globs` line at all — Cursor ignores `globs` when
|
|
280
|
+
`alwaysApply` is set, and a line that does nothing beside a line that does is how a config starts
|
|
281
|
+
lying.
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
geonosis-ledger sync --target agents-md --write AGENTS.md
|
|
285
|
+
geonosis-ledger sync --target cursor --write .cursor/rules
|
|
286
|
+
geonosis-ledger sync --target agents-md --check AGENTS.md # exit 1 on drift
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
`--write` names the FILE for `agents-md` and the DIRECTORY for `cursor`. `--check` compares byte for
|
|
290
|
+
byte and names what differs — including a generated file that **is not there at all**, which is the
|
|
291
|
+
drift nobody notices: a rule added upstream and never translated reads exactly like one that was.
|
|
292
|
+
|
|
293
|
+
Neither target reads the architecture table. They are about the law and the rule files, and
|
|
294
|
+
demanding an edges table before generating an `AGENTS.md` would be a coupling nobody asked for.
|
|
295
|
+
|
|
296
|
+
This repo runs both on itself, checked in `tooling/cross-tool-sync.test.ts`: a generator with a
|
|
297
|
+
round-trip test and no repo behind it proves the function, not the files.
|
|
298
|
+
|
|
299
|
+
## Configuration — the `ledger` block of `geonosis.json`
|
|
300
|
+
|
|
301
|
+
Every key is optional and every default is a **contract**, not a consumer's layout.
|
|
302
|
+
|
|
303
|
+
```jsonc
|
|
304
|
+
{
|
|
305
|
+
"ledger": {
|
|
306
|
+
"plans": "plans", // directory
|
|
307
|
+
"progress": "plans/PROGRESS.md", // the one file a tick appends to
|
|
308
|
+
"proofs": "proofs", // directory
|
|
309
|
+
"decisions": "docs/decisions.md",
|
|
310
|
+
"journal": "docs/journal/fallbacks.md",
|
|
311
|
+
"handoff": "HANDOFF.md",
|
|
312
|
+
"architecture": "docs/architecture.md",
|
|
313
|
+
"law": "CLAUDE.md", // what lawLineCount counts and sync projects
|
|
314
|
+
"lawSection": "^#{2,3} +The laws\\b", // the section of it AGENTS.md carries
|
|
315
|
+
"agents": "AGENTS.md", // where sync --target agents-md writes
|
|
316
|
+
"skills": ".claude/skills", // read for the one-line summaries
|
|
317
|
+
"rules": ".claude/rules", // the glob-scoped rules cursor translates
|
|
318
|
+
"maxLines": 200, // captured proof output, bounded
|
|
319
|
+
"commitMessageLines": 4, // subject + 3
|
|
320
|
+
"plan": {
|
|
321
|
+
"statusHeader": "^> \\*\\*Status\\*\\*: *\\S+",
|
|
322
|
+
"criteriaHeading": "^#{2,3} +Acceptance criteria *$",
|
|
323
|
+
"criteria": "^- When .+ shall .+",
|
|
324
|
+
"verificationHeading": "^#{2,3} +Verification\\b"
|
|
325
|
+
},
|
|
326
|
+
"runtime": { "include": ["…"], "exclude": ["…"] }
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
An unknown key is an **error**, not a shrug: a typo in a gate's config is silence.
|
|
332
|
+
|
|
333
|
+
### The plan patterns are regexes because a heading name is a repo's vocabulary
|
|
334
|
+
|
|
335
|
+
during.day writes `## Done criteria` and `## Test plan` and ticks a checkbox; this repo writes
|
|
336
|
+
`## Acceptance criteria` and an EARS sentence. Neither is the contract — *declaring* criteria and
|
|
337
|
+
*declaring* how they are verified is. A repo with its own words sets four regexes:
|
|
338
|
+
|
|
339
|
+
```jsonc
|
|
340
|
+
"plan": {
|
|
341
|
+
"statusHeader": "^#{2,3} +Status *$",
|
|
342
|
+
"criteriaHeading": "^#{2,3} +Done criteria *$",
|
|
343
|
+
"criteria": "^- \\[[ x]\\] .+",
|
|
344
|
+
"verificationHeading": "^#{2,3} +Test plan\\b"
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### `runtime` — G0, generalised
|
|
349
|
+
|
|
350
|
+
dielime's G0 gate ("a tick MUST deliver real runtime code") greps a staged diff for
|
|
351
|
+
`(apps|packages)/.+/src/`. That anchor is true of dielime and of nothing else: during.day keeps
|
|
352
|
+
1,727 of its 2,295 source files outside any `src/` directory, so it would refuse every tick that
|
|
353
|
+
repo has ever made. What travels is the **kind** of file, so the default is:
|
|
354
|
+
|
|
355
|
+
```jsonc
|
|
356
|
+
"runtime": {
|
|
357
|
+
"include": ["\\.(?:ts|tsx|js|jsx|mjs|cjs|mts|cts|css|scss|sass|less|svg|vue|svelte|astro)$"],
|
|
358
|
+
"exclude": [
|
|
359
|
+
"\\.(?:test|spec)\\.",
|
|
360
|
+
"\\.stories\\.",
|
|
361
|
+
"\\.d\\.ts$",
|
|
362
|
+
"(?:^|/)(?:__tests__|__mocks__|__fixtures__|__snapshots__|__perf__)/",
|
|
363
|
+
"(?:^|/)(?:docs?|tests?|e2e)/",
|
|
364
|
+
"(?:^|/)\\.[^/]+/"
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
The last exclusion is every dot-directory at once — `.dielime/`, `.github/`, `.claude/` — without
|
|
370
|
+
naming any repo.
|
|
371
|
+
|
|
372
|
+
On top of these, `tick` excludes **the ledger's own artefacts**: everything under `ledger.plans`,
|
|
373
|
+
`progress`, `proofs`, `journal`, `decisions`, `handoff` and `architecture`. dielime's G0 excluded
|
|
374
|
+
`^\.dielime/`, the directory its ledger lived in; that literal cannot ship, but the fact can, because
|
|
375
|
+
every one of those files is already a key of this config and so the exclusion follows a repo wherever
|
|
376
|
+
it keeps them. (Found by running G0 over this repo's history: a `test:` commit whose whole diff was
|
|
377
|
+
three files under `proofs/` passed, on a `.ts` proof harness.)
|
|
378
|
+
|
|
379
|
+
A repo that wants dielime's exact strictness keeps its own anchor:
|
|
380
|
+
|
|
381
|
+
```jsonc
|
|
382
|
+
"runtime": { "include": ["(apps|packages)/.+/src/.+\\.(ts|tsx|js|jsx|css|svg)$"] }
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Licence
|
|
386
|
+
|
|
387
|
+
Apache-2.0.
|