vault-cortex 0.2.3 → 0.2.5
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/dist/init.js +9 -5
- package/dist/messages.js +8 -3
- package/package.json +1 -1
package/dist/init.js
CHANGED
|
@@ -4,7 +4,7 @@ import { buildLocalConnectMessage, buildRemoteConnectMessage, } from "./messages
|
|
|
4
4
|
import { OBSIDIAN_SYNC_IMAGE, pollHealth } from "./docker.js";
|
|
5
5
|
import { buildFilesToWrite, readEnvPort, writeFiles, } from "./scaffold.js";
|
|
6
6
|
import { generateToken } from "./token.js";
|
|
7
|
-
import { validateVaultPath } from "./vault.js";
|
|
7
|
+
import { expandTilde, validateVaultPath } from "./vault.js";
|
|
8
8
|
const DEFAULT_TARGET_DIR = "./vault-cortex";
|
|
9
9
|
const isMode = (value) => value === "local" || value === "remote";
|
|
10
10
|
const askMode = async (prompts) => {
|
|
@@ -169,13 +169,15 @@ const runLocalInit = async (flags, deps) => {
|
|
|
169
169
|
const vaultPath = vaultPathResult !== undefined && vaultPathResult.kind !== "error"
|
|
170
170
|
? vaultPathResult.path
|
|
171
171
|
: await askVaultPath(prompts);
|
|
172
|
-
|
|
172
|
+
// expandTilde before resolve: resolve() treats a leading `~` as a literal
|
|
173
|
+
// path segment, so a quoted "~/path" would create a directory named "~".
|
|
174
|
+
const targetDir = resolve(expandTilde(flags.dir ??
|
|
173
175
|
(flags.yes
|
|
174
176
|
? DEFAULT_TARGET_DIR
|
|
175
177
|
: await prompts.text("Where should I put the config files?", {
|
|
176
178
|
defaultValue: DEFAULT_TARGET_DIR,
|
|
177
179
|
placeholder: DEFAULT_TARGET_DIR,
|
|
178
|
-
})));
|
|
180
|
+
}))));
|
|
179
181
|
const token = generateToken();
|
|
180
182
|
// Conflict policy: identical existing files are skipped silently;
|
|
181
183
|
// differing ones prompt per file (default keep). --yes never overwrites —
|
|
@@ -211,11 +213,13 @@ const runLocalInit = async (flags, deps) => {
|
|
|
211
213
|
// instructions. Always interactive — the sync-token step can't be defaulted.
|
|
212
214
|
const runRemoteInit = async (flags, deps) => {
|
|
213
215
|
const { prompts, docker } = deps;
|
|
214
|
-
|
|
216
|
+
// expandTilde before resolve: resolve() treats a leading `~` as a literal
|
|
217
|
+
// path segment, so a quoted "~/path" would create a directory named "~".
|
|
218
|
+
const targetDir = resolve(expandTilde(flags.dir ??
|
|
215
219
|
(await prompts.text("Where should I put the config files?", {
|
|
216
220
|
defaultValue: DEFAULT_TARGET_DIR,
|
|
217
221
|
placeholder: DEFAULT_TARGET_DIR,
|
|
218
|
-
})));
|
|
222
|
+
}))));
|
|
219
223
|
const publicUrl = await askPublicUrl(prompts);
|
|
220
224
|
const vaultName = await askVaultName(prompts);
|
|
221
225
|
// The Obsidian Sync token comes from an interactive docker run (the
|
package/dist/messages.js
CHANGED
|
@@ -22,8 +22,11 @@ export const buildLocalConnectMessage = (params) => {
|
|
|
22
22
|
const startLine = started
|
|
23
23
|
? "The server is running."
|
|
24
24
|
: startServerLine(targetDir);
|
|
25
|
+
// When the token was written, put it alone on its own line so selecting
|
|
26
|
+
// that line copies just the token — no "Auth token: " prefix to trim and
|
|
27
|
+
// no chance of grabbing the surrounding label.
|
|
25
28
|
const tokenLine = tokenWritten
|
|
26
|
-
? `Auth token
|
|
29
|
+
? `Auth token:\n ${token}`
|
|
27
30
|
: `Auth token: use the existing MCP_AUTH_TOKEN in ${targetDir}/.env`;
|
|
28
31
|
// Flush-left on purpose: template literals keep leading whitespace, so
|
|
29
32
|
// indenting these lines would indent the rendered output.
|
|
@@ -34,7 +37,9 @@ Connect your MCP client:
|
|
|
34
37
|
${tokenLine}
|
|
35
38
|
|
|
36
39
|
Claude Code:
|
|
37
|
-
1. claude mcp add --transport http vault-cortex http://localhost:${port}/mcp
|
|
40
|
+
1. claude mcp add --scope user --transport http vault-cortex http://localhost:${port}/mcp
|
|
41
|
+
(--scope user registers it for every project; drop it to scope
|
|
42
|
+
the server to the current directory only)
|
|
38
43
|
2. Approve the browser consent page with the token above
|
|
39
44
|
3. Done. The client holds auto-refreshing access tokens; the
|
|
40
45
|
token never sits in client config
|
|
@@ -89,7 +94,7 @@ export const buildRemoteConnectMessage = (params) => {
|
|
|
89
94
|
Note: claude.ai and Claude Desktop only accept https URLs — set up
|
|
90
95
|
HTTPS when you're ready for those clients (see the HTTPS section in
|
|
91
96
|
the remote guide). Claude Code works with http:
|
|
92
|
-
claude mcp add --transport http vault-cortex ${publicUrl}/mcp`;
|
|
97
|
+
claude mcp add --scope user --transport http vault-cortex ${publicUrl}/mcp`;
|
|
93
98
|
// Flush-left on purpose: template literals keep leading whitespace, so
|
|
94
99
|
// indenting these lines would indent the rendered output.
|
|
95
100
|
const connectMessage = `${startLine}
|