feat(joinir): Phase 213-2 Step 2-2 & 2-3 Data structure extensions

Extended PatternPipelineContext and CarrierUpdateInfo for Pattern 3 AST-based generalization.

Changes:
1. PatternPipelineContext:
   - Added loop_condition: Option<ASTNode>
   - Added loop_body: Option<Vec<ASTNode>>
   - Added loop_update_summary: Option<LoopUpdateSummary>
   - Updated build_pattern_context() for Pattern 3

2. CarrierUpdateInfo:
   - Added then_expr: Option<ASTNode>
   - Added else_expr: Option<ASTNode>
   - Updated analyze_loop_updates() with None defaults

Status: Phase 213-2 Steps 2-2 & 2-3 complete
Next: Create Pattern3IfAnalyzer to extract if statement and populate update summary
This commit is contained in:
nyash-codex
2025-12-10 00:01:53 +09:00
parent 577b5b01d5
commit d7805e5974
138 changed files with 3529 additions and 378 deletions

View File

@ -5,6 +5,12 @@
# set -eは使わない個々のテストが失敗しても全体を続行するため
set -uo pipefail
# Canonical CLI binary (hakorune). Fallback to legacy nyash if only that exists.
NYASH_BIN_RESOLVED="${NYASH_BIN:-./target/release/hakorune}"
if [ ! -f "$NYASH_BIN_RESOLVED" ] && [ -f "./target/release/nyash" ]; then
NYASH_BIN_RESOLVED="./target/release/nyash"
fi
# プリフライトチェック実行
preflight_all() {
echo "[INFO] Starting preflight checks..." >&2
@ -15,9 +21,9 @@ preflight_all() {
return 1
fi
# Nyashビルド確認
# Hakorune (CLI) ビルド確認
if ! preflight_nyash_build; then
echo "[ERROR] Nyash build check failed" >&2
echo "[ERROR] Hakorune build check failed" >&2
return 1
fi
@ -66,31 +72,31 @@ preflight_basic_env() {
return 0
}
# Nyashビルド確認
# Hakorune/CLI ビルド確認
preflight_nyash_build() {
local nyash_exe="./target/release/nyash"
local nyash_exe="$NYASH_BIN_RESOLVED"
# バイナリ存在確認
if [ ! -f "$nyash_exe" ]; then
echo "[ERROR] Nyash executable not found: $nyash_exe" >&2
echo "[INFO] Run 'cargo build --release' to build Nyash" >&2
echo "[ERROR] Hakorune executable not found: $nyash_exe" >&2
echo "[INFO] Run 'cargo build --release' to build Hakorune (Stage0 CLI)" >&2
return 1
fi
# バイナリ実行可能性確認
if [ ! -x "$nyash_exe" ]; then
echo "[ERROR] Nyash executable is not executable: $nyash_exe" >&2
echo "[ERROR] Hakorune executable is not executable: $nyash_exe" >&2
chmod +x "$nyash_exe" 2>/dev/null || true
if [ ! -x "$nyash_exe" ]; then
echo "[ERROR] Failed to make executable" >&2
return 1
fi
echo "[INFO] Made Nyash executable" >&2
echo "[INFO] Made Hakorune executable" >&2
fi
# 基本動作確認
if ! "$nyash_exe" --version >/dev/null 2>&1; then
echo "[ERROR] Nyash version check failed" >&2
echo "[ERROR] Hakorune version check failed" >&2
echo "[INFO] Binary may be corrupted, try rebuilding" >&2
return 1
fi
@ -111,7 +117,7 @@ preflight_nyash_build() {
echo "[WARN] Cranelift JIT: Not available in this build" >&2
fi
echo "[INFO] Nyash build: OK" >&2
echo "[INFO] Hakorune build: OK" >&2
return 0
}
@ -138,11 +144,11 @@ preflight_plugins() {
# Provider Verify段階導入: nyash.toml の [verify.required_methods] / [types.*.required_methods]
# 既定 warn。SMOKES_PROVIDER_VERIFY_MODE=strict でエラー化。
local verify_mode="${SMOKES_PROVIDER_VERIFY_MODE:-warn}"
if [ -f "./target/release/nyash" ]; then
if [ -f "$NYASH_BIN_RESOLVED" ]; then
local tmp_preflight
tmp_preflight="/tmp/nyash_preflight_empty_$$.ny"
echo "/* preflight */" > "$tmp_preflight"
if NYASH_PROVIDER_VERIFY="$verify_mode" ./target/release/nyash "$tmp_preflight" >/dev/null 2>&1; then
if NYASH_PROVIDER_VERIFY="$verify_mode" "$NYASH_BIN_RESOLVED" "$tmp_preflight" >/dev/null 2>&1; then
echo "[INFO] Provider verify ($verify_mode): OK" >&2
else
if [ "$verify_mode" = "strict" ]; then
@ -230,10 +236,10 @@ EOF
echo ""
# Nyash情報
if [ -f "./target/release/nyash" ]; then
echo "Nyash: $(./target/release/nyash --version 2>&1 | head -n1)"
echo "Features: $(./target/release/nyash --version 2>&1 | grep features || echo 'default')"
# Hakorune情報
if [ -f "$NYASH_BIN_RESOLVED" ]; then
echo "Hakorune: $("$NYASH_BIN_RESOLVED" --version 2>&1 | head -n1)"
echo "Features: $("$NYASH_BIN_RESOLVED" --version 2>&1 | grep features || echo 'default')"
fi
echo ""
@ -244,10 +250,10 @@ EOF
preflight_repair() {
echo "[INFO] Attempting automatic repairs..." >&2
# Nyashバイナリの実行権限修復
if [ -f "./target/release/nyash" ] && [ ! -x "./target/release/nyash" ]; then
chmod +x "./target/release/nyash" 2>/dev/null || true
echo "[INFO] Fixed Nyash executable permissions" >&2
# Hakoruneバイナリの実行権限修復
if [ -f "$NYASH_BIN_RESOLVED" ] && [ ! -x "$NYASH_BIN_RESOLVED" ]; then
chmod +x "$NYASH_BIN_RESOLVED" 2>/dev/null || true
echo "[INFO] Fixed Hakorune executable permissions" >&2
fi
# プラグイン再ビルド(オプション)
@ -277,7 +283,7 @@ Usage:
Functions:
preflight_all - Run all preflight checks
preflight_basic_env - Check basic environment
preflight_nyash_build - Check Nyash build
preflight_nyash_build - Check Hakorune build
preflight_plugins - Check plugin integrity
preflight_dependencies - Check optional dependencies
show_environment_info - Display environment info