Skip to content

Commit 58037e3

Browse files
feat: add YAML plugin to dprint formatter
Add pretty_yaml plugin covering both .yaml and .yml files. Exclude Helm templates directory (Go template syntax is not valid YAML). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4273fe7 commit 58037e3

14 files changed

Lines changed: 133 additions & 85 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- `urlencode` template filter for percent-encoding strings in URLs. Useful for embedding passwords or other values containing URL-reserved characters (`@`, `%`, `:`, `/`, etc.) in connection strings.
13-
- `dprint` formatter for Markdown, JSON, TOML, and Dockerfile with CI check (`dprint/check@v2.2`) and definition-of-done gate.
13+
- `dprint` formatter for Markdown, JSON, TOML, YAML, and Dockerfile with CI check (`dprint/check@v2.2`) and definition-of-done gate.
1414

1515
### Changed
1616

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Definition of done
121121
- Code compiles without warnings.
122122
- Code is linted.
123123
- Code is formatted.
124-
- `dprint check` passes with no issues (Markdown, JSON, TOML, Dockerfile).
124+
- `dprint check` passes with no issues (Markdown, JSON, TOML, YAML, Dockerfile).
125125
- Tests pass.
126126
- Docs updated.
127127
- CHANGELOG updated.

FAQ.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ No. Initium is designed for the most restrictive Kubernetes security posture:
237237
```yaml
238238
securityContext:
239239
runAsNonRoot: true
240-
runAsUser: 65534 # nobody
240+
runAsUser: 65534 # nobody
241241
runAsGroup: 65534
242242
readOnlyRootFilesystem: true
243243
allowPrivilegeEscalation: false
@@ -275,7 +275,12 @@ To prevent man-in-the-middle attacks. If you connect to `https://vault:8200`, In
275275
If you need to connect to a service with a self-signed certificate (common in dev/staging), explicitly opt in:
276276

277277
```yaml
278-
args: ["wait-for", "--target", "https://vault:8200/v1/sys/health", "--insecure-tls"]
278+
args: [
279+
"wait-for",
280+
"--target",
281+
"https://vault:8200/v1/sys/health",
282+
"--insecure-tls",
283+
]
279284
```
280285

