Wikipedia:WikiProject Articles for creation/Helper script/Contributing

This is a guide on how to contribute to the development of the Articles for Creation helper script. The AfC helper script is a critical part of how Wikipedia creates new articles. Thank you for your interest in contributing! There are many ways to contribute, and we appreciate all of them.

Contributing code
The helper script is written in JavaScript (ES5). We define the user interface in HTML, using Mustache templates, and style it using LESS (very similar to CSS).

The code for the helper script is in a GitHub repository. To contribute, you'll need a GitHub account to send your changes to us; create a GitHub account if you don't have one. We follow GitHub flow.

You'll probably also want a Wikipedia account. A Wikipedia account will make communicating with the helper script's users easier. Create a Wikipedia account if you don't have one.

You will need to be familiar with the Articles for Creation process. Briefly, new contributors write drafts; reviewers then either accept them, moving them to mainspace, or decline them, leaving instructions for the draft's author on how to fix the draft. There are a few other possible actions. The full process is described at WikiProject Articles for creation/Reviewing instructions.

See /Developer setup for setup instructions.

If you have any questions or get stuck, feel free to use our Zulip channel, #enwiki-afch, at https://wikimedia.zulipchat.com.

Finding issues to work on
Good first issues are the ones tagged with E-good-first-issue. There may also be suggestions at the main AfC talk page or its archives.

Modifying the code
The code is in the src/ directory of the repository. Inside are three directories and a file:


 * less/, which contains the LESS files with styling information. For example, if you wanted to change the color of a button, you would change a file in this directory.
 * modules/, which contains almost all the JavaScript code. You will probably be changing the files in this directory a lot. It has two files:
 * core.js, which has utility functions for the script. For example, the utility function to edit a page is defined here.
 * submissions.js, which has the main code ("business logic") for the script. For example, the code that runs when the user decides to accept a draft is defined here. It has lots of functions, including:
 * showAcceptOptions, showDeclineOptions, showCommentOptions, showSubmitOptions, etc., which load the user interfaces for some of the tabs. If you want to show something dynamic, like something depending on a MediaWiki API request, you'll change one of these functions.
 * handleAccept, handleDecline, handleComment, handleSubmit, handleCleanup, etc., which send the API requests to actually perform the actions. Called with data from the user interfaces.
 * templates/, which contains the Mustache templates. It has two files:
 * tpl-preferences.html, which defines the user interface for the Preferences panel of the script
 * tpl-submissions.html, which defines the user interface for all other parts of the script
 * afch.js, which contains the main code that loads the script. You probably won't need to change this.

Pro tip: if you set  using your browser console or in src/afch.js, instead of logging API requests in the console, the script will actually make page edits. (It used to default to making the page edits, but that wasn't very useful.)

Submitting code for review
All code must be your own work, or else have proper credit given to the author in a comment (yes, even for Stack Overflow code).


 * 1) Commit your changes.
 * 2) Create a pull request.

We'll look at it and give you feedback and/or merge it. If we merged it, congratulations on contributing and improving Wikipedia's article creation process for everyone!

Need help?
We have a Zulip channel, #enwiki-afch, at https://wikimedia.zulipchat.com (Zulip info).

As of January 2021, the maintainer of the script is. Feel free to ask him any questions you may have on his talk page or on Zulip. He is also available on IRC (usually in ) or on Discord.

Troubleshooting tips are at /Developer setup.

Roadmap
Bigger projects we could do eventually:


 * Adding the ability to do "checklist" reviews, where each reviewer checks only one of the requirements for accepting a draft (not a copyright violation, is notable, has good sources, has prose written using the appropriate tone).
 * Showing statistics for the current reviewing session, or across all reviewers
 * Additional tools for reviewers: more checks to do, like grammar or sources (perhaps automatically run checks like User:Headbomb/unreliable)

Verifying PRs
One way to help out is by testing code contributions to make sure they work on your setup.


 * 1) Install Git and Node.
 * 2) Clone the AFCH repository to your computer: open a terminal on your computer and run
 * 3) Go to the PR page and find the number of the PR. It's at the end of the URL. For example, for https://github.com/WPAFC/afch-rewrite/pull/219, the number 219 is at the end of the URL.
 * 4) Fetch the particular PR: open a terminal in the new afch-rewrite folder created by the previous step, and run   replacing NUMBER with the number of the PR you just determined.
 * 5) Run   and follow its instructions.
 * 6) Test the PR using your new setup. For example, if the PR is about whether a particular template is being removed during cleaning, edit a draft so it includes that template, and then verify that the script now removes that template during cleaning.
 * 7) Report whether it worked in a comment on the PR page. Thank you for helping with the AFCH script!

Other ways to contribute

 * Making sure our GitHub issues are tagged correctly and have meaningful and actionable descriptions
 * Reading the main AfC talk page and making sure new bugs are reported on GitHub, and generally communicating with the Articles for Creation reviewer community
 * Helping other developers out on Zulip
 * Writing documentation by editing the page you're reading right now, or our GitHub wiki