@runbooks/schema 0.1.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/dist/agent-skills.test.d.ts +1 -0
  4. package/dist/agent-skills.test.js +71 -0
  5. package/dist/capabilities.d.ts +40 -0
  6. package/dist/capabilities.js +211 -0
  7. package/dist/capabilities.test.d.ts +1 -0
  8. package/dist/capabilities.test.js +119 -0
  9. package/dist/content-classes.test.d.ts +1 -0
  10. package/dist/content-classes.test.js +77 -0
  11. package/dist/generate.cli.d.ts +2 -0
  12. package/dist/generate.cli.js +27 -0
  13. package/dist/generate.d.ts +54 -0
  14. package/dist/generate.js +133 -0
  15. package/dist/generate.test.d.ts +1 -0
  16. package/dist/generate.test.js +85 -0
  17. package/dist/generated.d.ts +101 -0
  18. package/dist/generated.js +9 -0
  19. package/dist/generated.ts +82 -0
  20. package/dist/hash.d.ts +36 -0
  21. package/dist/hash.js +102 -0
  22. package/dist/hash.test.d.ts +1 -0
  23. package/dist/hash.test.js +54 -0
  24. package/dist/index.d.ts +58 -0
  25. package/dist/index.js +61 -0
  26. package/dist/index.test.d.ts +1 -0
  27. package/dist/index.test.js +236 -0
  28. package/dist/interpolation.d.ts +11 -0
  29. package/dist/interpolation.js +34 -0
  30. package/dist/node.d.ts +41 -0
  31. package/dist/node.js +111 -0
  32. package/dist/p1.test.d.ts +1 -0
  33. package/dist/p1.test.js +87 -0
  34. package/dist/run-report.test.d.ts +1 -0
  35. package/dist/run-report.test.js +145 -0
  36. package/dist/served.d.ts +36 -0
  37. package/dist/served.js +128 -0
  38. package/dist/stats.d.ts +17 -0
  39. package/dist/stats.js +23 -0
  40. package/dist/stats.test.d.ts +1 -0
  41. package/dist/stats.test.js +32 -0
  42. package/dist/validate.d.ts +16 -0
  43. package/dist/validate.js +46 -0
  44. package/dist/validate.test.d.ts +1 -0
  45. package/dist/validate.test.js +61 -0
  46. package/dist/vocabularies.test.d.ts +1 -0
  47. package/dist/vocabularies.test.js +77 -0
  48. package/package.json +50 -0
  49. package/spec/v1/schema/attestation.json +62 -0
  50. package/spec/v1/schema/p0.json +383 -0
  51. package/spec/v1/schema/p1.json +408 -0
  52. package/spec/v1/schema/record.json +908 -0
  53. package/spec/v1/schema/run-report-envelope.json +25 -0
  54. package/spec/v1/schema/run-report.json +121 -0
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://runbooks.directory/spec/v1/schema/run-report-envelope.json",
4
+ "title": "Run report, CloudEvents envelope",
5
+ "description": "The event binding for a run report (RUNBOOK.md 14). A runner already emitting lineage events adds one mapping rather than a new pipeline, which is the whole reason the format is event-shaped. The envelope carries no field the report itself excludes: in particular `source` is a URI naming a kind of producer, not an installation, and `time` is not required - a precise emission time reintroduces exactly the movement log that bucketing the duration was meant to avoid.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["specversion", "type", "source", "id", "datacontenttype", "data"],
9
+ "properties": {
10
+ "specversion": { "const": "1.0" },
11
+ "type": { "const": "directory.runbooks.run-report.v1" },
12
+ "source": {
13
+ "type": "string",
14
+ "pattern": "^urn:runbooks:(cli|hook|proxy|other)$",
15
+ "description": "What kind of thing produced this, from a closed set. A free-form source is a hostname waiting to happen."
16
+ },
17
+ "id": {
18
+ "type": "string",
19
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
20
+ "description": "A per-event UUID for deduplication. Not a sender identity, and not stable across runs: correlating two reports to one reporter is the thing this format refuses to enable."
21
+ },
22
+ "datacontenttype": { "const": "application/json" },
23
+ "data": { "$ref": "https://runbooks.directory/spec/v1/schema/run-report.json" }
24
+ }
25
+ }
@@ -0,0 +1,121 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://runbooks.directory/spec/v1/schema/run-report.json",
4
+ "title": "Run report v1",
5
+ "description": "What a supervised run leaves behind (RUNBOOK.md 14). An optional extension of the specification: the catalog depends on receiving none. Every field here is either justified as actionable or excluded as a deanonymization risk, and the exclusions are the point - the pressure to add 'just an error message field' is constant, and each such field is a secret leak waiting to happen. Nothing in this schema accepts free text: that is enforced by enum, pattern or format on every string, not by a promise to redact before publishing.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "report_schema",
10
+ "schema_version",
11
+ "runbook",
12
+ "version",
13
+ "content_hash",
14
+ "profile",
15
+ "outcome",
16
+ "executor_kind",
17
+ "runtime_profile",
18
+ "deviation_count",
19
+ "duration_bucket",
20
+ "env_class",
21
+ "reported_at"
22
+ ],
23
+ "properties": {
24
+ "report_schema": {
25
+ "const": "runbook-run-report/v1"
26
+ },
27
+ "schema_version": {
28
+ "enum": ["v1"],
29
+ "description": "The runbook format the report is about. Without it, reports are incomparable across format versions."
30
+ },
31
+ "runbook": {
32
+ "type": "string",
33
+ "pattern": "^[a-z0-9][a-z0-9-]{0,31}/[a-z0-9][a-z0-9-]{0,63}$",
34
+ "description": "publisher/slug. A name, not a description: the pattern is what keeps it from becoming a place to write a sentence."
35
+ },
36
+ "version": {
37
+ "type": "string",
38
+ "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
39
+ },
40
+ "content_hash": {
41
+ "type": "string",
42
+ "pattern": "^sha256:[0-9a-f]{64}$",
43
+ "description": "What actually ran, not just the version id. A report tied only to a version lives until the first update drift. A hash the catalog has never seen is still valid here: a reporter cannot be required to have run an indexed version, and refusing those reports would silently exclude exactly the runs worth hearing about."
44
+ },
45
+ "profile": {
46
+ "enum": ["P0", "P1"]
47
+ },
48
+ "outcome": {
49
+ "enum": ["success", "failed", "aborted", "partial"]
50
+ },
51
+ "failed_step_id": {
52
+ "type": "string",
53
+ "pattern": "^[a-z][a-z0-9_]{0,31}$",
54
+ "description": "Where exactly it broke. '5 successes, 3 failures' produces no action; '3 failures at s4' does."
55
+ },
56
+ "failure_class": {
57
+ "enum": [
58
+ "precondition_unmet",
59
+ "tool_missing",
60
+ "permission_denied",
61
+ "expectation_mismatch",
62
+ "timeout",
63
+ "human_abort",
64
+ "upstream_changed"
65
+ ],
66
+ "description": "Closed on purpose. An open class would be a free-text field with extra steps."
67
+ },
68
+ "executor_kind": {
69
+ "enum": ["human", "agent-assisted", "autonomous"],
70
+ "description": "Without it you cannot say whether the procedure is fit for an agent, which is half the point of the catalog."
71
+ },
72
+ "runtime_profile": {
73
+ "enum": ["R0", "R1", "R2"],
74
+ "description": "A failure under an advisory client and a failure under a supervised one are different facts; aggregating them together destroys both."
75
+ },
76
+ "deviation_count": {
77
+ "type": "integer",
78
+ "minimum": 0,
79
+ "description": "How many times the supervisor blocked something the runbook did not authorize. A procedure that constantly provokes deviations is one whose graph does not match reality, and no other field surfaces that."
80
+ },
81
+ "duration_bucket": {
82
+ "enum": ["<1m", "1-5m", "5-30m", ">30m"],
83
+ "description": "Bucketed, never exact. Second-level precision combined with submission time and a rare runbook deanonymizes a small organization."
84
+ },
85
+ "env_class": {
86
+ "enum": ["local", "ci", "staging", "prod"],
87
+ "description": "A closed enum and nothing finer. No cloud, no region, no cluster version: that is already an infrastructure fingerprint."
88
+ },
89
+ "reported_at": {
90
+ "type": "string",
91
+ "format": "date",
92
+ "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
93
+ "description": "A date, not a timestamp, enforced by the pattern rather than by convention. A timestamp is a movement log of one organization's incidents."
94
+ }
95
+ },
96
+ "allOf": [
97
+ {
98
+ "description": "A success has nothing to attribute a failure to. Carrying a failed step anyway would put a step id into the aggregate for runs that did not fail there.",
99
+ "if": {
100
+ "properties": { "outcome": { "const": "success" } },
101
+ "required": ["outcome"]
102
+ },
103
+ "then": {
104
+ "properties": {
105
+ "failed_step_id": { "not": {} },
106
+ "failure_class": { "not": {} }
107
+ }
108
+ }
109
+ },
110
+ {
111
+ "description": "A failure that names no class is a report nobody can act on: the aggregate would say only that something went wrong somewhere.",
112
+ "if": {
113
+ "properties": { "outcome": { "const": "failed" } },
114
+ "required": ["outcome"]
115
+ },
116
+ "then": {
117
+ "required": ["failure_class"]
118
+ }
119
+ }
120
+ ]
121
+ }