Skip to content

Open source file-system and knowledge based agent template. Build AI agents that stay up to date with your knowledge base

fix lint

Hugo Richard725e64c19085
diff --git a/apps/api/workflows/sync-docs/utils/github.ts b/apps/api/workflows/sync-docs/utils/github.ts
index df401c0..d06ae62 100644
--- a/apps/api/workflows/sync-docs/utils/github.ts
+++ b/apps/api/workflows/sync-docs/utils/github.ts
@@ -49,14 +49,18 @@ export async function cleanupNonDocFiles(dir: string): Promise<number> {
try {
const remaining = await readdir(fullPath)
if (remaining.length === 0) await rmdir(fullPath)
- } catch {}
+ } catch {
+ // Ignore cleanup errors
+ }
} else if (stats.isFile()) {
if (isAllowedFile(entry)) {
if (entry.endsWith('.md') || entry.endsWith('.mdx')) mdCount++
} else {
try {
await unlink(fullPath)
- } catch {}
+ } catch {
+ // Ignore delete errors
+ }
}
}
}
@@ -135,7 +139,9 @@ export async function resetSourceDir(source: GitHubSource, outputDir: string): P
const targetDir = resolve(outputDir, 'docs', source.outputPath || source.id)
try {
await rm(targetDir, { recursive: true, force: true })
- } catch {}
+ } catch {
+ // Ignore if directory doesn't exist
+ }
}
export async function collectFiles(dir: string, basePath = ''): Promise<ContentFile[]> {
diff --git a/apps/api/workflows/sync-docs/utils/snapshot.ts b/apps/api/workflows/sync-docs/utils/snapshot.ts
index b3be82f..022531d 100644
--- a/apps/api/workflows/sync-docs/utils/snapshot.ts
+++ b/apps/api/workflows/sync-docs/utils/snapshot.ts
@@ -46,7 +46,9 @@ async function collectAllFiles(
try {
const content = await readFile(fullPath, 'utf-8')
files.push({ path: relPath, content })
- } catch {}
+ } catch {
+ // Skip unreadable files
+ }
}
}
}
@@ -103,7 +105,9 @@ export async function pushToSnapshot(
baseTreeSha = commitData.tree.sha
}
}
- } catch {}
+ } catch {
+ // Branch doesn't exist yet, will create new
+ }
const treeItems: GitHubTreeItem[] = []
diff --git a/packages/config/src/validation.ts b/packages/config/src/validation.ts
index 4b6a9de..a4a3960 100644
--- a/packages/config/src/validation.ts
+++ b/packages/config/src/validation.ts
@@ -1,12 +1,12 @@
import { z } from 'zod'
-const AdditionalSyncSchema = z.object({
+const additionalSyncSchema = z.object({
repo: z.string().min(1),
branch: z.string().optional(),
contentPath: z.string().optional(),
})
-const GitHubSourceSchema = z.object({
+const gitHubSourceSchema = z.object({
id: z.string().min(1),
label: z.string().optional(),
repo: z.string().regex(/^[\w.-]+\/[\w.-]+$/, 'Must be in format owner/repo'),
@@ -14,10 +14,10 @@ const GitHubSourceSchema = z.object({
contentPath: z.string().optional(),
outputPath: z.string().optional(),
readmeOnly: z.boolean().optional(),
- additionalSyncs: z.array(AdditionalSyncSchema).optional(),
+ additionalSyncs: z.array(additionalSyncSchema).optional(),
})
-const YouTubeSourceSchema = z.object({
+const youTubeSourceSchema = z.object({
id: z.string().min(1),
label: z.string().optional(),
channelId: z.string().min(1),
@@ -25,22 +25,22 @@ const YouTubeSourceSchema = z.object({
maxVideos: z.number().int().positive().optional(),
})
-const CustomSourceSchema = z.object({
+const customSourceSchema = z.object({
id: z.string().min(1),
label: z.string().optional(),
fetchFn: z.any(),
})
-const SavoirConfigSchema = z.object({
+const savoirConfigSchema = z.object({
sources: z.object({
- github: z.array(GitHubSourceSchema).optional(),
- youtube: z.array(YouTubeSourceSchema).optional(),
- custom: z.array(CustomSourceSchema).optional(),
+ github: z.array(gitHubSourceSchema).optional(),
+ youtube: z.array(youTubeSourceSchema).optional(),
+ custom: z.array(customSourceSchema).optional(),
}).optional(),
})
-export type ValidatedConfig = z.infer<typeof SavoirConfigSchema>
+export type ValidatedConfig = z.infer<typeof savoirConfigSchema>
export function validateConfig(config: unknown): ValidatedConfig {
- return SavoirConfigSchema.parse(config)
+ return savoirConfigSchema.parse(config)
}