{"id":25961696,"url":"https://github.com/ttab/mage","last_synced_at":"2026-04-20T06:32:33.929Z","repository":{"id":224798131,"uuid":"764255840","full_name":"ttab/mage","owner":"ttab","description":"Reusable mage tasks","archived":false,"fork":false,"pushed_at":"2025-01-09T08:57:37.000Z","size":34,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-09T09:57:16.158Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/ttab.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":"2024-02-27T18:55:45.000Z","updated_at":"2025-01-09T08:57:25.000Z","dependencies_parsed_at":"2024-05-06T12:28:08.262Z","dependency_job_id":"9c4d9ad8-1732-4bc4-bf22-a0ce2780b111","html_url":"https://github.com/ttab/mage","commit_stats":null,"previous_names":["ttab/mage"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fmage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fmage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fmage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fmage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttab","download_url":"https://codeload.github.com/ttab/mage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241912991,"owners_count":20041457,"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":[],"created_at":"2025-03-04T19:41:01.461Z","updated_at":"2026-04-20T06:32:33.913Z","avatar_url":"https://github.com/ttab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mage tasks\n\nReusable [mage](https://magefile.org/) tasks.\n\nImport in your \"magefiles/magefile.go\" to add the tasks:\n\n``` go\n//go:build mage\n// +build mage\n\npackage main\n\nimport (\n    //mage:import sql\n    _ \"github.com/ttab/mage/sql\"\n    //mage:import twirp\n    _ \"github.com/ttab/mage/twirp\"\n    //mage:import s3\n    _ \"github.com/ttab/mage/s3\"\n)\n```\n\nThis will allow you to run the sql targets using: `mage sql:target-name`.\n\n## Twirp tasks\n\n### `twirp:stub` \"application\" \"Service\" \"MethodName\"\n\nStub generates a protobuf service stub in `rpc/[application]/service.proto`.\n\n### `twirp:generate`\n\nGenerate auto-discovers all `rpc/*/service.proto` files, runs protoc to compile the service declarations, and generates openapi3 specifications. The version is resolved from the last ancestor git tag.\n\n### `twirp:release` \"version\"\n\nRelease runs the same protoc compilation and openapi3 generation as `twirp:generate`, but uses the provided version string instead of resolving it from git tags.\n\n## SQL tasks\n\n### `sql:generate`\n\nGenerate uses sqlc to compile the SQL queries in postgres/queries.sql to Go, adding the default sqlc.yaml file if necessary.\n\n### `sql:sqlcConfig`\n\nSqlcConfig adds the default sqlc.yaml configuration file.\n\n### `sql:postgres` \"name\"\n\nPostgres creates a local Postgres instance using docker. Data will be stored under the platform data directory (e.g. `~/.local/share/tt-mage/postgres-[name]` on Linux, `~/Library/tt-mage/postgres-[name]` on macOS). Override with the `STATE_DIR` environment variable.\n\n### `sql:db`\n\nDB calls DBWithName using the current directory name as the database name.\n\n### `sql:dbWithName` \"name\"\n\nCreates a local database and login role with the same name and the password 'pass'.\n\n### `sql:dropDB`\n\nDropDB calls DropDBWithName using the current directory name as the database name.\n\n### `sql:dropDBWithName` \"name\"\n\nDrops the database and login role with the given name.\n\n### `sql:migrate`\n\nMigrate the database to the latest version using the migrations in \"./schema\".\n\n### `sql:rollback` N\n\nRollback to a specific schema version:\n\n``` shell\nmage sql:rollback 1\n```\n\n### `sql:connString`\n\nPrints the connection string for use with psql:\n\n``` shell\npsql $(mage sql:connString)\n```\n\n### `sql:dumpSchema`\n\nDumpSchema writes the current database schema to \"./postgres/schema.sql\".\n\n### `sql.GrantReporting`\n\nGrantReporting is a reusable function (not a standalone target) that grants SELECT on the provided tables to a reporting role. It prompts interactively for the role name and connection string. Wrap it in your magefile to expose it as a target:\n\n``` go\nfunc GrantReporting(ctx context.Context) error {\n    return sql.GrantReporting(ctx, []string{\"my_table\", \"other_table\"})\n}\n```\n\n## S3 tasks\n\n### `s3:minio`\n\nMinio creates a local minio instance using docker. Data will be stored under the platform data directory (e.g. `~/.local/share/tt-mage/local-minio` on Linux, `~/Library/tt-mage/local-minio` on macOS).\n\nExposes an S3 compatible endpoint on http://localhost:9000 and a web GUI on http://localhost:9001.\n\nUse minioadmin/minioadmin to log in, or as access key/secret for the API.\n\n### `s3:bucket` \"name\"\n\nCreates a bucket in the local minio instance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Fmage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttab%2Fmage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Fmage/lists"}