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