prwarden 2.2.0__tar.gz → 2.3.0__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.
- {prwarden-2.2.0/prwarden.egg-info → prwarden-2.3.0}/PKG-INFO +72 -13
- {prwarden-2.2.0 → prwarden-2.3.0}/README.md +71 -12
- prwarden-2.3.0/VERSION +1 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/__init__.py +1 -1
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/doctor.py +40 -7
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/engine.py +13 -8
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/setup_wizard.py +383 -34
- prwarden-2.3.0/prwarden/tools.py +291 -0
- {prwarden-2.2.0 → prwarden-2.3.0/prwarden.egg-info}/PKG-INFO +72 -13
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden.egg-info/SOURCES.txt +2 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_doctor.py +17 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_setup_wizard.py +236 -3
- prwarden-2.3.0/tests/test_tools.py +264 -0
- prwarden-2.2.0/VERSION +0 -1
- {prwarden-2.2.0 → prwarden-2.3.0}/LICENSE +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/NOTICE +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/__main__.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/cli.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/commands.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/comment_template.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/compare_metrics.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/config.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/delivery.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/engine_antigravity.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/engine_claude.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/engine_codex.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/engine_command.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/engine_kiro.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/evaluate.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/github.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/github_status.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/metrics.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/models.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/paths.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/progress.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/public_safety.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/release.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/review.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/reviewer_identity.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/schedule.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/state.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/templates/github-comment-tags.json +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/templates/github-comment.md +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden/workspace.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden.egg-info/dependency_links.txt +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden.egg-info/entry_points.txt +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/prwarden.egg-info/top_level.txt +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/pyproject.toml +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/setup.cfg +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_background.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_cli.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_commands.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_comment_template.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_config.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_delivery.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_design_level.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_docs_level.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_engine.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_evaluate.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_github.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_github_status.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_managed_checkout.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_merge_conflict_state.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_metrics.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_model_usage.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_packaging.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_paths.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_public_safety.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_release.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_repository_account.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_review.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_reviewer_identity.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_schedule.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_slack_scope.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_state.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_verification_fallback.py +0 -0
- {prwarden-2.2.0 → prwarden-2.3.0}/tests/test_workspace.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: prwarden
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Self-hosted AI pull-request reviewer built on the AI and GitHub CLIs you already use
|
|
5
5
|
Author: Pylyp Borysov
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -58,25 +58,84 @@ and delivery are plain code, the same for every engine. Kiro, Claude Code, Codex
|
|
|
58
58
|
and Antigravity can each review, verify, or stand in when another's provider fails,
|
|
59
59
|
and a command of your own can review.
|
|
60
60
|
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
PR Warden is one command, `prwarden`, with no Python packages of its own to pull
|
|
64
|
+
in. Install it with Homebrew on macOS or Linux, or from PyPI anywhere Python 3.9 or
|
|
65
|
+
newer runs.
|
|
66
|
+
|
|
67
|
+
### Homebrew
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
brew install bruha/tap/prwarden
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This adds the [bruha/homebrew-tap](https://github.com/bruha/homebrew-tap) tap and
|
|
74
|
+
installs PR Warden together with GitHub CLI and the Python it runs on.
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
brew upgrade prwarden # update to the latest release
|
|
78
|
+
brew uninstall prwarden # remove it
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### PyPI
|
|
82
|
+
|
|
83
|
+
The [prwarden package](https://pypi.org/project/prwarden/) runs on any Python 3.9 or
|
|
84
|
+
newer, the `python3` that comes with the macOS Command Line Tools included. Install
|
|
85
|
+
it with [pipx](https://pipx.pypa.io/), which gives it an environment of its own and
|
|
86
|
+
puts `prwarden` on your `PATH`:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
pipx install prwarden # or: uv tool install prwarden
|
|
90
|
+
pipx upgrade prwarden # update to the latest release
|
|
91
|
+
pipx uninstall prwarden # remove it
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
GitHub CLI is not a Python package, so pipx does not install it; `prwarden setup`
|
|
95
|
+
checks for it and offers to.
|
|
96
|
+
|
|
97
|
+
### Either way
|
|
98
|
+
|
|
99
|
+
`prwarden --version` shows the installed release. Configuration and review records
|
|
100
|
+
live outside the installation, in `~/.config/prwarden` and `~/.local/state/prwarden`
|
|
101
|
+
(see [where configuration and state live](#where-configuration-and-state-live)), so
|
|
102
|
+
an upgrade keeps them and a schedule keeps working: Homebrew and pipx both keep
|
|
103
|
+
`prwarden` at one path. Install it one way only: `prwarden schedule install`
|
|
104
|
+
schedules the first `prwarden` on your `PATH`.
|
|
105
|
+
|
|
106
|
+
Uninstalling leaves the configuration and records behind. To remove everything, run
|
|
107
|
+
`prwarden schedule remove` before uninstalling, then delete `~/.config/prwarden`,
|
|
108
|
+
`~/.local/state/prwarden`, and `~/.local/share/prwarden`, which holds the clones PR
|
|
109
|
+
Warden made.
|
|
110
|
+
|
|
61
111
|
## Quick start
|
|
62
112
|
|
|
63
|
-
With
|
|
64
|
-
login`, plus your AI CLI's own login), install PR Warden with Homebrew on macOS or
|
|
65
|
-
Linux, or with [pipx](https://pipx.pypa.io/) anywhere Python 3.9 runs, and set it
|
|
66
|
-
up:
|
|
113
|
+
With PR Warden [installed](#install), run:
|
|
67
114
|
|
|
68
115
|
```sh
|
|
69
|
-
brew install bruha/tap/prwarden # or: pipx install prwarden
|
|
70
116
|
prwarden setup
|
|
71
117
|
```
|
|
72
118
|
|
|
73
|
-
`prwarden setup`
|
|
74
|
-
|
|
119
|
+
`prwarden setup` first checks GitHub CLI and the AI CLIs PR Warden can drive,
|
|
120
|
+
Kiro CLI, Claude Code, Codex, and Antigravity, and shows which are installed and
|
|
121
|
+
signed in. It offers to install what is missing, with Homebrew on macOS and the
|
|
122
|
+
vendor's own installer otherwise, showing each command and running it only when you
|
|
123
|
+
agree, and then runs each tool's own sign-in. Then it asks which GitHub account
|
|
124
|
+
reviews, which AI CLI reviews and which verifies, and which repositories to watch. A repository you have no clone of is
|
|
75
125
|
cloned by PR Warden on its first review; setup says where, and roughly how large,
|
|
76
|
-
before you agree.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
126
|
+
before you agree.
|
|
127
|
+
|
|
128
|
+
It then asks whether the reviews of your own pull requests, which GitHub does not
|
|
129
|
+
let you approve, should go to Slack. Without a webhook yet, it opens Slack's page
|
|
130
|
+
for a new app already filled in: pick the workspace and the channel, and paste the
|
|
131
|
+
webhook URL Slack shows. Setup sends a test message through it before keeping it,
|
|
132
|
+
and asks which repositories report there, so a repository whose team is in another
|
|
133
|
+
workspace stays out of it. `prwarden setup --slack` does this step alone later.
|
|
134
|
+
|
|
135
|
+
Setup writes `.env` and `repositories.json` to `~/.config/prwarden`, then offers a
|
|
136
|
+
dry-run preview of one pull request, which spends credits and posts nothing, live
|
|
137
|
+
delivery, and a schedule. `prwarden doctor` checks the result at any time and
|
|
138
|
+
spends nothing.
|
|
80
139
|
|
|
81
140
|
### By hand, or from a clone
|
|
82
141
|
|
|
@@ -134,7 +193,7 @@ account's own pull requests, so a separate reviewer account works best.
|
|
|
134
193
|
or a compatible custom command
|
|
135
194
|
- A Slack incoming webhook when reviewing your own pull requests or sending
|
|
136
195
|
failure and manual-review notifications, unless every repository is kept out of
|
|
137
|
-
Slack
|
|
196
|
+
Slack; `prwarden setup` walks you through making one
|
|
138
197
|
|
|
139
198
|
No third-party Python packages are required.
|
|
140
199
|
|
|
@@ -34,25 +34,84 @@ and delivery are plain code, the same for every engine. Kiro, Claude Code, Codex
|
|
|
34
34
|
and Antigravity can each review, verify, or stand in when another's provider fails,
|
|
35
35
|
and a command of your own can review.
|
|
36
36
|
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
PR Warden is one command, `prwarden`, with no Python packages of its own to pull
|
|
40
|
+
in. Install it with Homebrew on macOS or Linux, or from PyPI anywhere Python 3.9 or
|
|
41
|
+
newer runs.
|
|
42
|
+
|
|
43
|
+
### Homebrew
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
brew install bruha/tap/prwarden
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This adds the [bruha/homebrew-tap](https://github.com/bruha/homebrew-tap) tap and
|
|
50
|
+
installs PR Warden together with GitHub CLI and the Python it runs on.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
brew upgrade prwarden # update to the latest release
|
|
54
|
+
brew uninstall prwarden # remove it
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### PyPI
|
|
58
|
+
|
|
59
|
+
The [prwarden package](https://pypi.org/project/prwarden/) runs on any Python 3.9 or
|
|
60
|
+
newer, the `python3` that comes with the macOS Command Line Tools included. Install
|
|
61
|
+
it with [pipx](https://pipx.pypa.io/), which gives it an environment of its own and
|
|
62
|
+
puts `prwarden` on your `PATH`:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
pipx install prwarden # or: uv tool install prwarden
|
|
66
|
+
pipx upgrade prwarden # update to the latest release
|
|
67
|
+
pipx uninstall prwarden # remove it
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
GitHub CLI is not a Python package, so pipx does not install it; `prwarden setup`
|
|
71
|
+
checks for it and offers to.
|
|
72
|
+
|
|
73
|
+
### Either way
|
|
74
|
+
|
|
75
|
+
`prwarden --version` shows the installed release. Configuration and review records
|
|
76
|
+
live outside the installation, in `~/.config/prwarden` and `~/.local/state/prwarden`
|
|
77
|
+
(see [where configuration and state live](#where-configuration-and-state-live)), so
|
|
78
|
+
an upgrade keeps them and a schedule keeps working: Homebrew and pipx both keep
|
|
79
|
+
`prwarden` at one path. Install it one way only: `prwarden schedule install`
|
|
80
|
+
schedules the first `prwarden` on your `PATH`.
|
|
81
|
+
|
|
82
|
+
Uninstalling leaves the configuration and records behind. To remove everything, run
|
|
83
|
+
`prwarden schedule remove` before uninstalling, then delete `~/.config/prwarden`,
|
|
84
|
+
`~/.local/state/prwarden`, and `~/.local/share/prwarden`, which holds the clones PR
|
|
85
|
+
Warden made.
|
|
86
|
+
|
|
37
87
|
## Quick start
|
|
38
88
|
|
|
39
|
-
With
|
|
40
|
-
login`, plus your AI CLI's own login), install PR Warden with Homebrew on macOS or
|
|
41
|
-
Linux, or with [pipx](https://pipx.pypa.io/) anywhere Python 3.9 runs, and set it
|
|
42
|
-
up:
|
|
89
|
+
With PR Warden [installed](#install), run:
|
|
43
90
|
|
|
44
91
|
```sh
|
|
45
|
-
brew install bruha/tap/prwarden # or: pipx install prwarden
|
|
46
92
|
prwarden setup
|
|
47
93
|
```
|
|
48
94
|
|
|
49
|
-
`prwarden setup`
|
|
50
|
-
|
|
95
|
+
`prwarden setup` first checks GitHub CLI and the AI CLIs PR Warden can drive,
|
|
96
|
+
Kiro CLI, Claude Code, Codex, and Antigravity, and shows which are installed and
|
|
97
|
+
signed in. It offers to install what is missing, with Homebrew on macOS and the
|
|
98
|
+
vendor's own installer otherwise, showing each command and running it only when you
|
|
99
|
+
agree, and then runs each tool's own sign-in. Then it asks which GitHub account
|
|
100
|
+
reviews, which AI CLI reviews and which verifies, and which repositories to watch. A repository you have no clone of is
|
|
51
101
|
cloned by PR Warden on its first review; setup says where, and roughly how large,
|
|
52
|
-
before you agree.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
102
|
+
before you agree.
|
|
103
|
+
|
|
104
|
+
It then asks whether the reviews of your own pull requests, which GitHub does not
|
|
105
|
+
let you approve, should go to Slack. Without a webhook yet, it opens Slack's page
|
|
106
|
+
for a new app already filled in: pick the workspace and the channel, and paste the
|
|
107
|
+
webhook URL Slack shows. Setup sends a test message through it before keeping it,
|
|
108
|
+
and asks which repositories report there, so a repository whose team is in another
|
|
109
|
+
workspace stays out of it. `prwarden setup --slack` does this step alone later.
|
|
110
|
+
|
|
111
|
+
Setup writes `.env` and `repositories.json` to `~/.config/prwarden`, then offers a
|
|
112
|
+
dry-run preview of one pull request, which spends credits and posts nothing, live
|
|
113
|
+
delivery, and a schedule. `prwarden doctor` checks the result at any time and
|
|
114
|
+
spends nothing.
|
|
56
115
|
|
|
57
116
|
### By hand, or from a clone
|
|
58
117
|
|
|
@@ -110,7 +169,7 @@ account's own pull requests, so a separate reviewer account works best.
|
|
|
110
169
|
or a compatible custom command
|
|
111
170
|
- A Slack incoming webhook when reviewing your own pull requests or sending
|
|
112
171
|
failure and manual-review notifications, unless every repository is kept out of
|
|
113
|
-
Slack
|
|
172
|
+
Slack; `prwarden setup` walks you through making one
|
|
114
173
|
|
|
115
174
|
No third-party Python packages are required.
|
|
116
175
|
|
prwarden-2.3.0/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.3.0
|
|
@@ -14,7 +14,7 @@ from dataclasses import dataclass
|
|
|
14
14
|
from pathlib import Path
|
|
15
15
|
from typing import Callable, List, Optional, Sequence
|
|
16
16
|
|
|
17
|
-
from . import __version__, github, schedule
|
|
17
|
+
from . import __version__, github, schedule, tools
|
|
18
18
|
from .commands import CommandError, run_cmd
|
|
19
19
|
from .config import ConfigError, Settings, default_locations, load_settings
|
|
20
20
|
from .paths import LAYOUT_CHECKOUT, LAYOUT_HOME, Locations
|
|
@@ -60,7 +60,14 @@ def check_env_file(env_file: Path) -> List[Check]:
|
|
|
60
60
|
return [Check(OK, f"{_home_relative(env_file)} is private (0600)")]
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
def check_engines(
|
|
63
|
+
def check_engines(
|
|
64
|
+
settings: Settings, states: "Sequence[tools.ToolState]" = ()
|
|
65
|
+
) -> List[Check]:
|
|
66
|
+
"""Check that every configured engine's CLI is there and signed in."""
|
|
67
|
+
|
|
68
|
+
signed_in = {
|
|
69
|
+
state.tool.engine: state for state in states if state.tool.engine
|
|
70
|
+
}
|
|
64
71
|
roles = (
|
|
65
72
|
("review", settings.review_engine, settings.review_engine_command),
|
|
66
73
|
("verify", settings.verify_engine, settings.verify_engine_command),
|
|
@@ -80,12 +87,26 @@ def check_engines(settings: Settings) -> List[Check]:
|
|
|
80
87
|
found = executable if os.access(executable, os.X_OK) else None
|
|
81
88
|
else:
|
|
82
89
|
found = shutil.which(executable)
|
|
83
|
-
if found:
|
|
84
|
-
checks.append(Check(OK, f"{role} engine {engine}: {found}"))
|
|
85
|
-
else:
|
|
90
|
+
if not found:
|
|
86
91
|
checks.append(
|
|
87
92
|
Check(PROBLEM, f"{role} engine {engine}: {executable} was not found")
|
|
88
93
|
)
|
|
94
|
+
continue
|
|
95
|
+
state = signed_in.get(engine)
|
|
96
|
+
if state is not None and state.signed_in is False:
|
|
97
|
+
login = " ".join([state.tool.command, *state.tool.login])
|
|
98
|
+
checks.append(
|
|
99
|
+
Check(
|
|
100
|
+
PROBLEM,
|
|
101
|
+
f"{role} engine {engine} is not signed in; sign in with: {login}",
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
elif state is not None and state.signed_in is None:
|
|
105
|
+
checks.append(
|
|
106
|
+
Check(NOTE, f"{role} engine {engine}: could not tell if signed in")
|
|
107
|
+
)
|
|
108
|
+
else:
|
|
109
|
+
checks.append(Check(OK, f"{role} engine {engine}: {found}"))
|
|
89
110
|
return checks
|
|
90
111
|
|
|
91
112
|
|
|
@@ -143,12 +164,22 @@ def check_delivery(settings: Settings, locations: Locations) -> List[Check]:
|
|
|
143
164
|
else:
|
|
144
165
|
checks.append(Check(OK, "live delivery is enabled; runs with --live post"))
|
|
145
166
|
slack = [repository for repository in settings.repositories if repository.slack]
|
|
167
|
+
total = len(settings.repositories)
|
|
146
168
|
if slack and not settings.slack_webhook_url:
|
|
147
169
|
checks.append(
|
|
148
170
|
Check(
|
|
149
171
|
NOTE,
|
|
150
172
|
f"no SLACK_WEBHOOK_URL, so {len(slack)} repositories with Slack on "
|
|
151
|
-
|
|
173
|
+
"report only to the terminal; connect Slack with `prwarden setup "
|
|
174
|
+
'--slack`, or set "slack": false to say so',
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
elif settings.slack_webhook_url:
|
|
178
|
+
checks.append(
|
|
179
|
+
Check(
|
|
180
|
+
OK,
|
|
181
|
+
f"Slack: {len(slack)} of {total} repositories report to the webhook; "
|
|
182
|
+
"`prwarden setup --slack` replaces it",
|
|
152
183
|
)
|
|
153
184
|
)
|
|
154
185
|
return checks
|
|
@@ -191,6 +222,8 @@ def diagnose(env_file: Optional[Path]) -> "tuple[List[str], List[Check]]":
|
|
|
191
222
|
f" state {_home_relative(locations.state_directory)}",
|
|
192
223
|
f" managed clones {_home_relative(locations.checkouts_directory)}",
|
|
193
224
|
]
|
|
225
|
+
states = tools.check_all()
|
|
226
|
+
header += [f" {line}" for line in tools.render_table(states)]
|
|
194
227
|
checks = check_env_file(env_file or locations.env_file)
|
|
195
228
|
if any(check.status == PROBLEM for check in checks):
|
|
196
229
|
return header, checks
|
|
@@ -198,7 +231,7 @@ def diagnose(env_file: Optional[Path]) -> "tuple[List[str], List[Check]]":
|
|
|
198
231
|
settings = load_settings(env_file)
|
|
199
232
|
except (ConfigError, CommandError) as error:
|
|
200
233
|
return header, checks + [Check(PROBLEM, str(error))]
|
|
201
|
-
checks += check_engines(settings)
|
|
234
|
+
checks += check_engines(settings, states)
|
|
202
235
|
github_checks = check_github(settings)
|
|
203
236
|
checks += github_checks
|
|
204
237
|
if all(check.status != PROBLEM for check in github_checks):
|
|
@@ -1841,11 +1841,8 @@ def _process_owner() -> Optional[str]:
|
|
|
1841
1841
|
return None
|
|
1842
1842
|
|
|
1843
1843
|
|
|
1844
|
-
def
|
|
1845
|
-
|
|
1846
|
-
additions: Optional[Mapping[str, str]] = None,
|
|
1847
|
-
) -> dict[str, str]:
|
|
1848
|
-
"""Return the scrubbed environment for one engine invocation.
|
|
1844
|
+
def scrubbed_environment(names: Sequence[str] = ()) -> dict[str, str]:
|
|
1845
|
+
"""Return the few variables an authenticated CLI needs, and ``names``.
|
|
1849
1846
|
|
|
1850
1847
|
A scheduled run inherits far less than an interactive shell. launchd and cron
|
|
1851
1848
|
supply no USER or LOGNAME, and an authenticated CLI that resolves its stored
|
|
@@ -1864,15 +1861,23 @@ def build_engine_environment(
|
|
|
1864
1861
|
"USER",
|
|
1865
1862
|
"LOGNAME",
|
|
1866
1863
|
"SHELL",
|
|
1864
|
+
*names,
|
|
1867
1865
|
)
|
|
1868
1866
|
environment = {name: os.environ[name] for name in safe_names if name in os.environ}
|
|
1869
1867
|
account = environment.get("USER") or environment.get("LOGNAME") or _process_owner()
|
|
1870
1868
|
if account:
|
|
1871
1869
|
environment.setdefault("USER", account)
|
|
1872
1870
|
environment.setdefault("LOGNAME", account)
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1871
|
+
return environment
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
def build_engine_environment(
|
|
1875
|
+
settings: Settings,
|
|
1876
|
+
additions: Optional[Mapping[str, str]] = None,
|
|
1877
|
+
) -> dict[str, str]:
|
|
1878
|
+
"""Return the scrubbed environment for one engine invocation."""
|
|
1879
|
+
|
|
1880
|
+
environment = scrubbed_environment(settings.review_engine_env_allowlist)
|
|
1876
1881
|
if additions:
|
|
1877
1882
|
environment.update(additions)
|
|
1878
1883
|
return environment
|