verstak/docs/TEMPLATES.md

59 lines
2.2 KiB
Markdown

# Template System
## What is a Template?
A template defines the **type**, **default structure**, and **available modules**
for a Node. Every workspace node is created from a template.
## System Templates
Verstak ships with these built-in (system) templates:
| ID | Type | Default Modules | Default Files | Default Folders |
|---|---|---|---|---|
| `folder.default` | folder | overview, children, activity | — | — |
| `project.default` | project | overview, notes, files, activity, actions, worklog | Overview.md | Documents, Notes, Files |
| `client.default` | client | overview, notes, files, activity, actions | Overview.md | Notes, Files |
| `document.default` | document | overview, files, activity | — | — |
| `recipe.default` | recipe | overview, notes, files, activity | Overview.md | — |
## Template Structure
```json
{
"id": "project.default",
"title": "Проект",
"type": "project",
"enabled": true,
"system": true,
"icon": "project",
"default_modules": ["overview", "notes", "files", "activity", "actions", "worklog"],
"default_files": [
{"path": "Overview.md", "content_template": "project_overview"}
],
"default_folders": ["Documents", "Notes", "Files"],
"allowed_parent_types": ["folder", "root"],
"allowed_child_templates": ["*"]
}
```
## How Templates Drive the UI
1. The creation menu is built from **enabled templates**.
2. When you right-click a node, you see "Create inside" → [list of enabled templates].
3. Selecting a template creates a Node with that template's type and defaults.
4. Disabling a template removes it from the creation menu.
## Template Fields
- **id** — unique identifier
- **title** — i18n key for display name
- **type** — technical type (folder, project, client, etc.)
- **enabled** — whether it appears in the creation menu
- **system** — whether it's a built-in template
- **default_modules** — which tabs/modules are available in the node view
- **default_files** — files to create inside the node folder
- **default_folders** — subfolders to create inside the node folder
- **allowed_parent_types** — which node types can be parents of this template
- **allowed_child_templates** — which templates are allowed as children ("*" = any)