divan-cli 0.2.0__tar.gz → 0.2.1__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.
- {divan_cli-0.2.0 → divan_cli-0.2.1}/CHANGELOG.md +6 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/PKG-INFO +5 -1
- {divan_cli-0.2.0 → divan_cli-0.2.1}/README.md +4 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/packaging/homebrew/tap-readme.md +4 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/pyproject.toml +1 -1
- divan_cli-0.2.1/src/divan/__init__.py +1 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/tomledit.py +22 -2
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_settings.py +32 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/uv.lock +1 -1
- divan_cli-0.2.0/src/divan/__init__.py +0 -1
- {divan_cli-0.2.0 → divan_cli-0.2.1}/.agents/plugins/marketplace.json +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/.antigravity-plugin/plugin.json +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/.claude-plugin/marketplace.json +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/.claude-plugin/plugin.json +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/.codex-plugin/plugin.json +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/.github/workflows/ci.yml +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/.github/workflows/package.yml +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/.gitignore +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/AGENTS.md +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/CODE_OF_CONDUCT.md +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/CONTRIBUTING.md +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/LICENSE +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/SECURITY.md +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/examples/ci-divan-check.yml +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/hooks/claude.json +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/hooks/codex.json +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/hooks.json +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/install.sh +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/packaging/homebrew/divan.rb.tmpl +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/packaging/homebrew/render.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/packaging/smoke.sh +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/skills/divan/SKILL.md +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/SKILL.md +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/__main__.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/agent.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/check.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/cli.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/config.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/doc.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/hooks.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/index.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/join.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/land.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/privdir.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/safe.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/settings.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/src/divan/write.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/conftest.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_agent.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_check.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_confinement.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_exclude.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_find_new.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_guide_since.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_hooks.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_isolation.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_join.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_land.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_packaging.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_plugin.py +0 -0
- {divan_cli-0.2.0 → divan_cli-0.2.1}/tests/test_topics.py +0 -0
|
@@ -5,6 +5,12 @@ All notable changes to divan are recorded here. The format follows
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
## 0.2.1 - 2026-12-02
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- `divan agent set` and `divan join` edit a symlinked config (for example one managed by stow from a dotfiles repo) at its target, so the link stays in place. A dangling or looping link is refused instead of creating a config where it points.
|
|
13
|
+
|
|
8
14
|
## 0.2.0 - 2026-12-02
|
|
9
15
|
|
|
10
16
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: divan-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Search and write several markdown knowledge-base repos from one command.
|
|
5
5
|
Project-URL: Homepage, https://github.com/tnunamak/divan
|
|
6
6
|
Project-URL: Issues, https://github.com/tnunamak/divan/issues
|
|
@@ -48,9 +48,13 @@ The one-line pipe works too (`curl -fsSL https://raw.githubusercontent.com/tnuna
|
|
|
48
48
|
Homebrew:
|
|
49
49
|
|
|
50
50
|
```
|
|
51
|
+
brew tap tnunamak/divan
|
|
52
|
+
brew trust --formula tnunamak/divan/divan
|
|
51
53
|
brew install tnunamak/divan/divan
|
|
52
54
|
```
|
|
53
55
|
|
|
56
|
+
Homebrew asks you to trust a formula from a third-party tap before it installs it; the `brew trust` line does that for this one formula only.
|
|
57
|
+
|
|
54
58
|
## Quick start (one repo, no config)
|
|
55
59
|
|
|
56
60
|
```
|
|
@@ -23,9 +23,13 @@ The one-line pipe works too (`curl -fsSL https://raw.githubusercontent.com/tnuna
|
|
|
23
23
|
Homebrew:
|
|
24
24
|
|
|
25
25
|
```
|
|
26
|
+
brew tap tnunamak/divan
|
|
27
|
+
brew trust --formula tnunamak/divan/divan
|
|
26
28
|
brew install tnunamak/divan/divan
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
Homebrew asks you to trust a formula from a third-party tap before it installs it; the `brew trust` line does that for this one formula only.
|
|
32
|
+
|
|
29
33
|
## Quick start (one repo, no config)
|
|
30
34
|
|
|
31
35
|
```
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
Homebrew tap for [divan](https://github.com/tnunamak/divan), which searches and writes markdown knowledge-base repos from one command.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
+
brew tap tnunamak/divan
|
|
7
|
+
brew trust --formula tnunamak/divan/divan
|
|
6
8
|
brew install tnunamak/divan/divan
|
|
7
9
|
```
|
|
8
10
|
|
|
11
|
+
Homebrew asks you to trust a formula from a third-party tap before it installs it; the `brew trust` line does that for this one formula only.
|
|
12
|
+
|
|
9
13
|
The formula in `Formula/divan.rb` is generated from each divan release; do not edit it by hand.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.1"
|
|
@@ -53,11 +53,29 @@ def set_key(text: str, table: str, key: str, literal: str) -> str:
|
|
|
53
53
|
return "".join(lines)
|
|
54
54
|
|
|
55
55
|
|
|
56
|
+
def resolve_config(path: Path) -> Path:
|
|
57
|
+
"""The file to lock and edit for `path`. A symlink (e.g. a config stowed from a dotfiles
|
|
58
|
+
repo) resolves to its target, which must exist: a dangling or looping link is refused
|
|
59
|
+
rather than creating a config wherever it points. A missing plain path is fine."""
|
|
60
|
+
path = Path(path)
|
|
61
|
+
if not path.is_symlink():
|
|
62
|
+
return path
|
|
63
|
+
try:
|
|
64
|
+
target = Path(os.path.realpath(path, strict=True))
|
|
65
|
+
except (OSError, RuntimeError) as e:
|
|
66
|
+
raise ConfigError(f"{path} is a symlink to a missing or looping target; fix or remove the link") from e
|
|
67
|
+
if not target.is_file():
|
|
68
|
+
raise ConfigError(f"{path} links to {target}, which is not a file; fix or remove the link")
|
|
69
|
+
return target
|
|
70
|
+
|
|
71
|
+
|
|
56
72
|
@contextlib.contextmanager
|
|
57
73
|
def locked(path: Path, timeout: float | None = None):
|
|
58
74
|
"""Hold an exclusive lock on a sidecar file while a config is read, edited and
|
|
59
75
|
written, so two divan processes cannot both edit the same original text.
|
|
60
|
-
With `timeout` (seconds), give up with a ConfigError instead of waiting forever.
|
|
76
|
+
With `timeout` (seconds), give up with a ConfigError instead of waiting forever.
|
|
77
|
+
A symlinked config (e.g. managed by stow) is locked and edited at its target."""
|
|
78
|
+
path = resolve_config(path)
|
|
61
79
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
62
80
|
with open(path.with_name(path.name + ".lock"), "a") as lk:
|
|
63
81
|
if timeout is None:
|
|
@@ -81,7 +99,9 @@ def locked(path: Path, timeout: float | None = None):
|
|
|
81
99
|
|
|
82
100
|
def write_checked(path: Path, old: str, new: str, expected: dict) -> None:
|
|
83
101
|
"""Write `new` only if it parses to exactly `expected` and the file still holds
|
|
84
|
-
`old` (the text the edit was computed from); atomic replace. Call inside `locked`.
|
|
102
|
+
`old` (the text the edit was computed from); atomic replace. Call inside `locked`.
|
|
103
|
+
A symlink is followed, so the link itself survives the edit."""
|
|
104
|
+
path = resolve_config(path)
|
|
85
105
|
current = path.read_text(encoding="utf-8") if path.is_file() else ""
|
|
86
106
|
if current != old:
|
|
87
107
|
raise ConfigError(f"{path} changed while it was being edited; nothing was written, try again")
|
|
@@ -308,3 +308,35 @@ def test_gate_headless_shows_in_config_and_is_settable(box):
|
|
|
308
308
|
assert settings.values()["gate_headless"] is False
|
|
309
309
|
settings.set_value("gate_headless", "on")
|
|
310
310
|
assert settings.values()["gate_headless"] is True
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
def test_set_keeps_a_symlinked_config_linked(box, tmp_path):
|
|
314
|
+
# A config managed by stow is a symlink into a dotfiles repo; editing it must
|
|
315
|
+
# change the target and leave the link in place.
|
|
316
|
+
real = tmp_path / "dotfiles" / "config.toml"
|
|
317
|
+
real.parent.mkdir()
|
|
318
|
+
real.write_text("[agent]\nstop_gate = \"block-once\"\n")
|
|
319
|
+
link = box / "config.toml"
|
|
320
|
+
if link.exists() or link.is_symlink():
|
|
321
|
+
link.unlink()
|
|
322
|
+
link.symlink_to(real)
|
|
323
|
+
settings.set_value("stop_gate", "remind")
|
|
324
|
+
assert link.is_symlink() and link.resolve() == real.resolve()
|
|
325
|
+
assert 'stop_gate = "remind"' in real.read_text()
|
|
326
|
+
assert not list(box.glob("config.toml.*")), "no lock or temp file beside the link"
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
@pytest.mark.parametrize("kind", ["dangling", "loop"])
|
|
330
|
+
def test_set_refuses_a_broken_config_link(box, tmp_path, kind):
|
|
331
|
+
link = box / "config.toml"
|
|
332
|
+
if link.exists() or link.is_symlink():
|
|
333
|
+
link.unlink()
|
|
334
|
+
missing = tmp_path / "gone" / "config.toml"
|
|
335
|
+
if kind == "dangling":
|
|
336
|
+
link.symlink_to(missing)
|
|
337
|
+
else:
|
|
338
|
+
link.symlink_to(link)
|
|
339
|
+
with pytest.raises(ConfigError):
|
|
340
|
+
settings.set_value("stop_gate", "remind")
|
|
341
|
+
assert not missing.parent.exists(), "no target tree created"
|
|
342
|
+
assert not list(box.glob("config.toml.*")) and not list(tmp_path.glob("gone*")), "no sidecar created"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.0"
|
|
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
|