recx-cli 0.0.2__tar.gz → 0.0.3__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 (38) hide show
  1. recx_cli-0.0.3/PKG-INFO +98 -0
  2. recx_cli-0.0.3/README.md +84 -0
  3. {recx_cli-0.0.2 → recx_cli-0.0.3}/pyproject.toml +1 -1
  4. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/SPEC.md +5 -5
  5. {recx_cli-0.0.2 → recx_cli-0.0.3}/src/recx_cli/cli.py +21 -1
  6. recx_cli-0.0.3/src/recx_cli/evidence.py +77 -0
  7. {recx_cli-0.0.2 → recx_cli-0.0.3}/tests/test_check.py +3 -2
  8. recx_cli-0.0.3/tests/test_evidence.py +137 -0
  9. recx_cli-0.0.2/PKG-INFO +0 -57
  10. recx_cli-0.0.2/README.md +0 -43
  11. {recx_cli-0.0.2 → recx_cli-0.0.3}/.gitignore +0 -0
  12. {recx_cli-0.0.2 → recx_cli-0.0.3}/LICENSE +0 -0
  13. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/evidence-without-run.yaml +0 -0
  14. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/extension-value-not-scalar.yaml +0 -0
  15. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/http-url.yaml +0 -0
  16. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/license-not-permissive.yaml +0 -0
  17. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/missing-capabilities.yaml +0 -0
  18. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/multiline-summary.yaml +0 -0
  19. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/package-without-purl.yaml +0 -0
  20. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/path-escapes-repo.yaml +0 -0
  21. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/unknown-key.yaml +0 -0
  22. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid/unknown-version.yaml +0 -0
  23. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid-rules/rule1-duplicate-evidence-id.yaml +0 -0
  24. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid-rules/rule1-duplicate-module-id.yaml +0 -0
  25. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid-rules/rule2-covers-unknown-module.yaml +0 -0
  26. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid-rules/rule2-requires-unknown-module.yaml +0 -0
  27. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid-rules/rule5-over-64-kib.yaml +0 -0
  28. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid-rules/rule6-anchor-alias.yaml +0 -0
  29. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid-rules/rule6-duplicate-key.yaml +0 -0
  30. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/invalid-rules/rule6-merge-key.yaml +0 -0
  31. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/valid/full.yaml +0 -0
  32. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/examples/valid/minimal.yaml +0 -0
  33. {recx_cli-0.0.2 → recx_cli-0.0.3}/spec/recx.schema.json +0 -0
  34. {recx_cli-0.0.2 → recx_cli-0.0.3}/src/recx_cli/__init__.py +0 -0
  35. {recx_cli-0.0.2 → recx_cli-0.0.3}/src/recx_cli/__main__.py +0 -0
  36. {recx_cli-0.0.2 → recx_cli-0.0.3}/src/recx_cli/check.py +0 -0
  37. {recx_cli-0.0.2 → recx_cli-0.0.3}/src/recx_cli/hook.py +0 -0
  38. {recx_cli-0.0.2 → recx_cli-0.0.3}/tests/test_hook.py +0 -0
