Skip to content

Commit bb97d55

Browse files
jjang-aiEric
andauthored
Enforce the public documentation boundary (#26)
* Keep working documents and proof receipts outside public source * Integrate document checks with the existing CI contract --------- Co-authored-by: Eric <eric@osaurus.ai>
1 parent 8e86385 commit bb97d55

187 files changed

Lines changed: 175 additions & 69200 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""Reject private working documents in the Git index before publication."""
2+
from pathlib import PurePosixPath
3+
import re
4+
import subprocess
5+
import sys
6+
7+
PRIVATE_PREFIXES = (
8+
"docs/internal/", "docs/plans/", "docs/runtime/", "docs/superpowers/",
9+
"research/", "notes/", "botes/", ".agents/", ".claude/", ".codex/",
10+
"proof-artifacts/", "screen-recordings/", "reports/", "ralph_runner/results/",
11+
)
12+
PRIVATE_NAMES = {
13+
"AGENTS.md", "CLAUDE.md", "HANDOFF.md", "PLAN.md", "TODO.md",
14+
"AUDIT_CHECKLIST.md", "INVESTIGATION_LOG.md", "PROMPT.md",
15+
}
16+
DOC_SUFFIXES = {".md", ".rst", ".txt"}
17+
18+
19+
def violations(path: str, content: bytes = b"") -> list[str]:
20+
p = PurePosixPath(path)
21+
reasons = []
22+
if path.startswith(PRIVATE_PREFIXES) or p.name in PRIVATE_NAMES:
23+
reasons.append("private document or evidence path")
24+
if p.suffix.lower() in DOC_SUFFIXES:
25+
text = content.decode("utf-8", errors="replace")
26+
if re.search(r"(?im)^>?.*(?:required sub-skill|for claude:|internal only|do not publish).*$", text):
27+
reasons.append("internal document marker")
28+
if re.search(r"/Users/eric/|/Volumes/Erics|erics-m5-max", text):
29+
reasons.append("maintainer-specific machine path")
30+
return reasons
31+
32+
33+
def main() -> int:
34+
paths = subprocess.check_output(["git", "ls-files", "-z"]).split(b"\0")
35+
failures = []
36+
for raw in filter(None, paths):
37+
path = raw.decode("utf-8")
38+
# Read staged bytes, not a possibly sanitized working copy.
39+
content = b""
40+
if PurePosixPath(path).suffix.lower() in DOC_SUFFIXES:
41+
content = subprocess.check_output(["git", "show", ":" + path])
42+
reasons = violations(path, content)
43+
if reasons:
44+
failures.append((path, reasons))
45+
for path, reasons in failures:
46+
print(path + ": " + "; ".join(reasons), file=sys.stderr)
47+
if failures:
48+
return 1
49+
print("Public document boundary: PASS")
50+
return 0
51+
52+
53+
if __name__ == "__main__":
54+
raise SystemExit(main())
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import importlib.util
2+
from pathlib import Path
3+
import unittest
4+
5+
spec = importlib.util.spec_from_file_location("public_hygiene", Path(__file__).parents[1] / "scripts/check_public_hygiene.py")
6+
module = importlib.util.module_from_spec(spec)
7+
spec.loader.exec_module(module)
8+
9+
10+
class PublicDocumentBoundary(unittest.TestCase):
11+
def test_rejects_private_paths_even_without_content(self):
12+
for path in ("research/results.json", "docs/internal/notes.md", "docs/plans/work.md", "reports/run.json", "nested/HANDOFF.md"):
13+
with self.subTest(path=path):
14+
self.assertTrue(module.violations(path))
15+
16+
def test_rejects_internal_document_renamed_to_public_path(self):
17+
for body in (b"# INTERNAL ONLY", b"> For Claude: REQUIRED SUB-SKILL", b"Run /Users/eric/model/probe.py"):
18+
with self.subTest(body=body):
19+
self.assertTrue(module.violations("docs/guide.md", body))
20+
21+
def test_accepts_public_usage_and_runtime_internal_modules(self):
22+
for path, body in (("docs/api.md", b"Configure a private key through an environment variable."), ("jang-tools/_internal/jang_v3/encode.py", b""), ("tests/test_session_history.py", b""), ("README.md", b"python -m pip install jang")):
23+
with self.subTest(path=path):
24+
self.assertEqual(module.violations(path, body), [])
25+
26+
27+
if __name__ == "__main__":
28+
unittest.main()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Public document boundary
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main]
6+
permissions:
7+
contents: read
8+
jobs:
9+
public-documents:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
13+
- run: python -m unittest discover -s .github/tests -p 'test_public_hygiene.py'
14+
- run: python .github/scripts/check_public_hygiene.py

‎.gitignore‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,17 @@ verify_quant_*.py
155155

156156
# Internal issue/audit reports
157157
jangtq_*_report.md
158+
159+
# Private working documents and proof receipts
160+
/docs/plans/
161+
/docs/runtime/
162+
/docs/superpowers/
163+
/reports/
164+
**/HANDOFF.md
165+
**/PLAN.md
166+
**/AUDIT_CHECKLIST.md
167+
**/INVESTIGATION_LOG.md
168+
/ralph_runner/PROMPT.md
169+
170+
# Public repository-boundary regression tests
171+
!.github/tests/test_public_hygiene.py

‎docs/plans/2026-03-24-turboquant-integration.md‎

Lines changed: 0 additions & 281 deletions
This file was deleted.

0 commit comments

Comments
 (0)