cc-continuity 0.3.41__tar.gz → 0.3.43__tar.gz
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.
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/PKG-INFO +1 -1
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/README.md +2 -2
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/__init__.py +1 -1
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/cli.py +85 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity.egg-info/PKG-INFO +1 -1
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity.egg-info/SOURCES.txt +2 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/pyproject.toml +1 -1
- cc_continuity-0.3.43/tests/test_changelog_notes.py +90 -0
- cc_continuity-0.3.43/tests/test_cli_log.py +92 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/LICENSE +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/__main__.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/atomic.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/blink.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/blink_watch.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/bootstrap.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/checkpoint.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/config.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/daemon_supervisor.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/doctor.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/gitsnap.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/__init__.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/common.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/pre_compact.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/pre_tool_use.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/session_end.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/session_start.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/stop.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/task.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/tool_use.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hooks/user_prompt.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/hosting.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/install.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/launch.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/ledger.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/lock.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/managed.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/naming.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/notify.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/paths.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/power_plug.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/progress_pane.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/project.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/redact.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/rotator.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/settings_merge.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/skills.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/state.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/statusline.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/thresholds.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/transcript.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/validate.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/watchdog.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/watchdog_digest.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity/watchdogd.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity.egg-info/dependency_links.txt +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity.egg-info/entry_points.txt +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/cc_continuity.egg-info/top_level.txt +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/setup.cfg +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_atomic.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_blink.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_blink_watch.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_bootstrap.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_checkpoint.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_cli.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_cli_ledger.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_config.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_daemon_supervisor.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_doctor.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_gitsnap.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hooks_common.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hooks_pre_compact.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hooks_pre_tool_use.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hooks_session_end.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hooks_session_start.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hooks_stop.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hooks_task.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hooks_tool_use.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hooks_user_prompt.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hosting.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_hygiene.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_install.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_integration_phase5.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_integration_phase6.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_integration_phase7.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_launch.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_ledger.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_lock.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_managed.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_naming.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_notify.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_notify_integration.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_paths.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_power_plug.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_progress_pane.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_project.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_redact.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_rotator.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_settings_merge.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_skills.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_state.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_status.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_statusline.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_thresholds.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_tmux_host.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_transcript.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_transcript_finalize.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_uninstall.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_validate.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_watchdog.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_watchdog_digest.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_watchdog_integration.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_watchdogd.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_wsl_doctor.py +0 -0
- {cc_continuity-0.3.41 → cc_continuity-0.3.43}/tests/test_wsl_install.py +0 -0
|
@@ -26,11 +26,11 @@ The five most recent updates, newest first. Each line links to its
|
|
|
26
26
|
commit, so you can see what changed lately without digging through the
|
|
27
27
|
log:
|
|
28
28
|
|
|
29
|
+
- **2026-11-17**: Debugging the logs got a front door: `cc-continuity log blink` and `cc-continuity log errors` tail the root log files read-only (newest last, default 20 lines, `--lines N`, `--follow` keeps streaming), with UTC stamps rendered in your local time; blink's already-local stamps and traceback continuation lines stay byte-identical so nothing shifts twice ([commit](https://github.com/pqant/claude-continuity/commit/1ce3269)).
|
|
30
|
+
- **2026-11-15**: Tags now open their own release. A tag push used to publish to PyPI but the GitHub Release was still opened by hand; the release workflow now extracts the matching section from the changelog with a stdlib-only `tools/changelog_notes.py` helper (a missing or empty section stops the run before any upload, so notes can never ship blank) and creates the release itself, refreshing the notes on re-runs. A public release is now one push ([commit](https://github.com/pqant/claude-continuity/commit/0e31994)).
|
|
29
31
|
- **2026-11-17**: Zombie panes are measured now too. After the 0.3.40 revival, Claude Code still rendered the status line with the abandoned startup session id, so the ratio metric kept landing on the dead id: the pane showed a ratio while the tracked session never moved (measurement without reaction). The hook entry now stamps a pane-scoped binding with the session id it actually runs as, and the status line writes its metric under it whenever that binding is fresh and names a different live session. Non-tmux runs and normal panes behave byte-for-byte exactly as before ([commit](https://github.com/pqant/claude-continuity/commit/361b7b1)).
|
|
30
32
|
- **2026-11-16**: Zombie sessions are gone. Claude Code remembers the last conversation it opened per project (lastSessionId); a plain `claude` could reopen a conversation that died in a rotation and then run forever unmonitored (no ratio movement, no rotation, and the handoff chain silently broken). Now a resumed conversation whose session id is no longer alive is anchored onto the open chain tip under the same index, handed the bootstrap protocol, and taken over by the normal monitoring; live resumes behave exactly as before ([commit](https://github.com/pqant/claude-continuity/commit/dbaea33)).
|
|
31
33
|
- **2026-11-16**: The transcript fold arrows are anchored: both triangles now share one slot at the true screen center of the header (the previous version centered against the controls row, which spans only the left half of the header grid, so the arrow sat off-center over the theme button), they carry a red tint (a deeper red in light theme, a lighter red in dark theme), and folding keeps the reopen arrow in the very same spot so the button never jumps ([commit](https://github.com/pqant/claude-continuity/commit/1ca6ad5), [commit](https://github.com/pqant/claude-continuity/commit/e33874d)).
|
|
32
|
-
- **2026-11-16**: The transcript density view got its polish pass: the two panel toggles are plain filled triangles now (the up-triangle folds the header panel into the slim bar, the down-triangle brings it back, and the words live in the tooltips), the fold eases closed over 180 ms instead of snapping, and the folded bar only spans the left column when the 2-column mode is on, with the fold arrow sitting centered in the controls row in the theme's accent color. The "2-column · 75%" mode opens enabled by default now; unchecking it is still remembered in your browser ([commit](https://github.com/pqant/claude-continuity/commit/3959db9), [commit](https://github.com/pqant/claude-continuity/commit/7feba54)).
|
|
33
|
-
- **2026-11-15**: The transcript header panel gets out of the way: "panel up" folds it into a slim one-line bar carrying the session name, "panel down" brings the full panel back, and a new "2-column · 75%" checkbox in the controls row re-flows the whole conversation into two balanced columns at reduced zoom, so a screen holds roughly twice the conversation. Both choices persist in your browser; search, theme, sessions switcher and the image lightbox behave exactly the same in every state ([commit](https://github.com/pqant/claude-continuity/commit/594820d), [commit](https://github.com/pqant/claude-continuity/commit/2450369)).
|
|
34
34
|
|
|
35
35
|
## How it works
|
|
36
36
|
|
|
@@ -14,9 +14,11 @@ import argparse
|
|
|
14
14
|
import hashlib
|
|
15
15
|
import json
|
|
16
16
|
import os
|
|
17
|
+
import re
|
|
17
18
|
import subprocess
|
|
18
19
|
import sys
|
|
19
20
|
import time
|
|
21
|
+
from datetime import datetime
|
|
20
22
|
from pathlib import Path
|
|
21
23
|
from typing import Callable
|
|
22
24
|
|
|
@@ -79,6 +81,15 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
79
81
|
p_ledger.add_argument("n", nargs="?", type=int, default=20,
|
|
80
82
|
help="how many newest entries (default 20)")
|
|
81
83
|
|
|
84
|
+
p_log = sub.add_parser("log",
|
|
85
|
+
help="tail a root log file with local-time "
|
|
86
|
+
"stamps (issue #35)")
|
|
87
|
+
p_log.add_argument("kind", choices=["blink", "errors"])
|
|
88
|
+
p_log.add_argument("--lines", type=int, default=20,
|
|
89
|
+
help="how many newest lines (default 20)")
|
|
90
|
+
p_log.add_argument("--follow", action="store_true",
|
|
91
|
+
help="keep streaming appended lines")
|
|
92
|
+
|
|
82
93
|
p_vd = sub.add_parser("validate-draft",
|
|
83
94
|
help="validate a handoff draft (PRD §10.1)")
|
|
84
95
|
p_vd.add_argument("file", help="path to handoff.draft.md")
|
|
@@ -750,6 +761,78 @@ def cmd_ledger(args: argparse.Namespace) -> int:
|
|
|
750
761
|
return 0
|
|
751
762
|
|
|
752
763
|
|
|
764
|
+
_LOG_STAMP = re.compile(
|
|
765
|
+
r"^(?P<open>\[?)(?P<iso>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?)"
|
|
766
|
+
r"(?P<offset>Z|[+-]\d{2}:\d{2})(?P<close>\]?)")
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
def render_log_line(line, tz=None):
|
|
770
|
+
"""Rewrite an offset-bearing leading stamp into local time (issue #35).
|
|
771
|
+
|
|
772
|
+
errors.log stamps carry ``+00:00`` (UTC) and get converted; blink.log
|
|
773
|
+
stamps are naive local ``time.strftime`` output and MUST pass through
|
|
774
|
+
byte-identical (converting a naive stamp would double-shift it), and
|
|
775
|
+
so do untimestamped traceback continuation lines.
|
|
776
|
+
"""
|
|
777
|
+
match = _LOG_STAMP.match(line)
|
|
778
|
+
if not match:
|
|
779
|
+
return line
|
|
780
|
+
offset = "+00:00" if match.group("offset") == "Z" else match.group("offset")
|
|
781
|
+
try:
|
|
782
|
+
stamp = datetime.fromisoformat(match.group("iso") + offset)
|
|
783
|
+
except ValueError:
|
|
784
|
+
return line
|
|
785
|
+
local = stamp.astimezone(tz)
|
|
786
|
+
return (f"{match.group('open')}{local.isoformat()}{match.group('close')}"
|
|
787
|
+
+ line[match.end():])
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
def follow_lines(path, offset, poll=0.5, max_lines=None):
|
|
791
|
+
"""Yield whole lines appended to ``path`` after ``offset`` (issue #35).
|
|
792
|
+
|
|
793
|
+
``tail -f`` semantics for ``log --follow``: polls for growth, yields
|
|
794
|
+
only newline-terminated lines (a torn partial write is kept in the
|
|
795
|
+
buffer until complete), and tolerates a missing file by waiting for
|
|
796
|
+
it to appear. ``max_lines`` bounds the stream (tests).
|
|
797
|
+
"""
|
|
798
|
+
emitted = 0
|
|
799
|
+
buf = b""
|
|
800
|
+
while max_lines is None or emitted < max_lines:
|
|
801
|
+
chunk = b""
|
|
802
|
+
try:
|
|
803
|
+
with open(path, "rb") as fh:
|
|
804
|
+
fh.seek(offset)
|
|
805
|
+
chunk = fh.read()
|
|
806
|
+
except OSError:
|
|
807
|
+
pass
|
|
808
|
+
if chunk:
|
|
809
|
+
offset += len(chunk)
|
|
810
|
+
*complete, buf = (buf + chunk).split(b"\n")
|
|
811
|
+
for raw in complete:
|
|
812
|
+
yield raw.decode("utf-8", "replace")
|
|
813
|
+
emitted += 1
|
|
814
|
+
if max_lines is not None and emitted >= max_lines:
|
|
815
|
+
return
|
|
816
|
+
time.sleep(poll)
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
def cmd_log(args: argparse.Namespace) -> int:
|
|
820
|
+
"""Read-only tail of the root ``logs/`` files (issue #35).
|
|
821
|
+
|
|
822
|
+
``blink``/``errors`` are global (not per-session); stamps render in
|
|
823
|
+
local time, newest last. A missing file is an empty success.
|
|
824
|
+
"""
|
|
825
|
+
path = paths.logs_dir() / f"{args.kind}.log"
|
|
826
|
+
n = args.lines if isinstance(args.lines, int) and args.lines > 0 else 20
|
|
827
|
+
data = path.read_bytes() if path.is_file() else b""
|
|
828
|
+
for line in data.decode("utf-8", "replace").splitlines()[-n:]:
|
|
829
|
+
print(render_log_line(line))
|
|
830
|
+
if args.follow:
|
|
831
|
+
for line in follow_lines(path, len(data)):
|
|
832
|
+
print(render_log_line(line), flush=True)
|
|
833
|
+
return 0
|
|
834
|
+
|
|
835
|
+
|
|
753
836
|
# ----------------------------------------------------------- Phase 4 cmds
|
|
754
837
|
|
|
755
838
|
|
|
@@ -1678,6 +1761,8 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
1678
1761
|
return cmd_ratio(args)
|
|
1679
1762
|
if args.command == "ledger":
|
|
1680
1763
|
return cmd_ledger(args)
|
|
1764
|
+
if args.command == "log":
|
|
1765
|
+
return cmd_log(args)
|
|
1681
1766
|
if args.command == "validate-draft":
|
|
1682
1767
|
return cmd_validate_draft(args)
|
|
1683
1768
|
if args.command == "validate":
|
|
@@ -56,9 +56,11 @@ tests/test_atomic.py
|
|
|
56
56
|
tests/test_blink.py
|
|
57
57
|
tests/test_blink_watch.py
|
|
58
58
|
tests/test_bootstrap.py
|
|
59
|
+
tests/test_changelog_notes.py
|
|
59
60
|
tests/test_checkpoint.py
|
|
60
61
|
tests/test_cli.py
|
|
61
62
|
tests/test_cli_ledger.py
|
|
63
|
+
tests/test_cli_log.py
|
|
62
64
|
tests/test_config.py
|
|
63
65
|
tests/test_daemon_supervisor.py
|
|
64
66
|
tests/test_doctor.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cc-continuity"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.43"
|
|
8
8
|
description = "Zero-touch session rotation for Claude Code (local large-context model)"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = [] # stdlib only at runtime (PRD §0.5)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Unit tests for tools/changelog_notes.py (issue #33 release-notes extractor)."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
8
|
+
sys.path.insert(0, str(ROOT / "tools"))
|
|
9
|
+
import changelog_notes as cn # noqa: E402
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
SAMPLE = """\
|
|
13
|
+
# Changelog
|
|
14
|
+
|
|
15
|
+
All notable changes to cc-continuity are documented here.
|
|
16
|
+
|
|
17
|
+
## [Unreleased]
|
|
18
|
+
|
|
19
|
+
## [0.3.42] - 2026-11-15
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- The GitHub Release is created automatically from this section (issue #33).
|
|
24
|
+
|
|
25
|
+
## [0.3.41] - 2026-11-17
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Zombie pane metric lands on the pane-bound session id.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
NOTES_42 = (
|
|
33
|
+
"### Added\n\n"
|
|
34
|
+
"- The GitHub Release is created automatically from this section "
|
|
35
|
+
"(issue #33)."
|
|
36
|
+
)
|
|
37
|
+
NOTES_41 = (
|
|
38
|
+
"### Fixed\n\n"
|
|
39
|
+
"- Zombie pane metric lands on the pane-bound session id."
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_extract_returns_only_the_version_section():
|
|
44
|
+
assert cn.extract_notes(SAMPLE, "0.3.42") == NOTES_42
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_extract_stops_at_the_next_section_heading():
|
|
48
|
+
assert "Zombie pane metric" not in cn.extract_notes(SAMPLE, "0.3.42")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_extract_requires_the_exact_version_not_a_prefix():
|
|
52
|
+
assert cn.extract_notes(SAMPLE, "0.3.4") is None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_extract_accepts_a_leading_v():
|
|
56
|
+
assert cn.extract_notes(SAMPLE, "v0.3.41") == NOTES_41
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_extract_trims_blank_edges():
|
|
60
|
+
notes = cn.extract_notes(SAMPLE, "0.3.42")
|
|
61
|
+
assert notes == notes.strip()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_extract_treats_an_empty_section_as_missing():
|
|
65
|
+
# An [Unreleased] placeholder (or a section whose body was never
|
|
66
|
+
# filled in) must not produce a blank release: None, so the CLI
|
|
67
|
+
# fails and the workflow stops instead of publishing empty notes.
|
|
68
|
+
assert cn.extract_notes(SAMPLE, "Unreleased") is None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def test_cli_writes_the_notes_to_stdout(tmp_path):
|
|
72
|
+
changelog = tmp_path / "CHANGELOG.md"
|
|
73
|
+
changelog.write_text(SAMPLE, encoding="utf-8")
|
|
74
|
+
proc = subprocess.run(
|
|
75
|
+
[sys.executable, str(ROOT / "tools" / "changelog_notes.py"),
|
|
76
|
+
"0.3.42", str(changelog)],
|
|
77
|
+
capture_output=True, text=True)
|
|
78
|
+
assert proc.returncode == 0
|
|
79
|
+
assert proc.stdout == NOTES_42 + "\n"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_cli_missing_version_exits_1(tmp_path):
|
|
83
|
+
changelog = tmp_path / "CHANGELOG.md"
|
|
84
|
+
changelog.write_text(SAMPLE, encoding="utf-8")
|
|
85
|
+
proc = subprocess.run(
|
|
86
|
+
[sys.executable, str(ROOT / "tools" / "changelog_notes.py"),
|
|
87
|
+
"9.9.9", str(changelog)],
|
|
88
|
+
capture_output=True, text=True)
|
|
89
|
+
assert proc.returncode == 1
|
|
90
|
+
assert proc.stdout == ""
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""cli `log [blink|errors]` (issue #35): read-only tail, UTC stamps in local time.
|
|
2
|
+
|
|
3
|
+
errors.log carries explicit-offset UTC stamps (``[ISO+00:00]``); blink.log
|
|
4
|
+
stamps are naive LOCAL (``time.strftime``). Only offset-bearing stamps get
|
|
5
|
+
converted - converting naive ones would double-shift; untimestamped lines
|
|
6
|
+
(tracebacks) pass through untouched. Newest last, default tail 20,
|
|
7
|
+
``--follow`` streams appended lines. No session or rotation-state
|
|
8
|
+
dependency: the logs live at the root ``logs/`` dir.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from datetime import timedelta, timezone
|
|
12
|
+
|
|
13
|
+
import pytest
|
|
14
|
+
|
|
15
|
+
from cc_continuity import cli, paths
|
|
16
|
+
|
|
17
|
+
TZ = timezone(timedelta(hours=1))
|
|
18
|
+
|
|
19
|
+
UTC_STAMPED = "[2026-11-17T07:28:07.123456+00:00] notify: push failed: 403"
|
|
20
|
+
NAIVE = "2026-11-17T11:51:06 focus suppress-stored @0 key='(False, False)'"
|
|
21
|
+
TRACEBACK = ' File "cc_continuity/hooks/common.py", line 58, in log_error'
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _write_log(name, lines):
|
|
25
|
+
d = paths.logs_dir()
|
|
26
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
27
|
+
(d / name).write_text("".join(line + "\n" for line in lines),
|
|
28
|
+
encoding="utf-8")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _plain(count):
|
|
32
|
+
return [f"evt {i}" for i in range(1, count + 1)]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# ------------------------------------------------------------- renderer
|
|
36
|
+
|
|
37
|
+
def test_render_converts_offset_stamps_only():
|
|
38
|
+
out = cli.render_log_line(UTC_STAMPED, tz=TZ)
|
|
39
|
+
assert out == "[2026-11-17T08:28:07.123456+01:00] notify: push failed: 403"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_render_keeps_naive_local_stamps_untouched():
|
|
43
|
+
assert cli.render_log_line(NAIVE, tz=TZ) == NAIVE
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_render_passes_untimestamped_lines():
|
|
47
|
+
assert cli.render_log_line(TRACEBACK, tz=TZ) == TRACEBACK
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_render_accepts_zulu_without_brackets():
|
|
51
|
+
out = cli.render_log_line("2026-11-17T07:28:07Z heartbeat ok", tz=TZ)
|
|
52
|
+
assert out.startswith("2026-11-17T08:28:07+01:00")
|
|
53
|
+
assert out.endswith("heartbeat ok")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# ------------------------------------------------------------------ tail
|
|
57
|
+
|
|
58
|
+
def test_log_errors_tails_newest_last(cc_home, capsys):
|
|
59
|
+
_write_log("errors.log", _plain(25))
|
|
60
|
+
assert cli.main(["log", "errors", "--lines", "5"]) == 0
|
|
61
|
+
assert capsys.readouterr().out.splitlines() == _plain(25)[-5:]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_log_defaults_to_twenty_and_nonpositive_falls_back(cc_home, capsys):
|
|
65
|
+
_write_log("blink.log", _plain(25))
|
|
66
|
+
assert cli.main(["log", "blink"]) == 0
|
|
67
|
+
assert capsys.readouterr().out.splitlines() == _plain(25)[-20:]
|
|
68
|
+
assert cli.main(["log", "blink", "--lines", "0"]) == 0
|
|
69
|
+
assert capsys.readouterr().out.splitlines() == _plain(25)[-20:]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_log_missing_file_is_empty_success(cc_home, capsys):
|
|
73
|
+
assert cli.main(["log", "errors"]) == 0
|
|
74
|
+
assert capsys.readouterr().out == ""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_log_unknown_kind_is_rejected(cc_home):
|
|
78
|
+
with pytest.raises(SystemExit) as exc:
|
|
79
|
+
cli.main(["log", "rotator"])
|
|
80
|
+
assert exc.value.code == 2
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# ---------------------------------------------------------------- follow
|
|
84
|
+
|
|
85
|
+
def test_follow_emits_appended_lines(cc_home):
|
|
86
|
+
_write_log("blink.log", _plain(3))
|
|
87
|
+
path = paths.logs_dir() / "blink.log"
|
|
88
|
+
offset = len(path.read_bytes())
|
|
89
|
+
with open(path, "a", encoding="utf-8") as fh:
|
|
90
|
+
fh.write("evt 4\nevt 5\n")
|
|
91
|
+
emitted = list(cli.follow_lines(path, offset, poll=0.01, max_lines=2))
|
|
92
|
+
assert emitted == ["evt 4", "evt 5"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|