Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
663cf74
fix(skills): site-to-figma-components - follow the built template com…
ZaredRogers Nov 5, 2026
7c23c7b
docs(skills): figma-to-block-theme - handle manifest overrides and ex…
ZaredRogers Nov 5, 2026
05ef493
fix(skills): validate Figma composition and preserve text overrides w…
coderabbitai[bot] Nov 6, 2026
120918a
fix(skills): site-to-figma-components - tidy CodeRabbit autofix and f…
ZaredRogers Nov 6, 2026
fadcd3a
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
a7a6977
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
e31a176
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
147bdf1
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
91b5783
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
b3cf720
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
f4ccf19
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
91ad19f
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
de7604e
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
f8d9947
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
26c28b8
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
b14b1dc
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
cb5d6d1
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 9, 2026
6a0cbff
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 11, 2026
097bd79
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 18, 2026
4ba842c
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 18, 2026
05e65fe
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 18, 2026
f3b5744
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 18, 2026
5b30ee7
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 18, 2026
1dd228c
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 18, 2026
7c409de
Merge branch 'develop' into aiops/git-2754-manifest-composition
lightspeed-docs-bot[bot] Nov 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **Site to Figma Components Manifest** — Templates now follow the sections built in Figma, keep each section's own text and flag files already in the theme. ([#3992](https://github.com/lightspeedwp/.github/issues/3992))
- **Label inventory token** — The organisation label inventory now needs its own dedicated token, refuses the GitHub Actions token and fails when private repositories are missing. (#3734)
- **Private Repositories Stay Out Of Public Reports** — The label inventory and the weekly drift report now count private repositories without naming them or listing their labels. Detail goes to a private repository when one is set. (#3734)
- **Dependabot Merge Queue Fixed** — Dependabot pull requests no longer fail the Mergify queue check, because the queue now tests each pull request in place. ([PR #3817](https://github.com/lightspeedwp/.github/pull/3817))
Expand Down
16 changes: 12 additions & 4 deletions skills/figma-to-block-theme/references/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,18 @@ Show this, then ask `Approve this plan and proceed with implementation?`:

A rebuild that ran `site-to-figma-components` hands over `manifest.json`. Use it instead of choosing nodes, names and targets by hand:

1. Work through `entries` in order: components, template parts, patterns, then templates, so styles exist before the patterns that use them. Skip `skipped` entries.
2. For each entry, read `figma.nodeId` (and `figma.mobileNodeId` for the 390px layout) through `figma-design-to-code`, then follow steps 2 to 9 above.
3. Use the targets as given: `wordpress.file` as the path, `wordpress.slug` as the pattern or part slug, `wordpress.block` as the main block, and `wordpress.styles` as the block styles to create. The plan can question a target, but don't rename silently.
4. Write templates last, from `composition`: `<!-- wp:template-part {"slug":"header"} /-->` for parts, `<!-- wp:pattern {"slug":"<theme>/<slug>"} /-->` for patterns, and inline blocks for `local` entries.
1. Run Variables mode first if the Figma variables changed during the build. The design context names presets such as a new font family, and they must exist in `theme.json` before a pattern uses them.
2. Work through `entries` in order: components, template parts, patterns, then templates, so styles exist before the patterns that use them. Skip `skipped` entries, and read `warnings` into the plan.
3. For each entry, read `figma.nodeId` (and `figma.mobileNodeId` for the 390px layout) through `figma-design-to-code`, then follow steps 2 to 9 above. If the Figma server asks whether to set up Code Connect, put the question to the user once for the whole manifest; don't stop at each entry.
4. Use the targets as given: `wordpress.file` as the path, `wordpress.slug` as the pattern or part slug, `wordpress.block` as the main block, and `wordpress.styles` as the block styles to create. The plan can question a target, but don't rename silently.
5. When `wordpress.existsInTheme` is set, the file already holds something else (often a scaffold pattern with the same slug). The plan says whether to replace it or rename the new one. Never leave the old file in place and reference it from a template.
6. Write templates last, from `composition`:
- `<!-- wp:template-part {"slug":"header","tagName":"header"} /-->` for the header part
- `<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->` for the footer part; use each part's matching landmark tag
- `<!-- wp:pattern {"slug":"<theme>/<slug>"} /-->` for patterns without `overrides`
- the pattern's blocks inline, with every override value applied to its matching text, for an instance with `overrides` (a pattern reference can't change its content, so four card grids would otherwise share one heading)
- inline blocks for `local` entries
- everything between the header and footer parts wrapped in `<!-- wp:group {"tagName":"main"} -->`, so the template has a main landmark

## Checklist

Expand Down
4 changes: 2 additions & 2 deletions skills/site-to-figma-components/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ Compare each frame with the live page at both widths, list the differences, and

```bash
npx --prefix "$SITE_TO_FIGMA_REPO_ROOT" tsx ${CLAUDE_SKILL_DIR}/scripts/write-manifest.ts inventory.json --nodes figma-nodes.json \
--out manifest.json --markdown manifest.md
--out manifest.json --markdown manifest.md --theme-dir path/to/theme
```

Add `--partial` while only some items are built. Hand `manifest.json` to `figma-to-block-theme` Pattern mode and post `manifest.md` on the project's Linear issue. See [references/manifest.md](references/manifest.md).
Record each template's built `composition` first (see [references/figma-build.md](references/figma-build.md#record-node-ids)). `--theme-dir` flags targets that already exist in the theme. Add `--partial` while only some items are built. Hand `manifest.json` to `figma-to-block-theme` Pattern mode and post `manifest.md` on the project's Linear issue. See [references/manifest.md](references/manifest.md).

## Rules

Expand Down
27 changes: 27 additions & 0 deletions skills/site-to-figma-components/references/figma-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,33 @@ Use real site content throughout: headings, labels, excerpts, meta and images fr

After each call, add the IDs to `figma-nodes.json`: the component set for components; the set and its `Breakpoint=Mobile` variant (`mobileNodeId`) for parts and patterns; the 1440 frame and the 390 frame for templates. See [manifest.md](manifest.md).

When a template is final, record its `composition` with one read-only call. Each built component's description names its inventory ID (`Inventory id pattern:card-grid`), so the sections map back without guessing:

```js
const frame = await figma.getNodeByIdAsync('TEMPLATE_FRAME_ID');
const out = [];
for (const child of frame.children) {
if (child.type !== 'INSTANCE') { out.push({ id: `local:${child.name}` }); continue; }
const main = await child.getMainComponentAsync();
if (!main) { out.push({ id: `unknown:${child.id}` }); continue; }
const owner = main.parent?.type === 'COMPONENT_SET' ? main.parent : main;
const id = /Inventory id ([\w:-]+)/.exec(owner.description)?.[1] ?? `unknown:${owner.name}`;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
const overrides = {};
const definitions = owner.componentPropertyDefinitions;
for (const [name, property] of Object.entries(child.componentProperties)) {
if (property.type === 'TEXT' && property.value !== definitions[name]?.defaultValue) {
overrides[name] = property.value;
}
}
out.push(Object.keys(overrides).length ? { id, overrides } : id);
}
return out;
```

Expose every overridable text node as a `TEXT` component property, including nested text needed by templates. Compare all exposed text properties with their source defaults and keep the full property names (including Figma's ID suffix) as override keys, so repeated labels stay distinct. Pattern mode must apply every recorded value to its matching property when writing inline blocks.

Resolve any `unknown:` or `local:` entry before writing the manifest. An instance whose main component is unavailable is recorded as `unknown:<instance ID>` for review; the scan continues. Resolve local sections to identified inventory items (cut items remain local in the manifest).

## Archive, never delete

`node.remove()` is blocked. Move superseded items to an archive page, grouped in sections, and check the destinations of prototype links before moving anything.
27 changes: 23 additions & 4 deletions skills/site-to-figma-components/references/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,25 @@ Assemble it from the IDs each `use_figma` build call returns:
"nodes": {
"component:button": { "nodeId": "14100:200", "page": "> Components" },
"part:header": { "nodeId": "14100:310", "mobileNodeId": "14100:340" },
"template:single-tour": { "nodeId": "14101:12", "mobileNodeId": "14101:900" }
"template:front-page": {
"nodeId": "14101:12",
"mobileNodeId": "14101:900",
"composition": [
"part:header",
"pattern:hero",
{ "id": "pattern:card-grid", "overrides": { "heading": "Our Safari Styles" } },
{ "id": "pattern:card-grid", "overrides": { "heading": "Featured Tours" } },
"part:footer"
]
}
}
}
```

Use the component set's ID for components, and the 1440px frame (`nodeId`) and 390px frame (`mobileNodeId`) for parts, patterns and templates.

For each template, record `composition`: the built frame's sections in order, read from Figma with the snippet in [figma-build.md](figma-build.md#record-node-ids). The manifest follows it rather than the crawl, because the reviewer may have dropped or added sections. An entry is an inventory ID, or `{ id, overrides }` when the instance's text properties differ from the pattern's defaults. `overrides` holds every changed `TEXT` property, keyed by its full Figma property name. The writer refuses any ID that isn't in the inventory, including `unknown:` and `local:` entries, so resolve them first.

## manifest.json

```json
Expand All @@ -45,6 +57,7 @@ Use the component set's ID for components, and the 1440px frame (`nodeId`) and 3
"composition": [
{ "id": "part:header", "target": "template-part", "slug": "header", "file": "parts/header.html" },
{ "id": "pattern:hero", "target": "pattern", "slug": "tsp-theme/hero", "file": "patterns/hero.php" },
{ "id": "pattern:card-grid", "target": "pattern", "slug": "tsp-theme/card-grid", "file": "patterns/card-grid.php", "instance": 1, "overrides": { "heading": "Our Safari Styles" } },
{ "id": "pattern:map", "target": "local" }
]
}
Expand All @@ -54,10 +67,16 @@ Use the component set's ID for components, and the 1440px frame (`nodeId`) and 3
}
```

Entries are ordered components, template parts, patterns, then templates, so styles exist before the patterns that use them. `variantProperties` is included for items with variants. A composition entry marked `local` is a section the reviewer cut: build it inline in the template.
Entries are ordered components, template parts, patterns, then templates, so styles exist before the patterns that use them. `variantProperties` is included for items with variants. A composition entry marked `local` is a section the reviewer cut: build it inline in the template. `instance` numbers a pattern that appears more than once, and `overrides` holds that instance's own text. `wordpress.existsInTheme` is set when `--theme-dir` finds the target file already in the theme.

The writer refuses an unapproved inventory, a node ID not in the form `123:456`, and (without `--partial`) any item with no node. It warns about:

The writer refuses an unapproved inventory, a node ID not in the form `123:456`, and (without `--partial`) any item with no node. It warns about nodes for cut or unknown items, and about templates that change at 390px but have no mobile frame.
- nodes for cut or unknown items
- templates that change at 390px but have no mobile frame
- templates with no recorded `composition` (the crawled order is used instead)
- a built composition that differs from the live page, item by item or in section order (list each for the reviewer)
- targets that already exist in the theme (with `--theme-dir`)

## How Pattern mode uses it

`figma-to-block-theme` Pattern mode reads `manifest.json` in entry order. For each entry it reads the node with `figma-design-to-code`, writes the file named in `wordpress.file`, and uses `wordpress.slug`, `block` and `styles` as given. Templates are written last, from their `composition`: `<!-- wp:template-part {"slug":"header"} /-->` for parts and `<!-- wp:pattern {"slug":"tsp-theme/hero"} /-->` for patterns.
`figma-to-block-theme` Pattern mode reads `manifest.json` in entry order. For each entry it reads the node with `figma-design-to-code`, writes the file named in `wordpress.file`, and uses `wordpress.slug`, `block` and `styles` as given. Templates are written last, from their `composition`: `<!-- wp:template-part {"slug":"header","tagName":"header"} /-->` for parts, with each part's own landmark tag and `<!-- wp:pattern {"slug":"tsp-theme/hero"} /-->` for patterns. An instance with `overrides` is written inline, because a theme pattern reference can't change its text. A target that `existsInTheme` is replaced or renamed after review, never reused as it is.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Run `audit-design-system` on the build page, or this read-only scan through `use
| Auto Layout padding and gaps | Each non-zero value has a bound variable |
| Corner radius | Each non-zero radius is bound (component set containers set to 0) |
| Text | Every text node has a `textStyleId`; no mixed styles |
| Clipped text | No text is taller than a fixed-height parent that clips content (typical when a heading wraps at 390px); set the parent to hug |
| Effects | Every effect uses an effect style |
| Detached instances | No frame carries a component's name; every template instance has a `mainComponent` |
| Templates | Every direct child of a template frame is an instance |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { runInNewContext } from 'node:vm';

// Exercise the documented read-only scan against synthetic Figma nodes.
const guide = readFileSync(
join(process.cwd(), 'skills/site-to-figma-components/references/figma-build.md'),
'utf8'
);
const snippet = /```js\n([\s\S]*?)\n```/.exec(guide)![1];

describe('documented composition scan', () => {
it('continues after an unresolved instance and records every changed text property', async () => {
const owner = {
type: 'COMPONENT_SET',
description: 'Inventory id pattern:cards',
componentPropertyDefinitions: {
'Heading#1': { defaultValue: 'Heading' },
'Body#2': { defaultValue: 'Body' },
'Link#3': { defaultValue: 'Link' },
},
};
const main = { parent: owner };
const instance = {
type: 'INSTANCE',
getMainComponentAsync: async () => main,
componentProperties: {
'Heading#1': { type: 'TEXT', value: 'Heading' },
'Body#2': { type: 'TEXT', value: 'New body' },
'Link#3': { type: 'TEXT', value: '' },
Visible: { type: 'BOOLEAN', value: false },
},
};
const children = [
{ type: 'INSTANCE', id: '1:2', getMainComponentAsync: async () => null },
instance,
{
...instance,
getMainComponentAsync: async () => ({ ...owner, parent: null }),
componentProperties: {},
},
{ type: 'FRAME', name: 'Custom' },
];
const out = await runInNewContext(`(async () => { ${snippet} })()`, {
figma: { getNodeByIdAsync: async () => ({ children }) },
});
expect(out).toEqual([
{ id: 'unknown:1:2' },
{ id: 'pattern:cards', overrides: { 'Body#2': 'New body', 'Link#3': '' } },
'pattern:cards',
{ id: 'local:Custom' },
]);
});
});
Loading
Loading