Skip to content

Commit 71e8e92

Browse files
committed
fix: document safe template default editing
1 parent 1e11608 commit 71e8e92

9 files changed

Lines changed: 36 additions & 0 deletions

File tree

packages/cli/src/registry/registryBlocks.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ describe("registry blocks", () => {
6262

6363
expect(contractFiles, templateId).toHaveLength(1);
6464
expect(composition, templateId).toBeDefined();
65+
const editingContract = readFileSync(join(itemDir, "TEMPLATE.md"), "utf8");
66+
expect(editingContract, templateId).toContain("## Safe editing mechanics");
67+
expect(editingContract, templateId).toContain("set_template_variable_defaults");
68+
expect(editingContract, templateId).toContain("HTML-entity-encoded JSON");
6569
const html = readFileSync(join(itemDir, composition?.path ?? ""), "utf8");
6670
const { document } = parseHTML(html);
6771
const declarations = JSON.parse(

registry/blocks/ai-chat-reveal/TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Only defaults declared in `data-composition-variables` are editable:
1515

1616
Typed and streamed copy is length-locked to within 20% of the original.
1717

18+
## Safe editing mechanics
19+
20+
Call `set_template_variable_defaults` once with the existing variable ids and their new defaults. Do not directly edit or rewrite `index.html` or its `data-composition-variables` attribute; the imported declaration is HTML-entity-encoded JSON and the setter preserves that encoding. Never edit `__template_baseline__.html` or a duplicate composition file. For an image slot, pass only the token returned by an image tool. Validate after the setter succeeds.
21+
1822
## Protected
1923

2024
Do not change chat chrome, keyboard, layout, palette, fonts, scene order, duration, timing, easing, typing cadence, or reveal logic. Do not replace any image outside the declared closing-card logo slot, and do not restyle the assistant interface to match the supplied website. This contract declares no color variables.

registry/blocks/chatgpt-exchange/TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Only defaults declared in `data-composition-variables` are editable:
1414

1515
Typed and streamed copy is length-locked to within 20% of the original.
1616

17+
## Safe editing mechanics
18+
19+
Call `set_template_variable_defaults` once with the existing variable ids and their new defaults. Do not directly edit or rewrite `index.html` or its `data-composition-variables` attribute; the imported declaration is HTML-entity-encoded JSON and the setter preserves that encoding. Never edit `__template_baseline__.html` or a duplicate composition file. Validate after the setter succeeds.
20+
1721
## Protected
1822

1923
Preserve the ChatGPT name, labels, suggestions, predictive keyboard text, header, composer, keyboard, icons, fonts, palette, layout, status UI, table geometry, scene structure, duration, timing, easing, typing cadence, and reveal behavior.

registry/blocks/claude-exchange/TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Only defaults declared in `data-composition-variables` are editable:
1313

1414
Typed and streamed copy is length-locked to within 20% of the original.
1515

16+
## Safe editing mechanics
17+
18+
Call `set_template_variable_defaults` once with the existing variable ids and their new defaults. Do not directly edit or rewrite `index.html` or its `data-composition-variables` attribute; the imported declaration is HTML-entity-encoded JSON and the setter preserves that encoding. Never edit `__template_baseline__.html` or a duplicate composition file. Validate after the setter succeeds.
19+
1620
## Protected
1721

1822
Preserve the Claude name, model name, usage notice, placeholders, disclaimer, source treatment, header, composer, icons, starburst, fonts, palette, layout, status UI, scene structure, duration, timing, easing, typing cadence, and reveal behavior.

registry/blocks/message-thread-reveal/TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Only defaults declared in `data-composition-variables` are editable:
1515

1616
Keep replacement copy within 20% of the original length.
1717

18+
## Safe editing mechanics
19+
20+
Call `set_template_variable_defaults` once with the existing variable ids and their new defaults. Do not directly edit or rewrite `index.html` or its `data-composition-variables` attribute; the imported declaration is HTML-entity-encoded JSON and the setter preserves that encoding. Never edit `__template_baseline__.html` or a duplicate composition file. For an image slot, pass only the token returned by an image tool. Validate after the setter succeeds.
21+
1822
## Protected
1923

2024
Preserve messaging chrome, bubble styling, receipts, palette, typography, geometry, scene structure, duration, timing, easing, and reveal behavior. Do not replace any image outside the declared link-card and closing-card logo slots, and do not recolor the messaging interface to match the supplied website.

registry/blocks/notes-reveal/TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Only defaults declared in `data-composition-variables` are editable:
1414

1515
Typed copy is length-locked to within 20% of the original.
1616

17+
## Safe editing mechanics
18+
19+
Call `set_template_variable_defaults` once with the existing variable ids and their new defaults. Do not directly edit or rewrite `index.html` or its `data-composition-variables` attribute; the imported declaration is HTML-entity-encoded JSON and the setter preserves that encoding. Never edit `__template_baseline__.html` or a duplicate composition file. Validate after the setter succeeds.
20+
1721
## Protected
1822

1923
Preserve notes chrome, paper treatment, fonts, colors, checklist geometry, scene structure, duration, timing, easing, handwriting motion, and reveal cadence.

registry/blocks/notification-cascade/TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Only defaults declared in `data-composition-variables` are editable:
1414

1515
Keep replacement copy within 20% of the original length.
1616

17+
## Safe editing mechanics
18+
19+
Call `set_template_variable_defaults` once with the existing variable ids and their new defaults. Do not directly edit or rewrite `index.html` or its `data-composition-variables` attribute; the imported declaration is HTML-entity-encoded JSON and the setter preserves that encoding. Never edit `__template_baseline__.html` or a duplicate composition file. For an image slot, pass only the token returned by an image tool. Validate after the setter succeeds.
20+
1721
## Protected
1822

1923
Do not change CSS, layout, backdrop, notification chrome, scene structure, duration, timing, easing, stacking, or reveal behavior. Do not replace any image outside the declared closing-card logo slot. Colors are protected because this template declares no color variables.

registry/blocks/share-sheet-carousel/TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Only defaults declared in `data-composition-variables` are editable:
1515

1616
Keep replacement copy within 20% of the original length.
1717

18+
## Safe editing mechanics
19+
20+
Call `set_template_variable_defaults` once with the existing variable ids and their new defaults. Do not directly edit or rewrite `index.html` or its `data-composition-variables` attribute; the imported declaration is HTML-entity-encoded JSON and the setter preserves that encoding. Never edit `__template_baseline__.html` or a duplicate composition file. For an image slot, pass only the token returned by an image tool. Validate after the setter succeeds.
21+
1822
## Protected
1923

2024
Preserve the share-sheet palette, typography, buttons, geometry, carousel layout, scene structure, duration, timing, easing, and tap animation. Do not replace any image outside the declared slide and logo slots, and do not recolor the operating-system interface.

registry/blocks/slack-notification-ad/TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Only defaults declared in `data-composition-variables` are editable:
1313

1414
Keep replacement copy within 20% of the original length. The payoff logo must remain legible in the existing icon tile.
1515

16+
## Safe editing mechanics
17+
18+
Call `set_template_variable_defaults` once with the existing variable ids and their new defaults. Do not directly edit or rewrite `index.html` or its `data-composition-variables` attribute; the imported declaration is HTML-entity-encoded JSON and the setter preserves that encoding. Never edit `__template_baseline__.html` or a duplicate composition file. For the payoff logo, pass only the token returned by an image tool. Validate after the setter succeeds.
19+
1620
## Protected
1721

1822
Preserve the Slack mark on request notifications, iOS status/date/clock labels, wallpaper, notification chrome, fonts, palette, stacking geometry, scene structure, duration, timing, easing, and arrival cadence.

0 commit comments

Comments
 (0)