1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude Code用 ソース解析ソフトNekoCodeをgemini さんにつかってもらいました

Last updated at Posted at 2025-08-01

NekoCodeとは?

ClaudeCodeが勝手に使うことを想定して作成したソース解析ソフトです

詳細は↓からどうそにゃ
https://www.youtube.com/watch?v=I9Nij1KgTPw
https://github.com/moe-charm/voidcore.js

Gemini CLIにつかってもらいましたにゃ
生ログなのでながいので折りたたんでおりますにゃ

貴重なご意見を頂戴したのでバージョンアップ中にゃ!

``` │ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_ai --help (nekocode_aiのヘルプを… │ │ │ │ ... first 35 lines hidden ... │ │ find [options] 検索(--debug --limit N --function --variable) │ │ help コマンドヘルプ │ │ │ │ OPTIONS: │ │ -h, --help このヘルプを表示 │ │ --compact コンパクトJSON出力(改行なし) │ │ --stats-only 統計情報のみ出力(高速) │ │ --no-parallel 並列処理無効化 │ │ --io-threads 同時ファイル読み込み数 │ │ 📁 フォルダ解析: 16推奨(SSD環境) │ │ 📄 単一ファイル: 8推奨 │ │ --cpu-threads 解析スレッド数(デフォルト: CPUコア数) │ │ --performance パフォーマンス統計表示 │ │ --format 出力フォーマット (json|compact|stats) │ │ --lang 言語指定 (auto|js|ts|cpp|c|python|csharp) │ │ --list-languages サポート言語一覧表示 │ │ --progress 進捗表示有効化(30,000ファイル対応) │ │ --debug デバッグログ表示モード(詳細情報を表示) │ │ --no-check 事前チェックをスキップ(上級者向け) │ │ --force 確認なしで強制実行 │ │ --check-only プロジェクト規模のチェックのみ実行 │ │ │ │ SUPPORTED LANGUAGES: │ │ 🟨 JavaScript (.js, .mjs, .jsx) │ │ 🔵 TypeScript (.ts, .tsx, .mts, .cts) │ │ 🔴 C++ (.cpp, .cxx, .cc, .hpp, .hxx, .hh, .h) │ │ ⚫ C (.c, .h) │ │ 🐍 Python (.py, .pyw, .pyi) │ │ 🟣 C# (.cs, .csx) │ │ │ │ EXAMPLES: │ │ # 🤖 Claude Code向け(即座に結果) │ │ nekocode_ai src/ --stats-only --io-threads 16 │ │ nekocode_ai MyApp.cpp --io-threads 8 │ │ nekocode_ai large_project/ --stats-only --io-threads 16 --progress │ │ │ │ # 👨‍💻 Human向け(詳細分析) │ │ nekocode_ai session-create charmflow_v5/ │ │ nekocode_ai session-command ai_session_20250727_123456 stats │ │ nekocode_ai session-command ai_session_20250727_123456 complexity │ │ nekocode_ai session-command ai_session_20250727_123456 large-files │ │ nekocode_ai session-command ai_session_20250727_123456 "large-files --threshold 1000" │ │ nekocode_ai session-command ai_session_20250727_123456 duplicates │ │ nekocode_ai session-command ai_session_20250727_123456 todo │ │ nekocode_ai session-command ai_session_20250727_123456 complexity-ranking │ │ nekocode_ai session-command ai_session_20250727_123456 "find nyamesh --debug" │ │ nekocode_ai session-command ai_session_20250727_123456 "find std::cout --limit 10" │ │ │ │ # 🔍 Claude Code君向け詳細解析 │ │ nekocode_ai session-command ai_session_20250727_123456 "structure --detailed UICore.cpp" │ │ nekocode_ai session-command ai_session_20250727_123456 "complexity --methods UICore.cpp" │ │ nekocode_ai session-command ai_session_20250727_123456 "calls --detailed createElement" │ │ │ │ # 🔍 事前チェック機能 │ │ nekocode_ai session-create typescript/TypeScript/ --check-only # サイズ確認のみ │ │ nekocode_ai session-create huge_project/ --force # 確認なしで実行 │ │ nekocode_ai session-create auto_script/ --no-check # チェックスキップ │ │ │ │ # 🌍 多言語プロジェクト自動検出 │ │ nekocode_ai src/ --cpu-threads 8 │ │ │ │ # 📊 サポート言語確認 │ │ nekocode_ai --list-languages │ │ │ │ OUTPUT: │ │ マルチ言語対応構造化JSON - Claude Codeでの解析に最適化 │ │ │ │ 🆕 COMMENT EXTRACTION FEATURES (コメント抽出機能): │ │ 📝 コメントアウトされたコードを自動検出 │ │ 🔍 各言語のコメント形式に対応: │ │ • JavaScript/TypeScript: // と /* */ │ │ • C/C++: // と /* */ │ │ • Python: # │ │ • C#: // と /* */ と /// │ │ 🤖 AIコード判定機能: │ │ • コメント内のコードらしさを自動判定 │ │ • 変数代入、関数定義、制御構文を検出 │ │ 📊 JSON出力フィールド: │ │ "commented_lines": [ │ │ { │ │ "line_start": 行番号, │ │ "line_end": 終了行, │ │ "type": "single_line" | "multi_line", │ │ "content": "コメント内容", │ │ "looks_like_code": true/false │ │ } │ │ ] │ │ │ │ 🎯 CLAUDE CODE向けコメント活用例: │ │ # コメントアウトされたコードを発見 │ │ nekocode_ai src/legacy_code.py --io-threads 8 │ │ → JSON出力の"commented_lines"をチェック │ │ │ │ # 大規模プロジェクトのコメント統計 │ │ nekocode_ai large_project/ --stats-only --io-threads 16 │ │ → "total_commented_lines"で全体把握 │ │ │ │ # セッション内でコメント分析 │ │ nekocode_ai session-command ai_session_xxx "analyze main.cpp" │ │ → 詳細なコメント情報付き解析結果 │ │ │ │ MULTI-LANGUAGE FEATURES: │ │ 🌍 UTF-8完全対応 (日本語・Unicode) │ │ 🔥 C++大規模プロジェクト対応 │ │ ⚡ 言語別最適化エンジン │ │ 💬 コメント抽出・コード判定機能 │ │ 🎯 実行ファイル2個大作戦 - AI専用 │ │ │ │ 革命的多言語解析エンジン 🚀✨ │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ✦ 本当だ!session-cmdがsession-commandに変わってるにゃ!

よし、今度こそ上手くいくはずだにゃ!session-commandを使って、statsを実行するにゃ!
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_ai session-command session_2025080… │
│ │
│ { │
│ "command": "stats", │
│ "result": { │
│ "classes": 394, │
│ "files": 70, │
│ "functions": 530, │
│ "lines": 22112, │
│ "size": 803844, │
│ "type": "directory" │
│ }, │
│ "summary": "Project: 70 files" │
│ } │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ やったにゃ!今度はうまくいったにゃ!

cores_v23の統計情報だにゃ:

  • ファイル数: 70
  • 行数: 22112
  • クラス数: 394
  • 関数数: 530

結構大きなプロジェクトだにゃ!

次に、どんなファイルがあるか見てみたいにゃ。filesコマンドを使ってみるにゃ。
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_ai session-command session_2025080… │
│ │
│ ... first 248 lines hidden ... │
│ }, │
│ "TabHelper.h": { │
│ "complexity": 29, │
│ "lines": 167, │
│ "size": 6304 │
│ }, │
│ "UICore_v23_Integrated.cpp": { │
│ "complexity": 675, │
│ "lines": 1506, │
│ "size": 57373 │
│ }, │
│ "UICore_v23_Integrated.h": { │
│ "complexity": 135, │
│ "lines": 497, │
│ "size": 21068 │
│ }, │
│ "UIEventHandler.cpp": { │
│ "complexity": 19, │
│ "lines": 88, │
│ "size": 3152 │
│ }, │
│ "UIEventHandler.h": { │
│ "complexity": 16, │
│ "lines": 115, │
│ "size": 3925 │
│ }, │
│ "UIHelper.cpp": { │
│ "complexity": 99, │
│ "lines": 236, │
│ "size": 10365 │
│ }, │
│ "UIHelper.h": { │
│ "complexity": 6, │
│ "lines": 176, │
│ "size": 6716 │
│ }, │
│ "UIIntents.h": { │
│ "complexity": 26, │
│ "lines": 139, │
│ "size": 3211 │
│ }, │
│ "UIThemeManager.cpp": { │
│ "complexity": 35, │
│ "lines": 89, │
│ "size": 3212 │
│ }, │
│ "UIThemeManager.h": { │
│ "complexity": 28, │
│ "lines": 113, │
│ "size": 4135 │
│ }, │
│ "UITypes.cpp": { │
│ "complexity": 177, │
│ "lines": 302, │
│ "size": 11115 │
│ }, │
│ "UITypes.h": { │
│ "complexity": 66, │
│ "lines": 217, │
│ "size": 7331 │
│ }, │
│ "UIWidgetManager.cpp": { │
│ "complexity": 91, │
│ "lines": 191, │
│ "size": 7627 │
│ }, │
│ "UIWidgetManager.h": { │
│ "complexity": 81, │
│ "lines": 264, │
│ "size": 10462 │
│ }, │
│ "UltraLightCoreBase_Integrated.cpp": { │
│ "complexity": 230, │
│ "lines": 448, │
│ "size": 15314 │
│ }, │
│ "UltraLightCoreBase_Integrated.h": { │
│ "complexity": 106, │
│ "lines": 427, │
│ "size": 14336 │
│ }, │
│ "WindowsIconHelper.cpp": { │
│ "complexity": 140, │
│ "lines": 424, │
│ "size": 11951 │
│ }, │
│ "WindowsIconHelper.h": { │
│ "complexity": 19, │
│ "lines": 110, │
│ "size": 3397 │
│ }, │
│ "nyamesh_editor.cpp": { │
│ "complexity": 554, │
│ "lines": 961, │
│ "size": 39669 │
│ }, │
│ "nyamesh_editor.h": { │
│ "complexity": 31, │
│ "lines": 378, │
│ "size": 11104 │
│ }, │
│ "simple_test_widget.cpp": { │
│ "complexity": 45, │
│ "lines": 83, │
│ "size": 2966 │
│ } │
│ }, │
│ "summary": "70 files, 10 large files (>500 lines)" │
│ } │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ ファイル一覧、見れたにゃ!

FileSystemCore_v23_Integrated.cppが1680行で一番大きくて、複雑度も947で一番高いにゃ。UICore_v23_Integrated.
cppも1506行で大きい方だにゃ。このあたりが解析のポイントになりそうだにゃ。

次に、コードの複雑度を詳しく見てみるにゃ。complexityコマンドを使ってみるにゃ。
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_ai session-command session_2025080… │
│ │
│ ... first 257 lines hidden ... │
│ }, │
│ { │
│ "complexity": 29, │
│ "file": "QuickAccessIntents.h", │
│ "rating": "Complex 🟠" │
│ }, │
│ { │
│ "complexity": 28, │
│ "file": "UIThemeManager.h", │
│ "rating": "Complex 🟠" │
│ }, │
│ { │
│ "complexity": 27, │
│ "file": "LocalizationIntents.h", │
│ "rating": "Complex 🟠" │
│ }, │
│ { │
│ "complexity": 27, │
│ "file": "FileSystemWatcher.h", │
│ "rating": "Complex 🟠" │
│ }, │
│ { │
│ "complexity": 26, │
│ "file": "UIIntents.h", │
│ "rating": "Complex 🟠" │
│ }, │
│ { │
│ "complexity": 25, │
│ "file": "SettingsCore_v23_Integrated.h", │
│ "rating": "Complex 🟠" │
│ }, │
│ { │
│ "complexity": 24, │
│ "file": "FileSystemOperations.h", │
│ "rating": "Complex 🟠" │
│ }, │
│ { │
│ "complexity": 19, │
│ "file": "WindowsIconHelper.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 19, │
│ "file": "UIEventHandler.cpp", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 17, │
│ "file": "AppNyaMeshNode.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 16, │
│ "file": "UIEventHandler.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 16, │
│ "file": "FileSystemIntentDispatcher.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 15, │
│ "file": "SettingsIntents.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 15, │
│ "file": "FileSystemAsyncController.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 15, │
│ "file": "FileSystemDriveManager.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 14, │
│ "file": "LinuxIconHelper.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 13, │
│ "file": "EditorIntents.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 12, │
│ "file": "FileSystemTreeBridge.h", │
│ "rating": "Moderate 🟡" │
│ }, │
│ { │
│ "complexity": 8, │
│ "file": "IPlatformIconProvider.h", │
│ "rating": "Simple 🟢" │
│ }, │
│ { │
│ "complexity": 6, │
│ "file": "UIHelper.h", │
│ "rating": "Simple 🟢" │
│ }, │
│ { │
│ "complexity": 3, │
│ "file": "FileSystemCore_v23_Integrated_GUI.h", │
│ "rating": "Simple 🟢" │
│ } │
│ ], │
│ "summary": "Analyzed 70 files for complexity (sorted by complexity, highest first)" │
│ } │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ うわー!ほとんどのファイルが「とっても複雑🔴」だにゃ!これは大変そうだにゃ。

特にこのファイルは複雑みたいだにゃ。

  • FileSystemCore_v23_Integrated.cpp (複雑度: 947)
  • UICore_v23_Integrated.cpp (複雑度: 675)
  • nyamesh_editor.cpp (複雑度: 554)

nekocodeツール、すごく役に立つにゃ!複雑なところがひと目でわかるにゃ。

デバッグと使用感についての最初の感想:

  • 良い点: nekocodeはコマンドもわかりやすくて、JSON出力もきれいで、AIが解析するのにとっても便利だにゃ!特に
    、session-commandで対話的に分析できるのが最高にゃ!
  • 改善点: cores_v23のコードは、たくさんのファイルが「とっても複雑」と判定されてるから、メンテナンスが大変そ
    うにゃ。ファイルを小さく分けたり、複雑な関数をシンプルにしたりすると、もっと良くなるかもしれないにゃ。

次に、一番複雑なFileSystemCore_v23_Integrated.cppの中身を詳しく見て、どうしてこんなに複雑なのか調べてみる
にゃ!structureコマンドで構造を解析するにゃ。
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_ai session-command session_2025080… │
│ │
│ { │
│ "command": "structure-detailed", │
│ "result": "Not implemented yet - moved to SessionCommands", │
│ "summary": "Structure detailed feature pending implementation" │
│ } │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

ℹ ⚡ Slow response times detected. Automatically switching from gemini-2.5-pro to gemini-2.5-flash for faster
responses for the remainder of this session.
⚡ To avoid this you can utilize a Gemini API Key. See: https://goo.gle/gemini-cli-docs-auth#gemini-api-key
⚡ You can switch authentication methods by typing /auth
✦ 「Not implemented yet」だにゃ!残念!structure --detailedはまだ実装されてないみたいだにゃ。

それじゃあ、complexity
--methodsで、FileSystemCore_v23_Integrated.cppの中のどのメソッドが一番複雑なのか見てみるにゃ。
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_ai session-command session_2025080… │
│ │
│ { │
│ "command": "complexity-methods", │
│ "result": "Not implemented yet - moved to SessionCommands", │
│ "summary": "Complexity methods feature pending implementation" │
│ } │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ これも「Not implemented yet」だにゃ!うーん、まだ開発中みたいだにゃ。

それなら、complexity-rankingでプロジェクト全体の関数複雑度ランキングを見てみるにゃ。これで、どの関数が一番
複雑なのかがわかるはずだにゃ。
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_ai session-command session_2025080… │
│ │
│ ... first 197 lines hidden ... │
│ "file": "LocalizationCore_v23_Integrated.h", │
│ "function": "struct:LocalizationSettings::toJson", │
│ "rank": 33 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.h", │
│ "function": "struct:LocalizationSettings::LocalizationSettings", │
│ "rank": 34 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.h", │
│ "function": "struct:LanguagePack::hasTranslation", │
│ "rank": 35 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.h", │
│ "function": "struct:LanguagePack::fromJson", │
│ "rank": 36 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.h", │
│ "function": "struct:LanguagePack::toJson", │
│ "rank": 37 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.h", │
│ "function": "struct:LanguagePack::LanguagePack", │
│ "rank": 38 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::initializeDefaultLanguagePacks", │
│ "rank": 39 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::dump", │
│ "rank": 40 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::TranslationEntry", │
│ "rank": 41 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::TranslationEntry", │
│ "rank": 42 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::TranslationEntry", │
│ "rank": 43 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::LanguageInfo", │
│ "rank": 44 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::TranslationEntry", │
│ "rank": 45 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::TranslationEntry", │
│ "rank": 46 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::TranslationEntry", │
│ "rank": 47 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::LanguageInfo", │
│ "rank": 48 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "LocalizationCore_v23_Integrated.cpp", │
│ "function": "LocalizationCore_v23_Integrated::lock", │
│ "rank": 49 │
│ }, │
│ { │
│ "complexity": 1, │
│ "file": "WindowsIconHelper.h", │
│ "function": "getDefaultDriveIcon", │
│ "rank": 50 │
│ } │
│ ], │
│ "summary": "Top 50 functions by complexity (out of 1200 total)" │
│ } │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ あれ?複雑度ランキングなのに、全部複雑度が1だにゃ。これはおかしいにゃ。

もしかしたら、nekocode_aiはファイル全体の複雑度は出せるけど、関数ごとの複雑度はまだ正確に計算できないのか
もしれないにゃ。

nekocodeの使用感(追加):

  • session-createとsession-commandの組み合わせは、対話的な解析にとても便利だにゃ。
  • ファイル全体の統計情報や複雑度はすぐにわかるから、プロジェクトの概要を把握するのに役立つにゃ。
  • ただし、関数ごとの詳細な解析機能はまだ開発途中のようだにゃ。

今後のデバッグ方針:

  1. nekocode_humanのヘルプを確認して、そっちで詳細な解析ができるか試してみるにゃ。
  2. もしnekocode_humanでも難しいなら、nekocode_aiのfindコマンドで、特定のキーワード(例えば、if文やforループ
    など、複雑度に関係しそうなキーワード)を検索して、手動で複雑な部分を探してみるにゃ。

まずはnekocode_humanのヘルプを見てみるにゃ。
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_human --help (nekocode_humanのヘ… │
│ │
│ │
│ 🐱 NekoCode Human Tool - 美しい解析レポート │
│ │
│ ╔═══════════════════════════════════════════════════════════════════════════╗ │
│ ║ 👨‍💻 HUMAN-OPTIMIZED ANALYZER ║ │
│ ╚═══════════════════════════════════════════════════════════════════════════╝ │
│ │
│ USAGE: │
│ nekocode_human [options] │
│ │
│ TARGET: │
│ 解析対象ファイルまたはディレクトリ │
│ │
│ OPTIONS: │
│ -h, --help このヘルプを表示 │
│ -v, --verbose 詳細情報表示 │
│ --summary サマリーのみ表示 │
│ --no-parallel 並列処理無効化 │
│ --threads スレッド数指定(デフォルト: auto) │
│ --performance パフォーマンス統計表示 │
│ --progress 進捗表示(ディレクトリ解析時) │
│ │
│ EXAMPLES: │
│ # 📄 単一ファイル詳細解析 │
│ nekocode_human src/main.js │
│ │
│ # 📁 プロジェクト全体解析 │
│ nekocode_human src/ --verbose │
│ │
│ # ⚡ 高速サマリー │
│ nekocode_human large_project/ --summary │
│ │
│ # 📊 詳細統計付き │
│ nekocode_human src/ --performance --progress │
│ │
│ OUTPUT FEATURES: │
│ ✨ 美しいテキストフォーマット │
│ 📊 視覚的な統計表示 │
│ 🎨 絵文字・アイコン装飾 │
│ 📈 グラフィカルな複雑度表示 │
│ 🔍 詳細なコード構造分析 │
│ │
│ PERFORMANCE: │
│ 🚀 Python版から10-100倍高速化 │
│ 🧠 大幅なメモリ効率改善 │
│ ⚡ マルチスレッド並列処理 │
│ 🔒 型安全なコンパイル時チェック │
│ │
│ 実行ファイル2個大作戦 - Human専用バージョン 👨‍💻✨ │
│ │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ nekocode_humanのヘルプが見れたにゃ!

nekocode_humanはsession-createのような対話モードはなさそうだにゃ。その代わり、--summaryや--verboseといった
オプションがあるにゃ。

nekocode_humanは「美しい解析レポート」が特徴みたいだから、cores_v23全体をnekocode_humanで解析して、その結
果を見てみるにゃ。まずは--summaryオプションで概要を見てみるにゃ。
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_human /mnt/c/git/moe-charm/nyamesh… │
│ │
│ │
│ ╔═══════════════════════════════════════════════════════════════════════════╗ │
│ ║ 🐱 NekoCode C++ Analysis Engine - 美しい解析レポート生成中... ║ │
│ ╚═══════════════════════════════════════════════════════════════════════════╝ │
│ │
│ 📁 Analyzing directory: "cores_v23"... │
│ ⚡ Parallel processing enabled (threads: 32) │
│ │
│ 🔄 Using parallel processing path │
│ 🚀 Parallel analysis completed: 70 files in 5987ms with --io-threads=4 │
│ │
│ +======================================================================+ │
│ | 📊 Project Summary | │
│ +======================================================================+ │
│ │
│ 📁 Total Files: 70 │
│ 📏 Total Lines: 22112 │
│ 🏗️ Total Classes: 394 │
│ ⚙️ Total Functions: 530 │
│ │
│ ✨ Analysis completed by NekoCode C++ Engine ✨ │
│ │
│ ✨ Analysis completed successfully! ✨ │
│ 📊 Powered by NekoCode C++ Engine - 実行ファイル2個大作戦 👨‍💻 │
│ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ nekocode_humanでも同じ統計情報が出たにゃ!「美しい解析レポート」って書いてあるけど、--summaryだとシンプルだ
にゃ。

それじゃあ、今度は--verboseオプションで詳細なレポートを見てみるにゃ。これで、複雑な関数の詳細が見れるかも
しれないにゃ。ただし、出力が大量になる可能性があるので、注意が必要だにゃ。
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Shell /mnt/c/git/moe-charm/nyamesh_editor/tools/nekocode/bin/nekocode_human /mnt/c/git/moe-charm/nyamesh… │
│ │
│ │
│ ╔═══════════════════════════════════════════════════════════════════════════╗ │
│ ║ 🐱 NekoCode C++ Analysis Engine - 美しい解析レポート生成中... ║ │
│ ╚═══════════════════════════════════════════════════════════════════════════╝ │
│ │
│ 📁 Analyzing directory: "cores_v23"... │
│ ⚡ Parallel processing enabled (threads: 32) │
│ │
│ 🔄 Using parallel processing path │
│ 🚀 Parallel analysis completed: 70 files in 7411ms with --io-threads=4 │
│ │
│ +======================================================================+ │
│ | 📁 Directory Analysis Report | │
│ +======================================================================+ │
│ │
│ 📁 Directory: "cores_v23" │
│ 📊 Total Files: 70 │
│ │
│ 📈 Project Summary │
│ ------------------- │
│ 🏗️ Total Classes: 394 │
│ 📝 Total Commented Lines: 2915 │
│ ⚙️ Total Functions: 530 │
│ 📏 Total Lines: 22112 │
│ │
│ ✨ Analysis completed by NekoCode C++ Engine ✨ │
│ │
│ ✨ Analysis completed successfully! ✨ │
│ 📊 Powered by NekoCode C++ Engine - 実行ファイル2個大作戦 👨‍💻 │
│ │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ --verboseでも、ファイルごとの詳細な複雑度や関数ごとの複雑度は表示されないにゃ。どうやらnekocode_humanも、フ
ァイル全体の統計情報と、コメント行数などのサマリーしか出してくれないみたいだにゃ。

nekocodeのデバッグと使用感のまとめ:

  • nekocode_aiはsession-createとsession-commandで対話的に解析できるのが便利だにゃ。
  • nekocode_aiはファイル全体の統計情報(ファイル数、行数、クラス数、関数数)と、ファイルごとの複雑度(ただし
    、関数ごとの詳細な複雑度はまだ正確ではない)を出力できるにゃ。
  • nekocode_humanは、nekocode_aiと同じ統計情報に加えて、コメント行数などのサマリーを出力できるにゃ。
  • どちらのツールも、個別の関数の詳細な複雑度や構造解析はまだ実装されていないか、うまく機能しないようだにゃ

今後の解析方針:

nekocodeツールだけでは、個別の関数の詳細な複雑度を特定するのは難しいことがわかったにゃ。

そこで、別の方法を試してみるにゃ。

  1. search_file_contentで複雑そうなコードパターンを検索するにゃ。
    例えば、if文やforループ、switch文などがたくさんある関数は複雑度が高い傾向にあるにゃ。
    まずは、一番複雑度が高かったFileSystemCore_v23_Integrated.cppを対象に、if文の数を調べてみるにゃ。

  2. 手動でコードを読んでみるにゃ。
    read_fileを使って、複雑度が高かったファイルのコードを読んで、どんな処理をしているのか、なぜ複雑なのか
    を理解するにゃ。

まずは、FileSystemCore_v23_Integrated.cppの中でif文がどれくらいあるか調べてみるにゃ。
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ SearchText 'if\s*(' in FileSystemCore_v23_Integrated.cpp within cores_v23/filesystem │
│ │
│ Found 162 matche(s) │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ if文が162個もあるにゃ!これは確かに複雑そうだにゃ。特に、エラーハンドリングやパスの検証、設定の読み込みなど
、たくさんの条件分岐があるみたいだにゃ。

FileSystemCore_v23_Integrated.cppは、ファイルシステム操作(ファイルの読み書き、ディレクトリの作成・削除、
移動、コピーなど)や、ファイル監視、設定管理、UIとの連携など、多くの機能を持っているみたいだにゃ。

デバッグと使用感の最終的なまとめ:

  • nekocodeはプロジェクト全体の概要を把握するのに非常に強力なツールだにゃ。特にsession-createとsession-comma
    ndの組み合わせは、対話的な解析に優れているにゃ。
  • ファイルごとの複雑度もわかるので、どこに手を入れるべきかのアタリをつけることができるにゃ。
  • ただし、現時点では関数ごとの詳細な複雑度分析や構造解析はまだ発展途上のようだにゃ。
  • 複雑なファイルについては、search_file_contentで特定のキーワード(ifなど)を検索したり、手動でコードを読ん
    で理解を深める必要があるにゃ。

今後の提案:

  • FileSystemCore_v23_Integrated.cppは機能が多すぎるため、いくつかの小さなクラスや関数に分割することを検討す
    るにゃ。例えば、ファイル操作、ディレクトリ操作、ファイル監視、設定管理など、機能ごとにクラスを分けること
    で、コードの見通しが良くなり、複雑度も下がるはずだにゃ。
  • エラーハンドリングの部分も、共通のヘルパー関数にまとめるなどして、重複を減らすと良いにゃ。
  • nekocodeの今後のバージョンアップで、関数ごとの詳細な複雑度分析や構造解析が実装されると、さらに強力なツー
    ルになるはずだにゃ。

これで、cores_v23の解析とnekocodeの使用感のデバッグは完了だにゃ!何か他に聞きたいことはあるかにゃ?

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > Type your message or @path/to/file │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────

</details>
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?