codevf-js-sdk
v0.0.1
Published
A modular TypeScript SDK for integrating with the CodeVF API. Submit tasks for human review, manage projects, track credits, and leverage engineer expertise levels.
Readme
CodeVF JS SDK
A modular TypeScript SDK for integrating with the CodeVF API. Submit tasks for human review, manage projects, track credits, and leverage engineer expertise levels.
Features
- Project Management - Create and organize projects for grouping API tasks
- Task Submission - Submit tasks for human engineer review with customizable service levels
- Credit System - Monitor your credit balance and usage across tasks
- Engineer Expertise - Select engineer expertise levels with cost multipliers
- File Attachments - Attach screenshots, logs, code files, and documents to tasks
- Comprehensive Error Handling - Typed error classes for all HTTP status codes and failure modes
Quick Start
Installation
bun installBasic Usage
import { createClient, createProject, createTask } from 'codevf-js-sdk';
// Initialize the SDK
const client = createClient({ apiKey: 'your-api-key' });
// Create a project
const project = await createProject(client, {
name: 'My API Project',
description: 'Project for API integration'
});
// Submit a task for review
const task = await createTask(client, {
prompt: 'Review this authentication system',
projectId: project.id,
maxCredits: 100,
mode: 'fast'
});
// Check task status
const status = await getTask(client, task.id);
// Check credit balance
const balance = await getBalance(client);Architecture
The SDK follows a modular architecture with strict separation between internal core logic and public API modules:
- Core (
/src/core) - Internal HTTP client, authentication, error handling, and configuration - Modules (
/src/modules) - Public feature domains: projects, tasks, credits, tags - Types (
/src/types) - Shared TypeScript interfaces used across modules
API Reference
Projects
createProject(client, data)- Create a new project for grouping tasks
Tasks
createTask(client, data)- Submit a task for human engineer reviewgetTask(client, taskId)- Retrieve task status and resultscancelTask(client, taskId)- Cancel a pending or in-progress task
Credits
getBalance(client)- Check current credit balance, available and on-hold amounts
Tags
getTags(client)- Get available engineer expertise levels with cost multipliers
Error Handling
The SDK provides typed error classes for granular error handling:
BadRequestError(400) - Invalid parameters or malformed requestAuthError(401) - Invalid or missing API keyInsufficientCreditsError(402) - Not enough credits to complete taskNotFoundError(404) - Resource not found or access deniedConflictError(409) - Idempotency conflictPayloadTooLargeError(413) - Request exceeds size limitRateLimitError(429) - Rate limit exceededServerError(500) - Internal server errorNetworkError- Connection or timeout issues
Running Tests
bun testTests are organized in /tests directory with the same structure as source code. Uses vitest for testing framework.
Development
This project uses Bun as the runtime and build tool:
bun run index.ts- Execute main entry pointbun test- Run test suitebun docs- Generate TypeDoc documentation
Requirements
- Bun v1.3.6+
- TypeScript 5+
License
MIT