@@ -0,0 +1,98 @@
1
+ Metadata-Version: 2.5
2
+ Name: recx-cli
3
+ Version: 0.0.3
4
+ Summary: Validator for RECX.yaml manifests: the recx check command.
5
+ Project-URL: Homepage, https://github.com/jbmv/recx
6
+ Project-URL: Repository, https://github.com/jbmv/recx
7
+ Author: James Bullard
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: jsonschema[format-nongpl]>=4.18
12
+ Requires-Dist: pyyaml>=6
13
+ Description-Content-Type: text/markdown
14
+
15
+ # recx
16
+
17
+ *res extra commercium*: things outside commerce. A way for agents to find reusable, permissively
18
+ licensed code from solo and small-team projects.
19
+
20
+ A `RECX.yaml` at the root of a repository tells other people's coding agents what the repository
21
+ does, which parts of it they can take on their own, and which checks show those parts work. recx
22
+ is that format, a validator for it, and a Claude Code plugin that keeps the file current.
23
+
24
+ ## Why
25
+
26
+ Coding agents have increased the amount of software that individuals and small teams produce.
27
+ Much of it remains internal tooling, and the projects that are published are hard to find among
28
+ the number of new repositories. Evaluating an unfamiliar open-source project also takes time, so
29
+ writing a similar tool is often the quicker option, and comparable tools get written more than
30
+ once.
31
+
32
+ recx moves that search and evaluation to the agent doing the work, in two parts. The first is
33
+ the manifest: a `RECX.yaml` in each participating repository that describes the project's
34
+ capabilities, its separable modules and their interfaces, and the commands that verify them, in
35
+ a fixed machine-readable form. The second is search: a way for an agent, while planning new
36
+ work, to find manifests with relevant modules, check their evidence, and reuse a module rather
37
+ than write it again, recording where it came from in its own project's manifest.
38
+
39
+ Taking part is meant to cost a repository little. One prompt produces a complete, valid
40
+ manifest, and the Claude Code plugin checks it whenever a session ends, so it stays valid as
41
+ the code changes. No hosted service is involved, because the fixed filename serves as the index.
42
+ On GitHub, manifests can be found by searching code for `path:/(^|\/)recx\.ya?ml$/i`.
43
+
44
+ ## The manifest
45
+
46
+ ```yaml
47
+ recx: "0.1"
48
+ name: tinyfmt
49
+ summary: Formats byte counts as human-readable strings like 1.2 MB.
50
+ license: MIT
51
+ status: stable
52
+ capabilities:
53
+ - format a byte count as a human-readable size string
54
+ ```
55
+
56
+ Those six keys are the minimum. The optional parts carry most of the information: modules with
57
+ interfaces and extraction notes, evidence anyone can rerun, and records of what was reused from
58
+ where. [spec/SPEC.md](spec/SPEC.md) defines every field, puts a length limit on every string,
59
+ and sets out how to read a stranger's manifest safely.
60
+
61
+ Only permissively licensed projects qualify (MIT, Apache-2.0, the BSDs and similar), so
62
+ anything listed can be reused without asking.
63
+
64
+ ## Get started
65
+
66
+ - **Claude Code:** `/plugin marketplace add jbmv/recx`, then `/plugin install recx@recx`
67
+ (or, on Claude Code 2.1.275 or later, `/plugin install recx --marketplace jbmv/recx`). Then
68
+ ask Claude to add a RECX.yaml. A Stop hook keeps the manifest valid; set
69
+ `RECX_STOP_HOOK=warn` or `off` to soften or disable it.
70
+ - **Any other agent:** paste the prompt in [ADOPT.md](ADOPT.md).
71
+ - **By hand:** start from the example above, then run `uvx --from recx-cli recx check`.
72
+
73
+ ## What's here
74
+
75
+ | | |
76
+ |---|---|
77
+ | [spec/](spec/) | The spec, its JSON Schema, and valid and invalid example manifests |
78
+ | `recx-cli` on PyPI | `recx check`, the validator (`pip install recx-cli`) |
79
+ | `@jbmv/recx` on npm | The schema and examples, for JavaScript tooling |
80
+ | [plugin/](plugin/) | The Claude Code plugin; this repository is its marketplace |
81
+ | [RECX.yaml](RECX.yaml) | recx's own manifest |
82
+
83
+ ## Status
84
+
85
+ Experimental. The spec is a v0.1 draft and may change before 1.0; every manifest states the
86
+ version it was written against. `recx check` enforces the whole spec except rule 4, that the
87
+ license file matches `license`. The manifest, the validator and the plugin exist; search, the
88
+ second part described above, is not built yet.
89
+
90
+ ## Kyosei
91
+
92
+ I built recx for Kyosei, a record-keeping tool for running projects with coding agents. Kyosei
93
+ isn't public yet. It will generate its own RECX.yaml from its records. Nothing in the spec
94
+ depends on Kyosei: it is one client of the spec, like any other tool.
95
+
96
+ ## License
97
+
98
+ MIT
@@ -0,0 +1,84 @@
1
+ # recx
2
+
3
+ *res extra commercium*: things outside commerce. A way for agents to find reusable, permissively
4
+ licensed code from solo and small-team projects.
5
+
6
+ A `RECX.yaml` at the root of a repository tells other people's coding agents what the repository
7
+ does, which parts of it they can take on their own, and which checks show those parts work. recx
8
+ is that format, a validator for it, and a Claude Code plugin that keeps the file current.
9
+
10
+ ## Why
11
+
12
+ Coding agents have increased the amount of software that individuals and small teams produce.
13
+ Much of it remains internal tooling, and the projects that are published are hard to find among
14
+ the number of new repositories. Evaluating an unfamiliar open-source project also takes time, so
15
+ writing a similar tool is often the quicker option, and comparable tools get written more than
16
+ once.
17
+
18
+ recx moves that search and evaluation to the agent doing the work, in two parts. The first is
19
+ the manifest: a `RECX.yaml` in each participating repository that describes the project's
20
+ capabilities, its separable modules and their interfaces, and the commands that verify them, in
21
+ a fixed machine-readable form. The second is search: a way for an agent, while planning new
22
+ work, to find manifests with relevant modules, check their evidence, and reuse a module rather
23
+ than write it again, recording where it came from in its own project's manifest.
24
+
25
+ Taking part is meant to cost a repository little. One prompt produces a complete, valid
26
+ manifest, and the Claude Code plugin checks it whenever a session ends, so it stays valid as
27
+ the code changes. No hosted service is involved, because the fixed filename serves as the index.
28
+ On GitHub, manifests can be found by searching code for `path:/(^|\/)recx\.ya?ml$/i`.
29
+
30
+ ## The manifest
31
+
32
+ ```yaml
33
+ recx: "0.1"
34
+ name: tinyfmt
35
+ summary: Formats byte counts as human-readable strings like 1.2 MB.
36
+ license: MIT
37
+ status: stable
38
+ capabilities:
39
+ - format a byte count as a human-readable size string
40
+ ```
41
+
42
+ Those six keys are the minimum. The optional parts carry most of the information: modules with
43
+ interfaces and extraction notes, evidence anyone can rerun, and records of what was reused from
44
+ where. [spec/SPEC.md](spec/SPEC.md) defines every field, puts a length limit on every string,
45
+ and sets out how to read a stranger's manifest safely.
46
+
47
+ Only permissively licensed projects qualify (MIT, Apache-2.0, the BSDs and similar), so
48
+ anything listed can be reused without asking.
49
+
50
+ ## Get started
51
+
52
+ - **Claude Code:** `/plugin marketplace add jbmv/recx`, then `/plugin install recx@recx`
53
+ (or, on Claude Code 2.1.275 or later, `/plugin install recx --marketplace jbmv/recx`). Then
54
+ ask Claude to add a RECX.yaml. A Stop hook keeps the manifest valid; set
55
+ `RECX_STOP_HOOK=warn` or `off` to soften or disable it.
56
+ - **Any other agent:** paste the prompt in [ADOPT.md](ADOPT.md).
57
+ - **By hand:** start from the example above, then run `uvx --from recx-cli recx check`.
58
+
59
+ ## What's here
60
+
61
+ | | |
62
+ |---|---|
63
+ | [spec/](spec/) | The spec, its JSON Schema, and valid and invalid example manifests |
64
+ | `recx-cli` on PyPI | `recx check`, the validator (`pip install recx-cli`) |
65
+ | `@jbmv/recx` on npm | The schema and examples, for JavaScript tooling |
66
+ | [plugin/](plugin/) | The Claude Code plugin; this repository is its marketplace |
67
+ | [RECX.yaml](RECX.yaml) | recx's own manifest |
68
+
69
+ ## Status
70
+
71
+ Experimental. The spec is a v0.1 draft and may change before 1.0; every manifest states the
72
+ version it was written against. `recx check` enforces the whole spec except rule 4, that the
73
+ license file matches `license`. The manifest, the validator and the plugin exist; search, the
74
+ second part described above, is not built yet.
75
+
76
+ ## Kyosei
77
+
78
+ I built recx for Kyosei, a record-keeping tool for running projects with coding agents. Kyosei
79
+ isn't public yet. It will generate its own RECX.yaml from its records. Nothing in the spec
80
+ depends on Kyosei: it is one client of the spec, like any other tool.
81
+
82
+ ## License
83
+
84
+ MIT
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "recx-cli"
7
- version = "0.0.2"
7
+ version = "0.0.3"
8
8
  description = "Validator for RECX.yaml manifests: the recx check command."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -7,11 +7,11 @@ written against, so a change never silently reinterprets an old file.
7
7
 
8
8
  ## Purpose
9
9
 
10
- A great deal of permissively licensed code is being written by people working alone, and much
11
- of it is never read. recx assumes the reader that will look is another person's coding agent,
12
- and gives it something to read. `RECX.yaml` says what a repository does, which of its parts can
13
- be taken on their own, how to take them, and which checks anyone can rerun to see that they
14
- work.
10
+ recx is meant to let coding agents find and evaluate reusable code from solo and small-team
11
+ projects, which are otherwise difficult to discover among the volume of new repositories.
12
+ `RECX.yaml` states, in a fixed machine-readable form, what a repository does, which of its parts
13
+ can be taken on their own, how to take them, and which checks anyone can rerun to confirm that
14
+ they work.
15
15
 
16
16
  It complements `AGENTS.md` rather than replacing it. `AGENTS.md` tells an agent how to work
17
17
  *inside* a repository. `RECX.yaml` tells an agent working somewhere else what it can take
@@ -1,4 +1,4 @@
1
- """Command line: `recx check [PATH] [--no-repo]`."""
1
+ """Command line: `recx check`, `recx evidence`, `recx hook stop`."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
@@ -8,6 +8,8 @@ from importlib import metadata
8
8
  from pathlib import Path
9
9
 
10
10
  from recx_cli.check import Unreadable, check_file, format_problem
11
+ from recx_cli.evidence import HELP as EVIDENCE_HELP
12
+ from recx_cli.evidence import evidence
11
13
 
12
14
 
13
15
  def _version() -> str:
@@ -45,6 +47,22 @@ def build_parser() -> argparse.ArgumentParser:
45
47
  action="store_true",
46
48
  help="skip the checks that look at the repository (rule 3: module paths exist)",
47
49
  )
50
+ ev = sub.add_parser(
51
+ "evidence",
52
+ help="run a manifest's evidence commands (your own repository or a sandbox only)",
53
+ description=EVIDENCE_HELP,
54
+ )
55
+ ev.add_argument(
56
+ "path",
57
+ nargs="?",
58
+ default="RECX.yaml",
59
+ metavar="PATH",
60
+ help="a manifest file, or a directory holding RECX.yaml (default: ./RECX.yaml)",
61
+ )
62
+ ev.add_argument(
63
+ "--list", action="store_true", help="print each selected entry's commands without running anything"
64
+ )
65
+ ev.add_argument("--only", nargs="+", metavar="ID", help="run only the named evidence entries")
48
66
  hook = sub.add_parser(
49
67
  "hook",
50
68
  help="entry points for Claude Code hooks",
@@ -67,6 +85,8 @@ def main(argv: list[str] | None = None) -> int:
67
85
  from recx_cli.hook import stop
68
86
 
69
87
  return stop()
88
+ if args.command == "evidence":
89
+ return evidence(args.path, args.list, args.only)
70
90
  target = Path(args.path)
71
91
  if target.is_dir():
72
92
  target = target / "RECX.yaml"
@@ -0,0 +1,77 @@
1
+ """`recx evidence`: run a manifest's own evidence commands, in the repository owner's CI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import subprocess
6
+ import sys
7
+ import time
8
+ from pathlib import Path
9
+
10
+ from recx_cli.check import Unreadable, check_file, format_problem, parse
11
+
12
+ HELP = (
13
+ "Run each evidence entry's setup and run commands (sh -c, from the manifest's directory, "
14
+ "with your environment) and report pass or fail. This runs the manifest's commands: use it "
15
+ "on your own repository or inside a sandbox, never on a stranger's manifest outside one "
16
+ "(SPEC, Trust). The manifest must pass `recx check` first. "
17
+ "Exit status: 0 all selected entries passed, 1 an entry failed or the manifest is invalid, "
18
+ "2 usage error or unreadable file."
19
+ )
20
+
21
+
22
+ def _run(command: str, cwd: Path) -> int:
23
+ sys.stdout.flush()
24
+ sys.stderr.flush()
25
+ return subprocess.run(["sh", "-c", command], cwd=cwd).returncode
26
+
27
+
28
+ def evidence(path: str, list_only: bool = False, only: list[str] | None = None) -> int:
29
+ target = Path(path)
30
+ if target.is_dir():
31
+ target = target / "RECX.yaml"
32
+ label = str(target)
33
+ try:
34
+ problems = check_file(target, repo=True)
35
+ except Unreadable as exc:
36
+ print(f"{label}: cannot read: {exc}", file=sys.stderr)
37
+ return 2
38
+ if problems:
39
+ for p in problems:
40
+ print(format_problem(label, p))
41
+ return 1
42
+ entries = parse(target.read_text(encoding="utf-8")).get("evidence") or []
43
+ if only:
44
+ known = [e["id"] for e in entries]
45
+ unknown = [i for i in only if i not in known]
46
+ if unknown:
47
+ print(
48
+ f"recx evidence: no evidence entry with id {', '.join(unknown)} "
49
+ f"(known: {', '.join(known) or 'none'})",
50
+ file=sys.stderr,
51
+ )
52
+ return 2
53
+ entries = [e for e in entries if e["id"] in only]
54
+ if list_only:
55
+ for e in entries:
56
+ print(e["id"])
57
+ if "setup" in e:
58
+ print(f" setup: {e['setup']}")
59
+ print(f" run: {e['run']}")
60
+ return 0
61
+ cwd = target.resolve().parent
62
+ failed = False
63
+ for e in entries:
64
+ start = time.monotonic()
65
+ code = 0
66
+ for step in ("setup", "run"):
67
+ if step in e:
68
+ code = _run(e[step], cwd)
69
+ if code != 0:
70
+ break
71
+ secs = f"{time.monotonic() - start:.1f}s"
72
+ if code == 0:
73
+ print(f"{e['id']}: pass ({secs})", flush=True)
74
+ else:
75
+ failed = True
76
+ print(f"{e['id']}: fail ({secs}, exit {code})", flush=True)
77
+ return 1 if failed else 0
@@ -238,8 +238,9 @@ def test_build_produces_sdist_and_wheel(tmp_path):
238
238
  out = tmp_path / "dist"
