feat(PR-02): DocumentModel, Analysis v2 projection, single renderer and Live browsing

- document.rs: comrak marqdo.md.v1 parse -> DocBlock/Inline with exact UTF-8 spans
- semantic.rs: typed Analysis v2 validation (schema/profile/root_id/source_digest,
  units/functions/statements/resources/imports/references/calls/diagnostics,
  per-span UTF-8 checks with explicit view.source_span_invalid warnings)
- presentation.rs: one PresentationModel/Outline with source status matrix
- render.rs: one ReaderRenderer; sanitized GFM, statement anchors, heading mode
  badges (display-only prefix strip), source pane, docs/Live|Static link policy,
  CSP meta, no inline scripts, no raw HTML execution
- server.rs: loopback-only Live reader with Host/DNS-rebinding checks, strict
  percent decoding, project path boundary, security headers, read-only APIs
- app.rs: AppContext degradation (core missing -> prose-only, check error ->
  diagnostics + revoked semantics, protocol mismatch -> hard error)
- assets: single reader.css/reader.js + embedded SHA-256 AssetBundle, copied
  legacy logo/blossom/feather with provenance
- examples + frozen-CLI Analysis goldens + rendering/HTTP/asset/no-coupling tests
- ADR-0003 heading prefix/anchor identity; docs updated
This commit is contained in:
marqdo-view dev committed 2026-11-22 11:19:11 +08:00
1 parent 8ba20a5c67
commit 80ce564f09
47 files changed
+26127 -203

No files matched your search

+10 -1
View File
@@ -13,7 +13,11 @@ pub fn view_bin() -> &'static str {
}
pub fn temp_root(name: &str) -> PathBuf {
let dir = PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join(name);
use std::sync::atomic::{AtomicU64, Ordering};
static NEXT: AtomicU64 = AtomicU64::new(0);
let seq = NEXT.fetch_add(1, Ordering::Relaxed);
let dir = PathBuf::from(env!("CARGO_TARGET_TMPDIR"))
.join(format!("{name}-{}-{seq}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).expect("create test temp dir");
dir
@@ -79,6 +83,7 @@ case "$1" in
;;
check)
if [ -f "$dir/check_stderr" ]; then cat "$dir/check_stderr" >&2; fi
if [ -f "$dir/check_json" ]; then cat "$dir/check_json"; fi
emit=""
prev=""
for a in "$@"; do
@@ -126,6 +131,10 @@ esac
std::fs::write(self.dir.join("check_stderr"), stderr).expect("write stderr");
}
pub fn set_check_json(&self, json: &str) {
std::fs::write(self.dir.join("check_json"), json).expect("write check json");
}
pub fn set_analysis(&self, analysis: &str) {
std::fs::write(self.dir.join("analysis.json"), analysis).expect("write analysis");
}