Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1158: AWS version of JShell #1161

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

surajkumar
Copy link
Contributor

@surajkumar surajkumar commented Aug 31, 2024

Description

This PR introduces a new slash command /jshell-aws and it's accompanying infrastructure.

There are 2 parts:

Slash Command
The new /jshell-aws works by accepting 1 parameter code which is a snippet of Java code the user provides to be evaluated.
This command calls the API hosted on AWS and returns the result. At the moment, it's basic and does not compare to the existing /jshell command which has had much more thought put into handling user inputs and outputs.

JShell AWS API
A new module has been added to the project called jshell-aws-backend. This is the complete infrastructure and code for performing the JShell logic in a serverless AWS Lambda and contains the IaC as a CloudFormation template.

There is a GitHub action included in the PR which makes deployment a breeze.

#1158

Screenshots

Command

image

Error messages

image

Normal code execution

image

@surajkumar surajkumar force-pushed the 1158-aws-jshell branch 8 times, most recently from dfe03d0 to 24c59b9 Compare August 31, 2024 20:54
@tj-wazei tj-wazei linked an issue Sep 1, 2024 that may be closed by this pull request
@surajkumar surajkumar force-pushed the 1158-aws-jshell branch 11 times, most recently from f3cf468 to 0d7d787 Compare September 1, 2024 21:50
@surajkumar surajkumar marked this pull request as ready for review September 1, 2024 21:51
@surajkumar surajkumar requested a review from a team as a code owner September 1, 2024 21:51
Comment on lines +57 to +64
if (input == null || input.getAsString().isEmpty()) {
EmbedBuilder eb = new EmbedBuilder();
eb.setDescription(member.getAsMention()
+ ", you forgot to provide the code for JShell to evaluate or it was too short!\nTry running the command again and make sure to select the code option");
eb.setColor(Color.ORANGE);
event.replyEmbeds(eb.build()).queue();
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when setting up code as command option, you can set required property to True thus user can't execute the command without passing in something as code to begin with

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check, but I think true is the default value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it anyway, it enforces readability ig

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked, required is false by default
Screenshot 2024-09-14 at 4 37 42 PM

Since you made code param as mandatory, you no longer need to check for input being null or empty string

@surajkumar surajkumar marked this pull request as draft October 30, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JShell in AWS
2 participants