MCPcopy Index your code
hub / github.com/callstack/agent-device / applyCommandDefaults

Function applyCommandDefaults

src/utils/command-schema.ts:49–63  ·  view source on GitHub ↗
(
  command: string | null,
  flags: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

47}
48
49export function applyCommandDefaults(
50 command: string | null,
51 flags: Record<string, unknown>,
52): boolean {
53 const commandSchema = getCommandSchema(command);
54 if (!commandSchema?.defaults) return false;
55 let changed = false;
56 for (const [key, value] of Object.entries(commandSchema.defaults) as Array<[FlagKey, unknown]>) {
57 if (flags[key] === undefined) {
58 flags[key] = value;
59 changed = true;
60 }
61 }
62 return changed;
63}

Callers 2

finalizeParsedArgsFunction · 0.90

Calls 1

getCommandSchemaFunction · 0.85

Tested by

no test coverage detected