{"id":16977119,"url":"https://github.com/rickyes/kiritobuf","last_synced_at":"2025-08-13T06:05:43.083Z","repository":{"id":97125602,"uuid":"143006877","full_name":"rickyes/kiritobuf","owner":"rickyes","description":"Interface description language | Kirito ⚔","archived":false,"fork":false,"pushed_at":"2022-02-11T13:55:18.000Z","size":8,"stargazers_count":12,"open_issues_count":4,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T01:04:18.369Z","etag":null,"topics":["ast","compiler","idl","kirito","nodejs","parser","tokenizer"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/rickyes.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":"2018-07-31T11:45:22.000Z","updated_at":"2024-11-12T09:23:45.000Z","dependencies_parsed_at":"2023-04-04T08:30:55.733Z","dependency_job_id":null,"html_url":"https://github.com/rickyes/kiritobuf","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"395d3b113b2a3e3b86769f2472d2c54965e8e4f6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyes%2Fkiritobuf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyes%2Fkiritobuf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyes%2Fkiritobuf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyes%2Fkiritobuf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rickyes","download_url":"https://codeload.github.com/rickyes/kiritobuf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501860,"owners_count":21114684,"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":["ast","compiler","idl","kirito","nodejs","parser","tokenizer"],"created_at":"2024-10-14T01:28:05.807Z","updated_at":"2025-04-12T01:21:40.152Z","avatar_url":"https://github.com/rickyes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kiritobuf\n\n\nInterface Description Language | Kirito\n\n[![Travis](https://img.shields.io/travis/rickyes/kiritobuf.svg?style=for-the-badge)](https://travis-ci.org/rickyes/kiritobuf)\n[![Node Version](https://img.shields.io/badge/node-%3E=9.0.0-brightgreen.svg?longCache=true\u0026style=for-the-badge)](https://www.npmjs.com/package/kiritobuf)\n[![npm](https://img.shields.io/npm/v/kiritobuf.svg?style=for-the-badge)](https://www.npmjs.com/package/kiritobuf)\n\n## Install\n``` shell\n$ npm i kiritobuf --save\n```\n\n## Get Started\n1. Define the `kirito` suffix file\n```shell\n# test\n\nservice testService {\n  method ping (reqMsg, resMsg)\n}\n\nstruct reqMsg {\n  @1 age = Int16;\n  @2 name = Text;\n}\n\nstruct resMsg {\n  @1 age = Int16;\n  @2 name = Text;\n}\n```\n2. Generate `AST`\n``` js\n'use strict';\n\nconst path = require('path');\nconst kirito = require('kiritobuf');\nconst kiritoProto = './test.kirito';\n\nconst k = new kirito();\n\nconst AST = k.parse(path.join(__dirname, kiritoProto));\n\nconsole.log(JSON.stringify(AST, null, 2));\n```\n3. AST struct\n``` json\n{\n  \"type\": \"Program\",\n  \"body\": [\n    {\n      \"type\": \"StructDeclaration\",\n      \"name\": \"service\",\n      \"value\": \"testService\",\n      \"params\": [\n        {\n          \"type\": \"StructDeclaration\",\n          \"name\": \"method\",\n          \"value\": \"ping\",\n          \"params\": [\n            {\n              \"type\": \"Identifier\",\n              \"value\": \"reqMsg\"\n            },\n            {\n              \"type\": \"Identifier\",\n              \"value\": \"resMsg\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"type\": \"StructDeclaration\",\n      \"name\": \"struct\",\n      \"value\": \"reqMsg\",\n      \"params\": [\n        {\n          \"type\": \"VariableDeclaration\",\n          \"name\": \"@\",\n          \"value\": \"1\",\n          \"params\": [\n            {\n              \"type\": \"Identifier\",\n              \"value\": \"age\"\n            },\n            {\n              \"type\": \"DataType\",\n              \"value\": \"Int16\"\n            }\n          ]\n        },\n        {\n          \"type\": \"VariableDeclaration\",\n          \"name\": \"@\",\n          \"value\": \"2\",\n          \"params\": [\n            {\n              \"type\": \"Identifier\",\n              \"value\": \"name\"\n            },\n            {\n              \"type\": \"DataType\",\n              \"value\": \"Text\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"type\": \"StructDeclaration\",\n      \"name\": \"struct\",\n      \"value\": \"resMsg\",\n      \"params\": [\n        {\n          \"type\": \"VariableDeclaration\",\n          \"name\": \"@\",\n          \"value\": \"1\",\n          \"params\": [\n            {\n              \"type\": \"Identifier\",\n              \"value\": \"age\"\n            },\n            {\n              \"type\": \"DataType\",\n              \"value\": \"Int16\"\n            }\n          ]\n        },\n        {\n          \"type\": \"VariableDeclaration\",\n          \"name\": \"@\",\n          \"value\": \"2\",\n          \"params\": [\n            {\n              \"type\": \"Identifier\",\n              \"value\": \"name\"\n            },\n            {\n              \"type\": \"DataType\",\n              \"value\": \"Text\"\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n```\n\n## Author\nKiritobuf © [Ricky 泽阳](https://github.com/rickyes), Released under the MIT License. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickyes%2Fkiritobuf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickyes%2Fkiritobuf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickyes%2Fkiritobuf/lists"}