Commit 3b14ab2
authored
feat(cli, conversation): add
Introduce the `jp conversation fork` command, allowing users to create a
new conversation based on the contents of an existing one. This is
useful for exploring different paths or isolating specific parts of a
discussion.
The command supports time-based filtering of events using the `--from`
and `--until` flags, which accept both relative (e.g., "5mins") and
absolute timestamps. Users can also immediately switch to the new fork
using the `--activate` flag.
```shell
# Fork the active conversation
jp conversation fork --activate
# Fork a specific conversation with events from 10 minutes ago
jp conversation fork <id> --from 10mins
```
Internally, changes are made to make it easier to test code that relies
on the current timestamp, such as
`Workspace::set_active_conversation_id`, and
`Workspace::create_conversation`. Additionally, the persistence logic
was moved from `Ctx` to `Workspace` to ensure state is saved even when
the workspace is dropped outside of the CLI context.
---------
Signed-off-by: Jean Mertz <[email protected]>conversation fork command (#374)1 parent c2ca0f8 commit 3b14ab2
File tree
12 files changed
+572
-23
lines changed- crates
- jp_cli
- src
- cmd
- conversation
- jp_conversation/src
- jp_workspace/src
12 files changed
+572
-23
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
49 | 54 | | |
0 commit comments