pi-vault-mind 0.14.2 → 0.16.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.
Files changed (164) hide show
  1. package/CHANGELOG.md +293 -0
  2. package/README.md +5 -5
  3. package/agents/broadcaster.agent.md +2 -2
  4. package/agents/heavy-lifter.agent.md +1 -1
  5. package/agents/main.agent.md +29 -0
  6. package/agents/manager.agent.md +1 -1
  7. package/agents/miner.agent.md +1 -1
  8. package/dist/packages/obsidian/src/client.js +331 -0
  9. package/dist/packages/obsidian/src/types.js +1 -0
  10. package/dist/src/activity.d.ts +49 -0
  11. package/dist/src/activity.js +175 -0
  12. package/dist/src/agent-bus/Agent.d.ts +9 -1
  13. package/dist/src/agent-bus/Agent.js +18 -2
  14. package/dist/src/agent-bus/index.d.ts +5 -5
  15. package/dist/src/agent-bus/index.js +1 -1
  16. package/dist/src/agent-queue.js +12 -3
  17. package/dist/src/agents/BroadcasterAgent.d.ts +1 -1
  18. package/dist/src/agents/BroadcasterAgent.js +2 -2
  19. package/dist/src/agents/HeavyLifterAgent.d.ts +1 -1
  20. package/dist/src/agents/HeavyLifterAgent.js +2 -2
  21. package/dist/src/agents/ManagerAgent.js +1 -1
  22. package/dist/src/agents/MinerAgent.d.ts +1 -1
  23. package/dist/src/agents/MinerAgent.js +2 -2
  24. package/dist/src/agents/index.d.ts +2 -2
  25. package/dist/src/agents/index.js +2 -2
  26. package/dist/src/auth.d.ts +17 -15
  27. package/dist/src/auth.js +26 -37
  28. package/dist/src/autosync.js +2 -2
  29. package/dist/src/commands.d.ts +2 -19
  30. package/dist/src/commands.js +301 -231
  31. package/dist/src/config-keys.d.ts +16 -0
  32. package/dist/src/config-keys.js +45 -0
  33. package/dist/src/discover-schema.js +4 -4
  34. package/dist/src/edits.d.ts +21 -0
  35. package/dist/src/edits.js +75 -0
  36. package/dist/src/embedding-probe.d.ts +34 -0
  37. package/dist/src/embedding-probe.js +142 -0
  38. package/dist/src/embedding-providers.d.ts +133 -0
  39. package/dist/src/embedding-providers.js +173 -0
  40. package/dist/src/embedding-secrets.d.ts +38 -0
  41. package/dist/src/embedding-secrets.js +291 -0
  42. package/dist/src/engine.d.ts +6 -0
  43. package/dist/src/engine.js +78 -6
  44. package/dist/src/events.js +7 -10
  45. package/dist/src/extension-packages.d.ts +9 -0
  46. package/dist/src/extension-packages.js +14 -0
  47. package/dist/src/git.d.ts +19 -0
  48. package/dist/src/git.js +78 -0
  49. package/dist/src/graph.d.ts +2 -1
  50. package/dist/src/graph.js +47 -13
  51. package/dist/src/identities-config.d.ts +6 -0
  52. package/dist/src/identities-config.js +39 -0
  53. package/dist/src/identity-injector.js +1 -1
  54. package/dist/src/index.js +9 -26
  55. package/dist/src/lance.d.ts +9 -0
  56. package/dist/src/lance.js +143 -203
  57. package/dist/src/modal-client.d.ts +16 -0
  58. package/dist/src/modal-client.js +16 -0
  59. package/dist/src/modal-config.d.ts +37 -14
  60. package/dist/src/modal-config.js +59 -32
  61. package/dist/src/model-router.d.ts +27 -0
  62. package/dist/src/model-router.js +67 -0
  63. package/dist/src/models.d.ts +42 -0
  64. package/dist/src/models.js +78 -0
  65. package/dist/src/personalize.js +17 -3
  66. package/dist/src/scaffold.d.ts +48 -0
  67. package/dist/src/scaffold.js +246 -0
  68. package/dist/src/server.d.ts +47 -4
  69. package/dist/src/server.js +988 -221
  70. package/dist/src/session-search.d.ts +63 -0
  71. package/dist/src/session-search.js +379 -0
  72. package/dist/src/settings-ui.d.ts +2 -2
  73. package/dist/src/settings-ui.js +76 -135
  74. package/dist/src/sync.d.ts +3 -3
  75. package/dist/src/sync.js +19 -15
  76. package/dist/src/tool-catalog.d.ts +18 -0
  77. package/dist/src/tool-catalog.js +232 -0
  78. package/dist/src/tools/marksman.js +1 -1
  79. package/dist/src/tools.js +111 -65
  80. package/dist/src/types.d.ts +127 -71
  81. package/dist/src/utils.d.ts +57 -6
  82. package/dist/src/utils.js +114 -28
  83. package/dist/src/vault-tools.d.ts +34 -0
  84. package/dist/src/vault-tools.js +99 -0
  85. package/dist/src/vault-writer.js +4 -1
  86. package/dist/src/vm-handlers.js +140 -43
  87. package/dist/src/watcher.js +9 -9
  88. package/dist/test/activity-tool.test.js +54 -0
  89. package/dist/test/agent-bus/Agent.test.js +174 -0
  90. package/dist/test/agent-bus/AgentLoader.test.js +180 -0
  91. package/dist/test/agent-bus/AgentRegistry.test.js +86 -0
  92. package/dist/test/agent-bus/LLMProvider.test.js +162 -0
  93. package/dist/test/agent-bus/TaskQueue.test.js +256 -0
  94. package/dist/test/agent-dispatch-context.test.js +73 -0
  95. package/dist/test/agent-queue.test.js +1 -1
  96. package/dist/test/agents/Agents.test.js +282 -0
  97. package/dist/test/auth.test.js +57 -56
  98. package/dist/test/bridge-identity.test.js +34 -3
  99. package/dist/test/classify-search-mode.test.js +51 -0
  100. package/dist/test/commands.test.js +410 -0
  101. package/dist/test/config-merge.test.js +98 -0
  102. package/dist/test/context-capture.test.js +56 -0
  103. package/dist/test/discover-schema.test.js +8 -5
  104. package/dist/test/dispatch.test.js +45 -91
  105. package/dist/test/edits.test.js +144 -0
  106. package/dist/test/embedding-probe.test.js +424 -0
  107. package/dist/test/embedding-providers.test.js +157 -0
  108. package/dist/test/embedding-secrets.test.js +210 -0
  109. package/dist/test/engine-identity.test.js +1 -1
  110. package/dist/test/events.test.js +675 -0
  111. package/dist/test/git-bridge.test.js +160 -0
  112. package/dist/test/graph.test.js +464 -0
  113. package/dist/test/helpers/server.js +81 -0
  114. package/dist/test/identity-injector.test.js +197 -0
  115. package/dist/test/index.test.js +5 -7
  116. package/dist/test/lance-modal.test.js +67 -2
  117. package/dist/test/lance.test.js +429 -0
  118. package/dist/test/modal-client.test.js +1 -1
  119. package/dist/test/modal-config.test.js +92 -79
  120. package/dist/test/model-readiness.test.js +122 -0
  121. package/dist/test/model-router.test.js +99 -0
  122. package/dist/test/obsidian-client.test.js +42 -0
  123. package/dist/test/personalize.test.js +1 -1
  124. package/dist/test/rest-models.test.js +153 -0
  125. package/dist/test/rest-queue.test.js +135 -87
  126. package/dist/test/rest-setup.test.js +625 -115
  127. package/dist/test/rest-vm.test.js +355 -94
  128. package/dist/test/server-cors.test.js +48 -0
  129. package/dist/test/server-ws.test.js +61 -34
  130. package/dist/test/session-crud.test.js +323 -0
  131. package/dist/test/session-search.test.js +139 -0
  132. package/dist/test/settings-ui.test.js +113 -4
  133. package/dist/test/sync.test.js +12 -12
  134. package/dist/test/tombstone.test.js +8 -10
  135. package/dist/test/tool-catalog.test.js +86 -0
  136. package/dist/test/utils.test.js +588 -0
  137. package/dist/test/vault-tools.test.js +103 -12
  138. package/dist/test/vault-writer.test.js +371 -0
  139. package/dist/test/vm-handlers.test.js +620 -0
  140. package/extension-packages.json +9 -0
  141. package/package.json +107 -90
  142. package/pi-vault-mind.config.example.json +24 -2
  143. package/scripts/check-deps.sh +35 -32
  144. package/scripts/cli-e2e.mjs +215 -0
  145. package/scripts/configuration-e2e.mjs +783 -0
  146. package/scripts/e2e-commands.mjs +391 -0
  147. package/scripts/e2e-ws.mjs +3 -2
  148. package/scripts/fetch-modal-token.sh +4 -3
  149. package/scripts/generate-config-keys-json.mjs +45 -0
  150. package/scripts/generate-extension-packages-json.mjs +55 -0
  151. package/scripts/pi-session-query +0 -0
  152. package/scripts/publish-obsidian-plugin.sh +0 -0
  153. package/scripts/reset-test-vault.sh +2 -2
  154. package/scripts/setup-test-config.sh +0 -0
  155. package/scripts/setup-vault-pi.sh +48 -9
  156. package/scripts/test-slash-commands.mjs +2 -2
  157. package/scripts/vault-pi.sh +12 -3
  158. package/skills/github-release-notes-file/SKILL.md +42 -0
  159. package/skills/obsidian-guided-test-session/SKILL.md +110 -0
  160. package/skills/obsidian-interactive-test/SKILL.md +88 -0
  161. package/skills/obsidian-plugin-publish/SKILL.md +58 -0
  162. package/skills/pi-vault-mind-release/SKILL.md +141 -0
  163. package/skills/pre-test-release/SKILL.md +116 -0
  164. package/dist/test/auto-indexer.test.js +0 -2
