@wireweave/agent-prompts 0.2.0-beta.2 → 0.2.0-beta.3

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,6 +84,7 @@ 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.
89
90
 
@@ -99,6 +100,29 @@ page "Docs" uses=app { text "Getting started" }
99
100
  page "About" uses=app { text "Who we are" }
100
101
  \`\`\`
101
102
 
103
+ Parameters \u2014 ALWAYS QUOTE A $ REFERENCE:
104
+ Inside a component body, "$param" stands for the value the call site passed. The reference must be the whole quoted string.
105
+
106
+ \`\`\`
107
+ component navcard(label: string, to: string) {
108
+ card {
109
+ title "$label"
110
+ button "Open" navigate="$to"
111
+ button "Go" on={event=click, effects=[{kind=navigate, target="$to"}]}
112
+ }
113
+ }
114
+
115
+ page "Home" {
116
+ use navcard(label="Reports", to="Reports")
117
+ use navcard(label="Settings", to="Settings")
118
+ }
119
+ \`\`\`
120
+
121
+ - WRITE target="$to" \u2014 quoted. A quoted reference works ANYWHERE a value goes, including nested places like an effect target.
122
+ - NEVER write target=$to \u2014 bare. An identifier cannot begin with $, so the file FAILS TO PARSE with a syntax error.
123
+ - "$to" substitutes only as an entire value. "go to $to" is literal text, not a reference.
124
+ - Every "$name" must match a declared parameter. An undeclared name is a validation error, so check the spelling against the component's parameter list.
125
+
102
126
  Rules:
103
127
  - layout and component are TOP-LEVEL only \u2014 siblings of page, never nested inside one.
104
128
  - 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 +318,7 @@ function buildCompactGrammarPrompt() {
294
318
  - Multi-view apps default to separate top-level pages (not sidebar collapse).
295
319
 
296
320
  # 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.
321
+ # 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
322
  # 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
323
  # CONTAINERS: card(p, shadow), modal(w, id), drawer(w, position, id), accordion
299
324
  # TEXT: text(size, weight, muted), title(level), link(href)
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ 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.
62
63
 
@@ -72,6 +73,29 @@ page "Docs" uses=app { text "Getting started" }
72
73
  page "About" uses=app { text "Who we are" }
73
74
  \`\`\`
74
75
 
76
+ Parameters \u2014 ALWAYS QUOTE A $ REFERENCE:
77
+ Inside a component body, "$param" stands for the value the call site passed. The reference must be the whole quoted string.
78
+
79
+ \`\`\`
80
+ component navcard(label: string, to: string) {
81
+ card {
82
+ title "$label"
83
+ button "Open" navigate="$to"
84
+ button "Go" on={event=click, effects=[{kind=navigate, target="$to"}]}
85
+ }
86
+ }
87
+
88
+ page "Home" {
89
+ use navcard(label="Reports", to="Reports")
90
+ use navcard(label="Settings", to="Settings")
91
+ }
92
+ \`\`\`
93
+
94
+ - WRITE target="$to" \u2014 quoted. A quoted reference works ANYWHERE a value goes, including nested places like an effect target.
95
+ - NEVER write target=$to \u2014 bare. An identifier cannot begin with $, so the file FAILS TO PARSE with a syntax error.
96
+ - "$to" substitutes only as an entire value. "go to $to" is literal text, not a reference.
97
+ - Every "$name" must match a declared parameter. An undeclared name is a validation error, so check the spelling against the component's parameter list.
98
+
75
99
  Rules:
76
100
  - layout and component are TOP-LEVEL only \u2014 siblings of page, never nested inside one.
77
101
  - 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 +291,7 @@ function buildCompactGrammarPrompt() {
267
291
  - Multi-view apps default to separate top-level pages (not sidebar collapse).
268
292
 
269
293
  # 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.
294
+ # 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
295
  # 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
296
  # CONTAINERS: card(p, shadow), modal(w, id), drawer(w, position, id), accordion
272
297
  # 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.3",
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.6"
56
56
  },
57
57
  "keywords": [
58
58
  "wireframe",