nocaap 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -18,21 +18,18 @@ Your AI coding assistant is only as good as its context.
18
18
  * **Native Git Security:** We don't handle tokens. If you have SSH access to the repo via GitHub/GitLab, it works. If you don't, it skips. Zero configuration.
19
19
  * **Lightning Fast:** Uses `git sparse-checkout` and `partial clones` to fetch *only* the specific documentation folders you need, not the entire repo history.
20
20
  * **AI Optimized:** Auto-generates a token-conscious `INDEX.md` that guides AI agents to the right files without blowing up context windows.
21
+ * **MCP Server:** Expose your context to Claude Desktop via Model Context Protocol with search, document retrieval, and section extraction tools.
22
+ * **Hybrid Search:** Full-text (BM25) and semantic (vector) search with Reciprocal Rank Fusion for best results.
21
23
  * **Private Repo Support:** Seamlessly handles private repositories using your existing SSH keys - no tokens to manage.
22
24
 
23
25
  ## 📦 Installation
24
26
 
25
- ### Option 1: Install from GitHub (Recommended)
26
-
27
27
  ```bash
28
- # Install directly from GitHub
29
- npm install -g git+https://github.com/niteshpant99/nocaap.git
30
-
31
- # Or with SSH (if you have SSH keys configured)
32
- npm install -g git+ssh://git@github.com:niteshpant99/nocaap.git
28
+ # Install from npm (recommended)
29
+ npm install -g nocaap
33
30
  ```
34
31
 
35
- ### Option 2: Install from Source
32
+ ### Alternative: Install from Source
36
33
 
37
34
  ```bash
38
35
  # Clone the repo
@@ -43,18 +40,33 @@ cd nocaap
43
40
  pnpm install
44
41
  pnpm run build
45
42
 
46
- # Link globally (makes 'nocaap' command available)
43
+ # Link globally
47
44
  npm link
48
45
  ```
49
46
 
50
- ### Option 3: npx (Run without installing)
47
+ ## 5-Minute Quick Start (Human Flow)
48
+
49
+ Use this if you want the shortest path from install to merged PR.
51
50
 
52
51
  ```bash
53
- # Run setup directly from GitHub
54
- npx github:niteshpant99/nocaap setup
52
+ # 1) Install
53
+ npm install -g nocaap
54
+
55
+ # 2) Set your org registry
56
+ nocaap config registry https://github.com/your-org/context-hub
57
+
58
+ # 3) Install contexts in this project
59
+ nocaap setup
60
+
61
+ # 4) Sync before editing/pushing
62
+ nocaap update <alias>
63
+
64
+ # 5) Push changes as a PR
65
+ nocaap push <alias> -m "Update documentation"
55
66
  ```
56
67
 
57
- > **Coming Soon:** `npm install -g nocaap` (npm package publication in progress)
68
+ Then open the PR URL, review, and use **Squash and merge** in GitHub web UI.
69
+ For the full walkthrough, see [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md).
58
70
 
59
71
  ## 🏗️ Setting Up Your Organization's Context Hub
60
72
 
@@ -145,7 +157,98 @@ nocaap update
145
157
  * **Safety:** Checks for local changes ("Dirty State") before overwriting.
146
158
  * **Drift:** Detects if the remote version or configured path has changed.
147
159
 
148
- ### 4. Other Commands
160
+ ### 4. Push Changes Upstream
161
+
162
+ Push local context changes back to the source repository as a PR.
163
+
164
+ ```bash
165
+ # Interactive - select packages to push
166
+ nocaap push
167
+
168
+ # Push specific package
169
+ nocaap push engineering
170
+
171
+ # Push all changed packages
172
+ nocaap push --all
173
+
174
+ # With custom commit message
175
+ nocaap push engineering -m "Update API documentation"
176
+ ```
177
+
178
+ **Features:**
179
+ - Creates branch: `nocaap/{alias}-{YYYYMMDD}`
180
+ - Auto-creates PR via gh CLI or GitHub API
181
+ - Detects upstream divergence (requires `nocaap update` first)
182
+
183
+ **After `nocaap push` (default flow):**
184
+ 1. Open the PR URL printed by the CLI.
185
+ 2. Review files and wait for checks.
186
+ 3. Use **Squash and merge** in GitHub web UI.
187
+ 4. Optionally delete the branch.
188
+
189
+ Full guide: [`docs/GITHUB_WORKFLOW.md`](./docs/GITHUB_WORKFLOW.md)
190
+
191
+ ### 5. Build Search Index
192
+
193
+ Build a searchable index for AI agents to query your context.
194
+
195
+ ```bash
196
+ # Build full-text search index
197
+ nocaap index
198
+
199
+ # Build with semantic search (requires Ollama or OpenAI)
200
+ nocaap index --semantic
201
+
202
+ # Specify embedding provider
203
+ nocaap index --semantic --provider ollama
204
+ nocaap index --semantic --provider openai
205
+ ```
206
+
207
+ **Embedding Providers:**
208
+ - **Ollama** (default): Free, local, requires `ollama pull nomic-embed-text`
209
+ - **OpenAI**: Requires `OPENAI_API_KEY` environment variable
210
+ - **Transformers.js**: Automatic fallback, runs in Node.js
211
+
212
+ ### 6. Start MCP Server
213
+
214
+ Expose your context to AI agents via Model Context Protocol.
215
+
216
+ ```bash
217
+ # Start MCP server (for Claude Desktop)
218
+ nocaap serve
219
+
220
+ # Specify project root
221
+ nocaap serve --root /path/to/project
222
+
223
+ # Print Claude Desktop config JSON
224
+ nocaap serve --print-config
225
+ ```
226
+
227
+ **Claude Desktop Setup:**
228
+
229
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
230
+
231
+ ```json
232
+ {
233
+ "mcpServers": {
234
+ "nocaap": {
235
+ "command": "nocaap",
236
+ "args": ["serve", "--root", "/path/to/your/project"]
237
+ }
238
+ }
239
+ }
240
+ ```
241
+
242
+ **MCP Tools Available:**
243
+ | Tool | Description |
244
+ |------|-------------|
245
+ | `get_overview` | Get structured overview of all context (recommended first call) |
246
+ | `search` | Search across all packages (fulltext, semantic, or hybrid) |
247
+ | `get_document` | Retrieve full document by path |
248
+ | `get_section` | Extract specific section by heading |
249
+ | `list_contexts` | List installed packages |
250
+
251
+ ### 7. Other Commands
149
252
 
