> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fensu.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Read the Fensu Quickstart before onboarding a repository.
> Use fensu init --yes for an existing repository, or fensu init --yes --name NAME for an empty repository. Use --no-skills only when configuration-only initialization is explicitly required.
> For repository-wide Fensu onboarding, detect and configure every confidently supported target; a detected SvelteKit project belongs in that scope alongside Python targets.
> For narrowly scoped work, do not introduce unrelated analyzer targets. Existing configured targets always apply.
> Do not call Fensu onboarding complete until fensu skills --check succeeds.

# TypeScript and SvelteKit

> Configure native web analysis during repository-wide onboarding or explicitly requested TypeScript, Svelte, and SvelteKit architecture work.

Fensu can analyze TypeScript and SvelteKit targets natively, without starting
Node. Web analysis uses named targets, so a repository can check Python and web
projects in one deterministic `fensu check` run.

<Note>
  Web analyzers are newer and less broadly exercised than Fensu's Python
  analyzer. Include a confidently detected SvelteKit project during
  repository-wide Fensu onboarding, but do not expand an unrelated scoped task
  into frontend policy work. Existing configured targets always apply.
</Note>

## Repository-wide onboarding

Run the normal initializer when the user asks to set up Fensu for the repository:

```bash theme={null}
fensu init --yes
```

Fensu recognizes a SvelteKit target only when one directory contains all of the
following:

* `svelte.config.js`, `.cjs`, `.mjs`, or `.ts`;
* `package.json` with a non-empty `@sveltejs/kit` dependency or dev dependency;
* `tsconfig.json` or `jsconfig.json`; and
* a `src/` directory.

If Python packages are present too, init writes explicit Python and Svelte targets.
Use `--exclude-target NAME` only when repository-wide onboarding deliberately
excludes one detected web project. Generic TypeScript files alone do not imply a
particular architecture policy and are not auto-detected as a target.

For a new SvelteKit-only setup, an explicit preset is also available:

```bash theme={null}
fensu init --yes --preset sveltekit
```

## Add a target

To add SvelteKit to an existing explicit-target `fensu.toml`:

```bash theme={null}
fensu target add web --preset sveltekit --path frontend
```

This appends a validated `[targets.web]` block without converting or overwriting
an ambiguous configuration. See [`fensu target`](/cli/target) for its safety
contract.

## Configuration

A mixed repository can declare both analyzers:

```toml theme={null}
[targets.backend]
analyzer = "python"
root = "."
roots = ["src/acme"]
tests = ["tests"]
tooling = ["scripts"]
select = ["FF"]

[targets.web]
analyzer = "svelte"
root = "frontend"
roots = ["src"]
tests = ["tests"]
tooling = ["tooling"]
test_layout = "mirrored"
framework = "sveltekit"
select = ["FW"]
```

`root` is relative to the repository configuration and the target's `roots`,
`tests`, and `tooling` are relative to that root. Use `analyzer = "typescript"`
for an explicitly configured generic TypeScript project, or `analyzer = "svelte"`
with `framework = "sveltekit"` for SvelteKit.

With several targets, `fensu check` evaluates all of them and renders one report.
Use `fensu check --target web` to select one. Positional paths also require one
selected target.

## What it checks

The `FW` policy covers TypeScript imports, ownership and module shape, annotations,
naming, hygiene, and test conventions. Svelte analysis adds component and state
contracts. The SvelteKit framework adds route, resource, UI-kit, generated-client,
and API-boundary policies where configured.

Inspect any reported contract in the selected web target:

```bash theme={null}
fensu rule FWA001 --target web
```

Fensu reads TypeScript/JavaScript config inheritance and static path aliases. It
also reads literal SvelteKit `kit.alias` values. When a required alias is dynamic,
Fensu fails with a configuration diagnostic rather than guessing. A missing
generated `.svelte-kit/tsconfig.json` is accepted on a fresh checkout.

Python custom rules and `fensu map` remain Python analyzer features. Web targets
use the shipped native `FW` catalogue.

## Gradual adoption

Use the same target-local controls as other analyzers. To measure the full web
policy without blocking CI:

```toml theme={null}
[targets.web]
analyzer = "svelte"
root = "frontend"
roots = ["src"]
tests = ["tests"]
framework = "sveltekit"
select = []
warn = ["FW"]

[targets.web.evaluation]
include = ["src/**/*.{ts,js,svelte}", "tests/**/*.{ts,svelte}"]
```

Run `fensu check --warn`, then move proven rules or paths into blocking policy as
the repository adopts them.
