{"id":21194088,"url":"https://github.com/nahkd123/codetool","last_synced_at":"2026-05-08T06:40:29.162Z","repository":{"id":203359718,"uuid":"709415557","full_name":"nahkd123/codetool","owner":"nahkd123","description":"CLI tools to help you work faster with your code","archived":false,"fork":false,"pushed_at":"2023-10-24T17:14:31.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-07T12:44:51.158Z","etag":null,"topics":["cli","code-generation","codegen","node","tool","typescript"],"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/nahkd123.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}},"created_at":"2023-10-24T17:11:00.000Z","updated_at":"2023-10-24T17:12:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"e44394d8-f764-4e2a-b797-853466bfd883","html_url":"https://github.com/nahkd123/codetool","commit_stats":null,"previous_names":["nahkd123/codetool"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nahkd123/codetool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahkd123%2Fcodetool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahkd123%2Fcodetool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahkd123%2Fcodetool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahkd123%2Fcodetool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nahkd123","download_url":"https://codeload.github.com/nahkd123/codetool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nahkd123%2Fcodetool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280088702,"owners_count":26269914,"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","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cli","code-generation","codegen","node","tool","typescript"],"created_at":"2024-11-20T19:19:41.922Z","updated_at":"2025-10-20T12:14:42.786Z","avatar_url":"https://github.com/nahkd123.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codetool\n_CLI tools to help you work faster with your code!_\n\n## Using Codetool\n### Build and install\n```sh\ngit clone https://github.com/nahkd123/codetool.git\ncd codetool\nnpm run build\nnpm install -g .\n# Use codetool to get started\n```\n\n\u003e You need NodeJS and npm to install Codetool.\n\n### Reproducing build\nCodetool was initialized with `pnpm`, so you'll need to use `pnpm` to reproduce build from `pnpm-lock.yml`.\n\n### Codetool Filler\nFiller is a code generation tool. You can use Filler to generate code based on your templates.\n\nThere are 2 kinds of templates:\n- In-source: These templates are located inside your source code. When you use `filler new`, it will insert generated code on top of your template (which is a comment block).\n- Template file: These templates creates new files inside its parent directory.\n\nIn order to use Filler, you'll need to add `codetool.filler.json` at the project root. An example config file looks like this:\n\n```json\n{\n    \"mapping\": [\n        { \"regex\": \".+\\\\.txt$\", \"flags\": \"g\", \"mode\": \"in-source\" },\n        { \"regex\": \".+\\\\.template\", \"flags\": \"g\", \"mode\": \"file-template\" }\n    ]\n}\n```\n\n- `mapping`: Configure how Filler search for files and help it figure out whether the file is your source code or template.\n    - `regex`: The regular expression to match with the absolute file path (which is something like `/home/username/file.txt` or `C:\\Users\\username\\Documents\\file.txt`).\n    - `flags`: The regular expression flags.\n    - `mode`: The type of file. `in-source` will mark matching files as source code. `file-template` will mark matching files as template file.\n\nIn your source code, any occurences of comment block with its first line follows the `@template \u003ctemplate-id\u003e [parameters-spec]` format will be treated as template:\n\n```java\npublic class Main implements ModInitializer {\n    @Override\n    public void onInitialize() {\n        /*\n         * @template cosmetic id:snake\n         * CosmeticsManager.register(new Identifier(\"modid\", \"${{ id.snake }}\"), new ${{ id.pascal }}());\n         */\n    }\n}\n```\n\nIf you use `codetool filler new cosmetic id=my_cosmetic`, the generated code will be inserted above your template:\n\n```java\n@Override\npublic void onInitialize() {\n    CosmeticsManager.register(new Identifier(\"modid\", \"my_cosmetic\"), new MyCosmetic());\n    // @template cosmetic id:snake ...\n}\n```\n\nIn your template file, you can write like this:\n\n```\n@template cosmetic id:snake\n@use filename ${{ id.pascal }}.java\n@endheader\n\npackage com.example;\n\nimport net.example.Cosmetic;\n\npublic class ${{ id.pascal }} implements Cosmetic {\n    @Override\n    public void initializeCosmetic() {\n        // ...\n    }\n}\n```\n\nWhen run the command above, you'll get a new `MyCosmetic.java` file:\n\n```java\npackage com.example;\n\nimport net.example.Cosmetic;\n\npublic class MyCosmetic implements Cosmetic {\n    @Override\n    public void initializeCosmetic() {\n        // ...\n    }\n}\n```\n\nYou might have noticed: there's a `:snake` after your parameter name. This is what we call \"input parameter case specifier\". If you don't specify the initial case, stuffs like `${{ param.pascal }}` will not work (in this case, it will not give you PascalCase version of your `param`).\n\nThere are 5 cases for identifiers that you can use:\n- `PascalCase`: For Java class names and C# symbols.\n- `snake_case`: For Rust, JSON and string IDs.\n- `kebab-case`: For CSS.\n- `camelCase`: For Java variable names.\n- `CONSTANT_CASE`: For constant names.\n\n## Copyright and License\n(c) nahkd 2023. Licensed under MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnahkd123%2Fcodetool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnahkd123%2Fcodetool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnahkd123%2Fcodetool/lists"}