code-context-control 2.159.0__py3-none-any.whl → 2.159.1__py3-none-any.whl
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.
- cli/c3.py +1 -1
- cli/hook_edit_ledger.py +62 -33
- {code_context_control-2.159.0.dist-info → code_context_control-2.159.1.dist-info}/METADATA +1 -1
- {code_context_control-2.159.0.dist-info → code_context_control-2.159.1.dist-info}/RECORD +8 -8
- {code_context_control-2.159.0.dist-info → code_context_control-2.159.1.dist-info}/WHEEL +0 -0
- {code_context_control-2.159.0.dist-info → code_context_control-2.159.1.dist-info}/entry_points.txt +0 -0
- {code_context_control-2.159.0.dist-info → code_context_control-2.159.1.dist-info}/licenses/LICENSE +0 -0
- {code_context_control-2.159.0.dist-info → code_context_control-2.159.1.dist-info}/top_level.txt +0 -0
cli/c3.py
CHANGED
|
@@ -96,7 +96,7 @@ console = Console() if HAS_RICH else None
|
|
|
96
96
|
# Config
|
|
97
97
|
CONFIG_DIR = ".c3"
|
|
98
98
|
CONFIG_FILE = ".c3/config.json"
|
|
99
|
-
__version__ = "2.159.
|
|
99
|
+
__version__ = "2.159.1"
|
|
100
100
|
|
|
101
101
|
# The PreToolUse matcher for native subagent calls (installer and hub migration).
|
|
102
102
|
AGENT_MATCHER = "Agent|Task"
|
cli/hook_edit_ledger.py
CHANGED
|
@@ -36,57 +36,86 @@ EDITABLE_EXTS = {
|
|
|
36
36
|
|
|
37
37
|
# How many tail lines to scan for version/seq (avoids full-file parse)
|
|
38
38
|
_TAIL_SCAN = 50
|
|
39
|
+
# Bytes read per step when walking the ledger backwards from its end
|
|
40
|
+
_TAIL_CHUNK = 64 * 1024
|
|
39
41
|
|
|
40
42
|
|
|
41
43
|
def _tail_lines(ledger_file: Path, n: int = _TAIL_SCAN) -> list[str]:
|
|
42
|
-
"""
|
|
44
|
+
"""The last n non-empty lines of the ledger, oldest first.
|
|
45
|
+
|
|
46
|
+
Reads backwards from the end, so the cost follows n rather than the
|
|
47
|
+
ledger's size (it runs twice per edit, and ledgers reach megabytes).
|
|
48
|
+
"""
|
|
49
|
+
lines = []
|
|
43
50
|
try:
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
with open(ledger_file, "rb") as f:
|
|
52
|
+
pos = f.seek(0, 2)
|
|
53
|
+
partial = b""
|
|
54
|
+
while pos > 0 and len(lines) < n:
|
|
55
|
+
step = min(_TAIL_CHUNK, pos)
|
|
56
|
+
pos -= step
|
|
57
|
+
f.seek(pos)
|
|
58
|
+
parts = (f.read(step) + partial).split(b"\n")
|
|
59
|
+
# Unless the read reached the start, parts[0] may begin mid-line.
|
|
60
|
+
partial = parts.pop(0) if pos > 0 else b""
|
|
61
|
+
for raw in reversed(parts):
|
|
62
|
+
if raw.strip():
|
|
63
|
+
lines.append(raw.decode("utf-8", errors="replace"))
|
|
64
|
+
if len(lines) == n:
|
|
65
|
+
break
|
|
66
|
+
except OSError:
|
|
46
67
|
return []
|
|
47
|
-
lines = []
|
|
48
|
-
pos = len(raw)
|
|
49
|
-
while pos > 0 and len(lines) < n:
|
|
50
|
-
nl = raw.rfind(b"\n", 0, pos - 1)
|
|
51
|
-
chunk = raw[nl + 1:pos]
|
|
52
|
-
if chunk.strip():
|
|
53
|
-
lines.append(chunk.decode("utf-8", errors="replace"))
|
|
54
|
-
pos = nl if nl >= 0 else 0
|
|
55
68
|
return list(reversed(lines))
|
|
56
69
|
|
|
57
70
|
|
|
58
|
-
def
|
|
59
|
-
"""
|
|
71
|
+
def _lines_naming(ledger_file: Path, rel_path: str) -> list[str]:
|
|
72
|
+
"""Every ledger line that contains rel_path as a JSON string, in file order.
|
|
73
|
+
|
|
74
|
+
A byte search finds the candidates, so only they get JSON-parsed. The
|
|
75
|
+
raw-UTF-8 form is searched too, for a writer that skipped ASCII escaping.
|
|
76
|
+
"""
|
|
77
|
+
try:
|
|
78
|
+
raw = ledger_file.read_bytes()
|
|
79
|
+
except OSError:
|
|
80
|
+
return []
|
|
81
|
+
found = {}
|
|
82
|
+
for needle in {json.dumps(rel_path).encode("utf-8"),
|
|
83
|
+
json.dumps(rel_path, ensure_ascii=False).encode("utf-8")}:
|
|
84
|
+
pos = raw.find(needle)
|
|
85
|
+
while pos >= 0:
|
|
86
|
+
start = raw.rfind(b"\n", 0, pos) + 1
|
|
87
|
+
end = raw.find(b"\n", pos)
|
|
88
|
+
if end < 0:
|
|
89
|
+
end = len(raw)
|
|
90
|
+
found[start] = raw[start:end]
|
|
91
|
+
pos = raw.find(needle, end)
|
|
92
|
+
return [found[k].decode("utf-8", errors="replace") for k in sorted(found)]
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _max_version(lines: list[str], rel_path: str) -> int:
|
|
96
|
+
"""Highest version number among the lines' entries for rel_path (0 if none)."""
|
|
60
97
|
max_v = 0
|
|
61
|
-
for line in
|
|
98
|
+
for line in lines:
|
|
62
99
|
try:
|
|
63
100
|
entry = json.loads(line)
|
|
64
101
|
except (json.JSONDecodeError, ValueError):
|
|
65
102
|
continue
|
|
66
|
-
if entry.get("file") == rel_path:
|
|
103
|
+
if isinstance(entry, dict) and entry.get("file") == rel_path:
|
|
67
104
|
v_str = entry.get("version", "v0")
|
|
68
105
|
try:
|
|
69
106
|
max_v = max(max_v, int(v_str.lstrip("v")))
|
|
70
107
|
except (ValueError, AttributeError):
|
|
71
108
|
pass
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if entry.get("file") == rel_path:
|
|
83
|
-
v_str = entry.get("version", "v0")
|
|
84
|
-
try:
|
|
85
|
-
max_v = max(max_v, int(v_str.lstrip("v")))
|
|
86
|
-
except (ValueError, AttributeError):
|
|
87
|
-
pass
|
|
88
|
-
except Exception:
|
|
89
|
-
pass
|
|
109
|
+
return max_v
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _next_version(ledger_file: Path, rel_path: str) -> str:
|
|
113
|
+
"""Get next version for a file by scanning only the tail of the ledger."""
|
|
114
|
+
max_v = _max_version(_tail_lines(ledger_file, _TAIL_SCAN), rel_path)
|
|
115
|
+
# If nothing found in tail, file might have older entries (or a rotation
|
|
116
|
+
# tombstone at the head). Parse only the lines that name it.
|
|
117
|
+
if max_v == 0:
|
|
118
|
+
max_v = _max_version(_lines_naming(ledger_file, rel_path), rel_path)
|
|
90
119
|
return f"v{max_v + 1}"
|
|
91
120
|
|
|
92
121
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code-context-control
|
|
3
|
-
Version: 2.159.
|
|
3
|
+
Version: 2.159.1
|
|
4
4
|
Summary: Local MCP code-intelligence for AI coding tools: surgical search/read/edit, agent-config version history, path-level access + masking guards, and a multi-project hub.
|
|
5
5
|
Author-email: Dimitri Tselenchuk <dtselenc@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
cli/__init__.py,sha256=ec66drCZGNMRU4V6ov0zVhYZph1us12Vn8OvG_LJyRY,22
|
|
2
2
|
cli/_hook_utils.py,sha256=tzpdF413jakQKMbTru_GdHxQXxLLQKiZzVkTm4Fo_eU,23258
|
|
3
3
|
cli/_shell_writes.py,sha256=iBbzK0v0d29rhrYgF3zKJIJbb1WSZhQjD_6w8-nOUec,7348
|
|
4
|
-
cli/c3.py,sha256=
|
|
4
|
+
cli/c3.py,sha256=ehUpVJac8-Kdwng2kL40jaUSxb7NUIEs_k38M7AUxj8,439506
|
|
5
5
|
cli/docs.html,sha256=pPxcP5ieY0DcfEDvegwIcRxbz1woLZoKLVSF-4JVy0Q,146784
|
|
6
6
|
cli/edits.html,sha256=UjAhoCmBmQ89cklGvJqzC6eyNP2tc8H6T-e01DVkLvE,43418
|
|
7
7
|
cli/hook_access_guard.py,sha256=4UF2YHp5_vISH7Gvolc_Bz3ppSye2lGpGx38egRLj1g,32116
|
|
@@ -12,7 +12,7 @@ cli/hook_c3_signal.py,sha256=8-CycalKBMORVITE3iODjWd31Xf34KLg04stIxFlGTw,2304
|
|
|
12
12
|
cli/hook_c3read.py,sha256=bXLAVvERR0SoKrwcmZhpz78FyinteZWfm_ZL-QItSqc,3612
|
|
13
13
|
cli/hook_codex_lifecycle.py,sha256=TdpBNITJHblP0OrqQ4Ffp6ZNKLs0gJb-Onh6H-mzB0w,2832
|
|
14
14
|
cli/hook_dispatch.py,sha256=ePPxbiZbKpIyoMqXhEjTLvkKY0QNvowmmQ-1GoTguNE,29400
|
|
15
|
-
cli/hook_edit_ledger.py,sha256=
|
|
15
|
+
cli/hook_edit_ledger.py,sha256=SyOu-XHOtQQGVWyTDc5MOIRshc0zCeV3WgLv-WuL1q0,13334
|
|
16
16
|
cli/hook_edit_unlock.py,sha256=PwPRuCQPARZZRtH6wb2Xm-6ADpfrC-0rXs2uRmHAAmg,6883
|
|
17
17
|
cli/hook_filter.py,sha256=v8ZSznK5StTfYYqae1l4V2bm-e9sy2RFfpbNr5KwE2U,4988
|
|
18
18
|
cli/hook_ghost_files.py,sha256=plbedFgIJ5tXEE_8USUE39RmyODh1UjIUFNRbUo4R8w,10291
|
|
@@ -135,7 +135,7 @@ cli/ui/components/sessions.js,sha256=FIKtil76B8tCkAmcFV7hlj6GQ_DCJK2jCzvEmdK7NBE
|
|
|
135
135
|
cli/ui/components/settings.js,sha256=FXcn-UQE2mXC6HFsLeEas-wAUFKt0OJaLySroZQMhGA,84095
|
|
136
136
|
cli/ui/components/sidebar.js,sha256=K2ym2kUgpbyG-EBA_wBIIiqQY8qTatsiBZwzseMWuIQ,9939
|
|
137
137
|
cli/ui/components/tasks.js,sha256=vyKQ3uwoppMwvdEaHlhWXW4oWcAisx4NveqzMhsYqHo,38438
|
|
138
|
-
code_context_control-2.159.
|
|
138
|
+
code_context_control-2.159.1.dist-info/licenses/LICENSE,sha256=l8Kh5QCNWNvR6kIt8L0BUZvc2LAFiHv2c-FnsGnUZf4,11301
|
|
139
139
|
core/__init__.py,sha256=TSDCEcM4V7gcZVM3w2ykJaqEUch4Dkon-rivV17T73s,2501
|
|
140
140
|
core/blas_threads.py,sha256=Do7pR9YdumshhOmP6TV5oAv65i3gN7Lvt93b5EAO1bo,1256
|
|
141
141
|
core/codex_patch.py,sha256=CxvT_rQIwPNTRJZj9EHJmx0ZdOeSLxjiixuLI3Z7lPc,2107
|
|
@@ -354,8 +354,8 @@ tui/screens/search_view.py,sha256=MMHjVdlk3HZSuDBSvq8IGrqv_Mh5Us6YqXQ80bcWSMk,19
|
|
|
354
354
|
tui/screens/session_view.py,sha256=eZ1eDwHTvPOck1wCCviixtOaCxIkBT_95ytNNNriGNA,5991
|
|
355
355
|
tui/screens/stats.py,sha256=p81PjzdaIv7hllb8f45-rlVe4lJZwSdIMqu7e86_u5s,6223
|
|
356
356
|
tui/screens/ui_view.py,sha256=1QJCgLh2YfgWIpvzRG1KOGXYEaOYX6ojN61Azjf2oX0,2125
|
|
357
|
-
code_context_control-2.159.
|
|
358
|
-
code_context_control-2.159.
|
|
359
|
-
code_context_control-2.159.
|
|
360
|
-
code_context_control-2.159.
|
|
361
|
-
code_context_control-2.159.
|
|
357
|
+
code_context_control-2.159.1.dist-info/METADATA,sha256=M71H8FLV6nj0tfAPI3OXbH07UZVlqUUgiPce_stCG-M,29355
|
|
358
|
+
code_context_control-2.159.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
359
|
+
code_context_control-2.159.1.dist-info/entry_points.txt,sha256=7kX_WUsDCF2hbXzvbNyscyaBb9AeA-DJY5v_5hN0DlU,93
|
|
360
|
+
code_context_control-2.159.1.dist-info/top_level.txt,sha256=wRt41zBybVF3qAiNXHz9BURbkKvUvfhmWWtKMhaw6eE,29
|
|
361
|
+
code_context_control-2.159.1.dist-info/RECORD,,
|
|
File without changes
|
{code_context_control-2.159.0.dist-info → code_context_control-2.159.1.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{code_context_control-2.159.0.dist-info → code_context_control-2.159.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{code_context_control-2.159.0.dist-info → code_context_control-2.159.1.dist-info}/top_level.txt
RENAMED
|
File without changes
|