Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/labels-and-capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Tools under [`tools/`](../tools/). Tools with two values (separated by
| [`tools/skill-evals`](../tools/skill-evals/) | `capability:setup` + `capability:stats` | Eval harness for skills; the harness is setup infrastructure, the run output is governance evidence |
| [`tools/skill-and-tool-validator`](../tools/skill-and-tool-validator/) | `capability:setup` | Skill-frontmatter and convention validator |
| [`tools/spec-status-index`](../tools/spec-status-index/) | `capability:setup` + `capability:stats` | Index of spec / RFC implementation status — substrate that also doubles as a governance/stats view |
| [`tools/spec-validator`](../tools/spec-validator/) | `capability:setup` | Spec-frontmatter and body-section validator — counterpart to `skill-and-tool-validator` for `tools/spec-loop/specs/` |
| [`tools/vulnogram`](../tools/vulnogram/) | `capability:resolve` | ASF Vulnogram CVE-allocation client |

A tool's capabilities are determined by its **use-case lifecycle
Expand Down
51 changes: 51 additions & 0 deletions tools/spec-validator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [spec-validator](#spec-validator)
- [What it checks](#what-it-checks)
- [Usage](#usage)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->

# spec-validator

**Capability:** capability:setup

Validates spec files in `tools/spec-loop/specs/` — the counterpart to
`tools/skill-and-tool-validator/` for the spec side of the framework.

## What it checks

For every `.md` file that carries a YAML frontmatter block:

1. **Required frontmatter keys** — `title`, `status`, `kind`, `mode`,
`source`, `acceptance`.
2. **Valid `status`** — `stable` | `experimental` | `proposed` | `off`.
3. **Valid `kind`** — `feature` | `fix` | `docs` | `chore`.
4. **Valid `mode`** — `Triage` | `Mentoring` | `Drafting` | `Pairing` | `infra`.
5. **Non-empty `acceptance` list** — at least one `- item` entry.
6. **Required body sections** — `## What it does`, `## Where it lives`,
`## Behaviour & contract`, `## Out of scope`, `## Acceptance criteria`,
`## Validation`.
7. **Validation section has a fenced code block** — at least one `` ```…``` ``
block so build-loop backpressure commands are always explicit.

Files without frontmatter (e.g. `README.md`, `overview.md`) are silently
skipped — they are index/overview docs, not functional specs.

## Usage

```bash
# Run against the default spec directory
uv run --project tools/spec-validator spec-validate

# Run against a specific directory or file
uv run --project tools/spec-validator spec-validate tools/spec-loop/specs/

# Run the test suite
uv run --project tools/spec-validator --group dev pytest
```
58 changes: 58 additions & 0 deletions tools/spec-validator/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "spec-validator"
version = "0.1.0"
description = "Validate spec files — YAML frontmatter and required body sections."
readme = "README.md"
requires-python = ">=3.11"
license = { text = "Apache-2.0" }
dependencies = []

[project.scripts]
spec-validate = "spec_validator:main"

[dependency-groups]
dev = [
"pytest>=8.0",
"ruff>=0.6",
]

[tool.hatch.build.targets.wheel]
packages = ["src/spec_validator"]

[tool.ruff]
line-length = 110
target-version = "py311"
src = ["src", "tests"]

[tool.ruff.lint]
select = ["E", "W", "F", "I", "B", "UP", "SIM", "C4", "RUF"]
ignore = ["E501"]

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["B", "SIM"]

[tool.pytest.ini_options]
minversion = "8.0"
addopts = "-ra -q"
testpaths = ["tests"]
Loading
Loading