logicstamp-context 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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/LLM_CONTEXT.md +260 -0
  3. package/README.md +949 -0
  4. package/dist/cli/commands/clean.d.ts +15 -0
  5. package/dist/cli/commands/clean.d.ts.map +1 -0
  6. package/dist/cli/commands/clean.js +142 -0
  7. package/dist/cli/commands/clean.js.map +1 -0
  8. package/dist/cli/commands/compare.d.ts +88 -0
  9. package/dist/cli/commands/compare.d.ts.map +1 -0
  10. package/dist/cli/commands/compare.js +519 -0
  11. package/dist/cli/commands/compare.js.map +1 -0
  12. package/dist/cli/commands/context.d.ts +24 -0
  13. package/dist/cli/commands/context.d.ts.map +1 -0
  14. package/dist/cli/commands/context.js +576 -0
  15. package/dist/cli/commands/context.js.map +1 -0
  16. package/dist/cli/commands/init.d.ts +14 -0
  17. package/dist/cli/commands/init.d.ts.map +1 -0
  18. package/dist/cli/commands/init.js +71 -0
  19. package/dist/cli/commands/init.js.map +1 -0
  20. package/dist/cli/commands/validate.d.ts +52 -0
  21. package/dist/cli/commands/validate.d.ts.map +1 -0
  22. package/dist/cli/commands/validate.js +368 -0
  23. package/dist/cli/commands/validate.js.map +1 -0
  24. package/dist/cli/index.d.ts +7 -0
  25. package/dist/cli/index.d.ts.map +1 -0
  26. package/dist/cli/index.js +223 -0
  27. package/dist/cli/index.js.map +1 -0
  28. package/dist/cli/stamp.d.ts +7 -0
  29. package/dist/cli/stamp.d.ts.map +1 -0
  30. package/dist/cli/stamp.js +961 -0
  31. package/dist/cli/stamp.js.map +1 -0
  32. package/dist/cli/validate-index.d.ts +7 -0
  33. package/dist/cli/validate-index.d.ts.map +1 -0
  34. package/dist/cli/validate-index.js +55 -0
  35. package/dist/cli/validate-index.js.map +1 -0
  36. package/dist/core/astParser.d.ts +47 -0
  37. package/dist/core/astParser.d.ts.map +1 -0
  38. package/dist/core/astParser.js +417 -0
  39. package/dist/core/astParser.js.map +1 -0
  40. package/dist/core/contractBuilder.d.ts +48 -0
  41. package/dist/core/contractBuilder.d.ts.map +1 -0
  42. package/dist/core/contractBuilder.js +120 -0
  43. package/dist/core/contractBuilder.js.map +1 -0
  44. package/dist/core/manifest.d.ts +75 -0
  45. package/dist/core/manifest.d.ts.map +1 -0
  46. package/dist/core/manifest.js +173 -0
  47. package/dist/core/manifest.js.map +1 -0
  48. package/dist/core/pack.d.ts +190 -0
  49. package/dist/core/pack.d.ts.map +1 -0
  50. package/dist/core/pack.js +438 -0
  51. package/dist/core/pack.js.map +1 -0
  52. package/dist/core/signature.d.ts +47 -0
  53. package/dist/core/signature.d.ts.map +1 -0
  54. package/dist/core/signature.js +208 -0
  55. package/dist/core/signature.js.map +1 -0
  56. package/dist/index.d.ts +27 -0
  57. package/dist/index.d.ts.map +1 -0
  58. package/dist/index.js +23 -0
  59. package/dist/index.js.map +1 -0
  60. package/dist/types/UIFContract.d.ts +112 -0
  61. package/dist/types/UIFContract.d.ts.map +1 -0
  62. package/dist/types/UIFContract.js +36 -0
  63. package/dist/types/UIFContract.js.map +1 -0
  64. package/dist/utils/config.d.ts +34 -0
  65. package/dist/utils/config.d.ts.map +1 -0
  66. package/dist/utils/config.js +62 -0
  67. package/dist/utils/config.js.map +1 -0
  68. package/dist/utils/fsx.d.ts +85 -0
  69. package/dist/utils/fsx.d.ts.map +1 -0
  70. package/dist/utils/fsx.js +181 -0
  71. package/dist/utils/fsx.js.map +1 -0
  72. package/dist/utils/gitignore.d.ts +62 -0
  73. package/dist/utils/gitignore.d.ts.map +1 -0
  74. package/dist/utils/gitignore.js +183 -0
  75. package/dist/utils/gitignore.js.map +1 -0
  76. package/dist/utils/hash.d.ts +73 -0
  77. package/dist/utils/hash.d.ts.map +1 -0
  78. package/dist/utils/hash.js +159 -0
  79. package/dist/utils/hash.js.map +1 -0
  80. package/dist/utils/llmContext.d.ts +34 -0
  81. package/dist/utils/llmContext.d.ts.map +1 -0
  82. package/dist/utils/llmContext.js +136 -0
  83. package/dist/utils/llmContext.js.map +1 -0
  84. package/dist/utils/tokens.d.ts +23 -0
  85. package/dist/utils/tokens.d.ts.map +1 -0
  86. package/dist/utils/tokens.js +29 -0
  87. package/dist/utils/tokens.js.map +1 -0
  88. package/package.json +69 -0
  89. package/schema/logicstamp.context.schema.json +430 -0
