npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

extrix-intel

v1.0.0

Published

AI-powered dev tools pack for code explanation, refactoring, test generation, documentation, and schema design

Downloads

105

Readme

Extrix SDK

enter image description here

Features

  • Code Explanation: Get clear, comprehensive explanations of any code

  • Smart Refactoring: Refactor code with AI-guided improvements

  • Test Generation: Automatically generate comprehensive test suites

  • Documentation Generation: Create README and API documentation

  • Schema Design: Convert text descriptions to SQL schemas and ERD diagrams

Installation


npm  install  extrix-intel

Setup

Extrix uses OpenAI's GPT models for AI-powered features. You need an OpenAI API key to use this package.

Option 1: Environment Variable (Recommended)


export  OPENAI_API_KEY='your-api-key-here'

Option 2: Pass API Key Directly


import { DevTools } from  'extrix';

  

const  dev = new  DevTools({

apiKey:  'your-api-key-here'

});

Optional: Configure Model


const  dev = new  DevTools({

apiKey:  'your-api-key-here',

model:  'gpt-4-turbo-preview'  // default

});

Usage

1. Explain Code

Get detailed explanations of any code snippet or file.


import { DevTools } from  'extrix';

  

const  dev = new  DevTools();

  

// Explain code snippet

const  result = await  dev.explain(`

function fibonacci(n) {

if (n <= 1) return n;

return fibonacci(n - 1) + fibonacci(n - 2);

}

`);

  

console.log(result.explanation);

  

// Or explain from file

const  fileResult = await  dev.explain('./src/complex-logic.js');

console.log(fileResult.explanation);

2. Refactor Code

Refactor code with specific goals in mind.


const  result = await  dev.refactor(

`

function calc(a, b, op) {

if (op === 'add') return a + b;

if (op === 'sub') return a - b;

if (op === 'mul') return a * b;

if (op === 'div') return a / b;

}

`,

'Use strategy pattern and add error handling'

);

  

console.log(result.refactored);

console.log(result.response); // Explanation of changes

3. Generate Tests

Automatically create comprehensive test suites.


const  code = `

export function validateEmail(email) {

const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

return regex.test(email);

}

`;

  

const  result = await  dev.generateTests(code, {

framework:  'Jest'  // optional, auto-detected

});

  

console.log(result.tests);

  

// Save tests to file

await  dev.saveOutput(result.tests, './tests/validateEmail.test.js');

4. Generate Documentation

Create README or API documentation.


// Generate README

const  readme = await  dev.generateDocs('./src/index.js', {

type:  'README'

});

  

console.log(readme.documentation);

await  dev.saveOutput(readme.documentation, './README.md');

  

// Generate API docs

const  apiDocs = await  dev.generateDocs('./src/api.js', {

type:  'API'

});

  

console.log(apiDocs.documentation);

5. Schema from Text (Killer Feature!)

Convert natural language descriptions into SQL schemas and ERD diagrams.


const  schema = await  dev.schemaFromText(`

I need a blog system with users, posts, and comments.

Users can write multiple posts.

Each post can have many comments.

Comments are written by users.

Track timestamps for everything.

`);

  

console.log('SQL Schema:');

console.log(schema.sql);

  

console.log('\nERD Diagram (Mermaid):');

console.log(schema.erd);

  

// Save outputs

await  dev.saveOutput(schema.sql, './schema.sql');

await  dev.saveOutput(schema.erd, './erd.md');

You can also specify the SQL dialect:


const  schema = await  dev.schemaFromText(

'E-commerce system with products, orders, and customers',

{ dialect:  'mysql' }

);

API Reference

new DevTools(config)

Create a new DevTools instance.

Parameters:

  • config.apiKey (string, optional): OpenAI API key. Falls back to OPENAI_API_KEY env var

  • config.model (string, optional): OpenAI model to use. Default: 'gpt-4-turbo-preview'

dev.explain(code, options)

Explain code functionality.

Parameters:

  • code (string): Code snippet or file path

  • options.language (string, optional): Programming language (auto-detected if not provided)

Returns: Object with { code, language, explanation, source }

dev.refactor(code, goal, options)

Refactor code with a specific goal.

Parameters:

  • code (string): Code snippet or file path

  • goal (string): Refactoring goal/objective

  • options.language (string, optional): Programming language (auto-detected if not provided)

Returns: Object with { original, refactored, language, goal, response, source }

dev.generateTests(code, options)

Generate test suite for code.

Parameters:

  • code (string): Code snippet or file path

  • options.language (string, optional): Programming language (auto-detected)

  • options.framework (string, optional): Testing framework (auto-detected based on language)

Returns: Object with { code, tests, language, framework, response, source }

dev.generateDocs(pathOrCode, options)

Generate documentation.

Parameters:

  • pathOrCode (string): Code snippet or file path

  • options.type (string, optional): 'README' or 'API'. Default: 'README'

  • options.language (string, optional): Programming language (auto-detected)

Returns: Object with { code, documentation, language, type, source }

dev.schemaFromText(text, options)

Generate SQL schema and ERD from text description.

Parameters:

  • text (string): Natural language description of database requirements

  • options.dialect (string, optional): SQL dialect ('postgresql', 'mysql', 'sqlite'). Default: 'postgresql'

  • options.includeERD (boolean, optional): Include ERD diagram. Default: true

Returns: Object with { description, sql, erd, dialect, response }

dev.saveOutput(content, filePath)

Save output to file.

Parameters:

  • content (string): Content to save

  • filePath (string): Destination file path

Returns: Object with { saved, path }

Supported Languages

  • JavaScript / TypeScript

  • Python

  • Java

  • Go

  • Rust

  • Ruby

  • PHP

  • SQL

  • And more (auto-detected)

Examples

Check the examples/ directory for more usage examples:

  • basic-usage.js - Basic feature demonstrations

  • test-all.js - Comprehensive testing example

Requirements

  • Node.js >= 16.0.0

  • OpenAI API key

Error Handling


try {

const  result = await  dev.explain(code);

console.log(result.explanation);

} catch (error) {

if (error.message.includes('API key')) {

console.error('Please set your OpenAI API key');

} else {

console.error('Error:', error.message);

}

}

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please open an issue on GitHub.