Documentation
¶
Overview ¶
Package initialize creates the ~/.marunage/ on-disk layout that `marunage init` (PR-33) is responsible for. Splitting the side-effecting work out of the CLI command keeps cobra-free unit tests on top of the real filesystem and lets future callers (Web UI, tests for downstream commands) provision a fresh marunage home without re-implementing the invariants here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidMode = errors.New("invalid permission mode")
ErrInvalidMode is returned when Options.Mode is set to a value outside the documented permission-mode whitelist. Exposing it as a sentinel lets the CLI layer match with errors.Is and surface a non-zero exit code without re-validating the input itself.
Functions ¶
func ResolveMode ¶
ResolveMode applies the same defaulting + whitelist check Run does, returned as a separate step so callers (the CLI) can validate user input *before* opening side-effecting writers like the audit log. Empty input resolves to the documented default ("bypass"); anything outside the whitelist returns ErrInvalidMode.
Types ¶
type Options ¶
Options is the inject-the-world struct Run takes. Home is the only required field in production; tests pass it as t.TempDir() to avoid touching the developer's real ~/.marunage. Mode lets the CLI relay the user's permission-mode choice without coupling this package to cobra; an empty Mode resolves to the documented default ("bypass").
Auditor is optional and omitted by callers that genuinely have no audit log yet (single-test scenarios). Production wires in *logging.AuditLog so the "No silent execution" invariant from docs/requirement.md applies to init too.