memorix 0.3.2 → 0.3.4

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/cli/index.js CHANGED
@@ -2319,8 +2319,10 @@ var init_engine2 = __esm({
2319
2319
  }
2320
2320
  /**
2321
2321
  * Migrate workspace configs to a target agent format.
2322
+ * @param items — optional list of specific item names (MCP servers / skills) to sync.
2323
+ * When provided, only matching items are included. Omit to sync all.
2322
2324
  */
2323
- async migrate(target) {
2325
+ async migrate(target, items) {
2324
2326
  const scan = await this.scan();
2325
2327
  const result = {
2326
2328
  mcpServers: { scanned: [], generated: [] },
@@ -2328,11 +2330,14 @@ var init_engine2 = __esm({
2328
2330
  rules: { scanned: 0, generated: 0 },
2329
2331
  skills: { scanned: [], conflicts: [], copied: [], skipped: [] }
2330
2332
  };
2333
+ const itemFilter = items && items.length > 0 ? new Set(items.map((i) => i.toLowerCase())) : null;
2331
2334
  const allServers = /* @__PURE__ */ new Map();
2332
2335
  for (const servers of Object.values(scan.mcpConfigs)) {
2333
2336
  for (const s of servers) {
2334
2337
  if (!allServers.has(s.name)) {
2335
- allServers.set(s.name, s);
2338
+ if (!itemFilter || itemFilter.has(s.name.toLowerCase())) {
2339
+ allServers.set(s.name, s);
2340
+ }
2336
2341
  }
2337
2342
  }
2338
2343
  }
@@ -2363,7 +2368,7 @@ var init_engine2 = __esm({
2363
2368
  }
2364
2369
  } catch {
2365
2370
  }
2366
- result.skills.scanned = scan.skills;
2371
+ result.skills.scanned = itemFilter ? scan.skills.filter((sk) => itemFilter.has(sk.name.toLowerCase())) : scan.skills;
2367
2372
  result.skills.conflicts = scan.skillConflicts;
2368
2373
  return result;
2369
2374
  }
@@ -2486,8 +2491,8 @@ var init_engine2 = __esm({
2486
2491
  * - Auto-rollback on any failure
2487
2492
  * - Returns backup paths for manual rollback if needed
2488
2493
  */
2489
- async apply(target) {
2490
- const syncResult = await this.migrate(target);
2494
+ async apply(target, items) {
2495
+ const syncResult = await this.migrate(target, items);
2491
2496
  const applier = new WorkspaceSyncApplier();
2492
2497
  const filesToWrite = [
2493
2498
  ...syncResult.mcpServers.generated,
@@ -3062,6 +3067,31 @@ async function createMemorixServer(cwd) {
3062
3067
  }
3063
3068
  } catch {
3064
3069
  }
3070
+ let syncAdvisoryShown = false;
3071
+ let syncAdvisory = null;
3072
+ try {
3073
+ const engine = new WorkspaceSyncEngine(project.rootPath);
3074
+ const scan = await engine.scan();
3075
+ const lines = [];
3076
+ const totalMCP = Object.values(scan.mcpConfigs).reduce((sum, arr) => sum + arr.length, 0);
3077
+ const totalSkills = scan.skills.length;
3078
+ const totalRules = scan.rulesCount;
3079
+ const totalWorkflows = scan.workflows.length;
3080
+ if (totalMCP > 0 || totalSkills > 0 || totalRules > 0 || totalWorkflows > 0) {
3081
+ lines.push("", "---", "\u{1F504} **Cross-Agent Sync Available**");
3082
+ if (totalMCP > 0) lines.push(`- **${totalMCP} MCP server(s)** found across agents`);
3083
+ if (totalSkills > 0) lines.push(`- **${totalSkills} skill(s)** found across agents`);
3084
+ if (scan.skillConflicts.length > 0) lines.push(` \u26A0\uFE0F ${scan.skillConflicts.length} name conflict(s)`);
3085
+ if (totalRules > 0) lines.push(`- **${totalRules} rule(s)** found`);
3086
+ if (totalWorkflows > 0) lines.push(`- **${totalWorkflows} workflow(s)** found`);
3087
+ lines.push("");
3088
+ lines.push('Ask the user: "I found configs from other agents. Want me to sync them here?"');
3089
+ lines.push('Use `memorix_workspace_sync action="apply" target="<agent>"` to sync.');
3090
+ syncAdvisory = lines.join("\n");
3091
+ }
3092
+ console.error(`[memorix] Sync advisory: ${syncAdvisory ? "available" : "nothing to sync"}`);
3093
+ } catch {
3094
+ }
3065
3095
  const observationsFile = projectDir2 + "/observations.json";
3066
3096
  let reloadDebounce = null;
3067
3097
  try {
@@ -3160,11 +3190,16 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
3160
3190
  type,
3161
3191
  maxTokens
3162
3192
  });
3193
+ let text = result.formatted;
3194
+ if (!syncAdvisoryShown && syncAdvisory) {
3195
+ text += syncAdvisory;
3196
+ syncAdvisoryShown = true;
3197
+ }
3163
3198
  return {
3164
3199
  content: [
3165
3200
  {
3166
3201
  type: "text",
3167
- text: result.formatted
3202
+ text
3168
3203
  }
3169
3204
  ]
3170
3205
  };
@@ -3505,10 +3540,11 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
3505
3540
  description: 'Migrate your entire workspace environment between AI agents. Syncs MCP server configs, workflows, rules, and skills. Action "scan": detect all workspace configs. Action "migrate": generate configs for target agent (preview only). Action "apply": migrate AND write configs to disk with backup/rollback.',
3506
3541
  inputSchema: {
3507
3542
  action: z.enum(["scan", "migrate", "apply"]).describe('Action: "scan" to detect configs, "migrate" to preview, "apply" to write to disk'),
3508
- target: z.enum(AGENT_TARGETS).optional().describe("Target agent for migration (required for migrate)")
3543
+ target: z.enum(AGENT_TARGETS).optional().describe("Target agent for migration (required for migrate)"),
3544
+ items: z.array(z.string()).optional().describe('Selective sync: list specific MCP server or skill names to sync (e.g. ["figma-remote-mcp-server", "create-subagent"]). Omit to sync all.')
3509
3545
  }
3510
3546
  },
3511
- async ({ action, target }) => {
3547
+ async ({ action, target, items }) => {
3512
3548
  const engine = new WorkspaceSyncEngine(project.rootPath);
3513
3549
  if (action === "scan") {
3514
3550
  const scan = await engine.scan();
@@ -3557,13 +3593,13 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
3557
3593
  };
3558
3594
  }
3559
3595
  if (action === "apply") {
3560
- const applyResult = await engine.apply(target);
3596
+ const applyResult = await engine.apply(target, items);
3561
3597
  return {
3562
3598
  content: [{ type: "text", text: applyResult.migrationSummary }],
3563
3599
  ...applyResult.success ? {} : { isError: true }
3564
3600
  };
3565
3601
  }
3566
- const result = await engine.migrate(target);
3602
+ const result = await engine.migrate(target, items);
3567
3603
  const lines = [
3568
3604
  `## Workspace Migration \u2192 ${target}`,
3569
3605
  ""