feat(ui): interactive graph, strip context menus, days by activity, message times, limit status words
This commit is contained in:
+39
-1
@@ -2,7 +2,12 @@ import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
from beaver_gateway.agents.claude import ClaudeAgent, Prompts
|
||||
from beaver_gateway.conversations.context import compose, files_touched, granules
|
||||
from beaver_gateway.conversations.context import (
|
||||
bash_paths,
|
||||
compose,
|
||||
files_touched,
|
||||
granules,
|
||||
)
|
||||
from beaver_gateway.vault.links import LinkIndex
|
||||
|
||||
|
||||
@@ -39,6 +44,39 @@ def test_files_touched_groups_by_path_relative_to_cwd() -> None:
|
||||
assert counts == {"Read": 2, "Edit": 1, "Grep": 1, "Bash": 1}
|
||||
|
||||
|
||||
def test_bash_paths_follow_cd_and_quotes() -> None:
|
||||
paths, here, writes = bash_paths(
|
||||
"cd /vault/мета && cat 'заметка.md' | head; sed -n 1,5p \"📆 доски/работа.md\"",
|
||||
Path("/elsewhere"),
|
||||
)
|
||||
assert paths == ["/vault/мета/заметка.md", "/vault/мета/📆 доски/работа.md"]
|
||||
assert here == Path("/vault/мета")
|
||||
assert writes is False
|
||||
_, _, writes = bash_paths(
|
||||
'python3 - <<PY\np = pathlib.Path("поправки.md")\np.write_text(s)\nPY',
|
||||
Path("/vault"),
|
||||
)
|
||||
assert writes is True
|
||||
assert bash_paths("ls *.md; grep -c x notes.md", None)[0] == ["notes.md"]
|
||||
|
||||
|
||||
def test_files_touched_reads_shell_commands_with_a_sticky_cwd() -> None:
|
||||
cwd = Path("/vault")
|
||||
files, counts = files_touched(
|
||||
[
|
||||
entry("Bash", {"command": "cd /vault/мета && cat a.md"}, "1"),
|
||||
entry("Bash", {"command": "python3 - <<PY\nopen('b.md','w')\nPY"}, "2"),
|
||||
entry("Bash", {"command": "ls"}, "3"),
|
||||
],
|
||||
cwd=cwd,
|
||||
)
|
||||
assert [(f["path"], f["reads"], f["writes"]) for f in files] == [
|
||||
("мета/b.md", 0, 1),
|
||||
("мета/a.md", 1, 0),
|
||||
]
|
||||
assert counts == {"Bash": 3}
|
||||
|
||||
|
||||
def test_compose_reads_granules_and_skills() -> None:
|
||||
root = Path(tempfile.mkdtemp(prefix="beaver-ctx-"))
|
||||
(root / "voice.md").write_text("be brief " * 40)
|
||||
|
||||
Reference in New Issue
Block a user