@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.
- package/dist/bin/hq-auth-refresh.js +0 -0
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +2 -1
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/auth.d.ts +0 -3
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +0 -3
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/cloud.d.ts +12 -2
- package/dist/commands/cloud.d.ts.map +1 -1
- package/dist/commands/cloud.js +112 -80
- package/dist/commands/cloud.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +18 -1
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.d.ts +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +28 -9
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts +1 -1
- package/dist/commands/logout.d.ts.map +1 -1
- package/dist/commands/logout.js +8 -3
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/onboard.d.ts +23 -0
- package/dist/commands/onboard.d.ts.map +1 -0
- package/dist/commands/onboard.js +142 -0
- package/dist/commands/onboard.js.map +1 -0
- package/dist/commands/pack-install.d.ts +44 -0
- package/dist/commands/pack-install.d.ts.map +1 -0
- package/dist/commands/pack-install.js +513 -0
- package/dist/commands/pack-install.js.map +1 -0
- package/dist/commands/pkg-install.d.ts.map +1 -1
- package/dist/commands/pkg-install.js +20 -8
- package/dist/commands/pkg-install.js.map +1 -1
- package/dist/commands/pkg-list.js +4 -4
- package/dist/commands/pkg-list.js.map +1 -1
- package/dist/commands/pkg-update.js +3 -3
- package/dist/commands/pkg-update.js.map +1 -1
- package/dist/commands/secrets.d.ts +3 -0
- package/dist/commands/secrets.d.ts.map +1 -0
- package/dist/commands/secrets.js +521 -0
- package/dist/commands/secrets.js.map +1 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +10 -2
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/team-sync.d.ts.map +1 -1
- package/dist/commands/team-sync.js +6 -6
- package/dist/commands/team-sync.js.map +1 -1
- package/dist/commands/whoami.d.ts +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +23 -7
- package/dist/commands/whoami.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/strategies/link.d.ts +2 -2
- package/dist/strategies/link.d.ts.map +1 -1
- package/dist/strategies/link.js.map +1 -1
- package/dist/strategies/merge.d.ts +2 -2
- package/dist/strategies/merge.d.ts.map +1 -1
- package/dist/strategies/merge.js.map +1 -1
- package/dist/types.d.ts +37 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/cognito-session.d.ts +18 -7
- package/dist/utils/cognito-session.d.ts.map +1 -1
- package/dist/utils/cognito-session.js +35 -8
- package/dist/utils/cognito-session.js.map +1 -1
- package/dist/utils/manifest.d.ts +13 -0
- package/dist/utils/manifest.d.ts.map +1 -1
- package/dist/utils/manifest.js +24 -1
- package/dist/utils/manifest.js.map +1 -1
- package/dist/utils/secrets-cache.d.ts +7 -0
- package/dist/utils/secrets-cache.d.ts.map +1 -0
- package/dist/utils/secrets-cache.js +134 -0
- package/dist/utils/secrets-cache.js.map +1 -0
- package/package.json +15 -5
- package/src/commands/add.ts +7 -6
- package/src/commands/auth.ts +0 -3
- package/src/commands/cloud.ts +214 -101
- package/src/commands/list.ts +20 -1
- package/src/commands/login.ts +28 -9
- package/src/commands/logout.ts +8 -3
- package/src/commands/onboard.ts +193 -0
- package/src/commands/pack-install.ts +667 -0
- package/src/commands/pkg-install.ts +34 -16
- package/src/commands/pkg-list.ts +4 -4
- package/src/commands/pkg-update.ts +3 -3
- package/src/commands/secrets.ts +670 -0
- package/src/commands/sync.ts +20 -4
- package/src/commands/team-sync.ts +7 -8
- package/src/commands/whoami.ts +22 -7
- package/src/index.ts +9 -1
- package/src/strategies/link.ts +2 -2
- package/src/strategies/merge.ts +2 -2
- package/src/types.ts +54 -4
- package/src/utils/cognito-session.ts +46 -14
- package/src/utils/manifest.test.ts +148 -0
- package/src/utils/manifest.ts +22 -1
- package/src/utils/secrets-cache.ts +129 -0
- package/tsconfig.json +2 -1
- package/src/utils/auth.ts +0 -193
- 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 {
|
|
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 <
|
|
35
|
-
.description(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
73
|
+
const accessToken = await ensureCognitoToken();
|
|
56
74
|
const registryUrl = getRegistryUrl();
|
|
57
|
-
const client = new RegistryClient(registryUrl,
|
|
75
|
+
const client = new RegistryClient(registryUrl, accessToken);
|
|
58
76
|
|
|
59
77
|
// 2. Check entitlement
|
|
60
78
|
console.log(chalk.dim(`Checking entitlement for ${slug}...`));
|
package/src/commands/pkg-list.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
63
|
-
if (
|
|
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
|
-
|
|
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 {
|
|
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
|
|
54
|
+
const accessToken = await ensureCognitoToken();
|
|
55
55
|
const registryUrl = getRegistryUrl();
|
|
56
|
-
const client = new RegistryClient(registryUrl,
|
|
56
|
+
const client = new RegistryClient(registryUrl, accessToken);
|
|
57
57
|
|
|
58
58
|
const toCheck = slug
|
|
59
59
|
? entries.filter((e) => e.slug === slug)
|