@tyvm/knowhow 0.0.109 → 0.0.111

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 (108) hide show
  1. package/autodoc/README.md +324 -0
  2. package/autodoc/chat-guide.md +268 -365
  3. package/autodoc/cli-reference.md +399 -473
  4. package/autodoc/config-reference.md +431 -330
  5. package/autodoc/embeddings-guide.md +223 -322
  6. package/autodoc/generate-guide.md +261 -301
  7. package/autodoc/language-plugin-guide.md +221 -247
  8. package/autodoc/modules-guide.md +242 -215
  9. package/autodoc/plugins-guide.md +470 -469
  10. package/autodoc/quickstart-guide.md +67 -70
  11. package/autodoc/skills-guide.md +455 -339
  12. package/autodoc/worker-guide.md +301 -308
  13. package/package.json +1 -1
  14. package/scripts/build-for-node.sh +10 -24
  15. package/src/agents/tools/list.ts +2 -2
  16. package/src/ai.ts +81 -37
  17. package/src/auth/browserLogin.ts +129 -3
  18. package/src/chat/CliChatService.ts +1 -1
  19. package/src/chat/modules/AgentModule.ts +7 -2
  20. package/src/chat/modules/SessionsModule.ts +40 -1
  21. package/src/chat/modules/SystemModule.ts +2 -2
  22. package/src/clients/anthropic.ts +1 -1
  23. package/src/clients/index.ts +25 -6
  24. package/src/clients/openai.ts +8 -5
  25. package/src/clients/types.ts +29 -6
  26. package/src/clients/withRetry.ts +89 -0
  27. package/src/commands/agent.ts +30 -0
  28. package/src/commands/modules.ts +417 -47
  29. package/src/config.ts +1 -1
  30. package/src/fileSync.ts +20 -12
  31. package/src/hashes.ts +43 -22
  32. package/src/index.ts +4 -2
  33. package/src/login.ts +3 -2
  34. package/src/processors/Base64ImageDetector.ts +73 -0
  35. package/src/services/Mcp.ts +14 -1
  36. package/src/services/MediaProcessorService.ts +79 -10
  37. package/src/services/modules/index.ts +47 -18
  38. package/src/utils/http.ts +9 -2
  39. package/tests/processors/Base64ImageDetector.test.ts +160 -0
  40. package/tests/unit/clients/AIClient.test.ts +446 -0
  41. package/tests/unit/clients/withRetry.test.ts +319 -0
  42. package/tests/unit/commands/github-credentials.test.ts +1 -2
  43. package/ts_build/package.json +1 -1
  44. package/ts_build/src/agents/tools/list.js +2 -2
  45. package/ts_build/src/agents/tools/list.js.map +1 -1
  46. package/ts_build/src/ai.d.ts +3 -3
  47. package/ts_build/src/ai.js +51 -23
  48. package/ts_build/src/ai.js.map +1 -1
  49. package/ts_build/src/auth/browserLogin.d.ts +2 -0
  50. package/ts_build/src/auth/browserLogin.js +91 -3
  51. package/ts_build/src/auth/browserLogin.js.map +1 -1
  52. package/ts_build/src/chat/CliChatService.js +1 -1
  53. package/ts_build/src/chat/CliChatService.js.map +1 -1
  54. package/ts_build/src/chat/modules/AgentModule.js +5 -2
  55. package/ts_build/src/chat/modules/AgentModule.js.map +1 -1
  56. package/ts_build/src/chat/modules/SessionsModule.js +30 -1
  57. package/ts_build/src/chat/modules/SessionsModule.js.map +1 -1
  58. package/ts_build/src/chat/modules/SystemModule.js +2 -2
  59. package/ts_build/src/chat/modules/SystemModule.js.map +1 -1
  60. package/ts_build/src/clients/anthropic.js +1 -1
  61. package/ts_build/src/clients/anthropic.js.map +1 -1
  62. package/ts_build/src/clients/index.js +7 -6
  63. package/ts_build/src/clients/index.js.map +1 -1
  64. package/ts_build/src/clients/openai.js +4 -4
  65. package/ts_build/src/clients/openai.js.map +1 -1
  66. package/ts_build/src/clients/types.d.ts +12 -6
  67. package/ts_build/src/clients/withRetry.d.ts +2 -0
  68. package/ts_build/src/clients/withRetry.js +60 -0
  69. package/ts_build/src/clients/withRetry.js.map +1 -0
  70. package/ts_build/src/commands/agent.js +25 -0
  71. package/ts_build/src/commands/agent.js.map +1 -1
  72. package/ts_build/src/commands/modules.js +359 -32
  73. package/ts_build/src/commands/modules.js.map +1 -1
  74. package/ts_build/src/config.js +1 -1
  75. package/ts_build/src/config.js.map +1 -1
  76. package/ts_build/src/fileSync.d.ts +2 -2
  77. package/ts_build/src/fileSync.js +13 -11
  78. package/ts_build/src/fileSync.js.map +1 -1
  79. package/ts_build/src/hashes.d.ts +2 -2
  80. package/ts_build/src/hashes.js +40 -16
  81. package/ts_build/src/hashes.js.map +1 -1
  82. package/ts_build/src/index.js +1 -1
  83. package/ts_build/src/index.js.map +1 -1
  84. package/ts_build/src/login.js +2 -2
  85. package/ts_build/src/login.js.map +1 -1
  86. package/ts_build/src/processors/Base64ImageDetector.d.ts +3 -0
  87. package/ts_build/src/processors/Base64ImageDetector.js +42 -0
  88. package/ts_build/src/processors/Base64ImageDetector.js.map +1 -1
  89. package/ts_build/src/services/Mcp.js +9 -1
  90. package/ts_build/src/services/Mcp.js.map +1 -1
  91. package/ts_build/src/services/MediaProcessorService.d.ts +5 -4
  92. package/ts_build/src/services/MediaProcessorService.js +53 -8
  93. package/ts_build/src/services/MediaProcessorService.js.map +1 -1
  94. package/ts_build/src/services/modules/index.js +35 -12
  95. package/ts_build/src/services/modules/index.js.map +1 -1
  96. package/ts_build/src/utils/http.d.ts +2 -1
  97. package/ts_build/src/utils/http.js +11 -2
  98. package/ts_build/src/utils/http.js.map +1 -1
  99. package/ts_build/tests/processors/Base64ImageDetector.test.js +111 -0
  100. package/ts_build/tests/processors/Base64ImageDetector.test.js.map +1 -1
  101. package/ts_build/tests/unit/clients/AIClient.test.d.ts +1 -0
  102. package/ts_build/tests/unit/clients/AIClient.test.js +339 -0
  103. package/ts_build/tests/unit/clients/AIClient.test.js.map +1 -0
  104. package/ts_build/tests/unit/clients/withRetry.test.d.ts +1 -0
  105. package/ts_build/tests/unit/clients/withRetry.test.js +225 -0
  106. package/ts_build/tests/unit/clients/withRetry.test.js.map +1 -0
  107. package/ts_build/tests/unit/commands/github-credentials.test.js +1 -2
  108. package/ts_build/tests/unit/commands/github-credentials.test.js.map +1 -1