@@ -8,7 +8,7 @@
8
8
  # Command: bash /path/to/pi-vault-mind/scripts/vault-pi.sh {{vault_path}}
9
9
  #
10
10
  # The script:
11
- # 1. Checks for an existing PID file at <vault>/.pi/agent/daemon.pid
11
+ # 1. Checks for an existing PID file at <vault>/.vault-mind/.pi/agent/daemon.pid
12
12
  # 2. If the PID is alive → exits silently (already running)
13
13
  # 3. If stale/dead → cleans up and starts fresh
14
14
  # 4. Opens a new terminal window with pi using the vault-local config dir
@@ -16,7 +16,7 @@
16
16
  set -euo pipefail
17
17
 
18
18
  VAULT="${1:?Usage: vault-pi.sh <vault-path>}"
19
- PI_DIR="${VAULT}/.pi/agent"
19
+ PI_DIR="${VAULT}/.vault-mind/.pi/agent"
20
20
  PID_FILE="${PI_DIR}/daemon.pid"
21
21
 
22
22
  # Ensure the vault-local agent dir exists
@@ -33,10 +33,19 @@ if [ -f "${PID_FILE}" ]; then
33
33
  rm -f "${PID_FILE}"
34
34
  fi
35
35
 
36
+ # --op-env is a flag registered by pi-1password. Passing it when that
37
+ # extension isn't installed makes pi reject the whole invocation with
38
+ # "Unknown option: --op-env" — only pass it when both the env file exists
39
+ # AND pi-1password is actually installed in the vault-local agent dir.
40
+ OP_ENV_ARG=""
41
+ if [ -f "${VAULT}/.vault-mind/.env.1pass" ] && [ -d "${PI_DIR}/npm/node_modules/pi-1password" ]; then
42
+ OP_ENV_ARG="--op-env .vault-mind/.env.1pass"
43
+ fi
44
+
36
45
  # Start pi in a new terminal window.
