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.
Files changed (128) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +5 -0
  3. package/bin/install.cjs +981 -950
  4. package/hooks/repo-search-nudge.js +32 -32
  5. package/package.json +1 -1
  6. package/skills/estack-active-learning-tutor/SKILL.md +339 -339
  7. package/skills/estack-better-title/SKILL.md +64 -64
  8. package/skills/estack-better-title/scripts/rename.sh +55 -55
  9. package/skills/estack-chris-voss/SKILL.md +80 -80
  10. package/skills/estack-chris-voss/references/elliot-notes.md +120 -120
  11. package/skills/estack-chris-voss/references/voss-principles.md +210 -210
  12. package/skills/estack-customer-discovery/SKILL.md +60 -60
  13. package/skills/estack-flight-planner/SKILL.md +332 -332
  14. package/skills/estack-flight-planner/references/config_schema.md +156 -156
  15. package/skills/estack-flight-planner/references/flight_history_schema.md +97 -97
  16. package/skills/estack-flight-planner/references/shuttle_schedules.md +98 -98
  17. package/skills/estack-flight-planner/scripts/check_setup.sh +89 -89
  18. package/skills/estack-flight-planner/scripts/fetch_flights.py +99 -99
  19. package/skills/estack-flight-planner/scripts/filter_flights.py +265 -265
  20. package/skills/estack-flight-planner/scripts/pair_shuttles.py +173 -173
  21. package/skills/estack-github-issue-tracker/SKILL.md +322 -322
  22. package/skills/estack-github-issue-tracker/bin/tracker-tools.cjs +1358 -1358
  23. package/skills/estack-github-issue-tracker/references/gh-cli-patterns.md +124 -124
  24. package/skills/estack-github-issue-tracker/references/result-file-schema.md +156 -156
  25. package/skills/estack-github-issue-tracker/references/tracker-schema.md +96 -96
  26. package/skills/estack-github-issue-tracker/tracker-template.md +58 -58
  27. package/skills/estack-leadership-coach/SKILL.md +235 -0
  28. package/skills/estack-leadership-coach/adding-references.md +280 -0
  29. package/skills/estack-leadership-coach/frameworks/delegation/flows/post-mortem.md +120 -0
  30. package/skills/estack-leadership-coach/frameworks/delegation/flows/pre-delegation.md +138 -0
  31. package/skills/estack-leadership-coach/frameworks/delegation/phases/1-intake.md +145 -0
  32. package/skills/estack-leadership-coach/frameworks/delegation/phases/2-trm-assessment.md +119 -0
  33. package/skills/estack-leadership-coach/frameworks/delegation/phases/3-enrollment.md +132 -0
  34. package/skills/estack-leadership-coach/frameworks/delegation/phases/4-build-brief.md +171 -0
  35. package/skills/estack-leadership-coach/frameworks/delegation/phases/5-monitoring.md +134 -0
  36. package/skills/estack-leadership-coach/frameworks/delegation/phases/6-reverse-delegation.md +118 -0
  37. package/skills/estack-leadership-coach/frameworks/delegation/phases/7-diagnose.md +200 -0
  38. 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
  39. 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
  40. package/skills/estack-leadership-coach/references/.source-files/deci-ryan_self-determination-theory__selfdeterminationtheory-org-theory-overview-page.md +61 -0
  41. package/skills/estack-leadership-coach/references/.source-files/gallup_engagement-research__gallup-3-key-insights-into-the-global-workplace-2024.md +57 -0
  42. 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
  43. package/skills/estack-leadership-coach/references/.source-files/gallup_engagement-research__gallup-state-of-the-global-workplace-2026-global-data-summary.md +73 -0
  44. package/skills/estack-leadership-coach/references/.source-files/gallup_engagement-research__gallup-state-of-the-global-workplace-2026-report-landing.md +42 -0
  45. package/skills/estack-leadership-coach/references/.source-files/hormozi-leila_4-stages__leila-hormozi-the-art-of-delegation-blog-post.md +91 -0
  46. 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
  47. package/skills/estack-leadership-coach/references/.source-files/sanchez_main-street-millionaire__codie-sanchez-afford-anything-podcast-ep-565-show-notes.md +89 -0
  48. package/skills/estack-leadership-coach/references/.source-files/sullivan_who-not-how__dan-sullivan-impact-filter-tool-and-guide-booklet.md +565 -0
  49. 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
  50. package/skills/estack-leadership-coach/references/.source-files/van-edwards_cues__vanessa-van-edwards-roger-dooley-cues-interview.md +194 -0
  51. package/skills/estack-leadership-coach/references/deci-ryan_self-determination-theory.md +166 -0
  52. package/skills/estack-leadership-coach/references/doerr_measure-what-matters.md +154 -0
  53. package/skills/estack-leadership-coach/references/ferriss_4hww.md +189 -0
  54. package/skills/estack-leadership-coach/references/gallup_engagement-research.md +105 -0
  55. package/skills/estack-leadership-coach/references/gerber_e-myth-revisited.md +118 -0
  56. package/skills/estack-leadership-coach/references/grove_high-output-management.md +95 -0
  57. package/skills/estack-leadership-coach/references/hormozi-alex_followthrough.md +152 -0
  58. package/skills/estack-leadership-coach/references/hormozi-leila_4-stages.md +146 -0
  59. package/skills/estack-leadership-coach/references/oncken-wass_monkeys-hbr-1974.md +128 -0
  60. package/skills/estack-leadership-coach/references/sanchez_main-street-millionaire.md +196 -0
  61. package/skills/estack-leadership-coach/references/sullivan_who-not-how.md +137 -0
  62. package/skills/estack-leadership-coach/references/van-edwards_cues.md +189 -0
  63. package/skills/estack-migrate-claude-session-history/SKILL.md +226 -0
  64. package/skills/estack-migrate-claude-session-history/references/path-encoding.md +55 -0
  65. package/skills/estack-migrate-claude-session-history/references/troubleshooting.md +96 -0
  66. package/skills/estack-migrate-claude-session-history/scripts/migrate-claude-history.js +1123 -0
  67. package/skills/estack-migrate-claude-session-history/scripts/test-append-note.js +48 -0
  68. package/skills/estack-migrate-claude-session-history/scripts/test-validate-migration.py +326 -0
  69. package/skills/estack-migrate-claude-session-history/scripts/validate-migration.py +493 -0
  70. package/skills/estack-pdf-to-md/SKILL.md +180 -0
  71. package/skills/estack-pdf-to-md/scripts/pdf_to_md.py +596 -0
  72. package/skills/estack-productivity-prioritization-coach/SKILL.md +124 -0
  73. package/skills/estack-productivity-prioritization-coach/sources/01-tony-robbins-rpm.md +39 -0
  74. package/skills/estack-productivity-prioritization-coach/sources/02-justin-sung-task-prioritization.md +34 -0
  75. package/skills/estack-prompt-builder-coach/SKILL.md +81 -81
  76. package/skills/estack-prompt-builder-coach/definition-of-done-generator.md +42 -42
  77. package/skills/estack-prompt-builder-coach/prompt-builder.md +37 -37
  78. package/skills/estack-prompt-builder-coach/task-shaper.md +36 -36
  79. package/skills/estack-prompt-builder-coach/vague-ask-auditor.md +37 -37
  80. package/skills/estack-read-claude-session-history/SKILL.md +204 -204
  81. package/skills/estack-read-claude-session-history/references/jsonl-schema.md +126 -126
  82. package/skills/estack-read-claude-session-history/references/modes.md +423 -423
  83. package/skills/estack-read-claude-session-history/references/recipes.md +271 -271
  84. package/skills/estack-read-claude-session-history/scripts/lib/__init__.py +1 -1
  85. package/skills/estack-read-claude-session-history/scripts/lib/parser.py +460 -460
  86. package/skills/estack-read-claude-session-history/scripts/lib/paths.py +234 -234
  87. package/skills/estack-read-claude-session-history/scripts/lib/search.py +179 -179
  88. package/skills/estack-read-claude-session-history/scripts/lib/subagents.py +88 -88
  89. package/skills/estack-read-claude-session-history/scripts/lib/tools.py +144 -144
  90. package/skills/estack-read-claude-session-history/scripts/read_transcript.py +1776 -1776
  91. package/skills/estack-read-claude-session-history/scripts/tests/conftest.py +40 -40
  92. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/README.md +20 -20
  93. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/all-noise.jsonl +4 -4
  94. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/basic-session.jsonl +2 -2
  95. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-gaps.jsonl +9 -9
  96. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-noise.jsonl +7 -7
  97. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-parallel-a.jsonl +3 -3
  98. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-parallel-b.jsonl +3 -3
  99. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/engagement-waiting.jsonl +5 -5
  100. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/interrupted.jsonl +2 -2
  101. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/multi-compact.jsonl +8 -8
  102. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/pending-user.jsonl +2 -2
  103. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-no-meta/subagents/agent-aaa.jsonl +2 -2
  104. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-no-meta.jsonl +2 -2
  105. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-parent/subagents/agent-xyz123.jsonl +2 -2
  106. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-parent/subagents/agent-xyz123.meta.json +1 -1
  107. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/subagent-parent.jsonl +4 -4
  108. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/time-spread.jsonl +6 -6
  109. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/timeline-day-test.jsonl +5 -5
  110. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/tool-zoo.jsonl +10 -10
  111. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/truncated.jsonl +2 -2
  112. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/unicode.jsonl +2 -2
  113. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/with-advisor.jsonl +3 -3
  114. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/with-compact.jsonl +5 -5
  115. package/skills/estack-read-claude-session-history/scripts/tests/fixtures/with-thinking.jsonl +2 -2
  116. package/skills/estack-read-claude-session-history/scripts/tests/test_backup_roots.py +56 -56
  117. package/skills/estack-read-claude-session-history/scripts/tests/test_engagement.py +239 -239
  118. package/skills/estack-read-claude-session-history/scripts/tests/test_json_format.py +201 -201
  119. package/skills/estack-read-claude-session-history/scripts/tests/test_modes.py +199 -199
  120. package/skills/estack-read-claude-session-history/scripts/tests/test_parser.py +195 -195
  121. package/skills/estack-read-claude-session-history/scripts/tests/test_paths.py +133 -133
  122. package/skills/estack-read-claude-session-history/scripts/tests/test_search.py +78 -78
  123. package/skills/estack-read-claude-session-history/scripts/tests/test_subagents.py +43 -43
  124. package/skills/estack-read-claude-session-history/scripts/tests/test_timeline.py +179 -179
  125. package/skills/estack-read-claude-session-history/scripts/tests/test_timezone_and_project.py +212 -212
  126. package/skills/estack-read-claude-session-history/scripts/tests/test_tools.py +80 -80
  127. package/skills/estack-repo-search/SKILL.md +65 -65
  128. package/skills/estack-vscode-file-recovery/SKILL.md +188 -0
