Open
Conversation
|
Do we really need the |
Member
Author
Not really, we could skip the TUI if parameters are provided? Less to input |
Collaborator
💔 Build Failed
Failed CI StepsHistory
|
jsoriano
reviewed
Mar 5, 2026
Member
jsoriano
left a comment
There was a problem hiding this comment.
Nice, thanks! Added some suggestions about the help strings.
| Args: cobra.NoArgs, | ||
| RunE: createPackageCommandAction, | ||
| } | ||
| createPackageCmd.Flags().String(createPackageTypeFlag, "integration", "package type (input, integration, content); when set the TUI wizard is skipped") |
Member
There was a problem hiding this comment.
TUI is an implementation detail that we don't need to expose to users.
Suggested change
| createPackageCmd.Flags().String(createPackageTypeFlag, "integration", "package type (input, integration, content); when set the TUI wizard is skipped") | |
| createPackageCmd.Flags().String(createPackageTypeFlag, "integration", "set to input, integration or content to create an empty package of the given type in a non-interactive way") |
| RunE: createPackageCommandAction, | ||
| } | ||
| createPackageCmd.Flags().String(createPackageTypeFlag, "integration", "package type (input, integration, content); when set the TUI wizard is skipped") | ||
| createPackageCmd.Flags().String(createPackageNameFlag, "new_package", "package name; when set the TUI wizard is skipped") |
Member
There was a problem hiding this comment.
Suggested change
| createPackageCmd.Flags().String(createPackageNameFlag, "new_package", "package name; when set the TUI wizard is skipped") | |
| createPackageCmd.Flags().String(createPackageNameFlag, "new_package", "set to create an empty package with the given name in a non-interactive way") |
Comment on lines
+45
to
+47
| createDataStreamCmd.Flags().String(createDataStreamNameFlag, "new_data_stream", "data stream name; when set the TUI wizard is skipped") | ||
| createDataStreamCmd.Flags().String(createDataStreamTypeFlag, "logs", "data stream type (logs, metrics); when set the TUI wizard is skipped") | ||
| createDataStreamCmd.Flags().StringSlice(createDataStreamInputsFlag, nil, "input types for logs data streams (e.g. filestream,tcp); when set the TUI wizard is skipped") |
Member
There was a problem hiding this comment.
Please review these descriptions too to avoid references to TUI.
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.
Add CLI flag support to
create packageandcreate data-streamcommandsSummary
Adds optional CLI flags to
create packageandcreate data-stream, allowing them to run without the TUI wizard — enabling automation, scripts, and LLM agents to create packages and data streams deterministically.When any flag is explicitly passed, the TUI is skipped automatically.
Only flags required to make template decisions (package type, data stream type, input types) were added. All other fields use sensible production defaults.
Also fixes a minor YAML indentation bug in
VarValueYamlStringwhere multi-line block scalars (e.g.syslog_options,ssldefaults) lost their relative indentation when rendered into data stream manifests, causing newly created packages to fail format/lint checks.Changes
internal/packages/packages.goCentralizes type definitions and fixes YAML rendering:
AllowedPackageTypes,AllowedDataStreamTypes, andAllowedLogsInputTypesso the TUI wizard, CLI validation, and manifest checks all share a single source of truthVarValueYamlString: multi-line YAML values were losing indentation on continuation lines because only the first line inherited the template's base indentation — now pads continuation lines bynumSpacesso relative indentation stays validisPackageManifestreusesAllowedPackageTypesinstead of a local duplicatecmd/create.goDeclares flag name constants and registers flags on both subcommands:
create package:--type,--namecreate data-stream:--type,--name,--inputscmd/create_package.goAdds
createPackageNonInteractive():--typeor--nameis passed (detected viacmd.Flags().Changed())--typeagainstpackages.AllowedPackageTypesand--nameagainst existing validators0.0.1, Elastic License 2.0,basicsubscription, etc.)cmd/create_data_stream.goAdds
createDataStreamNonInteractive():--name,--type, or--inputsis passed--nameand--type(validated againstpackages.AllowedDataStreamTypes)logs, requires--inputsvalidated againstpackages.AllowedLogsInputTypesmetrics, auto-enables synthetic source + time series modeAllowedLogsInputTypesmap for both option keys and description labelsTests
Covers descriptor construction, type validation, survey questions, and YAML rendering:
cmd/create_package_test.go— Package descriptor construction andAllowedPackageTypesvalidationcmd/create_data_stream_test.go— Data stream descriptor construction, input type validation, and survey question generation per spec versioninternal/packages/packages_test.go—TestVarValueYamlStringcovering scalars, lists, custom indentation, and a regression test simulating template embedding at indent 6Usage