281286
The `--insecure-tls` flag is intentionally verbose — it should stand out in code review.
@@ -361,7 +366,15 @@ spec:
361366
initContainers:
362367
- name: render-config
363368
image: ghcr.io/kitstream/initium:latest
364-
args: ["render", "--template", "/templates/app.conf.tmpl", "--output", "app.conf", "--workdir", "/work"]
369+
args: [
370+
"render",
371+
"--template",
372+
"/templates/app.conf.tmpl",
373+
"--output",
374+
"app.conf",
375+
"--workdir",
376+
"/work",
377+
]
365378
volumeMounts:
366379
- name: workdir
367380
mountPath: /work

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,15 @@ Use the `render` subcommand with environment variable substitution:
214214
initContainers:
215215
- name: render-config
216216
image: ghcr.io/kitstream/initium:latest
217-
args: ["render", "--template", "/templates/app.conf.tmpl", "--output", "app.conf", "--workdir", "/work"]
217+
args: [
218+
"render",
219+
"--template",
220+
"/templates/app.conf.tmpl",
221+
"--output",
222+
"app.conf",
223+
"--workdir",
224+
"/work",
225+
]
218226
env:
219227
- name: DB_HOST
220228
value: postgres
@@ -249,7 +257,12 @@ Output: `{"time":"2025-01-15T10:30:00Z","level":"INFO","msg":"target is reachabl
249257
Use `--insecure-tls` (must be explicitly opted in):
250258

251259
```yaml
252-
args: ["wait-for", "--target", "https://vault:8200/v1/sys/health", "--insecure-tls"]
260+
args: [
261+
"wait-for",
262+
"--target",
263+
"https://vault:8200/v1/sys/health",
264+
"--insecure-tls",
265+
]
253266
```
254267

255268
### Can I use Initium outside Kubernetes?

charts/initium/Chart.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ keywords:
1616
- wait
1717
- migration
1818
- kubernetes
19-

charts/initium/values.yaml

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,49 +37,48 @@ sampleDeployment:
3737
#
3838
# Example: wait for Postgres, render config, then run migration
3939
initContainers:
40-
# - name: wait-for-postgres
41-
# command: ["wait-for"]
42-
# args:
43-
# - --target
44-
# - tcp://postgres:5432
45-
# - --timeout
46-
# - "120s"
47-
# - --max-attempts
48-
# - "30"
40+
# - name: wait-for-postgres
41+
# command: ["wait-for"]
42+
# args:
43+
# - --target
44+
# - tcp://postgres:5432
45+
# - --timeout
46+
# - "120s"
47+
# - --max-attempts
48+
# - "30"
4949

50-
# - name: render-config
51-
# command: ["render"]
52-
# args:
53-
# - --template
54-
# - /templates/app.conf.tmpl
55-
# - --output
56-
# - config/app.conf
57-
# - --workdir
58-
# - /work
59-
# env:
60-
# - name: DB_HOST
61-
# value: postgres
62-
# - name: DB_PORT
63-
# value: "5432"
50+
# - name: render-config
51+
# command: ["render"]
52+
# args:
53+
# - --template
54+
# - /templates/app.conf.tmpl
55+
# - --output
56+
# - config/app.conf
57+
# - --workdir
58+
# - /work
59+
# env:
60+
# - name: DB_HOST
61+
# value: postgres
62+
# - name: DB_PORT
63+
# value: "5432"
6464

65-
# - name: run-migration
66-
# command: ["migrate"]
67-
# args:
68-
# - --
69-
# - /usr/bin/flyway
70-
# - migrate
71-
# env:
72-
# - name: FLYWAY_URL
73-
# value: jdbc:postgresql://postgres:5432/mydb
65+
# - name: run-migration
66+
# command: ["migrate"]
67+
# args:
68+
# - --
69+
# - /usr/bin/flyway
70+
# - migrate
71+
# env:
72+
# - name: FLYWAY_URL
73+
# value: jdbc:postgresql://postgres:5432/mydb
7474

7575
# Additional volumes to mount into initContainers
7676
extraVolumes: []
77-
# - name: templates
78-
# configMap:
79-
# name: app-templates
77+
# - name: templates
78+
# configMap:
79+
# name: app-templates
8080

8181
extraVolumeMounts: []
82-
# - name: templates
83-
# mountPath: /templates
84-
# readOnly: true
85-
82+
# - name: templates
83+
# mountPath: /templates
84+
# readOnly: true

docs/seeding.md

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,37 @@ The seed spec file defines the complete seeding plan. Both YAML and JSON formats
3131

3232
```yaml
3333
database:
34-
driver: postgres # Required. One of: postgres, mysql, sqlite
35-
url: "postgres://..." # Direct database URL
36-
url_env: DATABASE_URL # Or: name of env var containing the URL
37-
tracking_table: initium_seed # Default: "initium_seed"
34+
driver: postgres # Required. One of: postgres, mysql, sqlite
35+
url: "postgres://..." # Direct database URL
36+
url_env: DATABASE_URL # Or: name of env var containing the URL
37+
tracking_table: initium_seed # Default: "initium_seed"
3838

3939
phases:
40-
- name: setup # Required. Phase name.
41-
order: 1 # Optional. Execution order (default: 0).
42-
database: reporting # Optional. Database to target/create.
43-
schema: analytics # Optional. Schema to target/create.
44-
create_if_missing: true # Optional. Create database/schema if missing.
45-
timeout: 30s # Optional. Default wait timeout (e.g. 30s, 1m; default: 30s).
46-
wait_for: # Optional. Objects to wait for before seeding.
47-
- type: table # One of: table, view, schema, database.
40+
- name: setup # Required. Phase name.
41+
order: 1 # Optional. Execution order (default: 0).
42+
database: reporting # Optional. Database to target/create.
43+
schema: analytics # Optional. Schema to target/create.
44+
create_if_missing: true # Optional. Create database/schema if missing.
45+
timeout: 30s # Optional. Default wait timeout (e.g. 30s, 1m; default: 30s).
46+
wait_for: # Optional. Objects to wait for before seeding.
47+
- type: table # One of: table, view, schema, database.
4848
name: users
49-
timeout: 60s # Optional. Per-object timeout override.
50-
seed_sets: # Optional. Seed sets to apply in this phase.
49+
timeout: 60s # Optional. Per-object timeout override.
50+
seed_sets: # Optional. Seed sets to apply in this phase.
5151
- name: initial_data
52-
order: 1 # Optional. Controls execution order across seed sets.
53-
mode: once # Optional. "once" (default) or "reconcile".
52+
order: 1 # Optional. Controls execution order across seed sets.
53+
mode: once # Optional. "once" (default) or "reconcile".
5454
tables:
5555
- table: config
56-
order: 1 # Optional. Controls execution order within a seed set.
57-
unique_key: [email] # Optional. Columns used for duplicate detection.
58-
auto_id: # Optional. Auto-generated ID configuration.
59-
column: id # Column name for the auto-generated ID.
60-
id_type: integer # ID type (default: integer).
56+
order: 1 # Optional. Controls execution order within a seed set.
57+
unique_key: [
58+
email,
59+
] # Optional. Columns used for duplicate detection.
60+
auto_id: # Optional. Auto-generated ID configuration.
61+
column: id # Column name for the auto-generated ID.
62+
id_type: integer # ID type (default: integer).
6163
rows:
62-
- _ref: row_alias # Optional. Internal reference name for this row.
64+
- _ref: row_alias # Optional. Internal reference name for this row.
6365
key: app_name
6466
value: "{{ env.APP_NAME }}"
6567
```
@@ -176,7 +178,7 @@ tables:
176178
unique_key: [email]
177179
rows:
178180
- name: Alice
179-
email: alice@example.com # Skipped if email already exists
181+
email: alice@example.com # Skipped if email already exists
180182
```
181183

