Implement the first Preview candidate in its unique owner repository: - marqdo web check/preview/handoff with explicit ENTRY/--unit/--root/--out/ --theme; independent executable packaged with tool.json (command web, api_revision/analysis requirements). - Consume only the public marqdo-web-design crate at a fixed git revision (Cargo.lock pinned; no ../design path dependency, no Markdown re-parsing). - preview renders one offline index.html: strict hashed CSP (default-src 'none', no network), visible prototype banner and build summary, escaped Design ContentBlocks (raw HTML stays inert), finite-state scenario panels with hashed inline script and reset, no server/timer/eval business logic. - Publication refuses existing outputs and symlink targets, builds in a private sibling staging dir and renames atomically; 0/1/2 exit codes with stderr diagnostics. - scripts/ci.sh installs the Tool through the real CLI, runs all three commands on a fixture project, asserts the offline/safety facts, verifies the CLI binary digest is unchanged and removes the Tool. - Evidence records we do NOT yet claim real-browser/responsive acceptance, image assets, the full negative matrix, budgets/timeouts or WEB-05 cold install. Refs cflmy/marqdo-web-preview#1, cflmy/marqdo#6
38 lines
1.6 KiB
Bash
Executable File
38 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# WEB-02 independent entry: real CLI, installed web Tool, offline artifact checks.
|
|
set -eu
|
|
: "${MARQDO_BIN:?set MARQDO_BIN to the verified marqdo executable}"
|
|
cd "$(dirname "$0")/.."
|
|
cargo fmt --all -- --check
|
|
cargo clippy --all-targets --locked -- -D warnings
|
|
scripts/package.sh
|
|
work="$(mktemp -d)"
|
|
trap 'rm -rf "$work"' EXIT
|
|
export MARQDO_TOOL_HOME="$work/tool-home"
|
|
cli_before="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
|
|
"$MARQDO_BIN" tool install "$PWD/dist/marqdo-web-preview/tool.json"
|
|
"$MARQDO_BIN" web check tests/fixture/index.mq.md --unit 工作台
|
|
preview="$work/preview"
|
|
"$MARQDO_BIN" web preview tests/fixture/index.mq.md --unit 工作台 --out "$preview" --theme light
|
|
test -f "$preview/index.html"
|
|
grep -q "Content-Security-Policy" "$preview/index.html"
|
|
grep -q "default-src 'none'" "$preview/index.html"
|
|
grep -q "原型 / 模拟" "$preview/index.html"
|
|
grep -q "raw HTML as inert text" "$preview/index.html"
|
|
grep -q "模拟保存" "$preview/index.html"
|
|
grep -q "data-scenario" "$preview/index.html"
|
|
! grep -q "href=\"javascript:" "$preview/index.html"
|
|
! grep -q "<script src" "$preview/index.html"
|
|
handoff="$work/handoff.md"
|
|
"$MARQDO_BIN" web handoff tests/fixture/index.mq.md --unit 工作台 --out "$handoff"
|
|
test -s "$handoff"
|
|
grep -q "Design handoff" "$handoff"
|
|
if "$MARQDO_BIN" web preview tests/fixture/index.mq.md --unit 工作台 --out "$preview" 2>/dev/null; then
|
|
echo "preview overwrote an existing directory" >&2
|
|
exit 1
|
|
fi
|
|
cli_after="$(sha256sum "$MARQDO_BIN" | cut -d' ' -f1)"
|
|
test "$cli_before" = "$cli_after"
|
|
"$MARQDO_BIN" tool remove web
|
|
echo "PASS: marqdo web Tool check/preview/handoff/remove"
|