@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,684 @@
1
+ # Commands
2
+
3
+ my-dev-kit provides six public CLI commands:
4
+
5
+ - index
6
+ - search
7
+ - lookup
8
+ - source
9
+ - slice
10
+ - view
11
+
12
+ Use this document as the command reference for the installed CLI.
13
+
14
+ For usage workflows, see WORKFLOWS.md.
15
+ For graph artifact details, see GRAPH_SCHEMA.md.
16
+ For internal architecture, see ARCHITECTURE.md.
17
+
18
+ ## Installation
19
+
20
+ Install the package globally:
21
+
22
+ npm install -g @dailephd/my-dev-kit
23
+
24
+ Check that the CLI is available:
25
+
26
+ my-dev-kit --help
27
+ my-dev-kit --version
28
+
29
+ ## Path conventions
30
+
31
+ Most workflows follow this pattern:
32
+
33
+ my-dev-kit index --root . --src src --out .my-dev-kit --json
34
+ my-dev-kit search --index .my-dev-kit --query "service" --json
35
+ my-dev-kit lookup --index .my-dev-kit --node "file:src/index.ts" --json
36
+ my-dev-kit source --index .my-dev-kit --file src/index.ts --start 1 --end 40 --format numbered
37
+ my-dev-kit slice --index .my-dev-kit --node "file:src/index.ts" --depth 1 --json
38
+ my-dev-kit view --index .my-dev-kit --format dot --out .my-dev-kit/graph.dot
39
+
40
+ Path rules:
41
+
42
+ - Run commands from your project root unless you intentionally pass another root.
43
+ - index uses --root to define the project root.
44
+ - index resolves --src paths relative to --root.
45
+ - index resolves --out relative to --root.
46
+ - Read commands use --index to point at the artifact directory created by index.
47
+ - Node IDs must be exact.
48
+ - Use search to find node IDs before calling lookup, source, slice, or view.
49
+
50
+ Recommended artifact directory:
51
+
52
+ .my-dev-kit
53
+
54
+ ## index
55
+
56
+ Index local source files and write graph artifacts.
57
+
58
+ Supported languages:
59
+
60
+ - TypeScript
61
+ - JavaScript
62
+ - Python
63
+
64
+ Supported source extensions:
65
+
66
+ - .ts
67
+ - .tsx
68
+ - .js
69
+ - .jsx
70
+ - .py
71
+
72
+ ### Usage
73
+
74
+ my-dev-kit index --root <project-root> --src <source-root> --out <artifact-dir>
75
+
76
+ ### Flags
77
+
78
+ - --root <path>
79
+ Project root. Source roots and output paths are resolved relative to this path.
80
+
81
+ - --src <path>
82
+ Source root to index, relative to --root. May be repeated. Required.
83
+
84
+ - --language <language>
85
+ Language hint. Supported values are typescript, javascript, and python. When omitted, language is inferred from file extensions.
86
+
87
+ - --out <dir>
88
+ Output directory for index artifacts, relative to --root.
89
+
90
+ - --exclude <path-or-name>
91
+ Directory name or relative path prefix to exclude. May be repeated. This is path/name based, not glob based.
92
+
93
+ - --dry-run
94
+ Scan and report what would be indexed without writing artifacts.
95
+
96
+ - --progress
97
+ Print bounded progress diagnostics to stderr.
98
+
99
+ - --call-graph
100
+ Write call-graph.json using conservative static call analysis when supported.
101
+
102
+ - --json
103
+ Print JSON result to stdout.
104
+
105
+ ### Default ignored directories
106
+
107
+ The indexer skips common dependency, generated, build, and cache directories before reading files from them.
108
+
109
+ Default ignored directory names include:
110
+
111
+ - node_modules
112
+ - .next
113
+ - dist
114
+ - build
115
+ - coverage
116
+ - playwright-report
117
+ - test-results
118
+ - output
119
+ - out
120
+ - .cache
121
+ - .turbo
122
+ - .vercel
123
+ - .git
124
+ - .pytest_cache
125
+ - __pycache__
126
+ - .venv
127
+ - venv
128
+
129
+ The --exclude flag adds extra directory names or relative path prefixes.
130
+
131
+ Examples:
132
+
133
+ --exclude generated
134
+
135
+ Skips any directory segment named generated.
136
+
137
+ --exclude apps/web/.next
138
+
139
+ Skips that relative path prefix.
140
+
141
+ ### Artifacts
142
+
143
+ index writes the following files inside --out:
144
+
145
+ - manifest.json
146
+ - symbol-index.json
147
+ - code-graph.json
148
+
149
+ When --call-graph is requested and call graph data is available, index also writes:
150
+
151
+ - call-graph.json
152
+
153
+ ### Examples
154
+
155
+ Index the current project:
156
+
157
+ my-dev-kit index --root . --src src --out .my-dev-kit --json
158
+
159
+ Index with call graph generation:
160
+
161
+ my-dev-kit index --root . --src src --out .my-dev-kit --call-graph --json
162
+
163
+ Index a Python project:
164
+
165
+ my-dev-kit index --root . --src src --language python --out .my-dev-kit --json
166
+
167
+ Index multiple source roots:
168
+
169
+ my-dev-kit index --root . --src src --src tests --out .my-dev-kit --json
170
+
171
+ Preview a scan without writing artifacts:
172
+
173
+ my-dev-kit index --root . --src apps/web --out .my-dev-kit-web --exclude .next --exclude coverage --dry-run --json
174
+
175
+ Show progress while keeping JSON output clean on stdout:
176
+
177
+ my-dev-kit index --root . --src apps/web/app --src apps/web/lib --out .my-dev-kit-web --progress --json
178
+
179
+ Index targeted folders in a large monorepo:
180
+
181
+ my-dev-kit index --root . --src apps/web/app --src apps/web/lib --src apps/web/prisma --out .my-dev-kit-web --call-graph --json
182
+
183
+ Split indexes by area:
184
+
185
+ my-dev-kit index --root . --src apps/web/app --src apps/web/lib --src apps/web/prisma --out .my-dev-kit-web --call-graph --json
186
+ my-dev-kit index --root . --src apps/web/tests --src apps/web/e2e --out .my-dev-kit-web-tests --exclude playwright-report --exclude test-results --json
187
+ my-dev-kit index --root . --src apps/nlp-service/src --language python --out .my-dev-kit-nlp --call-graph --json
188
+ my-dev-kit index --root . --src scripts --out .my-dev-kit-scripts --json
189
+
190
+ ### Python behavior
191
+
192
+ Python indexing requires Python 3.8 or later on PATH as python or python3.
193
+
194
+ Python extraction supports:
195
+
196
+ - top-level functions
197
+ - async top-level functions
198
+ - top-level classes
199
+ - ALL_CAPS constants
200
+ - Final-annotated constants
201
+ - imports
202
+ - __all__ when defined as a plain list
203
+
204
+ Python export behavior:
205
+
206
+ - symbols are considered exported unless their name starts with _
207
+ - if __all__ is defined as a plain list, only names in __all__ are marked exported
208
+
209
+ Python call graph extraction uses static AST parsing. It records conservative call edges for straightforward calls such as:
210
+
211
+ - foo()
212
+ - self.foo()
213
+ - module.foo()
214
+ - ClassName.method()
215
+
216
+ Python source files are parsed but not executed.
217
+
218
+ ## search
219
+
220
+ Search indexed files, symbols, and graph edges by keyword.
221
+
222
+ ### Usage
223
+
224
+ my-dev-kit search --index <artifact-dir> --query <text>
225
+
226
+ ### Flags
227
+
228
+ - --index <dir>
229
+ Index artifact directory.
230
+
231
+ - --query <text>
232
+ Search query text. Required.
233
+
234
+ - --limit <n>
235
+ Maximum number of results. Valid range is 1 through 100.
236
+
237
+ - --json
238
+ Print JSON result to stdout.
239
+
240
+ ### Searched fields
241
+
242
+ search checks:
243
+
244
+ - file paths
245
+ - file labels
246
+ - file node IDs
247
+ - symbol node IDs
248
+ - symbol names
249
+ - symbol kinds
250
+ - imported module paths
251
+ - exported symbol names
252
+ - dependency paths
253
+ - edge kinds
254
+ - edge endpoints
255
+ - neighboring node labels
256
+
257
+ ### Behavior
258
+
259
+ - Search is local.
260
+ - Search is deterministic.
261
+ - Search is keyword-based.
262
+ - Multi-word queries match results containing any query term.
263
+ - Result scores are deterministic ranking values.
264
+ - Scores are not probabilities or confidence values.
265
+ - Search does not call LLMs.
266
+ - Search does not use embeddings.
267
+ - Search does not read arbitrary source files.
268
+ - Search does not modify project files.
269
+
270
+ ### Examples
271
+
272
+ Search for service-related files or symbols:
273
+
274
+ my-dev-kit search --index .my-dev-kit --query "service" --limit 20 --json
275
+
276
+ Search for a known symbol name:
277
+
278
+ my-dev-kit search --index .my-dev-kit --query "formatUser" --json
279
+
280
+ Search for import or export related matches:
281
+
282
+ my-dev-kit search --index .my-dev-kit --query "imports exports" --limit 10 --json
283
+
284
+ ## lookup
285
+
286
+ Look up a graph node by exact node ID.
287
+
288
+ ### Usage
289
+
290
+ my-dev-kit lookup --index <artifact-dir> --node <node-id>
291
+
292
+ ### Flags
293
+
294
+ - --index <dir>
295
+ Index artifact directory.
296
+
297
+ - --node <node-id>
298
+ Exact node ID. Required.
299
+
300
+ - --depth <n>
301
+ Neighbor expansion depth. Valid range is 0 through 3.
302
+
303
+ - --json
304
+ Print JSON result to stdout.
305
+
306
+ ### Behavior
307
+
308
+ - lookup is exact-match only.
309
+ - Depth 0 returns only the focus node.
310
+ - Depth 1 through 3 expands neighbors breadth-first.
311
+ - Lookup includes incoming edges, outgoing edges, and neighboring nodes.
312
+ - Partial matching and fuzzy matching are not supported.
313
+ - Use search first when the exact node ID is unknown.
314
+
315
+ ### Node ID formats
316
+
317
+ File node:
318
+
319
+ file:<relative-path>
320
+
321
+ Example:
322
+
323
+ file:src/index.ts
324
+
325
+ Symbol node:
326
+
327
+ symbol:<relative-path>#<symbol-name>
328
+
329
+ Example:
330
+
331
+ symbol:src/index.ts#describeUser
332
+
333
+ ### Examples
334
+
335
+ Look up a file node:
336
+
337
+ my-dev-kit lookup --index .my-dev-kit --node "file:src/index.ts" --depth 1 --json
338
+
339
+ Look up a symbol node:
340
+
341
+ my-dev-kit lookup --index .my-dev-kit --node "symbol:src/index.ts#describeUser" --depth 2 --json
342
+
343
+ ## source
344
+
345
+ Retrieve bounded source content from an indexed project.
346
+
347
+ ### Usage
348
+
349
+ source supports three retrieval modes.
350
+
351
+ Retrieve by node ID:
352
+
353
+ my-dev-kit source --index <artifact-dir> --node <node-id>
354
+
355
+ Retrieve by file line range:
356
+
357
+ my-dev-kit source --index <artifact-dir> --file <path> --start <n> --end <n>
358
+
359
+ Retrieve by symbol name inside a file:
360
+
361
+ my-dev-kit source --index <artifact-dir> --file <path> --symbol <name>
362
+
363
+ Use one retrieval mode per command.
364
+
365
+ ### Flags
366
+
367
+ - --index <dir>
368
+ Index artifact directory.
369
+
370
+ - --node <node-id>
371
+ File or symbol node ID.
372
+
373
+ - --file <path>
374
+ Source file path relative to the indexed project root.
375
+
376
+ - --start <n>
377
+ Start line for line-range retrieval.
378
+
379
+ - --end <n>
380
+ End line for line-range retrieval.
381
+
382
+ - --symbol <name>
383
+ Symbol name to retrieve from the selected file.
384
+
385
+ - --max-lines <n>
386
+ Maximum number of lines to return.
387
+
388
+ - --format <json|plain|numbered>
389
+ Output format.
390
+
391
+ - --out <path>
392
+ Write rendered output to a file.
393
+
394
+ - --json
395
+ Alias for --format json.
396
+
397
+ ### Output formats
398
+
399
+ - json
400
+ Structured result with metadata.
401
+
402
+ - plain
403
+ Retrieved source content only.
404
+
405
+ - numbered
406
+ Retrieved source content with source line numbers.
407
+
408
+ ### Safety behavior
409
+
410
+ source enforces:
411
+
412
+ - project-root containment
413
+ - path traversal rejection
414
+ - valid line ranges
415
+ - max-lines limits
416
+ - read-only source access
417
+
418
+ source never modifies source files.
419
+
420
+ ### Symbol retrieval limitation
421
+
422
+ The current index records symbol start lines but not complete symbol end lines.
423
+
424
+ Because of this, symbol retrieval returns a bounded preview from the symbol start line and may include a warning. Use explicit line-range retrieval when exact bounds are required.
425
+
426
+ ### Examples
427
+
428
+ Retrieve a numbered source range:
429
+
430
+ my-dev-kit source --index .my-dev-kit --file src/index.ts --start 1 --end 40 --format numbered
431
+
432
+ Retrieve a symbol preview:
433
+
434
+ my-dev-kit source --index .my-dev-kit --file src/index.ts --symbol describeUser --format numbered
435
+
436
+ Retrieve by node ID:
437
+
438
+ my-dev-kit source --index .my-dev-kit --node "file:src/index.ts" --format json
439
+
440
+ Write source output to a file:
441
+
442
+ my-dev-kit source --index .my-dev-kit --file src/index.ts --start 1 --end 40 --format plain --out output/index.ts
443
+
444
+ ## slice
445
+
446
+ Build a bounded graph neighborhood around a focus node.
447
+
448
+ ### Usage
449
+
450
+ my-dev-kit slice --index <artifact-dir> --node <node-id>
451
+
452
+ ### Flags
453
+
454
+ - --index <dir>
455
+ Index artifact directory.
456
+
457
+ - --node <node-id>
458
+ Focus node ID. Required.
459
+
460
+ - --depth <n>
461
+ Traversal depth. Valid range is 0 through 3.
462
+
463
+ - --direction <both|incoming|outgoing>
464
+ Traversal direction.
465
+
466
+ - --out <path>
467
+ Write JSON slice artifact to a file.
468
+
469
+ - --json
470
+ Print JSON result to stdout.
471
+
472
+ ### Behavior
473
+
474
+ - Depth 0 returns only the focus node.
475
+ - Depth 1 through 3 expands breadth-first.
476
+ - Direction controls whether incoming edges, outgoing edges, or both are followed.
477
+ - The result includes focus node, included nodes, included edges, and summary counts.
478
+ - slice reads graph artifacts only.
479
+ - slice does not read source files.
480
+ - slice does not require Graphviz.
481
+
482
+ ### Examples
483
+
484
+ Slice one hop around a file:
485
+
486
+ my-dev-kit slice --index .my-dev-kit --node "file:src/index.ts" --depth 1 --json
487
+
488
+ Slice two hops in both directions:
489
+
490
+ my-dev-kit slice --index .my-dev-kit --node "file:src/index.ts" --depth 2 --direction both --json
491
+
492
+ Write a slice artifact:
493
+
494
+ my-dev-kit slice --index .my-dev-kit --node "file:src/index.ts" --depth 1 --direction incoming --out .my-dev-kit/slice.json
495
+
496
+ ## view
497
+
498
+ Render code-graph.json as DOT, SVG, or PNG.
499
+
500
+ ### Usage
501
+
502
+ my-dev-kit view --index <artifact-dir> --format <dot|svg|png> --out <path>
503
+
504
+ ### Flags
505
+
506
+ - --index <dir>
507
+ Index artifact directory.
508
+
509
+ - --format <dot|svg|png>
510
+ Output format.
511
+
512
+ - --out <path>
513
+ Output path.
514
+
515
+ - --edge-style <semantic|labeled|minimal>
516
+ Edge visualization style.
517
+
518
+ - --allow-dot-fallback
519
+ For SVG or PNG requests, write DOT instead of failing when Graphviz is unavailable.
520
+
521
+ - --json
522
+ Print JSON result to stdout.
523
+
524
+ ### Edge styles
525
+
526
+ semantic:
527
+
528
+ - applies distinct DOT marker and line-style attributes per edge kind
529
+ - emits a legend
530
+
531
+ labeled:
532
+
533
+ - emits inline edge labels
534
+
535
+ minimal:
536
+
537
+ - emits edges without labels, attributes, or legend
538
+
539
+ ### Graphviz behavior
540
+
541
+ - DOT output does not require Graphviz.
542
+ - SVG output requires the Graphviz dot executable.
543
+ - PNG output requires the Graphviz dot executable.
544
+ - If Graphviz is unavailable and --allow-dot-fallback is used, DOT is written instead of the requested SVG or PNG.
545
+
546
+ ### Examples
547
+
548
+ Write DOT output:
549
+
550
+ my-dev-kit view --index .my-dev-kit --format dot --out .my-dev-kit/graph.dot
551
+
552
+ Write labeled DOT output:
553
+
554
+ my-dev-kit view --index .my-dev-kit --format dot --edge-style labeled --out .my-dev-kit/graph.labeled.dot
555
+
556
+ Write minimal DOT output:
557
+
558
+ my-dev-kit view --index .my-dev-kit --format dot --edge-style minimal --out .my-dev-kit/graph.minimal.dot
559
+
560
+ Write SVG output:
561
+
562
+ my-dev-kit view --index .my-dev-kit --format svg --out .my-dev-kit/graph.svg
563
+
564
+ Request SVG but fall back to DOT if Graphviz is unavailable:
565
+
566
+ my-dev-kit view --index .my-dev-kit --format svg --allow-dot-fallback --out .my-dev-kit/graph.dot
567
+
568
+ ## Recommended graph-guided retrieval workflow
569
+
570
+ Use this workflow when preparing context for a coding task.
571
+
572
+ ### 1. Build the index
573
+
574
+ my-dev-kit index --root . --src src --out .my-dev-kit --call-graph --json
575
+
576
+ ### 2. Search for candidate files or symbols
577
+
578
+ my-dev-kit search --index .my-dev-kit --query "<task term>" --limit 20 --json
579
+
580
+ ### 3. Look up the strongest node
581
+
582
+ my-dev-kit lookup --index .my-dev-kit --node "<node-id>" --depth 1 --json
583
+
584
+ ### 4. Slice the graph around the strongest node
585
+
586
+ my-dev-kit slice --index .my-dev-kit --node "<node-id>" --depth 2 --direction both --out .my-dev-kit/task-slice.json
587
+
588
+ ### 5. Retrieve bounded source
589
+
590
+ Retrieve by symbol when possible:
591
+
592
+ my-dev-kit source --index .my-dev-kit --file "<path>" --symbol "<symbol-name>" --format numbered
593
+
594
+ Use line-range retrieval when exact bounds are needed:
595
+
596
+ my-dev-kit source --index .my-dev-kit --file "<path>" --start <n> --end <n> --format numbered
597
+
598
+ ### 6. Render the graph when useful
599
+
600
+ my-dev-kit view --index .my-dev-kit --format dot --out .my-dev-kit/graph.dot --edge-style semantic
601
+
602
+ ## Bundled examples
603
+
604
+ The bundled examples are useful for smoke tests and learning the command flow.
605
+
606
+ Index the TypeScript example:
607
+
608
+ my-dev-kit index --root examples/basic-ts --src src --out .my-dev-kit --json
609
+
610
+ Search the TypeScript example:
611
+
612
+ my-dev-kit search --index examples/basic-ts/.my-dev-kit --query "service" --limit 5 --json
613
+
614
+ Index the Python example:
615
+
616
+ my-dev-kit index --root examples/basic-python --src src --language python --out .my-dev-kit --json
617
+
618
+ Search the Python example:
619
+
620
+ my-dev-kit search --index examples/basic-python/.my-dev-kit --query "greet" --limit 5 --json
621
+
622
+ ## Troubleshooting
623
+
624
+ ### Missing index manifest
625
+
626
+ Run index first or check the --index path.
627
+
628
+ Example:
629
+
630
+ my-dev-kit index --root . --src src --out .my-dev-kit --json
631
+
632
+ Then use:
633
+
634
+ --index .my-dev-kit
635
+
636
+ ### Unknown node ID
637
+
638
+ Use search to find valid node IDs.
639
+
640
+ my-dev-kit search --index .my-dev-kit --query "<name>" --limit 20 --json
641
+
642
+ ### Symbol not found
643
+
644
+ Check the symbol name and file path.
645
+
646
+ Use search to confirm the symbol was indexed:
647
+
648
+ my-dev-kit search --index .my-dev-kit --query "<symbol-name>" --json
649
+
650
+ ### Range exceeds max-lines
651
+
652
+ Reduce the requested range or increase --max-lines.
653
+
654
+ ### Graphviz not found
655
+
656
+ DOT output does not require Graphviz.
657
+
658
+ Use DOT output:
659
+
660
+ my-dev-kit view --index .my-dev-kit --format dot --out .my-dev-kit/graph.dot
661
+
662
+ Or allow DOT fallback for SVG or PNG requests:
663
+
664
+ my-dev-kit view --index .my-dev-kit --format svg --allow-dot-fallback --out .my-dev-kit/graph.dot
665
+
666
+ ### Python interpreter not found
667
+
668
+ Install Python 3.8 or later and ensure python or python3 is available on PATH.
669
+
670
+ Python indexing checks both command names automatically.
671
+
672
+ ### Empty or unexpectedly small index
673
+
674
+ Check:
675
+
676
+ - --root points to the intended project root
677
+ - --src points to real source folders
678
+ - default ignored directories are not hiding the intended files
679
+ - --exclude is not too broad
680
+ - --language matches the source files, if provided
681
+
682
+ Use dry-run to inspect what would be indexed:
683
+
684
+ my-dev-kit index --root . --src src --out .my-dev-kit --dry-run --json