P1.1: swap yaml struct tags for json in domain types

Replace yaml:"…" tags with json:"…" on Job, Config, and JobsFile.
Add omitempty to bool fields in Config that previously lacked it.
Update comments to reference .json filenames.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mixeme
2026-06-22 21:21:56 +03:00
parent 095ae557f1
commit b7bbb41845
3 changed files with 21 additions and 21 deletions
+10 -10
View File
@@ -5,21 +5,21 @@ package domain
// launches omit this flag and open the normal window.
const StartInTrayArgument = "--start-in-tray"
// Config is stored in gosentry.yaml next to the program. It contains only
// Config is stored in gosentry.json next to the program. It contains only
// application-level choices: where to read jobs from, where to write logs, and
// how the desktop shell should behave.
type Config struct {
JobsDir string `yaml:"jobs_dir"`
LogsDir string `yaml:"logs_dir"`
MaxLogFiles int `yaml:"max_log_files"`
MaxLogAgeDays int `yaml:"max_log_age_days"`
StartOnLogin bool `yaml:"start_on_login"`
KeepRunningInTray bool `yaml:"keep_running_in_tray"`
NotifyOnFailure bool `yaml:"notify_on_failure"`
JobsDir string `json:"jobs_dir"`
LogsDir string `json:"logs_dir"`
MaxLogFiles int `json:"max_log_files"`
MaxLogAgeDays int `json:"max_log_age_days"`
StartOnLogin bool `json:"start_on_login,omitempty"`
KeepRunningInTray bool `json:"keep_running_in_tray,omitempty"`
NotifyOnFailure bool `json:"notify_on_failure,omitempty"`
}
// JobsFile is the on-disk shape of jobs.yaml. Wrapping the slice in a top-level
// JobsFile is the on-disk shape of jobs.json. Wrapping the slice in a top-level
// object leaves room for future metadata without breaking the basic file format.
type JobsFile struct {
Jobs []Job `yaml:"jobs"`
Jobs []Job `json:"jobs"`
}
+10 -10
View File
@@ -1,18 +1,18 @@
package domain
// Job is the user-visible scheduled command. It contains only durable
// configuration: every field is persisted to jobs.yaml. Transient execution
// configuration: every field is persisted to jobs.json. Transient execution
// state (last run, next run, command output, in-memory activity) lives in a
// separate JobRuntime so the jobs file stays a clean, hand-editable record of
// configuration and never mixes in process-lifetime bookkeeping.
type Job struct {
ID int `yaml:"id"`
Name string `yaml:"name"`
Folder string `yaml:"folder,omitempty"`
Schedule string `yaml:"schedule"`
Command string `yaml:"command"`
Arguments string `yaml:"arguments,omitempty"`
SuccessExitCodes string `yaml:"success_exit_codes,omitempty"`
StartOnly bool `yaml:"start_only,omitempty"`
Enabled bool `yaml:"enabled"`
ID int `json:"id"`
Name string `json:"name"`
Folder string `json:"folder,omitempty"`
Schedule string `json:"schedule"`
Command string `json:"command"`
Arguments string `json:"arguments,omitempty"`
SuccessExitCodes string `json:"success_exit_codes,omitempty"`
StartOnly bool `json:"start_only,omitempty"`
Enabled bool `json:"enabled"`
}