@overscore/cli 0.13.13 → 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 +40 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1901,6 +1901,27 @@ async function analysisNew(title) {
1901
1901
  https://${data.project_slug}.${HUB_HOST}/analysis/${data.slug}
1902
1902
  `);
1903
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
+ }
1904
1925
  function loadAnalysisMetadata() {
1905
1926
  const metaPath = path.resolve(process.cwd(), ".overscore", "analysis.json");
1906
1927
  if (!fs.existsSync(metaPath)) {
@@ -2915,6 +2936,25 @@ else if (command === "analysis") {
2915
2936
  `);
2916
2937
  }
2917
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
+ }
2918
2958
  else if (command === "platform") {
2919
2959
  if (subcommand === "update") {
2920
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.13",
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"