( id: string | undefined, options: StoreSetupOptions )
| 253 | } |
| 254 | |
| 255 | async 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 | |
| 295 | async function prepareSetupInput( |
| 296 | input: ResolvedStoreSetupInput, |
no test coverage detected