Skip to content

Add init, status, and unlock commands#10

Merged
pascal-zarrad merged 10 commits intomainfrom
feature/repo-commands
Apr 10, 2026
Merged

Add init, status, and unlock commands#10
pascal-zarrad merged 10 commits intomainfrom
feature/repo-commands

Conversation

@pascal-zarrad
Copy link
Copy Markdown
Member

Description

Add repository management commands that wrap restic operations:

  • conba init: initialize the restic repository (idempotent)
  • conba unlock: remove stale locks from the repository
  • conba status: show repo health, snapshot count, and size

Includes restic wrapper methods (Unlock, Stats), arg builders, JSON parsing, integration tests, and CLI unit tests.

Add repository management commands that wrap restic operations:
- conba init: initialize the restic repository (idempotent)
- conba unlock: remove stale locks from the repository
- conba status: show repo health, snapshot count, and size

Includes restic wrapper methods (Unlock, Stats), arg builders,
JSON parsing, integration tests, and CLI unit tests.
@pascal-zarrad pascal-zarrad self-assigned this Apr 10, 2026
@pascal-zarrad pascal-zarrad added the C2 - feature A suggestion or implementation of a new feature label Apr 10, 2026
@pascal-zarrad pascal-zarrad requested a review from a team as a code owner April 10, 2026 18:04
Disable zap stack traces for human log format (only useful at
error/fatal). Add missing repository location error pattern to
status command error handler.
Add requireResticConfig helper that checks repository and
password are configured before calling restic. Gives clear
error messages instead of leaking raw restic errors. Extract
shared sentinel errors to helpers.go.
Fix double-output UX bug in status command by returning nil for
known error states. Add missing tests for formatSize boundaries,
handleStatusError paths, and RunE nil-config/missing-repo for
init and unlock commands. Narrow gosec test exclusion to G101.
Add ResticConfig.Validate() method with ErrMissingRepository and
ErrMissingPassword sentinel errors. CLI commands call Validate()
before constructing the restic client. Validation logic belongs
to the config type, not the CLI layer.
@pascal-zarrad pascal-zarrad force-pushed the feature/repo-commands branch from e48156a to 3b9340f Compare April 10, 2026 19:36
Move restic error classification to restic.ClassifyError with
ErrRepoNotInitialized and ErrRepoLocked sentinels. Extract byte
formatting to internal/format package for reuse.
Extract shared RunE test assertions to helpers_test.go to
eliminate dupl violations. Keep only G101 gosec exclusion for
test files (PasswordFile field triggers false positive).
Move ResticConfig.Validate() call into restic.New so the client
cannot be constructed with missing repository or password. Remove
redundant validation from CLI command handlers.
Extract restic stderr patterns into named constants and use
switch/case for cleaner classification logic.
Move format.Bytes to internal/support/format and extract
containsAny to internal/support/stringutil.ContainsAny for
reuse across packages.
@pascal-zarrad pascal-zarrad merged commit b805d3c into main Apr 10, 2026
5 checks passed
@pascal-zarrad pascal-zarrad deleted the feature/repo-commands branch April 10, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C2 - feature A suggestion or implementation of a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant