Skip to content

feat(sv-utils): demo helpers - #1203

Open
sacrosanctic wants to merge 41 commits into
sveltejs:version-1from
sacrosanctic:unpleasant-orca
Open

feat(sv-utils): demo helpers#1203
sacrosanctic wants to merge 41 commits into
sveltejs:version-1from
sacrosanctic:unpleasant-orca

Conversation

@sacrosanctic

@sacrosanctic sacrosanctic commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Closes #1169

Description

Reopened from #1188 due to a glitch.

Checklist

  • Update snapshots (if applicable)
  • Add a changeset (if applicable)
  • Allow maintainers to edit this PR
  • I care about what I'm doing, no matter the tool I use (Notepad, Sublime, VSCode, AI...)

sacrosanctic and others added 9 commits July 23, 2026 15:46
* main

* throw if pm isnt installed

* throw

* nit

* changeset

* tmv sv ordering

* sh is unknwon on windows (execSync know about it)

* hint to label & next step

* caching agent install, keep none by default

---------

Co-authored-by: jycouet <jycouet@gmail.com>
Bump package-manager-detector to ^1.8.0, the first release with nub in its
agent and command tables. sv-utils bundles the library at build time, so the
published bundle only knows about nub once rebuilt against >=1.8.0.
…eltejs#1192)

When prettier is among the scaffolded add-ons, format the whole project rather
than only the add-on-touched files, so a fresh project passes its own lint.
Prettier's ignore rules still apply.

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
* feat: addOption in setup phase

* fmt²

* okay cut

* humm

* fmt

* chore: update api surface

* test: await async setupAddons in engine tests

* Update packages/sv/src/core/config.ts

Co-authored-by: Scott Wu <sw@scottwu.ca>

* Update packages/sv/src/core/config.ts

Co-authored-by: Scott Wu <sw@scottwu.ca>

* feat: typesafe addOption keys via defineAddon setup generic

- addOption now constrains key + question type from defineAddon<SetupValues>()
- regenerate api surface

---------

Co-authored-by: Scott Wu <sw@scottwu.ca>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* mv

* feat: welcome `ai-tools`

* abc

* don't format skills

* opencode -> plugin, claude question, subagents

* fmt

* cleanup snap

* snap

* update new path

* feat(ai-tools): choose Svelte plugin or individual tools per client

- delivery option: Svelte plugin (Claude via committed .claude/settings.json, opencode via opencode.json) or individual tools
- granular MCP/skills/sub-agents selection; rename `setup` -> `mcpSetup`
- consolidate per-client config into a single `CLIENTS` registry

* feat(ai-tools): install skills for cursor, gemini and vscode

* feat(ai-tools): CLAUDE.md imports AGENTS.md to keep a single source of truth

* chore(ai-tools): rename RX_MD to REGEX_MD

* feat(ai-tools): warn in next steps when plugin and loose skill/agent files coexist

* fmt

* fix(ai-tools): 'other' client now writes AGENTS.md

* fix(ai-tools): only ask tool/MCP questions when a client can use them

* Update packages/sv/src/create/shared/+skills/svelte-code-writer/SKILL.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update documentation/docs/30-add-ons/01-ai-tools.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update documentation/docs/30-add-ons/01-ai-tools.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update documentation/docs/30-add-ons/01-ai-tools.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update documentation/docs/30-add-ons/01-ai-tools.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/addons/ai-tools.ts

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/addons/ai-tools.ts

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+skills/svelte-code-writer/SKILL.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+skills/svelte-code-writer/SKILL.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+skills/svelte-code-writer/SKILL.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+skills/svelte-code-writer/SKILL.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/addons/ai-tools.ts

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/addons/ai-tools.ts

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+agents/svelte-file-editor.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+agents/svelte-file-editor.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+agents/svelte-file-editor.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+agents/svelte-file-editor.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+agents/svelte-file-editor.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+agents/svelte-file-editor.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+agents/svelte-file-editor.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Update packages/sv/src/create/shared/+agents/svelte-file-editor.md

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* update skills

* fix: drop stale reference files and update ai-tools snapshots

---------

