pi-para 0.5.2 → 0.6.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.
Files changed (195) hide show
  1. package/ARCHITECTURE.md +160 -0
  2. package/CHANGELOG.md +51 -0
  3. package/CONFIGURATION.md +243 -0
  4. package/README.md +140 -237
  5. package/SETUP.md +196 -112
  6. package/STRUCTURE.md +140 -0
  7. package/package.json +86 -18
  8. package/scripts/build-assets.mjs +29 -0
  9. package/scripts/install.ps1 +55 -0
  10. package/scripts/install.sh +63 -0
  11. package/scripts/smoke-install.mjs +63 -0
  12. package/skills/para/SKILL.md +1 -1
  13. package/skills/setup/SKILL.md +1 -1
  14. package/src/atomic-write.ts +17 -0
  15. package/src/capture.ts +4 -4
  16. package/src/cli-legacy.ts +43 -0
  17. package/src/cli.ts +133 -28
  18. package/src/commands.ts +203 -243
  19. package/src/config.ts +355 -0
  20. package/src/context.ts +29 -14
  21. package/src/credentials.ts +100 -0
  22. package/src/daemon.ts +1 -1
  23. package/src/doctor.ts +209 -0
  24. package/src/gepa/index.ts +1 -1
  25. package/src/index.ts +119 -40
  26. package/src/maintainer.ts +4 -4
  27. package/src/model-resolver.ts +96 -0
  28. package/src/paths.ts +48 -0
  29. package/src/processor.ts +4 -4
  30. package/src/qmd-providers.ts +63 -0
  31. package/src/query.ts +15 -1
  32. package/src/repair.ts +49 -0
  33. package/src/scheduler/controls.ts +125 -0
  34. package/src/scheduler/index.ts +210 -0
  35. package/src/scheduler/leases.ts +98 -0
  36. package/src/scheduler/session-capture.ts +146 -0
  37. package/src/scheduler/state.ts +304 -0
  38. package/src/session-tools.ts +1 -1
  39. package/src/settings.ts +126 -0
  40. package/src/setup.ts +116 -0
  41. package/src/status.ts +115 -0
  42. package/src/store.ts +116 -31
  43. package/src/summarize.ts +72 -16
  44. package/src/templates/prompts.ts +1 -1
  45. package/src/tools.ts +280 -90
  46. package/src/wiki-tool-guidance.ts +84 -0
  47. package/src/wiki.ts +98 -26
  48. package/dist/capture.d.ts +0 -34
  49. package/dist/capture.d.ts.map +0 -1
  50. package/dist/capture.js +0 -461
  51. package/dist/capture.js.map +0 -1
  52. package/dist/cli.d.ts +0 -15
  53. package/dist/cli.d.ts.map +0 -1
  54. package/dist/cli.js +0 -405
  55. package/dist/cli.js.map +0 -1
  56. package/dist/commands.d.ts +0 -15
  57. package/dist/commands.d.ts.map +0 -1
  58. package/dist/commands.js +0 -786
  59. package/dist/commands.js.map +0 -1
  60. package/dist/context.d.ts +0 -61
  61. package/dist/context.d.ts.map +0 -1
  62. package/dist/context.js +0 -289
  63. package/dist/context.js.map +0 -1
  64. package/dist/daemon.d.ts +0 -49
  65. package/dist/daemon.d.ts.map +0 -1
  66. package/dist/daemon.js +0 -226
  67. package/dist/daemon.js.map +0 -1
  68. package/dist/frontmatter.d.ts +0 -59
  69. package/dist/frontmatter.d.ts.map +0 -1
  70. package/dist/frontmatter.js +0 -170
  71. package/dist/frontmatter.js.map +0 -1
  72. package/dist/gepa/dataset.d.ts +0 -36
  73. package/dist/gepa/dataset.d.ts.map +0 -1
  74. package/dist/gepa/dataset.js +0 -148
  75. package/dist/gepa/dataset.js.map +0 -1
  76. package/dist/gepa/evaluator.d.ts +0 -51
  77. package/dist/gepa/evaluator.d.ts.map +0 -1
  78. package/dist/gepa/evaluator.js +0 -317
  79. package/dist/gepa/evaluator.js.map +0 -1
  80. package/dist/gepa/index.d.ts +0 -66
  81. package/dist/gepa/index.d.ts.map +0 -1
  82. package/dist/gepa/index.js +0 -240
  83. package/dist/gepa/index.js.map +0 -1
  84. package/dist/gepa/llm.d.ts +0 -35
  85. package/dist/gepa/llm.d.ts.map +0 -1
  86. package/dist/gepa/llm.js +0 -268
  87. package/dist/gepa/llm.js.map +0 -1
  88. package/dist/gepa/optimized/capture-prompt.txt +0 -65
  89. package/dist/gepa/optimizer.d.ts +0 -29
  90. package/dist/gepa/optimizer.d.ts.map +0 -1
  91. package/dist/gepa/optimizer.js +0 -249
  92. package/dist/gepa/optimizer.js.map +0 -1
  93. package/dist/gepa/targets.d.ts +0 -39
  94. package/dist/gepa/targets.d.ts.map +0 -1
  95. package/dist/gepa/targets.js +0 -326
  96. package/dist/gepa/targets.js.map +0 -1
  97. package/dist/gepa/types.d.ts +0 -168
  98. package/dist/gepa/types.d.ts.map +0 -1
  99. package/dist/gepa/types.js +0 -124
  100. package/dist/gepa/types.js.map +0 -1
  101. package/dist/index.d.ts +0 -21
  102. package/dist/index.d.ts.map +0 -1
  103. package/dist/index.js +0 -294
  104. package/dist/index.js.map +0 -1
  105. package/dist/ingest.d.ts +0 -88
  106. package/dist/ingest.d.ts.map +0 -1
  107. package/dist/ingest.js +0 -105
  108. package/dist/ingest.js.map +0 -1
  109. package/dist/link-discovery.d.ts +0 -40
  110. package/dist/link-discovery.d.ts.map +0 -1
  111. package/dist/link-discovery.js +0 -122
  112. package/dist/link-discovery.js.map +0 -1
  113. package/dist/link-utils.d.ts +0 -30
  114. package/dist/link-utils.d.ts.map +0 -1
  115. package/dist/link-utils.js +0 -145
  116. package/dist/link-utils.js.map +0 -1
  117. package/dist/lint.d.ts +0 -39
  118. package/dist/lint.d.ts.map +0 -1
  119. package/dist/lint.js +0 -827
  120. package/dist/lint.js.map +0 -1
  121. package/dist/maintainer.d.ts +0 -24
  122. package/dist/maintainer.d.ts.map +0 -1
  123. package/dist/maintainer.js +0 -358
  124. package/dist/maintainer.js.map +0 -1
  125. package/dist/processor.d.ts +0 -14
  126. package/dist/processor.d.ts.map +0 -1
  127. package/dist/processor.js +0 -361
  128. package/dist/processor.js.map +0 -1
  129. package/dist/query.d.ts +0 -69
  130. package/dist/query.d.ts.map +0 -1
  131. package/dist/query.js +0 -107
  132. package/dist/query.js.map +0 -1
  133. package/dist/raw.d.ts +0 -57
  134. package/dist/raw.d.ts.map +0 -1
  135. package/dist/raw.js +0 -219
  136. package/dist/raw.js.map +0 -1
  137. package/dist/redact.d.ts +0 -21
  138. package/dist/redact.d.ts.map +0 -1
  139. package/dist/redact.js +0 -143
  140. package/dist/redact.js.map +0 -1
  141. package/dist/scope.d.ts +0 -54
  142. package/dist/scope.d.ts.map +0 -1
  143. package/dist/scope.js +0 -161
  144. package/dist/scope.js.map +0 -1
  145. package/dist/scripts/bulk-link-fix.d.ts +0 -9
  146. package/dist/scripts/bulk-link-fix.d.ts.map +0 -1
  147. package/dist/scripts/bulk-link-fix.js +0 -106
  148. package/dist/scripts/bulk-link-fix.js.map +0 -1
  149. package/dist/session-tools.d.ts +0 -33
  150. package/dist/session-tools.d.ts.map +0 -1
  151. package/dist/session-tools.js +0 -211
  152. package/dist/session-tools.js.map +0 -1
  153. package/dist/state.d.ts +0 -54
  154. package/dist/state.d.ts.map +0 -1
  155. package/dist/state.js +0 -176
  156. package/dist/state.js.map +0 -1
  157. package/dist/store.d.ts +0 -56
  158. package/dist/store.d.ts.map +0 -1
  159. package/dist/store.js +0 -227
  160. package/dist/store.js.map +0 -1
  161. package/dist/summarize.d.ts +0 -56
  162. package/dist/summarize.d.ts.map +0 -1
  163. package/dist/summarize.js +0 -231
  164. package/dist/summarize.js.map +0 -1
  165. package/dist/tag-registry.d.ts +0 -56
  166. package/dist/tag-registry.d.ts.map +0 -1
  167. package/dist/tag-registry.js +0 -146
  168. package/dist/tag-registry.js.map +0 -1
  169. package/dist/templates/prompts.d.ts +0 -63
  170. package/dist/templates/prompts.d.ts.map +0 -1
  171. package/dist/templates/prompts.js +0 -260
  172. package/dist/templates/prompts.js.map +0 -1
  173. package/dist/tools.d.ts +0 -26
  174. package/dist/tools.d.ts.map +0 -1
  175. package/dist/tools.js +0 -1033
  176. package/dist/tools.js.map +0 -1
  177. package/dist/watcher.d.ts +0 -25
  178. package/dist/watcher.d.ts.map +0 -1
  179. package/dist/watcher.js +0 -84
  180. package/dist/watcher.js.map +0 -1
  181. package/dist/webui/client/dist/index.html +0 -1885
  182. package/dist/webui/server.d.ts +0 -31
  183. package/dist/webui/server.d.ts.map +0 -1
  184. package/dist/webui/server.js +0 -566
  185. package/dist/webui/server.js.map +0 -1
  186. package/dist/wiki.d.ts +0 -103
  187. package/dist/wiki.d.ts.map +0 -1
  188. package/dist/wiki.js +0 -428
  189. package/dist/wiki.js.map +0 -1
  190. package/scripts/gepa/__pycache__/dataset.cpython-313.pyc +0 -0
  191. package/scripts/gepa/__pycache__/lm_providers.cpython-313.pyc +0 -0
  192. package/scripts/gepa/__pycache__/metric.cpython-313.pyc +0 -0
  193. package/scripts/gepa/__pycache__/program.cpython-313.pyc +0 -0
  194. package/scripts/gepa/__pycache__/wiki_reader.cpython-313.pyc +0 -0
  195. package/scripts/gepa/uv.lock +0 -2241
