@tyvm/knowhow 0.0.88 → 0.0.90

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 (90) hide show
  1. package/CONFIG.md +52 -0
  2. package/README.md +344 -29
  3. package/WORKER.md +169 -334
  4. package/autodoc/chat-guide.md +540 -0
  5. package/autodoc/cli-reference.md +765 -0
  6. package/autodoc/config-reference.md +541 -0
  7. package/autodoc/embeddings-guide.md +566 -0
  8. package/autodoc/generate-guide.md +477 -0
  9. package/autodoc/language-plugin-guide.md +443 -0
  10. package/autodoc/modules-guide.md +352 -0
  11. package/autodoc/plugins-guide.md +720 -0
  12. package/autodoc/quickstart-guide.md +129 -0
  13. package/autodoc/skills-guide.md +468 -0
  14. package/autodoc/worker-guide.md +526 -0
  15. package/package.json +2 -2
  16. package/src/ai.ts +33 -2
  17. package/src/config.ts +28 -4
  18. package/src/index.ts +22 -2
  19. package/src/processors/TokenCompressor.ts +2 -2
  20. package/src/processors/ToolResponseCache.ts +3 -3
  21. package/src/processors/tools/grepToolResponse.ts +9 -4
  22. package/src/processors/tools/jqToolResponse.ts +11 -6
  23. package/src/processors/tools/listStoredToolResponses.ts +1 -1
  24. package/src/processors/tools/tailToolResponse.ts +9 -4
  25. package/src/worker.ts +9 -7
  26. package/ts_build/package.json +2 -2
  27. package/ts_build/src/ai.js +18 -1
  28. package/ts_build/src/ai.js.map +1 -1
  29. package/ts_build/src/config.js +17 -2
  30. package/ts_build/src/config.js.map +1 -1
  31. package/ts_build/src/index.js +12 -2
  32. package/ts_build/src/index.js.map +1 -1
  33. package/ts_build/src/processors/TokenCompressor.js +2 -2
  34. package/ts_build/src/processors/TokenCompressor.js.map +1 -1
  35. package/ts_build/src/processors/ToolResponseCache.js +3 -3
  36. package/ts_build/src/processors/ToolResponseCache.js.map +1 -1
  37. package/ts_build/src/processors/tools/grepToolResponse.d.ts +3 -1
  38. package/ts_build/src/processors/tools/grepToolResponse.js +8 -2
  39. package/ts_build/src/processors/tools/grepToolResponse.js.map +1 -1
  40. package/ts_build/src/processors/tools/jqToolResponse.d.ts +3 -1
  41. package/ts_build/src/processors/tools/jqToolResponse.js +10 -4
  42. package/ts_build/src/processors/tools/jqToolResponse.js.map +1 -1
  43. package/ts_build/src/processors/tools/listStoredToolResponses.js +1 -1
  44. package/ts_build/src/processors/tools/listStoredToolResponses.js.map +1 -1
  45. package/ts_build/src/processors/tools/tailToolResponse.d.ts +3 -1
  46. package/ts_build/src/processors/tools/tailToolResponse.js +8 -2
  47. package/ts_build/src/processors/tools/tailToolResponse.js.map +1 -1
  48. package/ts_build/src/worker.js +5 -3
  49. package/ts_build/src/worker.js.map +1 -1
  50. package/autodoc/chat.mdx +0 -20
  51. package/autodoc/cli.mdx +0 -11
  52. package/autodoc/plugins/asana.mdx +0 -47
  53. package/autodoc/plugins/downloader/downloader.mdx +0 -38
  54. package/autodoc/plugins/downloader/plugin.mdx +0 -37
  55. package/autodoc/plugins/downloader/types.mdx +0 -42
  56. package/autodoc/plugins/embedding.mdx +0 -41
  57. package/autodoc/plugins/figma.mdx +0 -45
  58. package/autodoc/plugins/github.mdx +0 -40
  59. package/autodoc/plugins/jira.mdx +0 -46
  60. package/autodoc/plugins/language.mdx +0 -37
  61. package/autodoc/plugins/linear.mdx +0 -35
  62. package/autodoc/plugins/notion.mdx +0 -38
  63. package/autodoc/plugins/plugins.mdx +0 -59
  64. package/autodoc/plugins/types.mdx +0 -51
  65. package/autodoc/plugins/vim.mdx +0 -39
  66. package/autodoc/tools/addInternalTools.mdx +0 -1
  67. package/autodoc/tools/agentCall.mdx +0 -1
  68. package/autodoc/tools/asana/definitions.mdx +0 -10
  69. package/autodoc/tools/asana/index.mdx +0 -12
  70. package/autodoc/tools/askHuman.mdx +0 -1
  71. package/autodoc/tools/callPlugin.mdx +0 -1
  72. package/autodoc/tools/embeddingSearch.mdx +0 -1
  73. package/autodoc/tools/execCommand.mdx +0 -1
  74. package/autodoc/tools/fileSearch.mdx +0 -1
  75. package/autodoc/tools/finalAnswer.mdx +0 -1
  76. package/autodoc/tools/github/definitions.mdx +0 -6
  77. package/autodoc/tools/github/index.mdx +0 -8
  78. package/autodoc/tools/index.mdx +0 -14
  79. package/autodoc/tools/lintFile.mdx +0 -7
  80. package/autodoc/tools/list.mdx +0 -16
  81. package/autodoc/tools/modifyFile.mdx +0 -7
  82. package/autodoc/tools/patch.mdx +0 -9
  83. package/autodoc/tools/readBlocks.mdx +0 -1
  84. package/autodoc/tools/readFile.mdx +0 -1
  85. package/autodoc/tools/scanFile.mdx +0 -1
  86. package/autodoc/tools/textSearch.mdx +0 -6
  87. package/autodoc/tools/types/fileblock.mdx +0 -1
  88. package/autodoc/tools/visionTool.mdx +0 -1
  89. package/autodoc/tools/writeFile.mdx +0 -1
  90. package/test-comprehensive.ts +0 -31
