elliot-stack 1.0.36 → 1.0.37
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/LICENSE +21 -21
- package/bin/install.cjs +981 -981
- package/hooks/repo-search-nudge.js +32 -32
- package/package.json +1 -1
- package/skills/estack-active-learning-tutor/SKILL.md +339 -339
- package/skills/estack-better-title/SKILL.md +64 -64
- package/skills/estack-better-title/scripts/rename.sh +55 -55
- package/skills/estack-chris-voss/SKILL.md +80 -80
- package/skills/estack-chris-voss/references/elliot-notes.md +120 -120
- package/skills/estack-chris-voss/references/voss-principles.md +210 -210
- package/skills/estack-customer-discovery/SKILL.md +60 -60
- package/skills/estack-flight-planner/SKILL.md +332 -332
- package/skills/estack-flight-planner/references/config_schema.md +156 -156
- package/skills/estack-flight-planner/references/flight_history_schema.md +97 -97
- package/skills/estack-flight-planner/references/shuttle_schedules.md +98 -98
- package/skills/estack-flight-planner/scripts/check_setup.sh +89 -89
- package/skills/estack-flight-planner/scripts/fetch_flights.py +99 -99
- package/skills/estack-flight-planner/scripts/filter_flights.py +265 -265
- package/skills/estack-flight-planner/scripts/pair_shuttles.py +173 -173
- package/skills/estack-github-issue-tracker/SKILL.md +322 -322
- package/skills/estack-github-issue-tracker/bin/tracker-tools.cjs +1358 -1358
- package/skills/estack-github-issue-tracker/references/gh-cli-patterns.md +124 -124
- package/skills/estack-github-issue-tracker/references/result-file-schema.md +156 -156
- package/skills/estack-github-issue-tracker/references/tracker-schema.md +96 -96
- package/skills/estack-github-issue-tracker/tracker-template.md +58 -58
- package/skills/estack-leadership-coach/SKILL.md +1 -1
- package/skills/estack-leadership-coach/adding-references.md +1 -1
- package/skills/estack-migrate-claude-session-history/SKILL.md +15 -2
- package/skills/estack-pdf-to-md/SKILL.md +1 -2
- package/skills/estack-prompt-builder-coach/SKILL.md +81 -81
- package/skills/estack-prompt-builder-coach/definition-of-done-generator.md +42 -42
- package/skills/estack-prompt-builder-coach/prompt-builder.md +37 -37
- package/skills/estack-prompt-builder-coach/task-shaper.md +36 -36
- package/skills/estack-prompt-builder-coach/vague-ask-auditor.md +37 -37
- package/skills/estack-read-claude-session-history/SKILL.md +224 -204
- package/skills/estack-read-claude-session-history/references/jsonl-schema.md +126 -126
- package/skills/estack-read-claude-session-history/references/modes.md +423 -423
- package/skills/estack-read-claude-session-history/references/recipes.md +271 -271
- package/skills/estack-read-claude-session-history/scripts/lib/__init__.py +1 -1
- package/skills/estack-read-claude-session-history/scripts/lib/parser.py +460 -460
- package/skills/estack-read-claude-session-history/scripts/lib/paths.py +234 -234
- package/skills/estack-read-claude-session-history/scripts/lib/search.py +179 -179
- package/skills/estack-read-claude-session-history/scripts/lib/subagents.py +88 -88
- package/skills/estack-read-claude-session-history/scripts/lib/tools.py +144 -144
- package/skills/estack-read-claude-session-history/scripts/read_transcript.py +1776 -1776
- package/skills/estack-read-claude-session-history/scripts/tests/conftest.py +40 -40
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/README.md +20 -20
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/all-noise.jsonl +4 -4
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/basic-session.jsonl +2 -2
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-gaps.jsonl +9 -9
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-noise.jsonl +7 -7
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-parallel-a.jsonl +3 -3
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-parallel-b.jsonl +3 -3
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-waiting.jsonl +5 -5
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/interrupted.jsonl +2 -2
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/multi-compact.jsonl +8 -8
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/pending-user.jsonl +2 -2
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-no-meta/subagents/agent-aaa.jsonl +2 -2
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-no-meta.jsonl +2 -2
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-parent/subagents/agent-xyz123.jsonl +2 -2
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-parent/subagents/agent-xyz123.meta.json +1 -1
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-parent.jsonl +4 -4
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/time-spread.jsonl +6 -6
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/timeline-day-test.jsonl +5 -5
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/tool-zoo.jsonl +10 -10
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/truncated.jsonl +2 -2
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/unicode.jsonl +2 -2
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/with-advisor.jsonl +3 -3
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/with-compact.jsonl +5 -5
- package/skills/estack-read-claude-session-history/scripts/tests/fixtures/with-thinking.jsonl +2 -2
- package/skills/estack-read-claude-session-history/scripts/tests/test_backup_roots.py +56 -56
- package/skills/estack-read-claude-session-history/scripts/tests/test_engagement.py +239 -239
- package/skills/estack-read-claude-session-history/scripts/tests/test_json_format.py +201 -201
- package/skills/estack-read-claude-session-history/scripts/tests/test_modes.py +199 -199
- package/skills/estack-read-claude-session-history/scripts/tests/test_parser.py +195 -195
- package/skills/estack-read-claude-session-history/scripts/tests/test_paths.py +133 -133
- package/skills/estack-read-claude-session-history/scripts/tests/test_search.py +78 -78
- package/skills/estack-read-claude-session-history/scripts/tests/test_subagents.py +43 -43
- package/skills/estack-read-claude-session-history/scripts/tests/test_timeline.py +179 -179
- package/skills/estack-read-claude-session-history/scripts/tests/test_timezone_and_project.py +212 -212
- package/skills/estack-read-claude-session-history/scripts/tests/test_tools.py +80 -80
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
"""Tests for --format json across modes."""
|
|
2
|
-
|
|
3
|
-
import json
|
|
4
|
-
import os
|
|
5
|
-
import shutil
|
|
6
|
-
import subprocess
|
|
7
|
-
import sys
|
|
8
|
-
from pathlib import Path
|
|
9
|
-
|
|
10
|
-
import pytest
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _run_cli(cli_path, *args, env_overrides=None):
|
|
14
|
-
env = dict(os.environ)
|
|
15
|
-
env["PYTHONIOENCODING"] = "utf-8"
|
|
16
|
-
if env_overrides:
|
|
17
|
-
env.update(env_overrides)
|
|
18
|
-
return subprocess.run(
|
|
19
|
-
[sys.executable, str(cli_path), *args],
|
|
20
|
-
capture_output=True,
|
|
21
|
-
text=True,
|
|
22
|
-
encoding="utf-8",
|
|
23
|
-
env=env,
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _json(r):
|
|
28
|
-
assert r.returncode == 0, r.stderr
|
|
29
|
-
return json.loads(r.stdout)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def test_last_json(cli_path, fixtures_dir):
|
|
33
|
-
data = _json(_run_cli(
|
|
34
|
-
cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
|
|
35
|
-
"--mode", "last", "--format", "json",
|
|
36
|
-
))
|
|
37
|
-
assert isinstance(data, list)
|
|
38
|
-
assert data[-1]["n_from_end"] == 1
|
|
39
|
-
assert "Here is help" in data[-1]["text"]
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def test_json_alias_flag(cli_path, fixtures_dir):
|
|
43
|
-
data = _json(_run_cli(
|
|
44
|
-
cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
|
|
45
|
-
"--mode", "last", "--json",
|
|
46
|
-
))
|
|
47
|
-
assert isinstance(data, list)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def test_advisor_json(cli_path, fixtures_dir):
|
|
51
|
-
data = _json(_run_cli(
|
|
52
|
-
cli_path, "--file", str(fixtures_dir / "with-advisor.jsonl"),
|
|
53
|
-
"--mode", "advisor", "--format", "json",
|
|
54
|
-
))
|
|
55
|
-
assert data == ["The advisor says do X then Y."]
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def test_pre_compact_json(cli_path, fixtures_dir):
|
|
59
|
-
data = _json(_run_cli(
|
|
60
|
-
cli_path, "--file", str(fixtures_dir / "with-compact.jsonl"),
|
|
61
|
-
"--mode", "pre-compact", "--format", "json",
|
|
62
|
-
))
|
|
63
|
-
assert data["found_compact"] is True
|
|
64
|
-
assert any("First answer" in m["text"] for m in data["messages"])
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def test_dump_json(cli_path, fixtures_dir):
|
|
68
|
-
data = _json(_run_cli(
|
|
69
|
-
cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
|
|
70
|
-
"--mode", "dump", "--format", "json",
|
|
71
|
-
))
|
|
72
|
-
assert isinstance(data, list)
|
|
73
|
-
assert data[0]["role"] == "user"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def test_debug_json(cli_path, fixtures_dir):
|
|
77
|
-
data = _json(_run_cli(
|
|
78
|
-
cli_path, "--file", str(fixtures_dir / "with-advisor.jsonl"),
|
|
79
|
-
"--mode", "debug", "--format", "json",
|
|
80
|
-
))
|
|
81
|
-
assert data["advisor_blocks"] == 1
|
|
82
|
-
assert "entry_types" in data
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def test_brief_json(cli_path, fixtures_dir):
|
|
86
|
-
data = _json(_run_cli(
|
|
87
|
-
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
88
|
-
"--mode", "brief", "--format", "json",
|
|
89
|
-
))
|
|
90
|
-
assert data["exists"] is True
|
|
91
|
-
assert data["tool_counts"]["Bash"] == 1
|
|
92
|
-
assert isinstance(data["files_touched"], list)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def test_changelog_json(cli_path, fixtures_dir):
|
|
96
|
-
data = _json(_run_cli(
|
|
97
|
-
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
98
|
-
"--mode", "changelog", "--format", "json",
|
|
99
|
-
))
|
|
100
|
-
assert len(data) == 9
|
|
101
|
-
assert data[0]["tool"] == "Bash"
|
|
102
|
-
assert "input" not in data[0]
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def test_tool_calls_json_includes_input(cli_path, fixtures_dir):
|
|
106
|
-
data = _json(_run_cli(
|
|
107
|
-
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
108
|
-
"--mode", "tool-calls", "--format", "json", "--tool", "Bash",
|
|
109
|
-
))
|
|
110
|
-
assert len(data) == 1
|
|
111
|
-
assert data[0]["input"]["command"] == "ls -la /tmp"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def test_file_edits_json(cli_path, fixtures_dir):
|
|
115
|
-
data = _json(_run_cli(
|
|
116
|
-
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
117
|
-
"--mode", "file-edits", "--format", "json",
|
|
118
|
-
))
|
|
119
|
-
paths = [row["path"] for row in data]
|
|
120
|
-
assert any("foo.py" in p for p in paths)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
def test_subagent_finals_json(cli_path, fixtures_dir):
|
|
124
|
-
data = _json(_run_cli(
|
|
125
|
-
cli_path, "--file", str(fixtures_dir / "subagent-parent.jsonl"),
|
|
126
|
-
"--mode", "subagent-finals", "--format", "json",
|
|
127
|
-
))
|
|
128
|
-
assert data[0]["agentType"] == "Explore"
|
|
129
|
-
assert "Found it" in data[0]["text"]
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def test_search_json_single_file(cli_path, fixtures_dir):
|
|
133
|
-
data = _json(_run_cli(
|
|
134
|
-
cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
|
|
135
|
-
"--mode", "search", "--query", "help", "--format", "json",
|
|
136
|
-
))
|
|
137
|
-
assert len(data) == 1
|
|
138
|
-
assert data[0]["role"] == "assistant"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def test_list_json(cli_path, fixtures_dir, tmp_path):
|
|
142
|
-
fake_root = tmp_path / "projects"
|
|
143
|
-
fake_proj = fake_root / "C--fake-proj"
|
|
144
|
-
fake_proj.mkdir(parents=True)
|
|
145
|
-
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
146
|
-
data = _json(_run_cli(
|
|
147
|
-
cli_path, "--root", str(fake_root), "--all-projects",
|
|
148
|
-
"--mode", "list", "--format", "json",
|
|
149
|
-
))
|
|
150
|
-
assert len(data) == 1
|
|
151
|
-
assert data[0]["uuid"] == "abc"
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def test_journal_json(cli_path, fixtures_dir, tmp_path):
|
|
155
|
-
fake_root = tmp_path / "projects"
|
|
156
|
-
fake_proj = fake_root / "C--fake-proj"
|
|
157
|
-
fake_proj.mkdir(parents=True)
|
|
158
|
-
shutil.copy(fixtures_dir / "tool-zoo.jsonl", fake_proj / "def.jsonl")
|
|
159
|
-
data = _json(_run_cli(
|
|
160
|
-
cli_path, "--root", str(fake_root), "--all-projects",
|
|
161
|
-
"--mode", "journal", "--since", "2020-01-01", "--format", "json",
|
|
162
|
-
))
|
|
163
|
-
assert data[0]["uuid"] == "def"
|
|
164
|
-
assert data[0]["tool_counts"]["Bash"] == 1
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
def test_count_json(cli_path, fixtures_dir, tmp_path):
|
|
168
|
-
fake_root = tmp_path / "projects"
|
|
169
|
-
fake_proj = fake_root / "C--fake-proj"
|
|
170
|
-
fake_proj.mkdir(parents=True)
|
|
171
|
-
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
172
|
-
data = _json(_run_cli(
|
|
173
|
-
cli_path, "--root", str(fake_root), "--all-projects",
|
|
174
|
-
"--mode", "count", "--query", "help", "--format", "json",
|
|
175
|
-
))
|
|
176
|
-
assert data == {"sessions": 1, "messages": 2, "matches": 1}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def test_count_text_unchanged(cli_path, fixtures_dir, tmp_path):
|
|
180
|
-
fake_root = tmp_path / "projects"
|
|
181
|
-
fake_proj = fake_root / "C--fake-proj"
|
|
182
|
-
fake_proj.mkdir(parents=True)
|
|
183
|
-
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
184
|
-
r = _run_cli(
|
|
185
|
-
cli_path, "--root", str(fake_root), "--all-projects",
|
|
186
|
-
"--mode", "count", "--query", "help",
|
|
187
|
-
)
|
|
188
|
-
assert r.returncode == 0
|
|
189
|
-
assert r.stdout.strip() == "1"
|
|
190
|
-
assert "1 sessions" in r.stderr
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
def test_diff_json(cli_path, fixtures_dir):
|
|
194
|
-
data = _json(_run_cli(
|
|
195
|
-
cli_path, "--mode", "diff",
|
|
196
|
-
"--file-a", str(fixtures_dir / "basic-session.jsonl"),
|
|
197
|
-
"--file-b", str(fixtures_dir / "with-thinking.jsonl"),
|
|
198
|
-
"--format", "json",
|
|
199
|
-
))
|
|
200
|
-
sources = {m["source"] for m in data["messages"]}
|
|
201
|
-
assert sources == {"A", "B"}
|
|
1
|
+
"""Tests for --format json across modes."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _run_cli(cli_path, *args, env_overrides=None):
|
|
14
|
+
env = dict(os.environ)
|
|
15
|
+
env["PYTHONIOENCODING"] = "utf-8"
|
|
16
|
+
if env_overrides:
|
|
17
|
+
env.update(env_overrides)
|
|
18
|
+
return subprocess.run(
|
|
19
|
+
[sys.executable, str(cli_path), *args],
|
|
20
|
+
capture_output=True,
|
|
21
|
+
text=True,
|
|
22
|
+
encoding="utf-8",
|
|
23
|
+
env=env,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _json(r):
|
|
28
|
+
assert r.returncode == 0, r.stderr
|
|
29
|
+
return json.loads(r.stdout)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_last_json(cli_path, fixtures_dir):
|
|
33
|
+
data = _json(_run_cli(
|
|
34
|
+
cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
|
|
35
|
+
"--mode", "last", "--format", "json",
|
|
36
|
+
))
|
|
37
|
+
assert isinstance(data, list)
|
|
38
|
+
assert data[-1]["n_from_end"] == 1
|
|
39
|
+
assert "Here is help" in data[-1]["text"]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_json_alias_flag(cli_path, fixtures_dir):
|
|
43
|
+
data = _json(_run_cli(
|
|
44
|
+
cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
|
|
45
|
+
"--mode", "last", "--json",
|
|
46
|
+
))
|
|
47
|
+
assert isinstance(data, list)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_advisor_json(cli_path, fixtures_dir):
|
|
51
|
+
data = _json(_run_cli(
|
|
52
|
+
cli_path, "--file", str(fixtures_dir / "with-advisor.jsonl"),
|
|
53
|
+
"--mode", "advisor", "--format", "json",
|
|
54
|
+
))
|
|
55
|
+
assert data == ["The advisor says do X then Y."]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_pre_compact_json(cli_path, fixtures_dir):
|
|
59
|
+
data = _json(_run_cli(
|
|
60
|
+
cli_path, "--file", str(fixtures_dir / "with-compact.jsonl"),
|
|
61
|
+
"--mode", "pre-compact", "--format", "json",
|
|
62
|
+
))
|
|
63
|
+
assert data["found_compact"] is True
|
|
64
|
+
assert any("First answer" in m["text"] for m in data["messages"])
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_dump_json(cli_path, fixtures_dir):
|
|
68
|
+
data = _json(_run_cli(
|
|
69
|
+
cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
|
|
70
|
+
"--mode", "dump", "--format", "json",
|
|
71
|
+
))
|
|
72
|
+
assert isinstance(data, list)
|
|
73
|
+
assert data[0]["role"] == "user"
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_debug_json(cli_path, fixtures_dir):
|
|
77
|
+
data = _json(_run_cli(
|
|
78
|
+
cli_path, "--file", str(fixtures_dir / "with-advisor.jsonl"),
|
|
79
|
+
"--mode", "debug", "--format", "json",
|
|
80
|
+
))
|
|
81
|
+
assert data["advisor_blocks"] == 1
|
|
82
|
+
assert "entry_types" in data
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_brief_json(cli_path, fixtures_dir):
|
|
86
|
+
data = _json(_run_cli(
|
|
87
|
+
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
88
|
+
"--mode", "brief", "--format", "json",
|
|
89
|
+
))
|
|
90
|
+
assert data["exists"] is True
|
|
91
|
+
assert data["tool_counts"]["Bash"] == 1
|
|
92
|
+
assert isinstance(data["files_touched"], list)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_changelog_json(cli_path, fixtures_dir):
|
|
96
|
+
data = _json(_run_cli(
|
|
97
|
+
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
98
|
+
"--mode", "changelog", "--format", "json",
|
|
99
|
+
))
|
|
100
|
+
assert len(data) == 9
|
|
101
|
+
assert data[0]["tool"] == "Bash"
|
|
102
|
+
assert "input" not in data[0]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def test_tool_calls_json_includes_input(cli_path, fixtures_dir):
|
|
106
|
+
data = _json(_run_cli(
|
|
107
|
+
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
108
|
+
"--mode", "tool-calls", "--format", "json", "--tool", "Bash",
|
|
109
|
+
))
|
|
110
|
+
assert len(data) == 1
|
|
111
|
+
assert data[0]["input"]["command"] == "ls -la /tmp"
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def test_file_edits_json(cli_path, fixtures_dir):
|
|
115
|
+
data = _json(_run_cli(
|
|
116
|
+
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
117
|
+
"--mode", "file-edits", "--format", "json",
|
|
118
|
+
))
|
|
119
|
+
paths = [row["path"] for row in data]
|
|
120
|
+
assert any("foo.py" in p for p in paths)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def test_subagent_finals_json(cli_path, fixtures_dir):
|
|
124
|
+
data = _json(_run_cli(
|
|
125
|
+
cli_path, "--file", str(fixtures_dir / "subagent-parent.jsonl"),
|
|
126
|
+
"--mode", "subagent-finals", "--format", "json",
|
|
127
|
+
))
|
|
128
|
+
assert data[0]["agentType"] == "Explore"
|
|
129
|
+
assert "Found it" in data[0]["text"]
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def test_search_json_single_file(cli_path, fixtures_dir):
|
|
133
|
+
data = _json(_run_cli(
|
|
134
|
+
cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
|
|
135
|
+
"--mode", "search", "--query", "help", "--format", "json",
|
|
136
|
+
))
|
|
137
|
+
assert len(data) == 1
|
|
138
|
+
assert data[0]["role"] == "assistant"
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def test_list_json(cli_path, fixtures_dir, tmp_path):
|
|
142
|
+
fake_root = tmp_path / "projects"
|
|
143
|
+
fake_proj = fake_root / "C--fake-proj"
|
|
144
|
+
fake_proj.mkdir(parents=True)
|
|
145
|
+
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
146
|
+
data = _json(_run_cli(
|
|
147
|
+
cli_path, "--root", str(fake_root), "--all-projects",
|
|
148
|
+
"--mode", "list", "--format", "json",
|
|
149
|
+
))
|
|
150
|
+
assert len(data) == 1
|
|
151
|
+
assert data[0]["uuid"] == "abc"
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def test_journal_json(cli_path, fixtures_dir, tmp_path):
|
|
155
|
+
fake_root = tmp_path / "projects"
|
|
156
|
+
fake_proj = fake_root / "C--fake-proj"
|
|
157
|
+
fake_proj.mkdir(parents=True)
|
|
158
|
+
shutil.copy(fixtures_dir / "tool-zoo.jsonl", fake_proj / "def.jsonl")
|
|
159
|
+
data = _json(_run_cli(
|
|
160
|
+
cli_path, "--root", str(fake_root), "--all-projects",
|
|
161
|
+
"--mode", "journal", "--since", "2020-01-01", "--format", "json",
|
|
162
|
+
))
|
|
163
|
+
assert data[0]["uuid"] == "def"
|
|
164
|
+
assert data[0]["tool_counts"]["Bash"] == 1
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def test_count_json(cli_path, fixtures_dir, tmp_path):
|
|
168
|
+
fake_root = tmp_path / "projects"
|
|
169
|
+
fake_proj = fake_root / "C--fake-proj"
|
|
170
|
+
fake_proj.mkdir(parents=True)
|
|
171
|
+
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
172
|
+
data = _json(_run_cli(
|
|
173
|
+
cli_path, "--root", str(fake_root), "--all-projects",
|
|
174
|
+
"--mode", "count", "--query", "help", "--format", "json",
|
|
175
|
+
))
|
|
176
|
+
assert data == {"sessions": 1, "messages": 2, "matches": 1}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def test_count_text_unchanged(cli_path, fixtures_dir, tmp_path):
|
|
180
|
+
fake_root = tmp_path / "projects"
|
|
181
|
+
fake_proj = fake_root / "C--fake-proj"
|
|
182
|
+
fake_proj.mkdir(parents=True)
|
|
183
|
+
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
184
|
+
r = _run_cli(
|
|
185
|
+
cli_path, "--root", str(fake_root), "--all-projects",
|
|
186
|
+
"--mode", "count", "--query", "help",
|
|
187
|
+
)
|
|
188
|
+
assert r.returncode == 0
|
|
189
|
+
assert r.stdout.strip() == "1"
|
|
190
|
+
assert "1 sessions" in r.stderr
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def test_diff_json(cli_path, fixtures_dir):
|
|
194
|
+
data = _json(_run_cli(
|
|
195
|
+
cli_path, "--mode", "diff",
|
|
196
|
+
"--file-a", str(fixtures_dir / "basic-session.jsonl"),
|
|
197
|
+
"--file-b", str(fixtures_dir / "with-thinking.jsonl"),
|
|
198
|
+
"--format", "json",
|
|
199
|
+
))
|
|
200
|
+
sources = {m["source"] for m in data["messages"]}
|
|
201
|
+
assert sources == {"A", "B"}
|