JavaScript SDK
Official TypeScript/JavaScript SDK for ArchiCore API.
Installation
npm install @archicore/sdk
# or
yarn add @archicore/sdk
# or
pnpm add @archicore/sdk
Requirements
- Node.js 16+
- TypeScript 4.5+ (optional, for type safety)
Quick Start
import { ArchiCore } from '@archicore/sdk';
const client = new ArchiCore({ apiKey: 'your-api-key' });
// List all projects
const projects = await client.projects.list();
console.log(projects);
Configuration
const client = new ArchiCore({
apiKey: 'your-api-key', // Required
baseUrl: 'https://api.archicore.io/api/v1', // Optional
timeout: 30000, // Optional, in milliseconds
});
Projects
List Projects
const projects = await client.projects.list();
// Returns: Project[]
Get Project
const project = await client.projects.get('project-id');
// Returns: Project
Create Project
const project = await client.projects.create({
name: 'my-project',
source: '/path/to/project', // Optional
githubUrl: 'https://github.com/user/repo', // Optional
});
Delete Project
await client.projects.delete('project-id');
Index Project
const status = await client.projects.index('project-id', {
force: true // Optional, re-index even if already indexed
});
Search
Semantic Search
Find code by natural language:
const results = await client.projects.search('project-id', {
query: 'authentication middleware',
limit: 10, // Optional, default 10
threshold: 0.7, // Optional, similarity threshold 0-1
});
for (const result of results) {
console.log(`${result.file}:${result.line} (${result.score})`);
console.log(result.code);
}