@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,360 @@
1
+ # Development
2
+
3
+ This document describes how to work with the my-dev-kit source repository.
4
+
5
+ For public CLI usage, see COMMANDS.md.
6
+ For release steps, see RELEASE.md.
7
+ For CI behavior, see CI_CD.md.
8
+
9
+ ## Prerequisites
10
+
11
+ Required:
12
+
13
+ - Node.js 18 or later
14
+ - npm
15
+
16
+ Required only for Python indexing tests or manual Python indexing:
17
+
18
+ - Python 3.8 or later
19
+ - python or python3 available on PATH
20
+
21
+ Optional:
22
+
23
+ - Graphviz, required only when manually testing SVG or PNG graph rendering
24
+
25
+ DOT graph output does not require Graphviz.
26
+
27
+ ## Setup
28
+
29
+ Install dependencies from the repository root:
30
+
31
+ npm ci
32
+
33
+ Build the CLI:
34
+
35
+ npm run build
36
+
37
+ Check the built CLI:
38
+
39
+ node dist/cli.js --help
40
+ node dist/cli.js --version
41
+
42
+ ## Development mode
43
+
44
+ For development without rebuilding after every source change, run the CLI through tsx:
45
+
46
+ npm run dev -- <command> <args>
47
+
48
+ Examples:
49
+
50
+ npm run dev -- --help
51
+ npm run dev -- index --root examples/basic-ts --src src --out .my-dev-kit-dev --json
52
+ npm run dev -- search --index examples/basic-ts/.my-dev-kit-dev --query user --json
53
+
54
+ The development command runs src/cli.ts directly.
55
+
56
+ ## Build
57
+
58
+ Build the distributable CLI:
59
+
60
+ npm run build
61
+
62
+ Build output:
63
+
64
+ - dist/cli.js
65
+
66
+ The build uses tsup with the repository tsup configuration.
67
+
68
+ The built CLI should start with the Node shebang:
69
+
70
+ #!/usr/bin/env node
71
+
72
+ ## Type checking
73
+
74
+ Run TypeScript type checking:
75
+
76
+ npm run typecheck
77
+
78
+ This runs tsc without emitting compiled files.
79
+
80
+ ## Tests
81
+
82
+ Run the full test suite:
83
+
84
+ npm run test
85
+
86
+ Tests are located in tests/ and are organized by subsystem.
87
+
88
+ Main test areas:
89
+
90
+ - CLI behavior
91
+ - indexing
92
+ - lookup
93
+ - source retrieval
94
+ - graph slicing
95
+ - graph viewing
96
+ - search
97
+ - security boundaries
98
+ - language adapters
99
+
100
+ Most integration tests invoke the CLI as a child process against fixture projects in examples/. Unit tests call exported functions directly.
101
+
102
+ ## Full validation
103
+
104
+ Run the full validation chain before release-related changes or package publishing:
105
+
106
+ npm run verify
107
+
108
+ The verify script runs the main local validation sequence for the repository.
109
+
110
+ If a more explicit validation sequence is needed, run:
111
+
112
+ npm run typecheck
113
+ npm run test
114
+ npm run build
115
+ npm run verify
116
+
117
+ ## Local CLI smoke test
118
+
119
+ After building, run a basic TypeScript smoke test:
120
+
121
+ node dist/cli.js index --root examples/basic-ts --src src --out .my-dev-kit-dev --call-graph --json
122
+ node dist/cli.js search --index examples/basic-ts/.my-dev-kit-dev --query user --limit 5 --json
123
+ node dist/cli.js lookup --index examples/basic-ts/.my-dev-kit-dev --node file:src/index.ts --depth 1 --json
124
+ node dist/cli.js view --index examples/basic-ts/.my-dev-kit-dev --format dot --out examples/basic-ts/.my-dev-kit-dev/graph.dot --edge-style semantic --json
125
+
126
+ Run a Python smoke test when Python is available:
127
+
128
+ node dist/cli.js index --root examples/basic-python --src src --language python --out .my-dev-kit-dev --json
129
+ node dist/cli.js search --index examples/basic-python/.my-dev-kit-dev --query greet --limit 5 --json
130
+
131
+ Clean up local smoke-test artifacts:
132
+
133
+ node -e "require('fs').rmSync('examples/basic-ts/.my-dev-kit-dev', { recursive: true, force: true })"
134
+ node -e "require('fs').rmSync('examples/basic-python/.my-dev-kit-dev', { recursive: true, force: true })"
135
+
136
+ ## Local tarball testing
137
+
138
+ Use local tarball testing to verify installed-package behavior before publishing.
139
+
140
+ Build and pack the package:
141
+
142
+ npm run build
143
+ npm pack
144
+
145
+ Install the tarball globally:
146
+
147
+ npm install -g ./dailephd-my-dev-kit-1.0.0.tgz
148
+
149
+ Run installed CLI checks:
150
+
151
+ my-dev-kit --help
152
+ my-dev-kit --version
153
+
154
+ Run an installed CLI smoke test:
155
+
156
+ my-dev-kit index --root examples/basic-ts --src src --out .my-dev-kit-release --call-graph --json
157
+ my-dev-kit search --index examples/basic-ts/.my-dev-kit-release --query user --limit 5 --json
158
+ my-dev-kit view --index examples/basic-ts/.my-dev-kit-release --format dot --out examples/basic-ts/.my-dev-kit-release/graph.dot --edge-style semantic --json
159
+
160
+ Clean up smoke-test artifacts:
161
+
162
+ node -e "require('fs').rmSync('examples/basic-ts/.my-dev-kit-release', { recursive: true, force: true })"
163
+
164
+ Uninstall the local package after testing:
165
+
166
+ npm uninstall -g @dailephd/my-dev-kit
167
+
168
+ ## npm scripts
169
+
170
+ Common scripts:
171
+
172
+ - npm run build
173
+ Builds src/cli.ts into dist/cli.js.
174
+
175
+ - npm run dev -- <args>
176
+ Runs the CLI from source through tsx.
177
+
178
+ - npm run typecheck
179
+ Runs TypeScript type checking without emitting files.
180
+
181
+ - npm run test
182
+ Runs all tests with Vitest.
183
+
184
+ - npm run verify
185
+ Runs the main validation chain.
186
+
187
+ - npm run clean
188
+ Removes dist/.
189
+
190
+ ## Source layout
191
+
192
+ Main source directories:
193
+
194
+ - src/cli.ts
195
+ CLI entry point.
196
+
197
+ - src/commands/
198
+ One command module per public CLI command.
199
+
200
+ - src/indexing/
201
+ Index orchestration, source discovery, artifact writing, and artifact loading.
202
+
203
+ - src/languages/
204
+ Language adapter registry and language-specific adapters.
205
+
206
+ - src/languages/typescript/
207
+ TypeScript, TSX, JavaScript, and JSX indexing support.
208
+
209
+ - src/languages/python/
210
+ Python indexing support through Python AST extraction.
211
+
212
+ - src/symbol-index/
213
+ Per-file symbol table construction.
214
+
215
+ - src/graph/
216
+ Code graph types, graph slicing support, DOT generation, and Graphviz rendering.
217
+
218
+ - src/lookup/
219
+ Node lookup, source target resolution, source slicing, and traversal behavior.
220
+
221
+ - src/search/
222
+ Deterministic keyword search over index artifacts.
223
+
224
+ - src/source/
225
+ Source output rendering.
226
+
227
+ - src/io/
228
+ Shared file-system and JSON I/O helpers.
229
+
230
+ - src/version.ts
231
+ CLI version constant.
232
+
233
+ ## Test layout
234
+
235
+ Main test directories:
236
+
237
+ - tests/cli/
238
+ Command registration and CLI behavior.
239
+
240
+ - tests/index/
241
+ Indexing, manifest writing, artifact writing, and source discovery.
242
+
243
+ - tests/lookup/
244
+ Lookup behavior, source retrieval, source rendering, and graph slice behavior.
245
+
246
+ - tests/view/
247
+ DOT generation and graph view behavior.
248
+
249
+ - tests/search/
250
+ Search behavior and search ranking.
251
+
252
+ - tests/security/
253
+ Security boundary regression tests.
254
+
255
+ Security tests cover:
256
+
257
+ - path traversal protection
258
+ - artifact path validation
259
+ - malformed artifact handling
260
+ - DOT escaping
261
+ - output path behavior
262
+ - traversal depth limits
263
+ - output size limits
264
+
265
+ ## Example projects
266
+
267
+ The examples directory contains fixture projects used by tests, documentation, and smoke checks.
268
+
269
+ Included examples:
270
+
271
+ - examples/basic-ts/
272
+ TypeScript example project.
273
+
274
+ - examples/basic-python/
275
+ Python example project.
276
+
277
+ The package may include selected example source folders for public smoke tests. Development-only generated artifacts under examples should not be committed or published.
278
+
279
+ ## Generated files
280
+
281
+ Common generated directories and files:
282
+
283
+ - dist/
284
+ Build output. Included in the npm package.
285
+
286
+ - examples/basic-ts/.my-dev-kit-*/
287
+ Local or CI index artifacts. Not committed.
288
+
289
+ - examples/basic-python/.my-dev-kit-*/
290
+ Local or CI index artifacts. Not committed.
291
+
292
+ - *.tgz
293
+ Local npm package tarballs. Not committed.
294
+
295
+ Generated index artifacts should be treated as disposable unless a specific test fixture intentionally requires one.
296
+
297
+ ## Package contents
298
+
299
+ The published npm package should include:
300
+
301
+ - dist/
302
+ - README.md
303
+ - LICENSE
304
+ - CHANGELOG.md
305
+ - public documentation files
306
+ - public examples intended for users
307
+ - package.json
308
+
309
+ The published npm package should not include:
310
+
311
+ - src/
312
+ - tests/
313
+ - node_modules/
314
+ - generated index artifacts
315
+ - local smoke-test folders
316
+ - alpha-import/
317
+ - private planning notes
318
+ - temporary migration files
319
+
320
+ Use npm pack --dry-run to inspect package contents before publishing.
321
+
322
+ ## Python development notes
323
+
324
+ Python indexing uses a subprocess and AST extraction scripts.
325
+
326
+ The adapter checks for:
327
+
328
+ - python
329
+ - python3
330
+
331
+ Python files are parsed but not executed.
332
+
333
+ When Python is not available, Python indexing may be skipped with a warning depending on the command path. TypeScript and JavaScript indexing should continue to work independently.
334
+
335
+ ## Graphviz development notes
336
+
337
+ DOT output is generated directly and does not require Graphviz.
338
+
339
+ SVG and PNG rendering require the Graphviz dot executable.
340
+
341
+ Use DOT output for cross-platform CI smoke tests:
342
+
343
+ node dist/cli.js view --index examples/basic-ts/.my-dev-kit-dev --format dot --out examples/basic-ts/.my-dev-kit-dev/graph.dot
344
+
345
+ Use SVG or PNG manually when Graphviz is installed:
346
+
347
+ node dist/cli.js view --index examples/basic-ts/.my-dev-kit-dev --format svg --out examples/basic-ts/.my-dev-kit-dev/graph.svg
348
+ node dist/cli.js view --index examples/basic-ts/.my-dev-kit-dev --format png --out examples/basic-ts/.my-dev-kit-dev/graph.png
349
+
350
+ ## Release preparation
351
+
352
+ Before publishing a release:
353
+
354
+ npm ci
355
+ npm run verify
356
+ npm pack --dry-run
357
+
358
+ Then follow RELEASE.md.
359
+
360
+ Do not publish from an unverified working tree.