cassis-cli 3.6.1__tar.gz → 3.8.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.
Files changed (23) hide show
  1. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/PKG-INFO +96 -15
  2. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/README.md +92 -14
  3. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/api.py +84 -159
  4. cassis_cli-3.8.0/cassis_cli/auth.py +208 -0
  5. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/chats.py +3 -3
  6. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/common.py +16 -11
  7. cassis_cli-3.8.0/cassis_cli/credentials.py +214 -0
  8. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/dbt.py +4 -2
  9. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/eval.py +18 -18
  10. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/guide.py +1 -1
  11. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/issues.py +7 -187
  12. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/main.py +5 -0
  13. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/ontology.py +12 -12
  14. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/ontology_design_guide.md +98 -20
  15. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/projects.py +6 -6
  16. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/schema.py +6 -6
  17. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/status.py +2 -2
  18. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/verify.py +2 -2
  19. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/pyproject.toml +4 -1
  20. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/LICENSE +0 -0
  21. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/NOTICE +0 -0
  22. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/__init__.py +0 -0
  23. {cassis_cli-3.6.1 → cassis_cli-3.8.0}/cassis_cli/schema_plan.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cassis-cli
3
- Version: 3.6.1
3
+ Version: 3.8.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
@@ -13,7 +13,10 @@ Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Environment :: Console
14
14
  Classifier: Intended Audience :: Developers
15
15
  Classifier: Topic :: Database
16
+ Requires-Dist: filelock (>=3.16,<4)
16
17
  Requires-Dist: httpx (>=0.24,<1.0)
18
+ Requires-Dist: keyring (>=25.6,<26)
19
+ Requires-Dist: platformdirs (>=4.3,<5)
17
20
  Requires-Dist: typer (>=0.12,<1.0)
18
21
  Project-URL: Documentation, https://github.com/GetCassis/cassis-cli#readme
19
22
  Project-URL: Homepage, https://getcassis.com
@@ -24,7 +27,7 @@ Description-Content-Type: text/markdown
24
27
 
25
28
  Validate, test and evaluate your context from your terminal, then publish it. The same commands gate your pull requests in CI:
26
29
 
27
- - `cassis context check` validates the context files in your repository with the exact same checks as the Cassis GitHub PR check (YAML parsing, round-trip, import validation), so you can gate merges in any CI system, not just GitHub. It then prints advisory **context quality warnings** for a tree that parsed: tables not assigned to any domain, joins/metrics pointing at unknown tables or columns, missing table/column descriptions, `enum_values` the column's type can't store (the same findings `context test` reports, without the agent run). In a checkout bound to a project (`project.yml`, `--project`, or `CASSIS_PROJECT_ID`), it also cross-checks the tree against the project's source schema: references to tables or columns the warehouse doesn't have print as **warnings** too, advisory only (the object may simply not be built or synced yet). Warnings never fail the check.
30
+ - `cassis context check` validates the context files in your repository with the exact same checks as the Cassis GitHub PR check (YAML parsing, round-trip, import validation), so you can gate merges in any CI system, not just GitHub. It then prints advisory **context quality warnings** for a tree that parsed: tables not assigned to any domain, joins/metrics pointing at unknown tables or columns, tables without a description, `enum_values` the column's type can't store (the same findings `context test` reports, without the agent run). In a checkout bound to a project (`project.yml`, `--project`, or `CASSIS_PROJECT_ID`), it also cross-checks the tree against the project's source schema: references to tables or columns the warehouse doesn't have print as **warnings** too, advisory only (the object may simply not be built or synced yet). Warnings never fail the check.
28
31
  - `cassis schema pull` downloads the data source's full source schema (as Cassis last introspected it) into `<base-path>/.schema.json`, a **gitignored** local snapshot (the command maintains the ignore entry) with a `pulled_at` stamp. The warehouse stays authoritative; the snapshot is a cache for offline/bulk work, e.g. a coding agent grepping table and column names during a modeling pass instead of paging through the MCP `get_source_schema` tool. Re-run to refresh.
29
32
  - `cassis context fmt` rewrites the context files in canonical form (think `black`/`gofmt` for your context), so hand or agent edits pass the round-trip check.
30
33
  - `cassis context upload` uploads the context files to a Cassis project (full replace) and, by default, publishes them immediately as a new version, so a merge to your main branch can go live in one CI step. It runs from a git checkout whose context files are committed, and the published version records that commit, even when the upload changes nothing, so `cassis status` can tell whether a checkout matches what is live.
@@ -39,7 +42,7 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
39
42
  - `cassis eval list-cases`, `cassis eval history` and `cassis eval delete-case` maintain the suite: list the current cases with their ids (flagging those whose gold SQL reads tables the context lacks), see how one case has behaved across runs (pass rate, whether repeated runs under one configuration disagree, divergences and timings), and prune one that is stale or wrong (e.g. its gold SQL encodes a definition the context has since changed). `cassis eval history` counts a repeat run as one run with its attempts, and prints each result's error, why result comparison did not apply, and the comparison rule that decided it.
