@indigoai-us/hq-cli 5.5.0 → 5.5.2

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 (103) hide show
  1. package/dist/bin/hq-auth-refresh.js +0 -0
  2. package/dist/commands/add.d.ts.map +1 -1
  3. package/dist/commands/add.js +2 -1
  4. package/dist/commands/add.js.map +1 -1
  5. package/dist/commands/auth.d.ts +0 -3
  6. package/dist/commands/auth.d.ts.map +1 -1
  7. package/dist/commands/auth.js +0 -3
  8. package/dist/commands/auth.js.map +1 -1
  9. package/dist/commands/cloud.d.ts +12 -2
  10. package/dist/commands/cloud.d.ts.map +1 -1
  11. package/dist/commands/cloud.js +112 -80
  12. package/dist/commands/cloud.js.map +1 -1
  13. package/dist/commands/list.d.ts.map +1 -1
  14. package/dist/commands/list.js +18 -1
  15. package/dist/commands/list.js.map +1 -1
  16. package/dist/commands/login.d.ts +1 -1
  17. package/dist/commands/login.d.ts.map +1 -1
  18. package/dist/commands/login.js +28 -9
  19. package/dist/commands/login.js.map +1 -1
  20. package/dist/commands/logout.d.ts +1 -1
  21. package/dist/commands/logout.d.ts.map +1 -1
  22. package/dist/commands/logout.js +8 -3
  23. package/dist/commands/logout.js.map +1 -1
  24. package/dist/commands/onboard.d.ts +23 -0
  25. package/dist/commands/onboard.d.ts.map +1 -0
  26. package/dist/commands/onboard.js +142 -0
  27. package/dist/commands/onboard.js.map +1 -0
  28. package/dist/commands/pack-install.d.ts +44 -0
  29. package/dist/commands/pack-install.d.ts.map +1 -0
  30. package/dist/commands/pack-install.js +513 -0
  31. package/dist/commands/pack-install.js.map +1 -0
  32. package/dist/commands/pkg-install.d.ts.map +1 -1
  33. package/dist/commands/pkg-install.js +20 -8
  34. package/dist/commands/pkg-install.js.map +1 -1
  35. package/dist/commands/pkg-list.js +4 -4
  36. package/dist/commands/pkg-list.js.map +1 -1
  37. package/dist/commands/pkg-update.js +3 -3
  38. package/dist/commands/pkg-update.js.map +1 -1
  39. package/dist/commands/secrets.d.ts +3 -0
  40. package/dist/commands/secrets.d.ts.map +1 -0
  41. package/dist/commands/secrets.js +521 -0
  42. package/dist/commands/secrets.js.map +1 -0
  43. package/dist/commands/sync.d.ts.map +1 -1
  44. package/dist/commands/sync.js +10 -2
  45. package/dist/commands/sync.js.map +1 -1
  46. package/dist/commands/team-sync.d.ts.map +1 -1
  47. package/dist/commands/team-sync.js +6 -6
  48. package/dist/commands/team-sync.js.map +1 -1
  49. package/dist/commands/whoami.d.ts +1 -1
  50. package/dist/commands/whoami.d.ts.map +1 -1
  51. package/dist/commands/whoami.js +23 -7
  52. package/dist/commands/whoami.js.map +1 -1
  53. package/dist/index.js +7 -1
  54. package/dist/index.js.map +1 -1
  55. package/dist/strategies/link.d.ts +2 -2
  56. package/dist/strategies/link.d.ts.map +1 -1
  57. package/dist/strategies/link.js.map +1 -1
  58. package/dist/strategies/merge.d.ts +2 -2
  59. package/dist/strategies/merge.d.ts.map +1 -1
  60. package/dist/strategies/merge.js.map +1 -1
  61. package/dist/types.d.ts +37 -3
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/types.js +6 -0
  64. package/dist/types.js.map +1 -1
  65. package/dist/utils/cognito-session.d.ts +18 -7
  66. package/dist/utils/cognito-session.d.ts.map +1 -1
  67. package/dist/utils/cognito-session.js +35 -8
  68. package/dist/utils/cognito-session.js.map +1 -1
  69. package/dist/utils/manifest.d.ts +13 -0
  70. package/dist/utils/manifest.d.ts.map +1 -1
  71. package/dist/utils/manifest.js +24 -1
  72. package/dist/utils/manifest.js.map +1 -1
  73. package/dist/utils/secrets-cache.d.ts +7 -0
  74. package/dist/utils/secrets-cache.d.ts.map +1 -0
  75. package/dist/utils/secrets-cache.js +134 -0
  76. package/dist/utils/secrets-cache.js.map +1 -0
  77. package/package.json +15 -5
  78. package/src/commands/add.ts +7 -6
  79. package/src/commands/auth.ts +0 -3
  80. package/src/commands/cloud.ts +214 -101
  81. package/src/commands/list.ts +20 -1
  82. package/src/commands/login.ts +28 -9
  83. package/src/commands/logout.ts +8 -3
  84. package/src/commands/onboard.ts +193 -0
  85. package/src/commands/pack-install.ts +667 -0
  86. package/src/commands/pkg-install.ts +34 -16
  87. package/src/commands/pkg-list.ts +4 -4
  88. package/src/commands/pkg-update.ts +3 -3
  89. package/src/commands/secrets.ts +670 -0
  90. package/src/commands/sync.ts +20 -4
  91. package/src/commands/team-sync.ts +7 -8
  92. package/src/commands/whoami.ts +22 -7
  93. package/src/index.ts +9 -1
  94. package/src/strategies/link.ts +2 -2
  95. package/src/strategies/merge.ts +2 -2
  96. package/src/types.ts +54 -4
  97. package/src/utils/cognito-session.ts +46 -14
  98. package/src/utils/manifest.test.ts +148 -0
  99. package/src/utils/manifest.ts +22 -1
  100. package/src/utils/secrets-cache.ts +129 -0
  101. package/tsconfig.json +2 -1
  102. package/src/utils/auth.ts +0 -193
  103. package/src/utils/token-store.ts +0 -83
