Skip to content

Refactor add command: Separate concerns into modular architecture#140

Open
MrKeiKun wants to merge 1 commit intoS4tvara:mainfrom
MrKeiKun:fix-98-refactor-cmd_add
Open

Refactor add command: Separate concerns into modular architecture#140
MrKeiKun wants to merge 1 commit intoS4tvara:mainfrom
MrKeiKun:fix-98-refactor-cmd_add

Conversation

@MrKeiKun
Copy link
Copy Markdown
Contributor

Summary

This PR refactors the add.go command to address increasing complexity by separating concerns into a well-organized modular architecture.

  • core.go - Core file processing logic
  • space.go - Space calculations and reporting
  • files.go - File operations and validation
  • config.go - Configuration management
  • ui.go - UI and progress handling

and of course, simplified cmd/add.go as the one handling calls to different modules. I didn't also forget about test file.

  • add/files_test.go - Cleaned-up its test since there way duplicated ones.
  • cmd/add_test.go - just the one calling the tests.

AI Assistance

  • I used AI assistance (generate code, write tests, refactor, or docs)
    • If yes, briefly describe where and how:

Scope & Risk

  • Adds tests or updates existing tests
  • Security/privacy reviewed where applicable
  • Performance/complexity considered

Hacktoberfest Notes

Checklist

  • PR title is descriptive
  • Commits are meaningful (no bulk AI dumps)
  • No generated files or lockfile-only changes unless justified

…ved maintainability

Signed-off-by: Lorenzo Buitizon <the.keikun@gmail.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 6.33245% with 355 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/add/ui.go 0.00% 107 Missing ⚠️
internal/add/core.go 0.00% 75 Missing ⚠️
internal/add/config.go 0.00% 52 Missing ⚠️
internal/add/files.go 32.43% 50 Missing ⚠️
internal/add/space.go 0.00% 36 Missing ⚠️
cmd/add.go 0.00% 35 Missing ⚠️

📢 Thoughts on this report? Let us know!

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