ccsniff 1.0.31 → 1.0.32
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 +15 -0
- package/package.json +1 -1
- package/src/cli.js +2 -2
- package/src/unsloth.js +13 -4
package/README.md
CHANGED
|
@@ -67,6 +67,21 @@ Two formats are supported via `--unsloth-format`:
|
|
|
67
67
|
|
|
68
68
|
Sessions with no user/assistant turn pair are skipped (no training value).
|
|
69
69
|
|
|
70
|
+
## GUI (Observatory)
|
|
71
|
+
|
|
72
|
+
A turnkey, zero-dep browser observatory ships with the package. It indexes
|
|
73
|
+
every session in `~/.claude/projects` and exposes sessions, projects, tools,
|
|
74
|
+
timeline, errors, subagent tree, live stream, and BM25 full-text search.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npx ccsniff gui --open # auto-open in default browser
|
|
78
|
+
npx ccsniff gui --port 4791 # custom port (default 4791)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Endpoints under `/api/*`: `snapshot`, `sessions`, `projects`, `tools`,
|
|
82
|
+
`timeline`, `stats`, `errors`, `subagents`, `events`, `search`, `stream`
|
|
83
|
+
(SSE).
|
|
84
|
+
|
|
70
85
|
## API
|
|
71
86
|
|
|
72
87
|
### `watch(projectsDir?)` → `JsonlWatcher`
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -24,8 +24,6 @@ if (process.argv[2] === 'gui') {
|
|
|
24
24
|
process.stdin.resume();
|
|
25
25
|
} else {
|
|
26
26
|
|
|
27
|
-
{ const r = vault(); if (r.copied > 0) process.stderr.write(`# vault: ${r.copied} copied → ~/.claude/history-backup\n`); }
|
|
28
|
-
|
|
29
27
|
const FLAGS = {
|
|
30
28
|
string: ['since', 'until', 'before', 'after', 'grep', 'igrep', 'cwd', 'project', 'role', 'type', 'tool', 'session', 'sid', 'parent', 'rollup', 'format', 'sort', 'unsloth', 'unsloth-format'],
|
|
31
29
|
multi: ['grep', 'igrep', 'role', 'type', 'tool', 'session', 'sid', 'project', 'cwd'],
|
|
@@ -242,6 +240,8 @@ function sortRows(rows, key, reverse) {
|
|
|
242
240
|
const { opts } = parseArgs(process.argv.slice(2));
|
|
243
241
|
if (opts.help || process.argv.length <= 2) { printHelp(); process.exit(0); }
|
|
244
242
|
|
|
243
|
+
{ const r = vault(); if (r.copied > 0) process.stderr.write(`# vault: ${r.copied} copied → ~/.claude/history-backup\n`); }
|
|
244
|
+
|
|
245
245
|
const since = parseTime(opts.since || opts.after);
|
|
246
246
|
const filter = buildFilter(opts);
|
|
247
247
|
|
package/src/unsloth.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
const SYS_REMINDER = /<system-reminder>[\s\S]*?<\/system-reminder>/gi;
|
|
2
|
+
const CC_ENVELOPE = /<\/?(command-name|command-message|command-args|local-command-stdout|local-command-stderr|user-prompt-submit-hook|stdin)[^>]*>/gi;
|
|
3
|
+
|
|
4
|
+
function sanitize(s) {
|
|
5
|
+
if (typeof s !== 'string' || !s) return s || '';
|
|
6
|
+
return s.replace(SYS_REMINDER, '').replace(CC_ENVELOPE, '').replace(/[ \t]+\n/g, '\n').replace(/\n{3,}/g, '\n\n').trim();
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
function textOf(b) {
|
|
2
|
-
|
|
3
|
-
if (typeof b.
|
|
4
|
-
if (
|
|
5
|
-
|
|
10
|
+
let raw = '';
|
|
11
|
+
if (typeof b.text === 'string') raw = b.text;
|
|
12
|
+
else if (typeof b.content === 'string') raw = b.content;
|
|
13
|
+
else if (Array.isArray(b.content)) raw = b.content.map(c => c?.text || '').join('');
|
|
14
|
+
return sanitize(raw);
|
|
6
15
|
}
|
|
7
16
|
|
|
8
17
|
function groupBySession(events) {
|