Skip to content

Quick Start Guide โ€‹

Welcome to CodeBuddy Code! This guide will help you get started in 5 minutes and experience a natural language-driven programming assistant.

๐ŸŽฏ Before You Begin โ€‹

System Requirements โ€‹

  • Node.js: Version 18.20 or higher
  • Operating System: macOS, Linux, or Windows

Verify Your Environment โ€‹

bash
# Check Node.js version
node --version  # Should display v18.0.0 or higher

# Check npm version
npm --version

โšก Quick Installation โ€‹

npm Global Installation โ€‹

bash
npm install -g @tencent-ai/codebuddy-code

Native Installer (Beta) โ€‹

โš ๏ธ Beta Feature: The native installer is currently in Beta. We recommend you try it to get a faster, standalone installation experience.

The native installer provides an independent CodeBuddy installation without requiring a Node.js environment.

Download and Install:

bash
# macOS/Linux
curl -fsSL https://copilot.tencent.com/cli/install.sh | bash
powershell
# Windows
irm https://copilot.tencent.com/cli/install.ps1 | iex

Advantages:

  • โœ… No Node.js dependency required
  • โœ… Faster installation and startup

Verify Installation โ€‹

bash
codebuddy --version

๐Ÿ” Login Authentication โ€‹

When using CodeBuddy Code for the first time, you need to complete login authentication. After startup, you will see the login method selection screen:

Select login method:
โ€บ Log in via Chinese Site
  Log in via International Site
  Log in via Enterprise Domain
  Log in via iOA (Tencent only)

Login Methods โ€‹

Login MethodUse CaseDescription
Chinese SiteUsers in ChinaAuthenticate via Tencent Cloud China (copilot.tencent.com), supports domestic mainstream models
International SiteOverseas usersAuthenticate via Tencent Cloud International (codebuddy.ai), supports international mainstream models
Enterprise DomainDedicated/Private deploymentConnect to enterprise dedicated or self-hosted CodeBuddy service, requires enterprise-provided service address
iOATencent employeesAuthenticate via Tencent iOA zero-trust system, for Tencent internal employees only

Use โ†‘โ†“ keys to select the login method, press Enter to confirm, and the browser will automatically open to complete authentication.

๐Ÿš€ First Experience โ€‹

1. Navigate to Your Project Directory โ€‹

bash
cd /path/to/your/project

2. Launch Interactive Mode โ€‹

bash
codebuddy

You will see the welcome screen:

Tip: If you want CodeBuddy Code to always reply in a specific language (e.g., Simplified Chinese), you can run the /config command after startup to set the Language option.

๐Ÿค– CodeBuddy Code v1.0.0
๐Ÿ’ก Type /help to view available commands
๐Ÿ“ Start chatting and let AI become your programming partner

>

Before starting your conversation, it is highly recommended to initialize the project context using the /init command:

> /init

Why is /init so important?

๐Ÿ“Š Performance Improvements:

  • โœ… More Accurate Understanding: Pre-builds a project knowledge graph, enabling AI to more accurately understand code structure and business logic
  • โœ… Faster Responses: Avoids repeated file scans, significantly improving subsequent conversation response times
  • โœ… More Precise Suggestions: Provides recommendations more aligned with your project architecture based on a global view
  • โœ… Reduced Misjudgments: Understands project dependencies, avoiding incompatible modification proposals

๐Ÿ’ฐ Cost Optimization:

  • โœ… Lower Token Consumption: Establishes context once, avoiding re-analysis in every conversation
  • โœ… Fewer Redundant Requests: Pre-loads key information, reducing context token overhead by 30-50%
  • โœ… More Efficient Conversations: Each conversation round carries less redundant information, lowering overall costs

Best Practices:

# When using a project for the first time
> /init

# When project structure undergoes major changes (e.g., adding new modules, refactoring)
> /clear  # Start a fresh conversation
> /init   # Re-initialize

4. Try Your First Conversation โ€‹

> Help me analyze the structure of this project

CodeBuddy will automatically scan your project files and provide a detailed structural analysis.

๐Ÿ’ก Core Usage Patterns โ€‹

Interactive Conversation Mode โ€‹

The most natural way to use, suitable for exploratory development:

bash
codebuddy

Typical Conversation Examples:

> I want to add a loading state to this React component
> Help me refactor this function to make it more readable
> What are the potential performance issues with this code?
> Write unit tests for this API endpoint

Single Command Mode โ€‹

Suitable for scripting and automation scenarios:

bash
# Direct query
codebuddy -p "Optimize the performance of this SQL query"

# Pipeline input
cat error.log | codebuddy -p "Analyze these error logs"

# File analysis (must add -y or --dangerously-skip-permissions when authorization is needed)
codebuddy -p "Review the code quality of src/utils.js" -y

Important Note: When using the -p/--print parameter for a single execution, if the operation requires authorized actions such as file access or command execution, you must add the -y (or --dangerously-skip-permissions) parameter. With -y alone, HIGH/CRITICAL dangerous commands may still require confirmation. To suppress prompts entirely inside an isolated sandbox, use export CODEBUDDY_IS_SANDBOX=1 && codebuddy -p -y ... (high risk; see Sandbox full pass (high risk)).

Project-Level Operations โ€‹

Handle complex cross-file tasks:

bash
# Project refactoring (requires file operation authorization)
codebuddy -p "Migrate all components from class components to function components" -y

# Code standards (requires file read authorization)
codebuddy -p "Check TypeScript type definitions across the entire project" -y

# Test coverage (requires file operation authorization)
codebuddy -p "Add unit tests for all files in the services directory" -y

Keyboard Shortcuts โ€‹

Basic Navigation โ€‹

ShortcutFunction
โ†‘/โ†“Browse command history
โ†“View background tasks (when tasks are running)
TabCommand auto-completion
EscClear input (press twice) / Return to previous menu
Ctrl+CExit program
Ctrl+DExit program (press twice when input is empty and no conversation in progress)

Permissions and Modes โ€‹

ShortcutFunction
Shift+Tab (Windows also supports Alt+M)Toggle permission mode (default โ†’ bypass โ†’ accept โ†’ plan)

Editing Features โ€‹

ShortcutFunction
Ctrl+RExpand/collapse detailed output (in conversation)
Ctrl+GEdit prompt in external editor
EnterSend message
Shift+EnterNew line (multi-line input)
\EnterNew line (backslash escape)
Ctrl+JInsert new line (multi-line input)

Panel Operations โ€‹

ShortcutFunction
โ†‘/โ†“ or j/kNavigate options in panel (Vim-style supported)
EnterSelect current item
SpaceToggle selection (multi-select panels)
xTerminate selected background task

Special Functions โ€‹

ShortcutFunction
Ctrl+OView thinking details panel

When the terminal displays a "Thinking" indicator, you can use Ctrl+O to open the full reasoning content, and press Ctrl+O again to exit.

๐ŸŽ“ Advanced Learning โ€‹

Congratulations on completing the quick start! We recommend reading next:

๐Ÿ’ฌ Get Help โ€‹

Having issues? We're here to support you:


Now, let AI become your programming partner! ๐Ÿš€