239
239
  env = {k: v for k, v in __import__("os").environ.items() if k != "VIRTUAL_ENV"}
240
240
  subprocess.run(["uv", "build", "--out-dir", str(out)], cwd=ROOT, check=True, capture_output=True, env=env)
241
- wheels = list(out.glob("recx_cli-0.0.2-*.whl"))
242
- sdists = list(out.glob("recx_cli-0.0.2.tar.gz"))
241
+ version = __import__("tomllib").loads((ROOT / "pyproject.toml").read_text())["project"]["version"]
242
+ wheels = list(out.glob(f"recx_cli-{version}-*.whl"))
243
+ sdists = list(out.glob(f"recx_cli-{version}.tar.gz"))
243
244
  assert len(wheels) == 1 and len(sdists) == 1
244
245
  with zipfile.ZipFile(wheels[0]) as z:
245
246
  names = z.namelist()
@@ -0,0 +1,137 @@
1
+ import re
2
+
3
+ from recx_cli.cli import main
4
+
5
+ HEAD = """recx: "0.1"
6
+ name: example
7
+ summary: An example project.
8
+ license: MIT
9
+ status: experimental
10
+ capabilities:
11
+ - do a thing
12
+ modules:
13
+ - id: m
14
+ path: RECX.yaml
15
+ summary: The manifest.
16
+ interface:
17
+ type: other
18
+ entrypoints: ["x"]
19
+ extract:
20
+ method: copy
21
+ evidence:
22
+ """
23
+
24
+
25
+ def manifest(tmp_path, body):
26
+ body = body.replace(" summary: s\n", " summary: s\n covers: [m]\n")
27
+ (tmp_path / "RECX.yaml").write_text(HEAD + body)
28
+ return tmp_path
29
+
30
+
31
+ def run(capsys, *argv):
32
+ code = main(list(argv))
33
+ out = capsys.readouterr()
34
+ return code, out.out, out.err
35
+
36
+
37
+ def test_runs_setup_then_run_in_order_from_manifest_dir(tmp_path, capsys, monkeypatch):
38
+ d = manifest(
39
+ tmp_path,
40
+ " - id: first\n summary: s\n setup: echo setup >> log\n run: echo first >> log\n"
41
+ " - id: second\n summary: s\n run: echo second >> log\n",
42
+ )
43
+ monkeypatch.chdir(tmp_path.parent) # not the manifest dir
44
+ code, out, _ = run(capsys, "evidence", str(d))
45
+ assert code == 0
46
+ assert (d / "log").read_text().split() == ["setup", "first", "second"]
47
+ lines = out.strip().splitlines()
48
+ assert re.fullmatch(r"first: pass \(\d+\.\d+s\)", lines[0])
49
+ assert re.fullmatch(r"second: pass \(\d+\.\d+s\)", lines[1])
50
+
51
+
52
+ def test_command_output_streams_through(tmp_path, capfd):
53
+ d = manifest(tmp_path, " - id: a\n summary: s\n run: echo hello-from-child\n")
54
+ assert main(["evidence", str(d)]) == 0
55
+ assert "hello-from-child" in capfd.readouterr().out
56
+
57
+
58
+ def test_failure_reports_exit_code_and_exits_1(tmp_path, capsys):
59
+ d = manifest(
60
+ tmp_path,
61
+ " - id: bad\n summary: s\n run: exit 3\n"
62
+ " - id: good\n summary: s\n run: 'true'\n",
63
+ )
64
+ code, out, _ = run(capsys, "evidence", str(d / "RECX.yaml"))
65
+ assert code == 1
66
+ lines = out.strip().splitlines()
67
+ assert re.fullmatch(r"bad: fail \(\d+\.\d+s, exit 3\)", lines[0])
68
+ assert lines[1].startswith("good: pass")
69
+
70
+
71
+ def test_failed_setup_skips_run(tmp_path, capsys):
72
+ d = manifest(
73
+ tmp_path,
74
+ " - id: a\n summary: s\n setup: exit 4\n run: touch ran\n",
75
+ )
76
+ code, out, _ = run(capsys, "evidence", str(d))
77
+ assert code == 1
78
+ assert "a: fail" in out and "exit 4" in out
79
+ assert not (d / "ran").exists()
80
+
81
+
82
+ def test_list_prints_commands_and_runs_nothing(tmp_path, capsys):
83
+ d = manifest(
84
+ tmp_path,
85
+ " - id: a\n summary: s\n setup: touch ran\n run: touch ran2\n",
86
+ )
87
+ code, out, _ = run(capsys, "evidence", str(d), "--list")
88
+ assert code == 0
89
+ assert "a" in out and "setup: touch ran" in out and "run: touch ran2" in out
90
+ assert not (d / "ran").exists() and not (d / "ran2").exists()
91
+
92
+
93
+ def test_only_selects_entries(tmp_path, capsys):
94
+ d = manifest(
95
+ tmp_path,
96
+ " - id: a\n summary: s\n run: touch a\n"
97
+ " - id: b\n summary: s\n run: touch b\n"
98
+ " - id: c\n summary: s\n run: touch c\n",
99
+ )
100
+ code, out, _ = run(capsys, "evidence", str(d), "--only", "c", "a")
101
+ assert code == 0
102
+ assert (d / "a").exists() and (d / "c").exists() and not (d / "b").exists()
103
+ assert [l.split(":")[0] for l in out.strip().splitlines()] == ["a", "c"]
104
+ code, out, _ = run(capsys, "evidence", str(d), "--list", "--only", "b")
105
+ assert out.splitlines()[0] == "b" and "a" not in out.split()
106
+
107
+
108
+ def test_unknown_only_id_is_usage_error(tmp_path, capsys):
109
+ d = manifest(tmp_path, " - id: a\n summary: s\n run: touch a\n")
110
+ code, _, err = run(capsys, "evidence", str(d), "--only", "nope")
111
+ assert code == 2 and "nope" in err
112
+ assert not (d / "a").exists()
113
+
114
+
115
+ def test_unreadable_file_is_usage_error(tmp_path, capsys):
116
+ code, _, err = run(capsys, "evidence", str(tmp_path / "missing.yaml"))
117
+ assert code == 2 and "cannot read" in err
118
+
119
+
120
+ def test_invalid_manifest_refuses_and_runs_nothing(tmp_path, capsys):
121
+ d = manifest(
122
+ tmp_path,
123
+ " - id: a\n summary: s\n run: touch ran\n bogus_field: 1\n",
124
+ )
125
+ code, out, _ = run(capsys, "evidence", str(d))
126
+ assert code == 1
127
+ assert "bogus_field" in out and "pass" not in out
128
+ assert not (d / "ran").exists()
129
+
130
+
131
+ def test_help_warns_about_strangers(capsys):
132
+ try:
133
+ main(["evidence", "--help"])
134
+ except SystemExit:
135
+ pass
136
+ out = capsys.readouterr().out
137
+ assert "your own repository or inside a sandbox" in " ".join(out.split())
recx_cli-0.0.2/PKG-INFO DELETED
@@ -1,57 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: recx-cli
3
- Version: 0.0.2
4
- Summary: Validator for RECX.yaml manifests: the recx check command.
5
- Project-URL: Homepage, https://github.com/jbmv/recx
6
- Project-URL: Repository, https://github.com/jbmv/recx
7
- Author: James Bullard
8
- License-Expression: MIT
9
- License-File: LICENSE
10
- Requires-Python: >=3.10
11
- Requires-Dist: jsonschema[format-nongpl]>=4.18
12
- Requires-Dist: pyyaml>=6
13
- Description-Content-Type: text/markdown
14
-
15
- # recx
16
-
17
- *res extra commercium*: things outside commerce. A repository drops a `RECX.yaml` at its
18
- root to tell other people's coding agents what it does, which of its modules can be taken on
19
- their own, how to take them, and which checks anyone can rerun to see that they work.
20
-
21
- The format is specified in [spec/SPEC.md](spec/SPEC.md); the schema is
22
- [spec/recx.schema.json](spec/recx.schema.json).
23
-
24
- ## Checking a manifest
25
-
26
- ```sh
27
- pip install recx-cli # or: uvx --from recx-cli recx check
28
-
29
- recx check # ./RECX.yaml, including that module paths exist
30
- recx check path/to/repo # a directory holding RECX.yaml
31
- recx check --no-repo FILE # the file alone, without looking at the repository
32
- ```
33
-
34
- One line per problem, `<file>: <json-pointer>: <message>`, or `<file>: valid`. Exit status 0
35
- means valid, 1 invalid, 2 a usage error or an unreadable file. `recx check` does not yet
36
- check that the license file agrees with `license` (rule 4 of the spec).
37
-
38
- ## The Claude Code plugin
39
-
40
- The `recx` plugin adds the `/recx:manifest` skill, for writing and maintaining a `RECX.yaml`,
41
- and a Stop hook that keeps the manifest valid as a session ends.
42
-
43
- ```
44
- /plugin marketplace add jbmv/recx
45
- /plugin install recx@recx
46
- ```
47
-
48
- On Claude Code 2.1.275 or later, `/plugin install recx --marketplace jbmv/recx` does both in one
49
- step. The hook runs `recx hook stop`, from `recx` on your PATH or else through `uvx`; it needs
50
- recx-cli 0.0.2 or later, and a missing `recx` never blocks a session. `RECX_STOP_HOOK` sets it:
51
- `block` (the default), `warn` for feedback only, or `off`.
52
-
53
- To adopt recx in a repository with any coding agent, see [ADOPT.md](ADOPT.md).
54
-
55
- The npm package `@jbmv/recx` ships the schema: `require('@jbmv/recx')` returns it.
56
-
57
- This README is an interim one. The full README is still to come.
recx_cli-0.0.2/README.md DELETED
@@ -1,43 +0,0 @@
1
- # recx
2
-
3
- *res extra commercium*: things outside commerce. A repository drops a `RECX.yaml` at its
4
- root to tell other people's coding agents what it does, which of its modules can be taken on
5
- their own, how to take them, and which checks anyone can rerun to see that they work.
6
-
7
- The format is specified in [spec/SPEC.md](spec/SPEC.md); the schema is
8
- [spec/recx.schema.json](spec/recx.schema.json).
9
-
10
- ## Checking a manifest
11
-
12
- ```sh
13
- pip install recx-cli # or: uvx --from recx-cli recx check
14
-
15
- recx check # ./RECX.yaml, including that module paths exist
16
- recx check path/to/repo # a directory holding RECX.yaml
17
- recx check --no-repo FILE # the file alone, without looking at the repository
18
- ```
19
-
20
- One line per problem, `<file>: <json-pointer>: <message>`, or `<file>: valid`. Exit status 0
21
- means valid, 1 invalid, 2 a usage error or an unreadable file. `recx check` does not yet
22
- check that the license file agrees with `license` (rule 4 of the spec).
23
-
24
- ## The Claude Code plugin
25
-
26
- The `recx` plugin adds the `/recx:manifest` skill, for writing and maintaining a `RECX.yaml`,
27
- and a Stop hook that keeps the manifest valid as a session ends.
28
-
29
- ```
30
- /plugin marketplace add jbmv/recx
31
- /plugin install recx@recx
32
- ```
33
-
34
- On Claude Code 2.1.275 or later, `/plugin install recx --marketplace jbmv/recx` does both in one
35
- step. The hook runs `recx hook stop`, from `recx` on your PATH or else through `uvx`; it needs
36
- recx-cli 0.0.2 or later, and a missing `recx` never blocks a session. `RECX_STOP_HOOK` sets it:
37
- `block` (the default), `warn` for feedback only, or `off`.
38
-
39
- To adopt recx in a repository with any coding agent, see [ADOPT.md](ADOPT.md).
40
-
41
- The npm package `@jbmv/recx` ships the schema: `require('@jbmv/recx')` returns it.
42
-
43
- This README is an interim one. The full README is still to come.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes