Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
Expand All @@ -30,12 +28,16 @@ jobs:
- name: Install mdBook
run: |
mkdir -p "$HOME/bin"
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.37/mdbook-v0.4.37-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C "$HOME/bin"
curl -fLsS https://github.com/rust-lang/mdBook/releases/download/v0.5.2/mdbook-v0.5.2-x86_64-unknown-linux-gnu.tar.gz -o mdbook.tar.gz
echo '084e4342ba564db270108763e404a7d1f309d932651a22484e93c0dc1a071f6d mdbook.tar.gz' | sha256sum --check
tar -xzf mdbook.tar.gz -C "$HOME/bin"
echo "$HOME/bin" >> $GITHUB_PATH

- name: Install Typst
run: |
curl -sSL https://github.com/typst/typst/releases/download/v0.14.0/typst-x86_64-unknown-linux-musl.tar.xz | tar -xJ
curl -fLsS https://github.com/typst/typst/releases/download/v0.15.1/typst-x86_64-unknown-linux-musl.tar.xz -o typst.tar.xz
echo 'a6d077d0a95eed5a2eba715b2dae06be954f624ccbf85758a03f389ded33118c typst.tar.xz' | sha256sum --check
tar -xJf typst.tar.xz
mv typst-x86_64-unknown-linux-musl/typst "$HOME/bin/"

- name: Install Node dependencies
Expand All @@ -54,9 +56,6 @@ jobs:
- name: Build mdBook
run: mdbook build

- name: Build research website
run: python3 scripts/build_website.py

- name: Build PDF
run: typst compile --root . docs/paper/reductions.typ book/reductions.pdf

