{"id":20712914,"url":"https://github.com/thesis/valkyrie","last_synced_at":"2025-04-23T07:55:52.628Z","repository":{"id":42350357,"uuid":"125570023","full_name":"thesis/valkyrie","owner":"thesis","description":"Valkyrie is our hubot. She guides your requirements to Valhalla, and shields the halls of Thesis.","archived":false,"fork":false,"pushed_at":"2025-03-28T09:20:52.000Z","size":2821,"stargazers_count":6,"open_issues_count":38,"forks_count":4,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-04-23T07:55:46.469Z","etag":null,"topics":["chatops"],"latest_commit_sha":null,"homepage":"https://valkyrie.thesis.co","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thesis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-03-16T21:08:37.000Z","updated_at":"2025-03-13T14:16:22.000Z","dependencies_parsed_at":"2023-02-16T13:00:52.471Z","dependency_job_id":"3f5be1e2-f14d-48e5-9008-00c8ddfd7a97","html_url":"https://github.com/thesis/valkyrie","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thesis%2Fvalkyrie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thesis%2Fvalkyrie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thesis%2Fvalkyrie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thesis%2Fvalkyrie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thesis","download_url":"https://codeload.github.com/thesis/valkyrie/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250395208,"owners_count":21423377,"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":["chatops"],"created_at":"2024-11-17T02:22:30.574Z","updated_at":"2025-04-23T07:55:52.615Z","avatar_url":"https://github.com/thesis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# valkyrie\n\nvalkyrie is a chat bot built on the [Hubot][hubot] framework. It was\ninitially generated by [generator-hubot][generator-hubot].\n\nThis README is intended to help get you started. Definitely update and improve\nto talk about your own instance, how to use and deploy, what functionality is\navailable, etc!\n\n[hubot]: http://hubot.github.com\n[generator-hubot]: https://github.com/github/generator-hubot\n\nValkyrie is the name of the Hubot we run in production.\nValkyrie can be summoned by name (`@Valkyrie`) or via her alias (`\\`).\n\n## Running Locally\n\nHeimdall is the name of the Hubot we run when working locally on Hubot.\nHeimdall can be summoned by name (`@Heimdall`) or via his alias (`?`).\n\nThis allows us to run both production and development Hubots at the same time\nusing the Flowdock adapter, and clearly differeniate which robot we are calling.\n(Note that both robots will reply to `robot.hear` commands since those don't\nrequire a direct invocation of the robot).\n\nYou can test your hubot by running the following, however some plugins will not\nbehave as expected unless the [environment variables](#configuration) they\nrely upon have been set.\n\nIf you don't have local values for env vars referenced in `./env-var.list`, ask\nsomeone how to get these values.\n\nOne exception is the Matrix password (when using the Matrix adapter to connect\nto the Thesis chat server ;see [section on Adapters](#adapters)). When using the\n`bin/heimdall` script, the script will search for a file `matrix-password.gpg`\nthat can be decrypted using the `gpg` tool. If the file exists, the decrypted\nvalue will be placed into the `HUBOT_MATRIX_PASSWORD` environment variable for\nuse by the adapter.\n\nNote that this file is gitignored, and should be encrypted locally with a key\naccessible to your local gpg, and never committed to source control.\n\n### Running locally in the terminal\n\nInstall npm if you don't already have it:\n\n```\nbrew install npm\n```\n\nYou can start Heimdall locally by running:\n\n```\n$ bin/heimdall\n```\n\nYou'll see some start up output (it can get pretty verbose - `npm i` is run at\nthis time) and a prompt:\n\n`heimdall\u003e`\n\nThen you can interact with Heimdall. If you don't know where to start, try\ntyping `?help`:\n\n```\nheimdall\u003e ?help\nheimdall\u003e Shell: I can do a lot of things!  Which would you like to know more about? You can say:\n```\n\n(followed by a list of available commands)\n\n### Running locally with VS Code\n\nWe strongly recommend running locally using Visual Studio Code, to\nmake use of its robust debugging functionality.\n\nAdd the following to the \"configurations\" list in your VS Code's `launch.json`:\n\n```\n{\n    \"type\": \"node\",\n    \"request\": \"launch\",\n    \"name\": \"Launch Heimdall Shell Adapter\",\n    \"program\": \"${workspaceFolder}/node_modules/hubot/bin/hubot.js\",\n    \"args\": [\"--alias\", \"?\", \"--name\", \"heimdall\"],\n    \"runtimeArgs\": [\"-r\", \"coffeescript/register\"],\n    \"console\": \"integratedTerminal\"\n},\n{\n    \"type\": \"node\",\n    \"request\": \"launch\",\n    \"name\": \"Launch Heimdall Matrix Adapter\",\n    \"program\": \"${workspaceFolder}/node_modules/hubot/bin/hubot.js\",\n    \"args\": [\"--alias\", \"?\", \"--name\", \"heimdall\", \"-a\", \"matrix\"],\n    \"runtimeArgs\": [\"-r\", \"coffeescript/register\"],\n    \"console\": \"integratedTerminal\"\n},\n\n```\n\nYou can then select either \"Launch Heimdall Shell Adapter\" or \"Launch Heimdall\nMatrix Adapter\" (see [section on Adapters](#adapters)) from the \"Run\" menu of\nthe debugging pane.\n\n### Running locally with Docker\n\nYou can also run using docker, which is what is deployed to kube:\n\n```\n$ brew install npm\n$ npm install\n$ npm audit fix\n$ docker build -f infrastructure/docker/Dockerfile -t valkyrie .\n$ docker run -it --env-file ./env-var.list --entrypoint \"bin/hubot\" valkyrie:latest\n```\n\nTo log in to your running hubot container:\n\n```\n$ docker ps | grep 'valkyrie:latest' | awk '{print $1}' | xargs -o -I {} docker exec -it {} /bin/sh\n```\n\n## Tests\n\nTest coverage is currently not programmatically enforced, but we are working\ntoward coverage for existing scripts. Any PRs opened should contain tests for\nnew functionality introduced, and fix tests for any breaking changes.\n\nTests should be saved in the `test/` directory; these will be run automatically\nby Circle CI whenever a branch is pushed to the remote. Test failures will\nabort the build, and prevent merging.\n\nTo run tests locally before pushing your branch:\nrun `npm test` from the repo root.\n\n## Deploying\n\nWe use Circle CI in conjunction with Github for our deployment.\n\nMerges to master (via Pull Requests) trigger an automatic deploy of that\nmerge's build.\n\nHowever, if there have been any changes to the `heimdall-hubot-deployment.yaml`,\nthose changes will need to be manually applied.\n\nEdit `infrastructure/kube/thesis-ops/heimdall-hubot-deployment.yaml` to replace\n`USE_CIRCLE_CI_BUILDS` with the relevant build number, and then apply:\n\n```\n$ kubectl apply -f infrastructure/kube/thesis-ops/heimdall-hubot-deployment.yaml\n```\n\n### Manual deployment\n\nTo deploy a new build, you'll need to set up Google Cloud SDK, authenticate,\ninstall `kubectl`, and authenticate docker; again, on macOS:\n\n```\n$ brew cask install google-cloud-sdk\n$ gcloud init\n$ gcloud components install kubectl\n$ gcloud container clusters get-credentials heimdall\n$ gcloud auth configure-docker\n```\n\nWhen running `gcloud init` you'll want to authenticate with your Thesis\ncredentials and use the `heimdall` cluster in region `us-central-1`.\n\nYou'll need to make google-cloud-sdk available on your path.\n`brew cask info google-cloud-sdk` gives general guidance on properly\npathing your install.\n\nThe easiest way to check is to see if, after\nthe above steps, you can run `kubectl config current-context` successfully.\n\nTo deploy a new build, you could tag and push your docker image:\n\n```\n$ docker tag heimdall:latest gcr.io/cfc-production/heimdall:my-cool-tag\n$ docker push gcr.io/cfc-production/heimdall:my-cool-tag\n```\n\nEdit `infrastructure/kube/thesis-ops/heimdall-hubot-deployment.yaml` to reference your tag, and then apply:\n\n```\n$ kubectl apply -f infrastructure/kube/thesis-ops/heimdall-hubot-deployment.yaml\n```\n\n### Configuration\n\nA few scripts (including some installed by default) require environment\nvariables to be set as a simple form of configuration.\n\nEach script should have a commented header which contains a \"Configuration\"\nsection that explains which values it requires to be placed in which variable.\nWhen you have lots of scripts installed this process can be quite labour\nintensive. The following shell command can be used as a stop gap until an\neasier way to do this has been implemented.\n\n    grep -o 'hubot-[a-z0-9_-]\\+' external-scripts.json | \\\n      xargs -n1 -I {} sh -c 'sed -n \"/^# Configuration/,/^#$/ s/^/{} /p\" \\\n          $(find node_modules/{}/ -name \"*.coffee\")' | \\\n        awk -F '#' '{ printf \"%-25s %s\\n\", $1, $2 }'\n\nHow to set environment variables will be specific to your operating system.\nRather than recreate the various methods and best practices in achieving this,\nit's suggested that you search for a dedicated guide focused on your OS.\n\n### Scripting\n\nAn example script is included at `scripts/example.coffee`, so check it out to\nget started, along with the [Scripting Guide][scripting-docs].\n\nFor many common tasks, there's a good chance someone has already one to do just\nthe thing.\n\n[scripting-docs]: https://github.com/github/hubot/blob/master/docs/scripting.md\n\n### external-scripts\n\nThere will inevitably be functionality that everyone will want. Instead of\nwriting it yourself, you can use existing plugins.\n\nHubot is able to load plugins from third-party `npm` packages. This is the\nrecommended way to add functionality to your hubot. You can get a list of\navailable hubot plugins on [npmjs.com][npmjs] or by using `npm search`:\n\n    % npm search hubot-scripts panda\n    NAME             DESCRIPTION                        AUTHOR DATE       VERSION KEYWORDS\n    hubot-pandapanda a hubot script for panda responses =missu 2014-11-30 0.9.2   hubot hubot-scripts panda\n    ...\n\nTo use a package, check the package's documentation, but in general it is:\n\n1. Use `npm install --save` to add the package to `package.json` and install it\n2. Add the package name to `external-scripts.json` as a double quoted string\n\nYou can review `external-scripts.json` to see what is included by default.\n\n##### Advanced Usage\n\nIt is also possible to define `external-scripts.json` as an object to\nexplicitly specify which scripts from a package should be included. The example\nbelow, for example, will only activate two of the six available scripts inside\nthe `hubot-fun` plugin, but all four of those in `hubot-auto-deploy`.\n\n```json\n{\n  \"hubot-fun\": [\"crazy\", \"thanks\"],\n  \"hubot-auto-deploy\": \"*\"\n}\n```\n\n**Be aware that not all plugins support this usage and will typically fallback\nto including all scripts.**\n\n[npmjs]: https://www.npmjs.com\n\n### hubot-scripts\n\nBefore hubot plugin packages were adopted, most plugins were held in the\n[hubot-scripts][hubot-scripts] package. Some of these plugins have yet to be\nmigrated to their own packages. They can still be used but the setup is a bit\ndifferent.\n\nTo enable scripts from the hubot-scripts package, add the script name with\nextension as a double quoted string to the `hubot-scripts.json` file in this\nrepo.\n\n[hubot-scripts]: https://github.com/github/hubot-scripts\n\n## Persistence\n\nIf you are going to use the `hubot-redis-brain` package (strongly suggested),\nyou will need to add the Redis to Go addon on Heroku which requires a verified\naccount or you can create an account at [Redis to Go][redistogo] and manually\nset the `REDISTOGO_URL` variable.\n\n    % heroku config:add REDISTOGO_URL=\"...\"\n\nIf you don't need any persistence feel free to remove the `hubot-redis-brain`\nfrom `external-scripts.json` and you don't need to worry about redis at all.\n\n[redistogo]: https://redistogo.com/\n\n## Adapters\n\nAdapters are the interface to the service you want your hubot to run on, such\nas Campfire or IRC. There are a number of third party adapters that the\ncommunity have contributed. Check [Hubot Adapters][hubot-adapters] for the\navailable ones.\n\nIf you would like to run a non-Flowdock or shell adapter you will need to add\nthe adapter package as a dependency to the `package.json` file in the\n`dependencies` section.\n\nOnce you've added the dependency with `npm install --save` to install it you\ncan then run hubot with the adapter.\n\n    % bin/hubot -a \u003cadapter\u003e\n\nWhere `\u003cadapter\u003e` is the name of your adapter without the `hubot-` prefix.\n\n[hubot-adapters]: https://github.com/github/hubot/blob/master/docs/adapters.md\n\n## Debugging\n\nIf you'd like to test certain aspects of Valkyrie with a debugger, use `robot.logger.debug` and in your environment variables the flag `export HUBOT_LOG_LEVEL=\"debug\"` which will enable those messages to appear in terminal output. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthesis%2Fvalkyrie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthesis%2Fvalkyrie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthesis%2Fvalkyrie/lists"}