Skip to main content

systemprompt_cli/commands/cloud/init/
templates.rs

1//! Default file contents used when scaffolding a new project.
2//!
3//! Each function returns the body of one generated service config, web
4//! template, or starter content file written by `super::scaffolding`.
5
6pub fn root_config() -> String {
7    r#"# systemprompt.io Services Configuration
8settings:
9  agent_port_range: [3100, 3199]
10  mcp_port_range: [3200, 3299]
11  auto_start_enabled: true
12  validation_strict: false
13  schema_validation_mode: "warn"
14"#
15    .to_owned()
16}
17
18pub fn agent_config(project_name: &str) -> String {
19    format!(
20        r#"# Assistant Agent Configuration
21endpoint: assistant
22port: 3100
23enabled: true
24default: true
25
26card:
27  display_name: "{} Assistant"
28  description: "AI assistant powered by systemprompt.io"
29  version: "1.0.0"
30
31metadata:
32  mcp_servers: []
33  skills: []
34
35prompt:
36  system: |
37    You are a helpful AI assistant.
38"#,
39        project_name
40    )
41}
42
43pub fn admin_agent_config() -> String {
44    r#"# Admin Agent Configuration
45endpoint: admin
46port: 3101
47enabled: true
48default: false
49
50card:
51  display_name: "Admin Agent"
52  description: "Administrative agent for system management"
53  version: "1.0.0"
54
55metadata:
56  mcp_servers:
57    - systemprompt-admin
58  skills: []
59
60prompt:
61  system: |
62    You are an administrative assistant with access to system tools.
63"#
64    .to_owned()
65}
66
67pub fn admin_mcp_config() -> String {
68    r#"# systemprompt.io Admin MCP Server
69endpoint: systemprompt-admin
70port: 3200
71enabled: true
72binary: "cargo"
73path: "services/mcp/systemprompt-admin"
74display_in_web: false
75
76oauth:
77  required: true
78  scopes: ["admin"]
79"#
80    .to_owned()
81}
82
83pub fn ai_config(default_provider: &str) -> String {
84    let seed = systemprompt_models::profile::ProviderRegistry::default_seed().ok();
85    let default_model = |provider: &str| -> String {
86        seed.as_ref()
87            .and_then(|registry| registry.find_provider(provider))
88            .and_then(|entry| entry.models.first())
89            .map(|model| model.id.as_str().to_owned())
90            .unwrap_or_default()
91    };
92    format!(
93        r#"# AI Configuration
94default_provider: "{provider}"
95
96providers:
97  anthropic:
98    enabled: true
99    default_model: "{anthropic}"
100
101  openai:
102    enabled: true
103    default_model: "{openai}"
104
105  gemini:
106    enabled: true
107    default_model: "{gemini}"
108"#,
109        provider = default_provider,
110        anthropic = default_model("anthropic"),
111        openai = default_model("openai"),
112        gemini = default_model("gemini"),
113    )
114}
115
116pub fn content_config() -> String {
117    r#"# Content Configuration
118# Define content sources for your project
119# Example:
120#   content_sources:
121#     blog:
122#       enabled: true
123#       path: "content/blog"
124#       source_id: "blog"
125#       category_id: "articles"
126#       description: "Blog posts"
127
128content_sources: {}
129"#
130    .to_owned()
131}
132
133pub fn web_config(project_name: &str) -> String {
134    format!(
135        "# Web Configuration\nbranding:\n  site_name: \"{}\"\n  primary_color: \"#3b82f6\"\n",
136        project_name
137    )
138}
139
140pub fn web_metadata(project_name: &str) -> String {
141    format!(
142        r#"# Web Metadata
143site:
144  title: "{}"
145  description: "Powered by systemprompt.io"
146"#,
147        project_name
148    )
149}
150
151pub fn scheduler_config() -> String {
152    r"# Scheduler Configuration
153enabled: false
154jobs: []
155"
156    .to_owned()
157}
158
159pub fn page_template() -> String {
160    r"<!DOCTYPE html>
161<html>
162<head>
163    <title>{{ title }}</title>
164</head>
165<body>
166    <main>{{ content }}</main>
167</body>
168</html>
169"
170    .to_owned()
171}
172
173pub fn blog_post_template() -> String {
174    r"<!DOCTYPE html>
175<html>
176<head>
177    <title>{{ title }}</title>
178</head>
179<body>
180    <article>
181        <h1>{{ title }}</h1>
182        <time>{{ date }}</time>
183        <div>{{ content }}</div>
184    </article>
185</body>
186</html>
187"
188    .to_owned()
189}
190
191pub fn blog_list_template() -> String {
192    r#"<!DOCTYPE html>
193<html>
194<head>
195    <title>Blog</title>
196</head>
197<body>
198    <h1>Blog</h1>
199    <ul>
200    {% for post in posts %}
201        <li><a href="{{ post.url }}">{{ post.title }}</a></li>
202    {% endfor %}
203    </ul>
204</body>
205</html>
206"#
207    .to_owned()
208}
209
210pub fn page_list_template() -> String {
211    r#"<!DOCTYPE html>
212<html>
213<head>
214    <title>Pages</title>
215</head>
216<body>
217    <h1>Pages</h1>
218    <ul>
219    {% for page in pages %}
220        <li><a href="{{ page.url }}">{{ page.title }}</a></li>
221    {% endfor %}
222    </ul>
223</body>
224</html>
225"#
226    .to_owned()
227}
228
229pub fn welcome_blog_post(project_name: &str) -> String {
230    format!(
231        r"---
232title: Welcome to {}
233date: 2024-01-01
234description: Getting started with your new project
235---
236
237# Welcome
238
239This is your first blog post. Edit or delete this file to get started.
240",
241        project_name
242    )
243}
244
245pub fn privacy_policy(project_name: &str) -> String {
246    format!(
247        r"---
248title: Privacy Policy
249---
250
251# Privacy Policy
252
253This is a placeholder privacy policy for {}.
254",
255        project_name
256    )
257}
258
259pub fn cookie_policy(project_name: &str) -> String {
260    format!(
261        r"---
262title: Cookie Policy
263---
264
265# Cookie Policy
266
267This is a placeholder cookie policy for {}.
268",
269        project_name
270    )
271}