Commit 4386681
committed
Add EXAMPLES.md; simplify hash --style bare; docs refresh
EXAMPLES.md (new, ~800 lines): hands-on tour of every sub-command with
copy-pastable examples, pipeline recipes, and scripting patterns.
Structured so first-time readers are pointed at 'auth' as a
prerequisite for API-touching commands, then 'config' for settings
resolution, then the create → download → verify lifecycle, then each
sub-command in turn.
Includes:
- A prerequisites section at the top listing the non-truestamp tools
referenced (cat / jq / curl / sha256sum / etc.) with availability
notes per platform; only 'truestamp' itself is required.
- Per-command sections for auth, config, create, download, verify,
hash, encode / decode, jcs, each convert sub-command, upgrade,
version.
- ~15 pipeline recipes (recompute protocol claims_hash intermediate,
file-hash comparison against a proof, kid derivation, ID timestamp
extraction, CBOR round-trip, batch verify, etc.).
- A 'scripting with --json and jq' section using the real JSON schema.
- A CI conventions section with the full env-var reference and the
list of CI environments that auto-suppress the passive upgrade
notice.
- An offline / air-gapped section explaining which commands need the
network and which don't.
Every example was exercised end-to-end against a live Truestamp dev
server (including real create → wait-past-block-boundary → download →
verify → verify --remote) to catch documentation drift. Inaccuracies
fixed during that pass:
- 'auth status --json' — flag doesn't exist; removed, kept exit-code
contract.
- 'convert id' ULID sample output replaced with the real value.
- 'verify --json' field name corrected from the mythical
'.hashComparison.expected' to the real '.hash_comparison.found'.
- The 'recompute claims_hash' recipe: the command was right but the
prose incorrectly claimed the output matched 's.mh' in the proof.
s.mh is the metadata_hash (prefix 0x12); the recipe computes the
claims_hash intermediate (prefix 0x11), which is used internally in
the item_hash derivation but is never serialized into the bundle.
Reworded to reflect reality and cross-link the file-hash comparison
recipe users actually want.
- The 'global flags' list conflated truly-persistent flags with
per-command ones (--json, --silent). Split into two explicit lists.
hash --style bare simplification:
Before: 'bare' still printed the filename column unless
--no-filename was also passed, making 'hash --style bare file.txt'
output byte-identical to 'hash --style gnu file.txt'. That accidental
collision defeated the whole point of 'bare'.
After: 'bare' unconditionally omits the filename column. The three
styles now produce three genuinely-distinct shapes:
gnu — '<hex> <filename>' sha256sum-compatible
bsd — '<ALGO> (<filename>) = <hex>' shasum --tag compatible
bare — '<hex>' scripting / pipe-into-another-command
--no-filename is still accepted everywhere for backward compatibility
(it's a no-op on bare, still useful on gnu / bsd). Updated flag help,
Long description, and the golden fixture capturing the help output.
README.md: new 'Documentation' section near the top linking
prominently to EXAMPLES.md, plus a mid-document callout and trailing
pointer so the link is discoverable at multiple scroll depths.
CONTRIBUTING.md: expanded 'When to run which task' table with every
Taskfile entry point, their durations, and their intended use. New
'Tests' section broken out by category (unit/integration, golden
snapshots, fuzz, bench, race, coverage, lint, vuln-check) with
guidance on what kind of test to add when.1 parent 9fe9070 commit 4386681
7 files changed
Lines changed: 909 additions & 29 deletions
File tree
- cmd
- testdata/golden
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
26 | 54 | | |
27 | 55 | | |
28 | 56 | | |
| |||
32 | 60 | | |
33 | 61 | | |
34 | 62 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 63 | + | |
38 | 64 | | |
39 | | - | |
| 65 | + | |
40 | 66 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
45 | 107 | | |
46 | 108 | | |
47 | 109 | | |
| |||
73 | 135 | | |
74 | 136 | | |
75 | 137 | | |
76 | | - | |
77 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
78 | 141 | | |
79 | 142 | | |
80 | 143 | | |
| |||
0 commit comments