(
agentName: SetupAgent,
scope: Scope,
downloadData: { files: Array<{ path: string; content: string }> }
)
| 445 | } |
| 446 | |
| 447 | async function setupCliAgent( |
| 448 | agentName: SetupAgent, |
| 449 | scope: Scope, |
| 450 | downloadData: { files: Array<{ path: string; content: string }> } |
| 451 | ): Promise<{ skillPath: string; skillStatus: string; rulePath: string; ruleStatus: string }> { |
| 452 | const agent = getAgent(agentName); |
| 453 | |
| 454 | const skillDir = |
| 455 | scope === "global" |
| 456 | ? agent.skill.dir("global") |
| 457 | : join(process.cwd(), agent.skill.dir("project")); |
| 458 | let skillStatus: string; |
| 459 | try { |
| 460 | const files = customizeSkillFilesForAgent(agentName, "find-docs", downloadData.files); |
| 461 | await installSkillFiles("find-docs", files, skillDir); |
| 462 | skillStatus = "installed"; |
| 463 | } catch (err) { |
| 464 | skillStatus = `failed: ${err instanceof Error ? err.message : String(err)}`; |
| 465 | } |
| 466 | const skillPath = join(skillDir, "find-docs"); |
| 467 | |
| 468 | let ruleStatus: string; |
| 469 | let rulePath: string; |
| 470 | try { |
| 471 | const result = await installRule(agentName, "cli", scope); |
| 472 | ruleStatus = result.status; |
| 473 | rulePath = result.path; |
| 474 | } catch (err) { |
| 475 | ruleStatus = `failed: ${err instanceof Error ? err.message : String(err)}`; |
| 476 | rulePath = ""; |
| 477 | } |
| 478 | |
| 479 | return { skillPath, skillStatus, rulePath, ruleStatus }; |
| 480 | } |
| 481 | |
| 482 | async function setupCli(options: SetupOptions): Promise<void> { |
| 483 | await resolveCliAuth(options.apiKey); |
no test coverage detected