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

Refactor SKonsole Commands and Improve Code Consistency #7

Merged
merged 12 commits into from
Aug 15, 2023

Conversation

lemillermicrosoft
Copy link
Owner

@lemillermicrosoft lemillermicrosoft commented Aug 15, 2023

Resolves #6.

Summary:
This pull request introduces a series of changes aimed at refactoring the SKonsole codebase, improving code organization, maintainability, and consistency. The main changes involve updating Java formatting settings, refactoring SKonsole commands, improving exception handling, and adding new settings and recommendations for Visual Studio Code.

Detailed List of Changes:

  1. Updated c# formatting settings in the .editorconfig file, such as spacing rules for various operators, parentheses, and braces.
  2. Refactored the SKonsole commands in the ConfigCommand.cs and ConfigurationProvider.cs files, including the use of this keyword for instance members, updating class declarations to be sealed, and refining exception handling.
  3. Improved exception handling in ConfigurationProvider.cs by handling specific exceptions: JsonException, NotSupportedException, and ArgumentNullException.
  4. Removed unused using System.CommandLine.Builder; directive and wrapped loggerFactory in a using statement in Program.cs.
  5. Added braces to single-line if statements in Program.cs for improved readability.
  6. Changed class declarations from internal class to internal sealed class in EmailSkill.cs, GitSkill.cs, and WriterSkill.cs.
  7. Added a new .vscode/settings.json file with settings for formatting, bracket pair colorization, file exclusions, and custom words for the spell checker.
  8. Added a new extensions.json file with recommendations for Visual Studio Code extensions, including C# support, Semantic Kernel, and Code Spell Checker.

These changes will help ensure that the project adheres to best practices and maintains a high level of code quality, consistency, and readability.

Configure VSCode settings to enable auto-formatting and exclude certain
files. Add recommended extensions for C# development and spell checking.
This commit updates the .editorconfig file with new diagnostic rules,
naming conventions, and settings for various file types, such as XML,
JSON, TypeScript, C#, and Java. It also enforces .NET coding
conventions and sets diagnostic severity levels for warnings and
errors. Additionally, the ConfigCommand.cs, ConfigurationProvider,
Program, EmailSkill, GitSkill, and WriterSkill classes have been
refactored to improve code consistency, maintainability, and error
handling.
Implement a new KernelProvider class to manage the creation and
configuration of the SemanticKernel. Add utility classes for handling
configuration variables and logging setup. This improves the overall
structure and maintainability of the code.
This commit introduces a new CommitCommand class to handle commit
messages and refactors the logging setup into a separate utility
class. It also simplifies the handling of git diff output by removing
unnecessary process calls and stream reading. The changes include:

- Create CommitCommand class with GenerateCommitMessageCommand method
- Move RunCommitMessage logic from Program.cs to CommitCommand.cs
- Refactor logging setup into Logging.GetFactory method
- Update Program.cs to use new CommitCommand and Logging classes
- Remove ConfigVar method and replace it with a direct call to the
  Configuration.ConfigVar method
This commit improves the logging system by setting the minimum log level
and adding a logger to the CommitCommand class. It also refactors the
RunCommitMessage method to accept a logger as a parameter and updates
the Program.cs file to include the logger.
- Extracted PRCommand logic into a separate class
- Added GeneratePRFeedbackCommand and GeneratePRDescriptionCommand methods
- Updated Program.cs to use the new PRCommand class
- Removed redundant code from Program.cs
This commit addresses two main changes:
1. Properly pass the `token` parameter to the `kernel.RunAsync` method in
   both `CommitCommand.cs` and `PRCommand.cs`.
2. Add a missing comma in `CommitCommand.cs` to correctly set the
   `StandardOutputEncoding` property.
This commit introduces a new PlannerCommand class that handles the
planning functionality. It has been integrated with the root command,
replacing the previous implementation. The PlannerCommand class now
generates a CreatePlan subcommand and handles its execution. The
RunCreatePlan method has been moved into the PlannerCommand class,
simplifying the Program.cs file.
Add a new PromptChatCommand class to handle chat functionality with the
prompt bot. This class includes methods for generating the command,
running the chat, and reading multi-line input. The main Program.cs file
has been updated to use the new PromptChatCommand class, simplifying the
code and improving organization.
Update the launch.json file to include an args array for the
SKonsole.dll program. This allows passing arguments to the program
when debugging in VSCode.
@lemillermicrosoft
Copy link
Owner Author

FYI @xbotter

Removed a large number of Java-specific formatting settings from the
.editorconfig file. This change simplifies the configuration and
focuses on the essential settings for the project.
@lemillermicrosoft lemillermicrosoft changed the title Refactor Commands Refactor SKonsole Commands and Improve Code Consistency Aug 15, 2023
Copy link
Contributor

@xbotter xbotter left a comment

Choose a reason for hiding this comment

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

fix a typo

apps/SKonsole/Commands/PromptChatCommand.cs Outdated Show resolved Hide resolved
apps/SKonsole/Commands/PromptChatCommand.cs Outdated Show resolved Hide resolved
Co-authored-by: xbotter <xbotter@users.noreply.github.com>
@lemillermicrosoft lemillermicrosoft merged commit d3ca825 into main Aug 15, 2023
@lemillermicrosoft lemillermicrosoft deleted the 814_commands branch September 29, 2023 22:46
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.

Refactor commands out of program.cs
2 participants