tpmjs/packages/tools/create-basic-tools/src/generators/readme.ts
Ajax Davis ada3ffb341 refactor: rename exportName to name across entire codebase
- Database: Migrate column export_name to name in tools table
- Prisma schema: Update Tool model to use name field
- Sync routes: Update keyword and changes sync to use name
- Railway executor: Update API endpoints to use name parameter
- API routes: Update all tool routes to use name field
- Web app: Update all pages and components
- Playground: Update tool loader and sidebar
- create-basic-tools: Update types and generators
- Scripts: Update sync and test scripts

Database migration was done via direct SQL:
  ALTER TABLE tools RENAME COLUMN export_name TO name;

The unique constraint remains on (package_id, name).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-17 17:19:21 +10:00

77 lines
1.4 KiB
TypeScript

import type { GeneratorConfig } from '../types.js';
/**
* Generates README.md content for the tool package
*/
export function generateReadme(config: GeneratorConfig): string {
const { packageInfo, tools } = config;
const toolsList = tools.map((tool) => `- **${tool.name}**: ${tool.description}`).join('\n');
const usageExample = tools[0];
if (!usageExample) {
throw new Error('At least one tool is required');
}
return `# ${packageInfo.name}
${packageInfo.description}
## Installation
\`\`\`bash
pnpm add ${packageInfo.name}
\`\`\`
## Tools
This package provides ${tools.length} tool${tools.length > 1 ? 's' : ''} for the AI SDK:
${toolsList}
## Usage
\`\`\`typescript
import { ${usageExample.name} } from '${packageInfo.name}';
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
const result = await generateText({
model: openai('gpt-4'),
prompt: 'Process this text for me',
tools: {
${usageExample.name},
},
});
console.log(result.text);
\`\`\`
## Development
\`\`\`bash
# Install dependencies
pnpm install
# Build the package
pnpm build
# Type-check
pnpm type-check
# Watch mode
pnpm dev
\`\`\`
## Publishing
1. Update the version in \`package.json\`
2. Build the package: \`pnpm build\`
3. Publish to npm: \`pnpm publish --access public\`
4. Your tools will appear on [tpmjs.com](https://tpmjs.com) within 2-15 minutes
## License
${packageInfo.license}
`;
}