@tyvm/knowhow 0.0.109-dev.e88af1e → 0.0.110
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.
- package/autodoc/README.md +324 -0
- package/autodoc/chat-guide.md +268 -365
- package/autodoc/cli-reference.md +399 -473
- package/autodoc/config-reference.md +431 -330
- package/autodoc/embeddings-guide.md +223 -322
- package/autodoc/generate-guide.md +261 -301
- package/autodoc/language-plugin-guide.md +221 -247
- package/autodoc/modules-guide.md +242 -215
- package/autodoc/plugins-guide.md +470 -469
- package/autodoc/quickstart-guide.md +67 -70
- package/autodoc/skills-guide.md +455 -339
- package/autodoc/worker-guide.md +301 -308
- package/package.json +1 -1
- package/src/agents/tools/list.ts +2 -2
- package/src/ai.ts +81 -37
- package/src/chat/CliChatService.ts +1 -1
- package/src/chat/modules/SystemModule.ts +2 -2
- package/src/clients/anthropic.ts +1 -1
- package/src/clients/index.ts +25 -6
- package/src/clients/openai.ts +8 -5
- package/src/clients/types.ts +29 -6
- package/src/clients/withRetry.ts +89 -0
- package/src/commands/agent.ts +30 -0
- package/src/commands/modules.ts +365 -30
- package/src/config.ts +1 -1
- package/src/hashes.ts +8 -9
- package/src/index.ts +4 -2
- package/src/processors/Base64ImageDetector.ts +73 -0
- package/src/services/MediaProcessorService.ts +79 -10
- package/src/services/modules/index.ts +24 -19
- package/tests/processors/Base64ImageDetector.test.ts +160 -0
- package/tests/unit/clients/AIClient.test.ts +446 -0
- package/tests/unit/clients/withRetry.test.ts +319 -0
- package/tests/unit/commands/github-credentials.test.ts +1 -2
- package/ts_build/package.json +1 -1
- package/ts_build/src/agents/tools/list.js +2 -2
- package/ts_build/src/agents/tools/list.js.map +1 -1
- package/ts_build/src/ai.d.ts +3 -3
- package/ts_build/src/ai.js +51 -23
- package/ts_build/src/ai.js.map +1 -1
- package/ts_build/src/chat/CliChatService.js +1 -1
- package/ts_build/src/chat/CliChatService.js.map +1 -1
- package/ts_build/src/chat/modules/SystemModule.js +2 -2
- package/ts_build/src/chat/modules/SystemModule.js.map +1 -1
- package/ts_build/src/clients/anthropic.js +1 -1
- package/ts_build/src/clients/anthropic.js.map +1 -1
- package/ts_build/src/clients/index.js +7 -6
- package/ts_build/src/clients/index.js.map +1 -1
- package/ts_build/src/clients/openai.js +4 -4
- package/ts_build/src/clients/openai.js.map +1 -1
- package/ts_build/src/clients/types.d.ts +12 -6
- package/ts_build/src/clients/withRetry.d.ts +2 -0
- package/ts_build/src/clients/withRetry.js +60 -0
- package/ts_build/src/clients/withRetry.js.map +1 -0
- package/ts_build/src/commands/agent.js +25 -0
- package/ts_build/src/commands/agent.js.map +1 -1
- package/ts_build/src/commands/modules.js +297 -17
- package/ts_build/src/commands/modules.js.map +1 -1
- package/ts_build/src/config.js +1 -1
- package/ts_build/src/config.js.map +1 -1
- package/ts_build/src/hashes.js +5 -7
- package/ts_build/src/hashes.js.map +1 -1
- package/ts_build/src/index.js +1 -1
- package/ts_build/src/index.js.map +1 -1
- package/ts_build/src/processors/Base64ImageDetector.d.ts +3 -0
- package/ts_build/src/processors/Base64ImageDetector.js +42 -0
- package/ts_build/src/processors/Base64ImageDetector.js.map +1 -1
- package/ts_build/src/services/MediaProcessorService.d.ts +5 -4
- package/ts_build/src/services/MediaProcessorService.js +53 -8
- package/ts_build/src/services/MediaProcessorService.js.map +1 -1
- package/ts_build/src/services/modules/index.js +17 -13
- package/ts_build/src/services/modules/index.js.map +1 -1
- package/ts_build/tests/processors/Base64ImageDetector.test.js +111 -0
- package/ts_build/tests/processors/Base64ImageDetector.test.js.map +1 -1
- package/ts_build/tests/unit/clients/AIClient.test.d.ts +1 -0
- package/ts_build/tests/unit/clients/AIClient.test.js +339 -0
- package/ts_build/tests/unit/clients/AIClient.test.js.map +1 -0
- package/ts_build/tests/unit/clients/withRetry.test.d.ts +1 -0
- package/ts_build/tests/unit/clients/withRetry.test.js +225 -0
- package/ts_build/tests/unit/clients/withRetry.test.js.map +1 -0
- package/ts_build/tests/unit/commands/github-credentials.test.js +1 -2
- package/ts_build/tests/unit/commands/github-credentials.test.js.map +1 -1
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
```md
|
|
2
|
+
# Knowhow CLI — chat with your project (via plugins, docs, and embeddings) 🤖
|
|
3
|
+
|
|
4
|
+
Knowhow is an AI-powered CLI that turns your repository into an indexable knowledgebase: it generates documentation from your files (`knowhow generate`), builds semantic embeddings for retrieval (`knowhow embed`), and lets you interact through an interactive chat experience (`knowhow chat`) powered by a configurable project in `./.knowhow/`.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@tyvm/knowhow)
|
|
7
|
+
[](https://www.npmjs.com/package/@tyvm/knowhow)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
- [🚀 Quickstart](#-quickstart)
|
|
14
|
+
- [💬 knowhow chat](#-knowhow-chat)
|
|
15
|
+
- [⚙️ Configuration](#️-configuration)
|
|
16
|
+
- [🔌 Plugins](#-plugins)
|
|
17
|
+
- [📚 Embeddings](#-embeddings)
|
|
18
|
+
- [📄 Generate Docs](#-generate-docs)
|
|
19
|
+
- [🔧 Worker System](#-worker-system)
|
|
20
|
+
- [🧩 Extending Knowhow](#-extending-knowhow)
|
|
21
|
+
- [📖 CLI Reference](#-cli-reference)
|
|
22
|
+
- [🔗 Links](#-links)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🚀 Quickstart
|
|
27
|
+
|
|
28
|
+
### 1) Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -g @tyvm/knowhow
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2) Initialize a project (`knowhow init`)
|
|
35
|
+
|
|
36
|
+
From your project folder:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
knowhow init
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This creates a local Knowhow workspace in `./.knowhow/` and sets up global templates in `~/.knowhow/`.
|
|
43
|
+
|
|
44
|
+
You’ll get:
|
|
45
|
+
|
|
46
|
+
- `./.knowhow/knowhow.json` (your project configuration)
|
|
47
|
+
- `./.knowhow/language.json`
|
|
48
|
+
- `./.knowhow/prompts/` (prompt templates)
|
|
49
|
+
- `./.knowhow/docs/` (generated docs output)
|
|
50
|
+
- `./.knowhow/embeddings/` (generated embedding output)
|
|
51
|
+
- plus runtime/support files like `.ignore`, `.hashes.json`, `.jwt`, etc.
|
|
52
|
+
|
|
53
|
+
### 3) Login (`knowhow login`)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
knowhow login
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Knowhow starts a browser-based OAuth flow, waits for approval, retrieves a JWT, and stores it at:
|
|
60
|
+
|
|
61
|
+
- `./.knowhow/.jwt` (permissioned so only you can read it)
|
|
62
|
+
|
|
63
|
+
If you already have a JWT, you can use:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
knowhow login --jwt
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
After authentication, Knowhow updates your `orgId` in `./.knowhow/knowhow.json` and ensures the `knowhow` model provider is enabled.
|
|
70
|
+
|
|
71
|
+
### 4) First steps after setup ✅
|
|
72
|
+
|
|
73
|
+
Recommended onboarding flow:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
knowhow embed
|
|
77
|
+
knowhow chat
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This builds embeddings for your configured `embedSources`, then starts chat so you can ask questions about what you indexed.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 💬 knowhow chat
|
|
85
|
+
|
|
86
|
+
**Knowhow chat is the primary way to use the tool.** It’s an interactive terminal experience where you can switch between agents, attach/resume tasks, change renderers, and trigger semantic retrieval—using slash commands (`/…`) on top of normal chat.
|
|
87
|
+
|
|
88
|
+
### Start chat
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
knowhow chat
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Once started, Knowhow will show available commands for the current mode.
|
|
95
|
+
|
|
96
|
+
> Tip: While chatting, you can usually discover features by trying `/…` commands. If you want context, run:
|
|
97
|
+
>
|
|
98
|
+
> ```bash
|
|
99
|
+
> knowhow chat --help
|
|
100
|
+
> ```
|
|
101
|
+
|
|
102
|
+
### Key slash commands (high impact)
|
|
103
|
+
|
|
104
|
+
#### Agents (switch the “brain”)
|
|
105
|
+
- `/agents` — list available agents and select one
|
|
106
|
+
- `/agent <agent_name>` — start a specific agent
|
|
107
|
+
- `/agent` — **toggle agent mode off** (when already enabled)
|
|
108
|
+
|
|
109
|
+
In **agent mode**, your prompt becomes like:
|
|
110
|
+
> `Ask knowhow <AgentName>:`
|
|
111
|
+
and your input becomes a task for that agent.
|
|
112
|
+
|
|
113
|
+
#### Attach / resume long-running work
|
|
114
|
+
- `/attach [taskId]` — attach to a running task
|
|
115
|
+
- `/resume [taskId]` — resume a saved/completed session
|
|
116
|
+
- `/logs [N]` — show last messages (default `N=20`) in attached mode
|
|
117
|
+
- Attached-mode controls:
|
|
118
|
+
- `/pause`, `/unpause`, `/kill`, `/detach`, `/done`
|
|
119
|
+
|
|
120
|
+
#### Renderers (how output is displayed)
|
|
121
|
+
- `/render` — show current renderer + built-ins
|
|
122
|
+
- `/render compact` / `/render basic` / `/render fancy`
|
|
123
|
+
- `/render ./my-renderer.js` — also supports paths and package names
|
|
124
|
+
|
|
125
|
+
#### Input modes
|
|
126
|
+
- `/multi` — toggle multiline editor input
|
|
127
|
+
- `/voice` — toggle voice input
|
|
128
|
+
|
|
129
|
+
#### Model/provider selection (per context)
|
|
130
|
+
- `/provider` — select AI provider
|
|
131
|
+
- `/model` — select model
|
|
132
|
+
|
|
133
|
+
#### Search
|
|
134
|
+
- `/search` — interactive embedding search (inside it, you’ll use commands like `next`, `exit`, `embeddings`, `use`)
|
|
135
|
+
|
|
136
|
+
### Switching agents (quick pattern)
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
/agents
|
|
140
|
+
/agent Researcher
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
After selecting, agent mode is enabled and your messages become tasks.
|
|
144
|
+
|
|
145
|
+
### Slash-command “power feature”: shell helpers while chatting
|
|
146
|
+
|
|
147
|
+
When an agent is active, you can run local shell commands:
|
|
148
|
+
|
|
149
|
+
- `/! <command>` — execute and stream output (interactive)
|
|
150
|
+
- `/!! <command>` — capture output and send it to the agent
|
|
151
|
+
|
|
152
|
+
Example:
|
|
153
|
+
```text
|
|
154
|
+
/agent Patcher
|
|
155
|
+
Ask knowhow Patcher: /!! npm test
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## ⚙️ Configuration
|
|
161
|
+
|
|
162
|
+
Your main project configuration is `./.knowhow/knowhow.json`.
|
|
163
|
+
|
|
164
|
+
It controls, among other things:
|
|
165
|
+
|
|
166
|
+
- enabled/disabled plugins
|
|
167
|
+
- what to generate (`sources`)
|
|
168
|
+
- what to embed for retrieval (`embedSources`)
|
|
169
|
+
- model provider configuration
|
|
170
|
+
- worker/tool behavior
|
|
171
|
+
|
|
172
|
+
For the full config schema and examples, see:
|
|
173
|
+
- `autodoc/config-reference.md`
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 🔌 Plugins
|
|
178
|
+
|
|
179
|
+
Plugins extend Knowhow with extra context, resolution (URLs, GitHub, etc.), semantic retrieval, and tooling awareness. Enable/disable them via:
|
|
180
|
+
|
|
181
|
+
- `knowhow.json -> plugins.enabled / plugins.disabled`
|
|
182
|
+
|
|
183
|
+
For the complete plugins guide, see:
|
|
184
|
+
- `autodoc/plugins-guide.md`
|
|
185
|
+
|
|
186
|
+
### Built-in plugins (commonly available)
|
|
187
|
+
|
|
188
|
+
From the shipped defaults you’ll typically see plugins like:
|
|
189
|
+
|
|
190
|
+
- `language`, `embeddings`, `git`, `vim`, `github`, `asana`, `jira`, `linear`, `download`, `url`, `tmux`, `agents-md`, `exec`, `skills`, `figma`, `notion`, etc.
|
|
191
|
+
|
|
192
|
+
### ⭐ Killer feature: the Language Plugin (hotwords → context injection)
|
|
193
|
+
|
|
194
|
+
The **Language Plugin** lets you define “terms” (hotwords) in **`.knowhow/language.json`**. When those terms appear in chat (or certain file events happen), Knowhow resolves configured sources (files/text/URLs/etc.) and injects that context automatically.
|
|
195
|
+
|
|
196
|
+
Example `./.knowhow/language.json`:
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"API, api, rest*": {
|
|
201
|
+
"sources": [
|
|
202
|
+
{ "kind": "file", "data": [".knowhow/docs/api/**/*.md"] }
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Now when you type something like “Explain the API…”, Knowhow will automatically pull in the matching API docs.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## 📚 Embeddings
|
|
213
|
+
|
|
214
|
+
Embeddings are the backbone of semantic retrieval.
|
|
215
|
+
|
|
216
|
+
### Generate embeddings
|
|
217
|
+
|
|
218
|
+
Knowhow uses `embedSources` from your config:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
knowhow embed
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
It writes embedding JSON to the configured `embedSources[].output` paths (commonly under `./.knowhow/embeddings/`).
|
|
225
|
+
|
|
226
|
+
### Upload/download to storage (and cloud KB)
|
|
227
|
+
|
|
228
|
+
- Upload:
|
|
229
|
+
```bash
|
|
230
|
+
knowhow upload
|
|
231
|
+
```
|
|
232
|
+
- Download:
|
|
233
|
+
```bash
|
|
234
|
+
knowhow download
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
If you’re uploading to Knowhow Cloud, you’ll use `remoteType: "knowhow"` with a `remoteId` (KB ID).
|
|
238
|
+
|
|
239
|
+
Full details:
|
|
240
|
+
- `autodoc/embeddings-guide.md`
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## 📄 Generate Docs
|
|
245
|
+
|
|
246
|
+
`knowhow generate` runs the **sources pipeline** from `config.sources`.
|
|
247
|
+
|
|
248
|
+
In short, for each `sources[]` entry it:
|
|
249
|
+
|
|
250
|
+
1. finds inputs (single file, glob, comma list, brace expansion)
|
|
251
|
+
2. resolves a prompt (from `promptsDir` / file / inline string)
|
|
252
|
+
3. writes outputs:
|
|
253
|
+
- multi-output mode if `output` ends with `/`
|
|
254
|
+
- single combined output otherwise
|
|
255
|
+
4. skips work using hashing via `./.knowhow/.hashes.json`
|
|
256
|
+
|
|
257
|
+
Run:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
knowhow generate
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Full guide:
|
|
264
|
+
- `autodoc/generate-guide.md`
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## 🔧 Worker System
|
|
269
|
+
|
|
270
|
+
The **Knowhow worker** is your bridge between local tools and the Knowhow cloud.
|
|
271
|
+
|
|
272
|
+
It runs a local MCP server that exposes selected tools to cloud agents (so an agent can operate on your repo/tools safely and intentionally).
|
|
273
|
+
|
|
274
|
+
### Security model highlights
|
|
275
|
+
|
|
276
|
+
- **Docker sandbox mode** (`--sandbox`) for stronger isolation
|
|
277
|
+
- **Passkey authentication** to protect tool access (worker can start “locked” until you unlock)
|
|
278
|
+
|
|
279
|
+
Full worker details:
|
|
280
|
+
- `autodoc/worker-guide.md`
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## 🧩 Extending Knowhow
|
|
285
|
+
|
|
286
|
+
Knowhow is designed to grow with your workflow—without forking core.
|
|
287
|
+
|
|
288
|
+
### Modules: add tools/agents/plugins/clients/commands
|
|
289
|
+
|
|
290
|
+
Modules are loaded from the `modules` array in `knowhow.json` (global + local are supported; load order is global then local). A module can register:
|
|
291
|
+
|
|
292
|
+
- tools
|
|
293
|
+
- agents
|
|
294
|
+
- plugins
|
|
295
|
+
- clients
|
|
296
|
+
- chat commands
|
|
297
|
+
|
|
298
|
+
Full guide:
|
|
299
|
+
- `autodoc/modules-guide.md`
|
|
300
|
+
|
|
301
|
+
### Skills system: reusable instruction packs (`SKILL.md`)
|
|
302
|
+
|
|
303
|
+
Skills let you store reusable instruction bundles as files named **`SKILL.md`** with frontmatter (`name`, `description`) and full markdown instructions.
|
|
304
|
+
|
|
305
|
+
Configured via `knowhow.json -> skills` (scanned recursively), and the Skills plugin injects matching skill content when the user prompt includes the skill name (case-insensitive substring match).
|
|
306
|
+
|
|
307
|
+
Full guide:
|
|
308
|
+
- `autodoc/skills-guide.md`
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 📖 CLI Reference
|
|
313
|
+
|
|
314
|
+
For the complete list of commands and their options, see:
|
|
315
|
+
- `autodoc/cli-reference.md`
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 🔗 Links
|
|
320
|
+
|
|
321
|
+
- Website: https://knowhow.tyvm.ai
|
|
322
|
+
- Twitter/X: https://x.com/micahriggan
|
|
323
|
+
- npm: https://www.npmjs.com/package/@tyvm/knowhow
|
|
324
|
+
```
|