@@ -1,129 +1,126 @@
1
1
  # Knowhow Quickstart
2
2
 
3
- Knowhow is an AI CLI (plugins + agents) for generating docs, creating embeddings, and running chat/agents.
3
+ Knowhow is an AI CLI that uses plugins/tools, builds embeddings from your files, and lets you chat/ask using a configured project.
4
4
 
5
- Project home: https://knowhow.tyvm.ai
5
+ Website: https://knowhow.tyvm.ai
6
6
 
7
7
  ---
8
8
 
9
9
  ## 1) Installation
10
10
 
11
- ### npm (global install)
11
+ ### Option A: Install globally
12
12
  ```bash
13
13
  npm i -g @tyvm/knowhow
14
14
  ```
15
15
 
16
- ### npx (run without installing globally)
16
+ ### Option B: Use with `npx` (no global install)
17
17
  ```bash
18
- npx @tyvm/knowhow@latest --version
18
+ npx @tyvm/knowhow@latest knowhow --version
19
19
  ```
20
20
 
21
- Now you can run:
22
- ```bash
23
- knowhow --help
24
- ```
21
+ > After that, you can run commands as `knowhow ...` (or via `npx ... knowhow ...`).
25
22
 
26
23
  ---
27
24
 
28
25
  ## 2) Initialize a project (`knowhow init`)
29
26
 
30
- From your project directory:
27
+ From your project folder, run:
31
28
  ```bash
32
29
  knowhow init
33
30
  ```
34
31
 
35
- This creates:
32
+ This creates a local **Knowhow workspace** in `./.knowhow/` and also sets up global templates in `~/.knowhow/`.
33
+
34
+ ### What it creates locally
36
35
 
37
- - **Local config** (in your current directory):
38
- - `.knowhow/` directory
39
- - `.knowhow/knowhow.json` (your config)
40
- - `.knowhow/prompts/` (prompt templates)
41
- - `.knowhow/docs/` (generated docs)
42
- - `.knowhow/embeddings/` (generated embeddings)
43
- - `.knowhow/language.json`
44
- - `.knowhow/.ignore`, `.knowhow/.hashes.json`, `.knowhow/.jwt` (JWT placeholder)
36
+ In your current directory:
37
+ - `./.knowhow/`
38
+ - `knowhow.json` (your project configuration)
39
+ - `language.json`
40
+ - `prompts/` (prompt templates)
41
+ - `docs/` (generated docs output)
42
+ - `embeddings/` (generated embedding output)
43
+ - `.ignore`, `.hashes.json`, `.jwt` (runtime/support files)
45
44
 
46
- - **Global template config** (in your home directory):
47
- - `~/.knowhow/` (stores template copies used by `init`)
45
+ You can edit `./.knowhow/knowhow.json` to customize sources, embeddings, plugins, agents, etc.
48
46
 
49
47
  ---
50
48
 
51
49
  ## 3) Login (`knowhow login`)
52
50
 
