added
This commit is contained in:
1 parent
1e52a733d1
commit
bd8f9a641f
27 files changed
+817
-33
No files matched your search
@@ -35,8 +35,13 @@ Use `scripts/audit_repository.py` for a read-only baseline and final structural
|
||||
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
|
||||
7. Determine whether the repository is content-heavy. Recommend
|
||||
`content-index.json` when it contains recurring updates, articles, research
|
||||
entries, policies, guides, or enough individual documents that listing each
|
||||
one in `repository.json` would make the repository manifest cumbersome.
|
||||
Keep small repositories on `repository.json` alone.
|
||||
8. Separate facts found in the repository from assumptions and recommendations.
|
||||
9. 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
|
||||
@@ -101,6 +106,12 @@ If implementation requires a material departure from the approved plan, update t
|
||||
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.
|
||||
- for an approved content-heavy repository, create `content-index.json` as
|
||||
the compact catalog of individual authoritative documents. Declare it in
|
||||
`repository.json`, keep document paths repository-relative, use stable
|
||||
`content_id` values, and do not copy full document bodies into the index.
|
||||
Do not add chunk IDs, knowledge IDs, `chunks.json`, or `qa.json` merely
|
||||
because a document is cataloged.
|
||||
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.
|
||||
|
||||
@@ -109,7 +120,8 @@ If implementation requires a material departure from the approved plan, update t
|
||||
1. Run `scripts/audit_repository.py` with the approved profile.
|
||||
2. Parse machine-readable files and check
|
||||
`repository-variables.json` alignment, version alignment, internal paths, and
|
||||
declared entry points.
|
||||
declared entry points. When `content-index.json` exists, check unique content
|
||||
IDs, unique paths, indexed-file existence, and related-content references.
|
||||
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.
|
||||
|
||||
@@ -45,6 +45,7 @@ repository-name/
|
||||
├── AUTHOR.md
|
||||
├── repository-variables.json
|
||||
├── repository.json
|
||||
├── content-index.json # optional for content-heavy repositories
|
||||
├── LICENSE
|
||||
├── CHANGELOG.md
|
||||
├── UPDATES.md
|
||||
@@ -578,6 +579,62 @@ Do not change IDs casually after publication because other catalogs, relationshi
|
||||
|
||||
---
|
||||
|
||||
## `content-index.json`
|
||||
|
||||
### Purpose
|
||||
|
||||
Provides a compact machine-readable catalog of the individual documents inside
|
||||
a content-heavy repository.
|
||||
|
||||
Use the separation:
|
||||
|
||||
```text
|
||||
repository.json
|
||||
Repository identity, purpose, capabilities, entry points, and major collections.
|
||||
|
||||
content-index.json
|
||||
One compact discovery record per individual document.
|
||||
|
||||
Individual Markdown file
|
||||
Complete authoritative human- and AI-readable content.
|
||||
```
|
||||
|
||||
Use `content-index.json` for recurring platform updates, articles, research
|
||||
entries, policies, guides, or dozens of documents. A repository with only a few
|
||||
major files may list those files directly in `repository.json` and omit the
|
||||
content index.
|
||||
|
||||
The index should include stable content IDs, titles, concise descriptions,
|
||||
content types, repository-relative paths, status, dates, and topics. It may
|
||||
include canonical URLs and relationships to other indexed items.
|
||||
|
||||
Do not:
|
||||
|
||||
* Copy full document bodies into the index.
|
||||
* Treat the index as the authoritative source instead of the Markdown file.
|
||||
* Add chunk IDs or knowledge IDs merely because a document is indexed.
|
||||
* Generate `chunks.json` or `qa.json` unless a separate publishing or semantic
|
||||
materialization workflow requires them.
|
||||
* Allow duplicate IDs, duplicate paths, missing paths, absolute paths, or path
|
||||
traversal.
|
||||
|
||||
Declare the index in the `contents` array of `repository.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"path": "content-index.json",
|
||||
"type": "content-index",
|
||||
"title": "Repository Content Index",
|
||||
"description": "Machine-readable index of the repository's published documents.",
|
||||
"required_for_use": true
|
||||
}
|
||||
```
|
||||
|
||||
Use `templates/content-index.json.template` and validate against
|
||||
`schemas/content-index.schema.json`.
|
||||
|
||||
---
|
||||
|
||||
## `LICENSE`
|
||||
|
||||
### Purpose
|
||||
@@ -1701,6 +1758,7 @@ Optional:
|
||||
```text
|
||||
CONTRIBUTING.md
|
||||
skills.md
|
||||
content-index.json
|
||||
templates/
|
||||
examples/
|
||||
assets/
|
||||
@@ -1737,6 +1795,7 @@ tests/
|
||||
receipts/
|
||||
CONTRIBUTING.md
|
||||
SECURITY.md
|
||||
content-index.json when the repository contains a document collection
|
||||
```
|
||||
|
||||
---
|
||||
@@ -1771,6 +1830,7 @@ assets/
|
||||
.env.example
|
||||
.gitignore
|
||||
dependency manifest
|
||||
content-index.json when documentation or release notes form a large collection
|
||||
```
|
||||
|
||||
---
|
||||
@@ -1801,6 +1861,7 @@ scripts/
|
||||
tests/
|
||||
examples/
|
||||
SECURITY.md
|
||||
content-index.json when the repository catalogs many individually addressable records or documents
|
||||
```
|
||||
|
||||
The README and `data/README.md` should document provenance, collection methodology, limitations, update frequency, field definitions, and rights.
|
||||
@@ -1966,6 +2027,8 @@ Before publishing a new repository:
|
||||
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.
|
||||
[ ] Content-heavy repositories include a valid `content-index.json`; small repositories intentionally omit it.
|
||||
[ ] Every indexed content ID and path is unique and every indexed path exists.
|
||||
[ ] repository_id is stable and unique.
|
||||
[ ] Canonical URL is correct.
|
||||
[ ] LICENSE matches repository.json.
|
||||
|
||||
@@ -94,6 +94,82 @@ def read_version_from_citation(path: Path) -> str | None:
|
||||
return match.group(1) if match else None
|
||||
|
||||
|
||||
def audit_content_index(root: Path, findings: list[dict[str, str]]) -> None:
|
||||
path = root / "content-index.json"
|
||||
if not path.is_file():
|
||||
return
|
||||
try:
|
||||
index = json.loads(path.read_text(encoding="utf-8-sig"))
|
||||
except (OSError, UnicodeError, json.JSONDecodeError) as exc:
|
||||
findings.append({"level": "error", "message": f"content-index.json is invalid: {exc}"})
|
||||
return
|
||||
|
||||
items = index.get("items")
|
||||
if not isinstance(items, list):
|
||||
findings.append(
|
||||
{"level": "error", "message": "content-index.json items must be an array"}
|
||||
)
|
||||
return
|
||||
|
||||
content_ids: set[str] = set()
|
||||
paths: set[str] = set()
|
||||
for position, item in enumerate(items):
|
||||
if not isinstance(item, dict):
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"content-index.json item {position + 1} must be an object",
|
||||
}
|
||||
)
|
||||
continue
|
||||
content_id = item.get("content_id")
|
||||
declared = item.get("path")
|
||||
if not content_id:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"content-index.json item {position + 1} lacks content_id",
|
||||
}
|
||||
)
|
||||
elif content_id in content_ids:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"Duplicate content_id in content-index.json: {content_id}",
|
||||
}
|
||||
)
|
||||
else:
|
||||
content_ids.add(content_id)
|
||||
if not declared:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"content-index.json item {position + 1} lacks path",
|
||||
}
|
||||
)
|
||||
elif declared in paths:
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"Duplicate path in content-index.json: {declared}",
|
||||
}
|
||||
)
|
||||
else:
|
||||
paths.add(declared)
|
||||
declared_path = Path(declared)
|
||||
if (
|
||||
declared_path.is_absolute()
|
||||
or ".." in declared_path.parts
|
||||
or not (root / declared_path).is_file()
|
||||
):
|
||||
findings.append(
|
||||
{
|
||||
"level": "error",
|
||||
"message": f"Indexed content path does not exist or is unsafe: {declared}",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def audit(root: Path, profile: str) -> dict:
|
||||
findings: list[dict[str, str]] = []
|
||||
if not root.is_dir():
|
||||
@@ -235,6 +311,8 @@ def audit(root: Path, profile: str) -> dict:
|
||||
}
|
||||
)
|
||||
|
||||
audit_content_index(root, findings)
|
||||
|
||||
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:
|
||||
|
||||
Reference in new issue
Block a user