pip install -e .
After installation, the svelte-pi command will be available globally.
svelte-pi createCreates a new SvelteKit project with opinionated defaults.
Interactive prompts:
What it does:
Example:
svelte-pi create
svelte-pi component [path]Creates a new component with proper file structure, naming conventions, and boilerplate templates.
Two modes:
What it creates:
ComponentName.svelte - Main component file with TypeScript and SCSS importComponentName.module.scss - Component-specific styles with container classComponent Templates:
ComponentName.svelte:
<script lang="ts">
import styles from './ComponentName.module.scss';
// Component logic here
</script>
<div class={styles.container}>
<h1>ComponentName</h1>
</div>
ComponentName.module.scss:
.container {
// Styles for the component
}
Component Organization:
src/lib/components/
āāā features/ # Feature-specific components
ā āāā auth/
ā āāā chat/
ā āāā trips/
āāā layout/ # Layout components
ā āāā MainLayout/
āāā shared/ # Shared/common components
āāā ui/ # Reusable UI components
āāā ErrorBanner/
āāā TypingIndicator/
Examples:
# Direct mode
svelte-pi component features/auth/login
svelte-pi component ui/button
svelte-pi component layout/header
# Interactive wizard mode
svelte-pi component
# ⨠Welcome to Component Creation Wizard
# Name of component (including path): features/auth/signup
Validation: The component command validates that you're in a SvelteKit project by checking:
package.json exists with @sveltejs/kit dependencysrc/ directory existsWhen you create a new SvelteKit project, svelte-pi generates this structure:
my-project/
āāā src/
ā āāā lib/
ā ā āāā components/ # Component organization
ā ā āāā styles/ # Global styles
ā ā āāā reset.css # Optional CSS reset
ā āāā routes/ # SvelteKit routes
ā āāā app.html # HTML template
ā āāā app.d.ts # TypeScript declarations
āāā static/ # Static assets
āāā package.json # Dependencies with Yarn
āāā tsconfig.json # TypeScript config
āāā svelte.config.js # SvelteKit config
āāā vite.config.ts # Vite config
auth-form, user-profile)AuthForm.svelte, UserProfile.svelte)features/: Business logic components (features/auth/login)ui/: Reusable interface components (ui/button, ui/modal)layout/: Page structure components (layout/header, layout/sidebar)shared/: Common utility componentsEach component gets its own directory with:
ComponentName/
āāā ComponentName.svelte # Main component with TypeScript and styles import
āāā ComponentName.module.scss # Scoped SCSS styles
Created components work immediately:
(.venv) ā abc svelte-pi component
⨠Welcome to Component Creation Wizard
Name of component (including path): user/profile
Creating component: user/profile
Created: src/lib/components/user/profile/Profile.svelte
Created: src/lib/components/user/profile/Profile.module.scss
ā Component created successfully
Generated file structure:
src/lib/components/
āāā user/
āāā profile/
āāā Profile.svelte
āāā Profile.module.scss
# See all available commands
svelte-pi --help
# Get help for specific commands
svelte-pi create --help
svelte-pi component --help
This tool is built with:
svelte-pi/
āāā svelte_pi/ # Main package
ā āāā main.py # CLI commands and orchestration
ā āāā ui.py # User interface and prompts
ā āāā project_setup.py # SvelteKit project creation
ā āāā file_operations.py # File and component operations
ā āāā file_templates.py # Content templates (CSS reset, component boilerplate)
āāā tests/ # Comprehensive test suite
ā āāā test_create_project.py
āāā setup.py # Package configuration
āāā requirements.txt # Dependencies
Run the test suite:
pytest
The project includes 5 tests covering:
Fully functional features:
svelte-pi page).svelte-pi.yml)MIT License
Copyright (c) 2025 Ankur Taxali
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.