@@ -1,212 +1,212 @@
1
- """Tests for timezone handling (set_timezone / --tz) and the --project filter."""
2
-
3
- import json
4
- import os
5
- import shutil
6
- import subprocess
7
- import sys
8
- from datetime import datetime
9
- from pathlib import Path
10
-
11
- import pytest
12
-
13
- from lib import parser as PR
14
- from lib import paths as P
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
- @pytest.fixture(autouse=True)
32
- def _reset_tz():
33
- yield
34
- PR.set_timezone(None)
35
-
36
-
37
- # ── set_timezone / _parse_timestamp ─────────────────────────────────────────
38
-
39
- def test_parse_timestamp_default_is_naive():
40
- dt = PR._parse_timestamp("2026-05-01T10:00:00Z")
41
- assert dt is not None
42
- assert dt.tzinfo is None
43
-
44
-
45
- def test_parse_timestamp_utc():
46
- PR.set_timezone("UTC")
47
- assert PR._parse_timestamp("2026-05-01T10:00:00Z") == datetime(2026, 5, 1, 10, 0)
48
-
49
-
50
- def test_parse_timestamp_offset():
51
- PR.set_timezone("+2")
52
- assert PR._parse_timestamp("2026-05-01T10:00:00Z") == datetime(2026, 5, 1, 12, 0)
53
-
54
-
55
- def test_parse_timestamp_utc_minus():
56
- PR.set_timezone("UTC-4")
57
- assert PR._parse_timestamp("2026-05-01T10:00:00Z") == datetime(2026, 5, 1, 6, 0)
58
-
59
-
60
- def test_set_timezone_half_hour_offset():
61
- PR.set_timezone("+05:30")
62
- assert PR._parse_timestamp("2026-05-01T10:00:00Z") == datetime(2026, 5, 1, 15, 30)
63
-
64
-
65
- def test_set_timezone_local_resets():
66
- PR.set_timezone("UTC")
67
- PR.set_timezone("local")
68
- assert PR._TARGET_TZ is None
69
-
70
-
71
- def test_set_timezone_iana():
72
- try:
73
- PR.set_timezone("America/New_York")
74
- except ValueError:
75
- pytest.skip("IANA tz database not available on this machine")
76
- dt = PR._parse_timestamp("2026-01-15T10:00:00Z") # EST = UTC-5
77
- assert dt == datetime(2026, 1, 15, 5, 0)
78
-
79
-
80
- def test_set_timezone_invalid_raises():
81
- with pytest.raises(ValueError):
82
- PR.set_timezone("Mars/Olympus_Mons")
83
-
84
-
85
- def test_epoch_to_display_utc():
86
- PR.set_timezone("UTC")
87
- # 2026-05-01T10:00:00Z as epoch
88
- epoch = datetime(2026, 5, 1, 10, 0).replace(
89
- tzinfo=__import__("datetime").timezone.utc
90
- ).timestamp()
91
- assert PR.epoch_to_display(epoch) == datetime(2026, 5, 1, 10, 0)
92
-
93
-
94
- def test_cli_tz_invalid(cli_path, fixtures_dir):
95
- r = _run_cli(
96
- cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
97
- "--mode", "changelog", "--tz", "Nope/Nowhere",
98
- )
99
- assert r.returncode == 1
100
- assert "timezone" in r.stderr.lower()
101
-
102
-
103
- def test_display_to_epoch_roundtrip_offset_tz():
104
- PR.set_timezone("+2")
105
- epoch = 1772546400.0
106
- assert PR.display_to_epoch(PR.epoch_to_display(epoch)) == epoch
107
-
108
-
109
- def test_display_to_epoch_roundtrip_local():
110
- epoch = 1772546400.0
111
- assert PR.display_to_epoch(PR.epoch_to_display(epoch)) == epoch
112
-
113
-
114
- def test_now_display_matches_utc_clock():
115
- from datetime import timezone as _tzmod
116
- PR.set_timezone("UTC")
117
- delta = abs((PR.now_display() - datetime.now(_tzmod.utc).replace(tzinfo=None)).total_seconds())
118
- assert delta < 5
119
-
120
-
121
- def test_parse_timespec_now_respects_tz():
122
- from datetime import timezone as _tzmod
123
- PR.set_timezone("UTC")
124
- now_spec = P.parse_timespec("now")
125
- delta = abs((now_spec - datetime.now(_tzmod.utc).replace(tzinfo=None)).total_seconds())
126
- assert delta < 5
127
-
128
-
129
- def test_json_timestamps_are_display_tz(cli_path, fixtures_dir):
130
- # basic-session events are 10:00:0xZ — with +2 the JSON timestamps read 12:00
131
- r = _run_cli(
132
- cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
133
- "--mode", "last", "--format", "json", "--tz", "+2",
134
- )
135
- assert r.returncode == 0
136
- data = json.loads(r.stdout)
137
- assert data[-1]["timestamp"].startswith("2026-05-01T12:00:05")
138
-
139
-
140
- def test_cli_changelog_respects_tz(cli_path, fixtures_dir):
141
- # tool-zoo events are 10:00:0xZ — with +3 they display as 13:00
142
- r = _run_cli(
143
- cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
144
- "--mode", "changelog", "--tz", "+3",
145
- )
146
- assert r.returncode == 0
147
- assert "13:00:01" in r.stdout
148
-
149
-
150
- # ── --project filter ─────────────────────────────────────────────────────────
151
-
152
- @pytest.fixture
153
- def multi_root(fixtures_dir, tmp_path):
154
- root = tmp_path / "projects"
155
- keel = root / "C--Users-x-Keel-Project"
156
- other = root / "C--Users-x-Other-Claude-Code"
157
- keel.mkdir(parents=True)
158
- other.mkdir(parents=True)
159
- shutil.copy(fixtures_dir / "basic-session.jsonl", keel / "keelsession.jsonl")
160
- shutil.copy(fixtures_dir / "tool-zoo.jsonl", other / "othersession.jsonl")
161
- return root
162
-
163
-
164
- def test_filter_projects_substring(multi_root):
165
- dirs = P.filter_projects(multi_root, "keel")
166
- assert len(dirs) == 1
167
- assert "Keel" in dirs[0].name
168
-
169
-
170
- def test_filter_projects_spaces_match_hyphens(multi_root):
171
- dirs = P.filter_projects(multi_root, "Keel Project")
172
- assert len(dirs) == 1
173
-
174
-
175
- def test_filter_projects_no_match(multi_root):
176
- assert P.filter_projects(multi_root, "zzz") == []
177
-
178
-
179
- def test_cli_list_project_filter(cli_path, multi_root):
180
- r = _run_cli(
181
- cli_path, "--root", str(multi_root), "--mode", "list", "--project", "keel",
182
- )
183
- assert r.returncode == 0
184
- assert "keelsess" in r.stdout
185
- assert "othersess" not in r.stdout
186
-
187
-
188
- def test_cli_search_project_filter(cli_path, multi_root):
189
- r = _run_cli(
190
- cli_path, "--root", str(multi_root), "--mode", "search",
191
- "--query", "help", "--project", "keel",
192
- )
193
- assert r.returncode == 0
194
- assert "keelsession" in r.stdout
195
-
196
-
197
- def test_cli_journal_project_filter_json(cli_path, multi_root):
198
- r = _run_cli(
199
- cli_path, "--root", str(multi_root), "--mode", "journal",
200
- "--since", "2020-01-01", "--project", "other claude", "--format", "json",
201
- )
202
- assert r.returncode == 0
203
- data = json.loads(r.stdout)
204
- assert len(data) == 1
205
- assert data[0]["uuid"] == "othersession"
206
-
207
-
208
- def test_cli_project_no_match_exits_1(cli_path, multi_root):
209
- r = _run_cli(
210
- cli_path, "--root", str(multi_root), "--mode", "list", "--project", "zzz",
211
- )
212
- assert r.returncode == 1
1
+ """Tests for timezone handling (set_timezone / --tz) and the --project filter."""
2
+
3
+ import json
4
+ import os
5
+ import shutil
6
+ import subprocess
7
+ import sys
8
+ from datetime import datetime
9
+ from pathlib import Path
10
+
11
+ import pytest
12
+
13
+ from lib import parser as PR
14
+ from lib import paths as P
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
+ @pytest.fixture(autouse=True)
32
+ def _reset_tz():
33
+ yield
34
+ PR.set_timezone(None)
35
+
36
+
37
+ # ── set_timezone / _parse_timestamp ─────────────────────────────────────────
38
+
39
+ def test_parse_timestamp_default_is_naive():
40
+ dt = PR._parse_timestamp("2026-05-01T10:00:00Z")
41
+ assert dt is not None
42
+ assert dt.tzinfo is None
43
+
44
+
45
+ def test_parse_timestamp_utc():
46
+ PR.set_timezone("UTC")
47
+ assert PR._parse_timestamp("2026-05-01T10:00:00Z") == datetime(2026, 5, 1, 10, 0)
48
+
49
+
50
+ def test_parse_timestamp_offset():
51
+ PR.set_timezone("+2")
52
+ assert PR._parse_timestamp("2026-05-01T10:00:00Z") == datetime(2026, 5, 1, 12, 0)
53
+
54
+
55
+ def test_parse_timestamp_utc_minus():
56
+ PR.set_timezone("UTC-4")
57
+ assert PR._parse_timestamp("2026-05-01T10:00:00Z") == datetime(2026, 5, 1, 6, 0)
58
+
59
+
60
+ def test_set_timezone_half_hour_offset():
61
+ PR.set_timezone("+05:30")
62
+ assert PR._parse_timestamp("2026-05-01T10:00:00Z") == datetime(2026, 5, 1, 15, 30)
63
+
64
+
65
+ def test_set_timezone_local_resets():
66
+ PR.set_timezone("UTC")
67
+ PR.set_timezone("local")
68
+ assert PR._TARGET_TZ is None
69
+
70
+
71
+ def test_set_timezone_iana():
72
+ try:
73
+ PR.set_timezone("America/New_York")
74
+ except ValueError:
75
+ pytest.skip("IANA tz database not available on this machine")
76
+ dt = PR._parse_timestamp("2026-01-15T10:00:00Z") # EST = UTC-5
77
+ assert dt == datetime(2026, 1, 15, 5, 0)
78
+
79
+
80
+ def test_set_timezone_invalid_raises():
81
+ with pytest.raises(ValueError):
82
+ PR.set_timezone("Mars/Olympus_Mons")
83
+
84
+
85
+ def test_epoch_to_display_utc():
86
+ PR.set_timezone("UTC")
87
+ # 2026-05-01T10:00:00Z as epoch
88
+ epoch = datetime(2026, 5, 1, 10, 0).replace(
89
+ tzinfo=__import__("datetime").timezone.utc
90
+ ).timestamp()
91
+ assert PR.epoch_to_display(epoch) == datetime(2026, 5, 1, 10, 0)
92
+
93
+
94
+ def test_cli_tz_invalid(cli_path, fixtures_dir):
95
+ r = _run_cli(
96
+ cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
97
+ "--mode", "changelog", "--tz", "Nope/Nowhere",
98
+ )
99
+ assert r.returncode == 1
100
+ assert "timezone" in r.stderr.lower()
101
+
102
+
103
+ def test_display_to_epoch_roundtrip_offset_tz():
104
+ PR.set_timezone("+2")
105
+ epoch = 1772546400.0
106
+ assert PR.display_to_epoch(PR.epoch_to_display(epoch)) == epoch
107
+
108
+
109
+ def test_display_to_epoch_roundtrip_local():
110
+ epoch = 1772546400.0
111
+ assert PR.display_to_epoch(PR.epoch_to_display(epoch)) == epoch
112
+
113
+
114
+ def test_now_display_matches_utc_clock():
115
+ from datetime import timezone as _tzmod
116
+ PR.set_timezone("UTC")
117
+ delta = abs((PR.now_display() - datetime.now(_tzmod.utc).replace(tzinfo=None)).total_seconds())
118
+ assert delta < 5
119
+
120
+
121
+ def test_parse_timespec_now_respects_tz():
122
+ from datetime import timezone as _tzmod
123
+ PR.set_timezone("UTC")
124
+ now_spec = P.parse_timespec("now")
125
+ delta = abs((now_spec - datetime.now(_tzmod.utc).replace(tzinfo=None)).total_seconds())
126
+ assert delta < 5
127
+
128
+
129
+ def test_json_timestamps_are_display_tz(cli_path, fixtures_dir):
130
+ # basic-session events are 10:00:0xZ — with +2 the JSON timestamps read 12:00
131
+ r = _run_cli(
132
+ cli_path, "--file", str(fixtures_dir / "basic-session.jsonl"),
133
+ "--mode", "last", "--format", "json", "--tz", "+2",
134
+ )
135
+ assert r.returncode == 0
136
+ data = json.loads(r.stdout)
137
+ assert data[-1]["timestamp"].startswith("2026-05-01T12:00:05")
138
+
139
+
140
+ def test_cli_changelog_respects_tz(cli_path, fixtures_dir):
141
+ # tool-zoo events are 10:00:0xZ — with +3 they display as 13:00
142
+ r = _run_cli(
143
+ cli_path, "--file", str(fixtures_dir / "tool-zoo.jsonl"),
144
+ "--mode", "changelog", "--tz", "+3",
145
+ )
146
+ assert r.returncode == 0
147
+ assert "13:00:01" in r.stdout
148
+
149
+
150
+ # ── --project filter ─────────────────────────────────────────────────────────
151
+
152
+ @pytest.fixture
153
+ def multi_root(fixtures_dir, tmp_path):
154
+ root = tmp_path / "projects"
155
+ keel = root / "C--Users-x-Keel-Project"
156
+ other = root / "C--Users-x-Other-Claude-Code"
157
+ keel.mkdir(parents=True)
158
+ other.mkdir(parents=True)
159
+ shutil.copy(fixtures_dir / "basic-session.jsonl", keel / "keelsession.jsonl")
160
+ shutil.copy(fixtures_dir / "tool-zoo.jsonl", other / "othersession.jsonl")
161
+ return root
162
+
163
+
164
+ def test_filter_projects_substring(multi_root):
165
+ dirs = P.filter_projects(multi_root, "keel")
166
+ assert len(dirs) == 1
167
+ assert "Keel" in dirs[0].name
168
+
169
+
170
+ def test_filter_projects_spaces_match_hyphens(multi_root):
171
+ dirs = P.filter_projects(multi_root, "Keel Project")
172
+ assert len(dirs) == 1
173
+
174
+
175
+ def test_filter_projects_no_match(multi_root):
176
+ assert P.filter_projects(multi_root, "zzz") == []
177
+
178
+
179
+ def test_cli_list_project_filter(cli_path, multi_root):
180
+ r = _run_cli(
181
+ cli_path, "--root", str(multi_root), "--mode", "list", "--project", "keel",
182
+ )
183
+ assert r.returncode == 0
184
+ assert "keelsess" in r.stdout
185
+ assert "othersess" not in r.stdout
186
+
187
+
188
+ def test_cli_search_project_filter(cli_path, multi_root):
189
+ r = _run_cli(
190
+ cli_path, "--root", str(multi_root), "--mode", "search",
191
+ "--query", "help", "--project", "keel",
192
+ )
193
+ assert r.returncode == 0
194
+ assert "keelsession" in r.stdout
195
+
196
+
197
+ def test_cli_journal_project_filter_json(cli_path, multi_root):
198
+ r = _run_cli(
199
+ cli_path, "--root", str(multi_root), "--mode", "journal",
200
+ "--since", "2020-01-01", "--project", "other claude", "--format", "json",
201
+ )
202
+ assert r.returncode == 0
203
+ data = json.loads(r.stdout)
204
+ assert len(data) == 1
205
+ assert data[0]["uuid"] == "othersession"
206
+
207
+
208
+ def test_cli_project_no_match_exits_1(cli_path, multi_root):
209
+ r = _run_cli(
210
+ cli_path, "--root", str(multi_root), "--mode", "list", "--project", "zzz",
211
+ )
212
+ assert r.returncode == 1
@@ -1,80 +1,80 @@
1
- """Tests for lib.tools."""
2
-
3
- from pathlib import Path
4
-
5
- from lib import parser as PR
6
- from lib import tools as T
7
-
8
-
9
- def _load(fixtures_dir, name):
10
- return PR.parse_lines(fixtures_dir / name)
11
-
12
-
13
- def test_extract_tool_calls_count(fixtures_dir):
14
- lines = _load(fixtures_dir, "tool-zoo.jsonl")
15
- calls = T.extract_tool_calls(lines)
16
- assert len(calls) == 9
17
-
18
-
19
- def test_format_bash():
20
- call = {"name": "Bash", "input": {"command": "ls -la /tmp"}}
21
- out = T.format_tool_call(call)
22
- assert out == "Bash: ls -la /tmp"
23
-
24
-
25
- def test_format_powershell():
26
- call = {"name": "PowerShell", "input": {"command": "Get-ChildItem"}}
27
- assert "PowerShell" in T.format_tool_call(call)
28
-
29
-
30
- def test_format_read_with_lines():
31
- call = {"name": "Read", "input": {"file_path": "C:\\foo.py", "offset": 1, "limit": 50}}
32
- out = T.format_tool_call(call)
33
- assert "C:\\foo.py" in out
34
- assert "lines 1" in out
35
-
36
-
37
- def test_format_edit_with_edits():
38
- call = {"name": "Edit", "input": {"file_path": "C:\\foo.py", "edits": [{}, {}, {}]}}
39
- out = T.format_tool_call(call)
40
- assert "3 edits" in out
41
-
42
-
43
- def test_format_write():
44
- call = {"name": "Write", "input": {"file_path": "C:\\bar.py", "content": "print('hi')"}}
45
- out = T.format_tool_call(call)
46
- assert "chars" in out
47
-
48
-
49
- def test_format_agent():
50
- call = {"name": "Agent", "input": {"subagent_type": "Explore", "description": "Find X"}}
51
- out = T.format_tool_call(call)
52
- assert "Agent[Explore]" in out
53
- assert "Find X" in out
54
-
55
-
56
- def test_format_skill():
57
- call = {"name": "Skill", "input": {"skill": "using-superpowers"}}
58
- out = T.format_tool_call(call)
59
- assert "using-superpowers" in out
60
-
61
-
62
- def test_tool_filter(fixtures_dir):
63
- lines = _load(fixtures_dir, "tool-zoo.jsonl")
64
- calls = T.extract_tool_calls(lines, tool_filter={"Bash"})
65
- assert len(calls) == 1
66
- assert calls[0]["name"] == "Bash"
67
-
68
-
69
- def test_files_touched(fixtures_dir):
70
- lines = _load(fixtures_dir, "tool-zoo.jsonl")
71
- files = T.files_touched(lines)
72
- assert any("foo.py" in str(p) for p in files)
73
- assert any("bar.py" in str(p) for p in files)
74
-
75
-
76
- def test_extract_tool_results(fixtures_dir):
77
- lines = _load(fixtures_dir, "subagent-parent.jsonl")
78
- result = T.extract_tool_results(lines, "toolu_01abc")
79
- assert result is not None
80
- assert "Found it" in result
1
+ """Tests for lib.tools."""
2
+
3
+ from pathlib import Path
4
+
5
+ from lib import parser as PR
6
+ from lib import tools as T
7
+
8
+
9
+ def _load(fixtures_dir, name):
10
+ return PR.parse_lines(fixtures_dir / name)
11
+
12
+
13
+ def test_extract_tool_calls_count(fixtures_dir):
14
+ lines = _load(fixtures_dir, "tool-zoo.jsonl")
15
+ calls = T.extract_tool_calls(lines)
16
+ assert len(calls) == 9
17
+
18
+
19
+ def test_format_bash():
20
+ call = {"name": "Bash", "input": {"command": "ls -la /tmp"}}
21
+ out = T.format_tool_call(call)
22
+ assert out == "Bash: ls -la /tmp"
23
+
24
+
25
+ def test_format_powershell():
26
+ call = {"name": "PowerShell", "input": {"command": "Get-ChildItem"}}
27
+ assert "PowerShell" in T.format_tool_call(call)
28
+
29
+
30
+ def test_format_read_with_lines():
31
+ call = {"name": "Read", "input": {"file_path": "C:\\foo.py", "offset": 1, "limit": 50}}
32
+ out = T.format_tool_call(call)
33
+ assert "C:\\foo.py" in out
34
+ assert "lines 1" in out
35
+
36
+
37
+ def test_format_edit_with_edits():
38
+ call = {"name": "Edit", "input": {"file_path": "C:\\foo.py", "edits": [{}, {}, {}]}}
39
+ out = T.format_tool_call(call)
40
+ assert "3 edits" in out
41
+
42
+
43
+ def test_format_write():
44
+ call = {"name": "Write", "input": {"file_path": "C:\\bar.py", "content": "print('hi')"}}
45
+ out = T.format_tool_call(call)
46
+ assert "chars" in out
47
+
48
+
49
+ def test_format_agent():
50
+ call = {"name": "Agent", "input": {"subagent_type": "Explore", "description": "Find X"}}
51
+ out = T.format_tool_call(call)
52
+ assert "Agent[Explore]" in out
53
+ assert "Find X" in out
54
+
55
+
56
+ def test_format_skill():
57
+ call = {"name": "Skill", "input": {"skill": "using-superpowers"}}
58
+ out = T.format_tool_call(call)
59
+ assert "using-superpowers" in out
60
+
61
+
62
+ def test_tool_filter(fixtures_dir):
63
+ lines = _load(fixtures_dir, "tool-zoo.jsonl")
64
+ calls = T.extract_tool_calls(lines, tool_filter={"Bash"})
65
+ assert len(calls) == 1
66
+ assert calls[0]["name"] == "Bash"
67
+
68
+
69
+ def test_files_touched(fixtures_dir):
70
+ lines = _load(fixtures_dir, "tool-zoo.jsonl")
71
+ files = T.files_touched(lines)
72
+ assert any("foo.py" in str(p) for p in files)
73
+ assert any("bar.py" in str(p) for p in files)
74
+
75
+
76
+ def test_extract_tool_results(fixtures_dir):
77
+ lines = _load(fixtures_dir, "subagent-parent.jsonl")
78
+ result = T.extract_tool_results(lines, "toolu_01abc")
79
+ assert result is not None
80
+ assert "Found it" in result