dotagents-cli 0.7.3__tar.gz → 0.7.5__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.
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/CHANGELOG.md +50 -1
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/PKG-INFO +2 -2
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/guide/commands.md +6 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/guide/private-sync.md +8 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/pyproject.toml +1 -1
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/AGENTS.md +6 -2
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/__init__.py +1 -1
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/cmds/findings.py +104 -5
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/cli/__init__.py +26 -65
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/cli/build_pyz.py +1 -1
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_cli_main.py +1 -1
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_cmds_discovery.py +15 -2
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_findings_cmd.py +81 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_fix_cli.py +0 -25
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_fix_init.py +3 -4
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/.gitignore +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/LICENSE +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/README.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/agents.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/cli.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/commands.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/context.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/env.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/fs.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/hooks.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/merge.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/overlays.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/reference.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/resources.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/scope.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/skills.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/sources.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/api/wrappers.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/changelog.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/guide/authoring.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/guide/install.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/guide/overlays.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/docs/index.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/install.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/mkdocs.yml +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/__main__.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_agents.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_context.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_env.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_fs.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_hooks.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_ignore.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_merge.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/cmds/launch.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/hooks/preinvocation_antigravity_context.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/hooks/pretooluse_codex_env.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/hooks/sessionstart_codex_context.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/templates/AGENTS.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/templates/PROJECT.md +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlays.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_resources.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_scope.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_skills.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_sources.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_wrappers.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/cli/_common.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/cli/about.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/cli/context.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/cli/env.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/cli/init.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/cli/overlays.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/cli/path.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/py.typed +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/_helpers.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/_shell.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/conftest.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_about.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_agents.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_api_header.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_audit_leak.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_build_pyz.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_cloud_setup.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_context.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_env.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_env_cli_scope.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_env_format.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_env_into.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_env_regressions.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_env_safety.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_fix_adapters.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_fix_env.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_fix_hooks.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_fix_overlays.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_fix_packaging.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_fix_scope_context.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_fix_skills_adapters.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_git_ssl_revoke.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_hooks.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_ignore.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_init_base.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_last_mile.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_launch_cmd.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_local_additions.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_mcp.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_no_internal_labels.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_overlay_libs.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_overlays_cli.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_overlays_command.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_path_timeout_frontmatter.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_powershell_env_hook.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_quoting_injection_safety.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_scope.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_sources.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_sources_uri.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_wire_hooks.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tests/test_wrappers.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tools/audit.py +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tools/cloud-setup.sh +0 -0
- {dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/tools/pyz_smoke.sh +0 -0
|
@@ -7,6 +7,53 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.5] - 2026-10-14
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `main()` runs through `duho.run(..., exit=False)`: it always returns the status
|
|
15
|
+
instead of raising `SystemExit` for a message, `--help` or a usage error (the
|
|
16
|
+
console script, `python -m dotagents` and `install.py` exit with it as before, with
|
|
17
|
+
the same statuses and the same text on standard error). Ctrl-C now ends with
|
|
18
|
+
status 130 and no traceback, and a closed pipe on standard output ends with
|
|
19
|
+
status 1, quietly.
|
|
20
|
+
- The `duho` floor moves to `>=0.7.5,<0.8` (from `>=0.6.0,<0.7`); the vendored
|
|
21
|
+
`.pyz` pin (`build-pyz --duho-version`) moves with it. No flag, exit status or
|
|
22
|
+
output changes.
|
|
23
|
+
- Command modules are loaded with duho's own `discover_commands(on_error=...)`
|
|
24
|
+
instead of a copy of its loop built on a private duho name. A module that fails
|
|
25
|
+
to import is still named in a warning and skipped, and the listing order is
|
|
26
|
+
unchanged. A command module may now import a sibling helper file by its bare
|
|
27
|
+
name.
|
|
28
|
+
- `kebab_name` delegates to `duho.text.kebabcase`; its results are unchanged.
|
|
29
|
+
- Discovered commands are listed in discovery order with `discover_commands(sort=False)`
|
|
30
|
+
instead of being re-sorted here, and a command that cannot build its parser is
|
|
31
|
+
found out with `duho.runtime.build_command_parser` instead of a private duho
|
|
32
|
+
helper. Output, exit statuses and which commands are skipped are unchanged.
|
|
33
|
+
|
|
34
|
+
## [0.7.4] - 2026-10-14
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- `findings index --requote` quotes, in the findings already on disk, the frontmatter
|
|
39
|
+
values YAML cannot read as they stand. Only those lines change: bodies, the other
|
|
40
|
+
lines and line endings are kept.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- The private-sync guide describes the default ignore rules the overlay's
|
|
45
|
+
`sync-project` now writes, once, into the `.gitignore` of a store kept in git:
|
|
46
|
+
`scratch/`, `tmp/`, `__pycache__/`, hidden files and the machine-local overrides
|
|
47
|
+
stay out of the private repository.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- `findings` writes frontmatter any YAML parser reads. A description that opens with
|
|
52
|
+
`[` or a backtick, or holds `: `, was written bare, and a markdown viewer or any
|
|
53
|
+
other tool reading the frontmatter rejected the file. Such a value is now a
|
|
54
|
+
double-quoted string; a plain one is still written bare, and a finding written
|
|
55
|
+
before reads as it did.
|
|
56
|
+
|
|
10
57
|
## [0.7.3] - 2026-10-04
|
|
11
58
|
|
|
12
59
|
### Changed
|
|
@@ -1394,7 +1441,9 @@ Patch release: the PATH/POSIX-conversion fix above (the only change since 0.3.0)
|
|
|
1394
1441
|
affected module sources (`dotagents.cli`, `duho.presets`) to extracted temp files
|
|
1395
1442
|
before dispatch; a no-op for a plain install.
|
|
1396
1443
|
|
|
1397
|
-
[Unreleased]: https://github.com/jose-pr/dotagents/compare/v0.7.
|
|
1444
|
+
[Unreleased]: https://github.com/jose-pr/dotagents/compare/v0.7.5...HEAD
|
|
1445
|
+
[0.7.5]: https://github.com/jose-pr/dotagents/compare/v0.7.4...v0.7.5
|
|
1446
|
+
[0.7.4]: https://github.com/jose-pr/dotagents/compare/v0.7.3...v0.7.4
|
|
1398
1447
|
[0.7.3]: https://github.com/jose-pr/dotagents/compare/v0.7.2...v0.7.3
|
|
1399
1448
|
[0.7.2]: https://github.com/jose-pr/dotagents/compare/v0.7.1...v0.7.2
|
|
1400
1449
|
[0.7.1]: https://github.com/jose-pr/dotagents/compare/v0.7.0...v0.7.1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: dotagents-cli
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.5
|
|
4
4
|
Summary: The dotagents CLI: install and manage a portable ~/.agents config for AI coding agents
|
|
5
5
|
Project-URL: Homepage, https://github.com/jose-pr/dotagents/
|
|
6
6
|
Project-URL: Repository, https://github.com/jose-pr/dotagents
|
|
@@ -23,7 +23,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
24
|
Classifier: Typing :: Typed
|
|
25
25
|
Requires-Python: >=3.9
|
|
26
|
-
Requires-Dist: duho<0.
|
|
26
|
+
Requires-Dist: duho<0.8,>=0.7.5
|
|
27
27
|
Requires-Dist: pathlib-next<0.10,>=0.9.0
|
|
28
28
|
Requires-Dist: tomli>=1.1.0; python_version < '3.11'
|
|
29
29
|
Provides-Extra: dev
|
|
@@ -442,6 +442,7 @@ dotagents findings done <name> -r "fixed in _context; test added"
|
|
|
442
442
|
dotagents findings reopen <name>
|
|
443
443
|
dotagents findings remove <name> # an active finding recorded by mistake
|
|
444
444
|
dotagents findings index # regenerate INDEX.md after hand edits
|
|
445
|
+
dotagents findings index --requote # ...and quote frontmatter values YAML cannot read
|
|
445
446
|
dotagents findings path # where this scope's queue lives
|
|
446
447
|
```
|
|
447
448
|
|
|
@@ -463,6 +464,11 @@ dotagents findings path # where this scope's queue lives
|
|
|
463
464
|
without a frontmatter is still listed (name = file stem, description = its
|
|
464
465
|
first heading or line) and gains one the first time the command rewrites it;
|
|
465
466
|
a note that is not UTF-8 is skipped with a warning and never rewritten.
|
|
467
|
+
- The frontmatter is YAML a viewer or another tool can parse: a value is written
|
|
468
|
+
bare when YAML reads it back as the same text, and double-quoted otherwise (a
|
|
469
|
+
description that opens with `[` or a backtick, or holds `: `). `index --requote`
|
|
470
|
+
does the same for findings an earlier version wrote, and for hand-written ones,
|
|
471
|
+
changing only the lines that need it.
|
|
466
472
|
- `add` refuses the names `index` and `readme` (on a case-insensitive
|
|
467
473
|
filesystem they are `INDEX.md` / `README.md`). `done` and `reopen` refuse to
|
|
468
474
|
move onto an existing file, and `remove` deletes active findings only: reopen
|
|
@@ -49,6 +49,14 @@ leaves the machine is a perfectly valid setup.
|
|
|
49
49
|
links the store instead.
|
|
50
50
|
- **Copy mode** (`--copy`) makes `.agents` a real directory rather than a symlink;
|
|
51
51
|
`sync-project` copies edits back into the store.
|
|
52
|
+
- **Default ignore rules.** A project's `.agents/scratch/` lives inside the store, so
|
|
53
|
+
the built-in git path would commit it. The first `sync-project` on that path
|
|
54
|
+
appends a block to the store's `.gitignore` that leaves out `scratch/`, `tmp/`,
|
|
55
|
+
`__pycache__/`, hidden files (`.*`, keeping `.gitignore`, `.gitattributes`,
|
|
56
|
+
`.gitkeep`, `.ignore` and `.dotagents-install.json`) and the machine-local
|
|
57
|
+
overrides (`*.local.*`, `local.env`). It is written once, under a marker line:
|
|
58
|
+
edit the block freely and keep that line. The overlay's `kb/PRIVATE_SYNC.md` has
|
|
59
|
+
the block in full.
|
|
52
60
|
|
|
53
61
|
## Cloud sessions
|
|
54
62
|
|
|
@@ -35,7 +35,7 @@ classifiers = [
|
|
|
35
35
|
# `build-pyz` vendors the floor of each of these (src/dotagents/cli/build_pyz.py);
|
|
36
36
|
# raise a floor and move its pin there in the same change.
|
|
37
37
|
dependencies = [
|
|
38
|
-
"duho>=0.
|
|
38
|
+
"duho>=0.7.5,<0.8",
|
|
39
39
|
"pathlib_next>=0.9.0,<0.10",
|
|
40
40
|
# overlay.toml manifests and TOML registries; tomllib is stdlib from 3.11.
|
|
41
41
|
'tomli>=1.1.0; python_version < "3.11"',
|
|
@@ -40,7 +40,7 @@ and an error saying a command is required, and exits 2.
|
|
|
40
40
|
| `path [-g] [--lib] [--format list\|native\|posix\|json]` | Print the bin dirs `env` puts on `PATH` (`--lib`: the existing lib dirs it puts on `PYTHONPATH`), highest precedence first; runs no env file. `posix` is `:`-joined, MSYS2 form on Windows. |
|
|
41
41
|
| `env [-g] [--format F] [--diff] [--cache] [--into FILE]` | Print the assembled environment (`--diff`: only what differs from the caller's; `--cache`: replay the previous output while `env_cache_key` holds, up to `ENV_CACHE_TTL`; `--into FILE`: write it into FILE as the one block this command owns there) in format `F`: `auto` (default: the calling shell), `export`/`posix`/`sh`/`bash`, `dotenv`/`env`, `powershell`/`pwsh`/`ps`, `cmd`/`bat`/`batch`, `fish`, `json`, `ini`, `yaml`. |
|
|
42
42
|
| `launch [AGENT] [-g] [--command PROG] [--no-context] [--inline] [--write-agent] [--dry-run] [-- ARGS...]` | Run the agent's CLI with the env applied and the context handed over; the exit code is the harness's (`128+N` on signal N). |
|
|
43
|
-
| `findings add\|list\|show\|done\|reopen\|remove\|index\|path [-g] [--dir D]` | The findings queue at `<store>/findings/` (`--dir` overrides): one markdown file per finding, `done` moves it to `processed/` with a required resolution, `INDEX.md` regenerated on every change. |
|
|
43
|
+
| `findings add\|list\|show\|done\|reopen\|remove\|index\|path [-g] [--dir D]` | The findings queue at `<store>/findings/` (`--dir` overrides): one markdown file per finding, `done` moves it to `processed/` with a required resolution, `INDEX.md` regenerated on every change. The frontmatter is valid YAML (a value is double-quoted when it must be); `index --requote` fixes values written bare in existing files, touching nothing else. |
|
|
44
44
|
| `about [--json]` | `dotagents-cli <version>`, then `<distribution> <version>` per bundled (`.pyz`) or installed package. |
|
|
45
45
|
| `build-pyz [--out P] [--python SHEBANG] [--duho-version V] [--pathlib-next-version V] [--extras a,b]` | Build a zipapp from a source checkout; errors elsewhere. |
|
|
46
46
|
|
|
@@ -74,7 +74,11 @@ are skipped.
|
|
|
74
74
|
## `dotagents.cli`
|
|
75
75
|
|
|
76
76
|
- `main(argv=None) -> int` — the entry point (`dotagents` console script,
|
|
77
|
-
`python -m dotagents`, `install.py`).
|
|
77
|
+
`python -m dotagents`, `install.py`). It always returns the status and never
|
|
78
|
+
raises `SystemExit`: a `SystemExit` raised below it (a message, `--help`, a usage
|
|
79
|
+
error) comes back as its status, the message going to standard error. Ctrl-C
|
|
80
|
+
returns 130 and a closed pipe on standard output returns 1, both without a
|
|
81
|
+
traceback.
|
|
78
82
|
- `class Dotagents(LoggingArgs, Cli)` — the umbrella; field `cmdspath: list[str]`.
|
|
79
83
|
- `CMDS_PATH_ENV = "AGENTS_CMDS_PATH"`.
|
|
80
84
|
- Re-exported for command modules: `DotAgentsArgs`, `_write_stdout` (see below).
|
{dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/cmds/findings.py
RENAMED
|
@@ -37,6 +37,10 @@ line, the details in the body::
|
|
|
37
37
|
|
|
38
38
|
<the decision, evidence, or why no action was needed>
|
|
39
39
|
|
|
40
|
+
The frontmatter is YAML a viewer or another tool can parse: a value is written
|
|
41
|
+
bare when YAML reads it back as the same text, and as a double-quoted string
|
|
42
|
+
otherwise (a description that opens with ``[`` or a backtick, or holds ``: ``).
|
|
43
|
+
|
|
40
44
|
``INDEX.md`` is one line per finding, active first, then processed -- the cheap
|
|
41
45
|
thing to read at session start. Hand-written notes without frontmatter are
|
|
42
46
|
still listed (name = file stem, description = first heading or line), and gain
|
|
@@ -90,6 +94,69 @@ def slugify(text: str) -> str:
|
|
|
90
94
|
return slug
|
|
91
95
|
|
|
92
96
|
|
|
97
|
+
#: A value cannot be written bare when it opens with one of these: YAML reads
|
|
98
|
+
#: ``[`` as a list, a quote as a quoted string, a backtick as reserved.
|
|
99
|
+
_YAML_INDICATORS = frozenset("-?:,[]{}#&*!|>'\"%@`")
|
|
100
|
+
#: Bare words YAML reads as a boolean or as nothing rather than as text.
|
|
101
|
+
_YAML_WORDS = frozenset(("true", "false", "yes", "no", "on", "off", "null", "~"))
|
|
102
|
+
#: Line breaks to YAML that JSON leaves as they are, escaped inside a quoted value.
|
|
103
|
+
_YAML_BREAKS = {"\x85": "\\u0085", "
": "\\u2028", "
": "\\u2029"}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _yaml_scalar(value: str) -> str:
|
|
107
|
+
"""``value`` as a one-line YAML scalar: bare when YAML reads it back as the
|
|
108
|
+
same text, double-quoted when it would read something else (a list, a
|
|
109
|
+
mapping, a comment) or nothing at all."""
|
|
110
|
+
plain = (
|
|
111
|
+
value == value.strip()
|
|
112
|
+
and value[:1] not in _YAML_INDICATORS
|
|
113
|
+
and ": " not in value
|
|
114
|
+
and " #" not in value
|
|
115
|
+
and not value.endswith(":")
|
|
116
|
+
and value.lower() not in _YAML_WORDS
|
|
117
|
+
and not any(ord(c) < 32 or c == "\x7f" or c in _YAML_BREAKS for c in value)
|
|
118
|
+
)
|
|
119
|
+
if plain and value:
|
|
120
|
+
return value
|
|
121
|
+
quoted = json.dumps(value, ensure_ascii=False) # a JSON string is a YAML one
|
|
122
|
+
for char, escape in _YAML_BREAKS.items():
|
|
123
|
+
quoted = quoted.replace(char, escape)
|
|
124
|
+
return quoted
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _yaml_text(scalar: str) -> str:
|
|
128
|
+
"""The text of a one-line scalar as :func:`_yaml_scalar` writes it. Anything
|
|
129
|
+
that is not one whole quoted string is its own text, which is how a value
|
|
130
|
+
this command wrote bare, before it quoted, still reads as it did."""
|
|
131
|
+
if len(scalar) >= 2 and scalar[0] == scalar[-1] == '"':
|
|
132
|
+
try:
|
|
133
|
+
value = json.loads(scalar)
|
|
134
|
+
except ValueError:
|
|
135
|
+
return scalar
|
|
136
|
+
return value if isinstance(value, str) else scalar
|
|
137
|
+
if len(scalar) >= 2 and scalar[0] == scalar[-1] == "'":
|
|
138
|
+
inner = scalar[1:-1]
|
|
139
|
+
if "'" not in inner.replace("''", ""):
|
|
140
|
+
return inner.replace("''", "'")
|
|
141
|
+
return scalar
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _requoted(block: str) -> str:
|
|
145
|
+
"""A frontmatter block with every bare value YAML would misread quoted.
|
|
146
|
+
A value that is already one quoted string, or reads back as itself, keeps
|
|
147
|
+
its line as it is; so do keys, order, line endings and any line that is
|
|
148
|
+
not ``key: value``."""
|
|
149
|
+
out = []
|
|
150
|
+
for line in block.splitlines(True):
|
|
151
|
+
text = line.rstrip("\r\n")
|
|
152
|
+
key, sep, value = text.partition(":")
|
|
153
|
+
bare = value.strip()
|
|
154
|
+
if sep and key.strip() and bare and _yaml_text(bare) == bare and _yaml_scalar(bare) != bare:
|
|
155
|
+
text = "%s: %s" % (key, _yaml_scalar(bare))
|
|
156
|
+
out.append(text + line[len(line.rstrip("\r\n")):])
|
|
157
|
+
return "".join(out)
|
|
158
|
+
|
|
159
|
+
|
|
93
160
|
def _today() -> str:
|
|
94
161
|
return datetime.date.today().isoformat()
|
|
95
162
|
|
|
@@ -153,7 +220,7 @@ class Finding:
|
|
|
153
220
|
for line in m.group(1).splitlines():
|
|
154
221
|
key, sep, value = line.partition(":")
|
|
155
222
|
if sep and key.strip():
|
|
156
|
-
meta[key.strip()] = value.strip()
|
|
223
|
+
meta[key.strip()] = _yaml_text(value.strip())
|
|
157
224
|
body = text[m.end():]
|
|
158
225
|
else:
|
|
159
226
|
body = text
|
|
@@ -178,10 +245,10 @@ class Finding:
|
|
|
178
245
|
lines = ["---"]
|
|
179
246
|
for key in _META_KEYS:
|
|
180
247
|
if self.meta.get(key):
|
|
181
|
-
lines.append("%s: %s" % (key, self.meta[key]))
|
|
248
|
+
lines.append("%s: %s" % (key, _yaml_scalar(self.meta[key])))
|
|
182
249
|
for key, value in self.meta.items():
|
|
183
250
|
if key not in _META_KEYS and value:
|
|
184
|
-
lines.append("%s: %s" % (key, value))
|
|
251
|
+
lines.append("%s: %s" % (key, _yaml_scalar(value)))
|
|
185
252
|
lines.append("---")
|
|
186
253
|
body = self.body.rstrip("\r\n")
|
|
187
254
|
return "\n".join(lines) + "\n\n" + (body + "\n" if body else "")
|
|
@@ -372,6 +439,26 @@ class FindingsStore:
|
|
|
372
439
|
self.write_index()
|
|
373
440
|
return path
|
|
374
441
|
|
|
442
|
+
def requote(self) -> "list[Path]":
|
|
443
|
+
"""Write again every frontmatter whose values are not in the form this
|
|
444
|
+
command writes now: a description an earlier version left bare where
|
|
445
|
+
YAML needs it quoted. Only those lines change; the body, the other
|
|
446
|
+
lines and the line endings stay byte for byte. Returns the files
|
|
447
|
+
changed."""
|
|
448
|
+
changed = []
|
|
449
|
+
for finding in self.all():
|
|
450
|
+
text = finding.path.read_bytes().decode("utf-8")
|
|
451
|
+
m = _FRONTMATTER_RE.match(text[1:] if text.startswith("") else text)
|
|
452
|
+
if not m:
|
|
453
|
+
continue
|
|
454
|
+
shift = 1 if text.startswith("") else 0
|
|
455
|
+
start, end = m.start(1) + shift, m.end(1) + shift
|
|
456
|
+
block = _requoted(text[start:end])
|
|
457
|
+
if block != text[start:end]:
|
|
458
|
+
write_text_lf(finding.path, text[:start] + block + text[end:])
|
|
459
|
+
changed.append(finding.path)
|
|
460
|
+
return changed
|
|
461
|
+
|
|
375
462
|
# -- index ---------------------------------------------------------------
|
|
376
463
|
|
|
377
464
|
def render_index(self) -> str:
|
|
@@ -605,12 +692,24 @@ class Findings(LoggingArgs, Cli):
|
|
|
605
692
|
return 0
|
|
606
693
|
|
|
607
694
|
class Index(_Base):
|
|
608
|
-
"""Regenerate INDEX.md from the files (after hand edits).
|
|
695
|
+
"""Regenerate INDEX.md from the files (after hand edits).
|
|
696
|
+
|
|
697
|
+
`--requote` first quotes any frontmatter value YAML cannot read as it
|
|
698
|
+
stands: what an earlier version wrote for a description opening with
|
|
699
|
+
`[` or a backtick, or holding `: `."""
|
|
609
700
|
|
|
610
701
|
_parsername_ = "index"
|
|
611
702
|
|
|
703
|
+
requote: bool = False
|
|
704
|
+
"Also quote frontmatter values YAML cannot read bare (bodies are not touched)."
|
|
705
|
+
("--requote",)
|
|
706
|
+
|
|
612
707
|
def __call__(self) -> int:
|
|
613
|
-
|
|
708
|
+
store = self.store()
|
|
709
|
+
if self.requote:
|
|
710
|
+
changed = store.requote()
|
|
711
|
+
self._logger_.info("requoted the frontmatter of %d finding(s)", len(changed))
|
|
712
|
+
_write_stdout("%s\n" % (store.write_index(),))
|
|
614
713
|
return 0
|
|
615
714
|
|
|
616
715
|
class PathCmd(_Base):
|
|
@@ -30,6 +30,8 @@ from pathlib import Path
|
|
|
30
30
|
|
|
31
31
|
import duho
|
|
32
32
|
from duho import Cli, LoggingArgs
|
|
33
|
+
from duho.runtime import build_command_parser
|
|
34
|
+
from duho.text import kebabcase
|
|
33
35
|
|
|
34
36
|
from dotagents import __version__
|
|
35
37
|
|
|
@@ -164,18 +166,7 @@ def _check_buildable(command) -> None:
|
|
|
164
166
|
fields claiming the same flag, a flag the umbrella already owns) would
|
|
165
167
|
otherwise fail every invocation. The parents are the umbrella's options,
|
|
166
168
|
as in `duho.app`, so a clash with them surfaces here too."""
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
base = Dotagents._parser_(add_help=False)
|
|
170
|
-
subparsers = argparse.ArgumentParser(add_help=False).add_subparsers()
|
|
171
|
-
if isinstance(command, type):
|
|
172
|
-
command._parser_(subparsers, parents=[base])
|
|
173
|
-
return
|
|
174
|
-
try:
|
|
175
|
-
from duho.runtime import _register_module_command
|
|
176
|
-
except ImportError: # pragma: no cover -- a later duho without this helper
|
|
177
|
-
return
|
|
178
|
-
_register_module_command(subparsers, command, base, None, Dotagents)
|
|
169
|
+
build_command_parser(command, Dotagents)
|
|
179
170
|
|
|
180
171
|
|
|
181
172
|
def _source_of(command) -> str:
|
|
@@ -207,18 +198,14 @@ def _buildable(commands, file=None) -> "list":
|
|
|
207
198
|
def kebab_name(class_name: str) -> str:
|
|
208
199
|
"""A command class's default subcommand name: ``LeakCheck`` ->
|
|
209
200
|
``leak-check``, ``HTTPServer`` -> ``http-server``, ``my_cmd`` -> ``my-cmd``."""
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
spaced = re.sub(r"(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])", "-", class_name)
|
|
213
|
-
return re.sub(r"[-_]+", "-", spaced).strip("-").lower()
|
|
201
|
+
return kebabcase(class_name)
|
|
214
202
|
|
|
215
203
|
|
|
216
204
|
def _named(commands) -> "list":
|
|
217
205
|
"""``commands``, each discovered class that declares no ``_parsername_``
|
|
218
|
-
of its own given the kebab-case of its class name (:func:`kebab_name`)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
which broke ``dotagents leak-check`` for a module that relied on it."""
|
|
206
|
+
of its own given the kebab-case of its class name (:func:`kebab_name`),
|
|
207
|
+
which is also the name duho gives it. Setting it makes the name readable as
|
|
208
|
+
an attribute, which the command-set keys and the tests rely on."""
|
|
222
209
|
for command in commands:
|
|
223
210
|
if isinstance(command, type) and "_parsername_" not in vars(command):
|
|
224
211
|
command._parsername_ = kebab_name(command.__name__)
|
|
@@ -228,46 +215,19 @@ def _named(commands) -> "list":
|
|
|
228
215
|
def _discover_modules(directory: Path) -> "list":
|
|
229
216
|
"""duho's per-directory discovery, made resilient per MODULE.
|
|
230
217
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
one
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
import; `_commands_in_module` has no public counterpart yet, so it stays
|
|
245
|
-
a private import (see `duho.discovery.import_from_path`'s own docstring:
|
|
246
|
-
it is the public counterpart of the `_unique_module_name` +
|
|
247
|
-
`_import_from_path` pair this module used to call directly)."""
|
|
248
|
-
try:
|
|
249
|
-
from duho.discovery import _commands_in_module, import_from_path
|
|
250
|
-
except ImportError: # pragma: no cover -- a later duho without these internals
|
|
251
|
-
from duho.discovery import discover_commands
|
|
252
|
-
|
|
253
|
-
_LOGGER.warning(
|
|
254
|
-
"duho's discovery internals moved; a broken module in %s now skips "
|
|
255
|
-
"the whole directory, not just itself",
|
|
256
|
-
directory,
|
|
257
|
-
)
|
|
258
|
-
return _named(_buildable(discover_commands(directory)))
|
|
259
|
-
commands = []
|
|
260
|
-
for file in sorted(directory.glob("*.py")):
|
|
261
|
-
if file.name.startswith("_"):
|
|
262
|
-
continue
|
|
263
|
-
try:
|
|
264
|
-
module = import_from_path("duho._discovered." + file.stem, file)
|
|
265
|
-
found = _commands_in_module(module, stem=file.stem)
|
|
266
|
-
except (Exception, SystemExit) as exc: # noqa: BLE001 -- see docstring
|
|
267
|
-
_LOGGER.warning("skipping command module %s: %s", file, _describe(exc))
|
|
268
|
-
continue
|
|
269
|
-
commands.extend(_named(_buildable(found, file)))
|
|
270
|
-
return commands
|
|
218
|
+
Discovery runs before EVERY dotagents invocation (including `env`/`context`
|
|
219
|
+
inside the SessionStart hooks), so one broken user module must not take
|
|
220
|
+
down every command. `on_error` is called for any exception raised importing
|
|
221
|
+
one file, `SystemExit` included (a module that `sys.exit()`s at import is
|
|
222
|
+
not an Exception): the bad module is named, with its exception, and skipped;
|
|
223
|
+
the rest of the directory still loads. A command that imports but cannot
|
|
224
|
+
build its parser is skipped the same way (`_buildable`)."""
|
|
225
|
+
|
|
226
|
+
def skip(source, exc) -> None:
|
|
227
|
+
_LOGGER.warning("skipping command module %s: %s", source, _describe(exc))
|
|
228
|
+
|
|
229
|
+
found = duho.discover_commands(directory, on_error=skip, sort=False)
|
|
230
|
+
return _named(_buildable(found))
|
|
271
231
|
|
|
272
232
|
|
|
273
233
|
def _discover_dir(source, by_name: dict) -> None:
|
|
@@ -522,13 +482,14 @@ def _repoint_zipapp_sources() -> None:
|
|
|
522
482
|
|
|
523
483
|
def main(argv=None) -> int:
|
|
524
484
|
_repoint_zipapp_sources()
|
|
525
|
-
# `duho.app` (not `duho.main`) so
|
|
526
|
-
#
|
|
527
|
-
#
|
|
528
|
-
return duho.
|
|
485
|
+
# `commands=` makes `run` use `duho.app` (not `duho.main`) so the resolved
|
|
486
|
+
# built-ins + discovered set are the commands; dispatch calls each command's
|
|
487
|
+
# `__call__`. `exit=False` returns the status, whatever ended the run.
|
|
488
|
+
return duho.run(
|
|
529
489
|
Dotagents,
|
|
490
|
+
argv,
|
|
491
|
+
exit=False,
|
|
530
492
|
commands=_discover(argv),
|
|
531
|
-
argv=argv,
|
|
532
493
|
name="dotagents",
|
|
533
494
|
)
|
|
534
495
|
|
|
@@ -73,7 +73,7 @@ class BuildPyz(LoggingArgs, Cmd):
|
|
|
73
73
|
# stale pin here ships an artifact `pip install dotagents-cli` would refuse.
|
|
74
74
|
# Pin the FLOOR of each declared range, not the latest patch -- the .pyz then
|
|
75
75
|
# exercises the minimum the metadata promises.
|
|
76
|
-
duho_version: str = "0.
|
|
76
|
+
duho_version: str = "0.7.5"
|
|
77
77
|
"Pinned duho version to vendor."
|
|
78
78
|
("--duho-version",)
|
|
79
79
|
|
|
@@ -130,7 +130,7 @@ def test_reinit_after_overlays_add_keeps_the_overlay_routing(tmp_path):
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
def test_init_with_an_unknown_agent_is_a_usage_error(tmp_path):
|
|
133
|
-
assert _main(["init", "--dest", str(tmp_path / "s"), "--agents", "claud", "--no-hooks"]) ==
|
|
133
|
+
assert _main(["init", "--dest", str(tmp_path / "s"), "--agents", "claud", "--no-hooks"]) == 1
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
# --------------------------------------------------------------------------
|
|
@@ -224,8 +224,7 @@ class LeakCheck(LoggingArgs, Cmd):
|
|
|
224
224
|
|
|
225
225
|
|
|
226
226
|
def test_a_command_without_parsername_gets_its_kebab_class_name(monkeypatch, tmp_path, capsys):
|
|
227
|
-
"""`_parsername_` is optional:
|
|
228
|
-
dotagents gives it `leak-check` (what duho < 0.6 derived)."""
|
|
227
|
+
"""`_parsername_` is optional: such a class is named `leak-check`."""
|
|
229
228
|
cmds = tmp_path / "extra"
|
|
230
229
|
_write(cmds / "leak_check.py", UNNAMED)
|
|
231
230
|
_write(cmds / "toy.py", TOY)
|
|
@@ -436,3 +435,17 @@ def test_a_module_failing_at_parser_build_does_not_take_the_cli_down(monkeypatch
|
|
|
436
435
|
except SystemExit as exc:
|
|
437
436
|
rc = exc.code
|
|
438
437
|
assert rc == 0
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
def test_a_directory_lists_its_commands_by_file_then_definition_order(tmp_path):
|
|
441
|
+
"""The `--help` listing follows the files, not the subcommand names."""
|
|
442
|
+
template = (
|
|
443
|
+
"from duho import Cmd, LoggingArgs\n\n"
|
|
444
|
+
"class {a}(LoggingArgs, Cmd):\n _parsername_ = '{a}'\n\n"
|
|
445
|
+
" def __call__(self) -> int:\n return 0\n\n"
|
|
446
|
+
"class {b}(LoggingArgs, Cmd):\n _parsername_ = '{b}'\n\n"
|
|
447
|
+
" def __call__(self) -> int:\n return 0\n"
|
|
448
|
+
)
|
|
449
|
+
_write(tmp_path / "aa_first.py", template.format(a="zulu", b="alpha"))
|
|
450
|
+
_write(tmp_path / "bb_second.py", template.format(a="mike", b="bravo"))
|
|
451
|
+
assert _names(cli._discover_modules(tmp_path)) == ["zulu", "alpha", "mike", "bravo"]
|
|
@@ -336,3 +336,84 @@ def test_a_finding_named_like_the_index_is_refused(findings_mod, tmp_path):
|
|
|
336
336
|
with pytest.raises(SystemExit, match="reserved"):
|
|
337
337
|
store.add(title, body="important details")
|
|
338
338
|
assert not root.exists() or not [p for p in root.iterdir() if p.suffix == ".md"]
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
# --------------------------------------------------------------------------- #
|
|
342
|
+
# The frontmatter is YAML another tool can read
|
|
343
|
+
# --------------------------------------------------------------------------- #
|
|
344
|
+
|
|
345
|
+
AWKWARD = [
|
|
346
|
+
"[low][correctness] off Linux, sniff with an interface name raises",
|
|
347
|
+
"`dotagents pyvenv` broken on the new machine",
|
|
348
|
+
"perf rule: two hosted-runner runs are not a before/after",
|
|
349
|
+
'"It compiles" is not evidence',
|
|
350
|
+
"'first', 'second' and a third",
|
|
351
|
+
'"quoted"',
|
|
352
|
+
"ends with a colon:",
|
|
353
|
+
"a marker # that starts a comment",
|
|
354
|
+
"*starred* and &anchored",
|
|
355
|
+
'a back\\slash and a "quote": both',
|
|
356
|
+
"- a leading dash",
|
|
357
|
+
"{braces} and a percent %",
|
|
358
|
+
"em dash — and an accent: é",
|
|
359
|
+
"true",
|
|
360
|
+
]
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
@pytest.mark.parametrize("text", AWKWARD)
|
|
364
|
+
def test_any_description_is_frontmatter_yaml_can_read(findings_mod, tmp_path, text):
|
|
365
|
+
yaml = pytest.importorskip("yaml")
|
|
366
|
+
store = findings_mod.FindingsStore(tmp_path / "findings")
|
|
367
|
+
finding = store.add(text, name="x")
|
|
368
|
+
front = yaml.safe_load(finding.path.read_text(encoding="utf-8").split("---\n")[1])
|
|
369
|
+
assert front["name"] == "x" and str(front["description"]) == text
|
|
370
|
+
assert findings_mod.Finding.load(finding.path).description == text
|
|
371
|
+
assert "— %s\n" % text in store.index_path.read_text(encoding="utf-8")
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def test_a_plain_description_is_written_bare(findings_mod, tmp_path):
|
|
375
|
+
store = findings_mod.FindingsStore(tmp_path / "findings")
|
|
376
|
+
text = "bare kb/X.md refs were never inlined (3 files, 2026-09-09)"
|
|
377
|
+
raw = store.add(text).path.read_text(encoding="utf-8")
|
|
378
|
+
assert "\ndescription: %s\n" % text in raw
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
@pytest.mark.parametrize("text", [
|
|
382
|
+
"[low][api] a consumer: rewrites `x`",
|
|
383
|
+
'"It compiles" is not evidence',
|
|
384
|
+
"'one', 'two'",
|
|
385
|
+
'"a" and "b"',
|
|
386
|
+
])
|
|
387
|
+
def test_a_finding_written_bare_still_reads_as_it_did(findings_mod, tmp_path, text):
|
|
388
|
+
"""What an earlier version wrote: the description as typed, whatever it held."""
|
|
389
|
+
path = tmp_path / "findings" / "old.md"
|
|
390
|
+
path.parent.mkdir(parents=True)
|
|
391
|
+
path.write_bytes(("---\nname: old\ndescription: %s\nstatus: active\n---\n\nbody\n" % text).encode("utf-8"))
|
|
392
|
+
assert findings_mod.Finding.load(path).description == text
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def test_index_requote_changes_only_the_values_yaml_cannot_read(findings_mod, tmp_path, capsys):
|
|
396
|
+
yaml = pytest.importorskip("yaml")
|
|
397
|
+
root = tmp_path / "findings"
|
|
398
|
+
(root / "processed").mkdir(parents=True)
|
|
399
|
+
bad = root / "processed" / "bad.md" # CRLF, odd spacing, blank lines: all kept
|
|
400
|
+
bad.write_bytes(b"---\r\nname: bad\r\ndescription: [low][api] a: b\r\nstatus: processed\r\n---\r\n\r\n\r\nbody kept \r\n\r\n\r\n")
|
|
401
|
+
kept = {
|
|
402
|
+
root / "quoted.md": b'---\nname: quoted\ndescription: "already: quoted"\n---\nbody\n',
|
|
403
|
+
root / "plain.md": b"---\nname: plain\ndescription: nothing to do\nextra: 1\n---\n\nbody\n",
|
|
404
|
+
root / "note.md": b"# a hand note\n\n---\nnot: [frontmatter\n---\n",
|
|
405
|
+
}
|
|
406
|
+
for path, data in kept.items():
|
|
407
|
+
path.write_bytes(data)
|
|
408
|
+
|
|
409
|
+
assert _run(findings_mod.Findings.Index, dir=root, requote=True) == 0
|
|
410
|
+
assert capsys.readouterr().out.strip() == str(root / "INDEX.md")
|
|
411
|
+
|
|
412
|
+
assert bad.read_bytes() == (
|
|
413
|
+
b'---\r\nname: bad\r\ndescription: "[low][api] a: b"\r\nstatus: processed\r\n---\r\n\r\n\r\nbody kept \r\n\r\n\r\n')
|
|
414
|
+
assert yaml.safe_load(bad.read_bytes().decode().split("---\r\n")[1])["description"] == "[low][api] a: b"
|
|
415
|
+
for path, data in kept.items():
|
|
416
|
+
assert path.read_bytes() == data, path.name
|
|
417
|
+
assert "— [low][api] a: b" in (root / "INDEX.md").read_text(encoding="utf-8")
|
|
418
|
+
# A second pass has nothing left to do.
|
|
419
|
+
assert findings_mod.FindingsStore(root).requote() == []
|
|
@@ -211,31 +211,6 @@ def test_a_command_clashing_with_an_umbrella_flag_is_skipped(monkeypatch, tmp_pa
|
|
|
211
211
|
assert cli.main(["about"]) == 0
|
|
212
212
|
|
|
213
213
|
|
|
214
|
-
def test_moved_duho_internals_are_reported_not_silent(monkeypatch, tmp_path, caplog):
|
|
215
|
-
import builtins
|
|
216
|
-
|
|
217
|
-
cmds = tmp_path / "cmds"
|
|
218
|
-
cmds.mkdir()
|
|
219
|
-
(cmds / "good.py").write_text(GOOD, encoding="utf-8")
|
|
220
|
-
real_import = builtins.__import__
|
|
221
|
-
|
|
222
|
-
def renamed(name, globals=None, locals=None, fromlist=(), level=0):
|
|
223
|
-
# What a duho release that renamed its remaining private helper looks
|
|
224
|
-
# like to `from duho.discovery import _commands_in_module, ...` --
|
|
225
|
-
# and only to it. `import_from_path` is duho's public counterpart
|
|
226
|
-
# (duho >= 0.6.0) and stays importable; `_commands_in_module` has no
|
|
227
|
-
# public counterpart yet, so it is the one still exposed to this risk.
|
|
228
|
-
if name == "duho.discovery" and "_commands_in_module" in (fromlist or ()):
|
|
229
|
-
raise ImportError("cannot import name '_commands_in_module'")
|
|
230
|
-
return real_import(name, globals, locals, fromlist, level)
|
|
231
|
-
|
|
232
|
-
monkeypatch.setattr(builtins, "__import__", renamed)
|
|
233
|
-
with caplog.at_level(logging.WARNING):
|
|
234
|
-
commands = cli._discover_modules(cmds)
|
|
235
|
-
assert "good" in _names(commands)
|
|
236
|
-
assert any("internals moved" in r.getMessage() for r in caplog.records)
|
|
237
|
-
|
|
238
|
-
|
|
239
214
|
# --------------------------------------------------------------------------- #
|
|
240
215
|
# The zipapp-repointed module list is derived, not hand-kept
|
|
241
216
|
# --------------------------------------------------------------------------- #
|
|
@@ -246,16 +246,15 @@ def test_a_bom_in_settings_json_is_accepted_and_not_written_back(tmp_path):
|
|
|
246
246
|
|
|
247
247
|
|
|
248
248
|
@pytest.mark.parametrize("content", [b"{not json", b"\xff\xfe{}"])
|
|
249
|
-
def test_a_corrupt_settings_file_stops_init_before_anything_is_written(content):
|
|
249
|
+
def test_a_corrupt_settings_file_stops_init_before_anything_is_written(content, capsys):
|
|
250
250
|
"""The error fired after AGENTS.md and the CLAUDE.md include were written,
|
|
251
251
|
leaving a half-initialised store."""
|
|
252
252
|
settings = Path.home() / ".claude" / "settings.json"
|
|
253
253
|
settings.parent.mkdir(parents=True)
|
|
254
254
|
settings.write_bytes(content)
|
|
255
255
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
assert str(settings) in str(exc.value)
|
|
256
|
+
assert cli.main(["init", "-g", "--agents", "claude"]) == 1
|
|
257
|
+
assert str(settings) in capsys.readouterr().err
|
|
259
258
|
assert not (Path.home() / ".agents").exists()
|
|
260
259
|
assert not (Path.home() / ".claude" / "CLAUDE.md").exists()
|
|
261
260
|
assert settings.read_bytes() == content
|
|
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
|
{dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/templates/AGENTS.md
RENAMED
|
File without changes
|
{dotagents_cli-0.7.3 → dotagents_cli-0.7.5}/src/dotagents/_overlay/dotagents/templates/PROJECT.md
RENAMED
|
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
|