@indigoai-us/hq-cli 5.47.11 → 5.47.12
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.
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* 9. Print next-step message
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
!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]="
|
|
16
|
+
!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]="ac6f26b7-5678-5b4e-b0d8-2f5901adf9fe")}catch(e){}}();
|
|
17
17
|
import * as fs from 'fs';
|
|
18
18
|
import * as os from 'os';
|
|
19
19
|
import * as path from 'path';
|
|
@@ -25,7 +25,7 @@ import { resolveDefaultHqRoot } from '../utils/cognito-session.js';
|
|
|
25
25
|
import { getRegistryUrl, RegistryClient, } from '../utils/registry-client.js';
|
|
26
26
|
import { verifySha256, verifyRsaSignature } from '../utils/integrity.js';
|
|
27
27
|
import { addToRegistry } from '../utils/registry.js';
|
|
28
|
-
import { installPack, sourceMatchesPackPattern } from './pack-install.js';
|
|
28
|
+
import { MARKETPLACE_PREFIX, installPack, sourceMatchesPackPattern, } from './pack-install.js';
|
|
29
29
|
export function registerPackageInstallCommand(parent) {
|
|
30
30
|
parent
|
|
31
31
|
.command('install <source>')
|
|
@@ -43,7 +43,14 @@ export function registerPackageInstallCommand(parent) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
|
|
46
|
+
// Bare slugs: the legacy Cognito-gated registry backend
|
|
47
|
+
// (/packages, /entitlements) was never deployed, so a bare slug
|
|
48
|
+
// would fail at registry setup. Resolve it through the marketplace
|
|
49
|
+
// listings transport — the live install path — instead.
|
|
50
|
+
await installPack(`${MARKETPLACE_PREFIX}${source}`, {
|
|
51
|
+
allowHooks: opts.allowHooks,
|
|
52
|
+
followBranch: opts.branch,
|
|
53
|
+
});
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
catch (error) {
|
|
@@ -156,4 +163,4 @@ async function installPackage(slug, company) {
|
|
|
156
163
|
}
|
|
157
164
|
}
|
|
158
165
|
//# sourceMappingURL=pkg-install.js.map
|
|
159
|
-
//# debugId=
|
|
166
|
+
//# debugId=ac6f26b7-5678-5b4e-b0d8-2f5901adf9fe
|
package/package.json
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// @vitest-environment node
|
|
2
|
+
/**
|
|
3
|
+
* Regression: `hq install <bare-slug>` must resolve through the marketplace
|
|
4
|
+
* listings transport (the live install path), not the legacy Cognito-gated
|
|
5
|
+
* registry flow whose backend (/packages, /entitlements) was never deployed.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
|
|
10
|
+
// vi.mock is hoisted above imports/consts, so build the mocks via vi.hoisted()
|
|
11
|
+
// to avoid a temporal-dead-zone reference inside the factory.
|
|
12
|
+
const { installPack, sourceMatchesPackPattern } = vi.hoisted(() => ({
|
|
13
|
+
installPack: vi.fn(async () => {}),
|
|
14
|
+
// Mirror the real classifier: pack-pattern sources (marketplace:/@scope/git/
|
|
15
|
+
// path) match; bare slugs do not.
|
|
16
|
+
sourceMatchesPackPattern: vi.fn(
|
|
17
|
+
(s: string) =>
|
|
18
|
+
s.startsWith('marketplace:') ||
|
|
19
|
+
s.startsWith('@') ||
|
|
20
|
+
s.startsWith('./') ||
|
|
21
|
+
s.startsWith('../') ||
|
|
22
|
+
s.startsWith('/') ||
|
|
23
|
+
s.endsWith('.git') ||
|
|
24
|
+
s.startsWith('git@') ||
|
|
25
|
+
s.startsWith('http://') ||
|
|
26
|
+
s.startsWith('https://'),
|
|
27
|
+
),
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
vi.mock('./pack-install.js', () => ({
|
|
31
|
+
MARKETPLACE_PREFIX: 'marketplace:',
|
|
32
|
+
installPack,
|
|
33
|
+
sourceMatchesPackPattern,
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
import { registerPackageInstallCommand } from './pkg-install.js';
|
|
37
|
+
|
|
38
|
+
async function runInstall(...args: string[]): Promise<void> {
|
|
39
|
+
const program = new Command();
|
|
40
|
+
program.exitOverride();
|
|
41
|
+
registerPackageInstallCommand(program);
|
|
42
|
+
await program.parseAsync(['install', ...args], { from: 'user' });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
describe('hq install dispatch — bare slug routes to marketplace', () => {
|
|
46
|
+
beforeEach(() => {
|
|
47
|
+
installPack.mockClear();
|
|
48
|
+
sourceMatchesPackPattern.mockClear();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('routes a bare slug through the marketplace transport', async () => {
|
|
52
|
+
await runInstall('email-assistant');
|
|
53
|
+
expect(installPack).toHaveBeenCalledTimes(1);
|
|
54
|
+
expect(installPack.mock.calls[0][0]).toBe('marketplace:email-assistant');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('preserves a pinned version on a bare slug', async () => {
|
|
58
|
+
await runInstall('email-assistant@0.1.0');
|
|
59
|
+
expect(installPack.mock.calls[0][0]).toBe('marketplace:email-assistant@0.1.0');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('passes an explicit marketplace: source through unchanged', async () => {
|
|
63
|
+
await runInstall('marketplace:tdd');
|
|
64
|
+
expect(installPack.mock.calls[0][0]).toBe('marketplace:tdd');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('passes a pack-pattern source (npm scope) through unchanged', async () => {
|
|
68
|
+
await runInstall('@indigoai-us/hq-pack-demo');
|
|
69
|
+
expect(installPack.mock.calls[0][0]).toBe('@indigoai-us/hq-pack-demo');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -28,7 +28,11 @@ 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 {
|
|
31
|
+
import {
|
|
32
|
+
MARKETPLACE_PREFIX,
|
|
33
|
+
installPack,
|
|
34
|
+
sourceMatchesPackPattern,
|
|
35
|
+
} from './pack-install.js';
|
|
32
36
|
|
|
33
37
|
export function registerPackageInstallCommand(parent: Command): void {
|
|
34
38
|
parent
|
|
@@ -52,7 +56,14 @@ export function registerPackageInstallCommand(parent: Command): void {
|
|
|
52
56
|
followBranch: opts.branch,
|
|
53
57
|
});
|
|
54
58
|
} else {
|
|
55
|
-
|
|
59
|
+
// Bare slugs: the legacy Cognito-gated registry backend
|
|
60
|
+
// (/packages, /entitlements) was never deployed, so a bare slug
|
|
61
|
+
// would fail at registry setup. Resolve it through the marketplace
|
|
62
|
+
// listings transport — the live install path — instead.
|
|
63
|
+
await installPack(`${MARKETPLACE_PREFIX}${source}`, {
|
|
64
|
+
allowHooks: opts.allowHooks,
|
|
65
|
+
followBranch: opts.branch,
|
|
66
|
+
});
|
|
56
67
|
}
|
|
57
68
|
} catch (error) {
|
|
58
69
|
console.error(
|