Skip to content

feat(cli): Unify turn selection across print/compact/fork - #891

Open
JeanMertz wants to merge 8 commits into
mainfrom
fork-from
Open

feat(cli): Unify turn selection across print/compact/fork#891
JeanMertz wants to merge 8 commits into
mainfrom
fork-from

Conversation

@JeanMertz

Copy link
Copy Markdown
Collaborator

jp c fork now accepts the same turn selector as jp c print and jp c compact: --from/--to, --turn, --first/--last, and --keep-first/--keep-last, replacing its old bespoke --from/--until/--first/--last flags. --from/--to also gain duration, absolute date (2026-01-01), and RFC 3339 support, and every bound now resolves to a whole turn instead of splitting one: --from <time> starts at the first turn to begin after the cutoff, --to <time> ends at (and includes) the turn active at the cutoff.

--first N --last M given together now compact/fork/print each window separately and skip the turns between them, rather than the previous single-range behavior. --keep-first/--keep-last compose with every selector (not just --first/--last) to protect turns at either end, and an explicit --keep-first/--keep-last replaces a configured compaction rule's bound instead of stacking with it.

The conversation-creation range filter on jp c rm, jp c archive, and jp c use is renamed from --from/--until to --created-since/--created-before, freeing --from/--to to mean "which turns" everywhere and --created-since/--created-before to mean "which conversations" — the two families accept near-identical values, so the old shared names were ambiguous. Semantics of the creation-range filter (half-open, since inclusive/before exclusive) are unchanged.

crates/jp_cli/src/cmd/turn_range.rs is replaced by turn_selection.rs, which resolves a selection to an ordered, non-overlapping TurnSet of inclusive 0-based windows instead of a single from/to pair, and ConversationStream::retain_first_turns/ retain_first_and_last_turns are replaced by a single retain_turns(impl Fn(usize) -> bool).

`jp c fork` now accepts the same turn selector as `jp c print` and
`jp c compact`: `--from`/`--to`, `--turn`, `--first`/`--last`, and
`--keep-first`/`--keep-last`, replacing its old bespoke
`--from`/`--until`/`--first`/`--last` flags. `--from`/`--to` also
gain duration, absolute date (`2026-01-01`), and RFC 3339 support, and
every bound now resolves to a whole turn instead of splitting one:
`--from <time>` starts at the first turn to begin after the cutoff,
`--to <time>` ends at (and includes) the turn active at the cutoff.

`--first N --last M` given together now compact/fork/print each
window separately and skip the turns between them, rather than the
previous single-range behavior. `--keep-first`/`--keep-last` compose
with every selector (not just `--first`/`--last`) to protect turns at
either end, and an explicit `--keep-first`/`--keep-last` replaces a
configured compaction rule's bound instead of stacking with it.

The conversation-creation range filter on `jp c rm`, `jp c archive`,
and `jp c use` is renamed from `--from`/`--until` to
`--created-since`/`--created-before`, freeing `--from`/`--to` to mean
"which turns" everywhere and `--created-since`/`--created-before` to
mean "which conversations" — the two families accept near-identical
values, so the old shared names were ambiguous. Semantics of the
creation-range filter (half-open, `since` inclusive/`before`
exclusive) are unchanged.

`crates/jp_cli/src/cmd/turn_range.rs` is replaced by
`turn_selection.rs`, which resolves a selection to an ordered,
non-overlapping `TurnSet` of inclusive 0-based windows instead of a
single from/to pair, and `ConversationStream::retain_first_turns`/
`retain_first_and_last_turns` are replaced by a single
`retain_turns(impl Fn(usize) -> bool)`.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant