#Usage and options
maleta watch [--interval seconds] [--once]maleta prune [--dry-run] [--yes]| Option | Command | Effect |
|---|---|---|
--interval seconds | watch | Sets the interval in whole seconds. The value must be at least 1, but the server enforces a 10-second floor. |
--once | watch | Runs one pass and exits. If the only failure is throttling, waits for Retry-After and tries once more. |
--dry-run | prune | Only reports what would be removed. It does not write or need to acquire the lock. |
--yes | prune | Authorizes removal. Without this option, prune defaults to a dry run. |
Without --interval, the first interval is 30 seconds; after the first response, the cadence provided by the server takes over. On startup, the CLI prints [ok] watch iniciado; aplicando a Maleta "<nome>" a cada <segundos>s.
#What happens on each pass
Read the binding
The CLI reads the device session and the revision of the bound Maleta. If the locally applied revision and the revision reported by the account already match, it does not download the document again.
Fetch and plan
When the revision changed or the previous pass ended in a conflict, it downloads the document, validates the Maleta, and creates the plan for the host. Plugins are deliberately excluded: a server-provided list must not become a remote-execution channel. The CLI prints
[skip] <n> plugin(s) desta Maleta não são aplicados pelo watch; rode 'maleta sync' para aplicá-los.Apply without removing
The plan adds or updates safe files and preserves local conflicts.
watchalways plans with removal disabled: it never deletes files.Record and report
The CLI writes the local state, including the revision and result, then reports the result to the account. A reporting failure does not undo a completed write.
#Cadence, retries, and locking
The server accepts at least 10 seconds between polls. A lower --interval is raised to that floor and prints [warn] o servidor aceita no mínimo 10s entre polls; usando esse intervalo.
- After an error, the delay grows as
min(intervalo × 2^tentativa, 5 min)with ±20% jitter. A validRetry-Afterreplaces this delay. - There is one
watch.lockper CLI home directory. A second process exits with[error] já existe um 'maleta watch' em execução neste computador (pid <pid>). maleta statusshows the process aswatch: rodando (pid <pid>). Locks left by processes that have exited are reclaimed on the next run.--onceexits after one successful or conflicting pass; an error on that pass returns failure, except for the single throttling retry.
#What remains pending
- Resources that the current Maleta revision no longer uses move to
pendingRemoval. - When you run
maleta detachormaleta logout, resources from the previous Maleta move toorphaned. - If the binding is replaced by another document, previously recorded resources also become orphaned for a later
prunerun.
#Prune and proof of ownership
Before deleting, prune reports each resource. Running without --yes is a simulation and prompts with <n> recurso(s): rode 'maleta prune --yes' para remover. Actual removal refuses to proceed while watch holds the lock: [error] há um 'maleta watch' em execução neste computador (pid <pid>); pare o watch antes de remover.
- Only files with
origin: "written"whose hash still matches the record can be deleted. Adopted or modified files, symlinks, unsafe paths, and unknown entries are preserved. - A directory is removed only after it becomes empty. A user-added file keeps the directory and blocks removal of the resource.
- Without account access,
pruneevaluates onlypendingRemovalandorphanedfrom the local record; it does not guess other candidates.
#Exit codes
| Code | Condition |
|---|---|
0 | A normal watch pass or shutdown; a completed prune report or removal. Untrusted state also exits without removing and returns 0. |
1 | Single-pass failure, revoked credential, or another operational error. |
2 | Invalid command, option, or value, including an --interval that is not a positive integer. |
3 | Another watch already holds watch.lock or an actual removal was refused because the lock is held. |