"""Basic template definitions for Attune AI.

Contains the minimal and python-cli template definitions used
by the template engine to scaffold new projects.

Copyright 2025 Smart-AI-Memory
Licensed under the Apache License, Version 2.0
"""

from typing import Any

MINIMAL_TEMPLATE: dict[str, Any] = {
    "name": "Minimal",
    "description": "Just the Attune config files - add to existing project",
    "files": {
        "attune.config.yml": """# Attune AI Configuration
# Generated by: attune new minimal

user_id: "{{project_name}}"
target_level: 4
confidence_threshold: 0.75

# Model routing for cost optimization
model_routing:
  enabled: true
  provider: "anthropic"
  models:
    cheap: "claude-haiku-4-5-20251001"
    capable: "claude-sonnet-4-6"
    premium: "claude-opus-4-6"

# Claude Code integration
claude_sync:
  enabled: true
  output_dir: ".claude/rules/attune"

# Persistence
persistence_enabled: true
persistence_backend: "sqlite"
persistence_path: ".attune"
metrics_enabled: true
""",
        ".claude/CLAUDE.md": """# {{project_name}} - Claude Code Rules

## Project Context

This project uses Attune AI for AI-assisted development.

## Attune Integration

Run these commands for best results:
- `attune workflow run morning` - Start-of-day briefing
- `attune workflow run ship` - Pre-commit checks
- `attune workflow run code-review` - Code review

## Coding Patterns

@patterns/debugging.json
@patterns/security.json
""",
        ".gitignore_additions": """# Attune AI
.attune/
patterns/sensitive/
*.db
""",
    },
}

PYTHON_CLI_TEMPLATE: dict[str, Any] = {
    "name": "Python CLI Tool",
    "description": "Command-line tool with Attune for smart assistance",
    "files": {
        "attune.config.yml": """# Attune AI Configuration
# Template: python-cli

user_id: "{{project_name}}"
target_level: 4
confidence_threshold: 0.75

model_routing:
  enabled: true
  provider: "anthropic"
  models:
    cheap: "claude-haiku-4-5-20251001"
    capable: "claude-sonnet-4-6"
    premium: "claude-opus-4-6"

claude_sync:
  enabled: true
  output_dir: ".claude/rules/attune"

persistence_enabled: true
persistence_backend: "sqlite"
persistence_path: ".attune"
metrics_enabled: true

inspection:
  parallel: true
  learning: true
  format: "terminal"
""",
        "{{project_name}}/__init__.py": '''"""
{{project_name}} - A CLI tool powered by Attune AI
"""

__version__ = "0.1.0"
''',
        "{{project_name}}/cli.py": '''"""
Command-line interface for {{project_name}}
"""

import argparse
from attune import AttuneOS, load_config


def main():
    parser = argparse.ArgumentParser(
        prog="{{project_name}}",
        description="{{project_name}} - powered by Attune AI"
    )
    parser.add_argument("--version", action="version", version="%(prog)s 0.1.0")

    args = parser.parse_args()

    # Initialize Attune
    config = load_config()
    attune = AttuneOS(config)

    print("{{project_name}} is ready!")
    print(f"Attune level: {config.target_level}")


if __name__ == "__main__":
    main()
''',
        "pyproject.toml": """[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "{{project_name}}"
version = "0.1.0"
description = "A CLI tool powered by Attune AI"
readme = "README.md"
requires-python = ">=3.9"
dependencies = [
    "attune-ai>=5.0",
]

[project.scripts]
{{project_name}} = "{{project_name}}.cli:main"
""",
        "README.md": """# {{project_name}}

A CLI tool powered by Attune AI.

## Installation

```bash
pip install -e .
```

## Usage

```bash
{{project_name}} --help
```

## Development

```bash
# Pre-commit checks
attune workflow run ship

# Run code review
attune workflow run code-review

# Check project health
attune doctor
```
""",
        ".claude/CLAUDE.md": """# {{project_name}} - Claude Code Rules

## Project Context

CLI tool built with Attune AI.

## Key Commands

- `attune workflow run ship` - Pre-commit checks
- `attune workflow run code-review` - Code review
- `attune doctor` - Environment health check

## Patterns

@patterns/debugging.json
""",
        ".gitignore": """# Python
__pycache__/
*.py[cod]
*.egg-info/
dist/
build/
.eggs/

# Attune AI
.attune/
patterns/sensitive/

# IDE
.vscode/
.idea/

# Environment
.env
.venv/
""",
    },
}
