@syntica/mcp 2.1.2 → 2.2.1

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/index.js CHANGED
@@ -18804,7 +18804,7 @@ var require_view = __commonJS({
18804
18804
  var debug = require_src()("express:view");
18805
18805
  var path = require("node:path");
18806
18806
  var fs = require("node:fs");
18807
- var dirname = path.dirname;
18807
+ var dirname2 = path.dirname;
18808
18808
  var basename = path.basename;
18809
18809
  var extname = path.extname;
18810
18810
  var join5 = path.join;
@@ -18843,7 +18843,7 @@ var require_view = __commonJS({
18843
18843
  for (var i = 0; i < roots.length && !path2; i++) {
18844
18844
  var root = roots[i];
18845
18845
  var loc = resolve(root, name);
18846
- var dir = dirname(loc);
18846
+ var dir = dirname2(loc);
18847
18847
  var file = basename(loc);
18848
18848
  path2 = this.resolve(dir, file);
18849
18849
  }
@@ -26818,11 +26818,11 @@ var require_utils4 = __commonJS({
26818
26818
  let endIpv6 = false;
26819
26819
  let consume = consumeHextets;
26820
26820
  for (let i = 0; i < input.length; i++) {
26821
- const cursor = input[i];
26822
- if (cursor === "[" || cursor === "]") {
26821
+ const cursor2 = input[i];
26822
+ if (cursor2 === "[" || cursor2 === "]") {
26823
26823
  continue;
26824
26824
  }
26825
- if (cursor === ":") {
26825
+ if (cursor2 === ":") {
26826
26826
  if (endipv6Encountered === true) {
26827
26827
  endIpv6 = true;
26828
26828
  }
@@ -26838,13 +26838,13 @@ var require_utils4 = __commonJS({
26838
26838
  }
26839
26839
  address.push(":");
26840
26840
  continue;
26841
- } else if (cursor === "%") {
26841
+ } else if (cursor2 === "%") {
26842
26842
  if (!consume(buffer, address, output)) {
26843
26843
  break;
26844
26844
  }
26845
26845
  consume = consumeIsZone;
26846
26846
  } else {
26847
- buffer.push(cursor);
26847
+ buffer.push(cursor2);
26848
26848
  continue;
26849
26849
  }
26850
26850
  }
@@ -55183,8 +55183,8 @@ var Protocol = class {
55183
55183
  }
55184
55184
  }
55185
55185
  },
55186
- listTasks: (cursor) => {
55187
- return taskStore.listTasks(cursor, sessionId);
55186
+ listTasks: (cursor2) => {
55187
+ return taskStore.listTasks(cursor2, sessionId);
55188
55188
  }
55189
55189
  };
55190
55190
  }
@@ -55474,8 +55474,8 @@ var ExperimentalServerTasks = class {
55474
55474
  *
55475
55475
  * @experimental
55476
55476
  */
55477
- async listTasks(cursor, options) {
55478
- return this._server.listTasks(cursor ? { cursor } : void 0, options);
55477
+ async listTasks(cursor2, options) {
55478
+ return this._server.listTasks(cursor2 ? { cursor: cursor2 } : void 0, options);
55479
55479
  }
55480
55480
  /**
55481
55481
  * Cancels a running task.
@@ -57307,38 +57307,521 @@ var import_fs2 = require("fs");
57307
57307
  var import_os2 = require("os");
57308
57308
  var import_path2 = require("path");
57309
57309
 
57310
- // apps/mcp-server/src/cli/setup.ts
57310
+ // apps/mcp-server/src/cli/agents.ts
57311
57311
  var import_child_process = require("child_process");
57312
57312
  var import_fs = require("fs");
57313
57313
  var import_os = require("os");
57314
57314
  var import_path = require("path");
57315
+
57316
+ // apps/mcp-server/src/cli/config-merge.ts
57317
+ function mergeJsonServer(existing, key, serversField, entry) {
57318
+ let doc = {};
57319
+ if (existing !== null && existing.trim() !== "") {
57320
+ try {
57321
+ const parsed = JSON.parse(existing);
57322
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
57323
+ return { ok: false, reason: "the file is not a JSON object" };
57324
+ }
57325
+ doc = parsed;
57326
+ } catch (err) {
57327
+ return { ok: false, reason: `the file is not valid JSON (${err instanceof Error ? err.message : "parse failed"})` };
57328
+ }
57329
+ }
57330
+ const servers = doc[serversField];
57331
+ const table = servers !== void 0 && servers !== null && typeof servers === "object" && !Array.isArray(servers) ? { ...servers } : {};
57332
+ const next = { ...doc, [serversField]: { ...table, [key]: entry } };
57333
+ const content = `${JSON.stringify(next, null, 2)}
57334
+ `;
57335
+ const before = existing ?? "";
57336
+ return { ok: true, content, changed: content !== before };
57337
+ }
57338
+ function removeJsonServer(existing, key, serversField) {
57339
+ if (existing === null || existing.trim() === "") {
57340
+ return { ok: true, content: "", changed: false };
57341
+ }
57342
+ let doc;
57343
+ try {
57344
+ const parsed = JSON.parse(existing);
57345
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
57346
+ return { ok: false, reason: "the file is not a JSON object" };
57347
+ }
57348
+ doc = parsed;
57349
+ } catch {
57350
+ return { ok: false, reason: "the file is not valid JSON" };
57351
+ }
57352
+ const servers = doc[serversField];
57353
+ if (servers === void 0 || servers === null || typeof servers !== "object" || Array.isArray(servers)) {
57354
+ return { ok: true, content: existing, changed: false };
57355
+ }
57356
+ const table = { ...servers };
57357
+ if (!(key in table)) {
57358
+ return { ok: true, content: existing, changed: false };
57359
+ }
57360
+ const kept = Object.fromEntries(Object.entries(table).filter(([name]) => name !== key));
57361
+ const content = `${JSON.stringify({ ...doc, [serversField]: kept }, null, 2)}
57362
+ `;
57363
+ return { ok: true, content, changed: true };
57364
+ }
57365
+ function mergeTomlServer(existing, key, entry) {
57366
+ const header = `[mcp_servers.${key}]`;
57367
+ const block = renderTomlBlock(key, entry);
57368
+ const before = existing ?? "";
57369
+ if (before.trim() === "") {
57370
+ return { ok: true, content: block, changed: true };
57371
+ }
57372
+ if (/^\s*mcp_servers\s*=/m.test(before)) {
57373
+ return {
57374
+ ok: false,
57375
+ reason: "mcp_servers is written as an inline table, which this installer will not edit automatically"
57376
+ };
57377
+ }
57378
+ const start = findTableStart(before, header);
57379
+ if (start === -1) {
57380
+ const separator = before.endsWith("\n\n") ? "" : before.endsWith("\n") ? "\n" : "\n\n";
57381
+ return { ok: true, content: `${before}${separator}${block}`, changed: true };
57382
+ }
57383
+ const end = findTableEnd(before, start);
57384
+ const content = `${before.slice(0, start)}${block}${before.slice(end)}`;
57385
+ return { ok: true, content, changed: content !== before };
57386
+ }
57387
+ function removeTomlServer(existing, key) {
57388
+ if (existing === null || existing.trim() === "") {
57389
+ return { ok: true, content: "", changed: false };
57390
+ }
57391
+ const start = findTableStart(existing, `[mcp_servers.${key}]`);
57392
+ if (start === -1) {
57393
+ return { ok: true, content: existing, changed: false };
57394
+ }
57395
+ const end = findTableEnd(existing, start);
57396
+ return { ok: true, content: `${existing.slice(0, start)}${existing.slice(end)}`, changed: true };
57397
+ }
57398
+ function findTableStart(content, header) {
57399
+ const pattern = new RegExp(`^[ \\t]*${header.replace(/[.[\]]/g, "\\$&")}[ \\t]*$`, "m");
57400
+ return pattern.exec(content)?.index ?? -1;
57401
+ }
57402
+ function findTableEnd(content, start) {
57403
+ const rest = content.slice(start);
57404
+ const nextHeader = /\n[ \t]*\[/.exec(rest.slice(1));
57405
+ return nextHeader === null ? content.length : start + 1 + nextHeader.index + 1;
57406
+ }
57407
+ function renderTomlBlock(key, entry) {
57408
+ const lines = [
57409
+ `[mcp_servers.${key}]`,
57410
+ `command = ${JSON.stringify(entry.command)}`,
57411
+ `args = [${entry.args.map((a) => JSON.stringify(a)).join(", ")}]`
57412
+ ];
57413
+ if (entry.env !== void 0 && Object.keys(entry.env).length > 0) {
57414
+ lines.push(`[mcp_servers.${key}.env]`);
57415
+ for (const [name, value] of Object.entries(entry.env)) {
57416
+ lines.push(`${name} = ${JSON.stringify(value)}`);
57417
+ }
57418
+ }
57419
+ return `${lines.join("\n")}
57420
+ `;
57421
+ }
57422
+ var SECTION_START = "<!-- syntica:start -->";
57423
+ var SECTION_END = "<!-- syntica:end -->";
57424
+ function upsertMarkdownSection(existing, body) {
57425
+ const section = `${SECTION_START}
57426
+ ${body.trim()}
57427
+ ${SECTION_END}
57428
+ `;
57429
+ const before = existing ?? "";
57430
+ if (before.trim() === "") {
57431
+ return { ok: true, content: section, changed: true };
57432
+ }
57433
+ const start = before.indexOf(SECTION_START);
57434
+ const end = before.indexOf(SECTION_END);
57435
+ if (start !== -1 && end !== -1 && end > start) {
57436
+ const content = `${before.slice(0, start)}${section}${before.slice(end + SECTION_END.length + 1)}`;
57437
+ return { ok: true, content, changed: content !== before };
57438
+ }
57439
+ if (start !== -1 || end !== -1) {
57440
+ return { ok: false, reason: "the syntica section markers are incomplete \u2014 fix or remove them and re-run" };
57441
+ }
57442
+ const separator = before.endsWith("\n\n") ? "" : before.endsWith("\n") ? "\n" : "\n\n";
57443
+ return { ok: true, content: `${before}${separator}${section}`, changed: true };
57444
+ }
57445
+ function removeMarkdownSection(existing) {
57446
+ if (existing === null || existing.trim() === "") {
57447
+ return { ok: true, content: "", changed: false };
57448
+ }
57449
+ const start = existing.indexOf(SECTION_START);
57450
+ const end = existing.indexOf(SECTION_END);
57451
+ if (start === -1 || end === -1 || end < start) {
57452
+ return { ok: true, content: existing, changed: false };
57453
+ }
57454
+ const content = `${existing.slice(0, start).trimEnd()}
57455
+ ${existing.slice(end + SECTION_END.length + 1)}`.trimStart();
57456
+ return { ok: true, content, changed: true };
57457
+ }
57458
+
57459
+ // apps/mcp-server/src/cli/agents.ts
57315
57460
  var HOME = (0, import_os.homedir)();
57316
57461
  var PLUGIN_INSTALL_DIR = (0, import_path.join)(HOME, ".syntica", "plugin");
57317
- function run(cmd) {
57318
- (0, import_child_process.execSync)(cmd, { stdio: "inherit" });
57319
- }
57320
- function runSetup() {
57462
+ var SERVER = { command: "npx", args: ["-y", "@syntica/mcp"] };
57463
+ var SERVER_KEY = "syntica";
57464
+ function installSkills() {
57321
57465
  const skillsDir = (0, import_path.join)(__dirname, "..", "skills");
57322
57466
  if (!(0, import_fs.existsSync)(skillsDir)) {
57323
- console.warn(" Skills directory not found \u2014 plugin not installed.");
57324
- return;
57467
+ return false;
57325
57468
  }
57326
57469
  (0, import_fs.rmSync)(PLUGIN_INSTALL_DIR, { recursive: true, force: true });
57327
57470
  (0, import_fs.mkdirSync)(PLUGIN_INSTALL_DIR, { recursive: true });
57328
57471
  (0, import_fs.cpSync)(skillsDir, PLUGIN_INSTALL_DIR, { recursive: true });
57329
- console.log(`\u2713 Plugin files copied to ${PLUGIN_INSTALL_DIR}`);
57472
+ return true;
57473
+ }
57474
+ function applyMerge(path, result, what) {
57475
+ if (!result.ok) {
57476
+ return { ok: false, detail: `${path} left untouched \u2014 ${result.reason}. Add the server by hand, or fix the file and re-run.` };
57477
+ }
57478
+ if (!result.changed) {
57479
+ return { ok: true, detail: `${what} already registered` };
57480
+ }
57481
+ (0, import_fs.mkdirSync)((0, import_path.dirname)(path), { recursive: true });
57482
+ if ((0, import_fs.existsSync)(path)) {
57483
+ (0, import_fs.copyFileSync)(path, `${path}.bak`);
57484
+ }
57485
+ (0, import_fs.writeFileSync)(path, result.content, "utf8");
57486
+ return { ok: true, detail: `${what} written to ${path}` };
57487
+ }
57488
+ function readIfExists(path) {
57489
+ return (0, import_fs.existsSync)(path) ? (0, import_fs.readFileSync)(path, "utf8") : null;
57490
+ }
57491
+ function onPath(binary) {
57330
57492
  try {
57331
- run(`claude plugin marketplace add "${PLUGIN_INSTALL_DIR}"`);
57332
- run("claude plugin install syntica@syntica --scope user");
57333
- console.log("\u2713 Plugin installed via claude CLI");
57493
+ (0, import_child_process.execFileSync)(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
57494
+ return true;
57334
57495
  } catch {
57335
- console.warn(" Could not install plugin automatically. Run manually:");
57336
- console.warn(` claude plugin marketplace add "${PLUGIN_INSTALL_DIR}"`);
57337
- console.warn(" claude plugin install syntica@syntica");
57496
+ return false;
57497
+ }
57498
+ }
57499
+ var claude = {
57500
+ name: "claude",
57501
+ label: "Claude Code",
57502
+ detect: () => onPath("claude") || (0, import_fs.existsSync)((0, import_path.join)(HOME, ".claude")),
57503
+ install: () => {
57504
+ try {
57505
+ (0, import_child_process.execFileSync)("claude", ["plugin", "marketplace", "add", PLUGIN_INSTALL_DIR], { stdio: "inherit" });
57506
+ (0, import_child_process.execFileSync)("claude", ["plugin", "install", "syntica@syntica", "--scope", "user"], { stdio: "inherit" });
57507
+ return { ok: true, detail: "plugin installed (tools and skills)" };
57508
+ } catch {
57509
+ return {
57510
+ ok: false,
57511
+ detail: `could not run the claude CLI. Install by hand:
57512
+ claude plugin marketplace add "${PLUGIN_INSTALL_DIR}"
57513
+ claude plugin install syntica@syntica`
57514
+ };
57515
+ }
57516
+ },
57517
+ teardown: () => {
57518
+ try {
57519
+ (0, import_child_process.execFileSync)("claude", ["plugin", "uninstall", "syntica"], { stdio: "inherit" });
57520
+ return { ok: true, detail: "plugin removed" };
57521
+ } catch {
57522
+ return { ok: false, detail: "could not run the claude CLI \u2014 remove with: claude plugin uninstall syntica" };
57523
+ }
57524
+ }
57525
+ };
57526
+ var CODEX_CONFIG = (0, import_path.join)(HOME, ".codex", "config.toml");
57527
+ var CODEX_PROMPTS = (0, import_path.join)(HOME, ".codex", "prompts");
57528
+ var codex = {
57529
+ name: "codex",
57530
+ label: "Codex CLI",
57531
+ detect: () => onPath("codex") || (0, import_fs.existsSync)((0, import_path.join)(HOME, ".codex")),
57532
+ install: () => {
57533
+ const merged = applyMerge(CODEX_CONFIG, mergeTomlServer(readIfExists(CODEX_CONFIG), SERVER_KEY, SERVER), "MCP server");
57534
+ if (!merged.ok) {
57535
+ return merged;
57536
+ }
57537
+ const prompts = writeSkillPointers(CODEX_PROMPTS, ".md");
57538
+ return { ok: true, detail: `${merged.detail}; ${String(prompts)} skill prompt(s) written to ${CODEX_PROMPTS}` };
57539
+ },
57540
+ teardown: () => {
57541
+ const removed = applyMerge(CODEX_CONFIG, removeTomlServer(readIfExists(CODEX_CONFIG), SERVER_KEY), "MCP server");
57542
+ removeSkillPointers(CODEX_PROMPTS, ".md");
57543
+ return removed.ok ? { ok: true, detail: "MCP server and skill prompts removed" } : removed;
57544
+ }
57545
+ };
57546
+ var CURSOR_CONFIG = (0, import_path.join)(HOME, ".cursor", "mcp.json");
57547
+ var CURSOR_RULES = (0, import_path.join)(HOME, ".cursor", "rules", "syntica.mdc");
57548
+ var cursor = {
57549
+ name: "cursor",
57550
+ label: "Cursor",
57551
+ detect: () => (0, import_fs.existsSync)((0, import_path.join)(HOME, ".cursor")),
57552
+ install: () => {
57553
+ const merged = applyMerge(
57554
+ CURSOR_CONFIG,
57555
+ mergeJsonServer(readIfExists(CURSOR_CONFIG), SERVER_KEY, "mcpServers", SERVER),
57556
+ "MCP server"
57557
+ );
57558
+ if (!merged.ok) {
57559
+ return merged;
57560
+ }
57561
+ (0, import_fs.mkdirSync)((0, import_path.dirname)(CURSOR_RULES), { recursive: true });
57562
+ (0, import_fs.writeFileSync)(CURSOR_RULES, cursorRules(), "utf8");
57563
+ return { ok: true, detail: `${merged.detail}; rules written to ${CURSOR_RULES}` };
57564
+ },
57565
+ teardown: () => {
57566
+ const removed = applyMerge(
57567
+ CURSOR_CONFIG,
57568
+ removeJsonServer(readIfExists(CURSOR_CONFIG), SERVER_KEY, "mcpServers"),
57569
+ "MCP server"
57570
+ );
57571
+ (0, import_fs.rmSync)(CURSOR_RULES, { force: true });
57572
+ return removed.ok ? { ok: true, detail: "MCP server and rules removed" } : removed;
57573
+ }
57574
+ };
57575
+ var WINDSURF_DIR = (0, import_path.join)(HOME, ".codeium", "windsurf");
57576
+ var WINDSURF_CONFIG = (0, import_path.join)(WINDSURF_DIR, "mcp_config.json");
57577
+ var WINDSURF_RULES = (0, import_path.join)(WINDSURF_DIR, "memories", "global_rules.md");
57578
+ var windsurf = {
57579
+ name: "windsurf",
57580
+ label: "Windsurf",
57581
+ detect: () => (0, import_fs.existsSync)(WINDSURF_DIR),
57582
+ install: () => {
57583
+ const merged = applyMerge(
57584
+ WINDSURF_CONFIG,
57585
+ mergeJsonServer(readIfExists(WINDSURF_CONFIG), SERVER_KEY, "mcpServers", SERVER),
57586
+ "MCP server"
57587
+ );
57588
+ if (!merged.ok) {
57589
+ return merged;
57590
+ }
57591
+ const rules = applyMerge(WINDSURF_RULES, upsertMarkdownSection(readIfExists(WINDSURF_RULES), skillPointerMarkdown()), "skill rules");
57592
+ return rules.ok ? { ok: true, detail: `${merged.detail}; ${rules.detail}` } : rules;
57593
+ },
57594
+ teardown: () => {
57595
+ const removed = applyMerge(
57596
+ WINDSURF_CONFIG,
57597
+ removeJsonServer(readIfExists(WINDSURF_CONFIG), SERVER_KEY, "mcpServers"),
57598
+ "MCP server"
57599
+ );
57600
+ applyMerge(WINDSURF_RULES, removeMarkdownSection(readIfExists(WINDSURF_RULES)), "skill rules");
57601
+ return removed.ok ? { ok: true, detail: "MCP server and rules removed" } : removed;
57602
+ }
57603
+ };
57604
+ var GEMINI_CONFIG = (0, import_path.join)(HOME, ".gemini", "settings.json");
57605
+ var GEMINI_RULES = (0, import_path.join)(HOME, ".gemini", "GEMINI.md");
57606
+ var gemini = {
57607
+ name: "gemini",
57608
+ label: "Gemini CLI",
57609
+ detect: () => onPath("gemini") || (0, import_fs.existsSync)((0, import_path.join)(HOME, ".gemini")),
57610
+ install: () => {
57611
+ const merged = applyMerge(
57612
+ GEMINI_CONFIG,
57613
+ mergeJsonServer(readIfExists(GEMINI_CONFIG), SERVER_KEY, "mcpServers", SERVER),
57614
+ "MCP server"
57615
+ );
57616
+ if (!merged.ok) {
57617
+ return merged;
57618
+ }
57619
+ const rules = applyMerge(GEMINI_RULES, upsertMarkdownSection(readIfExists(GEMINI_RULES), skillPointerMarkdown()), "skill instructions");
57620
+ return rules.ok ? { ok: true, detail: `${merged.detail}; ${rules.detail}` } : rules;
57621
+ },
57622
+ teardown: () => {
57623
+ const removed = applyMerge(
57624
+ GEMINI_CONFIG,
57625
+ removeJsonServer(readIfExists(GEMINI_CONFIG), SERVER_KEY, "mcpServers"),
57626
+ "MCP server"
57627
+ );
57628
+ applyMerge(GEMINI_RULES, removeMarkdownSection(readIfExists(GEMINI_RULES)), "skill instructions");
57629
+ return removed.ok ? { ok: true, detail: "MCP server and instructions removed" } : removed;
57630
+ }
57631
+ };
57632
+ var COPILOT_CONFIG = (0, import_path.join)(HOME, ".copilot", "mcp-config.json");
57633
+ var COPILOT_RULES = (0, import_path.join)(HOME, ".copilot", "copilot-instructions.md");
57634
+ var copilot = {
57635
+ name: "copilot",
57636
+ label: "GitHub Copilot CLI",
57637
+ detect: () => onPath("copilot") || (0, import_fs.existsSync)((0, import_path.join)(HOME, ".copilot")),
57638
+ install: () => {
57639
+ const merged = applyMerge(
57640
+ COPILOT_CONFIG,
57641
+ mergeJsonServer(readIfExists(COPILOT_CONFIG), SERVER_KEY, "mcpServers", SERVER),
57642
+ "MCP server"
57643
+ );
57644
+ if (!merged.ok) {
57645
+ return merged;
57646
+ }
57647
+ const rules = applyMerge(COPILOT_RULES, upsertMarkdownSection(readIfExists(COPILOT_RULES), skillPointerMarkdown()), "skill instructions");
57648
+ return rules.ok ? { ok: true, detail: `${merged.detail}; ${rules.detail}` } : rules;
57649
+ },
57650
+ teardown: () => {
57651
+ const removed = applyMerge(
57652
+ COPILOT_CONFIG,
57653
+ removeJsonServer(readIfExists(COPILOT_CONFIG), SERVER_KEY, "mcpServers"),
57654
+ "MCP server"
57655
+ );
57656
+ applyMerge(COPILOT_RULES, removeMarkdownSection(readIfExists(COPILOT_RULES)), "skill instructions");
57657
+ return removed.ok ? { ok: true, detail: "MCP server and instructions removed" } : removed;
57658
+ }
57659
+ };
57660
+ var ADAPTERS = [claude, codex, cursor, windsurf, gemini, copilot];
57661
+ function detectAgents() {
57662
+ return ADAPTERS.filter((a) => a.detect());
57663
+ }
57664
+ var POINTER_PREFIX = "syntica-";
57665
+ var SKILLS = [
57666
+ { name: "onboard", summary: "set an existing project up on Syntica for the first time" },
57667
+ { name: "deploy", summary: "push code and deploy an application" },
57668
+ { name: "debug", summary: "inspect a running application: logs, containers, database" },
57669
+ { name: "connections", summary: "connect third-party services to an application" },
57670
+ { name: "manage", summary: "manage applications, environments and machine sizes" },
57671
+ { name: "security", summary: "review an application for security problems before shipping" },
57672
+ { name: "pre-commit-validation", summary: "run the platform validation prompts against staged changes" }
57673
+ ];
57674
+ function writeSkillPointers(dir, extension) {
57675
+ (0, import_fs.mkdirSync)(dir, { recursive: true });
57676
+ let written = 0;
57677
+ for (const skill of SKILLS) {
57678
+ const target = (0, import_path.join)(PLUGIN_INSTALL_DIR, "skills", skill.name, "SKILL.md");
57679
+ if (!(0, import_fs.existsSync)(target)) {
57680
+ continue;
57681
+ }
57682
+ const body = [
57683
+ `Read ${target} and follow it exactly.`,
57684
+ "",
57685
+ `That file is the Syntica "${skill.name}" skill: ${skill.summary}.`,
57686
+ "It uses the syntica MCP tools, which are registered in this agent already.",
57687
+ ""
57688
+ ].join("\n");
57689
+ (0, import_fs.writeFileSync)((0, import_path.join)(dir, `${POINTER_PREFIX}${skill.name}${extension}`), body, "utf8");
57690
+ written += 1;
57691
+ }
57692
+ return written;
57693
+ }
57694
+ function removeSkillPointers(dir, extension) {
57695
+ for (const skill of SKILLS) {
57696
+ (0, import_fs.rmSync)((0, import_path.join)(dir, `${POINTER_PREFIX}${skill.name}${extension}`), { force: true });
57697
+ }
57698
+ }
57699
+ function skillPointerMarkdown() {
57700
+ return [
57701
+ "# Syntica",
57702
+ "",
57703
+ "This machine has the Syntica MCP tools registered. When the user asks for",
57704
+ "something on this list, read the matching skill file first and follow it:",
57705
+ "",
57706
+ ...SKILLS.map((s) => `- **${s.summary}** \u2014 read \`${(0, import_path.join)(PLUGIN_INSTALL_DIR, "skills", s.name, "SKILL.md")}\``),
57707
+ "",
57708
+ "The skill files hold the exact order of tool calls, the authentication flow",
57709
+ "and the failure handling. Do not improvise around them."
57710
+ ].join("\n");
57711
+ }
57712
+ function cursorRules() {
57713
+ return [
57714
+ "---",
57715
+ "description: Syntica platform skills \u2014 read the named skill file before acting on a Syntica task",
57716
+ "alwaysApply: true",
57717
+ "---",
57718
+ "",
57719
+ skillPointerMarkdown(),
57720
+ ""
57721
+ ].join("\n");
57722
+ }
57723
+
57724
+ // apps/mcp-server/src/cli/setup.ts
57725
+ function parseSetupArgs(argv) {
57726
+ const agents = [];
57727
+ let all = false;
57728
+ for (let i = 0; i < argv.length; i += 1) {
57729
+ const arg = argv[i];
57730
+ if (arg === "--all") {
57731
+ all = true;
57732
+ continue;
57733
+ }
57734
+ if (arg === "--agent") {
57735
+ const value = argv[i + 1];
57736
+ if (value?.startsWith("--") === false) {
57737
+ agents.push(value);
57738
+ i += 1;
57739
+ }
57740
+ continue;
57741
+ }
57742
+ if (arg?.startsWith("--agent=") === true) {
57743
+ agents.push(arg.slice("--agent=".length));
57744
+ }
57745
+ }
57746
+ return { agents, all };
57747
+ }
57748
+ function selectAgents(options, available, detected) {
57749
+ if (options.all) {
57750
+ return { chosen: available, unknown: [] };
57751
+ }
57752
+ if (options.agents.length > 0) {
57753
+ const chosen = [];
57754
+ const unknown2 = [];
57755
+ for (const name of options.agents) {
57756
+ const adapter = available.find((a) => a.name === name);
57757
+ if (adapter === void 0) {
57758
+ unknown2.push(name);
57759
+ } else {
57760
+ chosen.push(adapter);
57761
+ }
57762
+ }
57763
+ return { chosen, unknown: unknown2 };
57338
57764
  }
57339
- console.log("\nSetup complete! Restart Claude Code to activate the syntica tools.");
57340
- console.log("Then use /syntica-onboard to get started.");
57341
- console.log("To remove everything later: claude plugin uninstall syntica");
57765
+ return { chosen: detected, unknown: [] };
57766
+ }
57767
+ function runSetup(argv = []) {
57768
+ const options = parseSetupArgs(argv);
57769
+ const { chosen, unknown: unknown2 } = selectAgents(options, ADAPTERS, detectAgents());
57770
+ for (const name of unknown2) {
57771
+ console.warn(` Unknown agent "${name}". Known agents: ${ADAPTERS.map((a) => a.name).join(", ")}`);
57772
+ }
57773
+ if (chosen.length === 0) {
57774
+ console.warn("No supported coding agent found on this machine.");
57775
+ console.warn(`Install one, or name it explicitly: npx @syntica/mcp setup --agent ${ADAPTERS.map((a) => a.name).join("|")}`);
57776
+ return;
57777
+ }
57778
+ if (!installSkills()) {
57779
+ console.warn(" Skills directory not found in this package \u2014 nothing installed.");
57780
+ return;
57781
+ }
57782
+ console.log(`\u2713 Skills installed to ${PLUGIN_INSTALL_DIR}`);
57783
+ let failures = 0;
57784
+ for (const adapter of chosen) {
57785
+ const result = adapter.install();
57786
+ if (result.ok) {
57787
+ console.log(`\u2713 ${adapter.label}: ${result.detail}`);
57788
+ } else {
57789
+ failures += 1;
57790
+ console.warn(` ${adapter.label}: ${result.detail}`);
57791
+ }
57792
+ }
57793
+ console.log("");
57794
+ console.log(failures === 0 ? "Setup complete. Restart your agent to pick up the tools." : "Setup finished with warnings above.");
57795
+ if (chosen.some((a) => a.name === "claude")) {
57796
+ console.log("In Claude Code, start with /syntica:onboard.");
57797
+ } else {
57798
+ console.log("Then ask it to set your project up on Syntica \u2014 it will use the onboard skill.");
57799
+ console.log("");
57800
+ console.log("Tip: Claude Code gets the fullest version of this \u2014 the skills become real");
57801
+ console.log(" commands there (/syntica:onboard, /syntica:deploy) rather than files your");
57802
+ console.log(" agent has to be pointed at. Install it and re-run setup to add it.");
57803
+ }
57804
+ console.log("To remove everything later: npx @syntica/mcp teardown");
57805
+ }
57806
+ function runTeardown(argv = []) {
57807
+ const options = parseSetupArgs(argv);
57808
+ const { chosen, unknown: unknown2 } = selectAgents(
57809
+ options.agents.length > 0 ? options : { ...options, all: true },
57810
+ ADAPTERS,
57811
+ detectAgents()
57812
+ );
57813
+ for (const name of unknown2) {
57814
+ console.warn(` Unknown agent "${name}". Known agents: ${ADAPTERS.map((a) => a.name).join(", ")}`);
57815
+ }
57816
+ for (const adapter of chosen) {
57817
+ const result = adapter.teardown();
57818
+ console.log(`${result.ok ? "\u2713" : " "} ${adapter.label}: ${result.detail}`);
57819
+ }
57820
+ console.log("");
57821
+ console.log(`The skills are still at ${PLUGIN_INSTALL_DIR} \u2014 delete that directory to remove them too.`);
57822
+ }
57823
+ function runClaudeSetup() {
57824
+ runSetup(["--agent", "claude"]);
57342
57825
  }
57343
57826
 
57344
57827
  // apps/mcp-server/src/cli/migrate.ts
@@ -57390,7 +57873,7 @@ function runMigrate() {
57390
57873
  console.log("No old vibetocloud plugin install found on this machine \u2014 nothing to remove.\n");
57391
57874
  }
57392
57875
  console.log("Installing the syntica plugin (skills + MCP server entry)...");
57393
- runSetup();
57876
+ runClaudeSetup();
57394
57877
  console.log("\nMigration complete.");
57395
57878
  console.log("The five /vibetocloud-* slash commands are now /syntica-*. Restart Claude Code to pick up the change.");
57396
57879
  console.log(`Your previous plugin files are kept at ${OLD_PLUGIN_BACKUP_DIR} until you delete it yourself.`);
@@ -57580,6 +58063,27 @@ function selectRegisteredTools(allTools2, options) {
57580
58063
  });
57581
58064
  }
57582
58065
 
58066
+ // apps/mcp-server/src/lib/skill-digest.generated.ts
58067
+ var EXPECTED_SKILL_SHA256 = "5a7affff15cd59d87f1c258b7247849998a34009bf3606fe9c1465fc4fd5f1fe";
58068
+
58069
+ // apps/mcp-server/src/lib/skill-integrity.ts
58070
+ var import_crypto3 = require("crypto");
58071
+ function skillDigest(content) {
58072
+ return (0, import_crypto3.createHash)("sha256").update(content, "utf-8").digest("hex");
58073
+ }
58074
+ function verifySkillContent(content, expected) {
58075
+ const actual = skillDigest(content);
58076
+ return actual === expected ? { ok: true } : { ok: false, actual };
58077
+ }
58078
+ function skillMismatchMessage(expected, actual) {
58079
+ return `[mcp-server] refusing to install: the downloaded skill does not match the digest published with this release.
58080
+ expected ${expected}
58081
+ received ${actual}
58082
+ Nothing has been written to .claude/commands/vibe.md.
58083
+ If the skill was updated server-side, upgrade and retry: npx @syntica/mcp@latest install
58084
+ If it was not, do not run the downloaded file \u2014 it would execute as a slash command with your full tool access.`;
58085
+ }
58086
+
57583
58087
  // libs/shared/src/types/gitConnection.ts
57584
58088
  var UpstreamRequestError = class extends Error {
57585
58089
  constructor(code, message, status) {
@@ -57829,7 +58333,7 @@ var import_common5 = __toESM(require_common2());
57829
58333
  var import_jsonwebtoken = __toESM(require_jsonwebtoken());
57830
58334
 
57831
58335
  // libs/shared/src/utils/auth-public-key.ts
57832
- var import_crypto3 = require("crypto");
58336
+ var import_crypto4 = require("crypto");
57833
58337
  var import_common3 = __toESM(require_common2());
57834
58338
  var AuthPublicKeyCache = class _AuthPublicKeyCache {
57835
58339
  constructor() {
@@ -57880,7 +58384,7 @@ var AuthPublicKeyCache = class _AuthPublicKeyCache {
57880
58384
  }
57881
58385
  /** SHA-256 of the PEM, for logging — never log the key material itself. */
57882
58386
  static fingerprint(key) {
57883
- return (0, import_crypto3.createHash)("sha256").update(key).digest("hex").slice(0, 16);
58387
+ return (0, import_crypto4.createHash)("sha256").update(key).digest("hex").slice(0, 16);
57884
58388
  }
57885
58389
  /**
57886
58390
  * A bad response must not cost us the key we already have. Serving a slightly
@@ -57899,7 +58403,7 @@ var AuthPublicKeyCache = class _AuthPublicKeyCache {
57899
58403
  /** Parse it rather than pattern-match it: a truncated or corrupted PEM can carry the header and still be unusable. */
57900
58404
  isUsablePublicKey(key) {
57901
58405
  try {
57902
- (0, import_crypto3.createPublicKey)(key);
58406
+ (0, import_crypto4.createPublicKey)(key);
57903
58407
  return true;
57904
58408
  } catch {
57905
58409
  return false;
@@ -58552,6 +59056,18 @@ var UserClient = class {
58552
59056
  patchMember(orgId, userId, patch) {
58553
59057
  return this.request("PATCH", `/organisations/${orgId}/members/${userId}`, patch);
58554
59058
  }
59059
+ /**
59060
+ * Hand an organisation to the platform's ordinary erasure path.
59061
+ *
59062
+ * Used by the beta sweep when an expired organisation has slept out its keep
59063
+ * window. Deliberately the same call a person makes, so destruction has one
59064
+ * audited, restorable implementation rather than a second one written for a
59065
+ * background job.
59066
+ */
59067
+ async scheduleOrgErasure(orgId) {
59068
+ const org = await this.request("POST", `/organisations/${orgId}/erase`, {});
59069
+ return org !== null;
59070
+ }
58555
59071
  listSuspendedOrgs(before) {
58556
59072
  return this.request(
58557
59073
  "GET",
@@ -58948,7 +59464,7 @@ var import_common11 = __toESM(require_common2());
58948
59464
  var logger = new import_common11.Logger("RateLimiter");
58949
59465
 
58950
59466
  // libs/shared/src/utils/session-store.ts
58951
- var import_crypto4 = require("crypto");
59467
+ var import_crypto5 = require("crypto");
58952
59468
 
58953
59469
  // libs/shared/src/notifications/registry.ts
58954
59470
  function v(vars, k) {
@@ -59173,6 +59689,24 @@ var NOTIFICATION_TYPES = {
59173
59689
  body: (x) => v(x, "summary"),
59174
59690
  target: () => null
59175
59691
  },
59692
+ // A demo that stops without warning reads as the platform breaking, and the
59693
+ // person who could have renewed it hears about it from a colleague asking why
59694
+ // the site is down.
59695
+ "beta.ending": {
59696
+ key: "beta.ending",
59697
+ category: "billing",
59698
+ severity: "warning",
59699
+ audience: "admins",
59700
+ // In-app only until there is a Contentful template for it. Defaulting email
59701
+ // on without one promises a mail that never arrives, which for a warning
59702
+ // about losing access is worse than not offering email at all.
59703
+ inAppDefault: true,
59704
+ emailDefault: false,
59705
+ emailTemplateId: null,
59706
+ title: (x) => `Your beta ends in ${v(x, "days")} days`,
59707
+ body: (x) => `On ${v(x, "endsOn")} your applications stop and your data is kept for two months. Contact us to keep going.`,
59708
+ target: () => "/settings/billing"
59709
+ },
59176
59710
  "app.unreachable": {
59177
59711
  key: "app.unreachable",
59178
59712
  category: "deploy",
@@ -60153,7 +60687,7 @@ var appDbAuditTool = {
60153
60687
  properties: {
60154
60688
  token: { type: "string", description: "JWT session token from org_verify_otp" },
60155
60689
  applicationId: { type: "string", description: "Application ID" },
60156
- environment: { type: "string", enum: [...ENVIRONMENT_NAMES] },
60690
+ environment: { type: "string", enum: [...ENVIRONMENT_NAMES], description: "Which environment: dev, staging or production" },
60157
60691
  service: { type: "string", description: "Optional: filter to one service" },
60158
60692
  limit: { type: "number", description: "Max entries (default 100, cap 1000)" }
60159
60693
  },
@@ -60757,7 +61291,7 @@ async function handleAppRestartInstance(args) {
60757
61291
  return failFromResponse(res, "Instance restart failed");
60758
61292
  }
60759
61293
  return {
60760
- content: [{ type: "text", text: "Instance restart initiated. Containers will be up shortly. Run /syntica-deploy to deploy your latest code once the instance is running." }]
61294
+ content: [{ type: "text", text: "Instance restart initiated. Containers will be up shortly. Run /syntica:deploy to deploy your latest code once the instance is running." }]
60761
61295
  };
60762
61296
  }
60763
61297
  var NODE_ACTION_SCHEMA = {
@@ -61297,7 +61831,7 @@ var appServiceStartTool = {
61297
61831
  properties: {
61298
61832
  token: { type: "string", description: "JWT session token from org_verify_otp" },
61299
61833
  applicationId: { type: "string", description: "Application ID" },
61300
- environment: { type: "string", enum: [...ENVIRONMENT_NAMES] },
61834
+ environment: { type: "string", enum: [...ENVIRONMENT_NAMES], description: "Which environment: dev, staging or production" },
61301
61835
  service: { type: "string", description: "Service name (from docker-compose)" }
61302
61836
  },
61303
61837
  required: ["token", "applicationId", "environment", "service"]
@@ -61312,7 +61846,7 @@ var appServiceStopTool = {
61312
61846
  properties: {
61313
61847
  token: { type: "string", description: "JWT session token from org_verify_otp" },
61314
61848
  applicationId: { type: "string", description: "Application ID" },
61315
- environment: { type: "string", enum: [...ENVIRONMENT_NAMES] },
61849
+ environment: { type: "string", enum: [...ENVIRONMENT_NAMES], description: "Which environment: dev, staging or production" },
61316
61850
  service: { type: "string", description: "Service name (from docker-compose)" }
61317
61851
  },
61318
61852
  required: ["token", "applicationId", "environment", "service"]
@@ -61327,7 +61861,7 @@ var appServiceRestartTool = {
61327
61861
  properties: {
61328
61862
  token: { type: "string", description: "JWT session token from org_verify_otp" },
61329
61863
  applicationId: { type: "string", description: "Application ID" },
61330
- environment: { type: "string", enum: [...ENVIRONMENT_NAMES] },
61864
+ environment: { type: "string", enum: [...ENVIRONMENT_NAMES], description: "Which environment: dev, staging or production" },
61331
61865
  service: { type: "string", description: "Service name (from docker-compose)" }
61332
61866
  },
61333
61867
  required: ["token", "applicationId", "environment", "service"]
@@ -61342,7 +61876,7 @@ var appServiceLogsTool = {
61342
61876
  properties: {
61343
61877
  token: { type: "string", description: "JWT session token from org_verify_otp" },
61344
61878
  applicationId: { type: "string", description: "Application ID" },
61345
- environment: { type: "string", enum: [...ENVIRONMENT_NAMES] },
61879
+ environment: { type: "string", enum: [...ENVIRONMENT_NAMES], description: "Which environment: dev, staging or production" },
61346
61880
  service: { type: "string", description: "Service name (from docker-compose)" },
61347
61881
  tail: { type: "number", description: "Number of log lines to return (default 100)" }
61348
61882
  },
@@ -61358,7 +61892,7 @@ var appServiceTailLogsTool = {
61358
61892
  properties: {
61359
61893
  token: { type: "string", description: "JWT session token from org_verify_otp" },
61360
61894
  applicationId: { type: "string", description: "Application ID" },
61361
- environment: { type: "string", enum: [...ENVIRONMENT_NAMES] },
61895
+ environment: { type: "string", enum: [...ENVIRONMENT_NAMES], description: "Which environment: dev, staging or production" },
61362
61896
  service: { type: "string", description: "Service name (from docker-compose)" },
61363
61897
  since: { type: "number", description: "Unix timestamp from a previous nextSince. Omit on first call." }
61364
61898
  },
@@ -61644,7 +62178,7 @@ var orgListTemplatesTool = {
61644
62178
  var orgApplyTemplateTool = {
61645
62179
  name: "org_apply_template",
61646
62180
  description: "Overwrite an existing application repository with a fresh template scaffold. All existing code in the repository will be replaced.",
61647
- annotations: { readOnlyHint: false, destructiveHint: false },
62181
+ annotations: { readOnlyHint: false, destructiveHint: true },
61648
62182
  inputSchema: {
61649
62183
  type: "object",
61650
62184
  properties: {
@@ -62142,6 +62676,12 @@ function createServer() {
62142
62676
  { name: config2.server.name, version: config2.server.version },
62143
62677
  { capabilities: { tools: {} } }
62144
62678
  );
62679
+ server.oninitialized = () => {
62680
+ const client3 = server.getClientVersion();
62681
+ if (client3 !== void 0) {
62682
+ console.error(`[mcp-server] client ${client3.name} ${client3.version}`);
62683
+ }
62684
+ };
62145
62685
  server.setRequestHandler(
62146
62686
  ListToolsRequestSchema,
62147
62687
  () => Promise.resolve({ tools: registeredTools.map((t) => t.definition) })
@@ -62255,6 +62795,11 @@ async function install() {
62255
62795
  process.exit(1);
62256
62796
  }
62257
62797
  const skillContent = await response.text();
62798
+ const verification = verifySkillContent(skillContent, EXPECTED_SKILL_SHA256);
62799
+ if (!verification.ok) {
62800
+ console.error(skillMismatchMessage(EXPECTED_SKILL_SHA256, verification.actual));
62801
+ process.exit(1);
62802
+ }
62258
62803
  const dir = (0, import_path4.join)(process.cwd(), ".claude", "commands");
62259
62804
  const target = (0, import_path4.join)(dir, "vibe.md");
62260
62805
  if ((0, import_fs4.existsSync)(target)) {
@@ -62291,7 +62836,11 @@ function generateMcpJson() {
62291
62836
  async function main() {
62292
62837
  const command = process.argv[2];
62293
62838
  if (command === "setup") {
62294
- runSetup();
62839
+ runSetup(process.argv.slice(3));
62840
+ return;
62841
+ }
62842
+ if (command === "teardown") {
62843
+ runTeardown(process.argv.slice(3));
62295
62844
  return;
62296
62845
  }
62297
62846
  if (command === "migrate") {