#!/bin/sh # Regenerate the committed Analysis positive fixture with a real core CLI. # # Usage: scripts/regenerate-analysis-fixture.sh /path/to/marqdo # The emitted artefact is recorded together with the producer identity in # tests/fixtures/analysis/README.md. Never hand-edit the fixture. set -eu ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) BIN=${1:?usage: $0 /path/to/marqdo} WORK=$(mktemp -d) trap 'rm -rf "$WORK"' EXIT mkdir -p "$WORK/project/physics" cat > "$WORK/project/marqdo.yaml" <<'YAML' project: name: demo version: 0.1.0 marqdo: ">=3.0.0-beta.1,<4.0.0" dependencies: {} YAML cat > "$WORK/project/physics/mechanics.mq.md" <<'MD' --- type: Theory title: 经典力学 tags: [physics, mechanics] --- # 经典力学 ## @knowledge 牛顿第二定律 合外力等于质量与加速度的乘积。 $$ F = ma $$ | 符号 | 含义 | | --- | --- | | m | 质量 | | a | 加速度 | 计算入口:[计算力](#计算力)。 ## @exec 计算力 `params(m, a)` 依据[牛顿第二定律](#牛顿第二定律)。 `return m * a` MD ( cd "$WORK/project" "$BIN" check physics/mechanics.mq.md --emit "$WORK/analysis.json" ) cp "$WORK/analysis.json" "$ROOT/tests/fixtures/analysis/mechanics.json" ( cd "$ROOT/tests/fixtures/analysis" sha256sum mechanics.json > mechanics.json.sha256 ) "$BIN" --version sha256sum "$BIN"