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,18 +74,18 @@ compdef _flynn flynn
|
||||
|
||||
export function generateFishCompletion(): string {
|
||||
const lines = [
|
||||
`# Flynn fish completion — generated by 'flynn completion fish'`,
|
||||
`# Disable file completions by default`,
|
||||
`complete -c flynn -f`,
|
||||
``,
|
||||
`# Subcommands`,
|
||||
'# Flynn fish completion — generated by \'flynn completion fish\'',
|
||||
'# Disable file completions by default',
|
||||
'complete -c flynn -f',
|
||||
'',
|
||||
'# Subcommands',
|
||||
];
|
||||
|
||||
for (const cmd of SUBCOMMANDS) {
|
||||
lines.push(`complete -c flynn -n '__fish_use_subcommand' -a '${cmd}' -d '${cmd} subcommand'`);
|
||||
}
|
||||
lines.push(`complete -c flynn -n '__fish_use_subcommand' -l help -d 'Show help'`);
|
||||
lines.push(`complete -c flynn -n '__fish_use_subcommand' -l version -d 'Show version'`);
|
||||
lines.push('complete -c flynn -n \'__fish_use_subcommand\' -l help -d \'Show help\'');
|
||||
lines.push('complete -c flynn -n \'__fish_use_subcommand\' -l version -d \'Show version\'');
|
||||
lines.push('');
|
||||
lines.push('# Subcommand options');
|
||||
|
||||
@@ -98,7 +98,7 @@ export function generateFishCompletion(): string {
|
||||
}
|
||||
}
|
||||
|
||||
lines.push(`complete -c flynn -n '__fish_seen_subcommand_from completion' -a 'bash zsh fish' -d 'Shell type'`);
|
||||
lines.push('complete -c flynn -n \'__fish_seen_subcommand_from completion\' -a \'bash zsh fish\' -d \'Shell type\'');
|
||||
lines.push('');
|
||||
|
||||
return lines.join('\n');
|
||||
@@ -141,7 +141,7 @@ export function registerCompletionCommand(program: Command): void {
|
||||
writeFileSync(installPath, script, 'utf-8');
|
||||
console.log(`Completion script installed to: ${installPath}`);
|
||||
if (shell === 'zsh') {
|
||||
console.log(`Ensure ~/.zfunc is in your fpath: fpath=(~/.zfunc $fpath)`);
|
||||
console.log('Ensure ~/.zfunc is in your fpath: fpath=(~/.zfunc $fpath)');
|
||||
}
|
||||
} else {
|
||||
process.stdout.write(script);
|
||||
|
||||
+3
-3
@@ -152,9 +152,9 @@ const checkModelConnectivity: Check = async (ctx) => {
|
||||
|
||||
// Build a summary of the model stack
|
||||
const parts = [`default: ${model.provider}/${model.model}`];
|
||||
if (models.fast) parts.push(`fast: ${models.fast.provider}/${models.fast.model}`);
|
||||
if (models.complex) parts.push(`complex: ${models.complex.provider}/${models.complex.model}`);
|
||||
if (models.local) parts.push(`local: ${models.local.provider}/${models.local.model}`);
|
||||
if (models.fast) {parts.push(`fast: ${models.fast.provider}/${models.fast.model}`);}
|
||||
if (models.complex) {parts.push(`complex: ${models.complex.provider}/${models.complex.model}`);}
|
||||
if (models.local) {parts.push(`local: ${models.local.provider}/${models.local.model}`);}
|
||||
parts.push(`fallback: [${models.fallback_chain.join(', ')}]`);
|
||||
|
||||
return { status: 'pass', label: 'Model connectivity', detail: parts.join(', ') };
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ function loadSystemPrompt(): string {
|
||||
resolve(import.meta.dirname, '../../SOUL.md'),
|
||||
];
|
||||
for (const p of paths) {
|
||||
if (existsSync(p)) return readFileSync(p, 'utf-8');
|
||||
if (existsSync(p)) {return readFileSync(p, 'utf-8');}
|
||||
}
|
||||
return 'You are Flynn, a helpful personal AI assistant.';
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('sessions command', () => {
|
||||
|
||||
afterEach(() => {
|
||||
store?.close();
|
||||
if (existsSync(dbPath)) unlinkSync(dbPath);
|
||||
if (existsSync(dbPath)) {unlinkSync(dbPath);}
|
||||
});
|
||||
|
||||
it('returns empty list when no sessions', () => {
|
||||
|
||||
@@ -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');
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ export function getDataDir(): string {
|
||||
*/
|
||||
export function resolveOverlayPath(basePath: string): string | undefined {
|
||||
const env = process.env.FLYNN_ENV;
|
||||
if (!env) return undefined;
|
||||
if (!env) {return undefined;}
|
||||
const configDir = dirname(basePath);
|
||||
return join(configDir, `${env}.yaml`);
|
||||
}
|
||||
@@ -44,8 +44,8 @@ export function redactSecrets(config: Record<string, unknown>): Record<string, u
|
||||
const sensitiveKeys = ['bot_token', 'api_key', 'auth_token'];
|
||||
|
||||
function redact(obj: unknown): unknown {
|
||||
if (obj === null || obj === undefined) return obj;
|
||||
if (Array.isArray(obj)) return obj.map(redact);
|
||||
if (obj === null || obj === undefined) {return obj;}
|
||||
if (Array.isArray(obj)) {return obj.map(redact);}
|
||||
if (typeof obj === 'object') {
|
||||
const result: Record<string, unknown> = {};
|
||||
for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {
|
||||
|
||||
+2
-2
@@ -27,9 +27,9 @@ function formatToolName(name: string): string {
|
||||
|
||||
/** Format tool args as a compact, readable summary instead of raw JSON. */
|
||||
function formatToolArgs(args: unknown): string {
|
||||
if (!args || typeof args !== 'object') return '';
|
||||
if (!args || typeof args !== 'object') {return '';}
|
||||
const entries = Object.entries(args as Record<string, unknown>);
|
||||
if (entries.length === 0) return '';
|
||||
if (entries.length === 0) {return '';}
|
||||
|
||||
const parts = entries.map(([key, value]) => {
|
||||
if (typeof value === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user