class Start: banner = Steps( Box("Bento Initialization"), Echo( Text( "Bento configures itself for personal use by default. This means that it:", processor=Processors.wrap(), ) ), Newline(), Echo( Text( "1. Automatically checks for issues introduced by your code, as you commit it", processor=Processors.wrap(), ) ), Echo( Text( "2. Only affects you; it won’t change anything for other project contributors", processor=Processors.wrap(), ) ), Newline(), Echo( Text( "Learn more about personal and team use at bento.dev/workflows.", processor=Processors.wrap_link( [Link("bento.dev/workflows", "https://bento.dev/workflows")] ), ) ), Newline(), ) confirm = Steps(Confirm("Press ENTER to add Bento to this project"), Newline())
class UpdateEmail: leader = Steps( Echo( Multi( [ "Registration: ", Text( "We’ll use your email to provide support and share product updates. You can unsubscribe at " "any time.", style={"dim": True}, ), ], processor=Processors.wrap(extra=8), ) ), Newline(), ) prompt = Prompt("What is your email address?") failure = Steps( Newline(), Warn( "We were unable to subscribe you to the Bento mailing list (which means you may miss out on " "announcements!). Bento will continue running. Please shoot us a note via [email protected] to debug. " ), )
class ConfirmTos: fresh = Steps( Echo( Multi( [ "Privacy: ", Text( "We take privacy seriously. Bento runs exclusively on your computer. It will never send your " "code anywhere.", style={"dim": True}, ), ], processor=Processors.wrap(extra=8), ) ), Newline(), Echo( Text( "We’re constantly looking to make Bento better. To that end, we collect limited usage and results " "data. To learn more, see bento.dev/privacy.", processor=Processors.wrap_link( [Link("bento.dev/privacy", "https://bento.dev/privacy")] ), style={"dim": True}, ) ), Newline(), ) invalid_version = Error( "~/.bento/config.yml is malformed. Please remove this file and re-run Bento. " ) upgrade = Steps( Echo( Text( "We've made changes to our terms of service. Please review the new terms. If you have any questions " "or concerns please reach out via [email protected].", processor=Processors.wrap_link( [Link("*****@*****.**", "mailto:[email protected]")] ), style={"dim": True}, ) ), Newline(), ) prompt = Confirm( "Continue and agree to Bento's terms of service and privacy policy?", options={"default": True}, ) error = Error( "Bento did NOT install. Bento beta users must agree to the terms of service to continue. Please reach out to " "us at [email protected] with questions or concerns. " )
class Install: learn_more = Text( "To learn more, see the README.", processor=Processors.wrap_link([ Link( "README", "https://github.com/returntocorp/bento/blob/master/README.md#running-in-cicd", ) ]), ) banner = Steps( Echo( Multi( [ "Configuring a GitHub Action to automatically check your team's pull requests. ", learn_more, ], processor=Processors.wrap(), )), Newline(), ) progress = Progress( content=Multi([ "Creating GitHub Action configuration at ", Sub(0, style={ "bold": True, "dim": True }), Text("/", style={ "bold": True, "dim": True }), ]), extra=24, ) after_progress = Newline() finalize_ci = Steps( Warn("To finalize configuration of Bento's GitHub Action, please:"), Echo( Multi([ " $ git add .github/\n", ' $ git commit -m "Add Bento GitHub Action"\n', " $ git push\n", ])), )
class Clean: tools = Steps(Echo("Reinstalling tools due to passed --clean flag."), Newline()) check = Warn( """ Removing archive due to passed --clean flag. """ )
class Finish: body = Steps( Box("Thank You"), Echo( Text( "From all of us at r2c, thank you for trying Bento! We can’t wait to hear what you think.", processor=Processors.wrap(), )), Newline(), Echo( Multi( [ "Help and feedback: ", Text("Reach out to us at ", style={"dim": True}), "*****@*****.**", Text(" or file an issue on ", style={"dim": True}), "GitHub", Text(". We’d love to hear from you!", style={"dim": True}), ], processor=Processors.wrap_link( [ Link("*****@*****.**", "mailto:[email protected]"), Link("GitHub", "https://github.com/returntocorp/bento/issues"), ], extra=16, ), )), Newline(), Echo( Multi( [ "Community: ", Text("Join ", style={"dim": True}), "#bento", Text( " on our community Slack. Get support, talk with other users, and share feedback.", style={"dim": True}, ), ], processor=Processors.wrap_link( [ Link( "#bento", "https://join.slack.com/t/r2c-community/shared_invite/enQtNjU0NDYzMjAwODY4LWE3NTg1MGNhYTAwMzk5ZGRhMjQ2MzVhNGJiZjI1ZWQ0NjQ2YWI4ZGY3OGViMGJjNzA4ODQ3MjEzOWExNjZlNTA", ) ], extra=16, ), )), Newline(), Echo("Go forth and write great code! To use Bento:"), Echo( Multi([ _step_item("commit code", "git commit"), _step_item("get help for a command", "bento [COMMAND] --help", nl=False), ])), )
class Identify: success = Steps( Newline(), Echo(Multi(["Bento initialized for ", Sub(0, style={"bold": True})])), Newline(), ) failure = Steps( Newline(), Warn( "Bento can't automatically identify this project. Please manually configure this project:" ), Echo( Multi([ _step_item("configure a tool manually", "bento enable tool TOOL"), _step_item("list available tools", "bento enable tool --help"), ])), )
class Check: unnecessary = Steps( Echo("Bento archive is already configured on this project."), Newline()) prompt = Confirm("Analyze this project for the first time?", options={"default": True}) header = Box("Bento Check") noninteractive = Warn( "Skipping project analysis due to noninteractive terminal.")
class Overwrite: warn = Steps( Echo( Multi([ "It seems Bento is already installed for GitHub Actions at ", Sub(0, style={"bold": True}), ])), Newline(), Warn("If you continue, Bento will revert any changes " "you might have made manually to this CI configuration file."), Newline(), ) confirm = Confirm( "Do you want to revert Bento's GitHub Action to the default configuration?" ) after_confirm = Newline()
class InstallCI: pitch = Steps( Echo( Multi( [ "Bento can configure a GitHub Action to automatically check your team's pull requests. ", ci_content.Install.learn_more, ], processor=Processors.wrap(), ) ), Newline(), ) confirm = Confirm("Do you want to configure Bento's GitHub Action now?") after_confirm = Newline() progress = ci_content.Install.progress finalize_ci = ci_content.Install.finalize_ci
Link, Multi, Newline, Processors, Progress, Prompt, Steps, Sub, Text, Warn, ) not_registered = Steps( Error("This installation of Bento is not registered."), Echo(""" Please either: ◦ Register Bento by running it in an interactive terminal ◦ Run Bento with `--agree --email [EMAIL]`"""), ) welcome = Steps( Box("Global Bento Configuration"), Echo( Text( "Thanks for installing Bento, a free and opinionated toolkit for gradually adopting linters and program " "analysis in your codebase!", processor=Processors.wrap(), )), Newline(), )