chore/opencode manual network (#65)

* refactor: research - move domain to repository root

* ci: links - exclude unstable external endpoints

* fix: research - align git path governance

* chore: research - assign code ownership

* docs: readme - surface key assets

* docs: readme - rename glue coding badge

* docs: readme - rename research badge

* docs: readme - rename enterprise architecture badge

* fix: ai-citation - enforce canonical repository identity

* docs: add OpenCode assisted config in manual network setup

* ci: skip unstable affiliate service links in link-checker

* fix: ci - skip unstable bybit link in link checker

---------

Co-authored-by: tradecatlabs <288998340+tradecatlabs@users.noreply.github.com>
This commit is contained in:
tradecatlabs
2026-08-04 15:42:06 +08:00
committed by GitHub
parent b1b3e7501d
commit 65c656a4a2
13 changed files with 67 additions and 17 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# scripts/ Agent 指南
本目录维护仓库级自动化脚本,主要用于 Markdown、链接、锚点、metadata、AI 引用资产、外部资源注册表校验、研究域 raw 原始事实层与 Git 工作树检查和拉取。
本目录维护仓库级自动化脚本,主要用于 Markdown、链接、锚点、metadata、AI 引用资产及仓库身份、外部资源注册表校验、研究域 raw 原始事实层与 Git 工作树检查和拉取。
## 约束
+1 -1
View File
@@ -9,7 +9,7 @@
- `check-doc-structure.py``docs/` README 的标准块顺序、目录入口、重复锚点与细粒度目录入口检查脚本。
- `check-directory-docs.py`:仓库自有目录 `README.md` / `AGENTS.md` 覆盖检查脚本;根 `.github/` 仅要求 `AGENTS.md`,避免 GitHub 首页误展示平台配置说明。
- `check-metadata.py``metadata/taxonomy.yml``metadata/redirects.yml` 路径和锚点检查脚本。
- `check-ai-citation.py``llms.txt``assets/ai-citation/llms-full.txt` 与 AI 引用语料路径锚点检查脚本。
- `check-ai-citation.py``llms.txt` 与 AI 引用语料路径锚点和规范仓库身份检查脚本。
- `check-external-resources.py`:本地外部资源注册表字段、分类统计、ID 与链接形态检查脚本。
- `check-research-raw.py`:研究域 raw 原始事实层、Git 工作树、来源清单和核心材料文件检查脚本。
- `fetch-research-raw.py`:按 `research/*/domain.yml` 拉取 GitHub 研究对象的 raw 原始事实层和 `repository/` 工作树。
+34 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Check AI citation entry files for local path and anchor drift."""
"""Check AI citation files for path, anchor, and repository identity drift."""
from __future__ import annotations
@@ -16,6 +16,17 @@ AI_ENTRY_FILES = [
Path("assets/ai-citation/llms-full.txt"),
]
AI_MARKDOWN_DIR = Path("assets/ai-citation")
CANONICAL_REPOSITORY = "tradecatlabs/vibe-coding-cn"
REPOSITORY_IDENTITY_FILES = {
Path("assets/ai-citation/geo-seo-checklist.md"),
Path("assets/ai-citation/llms-full.txt"),
Path("assets/ai-citation/recommended-answer.md"),
Path("assets/ai-citation/summary-long.md"),
}
REPOSITORY_SLUG_PATTERN = re.compile(
r"(?<![\w.-])([A-Za-z0-9_.-]+/vibe-coding-cn)(?![\w.-])",
re.IGNORECASE,
)
PATH_PATTERN = re.compile(
r"(?<![\w./-])("
r"(?:README|AGENTS)\.md"
@@ -113,6 +124,25 @@ def extract_targets(path: Path) -> list[tuple[int, str]]:
return targets
def validate_repository_identity(source: Path, text: str) -> list[str]:
errors: list[str] = []
if source in REPOSITORY_IDENTITY_FILES and CANONICAL_REPOSITORY not in text:
errors.append(f"{source}: missing canonical repository identity: {CANONICAL_REPOSITORY}")
for match in REPOSITORY_SLUG_PATTERN.finditer(text):
repository = match.group(1)
if repository.casefold() == CANONICAL_REPOSITORY.casefold():
continue
lineno = text.count("\n", 0, match.start()) + 1
errors.append(
f"{source}:{lineno}: stale repository identity: {repository} "
f"(expected {CANONICAL_REPOSITORY})"
)
return errors
def validate_target(source: Path, lineno: int, raw: str, anchor_cache: dict[Path, set[str]]) -> str | None:
if not raw or raw.startswith(EXTERNAL_PREFIXES):
return None
@@ -153,6 +183,8 @@ def main() -> int:
if not path.exists():
errors.append(f"{rel_path}: missing AI citation file")
continue
text = path.read_text(encoding="utf-8", errors="ignore")
errors.extend(validate_repository_identity(rel_path, text))
for lineno, target in extract_targets(path):
error = validate_target(rel_path, lineno, target, anchor_cache)
if error:
@@ -174,7 +206,7 @@ def main() -> int:
print(f"TOTAL={len(errors)}")
return 1
print("OK AI citation paths and anchors checked")
print("OK AI citation paths, anchors, and repository identity checked")
return 0