@rasmusengelbrecht/pi-semantic-query 0.1.0 → 0.1.2

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.
package/README.md CHANGED
@@ -40,7 +40,7 @@ pi -e /absolute/path/to/pi-semantic-query
40
40
 
41
41
  ## Tools
42
42
 
43
- The package registers these pi tools:
43
+ The package registers a bundled `semantic-query` skill plus these pi tools:
44
44
 
45
45
  - `semantic_metrics` — list metrics with discovery metadata
46
46
  - `semantic_search_metrics` — search metrics by id, name, description, synonyms, and teams
@@ -48,6 +48,8 @@ The package registers these pi tools:
48
48
  - `semantic_validate` — validate a semantic model
49
49
  - `semantic_compile` — compile a metric request to SQL
50
50
 
51
+ The skill teaches pi the default workflow: search before guessing metric IDs, describe ambiguous metrics, validate model changes, prefer `period`, and never present compiled SQL as executed results.
52
+
51
53
  All tools shell out to the local `semantic` CLI. By default they look for one of:
52
54
 
53
55
  - `semantic.yml`
package/package.json CHANGED
@@ -1,23 +1,38 @@
1
1
  {
2
2
  "name": "@rasmusengelbrecht/pi-semantic-query",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Compile and inspect governed semantic metrics from pi coding agent",
5
5
  "keywords": [
6
6
  "pi-package",
7
+ "pi-extension",
8
+ "pi-coding-agent",
7
9
  "semantic-layer",
8
10
  "analytics",
9
11
  "metrics",
10
12
  "sql"
11
13
  ],
12
14
  "license": "MIT",
15
+ "author": "Rasmus Engelbrecht",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/rasmusengelbrecht/pi-semantic-query.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/rasmusengelbrecht/pi-semantic-query/issues"
22
+ },
23
+ "homepage": "https://github.com/rasmusengelbrecht/pi-semantic-query#readme",
13
24
  "type": "module",
14
25
  "pi": {
15
26
  "extensions": [
16
27
  "./extensions"
28
+ ],
29
+ "skills": [
30
+ "./skills"
17
31
  ]
18
32
  },
19
33
  "files": [
20
34
  "extensions",
35
+ "skills",
21
36
  "README.md",
22
37
  "package.json"
23
38
  ],
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: semantic-query
3
+ description: Compile and inspect governed semantic metrics with semantic-query-compiler from pi. Use when the user asks for semantic metrics, metric discovery, governed SQL compilation, semantic model validation, or SQL for a metric request.
4
+ ---
5
+
6
+ # Semantic Query
7
+
8
+ Use the `semantic_*` tools from this package to discover governed metrics and compile inspectable SQL. These tools do **not** execute warehouse queries.
9
+
10
+ ## Default workflow
11
+
12
+ 1. Start with `semantic_search_metrics` when the user describes a metric in business language.
13
+ 2. Use `semantic_metrics` when they ask what metrics exist or when search is too narrow.
14
+ 3. Use `semantic_describe` before compiling if the metric semantics, grain, filters, dimensions, teams, or formula are unclear.
15
+ 4. Use `semantic_validate` after model edits, before trusting a new model, or when compile errors suggest the model may be invalid.
16
+ 5. Use `semantic_compile` to generate SQL for the chosen metric and request.
17
+ 6. Say clearly that compiled SQL is not executed results.
18
+
19
+ ## Request guidance
20
+
21
+ Prefer period-based requests for CLI/agent workflows:
22
+
23
+ ```json
24
+ {
25
+ "metricId": "revenue",
26
+ "period": "last 12 complete months",
27
+ "dialect": "bigquery",
28
+ "request": {
29
+ "timeGrain": "monthly",
30
+ "breakdownDimensionIds": ["country"]
31
+ }
32
+ }
33
+ ```
34
+
35
+ Use raw `fromDate` / `toDate` only when the user needs exact fixed boundaries or provides a request JSON shape that already has them.
36
+
37
+ ## Safety boundary
38
+
39
+ `semantic_compile` returns SQL only. Do not claim row counts, metric values, parity, or dashboard results unless a separate warehouse/query tool actually executed the SQL.
40
+
41
+ If the user asks to run the query, use their normal warehouse tooling or ask which execution environment to use. This package intentionally does not handle credentials, warehouse cost, or data access.
42
+
43
+ ## Model discovery
44
+
45
+ By default, tools look for common model filenames in the current project (`semantic.yml`, `model.yml`, `semantic_layer.yml`, and `.yaml` variants). Pass `model` explicitly when the model lives elsewhere.