elliot-stack 1.0.29 → 1.0.33
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/README.md +5 -0
- package/bin/install.cjs +981 -950
- 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 +235 -0
- package/skills/estack-leadership-coach/adding-references.md +280 -0
- package/skills/estack-leadership-coach/frameworks/delegation/flows/post-mortem.md +120 -0
- package/skills/estack-leadership-coach/frameworks/delegation/flows/pre-delegation.md +138 -0
- package/skills/estack-leadership-coach/frameworks/delegation/phases/1-intake.md +145 -0
- package/skills/estack-leadership-coach/frameworks/delegation/phases/2-trm-assessment.md +119 -0
- package/skills/estack-leadership-coach/frameworks/delegation/phases/3-enrollment.md +132 -0
- package/skills/estack-leadership-coach/frameworks/delegation/phases/4-build-brief.md +171 -0
- package/skills/estack-leadership-coach/frameworks/delegation/phases/5-monitoring.md +134 -0
- package/skills/estack-leadership-coach/frameworks/delegation/phases/6-reverse-delegation.md +118 -0
- package/skills/estack-leadership-coach/frameworks/delegation/phases/7-diagnose.md +200 -0
- package/skills/estack-leadership-coach/references/.source-files/deci-ryan_self-determination-theory__deci-olafsen-ryan-2017-self-determination-theory-in-work-organizations.md +1881 -0
- package/skills/estack-leadership-coach/references/.source-files/deci-ryan_self-determination-theory__gagne-deci-2005-self-determination-theory-and-work-motivation.md +2058 -0
- package/skills/estack-leadership-coach/references/.source-files/deci-ryan_self-determination-theory__selfdeterminationtheory-org-theory-overview-page.md +61 -0
- package/skills/estack-leadership-coach/references/.source-files/gallup_engagement-research__gallup-3-key-insights-into-the-global-workplace-2024.md +57 -0
- package/skills/estack-leadership-coach/references/.source-files/gallup_engagement-research__gallup-managers-account-for-70-percent-of-variance-in-employee-engagement-2015.md +40 -0
- package/skills/estack-leadership-coach/references/.source-files/gallup_engagement-research__gallup-state-of-the-global-workplace-2026-global-data-summary.md +73 -0
- package/skills/estack-leadership-coach/references/.source-files/gallup_engagement-research__gallup-state-of-the-global-workplace-2026-report-landing.md +42 -0
- package/skills/estack-leadership-coach/references/.source-files/hormozi-leila_4-stages__leila-hormozi-the-art-of-delegation-blog-post.md +91 -0
- package/skills/estack-leadership-coach/references/.source-files/oncken-wass_monkeys-hbr-1974__oncken-wass-management-time-whos-got-the-monkey-hbr-classic-1974.md +969 -0
- package/skills/estack-leadership-coach/references/.source-files/sanchez_main-street-millionaire__codie-sanchez-afford-anything-podcast-ep-565-show-notes.md +89 -0
- package/skills/estack-leadership-coach/references/.source-files/sullivan_who-not-how__dan-sullivan-impact-filter-tool-and-guide-booklet.md +565 -0
- package/skills/estack-leadership-coach/references/.source-files/van-edwards_cues__vanessa-van-edwards-lewis-howes-school-of-greatness-ep-1231-show-notes.md +122 -0
- package/skills/estack-leadership-coach/references/.source-files/van-edwards_cues__vanessa-van-edwards-roger-dooley-cues-interview.md +194 -0
- package/skills/estack-leadership-coach/references/deci-ryan_self-determination-theory.md +166 -0
- package/skills/estack-leadership-coach/references/doerr_measure-what-matters.md +154 -0
- package/skills/estack-leadership-coach/references/ferriss_4hww.md +189 -0
- package/skills/estack-leadership-coach/references/gallup_engagement-research.md +105 -0
- package/skills/estack-leadership-coach/references/gerber_e-myth-revisited.md +118 -0
- package/skills/estack-leadership-coach/references/grove_high-output-management.md +95 -0
- package/skills/estack-leadership-coach/references/hormozi-alex_followthrough.md +152 -0
- package/skills/estack-leadership-coach/references/hormozi-leila_4-stages.md +146 -0
- package/skills/estack-leadership-coach/references/oncken-wass_monkeys-hbr-1974.md +128 -0
- package/skills/estack-leadership-coach/references/sanchez_main-street-millionaire.md +196 -0
- package/skills/estack-leadership-coach/references/sullivan_who-not-how.md +137 -0
- package/skills/estack-leadership-coach/references/van-edwards_cues.md +189 -0
- package/skills/estack-migrate-claude-session-history/SKILL.md +226 -0
- package/skills/estack-migrate-claude-session-history/references/path-encoding.md +55 -0
- package/skills/estack-migrate-claude-session-history/references/troubleshooting.md +96 -0
- package/skills/estack-migrate-claude-session-history/scripts/migrate-claude-history.js +1123 -0
- package/skills/estack-migrate-claude-session-history/scripts/test-append-note.js +48 -0
- package/skills/estack-migrate-claude-session-history/scripts/test-validate-migration.py +326 -0
- package/skills/estack-migrate-claude-session-history/scripts/validate-migration.py +493 -0
- package/skills/estack-pdf-to-md/SKILL.md +180 -0
- package/skills/estack-pdf-to-md/scripts/pdf_to_md.py +596 -0
- package/skills/estack-productivity-prioritization-coach/SKILL.md +124 -0
- package/skills/estack-productivity-prioritization-coach/sources/01-tony-robbins-rpm.md +39 -0
- package/skills/estack-productivity-prioritization-coach/sources/02-justin-sung-task-prioritization.md +34 -0
- 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 +204 -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
- package/skills/estack-repo-search/SKILL.md +65 -65
- package/skills/estack-vscode-file-recovery/SKILL.md +188 -0
|
@@ -1,199 +1,199 @@
|
|
|
1
|
-
"""End-to-end CLI tests via subprocess.run.
|
|
2
|
-
|
|
3
|
-
Exercises mode dispatch + argument parsing. Library-level behavior is
|
|
4
|
-
covered by the unit tests in test_paths/parser/tools/search/subagents.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import json
|
|
8
|
-
import os
|
|
9
|
-
import shutil
|
|
10
|
-
import subprocess
|
|
11
|
-
import sys
|
|
12
|
-
from pathlib import Path
|
|
13
|
-
|
|
14
|
-
import pytest
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def _run_cli(cli_path, *args, env_overrides=None):
|
|
18
|
-
env = dict(os.environ)
|
|
19
|
-
env["PYTHONIOENCODING"] = "utf-8"
|
|
20
|
-
if env_overrides:
|
|
21
|
-
env.update(env_overrides)
|
|
22
|
-
return subprocess.run(
|
|
23
|
-
[sys.executable, str(cli_path), *args],
|
|
24
|
-
capture_output=True,
|
|
25
|
-
text=True,
|
|
26
|
-
encoding="utf-8",
|
|
27
|
-
env=env,
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def test_help(cli_path):
|
|
32
|
-
r = _run_cli(cli_path, "--help")
|
|
33
|
-
assert r.returncode == 0
|
|
34
|
-
assert "--mode" in r.stdout
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def test_last_mode(cli_path, fixtures_dir):
|
|
38
|
-
r = _run_cli(cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"), "--mode", "last")
|
|
39
|
-
assert r.returncode == 0
|
|
40
|
-
assert "Here is help" in r.stdout
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def test_advisor_mode(cli_path, fixtures_dir):
|
|
44
|
-
r = _run_cli(cli_path, "--file", str(fixtures_dir / "with-advisor.jsonl"), "--mode", "advisor")
|
|
45
|
-
assert r.returncode == 0
|
|
46
|
-
assert "advisor" in r.stdout.lower()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def test_pre_compact_mode(cli_path, fixtures_dir):
|
|
50
|
-
r = _run_cli(cli_path, "--file", str(fixtures_dir / "with-compact.jsonl"), "--mode", "pre-compact")
|
|
51
|
-
assert r.returncode == 0
|
|
52
|
-
assert "Pre-compact" in r.stdout or "First answer" in r.stdout
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def test_debug_mode(cli_path, fixtures_dir):
|
|
56
|
-
r = _run_cli(cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"), "--mode", "debug")
|
|
57
|
-
assert r.returncode == 0
|
|
58
|
-
assert "Entry type distribution" in r.stdout
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def test_brief_mode(cli_path, fixtures_dir):
|
|
62
|
-
r = _run_cli(cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"), "--mode", "brief")
|
|
63
|
-
assert r.returncode == 0
|
|
64
|
-
body = r.stdout
|
|
65
|
-
# 6 lines expected
|
|
66
|
-
assert "intent:" in body
|
|
67
|
-
assert "last:" in body
|
|
68
|
-
assert "edits:" in body
|
|
69
|
-
assert "tools:" in body
|
|
70
|
-
assert "subagents:" in body
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def test_brief_with_include_subagents(cli_path, fixtures_dir):
|
|
74
|
-
r = _run_cli(
|
|
75
|
-
cli_path, "--file", str(fixtures_dir / "subagent-parent.jsonl"),
|
|
76
|
-
"--mode", "brief", "--include-subagents",
|
|
77
|
-
)
|
|
78
|
-
assert r.returncode == 0
|
|
79
|
-
assert "subagent" in r.stdout.lower()
|
|
80
|
-
assert "Found it" in r.stdout
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def test_changelog(cli_path, fixtures_dir):
|
|
84
|
-
r = _run_cli(cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"), "--mode", "changelog")
|
|
85
|
-
assert r.returncode == 0
|
|
86
|
-
assert "Bash" in r.stdout
|
|
87
|
-
assert "Read" in r.stdout
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def test_file_edits(cli_path, fixtures_dir):
|
|
91
|
-
r = _run_cli(cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"), "--mode", "file-edits")
|
|
92
|
-
assert r.returncode == 0
|
|
93
|
-
assert "foo.py" in r.stdout
|
|
94
|
-
assert "bar.py" in r.stdout
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def test_tool_calls(cli_path, fixtures_dir):
|
|
98
|
-
r = _run_cli(cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"), "--mode", "tool-calls")
|
|
99
|
-
assert r.returncode == 0
|
|
100
|
-
assert "Bash" in r.stdout
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def test_tool_calls_filter(cli_path, fixtures_dir):
|
|
104
|
-
r = _run_cli(
|
|
105
|
-
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
106
|
-
"--mode", "tool-calls", "--tool", "Bash",
|
|
107
|
-
)
|
|
108
|
-
assert r.returncode == 0
|
|
109
|
-
assert "Bash" in r.stdout
|
|
110
|
-
assert "Glob" not in r.stdout
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def test_subagent_list(cli_path, fixtures_dir):
|
|
114
|
-
r = _run_cli(
|
|
115
|
-
cli_path, "--file", str(fixtures_dir / "subagent-parent.jsonl"),
|
|
116
|
-
"--mode", "subagent-list",
|
|
117
|
-
)
|
|
118
|
-
assert r.returncode == 0
|
|
119
|
-
assert "agent-xyz123" in r.stdout
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
def test_subagent_finals(cli_path, fixtures_dir):
|
|
123
|
-
r = _run_cli(
|
|
124
|
-
cli_path, "--file", str(fixtures_dir / "subagent-parent.jsonl"),
|
|
125
|
-
"--mode", "subagent-finals",
|
|
126
|
-
)
|
|
127
|
-
assert r.returncode == 0
|
|
128
|
-
assert "Found it" in r.stdout
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
def test_diff_mode(cli_path, fixtures_dir):
|
|
132
|
-
r = _run_cli(
|
|
133
|
-
cli_path, "--mode", "diff",
|
|
134
|
-
"--file-a", str(fixtures_dir / "basic-session.jsonl"),
|
|
135
|
-
"--file-b", str(fixtures_dir / "with-thinking.jsonl"),
|
|
136
|
-
)
|
|
137
|
-
assert r.returncode == 0
|
|
138
|
-
assert "A>" in r.stdout
|
|
139
|
-
assert "B>" in r.stdout
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
def test_lookup_no_match(cli_path, fixtures_dir, tmp_path):
|
|
143
|
-
# Point --root at an empty dir so lookup definitely misses
|
|
144
|
-
r = _run_cli(cli_path, "--root", str(tmp_path), "--mode", "lookup", "--uuid", "nope")
|
|
145
|
-
assert r.returncode == 1
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
def test_list_legacy_format(cli_path, fixtures_dir, tmp_path):
|
|
149
|
-
# Build a fake project root + cwd that matches encoding
|
|
150
|
-
fake_root = tmp_path / "projects"
|
|
151
|
-
fake_proj = fake_root / "C--fake-proj"
|
|
152
|
-
fake_proj.mkdir(parents=True)
|
|
153
|
-
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
154
|
-
r = _run_cli(cli_path, "--root", str(fake_root), "--cwd", "C:\\fake\\proj", "--list")
|
|
155
|
-
assert r.returncode == 0
|
|
156
|
-
assert "abc.jsonl" in r.stdout
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
def test_exclude_current(cli_path, fixtures_dir, tmp_path):
|
|
160
|
-
fake_root = tmp_path / "projects"
|
|
161
|
-
fake_proj = fake_root / "C--fake-proj"
|
|
162
|
-
fake_proj.mkdir(parents=True)
|
|
163
|
-
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
164
|
-
shutil.copy(fixtures_dir / "tool-zoo.jsonl", fake_proj / "def.jsonl")
|
|
165
|
-
r = _run_cli(
|
|
166
|
-
cli_path, "--root", str(fake_root), "--cwd", "C:\\fake\\proj",
|
|
167
|
-
"--mode", "list", "--exclude-current",
|
|
168
|
-
env_overrides={"CLAUDE_SESSION_ID": "abc"},
|
|
169
|
-
)
|
|
170
|
-
assert r.returncode == 0
|
|
171
|
-
assert "def" in r.stdout
|
|
172
|
-
assert "abc" not in r.stdout
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
def test_dump_large_file_degrades(cli_path, fixtures_dir, tmp_path):
|
|
176
|
-
# Build a 6MB padded fixture by writing many valid lines
|
|
177
|
-
big = tmp_path / "big.jsonl"
|
|
178
|
-
line = '{"type":"user","timestamp":"2026-05-01T10:00:00Z","message":{"role":"user","content":"'
|
|
179
|
-
pad = "x" * 1000 + '"}}\n'
|
|
180
|
-
with open(big, "w", encoding="utf-8") as f:
|
|
181
|
-
# Each line ~1KB → write ~7000 to hit 6MB+
|
|
182
|
-
for _ in range(7000):
|
|
183
|
-
f.write(line + pad)
|
|
184
|
-
r = _run_cli(cli_path, "--file", str(big), "--mode", "dump")
|
|
185
|
-
assert r.returncode == 0
|
|
186
|
-
assert "degraded" in r.stderr.lower()
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def test_dump_large_file_force(cli_path, tmp_path):
|
|
190
|
-
big = tmp_path / "big.jsonl"
|
|
191
|
-
line = '{"type":"user","timestamp":"2026-05-01T10:00:00Z","message":{"role":"user","content":"'
|
|
192
|
-
pad = "x" * 1000 + '"}}\n'
|
|
193
|
-
with open(big, "w", encoding="utf-8") as f:
|
|
194
|
-
for _ in range(7000):
|
|
195
|
-
f.write(line + pad)
|
|
196
|
-
r = _run_cli(cli_path, "--file", str(big), "--mode", "dump", "--force-dump")
|
|
197
|
-
assert r.returncode == 0
|
|
198
|
-
# No degrade note when forced
|
|
199
|
-
assert "degraded" not in r.stderr.lower()
|
|
1
|
+
"""End-to-end CLI tests via subprocess.run.
|
|
2
|
+
|
|
3
|
+
Exercises mode dispatch + argument parsing. Library-level behavior is
|
|
4
|
+
covered by the unit tests in test_paths/parser/tools/search/subagents.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
import shutil
|
|
10
|
+
import subprocess
|
|
11
|
+
import sys
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
import pytest
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _run_cli(cli_path, *args, env_overrides=None):
|
|
18
|
+
env = dict(os.environ)
|
|
19
|
+
env["PYTHONIOENCODING"] = "utf-8"
|
|
20
|
+
if env_overrides:
|
|
21
|
+
env.update(env_overrides)
|
|
22
|
+
return subprocess.run(
|
|
23
|
+
[sys.executable, str(cli_path), *args],
|
|
24
|
+
capture_output=True,
|
|
25
|
+
text=True,
|
|
26
|
+
encoding="utf-8",
|
|
27
|
+
env=env,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_help(cli_path):
|
|
32
|
+
r = _run_cli(cli_path, "--help")
|
|
33
|
+
assert r.returncode == 0
|
|
34
|
+
assert "--mode" in r.stdout
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_last_mode(cli_path, fixtures_dir):
|
|
38
|
+
r = _run_cli(cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"), "--mode", "last")
|
|
39
|
+
assert r.returncode == 0
|
|
40
|
+
assert "Here is help" in r.stdout
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_advisor_mode(cli_path, fixtures_dir):
|
|
44
|
+
r = _run_cli(cli_path, "--file", str(fixtures_dir / "with-advisor.jsonl"), "--mode", "advisor")
|
|
45
|
+
assert r.returncode == 0
|
|
46
|
+
assert "advisor" in r.stdout.lower()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_pre_compact_mode(cli_path, fixtures_dir):
|
|
50
|
+
r = _run_cli(cli_path, "--file", str(fixtures_dir / "with-compact.jsonl"), "--mode", "pre-compact")
|
|
51
|
+
assert r.returncode == 0
|
|
52
|
+
assert "Pre-compact" in r.stdout or "First answer" in r.stdout
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_debug_mode(cli_path, fixtures_dir):
|
|
56
|
+
r = _run_cli(cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"), "--mode", "debug")
|
|
57
|
+
assert r.returncode == 0
|
|
58
|
+
assert "Entry type distribution" in r.stdout
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_brief_mode(cli_path, fixtures_dir):
|
|
62
|
+
r = _run_cli(cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"), "--mode", "brief")
|
|
63
|
+
assert r.returncode == 0
|
|
64
|
+
body = r.stdout
|
|
65
|
+
# 6 lines expected
|
|
66
|
+
assert "intent:" in body
|
|
67
|
+
assert "last:" in body
|
|
68
|
+
assert "edits:" in body
|
|
69
|
+
assert "tools:" in body
|
|
70
|
+
assert "subagents:" in body
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_brief_with_include_subagents(cli_path, fixtures_dir):
|
|
74
|
+
r = _run_cli(
|
|
75
|
+
cli_path, "--file", str(fixtures_dir / "subagent-parent.jsonl"),
|
|
76
|
+
"--mode", "brief", "--include-subagents",
|
|
77
|
+
)
|
|
78
|
+
assert r.returncode == 0
|
|
79
|
+
assert "subagent" in r.stdout.lower()
|
|
80
|
+
assert "Found it" in r.stdout
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def test_changelog(cli_path, fixtures_dir):
|
|
84
|
+
r = _run_cli(cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"), "--mode", "changelog")
|
|
85
|
+
assert r.returncode == 0
|
|
86
|
+
assert "Bash" in r.stdout
|
|
87
|
+
assert "Read" in r.stdout
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def test_file_edits(cli_path, fixtures_dir):
|
|
91
|
+
r = _run_cli(cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"), "--mode", "file-edits")
|
|
92
|
+
assert r.returncode == 0
|
|
93
|
+
assert "foo.py" in r.stdout
|
|
94
|
+
assert "bar.py" in r.stdout
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def test_tool_calls(cli_path, fixtures_dir):
|
|
98
|
+
r = _run_cli(cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"), "--mode", "tool-calls")
|
|
99
|
+
assert r.returncode == 0
|
|
100
|
+
assert "Bash" in r.stdout
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def test_tool_calls_filter(cli_path, fixtures_dir):
|
|
104
|
+
r = _run_cli(
|
|
105
|
+
cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
|
|
106
|
+
"--mode", "tool-calls", "--tool", "Bash",
|
|
107
|
+
)
|
|
108
|
+
assert r.returncode == 0
|
|
109
|
+
assert "Bash" in r.stdout
|
|
110
|
+
assert "Glob" not in r.stdout
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def test_subagent_list(cli_path, fixtures_dir):
|
|
114
|
+
r = _run_cli(
|
|
115
|
+
cli_path, "--file", str(fixtures_dir / "subagent-parent.jsonl"),
|
|
116
|
+
"--mode", "subagent-list",
|
|
117
|
+
)
|
|
118
|
+
assert r.returncode == 0
|
|
119
|
+
assert "agent-xyz123" in r.stdout
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def test_subagent_finals(cli_path, fixtures_dir):
|
|
123
|
+
r = _run_cli(
|
|
124
|
+
cli_path, "--file", str(fixtures_dir / "subagent-parent.jsonl"),
|
|
125
|
+
"--mode", "subagent-finals",
|
|
126
|
+
)
|
|
127
|
+
assert r.returncode == 0
|
|
128
|
+
assert "Found it" in r.stdout
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def test_diff_mode(cli_path, fixtures_dir):
|
|
132
|
+
r = _run_cli(
|
|
133
|
+
cli_path, "--mode", "diff",
|
|
134
|
+
"--file-a", str(fixtures_dir / "basic-session.jsonl"),
|
|
135
|
+
"--file-b", str(fixtures_dir / "with-thinking.jsonl"),
|
|
136
|
+
)
|
|
137
|
+
assert r.returncode == 0
|
|
138
|
+
assert "A>" in r.stdout
|
|
139
|
+
assert "B>" in r.stdout
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def test_lookup_no_match(cli_path, fixtures_dir, tmp_path):
|
|
143
|
+
# Point --root at an empty dir so lookup definitely misses
|
|
144
|
+
r = _run_cli(cli_path, "--root", str(tmp_path), "--mode", "lookup", "--uuid", "nope")
|
|
145
|
+
assert r.returncode == 1
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def test_list_legacy_format(cli_path, fixtures_dir, tmp_path):
|
|
149
|
+
# Build a fake project root + cwd that matches encoding
|
|
150
|
+
fake_root = tmp_path / "projects"
|
|
151
|
+
fake_proj = fake_root / "C--fake-proj"
|
|
152
|
+
fake_proj.mkdir(parents=True)
|
|
153
|
+
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
154
|
+
r = _run_cli(cli_path, "--root", str(fake_root), "--cwd", "C:\\fake\\proj", "--list")
|
|
155
|
+
assert r.returncode == 0
|
|
156
|
+
assert "abc.jsonl" in r.stdout
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def test_exclude_current(cli_path, fixtures_dir, tmp_path):
|
|
160
|
+
fake_root = tmp_path / "projects"
|
|
161
|
+
fake_proj = fake_root / "C--fake-proj"
|
|
162
|
+
fake_proj.mkdir(parents=True)
|
|
163
|
+
shutil.copy(fixtures_dir / "basic-session.jsonl", fake_proj / "abc.jsonl")
|
|
164
|
+
shutil.copy(fixtures_dir / "tool-zoo.jsonl", fake_proj / "def.jsonl")
|
|
165
|
+
r = _run_cli(
|
|
166
|
+
cli_path, "--root", str(fake_root), "--cwd", "C:\\fake\\proj",
|
|
167
|
+
"--mode", "list", "--exclude-current",
|
|
168
|
+
env_overrides={"CLAUDE_SESSION_ID": "abc"},
|
|
169
|
+
)
|
|
170
|
+
assert r.returncode == 0
|
|
171
|
+
assert "def" in r.stdout
|
|
172
|
+
assert "abc" not in r.stdout
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def test_dump_large_file_degrades(cli_path, fixtures_dir, tmp_path):
|
|
176
|
+
# Build a 6MB padded fixture by writing many valid lines
|
|
177
|
+
big = tmp_path / "big.jsonl"
|
|
178
|
+
line = '{"type":"user","timestamp":"2026-05-01T10:00:00Z","message":{"role":"user","content":"'
|
|
179
|
+
pad = "x" * 1000 + '"}}\n'
|
|
180
|
+
with open(big, "w", encoding="utf-8") as f:
|
|
181
|
+
# Each line ~1KB → write ~7000 to hit 6MB+
|
|
182
|
+
for _ in range(7000):
|
|
183
|
+
f.write(line + pad)
|
|
184
|
+
r = _run_cli(cli_path, "--file", str(big), "--mode", "dump")
|
|
185
|
+
assert r.returncode == 0
|
|
186
|
+
assert "degraded" in r.stderr.lower()
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def test_dump_large_file_force(cli_path, tmp_path):
|
|
190
|
+
big = tmp_path / "big.jsonl"
|
|
191
|
+
line = '{"type":"user","timestamp":"2026-05-01T10:00:00Z","message":{"role":"user","content":"'
|
|
192
|
+
pad = "x" * 1000 + '"}}\n'
|
|
193
|
+
with open(big, "w", encoding="utf-8") as f:
|
|
194
|
+
for _ in range(7000):
|
|
195
|
+
f.write(line + pad)
|
|
196
|
+
r = _run_cli(cli_path, "--file", str(big), "--mode", "dump", "--force-dump")
|
|
197
|
+
assert r.returncode == 0
|
|
198
|
+
# No degrade note when forced
|
|
199
|
+
assert "degraded" not in r.stderr.lower()
|