@ompo-design/mcp-server 0.1.11 → 0.1.12

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.
@@ -11,7 +11,7 @@ export type ApplyPlanFile = {
11
11
  layoutIntent?: string;
12
12
  };
13
13
  export type DomStructurePlan = {
14
- kind: 'dom.insert' | 'dom.move' | 'dom.delete' | 'dom.flexWrap';
14
+ kind: 'dom.insert' | 'dom.move' | 'dom.delete' | 'dom.flexWrap' | 'dom.iconReplace';
15
15
  summary: string;
16
16
  steps: string[];
17
17
  payload: Record<string, unknown>;
@@ -6,6 +6,7 @@ const OMPO_GLOSSARY = {
6
6
  domMove: `Ompo DOM move: reorder or reparent elements in source markup/components. Use movedElement anchors (tag, id, class, textSnippet) to find nodes. destinationChildren is the authoritative sibling order after the move — match this order in JSX/HTML or reorder mapped arrays. CSS alone cannot satisfy a dom.move.`,
7
7
  insertText: `Ompo text insert: the user added a new text block (usually <p>). insertedElement carries insertKind "text", a stable data-ompo-insert-id selector, and textSnippet for the current copy. Apply as markup or a text component at parent/index; check separate text operations for edits after insert.`,
8
8
  insertIcon: `Ompo icon insert: the user added an Iconify icon (span.ompo-insert-icon) or editable SVG. iconId is the Iconify name (e.g. lucide:home) when known. Prefer the project's icon library or @iconify/react with that id instead of inlining raw SVG when possible. Size, fill color, and stroke changes appear as style operations on the same stable data-ompo-insert-id or data-ompo-icon-id selector.`,
9
+ replaceIcon: `Ompo icon replace: the user swapped an existing icon/SVG to a different Iconify icon. Update the project's icon component or @iconify/react usage to the new iconId — do not only patch inline SVG unless the project already inlines icons.`,
9
10
  iconStroke: `Ompo icon/SVG stroke: iconStrokeWidth sets stroke-width on the inner SVG; iconStrokeColor sets stroke (often currentColor). Applies to inserted icons and native SVG elements selected in Ompo.`
10
11
  };
11
12
  function describeAnchor(anchor) {
@@ -73,6 +74,31 @@ function buildDomInsertPlan(operation) {
73
74
  }
74
75
  };
75
76
  }
