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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ Thumbs.db

# Local agent state and worktrees
.claude/
.vitest/
2 changes: 0 additions & 2 deletions benchmarks/analyze.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ describe("askr analyze", () => {
test("50-file workspace", async ({ bench }) => {
await bench("50-file workspace", () => analyzeFixture(mediumWorkspace, 50)).run(benchOptions);
});

test("250-file workspace", async ({ bench }) => {
await bench("250-file workspace", () => analyzeFixture(largeWorkspace, 250)).run(benchOptions);
});

test("5-workspace monorepo with 250 files", async ({ bench }) => {
await bench("5-workspace monorepo with 250 files", () => analyzeFixture(monorepo, 250)).run(
benchOptions,
Expand Down
975 changes: 452 additions & 523 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 6 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@
"@types/node": "^26.6.6",
"@types/semver": "^7.8.0",
"@typescript/native": "npm:typescript@^7.0.2",
"@vitest/coverage-v8": "5.1.0",
"publint": "^0.3.25",
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
"vite-plus": "1.7.0",
"vitest": "5.1.0"
"@vitest/coverage-v8": "5.0.5",
"publint": "^0.3.24",
"vite-plus": "1.3.0",
"vitest": "5.0.5"
},
"peerDependencies": {
"@askrjs/askr": ">=0.5.0 <0.6.0"
Expand All @@ -101,12 +100,8 @@
}
},
"overrides": {
"@npmcli/map-workspaces": {
"minimatch": "^11.0.9"
},
"glob": "14.0.6",
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
"vitest": "5.1.0"
"vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
"vitest": "5.0.5"
},
"engines": {
"node": ">=24.0.0"
Expand Down
33 changes: 21 additions & 12 deletions src/generate/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export async function planProviderAuth(
await replace("src/components/app-header.tsx", (content) =>
content
.replace(
"import { signOut } from '../lib/mock-data';",
/import \{ signOut \} from ["']\.\.\/lib\/mock-data["'];/,
'import { sessionAuth } from "../auth/client";',
)
.replace("onSelect={() => {", "onSelect={async () => {")
Expand All @@ -353,9 +353,9 @@ export async function planProviderAuth(
);
await replace("src/lib/mock-data.ts", (content) =>
content
.replace("const sessionStorageKey = 'startkit:session';\n", "")
.replace("let sessionEmail: string | null = null;\n", "")
.replace(" sessionEmail = readStorage(sessionStorageKey) ?? sessionEmail;\n", "")
.replace(/const sessionStorageKey = ["']startkit:session["'];\n/, "")
.replace(/let sessionEmail: string \| null = null;\n/, "")
.replace(/\s+sessionEmail = readStorage\(sessionStorageKey\) \?\? sessionEmail;\n/, "")
.replace(
/export function isAuthenticated\(\): boolean \{[\s\S]*?(?=export async function getDashboardData)/,
"",
Expand Down Expand Up @@ -474,14 +474,23 @@ export async function planProviderAuth(
),
);
await replace("src/main.tsx", (content) =>
content
.replace("import { createSPA }", "import { createSPA, hydrateSPA }")
.replace(
template === "spa"
? "await createSPA({\n root: document.getElementById('app')!,\n registry: pageRegistry,\n});"
: "await createSPA({ root, registry: pageRegistry });",
`${template === "spa" ? "const root = document.getElementById('app');\nif (!root) throw new Error('Missing #app root element.');\n\n" : ""}if (root.hasChildNodes()) {\n await hydrateSPA({ root, registry: pageRegistry });\n} else {\n await createSPA({ root, registry: pageRegistry });\n}`,
),
(() => {
const withHydrationImport = content.replace(
"import { createSPA }",
"import { createSPA, hydrateSPA }",
);
const hydration =
"if (root.hasChildNodes()) {\n await hydrateSPA({ root, registry: pageRegistry });\n} else {\n await createSPA({ root, registry: pageRegistry });\n}";
return template === "spa"
? withHydrationImport.replace(
/await createSPA\(\{\s*root: document\.getElementById\(["']app["']\)!?,\s*registry: pageRegistry,?\s*\}\);/,
`const root = document.getElementById("app");\nif (!root) throw new Error("Missing #app root element.");\n\n${hydration}`,
)
: withHydrationImport.replace(
"await createSPA({ root, registry: pageRegistry });",
hydration,
);
})(),
);
await replace("index.html", (content) =>
content
Expand Down
18 changes: 9 additions & 9 deletions templates/spa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ code lives in `src/adapters`.

```tsx
// src/pages/_routes.tsx
import { createRouteRegistry, fallback, group } from '@askrjs/askr/router';
import RootLayout from './_layout';
import NotFoundPage from './not-found';
import AuthLayout from './auth/_layout';
import { registerAuthRoutes } from './auth/_routes';
import AppLayout from './app/_layout';
import { registerAppRoutes } from './app/_routes';
import PublicLayout from './public/_layout';
import { registerPublicRoutes } from './public/_routes';
import { createRouteRegistry, fallback, group } from "@askrjs/askr/router";
import RootLayout from "./_layout";
import NotFoundPage from "./not-found";
import AuthLayout from "./auth/_layout";
import { registerAuthRoutes } from "./auth/_routes";
import AppLayout from "./app/_layout";
import { registerAppRoutes } from "./app/_routes";
import PublicLayout from "./public/_layout";
import { registerPublicRoutes } from "./public/_routes";

export const pageRegistry = createRouteRegistry(() => {
group({ layout: RootLayout }, () => {
Expand Down
70 changes: 35 additions & 35 deletions templates/spa/src/adapters/operations-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RunStatus } from '../components/shared/status-badge';
import type { RunStatus } from "../components/shared/status-badge";

export type OperationRun = {
id: string;
Expand All @@ -15,7 +15,7 @@ export type OperationsChartRow = {

export type OperationsSnapshot = {
version: number;
consistency: 'fresh' | 'pending-write' | 'stale';
consistency: "fresh" | "pending-write" | "stale";
lastEventId: string;
metrics: Array<{ label: string; value: string; trend: string }>;
throughput: OperationsChartRow[];
Expand All @@ -32,48 +32,48 @@ export async function getOperationsSnapshot({

return {
version: 42,
consistency: 'fresh',
lastEventId: 'evt_18442',
consistency: "fresh",
lastEventId: "evt_18442",
metrics: [
{ label: 'Active runs', value: '12', trend: '+3 today' },
{ label: 'Pending approvals', value: '3', trend: '2 urgent' },
{ label: 'Projection lag', value: '1.2s', trend: 'healthy' },
{ label: "Active runs", value: "12", trend: "+3 today" },
{ label: "Pending approvals", value: "3", trend: "2 urgent" },
{ label: "Projection lag", value: "1.2s", trend: "healthy" },
],
throughput: [
{ label: 'Research', value: 18 },
{ label: 'Review', value: 11 },
{ label: 'Deploy', value: 7 },
{ label: 'Audit', value: 9 },
{ label: "Research", value: 18 },
{ label: "Review", value: 11 },
{ label: "Deploy", value: 7 },
{ label: "Audit", value: 9 },
],
lag: [
{ label: '10:00', value: 4 },
{ label: '10:10', value: 3 },
{ label: '10:20', value: 2 },
{ label: '10:30', value: 1 },
{ label: '10:40', value: 2 },
{ label: '10:50', value: 1 },
{ label: "10:00", value: 4 },
{ label: "10:10", value: 3 },
{ label: "10:20", value: 2 },
{ label: "10:30", value: 1 },
{ label: "10:40", value: 2 },
{ label: "10:50", value: 1 },
],
runs: [
{
id: 'run_4812',
title: 'Summarize renewal risk',
status: 'running',
owner: 'Revenue ops',
updatedAt: '2026-05-22T09:52:00.000Z',
id: "run_4812",
title: "Summarize renewal risk",
status: "running",
owner: "Revenue ops",
updatedAt: "2026-05-22T09:52:00.000Z",
},
{
id: 'run_4811',
title: 'Approve workspace migration',
status: 'requires-action',
owner: 'Platform',
updatedAt: '2026-05-22T09:40:00.000Z',
id: "run_4811",
title: "Approve workspace migration",
status: "requires-action",
owner: "Platform",
updatedAt: "2026-05-22T09:40:00.000Z",
},
{
id: 'run_4810',
title: 'Reconcile audit events',
status: 'succeeded',
owner: 'Security',
updatedAt: '2026-05-22T09:25:00.000Z',
id: "run_4810",
title: "Reconcile audit events",
status: "succeeded",
owner: "Security",
updatedAt: "2026-05-22T09:25:00.000Z",
},
],
};
Expand All @@ -84,12 +84,12 @@ function delay(ms: number, signal: AbortSignal): Promise<void> {
const timeout = globalThis.setTimeout(resolve, ms);

signal.addEventListener(
'abort',
"abort",
() => {
globalThis.clearTimeout(timeout);
reject(new DOMException('Operation aborted', 'AbortError'));
reject(new DOMException("Operation aborted", "AbortError"));
},
{ once: true }
{ once: true },
);
});
}
8 changes: 1 addition & 7 deletions templates/spa/src/components/shared/metric-card.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
Block,
Card,
CardDescription,
CardHeader,
CardTitle,
} from '@askrjs/themes/components';
import { Block, Card, CardDescription, CardHeader, CardTitle } from "@askrjs/themes/components";

export type MetricCardProps = {
label: string;
Expand Down
19 changes: 7 additions & 12 deletions templates/spa/src/components/shared/status-badge.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import { Badge } from '@askrjs/themes/components';
import { Badge } from "@askrjs/themes/components";

export type RunStatus =
| 'queued'
| 'running'
| 'requires-action'
| 'succeeded'
| 'failed';
export type RunStatus = "queued" | "running" | "requires-action" | "succeeded" | "failed";

export type StatusBadgeProps = {
status: RunStatus;
};

const labels: Record<RunStatus, string> = {
queued: 'queued',
running: 'running',
'requires-action': 'needs review',
succeeded: 'succeeded',
failed: 'failed',
queued: "queued",
running: "running",
"requires-action": "needs review",
succeeded: "succeeded",
failed: "failed",
};

export default function StatusBadge({ status }: StatusBadgeProps) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getOperationsSnapshot } from '../../adapters/operations-client';
import { getOperationsSnapshot } from "../../adapters/operations-client";

export function loadOperations({
signal = new AbortController().signal,
Expand Down
8 changes: 4 additions & 4 deletions templates/spa/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createSPA } from '@askrjs/askr/boot';
import { createSPA } from "@askrjs/askr/boot";

import './styles.css';
import { pageRegistry } from './pages/_routes';
import "./styles.css";
import { pageRegistry } from "./pages/_routes";

await createSPA({
root: document.getElementById('app')!,
root: document.getElementById("app")!,
registry: pageRegistry,
});
2 changes: 1 addition & 1 deletion templates/spa/src/pages/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ThemeScope } from '@askrjs/themes/theme';
import { ThemeScope } from "@askrjs/themes/theme";

export default function RootLayout({ children }: { children?: unknown }) {
return (
Expand Down
18 changes: 9 additions & 9 deletions templates/spa/src/pages/_routes.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createRouteRegistry, fallback, group } from '@askrjs/askr/router';
import RootLayout from './_layout';
import AuthLayout from './auth/_layout';
import { registerAuthRoutes } from './auth/_routes';
import { registerAppRoutes } from './app/_routes';
import AppLayout from './app/_layout';
import NotFoundPage from './not-found';
import { registerPublicRoutes } from './public/_routes';
import PublicLayout from './public/_layout';
import { createRouteRegistry, fallback, group } from "@askrjs/askr/router";
import RootLayout from "./_layout";
import AuthLayout from "./auth/_layout";
import { registerAuthRoutes } from "./auth/_routes";
import { registerAppRoutes } from "./app/_routes";
import AppLayout from "./app/_layout";
import NotFoundPage from "./not-found";
import { registerPublicRoutes } from "./public/_routes";
import PublicLayout from "./public/_layout";

export const pageRegistry = createRouteRegistry(() => {
group({ layout: RootLayout }, () => {
Expand Down
Loading
Loading