@podut/cwescan-sdk
v0.3.0
Published
JavaScript/TypeScript SDK for CWEScan
Maintainers
Readme
podut cwescan SDK
⚠️ Work in Progress: This SDK is currently under active development. The API is subject to change and may introduce breaking changes in future releases.
@podut/cwescan-sdk is an HTTP/REST based client for TypeScript, built on top of the cwescan API.
Why cwescan?
LLMs rely on outdated or generic training data about the libraries you use. This leads to:
- Code examples based on year-old training data
- Hallucinated APIs that don't exist
- Generic answers for old package versions
cwescan solves this by providing up-to-date, version-specific documentation and code examples directly from the source. Use this SDK to:
- Build AI agents with accurate, current documentation context
- Create RAG pipelines with reliable library documentation
- Power code generation tools with real API references
Quick Start
Install
npm install @podut/cwescan-sdkGet API Key
Get your API key from cwescan
Basic Usage
import { cwescan } from "@podut/cwescan-sdk";
const client = new cwescan({
apiKey: "<cwescan_API_KEY>",
});
// Search for libraries
const libraries = await client.searchLibrary(
"I need to build a UI with components",
"react"
);
console.log(libraries[0].id); // "/facebook/react"
// Get documentation as JSON array (default)
const docs = await client.getContext("How do I use hooks?", "/facebook/react");
console.log(docs[0].title, docs[0].content);
// Get documentation context as plain text
const context = await client.getContext(
"How do I use hooks?",
"/facebook/react",
{ type: "txt" }
);
console.log(context);Configuration
Environment Variables
You can set your API key via environment variable:
cwescan_API_KEY=cwescansk-...Then initialize without options:
const client = new cwescan();Docs
See the documentation for details.
Contributing
Running tests
pnpm testBuilding
pnpm build