@lon-ask/dockit 0.1.1 → 0.1.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.
Files changed (140) hide show
  1. package/LICENSE +21 -674
  2. package/README.md +618 -328
  3. package/SKILL.md +61 -110
  4. package/apps/client/dist/assets/{index-CqOXxsEZ.js → index-DzadxeQH.js} +2 -2
  5. package/apps/client/dist/index.html +1 -1
  6. package/apps/client/index.html +12 -0
  7. package/apps/client/package.json +26 -0
  8. package/apps/client/src/App.tsx +18 -0
  9. package/apps/client/src/api/client.ts +54 -0
  10. package/apps/client/src/components/BuildPanel.tsx +77 -0
  11. package/apps/client/src/components/DocViewer.tsx +76 -0
  12. package/apps/client/src/components/EntryDetail.tsx +322 -0
  13. package/apps/client/src/components/EntryForm.tsx +117 -0
  14. package/apps/client/src/components/EntryList.tsx +165 -0
  15. package/apps/client/src/components/GlobalSearchBar.tsx +166 -0
  16. package/apps/client/src/components/Layout.tsx +57 -0
  17. package/apps/client/src/components/SearchBar.tsx +103 -0
  18. package/apps/client/src/components/SourceForm.tsx +497 -0
  19. package/apps/client/src/hooks/useTheme.ts +19 -0
  20. package/apps/client/src/index.css +77 -0
  21. package/apps/client/src/main.tsx +13 -0
  22. package/apps/client/src/types.ts +105 -0
  23. package/apps/client/vite.config.ts +13 -0
  24. package/apps/server/dist/core/domain/entry.js +20 -0
  25. package/apps/server/dist/core/domain/entry.js.map +1 -0
  26. package/apps/server/dist/core/domain/errors.js +33 -0
  27. package/apps/server/dist/core/domain/errors.js.map +1 -0
  28. package/apps/server/dist/core/domain/knowledge-graph.js +2 -0
  29. package/apps/server/dist/core/domain/knowledge-graph.js.map +1 -0
  30. package/apps/server/dist/core/domain/types.js +2 -0
  31. package/apps/server/dist/core/domain/types.js.map +1 -0
  32. package/apps/server/dist/core/ports/IBuildRepository.js +2 -0
  33. package/apps/server/dist/core/ports/IBuildRepository.js.map +1 -0
  34. package/apps/server/dist/core/ports/IDocumentNormalizer.js +2 -0
  35. package/apps/server/dist/core/ports/IDocumentNormalizer.js.map +1 -0
  36. package/apps/server/dist/core/ports/IDocumentStore.js +2 -0
  37. package/apps/server/dist/core/ports/IDocumentStore.js.map +1 -0
  38. package/apps/server/dist/core/ports/IEntryReadModel.js +2 -0
  39. package/apps/server/dist/core/ports/IEntryReadModel.js.map +1 -0
  40. package/apps/server/dist/core/ports/IEntryRepository.js +2 -0
  41. package/apps/server/dist/core/ports/IEntryRepository.js.map +1 -0
  42. package/apps/server/dist/core/ports/IKnowledgeGraph.js +2 -0
  43. package/apps/server/dist/core/ports/IKnowledgeGraph.js.map +1 -0
  44. package/apps/server/dist/core/ports/IPathResolver.js +2 -0
  45. package/apps/server/dist/core/ports/IPathResolver.js.map +1 -0
  46. package/apps/server/dist/core/ports/ISearchEngine.js +2 -0
  47. package/apps/server/dist/core/ports/ISearchEngine.js.map +1 -0
  48. package/apps/server/dist/core/ports/ISourceProcessor.js +2 -0
  49. package/apps/server/dist/core/ports/ISourceProcessor.js.map +1 -0
  50. package/apps/server/dist/core/ports/ISourceRepository.js +2 -0
  51. package/apps/server/dist/core/ports/ISourceRepository.js.map +1 -0
  52. package/apps/server/dist/core/usecases/BuildUseCase.js +76 -0
  53. package/apps/server/dist/core/usecases/BuildUseCase.js.map +1 -0
  54. package/apps/server/dist/core/usecases/ConfigUseCase.js +62 -0
  55. package/apps/server/dist/core/usecases/ConfigUseCase.js.map +1 -0
  56. package/apps/server/dist/core/usecases/SearchUseCase.js +17 -0
  57. package/apps/server/dist/core/usecases/SearchUseCase.js.map +1 -0
  58. package/apps/server/dist/index.js +86 -0
  59. package/apps/server/dist/index.js.map +1 -0
  60. package/apps/server/dist/infrastructure/filesystem/FileSystemDocumentStore.js +25 -0
  61. package/apps/server/dist/infrastructure/filesystem/FileSystemDocumentStore.js.map +1 -0
  62. package/apps/server/dist/infrastructure/graph/GraphSearchDecorator.js +42 -0
  63. package/apps/server/dist/infrastructure/graph/GraphSearchDecorator.js.map +1 -0
  64. package/apps/server/dist/infrastructure/graph/GraphifyKnowledgeGraph.js +145 -0
  65. package/apps/server/dist/infrastructure/graph/GraphifyKnowledgeGraph.js.map +1 -0
  66. package/apps/server/dist/infrastructure/graph/index.js +3 -0
  67. package/apps/server/dist/infrastructure/graph/index.js.map +1 -0
  68. package/apps/server/dist/infrastructure/persistence/sqlite/SqliteBuildRepository.js +21 -0
  69. package/apps/server/dist/infrastructure/persistence/sqlite/SqliteBuildRepository.js.map +1 -0
  70. package/apps/server/dist/infrastructure/persistence/sqlite/SqliteEntryReadModel.js +11 -0
  71. package/apps/server/dist/infrastructure/persistence/sqlite/SqliteEntryReadModel.js.map +1 -0
  72. package/apps/server/dist/infrastructure/persistence/sqlite/SqliteEntryRepository.js +59 -0
  73. package/apps/server/dist/infrastructure/persistence/sqlite/SqliteEntryRepository.js.map +1 -0
  74. package/apps/server/dist/infrastructure/persistence/sqlite/SqliteSourceRepository.js +47 -0
  75. package/apps/server/dist/infrastructure/persistence/sqlite/SqliteSourceRepository.js.map +1 -0
  76. package/apps/server/dist/infrastructure/persistence/sqlite/connection.js +50 -0
  77. package/apps/server/dist/infrastructure/persistence/sqlite/connection.js.map +1 -0
  78. package/apps/server/dist/infrastructure/search/SearchEngineFactory.js +32 -0
  79. package/apps/server/dist/infrastructure/search/SearchEngineFactory.js.map +1 -0
  80. package/apps/server/dist/infrastructure/search/json/JsonSearchEngine.js +147 -0
  81. package/apps/server/dist/infrastructure/search/json/JsonSearchEngine.js.map +1 -0
  82. package/apps/server/dist/infrastructure/search/vector/EmbeddingService.js +23 -0
  83. package/apps/server/dist/infrastructure/search/vector/EmbeddingService.js.map +1 -0
  84. package/apps/server/dist/infrastructure/search/vector/VectorSearchEngine.js +378 -0
  85. package/apps/server/dist/infrastructure/search/vector/VectorSearchEngine.js.map +1 -0
  86. package/apps/server/dist/infrastructure/source-processors/AntoraSourceProcessor.js +11 -0
  87. package/apps/server/dist/infrastructure/source-processors/AntoraSourceProcessor.js.map +1 -0
  88. package/apps/server/dist/infrastructure/source-processors/AsciidocSourceProcessor.js +9 -0
  89. package/apps/server/dist/infrastructure/source-processors/AsciidocSourceProcessor.js.map +1 -0
  90. package/apps/server/dist/infrastructure/source-processors/DocumentNormalizer.js +11 -0
  91. package/apps/server/dist/infrastructure/source-processors/DocumentNormalizer.js.map +1 -0
  92. package/apps/server/dist/infrastructure/source-processors/GithubMarkdownSourceProcessor.js +9 -0
  93. package/apps/server/dist/infrastructure/source-processors/GithubMarkdownSourceProcessor.js.map +1 -0
  94. package/apps/server/dist/infrastructure/source-processors/MavenSourceProcessor.js +9 -0
  95. package/apps/server/dist/infrastructure/source-processors/MavenSourceProcessor.js.map +1 -0
  96. package/apps/server/dist/infrastructure/source-processors/PathResolver.js +5 -0
  97. package/apps/server/dist/infrastructure/source-processors/PathResolver.js.map +1 -0
  98. package/apps/server/dist/infrastructure/source-processors/SourceCodeSourceProcessor.js +269 -0
  99. package/apps/server/dist/infrastructure/source-processors/SourceCodeSourceProcessor.js.map +1 -0
  100. package/apps/server/dist/infrastructure/source-processors/ZipSourceProcessor.js +9 -0
  101. package/apps/server/dist/infrastructure/source-processors/ZipSourceProcessor.js.map +1 -0
  102. package/apps/server/dist/mcp-http.js +93 -0
  103. package/apps/server/dist/mcp-http.js.map +1 -0
  104. package/apps/server/dist/mcp.js +339 -0
  105. package/apps/server/dist/mcp.js.map +1 -0
  106. package/apps/server/dist/routes/build.js +89 -0
  107. package/apps/server/dist/routes/build.js.map +1 -0
  108. package/apps/server/dist/routes/entries.js +52 -0
  109. package/apps/server/dist/routes/entries.js.map +1 -0
  110. package/apps/server/dist/routes/graph.js +58 -0
  111. package/apps/server/dist/routes/graph.js.map +1 -0
  112. package/apps/server/dist/routes/search.js +24 -0
  113. package/apps/server/dist/routes/search.js.map +1 -0
  114. package/apps/server/dist/routes/sources.js +100 -0
  115. package/apps/server/dist/routes/sources.js.map +1 -0
  116. package/apps/server/dist/routes/viewer.js +22 -0
  117. package/apps/server/dist/routes/viewer.js.map +1 -0
  118. package/apps/server/dist/services/antora.js +222 -0
  119. package/apps/server/dist/services/antora.js.map +1 -0
  120. package/apps/server/dist/services/asciidoc.js +206 -0
  121. package/apps/server/dist/services/asciidoc.js.map +1 -0
  122. package/apps/server/dist/services/configLoader.js +150 -0
  123. package/apps/server/dist/services/configLoader.js.map +1 -0
  124. package/apps/server/dist/services/githubMarkdown.js +221 -0
  125. package/apps/server/dist/services/githubMarkdown.js.map +1 -0
  126. package/apps/server/dist/services/maven.js +148 -0
  127. package/apps/server/dist/services/maven.js.map +1 -0
  128. package/apps/server/dist/services/normalizer.js +42 -0
  129. package/apps/server/dist/services/normalizer.js.map +1 -0
  130. package/apps/server/dist/services/paths.js +5 -0
  131. package/apps/server/dist/services/paths.js.map +1 -0
  132. package/apps/server/dist/services/textExtractor.js +46 -0
  133. package/apps/server/dist/services/textExtractor.js.map +1 -0
  134. package/apps/server/dist/services/zip.js +63 -0
  135. package/apps/server/dist/services/zip.js.map +1 -0
  136. package/apps/server/package.json +38 -0
  137. package/apps/server/src/infrastructure/source-processors/SourceCodeSourceProcessor.ts +9 -2
  138. package/bin/commands/dev.ts +2 -2
  139. package/bin/commands/serve.ts +2 -2
  140. package/package.json +22 -4
