Skip to content

Commit 81731a8

Browse files
kwonah0claude
andcommitted
Add separate test scripts for config priority testing
- test-env-vars.sh: Test environment variables only - test-temp-config.sh: Test with temporary custom config file 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f6fbaec commit 81731a8

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

scripts/test-env-vars.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Test with environment variables only
4+
echo "🚀 Testing with environment variables only"
5+
echo "=========================================="
6+
7+
echo "Environment variables:"
8+
echo " DTUI_CFG__ai__shell__command=echo"
9+
echo " DTUI_CFG__ai__shell__args='[\"[ENV_VARS_ONLY]:\"]'"
10+
echo " DTUI_CFG__ai__shell__template='{command} {args} \"{prompt}\"'"
11+
echo ""
12+
echo "Expected output: [ENV_VARS_ONLY]: <your_message>"
13+
echo "Look for: 'No DTUI_USER_CONFIGFILE specified, skipping user config file stage'"
14+
echo ""
15+
echo "Press Ctrl+C to stop the app when done testing..."
16+
echo ""
17+
18+
# Launch with environment variables only
19+
DTUI_CFG__ai__shell__command=echo \
20+
DTUI_CFG__ai__shell__args='["[ENV_VARS_ONLY]:"]' \
21+
DTUI_CFG__ai__shell__template='{command} {args} "{prompt}"' \
22+
npm run electron

scripts/test-temp-config.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Test with temporary custom config file
4+
echo "🧪 Testing with temporary custom config file"
5+
echo "============================================"
6+
7+
# Create temporary config file
8+
TEMP_CONFIG="/tmp/dtui-temp-config-$(date +%s).json"
9+
cat > "$TEMP_CONFIG" << 'EOF'
10+
{
11+
"ai": {
12+
"provider": "shell",
13+
"shell": {
14+
"command": "echo",
15+
"args": ["[TEMP_CUSTOM_FILE]:"],
16+
"template": "{command} {args} \"{prompt}\"",
17+
"timeout": 12000,
18+
"outputFormat": {
19+
"useCodeBlock": true,
20+
"codeBlockSyntax": "bash"
21+
}
22+
}
23+
}
24+
}
25+
EOF
26+
27+
echo "Created temporary config: $TEMP_CONFIG"
28+
echo "Config contents:"
29+
echo "$(cat $TEMP_CONFIG)"
30+
echo ""
31+
echo "Expected output: [TEMP_CUSTOM_FILE]: <your_message>"
32+
echo "Look for: 'Loaded user config file: $TEMP_CONFIG'"
33+
echo ""
34+
echo "Press Ctrl+C to stop the app when done testing..."
35+
echo ""
36+
37+
# Launch with temporary config
38+
DTUI_USER_CONFIGFILE="$TEMP_CONFIG" npm run electron
39+
40+
# Clean up
41+
echo ""
42+
echo "Cleaning up temporary config file: $TEMP_CONFIG"
43+
rm -f "$TEMP_CONFIG"
44+
echo "✅ Cleanup completed"

0 commit comments

Comments
 (0)