Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(open-knowledge): auto-promote stable after 24h beta soak (#2524)

Andrew Mikofalvy3dda0ab27a47
diff --git a/.github/scripts/promote-stable-auto.mjs b/.github/scripts/promote-stable-auto.mjs
new file mode 100644
index 000000000..e9d9ff6a9
--- /dev/null
+++ b/.github/scripts/promote-stable-auto.mjs
@@ -0,0 +1,156 @@
+// Beta-selection logic for the Auto-promote stable workflow
+// (.github/workflows/promote-stable-auto.yml).
+//
+// Extracted here (rather than inline bash) so the release-critical decision —
+// which beta, if any, to promote to stable — is unit-tested under
+// `bun test --cwd .github/scripts` (the OK `check` gate), mirroring the
+// scripts/compute-next-beta.mjs precedent. The pure core (deriveStableTag,
+// parseBetaTags, selectPromotion) takes its git/GitHub boundary as injected
+// dependencies so tests need no live repo or API.
+//
+// Fail-loud contract: selectPromotion treats ONLY a genuine "release not found"
+// (404) as "this beta has no release yet" (skip to the next-older candidate).
+// Any other fetch failure (auth, network, rate-limit) is an infrastructure
+// error the caller must surface and retry, NEVER fold into a promote/no-op
+// decision — an unattended path that ships npm `latest` + a signed auto-update
+// DMG must not mis-decide silently. fetchReleaseMeta signals this by returning
+// null for 404 and throwing for everything else; selectPromotion lets the throw
+// propagate so main() can exit non-zero.
+
+import { execFileSync } from "node:child_process";
+import { appendFileSync } from "node:fs";
+import { pathToFileURL } from "node:url";
+
+const BETA_TAG_RE = /^v\d+\.\d+\.\d+-beta\.\d+$/;
+
+// v0.10.0-beta.10 -> v0.10.0. The digit-run match keeps double-digit beta
+// numbers intact (the derived stable tag drops the whole -beta.N suffix).
+export function deriveStableTag(betaTag) {
+ const m = /^(v\d+\.\d+\.\d+)-beta\.\d+$/.exec(betaTag);
+ if (!m) throw new Error(`not a vX.Y.Z-beta.N tag: ${betaTag}`);
+ return m[1];
+}
+
+// Filter raw `git tag` output to conforming beta tags, preserving input order.
+// Ordering is git's job (`--sort=-version:refname`, newest first) — the same
+// resolver promote-stable.yml / release.yml use; this only drops plain vX.Y.Z
+// stable tags and any non-conforming ref.
+export function parseBetaTags(rawTagOutput) {
+ return rawTagOutput
+ .split("\n")
+ .map((s) => s.trim())
+ .filter((s) => BETA_TAG_RE.test(s));
+}
+
+function isFullyCut(meta) {
+ const assets = Array.isArray(meta.assets) ? meta.assets : [];
+ const hasDmg = assets.some((a) => typeof a.name === "string" && a.name.endsWith(".dmg"));
+ const hasManifest = assets.some((a) => typeof a.name === "string" && a.name.endsWith("-mac.yml"));
+ return meta.isDraft !== true && Boolean(meta.publishedAt) && hasDmg && hasManifest;
+}
+
+// Walk betaTags newest -> oldest and return the promotion decision:
+// { kind: "select", target, stableTag } -> dispatch promote-stable for `target`
+// { kind: "stop-promoted", beta, stableTag } -> newest unpromoted candidate is already
+// promoted; descent stops (no target)
+// { kind: "none" } -> nothing eligible right now
+// Selects the LATEST beta that is unpromoted + fully cut + soaked >= soakSeconds.
+// A fresher, under-soaked/not-yet-cut head is skipped in favor of the previous
+// eligible beta; the descent STOPS at the first already-promoted beta so it
+// never reaches back across a promoted cycle boundary. Propagates any throw from
+// fetchReleaseMeta (a non-404 infra error) instead of skipping the candidate.
+export function selectPromotion({ betaTags, tagExists, fetchReleaseMeta, soakSeconds, nowMs }) {
+ const soakMs = soakSeconds * 1000;
+ for (const beta of betaTags) {
+ const stableTag = deriveStableTag(beta);
+ if (tagExists(stableTag)) {
+ return { kind: "stop-promoted", beta, stableTag };
+ }
+ const meta = fetchReleaseMeta(beta); // null === 404 (no release yet); throws on infra error
+ if (meta === null) continue;
+ if (!isFullyCut(meta)) continue;
+ const ageMs = nowMs - Date.parse(meta.publishedAt);
+ if (Number.isNaN(ageMs) || ageMs < soakMs) continue;
+ return { kind: "select", target: beta, stableTag };
+ }
+ return { kind: "none" };
+}
+
+// --- workflow-runtime wiring (real git / gh boundary) ---
+
+function realTagExists(tag) {
+ try {
+ execFileSync("git", ["rev-parse", "--verify", "--quiet", `refs/tags/${tag}`], { stdio: "ignore" });
+ return true;
+ } catch {
+ return false;
+ }
+}
+
+// Distinguish a genuine 404 ("release not found") from any other gh failure.
+// gh writes the not-found message to stderr and exits non-zero; auth / network /
+// rate-limit failures also exit non-zero but with a different message, so we
+// string-match the 404 signature and rethrow everything else (fail loud).
+function realFetchReleaseMeta(tag) {
+ try {
+ const out = execFileSync("gh", ["release", "view", tag, "--json", "isDraft,publishedAt,assets"], {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "pipe"],
+ });
+ const j = JSON.parse(out);
+ return { isDraft: j.isDraft, publishedAt: j.publishedAt || null, assets: j.assets || [] };
+ } catch (err) {
+ const stderr = String(err?.stderr || err?.message || "");
+ if (/release not found|not found|HTTP 404|could not find/i.test(stderr)) {
+ return null;
+ }
+ throw new Error(`gh release view ${tag} failed (non-404 infra error): ${stderr.trim()}`);
+ }
+}
+
+function main() {
+ const soakSeconds = Number(process.env.SOAK_SECONDS || "86400");
+ const rawTags = execFileSync("git", ["tag", "--list", "v*-beta.*", "--sort=-version:refname"], {
+ encoding: "utf8",
+ });
+ const betaTags = parseBetaTags(rawTags);
+
+ let result;
+ try {
+ result = selectPromotion({
+ betaTags,
+ tagExists: realTagExists,
+ fetchReleaseMeta: realFetchReleaseMeta,
+ soakSeconds,
+ nowMs: Date.now(),
+ });
+ } catch (err) {
+ // Fail loud: an infra error means we cannot trust the decision. Exit
+ // non-zero so the failure surfaces in the Actions UI and the next tick
+ // retries once the issue clears — never a silent skip/no-op.
+ console.error(`::error::promote-stable-auto: ${err.message}`);
+ process.exit(1);
+ }
+
+ let target = "";
+ let stable = "";
+ if (result.kind === "select") {
+ target = result.target;
+ stable = result.stableTag;
+ console.log(`::notice::Eligible: ${target} (unpromoted + fully cut + soaked >= ${soakSeconds}s) -> ${stable}`);
+ } else if (result.kind === "stop-promoted") {
+ console.log(`No-op: newest candidate ${result.beta} is already promoted to ${result.stableTag}.`);
+ } else {
+ console.log("No-op: no beta is currently eligible (need unpromoted + fully cut + soaked >= 24h).");
+ }
+
+ if (process.env.GITHUB_OUTPUT) {
+ appendFileSync(process.env.GITHUB_OUTPUT, `target=${target}\nstable=${stable}\n`);
+ }
+}
+
+// Run main() only as a CLI, not when imported by the test file. Portable across
+// node (all ESM versions) and bun — import.meta.main is Node 24+ only.
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
+ main();
+}
diff --git a/.github/scripts/promote-stable-auto.test.mjs b/.github/scripts/promote-stable-auto.test.mjs
new file mode 100644
index 000000000..7ac1974d0
--- /dev/null
+++ b/.github/scripts/promote-stable-auto.test.mjs
@@ -0,0 +1,163 @@
+import { describe, expect, test } from "bun:test";
+import { deriveStableTag, parseBetaTags, selectPromotion } from "./promote-stable-auto.mjs";
+
+// Fixed clock so tests never call Date.now().
+const NOW = Date.parse("2026-07-08T20:00:00Z");
+const SOAK = 86400; // 24h
+const SOAKED = "2026-07-07T14:00:00Z"; // 30h before NOW
+const FRESH = "2026-07-08T17:00:00Z"; // 3h before NOW
+
+function meta({ isDraft = false, publishedAt = SOAKED, dmg = true, manifest = true } = {}) {
+ const assets = [];
+ if (dmg) assets.push({ name: "OpenKnowledge-universal.dmg" });
+ if (manifest) assets.push({ name: "beta-mac.yml" });
+ return { isDraft, publishedAt, assets };
+}
+
+// Build a fetchReleaseMeta from a tag->meta map. Unknown tag === 404 (null);
+// the sentinel "THROW" simulates a non-404 infra error.
+function fetcher(map) {
+ return (tag) => {
+ if (!(tag in map)) return null;
+ if (map[tag] === "THROW") throw new Error("simulated non-404 infra error");
+ return map[tag];
+ };
+}
+
+const noneExist = () => false;
+const existsIn = (...tags) => {
+ const set = new Set(tags);
+ return (t) => set.has(t);
+};
+
+const select = (over) =>
+ selectPromotion({ tagExists: noneExist, soakSeconds: SOAK, nowMs: NOW, ...over });
+
+describe("deriveStableTag", () => {
+ test("strips the -beta.N suffix", () => {
+ expect(deriveStableTag("v0.9.0-beta.1")).toBe("v0.9.0");
+ expect(deriveStableTag("v1.2.3-beta.0")).toBe("v1.2.3");
+ });
+ test("keeps double-digit beta numbers intact", () => {
+ expect(deriveStableTag("v0.10.0-beta.10")).toBe("v0.10.0");
+ });
+ test("throws on a non-beta tag", () => {
+ expect(() => deriveStableTag("v0.10.0")).toThrow();
+ expect(() => deriveStableTag("random")).toThrow();
+ });
+});
+
+describe("parseBetaTags", () => {
+ test("filters to conforming beta tags, preserving order", () => {
+ const raw = "v0.10.0-beta.6\nv0.10.0\nrandomtag\n\nv0.10.0-beta.5\nv0.9.0-beta.12\n";
+ expect(parseBetaTags(raw)).toEqual(["v0.10.0-beta.6", "v0.10.0-beta.5", "v0.9.0-beta.12"]);
+ });
+ test("empty input yields no tags", () => {
+ expect(parseBetaTags("")).toEqual([]);
+ });
+});
+
+describe("selectPromotion", () => {
+ test("reaches back to the latest soaked beta when the head is under-soaked", () => {
+ const r = select({
+ betaTags: ["v0.10.0-beta.6", "v0.10.0-beta.5"],
+ fetchReleaseMeta: fetcher({
+ "v0.10.0-beta.6": meta({ publishedAt: FRESH }),
+ "v0.10.0-beta.5": meta({ publishedAt: SOAKED }),
+ }),
+ });
+ expect(r).toEqual({ kind: "select", target: "v0.10.0-beta.5", stableTag: "v0.10.0" });
+ });
+
+ test("selects the head when the head itself is soaked", () => {
+ const r = select({
+ betaTags: ["v0.10.0-beta.6", "v0.10.0-beta.5"],
+ fetchReleaseMeta: fetcher({
+ "v0.10.0-beta.6": meta({ publishedAt: SOAKED }),
+ "v0.10.0-beta.5": meta({ publishedAt: SOAKED }),
+ }),
+ });
+ expect(r).toEqual({ kind: "select", target: "v0.10.0-beta.6", stableTag: "v0.10.0" });
+ });
+
+ test("stops at the first already-promoted beta and never reaches an older cycle", () => {
+ const r = select({
+ betaTags: ["v0.10.0-beta.6", "v0.9.0-beta.3"],
+ tagExists: existsIn("v0.10.0"), // beta.6's stable already exists
+ fetchReleaseMeta: fetcher({
+ "v0.9.0-beta.3": meta({ publishedAt: SOAKED }), // soaked but must NOT be chosen
+ }),
+ });
+ expect(r.kind).toBe("stop-promoted");
+ expect(r.beta).toBe("v0.10.0-beta.6");
+ expect(r.stableTag).toBe("v0.10.0");
+ expect(r.target).toBeUndefined();
+ });
+
+ test("skips a draft head and promotes the older soaked beta", () => {
+ const r = select({
+ betaTags: ["v0.10.0-beta.6", "v0.10.0-beta.5"],
+ fetchReleaseMeta: fetcher({
+ "v0.10.0-beta.6": meta({ isDraft: true, publishedAt: SOAKED }),
+ "v0.10.0-beta.5": meta({ publishedAt: SOAKED }),
+ }),
+ });
+ expect(r).toEqual({ kind: "select", target: "v0.10.0-beta.5", stableTag: "v0.10.0" });
+ });
+
+ test("skips a head missing the DMG asset", () => {
+ const r = select({
+ betaTags: ["v0.10.0-beta.6", "v0.10.0-beta.5"],
+ fetchReleaseMeta: fetcher({
+ "v0.10.0-beta.6": meta({ dmg: false }),
+ "v0.10.0-beta.5": meta(),
+ }),
+ });
+ expect(r.target).toBe("v0.10.0-beta.5");
+ });
+
+ test("skips a head missing the mac.yml manifest", () => {
+ const r = select({
+ betaTags: ["v0.10.0-beta.6", "v0.10.0-beta.5"],
+ fetchReleaseMeta: fetcher({
+ "v0.10.0-beta.6": meta({ manifest: false }),
+ "v0.10.0-beta.5": meta(),
+ }),
+ });
+ expect(r.target).toBe("v0.10.0-beta.5");
+ });
+
+ test("treats a 404 (null) as no-release-yet and considers the next-older beta", () => {
+ const r = select({
+ betaTags: ["v0.10.0-beta.6", "v0.10.0-beta.5"],
+ fetchReleaseMeta: fetcher({
+ // beta.6 unknown -> 404 -> null
+ "v0.10.0-beta.5": meta(),
+ }),
+ });
+ expect(r.target).toBe("v0.10.0-beta.5");
+ });
+
+ test("returns none when nothing is soaked", () => {
+ const r = select({
+ betaTags: ["v0.10.0-beta.2", "v0.10.0-beta.1"],
+ fetchReleaseMeta: fetcher({
+ "v0.10.0-beta.2": meta({ publishedAt: FRESH }),
+ "v0.10.0-beta.1": meta({ publishedAt: FRESH }),
+ }),
+ });
+ expect(r).toEqual({ kind: "none" });
+ });
+
+ test("propagates a non-404 infra error instead of skipping the candidate (fail loud)", () => {
+ expect(() =>
+ select({
+ betaTags: ["v0.10.0-beta.6", "v0.10.0-beta.5"],
+ fetchReleaseMeta: fetcher({
+ "v0.10.0-beta.6": "THROW", // auth/network/rate-limit on the newest candidate
+ "v0.10.0-beta.5": meta(), // would otherwise be wrongly promoted as latest
+ }),
+ }),
+ ).toThrow(/infra error/);
+ });
+});
diff --git a/.github/workflows/promote-stable-auto.yml b/.github/workflows/promote-stable-auto.yml
new file mode 100644
index 000000000..f6c9f8cb1
--- /dev/null
+++ b/.github/workflows/promote-stable-auto.yml
@@ -0,0 +1,191 @@
+name: Auto-promote stable
+
+# Scheduled gatekeeper on inkeep/open-knowledge that AUTOMATICALLY promotes the
+# LATEST beta that has soaked >= 24h online to stable, but only fires the
+# promotion inside the US business-hours window (9am ET .. 4pm PT, Mon-Fri).
+#
+# "Latest soaked" (not simply "newest"): it walks the beta tags newest -> oldest
+# in the established version order and promotes the first that is unpromoted,
+# fully cut, and >= 24h online. A fresher beta cut < 24h ago is skipped in favor
+# of the previous soaked beta; the skipped beta's changeset rolls forward into a
+# later beta/stable via the cumulative changeset model, so nothing is lost. The
+# descent stops at the first already-promoted beta, so it never reaches back
+# across a promoted cycle boundary. This selection logic lives in
+# .github/scripts/promote-stable-auto.mjs (unit-tested under `bun test --cwd
+# .github/scripts`), not inline bash — it is the sole safety gate for automated
+# promotions (see NOTE below), so it is fail-loud and test-covered.
+#
+# This workflow does NOT reimplement promotion. It dispatches promote-stable.yml
+# with an EXPLICIT beta_tag (the selected beta); promote-stable tags vX.Y.Z,
+# creates the Release, and cascades npm --tag latest + signed stable DMG +
+# main-reset unchanged. "OK desktop to stable" is covered for free via the
+# promote-stable -> desktop-release cascade (latest-mac.yml + DMG). NOTE:
+# promote-stable's Guard A/B run only on its blank/auto path, so the explicit
+# dispatch bypasses them; the script performs the unpromoted + fully-cut checks
+# itself, and fails loud (job error, retry next tick) on any non-404 gh/git
+# error rather than folding an infra failure into a promote/no-op decision.
+#
+# Why a schedule is the backbone (not push alone): eligibility here is reached
+# by the passage of TIME (a beta crossing 24h old), not by a commit. During a
+# quiet stretch with no pushes an eligible beta would never promote if we only
+# ran on commits. The cron is what notices "24h has now elapsed"; the push
+# trigger is an additive fast-path so an already-eligible beta promotes promptly
+# when a Copybara mirror commit lands in-hours.
+#
+# Weekend latency: the cron is Mon-Fri, so a beta that crosses 24h over the
+# weekend promotes on the next weekday tick — a Friday-published beta can be up
+# to ~71h online before its Monday-morning promotion. This is the intended "no
+# weekend promotions" behavior; workflow_dispatch (which bypasses the hours gate)
+# is the escape hatch for an urgent out-of-hours promotion.
+#
+# DST correctness: GitHub Actions cron is UTC and ignores daylight saving, so a
+# hard-coded "9am ET" would drift an hour twice a year. The cron fires hourly
+# across the UTC band that brackets the ET/PT window year-round; the
+# AUTHORITATIVE business-hours decision is made in-script against the
+# America/New_York clock (see the "Business-hours gate" step), so the window
+# stays exact through DST transitions. 4pm PT == 7pm ET == 19:00 ET, so the ET
+# window is 09:00 (inclusive) .. 19:00 (exclusive).
+#
+# Concurrency + de-dupe: this evaluator carries its own group (distinct from the
+# ok-release-cadence lock that release.yml / promote-stable.yml share) so it
+# never blocks a real cut. Double-promotion is prevented three ways:
+# (1) cancel-in-progress supersedes an overlapping eval, (2) a fail-loud in-flight
+# check skips when a promote-stable run is already in_progress/queued, and
+# (3) the script stops at the first already-promoted beta and never selects one
+# whose stable tag already exists.
+
+on:
+ schedule:
+ # Hourly at :17 (off the :00 scheduler spike), 13:00-23:59 UTC, Mon-Fri.
+ # This UTC band brackets the ET/PT window across DST (9am ET = 13:00 UTC
+ # under EDT / 14:00 UTC under EST; 4pm PT = 23:00 UTC under PDT / 00:00 UTC
+ # under PST). The in-script ET gate is authoritative and rejects any tick
+ # outside 09:00-19:00 ET for the current DST state, so band-edge over-firing
+ # is a clean no-op. Ticks land at :17, so up to ~1h can elapse before a
+ # newly-soaked beta is noticed, and the final ~40 min before the window
+ # closes falls between the last in-window tick and the boundary; both are
+ # covered by the next in-window tick or the push fast-path.
+ - cron: "17 13-23 * * 1-5"
+ # Fast-path: re-evaluate the gate when Copybara mirrors a commit to main so an
+ # already-eligible beta promotes promptly in-hours. Additive to the schedule;
+ # the same in-script business-hours + soak gate applies.
+ push:
+ branches: [main]
+ workflow_dispatch:
+ inputs:
+ dry_run:
+ description: "Evaluate the gate and log the decision without dispatching promote-stable."
+ required: false
+ type: boolean
+ default: false
+
+permissions:
+ # actions:write is required to dispatch promote-stable.yml (workflow_dispatch
+ # via the API) and covers the read for the in-flight `gh run list` check.
+ # contents:read to read tags. No id-token and no App token here — promote-stable
+ # mints its own App token for the identity-asserting work (tag push, cross-repo
+ # main-reset dispatch), so this evaluator stays minimally scoped.
+ contents: read
+ actions: write
+
+concurrency:
+ # Deliberately NOT the shared ok-release-cadence group — a read-only evaluator
+ # must never queue behind (or delay) a real beta cut / stable promotion.
+ # cancel-in-progress:true lets a newer eval (e.g. a push arriving mid-cron-tick)
+ # supersede an older one; the eval is idempotent so a cancelled run loses nothing.
+ group: ok-auto-promote-stable
+ cancel-in-progress: true
+
+jobs:
+ evaluate:
+ name: Evaluate 24h soak + business-hours gate
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ - name: Business-hours gate (America/New_York)
+ id: hours
+ env:
+ EVENT_NAME: ${{ github.event_name }}
+ run: |
+ set -euo pipefail
+ # Manual runs bypass the business-hours gate so an operator can test the
+ # soak logic at any time; schedule + push obey the window.
+ if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
+ echo "workflow_dispatch — bypassing business-hours gate (soak + guards still apply)."
+ echo "open=true" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+ DOW=$(TZ="America/New_York" date +%u) # 1=Mon .. 7=Sun
+ HOUR=$(TZ="America/New_York" date +%H) # 00 .. 23
+ HOUR=$((10#$HOUR)) # strip leading zero (octal-safe)
+ # Window: weekdays, 09:00 ET (inclusive) .. 19:00 ET (exclusive).
+ # 19:00 ET == 16:00 PT == 4pm PT, the requested upper bound.
+ if (( DOW >= 1 && DOW <= 5 )) && (( HOUR >= 9 && HOUR < 19 )); then
+ echo "In business hours (ET: DOW=$DOW HOUR=$HOUR)."
+ echo "open=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "Outside business hours (ET: DOW=$DOW HOUR=$HOUR; window Mon-Fri 09:00-18:59 ET = 9am ET .. 4pm PT). No-op."
+ echo "open=false" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Checkout (need full tag history for beta resolution)
+ if: steps.hours.outputs.open == 'true'
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ fetch-depth: 0
+ # Read-only job: it resolves tags with git and talks to GitHub via a
+ # separate GH_TOKEN; it never pushes, so don't persist GITHUB_TOKEN into
+ # the runner's .git/config (least privilege for a release-dispatching job).
+ persist-credentials: false
+
+ - name: Set up Node
+ if: steps.hours.outputs.open == 'true'
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
+ with:
+ node-version: "24"
+
+ - name: Select the beta to promote
+ id: select
+ if: steps.hours.outputs.open == 'true'
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SOAK_SECONDS: "86400" # 24h online soak
+ # Writes target= / stable= to GITHUB_OUTPUT (empty target => no-op). Exits
+ # non-zero (fails the job) on any non-404 gh/git infra error — a fail-loud
+ # retry-next-tick, never a silent skip. Logic + tests:
+ # .github/scripts/promote-stable-auto.{mjs,test.mjs}.
+ run: node .github/scripts/promote-stable-auto.mjs
+
+ - name: Guard against an in-flight promotion, then dispatch
+ if: steps.hours.outputs.open == 'true' && steps.select.outputs.target != ''
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ TARGET: ${{ steps.select.outputs.target }}
+ TARGET_STABLE: ${{ steps.select.outputs.stable }}
+ # workflow_dispatch supplies the boolean; schedule/push leave inputs
+ # null, so default to "false" (never a dry run on the automated path).
+ DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
+ run: |
+ set -euo pipefail
+ # Don't double-fire while a promote-stable run is already active — covers
+ # the window between dispatch and promote-stable pushing the stable tag
+ # (after which the script's stop-at-already-promoted catches it). Fail
+ # loud on a query error: an evaluator that cannot confirm "no promotion
+ # in flight" must abort and retry next tick, not assume zero (no
+ # `|| echo 0`).
+ active=$(gh run list --workflow=promote-stable.yml --json status \
+ --jq '[.[] | select(.status=="in_progress" or .status=="queued")] | length')
+ if [[ "$active" -gt 0 ]]; then
+ echo "::notice::A promote-stable run is already in_progress/queued (${active}); skipping to avoid a duplicate promotion."
+ exit 0
+ fi
+ if [[ "$DRY_RUN" == "true" ]]; then
+ echo "::notice::DRY RUN: would dispatch promote-stable.yml with beta_tag=${TARGET} -> ${TARGET_STABLE}."
+ exit 0
+ fi
+ # Explicit beta_tag (not blank): a blank dispatch auto-resolves the NEWEST
+ # beta, but under "latest soaked" the target may sit below the head.
+ # promote-stable's explicit-tag path skips its own Guard A/B, so the
+ # script's unpromoted + fully-cut checks are the safety net for this dispatch.
+ gh workflow run promote-stable.yml -f beta_tag="$TARGET"
+ echo "::notice::Dispatched promote-stable for ${TARGET} -> ${TARGET_STABLE} (npm --tag latest + stable DMG + main-reset)."
diff --git a/knip.config.ts b/knip.config.ts
index 2bfad8fc1..c12f11e77 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -76,6 +76,7 @@ export default {
'.github/scripts/cla-gate.test.mjs': ['files'],
'.github/scripts/cla-gate.mjs': ['exports'],
'.github/scripts/bridge-public-pr-to-monorepo.test.mjs': ['files'],
+ '.github/scripts/promote-stable-auto.test.mjs': ['files'],
'docs/src/lib/share-splash.ts': ['exports', 'types'],
'packages/app/src/components/PublishToGitHubDialog.tsx': ['types'],
'packages/app/src/components/ShareButton.tsx': ['types'],
diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.ts
index 8f9d95287..c014b1413 100644
--- a/packages/core/src/bridge/bind-frontmatter-doc.ts
+++ b/packages/core/src/bridge/bind-frontmatter-doc.ts
@@ -1,4 +1,3 @@
-
import type * as Y from 'yjs';
import type { Err, Ok, Result } from '../config/result.ts';
import { type FrontmatterValidationError, toFrontmatterIssue } from '../frontmatter/errors.ts';
diff --git a/packages/core/src/bridge/bridge-invariant.ts b/packages/core/src/bridge/bridge-invariant.ts
index 8bfdb40cd..005627195 100644
--- a/packages/core/src/bridge/bridge-invariant.ts
+++ b/packages/core/src/bridge/bridge-invariant.ts
@@ -1,4 +1,3 @@
-
import { fnv1aDigest } from './hash-util.ts';
export type BridgeInvariantSite = 'observer-b' | 'persistence' | 'test-harness';
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index c18c086d5..8890f6739 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,4 +1,3 @@
-
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
const LEADING_BOUNDARY_RE = /^(?:\r?\n)+/;
diff --git a/packages/core/src/bridge/merge-three-way.ts b/packages/core/src/bridge/merge-three-way.ts
index 864bc7245..b0a80fbd9 100644
--- a/packages/core/src/bridge/merge-three-way.ts
+++ b/packages/core/src/bridge/merge-three-way.ts
@@ -37,7 +37,6 @@ function mergeThreeWayImpl(baseline: string, userText: string, agentText: string
return parts.join('\n');
}
-
export type BridgeMergeContentLossSide = 'user' | 'agent';
export type BridgeMergeContentLossWhich = 'substring' | 'order';
diff --git a/packages/core/src/bridge/normalize.ts b/packages/core/src/bridge/normalize.ts
index 592f0b956..e67f33b40 100644
--- a/packages/core/src/bridge/normalize.ts
+++ b/packages/core/src/bridge/normalize.ts
@@ -1,4 +1,3 @@
-
const COMMONMARK_ESCAPE_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~])/g;
const TABLE_ALIGN_ROW_RE = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/;
diff --git a/packages/core/src/bridge/pm-structural-equivalence.ts b/packages/core/src/bridge/pm-structural-equivalence.ts
index 0be5203e4..754dc5cc2 100644
--- a/packages/core/src/bridge/pm-structural-equivalence.ts
+++ b/packages/core/src/bridge/pm-structural-equivalence.ts
@@ -32,7 +32,6 @@ const BR_SENTINEL: PmStructuralNode = { type: '__br__' };
const BR_LITERAL_RE = /^<br\s*\/?>$/i;
-
interface DegradeEntry {
readonly label: string;
readonly severity: ToleranceClassSeverity;
@@ -128,7 +127,6 @@ export interface ComparePmStructuralOptions {
ignoreAttrs?: (attrKey: string) => boolean;
}
-
/** Rebuild a node with `fn` applied to each child; identity when childless.
* Shared by the degrade canonicalizers so none re-implements the walk. */
function mapChildren(
@@ -250,7 +248,6 @@ function applyDegrades(tree: PmStructuralNode): {
return { normalized: current, fired };
}
-
export function comparePmStructural(
expected: PmStructuralNode,
actual: PmStructuralNode,
diff --git a/packages/core/src/bridge/subsequence.ts b/packages/core/src/bridge/subsequence.ts
index dca644141..af20de1e2 100644
--- a/packages/core/src/bridge/subsequence.ts
+++ b/packages/core/src/bridge/subsequence.ts
@@ -1,4 +1,3 @@
-
/** True when `needle` is a subsequence of `haystack` (two-pointer, O(n+m)):
* insertions in `haystack` are free; any dropped or substituted `needle` byte
* fails. */
diff --git a/packages/core/src/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.ts
index a363dfd54..83d47404a 100644
--- a/packages/core/src/markdown/callout-transformer.ts
+++ b/packages/core/src/markdown/callout-transformer.ts
@@ -1,4 +1,3 @@
-
import type { Blockquote, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index 47f0d07e4..193e286b0 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/dedent-block-jsx-close.ts b/packages/core/src/markdown/dedent-block-jsx-close.ts
index b6299a948..ece5c02a1 100644
--- a/packages/core/src/markdown/dedent-block-jsx-close.ts
+++ b/packages/core/src/markdown/dedent-block-jsx-close.ts
@@ -1,4 +1,3 @@
-
import { findFencedRegions, isInsideFence } from './fence-regions.ts';
const INDENTED_BLOCK_JSX_CLOSE_RE = /^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm;
diff --git a/packages/core/src/markdown/details-accordion-promoter.ts b/packages/core/src/markdown/details-accordion-promoter.ts
index acd398aa6..54774764a 100644
--- a/packages/core/src/markdown/details-accordion-promoter.ts
+++ b/packages/core/src/markdown/details-accordion-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/fence-regions.ts b/packages/core/src/markdown/fence-regions.ts
index fb5ac8e8a..c7518d614 100644
--- a/packages/core/src/markdown/fence-regions.ts
+++ b/packages/core/src/markdown/fence-regions.ts
@@ -1,4 +1,3 @@
-
const FENCE_RE = /^(`{3,}|~{3,})/gm;
export function findFencedRegions(src: string): Array<[number, number]> {
diff --git a/packages/core/src/markdown/fixtures/index.ts b/packages/core/src/markdown/fixtures/index.ts
index 6931623c7..00f5771ee 100644
--- a/packages/core/src/markdown/fixtures/index.ts
+++ b/packages/core/src/markdown/fixtures/index.ts
@@ -1,4 +1,3 @@
-
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -9,7 +8,6 @@ function fixturePath(...segments: string[]): string {
return resolve(FIXTURES_DIR, ...segments);
}
-
interface GfmExample {
section: string;
markdown: string;
@@ -19,7 +17,6 @@ export function loadGfmExamples(): GfmExample[] {
return JSON.parse(readFileSync(fixturePath('gfm', 'examples.json'), 'utf8')) as GfmExample[];
}
-
interface MdxCrashEntry {
id: string;
input: string;
@@ -71,7 +68,6 @@ export function loadLargeEmbedFixtures(): LargeEmbedFixture[] {
) as LargeEmbedFixture[];
}
-
export function loadPrd6955Before(): string {
return readFileSync(fixturePath('regression', 'prd-6955-before.md'), 'utf8');
}
@@ -80,7 +76,6 @@ export function loadPrd6955CorruptedTriplicated(): string {
return readFileSync(fixturePath('regression', 'prd-6955-corrupted-triplicated.md'), 'utf8');
}
-
export interface NgPinnedCase {
id: string;
name: string;
@@ -97,7 +92,6 @@ export function loadNgPinnedCases(): NgPinnedCase[] {
) as NgPinnedCase[];
}
-
export function loadLargeRealistic(): string {
return readFileSync(fixturePath('perf', 'large-realistic.md'), 'utf8');
}
diff --git a/packages/core/src/markdown/fixtures/perf/generate.ts b/packages/core/src/markdown/fixtures/perf/generate.ts
index daa3ef82b..8b1eb8519 100644
--- a/packages/core/src/markdown/fixtures/perf/generate.ts
+++ b/packages/core/src/markdown/fixtures/perf/generate.ts
@@ -1,4 +1,3 @@
-
import { writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -11,7 +10,6 @@ const BASELINE_ONLY_COUNTS = [500, 2500] as const;
const SEED = 0xf1de1117;
-
function mulberry32(seed: number): () => number {
let a = seed >>> 0;
return () => {
@@ -38,7 +36,6 @@ function pickWeighted<T>(rand: () => number, items: readonly [T, number][]): T {
return items[items.length - 1][0];
}
-
const WORDS = [
'lorem',
'ipsum',
@@ -156,7 +153,6 @@ function mdxBlock(rand: () => number): string {
return `<${name}>\n\n${sentence(rand)}\n\n</${name}>`;
}
-
type BlockKind = 'paragraph' | 'heading' | 'list' | 'code' | 'table' | 'mdx';
const MIX: readonly [BlockKind, number][] = [
@@ -195,7 +191,6 @@ function generateDocument(blockCount: number, seed: number): string {
return `${blocks.join('\n\n')}\n`;
}
-
function main(): void {
for (const count of [...BLOCK_COUNTS, ...BASELINE_ONLY_COUNTS]) {
const doc = generateDocument(count, SEED);
diff --git a/packages/core/src/markdown/guard-flanking-matrix.ts b/packages/core/src/markdown/guard-flanking-matrix.ts
index 32c055c5b..420dc0fe5 100644
--- a/packages/core/src/markdown/guard-flanking-matrix.ts
+++ b/packages/core/src/markdown/guard-flanking-matrix.ts
@@ -7,7 +7,6 @@ import {
import { BACKSLASH_GUARD_SUBSTITUTIONS, encodeBackslashEscapes } from './backslash-escape-guard.ts';
import { ENTITY_REF_GUARD_SUBSTITUTIONS, encodeEntityRefs } from './entity-ref-guard.ts';
-
export const ATTENTION_DELIMITERS = ['*', '_', '**', '~~', '=='] as const;
export type FlankClass = 'whitespace' | 'punctuation' | 'other';
diff --git a/packages/core/src/markdown/handler-shadow-audit.ts b/packages/core/src/markdown/handler-shadow-audit.ts
index 283913255..2653473da 100644
--- a/packages/core/src/markdown/handler-shadow-audit.ts
+++ b/packages/core/src/markdown/handler-shadow-audit.ts
@@ -1,4 +1,3 @@
-
export interface HandlerShadowWitness {
input: string;
expect: 'byte' | 'byte-and-reparse-type';
diff --git a/packages/core/src/markdown/highlight-promoter.ts b/packages/core/src/markdown/highlight-promoter.ts
index 7a22e8016..f758cf737 100644
--- a/packages/core/src/markdown/highlight-promoter.ts
+++ b/packages/core/src/markdown/highlight-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, PhrasingContent, Root, Text } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/html-to-mdast.ts b/packages/core/src/markdown/html-to-mdast.ts
index 2f082e6d0..78fdfeb02 100644
--- a/packages/core/src/markdown/html-to-mdast.ts
+++ b/packages/core/src/markdown/html-to-mdast.ts
@@ -1,4 +1,3 @@
-
import type { Root as HastRoot } from 'hast';
import type { Root as MdastRoot } from 'mdast';
import rehypeParse from 'rehype-parse';
@@ -76,8 +75,7 @@ export function htmlToMdast(html: string, options?: HtmlToMdastOptions): MdastRo
throw new HtmlPayloadTooLargeError(html.length, maxBytes);
}
- const processor = unified()
- .use(rehypeParse, { fragment: true });
+ const processor = unified().use(rehypeParse, { fragment: true });
for (const plugin of cleanupPlugins) {
processor.use(plugin);
diff --git a/packages/core/src/markdown/image-promoter.ts b/packages/core/src/markdown/image-promoter.ts
index 994eb6917..706fa9afb 100644
--- a/packages/core/src/markdown/image-promoter.ts
+++ b/packages/core/src/markdown/image-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Image, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/index.ts b/packages/core/src/markdown/index.ts
index c58d0847d..58be35302 100644
--- a/packages/core/src/markdown/index.ts
+++ b/packages/core/src/markdown/index.ts
@@ -1,4 +1,3 @@
-
import {
type FromProseMirrorOptions,
fromPmMark,
@@ -197,7 +196,6 @@ export class MarkdownManager {
}
}
-
const registry = createRegistry();
function destructureAttrs(
@@ -246,7 +244,6 @@ function destructureAttrs(
return result;
}
-
function hasDirtyDescendant(node: PmNode): boolean {
let found = false;
node.descendants((child) => {
@@ -266,7 +263,6 @@ function effectiveDirty(node: PmNode, freshnessChecker?: StructuralFreshnessChec
return freshnessChecker ? freshnessChecker.isDiverged(node.toJSON()) : false;
}
-
function isEmptyMdastParagraph(node: MdastNodes): boolean {
if (node.type !== 'paragraph') return false;
const children = node.children ?? [];
@@ -335,7 +331,6 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {
return out;
}
-
import {
AUDIO_EXTENSIONS,
FILE_ATTACHMENT_EXTENSIONS,
@@ -585,7 +580,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.emphasis) {
handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({
sourceDelimiter: node.data?.sourceDelimiter ?? '*',
@@ -665,7 +659,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.link) {
const sourceLiteralMark = m.sourceLiteral;
handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {
@@ -944,7 +937,6 @@ function buildMdastToPmHandlers(
};
}
-
const blockUnknownHandler = (node: {
type: string;
position?: { start: { offset: number }; end: { offset: number } };
@@ -1070,7 +1062,6 @@ function buildMdastToPmHandlers(
return handlers as RemarkProseMirrorOptions['handlers'];
}
-
function buildPmToMdastHandlers(
schema: Schema,
freshness: FreshnessCheckerHolder,
diff --git a/packages/core/src/markdown/math-promoter.ts b/packages/core/src/markdown/math-promoter.ts
index bd79424c7..a5b511f25 100644
--- a/packages/core/src/markdown/math-promoter.ts
+++ b/packages/core/src/markdown/math-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Code, Root } from 'mdast';
import type { Math as MdastMath } from 'mdast-util-math';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-hast-handlers.ts b/packages/core/src/markdown/mdast-to-hast-handlers.ts
index f84967798..679c72ef7 100644
--- a/packages/core/src/markdown/mdast-to-hast-handlers.ts
+++ b/packages/core/src/markdown/mdast-to-hast-handlers.ts
@@ -1,4 +1,3 @@
-
import type { Comment, Element, ElementContent, Properties } from 'hast';
import type { FootnoteDefinition, FootnoteReference } from 'mdast';
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-html.ts b/packages/core/src/markdown/mdast-to-html.ts
index df788a80d..8ce2b2492 100644
--- a/packages/core/src/markdown/mdast-to-html.ts
+++ b/packages/core/src/markdown/mdast-to-html.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root as HastRoot, Text as HastText } from 'hast';
import type { Root as MdastRoot, Text as MdastText } from 'mdast';
import type { Handler } from 'mdast-util-to-hast';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index a58f8c720..35d74b85e 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/mermaid-promoter.ts b/packages/core/src/markdown/mermaid-promoter.ts
index 17ed2b829..1a897fca8 100644
--- a/packages/core/src/markdown/mermaid-promoter.ts
+++ b/packages/core/src/markdown/mermaid-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Code, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/parse-with-fallback.ts b/packages/core/src/markdown/parse-with-fallback.ts
index 7e4a9a48b..9864b3b60 100644
--- a/packages/core/src/markdown/parse-with-fallback.ts
+++ b/packages/core/src/markdown/parse-with-fallback.ts
@@ -168,7 +168,6 @@ export function parseRecursive(
}
}
-
interface VFilePlace {
offset?: number;
start?: { offset?: number };
@@ -187,7 +186,6 @@ function extractErrorOffset(err: unknown): number | undefined {
return undefined;
}
-
interface Region {
start: number;
end: number;
@@ -211,7 +209,6 @@ function nearestBlankLineAfter(src: string, offset: number): number | null {
return null;
}
-
export interface TagEvent {
kind: 'open' | 'close' | 'self-close';
name: string;
@@ -358,7 +355,6 @@ function findFallbackRegion(src: string, errorOffset: number): Region {
return { start: blockStart, end: blockEnd };
}
-
interface SourceBlock {
src: string;
start: number;
@@ -456,7 +452,6 @@ function tryPerBlockFallback(
};
}
-
function wholeDocRawText(source: string): JSONContent {
return {
type: 'doc',
diff --git a/packages/core/src/markdown/parser-drop-closure.ts b/packages/core/src/markdown/parser-drop-closure.ts
index 43d420187..e6ab4fd57 100644
--- a/packages/core/src/markdown/parser-drop-closure.ts
+++ b/packages/core/src/markdown/parser-drop-closure.ts
@@ -1,4 +1,3 @@
-
export type DroppedTokenAdjudication =
| {
kind: 'format-dof-axis';
diff --git a/packages/core/src/markdown/pipeline.ts b/packages/core/src/markdown/pipeline.ts
index 5b9550e90..5d6db7aa8 100644
--- a/packages/core/src/markdown/pipeline.ts
+++ b/packages/core/src/markdown/pipeline.ts
@@ -1,4 +1,3 @@
-
import {
type FromProseMirrorOptions,
fromProseMirror,
diff --git a/packages/core/src/markdown/position-aware-join.ts b/packages/core/src/markdown/position-aware-join.ts
index 4ac5731e7..248685cfe 100644
--- a/packages/core/src/markdown/position-aware-join.ts
+++ b/packages/core/src/markdown/position-aware-join.ts
@@ -1,4 +1,3 @@
-
import type { Join } from 'mdast-util-to-markdown';
import type { Position } from 'unist';
diff --git a/packages/core/src/markdown/position-slice.ts b/packages/core/src/markdown/position-slice.ts
index 240be90e6..50a193a16 100644
--- a/packages/core/src/markdown/position-slice.ts
+++ b/packages/core/src/markdown/position-slice.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Root } from 'mdast';
import { visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
@@ -467,8 +466,7 @@ export function applyPositionSliceToNode(
const first = source[startOff];
if (first !== '[' && first !== '<' && !node.title) {
node.data.sourceStyle = 'gfm-autolink';
- }
- else if (first === '[') {
+ } else if (first === '[') {
const slice = source.slice(startOff, endOff);
const closeBracketIdx = slice.lastIndexOf('](');
if (closeBracketIdx !== -1) {
diff --git a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
index ca225ce9b..db10fa54b 100644
--- a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
+++ b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
@@ -1,4 +1,3 @@
-
import type { Comment, Element, Root, Text } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
index 3a2524a9a..34068d103 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
@@ -1,4 +1,3 @@
-
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
index 2279a0189..93151d43b 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
index a0f467c42..188f02d83 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
index 4e8542a21..4ba2c3418 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
index a3c96b24a..1a74b1272 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
@@ -1,4 +1,3 @@
-
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
index e95cf43d6..de35e7b79 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
@@ -1,4 +1,3 @@
-
import type { Comment, Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
index ffdb4d5b5..b4be1b2ea 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
@@ -1,4 +1,3 @@
-
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
index e2a96d1a7..3c8d88b7c 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
@@ -1,4 +1,3 @@
-
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/resolve-image-url.ts b/packages/core/src/markdown/resolve-image-url.ts
index 0389575ac..cf2c9da8e 100644
--- a/packages/core/src/markdown/resolve-image-url.ts
+++ b/packages/core/src/markdown/resolve-image-url.ts
@@ -1,4 +1,3 @@
-
import { isRelativeUrl } from './safe-url.ts';
function isDevDiagnosticContext(): boolean {
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 8be632ba4..4d3250d3a 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,4 +1,3 @@
-
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');
diff --git a/packages/core/src/markdown/serialize-helpers.ts b/packages/core/src/markdown/serialize-helpers.ts
index 542204403..46cc6a074 100644
--- a/packages/core/src/markdown/serialize-helpers.ts
+++ b/packages/core/src/markdown/serialize-helpers.ts
@@ -1,4 +1,3 @@
-
import type { Node as PmNode } from '@tiptap/pm/model';
import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import type { PropDef, SerializeContext } from '../registry/types.ts';
diff --git a/packages/core/src/markdown/single-dollar-math-promoter.ts b/packages/core/src/markdown/single-dollar-math-promoter.ts
index fe73659e6..be97d4d62 100644
--- a/packages/core/src/markdown/single-dollar-math-promoter.ts
+++ b/packages/core/src/markdown/single-dollar-math-promoter.ts
@@ -1,4 +1,3 @@
-
import type { PhrasingContent, Root, Text } from 'mdast';
import type { InlineMath } from 'mdast-util-math';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/to-markdown-handlers.ts b/packages/core/src/markdown/to-markdown-handlers.ts
index e1161455b..1a2fb5d50 100644
--- a/packages/core/src/markdown/to-markdown-handlers.ts
+++ b/packages/core/src/markdown/to-markdown-handlers.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parents } from 'mdast';
import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import type { Handle, Info, State } from 'mdast-util-to-markdown';
diff --git a/packages/core/src/markdown/unknown-mdast-guard.ts b/packages/core/src/markdown/unknown-mdast-guard.ts
index c5bfd2386..cd245c38c 100644
--- a/packages/core/src/markdown/unknown-mdast-guard.ts
+++ b/packages/core/src/markdown/unknown-mdast-guard.ts
@@ -1,4 +1,3 @@
-
import type { Root as MdastRoot } from 'mdast';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/whitespace-char-ref.ts b/packages/core/src/markdown/whitespace-char-ref.ts
index 1b75ba564..a100cad76 100644
--- a/packages/core/src/markdown/whitespace-char-ref.ts
+++ b/packages/core/src/markdown/whitespace-char-ref.ts
@@ -1,4 +1,3 @@
-
const INLINE_WHITESPACE_BY_CODE: ReadonlyMap<number, string> = new Map([
[0x20, ' '],
[0x09, '\t'],
diff --git a/packages/core/src/markdown/wiki-link-micromark.ts b/packages/core/src/markdown/wiki-link-micromark.ts
index afd9936fe..6dad26200 100644
--- a/packages/core/src/markdown/wiki-link-micromark.ts
+++ b/packages/core/src/markdown/wiki-link-micromark.ts
@@ -17,7 +17,6 @@ declare module 'micromark-util-types' {
}
}
-
const CODE_BANG = 33; // !
const CODE_LBRACKET = 91; // [
const CODE_RBRACKET = 93; // ]
@@ -261,7 +260,6 @@ export function wikiLinkSyntax(): Extension {
};
}
-
function enterWikiLink(this: CompileContext, token: Token) {
this.enter(
{
@@ -387,7 +385,6 @@ export const wikiLinkToMarkdown: {
unsafe: [{ character: '[', inConstruct: ['phrasing'] }],
};
-
const MICROMARK_EXT = wikiLinkSyntax();
export function remarkWikiLink(this: Processor) {