style: auto-fix ESLint issues (curly braces and formatting)
- Add curly braces to all if/else/for/while statements - Fix indentation and trailing spaces - Auto-fixed 372 linting errors using eslint --fix - Remaining issues are warnings only (non-null assertions, explicit any types)
This commit is contained in:
@@ -74,7 +74,7 @@ export async function setupAutomation(p: Prompter, builder: ConfigBuilder): Prom
|
||||
|
||||
// Google services
|
||||
const wantGoogle = await p.confirm('Configure Google services (Gmail, Calendar, Docs, Drive, Tasks)?', false);
|
||||
if (!wantGoogle) return;
|
||||
if (!wantGoogle) {return;}
|
||||
|
||||
p.println();
|
||||
for (const line of GOOGLE_SETUP_INSTRUCTIONS) {
|
||||
@@ -112,7 +112,7 @@ export async function setupAutomation(p: Prompter, builder: ConfigBuilder): Prom
|
||||
*/
|
||||
export async function runGoogleAuth(p: Prompter, config: Record<string, any>): Promise<void> {
|
||||
const automation = config.automation as Record<string, any> | undefined;
|
||||
if (!automation) return;
|
||||
if (!automation) {return;}
|
||||
|
||||
const pending: { name: string; authCmd: string }[] = [];
|
||||
for (const svc of GOOGLE_SERVICES) {
|
||||
@@ -122,7 +122,7 @@ export async function runGoogleAuth(p: Prompter, config: Record<string, any>): P
|
||||
}
|
||||
}
|
||||
|
||||
if (pending.length === 0) return;
|
||||
if (pending.length === 0) {return;}
|
||||
|
||||
p.println();
|
||||
const runAuth = await p.confirm(`Run OAuth authentication for ${pending.map(s => s.name).join(', ')}?`, true);
|
||||
|
||||
@@ -87,10 +87,10 @@ export async function setupChannels(p: Prompter, builder: ConfigBuilder): Promis
|
||||
if (choice === 'more') {
|
||||
const moreChoice = await p.choose('Channel:', MORE_CHANNEL_OPTIONS);
|
||||
const setup = CHANNEL_SETUP[moreChoice];
|
||||
if (setup) await setup(p, builder);
|
||||
if (setup) {await setup(p, builder);}
|
||||
} else {
|
||||
const setup = CHANNEL_SETUP[choice];
|
||||
if (setup) await setup(p, builder);
|
||||
if (setup) {await setup(p, builder);}
|
||||
}
|
||||
|
||||
p.println();
|
||||
|
||||
@@ -39,9 +39,9 @@ export class ConfigBuilder {
|
||||
setProvider(tier: 'default' | 'fast' | 'complex' | 'local', cfg: ProviderConfig): void {
|
||||
const models = (this.config.models ?? {}) as Record<string, unknown>;
|
||||
const entry: Record<string, unknown> = { provider: cfg.provider, model: cfg.model };
|
||||
if (cfg.api_key) entry.api_key = cfg.api_key;
|
||||
if (cfg.auth_token) entry.auth_token = cfg.auth_token;
|
||||
if (cfg.endpoint) entry.endpoint = cfg.endpoint;
|
||||
if (cfg.api_key) {entry.api_key = cfg.api_key;}
|
||||
if (cfg.auth_token) {entry.auth_token = cfg.auth_token;}
|
||||
if (cfg.endpoint) {entry.endpoint = cfg.endpoint;}
|
||||
models[tier] = entry;
|
||||
this.config.models = models;
|
||||
}
|
||||
@@ -91,8 +91,8 @@ export class ConfigBuilder {
|
||||
setMemoryEmbedding(cfg: EmbeddingConfig): void {
|
||||
const memory = (this.config.memory ?? {}) as Record<string, unknown>;
|
||||
const embedding: Record<string, unknown> = { enabled: true, provider: cfg.provider };
|
||||
if (cfg.api_key) embedding.api_key = cfg.api_key;
|
||||
if (cfg.endpoint) embedding.endpoint = cfg.endpoint;
|
||||
if (cfg.api_key) {embedding.api_key = cfg.api_key;}
|
||||
if (cfg.endpoint) {embedding.endpoint = cfg.endpoint;}
|
||||
memory.embedding = embedding;
|
||||
this.config.memory = memory;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ export class ConfigBuilder {
|
||||
|
||||
setCronEnabled(): void {
|
||||
const automation = (this.config.automation ?? {}) as Record<string, unknown>;
|
||||
if (!automation.cron) automation.cron = [];
|
||||
if (!automation.cron) {automation.cron = [];}
|
||||
this.config.automation = automation;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function setupMemory(p: Prompter, builder: ConfigBuilder): Promise<
|
||||
p.println(' Vector search enables semantic memory — Flynn remembers and retrieves');
|
||||
p.println(' information based on meaning, not just keywords.');
|
||||
const enable = await p.confirm('Enable vector search for semantic memory?', false);
|
||||
if (!enable) return;
|
||||
if (!enable) {return;}
|
||||
|
||||
p.println(' Pick a provider to generate embeddings (vector representations of text).');
|
||||
p.println(' If you already configured OpenAI or Gemini as a model, you can reuse that key.');
|
||||
@@ -43,7 +43,7 @@ function findReusableApiKey(config: Record<string, any>, embeddingProvider: stri
|
||||
const models = config.models ?? {};
|
||||
for (const tier of ['default', 'fast', 'complex', 'local']) {
|
||||
const m = models[tier];
|
||||
if (m?.provider === embeddingProvider && m?.api_key) return m.api_key;
|
||||
if (m?.provider === embeddingProvider && m?.api_key) {return m.api_key;}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export async function runMenu(p: Prompter, builder: ConfigBuilder): Promise<void
|
||||
const answer = await p.ask('>', '0');
|
||||
const idx = parseInt(answer, 10);
|
||||
|
||||
if (idx === 0 || isNaN(idx)) break;
|
||||
if (idx === 0 || isNaN(idx)) {break;}
|
||||
if (idx >= 1 && idx <= MENU_OPTIONS.length) {
|
||||
const section = MENU_OPTIONS[idx - 1].value;
|
||||
const handler = SECTION_HANDLERS[section];
|
||||
|
||||
@@ -25,7 +25,7 @@ export function createPrompter(rl: ReadlineInterface): Prompter {
|
||||
const hint = defaultYes ? '[Y/n]' : '[y/N]';
|
||||
const answer = await rl.question(`${question} ${hint} `);
|
||||
const trimmed = answer.trim().toLowerCase();
|
||||
if (trimmed === '') return defaultYes;
|
||||
if (trimmed === '') {return defaultYes;}
|
||||
return trimmed === 'y' || trimmed === 'yes';
|
||||
},
|
||||
|
||||
@@ -34,9 +34,9 @@ export function createPrompter(rl: ReadlineInterface): Prompter {
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
this.println(` ${i + 1}. ${options[i].label}`);
|
||||
}
|
||||
const answer = await rl.question(`> `);
|
||||
const answer = await rl.question('> ');
|
||||
const idx = parseInt(answer.trim(), 10) - 1;
|
||||
if (idx >= 0 && idx < options.length) return options[idx].value;
|
||||
if (idx >= 0 && idx < options.length) {return options[idx].value;}
|
||||
return options[0].value;
|
||||
},
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ async function configureProvider(p: Prompter, def: ProviderDef): Promise<{
|
||||
provider: string; model: string; api_key?: string; endpoint?: string;
|
||||
}> {
|
||||
const help = PROVIDER_HELP[def.provider];
|
||||
if (help) p.println(` ${help}`);
|
||||
if (help) {p.println(` ${help}`);}
|
||||
|
||||
const config: Record<string, string> = { provider: def.provider };
|
||||
if (def.needsApiKey) config.api_key = await p.password(def.apiKeyLabel ?? 'API key');
|
||||
if (def.needsEndpoint) config.endpoint = await p.ask('Host', def.defaultEndpoint);
|
||||
if (def.needsApiKey) {config.api_key = await p.password(def.apiKeyLabel ?? 'API key');}
|
||||
if (def.needsEndpoint) {config.endpoint = await p.ask('Host', def.defaultEndpoint);}
|
||||
config.model = await p.ask('Model', def.defaultModel);
|
||||
return config as { provider: string; model: string; api_key?: string; endpoint?: string };
|
||||
}
|
||||
|
||||
+18
-18
@@ -9,11 +9,11 @@ export function renderSummary(config: Record<string, any>): string {
|
||||
lines.push(` Models: ${tiers || 'none configured'}`);
|
||||
|
||||
const channels: string[] = [];
|
||||
if (config.server?.port) channels.push('webchat');
|
||||
if (config.telegram) channels.push('telegram');
|
||||
if (config.discord) channels.push('discord');
|
||||
if (config.slack) channels.push('slack');
|
||||
if (config.whatsapp) channels.push('whatsapp');
|
||||
if (config.server?.port) {channels.push('webchat');}
|
||||
if (config.telegram) {channels.push('telegram');}
|
||||
if (config.discord) {channels.push('discord');}
|
||||
if (config.slack) {channels.push('slack');}
|
||||
if (config.whatsapp) {channels.push('whatsapp');}
|
||||
lines.push(` Channels: ${channels.join(', ') || 'none'}`);
|
||||
|
||||
const embedding = config.memory?.embedding;
|
||||
@@ -22,27 +22,27 @@ export function renderSummary(config: Record<string, any>): string {
|
||||
|
||||
const auto = config.automation ?? {};
|
||||
const autoFeatures: string[] = [];
|
||||
if (auto.cron?.length > 0) autoFeatures.push(`${auto.cron.length} cron jobs`);
|
||||
if (auto.webhooks?.length > 0) autoFeatures.push('webhooks');
|
||||
if (auto.gmail?.enabled) autoFeatures.push('gmail');
|
||||
if (auto.gcal?.enabled) autoFeatures.push('gcal');
|
||||
if (auto.gdocs?.enabled) autoFeatures.push('gdocs');
|
||||
if (auto.gdrive?.enabled) autoFeatures.push('gdrive');
|
||||
if (auto.gtasks?.enabled) autoFeatures.push('gtasks');
|
||||
if (auto.heartbeat?.enabled) autoFeatures.push('heartbeat');
|
||||
if (auto.cron?.length > 0) {autoFeatures.push(`${auto.cron.length} cron jobs`);}
|
||||
if (auto.webhooks?.length > 0) {autoFeatures.push('webhooks');}
|
||||
if (auto.gmail?.enabled) {autoFeatures.push('gmail');}
|
||||
if (auto.gcal?.enabled) {autoFeatures.push('gcal');}
|
||||
if (auto.gdocs?.enabled) {autoFeatures.push('gdocs');}
|
||||
if (auto.gdrive?.enabled) {autoFeatures.push('gdrive');}
|
||||
if (auto.gtasks?.enabled) {autoFeatures.push('gtasks');}
|
||||
if (auto.heartbeat?.enabled) {autoFeatures.push('heartbeat');}
|
||||
lines.push(` Automation: ${autoFeatures.join(', ') || 'none'}`);
|
||||
|
||||
const secFeatures: string[] = [];
|
||||
secFeatures.push(`tools:${config.tools?.profile ?? 'full'}`);
|
||||
if (config.sandbox?.enabled) secFeatures.push('sandbox');
|
||||
if (config.pairing?.enabled) secFeatures.push('pairing');
|
||||
if (config.sandbox?.enabled) {secFeatures.push('sandbox');}
|
||||
if (config.pairing?.enabled) {secFeatures.push('pairing');}
|
||||
lines.push(` Security: ${secFeatures.join(', ')}`);
|
||||
|
||||
const gw: string[] = [];
|
||||
gw.push(`port ${config.server?.port ?? 18800}`);
|
||||
if (config.server?.token) gw.push('auth');
|
||||
if (config.server?.lock) gw.push('locked');
|
||||
if (config.server?.tailscale?.serve) gw.push('tailscale');
|
||||
if (config.server?.token) {gw.push('auth');}
|
||||
if (config.server?.lock) {gw.push('locked');}
|
||||
if (config.server?.tailscale?.serve) {gw.push('tailscale');}
|
||||
lines.push(` Gateway: ${gw.join(', ')}`);
|
||||
|
||||
return lines.join('\n');
|
||||
|
||||
Reference in New Issue
Block a user