{"id":26652345,"url":"https://github.com/redhat-et/copilot-ops","last_synced_at":"2025-04-11T05:50:20.783Z","repository":{"id":37079937,"uuid":"439119070","full_name":"redhat-et/copilot-ops","owner":"redhat-et","description":"copilot-ops is a CLI tool that boosts up any DevOps repo to a ninja level of Artificially Intelligent Ops Repo","archived":false,"fork":false,"pushed_at":"2023-03-06T18:27:46.000Z","size":1294,"stargazers_count":35,"open_issues_count":10,"forks_count":13,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-25T03:49:34.497Z","etag":null,"topics":["ai","devops","git","gitops","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/redhat-et.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-12-16T20:30:02.000Z","updated_at":"2025-01-10T07:11:26.000Z","dependencies_parsed_at":"2024-06-20T00:18:05.967Z","dependency_job_id":"515cd0fd-7e70-468f-aeaf-8c7cb72d2325","html_url":"https://github.com/redhat-et/copilot-ops","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-et%2Fcopilot-ops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-et%2Fcopilot-ops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-et%2Fcopilot-ops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-et%2Fcopilot-ops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redhat-et","download_url":"https://codeload.github.com/redhat-et/copilot-ops/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351425,"owners_count":21089271,"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":["ai","devops","git","gitops","hacktoberfest"],"created_at":"2025-03-25T03:49:38.723Z","updated_at":"2025-04-11T05:50:20.763Z","avatar_url":"https://github.com/redhat-et.png","language":"Jupyter Notebook","readme":"\u003ch1 align=\"center\"\u003ecopilot-ops\u003c/h1\u003e\n\n\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg alt=\"copilot-ops-logo\" src=\"./public/copilot-ops-logo.png\" width=\"300\" height=\"300\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://goreportcard.com/report/github.com/redhat-et/copilot-ops\"\u003e\n\t\t\u003cimg src=\"https://goreportcard.com/badge/github.com/redhat-et/copilot-ops\" alt=\"copilot-ops Go report badge\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://codecov.io/gh/redhat-et/copilot-ops\" \u003e \n\t\t\u003cimg src=\"https://codecov.io/gh/redhat-et/copilot-ops/branch/main/graph/badge.svg?token=3SNBJAXSVS\"/\u003e \n\t\u003c/a\u003e\n\u003c/p\u003e\n\n\n\n## About\n`copilot-ops` is a CLI tool that boosts up any \"devops repo\" to a ninja level of *Artificially Intelligent Ops Repo*.\n\n## Requirements\n\nIn order to use `copilot-ops`, you need to have an OpenAI account with access to the GPT-3 Codex model,\nand an API token saved as the `OPENAI_API_KEY` environment variable.\n\n## Installation\n\nYou can download a copilot-ops binary from our releases page:\n[binary releases](https://github.com/redhat-et/copilot-ops/releases/)\n\nBuilds from the most recent commit are available in our CI workflows: [ci-builds](https://github.com/redhat-et/copilot-ops/actions/workflows/ci.yaml)\n\n\nIf you prefer to build from source, simply clone this repository and `make build`:\n\n```console\n# Clone the repository\ngit clone https://github.com/redhat-et/copilot-ops.git\n\n# Build the binary\nmake build\n```\nTo install the command line tool, complete the following steps:\n\n```console\n# Create bin directory\nmkdir -p ${HOME}/bin\n\n# Save binary to bin directory (run from copilot-ops directory)\ncp copilot-ops ${HOME}/bin\n\n# Rerun .bashrc file \n. ~/.bashrc\n\n# Run binary with -h to see all commands\ncopilot-ops -h\n```\n\n\n\n## Usage \n\n`copilot-ops` currently supports two functionalities: `generate` and `edit`. \n\nBy default, `copilot-ops` will only print to stdout. To write the\nchanges directly to the disk, provide the `--write` flag.\n\n\n### Editing Files\n\n`copilot-ops` is capable of updating existing files using a command phrased with natural language.\nTo do this, you would simply reference your files as described above, and then specify the necessary changes.\n\nFor example:\n\n```bash\ncopilot-ops edit --request=\"The timeout for the @server.yaml should be increased from 60s to 2m\" \\\n  --file deployments/server.yaml`\n```\n\n\n### Generating Files\n\nThe `generate` command accepts a description of the file(s) needed and a set of files which are used to generate a new file based on their contents.\n\nHere are a few examples with the `generate` command:\n\n```sh\n# to create a Jupyter Notebook which uses a GPU to accelerate machine-learning tasks\ncopilot-ops generate --request \"create a Deployment which pulls a Jupyter Notebook image and requests 1 GPU resource\"\n\n# to generate a Pod that mounts a given ConfigMap\ncopilot-ops generate -f examples/stock-data.yaml --request '\n\tcreate a Pod which runs an express.js app and mounts the stock-data ConfigMap to trade stocks\n'\n\n# launch a Job which pulls data from the S3 bucket at 's3://my-bucket/data.csv' and loads it into a PVC in the same namespace\ncopilot-ops generate -f examples/aws-credentials-secret.yaml --request '\n\tcreate a Job which pulls data from the S3 bucket at \"s3://my-bucket/data.csv\" and loads it into a PVC in the same namespace\n'\n```\n\nTo control the amount of tokens used when generating, you can also\nspecify the `--ntokens` flag.\n\nHere's an example where we want OpenAI to generate a service based\non a Deployment, but should not exceed 100 tokens:\n\n```bash\ncopilot-ops generate --request \"Create a Service named 'mongodb-service' to expose the mongodb-deployment\" \\\n\t--file deployments/mongodb-deployment.yaml \\\n\t--ntokens 100\n```\n\nTo avoid providing multiple files, we can use the `--filesets` flag to specify a list of filesets to use.\n\nFor example:\n\n```bash\ncopilot-ops generate --request \"Create a Service for each of these deployments\" --fileset deployments\n```\n\n### Under the hood\n\nIn a nutshell, `copilot-ops` functions by formatting the user input and provided files, if any, in a way that an OpenAI would understand it as a programmer taking an issue and updating it.\n\n#### Generating Files\n\nHere's a breakdown of the generate process:\n\n1. Format the user's request along with the necessary files using a generate template that will be \"autocompleted\" by OpenAI.\n1. Have OpenAI attempt to complete the prompt and retrieve OpenAI's response.\n1. If OpenAI succeeded, parse the response and extract the newly generated files.\n1. Write the generated files either to the disk or to STDOUT. \n\n\n#### Editing Files\n\nEditing files is similar, however it currently only works on one file at a time. \n\nA breakdown of the process is described below:\n\n1. Take an input text description in natural language for a change requested on the repo. There should be no significant restrictions on the text format, but we will provide guidelines in the form of issue templates and identify textual markers to provide higher success rates and consistency.\n1. Collect information from the repo to be attached to the AI request.\n1. Send the request to AI service to process it and reply with the changed files.\n1. Apply the reply changes back to the repo.\n\n```console\n\u003e copilot-ops edit \"set mysql memory to 42 Gi only for production env\" --file deployments/mysql.yaml --write\n\nCollecting deployments/mysql.yaml ........ OK\nUsing the force .......................... OK\nApplying changes ......................... OK\n\nDone\n```\n\n\n\n## Copilot-Ops CLI\n\nThe Copilot-Ops CLI applies AI principles in order to turn you into a GitOps ninja.\nProvide an issue of the changes you'd like to make, and optionally some files that \nyou'd like to reference in your issue, and the CLI will generate the according changes for you.\n\n\n## About copilot-ops\n\nThe idea is that using modern AI services (such as [OpenAI Codex](https://openai.com/blog/openai-codex/)) users can describe their requested changes in a github issue, which triggers the `copilot-ops` action, which will use the AI service to create a suggested PR to resolve the issue. Users can then interact with the PR, review, make code changes directly, approve and merge it.\n\nThe assumption is that these new AI capabilities to understand natural language (NLP) and modify code, can simplify working on a devops repo where many changes are eventually simply modifying kubernetes yamls, config files or deployment scripts.\n\nGiven a request in natural language and access to the cloned repo, the `copilot-ops` tool works by collecting information from the repo, and composing a well formatted request to the AI service that has all the information to prepare the code change. When the response is received, it applies the changes back to the repo by mapping the reply to source file changes.\n\nRuntime consideration - to be able to integrate this tool to various gitops frameworks without dragging along dependencies or forcing to run inside a container image, we decided to package this functionality in a standalone self-contained golang CLI for easy portability. This decision is not critical for the usability of the tool and can be revised in the future as needed.\n\n\nCurrently, Copilot-Ops is using OpenAI codex as a backend, but we plan to modularize this so that you may use another backend such DeepMind's AlphaCode, or IBM Watson.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-et%2Fcopilot-ops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredhat-et%2Fcopilot-ops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-et%2Fcopilot-ops/lists"}