@graphit/cli 0.1.21 → 0.1.23
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/dist/api/client.d.ts +6 -2
- package/dist/api/client.js +10 -9
- package/dist/api/client.js.map +1 -1
- package/dist/commands/ds.js +162 -5
- package/dist/commands/ds.js.map +1 -1
- package/package.json +1 -1
- package/skills/graphit/SKILL.md +14 -0
- package/skills/graphit/cursor/graphit-data-sources.mdc +20 -0
- package/skills/graphit/graphit.mdc +7 -2
- package/skills/graphit/references/data-sources.md +20 -0
package/dist/api/client.d.ts
CHANGED
|
@@ -4,10 +4,14 @@ export interface ApiError {
|
|
|
4
4
|
retry_after_seconds?: number;
|
|
5
5
|
}
|
|
6
6
|
declare class ApiClient {
|
|
7
|
-
request<T>(method: string, path: string, body?: unknown
|
|
7
|
+
request<T>(method: string, path: string, body?: unknown, opts?: {
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
}): Promise<T>;
|
|
8
10
|
postUnauthed<T>(path: string, body: unknown): Promise<T>;
|
|
9
11
|
get<T>(path: string): Promise<T>;
|
|
10
|
-
post<T>(path: string, body: unknown
|
|
12
|
+
post<T>(path: string, body: unknown, opts?: {
|
|
13
|
+
timeoutMs?: number;
|
|
14
|
+
}): Promise<T>;
|
|
11
15
|
put<T>(path: string, body: unknown): Promise<T>;
|
|
12
16
|
patch<T>(path: string, body: unknown): Promise<T>;
|
|
13
17
|
delete<T>(path: string): Promise<T>;
|
package/dist/api/client.js
CHANGED
|
@@ -2,11 +2,11 @@ import { getValidIdToken } from "../auth/token.js";
|
|
|
2
2
|
import { getApiBaseUrl } from "../config.js";
|
|
3
3
|
const REQUEST_TIMEOUT_MS = 30_000;
|
|
4
4
|
class ApiClient {
|
|
5
|
-
async request(method, path, body) {
|
|
5
|
+
async request(method, path, body, opts) {
|
|
6
6
|
const { id_token } = await getValidIdToken();
|
|
7
7
|
return this._fetch(method, path, body, {
|
|
8
8
|
Authorization: `Bearer ${id_token}`,
|
|
9
|
-
});
|
|
9
|
+
}, opts?.timeoutMs);
|
|
10
10
|
}
|
|
11
11
|
async postUnauthed(path, body) {
|
|
12
12
|
return this._fetch("POST", path, body);
|
|
@@ -14,8 +14,8 @@ class ApiClient {
|
|
|
14
14
|
async get(path) {
|
|
15
15
|
return this.request("GET", path);
|
|
16
16
|
}
|
|
17
|
-
async post(path, body) {
|
|
18
|
-
return this.request("POST", path, body);
|
|
17
|
+
async post(path, body, opts) {
|
|
18
|
+
return this.request("POST", path, body, opts);
|
|
19
19
|
}
|
|
20
20
|
async put(path, body) {
|
|
21
21
|
return this.request("PUT", path, body);
|
|
@@ -26,8 +26,9 @@ class ApiClient {
|
|
|
26
26
|
async delete(path) {
|
|
27
27
|
return this.request("DELETE", path);
|
|
28
28
|
}
|
|
29
|
-
async _fetch(method, path, body, extraHeaders) {
|
|
29
|
+
async _fetch(method, path, body, extraHeaders, timeoutMs) {
|
|
30
30
|
const url = `${getApiBaseUrl()}${path}`;
|
|
31
|
+
const timeout = timeoutMs ?? REQUEST_TIMEOUT_MS;
|
|
31
32
|
const headers = {
|
|
32
33
|
"Content-Type": "application/json",
|
|
33
34
|
"X-Graphit-Source": "cli",
|
|
@@ -39,11 +40,11 @@ class ApiClient {
|
|
|
39
40
|
method,
|
|
40
41
|
headers,
|
|
41
42
|
body: body ? JSON.stringify(body) : undefined,
|
|
42
|
-
signal: AbortSignal.timeout(
|
|
43
|
+
signal: AbortSignal.timeout(timeout),
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
catch (e) {
|
|
46
|
-
throw new Error(classifyNetworkError(e, getApiBaseUrl()));
|
|
47
|
+
throw new Error(classifyNetworkError(e, getApiBaseUrl(), timeout));
|
|
47
48
|
}
|
|
48
49
|
if (!resp.ok) {
|
|
49
50
|
let detail = `HTTP ${resp.status}`;
|
|
@@ -72,14 +73,14 @@ class ApiClient {
|
|
|
72
73
|
return (await resp.json());
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
function classifyNetworkError(err, baseUrl) {
|
|
76
|
+
function classifyNetworkError(err, baseUrl, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
76
77
|
const msg = err instanceof Error ? err.message : String(err);
|
|
77
78
|
const causeCode = err instanceof Error && err.cause && typeof err.cause === "object"
|
|
78
79
|
? err.cause.code ?? ""
|
|
79
80
|
: "";
|
|
80
81
|
const lower = (msg + " " + causeCode).toLowerCase();
|
|
81
82
|
if (lower.includes("abort") || lower.includes("timeout")) {
|
|
82
|
-
return `Request timed out after ${
|
|
83
|
+
return `Request timed out after ${timeoutMs / 1000}s. Check your network or try again.`;
|
|
83
84
|
}
|
|
84
85
|
if (lower.includes("enotfound") || lower.includes("getaddrinfo")) {
|
|
85
86
|
return `Could not resolve host. Check GRAPHIT_API_URL or your DNS settings. (${baseUrl})`;
|
package/dist/api/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAQlC,MAAM,SAAS;IACb,KAAK,CAAC,OAAO,CACX,MAAc,EACd,IAAY,EACZ,IAAc;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAQlC,MAAM,SAAS;IACb,KAAK,CAAC,OAAO,CACX,MAAc,EACd,IAAY,EACZ,IAAc,EACd,IAA6B;QAE7B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,eAAe,EAAE,CAAC;QAC7C,OAAO,IA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rE,OAAO,+CAA+C,OAAO,GAAG,CAAC;IACnE,CAAC;IACD,IAAI,KAAK,CAAC,QAAQ,CAAC,wCAAwC,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvF,OAAO,8DAA8D,CAAC;IACxE,CAAC;IACD,OAAO,8BAA8B,OAAO,0BAA0B,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC"}
|
package/dist/commands/ds.js
CHANGED
|
@@ -1,5 +1,98 @@
|
|
|
1
1
|
import { apiClient } from "../api/client.js";
|
|
2
2
|
import { output, errorOutput } from "../output/format.js";
|
|
3
|
+
const POLL_INTERVAL_MS = 3_000;
|
|
4
|
+
const MAX_POLL_DURATION_MS = 5 * 60_000;
|
|
5
|
+
const REFRESH_TRIGGER_TIMEOUT_MS = 60_000;
|
|
6
|
+
async function fetchDSList(limit = 200) {
|
|
7
|
+
const resp = await apiClient.get(`/api/v1/cli/ds?limit=${limit}`);
|
|
8
|
+
return resp.data_sources;
|
|
9
|
+
}
|
|
10
|
+
async function triggerRefresh(id) {
|
|
11
|
+
try {
|
|
12
|
+
const resp = await apiClient.post(`/api/v1/cli/ds/${id}/refresh`, {}, { timeoutMs: REFRESH_TRIGGER_TIMEOUT_MS });
|
|
13
|
+
return resp;
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
const msg = err instanceof Error ? err.message : String(err.detail ?? err);
|
|
17
|
+
if (msg.toLowerCase().includes("timeout") || msg.toLowerCase().includes("timed out")) {
|
|
18
|
+
return { id, status: "refreshing", error: "trigger timed out (refresh continues server-side)" };
|
|
19
|
+
}
|
|
20
|
+
return { id, status: "error", error: msg };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function formatRowCount(n) {
|
|
24
|
+
if (n >= 1_000_000)
|
|
25
|
+
return `${(n / 1_000_000).toFixed(1)}M`;
|
|
26
|
+
if (n >= 1_000)
|
|
27
|
+
return `${(n / 1_000).toFixed(1)}K`;
|
|
28
|
+
return String(n);
|
|
29
|
+
}
|
|
30
|
+
function printStatusTable(targets, statuses, errors, clearPrevious) {
|
|
31
|
+
const lines = [];
|
|
32
|
+
const nameWidth = Math.max(4, ...Array.from(targets.values()).map((ds) => ds.name.length));
|
|
33
|
+
lines.push(` ${"NAME".padEnd(nameWidth)} ${"STATUS".padEnd(12)} ${"ROWS".padStart(8)}`);
|
|
34
|
+
lines.push(` ${"─".repeat(nameWidth)} ${"─".repeat(12)} ${"─".repeat(8)}`);
|
|
35
|
+
for (const [id, ds] of targets) {
|
|
36
|
+
const status = statuses.get(id) ?? ds.status;
|
|
37
|
+
const error = errors.get(id);
|
|
38
|
+
const icon = status === "ready" ? "+" : status === "error" ? "x" : "*";
|
|
39
|
+
const rowStr = formatRowCount(ds.row_count).padStart(8);
|
|
40
|
+
let line = ` ${ds.name.padEnd(nameWidth)} ${icon} ${status.padEnd(10)} ${rowStr}`;
|
|
41
|
+
if (error)
|
|
42
|
+
line += ` ${error}`;
|
|
43
|
+
lines.push(line);
|
|
44
|
+
}
|
|
45
|
+
if (clearPrevious) {
|
|
46
|
+
process.stdout.write(`\x1B[${lines.length + 1}A\x1B[J`);
|
|
47
|
+
}
|
|
48
|
+
console.log(lines.join("\n"));
|
|
49
|
+
return lines.length;
|
|
50
|
+
}
|
|
51
|
+
async function pollUntilReady(targetIds, targets, errors) {
|
|
52
|
+
const isTTY = process.stdout.isTTY ?? false;
|
|
53
|
+
const statuses = new Map();
|
|
54
|
+
for (const id of targetIds)
|
|
55
|
+
statuses.set(id, "refreshing");
|
|
56
|
+
let printed = false;
|
|
57
|
+
printStatusTable(targets, statuses, errors, false);
|
|
58
|
+
printed = true;
|
|
59
|
+
const pollStart = Date.now();
|
|
60
|
+
while (true) {
|
|
61
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
62
|
+
if (Date.now() - pollStart > MAX_POLL_DURATION_MS) {
|
|
63
|
+
console.error(`\n Timed out after ${MAX_POLL_DURATION_MS / 60_000}m waiting for refresh to complete.`);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
const fresh = await fetchDSList();
|
|
67
|
+
const freshMap = new Map(fresh.map((ds) => [ds.id, ds]));
|
|
68
|
+
let allDone = true;
|
|
69
|
+
for (const id of targetIds) {
|
|
70
|
+
const ds = freshMap.get(id);
|
|
71
|
+
if (ds) {
|
|
72
|
+
statuses.set(id, ds.status);
|
|
73
|
+
targets.set(id, ds);
|
|
74
|
+
if (ds.status !== "ready" && ds.status !== "error")
|
|
75
|
+
allDone = false;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
allDone = false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (isTTY && printed) {
|
|
82
|
+
printStatusTable(targets, statuses, errors, true);
|
|
83
|
+
}
|
|
84
|
+
if (allDone) {
|
|
85
|
+
if (!isTTY && printed) {
|
|
86
|
+
console.log("");
|
|
87
|
+
printStatusTable(targets, statuses, errors, false);
|
|
88
|
+
}
|
|
89
|
+
const readyCount = Array.from(statuses.values()).filter((s) => s === "ready").length;
|
|
90
|
+
const errorCount = Array.from(statuses.values()).filter((s) => s === "error").length;
|
|
91
|
+
console.log(`\n ${readyCount}/${targetIds.size} refreshed${errorCount > 0 ? `, ${errorCount} failed` : ""}`);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
3
96
|
export function registerDSCommands(program) {
|
|
4
97
|
const ds = program.command("ds").description("Data source management");
|
|
5
98
|
ds.command("list")
|
|
@@ -38,12 +131,76 @@ export function registerDSCommands(program) {
|
|
|
38
131
|
errorOutput(err);
|
|
39
132
|
}
|
|
40
133
|
});
|
|
41
|
-
ds.command("refresh
|
|
42
|
-
.description("
|
|
43
|
-
.
|
|
134
|
+
ds.command("refresh [ids...]")
|
|
135
|
+
.description("Refresh data sources (use --all for all, or pass one or more IDs)")
|
|
136
|
+
.option("--all", "Refresh all data sources")
|
|
137
|
+
.option("--no-wait", "Trigger refreshes without waiting for completion")
|
|
138
|
+
.option("--skip-empty", "Skip data sources with 0 rows")
|
|
139
|
+
.action(async function (ids) {
|
|
44
140
|
try {
|
|
45
|
-
const
|
|
46
|
-
|
|
141
|
+
const opts = this.opts();
|
|
142
|
+
const all = opts.all;
|
|
143
|
+
const wait = opts.wait;
|
|
144
|
+
const skipEmpty = opts.skipEmpty;
|
|
145
|
+
const allSources = await fetchDSList();
|
|
146
|
+
const sourceMap = new Map(allSources.map((ds) => [ds.id, ds]));
|
|
147
|
+
let targetIds;
|
|
148
|
+
if (all) {
|
|
149
|
+
let filtered = allSources;
|
|
150
|
+
if (skipEmpty) {
|
|
151
|
+
filtered = allSources.filter((ds) => ds.row_count > 0);
|
|
152
|
+
}
|
|
153
|
+
if (filtered.length === 0) {
|
|
154
|
+
console.log(" No data sources to refresh.");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
targetIds = filtered.map((ds) => ds.id);
|
|
158
|
+
console.log(` Refreshing ${filtered.length} data source${filtered.length > 1 ? "s" : ""}...\n`);
|
|
159
|
+
}
|
|
160
|
+
else if (ids.length > 0) {
|
|
161
|
+
for (const id of ids) {
|
|
162
|
+
if (!sourceMap.has(id)) {
|
|
163
|
+
console.error(JSON.stringify({ error: `Data source '${id}' not found` }));
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
targetIds = ids;
|
|
168
|
+
console.log(` Refreshing ${ids.length} data source${ids.length > 1 ? "s" : ""}...\n`);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
console.error(JSON.stringify({ error: "Provide data source IDs or use --all" }));
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
const targets = new Map();
|
|
175
|
+
for (const id of targetIds) {
|
|
176
|
+
targets.set(id, sourceMap.get(id));
|
|
177
|
+
}
|
|
178
|
+
const results = await Promise.allSettled(targetIds.map((id) => triggerRefresh(id)));
|
|
179
|
+
const errors = new Map();
|
|
180
|
+
const triggered = new Set();
|
|
181
|
+
for (let i = 0; i < results.length; i++) {
|
|
182
|
+
const r = results[i];
|
|
183
|
+
const id = targetIds[i];
|
|
184
|
+
if (r.status === "fulfilled") {
|
|
185
|
+
if (r.value.error)
|
|
186
|
+
errors.set(id, r.value.error);
|
|
187
|
+
if (r.value.status !== "error")
|
|
188
|
+
triggered.add(id);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
errors.set(id, String(r.reason));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (!wait) {
|
|
195
|
+
const statuses = new Map();
|
|
196
|
+
for (const id of targetIds) {
|
|
197
|
+
statuses.set(id, triggered.has(id) ? "refreshing" : "error");
|
|
198
|
+
}
|
|
199
|
+
printStatusTable(targets, statuses, errors, false);
|
|
200
|
+
console.log(`\n ${triggered.size}/${targetIds.length} triggered (not waiting)`);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
await pollUntilReady(new Set(targetIds), targets, errors);
|
|
47
204
|
}
|
|
48
205
|
catch (err) {
|
|
49
206
|
errorOutput(err);
|
package/dist/commands/ds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ds.js","sourceRoot":"","sources":["../../src/commands/ds.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;IAEvE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,mBAAmB,CAAC;SAChC,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,IAAI,CAAC;SAC1C,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,SAAS,CAAC,KAAK,CAChC,gCAAgC,EAAE,EAAE,EACpC,IAAI,CACL,CAAC;YACF,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
package/skills/graphit/SKILL.md
CHANGED
|
@@ -22,6 +22,16 @@ If the output includes an "Update available" banner, tell the user to update bef
|
|
|
22
22
|
When any `graphit` command fails with an unexpected error (unknown command, unrecognized flag, non-zero exit with unclear message), suggest `npm update -g @graphit/cli` before investigating further. Outdated CLI versions are the most common cause of unexpected errors.
|
|
23
23
|
Do NOT suggest updating for normal operational failures (expired auth, bad SQL syntax, network timeout, entity not found).
|
|
24
24
|
|
|
25
|
+
## Permission Errors
|
|
26
|
+
|
|
27
|
+
The CLI enforces the same permission model as the platform. Three error codes to know:
|
|
28
|
+
|
|
29
|
+
- **403 "This feature requires an Analyst seat"** - viewer-seat users are blocked from all CLI commands except `graphit auth` and `graphit me`. The CLI is an analyst tool; viewers use the platform UI.
|
|
30
|
+
- **404 "not found"** - returned for dashboards the user cannot access (private dashboards owned by others, team dashboards the user is not on). The API intentionally does not distinguish "does not exist" from "you cannot access it" to prevent ID enumeration.
|
|
31
|
+
- **423 "Shared dashboard requires an active editing session"** - shared dashboard mutations require the user to enter Edit mode on the platform first (see constraint #4 below).
|
|
32
|
+
|
|
33
|
+
Connector create/delete are restricted to org admins (owner/admin role). Non-admin analysts get 403 on these commands.
|
|
34
|
+
|
|
25
35
|
## After Setup
|
|
26
36
|
|
|
27
37
|
After `graphit setup` completes successfully, offer to add a Graphit section to the project's CLAUDE.md (or AGENTS.md for Codex) so future sessions know Graphit is available without activating the skill. Suggested snippet:
|
|
@@ -216,6 +226,10 @@ For metrics with natural variant axes (D7/D30/D90, gross/net), propose parameter
|
|
|
216
226
|
| `graphit kb update <type> <name> --description "..."` | Update description (all types) |
|
|
217
227
|
| `graphit kb delete <type> <name> --yes` | Delete any entity (all types supported) |
|
|
218
228
|
| `graphit ds list` | List cached data sources (use these for fast queries) |
|
|
229
|
+
| `graphit ds refresh --all` | Refresh all data sources, wait for completion with live status |
|
|
230
|
+
| `graphit ds refresh --all --skip-empty` | Refresh non-empty data sources only |
|
|
231
|
+
| `graphit ds refresh --all --no-wait` | Trigger all refreshes without waiting |
|
|
232
|
+
| `graphit ds refresh <id> [id2...]` | Refresh one or more data sources by ID |
|
|
219
233
|
| `graphit query "<sql>" --ds <id>` | Query cached data source (~100ms) |
|
|
220
234
|
| `graphit query "<sql>" --ds <id> --override-rules RULE1 RULE2` | Query with governance rule overrides |
|
|
221
235
|
| `graphit query "<sql>" --ds <id> --verbose` | Show expanded SQL and trust tier |
|
|
@@ -29,3 +29,23 @@ When you change a dashboard filter (e.g. switch country), Graphit answers from a
|
|
|
29
29
|
| Size | A few-thousand-row typical aggregation | Sitting at the 100M-row / 5GB ceiling |
|
|
30
30
|
|
|
31
31
|
Build the source small and pre-aggregated, and dashboards on it stay fast and filterable.
|
|
32
|
+
|
|
33
|
+
## Refreshing data sources
|
|
34
|
+
|
|
35
|
+
Data sources cache a snapshot of the Snowflake query result. Refresh when you need current data.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Refresh all data sources and wait for completion (live status table)
|
|
39
|
+
graphit ds refresh --all
|
|
40
|
+
|
|
41
|
+
# Refresh only non-empty sources (skip 0-row DSes)
|
|
42
|
+
graphit ds refresh --all --skip-empty
|
|
43
|
+
|
|
44
|
+
# Fire-and-forget (trigger refreshes, don't wait)
|
|
45
|
+
graphit ds refresh --all --no-wait
|
|
46
|
+
|
|
47
|
+
# Refresh specific sources by ID
|
|
48
|
+
graphit ds refresh <id1> <id2>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The CLI fires all refreshes in parallel and polls until every source is ready. Large sources (millions of rows) may take 30-60s; the CLI handles this gracefully without timeout errors. Use `--no-wait` when you only need to trigger the refresh and will check status later via `graphit ds list`.
|
|
@@ -52,8 +52,12 @@ KB asset references are derived automatically from `{{metric:X}}` / `{{dim:X}}`
|
|
|
52
52
|
|
|
53
53
|
**Label = visible title.** The `data-graphit-label` MUST match the card's visible heading exactly.
|
|
54
54
|
|
|
55
|
-
### 4.
|
|
56
|
-
|
|
55
|
+
### 4. Permission errors
|
|
56
|
+
The CLI enforces the same permission model as the platform:
|
|
57
|
+
- **403 "Analyst seat required"** - viewer-seat users are blocked from all CLI commands except `graphit auth` and `graphit me`. Viewers use the platform UI.
|
|
58
|
+
- **404 "not found"** - returned for dashboards the user cannot access (private dashboards owned by others, team dashboards the user is not on). The API does not distinguish "does not exist" from "you cannot access it."
|
|
59
|
+
- **423 "Shared dashboard requires an active editing session"** - shared dashboard mutations require the user to enter Edit mode on the platform first. Tell the user to open the dashboard and click **Edit**. Private dashboards are unaffected.
|
|
60
|
+
- Connector create/delete are restricted to org admins (owner/admin role).
|
|
57
61
|
|
|
58
62
|
### 5. ALWAYS use graphit.resolve() for live data
|
|
59
63
|
NEVER embed query results as static JS variables. The dashboard iframe provides `graphit.resolve()` which fetches live data from cached data sources on every page load.
|
|
@@ -88,6 +92,7 @@ You are the rendering layer - format and present every CLI result using markdown
|
|
|
88
92
|
**After `graphit kb search`** - result count + table with type column
|
|
89
93
|
**After `graphit kb explore`** - tree structure: Asset > Tables > Dimensions > Rules
|
|
90
94
|
**After `graphit ds list`** - table with Name, ID, Rows, Status, Governed + recommend which DS to use
|
|
95
|
+
**After `graphit ds refresh --all`** - live status table showing each DS name, status (refreshing/ready/error), and row count. Suggest `--skip-empty` if many 0-row sources exist.
|
|
91
96
|
**After `graphit governance status`** - mode + conformance table (Governed/Ad-hoc/Blocked with counts and %)
|
|
92
97
|
**After errors** - bold error message + actionable fix suggestion
|
|
93
98
|
|
|
@@ -23,3 +23,23 @@ When you change a dashboard filter (e.g. switch country), Graphit answers from a
|
|
|
23
23
|
| Size | A few-thousand-row typical aggregation | Sitting at the 100M-row / 5GB ceiling |
|
|
24
24
|
|
|
25
25
|
Build the source small and pre-aggregated, and dashboards on it stay fast and filterable.
|
|
26
|
+
|
|
27
|
+
## Refreshing data sources
|
|
28
|
+
|
|
29
|
+
Data sources cache a snapshot of the Snowflake query result. Refresh when you need current data.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Refresh all data sources and wait for completion (live status table)
|
|
33
|
+
graphit ds refresh --all
|
|
34
|
+
|
|
35
|
+
# Refresh only non-empty sources (skip 0-row DSes)
|
|
36
|
+
graphit ds refresh --all --skip-empty
|
|
37
|
+
|
|
38
|
+
# Fire-and-forget (trigger refreshes, don't wait)
|
|
39
|
+
graphit ds refresh --all --no-wait
|
|
40
|
+
|
|
41
|
+
# Refresh specific sources by ID
|
|
42
|
+
graphit ds refresh <id1> <id2>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The CLI fires all refreshes in parallel and polls until every source is ready. Large sources (millions of rows) may take 30-60s; the CLI handles this gracefully without timeout errors. Use `--no-wait` when you only need to trigger the refresh and will check status later via `graphit ds list`.
|