cassis-cli 3.8.0__tar.gz → 3.9.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.
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/PKG-INFO +8 -2
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/README.md +7 -1
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/api.py +68 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/issues.py +134 -1
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/pyproject.toml +1 -1
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/LICENSE +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/NOTICE +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/__init__.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/auth.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/chats.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/common.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/credentials.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/dbt.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/eval.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/guide.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/main.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/ontology.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/ontology_design_guide.md +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/projects.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/schema.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/schema_plan.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/status.py +0 -0
- {cassis_cli-3.8.0 → cassis_cli-3.9.0}/cassis_cli/verify.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cassis-cli
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.9.0
|
|
4
4
|
Summary: Validate, test and evaluate your Cassis context from your terminal, then publish it
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -46,7 +46,7 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
|
|
|
46
46
|
- DDL imports describe one schema snapshot/export file, including ordinary and materialized views; they do not replay incremental migrations. Extraction diagnostics include object names and statement locations. If extraction is incomplete, `schema plan` and `--dry-run` show the extracted inventory and exit 1; `apply`, `push`, and `--write-checkout` cannot save that result. Unknown column types are warnings when all output names are known. Plans also show object-kind, view-definition, comment, and constraint changes. `--json` preserves structured diagnostics and the server-capped inventory.
|
|
47
47
|
|
|
48
48
|
- `cassis status` shows the project's published version (number, label, git commit), whether unpublished changes await publication, the git-sync binding, a schema plan waiting to be applied, and how your local git HEAD relates to the published commit (in sync / N commits ahead / diverged). `cassis status --watch` polls until the published commit matches your local HEAD (e.g. right after merging a PR whose CI publishes the context) instead of watching the GitHub Actions tab.
|
|
49
|
-
- `cassis issues` triages the issues Cassis raised on the project (what it found wrong while answering questions: a context gap, missing data) without leaving the checkout: `issues list` (filterable by status, impact, cause and context domain, and showing each issue's domain so you can work through one domain at a time; and each issue's reach, the chat answers that used its context tables in the last 30 days), `issues show <id>` for the diagnosis, suggested action, the occurrences behind it, its reach and evidence (removed from dbt, an AI review suggestion, user feedback, a failed eval, or the chat analysis), `issues evidence <id> <occurrence-id>` for what the agent actually saw, and `issues resolve` / `dismiss` / `reopen` once you've acted on it. When the fix ships through a pull request, write the `PR mention:` line `issues show` prints (`Resolves <id>`) in the PR description instead: Cassis resolves the issue when the PR merges, and `issues show` then reports how it was closed and through which PR.
|
|
49
|
+
- `cassis issues` triages the issues Cassis raised on the project (what it found wrong while answering questions: a context gap, missing data) without leaving the checkout: `issues list` (filterable by status, impact, cause and context domain, and showing each issue's domain so you can work through one domain at a time; and each issue's reach, the chat answers that used its context tables in the last 30 days), `issues show <id>` for the diagnosis, suggested action, the occurrences behind it, its reach and evidence (removed from dbt, an AI review suggestion, user feedback, a failed eval, or the chat analysis), `issues evidence <id> <occurrence-id>` for what the agent actually saw, and `issues resolve` / `dismiss` / `reopen` once you've acted on it. When the fix ships through a pull request, write the `PR mention:` line `issues show` prints (`Resolves <id>`) in the PR description instead: Cassis resolves the issue when the PR merges, and `issues show` then reports how it was closed and through which PR. `issues tables` lists the warehouse tables users asked for that the context does not describe: one line per table, the most asked first, with a suggested domain. These requests are not issues, so `issues list` does not print them. `issues tables set-aside <TABLE>` records a table the team will not add; a table you add leaves the list on its own once published.
|
|
50
50
|
- `cassis dbt push` sends your dbt project's artifacts (`target/manifest.json`, and `catalog.json` when present) to Cassis from the dbt project's CI, with the commit they were built from. Cassis checks the files, matches each dbt model, seed, snapshot and source to a table of the project's data source, and keeps the upload as the project's dbt baseline unless a newer one is already there. The command prints how many relations matched and how many tests they declare. Cassis compares the upload with the previous baseline and saves findings about the context the merged change puts in doubt for grouping and issue curation. The command distinguishes findings awaiting curation from published issues, printing the source observation for pending findings and links for published issues. Nothing the agent answers with changes.
|
|
51
51
|
- `cassis dbt check` runs the same comparison on a pull request, before the change merges: it uploads the PR's artifacts (after `dbt compile` on the production target), compares them with the baseline, and prints the context tables, columns, joins and metrics the change puts in doubt, with why it matters and the context change to make. Each finding also says its **reach**, how many chat answers used its context tables in the last 30 days, and within each section the most-reached objects print first, the order the Review page will show them in. Findings are advisory: nothing is filed, the baseline doesn't move, and the check exits 0 with or without findings.
|
|
52
52
|
- `cassis verify` runs the full local gate in one verb (`context fmt --check`, `context check`, `eval run`), stopping at the first failure. One command in a checkout ("is this change safe to merge?"), one job in CI. `--no-eval` skips the eval suite.
|
|
@@ -255,6 +255,12 @@ cassis issues show 019f0000-0000-7000-8000-0000000000e1
|
|
|
255
255
|
|
|
256
256
|
# Work one context domain at a time (nested domains included):
|
|
257
257
|
cassis issues list --domain sales
|
|
258
|
+
# The warehouse tables users asked for that the context does not describe, the most asked first:
|
|
259
|
+
cassis issues tables
|
|
260
|
+
cassis issues tables --layer modeled
|
|
261
|
+
cassis issues tables --domain finance --offset 50
|
|
262
|
+
# A table the team will not add (--undo takes it back):
|
|
263
|
+
cassis issues tables set-aside CORE.PAYMENTS
|
|
258
264
|
|
|
259
265
|
# Issues are shared with the project; source evidence respects conversation access.
|
|
260
266
|
# Read what the agent saw for one readable occurrence (ids from `issues show`):
|
|
@@ -21,7 +21,7 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
|
|
|
21
21
|
- DDL imports describe one schema snapshot/export file, including ordinary and materialized views; they do not replay incremental migrations. Extraction diagnostics include object names and statement locations. If extraction is incomplete, `schema plan` and `--dry-run` show the extracted inventory and exit 1; `apply`, `push`, and `--write-checkout` cannot save that result. Unknown column types are warnings when all output names are known. Plans also show object-kind, view-definition, comment, and constraint changes. `--json` preserves structured diagnostics and the server-capped inventory.
|
|
22
22
|
|
|
23
23
|
- `cassis status` shows the project's published version (number, label, git commit), whether unpublished changes await publication, the git-sync binding, a schema plan waiting to be applied, and how your local git HEAD relates to the published commit (in sync / N commits ahead / diverged). `cassis status --watch` polls until the published commit matches your local HEAD (e.g. right after merging a PR whose CI publishes the context) instead of watching the GitHub Actions tab.
|
|
24
|
-
- `cassis issues` triages the issues Cassis raised on the project (what it found wrong while answering questions: a context gap, missing data) without leaving the checkout: `issues list` (filterable by status, impact, cause and context domain, and showing each issue's domain so you can work through one domain at a time; and each issue's reach, the chat answers that used its context tables in the last 30 days), `issues show <id>` for the diagnosis, suggested action, the occurrences behind it, its reach and evidence (removed from dbt, an AI review suggestion, user feedback, a failed eval, or the chat analysis), `issues evidence <id> <occurrence-id>` for what the agent actually saw, and `issues resolve` / `dismiss` / `reopen` once you've acted on it. When the fix ships through a pull request, write the `PR mention:` line `issues show` prints (`Resolves <id>`) in the PR description instead: Cassis resolves the issue when the PR merges, and `issues show` then reports how it was closed and through which PR.
|
|
24
|
+
- `cassis issues` triages the issues Cassis raised on the project (what it found wrong while answering questions: a context gap, missing data) without leaving the checkout: `issues list` (filterable by status, impact, cause and context domain, and showing each issue's domain so you can work through one domain at a time; and each issue's reach, the chat answers that used its context tables in the last 30 days), `issues show <id>` for the diagnosis, suggested action, the occurrences behind it, its reach and evidence (removed from dbt, an AI review suggestion, user feedback, a failed eval, or the chat analysis), `issues evidence <id> <occurrence-id>` for what the agent actually saw, and `issues resolve` / `dismiss` / `reopen` once you've acted on it. When the fix ships through a pull request, write the `PR mention:` line `issues show` prints (`Resolves <id>`) in the PR description instead: Cassis resolves the issue when the PR merges, and `issues show` then reports how it was closed and through which PR. `issues tables` lists the warehouse tables users asked for that the context does not describe: one line per table, the most asked first, with a suggested domain. These requests are not issues, so `issues list` does not print them. `issues tables set-aside <TABLE>` records a table the team will not add; a table you add leaves the list on its own once published.
|
|
25
25
|
- `cassis dbt push` sends your dbt project's artifacts (`target/manifest.json`, and `catalog.json` when present) to Cassis from the dbt project's CI, with the commit they were built from. Cassis checks the files, matches each dbt model, seed, snapshot and source to a table of the project's data source, and keeps the upload as the project's dbt baseline unless a newer one is already there. The command prints how many relations matched and how many tests they declare. Cassis compares the upload with the previous baseline and saves findings about the context the merged change puts in doubt for grouping and issue curation. The command distinguishes findings awaiting curation from published issues, printing the source observation for pending findings and links for published issues. Nothing the agent answers with changes.
|
|
26
26
|
- `cassis dbt check` runs the same comparison on a pull request, before the change merges: it uploads the PR's artifacts (after `dbt compile` on the production target), compares them with the baseline, and prints the context tables, columns, joins and metrics the change puts in doubt, with why it matters and the context change to make. Each finding also says its **reach**, how many chat answers used its context tables in the last 30 days, and within each section the most-reached objects print first, the order the Review page will show them in. Findings are advisory: nothing is filed, the baseline doesn't move, and the check exits 0 with or without findings.
|
|
27
27
|
- `cassis verify` runs the full local gate in one verb (`context fmt --check`, `context check`, `eval run`), stopping at the first failure. One command in a checkout ("is this change safe to merge?"), one job in CI. `--no-eval` skips the eval suite.
|
|
@@ -230,6 +230,12 @@ cassis issues show 019f0000-0000-7000-8000-0000000000e1
|
|
|
230
230
|
|
|
231
231
|
# Work one context domain at a time (nested domains included):
|
|
232
232
|
cassis issues list --domain sales
|
|
233
|
+
# The warehouse tables users asked for that the context does not describe, the most asked first:
|
|
234
|
+
cassis issues tables
|
|
235
|
+
cassis issues tables --layer modeled
|
|
236
|
+
cassis issues tables --domain finance --offset 50
|
|
237
|
+
# A table the team will not add (--undo takes it back):
|
|
238
|
+
cassis issues tables set-aside CORE.PAYMENTS
|
|
233
239
|
|
|
234
240
|
# Issues are shared with the project; source evidence respects conversation access.
|
|
235
241
|
# Read what the agent saw for one readable occurrence (ids from `issues show`):
|
|
@@ -1232,6 +1232,74 @@ def get_issues(
|
|
|
1232
1232
|
return result
|
|
1233
1233
|
|
|
1234
1234
|
|
|
1235
|
+
def get_requested_tables(
|
|
1236
|
+
*,
|
|
1237
|
+
api_url: str,
|
|
1238
|
+
api_key: str,
|
|
1239
|
+
project_id: str,
|
|
1240
|
+
layer: Optional[str] = None,
|
|
1241
|
+
search: Optional[str] = None,
|
|
1242
|
+
domain: Optional[str] = None,
|
|
1243
|
+
offset: int = 0,
|
|
1244
|
+
limit: int = 50,
|
|
1245
|
+
transport: Optional[httpx.BaseTransport] = None,
|
|
1246
|
+
) -> dict[str, Any]:
|
|
1247
|
+
"""GET /api/ci/projects/{project_id}/requested-tables and return the page of tables to add."""
|
|
1248
|
+
url = api_url.rstrip("/") + f"/api/ci/projects/{project_id}/requested-tables"
|
|
1249
|
+
params = {"limit": str(limit)}
|
|
1250
|
+
if offset:
|
|
1251
|
+
params["offset"] = str(offset)
|
|
1252
|
+
if layer:
|
|
1253
|
+
params["layer"] = layer
|
|
1254
|
+
if search:
|
|
1255
|
+
params["search"] = search
|
|
1256
|
+
if domain:
|
|
1257
|
+
params["domain"] = domain
|
|
1258
|
+
result = _get_issue_json(url, api_key, transport, params=params)
|
|
1259
|
+
if not isinstance(result, dict) or not isinstance(result.get("items"), list):
|
|
1260
|
+
raise ApiError(f"Unexpected response shape from the Cassis API at {url}.")
|
|
1261
|
+
return result
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
class TableDecisionRefusedError(ApiError):
|
|
1265
|
+
"""The server refused a decision about a requested table (HTTP 422), for example a table that is not in the list."""
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
def post_requested_table_decision(
|
|
1269
|
+
*,
|
|
1270
|
+
api_url: str,
|
|
1271
|
+
api_key: str,
|
|
1272
|
+
project_id: str,
|
|
1273
|
+
table: str,
|
|
1274
|
+
set_aside: bool,
|
|
1275
|
+
transport: Optional[httpx.BaseTransport] = None,
|
|
1276
|
+
) -> None:
|
|
1277
|
+
"""POST /api/ci/projects/{project_id}/requested-tables/decision: set a requested table aside or take it back.
|
|
1278
|
+
|
|
1279
|
+
Raise `TableDecisionRefusedError` with the server's reason when it refuses
|
|
1280
|
+
the table (HTTP 422: it is not in the list of tables to add).
|
|
1281
|
+
"""
|
|
1282
|
+
url = api_url.rstrip("/") + f"/api/ci/projects/{project_id}/requested-tables/decision"
|
|
1283
|
+
try:
|
|
1284
|
+
with _client(transport=transport) as client:
|
|
1285
|
+
response = client.post(
|
|
1286
|
+
url,
|
|
1287
|
+
json={"table": table, "set_aside": set_aside},
|
|
1288
|
+
headers={"Authorization": authorization(api_url, api_key)},
|
|
1289
|
+
)
|
|
1290
|
+
except httpx.HTTPError as exc:
|
|
1291
|
+
raise ApiError(f"Could not reach the Cassis API at {url}: {exc}") from exc
|
|
1292
|
+
|
|
1293
|
+
if response.status_code == 401:
|
|
1294
|
+
raise AuthError(_REJECTED_CREDENTIAL)
|
|
1295
|
+
if response.status_code == 422:
|
|
1296
|
+
raise TableDecisionRefusedError(_detail_or_text(response))
|
|
1297
|
+
if response.status_code in (403, 404):
|
|
1298
|
+
raise _project_scope_error(response)
|
|
1299
|
+
if response.status_code >= 400:
|
|
1300
|
+
raise ApiError(f"Cassis API returned HTTP {response.status_code}: {response.text[:500]}")
|
|
1301
|
+
|
|
1302
|
+
|
|
1235
1303
|
def get_issue(
|
|
1236
1304
|
*,
|
|
1237
1305
|
api_url: str,
|
|
@@ -19,10 +19,13 @@ from cassis_cli.api import (
|
|
|
19
19
|
ApiError,
|
|
20
20
|
AuthError,
|
|
21
21
|
IssueNotFoundError,
|
|
22
|
+
TableDecisionRefusedError,
|
|
22
23
|
get_issue,
|
|
23
24
|
get_issue_evidence,
|
|
24
25
|
get_issues,
|
|
26
|
+
get_requested_tables,
|
|
25
27
|
post_issue_status,
|
|
28
|
+
post_requested_table_decision,
|
|
26
29
|
)
|
|
27
30
|
from cassis_cli.common import (
|
|
28
31
|
DEFAULT_BASE_PATH,
|
|
@@ -36,11 +39,14 @@ from cassis_cli.common import (
|
|
|
36
39
|
)
|
|
37
40
|
|
|
38
41
|
app = typer.Typer(no_args_is_help=True, help="Triage the project's issues.")
|
|
42
|
+
# The tables users asked for are a list of their own, not issues: `issues list` points to it.
|
|
43
|
+
_TABLES_HINT = "Tables users asked for are not issues: see `cassis issues tables`."
|
|
39
44
|
|
|
40
45
|
STATUSES = ("open", "resolved", "dismissed", "all")
|
|
41
46
|
DISMISS_REASONS = ("invalid", "irrelevant", "duplicate", "declined")
|
|
42
47
|
IMPACTS = ("wrong_answer", "at_risk", "unreliable_answer", "no_answer", "inefficient")
|
|
43
48
|
CAUSES = ("ontology_gap", "missing_data")
|
|
49
|
+
LAYERS = ("modeled", "raw")
|
|
44
50
|
|
|
45
51
|
# The five options every command in this subapp takes. Shared instances: typer
|
|
46
52
|
# reads the option metadata at decoration time, so one constant per flag keeps
|
|
@@ -84,7 +90,7 @@ def _validate_choice(value: Optional[str], allowed: "tuple[str, ...]", flag: str
|
|
|
84
90
|
raise typer.Exit(EXIT_USAGE)
|
|
85
91
|
|
|
86
92
|
|
|
87
|
-
def _not_found_failure(exc: IssueNotFoundError) -> "typer.Exit":
|
|
93
|
+
def _not_found_failure(exc: IssueNotFoundError | TableDecisionRefusedError) -> "typer.Exit":
|
|
88
94
|
typer.secho(str(exc), fg=typer.colors.YELLOW, err=True)
|
|
89
95
|
return typer.Exit(EXIT_VALIDATION_FAILED)
|
|
90
96
|
|
|
@@ -158,6 +164,7 @@ def list_issues(
|
|
|
158
164
|
|
|
159
165
|
if not issues:
|
|
160
166
|
typer.echo("No issues match." if (status or impact or cause or domain) else "No issues on this project.")
|
|
167
|
+
typer.echo(_TABLES_HINT)
|
|
161
168
|
raise typer.Exit(EXIT_OK)
|
|
162
169
|
|
|
163
170
|
rows = []
|
|
@@ -185,6 +192,132 @@ def list_issues(
|
|
|
185
192
|
widths = [max(len(row[column]) for row in rows) for column in range(len(rows[0]) - 1)]
|
|
186
193
|
for row in rows:
|
|
187
194
|
typer.echo(" ".join([*(cell.ljust(width) for cell, width in zip(row, widths)), row[-1]]))
|
|
195
|
+
typer.echo(_TABLES_HINT)
|
|
196
|
+
raise typer.Exit(EXIT_OK)
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
tables_app = typer.Typer(help="The warehouse tables users asked for that the context does not describe.")
|
|
200
|
+
app.add_typer(tables_app, name="tables")
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
@tables_app.callback(invoke_without_command=True)
|
|
204
|
+
def tables(
|
|
205
|
+
ctx: typer.Context,
|
|
206
|
+
layer: Optional[str] = typer.Option(
|
|
207
|
+
None, "--layer", help=f"Only the modeled tables or only the raw ones ({', '.join(LAYERS)})."
|
|
208
|
+
),
|
|
209
|
+
search: Optional[str] = typer.Option(None, "--search", help="Only the tables whose name contains this text."),
|
|
210
|
+
domain: Optional[str] = typer.Option(
|
|
211
|
+
None, "--domain", help="Only the tables suggested for this domain path or a domain under it."
|
|
212
|
+
),
|
|
213
|
+
offset: int = typer.Option(0, "--offset", min=0, help="How many tables to skip, to page through the list."),
|
|
214
|
+
limit: int = typer.Option(50, "--limit", min=1, max=200, help="How many tables to print, the most asked first."),
|
|
215
|
+
path: Path = _PATH_OPTION,
|
|
216
|
+
project_id: Optional[str] = _PROJECT_OPTION,
|
|
217
|
+
api_key: Optional[str] = _API_KEY_OPTION,
|
|
218
|
+
api_url: str = _API_URL_OPTION,
|
|
219
|
+
base_path: str = _BASE_PATH_OPTION,
|
|
220
|
+
json_output: bool = typer.Option(False, "--json", help="Print the tables as raw JSON."),
|
|
221
|
+
) -> None:
|
|
222
|
+
"""List the warehouse tables users asked for that the context does not describe, the most asked first.
|
|
223
|
+
|
|
224
|
+
These requests are not issues, so `cassis issues list` does not print
|
|
225
|
+
them: they are one list for the project, one line per table. Prints each
|
|
226
|
+
table's conversations (`x3`), users, layer (`modeled` or `raw`; `-` when
|
|
227
|
+
the project does not draw that line), suggested domain and name. The
|
|
228
|
+
domain is a suggestion: it ends with `?` when it rests on one conversation,
|
|
229
|
+
and reads `-` when the conversations disagree (`--json` carries every
|
|
230
|
+
candidate with its count, and the owners each table goes to). A table
|
|
231
|
+
leaves the list when it is published in the context or when the team sets
|
|
232
|
+
it aside (`cassis issues tables set-aside <TABLE>`).
|
|
233
|
+
Exits 0 on success, 2 on usage errors, 3 on transport/API errors.
|
|
234
|
+
"""
|
|
235
|
+
if ctx.invoked_subcommand is not None:
|
|
236
|
+
return
|
|
237
|
+
layer = _validate_choice(layer, LAYERS, "--layer")
|
|
238
|
+
api_key = require_api_key(api_key, api_url)
|
|
239
|
+
project_id = resolve_project_id(project_id, path / Path(base_path), quiet=json_output)
|
|
240
|
+
|
|
241
|
+
try:
|
|
242
|
+
page = get_requested_tables(
|
|
243
|
+
api_url=api_url,
|
|
244
|
+
api_key=api_key,
|
|
245
|
+
project_id=project_id,
|
|
246
|
+
layer=layer,
|
|
247
|
+
search=search,
|
|
248
|
+
domain=domain,
|
|
249
|
+
offset=offset,
|
|
250
|
+
limit=limit,
|
|
251
|
+
)
|
|
252
|
+
except (AuthError, ApiError) as exc:
|
|
253
|
+
raise api_failure(exc) from exc
|
|
254
|
+
|
|
255
|
+
if json_output:
|
|
256
|
+
typer.echo(json.dumps(page, indent=2))
|
|
257
|
+
raise typer.Exit(EXIT_OK)
|
|
258
|
+
|
|
259
|
+
items = page["items"]
|
|
260
|
+
if not items:
|
|
261
|
+
typer.echo("No table to add.")
|
|
262
|
+
raise typer.Exit(EXIT_OK)
|
|
263
|
+
|
|
264
|
+
rows = []
|
|
265
|
+
for table in items:
|
|
266
|
+
domain = table.get("suggested_domain")
|
|
267
|
+
candidates = table.get("candidate_domains") or []
|
|
268
|
+
# A suggestion that one conversation carries is weak: say so on the line.
|
|
269
|
+
weak = (
|
|
270
|
+
bool(domain) and not table.get("filed_by_team") and candidates and candidates[0].get("conversations") == 1
|
|
271
|
+
)
|
|
272
|
+
rows.append(
|
|
273
|
+
[
|
|
274
|
+
f"x{table.get('conversations') or 0}",
|
|
275
|
+
f"users {table.get('users') or 0}",
|
|
276
|
+
str(table.get("layer") or "-"),
|
|
277
|
+
f"{domain}?" if weak else str(domain or "-"),
|
|
278
|
+
str(table.get("name")),
|
|
279
|
+
]
|
|
280
|
+
)
|
|
281
|
+
widths = [max(len(row[column]) for row in rows) for column in range(len(rows[0]) - 1)]
|
|
282
|
+
for row in rows:
|
|
283
|
+
typer.echo(" ".join([*(cell.ljust(width) for cell, width in zip(row, widths)), row[-1]]))
|
|
284
|
+
more = int(page.get("total") or 0) - offset - len(items)
|
|
285
|
+
if more > 0:
|
|
286
|
+
typer.echo(f"{more} more (--offset {offset + len(items)}).")
|
|
287
|
+
raise typer.Exit(EXIT_OK)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
@tables_app.command("set-aside")
|
|
291
|
+
def set_aside_table(
|
|
292
|
+
table: str = typer.Argument(..., help="SCHEMA.TABLE, as `cassis issues tables` prints it."),
|
|
293
|
+
undo: bool = typer.Option(False, "--undo", help="Take the table back into the list."),
|
|
294
|
+
path: Path = _PATH_OPTION,
|
|
295
|
+
project_id: Optional[str] = _PROJECT_OPTION,
|
|
296
|
+
api_key: Optional[str] = _API_KEY_OPTION,
|
|
297
|
+
api_url: str = _API_URL_OPTION,
|
|
298
|
+
base_path: str = _BASE_PATH_OPTION,
|
|
299
|
+
) -> None:
|
|
300
|
+
"""Record that the team will not add a requested table to the context, or take that back with `--undo`.
|
|
301
|
+
|
|
302
|
+
The table leaves `cassis issues tables` for everyone on the project. A
|
|
303
|
+
table you add needs no command: once the pull request that describes it
|
|
304
|
+
is merged and published, it leaves the list on its own. Requires the
|
|
305
|
+
editor or admin role. Exits 0 on success, 1 when the table is not in the
|
|
306
|
+
list, 2 on usage errors, 3 on transport/API errors.
|
|
307
|
+
"""
|
|
308
|
+
api_key = require_api_key(api_key, api_url)
|
|
309
|
+
project_id = resolve_project_id(project_id, path / Path(base_path))
|
|
310
|
+
try:
|
|
311
|
+
post_requested_table_decision(
|
|
312
|
+
api_url=api_url, api_key=api_key, project_id=project_id, table=table, set_aside=not undo
|
|
313
|
+
)
|
|
314
|
+
except TableDecisionRefusedError as exc:
|
|
315
|
+
raise _not_found_failure(exc) from exc
|
|
316
|
+
except (AuthError, ApiError) as exc:
|
|
317
|
+
raise api_failure(exc) from exc
|
|
318
|
+
name = table.strip().upper()
|
|
319
|
+
message = f"{name} is back in the list of tables to add." if undo else f"{name} is set aside."
|
|
320
|
+
typer.secho(f"✓ {message}", fg=typer.colors.GREEN)
|
|
188
321
|
raise typer.Exit(EXIT_OK)
|
|
189
322
|
|
|
190
323
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|