{"id":15282772,"url":"https://github.com/mkloubert/go-package-manager","last_synced_at":"2025-05-06T21:08:10.067Z","repository":{"id":239538809,"uuid":"797626926","full_name":"mkloubert/go-package-manager","owner":"mkloubert","description":"A package manager for Go","archived":false,"fork":false,"pushed_at":"2025-04-09T15:59:58.000Z","size":22045,"stargazers_count":4,"open_issues_count":13,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-06T21:07:47.213Z","etag":null,"topics":["cli","command-line","command-line-tool","go","golang","golang-cli","golang-tools","ollama","ollama-api","openai","openai-api","package-management","package-manager","swissarmyknife","tools"],"latest_commit_sha":null,"homepage":"https://gpm.kloubert.dev/","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/mkloubert.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"custom":"paypal.me/MarcelKloubert"}},"created_at":"2024-05-08T07:53:45.000Z","updated_at":"2025-04-09T16:00:02.000Z","dependencies_parsed_at":"2024-05-13T07:43:13.797Z","dependency_job_id":"66e7a559-9580-41db-8fa9-833017384b2b","html_url":"https://github.com/mkloubert/go-package-manager","commit_stats":null,"previous_names":["mkloubert/go-package-manager"],"tags_count":122,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkloubert%2Fgo-package-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkloubert%2Fgo-package-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkloubert%2Fgo-package-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkloubert%2Fgo-package-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkloubert","download_url":"https://codeload.github.com/mkloubert/go-package-manager/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252769421,"owners_count":21801378,"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":["cli","command-line","command-line-tool","go","golang","golang-cli","golang-tools","ollama","ollama-api","openai","openai-api","package-management","package-manager","swissarmyknife","tools"],"created_at":"2024-09-30T14:39:28.595Z","updated_at":"2025-05-06T21:08:10.045Z","avatar_url":"https://github.com/mkloubert.png","language":"Go","funding_links":["paypal.me/MarcelKloubert","https://paypal.me/MarcelKloubert","https://opencollective.com/babel","https://github.com/sponsors/alecthomas","https://github.com/sponsors/c-bata","https://github.com/sponsors/goccy","https://github.com/sponsors/shirou","https://github.com/sponsors/schollz","https://github.com/sponsors/briandowns","https://github.com/sponsors/rivo"],"categories":["Go [⬆](#table-of-contents-)"],"sub_categories":[],"readme":"# gpm - A swiss army knife written in and for Go\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./img/gpm_logo_by_marcel_joachim_kloubert.png\" alt=\"GPM logo\" width=\"512\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Copyright by \u003ca href=\"https://marcel.coffee\" target=\"_blank\"\u003eMarcel Joachim Kloubert\u003c/a\u003e, created with \u003ca href=\"https://www.midjourney.com/\" target=\"_blank\"\u003eMidjourney\u003c/a\u003e\n\u003c/p\u003e\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/mkloubert/go-package-manager.svg)](https://pkg.go.dev/github.com/mkloubert/go-package-manager) [![Go Report Card](https://goreportcard.com/badge/github.com/mkloubert/go-package-manager)](https://goreportcard.com/report/github.com/mkloubert/go-package-manager)\n\n[![Share via Pinterest](https://raw.githubusercontent.com/mkloubert/go-package-manager/master/img/share/Pinterest.png)](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fgithub.com%2Fmkloubert%2Fgo-package-manager\u0026description=gpm%20-%20Go%20Package%20Manager) [![Share via Reddit](https://raw.githubusercontent.com/mkloubert/go-package-manager/master/img/share/Reddit.png)](https://www.reddit.com/submit?url=https%3A%2F%2Fgithub.com%2Fmkloubert%2Fgo-package-manager\u0026title=gpm%20-%20Go%20Package%20Manager) [![Share via LinkedIn](https://raw.githubusercontent.com/mkloubert/go-package-manager/master/img/share/LinkedIn.png)](https://www.linkedin.com/shareArticle?mini=true\u0026url=https%3A%2F%2Fgithub.com%2Fmkloubert%2Fgo-package-manager\u0026title=gpm%20-%20Go%20Package%20Manager) [![Share via Wordpress](https://raw.githubusercontent.com/mkloubert/go-package-manager/master/img/share/Wordpress.png)](https://wordpress.com/press-this.php?u=https%3A%2F%2Fgithub.com%2Fmkloubert%2Fgo-package-manager\u0026s=gpm%20-%20Go%20Package%20Manager) [![Share via Email](https://raw.githubusercontent.com/mkloubert/go-package-manager/master/img/share/Email.png)](mailto:?subject=gpm%20-%20Go%20Package%20Manager\u0026body=https%3A%2F%2Fgithub.com%2Fmkloubert%2Fgo-package-manager)\n\n## Table of contents\n\n- [Overview](#overview-)\n- [Installation](#installation-)\n  - [MacOS / Linux / UNIX](#macos--linux--unix-)\n  - [Windows](#windows-)\n  - [Build from source](#build-from-source-)\n- [Updates](#updates-)\n- [Usage](#usage-)\n  - [Commands](#commands-)\n    - [Add alias](#add-alias-)\n    - [Add project](#add-project-)\n    - [AI chat](#ai-chat-)\n    - [AI image description](#ai-image-description-)\n    - [AI prompt](#ai-prompt-)\n    - [Build and install executable](#build-and-install-executable-)\n    - [Build project](#build-project-)\n    - [Bump version](#bump-version-)\n    - [Checkout branch](#checkout-branch-)\n      - [Branch aliases](#branch-aliases-)\n    - [Checkup project](#checkup-project-)\n    - [Cleanup project](#cleanup-project-)\n    - [Clone project](#clone-project-)\n    - [Compare code changes](#compare-code-changes-)\n    - [Compression](#compression-)\n    - [Cron jobs](#cron-jobs-)\n    - [Docker shorthands](#docker-shorthands-)\n    - [Encoding](#encoding-)\n    - [Execute shell command](#execute-shell-command-)\n    - [Generate documentation](#generate-documentation-)\n    - [Generate PowerPoint](#generate-powerpoint-)\n    - [Generate project](#generate-project-)\n    - [Import aliases](#import-aliases-)\n    - [Import projects](#import-projects-)\n    - [Install dependencies](#install-dependencies-)\n    - [List aliases](#list-aliases-)\n    - [List executables](#list-executables-)\n    - [List projects](#list-projects-)\n    - [Monitor process](#monitor-process-)\n    - [New project](#new-project-)\n    - [Open alias](#open-alias-)\n    - [Open project](#open-project-)\n    - [Pack project](#pack-project-)\n    - [Passwords and unique IDs](#passwords-and-unique-ids-)\n    - [Publish new version](#publish-new-version-)\n    - [Pull from Git remotes](#pull-from-git-remotes-)\n    - [Push to Git remotes](#push-to-git-remotes-)\n    - [Remove alias](#remove-alias-)\n    - [Remove project](#remove-project-)\n    - [Remove executable](#remove-project-executable-)\n    - [Run script](#run-script-)\n    - [Run tests](#run-tests-)\n    - [Show dependency graph](#show-dependency-graph-)\n    - [Sleep](#sleep-)\n    - [Start project](#start-project-)\n    - [Synchronize with Git remotes](#synchronize-with-git-remotes-)\n    - [Uninstall dependencies](#uninstall-dependencies-)\n    - [Update dependencies](#update-dependencies-)\n  - [Setup AI](#setup-ai-)\n    - [OpenAI / ChatGPT](#openai--chatgpt-)\n    - [Ollama](#ollama-)\n- [gpm.yaml](#gpmyaml-)\n  - [Files](#files-)\n  - [Scripts](#scripts-)\n    - [Predefined](#predefined-)\n- [Environment variables](#environment-variables-)\n  - [Supported variables](#supported-variables-)\n- [Contribution](#contribution-)\n- [Support](#support-)\n- [License](#license-)\n- [Credits](#credits-)\n\n## Overview [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\n`gpm` is a command-line tool designed to simplify developer workflows in particular for Go projects.\n\nHowever, it's not only limited to Go but can also be utilized for other project types as well.\n\n**KEEP IN MIND**: This project is in an beta state and under heavy development. It might happen that there will be breaking changes. Have a look at the [CHANGELOG.md file](CHANGELOG.md).\n\n## Installation [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\nYou can install `gpm` from a [pre-build binary](https://github.com/mkloubert/go-package-manager/releases) or build it by your own:\n\n### MacOS / Linux / UNIX [\u003ca href=\"#installation-\"\u003e↑\u003c/a\u003e]\n\nYou can simply execute the follow remote [shell script](https://sh.kloubert.dev/gpm.sh):\n\n```bash\nwget -qO- \"https://sh.kloubert.dev/gpm.sh\" | sh\n```\n\nLater you can run the command again to update the tool as well.\n\n### Windows [\u003ca href=\"#installation-\"\u003e↑\u003c/a\u003e]\n\nYou can simply execute the follow remote [PowerShell script](https://sh.kloubert.dev/gpm.ps1):\n\n```powershell\nInvoke-WebRequest -Uri \"https://sh.kloubert.dev/gpm.ps1\" | Select-Object -ExpandProperty Content | Invoke-Expression\n```\n\nLater you should be able to run the command again to update the tool as well.\n\n### Build from source [\u003ca href=\"#installation-\"\u003e↑\u003c/a\u003e]\n\n```bash\n# checkout current source\ngit clone https://github.com/mkloubert/go-package-manager.git -o gpm\n\n# switch to new subfolder, build and run it\ncd gpm\ngo build . \u0026\u0026 ./gpm --version\n```\n\n## Updates [\u003ca href=\"#installation-\"\u003e↑\u003c/a\u003e]\n\nA self-update works with\n\n```bash\ngpm update --self\n```\n\nif you have a valid [sh](https://en.wikipedia.org/wiki/Unix_shell) or [PowerShell](https://en.wikipedia.org/wiki/PowerShell) installed.\n\nYou are able to customize final directory with `GPM_INSTALL_PATH`, which is `C:\\Program Files\\gpm` on Windows and `/usr/local/bin` on POSIX-like systems by default e.g.\n\n## Usage [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\n### Commands [\u003ca href=\"#usage-\"\u003e↑\u003c/a\u003e]\n\n#### Add alias [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nWith\n\n```bash\ngpm add alias yaml https://github.com/go-yaml/yaml\n```\n\nyou define the alias `yaml` which refers to the Git repository in `https://github.com/go-yaml/yaml`. This information will be stored in `aliases.yaml` file inside your `\u003cGPM-ROOT\u003e` folder.\n\nIf you later run\n\n```bash\ngpm install yaml\n```\n\n`go get -u https://github.com/go-yaml/yaml` will be executed instead.\n\n#### Add project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nWith\n\n```bash\ngpm add project react-project https://github.com/ofnullable/react-spa-template\n```\n\nyou define the alias `react-project` which refers to the Git repository in `https://github.com/ofnullable/react-spa-template`. This information will be stored in `projects.yaml` file inside your `\u003cGPM-ROOT\u003e` folder.\n\nIf you later run\n\n```bash\ngpm new react-project\n```\n\nthe repository will be cloned to `react-spa-template` subfolder, then its `.git` folder will be removed and the new folder will be re-initialized with `git init`.\n\n#### AI chat [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n![AI Chat Demo 1](./img/demos/ai-chat-demo-1.gif)\n\n#### AI image description [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n![AI Image Description Demo 1](./img/demos/ai-image-description-demo-1.gif)\n\n#### AI prompt [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n![AI Prompt Demo 1](./img/demos/ai-prompt-demo-1.gif)\n\n#### Build and install executable [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\ngpm make https://github.com/gohugoio/hugo\n```\n\nwill clone the repository into a temp folder and run `gpm build` from it.\n\nThe final executable will be installed in `\u003cGPM-ROOT\u003e/bin` folder. So it could be useful to add it to the `$PATH` enviornment variable.\n\nFYI: Instead of the URL as argument you can use a project alias added by [add project command](#add-project-).\n\n#### Build project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\ngpm build\n```\n\nwill run `go build .` in the current directory or the `build` script in [gpm.yaml](#gpmyaml-), if defined.\n\n#### Bump version [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nThe simple execution of\n\n```bash\ngpm bump\n```\n\nwill detect the latest version of the underlying repository from [Git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) and then upgrade the minor part only, e.g. `1.2.4` =\u003e `1.3.0`. Finally a new Git tag is created in the format `v1.3.0`.\n\nYou also can use at least one of the following flags to increase parts of the current version number as well:\n\n- `--breaking`: `1.2.4` =\u003e `2.0.0` by default\n- `--feature`: `1.2.4` =\u003e `1.3.0` by default\n- `--fix`: `1.2.4` =\u003e `1.2.5`\n\n#### Checkout branch [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nThe execution of\n\n```bash\ngpm checkout my-branch\n```\n\nwill checkout or create the branch `my-branch` in the current Git repository.\n\nIf the branch does not exist, you can use `--suggest` to use AI which generates a branch name from a description using format `\u003ctype\u003e/\u003cdescription\u003e`.\n\nAn execution of\n\n```bash\ngpm checkout \"i will fix the save button on start page\" --suggest\n```\n\nfor example could suggest a value like `feature/fix-save-button-on-start-page` when using ChatGPT 3.5\n\nHave a look at the [Setup AI](#setup-ai) which describes how to setup OpenAI or Ollama API.\n\n##### Branch aliases [\u003ca href=\"#checkout-branch-\"\u003e↑\u003c/a\u003e]\n\nFor example, if you define the environment variable `GPM_BRANCH_DEV` with `development` as value, you can run\n\n```bash\ngpm checkout :dev\n```\n\nfrom the command line to switch to `development` branch.\n\nThe `:dev` is the part after the `GPM_BRANCH_` prefix in the environment variable name.\n\nThis means you are also able to define a variable, lets say `GPM_BRANCH_FOO`, with the value `bar`, which will allow you to easily switch to `bar` branch if you execute\n\n```\ngpm checkout :foo\n```\n\nKeep in mind: If you have no value for an alias defined, `gpm` will take its name as fallback!\n\n#### Checkup project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nThe following demo shows how `gpm doctor` works:\n\n![Doctor demo 1](./img/demos/doctor-demo-1.gif)\n\n#### Cleanup project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\ngpm tidy\n```\n\nis a short form of `go mod tidy`.\n\n#### Clone project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nThis command allows you to clone a [known project](#add-project-) using a shorter alias.\n\nFor example, if you’ve added a project named `hugo` with\n\n```bash\ngpm add project https://github.com/gohugoio/hugo\n```\n\nyou can later clone it with a simple\n\n```bash\ngpm clone hugo\n```\n\nwhich is a shorthand for `git clone https://github.com/gohugoio/hugo`, what means that you are able to add any [clone argument](https://git-scm.com/docs/git-clone) with your installed Git command version:\n\n```bash\n# clone to subfolder my-projects/the-great-hugo-project\n# and get only the last / head commit\ngpm clone hugo my-projects/the-great-hugo-project --depth 1\n```\n\n#### Compare code changes [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n![Diff demo 1](./img/demos/diff-demo-1.gif)\n\n#### Compression [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\n# compress LICENSE with gzip\ngpm compress ./LICENSE \u003e ./LICENSE.gz\n\n# decompress LICENSE.gz with gzip\ngpm uncompress ./LICENSE.gz \u003e ./LICENSE_unzipped\n```\n\n#### Cron jobs [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\n# run `date` every second\ngpm cron \"@every 1s\" date\n\n# run `date` every 2 minutes at :30\ngpm cron \"30 */2 * * * *\" date\n```\n\nFor more information about the cron syntax, you can visit [documentation page of the underlying module](https://pkg.go.dev/github.com/robfig/cron).\n\n#### Docker shorthands [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n| Shorthand  | Final command               |\n| ---------- | --------------------------- |\n| `gpm down` | `docker compose down`       |\n| `gpm up`   | `docker compose up --build` |\n\n#### Encoding [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\n# encode HTTP resource with Base64\ngpm cat \"https://avatars.githubusercontent.com/u/4951215?v=4\" | gpm base64 --data-uri \u003e gitfather_avatar.base64.txt\n```\n\n#### Execute shell command [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n![Execute demo 1](./img/demos/execute-demo-1.gif)\n\n#### Generate documentation [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nRunning the following command\n\n```bash\ngpm generate documentation\n```\n\nwill generate the full documentation for this tool as Markdown in the current directory.\n\nTo output the documentation into a specific folder, use:\n\n```bash\ngpm generate documentation my-doc-folder\n```\n\n#### Generate PowerPoint [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nThe following command will execute the default command template `pandoc -t pptx -o \"{{.OutputFile}}\" \"{{.InputFile}}\"` by creating `out.pptx` file from Markdown code, saved into `{{.InputFile}}`, which will be generated by AI:\n\n```bash\ngpm generate powerpoint out.pptx my-text-file1.txt *.go README.md --language=german\n```\n\nIn this case [Pandoc](https://pandoc.org/) must be installed on your system.\n\nYou can change the template by using `--template` flag or `GPM_GENERATE_PPTX_FROM_MD_COMMAND` environment variable, if you want to use another command.\n\n#### Generate project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nTo generate a new Go project tailored to your requirements, execute the following command:\n\n```bash\ngpm generate project --output=./my-new-project example.com/foo/example \"i need a starter backend with gin, i also need api key check and logging\"\n```\n\nThis command prompts the default AI provider to create a step-by-step plan for setting up a Go project based on your input `i need a starter backend with gin, i also need api key check and logging`.\n\nThe process begins by initializing a new project with the URL `example.com/foo/example` in the `my-new-project` folder. Each step in the setup is executed interactively, with user input guiding the workflow.\n\nOnce all steps are completed, the AI generates a summary in the standard output. This summary explains the actions performed and their purpose, ensuring the project aligns with the specified requirements.\n\nThe following video does demonstrate this (keep in mind: replace replace `go run . \u003c...\u003e` with `gpm \u003c...\u003e` later):\n\n![Generate project demo 1](./img/demos/generate-project-demo-1.gif)\n\n#### Import aliases [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\ngpm import aliases https://raw.githubusercontent.com/mkloubert/go-package-manager/main/aliases.yaml\n```\n\nloads aliases from `https://raw.githubusercontent.com/mkloubert/go-package-manager/main/aliases.yaml` and merge them with entries in `aliases.yaml` file in `\u003cGPM-ROOT\u003e` folder.\n\nYou can also use a local file path and/or pipe from `STDIN` as well.\n\n#### Import projects [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\ngpm import projects https://raw.githubusercontent.com/mkloubert/go-package-manager/main/projects.yaml\n```\n\nloads projects from `https://raw.githubusercontent.com/mkloubert/go-package-manager/main/projects.yaml` and merge them with entries in `projects.yaml` file in `\u003cGPM-ROOT\u003e` folder.\n\nYou can also use a local file path and/or pipe from `STDIN` as well.\n\n#### Install dependencies [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n`gpm install \u003calias\u003e` is designed to install a module via an alias defined with [Add alias](#add-alias-) command.\n\nFor example if you define an alias called `yaml` with\n\n```bash\ngpm add alias yaml https://github.com/go-yaml/yaml\n```\n\nyou can run\n\n```bash\ngpm install yaml\n```\n\nlater which will simply call `go get -u https://github.com/go-yaml/yaml` instead.\n\n#### List aliases [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nSimply run\n\n```bash\ngpm list aliases\n```\n\nwill output a list like this:\n\n```\ncobra\n        https://github.com/spf13/cobra\nmongo\n        go.mongodb.org/mongo-driver/mongo\nyaml\n        https://github.com/go-yaml/yaml\n```\n\n#### List executables [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nExecutables / binaries created with [make command](#build-and-install-executable-) can be listed with\n\n```bash\ngpm list binaries\n```\n\n#### List projects [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nSimply run\n\n```bash\ngpm list projects\n```\n\nwill output a list like this:\n\n```\nmkloubert\n        git@github.com:mkloubert/mkloubert.git\n```\n\n#### Monitor process [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n![Monitor Demo 1](./img/demos/monitor-demo-1.gif)\n\n#### New project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n`gpm new \u003cproject\u003e` is designed to setup a project via an alias defined with [Add project](#add-project-) command.\n\nFor example if you define an alias called `mkloubert` with\n\n```bash\ngpm add project mkloubert git@github.com:mkloubert/mkloubert.git\n```\n\nyou can run\n\n```bash\ngpm new mkloubert\n```\n\nlater which will simply call `git clone git@github.com:mkloubert/mkloubert.git` instead that clones the Git repository to `mkloubert` subfolder, removes its `.git` folder and re-initializes it with `git init`.\n\n#### Open alias [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nAliases created by [Add alias command](#add-alias-) can be opened by default handler of the operating system.\n\nLets say you created an alias called `cobra` with the URL `https://github.com/spf13/cobra`, the execution of\n\n```bash\ngpm open alias cobra\n```\n\nwill open this URL usually in the browser.\n\n#### Open project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nProject entries created by [Add project command](#add-project-) can be opened by default handler of the operating system.\n\nLets say you created a project alias called `gpm` with the URL `https://github.com/mkloubert/go-package-manager`, the execution of\n\n```bash\ngpm open project cobra\n```\n\nwill open this URL usually in the browser.\n\n#### Pack project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n![AI Chat Demo 1](./img/demos/pack-demo-1.gif)\n\n#### Passwords and unique IDs [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\n# directly generate password and copy to clipboard\ngpm password --no-output --copy\n\n# generate and output UUID\ngpm uuid\n```\n\n#### Publish new version [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nRunning\n\n```bash\ngpm publish\n```\n\nwill bump the feature part of the project's current version represented by Git tags.\n\nAfter this, the code will be pushed to all remotes, including tags as well.\n\n#### Pull from Git remotes [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nThe execution of\n\n```bash\ngpm pull\n```\n\nwill pull from all remotes which are stored inside the current Git repository.\n\n#### Push to Git remotes [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nThe execution of\n\n```bash\ngpm push\n```\n\nwill push to all remotes which are stored inside the current Git repository.\n\n#### Remove alias [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nWith\n\n```bash\ngpm remove alias yaml\n```\n\nyou will remove the `yaml` alias from `aliases.yaml` file, which is stored in `\u003cGPM-ROOT\u003e` folder.\n\n#### Remove project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nWith\n\n```bash\ngpm remove project yaml\n```\n\nyou will remove the `yaml` alias from `projects.yaml` file, which is stored in `\u003cGPM-ROOT\u003e` folder.\n\n#### Remove executable [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nIf you installed a binary with [make command](#build-and-install-executable-) like\n\n```bash\ngpm make https://github.com/gopasspw/gopass\n```\n\nyou can simply remove it with `gpm remove binary gopass` if the binary is stored as `gopass` in `\u003cGPM-ROOT\u003e/bin` folder.\n\n#### Run script [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nIn the [gpm.yaml file](#gpmyaml-) you can define script which are executed in shell/terminal context:\n\n```yaml\nscripts:\n  foo: \"echo bar\"\n```\n\nWith\n\n```bash\ngpm run foo\n```\n\nyou will run `echo bar`.\n\n#### Run tests [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\ngpm test\n```\n\nwill execute `go test .` instead or the `test` script defined in current [gpm.yaml file](#gpmyaml-), if defined.\n\n#### Show dependency graph [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nRunning\n\n```bash\ngpm show dependencies\n```\n\nwill create and open a temporary HTML file which will display a dependency graph of all installed modules:\n\n![Show dependency graph demo 1](./img/demos/show-dependencies-1.png)\n\n#### Sleep [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\ngpm sleep 10s\n```\n\nThe command uses [build-in duration format](https://pkg.go.dev/time#Duration).\n\n#### Start project [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\ngpm start\n```\n\nwill execute `go run .` instead or the `start` script defined in current [gpm.yaml file](#gpmyaml-), if defined.\n\n#### Synchronize with Git remotes [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\nWith execution of\n\n```bash\ngpm sync\n```\n\nyou will [pull from](#pull-from-git-remotes-) and then [push to](#push-to-git-remotes-) all remotes as defined in the current Git repository.\n\n#### Uninstall dependencies [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n`gpm uninstall \u003calias\u003e` is designed to un-install a module via an alias defined with [Add alias](#add-alias-) command.\n\nFor example if you define an alias called `yaml` with\n\n```bash\ngpm add alias yaml https://github.com/go-yaml/yaml\n```\n\nyou can run\n\n```bash\ngpm uninstall yaml\n```\n\nlater which will simply call `go get -u https://github.com/go-yaml/yaml@none` instead.\n\n#### Update dependencies [\u003ca href=\"#commands-\"\u003e↑\u003c/a\u003e]\n\n```bash\ngpm update\n```\n\nis a short version of `go get -u ./... \u0026\u0026 go mod tidy` and will update all dependencies.\n\nOn the other hand, you are able to run something like\n\n```bash\ngpm update github.com/alecthomas/chroma yaml\n```\n\nto update specific ones. Each argument can be a module URL or [alias](#add-alias-).\n\n## Setup AI [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\nIf you would like to use AI feature, like suggestion of branch names, you can setup one of the following APIs:\n\n### OpenAI / ChatGPT [\u003ca href=\"#setup-ai-\"\u003e↑\u003c/a\u003e]\n\nCreate (or use) an API from https://platform.openai.com/api-keys and write it to `OPENAI_API_KEY` environment variable.\n\nBy default `gpt-4o-mini` model is used. You can change this, by setting up `GPM_AI_CHAT_MODEL` environment variable with a [value from here](https://platform.openai.com/docs/models) like this:\n\n```dotenv\nGPM_AI_CHAT_MODEL=gpt-4-turbo\n```\n\n### Ollama [\u003ca href=\"#setup-ai-\"\u003e↑\u003c/a\u003e]\n\nIf you want to use [Ollama](https://ollama.com/) instead, you have to setup the following environment variables:\n\n```dotenv\nGPM_AI_API=ollama\nGPM_AI_CHAT_MODEL=\u003cname of the model\u003e\n```\n\nReplace `\u003cname of the model\u003e` with [one of these models](https://ollama.com/library).\n\nTwo good models are [llama3 by Meta](https://ollama.com/library/llama3) or [phi3 by Microsoft](https://ollama.com/library/phi3).\n\n## gpm.yaml [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\nThe idea of an `gpm.yaml` file is very similar to `package.json` file for Node / NPM environments.\n\nAn [example can be found here](./gpm.yaml).\n\nIf you want to initialize an empty one, you only need to execute\n\n```bash\ngpm init\n```\n\nin your terminal.\n\n### Files [\u003ca href=\"#gpmyaml-\"\u003e↑\u003c/a\u003e]\n\nThe `files` section contains a list of regular expressions that specify which files are included by the [pack command](#pack-project-):\n\n```yaml\n# ...\n\nfiles:\n  - my-app\n  - LICENSE\n  - README.md\n  - ^commands/p\n# ...\n```\n\nIf the list is empty or not defined, the following default values are applied:\n\n- the potential name of the executable file built with the [build command](#build-project-)\n- `^CHANGELOG.md$`\n- `^CONTRIBUTING.md$`\n- `^CONTRIBUTION.md$`\n- `^LICENSE$`\n- `^README.md$`\n\nYou can also define environment-specific file lists to customize behavior for different environments:\n\n```yaml\n# ...\n\n\"files:dev\":\n  - my-dev-app\n  - README.dev.md\n  - ^commands/p\n# ...\n```\n\nWhen `files:dev` is defined, it takes precedence over the `files` list, allowing you to tailor the included files for specific environments.\n\n### Scripts [\u003ca href=\"#gpmyaml-\"\u003e↑\u003c/a\u003e]\n\nTo configure your scripts, add or update the `scripts` section with key/value pairs as shown below:\n\n```yaml\nscripts:\n  test1: \"echo Test1\"\n  test2: \"echo Test2\"\n```\n\nOnce defined, you can run the commands directly from your project folder using `gpm run test1` or `gpm run test2`.\n\nYou can also create environment-specific scripts to customize behavior for different environments:\n\n```yaml\nscripts:\n  test1: \"echo Test1 runs in the default environment\"\n  dev:test1: \"echo Test1 runs in the 'dev' environment\"\n```\n\nWhen executing `gpm run test1 --environment=dev`, the command will prioritize `dev:test1` over `test1`. This allows you to tailor scripts for specific environments easily.\n\n#### Predefined [\u003ca href=\"#scripts-\"\u003e↑\u003c/a\u003e]\n\n| Name          | Description                                                                                 |\n| ------------- | ------------------------------------------------------------------------------------------- |\n| `build`       | Custom logic for [build command](#build-project-).                                          |\n| `bump`        | Custom logic for [bump command](#bump-version-).                                            |\n| `postbuild`   | Is executed after successful execution of [build command](#build-project-).                 |\n| `postinstall` | Is executed after successful execution of [install command](#install-dependencies-).        |\n| `postbump`    | Is executed after successful execution of [bump command](#bump-version-).                   |\n| `postpublish` | Is executed after successful execution of [publish command](#publish-new-version-).         |\n| `posttest`    | Is executed after successful execution of [test command](#run-tests-).                      |\n| `posttidy`    | Is executed after successful execution of [tidy command](#cleanup-project-).                |\n| `prebuild`    | Is executed before [build command](#build-project-) is executed.                            |\n| `prebump`     | Is executed before [bump command](#bump-version-) is executed.                              |\n| `preinstall`  | Is executed before [install command](#install-dependencies-) is executed.                   |\n| `prepublish`  | Is executed before [publish command](#publish-new-version-) is executed.                    |\n| `prestart`    | Is executed before [start command](#run-start-) is executed.                                |\n| `pretest`     | Is executed before [test command](#run-tests-) is executed.                                 |\n| `pretidy`     | Is executed before [tidy command](#cleanup-project-) is executed.                           |\n| `publish`     | Custom logic for [publish command](#publish-new-version-).                                  |\n| `start`       | Is executed by [start command](#start-project-). If not defined `go run .` is executed.     |\n| `test`        | Is executed by [test command](#run-tests-). If not defined `go test .` is executed.         |\n| `tidy`        | Is executed by [tidy command](#cleanup-project-). If not defined `go mod tidy` is executed. |\n\n## Environment variables [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\nEnvironment variables can be loaded from external files, which are handled in this order:\n\n- `\u003cGPM-ROOT\u003e/.env` (if exist)\n- `\u003cPROJECT-DIR\u003e/.env` (if exist)\n- `\u003cPROJECT-DIR\u003e/.env\u003cSUFFIX\u003e` (if exist)\n- `\u003cPROJECT-DIR\u003e/.env.local` (if exist)\n- `\u003cPROJECT-DIR\u003e/.env\u003cSUFFIX\u003e.local` (if exist)\n- from `--env-file` flags (must exist!)\n\n`\u003cSUFFIX\u003e` is the lower case value from `--environment` and can be empty.\n\n### Supported variables [\u003ca href=\"#environment-variables-\"\u003e↑\u003c/a\u003e]\n\n| Name                                | `settings.yaml`                 | Description                                                                                                                                                    | Example                                                                      |\n| ----------------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |\n| `GPM_AI_API`                        | `ai.api`                        | ID of the AI API to use. Possible values are `ollama` or `openai`.                                                                                             | `openai`                                                                     |\n| `GPM_AI_CHAT_MODEL`                 | `ai.chat.model`                 | ID of the AI chat model to use. Possible values are models by [OpenAI](https://platform.openai.com/docs/models) or [Ollama](https://ollama.com/library).       | `gpt-4o`                                                                     |\n| `GPM_AI_CHAT_TEMPERATURE`           | `ai.chat.temperature`           | Temperature value for an AI chat (operation)                                                                                                                   | `0`                                                                          |\n| `GPM_AI_PROMPT`                     | `ai.prompt`                     | Custom prompt for operations which are using chat completion operations, like [checkout command](#build-project-).                                             |                                                                              |\n| `GPM_AI_SYSTEM_PROMPT`              | `ai.system.prompt`              | Custom (initial) system prompt for AI chat operations.                                                                                                         | `You are a helpful AI assistant. You always answer in a very sarcastic way.` |\n| `GPM_ALIASES_FILE`                  | `aliases.file`                  | Custom path to [aliases.yaml file](#add-alias-). Relative paths will be mapped to `\u003cGPM-ROOT\u003e`. Default is `\u003cGPM-ROOT\u003e/aliases.yaml`.                          | `/my/custom/aliases/file.yaml`                                               |\n| `GPM_BIN_PATH`                      |                                 | Custom folder for binaries installed by [make command](#build-and-install-executable-). Default is `\u003cGPM-ROOT\u003e/bin`.                                           | `/my/custom/bin/path`                                                        |\n| `GPM_DEFAULT_ALIAS_SOURCE`          |                                 | Custom source for source of [alias imports](#import-aliases-). Multiple sources can be separated by lines.                                                     | `https://example.com/gpm-aliases.yaml`                                       |\n| `GPM_DEFAULT_PROJECT_SOURCE`        |                                 | Custom source for source of [project imports](#import-projects-). Multiple sources can be separated by lines.                                                  | `https://example.com/gpm-projects.yaml`                                      |\n| `GPM_DOWN_COMMAND`                  | `down.command`                  | Custom command for [docker compose down](#docker-shorthands-) shorthand.                                                                                       | `docker-compose down`                                                        |\n| `GPM_ENV`                           |                                 | ID of the current environment. This is especially used for the [.env files](#environment-variables-).                                                          | `prod`                                                                       |\n| `GPM_GENERATE_PPTX_FROM_MD_COMMAND` | `generate.pptx.from.md.command` | Template for a command that generates a PowerPoint presentation from a Markdown file.                                                                          | `pandoc -t pptx -o \"{{.OutputFile}}\" \"{{.InputFile}}`                        |\n| `GPM_INSTALL_PATH`                  |                                 | Custom installation path of global `gpm` binary.                                                                                                               | `/usr/bin`                                                                   |\n| `GPM_PROJECTS_FILE`                 | `projects.file`                 | Custom path to [projects.yaml file](#add-project-). Relative paths will be mapped to `\u003cGPM-ROOT\u003e`. Default is `\u003cGPM-ROOT\u003e/projects.yaml`.                      | `/my/custom/projects/file.yaml`                                              |\n| `GPM_ROOT_BASE_PATH`                |                                 | Custom root base folder for this application. Relative paths will be mapped to `$HOME`. Default is `$HOME/.gpm`.                                               | `.my-gpm-folder-inside-home`                                                 |\n| `GPM_SETTINGS_FILE`                 |                                 | Custom settings file.                                                                                                                                          | `../path/to/settings/file.yaml`                                              |\n| `GPM_TERMINAL_FORMATTER`            | `terminal.formatter`            | Default formatter for syntax highlighting in terminal. See [chroma project](https://github.com/alecthomas/chroma/tree/master/formatters) for more information. | `terminal16m`                                                                |\n| `GPM_TERMINAL_STYLE`                | `terminal.style`                | Default style for syntax highlighting in terminal. See [chroma project](https://github.com/alecthomas/chroma/tree/master/styles) for more information.         | `monokai`                                                                    |\n| `GPM_UP_COMMAND`                    | `up.command`                    | Custom command for [docker compose up](#docker-shorthands-) shorthand.                                                                                         | `docker-compose up`                                                          |\n| `GPM_UPDATE_SCRIPT`                 |                                 | Custom URL to self-update script                                                                                                                               | `sh.kloubert.dev/gpm.sh`                                                     |\n| `OPENAI_API_KEY`                    | `openai.api.key`                | Key which is used for the [API by OpenAI](https://platform.openai.com/docs/api-reference).                                                                     | `sk-...`                                                                     |\n\n## Contribution [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\nIf you have ideas and/or want to participate you are welcome!\n\n[Open an issue](https://github.com/mkloubert/go-package-manager/issues/new) or [create a pull request](https://github.com/mkloubert/go-package-manager/compare).\n\n## Support [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\nIf you like the project you can [donate via PayPal](https://paypal.me/MarcelKloubert).\n\n## License [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\nThe project is licensed under the [MIT](./LICENSE).\n\n## Credits [\u003ca href=\"#table-of-contents\"\u003e↑\u003c/a\u003e]\n\n`gpm` makes use of these following great projects:\n\n- [asciinema](https://github.com/asciinema/asciinema) + [agg](https://github.com/asciinema/agg) by [asciinema team](https://github.com/asciinema)\n- [Babel.js](https://babeljs.io) by [Babel team](https://opencollective.com/babel)\n- [chroma](https://github.com/alecthomas/chroma) by [Alec Thomas](https://github.com/sponsors/alecthomas)\n- [cobra](https://github.com/spf13/cobra) by [Steve Francia](https://github.com/spf13)\n- [cobra](https://github.com/spf13/cobra) by [Steve Francia](https://github.com/spf13)\n- [cron](https://github.com/robfig/cron) by [Rob Figueiredo](https://github.com/robfig)\n- [gitignore](https://github.com/sabhiram/go-gitignore) by [Shaba Abhiram](https://github.com/sabhiram)\n- [Glamour](https://github.com/charmbracelet/glamour) by [Charm](https://github.com/charmbracelet)\n- [go-prompt](https://github.com/c-bata/go-prompt) by [c-bata](https://github.com/sponsors/c-bata)\n- [go-version](https://github.com/hashicorp/go-version) by [HashiCorp](https://github.com/hashicorp)\n- [go-yaml](https://github.com/goccy/go-yaml) by [Masaaki Goshima](https://github.com/sponsors/goccy)\n- [godotenv](https://github.com/joho/godotenv) by [John Barton](https://github.com/joho)\n- [gopsutil](https://github.com/shirou/gopsutil) by [shirou](https://github.com/sponsors/shirou)\n- [Mermaid](https://github.com/mermaid-js/mermaid) by [Knut Sveidqvist](https://github.com/knsv) and [Sidharth Vinod](https://github.com/sidharthv96)\n- [progressbar](https://github.com/schollz/progressbar) by [Zack](https://github.com/sponsors/schollz)\n- [React](https://react.dev)\n- [spinner](https://github.com/sponsors/briandowns) by [Brian Downs](https://github.com/sponsors/briandowns)\n- [termui](https://github.com/gizak/termui) by [Zack Guo](https://github.com/gizak)\n- [tview](https://github.com/rivo/tview) by [rivo](https://github.com/sponsors/rivo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkloubert%2Fgo-package-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkloubert%2Fgo-package-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkloubert%2Fgo-package-manager/lists"}