[Haik]: ckpt, abstracted the templates functionality and swap contents to be legit files

This commit is contained in:
haikdc
2026-04-05 16:58:14 -07:00
parent 61212c648d
commit bf217ec081
5 changed files with 26 additions and 25 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ from backend.apps.app_builder.App import (
)
from backend.config.paths import DB_ROOT
from backend.apps.app_builder.executor import execute_backend_code
from backend.apps.app_builder.templates import APP_BUILDER_SKILL, APP_BUILDER_TEMPLATE_FILES
from backend.apps.app_builder.templates.templates import APP_BUILDER_SKILL, APP_BUILDER_TEMPLATE_FILES
from backend.apps.app_builder.helpers import walk_directory
APP_BUILDER_DIR = os.path.join(DB_ROOT, "app_builder")
@@ -1,13 +1,3 @@
"""Default template files seeded into new App Builder workspaces."""
import os
_SKILL_PATH = os.path.join(os.path.dirname(__file__), "app_builder_skill.md")
with open(_SKILL_PATH) as _f:
APP_BUILDER_SKILL = _f.read()
APP_BUILDER_TEMPLATE_INDEX = """\
<!DOCTYPE html>
<html lang="en">
<head>
@@ -47,17 +37,4 @@ APP_BUILDER_TEMPLATE_INDEX = """\
<script>
</script>
</body>
</html>
"""
APP_BUILDER_TEMPLATE_META = """\
{
"name": "",
"description": ""
}
"""
APP_BUILDER_TEMPLATE_FILES = {
"index.html": APP_BUILDER_TEMPLATE_INDEX,
"meta.json": APP_BUILDER_TEMPLATE_META,
}
</html>
@@ -0,0 +1,4 @@
{
"name": "",
"description": ""
}
@@ -0,0 +1,20 @@
"""Default template files seeded into new App Builder workspaces."""
import os
from typing import Dict
from typeguard import typechecked
P_SELF_DIR = os.path.dirname(__file__)
P_CONTENT_DIR = os.path.join(P_SELF_DIR, "content")
@typechecked
def p_read(filename: str) -> str:
with open(os.path.join(P_CONTENT_DIR, filename)) as f:
return f.read()
APP_BUILDER_SKILL: str = p_read("app_builder_skill.md")
APP_BUILDER_TEMPLATE_FILES: Dict[str, str] = {
"index.html": p_read("template_index.html"),
"meta.json": p_read("template_meta.json"),
}