@graphit/cli 0.2.260 → 0.2.306

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 (46) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/bin/graphit +1 -1
  5. package/bin/graphit.ps1 +1 -1
  6. package/dist/commands/connector.js +4 -2
  7. package/dist/commands/connector.js.map +1 -1
  8. package/dist/commands/dashboard.js +24 -11
  9. package/dist/commands/dashboard.js.map +1 -1
  10. package/dist/commands/ds/refresh-history.js +2 -1
  11. package/dist/commands/ds/refresh-history.js.map +1 -1
  12. package/dist/commands/ds/ui-only.js +10 -4
  13. package/dist/commands/ds/ui-only.js.map +1 -1
  14. package/dist/commands/ds-config.d.ts +1 -0
  15. package/dist/commands/ds-config.js +25 -2
  16. package/dist/commands/ds-config.js.map +1 -1
  17. package/dist/commands/ds.js +11 -7
  18. package/dist/commands/ds.js.map +1 -1
  19. package/dist/commands/governance.js +2 -2
  20. package/dist/commands/governance.js.map +1 -1
  21. package/dist/commands/kb-create.js +19 -14
  22. package/dist/commands/kb-create.js.map +1 -1
  23. package/dist/commands/kb-delete.js +14 -3
  24. package/dist/commands/kb-delete.js.map +1 -1
  25. package/dist/commands/kb-read.js +27 -11
  26. package/dist/commands/kb-read.js.map +1 -1
  27. package/dist/commands/kb-shared.d.ts +19 -1
  28. package/dist/commands/kb-shared.js +40 -0
  29. package/dist/commands/kb-shared.js.map +1 -1
  30. package/dist/commands/kb-update.js +29 -14
  31. package/dist/commands/kb-update.js.map +1 -1
  32. package/dist/commands/query.js +2 -1
  33. package/dist/commands/query.js.map +1 -1
  34. package/package.json +4 -4
  35. package/scripts/commander-walk.mjs +154 -0
  36. package/scripts/generate-commands-doc.mjs +26 -95
  37. package/scripts/generate-tool-manifest.mjs +613 -0
  38. package/scripts/verb-policy-source.json +555 -0
  39. package/skills/graphit/SKILL.md +7 -7
  40. package/skills/graphit/VERSION.json +1 -1
  41. package/skills/graphit/references/data-sources.md +8 -6
  42. package/skills/graphit/references/kb-discovery.md +1 -1
  43. package/skills/graphit/references/kb-scope.md +23 -0
  44. package/skills/graphit/references/kb-structure.md +3 -1
  45. package/skills/graphit/references/kb-traversal.md +1 -4
  46. package/skills/graphit/references/onboarding.md +12 -3
@@ -41,17 +41,19 @@ A wide or raw source is sometimes the right call - row-level drill-down/export,
41
41
 
42
42
  ## Creating data sources
43
43
 
44
- `graphit ds create` auto-chains: create -> poll until ready -> scan schema -> print verification link. To activate for KB use, either the user reviews and activates via the link on the platform, or - after you show them the scanned schema and they accept it - run `graphit ds verify <id> --accept-schema` to activate from the CLI.
44
+ `graphit ds create` auto-chains: create -> poll until ready -> scan schema -> print verification link. Activating it for KB use is the `ds verify` step below.
45
45
 
46
46
  ```bash
47
47
  # Create with auto-scan (recommended)
48
- graphit ds create --name "MY_DS" --sql "SELECT ..." --connection <id>
48
+ graphit ds create --name "MY_DS" --domain <DOMAIN> --sql "SELECT ..." --connection <id>
49
49
 
50
50
  # Create without auto-scan (for special cases)
51
- graphit ds create --name "MY_DS" --sql "SELECT ..." --skip-scan
51
+ graphit ds create --name "MY_DS" --domain <DOMAIN> --sql "SELECT ..." --skip-scan
52
52
  ```
53
53
 
54
- **From a local file (Excel/CSV):** `graphit ds create --file <path>` uploads the file and creates one data source. Optional: `--name` (defaults to the file name), `--sheet <name>` (multi-sheet workbooks), `--domain <NAME>` (attach to an existing KB domain - create it first if needed). `--file` and `--sql` are mutually exclusive; same auto-scan + verification flow as above.
54
+ **`--domain` is REQUIRED, in both modes.** It files the scanned table under an existing KB domain and decides who can see the source; there is no uncategorized fallback. `graphit kb list domains`, confirm the choice with the user, and `graphit kb create domain --name <NAME>` if none fits.
55
+
56
+ **From a local file (Excel/CSV):** `graphit ds create --file <path> --domain <NAME>` uploads the file and creates one data source. Optional: `--name` (defaults to the file name), `--sheet <name>` (multi-sheet workbooks). `--file` and `--sql` are mutually exclusive; same flow as above.
55
57
 
56
58
  **Warehouse connection.** `--connection` names the warehouse a `--sql` source reads from. Add BigQuery with `graphit connector add bigquery-serviceaccount --key-file <path> [--project --dataset --location]` (org admin; project defaults from the key). The pipeline routes by connection type - the same `ds create` works for either warehouse.
57
59
 
@@ -59,7 +61,7 @@ For existing unverified sources, `graphit ds verify <id>` scans and shows the sc
59
61
 
60
62
  ## Refreshing data sources
61
63
 
62
- Data sources cache a snapshot of the warehouse query result. Refresh when you need current data. **File-upload sources can't be refreshed (no query to re-run) - update them by re-uploading with `graphit ds create --file <path>`.**
64
+ Data sources cache a snapshot of the warehouse query result. Refresh when you need current data. **File-upload sources can't be refreshed - update them by re-uploading with `graphit ds create --file <path> --domain <NAME>`.**
63
65
 
64
66
  On BigQuery a refresh scans billed bytes, so keep the shape tight and prefer incremental/partition-pruned refresh over full re-scans; a per-connection scan cap (max bytes billed) fails an oversized query fast rather than running up a bill.
65
67
 
@@ -106,7 +108,7 @@ Only early-filter when an incremental source is slow for this reason; the defaul
106
108
 
107
109
  ## What needs write access
108
110
 
109
- Querying a source, listing sources, reading schema or refresh history, and an ordinary `graphit ds refresh` are reads - any member who can read that source's domain can run them, and a source in a domain they cannot read returns the same uniform 404 as one that does not exist. These need `data_source_write` in the source's domain: `ds create`, editing its SQL, `ds refresh-config`, a `--force` refresh or accepting a schema, `ds verify`, scanning, per-source governance settings, and deletion. Moving a source to another domain needs write in both the old and the new domain, and `ds create` must name a domain the caller can write to.
111
+ Querying a source, listing sources, reading schema or refresh history, and an ordinary `graphit ds refresh` are reads - any member who can read that source's domain can run them, and a source in a domain they cannot read returns the same uniform 404 as one that does not exist. These need `data_source_write` in the source's domain: `ds create`, editing its SQL, `ds refresh-config`, a `--force` refresh or accepting a schema, `ds verify`, scanning, per-source governance settings, and deletion. Moving a source to another domain needs write in both the old and the new domain.
110
112
 
111
113
  Check `graphit status` for those domains before proposing a create or a config change. It is advisory - the server authorizes each operation when it runs, and a denial with `retryable: false` is a stop, not a retry (`operations.md`).
112
114
 
@@ -12,7 +12,7 @@ Work narrow, not broad: **domain -> data source -> assets.** The first move is a
12
12
  4. **Handle gaps.** If the domain's data source is missing something, check `graphit kb list relationships` for a connection to another data source you can join; if the data genuinely does not exist, propose creating the asset or a new data source (see below).
13
13
  5. **Broaden only as a fallback.** Use `graphit kb search "<concept>"` only when an exploration came up empty or the concept name is too fuzzy to match a domain or topic. Search is semantic (matches by meaning, ranked by a relevance `score`) merged with name/text matching, and capped by `--limit` - the result carries `total` and `truncated`. So an empty or unexpected result means *maybe ranked-out or truncated*, never proof an asset is absent: raise `--limit`, narrow `--type`, or confirm a specific name with `kb get` before concluding it doesn't exist. `graphit kb list` carries `total`/`truncated` too - fewer rows than `total` means the list was capped, not that assets are missing; raise `--limit`. (`graphit kb list domains` enumerates domain names when you need to pick one; it is a name lookup, not the asset-discovery path - explore the domain to see its assets.)
14
14
 
15
- If a domain has tables but no metrics or dimensions, that is the strongest signal to propose foundational assets before building any graph - this is the KB-readiness gate the build workflow enforces. If the user declines ("just build it", "skip KB"), respect it and work from the table schema - read it with `graphit kb explore table <NAME>`, which returns the columns (names, types, descriptions).
15
+ If a domain has tables but no metrics or dimensions, that is the strongest signal to propose foundational assets before building any graph - this is the KB-readiness gate the build workflow enforces. **Exception:** when a response carries `migration_incomplete: true`, the org's KB rows are mid-migration and invisible, so emptiness is not evidence of anything - report the migration state instead of proposing creation. If the user declines ("just build it", "skip KB"), respect it and work from the table schema - read its columns with `graphit kb explore table <NAME>`.
16
16
 
17
17
  ## Metric vs Dimension
18
18
 
@@ -0,0 +1,23 @@
1
+ # KB Scope: Who Will See It
2
+
3
+ Consult BEFORE creating or moving any KB asset, and whenever the user asks who can see something. A domain is not only a filing shelf, it is the access boundary, so choosing one is choosing an audience - and the choice is not freely reversible.
4
+
5
+ | Scope | Who reads it | Use it for |
6
+ |---|---|---|
7
+ | The org commons | Everyone in the organization. It always exists, cannot be deleted, and is where an org-wide asset belongs | Definitions the whole company shares, and anything with no narrower home |
8
+ | A shared business domain | Whoever has been granted it. `graphit status` shows the caller's own access, advisory only - the server decides | The normal case: work a team owns and reuses |
9
+ | A private space | Its owner alone. Invisible to everyone else, admins included, and shown simply as "Private" | Scratch work, or data someone is not ready to share |
10
+
11
+ **Settle the scope with the user before creating anything.** Ask which of these the work belongs in rather than inferring it, and say plainly what the choice means: work put in a private space will not appear for their team at all. Default to a shared domain (or the commons) for anything the team should be able to use.
12
+
13
+ If a create or update response carries a `visibility` notice, the asset landed where only its author can read it. Relay the notice, and if the user meant the work for their team, treat that as the moment to fix the scope - not a detail to skip past.
14
+
15
+ **It is not freely reversible**, which is why the question comes first:
16
+
17
+ - An asset whose DEFINITION reads a private table (a metric's dependencies, a synonym's canonical target, a relationship's tables, or a table's own home) is readable by its author alone. That is by design, and it stays that way.
18
+ - Redefining an ALREADY-SHARED asset onto a private table is refused, because it would remove a working asset from the team without telling them. Copy it into the private space instead and change the copy.
19
+ - ATTACHING a private table to a shared asset as a placement (a secondary table, a rule target, an extra domain) is fully supported: the asset stays shared and usable, and nobody else sees the private reference. This is the safe way to enrich a team asset with something personal.
20
+
21
+ **When a delete is refused over someone's private dependency.** Deleting a shared asset can be blocked because another member's PRIVATE asset depends on it. The refusal names the owners to go ask - never their assets - and that attribution is the point: relay who is named and suggest asking them first. `--force` on `kb delete` proceeds anyway (it is offered only when every hidden blocker has a named owner), and every named owner is notified of what was deleted, by whom, and what of theirs broke. Treat `--force` as the user's deliberate escalation: never add it on your own to get past a refusal.
22
+
23
+ Never read a private space's stored name aloud or invent one. Refer to it as the user's private space. To target it in a command, pass `--domain Private` - the alias always resolves to the caller's OWN space, so no spelling of it can reach anyone else's.
@@ -14,7 +14,7 @@ The KB is a labeled property graph: assets carry tags that place them in a tree,
14
14
  | synonym | Maps a business term to a canonical metric, dimension, or column |
15
15
  | table | Physical data location in the warehouse, with typed columns |
16
16
  | topic | Business-concept tag applied to assets (e.g., REVENUE, ACQUISITION) |
17
- | domain | High-level business area (e.g., MARKETING, SALES, PRODUCT) |
17
+ | domain | High-level business area (e.g., MARKETING, SALES, PRODUCT), and the boundary that decides who can see what sits in it |
18
18
  | relationship | Documented JOIN pattern between two tables |
19
19
  | memory | Org-level context notes, always global scope |
20
20
 
@@ -42,6 +42,8 @@ Other placements layered on top:
42
42
 
43
43
  Domains are coarse and few (broad business areas); topics are finer and more numerous. A single domain like MARKETING typically spans topics such as ACQUISITION, ATTRIBUTION, and CAMPAIGN_PERFORMANCE.
44
44
 
45
+ A domain is also the access boundary: it decides who can see what sits in it. Settle that with the user before creating anything - see kb-scope.md.
46
+
45
47
  ## Tree Rendering Order
46
48
 
47
49
  The default tree renders Domain > Table > Topic > Asset, with each table under its one home domain. This is a visualization choice; the model also supports Topic > Table or a flat list. When the user asks "where is X?", an asset lives under its primary table's home domain - report that, plus any domains from its `secondary_tables` placements and its topics.
@@ -37,11 +37,8 @@ Which `graphit kb` read command answers each question, and how to present the re
37
37
  ### "What topics does ARPU_D1 belong to?"
38
38
  `graphit kb explore metric ARPU_D1` - the response includes its topics, along with its tables, dimensions, and home domain.
39
39
 
40
- ### "What's left uncategorized?"
41
- `graphit kb explore domain Uncategorized` - returns the tables with no home domain and their assets.
42
-
43
40
  ### "What domains do we have?" (enumerate names)
44
- `graphit kb list domains` - returns every domain with its description and asset count, plus an "Uncategorized" entry when tables have no domain. Report all of them, including empty ones. This enumerates domain NAMES; to see what is in one, explore it. Domain is not a searchable type, so `graphit kb search` will not surface domains.
41
+ `graphit kb list domains` - returns every domain with its description and asset count. Report all of them, including empty ones. This enumerates domain NAMES; to see what is in one, explore it. Domain is not a searchable type, so `graphit kb search` will not surface domains.
45
42
 
46
43
  ## Presenting KB Results
47
44
 
@@ -23,7 +23,7 @@ Two ways in. Lead with the warehouse; offer the file as the lighter path.
23
23
  - Snowflake keypair from the CLI: `graphit connector add snowflake-keypair` needs `--account --user --key --warehouse --role --database` (all required), plus optional `--name` for a friendly label (it defaults to `Snowflake (<account>)`). It validates the connection before saving, so a success really did connect.
24
24
  - OAuth and GitHub connections are set up in the Graphit web app, not the CLI - name that handoff when it applies.
25
25
 
26
- **File (lighter).** For a quick start with no warehouse, `graphit ds create --file ./data.csv` uploads a CSV or Excel file and creates a data source directly - no connector needed.
26
+ **File (lighter).** For a quick start with no warehouse, `graphit ds create --file ./data.csv --domain <NAME>` uploads a CSV or Excel file and creates a data source directly - no connector needed.
27
27
 
28
28
  Present the outcome: which connection is live, or the exact web-app / admin step the user has to finish.
29
29
 
@@ -33,10 +33,19 @@ Before creating anything, ask what business question the user wants to answer. T
33
33
 
34
34
  ## 3. Create the data source
35
35
 
36
- Explain that answering the question fast needs a cached data source over the connection, not repeated live-warehouse queries. Create it, then activate it:
36
+ Explain that answering the question fast needs a cached data source over the connection, not repeated live-warehouse queries.
37
+
38
+ **A domain comes first.** Every data source is created inside a KB domain - it is what makes the source findable and grantable, and there is no uncategorized fallback. A brand-new workspace has only the org-wide commons, so check with `graphit kb list domains` and, if the user's work deserves its own area, agree a name and create it before the source:
39
+
40
+ ```bash
41
+ graphit kb list domains
42
+ graphit kb create domain --name MARKETING --description "Acquisition and spend"
43
+ ```
44
+
45
+ Then create the source and activate it:
37
46
 
38
47
  ```bash
39
- graphit ds create --name "MY_DS" --sql "SELECT ..." --connection <id>
48
+ graphit ds create --name "MY_DS" --domain MARKETING --sql "SELECT ..." --connection <id>
40
49
  graphit ds verify <id> --accept-schema
41
50
  ```
42
51