Commit graph parsimony/internal/cli/commands.go
Author SHA1 Message Date
tgiachi
34f461bb6b Merge branch 'feat/nl-posts-stats' into feat/newsletter 2026-11-10 13:02:41 +01:00
tgiachi
7e43117c74 feat(cli): parsimony posts ls
- posts ls <list> [--limit N] prints ID, DATE, SUBJECT, RECIPIENTS, SENT,
  PENDING, FAILED and DROPPED, newest first, "No posts yet." when empty,
  and the API's JSON with --json
- cells go through the same control-character escaping as the other
  tables; tests for the table, the limit, JSON, errors and escaping
2026-11-10 12:42:15 +01:00
tgiachi
e850547b3d feat(cli): publishers in member add, ls, set and import
- member add --publisher makes a publisher, --publisher=false demotes; without
  the flag an existing member keeps its role
- member ls has a ROLE column: publisher or subscriber
- new member set <list> <email> --publisher=true|false (usage error without the flag)
- member import reads an optional third column, the keyword publisher (any case);
  anything else there fails that line; an empty third column is ignored
- list set --post publishers; help text updated
- the old import test now uses the publisher keyword in its third column
2026-11-10 12:40:10 +01:00
tgiachi
eccd82af69 feat(cli): escape control characters from mail, refuse the token over plain http
- printable() shows C0, DEL and C1 control characters (except tab and newline; CRLF counts
  as a newline) as \xNN / \uNNNN, applied to every table cell, archive show, member
  listings, import reports and error text, so an escape sequence in a subject cannot
  drive the terminal.
- The client refuses to send the bearer token over http:// to a non-loopback host unless
  --insecure is given: usage error, exit 2. localhost, 127.0.0.0/8 and ::1 stay allowed.
  Offline commands (dkim) never build the client, so they are not affected.
- Tests: the helper, ESC sequences in archive ls/show, held ls, queue ls, list/member names,
  API errors and import reports; the URL check by flag and PARSIMONY_URL. README updated.
2026-11-10 11:57:58 +01:00
tgiachi
bcca031ea3 feat: show who really wrote a held message in the CLI and the UI
- Add SENDER and FROM columns to held ls, flagging a From header that differs from the sender
- Show the From header and a badge in the Held tab; keep the envelope sender visible
2026-11-10 11:40:31 +01:00
tgiachi
afd067688c feat: show failed deliveries in the API, CLI and UI 2026-11-09 20:34:37 +01:00
tgiachi
eb9e915805 fix(security): hold posts whose From header does not match the sender
- Judge membership on the envelope sender and require the From header to name the same address
- Hold mismatches (and missing, unparsable or multiple From addresses) for the admin instead of delivering
- Record why a message was held: new held.reason column, migrated, shown in the API, CLI and UI
- Accept an empty message in the held queue
- Document who may post
2026-11-09 20:23:07 +01:00
tgiachi
cc47784fdb feat(cli): archive import from a file or stdin
- Add parsimony archive import <list> <file|->, streaming with no overall timeout
- Print imported, already present and failed counts; report failing messages and exit 1
- Support --json
2026-11-09 17:15:43 +01:00
tgiachi
2d8b0ccce6 feat(cli): command-line client for administration
- Add parsimony list, member, held, archive and queue subcommands over the REST API
- Read the token only from PARSIMONY_API_TOKEN; take the URL from --url or PARSIMONY_URL
- Print tables by default and JSON with --json
- Add member import from a file or stdin, reporting failing lines and exiting non-zero
- Require --yes for destructive commands
- Add parsimony serve; keep the old -config invocation working
- Run the CLI inside the container in the end-to-end test
- Test every command against the real API handler; mutation checks over the CLI
2026-11-09 16:57:25 +01:00