Skip to content

Commit cb452c0

Browse files
committed
perf: thin command metadata paths
1 parent 83b982b commit cb452c0

64 files changed

Lines changed: 1275 additions & 1089 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/__tests__/cli-client-commands.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ test('apps command defaults to user-installed and prints discovery hint', async
567567
help: false,
568568
version: false,
569569
platform: 'android',
570+
appsFilter: 'user-installed',
570571
},
571572
client,
572573
});

src/__tests__/cli-grammar.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { test } from 'vitest';
22
import assert from 'node:assert/strict';
33
import { DAEMON_COMMAND_GROUPS, PUBLIC_COMMANDS } from '../command-catalog.ts';
44
import { readInputFromCli } from '../commands/cli-grammar.ts';
5-
import type { CliFlags } from '../utils/command-schema.ts';
5+
import type { CliFlags } from '../utils/cli-flags.ts';
66

77
const BASE_FLAGS: CliFlags = {
88
json: false,

src/batch-contract.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const DEFAULT_BATCH_MAX_STEPS = 100;

src/bin.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if (runFastPath(argv)) {
1111
}
1212

1313
function runFastPath(argv: string[]): boolean {
14-
return runVersionFastPath(argv) || runHelpFastPath(argv);
14+
return runVersionFastPath(argv) || runNoCommandFastPath(argv) || runHelpFastPath(argv);
1515
}
1616

1717
function runVersionFastPath(argv: string[]): boolean {
@@ -24,6 +24,17 @@ function runVersionFastPath(argv: string[]): boolean {
2424
return true;
2525
}
2626

27+
function runNoCommandFastPath(argv: string[]): boolean {
28+
if (argv.length !== 0) return false;
29+
import('./utils/args.ts')
30+
.then(({ usage }) => {
31+
process.stdout.write(`${usage()}\n`);
32+
process.exit(1);
33+
})
34+
.catch(handleStartupError);
35+
return true;
36+
}
37+
2738
function runHelpFastPath(argv: string[]): boolean {
2839
const helpTarget = resolveSimpleHelpTarget(argv);
2940
if (helpTarget === undefined) return false;

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { resolveCliOptions } from './utils/cli-options.ts';
2828
import { maybeRunUpgradeNotifier } from './utils/update-check.ts';
2929
import { resolveRemoteConnectionDefaults } from './remote-connection-state.ts';
3030
import { resolveRemoteAuthForCli } from './cli/auth-session.ts';
31-
import type { CliFlags, FlagKey } from './utils/command-schema.ts';
31+
import type { CliFlags, FlagKey } from './utils/cli-flags.ts';
3232
import type { SessionRuntimeHints } from './contracts.ts';
3333

3434
type CliDeps = {

src/cli/auth-session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'node:fs';
22
import path from 'node:path';
33
import { runCmd } from '../utils/exec.ts';
44
import { AppError } from '../utils/errors.ts';
5-
import type { CliFlags } from '../utils/command-schema.ts';
5+
import type { CliFlags } from '../utils/cli-flags.ts';
66

77
const DEFAULT_CLOUD_BASE_URL = 'https://cloud.agent-device.dev';
88
const DEVICE_AUTH_START_PATH = '/api/control-plane/device-auth/start';

src/cli/batch-steps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { BatchStep } from '../client-types.ts';
22
import { readInputFromCli } from '../commands/cli-grammar.ts';
3-
import { isCommandName, type CommandName } from '../commands/command-surface.ts';
4-
import type { CliFlags } from '../utils/command-schema.ts';
3+
import { isCommandName, type CommandName } from '../commands/command-metadata.ts';
4+
import type { CliFlags } from '../utils/cli-flags.ts';
55
import { AppError } from '../utils/errors.ts';
66

77
type LegacyCliBatchStep = {

src/cli/cloud-connection-profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { resolveRemoteConfigProfile } from '../remote-config.ts';
55
import type { RemoteConfigProfile, ResolvedRemoteConfigProfile } from '../remote-config-schema.ts';
66
import { profileToCliFlags } from '../utils/remote-config.ts';
77
import { AppError, asAppError } from '../utils/errors.ts';
8-
import type { CliFlags } from '../utils/command-schema.ts';
8+
import type { CliFlags } from '../utils/cli-flags.ts';
99
import { resolveCloudAccessForConnect } from './auth-session.ts';
1010

1111
const CONNECTION_PROFILE_PATH = '/api/control-plane/connection-profile';

src/cli/commands/connection-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { profileToCliFlags } from '../../utils/remote-config.ts';
1414
import type { BatchStep } from '../../client-types.ts';
1515
import { AppError } from '../../utils/errors.ts';
1616
import type { LeaseBackend, SessionRuntimeHints } from '../../contracts.ts';
17-
import type { CliFlags } from '../../utils/command-schema.ts';
17+
import type { CliFlags } from '../../utils/cli-flags.ts';
1818
import type { AgentDeviceClient, Lease } from '../../client.ts';
1919

2020
const leaseDeferredCommands = new Set([

src/cli/commands/connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
} from './connection-runtime.ts';
2323
import { writeCommandOutput } from './shared.ts';
2424
import type { LeaseBackend } from '../../contracts.ts';
25-
import type { CliFlags } from '../../utils/command-schema.ts';
25+
import type { CliFlags } from '../../utils/cli-flags.ts';
2626
import type { ClientCommandHandler } from './router-types.ts';
2727

2828
export const connectCommand: ClientCommandHandler = async ({ flags, client }) => {

0 commit comments

Comments
 (0)