JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q47821F

Package Exports

  • @plastichub/code-bot
  • @plastichub/code-bot/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@plastichub/code-bot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@plastichub/code-bot

AI-powered command-line tool for code modifications and project management that supports multiple AI models and routers.

Overview

Code-bot is a powerful CLI tool that helps developers automate code modifications, handle project management tasks, and integrate with various AI models for intelligent code and content assistance.

Personal Preferences

Code-bot supports personalized interactions through a preferences configuration file:

  • Location: Store your preferences in .kbot/preferences.md
  • Customization: Define personal information, contact details, and content preferences
  • Contextual Responses: AI adapts its communication style and content formatting based on your preferences
  • Language Settings: Specify preferred languages for different contacts and communications

For detailed preferences configuration, see Preferences Documentation.

Project Templates

Available templates defined in TemplateDefinitionSchema:

  • Built-in templates:
    • typescript: TypeScript project templates
  • Custom template paths: Support for custom template definitions

Logging & History

Logs and session history are stored in the .kbot directory within your project:

  • messages.json: Complete conversation history with AI, including:
    • Session IDs and timestamps
    • User queries
    • AI responses
    • Tool execution details
  • modify-files.json: List of modified project files
  • stats.json: Usage statistics and token consumption
  • history.json: Comprehensive modification history
  • openai.md: Markdown formatted log of commands and responses

View modification history using:

kbot log .

Quick Start

NPM Installation

npm install -g @plastichub/code-bot

Configuration

API Keys Setup

Create configuration at $HOME/.osr/.config.json (or export OSR_CONFIG with path to config.json):

{
  "openrouter": {
    "key": "your-openrouter-key"
  },
  "openai": {
    "key": "your-openai-key"
  },
   "email": {
      "newsletter": {
          "host": "host.org",
          "port": 465,
          "debug": true,
          "transactionLog": true,
          "auth": {
              "user": "foo@bar.com",
              "pass": "pass"
          }
      }
  },
  "google": {
      "cse": "custom search engine id",
      "api_key": "google custom search api key"
  }
}

Preferences Setup

Optionally, create .kbot/preferences.md in your project directory to customize AI interactions:

## My Preferences

Gender : male
Location : New York, USA (eg: `send me all gym options`)
Language : English
Occupation : software developer, Typescript
Age : 30+

## Contacts

My email address : example@email.com (eg: `send me latest hacker news`)
My wife's email address ("Anne") : example@email.com (eg: `send email to my wife, with latest local news')

## Content

When creating content
- always Markdown
- always add links
- when sending emails, always add 'Best regards, [Your Name]'

See Preferences Documentation for more options.

CLI Options

Core Options

  • path - Path to the project directory (default: '.')
  • query - Description of the modifications to make to the project. Supports file paths.
  • output - Optional output path for modified files
  • template - Project template to use (typescript) or custom template path
  • templateRoot - Template root directory for loading templates with prefix

File Selection

  • glob - Glob patterns to match files for processing (comma-separated, e.g., "src/.tsx,src/.ts")

AI Configuration

  • model - AI model to use (default: 'anthropic/claude-3.5-sonnet')
  • router - Router to use: openai or openrouter (default: 'openrouter')
  • api_key - Set API key for OpenRouter/OpenAI (otherwise configured in $HOME/.osr/config.json)

Tool Control

  • disable - List of template parts or tool categories to disable (fs, git, interact, terminal, npm, web, search)
  • disableTools - List of specific tools to disable

Other Options

  • logLevel - Logging level (default: 2)
  • profile - Profile for constants (default: '${POLYMECH-ROOT}/profile.json')
  • env - Environment in profile (default: 'default')
  • dump - Write out as script

Usage Examples

For detailed usage examples and advanced configurations, please refer to Usage Examples.

Development

# Install Dependencies
pnpm install

# Development Mode
pnpm dev

# Build Project
pnpm build