package/SETUP.md CHANGED
@@ -1,171 +1,255 @@
1
- # pi-para Setup Instructions
1
+ # pi-para Setup
2
2
 
3
- > This file is designed to be read by pi (the AI agent). Ask pi: "read SETUP.md and set up pi-para"
3
+ This is the current setup flow for pi-para. It is cross-platform and does not require `systemd`, a long-running daemon, or a global QMD CLI.
4
4
 
5
5
  ## Prerequisites
6
6
 
7
- - pi (coding agent) installed and working
8
- - Node.js available (`node --version`)
9
- - Internet access for npm
7
+ - Pi installed and working.
8
+ - Node.js/npm available.
9
+ - A restarted Pi session after install/config changes.
10
10
 
11
- ## Step 1: Install the extension
11
+ ## Standard install
12
12
 
13
13
  ```bash
14
- pi install @picassio/pi-para
14
+ pi install pi-para
15
15
  ```
16
16
 
17
- Verify it loaded — restart pi and check extensions list. You should see `pi-para` in the `[Extensions]` section.
17
+ Then restart Pi.
18
18
 
19
- ## Step 2: Install qmd search engine (recommended)
19
+ Run diagnostics:
20
20
 
21
- qmd provides hybrid search (BM25 + vector + rerank). Without it, wiki search uses BM25 keyword matching only.
21
+ ```bash
22
+ pi-para doctor
23
+ ```
24
+
25
+ If needed, apply safe repairs:
26
+
27
+ ```bash
28
+ pi-para doctor --fix
29
+ ```
30
+
31
+ ## npx setup flow
32
+
33
+ For a fresh machine or scripted install:
22
34
 
