{"id":23033664,"url":"https://github.com/tamdaz/cruml","last_synced_at":"2025-04-23T17:03:52.795Z","repository":{"id":268177662,"uuid":"903555661","full_name":"tamdaz/cruml","owner":"tamdaz","description":"A tool that provides an UML class diagram generator for any Crystal projects.","archived":false,"fork":false,"pushed_at":"2025-04-20T14:39:18.000Z","size":630,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T17:02:45.579Z","etag":null,"topics":["crystal-lang","diagram","organize","uml"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/tamdaz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2024-12-14T22:41:48.000Z","updated_at":"2025-04-21T12:15:45.000Z","dependencies_parsed_at":"2025-04-15T12:36:40.041Z","dependency_job_id":null,"html_url":"https://github.com/tamdaz/cruml","commit_stats":null,"previous_names":["tamdaz/cruml"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamdaz%2Fcruml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamdaz%2Fcruml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamdaz%2Fcruml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamdaz%2Fcruml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tamdaz","download_url":"https://codeload.github.com/tamdaz/cruml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250477810,"owners_count":21437049,"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":["crystal-lang","diagram","organize","uml"],"created_at":"2024-12-15T16:17:23.991Z","updated_at":"2025-04-23T17:03:52.790Z","avatar_url":"https://github.com/tamdaz.png","language":"Crystal","funding_links":[],"categories":["Recently Updated","Code Analysis and Metrics"],"sub_categories":["[May 03, 2025](/content/2025/05/03/README.md)"],"readme":"# cruml\n\n![GitHub Release](https://img.shields.io/github/v/release/tamdaz/cruml)\n[![ci](https://github.com/tamdaz/cruml/actions/workflows/ci.yml/badge.svg)](https://github.com/tamdaz/cruml/actions/workflows/ci.yml)\n\n[![crystal doc info](https://img.shields.io/badge/main-CrystalDoc.info-2E1052?logo=crystal\u0026style=for-the-badge)](https://crystaldoc.info/github/tamdaz/cruml/main/index.html)\n\n\u003e [!WARNING]\n\u003e This tool is under development, it is not completely finished.\n\n**cruml** *(**Cr**ystal **UML**)* is a tool that allows to generate an UML diagram. This is useful for all projects using the Crystal language that need to know their structure.\n\n![uml_class_diagram](img/diagram.png)\n\n\u003e An UML class diagram representing the parent class linked to child classes.\n\n## Requirements\n\nTo do this, d2 should be installed in your machine.\n\nDocumentation source : https://d2lang.com/tour/install#install-script.\n\n## Compatibilities\n\nHere is the compatibility table:\n\n| Cruml version | Crystal version   |\n|---------------|-------------------|\n| \u003e\u003e\u003e soon...                       |\n| v0.7.0        | v1.16.0 \u0026 v1.16.1 |\n\n\u003e [!TIP]\n\u003e Table is subject to change.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n```yaml\ndevelopment_dependencies:\n  cruml:\n    github: tamdaz/cruml\n```\n\n2. Run `shards install`.\n\nOnce this tool installed, this will build a binary into `bin/` directory in your project.\n\n## Usage\n\n```\nUsage : cruml [subcommand] [arguments] -- [options]\n    config                           Configuration\n    generate                         Generate the class diagram\n    -v, --version                    Show the version\n    -h, --help                       Show this help\n```\n\n```\nUsage : cruml generate [arguments] -- [options]\n    -v, --version                    Show the version\n    -h, --help                       Show this help\n    --verbose                        Enable verbose\n    --dark-mode                      Set to dark mode\n    --no-color                       Disable color output\n    --path=PATH                      Path to specify\n    --output-dir=DIR                 Directory path to save diagrams\n```\n\n```\nUsage : cruml [subcommand] [arguments] -- [options]\n    -v, --version                    Show the version\n    -h, --help                       Show this help\n    --generate                       Generate a YML config\n```\n\n## Examples\n\nFor example, to generate a diagram with Crystal files from the `src/models` directory:\n\n```sh\nbin/cruml generate --path=\"src/models\"\n```\n\nTo generate a diagram with one Crystal file:\n\n```sh\nbin/cruml generate --path=\"src/models/user.cr\"\n```\n\n\u003e [!TIP]\n\u003e You can use multiple `--path` flag to include several files or directories.\n\nIn addition, you can set your diagram to the dark mode thanks to `--dark-mode` flag:\n\n```sh\nbin/cruml generate --path=\"src/models\" --dark-mode\n```\n\nIf you don't want to colorize the diagram, you can use the `--no-color` flag:\n\n```sh\nbin/cruml generate --path=\"src/models\" --no-color\n```\n\n## Configuration\n\nFlags are useful to generate the class diagram. In addition, you can use the YML config file to group namespaces,\ncustomize the color of the classifiers and add paths.\n\n```yml\ncolors:\n  light:\n    classes: \"#baa7e5\"\n    abstract_classes: \"#a7e5a7\"\n    interfaces: \"#e2c7a3\"\n    modules: \"#5ab3f4\"\n  dark:\n    classes: \"#2e1065\"\n    abstract_classes: \"#365314\"\n    interfaces: \"#af6300\"\n    modules: \"#0041cc\"\n\npaths:\n  - src/entities\n  - src/controllers\n  - src/services\n\nnamespaces:\n  MyNamespace:\n    - App::Services::ClassOne\n    - App::Services::ClassTwo\n    - App::Services::ClassThree\n```\n\nThanks to this config, you will not need to use flags in the CLI, just run `bin/cruml generate`.\n\n## Troubleshooting\n\n- Tool cannot know if there are objects in the recursive modules.\n- d2 binary cannot display the multi-line method signature.\n- Fonts cannot be automatically customized _(unless we manually edit the SVG file once generated)_. We'll see if d2 contributors can implement this feature later.\n- Return type of a method should be indicated explicity, otherwise it will display `void`.\n- Recursive modules aren't supported for the moment. For example, if you have a code that look like this:\n```crystal\nmodule MyModule\n  module MySubModule\n    class MyClass\n      getter name : String\n    end\n  end\nend\n```\n\nIt will get only the class `MyClass` but the namespace will not be prefixed with (`MyModule::MySubModule::MyClass`).\nIf you want to include the namespace in your class name, you have to use the implicit namespace by doing this:\n\n```crystal\nclass MyModule::MySubModule::MyClass\n  getter name : String\nend\n```\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/tamdaz/cruml/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [tamdaz](https://github.com/tamdaz) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamdaz%2Fcruml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftamdaz%2Fcruml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamdaz%2Fcruml/lists"}