@wireweave/agent-prompts 0.2.0-beta.5 → 0.2.0-beta.7
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/README.md +14 -30
- package/dist/index.cjs +10 -2
- package/dist/index.js +10 -2
- package/package.json +15 -19
package/README.md
CHANGED
|
@@ -1,43 +1,27 @@
|
|
|
1
1
|
# @wireweave/agent-prompts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Versioned grammar prompts derived from the Wireweave language contract.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The [public tool contract](../../docs/spec/TOOLING.md#5-mcp-and-agent-plugins) defines this package's APIs, behavior, configuration and compatibility. The [language contract](../../docs/spec/LANGUAGE.md) defines the DSL. [Package metadata](package.json) owns package versions, exports, dependencies and scripts.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Install
|
|
9
|
+
Use Node.js >=22.13.0. Replace `<pinned-version>` with the release selected for your toolchain.
|
|
12
10
|
|
|
13
11
|
```bash
|
|
14
|
-
pnpm add @wireweave/agent-prompts
|
|
12
|
+
pnpm add --save-exact '@wireweave/agent-prompts@<pinned-version>'
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import { buildGrammarPrompt, buildCompactGrammarPrompt } from '@wireweave/agent-prompts'
|
|
15
|
+
## Development
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
const system = buildGrammarPrompt()
|
|
17
|
+
Run from the monorepo root after the [workspace setup](../../README.md).
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
```bash
|
|
20
|
+
pnpm --filter @wireweave/agent-prompts run build
|
|
21
|
+
pnpm --filter @wireweave/agent-prompts run typecheck
|
|
22
|
+
pnpm --filter @wireweave/agent-prompts run lint
|
|
23
|
+
pnpm --filter @wireweave/agent-prompts run test
|
|
24
|
+
pnpm --filter @wireweave/agent-prompts run format:check
|
|
27
25
|
```
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### `buildGrammarPrompt(): string`
|
|
32
|
-
|
|
33
|
-
The full grammar guide for the generation phase. Covers syntax structure, the multi-page canvas model, the renderer surface (`render` / `renderCanvas` / `renderPage`), the layout / content / form / nav / data / feedback / overlay / utility component contracts, and how to map common UI concepts to DSL components.
|
|
34
|
-
|
|
35
|
-
### `buildCompactGrammarPrompt(): string`
|
|
36
|
-
|
|
37
|
-
A condensed grammar guide for the analyze / plan phases, where the full guide is more than needed.
|
|
38
|
-
|
|
39
|
-
Part of the [Wireweave monorepo](https://github.com/wireweave/wireweave).
|
|
40
|
-
|
|
41
|
-
## License
|
|
42
|
-
|
|
43
|
-
MIT
|
|
27
|
+
License: MIT.
|
package/dist/index.cjs
CHANGED
|
@@ -90,9 +90,17 @@ Screens in one .wf file share a shell (header, sidebar, footer). Restating it on
|
|
|
90
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.
|
|
91
91
|
- page "Title" variants=[loading, empty, ready] { \u2026 } \u2014 draw this page once per named state, as that many separate screens. The names are bare identifiers in brackets. Use this for a screen's loading / empty / populated / error conditions INSTEAD of states= + visibleWhen + a toggle button: a variant needs no switching control, so the wireframe shows no UI the product does not have, and every condition is visible at once instead of one at a time. Each screen is addressed as "id#variant" (quoted, e.g. navigate="orders#empty"); plain navigate=orders reaches the first variant.
|
|
92
92
|
|
|
93
|
+
- when=loading / when=[loading, empty] on ANY element inside a variant page \u2014 draw that element only on the named boards. A list is OR: write a block shared by two states once, with both names, instead of copying it into each. Omitting when= draws the element on every board, so the common chrome of a screen is written once with no when= at all. Every name must appear in that page's variants= list. This is build-time and is NOT visibleWhen: when= decides whether the element exists in a board's markup, visibleWhen decides whether the runtime shows an element that is already there \u2014 one element may carry both.
|
|
94
|
+
|
|
93
95
|
\`\`\`
|
|
94
96
|
page "Orders" id=orders variants=[loading, empty, ready] {
|
|
95
|
-
main {
|
|
97
|
+
main {
|
|
98
|
+
section "Header" { title "Orders" level=2 }
|
|
99
|
+
section when=loading { repeat 3 { card "" h=80 bg=muted } }
|
|
100
|
+
section when=empty { placeholder "No orders yet" }
|
|
101
|
+
section when=[empty, ready] { button "New order" primary }
|
|
102
|
+
section when=ready { table [["Order", "Status"], ["1001", "Shipped"]] }
|
|
103
|
+
}
|
|
96
104
|
}
|
|
97
105
|
\`\`\`
|
|
98
106
|
|
|
@@ -339,7 +347,7 @@ function buildCompactGrammarPrompt() {
|
|
|
339
347
|
- Use viewport="WxH" per page; omit at() to auto-flow, use at(x, y) to pin.
|
|
340
348
|
- Multi-view apps default to separate top-level pages (not sidebar collapse).
|
|
341
349
|
|
|
342
|
-
# VARIANTS: page "T" variants=[loading, empty, ready] { \u2026 } draws that page once per named state as that many separate screens (names are bare identifiers in brackets). Prefer it over states=+visibleWhen+a toggle for a screen's loading/empty/populated/error conditions \u2014 no switching control has to exist in the wireframe, and all conditions are visible at once. Address one as navigate="id#variant"; plain navigate=id reaches the first.
|
|
350
|
+
# VARIANTS: page "T" variants=[loading, empty, ready] { \u2026 } draws that page once per named state as that many separate screens (names are bare identifiers in brackets). Prefer it over states=+visibleWhen+a toggle for a screen's loading/empty/populated/error conditions \u2014 no switching control has to exist in the wireframe, and all conditions are visible at once. Address one as navigate="id#variant"; plain navigate=id reaches the first. Scope elements inside such a page with when=loading or when=[loading, empty] (OR) so a block shared by two states is authored once; no when= means every board. Names must be declared in that page's variants=. when= is build-time (the element is absent from other boards) and is orthogonal to visibleWhen (runtime toggle) \u2014 an element may carry both.
|
|
343
351
|
# 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.
|
|
344
352
|
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.
|
|
345
353
|
# 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.
|
package/dist/index.js
CHANGED
|
@@ -63,9 +63,17 @@ Screens in one .wf file share a shell (header, sidebar, footer). Restating it on
|
|
|
63
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.
|
|
64
64
|
- page "Title" variants=[loading, empty, ready] { \u2026 } \u2014 draw this page once per named state, as that many separate screens. The names are bare identifiers in brackets. Use this for a screen's loading / empty / populated / error conditions INSTEAD of states= + visibleWhen + a toggle button: a variant needs no switching control, so the wireframe shows no UI the product does not have, and every condition is visible at once instead of one at a time. Each screen is addressed as "id#variant" (quoted, e.g. navigate="orders#empty"); plain navigate=orders reaches the first variant.
|
|
65
65
|
|
|
66
|
+
- when=loading / when=[loading, empty] on ANY element inside a variant page \u2014 draw that element only on the named boards. A list is OR: write a block shared by two states once, with both names, instead of copying it into each. Omitting when= draws the element on every board, so the common chrome of a screen is written once with no when= at all. Every name must appear in that page's variants= list. This is build-time and is NOT visibleWhen: when= decides whether the element exists in a board's markup, visibleWhen decides whether the runtime shows an element that is already there \u2014 one element may carry both.
|
|
67
|
+
|
|
66
68
|
\`\`\`
|
|
67
69
|
page "Orders" id=orders variants=[loading, empty, ready] {
|
|
68
|
-
main {
|
|
70
|
+
main {
|
|
71
|
+
section "Header" { title "Orders" level=2 }
|
|
72
|
+
section when=loading { repeat 3 { card "" h=80 bg=muted } }
|
|
73
|
+
section when=empty { placeholder "No orders yet" }
|
|
74
|
+
section when=[empty, ready] { button "New order" primary }
|
|
75
|
+
section when=ready { table [["Order", "Status"], ["1001", "Shipped"]] }
|
|
76
|
+
}
|
|
69
77
|
}
|
|
70
78
|
\`\`\`
|
|
71
79
|
|
|
@@ -312,7 +320,7 @@ function buildCompactGrammarPrompt() {
|
|
|
312
320
|
- Use viewport="WxH" per page; omit at() to auto-flow, use at(x, y) to pin.
|
|
313
321
|
- Multi-view apps default to separate top-level pages (not sidebar collapse).
|
|
314
322
|
|
|
315
|
-
# VARIANTS: page "T" variants=[loading, empty, ready] { \u2026 } draws that page once per named state as that many separate screens (names are bare identifiers in brackets). Prefer it over states=+visibleWhen+a toggle for a screen's loading/empty/populated/error conditions \u2014 no switching control has to exist in the wireframe, and all conditions are visible at once. Address one as navigate="id#variant"; plain navigate=id reaches the first.
|
|
323
|
+
# VARIANTS: page "T" variants=[loading, empty, ready] { \u2026 } draws that page once per named state as that many separate screens (names are bare identifiers in brackets). Prefer it over states=+visibleWhen+a toggle for a screen's loading/empty/populated/error conditions \u2014 no switching control has to exist in the wireframe, and all conditions are visible at once. Address one as navigate="id#variant"; plain navigate=id reaches the first. Scope elements inside such a page with when=loading or when=[loading, empty] (OR) so a block shared by two states is authored once; no when= means every board. Names must be declared in that page's variants=. when= is build-time (the element is absent from other boards) and is orthogonal to visibleWhen (runtime toggle) \u2014 an element may carry both.
|
|
316
324
|
# 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.
|
|
317
325
|
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.
|
|
318
326
|
# 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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wireweave/agent-prompts",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.7",
|
|
4
4
|
"description": "Canonical grammar prompts for LLM agents generating Wireweave DSL (multi-page aware)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,24 +35,22 @@
|
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@commitlint/cli": "^21.
|
|
39
|
-
"@commitlint/config-conventional": "^21.
|
|
38
|
+
"@commitlint/cli": "^21.2.2",
|
|
39
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
40
40
|
"@eslint/js": "^10.0.1",
|
|
41
41
|
"@packlint/cli": "^0.0.2",
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
44
|
-
"eslint": "^10.4.0",
|
|
42
|
+
"@types/node": "^22.20.2",
|
|
43
|
+
"eslint": "^10.10.0",
|
|
45
44
|
"husky": "^9.1.7",
|
|
46
|
-
"knip": "^6.
|
|
47
|
-
"lint-staged": "^
|
|
48
|
-
"prettier": "^3.
|
|
49
|
-
"publint": "^0.3.
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"typescript": "^
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"@wireweave/core": "3.1.0-beta.8"
|
|
45
|
+
"knip": "^6.35.1",
|
|
46
|
+
"lint-staged": "^16.4.0",
|
|
47
|
+
"prettier": "^3.9.6",
|
|
48
|
+
"publint": "^0.3.24",
|
|
49
|
+
"tsup": "^8.5.1",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"typescript-eslint": "^8.70.0",
|
|
52
|
+
"vitest": "^4.1.11",
|
|
53
|
+
"@wireweave/core": "4.0.0-beta.13"
|
|
56
54
|
},
|
|
57
55
|
"keywords": [
|
|
58
56
|
"wireframe",
|
|
@@ -86,8 +84,6 @@
|
|
|
86
84
|
"knip": "knip",
|
|
87
85
|
"publint": "publint --strict",
|
|
88
86
|
"packlint": "packlint check",
|
|
89
|
-
"clean": "rm -rf dist"
|
|
90
|
-
"release": "release-it",
|
|
91
|
-
"release:beta": "release-it --preRelease=beta"
|
|
87
|
+
"clean": "rm -rf dist"
|
|
92
88
|
}
|
|
93
89
|
}
|