{"id":15716201,"url":"https://github.com/aaabramov/goal","last_synced_at":"2025-10-14T03:08:40.060Z","repository":{"id":37521575,"uuid":"425574711","full_name":"aaabramov/goal","owner":"aaabramov","description":"Allows you to create local aliases within directory/repository with proper assertions upon executions.","archived":false,"fork":false,"pushed_at":"2023-04-04T17:59:45.000Z","size":108,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-14T03:08:39.295Z","etag":null,"topics":["aliases","brew","cli","go","terraform"],"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/aaabramov.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":"2021-11-07T17:48:27.000Z","updated_at":"2025-04-03T10:47:38.000Z","dependencies_parsed_at":"2024-06-21T15:15:17.236Z","dependency_job_id":null,"html_url":"https://github.com/aaabramov/goal","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/aaabramov/goal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaabramov%2Fgoal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaabramov%2Fgoal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaabramov%2Fgoal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaabramov%2Fgoal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aaabramov","download_url":"https://codeload.github.com/aaabramov/goal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaabramov%2Fgoal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017786,"owners_count":26086141,"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-14T02:00:06.444Z","response_time":60,"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":["aliases","brew","cli","go","terraform"],"created_at":"2024-10-03T21:44:26.608Z","updated_at":"2025-10-14T03:08:40.046Z","avatar_url":"https://github.com/aaabramov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Go Aliases\n\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/aaabramov/goal) [![Tests](https://github.com/aaabramov/goal/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/aaabramov/goal/actions/workflows/test.yml) [![Coverage Status](https://coveralls.io/repos/github/aaabramov/goal/badge.svg?branch=feature/coverage)](https://coveralls.io/github/aaabramov/goal?branch=feature/coverage) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/aaabramov/goal)\n\n---\n\n[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua)\n\n---\n\nAllows you to create local aliases withing directory/repository with proper assertions upon executions.\n\n**Motivation:**\n\n- Simplify executing scoped repetitive commands\n- Avoid executing commands on wrong environment (e.g. _kubectl_, _terraform_, _helm_, _etc._)\n- Automatically generate OpsDoc from available goals. No need to read through whole README file to start operating on your infrastructure.\n\n## Install\n\nInstall via `brew`:\n\n```shell\n# Will be simplified\nbrew tap aaabramov/goal https://github.com/aaabramov/goal\nbrew install aaabramov/goal/goal\n```\n\n## Usage\n\nRun `goal init` in directory where aliases will be used. This will generate example `goal.yaml` file. Use it as a reference to define your own aliases. \n\n```shell\n$ goal init\n⌛ Generating default goal.yaml file\n✅ Generated default goal.yaml file. Try running `goal` to see available goals.\n```\n\n### List goals\n\nSimply type `goal` to see list of available goals and their dependencies:\n\n```shell\n$ goal\nAvailable goals:\n+---------------------+-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n|        GOAL         | ENVIRONMENT |                               CLI                               |         DESCRIPTION         |                    ASSERTIONS                    |\n+---------------------+-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n| gcloud-ssh          | dev         | gcloud compute ssh dev-vm --zone=us-central1-c                  | SSH to dev                  | 1. gcloud.project == \"dev-project\"               |\n+                     +-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n|                     | stage       | gcloud compute ssh stage-vm --zone=us-central1-c                | SSH to stage                | 1. gcloud.project == \"stage-project\"             |\n+---------------------+-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n| helm-upgrade        | dev         | helm upgrade release-name -f values.yaml -f values/dev.yaml .   | helm upgrade on dev         | 1. kubectl.context == \"gke_project_region_dev\"   |\n+                     +-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n|                     | stage       | helm upgrade release-name -f values.yaml -f values/stage.yaml . | helm upgrade on stage       | 1. kubectl.context == \"gke_project_region_stage\" |\n+---------------------+-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n| k8s-apply           | dev         | kubectl apply -f deployment.yaml                                | kubectl apply on dev        | 1. kubectl.context == \"gke_project_region_dev\"   |\n|                     |             |                                                                 |                             | 2. Manual approval                               |\n+                     +-------------+                                                                 +-----------------------------+--------------------------------------------------+\n|                     | stage       |                                                                 | kubectl apply on stage      | 1. kubectl.context == \"gke_project_region_stage\" |\n|                     |             |                                                                 |                             | 2. Manual approval                               |\n+---------------------+-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n| terraform-apply     | dev         | terraform apply -var-file vars/dev.tfvars                       | Terraform apply on dev      | 1. terraform.workspace == \"dev\"                  |\n+                     +-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n|                     | stage       | terraform apply -var-file vars/stage.tfvars                     | Terraform apply on stage    | 1. terraform.workspace == \"stage\"                |\n+---------------------+-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n| terraform-workspace |             | terraform workspace show                                        | Current terraform workspace |                                                  |\n+---------------------+-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n| test                |             | go test -v ./...                                                | Run go tests                |                                                  |\n+---------------------+-------------+-----------------------------------------------------------------+-----------------------------+--------------------------------------------------+\n```\n\n### Define simple local aliases\n\n```yaml\npods:\n  desc: Get nginx pods\n  cmd: kubectl\n  args:\n    - get\n    - pods\n    - -l\n    - app=nginx\nsvc:\n  desc: Get nginx services\n  cmd: kubectl\n  args:\n    - get\n    - svc\n    - -l\n    - app=nginx\n```\n\n### Define goal with assertions\n\n```yaml\n# This example demonstrates how to use custom assertions upon executions.\n\nmy-assertion:\n  desc: Ultimate Question of Life?\n  cmd: echo\n  args:\n    - -n\n    - $((40 + 2))\n  \nmy-goal:\n  desc: The Answer to the Ultimate Question of Life\n  assert:\n    - desc: If answer is 42..\n      ref: my-assertion # references another goal\n      expect: '42'\n      fix: # CLI on how to fix\n    - approve: yes # ask user to config execution  \n  cmd: echo\n  args:\n    - The Answer to the Ultimate Question of Life, the Universe, and Everything is 42\n```\n\n### Built-in assertions\n\n| Tool      | Example                                  |\n|-----------|------------------------------------------|\n| approval  | [examples/kubectl](examples/kubectl)     |\n| kubectl   | [examples/kubectl](examples/kubectl)     |\n| helm      | [examples/helm](examples/helm)           |\n| terraform | [examples/terraform](examples/terraform) |\n| gcloud    | [examples/gcloud](examples/gcloud)       |\n\n## goal vs Makefile\n_TODO_\n\n## Project plan\n\n- [X] Pipe STDIN for \"yes/no\" inputs, etc.\n- [X] Add `assert.fix`. Display when assertion failed, e.g. `terraform workspace select dev`\n- [X] Add \"environment\" management to avoid tf-plan-dev, tf-plan-stage, tf-plan-prod, etc. E.g. `goal tf-apply --on dev`\n  \u0026 `goal.env: dev` matches\n- [X] Support `-f my-goal.yaml`\n- [X] Validate empty goal cmd\n- [X] Validate empty assertion ref\n- [X] Add `goal init` which simply generated example `goal.yaml`\n- [X] Add predefined assertions:\n    - [X] `k8s_cluster`\n    - [X] `terraform_workspace`\n    - [X] `gcloud_project`\n- [X] `Check if current kubectl context is \"gke_project_region_stage\"` -\u003e `kubectl.context == \"gke_project_region_stage\"`\n- [ ] Assertions\n  - [X] ref output\n  - [X] support multiple assertions\n  - [ ] recursive assertions?\n  - [ ] raw CLI output -- bad pattern?\n- [ ] Simpler `brew tap aaabramov/goal`\n- [ ] Manual approvals for proceeding like `assert.approval`\n- [ ] Add \"depends on\" other task like switch to dev?\n    - [ ] Recursive dependencies\n- [ ] Global aliases in `$HOME` directory?\n- [ ] Self-autocompletion via [https://github.com/posener/complete](complete) library\n- [ ] Support both goal.yaml \u0026 goal.yml\n- [ ] Generate simple markdown file from `goal.yaml` (ops-doc)\n- [ ] `goal add GOAL_NAME` -- check if already exists\n- [ ] rework `Fatal` with `err`\n- [ ] suggest `fix?` when precondition failed with `yes/no` prompt\n- [ ] shared description from `goal.name` if there is no specific for env goal\n- [ ] add to readme about `source \u003c(goal completion zsh)`\n- [ ] `did you forget \"--on env\"` when command name is found but env is required\n- [ ] highlight commands \u0026 errors using https://github.com/fatih/color\n- [ ] templating env-dependant goals with {{ .Env }}?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaabramov%2Fgoal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaabramov%2Fgoal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaabramov%2Fgoal/lists"}