package/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dockit
3
- description: Documentation index and search tool that provides on-demand access to up-to-date framework and library documentation for LLM context
3
+ description: Documentation index and search tool providing on-demand framework/library docs and source code knowledge graphs for LLM context
4
4
  license: MIT
5
5
  compatibility: opencode
6
6
  metadata:
@@ -8,147 +8,98 @@ metadata:
8
8
  workflow: documentation
9
9
  ---
10
10
 
11
- ## What I do
12
- - Search and retrieve documentation for frameworks and libraries (e.g., Quarkus, Spring Boot, React)
13
- - Provide API documentation, class references, and configuration guides
14
- - Fetch full document content for LLM context via CLI or MCP tools
11
+ # ⚠️ CRITICAL: USE DOCKIT, NOT GREP
15
12
 
16
- ## When to use me
17
- Use this skill when the user asks about:
18
- - How to use a specific framework or library
19
- - API documentation, class references, or configuration reference
20
- - Any technology listed in available dockit entries
13
+ **When a dockit entry exists for the codebase, dockit's graph and search tools MUST be used for ALL structural queries. Do NOT use grep, rg, find, glob, or any text search tool for questions about code imports, dependencies, structure, architecture, or relationships.**
21
14
 
22
- ## Primary Method: CLI Commands
15
+ Dockit's knowledge graph (Graphify Tree-sitter AST) has already parsed every import, call, and inheritance edge. Using grep for structural questions is slower AND less accurate. You are discarding pre-parsed structural data to re-parse text — this is wasteful and produces worse results.
23
16
 
