Check for API key existence when selecting agent in dashboard (#115)

* add api key existence check when selecting agent

- create getSecretNames utility to fetch GitHub Actions secret names
- add /api/repo/[owner]/[repo]/secrets endpoint to check secrets
- update AgentSettings to fetch and display secret validation status
- show green check when required API key exists
- show amber warning when required API key is missing
- show loading state while checking secrets

* Add API key checking

* Fix null agent test

* Tweaks

* Switch to getrepoorgsecretes

---------

Co-authored-by: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.com>
Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
This commit is contained in:
pullfrog[bot]
2026-01-19 23:18:44 +00:00
committed by pullfrog[bot]
parent 8f6912deda
commit 159e937d0d
+36 -42
View File
@@ -1,51 +1,45 @@
import { Inputs } from './payload.ts'; import { Inputs } from "./payload.ts";
describe('Inputs schema', () => { describe("Inputs schema", () => {
it('only prompt is required', () => { it("only prompt is required", () => {
const result = Inputs.assert({prompt: 'test prompt'}); const result = Inputs.assert({ prompt: "test prompt" });
expect(result).toEqual({prompt: 'test prompt'}); expect(result).toEqual({ prompt: "test prompt" });
expect(() => Inputs.assert({})).toThrow(); expect(() => Inputs.assert({})).toThrow();
}); });
it.each([ it.each([
['web', 'enabled'], ["web", "enabled"],
['web', 'disabled'], ["web", "disabled"],
['web', undefined], ["web", undefined],
['search', 'enabled'], ["search", "enabled"],
['search', 'disabled'], ["search", "disabled"],
['search', undefined], ["search", undefined],
['write', 'enabled'], ["write", "enabled"],
['write', 'disabled'], ["write", "disabled"],
['write', undefined], ["write", undefined],
['bash', 'enabled'], ["bash", "enabled"],
['bash', 'restricted'], ["bash", "restricted"],
['bash', 'disabled'], ["bash", "disabled"],
['bash', undefined], ["bash", undefined],
['effort', 'mini'], ["effort", "mini"],
['effort', 'auto'], ["effort", "auto"],
['effort', 'max'], ["effort", "max"],
['agent', 'claude'], ["agent", "claude"],
['agent', 'codex'], ["agent", "codex"],
['agent', 'cursor'], ["agent", "cursor"],
['agent', 'gemini'], ["agent", "gemini"],
['agent', 'opencode'], ["agent", "opencode"],
['agent', null], // ['agent', null],
] as const)('should accept %s for %s', (prop, value) => { ] as const)("should accept %s for %s", (prop, value) => {
const input = {prompt: 'test', [prop]: value}; const input = { prompt: "test", [prop]: value };
expect(() => Inputs.assert(input)).not.toThrow(); expect(() => Inputs.assert(input)).not.toThrow();
}); });
it.each([["web"], ["search"], ["write"], ["bash"], ["effort"], ["agent"]] as const)(
it.each([ "should reject invalid %s values",
['web'], (prop) => {
['search'], const input = { prompt: "test", [prop]: "invalid" as any };
['write'], expect(() => Inputs.assert(input)).toThrow();
['bash'], }
['effort'], );
['agent'],
] as const)('should reject invalid %s values', (prop) => {
const input = {prompt: 'test', [prop]: 'invalid' as any};
expect(() => Inputs.assert(input)).toThrow();
});
}); });