77
+ function buildIconReplacePlan(operation) {
78
+ const steps = [];
79
+ if (operation.element) {
80
+ steps.push(`Locate icon element: ${describeAnchor(operation.element)} (selector: "${operation.selector}").`);
81
+ }
82
+ else {
83
+ steps.push(`Locate icon element "${operation.selector}" in source.`);
84
+ }
85
+ steps.push(OMPO_GLOSSARY.replaceIcon);
86
+ steps.push(`Set Iconify id to ${operation.iconId}.`);
87
+ if (operation.previousIconId) {
88
+ steps.push(`Previous icon id: ${operation.previousIconId}`);
89
+ }
90
+ return {
91
+ kind: 'dom.iconReplace',
92
+ summary: `Replace icon with ${operation.iconId}`,
93
+ steps,
94
+ payload: {
95
+ selector: operation.selector,
96
+ iconId: operation.iconId,
97
+ previousIconId: operation.previousIconId,
98
+ element: operation.element
99
+ }
100
+ };
101
+ }
76
102
  function formatChildOrder(children, movedSelector) {
77
103
  return children.map((child, index) => {
78
104
  const marker = child.selector === movedSelector ? ' ← moved element' : '';
@@ -341,6 +367,8 @@ function buildDomStructurePlan(operation) {
341
367
  return buildDomInsertPlan(operation);
342
368
  case 'dom.move':
343
369
  return buildDomMovePlan(operation);
370
+ case 'dom.iconReplace':
371
+ return buildIconReplacePlan(operation);
344
372
  case 'dom.delete':
345
373
  return {
346
374
  kind: 'dom.delete',
@@ -446,6 +474,7 @@ export function buildApplyPlan(bundle) {
446
474
  'For dom.move: destinationChildren is the structural snapshot of the final sibling order — match it in JSX/HTML or reorder mapped arrays.',
447
475
  'For dom.flexWrap: create a new wrapper, move matched children, then apply wrapperStyles.',
448
476
  'For dom.insert with insertKind text or icon: read ompoGlossary.insertText / insertIcon; use insertedElement anchors and iconId when applying.',
477
+ 'For dom.iconReplace: read ompoGlossary.replaceIcon; update the project icon to the new iconId.',
449
478
  'Use child anchors (tag, id, class, textSnippet, insertKind, iconId) to find elements in source when selectors are unstable.',
450
479
  'Prefer the smallest possible diff for each file.'
451
480
  ],
@@ -459,6 +488,7 @@ export function explainEdit(bundle) {
459
488
  const moveCount = bundle.operations.filter((operation) => operation.kind === 'dom.move').length;
460
489
  const textInsertCount = bundle.operations.filter((operation) => operation.kind === 'dom.insert' && operation.insertKind === 'text').length;
461
490
  const iconInsertCount = bundle.operations.filter((operation) => operation.kind === 'dom.insert' && operation.insertKind === 'icon').length;
491
+ const iconReplaceCount = bundle.operations.filter((operation) => operation.kind === 'dom.iconReplace').length;
462
492
  const domCount = bundle.operations.length - styleCount - textCount;
463
493
  const scopeLabel = bundle.scope.mode === 'subtree' && bundle.scope.rootLabel
464
494
  ? `${bundle.scope.rootLabel} and its children`
@@ -481,6 +511,9 @@ export function explainEdit(bundle) {
481
511
  if (iconInsertCount > 0) {
482
512
  lines.push(`${iconInsertCount} icon insert${iconInsertCount === 1 ? '' : 's'} — map iconId to project icons when possible`);
483
513
  }
514
+ if (iconReplaceCount > 0) {
515
+ lines.push(`${iconReplaceCount} icon replace${iconReplaceCount === 1 ? '' : 's'} — update iconId via domStructurePlans`);
516
+ }
484
517
  lines.push(`Source preview: ${bundle.source.url}`);
485
518
  return lines.join('\n');
486
519
  }
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import { getOmpoEditsStorePath } from './edits-path.js';
7
7
  import { readOmpoMcpSession } from './session.js';
8
8
  import { readMcpTokenBalance } from './tokens.js';
9
9
  const PACKAGE_NAME = '@ompo-design/mcp-server';
10
- const PACKAGE_VERSION = '0.1.11';
10
+ const PACKAGE_VERSION = '0.1.12';
11
11
  const SERVER_NAME = 'ompo';
12
12
  function resolveExecutable(name) {
13
13
  try {
@@ -187,7 +187,7 @@ async function runDoctor() {
187
187
  console.log('Edits: none yet (click Send in Ompo first)');
188
188
  }
189
189
  console.log('');
190
- console.log('If tools skip token usage, quit and reopen Claude Code to reload MCP v0.1.11+');
190
+ console.log('If tools skip token usage, quit and reopen Claude Code to reload MCP v0.1.12+');
191
191
  console.log('Global install: npx @ompo-design/mcp-server setup-global');
192
192
  }
193
193
  function printProjectNextSteps(projectRoot) {
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { getOmpoEditsStorePath } from './edits-path.js';
10
10
  import { McpTokenError } from './tokens.js';
11
11
  const server = new McpServer({
12
12
  name: 'ompo-mcp-server',
13
- version: '0.1.11'
13
+ version: '0.1.12'
14
14
  });
15
15
  function requireEditsStore() {
16
16
  const storePath = getOmpoEditsStorePath();
package/dist/types.d.ts CHANGED
@@ -38,6 +38,13 @@ export type DomDeleteOperation = {
38
38
  kind: 'dom.delete';
39
39
  selector: string;
40
40
  };
41
+ export type DomIconReplaceOperation = {
42
+ kind: 'dom.iconReplace';
43
+ selector: string;
44
+ iconId: string;
45
+ previousIconId?: string;
46
+ element?: ElementAnchor;
47
+ };
41
48
  export type ElementAnchor = {
42
49
  selector: string;
43
50
  tagName: string;
@@ -62,7 +69,7 @@ export type TextOperation = {
62
69
  textContent?: string;
63
70
  innerHTML?: string;
64
71
  };
65
- export type OmpoOperation = StyleOperation | DomInsertOperation | DomMoveOperation | DomDeleteOperation | DomFlexWrapOperation | TextOperation;
72
+ export type OmpoOperation = StyleOperation | DomInsertOperation | DomMoveOperation | DomDeleteOperation | DomIconReplaceOperation | DomFlexWrapOperation | TextOperation;
66
73
  export type OmpoEditBundle = {
67
74
  schemaVersion: number;
68
75
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ompo-design/mcp-server",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "MCP server for applying Ompo visual edits to a codebase",
5
5
  "type": "module",
6
6
  "license": "MIT",