New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ai-docs

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-docs

AI-DOCS is a powerful documentation generator. It analyzes the source code and automatically generates comprehensive documentation, helping you to create meaningful and easy-to-understand references for your projects.

  • 1.0.11
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

AI-DOCS

AI-DOCS is a powerful documentation generator. It analyzes the source code and automatically generates comprehensive documentation, helping you to create meaningful and easy-to-understand references for your projects.

This package is primarily focused on generating:

  1. Getting started guides
  2. Overviews
  3. Summaries from project structure
  4. Descriptions of individual files
  5. Folder level summaries

version License: MIT

Installation

Use the package manager npm to install AI-DOCS.

npm install ai-docs

Getting Your PolyFact Token

AI-DOCS uses the powerful package called PolyFact to generate AI responses. To use it, you need to get a PolyFact token.

Follow these steps to get your PolyFact token:

  1. Go to app.polyfact.com.
  2. Connect with GitHub.
  3. Copy the token.

Then, you need to export the PolyFact token in your environment:

export POLYFACT_TOKEN=<your_polyfact_token>

Remember to replace <your_polyfact_token> with your actual token.

Usage

To use AI-DOCS, you need to import various functions from the package and use them in your script to generate documentation. The functions should be executed in the order they are shown below. This ensures correct cross-referencing and linking within the generated documentation.

Here's a detailed usage example with each function:

import {
  generateReferenceForEachFile,
  extractDescriptionFromReference,
  generateFolderSummaryInAllFolders,
  generateGettingStarted,
  generateOverview,
  generateSummaryFromStructure,
} from "ai-docs-package";
const filesList: File[] = [
  {
    content: "\n          def add(a, b):\n              return a + b\n      ",
    name: "add.py",
    path: "src/add.py",
  },
  // ...other files...
];
  1. generateReferenceForEachFile

    This function generates a reference for each file in your project. The progress callback allows you to track the progress of the reference generation.

generateReferenceForEachFile(filesList, (file: Reference, progress: number) => {
  console.log(`Generated references for ${file.name}. Progress: ${progress}%`);
})
.then((references) => {
  console.log("All references generated.");
});
  1. extractDescriptionFromReference

    This function extracts descriptions from the generated references.

const descriptions = extractDescriptionFromReference(references);
console.log(descriptions);
  1. generateFolderSummaryInAllFolders

    This function generates a summary for each folder in your project. The progress callback allows you to track the progress of the summary generation.

generateFolderSummaryInAllFolders(descriptions, (content: string, path: string, progress: number) => {
  console.log(`Generated summary for folder ${path}. Progress: ${progress}%`);
})
.then((folderSummaries) => {
  console.log("All folder summaries generated.");
});
  1. generateSummaryFromStructure

    This function generates a summary from your project's structure.

generateSummaryFromStructure(filesList)
.then((structureSummary) => {
  console.log(structureSummary);
});
  1. generateOverview

    This function generates an overview of your project.

generateOverview(folderSummaries, structureSummary)
.then((overview) => {
  console.log(overview.result);
});
  1. generateGettingStarted

    This function generates a "getting started" guide for your project.

generateGettingStarted(references, structureSummary, overview)
.then((gettingStarted) => {
  console.log(gettingStarted);
});

Scripts

This package provides several npm scripts for development:

  • npm run lint : Lint the codebase using ESLint.
  • npm run build : Compile TypeScript source files to JavaScript (dist/).
  • npm start : Run the compiled JavaScript entrypoint.
  • npm test : Run the Mocha test suite.
  • npm run test:watch : Run the Mocha test suite in watch mode.
  • npm run prepare : Set up Git Hooks using Husky.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Need Help?

If you run into any issues or need help, please raise an issue on the GitHub issue tracker.

Keywords

FAQs

Package last updated on 25 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc