vault-cortex 0.10.2-beta.50 → 0.10.3-beta.52

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 CHANGED
@@ -154,8 +154,9 @@ const reportWrites = (params, prompts) => {
154
154
  /**
155
155
  * Offers to start the container, walking a gate ladder where each failed
156
156
  * gate degrades to instructions instead of an error: daemon running → user
157
- * consents → docker run succeeds → health check passes. Returns true only
158
- * when the server is confirmed up.
157
+ * consents → docker run succeeds → health check passes. Returns "running"
158
+ * when the server is confirmed up, "starting" when the container launched
159
+ * but the health check timed out, or "not-started" when a gate failed.
159
160
  */
160
161
  const offerDockerRun = async (params, deps) => {
161
162
  const { targetDir, port, mode, vaultPath } = params;
@@ -168,11 +169,11 @@ const offerDockerRun = async (params, deps) => {
168
169
  nextStep: `\nThen start the server with:\n ${startHint}`,
169
170
  })
170
171
  : buildDaemonNotRunningMessage(`, then run:\n ${startHint}`));
171
- return false;
172
+ return "not-started";
172
173
  }
173
174
  const startNow = await prompts.confirm("Start the server now?", true);
174
175
  if (!startNow)
175
- return false;
176
+ return "not-started";
176
177
  const containerStarted = docker.dockerRun({
177
178
  mode,
178
179
  envFilePath: join(targetDir, ".env"),
@@ -181,7 +182,7 @@ const offerDockerRun = async (params, deps) => {
181
182
  });
182
183
  if (!containerStarted) {
183
184
  prompts.error("docker run failed — see output above.");
184
- return false;
185
+ return "not-started";
185
186
  }
186
187
  const spinner = prompts.spinner();
187
188
  spinner.start("Waiting for the server to come up (first run may take a moment)");
@@ -189,10 +190,10 @@ const offerDockerRun = async (params, deps) => {
189
190
  const healthy = await pollHealth({ url: `http://127.0.0.1:${port}/healthz`, timeoutMs }, fetchFn);
190
191
  if (!healthy) {
191
192
  spinner.stop(healthTimeoutMessage(mode, timeoutMs));
192
- return false;
193
+ return "starting";
193
194
  }
194
195
  spinner.stop("Server is up — health check passed.");
195
- return true;
196
+ return "running";
196
197
  };
197
198
  // Local flow: resolve vault path → resolve target dir → generate token →
198
199
  // write .env → optionally start the container → print connect instructions.
@@ -271,10 +272,16 @@ const runLocalInit = async (flags, deps) => {
271
272
  prompts.log("Generated MCP auth token (saved to .env).");
272
273
  const port = readEnvPort(join(targetDir, ".env"));
273
274
  // --yes is for scripts/CI, so it never starts Docker.
274
- const started = flags.yes
275
- ? false
275
+ const startStatus = flags.yes
276
+ ? "not-started"
276
277
  : await offerDockerRun({ targetDir, port, mode: "local", vaultPath }, deps);
277
- prompts.print(buildLocalConnectMessage({ targetDir, token, started, port, tokenWritten }));
278
+ prompts.print(buildLocalConnectMessage({
279
+ targetDir,
280
+ token,
281
+ startStatus,
282
+ port,
283
+ tokenWritten,
284
+ }));
278
285
  return 0;
279
286
  };
280
287
  // Remote flow (VPS + Obsidian Sync): resolve target dir → PUBLIC_URL →
@@ -347,12 +354,12 @@ const runRemoteInit = async (flags, deps) => {
347
354
  const effectivePublicUrl = readEnvPublicUrl(join(targetDir, ".env")) ?? publicUrl;
348
355
  // Without the sync token the container can't start (init-check-auth fails
349
356
  // and s6 stops it), so only offer docker run when it was provided.
350
- const started = obsidianAuthToken === ""
351
- ? false
357
+ const startStatus = obsidianAuthToken === ""
358
+ ? "not-started"
352
359
  : await offerDockerRun({ targetDir, port, mode: "remote" }, deps);
353
360
  // The container check above hit localhost on this machine; the public URL
354
361
  // is the ingress path clients actually use — probe it too, informationally.
355
- if (started) {
362
+ if (startStatus === "running") {
356
363
  await reportPublicUrlProbe(effectivePublicUrl, {
357
364
  prompts,
358
365
  fetchFn: deps.fetchFn,
@@ -362,7 +369,7 @@ const runRemoteInit = async (flags, deps) => {
362
369
  targetDir,
363
370
  token,
364
371
  publicUrl: effectivePublicUrl,
365
- started,
372
+ startStatus,
366
373
  obsidianTokenMissing: obsidianAuthToken === "",
367
374
  tokenWritten,
368
375
  }));
package/dist/messages.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { styleText } from "node:util";
2
+ import { CONTAINER_NAME } from "./docker.js";
2
3
  // Strip styling when stdout isn't a color TTY (piped output, CI) or NO_COLOR
3
4
  // is set (any value, including empty — per the NO_COLOR spec) so
4
5
  // captured/redirected output stays plain — no stray escape codes in copied
@@ -50,11 +51,14 @@ const upgradeCommand = (targetDir) => `npx vault-cortex@latest upgrade --dir "${
50
51
  // have. `start` runs the same re-create cycle and pulls the image on demand.
51
52
  export const startCommand = (targetDir) => `npx vault-cortex@latest start --dir "${targetDir}"`;
52
53
  const startServerLine = (targetDir) => `Start the server:\n ${startCommand(targetDir)}`;
53
- /** Remote start line: running, blocked on the missing sync token, or ready to start. */
54
+ const startingInBackgroundLine = () => `The server is starting in the background check progress:\n docker logs ${CONTAINER_NAME}`;
55
+ /** Remote start line: running, starting, blocked on the missing sync token, or ready to start. */
54
56
  const remoteStartLine = (params) => {
55
- const { targetDir, started, obsidianTokenMissing } = params;
56
- if (started)
57
+ const { targetDir, startStatus, obsidianTokenMissing } = params;
58
+ if (startStatus === "running")
57
59
  return "The server is running.";
60
+ if (startStatus === "starting")
61
+ return startingInBackgroundLine();
58
62
  if (obsidianTokenMissing) {
59
63
  return `Fill in OBSIDIAN_AUTH_TOKEN in ${targetDir}/.env, then start the server:\n ${startCommand(targetDir)}`;
60
64
  }
@@ -99,13 +103,14 @@ const curlGuidance = (mcpUrl) => `Clients without OAuth, scripts, and curl send
99
103
  const smokeTest = (healthUrl) => `Smoke test:
100
104
  curl ${healthUrl}`;
101
105
  /**
102
- * Remote health-check block. Started: the CLI verified localhost on the VPS,
103
- * but the public URL is a different check (ingress DNS, TLS, proxy), so the
104
- * command stays, reworded as the works-from-any-device check. Not started:
105
- * the plain smoke test to run after starting.
106
+ * Remote health-check block. Running or starting: the CLI verified localhost
107
+ * on the VPS (or the container is still coming up), but the public URL is a
108
+ * different check (ingress — DNS, TLS, proxy), so the command stays, reworded
109
+ * as the works-from-any-device check. Not started: the plain smoke test to
110
+ * run after starting.
106
111
  */
107
- const remoteHealthCheckBlock = (healthUrl, started) => {
108
- if (started) {
112
+ const remoteHealthCheckBlock = (healthUrl, startStatus) => {
113
+ if (startStatus === "running" || startStatus === "starting") {
109
114
  return `Health check — works from any device that can reach the URL:
110
115
  curl ${healthUrl}`;
111
116
  }
@@ -119,18 +124,20 @@ const updateGuidance = (targetDir) => `Update to the latest release:
119
124
  * actually run.
120
125
  */
121
126
  export const buildLocalConnectMessage = (params) => {
122
- const { targetDir, token, started, port, tokenWritten } = params;
127
+ const { targetDir, token, startStatus, port, tokenWritten } = params;
123
128
  const baseUrl = `http://localhost:${port}`;
124
- const startLine = started
129
+ const startLine = startStatus === "running"
125
130
  ? "The server is running."
126
- : startServerLine(targetDir);
131
+ : startStatus === "starting"
132
+ ? startingInBackgroundLine()
133
+ : startServerLine(targetDir);
127
134
  const tokenLine = tokenBlock({ targetDir, token, tokenWritten });
128
135
  // Once the server is confirmed up, the smoke test is dropped — the CLI just
129
136
  // verified this exact URL, so re-printing it reads as leftover homework.
130
137
  // Assembled as a filtered list so the omission leaves no stray blank line.
131
138
  const nonOauthBlocks = [
132
139
  curlGuidance(`${baseUrl}/mcp`),
133
- started ? undefined : smokeTest(`${baseUrl}/healthz`),
140
+ startStatus === "running" ? undefined : smokeTest(`${baseUrl}/healthz`),
134
141
  ]
135
142
  .filter(Boolean)
136
143
  .join("\n\n");
@@ -187,10 +194,10 @@ ${bottomRule()}`;
187
194
  * handling here.
188
195
  */
189
196
  export const buildRemoteConnectMessage = (params) => {
190
- const { targetDir, token, publicUrl, started, obsidianTokenMissing, tokenWritten, } = params;
197
+ const { targetDir, token, publicUrl, startStatus, obsidianTokenMissing, tokenWritten, } = params;
191
198
  const startLine = remoteStartLine({
192
199
  targetDir,
193
- started,
200
+ startStatus,
194
201
  obsidianTokenMissing,
195
202
  });
196
203
  const tokenLine = tokenBlock({ targetDir, token, tokenWritten });
@@ -227,7 +234,7 @@ ${sectionRule("Non-OAuth")}
227
234
 
228
235
  ${curlGuidance(`${publicUrl}/mcp`)}
229
236
 
230
- ${remoteHealthCheckBlock(`${publicUrl}/healthz`, started)}
237
+ ${remoteHealthCheckBlock(`${publicUrl}/healthz`, startStatus)}
231
238
 
232
239
  ${sectionRule("Settings")}
233
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vault-cortex",
3
- "version": "0.10.2-beta.50",
3
+ "version": "0.10.3-beta.52",
4
4
  "description": "Set up a Vault Cortex MCP server for your Obsidian vault in one command: npx vault-cortex@latest init",
5
5
  "license": "MIT",
6
6
  "type": "module",