@@ -0,0 +1,765 @@
1
+ # Knowhow CLI Reference (`knowhow`)
2
+
3
+ AI CLI with plugins and agents.
4
+
5
+ > **Note on source coverage:** The provided code excerpts explicitly detailed only some commands (`knowhow init`, and the operational functions behind `generate/embed/upload/download/purge`, plus the full `knowhow worker` implementation). For commands whose flags/options are not present in the excerpts, this reference documents the command with **usage syntax** and **no flags** (or marks options as “not defined in provided source”).
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Global](#global)
10
+ 2. [Commands](#commands)
11
+ - [`init`](#init)
12
+ - [`login`](#login)
13
+ - [`logout`](#logout)
14
+ - [`update`](#update)
15
+ - [`generate`](#generate)
16
+ - [`gen`](#gen)
17
+ - [`embed`](#embed)
18
+ - [`embed:purge`](#embedpurge)
19
+ - [`purge`](#purge)
20
+ - [`upload`](#upload)
21
+ - [`download`](#download)
22
+ - [`chat`](#chat)
23
+ - [`agent`](#agent)
24
+ - [`ask`](#ask)
25
+ - [`setup`](#setup)
26
+ - [`search`](#search)
27
+ - [`sessions`](#sessions)
28
+ - [`worker`](#worker)
29
+ - [`files`](#files)
30
+ - [`workers`](#workers)
31
+ - [`github-credentials`](#github-credentials)
32
+ 3. [Exit Codes / Error Handling](#exit-codes--error-handling)
33
+
34
+ ---
35
+
36
+ ## Global
37
+
38
+ - **Binary name:** `knowhow`
39
+ - **Version:** `knowhow --version`
40
+ - **Config migration:** On startup, the CLI runs config migration (`migrateConfig()`) before dispatching commands.
41
+ - Many operational commands call `setupServices()` first to wire services/clients/tools (and connect to configured backends).
42
+
43
+ ---
44
+
45
+ ## Commands
46
+
47
+ ### `init`
48
+
49
+ #### Purpose
50
+ Initialize Knowhow configuration and project-local folders/templates.
51
+
52
+ #### Usage syntax
53
+ ```bash
54
+ knowhow init
55
+ ```
56
+
57
+ #### Options / flags
58
+ None defined in the provided source excerpts.
59
+
60
+ #### What it creates/writes
61
+ - Creates local directory structure under `./.knowhow/`:
62
+ - `./.knowhow/`
63
+ - `./.knowhow/prompts/`
64
+ - `./.knowhow/docs/`
65
+ - `./.knowhow/embeddings/`
66
+ - Creates global template/config directory under `~/.knowhow/` and copies template files if missing:
67
+ - `./.knowhow/knowhow.json` (local)
68
+ - `./.knowhow/language.json` (local)
69
+ - `./.knowhow/.ignore`, `./.knowhow/.hashes.json`, `./.knowhow/.jwt` (local)
70
+ - Prompt templates: `./.knowhow/prompts/*.mdx` (local)
71
+ - Template folder/file permissions are set when created (folder `0o744`, files `0o600`).
72
+
73
+ #### Example
74
+ ```bash
75
+ knowhow init
76
+ ```
77
+
78
+ ---
79
+
80
+ ### `login`
81
+
82
+ #### Purpose
83
+ Authenticate the CLI with Knowhow.
84
+
85
+ #### Usage syntax
86
+ ```bash
87
+ knowhow login [--jwt <jwt>]
88
+ ```
89
+
90
+ #### Options / flags
91
+ - `--jwt <jwt>` — Use manual JWT input instead of browser login.
92
+
93
+ > If `--jwt` is provided, the implementation passes it to the login routine.
94
+
95
+ #### Example
96
+ ```bash
97
+ knowhow login
98
+ ```
99
+
100
+ ```bash
101
+ knowhow login --jwt "<your-jwt>"
102
+ ```
103
+
104
+ ---
105
+
106
+ ### `logout`
107
+
108
+ #### Purpose
109
+ Log out (clear authentication credentials).
110
+
111
+ #### Usage syntax
112
+ ```bash
113
+ knowhow logout
114
+ ```
115
+
116
+ #### Options / flags
117
+ Not defined in the provided source excerpts.
118
+
119
+ #### Example
120
+ ```bash
121
+ knowhow logout
122
+ ```
123
+
124
+ ---
125
+
126
+ ### `update`
127
+
128
+ #### Purpose
129
+ Update the globally installed `knowhow` CLI to the latest npm version.
130
+
131
+ #### Usage syntax
132
+ ```bash
133
+ knowhow update
134
+ ```
135
+
136
+ #### Options / flags
137
+ None.
138
+
139
+ #### Behavior
140
+ Runs:
141
+ ```bash
142
+ npm install -g knowhow@latest
143
+ ```
144
+
145
+ #### Example
146
+ ```bash
147
+ knowhow update
148
+ ```
149
+
150
+ ---
151
+
152
+ ### `generate`
153
+
154
+ #### Purpose
155
+ Run the configured sources pipeline to generate outputs (summaries/docs/etc.) based on `config.sources`.
156
+
157
+ #### Usage syntax
158
+ ```bash
159
+ knowhow generate
160
+ ```
161
+
162
+ #### Options / flags
163
+ No flags defined in the provided excerpts. Behavior is **configuration-driven**.
164
+
165
+ #### Configuration behavior (high level)
166
+ From `config.sources`, the CLI:
167
+ - Computes hashes (prompt hash and input file hash) and skips work if unchanged.
168
+ - For each source:
169
+ - If `source.kind === "file"` (or falsy): generates from matching files (`source.input`)
170
+ - Otherwise: treats `source.kind` as a plugin “kind”, writes to `source.output`, then continues with file-handling logic.
171
+
172
+ #### Example
173
+ ```bash
174
+ knowhow generate
175
+ ```
176
+
177
+ ---
178
+
179
+ ### `gen`
180
+
181
+ #### Purpose
182
+ Alias of `knowhow generate`.
183
+
184
+ #### Usage syntax
185
+ ```bash
186
+ knowhow gen
187
+ ```
188
+
189
+ #### Options / flags
190
+ Not defined in provided excerpts (assumed equivalent to `generate`).
191
+
192
+ #### Example
193
+ ```bash
194
+ knowhow gen
195
+ ```
196
+
197
+ ---
198
+
199
+ ### `embed`
200
+
201
+ #### Purpose
202
+ Generate embeddings for sources configured in `config.embedSources`.
203
+
204
+ #### Usage syntax
205
+ ```bash
206
+ knowhow embed
207
+ ```
208
+
209
+ #### Options / flags
210
+ No flags defined in the provided excerpts. Behavior is **configuration-driven**.
211
+
212
+ #### Configuration behavior (high level)
213
+ From `config.embedSources` (if unset, it exits immediately):
214
+ - Uses `config.embeddingModel` or defaults to `EmbeddingModels.openai.EmbeddingAda2`
215
+ - Uses ignore pattern from `getIgnorePattern()`
216
+ - Calls `embedSource(defaultModel, source, ignorePattern)` per configured embedding source.
217
+
218
+ #### Example
219
+ ```bash
220
+ knowhow embed
221
+ ```
222
+
223
+ ---
224
+
225
+ ### `embed:purge`
226
+
227
+ #### Purpose
228
+ Purge embeddings matching a glob pattern.
229
+ (Depending on the CLI implementation, this may be an alias of `knowhow purge`.)
230
+
231
+ #### Usage syntax
232
+ ```bash
233
+ knowhow embed:purge <pattern>
234
+ ```
235
+
236
+ #### Options / flags
237
+ None defined in provided excerpts.
238
+
239
+ #### Arguments
240
+ - `<pattern>` — Glob expression for files/chunks to purge.
241
+
242
+ #### Example
243
+ ```bash
244
+ knowhow embed:purge "**/*.md"
245
+ ```
246
+
247
+ ---
248
+
249
+ ### `purge`
250
+
251
+ #### Purpose
252
+ Purge (remove) embedding chunks for files matching a provided glob.
253
+
254
+ #### Usage syntax
255
+ ```bash
256
+ knowhow purge <globPath>
257
+ ```
258
+
259
+ #### Options / flags
260
+ None defined in the provided excerpts.
261
+
262
+ #### Arguments
263
+ - `<globPath>` — Glob expression for matching files whose chunks should be purged.
264
+
265
+ #### Behavior (from provided excerpt)
266
+ - Matches files via `globSync(globPath)`
267
+ - Loads configured embeddings map and config (`config.embedSources`)
268
+ - For each embedding “file” key:
269
+ - Filters out entries whose:
270
+ - `id` starts with `"./" + filePath` (removes chunks for that file)
271
+ - `text.length` exceeds the configured `chunkSize` for that embedding output
272
+ - Saves the pruned embeddings.
273
+
274
+ #### Example
275
+ ```bash
276
+ knowhow purge "src/**/*.ts"
277
+ ```
278
+
279
+ ---
280
+
281
+ ### `upload`
282
+
283
+ #### Purpose
284
+ Upload embedding JSON artifacts to remote storage destinations configured in `config.embedSources`.
285
+
286
+ #### Usage syntax
287
+ ```bash
288
+ knowhow upload
289
+ ```
290
+
291
+ #### Options / flags
292
+ No flags defined in the provided excerpts. Behavior is **configuration-driven**.
293
+
294
+ #### Configuration behavior (high level)
295
+ For each `config.embedSources[]` entry:
296
+ - Requires `source.remoteType`
297
+ - Reads embedding JSON from `source.output`
298
+ - Determines `embeddingName` from the output filename
299
+
300
+ Supports:
301
+ - **`remoteType: "s3"`**
302
+ - Uploads to: `s3://{bucketName}/{embeddingName}.json`
303
+ - **`remoteType: "knowhow"`**
304
+ - Requires `source.remoteId`
305
+ - Gets a presigned upload URL from the Knowhow API
306
+ - Uploads via S3 helper
307
+ - Calls `updateEmbeddingMetadata(...)` to sync metadata back to the backend
308
+ - Other types: skipped with a log.
309
+
310
+ #### Example
311
+ ```bash
312
+ knowhow upload
313
+ ```
314
+
315
+ ---
316
+
317
+ ### `download`
318
+
319
+ #### Purpose
320
+ Download embedding JSON artifacts from remote storage into local `source.output` paths.
321
+
322
+ #### Usage syntax
323
+ ```bash
324
+ knowhow download
325
+ ```
326
+
327
+ #### Options / flags
328
+ No flags defined in the provided excerpts. Behavior is **configuration-driven**.
329
+
330
+ #### Configuration behavior (high level)
331
+ For each `config.embedSources[]` entry:
332
+ - Requires `source.remoteType`
333
+ - Computes destination:
334
+ - `fileName = "${name}.json"` where `name` is derived from `source.output`
335
+ - `destinationPath = source.output`
336
+
337
+ Supports:
338
+ - **`remoteType: "s3"`**
339
+ - Downloads `/{bucket}/{fileName}` into `destinationPath`
340
+ - **`remoteType: "github"`**
341
+ - Downloads from GitHub into local `.knowhow/embeddings/${fileName}`
342
+ - **`remoteType: "knowhow"`**
343
+ - Requires `source.remoteId`
344
+ - Gets presigned download URL from Knowhow API and downloads locally
345
+ - Other types: logs message.
346
+
347
+ #### Example
348
+ ```bash
349
+ knowhow download
350
+ ```
351
+
352
+ ---
353
+
354
+ ### `chat`
355
+
356
+ #### Purpose
357
+ Start an interactive chat session with configured agents.
358
+
359
+ #### Usage syntax
360
+ ```bash
361
+ knowhow chat
362
+ ```
363
+
364
+ #### Options / flags
365
+ Not defined in provided source excerpts.
366
+
367
+ #### Example
368
+ ```bash
369
+ knowhow chat
370
+ ```
371
+
372
+ ---
373
+
374
+ ### `agent`
375
+
376
+ #### Purpose
377
+ Run a one-shot agent task with limits and optional resume.
378
+
379
+ #### Usage syntax
380
+ ```bash
381
+ knowhow agent [options]
382
+ ```
383
+
384
+ #### Options / flags
385
+ Not defined in provided source excerpts.
386
+
387
+ > If you have the command/CLI parser code for `agent`, share it and this section can be updated with exact flags/options.
388
+
389
+ #### Example
390
+ ```bash
391
+ knowhow agent
392
+ ```
393
+
394
+ ---
395
+
396
+ ### `ask`
397
+
398
+ #### Purpose
399
+ Direct AI questioning without agent orchestration.
400
+
401
+ #### Usage syntax
402
+ ```bash
403
+ knowhow ask [options]
404
+ ```
405
+
406
+ #### Options / flags
407
+ Not defined in provided source excerpts.
408
+
409
+ #### Example
410
+ ```bash
411
+ knowhow ask "What is Knowhow?"
412
+ ```
413
+
414
+ ---
415
+
416
+ ### `setup`
417
+
418
+ #### Purpose
419
+ Ask the agent to configure Knowhow (runs setup workflow).
420
+
421
+ #### Usage syntax
422
+ ```bash
423
+ knowhow setup
424
+ ```
425
+
426
+ #### Options / flags
427
+ Not defined in provided source excerpts.
428
+
429
+ #### Example
430
+ ```bash
431
+ knowhow setup
432
+ ```
433
+
434
+ ---
435
+
436
+ ### `search`
437
+
438
+ #### Purpose
439
+ Search embeddings directly from the CLI.
440
+
441
+ #### Usage syntax
442
+ ```bash
443
+ knowhow search [options]
444
+ ```
445
+
446
+ #### Options / flags
447
+ Not defined in provided source excerpts.
448
+
449
+ #### Example
450
+ ```bash
451
+ knowhow search "how to configure plugins"
452
+ ```
453
+
454
+ ---
455
+
456
+ ### `sessions`
457
+
458
+ #### Purpose
459
+ Manage and list agent sessions from the CLI.
460
+
461
+ #### Usage syntax
462
+ ```bash
463
+ knowhow sessions [options]
464
+ ```
465
+
466
+ #### Options / flags
467
+ Not defined in provided source excerpts.
468
+
469
+ #### Example
470
+ ```bash
471
+ knowhow sessions --all
472
+ ```
473
+
474
+ ---
475
+
476
+ ### `worker`
477
+
478
+ #### Purpose
479
+ Start a Knowhow **worker** process exposing worker’s MCP tools over WebSocket to the Knowhow API.
480
+
481
+ Worker can run in:
482
+ - **Host mode** (default)
483
+ - **Docker sandbox mode** (`--sandbox`)
484
+ - **Passkey-gated locked mode** (when passkey auth is configured; worker starts locked)
485
+
486
+ It can also register/share/unshare the worker and can set up a tunnel (config-driven).
487
+
488
+ #### Usage syntax
489
+ ```bash
490
+ knowhow worker [options]
491
+ ```
492
+
493
+ #### Options / flags (from `src/worker.ts`)
494
+
495
+ ##### `--register`
496
+ - **Type:** boolean
497
+ - **Purpose:** Register the current directory (`process.cwd()`) as a worker path.
498
+ - **Effect:** Calls `registerWorkerPath(process.cwd())` and **exits** (does not start the worker loop).
499
+
500
+ **Example**
501
+ ```bash
502
+ knowhow worker --register
503
+ ```
504
+
505
+ ---
506
+
507
+ ##### `--share`
508
+ - **Type:** boolean
509
+ - **Purpose:** Share this worker with your organization.
510
+ - **Effect:** Adds request header `Shared: "true"`.
511
+
512
+ **Example**
513
+ ```bash
514
+ knowhow worker --share
515
+ ```
516
+
517
+ ---
518
+
519
+ ##### `--unshare`
520
+ - **Type:** boolean
521
+ - **Purpose:** Make this worker private/unshared.
522
+ - **Effect:** Adds request header `Shared: "false"`.
523
+
524
+ **Example**
525
+ ```bash
526
+ knowhow worker --unshare
527
+ ```
528
+
529
+ ---
530
+
531
+ ##### `--sandbox`
532
+ - **Type:** boolean
533
+ - **Purpose:** Run the worker in a **Docker container** for isolation.
534
+ - **Effect in code:**
535
+ - Checks Docker availability
536
+ - Rebuilds worker Docker image (`Docker.buildWorkerImage()`)
537
+ - Starts Docker with:
538
+ - `workspaceDir: process.cwd()`
539
+ - JWT + API URL + tunnel/config wiring
540
+ - share/unshare mapping via container options
541
+ - Persists config preference: `config.worker.sandbox = true`
542
+
543
+ **Example**
544
+ ```bash
545
+ knowhow worker --sandbox
546
+ ```
547
+
548
+ ---
549
+
550
+ ##### `--no-sandbox`
551
+ - **Type:** boolean
552
+ - **Purpose:** Force host mode (disable Docker sandbox).
553
+ - **Effect:** Persists `config.worker.sandbox = false`.
554
+
555
+ **Example**
556
+ ```bash
557
+ knowhow worker --no-sandbox
558
+ ```
559
+
560
+ ---
561
+
562
+ ##### `--passkey`
563
+ - **Type:** boolean
564
+ - **Purpose:** Run passkey setup for this worker (browser-based registration flow).
565
+ - **Effect in code:**
566
+ - Requires you to be logged in (`loadJwt()`).
567
+ - If not logged in: prints error:
568
+ - `You must be logged in to set up a passkey. Run 'knowhow login' first.`
569
+ - Calls `new PasskeySetupService().setup(jwt)`
570
+
571
+ **Example**
572
+ ```bash
573
+ knowhow worker --passkey
574
+ ```
575
+
576
+ ---
577
+
578
+ ##### `--passkey-reset`
579
+ - **Type:** boolean
580
+ - **Purpose:** Reset/remove passkey configuration.
581
+ - **Effect:** Calls `new PasskeySetupService().reset()` and exits.
582
+
583
+ **Example**
584
+ ```bash
585
+ knowhow worker --passkey-reset
586
+ ```
587
+
588
+ ---
589
+
590
+ #### Behavior notes
591
+
592
+ ##### Docker-in-Docker detection
593
+ If `process.env.KNOWHOW_DOCKER === "true"`:
594
+ - It forces sandbox off:
595
+ - `options.sandbox = false`
596
+ - `options.noSandbox = true`
597
+
598
+ ##### Sandbox mode selection priority
599
+ - CLI flags `--sandbox` / `--no-sandbox`
600
+ - then config: `config.worker?.sandbox`
601
+ - default: host mode (`false`)
602
+
603
+ ##### Allowed tools auto-initialization
604
+ If `config.worker.allowedTools` is missing:
605
+ - Populates allowed tools from `Tools.getToolNames()`
606
+ - Persists it via `updateConfig(config)`
607
+ - Exits without starting worker loop.
608
+
609
+ ##### Passkey-gated locked worker
610
+ If config includes:
611
+ - `config.worker?.auth?.passkey?.publicKey`
612
+ - `config.worker?.auth?.passkey?.credentialId`
613
+
614
+ Then:
615
+ - Worker starts **locked**
616
+ - Tool calls are wrapped so tools return:
617
+ ```json
618
+ {
619
+ "error": "WORKER_LOCKED",
620
+ "message": "Worker is locked. Call the `unlock` tool with your passkey assertion to unlock it first."
621
+ }
622
+ ```
623
+
624
+ Additionally, the tools `unlock` and `lock` are registered.
625
+
626
+ ##### Tunnel configuration (config-driven)
627
+ If `config.worker.tunnel.enabled === true`, the worker may open an additional WebSocket to `/ws/tunnel` and configure:
628
+ - `allowedPorts` (warns if unset)
629
+ - `maxConcurrentStreams` (default `50`)
630
+ - `localHost` (auto-detects `host.docker.internal` when inside Docker, otherwise `127.0.0.1`)
631
+ - URL rewriting behavior (config-driven)
632
+
633
+ No CLI flags are defined for tunnel options in the provided excerpt.
634
+
635
+ #### Examples
636
+
637
+ Start worker in host mode:
638
+ ```bash
639
+ knowhow worker
640
+ ```
641
+
642
+ Start worker in Docker sandbox and share it:
643
+ ```bash
644
+ knowhow worker --sandbox --share
645
+ ```
646
+
647
+ Register current directory as a worker:
648
+ ```bash
649
+ knowhow worker --register
650
+ ```
651
+
652
+ Set up passkey auth (requires `knowhow login` first):
653
+ ```bash
654
+ knowhow worker --passkey
655
+ ```
656
+
657
+ Reset passkey:
658
+ ```bash
659
+ knowhow worker --passkey-reset
660
+ ```
661
+
662
+ ---
663
+
664
+ ### `files`
665
+
666
+ #### Purpose
667
+ Sync files between local filesystem and Knowhow FS using configured `fileMounts`.
668
+
669
+ #### Usage syntax
670
+ ```bash
671
+ knowhow files [options]
672
+ ```
673
+
674
+ #### Options / flags
675
+ Not defined in provided source excerpts.
676
+
677
+ #### Example
678
+ ```bash
679
+ knowhow files --dry-run --download
680
+ ```
681
+
682
+ ---
683
+
684
+ ### `workers`
685
+
686
+ #### Purpose
687
+ Manage and start registered workers.
688
+
689
+ #### Usage syntax
690
+ ```bash
691
+ knowhow workers [options]
692
+ ```
693
+
694
+ #### Options / flags
695
+ Not defined in provided source excerpts.
696
+
697
+ #### Examples
698
+ ```bash
699
+ knowhow workers --list
700
+ ```
701
+
702
+ ```bash
703
+ knowhow workers --unregister /path/to/worker
704
+ ```
705
+
706
+ ```bash
707
+ knowhow workers --clear
708
+ ```
709
+
710
+ Start all workers:
711
+ ```bash
712
+ knowhow workers
713
+ ```
714
+
715
+ ---
716
+
717
+ ### `github-credentials`
718
+
719
+ #### Purpose
720
+ Git credential helper for GitHub using Knowhow as the backend.
721
+
722
+ #### Usage syntax
723
+ ```bash
724
+ knowhow github-credentials [action] [--repo <repo>]
725
+ ```
726
+
727
+ #### Arguments
728
+ - `[action]` — credential helper action (commonly `get`, `store`, `erase`)
729
+ - `--repo <repo>` — repository in `owner/repo` format
730
+
731
+ #### Options / flags
732
+ - `--repo <repo>` — Repo to fetch credentials for.
733
+ - If omitted, and `git remote get-url origin` exists, it attempts to infer `owner/repo` from origin URL.
734
+
735
+ #### Behavior (from provided excerpt)
736
+ - If `action === "get"`:
737
+ - Reads stdin for git credential protocol/host lines (implementation ignores parsed host and always fetches for the repo)
738
+ - Fetches credentials via `KnowhowSimpleClient().getGitCredential(repo || "")`
739
+ - Outputs:
740
+ - `protocol=...`
741
+ - `host=...`
742
+ - `username=...`
743
+ - `password=...`
744
+ - If `action` is `store` or `erase`:
745
+ - exits successfully without output.
746
+
747
+ #### Examples
748
+
749
+ Configure git to use the helper:
750
+ ```bash
751
+ git config credential.helper 'knowhow github-credentials'
752
+ ```
753
+
754
+ Manual credential request:
755
+ ```bash
756
+ knowhow github-credentials get --repo "myorg/myrepo"
757
+ ```
758
+
759
+ ---
760
+
761
+ ## Exit Codes / Error Handling
762
+
763
+ - Many command implementations use `try/catch` and call `process.exit(1)` on errors.
764
+ - For `update`, npm install errors are logged and exit code is `1`.
765
+ - On startup, command dispatch is handled by `program.parseAsync(...)`, and the CLI follows standard Node process error handling when uncaught errors occur.