@indigoai-us/hq-cli 5.62.0 → 5.62.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.62.1]
6
+
7
+ ### Added
8
+
9
+ - **`hq db provision` / `hq db status --remote` use Cognito + vault API** to call the live control plane (`POST /v1/db/provision`, `GET /v1/db/status`). Team plan required for provision; local `status|sql|migrate` unchanged.
10
+
11
+
5
12
  ## [5.55.1]
6
13
 
7
14
  ### Fixed
@@ -2,31 +2,34 @@
2
2
  * hq db provision — request remote vault DB binding (US-009).
3
3
  */
4
4
 
5
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cecdf1ea-3f73-54c4-adc0-f11caebf1e55")}catch(e){}}();
5
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f0d312c6-3730-5e46-b21f-c694723d0f5b")}catch(e){}}();
6
6
  import chalk from "chalk";
7
7
  import { ControlPlaneDbClient } from "../lib/db/control-plane.js";
8
+ import { DEFAULT_VAULT_API_URL, ensureCognitoToken, } from "../utils/cognito-session.js";
9
+ import { getCompanyUid } from "../utils/vault-api.js";
8
10
  const defaultDeps = () => ({
9
11
  async resolveCompany(slug) {
10
- // Production path: resolve via vault API membership. Tests inject mocks.
11
- // Keep slug as placeholder uid only when HQ_DB_MOCK_CONTROL_PLANE=1.
12
12
  if (process.env.HQ_DB_MOCK_CONTROL_PLANE === "1") {
13
13
  return { companyUid: `cmp_${slug}`, companySlug: slug };
14
14
  }
15
- throw new Error("company resolution not wired in this build path — inject deps or set HQ_DB_MOCK_CONTROL_PLANE=1 for local mock");
15
+ const token = await ensureCognitoToken({ interactive: false });
16
+ const companyUid = await getCompanyUid(token, slug);
17
+ return { companyUid, companySlug: slug.trim().toLowerCase() };
16
18
  },
17
19
  async getAccessToken() {
18
20
  if (process.env.HQ_DB_MOCK_CONTROL_PLANE === "1") {
19
21
  return "mock-token";
20
22
  }
21
- throw new Error("auth token resolution not wired — inject deps for production");
23
+ return ensureCognitoToken({ interactive: false });
22
24
  },
23
- apiBaseUrl: process.env.HQ_API_BASE_URL ||
25
+ apiBaseUrl: process.env.HQ_VAULT_API_URL ||
26
+ process.env.HQ_API_BASE_URL ||
24
27
  process.env.HQ_CLOUD_API_URL ||
25
- "https://hqapi.getindigo.ai",
28
+ DEFAULT_VAULT_API_URL,
26
29
  });
