chore(lint): burn down remaining warnings to zero
This commit is contained in:
@@ -31,10 +31,16 @@ describe('sessions command', () => {
|
||||
|
||||
const telegramSession = sessions.find(s => s.id === 'telegram:123');
|
||||
expect(telegramSession).toBeDefined();
|
||||
expect(telegramSession!.messageCount).toBe(2);
|
||||
if (!telegramSession) {
|
||||
throw new Error('Expected telegram session');
|
||||
}
|
||||
expect(telegramSession.messageCount).toBe(2);
|
||||
|
||||
const tuiSession = sessions.find(s => s.id === 'tui:local');
|
||||
expect(tuiSession).toBeDefined();
|
||||
expect(tuiSession!.messageCount).toBe(1);
|
||||
if (!tuiSession) {
|
||||
throw new Error('Expected tui session');
|
||||
}
|
||||
expect(tuiSession.messageCount).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -110,8 +110,8 @@ export async function setupAutomation(p: Prompter, builder: ConfigBuilder): Prom
|
||||
* Run OAuth auth flows for enabled Google services.
|
||||
* Called after config is saved so the auth commands can read it.
|
||||
*/
|
||||
export async function runGoogleAuth(p: Prompter, config: Record<string, any>): Promise<void> {
|
||||
const automation = config.automation as Record<string, any> | undefined;
|
||||
export async function runGoogleAuth(p: Prompter, config: Record<string, unknown>): Promise<void> {
|
||||
const automation = config.automation as Record<string, unknown> | undefined;
|
||||
if (!automation) {return;}
|
||||
|
||||
const pending: { name: string; authCmd: string }[] = [];
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { EventEmitter } from 'events';
|
||||
import type { Interface as ReadlineInterface } from 'readline/promises';
|
||||
import { createPrompter } from './prompts.js';
|
||||
import { ConfigBuilder } from './config.js';
|
||||
import { setupChannels } from './channels.js';
|
||||
|
||||
function mockReadline(inputs: string[]) {
|
||||
let questionIdx = 0;
|
||||
const emitter = new EventEmitter();
|
||||
|
||||
return {
|
||||
async question(query: string) {
|
||||
async question(_query: string) {
|
||||
const answer = inputs[questionIdx++];
|
||||
return answer ?? '';
|
||||
},
|
||||
@@ -25,7 +24,7 @@ function mockReadline(inputs: string[]) {
|
||||
async next() {
|
||||
return { done: true };
|
||||
},
|
||||
} as any;
|
||||
} as unknown as ReadlineInterface;
|
||||
}
|
||||
|
||||
describe('setupChannels', () => {
|
||||
|
||||
@@ -155,8 +155,8 @@ export class ConfigBuilder {
|
||||
this.config.automation = automation;
|
||||
}
|
||||
|
||||
build(): Record<string, any> {
|
||||
return structuredClone(this.config) as Record<string, any>;
|
||||
build(): Record<string, unknown> {
|
||||
return structuredClone(this.config) as Record<string, unknown>;
|
||||
}
|
||||
|
||||
toYaml(): string {
|
||||
|
||||
@@ -14,7 +14,7 @@ function mockReadline(inputs: string[]): ReadlineInterface {
|
||||
throw new Error('No more inputs');
|
||||
}),
|
||||
close: vi.fn(),
|
||||
} as any as ReadlineInterface;
|
||||
} as unknown as ReadlineInterface;
|
||||
}
|
||||
|
||||
describe('first-run wizard integration', () => {
|
||||
|
||||
@@ -39,8 +39,8 @@ export async function setupMemory(p: Prompter, builder: ConfigBuilder): Promise<
|
||||
p.println('✓ Vector search enabled');
|
||||
}
|
||||
|
||||
function findReusableApiKey(config: Record<string, any>, embeddingProvider: string): string | undefined {
|
||||
const models = config.models ?? {};
|
||||
function findReusableApiKey(config: Record<string, unknown>, embeddingProvider: string): string | undefined {
|
||||
const models = (config.models as Record<string, { provider?: string; api_key?: string }>) ?? {};
|
||||
for (const tier of ['default', 'fast', 'complex', 'local']) {
|
||||
const m = models[tier];
|
||||
if (m?.provider === embeddingProvider && m?.api_key) {return m.api_key;}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { describe, it } from 'vitest';
|
||||
import { createInterface } from 'readline/promises';
|
||||
import { Readable, Writable } from 'stream';
|
||||
import { createPrompter } from './prompts.js';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import type { Interface as ReadlineInterface } from 'readline/promises';
|
||||
import { createPrompter } from './prompts.js';
|
||||
import { ConfigBuilder } from './config.js';
|
||||
import { setupMemory } from './memory.js';
|
||||
@@ -9,7 +10,7 @@ function mockReadline(inputs: string[]) {
|
||||
let questionIdx = 0;
|
||||
|
||||
return {
|
||||
async question(query: string) {
|
||||
async question(_query: string) {
|
||||
const answer = inputs[questionIdx++];
|
||||
return answer ?? '';
|
||||
},
|
||||
@@ -25,7 +26,7 @@ function mockReadline(inputs: string[]) {
|
||||
async next() {
|
||||
return { done: true };
|
||||
},
|
||||
} as any;
|
||||
} as unknown as ReadlineInterface;
|
||||
}
|
||||
|
||||
describe('setupMemory', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export function renderSummary(config: Record<string, any>): string {
|
||||
export function renderSummary(config: Record<string, unknown>): string {
|
||||
const lines: string[] = [];
|
||||
|
||||
const models = config.models ?? {};
|
||||
|
||||
+10
-2
@@ -50,7 +50,11 @@ models:
|
||||
const result = loadConfigSafe(configPath);
|
||||
expect(result.config).toBeDefined();
|
||||
expect(result.error).toBeUndefined();
|
||||
expect(result.config!.telegram?.bot_token).toBe('test-token');
|
||||
const config = result.config;
|
||||
if (!config) {
|
||||
throw new Error('Expected loaded config');
|
||||
}
|
||||
expect(config.telegram?.bot_token).toBe('test-token');
|
||||
});
|
||||
|
||||
it('loads env vars from FLYNN_ENV_FILE before parsing config', () => {
|
||||
@@ -78,7 +82,11 @@ models:
|
||||
const result = loadConfigSafe(configPath);
|
||||
expect(result.config).toBeDefined();
|
||||
expect(result.error).toBeUndefined();
|
||||
expect(result.config!.telegram?.bot_token).toBe('test-token');
|
||||
const config = result.config;
|
||||
if (!config) {
|
||||
throw new Error('Expected loaded config');
|
||||
}
|
||||
expect(config.telegram?.bot_token).toBe('test-token');
|
||||
|
||||
if (prevEnvFile !== undefined) {
|
||||
process.env.FLYNN_ENV_FILE = prevEnvFile;
|
||||
|
||||
Reference in New Issue
Block a user