VAI Command Line Runner: Streamlining Your ThorAPI Workflow
The ValkyrAI Command Line Runner, ./vai
, is a powerful tool designed to simplify and automate common tasks within your ThorAPI project. This document provides a comprehensive guide to using the VAI command-line runner, detailing its functionalities and how it can streamline your development workflow.
Overview of VAI Capabilities
The ./vai
command-line runner offers a range of functionalities to manage and automate your ThorAPI project tasks. It allows you to:
- Clean Generated Files: Remove previously generated files to ensure a clean state before generating new code.
- Run OpenAPI Enhancer: Enhance your OpenAPI specification with additional features and configurations.
- Build the Generator: Compile and build the ThorAPI code generator.
- Generate Output Stacks: Generate the complete FEBE stack and supporting documentation based on your OpenAPI specification.
By automating these tasks, VAI significantly reduces manual effort, minimizes errors, and accelerates your development cycles.
Getting Started with VAI
To use the VAI command-line runner, navigate to the root directory of your ThorAPI project in your terminal. Ensure that the vai
script has execute permissions. If not, you can grant execute permissions using:
chmod +x vai
Once you have execute permissions, you can run VAI commands directly from your terminal.
VAI Commands and Options
1. Clean Generated Files
Command: ./vai clean
The clean
command removes all previously generated files from your ThorAPI project. This is useful when you want to regenerate the entire project from scratch or ensure a clean build.
Usage:
./vai clean
This command will delete the generated
directory and its contents, removing all generated backend and frontend code.
2. Run OpenAPI Enhancer
Command: ./vai enhance
The enhance
command runs the OpenAPI Enhancer, which processes your OpenAPI specification and adds enhancements or modifications as configured. This step is crucial for preparing your OpenAPI spec for code generation.
Usage:
./vai enhance
This command will execute the OpenAPI Enhancer and modify your openapi.yaml
file in place with the applied enhancements.
3. Build the Generator
Command: ./vai build
The build
command compiles and builds the ThorAPI code generator. This step is necessary if you have made changes to the generator code itself or are setting up the project for the first time.
Usage:
./vai build
This command will compile the generator code and prepare it for generating output stacks.
4. Generate Output Stacks
Command: ./vai generate
The generate
command is the core functionality of VAI. It generates the complete output stacks, including the FEBE stack and documentation, based on your OpenAPI specification.
Usage:
./vai generate
This command will read your openapi.yaml
file, run the code generator, and output the generated backend and frontend projects into the generated
directory.
Combining Commands
You can combine VAI commands to perform a sequence of tasks in a single command. For example, to clean the project, enhance the OpenAPI spec, build the generator, and then generate the output stacks, you can use:
./vai clean && ./vai enhance && ./vai build && ./vai generate
This command chain ensures that each step is executed in order, providing a complete and automated workflow for ThorAPI project generation.
Example Workflow
A typical ThorAPI development workflow using VAI might look like this:
- Modify OpenAPI Specification: Update your
openapi.yaml
file to reflect changes in your API design. - Enhance OpenAPI Specification: Run
./vai enhance
to apply any configured enhancements to your OpenAPI spec. - Generate Output Stacks: Execute
./vai generate
to regenerate the FEBE stack and documentation based on the updated OpenAPI spec. - Build and Deploy: Build the generated backend and frontend projects and deploy them to your target environments.
By using VAI, you can automate steps 2 and 3, significantly reducing the manual effort required to update your generated code when your API specification changes.
Advanced Usage and Customization
For advanced usage and customization options, refer to the ThorAPI documentation and configuration files. You can customize the VAI script itself to add additional commands or modify existing ones to suit your specific workflow requirements.
Conclusion
The VAI command-line runner is an indispensable tool for streamlining your ThorAPI development workflow. By automating tasks such as cleaning generated files, enhancing OpenAPI specs, building the generator, and generating output stacks, VAI enhances productivity, reduces errors, and accelerates your development cycles.
Start using ./vai
today to unlock the full potential of ThorAPI and revolutionize your API development workflow!