Skip to content

feat(cli): add --config flag to dirctl import and simplify pipeline setup - #1715

Merged
paralta merged 5 commits into
mainfrom
refactor/import-config
Jun 29, 2026
Merged

paralta merged 5 commits into
mainfrom
refactor/import-config

Conversation

@paralta

@paralta paralta commented Jun 29, 2026

Copy link
Copy Markdown
Member

dirctl import previously required 10+ flags to configure the enricher, scanner, and record authors, making invocations hard to read and impossible to reproduce across environments. This PR introduces a --config flag that accepts a YAML file covering the full pipeline — enricher model and tool-host, scanner settings, authors, source type and URL — with CLI flags taking precedence so frequently-varied options (--filter, --limit, --dry-run, --output-dir) can still be supplied per-invocation without touching the file. As part of this, 9 flags are removed (--enrich-*, --scanner-*, --author) and the CI workflow is updated to generate the new YAML config at runtime instead of the previous JSON enricher template.

  • Config-to-struct mapping uses local yaml-tagged structs with an explicit applyFileConfig copy function, replacing mapstructure reflection and custom name-matching logic; the mapping between YAML keys and Go fields is now visible in the type definitions.
  • --author is removed as a flag (config-file-only) since authors represent stable pipeline metadata rather than a per-run variable; --type, --url, and --file-path are kept so the tool remains usable without a config file for quick one-liners.
  • A reference import.config.yaml is included in the repository as both documentation and a test fixture.

@paralta paralta linked an issue Jun 29, 2026 that may be closed by this pull request
2 tasks done
@github-actions github-actions Bot added the size/M Denotes a PR that changes 200-999 lines label Jun 29, 2026
paralta added 2 commits June 29, 2026 12:04
Signed-off-by: Catarina Paralta <[email protected]>
Signed-off-by: Catarina Paralta <[email protected]>
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.08264% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/cmd/import/config.go 89.8% 6 Missing and 6 partials ⚠️

📢 Thoughts on this report? Let us know!

@paralta
paralta marked this pull request as ready for review June 29, 2026 12:01
@paralta
paralta requested a review from a team as a code owner June 29, 2026 12:01

@ramizpolic ramizpolic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work!

@paralta

paralta commented Jun 29, 2026

Copy link
Copy Markdown
Member Author

Test run looking good ✅ https://github.com/agntcy/dir/actions/runs/28366259035

@paralta
paralta merged commit 682993e into main Jun 29, 2026
35 checks passed
@paralta
paralta deleted the refactor/import-config branch June 29, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 200-999 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Allow dirctl import to be driven from a configuration file

2 participants