Challenge Overview
Challenge Objectives
-
Fix the issues from our previous challenge on the Topcoder CLI tool.
Technology Stack
-
Node.js
-
JavaScript
Code Access
Repo: https://github.com/topcoder-platform/topcoder-cli
Branch: develop
Individual requirements
As part of this challenge, we need your help to fix the following issues on our Topcoder CLI tool.
Complete the ‘pay’ command
The ‘pay’ command is currently half-baked and it only prompts the user for some of the challenge information.
You need to complete this command based on the description here https://github.com/topcoder-platform/topcoder-cli/issues/18
Complete support for M2M tokens
Currently, an authService was created but it’s not used anywhere.
If M2M credentials are provided, the M2M token should be used instead of the user JWT.
When a username is required (for example, in the `submit` command), this should be read from an RC file (.topcoderrc). If the username is not present, throw an error with a meaningful error message.
Make sure to update the schemaForRC Joi validation schema accordingly.
RC file vs global configs
Make sure the RC file (.topcoderrc), when is provided, will overwrite the global configurations.
If an RC file is not present, use the global configurations.
Fix the ‘config’ command
Currently, the user is expected to use the ‘config’ command using the ‘-a --add <key> <value>’ argument to set the configs one by one. This is wrong.
The user should be prompted to store either a combination of username/password or a combination of client id/secret for M2M.
Based on the user’s selection, the user should then get prompted to enter the credentials (password should be hidden using asterisks *).
Finally, the entered information should be saved.
Currently, running the tests ends up overwriting the global configured settings. This should not happen and must be fixed.
Code documentation
Make sure all methods have proper documentation explaining what the method does and describing the expected parameters.
Update existing documentation
Make sure to update all related documentation to reflect the changes made in the CLI tool.
All available commands should be documented.
Also, you need to update the CLI’s own documentation (‘--help’ argument) to document the usage of all commands.
Unit testing
You also need to update the existing tests to reflect the above changes and cover all new functionality with tests.
Should you have any doubts, do not hesitate to ask for clarification in the challenge forum! Do not comment directly on the Github issues.