40
43
  - `cassis eval runs` lists the project's recent eval runs, newest first (`--limit`, default 20; `--json` for the server's list): each run's id, status, the context it scored, where it came from (CLI, CI, scheduled, Evals page, ...), the model and how many results passed (attempts on a repeat run, and how much of the suite a change-scoped run covered), and for a run the spending protection did not start, why. Exits 3 on a server too old to list runs.
41
44
  - `cassis schema plan <ddl>` (or `--warehouse` on a project connected to a warehouse) previews what a schema update would change before anything is applied: the source schema diff, the context changes Cassis will make (every change on a table placed in the context, with everything a drop takes with it) and warnings, terraform-style. `cassis schema apply <ddl>` (or `--plan <id>`) writes the resulting context files into the local checkout, app untouched, for review with `git diff`. `cassis schema push <ddl> [--publish]` pushes the new schema and the local context to the app (`--yes` in CI). The file speaks only for the schemas it contains: pass `--complete` when it is the project's complete source schema so schemas absent from it are treated as dropped. With `--warehouse` the server introspects the connected warehouse instead of parsing a file; the plan is always whole-source. `cassis schema plan <ddl> --dry-run` is the prepare-ahead variant: the plan is computed synchronously and nothing is kept in Cassis (no plan to apply or resume, the current plan untouched), so the schema snapshot for a change still in a PR can be planned against safely; `--write-checkout` writes the context files it would produce into the checkout, to commit alongside the schema change.
42
- - `cassis projects list` lists the projects your API key can reach: id (what `--project` and `CASSIS_PROJECT_ID` take), name, published context version, and data-source dialect. A pipeline or agent can discover the project id from the terminal instead of fishing it out of a webapp URL.
45
+ - `cassis projects list` lists the projects your account can reach: id (what `--project` and `CASSIS_PROJECT_ID` take), name, published context version, and data-source dialect. A pipeline or agent can discover the project id from the terminal instead of fishing it out of a webapp URL.
43
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.
44
47
 
45
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.
@@ -48,6 +51,70 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
48
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.
49
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.
50
53
 
54
+ ## Sign in
55
+
56
+ ```sh
57
+ cassis login
58
+ cassis auth status
59
+ cassis projects list
60
+ ```
61
+
62
+ `login` opens your browser and prints a verification URL and short code. Sign in
63
+ with your existing Cassis account (Google or email), enter that code, and approve
64
+ CLI access. The approval page identifies your account and permissions. Only
65
+ approve a code from a login you started. The CLI acts with your **current** role,
66
+ organization and domain permissions; signing in grants no additional rights.
67
+ Requires a Cassis server with CLI device authorization support.
68
+
69
+ For Claude Code, a container, SSH, or another remote terminal, run
70
+ `cassis login --no-browser` and open the printed URL on your own computer. The
71
+ remote CLI polls for approval; no port forwarding or local callback is needed.
72
+ An agent can start login and show you the URL/code; you complete sign-in yourself.
73
+ Do not paste passwords or tokens into the agent chat. Codes expire after 10
74
+ minutes. Ctrl-C cancels the request; denial and expiry require a new login.
75
+ Ordinary commands and CI jobs never start login or open a browser.
76
+
77
+ Saved credentials live in macOS Keychain, Windows Credential Locker, or an
78
+ unlocked Linux Secret Service/KWallet session, **never in your repository or a
79
+ plaintext fallback**. Remote/container environments need their own usable OS
80
+ credential store; device authorization does not forward your laptop's keychain.
81
+ Without one, login stops before authorization: configure a secure store, or keep
82
+ using an API key supplied through your environment's secret manager. Access and
83
+ refresh credentials are not printed by any CLI command. Local processes running
84
+ as the same OS user may have access to that user's credential store.
85
+
86
+ Access tokens last 10 minutes and refresh automatically. Refresh sessions expire
87
+ after 30 days without rotation by default (the server can configure this). A
88
+ per-server lock serializes concurrent commands across processes. If a process
89
+ crashes or loses a refresh response, the CLI asks you to log out and log in again
90
+ instead of reusing a possibly consumed refresh token. Revocation, changed account
91
+ eligibility and server session loss can also require a new login.
92
+
93
+ `cassis auth status` verifies and shows the effective account, organization, role,
94
+ server and credential source; `cassis status` still reports **project** status.
95
+ One account is saved per server. To switch accounts, run `cassis logout`, then
96
+ `cassis login`, and use **Use another account** on the browser consent page.
97
+
98
+ `cassis logout` revokes only this login session and removes its local credentials.
99
+ It can revoke the session even when the saved access token has expired and a
100
+ copied refresh credential has kept the session active elsewhere.
101
+ It does not revoke browser/MCP sessions or API keys. If the server is unreachable,
102
+ credentials remain available for a revocation retry and logout exits 3. Explicit
103
+ `cassis logout --local-only` removes them without confirming revocation; any
104
+ copied credentials could remain usable until expiry.
105
+
106
+ Credential precedence is **`--api-key` → `CASSIS_API_KEY` → saved login**. An
107
+ explicit key that is rejected never falls back to a saved account. Logout does
108
+ not unset `CASSIS_API_KEY`. Keep API keys in CI secret variables as before;
109
+ delegated gateway keys are not CLI credentials.
110
+
111
+ Server selection is **`--api-url` → `CASSIS_API_URL` →
112
+ `https://app.getcassis.com`**. Pass the server flag to each command, or set the
113
+ variable for the shell. Saved logins are keyed by normalized server origin;
114
+ changing server never forwards another server's credentials. Login requires
115
+ HTTPS, with HTTP allowed only on localhost for development. Authentication
116
+ requests do not follow redirects.
117
+
51
118
  ## Install
52
119
 
53
120
  ```bash
@@ -59,12 +126,14 @@ pip install cassis-cli
59
126
  The context tree under `<base-path>` (default `cassis/`) is:
60
127
 
61
128
  - **Project identity**: `project.yml`, the Cassis project id and format version. Written by `pull` and by server-side publish (the places that know the id); a local `fmt` won't create it.
62
- - **Domains**: Markdown files. Every domain is the `README.md` of its folder: `domains/README.md` for the root, `domains/<path>/README.md` for each sub-domain. Each has a small YAML frontmatter block (`type`, `title`, `description`) and a Markdown body carrying the domain's `context_md`; a generated section at the bottom links the domain's tables and metrics (kept current by `fmt`/`pull`: edit your prose above it, and the PR check fails if the links are stale, so re-run `fmt`). The layout is a Cassis profile inspired by [OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/okf): the files render on GitHub and read in any Markdown editor, but Cassis validates them strictly (unknown keys are flagged, not preserved).
129
+ - **Domains**: Markdown files. Every domain is the `README.md` of its folder: `domains/README.md` for the root, `domains/<path>/README.md` for each sub-domain. Each has a small YAML frontmatter block (`type`, `title`, `description`, optionally `owners`) and a Markdown body carrying the domain's `context_md`; a generated section at the bottom links the domain's tables and metrics (kept current by `fmt`/`pull`: edit your prose above it, and the PR check fails if the links are stale, so re-run `fmt`). The layout is a Cassis profile inspired by [OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/okf): the files render on GitHub and read in any Markdown editor, but Cassis validates them strictly (unknown keys are flagged, not preserved).
63
130
  - **Tables, joins, metrics**: YAML, unchanged: `tables/<schema>/<table>.yml`, `joins.yml`, `metrics/<name>.yml`. A column can list the values it stores as `enum_values` (items `{value, description?}`, values quoted exactly as stored); see `cassis/AGENTS.md`.
64
131
 
65
132
  **Migrating an existing repo** (domains were YAML `_project.yml` / `_domain.yml` before cassis-cli 1.1.0): upgrade and run `cassis context fmt` (or `cassis context pull` if you have no local edits). It rewrites the domain files to Markdown and removes the old ones. Review the diff and commit. Cassis reads the old YAML domain files too, so an un-migrated repo keeps working until you convert it. **Uploading requires cassis-cli ≥ 1.1.0**: the server rejects an older CLI (which would drop the Markdown domain files) with a clear upgrade error.
66
133
 
67
- ## Setup
134
+ ## CI setup
135
+
136
+ Interactive users can follow [Sign in](#sign-in). For automation:
68
137
 
69
138
  1. Create an API key in Cassis under **Organization settings → API keys** (keys start with `sk-k6-`).
70
139
  2. Store it as a CI secret and expose it as `CASSIS_API_KEY`.
@@ -176,14 +245,9 @@ cassis schema push schema.sql --complete --yes # schema + context to the app
176
245
  cassis schema plan --warehouse # warehouse-connected projects: introspect instead
177
246
  cassis schema plan future.sql --dry-run --write-checkout # plan a not-yet-deployed DDL, keep nothing server-side
178
247
 
179
- # List the projects the API key can reach (id, name, published version, dialect):
248
+ # List the projects the acting account can reach (id, name, published version, dialect):
180
249
  cassis projects list
181
250
 
182
- # Refresh the issues from the conversations nobody has analyzed yet (the same pass as the
183
- # webapp's "Analyze conversations" button; waits for the result, --no-wait returns at once,
184
- # and Ctrl-C cancels the run server-side and exits 130):
185
- cassis issues analyze
186
-
187
251
  # Triage the issues Cassis raised (filter by --status/--impact/--cause; --json for raw output):
188
252
  cassis issues list # open issues by default
189
253
  cassis issues list --status all # include resolved and dismissed issues
@@ -225,7 +289,7 @@ Configuration (flags take precedence over env vars):
225
289
 
226
290
  | Flag | Env var | Default |
227
291
  | ----------- | ---------------- | --------------------------- |
228
- | `--api-key` | `CASSIS_API_KEY` | none (required) |
292
+ | `--api-key` | `CASSIS_API_KEY` | saved login when no key is set |
229
293
  | `--api-url` | `CASSIS_API_URL` | `https://app.getcassis.com` |
230
294
  | `--base-path` | `CASSIS_BASE_PATH` | `cassis`, must match the project's git-sync "Path" setting |
231
295
  | `--project` (check, pull, upload, schema pull, eval run, eval add-case, eval list-cases, eval history, eval runs, eval show, eval delete-case, test, issues, dbt push, dbt check) | `CASSIS_PROJECT_ID` | the id in `<base-path>/project.yml` (required before the first pull; `check` alone falls back to the project-less validation when unbound) |
@@ -254,14 +318,31 @@ cassis context fmt --check
254
318
 
255
319
  **Review the diff before committing**: canonical form keeps exactly the fields Cassis understands. Unknown fields (typos) are dropped, and the rewrite makes them visible in `git diff` instead of losing them silently at sync time. Files with duplicate YAML keys are rejected (fix them by hand: the formatter can't know which value you meant).
256
320
 
321
+ ### Domain owners
322
+
323
+ A domain README can list who owns the domain. Each entry is an email address (one person) or a typed reference: `slack:@group` (a Slack user group), `github:@user` or `github:@org/team`. Anything else is rejected, a bare `@name` included:
324
+
325
+ ```markdown
326
+ ---
327
+ type: Domain
328
+ title: Sales
329
+ owners:
330
+ - jane@acme.com
331
+ - slack:@sales-data
332
+ - github:@acme/sales-data
333
+ ---
334
+ ```
335
+
336
+ A domain without `owners` inherits its nearest parent's, and the root domain's (`domains/README.md`) are the default. Cassis shows the owners on each issue (`cassis issues show`, and `owners` / `owner_domain` in `cassis issues list --json`) so it can be routed to the right team. Cassis passes the entries on as declared, without resolving them to people. Owners grant no edit permission in Cassis and are never shown to the agent.
337
+
257
338
  ### Exit codes
258
339
 
259
340
  | Code | Meaning |
260
341
  | ---- | ------------------------------------------------------------------------------ |
261
342
  | 0 | Context is valid (check) / pulled (pull) / uploaded (upload) / eval run completed with no regression: every case passed, already failed on the base run, or is pending the change it guards (eval run) / every probe completed (test, whatever its outcome; probes are informational, don't gate CI on them) / dbt upload accepted, or kept behind a newer one (dbt push) / dbt upload checked, with or without findings (dbt check) |
262
- | 1 | Validation failed (check: findings printed; upload: nothing imported; eval run: invalid tree or a regression, a case whose answer fails now and passed on the base run; test: invalid tree or a probe failed; add-case: duplicate question or gold SQL that does not run; delete-case, history: no such case in the project; show: no such run in the project; issues: no such issue or occurrence in the project; issues analyze: failed or cancelled analysis run; schema plan/apply: extraction is incomplete, the plan failed (unparseable or truncated DDL), is stale or expired, the apply failed, or the project won't accept it (a plan is being applied, a DDL was given for a warehouse-connected project, or --warehouse for a DDL-only one); dbt push: the upload was refused or rejected (a file is invalid, too large or from an unsupported dbt version, or no relation matches the project's data source); dbt check: the upload was refused or rejected (an invalid file, or no baseline yet: run `cassis dbt push` first)) |
263
- | 2 | Usage error (missing API key or project, no context directory, unreadable file, tree over the size limits, `eval run --branch` naming a context branch the project does not have, `eval run --base` naming a published version the project does not have or given without `--changed`, `eval run --dry-run --case` naming no current case, `upload` or `schema push` outside a git checkout or with uncommitted context files, `dbt push` or `dbt check` without a manifest.json, outside a git checkout without `--commit`, or with an artifact over the size limits) |
264
- | 3 | Transport/API error (unreachable API, invalid key, inaccessible project, unexpected response, a server too old for the command or option), another eval run or issue analysis already active, out of credits, `--timeout` reached, or Cassis failed on its side while processing a dbt upload (`dbt push` / `dbt check`: nothing to fix in the upload, push again) |
343
+ | 1 | Validation failed (check: findings printed; upload: nothing imported; eval run: invalid tree or a regression, a case whose answer fails now and passed on the base run; test: invalid tree or a probe failed; add-case: duplicate question or gold SQL that does not run; delete-case, history: no such case in the project; show: no such run in the project; issues: no such issue or occurrence in the project; schema plan/apply: extraction is incomplete, the plan failed (unparseable or truncated DDL), is stale or expired, the apply failed, or the project won't accept it (a plan is being applied, a DDL was given for a warehouse-connected project, or --warehouse for a DDL-only one); dbt push: the upload was refused or rejected (a file is invalid, too large or from an unsupported dbt version, or no relation matches the project's data source); dbt check: the upload was refused or rejected (an invalid file, or no baseline yet: run `cassis dbt push` first)) |
344
+ | 2 | Usage error (missing credentials or project, no context directory, unreadable file, tree over the size limits, `eval run --branch` naming a context branch the project does not have, `eval run --base` naming a published version the project does not have or given without `--changed`, `eval run --dry-run --case` naming no current case, `upload` or `schema push` outside a git checkout or with uncommitted context files, `dbt push` or `dbt check` without a manifest.json, outside a git checkout without `--commit`, or with an artifact over the size limits) |
345
+ | 3 | Transport/API error (unreachable API, invalid key, inaccessible project, unexpected response, a server too old for the command or option), another eval run already active, out of credits, `--timeout` reached, or Cassis failed on its side while processing a dbt upload (`dbt push` / `dbt check`: nothing to fix in the upload, push again) |
265
346
  | 4 | `eval run` reached no verdict: the run failed or was cancelled on Cassis's side, or the cases that did not pass errored instead of failing (agent, judge or warehouse errors, a broken gold SQL). Nothing says the context regressed: rerun, or read the errors |
266
347
 
267
348
  Commands that send the local tree (`check`, `fmt`, `upload`, `eval run`, `test`) accept up to
@@ -2,7 +2,7 @@
2
2
 
3
3
  Validate, test and evaluate your context from your terminal, then publish it. The same commands gate your pull requests in CI:
4
4
 
5
- - `cassis context check` validates the context files in your repository with the exact same checks as the Cassis GitHub PR check (YAML parsing, round-trip, import validation), so you can gate merges in any CI system, not just GitHub. It then prints advisory **context quality warnings** for a tree that parsed: tables not assigned to any domain, joins/metrics pointing at unknown tables or columns, missing table/column descriptions, `enum_values` the column's type can't store (the same findings `context test` reports, without the agent run). In a checkout bound to a project (`project.yml`, `--project`, or `CASSIS_PROJECT_ID`), it also cross-checks the tree against the project's source schema: references to tables or columns the warehouse doesn't have print as **warnings** too, advisory only (the object may simply not be built or synced yet). Warnings never fail the check.
5
+ - `cassis context check` validates the context files in your repository with the exact same checks as the Cassis GitHub PR check (YAML parsing, round-trip, import validation), so you can gate merges in any CI system, not just GitHub. It then prints advisory **context quality warnings** for a tree that parsed: tables not assigned to any domain, joins/metrics pointing at unknown tables or columns, tables without a description, `enum_values` the column's type can't store (the same findings `context test` reports, without the agent run). In a checkout bound to a project (`project.yml`, `--project`, or `CASSIS_PROJECT_ID`), it also cross-checks the tree against the project's source schema: references to tables or columns the warehouse doesn't have print as **warnings** too, advisory only (the object may simply not be built or synced yet). Warnings never fail the check.
6
6
  - `cassis schema pull` downloads the data source's full source schema (as Cassis last introspected it) into `<base-path>/.schema.json`, a **gitignored** local snapshot (the command maintains the ignore entry) with a `pulled_at` stamp. The warehouse stays authoritative; the snapshot is a cache for offline/bulk work, e.g. a coding agent grepping table and column names during a modeling pass instead of paging through the MCP `get_source_schema` tool. Re-run to refresh.
7
7
  - `cassis context fmt` rewrites the context files in canonical form (think `black`/`gofmt` for your context), so hand or agent edits pass the round-trip check.
8
8
  - `cassis context upload` uploads the context files to a Cassis project (full replace) and, by default, publishes them immediately as a new version, so a merge to your main branch can go live in one CI step. It runs from a git checkout whose context files are committed, and the published version records that commit, even when the upload changes nothing, so `cassis status` can tell whether a checkout matches what is live.
@@ -17,7 +17,7 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
17
17
  - `cassis eval list-cases`, `cassis eval history` and `cassis eval delete-case` maintain the suite: list the current cases with their ids (flagging those whose gold SQL reads tables the context lacks), see how one case has behaved across runs (pass rate, whether repeated runs under one configuration disagree, divergences and timings), and prune one that is stale or wrong (e.g. its gold SQL encodes a definition the context has since changed). `cassis eval history` counts a repeat run as one run with its attempts, and prints each result's error, why result comparison did not apply, and the comparison rule that decided it.
18
18
  - `cassis eval runs` lists the project's recent eval runs, newest first (`--limit`, default 20; `--json` for the server's list): each run's id, status, the context it scored, where it came from (CLI, CI, scheduled, Evals page, ...), the model and how many results passed (attempts on a repeat run, and how much of the suite a change-scoped run covered), and for a run the spending protection did not start, why. Exits 3 on a server too old to list runs.
19
19
  - `cassis schema plan <ddl>` (or `--warehouse` on a project connected to a warehouse) previews what a schema update would change before anything is applied: the source schema diff, the context changes Cassis will make (every change on a table placed in the context, with everything a drop takes with it) and warnings, terraform-style. `cassis schema apply <ddl>` (or `--plan <id>`) writes the resulting context files into the local checkout, app untouched, for review with `git diff`. `cassis schema push <ddl> [--publish]` pushes the new schema and the local context to the app (`--yes` in CI). The file speaks only for the schemas it contains: pass `--complete` when it is the project's complete source schema so schemas absent from it are treated as dropped. With `--warehouse` the server introspects the connected warehouse instead of parsing a file; the plan is always whole-source. `cassis schema plan <ddl> --dry-run` is the prepare-ahead variant: the plan is computed synchronously and nothing is kept in Cassis (no plan to apply or resume, the current plan untouched), so the schema snapshot for a change still in a PR can be planned against safely; `--write-checkout` writes the context files it would produce into the checkout, to commit alongside the schema change.
20
- - `cassis projects list` lists the projects your API key can reach: id (what `--project` and `CASSIS_PROJECT_ID` take), name, published context version, and data-source dialect. A pipeline or agent can discover the project id from the terminal instead of fishing it out of a webapp URL.
20
+ - `cassis projects list` lists the projects your account can reach: id (what `--project` and `CASSIS_PROJECT_ID` take), name, published context version, and data-source dialect. A pipeline or agent can discover the project id from the terminal instead of fishing it out of a webapp URL.
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.
@@ -26,6 +26,70 @@ Validate, test and evaluate your context from your terminal, then publish it. Th
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.
28
28
 
29
+ ## Sign in
30
+
31
+ ```sh
32
+ cassis login
33
+ cassis auth status
34
+ cassis projects list
35
+ ```
36
+
37
+ `login` opens your browser and prints a verification URL and short code. Sign in
38
+ with your existing Cassis account (Google or email), enter that code, and approve
39
+ CLI access. The approval page identifies your account and permissions. Only
40
+ approve a code from a login you started. The CLI acts with your **current** role,
41
+ organization and domain permissions; signing in grants no additional rights.
42
+ Requires a Cassis server with CLI device authorization support.
43
+
44
+ For Claude Code, a container, SSH, or another remote terminal, run
45
+ `cassis login --no-browser` and open the printed URL on your own computer. The
46
+ remote CLI polls for approval; no port forwarding or local callback is needed.
47
+ An agent can start login and show you the URL/code; you complete sign-in yourself.
48
+ Do not paste passwords or tokens into the agent chat. Codes expire after 10
49
+ minutes. Ctrl-C cancels the request; denial and expiry require a new login.
50
+ Ordinary commands and CI jobs never start login or open a browser.
51
+
52
+ Saved credentials live in macOS Keychain, Windows Credential Locker, or an
53
+ unlocked Linux Secret Service/KWallet session, **never in your repository or a
54
+ plaintext fallback**. Remote/container environments need their own usable OS
55
+ credential store; device authorization does not forward your laptop's keychain.
56
+ Without one, login stops before authorization: configure a secure store, or keep
57
+ using an API key supplied through your environment's secret manager. Access and
58
+ refresh credentials are not printed by any CLI command. Local processes running
59
+ as the same OS user may have access to that user's credential store.
60
+
61
+ Access tokens last 10 minutes and refresh automatically. Refresh sessions expire
62
+ after 30 days without rotation by default (the server can configure this). A
63
+ per-server lock serializes concurrent commands across processes. If a process
64
+ crashes or loses a refresh response, the CLI asks you to log out and log in again
65
+ instead of reusing a possibly consumed refresh token. Revocation, changed account
66
+ eligibility and server session loss can also require a new login.
67
+
68
+ `cassis auth status` verifies and shows the effective account, organization, role,
69
+ server and credential source; `cassis status` still reports **project** status.
70
+ One account is saved per server. To switch accounts, run `cassis logout`, then
71
+ `cassis login`, and use **Use another account** on the browser consent page.
72
+
73
+ `cassis logout` revokes only this login session and removes its local credentials.
74
+ It can revoke the session even when the saved access token has expired and a
75
+ copied refresh credential has kept the session active elsewhere.
76
+ It does not revoke browser/MCP sessions or API keys. If the server is unreachable,
77
+ credentials remain available for a revocation retry and logout exits 3. Explicit
78
+ `cassis logout --local-only` removes them without confirming revocation; any
79
+ copied credentials could remain usable until expiry.
80
+
81
+ Credential precedence is **`--api-key` → `CASSIS_API_KEY` → saved login**. An
82
+ explicit key that is rejected never falls back to a saved account. Logout does
83
+ not unset `CASSIS_API_KEY`. Keep API keys in CI secret variables as before;
84
+ delegated gateway keys are not CLI credentials.
85
+
86
+ Server selection is **`--api-url` → `CASSIS_API_URL` →
87
+ `https://app.getcassis.com`**. Pass the server flag to each command, or set the
88
+ variable for the shell. Saved logins are keyed by normalized server origin;
89
+ changing server never forwards another server's credentials. Login requires
90
+ HTTPS, with HTTP allowed only on localhost for development. Authentication
91
+ requests do not follow redirects.
92
+
29
93
  ## Install
30
94
 
31
95
  ```bash
@@ -37,12 +101,14 @@ pip install cassis-cli
37
101
  The context tree under `<base-path>` (default `cassis/`) is:
38
102
 
39
103
  - **Project identity**: `project.yml`, the Cassis project id and format version. Written by `pull` and by server-side publish (the places that know the id); a local `fmt` won't create it.
40
- - **Domains**: Markdown files. Every domain is the `README.md` of its folder: `domains/README.md` for the root, `domains/<path>/README.md` for each sub-domain. Each has a small YAML frontmatter block (`type`, `title`, `description`) and a Markdown body carrying the domain's `context_md`; a generated section at the bottom links the domain's tables and metrics (kept current by `fmt`/`pull`: edit your prose above it, and the PR check fails if the links are stale, so re-run `fmt`). The layout is a Cassis profile inspired by [OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/okf): the files render on GitHub and read in any Markdown editor, but Cassis validates them strictly (unknown keys are flagged, not preserved).
104
+ - **Domains**: Markdown files. Every domain is the `README.md` of its folder: `domains/README.md` for the root, `domains/<path>/README.md` for each sub-domain. Each has a small YAML frontmatter block (`type`, `title`, `description`, optionally `owners`) and a Markdown body carrying the domain's `context_md`; a generated section at the bottom links the domain's tables and metrics (kept current by `fmt`/`pull`: edit your prose above it, and the PR check fails if the links are stale, so re-run `fmt`). The layout is a Cassis profile inspired by [OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/okf): the files render on GitHub and read in any Markdown editor, but Cassis validates them strictly (unknown keys are flagged, not preserved).
41
105
  - **Tables, joins, metrics**: YAML, unchanged: `tables/<schema>/<table>.yml`, `joins.yml`, `metrics/<name>.yml`. A column can list the values it stores as `enum_values` (items `{value, description?}`, values quoted exactly as stored); see `cassis/AGENTS.md`.
42
106
 
43
107
  **Migrating an existing repo** (domains were YAML `_project.yml` / `_domain.yml` before cassis-cli 1.1.0): upgrade and run `cassis context fmt` (or `cassis context pull` if you have no local edits). It rewrites the domain files to Markdown and removes the old ones. Review the diff and commit. Cassis reads the old YAML domain files too, so an un-migrated repo keeps working until you convert it. **Uploading requires cassis-cli ≥ 1.1.0**: the server rejects an older CLI (which would drop the Markdown domain files) with a clear upgrade error.
44
108
 
45
- ## Setup
109
+ ## CI setup
110
+
111
+ Interactive users can follow [Sign in](#sign-in). For automation:
46
112
 
47
113
  1. Create an API key in Cassis under **Organization settings → API keys** (keys start with `sk-k6-`).
48
114
  2. Store it as a CI secret and expose it as `CASSIS_API_KEY`.
@@ -154,14 +220,9 @@ cassis schema push schema.sql --complete --yes # schema + context to the app
154
220
  cassis schema plan --warehouse # warehouse-connected projects: introspect instead
155
221
  cassis schema plan future.sql --dry-run --write-checkout # plan a not-yet-deployed DDL, keep nothing server-side
156
222
 
157
- # List the projects the API key can reach (id, name, published version, dialect):
223
+ # List the projects the acting account can reach (id, name, published version, dialect):
158
224
  cassis projects list
159
225
 
160
- # Refresh the issues from the conversations nobody has analyzed yet (the same pass as the
161
- # webapp's "Analyze conversations" button; waits for the result, --no-wait returns at once,
162
- # and Ctrl-C cancels the run server-side and exits 130):
163
- cassis issues analyze
164
-
165
226
  # Triage the issues Cassis raised (filter by --status/--impact/--cause; --json for raw output):
166
227
  cassis issues list # open issues by default
167
228
  cassis issues list --status all # include resolved and dismissed issues
@@ -203,7 +264,7 @@ Configuration (flags take precedence over env vars):
203
264
 
204
265
  | Flag | Env var | Default |
205
266
  | ----------- | ---------------- | --------------------------- |
206
- | `--api-key` | `CASSIS_API_KEY` | none (required) |
267
+ | `--api-key` | `CASSIS_API_KEY` | saved login when no key is set |
207
268
  | `--api-url` | `CASSIS_API_URL` | `https://app.getcassis.com` |
208
269
  | `--base-path` | `CASSIS_BASE_PATH` | `cassis`, must match the project's git-sync "Path" setting |
209
270
  | `--project` (check, pull, upload, schema pull, eval run, eval add-case, eval list-cases, eval history, eval runs, eval show, eval delete-case, test, issues, dbt push, dbt check) | `CASSIS_PROJECT_ID` | the id in `<base-path>/project.yml` (required before the first pull; `check` alone falls back to the project-less validation when unbound) |
@@ -232,14 +293,31 @@ cassis context fmt --check
232
293
 
233
294
  **Review the diff before committing**: canonical form keeps exactly the fields Cassis understands. Unknown fields (typos) are dropped, and the rewrite makes them visible in `git diff` instead of losing them silently at sync time. Files with duplicate YAML keys are rejected (fix them by hand: the formatter can't know which value you meant).
234
295
 
296
+ ### Domain owners
297
+
298
+ A domain README can list who owns the domain. Each entry is an email address (one person) or a typed reference: `slack:@group` (a Slack user group), `github:@user` or `github:@org/team`. Anything else is rejected, a bare `@name` included:
299
+
300
+ ```markdown
301
+ ---
302
+ type: Domain
303
+ title: Sales
304
+ owners:
305
+ - jane@acme.com
306
+ - slack:@sales-data
307
+ - github:@acme/sales-data
308
+ ---
309
+ ```
310
+
311
+ A domain without `owners` inherits its nearest parent's, and the root domain's (`domains/README.md`) are the default. Cassis shows the owners on each issue (`cassis issues show`, and `owners` / `owner_domain` in `cassis issues list --json`) so it can be routed to the right team. Cassis passes the entries on as declared, without resolving them to people. Owners grant no edit permission in Cassis and are never shown to the agent.
312
+
235
313
  ### Exit codes
236
314
 
237
315
  | Code | Meaning |
238
316
  | ---- | ------------------------------------------------------------------------------ |
239
317
  | 0 | Context is valid (check) / pulled (pull) / uploaded (upload) / eval run completed with no regression: every case passed, already failed on the base run, or is pending the change it guards (eval run) / every probe completed (test, whatever its outcome; probes are informational, don't gate CI on them) / dbt upload accepted, or kept behind a newer one (dbt push) / dbt upload checked, with or without findings (dbt check) |
240
- | 1 | Validation failed (check: findings printed; upload: nothing imported; eval run: invalid tree or a regression, a case whose answer fails now and passed on the base run; test: invalid tree or a probe failed; add-case: duplicate question or gold SQL that does not run; delete-case, history: no such case in the project; show: no such run in the project; issues: no such issue or occurrence in the project; issues analyze: failed or cancelled analysis run; schema plan/apply: extraction is incomplete, the plan failed (unparseable or truncated DDL), is stale or expired, the apply failed, or the project won't accept it (a plan is being applied, a DDL was given for a warehouse-connected project, or --warehouse for a DDL-only one); dbt push: the upload was refused or rejected (a file is invalid, too large or from an unsupported dbt version, or no relation matches the project's data source); dbt check: the upload was refused or rejected (an invalid file, or no baseline yet: run `cassis dbt push` first)) |
241
- | 2 | Usage error (missing API key or project, no context directory, unreadable file, tree over the size limits, `eval run --branch` naming a context branch the project does not have, `eval run --base` naming a published version the project does not have or given without `--changed`, `eval run --dry-run --case` naming no current case, `upload` or `schema push` outside a git checkout or with uncommitted context files, `dbt push` or `dbt check` without a manifest.json, outside a git checkout without `--commit`, or with an artifact over the size limits) |
242
- | 3 | Transport/API error (unreachable API, invalid key, inaccessible project, unexpected response, a server too old for the command or option), another eval run or issue analysis already active, out of credits, `--timeout` reached, or Cassis failed on its side while processing a dbt upload (`dbt push` / `dbt check`: nothing to fix in the upload, push again) |
318
+ | 1 | Validation failed (check: findings printed; upload: nothing imported; eval run: invalid tree or a regression, a case whose answer fails now and passed on the base run; test: invalid tree or a probe failed; add-case: duplicate question or gold SQL that does not run; delete-case, history: no such case in the project; show: no such run in the project; issues: no such issue or occurrence in the project; schema plan/apply: extraction is incomplete, the plan failed (unparseable or truncated DDL), is stale or expired, the apply failed, or the project won't accept it (a plan is being applied, a DDL was given for a warehouse-connected project, or --warehouse for a DDL-only one); dbt push: the upload was refused or rejected (a file is invalid, too large or from an unsupported dbt version, or no relation matches the project's data source); dbt check: the upload was refused or rejected (an invalid file, or no baseline yet: run `cassis dbt push` first)) |
319
+ | 2 | Usage error (missing credentials or project, no context directory, unreadable file, tree over the size limits, `eval run --branch` naming a context branch the project does not have, `eval run --base` naming a published version the project does not have or given without `--changed`, `eval run --dry-run --case` naming no current case, `upload` or `schema push` outside a git checkout or with uncommitted context files, `dbt push` or `dbt check` without a manifest.json, outside a git checkout without `--commit`, or with an artifact over the size limits) |
320
+ | 3 | Transport/API error (unreachable API, invalid key, inaccessible project, unexpected response, a server too old for the command or option), another eval run already active, out of credits, `--timeout` reached, or Cassis failed on its side while processing a dbt upload (`dbt push` / `dbt check`: nothing to fix in the upload, push again) |
243
321
  | 4 | `eval run` reached no verdict: the run failed or was cancelled on Cassis's side, or the cases that did not pass errored instead of failing (agent, judge or warehouse errors, a broken gold SQL). Nothing says the context regressed: rerun, or read the errors |
244
322
 
245
323
  Commands that send the local tree (`check`, `fmt`, `upload`, `eval run`, `test`) accept up to