@@ -1067,9 +1067,10 @@ assail:
10671067# ONBOARDING & DIAGNOSTICS
10681068# ═══════════════════════════════════════════════════════════════════════════════
10691069
1070- # Check all required toolchain dependencies and report health
1070+ # Check all required toolchain dependencies, versions, port, and build state
10711071doctor :
10721072 #!/usr/bin/env bash
1073+ set -euo pipefail
10731074 echo " ═══════════════════════════════════════════════════"
10741075 echo " BoJ Server Doctor — Toolchain Health Check"
10751076 echo " ═══════════════════════════════════════════════════"
@@ -1086,31 +1087,70 @@ doctor:
10861087 FAIL=$((FAIL + 1 ))
10871088 fi
10881089 }
1089- check " Idris2" idris2 " 0.7.0"
1090+ check_optional() {
1091+ local name=" $1" cmd=" $2" note=" $3"
1092+ if command -v " $cmd" >/ dev/ null 2 >&1 ; then
1093+ VER=$(" $cmd" --version 2 >&1 | head -1 || echo " available" )
1094+ echo " [OK] $name — $VER"
1095+ PASS=$((PASS + 1 ))
1096+ else
1097+ echo " [WARN] $name — not found ($note)"
1098+ WARN=$((WARN + 1 ))
1099+ fi
1100+ }
1101+ echo " Required tools:"
1102+ check " Deno" deno " 1.40+"
10901103 check " Zig" zig " 0.13"
1104+ check " Idris2" idris2 " 0.7.0"
10911105 check " V (vlang)" v " 0.4.4"
10921106 check " just" just " 1.25"
1093- # Optional tools
1094- if command -v cargo >/ dev/ null 2 >&1 ; then
1095- echo " [OK] Cargo (optional) — $(cargo --version 2>&1 | head -1)"
1096- PASS=$((PASS + 1 ))
1107+ check " git" git " 2.0+"
1108+ echo " "
1109+ echo " Optional tools:"
1110+ check_optional " Cargo" cargo " needed for tools/cartridge-minter"
1111+ check_optional " cloudflared" cloudflared " needed for tunnel"
1112+ check_optional " panic-attack" panic-attack " pre-commit scanner"
1113+ check_optional " podman" podman " container builds"
1114+ check_optional " trivy" trivy " vulnerability scanning"
1115+ check_optional " gitleaks" gitleaks " secret detection"
1116+ echo " "
1117+ echo " Port availability:"
1118+ if command -v ss >/ dev/ null 2 >&1 ; then
1119+ if ss -tlnp 2 >/ dev/ null | grep -q ' :7700 ' ; then
1120+ echo " [WARN] Port 7700 is in use (BoJ REST endpoint)"
1121+ WARN=$((WARN + 1 ))
1122+ else
1123+ echo " [OK] Port 7700 is available"
1124+ PASS=$((PASS + 1 ))
1125+ fi
1126+ elif command -v lsof >/ dev/ null 2 >&1 ; then
1127+ if lsof -i :7700 >/ dev/ null 2 >&1 ; then
1128+ echo " [WARN] Port 7700 is in use (BoJ REST endpoint)"
1129+ WARN=$((WARN + 1 ))
1130+ else
1131+ echo " [OK] Port 7700 is available"
1132+ PASS=$((PASS + 1 ))
1133+ fi
10971134 else
1098- echo " [WARN] Cargo (optional) — not found (needed for tools/cartridge-minter )"
1135+ echo " [WARN] Cannot check port (no ss or lsof )"
10991136 WARN=$((WARN + 1 ))
11001137 fi
1101- if command -v cloudflared >/ dev/ null 2 >&1 ; then
1102- echo " [OK] cloudflared (optional) — available"
1103- PASS=$((PASS + 1 ))
1138+ echo " "
1139+ echo " Build artefacts:"
1140+ if [ -d " ffi/zig/zig-out" ]; then
1141+ echo " [OK] ffi/zig/zig-out/ exists (catalogue FFI built)"
11041142 else
1105- echo " [WARN] cloudflared (optional) — not found (needed for tunnel)"
1106- WARN=$((WARN + 1 ))
1143+ echo " [INFO] ffi/zig/zig-out/ not found — run 'just build'"
11071144 fi
1108- if command -v panic-attack >/ dev/ null 2 >&1 ; then
1109- echo " [OK] panic-attack — available"
1110- PASS=$((PASS + 1 ))
1145+ if [ -f " adapter/v/boj-server" ]; then
1146+ echo " [OK] adapter/v/boj-server binary exists"
11111147 else
1112- echo " [WARN] panic-attack — not found (pre-commit scanner)"
1113- WARN=$((WARN + 1 ))
1148+ echo " [INFO] V-lang adapter not built — run 'just build-adapter'"
1149+ fi
1150+ if [ -d " src/abi/build" ]; then
1151+ echo " [OK] src/abi/build/ exists (Idris2 ABI compiled)"
1152+ else
1153+ echo " [INFO] Idris2 ABI not compiled — run 'just typecheck'"
11141154 fi
11151155 echo " "
11161156 echo " Result: $PASS passed, $FAIL failed, $WARN warnings"
@@ -1120,49 +1160,82 @@ doctor:
11201160 fi
11211161 echo " All required tools present."
11221162
1123- # Attempt to automatically install missing tools
1163+ # Attempt to fix common issues ( install deps, clear caches, rebuild FFI)
11241164heal :
11251165 #!/usr/bin/env bash
1166+ set -euo pipefail
11261167 echo " ═══════════════════════════════════════════════════"
11271168 echo " BoJ Server Heal — Automatic Tool Installation"
11281169 echo " ═══════════════════════════════════════════════════"
11291170 echo " "
1171+ HEALED=0
1172+ # --- Missing tool install instructions / attempts ---
1173+ if ! command -v deno >/ dev/ null 2 >&1 ; then
1174+ echo " Deno not found (REQUIRED — runtime & package manager)."
1175+ echo " curl -fsSL https://deno.land/install.sh | sh"
1176+ echo " Or via asdf: asdf plugin add deno && asdf install deno latest"
1177+ echo " "
1178+ fi
11301179 if ! command -v idris2 >/ dev/ null 2 >&1 ; then
1131- echo " Idris2 not found."
1180+ echo " Idris2 not found (REQUIRED — ABI definitions) ."
11321181 if command -v asdf >/ dev/ null 2 >&1 ; then
11331182 echo " Installing via asdf..."
1134- asdf install idris2 latest
1183+ asdf install idris2 latest || echo " asdf install failed — try: https://github.com/stefan-hoeck/idris2-pack"
11351184 else
1136- echo " Install manually : https://www.idris-lang.org/pages/download.html "
1185+ echo " Install via pack : https://github.com/stefan-hoeck/idris2-pack "
11371186 echo " Or via asdf: asdf plugin add idris2 && asdf install idris2 latest"
11381187 fi
1188+ echo " "
11391189 fi
11401190 if ! command -v zig >/ dev/ null 2 >&1 ; then
1141- echo " Zig not found."
1191+ echo " Zig not found (REQUIRED — FFI layer) ."
11421192 if command -v asdf >/ dev/ null 2 >&1 ; then
11431193 echo " Installing via asdf..."
1144- asdf install zig latest
1194+ asdf install zig latest || echo " asdf install failed — try: https://ziglang.org/download/"
11451195 else
11461196 echo " Install manually: https://ziglang.org/download/"
11471197 echo " Or via asdf: asdf plugin add zig && asdf install zig latest"
11481198 fi
1199+ echo " "
11491200 fi
11501201 if ! command -v v >/ dev/ null 2 >&1 ; then
1151- echo " V (vlang) not found."
1202+ echo " V (vlang) not found (REQUIRED — API triple adapter) ."
11521203 if command -v asdf >/ dev/ null 2 >&1 ; then
11531204 echo " Installing via asdf..."
1154- asdf install vlang latest
1205+ asdf install vlang latest || echo " asdf install failed — try: https://vlang.io"
11551206 else
11561207 echo " Install manually: https://vlang.io"
11571208 echo " Or via asdf: asdf plugin add vlang && asdf install vlang latest"
11581209 fi
1210+ echo " "
11591211 fi
11601212 if ! command -v just >/ dev/ null 2 >&1 ; then
11611213 echo " Installing just..."
11621214 cargo install just 2 >/ dev/ null || echo " Install cargo first, then: cargo install just"
1215+ echo " "
1216+ fi
1217+ if ! command -v panic-attack >/ dev/ null 2 >&1 ; then
1218+ echo " panic-attack not found (optional — pre-commit scans):"
1219+ echo " cargo install --git https://github.com/hyperpolymath/panic-attacker"
1220+ echo " "
1221+ fi
1222+ # --- Clear stale caches ---
1223+ echo " Clearing stale Zig caches..."
1224+ rm -rf ffi/ zig/ .zig-cache cartridges/ */ ffi/ .zig-cache 2 >/ dev/ null && HEALED=$((HEALED + 1 )) || true
1225+ echo " Cleared."
1226+ # --- Rebuild FFI if tools are present ---
1227+ if command -v zig >/ dev/ null 2 >&1 ; then
1228+ echo " "
1229+ echo " Rebuilding catalogue FFI..."
1230+ if (cd ffi/ zig && zig build 2 >/ dev/ null); then
1231+ echo " Catalogue FFI rebuilt successfully."
1232+ HEALED=$((HEALED + 1 ))
1233+ else
1234+ echo " Catalogue FFI rebuild failed — check 'just doctor' output."
1235+ fi
11631236 fi
11641237 echo " "
1165- echo " Heal complete . Run 'just doctor' to verify."
1238+ echo " Healed $HEALED items . Run 'just doctor' to verify."
11661239
11671240# Guided tour of the project structure and key concepts
11681241tour :
@@ -1212,45 +1285,71 @@ tour:
12121285 echo " "
12131286 echo " Read more: docs/ARCHITECTURE.md, QUICKSTART-USER.adoc"
12141287
1215- # Show help for common workflows
1288+ # Show help for common workflows, build commands, test commands, and doc links
12161289help-me :
12171290 #!/usr/bin/env bash
12181291 echo " ═══════════════════════════════════════════════════"
12191292 echo " BoJ Server — Common Workflows"
12201293 echo " ═══════════════════════════════════════════════════"
12211294 echo " "
12221295 echo " FIRST TIME SETUP:"
1223- echo " just doctor Check toolchain"
1224- echo " just heal Fix missing tools"
1296+ echo " just doctor Check toolchain health + port 7700 "
1297+ echo " just heal Fix missing tools, clear caches, rebuild FFI "
12251298 echo " just deps Verify dependencies"
1299+ echo " just tour Guided project tour"
12261300 echo " "
12271301 echo " BUILD & RUN:"
1228- echo " just build Build all Zig FFI layers"
1229- echo " just run Build + start server"
1302+ echo " just build Build all Zig FFI layers (catalogue + cartridges)"
1303+ echo " just build-release Build with optimizations"
1304+ echo " just build-adapter Build V-lang API triple adapter"
1305+ echo " just run Build + start server (REST 7700, gRPC 7701, GraphQL 7702)"
1306+ echo " just run-verbose Start with verbose output"
12301307 echo " just serve Server + Cloudflare tunnel"
1308+ echo " just tunnel Cloudflare quick tunnel only"
12311309 echo " "
12321310 echo " TEST & VERIFY:"
1233- echo " just test Run all FFI tests (18 suites)"
1234- echo " just test-smoke Quick smoke test"
1235- echo " just verify Full verification suite"
1311+ echo " just test Run all FFI tests (catalogue + 17 cartridges)"
1312+ echo " just test-verbose Run tests with verbose output"
1313+ echo " just test-smoke Quick smoke test (ABI check + catalogue test)"
1314+ echo " just readiness Component Readiness Grade tests"
1315+ echo " just bench Run benchmarks"
1316+ echo " just integration End-to-end integration tests"
1317+ echo " just verify Full verification (typecheck + zero believe_me + build + test)"
12361318 echo " just typecheck Type-check all Idris2 ABIs"
12371319 echo " just verify-no-believe-me Scan for unsound constructs"
12381320 echo " "
12391321 echo " QUALITY:"
12401322 echo " just quality All checks (fmt + lint + test)"
12411323 echo " just fmt Format all Zig source"
1324+ echo " just fmt-check Check formatting without changes"
12421325 echo " just lint Lint + typecheck"
1243- echo " just matrix Show cartridge status"
1326+ echo " just matrix Show cartridge capability status"
1327+ echo " "
1328+ echo " SECURITY:"
1329+ echo " just security Full security audit"
1330+ echo " just deps-audit Audit dependencies for vulnerabilities"
1331+ echo " just assail Run panic-attacker pre-commit scan"
12441332 echo " "
12451333 echo " CONTAINERS:"
12461334 echo " just container-build Build OCI image"
12471335 echo " just container-up Start compose stack"
12481336 echo " just container-down Stop compose stack"
12491337 echo " "
1250- echo " PRE-COMMIT:"
1251- echo " just assail Run panic-attacker scan"
1338+ echo " VALIDATION:"
1339+ echo " just validate Full RSR + STATE + AI install validation"
1340+ echo " just validate-rsr RSR compliance check"
12521341 echo " "
1253- echo " LEARN:"
1254- echo " just tour Guided project tour"
1255- echo " just info Project info"
1342+ echo " HOUSEKEEPING:"
1343+ echo " just clean Remove build artefacts"
1344+ echo " just clean-all Deep clean including caches"
1345+ echo " just docs Generate documentation"
1346+ echo " just info Project metadata"
12561347 echo " just default List all recipes"
1348+ echo " "
1349+ echo " DOCUMENTATION:"
1350+ echo " README.adoc Project overview"
1351+ echo " EXPLAINME.adoc Detailed claims and evidence"
1352+ echo " docs/AI_INSTALLATION_GUIDE.adoc AI-assisted setup guide"
1353+ echo " docs/ARCHITECTURE.md Architecture overview"
1354+ echo " QUICKSTART-USER.adoc Quick start for users"
1355+ echo " .machine_readable/STATE.a2ml Current project state"
0 commit comments