@rahmantech/knl-view 0.1.0 → 0.3.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 (98) hide show
  1. package/README.md +133 -32
  2. package/bin/knl-view.js +591 -58
  3. package/dist/assets/{abnfDiagram-WEYOIA3C-B1gaBaSI.js → abnfDiagram-WEYOIA3C-hoSbsMOz.js} +1 -1
  4. package/dist/assets/{arc-NZ9uRaCl.js → arc-g87Np6E5.js} +1 -1
  5. package/dist/assets/{architecture-WOLXFQ4H-8MalLwTd.js → architecture-WOLXFQ4H-DOIq-0IA.js} +1 -1
  6. package/dist/assets/{architectureDiagram-ZHVYKT53-eZ8i5cl4.js → architectureDiagram-ZHVYKT53-Dxwe8n7m.js} +1 -1
  7. package/dist/assets/{blockDiagram-RJAE7QA3-BavOE8BM.js → blockDiagram-RJAE7QA3-BnGng59Z.js} +1 -1
  8. package/dist/assets/{c4Diagram-XDPPPE54-DqMaTAzx.js → c4Diagram-XDPPPE54-C5LjqIIo.js} +1 -1
  9. package/dist/assets/channel-BVWkRFBw.js +1 -0
  10. package/dist/assets/{chunk-2E7WHVMD-B1Hj2BjJ.js → chunk-2E7WHVMD-BJ1dyGLq.js} +1 -1
  11. package/dist/assets/{chunk-4EMNKR2T-HDscrCiq.js → chunk-4EMNKR2T-DXF02Sgw.js} +1 -1
  12. package/dist/assets/{chunk-55XCU76K-QR_ARj8I.js → chunk-55XCU76K-CM1akAbu.js} +1 -1
  13. package/dist/assets/{chunk-7S6XSTFO-B0p3o547.js → chunk-7S6XSTFO-BOUjqldL.js} +1 -1
  14. package/dist/assets/{chunk-AQDTSKZB-CCxwNyyA.js → chunk-AQDTSKZB-C4isdNLA.js} +1 -1
  15. package/dist/assets/{chunk-DSNLSHJZ-BM5PBFmz.js → chunk-DSNLSHJZ-CbOTkSVM.js} +1 -1
  16. package/dist/assets/{chunk-HAGFOTED-UCDVFuN_.js → chunk-HAGFOTED-CRfnketR.js} +1 -1
  17. package/dist/assets/{chunk-HNE4Q36P-C_1sakp2.js → chunk-HNE4Q36P-rxlpGUU8.js} +1 -1
  18. package/dist/assets/{chunk-NQOKRVIF-b2D1Z4oK.js → chunk-NQOKRVIF-BOYCgTmV.js} +1 -1
  19. package/dist/assets/{chunk-UHW7PFBP-CJs0VwBY.js → chunk-UHW7PFBP-Cnogp1Fb.js} +1 -1
  20. package/dist/assets/{chunk-VQ5W62QI-DQxjgE4_.js → chunk-VQ5W62QI-Cu1WY5Uo.js} +1 -1
  21. package/dist/assets/{chunk-WQQL4CDK-DcjPeAfQ.js → chunk-WQQL4CDK-BJc3FPE2.js} +1 -1
  22. package/dist/assets/{chunk-XXDRQBXY-glA0kB5s.js → chunk-XXDRQBXY-BlPj4H7s.js} +1 -1
  23. package/dist/assets/{chunk-YZO67HFG-DJqACL5V.js → chunk-YZO67HFG-V85H31x4.js} +1 -1
  24. package/dist/assets/{chunk-ZAUX2LTX-CWfaYtwb.js → chunk-ZAUX2LTX-C3XKXW09.js} +1 -1
  25. package/dist/assets/{chunk-ZCHMQSOR-BGX73Hho.js → chunk-ZCHMQSOR-B0mmpEgW.js} +1 -1
  26. package/dist/assets/{classDiagram-v2-4MYWR3UA-BpYXPz-e.js → classDiagram-v2-4MYWR3UA-oMd7YaHP.js} +1 -1
  27. package/dist/assets/{cose-bilkent-JH36ORCC-e1quKm0Q.js → cose-bilkent-JH36ORCC-J0kSVsDf.js} +1 -1
  28. package/dist/assets/{cynefin-EF2NZ3EQ-hb3oUmFO.js → cynefin-EF2NZ3EQ-DK2TNhel.js} +1 -1
  29. package/dist/assets/{cynefinDiagram-WF24UDRP-CnMQvLqi.js → cynefinDiagram-WF24UDRP-DDvKgieA.js} +1 -1
  30. package/dist/assets/{dagre-NK4GIZVX-BH_Y8y3F.js → dagre-NK4GIZVX-Ca2Fe-i-.js} +1 -1
  31. package/dist/assets/{diagram-CBK3MWTC-Dh79VetZ.js → diagram-CBK3MWTC-L6dmeQ2V.js} +1 -1
  32. package/dist/assets/{diagram-I5XIIV2D-D3u-o1RV.js → diagram-I5XIIV2D-DhG8R-v5.js} +1 -1
  33. package/dist/assets/{diagram-ODIL2UCW-Bfuo-OKS.js → diagram-ODIL2UCW-BpYYbYBT.js} +1 -1
  34. package/dist/assets/{diagram-PFBEJUXE-CwHasIbs.js → diagram-PFBEJUXE-DKQpHSsC.js} +1 -1
  35. package/dist/assets/{diagram-RJA3I4VV-D8ttmuE8.js → diagram-RJA3I4VV-DP7Dsnya.js} +1 -1
  36. package/dist/assets/{diagram-TYUNFSNR-CzC-8RZ0.js → diagram-TYUNFSNR-CfSFewUS.js} +1 -1
  37. package/dist/assets/{dist-CUJYGnnI.js → dist-CQNjnrld.js} +1 -1
  38. package/dist/assets/{ebnfDiagram-V4P3TTPT-9AAhU7In.js → ebnfDiagram-V4P3TTPT-DE3MZoJO.js} +1 -1
  39. package/dist/assets/{elk-QONTBCTQ-BgvnD1v_.js → elk-QONTBCTQ-p_aAQPHU.js} +1 -1
  40. package/dist/assets/{erDiagram-KYQIGQAA-RLtbiLlP.js → erDiagram-KYQIGQAA-DZO3vQrk.js} +1 -1
  41. package/dist/assets/{eventmodeling-K75KTNOO-DVY22vNZ.js → eventmodeling-K75KTNOO-BII9EPl5.js} +1 -1
  42. package/dist/assets/flowDiagram-IUGLLWBU-D9uPno39.js +1 -0
  43. package/dist/assets/{ganttDiagram-R7GPNTJY-hHiBGa9W.js → ganttDiagram-R7GPNTJY-BKiH3v2r.js} +1 -1
  44. package/dist/assets/{gitGraph-VSP46ZUC-Cvxay1wh.js → gitGraph-VSP46ZUC-oHL6cr73.js} +1 -1
  45. package/dist/assets/{gitGraphDiagram-PDYL7XHY-AOhlpSqg.js → gitGraphDiagram-PDYL7XHY-CqPVIEeo.js} +1 -1
  46. package/dist/assets/{index-CBLNQvK3.js → index-CSpirV16.js} +3 -3
  47. package/dist/assets/{info-OHQRW6UA-CJ8EUO1m.js → info-OHQRW6UA-Drrbnhpd.js} +1 -1
  48. package/dist/assets/{infoDiagram-MVDRKAX5-DOQu7oYI.js → infoDiagram-MVDRKAX5-DnQQFMAd.js} +1 -1
  49. package/dist/assets/{ishikawaDiagram-HPEHV2GE-DcVMvGmx.js → ishikawaDiagram-HPEHV2GE-DIpQlxRh.js} +1 -1
  50. package/dist/assets/{journeyDiagram-BOSHW7O7-luMeqEqz.js → journeyDiagram-BOSHW7O7-EBR9I5h1.js} +1 -1
  51. package/dist/assets/{kanban-definition-FNSA4HC5-KTZbmrW2.js → kanban-definition-FNSA4HC5-CdvNsjik.js} +1 -1
  52. package/dist/assets/{line-CmPHiOVm.js → line-CDLzgxDc.js} +1 -1
  53. package/dist/assets/{linear-DHYlKXBA.js → linear-DfXKql9u.js} +1 -1
  54. package/dist/assets/{mermaid-parser.core-BRDI-WhC.js → mermaid-parser.core-DnXGphT2.js} +3 -3
  55. package/dist/assets/{mermaid.core-DPTRaYLy.js → mermaid.core-h6fiCaSZ.js} +4 -4
  56. package/dist/assets/{mindmap-definition-6OY57UG3-70EN5Kw_.js → mindmap-definition-6OY57UG3-BiNfio-j.js} +1 -1
  57. package/dist/assets/{packet-JDAUHWVQ-CXWz83oS.js → packet-JDAUHWVQ-D76byv1S.js} +1 -1
  58. package/dist/assets/{pegDiagram-ECIUJNBX-z5UXKmp4.js → pegDiagram-ECIUJNBX-Drs8Pxdt.js} +1 -1
  59. package/dist/assets/{pie-XZMESJXO-rWI1HIQ7.js → pie-XZMESJXO-D_83z1lM.js} +1 -1
  60. package/dist/assets/{pieDiagram-GNMPY74T-Bh4Kv3NQ.js → pieDiagram-GNMPY74T-wvzIphSf.js} +1 -1
  61. package/dist/assets/{quadrantDiagram-D57K4MC3-wGM4Ckig.js → quadrantDiagram-D57K4MC3-B7EfMRWb.js} +1 -1
  62. package/dist/assets/{radar-ABXABTNO-CIJ92p5N.js → radar-ABXABTNO-Bs6dVdAR.js} +1 -1
  63. package/dist/assets/{railroad-I3PHUGI6-8bxua-Hf.js → railroad-I3PHUGI6-lKaN4miw.js} +1 -1
  64. package/dist/assets/{railroad-abnf-LNEFI6M7-B9KVI10m.js → railroad-abnf-LNEFI6M7-Bhh16b7Z.js} +1 -1
  65. package/dist/assets/{railroad-ebnf-DWYD2UWJ-Bt73rnyJ.js → railroad-ebnf-DWYD2UWJ-m6ybW-Y_.js} +1 -1
  66. package/dist/assets/{railroad-peg-JR7BVNR7-Cie82UPT.js → railroad-peg-JR7BVNR7-DNn72e7r.js} +1 -1
  67. package/dist/assets/{railroadDiagram-Y72NRBL7-C1nmi_tl.js → railroadDiagram-Y72NRBL7-DNeop1iZ.js} +1 -1
  68. package/dist/assets/{requirementDiagram-EQYSW5RA-BSianW40.js → requirementDiagram-EQYSW5RA-BVYZ2XYJ.js} +1 -1
  69. package/dist/assets/{sankeyDiagram-SY24JHO5-DIa11-h7.js → sankeyDiagram-SY24JHO5-B2MP51on.js} +1 -1
  70. package/dist/assets/{sequenceDiagram-BLEHNHQU-Df5rZKz2.js → sequenceDiagram-BLEHNHQU-BUvxstXG.js} +1 -1
  71. package/dist/assets/{src-dClg85lX.js → src-BrR0lqlG.js} +1 -1
  72. package/dist/assets/{stateDiagram-v2-A6IESKWZ-B15PTSvX.js → stateDiagram-v2-A6IESKWZ-Ba84OGKE.js} +1 -1
  73. package/dist/assets/{swimlanes-B3ENRKFQ-C9mgRCMi.js → swimlanes-B3ENRKFQ-BMSl2PNA.js} +1 -1
  74. package/dist/assets/swimlanesDiagram-AYQRV4AK-M1dmvq7m.js +8 -0
  75. package/dist/assets/{timeline-definition-JXYKGLGB-BDVf_mIv.js → timeline-definition-JXYKGLGB-DOdW-dxq.js} +1 -1
  76. package/dist/assets/{treeView-D4JQ5SDB-BbBK-25J.js → treeView-D4JQ5SDB-DZ9KQyn5.js} +1 -1
  77. package/dist/assets/{treemap-SAJKECNS-CEDX8apk.js → treemap-SAJKECNS-WEC5wtDV.js} +1 -1
  78. package/dist/assets/{usecaseDiagram-WPOLBNNX-D1QkwFF8.js → usecaseDiagram-WPOLBNNX-cldTztFL.js} +1 -1
  79. package/dist/assets/{vennDiagram-Q3Y3IDCW-5PeGZvEO.js → vennDiagram-Q3Y3IDCW-c41KySoY.js} +1 -1
  80. package/dist/assets/{wardley-7MLQ67FV-BatN94pO.js → wardley-7MLQ67FV-Bf9_aSSZ.js} +1 -1
  81. package/dist/assets/{wardleyDiagram-IVAIDKWA-DyCcDS3Y.js → wardleyDiagram-IVAIDKWA-BeKEvEBG.js} +1 -1
  82. package/dist/assets/{xychartDiagram-4URNHDU4-CbCXcRlg.js → xychartDiagram-4URNHDU4-tNkAxTxG.js} +1 -1
  83. package/dist/index.html +1 -1
  84. package/package.json +5 -1
  85. package/server/config.js +140 -14
  86. package/server/consensus.js +18 -13
  87. package/server/graph/modules_builder.js +290 -0
  88. package/server/graph/modules_catalog.js +288 -0
  89. package/server/graph/parser.js +3 -2
  90. package/server/graph/sources.js +165 -24
  91. package/server/graph/syntax.js +245 -28
  92. package/server/index.js +124 -61
  93. package/server/install.js +350 -10
  94. package/server/models_registry.js +34 -9
  95. package/server/scaffold.js +109 -9
  96. package/dist/assets/channel-BZ2_TTTJ.js +0 -1
  97. package/dist/assets/flowDiagram-IUGLLWBU-l7L5DTb5.js +0 -1
  98. package/dist/assets/swimlanesDiagram-AYQRV4AK-BGFq4t7O.js +0 -8
