4.3 KiB
4.3 KiB
phase, plan, subsystem, tags, dependency_graph, tech_stack, key_files, decisions, metrics
| phase | plan | subsystem | tags | dependency_graph | tech_stack | key_files | decisions | metrics | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 17 | 05 | cli-commands |
|
|
|
|
|
|
Phase 17 Plan 05: Serve & Schedule CLI Commands Summary
cmd/serve.go starts scheduler + optional Telegram bot; cmd/schedule.go provides add/list/remove/run CRUD for cron-based recurring scan jobs backed by SQLite
Performance
- Duration: 6 min
- Started: 2026-04-06T14:41:07Z
- Completed: 2026-04-06T14:47:00Z
- Tasks: 1 (combined)
- Files modified: 10
Accomplishments
- Replaced serve and schedule stubs with real implementations
- Scheduler package wraps gocron v2 with DB-backed job persistence
- Serve command starts scheduler and optionally Telegram bot with --telegram flag
- Schedule subcommands provide full CRUD: add (--cron, --scan, --name, --notify), list, remove, run
Task Commits
- Task 1: Implement serve, schedule commands + scheduler package + storage layer -
292ec24(feat)
Files Created/Modified
cmd/serve.go- Serve command: starts scheduler, optionally Telegram bot with --telegram flagcmd/schedule.go- Schedule command with add/list/remove/run subcommandscmd/stubs.go- Removed serve and schedule stubspkg/scheduler/scheduler.go- Scheduler wrapping gocron v2 with DB job loading, OnFindings callbackpkg/scheduler/source.go- Source selection for scheduled scan pathspkg/storage/schema.sql- Added scheduled_jobs table with indexespkg/storage/scheduled_jobs.go- CRUD operations for scheduled_jobs tablepkg/storage/scheduled_jobs_test.go- Tests for job CRUD and last_run updatego.mod- Added gocron/v2 v2.19.1 dependencygo.sum- Updated checksums
Decisions Made
- Scheduler lives in pkg/scheduler, decoupled from cmd layer via Deps struct injection
- OnFindings callback pattern allows serve.go to wire Telegram notification without pkg/scheduler knowing about pkg/bot
- schedule add/list/remove/run are standalone DB operations (no running scheduler needed)
- schedule run executes scan immediately using same engine/storage as scan command
- parseNullTime handles multiple SQLite datetime formats (space-separated and ISO 8601)
Deviations from Plan
Auto-fixed Issues
1. [Rule 1 - Bug] Fixed parseNullTime to handle multiple SQLite datetime formats
- Found during: Task 1 (scheduled_jobs_test.go)
- Issue: SQLite returned datetime as
2026-04-06T17:45:53Zbut parser only handled2006-01-02 15:04:05 - Fix: Added multiple format fallback in parseNullTime
- Files modified: pkg/storage/scheduled_jobs.go
- Verification: TestUpdateJobLastRun passes
2. [Rule 3 - Blocking] Renamed truncate to truncateStr to avoid redeclaration with dorks.go
- Found during: Task 1 (compilation)
- Issue: truncate function already declared in cmd/dorks.go
- Fix: Renamed to truncateStr in schedule.go
- Files modified: cmd/schedule.go
Total deviations: 2 auto-fixed (1 bug, 1 blocking) Impact on plan: Both essential for correctness. No scope creep.
Issues Encountered
None beyond the auto-fixed items above.
Known Stubs
None. All commands are fully wired to real implementations.
Next Phase Readiness
- Serve command ready for Phase 18 web dashboard (--port flag reserved)
- Scheduler operational for all enabled DB-stored jobs
- Telegram bot integration tested via existing Phase 17 Plan 03 handlers