24
- The `dockit` CLI is the recommended way to search and retrieve documentation.
17
+ | Question | Use dockit | Do NOT use |
18
+ |----------|------------|-------------|
19
+ | "What files import X?" | `dockit graph query <entry> "X"` | `grep`, `rg`, `glob` |
20
+ | "What does X depend on?" | `dockit graph explain <entry> "X"` | Reading files, `grep "import"` |
21
+ | "Does UI import server code?" | `dockit graph path <entry> "A" "B"` | Manually checking imports |
22
+ | "Most critical modules?" | `dockit graph gods <entry>` | Guessing, `ls`, `wc -l` |
23
+ | "How are A and B connected?" | `dockit graph path <entry> "A" "B"` | Tracing imports across files |
24
+ | "Docs for X?" | `dockit search <entry> "X"` | `grep "X"` on docs |
25
+ | "Find all files about X" | `dockit search <entry> "X"` or `dockit graph query <entry> "X"` | `grep -r "X"` |
25
26
 
26
- ### `dockit list`
27
- Lists all configured documentation entries. Run this first to discover what's available.
27
+ **Only use grep / glob when:**
28
+ 1. No dockit entry exists for the target codebase (not yet built)
29
+ 2. You have already found the right files via dockit and now need to read their content
30
+ 3. The question is about raw text patterns, not code structure
28
31
 
