@dailephd/my-dev-kit 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.
@@ -0,0 +1,675 @@
1
+ # Graph Schema
2
+
3
+ This document describes the JSON artifacts produced and consumed by my-dev-kit.
4
+
5
+ my-dev-kit writes local, file-based artifacts when a project is indexed. These artifacts describe project metadata, per-file symbols, code graph structure, and optional call graph information.
6
+
7
+ The public product name is my-dev-kit. Some artifactKind values include my-dev-kit-v1 because they are versioned schema identifiers for the Version 1 artifact format. They do not change the product name.
8
+
9
+ For command flags, see COMMANDS.md.
10
+ For practical workflows, see WORKFLOWS.md.
11
+ For internal architecture details, see ARCHITECTURE.md.
12
+
13
+ ## Artifact overview
14
+
15
+ The index command writes artifacts into the selected output directory.
16
+
17
+ The output directory is passed through --out and is resolved relative to --root.
18
+
19
+ Recommended output directory:
20
+
21
+ .my-dev-kit
22
+
23
+ Core artifacts:
24
+
25
+ - manifest.json
26
+ - symbol-index.json
27
+ - code-graph.json
28
+
29
+ Optional artifact:
30
+
31
+ - call-graph.json
32
+
33
+ The optional call graph is written only when --call-graph is requested and call graph data is available.
34
+
35
+ Artifact flow:
36
+
37
+ my-dev-kit index --root <project> --src <src> --out .my-dev-kit
38
+ |
39
+ +-> manifest.json
40
+ +-> symbol-index.json
41
+ +-> code-graph.json
42
+ +-> call-graph.json, optional
43
+
44
+ Consumer commands:
45
+
46
+ - search reads manifest.json, symbol-index.json, and code-graph.json
47
+ - lookup reads manifest.json and code-graph.json
48
+ - source reads manifest.json, symbol-index.json, and sometimes code-graph.json
49
+ - slice reads manifest.json and code-graph.json
50
+ - view reads manifest.json and code-graph.json
51
+
52
+ ## Versioned artifact kinds
53
+
54
+ Some output objects include an artifactKind field.
55
+
56
+ Version 1 artifact kind values may include the string my-dev-kit-v1. These values are schema identifiers, not the public product name.
57
+
58
+ Current versioned artifact kind examples:
59
+
60
+ - my-dev-kit-v1-manifest
61
+ - my-dev-kit-v1-graph-slice
62
+ - my-dev-kit-v1-search-result
63
+
64
+ These values should remain stable for Version 1 compatibility unless the code and tests are intentionally migrated to a new schema identifier.
65
+
66
+ ## manifest.json
67
+
68
+ manifest.json records project metadata, source roots, artifact paths, warnings, errors, and summary counts.
69
+
70
+ Artifact kind:
71
+
72
+ - my-dev-kit-v1-manifest
73
+
74
+ Main fields:
75
+
76
+ - artifactKind
77
+ - version
78
+ - createdAt
79
+ - projectRoot
80
+ - sourceRoots
81
+ - languages
82
+ - callGraphEnabled
83
+ - artifacts
84
+ - summary
85
+ - warnings
86
+ - errors
87
+
88
+ Field descriptions:
89
+
90
+ - artifactKind is the versioned manifest schema identifier.
91
+ - version is the schema version string.
92
+ - createdAt is an ISO 8601 timestamp.
93
+ - projectRoot is the absolute path to the indexed project root.
94
+ - sourceRoots contains source roots relative to projectRoot.
95
+ - languages contains detected or requested source languages.
96
+ - callGraphEnabled is true when call graph generation was requested and produced.
97
+ - artifacts records artifact filenames relative to the index directory.
98
+ - summary contains file, symbol, edge, warning, and error counts.
99
+ - warnings contains non-fatal indexing warnings.
100
+ - errors contains indexing errors.
101
+
102
+ The artifacts object may include:
103
+
104
+ - symbolIndex
105
+ - codeGraph
106
+ - callGraph
107
+
108
+ When call graph generation is not requested or not available, artifacts.callGraph is null.
109
+
110
+ ## symbol-index.json
111
+
112
+ symbol-index.json records per-file symbol information extracted during indexing.
113
+
114
+ Top-level fields:
115
+
116
+ - schemaVersion
117
+ - buildTime
118
+ - repoRoot
119
+ - sourceRoots
120
+ - fileCount
121
+ - symbolCount
122
+ - files
123
+
124
+ Each file summary may include:
125
+
126
+ - path
127
+ - language
128
+ - imports
129
+ - exports
130
+ - symbols
131
+ - dependencies
132
+
133
+ Field descriptions:
134
+
135
+ - path is the file path relative to the indexed project root.
136
+ - language is the detected source language.
137
+ - imports contains imported module paths.
138
+ - exports contains exported symbol names.
139
+ - symbols contains per-symbol records.
140
+ - dependencies contains resolved internal dependency paths when available.
141
+
142
+ Each symbol record may include:
143
+
144
+ - name
145
+ - kind
146
+ - line
147
+ - exported
148
+ - language-specific metadata when available
149
+
150
+ Current symbol indexing records symbol start lines but not complete symbol end-line bounds.
151
+
152
+ symbol-index.json is consumed by:
153
+
154
+ - source, for symbol-name and symbol-node retrieval
155
+ - search, for symbol names, imports, exports, and dependency matching
156
+ - downstream tools that need compact per-file source summaries
157
+
158
+ ## code-graph.json
159
+
160
+ code-graph.json records the main typed code graph.
161
+
162
+ Artifact kind:
163
+
164
+ - code-graph
165
+
166
+ Top-level fields:
167
+
168
+ - artifactKind
169
+ - schemaVersion
170
+ - createdAt
171
+ - nodes
172
+ - edges
173
+ - summary
174
+
175
+ Field descriptions:
176
+
177
+ - artifactKind identifies the artifact as a code graph.
178
+ - schemaVersion is the code graph schema version.
179
+ - createdAt is an ISO 8601 timestamp.
180
+ - nodes contains file and symbol nodes.
181
+ - edges contains typed relationships between nodes.
182
+ - summary contains node and edge counts.
183
+
184
+ Summary fields:
185
+
186
+ - nodeCount
187
+ - edgeCount
188
+ - fileNodeCount
189
+ - symbolNodeCount
190
+
191
+ The code graph is consumed by:
192
+
193
+ - search
194
+ - lookup
195
+ - slice
196
+ - view
197
+ - source, when resolving node-based retrieval
198
+
199
+ The code graph describes static code structure. It is not a complete runtime execution graph.
200
+
201
+ ## Node model
202
+
203
+ Each code graph node has:
204
+
205
+ - id
206
+ - kind
207
+ - label
208
+
209
+ Additional fields depend on node kind.
210
+
211
+ File node fields:
212
+
213
+ - id
214
+ - kind
215
+ - label
216
+ - path
217
+ - language
218
+
219
+ Symbol node fields:
220
+
221
+ - id
222
+ - kind
223
+ - label
224
+ - path
225
+ - symbolName
226
+ - symbolKind
227
+ - language
228
+ - line
229
+ - exported
230
+
231
+ Field descriptions:
232
+
233
+ - id is the unique node ID.
234
+ - kind is file or symbol.
235
+ - label is a display label.
236
+ - path is the file path relative to the indexed project root.
237
+ - symbolName is the symbol name for symbol nodes.
238
+ - symbolKind is the extracted symbol kind.
239
+ - language is the detected source language.
240
+ - line is the symbol start line when available.
241
+ - exported indicates whether a symbol is exported.
242
+
243
+ ## Node ID conventions
244
+
245
+ Node IDs must be passed exactly as they appear in code-graph.json.
246
+
247
+ Use search results or inspect the nodes array in code-graph.json to discover valid node IDs.
248
+
249
+ File node format:
250
+
251
+ file:<relative-path>
252
+
253
+ Examples:
254
+
255
+ file:src/index.ts
256
+ file:src/userService.ts
257
+ file:src/main.py
258
+
259
+ Symbol node format:
260
+
261
+ symbol:<relative-path>#<symbol-name>
262
+
263
+ Examples:
264
+
265
+ symbol:src/index.ts#describeUser
266
+ symbol:src/userService.ts#formatUser
267
+ symbol:src/main.py#greet
268
+
269
+ Node IDs are stable within a single index run. Re-indexing may produce different IDs if file paths or symbol names change.
270
+
271
+ ## Edge model
272
+
273
+ Each edge has:
274
+
275
+ - id
276
+ - source
277
+ - target
278
+ - kind
279
+ - label
280
+
281
+ Field descriptions:
282
+
283
+ - id is the unique edge ID.
284
+ - source is the source node ID.
285
+ - target is the target node ID.
286
+ - kind is the edge kind.
287
+ - label is an optional display label.
288
+
289
+ ## Edge kinds
290
+
291
+ Defined edge kinds:
292
+
293
+ - defines
294
+ - imports
295
+ - exports
296
+ - calls
297
+ - depends-on
298
+ - related-to
299
+
300
+ Edge meanings:
301
+
302
+ - defines means a file node defines a symbol node.
303
+ - imports means a file node imports from another module or dependency.
304
+ - exports means a file node exports a symbol node.
305
+ - calls means a symbol node calls another symbol node when statically detected.
306
+ - depends-on means a file or symbol depends on another file or symbol.
307
+ - related-to means a general structural relationship that does not fit a narrower edge kind.
308
+
309
+ Edge kinds are used by:
310
+
311
+ - lookup traversal
312
+ - slice traversal
313
+ - search scoring
314
+ - graph view rendering
315
+ - semantic edge styling
316
+
317
+ ## call-graph.json
318
+
319
+ call-graph.json is written when --call-graph is requested and call graph data is available.
320
+
321
+ The call graph records static call edges discovered by supported language adapters.
322
+
323
+ Supported languages:
324
+
325
+ - TypeScript
326
+ - JavaScript
327
+ - Python
328
+
329
+ The call graph is best-effort and conservative.
330
+
331
+ It may detect straightforward calls such as:
332
+
333
+ - foo()
334
+ - self.foo()
335
+ - module.foo()
336
+ - ClassName.method()
337
+
338
+ It may miss:
339
+
340
+ - dynamic dispatch
341
+ - computed calls
342
+ - monkey-patching
343
+ - decorator-injected behavior
344
+ - runtime-generated calls
345
+ - framework-specific runtime wiring
346
+ - arbitrary import execution
347
+ - indirect runtime behavior
348
+
349
+ Python call graph extraction uses Python ast parsing and does not execute user source files.
350
+
351
+ The call graph should be treated as useful structural evidence, not as a complete runtime call graph.
352
+
353
+ ## Lookup behavior
354
+
355
+ lookup reads:
356
+
357
+ - manifest.json
358
+ - code-graph.json
359
+
360
+ lookup requires an exact node ID.
361
+
362
+ Behavior:
363
+
364
+ - depth 0 returns only the focus node.
365
+ - depth 1 through 3 expands graph neighbors breadth-first.
366
+ - results include the focus node, incoming edges, outgoing edges, and expanded neighbors.
367
+ - lookup does not read source files.
368
+ - lookup does not require Graphviz.
369
+ - lookup does not perform fuzzy matching.
370
+
371
+ Use search first when the exact node ID is unknown.
372
+
373
+ ## Source retrieval behavior
374
+
375
+ source reads different artifacts depending on retrieval mode.
376
+
377
+ Line-range retrieval reads:
378
+
379
+ - manifest.json
380
+ - source file from the indexed project
381
+
382
+ Symbol retrieval reads:
383
+
384
+ - manifest.json
385
+ - symbol-index.json
386
+ - source file from the indexed project
387
+
388
+ Node retrieval may read:
389
+
390
+ - manifest.json
391
+ - code-graph.json
392
+ - symbol-index.json
393
+ - source file from the indexed project
394
+
395
+ Supported retrieval modes:
396
+
397
+ - line range
398
+ - symbol name within a file
399
+ - node ID
400
+
401
+ Line-range mode:
402
+
403
+ my-dev-kit source --index .my-dev-kit --file src/index.ts --start 1 --end 40
404
+
405
+ Symbol mode:
406
+
407
+ my-dev-kit source --index .my-dev-kit --file src/index.ts --symbol describeUser
408
+
409
+ Node mode:
410
+
411
+ my-dev-kit source --index .my-dev-kit --node symbol:src/index.ts#describeUser
412
+
413
+ Source retrieval output may include:
414
+
415
+ - status
416
+ - mode
417
+ - filePath
418
+ - absolutePath
419
+ - symbolName
420
+ - startLine
421
+ - endLine
422
+ - lineCount
423
+ - content
424
+ - warnings
425
+
426
+ Output formats:
427
+
428
+ - json
429
+ - plain
430
+ - numbered
431
+
432
+ Safety constraints:
433
+
434
+ - file paths that escape manifest.projectRoot are rejected
435
+ - ranges where start exceeds end are rejected
436
+ - ranges that exceed --max-lines are rejected
437
+ - source files are read-only
438
+ - source files are never modified
439
+
440
+ Current limitation:
441
+
442
+ - The index records symbol start lines but not symbol end lines.
443
+ - Symbol retrieval returns a bounded preview from the symbol start line.
444
+ - Symbol retrieval may include a warning when the result is capped.
445
+ - Use explicit line-range retrieval when exact source bounds are required.
446
+
447
+ ## Graph slice artifact
448
+
449
+ slice produces a bounded graph-neighborhood artifact.
450
+
451
+ Artifact kind:
452
+
453
+ - my-dev-kit-v1-graph-slice
454
+
455
+ Main fields:
456
+
457
+ - artifactKind
458
+ - focusNodeId
459
+ - depth
460
+ - direction
461
+ - nodes
462
+ - edges
463
+ - summary
464
+ - artifactPaths
465
+
466
+ Field descriptions:
467
+
468
+ - artifactKind is the versioned graph-slice schema identifier.
469
+ - focusNodeId is the requested focus node.
470
+ - depth is the requested traversal depth.
471
+ - direction is incoming, outgoing, or both.
472
+ - nodes contains included graph nodes.
473
+ - edges contains included graph edges.
474
+ - summary contains node and edge counts by kind.
475
+ - artifactPaths records the manifest and code graph paths used to build the slice.
476
+
477
+ Traversal behavior:
478
+
479
+ - depth 0 returns only the focus node and no edges.
480
+ - depth 1 through 3 expands breadth-first.
481
+ - direction controls which edges are followed.
482
+ - slice reads graph artifacts only.
483
+ - slice does not read source files.
484
+ - slice does not require Graphviz.
485
+
486
+ ## Graph view behavior
487
+
488
+ view reads code-graph.json and renders it as DOT, SVG, or PNG.
489
+
490
+ Supported output formats:
491
+
492
+ - dot
493
+ - svg
494
+ - png
495
+
496
+ DOT output:
497
+
498
+ - does not require Graphviz
499
+ - renders file nodes as boxes
500
+ - renders symbol nodes as ellipses
501
+ - uses relative file paths for file labels
502
+ - uses symbol names for symbol labels
503
+
504
+ SVG and PNG output:
505
+
506
+ - require the Graphviz dot executable
507
+ - can fall back to DOT when --allow-dot-fallback is used
508
+
509
+ Supported edge style modes:
510
+
511
+ - semantic
512
+ - labeled
513
+ - minimal
514
+
515
+ Edge style behavior:
516
+
517
+ - semantic uses distinct DOT marker and line-style attributes per edge kind and includes one legend.
518
+ - labeled emits inline edge labels.
519
+ - minimal emits edges without labels or extra attributes.
520
+
521
+ Semantic edge DOT attribute mapping:
522
+
523
+ | Edge kind | dir | arrowtail | arrowhead | style |
524
+ | --- | --- | --- | --- | --- |
525
+ | defines | both | dot | normal | solid |
526
+ | imports | both | dot | inv | solid |
527
+ | exports | both | dot | onormal | solid |
528
+ | calls | both | dot | normal | bold |
529
+ | depends-on | both | dot | inv | dashed |
530
+ | related-to | both | odot | odot | dotted |
531
+
532
+ Semantic visualization is a rendering convention. It does not change code-graph.json.
533
+
534
+ ## Search result artifact
535
+
536
+ search produces a structured search result object.
537
+
538
+ Artifact kind:
539
+
540
+ - my-dev-kit-v1-search-result
541
+
542
+ Main fields:
543
+
544
+ - artifactKind
545
+ - version
546
+ - createdAt
547
+ - indexDir
548
+ - query
549
+ - normalizedTerms
550
+ - limit
551
+ - results
552
+ - summary
553
+ - artifactPaths
554
+ - warnings
555
+
556
+ Field descriptions:
557
+
558
+ - artifactKind is the versioned search result schema identifier.
559
+ - version is the schema version string.
560
+ - createdAt is an ISO 8601 timestamp.
561
+ - indexDir is the absolute path to the index artifact directory.
562
+ - query is the original query string.
563
+ - normalizedTerms contains tokenized query terms.
564
+ - limit is the requested result limit.
565
+ - results contains ranked file, symbol, and edge results.
566
+ - summary contains search coverage counts.
567
+ - artifactPaths records the artifacts used during search.
568
+ - warnings contains non-fatal warnings.
569
+
570
+ Summary fields:
571
+
572
+ - resultCount
573
+ - searchedFileCount
574
+ - searchedSymbolCount
575
+ - searchedEdgeCount
576
+
577
+ Each result includes:
578
+
579
+ - kind
580
+ - score
581
+ - matchReasons
582
+
583
+ File and symbol results include a nodeId.
584
+
585
+ Edge results include an edge ID.
586
+
587
+ Search result kinds:
588
+
589
+ - file
590
+ - symbol
591
+ - edge
592
+
593
+ Score behavior:
594
+
595
+ - score is a deterministic ranking integer
596
+ - score is not a probability
597
+ - score is not a confidence value
598
+ - score is not produced by a language model
599
+
600
+ matchReasons explain which fields matched the query and how the score was built.
601
+
602
+ Each match reason may include:
603
+
604
+ - field
605
+ - term
606
+ - weight
607
+ - text
608
+
609
+ Search reads only:
610
+
611
+ - manifest.json
612
+ - symbol-index.json
613
+ - code-graph.json
614
+
615
+ Search does not:
616
+
617
+ - read arbitrary source files
618
+ - call LLMs
619
+ - call external APIs
620
+ - use embeddings
621
+ - modify files
622
+
623
+ ## Schema limitations
624
+
625
+ Version 1.0.0 has the following schema limitations:
626
+
627
+ - Symbol end lines are not recorded.
628
+ - Symbol-mode source retrieval returns a bounded preview from the symbol start line.
629
+ - Call graph extraction is static, syntactic, and best-effort.
630
+ - Dynamic and computed call sites may not be captured.
631
+ - Python indexing is supported but conservative.
632
+ - Python call graph extraction uses ast parsing and does not execute user source.
633
+ - Search is keyword-based and deterministic.
634
+ - Semantic similarity search is not supported.
635
+ - Embedding-based retrieval is not supported.
636
+ - Lookup requires exact node IDs.
637
+ - Node IDs are stable within a single index run but may change after re-indexing if paths or symbol names change.
638
+
639
+ ## Compatibility notes
640
+
641
+ Version 1 artifact kinds may include my-dev-kit-v1 in artifactKind values.
642
+
643
+ These values should be treated as schema identifiers. They are not user-facing product names and should not be used as the package name, command name, or documentation title.
644
+
645
+ Public product identity:
646
+
647
+ - product name: my-dev-kit
648
+ - npm package: @dailephd/my-dev-kit
649
+ - CLI command: my-dev-kit
650
+
651
+ Versioned schema identifiers:
652
+
653
+ - my-dev-kit-v1-manifest
654
+ - my-dev-kit-v1-graph-slice
655
+ - my-dev-kit-v1-search-result
656
+
657
+ If artifact kinds are renamed in a future release, that change should be treated as a schema migration and documented in the changelog.
658
+
659
+ ## Practical summary
660
+
661
+ The graph schema is built around three core ideas:
662
+
663
+ - manifest.json records project and artifact metadata.
664
+ - symbol-index.json records compact per-file symbol information.
665
+ - code-graph.json records static file and symbol relationships.
666
+
667
+ Other commands consume these artifacts:
668
+
669
+ - search ranks candidate files, symbols, and edges.
670
+ - lookup expands exact graph nodes.
671
+ - source retrieves bounded source excerpts.
672
+ - slice extracts bounded graph neighborhoods.
673
+ - view renders graph output.
674
+
675
+ The artifacts are designed to be local, deterministic, inspectable, and reusable.