Metadata-Version: 2.4
Name: specweave
Version: 0.2.0
Summary: Translate between Python tests, Gherkin behavior specs, and BDD execution evidence
Author: SpecWeave Contributors
Maintainer: Holger Nahrstaedt
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/holgern/specweave
Project-URL: Repository, https://github.com/holgern/specweave
Project-URL: Issues, https://github.com/holgern/specweave/issues
Project-URL: Changelog, https://github.com/holgern/specweave/releases
Keywords: bdd,gherkin,cucumber,pytest,testing,developer-tools,cli
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer
Requires-Dist: click
Requires-Dist: tomli>=2; python_version < "3.11"
Provides-Extra: gherkin
Requires-Dist: gherkin-official<40,>=39; extra == "gherkin"
Provides-Extra: docs
Requires-Dist: myst-parser>=2; extra == "docs"
Requires-Dist: sphinx>=7; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=2; extra == "docs"
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: gherkin-official<40,>=39; extra == "dev"
Requires-Dist: myst-parser>=2; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-xdist; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: sphinx>=7; extra == "dev"
Requires-Dist: sphinx-rtd-theme>=2; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: types-PyYAML; extra == "dev"
Dynamic: license-file

[![PyPI - Version](https://img.shields.io/pypi/v/specweave)](https://pypi.org/project/specweave/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/specweave)
![PyPI - Downloads](https://img.shields.io/pypi/dm/specweave)
[![codecov](https://codecov.io/gh/holgern/specweave/graph/badge.svg?token=CjRFwWvyYm)](https://codecov.io/gh/holgern/specweave)

# specweave

SpecWeave translates between canonical Gherkin behavior specs, plain pytest
enforcement, and normalized execution evidence.

It is not a task ledger, architecture ledger, or CI system.

## Canonical layout

```text
specweave.toml
specs/behavior/README.md
specs/behavior/manifest.json
specs/behavior/features/<area>/<feature>.feature
specs/behavior/evidence/*.json
specs/behavior/mappings/taskledger/*.json
tests/test_<area>_<feature>.py
specs/behavior/reports/*.xml
specs/behavior/reports/specweave/*.json
```

Hidden `.specweave.toml` is still discovered for existing projects, but
`specweave.toml` is the default config file and classic `.feature` is the only
canonical feature format.

## Behavior workflow

```bash
specweave init
specweave doctor
specweave create gherkin --from-tests tests --out specs/behavior/features
specweave review specs
specweave review coverage --view both --show gaps
specweave behavior index
specweave behavior generate-tests --features specs/behavior/features --tests-dir tests
pytest --junitxml=specs/behavior/reports/pytest-junit.xml
specweave behavior import-report specs/behavior/reports/pytest-junit.xml --format junit-xml
```

## Classic Gherkin only

Canonical specs use classic Gherkin:

```gherkin
@area-auth @feature-password-login
Feature: Password login
  Users authenticate with a password.

  @rule-invalid-password
  Rule: Invalid passwords are rejected

    @bdd-password-login-invalid-password @ac-0001
    Example: Reject invalid password
      Given a registered user exists
      When the user submits an invalid password
      Then login is rejected
      And no authenticated session is created
```

Legacy `.feature.md` files are no longer supported as canonical specs.

## Evidence and mappings

- normalized evidence: `specs/behavior/evidence`
- Taskledger mapping artifacts: `specs/behavior/mappings/taskledger`
- generated runner output: `specs/behavior/reports`
- SpecWeave runner summaries: `specs/behavior/reports/specweave`

Import pytest/JUnit evidence with:

```bash
specweave behavior import-report \
  specs/behavior/reports/pytest-junit.xml \
  --format junit-xml \
  --out specs/behavior/evidence/pytest-evidence.json
```

## Optional Taskledger integration

Taskledger exchange is file-based:

```bash
specweave behavior import-taskledger \
  specs/behavior/mappings/taskledger/task-0123.json \
  --out specs/behavior/features/task-management/plan-gates.feature

specweave create taskledger-task \
  --feature specs/behavior/features/task-management/plan-gates.feature \
  --out specs/behavior/mappings/taskledger/draft.json
```

Trace and cross-ledger diagnostics remain read-only:

```bash
specweave trace @bdd-login-success --format json
specweave combi check --json specs/behavior/reports/specweave/combi-check.json
```

## Installation

```bash
pip install specweave
pip install specweave[gherkin]   # optional official Cucumber parser
pip install -e ".[dev]"          # development tools
```

## Development

```bash
pytest -q
ruff check .
ruff format --check .
mypy specweave
```

## License

Apache 2.0
