feat(hako_check): Phase 153 - Dead code detection revival (JoinIR version)

Implement comprehensive dead code detection for hako_check with JoinIR
integration, following Phase 133/134/152 box-based modularity pattern.

## Key Achievements

1. **Comprehensive Inventory** (`phase153_hako_check_inventory.md`):
   - Documented current hako_check architecture (872 lines)
   - Analyzed existing HC011/HC012 rules
   - Confirmed JoinIR-only pipeline (Phase 124)
   - Identified Phase 153 opportunities

2. **DeadCodeAnalyzerBox** (`rule_dead_code.hako`):
   - Unified HC019 rule (570+ lines)
   - Method-level + box-level dead code detection
   - DFS reachability from entrypoints
   - Text-based analysis (no MIR JSON dependency for MVP)
   - Heuristic-based false positive reduction

3. **CLI Integration** (`cli.hako`):
   - Added `--dead-code` flag for comprehensive mode
   - Added `--rules dead_code` for selective execution
   - Compatible with --format (text/json-lsp/dot)

4. **Test Infrastructure**:
   - HC019_dead_code test directory (ng/ok/expected.json)
   - `hako_check_deadcode_smoke.sh` with 4 test cases

## Technical Details

- **Input**: Analysis IR (MapBox with methods/calls/boxes/entrypoints)
- **Output**: HC019 diagnostics
- **Algorithm**: Graph-based DFS reachability
- **Pattern**: Box-based modular architecture
- **No ENV vars**: CLI flags only

## Files Modified

- NEW: docs/development/current/main/phase153_hako_check_inventory.md
- NEW: tools/hako_check/rules/rule_dead_code.hako
- MOD: tools/hako_check/cli.hako
- NEW: tools/hako_check/tests/HC019_dead_code/
- NEW: tools/hako_check_deadcode_smoke.sh
- MOD: CURRENT_TASK.md

## Next Steps

- Phase 154+: MIR CFG integration for block-level detection
- Phase 160+: Integration with .hako JoinIR/MIR migration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-04 14:19:48 +09:00
parent d75bbf4f90
commit c85d67c92e
19 changed files with 1388 additions and 8 deletions

25
docs/specs/README.md Normal file
View File

@ -0,0 +1,25 @@
# Nyash Specs (Legacy / Experimental)
このディレクトリは、古い仕様案や実験的なスペックを一時的に置いておくための場所だよ。
## ステータス
- `specs/` 全体のステータス: **Legacy / Cleanup対象**
- 現行仕様の「正本」は `docs/reference/``docs/architecture/` 側に集約していく方針だよ。
## 現在の主なファイル
- `language/index-operator.md`
- 配列 / マップ向けの `[]` インデックス演算子の設計メモ。
- Phase20.31 スコープの設計案として残しているよ。
## 運用ルール(提案)
- 新しい仕様はここではなく、まず `docs/private/`(案)か `docs/reference/`(正本)に置く。
- `specs/` にある文書は、以下のどちらかに徐々に移していく:
- 内容が現行仕様として生きている → `docs/reference/` / `docs/architecture/` に昇格して整理する。
- 歴史的な価値のみ → `docs/archive/specs/` 以下に移動し、先頭に「Archived」の一行メモを書く。
この README 自体は、「ここはAIや過去フェーズのメモ置き場だった」という目印兼、今後の整理方針のメモとして使うよ。
大掃除したくなったタイミングで、ここから順番に `reference/``archive/` へ移していけば大丈夫だよ。