23
35
  ```bash
24
- npm install -g @picassio/qmd
36
+ npx pi-para@latest setup
25
37
  ```
26
38
 
27
- Verify: `qmd --version` should print a version number.
39
+ POSIX one-liner:
28
40
 
29
- ## Step 3: Configure search providers
41
+ ```bash
42
+ curl -fsSL https://raw.githubusercontent.com/picassio/pi-para/main/scripts/install.sh | bash
43
+ ```
44
+
45
+ Windows PowerShell one-liner:
46
+
47
+ ```powershell
48
+ irm https://raw.githubusercontent.com/picassio/pi-para/main/scripts/install.ps1 | iex
49
+ ```
50
+
51
+ Non-interactive defaults:
30
52
 
31
- Create `~/.config/qmd/index.yml` with your API providers. Choose based on what keys you have:
53
+ ```bash
54
+ npx pi-para@latest setup --yes
55
+ ```
32
56
 
33
- ### Option A: OpenRouter (embedding) + MiniMax CN (chat)
57
+ Dry run:
34
58
 
35
- ```yaml
36
- providers:
37
- embed:
38
- url: https://openrouter.ai/api/v1
39
- key: YOUR_OPENROUTER_KEY
40
- model: openai/text-embedding-3-small
41
- dims: 768
42
- chat:
43
- url: https://api.minimaxi.com/anthropic
44
- key: YOUR_MINIMAX_CN_KEY
45
- model: MiniMax-M2.7-highspeed
46
- api: anthropic
59
+ ```bash
60
+ npx pi-para@latest setup --dry-run
47
61
  ```
48
62
 
49
- ### Option B: OpenAI only
63
+ Local development install:
50
64
 
51
- ```yaml
52
- providers:
53
- embed:
54
- url: https://api.openai.com/v1
55
- key: YOUR_OPENAI_KEY
56
- model: text-embedding-3-small
57
- dims: 1536
58
- chat:
59
- url: https://api.openai.com/v1
60
- key: YOUR_OPENAI_KEY
61
- model: gpt-4o-mini
65
+ ```bash
66
+ cd /path/to/pi-para
67
+ npm install
68
+ npm run build
69
+ node ./dist/cli.js setup --local .
62
70
  ```
