@floomhq/floom-mcp-sync 1.0.36 → 1.0.37

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.
@@ -262,6 +262,9 @@ export async function withSyncLock(fn) {
262
262
  await rm(lockPath, { recursive: true, force: true }).catch(() => { });
263
263
  }
264
264
  }
265
+ export async function clearSyncLock() {
266
+ await rm(join(dirname(syncManifestPath()), "sync.lock"), { recursive: true, force: true }).catch(() => { });
267
+ }
265
268
  export function manifestKey(root, target) {
266
269
  const relativeTarget = relative(resolve(root), resolve(target));
267
270
  if (relativeTarget === ".." || relativeTarget.startsWith(`..${sep}`)) {
package/dist/server.js CHANGED
@@ -2,15 +2,17 @@
2
2
  import { createInterface } from "node:readline";
3
3
  import { stdin, stdout } from "node:process";
4
4
  import { autoSync } from "./auto-sync.js";
5
+ import { clearSyncLock } from "./lib/manifest.js";
5
6
  import { getSkill } from "./tools/get.js";
6
7
  import { searchSkills } from "./tools/search.js";
7
8
  import { syncStatus } from "./tools/status.js";
8
- const SERVER_VERSION = "1.0.36";
9
+ const SERVER_VERSION = "1.0.37";
9
10
  const DEFAULT_INTERVAL_MS = 60_000;
10
11
  const MIN_INTERVAL_MS = 10_000;
11
12
  const SEARCH_TYPES = new Set(["knowledge", "instruction", "workflow", "skill"]);
12
13
  let syncInFlight = null;
13
14
  let syncAbortController = null;
15
+ let shuttingDown = false;
14
16
  function runAutoSync() {
15
17
  if (syncInFlight)
16
18
  return syncInFlight;
@@ -27,6 +29,24 @@ function abortAutoSync() {
27
29
  syncAbortController?.abort();
28
30
  syncAbortController = null;
29
31
  }
32
+ async function stopAutoSync() {
33
+ const inFlight = syncInFlight;
34
+ abortAutoSync();
35
+ if (!inFlight)
36
+ return;
37
+ try {
38
+ await Promise.race([
39
+ inFlight,
40
+ new Promise((resolve) => setTimeout(resolve, 750)),
41
+ ]);
42
+ }
43
+ catch {
44
+ // Shutdown is best-effort; autoSync already logged actionable failures.
45
+ }
46
+ finally {
47
+ await clearSyncLock();
48
+ }
49
+ }
30
50
  function usage() {
31
51
  return `
32
52
  floom-mcp-sync v${SERVER_VERSION}
@@ -280,10 +300,12 @@ async function main() {
280
300
  });
281
301
  const pollHandle = startPolling(intervalMs, syncState);
282
302
  const shutdown = (signal) => {
303
+ if (shuttingDown)
304
+ return;
305
+ shuttingDown = true;
283
306
  clearInterval(pollHandle);
284
- abortAutoSync();
285
307
  process.stderr.write(`[floom] received ${signal}, stopping sync poller\n`);
286
- process.exit(0);
308
+ void stopAutoSync().finally(() => process.exit(0));
287
309
  };
288
310
  process.once("SIGINT", () => shutdown("SIGINT"));
289
311
  process.once("SIGTERM", () => shutdown("SIGTERM"));
@@ -307,7 +329,7 @@ async function main() {
307
329
  }
308
330
  finally {
309
331
  clearInterval(pollHandle);
310
- abortAutoSync();
332
+ await stopAutoSync();
311
333
  process.stderr.write("[floom] stdin closed, stopping sync poller\n");
312
334
  }
313
335
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floomhq/floom-mcp-sync",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "Lightweight Floom MCP server for installing, publishing, and startup-syncing skills.",
5
5
  "license": "MIT",
6
6
  "type": "module",