Socket
Book a DemoInstallSign in
Socket

1shot

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

1shot

1shot CLI

0.0.9
latest
npmnpm
Version published
Weekly downloads
19
-95.29%
Maintainers
2
Weekly downloads
Β 
Created
Source

1shot

A powerful AI-powered CLI tool that executes predefined commands with a single shot. Built on top of assistant-code, 1shot provides a collection of ready-to-use AI assistants for common development tasks.

Features

  • 🎯 One-command execution: Run complex tasks with a single command
  • πŸ€– Pre-configured AI assistants: Various specialized assistants for different tasks
  • πŸ“‹ Interactive command selector: Browse and select commands interactively
  • πŸ”„ Git-aware: Warns about uncommitted changes before execution
  • ⏸️ Pause functionality: Press ESC to pause execution during tasks
  • 🎨 Beautiful CLI interface: Built with Ink and React
  • πŸ“Š Task completion summary: Shows execution details and stats after completion

Installation

npm install -g 1shot

Setup

You need an Anthropic API key to use 1shot:

export ANTHROPIC_API_KEY=your-api-key
# or
export ASSISTANT_CODE_API_KEY=your-api-key

Get your API key from: https://claude.ai/settings/keys

Usage

Basic Usage

# Run a specific command
1shot <command-name>

# Run a command with custom prompt
1shot <command-name> "your custom request"

# Interactive command selector
1shot commands

Available Commands

  • assistant-ui - Integrate assistant-ui into your project πŸ€–
  • bug - Find and fix bugs in your project πŸ›
  • fix-next-build - Fix Next.js build issues πŸ”§
  • frenchify - Translate project summary to French πŸ‡«πŸ‡·
  • hello-world - Simple greeting command πŸ‘‹
  • prd - Create a comprehensive Product Requirements Document πŸ“‹
  • readme - Create a README.md file for your project πŸ“„
  • upgrade-next - Upgrade to latest Next.js ⚑
  • upgrade-react - Upgrade to latest React βš›οΈ
  • upgrade-typescript - Upgrade to latest TypeScript πŸ’™

Examples

# Create a README for your project
1shot readme

# Find and fix bugs in your codebase
1shot bug

# Create a comprehensive PRD with best practices
1shot prd

# Use custom prompt with any command
1shot prd "Add user personas and an API section."

# Interactive mode - browse and select commands
1shot commands

Git Integration

1shot checks your git status before executing commands and will warn you if:

  • You're not in a git repository
  • You have uncommitted changes
  • You have untracked files

You can choose to continue anyway or cancel to commit your changes first.

Pause and Resume

During command execution, you can:

  • Press ESC once to see a pause warning
  • Press ESC again within 3 seconds to pause execution
  • Press any key to resume when paused
  • Press Ctrl+C to cancel completely

Development

Project Structure

1shot/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts        # Main CLI entry point
β”‚   β”œβ”€β”€ registry.ts     # Command registry
β”‚   └── components/     # React components (if any)
β”œβ”€β”€ dist/               # Compiled output
β”œβ”€β”€ package.json
β”œβ”€β”€ build.mts           # Build configuration
└── README.md

Prerequisites

  • Node.js (with ESM support)
  • npm or yarn
  • TypeScript

Building

# Install dependencies
npm install

# Build the project
npm run build

Development Mode

# Run in watch mode
npm run dev

Adding New Commands

To add a new command, edit src/registry.ts:

export const registry: Record<string, RegistryEntry> = {
  "your-command": {
    systemPrompt: "System prompt for the AI assistant",
    prompt: "🎯 Default user prompt",
  },
  // ... other commands
};

Key points for new commands:

  • Keep command names lowercase with hyphens
  • Start prompts with an emoji for visual clarity
  • System prompts should clearly define the assistant's role
  • Consider using tools like Deepwiki for enhanced capabilities

Dependencies

Core Dependencies

  • @assistant-ui/react - UI components for assistant interfaces
  • assistant-code - Core AI assistant functionality
  • ink - React renderer for CLI apps
  • cross-spawn - Cross-platform command execution
  • vite - Build tool

Development Dependencies

  • TypeScript
  • Vite plugins
  • Tailwind CSS (for any UI components)

Contributing

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

Contribution Guidelines

  • Follow the existing code style
  • Add your new commands in alphabetical order
  • Include clear descriptions for system prompts
  • Test your changes before submitting
  • Update documentation if needed

Troubleshooting

API Key Issues

If you see "No API key found", ensure you've set:

export ANTHROPIC_API_KEY=your-api-key

Command Not Found

If 1shot command is not found after installation:

  • Ensure npm global bin is in your PATH
  • Try installing with sudo (on Unix systems)
  • Use npx 1shot as an alternative

Build Errors

If you encounter build errors:

  • Ensure you're using a compatible Node.js version
  • Delete node_modules and reinstall
  • Check that all TypeScript types are properly installed

License

MIT License - see LICENSE file for details

Acknowledgments

Built with ❀️ using:

Keywords

claude

FAQs

Package last updated on 20 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.