Skip to content
quarry Artifact [ad3ed7c42b]
Login

Artifact [ad3ed7c42b]

Artifact ad3ed7c42bc960a0b317187704a8c39d79e4586dc5ce99e71c003e43e80314f1:


#!/bin/sh
# Build the synthetic fixture store (0003 phase 0): a fossil repository
# heavy on non-file artifacts — wiki, tickets, branches — converted to a
# zit store via the serve-and-clone path (0003 §6: the bare-.fossil reader
# is upstream zit work; until it lands, fossil serve + zit clone is the
# conversion route).
#
# Output: fixtures/out/synthetic/ (a zit checkout). fixtures/out is
# GENERATED and untracked — zit has no ignore globs yet (zit#64), so never
# `zit addremove` in this repo; see AGENTS notes.
#
# Forum posts and chat have no fossil CLI write path; they join the corpus
# when quarry can author them through its own ingest (tracked in 0003 §1).
set -eu

port=8929
root=$(cd "$(dirname "$0")" && pwd)
out="$root/out"
work=$(mktemp -d)
trap 'pkill -f "fossil serve $work/synthetic.fossil" 2>/dev/null || true; rm -rf "$work"' EXIT

command -v fossil >/dev/null || { echo "fossil not on PATH" >&2; exit 1; }
command -v zit >/dev/null || { echo "zit not on PATH" >&2; exit 1; }

fossil init "$work/synthetic.fossil" >/dev/null
mkdir "$work/co"
cd "$work/co"
fossil open "$work/synthetic.fossil" >/dev/null

# --- file history: a few commits and a branch ---
cat > README.md <<'EOF'
# synthetic

Fixture store for quarry's disposability harness. Content is deliberately
boring; the artifact *shapes* (wiki, tickets, branches) are the point.
EOF
fossil add README.md >/dev/null
fossil commit -m "add README" --no-warnings >/dev/null

mkdir src
printf 'package main\n\nfunc main() {}\n' > src/main.go
fossil add src/main.go >/dev/null
fossil commit -m "add src/main.go" --no-warnings >/dev/null

printf 'notes line one\n' > NOTES.md
fossil add NOTES.md >/dev/null
fossil commit -m "add NOTES" --branch feature --no-warnings >/dev/null

fossil update trunk >/dev/null 2>&1
printf 'trunk continues\n' >> README.md
fossil commit -m "extend README on trunk" --no-warnings >/dev/null

# --- wiki: several pages, one edited so the page has history ---
fossil wiki create "HomePage" --mimetype text/x-markdown <<'EOF'
# Home

Welcome to the synthetic fixture. See [Design](Design) and [FAQ](FAQ).
EOF
fossil wiki create "Design" --mimetype text/x-markdown <<'EOF'
Design notes with a code block:

    fn main() {}

And a timestamp: 2026-08-14T12:00:00Z
EOF
fossil wiki create "FAQ" --mimetype text/x-markdown <<'EOF'
Q: why? A: coverage.
EOF
fossil wiki commit "HomePage" --mimetype text/x-markdown <<'EOF'
# Home

Welcome to the synthetic fixture (revised). See [Design](Design).
EOF

# --- tickets: a few, in different states ---
fossil ticket add title "crash on empty input" status Open type Code_Defect >/dev/null
fossil ticket add title "add dark mode" status Open type Feature_Request >/dev/null
closed=$(fossil ticket add title "typo in docs" status Open type Documentation | awk '{print $NF}')
fossil ticket change "$closed" status Closed resolution Fixed >/dev/null

# --- serve and clone ---
rm -rf "$out/synthetic"
mkdir -p "$out"
fossil serve "$work/synthetic.fossil" --port "$port" --localhost >"$work/serve.log" 2>&1 &
sleep 1
zit clone "http://localhost:$port" "$out/synthetic"
pkill -f "fossil serve $work/synthetic.fossil" 2>/dev/null || true

echo "built $out/synthetic"