{"id":31595267,"url":"https://github.com/escherize/miracles","last_synced_at":"2026-02-15T12:36:50.652Z","repository":{"id":308983507,"uuid":"1034794739","full_name":"escherize/miracles","owner":"escherize","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-09T02:20:43.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-06T03:59:05.127Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/escherize.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-08-09T02:15:45.000Z","updated_at":"2025-08-09T02:20:46.000Z","dependencies_parsed_at":"2025-08-09T04:13:17.629Z","dependency_job_id":"f475589c-7fdd-40af-9c9b-11e9dec26c75","html_url":"https://github.com/escherize/miracles","commit_stats":null,"previous_names":["escherize/miracles"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/escherize/miracles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherize%2Fmiracles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherize%2Fmiracles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherize%2Fmiracles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherize%2Fmiracles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/escherize","download_url":"https://codeload.github.com/escherize/miracles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/escherize%2Fmiracles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29478354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T11:35:25.641Z","status":"ssl_error","status_checked_at":"2026-02-15T11:34:57.128Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2025-10-06T03:58:51.240Z","updated_at":"2026-02-15T12:36:50.635Z","avatar_url":"https://github.com/escherize.png","language":"Gleam","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Miracles\n\n**⚠️ Experimental Project**: This is an experimental AST-based macro system for the Gleam programming language. It's a proof-of-concept exploring code generation through comment annotations.\n\n[![Package Version](https://img.shields.io/hexpm/v/miracles)](https://hex.pm/packages/miracles)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/miracles/)\n\n## Overview\n\nMiracles is an experiment in bringing macro-like capabilities to Gleam through comment annotations and AST manipulation. The system parses Gleam code, finds annotation comments, and applies transformations to generate new functions.\n\n## Installation\n\n```sh\ngleam add miracles@1\n```\n\n## Quick Example\n\n**Input (`src/input_code.gleam`):**\n```gleam\n// @make_printer\npub type Cardinal {\n  North\n  East\n  South\n  West\n}\n```\n\n**Generated Output (`src/output_code.gleam`):**\n```gleam\nimport gleam/io\n\npub type Cardinal {\n  North()\n  East()\n  South()\n  West()\n}\n\npub fn print_cardinal(cardinal: Cardinal) {\n  case cardinal {\n    North() -\u003e io.println(\"North\")\n    East() -\u003e io.println(\"East\")\n    South() -\u003e io.println(\"South\")\n    West() -\u003e io.println(\"West\")\n  }\n}\n```\n\n## How It Works\n\n1. **Annotation**: Add a comment annotation above your type definition (e.g., `// @make_printer`)\n2. **Processing**: Run the macro system to parse your code into an AST using `glance`\n3. **Generation**: The system finds annotations and applies the corresponding macro function\n4. **Output**: Generated code is written to the output file with new functions added\n\n## Available Macros\n\n### `@make_printer`\n\nGenerates a printer function for custom types that prints the variant name for each constructor.\n\n## Usage\n\n```sh\ngleam run   # Process input_code.gleam and generate output_code.gleam\n```\n\nThe system reads from `src/input_code.gleam` and writes the transformed code to `src/output_code.gleam`.\n\n## Experiment Status\n\nThis is a learning project exploring:\n- AST manipulation in Gleam using the `glance` library\n- Comment-based annotation systems\n- Code generation patterns\n- Macro-like transformations in a functional language\n\nThe implementation is intentionally simple and serves as a foundation for understanding how such systems might work.\n\n## Development\n\n```sh\ngleam run   # Run the macro processor\ngleam test  # Run the tests\n```\n\nFurther documentation can be found at \u003chttps://hexdocs.pm/miracles\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescherize%2Fmiracles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fescherize%2Fmiracles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fescherize%2Fmiracles/lists"}