Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Docgenie is a powerful command-line tool that leverages advanced AI models to automatically generate comprehensive documentation for your projects. It supports various documentation types, including general documentation, README files, API documentation, and code model explanations.
Docgenie requires Python 3.8.1 or higher. To install it, run the following command:
pip install docgenie
Initialize Configuration:
Run docgenie init
to create a docgenie.config.json
file in your project root directory. This file contains the configuration settings for Docgenie.
Configure the AI Agent:
custom-api
as the AI agent if you want to use your own API endpoint for documentation generation. You will need to provide the API URL, headers, and query parameters.gemini-*
as the AI agent to leverage Google's Gemini model. You will need to set the DOCGENIE_MODEL_API_KEY
environment variable to your Gemini API key.Define Documentation Rules:
general
, readme
, api
, model
).*
and ?
are supported).*
and ?
are supported).markdown
, html
, text
).Example docgenie.config.json
:
{
"root_dir": ".", // Root directory of your project
"agent": {
"name": "custom-api", // Name of the AI model to use
"config": {
"url": "", // API URL for custom API model (if applicable)
"headers": {}, // Headers for custom API model (if applicable)
"query": {} // Query parameters for custom API model (if applicable)
}
},
"rules": [
{
"type": "general", // Type of documentation to generate (general, api, readme, model)
"dir": ".", // Directory to generate documentation for
"include": [], // Patterns to include (using wildcard characters * and ?)
"exclude": [], // Patterns to exclude (using wildcard characters * and ?)
"output": ".", // Output directory
"depth": 3, // Search depth for code analysis
"format": "markdown", // Output format (markdown, html, text)
"prompt": "" // Additional prompt for the AI model
}
]
}
To generate documentation, run the following command:
docgenie build
Docgenie will process your code files based on the defined rules and generate documentation in the specified output directory.
{
"root_dir": ".",
"agent": {
"name": "gemini-1.5-flash",
"config": {}
},
"rules": [
{
"type": "general",
"dir": ".",
"include": ["*.py"],
"exclude": ["test_*"],
"output": "docs",
"depth": 3,
"format": "markdown"
}
]
}
{
"root_dir": "./my_api",
"agent": {
"name": "gemini-1.5-pro"
},
"rules": [
{
"type": "api",
"dir": "./my_api/routes",
"include": ["*.js"],
"output": "./docs/api"
}
]
}
The code is structured as follows:
build
and init
commands.docgenie.config.json
:
root_dir
: Specifies the root directory of the project. Defaults to the current directory.
agent
:
name
: The name of the AI agent to use. Supported values: gemini-1.5-flash
, custom-api
.
config
:
For custom-api
:
url
: The URL of the custom API endpoint.headers
: A dictionary of headers to be sent with the API request.query
: A dictionary of query parameters to be sent with the API request.Note: You can use {DOCGENIE_MODEL_API_KEY} and {DOCGENIE_MODEL_PROMPT} placeholders in the URL, headers, and query parameters, which will be replaced with the actual API key and prompt during runtime.
rules
: An array of objects representing the documentation rules. Each rule object has the following properties:
type
: The type of documentation to generate. Supported values: general
, readme
, api
, model
.dir
: The directory where the code files reside.include
: An array of patterns for files to be included in the documentation generation process.exclude
: An array of patterns for files to be excluded from the documentation generation process.output
: The directory where the generated documentation files will be saved.depth
: The depth of the directory search for code files.format
: The output format for the documentation. Supported values: markdown
, html
, text
.prompt
: Additional instructions or context for the AI agent.DOCGENIE_MODEL_API_KEY
: The API key for the Gemini model.Contributions are welcome! Please follow the standard contribution guidelines:
Docgenie is licensed under the MIT License.
The documentation is generated using AI by docgenie. If you found any issues, please report them to the team.
FAQs
A tool for generating documentation
We found that docgenie demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.