diff --git a/AGENTS.md b/AGENTS.md index f290328..e11d069 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,9 +6,10 @@ Read, in order: 1. `README.md` 2. `AUTHOR.md` -3. `repository.json` -4. `skills.md` -5. The relevant skill or documentation for the task +3. `repository-variables.json` +4. `repository.json` +5. `skills.md` +6. The relevant skill or documentation for the task ## Repository Purpose @@ -19,7 +20,11 @@ This repository defines and validates a platform-neutral structure for human- an - Preserve accurate existing content and stable identifiers. - Use the smallest repository profile that fits the target. - Do not invent maintainers, publication URLs, licenses, security contacts, provenance, or credentials. -- Keep `AUTHOR.md`, `repository.json`, `CITATION.cff`, and `LICENSE` attribution aligned. +- Keep `repository-variables.json`, `AUTHOR.md`, `repository.json`, + `CITATION.cff`, and `LICENSE` attribution aligned. +- Treat verified values in `repository-variables.json` as defaults for + repository-structure work. Ask only about missing, conflicting, or explicitly + unverified values. - Treat `UPDATES.md` as proposed future work, not authorization. - Record completed versioned changes in `CHANGELOG.md`. - Keep `VERSION`, `repository.json`, `CITATION.cff`, and release notes aligned. @@ -46,6 +51,8 @@ Also validate any modified skill with the available Codex skill validator. ## File-Specific Guidance - Update `schemas/repository.schema.json` when the manifest contract changes. +- Update `schemas/repository-variables.schema.json` when the reusable variables + contract changes. - Update both the skill reference and root documentation when the repository standard changes. - Update validator tests when requirements change. - Keep Git-host files under the correct host-specific directory. diff --git a/AUTHOR.md b/AUTHOR.md index 4872291..f24260b 100644 --- a/AUTHOR.md +++ b/AUTHOR.md @@ -31,7 +31,8 @@ https://projects.eddiesoehnel.com/adminprojects/repo-template When using this repository as the basis for another repository: 1. replace the author, publisher, and maintainer values in this file; -2. update `repository.json`, `CITATION.cff`, and `LICENSE` to match; +2. update `repository-variables.json`, `repository.json`, `CITATION.cff`, and + `LICENSE` to match; 3. update the canonical repository URL; 4. verify the license is appropriate for the new repository; 5. run the repository validator. diff --git a/CHANGELOG.md b/CHANGELOG.md index 7635087..c807adb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,22 @@ All notable released changes to this repository are documented here. ### Security +## [0.2.0] - 2026-07-24 + +### Added + +- Required `repository-variables.json` for verified stable identity, + publication, rights, profile, and repository-skill defaults. +- Reusable variables template and Draft 2020-12 JSON Schema. +- Variable alignment checks in the profile audit, root validator, and tests. + +### Changed + +- Repository-structure skill now reads verified variables before asking identity + questions and creates or updates the file for every supported profile. +- Documentation, agent retrieval order, and repository templates now treat the + variables file as a standard root entry point. + ## [0.1.0] - 2026-07-23 ### Added diff --git a/CITATION.cff b/CITATION.cff index c411a55..c32c639 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,8 +2,8 @@ cff-version: 1.2.0 message: "If you use this repository template, please cite it using this metadata." title: "AI-Ready Repository Template" type: software -version: 0.1.0 -date-released: 2026-07-23 +version: 0.2.0 +date-released: 2026-07-24 authors: - family-names: "Soehnel" given-names: "Eddie" diff --git a/README.md b/README.md index 9b3f90d..5dddbaf 100644 --- a/README.md +++ b/README.md @@ -56,13 +56,15 @@ Use $structure-ai-ready-repository to build or correct this repository. The skill will normally: -1. confirm the author, publisher, maintainer, canonical URL, and license; -2. inspect the target repository and preserve useful existing content; -3. select the smallest appropriate repository profile; -4. create `tasks//repository-structure-plan.md`; -5. wait for review, amendments, and explicit approval; -6. implement only the approved file actions; -7. validate the completed repository and report the results. +1. read `repository-variables.json` when present; +2. confirm only missing or conflicting author, publisher, maintainer, canonical + URL, and license values; +3. inspect the target repository and preserve useful existing content; +4. select the smallest appropriate repository profile; +5. create `tasks//repository-structure-plan.md`; +6. wait for review, amendments, and explicit approval; +7. implement only the approved file actions; +8. validate the completed repository and report the results. The planning gate can be bypassed only when the user explicitly authorizes immediate implementation and applicable safety and permission rules allow it. @@ -70,11 +72,13 @@ The planning gate can be bypassed only when the user explicitly authorizes immed 1. Read the [implementation guide](docs/implementation.md). 2. Confirm repository identity and publication facts. -3. Create or adapt [AUTHOR.md](AUTHOR.md). -4. Select the smallest applicable repository profile. -5. Start from the files in [`templates/`](templates/README.md). -6. Replace every visible placeholder with verified information. -7. Run the validator and tests: +3. Create or adapt + [`repository-variables.json`](repository-variables.json). +4. Create or adapt [AUTHOR.md](AUTHOR.md). +5. Select the smallest applicable repository profile. +6. Start from the files in [`templates/`](templates/README.md). +7. Replace every visible placeholder with verified information. +8. Run the validator and tests: ```text python scripts/validate_repository.py . @@ -102,6 +106,7 @@ Profiles are minimum useful structures, not commands to create every possible fo | --- | --- | | [`README.md`](README.md) | Primary human overview and usage guide. | | [`AUTHOR.md`](AUTHOR.md) | Canonical author, publisher, maintainer, and attribution record. | +| [`repository-variables.json`](repository-variables.json) | Verified stable identity, publication, rights, profile, and skill defaults. | | [`repository.json`](repository.json) | Authoritative machine-readable repository manifest. | | [`AGENTS.md`](AGENTS.md) | Repository-scoped operating instructions for AI agents. | | [`skills.md`](skills.md) | Skill index, triggers, inputs, outputs, and approval requirements. | @@ -120,7 +125,7 @@ Profiles are minimum useful structures, not commands to create every possible fo | Path | Purpose | | --- | --- | | [`docs/`](docs/README.md) | Architecture, implementation guidance, and glossary. | -| [`templates/`](templates/README.md) | Reusable manifest, author, and future-update templates. | +| [`templates/`](templates/README.md) | Reusable variables, manifest, author, and future-update templates. | | [`examples/`](examples/README.md) | Synthetic completed examples. | | [`schemas/`](schemas/README.md) | JSON Schema for the repository manifest. | | [`scripts/`](scripts/README.md) | Dependency-free validation for this repository. | @@ -147,6 +152,7 @@ Profiles are minimum useful structures, not commands to create every possible fo - Target repository path. - Repository purpose and intended users. +- Existing `repository-variables.json`, when present. - Verified author or authors. - Publisher and maintainer. - Canonical repository URL. @@ -161,6 +167,7 @@ If an existing `AUTHOR.md` is present, the skill reads and confirms it rather th Depending on the selected profile, the skill produces: - clear human and AI entry points; +- a verified, reusable `repository-variables.json`; - verified author and publication metadata; - a machine-readable `repository.json`; - profile-appropriate documentation, indexes, templates, examples, scripts, schemas, and tests; @@ -173,11 +180,12 @@ An AI agent should read: 1. [`README.md`](README.md) 2. [`AUTHOR.md`](AUTHOR.md) -3. [`repository.json`](repository.json) -4. [`AGENTS.md`](AGENTS.md) -5. [`skills.md`](skills.md) -6. The relevant skill -7. Only the references and supporting files required for the current task +3. [`repository-variables.json`](repository-variables.json) +4. [`repository.json`](repository.json) +5. [`AGENTS.md`](AGENTS.md) +6. [`skills.md`](skills.md) +7. The relevant skill +8. Only the references and supporting files required for the current task Treat `UPDATES.md` as planning context, not authorization. Treat `CHANGELOG.md` as the record of completed versioned work. @@ -192,7 +200,8 @@ python scripts/validate_repository.py . It checks: - required files and directories; -- JSON parsing and core manifest fields; +- JSON parsing and core manifest and repository-variable fields; +- alignment between reusable variables and repository metadata; - author, publisher, maintainer, citation, and license alignment; - human, AI, skill, script, and template entry points; - declared content and retrieval paths; @@ -211,13 +220,14 @@ Structural validation cannot prove that documentation is accurate, that a licens When using this template for another repository: -1. replace the identity values in `AUTHOR.md`; -2. align `repository.json`, `CITATION.cff`, and `LICENSE`; -3. replace the canonical URL and hosting metadata; -4. choose the correct profile; -5. remove irrelevant example structure; -6. update tests and validation requirements; -7. run the complete validation workflow. +1. replace the verified values in `repository-variables.json`; +2. replace the identity values in `AUTHOR.md`; +3. align `repository.json`, `CITATION.cff`, and `LICENSE`; +4. replace the canonical URL and hosting metadata; +5. choose the correct profile; +6. remove irrelevant example structure; +7. update tests and validation requirements; +8. run the complete validation workflow. Do not leave Eddie Soehnel's identity on a derived repository unless that attribution remains accurate. @@ -229,7 +239,7 @@ See [SECURITY.md](SECURITY.md). ## Version, Author, And License -- **Version:** `0.1.0` +- **Version:** `0.2.0` - **Author, publisher, and maintainer:** Eddie Soehnel - **License:** MIT - **Canonical repository:** `https://projects.eddiesoehnel.com/adminprojects/repo-template` diff --git a/UPDATES.md b/UPDATES.md index a642bee..2e680ee 100644 --- a/UPDATES.md +++ b/UPDATES.md @@ -27,5 +27,7 @@ Items here are not approved work, release commitments, or completed changes. Whe ## Completed Or Superseded +- 2026-07-24: Added required, schema-backed `repository-variables.json` support + across the standard, skill, templates, validation, and tests. - 2026-07-23: Set Eddie Soehnel as author, publisher, and maintainer and added `AUTHOR.md`. - 2026-07-23: Added `UPDATES.md` to the repository standard and implemented template. diff --git a/VERSION b/VERSION index 6e8bf73..0ea3a94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 +0.2.0 diff --git a/docs/architecture.md b/docs/architecture.md index 23195aa..82e0aa6 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -8,7 +8,10 @@ The repository separates human guidance, machine-readable contracts, reusable AI README.md + AGENTS.md | v -repository.json ----> schemas/repository.schema.json +repository-variables.json ---> schemas/repository-variables.schema.json + | + v +repository.json -------------> schemas/repository.schema.json | v skills/structure-ai-ready-repository/ @@ -28,7 +31,11 @@ scripts/validate_repository.py + tests/ ### Entry points -`README.md` is the human entry point. `AUTHOR.md` is the canonical attribution record. `AGENTS.md` is the AI operating entry point. `repository.json` provides authoritative structured metadata and retrieval order. +`README.md` is the human entry point. `AUTHOR.md` is the canonical attribution +record. `repository-variables.json` stores verified stable inputs for future +repository-structure work. `AGENTS.md` is the AI operating entry point. +`repository.json` provides authoritative structured metadata and retrieval +order. ### Standard diff --git a/docs/implementation.md b/docs/implementation.md index f97582c..5918f1d 100644 --- a/docs/implementation.md +++ b/docs/implementation.md @@ -15,11 +15,13 @@ Add profile-specific files only when they support real content or validation. 1. Choose a clear lowercase kebab-case repository name. 2. Create human and AI entry points. -3. Create `repository.json` using `templates/repository.json.template`. -4. Select and create profile-required documentation and folders. -5. Add a verified license, version, and change record. -6. Add host-specific contribution templates. -7. Validate the repository. +3. Create `repository-variables.json` using + `templates/repository-variables.json.template`. +4. Create `repository.json` using `templates/repository.json.template`. +5. Select and create profile-required documentation and folders. +6. Add a verified license, version, and change record. +7. Add host-specific contribution templates. +8. Validate the repository. ## Existing Repository Workflow @@ -44,7 +46,9 @@ Declare these answers in `repository.json`. ## Identity And Publication -At the beginning of a repository build, confirm: +At the beginning of a repository build, read `repository-variables.json` when +present. Treat its verified values as defaults, then confirm only absent, +conflicting, or explicitly unverified values: - author or authors; - publisher; @@ -52,7 +56,10 @@ At the beginning of a repository build, confirm: - canonical repository URL; - intended license. -Record the verified values in `AUTHOR.md` and keep `repository.json`, `CITATION.cff`, and `LICENSE` aligned. When adapting an existing template, never inherit its author automatically. +Record stable verified values in `repository-variables.json` and the canonical +human-readable identity in `AUTHOR.md`. Keep both files aligned with +`repository.json`, `CITATION.cff`, and `LICENSE`. When adapting an existing +template, never inherit its author automatically. ## Metadata Rules diff --git a/examples/README.md b/examples/README.md index b29dc71..702d959 100644 --- a/examples/README.md +++ b/examples/README.md @@ -4,6 +4,7 @@ All examples in this directory are synthetic and do not represent an actual orga | File | Purpose | | --- | --- | +| `example-repository-variables.json` | Completed stable repository-skill variables for a fictional repository. | | `example-repository.json` | Completed documentation-profile manifest for a fictional repository. | Use examples to understand expected shape. Do not copy fictional URLs, maintainers, or identifiers into a real repository. diff --git a/examples/example-repository-variables.json b/examples/example-repository-variables.json new file mode 100644 index 0000000..0385111 --- /dev/null +++ b/examples/example-repository-variables.json @@ -0,0 +1,42 @@ +{ + "$schema": "../schemas/repository-variables.schema.json", + "schema_version": "1.0", + "purpose": "Synthetic verified inputs for the example documentation repository.", + "repository_profile": "documentation-guide", + "identity": { + "authors": [ + { + "name": "Alex Example" + } + ], + "publisher": { + "name": "Example Organization" + }, + "maintainer": { + "name": "Example Maintainer" + } + }, + "repository": { + "repository_id": "example-organization-field-guide", + "name": "field-guide", + "title": "Synthetic Field Guide", + "canonical_url": "https://code.example.org/example-organization/field-guide", + "organization": { + "id": "example-organization", + "name": "Example Organization", + "url": "https://code.example.org/example-organization" + } + }, + "rights": { + "license": "CC-BY-4.0", + "license_file": "LICENSE" + }, + "skill_defaults": { + "task_id": "structure-ai-ready-repository", + "require_plan_approval": true, + "preserve_existing_content": true, + "use_smallest_fitting_profile": true + }, + "verified_by": "Synthetic example fixture", + "verified_at": "2026-01-01" +} diff --git a/examples/example-repository.json b/examples/example-repository.json index 45915b5..ba2dfb5 100644 --- a/examples/example-repository.json +++ b/examples/example-repository.json @@ -6,6 +6,11 @@ "description": "A synthetic example showing machine-readable metadata for a documentation repository.", "summary": "Demonstrates the minimum identity, profile, entrypoint, rights, and AI retrieval fields without using real organizational data.", "canonical_url": "https://code.example.org/example-organization/field-guide", + "organization": { + "id": "example-organization", + "name": "Example Organization", + "url": "https://code.example.org/example-organization" + }, "repository_status": "active", "visibility": "public", "maturity": "stable", @@ -101,6 +106,9 @@ "ai_retrieval": { "read_first": [ "README.md", + "AUTHOR.md", + "repository-variables.json", + "repository.json", "AGENTS.md" ], "retrieve_as_needed": [ diff --git a/repository-variables.json b/repository-variables.json new file mode 100644 index 0000000..b218ad1 --- /dev/null +++ b/repository-variables.json @@ -0,0 +1,42 @@ +{ + "$schema": "./schemas/repository-variables.schema.json", + "schema_version": "1.0", + "purpose": "Verified stable inputs for repository-structure skills and future repository maintenance.", + "repository_profile": "skill-workflow", + "identity": { + "authors": [ + { + "name": "Eddie Soehnel" + } + ], + "publisher": { + "name": "Eddie Soehnel" + }, + "maintainer": { + "name": "Eddie Soehnel" + } + }, + "repository": { + "repository_id": "adminprojects-repo-template", + "name": "repo-template", + "title": "AI-Ready Repository Template", + "canonical_url": "https://projects.eddiesoehnel.com/adminprojects/repo-template", + "organization": { + "id": "adminprojects", + "name": "adminprojects", + "url": "https://projects.eddiesoehnel.com/adminprojects" + } + }, + "rights": { + "license": "MIT", + "license_file": "LICENSE" + }, + "skill_defaults": { + "task_id": "structure-ai-ready-repository", + "require_plan_approval": true, + "preserve_existing_content": true, + "use_smallest_fitting_profile": true + }, + "verified_by": "AUTHOR.md and repository maintainers", + "verified_at": "2026-07-24" +} diff --git a/repository.json b/repository.json index ef091f8..009938d 100644 --- a/repository.json +++ b/repository.json @@ -23,9 +23,9 @@ "repository_status": "active", "visibility": "public", "maturity": "experimental", - "version": "0.1.0", + "version": "0.2.0", "created_at": "2026-07-23", - "updated_at": "2026-07-23", + "updated_at": "2026-07-24", "resource_types": [ "documentation", "framework", @@ -72,6 +72,7 @@ "Assess a new or existing repository.", "Propose a profile-appropriate repository structure.", "Create machine-readable repository metadata.", + "Persist verified stable repository-skill variables.", "Validate required paths, entrypoints, versions, and links." ], "use_cases": [ @@ -110,6 +111,13 @@ "description": "Canonical author, publisher, maintainer, and attribution guidance.", "required_for_use": true }, + { + "path": "repository-variables.json", + "type": "configuration", + "title": "Repository Variables", + "description": "Verified stable identity, publication, rights, profile, and repository-skill defaults.", + "required_for_use": true + }, { "path": "README.md", "type": "documentation", @@ -180,6 +188,7 @@ "read_first": [ "README.md", "AUTHOR.md", + "repository-variables.json", "repository.json", "AGENTS.md", "skills.md" diff --git a/schemas/README.md b/schemas/README.md index 8f0a4b9..a37713f 100644 --- a/schemas/README.md +++ b/schemas/README.md @@ -3,5 +3,6 @@ | File | Purpose | | --- | --- | | `repository.schema.json` | JSON Schema contract for the repository manifest. | +| `repository-variables.schema.json` | JSON Schema contract for stable repository-skill inputs. | The root validator performs dependency-free contract checks. Use a Draft 2020-12 compatible JSON Schema validator for complete schema validation. diff --git a/schemas/repository-variables.schema.json b/schemas/repository-variables.schema.json new file mode 100644 index 0000000..2b012d6 --- /dev/null +++ b/schemas/repository-variables.schema.json @@ -0,0 +1,179 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://projects.eddiesoehnel.com/adminprojects/repo-template/schemas/repository-variables.schema.json", + "title": "Repository Structure Skill Variables", + "description": "Verified stable identity, repository, rights, profile, and workflow inputs reused by repository-structure skills.", + "type": "object", + "required": [ + "schema_version", + "purpose", + "repository_profile", + "identity", + "repository", + "rights", + "skill_defaults", + "verified_by", + "verified_at" + ], + "properties": { + "$schema": { + "type": "string" + }, + "schema_version": { + "type": "string", + "pattern": "^\\d+\\.\\d+$" + }, + "purpose": { + "type": "string", + "minLength": 1 + }, + "repository_profile": { + "enum": [ + "documentation-guide", + "skill-workflow", + "software-automation", + "dataset", + "custom" + ] + }, + "identity": { + "type": "object", + "required": [ + "authors", + "publisher", + "maintainer" + ], + "properties": { + "authors": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "#/$defs/namedEntity" + } + }, + "publisher": { + "$ref": "#/$defs/namedEntity" + }, + "maintainer": { + "$ref": "#/$defs/namedEntity" + } + }, + "additionalProperties": false + }, + "repository": { + "type": "object", + "required": [ + "repository_id", + "name", + "title", + "canonical_url" + ], + "properties": { + "repository_id": { + "type": "string", + "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" + }, + "name": { + "type": "string", + "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" + }, + "title": { + "type": "string", + "minLength": 1 + }, + "canonical_url": { + "type": [ + "string", + "null" + ], + "format": "uri" + }, + "organization": { + "oneOf": [ + { + "$ref": "#/$defs/namedEntity" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + }, + "rights": { + "type": "object", + "required": [ + "license", + "license_file" + ], + "properties": { + "license": { + "type": "string", + "minLength": 1 + }, + "license_file": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false + }, + "skill_defaults": { + "type": "object", + "required": [ + "task_id", + "require_plan_approval", + "preserve_existing_content", + "use_smallest_fitting_profile" + ], + "properties": { + "task_id": { + "type": "string", + "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" + }, + "require_plan_approval": { + "type": "boolean" + }, + "preserve_existing_content": { + "type": "boolean" + }, + "use_smallest_fitting_profile": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "verified_by": { + "type": "string", + "minLength": 1 + }, + "verified_at": { + "type": "string", + "format": "date" + } + }, + "$defs": { + "namedEntity": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string", + "minLength": 1 + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false +} diff --git a/scripts/README.md b/scripts/README.md index a495df3..887d916 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -18,4 +18,7 @@ python scripts/validate_repository.py . python scripts/validate_repository.py . --json ``` -The validator checks required paths, JSON parsing, core manifest fields, author/publisher alignment, entrypoint paths, manifest contents paths, version alignment, license alignment, and relative Markdown links. It does not prove content accuracy or check external URLs. +The validator checks required paths, JSON parsing, repository-variable and +manifest alignment, author/publisher alignment, entrypoint paths, manifest +contents paths, version alignment, license alignment, and relative Markdown +links. It does not prove content accuracy or check external URLs. diff --git a/scripts/validate_repository.py b/scripts/validate_repository.py index 9f85850..c492a7e 100644 --- a/scripts/validate_repository.py +++ b/scripts/validate_repository.py @@ -32,14 +32,17 @@ REQUIRED_PATHS = ( "examples/README.md", "receipts/README.md", "repository.json", + "repository-variables.json", "schemas/README.md", "schemas/repository.schema.json", + "schemas/repository-variables.schema.json", "scripts/README.md", "skills.md", "skills/README.md", "skills/structure-ai-ready-repository/SKILL.md", "tasks/README.md", "templates/README.md", + "templates/repository-variables.json.template", "tests/README.md", ) @@ -160,6 +163,77 @@ def validate_manifest(root: Path, findings: list[dict[str, str]]) -> dict | None return manifest +def validate_variables( + root: Path, manifest: dict | None, findings: list[dict[str, str]] +) -> dict | None: + path = root / "repository-variables.json" + try: + variables = json.loads(read_text(path)) + except (OSError, UnicodeError, json.JSONDecodeError) as exc: + add(findings, "error", f"repository-variables.json is invalid: {exc}") + return None + + required = ( + "schema_version", + "purpose", + "repository_profile", + "identity", + "repository", + "rights", + "skill_defaults", + "verified_by", + "verified_at", + ) + for key in required: + if key not in variables: + add(findings, "error", f"repository-variables.json lacks required key: {key}") + + if not manifest: + return variables + + identity = variables.get("identity", {}) + variable_authors = [ + item.get("name") for item in identity.get("authors", []) if isinstance(item, dict) + ] + manifest_authors = [ + item.get("name") + for item in manifest.get("authors", []) + if isinstance(item, dict) + ] + if variable_authors != manifest_authors: + add(findings, "error", "Authors differ between repository-variables.json and repository.json") + + variable_publisher = identity.get("publisher", {}).get("name") + manifest_publisher = manifest.get("publisher", {}).get("name") + if variable_publisher != manifest_publisher: + add(findings, "error", "Publisher differs between repository-variables.json and repository.json") + + variable_maintainer = identity.get("maintainer", {}).get("name") + manifest_maintainer = manifest.get("maintenance", {}).get("maintainer") + if variable_maintainer != manifest_maintainer: + add(findings, "error", "Maintainer differs between repository-variables.json and repository.json") + + repository = variables.get("repository", {}) + for key in ("repository_id", "name", "title", "canonical_url", "organization"): + if repository.get(key) != manifest.get(key): + add( + findings, + "error", + f"{key} differs between repository-variables.json and repository.json", + ) + + variable_rights = variables.get("rights", {}) + manifest_rights = manifest.get("rights", {}) + for key in ("license", "license_file"): + if variable_rights.get(key) != manifest_rights.get(key): + add( + findings, + "error", + f"{key} differs between repository-variables.json and repository.json", + ) + return variables + + def validate_versions(root: Path, manifest: dict | None, findings: list[dict[str, str]]) -> None: version = read_text(root / "VERSION").strip() if not re.fullmatch(r"\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?", version): @@ -226,6 +300,8 @@ def validate(root: Path) -> dict: missing_core = False manifest = None if not (root / "repository.json").is_file() else validate_manifest(root, findings) + if (root / "repository-variables.json").is_file(): + validate_variables(root, manifest, findings) if not missing_core: validate_versions(root, manifest, findings) validate_markdown_links(root, findings) diff --git a/skills.md b/skills.md index 096b5e7..d5454b0 100644 --- a/skills.md +++ b/skills.md @@ -11,8 +11,13 @@ Read this file after `README.md`, `repository.json`, and `AGENTS.md` to determin - **Path:** `skills/structure-ai-ready-repository/SKILL.md` - **Purpose:** Assess, plan, create, correct, and validate a human- and AI-findable repository structure. - **Use when:** Starting a repository, correcting inconsistent structure, adding repository metadata, or improving AI entry points. -- **Inputs:** Target repository, project purpose, existing contents, verified author/publisher/maintainer identity, canonical URL, license, and any constraints. -- **Outputs:** A profile-appropriate repository structure, metadata, documentation, validation, and normal-workflow task records. +- **Inputs:** Target repository, project purpose, existing contents, + `repository-variables.json` when present, verified + author/publisher/maintainer identity, canonical URL, license, and any + constraints. +- **Outputs:** A profile-appropriate repository structure, + `repository-variables.json`, metadata, documentation, validation, and + normal-workflow task records. - **Human approval required:** Yes by default. The user may explicitly authorize immediate implementation. - **Related scripts:** `skills/structure-ai-ready-repository/scripts/audit_repository.py` and `scripts/validate_repository.py`. - **Reference standard:** `skills/structure-ai-ready-repository/references/repository-structure-standard.md`. diff --git a/skills/structure-ai-ready-repository/SKILL.md b/skills/structure-ai-ready-repository/SKILL.md index edc32d8..dfd97b8 100644 --- a/skills/structure-ai-ready-repository/SKILL.md +++ b/skills/structure-ai-ready-repository/SKILL.md @@ -18,16 +18,26 @@ Use `scripts/audit_repository.py` for a read-only baseline and final structural ## Phase 1: Inspect 1. Resolve the target repository and determine whether it is new or existing. -2. Begin with a short identity and publication round. Ask only for values the user has not already supplied: +2. If `repository-variables.json` exists, read it before the identity round. + Treat values with a verification source and date as defaults. Ask only about + missing, conflicting, explicitly unverified, or user-overridden values. +3. Begin with a short identity and publication round. Ask only for values the + user has not already supplied or verified: - author or authors; - publisher and maintainer; - canonical repository URL; - intended license. -3. If `AUTHOR.md` exists, read it first, present its values for confirmation, and ask only about missing or conflicting facts. Do not silently inherit identity from a template or source repository. -4. For an existing repository, inspect its files, Git status, documentation, manifests, tests, host configuration, and any `AGENTS.md` or equivalent instructions. Preserve unrelated user changes. -5. Infer the most suitable profile: documentation/guide, skill/workflow, software/automation, dataset, or a justified custom minimum. -6. Separate facts found in the repository from assumptions and recommendations. -7. Run the read-only audit when Python is available. Record failures as planning inputs, not as permission to change files. +4. If `AUTHOR.md` exists, read it and compare it with + `repository-variables.json`. Ask only about missing or conflicting facts. Do + not silently inherit identity from a template or source repository. +5. For an existing repository, inspect its files, Git status, documentation, + manifests, tests, host configuration, and any `AGENTS.md` or equivalent + instructions. Preserve unrelated user changes. +6. Infer the most suitable profile: documentation/guide, skill/workflow, + software/automation, dataset, or a justified custom minimum. +7. Separate facts found in the repository from assumptions and recommendations. +8. Run the read-only audit when Python is available. Record failures as + planning inputs, not as permission to change files. ## Phase 2: Write the review plan @@ -84,14 +94,22 @@ If implementation requires a material departure from the approved plan, update t - provide scoped agent instructions in the repository's established agent-instruction file; - index skills, scripts, templates, schemas, data, and examples when they exist. - create or update `UPDATES.md` for future notes and proposals, while keeping completed versioned changes in `CHANGELOG.md`. - - create `AUTHOR.md` as the canonical human-readable attribution file and keep it aligned with `repository.json`, `CITATION.cff`, and `LICENSE`. + - create `AUTHOR.md` as the canonical human-readable attribution file and + keep it aligned with `repository-variables.json`, `repository.json`, + `CITATION.cff`, and `LICENSE`. + - create or update `repository-variables.json` with verified stable identity, + repository, rights, profile, and workflow defaults; add it to agent read + order before `repository.json`. Omit optional unknown values or use `null` + where the schema permits; never invent an organization. 7. Use placeholders only when the user has not supplied a value and the placeholder is visibly marked. Never invent URLs, maintainers, licenses, security contacts, provenance, or credentials. 8. Do not create commits, branches, remotes, releases, or hosting-platform settings unless the user separately requested them. ## Phase 5: Validate and record 1. Run `scripts/audit_repository.py` with the approved profile. -2. Parse machine-readable files and check version alignment, internal paths, and declared entry points. +2. Parse machine-readable files and check + `repository-variables.json` alignment, version alignment, internal paths, and + declared entry points. 3. Run relevant repository-native tests, linters, schema checks, and link checks that can safely run. 4. Search created examples and receipts for secrets, personal data, and organization-specific residue. 5. Confirm that `UPDATES.md` contains future planning notes only and is not presented as approval or completed work. @@ -108,7 +126,8 @@ Record the approved revision, actual actions, deviations, commands, results, unr Report: -- the verified author, publisher, maintainer, canonical URL, and license; +- the verified author, publisher, maintainer, canonical URL, license, and + `repository-variables.json` source; - the selected profile and resulting entry points; - created, modified, preserved, moved, and intentionally omitted files; - validation results and anything not tested; diff --git a/skills/structure-ai-ready-repository/assets/repository-structure-plan-template.md b/skills/structure-ai-ready-repository/assets/repository-structure-plan-template.md index 4cef19d..2b0f367 100644 --- a/skills/structure-ai-ready-repository/assets/repository-structure-plan-template.md +++ b/skills/structure-ai-ready-repository/assets/repository-structure-plan-template.md @@ -23,7 +23,8 @@ - Maintainer: `[verified name]` - Canonical repository URL: `[verified URL or explicitly unset]` - License: `[verified license or decision required]` -- Identity source: `[user response | AUTHOR.md | other verified source]` +- Repository variables: `[path, values used, or not present]` +- Identity source: `[user response | repository-variables.json | AUTHOR.md | other verified source]` ## Current State @@ -64,6 +65,7 @@ Allowed actions: `create`, `preserve`, `modify`, `move`, `deprecate`, `leave abs - Human starts at: `[path]` - AI agent starts at: `[path]` - Authoritative manifest: `[path]` +- Verified repository variables: `[path]` - Retrieve next: `[ordered paths]` ## Hosting Platform Choices @@ -74,6 +76,8 @@ Allowed actions: `create`, `preserve`, `modify`, `move`, `deprecate`, `leave abs - [ ] Required files contain project-specific, accurate content. - [ ] Machine-readable files parse and agree with authoritative values. +- [ ] `repository-variables.json` contains verified stable inputs and agrees + with attribution, manifest, citation, and license files. - [ ] Declared paths and internal links resolve. - [ ] Version references align. - [ ] Relevant project-native tests pass. diff --git a/skills/structure-ai-ready-repository/references/repository-structure-standard.md b/skills/structure-ai-ready-repository/references/repository-structure-standard.md index 9cb77ea..14aab1f 100644 --- a/skills/structure-ai-ready-repository/references/repository-structure-standard.md +++ b/skills/structure-ai-ready-repository/references/repository-structure-standard.md @@ -43,6 +43,7 @@ repository-name/ │ ├── README.md ├── AUTHOR.md +├── repository-variables.json ├── repository.json ├── LICENSE ├── CHANGELOG.md @@ -119,6 +120,7 @@ The following root files should normally exist in every public repository: ```text README.md AUTHOR.md +repository-variables.json repository.json LICENSE CHANGELOG.md @@ -261,7 +263,47 @@ It should state: Confirm these values with the user at the beginning of repository creation or restructuring. If an existing `AUTHOR.md` is present, present its values for confirmation rather than silently inheriting them. -Keep `AUTHOR.md`, `repository.json`, `CITATION.cff`, and `LICENSE` aligned. Never leave a source-template author attached to a derived repository unless that attribution remains accurate. +Keep `repository-variables.json`, `AUTHOR.md`, `repository.json`, +`CITATION.cff`, and `LICENSE` aligned. Never leave a source-template author +attached to a derived repository unless that attribution remains accurate. + +--- + +## `repository-variables.json` + +### Purpose + +Stores verified stable inputs that repository-structure skills and future +maintainers can reuse without repeatedly asking for the same facts. + +Every supported repository profile should include this file. It should contain: + +* Repository profile. +* Author or authors. +* Publisher and maintainer. +* Stable repository ID, name, title, canonical URL, and organization when + applicable. +* License and license-file path. +* Repository-skill defaults, including approval and preservation behavior. +* Verification source and date. + +### Rules + +Read this file before an identity and publication round. Treat its values as +defaults only when a verification source and date are present. Ask about values +that are missing, conflicting, explicitly unverified, or overridden by the +user. + +Keep dynamic release values such as the current version out of this file; their +authoritative sources remain `VERSION`, `repository.json`, `CITATION.cff`, and +`CHANGELOG.md`. + +When verified identity, repository, or rights values change, update +`repository-variables.json`, `AUTHOR.md`, `repository.json`, `CITATION.cff`, and +`LICENSE` together. + +Use `templates/repository-variables.json.template` and validate against +`schemas/repository-variables.schema.json`. --- @@ -449,7 +491,9 @@ Do not include comments, trailing commas, Markdown, or JSON5 syntax. "ai_retrieval": { "read_first": [ "README.md", - "AUTHOR.md" + "AUTHOR.md", + "repository-variables.json", + "repository.json" ], "retrieve_as_needed": [], "exclude_by_default": [ @@ -901,9 +945,11 @@ Markdown. ## Read Order 1. `README.md` -2. `repository.json` -3. Relevant files listed in `entrypoints` -4. Supporting documentation only as needed +2. `AUTHOR.md` +3. `repository-variables.json` +4. `repository.json` +5. Relevant files listed in `entrypoints` +6. Supporting documentation only as needed ## Task Routing @@ -1640,6 +1686,7 @@ Required: ```text README.md AUTHOR.md +repository-variables.json repository.json LICENSE CHANGELOG.md @@ -1668,6 +1715,7 @@ Required: ```text README.md AUTHOR.md +repository-variables.json repository.json LICENSE CHANGELOG.md @@ -1700,6 +1748,7 @@ Required: ```text README.md AUTHOR.md +repository-variables.json repository.json LICENSE CHANGELOG.md @@ -1733,6 +1782,7 @@ Required: ```text README.md AUTHOR.md +repository-variables.json repository.json LICENSE CHANGELOG.md @@ -1912,6 +1962,8 @@ Before publishing a new repository: [ ] Hosting-platform description is complete. [ ] hosting-platform topics are assigned. [ ] README explains the purpose, users, process, inputs, and outputs. +[ ] repository-variables.json contains verified identity, repository, rights, + profile, workflow defaults, and verification metadata. [ ] AUTHOR.md contains verified author, publisher, maintainer, canonical URL, and adaptation guidance. [ ] repository.json is complete and valid JSON. [ ] repository_id is stable and unique. @@ -1941,6 +1993,7 @@ For the first implementation, every repository should begin with: ```text README.md AUTHOR.md +repository-variables.json repository.json LICENSE CHANGELOG.md diff --git a/skills/structure-ai-ready-repository/scripts/audit_repository.py b/skills/structure-ai-ready-repository/scripts/audit_repository.py index fd2c2d4..75f08ff 100644 --- a/skills/structure-ai-ready-repository/scripts/audit_repository.py +++ b/skills/structure-ai-ready-repository/scripts/audit_repository.py @@ -14,6 +14,7 @@ PROFILES = { "documentation-guide": { "README.md", "AUTHOR.md", + "repository-variables.json", "repository.json", "LICENSE", "CHANGELOG.md", @@ -25,6 +26,7 @@ PROFILES = { "skill-workflow": { "README.md", "AUTHOR.md", + "repository-variables.json", "repository.json", "LICENSE", "CHANGELOG.md", @@ -39,6 +41,7 @@ PROFILES = { "software-automation": { "README.md", "AUTHOR.md", + "repository-variables.json", "repository.json", "LICENSE", "CHANGELOG.md", @@ -54,6 +57,7 @@ PROFILES = { "dataset": { "README.md", "AUTHOR.md", + "repository-variables.json", "repository.json", "LICENSE", "CHANGELOG.md", @@ -133,6 +137,104 @@ def audit(root: Path, profile: str) -> dict: else: findings.append({"level": "error", "message": "entrypoints must be an object"}) + variables_path = root / "repository-variables.json" + variables = None + if variables_path.is_file(): + try: + variables = json.loads(variables_path.read_text(encoding="utf-8-sig")) + except (OSError, UnicodeError, json.JSONDecodeError) as exc: + findings.append( + {"level": "error", "message": f"repository-variables.json is invalid: {exc}"} + ) + else: + for key in ( + "schema_version", + "repository_profile", + "identity", + "repository", + "rights", + "skill_defaults", + "verified_by", + "verified_at", + ): + if key not in variables: + findings.append( + { + "level": "error", + "message": f"repository-variables.json lacks key: {key}", + } + ) + + if manifest and variables: + identity = variables.get("identity", {}) + variable_authors = [ + item.get("name") + for item in identity.get("authors", []) + if isinstance(item, dict) + ] + manifest_authors = [ + item.get("name") + for item in manifest.get("authors", []) + if isinstance(item, dict) + ] + comparisons = ( + ("authors", variable_authors, manifest_authors), + ( + "publisher", + identity.get("publisher", {}).get("name"), + manifest.get("publisher", {}).get("name"), + ), + ( + "maintainer", + identity.get("maintainer", {}).get("name"), + manifest.get("maintenance", {}).get("maintainer"), + ), + ( + "repository", + variables.get("repository"), + { + key: manifest.get(key) + for key in ( + "repository_id", + "name", + "title", + "canonical_url", + "organization", + ) + }, + ), + ( + "rights", + variables.get("rights"), + { + key: manifest.get("rights", {}).get(key) + for key in ("license", "license_file") + }, + ), + ) + for label, variable_value, manifest_value in comparisons: + if variable_value != manifest_value: + findings.append( + { + "level": "error", + "message": ( + f"{label} differs between repository-variables.json " + "and repository.json" + ), + } + ) + + if variables and variables.get("repository_profile") != profile: + findings.append( + { + "level": "error", + "message": ( + "repository_profile differs between repository-variables.json " + f"({variables.get('repository_profile')}) and requested audit ({profile})" + ), + } + ) + version_path = root / "VERSION" version = version_path.read_text(encoding="utf-8-sig").strip() if version_path.is_file() else None if version and manifest and manifest.get("version") != version: diff --git a/templates/AUTHOR.md.template b/templates/AUTHOR.md.template index 60135ee..b2c937e 100644 --- a/templates/AUTHOR.md.template +++ b/templates/AUTHOR.md.template @@ -26,4 +26,6 @@ Canonical repository: ## Adapting This Template -Replace these values in `AUTHOR.md`, `repository.json`, `CITATION.cff`, and `LICENSE`. Verify the license and canonical URL rather than inheriting them automatically. +Replace these values in `repository-variables.json`, `AUTHOR.md`, +`repository.json`, `CITATION.cff`, and `LICENSE`. Verify the license and +canonical URL rather than inheriting them automatically. diff --git a/templates/README.md b/templates/README.md index cabaedc..d939a44 100644 --- a/templates/README.md +++ b/templates/README.md @@ -3,6 +3,7 @@ | File | Purpose | | --- | --- | | `repository.json.template` | Starting machine-readable repository manifest with visible placeholders. | +| `repository-variables.json.template` | Starting verified identity, publication, rights, profile, and repository-skill defaults. | | `AUTHOR.md.template` | Starting canonical author, publisher, maintainer, and attribution file. | | `UPDATES.md.template` | Starting notes file for future repository improvements. | diff --git a/templates/repository-variables.json.template b/templates/repository-variables.json.template new file mode 100644 index 0000000..48e18e0 --- /dev/null +++ b/templates/repository-variables.json.template @@ -0,0 +1,42 @@ +{ + "$schema": "./schemas/repository-variables.schema.json", + "schema_version": "1.0", + "purpose": "Verified stable inputs for repository-structure skills and future repository maintenance.", + "repository_profile": "{{documentation-guide|skill-workflow|software-automation|dataset|custom}}", + "identity": { + "authors": [ + { + "name": "{{AUTHOR_NAME}}" + } + ], + "publisher": { + "name": "{{PUBLISHER_NAME}}" + }, + "maintainer": { + "name": "{{MAINTAINER_NAME}}" + } + }, + "repository": { + "repository_id": "{{STABLE_REPOSITORY_ID}}", + "name": "{{REPOSITORY_NAME}}", + "title": "{{REPOSITORY_TITLE}}", + "canonical_url": "{{CANONICAL_REPOSITORY_URL}}", + "organization": { + "id": "{{ORGANIZATION_ID}}", + "name": "{{ORGANIZATION_NAME}}", + "url": "{{ORGANIZATION_URL}}" + } + }, + "rights": { + "license": "{{SPDX_LICENSE_ID}}", + "license_file": "LICENSE" + }, + "skill_defaults": { + "task_id": "structure-ai-ready-repository", + "require_plan_approval": true, + "preserve_existing_content": true, + "use_smallest_fitting_profile": true + }, + "verified_by": "{{VERIFICATION_SOURCE}}", + "verified_at": "{{YYYY-MM-DD}}" +} diff --git a/templates/repository.json.template b/templates/repository.json.template index 754c7d1..c717028 100644 --- a/templates/repository.json.template +++ b/templates/repository.json.template @@ -82,6 +82,7 @@ "read_first": [ "README.md", "AUTHOR.md", + "repository-variables.json", "repository.json", "AGENTS.md" ], diff --git a/tests/README.md b/tests/README.md index d3b9cb2..810fe06 100644 --- a/tests/README.md +++ b/tests/README.md @@ -6,4 +6,6 @@ Run the dependency-free unit tests with: python -m unittest discover -s tests -p "test_*.py" ``` -The tests validate the current repository and protect key failure cases in `scripts/validate_repository.py`. +The tests validate the current repository and protect key failure cases in +`scripts/validate_repository.py`, including mismatches between +`repository-variables.json` and `repository.json`. diff --git a/tests/test_repository.py b/tests/test_repository.py index a409668..286e7dc 100644 --- a/tests/test_repository.py +++ b/tests/test_repository.py @@ -1,7 +1,9 @@ from __future__ import annotations import importlib.util +import json from pathlib import Path +import shutil import tempfile import unittest @@ -27,6 +29,24 @@ class RepositoryValidationTests(unittest.TestCase): any("Missing required path" in item["message"] for item in result["findings"]) ) + def test_variable_identity_mismatch_fails(self) -> None: + with tempfile.TemporaryDirectory() as directory: + copy = Path(directory) / "repository" + shutil.copytree(ROOT, copy, ignore=shutil.ignore_patterns(".git", "__pycache__")) + variables_path = copy / "repository-variables.json" + variables = json.loads(variables_path.read_text(encoding="utf-8")) + variables["identity"]["publisher"]["name"] = "Different Publisher" + variables_path.write_text(json.dumps(variables, indent=2) + "\n", encoding="utf-8") + result = VALIDATOR.validate(copy) + self.assertFalse(result["passed"]) + self.assertTrue( + any( + "Publisher differs between repository-variables.json and repository.json" + in item["message"] + for item in result["findings"] + ) + ) + if __name__ == "__main__": unittest.main()