autodoc-engine-cli
v1.0.4
Published
<p align="center"> <img src="https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white" alt="Node.js"> <img src="https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white" a
Readme
Autodoc Engine CLI
Dynamic Autonomous Codebase Documentation & File Generation Engine
The Autodoc Engine CLI is a powerful command-line interface tool designed to automate the generation of codebase documentation, architectural blueprints, and even facilitate intelligent code refactoring operations. Leveraging an external AI-powered service, it deeply analyzes your project's file structure and content to produce relevant, high-quality output tailored to your specifications.
Whether you need a README.md for your new repository, a LICENSE file for open-source distribution, or custom documentation for a specific file or directory, autodoc-cli streamlines the process, saving developers valuable time.
✨ Features
- AI-Powered Generation: Connects to a remote LLM tier to generate context-aware documentation and code.
- Intelligent Project Sensing: Automatically scans and maps your project's file tree, intelligently filtering out irrelevant files and directories (e.g.,
node_modules,.git,dist). - Versatile Output Formats: Supports generation of common project files like
README.md,LICENSE,CONTRIBUTING.md, and custom documentation for specific files or folders. - Custom Instructions: Provide raw context steering directives to the remote LLM for highly customized output.
- Targeted Analysis: Specify a particular path within your project for focused documentation or refactoring.
- Smart Output Routing: Automatically handles naming conventions for documentation files to avoid overwriting source code, and directly applies changes for refactoring operations.
- Interactive & Direct Modes:
- Interactive Mode: A user-friendly, guided interface for common documentation tasks.
- Direct Mode: Command-line options for scripting and advanced usage.
- Real-time Feedback: Features a terminal spinner to indicate ongoing operations.
- Cross-Platform Compatibility: Normalizes file paths for consistent behavior across different operating systems.
🚀 How It Works
The autodoc-cli operates by performing the following steps:
- Workspace Sensing: It first resolves your target project path and recursively scans its file system, building a comprehensive map of your codebase.
- Context Aggregation: Relevant files (based on critical extensions like
.ts,.js,.json,.md, etc.) are read into a system buffer cache, with their content truncated to optimize payload size. - Remote AI Processing: The aggregated file tree and selected file contexts, along with your specified documentation type and custom instructions, are securely transmitted to a remote AI service (
SERVER_API_URL). - Content Generation/Refactoring: The AI service processes this information to generate the requested documentation or perform the specified code refactoring.
- Output Delivery: The generated content (Markdown or code) is returned to the CLI, which then saves it to your local filesystem at the appropriate location, handling file naming and directory creation as needed.
📦 Installation
To use autodoc-cli, you need Node.js installed on your system.
Global Installation (Recommended for CLI Tools):
npm install -g autodoc-engine-cliThis will make the autodoc-cli command available globally in your terminal.
Local Development (for contributors):
- Clone the repository:
git clone https://github.com/your-repo/autodoc-engine-cli.git # Replace with actual repo URL cd autodoc-engine-cli - Install dependencies:
npm install - Build the TypeScript project:
npm run build - Link the CLI tool locally for testing:
You can now runnpm linkautodoc-clifrom any directory to test your local changes.
💡 Usage
Interactive Mode
Simply run the command without any arguments to enter the interactive prompt:
autodoc-cliYou will be presented with a menu to select the type of documentation you want to generate:
================================================================
AUTODOC ENGINE CORE: INTERACTIVE DEVELOPMENT INTERFACE
================================================================
Select the architectural documentation output template to execute:
[1] Standard README.md Blueprint Layout
[2] Open-Source Distribution LICENSE Text Boilerplate
[3] CONTRIBUTING.md Repository Deployment Ruleset
[4] Custom Scope (Target custom files or custom analysis modules)Follow the prompts to specify your requirements.
Direct Mode
You can also use command-line options for more direct control:
autodoc-cli [options]Options:
-t, --type <type>: Specifies the output variant target. This can be a common file likeREADME.md,LICENSE,CONTRIBUTING.md, or a custom file path (e.g.,src/components/MyComponent.md,server/api/route.ts).-p, --path <path>: Specifies the target filesystem resolution depth routing. This is the directory to scan for files. Defaults to./(current directory).-i, --instruct <instruction>: Provides raw context steering directives for the remote LLM tier. Use this for specific requirements or complex generation tasks.
Examples:
Generate a
README.mdfor the current directory:autodoc-cli -t README.mdGenerate a
LICENSEfile for a specific project folder:autodoc-cli -t LICENSE -p ./my-project-rootGenerate custom documentation for a
server/users.tsfile with specific instructions:autodoc-cli -t server/users.ts-documentation.md -i "Explain the API endpoints and data models for user management, focusing on security considerations."Perform an inline refactoring operation on a file (if supported by the remote API, indicated by
--typematching an existing code file):autodoc-cli -t src/utils/helper.ts -i "Refactor this utility file to use modern ES modules and add JSDoc comments to all functions."Note: The system intelligently determines if an operation is for documentation or refactoring based on the
--typeand the remote API's response. For refactoring, the target file is directly modified.
⚙️ Configuration
The CLI communicates with an external API endpoint defined internally:
SERVER_API_URL:https://cli-puce.vercel.app/api/agentThis URL is crucial for the core functionality of theautodoc-clias it hosts the AI-powered generation engine. The CLI requires an active internet connection to reach this service.
🛠️ Development
This project is built with TypeScript and Node.js.
Build
To compile the TypeScript source code into JavaScript:
npm run buildThis command will output the compiled JavaScript files to the dist directory.
TypeScript Configuration
The tsconfig.json specifies the TypeScript compiler options:
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"types": ["node"],
"outDir": "./dist"
}
}🤝 Contributing
Contributions are welcome! Please feel free to open issues or submit pull requests.
📄 License
This project is licensed under the ISC License. See the LICENSE file for more details.
