@devries-cameron20 / composio-1 / commits / f730b28c8
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

remove utils

Sushmithamallesh committed Nov 5, 2025 at 21:55 UTC f730b28c8a59dc61f1e3363ce16901c8b2c22a99
3 files changed +47 -74
fern/scripts/build-llms-txt.ts
+37 -11
@@ -3,15 +3,41 @@
3
4 import fs from 'fs';
5 import path from 'path';
6 -import {
7 - FERN_DIR,
8 - LLMS_TXT_PATH,
9 - loadDocsConfig,
10 - ensureOutputDir,
11 - type DocsConfig,
12 - type ContentItem,
13 - type LayoutItem,
14 -} from './utils';
6 +import yaml from 'yaml';
7 +
8 +const FERN_DIR = path.join(import.meta.dir, '..');
9 +const DOCS_YML_PATH = path.join(FERN_DIR, 'docs.yml');
10 +const LLMS_TXT_PATH = path.join(FERN_DIR, 'llms-txt-worker', 'public', 'llms.txt');
11 +
12 +interface DocsConfig {
13 + title: string;
14 + navigation: Array<{
15 + tab: string;
16 + layout?: LayoutItem[];
17 + }>;
18 + tabs?: {
19 + [key: string]: {
20 + 'display-name': string;
21 + 'skip-slug'?: boolean;
22 + };
23 + };
24 +}
25 +
26 +interface LayoutItem {
27 + section?: string;
28 + contents?: ContentItem[];
29 + page?: string;
30 + path?: string;
31 + slug?: string;
32 +}
33 +
34 +interface ContentItem {
35 + page?: string;
36 + path?: string;
37 + slug?: string;
38 + section?: string;
39 + contents?: ContentItem[];
40 +}
41
42 interface LlmsEntry {
43 title: string;
@@ -209,14 +235,14 @@ async function main(): Promise<void> {
235 console.log('Building llms.txt...');
236
237 try {
212 - const config = loadDocsConfig();
238 + const docsYmlContent = fs.readFileSync(DOCS_YML_PATH, 'utf8');
239 + const config = yaml.parse(docsYmlContent) as DocsConfig;
240 const sections = processNavigation(config);
241
242 const totalEntries = sections.reduce((total, [_, entries]) => total + entries.length, 0);
243 console.log(`Found ${totalEntries} pages across ${sections.length} sections`);
244
245 const llmsTxtContent = generateLlmsTxt(sections);
219 - ensureOutputDir(LLMS_TXT_PATH);
246 fs.writeFileSync(LLMS_TXT_PATH, llmsTxtContent);
247
248 console.log(`Generated ${LLMS_TXT_PATH}`);
fern/scripts/build-tools-json.ts
+10 -2
@@ -3,7 +3,16 @@
3
4 import fs from 'fs';
5 import path from 'path';
6 -import { TOOLKITS_DIR, TOOLS_JSON_PATH, ensureOutputDir } from './utils';
6 +
7 +const FERN_DIR = path.join(import.meta.dir, '..');
8 +const TOOLKITS_DIR = path.join(FERN_DIR, 'toolkits');
9 +const TOOLS_JSON_PATH = path.join(
10 + FERN_DIR,
11 + 'llms-txt-worker',
12 + 'public',
13 + 'robots-only',
14 + 'tools.json'
15 +);
16
17 interface ToolkitInfo {
18 slug: string;
@@ -124,7 +133,6 @@ async function main(): Promise<void> {
133 console.log(` - Total tools: ${totalTools}`);
134
135 // Write tools.json
127 - ensureOutputDir(TOOLS_JSON_PATH);
136 const toolsJsonContent = JSON.stringify(toolsData, null, 2);
137 fs.writeFileSync(TOOLS_JSON_PATH, toolsJsonContent);
138
fern/scripts/utils.ts deleted
-61
@@ -1,61 +0,0 @@
1 -#!/usr/bin/env bun
2 -
3 -import fs from 'fs';
4 -import path from 'path';
5 -import yaml from 'yaml';
6 -
7 -// Shared directories
8 -export const FERN_DIR = path.join(import.meta.dir, '..');
9 -export const DOCS_YML_PATH = path.join(FERN_DIR, 'docs.yml');
10 -export const LLMS_TXT_PATH = path.join(FERN_DIR, 'llms-txt-worker', 'public', 'llms.txt');
11 -export const TOOLS_JSON_PATH = path.join(
12 - FERN_DIR,
13 - 'llms-txt-worker',
14 - 'public',
15 - 'robots-only',
16 - 'tools.json'
17 -);
18 -export const PAGES_DIR = path.join(FERN_DIR, 'pages');
19 -export const TOOLKITS_DIR = path.join(FERN_DIR, 'toolkits');
20 -
21 -export interface DocsConfig {
22 - title: string;
23 - navigation: Array<{
24 - tab: string;
25 - layout?: LayoutItem[];
26 - }>;
27 - tabs?: {
28 - [key: string]: {
29 - 'display-name': string;
30 - 'skip-slug'?: boolean;
31 - };
32 - };
33 -}
34 -
35 -export interface LayoutItem {
36 - section?: string;
37 - contents?: ContentItem[];
38 - page?: string;
39 - path?: string;
40 - slug?: string;
41 -}
42 -
43 -export interface ContentItem {
44 - page?: string;
45 - path?: string;
46 - slug?: string;
47 - section?: string;
48 - contents?: ContentItem[];
49 -}
50 -
51 -export function loadDocsConfig(): DocsConfig {
52 - const docsYmlContent = fs.readFileSync(DOCS_YML_PATH, 'utf8');
53 - return yaml.parse(docsYmlContent) as DocsConfig;
54 -}
55 -
56 -export function ensureOutputDir(filePath: string): void {
57 - const dir = path.dirname(filePath);
58 - if (!fs.existsSync(dir)) {
59 - fs.mkdirSync(dir, { recursive: true });
60 - }
61 -}
\ No newline at end of file