@@ -20,7 +20,7 @@ import * as yaml from 'js-yaml';
20
20
  import { execSync } from 'child_process';
21
21
  import { Command } from 'commander';
22
22
  import chalk from 'chalk';
23
- import { getAuthToken } from '../utils/auth.js';
23
+ import { ensureCognitoToken } from '../utils/cognito-session.js';
24
24
  import { findHqRoot } from '../utils/hq-root.js';
25
25
  import {
26
26
  getRegistryUrl,
@@ -28,23 +28,41 @@ import {
28
28
  } from '../utils/registry-client.js';
29
29
  import { verifySha256, verifyRsaSignature } from '../utils/integrity.js';
30
30
  import { addToRegistry } from '../utils/registry.js';
31
+ import { installPack, sourceMatchesPackPattern } from './pack-install.js';
31
32
 
32
33
  export function registerPackageInstallCommand(parent: Command): void {
33
34
  parent
34
- .command('install <slug>')
35
- .description('Install a package from the registry')
36
- .option('--company <co>', 'Scope the package to a specific company')
37
- .action(async (slug: string, opts: { company?: string }) => {
38
- try {
39
- await installPackage(slug, opts.company);
40
- } catch (error) {
41
- console.error(
42
- chalk.red('Install failed:'),
43
- error instanceof Error ? error.message : 'Unknown error'
44
- );
45
- process.exit(1);
35
+ .command('install <source>')
36
+ .description(
37
+ 'Install a package. Sources: bare slug (registry, Cognito-gated), ' +
38
+ '@scope/name[@ver] (npm pack), git URL[#ref], or local path.'
39
+ )
40
+ .option('--company <co>', 'Scope the package to a specific company (registry flow only)')
41
+ .option('--allow-hooks', 'Skip the hooks confirmation prompt (content-pack flow)')
42
+ .option('--branch', 'Follow a ref instead of SHA-pinning (git content-pack flow)')
43
+ .action(
44
+ async (
45
+ source: string,
46
+ opts: { company?: string; allowHooks?: boolean; branch?: boolean }
47
+ ) => {
48
+ try {
49
+ if (sourceMatchesPackPattern(source)) {
50
+ await installPack(source, {
51
+ allowHooks: opts.allowHooks,
52
+ followBranch: opts.branch,
53
+ });
54
+ } else {
55
+ await installPackage(source, opts.company);
56
+ }
57
+ } catch (error) {
58
+ console.error(
59
+ chalk.red('Install failed:'),
60
+ error instanceof Error ? error.message : 'Unknown error'
61
+ );
62
+ process.exit(1);
63
+ }
46
64
  }
47
- });
65
+ );
48
66
  }
49
67
 
50
68
  async function installPackage(
@@ -52,9 +70,9 @@ async function installPackage(
52
70
  company?: string
53
71
  ): Promise<void> {
54
72
  // 1. Auth
55
- const token = await getAuthToken();
73
+ const accessToken = await ensureCognitoToken();
56
74
  const registryUrl = getRegistryUrl();
57
- const client = new RegistryClient(registryUrl, token.clerk_session_token);
75
+ const client = new RegistryClient(registryUrl, accessToken);
58
76
 
59
77
  // 2. Check entitlement
60
78
  console.log(chalk.dim(`Checking entitlement for ${slug}...`));
@@ -8,7 +8,7 @@ import { Command } from 'commander';
8
8
  import chalk from 'chalk';
9
9
  import { findHqRoot } from '../utils/hq-root.js';
10
10
  import { readRegistry } from '../utils/registry.js';
11
- import { loadToken, isTokenExpired } from '../utils/token-store.js';
11
+ import { loadCachedTokens, isExpiring } from '@indigoai-us/hq-cloud';
12
12
  import {
13
13
  getRegistryUrl,
14
14
  RegistryClient,
@@ -59,12 +59,12 @@ async function listPackages(): Promise<void> {
59
59
  let offline = false;
60
60
 
61
61
  try {
62
- const token = await loadToken();
63
- if (token && !isTokenExpired(token)) {
62
+ const cached = loadCachedTokens();
63
+ if (cached && !isExpiring(cached, 120)) {
64
64
  const registryUrl = getRegistryUrl();
65
65
  const client = new RegistryClient(
66
66
  registryUrl,
67
- token.clerk_session_token
67
+ cached.accessToken
68
68
  );
69
69
  const result = await client.getMyEntitlements();
70
70
  entitlements = result.entitlements;
@@ -12,7 +12,7 @@ import * as yaml from 'js-yaml';
12
12
  import { execSync } from 'child_process';
13
13
  import { Command } from 'commander';
14
14
  import chalk from 'chalk';
15
- import { getAuthToken } from '../utils/auth.js';
15
+ import { ensureCognitoToken } from '../utils/cognito-session.js';
16
16
  import { findHqRoot } from '../utils/hq-root.js';
17
17
  import {
18
18
  getRegistryUrl,
@@ -51,9 +51,9 @@ async function updatePackages(slug?: string): Promise<void> {
51
51
  return;
52
52
  }
53
53
 
54
- const token = await getAuthToken();
54
+ const accessToken = await ensureCognitoToken();
55
55
  const registryUrl = getRegistryUrl();
56
- const client = new RegistryClient(registryUrl, token.clerk_session_token);
56
+ const client = new RegistryClient(registryUrl, accessToken);
57
57
 
58
58
  const toCheck = slug
59
59
  ? entries.filter((e) => e.slug === slug)