37
46
  # macOS: open -a Terminal or open -a iTerm
38
47
  # The trap writes the PID and cleans up on exit.
39
- PI_CMD="PI_CODING_AGENT_DIR='${PI_DIR}' pi; rm -f '${PID_FILE}'"
48
+ PI_CMD="PI_CODING_AGENT_DIR='${PI_DIR}' pi ${OP_ENV_ARG}; rm -f '${PID_FILE}'"
40
49
 
41
50
  if [ -d "/Applications/iTerm.app" ]; then
42
51
  open -a iTerm --args --detach bash -c "echo \$\$ > '${PID_FILE}'; cd '${VAULT}'; ${PI_CMD}"
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: github-release-notes-file
3
+ description: Create GitHub releases with multi-line notes by writing to a file and using gh --notes-file
4
+ ---
5
+
6
+ # GitHub Release Notes — Use `--notes-file`
7
+
8
+ When you need multi-line markdown release notes, **do not** use inline `--notes` with `\n` escapes. Bash keeps the backslashes literal, and the release notes will display `\n` on GitHub.
9
+
10
+ ## Recommended pattern
11
+
12
+ 1. Create the notes file with the `write` tool:
13
+
14
+ Path: `/tmp/release-notes-vX.Y.Z.md`
15
+
16
+ Content:
17
+ ```markdown
18
+ ## What's new
19
+
20
+ - Feature one
21
+ - Feature two
22
+
23
+ ## Known issues
24
+
25
+ - Issue one
26
+ ```
27
+
28
+ 2. Create the release with `--notes-file`:
29
+
30
+ ```bash
31
+ gh release create vX.Y.Z --title "vX.Y.Z" --notes-file /tmp/release-notes-vX.Y.Z.md
32
+ ```
33
+
34
+ 3. To edit an existing release:
35
+
36
+ ```bash
37
+ gh release edit vX.Y.Z --notes-file /tmp/release-notes-vX.Y.Z.md
38
+ ```
39
+
40
+ ## Why not inline?
41
+
42
+ Double-quoted shell strings do not interpret `\n` as a newline. `$'...'` or `printf` can work, but they are fragile for markdown containing quotes and backticks. The bash tool also blocks `cat > file <<'EOF'` redirects for file creation, so use the `write` tool instead.
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: obsidian-guided-test-session
3
+ description: "Run structured manual test sessions in the ReturnVape Obsidian vault: attach debugger, guide user through steps, poll console/errors, collect Developer Toolbox screenshots, and produce a token-efficient session report."
4
+ ---
5
+
6
+ # obsidian-guided-test-session
7
+
8
+ Use this when manually testing the Vault Mind Obsidian plugin in the ReturnVape test vault. The assistant guides the session; the user drives the interaction in Obsidian and captures annotated screenshots with Developer Toolbox.
9
+
10
+ ## Preconditions
11
+
12
+ - Obsidian is running with the ReturnVape vault open.
13
+ - Developer Toolbox plugin is installed and enabled.
14
+ - Vault Mind plugin is installed (BRAT-managed) and enabled.
15
+ - `obsidian` CLI is available in this session.
16
+
17
+ ## Session artifacts
18
+
19
+ - Working scratchpad: `local://test-session-YYYY-MM-DD.md` (or `local://test-session-YYYY-MM-DD-HHMM.md` if multiple sessions per day).
20
+ - Archived report: `docs/test-sessions/YYYY-MM-DD-HHMM.md` after the session.
21
+
22
+ Template sections in the scratchpad:
23
+
24
+ ```markdown
25
+ # Test Session — YYYY-MM-DD HH:MM
26
+
27
+ ## Scope
28
+ - Plugin version tested:
29
+ - pi-vault-mind version tested:
30
+ - Areas under test:
31
+
32
+ ## Steps / Checklist
33
+ - [ ] Step 1: ...
34
+
35
+ ## Findings
36
+ | # | Step | Severity | Summary | Screenshot | Console/errors | Follow-up |
37
+ |---|------|----------|---------|------------|----------------|-----------|
38
+ | 1 | | | | | | |
39
+
40
+ ## Console dump (only if relevant)
41
+ ```
42
+
43
+ ## Start a session
44
+
45
+ 1. Create the scratchpad from the template above.
46
+ 2. Record plugin versions:
47
+ ```bash
48
+ obsidian plugin id=vault-mind vault=ReturnVape
49
+ ```
50
+ 3. Attach the debugger and clear buffers:
51
+ ```bash
52
+ obsidian dev:debug on --vault ReturnVape
53
+ obsidian dev:errors --vault ReturnVape clear
54
+ obsidian dev:console --vault ReturnVape clear
55
+ ```
56
+ 4. Define the test plan checklist in the scratchpad.
57
+
58
+ ## During the session
59
+
60
+ For each step:
61
+
62
+ 1. Tell the user what to do in Obsidian (one action at a time, e.g. "Open the Vault Mind panel from the left sidebar", "Click the Setup tab").
63
+ 2. Wait for the user to report completion or paste a screenshot path/annotation.
64
+ 3. Poll errors and console:
65
+ ```bash
66
+ obsidian dev:errors --vault ReturnVape
67
+ obsidian dev:console --vault ReturnVape --lines 50
68
+ ```
69
+ 4. If the user shares a screenshot, record its path. If they used Developer Toolbox annotations, note the annotation text.
70
+ 5. If an issue is found, record it immediately in the findings table with:
71
+ - Repro step
72
+ - Expected vs actual behavior
73
+ - Severity: `blocker`, `major`, `minor`, `polish`
74
+ - Screenshot path (if any)
75
+ - Relevant console/error snippet
76
+ - Follow-up action (file bug, investigate, expected, etc.)
77
+ 6. If the step succeeds, mark the checklist item done.
78
+
79
+ ## Asking for screenshots
80
+
81
+ When a visual state matters, ask the user:
82
+
83
+ > Please capture a screenshot with Developer Toolbox and paste the saved file path here. Annotate anything that looks wrong.
84
+
85
+ Do not ask for screenshots on every step — only when visual state is ambiguous or an issue appears.
86
+
87
+ ## Ending a session
88
+
89
+ 1. Detach debugger:
90
+ ```bash
91
+ obsidian dev:debug off --vault ReturnVape
92
+ ```
93
+ 2. Summarize findings: count by severity, list blockers/majors first.
94
+ 3. Archive the scratchpad to `docs/test-sessions/YYYY-MM-DD-HHMM.md`.
95
+ 4. If there are actionable bugs, file them or add them to ROADMAP/Open Questions.
96
+
97
+ ## Token efficiency rules
98
+
99
+ - Never paste image bytes into the conversation; only record paths/URIs.
100
+ - Pull full console/error output only when a step fails or an issue is found.
101
+ - Keep the running scratchpad as the single source of truth; append to it instead of repeating findings in chat.
102
+ - Use tables and short bullets for findings.
103
+ - Link follow-ups to existing ROADMAP/P2 items when possible.
104
+
105
+ ## Common pitfalls to watch for
106
+
107
+ - Plugin fails to load: check `obsidian dev:errors` for `MODULE_NOT_FOUND` — usually an npm dependency not bundled into `main.js`.
108
+ - `PVM_API_TOKEN` missing: check Obsidian Settings → Vault Mind token status and the `obsidian dev:console` output.
109
+ - Chat composer blank or unresponsive: check console for Arrow/runtime errors; ask for a screenshot.
110
+ - Setup wizard looping: verify `.pi/` state and whether the vault has already been initialized.
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: obsidian-interactive-test
3
+ description: "Use during plugin testing — enables debug monitoring, takes screenshots (via CLI or Developer Toolbox), inspects DOM, tails console, checks functional state."
4
+ ---
5
+
6
+ # Obsidian Interactive Test Monitor
7
+
8
+ Run these during plugin testing to see what the user sees in real time.
9
+
10
+ ## Setup (run once at start of test session)
11
+
12
+ ```bash
13
+ obsidian dev:debug on # enable console capture
14
+ obsidian vault="ReturnVape" plugin:reload id=vault-mind # ensure latest
15
+ ```
16
+
17
+ **Developer Toolbox** (v0.9.0, installed in ReturnVape) provides richer dev tools:
18
+ - **Issue Capture**: annotated screenshots with plugin context — use instead of dev:screenshot when documenting bugs
19
+ - **Plugin Reloader**: auto-reload on build change — replaces manual plugin:reload
20
+ - **CSS inspector**: browse `--vm-*` variables
21
+ - **Icon browser**: find icon IDs
22
+
23
+ Trigger from Obsidian command palette: "Developer Toolbox: ..."
24
+
25
+ ## Screenshots
26
+
27
+ ```bash
28
+ # Quick — obsidian CLI
29
+ obsidian vault="ReturnVape" dev:screenshot path=/tmp/vm-test.png
30
+
31
+ # Rich — Developer Toolbox (use when annotating a bug)
32
+ # Trigger: Cmd+P → "Developer Toolbox: Capture screenshot"
33
+ ```
34
+
35
+ ## Monitoring loop (run while user tests)
36
+
37
+ ```bash
38
+ # Errors
39
+ obsidian vault="ReturnVape" dev:errors
40
+
41
+ # DOM state — what's visible
42
+ obsidian vault="ReturnVape" dev:dom selector=".vault-mind-panel" text
43
+ obsidian vault="ReturnVape" dev:dom selector=".vault-mind-tab-content:not([style*='none'])" text
44
+
45
+ # Full functional state check
46
+ obsidian vault="ReturnVape" eval code="(()=>{const l=app.workspace.getLeavesOfType('vault-mind-panel');const v=l[0]?.view;const chat=v?.tabs?.find(t=>t.id==='chat');return JSON.stringify({tabs:v?.tabs?.length,activeTab:v?.activeTab,chatHasPi:!!chat?.tab?.connection?.process?.pid,msgCount:chat?.tab?.view?.messages?.length})})()"
47
+
48
+ # Pi process running?
49
+ pgrep -fl "pi" | grep -v "Applications\|System\|usr\|omp\|Claude"
50
+
51
+ # Check heights (layout issues)
52
+ obsidian vault="ReturnVape" eval code="(()=>{const msgs=document.querySelector('.pi-messages');return JSON.stringify({h:msgs?.offsetHeight,children:msgs?.children.length})})()"
53
+ ```
54
+
55
+ ## After user reports an issue
56
+
57
+ 1. `obsidian vault="ReturnVape" dev:errors` — crashes
58
+ 2. `obsidian vault="ReturnVape" dev:dom selector=".vault-mind-tab-content:not([style*='none'])" text` — what's showing
59
+ 3. `obsidian vault="ReturnVape" dev:console` — recent logs
60
+ 4. **Use Developer Toolbox Issue Capture** for annotated screenshot with context
61
+
62
+ ## Deploy fix and reload
63
+
64
+ ```bash
65
+ cd packages/obsidian && node esbuild.config.mjs production
66
+ cp main.js ~/workspace/recycvape/ReturnVape/.obsidian/plugins/vault-mind/
67
+ obsidian vault="ReturnVape" plugin:reload id=vault-mind
68
+ # Or use Developer Toolbox auto-reload if watching build output
69
+ ```
70
+
71
+ ## Functional assertions (not just error-free)
72
+
73
+ After init, verify these are ALL true:
74
+ ```bash
75
+ obsidian vault="ReturnVape" eval code="(()=>{
76
+ const hasPi=!!require('child_process').execSync('pgrep -f \"pi.*rpc\"',{stdio:['pipe','pipe','pipe']}).toString().trim();
77
+ const panel=app.workspace.getLeavesOfType('vault-mind-panel')[0]?.view;
78
+ const chat=panel?.tabs?.find(t=>t.id==='chat')?.tab;
79
+ return JSON.stringify({
80
+ panel_has_tabs: panel?.tabs?.length>0,
81
+ chat_mounted: chat?.mounted,
82
+ pi_connected: chat?.connection?.isConnected(),
83
+ pi_process_alive: !!(chat?.connection?.process?.pid),
84
+ messages_area_height: document.querySelector('.pi-messages')?.offsetHeight,
85
+ piConfigDir_correct: chat?.deps?.piConfigDir?.startsWith('/')
86
+ })
87
+ })()"
88
+ ```
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: obsidian-plugin-publish
3
+ description: Publishing the Vault Mind Obsidian plugin from the pi-vault-mind monorepo to the separate obsidian-vault-mind repo via BRAT
4
+ ---
5
+
6
+ # Publishing the Obsidian Plugin
7
+
8
+ ## Architecture
9
+
10
+ - Source: `packages/obsidian/` in the `pi-vault-mind` monorepo
11
+ - Distribution repo: `kylebrodeur/obsidian-vault-mind` (releases only)
12
+ - Plugin ID: `vault-mind`
13
+ - BRAT install: `kylebrodeur/obsidian-vault-mind`
14
+
15
+ ## Build
16
+
17
+ ```bash
18
+ cd packages/obsidian && node esbuild.config.mjs production
19
+ ```
20
+
21
+ ## Publish (local)
22
+
23
+ ```bash
24
+ ./scripts/publish-obsidian-plugin.sh [version]
25
+ ```
26
+
27
+ Reads version from `packages/obsidian/manifest.json` if not specified.
28
+ Clones plugin repo, copies `main.js`, `manifest.json`, `styles.css`, `versions.json`, `README.md`, commits, pushes, creates GitHub release.
29
+
30
+ ## Publish (CI)
31
+
32
+ Tag with `obsidian-v<version>` and push. The `release-obsidian.yml` workflow runs the publish script.
33
+ Requires `PLUGIN_REPO_TOKEN` secret (PAT with repo scope).
34
+
35
+ ## Test locally
36
+
37
+ ```bash
38
+ # Copy to vault for immediate testing
39
+ cp packages/obsidian/main.js <vault>/.obsidian/plugins/vault-mind/main.js
40
+ obsidian plugin:reload id=vault-mind
41
+ obsidian dev:errors
42
+ ```
43
+
44
+ ## BRAT install command (for users)
45
+
46
+ ```bash
47
+ obsidian eval code='(async()=>{await app.plugins.getPlugin("obsidian42-brat").betaPlugins.addPlugin("kylebrodeur/obsidian-vault-mind")})()'
48
+ ```
49
+
50
+ Note: `betaPlugins.addPlugin` (not `addPlugin` on plugin root), async IIFE required.
51
+
52
+ ## Version bump checklist
53
+
54
+ 1. Bump `packages/obsidian/manifest.json` version
55
+ 2. Bump root `manifest.json` to match
56
+ 3. Build: `node esbuild.config.mjs production`
57
+ 4. Commit
58
+ 5. Run `./scripts/publish-obsidian-plugin.sh`
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: pi-vault-mind-release
3
+ description: "Release workflow for the pi-vault-mind monorepo: version bump, build, commit, GitHub releases, Obsidian plugin publish, BRAT test-vault install, npm publish"
4
+ ---
5
+
6
+ # pi-vault-mind release workflow
7
+
8
+ Use this when cutting a new release of `pi-vault-mind` (backend/core) and `obsidian-pi-vault-mind` (Obsidian plugin).
9
+
10
+ ## Preconditions
11
+
12
+ - `pnpm check` passes.
13
+ - `pnpm test` passes.
14
+ - `packages/obsidian` build passes (`pnpm --filter obsidian-pi-vault-mind build`).
15
+
16
+ ## Version files to bump
17
+
18
+ Keep versions aligned for coordinated releases:
19
+
20
+ - `package.json` root → `pi-vault-mind` package version.
21
+ - `packages/obsidian/package.json` → plugin package version (should track manifest).
22
+ - `packages/obsidian/manifest.json` → `version`.
23
+ - `manifest.json` root → mirror `packages/obsidian/manifest.json`.
24
+ - `packages/obsidian/versions.json` → add new row: `"<version>": "<minAppVersion>"`.
25
+
26
+ Example: bump root to `0.13.0`, plugin files to `0.5.0`.
27
+
28
+ For **plugin-only hotfixes**, bump only the plugin files (`packages/obsidian/package.json`, `packages/obsidian/manifest.json`, root `manifest.json`, `versions.json`). Do **not** bump the root `package.json` if the npm package itself did not change.
29
+
30
+ ## Build and verify
31
+
32
+ ```bash
33
+ pnpm run build
34
+ pnpm --filter obsidian-pi-vault-mind build
35
+ pnpm check && pnpm test
36
+ ```
37
+
38
+ ## Update CHANGELOG.md
39
+
40
+ Add a section under `# Changelog` at the top, e.g.:
41
+
42
+ ```markdown
43
+ ## 0.5.1 — YYYY-MM-DD
44
+
45
+ ### Fixed
46
+ ...
47
+
48
+ ## 0.13.0 / 0.5.0 — YYYY-MM-DD
49
+
50
+ ### Added
51
+ ...
52
+ ```
53
+
54
+ For plugin-only hotfixes, use a plugin-version-only header.
55
+
56
+ ## Commit and push
57
+
58
+ ```bash
59
+ git add -A
60
+ git commit -m "feat: <summary>"
61
+ git push origin main
62
+ ```
63
+
64
+ For a plugin-only hotfix:
65
+
66
+ ```bash
67
+ git commit -m "fix(obsidian): <summary>
68
+
69
+ - Root package stays at 0.13.0 since the npm package did not change."
70
+ ```
71
+
72
+ ## Create GitHub releases
73
+
74
+ Main repo (only when the npm package / root changed):
75
+
76
+ ```bash
77
+ gh release create v<version> --repo kylebrodeur/pi-vault-mind \
78
+ --title "v<version> — <summary>" \
79
+ --notes "<markdown release notes>"
80
+ ```
81
+
82
+ Obsidian plugin repo:
83
+
84
+ ```bash
85
+ bash scripts/publish-obsidian-plugin.sh <plugin-version>
86
+ ```
87
+
88
+ This script pushes `manifest.json`, `main.js`, `styles.css`, and `versions.json` to `kylebrodeur/obsidian-vault-mind` and creates a GitHub release there.
89
+
90
+ ## Install/update in the test vault via BRAT
91
+
92
+ Never manually copy plugin files into `.obsidian/plugins/vault-mind/`. Let BRAT manage the install.
93
+
94
+ The ReturnVape test vault has BRAT configured with `kylebrodeur/obsidian-vault-mind` as a beta plugin. Trigger an update:
95
+
96
+ ```bash
97
+ obsidian command id=obsidian42-brat:checkForUpdatesAndUpdate vault=ReturnVape
98
+ ```
99
+
100
+ Then verify:
101
+
102
+ ```bash
103
+ obsidian plugin id=vault-mind vault=ReturnVape
104
+ obsidian plugin:reload id=vault-mind vault=ReturnVape
105
+ obsidian dev:errors --vault ReturnVape
106
+ obsidian dev:console --vault ReturnVape --lines 50
107
+ ```
108
+
109
+ Expected: plugin version matches the new release, reload succeeds, no plugin-load errors.
110
+
111
+ ## Reset the test vault data (optional)
112
+
113
+ ```bash
114
+ ./scripts/reset-test-vault.sh
115
+ ```
116
+
117
+ This removes `.pi/`, `.lancedb/`, `pi-vault-mind.config.json`, and `collections/` while preserving vault notes and `.obsidian/` (including the BRAT-managed plugin).
118
+
119
+ ## Publish to npm (only when root package changed)
120
+
121
+ ```bash
122
+ npm pack
123
+ npm publish pi-vault-mind-<version>.tgz --otp=<your-otp>
124
+ ```
125
+
126
+ Requires the user's one-time password.
127
+
128
+ ## Post-release smoke test
129
+
130
+ 1. Open the vault in Obsidian.
131
+ 2. Trigger BRAT update if not already done.
132
+ 3. Open the Vault Mind panel → Setup tab.
133
+ 4. Walk through init: model-router picker, Modal setup + test connection, chat composer, session popover.
134
+ 5. Exercise the **Vault Mind: Dispatch agent** palette command on a note with `@agent` markers.
135
+ 6. Verify chat messages render and actions (copy/info/rewind) work.
136
+
137
+ ## Obsidian dependency bundling rule
138
+
139
+ If the plugin imports an npm package (e.g. `json5`), it must be bundled into `main.js`. Do **not** list it in `esbuild.config.mjs`'s `external` array. Only `obsidian`, `electron`, `@codemirror/view`, and Node built-ins should be external.
140
+
141
+ Verify a dependency is bundled by ensuring `main.js` contains its code and that `require("<dep>")` does not appear in the bundle.
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: pre-test-release
3
+ description: "Use before handing off to the user for manual testing — runs full CI, updates docs/versions, publishes plugin, resets test vault, and alerts for npm OTP."
4
+ ---
5
+
6
+ # Pre-Test Release Checklist
7
+
8
+ Run this procedure when implementation is complete and the user needs a clean, publishable build to test against.
9
+
10
+ ## 1. Full CI Check
11
+
12
+ ```bash
13
+ cd packages/obsidian && npx tsc --noEmit # plugin types
14
+ cd ~/workspace/pi-vault-mind && pnpm run build # full project build
15
+ cd ~/workspace/pi-vault-mind && pnpm test # all tests (expect 238 pass / 0 fail)
16
+ cd packages/obsidian && node esbuild.config.mjs production # plugin bundle
17
+ ```
18
+
19
+ All must pass with zero errors. Fix any issues before proceeding. Do not rely on piped `tail` for exit status — verify the actual test summary and exit code.
20
+
21
+ ## 2. Clean Git Tree
22
+
23
+ ```bash
24
+ git status # must be clean — no unstaged, no untracked
25
+ ```
26
+
27
+ If dirty: stage and commit with an appropriate message, or stash unrelated changes.
28
+
29
+ ## 3. Docs Review & Update
30
+
31
+ - Read `docs/NEXT_STEPS.md` — move completed items to ✅ Shipped, update Now/Next
32
+ - Read `docs/ROADMAP.md` — add new version row to Shipped table, update date and current status
33
+ - Read `docs/getting-started/WALKTHROUGH.md` — verify steps match current behavior
34
+ - Commit doc changes: `docs: update status for v<version>`
35
+
36
+ ## 4. Version Bump
37
+
38
+ Determine bump type (patch/minor) based on changes. Update ALL version files:
39
+
40
+ ```python
41
+ # package.json — npm package version
42
+ # packages/obsidian/manifest.json — plugin version
43
+ # manifest.json (root) — mirror of plugin manifest
44
+ # packages/obsidian/versions.json — add "<plugin-ver>": "<minAppVersion>"
45
+ ```
46
+
47
+ Rebuild plugin after bump: `cd packages/obsidian && node esbuild.config.mjs production`
48
+
49
+ ## 5. Commit, Push, Release
50
+
51
+ Write the release notes to a temp markdown file so multi-line formatting is preserved literally. Use the `write` tool to save it to `/tmp/release-notes-v<npm-ver>.md`:
52
+
53
+ ```markdown
54
+ ## What's new
55
+
56
+ < bullets >
57
+
58
+ ## Release gate
59
+
60
+ < pending verification, known issues >
61
+ ```
62
+
63
+ ```bash
64
+ git add -A
65
+ git commit -m "feat(...): <summary>\n\n<details>"
66
+ git push origin main
67
+ gh release create v<npm-ver> --title "v<npm-ver>" --notes-file /tmp/release-notes-v<npm-ver>.md
68
+ ```
69
+
70
+ ## 6. Publish Obsidian Plugin
71
+
72
+ ```bash
73
+ bash scripts/publish-obsidian-plugin.sh <plugin-ver>
74
+ ```
75
+
76
+ This clones `kylebrodeur/obsidian-vault-mind`, copies built assets, commits, pushes, and creates a GH release with main.js + manifest.json + styles.css.
77
+
78
+ ## 7. Reset & Update Test Vault
79
+
80
+ ```bash
81
+ ./scripts/reset-test-vault.sh
82
+ ```
83
+
84
+ This removes `.pi/`, config, `.lancedb/`, `collections/`, and copies the latest plugin build into the test vault.
85
+
86
+ After reset, remind user to **reload the plugin in Obsidian** (reopen vault or disable/re-enable plugin).
87
+
88
+ ## 8. npm Pack & Test
89
+
90
+ ```bash
91
+ cd ~/workspace/pi-vault-mind
92
+ npm pack --dry-run # verify package contents look correct
93
+ npm pack # create tarball for inspection
94
+ ```
95
+
96
+ ## 9. Alert User
97
+
98
+ Tell the user:
99
+ - Everything is published (GH releases for both repos)
100
+ - Test vault is reset and ready
101
+ - npm needs their OTP: `npm publish --otp=<code>`
102
+ - Where to start testing (specific WALKTHROUGH step or doc section)
103
+ - What was changed since last test (brief summary)
104
+ - Any known issues or areas to watch
105
+ - Remind to reload plugin in Obsidian after reset
106
+
107
+ ## Key paths
108
+
109
+ | Artifact | Location |
110
+ |----------|----------|
111
+ | npm package | `pi-vault-mind` on npm |
112
+ | Plugin repo | `kylebrodeur/obsidian-vault-mind` (BRAT) |
113
+ | Test vault | `~/workspace/recycvape/ReturnVape/` |
114
+ | Plugin in vault | `<vault>/.obsidian/plugins/vault-mind/` |
115
+ | Publish script | `scripts/publish-obsidian-plugin.sh` |
116
+ | Reset script | `scripts/reset-test-vault.sh` |
@@ -1,2 +0,0 @@
1
- import { strict as assert } from "node:assert";
2
- assert.equal(1, 1);