Skip to content

Commit eb14415

Browse files
committed
feat: enrich help text
1 parent dfc1425 commit eb14415

File tree

8 files changed

+50
-2
lines changed

8 files changed

+50
-2
lines changed

packages/use-agently/src/cli.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,32 @@ cli.addCommand(initCommand.helpGroup("Lifecycle"));
5151
cli.addCommand(walletCommand.helpGroup("Lifecycle"));
5252
cli.addCommand(updateCommand.helpGroup("Lifecycle"));
5353

54+
cli.addHelpText(
55+
"after",
56+
`
57+
Protocol Quick Reference:
58+
59+
a2a send -u <uri> -m <message> [--pay] Send a message via A2A
60+
a2a card -u <uri> Fetch an agent's A2A card
61+
62+
mcp tools -u <uri> List tools on an MCP server
63+
mcp call -u <uri> --tool <name> [--args <json>] [--pay]
64+
Call a tool on an MCP server
65+
66+
web get|post|put|patch|delete <url> [options]
67+
[-d <body>] [-H <header>] [-v] [--pay]
68+
HTTP requests with x402 support
69+
70+
wallet spend View current spend limit
71+
wallet spend set-max <value> Set max USD spend per call (0–1)
72+
73+
<uri> can be an HTTP URL or a CAIP-19 ID (e.g. eip155:8453/erc8004:0x…/1)
74+
75+
Getting started: use-agently init → use-agently doctor → use-agently search
76+
77+
Run "use-agently <command> -h" for full option details.`,
78+
);
79+
5480
// Propagate showGlobalOptions to all subcommands added via addCommand(),
5581
// which does not inherit configureHelp from the parent.
5682
function enableGlobalOptionsInHelp(cmd: Command) {

packages/use-agently/src/commands/a2a.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ async function resolveTransactionMode(pay?: boolean): Promise<{ client: unstable
3636

3737
export const a2aCommand = new Command("a2a")
3838
.description("Send messages and fetch agent cards via the A2A protocol")
39+
.addHelpText(
40+
"after",
41+
'\nExamples:\n use-agently a2a send --uri <uri> -m "Hello!"\n use-agently a2a card --uri <uri>',
42+
)
3943
.action(function () {
4044
(this as Command).outputHelp();
4145
});

packages/use-agently/src/commands/balance.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const balanceCommand = new Command("balance")
77
.description("Check wallet balance on-chain")
88
.option("--rpc <url>", "Custom RPC URL")
99
.showHelpAfterError(true)
10+
.addHelpText("after", "\nExamples:\n use-agently balance")
1011
.action(async (options: { rpc?: string }, command: Command) => {
1112
const config = await getConfigOrThrow();
1213
const wallet = loadWallet(config.wallet);

packages/use-agently/src/commands/doctor.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ export const doctorCommand = new Command("doctor")
1515
.description("Run environment checks and report any issues")
1616
.option("--rpc <url>", "Custom RPC URL to use for network check")
1717
.showHelpAfterError(true)
18-
.addHelpText("after", "\nConfig: ~/.use-agently/config.json (global), .use-agently/config.json (local)")
18+
.addHelpText(
19+
"after",
20+
"\nExamples:\n use-agently doctor\n\nConfig: ~/.use-agently/config.json (global), .use-agently/config.json (local)",
21+
)
1922
.action(async (options: { rpc?: string }, command: Command) => {
2023
const checks: Check[] = [];
2124

packages/use-agently/src/commands/mcp.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ function checkSpendLimit(err: DryRunPaymentRequired, maxSpendPerCall: number): v
3939

4040
export const mcpCommand = new Command("mcp")
4141
.description("Discover and call tools on MCP servers (always list tools before calling)")
42+
.addHelpText(
43+
"after",
44+
'\nExamples:\n use-agently mcp tools --uri <uri>\n use-agently mcp call --uri <uri> --tool <name> --args \'{"key":"value"}\'',
45+
)
4246
.action(function () {
4347
(this as Command).outputHelp();
4448
});

packages/use-agently/src/commands/wallet.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { output } from "../output";
44

55
export const walletCommand = new Command("wallet")
66
.description("Manage wallet settings (spend limits)")
7+
.addHelpText("after", "\nExamples:\n use-agently wallet spend\n use-agently wallet spend set-max 0.5")
78
.action(function () {
89
(this as Command).outputHelp();
910
});

packages/use-agently/src/commands/web.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,11 @@ function createMethodSubcommand(method: string, description: string, hasBody: bo
332332
addSharedOptions(cmd, hasBody);
333333

334334
const bodyExample = hasBody ? ' -d \'{"key":"value"}\' -H "Content-Type: application/json"' : "";
335-
cmd.addHelpText("after", `\nExamples:\n use-agently web ${method} https://api.example.com/data${bodyExample} -v`);
335+
const payExample = !hasBody ? `\n use-agently web ${method} https://api.example.com/paid-endpoint --pay` : "";
336+
cmd.addHelpText(
337+
"after",
338+
`\nExamples:\n use-agently web ${method} https://api.example.com/data${bodyExample} -v${payExample}`,
339+
);
336340

337341
cmd.action(async (url: string, options: WebOptions, command: Command) => {
338342
await executeHttpRequest(method, url, options, command);
@@ -343,6 +347,10 @@ function createMethodSubcommand(method: string, description: string, hasBody: bo
343347

344348
export const webCommand = new Command("web")
345349
.description("Make HTTP requests with automatic x402 payment support (GET, POST, PUT, PATCH, DELETE)")
350+
.addHelpText(
351+
"after",
352+
'\nExamples:\n use-agently web get https://api.example.com/data\n use-agently web post https://api.example.com/data -d \'{"key":"value"}\' --pay',
353+
)
346354
.action(function () {
347355
(this as Command).outputHelp();
348356
});

packages/use-agently/src/commands/whoami.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getConfigOrThrow } from "../config";
66
export const whoamiCommand = new Command("whoami")
77
.description("Show current wallet info")
88
.showHelpAfterError(true)
9+
.addHelpText("after", "\nExamples:\n use-agently whoami")
910
.action(async (_options: Record<string, never>, command: Command) => {
1011
const config = await getConfigOrThrow();
1112
const wallet = loadWallet(config.wallet);

0 commit comments

Comments
 (0)