@gi4nks/ph 1.6.0 → 1.7.0

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/docs/ph-manual.md CHANGED
@@ -10,6 +10,8 @@ ph is a transparent observability and knowledge layer for AI CLI tools (Claude C
10
10
 
11
11
  **Core principle:** ph captures conversations without changing the normal tool workflow. Optional analysis turns captured history into project summaries and memories that can be searched locally or requested by an MCP client. Capture and full-text search work without an LLM provider; analysis, embeddings, and semantic search require the configured provider.
12
12
 
13
+ In the TUI, `p` runs the selected prompt through one of the configured Wise analysis providers (same provider/model/URL settings shown by `ph config show`) and saves the response to history. `r` reruns the prompt with its original CLI tool.
14
+
13
15
  ### Key Features
14
16
 
15
17
  - **Automatic capture** via hooks (Claude Code, Codex CLI, Gemini CLI, OpenCode plugin) or wrapper mode
@@ -45,7 +47,7 @@ npm link
45
47
 
46
48
  ```bash
47
49
  ph config set background-analysis true # auto-analyze after each capture
48
- ph config set analyze-provider ollama # ollama (default) or gemini
50
+ ph config set analyze-provider ollama # ollama (default), gemini, openrouter, or mlx-serve
49
51
  ph config set ollama-model llama3.1:latest
50
52
  ```
51
53
 
@@ -283,6 +285,37 @@ ph config set ollama-model llama3.1:latest
283
285
  ph config set ollama-embed-model nomic-embed-text-v2-moe
284
286
  ```
285
287
 
288
+ OpenRouter and MLX-Serve generation use `@gi4nks/wise`:
289
+
290
+ ```bash
291
+ # OpenRouter: credentials stay in the environment; model IDs keep provider/model.
292
+ export OPENROUTER_API_KEY="your_openrouter_api_key"
293
+ ph models openrouter
294
+ ph config set openrouter-api-key # hidden prompt; or keep using the environment
295
+ ph config set analyze-provider openrouter
296
+ ph config set openrouter-model "provider/model-id"
297
+ ph config show # provider settings with credentials redacted
298
+ ph analyze
299
+
300
+ # MLX-Serve on Parmenide: open this tunnel in a separate terminal.
301
+ ssh -N -L 11234:127.0.0.1:11234 parmenide
302
+ ```
303
+
304
+ ```bash
305
+ # In the terminal where you run ph:
306
+ ph models mlx-serve
307
+ ph config set analyze-provider mlx-serve
308
+ ph config set mlx-serve-model "exact-model-id-from-server"
309
+ ph analyze
310
+ ```
311
+
312
+ MLX-Serve defaults to `http://127.0.0.1:11234/v1`. Override it with
313
+ `MLX_SERVE_BASE_URL` or `ph config set mlx-serve-url <url>`. Set
314
+ `MLX_SERVE_API_KEY` if the server requires auth; `GLB_OMLX_API_KEY` is also
315
+ accepted for existing setups. Alternatively run `ph config set mlx-serve-api-key`
316
+ to enter it without echoing it in the terminal. `ph config show` redacts
317
+ credentials. `ph models mlx-serve` marks entries `[loaded]` or `[unloaded]`.
318
+
286
319
  ---
287
320
 
288
321
  ## 9. MCP Server
@@ -380,11 +413,15 @@ ph config set filter-min-relevance 3
380
413
  | Key | Default | Description |
381
414
  |-----|---------|-------------|
382
415
  | `dbPath` | `~/.prompt_history.db` | SQLite database path |
383
- | `analyzeProvider` | `ollama` | LLM provider: `ollama` or `gemini` |
416
+ | `analyzeProvider` | `ollama` | LLM provider: `ollama`, `gemini`, `openrouter`, or `mlx-serve` |
384
417
  | `ollamaUrl` | `http://localhost:11434` | Ollama server URL |
385
418
  | `ollamaModel` | `llama3.1:latest` | Analysis model |
386
419
  | `ollamaEmbedModel` | `nomic-embed-text-v2-moe` | Embedding model |
387
420
  | `geminiApiKey` | — | Gemini API key |
421
+ | `openrouterModel` | — | Exact OpenRouter model ID |
422
+ | `openrouterUrl` | `https://openrouter.ai/api/v1` | OpenRouter-compatible API root |
423
+ | `mlxServeModel` | — | Exact MLX-Serve model ID |
424
+ | `mlxServeUrl` | `http://127.0.0.1:11234/v1` | MLX-Serve API root (Parmenide SSH tunnel by default) |
388
425
  | `backgroundAnalysis` | `false` | Auto-analyze after each capture |
389
426
  | `filterMinLength` | `15` | Min prompt length to keep |
390
427
  | `filterMinRelevance` | `3` | Min relevance to keep (0=disable) |
@@ -397,6 +434,10 @@ ph config set filter-min-relevance 3
397
434
  | `remoteLastPush` | — | Timestamp of last successful push |
398
435
  | `remoteLastPull` | — | Timestamp of last successful pull |
399
436
 
437
+ Provider API credentials are environment-only: `OPENROUTER_API_KEY` and
438
+ `MLX_SERVE_API_KEY` (`GLB_OMLX_API_KEY` is a fallback). They are not written to
439
+ `~/.ph_config.json`.
440
+
400
441
  ---
401
442
 
402
443
  ## 14. Architecture
@@ -25,7 +25,7 @@ Add (or update) the `hooks` section in your `~/.claude/settings.json` file:
25
25
  "hooks": [
26
26
  {
27
27
  "type": "command",
28
- "command": "/Users/gianluca/.claude/ph-hook.sh",
28
+ "command": "$HOME/.claude/ph-hook.sh",
29
29
  "async": true
30
30
  }
31
31
  ]
@@ -24,7 +24,7 @@ Add (or update) the `hooks` section in your `~/.gemini/settings.json` file:
24
24
  "hooks": [
25
25
  {
26
26
  "type": "command",
27
- "command": "/Users/gianluca/.gemini/ph-hook.sh"
27
+ "command": "$HOME/.gemini/ph-hook.sh"
28
28
  }
29
29
  ]
30
30
  }
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@gi4nks/ph",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Transparent CLI wrapper that captures and indexes AI prompts",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
7
10
  "bin": {
8
11
  "ph": "dist/cli.js"
9
12
  },
@@ -56,8 +59,10 @@
56
59
  },
57
60
  "dependencies": {
58
61
  "@gi4nks/ink": "^1.5.0",
62
+ "@gi4nks/wise": "^2.1.0",
59
63
  "@lydell/node-pty": "^1.2.0-beta.3",
60
64
  "@modelcontextprotocol/sdk": "^1.29.0",
65
+ "ai": "^7.0.136",
61
66
  "better-sqlite3": "^12.8.0",
62
67
  "ink": "^7.0.5",
63
68
  "react": "^19.2.7",