{"id":16391802,"url":"https://github.com/williamfzc/cupido","last_synced_at":"2025-03-21T02:32:16.533Z","repository":{"id":221644831,"uuid":"742862625","full_name":"williamfzc/cupido","owner":"williamfzc","description":"A tiny engine for exploring your git history with graph view.","archived":false,"fork":false,"pushed_at":"2024-10-20T07:23:50.000Z","size":180,"stargazers_count":10,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-17T19:52:29.415Z","etag":null,"topics":["analysis","git","graph","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/williamfzc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2024-01-13T15:41:10.000Z","updated_at":"2024-10-22T01:30:23.000Z","dependencies_parsed_at":"2024-04-21T07:31:04.853Z","dependency_job_id":"8fe6d0c6-278e-4525-8fee-e3b76e62e60d","html_url":"https://github.com/williamfzc/cupido","commit_stats":null,"previous_names":["williamfzc/cupido"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fcupido","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fcupido/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fcupido/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamfzc%2Fcupido/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/williamfzc","download_url":"https://codeload.github.com/williamfzc/cupido/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244725582,"owners_count":20499632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["analysis","git","graph","rust"],"created_at":"2024-10-11T04:47:23.481Z","updated_at":"2025-03-21T02:32:16.215Z","avatar_url":"https://github.com/williamfzc.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cupido\n\n![Crates.io Version](https://img.shields.io/crates/v/cupido)\n\n\u003e Explore your codebase with graph view.\n\n## Goal \u0026 Motivation\n\nIt efficiently analyzes the entire commit history of a repository, combining information such as files, issue\nreferences, authors, etc., to generate a graph for the entire repository, in seconds.\n\nAll analyses can be performed flexibly and quickly on the graph.\n\n```mermaid\ngraph TD\n;\n    File1(\"src/main.rs\") === Commit1(\"abcd1234\");\n    File2(\"src/utils.rs\") === Commit1;\n    Commit1 === Issue1(\"#123\");\n    Issue1 === File1;\n    Dir(\"src/\") --- File1;\n    Dir --- File2;\n    Author1(\"Williamfzc\") --- Commit1;\n    File3(\"src/config.rs\") === Commit2(\"efgh5678\");\n    File4(\"README.md\") === Commit2;\n    Commit2 === Issue2(\"#456\");\n    Issue2 === File4;\n    Dir --- File3;\n    Author2(\"JaneDoe\") --- Commit2;\n\n```\n\n## Concept\n\n```mermaid\ngraph TD\n;\n    File === Commit;\n    Commit === Issue;\n    Issue === File;\n    Dir --- File;\n    Author --- Commit;\n```\n\nConceptually, the entire graph consists of three core node types:\n\n- File Node: logic unit.\n- Commit Node: developer unit.\n- Issue Node: story unit.\n\nThese nodes are interconnected and support bidirectional fast searching.\n\nIn addition to these, there are also some additional nodes to support more extensive retrieval and analysis:\n\n- Author Node\n- Dir Node\n- ...\n\n## Usage\n\nWe primarily offer three usage modes:\n\n- Rust library\n- Local server mode (similar to LSP)\n- CLI\n\n### Rust library\n\nSee [examples/mini.rs](examples/mini.rs)\n\n```rust\nuse cupido::collector::config::{get_collector, Collect, Config};\n\nfn main() {\n    let collector = get_collector();\n    let mut conf = Config::default();\n    conf.repo_path = String::from(\".\");\n    let graph = collector.walk(Config::default());\n\n    // 1. search from files to issues\n    let file_name = String::from(\"src/server/app.rs\");\n    let issues = graph.file_related_issues(\u0026file_name).unwrap();\n\n    // src/server/app.rs related to [\"#1\"]\n    println!(\"1. {} related to {:?}\", file_name, issues);\n\n    // 2. search from issues to commits\n    let issue_label = issues.get(0).unwrap();\n    let commits = graph.issue_related_commits(issue_label).unwrap();\n\n    // #1 related to [\"b7574411fbf685a777d1929bff26b3ad4ebd84f2\"]\n    println!(\"2. {} related to {:?}\", issue_label, commits);\n\n    // 3. search from commits to files\n    let commit = commits.get(0).unwrap();\n    let files = graph.commit_related_files(commit).unwrap();\n\n    // b7574411fbf685a777d1929bff26b3ad4ebd84f2 related to [\"src/server/mod.rs\", \"src/server/handler.rs\", \"src/server/config.rs\", \"src/server/app.rs\", \"src/server.rs\", \"src/main.rs\"]\n    println!(\"3. {} related to {:?}\", commit, files);\n\n    // Also, you can do it vice versa.\n}\n```\n\n### Local server mode\n\nYou can find the corresponding binary files for your system on the release page:\n\nhttps://github.com/williamfzc/cupido/releases/\n\nYou can start the service using the following command:\n\n```shell\n./cupido up --repo-path ~/workspace/github/axios\n```\n\nUpon successful startup, you should see logs similar to the following:\n\n```text\n2024-02-08T13:46:02.932406Z  INFO cupido: relation creating ...\n2024-02-08T13:46:02.932754Z  INFO cupido: config: UpCommand { issue_regex: None, repo_path: Some(\"/Users/bytedance/workspace/github/axios\"), path_specs: None, multi_parents: None }\n2024-02-08T13:46:03.177632Z  INFO cupido: relation ready in 244.838094ms: GraphSize { file_size: 321, commit_size: 1136, issue_size: 753 }\n2024-02-08T13:46:03.178575Z  INFO cupido: server up: http://127.0.0.1:9410\n```\n\nThe service is exposed on port 9410, and you can access the HTTP API through it. You can use our client or other HTTP\ntools to interact with it.\n\n```shell\n➜ curl http://127.0.0.1:9410/size\n{\"file_size\":10486,\"commit_size\":6983,\"issue_size\":1403}\n```\n\nYou can find our client and API documentation here: [node client](./client/node)\n\n### CLI\n\nPlease see `cupido --help`.\n\n## Performance\n\ncupido can also work with bare repo. At the most time, the analysis should finish in seconds.\n\n| Repository                           | Time Taken   | File Size | Commit Size | Issue Size |\n|--------------------------------------|--------------|-----------|-------------|------------|\n| https://github.com/microsoft/pyright | 8.046621521s | 10486     | 6983        | 1403       |\n| https://github.com/axios/axios       | 244.838094ms | 321       | 1136        | 753        |\n\n## Contribution\n\nIssues and PRs are always welcome. :)\n\nCurrently, we are working on API v1.\n\n## License\n\n[Apache 2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamfzc%2Fcupido","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliamfzc%2Fcupido","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamfzc%2Fcupido/lists"}