27
30
  export function registerDbProvisionCommand(db, depsFactory = defaultDeps) {
28
31
  db.command("provision")
29
- .description("Provision (or re-bind) the company remote vault DB via HQ control plane")
32
+ .description("Provision (or re-bind) the company remote vault DB via HQ control plane (Team plan)")
30
33
  .requiredOption("--company <slug>", "Company slug")
31
34
  .option("--region <region>", "AWS region", "us-east-1")
32
35
  .action(async (opts) => {
@@ -64,6 +67,10 @@ export function registerDbProvisionCommand(db, depsFactory = defaultDeps) {
64
67
  console.error(chalk.red("Error:"), "Remote vault DB requires the HQ Team plan ($500/mo).");
65
68
  console.error(chalk.dim("Local databases still work: hq db status|sql|migrate — no Team plan required."));
66
69
  }
70
+ else if (status === 404 || /Unknown route|Not Found/i.test(msg)) {
71
+ console.error(chalk.red("Error:"), "Remote DB control plane is not available yet (routes not deployed).");
72
+ console.error(chalk.dim("Local hq db status|sql|migrate still work offline."));
73
+ }
67
74
  else {
68
75
  console.error(chalk.red("Error:"), msg);
69
76
  }
@@ -75,4 +82,4 @@ export function registerDbProvisionCommand(db, depsFactory = defaultDeps) {
75
82
  });
76
83
  }
77
84
  //# sourceMappingURL=db-provision.js.map
78
- //# debugId=cecdf1ea-3f73-54c4-adc0-f11caebf1e55
85
+ //# debugId=f0d312c6-3730-5e46-b21f-c694723d0f5b
@@ -3,7 +3,7 @@
3
3
  * Optionally reports remote tier when control plane returns a binding (US-009).
4
4
  */
5
5
 
6
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8b820218-b1e5-57a2-8acd-d8e749a0d83f")}catch(e){}}();
6
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b0f21394-45cb-572c-890b-bcdf0fc9e7d7")}catch(e){}}();
7
7
  import chalk from "chalk";
8
8
  import { ControlPlaneDbClient } from "../lib/db/control-plane.js";
9
9
  import { ensureAndStatusLocalDb, formatLocalDbStatus, } from "../lib/db/local.js";
@@ -26,19 +26,23 @@ export function registerDbStatusCommand(db) {
26
26
  // Never print remote connection material.
27
27
  console.log(formatLocalDbStatus(status));
28
28
  if (opts.remote) {
29
- const companyUid = opts.companyUid || `cmp_${company}`;
30
- const baseUrl = process.env.HQ_API_BASE_URL ||
31
- process.env.HQ_CLOUD_API_URL ||
32
- "https://hqapi.getindigo.ai";
29
+ const { DEFAULT_VAULT_API_URL, ensureCognitoToken } = await import("../utils/cognito-session.js");
30
+ const { getCompanyUid } = await import("../utils/vault-api.js");
33
31
  try {
32
+ const token = process.env.HQ_DB_MOCK_CONTROL_PLANE === "1"
33
+ ? "mock-token"
34
+ : await ensureCognitoToken({ interactive: false });
35
+ const companyUid = opts.companyUid ||
36
+ (process.env.HQ_DB_MOCK_CONTROL_PLANE === "1"
37
+ ? `cmp_${company}`
38
+ : await getCompanyUid(token, company));
39
+ const baseUrl = process.env.HQ_VAULT_API_URL ||
40
+ process.env.HQ_API_BASE_URL ||
41
+ process.env.HQ_CLOUD_API_URL ||
42
+ DEFAULT_VAULT_API_URL;
34
43
  const client = new ControlPlaneDbClient({
35
44
  baseUrl,
36
- getAccessToken: async () => {
37
- if (process.env.HQ_DB_MOCK_CONTROL_PLANE === "1") {
38
- return "mock-token";
39
- }
40
- throw new Error("auth required for remote status");
41
- },
45
+ getAccessToken: async () => token,
42
46
  });
43
47
  const remote = await client.status(companyUid);
44
48
  if (!remote.remote) {
@@ -67,4 +71,4 @@ export function registerDbStatusCommand(db) {
67
71
  });
68
72
  }
69
73
  //# sourceMappingURL=db-status.js.map
70
- //# debugId=8b820218-b1e5-57a2-8acd-d8e749a0d83f
74
+ //# debugId=b0f21394-45cb-572c-890b-bcdf0fc9e7d7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.62.0",
3
+ "version": "5.62.1",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -6,6 +6,11 @@ import { Command } from "commander";
6
6
  import chalk from "chalk";
7
7
 
8
8
  import { ControlPlaneDbClient } from "../lib/db/control-plane.js";
9
+ import {
10
+ DEFAULT_VAULT_API_URL,
11
+ ensureCognitoToken,
12
+ } from "../utils/cognito-session.js";
13
+ import { getCompanyUid } from "../utils/vault-api.js";
9
14
 
10
15
  export interface DbProvisionCommandDeps {
11
16
  resolveCompany: (slug: string) => Promise<{ companyUid: string; companySlug: string }>;
@@ -16,25 +21,24 @@ export interface DbProvisionCommandDeps {
16
21
 
17
22
  const defaultDeps = (): DbProvisionCommandDeps => ({
18
23
  async resolveCompany(slug) {
19
- // Production path: resolve via vault API membership. Tests inject mocks.
20
- // Keep slug as placeholder uid only when HQ_DB_MOCK_CONTROL_PLANE=1.
21
24
  if (process.env.HQ_DB_MOCK_CONTROL_PLANE === "1") {
22
25
  return { companyUid: `cmp_${slug}`, companySlug: slug };
23
26
  }
24
- throw new Error(
25
- "company resolution not wired in this build path — inject deps or set HQ_DB_MOCK_CONTROL_PLANE=1 for local mock",
26
- );
27
+ const token = await ensureCognitoToken({ interactive: false });
28
+ const companyUid = await getCompanyUid(token, slug);
29
+ return { companyUid, companySlug: slug.trim().toLowerCase() };
27
30
  },
28
31
  async getAccessToken() {
29
32
  if (process.env.HQ_DB_MOCK_CONTROL_PLANE === "1") {
30
33
  return "mock-token";
31
34
  }
32
- throw new Error("auth token resolution not wired — inject deps for production");
35
+ return ensureCognitoToken({ interactive: false });
33
36
  },
34
37
  apiBaseUrl:
38
+ process.env.HQ_VAULT_API_URL ||
35
39
  process.env.HQ_API_BASE_URL ||
36
40
  process.env.HQ_CLOUD_API_URL ||
37
- "https://hqapi.getindigo.ai",
41
+ DEFAULT_VAULT_API_URL,
38
42
  });
39
43
 
40
44
  export function registerDbProvisionCommand(
@@ -43,7 +47,7 @@ export function registerDbProvisionCommand(
43
47
  ): void {
44
48
  db.command("provision")
45
49
  .description(
46
- "Provision (or re-bind) the company remote vault DB via HQ control plane",
50
+ "Provision (or re-bind) the company remote vault DB via HQ control plane (Team plan)",
47
51
  )
48
52
  .requiredOption("--company <slug>", "Company slug")
49
53
  .option("--region <region>", "AWS region", "us-east-1")
@@ -90,6 +94,14 @@ export function registerDbProvisionCommand(
90
94
  "Local databases still work: hq db status|sql|migrate — no Team plan required.",
91
95
  ),
92
96
  );
97
+ } else if (status === 404 || /Unknown route|Not Found/i.test(msg)) {
98
+ console.error(
99
+ chalk.red("Error:"),
100
+ "Remote DB control plane is not available yet (routes not deployed).",
101
+ );
102
+ console.error(
103
+ chalk.dim("Local hq db status|sql|migrate still work offline."),
104
+ );
93
105
  } else {
94
106
  console.error(chalk.red("Error:"), msg);
95
107
  }
@@ -55,20 +55,28 @@ export function registerDbStatusCommand(db: Command): void {
55
55
  console.log(formatLocalDbStatus(status));
56
56
 
57
57
  if (opts.remote) {
58
- const companyUid = opts.companyUid || `cmp_${company}`;
59
- const baseUrl =
60
- process.env.HQ_API_BASE_URL ||
61
- process.env.HQ_CLOUD_API_URL ||
62
- "https://hqapi.getindigo.ai";
58
+ const { DEFAULT_VAULT_API_URL, ensureCognitoToken } = await import(
59
+ "../utils/cognito-session.js"
60
+ );
61
+ const { getCompanyUid } = await import("../utils/vault-api.js");
63
62
  try {
63
+ const token =
64
+ process.env.HQ_DB_MOCK_CONTROL_PLANE === "1"
65
+ ? "mock-token"
66
+ : await ensureCognitoToken({ interactive: false });
67
+ const companyUid =
68
+ opts.companyUid ||
69
+ (process.env.HQ_DB_MOCK_CONTROL_PLANE === "1"
70
+ ? `cmp_${company}`
71
+ : await getCompanyUid(token, company));
72
+ const baseUrl =
73
+ process.env.HQ_VAULT_API_URL ||
74
+ process.env.HQ_API_BASE_URL ||
75
+ process.env.HQ_CLOUD_API_URL ||
76
+ DEFAULT_VAULT_API_URL;
64
77
  const client = new ControlPlaneDbClient({
65
78
  baseUrl,
66
- getAccessToken: async () => {
67
- if (process.env.HQ_DB_MOCK_CONTROL_PLANE === "1") {
68
- return "mock-token";
69
- }
70
- throw new Error("auth required for remote status");
71
- },
79
+ getAccessToken: async () => token,
72
80
  });
73
81
  const remote = await client.status(companyUid);
74
82
  if (!remote.remote) {