Add watch mode with config interval support - #20
Merged
Conversation
Implements #19 Features: - Add `watch` command for interval-based scheduled sync - Interval validation: 1h minimum, 168h (7 days) maximum - Default interval: 24h - `--once` flag for immediate sync before watching - Docker-friendly (works with restart=unless-stopped) Files: - cmd_watch.go: Watch command implementation - cmd_watch_test.go: Tests for watch command - cli.go: Register watch command - cli_test.go: Update command count test - README.md: Documentation for watch command Tests: All passing Lint: No issues
## Linting improvements - Update .golangci.yml with AI-optimized settings - Add new linters: cyclop, nestif, maintidx, musttag, nilnil, prealloc, usestdlibvars - Tighten complexity limits: funlen 100 lines, gocyclo 15 - Exclude test files from complexity checks - Add lefthook.yml for Git hooks (pre-commit/pre-push checks) - Add make install for one-command development tool setup - Add make check to run all Git hooks checks manually ## Code quality fixes - Fix usestdlibvars issues: replace "GET" with http.MethodGet (3 occurrences) - Fix nilnil issues: replace return nil,nil with proper errors (3 occurrences) ## Refactoring to reduce cyclomatic complexity - utils.go: Extract titleMatchingLevels helper functions - exactMatch, normalizedMatch, fuzzyMatch, levenshteinMatch - Reduce complexity from 37 to <15 - app.go: Extract updater creation helper functions - newAnimeUpdater, newMangaUpdater - newReverseAnimeUpdater, newReverseMangaUpdater - Reduce NewApp complexity from 28 to <15 ## Documentation - Update CLAUDE.md with AI agent development rules - Add linting workflow, code complexity limits, and style rules All checks pass: format ✓ imports ✓ vet ✓ lint (0 issues) ✓ tests ✓
- Add WatchConfig struct with GetInterval() method - Update config.example.yaml with watch section - Implement priority: CLI flag > Config > Error (no auto-default) - Add comprehensive tests for interval priority - Update README documentation Priority order: 1. CLI --interval flag (highest) 2. watch.interval in config.yaml 3. Error if neither specified (no default)
Remove deprecated skip-tests option from cyclop linter settings, which is no longer supported in golangci-lint v2.x. Test files are already excluded via the exclusions section. Also update project references to use v2.2.2 consistently.
- Update Dockerfile: golang:1.23-alpine → golang:1.25-alpine - Update go.mod: go 1.24.0 → go 1.25.0 - Update go.mod: toolchain go1.24.5 → toolchain go1.25.5 - Run go mod tidy && go mod vendor All tests pass after upgrade.
CI was using v2.2 which has compatibility issues with the config format. Local environment uses v2.7.2 which works correctly.
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
watchcommand for scheduled sync (Docker-friendly)config.yamlwith CLI overrideKey Changes
WatchConfigstruct withGetInterval()methodwatch.intervalfieldTest plan
Fixes #19