@llmkb/claude-code 0.1.0 → 0.1.1

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 (3) hide show
  1. package/README.md +222 -38
  2. package/dist/cli.d.ts +1 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -3,50 +3,210 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@llmkb/claude-code)](https://www.npmjs.com/package/@llmkb/claude-code)
4
4
  [![License](https://img.shields.io/npm/l/@llmkb/claude-code)](LICENSE)
5
5
 
6
- Claude Code plugin for **llmkb** — search, read, and write your knowledge base via MCP tools directly from Claude Code.
6
+ **llmkb** (LLM Knowledge Base) is a SaaS AI knowledge platform that transforms raw documents into an organized, interlinked knowledge graph. This plugin connects Claude Code to your llmkb spaces — search, read, and write your knowledge base directly from your editor.
7
7
 
8
- ## Install
8
+ > **Prerequisites:** Node.js >= 20, a running llmkb server (local Docker stack or remote deployment).
9
9
 
10
- ```bash
11
- npm install -g @llmkb/claude-code
12
- ```
10
+ ---
13
11
 
14
12
  ## Quick Start
15
13
 
16
14
  ```bash
17
- # Initialize llmkb in your project
15
+ # 1. Install the CLI
16
+ npm install -g @llmkb/claude-code
17
+
18
+ # 2. Scaffold config in your project
19
+ cd my-project
18
20
  llmkb init
19
21
 
20
- # Log in to your llmkb server
21
- llmkb login --space my-space
22
+ # 3. Authenticate with your access token
23
+ llmkb login --project-space <space-uuid>
24
+
25
+ # 4. Verify everything works
26
+ llmkb doctor
22
27
 
23
- # Sync local files as knowledge sources
28
+ # 5. Sync local files to your llmkb space (optional)
24
29
  llmkb sync
30
+ ```
25
31
 
26
- # Verify connection
27
- llmkb doctor
32
+ ---
33
+
34
+ ## Commands
35
+
36
+ ### `llmkb init` — Scaffold configuration
37
+
38
+ Sets up `.claude-plugin/`, `.mcp.json`, `.llmkb/spaces.yml`, and skills in your project. Run this first.
39
+
40
+ ```bash
41
+ llmkb init # Interactive setup — prompts for space config
42
+ llmkb init --platform cursor # Generate Cursor rules instead of Claude Code config
43
+ llmkb init --platform claude # Generate Claude Code config (default)
44
+ llmkb init --with-skills # Install Claude Code skills
45
+ llmkb init --without-skills # Skip skill installation
46
+ llmkb init --with-hooks # Install Claude Code hooks for context enrichment
47
+ llmkb init --non-interactive # Skip prompts (for CI/headless)
48
+ llmkb init /path/to/project # Scaffold in a specific directory
49
+ ```
50
+
51
+ ### `llmkb login` — Authenticate
52
+
53
+ Authenticates with a user-level access token, stores it in your OS keychain, discovers accessible spaces, and writes `.llmkb/spaces.yml`.
54
+
55
+ ```bash
56
+ llmkb login --project-space <space-uuid> # Authenticate and set project space
57
+ ```
58
+
59
+ The CLI will:
60
+ 1. Prompt you to paste your access token (generate one from your llmkb dashboard at Settings → Access Tokens)
61
+ 2. Validate the token against the server
62
+ 3. Store the token in your OS keychain
63
+ 4. Discover all spaces you have access to
64
+ 5. Write `.llmkb/spaces.yml`
65
+
66
+ ### `llmkb logout` — Remove credentials
67
+
68
+ ```bash
69
+ llmkb logout # Remove access token from keychain
70
+ ```
71
+
72
+ ### `llmkb sync` — Sync local files
73
+
74
+ Uploads local files to your llmkb space as knowledge sources. Uses content-addressed sync — only new and changed files are uploaded.
75
+
76
+ ```bash
77
+ llmkb sync # Sync current directory
78
+ llmkb sync src/ # Sync a specific directory or file
79
+ llmkb sync --dry-run # Preview what would be uploaded
80
+ llmkb sync --force # Re-upload everything, bypassing cache
81
+ llmkb sync --watch # Watch for file changes and auto-sync
82
+ llmkb sync --debounce 500 # Watch debounce in milliseconds (default: 300)
83
+ llmkb sync --json # Machine-readable JSON output
84
+ llmkb sync --verbose # Detailed output including skipped files
85
+ llmkb sync --space <space-uuid> # Override target space
86
+ ```
87
+
88
+ ### `llmkb query` — Search your knowledge base
89
+
90
+ Searches an llmkb space and prints ranked results from the knowledge graph.
91
+
92
+ ```bash
93
+ llmkb query "your search text" # Search the project space
94
+ llmkb query "search text" --space <space-id> # Search a specific space
95
+ llmkb query "search text" --limit 20 # Max results (default: 10)
96
+ llmkb query "search text" --json # Machine-readable JSON output
97
+ ```
98
+
99
+ ### `llmkb doctor` — Diagnose configuration
100
+
101
+ Run all configuration and permission checks to verify your setup is healthy.
102
+
103
+ ```bash
104
+ llmkb doctor # Run full diagnostic
105
+ ```
106
+
107
+ Checks performed:
108
+ - Config file validity (`.llmkb/config.yml`, `.llmkb/spaces.yml`)
109
+ - Backend server connectivity
110
+ - Access token validity
111
+ - Space access permissions for all configured spaces
112
+ - Related spaces synced from backend
113
+
114
+ ### `llmkb status` — Display current state
115
+
116
+ Shows version stamps, configuration summary, and access token status.
117
+
118
+ ```bash
119
+ llmkb status
120
+ ```
121
+
122
+ ### `llmkb use` — Switch project space
123
+
124
+ Sets the active project space in `.llmkb/spaces.yml`.
125
+
126
+ ```bash
127
+ llmkb use <space-uuid> # Set project space
128
+ ```
129
+
130
+ ### `llmkb whoami` — Show current user
131
+
132
+ Displays the currently authenticated user's identity.
133
+
134
+ ```bash
135
+ llmkb whoami
136
+ ```
137
+
138
+ ### `llmkb add` — Register a space
139
+
140
+ Adds a space to `.llmkb/spaces.yml` without authenticating.
141
+
142
+ ```bash
143
+ llmkb add --space <space-uuid> # Add a space
144
+ llmkb add --space <uuid> --name "My Space" # Add with a display name
145
+ ```
146
+
147
+ ### `llmkb remove` — Unregister a space
148
+
149
+ Removes a space from `.llmkb/spaces.yml`.
150
+
151
+ ```bash
152
+ llmkb remove --space <space-uuid> # Remove a space
28
153
  ```
29
154
 
30
- ## CLI Commands
155
+ ### `llmkb update` — Update project space
156
+
157
+ Updates the project space configuration in `.llmkb/spaces.yml`.
31
158
 
32
- | Command | Description |
33
- |---------|-------------|
34
- | `llmkb init` | Scaffold `.claude-plugin/`, `.mcp.json`, and skills |
35
- | `llmkb login --space <name>` | Store credentials in OS keychain |
36
- | `llmkb logout` | Remove stored credentials |
37
- | `llmkb sync` | Sync local files to llmkb server |
38
- | `llmkb query "..."` | Query your knowledge base |
39
- | `llmkb doctor` | Diagnose connection and configuration |
40
- | `llmkb status` | Show current space status |
41
- | `llmkb use <space>` | Switch active space |
42
- | `llmkb add/remove <space>` | Manage space registrations |
43
- | `llmkb spaces` | List configured spaces |
44
- | `llmkb hooks` | Manage Claude Code hooks |
159
+ ```bash
160
+ llmkb update --project-space <space-uuid> # Update project space
161
+ ```
45
162
 
46
- ## MCP Configuration
163
+ ### `llmkb spaces` — List configured spaces
164
+
165
+ Lists all spaces registered in `.llmkb/spaces.yml`.
166
+
167
+ ```bash
168
+ llmkb spaces # List spaces
169
+ llmkb spaces --delete-all # Remove all space entries (requires confirmation)
170
+ ```
171
+
172
+ ### `llmkb hooks` — Manage Claude Code hooks
173
+
174
+ Manages hooks that enrich Claude Code context with llmkb data and check sync freshness.
175
+
176
+ ```bash
177
+ llmkb hooks install # Install hooks
178
+ llmkb hooks install --force # Overwrite existing hook files
179
+ llmkb hooks remove # Remove hooks
180
+ llmkb hooks check # Check whether hooks are installed
181
+ ```
47
182
 
48
- The plugin registers an MCP server so Claude Code can interact with your llmkb spaces. By default it uses Docker stdio transport:
183
+ ---
49
184
 
185
+ ## Environment Variables (Headless / CI)
186
+
187
+ In environments without a keychain (Linux servers, CI), use environment variables:
188
+
189
+ | Variable | Purpose |
190
+ |----------|---------|
191
+ | `LLMKB_ENDPOINT` | Server URL (e.g., `https://llmkb.your-server.com`) |
192
+ | `LLMKB_SPACE` | Default space name for operations |
193
+ | `LLMKB_TOKEN` | Space access token |
194
+ | `LLMKB_ADMIN_TOKEN` | Admin token for admin operations |
195
+
196
+ Example:
197
+ ```bash
198
+ export LLMKB_ENDPOINT=https://llmkb.example.com
199
+ export LLMKB_SPACE=my-project
200
+ export LLMKB_TOKEN=llmkb_abc123...
201
+ ```
202
+
203
+ ---
204
+
205
+ ## MCP Integration
206
+
207
+ The plugin registers an MCP server so Claude Code can interact with your llmkb spaces during chat sessions.
208
+
209
+ **Docker stdio transport** (local development — requires Docker Compose running):
50
210
  ```json
51
211
  {
52
212
  "mcpServers": {
@@ -59,24 +219,48 @@ The plugin registers an MCP server so Claude Code can interact with your llmkb s
59
219
  }
60
220
  ```
61
221
 
62
- For production deployments, configure HTTP transport targeting your deployed llmkb server.
222
+ **HTTP transport** (remote/production deployment):
223
+ ```json
224
+ {
225
+ "mcpServers": {
226
+ "llmkb": {
227
+ "type": "url",
228
+ "url": "https://llmkb.your-server.com/mcp"
229
+ }
230
+ }
231
+ }
232
+ ```
63
233
 
64
- ## Environment Variables (Headless / CI)
234
+ ---
65
235
 
66
- In environments without a keychain (Linux servers, CI), use environment variables:
236
+ ## Typical Workflow
67
237
 
68
238
  ```bash
69
- export LLMKB_ENDPOINT=https://your-server.llmkb.ai
70
- export LLMKB_SPACE=my-space
71
- export LLMKB_TOKEN=your-space-token
72
- export LLMKB_ADMIN_TOKEN=your-admin-token
239
+ # First-time setup
240
+ cd my-project
241
+ llmkb init
242
+ llmkb login --project-space abc123...
243
+
244
+ # Daily use
245
+ llmkb sync src/ # Sync code changes
246
+ llmkb query "auth patterns" # Search knowledge base
247
+ llmkb doctor # Check everything is healthy
73
248
  ```
74
249
 
75
- ## Requirements
250
+ ## Configuration Files
251
+
252
+ After `llmkb init`, the following files are created in your project:
253
+
254
+ | File | Purpose |
255
+ |------|---------|
256
+ | `.claude-plugin/plugin.json` | Plugin metadata for Claude Code |
257
+ | `.mcp.json` | MCP server registration |
258
+ | `.llmkb/spaces.yml` | Space configuration (without tokens) |
259
+ | `.llmkb/config.yml` | General plugin configuration |
260
+ | `.claude/skills/llmkb/*/SKILL.md` | Claude Code skills (if installed with `--with-skills`) |
261
+ | `.claude/hooks/llmkb/hooks.json` | Claude Code hooks (if installed with `--with-hooks`) |
76
262
 
77
- - **Node.js** >= 20
78
- - **Docker** (for local MCP stdio transport)
79
- - **llmkb server** (local Docker stack or remote deployment)
263
+ **Tokens are never stored in config files.** They are stored in your OS keychain, with environment variable fallback for headless environments.
80
264
 
81
265
  ## License
82
266
 
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmkb/claude-code",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Claude Code plugin for llmkb — search, read, and write your knowledge base via MCP tools",
5
5
  "license": "MIT",
6
6
  "type": "module",