Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Override default runner options. All fields are optional:
| `samplingStrategy` | `random` | `random`, `deterministic`, `curated`, or `none` |
| `maxConcurrency` | `3` | Maximum concurrent HTTP requests |
| `requestDelay` | `200` | Delay between requests in milliseconds |
| `requestTimeout` | `30000` | Timeout for individual HTTP requests in milliseconds |
| `requestTimeout` | `15000` | Timeout for individual HTTP requests in milliseconds |
| `preferredLocale` | auto-detect | Preferred locale for URL discovery (e.g. `en`, `fr`, `ja`, `zh-Hans`) |
| `preferredVersion` | auto-detect | Preferred version for URL discovery (e.g. `v3`, `2.x`) |
| `canonicalOrigin` | | The production base URL (origin, or origin plus a path prefix) your content links to |
Expand Down
3 changes: 3 additions & 0 deletions src/cli/commands/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ export function registerCheckCommand(program: Command): void {
String((opts.requestDelay as string | undefined) ?? config?.options?.requestDelay ?? 200),
10,
);
// Config-only: there is no CLI flag for the request timeout.
const requestTimeout = config?.options?.requestTimeout;
const maxLinksToTest = parseInt(
String((opts.maxLinks as string | undefined) ?? config?.options?.maxLinksToTest ?? 50),
10,
Expand Down Expand Up @@ -358,6 +360,7 @@ export function registerCheckCommand(program: Command): void {
skipCheckIds,
maxConcurrency,
requestDelay,
...(requestTimeout != null && { requestTimeout }),
maxLinksToTest,
samplingStrategy: sampling,
curatedPages,
Expand Down
35 changes: 35 additions & 0 deletions test/unit/cli/check-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,41 @@ describe('check command config integration', () => {
stdoutSpy.mockRestore();
});

it('passes requestTimeout from config to the runner', async () => {
server.use(
http.get('http://cmd-timeout-cfg.local/llms.txt', () => HttpResponse.text(VALID_LLMS_TXT)),
http.get(
'http://cmd-timeout-cfg.local/docs/llms.txt',
() => new HttpResponse(null, { status: 404 }),
),
);

const configPath = resolve(CONFIG_TMP, 'agent-docs.config.yml');
await writeFile(
configPath,
[
'url: http://cmd-timeout-cfg.local',
'checks:',
' - llms-txt-exists',
'options:',
' requestDelay: 0',
' requestTimeout: 45000',
'',
].join('\n'),
);

const spy = vi.spyOn(validationMod, 'validateRunnerOptions');
const stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
const { run } = await import('../../../src/cli/index.js');

await run(['node', 'afdocs', 'check', '--config', configPath]);
await new Promise((r) => setTimeout(r, 100));
expect(spy.mock.calls.at(-1)?.[0]?.requestTimeout).toBe(45000);

spy.mockRestore();
stdoutSpy.mockRestore();
});

it('displays validation warnings on stderr', async () => {
server.use(
http.get('http://cmd-warn.local/llms.txt', () => HttpResponse.text(VALID_LLMS_TXT)),
Expand Down