@am_shork/attest 0.8.0 → 0.9.1

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.
@@ -28,6 +28,7 @@ export function uncoveredIssues(registry, plan) {
28
28
  }
29
29
  /**
30
30
  * Static structural validation (design §5.3). Emits ERROR-level issues for:
31
+ * - empty-spec: the root declares no requirements at all
31
32
  * - orphan-test: a scenario covers an unknown requirement id
32
33
  * - uncovered-requirement: a requirement has no scenario
33
34
  * - unbound-param: a statement placeholder has no matching param
@@ -47,6 +48,27 @@ export function uncoveredIssues(registry, plan) {
47
48
  export function validateStructure(registry, plan, unreadable = []) {
48
49
  const issues = [];
49
50
  const knownIds = new Set(Object.keys(registry));
51
+ // empty-spec: nothing under this root declares intent, so no finding below is
52
+ // about a requirement — and the report has no line saying why. It is stated
53
+ // first because everything else this function can emit against an empty
54
+ // registry is fallout from it: every scenario in the project is an orphan, and
55
+ // the diagnosis after 135 of them is a diagnosis nobody reaches.
56
+ //
57
+ // Guarded on `unreadable`, which is the same withdrawal the orphan advice
58
+ // makes below and for the same reason. "Point attest at the directory holding
59
+ // your *.reqs.ts files" is right for a root that has none, and **wrong** for
60
+ // one whose registry is sitting right there and failed to load: the files were
61
+ // found, the fix is the load error already in the report, and following the
62
+ // hint would move a working path. A registry that could not be read is not an
63
+ // absent one, and the two take different repairs.
64
+ if (knownIds.size === 0 && unreadable.length === 0) {
65
+ issues.push({
66
+ level: 'ERROR',
67
+ code: 'empty-spec',
68
+ message: `No requirements found under this root, so there is no intent here to attest. ` +
69
+ `Point attest at the directory holding your *.reqs.ts files, or add one.`,
70
+ });
71
+ }
50
72
  // orphan-test: covers a requirement that does not exist.
51
73
  //
52
74
  // "Add it to the registry, or fix the id" is the right advice for an id that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@am_shork/attest",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "description": "TDD-native spec framework: tests are the source of truth for verification, ID-bound requirements the source of truth for intent.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -25,7 +25,8 @@
25
25
  "./define": {
26
26
  "types": "./dist/core/registry.d.ts",
27
27
  "default": "./dist/core/registry.js"
28
- }
28
+ },
29
+ "./package.json": "./package.json"
29
30
  },
30
31
  "files": [
31
32
  "dist",