@homemadedev/config 0.0.0-stage → 2.0.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 +71 -2
- package/configuration_schema.json +374 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +5 -0
- package/package.json +43 -4
package/README.md
CHANGED
|
@@ -1,3 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @homemadedev/config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Typed authoring for [homemade.dev](https://homemade.dev) project configs.
|
|
4
|
+
|
|
5
|
+
A project's config lives in its repo under `.homemade/` as `config.ts`, `config.js`, `config.jsonc`, or `config.json` (first one found wins). JSONC is the preferred declarative format; plain JSON is available for strict-JSON tooling.
|
|
6
|
+
|
|
7
|
+
## TypeScript / JavaScript
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
// .homemade/config.ts
|
|
11
|
+
import { config } from "@homemadedev/config";
|
|
12
|
+
|
|
13
|
+
export default config({
|
|
14
|
+
setup: ["apt-get install -y postgresql-16"],
|
|
15
|
+
install: ["pnpm install"],
|
|
16
|
+
services: {
|
|
17
|
+
app: { cmd: "pnpm dev", port: 3000, url: true },
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The module's default export must be the object returned by `config()`. It is evaluated in an isolated, network-less container at build time — no other package is installed, so keep the module self-contained.
|
|
23
|
+
|
|
24
|
+
### Config-format version
|
|
25
|
+
|
|
26
|
+
`version` is optional. An explicit `version: "1.0.0"` in the config overrides everything; without one, the platform uses the `@homemadedev/config` version your repo installs in its `package.json`, and if the package isn't installed either, the latest version the platform supports. Configs newer than the platform are rejected with a clear error.
|
|
27
|
+
|
|
28
|
+
### Create-time parameters
|
|
29
|
+
|
|
30
|
+
`parameters` declares knobs a user fills in when creating a VM from this repo — rendered in the New VM dialog and delivered as `HOMEMADE_PARAM_<NAME>` env vars (name upper-cased):
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
export default config({
|
|
34
|
+
parameters: [
|
|
35
|
+
{ name: "environment", type: "select", options: [{ value: "staging" }, { value: "production" }], default: "staging" },
|
|
36
|
+
{ name: "enable_debug", type: "boolean", default: false },
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Not for secrets** — a parameter's value is cleartext in the create request, the VM's create event, and its own env. Use `env_vars` with `is_secret` for anything sensitive.
|
|
42
|
+
|
|
43
|
+
## JSONC (comments and trailing commas allowed)
|
|
44
|
+
|
|
45
|
+
```jsonc
|
|
46
|
+
// .homemade/config.jsonc
|
|
47
|
+
{
|
|
48
|
+
"$schema": "https://homemade.dev/schemas/latest/config.json",
|
|
49
|
+
"services": {
|
|
50
|
+
"app": { "cmd": "pnpm dev", "port": 3000, "url": true },
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Strict JSON
|
|
56
|
+
|
|
57
|
+
`.homemade/config.json` is also supported, but it must contain strict JSON: comments and trailing commas are rejected.
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"$schema": "https://homemade.dev/schemas/latest/config.json",
|
|
62
|
+
"services": {
|
|
63
|
+
"app": { "cmd": "pnpm dev", "port": 3000, "url": true }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The schema is also embedded in this package, so an offline-friendly alternative is:
|
|
69
|
+
|
|
70
|
+
```jsonc
|
|
71
|
+
{ "$schema": "./node_modules/@homemadedev/config/configuration_schema.json" }
|
|
72
|
+
```
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://homemade.dev/schemas/2.0.0/config.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"$schema": {
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"agent": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"instructions": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"maxLength": 32768
|
|
15
|
+
},
|
|
16
|
+
"skills": {
|
|
17
|
+
"maxItems": 20,
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"maxLength": 200,
|
|
22
|
+
"pattern": "^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?\\/[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?(?:#[A-Za-z0-9._/-]+)?$"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"base": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+$"
|
|
30
|
+
},
|
|
31
|
+
"compose": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"editor": {
|
|
35
|
+
"default": {
|
|
36
|
+
"enabled": false
|
|
37
|
+
},
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": {
|
|
40
|
+
"enabled": {
|
|
41
|
+
"default": false,
|
|
42
|
+
"type": "boolean"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"env_schema": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"anyOf": [
|
|
50
|
+
{
|
|
51
|
+
"type": "string",
|
|
52
|
+
"minLength": 1
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"key": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"minLength": 1
|
|
60
|
+
},
|
|
61
|
+
"warmup": {
|
|
62
|
+
"default": false,
|
|
63
|
+
"type": "boolean"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"required": [
|
|
67
|
+
"key"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"install": {
|
|
74
|
+
"default": [],
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": {
|
|
77
|
+
"type": "string"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"network": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"properties": {
|
|
83
|
+
"egress": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"properties": {
|
|
86
|
+
"allow": {
|
|
87
|
+
"description": "Egress allowlist — IPv4 addresses, IPv4 CIDRs, exact domains, or *.wildcard domains. Present ⇒ default-deny egress: only these destinations (minus anything in `deny`) are reachable. An empty allow list behaves as if omitted (deny-only).",
|
|
88
|
+
"type": "array",
|
|
89
|
+
"items": {
|
|
90
|
+
"type": "string"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"deny": {
|
|
94
|
+
"description": "Egress denylist, same entry grammar as `allow`. Deny always wins over allow, even when a destination also matches `allow`.",
|
|
95
|
+
"type": "array",
|
|
96
|
+
"items": {
|
|
97
|
+
"type": "string"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"description": "Outbound network policy. Domain matching is EXACT: `github.com` does not cover `api.github.com` — use `*.github.com` for subdomains (which in turn does not cover the bare apex `github.com`). IPv6 is not accepted here (guest networking is IPv4-only)."
|
|
102
|
+
},
|
|
103
|
+
"ingress": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"properties": {
|
|
106
|
+
"allow": {
|
|
107
|
+
"description": "Ingress allowlist — client IPv4/IPv6 addresses or CIDRs (no domains). Present ⇒ default-deny ingress: only these clients (minus anything in `deny`) may reach the VM's routed ports. An empty allow list behaves as if omitted (deny-only).",
|
|
108
|
+
"type": "array",
|
|
109
|
+
"items": {
|
|
110
|
+
"type": "string"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"deny": {
|
|
114
|
+
"description": "Ingress denylist, same entry grammar as `allow`. Deny always wins over allow, even when a client also matches `allow`.",
|
|
115
|
+
"type": "array",
|
|
116
|
+
"items": {
|
|
117
|
+
"type": "string"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"description": "Inbound network policy. Matches the connecting CLIENT's IP address — never a domain."
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"description": "Network egress/ingress policy. Absent entirely ⇒ allow everything (current default behavior)."
|
|
125
|
+
},
|
|
126
|
+
"parameters": {
|
|
127
|
+
"type": "array",
|
|
128
|
+
"items": {
|
|
129
|
+
"type": "object",
|
|
130
|
+
"properties": {
|
|
131
|
+
"default": {
|
|
132
|
+
"type": [
|
|
133
|
+
"string",
|
|
134
|
+
"number",
|
|
135
|
+
"boolean"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
"description": {
|
|
139
|
+
"type": "string"
|
|
140
|
+
},
|
|
141
|
+
"icon": {
|
|
142
|
+
"description": "Plain optional label glyph — rendered as literal text if at all, never fetched as an image. No icon rendering in v1: accepted and stored only.",
|
|
143
|
+
"type": "string"
|
|
144
|
+
},
|
|
145
|
+
"name": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"maxLength": 64,
|
|
148
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
|
|
149
|
+
},
|
|
150
|
+
"options": {
|
|
151
|
+
"minItems": 1,
|
|
152
|
+
"type": "array",
|
|
153
|
+
"items": {
|
|
154
|
+
"type": "object",
|
|
155
|
+
"properties": {
|
|
156
|
+
"description": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"minLength": 1
|
|
159
|
+
},
|
|
160
|
+
"label": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"minLength": 1
|
|
163
|
+
},
|
|
164
|
+
"value": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"minLength": 1
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"required": [
|
|
170
|
+
"value"
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"required": {
|
|
175
|
+
"default": false,
|
|
176
|
+
"type": "boolean"
|
|
177
|
+
},
|
|
178
|
+
"type": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"enum": [
|
|
181
|
+
"string",
|
|
182
|
+
"number",
|
|
183
|
+
"boolean",
|
|
184
|
+
"select"
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"validation": {
|
|
188
|
+
"type": "object",
|
|
189
|
+
"properties": {
|
|
190
|
+
"errorMessage": {
|
|
191
|
+
"type": "string"
|
|
192
|
+
},
|
|
193
|
+
"max": {
|
|
194
|
+
"type": "number"
|
|
195
|
+
},
|
|
196
|
+
"min": {
|
|
197
|
+
"type": "number"
|
|
198
|
+
},
|
|
199
|
+
"regex": {
|
|
200
|
+
"type": "string"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"required": [
|
|
206
|
+
"name",
|
|
207
|
+
"type"
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"services": {
|
|
212
|
+
"type": "object",
|
|
213
|
+
"propertyNames": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"maxLength": 32,
|
|
216
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_-]*$"
|
|
217
|
+
},
|
|
218
|
+
"additionalProperties": {
|
|
219
|
+
"type": "object",
|
|
220
|
+
"properties": {
|
|
221
|
+
"autostart": {
|
|
222
|
+
"default": true,
|
|
223
|
+
"type": "boolean"
|
|
224
|
+
},
|
|
225
|
+
"cmd": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"minLength": 1
|
|
228
|
+
},
|
|
229
|
+
"displayName": {
|
|
230
|
+
"description": "Human-friendly name shown instead of the service key in the dashboard.",
|
|
231
|
+
"type": "string",
|
|
232
|
+
"minLength": 1,
|
|
233
|
+
"maxLength": 64
|
|
234
|
+
},
|
|
235
|
+
"healthcheck": {
|
|
236
|
+
"description": "Probe the service over localhost HTTP (guest-side) and report health on the `health` command / VM runtime. Success is any HTTP status below 500 — a 404 still counts as up. Requires `port`.",
|
|
237
|
+
"type": "object",
|
|
238
|
+
"properties": {
|
|
239
|
+
"interval": {
|
|
240
|
+
"default": 5,
|
|
241
|
+
"description": "Seconds between probes. Default 5.",
|
|
242
|
+
"type": "integer",
|
|
243
|
+
"minimum": 1,
|
|
244
|
+
"maximum": 300
|
|
245
|
+
},
|
|
246
|
+
"path": {
|
|
247
|
+
"default": "/",
|
|
248
|
+
"description": "HTTP path probed on the service's own port (http://127.0.0.1:{port}{path}). Default \"/\".",
|
|
249
|
+
"type": "string",
|
|
250
|
+
"minLength": 1
|
|
251
|
+
},
|
|
252
|
+
"threshold": {
|
|
253
|
+
"default": 6,
|
|
254
|
+
"description": "Consecutive failing probes before the service flips to unhealthy. Any single success flips it back to healthy. Default 6.",
|
|
255
|
+
"type": "integer",
|
|
256
|
+
"minimum": 1,
|
|
257
|
+
"maximum": 60
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"hidden": {
|
|
262
|
+
"default": false,
|
|
263
|
+
"description": "Hide the service from the VM workspace's Services pane. Does not affect autostart, and does not stop the service's own terminal from existing.",
|
|
264
|
+
"type": "boolean"
|
|
265
|
+
},
|
|
266
|
+
"icon": {
|
|
267
|
+
"description": "A short text/emoji glyph shown next to the service — rendered as literal text, never fetched as an image.",
|
|
268
|
+
"type": "string",
|
|
269
|
+
"minLength": 1,
|
|
270
|
+
"maxLength": 32
|
|
271
|
+
},
|
|
272
|
+
"order": {
|
|
273
|
+
"description": "Sort position among services in the dashboard (ascending). Services without an order sort after those with one.",
|
|
274
|
+
"type": "integer",
|
|
275
|
+
"minimum": 0,
|
|
276
|
+
"maximum": 9007199254740991
|
|
277
|
+
},
|
|
278
|
+
"port": {
|
|
279
|
+
"type": "integer",
|
|
280
|
+
"minimum": 1,
|
|
281
|
+
"maximum": 65535
|
|
282
|
+
},
|
|
283
|
+
"share": {
|
|
284
|
+
"default": "public",
|
|
285
|
+
"description": "Who may open the service's public URL. \"public\": anyone with the link. \"authenticated\": members of the organization that owns the VM. \"owner\": only the user who created the VM (platform admins always allowed). Only meaningful when `url` is true.",
|
|
286
|
+
"type": "string",
|
|
287
|
+
"enum": [
|
|
288
|
+
"public",
|
|
289
|
+
"authenticated",
|
|
290
|
+
"owner"
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
"url": {
|
|
294
|
+
"default": false,
|
|
295
|
+
"type": "boolean"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"setup": {
|
|
301
|
+
"default": [],
|
|
302
|
+
"type": "array",
|
|
303
|
+
"items": {
|
|
304
|
+
"type": "string"
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"size": {
|
|
308
|
+
"anyOf": [
|
|
309
|
+
{
|
|
310
|
+
"type": "string",
|
|
311
|
+
"enum": [
|
|
312
|
+
"nano",
|
|
313
|
+
"tiny",
|
|
314
|
+
"small",
|
|
315
|
+
"medium",
|
|
316
|
+
"large"
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"type": "object",
|
|
321
|
+
"properties": {
|
|
322
|
+
"disk": {
|
|
323
|
+
"type": "string",
|
|
324
|
+
"pattern": "^\\d+(?:mb|gb)$"
|
|
325
|
+
},
|
|
326
|
+
"ram": {
|
|
327
|
+
"type": "string",
|
|
328
|
+
"pattern": "^\\d+(?:mb|gb)$"
|
|
329
|
+
},
|
|
330
|
+
"vcpu": {
|
|
331
|
+
"type": "integer",
|
|
332
|
+
"minimum": 1,
|
|
333
|
+
"maximum": 64
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
"required": [
|
|
337
|
+
"disk",
|
|
338
|
+
"ram",
|
|
339
|
+
"vcpu"
|
|
340
|
+
]
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
"sleep_after": {
|
|
345
|
+
"anyOf": [
|
|
346
|
+
{
|
|
347
|
+
"type": "string",
|
|
348
|
+
"const": "never"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"type": "string",
|
|
352
|
+
"pattern": "^[0-9]+(?:m|h)$"
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
"troubleshootingUrl": {
|
|
357
|
+
"type": "string",
|
|
358
|
+
"format": "uri"
|
|
359
|
+
},
|
|
360
|
+
"version": {
|
|
361
|
+
"type": "string",
|
|
362
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+$"
|
|
363
|
+
},
|
|
364
|
+
"warmup": {
|
|
365
|
+
"default": [],
|
|
366
|
+
"type": "array",
|
|
367
|
+
"items": {
|
|
368
|
+
"type": "string"
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"description": "homemade.dev project configuration (.homemade/config.jsonc with comments and trailing commas, or strict .homemade/config.json).",
|
|
373
|
+
"title": "homemade.dev project config"
|
|
374
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/** Per-service HTTP healthcheck. Requires `port`. */
|
|
2
|
+
export interface HomemadeServiceHealthcheck {
|
|
3
|
+
/** Seconds between probes. Default 5. */
|
|
4
|
+
interval?: number;
|
|
5
|
+
/** HTTP path probed on the service's own port (`http://127.0.0.1:{port}{path}`). Default "/". */
|
|
6
|
+
path?: string;
|
|
7
|
+
/** Consecutive failing probes before flipping unhealthy; any success flips back healthy. Default 6. */
|
|
8
|
+
threshold?: number;
|
|
9
|
+
}
|
|
10
|
+
/** One entry of the `services` map. */
|
|
11
|
+
export interface HomemadeServiceConfig {
|
|
12
|
+
/** Start `cmd` automatically at boot (default true); false just documents how to run it. */
|
|
13
|
+
autostart?: boolean;
|
|
14
|
+
/** Command typed into a plain terminal session at boot; omit for a pure port/URL claim. */
|
|
15
|
+
cmd?: string;
|
|
16
|
+
/** Human-friendly name shown instead of the service key in the dashboard. */
|
|
17
|
+
displayName?: string;
|
|
18
|
+
/** Probe the service over localhost HTTP; any status below 500 counts as up (reported on the VM's runtime status). Requires `port`. */
|
|
19
|
+
healthcheck?: HomemadeServiceHealthcheck;
|
|
20
|
+
/** Hide from the quick-open dropdown and status panel; does not affect autostart or open tabs. */
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
/** Short text/emoji glyph shown next to the service — rendered as literal text, never fetched as an image. */
|
|
23
|
+
icon?: string;
|
|
24
|
+
/** Sort position among services in the dashboard (ascending); unordered services sort last. */
|
|
25
|
+
order?: number;
|
|
26
|
+
/** Routed port (1–65535). */
|
|
27
|
+
port?: number;
|
|
28
|
+
/** Who may open the service's public URL (default "public"): "public"=anyone with link, "authenticated"=org
|
|
29
|
+
* members, "owner"=creator only (admins always allowed). Only when `url` is true. */
|
|
30
|
+
share?: "public" | "authenticated" | "owner";
|
|
31
|
+
/** true → the service gets a public `{project-slug}-{vm-slug}-{port}-{org-slug}` URL. Requires `port`. */
|
|
32
|
+
url?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* One direction's entries: Egress (IPv4/CIDR/domain), Ingress (IPv4/IPv6/CIDR only).
|
|
36
|
+
*/
|
|
37
|
+
export interface HomemadeNetworkDirection {
|
|
38
|
+
/** Present ⇒ default-deny this direction: only these entries are allowed. */
|
|
39
|
+
allow?: string[];
|
|
40
|
+
/** Always wins over `allow`, even for an entry present in both. */
|
|
41
|
+
deny?: string[];
|
|
42
|
+
}
|
|
43
|
+
/** Network egress/ingress policy. Omitted entirely = allow everything (current default). */
|
|
44
|
+
export interface HomemadeNetworkConfig {
|
|
45
|
+
/** Outbound policy. Domain matching is exact — see HomemadeNetworkDirection. */
|
|
46
|
+
egress?: HomemadeNetworkDirection;
|
|
47
|
+
/** Inbound policy, matched against the connecting client's IP. */
|
|
48
|
+
ingress?: HomemadeNetworkDirection;
|
|
49
|
+
}
|
|
50
|
+
/** Repo-declared agent customization; brings this repo's agent guidance along when cloned. */
|
|
51
|
+
export interface HomemadeAgentConfig {
|
|
52
|
+
/** Free text appended as the narrowest "repo" section under any dashboard-authored instructions — scopes stitch together, never replace. */
|
|
53
|
+
instructions?: string;
|
|
54
|
+
/** Skill refs ("owner/repo" or "owner/repo#ref"); validated for shape only, not consumed yet. */
|
|
55
|
+
skills?: string[];
|
|
56
|
+
}
|
|
57
|
+
/** One `env_schema` entry in its object form. */
|
|
58
|
+
export interface HomemadeEnvSchemaEntry {
|
|
59
|
+
/** The environment variable name. */
|
|
60
|
+
key: string;
|
|
61
|
+
/** Deliver value to the throwaway warmup VM before the snapshot is taken (default false; for install-time
|
|
62
|
+
* registry tokens). Baked in — rotating retires it. Org/project-scoped only, never VM-scoped. */
|
|
63
|
+
warmup?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** The homemade.dev project config (`.homemade/config.*`). */
|
|
66
|
+
/** A named machine size (HM-770). Prices per running hour are on homemade.dev/pricing. */
|
|
67
|
+
export type HomemadeMachineSize = "large" | "medium" | "nano" | "small" | "tiny";
|
|
68
|
+
/** A custom machine shape, Enterprise only. */
|
|
69
|
+
export interface HomemadeCustomMachineSize {
|
|
70
|
+
/** Like "200gb", up to 1000 GB. */
|
|
71
|
+
disk: string;
|
|
72
|
+
/** Like "64gb", up to 256 GB. */
|
|
73
|
+
ram: string;
|
|
74
|
+
/** 1–64. */
|
|
75
|
+
vcpu: number;
|
|
76
|
+
}
|
|
77
|
+
export interface HomemadeConfig {
|
|
78
|
+
/** Editor tooling pointer; ignored by the platform. */
|
|
79
|
+
$schema?: string;
|
|
80
|
+
/** Repo-declared agent customization. See HomemadeAgentConfig. */
|
|
81
|
+
agent?: HomemadeAgentConfig;
|
|
82
|
+
/** Pin the exact homemade-base version to build FROM (e.g. "0.2.5"); omitted = latest at build time. */
|
|
83
|
+
base?: string;
|
|
84
|
+
/** docker-compose passthrough: run this file instead of `services`. */
|
|
85
|
+
compose?: string;
|
|
86
|
+
/** Documented/validated env var keys: a bare name, or an object marking it warmup-safe. */
|
|
87
|
+
env_schema?: (string | HomemadeEnvSchemaEntry)[];
|
|
88
|
+
/** Boot-time commands, run with the full repo present — best-effort, never gates startup. */
|
|
89
|
+
install?: string[];
|
|
90
|
+
/** Egress/ingress network policy; omitted = allow everything. Declaring `allow` switches that direction to default-deny; `deny` always wins. */
|
|
91
|
+
network?: HomemadeNetworkConfig;
|
|
92
|
+
/** Create-time knobs rendered in the New VM dialog, delivered as `HOMEMADE_PARAM_<NAME>` env vars. Not for secrets. */
|
|
93
|
+
parameters?: HomemadeParameterConfig[];
|
|
94
|
+
/** Services supervised at runtime. Mutually exclusive with `compose`. */
|
|
95
|
+
services?: Record<string, HomemadeServiceConfig>;
|
|
96
|
+
/** The machine size new VMs start on: "nano" | "tiny" | "small" | "medium" | "large", or a custom
|
|
97
|
+
* `{ vcpu, ram, disk }` shape (Enterprise only). Omitted = medium (Hobby: tiny). The New VM sheet can
|
|
98
|
+
* still pick another named size. */
|
|
99
|
+
size?: HomemadeMachineSize | HomemadeCustomMachineSize;
|
|
100
|
+
/** Build-time commands, baked into the template. Runs before repo code is copied in (only dependency
|
|
101
|
+
* manifests exist yet) — commands needing source files belong in `install`. */
|
|
102
|
+
setup?: string[];
|
|
103
|
+
/** Auto-sleep countdown before suspend: a duration like "30m"/"2h" (10–1440 min), or "never". Omitted = project/plan default. */
|
|
104
|
+
sleep_after?: string;
|
|
105
|
+
/** Project-owned runbook shown when a best-effort boot step fails. */
|
|
106
|
+
troubleshootingUrl?: string;
|
|
107
|
+
/** Optional pin for the config-format semver (e.g. "1.0.0"); overrides everything. Omitted, falls back to
|
|
108
|
+
* the installed @homemadedev/config version, then latest supported. Newer-than-platform configs are rejected. */
|
|
109
|
+
version?: string;
|
|
110
|
+
/** Commands run once on the builder before the warm snapshot is taken. */
|
|
111
|
+
warmup?: string[];
|
|
112
|
+
}
|
|
113
|
+
/** One selectable value for a `select`-type parameter. */
|
|
114
|
+
export interface HomemadeParameterOption {
|
|
115
|
+
/** Muted helper text shown under the option. */
|
|
116
|
+
description?: string;
|
|
117
|
+
/** Display label; falls back to `value` when omitted. */
|
|
118
|
+
label?: string;
|
|
119
|
+
/** The stored/delivered value. */
|
|
120
|
+
value: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Regex/range validation with templated error message (`{value}`, `{min}`, `{max}` placeholders).
|
|
124
|
+
*/
|
|
125
|
+
export interface HomemadeParameterValidation {
|
|
126
|
+
errorMessage?: string;
|
|
127
|
+
max?: number;
|
|
128
|
+
min?: number;
|
|
129
|
+
regex?: string;
|
|
130
|
+
}
|
|
131
|
+
/** One create-time parameter (HM-125): New VM dialog control as `HOMEMADE_PARAM_<NAME>`. Not for secrets; use `env_vars` with `is_secret` instead. */
|
|
132
|
+
export interface HomemadeParameterConfig {
|
|
133
|
+
/** Must match `type` (a select default must be one of `options`). */
|
|
134
|
+
default?: string | number | boolean;
|
|
135
|
+
description?: string;
|
|
136
|
+
/** Plain optional label glyph, rendered as literal text if at all; no icon rendering in v1. */
|
|
137
|
+
icon?: string;
|
|
138
|
+
/** Starts with a letter; letters/digits/`_` only (max 64 chars). */
|
|
139
|
+
name: string;
|
|
140
|
+
/** Required when `type` is `"select"`; unused otherwise. */
|
|
141
|
+
options?: HomemadeParameterOption[];
|
|
142
|
+
/** Blocks VM creation without a value — moot when `default` is set. */
|
|
143
|
+
required?: boolean;
|
|
144
|
+
type: "string" | "number" | "boolean" | "select";
|
|
145
|
+
validation?: HomemadeParameterValidation;
|
|
146
|
+
}
|
|
147
|
+
/** Identity helper giving `.homemade/config.ts`/`config.js` full typing; the config module's default export must be the value this returns. */
|
|
148
|
+
export declare const config: (value: HomemadeConfig) => HomemadeConfig;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Public npm package (@homemadedev/config): typed authoring surface for
|
|
2
|
+
// `.homemade/config.ts`/`config.js`. Dependency-free — the platform validates
|
|
3
|
+
// with its own Zod schema (@homemade/schemas), kept in lockstep by a compile-time test.
|
|
4
|
+
/** Identity helper giving `.homemade/config.ts`/`config.js` full typing; the config module's default export must be the value this returns. */
|
|
5
|
+
export const config = (value) => value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homemadedev/config",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Typed config() helper and JSON schema for homemade.dev project configs (.homemade/config.ts, config.js, config.jsonc or config.json)",
|
|
5
|
+
"homepage": "https://homemade.dev",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/usehomemade/homemade-dev.git",
|
|
10
|
+
"directory": "packages/config"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"configuration_schema.json"
|
|
15
|
+
],
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./configuration_schema.json": "./configuration_schema.json",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsx scripts/generate-schema.ts && tsc -p tsconfig.build.json",
|
|
32
|
+
"check": "tsc --noEmit",
|
|
33
|
+
"prepublishOnly": "pnpm build",
|
|
34
|
+
"test": "vitest run"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@homemade/schemas": "workspace:*",
|
|
38
|
+
"@homemade/vitest-config": "workspace:*",
|
|
39
|
+
"@types/node": "~26.6.6",
|
|
40
|
+
"tsx": "^4.23.15",
|
|
41
|
+
"typescript": "^7.0.2",
|
|
42
|
+
"vitest": "^5.0.5",
|
|
43
|
+
"zod": "catalog:"
|
|
44
|
+
}
|
|
45
|
+
}
|