refactor: remove dead code — 1,784 lines across 77 files (#9180)

Deep scan with vulture, pyflakes, and manual cross-referencing identified:
- 41 dead functions/methods (zero callers in production)
- 7 production-dead functions (only test callers, tests deleted)
- 5 dead constants/variables
- ~35 unused imports across agent/, hermes_cli/, tools/, gateway/

Categories of dead code removed:
- Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection,
  rebuild_lookups, clear_session_context, get_logs_dir, clear_session
- Unused API surface: search_models_dev, get_pricing, skills_categories,
  get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list
- Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob
- Stale debug helpers: get_debug_session_info copies in 4 tool files
  (centralized version in debug_helpers.py already exists)
- Dead gateway methods: send_emote, send_notice (matrix), send_reaction
  (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history
  (matrix), _start_typing_indicator (signal), parse_feishu_post_content
- Dead constants: NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION,
  FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR
- Unused UI code: _interactive_provider_selection,
  _interactive_model_selection (superseded by prompt_toolkit picker)

Test suite verified: 609 tests covering affected files all pass.
Tests for removed functions deleted. Tests using removed utilities
(clear_read_tracker, MEMORY_DIR) updated to use internal APIs directly.
This commit is contained in:
Teknium 2026-04-13 16:32:04 -07:00 committed by GitHub
parent a66fc1365d
commit 8d023e43ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
77 changed files with 44 additions and 1784 deletions

View file

@ -13,11 +13,9 @@ from tools.skills_tool import (
_parse_frontmatter,
_parse_tags,
_get_category_from_path,
_estimate_tokens,
_find_all_skills,
skill_matches_platform,
skills_list,
skills_categories,
skill_view,
MAX_DESCRIPTION_LENGTH,
)
@ -190,18 +188,6 @@ class TestGetCategoryFromPath:
assert _get_category_from_path(skill_md) is None
# ---------------------------------------------------------------------------
# _estimate_tokens
# ---------------------------------------------------------------------------
class TestEstimateTokens:
def test_estimate(self):
assert _estimate_tokens("1234") == 1
assert _estimate_tokens("12345678") == 2
assert _estimate_tokens("") == 0
# ---------------------------------------------------------------------------
# _find_all_skills
# ---------------------------------------------------------------------------
@ -544,32 +530,6 @@ class TestSkillViewSecureSetupOnLoad:
assert result["content"].startswith("---")
# ---------------------------------------------------------------------------
# skills_categories
# ---------------------------------------------------------------------------
class TestSkillsCategories:
def test_lists_categories(self, tmp_path):
with patch("tools.skills_tool.SKILLS_DIR", tmp_path):
_make_skill(tmp_path, "s1", category="devops")
_make_skill(tmp_path, "s2", category="mlops")
raw = skills_categories()
result = json.loads(raw)
assert result["success"] is True
names = {c["name"] for c in result["categories"]}
assert "devops" in names
assert "mlops" in names
def test_empty_skills_dir(self, tmp_path):
skills_dir = tmp_path / "skills"
with patch("tools.skills_tool.SKILLS_DIR", skills_dir):
raw = skills_categories()
result = json.loads(raw)
assert result["success"] is True
assert result["categories"] == []
# ---------------------------------------------------------------------------
# skill_matches_platform
# ---------------------------------------------------------------------------