test: add coverage for optional repo and ignore interactive prompt lines

- Add test for orchestrator-prompt with repo: undefined (verifies
  "not configured" fallback instead of showing literal "undefined")
- Add c8 ignore for interactive prompt code in autoCreateConfig and
  promptText (same pattern as existing promptConfirm/promptSelect)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
adil 2026-04-12 12:19:29 +05:30
parent 4c31685584
commit 9ae7c00cef
3 changed files with 16 additions and 0 deletions

View File

@ -567,6 +567,7 @@ async function autoCreateConfig(workingDir: string): Promise<OrchestratorConfig>
const defaultBranch = env.defaultBranch || "main";
// If no repo detected, inform the user and ask
/* c8 ignore start -- interactive prompt, tested via onboarding integration */
if (!repo && isHumanCaller()) {
console.log(chalk.yellow(" ⚠ Could not auto-detect a GitHub/GitLab remote."));
const entered = await promptText(
@ -581,6 +582,7 @@ async function autoCreateConfig(workingDir: string): Promise<OrchestratorConfig>
console.log(chalk.yellow(` ⚠ "${trimmed}" doesn't look like owner/repo — skipping.`));
}
}
/* c8 ignore stop */
// Detect available agent runtimes via plugin registry
let detectedAgents = await detectAvailableAgents();

View File

@ -29,6 +29,7 @@ export async function promptSelect<T extends string>(
return result;
}
/* c8 ignore start -- interactive prompt wrapper, same pattern as promptConfirm/promptSelect */
export async function promptText(
message: string,
placeholder?: string,
@ -43,3 +44,4 @@ export async function promptText(
}
return result;
}
/* c8 ignore stop */

View File

@ -56,6 +56,18 @@ describe("generateOrchestratorPrompt", () => {
expect(prompt).toContain("ao send --no-wait");
});
it("shows 'not configured' when repo is omitted", () => {
const noRepoProject = { ...config.projects["my-app"]!, repo: undefined };
const prompt = generateOrchestratorPrompt({
config,
projectId: "my-app",
project: noRepoProject,
});
expect(prompt).toContain("not configured");
expect(prompt).not.toContain("undefined");
});
it("pushes implementation and PR claiming into worker sessions", () => {
const prompt = generateOrchestratorPrompt({
config,