AtlatestRepositorysigil-web-styles
sigil-web-styles / tree / build / dev / lib / _pkg / sigil-buildgetting-started.md
2
# Getting Started4
> Creating new Sigil projects with `sigil init`.6
## Creating a New Project8
Use `sigil init` to create a new project:10
```bash11
sigil init my-project12
```14
This creates a new directory `my-project/` with a basic project structure.16
## Project Templates18
Sigil provides several templates for different project types:20
```bash21
sigil init my-app # Application with entry point (default template)22
sigil init my-lib --template library # Reusable library with exports23
sigil init my-cli --template cli # Command-line tool with argument parsing24
sigil init my-game --template game # Game project with graphics/audio setup25
```27
### Template: default29
Creates a simple application:31
```32
my-app/33
├── package.sgl # Package definition34
├── README.md # Project documentation35
└── src/36
└── my-app/37
└── main.sgl # Entry point module38
```40
### Template: library42
Creates a library package:44
```45
my-lib/46
├── package.sgl47
├── README.md48
├── src/49
│ └── my-lib.sgl # Main library module50
└── test/51
└── test-my-lib.sgl52
```54
### Template: cli56
Creates a CLI application with argument parsing:58
```59
my-cli/60
├── package.sgl61
├── README.md62
└── src/63
└── my-cli/64
└── main.sgl # CLI with sigil/args65
```67
## Package File Format69
The `package.sgl` file defines your project:71
```scheme72
(package73
name: "my-app"74
version: "0.1.0"75
description: "My application"76
license: "MIT"78
;; Entry point for executable apps79
;; The module must export a 'main' procedure80
entry: '(my-app main)82
;; Dependencies from the Sigil ecosystem83
dependencies: (list84
(from-workspace name: "sigil-stdlib")))85
```87
### Entry Point89
The `entry:` field specifies which module to run when the application starts:91
- Format: `'(module-name)` - a quoted list of symbols representing the module92
- The module must export a `main` procedure that takes no arguments93
- Example: `entry: '(my-app main)` runs the `main` procedure from `(my-app main)` module95
### Module Naming Convention97
Module names follow the directory structure under `src/`:99
| File Path | Module Name |100
|-----------|-------------|101
| `src/my-app/main.sgl` | `(my-app main)` |102
| `src/my-app.sgl` | `(my-app)` |103
| `src/my-app/utils.sgl` | `(my-app utils)` |105
## Running Your Project107
After creating a project:109
```bash110
cd my-project111
sigil run # Build and run the app112
sigil test # Run tests (if any)113
```115
The `sigil run` command automatically builds any out-of-date modules before running.117
For a release build (standalone executable):119
```bash120
sigil build --config release # Create release build121
./build/release/bin/my-project # Run the release build122
```124
## Example: Hello World Application126
```bash127
sigil init hello-world128
cd hello-world129
```131
Edit `src/hello-world/main.sgl`:133
```scheme134
(define-library (hello-world main)135
(export main)136
(begin137
(define (main)138
(println "Hello, World!"))))139
```141
Build and run:143
```bash144
sigil run145
# Output: Hello, World!146
```