Skip to content

Commit 8e75266

Browse files
committed
Update evals for new sdk UI template (vite)
1 parent 49dd7c4 commit 8e75266

File tree

6 files changed

+106
-27
lines changed

6 files changed

+106
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,4 @@ klaudbiusz/results_*/**
188188
klaudbiusz/results/**
189189
klaudbiusz/results_latest
190190
klaudbiusz/app copy/**
191+
klaudbiusz/app-tmp/**
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
#!/bin/bash
2-
set -e
2+
# Don't use set -e - handle errors gracefully
33

44
# DBX SDK template: Build the application
55
# For DBX SDK, we build from root package.json
66

77
echo "Building application..." >&2
88

9-
if [ -f "package.json" ]; then
10-
if grep -q '"build"' package.json 2>/dev/null; then
11-
echo "Building from root..." >&2
12-
npm run build
13-
echo "✅ Build successful" >&2
14-
else
15-
echo "⚠️ No build script found in package.json" >&2
16-
fi
9+
if [ ! -f "package.json" ]; then
10+
echo "❌ No package.json found" >&2
11+
exit 1
12+
fi
13+
14+
if ! grep -q '"build"' package.json 2>/dev/null; then
15+
echo "⚠️ No build script found in package.json - skipping" >&2
16+
exit 0
17+
fi
18+
19+
echo "Building from root..." >&2
20+
if npm run build 2>&1; then
21+
echo "✅ Build successful" >&2
22+
exit 0
1723
else
18-
echo "⚠️ No package.json found" >&2
24+
echo "❌ Build failed" >&2
25+
exit 1
1926
fi
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
#!/bin/bash
2-
set -e
2+
# Don't use set -e
33

44
# DBX SDK template: Install dependencies
55
# This template has a single root package.json
66

77
echo "Installing dependencies..." >&2
88

9-
if [ -f "package.json" ]; then
10-
npm install
9+
if [ ! -f "package.json" ]; then
10+
echo "❌ No package.json found" >&2
11+
exit 1
12+
fi
13+
14+
if npm install 2>&1; then
1115
echo "✅ Dependencies installed" >&2
16+
exit 0
1217
else
13-
echo "⚠️ No package.json found" >&2
18+
echo "❌ Dependency installation failed" >&2
1419
exit 1
1520
fi
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
#!/bin/bash
2+
# Don't use set -e
23

34
# DBX SDK template test script
4-
# DBX SDK apps don't have test infrastructure in the template
5+
echo "Running tests..." >&2
56

6-
echo "❌ DBX SDK template does not include test infrastructure" >&2
7-
exit 1
7+
# Check if test script exists in package.json
8+
if [ -f "package.json" ] && grep -q '"test"' package.json 2>/dev/null && ! grep -q '"test": *".*echo.*Error.*no test.*"' package.json 2>/dev/null; then
9+
if npm test 2>&1; then
10+
echo "✅ Tests passed" >&2
11+
exit 0
12+
else
13+
echo "❌ Tests failed" >&2
14+
exit 1
15+
fi
16+
else
17+
echo "No tests configured - skipping" >&2
18+
exit 0
19+
fi
Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
#!/bin/bash
2-
set -e
2+
# Don't use set -e
33

44
# DBX SDK template typecheck script
55
# Runs TypeScript type checking using npm run check or tsc directly
66

7-
# Source common functions
8-
source "$(dirname "$0")/common.sh"
9-
10-
# Install dependencies if needed
11-
install_dependencies
7+
echo "Running type check..." >&2
128

139
# Verify package.json exists
1410
if [ ! -f "package.json" ]; then
15-
echo "Error: No package.json found" >&2
11+
echo "❌ No package.json found" >&2
1612
exit 1
1713
fi
1814

1915
# Check if npm run check is available (standard for DBX SDK)
2016
if grep -q '"check"' package.json 2>/dev/null; then
21-
exec npm run check
17+
if npm run check 2>&1 >/dev/null; then
18+
echo "✅ Type check passed" >&2
19+
exit 0
20+
else
21+
echo "❌ Type check failed" >&2
22+
exit 1
23+
fi
2224
else
2325
# Fallback: run tsc directly
24-
exec npx tsc --noEmit --skipLibCheck
26+
if npx tsc --noEmit --skipLibCheck 2>&1 >/dev/null; then
27+
echo "✅ Type check passed" >&2
28+
exit 0
29+
else
30+
echo "❌ Type check failed" >&2
31+
exit 1
32+
fi
2533
fi

klaudbiusz/cli/template_detection.py

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def detect_template(app_dir: Path) -> str:
1616
app_dir: Path to the application directory
1717
1818
Returns:
19-
Template type: "dbx-sdk", "trpc", or "unknown"
19+
Template type: "dbx-sdk", "trpc", "vite", or "unknown"
2020
"""
2121
# DBX SDK markers (new template)
2222
if _is_dbx_sdk_app(app_dir):
@@ -26,6 +26,10 @@ def detect_template(app_dir: Path) -> str:
2626
if _is_trpc_app(app_dir):
2727
return "trpc"
2828

29+
# Vite markers (simple frontend apps)
30+
if _is_vite_app(app_dir):
31+
return "vite"
32+
2933
return "unknown"
3034

3135

@@ -87,6 +91,39 @@ def _is_trpc_app(app_dir: Path) -> bool:
8791
return score >= 2
8892

8993

94+
def _is_vite_app(app_dir: Path) -> bool:
95+
"""Check if app uses Vite template (simple frontend apps)."""
96+
score = 0
97+
98+
# Check for vite.config.ts/js
99+
if (app_dir / "vite.config.ts").exists() or (app_dir / "vite.config.js").exists():
100+
score += 2
101+
102+
# Check for single root package.json (not monorepo)
103+
root_pkg = app_dir / "package.json"
104+
if root_pkg.exists():
105+
try:
106+
import json
107+
pkg_content = json.loads(root_pkg.read_text())
108+
# Check for vite in devDependencies
109+
dev_deps = pkg_content.get("devDependencies", {})
110+
if "vite" in dev_deps:
111+
score += 2
112+
# Check for typical Vite scripts
113+
scripts = pkg_content.get("scripts", {})
114+
if "dev" in scripts and "vite" in scripts.get("dev", ""):
115+
score += 1
116+
except:
117+
pass
118+
119+
# Check that it's NOT a monorepo (no separate server/client package.json files)
120+
if not (app_dir / "server" / "package.json").exists() and not (app_dir / "client" / "package.json").exists():
121+
score += 1
122+
123+
# Need at least 2 indicators
124+
return score >= 2
125+
126+
90127
def get_template_info(template: str) -> dict:
91128
"""
92129
Get template-specific configuration.
@@ -115,6 +152,15 @@ def get_template_info(template: str) -> dict:
115152
"api_pattern": "/api/trpc/{procedure}",
116153
"sql_location": "inline", # SQL embedded in TypeScript
117154
}
155+
elif template == "vite":
156+
return {
157+
"backend_dirs": [], # Frontend-only
158+
"frontend_dirs": ["src"],
159+
"entry_points": ["src/main.tsx", "src/main.ts", "src/index.tsx", "src/index.ts"],
160+
"package_json_location": "root",
161+
"api_pattern": "none", # No backend
162+
"sql_location": "none", # No SQL
163+
}
118164
else:
119165
# Fallback: try all common patterns
120166
return {

0 commit comments

Comments
 (0)