Skip to content

codellm-devkit/typescript-sdk

Repository files navigation

Logo

A framework that bridges the gap between traditional program analysis tools and Large Language Models (LLMs) specialized for code (CodeLLMs).

Overview

This is the TypeScript SDK for the Codellm-Devkit (CLDK). The SDK provides a unified interface for integrating outputs from various analysis tools and preparing them for effective use by CodeLLMs. It allows developers to streamline the process of transforming raw code into actionable insights.

📦 Installation

To install the SDK, you can use bun, npm, or yarn. Run the following command in your terminal:

  1. Using npm

    npm i @codellm-devkit/cldk
  2. Using yarn

    yarn add @codellm-devkit/cldk
  3. Using bun

    bun add @codellm-devkit/cldk

🚀 Quickstart

  1. Create a Temporary Directory

    mkdir cldk-quickstart
    cd cldk-quickstart
  2. Initialize a Bare Project

    bun init -y

    This creates a minimal package.json instantly.

  3. Install @codellm-devkit/cldk

    bun add @codellm-devkit/cldk
  4. Create a file test-analysis.ts with the following content:

    import { CLDK } from "cldk";
    
    // Initialize Java analysis
    const analysis = CLDK.for("java").analysis({
        projectPath: "/path/to/your/java/project",
        analysisLevel: "Symbol Table",
    });
    
    // Retrieve structured application model
    const jApplication = await analysis.getApplication();
    console.log("Parsed JApplication:", jApplication);
    
    // Retrieve the symbol table
    const symbolTable = await analysis.getSymbolTable();
    console.log("Symbol Table:", symbolTable);
  5. Run the Script

    bun test-analysis.ts

🛠️ Development Instructions

Developing Locally (with Bun)

  1. Clone the repository:

    git clone https://github.com/codellm-devkit/typescript-sdk.git
    cd typescript-sdk
  2. If you don't have it already, pleaes install Bun:

    curl -fsSL https://bun.sh/install | bash

    Note: follow any post-installation instructions to complete the installation

  3. Install the dependencies

    bun install
  4. Run tests:

    bun run test

Developing inside a Container (Using Dev Containers)

  1. If you don't, ensure you have Docker/Podman and a compatible editor (e.g., VS Code) with the Dev Containers extension installed.

  2. Open the repository in your editor. When prompted, reopen the project in the dev container. The devcontainer is configured to come pre-installed with bun and all the necessary dependencies.

  3. You can start by run tests:

    bun run test