Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(open-knowledge): packs-forward first-run launcher (#2442)

sarah5b743f423e81
diff --git a/.changeset/first-run-packs-forward-launcher.md b/.changeset/first-run-packs-forward-launcher.md
new file mode 100644
index 000000000..570cce6b0
--- /dev/null
+++ b/.changeset/first-run-packs-forward-launcher.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": minor
+---
+
+New projects can now start from a starter pack right on the first-run launcher. When you open OpenKnowledge with no recent projects, the launcher leads with the starter packs (Knowledge base, Software lifecycle, Codebase wiki, and more) so a brand-new project opens already scaffolded with folders and templates instead of a blank editor. Picking a pack flows into the create dialog with the pack pre-selected; you still name the project and choose where it lives, then the editor opens populated. Prefer to start differently? Open a folder, clone from GitHub, or start a blank project from the same screen. Returning users (anyone with recent projects) see the launcher exactly as before.
diff --git a/packages/app/src/components/CreateProjectDialog.runtime.dom.test.tsx b/packages/app/src/components/CreateProjectDialog.runtime.dom.test.tsx
index d04d4bff3..237e77fa9 100644
--- a/packages/app/src/components/CreateProjectDialog.runtime.dom.test.tsx
+++ b/packages/app/src/components/CreateProjectDialog.runtime.dom.test.tsx
@@ -16,9 +16,29 @@ import type {
OkDesktopBridge,
OkFolderState,
OkMcpWiringEditorId,
+ OkSeedPackInfo,
} from '@/lib/desktop-bridge-types';
import { CreateProjectDialog } from './CreateProjectDialog';
+// Two packs to look up `initialPackId`'s display metadata. Folder counts differ
+// so the read-only description's "N folders" phrasing is distinguishable per pack.
+const PACKS: OkSeedPackInfo[] = [
+ {
+ id: 'plain-notes',
+ name: 'Plain notes',
+ description: 'A single flat folder for quick notes.',
+ folders: [],
+ entryCounts: { files: 2, folders: 1 },
+ },
+ {
+ id: 'knowledge-base',
+ name: 'Knowledge base',
+ description: 'Structured folders for a team wiki.',
+ folders: [],
+ entryCounts: { files: 8, folders: 4 },
+ },
+];
+
type WindowGlobals = {
NodeFilter?: typeof NodeFilter;
};
@@ -60,6 +80,7 @@ function makeBridge() {
name: string;
editors: OkMcpWiringEditorId[];
sharing: 'shared' | 'local-only';
+ packId?: string;
}> = [];
const bridge = {
@@ -90,6 +111,7 @@ function makeBridge() {
name: string;
editors: OkMcpWiringEditorId[];
sharing: 'shared' | 'local-only';
+ packId?: string;
}) => {
createNewCalls.push(payload);
return createNewImpl();
@@ -338,6 +360,42 @@ describe('CreateProjectDialog runtime wiring', () => {
expect(stub.createNewCalls[0]?.sharing).toBe('local-only');
});
+ test('a pre-selected pack threads packId through to the createNew payload', async () => {
+ // Pins the seam that makes the packs-forward launcher actually seed:
+ // `initialPackId` → `createNew({ ..., packId })`. Without this, dropping
+ // `packId` threading in the dialog would silently make every first-run
+ // pack pick produce a blank project (DOM tests mock the dialog; the
+ // desktop integration tests call `runCreateNew` directly — neither
+ // exercises the real dialog → bridge payload with a pack).
+ const stub = makeBridge();
+ const onOpenChange = mock(() => {});
+ render(
+ <CreateProjectDialog
+ open={true}
+ onOpenChange={onOpenChange}
+ bridge={stub.bridge}
+ initialPackId="plain-notes"
+ packs={PACKS}
+ />,
+ );
+ await screen.findByTestId('create-project-dialog');
+ await waitForLocationHydrate();
+
+ // The launcher-chosen pack is named as read-only context in the dialog
+ // description — no Select control.
+ expect(screen.getByTestId('create-project-dialog').textContent).toContain('Plain notes');
+
+ await typeProjectName(PROJECT_NAME);
+ await waitForSubmitEnabled();
+
+ fireEvent.click(screen.getByTestId('create-submit'));
+
+ await waitFor(() => {
+ expect(stub.createNewCalls).toHaveLength(1);
+ });
+ expect(stub.createNewCalls[0]?.packId).toBe('plain-notes');
+ });
+
test('name resolving to a non-empty folder shows inline name-taken error and disables Create', async () => {
const stub = makeBridge();
const TAKEN_NAME = 'Existing Notes';
diff --git a/packages/app/src/components/CreateProjectDialog.tsx b/packages/app/src/components/CreateProjectDialog.tsx
index 8e9e22f47..9cb81d2d4 100644
--- a/packages/app/src/components/CreateProjectDialog.tsx
+++ b/packages/app/src/components/CreateProjectDialog.tsx
@@ -73,7 +73,7 @@ import {
} from '@inkeep/open-knowledge-core';
import type { MessageDescriptor } from '@lingui/core';
import { msg } from '@lingui/core/macro';
-import { Trans, useLingui } from '@lingui/react/macro';
+import { Plural, Trans, useLingui } from '@lingui/react/macro';
import { ChevronRight } from 'lucide-react';
import { useEffect, useId, useRef, useState } from 'react';
import { toast } from 'sonner';
@@ -98,6 +98,8 @@ import type {
OkFindEnclosingProjectRootResult,
OkFolderState,
OkMcpWiringEditorId,
+ OkPackId,
+ OkSeedPackInfo,
} from '@/lib/desktop-bridge-types';
/**
@@ -178,6 +180,22 @@ interface CreateProjectDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
bridge: OkDesktopBridge;
+ /**
+ * Starter pack pre-selected on the packs-forward first-run launcher. When
+ * set (alongside a matching entry in `packs`), the dialog names the pack in
+ * its description as read-only confirmation and threads this id into
+ * `createNew` so the fresh project opens seeded. The pack was already chosen
+ * on the launcher — the dialog confirms it, it isn't a control here. Unset →
+ * the blank-project create flow (today's generic description). No subfolder
+ * UI — first-run applies the pack's defaults (see `runCreateNew`).
+ */
+ initialPackId?: OkPackId;
+ /**
+ * The available starter packs, used only to look up `initialPackId`'s
+ * display metadata (name + folder count) for the read-only description.
+ * Empty/omitted → the generic blank-create description.
+ */
+ packs?: OkSeedPackInfo[];
}
/**
@@ -281,7 +299,13 @@ function errorCopy(err: CreateNewError): MessageDescriptor {
}
}
-export function CreateProjectDialog({ open, onOpenChange, bridge }: CreateProjectDialogProps) {
+export function CreateProjectDialog({
+ open,
+ onOpenChange,
+ bridge,
+ initialPackId,
+ packs,
+}: CreateProjectDialogProps) {
const { t } = useLingui();
const formId = useId();
const nameInputId = useId();
@@ -588,6 +612,12 @@ export function CreateProjectDialog({ open, onOpenChange, bridge }: CreateProjec
});
}, [open, cascade, bridge]);
+ // The launcher-chosen pack, resolved for the read-only description. Present
+ // only when the dialog was opened from a pack (`initialPackId` set) and its
+ // metadata is available in `packs`; otherwise the description stays generic
+ // (blank / `File → New` create path).
+ const selectedPack = packs?.find((pack) => pack.id === initialPackId);
+
// Derived name + target presentation.
const rawName = name;
const sanitized = rawName === '' ? '' : sanitizeFolderName(rawName);
@@ -682,6 +712,10 @@ export function CreateProjectDialog({ open, onOpenChange, bridge }: CreateProjec
name: sanitized,
editors: Array.from(editorIds),
sharing,
+ // Seed the launcher-chosen starter pack (packs-forward first-run).
+ // Undefined on the blank-create path — main opens an empty project
+ // as before.
+ packId: initialPackId,
});
onOpenChange(false);
} catch (err) {
@@ -771,7 +805,16 @@ export function CreateProjectDialog({ open, onOpenChange, bridge }: CreateProjec
<Trans>Create new project</Trans>
</DialogTitle>
<DialogDescription>
- <Trans>Create a new OpenKnowledge project in the folder of your choice.</Trans>
+ {selectedPack ? (
+ <Trans>
+ Create a new OpenKnowledge project from the <strong>{selectedPack.name}</strong>{' '}
+ starter pack (
+ <Plural value={selectedPack.entryCounts.folders} one="# folder" other="# folders" />{' '}
+ and starter templates) in the folder of your choice.
+ </Trans>
+ ) : (
+ <Trans>Create a new OpenKnowledge project in the folder of your choice.</Trans>
+ )}
</DialogDescription>
</DialogHeader>
diff --git a/packages/app/src/components/NavigatorApp.first-run.dom.test.tsx b/packages/app/src/components/NavigatorApp.first-run.dom.test.tsx
new file mode 100644
index 000000000..31c7f3c0e
--- /dev/null
+++ b/packages/app/src/components/NavigatorApp.first-run.dom.test.tsx
@@ -0,0 +1,304 @@
+import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test';
+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import type { ReactNode } from 'react';
+import { NavigatorApp } from './NavigatorApp';
+
+let createDialogProps: Array<{
+ open: boolean;
+ initialPackId?: string;
+ packs?: Array<{ id: string }>;
+ onOpenChange?: (next: boolean) => void;
+}> = [];
+let listPacksImpl: () => Promise<unknown> = () =>
+ Promise.resolve({
+ ok: true,
+ packs: [
+ {
+ id: 'knowledge-base',
+ name: 'Knowledge base',
+ description: '',
+ folders: [],
+ entryCounts: { files: 0, folders: 0 },
+ },
+ ],
+ });
+
+mock.module('next-themes', () => ({
+ useTheme: () => ({ theme: undefined }),
+}));
+
+mock.module('@/hooks/use-theme-bridge', () => ({
+ useThemeBridge: () => {},
+}));
+
+mock.module('./BetaBadge', () => ({
+ BetaBadge: () => <span data-testid="beta-badge">Beta</span>,
+}));
+
+mock.module('./ui/button', () => ({
+ Button: ({ children, ...props }: { children?: ReactNode; [key: string]: unknown }) => (
+ <button type="button" {...props}>
+ {children}
+ </button>
+ ),
+}));
+
+mock.module('./ui/badge', () => ({
+ Badge: ({ children, ...props }: { children?: ReactNode; [key: string]: unknown }) => (
+ <span {...props}>{children}</span>
+ ),
+}));
+
+// Stub the pack grid: expose a single card whose click fires onPackSelect so
+// the launcher's pack → dialog wiring can be asserted without the real grid.
+// The card only renders once `packs` has loaded (mirrors the real grid, which
+// shows skeletons while null) — so `findByTestId(card)` waits for the launcher's
+// listPacks fetch to settle before a click, and the resolved pack name is
+// available by then (avoids racing the async fetch under full-suite timing).
+mock.module('./PackCardGrid', () => ({
+ PackCardGrid: ({
+ onPackSelect,
+ packs,
+ }: {
+ onPackSelect: (id: string) => void;
+ packs?: unknown[] | null;
+ }) =>
+ packs == null ? (
+ <div data-testid="pack-grid-loading" />
+ ) : (
+ <button
+ type="button"
+ data-testid="pack-card-knowledge-base"
+ onClick={() => onPackSelect('knowledge-base')}
+ >
+ Knowledge base
+ </button>
+ ),
+}));
+
+mock.module('@/lib/seed-client', () => ({
+ seedClient: () => ({ listPacks: () => listPacksImpl() }),
+}));
+
+mock.module('./CreateProjectDialog', () => ({
+ CreateProjectDialog: (props: {
+ open: boolean;
+ initialPackId?: string;
+ packs?: Array<{ id: string }>;
+ onOpenChange?: (next: boolean) => void;
+ }) => {
+ createDialogProps.push(props);
+ return (
+ <div
+ data-testid="create-project-dialog"
+ data-open={String(props.open)}
+ data-pack-id={props.initialPackId ?? ''}
+ data-pack-count={props.packs === undefined ? '' : String(props.packs.length)}
+ >
+ {/* Stand-in for the dialog's own close path (Escape / backdrop /
+ Cancel) so a test can drive the parent's onOpenChange(false)
+ without the real Radix dialog. */}
+ <button
+ type="button"
+ data-testid="create-dialog-close"
+ onClick={() => props.onOpenChange?.(false)}
+ />
+ </div>
+ );
+ },
+}));
+
+mock.module('./CloneDialog', () => ({
+ CloneDialog: (props: { open: boolean }) => (
+ <div data-testid="clone-dialog" data-open={String(props.open)} />
+ ),
+}));
+
+mock.module('./AuthModal', () => ({ AuthModal: () => null }));
+mock.module('./ConsentDialog', () => ({ ConsentDialog: () => null }));
+mock.module('./McpConsentDialog', () => ({ McpConsentDialog: () => null }));
+mock.module('./ShareReceiveDialog', () => ({ ShareReceiveDialog: () => null }));
+mock.module('@/lib/share/clone-controller', () => ({ createCloneController: () => ({}) }));
+mock.module('@/lib/transports/auth-query-transport', () => ({ ipcAuthQueryTransport: () => ({}) }));
+mock.module('@/lib/transports/auth-transport', () => ({ ipcAuthTransport: () => ({}) }));
+mock.module('@/lib/transports/clone-transport', () => ({ ipcCloneTransport: () => ({}) }));
+
+function createBridge(recents: unknown[]) {
+ return {
+ appVersion: '0.4.0-beta.1',
+ onMenuAction: mock(() => () => {}),
+ config: { mode: 'navigator' },
+ project: {
+ listRecent: mock(() => Promise.resolve(recents)),
+ removeRecent: mock(() => Promise.resolve()),
+ open: mock(() => Promise.resolve()),
+ createNew: mock(() => Promise.resolve()),
+ recordCreateNewBannerShown: mock(() => Promise.resolve()),
+ readHeadBranch: mock(() => Promise.resolve({ currentBranch: null })),
+ },
+ dialog: {
+ openFolder: mock(() => Promise.resolve('/picked/folder')),
+ },
+ };
+}
+
+async function renderNavigator(bridge: ReturnType<typeof createBridge>) {
+ Object.defineProperty(window, 'okDesktop', { configurable: true, value: bridge });
+ render(<NavigatorApp bridge={bridge as never} />);
+ await waitFor(() => expect(bridge.project.listRecent).toHaveBeenCalledTimes(1));
+}
+
+describe('NavigatorApp first-run packs-forward launcher', () => {
+ beforeEach(() => {
+ cleanup();
+ Reflect.deleteProperty(window, 'okDesktop');
+ createDialogProps = [];
+ listPacksImpl = () =>
+ Promise.resolve({
+ ok: true,
+ packs: [
+ {
+ id: 'knowledge-base',
+ name: 'Knowledge base',
+ description: '',
+ folders: [],
+ entryCounts: { files: 0, folders: 0 },
+ },
+ ],
+ });
+ });
+
+ afterEach(() => cleanup());
+
+ test('leads with the pack grid + demoted secondary row when there are no recents', async () => {
+ const bridge = createBridge([]);
+ await renderNavigator(bridge);
+
+ // Packs-forward view present; three-card launcher absent.
+ const firstRun = await screen.findByTestId('nav-first-run');
+ expect(firstRun.textContent).toContain('What do you want to build?');
+ expect(screen.queryByTestId('nav-create-new')).toBeNull();
+
+ // Secondary row keeps all three original doors.
+ expect(screen.getByTestId('nav-first-run-open')).not.toBeNull();
+ expect(screen.getByTestId('nav-first-run-clone')).not.toBeNull();
+ expect(screen.getByTestId('nav-first-run-blank')).not.toBeNull();
+ });
+
+ test('pack click opens the create dialog with the pack pre-selected + the pack list', async () => {
+ const bridge = createBridge([]);
+ await renderNavigator(bridge);
+
+ const card = await screen.findByTestId('pack-card-knowledge-base');
+ fireEvent.click(card);
+
+ await waitFor(() => {
+ const dialog = screen.getByTestId('create-project-dialog');
+ expect(dialog.getAttribute('data-open')).toBe('true');
+ expect(dialog.getAttribute('data-pack-id')).toBe('knowledge-base');
+ // The full pack list (not a name string) threads through so the dialog
+ // can look up the chosen pack's display metadata — the stub listPacks
+ // returns one pack.
+ expect(dialog.getAttribute('data-pack-count')).toBe('1');
+ });
+ });
+
+ test('secondary Blank project opens the create dialog with no pack selected', async () => {
+ const bridge = createBridge([]);
+ await renderNavigator(bridge);
+
+ fireEvent.click(await screen.findByTestId('nav-first-run-blank'));
+ await waitFor(() => {
+ const dialog = screen.getByTestId('create-project-dialog');
+ expect(dialog.getAttribute('data-open')).toBe('true');
+ expect(dialog.getAttribute('data-pack-id')).toBe('');
+ });
+ });
+
+ test('secondary Open folder routes through the pick-existing entry point', async () => {
+ const bridge = createBridge([]);
+ await renderNavigator(bridge);
+
+ fireEvent.click(await screen.findByTestId('nav-first-run-open'));
+ await waitFor(() => {
+ expect(bridge.project.open).toHaveBeenCalledWith({
+ path: '/picked/folder',
+ target: 'new-window',
+ entryPoint: 'pick-existing',
+ });
+ });
+ });
+
+ test('pack selection clears on dialog close — reopening Blank carries no stale pack', async () => {
+ const bridge = createBridge([]);
+ await renderNavigator(bridge);
+
+ // Open via a pack card → dialog carries the pre-selected pack.
+ fireEvent.click(await screen.findByTestId('pack-card-knowledge-base'));
+ await waitFor(() => {
+ const dialog = screen.getByTestId('create-project-dialog');
+ expect(dialog.getAttribute('data-open')).toBe('true');
+ expect(dialog.getAttribute('data-pack-id')).toBe('knowledge-base');
+ });
+
+ // Close the dialog (Escape / backdrop / Cancel stand-in).
+ fireEvent.click(screen.getByTestId('create-dialog-close'));
+ await waitFor(() => {
+ expect(screen.getByTestId('create-project-dialog').getAttribute('data-open')).toBe('false');
+ });
+
+ // Reopen via the secondary "Blank project" door — the stale packId must
+ // not leak in, or the blank-create path would silently seed a pack.
+ fireEvent.click(screen.getByTestId('nav-first-run-blank'));
+ await waitFor(() => {
+ const dialog = screen.getByTestId('create-project-dialog');
+ expect(dialog.getAttribute('data-open')).toBe('true');
+ expect(dialog.getAttribute('data-pack-id')).toBe('');
+ });
+ });
+
+ test('listPacks error still renders a usable first-run state (secondary row intact)', async () => {
+ listPacksImpl = () =>
+ Promise.resolve({ ok: false, error: { kind: 'internal', message: 'boom' } });
+ const bridge = createBridge([]);
+ await renderNavigator(bridge);
+
+ // The packs-forward view still mounts; the demoted secondary row remains
+ // the user's path forward even when the pack fetch fails.
+ const firstRun = await screen.findByTestId('nav-first-run');
+ expect(firstRun).not.toBeNull();
+ expect(screen.getByTestId('nav-first-run-secondary')).not.toBeNull();
+ expect(screen.getByTestId('nav-first-run-open')).not.toBeNull();
+ expect(screen.getByTestId('nav-first-run-clone')).not.toBeNull();
+ expect(screen.getByTestId('nav-first-run-blank')).not.toBeNull();
+ });
+
+ test('renders the returning-user three-card launcher unchanged when recents exist', async () => {
+ const bridge = createBridge([{ path: '/projects/recent', name: 'Recent Project' }]);
+ await renderNavigator(bridge);
+
+ // Three-card launcher present; packs-forward view absent.
+ expect(await screen.findByTestId('nav-create-new')).not.toBeNull();
+ expect(screen.getByTestId('nav-open')).not.toBeNull();
+ expect(screen.getByTestId('nav-clone')).not.toBeNull();
+ expect(screen.queryByTestId('nav-first-run')).toBeNull();
+ expect(await screen.findByTestId('nav-recent-list')).not.toBeNull();
+ });
+
+ test('listRecent failure falls back to the three-card launcher, not the packs view', async () => {
+ // A rejected listRecent leaves `recents` empty — but an empty-because-failed
+ // fetch must NOT read as "brand-new user" and show the first-run packs
+ // onboarding. It falls back to the returning-user three-card launcher.
+ const bridge = createBridge([]);
+ bridge.project.listRecent = mock(() => Promise.reject(new Error('boom')));
+ await renderNavigator(bridge);
+
+ expect(await screen.findByTestId('nav-create-new')).not.toBeNull();
+ expect(screen.getByTestId('nav-open')).not.toBeNull();
+ expect(screen.getByTestId('nav-clone')).not.toBeNull();
+ // The first-run packs view must be absent.
+ expect(screen.queryByTestId('nav-first-run')).toBeNull();
+ // The failure surfaces the error banner.
+ expect(screen.getByTestId('nav-error-banner')).not.toBeNull();
+ });
+});
diff --git a/packages/app/src/components/NavigatorApp.tsx b/packages/app/src/components/NavigatorApp.tsx
index f70614239..71238b5f4 100644
--- a/packages/app/src/components/NavigatorApp.tsx
+++ b/packages/app/src/components/NavigatorApp.tsx
@@ -22,13 +22,16 @@ import { useThemeBridge } from '@/hooks/use-theme-bridge';
import type {
OkDesktopBridge,
OkLocalOpAuthStatusResponse,
+ OkPackId,
OkProjectEntryPoint,
+ OkSeedPackInfo,
RecentProjectEntry,
} from '@/lib/desktop-bridge-types';
import {
resolveErrorMessage,
runWithErrorStatePure as runWithErrorStatePureBase,
} from '@/lib/error-state';
+import { seedClient } from '@/lib/seed-client';
import { createCloneController } from '@/lib/share/clone-controller';
import { ipcAuthQueryTransport } from '@/lib/transports/auth-query-transport';
import { ipcAuthTransport } from '@/lib/transports/auth-transport';
@@ -42,6 +45,7 @@ import { CreateProjectDialog } from './CreateProjectDialog';
import { GithubIcon } from './icons/github';
import { OkIcon } from './icons/ok';
import { McpConsentDialog } from './McpConsentDialog';
+import { PackCardGrid } from './PackCardGrid';
import { basenameOf } from './project-switcher-recents';
import { Badge } from './ui/badge';
import { Button } from './ui/button';
@@ -76,6 +80,11 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
const [recents, setRecents] = useState<RecentProject[]>([]);
const [recentBranches, setRecentBranches] = useState<Map<string, string | null>>(new Map());
const [loading, setLoading] = useState(true);
+ // Whether the `listRecent()` fetch rejected. A fetch failure must fall back
+ // to the returning-user three-card launcher, NOT the first-run packs view —
+ // otherwise a transient error would show a returning user the first-run
+ // onboarding (`recents` stays `[]` on failure).
+ const [recentsLoadFailed, setRecentsLoadFailed] = useState(false);
const [error, setError] = useState<string | null>(null);
// Non-null while a project open is in flight. `bridge.project.open` stays
// pending for the entire main-side flow — server spawn, the up-to-15s lock
@@ -85,6 +94,13 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
const [openingLabel, setOpeningLabel] = useState<string | null>(null);
const [cloneDialogOpen, setCloneDialogOpen] = useState(false);
const [createDialogOpen, setCreateDialogOpen] = useState(false);
+ // Starter pack chosen on the packs-forward first-run grid, plus the pack
+ // list. Threaded into CreateProjectDialog so it can name the pack as
+ // read-only context in its description and seed the fresh project with it;
+ // both clear on dialog close so the blank-create path (secondary row /
+ // File → New project) never inherits a stale selection.
+ const [createPackId, setCreatePackId] = useState<OkPackId | undefined>(undefined);
+ const [createPacks, setCreatePacks] = useState<OkSeedPackInfo[] | undefined>(undefined);
const [authModalOpen, setAuthModalOpen] = useState(false);
const [returnToCloneAfterAuth, setReturnToCloneAfterAuth] = useState(false);
// Pending share-receive sign-in resolver — the share dialog's controller
@@ -165,6 +181,10 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
console.error('[NavigatorApp] listRecent failed:', err);
if (!cancelled) {
setError(err instanceof Error ? err.message : t`Failed to load recent projects.`);
+ // Mark the fetch as failed so the launcher falls back to the
+ // three-card view rather than the first-run packs onboarding (an
+ // empty `recents` on failure would otherwise read as "brand-new user").
+ setRecentsLoadFailed(true);
}
})
.finally(() => {
@@ -224,6 +244,25 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
const onCreate = () => setCreateDialogOpen(true);
+ // First-run pack pick → open the create dialog with the pack pre-selected
+ // and the full pack list so the dialog's Select can switch in-place.
+ const onPackSelect = (packId: OkPackId, packs: OkSeedPackInfo[]) => {
+ setCreatePackId(packId);
+ setCreatePacks(packs);
+ setCreateDialogOpen(true);
+ };
+
+ // Clear the pending pack + pack list whenever the create dialog closes so the
+ // next open (blank secondary-row create, File → New project) starts unseeded
+ // and renders no Select.
+ const onCreateDialogOpenChange = (next: boolean) => {
+ setCreateDialogOpen(next);
+ if (!next) {
+ setCreatePackId(undefined);
+ setCreatePacks(undefined);
+ }
+ };
+
const onOpenRecent = (path: string) =>
openWithIndicator(path, 'recents', displayNameForPath(path));
@@ -258,7 +297,7 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
//
// `overflow-hidden` on the content column + `shrink-0` on every
// fixed-height item keeps the primary affordances on-screen at the
- // default 840×600 Navigator window size.
+ // default 920×680 Navigator window size.
<div className="relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground">
{/* Chrome row is absolutely positioned so it doesn't push content
out of geometric center. The full window height participates in
@@ -298,29 +337,43 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
</div>
</header>
- <section className="grid shrink-0 sm:grid-cols-3 gap-3">
- <NavigatorCard
- title={t`Create new project`}
- description={t`Start a new OpenKnowledge project.`}
- onClick={onCreate}
- dataTestId="nav-create-new"
- Icon={PlusIcon}
- />
- <NavigatorCard
- title={t`Open folder on disk`}
- description={t`Use a folder you already have.`}
- onClick={onOpenFolder}
- dataTestId="nav-open"
- Icon={FolderOpenIcon}
+ {/* First run (no recents, load settled) leads with the starter
+ packs; everyone else sees today's three-card launcher unchanged.
+ During loading we render neither so neither the packs grid nor the
+ three-card launcher flashes in before a returning user's recents
+ resolve. */}
+ {loading ? null : !recentsLoadFailed && recents.length === 0 ? (
+ <FirstRunPacksView
+ onPackSelect={onPackSelect}
+ onOpenFolder={onOpenFolder}
+ onClone={onClone}
+ onCreate={onCreate}
/>
- <NavigatorCard
- title={t`Clone from GitHub`}
- description={t`Bring a remote repository onto this machine.`}
- onClick={onClone}
- dataTestId="nav-clone"
- Icon={GithubIcon}
- />
- </section>
+ ) : (
+ <section className="grid shrink-0 sm:grid-cols-3 gap-3">
+ <NavigatorCard
+ title={t`Create new project`}
+ description={t`Start a new OpenKnowledge project.`}
+ onClick={onCreate}
+ dataTestId="nav-create-new"
+ Icon={PlusIcon}
+ />
+ <NavigatorCard
+ title={t`Open folder on disk`}
+ description={t`Use a folder you already have.`}
+ onClick={onOpenFolder}
+ dataTestId="nav-open"
+ Icon={FolderOpenIcon}
+ />
+ <NavigatorCard
+ title={t`Clone from GitHub`}
+ description={t`Bring a remote repository onto this machine.`}
+ onClick={onClone}
+ dataTestId="nav-clone"
+ Icon={GithubIcon}
+ />
+ </section>
+ )}
{error !== null ? (
<div
@@ -383,8 +436,10 @@ export function NavigatorApp({ bridge }: { bridge: OkDesktopBridge }) {
<CreateProjectDialog
open={createDialogOpen}
- onOpenChange={setCreateDialogOpen}
+ onOpenChange={onCreateDialogOpenChange}
bridge={bridge}
+ initialPackId={createPackId}
+ packs={createPacks}
/>
<AuthModal
@@ -501,6 +556,126 @@ function NavigatorCard({ title, description, onClick, dataTestId, Icon }: Naviga
);
}
+/**
+ * Packs-forward first-run launcher. Leads with the same starter-pack grid the
+ * empty editor shows (6 visible + "Show more" for `okf`/`entity-vault`) so a
+ * brand-new user's first action produces a project that already has content in
+ * it. Below it, a demoted secondary row keeps the three original doors for
+ * people who arrive with their own content. Only mounted when there are no
+ * recent projects — returning users never see it.
+ *
+ * Fetches the pack list here (not in `PackCardGrid`, which can self-fetch) so
+ * `onPackSelect` can hand the full list to the create dialog's Select without a
+ * second round-trip.
+ */
+function FirstRunPacksView({
+ onPackSelect,
+ onOpenFolder,
+ onClone,
+ onCreate,
+}: {
+ onPackSelect: (packId: OkPackId, packs: OkSeedPackInfo[]) => void;
+ onOpenFolder: () => void;
+ onClone: () => void;
+ onCreate: () => void;
+}) {
+ const [packs, setPacks] = useState<OkSeedPackInfo[] | null>(null);
+
+ useEffect(() => {
+ let cancelled = false;
+ void (async () => {
+ try {
+ const result = await seedClient().listPacks();
+ if (cancelled) return;
+ // `[]` short-circuits PackCardGrid's spinner into its labelled
+ // empty-state; the secondary row below still gives the user a path.
+ if (result.ok) {
+ setPacks(result.packs);
+ } else {
+ console.error('[NavigatorApp] listPacks returned error:', result);
+ setPacks([]);
+ }
+ } catch (err) {
+ if (cancelled) return;
+ console.error('[NavigatorApp] listPacks failed:', err);
+ setPacks([]);
+ }
+ })();
+ return () => {
+ cancelled = true;
+ };
+ }, []);
+
+ return (
+ <section className="flex min-h-0 shrink flex-col gap-6" data-testid="nav-first-run">
+ <div className="flex shrink-0 flex-col gap-1">
+ <h2 className="text-xl font-light tracking-tighter text-balance">
+ <Trans>What do you want to build?</Trans>
+ </h2>
+ <p className="text-muted-foreground text-sm">
+ <Trans>
+ Pick a starter pack to scaffold your project with ready-made folders and templates.
+ </Trans>
+ </p>
+ </div>
+ {/* Grid scrolls inside its own container so the header + secondary row
+ stay anchored on the default 920×680 Navigator window. The 6 visible
+ packs fit without scrolling; expanding "Show more" can overflow, so
+ this stays a scroll container. The `-m-1 p-1` widens the overflow clip
+ box by the card focus-ring width, then pulls it back, so a focused
+ card's ring on the edge rows isn't shaved off. No `scroll-fade-mask`
+ here: its 1rem edge fade clipped that same ring. */}
+ <div className="-m-1 min-h-0 flex-1 overflow-y-auto subtle-scrollbar p-1">
+ <PackCardGrid
+ packs={packs}
+ onPackSelect={(packId) => onPackSelect(packId, packs ?? [])}
+ collapsedPackIds={['okf', 'entity-vault']}
+ />
+ </div>
+ <div
+ className="flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1"
+ data-testid="nav-first-run-secondary"
+ >
+ <span className="text-muted-foreground text-sm">
+ <Trans>Have something else in mind?</Trans>
+ </span>
+ <div className="flex flex-wrap items-center gap-x-1 gap-y-1">
+ <Button
+ type="button"
+ variant="link-muted"
+ size="sm"
+ onClick={onOpenFolder}
+ data-testid="nav-first-run-open"
+ >
+ <FolderOpenIcon aria-hidden="true" className="size-3.5" />
+ <Trans>Open folder</Trans>
+ </Button>
+ <Button
+ type="button"
+ variant="link-muted"
+ size="sm"
+ onClick={onClone}
+ data-testid="nav-first-run-clone"
+ >
+ <GithubIcon aria-hidden="true" className="size-3.5" />
+ <Trans>Clone from GitHub</Trans>
+ </Button>
+ <Button
+ type="button"
+ variant="link-muted"
+ size="sm"
+ onClick={onCreate}
+ data-testid="nav-first-run-blank"
+ >
+ <PlusIcon aria-hidden="true" className="size-3.5" />
+ <Trans>Blank project</Trans>
+ </Button>
+ </div>
+ </div>
+ </section>
+ );
+}
+
function RecentRow({
project,
branch,
diff --git a/packages/app/src/lib/desktop-bridge-types.ts b/packages/app/src/lib/desktop-bridge-types.ts
index 8e7bc509f..c14399037 100644
--- a/packages/app/src/lib/desktop-bridge-types.ts
+++ b/packages/app/src/lib/desktop-bridge-types.ts
@@ -895,6 +895,11 @@ export interface OkDesktopBridge {
editors: OkMcpWiringEditorId[];
/** OK config sharing mode — defaults to 'shared' when omitted. */
sharing?: 'shared' | 'local-only';
+ /**
+ * Starter pack to seed into the newly-created project (first-run
+ * packs-forward launcher). Omitted → blank project (today's behavior).
+ */
+ packId?: OkPackId;
}): Promise<void>;
/**
* Fire-and-forget renderer→main telemetry counter for the Create-new-project
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index fc32ca9f4..f6832a7fd 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -531,6 +531,13 @@
"CmeH9S": ["Add property to ", ["keyName"]],
"CvsD6Y": ["via ", ["viaTags"]],
"D12vtS": ["(detached)"],
+ "D2CwBE": [
+ "Create a new OpenKnowledge project from the <0>",
+ ["0"],
+ "</0> starter pack (",
+ ["1", "plural", { "one": ["#", " folder"], "other": ["#", " folders"] }],
+ " and starter templates) in the folder of your choice."
+ ],
"D4H2N6": ["Remove ", ["tag"]],
"D8OV7J": ["Only collaborators"],
"DDTdLl": ["Code block settings"],
@@ -1064,6 +1071,7 @@
"QfFBdJ": ["The template's filename (without `.md`)."],
"Qj4RL5": ["Completed:"],
"QlxHAH": ["Showing results for \"", ["semanticResultsLabel"], "\""],
+ "QnjpOq": ["What do you want to build?"],
"QqBQu1": ["Label <0>(visible link text)</0>"],
"Qvls7J": ["Eng specs"],
"Qw-7Ie": [
@@ -1119,6 +1127,7 @@
" has been moved, renamed, or deleted in your local copy, and that change hasn't synced yet."
],
"S33tz3": ["Not connected"],
+ "S34Vju": ["Have something else in mind?"],
"S6l5dv": ["Could not start creating a new item"],
"S9Vnum": ["Remove ", ["patternText"]],
"SCoBBH": ["Tag suggestions"],
@@ -1651,6 +1660,9 @@
" could not be opened — try navigating to it manually."
],
"gUlRQj": ["Orphans"],
+ "gYuDfu": [
+ "Pick a starter pack to scaffold your project with ready-made folders and templates."
+ ],
"gYz2ep": ["Expires in ", ["timeLabel"]],
"gbHcbI": ["Failed to delete property"],
"gfohmY": ["Connect tools"],
@@ -1763,6 +1775,7 @@
"iqIDv4": ["Sync status unavailable"],
"iqugog": ["Initialize failed: ", ["errorDetail"]],
"irFGwu": ["Template list"],
+ "ircigK": ["Blank project"],
"irrm_E": ["Remove selection"],
"isRobC": ["New"],
"iuTKci": ["No edits yet."],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 07ec484be..9db0768f9 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -982,6 +982,10 @@ msgstr "Bird wiki"
msgid "Blank note"
msgstr "Blank note"
+#: src/components/NavigatorApp.tsx
+msgid "Blank project"
+msgstr "Blank project"
+
#: src/editor/slash-command/component-items.tsx
msgid "Block math equation rendered with KaTeX from a LaTeX source string."
msgstr "Block math equation rendered with KaTeX from a LaTeX source string."
@@ -2030,6 +2034,12 @@ msgstr "Create a new branch, or check out an existing one, in its own window."
msgid "Create a new list item from the current list item."
msgstr "Create a new list item from the current list item."
+#. placeholder {0}: selectedPack.name
+#. placeholder {1}: selectedPack.entryCounts.folders
+#: src/components/CreateProjectDialog.tsx
+msgid "Create a new OpenKnowledge project from the <0>{0}</0> starter pack ({1, plural, one {# folder} other {# folders}} and starter templates) in the folder of your choice."
+msgstr "Create a new OpenKnowledge project from the <0>{0}</0> starter pack ({1, plural, one {# folder} other {# folders}} and starter templates) in the folder of your choice."
+
#: src/components/CreateProjectDialog.tsx
msgid "Create a new OpenKnowledge project in the folder of your choice."
msgstr "Create a new OpenKnowledge project in the folder of your choice."
@@ -3249,6 +3259,10 @@ msgstr "guides/install or https://example.com"
msgid "Hard break"
msgstr "Hard break"
+#: src/components/NavigatorApp.tsx
+msgid "Have something else in mind?"
+msgstr "Have something else in mind?"
+
#: src/editor/slash-command/items.tsx
msgid "Heading 1"
msgstr "Heading 1"
@@ -4708,6 +4722,7 @@ msgstr "Open emoji picker for {keyName}"
msgid "Open file"
msgstr "Open file"
+#: src/components/NavigatorApp.tsx
#: src/components/ProjectSwitcher.tsx
#: src/lib/keyboard-shortcuts.ts
msgid "Open folder"
@@ -5097,6 +5112,10 @@ msgstr "Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It en
msgid "Pick a name"
msgstr "Pick a name"
+#: src/components/NavigatorApp.tsx
+msgid "Pick a starter pack to scaffold your project with ready-made folders and templates."
+msgstr "Pick a starter pack to scaffold your project with ready-made folders and templates."
+
#: src/components/ShareReceiveDialog.tsx
msgid "Pick the folder where you've cloned it."
msgstr "Pick the folder where you've cloned it."
@@ -7480,6 +7499,10 @@ msgstr "What agents match on to decide when to use the skill."
msgid "What config sharing covers"
msgstr "What config sharing covers"
+#: src/components/NavigatorApp.tsx
+msgid "What do you want to build?"
+msgstr "What do you want to build?"
+
#: src/components/CreatedItemsList.tsx
msgid "What gets created"
msgstr "What gets created"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 7b3f05c2d..5530992b1 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -531,6 +531,13 @@
"CmeH9S": ["Àďď ƥŕōƥēŕţŷ ţō ", ["keyName"]],
"CvsD6Y": ["vĩà ", ["viaTags"]],
"D12vtS": ["(ďēţàćĥēď)"],
+ "D2CwBE": [
+ "Ćŕēàţē à ńēŵ ŌƥēńĶńōŵĺēďĝē ƥŕōĴēćţ ƒŕōḿ ţĥē <0>",
+ ["0"],
+ "</0> śţàŕţēŕ ƥàćķ (",
+ ["1", "plural", { "one": ["#", " ƒōĺďēŕ"], "other": ["#", " ƒōĺďēŕś"] }],
+ " àńď śţàŕţēŕ ţēḿƥĺàţēś) ĩń ţĥē ƒōĺďēŕ ōƒ ŷōũŕ ćĥōĩćē."
+ ],
"D4H2N6": ["Ŕēḿōvē ", ["tag"]],
"D8OV7J": ["Ōńĺŷ ćōĺĺàƀōŕàţōŕś"],
"DDTdLl": ["Ćōďē ƀĺōćķ śēţţĩńĝś"],
@@ -1064,6 +1071,7 @@
"QfFBdJ": ["Ţĥē ţēḿƥĺàţē'ś ƒĩĺēńàḿē (ŵĩţĥōũţ `.ḿď`)."],
"Qj4RL5": ["Ćōḿƥĺēţēď:"],
"QlxHAH": ["Śĥōŵĩńĝ ŕēśũĺţś ƒōŕ \"", ["semanticResultsLabel"], "\""],
+ "QnjpOq": ["Ŵĥàţ ďō ŷōũ ŵàńţ ţō ƀũĩĺď?"],
"QqBQu1": ["Ĺàƀēĺ <0>(vĩśĩƀĺē ĺĩńķ ţēxţ)</0>"],
"Qvls7J": ["Ēńĝ śƥēćś"],
"Qw-7Ie": [
@@ -1119,6 +1127,7 @@
" ĥàś ƀēēń ḿōvēď, ŕēńàḿēď, ōŕ ďēĺēţēď ĩń ŷōũŕ ĺōćàĺ ćōƥŷ, àńď ţĥàţ ćĥàńĝē ĥàśń'ţ śŷńćēď ŷēţ."
],
"S33tz3": ["Ńōţ ćōńńēćţēď"],
+ "S34Vju": ["Ĥàvē śōḿēţĥĩńĝ ēĺśē ĩń ḿĩńď?"],
"S6l5dv": ["Ćōũĺď ńōţ śţàŕţ ćŕēàţĩńĝ à ńēŵ ĩţēḿ"],
"S9Vnum": ["Ŕēḿōvē ", ["patternText"]],
"SCoBBH": ["Ţàĝ śũĝĝēśţĩōńś"],
@@ -1651,6 +1660,9 @@
" ćōũĺď ńōţ ƀē ōƥēńēď — ţŕŷ ńàvĩĝàţĩńĝ ţō ĩţ ḿàńũàĺĺŷ."
],
"gUlRQj": ["Ōŕƥĥàńś"],
+ "gYuDfu": [
+ "Ƥĩćķ à śţàŕţēŕ ƥàćķ ţō śćàƒƒōĺď ŷōũŕ ƥŕōĴēćţ ŵĩţĥ ŕēàďŷ-ḿàďē ƒōĺďēŕś àńď ţēḿƥĺàţēś."
+ ],
"gYz2ep": ["Ēxƥĩŕēś ĩń ", ["timeLabel"]],
"gbHcbI": ["Ƒàĩĺēď ţō ďēĺēţē ƥŕōƥēŕţŷ"],
"gfohmY": ["Ćōńńēćţ ţōōĺś"],
@@ -1763,6 +1775,7 @@
"iqIDv4": ["Śŷńć śţàţũś ũńàvàĩĺàƀĺē"],
"iqugog": ["Ĩńĩţĩàĺĩźē ƒàĩĺēď: ", ["errorDetail"]],
"irFGwu": ["Ţēḿƥĺàţē ĺĩśţ"],
+ "ircigK": ["ßĺàńķ ƥŕōĴēćţ"],
"irrm_E": ["Ŕēḿōvē śēĺēćţĩōń"],
"isRobC": ["Ńēŵ"],
"iuTKci": ["Ńō ēďĩţś ŷēţ."],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index 300a5aed8..40c0d2196 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -977,6 +977,10 @@ msgstr ""
msgid "Blank note"
msgstr ""
+#: src/components/NavigatorApp.tsx
+msgid "Blank project"
+msgstr ""
+
#: src/editor/slash-command/component-items.tsx
msgid "Block math equation rendered with KaTeX from a LaTeX source string."
msgstr ""
@@ -2025,6 +2029,12 @@ msgstr ""
msgid "Create a new list item from the current list item."
msgstr ""
+#. placeholder {0}: selectedPack.name
+#. placeholder {1}: selectedPack.entryCounts.folders
+#: src/components/CreateProjectDialog.tsx
+msgid "Create a new OpenKnowledge project from the <0>{0}</0> starter pack ({1, plural, one {# folder} other {# folders}} and starter templates) in the folder of your choice."
+msgstr ""
+
#: src/components/CreateProjectDialog.tsx
msgid "Create a new OpenKnowledge project in the folder of your choice."
msgstr ""
@@ -3244,6 +3254,10 @@ msgstr ""
msgid "Hard break"
msgstr ""
+#: src/components/NavigatorApp.tsx
+msgid "Have something else in mind?"
+msgstr ""
+
#: src/editor/slash-command/items.tsx
msgid "Heading 1"
msgstr ""
@@ -4703,6 +4717,7 @@ msgstr ""
msgid "Open file"
msgstr ""
+#: src/components/NavigatorApp.tsx
#: src/components/ProjectSwitcher.tsx
#: src/lib/keyboard-shortcuts.ts
msgid "Open folder"
@@ -5092,6 +5107,10 @@ msgstr ""
msgid "Pick a name"
msgstr ""
+#: src/components/NavigatorApp.tsx
+msgid "Pick a starter pack to scaffold your project with ready-made folders and templates."
+msgstr ""
+
#: src/components/ShareReceiveDialog.tsx
msgid "Pick the folder where you've cloned it."
msgstr ""
@@ -7475,6 +7494,10 @@ msgstr ""
msgid "What config sharing covers"
msgstr ""
+#: src/components/NavigatorApp.tsx
+msgid "What do you want to build?"
+msgstr ""
+
#: src/components/CreatedItemsList.tsx
msgid "What gets created"
msgstr ""
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/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 064fa0773..58a810193 100644
--- a/packages/core/src/markdown/index.ts
+++ b/packages/core/src/markdown/index.ts
@@ -1,4 +1,3 @@
-
import {
type FromProseMirrorOptions,
fromPmMark,
@@ -165,7 +164,6 @@ export class MarkdownManager {
}
}
-
const registry = createRegistry();
function destructureAttrs(
@@ -214,7 +212,6 @@ function destructureAttrs(
return result;
}
-
function hasDirtyDescendant(node: PmNode): boolean {
let found = false;
node.descendants((child) => {
@@ -233,7 +230,6 @@ function effectiveDirty(node: PmNode): boolean {
return node.attrs.sourceDirty || hasDirtyDescendant(node);
}
-
function isEmptyMdastParagraph(node: MdastNodes): boolean {
if (node.type !== 'paragraph') return false;
const children = node.children ?? [];
@@ -302,7 +298,6 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {
return out;
}
-
import {
AUDIO_EXTENSIONS,
FILE_ATTACHMENT_EXTENSIONS,
@@ -552,7 +547,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.emphasis) {
handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({
sourceDelimiter: node.data?.sourceDelimiter ?? '*',
@@ -632,7 +626,6 @@ function buildMdastToPmHandlers(
}));
}
-
if (m.link) {
const sourceLiteralMark = m.sourceLiteral;
handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {
@@ -911,7 +904,6 @@ function buildMdastToPmHandlers(
};
}
-
const blockUnknownHandler = (node: {
type: string;
position?: { start: { offset: number }; end: { offset: number } };
@@ -1037,7 +1029,6 @@ function buildMdastToPmHandlers(
return handlers as RemarkProseMirrorOptions['handlers'];
}
-
function buildPmToMdastHandlers(schema: Schema): {
nodeHandlers: FromProseMirrorOptions<string, string>['nodeHandlers'];
markHandlers: FromProseMirrorOptions<string, string>['markHandlers'];
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 153fdc1d8..79072375c 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 } from 'hast';
import type { Root as MdastRoot } from 'mdast';
import { normalizeUri } from 'micromark-util-sanitize-uri';
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) {
diff --git a/packages/desktop/src/main/create-new-project.test.ts b/packages/desktop/src/main/create-new-project.test.ts
index e4640e46d..da210dda8 100644
--- a/packages/desktop/src/main/create-new-project.test.ts
+++ b/packages/desktop/src/main/create-new-project.test.ts
@@ -585,3 +585,37 @@ describe('runCreateNew — installs the project-local skill (PRD-6733)', () => {
]);
});
});
+
+describe('runCreateNew — starter-pack seeding', () => {
+ // The seed step is the primary new user-facing behavior of the packs-forward
+ // launcher: a known `packId` scaffolds the pack's folders before the editor
+ // opens, an unknown id is silently coerced away (blank project), and a seed
+ // failure is best-effort (a valid project still lands). Type-checking alone
+ // doesn't cover the runtime `coercePackId` narrowing or the best-effort catch.
+ test('scaffolds the pack folders when a known packId is supplied', async () => {
+ const result = await runCreateNew({
+ parent: tmpRoot,
+ name: 'Seeded Project',
+ editors: [...ALL_EDITOR_IDS],
+ packId: 'plain-notes',
+ });
+ // `plain-notes` declares `notes/` + `daily/`; the seed step creates them on
+ // disk. A blank create leaves neither.
+ expect(existsSync(join(result.projectDir, 'notes'))).toBe(true);
+ expect(existsSync(join(result.projectDir, 'daily'))).toBe(true);
+ });
+
+ test('creates a blank project when packId is unrecognised', async () => {
+ const result = await runCreateNew({
+ parent: tmpRoot,
+ name: 'Blank From Unknown Pack',
+ editors: [...ALL_EDITOR_IDS],
+ packId: 'not-a-real-pack-id',
+ });
+ // `coercePackId` narrows the unknown id to `undefined`, so seeding is
+ // skipped — the project is valid but carries no pack scaffold.
+ expect(existsSync(join(result.projectDir, '.ok/config.yml'))).toBe(true);
+ expect(existsSync(join(result.projectDir, 'notes'))).toBe(false);
+ expect(existsSync(join(result.projectDir, 'daily'))).toBe(false);
+ });
+});
diff --git a/packages/desktop/src/main/create-new-project.ts b/packages/desktop/src/main/create-new-project.ts
index 2f9296b14..40c270c6a 100644
--- a/packages/desktop/src/main/create-new-project.ts
+++ b/packages/desktop/src/main/create-new-project.ts
@@ -27,10 +27,14 @@ import {
sanitizeFolderName,
} from '@inkeep/open-knowledge-core';
import {
+ applySeed,
+ coercePackId,
type EnsureProjectGitResult,
ensureProjectGit,
findEnclosingProjectRoot,
initContent,
+ planSeed,
+ resolvePack,
tracedMkdirSync,
writeRootGitignoreForNewRepo,
} from '@inkeep/open-knowledge-server';
@@ -177,6 +181,14 @@ interface CreateNewProjectArgs {
* Pick-Existing consent dialog share one sharing-transition site.
*/
readonly sharing?: 'shared' | 'local-only';
+ /**
+ * Starter pack to seed into the fresh project (first-run packs-forward
+ * launcher). When set, `runCreateNew` plans + applies the pack's scaffold
+ * BEFORE returning so the editor opens populated with no empty-editor
+ * flash. Omitted → blank project (today's behavior). Coerced through
+ * `coercePackId` at the trust boundary; an unknown id skips seeding.
+ */
+ readonly packId?: string;
}
/**
@@ -438,6 +450,48 @@ export async function runCreateNew(
const sharingOutcome: CreateNewSharingOutcome =
desiredSharing === 'local-only' ? applyCreateNewLocalOnly(projectDir) : { kind: 'shared' };
+ // 10. Seed the selected starter pack. Only fires when the packs-forward
+ // first-run launcher threaded a `packId`; the blank create path leaves
+ // it undefined and the project opens empty as before. Runs BEFORE the
+ // caller opens the editor window so it lands populated with no
+ // empty-editor flash. Seeds at the pack's `defaultSubfolder` (project
+ // root when the pack declares none) — parity with `SeedDialog`'s
+ // project-root default + pre-filled subfolder. `initContent` (step 7)
+ // already wrote `.ok/config.yml`, so `planSeed`'s project-root
+ // prerequisite holds. Best-effort: a seed failure leaves a valid (if
+ // empty) project rather than failing the whole create — the folder is
+ // already on disk and the user just picked a name/location.
+ const seedPackId = coercePackId(args.packId);
+ if (seedPackId !== undefined) {
+ try {
+ const pack = resolvePack(seedPackId);
+ const plan = await planSeed({
+ projectDir,
+ rootDir: pack.defaultSubfolder,
+ packId: seedPackId,
+ });
+ const seedResult = await applySeed(plan, { projectDir, packId: seedPackId });
+ // `applySeed` is best-effort: per-file write failures land in
+ // `errors[]` rather than throwing, so a partial seed would otherwise
+ // leave the user in a partially-populated project with no breadcrumb.
+ if (seedResult.errors.length > 0) {
+ console.warn(
+ `[create-new-project] starter-pack seed partial failure at ${projectDir} (pack ${seedPackId}):`,
+ seedResult.errors,
+ );
+ }
+ } catch (err) {
+ // Pass `err` as a structured second arg (not the interpolated message) so
+ // the stack survives — parity with the partial-failure branch above; a
+ // "first project was empty" report needs the call depth to tell whether
+ // the throw came from resolvePack, planSeed, or applySeed.
+ console.warn(
+ `[create-new-project] starter-pack seed failed at ${projectDir} (pack ${seedPackId}):`,
+ err,
+ );
+ }
+ }
+
const variant: CreateNewProjectSuccess['variant'] =
editors.length === ALL_EDITOR_IDS.length ? 'create-new-default' : 'create-new-customized';
diff --git a/packages/desktop/src/main/index.ts b/packages/desktop/src/main/index.ts
index 38285e3fb..7d73b5b89 100644
--- a/packages/desktop/src/main/index.ts
+++ b/packages/desktop/src/main/index.ts
@@ -1265,16 +1265,17 @@ function openNavigator(pendingPayload?: ShareNavigatorPayload) {
return;
}
getLogger('navigator').info({}, 'opening window');
- // Fixed-size launcher window at the 840×600 (1.4 ratio) target.
- // NavigatorApp.tsx vertically centers the visible content (icon, title,
- // 3 action cards, recents) within this frame and leaves the top ~36 px
- // chrome strip as the drag region for the macOS title-bar zone.
+ // Fixed-size launcher window at the 920×680 target. Sized so the first-run
+ // packs-forward view (header + full starter-pack grid + secondary row) fits
+ // without the grid scrolling. NavigatorApp.tsx vertically centers the visible
+ // content within this frame and leaves the top ~36 px chrome strip as the
+ // drag region for the macOS title-bar zone.
navigatorWindow = createNavigatorWindow({
createWindow: (opts) => {
const win = new BrowserWindow({
...DEFAULT_WIN_OPTS,
- width: 840,
- height: 600,
+ width: 920,
+ height: 680,
webPreferences: {
...DEFAULT_WIN_OPTS.webPreferences,
additionalArguments: withDebugFlagIfAllowed(opts.additionalArguments),
@@ -3644,6 +3645,7 @@ function registerIpcHandlers() {
name: args.name,
editors: args.editors,
sharing: args.sharing,
+ packId: args.packId,
});
} catch (err) {
if (err instanceof CreateNewProjectError) {
diff --git a/packages/desktop/src/main/window-min-size.test.ts b/packages/desktop/src/main/window-min-size.test.ts
index 9617d0b62..07a3b4b6d 100644
--- a/packages/desktop/src/main/window-min-size.test.ts
+++ b/packages/desktop/src/main/window-min-size.test.ts
@@ -44,9 +44,9 @@ describe('WINDOW_MIN_SIZE constants', () => {
expect(WINDOW_MIN_SIZE.EDITOR.height).toBeLessThan(800);
});
- test('min sizes leave headroom under initial Navigator size (840 x 600)', () => {
- expect(WINDOW_MIN_SIZE.NAVIGATOR.width).toBeLessThan(840);
- expect(WINDOW_MIN_SIZE.NAVIGATOR.height).toBeLessThan(600);
+ test('min sizes leave headroom under initial Navigator size (920 x 680)', () => {
+ expect(WINDOW_MIN_SIZE.NAVIGATOR.width).toBeLessThan(920);
+ expect(WINDOW_MIN_SIZE.NAVIGATOR.height).toBeLessThan(680);
});
});
diff --git a/packages/desktop/src/shared/bridge-contract.ts b/packages/desktop/src/shared/bridge-contract.ts
index ae2ed3c4d..29d84b4ac 100644
--- a/packages/desktop/src/shared/bridge-contract.ts
+++ b/packages/desktop/src/shared/bridge-contract.ts
@@ -1206,6 +1206,11 @@ export interface OkDesktopBridge {
editors: OkMcpWiringEditorId[];
/** OK config sharing mode — defaults to 'shared' when omitted. */
sharing?: 'shared' | 'local-only';
+ /**
+ * Starter pack to seed into the newly-created project (first-run
+ * packs-forward launcher). Omitted → blank project (today's behavior).
+ */
+ packId?: PackId;
}): Promise<void>;
/**
* Fire-and-forget renderer→main telemetry signal for the Create-new-project
diff --git a/packages/desktop/src/shared/ipc-channels.ts b/packages/desktop/src/shared/ipc-channels.ts
index b11b323ed..a4c29f1ba 100644
--- a/packages/desktop/src/shared/ipc-channels.ts
+++ b/packages/desktop/src/shared/ipc-channels.ts
@@ -56,6 +56,7 @@ import type {
import type {
FindEnclosingGitRootResult,
FindEnclosingProjectRootResult,
+ PackId,
ScaffoldPlan,
} from '@inkeep/open-knowledge-server';
import type { BuildAndOpenResult } from '../main/ipc/install-skill.ts';
@@ -808,6 +809,11 @@ export interface RequestChannels {
editors: readonly McpWiringEditorId[];
/** Defaults to 'shared' when omitted. */
sharing?: 'shared' | 'local-only';
+ /**
+ * Starter pack to seed into the newly-created project (first-run
+ * packs-forward launcher). Omitted → blank project (today's behavior).
+ */
+ packId?: PackId;
},
];
result: undefined;