29
- ### `dockit search [<entry>] <query>`
30
- Searches documentation. Always provide the entry name as the first argument when you know which framework the question is about.
32
+ **If a source-code entry is built (status = ready): graph tools get priority. Every time. No exceptions.**
31
33
 
32
- ```bash
33
- # Scoped to a specific entry (recommended)
34
- dockit search react "how to create a hook"
35
- dockit search quarkus "configure cache"
34
+ ## What dockit does
36
35
 
37
- # Global search top result per entry (when unsure which entry)
38
- dockit search "cache"
39
- ```
36
+ Dockit is a local documentation hub. It indexes documentation from multiple sources (GitHub Markdown, AsciiDoc, Antora, Maven Javadoc, ZIP archives) and builds source code knowledge graphs (Tree-sitter AST via Graphify). It provides hybrid TF-IDF + vector semantic search across all indexed content.
40
37
 
41
- ### `dockit search [<entry>] <query> --get-top [N]`
42
- Searches and fetches full document content for the top N results (default 3). This is the **primary command for LLMs** — it combines search + content retrieval in one step.
38
+ Run it from the terminal no server process required. No internet needed after build.
43
39
 
44
- ```bash
45
- # Get full content for top 3 results
46
- dockit search react "useState" --get-top
40
+ ## Installation
47
41
 
48
- # Get full content for top 5 results, as JSON
49
- dockit search react "hooks" --get-top 5 --json
42
+ ```bash
43
+ npm install -g @lon-ask/dockit
50
44
  ```
51
45
 
52
- ### `dockit get <entry> <path>`
53
- Fetches full content of a specific document by path (from search results).
46
+ Or use `npx` without installing:
54
47
 
55
- ### `dockit build <entry>` / `dockit status <entry>`
56
- Builds documentation or checks build status.
48
+ ```bash
49
+ npx @lon-ask/dockit <command>
50
+ ```
57
51
 
58
- ## Recommended Workflow
52
+ All data is stored in `~/.dockit/` by default. Override with `DOCKIT_DATA_DIR`.
59
53
 
60
- ### Step 1: Identify the entry
61
- Determine which documentation entry is relevant:
62
- - "How do I use useState in React?" → entry: `react`
63
- - "How to configure cache in Quarkus?" → entry: `quarkus`
54
+ ## When to use dockit
64
55
 
65
- If unsure, run `dockit list` to see available entries.
56
+ Use when you need:
57
+ - Up-to-date framework/library documentation instead of stale training data
58
+ - API reference, class docs, or configuration guides
59
+ - Source code structure analysis (imports, calls, inheritance graphs)
60
+ - To find which files/modules a function touches in a codebase
66
61
 
67
- ### Step 2: Search pattern
68
- **Global search** (no entry) — returns top result per entry:
69
- ```bash
70
- dockit search "cache"
71
- ```
62
+ ## Entry Types and Behavior
72
63
 
73
- **Scoped search** (with entry) dive deeper:
74
- ```bash
75
- dockit search quarkus "cache" --get-top 3
76
- ```
77
-
78
- Always scope to the entry once you know which framework the user is asking about.
64
+ | Entry has | `dockit search` | `dockit graph` |
65
+ |-----------|----------------|-----------------|
66
+ | Docs only | Returns results | No graph available |
67
+ | Source code only | Returns empty | Use graph tools |
68
+ | Docs + code | Returns results (graph-boosted) | Graph tools work |
79
69
 
80
- ### Step 3: Refine the query
81
- Strip conversational filler. Keep only technical terms:
70
+ ## Build Status
82
71
 
83
- | User Question | Good Query |
84
- |---------------|------------|
85
- | "How do I create a custom hook in React?" | `"create custom hook"` |
86
- | "What is the latest Quarkus feature for caching?" | `"cache latest feature"` |
72
+ Entries start as `pending`. Build them before searching:
87
73
 
88
- ### Step 4: Handle missing builds
89
- If an entry shows status `pending` or `error`, build it first:
90
74
  ```bash
