edify-agents-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.
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/.gitignore +7 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/CHANGELOG.md +24 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/INSTALL.md +34 -3
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/PKG-INFO +5 -2
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/README.md +4 -1
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/formats/tasks.format.md +17 -1
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/manifest.md +1 -1
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/__init__.py +1 -1
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/doctor_cmd.py +1 -1
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/license_cmd.py +57 -9
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/check.py +38 -1
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/tasks.py +31 -0
- edify_agents_cli-0.2.1/src/edify/licensing/binding.py +34 -0
- edify_agents_cli-0.2.1/src/edify/licensing/revocation.py +146 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/licensing/tier.py +26 -1
- edify_agents_cli-0.2.1/src/edify/licensing/token.py +243 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_formats.py +83 -0
- edify_agents_cli-0.2.1/tests/test_license_cmd.py +117 -0
- edify_agents_cli-0.2.1/tests/test_licensing.py +376 -0
- edify_agents_cli-0.2.0/src/edify/licensing/token.py +0 -149
- edify_agents_cli-0.2.0/tests/test_license_cmd.py +0 -45
- edify_agents_cli-0.2.0/tests/test_licensing.py +0 -170
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/LICENSE +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/commands/build.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/commands/plan.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/commands/spec.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/commands/tasks.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/commands/verify.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/formats/plan.example.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/formats/plan.format.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/formats/spec.example.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/formats/spec.format.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/formats/tasks.example.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/harvest/harvest.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/harvest/sources.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/harvest/vocab.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/mcp/default-registry.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/adversary.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/debugger.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/implementer-general.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/implementer-go.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/implementer-node.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/implementer-postgres.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/implementer-python.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/implementer-react.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/planner.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/test-writer-node.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/test-writer-python.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/skills/verifier.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/edify/templates/CLAUDE.md +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/pyproject.toml +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/__main__.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/_toml.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/agents.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/anim.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/assets.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/cli.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/__init__.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/check_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/feedback_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/governance_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/graph_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/harvest_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/init_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/init_new_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/mcp_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/self_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/setup_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/skills_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/commands/upgrade_cmd.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/context.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/conventions.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/detect.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/distribution.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/errors.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/feedback.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/__init__.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/document.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/finding.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/fix.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/mcp.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/plan.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/skill.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/formats/spec.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/governance.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/__init__.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/extract.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/ignore.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/langs/__init__.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/langs/ctags.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/langs/markdown.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/langs/patterns.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/langs/python_ast.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/langs/sqlish.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/model.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/queries.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/graph/store.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/harvest/__init__.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/harvest/ledger.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/harvest/screen.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/harvest/sources.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/host.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/interview.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/library.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/licensing/__init__.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/licensing/ed25519.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/licensing/projects.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/paths.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/selfinstall.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/skills.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/tsv.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/src/edify/ui.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/conftest.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_anim.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_cli.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_detect.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_feedback.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_fix.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_governance.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_graph.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_harvest.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_host.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_init_new.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_library.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_mixed_versions.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_platform.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_projects_retired.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_selection.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_self.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_toml.py +0 -0
- {edify_agents_cli-0.2.0 → edify_agents_cli-0.2.1}/tests/test_ui.py +0 -0
|
@@ -13,6 +13,9 @@ htmlcov/
|
|
|
13
13
|
tools/.keys/
|
|
14
14
|
# Every licence issued, with the customer's email. Local, append-only, never committed.
|
|
15
15
|
tools/.issued.tsv
|
|
16
|
+
# The issuer home: client registry, audit, revocations, issued tokens, outbox.
|
|
17
|
+
# Back it up with the seed; never commit it.
|
|
18
|
+
tools/.issuer/
|
|
16
19
|
|
|
17
20
|
# A stranger's text, verbatim, awaiting a human. The permanent record of what
|
|
18
21
|
# arrived and what happened to it is harvest/ledger.json, not the bytes.
|
|
@@ -22,3 +25,7 @@ harvest/quarantine/
|
|
|
22
25
|
# The public repository, built from this tree by copying. It carries its own
|
|
23
26
|
# git history and is pushed separately, so it must not be tracked here as well.
|
|
24
27
|
edify_public/
|
|
28
|
+
|
|
29
|
+
# SSH deploy keys never belong in the repository
|
|
30
|
+
edify_deploy
|
|
31
|
+
edify_deploy.pub
|
|
@@ -7,6 +7,30 @@ Two contract versions move independently of the CLI version and are recorded in
|
|
|
7
7
|
`.edify/graph/meta` and `edify/manifest.md`: `graph-schema` (bumping it rebuilds an
|
|
8
8
|
existing graph rather than misreading it) and `index-schema`.
|
|
9
9
|
|
|
10
|
+
## 0.2.1
|
|
11
|
+
|
|
12
|
+
- **Licences carry the team fields.** A team or partner token names its client, its admin
|
|
13
|
+
handles, an optional repository binding (the root commit) and its signing key (`kid`).
|
|
14
|
+
Every field is optional, so tokens already issued keep working.
|
|
15
|
+
- **Licence ID.** Every licence has one, derived from its signed bytes, shown by
|
|
16
|
+
`edify license status` and in `--json` as `license.id`.
|
|
17
|
+
- **Revocation, offline.** A release can carry a signed list of revoked licence IDs
|
|
18
|
+
(`edify/licensing/revoked.tsv`). A revoked licence runs the public edition and says so;
|
|
19
|
+
`activate` refuses it. Nothing is fetched.
|
|
20
|
+
- **Key rotation.** Several licence keys can ship at once, selected by the token's `kid`.
|
|
21
|
+
`EDIFY_LICENSE_PUBKEY` now adds a key rather than replacing the shipped one.
|
|
22
|
+
- `license status` shows the client, admins, licence ID, verifying key and whether a bound
|
|
23
|
+
licence matches this repository. `status` and `doctor` warn 30 days before expiry
|
|
24
|
+
(was 15).
|
|
25
|
+
- `edify check` understands milestone-scoped task lists. With `milestone:` in the
|
|
26
|
+
frontmatter, a `deferred` coverage row excuses the assertions it owns (listed as notes,
|
|
27
|
+
not errors), and a delete by a task marked `Status — done` no longer counts as a
|
|
28
|
+
missing file. `deferred` without a milestone is an error.
|
|
29
|
+
- Fixed: `edify license activate <token>` crashed with "File name too long" when the
|
|
30
|
+
token, pasted on the command line, was longer than a filename may be.
|
|
31
|
+
- Fixed: a validly signed token with a non-numeric `seats`, or a payload that is not an
|
|
32
|
+
object, crashed licence resolution instead of being refused.
|
|
33
|
+
|
|
10
34
|
## 0.2.0
|
|
11
35
|
|
|
12
36
|
- **Renamed** on PyPI from `edify-cli`, a name that belongs to another project, to
|
|
@@ -6,6 +6,27 @@ procurement conversation about a runtime it drags in behind it.
|
|
|
6
6
|
|
|
7
7
|
Requirements: **Python 3.10 or newer**. That is the whole list.
|
|
8
8
|
|
|
9
|
+
The package is [`edify-agents-cli` on PyPI](https://pypi.org/project/edify-agents-cli/);
|
|
10
|
+
it installs one command, `edify`.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Any platform, with pip
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install edify-agents-cli
|
|
18
|
+
|
|
19
|
+
edify version # edify 0.2.1
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`pip` installs into whichever Python environment it belongs to. Inside a virtual
|
|
23
|
+
environment that is all there is to it. On a system Python, prefer `pipx` or `uv tool`
|
|
24
|
+
below, which give `edify` an environment of its own; `pip install --user
|
|
25
|
+
edify-agents-cli` is the fallback, and its scripts directory has to be on your PATH
|
|
26
|
+
(see *If `edify: command not found`*).
|
|
27
|
+
|
|
28
|
+
To upgrade later: `pip install --upgrade edify-agents-cli`.
|
|
29
|
+
|
|
9
30
|
---
|
|
10
31
|
|
|
11
32
|
## macOS
|
|
@@ -80,6 +101,7 @@ Gatekeeper does not gate that.
|
|
|
80
101
|
|
|
81
102
|
```bash
|
|
82
103
|
pipx install edify-agents-cli # or: uv tool install edify-agents-cli
|
|
104
|
+
# or, inside a virtualenv: pip install edify-agents-cli
|
|
83
105
|
```
|
|
84
106
|
|
|
85
107
|
Configuration lives in `$XDG_CONFIG_HOME/edify`, or `~/.config/edify`.
|
|
@@ -92,6 +114,8 @@ py -m pipx ensurepath
|
|
|
92
114
|
pipx install edify-agents-cli
|
|
93
115
|
```
|
|
94
116
|
|
|
117
|
+
Or, inside a virtual environment: `py -m pip install edify-agents-cli`.
|
|
118
|
+
|
|
95
119
|
Configuration lives in `%APPDATA%\edify`.
|
|
96
120
|
|
|
97
121
|
---
|
|
@@ -220,13 +244,20 @@ activation server and no phone-home, so a licence works on an air-gapped machine
|
|
|
220
244
|
keeps working if we are down.
|
|
221
245
|
|
|
222
246
|
`EDIFY_LICENSE` carries a token in CI without writing a file. `EDIFY_LICENSE_PUBKEY`
|
|
223
|
-
|
|
224
|
-
|
|
247
|
+
adds a verifying key, for testing an issuer; it never replaces the keys edify ships, and
|
|
248
|
+
`edify license status` says which key verified a licence. `EDIFY_HOME` moves the licence
|
|
249
|
+
and the feedback file together — which is also how a test isolates both.
|
|
250
|
+
|
|
251
|
+
`edify license status` shows the licence ID. Quote it, not the token, when you write to
|
|
252
|
+
us. A team licence may be bound to one repository by its root commit; in CI, check out
|
|
253
|
+
with full history (`fetch-depth: 0`) so the root commit is visible. A licence that leaks
|
|
254
|
+
can be revoked: the next release carries its ID, and it stops working when that release
|
|
255
|
+
is installed.
|
|
225
256
|
|
|
226
257
|
## Uninstalling
|
|
227
258
|
|
|
228
259
|
```bash
|
|
229
|
-
pipx uninstall edify-agents-cli # or: brew uninstall edify
|
|
260
|
+
pipx uninstall edify-agents-cli # or: pip uninstall edify-agents-cli / brew uninstall edify
|
|
230
261
|
rm -rf ~/Library/Application\ Support/edify # macOS; ~/.config/edify elsewhere
|
|
231
262
|
```
|
|
232
263
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: edify-agents-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A harness that makes an AI coding agent work reliably on large codebases: three documents and a map.
|
|
5
5
|
Project-URL: Homepage, https://github.com/EDIFY-agents/EDIFY
|
|
6
6
|
Project-URL: Documentation, https://github.com/EDIFY-agents/EDIFY#readme
|
|
@@ -89,8 +89,11 @@ macOS, Linux, and Windows, from the same artifact. Python 3.10 or newer is the w
|
|
|
89
89
|
requirement — there are no dependencies, no compiler, and no runtime to install on a
|
|
90
90
|
build server.
|
|
91
91
|
|
|
92
|
+
The CLI is [`edify-agents-cli` on PyPI](https://pypi.org/project/edify-agents-cli/);
|
|
93
|
+
it installs one command, `edify`.
|
|
94
|
+
|
|
92
95
|
```bash
|
|
93
|
-
|
|
96
|
+
pip install edify-agents-cli # or: pipx install / uv tool install edify-agents-cli
|
|
94
97
|
brew install edify-dev/tap/edify # macOS, if you prefer brew
|
|
95
98
|
|
|
96
99
|
cd your-repository
|
|
@@ -40,8 +40,11 @@ macOS, Linux, and Windows, from the same artifact. Python 3.10 or newer is the w
|
|
|
40
40
|
requirement — there are no dependencies, no compiler, and no runtime to install on a
|
|
41
41
|
build server.
|
|
42
42
|
|
|
43
|
+
The CLI is [`edify-agents-cli` on PyPI](https://pypi.org/project/edify-agents-cli/);
|
|
44
|
+
it installs one command, `edify`.
|
|
45
|
+
|
|
43
46
|
```bash
|
|
44
|
-
|
|
47
|
+
pip install edify-agents-cli # or: pipx install / uv tool install edify-agents-cli
|
|
45
48
|
brew install edify-dev/tap/edify # macOS, if you prefer brew
|
|
46
49
|
|
|
47
50
|
cd your-repository
|
|
@@ -46,6 +46,7 @@ feature: team-invitations
|
|
|
46
46
|
spec: spec.md
|
|
47
47
|
plan: — # plan.md, or — when the feature does not need one
|
|
48
48
|
status: draft # draft | approved | amended
|
|
49
|
+
milestone: M1 # optional: this document tasks one milestone of the spec
|
|
49
50
|
phases: 8
|
|
50
51
|
tasks: 16
|
|
51
52
|
date: 2026-08-06
|
|
@@ -167,6 +168,19 @@ Three legal values in the right-hand columns: task ids, `waived` with a reason o
|
|
|
167
168
|
the same line, or `proof-only`. An empty cell means the plan is not ready, and the
|
|
168
169
|
check runs **before** a human sees the table.
|
|
169
170
|
|
|
171
|
+
A fourth, `deferred`, is legal only when the frontmatter names a `milestone:`. A
|
|
172
|
+
spec too large for one build is tasked a milestone at a time, and its later
|
|
173
|
+
requirements stay in this table as `deferred` rows, so the table is visibly
|
|
174
|
+
incomplete rather than falsely complete. An assertion owned only by deferred rows
|
|
175
|
+
needs no phase-2 task here; `edify check` lists it as a note. A row can also defer
|
|
176
|
+
part of a requirement by naming the assertions in the sentence that says
|
|
177
|
+
`deferred` — `T-8. The team half (A-81, A-82) is deferred, M2` — and only that
|
|
178
|
+
sentence defers.
|
|
179
|
+
|
|
180
|
+
| source | what it is | asserted by | built by |
|
|
181
|
+
|---|---|---|---|
|
|
182
|
+
| REQ-9 | An admin can revoke an invitation | `deferred` M2 | `deferred` M2 |
|
|
183
|
+
|
|
170
184
|
A row with a builder and no asserter is a requirement nobody wrote a failing test
|
|
171
185
|
for: it will be built, it will look done, and nothing will ever have proved it.
|
|
172
186
|
|
|
@@ -194,6 +208,8 @@ next feature.
|
|
|
194
208
|
## What `edify check` reports
|
|
195
209
|
|
|
196
210
|
A task with no discharge, no steps, or no done-check. A whole-file reference on an
|
|
197
|
-
edit. A file that is not on disk
|
|
211
|
+
edit. A file that is not on disk, except a delete by a task whose `Status — done`
|
|
212
|
+
line /build has written, since that file is meant to be gone. A `deferred` row in
|
|
213
|
+
a document with no `milestone:`. A phase-2 done-check that asserts tests pass. An
|
|
198
214
|
assertion with no phase-2 task. An empty coverage cell. A phase with no exit check.
|
|
199
215
|
A dependency on a task that does not exist.
|
|
@@ -7,7 +7,7 @@ queries the graph, resolves skills, and checks formats.
|
|
|
7
7
|
It is not the agent runtime and it never wraps a model.
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
|
-
__version__ = "0.2.
|
|
10
|
+
__version__ = "0.2.1"
|
|
11
11
|
|
|
12
12
|
# The on-disk contract version for `.edify/graph/`. Bumping it means an existing
|
|
13
13
|
# graph is rebuilt rather than misread.
|
|
@@ -183,7 +183,7 @@ def _license(ctx: Context) -> Check:
|
|
|
183
183
|
ent = ctx.entitlement
|
|
184
184
|
if ent.problem:
|
|
185
185
|
return Check("license", AMBER, f"running free — {ent.problem}")
|
|
186
|
-
if ent.
|
|
186
|
+
if ent.warning and ent.license:
|
|
187
187
|
return Check("license", AMBER, f"{ent.plan} · expires in {ent.license.days_left} days")
|
|
188
188
|
|
|
189
189
|
if ent.paid:
|
|
@@ -17,24 +17,37 @@ from pathlib import Path
|
|
|
17
17
|
from ..context import Context
|
|
18
18
|
from ..distribution import CONTACT
|
|
19
19
|
from ..errors import EdifyError
|
|
20
|
-
from ..licensing import tier
|
|
21
|
-
from ..licensing.
|
|
20
|
+
from ..licensing import revocation, tier
|
|
21
|
+
from ..licensing.binding import root_commits
|
|
22
|
+
from ..licensing.token import License, parse
|
|
22
23
|
from ..ui import MARKS
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
def status(ctx: Context) -> int:
|
|
26
27
|
ent = ctx.entitlement
|
|
27
|
-
|
|
28
|
+
data = ent.as_dict()
|
|
29
|
+
binding = _binding(ctx, ent.license) if ent.license else None
|
|
30
|
+
data["binding"] = binding
|
|
31
|
+
data["revocations"] = revocation.load().as_dict()
|
|
32
|
+
ctx.out.data(data)
|
|
28
33
|
|
|
29
34
|
ctx.out.field("plan", ent.plan)
|
|
30
35
|
if ent.license:
|
|
31
36
|
lic = ent.license
|
|
32
|
-
|
|
37
|
+
who = lic.client or lic.email or lic.subject or "unnamed"
|
|
38
|
+
ctx.out.field("licensed", f"{who} · {lic.seats} seat(s)")
|
|
39
|
+
if lic.admins:
|
|
40
|
+
ctx.out.field("admins", ", ".join(lic.admins))
|
|
41
|
+
ctx.out.field("licence id", f"{lic.id} · key {lic.key}")
|
|
33
42
|
if lic.expires_at:
|
|
34
43
|
when = time.strftime("%Y-%m-%d", time.gmtime(lic.expires_at))
|
|
35
44
|
ctx.out.field("expires", f"{when} ({lic.days_left} days)")
|
|
45
|
+
if binding:
|
|
46
|
+
ctx.out.field("bound to", f"{lic.bind[:12]} · {binding['detail']}")
|
|
36
47
|
if ent.problem:
|
|
37
48
|
ctx.out.warn(f"a licence was found and not accepted: {ent.problem}")
|
|
49
|
+
if ent.warning:
|
|
50
|
+
ctx.out.warn(ent.warning)
|
|
38
51
|
ctx.out.field("source", str(ent.source))
|
|
39
52
|
ctx.out.line("")
|
|
40
53
|
|
|
@@ -57,22 +70,57 @@ def status(ctx: Context) -> int:
|
|
|
57
70
|
|
|
58
71
|
|
|
59
72
|
def activate(ctx: Context) -> int:
|
|
60
|
-
token = ctx.args.token.strip()
|
|
61
|
-
if Path(token).expanduser().is_file():
|
|
62
|
-
token = Path(token).expanduser().read_text(encoding="utf-8").strip()
|
|
73
|
+
token = _token_or_file(ctx.args.token.strip())
|
|
63
74
|
|
|
64
75
|
verdict = parse(token)
|
|
65
76
|
if not verdict.valid or verdict.license is None:
|
|
66
77
|
raise EdifyError(f"not activated — {verdict.reason}")
|
|
67
78
|
|
|
68
|
-
path = tier.save(token)
|
|
69
79
|
lic = verdict.license
|
|
80
|
+
if lic.id in revocation.revoked_ids():
|
|
81
|
+
raise EdifyError(f"not activated — licence {lic.id} was revoked")
|
|
82
|
+
|
|
83
|
+
path = tier.save(token)
|
|
70
84
|
ctx.out.data({"path": str(path), "license": lic.as_dict()})
|
|
71
|
-
ctx.out.ok(f"{lic.plan} plan activated for {lic.email or lic.subject or 'this machine'}")
|
|
85
|
+
ctx.out.ok(f"{lic.plan} plan activated for {lic.client or lic.email or lic.subject or 'this machine'}")
|
|
72
86
|
ctx.out.line(str(path))
|
|
87
|
+
if lic.plan in tier.RETIRED_PLANS:
|
|
88
|
+
ctx.out.warn(f"the {lic.plan} plan is retired — this machine runs the public edition; ask for a new token")
|
|
89
|
+
binding = _binding(ctx, lic)
|
|
90
|
+
if binding and not binding["matches"]:
|
|
91
|
+
ctx.out.warn(f"this licence is bound to another repository ({binding['detail']})")
|
|
73
92
|
return 0
|
|
74
93
|
|
|
75
94
|
|
|
95
|
+
def _token_or_file(value: str) -> str:
|
|
96
|
+
"""The token itself, or the contents of the file it names.
|
|
97
|
+
|
|
98
|
+
A token is checked for first: a team token is longer than a path component may
|
|
99
|
+
be, and asking the filesystem about it raises rather than answering no.
|
|
100
|
+
"""
|
|
101
|
+
if value.startswith("edify1."):
|
|
102
|
+
return value
|
|
103
|
+
try:
|
|
104
|
+
path = Path(value).expanduser()
|
|
105
|
+
if path.is_file():
|
|
106
|
+
return path.read_text(encoding="utf-8").strip()
|
|
107
|
+
except OSError:
|
|
108
|
+
pass
|
|
109
|
+
return value
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _binding(ctx: Context, lic: License) -> dict[str, object] | None:
|
|
113
|
+
"""Whether a bound licence matches the repository this command runs in."""
|
|
114
|
+
if not lic.bind:
|
|
115
|
+
return None
|
|
116
|
+
roots, problem = root_commits(ctx.layout.root)
|
|
117
|
+
if problem:
|
|
118
|
+
return {"bind": lic.bind, "matches": False, "detail": problem}
|
|
119
|
+
matches = lic.bound_to(roots)
|
|
120
|
+
detail = "this repository" if matches else f"this repository's root is {roots[0][:12]}"
|
|
121
|
+
return {"bind": lic.bind, "matches": matches, "detail": detail}
|
|
122
|
+
|
|
123
|
+
|
|
76
124
|
def deactivate(ctx: Context) -> int:
|
|
77
125
|
removed = tier.clear()
|
|
78
126
|
ctx.out.data({"removed": removed})
|
|
@@ -326,7 +326,9 @@ def _check_task(
|
|
|
326
326
|
hint="a whole-file reference passes any shape check, inflates overlap, and makes the builder open lines it did not need",
|
|
327
327
|
)
|
|
328
328
|
)
|
|
329
|
-
|
|
329
|
+
# A done task's delete has already happened: its target is meant to be gone.
|
|
330
|
+
gone_on_purpose = action == "delete" and task.status == "done"
|
|
331
|
+
if action in ("edit", "delete") and not gone_on_purpose and not (layout.root / ref.path).exists():
|
|
330
332
|
out.append(
|
|
331
333
|
Finding(
|
|
332
334
|
Level.ERROR, rel, ref.line, "task-file-missing",
|
|
@@ -406,6 +408,24 @@ def _check_phases(tasks: tasks_format.Tasks) -> list[Finding]:
|
|
|
406
408
|
return out
|
|
407
409
|
|
|
408
410
|
|
|
411
|
+
def _deferred_assertions(tasks: tasks_format.Tasks, spec: spec_format.Spec) -> set[str]:
|
|
412
|
+
"""Assertions this milestone defers: those owned only by deferred requirements,
|
|
413
|
+
and those a coverage row names in a sentence that says `deferred`.
|
|
414
|
+
|
|
415
|
+
Only a milestone-scoped document may defer. An assertion that a live
|
|
416
|
+
requirement also names is not deferred, unless a row defers it by id.
|
|
417
|
+
"""
|
|
418
|
+
if not tasks.milestone:
|
|
419
|
+
return set()
|
|
420
|
+
deferred_reqs = {r.source.strip().strip("`*") for r in tasks.coverage if r.deferred}
|
|
421
|
+
owners: dict[str, set[str]] = {}
|
|
422
|
+
for req in spec.requirements:
|
|
423
|
+
for aid in req.assertions:
|
|
424
|
+
owners.setdefault(aid, set()).add(req.id)
|
|
425
|
+
by_id = {aid for r in tasks.coverage for aid in r.deferred_ids}
|
|
426
|
+
return by_id | {aid for aid, reqs in owners.items() if reqs and reqs <= deferred_reqs}
|
|
427
|
+
|
|
428
|
+
|
|
409
429
|
def _check_coverage(tasks: tasks_format.Tasks, spec: spec_format.Spec | None) -> list[Finding]:
|
|
410
430
|
out: list[Finding] = []
|
|
411
431
|
rel = tasks.rel
|
|
@@ -416,6 +436,14 @@ def _check_coverage(tasks: tasks_format.Tasks, spec: spec_format.Spec | None) ->
|
|
|
416
436
|
return out
|
|
417
437
|
|
|
418
438
|
for row in tasks.coverage:
|
|
439
|
+
if row.deferred and not tasks.milestone:
|
|
440
|
+
out.append(
|
|
441
|
+
Finding(
|
|
442
|
+
Level.ERROR, rel, row.line, "coverage-deferred-no-milestone",
|
|
443
|
+
f"{row.source} is `deferred`, and this document tasks no milestone",
|
|
444
|
+
hint="add `milestone:` to the frontmatter, or task the requirement here",
|
|
445
|
+
)
|
|
446
|
+
)
|
|
419
447
|
if not row.discharged.strip():
|
|
420
448
|
out.append(
|
|
421
449
|
Finding(
|
|
@@ -503,7 +531,16 @@ def _check_phase_two(
|
|
|
503
531
|
|
|
504
532
|
if spec is not None and phase_two:
|
|
505
533
|
asserted = {aid for t in phase_two for aid in t.discharges}
|
|
534
|
+
deferred = _deferred_assertions(tasks, spec)
|
|
506
535
|
for missing in sorted(spec.assertion_ids() - asserted):
|
|
536
|
+
if missing in deferred:
|
|
537
|
+
out.append(
|
|
538
|
+
Finding(
|
|
539
|
+
Level.INFO, rel, 1, "phase2-assertion-deferred",
|
|
540
|
+
f"assertion {missing} belongs to a later milestone than {tasks.milestone}",
|
|
541
|
+
)
|
|
542
|
+
)
|
|
543
|
+
continue
|
|
507
544
|
out.append(
|
|
508
545
|
Finding(
|
|
509
546
|
Level.ERROR, rel, 1, "phase2-assertion-untested",
|
|
@@ -37,6 +37,8 @@ _DISCHARGES = re.compile(r"^\s*Discharges\s+(?P<ids>.+)$", re.IGNORECASE)
|
|
|
37
37
|
_VERIFICATION = re.compile(r"^\s*Verification\s+(?P<kinds>.+)$", re.IGNORECASE)
|
|
38
38
|
_DEPENDS = re.compile(r"^\s*Depends on\s+(?P<ids>.*?)(?:·|$)", re.IGNORECASE)
|
|
39
39
|
_PARALLEL = re.compile(r"Parallel with\s+(?P<ids>.+)$", re.IGNORECASE)
|
|
40
|
+
#: `Status — **done** 2026-09-28`, written by /build when a task's done-check passes.
|
|
41
|
+
_STATUS = re.compile(r"^\s*Status\s*[—:-]+\s*[*_`]*(?P<status>[A-Za-z-]+)", re.IGNORECASE)
|
|
40
42
|
_RANGE = re.compile(r"^(?P<start>\d+)\s*[-–]\s*(?P<end>\d+)$")
|
|
41
43
|
|
|
42
44
|
|
|
@@ -81,6 +83,8 @@ class Task:
|
|
|
81
83
|
steps: list[str] = field(default_factory=list)
|
|
82
84
|
done_when: list[str] = field(default_factory=list)
|
|
83
85
|
files_table_line: int = 0
|
|
86
|
+
#: Empty until /build records one; `done` once the task's done-check passed.
|
|
87
|
+
status: str = ""
|
|
84
88
|
|
|
85
89
|
@property
|
|
86
90
|
def edits(self) -> list[FileRef]:
|
|
@@ -112,6 +116,26 @@ class CoverageRow:
|
|
|
112
116
|
def discharged(self) -> str:
|
|
113
117
|
return " ".join(c for c in self.cells if c.strip())
|
|
114
118
|
|
|
119
|
+
@property
|
|
120
|
+
def deferred(self) -> bool:
|
|
121
|
+
"""Owned by a later milestone: the asserted-by cell says `deferred`."""
|
|
122
|
+
return bool(self.cells) and "deferred" in self.cells[0].lower()
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def deferred_ids(self) -> set[str]:
|
|
126
|
+
"""Assertion ids named in a sentence that says `deferred`.
|
|
127
|
+
|
|
128
|
+
A milestone can split a requirement — "T-8. The team half (A-81, A-82) is
|
|
129
|
+
`deferred`, M2" — and only that sentence defers. "`deferred` M2. A-16 is
|
|
130
|
+
pulled into M1" defers nothing by id: A-16 is in another sentence.
|
|
131
|
+
"""
|
|
132
|
+
out: set[str] = set()
|
|
133
|
+
for cell in self.cells:
|
|
134
|
+
for sentence in re.split(r"\.\s+", cell):
|
|
135
|
+
if "deferred" in sentence.lower():
|
|
136
|
+
out.update(re.findall(r"\bA-\d+\b", sentence))
|
|
137
|
+
return out
|
|
138
|
+
|
|
115
139
|
|
|
116
140
|
@dataclass
|
|
117
141
|
class Tasks:
|
|
@@ -119,6 +143,8 @@ class Tasks:
|
|
|
119
143
|
feature: str = ""
|
|
120
144
|
status: str = ""
|
|
121
145
|
spec_ref: str = ""
|
|
146
|
+
#: Set when the document tasks one milestone of a larger spec.
|
|
147
|
+
milestone: str = ""
|
|
122
148
|
tasks: list[Task] = field(default_factory=list)
|
|
123
149
|
phases: list[Phase] = field(default_factory=list)
|
|
124
150
|
coverage: list[CoverageRow] = field(default_factory=list)
|
|
@@ -144,6 +170,7 @@ def parse(path: Path, rel: str | None = None) -> Tasks:
|
|
|
144
170
|
out.feature = doc.frontmatter.get("feature", "")
|
|
145
171
|
out.status = doc.frontmatter.get("status", "")
|
|
146
172
|
out.spec_ref = doc.frontmatter.get("spec", "")
|
|
173
|
+
out.milestone = doc.frontmatter.get("milestone", "")
|
|
147
174
|
|
|
148
175
|
current_phase: int | None = None
|
|
149
176
|
for section in doc.sections:
|
|
@@ -206,6 +233,10 @@ def _task(section: Section, heading: re.Match[str], fallback_phase: int | None)
|
|
|
206
233
|
if m:
|
|
207
234
|
task.verification = _kinds(m.group("kinds"))
|
|
208
235
|
continue
|
|
236
|
+
m = _STATUS.match(line)
|
|
237
|
+
if m and not task.status:
|
|
238
|
+
task.status = m.group("status").lower()
|
|
239
|
+
continue
|
|
209
240
|
m = _DEPENDS.match(line)
|
|
210
241
|
if m:
|
|
211
242
|
task.depends_on = _ids(m.group("ids"))
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""A repository's identity for licence binding: its root commit (REQ-52).
|
|
2
|
+
|
|
3
|
+
A `team` licence may name the root commit of the repository it is for. The root
|
|
4
|
+
commit survives renames, forks of the remote and moves on disk, and needs no
|
|
5
|
+
network to read. A shallow clone hides it, so a shallow clone reports that rather
|
|
6
|
+
than guessing (plan.md R-9).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import subprocess
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def root_commits(repo: Path) -> tuple[list[str], str]:
|
|
16
|
+
"""The repository's root commits, or why they cannot be read."""
|
|
17
|
+
def git(*args: str) -> subprocess.CompletedProcess[str]:
|
|
18
|
+
return subprocess.run(
|
|
19
|
+
["git", "-C", str(repo), *args],
|
|
20
|
+
capture_output=True, text=True, timeout=10, check=False,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
shallow = git("rev-parse", "--is-shallow-repository")
|
|
25
|
+
if shallow.returncode != 0:
|
|
26
|
+
return [], "not a git repository"
|
|
27
|
+
if shallow.stdout.strip() == "true":
|
|
28
|
+
return [], "a shallow clone hides the root commit — run `git fetch --unshallow`"
|
|
29
|
+
roots = git("rev-list", "--max-parents=0", "HEAD")
|
|
30
|
+
except (OSError, subprocess.SubprocessError):
|
|
31
|
+
return [], "git is not available"
|
|
32
|
+
if roots.returncode != 0:
|
|
33
|
+
return [], "the repository has no commits yet"
|
|
34
|
+
return [line.strip() for line in roots.stdout.splitlines() if line.strip()], ""
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""Revoked licences: a signed list of licence IDs, shipped with a release.
|
|
2
|
+
|
|
3
|
+
A token is valid until it expires, and nothing is fetched to ask whether it still
|
|
4
|
+
should be. So a leaked or withdrawn licence is stopped the only offline way there
|
|
5
|
+
is: the next release carries its ID, signed with the licence key, and `tier`
|
|
6
|
+
treats a revoked licence as no licence (REQ-54).
|
|
7
|
+
|
|
8
|
+
The list holds licence IDs and nothing else — no client names and no emails —
|
|
9
|
+
because it ships in the public wheel. It is written by the private issuer
|
|
10
|
+
(`revocations sign`), never by hand. An absent list is an empty one. A list whose
|
|
11
|
+
signature does not verify is ignored and reported, never trusted, since a list
|
|
12
|
+
can only ever take entitlements away.
|
|
13
|
+
|
|
14
|
+
# comment lines
|
|
15
|
+
edify-revoked<TAB>1<TAB>kid=0<TAB>issued=2026-10-02
|
|
16
|
+
0123456789abcdef
|
|
17
|
+
...
|
|
18
|
+
signature<TAB><base64url Ed25519 over every byte above this line>
|
|
19
|
+
|
|
20
|
+
The team edition adds its own list with `register()`.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
import base64
|
|
26
|
+
import binascii
|
|
27
|
+
import re
|
|
28
|
+
import time
|
|
29
|
+
from dataclasses import dataclass, field
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
from .ed25519 import verify
|
|
33
|
+
from .token import override_keys, shipped_key
|
|
34
|
+
|
|
35
|
+
HEADER = "edify-revoked"
|
|
36
|
+
VERSION = "1"
|
|
37
|
+
|
|
38
|
+
#: The list this release ships. Absent until the first revocation.
|
|
39
|
+
EMBEDDED = Path(__file__).with_name("revoked.tsv")
|
|
40
|
+
|
|
41
|
+
_ID = re.compile(r"^[0-9a-f]{16}$")
|
|
42
|
+
_registered: list[Path] = []
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass
|
|
46
|
+
class RevocationList:
|
|
47
|
+
ids: frozenset[str] = frozenset()
|
|
48
|
+
sources: list[str] = field(default_factory=list)
|
|
49
|
+
problems: list[str] = field(default_factory=list)
|
|
50
|
+
|
|
51
|
+
def as_dict(self) -> dict[str, object]:
|
|
52
|
+
return {"count": len(self.ids), "sources": self.sources, "problems": self.problems}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def register(path: Path) -> None:
|
|
56
|
+
"""Add a signed list to the ones consulted. For the team edition's own list."""
|
|
57
|
+
if path not in _registered:
|
|
58
|
+
_registered.append(path)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def load() -> RevocationList:
|
|
62
|
+
"""Every verified list, merged. Read per call: the files are a few hundred bytes."""
|
|
63
|
+
ids: set[str] = set()
|
|
64
|
+
sources: list[str] = []
|
|
65
|
+
problems: list[str] = []
|
|
66
|
+
for path in [EMBEDDED, *_registered]:
|
|
67
|
+
if not path.is_file():
|
|
68
|
+
continue
|
|
69
|
+
found, problem = read(path.read_text(encoding="utf-8"))
|
|
70
|
+
if problem:
|
|
71
|
+
problems.append(f"{path.name}: {problem}")
|
|
72
|
+
continue
|
|
73
|
+
ids |= found
|
|
74
|
+
sources.append(str(path))
|
|
75
|
+
return RevocationList(frozenset(ids), sources, problems)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def revoked_ids() -> frozenset[str]:
|
|
79
|
+
return load().ids
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def read(text: str) -> tuple[frozenset[str], str]:
|
|
83
|
+
"""The IDs a signed list carries, or why the list is not trusted."""
|
|
84
|
+
text = text.replace("\r\n", "\n")
|
|
85
|
+
marker = text.rfind("\nsignature\t")
|
|
86
|
+
if marker < 0:
|
|
87
|
+
return frozenset(), "unsigned"
|
|
88
|
+
body = text[: marker + 1]
|
|
89
|
+
sig_line = text[marker + 1 :].strip()
|
|
90
|
+
try:
|
|
91
|
+
signature = _b64decode(sig_line.split("\t", 1)[1].strip())
|
|
92
|
+
except (IndexError, binascii.Error, ValueError):
|
|
93
|
+
return frozenset(), "the signature is not base64url"
|
|
94
|
+
|
|
95
|
+
lines = [ln for ln in body.splitlines() if ln.strip() and not ln.startswith("#")]
|
|
96
|
+
if not lines:
|
|
97
|
+
return frozenset(), "no header"
|
|
98
|
+
head = lines[0].split("\t")
|
|
99
|
+
if head[0] != HEADER or len(head) < 2 or head[1] != VERSION:
|
|
100
|
+
return frozenset(), f"not a version {VERSION} revocation list"
|
|
101
|
+
kid = 0
|
|
102
|
+
for part in head[2:]:
|
|
103
|
+
if part.startswith("kid="):
|
|
104
|
+
try:
|
|
105
|
+
kid = int(part[4:])
|
|
106
|
+
except ValueError:
|
|
107
|
+
return frozenset(), "the key id is not a number"
|
|
108
|
+
|
|
109
|
+
payload = body.encode("utf-8")
|
|
110
|
+
keys = [k for k in [shipped_key(kid), *override_keys()] if k]
|
|
111
|
+
if not any(verify(payload, signature, k) for k in keys):
|
|
112
|
+
return frozenset(), "the signature does not verify"
|
|
113
|
+
|
|
114
|
+
ids = {ln.split("\t", 1)[0].strip().lower() for ln in lines[1:]}
|
|
115
|
+
bad = sorted(i for i in ids if not _ID.match(i))
|
|
116
|
+
if bad:
|
|
117
|
+
return frozenset(), f"not a licence ID: {bad[0]}"
|
|
118
|
+
return frozenset(ids), ""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def write(ids: set[str] | frozenset[str], seed: bytes, kid: int = 0, now: int | None = None) -> str:
|
|
122
|
+
"""Sign a list. Used by the private issuer and by the tests."""
|
|
123
|
+
from .ed25519 import sign
|
|
124
|
+
|
|
125
|
+
clean = sorted({i.strip().lower() for i in ids})
|
|
126
|
+
bad = [i for i in clean if not _ID.match(i)]
|
|
127
|
+
if bad:
|
|
128
|
+
raise ValueError(f"not a licence ID: {bad[0]}")
|
|
129
|
+
day = time.strftime("%Y-%m-%d", time.gmtime(now if now is not None else time.time()))
|
|
130
|
+
body = (
|
|
131
|
+
"# edify revocation list — licence IDs only, signed with the licence key.\n"
|
|
132
|
+
"# Written by the private issuer (`revocations sign`). Never edit by hand:\n"
|
|
133
|
+
"# an edited list fails its signature and is ignored.\n"
|
|
134
|
+
f"{HEADER}\t{VERSION}\tkid={kid}\tissued={day}\n"
|
|
135
|
+
+ "".join(f"{i}\n" for i in clean)
|
|
136
|
+
)
|
|
137
|
+
signature = sign(body.encode("utf-8"), seed)
|
|
138
|
+
return body + f"signature\t{_b64encode(signature)}\n"
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _b64encode(data: bytes) -> str:
|
|
142
|
+
return base64.urlsafe_b64encode(data).decode("ascii").rstrip("=")
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _b64decode(data: str) -> bytes:
|
|
146
|
+
return base64.urlsafe_b64decode(data + "=" * (-len(data) % 4))
|