Metadata-Version: 2.4
Name: bugyo-prjmeta
Version: 1.0.0
Summary: Project metadata plugin for Daimyo - provides .project-metadata.yml content for templates
Project-URL: Homepage, https://gitlab.com/Kencho1/daimyo
Project-URL: Documentation, https://gitlab.com/Kencho1/daimyo/-/blob/main/plugins/bugyo-prjmeta/README.md
Project-URL: Repository, https://gitlab.com/Kencho1/daimyo
Project-URL: Issues, https://gitlab.com/Kencho1/daimyo/-/issues
Author: Jesús Alonso Abad
License: MIT License
        
        Copyright (c) 2026 Jesús Alonso Abad
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: daimyo,jinja2,metadata,plugin,project,templates
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: daimyo>=1.4.0
Requires-Dist: pyyaml~=6.0
Description-Content-Type: text/markdown

# bugyo-prjmeta

Project metadata plugin for Daimyo - provides `.project-metadata.yml` content for Jinja2 templates.

## Installation

```bash
pip install bugyo-prjmeta
```

## Requirements

- Python >= 3.11
- daimyo >= 1.4.0
- pyyaml ~= 6.0

## Features

### Context Variables

The `prjmeta.context` plugin provides the following template variable:

| Variable | Type | Description |
|----------|------|-------------|
| `project_metadata` | dict | Full contents of `.project-metadata.yml` in the project root |

## Configuration

Enable the plugin in your `.daimyo/config/settings.toml`:

```toml
# Enable all project metadata plugins
enabled_plugins = ["prjmeta.*"]

# Or enable the specific context plugin
enabled_plugins = ["prjmeta.context"]
```

## Usage

### Template Examples

#### Conditional Rules Based on Project Metadata

```yaml
project.language:
  when: Language-specific guidelines
  ruleset:
    - "{% if project_metadata.get('language') == 'python' %}Use uv for dependency management{% endif %}"
    - "{% if project_metadata.get('language') == 'javascript' %}Use npm or yarn for dependency management{% endif %}"
```

#### Using Daimyo Scope

The `.project-metadata.yml` file is used by Claude Code to determine the daimyo rule scope.
Its full contents are also available in templates:

```yaml
project.info:
  when: Project information rules
  ruleset:
    - "{% if project_metadata.get('daimyo', {}).get('scope') %}Rules scope: {{ project_metadata.daimyo.scope }}{% endif %}"
    - "{% if project_metadata.get('team') %}Team: {{ project_metadata.team }}{% endif %}"
```

#### Accessing Nested Metadata

```yaml
project.team:
  when: Team-specific guidelines
  ruleset:
    - "{% set team = project_metadata.get('team', {}) %}"
    - "{% if team.get('timezone') %}Team timezone: {{ team.timezone }}{% endif %}"
    - "{% if team.get('lead') %}Technical lead: {{ team.lead }}{% endif %}"
```

## Availability

The plugin is **always available**, even when `.project-metadata.yml` does not exist in the project root. In that case, `project_metadata` is an empty dict `{}`.

## Security

This plugin reads only `.project-metadata.yml` from the current working directory. No path traversal is possible - the file path is fixed and cannot be influenced by template authors.

## License

MIT License - see LICENSE file for details.

## Support

For issues and questions, please visit the [Daimyo issue tracker](https://gitlab.com/Kencho1/daimyo/-/issues).
