{"id":20898848,"url":"https://github.com/metafam/xp","last_synced_at":"2025-05-13T01:31:14.570Z","repository":{"id":37624481,"uuid":"286838500","full_name":"MetaFam/XP","owner":"MetaFam","description":"MetaGame's SourceCred instance for tracking XP","archived":false,"fork":false,"pushed_at":"2023-10-27T16:09:33.000Z","size":20903127,"stargazers_count":11,"open_issues_count":6,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-01T14:56:48.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://xp.metagame.wtf","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MetaFam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-08-11T20:10:44.000Z","updated_at":"2023-03-10T14:14:25.000Z","dependencies_parsed_at":"2024-11-18T11:26:03.905Z","dependency_job_id":null,"html_url":"https://github.com/MetaFam/XP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"sourcecred/template-instance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaFam%2FXP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaFam%2FXP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaFam%2FXP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaFam%2FXP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MetaFam","download_url":"https://codeload.github.com/MetaFam/XP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253853748,"owners_count":21974167,"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":"2024-11-18T11:12:23.506Z","updated_at":"2025-05-13T01:31:10.404Z","avatar_url":"https://github.com/MetaFam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MetaGame XP Instance\n\nThis repository contains MetaGame's SourceCred instance.\n\n## About SourceCred Instances\n\nSourceCred is organized around \"instances\". Every instance must have a\n`sourcecred.json` file at root, which specifies which plugins are active in the\ninstance. Config and permanent data (e.g. the Ledger) are stored in the master branch.\nAll output or site data gets stored in the `gh-pages` branch by the Github Action.\n\nConfiguration files:\n- `config/grain.json` specifies how much Grain to distribute every week. The `maxSimultaneousDistributions` parameter \ndetermines how many weeks of \"back-distributions\" to generate if the command hasn't been run in a while (or ever).\n- `config/plugins/$PLUGIN_OWNER/$PLUGIN_NAME` stores plugin-specific data. Each\n  plugin has its own directory. See the plugin section below to learn how to configure them.\n\nPermanent Data:\n- `data/ledger.json` keeps a history of all grain distributions and transfers as well as identities added / merged.\n\nGenerated Data: \n\n- `cache/` stores intermediate produced by the plugins. This directory should\n  not be checked into Git at all.\n- `output/` stores output data generated by SourceCred, including the Cred\n  Graph and Cred Scores. This directory should be checked into Git; when\n  needed, it may be removed and re-generated by SourceCred.\n- `site/` which stores the compiled SourceCred frontend, which can display data\n  stored in the instance.\n\n\n## Setup and Usage\n\nUsing this instance as a starting point, you can update the config to include\njust the plugins you want, pointing at the data you care about. We recommend setting up\nyour instance locally first and make sure its working before pushing your changes\nto master and using the Github Action.\n\nGet [Yarn] and then run `yarn` to install SourceCred and dependencies.\n\nUpdate the configuration files according to the plugin guides below.\n\nThen, run the following commands to update the instance:\n\n- `yarn load [...plugins]` loads the cache. By default, it loads all\n  plugins, or it can load only specific plugins if requested.\n- `yarn graph  [...plugins]` regenerates plugin graphs from the cache;\n  these graphs get saved in `output/`\n- `yarn score` computes Cred scores, combining data from all the chosen\n  plugins\n- `yarn grain` distributes Grain according to the current Cred scores, and the config in `config/grain.json`\n\n**Generate the frontend:**\n\n- `yarn site`\n\n**Run the frontend:**\n\n- `yarn admin`\n\n\nIf you want to clear the cached data, you can do so via:\n\n- `yarn clean` \n\nRunning `yarn clean` is a good idea if any plugins fail to load.\n\nIf you want to restart from a clean slate and remove all the generated graphs, you can do so via:\n\n- `yarn clean-all` \n\nRun `yarn clean-all` if the `yarn graph` command fails due to a change in the config or breaking changes in a new version of SourceCred.\n**Warning**: If you don't have credentials for every plugin, you might not be able to regenerate parts of the graph.\n\n#### Publishing on GitHub pages\n\nOnce you've got the instance configured to your satisfaction (see instructions on plugins below),\ncommit and push your changes to master (or make a pull request). The Github Action will then generate the frontend\nand deploy it to GitHub Pages. To enable GitHub Pages for your instance, check out [this guide](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site).\nMake sure you select `gh-pages` as the branch to publish from. \n\n## Supported Plugins\n\n### GitHub\n\nThe GitHub plugin loads GitHub repositories.\n\nYou can specify the repositories to load in\n`config/plugins/sourcecred/github/config.json`.\n\nThe Github Action automatically has its own GITHUB_TOKEN, but if you need to load data from the \nGitHub plugin locally, you must have a GitHub API key in your environment as\n`$SOURCECRED_GITHUB_TOKEN`. The key should be read-only without any special\npermissions (unless you are loading a private GitHub repository, in which case\nthe key needs access to your private repositories).\n\nYou can generate a GitHub API key [here](https://github.com/settings/tokens).\n\n### Discourse\n\nThe Discourse plugin loads Discourse forums; currently, only one forum can be loaded in any single instance. This does not require any special API\nkeys or permissions. You just need to set the server url in `config/plugins/sourcecred/discourse/config.json`.\n\n### Discord\n\nThe Discord plugin loads Discord servers, and mints cred on Discord reactions.\n\nTo get this setup, you'll first want to enable Developer Mode in your Discord\nclient, under User Settings -\u003e Appearance -\u003e Advanced -\u003e Developer Mode. This\nwill give you the ability to right-click on items and copy their Discord ids.\n\nThen, right click on the server you want to track, and copy its ID. Modify the\n`config/plugins/sourcecred/discord/config.json` file to have the correct\nguildId.\n\nNext, you'll need to create a Discord application and add it to the server. (This requires admin permissions on that server.)\n\nThe first step is to create an application, which you can do here:\nhttps://discordapp.com/developers/applications\n\nYou'll get an application client ID, which you'll need in a future step.\n\nNext, give that application a Bot by clicking on the \"Bot\" menu option on the left, and then adding a bot.\nThe bot will have a token, which you should also save.\n\nOnce you've made the bot, you need to invite it to your server.\nYou'll need to do so by constructing a URL like:\n\n`https://discordapp.com/api/oauth2/authorize?client_id=${CLIENT_ID}\u0026scope=bot\u0026permissions=66560`\n\nWhere `${CLIENT_ID}` should be replaced with your application's client id from\nabove. For example, if your application's client id is 1234, use the following url:\n\n`https://discordapp.com/api/oauth2/authorize?client_id=1234\u0026scope=bot\u0026permissions=66560`\n\nOpen that url in a browser where you are logged into Discord, and you'll see a\nmenu letting you add the bot to servers you have access to. Add it to the\nserver in question, giving it permission to read messages and read message\nhistory.\n\nYou need to add this token into GitHub for the Action to work correctly.\n[Checkout this guide](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository) \nto see how you can add the token as a Secret that can be read by the Action. Set the name to `SOURCECRED_DISCORD_TOKEN`;\n\nIf you are running SourceCred locally, set the bot token to the environment variable `$SOURCECRED_DISCORD_TOKEN`.\n\nYou can now load your Discord server. Hooray!\n\nAs an added bit of configuration, you can set custom reactionWeights in the\n`reactionWeights` section of the Discord config. These allow you to change how\nmuch Cred is minted per reaction.\n\nIf you want to change the weight for a default reaction, just put the\nreaction's literal emoji in the config.json, as in `\"💜\": 5` to give the purple\nheart a weight of 5.\n\nIf you want to set a custom weight for a custom emoji, you'll need to get the\ncustom emoji's server id. You can do this by right-clicking on a custom emoji\nin the server, and clicking \"copy link\". This will give you a link to the\nemoji's image on Discord's servers, for example:\n\nhttps://cdn.discordapp.com/emojis/678399364418502669.png?v=1\n\nThe numeric substring is the emoji's ID. You can then specify it in the\nreaction weights file as `$EMOJI_NAME:$EMOJI_ID`, as in:\n`\"sourcecred:678399364418502669\": 10` to give some server's custom SourceCred\nemoji a weight of 10.\n\n## Removing plugins\n\nTo deactivate a plugin, just remove it from the `bundledPlugins` array in the `sourcecred.json` file.\nYou can also remove its `config/plugins/OWNER/NAME` directory for good measure.\n\n\n\n[Yarn]: https://classic.yarnpkg.com/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetafam%2Fxp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetafam%2Fxp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetafam%2Fxp/lists"}