182184
### Auto-Generated IDs and Cross-Table References
@@ -194,15 +196,15 @@ phases:
194196
auto_id:
195197
column: id
196198
rows:
197-
- _ref: dept_eng # Name this row for later reference
199+
- _ref: dept_eng # Name this row for later reference
198200
name: Engineering
199201
200202
- table: employees
201203
order: 2
202204
rows:
203205
- name: Alice
204206
email: alice@example.com
205-
department_id: "@ref:dept_eng.id" # Resolves to the generated ID
207+
department_id: "@ref:dept_eng.id" # Resolves to the generated ID
206208
```
207209

208210
### Environment Variable Substitution
@@ -226,10 +228,10 @@ Enable reconcile mode per seed set:
226228
```yaml
227229
seed_sets:
228230
- name: departments
229-
mode: reconcile # "once" (default) or "reconcile"
231+
mode: reconcile # "once" (default) or "reconcile"
230232
tables:
231233
- table: departments
232-
unique_key: [name] # Required for reconcile mode
234+
unique_key: [name] # Required for reconcile mode
233235
rows:
234236
- name: Engineering
235237
- name: Sales

docs/usage.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,17 @@ initContainers:
338338
- name: generate-key
339339
image: my-registry/initium-openssl:latest
340340
command: ["initium"]
341-
args: ["exec", "--workdir", "/certs", "--", "openssl", "genrsa", "-out", "key.pem", "4096"]
341+
args: [
342+
"exec",
343+
"--workdir",
344+
"/certs",
345+
"--",
346+
"openssl",
347+
"genrsa",
348+
"-out",
349+
"key.pem",
350+
"4096",
351+
]
342352
volumeMounts:
343353
- name: certs
344354
mountPath: /certs
@@ -359,7 +369,13 @@ initContainers:
359369
- name: transform-config
360370
image: ghcr.io/kitstream/initium-jyq:latest
361371
command: ["initium"]
362-
args: ["exec", "--", "jq", ".database.host = \"db.prod\"", "/config/app.json"]
372+
args: [
373+
"exec",
374+
"--",
375+
"jq",
376+
".database.host = \"db.prod\"",
377+
"/config/app.json",
378+
]
363379
```
364380

365381
## Global Flags

dprint.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
2-
"includes": ["**/*.md", "**/*.json", "**/*.toml", "**/Dockerfile", "**/Dockerfile.*"],
3-
"excludes": ["target/", "node_modules/"],
2+
"includes": ["**/*.md", "**/*.json", "**/*.toml", "**/*.yaml", "**/*.yml", "**/Dockerfile", "**/Dockerfile.*"],
3+
"excludes": ["target/", "node_modules/", "charts/**/templates/"],
44
"dockerfile": {
55
"associations": ["**/Dockerfile", "**/Dockerfile.*"]
66
},
77
"plugins": [
88
"https://plugins.dprint.dev/markdown-0.17.8.wasm",
99
"https://plugins.dprint.dev/json-0.21.1.wasm",
1010
"https://plugins.dprint.dev/toml-0.7.0.wasm",
11-
"https://plugins.dprint.dev/dockerfile-0.3.3.wasm"
11+
"https://plugins.dprint.dev/dockerfile-0.3.3.wasm",
12+
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.6.0.wasm"
1213
]
1314
}

examples/config-render/deployment.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,3 @@ spec:
8585
- name: templates
8686
configMap:
8787
name: app-template
88-

0 commit comments

Comments
 (0)