This document provides the API reference for Automanic’s programmatic usage.
The AutomanicConfig class handles parsing and validation of Automanic configuration from README.md files.
from scripts.generate_structure import AutomanicConfig
config_parser = AutomanicConfig()
config = config_parser.parse_readme('README.md')
parse_readme(readme_path: str) -> Dict[str, str]Parses configuration from a README.md file.
Parameters:
readme_path (str): Path to the README.md file containing the configuration block.Returns:
Dict[str, str]: Dictionary containing the parsed configuration values.Raises:
Exception: If the configuration block is not found or contains invalid values.Example:
config = config_parser.parse_readme('path/to/README.md')
print(config['PROJECT_TYPE']) # Output: 'web-app'
print(config['LANGUAGE']) # Output: 'python'
_validate_config(config: Dict[str, str]) -> NoneValidates the parsed configuration values against valid options.
Parameters:
config (Dict[str, str]): Dictionary containing configuration key-value pairs.Raises:
Exception: If required fields are missing or values are invalid.The StructureGenerator class generates project structure based on configuration.
from scripts.generate_structure import StructureGenerator
generator = StructureGenerator(config)
generator.generate_structure()
generate_structure() -> NoneGenerates the complete project structure based on the provided configuration.
Example:
from scripts.generate_structure import AutomanicConfig, StructureGenerator
# Parse configuration
config_parser = AutomanicConfig()
config = config_parser.parse_readme('README.md')
# Generate structure
generator = StructureGenerator(config)
generator.generate_structure()
The ProjectStructureCreator class creates detailed project files and directories.
from scripts.create_structure import ProjectStructureCreator
creator = ProjectStructureCreator()
creator.create_structure()
create_structure() -> NoneCreates the complete project structure including source files, tests, documentation, and configuration.
The DevEnvironmentSetup class sets up the development environment with necessary tools and configurations.
from scripts.setup_dev_env import DevEnvironmentSetup
setup = DevEnvironmentSetup()
setup.setup_environment()
setup_environment() -> NoneSets up the complete development environment including:
The WorkflowGenerator class generates GitHub Actions workflows based on project configuration.
from scripts.setup_workflows import WorkflowGenerator
generator = WorkflowGenerator()
generator.generate_workflows()
generate_workflows() -> NoneGenerates all necessary GitHub Actions workflow files:
./scripts/setup.sh
Automatically configures repository structure based on README.md configuration.
Options:
README.md in the current directory./scripts/interactive-setup.sh
Runs the interactive setup wizard that guides you through configuration options.
Process:
python scripts/generate-structure.py --config-file README.md
Generates project structure from a configuration file.
Arguments:
--config-file: Path to the README.md file with configuration (default: README.md)python scripts/validate.py
Validates the Automanic installation and configuration.
Checks:
The configuration block must be placed in your README.md:
<!-- AUTOMANIC-CONFIG-START -->
PROJECT_TYPE: web-app
LANGUAGE: python
FRAMEWORK: fastapi
BUILD_SYSTEM: pip
DATABASE: postgresql
DEPLOYMENT: docker
CI_CD: github-actions
TESTING: pytest
LICENSE_TYPE: mit
VISIBILITY: public
<!-- AUTOMANIC-CONFIG-END -->
All fields are required:
| Field | Type | Description |
|---|---|---|
PROJECT_TYPE |
string | Type of project |
LANGUAGE |
string | Programming language |
FRAMEWORK |
string | Framework to use |
BUILD_SYSTEM |
string | Build system |
DATABASE |
string | Database system |
DEPLOYMENT |
string | Deployment platform |
CI_CD |
string | CI/CD platform |
TESTING |
string | Testing framework |
LICENSE_TYPE |
string | License type |
VISIBILITY |
string | Repository visibility |
Exception: Automanic configuration block not found in README.md
Ensure your README.md contains the configuration block between <!-- AUTOMANIC-CONFIG-START --> and <!-- AUTOMANIC-CONFIG-END -->.
Exception: Missing required fields: FIELD_NAME
Add the missing field to your configuration block.
Exception: Invalid value 'VALUE' for field 'FIELD'. Valid values: ...
Use one of the valid values listed in the error message.
# .github/workflows/setup.yml
name: Setup New Project
on:
workflow_dispatch:
inputs:
project_type:
description: 'Project type'
required: true
default: 'web-app'
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Automanic Setup
run: python scripts/generate-structure.py
FROM python:3.11-slim
WORKDIR /app
COPY scripts/ ./scripts/
COPY README.md .
RUN python scripts/generate-structure.py