63
71
 
64
- ### Option C: No providers (BM25 only)
72
+ Restart Pi after setup.
73
+
74
+ ## What setup does
75
+
76
+ `pi-para setup` is idempotent. It may:
65
77
 
66
- Skip this step. Wiki search works with keyword matching. No API keys needed.
78
+ 1. locate Pi settings,
79
+ 2. register the pi-para extension,
80
+ 3. initialize `~/.pi/wiki/`,
81
+ 4. create or migrate `~/.pi/para/config.jsonc`,
82
+ 5. repair generated-state `.gitignore` entries,
83
+ 6. validate the embedded QMD SDK,
84
+ 7. print next steps.
67
85
 
68
- ## Step 4: Configure daemon LLM (optional)
86
+ It does **not** install a system daemon by default, does **not** require global `qmd`, and does **not** copy secrets unless you explicitly store one.
87
+
88
+ ## Configuration locations
89
+
90
+ Canonical:
91
+
92
+ ```text
93
+ ~/.pi/para/config.jsonc
94
+ ~/.pi/para/secrets.json
95
+ ~/.pi/wiki/
96
+ ~/.pi/wiki/.pi-para.sqlite
97
+ ~/.pi/wiki/.qmd.sqlite
98
+ ```
69
99
 
70
- Edit `~/.pi/wiki/config.json` (created after first pi session) and set `daemonModel`:
100
+ Legacy migration inputs:
71
101
 
72
- ```json
73
- {
74
- "daemonModel": "anthropic/claude-sonnet-4"
75
- }
102
+ ```text
103
+ ~/.pi/wiki/config.json
104
+ ~/.pi/wiki/.daemon.sqlite
105
+ ~/.config/qmd/index.yml
76
106
  ```
77
107
 
78
- If null, the daemon auto-detects from:
79
- 1. Pi's API keys (ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.)
80
- 2. qmd chat provider from Step 3
108
+ ## Provider credentials
81
109
 
82
- ## Step 5: Start the background capture daemon
110
+ Credential refs use:
83
111
 
84
- ### Linux (systemd — recommended)
112
+ ```text
113
+ pi-auth:<provider>
114
+ secret:<name>
115
+ none
116
+ ```
85
117
 
86
- Run the setup script from the pi-para install directory:
118
+ Examples:
87
119
 
88
120
  ```bash
89
- # Find the install path
90
- PARA_DIR="$(npm root -g)/@picassio/pi-para"
91
- # Or if installed via pi:
92
- # PARA_DIR="$HOME/.pi/agent/packages/npm/@picassio/pi-para"
121
+ pi-para providers
122
+ pi-para providers set-secret embedding sk-...
123
+ pi-para providers remove-secret embedding
124
+ ```
125
+
126
+ Recommended order:
127
+
128
+ 1. Pi AuthStorage (`~/.pi/agent/auth.json`),
129
+ 2. pi-para secrets (`~/.pi/para/secrets.json`),
130
+ 3. `none` for local/no-auth endpoints.
131
+
132
+ No env-var setup path is required.
133
+
134
+ ## Configure inside Pi
135
+
136
+ Run:
137
+
138
+ ```text
139
+ /wiki-settings
140
+ ```
141
+
142
+ The settings menu writes through the same config service as the CLI. It can configure:
93
143
 
94
- cd "$PARA_DIR"
144
+ - context token budget,
145
+ - search limit and graph boost,
146
+ - lint autofix/stale days,
147
+ - capture model,
148
+ - WebWiki host/port/enabled,
149
+ - embedding and rerank provider profiles,
150
+ - local secrets.
95
151
 
96
- # Install tsx if not present
97
- npm install tsx 2>/dev/null
152
+ ## Verify inside Pi
98
153
 
99
- # Create systemd user service
100
- mkdir -p ~/.config/systemd/user
101
- NODE_BIN="$(dirname "$(which node)")"
154
+ Useful commands:
155
+
156
+ ```text
157
+ /wiki
158
+ /wiki-search test
159
+ /wiki-settings
160
+ /wiki-scheduler status
161
+ /wiki-lint --report-only
162
+ ```
102
163
 
103
- cat > ~/.config/systemd/user/pi-para-daemon.service << EOF
104
- [Unit]
105
- Description=pi-para knowledge capture daemon
106
- After=network.target
164
+ Try a smoke test:
107
165
 
108
- [Service]
109
- Type=simple
110
- WorkingDirectory=$PARA_DIR
111
- ExecStart=$PARA_DIR/node_modules/.bin/tsx src/cli.ts start
112
- Restart=on-failure
113
- RestartSec=10
114
- Environment=HOME=$HOME
115
- Environment=PATH=$NODE_BIN:$HOME/.local/bin:/usr/local/bin:/usr/bin:/bin
166
+ ```text
167
+ Save this to the wiki as a test note: pi-para setup succeeded.
168
+ ```
116
169
 
117
- [Install]
118
- WantedBy=default.target
119
- EOF
170
+ Then:
120
171
 
121
- # Enable, start, and survive SSH logout
122
- systemctl --user daemon-reload
123
- systemctl --user enable pi-para-daemon
124
- systemctl --user start pi-para-daemon
125
- sudo loginctl enable-linger $USER
172
+ ```text
173
+ /wiki-search setup succeeded
126
174
  ```
127
175
 
128
- Verify: `systemctl --user status pi-para-daemon`
176
+ ## Background capture
177
+
178
+ No daemon needs to be started.
129
179
 
130
- ### macOS / Manual
180
+ pi-para queues completed/compacted sessions and processes them when a Pi session with pi-para is open. If Pi is closed, queued work resumes on the next startup.
181
+
182
+ Inspect queue/history:
131
183
 
132
184
  ```bash
