@ompo-design/mcp-server 0.1.4 → 0.1.6

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.
@@ -1,7 +1,8 @@
1
1
  const OMPO_GLOSSARY = {
2
2
  gap: `Ompo "Gap" is the space between children inside a flex or grid container. Apply \`gap\` on the parent layout element (not on children). The parent needs \`display: flex\` or \`display: grid\`. Example: gap "16px" → CSS \`gap: 16px\` or Tailwind \`gap-4\`.`,
3
3
  fill: `Ompo "Fill" means an element should expand to consume free space inside its parent. Fill is NOT a CSS property — read \`widthMode: fill\` / \`heightMode: fill\` together with \`ensureParentFlex\`, \`flexGrow\`, \`flexShrink\`, \`flexBasis\`, and \`alignSelf\` on the same selector. Parent must be \`display: flex\`. Main axis (direction of flex): use \`flex: 1 1 0\` (grow/shrink/basis). Cross axis: use \`align-self: stretch\` and remove fixed width/height on that axis. If \`ensureParentFlex\` is present, make the parent a flex container with that direction first.`,
4
- fit: `Ompo "Fit" means size to content. Map \`widthMode: fit\` → \`width: fit-content\`, \`heightMode: fit\` → \`height: fit-content\` (or the project's equivalent).`
4
+ fit: `Ompo "Fit" means size to content. Map \`widthMode: fit\` → \`width: fit-content\`, \`heightMode: fit\` → \`height: fit-content\` (or the project's equivalent).`,
5
+ imageFill: `Ompo image background fill: copy the source file from \`backgroundImageSource\` into the project (e.g. public/images/), then set \`background-image\` to a project-relative url(), with \`background-size: cover\`, \`background-position: center\`, and \`background-repeat: no-repeat\`. Do not commit file:// URLs to source.`
5
6
  };
6
7
  function formatChangedValue(property, value) {
7
8
  const text = String(value);
@@ -103,6 +104,35 @@ function styleSuggestionForProperty(property, value, changed) {
103
104
  strategy: 'css-rule',
104
105
  notes: 'Supporting constraint for Ompo Fill sizing. max-width/max-height: none allows the element to grow.'
105
106
  };
107
+ case 'backgroundImageSource':
108
+ return {
109
+ property,
110
+ value: formatChangedValue(property, value),
111
+ strategy: 'component-markup',
112
+ notes: `${OMPO_GLOSSARY.imageFill} Read this file from the user's machine (${String(value)}), copy it into the repo, and reference the copied asset in CSS.`
113
+ };
114
+ case 'backgroundImage':
115
+ if (changed.backgroundImageSource) {
116
+ return {
117
+ property,
118
+ value: formatChangedValue(property, value),
119
+ strategy: 'css-rule',
120
+ notes: `${OMPO_GLOSSARY.imageFill} Apply after copying the file from backgroundImageSource.`
121
+ };
122
+ }
123
+ break;
124
+ case 'backgroundSize':
125
+ case 'backgroundPosition':
126
+ case 'backgroundRepeat':
127
+ if (changed.backgroundImageSource) {
128
+ return {
129
+ property,
130
+ value: formatChangedValue(property, value),
131
+ strategy: 'css-rule',
132
+ notes: `Part of Ompo image background fill (${OMPO_GLOSSARY.imageFill}).`
133
+ };
134
+ }
135
+ break;
106
136
  }
107
137
  return {
108
138
  property,
@@ -169,23 +199,32 @@ function buildDomStructurePlan(operation) {
169
199
  selector: operation.selector
170
200
  }
171
201
  };
172
- case 'dom.move':
202
+ case 'dom.move': {
203
+ const reordered = operation.fromParentSelector === operation.toParentSelector;
173
204
  return {
174
205
  kind: 'dom.move',
175
- summary: 'Move an existing element to a new parent',
206
+ summary: reordered
207
+ ? `Reorder element within parent "${operation.toParentSelector}"`
208
+ : `Move element to a new parent "${operation.toParentSelector}"`,
176
209
  steps: [
177
- `Locate element "${operation.selector}" in source using selector and surrounding structure.`,
178
- `Move it from "${operation.fromParentSelector}" (index ${operation.fromIndex}) to "${operation.toParentSelector}" at index ${operation.index}.`,
179
- 'Preserve the element’s content and non-Ompo styling.'
210
+ `Locate element "${operation.selector}" in source using selector, tag, id, class, or nearby text.`,
211
+ reordered
212
+ ? `Reorder it inside "${operation.toParentSelector}" from child index ${operation.fromIndex} to index ${operation.index}.`
213
+ : `Move it from "${operation.fromParentSelector}" (index ${operation.fromIndex}) to "${operation.toParentSelector}" at index ${operation.index}.`,
214
+ 'Update JSX/HTML/component structure in source — this is a markup change, not a CSS tweak.',
215
+ 'Preserve the element’s content and non-Ompo styling.',
216
+ 'If the project uses mapped lists or arrays, update item order in data when that drives rendering.'
180
217
  ],
181
218
  payload: {
182
219
  selector: operation.selector,
183
220
  fromParentSelector: operation.fromParentSelector,
184
221
  fromIndex: operation.fromIndex,
185
222
  toParentSelector: operation.toParentSelector,
186
- insertIndex: operation.index
223
+ insertIndex: operation.index,
224
+ reordered
187
225
  }
188
226
  };
227
+ }
189
228
  case 'dom.delete':
190
229
  return {
191
230
  kind: 'dom.delete',
@@ -278,6 +317,7 @@ export function buildApplyPlan(bundle) {
278
317
  'Read ompoGlossary.fill and ompoGlossary.gap before applying layout changes — Ompo terms are not literal CSS properties.',
279
318
  'When widthMode or heightMode is "fill", apply the grouped flex properties together (flexGrow, flexBasis, alignSelf, removed width/height) — do not set a fixed px width/height on the filled axis.',
280
319
  'Gap belongs on the flex/grid parent. Fill belongs on the child inside a flex parent.',
320
+ 'DOM moves are in domStructurePlans and domChanges — reorder or reparent elements in source markup/components, not just CSS.',
281
321
  'For dom.flexWrap: create a new wrapper, move matched children, then apply wrapperStyles.',
282
322
  'Use child anchors (tag, id, class, textSnippet) to find elements in source when selectors are unstable.',
283
323
  'Prefer the smallest possible diff for each file.'
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { editsStoreReady, listEdits, readEditBundle, recordEditApplied, recordEd
8
8
  import { getOmpoEditsStorePath } from './edits-path.js';
9
9
  const server = new McpServer({
10
10
  name: 'ompo-mcp-server',
11
- version: '0.1.4'
11
+ version: '0.1.6'
12
12
  });
13
13
  function requireEditsStore() {
14
14
  const storePath = getOmpoEditsStorePath();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ompo-design/mcp-server",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "MCP server for applying Ompo visual edits to a codebase",
5
5
  "type": "module",
6
6
  "license": "MIT",