fix(coding-agent): bootstrap profiles for acp

This commit is contained in:
Ogrodev
2026-06-02 22:30:23 -03:00
parent 90d4dd66de
commit c5011661db
4 changed files with 48 additions and 9 deletions
@@ -178,6 +178,32 @@ describe("global --profile flag", () => {
expect(output).not.toContain(`${APP_NAME}/${VERSION}`);
});
it("installs a shell alias when acp is explicit", async () => {
const installSpy = vi.spyOn(profileAliasCli, "installProfileAlias").mockResolvedValue({
shell: "bash",
configPath: "/home/me/.bashrc",
aliasName: "omp-work",
profile: "work",
command: "omp --profile=work",
reloadedWith: ". '/home/me/.bashrc'",
});
const outSpy = vi.spyOn(process.stdout, "write").mockImplementation(() => true);
await runCli(["acp", "--profile", "work", "--alias", "omp-work", "--version"]);
expect(process.exitCode).toBe(0);
expect(installSpy).toHaveBeenCalledWith(
expect.objectContaining({
profile: "work",
aliasName: "omp-work",
}),
);
expect(getActiveProfile()).toBe("work");
const output = outSpy.mock.calls.map(call => String(call[0] ?? "")).join("\n");
expect(output).toContain("Created omp-work");
expect(output).not.toContain(`${APP_NAME}/${VERSION}`);
});
it("rejects missing profile values without dispatching", async () => {
const errSpy = vi.spyOn(process.stderr, "write").mockImplementation(() => true);
const outSpy = vi.spyOn(process.stdout, "write").mockImplementation(() => true);