{"id":37177752,"url":"https://github.com/eminaktas/kbgen","last_synced_at":"2026-01-14T20:43:45.098Z","repository":{"id":277829667,"uuid":"933659715","full_name":"eminaktas/kbgen","owner":"eminaktas","description":"kbgen is a Go struct generator for Kubebuilder from KCL schemas","archived":false,"fork":false,"pushed_at":"2025-12-12T20:18:31.000Z","size":129,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-14T10:51:43.848Z","etag":null,"topics":["generator","kcl","kubebuilder"],"latest_commit_sha":null,"homepage":"","language":"Go","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/eminaktas.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-16T12:05:21.000Z","updated_at":"2025-12-12T20:17:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"0da808cc-ae3a-41b5-bf7a-e4fc43116959","html_url":"https://github.com/eminaktas/kbgen","commit_stats":null,"previous_names":["eminaktas/kbgen"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/eminaktas/kbgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminaktas%2Fkbgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminaktas%2Fkbgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminaktas%2Fkbgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminaktas%2Fkbgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eminaktas","download_url":"https://codeload.github.com/eminaktas/kbgen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminaktas%2Fkbgen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["generator","kcl","kubebuilder"],"created_at":"2026-01-14T20:43:44.430Z","updated_at":"2026-01-14T20:43:45.082Z","avatar_url":"https://github.com/eminaktas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kbgen\n\n**kbgen** is a tool that generates Go structs for Kubebuilder from KCL schemas. This approach ensures that schemas are compatible and ready for use—even when dealing with complex schema structures. By transforming KCL schema definitions into Go structs, kbgen simplifies integration with Kubebuilder-based (Kubernetes Operator) projects.\n\n## Installation\n\n### 1. Download and Install Pre-built Binary\n\nInstall kbgen using our dynamic installer. This script automatically detects the latest version and downloads the correct binary for your operating system and architecture. Make sure you have both curl and jq installed.\n\nRun the following commands in your terminal:\n\n```bash\nexport KBGEN_VERSION=$(curl -s \"https://api.github.com/repos/eminaktas/kbgen/tags\" | jq -r '.[0].name')\ncurl -sSL https://raw.githubusercontent.com/eminaktas/kbgen/$KBGEN_VERSION/install.sh | sh\n```\n\n### 2. Use `go install`\n\nIf you have a Go environment set up, you can install **kbgen** with:\n\n```bash\ngo install github.com/eminaktas/kbgen/cmd/kbgen@latest\n```\n\nThis will compile and install kbgen into your `$GOPATH/bin`.\n\n### 3. Build it from Source Code\n\nClone the repository and build the binary:\n\n```bash\ngit clone https://github.com/eminaktas/kbgen.git\ncd kbgen\ngo build -o kbgen ./cmd/kbgen\n```\n\nThen, move the binary to your `$PATH`:\n\n```bash\nsudo mv kbgen /usr/local/bin/\nchmod +x /usr/local/bin/kbgen\n```\n\n## Usage\n\nAfter installation, you can generate Go structs by running the following command:\n\n```bash\nkbgen gen --outputDir=example/example-go/pkg --packageName=models --programPath=example/kubeconf --directory=example/kubeconf/models --configPath=example/conf.yaml\n```\n\n### Command Flags\n\n- --outputDir: Output directory for the generated Go structs.\n- --packageName: Package name for the generated Go code.\n- --programPath: The directory where the KCL module (mod file) exists.\n- --directory: Directory containing the .k files used to generate the schemas.\n- --configPath: Path to the YAML configuration file.\n\n### Configuration\n\nThe generator uses a YAML configuration file to fine-tune its behavior. Below is an example configuration (example/conf.yaml):\n\n```yaml\n# Optional configuration for handling multiple types in KCL.\n# Uncomment and adjust if you need to override the default type (*apiextensionsv1.JSON).\n# customAnyType:\n#   type: '*apiextensionsv1.JSON'\n#   import: 'apiextensionsv1 \"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1\"'\n```\n\n### Workaround for Index Signature Schemas (Removed)\n\n**REMOVED**: This workaround is no longer necessary as the issue has been resolved in the kcl-go library. This note will be removed in the future.\n\nDue to an issue in the underlying kcl-go library (see [Issue #411](https://github.com/kcl-lang/kcl-go/issues/411)), schemas that use index signatures may not be automatically detected.\n\n### Kubebuilder Example\n\nBelow is an example of how the generated structs can be integrated into a Kubebuilder project:\n\n```go\npackage v1alpha1\n\nimport \"github.com/eminaktas/kbgen/example/example-go/pkg/models\"\n\n// KubeConfSpec defines the desired state of KubeConf.\ntype KubeConfSpec struct {\n   Server *models.Server `json:\"server,omitempty\"`\n}\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request with your suggestions or bug fixes.\n\n## License\n\nThis project is licensed under the [Apache-2.0 License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feminaktas%2Fkbgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feminaktas%2Fkbgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feminaktas%2Fkbgen/lists"}