Updates for hooks

This commit is contained in:
2026-03-17 20:30:36 -05:00
parent 5d7ee6e00f
commit d51060fbec
3 changed files with 33 additions and 33 deletions

View File

@@ -18,7 +18,15 @@
"Bash(pip install:*)", "Bash(pip install:*)",
"Bash(python3 -m pip install requests python-dotenv)", "Bash(python3 -m pip install requests python-dotenv)",
"Bash(python3 -c \"import sys; print\\(sys.executable\\)\")", "Bash(python3 -c \"import sys; print\\(sys.executable\\)\")",
"Bash(python -c \"import sys; print\\(sys.executable\\)\")" "Bash(python -c \"import sys; print\\(sys.executable\\)\")",
"Bash(command -v python)",
"Bash(command -v python3)",
"Bash(/c/Python314/python -c \"import requests, dotenv\")",
"Bash(bash -c '[[ -x \"\"/c/Python314/python\"\" ]] && echo \"\"executable\"\" || echo \"\"not executable\"\"')",
"Bash(bash -c '/c/Python314/python -c \"\"import requests, dotenv\"\" 2>&1 && echo OK || echo FAIL')",
"Bash(bash -c '/c/Python314/python -c \"\"import requests, dotenv\"\" && echo OK || echo FAIL')",
"Bash(bash -c '_py_check\\(\\) { [[ -n \"\"$1\"\" ]] && \"\"$1\"\" -c \"\"import requests, dotenv\"\" &>/dev/null 2>&1; }; if _py_check \"\"/c/Python314/python\"\"; then echo \"\"FOUND\"\"; else echo \"\"NOT FOUND\"\"; fi')",
"Bash(bash -c 'set -euo pipefail; _py_check\\(\\) { [[ -n \"\"$1\"\" ]] && \"\"$1\"\" -c \"\"import requests, dotenv\"\" &>/dev/null 2>&1; }; if _py_check \"\"/c/Python314/python\"\"; then echo FOUND; else echo NOT FOUND; fi')"
] ]
} }
} }

View File

@@ -19,17 +19,12 @@ POST_PUSH="$HOOKS_DIR/post-push"
cat > "$POST_PUSH" << 'EOF' cat > "$POST_PUSH" << 'EOF'
#!/usr/bin/env bash #!/usr/bin/env bash
# post-push hook — sync markdown files to WikiJS after every push. # post-push hook — sync markdown files to WikiJS after every push.
cd "$(git rev-parse --show-toplevel)" REPO=$(git rev-parse --show-toplevel)
PYTHON=$(command -v python3 2>/dev/null || command -v python 2>/dev/null || true) powershell.exe -NoProfile -NonInteractive -Command "
if [[ -z "$PYTHON" ]]; then Set-Location '$REPO'
echo "[wikijs] python not found — skipping doc sync" python tools/publish_docs.py
elif ! "$PYTHON" -c "import requests" &>/dev/null; then " || echo "[wikijs] publish failed — run manually: python tools/publish_docs.py"
echo "[wikijs] requests not installed — skipping doc sync (run: $PYTHON -m pip install requests python-dotenv)"
else
"$PYTHON" tools/publish_docs.py || echo "[wikijs] publish failed — run manually: $PYTHON tools/publish_docs.py"
fi
EOF EOF
chmod +x "$POST_PUSH" chmod +x "$POST_PUSH"
echo " Installed post-push hook → $POST_PUSH" echo " Installed post-push hook → $POST_PUSH"

View File

@@ -32,16 +32,24 @@ WIKIJS_API_KEY = os.environ["WIKIJS_API_KEY"] # loud failure if missing
GRAPHQL_ENDPOINT = f"{WIKIJS_URL.rstrip('/')}/graphql" GRAPHQL_ENDPOINT = f"{WIKIJS_URL.rstrip('/')}/graphql"
LOCALE = "en" LOCALE = "en"
# Maps repo-relative file path → WikiJS page path (no leading slash) # Maps repo-relative file path → (WikiJS path, title)
MANIFEST: dict[str, str] = { MANIFEST: dict[str, tuple[str, str]] = {
"README.md": "en/engineering/AI-Framework/home", "README.md": (
"CLAUDE.md": "en/engineering/AI-Framework/CLAUDE", "engineering/AI-Framework", "AI-Framework Project"),
"docker/CLAUDE.md": "en/engineering/AI-Framework/docker", "CLAUDE.md": (
"ignition/CLAUDE.md": "en/engineering/AI-Framework/ignition", "engineering/AI-Framework/CLAUDE", "Claude AI Instructions"),
"testing/CLAUDE.md": "en/engineering/AI-Framework/testing", "docker/CLAUDE.md": (
"webdev/CLAUDE.md": "en/engineering/AI-Framework/webdev", "engineering/AI-Framework/docker", "Docker"),
"ignition/ignition-api.md": "en/engineering/AI-Framework/ignition/ignition-api", "ignition/CLAUDE.md": (
"docker/config/traefik/dynamic/README.md": "en/engineering/AI-Framework/docker/traefik", "engineering/AI-Framework/ignition", "Ignition"),
"testing/CLAUDE.md": (
"engineering/AI-Framework/testing", "Testing"),
"webdev/CLAUDE.md": (
"engineering/AI-Framework/webdev", "WebDev"),
"ignition/ignition-api.md": (
"engineering/AI-Framework/ignition/ignition-api", "Ignition Open API Endpoints"),
"docker/config/traefik/dynamic/README.md": (
"engineering/AI-Framework/docker/traefik", "Traefik"),
} }
@@ -83,16 +91,6 @@ def page_id_for_path(wiki_path: str) -> int | None:
return None return None
def derive_title(local_path: str) -> str:
stem = Path(local_path).stem # e.g. "ignition-api"
if stem.upper() == "README":
# Use parent directory name for README files
parent = Path(local_path).parent.name
if parent == ".":
return "Home"
return parent.replace("-", " ").replace("_", " ").title()
return stem.replace("-", " ").replace("_", " ").title()
def create_page(wiki_path: str, title: str, content: str) -> None: def create_page(wiki_path: str, title: str, content: str) -> None:
mutation = """ mutation = """
@@ -165,9 +163,8 @@ def main() -> int:
errors = 0 errors = 0
for local_rel, wiki_path in MANIFEST.items(): for local_rel, (wiki_path, title) in MANIFEST.items():
local_file = REPO_ROOT / local_rel local_file = REPO_ROOT / local_rel
title = derive_title(local_rel)
if not local_file.exists(): if not local_file.exists():
print(f"[SKIP] {local_rel} (file not found)") print(f"[SKIP] {local_rel} (file not found)")