new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Svelte · CLI and AI tooling · all subjects

cli/overview

141 notes in this subject, read out of this brain and free to use. This is page 1 of 3.

Alternative package managers for sv

If you're using a different package manager than npm, you can use the equivalent command. For example, use `pnpm dlx` if you're using pnpm.

Running sv with npx

The easiest way to run `sv` is with `npx sv <command> <args>`. If `sv` is already installed locally in a project, npx will use the local installation. Otherwise, npx will download the latest version and run it without installing it.

sv CLI is a toolkit for Svelte applications

The command line interface (CLI), `sv`, is a toolkit for creating and maintaining Svelte applications.

sv create command with npx

The npx method is particularly useful for the `sv create` command, as it allows running the latest version without requiring local installation.

CLI introduction documentation source

The CLI introduction documentation is generated from a script located at apps/svelte.dev/scripts/sync-docs/index.ts. Direct editing of the documentation file is not recommended as it is auto-generated.

npx sv command not working issue

If `npx sv` is not working, some package managers prefer to run locally installed tools instead of downloading and executing packages from the registry. This issue mostly occurs with npm and yarn, and usually results in an error message or appears as though the command did nothing.

Running sv CLI with Bun

To run the sv CLI with Bun, use the command `bunx sv create`.

Running sv CLI with Deno

To run the sv CLI with Deno, use the command `deno run npm:sv create`.

sv command name collision with runit

The `sv` command name can collide with `runit`. Reference: https://github.com/sveltejs/cli/issues/259

npx sv create does nothing

There is a known issue where `npx sv create` does nothing. Reference: https://github.com/sveltejs/cli/issues/472

sv in Windows PowerShell conflicts with Set-Variable

In Windows PowerShell, the `sv` command conflicts with the `Set-Variable` alias. Reference: https://github.com/sveltejs/cli/issues/317

Running sv CLI with pnpm

To run the sv CLI with pnpm, use the command `pnpm dlx sv create`.

Running sv CLI with npm

To run the sv CLI with npm, use the command `npx sv create`.

Running sv CLI with Yarn

To run the sv CLI with Yarn, use the command `yarn dlx sv create`.

sv create --install option values

The --install <package-manager> option installs dependencies with a specified package manager. Supported package managers are: npm, pnpm, yarn, bun, and deno.

sv create --types option values

The --types <option> option determines whether and how to add typechecking to the project. Options are: ts (default to .ts files and use lang="ts" for .svelte components) and jsdoc (use JSDoc syntax for types).

sv create --no-add-ons option

The --no-add-ons flag runs the command without the interactive add-ons prompt.

sv create --no-types option

The --no-types flag prevents typechecking from being added to the project. The documentation notes this is not recommended.

sv create --template option values

The --template <name> option specifies which project template to use. Available templates are: minimal (barebones scaffolding), demo (showcase app with a word guessing game that works without JavaScript), and library (template for a Svelte library set up with svelte-package).

sv create --add option

The --add [add-ons...] option adds add-ons to the project during the create command, following the same format as the sv add command. Example: npx sv create --add eslint prettier [path]

sv create --no-install option

The --no-install flag prevents installing dependencies.

sv create --no-dir-check option

The --no-dir-check flag skips checking whether the target directory is empty.

sv create command purpose

The sv create command sets up a new SvelteKit project with options to setup additional functionality through add-ons.

sv create basic usage

The sv create command is invoked with: npx sv create [options] [path]

sv create --from-playground option

The --from-playground <url> option creates a SvelteKit project from a playground URL. It downloads all playground files, detects external dependencies, and sets up a complete SvelteKit project structure. Example usage: npx sv create --from-playground="https://svelte.dev/playground/hello-world"

Windows PowerShell @ character escaping

On Windows PowerShell, the `@` character is special and should be escaped with single quotes, for example: `npx sv add '@supacool'`.

Installing local add-ons

Local add-ons can be installed for development or internal use by specifying the file path, for example: `npx sv add file:../path/to/my-addon`.

Mixing official and community add-ons

Multiple add-ons can be mixed, for example: `npx sv add eslint @supacool`. The `--add` flag also works when creating a new project with `npx sv create --add eslint @supacool`.

Installing community add-ons by org name

Community add-ons can be installed by org name using `npx sv add @org`, which looks for `@org/sv` on npm. Community add-ons can be found on npmx by searching for the keyword `sv-add`.

Official add-ons for sv add

Official add-ons available with `sv add` are: ai-tools, better-auth, drizzle, eslint, mdsvex, paraglide, playwright, prettier, storybook, sveltekit-adapter, tailwindcss, and vitest.

sv add --no-install option

The `--no-install` flag for `sv add` prevents prompting to install dependencies.

sv add --install option

