feat: add a --format flag for init and export output - #421
Merged
josegonzalez merged 1 commit intoAug 7, 2026
Conversation
`init` and `export` inferred the recipe format from the `--output` extension, which left `--output -` able to emit YAML and nothing else. `--format yaml|json5` states the format outright and always wins, so a JSON5-native user can finally pipe a recipe out as well as in: `docket export --output - --format json5 | docket apply --tasks-format json5 -`. Because writing JSON5 into a file named `tasks.yml` produces something the YAML parser cannot read back, `--format json5` with no explicit `--output` moves the default to `tasks.json`, and export's companion vars-file to `tasks.vars.json`. A path the user typed is never rewritten; when its extension then disagrees with the bytes, a warning names the `--tasks-format` needed to read it back. On export the flag governs the vars-file too, while a vars-file with no `--format` keeps following its own extension. `parseTasksFormatFlag` becomes `parseRecipeFormatFlag`, taking the flag name so `--format` and `--tasks-format` each blame themselves, and the shared completion predictor is renamed to match. `format` is deliberately not reserved as an input name: only apply, plan, and validate register recipe inputs as flags. Closes #410. Carved out as follow-ups: #418 for cross-format conversion in `fmt`, #419 for `--vars-output` being ignored under `--output -`, and #420 for init's next-steps block naming the recipe it wrote.
josegonzalez
deleted the
410-add-a-format-flag-for-init-and-export-output
branch
August 7, 2026 06:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
initandexportinferred the recipe format from the--outputextension, which left--output -able to emit YAML and nothing else.--format yaml|json5states the format outright and always wins, so a JSON5-native user can finally pipe a recipe out as well as in:docket export --output - --format json5 | docket apply --tasks-format json5 -. Because writing JSON5 into a file namedtasks.ymlproduces something the YAML parser cannot read back,--format json5with no explicit--outputmoves the default totasks.json, and export's companion vars-file totasks.vars.json. A path the user typed is never rewritten; when its extension then disagrees with the bytes, a warning names the--tasks-formatneeded to read it back. On export the flag governs the vars-file too, while a vars-file with no--formatkeeps following its own extension.parseTasksFormatFlagbecomesparseRecipeFormatFlag, taking the flag name so--formatand--tasks-formateach blame themselves, and the shared completion predictor is renamed to match.formatis deliberately not reserved as an input name: only apply, plan, and validate register recipe inputs as flags.Closes #410. Carved out as follow-ups: #418 for cross-format conversion in
fmt, #419 for--vars-outputbeing ignored under--output -, and #420 for init's next-steps block naming the recipe it wrote.