lift-free.openapps.xyz

Source

This app’s code and revision history are public. Download a copy or explore the files below.

Public
The app’s code and revision history are public.
Owned app · rev f9f4e37d6945
Run it yourself
Take the whole tree and run it on your own machine. The download needs no account. Cloning needs a sign-in.
Download .zip
bounded clone 23e397d8a5d5bf7756362640
A copy you download is not bounded. The guarantees this app runs under - declared egress, proven invariants, writes that fail closed - live in the runtime serving this page, not in the files. What you get is auditable source you can read and run, with no runtime guarantees attached.
← All files
vite.config.ts
import crypto from "node:crypto";
import fs from "node:fs";
import { defineConfig, type Plugin } from "vite";
import react from "@vitejs/plugin-react";
import { LIBRARY } from "./src/lib/library";

// Writes the service worker, which keeps the app shell on the device so Lift
// opens and logs sets with no connection once it has loaded.
function serviceWorker(): Plugin {
  return {
    name: "lift-sw",
    apply: "build",
    generateBundle(_, bundle) {
      const pub = fs.readdirSync("public", { recursive: true, encoding: "utf8" })
        .filter((f) => fs.statSync(`public/${f}`).isFile() && !f.startsWith("art/card-blog") && !f.startsWith("og/"));
      const shell = ["/", ...[...Object.keys(bundle).filter((f) => f !== "index.html"), ...pub].map((f) => `/${f}`)];
      const hash = crypto.createHash("sha256").update(shell.join("\n"));
      for (const f of Object.values(bundle)) hash.update(f.type === "chunk" ? f.code : f.source);
      for (const f of pub) hash.update(fs.readFileSync(`public/${f}`));
      const source = fs.readFileSync("src/sw.js", "utf8")
        .replace("__VERSION__", hash.digest("hex").slice(0, 12))
        .replace("__SHELL__", JSON.stringify(shell));
      this.emitFile({ type: "asset", fileName: "sw.js", source });
    },
  };
}

// Assistants build routine links from the exercise ids in llms.txt, so the build fails if the
// list there drifts from the library.
function exerciseIdsInLlms(): Plugin {
  return {
    name: "lift-llms-ids",
    apply: "build",
    buildStart() {
      const section = fs.readFileSync("public/llms.txt", "utf8").split("\n## Exercise ids\n")[1]?.split("\n## ")[0] ?? "";
      const listed = new Set([...section.matchAll(/^- ([a-z0-9-]+): /gm)].map((m) => m[1]));
      const ids = new Set(LIBRARY.map((e) => e.id));
      const missing = [...ids].filter((id) => !listed.has(id));
      const extra = [...listed].filter((id) => !ids.has(id));
      if (missing.length || extra.length) this.error(`public/llms.txt exercise list is out of date. Missing: ${missing.join(", ") || "none"}. Not in the library: ${extra.join(", ") || "none"}.`);
    },
  };
}

export default defineConfig({
  plugins: [react(), serviceWorker(), exerciseIdsInLlms()],
  server: { port: 4350, strictPort: true },
  preview: { port: 4350, strictPort: true },
  build: { target: "es2020", chunkSizeWarningLimit: 1500 },
});

Change history

Point OpenApps store links to openapps.free
f9f4e37d69 · 17 hours ago
Add favicon.ico, local share image and openapi.json for links and guides
2796c0063c · 18 hours ago
Bind agent address in policy constants
cf80a3ca66 · 19 hours ago
Add OpenApp contribution strip and OpenApps source links
5e4cc2b9f3 · 19 hours ago
Bounded source sync
ca4a3d3631 · 1 day ago
Bounded source sync
7351063f4d · 1 day ago
Bounded source sync
0ce3238c46 · 1 day ago