Skip to content

Commit 85c06b9

Browse files
kvzclaude
andcommitted
fix: handle templates with no steps in sync download
When downloading a template that has no steps defined, `result.content.steps` is undefined. JSON.stringify strips undefined values, so after writing and reading the file back, the `steps` property would be missing. Use nullish coalescing to default to empty object: `steps ?? {}` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 447f73f commit 85c06b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/cli/templates.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ export async function sync(
317317

318318
const result = await client.getTemplate(templateId)
319319

320-
template.data.steps = result.content.steps
320+
// Use empty object if template has no steps (undefined would be stripped by JSON.stringify)
321+
template.data.steps = result.content.steps ?? {}
321322
const file = path.join(path.dirname(template.file), `${result.name}.json`)
322323

323324
await fsp.writeFile(template.file, JSON.stringify(template.data))

0 commit comments

Comments
 (0)