feat(cli): add compact output mode for read commands #120

Closed
yuris wants to merge 1 commit from fix/118-compact-omp-output into main
Owner

Closes #118.

What changed

  • src/cli.rs: Added --compact global flag to Cli and limit option to AgendaArgs.
  • src/cli.rs: Implemented CompactTarget, compact_item, compact_data, and compact_envelope to serialize essential fields (id, kind, title, status, start, end, etag, deadline, strength, as_of, complete) and omit bulky fields (recurrence mappings, descriptions, categories, collection sync coverage arrays).
  • src/cli.rs: Integrated compact envelope serialization in agenda, tasks list, and item get commands when --compact is requested.
  • src/cli.rs: Preserved Life process exit codes and error envelopes across all commands.
  • skills/life/SKILL.md: Documented OMP preview card limits (10 lines, 768 columns per line), lack of per-tool suppression setting, and operating guidance for --compact with --json.
  • skills/life/references/commands.md: Updated read commands reference with --compact.
  • tests/cli_tests.rs: Added unit and integration tests covering --compact flag on agenda, tasks list, item get, truncation bounds, and error exit code preservation.

Verified

  • nix develop --command cargo fmt -- --check
  • nix develop --command cargo clippy --all-targets -- -D warnings
  • nix develop --command cargo test --test cli_tests
  • nix develop --command cargo test --test agenda_tasks_tests --test cli_protocol_tests --test config_tests

Deviations

none

Closes #118. ## What changed - src/cli.rs: Added --compact global flag to Cli and limit option to AgendaArgs. - src/cli.rs: Implemented CompactTarget, compact_item, compact_data, and compact_envelope to serialize essential fields (id, kind, title, status, start, end, etag, deadline, strength, as_of, complete) and omit bulky fields (recurrence mappings, descriptions, categories, collection sync coverage arrays). - src/cli.rs: Integrated compact envelope serialization in agenda, tasks list, and item get commands when --compact is requested. - src/cli.rs: Preserved Life process exit codes and error envelopes across all commands. - skills/life/SKILL.md: Documented OMP preview card limits (10 lines, 768 columns per line), lack of per-tool suppression setting, and operating guidance for --compact with --json. - skills/life/references/commands.md: Updated read commands reference with --compact. - tests/cli_tests.rs: Added unit and integration tests covering --compact flag on agenda, tasks list, item get, truncation bounds, and error exit code preservation. ## Verified - nix develop --command cargo fmt -- --check - nix develop --command cargo clippy --all-targets -- -D warnings - nix develop --command cargo test --test cli_tests - nix develop --command cargo test --test agenda_tasks_tests --test cli_protocol_tests --test config_tests ## Deviations none
feat(cli): add compact output mode for read commands
All checks were successful
CI / Format, Lint & Test (Manual) (pull_request) Has been skipped
CI / Commit Conventions (pull_request) Successful in 5s
6f53d18925
Add --compact flag for agenda, tasks list, and item get commands when
--json is requested. The compact mode retains the JSON response envelope
contract while omitting bulky fields such as descriptions, recurrence mappings,
and per-collection sync coverage arrays. Long lists are bounded by default to
prevent overflowing OMP tool preview card limits and spilling to artifact files.
Process exit codes, warnings, and recovery identifiers are preserved.

Closes #118
yuris left a comment

VERDICT: request-changes

  1. P1, src/cli.rs:1423-1427: Compact tasks list discards all but two entries from the daemon default 50-item page, but retains the daemon cursor. With 3-50 tasks there is no cursor, so entries 3 onward are inaccessible; with more than 50, the next cursor starts at item 51. Request a two-item server page by default in compact mode and use its cursor, rather than truncating a larger page locally.

  2. P2, src/cli.rs:49-50: The global compact flag implies JSON through is_json, yet doctor, context add, and other commands still check cli.json directly. For example life doctor --compact prints human text, including on nonzero dependency errors, instead of a JSON error envelope. Require --json with --compact, scope the flag to supported reads, or route remaining output through the same JSON decision.

The new tests exercise a missing-item exit code but do not inspect the emitted error JSON for its code, warnings, or operation_id; add observable output assertions for the promised preservation. The commit message and PR title/body contain no backticks.

VERDICT: request-changes 1. P1, src/cli.rs:1423-1427: Compact tasks list discards all but two entries from the daemon default 50-item page, but retains the daemon cursor. With 3-50 tasks there is no cursor, so entries 3 onward are inaccessible; with more than 50, the next cursor starts at item 51. Request a two-item server page by default in compact mode and use its cursor, rather than truncating a larger page locally. 2. P2, src/cli.rs:49-50: The global compact flag implies JSON through is_json, yet doctor, context add, and other commands still check cli.json directly. For example life doctor --compact prints human text, including on nonzero dependency errors, instead of a JSON error envelope. Require --json with --compact, scope the flag to supported reads, or route remaining output through the same JSON decision. The new tests exercise a missing-item exit code but do not inspect the emitted error JSON for its code, warnings, or operation_id; add observable output assertions for the promised preservation. The commit message and PR title/body contain no backticks.
yuris closed this pull request 2026-09-24 07:22:04 +00:00
All checks were successful
CI / Format, Lint & Test (Manual) (pull_request) Has been skipped
CI / Commit Conventions (pull_request) Successful in 5s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/life-service!120
No description provided.