cc-continuity 0.3.45__tar.gz → 0.3.47__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.
Files changed (118) hide show
  1. cc_continuity-0.3.47/PKG-INFO +12 -0
  2. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/README.md +9 -2
  3. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/__init__.py +1 -1
  4. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/cli.py +24 -0
  5. cc_continuity-0.3.47/cc_continuity.egg-info/PKG-INFO +12 -0
  6. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/pyproject.toml +8 -1
  7. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_cli.py +63 -0
  8. cc_continuity-0.3.47/tests/test_readme_badges.py +108 -0
  9. cc_continuity-0.3.45/PKG-INFO +0 -7
  10. cc_continuity-0.3.45/cc_continuity.egg-info/PKG-INFO +0 -7
  11. cc_continuity-0.3.45/tests/test_readme_badges.py +0 -62
  12. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/LICENSE +0 -0
  13. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/__main__.py +0 -0
  14. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/atomic.py +0 -0
  15. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/blink.py +0 -0
  16. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/blink_watch.py +0 -0
  17. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/bootstrap.py +0 -0
  18. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/checkpoint.py +0 -0
  19. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/config.py +0 -0
  20. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/daemon_supervisor.py +0 -0
  21. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/doctor.py +0 -0
  22. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/gitsnap.py +0 -0
  23. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/__init__.py +0 -0
  24. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/common.py +0 -0
  25. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/pre_compact.py +0 -0
  26. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/pre_tool_use.py +0 -0
  27. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/session_end.py +0 -0
  28. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/session_start.py +0 -0
  29. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/stop.py +0 -0
  30. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/task.py +0 -0
  31. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/tool_use.py +0 -0
  32. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hooks/user_prompt.py +0 -0
  33. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/hosting.py +0 -0
  34. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/install.py +0 -0
  35. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/launch.py +0 -0
  36. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/ledger.py +0 -0
  37. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/lock.py +0 -0
  38. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/managed.py +0 -0
  39. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/naming.py +0 -0
  40. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/notify.py +0 -0
  41. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/paths.py +0 -0
  42. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/power_plug.py +0 -0
  43. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/progress_pane.py +0 -0
  44. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/project.py +0 -0
  45. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/redact.py +0 -0
  46. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/rotator.py +0 -0
  47. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/settings_merge.py +0 -0
  48. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/skills.py +0 -0
  49. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/state.py +0 -0
  50. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/statusline.py +0 -0
  51. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/thresholds.py +0 -0
  52. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/transcript.py +0 -0
  53. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/validate.py +0 -0
  54. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/watchdog.py +0 -0
  55. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/watchdog_digest.py +0 -0
  56. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity/watchdogd.py +0 -0
  57. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity.egg-info/SOURCES.txt +0 -0
  58. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity.egg-info/dependency_links.txt +0 -0
  59. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity.egg-info/entry_points.txt +0 -0
  60. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/cc_continuity.egg-info/top_level.txt +0 -0
  61. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/setup.cfg +0 -0
  62. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_atomic.py +0 -0
  63. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_blink.py +0 -0
  64. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_blink_watch.py +0 -0
  65. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_bootstrap.py +0 -0
  66. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_changelog_notes.py +0 -0
  67. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_checkpoint.py +0 -0
  68. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_cli_ledger.py +0 -0
  69. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_cli_log.py +0 -0
  70. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_config.py +0 -0
  71. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_daemon_supervisor.py +0 -0
  72. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_doctor.py +0 -0
  73. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_gitsnap.py +0 -0
  74. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hooks_common.py +0 -0
  75. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hooks_pre_compact.py +0 -0
  76. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hooks_pre_tool_use.py +0 -0
  77. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hooks_session_end.py +0 -0
  78. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hooks_session_start.py +0 -0
  79. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hooks_stop.py +0 -0
  80. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hooks_task.py +0 -0
  81. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hooks_tool_use.py +0 -0
  82. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hooks_user_prompt.py +0 -0
  83. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hosting.py +0 -0
  84. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_hygiene.py +0 -0
  85. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_install.py +0 -0
  86. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_integration_phase5.py +0 -0
  87. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_integration_phase6.py +0 -0
  88. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_integration_phase7.py +0 -0
  89. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_launch.py +0 -0
  90. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_ledger.py +0 -0
  91. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_lock.py +0 -0
  92. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_managed.py +0 -0
  93. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_naming.py +0 -0
  94. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_notify.py +0 -0
  95. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_notify_integration.py +0 -0
  96. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_paths.py +0 -0
  97. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_power_plug.py +0 -0
  98. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_progress_pane.py +0 -0
  99. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_project.py +0 -0
  100. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_redact.py +0 -0
  101. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_rotator.py +0 -0
  102. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_settings_merge.py +0 -0
  103. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_skills.py +0 -0
  104. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_state.py +0 -0
  105. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_status.py +0 -0
  106. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_statusline.py +0 -0
  107. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_thresholds.py +0 -0
  108. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_tmux_host.py +0 -0
  109. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_transcript.py +0 -0
  110. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_transcript_finalize.py +0 -0
  111. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_uninstall.py +0 -0
  112. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_validate.py +0 -0
  113. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_watchdog.py +0 -0
  114. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_watchdog_digest.py +0 -0
  115. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_watchdog_integration.py +0 -0
  116. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_watchdogd.py +0 -0
  117. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_wsl_doctor.py +0 -0
  118. {cc_continuity-0.3.45 → cc_continuity-0.3.47}/tests/test_wsl_install.py +0 -0
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: cc-continuity
3
+ Version: 0.3.47
4
+ Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
+ Classifier: Development Status :: 5 - Production/Stable
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Programming Language :: Python :: 3.11
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Requires-Python: >=3.11
11
+ License-File: LICENSE
12
+ Dynamic: license-file
@@ -8,6 +8,13 @@
8
8
  [![Contributions](https://img.shields.io/badge/CONTRIBUTIONS-WELCOME-%23e0559a?logo=git&labelColor=%23333333)](CONTRIBUTING.md)
9
9
  [![Security](https://img.shields.io/badge/SECURITY-POLICY-%234c1?logo=github&labelColor=%23333333)](SECURITY.md)
10
10
 
11
+ [![PyPI](https://img.shields.io/pypi/v/cc-continuity?label=PYPI&logo=pypi&logoColor=white&labelColor=%23333333&color=%23007ec6)](https://pypi.org/project/cc-continuity/)
12
+ [![Downloads](https://img.shields.io/pypi/dm/cc-continuity?label=DOWNLOADS&logo=pypi&logoColor=white&labelColor=%23333333&color=%23007ec6)](https://pypi.org/project/cc-continuity/)
13
+ [![License](https://img.shields.io/github/license/pqant/claude-continuity?label=LICENSE&logo=github&labelColor=%23333333&color=%234c1)](LICENSE)
14
+ [![CI](https://github.com/pqant/claude-continuity/actions/workflows/ci.yml/badge.svg)](https://github.com/pqant/claude-continuity/actions/workflows/ci.yml)
15
+ [![Python versions](https://img.shields.io/pypi/pyversions/cc-continuity?label=PYTHON&logo=python&logoColor=white&labelColor=%23333333&color=%233776ab)](https://pypi.org/project/cc-continuity/)
16
+ [![Good first issues](https://img.shields.io/github/issues/pqant/claude-continuity/good%20first%20issue?label=GOOD%20FIRST%20ISSUES&logo=github&labelColor=%23333333&color=%237057ff)](https://github.com/pqant/claude-continuity/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
17
+
11
18
  Zero-touch session rotation and supervision for Claude Code.
12
19
 
13
20
  **Why it exists.** Long sessions die when the context window fills up, and local LLMs make it worse: their window is fixed and small, and the built-in compaction (`/compact`, auto-compact) is a lossy one-shot summary. With a small model it silently drops decisions, rejected approaches and the exact stopping point, and every compaction then summarizes a summary, so the drift compounds. cc-continuity exists to give long work room to breathe inside the window: at a safe threshold it rotates the session with a structured, validated handoff instead of a lossy summary.
@@ -34,11 +41,11 @@ The five most recent updates, newest first. Each line links to its
34
41
  commit, so you can see what changed lately without digging through the
35
42
  log:
36
43
 
44
+ - **2026-11-18**: The session chain went machine-readable: `cc-continuity history --json` prints it as one JSON array with stable keys (`nnn`, `name`, `session_id`, `created`, `state`). The state comes from each session's `state.json` with the same fallback the status rotation line uses, a project without a record prints `[]`, and the default human output is unchanged ([commit](https://github.com/pqant/claude-continuity/commit/180b761)).
45
+ - **2026-11-17**: A second badges row landed under the title, this one for the package side: PyPI version and monthly-download counters, MIT license, live CI status, supported Python versions (backed by new PyPI classifiers in pyproject.toml) and a good-first-issues counter that opens the labeled contributor on-ramp ([commit](https://github.com/pqant/claude-continuity/commit/fb0ad8a)).
37
46
  - **2026-11-17**: The README now opens at a glance. A badges row sits under the title: live shields.io counters for forks, stars, open issues and the last commit (each links to the matching GitHub page), plus Code of conduct, Contributions and Security badges that lead straight into the community files ([commit](https://github.com/pqant/claude-continuity/commit/f642a4b)).
38
47
  - **2026-11-17**: Pasted images stopped cloning themselves in transcript exports. Claude Code writes one paste as two records: the base64 record plus an isMeta sibling carrying the same `[Image: source: ...]` lines. While the image cache was still on disk the sibling embedded the very same images, so the export opened a second User block repeating the whole gallery right next to the first. A sibling whose timestamp and image count both match the block before it is the same paste and is now folded away; a genuine second paste carries its own timestamp and still gets its own gallery ([commit](https://github.com/pqant/claude-continuity/commit/55b1c1c)).
39
48
  - **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)).
40
- - **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)).
41
- - **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)).
42
49
 
43
50
  ## How it works
44
51
 
@@ -4,4 +4,4 @@ Spec: docs/PRD.md (v1.0). Platform facts verified in docs/VERIFICATION.md.
4
4
  Standard library only at runtime; pytest is dev-only.
5
5
  """
6
6
 
7
- __version__ = "0.3.45"
7
+ __version__ = "0.3.47"
@@ -67,6 +67,8 @@ def build_parser() -> argparse.ArgumentParser:
67
67
  p_hist = sub.add_parser("history", help="session chain for this project")
68
68
  p_hist.add_argument("-n", type=int, default=20,
69
69
  help="show at most N most recent sessions (default 20)")
70
+ p_hist.add_argument("--json", action="store_true",
71
+ help="print the session chain as one JSON array")
70
72
 
71
73
  p_ratio = sub.add_parser("ratio",
72
74
  help="print the live context ratio of a project")
@@ -604,6 +606,9 @@ def cmd_history(args: argparse.Namespace) -> int:
604
606
  key = project.project_key_for_root(root)
605
607
  pfile = paths.project_dir(key) / "project.json"
606
608
  if not pfile.is_file():
609
+ if getattr(args, "json", False):
610
+ print("[]")
611
+ return 0
607
612
  print(f"No cc-continuity project for {root} "
608
613
  f"(a project registers itself on its first hook).")
609
614
  return 0
@@ -613,6 +618,25 @@ def cmd_history(args: argparse.Namespace) -> int:
613
618
  print(f"cc-continuity history: unreadable project record: {e}",
614
619
  file=sys.stderr)
615
620
  return 1
621
+ if getattr(args, "json", False):
622
+ rows = []
623
+ for s in (record.get("sessions") or [])[-args.n:]:
624
+ if not isinstance(s, dict):
625
+ continue
626
+ nnn = s.get("nnn") if isinstance(s.get("nnn"), int) else 0
627
+ try:
628
+ srec = json.loads(
629
+ (paths.session_dir(key, nnn)
630
+ / "state.json").read_text(encoding="utf-8"))
631
+ except (OSError, json.JSONDecodeError):
632
+ srec = None
633
+ st = (srec.get("state") if isinstance(srec, dict)
634
+ and isinstance(srec.get("state"), str) else None)
635
+ rows.append({"nnn": nnn, "name": s.get("name"),
636
+ "session_id": s.get("session_id"),
637
+ "created": s.get("created"), "state": st})
638
+ print(json.dumps(rows))
639
+ return 0
616
640
  for s in (record.get("sessions") or [])[-args.n:]:
617
641
  nnn = s.get("nnn") if isinstance(s.get("nnn"), int) else 0
618
642
  print(f"{nnn:03d} {s.get('name')} {s.get('session_id')} "
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: cc-continuity
3
+ Version: 0.3.47
4
+ Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
+ Classifier: Development Status :: 5 - Production/Stable
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Programming Language :: Python :: 3.11
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Requires-Python: >=3.11
11
+ License-File: LICENSE
12
+ Dynamic: license-file
@@ -4,9 +4,16 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cc-continuity"
7
- version = "0.3.45"
7
+ version = "0.3.47"
8
8
  description = "Zero-touch session rotation for Claude Code (local large-context model)"
9
9
  requires-python = ">=3.11"
10
+ classifiers = [
11
+ "Development Status :: 5 - Production/Stable",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Programming Language :: Python :: 3.11",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Programming Language :: Python :: 3.13",
16
+ ]
10
17
  dependencies = [] # stdlib only at runtime (PRD §0.5)
11
18
 
12
19
  [project.scripts]
@@ -122,6 +122,69 @@ def test_history_n_limits_output(cc_home, tmp_path, monkeypatch, capsys):
122
122
  assert "spike-repo-001" not in out
123
123
 
124
124
 
125
+ # --json (issue #38): the session chain as one JSON array on stdout,
126
+ # stable keys (nnn, name, session_id, created, state); the state reads
127
+ # sessions/<nnn>/state.json exactly like the #32 status fallback.
128
+
129
+
130
+ def test_history_json_prints_chain_array_with_state(cc_home, tmp_path,
131
+ monkeypatch, capsys):
132
+ repo = make_repo(tmp_path)
133
+ key, nnn = register_session(repo)
134
+ sdir = paths.session_dir(key, nnn)
135
+ sdir.mkdir(parents=True, exist_ok=True)
136
+ (sdir / "state.json").write_text(json.dumps({"state": "ACTIVE"}),
137
+ encoding="utf-8")
138
+ key2, nnn2 = register_session(
139
+ repo, session_id="22222222-2222-2222-2222-222222222222")
140
+ # The real SessionStart hook seeds state.json; drop it so session 2
141
+ # exercises the "no state on disk yet" path.
142
+ (paths.session_dir(key2, nnn2) / "state.json").unlink(missing_ok=True)
143
+ monkeypatch.chdir(repo)
144
+ assert cli.main(["history", "--json"]) == 0
145
+ rows = json.loads(capsys.readouterr().out)
146
+ assert [r["nnn"] for r in rows] == [1, 2]
147
+ assert set(rows[0]) == {"nnn", "name", "session_id", "created", "state"}
148
+ assert rows[0]["state"] == "ACTIVE"
149
+ assert rows[0]["session_id"] == SID
150
+ assert rows[0]["name"] == "spike-repo-001"
151
+ assert rows[1]["state"] is None
152
+ assert rows[1]["name"] == "spike-repo-002"
153
+
154
+
155
+ def test_history_json_empty_array_without_project(cc_home, tmp_path,
156
+ monkeypatch, capsys):
157
+ repo = make_repo(tmp_path)
158
+ monkeypatch.chdir(repo)
159
+ assert cli.main(["history", "--json"]) == 0
160
+ captured = capsys.readouterr()
161
+ assert json.loads(captured.out) == []
162
+ assert captured.err == ""
163
+
164
+
165
+ def test_history_json_honors_n(cc_home, tmp_path, monkeypatch, capsys):
166
+ repo = make_repo(tmp_path)
167
+ register_session(repo, session_id=SID)
168
+ register_session(repo, session_id="22222222-2222-2222-2222-222222222222")
169
+ monkeypatch.chdir(repo)
170
+ assert cli.main(["history", "--json", "-n", "1"]) == 0
171
+ rows = json.loads(capsys.readouterr().out)
172
+ assert [r["name"] for r in rows] == ["spike-repo-002"]
173
+
174
+
175
+ def test_history_json_unreadable_state_is_none(cc_home, tmp_path,
176
+ monkeypatch, capsys):
177
+ repo = make_repo(tmp_path)
178
+ key, nnn = register_session(repo, session_id=SID)
179
+ sdir = paths.session_dir(key, nnn)
180
+ sdir.mkdir(parents=True, exist_ok=True)
181
+ (sdir / "state.json").write_text("{broken", encoding="utf-8")
182
+ monkeypatch.chdir(repo)
183
+ assert cli.main(["history", "--json"]) == 0
184
+ rows = json.loads(capsys.readouterr().out)
185
+ assert rows[0]["state"] is None
186
+
187
+
125
188
  # -------------------------------------------------------------------- ratio
126
189
 
127
190
 
@@ -0,0 +1,108 @@
1
+ """Issue #73 + #74: README badges rows.
2
+
3
+ Two shields.io rows under the title are the README's at-a-glance vitals:
4
+ GitHub counters first, package and community signals second. Pin the
5
+ exact badge lines (image URL + link target) and their position so a
6
+ later edit cannot silently drop one or retarget a link.
7
+ """
8
+
9
+ from pathlib import Path
10
+
11
+ ROOT = Path(__file__).resolve().parents[1]
12
+ TEXT = (ROOT / "README.md").read_text(encoding="utf-8")
13
+
14
+ BADGES_GITHUB = [
15
+ "[![Forks](https://img.shields.io/github/forks/pqant/claude-continuity"
16
+ "?label=FORKS&logo=github&labelColor=%23333333&color=%23ff8c00)]"
17
+ "(https://github.com/pqant/claude-continuity/forks)",
18
+ "[![Stars](https://img.shields.io/github/stars/pqant/claude-continuity"
19
+ "?label=STARS&logo=github&labelColor=%23333333&color=%234c1)]"
20
+ "(https://github.com/pqant/claude-continuity/stargazers)",
21
+ "[![Issues](https://img.shields.io/github/issues/pqant/claude-continuity"
22
+ "?label=ISSUES&logo=github&labelColor=%23333333&color=%23007ec6)]"
23
+ "(https://github.com/pqant/claude-continuity/issues)",
24
+ "[![Last commit](https://img.shields.io/github/last-commit/"
25
+ "pqant/claude-continuity?label=LAST%20COMMIT&logo=github"
26
+ "&labelColor=%23333333&color=%23e0559a)]"
27
+ "(https://github.com/pqant/claude-continuity/commits/main)",
28
+ "[![Code of conduct](https://img.shields.io/badge/CODE%20OF%20CONDUCT"
29
+ "-ENFORCED-%239146ff?logo=contributorcovenant&labelColor=%23333333)]"
30
+ "(CODE_OF_CONDUCT.md)",
31
+ "[![Contributions](https://img.shields.io/badge/CONTRIBUTIONS-WELCOME"
32
+ "-%23e0559a?logo=git&labelColor=%23333333)](CONTRIBUTING.md)",
33
+ "[![Security](https://img.shields.io/badge/SECURITY-POLICY-%234c1"
34
+ "?logo=github&labelColor=%23333333)](SECURITY.md)",
35
+ ]
36
+
37
+ BADGES_PACKAGE = [
38
+ "[![PyPI](https://img.shields.io/pypi/v/cc-continuity?label=PYPI"
39
+ "&logo=pypi&logoColor=white&labelColor=%23333333&color=%23007ec6)]"
40
+ "(https://pypi.org/project/cc-continuity/)",
41
+ "[![Downloads](https://img.shields.io/pypi/dm/cc-continuity"
42
+ "?label=DOWNLOADS&logo=pypi&logoColor=white&labelColor=%23333333"
43
+ "&color=%23007ec6)](https://pypi.org/project/cc-continuity/)",
44
+ "[![License](https://img.shields.io/github/license/pqant/claude-continuity"
45
+ "?label=LICENSE&logo=github&labelColor=%23333333&color=%234c1)](LICENSE)",
46
+ "[![CI](https://github.com/pqant/claude-continuity/actions/workflows/"
47
+ "ci.yml/badge.svg)](https://github.com/pqant/claude-continuity/actions"
48
+ "/workflows/ci.yml)",
49
+ "[![Python versions](https://img.shields.io/pypi/pyversions/"
50
+ "cc-continuity?label=PYTHON&logo=python&logoColor=white"
51
+ "&labelColor=%23333333&color=%233776ab)]"
52
+ "(https://pypi.org/project/cc-continuity/)",
53
+ "[![Good first issues](https://img.shields.io/github/issues/"
54
+ "pqant/claude-continuity/good%20first%20issue?label=GOOD%20FIRST%20ISSUES"
55
+ "&logo=github&labelColor=%23333333&color=%237057ff)]"
56
+ "(https://github.com/pqant/claude-continuity/issues?q=is%3Aissue"
57
+ "+is%3Aopen+label%3A%22good+first+issue%22)",
58
+ ]
59
+
60
+
61
+ def test_badges_rows_are_the_first_block():
62
+ lines = TEXT.splitlines()
63
+ assert lines[0] == "# cc-continuity"
64
+ assert lines[1] == ""
65
+ for start, count in ((2, len(BADGES_GITHUB)),
66
+ (2 + len(BADGES_GITHUB) + 1, len(BADGES_PACKAGE))):
67
+ row = lines[start:start + count]
68
+ assert all(ln.startswith("[![") for ln in row), row
69
+ assert lines[start + count] == ""
70
+ # the tagline still follows the rows (not displaced)
71
+ tail = 2 + len(BADGES_GITHUB) + 1 + len(BADGES_PACKAGE) + 1
72
+ assert lines[tail].startswith("Zero-touch session rotation")
73
+
74
+
75
+ def test_badge_lines_are_exact():
76
+ lines = TEXT.splitlines()
77
+ assert lines[2:2 + len(BADGES_GITHUB)] == BADGES_GITHUB
78
+ start = 2 + len(BADGES_GITHUB) + 1
79
+ assert lines[start:start + len(BADGES_PACKAGE)] == BADGES_PACKAGE
80
+
81
+
82
+ def test_live_counters_hit_the_repo():
83
+ for line in BADGES_GITHUB[:4]:
84
+ assert "https://img.shields.io/github/" in line
85
+ assert "pqant/claude-continuity" in line
86
+ for line in (BADGES_PACKAGE[0], BADGES_PACKAGE[1], BADGES_PACKAGE[4]):
87
+ assert "img.shields.io/pypi/" in line
88
+ assert "cc-continuity" in line
89
+
90
+
91
+ def test_static_badges_link_into_community_files():
92
+ assert "(CODE_OF_CONDUCT.md)" in TEXT
93
+ assert "(CONTRIBUTING.md)" in TEXT
94
+ assert "(SECURITY.md)" in TEXT
95
+
96
+
97
+ def test_pyproject_declares_classifiers_for_the_python_badge():
98
+ # The PYTHON badge reads the published metadata; without these
99
+ # classifiers it renders "missing" (issue #74).
100
+ pyproject = (ROOT / "pyproject.toml").read_text(encoding="utf-8")
101
+ for want in [
102
+ "Programming Language :: Python :: 3.11",
103
+ "Programming Language :: Python :: 3.12",
104
+ "Programming Language :: Python :: 3.13",
105
+ "Development Status :: 5 - Production/Stable",
106
+ "License :: OSI Approved :: MIT License",
107
+ ]:
108
+ assert want in pyproject, want
@@ -1,7 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: cc-continuity
3
- Version: 0.3.45
4
- Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
- Requires-Python: >=3.11
6
- License-File: LICENSE
7
- Dynamic: license-file
@@ -1,7 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: cc-continuity
3
- Version: 0.3.45
4
- Summary: Zero-touch session rotation for Claude Code (local large-context model)
5
- Requires-Python: >=3.11
6
- License-File: LICENSE
7
- Dynamic: license-file
@@ -1,62 +0,0 @@
1
- """Issue #73: README badges row.
2
-
3
- The seven shields.io badges under the title are the README's at-a-glance
4
- vitals. Pin the exact badge lines (image URL + link target) and their
5
- position so a later edit cannot silently drop one or retarget a link.
6
- """
7
-
8
- from pathlib import Path
9
-
10
- ROOT = Path(__file__).resolve().parents[1]
11
- TEXT = (ROOT / "README.md").read_text(encoding="utf-8")
12
-
13
- BADGES = [
14
- "[![Forks](https://img.shields.io/github/forks/pqant/claude-continuity"
15
- "?label=FORKS&logo=github&labelColor=%23333333&color=%23ff8c00)]"
16
- "(https://github.com/pqant/claude-continuity/forks)",
17
- "[![Stars](https://img.shields.io/github/stars/pqant/claude-continuity"
18
- "?label=STARS&logo=github&labelColor=%23333333&color=%234c1)]"
19
- "(https://github.com/pqant/claude-continuity/stargazers)",
20
- "[![Issues](https://img.shields.io/github/issues/pqant/claude-continuity"
21
- "?label=ISSUES&logo=github&labelColor=%23333333&color=%23007ec6)]"
22
- "(https://github.com/pqant/claude-continuity/issues)",
23
- "[![Last commit](https://img.shields.io/github/last-commit/"
24
- "pqant/claude-continuity?label=LAST%20COMMIT&logo=github"
25
- "&labelColor=%23333333&color=%23e0559a)]"
26
- "(https://github.com/pqant/claude-continuity/commits/main)",
27
- "[![Code of conduct](https://img.shields.io/badge/CODE%20OF%20CONDUCT"
28
- "-ENFORCED-%239146ff?logo=contributorcovenant&labelColor=%23333333)]"
29
- "(CODE_OF_CONDUCT.md)",
30
- "[![Contributions](https://img.shields.io/badge/CONTRIBUTIONS-WELCOME"
31
- "-%23e0559a?logo=git&labelColor=%23333333)](CONTRIBUTING.md)",
32
- "[![Security](https://img.shields.io/badge/SECURITY-POLICY-%234c1"
33
- "?logo=github&labelColor=%23333333)](SECURITY.md)",
34
- ]
35
-
36
-
37
- def test_badges_row_is_the_first_block():
38
- lines = TEXT.splitlines()
39
- assert lines[0] == "# cc-continuity"
40
- assert lines[1] == ""
41
- row = [ln for ln in lines[2:2 + 7]]
42
- assert all(ln.startswith("[![") for ln in row), row
43
- # the tagline still follows the row (not displaced)
44
- assert lines[2 + 7] == ""
45
- assert lines[2 + 8].startswith("Zero-touch session rotation")
46
-
47
-
48
- def test_badge_lines_are_exact():
49
- lines = TEXT.splitlines()
50
- assert lines[2:2 + 7] == BADGES
51
-
52
-
53
- def test_live_counters_hit_the_repo():
54
- for line in BADGES[:4]:
55
- assert "https://img.shields.io/github/" in line
56
- assert "pqant/claude-continuity" in line
57
-
58
-
59
- def test_static_badges_link_into_community_files():
60
- assert "(CODE_OF_CONDUCT.md)" in TEXT
61
- assert "(CONTRIBUTING.md)" in TEXT
62
- assert "(SECURITY.md)" in TEXT
File without changes
File without changes