@@ -0,0 +1,430 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://logicstamp.dev/schemas/context/v0.1.json",
4
+ "title": "LogicStamp Context Bundle",
5
+ "description": "JSON Schema for LogicStamp Context bundles - AI-ready documentation of React/TypeScript codebases. Each bundle represents component contracts, dependency graphs, and metadata. For detailed documentation on the meta.missing field and dependency resolution, see README.md 'Understanding the Meta Field' section.",
6
+ "type": "array",
7
+ "items": {
8
+ "$ref": "#/definitions/LogicStampBundle"
9
+ },
10
+ "definitions": {
11
+ "LogicStampBundle": {
12
+ "type": "object",
13
+ "required": ["type", "schemaVersion", "entryId", "depth", "createdAt", "bundleHash", "graph", "meta"],
14
+ "properties": {
15
+ "type": {
16
+ "type": "string",
17
+ "const": "LogicStampBundle",
18
+ "description": "Type identifier for LogicStamp bundles"
19
+ },
20
+ "schemaVersion": {
21
+ "type": "string",
22
+ "const": "0.1",
23
+ "description": "Schema version for the bundle format"
24
+ },
25
+ "position": {
26
+ "type": "string",
27
+ "pattern": "^\\d+/\\d+$",
28
+ "description": "Position of this bundle in the output (e.g., '1/10')"
29
+ },
30
+ "entryId": {
31
+ "type": "string",
32
+ "description": "Entry point identifier (file path)"
33
+ },
34
+ "depth": {
35
+ "type": "integer",
36
+ "minimum": 0,
37
+ "description": "Dependency traversal depth"
38
+ },
39
+ "createdAt": {
40
+ "type": "string",
41
+ "format": "date-time",
42
+ "description": "ISO 8601 timestamp of bundle creation"
43
+ },
44
+ "bundleHash": {
45
+ "type": "string",
46
+ "pattern": "^uifb:[a-f0-9]{24}$",
47
+ "description": "Content hash of the bundle"
48
+ },
49
+ "graph": {
50
+ "$ref": "#/definitions/BundleGraph"
51
+ },
52
+ "meta": {
53
+ "$ref": "#/definitions/BundleMeta"
54
+ }
55
+ },
56
+ "additionalProperties": false
57
+ },
58
+ "BundleGraph": {
59
+ "type": "object",
60
+ "required": ["nodes", "edges"],
61
+ "properties": {
62
+ "nodes": {
63
+ "type": "array",
64
+ "items": {
65
+ "$ref": "#/definitions/BundleNode"
66
+ },
67
+ "description": "Component nodes in the dependency graph"
68
+ },
69
+ "edges": {
70
+ "type": "array",
71
+ "items": {
72
+ "type": "array",
73
+ "minItems": 2,
74
+ "maxItems": 2,
75
+ "items": {
76
+ "type": "string"
77
+ }
78
+ },
79
+ "description": "Dependency edges as [from, to] tuples"
80
+ }
81
+ },
82
+ "additionalProperties": false
83
+ },
84
+ "BundleNode": {
85
+ "type": "object",
86
+ "required": ["entryId", "contract"],
87
+ "properties": {
88
+ "entryId": {
89
+ "type": "string",
90
+ "description": "Unique identifier for this component"
91
+ },
92
+ "contract": {
93
+ "$ref": "#/definitions/UIFContract"
94
+ },
95
+ "codeHeader": {
96
+ "type": ["string", "null"],
97
+ "description": "Header comment from the source file (when includeCode=header)"
98
+ },
99
+ "code": {
100
+ "type": ["string", "null"],
101
+ "description": "Full source code (when includeCode=full)"
102
+ }
103
+ },
104
+ "additionalProperties": false
105
+ },
106
+ "BundleMeta": {
107
+ "type": "object",
108
+ "required": ["missing", "source"],
109
+ "properties": {
110
+ "missing": {
111
+ "type": "array",
112
+ "items": {
113
+ "$ref": "#/definitions/MissingDependency"
114
+ },
115
+ "description": "Array of unresolved dependencies. Empty array [] indicates complete dependency resolution. Non-empty indicates external packages, missing files, or dependencies outside scan scope."
116
+ },
117
+ "source": {
118
+ "type": "string",
119
+ "pattern": "^logicstamp-context@\\d+\\.\\d+\\.\\d+$",
120
+ "description": "Generator identifier with version (e.g., 'logicstamp-context@0.1.0'). Used for compatibility tracking and debugging."
121
+ }
122
+ },
123
+ "additionalProperties": false
124
+ },
125
+ "MissingDependency": {
126
+ "type": "object",
127
+ "required": ["name", "reason"],
128
+ "properties": {
129
+ "name": {
130
+ "type": "string",
131
+ "description": "Import specifier that could not be resolved (e.g., './Component', '@mui/material')"
132
+ },
133
+ "reason": {
134
+ "type": "string",
135
+ "enum": ["file not found", "external package", "outside scan path", "max depth exceeded", "circular dependency"],
136
+ "description": "Reason for missing dependency: 'file not found' (deleted/moved), 'external package' (npm module), 'outside scan path' (not in scan dir), 'max depth exceeded' (beyond depth limit), 'circular dependency' (import cycle)"
137
+ },
138
+ "referencedBy": {
139
+ "type": "string",
140
+ "description": "File path of the component that attempted to import this dependency"
141
+ }
142
+ },
143
+ "additionalProperties": false
144
+ },
145
+ "UIFContract": {
146
+ "type": "object",
147
+ "required": ["type", "schemaVersion", "kind", "entryId", "description", "version", "logicSignature", "semanticHash", "fileHash"],
148
+ "properties": {
149
+ "type": {
150
+ "type": "string",
151
+ "const": "UIFContract",
152
+ "description": "Type identifier for UIF contracts"
153
+ },
154
+ "schemaVersion": {
155
+ "type": "string",
156
+ "const": "0.3",
157
+ "description": "Schema version for UIF contracts"
158
+ },
159
+ "kind": {
160
+ "type": "string",
161
+ "enum": ["react:component", "ts:module", "node:cli"],
162
+ "description": "Type of component"
163
+ },
164
+ "entryId": {
165
+ "type": "string",
166
+ "description": "File path identifier"
167
+ },
168
+ "description": {
169
+ "type": "string",
170
+ "description": "Human-readable description of the component"
171
+ },
172
+ "usedIn": {
173
+ "type": "array",
174
+ "items": {
175
+ "type": "string"
176
+ },
177
+ "description": "Components that depend on this one"
178
+ },
179
+ "version": {
180
+ "$ref": "#/definitions/ComponentVersion"
181
+ },
182
+ "logicSignature": {
183
+ "$ref": "#/definitions/LogicSignature"
184
+ },
185
+ "prediction": {
186
+ "type": "array",
187
+ "items": {
188
+ "type": "string"
189
+ },
190
+ "description": "Behavioral predictions about the component"
191
+ },
192
+ "metrics": {
193
+ "$ref": "#/definitions/ContractMetrics"
194
+ },
195
+ "links": {
196
+ "$ref": "#/definitions/ContractLinks"
197
+ },
198
+ "semanticHash": {
199
+ "type": "string",
200
+ "pattern": "^uif:[a-f0-9]{24}$",
201
+ "description": "Hash of the component's semantic structure"
202
+ },
203
+ "fileHash": {
204
+ "type": "string",
205
+ "pattern": "^uif:[a-f0-9]{24}$",
206
+ "description": "Hash of the source file"
207
+ }
208
+ },
209
+ "additionalProperties": false
210
+ },
211
+ "ComponentVersion": {
212
+ "type": "object",
213
+ "required": ["variables", "hooks", "components", "functions"],
214
+ "properties": {
215
+ "variables": {
216
+ "type": "array",
217
+ "items": {
218
+ "type": "string"
219
+ },
220
+ "description": "Variable declarations"
221
+ },
222
+ "hooks": {
223
+ "type": "array",
224
+ "items": {
225
+ "type": "string"
226
+ },
227
+ "description": "React hooks used"
228
+ },
229
+ "components": {
230
+ "type": "array",
231
+ "items": {
232
+ "type": "string"
233
+ },
234
+ "description": "JSX components used"
235
+ },
236
+ "functions": {
237
+ "type": "array",
238
+ "items": {
239
+ "type": "string"
240
+ },
241
+ "description": "Function declarations"
242
+ },
243
+ "imports": {
244
+ "type": "array",
245
+ "items": {
246
+ "type": "string"
247
+ },
248
+ "description": "Import statements"
249
+ }
250
+ },
251
+ "additionalProperties": false
252
+ },
253
+ "LogicSignature": {
254
+ "type": "object",
255
+ "required": ["props", "events"],
256
+ "properties": {
257
+ "props": {
258
+ "type": "object",
259
+ "additionalProperties": {
260
+ "$ref": "#/definitions/PropType"
261
+ },
262
+ "description": "Component props with types"
263
+ },
264
+ "events": {
265
+ "type": "object",
266
+ "additionalProperties": {
267
+ "$ref": "#/definitions/EventType"
268
+ },
269
+ "description": "Event handlers"
270
+ },
271
+ "state": {
272
+ "type": "object",
273
+ "additionalProperties": {
274
+ "type": "string"
275
+ },
276
+ "description": "Component state variables"
277
+ }
278
+ },
279
+ "additionalProperties": false
280
+ },
281
+ "PropType": {
282
+ "oneOf": [
283
+ {
284
+ "type": "string",
285
+ "description": "Simple type (e.g., 'string', 'number', 'boolean')"
286
+ },
287
+ {
288
+ "type": "array",
289
+ "items": {
290
+ "type": "string"
291
+ },
292
+ "description": "Legacy literal union format"
293
+ },
294
+ {
295
+ "type": "object",
296
+ "required": ["type"],
297
+ "properties": {
298
+ "type": {
299
+ "type": "string",
300
+ "description": "Type descriptor (literal-union, function, object, array, etc.)"
301
+ },
302
+ "optional": {
303
+ "type": "boolean",
304
+ "description": "Whether the prop is optional"
305
+ },
306
+ "literals": {
307
+ "type": "array",
308
+ "items": {
309
+ "type": "string"
310
+ },
311
+ "description": "Literal values for literal-union types"
312
+ },
313
+ "signature": {
314
+ "type": "string",
315
+ "description": "Function signature for function types"
316
+ }
317
+ },
318
+ "additionalProperties": false,
319
+ "description": "Rich type descriptor"
320
+ }
321
+ ]
322
+ },
323
+ "EventType": {
324
+ "oneOf": [
325
+ {
326
+ "type": "string",
327
+ "description": "Legacy format (e.g., 'function', 'arrow function')"
328
+ },
329
+ {
330
+ "type": "object",
331
+ "required": ["type", "signature"],
332
+ "properties": {
333
+ "type": {
334
+ "type": "string",
335
+ "const": "function",
336
+ "description": "Event handler type"
337
+ },
338
+ "signature": {
339
+ "type": "string",
340
+ "description": "Function signature (e.g., '() => void')"
341
+ },
342
+ "optional": {
343
+ "type": "boolean",
344
+ "description": "Whether the event handler is optional"
345
+ }
346
+ },
347
+ "additionalProperties": false,
348
+ "description": "Normalized event descriptor"
349
+ }
350
+ ]
351
+ },
352
+ "ContractMetrics": {
353
+ "type": "object",
354
+ "properties": {
355
+ "a11y": {
356
+ "$ref": "#/definitions/A11yMetrics"
357
+ },
358
+ "latency": {
359
+ "$ref": "#/definitions/LatencyMetrics"
360
+ },
361
+ "coverage": {
362
+ "$ref": "#/definitions/CoverageMetrics"
363
+ }
364
+ },
365
+ "additionalProperties": false
366
+ },
367
+ "A11yMetrics": {
368
+ "type": "object",
369
+ "properties": {
370
+ "contrastMin": {
371
+ "type": "number",
372
+ "description": "Minimum color contrast ratio"
373
+ },
374
+ "role": {
375
+ "type": "string",
376
+ "description": "ARIA role"
377
+ }
378
+ },
379
+ "additionalProperties": false
380
+ },
381
+ "LatencyMetrics": {
382
+ "type": "object",
383
+ "properties": {
384
+ "clientP95Ms": {
385
+ "type": "number",
386
+ "description": "95th percentile client latency in milliseconds"
387
+ }
388
+ },
389
+ "additionalProperties": false
390
+ },
391
+ "CoverageMetrics": {
392
+ "type": "object",
393
+ "properties": {
394
+ "lines": {
395
+ "type": "number",
396
+ "minimum": 0,
397
+ "maximum": 100,
398
+ "description": "Line coverage percentage"
399
+ },
400
+ "branches": {
401
+ "type": "number",
402
+ "minimum": 0,
403
+ "maximum": 100,
404
+ "description": "Branch coverage percentage"
405
+ }
406
+ },
407
+ "additionalProperties": false
408
+ },
409
+ "ContractLinks": {
410
+ "type": "object",
411
+ "properties": {
412
+ "tokens": {
413
+ "type": "string",
414
+ "description": "Link to design tokens"
415
+ },
416
+ "figma": {
417
+ "type": "string",
418
+ "format": "uri",
419
+ "description": "Link to Figma design"
420
+ },
421
+ "spec": {
422
+ "type": "string",
423
+ "format": "uri",
424
+ "description": "Link to specification"
425
+ }
426
+ },
427
+ "additionalProperties": false
428
+ }
429
+ }
430
+ }