133
- cd "$PARA_DIR" && npx tsx src/cli.ts start
185
+ pi-para tasks
186
+ pi-para tasks history
187
+ pi-para capture-recent --hours 24
188
+ ```
189
+
190
+ Inside Pi:
191
+
192
+ ```text
193
+ /wiki-scheduler queue
194
+ /wiki-scheduler history
195
+ /wiki-scheduler capture-history
134
196
  ```
135
197
 
136
- Keep the terminal open, or use a process manager like pm2.
198
+ `/wiki-daemon` and `pi-para-daemon` remain compatibility aliases for older workflows.
199
+
200
+ ## QMD search
201
+
202
+ Global QMD CLI is not required. pi-para uses embedded `qmd-engine` SDK.
137
203
 
138
- ## Step 6: Verify everything works
204
+ - BM25 search works with no providers.
205
+ - Embeddings/rerank use provider profiles in `~/.pi/para/config.jsonc`.
206
+ - Legacy `~/.config/qmd/index.yml` is read only for compatibility.
207
+
208
+ Doctor check:
209
+
210
+ ```bash
211
+ pi-para doctor
212
+ ```
139
213
 
140
- In pi, run these commands:
214
+ Provider/model diagnostic:
141
215
 
142
- 1. `/wiki-settings` — should show config, search engine status, providers, daemon status
143
- 2. `/wiki` — should show "Pages: 0 total" (empty wiki)
144
- 3. Say: "save to wiki: this is a test page" — should create a page
145
- 4. `/wiki` — should show "Pages: 1 total"
146
- 5. Say: "search the wiki for test" — should find the test page
216
+ ```bash
217
+ pi-para doctor --test-capture-model
218
+ pi-para status --json
219
+ ```
147
220
 
148
221
  ## Troubleshooting
149
222
 
150
- ### Extension not loading
151
- - Check: `pi list` should show `@picassio/pi-para`
152
- - Try: `pi -e npm:@picassio/pi-para` for a quick test
223
+ ### Extension changed but behavior did not
224
+
225
+ Restart Pi. Existing sessions keep loaded extension code.
226
+
227
+ ### Missing or stale provider credentials
228
+
229
+ Run:
230
+
231
+ ```bash
232
+ pi-para doctor
233
+ pi-para providers
234
+ ```
235
+
236
+ Store a local secret only if you do not want to use Pi AuthStorage:
237
+
238
+ ```bash
239
+ pi-para providers set-secret embedding <key>
240
+ ```
241
+
242
+ ### Search works but embeddings fail
243
+
244
+ BM25 search remains available. Check:
153
245
 
154
- ### qmd not found
155
- - Check: `which qmd` and `qmd --version`
156
- - Install: `npm install -g @picassio/qmd`
246
+ ```bash
247
+ pi-para doctor
248
+ /wiki-settings
249
+ ```
157
250
 
158
- ### Search not working (no results)
159
- - BM25 works immediately after `wiki_write`
160
- - Vector search needs providers configured in `~/.config/qmd/index.yml`
161
- - Check: `/wiki-settings` shows providers
251
+ Then configure or disable embedding.
162
252
 
163
- ### Daemon not running
164
- - Check: `systemctl --user status pi-para-daemon`
165
- - Logs: `journalctl --user -u pi-para-daemon -n 20`
166
- - Manual start: `cd <pi-para-dir> && npx tsx src/cli.ts start`
253
+ ### Old daemon/systemd service exists
167
254
 
168
- ### Vulkan/CMake errors in logs
169
- - These are from qmd's node-llama-cpp dependency (safe to ignore)
170
- - They only appear if no API providers configured
171
- - Fix: configure providers in `~/.config/qmd/index.yml`
255
+ The old service is no longer required. You can leave it stopped while using the in-process scheduler. Do not start both old daemon capture and the scheduler for the same wiki unless you are intentionally testing legacy behavior.
package/STRUCTURE.md ADDED
@@ -0,0 +1,140 @@
1
+ # pi-para Repository Structure
2
+
3
+ ## Top level
4
+
5
+ ```text
6
+ README.md # user overview
7
+ SETUP.md # current setup/onboarding
8
+ ARCHITECTURE.md # runtime architecture
9
+ CONFIGURATION.md # config schema and credentials
10
+ NO_DAEMON_REFACTOR_ROADMAP.md # implementation roadmap/history
11
+ PROVIDER_MODEL_SELECTION_PLAN.md
12
+ SETUP_SETTINGS_FLOW_PLAN.md
13
+ package.json
14
+ src/
15
+ test/
16
+ scripts/gepa/
17
+ skills/
18
+ ```
19
+
20
+ ## `src/`
21
+
22
+ ### Extension entry and CLI
23
+
24
+ | Path | Purpose |
25
+ |---|---|
26
+ | `src/index.ts` | Pi extension entry point; registers lifecycle handlers/tools/commands/scheduler |
27
+ | `src/cli.ts` | `pi-para` and compatibility `pi-para-daemon` CLI |
28
+ | `src/commands.ts` | Pi slash commands |
29
+ | `src/tools.ts` | Pi tool definitions |
30
+
31
+ ### Wiki core
32
+
33
+ | Path | Purpose |
34
+ |---|---|
35
+ | `src/wiki.ts` | Filesystem wiki operations, page writes, index/log maintenance |
36
+ | `src/frontmatter.ts` | Frontmatter parsing/formatting |
37
+ | `src/scope.ts` | Project scope detection and matching |
38
+ | `src/query.ts` | Query formatting and search orchestration |
39
+ | `src/ingest.ts` | Source ingestion |
40
+ | `src/raw.ts` | Raw source storage and session digest helpers |
41
+ | `src/lint.ts` | Wiki health checks/autofix |
42
+ | `src/summarize.ts` | Summary operations |
43
+ | `src/link-utils.ts`, `src/link-discovery.ts`, `src/tag-registry.ts` | Link/tag helpers |
44
+
45
+ ### Runtime/search/state
46
+
47
+ | Path | Purpose |
48
+ |---|---|
49
+ | `src/store.ts` | QMD SDK store lifecycle, search, reindex/embed helpers |
50
+ | `src/qmd-providers.ts` | Convert pi-para provider profiles into QMD SDK provider config |
51
+ | `src/context.ts` | Wiki context injection into Pi sessions |
52
+ | `src/wiki-tool-guidance.ts` | Shared wiki tool descriptions, prompt snippets, and behavior guidance |
53
+ | `src/state.ts` | Legacy/session capture state DB helpers |
54
+
55
+ ### Config/setup/diagnostics
56
+
57
+ | Path | Purpose |
58
+ |---|---|
59
+ | `src/paths.ts` | Cross-platform path resolution |
60
+ | `src/config.ts` | JSONC config defaults, migration, save/load |
61
+ | `src/credentials.ts` | Pi AuthStorage/local secret credential refs |
62
+ | `src/settings.ts` | Pure helpers for `/wiki-settings` updates |
63
+ | `src/setup.ts` | CLI setup flow |
64
+ | `src/status.ts` | Lightweight config/wiki/scheduler status summary |
65
+ | `src/doctor.ts` | Diagnostics and safe repairs |
66
+ | `src/repair.ts` | Repair helpers such as generated-state `.gitignore` and secret perms |
67
+ | `src/atomic-write.ts` | Atomic file writes |
68
+
69
+ ### Scheduler
70
+
71
+ ```text
72
+ src/scheduler/
73
+ ├── index.ts # scheduler lifecycle and task execution
74
+ ├── state.ts # queue/history/task SQLite tables
75
+ ├── leases.ts # SQLite lease acquire/release
76
+ ├── controls.ts # CLI/command observability helpers
77
+ └── session-capture.ts # completed-session registry and capture task handler
78
+ ```
79
+
80
+ ### GEPA
81
+
82
+ ```text
83
+ src/gepa/index.ts # TS orchestration/CLI integration
84
+ src/templates/prompts.ts
85
+ scripts/gepa/ # uv/DSPy Python optimizer
86
+ ```
87
+
88
+ ### Legacy/compatibility
89
+
90
+ | Path | Purpose |
91
+ |---|---|
92
+ | `src/daemon.ts` | Legacy daemon foreground mode |
93
+ | `src/watcher.ts` | Legacy `.completed-sessions` watcher |
94
+ | `src/processor.ts` | Legacy session processor |
95
+ | `src/session-tools.ts` | Session exploration tools used by capture |
96
+ | `src/maintainer.ts` | Legacy/maintenance helpers |
97
+
98
+ New code should avoid adding daemon-only dependencies unless intentionally maintaining compatibility.
99
+
100
+ ## `test/`
101
+
102
+ Tests are Vitest-based. Important suites:
103
+
104
+ | Path | Purpose |
105
+ |---|---|
106
+ | `test/config.test.ts` | Config defaults/migration |
107
+ | `test/credentials.test.ts` | Credential refs and secrets |
108
+ | `test/settings.test.ts` | `/wiki-settings` pure helper behavior |
109
+ | `test/qmd-providers.test.ts` | QMD provider profile translation |
110
+ | `test/scheduler*.test.ts` | Scheduler state/controls |
111
+ | `test/session-capture.test.ts` | Completed-session parsing/enqueueing |
112
+ | `test/status.test.ts` | Status summary formatting/counts |
113
+ | `test/doctor.test.ts` | Diagnostics/repairs/provider checks |
114
+ | `test/index.test.ts` | Pi extension entry lifecycle |
115
+ | `test/tools.test.ts`, `test/commands.test.ts` | Tool/command behavior |
116
+
117
+ Run:
118
+
119
+ ```bash
120
+ npm run check
121
+ npm test
122
+ npm run test:coverage
123
+ npm run build
124
+ ```
125
+
126
+ ## Packaging notes
127
+
128
+ `package.json` exposes public modules under `exports`. When adding a new public module, add it to both `exports` and tests/build expectations.
129
+
130
+ Primary binary:
131
+
132
+ ```text
133
+ pi-para -> dist/cli.js
134
+ ```
135
+
136
+ Compatibility binary:
137
+
138
+ ```text
139
+ pi-para-daemon -> dist/cli.js
140
+ ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-para",
3
- "version": "0.5.2",
4
- "description": "PARA Knowledge Base Extension for pi \u2014 persistent, LLM-curated personal wiki",
3
+ "version": "0.6.0",
4
+ "description": "PARA Knowledge Base Extension for pi — persistent, LLM-curated personal wiki",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -65,6 +65,62 @@
65
65
  "./context": {
66
66
  "types": "./dist/context.d.ts",
67
67
  "import": "./dist/context.js"
68
+ },
69
+ "./config": {
70
+ "types": "./dist/config.d.ts",
71
+ "import": "./dist/config.js"
72
+ },
73
+ "./credentials": {
74
+ "types": "./dist/credentials.d.ts",
75
+ "import": "./dist/credentials.js"
76
+ },
77
+ "./paths": {
78
+ "types": "./dist/paths.d.ts",
79
+ "import": "./dist/paths.js"
80
+ },
81
+ "./scheduler": {
82
+ "types": "./dist/scheduler/index.d.ts",
83
+ "import": "./dist/scheduler/index.js"
84
+ },
85
+ "./setup": {
86
+ "types": "./dist/setup.d.ts",
87
+ "import": "./dist/setup.js"
88
+ },
89
+ "./doctor": {
90
+ "types": "./dist/doctor.d.ts",
91
+ "import": "./dist/doctor.js"
92
+ },
93
+ "./repair": {
94
+ "types": "./dist/repair.d.ts",
95
+ "import": "./dist/repair.js"
96
+ },
97
+ "./scheduler/session-capture": {
98
+ "types": "./dist/scheduler/session-capture.d.ts",
99
+ "import": "./dist/scheduler/session-capture.js"
100
+ },
101
+ "./scheduler/controls": {
102
+ "types": "./dist/scheduler/controls.d.ts",
103
+ "import": "./dist/scheduler/controls.js"
104
+ },
105
+ "./model-resolver": {
106
+ "types": "./dist/model-resolver.d.ts",
107
+ "import": "./dist/model-resolver.js"
108
+ },
109
+ "./settings": {
110
+ "types": "./dist/settings.d.ts",
111
+ "import": "./dist/settings.js"
112
+ },
113
+ "./qmd-providers": {
114
+ "types": "./dist/qmd-providers.d.ts",
115
+ "import": "./dist/qmd-providers.js"
116
+ },
117
+ "./status": {
118
+ "types": "./dist/status.d.ts",
119
+ "import": "./dist/status.js"
120
+ },
121
+ "./wiki-tool-guidance": {
122
+ "types": "./dist/wiki-tool-guidance.d.ts",
123
+ "import": "./dist/wiki-tool-guidance.js"
68
124
  }
