sessioner 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/lib/actions/merge.js +1 -5
- package/lib/actions/prune.js +6 -14
- package/lib/ui/search.js +1 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
|
|
15
15
|
## 💡 Why
|
|
16
16
|
|
|
17
|
-
Claude Code supports native forking from specific points, but loses context like thoughts, references, choices, and subagents. It also provides no built-in way to browse, merge, prune, or trim the `.jsonl` session files stored in `~/.claude/projects`.
|
|
17
|
+
Claude Code supports native forking from specific points, but loses context like thoughts, references, choices, and subagents. It also provides no built-in way to search, browse, merge, prune, or trim the `.jsonl` session files stored in `~/.claude/projects`.
|
|
18
18
|
|
|
19
19
|
**Sessioner** gives you a keyboard-driven interface to manage those sessions directly, including a **full fork** that preserves subagents and all session data:
|
|
20
20
|
|
|
21
21
|
- Browse all sessions in a project, sorted by date
|
|
22
|
+
- Search text across all sessions with highlighted results
|
|
22
23
|
- Preview conversations before acting
|
|
23
24
|
- Fork, merge, prune, trim, rename, or delete sessions
|
|
24
25
|
- View session and project stats (duration, tokens, costs, tool usage)
|
|
@@ -172,8 +173,6 @@ sessioner
|
|
|
172
173
|
|
|
173
174
|
## ⌨️ Navigation
|
|
174
175
|
|
|
175
|
-
---
|
|
176
|
-
|
|
177
176
|
### Main Menu
|
|
178
177
|
|
|
179
178
|
- <kbd>Up</kbd> / <kbd>Down</kbd>: move cursor
|
package/lib/actions/merge.js
CHANGED
|
@@ -88,11 +88,7 @@ const copySubagents = async (sourceSessions, targetDir) => {
|
|
|
88
88
|
};
|
|
89
89
|
export const merge = async (sessions, title) => {
|
|
90
90
|
const sorted = [...sessions].sort((first, second) => first.date.localeCompare(second.date));
|
|
91
|
-
const contents =
|
|
92
|
-
for (const session of sorted) {
|
|
93
|
-
const raw = await readFile(session.file, 'utf-8');
|
|
94
|
-
contents.push(raw);
|
|
95
|
-
}
|
|
91
|
+
const contents = await Promise.all(sorted.map((session) => readFile(session.file, 'utf-8')));
|
|
96
92
|
const first = sorted[0];
|
|
97
93
|
if (!first)
|
|
98
94
|
return { id: '', date: '', message: title, file: '' };
|
package/lib/actions/prune.js
CHANGED
|
@@ -17,20 +17,12 @@ const stripTagsFromText = (text) => {
|
|
|
17
17
|
}
|
|
18
18
|
return result;
|
|
19
19
|
};
|
|
20
|
-
const stripSystemTags = (blocks) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
const stripped = stripTagsFromText(block.text).trim();
|
|
28
|
-
if (!stripped)
|
|
29
|
-
continue;
|
|
30
|
-
result.push({ ...block, text: stripped });
|
|
31
|
-
}
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
20
|
+
const stripSystemTags = (blocks) => blocks.flatMap((block) => {
|
|
21
|
+
if (block.type !== 'text' || !block.text)
|
|
22
|
+
return [block];
|
|
23
|
+
const stripped = stripTagsFromText(block.text).trim();
|
|
24
|
+
return stripped ? [{ ...block, text: stripped }] : [];
|
|
25
|
+
});
|
|
34
26
|
const filterContent = (content, options) => {
|
|
35
27
|
let filtered = content;
|
|
36
28
|
if (options.toolBlocks) {
|
package/lib/ui/search.js
CHANGED
|
@@ -38,15 +38,7 @@ const highlightMatch = (value, query) => {
|
|
|
38
38
|
const pattern = new RegExp(escapeRegExp(query), 'gi');
|
|
39
39
|
return value.replace(pattern, (match) => colorize(match, MATCH_COLOR));
|
|
40
40
|
};
|
|
41
|
-
const flattenMatches = (results) => {
|
|
42
|
-
const entries = [];
|
|
43
|
-
for (const result of results) {
|
|
44
|
-
for (const line of result.entries) {
|
|
45
|
-
entries.push({ session: result.session, text: line });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return entries;
|
|
49
|
-
};
|
|
41
|
+
const flattenMatches = (results) => results.flatMap((result) => result.entries.map((text) => ({ session: result.session, text })));
|
|
50
42
|
export const selectSearchResult = async (results, query, fields) => {
|
|
51
43
|
const entries = flattenMatches(results);
|
|
52
44
|
let page = 0;
|