@indigoai-us/hq-cli 5.50.0 → 5.50.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/commands/mcp-registration.d.ts +905 -0
- package/dist/commands/mcp-registration.js +2001 -0
- package/dist/commands/mcp-status.d.ts +130 -0
- package/dist/commands/mcp-status.js +406 -0
- package/dist/commands/onboard-warning.d.ts +7 -0
- package/dist/commands/onboard-warning.js +14 -0
- package/dist/commands/onboard.js +5 -5
- package/dist/commands/pack-install.d.ts +74 -0
- package/dist/commands/pack-install.js +493 -14
- package/dist/commands/packs.js +42 -4
- package/dist/commands/pkg-install.js +5 -2
- package/dist/index.js +7 -2
- package/dist/types.d.ts +26 -1
- package/dist/utils/contribution-table.d.ts +103 -0
- package/dist/utils/contribution-table.js +65 -0
- package/dist/utils/pack-contributions.d.ts +93 -10
- package/dist/utils/pack-contributions.js +140 -48
- package/dist/utils/secrets-cache.d.ts +9 -0
- package/dist/utils/secrets-cache.js +24 -2
- package/dist/utils/version-gate.d.ts +40 -1
- package/dist/utils/version-gate.js +91 -20
- package/package.json +3 -2
- package/scripts/generate-scan-packages-table.mjs +113 -0
- package/src/commands/mcp-registration.test.ts +2787 -0
- package/src/commands/mcp-registration.ts +2612 -0
- package/src/commands/mcp-status.test.ts +483 -0
- package/src/commands/mcp-status.ts +575 -0
- package/src/commands/mcp-status.us011.test.ts +243 -0
- package/src/commands/onboard-warning.test.ts +26 -0
- package/src/commands/onboard-warning.ts +12 -0
- package/src/commands/onboard.ts +4 -7
- package/src/commands/pack-install.test.ts +733 -0
- package/src/commands/pack-install.ts +582 -13
- package/src/commands/packs.ts +45 -1
- package/src/commands/pkg-install.ts +4 -1
- package/src/index.ts +6 -0
- package/src/types.ts +28 -9
- package/src/utils/contribution-table.ts +83 -0
- package/src/utils/pack-contributions.test.ts +310 -25
- package/src/utils/pack-contributions.ts +194 -47
- package/src/utils/secrets-cache.ts +22 -0
- package/src/utils/version-gate.test.ts +122 -0
- package/src/utils/version-gate.ts +109 -13
- package/test/e2e/smoke-install-mcp.sh +113 -0
- package/test/fixtures/hq-pack-smoke-mcp/mcp/smoke-http.json +1 -0
- package/test/fixtures/hq-pack-smoke-mcp/package.yaml +11 -0
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
* from each pack's package.yaml; rationale lives in the layout-fix PR.)
|
|
35
35
|
*/
|
|
36
36
|
import { type KeyObject } from 'node:crypto';
|
|
37
|
+
import { type SecretResolver } from './mcp-registration.js';
|
|
37
38
|
import type { PackManifest } from '../types.js';
|
|
38
39
|
export type Transport = 'npm' | 'git' | 'local' | 'marketplace';
|
|
39
40
|
/** Prefix that routes a source through the HQ marketplace transport (US-006). */
|
|
@@ -237,7 +238,39 @@ export declare function computeArtifactHash(tarballBytes: Uint8Array): string;
|
|
|
237
238
|
* full strings rather than prefixes.
|
|
238
239
|
*/
|
|
239
240
|
export declare function verifyArtifact(input: VerifyArtifactInput): void;
|
|
241
|
+
/**
|
|
242
|
+
* Parse + shape-validate one pack's per-server MCP manifest (`mcp/{item}.json`),
|
|
243
|
+
* mirroring the bash `validate_mcp_manifest` arm. EXPORTED so the acceptance
|
|
244
|
+
* test (and US-006's registration engine) can call it directly.
|
|
245
|
+
*
|
|
246
|
+
* Throws an `Error` (whose message names the pack-relative payload path, e.g.
|
|
247
|
+
* `mcp/foo.json`) when the file does not parse as JSON or violates a transport
|
|
248
|
+
* rule:
|
|
249
|
+
* - `type` required, one of `http|stdio|sse`;
|
|
250
|
+
* - no unknown top-level keys (allowed: {@link MCP_ALLOWED_KEYS});
|
|
251
|
+
* - http/sse: `url` required + `^https?://`; `command`/`args`/`env` forbidden;
|
|
252
|
+
* - stdio: non-empty `command` required; `url`/`headers` forbidden;
|
|
253
|
+
* - `headers`/`env` (if present) are objects of string values;
|
|
254
|
+
* - NO inline literal `Bearer ` secret — such a value MUST carry a
|
|
255
|
+
* `${secret:NAME}` reference, never a literal token.
|
|
256
|
+
*
|
|
257
|
+
* @param payloadDir the pack payload root (holds `mcp/{item}.json`)
|
|
258
|
+
* @param item the bare server name declared under `contributes.mcp`
|
|
259
|
+
*/
|
|
260
|
+
export declare function validateMcpManifest(payloadDir: string, item: string): void;
|
|
240
261
|
export declare function validateManifest(payloadDir: string, hqVersion: string | null): PackManifest;
|
|
262
|
+
/**
|
|
263
|
+
* Enforce a pack's `requires.packs`: every named dependency MUST already be
|
|
264
|
+
* installed (and satisfy its optional semver RANGE) before we write anything.
|
|
265
|
+
*
|
|
266
|
+
* Installed packs are discovered by FILESYSTEM PRESENCE via `listInstalledPacks`
|
|
267
|
+
* — deliberately NOT `modules.yaml`, which `installPack` no longer writes under
|
|
268
|
+
* the v12+ layout (a modules.yaml-based check would silently ignore every modern
|
|
269
|
+
* pack). Throws on the first unmet dependency so the install aborts with NO
|
|
270
|
+
* partial state (it is called before installToPackages). No-op when
|
|
271
|
+
* `requires.packs` is absent/empty, keeping legacy packs unaffected.
|
|
272
|
+
*/
|
|
273
|
+
export declare function assertPackDependencies(hqRoot: string, pkg: PackManifest): void;
|
|
241
274
|
/**
|
|
242
275
|
* Derive the safe, auto-generated "get started" line for a freshly installed
|
|
243
276
|
* pack from its `initialization.entrypoint` ONLY. PHASE 1 deliberately ignores
|
|
@@ -252,6 +285,40 @@ export declare function validateManifest(payloadDir: string, hqVersion: string |
|
|
|
252
285
|
* the caller prints nothing extra).
|
|
253
286
|
*/
|
|
254
287
|
export declare function getStartedLine(initialization?: PackManifest['initialization']): string | null;
|
|
288
|
+
/**
|
|
289
|
+
* Render one declared MCP server's prompt line, redacting every header/env value.
|
|
290
|
+
* EXPORTED so the acceptance/redaction self-test can assert no secret/Bearer
|
|
291
|
+
* substring ever appears in the rendered output.
|
|
292
|
+
*/
|
|
293
|
+
export declare function renderMcpServerLine(payloadDir: string, item: string): string;
|
|
294
|
+
/**
|
|
295
|
+
* Install-time MCP trust prompt. EXPORTED so the acceptance test can drive the
|
|
296
|
+
* gate / bypass / non-TTY branches directly (capture stdout, assert no secret
|
|
297
|
+
* substring leaks, assert deny returns false). See {@link confirmHooks} for the
|
|
298
|
+
* voice/shape this mirrors.
|
|
299
|
+
*/
|
|
300
|
+
export declare function confirmMcp(pkg: PackManifest, payloadDir: string, allowMcp: boolean): Promise<boolean>;
|
|
301
|
+
/**
|
|
302
|
+
* Build the install-time {@link SecretResolver} bound to the HQ vault's local
|
|
303
|
+
* secrets-cache (`~/.hq/secrets-cache/<scope>/<NAME>`, AES-256-GCM, 0600, TTL'd).
|
|
304
|
+
*
|
|
305
|
+
* Active-company resolution at install time is INDIRECT by design: `hq install`
|
|
306
|
+
* has no `--company` flag and runs OFFLINE (no token), so we cannot resolve a
|
|
307
|
+
* single active company UID the way `hq run` / `hq secrets` do (via
|
|
308
|
+
* `getEntityUid` over the network). Instead we probe EVERY cached scope
|
|
309
|
+
* (`cmp_*`/`prs_*` — whichever has minted secrets locally) for the requested
|
|
310
|
+
* name and return the first hit. This naturally resolves to whichever company
|
|
311
|
+
* context just provisioned the secret (e.g. the one `/connect-shopify` minted
|
|
312
|
+
* `VYG_API_KEY` under), without guessing, and works whether the vault scoped the
|
|
313
|
+
* key under a company or person entity.
|
|
314
|
+
*
|
|
315
|
+
* On MISS across all scopes (no cache, expired TTL, or key never minted) it
|
|
316
|
+
* returns `null` — which is exactly what {@link registerMcpServers}'s
|
|
317
|
+
* unresolvable-secret path keys off to defer that server gracefully. With no
|
|
318
|
+
* cached scopes at all (`listSecretCacheScopes()` → `[]`) it simply returns
|
|
319
|
+
* `null` for every name, the desired graceful-deferral behavior.
|
|
320
|
+
*/
|
|
321
|
+
export declare function makeInstallSecretResolver(): SecretResolver;
|
|
255
322
|
/**
|
|
256
323
|
* Install the fetched payload to `<hqRoot>/core/packages/<pkg.name>/` (HQ
|
|
257
324
|
* v12+ layout). The HQ template (`hq-core` / `hq-core-staging`) ships
|
|
@@ -308,6 +375,13 @@ export declare function runScanPackages(hqRoot: string, opts?: {
|
|
|
308
375
|
}): void;
|
|
309
376
|
export interface InstallPackOptions {
|
|
310
377
|
allowHooks?: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* US-010 install-time MCP trust prompt bypass (CI/ambient-trust). Mirrors
|
|
380
|
+
* `allowHooks`: when set, `confirmMcp` skips the prompt and prints a yellow
|
|
381
|
+
* notice. Absent/false → the operator is prompted (or, in a non-TTY shell,
|
|
382
|
+
* the install is refused with a "re-run with --allow-mcp" hint).
|
|
383
|
+
*/
|
|
384
|
+
allowMcp?: boolean;
|
|
311
385
|
followBranch?: boolean;
|
|
312
386
|
/**
|
|
313
387
|
* Route this function's human output to stderr (and silence scan-packages
|