Overview
Thekosh init command scaffolds a new Kosh static site with the essential directory structure, configuration file, and a starter post.
Usage
Arguments
Optional project name. If provided, creates the project in a subdirectory with that name. If omitted, initializes in the current directory.
What Gets Created
Theinit command creates the following structure:
Generated Files
kosh.yaml
A minimal configuration file with sensible defaults:internal/scaffold/scaffold.go:9-34
content/hello-world.md
A welcome post with instructions for installing a theme and running the dev server:internal/scaffold/scaffold.go:36-70
Behavior
Existing kosh.yaml
Existing kosh.yaml
If This prevents accidentally overwriting your configuration.
kosh.yaml already exists in the target directory, the init command skips creating it and prints a warning:Existing content/hello-world.md
Existing content/hello-world.md
If the first post already exists, it is skipped silently to avoid overwriting your content.
Directory Creation
Directory Creation
All directories are created with
0755 permissions (rwxr-xr-x), ensuring the owner has full access and others can read and execute.Examples
Initialize in Current Directory
Initialize with Project Name
my-blog/ directory with the full project structure.
Next Steps
After runningkosh init, you need to install a theme before building:
Start Development Server
http://localhost:2604 with live reload.Related Commands
kosh build- Build the static sitekosh serve- Start development serverkosh new- Create a new post
Source Code
Implementation:internal/scaffold/scaffold.go:73-115