Metadata-Version: 2.4
Name: move-fcg-analyzer
Version: 1.0.4
Summary: Move language parser and function call graph analyzer
Author-email: ArArgon <liaozping@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/yourusername/move-fcg-analyzer
Project-URL: Repository, https://github.com/yourusername/move-fcg-analyzer
Project-URL: Issues, https://github.com/yourusername/move-fcg-analyzer/issues
Keywords: move,aptos,parser,tree-sitter,static-analysis
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tree-sitter>=0.20.0
Dynamic: license-file

# Move FCG Analyzer

一个用于分析 Move 项目的静态分析工具，支持函数调用图（Function Call Graph）分析，可以提取函数信息、调用关系、参数等。

## 功能

- 提取函数签名、参数、返回类型
- 提取函数源代码和位置信息
- **准确提取函数调用关系（calls）**
- 支持模块限定的函数查询
- 输出标准 JSON 格式

## 构建

### 1. 安装依赖

```bash
npm install
```

### 2. 构建 TypeScript Indexer

```bash
npm run build:indexer
```

## 使用

### Python API

```python
from move_fcg_analyzer import MoveFunctionAnalyzer

analyzer = MoveFunctionAnalyzer()
result = analyzer.analyze_raw("./project_path", "function_name")

# result 包含 contract, function, source, location, parameter, calls 等字段
print(result["calls"])  # 查看函数调用关系
```

### 命令行

```bash
python3 -m move_fcg_analyzer <project_path> <function_name>
```

示例：
```bash
python3 -m move_fcg_analyzer ./test/caas-framework grant_read_authorization
```

## 输出格式

```json
{
  "contract": "module_name",
  "function": "function_signature",
  "source": "function_source_code",
  "location": {
    "file": "/path/to/file.move",
    "start_line": 134,
    "end_line": 204
  },
  "parameter": [
    {"name": "param_name", "type": "param_type"}
  ],
  "calls": [
    {
      "file": "/path/to/called/function.move",
      "function": "called_function_name",
      "module": "called_module_name"
    }
  ]
}
```

## License

Apache-2.0
