@relyio/cli 0.3.0 → 0.3.1

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 +26 -37
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import * as yaml2 from 'js-yaml';
15
15
  import { glob } from 'glob';
16
16
  import { createJiti } from 'jiti';
17
17
  import { fileURLToPath } from 'url';
18
- import { execFileSync, execSync, spawn } from 'child_process';
18
+ import { execFileSync, spawn, execSync } from 'child_process';
19
19
  import Handlebars from 'handlebars';
20
20
  import 'object-hash';
21
21
  import 'semver';
@@ -8920,8 +8920,8 @@ var init_context_provider = __esm({
8920
8920
  }
8921
8921
  async getCurrentGitBranch() {
8922
8922
  try {
8923
- const { execSync: execSync3 } = await import('child_process');
8924
- const branch = execSync3("git rev-parse --abbrev-ref HEAD", {
8923
+ const { execSync: execSync2 } = await import('child_process');
8924
+ const branch = execSync2("git rev-parse --abbrev-ref HEAD", {
8925
8925
  encoding: "utf8",
8926
8926
  stdio: ["pipe", "pipe", "pipe"]
8927
8927
  }).trim();
@@ -10719,7 +10719,7 @@ var init_banner = __esm({
10719
10719
  init_dev_cockpit_context();
10720
10720
  init_dev_cockpit_format();
10721
10721
  init_startup_info();
10722
- CLI_VERSION2 = "0.3.0" ;
10722
+ CLI_VERSION2 = "0.3.1" ;
10723
10723
  BRAND_GLYPH = "\u25B6";
10724
10724
  BRAND_NAME = "RelyIO";
10725
10725
  LABEL_WIDTH = 9;
@@ -20440,7 +20440,7 @@ function sandboxCommands(program2) {
20440
20440
  }
20441
20441
 
20442
20442
  // src/commands/version.ts
20443
- var CLI_VERSION = "0.3.0" ;
20443
+ var CLI_VERSION = "0.3.1" ;
20444
20444
  async function handleVersion(_options) {
20445
20445
  console.log(heading("RelyIO CLI Version Information"));
20446
20446
  const versionInfo = [
@@ -22355,40 +22355,23 @@ var THEME5 = {
22355
22355
  link: chalk12.cyan.underline
22356
22356
  };
22357
22357
  async function getDashboardPath(target) {
22358
- const dashboardUrl = config_default.getDashboardUrl();
22359
- const projectId = config_default.getProjectId();
22360
- const organizationId = config_default.getOrganizationId();
22358
+ const dashboardUrl = config_default.getDashboardUrl().replace(/\/+$/, "");
22361
22359
  switch (target) {
22362
22360
  case "dashboard": {
22363
22361
  return dashboardUrl;
22364
22362
  }
22365
- case "project": {
22366
- if (!projectId) {
22367
- throw new Error("No project linked. Run 'relyio link' first.");
22368
- }
22369
- return `${dashboardUrl}/projects/${projectId}`;
22370
- }
22363
+ // The Dashboard has no page per branch, so a branch opens the Project it belongs to.
22364
+ case "project":
22371
22365
  case "branch": {
22372
- if (!projectId) {
22373
- throw new Error("No project linked. Run 'relyio link' first.");
22374
- }
22375
- const currentBranch = getCurrentGitBranch2();
22376
- if (currentBranch) {
22377
- try {
22378
- const branches = await manage_default.getProjectBranches(projectId, { name: currentBranch });
22379
- if (branches.length > 0) {
22380
- return `${dashboardUrl}/projects/${projectId}/branches/${branches[0].id}`;
22381
- }
22382
- } catch {
22383
- }
22384
- }
22385
- return `${dashboardUrl}/projects/${projectId}`;
22366
+ const { organizationId, projectId } = await linkedProject();
22367
+ return `${dashboardUrl}/o/${encodeURIComponent(organizationId)}/${encodeURIComponent(projectId)}`;
22386
22368
  }
22387
22369
  case "settings": {
22370
+ const organizationId = config_default.getOrganizationId();
22388
22371
  if (organizationId) {
22389
- return `${dashboardUrl}/organizations/${organizationId}/settings`;
22372
+ return `${dashboardUrl}/o/${encodeURIComponent(organizationId)}/settings`;
22390
22373
  }
22391
- return `${dashboardUrl}/settings`;
22374
+ return `${dashboardUrl}/account/settings`;
22392
22375
  }
22393
22376
  case "docs": {
22394
22377
  return "https://docs.relyio.com";
@@ -22401,12 +22384,15 @@ async function getDashboardPath(target) {
22401
22384
  }
22402
22385
  }
22403
22386
  }
22404
- function getCurrentGitBranch2() {
22405
- try {
22406
- return execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf8" }).trim();
22407
- } catch {
22408
- return null;
22387
+ async function linkedProject() {
22388
+ const projectId = config_default.getProjectId();
22389
+ if (!projectId) {
22390
+ throw new Error("No project linked. Run 'relyio link' first.");
22409
22391
  }
22392
+ const linked = config_default.getOrganizationId();
22393
+ if (linked) return { organizationId: linked, projectId };
22394
+ const project = await manage_default.getProject(projectId);
22395
+ return { organizationId: project.organizationId, projectId };
22410
22396
  }
22411
22397
  async function handleOpen(target, options) {
22412
22398
  const resolvedTarget = target || options.target || "dashboard";
@@ -22421,6 +22407,9 @@ async function handleOpen(target, options) {
22421
22407
  console.log();
22422
22408
  console.log(THEME5.success("\u2713") + ` Opening ${THEME5.bold(resolvedTarget)} in browser...`);
22423
22409
  console.log(THEME5.muted(` ${url}`));
22410
+ if (resolvedTarget === "branch") {
22411
+ console.log(THEME5.muted(" The Dashboard has no page per branch, so this is the project."));
22412
+ }
22424
22413
  await open(url);
22425
22414
  } catch (error2) {
22426
22415
  console.error(chalk12.red(`Failed to open: ${error2.message}`));
@@ -22441,7 +22430,7 @@ function openCommand(program2) {
22441
22430
  Targets:
22442
22431
  dashboard Open the main dashboard (default)
22443
22432
  project Open the current project
22444
- branch Open the current branch
22433
+ branch Open the current branch's project (the Dashboard has no page per branch)
22445
22434
  settings Open settings page
22446
22435
  docs Open documentation
22447
22436
  api Open API documentation
@@ -24603,7 +24592,7 @@ Examples:
24603
24592
  }
24604
24593
 
24605
24594
  // src/index.ts
24606
- var CLI_VERSION3 = "0.3.0" ;
24595
+ var CLI_VERSION3 = "0.3.1" ;
24607
24596
  var program = new Command();
24608
24597
  program.name("relyio").description("RelyIO CLI - Content Management, Simplified").version(CLI_VERSION3);
24609
24598
  registerGlobalOptions(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relyio/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "RelyIO is coming soon — this package is not ready for general use yet.",
5
5
  "bugs": {
6
6
  "email": "team@relyio.com"
@@ -65,14 +65,14 @@
65
65
  "typescript": "npm:@typescript/typescript6@6.0.2",
66
66
  "typescript-eslint": "8.69.0",
67
67
  "vitest": "4.1.11",
68
- "@relyio/codegen-python": "0.1.0",
69
68
  "@relyio/codegen-core": "1.0.0",
70
- "@relyio/api-contract": "0.1.0",
69
+ "@relyio/codegen-python": "0.1.0",
70
+ "@relyio/codegen-typescript": "1.0.0",
71
71
  "@relyio/device-auth": "0.0.0",
72
72
  "@relyio/eslint-config": "0.0.0",
73
73
  "@relyio/schema": "0.0.1",
74
- "@relyio/sdk": "0.4.0",
75
- "@relyio/codegen-typescript": "1.0.0",
74
+ "@relyio/api-contract": "0.1.0",
75
+ "@relyio/sdk": "0.5.0",
76
76
  "@relyio/tenancy": "0.1.0"
77
77
  },
78
78
  "publishConfig": {