@specdest/devkit 0.4.18 → 0.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -28
- package/dist/npm/cli.js +16 -24
- package/dist/npm/index.js +5 -1
- package/dist/npm/native/specdest-darwin-arm64 +0 -0
- package/dist/npm/native/specdest-darwin-x64 +0 -0
- package/dist/npm/native/specdest-linux-arm64 +0 -0
- package/dist/npm/native/specdest-linux-x64 +0 -0
- package/package.json +8 -5
- package/dist/npm/automation-policy.d.ts +0 -2
- package/dist/npm/automation-policy.js +0 -30
- package/dist/npm/canonical-project-operations.d.ts +0 -5
- package/dist/npm/canonical-project-operations.js +0 -5
- package/dist/npm/canonical-project.d.ts +0 -21
- package/dist/npm/canonical-project.js +0 -115
- package/dist/npm/catalog-snapshot.d.ts +0 -53
- package/dist/npm/catalog-snapshot.js +0 -35
- package/dist/npm/client-only-boundary.d.ts +0 -1
- package/dist/npm/client-only-boundary.js +0 -29
- package/dist/npm/commands.d.ts +0 -15
- package/dist/npm/commands.js +0 -188
- package/dist/npm/git-catalog.d.ts +0 -40
- package/dist/npm/git-catalog.js +0 -222
- package/dist/npm/host-automation.d.ts +0 -9
- package/dist/npm/host-automation.js +0 -66
- package/dist/npm/installer-primitives.d.ts +0 -3
- package/dist/npm/installer-primitives.js +0 -50
- package/dist/npm/predefined-packages/abac.d.ts +0 -2
- package/dist/npm/predefined-packages/abac.js +0 -22
- package/dist/npm/predefined-packages/admin-ui-templates/AdminConfirmDialog.tsx.template +0 -46
- package/dist/npm/predefined-packages/admin-ui-templates/AdminDataTable.tsx.template +0 -49
- package/dist/npm/predefined-packages/admin-ui-templates/AdminDetailLayout.tsx.template +0 -15
- package/dist/npm/predefined-packages/admin-ui-templates/AdminEmptyState.tsx.template +0 -17
- package/dist/npm/predefined-packages/admin-ui-templates/AdminFilterBar.tsx.template +0 -16
- package/dist/npm/predefined-packages/admin-ui-templates/AdminFormLayout.tsx.template +0 -19
- package/dist/npm/predefined-packages/admin-ui-templates/AdminPage.tsx.template +0 -19
- package/dist/npm/predefined-packages/admin-ui-templates/AdminPageHeader.tsx.template +0 -19
- package/dist/npm/predefined-packages/admin-ui-templates/AdminPagination.tsx.template +0 -20
- package/dist/npm/predefined-packages/admin-ui-templates/AdminShell.tsx.template +0 -20
- package/dist/npm/predefined-packages/admin-ui-templates/AdminSidebar.tsx.template +0 -18
- package/dist/npm/predefined-packages/admin-ui-templates/AdminStatCard.tsx.template +0 -22
- package/dist/npm/predefined-packages/admin-ui.d.ts +0 -2
- package/dist/npm/predefined-packages/admin-ui.js +0 -79
- package/dist/npm/predefined-packages/auth.d.ts +0 -2
- package/dist/npm/predefined-packages/auth.js +0 -21
- package/dist/npm/predefined-packages/convex.d.ts +0 -2
- package/dist/npm/predefined-packages/convex.js +0 -53
- package/dist/npm/predefined-packages/expo.d.ts +0 -2
- package/dist/npm/predefined-packages/expo.js +0 -88
- package/dist/npm/predefined-packages/firebase-hosting.d.ts +0 -2
- package/dist/npm/predefined-packages/firebase-hosting.js +0 -24
- package/dist/npm/predefined-packages/health.d.ts +0 -10
- package/dist/npm/predefined-packages/health.js +0 -52
- package/dist/npm/predefined-packages/husky.d.ts +0 -2
- package/dist/npm/predefined-packages/husky.js +0 -57
- package/dist/npm/predefined-packages/index.d.ts +0 -12
- package/dist/npm/predefined-packages/index.js +0 -97
- package/dist/npm/predefined-packages/install.d.ts +0 -19
- package/dist/npm/predefined-packages/install.js +0 -86
- package/dist/npm/predefined-packages/local-logging.d.ts +0 -2
- package/dist/npm/predefined-packages/local-logging.js +0 -17
- package/dist/npm/predefined-packages/logging.d.ts +0 -2
- package/dist/npm/predefined-packages/logging.js +0 -21
- package/dist/npm/predefined-packages/multi-tenancy.d.ts +0 -2
- package/dist/npm/predefined-packages/multi-tenancy.js +0 -21
- package/dist/npm/predefined-packages/nps.d.ts +0 -2
- package/dist/npm/predefined-packages/nps.js +0 -32
- package/dist/npm/predefined-packages/oxfmt.d.ts +0 -2
- package/dist/npm/predefined-packages/oxfmt.js +0 -22
- package/dist/npm/predefined-packages/oxlint.d.ts +0 -2
- package/dist/npm/predefined-packages/oxlint.js +0 -35
- package/dist/npm/predefined-packages/package-json.d.ts +0 -3
- package/dist/npm/predefined-packages/package-json.js +0 -61
- package/dist/npm/predefined-packages/payments.d.ts +0 -2
- package/dist/npm/predefined-packages/payments.js +0 -31
- package/dist/npm/predefined-packages/playwright.d.ts +0 -2
- package/dist/npm/predefined-packages/playwright.js +0 -35
- package/dist/npm/predefined-packages/project-signals.d.ts +0 -4
- package/dist/npm/predefined-packages/project-signals.js +0 -39
- package/dist/npm/predefined-packages/registry.d.ts +0 -3
- package/dist/npm/predefined-packages/registry.js +0 -65
- package/dist/npm/predefined-packages/resolver.d.ts +0 -8
- package/dist/npm/predefined-packages/resolver.js +0 -35
- package/dist/npm/predefined-packages/sentry.d.ts +0 -2
- package/dist/npm/predefined-packages/sentry.js +0 -29
- package/dist/npm/predefined-packages/shadcn.d.ts +0 -2
- package/dist/npm/predefined-packages/shadcn.js +0 -23
- package/dist/npm/predefined-packages/storybook.d.ts +0 -2
- package/dist/npm/predefined-packages/storybook.js +0 -25
- package/dist/npm/predefined-packages/stryker.d.ts +0 -2
- package/dist/npm/predefined-packages/stryker.js +0 -48
- package/dist/npm/predefined-packages/supabase.d.ts +0 -2
- package/dist/npm/predefined-packages/supabase.js +0 -355
- package/dist/npm/predefined-packages/tailwind.d.ts +0 -2
- package/dist/npm/predefined-packages/tailwind.js +0 -18
- package/dist/npm/predefined-packages/tanstack-form.d.ts +0 -2
- package/dist/npm/predefined-packages/tanstack-form.js +0 -19
- package/dist/npm/predefined-packages/tanstack-query.d.ts +0 -2
- package/dist/npm/predefined-packages/tanstack-query.js +0 -15
- package/dist/npm/predefined-packages/tanstack-router.d.ts +0 -2
- package/dist/npm/predefined-packages/tanstack-router.js +0 -18
- package/dist/npm/predefined-packages/types.d.ts +0 -38
- package/dist/npm/predefined-packages/types.js +0 -1
- package/dist/npm/predefined-packages/vite.d.ts +0 -2
- package/dist/npm/predefined-packages/vite.js +0 -127
- package/dist/npm/predefined-packages/vitest.d.ts +0 -2
- package/dist/npm/predefined-packages/vitest.js +0 -20
- package/dist/npm/predefined-packages/zod.d.ts +0 -2
- package/dist/npm/predefined-packages/zod.js +0 -18
- package/dist/npm/project-check.d.ts +0 -25
- package/dist/npm/project-check.js +0 -178
- package/dist/npm/project-context.d.ts +0 -52
- package/dist/npm/project-context.js +0 -211
- package/dist/npm/project-install-guard.d.ts +0 -2
- package/dist/npm/project-install-guard.js +0 -51
- package/dist/npm/project-rules.d.ts +0 -25
- package/dist/npm/project-rules.js +0 -106
- package/dist/npm/project-runtime.d.ts +0 -21
- package/dist/npm/project-runtime.js +0 -41
- package/dist/npm/project-status.d.ts +0 -32
- package/dist/npm/project-status.js +0 -70
- package/dist/npm/project-sync.d.ts +0 -7
- package/dist/npm/project-sync.js +0 -143
- package/dist/npm/remote-installer.d.ts +0 -35
- package/dist/npm/remote-installer.js +0 -351
- package/dist/npm/rule-id-migrations.d.ts +0 -6
- package/dist/npm/rule-id-migrations.js +0 -19
- package/dist/npm/slack.d.ts +0 -16
- package/dist/npm/slack.js +0 -135
- package/dist/npm/snapshot/config.d.ts +0 -10
- package/dist/npm/snapshot/config.js +0 -24
- package/dist/npm/snapshot/policy.d.ts +0 -1
- package/dist/npm/snapshot/policy.js +0 -64
- package/dist/npm/snapshot/restore.d.ts +0 -10
- package/dist/npm/snapshot/restore.js +0 -19
- package/dist/npm/snapshot/sql.d.ts +0 -2
- package/dist/npm/snapshot/sql.js +0 -113
- package/dist/npm/snapshot/storage.d.ts +0 -8
- package/dist/npm/snapshot/storage.js +0 -70
- package/dist/npm/snapshot/verify.d.ts +0 -11
- package/dist/npm/snapshot/verify.js +0 -13
- package/dist/npm/snapshot-cli.d.ts +0 -6
- package/dist/npm/snapshot-cli.js +0 -45
- package/dist/npm/state.d.ts +0 -14
- package/dist/npm/state.js +0 -269
- package/dist/npm/supabase-local.d.ts +0 -2
- package/dist/npm/supabase-local.js +0 -62
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
|
3
|
-
|
|
4
|
-
export type AdminColumn<T> = {
|
|
5
|
-
id: string;
|
|
6
|
-
header: ReactNode;
|
|
7
|
-
cell: (row: T) => ReactNode;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
type AdminDataTableProps<T> = {
|
|
11
|
-
columns: readonly AdminColumn<T>[];
|
|
12
|
-
rows: readonly T[];
|
|
13
|
-
getRowId: (row: T) => string;
|
|
14
|
-
empty?: ReactNode;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export function AdminDataTable<T>({
|
|
18
|
-
columns,
|
|
19
|
-
rows,
|
|
20
|
-
getRowId,
|
|
21
|
-
empty = 'No results',
|
|
22
|
-
}: AdminDataTableProps<T>) {
|
|
23
|
-
return (
|
|
24
|
-
<div className="w-full min-w-0 overflow-x-auto rounded-lg border">
|
|
25
|
-
<Table>
|
|
26
|
-
<TableHeader>
|
|
27
|
-
<TableRow>
|
|
28
|
-
{columns.map((column) => <TableHead key={column.id}>{column.header}</TableHead>)}
|
|
29
|
-
</TableRow>
|
|
30
|
-
</TableHeader>
|
|
31
|
-
<TableBody>
|
|
32
|
-
{rows.length === 0 ? (
|
|
33
|
-
<TableRow>
|
|
34
|
-
<TableCell colSpan={columns.length} className="h-24 text-center text-muted-foreground">
|
|
35
|
-
{empty}
|
|
36
|
-
</TableCell>
|
|
37
|
-
</TableRow>
|
|
38
|
-
) : (
|
|
39
|
-
rows.map((row) => (
|
|
40
|
-
<TableRow key={getRowId(row)}>
|
|
41
|
-
{columns.map((column) => <TableCell key={column.id}>{column.cell(row)}</TableCell>)}
|
|
42
|
-
</TableRow>
|
|
43
|
-
))
|
|
44
|
-
)}
|
|
45
|
-
</TableBody>
|
|
46
|
-
</Table>
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type AdminDetailLayoutProps = {
|
|
4
|
-
main: ReactNode;
|
|
5
|
-
aside?: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function AdminDetailLayout({ main, aside }: AdminDetailLayoutProps) {
|
|
9
|
-
return (
|
|
10
|
-
<div className={aside ? 'grid min-w-0 gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]' : 'min-w-0'}>
|
|
11
|
-
<div className="min-w-0 space-y-6">{main}</div>
|
|
12
|
-
{aside ? <aside className="min-w-0 space-y-6">{aside}</aside> : null}
|
|
13
|
-
</div>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type AdminEmptyStateProps = {
|
|
4
|
-
title: ReactNode;
|
|
5
|
-
description?: ReactNode;
|
|
6
|
-
action?: ReactNode;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function AdminEmptyState({ title, description, action }: AdminEmptyStateProps) {
|
|
10
|
-
return (
|
|
11
|
-
<div className="flex min-h-40 flex-col items-center justify-center gap-3 rounded-lg border p-6 text-center">
|
|
12
|
-
<p className="font-medium">{title}</p>
|
|
13
|
-
{description ? <p className="text-sm text-muted-foreground">{description}</p> : null}
|
|
14
|
-
{action}
|
|
15
|
-
</div>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type AdminFilterBarProps = {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
actions?: ReactNode;
|
|
6
|
-
label?: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function AdminFilterBar({ children, actions, label = 'Filters' }: AdminFilterBarProps) {
|
|
10
|
-
return (
|
|
11
|
-
<section aria-label={label} className="flex flex-wrap items-end gap-3 rounded-lg border bg-card p-4">
|
|
12
|
-
<div className="flex min-w-0 flex-1 flex-wrap items-end gap-3">{children}</div>
|
|
13
|
-
{actions ? <div className="flex shrink-0 items-end gap-2">{actions}</div> : null}
|
|
14
|
-
</section>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type AdminFormLayoutProps = {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
aside?: ReactNode;
|
|
6
|
-
actions?: ReactNode;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function AdminFormLayout({ children, aside, actions }: AdminFormLayoutProps) {
|
|
10
|
-
return (
|
|
11
|
-
<div className="space-y-6">
|
|
12
|
-
<div className={aside ? 'grid min-w-0 gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]' : 'min-w-0'}>
|
|
13
|
-
<div className="min-w-0 space-y-6">{children}</div>
|
|
14
|
-
{aside ? <aside className="min-w-0 space-y-6">{aside}</aside> : null}
|
|
15
|
-
</div>
|
|
16
|
-
{actions ? <div className="flex flex-wrap justify-end gap-2">{actions}</div> : null}
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type AdminPageVariant = 'list' | 'detail' | 'form' | 'dashboard';
|
|
4
|
-
|
|
5
|
-
type AdminPageProps = {
|
|
6
|
-
variant: AdminPageVariant;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const widths: Record<AdminPageVariant, string> = {
|
|
11
|
-
list: 'w-full',
|
|
12
|
-
detail: 'max-w-6xl',
|
|
13
|
-
form: 'max-w-3xl',
|
|
14
|
-
dashboard: 'w-full',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export function AdminPage({ variant, children }: AdminPageProps) {
|
|
18
|
-
return <div className={'mx-auto min-w-0 space-y-6 p-4 md:p-6 ' + widths[variant]}>{children}</div>;
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type AdminPageHeaderProps = {
|
|
4
|
-
title: ReactNode;
|
|
5
|
-
description?: ReactNode;
|
|
6
|
-
actions?: ReactNode;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function AdminPageHeader({ title, description, actions }: AdminPageHeaderProps) {
|
|
10
|
-
return (
|
|
11
|
-
<header className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
|
12
|
-
<div className="min-w-0 space-y-1">
|
|
13
|
-
<h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
|
|
14
|
-
{description ? <p className="text-sm text-muted-foreground">{description}</p> : null}
|
|
15
|
-
</div>
|
|
16
|
-
{actions ? <div className="flex shrink-0 flex-wrap gap-2">{actions}</div> : null}
|
|
17
|
-
</header>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
type AdminPaginationProps = {
|
|
4
|
-
page: number;
|
|
5
|
-
totalPages: number;
|
|
6
|
-
previous?: ReactNode;
|
|
7
|
-
next?: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function AdminPagination({ page, totalPages, previous, next }: AdminPaginationProps) {
|
|
11
|
-
return (
|
|
12
|
-
<nav aria-label="Pagination" className="flex flex-wrap items-center justify-between gap-3 rounded-lg border p-3">
|
|
13
|
-
<div className="min-w-0">{previous}</div>
|
|
14
|
-
<span className="text-sm text-muted-foreground" aria-live="polite">
|
|
15
|
-
Page {page} of {totalPages}
|
|
16
|
-
</span>
|
|
17
|
-
<div className="min-w-0">{next}</div>
|
|
18
|
-
</nav>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import { SidebarInset, SidebarProvider } from '@/components/ui/sidebar';
|
|
3
|
-
|
|
4
|
-
type AdminShellProps = {
|
|
5
|
-
sidebar: ReactNode;
|
|
6
|
-
header?: ReactNode;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function AdminShell({ sidebar, header, children }: AdminShellProps) {
|
|
11
|
-
return (
|
|
12
|
-
<SidebarProvider>
|
|
13
|
-
{sidebar}
|
|
14
|
-
<SidebarInset className="min-w-0">
|
|
15
|
-
{header}
|
|
16
|
-
<main className="min-w-0 flex-1">{children}</main>
|
|
17
|
-
</SidebarInset>
|
|
18
|
-
</SidebarProvider>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader } from '@/components/ui/sidebar';
|
|
3
|
-
|
|
4
|
-
type AdminSidebarProps = {
|
|
5
|
-
navigation: ReactNode;
|
|
6
|
-
header?: ReactNode;
|
|
7
|
-
footer?: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function AdminSidebar({ navigation, header, footer }: AdminSidebarProps) {
|
|
11
|
-
return (
|
|
12
|
-
<Sidebar>
|
|
13
|
-
{header ? <SidebarHeader>{header}</SidebarHeader> : null}
|
|
14
|
-
<SidebarContent>{navigation}</SidebarContent>
|
|
15
|
-
{footer ? <SidebarFooter>{footer}</SidebarFooter> : null}
|
|
16
|
-
</Sidebar>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
3
|
-
|
|
4
|
-
type AdminStatCardProps = {
|
|
5
|
-
label: ReactNode;
|
|
6
|
-
value: ReactNode;
|
|
7
|
-
description?: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function AdminStatCard({ label, value, description }: AdminStatCardProps) {
|
|
11
|
-
return (
|
|
12
|
-
<Card>
|
|
13
|
-
<CardHeader>
|
|
14
|
-
<CardTitle className="text-sm font-medium text-muted-foreground">{label}</CardTitle>
|
|
15
|
-
</CardHeader>
|
|
16
|
-
<CardContent className="space-y-1">
|
|
17
|
-
<div className="text-2xl font-semibold tabular-nums">{value}</div>
|
|
18
|
-
{description ? <p className="text-sm text-muted-foreground">{description}</p> : null}
|
|
19
|
-
</CardContent>
|
|
20
|
-
</Card>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { writeProjectFileIfMissing } from "./install.js";
|
|
4
|
-
import { pathExists } from "./project-signals.js";
|
|
5
|
-
const components = [
|
|
6
|
-
'AdminShell',
|
|
7
|
-
'AdminSidebar',
|
|
8
|
-
'AdminPage',
|
|
9
|
-
'AdminPageHeader',
|
|
10
|
-
'AdminFilterBar',
|
|
11
|
-
'AdminDataTable',
|
|
12
|
-
'AdminPagination',
|
|
13
|
-
'AdminFormLayout',
|
|
14
|
-
'AdminDetailLayout',
|
|
15
|
-
'AdminStatCard',
|
|
16
|
-
'AdminEmptyState',
|
|
17
|
-
'AdminConfirmDialog',
|
|
18
|
-
];
|
|
19
|
-
const primitives = ['alert-dialog', 'card', 'sidebar', 'table'];
|
|
20
|
-
async function hasExistingAdminUi(root) {
|
|
21
|
-
// Existing project-owned shared admin page systems are adopted, not replaced.
|
|
22
|
-
return ((await pathExists(root, 'src/components/extra/admin-list-layout.tsx')) &&
|
|
23
|
-
(await pathExists(root, 'src/components/extra/admin-list-states.tsx')));
|
|
24
|
-
}
|
|
25
|
-
async function templateCount(root) {
|
|
26
|
-
const files = await Promise.all(components.map((name) => pathExists(root, 'src/components/admin/' + name + '.tsx')));
|
|
27
|
-
return files.filter(Boolean).length;
|
|
28
|
-
}
|
|
29
|
-
export const adminUiRecipe = {
|
|
30
|
-
id: 'admin-ui',
|
|
31
|
-
recipeVersion: '1.0.0',
|
|
32
|
-
role: 'feature',
|
|
33
|
-
requires: ['shadcn'],
|
|
34
|
-
async detect(root) {
|
|
35
|
-
if (await hasExistingAdminUi(root)) {
|
|
36
|
-
return { present: true, compatible: true, detectedVersion: null };
|
|
37
|
-
}
|
|
38
|
-
const count = await templateCount(root);
|
|
39
|
-
return {
|
|
40
|
-
present: count > 0,
|
|
41
|
-
compatible: count === components.length,
|
|
42
|
-
detectedVersion: null,
|
|
43
|
-
...(count > 0 && count < components.length
|
|
44
|
-
? {
|
|
45
|
-
reason: 'Admin UI has only ' + count + ' of ' + components.length + ' source components',
|
|
46
|
-
}
|
|
47
|
-
: {}),
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
async apply(root) {
|
|
51
|
-
if (await hasExistingAdminUi(root))
|
|
52
|
-
return { source: 'adopted' };
|
|
53
|
-
const rawConfig = JSON.parse(await readFile(join(root, 'components.json'), 'utf8'));
|
|
54
|
-
const aliases = rawConfig !== null && typeof rawConfig === 'object' && 'aliases' in rawConfig
|
|
55
|
-
? rawConfig.aliases
|
|
56
|
-
: null;
|
|
57
|
-
if (aliases === null ||
|
|
58
|
-
typeof aliases !== 'object' ||
|
|
59
|
-
!('ui' in aliases) ||
|
|
60
|
-
aliases.ui !== '@/components/ui' ||
|
|
61
|
-
!('components' in aliases) ||
|
|
62
|
-
aliases.components !== '@/components') {
|
|
63
|
-
throw new Error('admin-ui requires shadcn aliases for @/components and @/components/ui');
|
|
64
|
-
}
|
|
65
|
-
const missing = (await Promise.all(primitives.map(async (name) => (await pathExists(root, 'src/components/ui/' + name + '.tsx')) ? null : name))).filter((name) => name !== null);
|
|
66
|
-
if (missing.length) {
|
|
67
|
-
throw new Error('admin-ui requires shadcn components: ' + missing.join(', ') + '. Add them first.');
|
|
68
|
-
}
|
|
69
|
-
// Read all inputs before changing the project; generated files become project-owned.
|
|
70
|
-
const templates = await Promise.all(components.map(async (name) => ({
|
|
71
|
-
name,
|
|
72
|
-
content: await readFile(new URL('./admin-ui-templates/' + name + '.tsx.template', import.meta.url), 'utf8'),
|
|
73
|
-
})));
|
|
74
|
-
for (const { name, content } of templates) {
|
|
75
|
-
await writeProjectFileIfMissing(root, 'src/components/admin/' + name + '.tsx', content);
|
|
76
|
-
}
|
|
77
|
-
return { source: 'installed' };
|
|
78
|
-
},
|
|
79
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { detectAnyPath } from "./project-signals.js";
|
|
2
|
-
export const authRecipe = {
|
|
3
|
-
id: 'auth',
|
|
4
|
-
recipeVersion: '1.0.0',
|
|
5
|
-
role: 'feature',
|
|
6
|
-
variants: [
|
|
7
|
-
{ id: 'supabase', when: ['supabase'] },
|
|
8
|
-
{ id: 'convex', when: ['convex'] },
|
|
9
|
-
],
|
|
10
|
-
async detect(projectRoot) {
|
|
11
|
-
return await detectAnyPath(projectRoot, ['src/application/auth', 'src/auth', 'app/auth', 'convex/auth.ts', 'convex/auth.config.ts'], 'authentication integration was not detected');
|
|
12
|
-
},
|
|
13
|
-
async apply(_projectRoot, detection, _resolution) {
|
|
14
|
-
if (!detection.present) {
|
|
15
|
-
throw new Error('Auth is not implemented in this project; creating auth is not supported by `add auth` yet.');
|
|
16
|
-
}
|
|
17
|
-
if (!detection.compatible)
|
|
18
|
-
throw new Error(detection.reason ?? 'Existing auth integration is not compatible.');
|
|
19
|
-
return { source: 'adopted' };
|
|
20
|
-
},
|
|
21
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { ensurePnpmBuildPolicy, mergeMissing, projectPackageName, updatePackageJson, writeProjectFileIfMissing } from "./install.js";
|
|
2
|
-
import { detectDependency } from "./package-json.js";
|
|
3
|
-
async function installConvex(projectRoot, context) {
|
|
4
|
-
await updatePackageJson(projectRoot, (pkg) => ({
|
|
5
|
-
...pkg,
|
|
6
|
-
name: pkg.name ?? projectPackageName(projectRoot),
|
|
7
|
-
private: pkg.private ?? true,
|
|
8
|
-
packageManager: pkg.packageManager ?? 'pnpm@11.6.0',
|
|
9
|
-
engines: {
|
|
10
|
-
...pkg.engines,
|
|
11
|
-
node: pkg.engines?.node ?? '>=24.0.0',
|
|
12
|
-
pnpm: pkg.engines?.pnpm ?? '>=11.0.0',
|
|
13
|
-
},
|
|
14
|
-
scripts: mergeMissing(pkg.scripts, {
|
|
15
|
-
'convex:dev': 'convex dev',
|
|
16
|
-
'convex:codegen': 'convex codegen --typecheck=disable',
|
|
17
|
-
}),
|
|
18
|
-
dependencies: mergeMissing(pkg.dependencies, {
|
|
19
|
-
convex: '1.43.0',
|
|
20
|
-
}),
|
|
21
|
-
}));
|
|
22
|
-
await ensurePnpmBuildPolicy(projectRoot);
|
|
23
|
-
await writeProjectFileIfMissing(projectRoot, 'convex/schema.ts', `import { defineSchema } from 'convex/server';
|
|
24
|
-
|
|
25
|
-
export default defineSchema({});
|
|
26
|
-
`);
|
|
27
|
-
const expo = await detectDependency(projectRoot, 'expo', 'Expo');
|
|
28
|
-
if (expo.present) {
|
|
29
|
-
await writeProjectFileIfMissing(projectRoot, 'src/integrations/convex/config.ts', `export function convexConfig() {
|
|
30
|
-
return { url: process.env.EXPO_PUBLIC_CONVEX_URL ?? '' };
|
|
31
|
-
}
|
|
32
|
-
`);
|
|
33
|
-
}
|
|
34
|
-
await context.runCommand('pnpm', ['install', '--no-frozen-lockfile'], { cwd: projectRoot });
|
|
35
|
-
}
|
|
36
|
-
export const convexRecipe = {
|
|
37
|
-
id: 'convex',
|
|
38
|
-
recipeVersion: '1.1.1',
|
|
39
|
-
role: 'backend',
|
|
40
|
-
conflicts: ['supabase'],
|
|
41
|
-
async detect(projectRoot) {
|
|
42
|
-
return await detectDependency(projectRoot, 'convex', 'Convex');
|
|
43
|
-
},
|
|
44
|
-
async apply(projectRoot, detection, _resolution, context) {
|
|
45
|
-
if (detection.present) {
|
|
46
|
-
if (!detection.compatible)
|
|
47
|
-
throw new Error(detection.reason ?? 'Existing Convex setup is not compatible.');
|
|
48
|
-
return { source: 'adopted' };
|
|
49
|
-
}
|
|
50
|
-
await installConvex(projectRoot, context);
|
|
51
|
-
return { source: 'installed' };
|
|
52
|
-
},
|
|
53
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { ensurePnpmBuildPolicy, mergeMissing, projectPackageName, updatePackageJson, writeProjectFileIfMissing } from "./install.js";
|
|
2
|
-
import { detectDependency } from "./package-json.js";
|
|
3
|
-
const dependencies = {
|
|
4
|
-
expo: '57.0.19',
|
|
5
|
-
react: '19.2.3',
|
|
6
|
-
'react-dom': '19.2.3',
|
|
7
|
-
'react-native': '0.86.3',
|
|
8
|
-
'react-native-web': '0.21.2',
|
|
9
|
-
};
|
|
10
|
-
const devDependencies = {
|
|
11
|
-
'@types/react': '19.2.14',
|
|
12
|
-
typescript: '6.0.3',
|
|
13
|
-
};
|
|
14
|
-
async function installExpo(projectRoot, context) {
|
|
15
|
-
const pkg = await updatePackageJson(projectRoot, (current) => ({
|
|
16
|
-
...current,
|
|
17
|
-
name: current.name ?? projectPackageName(projectRoot),
|
|
18
|
-
private: current.private ?? true,
|
|
19
|
-
main: current.main ?? 'index.ts',
|
|
20
|
-
packageManager: current.packageManager ?? 'pnpm@11.6.0',
|
|
21
|
-
engines: {
|
|
22
|
-
...current.engines,
|
|
23
|
-
node: current.engines?.node ?? '>=24.0.0',
|
|
24
|
-
pnpm: current.engines?.pnpm ?? '>=11.0.0',
|
|
25
|
-
},
|
|
26
|
-
scripts: mergeMissing(current.scripts, {
|
|
27
|
-
start: 'expo start',
|
|
28
|
-
android: 'expo start --android',
|
|
29
|
-
ios: 'expo start --ios',
|
|
30
|
-
web: 'expo start --web',
|
|
31
|
-
typecheck: 'tsc --noEmit',
|
|
32
|
-
}),
|
|
33
|
-
dependencies: mergeMissing(current.dependencies, dependencies),
|
|
34
|
-
devDependencies: mergeMissing(current.devDependencies, devDependencies),
|
|
35
|
-
}));
|
|
36
|
-
const name = pkg.name;
|
|
37
|
-
await ensurePnpmBuildPolicy(projectRoot);
|
|
38
|
-
await writeProjectFileIfMissing(projectRoot, 'index.ts', `import { registerRootComponent } from 'expo';
|
|
39
|
-
import App from './App';
|
|
40
|
-
|
|
41
|
-
registerRootComponent(App);
|
|
42
|
-
`);
|
|
43
|
-
await writeProjectFileIfMissing(projectRoot, 'App.tsx', `import { SafeAreaView, Text } from 'react-native';
|
|
44
|
-
|
|
45
|
-
export default function App() {
|
|
46
|
-
return <SafeAreaView><Text>Specdest app</Text></SafeAreaView>;
|
|
47
|
-
}
|
|
48
|
-
`);
|
|
49
|
-
await writeProjectFileIfMissing(projectRoot, 'app.json', `${JSON.stringify({
|
|
50
|
-
expo: {
|
|
51
|
-
name,
|
|
52
|
-
slug: name,
|
|
53
|
-
version: '1.0.0',
|
|
54
|
-
orientation: 'portrait',
|
|
55
|
-
userInterfaceStyle: 'automatic',
|
|
56
|
-
},
|
|
57
|
-
}, null, 2)}\n`);
|
|
58
|
-
await writeProjectFileIfMissing(projectRoot, 'tsconfig.json', `{
|
|
59
|
-
"extends": "expo/tsconfig.base",
|
|
60
|
-
"compilerOptions": {
|
|
61
|
-
"strict": true
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
`);
|
|
65
|
-
await context.runCommand('pnpm', ['install', '--no-frozen-lockfile'], { cwd: projectRoot });
|
|
66
|
-
}
|
|
67
|
-
export const expoRecipe = {
|
|
68
|
-
id: 'expo',
|
|
69
|
-
recipeVersion: '1.2.0',
|
|
70
|
-
role: 'frontend',
|
|
71
|
-
setupRequirements: [
|
|
72
|
-
{ kind: 'package', packageId: 'oxlint', required: true },
|
|
73
|
-
{ kind: 'package', packageId: 'husky', required: true, when: 'git' },
|
|
74
|
-
],
|
|
75
|
-
conflicts: ['vite'],
|
|
76
|
-
async detect(projectRoot) {
|
|
77
|
-
return await detectDependency(projectRoot, 'expo', 'Expo');
|
|
78
|
-
},
|
|
79
|
-
async apply(projectRoot, detection, _resolution, context) {
|
|
80
|
-
if (detection.present) {
|
|
81
|
-
if (!detection.compatible)
|
|
82
|
-
throw new Error(detection.reason ?? 'Existing Expo setup is not compatible.');
|
|
83
|
-
return { source: 'adopted' };
|
|
84
|
-
}
|
|
85
|
-
await installExpo(projectRoot, context);
|
|
86
|
-
return { source: 'installed' };
|
|
87
|
-
},
|
|
88
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { detectDependency } from "./package-json.js";
|
|
2
|
-
import { pathExists } from "./project-signals.js";
|
|
3
|
-
export const firebaseHostingRecipe = {
|
|
4
|
-
id: 'firebase-hosting',
|
|
5
|
-
recipeVersion: '1.0.0',
|
|
6
|
-
role: 'integration',
|
|
7
|
-
requires: ['vite'],
|
|
8
|
-
async detect(projectRoot) {
|
|
9
|
-
const [firebaseJson, firebaseRc, tools] = await Promise.all([
|
|
10
|
-
pathExists(projectRoot, 'firebase.json'),
|
|
11
|
-
pathExists(projectRoot, '.firebaserc'),
|
|
12
|
-
detectDependency(projectRoot, 'firebase-tools', 'firebase-tools'),
|
|
13
|
-
]);
|
|
14
|
-
if (firebaseJson && firebaseRc) {
|
|
15
|
-
return { present: true, compatible: true, detectedVersion: tools.present ? tools.detectedVersion : null };
|
|
16
|
-
}
|
|
17
|
-
return { present: false, compatible: false, detectedVersion: null, reason: 'firebase.json and .firebaserc were not both found' };
|
|
18
|
-
},
|
|
19
|
-
async apply(_projectRoot, detection, _resolution) {
|
|
20
|
-
if (!detection.present)
|
|
21
|
-
throw new Error('Firebase Hosting configuration was not detected; creating Firebase Hosting configuration is not supported by `add firebase-hosting` yet.');
|
|
22
|
-
return { source: 'adopted' };
|
|
23
|
-
},
|
|
24
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function inspectPredefinedPackageState(projectRoot: string, state?: any): Promise<{
|
|
2
|
-
registered: string[];
|
|
3
|
-
present: string[];
|
|
4
|
-
issues: string[];
|
|
5
|
-
}>;
|
|
6
|
-
export declare function assertPredefinedPackageState(projectRoot: string): Promise<{
|
|
7
|
-
registered: string[];
|
|
8
|
-
present: string[];
|
|
9
|
-
issues: string[];
|
|
10
|
-
}>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { listPackageRecipes } from "./registry.js";
|
|
2
|
-
import { installedPackageIds, resolvePackageAddition } from "./resolver.js";
|
|
3
|
-
import { readInstalledState } from "../state.js";
|
|
4
|
-
export async function inspectPredefinedPackageState(projectRoot, state) {
|
|
5
|
-
const installedState = state ?? await readInstalledState(projectRoot);
|
|
6
|
-
const recipes = listPackageRecipes();
|
|
7
|
-
const byId = new Map(recipes.map((recipe) => [recipe.id, recipe]));
|
|
8
|
-
const detections = new Map(await Promise.all(recipes.map(async (recipe) => [recipe.id, await recipe.detect(projectRoot)])));
|
|
9
|
-
const registered = installedPackageIds(installedState);
|
|
10
|
-
const present = recipes.filter((recipe) => detections.get(recipe.id)?.present).map((recipe) => recipe.id);
|
|
11
|
-
const issues = [];
|
|
12
|
-
for (const id of registered) {
|
|
13
|
-
const recipe = byId.get(id);
|
|
14
|
-
if (!recipe) {
|
|
15
|
-
issues.push(`Unknown registered predefined package: ${id}`);
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
const detection = detections.get(id);
|
|
19
|
-
if (!detection?.present) {
|
|
20
|
-
issues.push(`${id} is registered but no longer detected in the project`);
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (!detection.compatible) {
|
|
24
|
-
issues.push(`${id}: ${detection.reason ?? 'detected package is not compatible'}`);
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
const registeredDependencies = registered.filter((candidate) => candidate !== id);
|
|
28
|
-
const presentEnvironment = present.filter((candidate) => candidate !== id);
|
|
29
|
-
try {
|
|
30
|
-
const resolution = resolvePackageAddition(recipe, {
|
|
31
|
-
registeredPackageIds: registeredDependencies,
|
|
32
|
-
presentPackageIds: presentEnvironment,
|
|
33
|
-
knownRecipes: recipes,
|
|
34
|
-
});
|
|
35
|
-
const recordedVariant = installedState.installed[id]?.resolvedVariant ?? null;
|
|
36
|
-
if (recordedVariant !== resolution.variant) {
|
|
37
|
-
issues.push(`${id} resolved variant changed from ${recordedVariant ?? 'none'} to ${resolution.variant ?? 'none'}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
issues.push(error.message);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return { registered, present, issues: [...new Set(issues)].sort() };
|
|
45
|
-
}
|
|
46
|
-
export async function assertPredefinedPackageState(projectRoot) {
|
|
47
|
-
const health = await inspectPredefinedPackageState(projectRoot);
|
|
48
|
-
if (health.issues.length) {
|
|
49
|
-
throw new Error(`Predefined package state is invalid:\n- ${health.issues.join('\n- ')}`);
|
|
50
|
-
}
|
|
51
|
-
return health;
|
|
52
|
-
}
|