@anatomytool/validate 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.
Files changed (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +127 -0
  3. package/dist/canonical.d.ts +21 -0
  4. package/dist/canonical.d.ts.map +1 -0
  5. package/dist/canonical.js +76 -0
  6. package/dist/canonical.js.map +1 -0
  7. package/dist/checks/commands-no-test-warn.d.ts +6 -0
  8. package/dist/checks/commands-no-test-warn.d.ts.map +1 -0
  9. package/dist/checks/commands-no-test-warn.js +35 -0
  10. package/dist/checks/commands-no-test-warn.js.map +1 -0
  11. package/dist/checks/description-warn.d.ts +6 -0
  12. package/dist/checks/description-warn.d.ts.map +1 -0
  13. package/dist/checks/description-warn.js +23 -0
  14. package/dist/checks/description-warn.js.map +1 -0
  15. package/dist/checks/entry-point-alias-warn.d.ts +6 -0
  16. package/dist/checks/entry-point-alias-warn.d.ts.map +1 -0
  17. package/dist/checks/entry-point-alias-warn.js +25 -0
  18. package/dist/checks/entry-point-alias-warn.js.map +1 -0
  19. package/dist/checks/fingerprint-check.d.ts +6 -0
  20. package/dist/checks/fingerprint-check.d.ts.map +1 -0
  21. package/dist/checks/fingerprint-check.js +59 -0
  22. package/dist/checks/fingerprint-check.js.map +1 -0
  23. package/dist/checks/hash-check.d.ts +6 -0
  24. package/dist/checks/hash-check.d.ts.map +1 -0
  25. package/dist/checks/hash-check.js +36 -0
  26. package/dist/checks/hash-check.js.map +1 -0
  27. package/dist/checks/interface-form-check.d.ts +6 -0
  28. package/dist/checks/interface-form-check.d.ts.map +1 -0
  29. package/dist/checks/interface-form-check.js +66 -0
  30. package/dist/checks/interface-form-check.js.map +1 -0
  31. package/dist/checks/memory-dangling-ref-check.d.ts +6 -0
  32. package/dist/checks/memory-dangling-ref-check.d.ts.map +1 -0
  33. package/dist/checks/memory-dangling-ref-check.js +34 -0
  34. package/dist/checks/memory-dangling-ref-check.js.map +1 -0
  35. package/dist/checks/memory-fingerprint-check.d.ts +6 -0
  36. package/dist/checks/memory-fingerprint-check.d.ts.map +1 -0
  37. package/dist/checks/memory-fingerprint-check.js +20 -0
  38. package/dist/checks/memory-fingerprint-check.js.map +1 -0
  39. package/dist/checks/memory-supersession-check.d.ts +6 -0
  40. package/dist/checks/memory-supersession-check.d.ts.map +1 -0
  41. package/dist/checks/memory-supersession-check.js +61 -0
  42. package/dist/checks/memory-supersession-check.js.map +1 -0
  43. package/dist/checks/memory-verification-check.d.ts +6 -0
  44. package/dist/checks/memory-verification-check.d.ts.map +1 -0
  45. package/dist/checks/memory-verification-check.js +61 -0
  46. package/dist/checks/memory-verification-check.js.map +1 -0
  47. package/dist/checks/nested-path-escape.d.ts +6 -0
  48. package/dist/checks/nested-path-escape.d.ts.map +1 -0
  49. package/dist/checks/nested-path-escape.js +76 -0
  50. package/dist/checks/nested-path-escape.js.map +1 -0
  51. package/dist/checks/schema-check.d.ts +6 -0
  52. package/dist/checks/schema-check.d.ts.map +1 -0
  53. package/dist/checks/schema-check.js +32 -0
  54. package/dist/checks/schema-check.js.map +1 -0
  55. package/dist/checks/source-cross-check.d.ts +52 -0
  56. package/dist/checks/source-cross-check.d.ts.map +1 -0
  57. package/dist/checks/source-cross-check.js +473 -0
  58. package/dist/checks/source-cross-check.js.map +1 -0
  59. package/dist/checks/source-path-check.d.ts +6 -0
  60. package/dist/checks/source-path-check.d.ts.map +1 -0
  61. package/dist/checks/source-path-check.js +62 -0
  62. package/dist/checks/source-path-check.js.map +1 -0
  63. package/dist/checks/structure-path-check.d.ts +6 -0
  64. package/dist/checks/structure-path-check.d.ts.map +1 -0
  65. package/dist/checks/structure-path-check.js +31 -0
  66. package/dist/checks/structure-path-check.js.map +1 -0
  67. package/dist/checks/verify/ast-grep-verifier.d.ts +4 -0
  68. package/dist/checks/verify/ast-grep-verifier.d.ts.map +1 -0
  69. package/dist/checks/verify/ast-grep-verifier.js +153 -0
  70. package/dist/checks/verify/ast-grep-verifier.js.map +1 -0
  71. package/dist/checks/verify/detect-ast-grep.d.ts +9 -0
  72. package/dist/checks/verify/detect-ast-grep.d.ts.map +1 -0
  73. package/dist/checks/verify/detect-ast-grep.js +26 -0
  74. package/dist/checks/verify/detect-ast-grep.js.map +1 -0
  75. package/dist/checks/verify/detect-semgrep.d.ts +8 -0
  76. package/dist/checks/verify/detect-semgrep.d.ts.map +1 -0
  77. package/dist/checks/verify/detect-semgrep.js +36 -0
  78. package/dist/checks/verify/detect-semgrep.js.map +1 -0
  79. package/dist/checks/verify/glob-verifier.d.ts +5 -0
  80. package/dist/checks/verify/glob-verifier.d.ts.map +1 -0
  81. package/dist/checks/verify/glob-verifier.js +58 -0
  82. package/dist/checks/verify/glob-verifier.js.map +1 -0
  83. package/dist/checks/verify/semgrep-pattern-verifier.d.ts +4 -0
  84. package/dist/checks/verify/semgrep-pattern-verifier.d.ts.map +1 -0
  85. package/dist/checks/verify/semgrep-pattern-verifier.js +121 -0
  86. package/dist/checks/verify/semgrep-pattern-verifier.js.map +1 -0
  87. package/dist/checks/verify/semgrep-rule-file-verifier.d.ts +9 -0
  88. package/dist/checks/verify/semgrep-rule-file-verifier.d.ts.map +1 -0
  89. package/dist/checks/verify/semgrep-rule-file-verifier.js +151 -0
  90. package/dist/checks/verify/semgrep-rule-file-verifier.js.map +1 -0
  91. package/dist/checks/verify/types.d.ts +44 -0
  92. package/dist/checks/verify/types.d.ts.map +1 -0
  93. package/dist/checks/verify/types.js +6 -0
  94. package/dist/checks/verify/types.js.map +1 -0
  95. package/dist/checks/verify-check.d.ts +9 -0
  96. package/dist/checks/verify-check.d.ts.map +1 -0
  97. package/dist/checks/verify-check.js +67 -0
  98. package/dist/checks/verify-check.js.map +1 -0
  99. package/dist/discovery.d.ts +13 -0
  100. package/dist/discovery.d.ts.map +1 -0
  101. package/dist/discovery.js +82 -0
  102. package/dist/discovery.js.map +1 -0
  103. package/dist/errors.d.ts +38 -0
  104. package/dist/errors.d.ts.map +1 -0
  105. package/dist/errors.js +5 -0
  106. package/dist/errors.js.map +1 -0
  107. package/dist/index.d.ts +43 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +81 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/memory.d.ts +19 -0
  112. package/dist/memory.d.ts.map +1 -0
  113. package/dist/memory.js +80 -0
  114. package/dist/memory.js.map +1 -0
  115. package/dist/parse.d.ts +17 -0
  116. package/dist/parse.d.ts.map +1 -0
  117. package/dist/parse.js +47 -0
  118. package/dist/parse.js.map +1 -0
  119. package/dist/schema-0.10.json +194 -0
  120. package/dist/schema-0.11.json +203 -0
  121. package/dist/schema-0.12.json +243 -0
  122. package/dist/schema-0.13.json +267 -0
  123. package/dist/schema-0.14.json +288 -0
  124. package/dist/schema-0.15.json +347 -0
  125. package/dist/schema-0.2.json +283 -0
  126. package/dist/schema-0.4.json +280 -0
  127. package/dist/schema-0.5.json +300 -0
  128. package/dist/schema-0.6.json +328 -0
  129. package/dist/schema-0.7.json +311 -0
  130. package/dist/schema-0.8.json +245 -0
  131. package/dist/schema-0.9.json +172 -0
  132. package/dist/schema-1.0.json +347 -0
  133. package/dist/schema-memory-0.1.json +43 -0
  134. package/dist/schema-memory-0.2.json +49 -0
  135. package/dist/schema-memory.d.ts +5 -0
  136. package/dist/schema-memory.d.ts.map +1 -0
  137. package/dist/schema-memory.js +16 -0
  138. package/dist/schema-memory.js.map +1 -0
  139. package/dist/schema.d.ts +6 -0
  140. package/dist/schema.d.ts.map +1 -0
  141. package/dist/schema.js +62 -0
  142. package/dist/schema.js.map +1 -0
  143. package/dist/schema.json +129 -0
  144. package/dist/types.d.ts +2 -0
  145. package/dist/types.d.ts.map +1 -0
  146. package/dist/types.generated.d.ts +1103 -0
  147. package/dist/types.generated.d.ts.map +1 -0
  148. package/dist/types.generated.js +7 -0
  149. package/dist/types.generated.js.map +1 -0
  150. package/dist/types.js +7 -0
  151. package/dist/types.js.map +1 -0
  152. package/dist/validate-tree.d.ts +20 -0
  153. package/dist/validate-tree.d.ts.map +1 -0
  154. package/dist/validate-tree.js +64 -0
  155. package/dist/validate-tree.js.map +1 -0
  156. package/package.json +48 -0
@@ -0,0 +1,328 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://anatomy.dev/spec/0.6/schema.json",
4
+ "title": "Anatomy",
5
+ "description": "Schema for .anatomy files (v0.6). Additive over v0.5: adds optional [[insights]] array with architecture, pattern, data-model, protocol, invariant, and constraint types.",
6
+ "type": "object",
7
+ "required": ["anatomy_version", "tagline", "identity", "generated"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "anatomy_version": { "type": "string", "const": "0.6" },
11
+ "tagline": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" },
12
+ "description": { "type": "string", "minLength": 1, "maxLength": 2000 },
13
+ "identity": { "$ref": "#/$defs/identity" },
14
+ "generated": { "$ref": "#/$defs/generated" },
15
+ "operation": { "$ref": "#/$defs/operation" },
16
+ "substance": { "$ref": "#/$defs/substance" },
17
+ "structure": { "$ref": "#/$defs/structure" },
18
+ "environment": { "$ref": "#/$defs/environment" },
19
+ "interface": { "$ref": "#/$defs/interface" },
20
+ "domain_model": { "$ref": "#/$defs/domain_model" },
21
+ "code_profile": { "$ref": "#/$defs/code_profile" },
22
+ "architecture": { "$ref": "#/$defs/architecture" },
23
+ "insights": {
24
+ "type": "array",
25
+ "minItems": 3,
26
+ "maxItems": 8,
27
+ "items": {
28
+ "type": "object",
29
+ "required": ["type", "name", "summary"],
30
+ "additionalProperties": false,
31
+ "properties": {
32
+ "type": {
33
+ "type": "string",
34
+ "enum": ["architecture", "pattern", "data-model", "protocol", "invariant", "constraint"]
35
+ },
36
+ "name": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
40
+ "maxLength": 40
41
+ },
42
+ "summary": {
43
+ "type": "string",
44
+ "minLength": 1,
45
+ "maxLength": 200,
46
+ "pattern": "^[^\\n\\r]+$"
47
+ }
48
+ }
49
+ }
50
+ }
51
+ },
52
+ "$defs": {
53
+ "identity": {
54
+ "type": "object",
55
+ "required": ["stack", "form", "domain", "function", "fingerprint"],
56
+ "additionalProperties": false,
57
+ "properties": {
58
+ "stack": { "$ref": "#/$defs/pillar" },
59
+ "form": { "$ref": "#/$defs/pillar" },
60
+ "domain": { "$ref": "#/$defs/pillar" },
61
+ "function": { "$ref": "#/$defs/pillar" },
62
+ "fingerprint": { "type": "string", "pattern": "^[a-z0-9]{20}$" }
63
+ }
64
+ },
65
+ "pillar": {
66
+ "type": "object",
67
+ "required": ["id", "hash"],
68
+ "additionalProperties": false,
69
+ "properties": {
70
+ "id": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
71
+ "hash": { "type": "string", "pattern": "^[a-z0-9]{5}$" }
72
+ }
73
+ },
74
+ "generated": {
75
+ "type": "object",
76
+ "required": ["at", "by", "model", "schema"],
77
+ "additionalProperties": false,
78
+ "properties": {
79
+ "at": { "type": "string", "format": "date-time" },
80
+ "commit": { "type": "string", "pattern": "^[0-9a-f]{7,12}$" },
81
+ "by": { "type": "string", "minLength": 1 },
82
+ "model": { "type": "string", "minLength": 1 },
83
+ "schema": { "type": "string", "format": "uri" }
84
+ }
85
+ },
86
+ "operation": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "properties": {
90
+ "entry_points": {
91
+ "type": "array", "maxItems": 10,
92
+ "items": { "$ref": "#/$defs/entry_point" }
93
+ },
94
+ "commands": {
95
+ "type": "object",
96
+ "propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*(\\.[a-z0-9]+(-[a-z0-9]+)*)?$" },
97
+ "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 200 },
98
+ "maxProperties": 25
99
+ },
100
+ "conventions": {
101
+ "type": "object",
102
+ "propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
103
+ "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 120 },
104
+ "maxProperties": 15
105
+ }
106
+ }
107
+ },
108
+ "entry_point": {
109
+ "type": "object",
110
+ "required": ["path", "role"],
111
+ "additionalProperties": false,
112
+ "not": { "required": ["description", "purpose"] },
113
+ "properties": {
114
+ "path": { "type": "string", "minLength": 1, "maxLength": 256 },
115
+ "role": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
116
+ "purpose": { "type": "string", "minLength": 1, "maxLength": 80, "pattern": "^[^\\n\\r]+$" },
117
+ "description": { "type": "string", "minLength": 1, "maxLength": 80, "pattern": "^[^\\n\\r]+$" }
118
+ }
119
+ },
120
+ "substance": {
121
+ "type": "object",
122
+ "additionalProperties": false,
123
+ "properties": {
124
+ "key_dependencies": { "type": "array", "maxItems": 10, "items": { "$ref": "#/$defs/key_dependency" } },
125
+ "capabilities": { "type": "array", "maxItems": 10, "items": { "$ref": "#/$defs/phrase_with_source" } },
126
+ "limitations": { "type": "array", "maxItems": 10, "items": { "$ref": "#/$defs/phrase_with_source" } }
127
+ }
128
+ },
129
+ "key_dependency": {
130
+ "type": "object", "required": ["name", "why"], "additionalProperties": false,
131
+ "properties": {
132
+ "name": { "type": "string", "minLength": 1, "maxLength": 200 },
133
+ "why": { "type": "string", "minLength": 1, "maxLength": 80 }
134
+ }
135
+ },
136
+ "phrase_with_source": {
137
+ "type": "object", "required": ["phrase"], "additionalProperties": false,
138
+ "properties": {
139
+ "phrase": { "type": "string", "minLength": 1, "maxLength": 120 },
140
+ "source": {
141
+ "oneOf": [
142
+ { "type": "string", "minLength": 1, "maxLength": 256 },
143
+ {
144
+ "type": "object", "required": ["path", "symbol"], "additionalProperties": false,
145
+ "properties": {
146
+ "path": { "type": "string", "minLength": 1, "maxLength": 256 },
147
+ "symbol": { "type": "string", "minLength": 1, "maxLength": 200 }
148
+ }
149
+ }
150
+ ]
151
+ }
152
+ }
153
+ },
154
+ "structure": {
155
+ "type": "object", "additionalProperties": false, "required": ["entries"],
156
+ "properties": {
157
+ "entries": {
158
+ "type": "array", "minItems": 1, "maxItems": 25,
159
+ "items": {
160
+ "type": "object", "required": ["path", "purpose", "kind"], "additionalProperties": false,
161
+ "properties": {
162
+ "path": { "type": "string", "minLength": 1, "maxLength": 256 },
163
+ "purpose": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" },
164
+ "kind": { "enum": ["source", "tests", "docs", "config", "build", "scripts", "examples", "generated", "other"] },
165
+ "convention": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "^[^\\n\\r]+$" }
166
+ }
167
+ }
168
+ }
169
+ }
170
+ },
171
+ "environment": {
172
+ "type": "object", "additionalProperties": false,
173
+ "anyOf": [
174
+ { "required": ["language_version"] }, { "required": ["runtime"] },
175
+ { "required": ["os"] }, { "required": ["required_services"] }, { "required": ["required_env"] }
176
+ ],
177
+ "properties": {
178
+ "language_version": { "type": "string", "minLength": 1, "maxLength": 80 },
179
+ "runtime": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
180
+ "os": {
181
+ "oneOf": [
182
+ { "type": "array", "items": { "const": "any" }, "minItems": 1, "maxItems": 1 },
183
+ { "type": "array", "minItems": 1, "maxItems": 5, "uniqueItems": true, "items": { "enum": ["linux", "macos", "windows", "freebsd"] } }
184
+ ]
185
+ },
186
+ "required_services": {
187
+ "type": "array", "minItems": 1, "maxItems": 10,
188
+ "items": {
189
+ "type": "object", "required": ["name", "why"], "additionalProperties": false,
190
+ "properties": {
191
+ "name": { "type": "string", "minLength": 1, "maxLength": 80, "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
192
+ "why": { "type": "string", "minLength": 1, "maxLength": 80 }
193
+ }
194
+ }
195
+ },
196
+ "required_env": {
197
+ "type": "array", "minItems": 1, "maxItems": 25,
198
+ "items": {
199
+ "type": "object", "required": ["name", "why"], "additionalProperties": false,
200
+ "properties": {
201
+ "name": { "type": "string", "minLength": 1, "maxLength": 80, "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
202
+ "why": { "type": "string", "minLength": 1, "maxLength": 80 }
203
+ }
204
+ }
205
+ }
206
+ }
207
+ },
208
+ "interface": {
209
+ "type": "object", "additionalProperties": false,
210
+ "oneOf": [
211
+ { "required": ["exports"] }, { "required": ["endpoints"] }, { "required": ["subcommands"] }
212
+ ],
213
+ "properties": {
214
+ "exports": {
215
+ "type": "array", "minItems": 1, "maxItems": 25,
216
+ "items": {
217
+ "type": "object", "required": ["symbol", "kind", "summary"], "additionalProperties": false,
218
+ "properties": {
219
+ "symbol": { "type": "string", "minLength": 1, "maxLength": 120 },
220
+ "kind": { "enum": ["function", "class", "type", "constant", "namespace", "trait"] },
221
+ "summary": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" },
222
+ "signature": { "type": "string", "minLength": 1, "maxLength": 200 }
223
+ }
224
+ }
225
+ },
226
+ "endpoints": {
227
+ "type": "array", "minItems": 1, "maxItems": 50,
228
+ "items": {
229
+ "type": "object", "required": ["method", "path", "summary"], "additionalProperties": false,
230
+ "properties": {
231
+ "method": { "enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "WS", "GRPC", "OTHER"] },
232
+ "path": { "type": "string", "minLength": 1, "maxLength": 200 },
233
+ "summary": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" }
234
+ }
235
+ }
236
+ },
237
+ "subcommands": {
238
+ "type": "array", "minItems": 1, "maxItems": 30,
239
+ "items": {
240
+ "type": "object", "required": ["name", "summary"], "additionalProperties": false,
241
+ "properties": {
242
+ "name": { "type": "string", "minLength": 1, "maxLength": 60, "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
243
+ "summary": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ },
249
+ "domain_model": {
250
+ "type": "object", "additionalProperties": false, "required": ["entities"],
251
+ "properties": {
252
+ "entities": {
253
+ "type": "array", "minItems": 1, "maxItems": 25,
254
+ "items": {
255
+ "type": "object", "required": ["name", "summary"], "additionalProperties": false,
256
+ "properties": {
257
+ "name": { "type": "string", "minLength": 1, "maxLength": 80 },
258
+ "summary": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "^[^\\n\\r]+$" }
259
+ }
260
+ }
261
+ }
262
+ }
263
+ },
264
+ "code_profile": {
265
+ "type": "object",
266
+ "additionalProperties": false,
267
+ "oneOf": [
268
+ { "required": ["components"] },
269
+ { "required": ["commands"] },
270
+ { "required": ["endpoints"] },
271
+ { "required": ["exports"] }
272
+ ],
273
+ "properties": {
274
+ "components": { "$ref": "#/$defs/code_profile_components" },
275
+ "commands": { "$ref": "#/$defs/code_profile_commands" },
276
+ "endpoints": { "$ref": "#/$defs/code_profile_endpoints" },
277
+ "exports": { "$ref": "#/$defs/code_profile_exports" }
278
+ }
279
+ },
280
+ "code_profile_components": {
281
+ "type": "object", "additionalProperties": false, "required": ["count"],
282
+ "properties": {
283
+ "count": { "type": "integer", "minimum": 0 },
284
+ "styling": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
285
+ "sample": { "type": "array", "maxItems": 10, "items": { "type": "string", "minLength": 1, "maxLength": 80 } }
286
+ }
287
+ },
288
+ "code_profile_commands": {
289
+ "type": "object", "additionalProperties": false, "required": ["count"],
290
+ "properties": {
291
+ "count": { "type": "integer", "minimum": 0 },
292
+ "max_depth": { "type": "integer", "minimum": 2, "maximum": 10 },
293
+ "sample": { "type": "array", "maxItems": 10, "items": { "type": "string", "minLength": 1, "maxLength": 80 } }
294
+ }
295
+ },
296
+ "code_profile_endpoints": {
297
+ "type": "object", "additionalProperties": false, "required": ["count"],
298
+ "properties": {
299
+ "count": { "type": "integer", "minimum": 0 },
300
+ "auth_scheme": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
301
+ "sample": { "type": "array", "maxItems": 10, "items": { "type": "string", "minLength": 1, "maxLength": 80 } }
302
+ }
303
+ },
304
+ "code_profile_exports": {
305
+ "type": "object", "additionalProperties": false, "required": ["count"],
306
+ "properties": {
307
+ "count": { "type": "integer", "minimum": 0 },
308
+ "sample": { "type": "array", "maxItems": 10, "items": { "type": "string", "minLength": 1, "maxLength": 80 } }
309
+ }
310
+ },
311
+ "architecture": {
312
+ "type": "object",
313
+ "additionalProperties": false,
314
+ "required": ["invariants"],
315
+ "properties": {
316
+ "invariants": {
317
+ "type": "array", "minItems": 1, "maxItems": 25,
318
+ "items": {
319
+ "type": "object", "required": ["rule"], "additionalProperties": false,
320
+ "properties": {
321
+ "rule": { "type": "string", "minLength": 1, "maxLength": 300 }
322
+ }
323
+ }
324
+ }
325
+ }
326
+ }
327
+ }
328
+ }
@@ -0,0 +1,311 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://anatomy.dev/spec/0.7/schema.json",
4
+ "title": "Anatomy",
5
+ "description": "Schema for .anatomy files (v0.7). Flat identity pillars; replaces insights+architecture with rules, flows, decisions.",
6
+ "type": "object",
7
+ "required": ["anatomy_version", "tagline", "identity", "generated"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "anatomy_version": { "type": "string", "const": "0.7" },
11
+ "tagline": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" },
12
+ "description": { "type": "string", "minLength": 1, "maxLength": 2000 },
13
+ "identity": { "$ref": "#/$defs/identity" },
14
+ "generated": { "$ref": "#/$defs/generated" },
15
+ "operation": { "$ref": "#/$defs/operation" },
16
+ "substance": { "$ref": "#/$defs/substance" },
17
+ "structure": { "$ref": "#/$defs/structure" },
18
+ "environment": { "$ref": "#/$defs/environment" },
19
+ "interface": { "$ref": "#/$defs/interface" },
20
+ "domain_model": { "$ref": "#/$defs/domain_model" },
21
+ "code_profile": { "$ref": "#/$defs/code_profile" },
22
+ "rules": {
23
+ "type": "array", "minItems": 1, "maxItems": 20,
24
+ "items": { "$ref": "#/$defs/rule" }
25
+ },
26
+ "flows": {
27
+ "type": "array", "minItems": 1, "maxItems": 15,
28
+ "items": { "$ref": "#/$defs/flow" }
29
+ },
30
+ "decisions": {
31
+ "type": "array", "minItems": 1, "maxItems": 15,
32
+ "items": { "$ref": "#/$defs/decision" }
33
+ }
34
+ },
35
+ "$defs": {
36
+ "identity": {
37
+ "type": "object",
38
+ "required": ["stack", "form", "domain", "function", "fingerprint"],
39
+ "additionalProperties": false,
40
+ "properties": {
41
+ "stack": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
42
+ "form": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
43
+ "domain": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
44
+ "function": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
45
+ "fingerprint": { "type": "string", "pattern": "^[a-z0-9]{20}$" }
46
+ }
47
+ },
48
+ "rule": {
49
+ "type": "object",
50
+ "required": ["rule"],
51
+ "additionalProperties": false,
52
+ "properties": {
53
+ "rule": { "type": "string", "minLength": 1, "maxLength": 300 },
54
+ "why": { "type": "string", "minLength": 1, "maxLength": 200 }
55
+ }
56
+ },
57
+ "flow": {
58
+ "type": "object",
59
+ "required": ["name", "summary"],
60
+ "additionalProperties": false,
61
+ "properties": {
62
+ "name": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
63
+ "summary": { "type": "string", "minLength": 1, "maxLength": 300, "pattern": "^[^\\n\\r]+$" }
64
+ }
65
+ },
66
+ "decision": {
67
+ "type": "object",
68
+ "required": ["topic", "reason"],
69
+ "additionalProperties": false,
70
+ "properties": {
71
+ "topic": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" },
72
+ "reason": { "type": "string", "minLength": 1, "maxLength": 400 }
73
+ }
74
+ },
75
+ "generated": {
76
+ "type": "object",
77
+ "required": ["at", "by", "model", "schema"],
78
+ "additionalProperties": false,
79
+ "properties": {
80
+ "at": { "type": "string", "format": "date-time" },
81
+ "commit": { "type": "string", "pattern": "^[0-9a-f]{7,12}$" },
82
+ "by": { "type": "string", "minLength": 1 },
83
+ "model": { "type": "string", "minLength": 1 },
84
+ "schema": { "type": "string", "format": "uri" }
85
+ }
86
+ },
87
+ "operation": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "properties": {
91
+ "entry_points": {
92
+ "type": "array", "maxItems": 10,
93
+ "items": { "$ref": "#/$defs/entry_point" }
94
+ },
95
+ "commands": {
96
+ "type": "object",
97
+ "propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*(\\.[a-z0-9]+(-[a-z0-9]+)*)?$" },
98
+ "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 200 },
99
+ "maxProperties": 25
100
+ },
101
+ "conventions": {
102
+ "type": "object",
103
+ "propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
104
+ "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 120 },
105
+ "maxProperties": 15
106
+ }
107
+ }
108
+ },
109
+ "entry_point": {
110
+ "type": "object",
111
+ "required": ["path", "role"],
112
+ "additionalProperties": false,
113
+ "not": { "required": ["description", "purpose"] },
114
+ "properties": {
115
+ "path": { "type": "string", "minLength": 1, "maxLength": 256 },
116
+ "role": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
117
+ "purpose": { "type": "string", "minLength": 1, "maxLength": 80, "pattern": "^[^\\n\\r]+$" },
118
+ "description": { "type": "string", "minLength": 1, "maxLength": 80, "pattern": "^[^\\n\\r]+$" }
119
+ }
120
+ },
121
+ "substance": {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "properties": {
125
+ "key_dependencies": { "type": "array", "maxItems": 10, "items": { "$ref": "#/$defs/key_dependency" } },
126
+ "capabilities": { "type": "array", "maxItems": 10, "items": { "$ref": "#/$defs/phrase_with_source" } },
127
+ "limitations": { "type": "array", "maxItems": 10, "items": { "$ref": "#/$defs/phrase_with_source" } }
128
+ }
129
+ },
130
+ "key_dependency": {
131
+ "type": "object", "required": ["name", "why"], "additionalProperties": false,
132
+ "properties": {
133
+ "name": { "type": "string", "minLength": 1, "maxLength": 200 },
134
+ "why": { "type": "string", "minLength": 1, "maxLength": 80 }
135
+ }
136
+ },
137
+ "phrase_with_source": {
138
+ "type": "object", "required": ["phrase"], "additionalProperties": false,
139
+ "properties": {
140
+ "phrase": { "type": "string", "minLength": 1, "maxLength": 120 },
141
+ "source": {
142
+ "oneOf": [
143
+ { "type": "string", "minLength": 1, "maxLength": 256 },
144
+ {
145
+ "type": "object", "required": ["path", "symbol"], "additionalProperties": false,
146
+ "properties": {
147
+ "path": { "type": "string", "minLength": 1, "maxLength": 256 },
148
+ "symbol": { "type": "string", "minLength": 1, "maxLength": 200 }
149
+ }
150
+ }
151
+ ]
152
+ }
153
+ }
154
+ },
155
+ "structure": {
156
+ "type": "object", "additionalProperties": false, "required": ["entries"],
157
+ "properties": {
158
+ "entries": {
159
+ "type": "array", "minItems": 1, "maxItems": 25,
160
+ "items": {
161
+ "type": "object", "required": ["path", "purpose", "kind"], "additionalProperties": false,
162
+ "properties": {
163
+ "path": { "type": "string", "minLength": 1, "maxLength": 256 },
164
+ "purpose": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" },
165
+ "kind": { "enum": ["source", "tests", "docs", "config", "build", "scripts", "examples", "generated", "other"] },
166
+ "convention": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "^[^\\n\\r]+$" }
167
+ }
168
+ }
169
+ }
170
+ }
171
+ },
172
+ "environment": {
173
+ "type": "object", "additionalProperties": false,
174
+ "anyOf": [
175
+ { "required": ["language_version"] }, { "required": ["runtime"] },
176
+ { "required": ["os"] }, { "required": ["required_services"] }, { "required": ["required_env"] }
177
+ ],
178
+ "properties": {
179
+ "language_version": { "type": "string", "minLength": 1, "maxLength": 80 },
180
+ "runtime": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
181
+ "os": {
182
+ "oneOf": [
183
+ { "type": "array", "items": { "const": "any" }, "minItems": 1, "maxItems": 1 },
184
+ { "type": "array", "minItems": 1, "maxItems": 5, "uniqueItems": true, "items": { "enum": ["linux", "macos", "windows", "freebsd"] } }
185
+ ]
186
+ },
187
+ "required_services": {
188
+ "type": "array", "minItems": 1, "maxItems": 10,
189
+ "items": {
190
+ "type": "object", "required": ["name", "why"], "additionalProperties": false,
191
+ "properties": {
192
+ "name": { "type": "string", "minLength": 1, "maxLength": 80, "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
193
+ "why": { "type": "string", "minLength": 1, "maxLength": 80 }
194
+ }
195
+ }
196
+ },
197
+ "required_env": {
198
+ "type": "array", "minItems": 1, "maxItems": 25,
199
+ "items": {
200
+ "type": "object", "required": ["name", "why"], "additionalProperties": false,
201
+ "properties": {
202
+ "name": { "type": "string", "minLength": 1, "maxLength": 80, "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
203
+ "why": { "type": "string", "minLength": 1, "maxLength": 80 }
204
+ }
205
+ }
206
+ }
207
+ }
208
+ },
209
+ "interface": {
210
+ "type": "object", "additionalProperties": false,
211
+ "oneOf": [
212
+ { "required": ["exports"] }, { "required": ["endpoints"] }, { "required": ["subcommands"] }
213
+ ],
214
+ "properties": {
215
+ "exports": {
216
+ "type": "array", "minItems": 1, "maxItems": 25,
217
+ "items": {
218
+ "type": "object", "required": ["symbol", "kind", "summary"], "additionalProperties": false,
219
+ "properties": {
220
+ "symbol": { "type": "string", "minLength": 1, "maxLength": 120 },
221
+ "kind": { "enum": ["function", "class", "type", "constant", "namespace", "trait"] },
222
+ "summary": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" },
223
+ "signature": { "type": "string", "minLength": 1, "maxLength": 200 }
224
+ }
225
+ }
226
+ },
227
+ "endpoints": {
228
+ "type": "array", "minItems": 1, "maxItems": 50,
229
+ "items": {
230
+ "type": "object", "required": ["method", "path", "summary"], "additionalProperties": false,
231
+ "properties": {
232
+ "method": { "enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "WS", "GRPC", "OTHER"] },
233
+ "path": { "type": "string", "minLength": 1, "maxLength": 200 },
234
+ "summary": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" }
235
+ }
236
+ }
237
+ },
238
+ "subcommands": {
239
+ "type": "array", "minItems": 1, "maxItems": 30,
240
+ "items": {
241
+ "type": "object", "required": ["name", "summary"], "additionalProperties": false,
242
+ "properties": {
243
+ "name": { "type": "string", "minLength": 1, "maxLength": 60, "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
244
+ "summary": { "type": "string", "minLength": 1, "maxLength": 120, "pattern": "^[^\\n\\r]+$" }
245
+ }
246
+ }
247
+ }
248
+ }
249
+ },
250
+ "domain_model": {
251
+ "type": "object", "additionalProperties": false, "required": ["entities"],
252
+ "properties": {
253
+ "entities": {
254
+ "type": "array", "minItems": 1, "maxItems": 25,
255
+ "items": {
256
+ "type": "object", "required": ["name", "summary"], "additionalProperties": false,
257
+ "properties": {
258
+ "name": { "type": "string", "minLength": 1, "maxLength": 80 },
259
+ "summary": { "type": "string", "minLength": 1, "maxLength": 200, "pattern": "^[^\\n\\r]+$" }
260
+ }
261
+ }
262
+ }
263
+ }
264
+ },
265
+ "code_profile": {
266
+ "type": "object",
267
+ "additionalProperties": false,
268
+ "oneOf": [
269
+ { "required": ["components"] }, { "required": ["commands"] },
270
+ { "required": ["endpoints"] }, { "required": ["exports"] }
271
+ ],
272
+ "properties": {
273
+ "components": { "$ref": "#/$defs/code_profile_components" },
274
+ "commands": { "$ref": "#/$defs/code_profile_commands" },
275
+ "endpoints": { "$ref": "#/$defs/code_profile_endpoints" },
276
+ "exports": { "$ref": "#/$defs/code_profile_exports" }
277
+ }
278
+ },
279
+ "code_profile_components": {
280
+ "type": "object", "additionalProperties": false, "required": ["count"],
281
+ "properties": {
282
+ "count": { "type": "integer", "minimum": 0 },
283
+ "styling": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
284
+ "sample": { "type": "array", "maxItems": 10, "items": { "type": "string", "minLength": 1, "maxLength": 80 } }
285
+ }
286
+ },
287
+ "code_profile_commands": {
288
+ "type": "object", "additionalProperties": false, "required": ["count"],
289
+ "properties": {
290
+ "count": { "type": "integer", "minimum": 0 },
291
+ "max_depth": { "type": "integer", "minimum": 2, "maximum": 10 },
292
+ "sample": { "type": "array", "maxItems": 10, "items": { "type": "string", "minLength": 1, "maxLength": 80 } }
293
+ }
294
+ },
295
+ "code_profile_endpoints": {
296
+ "type": "object", "additionalProperties": false, "required": ["count"],
297
+ "properties": {
298
+ "count": { "type": "integer", "minimum": 0 },
299
+ "auth_scheme": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$", "maxLength": 40 },
300
+ "sample": { "type": "array", "maxItems": 10, "items": { "type": "string", "minLength": 1, "maxLength": 80 } }
301
+ }
302
+ },
303
+ "code_profile_exports": {
304
+ "type": "object", "additionalProperties": false, "required": ["count"],
305
+ "properties": {
306
+ "count": { "type": "integer", "minimum": 0 },
307
+ "sample": { "type": "array", "maxItems": 10, "items": { "type": "string", "minLength": 1, "maxLength": 80 } }
308
+ }
309
+ }
310
+ }
311
+ }