91
- dockit build react
92
- dockit status react
75
+ dockit build quarkus
76
+ dockit status quarkus # wait for "ready"
93
77
  ```
94
78
 
95
- ## Alternative: MCP Tools
79
+ If an entry shows `error`, check the build log via `dockit status <entry> --json`.
96
80
 
97
- If Dockit is configured as an MCP server, use `dockit_*` tools instead of CLI commands:
81
+ ## MCP Tools
82
+
83
+ If configured as an MCP server, use these tools instead of CLI:
98
84
 
99
85
  | MCP Tool | CLI Equivalent |
100
86
  |----------|----------------|
101
87
  | `dockit_list_entries` | `dockit list` |
88
+ | `dockit_find_entry` | — |
102
89
  | `dockit_global_search` | `dockit search "query"` |
103
90
  | `dockit_search` | `dockit search <entry> "query"` |
104
91
  | `dockit_get_doc` | `dockit get <entry> <path>` |
105
- | `dockit_build` / `dockit_build_status` | `dockit build` / `dockit status` |
106
- | `dockit_graph_query` | (MCP only) |
107
- | `dockit_graph_path` | (MCP only) |
108
- | `dockit_graph_explain` | (MCP only) |
109
- | `dockit_graph_gods` | (MCP only) |
110
-
111
- ## Source Code Entries (Knowledge Graph)
112
-
113
- For entries with `source-code` sources, the primary query mechanism is the **knowledge graph** instead of text search. Graphify's Tree-sitter AST pass parses 15+ languages and produces structural edges (*calls*, *imports*, *inherits*).
114
-
115
- ### Graph MCP Tools
116
-
117
- | Tool | Description |
118
- |------|-------------|
119
- | `dockit_graph_query <entry> <query>` | Search graph nodes by name, file, or type |
120
- | `dockit_graph_path <entry> <from> <to>` | Find shortest dependency path between two nodes |
121
- | `dockit_graph_explain <entry> <node>` | Get node details with edges and connections |
122
- | `dockit_graph_gods <entry>` | List most connected (highest-degree) nodes |
123
-
124
- ### Behavior by Entry Type
92
+ | `dockit_build` | `dockit build <entry>` |
93
+ | `dockit_build_status` | `dockit status <entry>` |
94
+ | `dockit_graph_query` | `dockit graph query` |
95
+ | `dockit_graph_path` | `dockit graph path` |
96
+ | `dockit_graph_explain` | `dockit graph explain` |
97
+ | `dockit_graph_gods` | `dockit graph gods` |
125
98
 
126
- | Entry Type | Search | Graph Query |
127
- |------------|--------|-------------|
128
- | Source-code only | `dockit search` returns empty | Use `dockit_graph_*` tools |
129
- | Mixed (docs + code) | `dockit search` works + results graph-boosted | `dockit_graph_*` tools work |
130
- | Docs only | `dockit search` works | No graph tools |
99
+ ## Key Constraints
131
100
 
132
- ## Notes
133
101
  - Documentation is plain text extracted from HTML
134
- - Content is truncated at 50KB per document
135
- - Entries start as `pending` and must be built before searchable
136
-
137
- ## Always Show Source
138
-
139
- After answering with documentation content, always display the source in a table at the end:
140
-
141
- | Field | Value |
142
- |-------|-------|
143
- | **Type** | `<source type>` |
144
- | **Label** | `<source label>` |
145
- | **Repo** | `<repoUrl>` |
146
- | **Source Path** | `<sourcePath>` |
147
- | **Version** | `<entry version>` |
148
-
149
- To get source details, use `--json` flag with search or check `dockit list --json`. Source fields come from the entry's `sources` array in `dockit.yaml`:
150
- - `type` — source type (e.g., `github-markdown`, `asciidoc`, `maven`, `source-code`)
151
- - `label` — human-readable label
152
- - `repoUrl` or `localPath` — repository URL or local path
153
- - `sourcePath` — path within the repo
154
- - Entry `version` — the version of the documentation entry
102
+ - Content is truncated at 50 KB per document
103
+ - Documents must be built before searchable (status = `ready`)
104
+ - Knowledge graph requires `graphify` Python package and source-code source type
105
+ - All data is local. No cloud, no API keys required