tpmjs/packages/tools/create-basic-tools/src/generators
Ajax Davis fada29ecbe feat: add npm-like features to tool detail page and update keyword to tpmjs
- Add download trend sparkline chart showing 30-day download history
- Add bundle size component with minified/gzipped sizes via bundlephobia proxy
- Add more install commands: yarn, bun, deno (in addition to npm, pnpm)
- Change discovery keyword from "tpmjs-tool" to "tpmjs" across entire codebase
- Update sync endpoints to use new keyword
- Update all documentation and package.json files

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-29 21:30:42 +10:00
..
config-files.ts feat: add @tpmjs/create-basic-tools CLI generator 2025-12-04 23:34:37 +10:00
package-json.ts feat: add npm-like features to tool detail page and update keyword to tpmjs 2025-12-29 21:30:42 +10:00
readme.ts refactor: rename exportName to name across entire codebase 2025-12-17 17:19:21 +10:00
source-code.ts refactor: rename exportName to name across entire codebase 2025-12-17 17:19:21 +10:00

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}
`;
}