Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions packages/cli/src/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1190,11 +1190,12 @@ describe('production mode', () => {
expect(txnRequest).toBeUndefined();
});

it('does not show transactions in root help', async () => {
it('shows transactions in root help as beta', async () => {
const result = await runProdCli('--help');

expect(result.exitCode).toBe(0);
expect(result.stdout + result.stderr).not.toContain('transactions');
expect(result.stdout + result.stderr).toContain('[beta]');
expect(result.stdout + result.stderr).toContain('transactions');
});
});

Expand Down Expand Up @@ -1270,11 +1271,12 @@ describe('production mode', () => {
expect(sourcesRequest).toBeUndefined();
});

it('does not show sources in root help', async () => {
it('shows sources in root help as beta', async () => {
const result = await runProdCli('--help');

expect(result.exitCode).toBe(0);
expect(result.stdout + result.stderr).not.toContain('sources');
expect(result.stdout + result.stderr).toContain('[beta]');
expect(result.stdout + result.stderr).toContain('sources');
});
});

Expand Down Expand Up @@ -1349,11 +1351,12 @@ describe('production mode', () => {
expect(balancesRequest).toBeUndefined();
});

it('does not show balances in root help', async () => {
it('shows balances in root help as beta', async () => {
const result = await runProdCli('--help');

expect(result.exitCode).toBe(0);
expect(result.stdout + result.stderr).not.toContain('balances');
expect(result.stdout + result.stderr).toContain('[beta]');
expect(result.stdout + result.stderr).toContain('balances');
});
});

Expand Down
187 changes: 91 additions & 96 deletions packages/cli/src/cli.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,38 +63,14 @@ const factory = new ResourceFactory({
const authRepo = factory.createAuthResource();
const spendRequestRepo = factory.createSpendRequestResource();

const requestedCommand = process.argv[2];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

const hiddenCli =
requestedCommand === 'transactions'
? createTransactionsCli(
() => factory.createTransactionsResource(),
authStorage,
envAccessToken,
)
: requestedCommand === 'sources'
? createSourcesCli(
() => factory.createSourcesResource(),
authStorage,
envAccessToken,
)
: requestedCommand === 'balances'
? createBalancesCli(
() => factory.createBalancesResource(),
authStorage,
envAccessToken,
)
: null;
if (hiddenCli) {
process.argv.splice(2, 1);
}

const cli =
hiddenCli ??
Cli.create('link-cli', {
description:
'Create a secure, one-time payment credential from a Link wallet to let agents complete purchases on behalf of users.',
version: cliVersion,
});
const cli = Cli.create('link-cli', {
description:
'Create a secure, one-time payment credential from a Link wallet to let agents complete purchases on behalf of users.',
version: cliVersion,
sync: {
include: ['skills/*'],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the create-payment-credential was not being included in skills list either, and this change updates that. @jlau-stripe was that intentional/is this okay?

},
});

const isAgent =
process.argv.includes('--format') || process.argv.includes('--mcp');
Expand All @@ -112,70 +88,89 @@ if (!isAgent && process.stdout.isTTY) {
}
}

if (!hiddenCli) {
cli.command(
createAuthCli(authRepo, getUpdateInfo, authStorage, envAccessToken),
);
cli.command(
createSpendRequestCli(spendRequestRepo, authStorage, envAccessToken),
);
cli.command(
createPaymentMethodsCli(
() => factory.createPaymentMethodsResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createShippingAddressCli(
() => factory.createShippingAddressResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createUserInfoCli(
() => factory.createUserInfoResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createMppCli(
spendRequestRepo,
() => factory.createPaymentMethodsResource(),
authStorage,
envAccessToken,
),
);
// cli.command(
// createWebBotAuthCli(() => factory.createWebBotAuthResource(), authStorage),
// );
cli.command(
createReportCli(
() => factory.createReportResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createDemoCli(
authRepo,
spendRequestRepo,
() => factory.createPaymentMethodsResource(),
authStorage,
),
);
cli.command(
createOnboardCli(
authRepo,
spendRequestRepo,
() => factory.createPaymentMethodsResource(),
authStorage,
),
);
cli.command(createServeCli(cli));
}
cli.command(
createAuthCli(authRepo, getUpdateInfo, authStorage, envAccessToken),
);
cli.command(
createSpendRequestCli(spendRequestRepo, authStorage, envAccessToken),
);
cli.command(
createPaymentMethodsCli(
() => factory.createPaymentMethodsResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createShippingAddressCli(
() => factory.createShippingAddressResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createUserInfoCli(
() => factory.createUserInfoResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createMppCli(
spendRequestRepo,
() => factory.createPaymentMethodsResource(),
authStorage,
envAccessToken,
),
);
// cli.command(
// createWebBotAuthCli(() => factory.createWebBotAuthResource(), authStorage),
// );
cli.command(
createReportCli(
() => factory.createReportResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createBalancesCli(
() => factory.createBalancesResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createSourcesCli(
() => factory.createSourcesResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createTransactionsCli(
() => factory.createTransactionsResource(),
authStorage,
envAccessToken,
),
);
cli.command(
createDemoCli(
authRepo,
spendRequestRepo,
() => factory.createPaymentMethodsResource(),
authStorage,
),
);
cli.command(
createOnboardCli(
authRepo,
spendRequestRepo,
() => factory.createPaymentMethodsResource(),
authStorage,
),
);
cli.command(createServeCli(cli));

cli.serve();

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/balances/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function createBalancesCli(
envAccessToken?: string,
) {
const cli = Cli.create('balances', {
description: 'List balances from your Link wallet',
description: '[beta] List balances from your Link wallet',
});

cli.command('list', {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/sources/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function createSourcesCli(
envAccessToken?: string,
) {
const cli = Cli.create('sources', {
description: 'List sources from your Link wallet',
description: '[beta] List sources from your Link wallet',
});

cli.command('list', {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/transactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function createTransactionsCli(
envAccessToken?: string,
) {
const cli = Cli.create('transactions', {
description: 'List transactions from Link and external accounts',
description: '[beta] List transactions from Link and external accounts',
});

cli.command('list', {
Expand Down
4 changes: 4 additions & 0 deletions scripts/sync-skill-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ syncSkillVersion(
'SKILL.md',
resolve(root, 'skills/create-payment-credential/SKILL.md'),
);
syncSkillVersion(
'financial-insights/SKILL.md',
resolve(root, 'skills/financial-insights/SKILL.md'),
);
syncPluginJsonVersion(
'.cursor-plugin/plugin.json',
resolve(root, 'plugins/link/.cursor-plugin/plugin.json'),
Expand Down
Loading
Loading