69
125
  },
70
126
  "pi": {
@@ -81,45 +137,55 @@
81
137
  "scripts",
82
138
  "CHANGELOG.md",
83
139
  "README.md",
84
- "skills",
85
- "SETUP.md"
140
+ "SETUP.md",
141
+ "ARCHITECTURE.md",
142
+ "STRUCTURE.md",
143
+ "CONFIGURATION.md",
144
+ "skills"
86
145
  ],
87
146
  "scripts": {
88
- "clean": "rm -rf dist",
89
- "build": "tsc -p tsconfig.json && mkdir -p dist/webui/client/dist && cp src/webui/client/dist/index.html dist/webui/client/dist/index.html && mkdir -p dist/gepa/optimized && cp -r src/gepa/optimized/*.txt dist/gepa/optimized/ 2>/dev/null || true",
147
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
148
+ "build": "tsc -p tsconfig.json && node scripts/build-assets.mjs",
90
149
  "check": "tsc --noEmit",
91
150
  "test": "vitest --run",
151
+ "test:coverage": "vitest --run --coverage",
152
+ "smoke:install": "npm run build && node scripts/smoke-install.mjs",
92
153
  "fix-links": "tsx src/scripts/bulk-link-fix.ts",
93
154
  "fix-links:dry": "tsx src/scripts/bulk-link-fix.ts --dry-run"
94
155
  },
