Skip to content

Commit 806de23

Browse files
authored
docs: tighten contributor and validation guidance (#26)
1 parent 0e07f4b commit 806de23

File tree

8 files changed

+95
-59
lines changed

8 files changed

+95
-59
lines changed

CONTRIBUTING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# CONTRIBUTING — Protocol-Commercial
2+
3+
This document defines the contributor workflow for the current release line. Keep changes minimal, validation-preserving, and explicit about whether they affect the current line (`v1.1.0`) or retained legacy artifacts.
4+
5+
## Pull request expectations
6+
7+
- Describe the exact problem being fixed and the exact files changed.
8+
- Keep protocol semantics unchanged unless the change is intentionally normative and documented.
9+
- Prefer deletion over vestigial compatibility scaffolding.
10+
- When docs change, keep them precise and avoid restating the full validation command block outside `README.md#validation-commands`.
11+
- If you touch checksum-covered machine artifacts (`schemas/v1.1.0/`, `examples/v1.1.0/`, `manifest.json`), regenerate `checksums.txt` before merge.
12+
13+
## Commit convention
14+
15+
Use concise, imperative commit subjects. Prefer a scope when it clarifies intent, for example:
16+
17+
- `docs: clarify current-line validation policy`
18+
- `tooling: route npm test through validation aggregate`
19+
- `validation: reuse strict JSON loader across scripts`
20+
21+
Avoid mixed-purpose commits when a focused change is practical.
22+
23+
## Required validation before merge
24+
25+
Run the canonical commands from `README.md#validation-commands` that match your change set. In normal contributor flow, this means at least:
26+
27+
```bash
28+
npm test
29+
npm run validate:schemas
30+
npm run validate:examples
31+
npm run validate:integrity
32+
```
33+
34+
Also run `sha256sum -c checksums.txt` whenever you changed checksum-covered artifacts or regenerated the checksum ledger.
35+
36+
## When changing schemas, examples, or docs
37+
38+
### Schemas
39+
40+
- Preserve flat, self-contained `v1.1.0` schemas; do not reintroduce current-line cross-file schema dependencies.
41+
- Keep file paths and `$id` values aligned exactly.
42+
- Treat same-named local `$defs` as canonical repeated shapes and keep them consistent across verbs.
43+
44+
### Examples
45+
46+
- Keep valid fixtures conformant and invalid fixtures narrowly targeted.
47+
- Ensure request and receipt coverage remains present in both `valid/` and `invalid/` for each current-line verb.
48+
- Do not add a current-line `examples/v1.1.0/**/ts/` surface unless the repository deliberately restores and governs it.
49+
50+
### Documentation
51+
52+
- Keep onboarding content orientation-focused and contributor policy in this file.
53+
- Use explicit JSON path imports in examples by default, with any bare-package import labeled as environment-dependent.
54+
- State clearly when guidance applies only to the current line and when legacy `v1.0.0` artifacts are mentioned for compatibility or audit history.

INTEGRATOR.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ This document is the external-consumer quickstart for the current commercial rel
44

55
## What to import
66

7-
Use the package root or the current index directly:
7+
Use the explicit current-line JSON path export by default:
88

99
```js
10-
import commercialIndex from '@commandlayer/commercial';
10+
import commercialIndex from '@commandlayer/commercial/schemas/v1.1.0/index.json';
1111
```
1212

13-
The package root resolves to `schemas/v1.1.0/index.json`. That index is the current machine-readable map of every canonical verb schema in the release.
13+
That path is the current machine-readable map of every canonical verb schema in the release and is the most portable documented import for ESM-first consumers. The bare package import `@commandlayer/commercial` currently resolves to the same file, but treat it as an environment-dependent shortcut rather than the default example.
1414

1515
## What is normative vs illustrative
1616

@@ -37,11 +37,7 @@ Normative interpretive docs:
3737
1. Confirm the package version is `1.1.0` and that `manifest.json` reports `status: current`.
3838
2. Load `schemas/v1.1.0/index.json` and select the request and receipt schema paths you need.
3939
3. Configure your validator from the flat per-verb schema files under `schemas/v1.1.0/commercial/<verb>/`.
40-
4. Run checksum verification before mirroring or vendoring artifacts:
41-
```bash
42-
npm run validate:integrity
43-
sha256sum -c checksums.txt
44-
```
40+
4. Run checksum verification before mirroring or vendoring artifacts using the canonical commands in `README.md#validation-commands`.
4541
5. Use `examples/v1.1.0/` as conformance fixtures, not as a substitute for schema requirements.
4642

4743
## Choosing between v1.1.0 and v1.0.0
@@ -65,4 +61,4 @@ The checksum-covered payload for this release is intentionally narrow:
6561

6662
## TypeScript guidance
6763

68-
There is no public `examples/v1.1.0/**/ts/` teaching surface in the current release. If a future release restores TypeScript examples, they should be explicitly governed, validated, and documented before they are treated as part of the public implementer surface.
64+
There is no current-line TypeScript compile target or public `examples/v1.1.0/**/ts/` teaching surface in this release. The retained `v1.0.0` TypeScript example files are legacy compatibility artifacts, not an active build surface. If a future release restores a TypeScript surface, it should be explicitly governed, validated, and documented before it is treated as part of the public implementer surface.

ONBOARDING.md

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# ONBOARDING — Protocol-Commercial
22

3-
This document describes both the external-consumer path and the maintainer workflow for the active v1.1.0 release line.
3+
This document is an orientation guide for the active v1.1.0 release line. Contributor policy and pre-merge workflow live in `CONTRIBUTING.md`.
44

55
## Document scope
66

7-
This document is the operational workflow for the current release line.
7+
Use this document to understand the repository shape, release line, and maintainer intent before editing.
88

99
## External consumer workflow
1010

@@ -24,32 +24,15 @@ This document is the operational workflow for the current release line.
2424

2525
## Maintainer workflow
2626

27-
1. Install dependencies.
28-
```bash
29-
npm install
30-
```
31-
2. Edit schemas, examples, metadata, scripts, and docs coherently.
32-
3. Run validation.
33-
```bash
34-
npm run validate
35-
npm run validate:schemas
36-
npm run validate:examples
37-
npm run validate:integrity
38-
```
39-
4. Regenerate checksums when checksum-covered machine artifacts change.
40-
```bash
41-
npm run generate:checksums
42-
```
43-
5. Re-run validation and checksum verification.
44-
```bash
45-
npm run validate
46-
npm run validate:schemas
47-
npm run validate:examples
48-
npm run validate:integrity
49-
sha256sum -c checksums.txt
50-
```
27+
For contribution workflow, pull request expectations, commit convention, and required pre-merge validation, use `CONTRIBUTING.md`.
28+
29+
High-level maintainer sequence:
5130

52-
When editing only prose docs outside the checksum surface, do not regenerate `checksums.txt` unless a checksum-covered machine artifact also changed.
31+
1. Install dependencies with `npm install`.
32+
2. Edit schemas, examples, metadata, scripts, and docs coherently.
33+
3. Run the canonical validation commands referenced from `README.md#validation-commands`.
34+
4. Regenerate `checksums.txt` only when checksum-covered machine artifacts change.
35+
5. Keep current-line teaching focused on `v1.1.0` and mark `v1.0.0` as retained legacy.
5336

5437
## Adding a new commercial verb
5538

README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,18 @@ The stack story is singular:
5656

5757
For consumers who need the shortest safe path:
5858

59-
1. Install the package and import the current index entrypoint.
59+
1. Install the package and import the current index entrypoint using the explicit JSON path export.
6060
```bash
6161
npm install @commandlayer/commercial
6262
```
6363
```js
64-
import commercialIndex from '@commandlayer/commercial';
64+
import commercialIndex from '@commandlayer/commercial/schemas/v1.1.0/index.json';
6565
```
66+
The bare package import `@commandlayer/commercial` resolves to the same file today, but treat that shortcut as environment-dependent rather than the default documentation path.
6667
2. Treat `schemas/v1.1.0/index.json` as the authoritative map of current schemas and verb inventory.
6768
3. Prefer `schemas/v1.1.0/commercial/<verb>/<verb>.request.schema.json` and `...receipt.schema.json` directly for validator configuration.
68-
4. Verify the machine-artifact set before mirroring or vendoring:
69-
```bash
70-
npm run validate:integrity
71-
sha256sum -c checksums.txt
72-
```
73-
5. Ignore `v1.0.0` unless you are maintaining compatibility with historical nested paths.
69+
4. Verify the machine-artifact set before mirroring or vendoring using the canonical command surface in [Validation commands](#validation-commands).
70+
5. Ignore `v1.0.0` unless you are maintaining compatibility with historical nested paths. Current automated validation targets `v1.1.0`; retained `v1.0.0` artifacts remain published for compatibility and audit without equal current-line guarantees.
7471
6. Treat schemas and `manifest.json` as normative machine artifacts. Treat examples as illustrative conformance fixtures. Treat prose docs as normative interpretation and release-process guidance.
7572

7673
A longer external-consumer workflow lives in `INTEGRATOR.md`.
@@ -159,6 +156,15 @@ protocol-commercial/
159156

160157
Protocol-Commercial v1.1.0 does **not** use a current-line `_shared/` tree. Every v1.1.0 request and receipt schema is self-contained, flat, and mirror-safe.
161158

159+
### Browsing large self-contained schemas
160+
161+
To navigate the flat schema line efficiently without reintroducing cross-file dependencies:
162+
163+
- Start at `schemas/v1.1.0/index.json` to locate the request and receipt pair for the verb you need.
164+
- Read a verb directory as a pair: request first for caller obligations, receipt second for canonical outcome and audit references.
165+
- Use the local `$defs` section in each schema as the file-scoped glossary for repeated structures such as actors, money, and payment evidence.
166+
- Compare same-named `$defs` across verbs only when checking consistency; the validator enforces those shared shapes without making readers chase external files.
167+
162168
Current-line example governance is equally explicit:
163169

164170
- `valid/` contains illustrative conforming request and receipt fixtures.
@@ -223,19 +229,21 @@ This repository does not define:
223229
}
224230
```
225231

226-
## Validation and integrity
232+
## Validation commands
233+
234+
This README is the canonical command surface for repository validation. Other docs should reference this section instead of duplicating the full command block.
227235

228236
```bash
229237
npm install
230-
npm run validate
238+
npm test
231239
npm run validate:schemas
232240
npm run validate:examples
233241
npm run validate:integrity
234242
npm run generate:checksums
235243
sha256sum -c checksums.txt
236244
```
237245

238-
- `npm run validate` runs the full validation suite for the current release line.
246+
- `npm test` runs the full current-line validation aggregate (`npm run validate`).
239247
- `npm run validate:schemas` checks current-line metadata, schema identity, layout, and manifest/index alignment expectations.
240248
- `npm run validate:examples` validates every current-line JSON valid and invalid example against the canonical schemas.
241249
- `npm run validate:integrity` verifies the checksum file scope and hash coverage for the current release artifact set.

SECURITY.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@ Protocol-Commercial provides schema-level security properties, not transaction o
3131

3232
## Verification commands
3333

34-
```bash
35-
npm run validate
36-
npm run validate:schemas
37-
npm run validate:examples
38-
npm run validate:integrity
39-
sha256sum -c checksums.txt
40-
```
41-
42-
`npm run validate:schemas` is the direct schema/metadata drift check. `sha256sum -c checksums.txt` verifies only the checksum-covered machine-artifact surface, not release prose docs.
34+
Use the canonical validation command surface in `README.md#validation-commands`. For security review, `npm run validate:schemas` is the direct schema/metadata drift check, and `sha256sum -c checksums.txt` verifies only the checksum-covered machine-artifact surface, not release prose docs.
4335

4436
Security contact: `dev@commandlayer.org`

SPEC.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ A conformant release MUST satisfy all of the following:
147147
- every declared verb has valid and invalid examples for both request and receipt artifacts
148148
- every current schema path matches its `$id`
149149
- `manifest.json` and `schemas/v1.1.0/index.json` agree on the current verb set and path inventory
150-
- `npm run validate` passes
150+
- `npm test` passes as the current-line validation aggregate
151151
- `npm run validate:schemas` passes
152152
- `sha256sum -c checksums.txt` passes for the checksum-covered machine-artifact set
153153
- repository metadata does not drift from the published current line
154+
155+
The canonical command list lives in `README.md#validation-commands`.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
"validate:integrity": "node scripts/validate-integrity.mjs",
6767
"validate:all": "npm run validate:schemas && npm run validate:examples && npm run validate:integrity",
6868
"validate": "npm run validate:all",
69-
"generate:checksums": "node scripts/generate-checksums.mjs"
69+
"generate:checksums": "node scripts/generate-checksums.mjs",
70+
"test": "npm run validate"
7071
},
7172
"devDependencies": {
7273
"ajv": "^8.17.1",

scripts/validate-examples.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
import fs from "fs/promises";
2+
import { readdir } from "fs/promises";
33
import path from "path";
44
import Ajv2020 from "ajv/dist/2020.js";
55
import addFormats from "ajv-formats";

0 commit comments

Comments
 (0)