feat: implement repoctl L1 core (models, schemas, validate, discover, context, init, adopt)
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>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
9a39b8a941
commit
96d4d08230
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://stewardship.corsus.ru/schemas/v1alpha1/adoption-assessment.schema.json",
|
||||
"title": "AdoptionAssessment",
|
||||
"type": "object",
|
||||
"required": ["schema", "repository", "classification", "entrypoints", "knowledge", "proposedContentRoots", "collisions", "findings", "questions"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"schema": { "const": "stewardship/adoption-assessment@0.1" },
|
||||
"repository": {
|
||||
"type": "object",
|
||||
"required": ["path", "baselineRevision", "dirty"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"path": { "type": "string" },
|
||||
"baselineRevision": { "type": "string" },
|
||||
"dirty": { "type": "boolean" }
|
||||
}
|
||||
},
|
||||
"classification": {
|
||||
"type": "object",
|
||||
"required": ["proposedType", "confidence", "evidence", "confirmationRequired"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"proposedType": { "type": "string" },
|
||||
"confidence": { "enum": ["low", "medium", "high"] },
|
||||
"evidence": { "type": "array", "items": { "type": "string" } },
|
||||
"confirmationRequired": { "type": "boolean" }
|
||||
}
|
||||
},
|
||||
"entrypoints": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"claude": { "type": ["string", "null"] },
|
||||
"portable": { "type": ["string", "null"] },
|
||||
"canonicalDirection": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"knowledge": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["path", "format", "action"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"path": { "type": "string" },
|
||||
"format": { "type": "string" },
|
||||
"action": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"proposedContentRoots": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["id", "path", "role", "authority"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"path": { "type": "string" },
|
||||
"role": { "type": "string" },
|
||||
"authority": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"collisions": { "type": "array", "items": { "type": "string" } },
|
||||
"findings": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["severity", "code"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"severity": { "enum": ["info", "warning", "error"] },
|
||||
"code": { "type": "string" },
|
||||
"path": { "type": "string" },
|
||||
"message": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"questions": { "type": "array", "items": { "type": "string" } }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user