forma-dsl-mcp 0.3.9 → 0.4.0
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 +4 -0
- package/package.json +2 -2
- package/src/reference/cli.md +70 -17
package/README.md
CHANGED
|
@@ -15,6 +15,10 @@ it.
|
|
|
15
15
|
|
|
16
16
|
It speaks over stdio, and there is nothing to configure.
|
|
17
17
|
|
|
18
|
+
**[The site](https://kalpak44.github.io/forma-dsl/)** ·
|
|
19
|
+
**[Try the editor](https://kalpak44.github.io/forma-dsl/editor/)** ·
|
|
20
|
+
**[Read the reference](https://kalpak44.github.io/forma-dsl/docs/)**
|
|
21
|
+
|
|
18
22
|
## Installing it
|
|
19
23
|
|
|
20
24
|
**Claude Code**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forma-dsl-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A stdio MCP server that knows the forma DSL and writes .forma documents that render.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
49
|
-
"forma-dsl": "^0.
|
|
49
|
+
"forma-dsl": "^0.4.0",
|
|
50
50
|
"zod": "^4.1.13"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/src/reference/cli.md
CHANGED
|
@@ -28,6 +28,10 @@ evaluator's own position.
|
|
|
28
28
|
|
|
29
29
|
A `<file>` of `-` reads the document from stdin. `params` and `models` take `--json`.
|
|
30
30
|
|
|
31
|
+
A document, and an `-o`/`--out` that names one, must resolve inside the directory the command
|
|
32
|
+
is run in: a path that leaves it - by `..`, an absolute path, or a symlink pointing out of the
|
|
33
|
+
tree - is refused with exit code 2.
|
|
34
|
+
|
|
31
35
|
### `render`
|
|
32
36
|
|
|
33
37
|
| Option | Default | What it does |
|
|
@@ -36,6 +40,7 @@ A `<file>` of `-` reads the document from stdin. `params` and `models` take `--j
|
|
|
36
40
|
| `-m, --model <name>` | the first declared | which [model](reference/model.md) to build |
|
|
37
41
|
| `--part <name>` | see below | one [part](reference/part.md) by name |
|
|
38
42
|
| `-p, --param <name=val>` | each param's own default | a value for one declared [param](reference/param.md). Repeatable |
|
|
43
|
+
| `--params <file>` | - | a JSON object of values by name. `-p` wins over it |
|
|
39
44
|
| `--segments <n>` | the kernel's own | a fixed segment count for every curve |
|
|
40
45
|
| `--min-angle <deg>` | the kernel's own | smallest angle between adjacent segments of a curve |
|
|
41
46
|
| `--min-edge <n>` | the kernel's own | smallest length a curve segment may be shortened to |
|
|
@@ -52,16 +57,67 @@ makes a mess of them.
|
|
|
52
57
|
|
|
53
58
|
---
|
|
54
59
|
|
|
55
|
-
##
|
|
60
|
+
## Passing parameters
|
|
61
|
+
|
|
62
|
+
Three ways, and they compose.
|
|
56
63
|
|
|
57
|
-
A value is JSON where it parses as JSON, and the
|
|
58
|
-
|
|
59
|
-
quoting:
|
|
64
|
+
**One at a time, on the command line.** A value is JSON where it parses as JSON, and the
|
|
65
|
+
string as written otherwise - so there is no second layer of quoting to get wrong:
|
|
60
66
|
|
|
61
67
|
```bash
|
|
62
68
|
forma render part.forma -p count=6 -p center=true -p size=[10,20] -p label=M6
|
|
63
69
|
```
|
|
64
70
|
|
|
71
|
+
| Written | Arrives as |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `-p count=6` | the number `6` |
|
|
74
|
+
| `-p center=true` | the boolean `true` |
|
|
75
|
+
| `-p size=[10,20]` | the list `[10, 20]` |
|
|
76
|
+
| `-p label=M6` | the string `"M6"` |
|
|
77
|
+
|
|
78
|
+
**From a file.** `--params` takes a JSON object of values by name - the thing you commit and
|
|
79
|
+
diff, rather than assemble in a shell loop:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"height": 36,
|
|
84
|
+
"label": "M6",
|
|
85
|
+
"center": true
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
forma render riser.forma --params params.json -o riser.stl
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
It has to be a JSON **object**. An array or a bare number parses but names nothing, and is
|
|
94
|
+
refused with exit code 2 rather than quietly contributing nothing. Like every other path, it
|
|
95
|
+
must resolve inside the directory the command runs in.
|
|
96
|
+
|
|
97
|
+
**Both.** `-p` wins over `--params`, which is what a build matrix wants: the values every
|
|
98
|
+
variant shares live in the file, and the one that varies goes on the line.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
for h in 8 20 40; do
|
|
102
|
+
forma render riser.forma --params shared.json -p "height=$h" -o "build/riser-$h.stl"
|
|
103
|
+
done
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
And the document will tell you what it takes, so the first `params.json` need not be written
|
|
107
|
+
by hand:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
forma params riser.forma --json | jq 'map({(.name): .default}) | add' > params.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"height": 20,
|
|
116
|
+
"label": "A",
|
|
117
|
+
"center": false
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
65
121
|
---
|
|
66
122
|
|
|
67
123
|
## In a pipeline
|
|
@@ -96,13 +152,13 @@ A failure is reported where an editor and a CI annotation can both find it: the
|
|
|
96
152
|
`file:line:column:` prefix, then the lines around it with a caret under the column.
|
|
97
153
|
|
|
98
154
|
```
|
|
99
|
-
riser.forma:7:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
155
|
+
riser.forma:7:7: rounded_rect: unknown attribute "corner_radius" - rounded_rect reads "center", "radius", "segments", "size"
|
|
156
|
+
5 | extrude {
|
|
157
|
+
6 | height = var.height
|
|
158
|
+
7 | rounded_rect { size = [40, 20] corner_radius = 4 }
|
|
159
|
+
| ^
|
|
160
|
+
8 | }
|
|
161
|
+
9 | }
|
|
106
162
|
```
|
|
107
163
|
|
|
108
164
|
The position comes from the error itself - see [Errors](errors.md) for what each stage raises
|
|
@@ -110,7 +166,7 @@ and what it means.
|
|
|
110
166
|
|
|
111
167
|
---
|
|
112
168
|
|
|
113
|
-
##
|
|
169
|
+
## What a document declares
|
|
114
170
|
|
|
115
171
|
`params --json` is the document describing itself, which is what lets a script build every
|
|
116
172
|
variant without being told what the variants are:
|
|
@@ -132,11 +188,8 @@ forma params riser.forma --json
|
|
|
132
188
|
]
|
|
133
189
|
```
|
|
134
190
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
forma render riser.forma -p "height=$h" -o "build/riser-$h.stl"
|
|
138
|
-
done
|
|
139
|
-
```
|
|
191
|
+
`required` is true for a param declared with no default, which is one that has to be supplied
|
|
192
|
+
before the document will build at all.
|
|
140
193
|
|
|
141
194
|
---
|
|
142
195
|
|