package/README.md CHANGED
@@ -27,6 +27,8 @@ knl-view --port 8086 --path=.knowledges
27
27
  that narrows the index by file title or path.
28
28
  - Interface in English or Indonesian, switchable in the top bar. English is the
29
29
  default.
30
+ - Whole-project dependency and symbol call graph extraction via WebAssembly
31
+ Tree-Sitter for JavaScript, TypeScript, Go, Python, and Rust.
30
32
 
31
33
  ## Requirements
32
34
 
@@ -73,9 +75,39 @@ GitHub commit without cloning, run
73
75
  `--install-links`, npm 11 links against a temporary clone it deletes
74
76
  afterwards, which leaves a broken install.
75
77
 
78
+ ## How to Set Up
79
+
80
+ Setting up a project takes a single command:
81
+
82
+ ```sh
83
+ knl-view setup
84
+ ```
85
+
86
+ Or run directly without installing:
87
+
88
+ ```sh
89
+ npx @rahmantech/knl-view setup
90
+ ```
91
+
92
+ ### What `knl-view setup` Does Automatically
93
+ 1. **Scaffolds `.knowledges/`**: Creates the documentation directory with a starter `README.md` index and template folders (or custom folders via `--folders`).
94
+ 2. **Installs Agent Skills**: Automatically places the `knl-view` skill into `.agents/skills/knl-view/` so coding agents (Antigravity, Claude, Codex, OpenCode) can read and manage your knowledge base.
95
+ 3. **Integrates Decision History**: Audits and offers to install the `decision-history` skill ([decisionskills](https://github.com/rachmanzz/decisionskills)) for append-only architecture decision tracking.
96
+ 4. **Protects Configuration**: Ensures `.gitignore` includes `knl-config.json` and temporary artifacts.
97
+ 5. **Auto-maps AnchorDB Models**: Configures `knowledges` and `sources` model identifiers in `knl-config.json` and records them in the machine-wide registry.
98
+ 6. **Provisions AnchorDB**: Prompts to start or provision an AnchorDB instance (native binary on Linux, Podman/Docker container on Windows & macOS).
99
+ 7. **Seeds Agent Rules**: Configures standardized KNL-View instructions in `AGENTS.md`, `GEMINI.md`, and `CLAUDE.md`.
100
+
101
+ After setup, start the viewer immediately:
102
+
103
+ ```sh
104
+ knl-view
105
+ ```
106
+
76
107
  ## Usage
77
108
 
78
109
  ```sh
110
+ knl-view setup # bootstrap project (scaffold base, skill, gitignore, models)
79
111
  knl-view # serve ./.knowledges on 127.0.0.1:8085
80
112
  knl-view --path=../other-project/.knowledges
81
113
  knl-view --port 8086 --host 0.0.0.0 # expose on the network
@@ -93,6 +125,8 @@ knl-view --seed-skill=knl-view --dir=global --yes
93
125
  | `--anchordb` | none | AnchorWire URL (`wire://host:port?token=...`) for this session; overrides the global config block |
94
126
  | `--target` | none | Target node ID for CLI subgraph trace (`knl-view graph trace`) |
95
127
  | `--hops` | `2` | Traversal depth radius for subgraph extraction |
128
+ | `--method` | auto | Install method for `install anchordb`: `binary` or `container` |
129
+ | `--runtime` | auto | Container runtime for `install anchordb`: `docker` or `podman` |
96
130
  | `--init` | off | Scaffold a new base interactively; does not start the server |
97
131
  | `--structure` | `standard` | Layout for a non-interactive `--init`: `standard`, `empty`, or `custom` |
98
132
  | `--folders` | none | Comma-separated folder names for `--structure=custom` |
@@ -118,15 +152,19 @@ off and the viewer runs fully local:
118
152
  ```json
119
153
  {
120
154
  "anchordb": {
121
- "url": "wire://127.0.0.1:7448",
155
+ "url": "wire://127.0.0.1:17448",
122
156
  "token": "your-token",
123
- "sync": true
157
+ "sync": true,
158
+ "deamon": "podman",
159
+ "container_name": "anchordb-knlview",
160
+ "container_id": "56519e7acbaa...",
161
+ "container_created_on": "2026-10-31 14:08:48..."
124
162
  }
125
163
  }
126
164
  ```
127
165
 
128
- **Per project: `knl-config.json` at the project root** (gitignored): only
129
- `path`, `port`, `host`, and a `models` map, never the anchordb connection:
166
+ **Per project: `knl-config.json` at the project root** (gitignored):
167
+ `path`, `port`, `host`, `models`, and optional `include` / `exclude` patterns:
130
168
 
131
169
  ```json
132
170
  {
@@ -134,10 +172,15 @@ off and the viewer runs fully local:
134
172
  "models": {
135
173
  "knowledges": "vez0vqrp",
136
174
  "consensus": "n0qrnmsz"
137
- }
175
+ },
176
+ "include": ["dist/bundle.js"],
177
+ "exclude": ["legacy/**", "*.tmp"]
138
178
  }
139
179
  ```
140
180
 
181
+ - `exclude`: Hard exclude that strictly filters files and folders from graph analysis and knowledge tree. Always takes precedence over defaults and includes.
182
+ - `include`: Whitelists files and folders. Overrides default directory exclusions (e.g. including files from `dist/` or dot-folders).
183
+
141
184
  Model names are owned by the `models` map: role → name, and the name can
142
185
  be anything (random names are fine; the map records what each name is
143
186
  *for*). Names stay stable even if the project folder is renamed. knl-view
@@ -150,29 +193,48 @@ The global registry `~/.knlview/models.json` records every name's owner
150
193
  project whose map has no entry for a role runs fully local: AnchorDB is
151
194
  touched only once the role is mapped.
152
195
 
153
- ## Installing AnchorDB (optional)
196
+ ## Operating System Support & Installing AnchorDB
197
+
198
+ ### Operating System Support
154
199
 
155
- AnchorDB is an optional layer. Without it the viewer runs fully local:
156
- everything (browsing, search, the graph engine, and `knl-view graph trace`)
157
- works with zero setup. Installing AnchorDB only adds persistent causal
158
- tracing across sessions and shared sync between machines.
200
+ | OS | Core Viewer (`knl-view`) | Global Config Location | AnchorDB Backend |
201
+ | --- | --- | --- | --- |
202
+ | **Linux** | Native (Node.js >= 20.19) | `~/.knlview/knl-config.json` | **Native Binary** (`amd64`, `arm64`) or Container |
203
+ | **macOS** | Native (Node.js >= 20.19) | `~/.knlview/knl-config.json` | **Container**: **Podman (Recommended)** or Docker |
204
+ | **Windows** | Native (Node.js >= 20.19) | `%APPDATA%\knlview\knl-config.json` | **Container**: **Podman (Recommended)** or Docker |
159
205
 
160
- `knl-view install anchordb` installs AnchorDB and writes the `anchordb`
161
- block into the global config:
206
+ ---
162
207
 
163
- - **Linux and macOS**: downloads the native binary from
164
- [GitHub Releases](https://github.com/rachmanzz/anchordb/releases),
165
- verifies it against the release's `SHA256SUMS.txt`, installs to
166
- `~/.knlview/bin/`, and starts `anchordb-server` detached (logs in
167
- `~/.knlview/anchordb.log`, data in `~/.knlview/anchordb-data`).
168
- - **Other platforms**: a Linux container from
169
- `ghcr.io/rachmanzz/anchordb` via docker or podman; the command refuses
170
- to continue if neither is installed.
208
+ ### Installing AnchorDB (Optional)
171
209
 
172
- Non-interactive (CI/scripts): add `--yes`. Explicit method: `--method=binary`
173
- or `--method=container`. Fixed token instead of a random one: `--token=...`.
174
- If a container named `anchordb-knlview` already exists, the installer stops
175
- instead of removing it: data must not disappear by accident.
210
+ AnchorDB is an optional layer. Without it, the viewer runs 100% locally with zero external dependencies: document browsing, full-text search, the Markdown graph engine, and `knl-view graph trace` all work immediately. Installing AnchorDB adds persistent multi-hop causal tracing across sessions, whole-project source code dependency syncing, and shared multi-machine graphs.
211
+
212
+ Run `knl-view install anchordb` to install AnchorDB and write the `anchordb` block into your global configuration:
213
+
214
+ #### 1. Linux (Native Standalone Binary)
215
+ - Native binaries are published on [GitHub Releases](https://github.com/rachmanzz/anchordb/releases) for Linux architectures:
216
+ - `linux_amd64` (x86_64)
217
+ - `linux_arm64` (aarch64)
218
+ - On Linux, `knl-view install anchordb` automatically:
219
+ - Fetches the latest release asset and verifies it against the official `SHA256SUMS.txt`.
220
+ - Installs `anchordb-server` and `anchordb` into `~/.knlview/bin/` with secure file permissions (`0o700` / `0o755`).
221
+ - Starts `anchordb-server` detached as a background process daemon (logs in `~/.knlview/anchordb.log`, data in `~/.knlview/anchordb-data`).
222
+ - You can also explicitly opt for containers on Linux using `--method=container`.
223
+
224
+ #### 2. Windows & macOS (Container via Podman or Docker)
225
+ - AnchorDB relies on Linux kernel primitives (`mmap` memory mapping and POSIX file locking). Native binaries are not yet published for Windows or macOS.
226
+ - For Windows and macOS, AnchorDB is currently deployed via a lightweight container image (`ghcr.io/rachmanzz/anchordb`):
227
+ - **Podman (Recommended)**: Rootless, daemonless, lightweight, and requires no administrative privileges or background daemons.
228
+ - **Docker**: Supported via Docker Desktop or Docker Engine (`--runtime=docker`).
229
+ - `knl-view install anchordb` automatically detects installed container runtimes. If both are found, it prompts you to select **Podman (Recommended)** or **Docker**. If neither is installed, it halts with clear installation guidance.
230
+
231
+ #### Flags & Automation (CI / Scripts)
232
+ - Non-interactive mode: add `--yes` (accepts all defaults).
233
+ - Force install method: `--method=binary` or `--method=container`.
234
+ - Specify container engine: `--runtime=podman` (recommended) or `--runtime=docker`.
235
+ - Custom token: `--token=<text>` (default: cryptographic 32-byte hex token).
236
+ - Port conflict handling: automatically detects if port 17448 is occupied and suggests alternative free ports.
237
+ - Data safety: if a container named `anchordb-knlview` already exists, the installer stops rather than overwriting existing data.
176
238
 
177
239
  ## How a base is read
178
240
 
@@ -207,10 +269,10 @@ Every entry is decoration. Nothing in it can invent a file that is not on disk.
207
269
  "coding-rules.md": { "title": "Coding rules", "order": 1 }
208
270
  },
209
271
  "files": {
210
- "rahasia.md": { "ignore": true }
272
+ "secret.md": { "ignore": true }
211
273
  },
212
274
  "dirs": {
213
- "draft-lama": { "ignore": true }
275
+ "old-drafts": { "ignore": true }
214
276
  }
215
277
  }
216
278
  ```
@@ -310,18 +372,19 @@ A third AnchorDB model, the `sources` role in the models map, holds the
310
372
  dependency graph of the whole project, not just `.knowledges`. Every file
311
373
  becomes a node (id = repo-relative path; hidden folders are skipped except
312
374
  `.github`, and `node_modules`, `dist`, and `.gitignore` patterns are
313
- ignored). Import edges are extracted with tree-sitter syntax parsing (the
314
- JS family and Go today, one grammar package per language) and stored in
315
- both directions (`imports`, `imported_by`) so lineage works without any
316
- local mirror: sync is server-authoritative, enumerating the server's own
317
- records and edges before applying the difference from a fresh disk scan.
375
+ ignored). Import edges are extracted with tree-sitter syntax parsing
376
+ (JavaScript, TypeScript/TSX, Go, Python, and Rust, one grammar package per
377
+ language family) and stored in both directions (`imports`, `imported_by`) so
378
+ lineage works without any local mirror: sync is server-authoritative, enumerating
379
+ the server's own records and edges before applying the difference from a fresh
380
+ disk scan.
318
381
 
319
382
  Each file also defines **symbol nodes**, extracted from the same parse:
320
383
 
321
384
  - Symbol ids are `<path>#<name>`; class methods are `Class.method`. A name
322
385
  defined more than once in one file gets a line suffix
323
386
  (`<path>#<name>@<line>`), so duplicate helpers stay distinct records.
324
- - Kinds: `function`, `class`, `method`, `type` (Go type declarations).
387
+ - Kinds: `function`, `class`, `method`, `type`, `interface`, `enum`, `struct`, `trait`.
325
388
  - Edges: `defines`/`defined_in` (file → symbol) and `calls`/`called_by`
326
389
  (symbol → symbol), each stored in both directions because causalChain
327
390
  walks forward only.
@@ -335,6 +398,28 @@ Each file also defines **symbol nodes**, extracted from the same parse:
335
398
  per source file that has symbols; override the location with `labelDir`
336
399
  in the project config. Labels are regenerated and pruned on every sync.
337
400
 
401
+ #### Supported Languages (v0.3.0)
402
+
403
+ Tree-sitter WASM grammars run in-memory within Node.js without requiring host compilers:
404
+
405
+ | Language | Extensions | Extracted Symbols | Import Resolution |
406
+ | :--- | :--- | :--- | :--- |
407
+ | **JavaScript** | `.js`, `.mjs`, `.cjs`, `.jsx` | `function`, `class`, `method` | ESM (`import`/`export`), dynamic `import()`, CJS `require()` |
408
+ | **TypeScript** | `.ts`, `.mts`, `.cts`, `.tsx` | `function`, `class`, `method`, `interface`, `type`, `enum` | ESM/CJS, automatic resolution of `.js` specifiers to `.ts`/`.tsx` on disk |
409
+ | **Go** | `.go` | `function`, `method` (receiver-qualified), `type` | `go.mod` module-internal packages |
410
+ | **Python** | `.py` | `function`, `class`, `method` | Relative imports (`.local`, `..pkg`) and dot-separated package paths |
411
+ | **Rust** | `.rs` | `function`, `method` (`impl`), `struct`, `enum`, `trait`, `type` | `mod <name>;`, `use crate::`, `use super::`, `use self::` |
412
+
413
+ #### Upcoming Languages (Planned for Next Versions)
414
+
415
+ Support for additional languages via WebAssembly Tree-Sitter grammars will be added in upcoming releases:
416
+
417
+ - **Java** (`.java`): Class, interface, record, method extraction, package imports
418
+ - **C / C++** (`.c`, `.h`, `.cpp`, `.hpp`): Functions, structs, classes, `#include` resolution
419
+ - **C#** (`.cs`): Classes, structs, interfaces, methods, namespaces/using
420
+ - **Ruby** (`.rb`): Modules, classes, methods, `require_relative`
421
+ - **PHP** (`.php`): Classes, interfaces, traits, functions, namespaces/use
422
+
338
423
  ```sh
339
424
  knl-view model new sources
340
425
  knl-view sources sync
@@ -358,6 +443,22 @@ record with a normal save and relinks its edges. Sync reports
358
443
  never silent. The read-only HTTP endpoint answers the same queries:
359
444
  `GET /api/sources/trace?target=<id>&direction=in|out|both&hops=N`.
360
445
 
446
+ ### External Modules Graph (On-Demand Module Boundary)
447
+
448
+ AI agents can parse, index, and trace third-party dependencies on-demand into dedicated global AnchorDB models (`modules-npm`, `modules-go`, `modules-cargo`, `modules-pypi`) without polluting the local project graph or re-syncing across projects:
449
+
450
+ ```sh
451
+ # Build & sync external module graph on-demand
452
+ knl-view modules build-graph npm::express
453
+ knl-view modules build-graph go::github.com/gin-gonic/gin
454
+
455
+ # Trace definitions and call hierarchy within the module
456
+ knl-view modules trace npm::express Router --hops=1
457
+
458
+ # List locally indexed modules in ~/.knlview/modules
459
+ knl-view modules list
460
+ ```
461
+
361
462
  ### CLI Query
362
463
 
363
464
  ```sh