Skip to content

Commit e4d1381

Browse files
fix(deps): update rust crate kdl to v6 (#59)
* fix(deps): update rust crate kdl to v6 * fix: update code for kdl v6 API compatibility - Remove .value() calls as node.get() now returns Option<&KdlValue> directly - Update KDL boolean syntax from use-outputs=true to use-outputs=#true - Fix all tests, fixtures, and documentation to use proper KDL v6 syntax --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Pedro Piñera <pedro@pepicrft.me>
1 parent e26b320 commit e4d1381

File tree

8 files changed

+108
-51
lines changed

8 files changed

+108
-51
lines changed

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ Fabrik provides **content-addressed caching for arbitrary scripts** (bash, node,
992992
#FABRIK input "package.json"
993993
#FABRIK output "dist/"
994994
#FABRIK env "NODE_ENV"
995-
#FABRIK depends "./build-deps.sh" use-outputs=true
995+
#FABRIK depends "./build-deps.sh" use-outputs=#true
996996

997997
# Build TypeScript project
998998
npm run build
@@ -1004,7 +1004,7 @@ npm run build
10041004
- `#FABRIK output "path"` - Declare output paths to archive/restore (files or directories)
10051005
- `#FABRIK env "VAR_NAME"` - Track environment variable (invalidates cache when value changes)
10061006
- `#FABRIK depends "script.sh"` - Declare dependency on another script
1007-
- `#FABRIK depends "script.sh" use-outputs=true` - Add dependency outputs as inputs
1007+
- `#FABRIK depends "script.sh" use-outputs=#true` - Add dependency outputs as inputs
10081008
- `#FABRIK cache disable` - Disable caching for this script
10091009
- `#FABRIK cache ttl="7d"` - Set cache expiration (e.g., "2h", "7d", "30d")
10101010
- `#FABRIK cache key="custom"` - Override cache key computation

Cargo.lock

Lines changed: 87 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ num_cpus = "1.16"
2626
crossbeam-channel = "0.5"
2727
sha2 = "0.10"
2828
hex = "0.4"
29-
kdl = "4.6"
29+
kdl = "6.0"
3030
glob = "0.3"
3131
tar = "0.4"
3232
zstd = "0.13"

docs/cache/scripts/examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ npm ci
160160
# build.sh
161161
#FABRIK input "src/**/*.ts"
162162
#FABRIK input "tsconfig.json"
163-
#FABRIK depends "./install.sh" use-outputs=true
163+
#FABRIK depends "./install.sh" use-outputs=#true
164164
#FABRIK output "dist/"
165165

166166
npm run build
@@ -171,7 +171,7 @@ npm run build
171171
#!/usr/bin/env bash
172172
# test.sh
173173
#FABRIK input "tests/**/*.test.ts"
174-
#FABRIK depends "./build.sh" use-outputs=true
174+
#FABRIK depends "./build.sh" use-outputs=#true
175175
#FABRIK output "coverage/"
176176

177177
npm test -- --coverage

docs/cache/scripts/reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Declare dependencies on other scripts. Fabrik will execute dependencies before t
126126

127127
**With output reuse:**
128128
```bash
129-
#FABRIK depends "build-deps.sh" use-outputs=true
129+
#FABRIK depends "build-deps.sh" use-outputs=#true
130130
```
131131

132132
**Examples:**
@@ -135,14 +135,14 @@ Declare dependencies on other scripts. Fabrik will execute dependencies before t
135135
#FABRIK depends "./prepare.sh"
136136

137137
# Dependency with output reuse (adds dependency outputs as inputs)
138-
#FABRIK depends "./build-libs.sh" use-outputs=true
138+
#FABRIK depends "./build-libs.sh" use-outputs=#true
139139

140140
# Multiple dependencies
141141
#FABRIK depends "./step1.sh"
142142
#FABRIK depends "./step2.sh"
143143
```
144144

145-
**With `use-outputs=true`:**
145+
**With `use-outputs=#true`:**
146146
- Dependency's outputs are automatically added as inputs to current script
147147
- Ensures cache invalidation when dependency outputs change
148148
- Useful for build pipelines (build → test → deploy)
@@ -395,7 +395,7 @@ Here's a comprehensive example using multiple directives:
395395
#FABRIK output "build-stats.json"
396396
#FABRIK env "NODE_ENV"
397397
#FABRIK env "BUILD_TARGET"
398-
#FABRIK depends "./install-deps.sh" use-outputs=true
398+
#FABRIK depends "./install-deps.sh" use-outputs=#true
399399
#FABRIK cache ttl="24h"
400400
#FABRIK runtime-version
401401
#FABRIK exec timeout="10m"

fixtures/cache/scripts/bash/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env -S fabrik run bash
2-
#FABRIK depends "./build.sh" use-outputs=true
2+
#FABRIK depends "./build.sh" use-outputs=#true
33
#FABRIK input "build/"
44
#FABRIK output "deploy.log"
55
#FABRIK env "DEPLOY_ENV"

src/script/annotations.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ fn parse_kdl_node(annotations: &mut ScriptAnnotations, node: &KdlNode) -> Result
175175

176176
let hash = node
177177
.get("hash")
178-
.and_then(|e| e.value().as_string())
178+
.and_then(|e| e.as_string())
179179
.unwrap_or("content");
180180

181181
let hash_method = match hash {
@@ -202,7 +202,7 @@ fn parse_kdl_node(annotations: &mut ScriptAnnotations, node: &KdlNode) -> Result
202202

203203
let required = node
204204
.get("required")
205-
.and_then(|e| e.value().as_bool())
205+
.and_then(|e| e.as_bool())
206206
.unwrap_or(true);
207207

208208
annotations.outputs.push(OutputSpec { path, required });
@@ -218,13 +218,13 @@ fn parse_kdl_node(annotations: &mut ScriptAnnotations, node: &KdlNode) -> Result
218218
}
219219

220220
"cache" => {
221-
if let Some(ttl) = node.get("ttl").and_then(|e| e.value().as_string()) {
221+
if let Some(ttl) = node.get("ttl").and_then(|e| e.as_string()) {
222222
annotations.cache_ttl = Some(parse_duration(ttl)?);
223223
}
224-
if let Some(key) = node.get("key").and_then(|e| e.value().as_string()) {
224+
if let Some(key) = node.get("key").and_then(|e| e.as_string()) {
225225
annotations.cache_key = Some(key.to_string());
226226
}
227-
if let Some(disabled) = node.get("disabled").and_then(|e| e.value().as_bool()) {
227+
if let Some(disabled) = node.get("disabled").and_then(|e| e.as_bool()) {
228228
annotations.cache_disabled = disabled;
229229
}
230230
}
@@ -235,10 +235,7 @@ fn parse_kdl_node(annotations: &mut ScriptAnnotations, node: &KdlNode) -> Result
235235
annotations.runtime = runtime_name;
236236
}
237237

238-
if let Some(include) = node
239-
.get("include-version")
240-
.and_then(|e| e.value().as_bool())
241-
{
238+
if let Some(include) = node.get("include-version").and_then(|e| e.as_bool()) {
242239
annotations.runtime_version = include;
243240
}
244241
}
@@ -256,13 +253,13 @@ fn parse_kdl_node(annotations: &mut ScriptAnnotations, node: &KdlNode) -> Result
256253
}
257254

258255
"exec" => {
259-
if let Some(cwd) = node.get("cwd").and_then(|e| e.value().as_string()) {
256+
if let Some(cwd) = node.get("cwd").and_then(|e| e.as_string()) {
260257
annotations.exec_cwd = Some(PathBuf::from(cwd));
261258
}
262-
if let Some(timeout) = node.get("timeout").and_then(|e| e.value().as_string()) {
259+
if let Some(timeout) = node.get("timeout").and_then(|e| e.as_string()) {
263260
annotations.exec_timeout = Some(parse_duration(timeout)?);
264261
}
265-
if let Some(shell) = node.get("shell").and_then(|e| e.value().as_bool()) {
262+
if let Some(shell) = node.get("shell").and_then(|e| e.as_bool()) {
266263
annotations.exec_shell = shell;
267264
}
268265
}
@@ -273,7 +270,7 @@ fn parse_kdl_node(annotations: &mut ScriptAnnotations, node: &KdlNode) -> Result
273270

274271
let use_outputs = node
275272
.get("use-outputs")
276-
.and_then(|e| e.value().as_bool())
273+
.and_then(|e| e.as_bool())
277274
.unwrap_or(false);
278275

279276
annotations.depends_on.push(DependencySpec {

src/script/dependencies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ echo "build"
224224
fs::write(
225225
&main_script,
226226
r#"#!/usr/bin/env -S fabrik run bash
227-
#FABRIK depends "./dep.sh" use-outputs=true
227+
#FABRIK depends "./dep.sh" use-outputs=#true
228228
echo "deploy"
229229
"#,
230230
)

0 commit comments

Comments
 (0)