53
- Login uses **browser-based OAuth** by default (you approve in a browser, the CLI polls for approval, then retrieves a JWT).
54
-
51
+ Run:
55
52
  ```bash
56
53
  knowhow login
57
54
  ```
58
55
 
59
- If you prefer to paste a token manually:
56
+ ### What login does
57
+ - Starts a **browser-based OAuth/login flow** (it creates a short-lived login session, opens your browser, waits until you approve).
58
+ - Retrieves a **JWT token** after approval.
59
+ - Stores the JWT at:
60
+ - `./.knowhow/.jwt` (permissions are set so only you can read it)
61
+
62
+ ### If you already have a JWT
60
63
  ```bash
61
64
  knowhow login --jwt
62
65
  ```
63
66
 
64
- What it does:
65
- - Performs browser login flow against **https://knowhow.tyvm.ai**
66
- - Stores the returned **JWT** in:
67
- - `.knowhow/.jwt` (permissioned to be read/write only by you)
68
- - Updates `knowhow.json` by adding a **model provider** entry for the `knowhow` proxy (so Knowhow-backed models work with your config)
67
+ After authentication, Knowhow:
68
+ - Calls Knowhow’s API (`/api/users/me`) using your JWT
69
+ - Prints your current user + organization
70
+ - Saves `orgId` into `./.knowhow/knowhow.json`
71
+ - Ensures the `knowhow` model provider is enabled in your config
69
72
 
70
73
  ---
71
74
 
72
75
  ## 4) Basic first run
73
76
 
74
- After `init` + `login`, you can immediately start a chat UI:
77
+ After `knowhow init` + `knowhow login`, you can start immediately.
75
78
 
79
+ ### Recommended: build embeddings first
76
80
  ```bash
77
- knowhow chat
81
+ knowhow embed
78
82
  ```
79
83
 
80
- You can also ask directly (no agent overhead):
84
+ ### Then chat
81
85
  ```bash
82
- knowhow ask --input "What should I work on next?"
86
+ knowhow chat
83
87
  ```
84
88
 
85
- (Optionally) search embeddings:
86
- ```bash
87
- knowhow search --input "How do plugins work in Knowhow?"
88
- ```
89
+ You can ask questions about your indexed project content.
89
90
 
90
91
  ---
91
92
 
92
- ## 5) Key concepts (quick mental model)
93
-
94
- - **`knowhow.json` (config file)**
95
- The main project configuration inside `.knowhow/knowhow.json`. It controls:
96
- - **plugins** (enabled/disabled)
97
- - **sources** (what to generate and where)
98
- - **embedSources** (what to embed and where)
99
- - **embeddingModel**, agents, model providers, worker settings, etc.
100
-
101
- - **Plugins**
102
- Small capability modules (e.g., language, git, embeddings, etc.). Knowhow enables/loads them based on `knowhow.json`.
103
-
104
- - **Sources**
105
- Inputs that Knowhow can **generate** from. Each source defines things like:
106
- - `input` glob/pattern
107
- - `output` path
108
- - `prompt` template to use
109
-
110
- - **Embeddings (and `embedSources`)**
111
- Defines what files to chunk/embed and where to write embedding JSON outputs (typically under `.knowhow/embeddings/`).
112
-
113
- - **Worker**
114
- A separate runnable process to execute work in a sandbox/isolated way. You can start/register workers with:
115
- ```bash
116
- knowhow worker --register
117
- ```
118
- and manage them with:
119
- ```bash
120
- knowhow workers --list
121
- ```
93
+ ## 5) Key concepts (quick overview)
122
94
 
123
- ---
95
+ ### `knowhow.json` (project config)
96
+ Your main configuration file at `./.knowhow/knowhow.json`. It controls:
97
+ - enabled plugins
98
+ - what files to turn into docs/artifacts (**sources**)
99
+ - what files to embed for retrieval (**embedSources**)
100
+ - model providers and the worker/tunneling behavior
101
+
102
+ ### Plugins
103
+ Plugins are “tools” Knowhow can use (for example: embeddings, git, agents, download, etc.).
104
+ They’re enabled/disabled via `config.plugins.enabled/disabled`.
105
+
106
+ ### Sources
107
+ **Sources** describe generation tasks (input files → output file(s) + which prompt to use).
108
+ Example fields (names vary by config): `sources[].input`, `sources[].output`, `sources[].prompt`.
109
+
110
+ ### Embeddings
111
+ **Embeddings** are vector indexes built from configured inputs (`embedSources`).
112
+ Running:
113
+ ```bash
114
+ knowhow embed
115
+ ```
116
+ creates embedding data under `./.knowhow/embeddings/` (based on your `embedSources`).
124
117
 
125
- See you inside the CLI. 👍
118
+ ### Worker
119
+ A **worker** controls background execution features (for example, tunneling/remote execution support).
120
+ This lives under the `worker` section in `knowhow.json`.
121
+
122
+ ---
126
123
 
127
- **Links**
124
+ ## Links
128
125
  - https://knowhow.tyvm.ai
129
126
  - https://x.com/micahriggan