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 +46 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +46 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2606,8 +2606,10 @@ var WorkspaceSyncEngine = class _WorkspaceSyncEngine {
|
|
|
2606
2606
|
}
|
|
2607
2607
|
/**
|
|
2608
2608
|
* Migrate workspace configs to a target agent format.
|
|
2609
|
+
* @param items — optional list of specific item names (MCP servers / skills) to sync.
|
|
2610
|
+
* When provided, only matching items are included. Omit to sync all.
|
|
2609
2611
|
*/
|
|
2610
|
-
async migrate(target) {
|
|
2612
|
+
async migrate(target, items) {
|
|
2611
2613
|
const scan = await this.scan();
|
|
2612
2614
|
const result = {
|
|
2613
2615
|
mcpServers: { scanned: [], generated: [] },
|
|
@@ -2615,11 +2617,14 @@ var WorkspaceSyncEngine = class _WorkspaceSyncEngine {
|
|
|
2615
2617
|
rules: { scanned: 0, generated: 0 },
|
|
2616
2618
|
skills: { scanned: [], conflicts: [], copied: [], skipped: [] }
|
|
2617
2619
|
};
|
|
2620
|
+
const itemFilter = items && items.length > 0 ? new Set(items.map((i) => i.toLowerCase())) : null;
|
|
2618
2621
|
const allServers = /* @__PURE__ */ new Map();
|
|
2619
2622
|
for (const servers of Object.values(scan.mcpConfigs)) {
|
|
2620
2623
|
for (const s of servers) {
|
|
2621
2624
|
if (!allServers.has(s.name)) {
|
|
2622
|
-
|
|
2625
|
+
if (!itemFilter || itemFilter.has(s.name.toLowerCase())) {
|
|
2626
|
+
allServers.set(s.name, s);
|
|
2627
|
+
}
|
|
2623
2628
|
}
|
|
2624
2629
|
}
|
|
2625
2630
|
}
|
|
@@ -2650,7 +2655,7 @@ var WorkspaceSyncEngine = class _WorkspaceSyncEngine {
|
|
|
2650
2655
|
}
|
|
2651
2656
|
} catch {
|
|
2652
2657
|
}
|
|
2653
|
-
result.skills.scanned = scan.skills;
|
|
2658
|
+
result.skills.scanned = itemFilter ? scan.skills.filter((sk) => itemFilter.has(sk.name.toLowerCase())) : scan.skills;
|
|
2654
2659
|
result.skills.conflicts = scan.skillConflicts;
|
|
2655
2660
|
return result;
|
|
2656
2661
|
}
|
|
@@ -2773,8 +2778,8 @@ var WorkspaceSyncEngine = class _WorkspaceSyncEngine {
|
|
|
2773
2778
|
* - Auto-rollback on any failure
|
|
2774
2779
|
* - Returns backup paths for manual rollback if needed
|
|
2775
2780
|
*/
|
|
2776
|
-
async apply(target) {
|
|
2777
|
-
const syncResult = await this.migrate(target);
|
|
2781
|
+
async apply(target, items) {
|
|
2782
|
+
const syncResult = await this.migrate(target, items);
|
|
2778
2783
|
const applier = new WorkspaceSyncApplier();
|
|
2779
2784
|
const filesToWrite = [
|
|
2780
2785
|
...syncResult.mcpServers.generated,
|
|
@@ -2888,6 +2893,31 @@ async function createMemorixServer(cwd) {
|
|
|
2888
2893
|
}
|
|
2889
2894
|
} catch {
|
|
2890
2895
|
}
|
|
2896
|
+
let syncAdvisoryShown = false;
|
|
2897
|
+
let syncAdvisory = null;
|
|
2898
|
+
try {
|
|
2899
|
+
const engine = new WorkspaceSyncEngine(project.rootPath);
|
|
2900
|
+
const scan = await engine.scan();
|
|
2901
|
+
const lines = [];
|
|
2902
|
+
const totalMCP = Object.values(scan.mcpConfigs).reduce((sum, arr) => sum + arr.length, 0);
|
|
2903
|
+
const totalSkills = scan.skills.length;
|
|
2904
|
+
const totalRules = scan.rulesCount;
|
|
2905
|
+
const totalWorkflows = scan.workflows.length;
|
|
2906
|
+
if (totalMCP > 0 || totalSkills > 0 || totalRules > 0 || totalWorkflows > 0) {
|
|
2907
|
+
lines.push("", "---", "\u{1F504} **Cross-Agent Sync Available**");
|
|
2908
|
+
if (totalMCP > 0) lines.push(`- **${totalMCP} MCP server(s)** found across agents`);
|
|
2909
|
+
if (totalSkills > 0) lines.push(`- **${totalSkills} skill(s)** found across agents`);
|
|
2910
|
+
if (scan.skillConflicts.length > 0) lines.push(` \u26A0\uFE0F ${scan.skillConflicts.length} name conflict(s)`);
|
|
2911
|
+
if (totalRules > 0) lines.push(`- **${totalRules} rule(s)** found`);
|
|
2912
|
+
if (totalWorkflows > 0) lines.push(`- **${totalWorkflows} workflow(s)** found`);
|
|
2913
|
+
lines.push("");
|
|
2914
|
+
lines.push('Ask the user: "I found configs from other agents. Want me to sync them here?"');
|
|
2915
|
+
lines.push('Use `memorix_workspace_sync action="apply" target="<agent>"` to sync.');
|
|
2916
|
+
syncAdvisory = lines.join("\n");
|
|
2917
|
+
}
|
|
2918
|
+
console.error(`[memorix] Sync advisory: ${syncAdvisory ? "available" : "nothing to sync"}`);
|
|
2919
|
+
} catch {
|
|
2920
|
+
}
|
|
2891
2921
|
const observationsFile = projectDir2 + "/observations.json";
|
|
2892
2922
|
let reloadDebounce = null;
|
|
2893
2923
|
try {
|
|
@@ -2986,11 +3016,16 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
|
|
|
2986
3016
|
type,
|
|
2987
3017
|
maxTokens
|
|
2988
3018
|
});
|
|
3019
|
+
let text = result.formatted;
|
|
3020
|
+
if (!syncAdvisoryShown && syncAdvisory) {
|
|
3021
|
+
text += syncAdvisory;
|
|
3022
|
+
syncAdvisoryShown = true;
|
|
3023
|
+
}
|
|
2989
3024
|
return {
|
|
2990
3025
|
content: [
|
|
2991
3026
|
{
|
|
2992
3027
|
type: "text",
|
|
2993
|
-
text
|
|
3028
|
+
text
|
|
2994
3029
|
}
|
|
2995
3030
|
]
|
|
2996
3031
|
};
|
|
@@ -3331,10 +3366,11 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
|
|
|
3331
3366
|
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.',
|
|
3332
3367
|
inputSchema: {
|
|
3333
3368
|
action: z.enum(["scan", "migrate", "apply"]).describe('Action: "scan" to detect configs, "migrate" to preview, "apply" to write to disk'),
|
|
3334
|
-
target: z.enum(AGENT_TARGETS).optional().describe("Target agent for migration (required for migrate)")
|
|
3369
|
+
target: z.enum(AGENT_TARGETS).optional().describe("Target agent for migration (required for migrate)"),
|
|
3370
|
+
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.')
|
|
3335
3371
|
}
|
|
3336
3372
|
},
|
|
3337
|
-
async ({ action, target }) => {
|
|
3373
|
+
async ({ action, target, items }) => {
|
|
3338
3374
|
const engine = new WorkspaceSyncEngine(project.rootPath);
|
|
3339
3375
|
if (action === "scan") {
|
|
3340
3376
|
const scan = await engine.scan();
|
|
@@ -3383,13 +3419,13 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
|
|
|
3383
3419
|
};
|
|
3384
3420
|
}
|
|
3385
3421
|
if (action === "apply") {
|
|
3386
|
-
const applyResult = await engine.apply(target);
|
|
3422
|
+
const applyResult = await engine.apply(target, items);
|
|
3387
3423
|
return {
|
|
3388
3424
|
content: [{ type: "text", text: applyResult.migrationSummary }],
|
|
3389
3425
|
...applyResult.success ? {} : { isError: true }
|
|
3390
3426
|
};
|
|
3391
3427
|
}
|
|
3392
|
-
const result = await engine.migrate(target);
|
|
3428
|
+
const result = await engine.migrate(target, items);
|
|
3393
3429
|
const lines = [
|
|
3394
3430
|
`## Workspace Migration \u2192 ${target}`,
|
|
3395
3431
|
""
|