kernel-pilot
TypeScript icon, indicating that this package has built-in type declarations

0.0.23 • Public • Published

Kernal Pilot

A Next.js package that provides AI-powered file analysis capabilities.

Installation

npm install kernel-pilot

Usage

  1. Start the analysis server:
npx kernel-pilot start
  1. In your Next.js application:
import { analyzeFile, FileAnalyzer } from 'kernal-pilot';

// Using the React component
function MyComponent() {
  const handleAnalysisComplete = (result) => {
    console.log('Analysis result:', result);
  };

  return <FileAnalyzer onAnalysisComplete={handleAnalysisComplete} />;
}

// Or using the function directly
async function analyzeMyFile() {
  try {
    const result = await analyzeFile({
      filePath: '/path/to/file',
      prompt: 'Your analysis prompt'
    });
    console.log('Analysis result:', result);
  } catch (error) {
    console.error('Analysis failed:', error);
  }
}

Or

  1. Use Code Generator:
import { CodeGenerator } from 'kernal-pilot';

function MyComponent() {
  const handleGenerationComplete = (filePath: string) => {
    console.log('Code generated at:', filePath);
  };

  return (
    <CodeGenerator onGenerationComplete={handleGenerationComplete} />
  );
}

API

// Using fetch
const response = await fetch('http://localhost:4561/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    prompt: 'Create functions with error cases like division by zero',
    filename: 'error-cases.js'
  })
});

const result = await response.json();
console.log('Generated file path:', result.filePath);

analyzeFile(options)

Analyzes a file using AI.

Parameters:

  • options.filePath: Path to the file to analyze
  • options.prompt: Prompt for the AI analysis

Returns: Promise with analysis results

FileAnalyzer Component

React component for file analysis.

Props: <<<<<<< HEAD

  • onAnalysisComplete: Callback function called with analysis results =======
  • onAnalysisComplete: Callback function called with analysis results

main

Readme

Keywords

Package Sidebar

Install

npm i kernel-pilot

Weekly Downloads

5

Version

0.0.23

License

MIT

Unpacked Size

34 kB

Total Files

12

Last publish

Collaborators

  • tanishbasu
  • souvik-223