Co-authored-by: Rich Harris <hello@rich-harris.dev>
…rrors (sveltejs#1198)

* fix: drop obsolete pnpm allowBuilds entries and surface real format errors

* test: install generated project outside the repo workspace
…t 3 shape (sveltejs#1199)

* feat(sv-utils): add SvelteKit 3 helpers

Version detection, the `$lib` -> `#lib` move and the generated `$app/tsconfig`, so add-ons stop hardcoding kit-version-specific shapes.

* fix(core): make `runsAfter` actually order add-ons

It sorted by number of constraints, so an add-on could still run before one it declared it runs after. Topologically sort instead, seeded with the previous order so unconstrained add-ons keep their relative position.

* fix(experimental): create manages `#lib` and the rest of the SvelteKit 3 shape

- skip `handleRenderingErrors`/`explicitEnvironmentVariables`, removed in kit 3
- extend `$app/tsconfig` and own `include`, keeping deliberate compiler option overrides
- rewrite `$lib` to `#lib` and declare the subpath imports Vite resolves from
- drizzle drops the removed `typescript.config` hook; `defineEnvVars` moves to `@sveltejs/kit/env`
- better-auth and paraglide emit the right lib prefix and route type

* test(cli): cover `kit@next` with a real install, build and check

No snapshot: the point is that the project works, not what it looks like.

* Update packages/sv/src/addons/drizzle.ts

Co-authored-by: Scott Wu <sw@scottwu.ca>

* Update packages/sv-utils/src/kit3.ts

Co-authored-by: Scott Wu <sw@scottwu.ca>

* test(cli): cover better-auth on `kit@next`, finish the `KIT3_TSCONFIG_DEFAULT` rename

better-auth has the most `#lib` imports, so it gets its own `kit@next` install/build/check case. It
can't join the existing one: kit treats any `remote.js` as a remote module, including the one `jose`
ships, so `remoteFunctions` breaks the build.

Also rewords the changeset and updates the two remaining `KIT3_TSCONFIG_INHERITED` references.

* test(cli): pin the `kit@next` prereleases the experimental cases run against

* test(cli): drop the better-auth `kit@next` case

* chore: fix indentation

* test(cli): let the generated project install a fresh prerelease

* test(cli): track the `next` tag instead of a pinned prerelease

* chore: trim the changesets to one line each

* chore: changeset wording

---------

Co-authored-by: Scott Wu <sw@scottwu.ca>
@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 30, 2026

Copy link
Copy Markdown

Install the latest version of sv from d721816:

pnx https://pkg.svelte.dev/sv/c/d721816809989761710ea7c560d055f2286b9fb3 create

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/cli/pr/1203

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d721816

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@sveltejs/sv-utils Patch
sv Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sacrosanctic sacrosanctic changed the title fix: improve demo experience- #1188 fix: improve demo experience Jul 30, 2026
Comment thread packages/sv/src/addons/better-auth.ts Outdated
],
required: false
required: false,
condition: ({ template }) => template !== 'demo'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jycouet the general idea of this PR is this, thoughts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I find it strange to not allow better-auth demo in demo template

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic got lost during the rebasing. It's supposed to be "when template is demo, don't ask, always use template"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic got lost during the rebasing. It's supposed to be "when template is demo, don't ask, always use template"

I guess you meant when template is demo, don't ask, always use demo ?
I don't really see the value there and it's doing a big breaking, and it's only for create.

@sacrosanctic
sacrosanctic marked this pull request as ready for review July 31, 2026 02:53

@jycouet jycouet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in all, I'm not a big fan.

I re read the issue a few times, and:

On the demo template, add a fourth header called addon which links to the /demo page.

It could also be /demo as a 4th tab?

Actually, in the minimal template, I would love to have a link to the demo page from the root layout! (It's maybe VERY intrusive... but very visible for people adding something in their app!)

when sv create, addons should not prompt to add demo if the template is demo

I think that this is not necessary. Why doing "soooo much work" for so small outcome? Maybe I'm missing somehting?

rename /demo to /addon

Possible yes, but I don't really see the cool thing about it

Comment thread packages/sv/src/addons/tests/better-auth/test.ts Outdated
Comment thread packages/sv/src/core/options.ts Outdated
@manuel3108
manuel3108 changed the base branch from main to version-1 August 7, 2026 08:51
@sacrosanctic

Copy link
Copy Markdown
Contributor Author
const demo = createDemoPage('paraglide', language, directory.kitRoutes);
sv.file(...demo.listing);
sv.file(...demo.header);

Im also interested in making this a sv-utils so the community can easily add their demo to the demopage.

@sacrosanctic

Copy link
Copy Markdown
Contributor Author

I would like this merged if a maintainer can provide some more feedback.

@jycouet jycouet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of this new template param that is available only in create scenario.
And I don't see the value of skipping demo questions in the demo template.
Am I missing something?

Comment thread packages/sv/src/addons/better-auth.ts Outdated
Comment on lines 54 to 56
const demoPassword = template === 'demo' || options.demo?.includes('password');
const demoGithub = template === 'demo' || options.demo?.includes('github');
const hasDemo = demoPassword || demoGithub;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why forcing the password demo and the github demo in the demo template?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should prompt the user instead of forcing.

Comment thread packages/sv/src/addons/better-auth.ts
@sacrosanctic

Copy link
Copy Markdown
Contributor Author

I'm not a big fan of this new template param that is available only in create scenario.

Originally tried dynamic options but didn't work. sv create is the only time template value is valid, there's no template in sv add

And I don't see the value of skipping demo questions in the demo template.

What is the value of asking? If you select demo template and addons that has demos, you want a playground to mess around with.

want demos dont want demos
demo template new users who
minimal template tryout addon experienced users

@jycouet

jycouet commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

And I don't see the value of skipping demo questions in the demo template.

What is the value of asking? If you select demo template and addons that has demos, you want a playground to mess around with.

want demos dont want demos
demo template new users who
minimal template tryout addon experienced users

  • maybe a new user want to know only the code about password and not github.
  • I like to not have too many hidden if in addon. To avoid "I ran this add-on but now it not behaving the same, why?"
  • With your matrix, you are guessing what question to ask depending on "user level". I think that it's too much guessing over predictability.

@sacrosanctic sacrosanctic left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see where you're coming from. On the other side, it feels like you're getting asked the same question again.
"Which template do you want?" "Demo" "Do you want to include a demo?" "Didnt i just answer this question?"

I have reversed the changes to complex questions. We only skip questions that are binary like 'Do you want to include a demo?'. If you remain unconvinced, then we can move on.

@svelte-docs-bot

Copy link
Copy Markdown

@manuel3108

manuel3108 commented Aug 21, 2026

Copy link
Copy Markdown
Member

I think the committed implementation at this point is quite harmless. I don't have a strong opinion here but I think I would be slightly in favor of proceeding with this. Basically the current implementation skips the demo question if the sveltekit demo was used. Thats a total of two skipped questions or something.

But I will leave the final decision to @jycouet

Skipping the demo question in the demo template removed the opt-out rather
than a redundant question: a false `condition` forces the value to
`undefined` with no default fallback, and specifying `demo:false` throws.
It also made the same addon ask different questions in `sv create` vs
`sv add`, where `template` is never set.
Moves the demo wiring out of `sv`'s private `addons/common.ts` so community
add-ons can hang a route off `/demo` the same way the official ones do.
Renamed from `createDemoPage` to match `defineEnv`/`defineAddon`.
@jycouet

jycouet commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

I'm sorry, but I strongly think that this API change adding template to remove one question only in create scenario is not worth it. Plus it's creating issue with paraglide=demo:false that would not be respected. Plus create & add would have different questions and that's not really consistent.

I like the idea of moving the helper to sv-utils to add more demos there by the community.
I'm moving it now to then merge like this.

@sacrosanctic sacrosanctic changed the title fix: improve demo experience feat(sv-utils): demo helpers Aug 22, 2026
if (hasDemoLink(ast.fragment.nodes, name)) return false;

js.imports.addNamed(ast.instance.content, { imports: ['resolve'], from: '$app/paths' });
svelte.addFragment(ast, `<a href={resolve('/demo/${name}')}>${name}</a>`, { mode: 'prepend' });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be append?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update demo experience

5 participants