MCPcopy
hub / github.com/Fission-AI/OpenSpec / resolveSetupInput

Function resolveSetupInput

src/commands/store.ts:255–293  ·  view source on GitHub ↗
(
  id: string | undefined,
  options: StoreSetupOptions
)

Source from the content-addressed store, hash-verified

253}
254
255async function resolveSetupInput(
256 id: string | undefined,
257 options: StoreSetupOptions
258): Promise<ResolvedStoreSetupInput> {
259 const interactive = !options.json && isInteractive();
260
261 if (!id && !interactive) {
262 throw new StoreError(
263 'Pass a store name.',
264 'store_setup_id_required',
265 {
266 target: 'store.id',
267 fix: 'openspec store setup <id> --path ~/openspec/<id> --json',
268 }
269 );
270 }
271
272 if (options.path === undefined && !interactive) {
273 throw new StoreError(
274 'Pass --path with the folder where this store should live.',
275 'store_setup_path_required',
276 {
277 target: 'store.root',
278 fix: `openspec store setup ${id ?? '<id>'} --path ~/openspec/${id ?? '<id>'}`,
279 }
280 );
281 }
282
283 const resolvedId = id ? validateStoreId(id) : await promptStoreId();
284 const promptedPath = options.path === undefined
285 ? await promptStorePath(resolvedId)
286 : undefined;
287
288 return {
289 id: resolvedId,
290 path: options.path ?? promptedPath,
291 ...(options.remote !== undefined ? { remote: options.remote } : {}),
292 };
293}
294
295async function prepareSetupInput(
296 input: ResolvedStoreSetupInput,

Callers 1

setupMethod · 0.85

Calls 4

isInteractiveFunction · 0.85
validateStoreIdFunction · 0.85
promptStoreIdFunction · 0.85
promptStorePathFunction · 0.85

Tested by

no test coverage detected