AgentSkillsCN

codebolt-api-access

当您需要调用 Codebolt 模块(fs、浏览器、终端、Git、聊天、LLM、线程、待办事项、内存、任务、蜂群、作业、路线图、自动测试、MCP、行动计划)时,可使用此技能。

SKILL.md
--- frontmatter
name: codebolt-api-access
description: Use when you need to call codebolt modules (fs, browser, terminal, git, chat, llm, thread, todo, memory, task, swarm, job, roadmap, autoTesting, mcp, actionPlan)

Codebolt API Access

This skill provides reference documentation for direct TypeScript SDK calls to codebolt modules.

Quick Start

File System

typescript
import codebolt from '@anthropic/codeboltjs';

// Read and write files
const content = await codebolt.fs.readFile('/path/to/file.ts');
await codebolt.fs.createFile('newfile.ts', 'const x = 1;', '/path/to/dir');

// Search files
const results = await codebolt.fs.grepSearch('/src', 'function', '*.ts');

Browser

typescript
import codebolt from '@anthropic/codeboltjs';

await codebolt.browser.goToPage('https://example.com');
const screenshot = await codebolt.browser.screenshot();
const markdown = await codebolt.browser.getMarkdown();
await codebolt.browser.close();

Terminal

typescript
import codebolt from '@anthropic/codeboltjs';

const result = await codebolt.terminal.executeCommand('npm install');
const stream = codebolt.terminal.executeCommandWithStream('npm run dev');
stream.on('commandOutput', (data) => console.log(data));

Git

typescript
import codebolt from '@anthropic/codeboltjs';

await codebolt.git.init('/path/to/project');
await codebolt.git.addAll();
await codebolt.git.commit('Add new feature');
await codebolt.git.push();
const status = await codebolt.git.status();

LLM

typescript
import codebolt from '@anthropic/codeboltjs';

const response = await codebolt.llm.inference({
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'What is TypeScript?' }
  ],
  tool_choice: 'auto',
  max_tokens: 1000,
  temperature: 0.7
});
console.log(response.completion.content);

Thread

typescript
import codebolt from '@anthropic/codeboltjs';

const thread = await codebolt.thread.createThread({
  name: 'Feature Discussion',
  threadType: 'discussion',
  agentId: 'agent-123'
});

await codebolt.thread.startThread(thread.thread.id, {
  initialMessage: 'Lets discuss new feature requirements.'
});

const messages = await codebolt.thread.getThreadMessages({
  threadId: thread.thread.id,
  limit: 50
});

Swarm

typescript
import codebolt from '@anthropic/codeboltjs';

const swarm = await codebolt.swarm.createSwarm({
  name: 'Processing Swarm',
  allowExternalAgents: false,
  maxAgents: 10
});

const agent = await codebolt.swarm.registerAgent(swarm.data.swarm.id, {
  name: 'Agent Alpha',
  agentType: 'internal'
});

const team = await codebolt.swarm.createTeam(swarm.data.swarm.id, {
  name: 'Processing Team',
  maxMembers: 5
});

const role = await codebolt.swarm.createRole(swarm.data.swarm.id, {
  name: 'Data Processor',
  permissions: ['task:execute', 'data:read'],
  maxAssignees: 5
});

Job

typescript
import codebolt from '@anthropic/codeboltjs';

const group = await codebolt.job.createJobGroup({
  name: 'Data Processing Jobs'
});

const job = await codebolt.job.createJob(group.data.groupId, {
  title: 'Process dataset',
  priority: 'high',
  estimatedHours: 2
});

await codebolt.job.addDependency(job.data.job.id, otherJobId, 'finish_to_start');
await codebolt.job.lockJob(job.data.job.id, 'agent-001', 'Worker Agent');
await codebolt.job.unlockJob(job.data.job.id, 'agent-001');

MCP Tools

typescript
import codebolt from '@anthropic/codeboltjs';

const enabled = await codebolt.mcp.getEnabledMCPServers();
const tools = await codebolt.mcp.listMcpFromServers(['filesystem', 'browser']);

const result = await codebolt.mcp.executeTool(
  'filesystem',
  'read_file',
  { path: '/path/to/file.ts' }
);

Auto Testing

typescript
import codebolt from '@anthropic/codeboltjs';

const suite = await codebolt.autoTesting.createSuite({
  name: 'Authentication Tests'
});

const testCase = await codebolt.autoTesting.addCaseToSuite(suite.data.suite.id, {
  name: 'Valid login',
  steps: ['Navigate', 'Enter credentials', 'Click login'],
  expectedResult: 'Redirected to dashboard'
});

const run = await codebolt.autoTesting.createRun({
  suiteId: suite.data.suite.id,
  name: 'Test Run 001'
});

Memory

typescript
import codebolt from '@anthropic/codeboltjs';

// Store JSON data
await codebolt.memory.json.save({ theme: 'dark' }, { type: 'config' });
const saved = await codebolt.memory.json.list({ type: 'config' });

// Store markdown notes
await codebolt.memory.markdown.save('# Notes', { topic: 'meetings' });
const notes = await codebolt.memory.markdown.list({ tags: ['meetings'] });

Module Reference

ModuleDescriptionReference
codebolt.fsFile system operations (read, write, search, diff)fs.md
codebolt.browserBrowser automation (navigation, screenshots, DOM)browser.md
codebolt.terminalCommand execution (sync, async, streaming)terminal.md
codebolt.gitGit operations (init, clone, commit, push, pull)git.md
codebolt.chatChat & WebSocket communication (messages, process lifecycle, notifications)chat.md
codebolt.projectProject management (settings, path, repo map, execution)project.md
codebolt.llmLLM inference with tools and model configurationllm.md
codebolt.agentAgent discovery and execution (find, start, list agents)agent.md
codebolt.threadThread management (create, start, update, delete, messages)thread.md
codebolt.todoTodo list management (add, update, delete, export, import)todo.md
codebolt.memoryPersistent memory storage (JSON, Markdown, Todo formats)memory.md
codebolt.taskTask management (create, update, delete, assign, execute)task.md
codebolt.codeutilsCode analysis, matching, and markdown generationcodeutils.md
codebolt.searchWeb search operationssearch.md
codebolt.jobJob management with pheromones, bidding, locks, blockersjob.md
codebolt.swarmSwarm orchestration with teams, roles, vacanciesswarm.md
codebolt.orchestratorOrchestrator management and controlorchestrator.md
codebolt.requirementPlanRequirement plan document management (sections, review)requirementPlan.md
codebolt.actionPlanAction plan workflow management (tasks, groups, execution)actionPlan.md
codebolt.actionBlockAction block management and executionactionBlock.md
codebolt.codebaseSearchSemantic code search and MCP tool searchcodebaseSearch.md
codebolt.mcpMCP server and tool management (configure, list, execute)mcp.md
codebolt.autoTestingAutomated testing (suites, cases, runs)autoTesting.md
codebolt.hookHook management (event triggers, actions, conditions)hook.md
codebolt.crawlerWeb crawler automation (start, navigate, scroll, click, screenshot)crawler.md
codebolt.vectordbVector database operations (store, retrieve, query vectors)vectordb.md
codebolt.historyChat history summarization (full history, partial history)history.md
codebolt.ragRAG system (placeholder)rag.md
codebolt.roadmapRoadmap management (phases, features, ideas)roadmap.md
codebolt.reviewMergeRequestReview and merge request management (create, review, merge, track)reviewMergeRequest.md
codebolt.knowledgeKnowledge base (placeholder)knowledge.md
codebolt.dbmemoryIn-memory key-value database operationsdbmemory.md

Common Patterns

File Operations

typescript
// Read, write, and search files
const content = await codebolt.fs.readFile('/path/to/file.ts');
await codebolt.fs.updateFile('file.ts', '/path/to', newContent);
const results = await codebolt.fs.grepSearch('/src', 'function', '*.ts');

Browser Automation

typescript
// Navigate, capture content, screenshot
await codebolt.browser.goToPage('https://example.com');
const markdown = await codebolt.browser.getMarkdown();
await codebolt.browser.screenshot({ fullPage: true });

Command Streaming

typescript
// Stream command output
const stream = codebolt.terminal.executeCommandWithStream('npm test');
stream.on('commandOutput', (data) => console.log('Output:', data));
stream.on('commandFinish', (data) => {
  console.log('Finished:', data);
  stream.cleanup?.();
});