Skip to content

Commit 70b41f1

Browse files
authored
Merge pull request #34 from clement-lucas/main
Recommend 3 fixes to the code (fix connection using Entra ID, fix Windows compatibility, fix missing .NET 10 in McpChatWeb)
2 parents 99b2678 + b481319 commit 70b41f1

File tree

3 files changed

+39
-16
lines changed

3 files changed

+39
-16
lines changed

McpChatWeb/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ string ResolvePath(string path) => Path.IsPathFullyQualified(path)
5151

5252
if (string.IsNullOrWhiteSpace(options.AssemblyPath))
5353
{
54-
var candidateFrameworks = new[] { "net9.0", "net8.0" };
54+
var candidateFrameworks = new[] { "net10.0", "net9.0", "net8.0" };
5555
foreach (var framework in candidateFrameworks)
5656
{
5757
var candidate = Path.Combine(repoRoot, "bin", buildConfiguration, framework, "CobolToQuarkusMigration.dll");

Processes/RunMcpServerProcess.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,21 @@ public RunMcpServerProcess(IMigrationRepository repository, int runId, ILogger<R
5454
if (string.IsNullOrWhiteSpace(chatDeployment)) chatDeployment = _aiSettings?.DeploymentName;
5555
if (string.IsNullOrWhiteSpace(chatDeployment)) chatDeployment = _aiSettings?.ModelId;
5656

57-
if (!string.IsNullOrEmpty(chatEndpoint) && !string.IsNullOrEmpty(chatApiKey) && !string.IsNullOrEmpty(chatDeployment))
57+
if (!string.IsNullOrEmpty(chatEndpoint) && !string.IsNullOrEmpty(chatDeployment))
5858
{
5959
try
6060
{
61+
bool useEntraId = string.IsNullOrEmpty(chatApiKey) || chatApiKey.Contains("your-api-key");
6162
_chatClient = ChatClientFactory.CreateChatClient(
6263
chatEndpoint,
63-
chatApiKey,
64+
chatApiKey ?? string.Empty,
6465
chatDeployment,
65-
useDefaultCredential: false,
66+
useDefaultCredential: useEntraId,
6667
_logger);
6768

6869
_modelId = chatDeployment;
69-
_logger.LogInformation("IChatClient initialized for custom Q&A with model {ModelId}", _modelId);
70+
_logger.LogInformation("IChatClient initialized for custom Q&A with model {ModelId} ({AuthMode})",
71+
_modelId, useEntraId ? "Entra ID" : "API Key");
7072
}
7173
catch (Exception ex)
7274
{

doctor.sh

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ MAGENTA='\033[0;35m'
1414
BOLD='\033[1m'
1515
NC='\033[0m' # No Color
1616

17+
# Resolve the sqlite3 command, handling Windows (Git Bash / MSYS2) paths
18+
SQLITE3_CMD=""
19+
resolve_sqlite3() {
20+
if [ -n "$SQLITE3_CMD" ]; then return 0; fi
21+
if command -v sqlite3 >/dev/null 2>&1; then
22+
SQLITE3_CMD="sqlite3"
23+
elif command -v sqlite3.exe >/dev/null 2>&1; then
24+
SQLITE3_CMD="sqlite3.exe"
25+
else
26+
local winget_match
27+
winget_match=$(find "${LOCALAPPDATA:-/dev/null}/Microsoft/WinGet/Packages" -name "sqlite3.exe" 2>/dev/null | head -1)
28+
if [ -n "$winget_match" ]; then
29+
SQLITE3_CMD="$winget_match"
30+
fi
31+
fi
32+
[ -n "$SQLITE3_CMD" ]
33+
}
34+
1735
# Get repository root (directory containing this script)
1836
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1937

@@ -885,10 +903,11 @@ run_doctor() {
885903
generate_migration_report() {
886904
echo -e "${BLUE}📝 Generating Migration Report...${NC}"
887905

888-
if ! command -v sqlite3 >/dev/null 2>&1; then
906+
if ! resolve_sqlite3; then
889907
echo -e "${RED}❌ sqlite3 is not installed. Install it to generate reports.${NC}"
890-
echo -e "${YELLOW} macOS: brew install sqlite3${NC}"
891-
echo -e "${YELLOW} Linux: sudo apt install sqlite3${NC}"
908+
echo -e "${YELLOW} macOS: brew install sqlite3${NC}"
909+
echo -e "${YELLOW} Linux: sudo apt install sqlite3${NC}"
910+
echo -e "${YELLOW} Windows: winget install SQLite.SQLite (then restart your terminal)${NC}"
892911
return 1
893912
fi
894913

@@ -900,7 +919,7 @@ generate_migration_report() {
900919
fi
901920

902921
# Get the latest run ID
903-
local run_id=$(sqlite3 "$db_path" "SELECT MAX(run_id) FROM cobol_files;")
922+
local run_id=$($SQLITE3_CMD "$db_path" "SELECT MAX(run_id) FROM cobol_files;")
904923

905924
if [ -z "$run_id" ]; then
906925
echo -e "${RED}❌ No migration runs found in database${NC}"
@@ -925,7 +944,7 @@ generate_migration_report() {
925944
echo "## 📊 Migration Summary"
926945
echo ""
927946

928-
sqlite3 "$db_path" <<SQL
947+
$SQLITE3_CMD "$db_path" <<SQL
929948
.mode markdown
930949
.headers off
931950
SELECT '- **Total COBOL Files:** ' || COUNT(DISTINCT file_name) FROM cobol_files WHERE run_id = $run_id;
@@ -935,7 +954,7 @@ SQL
935954

936955
echo ""
937956

938-
sqlite3 "$db_path" <<SQL
957+
$SQLITE3_CMD "$db_path" <<SQL
939958
.mode markdown
940959
.headers off
941960
SELECT '- **Total Dependencies:** ' || COUNT(*) FROM dependencies WHERE run_id = $run_id;
@@ -956,7 +975,7 @@ SQL
956975
echo "## 📁 File Inventory"
957976
echo ""
958977

959-
sqlite3 "$db_path" <<SQL
978+
$SQLITE3_CMD "$db_path" <<SQL
960979
.mode markdown
961980
.headers on
962981
SELECT file_name AS 'File Name', file_path AS 'Path', is_copybook AS 'Is Copybook'
@@ -972,7 +991,7 @@ SQL
972991
echo "## 🔗 Dependency Relationships"
973992
echo ""
974993

975-
sqlite3 "$db_path" <<SQL
994+
$SQLITE3_CMD "$db_path" <<SQL
976995
.mode markdown
977996
.headers on
978997
SELECT source_file AS 'Source', target_file AS 'Target', dependency_type AS 'Type',
@@ -2068,9 +2087,10 @@ check_chunking_health() {
20682087
if [[ -f "$db_path" ]]; then
20692088
local tables=("chunk_metadata" "forward_references" "signatures" "type_mappings")
20702089
for table in "${tables[@]}"; do
2071-
local exists=$(sqlite3 "$db_path" "SELECT name FROM sqlite_master WHERE type='table' AND name='$table';" 2>/dev/null)
2090+
resolve_sqlite3 2>/dev/null
2091+
local exists=$($SQLITE3_CMD "$db_path" "SELECT name FROM sqlite_master WHERE type='table' AND name='$table';" 2>/dev/null)
20722092
if [[ -n "$exists" ]]; then
2073-
local count=$(sqlite3 "$db_path" "SELECT COUNT(*) FROM $table;" 2>/dev/null)
2093+
local count=$($SQLITE3_CMD "$db_path" "SELECT COUNT(*) FROM $table;" 2>/dev/null)
20742094
echo -e " ${GREEN}$table${NC} ($count rows)"
20752095
else
20762096
echo -e " ${YELLOW}⚠️ $table not found (created on first chunked run)${NC}"
@@ -2107,7 +2127,8 @@ check_chunking_health() {
21072127
# Check 5: Recent chunk activity
21082128
echo -e "${CYAN}5. Recent Chunk Activity${NC}"
21092129
if [[ -f "$db_path" ]]; then
2110-
local recent=$(sqlite3 "$db_path" "
2130+
resolve_sqlite3 2>/dev/null
2131+
local recent=$($SQLITE3_CMD "$db_path" "
21112132
SELECT run_id, source_file,
21122133
COUNT(*) as chunks,
21132134
SUM(CASE WHEN status='Completed' THEN 1 ELSE 0 END) as completed,

0 commit comments

Comments
 (0)