Skip to content

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

Sushmithamalleshf730b28c8a59
diff --git a/fern/scripts/build-llms-txt.ts b/fern/scripts/build-llms-txt.ts
index c0bb92f6d..7b35d1f79 100644
--- a/fern/scripts/build-llms-txt.ts
+++ b/fern/scripts/build-llms-txt.ts
@@ -3,15 +3,41 @@
import fs from 'fs';
import path from 'path';
-import {
- FERN_DIR,
- LLMS_TXT_PATH,
- loadDocsConfig,
- ensureOutputDir,
- type DocsConfig,
- type ContentItem,
- type LayoutItem,
-} from './utils';
+import yaml from 'yaml';
+
+const FERN_DIR = path.join(import.meta.dir, '..');
+const DOCS_YML_PATH = path.join(FERN_DIR, 'docs.yml');
+const LLMS_TXT_PATH = path.join(FERN_DIR, 'llms-txt-worker', 'public', 'llms.txt');
+
+interface DocsConfig {
+ title: string;
+ navigation: Array<{
+ tab: string;
+ layout?: LayoutItem[];
+ }>;
+ tabs?: {
+ [key: string]: {
+ 'display-name': string;
+ 'skip-slug'?: boolean;
+ };
+ };
+}
+
+interface LayoutItem {
+ section?: string;
+ contents?: ContentItem[];
+ page?: string;
+ path?: string;
+ slug?: string;
+}
+
+interface ContentItem {
+ page?: string;
+ path?: string;
+ slug?: string;
+ section?: string;
+ contents?: ContentItem[];
+}
interface LlmsEntry {
title: string;
@@ -209,14 +235,14 @@ async function main(): Promise<void> {
console.log('Building llms.txt...');
try {
- const config = loadDocsConfig();
+ const docsYmlContent = fs.readFileSync(DOCS_YML_PATH, 'utf8');
+ const config = yaml.parse(docsYmlContent) as DocsConfig;
const sections = processNavigation(config);
const totalEntries = sections.reduce((total, [_, entries]) => total + entries.length, 0);
console.log(`Found ${totalEntries} pages across ${sections.length} sections`);
const llmsTxtContent = generateLlmsTxt(sections);
- ensureOutputDir(LLMS_TXT_PATH);
fs.writeFileSync(LLMS_TXT_PATH, llmsTxtContent);
console.log(`Generated ${LLMS_TXT_PATH}`);
diff --git a/fern/scripts/build-tools-json.ts b/fern/scripts/build-tools-json.ts
index efa6250d1..4311f25e8 100644
--- a/fern/scripts/build-tools-json.ts
+++ b/fern/scripts/build-tools-json.ts
@@ -3,7 +3,16 @@
import fs from 'fs';
import path from 'path';
-import { TOOLKITS_DIR, TOOLS_JSON_PATH, ensureOutputDir } from './utils';
+
+const FERN_DIR = path.join(import.meta.dir, '..');
+const TOOLKITS_DIR = path.join(FERN_DIR, 'toolkits');
+const TOOLS_JSON_PATH = path.join(
+ FERN_DIR,
+ 'llms-txt-worker',
+ 'public',
+ 'robots-only',
+ 'tools.json'
+);
interface ToolkitInfo {
slug: string;
@@ -124,7 +133,6 @@ async function main(): Promise<void> {
console.log(` - Total tools: ${totalTools}`);
// Write tools.json
- ensureOutputDir(TOOLS_JSON_PATH);
const toolsJsonContent = JSON.stringify(toolsData, null, 2);
fs.writeFileSync(TOOLS_JSON_PATH, toolsJsonContent);
diff --git a/fern/scripts/utils.ts b/fern/scripts/utils.ts
deleted file mode 100644
index f3b390846..000000000
--- a/fern/scripts/utils.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env bun
-
-import fs from 'fs';
-import path from 'path';
-import yaml from 'yaml';
-
-// Shared directories
-export const FERN_DIR = path.join(import.meta.dir, '..');
-export const DOCS_YML_PATH = path.join(FERN_DIR, 'docs.yml');
-export const LLMS_TXT_PATH = path.join(FERN_DIR, 'llms-txt-worker', 'public', 'llms.txt');
-export const TOOLS_JSON_PATH = path.join(
- FERN_DIR,
- 'llms-txt-worker',
- 'public',
- 'robots-only',
- 'tools.json'
-);
-export const PAGES_DIR = path.join(FERN_DIR, 'pages');
-export const TOOLKITS_DIR = path.join(FERN_DIR, 'toolkits');
-
-export interface DocsConfig {
- title: string;
- navigation: Array<{
- tab: string;
- layout?: LayoutItem[];
- }>;
- tabs?: {
- [key: string]: {
- 'display-name': string;
- 'skip-slug'?: boolean;
- };
- };
-}
-
-export interface LayoutItem {
- section?: string;
- contents?: ContentItem[];
- page?: string;
- path?: string;
- slug?: string;
-}
-
-export interface ContentItem {
- page?: string;
- path?: string;
- slug?: string;
- section?: string;
- contents?: ContentItem[];
-}
-
-export function loadDocsConfig(): DocsConfig {
- const docsYmlContent = fs.readFileSync(DOCS_YML_PATH, 'utf8');
- return yaml.parse(docsYmlContent) as DocsConfig;
-}
-
-export function ensureOutputDir(filePath: string): void {
- const dir = path.dirname(filePath);
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir, { recursive: true });
- }
-}
\ No newline at end of file