MCPcopy Index your code
hub / github.com/MagaluCloud/magalu

github.com/MagaluCloud/magalu @v0.61.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.61.2 ↗ · + Follow
2,866 symbols 8,132 edges 397 files 346 documented · 12% updated 15d agov0.36.0 · 2025-03-24★ 431 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

MGC

This repository contains the monorepo developed for Magalu Cloud (MGC). Each subdirectory within mgc/ corresponds to a Go module:

  • Core: Definition of data types used for the intermediate structure generated by the SDK after parsing either an OpenAPI spec or a static definition.

  • SDK: Implement the concrete data types defined by core to generate usable commands. The commands can be used by the CLI via Cobra commands, or by Terraform Plugin Provider to perform CRUD on resources.

  • CLI: Go CLI, using Cobra, with commands and actions defined by the SDK. The commands can either come from dynamic loaded OpenAPI spec or static modules, i.e: authentication.

Our code is written in Golang, however there are some utility scripts written in Python as well.

Looking for Terraform code? Check out the Terraform provider repository

Dependencies

To run the project, the main dependency needed is Go. To install, visit the official link with the instructions.

There are some utility scripts written in Python. For this, Poetry is used. Check Poetry.md for instructions.

Building and running locally

Building needs goreleaser and can be done using Makefile targets.

If you have API spec changes, update them on specs, on the corresponding product and run the following commands:

  1. :zap: to validate and prettify the specs
$ make prepare-specs
  1. :zap: this command will convert the oas file with 3.1.x version to 3.0.x version.
$ make downgrade-specs
  1. :zap: refresh specs
$ make refresh-specs

After that (or if there are no further spec changes), build the CLI with:

$ make build-local

If all goes well, the output binary will be a platform-dependent directory, where it can be run:

$ cd dist/mgc_<your_platform>
$ ./mgc

OpenAPI

See sdk/openapi/README.md

Adding new APIs

OpenAPIs

To add a new API spec, see instructions.

Static APIs

Manually written APIs should be added to mgc/sdk/static, follow the structure in the exiting modules (auth, config).

Contributing

pre-commit

We use pre-commit to install git hooks and enforce lint, formatting, tests, commit messages and others. This tool depends on Python as well. On pre-commit we enforce:

  • On commit-msg for all commits:
  • Conventional commit pattern with commitzen
  • On pre-commit for Go files:
  • Complete set of golangci-lint: errcheck, gosimple, govet, ineffasign, staticcheck, unused
  • On pre-commit for Python files:
  • flake8 and black enforcing pep code styles

Installation

Mac

brew install pre-commit

pip

pip install pre-commit

For other types of installation, check their official doc.

Configuration

After installing, the developer must configure the git hooks inside its clone:

pre-commit install

Linters

We install the go linters via pre-commit, so it is automatically run by the pre-commit git hook. However, if one wants to run standalone it can be done via:

pre-commit run golangci-lint

Run all

Run pre-commit without any file modified:

pre-commit run -a

Extension points exported contracts — how you extend this code

ExecutorWrapper (Interface)
NOTE: whenever you wrap an executor remember to also wrap the result with ExecutorWrapResult() so the outmost executor i [26 …
mgc/core/types.go
OutputFormatter (Interface)
(no doc) [9 implementers]
mgc/cli/cmd/output.go
MarkdownReportGenerator (Interface)
(no doc) [1 implementers]
mgc/spec_manipulator/cmd/spec/markdown-report/build_report.go
ResultWrapper (Interface)
(no doc) [26 implementers]
mgc/core/result.go
SchemaFlagValue (Interface)
(no doc) [1 implementers]
mgc/cli/cmd/schema_flags/schema_flag_value.go
FilterRule (Interface)
Use an interface and then structs so debugging is simpler, we can get the tree and actual values instead of plain functi [4 …
mgc/core/pipeline/filter.go
COW (Interface)
Copy-on-Write are helper to manage a mutable value, generating a copy whenever it will be written the first time If no w [2 …
mgc/core/utils/cow.go
Loader (Interface)
Given a name (path), return its contents [2 implementers]
mgc/core/dataloader/loader.go

Core symbols most depended-on inside this repo

Set
called by 134
mgc/core/utils/cow.go
Get
called by 99
mgc/core/utils/cow.go
Join
called by 98
mgc/core/schema/types.go
Contains
called by 64
mgc/core/utils/cow_slice_of_cow.go
Error
called by 60
mgc/core/http/http.go
String
called by 60
mgc/sdk/static/object_storage/common/types.go
Encode
called by 51
mgc/core/result.go
Run
called by 50
mgc/core/retry_until.go

Shape

Function 1,250
Method 998
Struct 413
Class 78
TypeAlias 55
Interface 42
FuncType 30

Languages

Go91%
Python9%

Modules by API surface

mgc/core/schema/cow.go125 symbols
scripts/spec_stats.py88 symbols
mgc/core/auth/auth.go84 symbols
mgc/core/schema/simplify_schema_test.go56 symbols
scripts/yaml_merge.py47 symbols
scripts/transformers/oapi_types.py47 symbols
mgc/core/ref_resolver.go46 symbols
mgc/core/pipeline/filter.go45 symbols
mgc/core/result.go41 symbols
mgc/sdk/openapi/operation.go40 symbols
mgc/cli/cmd/output_table.go37 symbols
mgc/cli/cmd/schema_flags/parsers.go36 symbols

For agents

$ claude mcp add magalu \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page