完整测试通过
This commit is contained in:
@@ -77,42 +77,42 @@
|
||||
"raw/Cloud & DevOps/These 6 Linux apps let you monitor system resources in style.md": {
|
||||
"hash": "a31075218ca6624e",
|
||||
"modified": "2026-04-14T04:28:42.641312+00:00",
|
||||
"slug": "These-6-Linux-apps-let-you-monitor-system-resources-in-style",
|
||||
"source_path": "wiki/sources/These-6-Linux-apps-let-you-monitor-system-resources-in-style.md",
|
||||
"slug": "these-6-linux-apps-let-you-monitor-system-resources-in-style",
|
||||
"source_path": "wiki/sources/these-6-linux-apps-let-you-monitor-system-resources-in-style.md",
|
||||
"ingested": true,
|
||||
"ingested_at": "2026-04-16T06:20:57+00:00"
|
||||
},
|
||||
"raw/Cloud & DevOps/RTO vs RPO Key Differences for Modern Disaster Recovery.md": {
|
||||
"hash": "54e2ec8ad0a3202d",
|
||||
"modified": "2026-04-14T04:28:42.627898+00:00",
|
||||
"slug": "RTO-vs-RPO-Key-Differences-for-Modern-Disaster-Recovery",
|
||||
"source_path": "wiki/sources/RTO-vs-RPO-Key-Differences-for-Modern-Disaster-Recovery.md",
|
||||
"slug": "rto-vs-rpo-key-differences-for-modern-disaster-recovery",
|
||||
"source_path": "wiki/sources/rto-vs-rpo-key-differences-for-modern-disaster-recovery.md",
|
||||
"ingested": true,
|
||||
"ingested_at": "2026-04-16T06:35:00+00:00"
|
||||
},
|
||||
"raw/Cloud & DevOps/How to Simplify Multi-Account Deployments Monitoring Centralized Logs for AWS CloudFormation StackSets.md": {
|
||||
"hash": "6719289e55a83ef8",
|
||||
"modified": "2026-04-14T04:28:42.627379+00:00",
|
||||
"slug": "How-to-Simplify-Multi-Account-Deployments-Monitoring-Centralized-Logs-for-AWS-CloudFormation-StackSets",
|
||||
"source_path": "wiki/sources/How-to-Simplify-Multi-Account-Deployments-Monitoring-Centralized-Logs-for-AWS-CloudFormation-StackSets.md",
|
||||
"slug": "how-to-simplify-multi-account-deployments-monitoring",
|
||||
"source_path": "wiki/sources/how-to-simplify-multi-account-deployments-monitoring.md",
|
||||
"ingested": true,
|
||||
"ingested_at": "2026-04-16T08:46:30.130439+00:00"
|
||||
},
|
||||
"raw/Cloud & DevOps/Understanding Complete ITSM.md": {
|
||||
"hash": "71ce0a0425bf6c22",
|
||||
"modified": "2026-04-14T04:28:42.630861+00:00",
|
||||
"slug": "Understanding-Complete-ITSM",
|
||||
"source_path": "wiki/sources/Understanding-Complete-ITSM.md",
|
||||
"slug": "modern-itsm-driving-efficiency-security-resilience",
|
||||
"source_path": "wiki/sources/modern-itsm-driving-efficiency-security-resilience.md",
|
||||
"ingested": true,
|
||||
"ingested_at": "2026-04-16T08:46:30.130604+00:00"
|
||||
},
|
||||
"raw/Cloud & DevOps/What is DevSecOps Best Practices, Benefits, and Tools.md": {
|
||||
"hash": "f4257c49bc1ec641",
|
||||
"modified": "2026-04-14T04:28:42.631251+00:00",
|
||||
"slug": "What-is-DevSecOps-Best-Practices--Benefits--and-Tools",
|
||||
"source_path": "wiki/sources/What-is-DevSecOps-Best-Practices--Benefits--and-Tools.md",
|
||||
"ingested": false,
|
||||
"ingested_at": null
|
||||
"slug": "what-is-devsecops-best-practices-benefits-and-tools",
|
||||
"source_path": "wiki/sources/what-is-devsecops-best-practices-benefits-and-tools.md",
|
||||
"ingested": true,
|
||||
"ingested_at": "2026-04-16T09:07:53.809640+00:00"
|
||||
},
|
||||
"raw/Cloud & DevOps/Cloud Operating Model Key Strategies and Best Practices.md": {
|
||||
"hash": "a58d5e980eeaf214",
|
||||
|
||||
@@ -141,6 +141,37 @@ def call_ingest(abs_path: str, slug: str, json_mode: bool = False) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def parse_slug_from_output(output: str) -> str | None:
|
||||
"""从 TMUX 输出中解析 SLUG: xxx 行"""
|
||||
import re
|
||||
match = re.search(r"SLUG:\s*([a-zA-Z0-9_-]+)", output)
|
||||
return match.group(1) if match else None
|
||||
|
||||
|
||||
def update_manifest_with_slug(rel_path: str, actual_slug: str) -> bool:
|
||||
"""更新 manifest 中的 slug 和 source_path"""
|
||||
import json
|
||||
from datetime import datetime, timezone
|
||||
|
||||
manifest_file = Path(__file__).parent / "manifest.json"
|
||||
if not manifest_file.exists():
|
||||
return False
|
||||
|
||||
try:
|
||||
manifest = json.loads(manifest_file.read_text(encoding="utf-8"))
|
||||
if rel_path in manifest["files"]:
|
||||
manifest["files"][rel_path]["slug"] = actual_slug
|
||||
manifest["files"][rel_path]["source_path"] = f"wiki/sources/{actual_slug}.md"
|
||||
manifest["files"][rel_path]["ingested"] = True
|
||||
manifest["files"][rel_path]["ingested_at"] = datetime.now(timezone.utc).isoformat()
|
||||
manifest["updated_at"] = datetime.now(timezone.utc).isoformat()
|
||||
manifest_file.write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Error updating manifest: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def start_tmux_session() -> bool:
|
||||
"""启动 TMUX session 用于 wiki ingest"""
|
||||
TMUX_SESSION = "wiki-ingest"
|
||||
|
||||
Reference in New Issue
Block a user