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

Function runInstallCommand

src/commands/management/runtime/admin.ts:147–178  ·  view source on GitHub ↗
(
  runtime: AgentDeviceRuntime,
  options:
    | AdminInstallCommandOptions
    | AdminReinstallCommandOptions
    | AdminInstallFromSourceCommandOptions,
  mode: 'install' | 'reinstall' | 'installFromSource',
)

Source from the content-addressed store, hash-verified

145 await runInstallCommand(runtime, options, 'installFromSource');
146
147async function runInstallCommand(
148 runtime: AgentDeviceRuntime,
149 options:
150 | AdminInstallCommandOptions
151 | AdminReinstallCommandOptions
152 | AdminInstallFromSourceCommandOptions,
153 mode: 'install' | 'reinstall' | 'installFromSource',
154): Promise<AdminInstallCommandResult> {
155 const methodName = mode === 'reinstall' ? 'reinstallApp' : 'installApp';
156 const method = runtime.backend[methodName];
157 if (!method) {
158 throw new AppError('UNSUPPORTED_OPERATION', `admin.${mode} is not supported by this backend`);
159 }
160
161 const app =
162 'app' in options && options.app !== undefined ? requireText(options.app, 'app') : undefined;
163 if (mode !== 'installFromSource' && !app) {
164 throw new AppError('INVALID_ARGS', `admin.${mode} requires app`);
165 }
166
167 const context = toBackendContext(runtime, options);
168 const resolved = await resolveInstallSource(runtime, context, options.source);
169 try {
170 const result = await method.call(runtime.backend, context, {
171 ...(app ? { app } : {}),
172 source: resolved.source,
173 });
174 return formatInstallResult(mode, app, resolved.source, result);
175 } finally {
176 await resolved.cleanup?.();
177 }
178}
179
180async function resolveInstallSource(
181 runtime: AgentDeviceRuntime,

Callers 3

installCommandFunction · 0.85
reinstallCommandFunction · 0.85
installFromSourceCommandFunction · 0.85

Calls 4

requireTextFunction · 0.90
toBackendContextFunction · 0.90
formatInstallResultFunction · 0.85
resolveInstallSourceFunction · 0.70

Tested by

no test coverage detected