Expand All @@ -68,21 +67,38 @@ jobs:
mkdir -p book/api
cp -r target/doc/* book/api/

- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build research website
run: python3 scripts/build_website.py

- name: Verify deployment artifact
run: |
python3 -m pip install playwright==1.58.0
python3 -m playwright install --with-deps chromium
npm audit --audit-level=moderate
npm run test:reduction-graph-js
python3 -m unittest discover -s scripts -p 'test_website_build.py'
python3 -m http.server 3001 --bind 127.0.0.1 --directory book &
server_pid=$!
trap 'kill "$server_pid"' EXIT
python3 scripts/test_website.py

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './book'

deploy:
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Makefile for problemreductions

.PHONY: help build test bench mcp-test fmt clippy doc mdbook website paper clean coverage rust-export compare qubo-testdata export-schemas release run-plan run-issue run-pipeline run-pipeline-forever run-review run-review-forever board-next board-claim board-ack board-move issue-context issue-guards pr-context pr-wait-ci worktree-issue worktree-pr diagrams jl-testdata cli cli-demo copilot-review papers papers-lookup papers-download papers-scihub papers-status papers-push papers-pull papers-index
.PHONY: help build test bench mcp-test fmt clippy doc mdbook website paper paper-data clean coverage rust-export compare qubo-testdata export-schemas release run-plan run-issue run-pipeline run-pipeline-forever run-review run-review-forever board-next board-claim board-ack board-move issue-context issue-guards pr-context pr-wait-ci worktree-issue worktree-pr diagrams jl-testdata cli cli-demo copilot-review papers papers-lookup papers-download papers-scihub papers-status papers-push papers-pull papers-index

RUNNER ?= codex
CLAUDE_MODEL ?= opus
Expand Down Expand Up @@ -94,22 +94,28 @@ clippy:
node_modules/elkjs/package.json: package.json package-lock.json
npm ci

# Example data read by docs/paper/reductions.typ, which the PDF and the website details compile.
paper-data:
cargo run --features "$(TEST_FEATURES)" --example export_examples
cargo run --features "$(TEST_FEATURES)" --example export_petersen_mapping

# Build mdBook documentation
doc: node_modules/elkjs/package.json
doc: node_modules/elkjs/package.json paper-data
cargo run --example export_graph
node scripts/generate_reduction_graph_layout.js
cargo run --example export_schemas
cargo build -p problemreductions-cli --bin pred
bash scripts/generate_doc_snippets.sh target/debug/pred
mdbook build
python3 scripts/build_website.py
RUSTDOCFLAGS="--default-theme=dark" cargo doc --no-deps
rm -rf book/api
cp -r target/doc book/api
python3 scripts/build_website.py

# Build the product website with fresh atlas data; API/PDF builds remain in doc/paper.
website:
website: node_modules/elkjs/package.json paper-data
cargo run --example export_graph
node scripts/generate_reduction_graph_layout.js
cargo run --example export_schemas
cargo build -p problemreductions-cli --bin pred
bash scripts/generate_doc_snippets.sh target/debug/pred
Expand All @@ -128,7 +134,7 @@ diagrams:
done

# Build and serve mdBook with API docs
mdbook: node_modules/elkjs/package.json
mdbook: node_modules/elkjs/package.json paper-data
@echo "Exporting graph..."
@cargo run --example export_graph 2>&1 | tail -1
@echo "Generating graph layout..."
Expand All @@ -142,9 +148,9 @@ mdbook: node_modules/elkjs/package.json
@RUSTDOCFLAGS="--default-theme=dark" cargo doc --no-deps 2>&1 | tail -1
@echo "Building mdBook..."
@mdbook build
@python3 scripts/build_website.py
rm -rf book/api
cp -r target/doc book/api
@python3 scripts/build_website.py
@-lsof -ti:3001 | xargs kill 2>/dev/null || true
@echo "Serving at http://localhost:3001"
python3 -m http.server 3001 -d book &
Expand All @@ -156,9 +162,7 @@ export-schemas:
cargo run --example export_schemas

# Build Typst paper (generates example data on demand)
paper:
cargo run --features "$(TEST_FEATURES)" --example export_examples
cargo run --features "$(TEST_FEATURES)" --example export_petersen_mapping
paper: paper-data
cargo run --features "$(TEST_FEATURES)" --example export_graph
cargo run --features "$(TEST_FEATURES)" --example export_schemas
typst compile --root . docs/paper/reductions.typ docs/paper/reductions.pdf
Expand Down
9 changes: 7 additions & 2 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ src = "docs/src"
default-theme = "navy"
git-repository-url = "https://github.com/CodingThrust/problem-reductions"
edit-url-template = "https://github.com/CodingThrust/problem-reductions/edit/main/{path}"
additional-css = ["docs/src/static/docs-theme.css", "docs/src/static/theme-images.css", "docs/src/static/reduction-graph.css"]
additional-js = ["docs/src/static/docs-theme.js", "docs/src/static/cytoscape.min.js", "docs/src/static/reduction-graph.js"]
additional-css = ["docs/src/static/docs-theme.css", "docs/src/static/theme-images.css"]
additional-js = ["docs/src/static/docs-theme.js"]
no-section-label = true

[output.html.fold]
Expand All @@ -32,3 +32,8 @@ boost-paragraph = 1
expand = true
heading-split-level = 3
copy-js = true

# Pages that moved to the website keep their published URLs.
[output.html.redirect]
"/reduction-graph.html" = "graph.html"
"/open-problems.html" = "index.html#open-questions"
73 changes: 69 additions & 4 deletions docs/paper/reductions.typ
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#import "@preview/cetz:0.4.2": canvas, draw
#import "@preview/ctheorems:1.1.3": thmbox, thmplain, thmproof, thmrules
#import "lib.typ": g-node, g-edge, petersen-graph, house-graph, octahedral-graph, draw-grid-graph, draw-triangular-graph, graph-colors, selem, sregion, draw-node-highlight, draw-edge-highlight, draw-node-colors, sregion-selected, sregion-dimmed, gate-and, gate-or, gate-xor
#import "web.typ": export-details, detail-key, detail-article

#set page(
paper: "a4",
Expand All @@ -64,6 +65,36 @@

// Set up theorem environments with ctheorems
#show: thmrules.with(qed-symbol: $square$)
#show math.equation: it => context {
if export-details and target() == "html" {
html.elem(if it.block { "div" } else { "span" }, attrs: (class: "typst-math"), html.frame(it))
} else { it }
}
#show figure: it => context {
if export-details and target() == "html" {
html.elem("figure")[
#html.frame(it.body)
#if it.caption != none { html.elem("figcaption", it.caption.body) }
]
} else { it }
}
#show block: it => context {
if export-details and target() == "html" {
if it.height != auto { html.frame(it) } else { html.elem("div", it.body) }
} else { it }
}
#show align: it => context {
if export-details and target() == "html" { it.body } else { it }
}
#show pad: it => context {
if export-details and target() == "html" { it.body } else { it }
}
#show grid: it => context {
if export-details and target() == "html" { html.frame(it) } else { it }
}
#show stack: it => context {
if export-details and target() == "html" { html.frame(it) } else { it }
}

// === Example JSON helpers ===
// Load the generated canonical example database.
Expand Down Expand Up @@ -515,6 +546,7 @@

// Render a block of pred CLI commands for reproducibility
#let pred-commands(..cmds) = {
if export-details { return raw(cmds.pos().join("\n"), block: true) }
block(
width: 100%,
fill: luma(245),
Expand Down Expand Up @@ -545,8 +577,22 @@
)

// Problem definition wrapper: auto-adds schema, complexity, reductions list, and label
#let problem-def(name, def, body) = {
let lbl = label("def:" + name)
#show ref: it => context {
let name = str(it.target)
if export-details and target() == "html" and name.starts-with("def:") {
link(it.target, display-name.at(name.slice(4)))
} else { it }
}
#let problem-def(name, def, body, variant: none) = {
if export-details {
return detail-article("problem:" + detail-key(name, variant))[
#html.elem("h3")[Definition]
#def
#html.elem("h3")[Background and example]
#body
]
}
let lbl = label("def:" + detail-key(name, variant))
let title = display-name.at(name)
[#definition(title)[
#def
Expand Down Expand Up @@ -600,8 +646,23 @@
example-target-variant: none,
example-caption: none,
extra: none,
source-variant: none,
target-variant: none,
theorem-body, proof-body,
) = {
if export-details {
return detail-article("rule:" + detail-key(source, source-variant) + "->" + detail-key(target, target-variant))[
#html.elem("h3")[Reduction]
#theorem-body
#html.elem("h3")[Proof]
#proof-body
#if example {
html.elem("h3")[Example]
if example-caption != none { strong(example-caption) }
extra
}
]
}
let arrow = sym.arrow.r
let edge = find-edge(source, target)
let src-disp = if edge != none { variant-display(graph-data.nodes.at(edge.source)) }
Expand All @@ -611,7 +672,7 @@
let src-lbl = label("def:" + source)
let tgt-lbl = label("def:" + target)
let parameters = if edge != none and edge.parameters.len() > 0 { edge.parameters } else { none }
let thm-lbl = label("thm:" + source + "-to-" + target)
let thm-lbl = label("thm:" + detail-key(source, source-variant) + "-to-" + detail-key(target, target-variant))
covered-rules.update(old => old + ((source, target),))

[
Expand Down Expand Up @@ -19475,4 +19536,8 @@ The following table shows concrete target-variable counts for example instances,
]

#pagebreak()
#bibliography("references.bib", style: "ieee")
#if export-details {
detail-article("references")[#bibliography("references.bib", style: "ieee")]
} else {
bibliography("references.bib", style: "ieee")
}
12 changes: 12 additions & 0 deletions docs/paper/web.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Web presentation only; all definitions, proofs, and examples stay in reductions.typ.
#let export-details = sys.inputs.at("details", default: "false") == "true"

#let detail-key(name, variant) = {
if variant == none { return name }
name + "/" + variant.keys().sorted().map(key => key + "=" + str(variant.at(key))).join(",")
}

#let detail-article(key, body) = {
let anchor = key.replace("problem:", "def:").replace("rule:", "thm:").replace("->", "-to-")
[#html.elem("article", attrs: ("data-detail-key": key), body)#label(anchor)]
}
5 changes: 0 additions & 5 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

- [Quick start](cli.md)
- [Command reference](cli-commands.md)
- [Reduction graph](reduction-graph.md)

# Agents

Expand All @@ -17,7 +16,3 @@
- [Getting started](getting-started.md)
- [API reference](api.md)
- [Design](design.md)

# Research

- [Open problems](open-problems.md)
2 changes: 1 addition & 1 deletion docs/src/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ let restored: MaximumIndependentSet<SimpleGraph, i64> = from_json(&json)?;

## Contributing

See [Call for Contributions](./open-problems.md) for the recommended issue-based workflow (no coding required).
See [Call for Contributions](index.html#open-questions) for the recommended issue-based workflow (no coding required).

### QUBO coefficient storage

Expand Down
3 changes: 0 additions & 3 deletions docs/src/open-problems.md

This file was deleted.

35 changes: 0 additions & 35 deletions docs/src/reduction-graph.md

This file was deleted.

31 changes: 0 additions & 31 deletions docs/src/static/cytoscape.min.js

This file was deleted.

9 changes: 7 additions & 2 deletions docs/src/static/docs-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ html[class] {
--sidebar-fg: #adb9af;
--sidebar-active: #c4dda6;
--sidebar-non-existant: #87968b;
--sidebar-width: 264px;
--sidebar-target-width: 264px;
--sidebar-width: min(var(--sidebar-target-width), 80vw);
--links: #c4dda6;
--inline-code-color: #d5e7c5;
--theme-popup-bg: #19241d;
Expand Down Expand Up @@ -56,6 +57,8 @@ body {
}
.docs-brand {
display: flex;
height: 78px;
box-sizing: border-box;
align-items: center;
gap: 12px;
padding: 9px 18px;
Expand All @@ -66,7 +69,9 @@ body {
}
.docs-brand img {
width: 204px;
height: 59px;
max-width: 100%;
min-width: 0;
height: auto;
object-fit: contain;
}
.sidebar .sidebar-scrollbox {
Expand Down
Loading