Skip to content

Add nextflow module generate-meta command#6859

Draft
jorgee wants to merge 3 commits into251117-module-system-implementationfrom
260220-generate-meta-yml
Draft

Add nextflow module generate-meta command#6859
jorgee wants to merge 3 commits into251117-module-system-implementationfrom
260220-generate-meta-yml

Conversation

@jorgee
Copy link
Contributor

@jorgee jorgee commented Feb 24, 2026

Summary

  • Adds nextflow module generate-meta CLI subcommand that parses a module's main.nf and generates a meta.yml template pre-populated with all inferable values
  • Supports both V1 (classic qualifier syntax: val, path, tuple) and V2 (static type syntax: reads: Path, (meta, reads): Tuple<String, Path>)
  • Implements two-pass static analysis for V2 output type inference: builds a symbol map from input parameters and exec block assignments, then resolves output types via declared type → symbol map lookup → RHS expression inference chain
  • Adds -force flag to overwrite an existing meta.yml and -dry-run flag to print to stdout without writing

Changes

  • CmdModule.groovy — registers the new generate-meta subcommand
  • ModuleGenerateMeta.groovy — CLI entry point with path resolution, overwrite guard, dry-run routing
  • MetaYmlGenerator.groovy — AST extraction (V1 + V2) and YAML rendering via SnakeYAML
  • MetaYmlGeneratorTest.groovy — 14 Spock unit tests covering V1 qualifiers, V2 typed inputs, symbol map inference, tuple sub-entries, YAML rendering
  • ModuleGenerateMetaTest.groovy — 10 Spock CLI tests covering generation, overwrite guard, dry-run, error cases
  • VariableScopeVisitor.java — minor related fix

Test plan

  • Run ./gradlew :nextflow:test --tests "nextflow.module.MetaYmlGeneratorTest" — all 14 tests pass
  • Run ./gradlew :nextflow:test --tests "nextflow.cli.module.ModuleGenerateMetaTest" — CLI tests pass
  • Manual: nextflow module generate-meta <module-dir> generates a valid meta.yml
  • Manual: re-running without -force errors; with -force regenerates; -dry-run prints to stdout

🤖 Generated with Claude Code

Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@jorgee jorgee requested a review from a team as a code owner February 24, 2026 19:26
@jorgee jorgee marked this pull request as draft February 24, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant