agent-relay 12.2.2 → 12.2.4
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/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +12 -5
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/commands/cloud-v1-deprecations.d.ts +44 -0
- package/dist/cli/commands/cloud-v1-deprecations.d.ts.map +1 -0
- package/dist/cli/commands/cloud-v1-deprecations.js +108 -0
- package/dist/cli/commands/cloud-v1-deprecations.js.map +1 -0
- package/dist/cli/commands/cloud.d.ts.map +1 -1
- package/dist/cli/commands/cloud.js +3 -0
- package/dist/cli/commands/cloud.js.map +1 -1
- package/dist/cli/commands/local-agent.d.ts.map +1 -1
- package/dist/cli/commands/local-agent.js +61 -5
- package/dist/cli/commands/local-agent.js.map +1 -1
- package/dist/cli/commands/local-workflow.d.ts.map +1 -1
- package/dist/cli/commands/local-workflow.js +3 -0
- package/dist/cli/commands/local-workflow.js.map +1 -1
- package/dist/cli/commands/product-surfaces.d.ts +67 -0
- package/dist/cli/commands/product-surfaces.d.ts.map +1 -0
- package/dist/cli/commands/product-surfaces.js +165 -0
- package/dist/cli/commands/product-surfaces.js.map +1 -0
- package/dist/cli/commands/session.d.ts +17 -0
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +65 -1
- package/dist/cli/commands/session.js.map +1 -1
- package/dist/cli/lib/deprecate-command.d.ts +74 -0
- package/dist/cli/lib/deprecate-command.d.ts.map +1 -0
- package/dist/cli/lib/deprecate-command.js +107 -0
- package/dist/cli/lib/deprecate-command.js.map +1 -0
- package/dist/cli/lib/relay-cli-surface.d.ts +93 -0
- package/dist/cli/lib/relay-cli-surface.d.ts.map +1 -0
- package/dist/cli/lib/relay-cli-surface.js +237 -0
- package/dist/cli/lib/relay-cli-surface.js.map +1 -0
- package/dist/index.cjs +60 -7
- package/package.json +13 -9
- package/dist/cli/commands/reflex.d.ts +0 -18
- package/dist/cli/commands/reflex.d.ts.map +0 -1
- package/dist/cli/commands/reflex.js +0 -181
- package/dist/cli/commands/reflex.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/cli/commands/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/cli/commands/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,aAAa,EAA4B,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAW,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE,kFAAkF;AAClF,MAAM,mBAAmB,GAAG,4EAA4E,CAAC;AACzG,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAC3D,0FAA0F;AAC1F,MAAM,2BAA2B,GAAG,CAAC,oBAAoB,EAAE,2BAA2B,EAAE,mBAAmB,CAAC,CAAC;AAoB7G,mGAAmG;AACnG,MAAM,UAAU,0BAA0B;IACxC,IAAI,CAAC;QACH,MAAM,OAAO,GACX,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;QAC9F,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,E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AAM,CAAC,aAAa,IAAI,CAAC,CAAC;YACvC,OAAO,CAAC,CAAC;QACX,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mark existing commander commands as deprecated without changing what they do.
|
|
3
|
+
*
|
|
4
|
+
* Used for the v1 relayflows commands under `agent-relay cloud`, which are
|
|
5
|
+
* superseded by the v2 `agent-relay flows` surface. The agreed behaviour is
|
|
6
|
+
* "keep working, warn, hide": scripts that call them today keep passing, the
|
|
7
|
+
* operator is told what to move to, and new users never discover v1 from
|
|
8
|
+
* `--help`.
|
|
9
|
+
*
|
|
10
|
+
* Hiding goes through commander's public `configureHelp({ visibleCommands })`
|
|
11
|
+
* rather than the private `_hidden` field, so a commander upgrade cannot
|
|
12
|
+
* silently un-hide the v1 surface.
|
|
13
|
+
*/
|
|
14
|
+
import { type Command } from 'commander';
|
|
15
|
+
/** Where a deprecated command's callers should go instead. */
|
|
16
|
+
export interface DeprecationNotice {
|
|
17
|
+
/**
|
|
18
|
+
* Replacement invocation, e.g. `agent-relay flows run`.
|
|
19
|
+
*
|
|
20
|
+
* Omit when nothing replaces the command yet. Several v1 relayflows commands
|
|
21
|
+
* (schedule, logs, cancel) have no v2 equivalent, and inventing a pointer to
|
|
22
|
+
* a command that does not exist is worse than admitting the gap.
|
|
23
|
+
*/
|
|
24
|
+
replacement?: string;
|
|
25
|
+
/** Version the deprecation took effect. */
|
|
26
|
+
since: string;
|
|
27
|
+
/**
|
|
28
|
+
* Extra guidance appended to the warning.
|
|
29
|
+
*
|
|
30
|
+
* Set this when the replacement is not a drop-in — a v1 command whose v2
|
|
31
|
+
* equivalent takes different arguments needs to say so, or the pointer is
|
|
32
|
+
* worse than no pointer.
|
|
33
|
+
*/
|
|
34
|
+
note?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Keep the command listed in `--help` (default: hide it).
|
|
37
|
+
*
|
|
38
|
+
* Hiding is right for a command with a replacement. A command that is still
|
|
39
|
+
* the only way to do its job must stay discoverable even while deprecated,
|
|
40
|
+
* or we strand the people relying on it.
|
|
41
|
+
*/
|
|
42
|
+
keepVisible?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** Injectable warning sink; defaults to the real stderr. */
|
|
45
|
+
export interface DeprecationDependencies {
|
|
46
|
+
warn: (message: string) => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Render the stderr notice for a deprecated command.
|
|
50
|
+
*
|
|
51
|
+
* @param invocation - How the user reached the command, e.g. `agent-relay cloud run`.
|
|
52
|
+
* @param notice - Replacement and guidance.
|
|
53
|
+
* @returns The warning text, newline-terminated.
|
|
54
|
+
*/
|
|
55
|
+
export declare function formatDeprecationWarning(invocation: string, notice: DeprecationNotice): string;
|
|
56
|
+
/**
|
|
57
|
+
* Attach a deprecation warning to one command and hide it from its parent's help.
|
|
58
|
+
*
|
|
59
|
+
* The command's action is untouched: it still runs, and still returns whatever
|
|
60
|
+
* it returned before.
|
|
61
|
+
*
|
|
62
|
+
* @param command - The command to deprecate. Must already be attached to a parent.
|
|
63
|
+
* @param notice - Replacement and guidance.
|
|
64
|
+
* @param overrides - Test seam for the warning sink.
|
|
65
|
+
* @throws When the command has no parent, since there is then no help to hide it from.
|
|
66
|
+
*/
|
|
67
|
+
export declare function deprecateCommand(command: Command, notice: DeprecationNotice, overrides?: Partial<DeprecationDependencies>): void;
|
|
68
|
+
/**
|
|
69
|
+
* Read back the names hidden from a parent's help.
|
|
70
|
+
*
|
|
71
|
+
* Exported for tests; production code has no reason to ask.
|
|
72
|
+
*/
|
|
73
|
+
export declare function hiddenCommandNames(parent: Command): readonly string[];
|
|
74
|
+
//# sourceMappingURL=deprecate-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecate-command.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/deprecate-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAQ,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAE/C,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,4DAA4D;AAC5D,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAe9F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC/C,IAAI,CAoBN;AAwCD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAErE"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mark existing commander commands as deprecated without changing what they do.
|
|
3
|
+
*
|
|
4
|
+
* Used for the v1 relayflows commands under `agent-relay cloud`, which are
|
|
5
|
+
* superseded by the v2 `agent-relay flows` surface. The agreed behaviour is
|
|
6
|
+
* "keep working, warn, hide": scripts that call them today keep passing, the
|
|
7
|
+
* operator is told what to move to, and new users never discover v1 from
|
|
8
|
+
* `--help`.
|
|
9
|
+
*
|
|
10
|
+
* Hiding goes through commander's public `configureHelp({ visibleCommands })`
|
|
11
|
+
* rather than the private `_hidden` field, so a commander upgrade cannot
|
|
12
|
+
* silently un-hide the v1 surface.
|
|
13
|
+
*/
|
|
14
|
+
import { Help } from 'commander';
|
|
15
|
+
/**
|
|
16
|
+
* Render the stderr notice for a deprecated command.
|
|
17
|
+
*
|
|
18
|
+
* @param invocation - How the user reached the command, e.g. `agent-relay cloud run`.
|
|
19
|
+
* @param notice - Replacement and guidance.
|
|
20
|
+
* @returns The warning text, newline-terminated.
|
|
21
|
+
*/
|
|
22
|
+
export function formatDeprecationWarning(invocation, notice) {
|
|
23
|
+
const lines = [
|
|
24
|
+
`warning: \`${invocation}\` is deprecated since ${notice.since} and will be removed in a future release.`,
|
|
25
|
+
];
|
|
26
|
+
if (notice.replacement) {
|
|
27
|
+
lines.push(` Use \`${notice.replacement}\` instead.`);
|
|
28
|
+
if (notice.note)
|
|
29
|
+
lines.push(` ${notice.note}`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// A specific note about why there is no replacement beats the generic
|
|
33
|
+
// line; printing both just says the same thing twice.
|
|
34
|
+
lines.push(` ${notice.note ?? 'No replacement is available yet; it remains supported until one ships.'}`);
|
|
35
|
+
}
|
|
36
|
+
return `${lines.join('\n')}\n`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Attach a deprecation warning to one command and hide it from its parent's help.
|
|
40
|
+
*
|
|
41
|
+
* The command's action is untouched: it still runs, and still returns whatever
|
|
42
|
+
* it returned before.
|
|
43
|
+
*
|
|
44
|
+
* @param command - The command to deprecate. Must already be attached to a parent.
|
|
45
|
+
* @param notice - Replacement and guidance.
|
|
46
|
+
* @param overrides - Test seam for the warning sink.
|
|
47
|
+
* @throws When the command has no parent, since there is then no help to hide it from.
|
|
48
|
+
*/
|
|
49
|
+
export function deprecateCommand(command, notice, overrides = {}) {
|
|
50
|
+
const warn = overrides.warn ?? ((message) => process.stderr.write(message));
|
|
51
|
+
const parent = command.parent;
|
|
52
|
+
if (!parent) {
|
|
53
|
+
throw new Error(`cannot deprecate '${command.name()}': it is not attached to a parent command`);
|
|
54
|
+
}
|
|
55
|
+
// Keep the text accurate for anyone who reaches help another way (`--help`
|
|
56
|
+
// on the command itself still prints its own description).
|
|
57
|
+
command.description(notice.replacement
|
|
58
|
+
? `${command.description()} (deprecated — use \`${notice.replacement}\`)`
|
|
59
|
+
: `${command.description()} (deprecated)`);
|
|
60
|
+
command.hook('preAction', () => {
|
|
61
|
+
warn(formatDeprecationWarning(invocationPath(command), notice));
|
|
62
|
+
});
|
|
63
|
+
if (!notice.keepVisible)
|
|
64
|
+
hideFromParentHelp(parent, command.name());
|
|
65
|
+
}
|
|
66
|
+
/** Build the full invocation path for a command, e.g. `agent-relay cloud run`. */
|
|
67
|
+
function invocationPath(command) {
|
|
68
|
+
const names = [];
|
|
69
|
+
let cursor = command;
|
|
70
|
+
while (cursor) {
|
|
71
|
+
names.unshift(cursor.name());
|
|
72
|
+
cursor = cursor.parent;
|
|
73
|
+
}
|
|
74
|
+
return names.join(' ');
|
|
75
|
+
}
|
|
76
|
+
/** Command names hidden from each parent's help, keyed by the parent command. */
|
|
77
|
+
const hiddenByParent = new WeakMap();
|
|
78
|
+
/**
|
|
79
|
+
* Hide one subcommand name from a parent's help listing.
|
|
80
|
+
*
|
|
81
|
+
* Idempotent, and safe to call for several children of the same parent: the
|
|
82
|
+
* help override is installed once and consults a growing name set.
|
|
83
|
+
*/
|
|
84
|
+
function hideFromParentHelp(parent, name) {
|
|
85
|
+
const existing = hiddenByParent.get(parent);
|
|
86
|
+
if (existing) {
|
|
87
|
+
existing.add(name);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const hidden = new Set([name]);
|
|
91
|
+
hiddenByParent.set(parent, hidden);
|
|
92
|
+
// Delegate to commander's own visibility rules, then subtract. Reimplementing
|
|
93
|
+
// the filter would drop its handling of the built-in help command.
|
|
94
|
+
const base = new Help();
|
|
95
|
+
parent.configureHelp({
|
|
96
|
+
visibleCommands: (cmd) => base.visibleCommands(cmd).filter((child) => !hidden.has(child.name())),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Read back the names hidden from a parent's help.
|
|
101
|
+
*
|
|
102
|
+
* Exported for tests; production code has no reason to ask.
|
|
103
|
+
*/
|
|
104
|
+
export function hiddenCommandNames(parent) {
|
|
105
|
+
return [...(hiddenByParent.get(parent) ?? [])];
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=deprecate-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecate-command.js","sourceRoot":"","sources":["../../../src/cli/lib/deprecate-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAgB,MAAM,WAAW,CAAC;AAqC/C;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAAkB,EAAE,MAAyB;IACpF,MAAM,KAAK,GAAG;QACZ,cAAc,UAAU,0BAA0B,MAAM,CAAC,KAAK,2CAA2C;KAC1G,CAAC;IACF,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,kBAAkB,MAAM,CAAC,WAAW,aAAa,CAAC,CAAC;QAC9D,IAAI,MAAM,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,YAAY,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,sEAAsE;QACtE,sDAAsD;QACtD,KAAK,CAAC,IAAI,CACR,YAAY,MAAM,CAAC,IAAI,IAAI,wEAAwE,EAAE,CACtG,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAgB,EAChB,MAAyB,EACzB,YAA8C,EAAE;IAEhD,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,IAAI,CAAC,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACpF,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AE,CAAC;QACb,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEnC,8EAA8E;IAC9E,mEAAmE;IACnE,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACxB,MAAM,CAAC,aAAa,CAAC;QACnB,eAAe,EAAE,CAAC,GAAY,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;KAC1G,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAe;IAChD,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single generic mount point for Relay product CLIs.
|
|
3
|
+
*
|
|
4
|
+
* `agent-relay file`, `agent-relay flows`, and `agent-relay sessions` are all
|
|
5
|
+
* this module. Each product repo (relayfile, flows, relayhistory) ships a
|
|
6
|
+
* {@link RelayCliSurface} describing and dispatching its own commands; this
|
|
7
|
+
* host renders help from the declared tree and forwards everything else to the
|
|
8
|
+
* product verbatim. No product command is reimplemented here — if a command
|
|
9
|
+
* needs to change, it changes in the product repo.
|
|
10
|
+
*
|
|
11
|
+
* Two deliberate choices:
|
|
12
|
+
*
|
|
13
|
+
* - **Argv is forwarded untouched.** Commander parses only far enough to find
|
|
14
|
+
* the group, then hands the remaining tokens straight to `surface.run`. A
|
|
15
|
+
* re-serialized option list would silently drop product flags the host has
|
|
16
|
+
* never heard of.
|
|
17
|
+
* - **Help is rendered from the spec, not forwarded.** Asking the product to
|
|
18
|
+
* print its own help yields its own program name (`relayfile ls …`), which is
|
|
19
|
+
* wrong once mounted. Rendering from `commands` keeps `agent-relay file ls`
|
|
20
|
+
* in the usage line and makes every product's help look the same.
|
|
21
|
+
*/
|
|
22
|
+
import { type Command } from 'commander';
|
|
23
|
+
import type { RelayCliCommandSpec, RelayCliIo, RelayCliSurface } from '@agent-relay/cli-surface';
|
|
24
|
+
/** Injectable seams; the defaults are the real process. */
|
|
25
|
+
export interface RelayCliSurfaceDependencies {
|
|
26
|
+
io: RelayCliIo;
|
|
27
|
+
exit: (code: number) => never;
|
|
28
|
+
}
|
|
29
|
+
export interface MountSurfaceOptions {
|
|
30
|
+
/** Group name under `agent-relay`, e.g. `file`. */
|
|
31
|
+
as: string;
|
|
32
|
+
/** One-line description for `agent-relay --help`. */
|
|
33
|
+
description: string;
|
|
34
|
+
/**
|
|
35
|
+
* Import and construct the surface.
|
|
36
|
+
*
|
|
37
|
+
* Called only once the group is actually invoked. Product SDKs are heavy
|
|
38
|
+
* (the relayfile SDK resolves a Go binary, the flows SDK pulls a runtime),
|
|
39
|
+
* so importing them eagerly would tax every `agent-relay` invocation
|
|
40
|
+
* including `--help`.
|
|
41
|
+
*/
|
|
42
|
+
load: () => Promise<RelayCliSurface>;
|
|
43
|
+
/**
|
|
44
|
+
* Extra group names that reach the same surface, hidden from help.
|
|
45
|
+
*
|
|
46
|
+
* Used to keep `agent-relay session …` working after it was absorbed into
|
|
47
|
+
* `agent-relay sessions`.
|
|
48
|
+
*/
|
|
49
|
+
hiddenAliases?: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Walk `argv` down the spec tree as far as it matches.
|
|
53
|
+
*
|
|
54
|
+
* @returns The deepest matched command (undefined at the group root), the path
|
|
55
|
+
* taken, and the first token that did not match a subcommand.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveSpecPath(commands: readonly RelayCliCommandSpec[], argv: readonly string[]): {
|
|
58
|
+
command: RelayCliCommandSpec | undefined;
|
|
59
|
+
path: readonly string[];
|
|
60
|
+
/** Tokens left once matching stopped, including the one that failed to match. */
|
|
61
|
+
rest: readonly string[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Render help for one node of a product command tree.
|
|
65
|
+
*
|
|
66
|
+
* @param groupPath - How the user reached here, e.g. `agent-relay file ls`.
|
|
67
|
+
* @param command - The resolved spec node, or undefined for the group root.
|
|
68
|
+
* @param roots - The surface's top-level commands, used at the group root.
|
|
69
|
+
* @returns The help text, newline-terminated.
|
|
70
|
+
*/
|
|
71
|
+
export declare function renderSurfaceHelp(groupPath: string, command: RelayCliCommandSpec | undefined, roots: readonly RelayCliCommandSpec[]): string;
|
|
72
|
+
/**
|
|
73
|
+
* Run one invocation against a loaded surface.
|
|
74
|
+
*
|
|
75
|
+
* Exported for tests and for the hidden-alias path; `mountRelayCliSurface` is
|
|
76
|
+
* the normal entry point.
|
|
77
|
+
*
|
|
78
|
+
* @param surface - The product surface.
|
|
79
|
+
* @param groupPath - Display path for help and notices, e.g. `agent-relay file`.
|
|
80
|
+
* @param argv - Tokens after the group name.
|
|
81
|
+
* @param deps - Output sink and exit function.
|
|
82
|
+
* @returns The exit code the host should use.
|
|
83
|
+
*/
|
|
84
|
+
export declare function runSurface(surface: RelayCliSurface, groupPath: string, argv: readonly string[], deps: RelayCliSurfaceDependencies): Promise<number>;
|
|
85
|
+
/**
|
|
86
|
+
* Mount a product CLI as a group on the `agent-relay` program.
|
|
87
|
+
*
|
|
88
|
+
* @param program - The root commander program.
|
|
89
|
+
* @param options - Group name, description, and the lazy surface loader.
|
|
90
|
+
* @param overrides - Test seams for io and exit.
|
|
91
|
+
*/
|
|
92
|
+
export declare function mountRelayCliSurface(program: Command, options: MountSurfaceOptions, overrides?: Partial<RelayCliSurfaceDependencies>): void;
|
|
93
|
+
//# sourceMappingURL=relay-cli-surface.d.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ACjB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,MAAM,CAAC,CA2CjB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,mBAAmB,EAC5B,SAAS,GAAE,OAAO,CAAC,2BAA2B,CAAM,GACnD,IAAI,CAsCN"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single generic mount point for Relay product CLIs.
|
|
3
|
+
*
|
|
4
|
+
* `agent-relay file`, `agent-relay flows`, and `agent-relay sessions` are all
|
|
5
|
+
* this module. Each product repo (relayfile, flows, relayhistory) ships a
|
|
6
|
+
* {@link RelayCliSurface} describing and dispatching its own commands; this
|
|
7
|
+
* host renders help from the declared tree and forwards everything else to the
|
|
8
|
+
* product verbatim. No product command is reimplemented here — if a command
|
|
9
|
+
* needs to change, it changes in the product repo.
|
|
10
|
+
*
|
|
11
|
+
* Two deliberate choices:
|
|
12
|
+
*
|
|
13
|
+
* - **Argv is forwarded untouched.** Commander parses only far enough to find
|
|
14
|
+
* the group, then hands the remaining tokens straight to `surface.run`. A
|
|
15
|
+
* re-serialized option list would silently drop product flags the host has
|
|
16
|
+
* never heard of.
|
|
17
|
+
* - **Help is rendered from the spec, not forwarded.** Asking the product to
|
|
18
|
+
* print its own help yields its own program name (`relayfile ls …`), which is
|
|
19
|
+
* wrong once mounted. Rendering from `commands` keeps `agent-relay file ls`
|
|
20
|
+
* in the usage line and makes every product's help look the same.
|
|
21
|
+
*/
|
|
22
|
+
import { Help } from 'commander';
|
|
23
|
+
import { describeError } from './describe-error.js';
|
|
24
|
+
import { defaultExit } from './exit.js';
|
|
25
|
+
/** Exit code used when the argv names no command in the surface. */
|
|
26
|
+
const EXIT_UNKNOWN_COMMAND = 2;
|
|
27
|
+
function withDefaults(overrides) {
|
|
28
|
+
return {
|
|
29
|
+
io: overrides.io ?? {
|
|
30
|
+
stdout: (chunk) => process.stdout.write(chunk),
|
|
31
|
+
stderr: (chunk) => process.stderr.write(chunk),
|
|
32
|
+
},
|
|
33
|
+
exit: overrides.exit ?? defaultExit,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** True when the token asks for help rather than naming a command. */
|
|
37
|
+
function isHelpFlag(token) {
|
|
38
|
+
return token === '--help' || token === '-h' || token === 'help';
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Walk `argv` down the spec tree as far as it matches.
|
|
42
|
+
*
|
|
43
|
+
* @returns The deepest matched command (undefined at the group root), the path
|
|
44
|
+
* taken, and the first token that did not match a subcommand.
|
|
45
|
+
*/
|
|
46
|
+
export function resolveSpecPath(commands, argv) {
|
|
47
|
+
let level = commands;
|
|
48
|
+
let command;
|
|
49
|
+
const path = [];
|
|
50
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
51
|
+
const token = argv[index];
|
|
52
|
+
// Stop at the first flag: everything after it belongs to the product.
|
|
53
|
+
if (token.startsWith('-'))
|
|
54
|
+
return { command, path, rest: argv.slice(index) };
|
|
55
|
+
const match = level.find((candidate) => candidate.name === token || candidate.aliases?.includes(token));
|
|
56
|
+
if (!match)
|
|
57
|
+
return { command, path, rest: argv.slice(index) };
|
|
58
|
+
command = match;
|
|
59
|
+
path.push(match.name);
|
|
60
|
+
level = match.subcommands ?? [];
|
|
61
|
+
}
|
|
62
|
+
return { command, path, rest: [] };
|
|
63
|
+
}
|
|
64
|
+
function renderUsage(groupPath, command) {
|
|
65
|
+
const parts = [groupPath];
|
|
66
|
+
if (command?.subcommands?.length)
|
|
67
|
+
parts.push('<command>');
|
|
68
|
+
for (const arg of command?.args ?? []) {
|
|
69
|
+
const name = arg.variadic ? `${arg.name}...` : arg.name;
|
|
70
|
+
parts.push(arg.required ? `<${name}>` : `[${name}]`);
|
|
71
|
+
}
|
|
72
|
+
if (command?.options?.length || !command)
|
|
73
|
+
parts.push('[options]');
|
|
74
|
+
return `Usage: ${parts.join(' ')}`;
|
|
75
|
+
}
|
|
76
|
+
function renderColumns(rows, indent = ' ') {
|
|
77
|
+
if (rows.length === 0)
|
|
78
|
+
return [];
|
|
79
|
+
const width = Math.max(...rows.map(([left]) => left.length));
|
|
80
|
+
return rows.map(([left, right]) => `${indent}${left.padEnd(width)} ${right}`);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Render help for one node of a product command tree.
|
|
84
|
+
*
|
|
85
|
+
* @param groupPath - How the user reached here, e.g. `agent-relay file ls`.
|
|
86
|
+
* @param command - The resolved spec node, or undefined for the group root.
|
|
87
|
+
* @param roots - The surface's top-level commands, used at the group root.
|
|
88
|
+
* @returns The help text, newline-terminated.
|
|
89
|
+
*/
|
|
90
|
+
export function renderSurfaceHelp(groupPath, command, roots) {
|
|
91
|
+
const lines = [renderUsage(groupPath, command), ''];
|
|
92
|
+
if (command?.description)
|
|
93
|
+
lines.push(command.description, '');
|
|
94
|
+
if (command?.deprecated) {
|
|
95
|
+
lines.push(`Deprecated. Use \`${command.deprecated.replacement}\` instead.`, '');
|
|
96
|
+
}
|
|
97
|
+
const args = command?.args ?? [];
|
|
98
|
+
if (args.length > 0) {
|
|
99
|
+
lines.push('Arguments:');
|
|
100
|
+
lines.push(...renderColumns(args.map((arg) => [arg.variadic ? `${arg.name}...` : arg.name, arg.description])));
|
|
101
|
+
lines.push('');
|
|
102
|
+
}
|
|
103
|
+
const options = command?.options ?? [];
|
|
104
|
+
if (options.length > 0) {
|
|
105
|
+
lines.push('Options:');
|
|
106
|
+
lines.push(...renderColumns(options.map((option) => [
|
|
107
|
+
option.flags,
|
|
108
|
+
option.defaultValue === undefined
|
|
109
|
+
? option.description
|
|
110
|
+
: `${option.description} (default: ${JSON.stringify(option.defaultValue)})`,
|
|
111
|
+
])));
|
|
112
|
+
lines.push('');
|
|
113
|
+
}
|
|
114
|
+
const children = (command?.subcommands ?? roots).filter((child) => !child.hidden);
|
|
115
|
+
if (children.length > 0) {
|
|
116
|
+
lines.push('Commands:');
|
|
117
|
+
lines.push(...renderColumns(children.map((child) => [child.name, child.deprecated ? `${child.description} (deprecated)` : child.description])));
|
|
118
|
+
lines.push('');
|
|
119
|
+
}
|
|
120
|
+
return `${lines.join('\n').trimEnd()}\n`;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Run one invocation against a loaded surface.
|
|
124
|
+
*
|
|
125
|
+
* Exported for tests and for the hidden-alias path; `mountRelayCliSurface` is
|
|
126
|
+
* the normal entry point.
|
|
127
|
+
*
|
|
128
|
+
* @param surface - The product surface.
|
|
129
|
+
* @param groupPath - Display path for help and notices, e.g. `agent-relay file`.
|
|
130
|
+
* @param argv - Tokens after the group name.
|
|
131
|
+
* @param deps - Output sink and exit function.
|
|
132
|
+
* @returns The exit code the host should use.
|
|
133
|
+
*/
|
|
134
|
+
export async function runSurface(surface, groupPath, argv, deps) {
|
|
135
|
+
const resolved = resolveSpecPath(surface.commands, argv);
|
|
136
|
+
const wantsHelp = argv.length === 0 || argv.some(isHelpFlag);
|
|
137
|
+
if (wantsHelp) {
|
|
138
|
+
// `--help` after a partially-matched path still documents the deepest node
|
|
139
|
+
// we recognised, which is what the user was asking about.
|
|
140
|
+
deps.io.stdout(renderSurfaceHelp([groupPath, ...resolved.path].join(' '), resolved.command, surface.commands));
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
if (!resolved.command) {
|
|
144
|
+
const unknown = resolved.rest[0] ?? argv[0] ?? '';
|
|
145
|
+
const available = surface.commands
|
|
146
|
+
.filter((command) => !command.hidden)
|
|
147
|
+
.map((command) => command.name)
|
|
148
|
+
.join(', ');
|
|
149
|
+
deps.io.stderr(`error: unknown command '${unknown}' for \`${groupPath}\`\n` +
|
|
150
|
+
`Available commands: ${available}\n` +
|
|
151
|
+
`Run \`${groupPath} --help\` for usage.\n`);
|
|
152
|
+
return EXIT_UNKNOWN_COMMAND;
|
|
153
|
+
}
|
|
154
|
+
if (resolved.command.deprecated) {
|
|
155
|
+
const { replacement, since } = resolved.command.deprecated;
|
|
156
|
+
deps.io.stderr(`warning: \`${[groupPath, ...resolved.path].join(' ')}\` is deprecated` +
|
|
157
|
+
`${since ? ` since ${since}` : ''}. Use \`${replacement}\` instead.\n`);
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
return await surface.run(argv, deps.io);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
// A product throwing instead of returning a code is a contract violation,
|
|
164
|
+
// but it must not surface as an unhandled rejection from the host.
|
|
165
|
+
deps.io.stderr(`${describeError(error)}\n`);
|
|
166
|
+
return 1;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Mount a product CLI as a group on the `agent-relay` program.
|
|
171
|
+
*
|
|
172
|
+
* @param program - The root commander program.
|
|
173
|
+
* @param options - Group name, description, and the lazy surface loader.
|
|
174
|
+
* @param overrides - Test seams for io and exit.
|
|
175
|
+
*/
|
|
176
|
+
export function mountRelayCliSurface(program, options, overrides = {}) {
|
|
177
|
+
const deps = withDefaults(overrides);
|
|
178
|
+
renderGroupTermsWithoutArgv(program);
|
|
179
|
+
const attach = (name, hidden) => {
|
|
180
|
+
program
|
|
181
|
+
.command(name, { hidden })
|
|
182
|
+
.description(options.description)
|
|
183
|
+
// The product owns its flags; commander must not reject or consume them.
|
|
184
|
+
.allowUnknownOption(true)
|
|
185
|
+
.allowExcessArguments(true)
|
|
186
|
+
// Without this, `agent-relay file --json` is parsed as a root-level flag.
|
|
187
|
+
.enablePositionalOptions()
|
|
188
|
+
.passThroughOptions()
|
|
189
|
+
// Help is rendered from the surface spec, so commander must not intercept.
|
|
190
|
+
.helpOption(false)
|
|
191
|
+
.argument('[args...]', `Arguments passed through to ${options.as}`)
|
|
192
|
+
.action(async (args) => {
|
|
193
|
+
let surface;
|
|
194
|
+
try {
|
|
195
|
+
surface = await options.load();
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
// Loading fails when the product package is missing or too old. The
|
|
199
|
+
// loader's message names the fix, so it must reach stderr as a plain
|
|
200
|
+
// line rather than escaping the action as an unhandled rejection.
|
|
201
|
+
deps.io.stderr(`${describeError(error)}\n`);
|
|
202
|
+
deps.exit(1);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const code = await runSurface(surface, `agent-relay ${options.as}`, args, deps);
|
|
206
|
+
if (code !== 0)
|
|
207
|
+
deps.exit(code);
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
mountedGroups.get(program).add(options.as);
|
|
211
|
+
attach(options.as, false);
|
|
212
|
+
for (const alias of options.hiddenAliases ?? [])
|
|
213
|
+
attach(alias, true);
|
|
214
|
+
}
|
|
215
|
+
/** Group names mounted on each program, so help can render them bare. */
|
|
216
|
+
const mountedGroups = new WeakMap();
|
|
217
|
+
/**
|
|
218
|
+
* Render mounted groups in the parent's help as a bare name.
|
|
219
|
+
*
|
|
220
|
+
* Commander derives a subcommand's help term from its registered arguments, so
|
|
221
|
+
* the catch-all that carries product argv would surface to users as
|
|
222
|
+
* `file [args...]`. The placeholder is an implementation detail of the mount;
|
|
223
|
+
* what a reader needs is `file`, with the real commands one level down.
|
|
224
|
+
*
|
|
225
|
+
* Installed once per program and consulted per render, so several mounts share it.
|
|
226
|
+
*/
|
|
227
|
+
function renderGroupTermsWithoutArgv(program) {
|
|
228
|
+
if (mountedGroups.has(program))
|
|
229
|
+
return;
|
|
230
|
+
const groups = new Set();
|
|
231
|
+
mountedGroups.set(program, groups);
|
|
232
|
+
const base = new Help();
|
|
233
|
+
program.configureHelp({
|
|
234
|
+
subcommandTerm: (cmd) => (groups.has(cmd.name()) ? cmd.name() : base.subcommandTerm(cmd)),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=relay-cli-surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-cli-surface.js","sourceRoot":"","sources":["../../../src/cli/lib/relay-cli-surface.ts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