@wireweave/agent-prompts 0.2.0-beta.2 → 0.2.0-beta.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/index.cjs CHANGED
@@ -84,8 +84,10 @@ Screens in one .wf file share a shell (header, sidebar, footer). Restating it on
84
84
  - layout NAME { \u2026 slot \u2026 } \u2014 a named page shell. The name is a bare identifier, NOT a quoted string.
85
85
  - slot \u2014 a bare positional marker inside a layout, marking where a referencing page's own content goes. It takes no name and no braces.
86
86
  - component NAME { \u2026 } \u2014 a named fragment defined once and referenced by name instead of restated.
87
+ - component NAME(param: string, other: number) { \u2026 } \u2014 declare typed parameters so one fragment serves several call sites. Types are string, number, boolean.
87
88
  - use NAME(arg="value") { \u2026 } \u2014 draw a component defined above. Arguments are parenthesized name=value pairs; the optional braces fill the component's slots.
88
89
  - page "Title" uses=NAME { \u2026 } \u2014 draw this page inside layout NAME. The page body holds only what is unique to that screen.
90
+ - repeat N { \u2026 } \u2014 draw the body N times. N is a bare non-negative integer, NOT quoted and NOT an attribute. Use it instead of pasting the same child N times.
89
91
 
90
92
  \`\`\`
91
93
  layout app {
@@ -99,6 +101,43 @@ page "Docs" uses=app { text "Getting started" }
99
101
  page "About" uses=app { text "Who we are" }
100
102
  \`\`\`
101
103
 
104
+ Parameters \u2014 ALWAYS QUOTE A $ REFERENCE:
105
+ Inside a component body, "$param" stands for the value the call site passed. The reference must be the whole quoted string.
106
+
107
+ \`\`\`
108
+ component navcard(label: string, to: string) {
109
+ card {
110
+ title "$label"
111
+ button "Open" navigate="$to"
112
+ button "Go" on={event=click, effects=[{kind=navigate, target="$to"}]}
113
+ }
114
+ }
115
+
116
+ page "Home" {
117
+ use navcard(label="Reports", to="Reports")
118
+ use navcard(label="Settings", to="Settings")
119
+ }
120
+ \`\`\`
121
+
122
+ - WRITE target="$to" \u2014 quoted. A quoted reference works ANYWHERE a value goes, including nested places like an effect target.
123
+ - NEVER write target=$to \u2014 bare. An identifier cannot begin with $, so the file FAILS TO PARSE with a syntax error.
124
+ - "$to" substitutes only as an entire value. "go to $to" is literal text, not a reference.
125
+ - Every "$name" must match a declared parameter. An undeclared name is a validation error, so check the spelling against the component's parameter list.
126
+
127
+ Repeated siblings \u2014 WRITE THE BODY ONCE:
128
+ Six identical skeleton cards are one body repeated, not six pasted copies.
129
+
130
+ \`\`\`
131
+ row gap=4 {
132
+ repeat 6 { use skeletonCard() }
133
+ }
134
+ \`\`\`
135
+
136
+ - There is NO index variable. \`repeat 6 as i\` does NOT exist and FAILS TO PARSE. Every copy is identical \u2014 that is what a wireframe shows.
137
+ - If the items genuinely differ (different labels, different icons), do NOT use repeat. Write them out, or pass the difference as a component parameter.
138
+ - The count is positional: write \`repeat 6\`, never \`repeat count=6\`.
139
+ - \`repeat 0\` draws nothing; \`repeat 1\` draws the body once. Nesting multiplies, so keep nested counts small.
140
+
102
141
  Rules:
103
142
  - layout and component are TOP-LEVEL only \u2014 siblings of page, never nested inside one.
104
143
  - Define a layout as soon as two or more pages share a shell. Three pages that each repeat a header is a defect, not a style.
@@ -294,6 +333,8 @@ function buildCompactGrammarPrompt() {
294
333
  - Multi-view apps default to separate top-level pages (not sidebar collapse).
295
334
 
296
335
  # REUSE: layout NAME { \u2026 } defines a shared shell (name is a bare identifier, not a quoted string); slot marks where a referencing page's own content goes inside that shell (bare keyword, no name, no braces); component NAME { \u2026 } defines a reusable fragment; use NAME(arg="value") { \u2026 } draws that fragment, passing parenthesized arguments and optionally filling its slots; page "Title" uses=NAME draws that page inside the layout and states only its own content. layout/component are top-level siblings of page. Two or more pages sharing a shell \u2192 define a layout instead of repeating it.
336
+ repeat N { \u2026 } draws its body N times \u2014 write repeat 6 { use skeletonCard() } instead of pasting six copies. N is a bare integer. There is NO index variable (repeat 6 as i fails to parse) and every copy is identical, so write items out individually when they differ.
337
+ # PARAMETERS: component NAME(label: string, to: string) { \u2026 } declares typed parameters (string/number/boolean); inside the body "$label" stands for the passed value. ALWAYS quote the reference \u2014 navigate="$to" and target="$to" work anywhere, including nested effect targets. NEVER write it bare (navigate=$to): an identifier cannot start with $, so the file fails to parse. A reference must be the whole value ("go to $to" is literal text), and every "$name" must match a declared parameter or validation fails.
297
338
  # LAYOUT: page(at, viewport, width, height, device, centered, uses), header(h, border), main(p, scroll), footer(h, border), sidebar(w, border, position), section, row(gap, justify, align, wrap), col(gap, flex, span), stack, relative
298
339
  # CONTAINERS: card(p, shadow), modal(w, id), drawer(w, position, id), accordion
299
340
  # TEXT: text(size, weight, muted), title(level), link(href)
package/dist/index.js CHANGED
@@ -57,8 +57,10 @@ Screens in one .wf file share a shell (header, sidebar, footer). Restating it on
57
57
  - layout NAME { \u2026 slot \u2026 } \u2014 a named page shell. The name is a bare identifier, NOT a quoted string.
58
58
  - slot \u2014 a bare positional marker inside a layout, marking where a referencing page's own content goes. It takes no name and no braces.
59
59
  - component NAME { \u2026 } \u2014 a named fragment defined once and referenced by name instead of restated.
60
+ - component NAME(param: string, other: number) { \u2026 } \u2014 declare typed parameters so one fragment serves several call sites. Types are string, number, boolean.
60
61
  - use NAME(arg="value") { \u2026 } \u2014 draw a component defined above. Arguments are parenthesized name=value pairs; the optional braces fill the component's slots.
61
62
  - page "Title" uses=NAME { \u2026 } \u2014 draw this page inside layout NAME. The page body holds only what is unique to that screen.
63
+ - repeat N { \u2026 } \u2014 draw the body N times. N is a bare non-negative integer, NOT quoted and NOT an attribute. Use it instead of pasting the same child N times.
62
64
 
63
65
  \`\`\`
64
66
  layout app {
@@ -72,6 +74,43 @@ page "Docs" uses=app { text "Getting started" }
72
74
  page "About" uses=app { text "Who we are" }
73
75
  \`\`\`
74
76
 
77
+ Parameters \u2014 ALWAYS QUOTE A $ REFERENCE:
78
+ Inside a component body, "$param" stands for the value the call site passed. The reference must be the whole quoted string.
79
+
80
+ \`\`\`
81
+ component navcard(label: string, to: string) {
82
+ card {
83
+ title "$label"
84
+ button "Open" navigate="$to"
85
+ button "Go" on={event=click, effects=[{kind=navigate, target="$to"}]}
86
+ }
87
+ }
88
+
89
+ page "Home" {
90
+ use navcard(label="Reports", to="Reports")
91
+ use navcard(label="Settings", to="Settings")
92
+ }
93
+ \`\`\`
94
+
95
+ - WRITE target="$to" \u2014 quoted. A quoted reference works ANYWHERE a value goes, including nested places like an effect target.
96
+ - NEVER write target=$to \u2014 bare. An identifier cannot begin with $, so the file FAILS TO PARSE with a syntax error.
97
+ - "$to" substitutes only as an entire value. "go to $to" is literal text, not a reference.
98
+ - Every "$name" must match a declared parameter. An undeclared name is a validation error, so check the spelling against the component's parameter list.
99
+
100
+ Repeated siblings \u2014 WRITE THE BODY ONCE:
101
+ Six identical skeleton cards are one body repeated, not six pasted copies.
102
+
103
+ \`\`\`
104
+ row gap=4 {
105
+ repeat 6 { use skeletonCard() }
106
+ }
107
+ \`\`\`
108
+
109
+ - There is NO index variable. \`repeat 6 as i\` does NOT exist and FAILS TO PARSE. Every copy is identical \u2014 that is what a wireframe shows.
110
+ - If the items genuinely differ (different labels, different icons), do NOT use repeat. Write them out, or pass the difference as a component parameter.
111
+ - The count is positional: write \`repeat 6\`, never \`repeat count=6\`.
112
+ - \`repeat 0\` draws nothing; \`repeat 1\` draws the body once. Nesting multiplies, so keep nested counts small.
113
+
75
114
  Rules:
76
115
  - layout and component are TOP-LEVEL only \u2014 siblings of page, never nested inside one.
77
116
  - Define a layout as soon as two or more pages share a shell. Three pages that each repeat a header is a defect, not a style.
@@ -267,6 +306,8 @@ function buildCompactGrammarPrompt() {
267
306
  - Multi-view apps default to separate top-level pages (not sidebar collapse).
268
307
 
269
308
  # REUSE: layout NAME { \u2026 } defines a shared shell (name is a bare identifier, not a quoted string); slot marks where a referencing page's own content goes inside that shell (bare keyword, no name, no braces); component NAME { \u2026 } defines a reusable fragment; use NAME(arg="value") { \u2026 } draws that fragment, passing parenthesized arguments and optionally filling its slots; page "Title" uses=NAME draws that page inside the layout and states only its own content. layout/component are top-level siblings of page. Two or more pages sharing a shell \u2192 define a layout instead of repeating it.
309
+ repeat N { \u2026 } draws its body N times \u2014 write repeat 6 { use skeletonCard() } instead of pasting six copies. N is a bare integer. There is NO index variable (repeat 6 as i fails to parse) and every copy is identical, so write items out individually when they differ.
310
+ # PARAMETERS: component NAME(label: string, to: string) { \u2026 } declares typed parameters (string/number/boolean); inside the body "$label" stands for the passed value. ALWAYS quote the reference \u2014 navigate="$to" and target="$to" work anywhere, including nested effect targets. NEVER write it bare (navigate=$to): an identifier cannot start with $, so the file fails to parse. A reference must be the whole value ("go to $to" is literal text), and every "$name" must match a declared parameter or validation fails.
270
311
  # LAYOUT: page(at, viewport, width, height, device, centered, uses), header(h, border), main(p, scroll), footer(h, border), sidebar(w, border, position), section, row(gap, justify, align, wrap), col(gap, flex, span), stack, relative
271
312
  # CONTAINERS: card(p, shadow), modal(w, id), drawer(w, position, id), accordion
272
313
  # TEXT: text(size, weight, muted), title(level), link(href)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireweave/agent-prompts",
3
- "version": "0.2.0-beta.2",
3
+ "version": "0.2.0-beta.4",
4
4
  "description": "Canonical grammar prompts for LLM agents generating Wireweave DSL (multi-page aware)",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -52,7 +52,7 @@
52
52
  "typescript": "^5.7.2",
53
53
  "typescript-eslint": "^8.60.0",
54
54
  "vitest": "^3.1.1",
55
- "@wireweave/core": "3.1.0-beta.5"
55
+ "@wireweave/core": "3.1.0-beta.7"
56
56
  },
57
57
  "keywords": [
58
58
  "wireframe",