@fatduckai/cli
v0.6.1
Published
CLI tool for managing FatDuck AI prompts and tools
Downloads
732
Readme
@fatduckai/cli
Command-line interface for managing AI prompts and tools in your FatDuck AI projects.
📦 Installation
Global Installation
# Using npm
npm install -g @fatduckai/cli
# Using bun
bun install -g @fatduckai/cli
# Now you can use the CLI directly
fatduckai add tweet
Local Installation
# Using npm
npm install --save-dev @fatduckai/cli
# Using bun
bun add -d @fatduckai/cli
🛠️ Commands
add <component>
Add a prompt or tool to your project.
fatduckai add tweet # Add the tweet prompt
fatduckai add btc-price # Add the Bitcoin price tool
fatduckai add tweet --yes # Skip confirmation prompt
The command will:
- Create the appropriate directory structure (
ai/prompts
orai/tools
) - Generate a TypeScript file with the component configuration
- Show usage instructions
Help
# Show general help
fatduckai --help
# Show help for a specific command
fatduckai add --help
📁 Project Structure
When you add components, they are organized in the following structure:
your-project/
├── ai/
│ ├── prompts/
│ │ └── tweet.ts
│ └── tools/
│ └── btc-price.ts
🧪 Development
Setup
# Clone the repository
git clone https://github.com/yourusername/fatduckai
cd packages/cli
# Install dependencies
bun install
Build
# Build the project
bun run build
Testing
# Run unit tests
bun test
# Run manual test script
bun run test/manual-test.ts
Development Mode
# Run CLI in development mode
bun run dev add tweet
📝 Example Usage
Adding and Using a Prompt
- Add the tweet prompt to your project:
fatduckai add tweet
- Use the prompt in your code:
import { tweet } from "./ai/prompts/tweet";
// Use the prompt with your AI service
const result = await ai.generate(tweet.template, {
topic: "AI advancements",
tone: "professional",
includeHashtags: true,
includeEmojis: true,
});
Adding and Using a Tool
- Add the Bitcoin price tool:
fatduckai add btc-price
- Use the tool in your code:
import { btcPrice } from "./ai/tools/btc-price";
const price = await btcPrice.handler({
config: {
currency: "USD",
precision: 2,
},
});
🔧 Configuration
The CLI will respect any .fatduckrc
or fatduck.config.js
file in your project root. Example configuration:
{
"outputDir": "custom/path",
"typescript": true
}
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.