tagoro9 / fotingo Goto Github PK
View Code? Open in Web Editor NEWA CLI to ease the interaction between git, github and jira when working on tasks.
License: MIT License
A CLI to ease the interaction between git, github and jira when working on tasks.
License: MIT License
When remote push is rejected (If your local branch is behind, for example), I'm getting a ssh key error.
DEBUG="fotingo:*" fotingo review ANDROID-774 -b i/oauth
[1/7] ๐ Initializing services...
fotingo:github Initializing Github api +0ms
fotingo:github User token is present. Using current authentication +4ms
fotingo:git Initializing /Users/carlos/code/marvin repository +440ms
fotingo:jira Initializing Jira api +3ms
fotingo:http Performing GET https://team-turo.atlassian.net/rest/api/2/myself?expand=groups +2ms
[2/7] โฌ๏ธ Pushing 'f/android-774_handle_access_token_retrieval_by_client_credentials' to Github...
fotingo:git Getting authentication from SSH agent +495ms
error ๐ฅ It looks like you haven't added you ssh key. Remember to `ssh-add -k path_to_private_key` so we can communicate with the remote repository.
If there is a done and in review transitions if will set the first one that it finds without giving preference to the in review status.
This ends up in setting issue to the wrong workflow state (done instead of in review).
Test should be added ASAP. As new features are added, it will become more difficult to add all the needed tests.
Sometimes it may be easier to copy a ticket URL and run fotingo start :pastedUrl
than having to manually type the ticket id.
Right now it is showing a really ugly error.
It happens with a local config file and a failed jira login with the global user / password. If there is a local config file with other config (i.e. github) it will get lost.
This is the current output, which could be clearer or clever about it.
[1/4] ๐ Initializing services...
[2/4] ๐ Getting issue from jira...
[3/4] ๐ Updating issue status...
[4/4] ๐ Creating branch to work on issue...
error ๐ฅ Error: Failed to write reference 'refs/heads/b/dunlop-767_org-hibernate-exception-genericjdbcexception_in_-api-login': a reference with that name already exists.
error ๐ฅ I DON'T KNOW HOW TO HANDLE THIS ERROR
This happens if the user doesn't have the right permissions on the repo.
Fotingo should only fetch the labels if the -l
option was specified. Also, it should fail with a better error if the user doesn't have permissions.
It should do it the same way it checks the labels.
There is no problem with the -n
option, but if this is not passed, then there should be an option that allows to specify the branch name.
If a reviewer or label is specified and no matches can be found, fotingo will crash with a very bad error. Instead, we should notify the user and ask them if they want to continue or not
With a branch template of simply {issue.key}
, fotingo review
can't extract the branch name.
It seems like the problem is the regex here:
Line 50 in b5af3dc
I'm not sure, but I had a thought about how to fix it: transform the keys used inside the template to matching regex fragments, leaving any symbols as they are (as anchors), so {issue.key}
would be replaced with (\w+-\d+)
This is my first time using fotingo, so there may be some user error involved. Here are my current steps to reproduce:
fotingo start TICKET_NUMBER
.dmarr@MacBook-Pro-3 ~/code/schumacher (react-storysource) $ DEBUG=fotingo:* !!
DEBUG=fotingo:* fotingo start SCHU-1436
[1/4] ๐ Initializing services...
fotingo:github Initializing Github api +0ms
fotingo:github User token is present. Using current authentication +0ms
fotingo:git Initializing /Users/dmarr/code/schumacher repository +0ms
fotingo:jira Initializing Jira api +0ms
fotingo:http Performing GET https://team-turo.atlassian.net//rest/api/2/myself?expand=groups +0ms
[2/4] ๐ Getting 'SCHU-1436' from jira...
fotingo:jira Getting issue from jira +0ms
fotingo:http Performing GET https://team-turo.atlassian.net//rest/api/2/issue/SCHU-1436?expand=transitions +0ms
[3/4] ๐ Setting 'SCHU-1436' in progress...
fotingo:jira Updating issue status to IN_PROGRESS +0ms
fotingo:http Performing POST https://team-turo.atlassian.net//rest/api/2/issue/SCHU-1436/transitions with body {
fotingo:http "transition": {
fotingo:http "id": "31"
fotingo:http },
fotingo:http "fields": {}
fotingo:http } +0ms
[4/4] ๐ Creating branch 'c/schu-1436_on_the_vehicles_page_if_a_host_has_already_listed_a_vehicle__can_we_make'...
fotingo:git Creating branch for issue +0ms
fotingo:git Fetching data from remote +0ms
fotingo:git Getting authentication from SSH agent +0ms
error ๐ฅ Error: credentials callback returned an invalid cred type
Right now it is printing the error object. It could have a better error message.
According to the documentation:
โฏ fotingo release -h
Usage: fotingo-release [options]
Options:
-n, --no-branch-issue Do not pick issue from the branch name
-i, --issue [issue] Specify more issues to include in the release (default: )
-h, --help output usage information
it seems that -n
and --no-branch-issue
are equivalent. However, if I execute
โฏ fotingo release -n -issue_1 release_1
[1/5] ๐ Initializing services...
error ๐ฅ You haven't made any changes to this branch
Using --no-branch-issue
seem to be working correctly
If you forgot to execute ssh-add -k ~/.ssh/id_rsa
it will hangout while creating the branch without giving the user any hint what is wrong.
> yarn global add fotingo
yarn global v0.23.2
warning No license field
[1/4] ๐ Resolving packages...
[2/4] ๐ Fetching packages...
error [email protected]: The engine "yarn" is incompatible with this module. Expected version "^0.19.1".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
It can be worked around, though:
yarn global add --ignore-engines fotingo
It the failure is due to not being able to push the branch (it needs to be forced), then the program exits but no error is shown
It happens that in most PRs for a project there may be a set of labels that are applied to most of the, so let's save some time and store them in the config files.
When running a subcommand (start
, review
, ...) it will fail. More details on tj/commander.js#869
I don't know how reproducible this is:
fotingo start DUNLOP-4560
fotingo review
[1/7] ๐ Initializing services...
fotingo:github Initializing Github api +0ms
fotingo:github User token is present. Using current authentication +0ms
fotingo:git Initializing /Users/kiwi/dkr/dkr-httpd-dunlop repository +0ms
fotingo:jira Initializing Jira api +0ms
fotingo:http Performing GET https://****.atlassian.net/rest/api/2/myself?expand=groups +0ms
[2/7] โฌ๏ธ Pushing 'c/dunlop-4560_update_apache_image_to_use_new_paths_for_static_content' to Github...
fotingo:git Getting authentication from SSH agent +0ms
[3/7] ๐ Extracting issue from branch...
fotingo:git Extracting issue from current branch +0ms
[4/7] ๐ Getting 'DUNLOP-4560' from jira...
fotingo:jira Getting issue from jira +0ms
fotingo:http Performing GET https://****.atlassian.net/rest/api/2/issue/DUNLOP-4560?expand=transitions +0ms
[5/7] ๐ Getting your commit history...
fotingo:git Getting branch commit history +0ms
[6/7] ๐ Creating pull request...
fotingo:git Created history walker. Latest common commit: 68a17f****1039056 +0ms
error ๐ฅ {"message":"Not Found","documentation_url":"https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository"}
I ran an update and tried again with the same result:
npm -g update fotingo
/Users/kiwi/.nvm/versions/node/v8.3.0/bin/fotingo -> /Users/kiwi/.nvm/versions/node/v8.3.0/lib/node_modules/fotingo/lib/fotingo.js
+ [email protected]
It creates a text like Fixes [, #WHATEVER-llalal](link)
.
The api should be something like:
fotingo review -a tagoro9 -a <github username>
or
fotingo review -a 'tagoro9,<githubusername>'
Either way, it should somehow check that these are valid github users and that have access to the repo. Probably the api will do this for us, so the only need is to differentiate among the returned error codes to show the proper message.
The relevant APIs are here.
Sometimes I may create a branch where I intend to work on a few small issues and I don't want fotingo to create a new branch but just set the issue in progress.
When getting the commit information and doing a merge base, origin/master
is hardcoded. Which means that if someone has a different remote or base branch, then the commit information will be wrong.
If the commit message contains references to PRs or anything that may seem like a Jira issue but it is not, the process will fail
If there are new files, not added to the index, before doing a fotingo start
they don't get add to the stash and the changes are lost.
It should handle nicely when the current branch has not a remote tracked branch set.
Right now in createIssueBranch
, the duplicate branch error is always thrown, but there could be another error.
In order to implement this, nodegit/nodegit#1206 needs to be fixed.
Based on recent announcement from Github
https://github.blog/2019-02-14-introducing-draft-pull-requests/
brew install libgcrypt
The api should be something like:
fotingo review -l 'feature request' -l 'semver minor'
Probably if there is a typo in the label, a new label will be created and that is not desired. It should get the labels for the repo and verify that they exist before submitting the change.
Relevant api is here. I thought that PRs needed to be linked to an issue but I was wrong, a PR is a superset of an issue, so all the APIs are compatible.
It could be useful to have a quick way to change the base branch, for example, when you're working with integration branches and want to branch off them.
fotingo start ISSUE-X -b "branch-name"
).fotingo
config file (fotingo config -b "branch-name"
)Right now the error message is this one:
{"message":"Reviews may only be requested from collaborators. One or more of the users you specified is not a collaborator of the tagoro9/fotingo repository.","documentation_url":"https://developer.github.com/v3/schema/pull-request-review-request"}
It should have a better error handling. It happened with a user with a google login.
I wanted to start
an issue of type Improvement. This created a branch name like "undefined/XXXX-1234โฆ"
Looking at git/util.js, it seems as though the ISSUE_TYPES
mapping doesn't handle this and doesn't have a fallback.
I see a few ways to solve this:
ISSUE_TYPES
into user configurationISSUE_TYPES
that match those from JIRAI can work on this myself if that's helpful (I'm familiar with Ramda), I would just like to know which approach is preferred.
It should look for .fotingo
files in CWD and merge with the global config file.
It's generally accepted that keeping secrets on disk in unencrypted files is a _Bad Idea_โข. Having secrets inside the fotingo configuration keeps me from publishing it alongside my other dotfiles.
There are probably multiple ways to approach the issue. What I think would make sense is the ability to specify a program to fetch the JIRA password/github API key. A user could then use e.g. pass ,
command-line access to the system keychain (e.g. for macOS) or any other tool that outputs the password to stdout.
Another option would be to read from environment variable, like the AWS command-line tools.
Either way, fotingo wouldn't have to deal with any cryptographic operations
There are probably other approaches, but these ones consistent with what I've seen in other command-line tools.
I looked at the code, and it seems like it would be easier to use environment variables, or read the secrets via command once and keep them in memory. However, It would be more secure to use the command approach and call the command each time, but that would require some changes in http-client. I would think that auth.password
would therefore have to be a function, which would either be R.always(pass)
for a string password, or a function that calls the specified command (child_process.execSync
). The configuration format would then need some way of indicating whether the password is a string or command. Perhaps the command could be specified as an object, then the decision to use string/command processing would be based on the type?
I think I could probably work on this.
I had my credentials changed on Jira but not on Fotingo. When performing a fotingo start
, it to provide a login and password as if it was a first-time installation. It would be nice to have a message saying that the stored credentials are no longer valid.
Show the issue name, branch name, ....
It should infer the different transition ids given the transition names. Fallback to the question (better phrased) if it is unable to find all the ids.
When I perform a release with no release name the command goes through without any warning until it fails.
fotingo release
The real issue comes when there are multiple related issues -i
and no release name
IMO this problem can be solved just by enforcing a release name to exist. Any thoughts on it?
P.S: I โค๏ธ fotingo
Even though there is no interaction with the issue tracker the default PR description will have links to the issues.
For a few reasons, GitHub recommends HTTPS cloning
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.