tpmjs/packages/tools/create-basic-tools
Ajax Davis 0d1fa3e292 fix: remove duplicate shebang from source file
- tsup banner already adds shebang, no need in source
- bump version to 1.0.2
- fixes CLI execution errors

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 23:43:03 +10:00
..
.changeset feat: add @tpmjs/create-basic-tools CLI generator 2025-12-04 23:34:37 +10:00
src fix: remove duplicate shebang from source file 2025-12-04 23:43:03 +10:00
templates feat: add @tpmjs/create-basic-tools CLI generator 2025-12-04 23:34:37 +10:00
CHANGELOG.md feat: add @tpmjs/create-basic-tools CLI generator 2025-12-04 23:34:37 +10:00
package.json fix: remove duplicate shebang from source file 2025-12-04 23:43:03 +10:00
README.md feat: add @tpmjs/create-basic-tools CLI generator 2025-12-04 23:34:37 +10:00
tsconfig.json feat: add @tpmjs/create-basic-tools CLI generator 2025-12-04 23:34:37 +10:00
tsup.config.ts feat: add @tpmjs/create-basic-tools CLI generator 2025-12-04 23:34:37 +10:00

@tpmjs/create-basic-tools

CLI generator for scaffolding production-ready TPMJS tool packages with 2-3 tools by default.

Features

  • 🎯 Multi-tool packages: Generates packages with minimum 2 tools (ideally 2-3)
  • 🔧 Zod 4 schemas: Uses Zod directly (not jsonSchema wrapper)
  • AI SDK v6: Full compatibility with the latest AI SDK
  • 📦 One file per tool: Clean src/tools/<toolName>.ts structure
  • TPMJS validated: Auto-validates against official TPMJS schemas
  • 🎨 Beautiful CLI: Interactive prompts with @clack/prompts
  • 📝 Complete setup: Generates package.json, tsconfig, tsup config, README, and more
  • 🚀 Publish ready: Generated packages are ready to publish to npm immediately

Usage

pnpmx @tpmjs/create-basic-tools

This will guide you through an interactive wizard that asks:

  1. Package info: name, description, author, license
  2. Tool definitions: At least 2 tools (export name + description)
  3. Category: Choose from 12 TPMJS categories
  4. Mode: Simple (basic Zod schemas) or Advanced (full control)
  5. Output path: Where to create the package
  6. Confirmation: Review and confirm

Example Session

$ pnpmx @tpmjs/create-basic-tools

┌  create-tpmjs-tool
│
◇  Package name
│  @myorg/content-tools
│
◇  Package description
│  AI SDK tools for content processing
│
◇  Tool #1 export name
│  summarizeText
│
◇  Tool #1 description
│  Summarize a block of text into a concise overview.
│
◇  Tool #2 export name
│  extractKeywords
│
◇  Tool #2 description
│  Extract important keywords from text.
│
◇  Add tool #3? (already have 2)
│  Yes
│
◇  Tool #3 export name
│  classifySentiment
│
◇  Tool #3 description
│  Classify the sentiment of text as positive, negative, or neutral.
│
◇  Category
│  text-analysis
│
◇  Mode
│  Simple Mode - Basic Zod schemas
│
◇  Where should we create the package?
│  ./content-tools
│
◇  Ready to generate?
│  Yes
│
└  Success! Created @myorg/content-tools at ./content-tools

Generated Package Structure

content-tools/
├── src/
│   ├── tools/                # One file per tool
│   │   ├── summarizeText.ts
│   │   ├── extractKeywords.ts
│   │   └── classifySentiment.ts
│   └── index.ts              # Re-exports all tools
├── dist/                     # Build output (after pnpm build)
│   ├── index.js
│   └── index.d.ts
├── package.json              # With complete tpmjs field
├── tsconfig.json
├── tsup.config.ts
├── README.md
├── .gitignore
├── .npmignore
└── LICENSE

Generated Tool File Example

Each tool file follows this Zod-first pattern:

import { tool } from 'ai';
import { z } from 'zod';

const SummarizeTextSchema = z.object({
  text: z.string().min(1, 'Text cannot be empty').describe('The input text to process.'),
  options: z.object({
    language: z.string().default('en').describe('Language code (e.g., en, es, fr).'),
    maxLength: z.number().int().positive().default(100).describe('Maximum length of output.'),
  }).default({ language: 'en', maxLength: 100 }).describe('Optional configuration.'),
});

export const summarizeText = tool({
  description: 'Summarize a block of text into a concise overview.',
  inputSchema: SummarizeTextSchema,
  async execute(input: z.infer<typeof SummarizeTextSchema>) {
    // TODO: Implement the tool logic here
    console.log('summarizeText called with:', input);

    return {
      success: true,
      message: 'Tool executed successfully. Replace this with your implementation.',
      input,
    };
  },
});

After Generation

Once the package is generated:

cd content-tools

# Install dependencies
pnpm install

# Build the package
pnpm build

# Type-check
pnpm type-check

# Publish to npm
pnpm publish --access public

Your tools will appear on tpmjs.com within 2-15 minutes after publishing!

TPMJS Categories

The generator validates against these official TPMJS categories:

  • web-scraping
  • data-processing
  • file-operations
  • communication
  • database
  • api-integration
  • image-processing
  • text-analysis
  • automation
  • ai-ml
  • security
  • monitoring

Requirements

  • Node.js 18+
  • pnpm (recommended)

Development

This is a generator package itself. To work on it:

# Install dependencies
pnpm install

# Build
pnpm build

# Type-check
pnpm type-check

# Test locally
node dist/index.js

License

MIT