Refactor: split main.zig into modular CLI modules#15
Merged
Conversation
Extract 2251-line main.zig into focused modules under src/cli/: - ui.zig: UI constants, table formatting, color helpers - data.zig: data loading, filtering, date utilities - enrich.zig: IP enrichment display helpers - show.zig: show/list commands - commands.zig: fetch/enrich/aggregate/dns/domains/summary/check commands main.zig is now 146 lines (entry point + arg parsing only). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Refactors the Zig CLI entrypoint by splitting the previously large src/main.zig into focused modules under src/cli/, keeping main.zig as a thin dispatcher/arg parser.
Changes:
- Moved command implementations into
src/cli/commands.zig(fetch/enrich/aggregate/dns/domains/summary/check) andsrc/cli/show.zig(show/list). - Extracted shared helpers into
src/cli/ui.zig(output formatting/constants) andsrc/cli/data.zig/src/cli/enrich.zig(data + enrichment utilities). - Updated
src/main.zigto delegate to the new modules and to re-export submodule tests for the executable test target.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.zig | Reduced to CLI entrypoint + arg parsing; dispatches to new cli/* modules; pulls in submodule tests. |
| src/cli/ui.zig | Adds shared UI constants and table formatting helpers used across CLI commands. |
| src/cli/data.zig | Centralizes report loading/filtering and date/time utilities used by multiple commands. |
| src/cli/enrich.zig | Extracts cached IP enrichment helpers and TLS enrichment line formatting. |
| src/cli/show.zig | Implements show/list commands and table/JSON output using shared helpers. |
| src/cli/commands.zig | Implements non-show commands (fetch/enrich/aggregate/dns/domains/summary/check) using shared helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
src/main.zig(2251 lines) into 5 focused modules undersrc/cli/main.zigto 146 lines (entry point + arg parsing only)Module structure
cli/ui.zigcli/data.zigcli/enrich.zigcli/show.zigcli/commands.zigTest plan
zig buildcompiles successfullyzig build testall tests passzig build run -- versionworks correctlyzig build run -- helpworks correctly🤖 Generated with Claude Code