Adds the repository-stewardship Python package (src/stewardship) with: - JSON Schemas (Draft 2020-12) for RepositoryContract, KnowledgeBase, CatalogIndex, ContextBundle, BootstrapPlan, AdoptionAssessment/Plan/Report, user config and the repoctl-result envelope. - Safe YAML I/O, path confinement, deterministic clock and canonical-JSON hashing. - validate: schema, ID uniqueness, path safety, KDB references, freshness, secret-shaped fields, shell-string detection, and Markdown frontmatter/fence/link checks. - discover/CatalogIndex with deterministic sorting and duplicate-name detection. - describe (contract-only) and context (intent-scoped ContextBundle with budgeted materialization and --strict truncation). - init: plan-then-apply bootstrap with SHA-256 plan-hash approval, no fake domain artifacts, bundled Claude skills. - adopt: assess/plan/apply/verify overlay workflow per docs/adoption-runbook.md, preserving legacy content roots and KDB, with baseline-hash re-check and rollback. - argparse-based `repoctl` CLI with human/yaml/json output and spec exit codes. - pytest suite (39 tests) covering positive/negative fixtures, discovery, context, bootstrap and adoption (including LXD- and Antivirus-shaped legacy layouts). Managed with uv (.venv), ruff clean, mypy --strict clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
28 lines
784 B
Python
28 lines
784 B
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from stewardship.validate import validate_repository
|
|
|
|
POSITIVE_FIXTURES = [
|
|
"positive/infra-lxd",
|
|
"positive/service-antivirus",
|
|
"positive/software-example",
|
|
"positive/project-example",
|
|
]
|
|
|
|
|
|
@pytest.mark.parametrize("fixture", POSITIVE_FIXTURES)
|
|
def test_positive_fixture_validates_clean(make_repo, fixture):
|
|
repo = make_repo(fixture)
|
|
result = validate_repository(repo)
|
|
errors = [f for f in result.findings if f.severity == "error"]
|
|
assert errors == [], errors
|
|
assert result.ok
|
|
|
|
|
|
def test_infra_lxd_content_roots_not_moved(make_repo):
|
|
repo = make_repo("positive/infra-lxd")
|
|
assert (repo / "profiles-source" / "default.yaml").exists()
|
|
assert (repo / "profiles" / "default.yaml").exists()
|