bricksentry 0.1.6__tar.gz → 0.1.8__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.
- {bricksentry-0.1.6 → bricksentry-0.1.8}/CHANGELOG.md +19 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/PKG-INFO +44 -7
- {bricksentry-0.1.6 → bricksentry-0.1.8}/README.md +43 -6
- bricksentry-0.1.8/packages/bricksentry-mcp/LICENSE +202 -0
- bricksentry-0.1.8/packages/bricksentry-mcp/README.md +32 -0
- bricksentry-0.1.8/packages/bricksentry-mcp/src/bricksentry_mcp/__init__.py +5 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/pyproject.toml +1 -1
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/__init__.py +1 -1
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/agent_tools.py +1 -1
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/assess.py +3 -2
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/cli.py +58 -6
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/config.py +69 -1
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/demo.py +6 -4
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/explain.py +7 -2
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/mcp_server.py +10 -2
- bricksentry-0.1.8/src/bricksentry/measures.py +63 -0
- bricksentry-0.1.8/src/bricksentry/notify.py +362 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/policy.py +9 -2
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/policy_templates.py +21 -0
- bricksentry-0.1.8/tests/test_018.py +288 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/tests/test_notify_templates.py +86 -0
- bricksentry-0.1.6/src/bricksentry/notify.py +0 -156
- {bricksentry-0.1.6 → bricksentry-0.1.8}/.gitignore +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/CONTRIBUTING.md +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/LICENSE +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/SECURITY.md +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/action.yml +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/examples/databricks/bricksentry.yml +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/examples/databricks/bricksentry_quickstart.ipynb +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/examples/databricks/bricksentry_quickstart.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/examples/databricks/github-workflow.yml +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/examples/databricks/policy.yml +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/examples/demo/agent_loop_demo.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/scripts/build_notebook.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/backends/__init__.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/backends/base.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/backends/databricks_backend.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/backends/duckdb_backend.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/changes.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/diff.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/github.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/lineage.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/models.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/preview.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/py.typed +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/src/bricksentry/report.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/tests/conftest.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/tests/test_assess_policy.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/tests/test_databricks_and_uc.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/tests/test_demo.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/tests/test_diff.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/tests/test_notebook.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/tests/test_preview_agents.py +0 -0
- {bricksentry-0.1.6 → bricksentry-0.1.8}/tests/test_sample_guard_and_store.py +0 -0
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.8 (2026-11-11)
|
|
4
|
+
|
|
5
|
+
From the first real Slack alert sent from a Databricks workspace:
|
|
6
|
+
|
|
7
|
+
- Totals checks skip columns where a total means nothing. `numeric-total-moved` and diff summaries now ignore keys and columns that look like IDs, codes, years and other date parts, coordinates, ratings, scores or rates, so a real move in `sum(bed_count)` is no longer buried under `sum(established_year)`. Choose exactly with `measures: [...]` per table, or `measures: all` for the old behaviour. Rules that name a column still check it.
|
|
8
|
+
- Slack alerts can @-mention reviewers: map owners to Slack member or group ids under `notify.mentions`.
|
|
9
|
+
- Alerts link back to the run: the Databricks job run when the check runs in a job (new), the PR or Actions run in GitHub, or any URL in `BRICKSENTRY_RUN_URL` / `notify.run_url`.
|
|
10
|
+
- New `bricksentry test-alert` sends a clearly labelled sample alert to check the webhook setup (`--verdict`, `--owner`). Exits 1 if delivery fails.
|
|
11
|
+
- More robust delivery: one retry when Slack or Teams answers 429 or 5xx or the connection fails; clear messages for revoked webhooks (404/410); the webhook URL never appears in an error; Slack text is escaped so table names or values can't break or inject formatting; long reasons are clipped. Teams cards use plain text runs, so names like `my_table_name` show exactly. Bad `notify.on` or `mentions` values give a clear error.
|
|
12
|
+
- Config typos are reported. Unknown keys in bricksentry.yml (top level, `tables`, `notify`, `lineage`) print a warning with the closest valid key; also warns about tables without keys, short table names on Databricks, and webhook URLs written into the file.
|
|
13
|
+
- `bricksentry-mcp --help` shows `Usage: bricksentry-mcp [OPTIONS]`, and the MCP server reports the bricksentry version to clients (the version used to be empty).
|
|
14
|
+
|
|
15
|
+
## 0.1.7 (2026-11-11)
|
|
16
|
+
|
|
17
|
+
- New companion package `bricksentry-mcp`: `uvx bricksentry-mcp --config /full/path/bricksentry.yml` starts the MCP server with everything it needs. Before, `uvx bricksentry mcp` installed the package without its MCP extra and failed, and that is what MCP Registry clients ran. The registry listing now points at `bricksentry-mcp`.
|
|
18
|
+
- Setup docs for Claude Code, the Claude desktop app and Cursor now use full config paths, which clients need because they start the server from their own folder.
|
|
19
|
+
- `run_demo()` called from Python without DuckDB now raises one clear ImportError with the install command, instead of a CLI error with a traceback (reported in a Databricks notebook test).
|
|
20
|
+
- New `agent-safe` policy template for changes written by AI agents.
|
|
21
|
+
|
|
3
22
|
## 0.1.6 (2026-11-11)
|
|
4
23
|
|
|
5
24
|
- Slack and Teams alerts. Set `notify:` in bricksentry.yml (or `BRICKSENTRY_SLACK_WEBHOOK` / `BRICKSENTRY_TEAMS_WEBHOOK`) and `assess` / `preview` post the verdict, the rules that fired, the reviewers and a PR link when the verdict reaches `notify.on` (default `needs_human`). `--no-notify` turns it off; `Sentry.notify()` does it from Python; the GitHub Action takes `slack-webhook`, `teams-webhook` and `notify-on`. A failed webhook never changes the verdict.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bricksentry
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: Change-safety for Databricks pipelines and the AI agents that edit them: data diffs, Unity Catalog blast radius, policy verdicts and rollback plans.
|
|
5
5
|
Project-URL: Homepage, https://bricksentry.org
|
|
6
6
|
Project-URL: Documentation, https://bricksentry.org/docs
|
|
@@ -107,11 +107,30 @@ AI now writes much of our pipeline code, and checking what that code does to the
|
|
|
107
107
|
|
|
108
108
|
## For AI agents: the MCP server
|
|
109
109
|
|
|
110
|
+
The quickest way to connect an agent is the `bricksentry-mcp` package, which installs bricksentry with its MCP and Databricks extras. With [uv](https://docs.astral.sh/uv/) there is nothing to install first:
|
|
111
|
+
|
|
110
112
|
```bash
|
|
111
|
-
|
|
112
|
-
claude mcp add bricksentry -- bricksentry
|
|
113
|
+
# Claude Code
|
|
114
|
+
claude mcp add bricksentry -- uvx bricksentry-mcp --config /full/path/to/bricksentry.yml
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"mcpServers": {
|
|
120
|
+
"bricksentry": {
|
|
121
|
+
"command": "uvx",
|
|
122
|
+
"args": ["bricksentry-mcp", "--config", "/full/path/to/bricksentry.yml"]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
113
126
|
```
|
|
114
127
|
|
|
128
|
+
The JSON works for the Claude desktop app, Cursor and other MCP clients. Use a **full path** to `bricksentry.yml`, because clients start the server from their own working folder. If an app can't find `uvx`, use its full path (`which uvx`). To share the setup through a repo, `claude mcp add -s project ...` writes it to `.mcp.json`; a relative path then works when Claude Code starts from the repo root. No config yet? `uvx --from bricksentry bricksentry init` writes a starter one.
|
|
129
|
+
|
|
130
|
+
Already installed bricksentry with pip? `pip install "bricksentry[mcp,databricks]"` and run `bricksentry mcp --config /full/path/to/bricksentry.yml` instead. Add `--transport streamable-http` for remote agents.
|
|
131
|
+
|
|
132
|
+
bricksentry is listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.bricksentry/bricksentry) as `io.github.bricksentry/bricksentry`.
|
|
133
|
+
|
|
115
134
|
| Tool | What the agent gets |
|
|
116
135
|
|---|---|
|
|
117
136
|
| `whats_downstream(table, depth)` | Downstream assets with owners and tags. Call it *before* editing. |
|
|
@@ -175,7 +194,7 @@ Check out with `fetch-depth: 0` and give the job `pull-requests: write` permissi
|
|
|
175
194
|
Or use the bundled GitHub Action, which also writes the report to the job summary:
|
|
176
195
|
|
|
177
196
|
```yaml
|
|
178
|
-
- uses: bricksentry/bricksentry@v0.1.
|
|
197
|
+
- uses: bricksentry/bricksentry@v0.1.8
|
|
179
198
|
with:
|
|
180
199
|
config: bricksentry.yml
|
|
181
200
|
fail-on: needs_human
|
|
@@ -200,7 +219,7 @@ jobs:
|
|
|
200
219
|
fetch-depth: 0
|
|
201
220
|
# Build this PR's version of your pipeline into a per-PR schema first,
|
|
202
221
|
# for example: databricks bundle deploy -t ci && databricks bundle run -t ci
|
|
203
|
-
- uses: bricksentry/bricksentry@v0.1.
|
|
222
|
+
- uses: bricksentry/bricksentry@v0.1.8
|
|
204
223
|
with:
|
|
205
224
|
config: bricksentry.yml
|
|
206
225
|
fail-on: needs_human
|
|
@@ -217,7 +236,7 @@ To make the check binding, mark this job as a required status check in your bran
|
|
|
217
236
|
|
|
218
237
|
### Alerts in Slack and Teams
|
|
219
238
|
|
|
220
|
-
When the verdict is `needs_human` or worse, bricksentry can post a short alert: the verdict, the rules that fired, who should review, and a link to the
|
|
239
|
+
When the verdict is `needs_human` or worse, bricksentry can post a short alert: the verdict, the rules that fired, who should review, and a link back to where the check ran.
|
|
221
240
|
|
|
222
241
|
```yaml
|
|
223
242
|
# bricksentry.yml
|
|
@@ -225,9 +244,21 @@ notify:
|
|
|
225
244
|
on: needs_human # alert at this verdict or worse
|
|
226
245
|
slack_webhook: env:SLACK_WEBHOOK_URL # Slack incoming webhook
|
|
227
246
|
teams_webhook: env:TEAMS_WEBHOOK_URL # Teams Workflows "webhook request" URL
|
|
247
|
+
mentions: # optional: @-mention reviewers in Slack
|
|
248
|
+
finance-analytics: S0123ABCD # a user group id (starts with S)
|
|
249
|
+
jane@acme.com: U0456EFGH # a member id (starts with U)
|
|
228
250
|
```
|
|
229
251
|
|
|
230
|
-
|
|
252
|
+
Then check the setup with one command. It sends a clearly labelled sample alert and reads no tables:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
bricksentry test-alert
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
- **Keep webhook URLs secret.** Put them in CI secrets or environment variables (`BRICKSENTRY_SLACK_WEBHOOK` and `BRICKSENTRY_TEAMS_WEBHOOK` work too), never in the file; bricksentry warns if it finds one there.
|
|
259
|
+
- **Links back to the run.** In GitHub Actions the alert links to the PR or run. In a Databricks job it links to the job run. Anywhere else, set `BRICKSENTRY_RUN_URL` (or `notify.run_url`).
|
|
260
|
+
- **Mentions.** Owners come from Unity Catalog. Map them to Slack ids under `mentions` and the alert @-mentions them; unmapped owners are shown as text. Find an id in Slack under a person's profile or a user group's menu, "Copy member ID" / "Copy group ID".
|
|
261
|
+
- **Never breaks a run.** `assess` and `preview` send alerts automatically when a webhook is set (`--no-notify` turns them off); in Python call `sentry.notify(assessment)`. If Slack or Teams is busy the alert is retried once, a failure is reported without the webhook URL, and the verdict always stands.
|
|
231
262
|
|
|
232
263
|
## Python API
|
|
233
264
|
|
|
@@ -255,10 +286,15 @@ tables:
|
|
|
255
286
|
main.sales.orders:
|
|
256
287
|
keys: [order_id]
|
|
257
288
|
segment_by: [region]
|
|
289
|
+
measures: [amount, quantity] # totals worth checking (see below)
|
|
258
290
|
paths: ["src/pipelines/orders/**", "resources/orders_job.yml"]
|
|
259
291
|
policy: policy.yml # or builtin:<template>, see "Policy templates" below
|
|
260
292
|
```
|
|
261
293
|
|
|
294
|
+
Typos are caught: an unknown key such as `sample_pc` prints a warning that names the right one (`did you mean 'sample_pct'?`) instead of being silently ignored.
|
|
295
|
+
|
|
296
|
+
**Which totals are checked.** `sum_change_pct_gt` rules and summaries look at measures: by default every numeric column except keys and columns whose names look like IDs, codes, years and other date parts, coordinates, ratings, scores or rates (a 10% drop in `sum(established_year)` only says rows were removed). List `measures` for a table to choose exactly, or set `measures: all` to check every numeric column. A rule that names a column (`when: {column: rating, sum_change_pct_gt: 1}`) always checks it.
|
|
297
|
+
|
|
262
298
|
### Policy example
|
|
263
299
|
|
|
264
300
|
A small `policy.yml` with one rule per severity. `pass` is the default: a change gets it when no rule matches.
|
|
@@ -296,6 +332,7 @@ Start from a ready-made policy instead of writing one:
|
|
|
296
332
|
|
|
297
333
|
| Template | For |
|
|
298
334
|
|---|---|
|
|
335
|
+
| `agent-safe` | Changes written by AI agents: anything beyond a small, clean change goes to a human |
|
|
299
336
|
| `default` | Balanced: block duplicate keys, a human for row loss, dropped columns, PII and certified downstream |
|
|
300
337
|
| `strict` | Production-critical pipelines: small changes need a human, failed checks block |
|
|
301
338
|
| `pii` | Tables with personal data: any change to a `pii`-tagged table, or one feeding it, needs a human |
|
|
@@ -60,11 +60,30 @@ AI now writes much of our pipeline code, and checking what that code does to the
|
|
|
60
60
|
|
|
61
61
|
## For AI agents: the MCP server
|
|
62
62
|
|
|
63
|
+
The quickest way to connect an agent is the `bricksentry-mcp` package, which installs bricksentry with its MCP and Databricks extras. With [uv](https://docs.astral.sh/uv/) there is nothing to install first:
|
|
64
|
+
|
|
63
65
|
```bash
|
|
64
|
-
|
|
65
|
-
claude mcp add bricksentry -- bricksentry
|
|
66
|
+
# Claude Code
|
|
67
|
+
claude mcp add bricksentry -- uvx bricksentry-mcp --config /full/path/to/bricksentry.yml
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"bricksentry": {
|
|
74
|
+
"command": "uvx",
|
|
75
|
+
"args": ["bricksentry-mcp", "--config", "/full/path/to/bricksentry.yml"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
66
79
|
```
|
|
67
80
|
|
|
81
|
+
The JSON works for the Claude desktop app, Cursor and other MCP clients. Use a **full path** to `bricksentry.yml`, because clients start the server from their own working folder. If an app can't find `uvx`, use its full path (`which uvx`). To share the setup through a repo, `claude mcp add -s project ...` writes it to `.mcp.json`; a relative path then works when Claude Code starts from the repo root. No config yet? `uvx --from bricksentry bricksentry init` writes a starter one.
|
|
82
|
+
|
|
83
|
+
Already installed bricksentry with pip? `pip install "bricksentry[mcp,databricks]"` and run `bricksentry mcp --config /full/path/to/bricksentry.yml` instead. Add `--transport streamable-http` for remote agents.
|
|
84
|
+
|
|
85
|
+
bricksentry is listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.bricksentry/bricksentry) as `io.github.bricksentry/bricksentry`.
|
|
86
|
+
|
|
68
87
|
| Tool | What the agent gets |
|
|
69
88
|
|---|---|
|
|
70
89
|
| `whats_downstream(table, depth)` | Downstream assets with owners and tags. Call it *before* editing. |
|
|
@@ -128,7 +147,7 @@ Check out with `fetch-depth: 0` and give the job `pull-requests: write` permissi
|
|
|
128
147
|
Or use the bundled GitHub Action, which also writes the report to the job summary:
|
|
129
148
|
|
|
130
149
|
```yaml
|
|
131
|
-
- uses: bricksentry/bricksentry@v0.1.
|
|
150
|
+
- uses: bricksentry/bricksentry@v0.1.8
|
|
132
151
|
with:
|
|
133
152
|
config: bricksentry.yml
|
|
134
153
|
fail-on: needs_human
|
|
@@ -153,7 +172,7 @@ jobs:
|
|
|
153
172
|
fetch-depth: 0
|
|
154
173
|
# Build this PR's version of your pipeline into a per-PR schema first,
|
|
155
174
|
# for example: databricks bundle deploy -t ci && databricks bundle run -t ci
|
|
156
|
-
- uses: bricksentry/bricksentry@v0.1.
|
|
175
|
+
- uses: bricksentry/bricksentry@v0.1.8
|
|
157
176
|
with:
|
|
158
177
|
config: bricksentry.yml
|
|
159
178
|
fail-on: needs_human
|
|
@@ -170,7 +189,7 @@ To make the check binding, mark this job as a required status check in your bran
|
|
|
170
189
|
|
|
171
190
|
### Alerts in Slack and Teams
|
|
172
191
|
|
|
173
|
-
When the verdict is `needs_human` or worse, bricksentry can post a short alert: the verdict, the rules that fired, who should review, and a link to the
|
|
192
|
+
When the verdict is `needs_human` or worse, bricksentry can post a short alert: the verdict, the rules that fired, who should review, and a link back to where the check ran.
|
|
174
193
|
|
|
175
194
|
```yaml
|
|
176
195
|
# bricksentry.yml
|
|
@@ -178,9 +197,21 @@ notify:
|
|
|
178
197
|
on: needs_human # alert at this verdict or worse
|
|
179
198
|
slack_webhook: env:SLACK_WEBHOOK_URL # Slack incoming webhook
|
|
180
199
|
teams_webhook: env:TEAMS_WEBHOOK_URL # Teams Workflows "webhook request" URL
|
|
200
|
+
mentions: # optional: @-mention reviewers in Slack
|
|
201
|
+
finance-analytics: S0123ABCD # a user group id (starts with S)
|
|
202
|
+
jane@acme.com: U0456EFGH # a member id (starts with U)
|
|
181
203
|
```
|
|
182
204
|
|
|
183
|
-
|
|
205
|
+
Then check the setup with one command. It sends a clearly labelled sample alert and reads no tables:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
bricksentry test-alert
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- **Keep webhook URLs secret.** Put them in CI secrets or environment variables (`BRICKSENTRY_SLACK_WEBHOOK` and `BRICKSENTRY_TEAMS_WEBHOOK` work too), never in the file; bricksentry warns if it finds one there.
|
|
212
|
+
- **Links back to the run.** In GitHub Actions the alert links to the PR or run. In a Databricks job it links to the job run. Anywhere else, set `BRICKSENTRY_RUN_URL` (or `notify.run_url`).
|
|
213
|
+
- **Mentions.** Owners come from Unity Catalog. Map them to Slack ids under `mentions` and the alert @-mentions them; unmapped owners are shown as text. Find an id in Slack under a person's profile or a user group's menu, "Copy member ID" / "Copy group ID".
|
|
214
|
+
- **Never breaks a run.** `assess` and `preview` send alerts automatically when a webhook is set (`--no-notify` turns them off); in Python call `sentry.notify(assessment)`. If Slack or Teams is busy the alert is retried once, a failure is reported without the webhook URL, and the verdict always stands.
|
|
184
215
|
|
|
185
216
|
## Python API
|
|
186
217
|
|
|
@@ -208,10 +239,15 @@ tables:
|
|
|
208
239
|
main.sales.orders:
|
|
209
240
|
keys: [order_id]
|
|
210
241
|
segment_by: [region]
|
|
242
|
+
measures: [amount, quantity] # totals worth checking (see below)
|
|
211
243
|
paths: ["src/pipelines/orders/**", "resources/orders_job.yml"]
|
|
212
244
|
policy: policy.yml # or builtin:<template>, see "Policy templates" below
|
|
213
245
|
```
|
|
214
246
|
|
|
247
|
+
Typos are caught: an unknown key such as `sample_pc` prints a warning that names the right one (`did you mean 'sample_pct'?`) instead of being silently ignored.
|
|
248
|
+
|
|
249
|
+
**Which totals are checked.** `sum_change_pct_gt` rules and summaries look at measures: by default every numeric column except keys and columns whose names look like IDs, codes, years and other date parts, coordinates, ratings, scores or rates (a 10% drop in `sum(established_year)` only says rows were removed). List `measures` for a table to choose exactly, or set `measures: all` to check every numeric column. A rule that names a column (`when: {column: rating, sum_change_pct_gt: 1}`) always checks it.
|
|
250
|
+
|
|
215
251
|
### Policy example
|
|
216
252
|
|
|
217
253
|
A small `policy.yml` with one rule per severity. `pass` is the default: a change gets it when no rule matches.
|
|
@@ -249,6 +285,7 @@ Start from a ready-made policy instead of writing one:
|
|
|
249
285
|
|
|
250
286
|
| Template | For |
|
|
251
287
|
|---|---|
|
|
288
|
+
| `agent-safe` | Changes written by AI agents: anything beyond a small, clean change goes to a human |
|
|
252
289
|
| `default` | Balanced: block duplicate keys, a human for row loss, dropped columns, PII and certified downstream |
|
|
253
290
|
| `strict` | Production-critical pipelines: small changes need a human, failed checks block |
|
|
254
291
|
| `pii` | Tables with personal data: any change to a `pii`-tagged table, or one feeding it, needs a human |
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# bricksentry-mcp
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.bricksentry/bricksentry -->
|
|
4
|
+
|
|
5
|
+
The MCP server for [bricksentry](https://github.com/bricksentry/bricksentry), the safety check for data changes in the AI era. This package only installs `bricksentry` with its MCP and Databricks extras and gives you one command, so agents can start the server with `uvx`:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uvx bricksentry-mcp --config /full/path/to/bricksentry.yml
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Claude Code**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
claude mcp add bricksentry -- uvx bricksentry-mcp --config /full/path/to/bricksentry.yml
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Claude desktop, Cursor and other clients** (`mcpServers` config):
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"bricksentry": {
|
|
23
|
+
"command": "uvx",
|
|
24
|
+
"args": ["bricksentry-mcp", "--config", "/full/path/to/bricksentry.yml"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use a full path to `bricksentry.yml`: clients start the server from their own working folder. If an app can't find `uvx`, use its full path (`which uvx`).
|
|
31
|
+
|
|
32
|
+
`bricksentry-mcp` accepts the same options as `bricksentry mcp`, for example `--transport streamable-http`. Docs: [bricksentry.org/docs/agents](https://bricksentry.org/docs/agents). License: Apache-2.0.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "bricksentry"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.8"
|
|
8
8
|
description = "Change-safety for Databricks pipelines and the AI agents that edit them: data diffs, Unity Catalog blast radius, policy verdicts and rollback plans."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -163,7 +163,7 @@ def explain_diff(
|
|
|
163
163
|
d = s.get_diff(table)
|
|
164
164
|
if d is None:
|
|
165
165
|
return {"error": f"no diff for {table} yet; call assess_change or preview_write first"}
|
|
166
|
-
return {"table": table, "explanation": _explain_diff(d)}
|
|
166
|
+
return {"table": table, "explanation": _explain_diff(d, s.config.spec(table).measures)}
|
|
167
167
|
return {"error": "pass assessment_id or table"}
|
|
168
168
|
|
|
169
169
|
|
|
@@ -102,8 +102,9 @@ class Sentry:
|
|
|
102
102
|
nodes = []
|
|
103
103
|
err = err or f"lineage lookup failed: {e}"
|
|
104
104
|
owner, tags = self.lineage.owner_and_tags(table)
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
measures = self.config.spec(table).measures
|
|
106
|
+
verdict, hits = self.policy.evaluate(table, diff, nodes, tags, diff_error=err, measures=measures)
|
|
107
|
+
summary = (explain_diff(diff, measures) if diff else f"{table}: diff unavailable ({err}).") + " " + explain_impact(table, nodes)
|
|
107
108
|
ta = TableAssessment(
|
|
108
109
|
table=table,
|
|
109
110
|
diff=diff,
|
|
@@ -18,10 +18,17 @@ from bricksentry.config import Config
|
|
|
18
18
|
from bricksentry.models import Verdict
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
def _config(config_path) -> Config:
|
|
22
|
+
cfg = Config.load(config_path, warn=False)
|
|
23
|
+
for w in cfg.warnings:
|
|
24
|
+
click.echo(click.style("warning: ", fg="yellow") + w, err=True)
|
|
25
|
+
return cfg
|
|
26
|
+
|
|
27
|
+
|
|
21
28
|
def _sentry(config_path):
|
|
22
29
|
from bricksentry.assess import Sentry
|
|
23
30
|
|
|
24
|
-
return Sentry(
|
|
31
|
+
return Sentry(_config(config_path))
|
|
25
32
|
|
|
26
33
|
|
|
27
34
|
def _emit(obj, fmt: str, markdown_fn=None):
|
|
@@ -65,7 +72,7 @@ def diff(base, candidate, keys, sample_pct, fmt, config_path):
|
|
|
65
72
|
|
|
66
73
|
s = _sentry(config_path)
|
|
67
74
|
d = s.diff(base, candidate, keys=list(keys) or None, table=base, sample_pct=sample_pct)
|
|
68
|
-
_emit(d.to_dict() if fmt == "json" else explain_diff(d), fmt)
|
|
75
|
+
_emit(d.to_dict() if fmt == "json" else explain_diff(d, s.config.spec(base).measures), fmt)
|
|
69
76
|
|
|
70
77
|
|
|
71
78
|
@main.command()
|
|
@@ -180,7 +187,10 @@ def demo(report_path):
|
|
|
180
187
|
"""Run the agent safety loop on a local 20,000-row example (needs bricksentry[duckdb])."""
|
|
181
188
|
from bricksentry.demo import run_demo
|
|
182
189
|
|
|
183
|
-
|
|
190
|
+
try:
|
|
191
|
+
run_demo(report_path)
|
|
192
|
+
except ImportError as e:
|
|
193
|
+
raise click.ClickException(str(e)) from e
|
|
184
194
|
|
|
185
195
|
|
|
186
196
|
@main.command()
|
|
@@ -217,10 +227,13 @@ candidate_pattern: "{catalog}.{schema}_pr_{pr}.{table}"
|
|
|
217
227
|
# sample_pct: 10 # diff a deterministic 10% key sample on big tables
|
|
218
228
|
|
|
219
229
|
# Optional Slack / Teams alerts. Keep webhook URLs in environment variables or CI secrets.
|
|
230
|
+
# Test with: bricksentry test-alert
|
|
220
231
|
# notify:
|
|
221
232
|
# on: needs_human
|
|
222
233
|
# slack_webhook: env:SLACK_WEBHOOK_URL
|
|
223
234
|
# teams_webhook: env:TEAMS_WEBHOOK_URL
|
|
235
|
+
# mentions: # owner -> Slack id, so reviewers get @-mentioned
|
|
236
|
+
# finance-analytics: S0123ABCD
|
|
224
237
|
|
|
225
238
|
lineage:
|
|
226
239
|
depth: 3
|
|
@@ -230,6 +243,7 @@ tables:
|
|
|
230
243
|
main.sales.orders:
|
|
231
244
|
keys: [order_id]
|
|
232
245
|
segment_by: [region]
|
|
246
|
+
measures: [amount, quantity] # totals worth checking; IDs, years and ratings are skipped by default
|
|
233
247
|
paths: ["src/pipelines/orders/**", "resources/orders_job.yml"]
|
|
234
248
|
|
|
235
249
|
policy: policy.yml
|
|
@@ -289,10 +303,38 @@ def policies(name):
|
|
|
289
303
|
click.echo("\nUse one with `policy: builtin:<name>` in bricksentry.yml, or `bricksentry init --policy <name>`.")
|
|
290
304
|
|
|
291
305
|
|
|
292
|
-
|
|
293
|
-
|
|
306
|
+
@main.command("test-alert")
|
|
307
|
+
@click.option("--verdict", type=click.Choice([v.value for v in Verdict]), default="needs_human", show_default=True,
|
|
308
|
+
help="Verdict of the sample alert")
|
|
309
|
+
@click.option("--owner", default=None,
|
|
310
|
+
help="Reviewer to show. Use a name from notify.mentions to check that @-mentions work.")
|
|
311
|
+
@config_opt
|
|
312
|
+
def test_alert(verdict, owner, config_path):
|
|
313
|
+
"""Send a clearly labelled sample alert to your Slack / Teams webhooks.
|
|
314
|
+
|
|
315
|
+
Reads no tables. Exits 1 if a webhook failed or none is configured."""
|
|
316
|
+
from bricksentry.notify import NotifySettings, sample_assessment, send
|
|
317
|
+
|
|
318
|
+
cfg = _config(config_path)
|
|
319
|
+
try:
|
|
320
|
+
settings = NotifySettings.from_config(cfg.notify)
|
|
321
|
+
except ValueError as e:
|
|
322
|
+
raise click.UsageError(str(e)) from e
|
|
323
|
+
if not settings.enabled:
|
|
324
|
+
raise click.ClickException(
|
|
325
|
+
"no webhook configured: set BRICKSENTRY_SLACK_WEBHOOK or BRICKSENTRY_TEAMS_WEBHOOK, "
|
|
326
|
+
"or add notify: to bricksentry.yml"
|
|
327
|
+
)
|
|
328
|
+
lines = send(sample_assessment(Verdict(verdict), owner), settings, force=True)
|
|
329
|
+
for line in lines:
|
|
330
|
+
click.echo(line)
|
|
331
|
+
if any(not line.endswith(": sent") for line in lines):
|
|
332
|
+
sys.exit(1)
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def _run(cmd: click.Command, prog_name: str | None = None) -> None:
|
|
294
336
|
try:
|
|
295
|
-
main(standalone_mode=False)
|
|
337
|
+
cmd.main(prog_name=prog_name, standalone_mode=False)
|
|
296
338
|
except click.exceptions.Exit as e:
|
|
297
339
|
sys.exit(e.exit_code)
|
|
298
340
|
except click.ClickException as e:
|
|
@@ -307,5 +349,15 @@ def entry() -> None:
|
|
|
307
349
|
sys.exit(2)
|
|
308
350
|
|
|
309
351
|
|
|
352
|
+
def entry() -> None:
|
|
353
|
+
"""Console entry point: turn unexpected errors into a clean message and exit code 2."""
|
|
354
|
+
_run(main)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def mcp_entry() -> None:
|
|
358
|
+
"""Console entry for the ``bricksentry-mcp`` package: same as ``bricksentry mcp``."""
|
|
359
|
+
_run(mcp, prog_name="bricksentry-mcp")
|
|
360
|
+
|
|
361
|
+
|
|
310
362
|
if __name__ == "__main__": # pragma: no cover
|
|
311
363
|
entry()
|