The `--install <package-manager>` flag for `sv add` installs dependencies with a specified package manager. Supported package managers are: npm, pnpm, yarn, bun, and deno.

sv add --no-download-check option

The `--no-download-check` flag for `sv add` disables the warning about downloads from community add-ons. Svelte maintainers have not reviewed community add-ons for malicious code, so this flag should be used with discretion.

sv add --no-git-check option

The `--no-git-check` flag for `sv add` disables the warning about uncommitted changes.

sv add -C/--cwd option

The `-C` or `--cwd` flag for `sv add` specifies the path to the root of your Svelte(Kit) project.

sv add command usage

The `sv add` command updates an existing project with new functionality. It can be run as `npx sv add` for an interactive prompt, or as `npx sv add [add-ons]` with space-separated add-on names.

routes migration

The routes migration upgrades a pre-release SvelteKit app to use the filesystem routing conventions in SvelteKit 1.

package migration

The package migration upgrades a library using @sveltejs/package from version 1 to version 2.

sveltekit-2 migration

The sveltekit-2 migration upgrades a SvelteKit 1 app to SvelteKit 2.

svelte-4 migration

The svelte-4 migration upgrades a Svelte 3 app to use Svelte 4.

self-closing-tags migration

The self-closing-tags migration replaces all self-closing non-void elements in .svelte files.

svelte-5 migration

The svelte-5 migration upgrades a Svelte 4 app to use Svelte 5 and updates individual components to use runes and other Svelte 5 syntax.

app-state migration

The app-state migration migrates $app/stores usage to $app/state in .svelte files.

sv migrate usage

The sv migrate command can be run with no arguments using 'npx sv migrate' to start an interactive migration selection process, or with a migration name specified directly using 'npx sv migrate [migration]'.

sv migrate command purpose

The sv migrate command migrates Svelte(Kit) codebases by delegating to the svelte-migrate package. It can optionally annotate the codebase with tasks for completion that can be found by searching for @migration.

CLI commands index page location

The CLI commands documentation is generated from apps/svelte.dev/scripts/sync-docs/index.ts and located at apps/svelte.dev/content/docs/cli/20-commands/index.md. This file should not be manually edited.

better-auth installation provides

When installed via sv add better-auth, the package includes a complete auth setup for SvelteKit with Drizzle as the database adapter, email/password authentication enabled by default, and optional demo registration and login pages.

sv add better-auth command

The sv add better-auth command installs the Better Auth framework-agnostic authentication library for TypeScript into a SvelteKit project. Run it with: npx sv add better-auth

better-auth demo option

The better-auth add-on supports a 'demo' option to specify which demo pages to include. Available values are 'password' for Email & Password authentication and 'github' for GitHub OAuth. The syntax is npx sv add better-auth="demo:password" for Email & Password only (default), npx sv add better-auth="demo:github" for GitHub OAuth only, or npx sv add better-auth="demo:password,github" for both.

sv add ai-tools command

The sv add command for ai-tools is invoked with 'npx sv add ai-tools'. This command adds Svelte AI tools to your project to help LLMs write better Svelte code.

sv add drizzle client option values

The client option specifies the SQL client to use and depends on the database choice. For postgresql: 'postgres.js' or 'neon'. For mysql: 'mysql2' or 'planetscale'. For sqlite: 'better-sqlite3', 'libsql', or 'turso'. Example usage: npx sv add drizzle='database:postgresql+client:postgres.js'

sv add drizzle combining options syntax

Multiple options can be combined using the plus sign (+) as a separator. The format is 'option:value+option:value'. For example: database:postgresql+client:postgres.js+docker:yes

sv add drizzle database option values

The database option accepts three values: 'postgresql' (the most popular open source database), 'mysql' (another popular open source database), and 'sqlite' (file-based database not requiring a database server). Example usage: npx sv add drizzle='database:postgresql'

sv add drizzle what gets installed

The drizzle add-on provides a setup that keeps database access in SvelteKit's server files, an .env file to store credentials, compatibility with the Better Auth add-on, and an optional Docker configuration for running a local database.

sv add drizzle command basic usage

Run 'npx sv add drizzle' to add Drizzle ORM to a SvelteKit project.

sv add drizzle docker option

The docker option controls whether to add Docker Compose configuration. It only works with database values 'postgresql' or 'mysql', not 'sqlite'. Set it with the value 'yes'. Example usage: npx sv add drizzle='database:postgresql+client:postgres.js+docker:yes'

sv add eslint updates VS Code extensions

Running sv add eslint updates the .vscode/extensions.json file.

sv add eslint creates configuration file

Running sv add eslint generates an eslint.config.js file in the project.

sv add eslint installs ESLint packages

Running sv add eslint installs relevant packages including eslint-plugin-svelte.

sv add eslint command

To add ESLint to a Svelte project, run the command: npx sv add eslint

Give your agent this brain