Implement declarative ManageSieve synchronization CLI #1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Implement
sievectl, a small command-line tool for managing Sieve filters stored in Git (for example, in dotfiles) and deploying them to ManageSieve accounts. Synchronization is strictly one-way: local files are authoritative. Common uses are vacation replies andfileintorules.Configuration
Use a TOML configuration file, suitable for committing to Git alongside the scripts. Identify accounts directly by their email address, without additional aliases or directory mappings. Use one local Sieve file per account and one managed remote script (default name
main). Example:The corresponding local file is
user@example.net.sievenext toconfig.toml. The account key is the ManageSieve username. Allow the managed remote script name to be configured globally, withmainas the default; per-account overrides can be considered later if needed. Do not store passwords in configuration.Commands
sievectl status [account]: read-only comparison of local content, remote managed script and active state.sievectl sync [account]: upload only if content differs and activate the managed script if needed.sievectl list [account]: list all remote scripts, showing their active and managed status.sievectl delete <account> <script>: explicitly delete a named unmanaged remote script after confirmation; support--yesfor automation. Refuse to delete the managed script. Report server-side restrictions (such as deleting an active script) clearly.Commands that accept
[account]operate on all configured accounts when omitted.Safety and behavior
syncactivates the managed script.statusandlistmust never modify server state.mainscript,syncshould make the intended overwrite clear; include a read-onlystatusfor preview.password_commandwithout a shell, capture stdout, and pass credentials directly to the Python ManageSieve library. Do not expose passwords in arguments, logs, or error messages.ManageSieve library and validation
sievelib(sievelib.managesieve.Client) instead ofpython-managesieve.It supports the required remote script operations and is also a candidate for a future Postoffice Sieve interface.
sieve-connect..sievefiles as opaque text: do not parse, normalize, or regenerate them withsievelib's Sieve parser.sievelibversion provides a suitableCHECKSCRIPTAPI, and use server-side validationwhen available. Regardless, handle
PUTSCRIPTvalidation failures and display the server's diagnostic response.Reject plaintext authentication, invalid certificates, and hostname mismatches; never downgrade silently.
python3-sievelib;confirm Arch packaging before deciding whether an additional package is necessary.
Implementation and tests
pyproject.toml.gopassintegration, initial deployment, status/list output, and rollback via Git followed bysync.Out of scope (initial version)
Bidirectional synchronization, multiple managed Sieve files per account, automatic deletion, Sieve rule generation, scheduled execution, and automatic conflict merging.