diff --git a/.svelte-kit/ambient.d.ts b/.svelte-kit/ambient.d.ts index ff87d23..30288d5 100644 --- a/.svelte-kit/ambient.d.ts +++ b/.svelte-kit/ambient.d.ts @@ -30,14 +30,19 @@ declare module '$env/static/private' { export const GHOSTTY_RESOURCES_DIR: string; export const TERM_PROGRAM: string; export const NODE: string; - export const SHELL: string; + export const INIT_CWD: string; export const TERM: string; - export const HOMEBREW_REPOSITORY: string; + export const SHELL: string; export const TMPDIR: string; + export const HOMEBREW_REPOSITORY: string; + export const npm_config_global_prefix: string; export const TERM_PROGRAM_VERSION: string; + export const COLOR: string; + export const npm_config_noproxy: string; export const npm_config_local_prefix: string; export const USER: string; export const COMMAND_MODE: string; + export const npm_config_globalconfig: string; export const SSH_AUTH_SOCK: string; export const __CF_USER_TEXT_ENCODING: string; export const npm_execpath: string; @@ -46,19 +51,25 @@ declare module '$env/static/private' { export const _: string; export const LaunchInstanceID: string; export const GHOSTTY_SHELL_FEATURES: string; + export const npm_config_userconfig: string; + export const npm_config_init_module: string; export const __CFBundleIdentifier: string; export const npm_command: string; export const PWD: string; export const npm_lifecycle_event: string; + export const EDITOR: string; export const npm_package_name: string; export const LANG: string; + export const npm_config_npm_version: string; export const XPC_FLAGS: string; + export const npm_config_node_gyp: string; export const npm_package_version: string; export const XPC_SERVICE_NAME: string; export const HOME: string; export const SHLVL: string; export const TERMINFO: string; export const HOMEBREW_PREFIX: string; + export const npm_config_cache: string; export const LOGNAME: string; export const npm_lifecycle_script: string; export const XDG_DATA_DIRS: string; @@ -67,10 +78,12 @@ declare module '$env/static/private' { export const INFOPATH: string; export const HOMEBREW_CELLAR: string; export const OSLogRateLimit: string; + export const AGENT: string; export const SECURITYSESSIONID: string; export const npm_node_execpath: string; + export const npm_config_prefix: string; + export const OPENCODE: string; export const COLORTERM: string; - export const NODE_ENV: string; } /** @@ -104,14 +117,19 @@ declare module '$env/dynamic/private' { GHOSTTY_RESOURCES_DIR: string; TERM_PROGRAM: string; NODE: string; - SHELL: string; + INIT_CWD: string; TERM: string; - HOMEBREW_REPOSITORY: string; + SHELL: string; TMPDIR: string; + HOMEBREW_REPOSITORY: string; + npm_config_global_prefix: string; TERM_PROGRAM_VERSION: string; + COLOR: string; + npm_config_noproxy: string; npm_config_local_prefix: string; USER: string; COMMAND_MODE: string; + npm_config_globalconfig: string; SSH_AUTH_SOCK: string; __CF_USER_TEXT_ENCODING: string; npm_execpath: string; @@ -120,19 +138,25 @@ declare module '$env/dynamic/private' { _: string; LaunchInstanceID: string; GHOSTTY_SHELL_FEATURES: string; + npm_config_userconfig: string; + npm_config_init_module: string; __CFBundleIdentifier: string; npm_command: string; PWD: string; npm_lifecycle_event: string; + EDITOR: string; npm_package_name: string; LANG: string; + npm_config_npm_version: string; XPC_FLAGS: string; + npm_config_node_gyp: string; npm_package_version: string; XPC_SERVICE_NAME: string; HOME: string; SHLVL: string; TERMINFO: string; HOMEBREW_PREFIX: string; + npm_config_cache: string; LOGNAME: string; npm_lifecycle_script: string; XDG_DATA_DIRS: string; @@ -141,10 +165,12 @@ declare module '$env/dynamic/private' { INFOPATH: string; HOMEBREW_CELLAR: string; OSLogRateLimit: string; + AGENT: string; SECURITYSESSIONID: string; npm_node_execpath: string; + npm_config_prefix: string; + OPENCODE: string; COLORTERM: string; - NODE_ENV: string; [key: `PUBLIC_${string}`]: undefined; [key: `${string}`]: string | undefined; } diff --git a/.svelte-kit/generated/client/app.js b/.svelte-kit/generated/client/app.js deleted file mode 100644 index c3c7b78..0000000 --- a/.svelte-kit/generated/client/app.js +++ /dev/null @@ -1,29 +0,0 @@ -export { matchers } from './matchers.js'; - -export const nodes = [ - () => import('./nodes/0'), - () => import('./nodes/1'), - () => import('./nodes/2') -]; - -export const server_loads = []; - -export const dictionary = { - "/": [2] - }; - -export const hooks = { - handleError: (({ error }) => { console.error(error) }), - - reroute: (() => {}), - transport: {} -}; - -export const decoders = Object.fromEntries(Object.entries(hooks.transport).map(([k, v]) => [k, v.decode])); -export const encoders = Object.fromEntries(Object.entries(hooks.transport).map(([k, v]) => [k, v.encode])); - -export const hash = false; - -export const decode = (type, value) => decoders[type](value); - -export { default as root } from '../root.js'; \ No newline at end of file diff --git a/.svelte-kit/generated/client/matchers.js b/.svelte-kit/generated/client/matchers.js deleted file mode 100644 index f6bd30a..0000000 --- a/.svelte-kit/generated/client/matchers.js +++ /dev/null @@ -1 +0,0 @@ -export const matchers = {}; \ No newline at end of file diff --git a/.svelte-kit/generated/client/nodes/0.js b/.svelte-kit/generated/client/nodes/0.js deleted file mode 100644 index fed1375..0000000 --- a/.svelte-kit/generated/client/nodes/0.js +++ /dev/null @@ -1 +0,0 @@ -export { default as component } from "../../../../src/routes/+layout.svelte"; \ No newline at end of file diff --git a/.svelte-kit/generated/client/nodes/1.js b/.svelte-kit/generated/client/nodes/1.js deleted file mode 100644 index bf58bad..0000000 --- a/.svelte-kit/generated/client/nodes/1.js +++ /dev/null @@ -1 +0,0 @@ -export { default as component } from "../../../../node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte"; \ No newline at end of file diff --git a/.svelte-kit/generated/client/nodes/2.js b/.svelte-kit/generated/client/nodes/2.js deleted file mode 100644 index 1cb4f85..0000000 --- a/.svelte-kit/generated/client/nodes/2.js +++ /dev/null @@ -1 +0,0 @@ -export { default as component } from "../../../../src/routes/+page.svelte"; \ No newline at end of file diff --git a/.svelte-kit/generated/root.js b/.svelte-kit/generated/root.js deleted file mode 100644 index 4d1e892..0000000 --- a/.svelte-kit/generated/root.js +++ /dev/null @@ -1,3 +0,0 @@ -import { asClassComponent } from 'svelte/legacy'; -import Root from './root.svelte'; -export default asClassComponent(Root); \ No newline at end of file diff --git a/.svelte-kit/generated/root.svelte b/.svelte-kit/generated/root.svelte deleted file mode 100644 index 0795183..0000000 --- a/.svelte-kit/generated/root.svelte +++ /dev/null @@ -1,68 +0,0 @@ - - - - -{#if constructors[1]} - {@const Pyramid_0 = constructors[0]} - - - - - - -{:else} - {@const Pyramid_0 = constructors[0]} - - - -{/if} - -{#if mounted} -
- {#if navigated} - {title} - {/if} -
-{/if} \ No newline at end of file diff --git a/.svelte-kit/generated/server/internal.js b/.svelte-kit/generated/server/internal.js deleted file mode 100644 index 57501b7..0000000 --- a/.svelte-kit/generated/server/internal.js +++ /dev/null @@ -1,53 +0,0 @@ - -import root from '../root.js'; -import { set_building, set_prerendering } from '__sveltekit/environment'; -import { set_assets } from '$app/paths/internal/server'; -import { set_manifest, set_read_implementation } from '__sveltekit/server'; -import { set_private_env, set_public_env } from '../../../node_modules/@sveltejs/kit/src/runtime/shared-server.js'; - -export const options = { - app_template_contains_nonce: false, - async: false, - csp: {"mode":"auto","directives":{"upgrade-insecure-requests":false,"block-all-mixed-content":false},"reportOnly":{"upgrade-insecure-requests":false,"block-all-mixed-content":false}}, - csrf_check_origin: true, - csrf_trusted_origins: [], - embedded: false, - env_public_prefix: 'PUBLIC_', - env_private_prefix: '', - hash_routing: false, - hooks: null, // added lazily, via `get_hooks` - preload_strategy: "modulepreload", - root, - service_worker: false, - service_worker_options: undefined, - templates: { - app: ({ head, body, assets, nonce, env }) => "\n\n\t\n\t\t\n\t\t\n\t\t" + head + "\n\t\n\t\n\t\t
" + body + "
\n\t\n\n", - error: ({ status, message }) => "\n\n\t\n\t\t\n\t\t" + message + "\n\n\t\t\n\t\n\t\n\t\t
\n\t\t\t" + status + "\n\t\t\t
\n\t\t\t\t

" + message + "

\n\t\t\t
\n\t\t
\n\t\n\n" - }, - version_hash: "1rc0y0p" -}; - -export async function get_hooks() { - let handle; - let handleFetch; - let handleError; - let handleValidationError; - let init; - - - let reroute; - let transport; - - - return { - handle, - handleFetch, - handleError, - handleValidationError, - init, - reroute, - transport - }; -} - -export { set_assets, set_building, set_manifest, set_prerendering, set_private_env, set_public_env, set_read_implementation }; diff --git a/.svelte-kit/types/route_meta_data.json b/.svelte-kit/types/route_meta_data.json index a96ec02..031da0d 100644 --- a/.svelte-kit/types/route_meta_data.json +++ b/.svelte-kit/types/route_meta_data.json @@ -1,3 +1,10 @@ { - "/": [] + "/": [ + "src/routes/+page.ts", + "src/routes/+page.server.ts", + "src/routes/+layout.ts", + "src/routes/+layout.server.ts", + "src/routes/+layout.ts", + "src/routes/+layout.server.ts" + ] } \ No newline at end of file diff --git a/.svelte-kit/types/src/routes/$types.d.ts b/.svelte-kit/types/src/routes/$types.d.ts index 32e2797..30b705c 100644 --- a/.svelte-kit/types/src/routes/$types.d.ts +++ b/.svelte-kit/types/src/routes/$types.d.ts @@ -11,14 +11,28 @@ type OutputDataShape = MaybeWithVoid> & Pa type EnsureDefined = T extends null | undefined ? {} : T; type OptionalUnion, A extends keyof U = U extends U ? keyof U : never> = U extends unknown ? { [P in Exclude]?: never } & U : never; export type Snapshot = Kit.Snapshot; +type PageServerParentData = EnsureDefined; type PageParentData = EnsureDefined; type LayoutRouteId = RouteId | "/" | null type LayoutParams = RouteParams & { } +type LayoutServerParentData = EnsureDefined<{}>; type LayoutParentData = EnsureDefined<{}>; -export type PageServerData = null; -export type PageData = Expand; -export type PageProps = { params: RouteParams; data: PageData } -export type LayoutServerData = null; -export type LayoutData = Expand; -export type LayoutProps = { params: LayoutParams; data: LayoutData; children: import("svelte").Snippet } \ No newline at end of file +export type PageServerLoad & Record | void = Partial & Record | void> = Kit.ServerLoad; +export type PageServerLoadEvent = Parameters[0]; +export type ActionData = unknown; +export type PageServerData = Expand>>>>>; +export type PageLoad = OutputDataShape> = Kit.Load; +export type PageLoadEvent = Parameters[0]; +export type PageData = Expand>>> & OptionalUnion>>>>>; +export type Action | void = Record | void> = Kit.Action +export type Actions | void = Record | void> = Kit.Actions +export type PageProps = { params: RouteParams; data: PageData; form: ActionData } +export type LayoutServerLoad & Record | void = Partial & Record | void> = Kit.ServerLoad; +export type LayoutServerLoadEvent = Parameters[0]; +export type LayoutServerData = Expand>>>>>; +export type LayoutLoad & Record | void = Partial & Record | void> = Kit.Load; +export type LayoutLoadEvent = Parameters[0]; +export type LayoutData = Expand>>> & OptionalUnion>>>>>; +export type LayoutProps = { params: LayoutParams; data: LayoutData; children: import("svelte").Snippet } +export type RequestEvent = Kit.RequestEvent; \ No newline at end of file diff --git a/.svelte-kit/types/src/routes/proxy+layout.server.ts b/.svelte-kit/types/src/routes/proxy+layout.server.ts new file mode 100644 index 0000000..8b4bab9 --- /dev/null +++ b/.svelte-kit/types/src/routes/proxy+layout.server.ts @@ -0,0 +1,12 @@ +// @ts-nocheck +// Server-only load function for the root layout. +// Runs only on the server. +// Provides shared data that requires server access (auth, user info, etc.). +import type { LayoutServerLoad } from './$types'; + +export const load = async ({ locals }: Parameters[0]) => { + // Example: Load user session or server-side data here + return { + // Add server-side shared data here + }; +}; diff --git a/.svelte-kit/types/src/routes/proxy+layout.ts b/.svelte-kit/types/src/routes/proxy+layout.ts new file mode 100644 index 0000000..d526543 --- /dev/null +++ b/.svelte-kit/types/src/routes/proxy+layout.ts @@ -0,0 +1,12 @@ +// @ts-nocheck +// Universal load function for the root layout. +// Runs on both server and client. +// Provides shared data to all child routes. +import type { LayoutLoad } from './$types'; + +export const load = async () => { + return { + appName: 'My SvelteKit App' + }; +}; +;null as any as LayoutLoad; \ No newline at end of file diff --git a/.svelte-kit/types/src/routes/proxy+page.server.ts b/.svelte-kit/types/src/routes/proxy+page.server.ts new file mode 100644 index 0000000..0eddb79 --- /dev/null +++ b/.svelte-kit/types/src/routes/proxy+page.server.ts @@ -0,0 +1,17 @@ +// @ts-nocheck +// Server-only load function for the home page. +// Runs only on the server with access to cookies, database, and server APIs. +import type { PageServerLoad } from './$types'; + +export const load = async ({ cookies }: Parameters[0]) => { + // Example: Access cookies, database, or server APIs here + const visitCount = parseInt(cookies.get('visit-count') || '0', 10); + cookies.set('visit-count', String(visitCount + 1), { + path: '/', + httpOnly: true + }); + + return { + visitCount + }; +}; diff --git a/.svelte-kit/types/src/routes/proxy+page.ts b/.svelte-kit/types/src/routes/proxy+page.ts new file mode 100644 index 0000000..b4ae654 --- /dev/null +++ b/.svelte-kit/types/src/routes/proxy+page.ts @@ -0,0 +1,12 @@ +// @ts-nocheck +// Universal load function for the home page. +// Runs on both server and client. +// Returns data to the page component. +import type { PageLoad } from './$types'; + +export const load = async () => { + return { + title: 'Welcome to SvelteKit' + }; +}; +;null as any as PageLoad; \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..4042acf --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,143 @@ +# Agent Guidelines + +## Development Commands + +```bash +# Start development server +npm run dev + +# Build for production +npm run build + +# Preview production build +npm run preview + +# Type checking +npm run check + +# Type checking with watch mode +npm run check:watch + +# Sync SvelteKit +npm run prepare +``` + +**Note:** No test framework is configured. Add Vitest or similar for testing. + +## Code Style Guidelines + +### File Structure +- `src/routes/` - Route pages and layouts +- `src/lib/` - Reusable components and utilities (importable via `$lib` alias) +- `src/app.d.ts` - Global TypeScript declarations for SvelteKit types +- `static/` - Static assets served at `/` + +### Svelte Components + +**Svelte 5 Runes Syntax:** +```svelte + +``` + +Use Svelte 5 runes API for reactivity: +- `$props()` for component props +- `$state()` for reactive state +- `$derived()` for derived values + +**Imports:** +```svelte + +``` + +Use `$lib` alias for imports from `src/lib/`. + +### TypeScript + +**Configuration:** +- Strict mode enabled +- ES modules (`"type": "module"`) +- Module resolution: bundler + +**Types:** +- Extend global `App` namespace in `app.d.ts` for custom interfaces: + - `App.Error` + - `App.Locals` + - `App.PageData` + - `App.PageState` + - `App.Platform` + +### Styling + +- Use tabs for indentation +- Single quotes for string literals +- Semicolons at end of statements +- No ESLint/Prettier configured - follow SvelteKit conventions + +### File Naming + +- Routes: `+page.svelte`, `+layout.svelte`, `+error.svelte` +- Server endpoints: `+page.server.ts`, `+layout.server.ts`, `+server.ts` +- Load functions: `+page.ts`, `+layout.ts` + +### SvelteKit File Types + +**Page Files:** +- `+page.svelte` - The component for a route page, renders HTML and handles UI +- `+page.ts` - Universal load function that runs on server and client, returns data for the page +- `+page.server.ts` - Server-only load function with access to cookies, database, and server APIs + +**Layout Files:** +- `+layout.svelte` - Wraps child routes with shared UI (navbar, footer, etc.) +- `+layout.ts` - Universal load function that provides data to all child routes +- `+layout.server.ts` - Server-only layout load for shared data (auth session, user info, etc.) + +**Special Files:** +- `+error.svelte` - Custom error page component, renders when `error()` is thrown or page fails to load +- `+loading.svelte` - Loading indicator shown during navigation while data is loading +- `+not-found.svelte` - Custom 404 page when a route doesn't exist + +**Server Endpoints:** +- `+server.ts` - API endpoint (GET, POST, PUT, DELETE, etc.) that creates RESTful routes +- Supports named export functions like `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` + +**Root Files:** +- `src/app.html` - HTML template for the entire application, injected with rendered content +- `src/app.d.ts` - TypeScript declarations extending SvelteKit's global types +- `src/hooks.server.ts` - Server-side hooks (handle, handleError) for auth, cookies, middleware +- `src/hooks.client.ts` - Client-side hooks for browser-specific initialization + +### Import Style + +- Group imports: third-party, internal, relative +- Use absolute imports with `$lib` alias for library imports +- Use relative imports `./` and `../` for same-directory files + +### Component Conventions + +- Always specify `lang="ts"` in ` + + + Error + + +

Error

+

{$page.error?.message || 'Something went wrong'}

+ +{#if $page.status} +

Status: {$page.status}

+{/if} + +Go back home diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts new file mode 100644 index 0000000..2c912e6 --- /dev/null +++ b/src/routes/+layout.server.ts @@ -0,0 +1,11 @@ +// Server-only load function for the root layout. +// Runs only on the server. +// Provides shared data that requires server access (auth, user info, etc.). +import type { LayoutServerLoad } from './$types'; + +export const load: LayoutServerLoad = async ({ locals }) => { + // Example: Load user session or server-side data here + return { + // Add server-side shared data here + }; +}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9cebde5..dd550c5 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,3 +1,7 @@ +