@overscore/cli 0.13.12 → 0.13.14

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 (2) hide show
  1. package/dist/index.js +52 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -194,6 +194,18 @@ async function apiRequest(method, urlPath, body, command) {
194
194
  console.error(" BigQuery — inspect dataset columns and sample rows with: npm run queries");
195
195
  console.error(" • The project should use BigQuery but no warehouse is connected yet — connect it in the Hub.\n");
196
196
  }
197
+ // Dataset-scoped service account: it can READ a named dataset but can't LIST
198
+ // datasets (project/region INFORMATION_SCHEMA.SCHEMATA needs project-level
199
+ // access). This is where the AI tends to rabbit-hole guessing names — tell it
200
+ // to stop and ASK the user instead.
201
+ if (/INFORMATION_SCHEMA\.SCHEMATA/i.test(errMsg) &&
202
+ /(access denied|datasets\.(get|list)|does not have)/i.test(errMsg)) {
203
+ console.error(" The service account is scoped to specific dataset(s), so it can't LIST datasets.");
204
+ console.error(" • Do NOT guess dataset names. Ask the user: \"Which dataset should I use?\" (and its region, e.g. US).");
205
+ console.error(" • Then explore it directly — this works with a dataset-scoped grant:");
206
+ console.error(" npx @overscore/cli query run \"SELECT table_name FROM \\`<project>\\`.<dataset>.INFORMATION_SCHEMA.TABLES\"");
207
+ console.error(" • For auto-discovery instead, the user can grant BigQuery Data Viewer at the PROJECT level.\n");
208
+ }
197
209
  process.exit(1);
198
210
  }
199
211
  return data;
@@ -1889,6 +1901,27 @@ async function analysisNew(title) {
1889
1901
  https://${data.project_slug}.${HUB_HOST}/analysis/${data.slug}
1890
1902
  `);
1891
1903
  }
1904
+ async function dashboardCreate(name, slugArg, description) {
1905
+ if (!name || name.startsWith("--")) {
1906
+ console.error('\n Usage: npx @overscore/cli dashboard create "<name>" [--slug <slug>] [--description <text>]\n');
1907
+ process.exit(1);
1908
+ }
1909
+ // Reuses the project-level config/request helpers (resolve project + key, then POST).
1910
+ const cfg = await loadAnalysisConfig();
1911
+ console.log(`\n Creating dashboard: "${name}"\n`);
1912
+ const data = (await analysisApiRequest(cfg, "POST", `/api/projects/${cfg.projectSlug}/dashboards`, { name, slug: slugArg, description }));
1913
+ console.log(` Dashboard created: ${data.name}
1914
+ Slug: ${data.slug}
1915
+ Project: ${data.project_slug}
1916
+
1917
+ Next step — scaffold the local folder for it:
1918
+
1919
+ npm create overscore@latest -- --project ${data.project_slug} --dashboard ${data.slug}
1920
+
1921
+ then build it and \`npx @overscore/cli deploy\`. It will be live at:
1922
+ https://${data.project_slug}.${HUB_HOST}/${data.slug}/
1923
+ `);
1924
+ }
1892
1925
  function loadAnalysisMetadata() {
1893
1926
  const metaPath = path.resolve(process.cwd(), ".overscore", "analysis.json");
1894
1927
  if (!fs.existsSync(metaPath)) {
@@ -2903,6 +2936,25 @@ else if (command === "analysis") {
2903
2936
  `);
2904
2937
  }
2905
2938
  }
2939
+ else if (command === "dashboard") {
2940
+ if (subcommand === "create") {
2941
+ const slugIdx = process.argv.indexOf("--slug");
2942
+ const descIdx = process.argv.indexOf("--description");
2943
+ dashboardCreate(process.argv[4], slugIdx !== -1 ? process.argv[slugIdx + 1] : undefined, descIdx !== -1 ? process.argv[descIdx + 1] : undefined);
2944
+ }
2945
+ else {
2946
+ console.log(`
2947
+ overscore dashboard — Manage dashboards
2948
+
2949
+ Commands:
2950
+ create "<name>" [--slug <slug>] [--description <text>]
2951
+ Create a new (empty) dashboard in your project
2952
+
2953
+ Examples:
2954
+ npx @overscore/cli dashboard create "Sales Pipeline (metrics)" --slug sales-pipeline-metrics
2955
+ `);
2956
+ }
2957
+ }
2906
2958
  else if (command === "platform") {
2907
2959
  if (subcommand === "update") {
2908
2960
  const checkOnly = process.argv.includes("--check");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overscore/cli",
3
- "version": "0.13.12",
3
+ "version": "0.13.14",
4
4
  "description": "CLI for deploying Overscore dashboards and publishing analyses",
5
5
  "bin": {
6
6
  "overscore": "dist/index.js"