Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): stop write-back replies from repeating a changeset twice (#3978)

Andrew Mikofalvyb9fde5a00d72
diff --git a/.github/scripts/write-back-gate.mjs b/.github/scripts/write-back-gate.mjs
index cc3994dc3..cd1954dda 100644
--- a/.github/scripts/write-back-gate.mjs
+++ b/.github/scripts/write-back-gate.mjs
@@ -47,8 +47,10 @@ const RELEASE_VERSION_RE = /^v?(\d+)\.(\d+)\.(\d+)(?:-beta\.(\d+))?$/;
const RELEASES_URL = 'https://github.com/inkeep/open-knowledge/releases';
// Discord caps a message at 2000 characters. Bounding the quoted prose leaves
-// room for the surrounding lines on either channel and keeps a pathological
-// changeset from turning the reply into a wall.
+// room for the surrounding lines on either channel. This is not a rare guard:
+// plenty of this project's release notes run past it — see the longer entries
+// in packages/cli/CHANGELOG.md — so those replies end in a mid-sentence
+// ellipsis and the rest of the note lives only on the releases page.
const MAX_PROSE_CHARS = 1200;
/**
@@ -186,6 +188,52 @@ export function isOriginRepliableFrom(origin, selfRepo) {
return self === `${origin.owner}/${origin.repo}`.toLowerCase();
}
+/**
+ * The query-string suffix that names a notification marker's origin.
+ * Composed here so the sibling `notificationMarkerUrl` (in `write-back.mjs`,
+ * which prefixes a release tag to build the full marker URL) and
+ * `originAlreadyNotified` below share one encoding rather than two hand-rolled
+ * copies drifting apart. `encodeURIComponent` escapes both `?` and `&`, so an
+ * origin URL carrying its own query string cannot forge a false match against
+ * this suffix.
+ */
+export function markerSuffixFor(originUrl) {
+ return `?notified=${encodeURIComponent(String(originUrl ?? ''))}`;
+}
+
+/**
+ * Whether this origin carries a notification marker for some earlier
+ * version — checked against the origin alone, regardless of which version the
+ * marker names, unlike the exact-match idempotency check `notificationMarkerUrl`
+ * keys on (origin, version).
+ *
+ * This is a marker existing, not a reply confirmed delivered, and the two can
+ * diverge: a marker is written before its reply posts, and a `postReply`
+ * failure in between leaves the marker standing with nothing actually sent
+ * (see the `NeedsHumanError` note where the marker is written, in
+ * `write-back.mjs`). The caller uses this to decide whether to elide the
+ * changeset quote on the assumption that a marker ordinarily means the
+ * reporter already read it; in the rare case that assumption is wrong, the
+ * operator following up on that `NeedsHumanError` is the one place with
+ * standing to catch it, which is why that message says so.
+ *
+ * A deliberate trade this makes. Before `quote` existed, every reply carried
+ * the full note regardless of what an earlier one on the same origin had
+ * done, so a beta-leg `postReply` failure cost nothing beyond a delay: the
+ * stable leg keyed a different marker and re-sent everything. That accidental
+ * repair is what eliding gives up — a reporter whose only delivered reply
+ * follows a failed one still learns the version and the tickets it covers,
+ * but never what changed. The repair was largely a beta-leg effect: a
+ * stable-leg failure ordinarily recomputes the same version and hits the
+ * exact-marker skip, so nothing re-sends.
+ * Accepted because that failure is visible on its own terms (a red run, an
+ * `ACTION REQUIRED` message), not because it is rare.
+ */
+export function originAlreadyNotified(attachmentUrls, originUrl) {
+ const suffix = markerSuffixFor(originUrl);
+ return (attachmentUrls ?? []).some((u) => String(u ?? '').endsWith(suffix));
+}
+
/** Numeric semver ordering. String comparison puts v0.9.0 above v0.36.0. */
export function compareVersions(a, b) {
const ka = releaseVersionKey(a);
@@ -334,10 +382,25 @@ export function evaluateFanIn({ ticket, descendants = [], resolveVersion, log =
* see lives on the Linear ticket: its internal title, its assignee, the
* customer it was raised for, notes about work that has not shipped. None of
* that is a parameter here, so no amount of downstream carelessness can leak
- * it. What can reach the reply is the changeset prose, which is written for the
- * public release notes and is already published, plus the derived version and
- * the ticket identifiers the reporter's own report fanned into. Widening these
- * parameters is the one change to this file that needs a second look.
+ * it. What can reach the reply is the changeset prose, which is written for
+ * the public release notes and is already published, plus the derived
+ * version, the ticket identifiers the reporter's own report fanned into, and
+ * whether to quote the prose at all. Widening these parameters is the one
+ * change to this file that needs a second look.
+ *
+ * Why `quote` exists. A fix that ships beta-then-stable gets two replies on
+ * the same origin, and the second one has nothing new to say: whatever of the
+ * note the first reply could fit — the full text, or as much of it as cleared
+ * MAX_PROSE_CHARS — already reached this thread. `quote: false` drops the
+ * prose block and leaves the rest — the opening line already says the fix is
+ * out, the coverage line still lists every ticket it fanned into, and the
+ * update instruction still says how to get it. That is a real answer on its
+ * own, so the second reply is short rather than empty, and repeats nothing
+ * rather than repeating a second, independently-trimmed copy of the first
+ * reply's prose. The caller decides `quote` by checking whether an earlier
+ * marker exists for this origin, not by channel: a fix that lands straight on
+ * a stable (the point-release fast lane skips beta) gets exactly one reply
+ * either way, and that one should always quote.
*
* The coverage line is not decoration. A report that fanned into three tickets
* gets one reply, and without the list the reporter has no way to tell whether
@@ -345,7 +408,9 @@ export function evaluateFanIn({ ticket, descendants = [], resolveVersion, log =
*
* Returns the reply text, or null when there is nothing truthful to say. An
* empty changeset is the one case: a blank or version-only reply reads as a
- * claim with no content behind it, so the caller warns and posts nothing.
+ * claim with no content behind it, so the caller warns and posts nothing —
+ * checked regardless of `quote`, since a changeset that does not exist is not
+ * a fact this reply can stand on even when it isn't quoted.
*/
export function composeReply({
changeset = {},
@@ -353,6 +418,7 @@ export function composeReply({
originChannel,
coverage = [],
channel = 'stable',
+ quote = true,
}) {
const normalizedVersion = String(version ?? '')
.trim()
@@ -369,10 +435,13 @@ export function composeReply({
const prose = body || title;
if (!prose) return null;
- const trimmedProse =
- prose.length > MAX_PROSE_CHARS ? `${prose.slice(0, MAX_PROSE_CHARS).trimEnd()}...` : prose;
+ const lines = [openingLine(channel, normalizedVersion)];
- const lines = [openingLine(channel, normalizedVersion), '', trimmedProse];
+ if (quote) {
+ const trimmedProse =
+ prose.length > MAX_PROSE_CHARS ? `${prose.slice(0, MAX_PROSE_CHARS).trimEnd()}...` : prose;
+ lines.push('', trimmedProse);
+ }
if (coverage.length > 0) {
lines.push('', `Covers ${[...coverage].sort().join(', ')}.`);
diff --git a/.github/scripts/write-back-gate.test.mjs b/.github/scripts/write-back-gate.test.mjs
index 3ad4e9d4c..97a90b095 100644
--- a/.github/scripts/write-back-gate.test.mjs
+++ b/.github/scripts/write-back-gate.test.mjs
@@ -6,6 +6,8 @@ import {
evaluateFanIn,
isOriginRepliableFrom,
highestVersion,
+ markerSuffixFor,
+ originAlreadyNotified,
partitionAttachments,
} from './write-back-gate.mjs';
@@ -283,6 +285,36 @@ describe('reply composition', () => {
expect(compose()).toContain('stays literal instead of turning into a highlight');
});
+ test('a multi-paragraph changeset that fits the bound is quoted in full', () => {
+ // A body that fits the bound is quoted whole, paragraph breaks included: a
+ // changeset that leads with a list stem is meaningless without the list in
+ // the block below it.
+ const text = compose({
+ changeset: {
+ title: 'Message actions',
+ body: 'Messages you send now carry their own actions:\n\n- Resend to a different agent.\n- Copy and edit.',
+ },
+ });
+ expect(text).toContain('Messages you send now carry their own actions:');
+ expect(text).toContain('Resend to a different agent.');
+ });
+
+ test('quote: false omits the changeset prose but keeps the rest of the reply', () => {
+ // The second reply on an origin that already received one has nothing new
+ // to quote: the opening line, coverage, and update instruction already
+ // say everything it needs to.
+ const text = compose({ quote: false });
+ expect(text).not.toContain('stays literal instead of turning into a highlight');
+ expect(text).toContain('v0.36.0');
+ expect(text).toContain('update to the latest desktop app');
+ });
+
+ test('quote: false still refuses to compose from an empty changeset', () => {
+ // A changeset that does not exist is not a fact this reply can stand on,
+ // whether or not the caller intended to quote it.
+ expect(compose({ quote: false, changeset: { title: '', body: '' } })).toBeNull();
+ });
+
test('the reply lists every contributing ticket in sorted order', () => {
const text = compose({ coverage: ['PRD-7403', 'PRD-7398', 'PRD-7400'] });
expect(text).toContain('Covers PRD-7398, PRD-7400, PRD-7403.');
@@ -331,6 +363,31 @@ describe('reply composition', () => {
expect(text).toContain('...');
});
+ // Mirrors write-back-gate.mjs's MAX_PROSE_CHARS (1200). A single-token body
+ // like 'x'.repeat(5000) above can't tell `>` from `>=` at the boundary, and
+ // can't tell .trimEnd() from .trimStart() (both are no-ops on all-x input) —
+ // these three pin the boundary itself and a realistic multi-word cut.
+ test('a body exactly at the bound is quoted whole, not truncated', () => {
+ const body = 'x'.repeat(1200);
+ const text = compose({ changeset: { title: 't', body }, coverage: ['PRD-1'] });
+ expect(text).toContain(body);
+ expect(text).not.toContain('...');
+ });
+
+ test('one character past the bound is truncated', () => {
+ const body = 'x'.repeat(1201);
+ const text = compose({ changeset: { title: 't', body }, coverage: ['PRD-1'] });
+ expect(text).toContain(`${'x'.repeat(1200)}...`);
+ expect(text).not.toContain(body);
+ });
+
+ test('a realistic multi-word body is cut mid-word with the trailing space trimmed', () => {
+ const body = `${'word '.repeat(240)}tail`; // 240*5 + 4 = 1204 chars, space right at the cut
+ const text = compose({ changeset: { title: 't', body }, coverage: ['PRD-1'] });
+ expect(text).toContain('word...');
+ expect(text).not.toContain('word ...');
+ });
+
test('no internal ticket detail reaches the composed reply', () => {
// An adversarial candidate: every field a reporter must never see is
// populated with a recognizable value. The composer's parameter list is
@@ -369,10 +426,12 @@ describe('reply composition', () => {
}
});
- test('the composer accepts nothing beyond the changeset, the version, the channel, and the coverage', () => {
- // A regression pin on the redaction mechanism itself: if a future change
- // widens the parameter object, this states the intended surface out loud.
- expect(composeReply.length).toBe(1);
+ test('the composer redacts extraneous fields rather than trusting the caller to omit them', () => {
+ // A regression pin on the redaction mechanism itself: `composeReply` reads
+ // only the fields it destructures, so passing more can never leak. This
+ // does not (and, being a single destructured object, structurally cannot)
+ // pin which fields those are — that surface is the explicit parameter
+ // list at the function's own definition.
const text = composeReply({
changeset: CHANGESET,
version: '0.36.0',
@@ -410,6 +469,44 @@ describe('origin remit', () => {
});
});
+describe('repeat-reply detection', () => {
+ const ORIGIN = 'https://github.com/inkeep/open-knowledge/issues/1414';
+ // Built from the real `markerSuffixFor`, not a hand-rolled restatement of
+ // it, so this pins the shared contract rather than a second copy of it.
+ const marker = (version, originUrl = ORIGIN) =>
+ `https://github.com/inkeep/open-knowledge/releases/tag/v${version}${markerSuffixFor(originUrl)}`;
+
+ test('no marker for this origin at all means no earlier reply', () => {
+ expect(originAlreadyNotified([], ORIGIN)).toBe(false);
+ expect(originAlreadyNotified([marker('0.59.0')], 'https://github.com/other/repo/issues/1')).toBe(
+ false,
+ );
+ });
+
+ test('a marker for a DIFFERENT version on this origin means an earlier reply already quoted it', () => {
+ // The beta leg marks the origin with its own version; the stable run
+ // reads that marker for a version that is not the one it is about to post.
+ expect(originAlreadyNotified([marker('0.59.0-beta.2')], ORIGIN)).toBe(true);
+ });
+
+ test('an origin carrying its own query string still gets an unambiguous suffix', () => {
+ // encodeURIComponent escapes both `?` and `&`, so a `?notified=` inside the
+ // origin URL itself cannot be confused with the marker's own suffix.
+ const trickyOrigin = 'https://github.com/inkeep/open-knowledge/issues/1?notified=x';
+ expect(originAlreadyNotified([marker('0.59.0')], trickyOrigin)).toBe(false);
+ expect(originAlreadyNotified([marker('0.59.0', trickyOrigin)], trickyOrigin)).toBe(true);
+ expect(originAlreadyNotified([marker('0.59.0', trickyOrigin)], ORIGIN)).toBe(false);
+ });
+
+ test('the suffix must be at the tail, not merely present', () => {
+ // Pins .endsWith over .includes: a plausible-looking simplification to
+ // .includes would leave this suite green everywhere else, since every
+ // other case here puts the suffix genuinely last or leaves it out
+ // entirely.
+ expect(originAlreadyNotified([`${marker('0.59.0')}&ref=slack`], ORIGIN)).toBe(false);
+ });
+});
+
describe('prerelease ordering', () => {
test('a beta ranks below the stable that supersedes it', () => {
expect(compareVersions('0.59.0-beta.9', '0.59.0')).toBeLessThan(0);
diff --git a/.github/scripts/write-back.mjs b/.github/scripts/write-back.mjs
index cf4884e52..f7daeebc4 100644
--- a/.github/scripts/write-back.mjs
+++ b/.github/scripts/write-back.mjs
@@ -58,6 +58,8 @@ import {
composeReply,
evaluateFanIn,
isOriginRepliableFrom,
+ markerSuffixFor,
+ originAlreadyNotified,
partitionAttachments,
} from './write-back-gate.mjs';
@@ -143,7 +145,7 @@ export function notificationMarkerUrl({ version, originUrl }) {
.replace(/^v/, '');
if (!v) throw new Error('notificationMarkerUrl needs a version');
if (!String(originUrl ?? '').trim()) throw new Error('notificationMarkerUrl needs an origin url');
- return `${RELEASES_TAG_BASE}/v${v}?notified=${encodeURIComponent(originUrl)}`;
+ return `${RELEASES_TAG_BASE}/v${v}${markerSuffixFor(originUrl)}`;
}
/**
@@ -615,11 +617,25 @@ export async function runWriteBack({
}
for (const origin of origins) {
+ const attachmentUrls = candidate.attachmentUrls ?? [];
const marker = notificationMarkerUrl({ version: gate.version, originUrl: origin.url });
- if ((candidate.attachmentUrls ?? []).includes(marker)) {
+ if (attachmentUrls.includes(marker)) {
skip(candidate.identifier, 'already-notified');
continue;
}
+ // A marker for this origin under any OTHER version ordinarily means an
+ // earlier reply already quoted the changeset here — a beta reply, most
+ // often. It is a marker existing, not a reply confirmed delivered (see
+ // the NeedsHumanError note below); this elides the quote on the
+ // assumption that a marker usually means the reporter already read it,
+ // rather than never eliding at all.
+ const quotedBefore = originAlreadyNotified(attachmentUrls, origin.url);
+ if (quotedBefore) {
+ log(
+ `::debug::write-back: ${origin.url} already carries a marker for an earlier version ` +
+ `(${candidate.identifier}); any reply for this origin will omit the changeset quote.`,
+ );
+ }
const changeset = await readChangesetProse(candidate, { fixReferences });
const text =
@@ -631,6 +647,7 @@ export async function runWriteBack({
originChannel: origin.channel,
coverage: gate.coverage,
channel,
+ quote: !quotedBefore,
});
if (!text) {
@@ -645,13 +662,14 @@ export async function runWriteBack({
if (!live) {
log(
`::notice::write-back: [dry run] would reply to ${origin.url} for ${candidate.identifier} ` +
- `(v${gate.version}, covers ${gate.coverage.join(', ')}).`,
+ `(v${gate.version}, covers ${gate.coverage.join(', ')}, quoted=${!quotedBefore}).`,
);
posted.push({
identifier: candidate.identifier,
origin: origin.url,
version: gate.version,
dryRun: true,
+ quoted: !quotedBefore,
});
continue;
}
@@ -682,17 +700,20 @@ export async function runWriteBack({
// and the only remaining fix is a reply posted by hand.
throw new NeedsHumanError(
`marker for ${origin.url} was written but the reply did NOT send (${err.message}). ` +
- 'No future run will retry it; post the reply by hand.',
+ 'No future run will retry it; post the reply by hand — and since this marker now makes a ' +
+ 'later automated reply on this same origin assume its quote already landed, include it.',
);
}
log(
- `::notice::write-back: replied to ${origin.url} for ${candidate.identifier} (v${gate.version}).`,
+ `::notice::write-back: replied to ${origin.url} for ${candidate.identifier} ` +
+ `(v${gate.version}, quoted=${!quotedBefore}).`,
);
posted.push({
identifier: candidate.identifier,
origin: origin.url,
version: gate.version,
dryRun: false,
+ quoted: !quotedBefore,
});
}
};
diff --git a/.github/scripts/write-back.test.mjs b/.github/scripts/write-back.test.mjs
index c8502055d..10193f6e3 100644
--- a/.github/scripts/write-back.test.mjs
+++ b/.github/scripts/write-back.test.mjs
@@ -491,6 +491,7 @@ describe('write-back run', () => {
const mark = h.writes.find((w) => w.kind === 'mark');
expect(post.origin).toBe(GH_ISSUE);
expect(post.text).toContain('v0.36.0');
+ expect(post.text).toContain(CHANGESET.body);
expect(mark.url).toBe(notificationMarkerUrl({ version: '0.36.0', originUrl: GH_ISSUE }));
});
@@ -1549,6 +1550,10 @@ describe('the beta leg', () => {
expect(post.text).toContain('going out now on the Open Knowledge beta channel');
expect(post.text).toContain('follow up here');
expect(post.text).not.toContain('This shipped in');
+ // The beta leg is first contact for most reporters, so it is the leg that
+ // must always carry the changeset — a regression here would strip the
+ // note from every reply, beta and stable, from then on.
+ expect(post.text).toContain(CHANGESET.body);
});
test('the beta marker is not the stable one, so each channel is told at most once', async () => {
@@ -1597,4 +1602,54 @@ describe('the beta leg', () => {
expect(post.text).toContain('This shipped in Open Knowledge v0.36.0');
expect(post.text).not.toContain('beta');
});
+
+ test('the stable leg omits the changeset prose when a beta reply already quoted it on this origin', async () => {
+ // The beta marker names v0.37.0-beta.0, a version the stable run is not
+ // about to post about, so the exact-marker check does not fire — but the
+ // presence of ANY marker for this origin means a beta reply ordinarily
+ // already said everything the prose would say a second time.
+ const betaMarker = notificationMarkerUrl({ version: '0.37.0-beta.0', originUrl: GH_ISSUE });
+ const h = harness({
+ live: true,
+ listCandidates: async () => [candidate({ attachmentUrls: [GH_PULL, GH_ISSUE, betaMarker] })],
+ });
+ const result = await h.run();
+ const post = h.writes.find((w) => w.kind === 'post');
+ expect(post.text).toContain('This shipped in Open Knowledge v0.36.0');
+ expect(post.text).not.toContain(CHANGESET.body);
+ expect(result.posted.map((p) => p.identifier)).toEqual(['PRD-7539']);
+ // Pins the live push site's `quoted` flag to what the reply actually did.
+ // The dry-run push site and notice line get their own coverage below.
+ expect(result.posted[0].quoted).toBe(false);
+ });
+
+ test('a dry run reports the same quote decision the live run would make', async () => {
+ const betaMarker = notificationMarkerUrl({ version: '0.37.0-beta.0', originUrl: GH_ISSUE });
+ const h = harness({
+ listCandidates: async () => [candidate({ attachmentUrls: [GH_PULL, GH_ISSUE, betaMarker] })],
+ });
+ const result = await h.run();
+ expect(result.posted[0].quoted).toBe(false);
+ expect(h.logs.some((m) => m.includes('[dry run]') && m.includes('quoted=false'))).toBe(true);
+ });
+
+ test('the quote decision is made per origin, not once for the whole candidate', async () => {
+ // One origin already carries a marker from an earlier version; the other
+ // has never been notified. Hoisting `quotedBefore` out of the per-origin
+ // loop would suppress the quote on the wrong origin without failing any
+ // single-origin test.
+ const betaMarker = notificationMarkerUrl({ version: '0.35.0', originUrl: GH_ISSUE });
+ const h = harness({
+ live: true,
+ listCandidates: async () => [
+ candidate({ attachmentUrls: [GH_PULL, GH_ISSUE, DISCORD_THREAD, betaMarker] }),
+ ],
+ });
+ await h.run();
+ const posts = h.writes.filter((w) => w.kind === 'post');
+ const forIssue = posts.find((p) => p.origin === GH_ISSUE);
+ const forDiscord = posts.find((p) => p.origin === DISCORD_THREAD);
+ expect(forIssue.text).not.toContain(CHANGESET.body);
+ expect(forDiscord.text).toContain(CHANGESET.body);
+ });
});
diff --git a/knip.config.ts b/knip.config.ts
index 8ad68f996..b61debe5e 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -124,9 +124,7 @@ export default {
'packages/server': {
entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],
project: 'src/**',
- ignoreDependencies: [
- '@types/shell-quote',
- ],
+ ignoreDependencies: ['@types/shell-quote'],
},
'packages/cli': {
entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],
diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.ts
index dfd95ef49..d7a845280 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/compose.ts b/packages/core/src/bridge/compose.ts
index 2a597ec3d..f4cc8a286 100644
--- a/packages/core/src/bridge/compose.ts
+++ b/packages/core/src/bridge/compose.ts
@@ -1,4 +1,3 @@
-
import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';
export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';
diff --git a/packages/core/src/bridge/divergence-locate.ts b/packages/core/src/bridge/divergence-locate.ts
index d979f4b39..6b505314d 100644
--- a/packages/core/src/bridge/divergence-locate.ts
+++ b/packages/core/src/bridge/divergence-locate.ts
@@ -1,4 +1,3 @@
-
import { findFirstDivergenceIndex } from './tolerance-telemetry.ts';
export const BRIDGE_LINE_KINDS = [
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index 01ef76a9f..8fb428b90 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';
import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';
diff --git a/packages/core/src/bridge/growth-detect.ts b/packages/core/src/bridge/growth-detect.ts
index 463e89595..9d9c244b0 100644
--- a/packages/core/src/bridge/growth-detect.ts
+++ b/packages/core/src/bridge/growth-detect.ts
@@ -1,4 +1,3 @@
-
const DEFAULT_MIN_SUBSTANTIVE_LINE_LENGTH = 16;
export const DUPLICATION_GATE_MIN_LINE_LENGTH = 8;
diff --git a/packages/core/src/bridge/intraline-predicate.ts b/packages/core/src/bridge/intraline-predicate.ts
index 0939885bb..c43fdd7e7 100644
--- a/packages/core/src/bridge/intraline-predicate.ts
+++ b/packages/core/src/bridge/intraline-predicate.ts
@@ -1,4 +1,3 @@
-
export function rawLineCounts(doc: string): Map<string, number> {
const counts = new Map<string, number>();
for (const line of doc.split('\n')) {
diff --git a/packages/core/src/bridge/merge-three-way.ts b/packages/core/src/bridge/merge-three-way.ts
index c0dc65705..251560a35 100644
--- a/packages/core/src/bridge/merge-three-way.ts
+++ b/packages/core/src/bridge/merge-three-way.ts
@@ -65,7 +65,6 @@ export function tryLineLevelCombine(
return { clean: true, merged };
}
-
export type BridgeMergeContentLossSide = 'user' | 'agent';
export type BridgeMergeContentLossWhich = 'substring' | 'order' | 'growth';
diff --git a/packages/core/src/bridge/normalize.ts b/packages/core/src/bridge/normalize.ts
index dcc5b0690..01ac80099 100644
--- a/packages/core/src/bridge/normalize.ts
+++ b/packages/core/src/bridge/normalize.ts
@@ -1,4 +1,3 @@
-
import { stripFrontmatter } from '../extensions/frontmatter.ts';
import { bodyEdgeEmpties } from './doc-boundary-space.ts';
diff --git a/packages/core/src/bridge/pm-structural-equivalence.ts b/packages/core/src/bridge/pm-structural-equivalence.ts
index 4f7b79587..bb53e7c7c 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;
@@ -129,7 +128,6 @@ export interface ComparePmStructuralOptions {
rawSourceSide?: 'expected';
}
-
/** 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(
@@ -255,7 +253,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/code-fence.ts b/packages/core/src/markdown/code-fence.ts
index 4499dbc92..9807a7e82 100644
--- a/packages/core/src/markdown/code-fence.ts
+++ b/packages/core/src/markdown/code-fence.ts
@@ -1,4 +1,3 @@
-
export function selectFenceChar(info: string): '`' | '~' {
return info.includes('`') ? '~' : '`';
}
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index 34704165b..7415c474a 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/div-align-promoter.ts b/packages/core/src/markdown/div-align-promoter.ts
index ba9b56384..43ecdc709 100644
--- a/packages/core/src/markdown/div-align-promoter.ts
+++ b/packages/core/src/markdown/div-align-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { 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 4513da9bb..6d3f3643e 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 5d1000cc4..da0a81d23 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 9681c0056..787315157 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 { Element as HastElement, Root as HastRoot } from 'hast';
import type { List, Nodes as MdastNodes, Root as MdastRoot } from 'mdast';
import rehypeParse from 'rehype-parse';
@@ -129,8 +128,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 ec1ac1b7e..779e27500 100644
--- a/packages/core/src/markdown/index.ts
+++ b/packages/core/src/markdown/index.ts
@@ -1,4 +1,3 @@
-
import {
type FromProseMirrorOptions,
fromPmMark,
@@ -207,7 +206,6 @@ export class MarkdownManager {
}
}
-
const registry = createRegistry();
function destructureAttrs(
@@ -256,7 +254,6 @@ function destructureAttrs(
return result;
}
-
function hasDirtyDescendant(node: PmNode): boolean {
let found = false;
node.descendants((child) => {
@@ -279,7 +276,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 ?? [];
@@ -348,7 +344,6 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {
return out;
}
-
import {
AUDIO_EXTENSIONS,
FILE_ATTACHMENT_EXTENSIONS,
@@ -601,7 +596,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.emphasis) {
handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({
sourceDelimiter: node.data?.sourceDelimiter ?? '*',
@@ -682,7 +676,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.link) {
const sourceLiteralMark = m.sourceLiteral;
handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {
@@ -980,7 +973,6 @@ function buildMdastToPmHandlers(
};
}
-
const blockUnknownHandler = (node: {
type: string;
position?: { start: { offset: number }; end: { offset: number } };
@@ -1106,7 +1098,6 @@ function buildMdastToPmHandlers(
return handlers as RemarkProseMirrorOptions['handlers'];
}
-
function buildPmToMdastHandlers(
schema: Schema,
freshness: FreshnessCheckerHolder,
diff --git a/packages/core/src/markdown/lint/applies-to.ts b/packages/core/src/markdown/lint/applies-to.ts
index b79e9aef7..fa0be9e86 100644
--- a/packages/core/src/markdown/lint/applies-to.ts
+++ b/packages/core/src/markdown/lint/applies-to.ts
@@ -1,4 +1,3 @@
-
import picomatch from 'picomatch';
import { SUPPORTED_DOC_EXTENSIONS } from '../../constants/doc-extensions.ts';
diff --git a/packages/core/src/markdown/lint/config-files.ts b/packages/core/src/markdown/lint/config-files.ts
index 94b34dee1..312c9c74b 100644
--- a/packages/core/src/markdown/lint/config-files.ts
+++ b/packages/core/src/markdown/lint/config-files.ts
@@ -1,4 +1,3 @@
-
const MARKDOWNLINT_JSON_CONFIG_FILES: ReadonlySet<string> = new Set([
'.markdownlint.json',
'.markdownlint.jsonc',
diff --git a/packages/core/src/markdown/lint/config-schemas.ts b/packages/core/src/markdown/lint/config-schemas.ts
index 7c54c0a73..cc667b93e 100644
--- a/packages/core/src/markdown/lint/config-schemas.ts
+++ b/packages/core/src/markdown/lint/config-schemas.ts
@@ -52,7 +52,6 @@ const fullPluginShape = Object.fromEntries(
LINT_PLUGINS.map((plugin) => [plugin.id, plugin.sliceSchema]),
) as z.ZodRawShape;
-
export const LinterConfigSchema = z.object({
enabled: z.boolean(),
plugins: z.object(fullPluginShape),
diff --git a/packages/core/src/markdown/lint/default-config.ts b/packages/core/src/markdown/lint/default-config.ts
index a51f2ffb0..d48eea5e4 100644
--- a/packages/core/src/markdown/lint/default-config.ts
+++ b/packages/core/src/markdown/lint/default-config.ts
@@ -6,7 +6,6 @@ export const DEFAULT_MARKDOWNLINT_CONFIG: Record<string, MarkdownlintRuleSetting
MD013: false,
};
-
export function resolveMarkdownlintConfig(
rules: Record<string, MarkdownlintRuleSetting> | undefined,
): Configuration {
diff --git a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
index 9c9542661..ef478e268 100644
--- a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
+++ b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
@@ -1,4 +1,3 @@
-
import { CANONICAL_SCHEMA_DIALECT_URIS, DEFAULT_SCHEMA_DIALECT } from './frontmatter-validate.ts';
export interface FrontmatterFieldConstraint {
diff --git a/packages/core/src/markdown/lint/frontmatter-validate.ts b/packages/core/src/markdown/lint/frontmatter-validate.ts
index a19b298ce..1943ac84f 100644
--- a/packages/core/src/markdown/lint/frontmatter-validate.ts
+++ b/packages/core/src/markdown/lint/frontmatter-validate.ts
@@ -1,4 +1,3 @@
-
import Ajv, { type ValidateFunction } from 'ajv';
import Ajv2019 from 'ajv/dist/2019.js';
import Ajv2020 from 'ajv/dist/2020.js';
diff --git a/packages/core/src/markdown/lint/index.ts b/packages/core/src/markdown/lint/index.ts
index 26fbc2b22..781226a5d 100644
--- a/packages/core/src/markdown/lint/index.ts
+++ b/packages/core/src/markdown/lint/index.ts
@@ -1,4 +1,3 @@
-
import type { LintPluginFailureReporter } from './plugin-failure.ts';
import { isLintPluginSelected, LINT_PLUGINS, type LinterConfig } from './plugins.ts';
import type { LintDiagnostic } from './types.ts';
@@ -80,8 +79,7 @@ function renderErrorMessage(error: unknown, depth = 0): string {
try {
const json = JSON.stringify(error);
if (json !== undefined) return json;
- } catch {
- }
+ } catch {}
}
return String(error);
}
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts b/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
index f438f1b16..7a5af097e 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
@@ -1,4 +1,3 @@
-
import type { OkfRuleId } from '../okf-rule-meta.ts';
import { fileNameFor, OKF_SCHEMA_DIR, okfSchemaPathFor } from './paths.ts';
import { OKF_FRONTMATTER_REGISTRY } from './registry.ts';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/paths.ts b/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
index c290b6878..1ee913527 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
@@ -1,4 +1,3 @@
-
import type { OkfRuleId } from '../okf-rule-meta.ts';
export const OKF_SCHEMA_DIR = '.ok/okf';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/registry.ts b/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
index 53ecb619d..f325fbbb4 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
@@ -1,4 +1,3 @@
-
import { compileAppliesTo } from '../applies-to.ts';
import { validateFrontmatterSource } from '../frontmatter-validate.ts';
import {
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts b/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
index f700795d2..ed9e2efcf 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
@@ -1,4 +1,3 @@
-
// file-level form is deliberate: the sibling `biome-ignore` must sit on the line
// oxlint-disable unicorn/no-thenable
diff --git a/packages/core/src/markdown/lint/okf-project/rules.ts b/packages/core/src/markdown/lint/okf-project/rules.ts
index 8b476332e..6d691ae2b 100644
--- a/packages/core/src/markdown/lint/okf-project/rules.ts
+++ b/packages/core/src/markdown/lint/okf-project/rules.ts
@@ -1,4 +1,3 @@
-
import { SUPPORTED_DOC_EXTENSIONS } from '../../../constants/doc-extensions.ts';
import { isOkfRuleEnabled, type OkfRuleId, type OkfRuleToggles } from '../okf-rule-meta.ts';
diff --git a/packages/core/src/markdown/lint/okf-rule-meta.ts b/packages/core/src/markdown/lint/okf-rule-meta.ts
index 44913a9dc..4de50d79f 100644
--- a/packages/core/src/markdown/lint/okf-rule-meta.ts
+++ b/packages/core/src/markdown/lint/okf-rule-meta.ts
@@ -1,4 +1,3 @@
-
export const OKF_RULE_IDS = [
'no-wiki-links',
'log-shape',
diff --git a/packages/core/src/markdown/lint/okf-rules.ts b/packages/core/src/markdown/lint/okf-rules.ts
index d0999b62e..1d5538421 100644
--- a/packages/core/src/markdown/lint/okf-rules.ts
+++ b/packages/core/src/markdown/lint/okf-rules.ts
@@ -1,4 +1,3 @@
-
import { isOkfRuleEnabled, type OkfRuleId, type OkfRuleToggles } from './okf-rule-meta.ts';
import type { OkfRule } from './okf-runner.ts';
import { indexShape } from './rules/index-shape.ts';
diff --git a/packages/core/src/markdown/lint/okf-runner.ts b/packages/core/src/markdown/lint/okf-runner.ts
index fabb08d6e..de130e3f4 100644
--- a/packages/core/src/markdown/lint/okf-runner.ts
+++ b/packages/core/src/markdown/lint/okf-runner.ts
@@ -1,4 +1,3 @@
-
import type { Root } from 'mdast';
import remarkFrontmatter from 'remark-frontmatter';
import remarkGfm from 'remark-gfm';
diff --git a/packages/core/src/markdown/lint/plugin-failure.ts b/packages/core/src/markdown/lint/plugin-failure.ts
index 1cd0d2543..e7d694890 100644
--- a/packages/core/src/markdown/lint/plugin-failure.ts
+++ b/packages/core/src/markdown/lint/plugin-failure.ts
@@ -1,4 +1,3 @@
-
import type { LintPluginId } from './types.ts';
export interface LintPluginFailure {
diff --git a/packages/core/src/markdown/lint/plugins.ts b/packages/core/src/markdown/lint/plugins.ts
index 1dae8316d..e7455ccf7 100644
--- a/packages/core/src/markdown/lint/plugins.ts
+++ b/packages/core/src/markdown/lint/plugins.ts
@@ -1,4 +1,3 @@
-
import { z } from 'zod';
import { DEFAULT_MARKDOWNLINT_CONFIG, resolveMarkdownlintConfig } from './default-config.ts';
import {
@@ -24,7 +23,6 @@ import {
type OkfSlice,
} from './types.ts';
-
const MarkdownlintRuleSettingSchema = z.union([
z.boolean(),
z.enum(MARKDOWNLINT_RULE_SEVERITIES),
diff --git a/packages/core/src/markdown/lint/rules/index-shape.ts b/packages/core/src/markdown/lint/rules/index-shape.ts
index fcbb1b56c..59fe9b87d 100644
--- a/packages/core/src/markdown/lint/rules/index-shape.ts
+++ b/packages/core/src/markdown/lint/rules/index-shape.ts
@@ -1,4 +1,3 @@
-
import type { List, ListItem } from 'mdast';
import { EXIT, visit } from 'unist-util-visit';
import { defineScopedOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/rules/log-shape.ts b/packages/core/src/markdown/lint/rules/log-shape.ts
index 431e4e9c8..e0159519f 100644
--- a/packages/core/src/markdown/lint/rules/log-shape.ts
+++ b/packages/core/src/markdown/lint/rules/log-shape.ts
@@ -1,4 +1,3 @@
-
import type { Heading } from 'mdast';
import { toString as headingText } from 'mdast-util-to-string';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/lint/rules/no-wiki-links.ts b/packages/core/src/markdown/lint/rules/no-wiki-links.ts
index f75a04d15..2123e977f 100644
--- a/packages/core/src/markdown/lint/rules/no-wiki-links.ts
+++ b/packages/core/src/markdown/lint/rules/no-wiki-links.ts
@@ -1,4 +1,3 @@
-
import type { Point } from 'unist';
import { visit } from 'unist-util-visit';
import { defineOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/rules/reserved-casing.ts b/packages/core/src/markdown/lint/rules/reserved-casing.ts
index c8b4d8f28..89ef3e4a9 100644
--- a/packages/core/src/markdown/lint/rules/reserved-casing.ts
+++ b/packages/core/src/markdown/lint/rules/reserved-casing.ts
@@ -1,4 +1,3 @@
-
import { SUPPORTED_DOC_EXTENSIONS } from '../../../constants/doc-extensions.ts';
import { defineOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/types.ts b/packages/core/src/markdown/lint/types.ts
index 594830b88..2cffecae6 100644
--- a/packages/core/src/markdown/lint/types.ts
+++ b/packages/core/src/markdown/lint/types.ts
@@ -1,4 +1,3 @@
-
import type { BrokenLinkReason } from '../../schemas/api/agent-write.ts';
import type { OkfRuleId } from './okf-rule-meta.ts';
@@ -113,7 +112,6 @@ export interface OkfSlice {
generate?: { index?: boolean };
}
-
interface RuleOptionSpecBase {
key: string;
description: string;
diff --git a/packages/core/src/markdown/lint/validation-counts.ts b/packages/core/src/markdown/lint/validation-counts.ts
index 437cc539a..98238656e 100644
--- a/packages/core/src/markdown/lint/validation-counts.ts
+++ b/packages/core/src/markdown/lint/validation-counts.ts
@@ -1,4 +1,3 @@
-
export interface ValidationSourceCounts {
errorCount: number;
warningCount: number;
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 00fbc0035..ed89371d0 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 fa3cfcd86..bfd7e3109 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 4aa0490c4..d988f4b8b 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 55736041c..0e3224206 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 ccf06e94d..91cdf658f 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';
import { isBlankLineParagraph } from './zero-emission-blocks.ts';
diff --git a/packages/core/src/markdown/position-slice.ts b/packages/core/src/markdown/position-slice.ts
index e5b4c9eba..0f399d34c 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';
@@ -477,8 +476,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-fidelity.test-helper.ts b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
index 96304e7a5..0dd54070e 100644
--- a/packages/core/src/markdown/serialize-fidelity.test-helper.ts
+++ b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
@@ -1,4 +1,3 @@
-
import type { JSONContent } from '@tiptap/core';
import type { Nodes } from 'mdast';
import { expect } from 'vitest';
diff --git a/packages/core/src/markdown/serialize-helpers.ts b/packages/core/src/markdown/serialize-helpers.ts
index 93798cf83..7cac5b042 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,
diff --git a/packages/core/src/markdown/single-dollar-math-promoter.ts b/packages/core/src/markdown/single-dollar-math-promoter.ts
index 8c08b7a04..b012a5aff 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 83d4af672..b50bea5ec 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/underline-promoter.ts b/packages/core/src/markdown/underline-promoter.ts
index 6e6d73400..0f1b0f27d 100644
--- a/packages/core/src/markdown/underline-promoter.ts
+++ b/packages/core/src/markdown/underline-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, Root } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/unknown-mdast-guard.ts b/packages/core/src/markdown/unknown-mdast-guard.ts
index 932d7d2a8..1a082bda7 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 ac9f5239b..d578476a7 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) {