95
156
  "dependencies": {
96
- "qmd-engine": "^2.3.3",
97
157
  "@types/better-sqlite3": "^7.6.13",
98
- "better-sqlite3": "^11.9.1",
158
+ "better-sqlite3": "^12.11.1",
159
+ "qmd-engine": "^2.5.0",
99
160
  "yaml": "^2.8.2"
100
161
  },
162
+ "engines": {
163
+ "node": ">=22.0.0"
164
+ },
101
165
  "peerDependencies": {
102
- "@mariozechner/pi-agent-core": "^0.70.2",
103
- "@mariozechner/pi-ai": "^0.70.2",
104
- "@mariozechner/pi-coding-agent": "^0.70.2",
105
- "@mariozechner/pi-tui": "^0.70.2",
166
+ "@earendil-works/pi-agent-core": "^0.80.2",
167
+ "@earendil-works/pi-ai": "^0.80.2",
168
+ "@earendil-works/pi-coding-agent": "^0.80.2",
169
+ "@earendil-works/pi-tui": "^0.80.2",
106
170
  "typebox": "^1.1.24"
107
171
  },
108
172
  "peerDependenciesMeta": {},
109
173
  "devDependencies": {
110
- "@mariozechner/pi-agent-core": "^0.70.2",
111
- "@mariozechner/pi-ai": "^0.70.2",
112
- "@mariozechner/pi-coding-agent": "^0.70.2",
113
- "@mariozechner/pi-tui": "^0.70.2",
174
+ "@earendil-works/pi-agent-core": "^0.80.2",
175
+ "@earendil-works/pi-ai": "^0.80.2",
176
+ "@earendil-works/pi-coding-agent": "^0.80.2",
177
+ "@earendil-works/pi-tui": "^0.80.2",
114
178
  "@types/node": "^24.3.0",
179
+ "@vitest/coverage-v8": "^3.2.4",
115
180
  "tsx": "^4.21.0",
116
181
  "typebox": "^1.1.34",
117
182
  "typescript": "^5.7.3",
118
183
  "vitest": "^3.2.4"
119
184
  },
120
185
  "keywords": [
186
+ "pi-package",
187
+ "pi-extension",
121
188
  "pi",
122
- "extension",
123
189
  "para",
124
190
  "knowledge-base",
125
191
  "wiki"
@@ -134,9 +200,11 @@
134
200
  "url": "https://github.com/picassio/pi-para/issues"
135
201
  },
136
202
  "publishConfig": {
203
+ "registry": "https://registry.npmjs.org/",
137
204
  "access": "public"
138
205
  },
139
206
  "bin": {
207
+ "pi-para": "./dist/cli.js",
140
208
  "pi-para-daemon": "./dist/cli.js"
141
209
  }
142
- }
210
+ }