@hypercli.com/cli 0.0.0-stage → 0.9.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 (98) hide show
  1. package/README.md +25 -2
  2. package/dist/commands/acp.d.ts +5 -0
  3. package/dist/commands/acp.js +51 -0
  4. package/dist/commands/acp.js.map +1 -0
  5. package/dist/commands/agent-login.d.ts +97 -0
  6. package/dist/commands/agent-login.js +547 -0
  7. package/dist/commands/agent-login.js.map +1 -0
  8. package/dist/commands/agents.d.ts +48 -0
  9. package/dist/commands/agents.js +2026 -0
  10. package/dist/commands/agents.js.map +1 -0
  11. package/dist/commands/configure.d.ts +11 -0
  12. package/dist/commands/configure.js +59 -0
  13. package/dist/commands/configure.js.map +1 -0
  14. package/dist/commands/files.d.ts +15 -0
  15. package/dist/commands/files.js +176 -0
  16. package/dist/commands/files.js.map +1 -0
  17. package/dist/commands/flow.d.ts +20 -0
  18. package/dist/commands/flow.js +360 -0
  19. package/dist/commands/flow.js.map +1 -0
  20. package/dist/commands/integrations.d.ts +32 -0
  21. package/dist/commands/integrations.js +460 -0
  22. package/dist/commands/integrations.js.map +1 -0
  23. package/dist/commands/jobs.d.ts +5 -0
  24. package/dist/commands/jobs.js +496 -0
  25. package/dist/commands/jobs.js.map +1 -0
  26. package/dist/commands/me.d.ts +23 -0
  27. package/dist/commands/me.js +258 -0
  28. package/dist/commands/me.js.map +1 -0
  29. package/dist/commands/memory.d.ts +5 -0
  30. package/dist/commands/memory.js +110 -0
  31. package/dist/commands/memory.js.map +1 -0
  32. package/dist/commands/routines.d.ts +27 -0
  33. package/dist/commands/routines.js +493 -0
  34. package/dist/commands/routines.js.map +1 -0
  35. package/dist/commands/skills.d.ts +36 -0
  36. package/dist/commands/skills.js +369 -0
  37. package/dist/commands/skills.js.map +1 -0
  38. package/dist/commands/voice.d.ts +15 -0
  39. package/dist/commands/voice.js +378 -0
  40. package/dist/commands/voice.js.map +1 -0
  41. package/dist/commands/websearch-core.d.ts +10 -0
  42. package/dist/commands/websearch-core.js +56 -0
  43. package/dist/commands/websearch-core.js.map +1 -0
  44. package/dist/commands/websearch.d.ts +13 -0
  45. package/dist/commands/websearch.js +20 -0
  46. package/dist/commands/websearch.js.map +1 -0
  47. package/dist/core/argv.d.ts +51 -0
  48. package/dist/core/argv.js +81 -0
  49. package/dist/core/argv.js.map +1 -0
  50. package/dist/core/captured-logs.d.ts +9 -0
  51. package/dist/core/captured-logs.js +52 -0
  52. package/dist/core/captured-logs.js.map +1 -0
  53. package/dist/core/client.d.ts +18 -0
  54. package/dist/core/client.js +31 -0
  55. package/dist/core/client.js.map +1 -0
  56. package/dist/core/config-file.d.ts +13 -0
  57. package/dist/core/config-file.js +79 -0
  58. package/dist/core/config-file.js.map +1 -0
  59. package/dist/core/errors.d.ts +22 -0
  60. package/dist/core/errors.js +37 -0
  61. package/dist/core/errors.js.map +1 -0
  62. package/dist/core/help.d.ts +13 -0
  63. package/dist/core/help.js +55 -0
  64. package/dist/core/help.js.map +1 -0
  65. package/dist/core/integrations-mcp.d.ts +2 -0
  66. package/dist/core/integrations-mcp.js +115 -0
  67. package/dist/core/integrations-mcp.js.map +1 -0
  68. package/dist/core/output.d.ts +29 -0
  69. package/dist/core/output.js +34 -0
  70. package/dist/core/output.js.map +1 -0
  71. package/dist/core/skills-runtime.d.ts +37 -0
  72. package/dist/core/skills-runtime.js +101 -0
  73. package/dist/core/skills-runtime.js.map +1 -0
  74. package/dist/core/table.d.ts +17 -0
  75. package/dist/core/table.js +34 -0
  76. package/dist/core/table.js.map +1 -0
  77. package/dist/core/types.d.ts +65 -0
  78. package/dist/core/types.js +40 -0
  79. package/dist/core/types.js.map +1 -0
  80. package/dist/index.d.ts +11 -0
  81. package/dist/index.js +73 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/registry.d.ts +10 -0
  84. package/dist/registry.js +39 -0
  85. package/dist/registry.js.map +1 -0
  86. package/dist/version.d.ts +1 -0
  87. package/dist/version.js +3 -0
  88. package/dist/version.js.map +1 -0
  89. package/package.json +33 -4
  90. package/skills/hypercli-account.json +17 -0
  91. package/skills/hypercli-agents.json +23 -0
  92. package/skills/hypercli-auth.json +11 -0
  93. package/skills/hypercli-compute.json +20 -0
  94. package/skills/hypercli-flows.json +11 -0
  95. package/skills/hypercli-knowledge.json +13 -0
  96. package/skills/hypercli-voice.json +10 -0
  97. package/skills/hypercli.json +23 -0
  98. package/skills/index.json +124 -0
@@ -0,0 +1,9 @@
1
+ import type { AgentLogCapture } from '@hypercli.com/sdk';
2
+ /** The original SDK snapshot stays intact for JSON. */
3
+ type Capture = Pick<AgentLogCapture, 'source' | 'generation' | 'file_generation' | 'launch_epoch' | 'content_base64' | 'truncated' | 'unavailable' | 'assignment_id' | 'capture' | 'diagnostics_dropped'>;
4
+ /** No offsets are provided by the capture protocol: overlapping tails are not deltas. */
5
+ export declare function capturedLogRenderer(write: (text: string) => void, info: (text: string) => void): (snapshot: {
6
+ unavailable: string | null;
7
+ captures: Capture[];
8
+ }) => void;
9
+ export {};
@@ -0,0 +1,52 @@
1
+ /** No offsets are provided by the capture protocol: overlapping tails are not deltas. */
2
+ export function capturedLogRenderer(write, info) {
3
+ const previous = new Map();
4
+ return (snapshot) => {
5
+ if (snapshot.unavailable)
6
+ info(`runner logs unavailable: ${snapshot.unavailable}`);
7
+ const present = new Set();
8
+ for (const capture of snapshot.captures) {
9
+ const key = `${capture.source}/${capture.generation}`;
10
+ present.add(key);
11
+ const old = previous.get(key);
12
+ previous.set(key, capture);
13
+ if (capture.capture?.dropped_bytes && capture.capture.dropped_bytes !== old?.capture?.dropped_bytes) {
14
+ info(`${key}: capture dropped ${capture.capture.dropped_bytes} bytes; continuity unavailable`);
15
+ }
16
+ if (capture.diagnostics_dropped && capture.diagnostics_dropped !== old?.diagnostics_dropped) {
17
+ info(`${key}: ${capture.diagnostics_dropped} diagnostics dropped`);
18
+ }
19
+ if (capture.unavailable) {
20
+ if (old?.unavailable !== capture.unavailable)
21
+ info(`${key}: unavailable (${capture.unavailable})`);
22
+ continue;
23
+ }
24
+ const bytes = Buffer.from(capture.content_base64 ?? '', 'base64');
25
+ const sameFile = old && capture.file_generation !== null && old.file_generation === capture.file_generation
26
+ && old.assignment_id === capture.assignment_id && old.launch_epoch === capture.launch_epoch && !old.unavailable;
27
+ if (sameFile && old.content_base64 === capture.content_base64 && old.truncated === capture.truncated)
28
+ continue;
29
+ if (!old || !sameFile) {
30
+ info(`${key}: ${old ? 'replacement generation' : 'captured snapshot'}${capture.truncated ? ' (truncated)' : ''}`);
31
+ if (bytes.length)
32
+ write(bytes.toString('utf8'));
33
+ else
34
+ info(`${key}: empty capture`);
35
+ continue;
36
+ }
37
+ const prior = Buffer.from(old.content_base64 ?? '', 'base64');
38
+ if (!old.truncated && !capture.truncated && bytes.subarray(0, prior.length).equals(prior)) {
39
+ const suffix = bytes.subarray(prior.length);
40
+ if (suffix.length)
41
+ write(suffix.toString('utf8'));
42
+ }
43
+ else {
44
+ info(`${key}: bounded snapshot replaced; continuity unavailable (use --json --follow for replacement snapshots)`);
45
+ }
46
+ }
47
+ for (const key of previous.keys())
48
+ if (!present.has(key))
49
+ previous.delete(key);
50
+ };
51
+ }
52
+ //# sourceMappingURL=captured-logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captured-logs.js","sourceRoot":"","sources":["../../src/core/captured-logs.ts"],"names":[],"mappings":"AAMA,yFAAyF;AACzF,MAAM,UAAU,mBAAmB,CAAC,KAA6B,EAAE,IAA4B;IAC7F,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC5C,OAAO,CAAC,QAA6D,EAAE,EAAE;QACvE,IAAI,QAAQ,CAAC,WAAW;YAAE,IAAI,CAAC,4BAA4B,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QACnF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAClC,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACx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AAM,CAAC,GAAG,CAAC,CAAC;IACjF,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The one place that builds the SDK client.
3
+ *
4
+ * Construction honors the SDK config precedence exactly:
5
+ * product key: HYPER_API_KEY > $HYPER_HOME/config or ~/.hypercli/config
6
+ * agents key: product key first, then HYPER_AGENTS_API_KEY fallback
7
+ * apiUrl: HYPER_API_BASE / config / default
8
+ * agents base: HYPER_AGENTS_API_BASE / config / derived from product base
9
+ *
10
+ * The retired HYPERCLI_API_URL / AGENTS_API_BASE_URL override envs are no
11
+ * longer read anywhere; endpoint resolution lives in the SDK config.
12
+ *
13
+ * Throws (as a plain Error, mapped to exit 1 by the entrypoint) when no
14
+ * credential is configured.
15
+ */
16
+ import { HyperCLI } from '@hypercli.com/sdk';
17
+ /** Lazily-built singleton for CommandContext.client(). */
18
+ export declare function lazyClient(): () => Promise<HyperCLI>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The one place that builds the SDK client.
3
+ *
4
+ * Construction honors the SDK config precedence exactly:
5
+ * product key: HYPER_API_KEY > $HYPER_HOME/config or ~/.hypercli/config
6
+ * agents key: product key first, then HYPER_AGENTS_API_KEY fallback
7
+ * apiUrl: HYPER_API_BASE / config / default
8
+ * agents base: HYPER_AGENTS_API_BASE / config / derived from product base
9
+ *
10
+ * The retired HYPERCLI_API_URL / AGENTS_API_BASE_URL override envs are no
11
+ * longer read anywhere; endpoint resolution lives in the SDK config.
12
+ *
13
+ * Throws (as a plain Error, mapped to exit 1 by the entrypoint) when no
14
+ * credential is configured.
15
+ */
16
+ import { HyperCLI, getAgentApiKey, getApiKey, getApiUrl, } from '@hypercli.com/sdk';
17
+ /** Lazily-built singleton for CommandContext.client(). */
18
+ export function lazyClient() {
19
+ let cached;
20
+ return async () => {
21
+ if (!cached) {
22
+ cached = new HyperCLI({
23
+ apiKey: getApiKey(),
24
+ agentApiKey: getAgentApiKey(),
25
+ apiUrl: getApiUrl(),
26
+ });
27
+ }
28
+ return cached;
29
+ };
30
+ }
31
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,QAAQ,EACR,cAAc,EACd,SAAS,EACT,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,0DAA0D;AAC1D,MAAM,UAAU,UAAU;IACxB,IAAI,MAA4B,CAAC;IACjC,OAAO,KAAK,IAAI,EAAE;QAChB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,IAAI,QAAQ,CAAC;gBACpB,MAAM,EAAE,SAAS,EAAE;gBACnB,WAAW,EAAE,cAAc,EAAE;gBAC7B,MAAM,EAAE,SAAS,EAAE;aACpB,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * CLI config file ($HYPER_HOME/config or ~/.hypercli/config).
3
+ *
4
+ * HYPER_API_KEY, HYPER_API_BASE and HYPER_AGENTS_API_BASE are honored. HYPER_HOME is used
5
+ * verbatim (no tilde expansion), matching the rs and py SDKs, and retired
6
+ * legacy override keys are scrubbed at save time so stale persisted values
7
+ * cannot shadow the selected bases.
8
+ */
9
+ export declare function cliConfigDir(): string;
10
+ export declare function cliConfigFile(): string;
11
+ export declare function loadCliConfigFile(): Record<string, string>;
12
+ export declare function applyCliConfigFile(): void;
13
+ export declare function saveCliConfig(apiKey: string, apiBase?: string): void;
@@ -0,0 +1,79 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ /**
5
+ * CLI config file ($HYPER_HOME/config or ~/.hypercli/config).
6
+ *
7
+ * HYPER_API_KEY, HYPER_API_BASE and HYPER_AGENTS_API_BASE are honored. HYPER_HOME is used
8
+ * verbatim (no tilde expansion), matching the rs and py SDKs, and retired
9
+ * legacy override keys are scrubbed at save time so stale persisted values
10
+ * cannot shadow the selected bases.
11
+ */
12
+ export function cliConfigDir() {
13
+ const hyperHome = process.env.HYPER_HOME?.trim();
14
+ return hyperHome || join(homedir(), '.hypercli');
15
+ }
16
+ export function cliConfigFile() {
17
+ return join(cliConfigDir(), 'config');
18
+ }
19
+ function parseConfigValue(value) {
20
+ const trimmed = value.trim();
21
+ if ((trimmed.startsWith('"') && trimmed.endsWith('"')) ||
22
+ (trimmed.startsWith("'") && trimmed.endsWith("'"))) {
23
+ return trimmed.slice(1, -1);
24
+ }
25
+ return trimmed;
26
+ }
27
+ export function loadCliConfigFile() {
28
+ const config = {};
29
+ const path = cliConfigFile();
30
+ if (!existsSync(path))
31
+ return config;
32
+ for (const line of readFileSync(path, 'utf8').split('\n')) {
33
+ const trimmed = line.trim();
34
+ if (!trimmed || trimmed.startsWith('#') || !trimmed.includes('='))
35
+ continue;
36
+ const normalized = trimmed.startsWith('export ') ? trimmed.slice('export '.length).trim() : trimmed;
37
+ const [key, ...valueParts] = normalized.split('=');
38
+ config[key.trim()] = parseConfigValue(valueParts.join('='));
39
+ }
40
+ return config;
41
+ }
42
+ export function applyCliConfigFile() {
43
+ const config = loadCliConfigFile();
44
+ if (!process.env.HYPER_API_KEY && config.HYPER_API_KEY) {
45
+ process.env.HYPER_API_KEY = config.HYPER_API_KEY;
46
+ }
47
+ if (!process.env.HYPER_API_BASE && config.HYPER_API_BASE) {
48
+ process.env.HYPER_API_BASE = config.HYPER_API_BASE;
49
+ }
50
+ if (!process.env.HYPER_AGENTS_API_BASE && config.HYPER_AGENTS_API_BASE) {
51
+ process.env.HYPER_AGENTS_API_BASE = config.HYPER_AGENTS_API_BASE;
52
+ }
53
+ }
54
+ export function saveCliConfig(apiKey, apiBase) {
55
+ const config = loadCliConfigFile();
56
+ config.HYPER_API_KEY = apiKey;
57
+ // Drop retired legacy overrides, preserving both supported base settings.
58
+ delete config.HYPERCLI_API_KEY;
59
+ delete config.HYPERCLI_API_URL;
60
+ delete config.AGENTS_API_BASE_URL;
61
+ delete config.AGENTS_WS_URL;
62
+ if (apiBase) {
63
+ config.HYPER_API_BASE = apiBase;
64
+ }
65
+ else if (!config.HYPER_API_BASE) {
66
+ delete config.HYPER_API_BASE;
67
+ }
68
+ const dir = cliConfigDir();
69
+ const path = cliConfigFile();
70
+ mkdirSync(dir, { recursive: true });
71
+ writeFileSync(path, Object.entries(config).map(([key, value]) => `${key}=${value}`).join('\n') + '\n');
72
+ try {
73
+ chmodSync(path, 0o600);
74
+ }
75
+ catch {
76
+ // Some platforms do not support POSIX permissions.
77
+ }
78
+ }
79
+ //# sourceMappingURL=config-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-file.js","sourceRoot":"","sources":["../../src/core/config-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;IACjD,OAAO,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC,YAAY,EAAE,EAAE,QAAQ,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IACE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA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,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACvG,IAAI,CAAC;QACH,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,mDAAmD;IACrD,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * CLI errors and exit-code mapping.
3
+ *
4
+ * Exit codes (non-negotiable):
5
+ * 0 success
6
+ * 1 generic error (default)
7
+ * 2 usage error (bad flags / bad arguments) — throw UsageError
8
+ * 130 SIGINT (Ctrl+C) — handled by the entrypoint
9
+ *
10
+ * All errors print `error: <message>` to stderr, nothing to stdout.
11
+ */
12
+ export declare class CliError extends Error {
13
+ readonly exitCode: number;
14
+ constructor(message: string, exitCode?: number);
15
+ }
16
+ export declare class UsageError extends CliError {
17
+ constructor(message: string);
18
+ }
19
+ /** Print an error to stderr in the canonical `error: <message>` form. */
20
+ export declare function printError(err: unknown): void;
21
+ /** Map any thrown value to a process exit code. */
22
+ export declare function exitCodeFor(err: unknown): number;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * CLI errors and exit-code mapping.
3
+ *
4
+ * Exit codes (non-negotiable):
5
+ * 0 success
6
+ * 1 generic error (default)
7
+ * 2 usage error (bad flags / bad arguments) — throw UsageError
8
+ * 130 SIGINT (Ctrl+C) — handled by the entrypoint
9
+ *
10
+ * All errors print `error: <message>` to stderr, nothing to stdout.
11
+ */
12
+ export class CliError extends Error {
13
+ exitCode;
14
+ constructor(message, exitCode = 1) {
15
+ super(message);
16
+ this.name = 'CliError';
17
+ this.exitCode = exitCode;
18
+ }
19
+ }
20
+ export class UsageError extends CliError {
21
+ constructor(message) {
22
+ super(message, 2);
23
+ this.name = 'UsageError';
24
+ }
25
+ }
26
+ /** Print an error to stderr in the canonical `error: <message>` form. */
27
+ export function printError(err) {
28
+ const message = err instanceof Error ? err.message : String(err);
29
+ process.stderr.write(`error: ${message}\n`);
30
+ }
31
+ /** Map any thrown value to a process exit code. */
32
+ export function exitCodeFor(err) {
33
+ if (err instanceof CliError)
34
+ return err.exitCode;
35
+ return 1;
36
+ }
37
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,QAAQ,CAAS;IAE1B,YAAY,OAAe,EAAE,QAAQ,GAAG,CAAC;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,OAAO,UAAW,SAAQ,QAAQ;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED,yEAAyE;AACzE,MAAM,UAAU,UAAU,CAAC,GAAY;IACrC,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,OAAO,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,IAAI,GAAG,YAAY,QAAQ;QAAE,OAAO,GAAG,CAAC,QAAQ,CAAC;IACjD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Root and group help rendering, driven by the registry.
3
+ */
4
+ import type { CommandGroup } from './types.js';
5
+ export declare function renderRootHelp(groups: readonly CommandGroup[]): string;
6
+ export declare function renderGroupHelp(group: CommandGroup): string;
7
+ /**
8
+ * Closest match for an unknown group name: shortest candidate that starts
9
+ * with the input, else the shortest candidate containing it. Anything else
10
+ * gets no suggestion — with only a handful of groups, fuzzy edit-distance
11
+ * guesses are more misleading than helpful.
12
+ */
13
+ export declare function closestMatch(input: string, candidates: readonly string[]): string | undefined;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Root and group help rendering, driven by the registry.
3
+ */
4
+ import { formatTable } from './table.js';
5
+ const UNIVERSAL_HELP = `\
6
+ Universal flags:
7
+ --json machine output: single JSON value on stdout
8
+ --output, -o FMT 'table' (default) or 'json'
9
+ --help, -h show help`;
10
+ export function renderRootHelp(groups) {
11
+ const lines = [
12
+ 'hyper — HyperCLI command line',
13
+ '',
14
+ 'Usage:',
15
+ ' hyper <group> <command> [flags]',
16
+ ' hyper <command> [flags]',
17
+ '',
18
+ 'Commands:',
19
+ formatTable(['GROUP', 'DESCRIPTION'], groups.map((g) => [g.name, g.summary])),
20
+ '',
21
+ UNIVERSAL_HELP,
22
+ '',
23
+ "Run 'hyper <group> --help' for command-level help.",
24
+ ];
25
+ return lines.join('\n');
26
+ }
27
+ export function renderGroupHelp(group) {
28
+ const lines = [
29
+ `hyper ${group.name} — ${group.summary}`,
30
+ '',
31
+ 'Usage:',
32
+ ...group.usage.map((u) => ` ${u}`),
33
+ '',
34
+ UNIVERSAL_HELP,
35
+ ];
36
+ return lines.join('\n');
37
+ }
38
+ /**
39
+ * Closest match for an unknown group name: shortest candidate that starts
40
+ * with the input, else the shortest candidate containing it. Anything else
41
+ * gets no suggestion — with only a handful of groups, fuzzy edit-distance
42
+ * guesses are more misleading than helpful.
43
+ */
44
+ export function closestMatch(input, candidates) {
45
+ const query = input.toLowerCase();
46
+ if (!query)
47
+ return undefined;
48
+ const byLength = (a, b) => a.length - b.length;
49
+ const prefix = candidates.filter((c) => c.toLowerCase().startsWith(query)).sort(byLength);
50
+ if (prefix.length > 0)
51
+ return prefix[0];
52
+ const containing = candidates.filter((c) => c.toLowerCase().includes(query)).sort(byLength);
53
+ return containing[0];
54
+ }
55
+ //# sourceMappingURL=help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/core/help.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,cAAc,GAAG;;;;8BAIO,CAAC;AAE/B,MAAM,UAAU,cAAc,CAAC,MAA+B;IAC5D,MAAM,KAAK,GAAG;QACZ,+BAA+B;QAC/B,EAAE;QACF,QAAQ;QACR,mCAAmC;QACnC,2BAA2B;QAC3B,EAAE;QACF,WAAW;QACX,WAAW,CACT,CAAC,OAAO,EAAE,aAAa,CAAC,EACxB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CACvC;QACD,EAAE;QACF,cAAc;QACd,EAAE;QACF,oDAAoD;KACrD,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAmB;IACjD,MAAM,KAAK,GAAG;QACZ,SAAS,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;QACxC,EAAE;QACF,QAAQ;QACR,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,EAAE;QACF,cAAc;KACf,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,UAA6B;IACvE,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/D,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1F,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5F,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CommandContext } from './types.js';
2
+ export declare function runIntegrationsMcp(ctx: CommandContext, args: string[]): Promise<number | void>;
@@ -0,0 +1,115 @@
1
+ import { deriveIntegrationsApiBase } from '@hypercli.com/sdk';
2
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
3
+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
4
+ import { APP_VERSION } from '../version.js';
5
+ import { parseCommandArgs } from './argv.js';
6
+ import { CliError, UsageError } from './errors.js';
7
+ const HELP = `hyper integrations --mcp [--json]
8
+ List server tool names and descriptions; --json includes full input schemas.
9
+ hyper integrations --mcp <tool> --help [--json]
10
+ Fetch a tool's description and input schema (requires authentication).
11
+ hyper integrations --mcp <tool> [--args JSON] [--json]
12
+ Invoke a tool with a JSON object (defaults to {}). Server permissions apply.
13
+ --json returns the complete MCP result; tool errors exit with status 1.
14
+ Uses the same credentials and HYPER_AGENTS_API_BASE (or HYPER_API_BASE fallback) as integrations REST.`;
15
+ export async function runIntegrationsMcp(ctx, args) {
16
+ const parsed = parseCommandArgs(args, { mcp: { type: 'boolean' }, args: { type: 'string' } });
17
+ const [name, extra] = parsed.positionals;
18
+ if (extra !== undefined)
19
+ throw new UsageError('expected at most one MCP tool name');
20
+ if (parsed.values.args !== undefined && !name)
21
+ throw new UsageError('--args requires an MCP tool name');
22
+ if (parsed.help && !name) {
23
+ ctx.output.result({ help: HELP }, HELP);
24
+ return;
25
+ }
26
+ let toolArgs = {};
27
+ if (typeof parsed.values.args === 'string') {
28
+ try {
29
+ const value = JSON.parse(parsed.values.args);
30
+ if (value === null || typeof value !== 'object' || Array.isArray(value))
31
+ throw new Error();
32
+ toolArgs = value;
33
+ }
34
+ catch {
35
+ // Do not echo arguments: they may contain provider credentials.
36
+ throw new UsageError('--args must be a valid JSON object');
37
+ }
38
+ }
39
+ const resolved = await ctx.client();
40
+ const client = new Client({ name: 'hyper-cli', version: APP_VERSION });
41
+ let transport;
42
+ let action = 'connect to integrations MCP';
43
+ try {
44
+ // Same base resolution as lazyClient -> HyperCLI.integrations. Reuse the
45
+ // resolved key rather than introducing a separate credential precedence.
46
+ const base = deriveIntegrationsApiBase(resolved.deployments.agentApiBase);
47
+ transport = new StreamableHTTPClientTransport(new URL(`${base}/mcp`), {
48
+ requestInit: { headers: { Authorization: `Bearer ${resolved.apiKey}` } },
49
+ });
50
+ await client.connect(transport);
51
+ action = 'list integrations MCP tools';
52
+ const tools = [];
53
+ const cursors = new Set();
54
+ let cursor;
55
+ do {
56
+ const page = await client.listTools(cursor === undefined ? undefined : { cursor });
57
+ tools.push(...page.tools);
58
+ cursor = page.nextCursor;
59
+ if (cursor !== undefined) {
60
+ if (cursors.has(cursor))
61
+ throw new CliError('integrations MCP returned a repeated pagination cursor');
62
+ cursors.add(cursor);
63
+ }
64
+ } while (cursor !== undefined);
65
+ if (!name) {
66
+ ctx.output.result(tools, {
67
+ columns: ['NAME', 'DESCRIPTION'],
68
+ rows: tools.map((tool) => [tool.name, tool.description ?? '']),
69
+ });
70
+ return;
71
+ }
72
+ const tool = tools.find((entry) => entry.name === name);
73
+ if (!tool)
74
+ throw new UsageError('unknown MCP tool; run hyper integrations --mcp to list available tools');
75
+ if (parsed.help) {
76
+ ctx.output.result(tool, [
77
+ `hyper integrations --mcp ${tool.name} --args JSON`,
78
+ tool.description ?? '',
79
+ 'Arguments (inputSchema):',
80
+ JSON.stringify(tool.inputSchema, null, 2),
81
+ ].join('\n'));
82
+ return;
83
+ }
84
+ action = 'call integrations MCP tool';
85
+ const result = await client.callTool({ name, arguments: toolArgs }, undefined, { timeout: 90000 });
86
+ // Preserve all content blocks and structuredContent in either output mode.
87
+ // A server error can echo the request credential; never print that key.
88
+ const safeResult = result.isError
89
+ ? JSON.parse(JSON.stringify(result).split(resolved.apiKey).join('[REDACTED]'))
90
+ : result;
91
+ ctx.output.result(safeResult, JSON.stringify(safeResult, null, 2));
92
+ return result.isError ? 1 : 0;
93
+ }
94
+ catch (err) {
95
+ if (err instanceof CliError)
96
+ throw err;
97
+ // SDK/HTTP exceptions can embed response bodies, URLs or auth headers.
98
+ throw new CliError(`failed to ${action}; check credentials, base URL and server availability`);
99
+ }
100
+ finally {
101
+ try {
102
+ await client.close();
103
+ }
104
+ catch {
105
+ ctx.output.info('warning: failed to close integrations MCP client');
106
+ }
107
+ finally {
108
+ // Also cover partial connect failures before the client owns transport.
109
+ await transport?.close().catch(() => {
110
+ ctx.output.info('warning: failed to close integrations MCP transport');
111
+ });
112
+ }
113
+ }
114
+ }
115
+ //# sourceMappingURL=integrations-mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations-mcp.js","sourceRoot":"","sources":["../../src/core/integrations-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6B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. Nothing else may be written to stdout; progress
6
+ * and diagnostics go to stderr via `output.info()`.
7
+ * - Table mode: human-readable aligned columns (see core/table.ts). Commands
8
+ * must pass an explicit TableData or a preformatted string; there is no
9
+ * auto-rendering of raw data.
10
+ */
11
+ export type OutputFormat = 'table' | 'json';
12
+ export interface TableData {
13
+ columns: string[];
14
+ rows: unknown[][];
15
+ }
16
+ export interface Output {
17
+ readonly format: OutputFormat;
18
+ /**
19
+ * Emit the command's result.
20
+ * - json: writes `JSON.stringify(data)` + '\n' to stdout. `table` ignored.
21
+ * - table: writes the rendered table/string to stdout. In table mode you
22
+ * MUST pass `table` (TableData or preformatted string); without it the
23
+ * data is not rendered, only surfaced in JSON mode.
24
+ */
25
+ result(data: unknown, table?: TableData | string): void;
26
+ /** Progress / diagnostic message to stderr. Never stdout. */
27
+ info(message: string): void;
28
+ }
29
+ export declare function createOutput(format: OutputFormat): Output;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Output discipline:
3
+ *
4
+ * - JSON mode: stdout receives exactly one `JSON.stringify` of the result
5
+ * plus a trailing newline. Nothing else may be written to stdout; progress
6
+ * and diagnostics go to stderr via `output.info()`.
7
+ * - Table mode: human-readable aligned columns (see core/table.ts). Commands
8
+ * must pass an explicit TableData or a preformatted string; there is no
9
+ * auto-rendering of raw data.
10
+ */
11
+ import { formatTable } from './table.js';
12
+ export function createOutput(format) {
13
+ return {
14
+ format,
15
+ result(data, table) {
16
+ if (format === 'json') {
17
+ process.stdout.write(`${JSON.stringify(data)}\n`);
18
+ return;
19
+ }
20
+ const text = typeof table === 'string'
21
+ ? table
22
+ : table
23
+ ? formatTable(table.columns, table.rows)
24
+ : undefined;
25
+ if (!text)
26
+ return;
27
+ process.stdout.write(text.endsWith('\n') ? text : `${text}\n`);
28
+ },
29
+ info(message) {
30
+ process.stderr.write(`${message}\n`);
31
+ },
32
+ };
33
+ }
34
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/core/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAyBzC,MAAM,UAAU,YAAY,CAAC,MAAoB;IAC/C,OAAO;QACL,MAAM;QACN,MAAM,CAAC,IAAa,EAAE,KAA0B;YAC9C,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;gBACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClD,OAAO;YACT,CAAC;YACD,MAAM,IAAI,GACR,OAAO,KAAK,KAAK,QAAQ;gBACvB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,KAAK;oBACL,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC;oBACxC,CAAC,CAAC,SAAS,CAAC;YAClB,IAAI,CAAC,IAAI;gBAAE,OAAO;YAClB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,OAAe;YAClB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Bundled-skills runtime.
3
+ *
4
+ * scripts/build-skills.mjs compiles the allowlisted skills into
5
+ * <pkg>/skills/: one <name>.json per skill (full record, markdown
6
+ * included) and an index.json with { skills: [{ name, description,
7
+ * commands }] } in display order.
8
+ *
9
+ * index.json is the single source of truth for listSkills() and name
10
+ * resolution — the skills directory is never scanned, so the build-time
11
+ * allowlist fully controls what `hyper skills` can see. getSkill()
12
+ * resolves an exact name or an unambiguous case-insensitive prefix against
13
+ * the index, then loads <name>.json for the full markdown record; failures
14
+ * list candidate skill names on the error.
15
+ */
16
+ export interface SkillIndexEntry {
17
+ name: string;
18
+ description: string;
19
+ commands: string[];
20
+ }
21
+ export interface BundledSkill extends SkillIndexEntry {
22
+ markdown: string;
23
+ }
24
+ /** Resolve the generated catalog relative to the installed CLI artifact. */
25
+ export declare function skillsDir(): string;
26
+ /**
27
+ * Index entries in display order. Empty when the dir or index is missing
28
+ * or corrupt.
29
+ */
30
+ export declare function listSkills(dir?: string): SkillIndexEntry[];
31
+ /**
32
+ * Resolve a name or unambiguous prefix against candidate names.
33
+ * Returns the matched name, or throws CliError listing candidates.
34
+ */
35
+ export declare function resolveSkillName(nameOrPrefix: string, names: readonly string[]): string;
36
+ /** Load one skill by exact name or unambiguous prefix. */
37
+ export declare function getSkill(nameOrPrefix: string, dir?: string): BundledSkill;