logicstamp-context 0.8.2 → 0.8.4
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.
- package/LICENSE +21 -21
- package/LLM_CONTEXT.md +703 -703
- package/README.md +404 -459
- package/dist/cli/commands/clean.d.ts.map +1 -1
- package/dist/cli/commands/clean.js +1 -6
- package/dist/cli/commands/clean.js.map +1 -1
- package/dist/cli/commands/context/fileWriter.js +2 -2
- package/dist/cli/commands/context/fileWriter.js.map +1 -1
- package/dist/cli/commands/context/statsCalculator.d.ts +3 -2
- package/dist/cli/commands/context/statsCalculator.d.ts.map +1 -1
- package/dist/cli/commands/context/statsCalculator.js +45 -104
- package/dist/cli/commands/context/statsCalculator.js.map +1 -1
- package/dist/cli/commands/context/watchMode/watchMode.d.ts.map +1 -1
- package/dist/cli/commands/context/watchMode/watchMode.js +124 -39
- package/dist/cli/commands/context/watchMode/watchMode.js.map +1 -1
- package/dist/cli/commands/init.js +20 -20
- package/dist/cli/commands/security.js +3 -3
- package/dist/cli/commands/security.js.map +1 -1
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +1 -6
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/handlers/initHandler.js +5 -5
- package/dist/cli/index.d.ts +6 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +100 -96
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/parser/helpText.js +570 -570
- package/dist/cli/validate-index.js +26 -26
- package/dist/core/astParser/detectors.d.ts.map +1 -1
- package/dist/core/astParser/detectors.js +3 -2
- package/dist/core/astParser/detectors.js.map +1 -1
- package/dist/core/pack/loader.js +3 -3
- package/dist/core/pack/loader.js.map +1 -1
- package/dist/utils/codeSanitizer.d.ts.map +1 -1
- package/dist/utils/codeSanitizer.js +3 -2
- package/dist/utils/codeSanitizer.js.map +1 -1
- package/dist/utils/fsx.d.ts +5 -0
- package/dist/utils/fsx.d.ts.map +1 -1
- package/dist/utils/fsx.js +9 -2
- package/dist/utils/fsx.js.map +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +2 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/gitignore.d.ts.map +1 -1
- package/dist/utils/gitignore.js +2 -1
- package/dist/utils/gitignore.js.map +1 -1
- package/dist/utils/secretDetector.d.ts.map +1 -1
- package/dist/utils/secretDetector.js +17 -10
- package/dist/utils/secretDetector.js.map +1 -1
- package/package.json +85 -84
- package/schema/logicstamp.context.schema.json +1250 -1250
package/README.md
CHANGED
|
@@ -1,459 +1,404 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<a href="https://logicstamp.dev">
|
|
3
|
-
<picture>
|
|
4
|
-
<source media="(prefers-color-scheme: dark)" srcset="assets/logicstamp-
|
|
5
|
-
<source media="(prefers-color-scheme: light)" srcset="assets/logicstamp-
|
|
6
|
-
<img src="assets/logicstamp-
|
|
7
|
-
</picture>
|
|
8
|
-
</a>
|
|
9
|
-
|
|
10
|
-
## The Context Compiler for TypeScript.
|
|
11
|
-
|
|
12
|
-
<em>Supports: React · Next.js · Vue (TS/TSX) · Express · NestJS</em>
|
|
13
|
-
|
|
14
|
-
<br/>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
LogicStamp Context is a CLI that compiles TypeScript codebases into deterministic, diffable architectural contracts and dependency graphs - a compact, structured source of truth for AI coding workflows.
|
|
18
|
-
|
|
19
|
-
Includes watch mode, strict, auditable diffs, and real-time breaking change detection.
|
|
20
|
-
Use with [logicstamp-mcp](https://github.com/LogicStamp/logicstamp-mcp) to feed structured context into **Claude**, **Cursor**, and other MCP-compatible assistants.
|
|
21
|
-
|
|
22
|
-
<div align="center">
|
|
23
|
-
|
|
24
|
-
<br/>
|
|
25
|
-
<a href="https://github.com/LogicStamp">
|
|
26
|
-
<img src="./assets/logicstamp-fox.svg" alt="LogicStamp Fox Mascot" width="100" style="min-width: 80px;">
|
|
27
|
-
</a>
|
|
28
|
-
|
|
29
|
-
[](https://www.npmjs.com/package/logicstamp-context)
|
|
30
|
-

|
|
31
|
-
[](LICENSE)
|
|
32
|
-

|
|
33
|
-
[](https://github.com/LogicStamp/logicstamp-context/actions)
|
|
34
|
-
|
|
35
|
-
</div>
|
|
36
|
-
<br/>
|
|
37
|
-
|
|
38
|
-
<details>
|
|
39
|
-
<summary><strong>📑 Table of Contents</strong></summary>
|
|
40
|
-
|
|
41
|
-
- [The Problem](#the-problem)
|
|
42
|
-
- [Quick Start](#quick-start)
|
|
43
|
-
- [Why Structured Context?](#why-structured-context)
|
|
44
|
-
- [Features](#-features)
|
|
45
|
-
- [Watch Mode](#watch-mode)
|
|
46
|
-
- [How it Works](#how-it-works)
|
|
47
|
-
- [MCP Server](#mcp-server)
|
|
48
|
-
- [
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [
|
|
53
|
-
- [
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
|
|
104
|
-
stamp
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### What "Structured" Means
|
|
125
|
-
|
|
126
|
-
Instead of
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
// Raw: AI must parse and infer
|
|
130
|
-
export const Button = ({ variant = 'primary', disabled, onClick, children }) => {
|
|
131
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
132
|
-
// ... 150 more lines of implementation
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
LogicStamp Context generates:
|
|
137
|
-
|
|
138
|
-
```json
|
|
139
|
-
{
|
|
140
|
-
"kind": "react:component",
|
|
141
|
-
"interface": {
|
|
142
|
-
"props": {
|
|
143
|
-
"variant": { "type": "literal-union", "literals": ["primary", "secondary"] },
|
|
144
|
-
"disabled": { "type": "boolean" },
|
|
145
|
-
"onClick": { "type": "function", "signature": "() => void" }
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
"composition": { "hooks": ["useState"], "components": ["./Icon"] }
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
Pre-parsed. Categorized. Stable. The AI reads contracts, not implementations.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
- **
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
**
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
- Next.js
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
**
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
</details>
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
| **Express.js** | Full | Routes, API signatures (middleware not extracted. see [limitations](docs/reference/limitations.md)) |
|
|
406
|
-
| **NestJS** | Full | Controllers, decorators, API signatures |
|
|
407
|
-
| **UI Libraries** | Full | Material UI, ShadCN, Radix, Tailwind, Styled Components, SCSS, Chakra UI, Ant Design (component usage, props, composition. not raw CSS) |
|
|
408
|
-
|
|
409
|
-
> **ℹ️ Note:** LogicStamp Context analyzes `.ts` and `.tsx` files only. JavaScript files are not analyzed.
|
|
410
|
-
|
|
411
|
-
## Documentation
|
|
412
|
-
|
|
413
|
-
**Full documentation at [logicstamp.dev/docs](https://logicstamp.dev/docs)**
|
|
414
|
-
|
|
415
|
-
- [Getting Started Guide](https://logicstamp.dev/docs/getting-started)
|
|
416
|
-
- [Usage Guide](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/guides/usage.md)
|
|
417
|
-
- [Monorepo Support](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/guides/monorepo.md)
|
|
418
|
-
- [Output Schema](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/reference/schema.md)
|
|
419
|
-
- [UIF Contracts](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/reference/uif-contracts.md)
|
|
420
|
-
- [Watch Mode](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/cli/watch.md)
|
|
421
|
-
- [Troubleshooting](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/guides/usage.md#troubleshooting)
|
|
422
|
-
|
|
423
|
-
## Known Limitations
|
|
424
|
-
|
|
425
|
-
LogicStamp Context is in beta. Some edge cases are not fully supported.
|
|
426
|
-
|
|
427
|
-
📋 **See [docs/reference/limitations.md](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/reference/limitations.md)** for the full list.
|
|
428
|
-
|
|
429
|
-
## Requirements
|
|
430
|
-
|
|
431
|
-
- Node.js >= 20
|
|
432
|
-
- TypeScript codebase (React, Next.js, Vue (TS/TSX), Express, or NestJS)
|
|
433
|
-
|
|
434
|
-
## Need Help?
|
|
435
|
-
|
|
436
|
-
- **Issues** - [github.com/LogicStamp/logicstamp-context/issues](https://github.com/LogicStamp/logicstamp-context/issues)
|
|
437
|
-
- **Roadmap** - [logicstamp.dev/roadmap](https://logicstamp.dev/roadmap)
|
|
438
|
-
|
|
439
|
-
## License
|
|
440
|
-
|
|
441
|
-
[MIT](LICENSE)
|
|
442
|
-
|
|
443
|
-
---
|
|
444
|
-
|
|
445
|
-
<details>
|
|
446
|
-
<summary>Branding & Attribution</summary>
|
|
447
|
-
|
|
448
|
-
The LogicStamp Fox mascot and related brand assets are © 2025 Amit Levi. These assets may not be used for third-party branding without permission.
|
|
449
|
-
</details>
|
|
450
|
-
|
|
451
|
-
<details>
|
|
452
|
-
<summary>Contributing</summary>
|
|
453
|
-
|
|
454
|
-
Issues and PRs welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
455
|
-
|
|
456
|
-
This project follows a [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
457
|
-
</details>
|
|
458
|
-
|
|
459
|
-
**Links:** [Website](https://logicstamp.dev) · [GitHub](https://github.com/LogicStamp/logicstamp-context) · [MCP Server](https://github.com/LogicStamp/logicstamp-mcp) · [Changelog](https://github.com/LogicStamp/logicstamp-context/blob/main/CHANGELOG.md)
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://logicstamp.dev">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logicstamp-wordmark-dark.png">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="assets/logicstamp-wordmark-light.png">
|
|
6
|
+
<img src="assets/logicstamp-wordmark-light.png" alt="LogicStamp" width="400" height="auto">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
|
|
10
|
+
## The Context Compiler for TypeScript.
|
|
11
|
+
|
|
12
|
+
<em>Supports: React · Next.js · Vue (TS/TSX) · Express · NestJS</em>
|
|
13
|
+
|
|
14
|
+
<br/>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
LogicStamp Context is a CLI that compiles TypeScript codebases into deterministic, diffable architectural contracts and dependency graphs - a compact, structured source of truth for AI coding workflows.
|
|
18
|
+
|
|
19
|
+
Includes watch mode, strict, auditable diffs, and real-time breaking change detection.
|
|
20
|
+
Use with [logicstamp-mcp](https://github.com/LogicStamp/logicstamp-mcp) to feed structured context into **Claude**, **Cursor**, and other MCP-compatible assistants.
|
|
21
|
+
|
|
22
|
+
<div align="center">
|
|
23
|
+
|
|
24
|
+
<br/>
|
|
25
|
+
<a href="https://github.com/LogicStamp">
|
|
26
|
+
<img src="./assets/logicstamp-fox.svg" alt="LogicStamp Fox Mascot" width="100" style="min-width: 80px;">
|
|
27
|
+
</a>
|
|
28
|
+
|
|
29
|
+
[](https://www.npmjs.com/package/logicstamp-context)
|
|
30
|
+

|
|
31
|
+
[](LICENSE)
|
|
32
|
+

|
|
33
|
+
[](https://github.com/LogicStamp/logicstamp-context/actions)
|
|
34
|
+
|
|
35
|
+
</div>
|
|
36
|
+
<br/>
|
|
37
|
+
|
|
38
|
+
<details>
|
|
39
|
+
<summary><strong>📑 Table of Contents</strong></summary>
|
|
40
|
+
|
|
41
|
+
- [The Problem](#the-problem)
|
|
42
|
+
- [Quick Start](#quick-start)
|
|
43
|
+
- [Why Structured Context?](#why-structured-context)
|
|
44
|
+
- [Features](#-features)
|
|
45
|
+
- [Watch Mode](#watch-mode)
|
|
46
|
+
- [How it Works](#how-it-works)
|
|
47
|
+
- [MCP Server](#mcp-server)
|
|
48
|
+
- [Security](#security)
|
|
49
|
+
- [Usage](#usage)
|
|
50
|
+
- [Framework Support](#framework-support)
|
|
51
|
+
- [Documentation](#documentation)
|
|
52
|
+
- [Known Limitations](#known-limitations)
|
|
53
|
+
- [Benchmarks](#benchmarks)
|
|
54
|
+
- [Requirements](#requirements)
|
|
55
|
+
- [Need Help?](#need-help)
|
|
56
|
+
- [License](#license)
|
|
57
|
+
</details>
|
|
58
|
+
|
|
59
|
+
## The Problem
|
|
60
|
+
|
|
61
|
+
AI coding assistants read your source code - but they don’t understand its structure.
|
|
62
|
+
They hallucinate props, miss dependencies, and can’t detect when a breaking change impacts consumers.
|
|
63
|
+
|
|
64
|
+
Example: your `Button` accepts `variant` and `disabled`, but the AI suggests `isLoading` because it saw that pattern elsewhere. Without a structured contract, there is no reliable source of truth.
|
|
65
|
+
|
|
66
|
+
**LogicStamp Context** derives that layer from your TypeScript - explicit interfaces and dependency structure for tools to consume instead of inferring from implementation.
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
*Example workflow: `stamp context --strict-watch` generates context bundles that MCP-powered assistants use to explain component architecture (ThemeContext shown here).*
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
TypeScript Code → Compilation → Deterministic Contracts → AI Assistant
|
|
73
|
+
(.ts/.tsx) (ts-morph) (context.json bundles) (Claude, Cursor)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
No install required:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npx logicstamp-context context
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Scans your repo and writes `context.json` files + `context_main.json` for AI tools.
|
|
87
|
+
|
|
88
|
+
**What you get:**
|
|
89
|
+
- 📁 `context.json` files - one per folder with components, preserving your directory structure
|
|
90
|
+
- 📋 `context_main.json` - index file with project overview and folder metadata
|
|
91
|
+
|
|
92
|
+
### Installation
|
|
93
|
+
|
|
94
|
+
For ongoing use, install the CLI globally:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm install -g logicstamp-context
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The `stamp` command is then available everywhere. Initialize and generate context:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
stamp init # sets up .gitignore, scans for secrets
|
|
104
|
+
stamp context
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
> **ℹ️ Note:** With `npx`, run `npx logicstamp-context context`. after a global install, use `stamp context`. If `npx` breaks but `stamp` works, remove the stale global CLI (`npm uninstall -g logicstamp-context`) and reinstall or run `npx logicstamp-context@latest context`.
|
|
108
|
+
|
|
109
|
+
📋 **For detailed setup instructions, see the [Getting Started Guide](https://logicstamp.dev/docs/getting-started).**
|
|
110
|
+
|
|
111
|
+
## Why Structured Context?
|
|
112
|
+
|
|
113
|
+
| Without LogicStamp Context | With LogicStamp Context |
|
|
114
|
+
|-------------------|-----------------|
|
|
115
|
+
| AI parses ~200 lines of implementation to infer a component's interface | AI reads a ~20-line interface contract |
|
|
116
|
+
| Props/hooks inferred (often wrong) | Props/hooks explicit and verified |
|
|
117
|
+
| No way to know if context is stale | Watch mode catches changes in real-time |
|
|
118
|
+
| Different prompts = different understanding | Deterministic: same code = same contract |
|
|
119
|
+
| Manual context gathering: "Here's my Button component..." | Structured contracts: AI understands architecture automatically |
|
|
120
|
+
|
|
121
|
+
**Key insight:** AI assistants don’t need your implementation - they need your *interfaces*.
|
|
122
|
+
LogicStamp extracts what matters and discards the noise.
|
|
123
|
+
|
|
124
|
+
### What "Structured" Means
|
|
125
|
+
|
|
126
|
+
Instead of sending raw source code to AI:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// Raw: AI must parse and infer
|
|
130
|
+
export const Button = ({ variant = 'primary', disabled, onClick, children }) => {
|
|
131
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
132
|
+
// ... 150 more lines of implementation
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
LogicStamp Context generates:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"kind": "react:component",
|
|
141
|
+
"interface": {
|
|
142
|
+
"props": {
|
|
143
|
+
"variant": { "type": "literal-union", "literals": ["primary", "secondary"] },
|
|
144
|
+
"disabled": { "type": "boolean" },
|
|
145
|
+
"onClick": { "type": "function", "signature": "() => void" }
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"composition": { "hooks": ["useState"], "components": ["./Icon"] }
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Pre-parsed. Categorized. Stable. The AI reads contracts, not implementations.
|
|
153
|
+
|
|
154
|
+
On disk, each folder’s `context.json` is a **LogicStampBundle**: contracts live under `graph.nodes`, with `graph.edges` for dependencies. **`context_main.json`** indexes folders and metadata. **Full JSON shape:** [docs/reference/schema.md](docs/reference/schema.md).
|
|
155
|
+
|
|
156
|
+
## ⚡ Features
|
|
157
|
+
|
|
158
|
+
**Under the hood:** the TypeScript compiler API (via ts-morph). **Analysis-only** - it describes your codebase and emits context files. it does not transform or refactor your source.
|
|
159
|
+
|
|
160
|
+
**Core:**
|
|
161
|
+
- **Deterministic contracts** - Same input = same output, auditable in version control
|
|
162
|
+
- **Watch mode** - Auto-regenerate on file changes with incremental rebuilds
|
|
163
|
+
- **Breaking change detection** - Strict watch mode catches removed props, events, functions in real-time
|
|
164
|
+
- **MCP-ready** - AI agents consume context via standardized MCP interface
|
|
165
|
+
|
|
166
|
+
**Analysis:**
|
|
167
|
+
- React/Next.js/Vue component extraction (props, hooks, state, deps)
|
|
168
|
+
- Backend API extraction (Express.js, NestJS routes and controllers)
|
|
169
|
+
- Dependency graphs (handles circular dependencies)
|
|
170
|
+
- Style metadata extraction (Tailwind, SCSS, MUI, shadcn)
|
|
171
|
+
- Next.js App Router detection (client/server, layouts, pages)
|
|
172
|
+
|
|
173
|
+
**Developer experience:**
|
|
174
|
+
- Per-folder bundles matching your project structure
|
|
175
|
+
- Accurate token estimates (GPT/Claude)
|
|
176
|
+
- Security-first: automatic secret detection and sanitization
|
|
177
|
+
- Zero config required - sensible defaults, works out of the box
|
|
178
|
+
|
|
179
|
+
### How it fits your stack
|
|
180
|
+
|
|
181
|
+
- **Works alongside `tsc`** - Focuses on contract structure and change detection, not type-checking. Use `tsc --noEmit` for compiler errors. `compare --strict` and `--strict-watch` flag **contract-level** breaking changes.
|
|
182
|
+
- **Beyond `.d.ts`** - Adds semantic contracts, dependency graphs, and diffable hashes (`semanticHash`, `bundleHash`) alongside declaration surfaces.
|
|
183
|
+
- **Context, not control** - Feeds structured context to assistants. Decisions stay with you.
|
|
184
|
+
|
|
185
|
+
📋 **For detailed behavior, CLI options, and workflows, see the [Usage guide](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/guides/usage.md).**
|
|
186
|
+
|
|
187
|
+
## Watch Mode
|
|
188
|
+
|
|
189
|
+
<p align="center">
|
|
190
|
+
<img src="./assets/logicstamp-strict-watch.gif" width="820" />
|
|
191
|
+
</p>
|
|
192
|
+
|
|
193
|
+
*Strict watch mode in action: detecting violations and clearing them when resolved.*
|
|
194
|
+
|
|
195
|
+
For development, run watch mode to keep context fresh as you code:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
stamp context --watch # regenerate on changes
|
|
199
|
+
stamp context --strict-watch # also detect breaking changes (implies --watch)
|
|
200
|
+
```
|
|
201
|
+
Strict watch catches breaking changes that affect consumers:
|
|
202
|
+
|
|
203
|
+
| Violation | Example |
|
|
204
|
+
|-----------|---------|
|
|
205
|
+
| `breaking_change_prop_removed` | Removed `disabled` prop from Button |
|
|
206
|
+
| `breaking_change_event_removed` | Removed `onSubmit` callback |
|
|
207
|
+
| `breaking_change_function_removed` | Deleted exported `formatDate()` |
|
|
208
|
+
| `contract_removed` | Deleted entire component |
|
|
209
|
+
|
|
210
|
+
**Errors vs Warnings:** Violations are classified by severity:
|
|
211
|
+
|
|
212
|
+
**❌ Errors** indicate breaking changes that will affect consumers (removed props, events, functions, or entire contracts).
|
|
213
|
+
|
|
214
|
+
**⚠️ Warnings** indicate less severe changes (type signature changes, removed internal state). Violations are tracked in real-time and automatically cleared when resolved.
|
|
215
|
+
|
|
216
|
+
**Session Status Tracking:** Strict watch mode displays a session status block showing cumulative statistics:
|
|
217
|
+
- **Errors/Warnings detected**: Total violations detected during the session
|
|
218
|
+
- **Resolved**: Number of times all violations were completely resolved
|
|
219
|
+
- **Active**: Current number of active violations
|
|
220
|
+
|
|
221
|
+
The status block only appears when violations change (not on every file change), keeping terminal output clean.
|
|
222
|
+
|
|
223
|
+

|
|
224
|
+
|
|
225
|
+
*Example terminal output showing violations and session status.*
|
|
226
|
+
|
|
227
|
+
> ℹ️ **Note:** Strict Watch currently detects breaking changes at the source. Next step: a symbol-level import/export reverse index to trace which consumer files will break. See [docs/cli/watch.md](docs/cli/watch.md) for complete documentation.
|
|
228
|
+
|
|
229
|
+
### One-time Comparison
|
|
230
|
+
|
|
231
|
+
Compare regenerated context against existing files:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
stamp context compare # detect changes
|
|
235
|
+
stamp context compare --approve # update (like jest -u)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Useful for reviewing changes before committing or validating context is up-to-date.
|
|
239
|
+
|
|
240
|
+
**Git baseline comparison** *(v0.7.2)*: Compare against any git ref:
|
|
241
|
+
```bash
|
|
242
|
+
stamp context compare --baseline git:main # Compare against main branch
|
|
243
|
+
stamp context compare --baseline git:HEAD # Compare against HEAD
|
|
244
|
+
stamp context compare --baseline git:v1.0.0 # Compare against a tag
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
> **ℹ️ Note:** Context files are gitignored by default. Git baseline comparison uses git worktrees to generate context for both the baseline ref and the current working tree, then performs a structural contract comparison. See [docs/cli/compare.md](docs/cli/compare.md) for complete documentation.
|
|
248
|
+
|
|
249
|
+
## How it Works
|
|
250
|
+
|
|
251
|
+
The compilation pipeline:
|
|
252
|
+
|
|
253
|
+
1. **Scan** - Discovers all `.ts` and `.tsx` source files
|
|
254
|
+
2. **Parse** - Builds AST (Abstract Syntax Tree) via `ts-morph` using the TypeScript compiler API
|
|
255
|
+
3. **Extract** - Compiles contracts with props, hooks, state, signatures
|
|
256
|
+
4. **Graph** - Resolves dependency relationships
|
|
257
|
+
5. **Emit** - Outputs `context.json` bundles per folder
|
|
258
|
+
6. **Index** - Generates `context_main.json` with metadata and statistics
|
|
259
|
+
|
|
260
|
+
One command. No build step required.
|
|
261
|
+
|
|
262
|
+
> **💡Tip:** Use `stamp context` for basic contracts. Use `stamp context style` when you need style metadata (Tailwind classes, SCSS selectors, layout patterns). Use `--style-mode lean` (default) for compact output or `--style-mode full` for detailed arrays.
|
|
263
|
+
|
|
264
|
+
## MCP Server
|
|
265
|
+
|
|
266
|
+
For AI assistants with MCP support (Claude Desktop, Cursor, etc.):
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
npm install -g logicstamp-mcp
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Then configure your AI assistant to use the LogicStamp MCP Server.
|
|
273
|
+
|
|
274
|
+
🔗 **See [LogicStamp MCP Server Repository](https://github.com/LogicStamp/logicstamp-mcp)**
|
|
275
|
+
|
|
276
|
+
📋 **See [MCP Getting Started Guide](https://logicstamp.dev/docs/mcp/getting-started)** for setup instructions.
|
|
277
|
+
|
|
278
|
+
## Security
|
|
279
|
+
|
|
280
|
+
**Automatic Secret Protection**
|
|
281
|
+
|
|
282
|
+
LogicStamp Context protects sensitive data in generated context:
|
|
283
|
+
|
|
284
|
+
- **Security scanning by default** - `stamp init` scans source files (`.ts`, `.tsx`, `.js`, `.jsx`) and `.json` files for hard-coded secrets before context compilation
|
|
285
|
+
- **Automatic sanitization** - Detected secrets replaced with `"PRIVATE_DATA"` in output
|
|
286
|
+
- **Manual exclusions** - Use `stamp ignore <file>` to exclude files via `.stampignore`
|
|
287
|
+
- **Safe by default** - Only metadata included. Credentials only appear in `--include-code full` mode
|
|
288
|
+
|
|
289
|
+
> **⚠️ Seeing `"PRIVATE_DATA"` in output?** Review `stamp_security_report.json`, remove hardcoded secrets from source, use environment variables instead.
|
|
290
|
+
|
|
291
|
+
🔒 **See [SECURITY.md](https://github.com/LogicStamp/logicstamp-context/blob/main/SECURITY.md)** for complete security documentation.
|
|
292
|
+
|
|
293
|
+
## Usage
|
|
294
|
+
|
|
295
|
+
<details>
|
|
296
|
+
<summary><strong>💻 CLI Usage Reference</strong></summary>
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
stamp --version # Show version
|
|
300
|
+
stamp --help # Show help
|
|
301
|
+
stamp init [path] # Initialize project (security scan by default)
|
|
302
|
+
stamp ignore <path> # Add to .stampignore
|
|
303
|
+
stamp context [path] # Generate context bundles
|
|
304
|
+
stamp context style [path] # Generate with style metadata (lean mode by default)
|
|
305
|
+
stamp context style --style-mode full # Generate with full style details (verbose)
|
|
306
|
+
stamp context --watch # Watch mode
|
|
307
|
+
stamp context --strict-watch # Watch with breaking change detection (--watch optional)
|
|
308
|
+
stamp context compare # Detect changes vs existing context
|
|
309
|
+
stamp context validate [file] # Validate context files
|
|
310
|
+
stamp context clean [path] # Remove generated files
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Common Options
|
|
314
|
+
|
|
315
|
+
| Option | Description |
|
|
316
|
+
|--------|-------------|
|
|
317
|
+
| `--depth <n>` | Dependency traversal depth (default: 2) |
|
|
318
|
+
| `--include-code <mode>` | Code inclusion: `none\|header\|full` (default: header) |
|
|
319
|
+
| `--include-style` | Extract style metadata (Tailwind, SCSS, animations) |
|
|
320
|
+
| `--format <fmt>` | Output format: `json\|pretty\|ndjson\|toon` (default: json) |
|
|
321
|
+
| `--max-nodes <n>` | Maximum nodes per bundle (default: 100) |
|
|
322
|
+
| `--profile <p>` | Preset: `llm-chat`, `llm-safe`, `ci-strict`, `watch-fast` |
|
|
323
|
+
| `--compare-modes` | Show token cost comparison across all modes |
|
|
324
|
+
| `--stats` | Emit JSON stats with token estimates |
|
|
325
|
+
| `--out <path>` | Output directory |
|
|
326
|
+
| `--quiet` | Suppress verbose output |
|
|
327
|
+
| `--strict-missing` | Exit with error if any missing dependencies found (CI-friendly) |
|
|
328
|
+
| `--debug` | Show detailed hash info (watch mode) |
|
|
329
|
+
| `--log-file` | Write change logs to `.logicstamp/` (watch mode) |
|
|
330
|
+
|
|
331
|
+
</details>
|
|
332
|
+
|
|
333
|
+
📋 **See [docs/cli/commands.md](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/cli/commands.md)** for complete reference.
|
|
334
|
+
|
|
335
|
+
## Framework Support
|
|
336
|
+
|
|
337
|
+
| Framework | Support Level | What's Extracted |
|
|
338
|
+
|-----------|--------------|------------------|
|
|
339
|
+
| **React** | Full | Components, hooks, props, styles |
|
|
340
|
+
| **Next.js** | Full | App Router roles, segment paths, metadata |
|
|
341
|
+
| **Vue 3** | Partial | Composition API (TS/TSX only, not .vue SFC) |
|
|
342
|
+
| **Express.js** | Full | Routes, API signatures (middleware not extracted. see [limitations](docs/reference/limitations.md)) |
|
|
343
|
+
| **NestJS** | Full | Controllers, decorators, API signatures |
|
|
344
|
+
| **UI Libraries** | Full | Material UI, ShadCN, Radix, Tailwind, Styled Components, CSS/SCSS (modules & imports), Chakra UI, Ant Design |
|
|
345
|
+
|
|
346
|
+
> ℹ️ **Note:** LogicStamp Context analyzes `.ts` and `.tsx` files only (JavaScript is not analyzed). Styling (Tailwind, SCSS, CSS Modules, UI libraries) is extracted as **structured style metadata**, not raw CSS. See the [Style command](docs/cli/style.md).
|
|
347
|
+
|
|
348
|
+
## Documentation
|
|
349
|
+
|
|
350
|
+
**Full documentation at [logicstamp.dev/docs](https://logicstamp.dev/docs)**
|
|
351
|
+
|
|
352
|
+
- [Getting Started Guide](https://logicstamp.dev/docs/getting-started)
|
|
353
|
+
- [Usage Guide](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/guides/usage.md)
|
|
354
|
+
- [Monorepo Support](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/guides/monorepo.md)
|
|
355
|
+
- [Output Schema](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/reference/schema.md)
|
|
356
|
+
- [UIF Contracts](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/reference/uif-contracts.md)
|
|
357
|
+
- [Watch Mode](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/cli/watch.md)
|
|
358
|
+
- [Troubleshooting](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/guides/usage.md#troubleshooting)
|
|
359
|
+
|
|
360
|
+
## Known Limitations
|
|
361
|
+
|
|
362
|
+
LogicStamp Context is in beta. Some edge cases are not fully supported.
|
|
363
|
+
|
|
364
|
+
📋 **See [docs/reference/limitations.md](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/reference/limitations.md)** for the full list.
|
|
365
|
+
|
|
366
|
+
## Benchmarks
|
|
367
|
+
|
|
368
|
+
You can compare bundle token costs across modes on your repo with `stamp context --compare-modes` (see [compare modes](https://github.com/LogicStamp/logicstamp-context/blob/main/docs/cli/compare-modes.md)).
|
|
369
|
+
|
|
370
|
+
**Formal benchmarks** are on the [roadmap](https://github.com/LogicStamp/logicstamp-context/blob/main/ROADMAP.md#performance--optimization):
|
|
371
|
+
- CLI/runtime baselines
|
|
372
|
+
- LLM evaluations (with vs without LogicStamp context)
|
|
373
|
+
|
|
374
|
+
## Requirements
|
|
375
|
+
|
|
376
|
+
- **Node.js** >= 20
|
|
377
|
+
- **TypeScript codebase** - `.ts` / `.tsx` only (JavaScript is not yet analyzed). Frameworks, UI libraries, and limits: **[Framework support](#framework-support)**.
|
|
378
|
+
|
|
379
|
+
## Need Help?
|
|
380
|
+
|
|
381
|
+
- **Issues** - [github.com/LogicStamp/logicstamp-context/issues](https://github.com/LogicStamp/logicstamp-context/issues)
|
|
382
|
+
- **Roadmap** - [logicstamp.dev/roadmap](https://logicstamp.dev/roadmap)
|
|
383
|
+
|
|
384
|
+
## License
|
|
385
|
+
|
|
386
|
+
[MIT](LICENSE)
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
<details>
|
|
391
|
+
<summary>Branding & Attribution</summary>
|
|
392
|
+
|
|
393
|
+
The LogicStamp Fox mascot and related brand assets are © 2025 Amit Levi. These assets may not be used for third-party branding without permission.
|
|
394
|
+
</details>
|
|
395
|
+
|
|
396
|
+
<details>
|
|
397
|
+
<summary>Contributing</summary>
|
|
398
|
+
|
|
399
|
+
Issues and PRs welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
400
|
+
|
|
401
|
+
This project follows a [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
402
|
+
</details>
|
|
403
|
+
|
|
404
|
+
**Links:** [Website](https://logicstamp.dev) · [GitHub](https://github.com/LogicStamp/logicstamp-context) · [MCP Server](https://github.com/LogicStamp/logicstamp-mcp) · [Changelog](https://github.com/LogicStamp/logicstamp-context/blob/main/CHANGELOG.md)
|