150
253
  ```bash
151
254
  # List installed packages
@@ -158,6 +261,31 @@ nocaap remove <alias>
158
261
  nocaap generate
159
262
  ```
160
263
 
264
+ ## 📋 Command Reference
265
+
266
+ | Command | Description |
267
+ |---------|-------------|
268
+ | `nocaap setup` | Interactive setup wizard |
269
+ | `nocaap add <repo>` | Add a context package |
270
+ | `nocaap update [alias]` | Update packages (or all if no alias) |
271
+ | `nocaap list` | List installed packages |
272
+ | `nocaap remove <alias>` | Remove a package |
273
+ | `nocaap push [alias]` | Push changes upstream as PR |
274
+ | `nocaap index` | Build search index (add `--semantic` for vectors) |
275
+ | `nocaap serve` | Start MCP server for AI agents |
276
+ | `nocaap config [key] [value]` | Manage configuration |
277
+
278
+ ## 📚 Human Documentation
279
+
280
+ These guides are written for people (not agent instructions):
281
+
282
+ - [Documentation Index](./docs/README.md)
283
+ - [Getting Started](./docs/GETTING_STARTED.md)
284
+ - [GitHub Workflow](./docs/GITHUB_WORKFLOW.md)
285
+ - [Troubleshooting](./docs/TROUBLESHOOTING.md)
286
+ - [FAQ](./docs/FAQ.md)
287
+ - [Releasing (maintainers)](./docs/RELEASING.md)
288
+
161
289
  ## 📂 Directory Structure
162
290
 
163
291
  `nocaap` manages everything inside `.context/`. You should commit `context.config.json` and `context.lock`, but **ignore** the packages.
@@ -169,6 +297,8 @@ project-root/
169
297
  │ ├── context.config.json # Manifest of installed contexts
170
298
  │ ├── context.lock # Exact commit SHAs for reproducibility
171
299
  │ ├── INDEX.md # THE file you point your AI to
300
+ │ ├── index.orama.json # Full-text search index
301
+ │ ├── index.lance/ # Vector embeddings (if --semantic)
172
302
  │ └── packages/ # Cloned content (Partial clones)
173
303
  │ ├── engineering/
174
304
  │ └── design-system/
@@ -176,9 +306,20 @@ project-root/
176
306
 
177
307
  ## 🤖 AI Integration
178
308
 
179
- To make your AI aware of the context, simply mention `@.context/INDEX.md` in your prompt, or configure your editor:
309
+ ### Claude Desktop (Recommended)
310
+
311
+ Use the MCP server for the best experience:
312
+
313
+ 1. Build the search index: `nocaap index --semantic`
314
+ 2. Add to Claude Desktop config (see [MCP Server section](#6-start-mcp-server))
315
+ 3. Restart Claude Desktop
316
+
317
+ Claude will automatically have access to search, document retrieval, and section extraction tools.
318
+
319
+ ### VS Code / Cursor
320
+
321
+ For Copilot integration, add to `.vscode/settings.json`:
180
322
 
181
- **VS Code / Cursor (`.vscode/settings.json`):**
182
323
  ```json
183
324
  {
184
325
  "github.copilot.chat.context.additionalContextFiles": [
@@ -187,6 +328,10 @@ To make your AI aware of the context, simply mention `@.context/INDEX.md` in you
187
328
  }
188
329
  ```
189
330
 
331
+ ### Manual
332
+
333
+ Simply mention `@.context/INDEX.md` in your prompt to give AI agents access to the context index.
334
+
190
335
  ## 🔐 Private Repository Support
191
336
 
192
337
  nocaap uses your existing Git credentials for private repos: