@graphit/cli 0.2.321 → 0.2.323

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 (57) 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/api/client.js +15 -0
  7. package/dist/api/client.js.map +1 -1
  8. package/dist/commands/ds-config.js +2 -2
  9. package/dist/commands/ds-config.js.map +1 -1
  10. package/dist/commands/ds.js +2 -2
  11. package/dist/commands/ds.js.map +1 -1
  12. package/dist/commands/kb.js +347 -15
  13. package/dist/commands/kb.js.map +1 -1
  14. package/dist/commands/query.js +3 -3
  15. package/dist/commands/query.js.map +1 -1
  16. package/dist/skill-guard.js +2 -1
  17. package/dist/skill-guard.js.map +1 -1
  18. package/package.json +1 -1
  19. package/scripts/verb-policy-source.json +30 -102
  20. package/skills/graphit/SKILL.md +31 -39
  21. package/skills/graphit/VERSION.json +1 -1
  22. package/skills/graphit/references/data-source-refresh.md +27 -0
  23. package/skills/graphit/references/data-sources.md +27 -122
  24. package/skills/graphit/references/filters-advanced.md +2 -2
  25. package/skills/graphit/references/governance-explained.md +18 -29
  26. package/skills/graphit/references/governance.md +20 -83
  27. package/skills/graphit/references/kb-actions.md +28 -81
  28. package/skills/graphit/references/kb-discovery.md +35 -64
  29. package/skills/graphit/references/kb-scope.md +17 -15
  30. package/skills/graphit/references/kb-structure.md +28 -54
  31. package/skills/graphit/references/kb-traversal.md +24 -96
  32. package/skills/graphit/references/metric-families.md +19 -0
  33. package/skills/graphit/references/migration.md +2 -2
  34. package/skills/graphit/references/onboarding.md +5 -4
  35. package/skills/graphit/references/presentations.md +1 -1
  36. package/skills/graphit/references/runtime.md +6 -6
  37. package/skills/graphit/references/semantic-authoring.md +65 -0
  38. package/skills/graphit/references/sql-reference.md +10 -20
  39. package/dist/commands/kb-constraints.d.ts +0 -14
  40. package/dist/commands/kb-constraints.js +0 -53
  41. package/dist/commands/kb-constraints.js.map +0 -1
  42. package/dist/commands/kb-create.d.ts +0 -2
  43. package/dist/commands/kb-create.js +0 -296
  44. package/dist/commands/kb-create.js.map +0 -1
  45. package/dist/commands/kb-delete.d.ts +0 -2
  46. package/dist/commands/kb-delete.js +0 -37
  47. package/dist/commands/kb-delete.js.map +0 -1
  48. package/dist/commands/kb-read.d.ts +0 -2
  49. package/dist/commands/kb-read.js +0 -223
  50. package/dist/commands/kb-read.js.map +0 -1
  51. package/dist/commands/kb-shared.d.ts +0 -43
  52. package/dist/commands/kb-shared.js +0 -81
  53. package/dist/commands/kb-shared.js.map +0 -1
  54. package/dist/commands/kb-update.d.ts +0 -2
  55. package/dist/commands/kb-update.js +0 -240
  56. package/dist/commands/kb-update.js.map +0 -1
  57. package/skills/graphit/references/parameterized-metrics.md +0 -77
@@ -1,77 +0,0 @@
1
- # Parameterized Metrics
2
-
3
- A parameterized metric is a template whose calculation contains `${PARAM:NAME}` tokens (dollar sign and curly braces). Each token maps to a named parameter with a list of values (a value name paired with the SQL fragment it substitutes in). The system auto-generates one validated child variant per combination of values - a ROAS template with REVENUE (9 values) and DN (4 values) produces 36 children.
4
-
5
- ## When to Parameterize
6
-
7
- Parameterize when columns or formulas follow a variant pattern: `total_iap` / `total_iap_new_users` / `estimated_gross_iap` map to one REVENUE parameter; metrics that differ only by a WHERE window (D7, D30, D90) map to one DN parameter. Stay standalone when the metric has no natural variants, has only one or two (template overhead is not worth it), or when variants use fundamentally different formulas.
8
-
9
- ## Authoring a Template
10
-
11
- Put `${PARAM:NAME}` tokens in the calculation, then pass the value map with `--parameters` (inline JSON array) or `--parameters-file <path>` on `graphit kb create metric` / `graphit kb update metric`. Run `graphit kb create metric --help` for the exact flag spelling.
12
-
13
- ```json
14
- [
15
- {
16
- "name": "REVENUE",
17
- "values": {"ALL_BOOKINGS": "total_iap", "NEW_BOOKINGS": "total_iap_new_users"},
18
- "default_value": "ALL_BOOKINGS"
19
- },
20
- {
21
- "name": "DN",
22
- "values": {"D0": "", "D7": "WHERE day <= 7"},
23
- "default_value": "D0"
24
- }
25
- ]
26
- ```
27
-
28
- Paired with a calculation such as `SUM(${PARAM:REVENUE}) / SUM(cost) * 100 ${PARAM:DN}`.
29
-
30
- | Rule | Detail |
31
- |------|--------|
32
- | Token match | Every `${PARAM:NAME}` token in the calculation needs a matching parameter by name |
33
- | Empty values | Valid as no-ops (e.g. D0 adds no filter) |
34
- | Variant cap | Max 1000 (the Cartesian product of all parameter values) |
35
- | Child naming | Auto-generated as `{PARENT}_{VALUE1}_{VALUE2}` (e.g. ROAS_ALL_BOOKINGS_D7) |
36
- | Validation | Template create skips per-formula validation (children validate on generation) |
37
-
38
- ## Editing a Template
39
-
40
- All edits go through the parent template; children are read-only. Run a fresh `--parameters` array to change the value sets.
41
-
42
- | User intent | Edit action |
43
- |-------------|-------------|
44
- | Change formula | Update `--sql` on the template - children re-generate |
45
- | Add a variant (e.g. D120) | Update `--parameters` with the new value added to the relevant parameter |
46
- | Remove variants | Update `--parameters` with values removed from the relevant parameter |
47
- | Change description or topics | Update those fields on the template - no child re-generation |
48
-
49
- If the user targets a child for edit or delete, redirect to the parent: "ROAS_ALL_BOOKINGS_D7 is a variant of ROAS. Edit the parent template ROAS instead."
50
-
51
- ## Using a Variant in a Query
52
-
53
- You never substitute tokens by hand. The server resolves a variant when you reference it with the parameter syntax in SQL.
54
-
55
- 1. Find the template. `graphit kb list metric` shows the collapsed inventory - templates and flat metrics only, never child variants - with a `params` column (the required parameter names, e.g. `REVENUE, DN`) and a `variant_count`; an empty `params` cell means the metric is flat. To enumerate a template's concrete variants, `graphit kb explore metric NAME`; reach for `graphit kb list metric --include-variants` only when you truly need every child row flat.
56
- 2. Map the user's words to parameter values: "D7 ROAS for new users" maps to `REVENUE=NEW_BOOKINGS` and `DN=D7`.
57
- 3. Reference it with `{{metric:NAME(K=V)}}` in the query SQL, e.g. `{{metric:ROAS(REVENUE=NEW_BOOKINGS, DN=D7)}}`. The server expands it to the pre-validated child calculation at query time.
58
-
59
- ```bash
60
- graphit query "SELECT {{dim:INSTALL_MONTH}}, {{metric:ROAS(REVENUE=NEW_BOOKINGS, DN=D7)}} AS roas FROM MARKETING_UA_DS GROUP BY 1" --ds MARKETING_UA_DS --verbose
61
- ```
62
-
63
- Defaults and errors:
64
- - Omitting a parameter on a required metric returns a clear error naming the parameter and the valid values. Retry with a value or ask the user which one they meant.
65
- - A pre-baked variant (ROAS_D7, ARPU_D30) has its value hardcoded in the name, so reference it plainly as `{{metric:ROAS_D7}}` with no parameter clause. Find its exact name via `graphit kb explore metric ROAS` (lists the variants) or `graphit kb list metric --include-variants` - the collapsed `kb list` does not show child variant names.
66
-
67
- ## Contrast: Wrong vs Right
68
-
69
- | Wrong | Right |
70
- |-------|-------|
71
- | Replace `${PARAM:REVENUE}` with `total_iap` by hand and put that in the query SQL | Reference `{{metric:ROAS(REVENUE=ALL_BOOKINGS, DN=D7)}}` and let the server expand the validated child |
72
- | Create ROAS_ALL_BOOKINGS and ROAS_NEW_BOOKINGS as separate standalone metrics | Create one ROAS template with a REVENUE parameter |
73
- | Edit ROAS_ALL_BOOKINGS_D7 directly | Edit the parent ROAS template instead |
74
-
75
- ## Delete and Verify
76
-
77
- Deleting the parent cascade-deletes every child; the blast radius includes all children plus their downstream references (graphs, rules, synonyms), so confirm before deleting. Verifying the parent sets `verified=true` on the parent and every child at once.