{"id":41301492,"url":"https://github.com/mitojs/node","last_synced_at":"2026-01-23T04:50:55.360Z","repository":{"id":302069925,"uuid":"1010447839","full_name":"mitojs/node","owner":"mitojs","description":"A Lite SDK And Cli For Monitoring Node.js, Sidercar Agent Write By Rust（Work In Progress）","archived":false,"fork":false,"pushed_at":"2025-11-14T08:50:45.000Z","size":4421,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-14T10:22:45.349Z","etag":null,"topics":["node-apm","nodejs","rust"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitojs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-29T05:00:33.000Z","updated_at":"2025-11-14T08:50:50.000Z","dependencies_parsed_at":"2025-08-21T13:08:39.844Z","dependency_job_id":"3692832d-c038-4008-b72d-4c5ba0a4db1a","html_url":"https://github.com/mitojs/node","commit_stats":null,"previous_names":["mitojs/node"],"tags_count":0,"template":false,"template_full_name":"cjinhuo/mono-sdk-boilerplate","purl":"pkg:github/mitojs/node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitojs%2Fnode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitojs%2Fnode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitojs%2Fnode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitojs%2Fnode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitojs","download_url":"https://codeload.github.com/mitojs/node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitojs%2Fnode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28680623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T04:33:33.518Z","status":"ssl_error","status_checked_at":"2026-01-23T04:33:30.433Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node-apm","nodejs","rust"],"created_at":"2026-01-23T04:50:54.599Z","updated_at":"2026-01-23T04:50:55.353Z","avatar_url":"https://github.com/mitojs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# work in progress 🚧\n正在开发中，感兴趣可以加入我们\n![飞书群](./docs/lark_group.jpg)\n\n# MitoJS Node(README 由 AI 生成)\n一个强大的 Node.js 性能监控和调试工具套件，提供实时性能分析、内存监控和代码调试功能。\n\n## 🚀 特性\n\n- **性能分析**: CPU 性能分析、堆快照、内存使用监控\n- **实时监控**: 实时 CPU 使用率监控\n- **代码调试**: 支持在目标进程中运行代码\n- **跨平台**: 支持 macOS、Linux、Windows\n- **CLI 工具**: 提供命令行界面，易于集成到开发流程\n- **Rust 代理**: 高性能的 Rust 代理程序，提供稳定的数据处理能力\n\n## 📦 包结构\n\n本项目采用 monorepo 架构，包含以下核心包：\n\n- **@mitojs/node**: Node.js SDK，提供性能监控的核心功能\n- **@mitojs/node-cli**: 命令行工具，提供交互式的调试和监控界面\n- **agent**: Rust 编写的高性能代理程序，负责数据处理和 IPC 通信\n\n## 🛠 安装（开发中）\n\n### 使用 npm\n\n```bash\nnpm install @mitojs/node @mitojs/node-cli\n```\n\n### 使用 pnpm\n\n```bash\npnpm add @mitojs/node @mitojs/node-cli\n```\n\n### 使用 yarn\n\n```bash\nyarn add @mitojs/node @mitojs/node-cli\n```\n\n## 🚀 快速开始\n\n### 1. 在你的 Node.js 应用中集成 SDK\n\n```javascript\n// 在应用入口文件中引入\nimport '@mitojs/node'\n\n// 或者手动初始化\nimport { init } from '@mitojs/node'\n\nasync function startApp() {\n  await init()\n  // 你的应用代码\n}\n\nstartApp()\n```\n\n### 2. 使用 CLI 工具监控应用\n\n```bash\n# 获取进程的 CPU 性能分析（10秒）\nmito-node cpuprofile -p \u003cpid\u003e -d 10000\n\n# 获取堆快照\nmito-node heapsnapshot -p \u003cpid\u003e -d ./snapshots\n\n# 实时监控 CPU 使用率\nmito-node monitor-cpu -p \u003cpid\u003e\n\n# 获取内存信息\nmito-node memory -p \u003cpid\u003e\n\n# 在目标进程中运行代码\nmito-node run-code -p \u003cpid\u003e -c \"console.log('Hello from target process')\"\n\n# 从文件运行代码\nmito-node run-code -p \u003cpid\u003e -f ./debug-script.js\n```\n\n## 📋 CLI 命令详解\n\n| 命令            | 描述                  | 选项                                                           |\n| --------------- | --------------------- | -------------------------------------------------------------- |\n| `cpuprofile`    | 获取 CPU 性能分析文件 | `-d, --duration \u003cms\u003e` 分析持续时间（默认10000ms）              |\n| `heapsnapshot`  | 获取堆快照            | `-d, --dir \u003cdir\u003e` 保存目录（默认当前目录）                     |\n| `memory`        | 获取内存使用信息      | 无                                                             |\n| `monitor-cpu`   | 实时监控 CPU 使用率   | 无                                                             |\n| `run-code`      | 在目标进程中执行代码  | `-c, --code \u003ccode\u003e` 代码字符串\u003cbr\u003e`-f, --file \u003cfile\u003e` 代码文件 |\n| `start-inspect` | 开始调试目标进程      | 无                                                             |\n| `stop-inspect`  | 停止调试目标进程      | 无                                                             |\n| `report`        | 生成进程报告          | `-d, --dir \u003cdir\u003e` 保存目录（默认当前目录）                     |\n\n## 🏗 开发\n\n### 环境要求\n\n- Node.js \u003e= 20\n- pnpm \u003e= 10\n- Rust (用于构建 agent)\n\n### 安装依赖\n\n```bash\npnpm install\n```\n\n### 构建项目\n\n```bash\n# 构建所有包\npnpm build\n\n# 仅构建 TypeScript\npnpm esm\n\n# 仅构建 Rust agent\npnpm build:rust\n```\n\n### 开发模式\n\n```bash\n# 监听模式构建\npnpm watch:esm\n\n# 启动 React 19 示例应用\npnpm web:dev\n```\n\n### 运行测试\n\n```bash\npnpm test\n```\n\n## 🏛 架构\n\n```\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│   Node.js App   │    │   CLI Tool      │    │   Rust Agent    │\n│                 │    │                 │    │                 │\n│  @mitojs/node   │◄──►│@mitojs/node-cli │◄──►│   IPC + HTTP    │\n│                 │    │                 │    │                 │\n│   SDK集成       │    │   命令行界面    │    │   数据处理      │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n```\n\n### 核心组件\n\n1. **Node.js SDK** (`@mitojs/node`)\n   - 自动初始化 Rust 代理\n   - 提供性能监控 API\n   - 跨平台二进制文件管理\n\n2. **CLI 工具** (`@mitojs/node-cli`)\n   - 基于 Commander.js 的命令行界面\n   - 使用 Ink + React 的交互式 UI\n   - WebSocket 通信支持\n\n3. **Rust 代理** (`agent`)\n   - 高性能数据处理\n   - IPC 进程间通信\n   - HTTP 服务器\n   - 跨平台编译支持\n\n## 🤝 贡献\n\n欢迎贡献代码！请查看 [CONTRIBUTING.md](.github/CONTRIBUTING.md) 了解详细信息。\n\n## 📄 许可证\n\nMIT License - 查看 [LICENSE](LICENSE) 文件了解详细信息。\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitojs%2Fnode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitojs%2Fnode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitojs%2Fnode/lists"}