-
Notifications
You must be signed in to change notification settings - Fork 75
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments about infrastructure. I didn't read the code. 7k lines is a bit much to bite off in one chunk. Is someone else reviewing the actual implementation here?
build/dependencies.props
Outdated
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion> | ||
<SystemDataSqlClientPackageVersion>4.5.1</SystemDataSqlClientPackageVersion> | ||
<SystemSecurityCryptographyCngPackageVersion>4.5.0</SystemSecurityCryptographyCngPackageVersion> | ||
<CommandLine_NewtonsoftJsonPackageVersion>10.0.1</CommandLine_NewtonsoftJsonPackageVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reasonly to use 10? The rest of the runtime uses 11.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe there was a particular reason, i'll try bumping to the latest patch of 11
@@ -0,0 +1,38 @@ | |||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the copyright header to all .cs files.
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<Description>A framework for creating REPLs in .NET Core.</Description> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this meant to be a package that is distributed to NuGet.org for others to use? If so, there are a few more infrastructure hoops to jump through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, intended to be distributed via NuGet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked in person yesterday. Let's not ship Microsoft.Repl.dll as a package yet. The demand is unclear, and we don't want to be on the hook to support the package.
You can disable producing a nupkg by adding <IsPackable>false</IsPackable>
to this .csproj file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
<ItemGroup> | ||
<SignedPackageFile Include="tools/$(TargetFramework)/any/Microsoft.Repl.dll" Certificate="$(AssemblySigningCertName)" /> | ||
<SignedPackageFile Include="tools/$(TargetFramework)/any/Newtonsoft.Json.dll" Certificate="$(AssemblySigningCertName)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change third party binaries to use Certificate="Microsoft3rdPartyAppComponentDual"
. If it uses $(AssemblySigningCertName)
, it would cause us to sign JSON.NET with the Microsoft cert, which is wrong. I see dotnet-user-secrets.csproj also has this wrong. We're not actually using this metadata yet, but will be in the next few weeks.
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<PackAsTool>true</PackAsTool> | ||
<AssemblyName>dotnet-httprepl</AssemblyName> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this shipping as a package to nuget.org, a bundled command in the CLI, or both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, only distribution is planned for NuGet.org, not as a bundled tool with the CLI, but that's really a question for @glennc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan right now is only to ship it on NuGet.org, I expect us to re-examine that decision at some point though.
Bump version of JSON.NET to 11.0.2
4923057
to
7f8f210
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got through like half of the code. Here are some of the things I noticed so far. Some questions, a few pieces of feedback.
It might be nice to set down with Glenn and go over the design a little more. I'm a bit fuzzy on the requirements for the project w.r.t swagger, graphql, interaction with oauth, etc.
build/dependencies.props
Outdated
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion> | ||
<SystemDataSqlClientPackageVersion>4.5.1</SystemDataSqlClientPackageVersion> | ||
<SystemSecurityCryptographyCngPackageVersion>4.5.0</SystemSecurityCryptographyCngPackageVersion> | ||
<CommandLine_NewtonsoftJsonPackageVersion>11.0.2</CommandLine_NewtonsoftJsonPackageVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change the variable name to NewtonsoftJsonPackageVersion
? This will align it with the rest of our automation for managing dependencies.
inputManager.RegisterKeyHandler(ConsoleKey.Tab, Tab); | ||
|
||
//Input manipulation | ||
inputManager.RegisterKeyHandler(ConsoleKey.Escape, Escape); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered also adding other common bash/zsh key mappings? e.g. here are some common ones
- CTRL+U - clear input (equivalent to
Escape
in this mapping) - CTRL+A - go to beginning of input (equivalent to
Home
) - CTRL+E - go to endof input (equivalent to
End
)
shell.ShellState.InputManager.SetInput(shell.ShellState, $"set base \"{args[0]}\""); | ||
await shell.ShellState.CommandDispatcher.ExecuteCommandAsync(shell.ShellState, CancellationToken.None).ConfigureAwait(false); | ||
} | ||
Task result = shell.RunAsync(source.Token); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to check Console.IsOutputRedirected
and exit with an error before launching the shell? I'm assuming piping the repl should never work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
CancellationTokenSource source = new CancellationTokenSource(); | ||
var shell = new Shell(dispatcher); | ||
shell.ShellState.ConsoleManager.AddBreakHandler(() => source.Cancel()); | ||
if (args.Length > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should support a --help
option which prints usage and exits. This is a standard for almost every dotnet command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
} | ||
|
||
#region JSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally dislike regions, so if you don't feel strongly about this, would be nice to remove. But I'm also not a militant anti-region-legion-er so I'll let it slide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm generally pretty anti-region as well, but wanted these out of the way as I was adding more settings, will remove the region
return toResolve; | ||
} | ||
|
||
//public static async Task<JToken> ResolvePointerAsync(this JToken root, HttpClient client, string pointer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a TODO for this block?
} | ||
} | ||
|
||
shellState.ConsoleManager.Error.WriteLine("No matching command found".Red().Bold()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider also printing to output a message like "Execute 'help' to see available commands"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|| contentType.EndsWith("-JAVASCRIPT", StringComparison.OrdinalIgnoreCase) | ||
|| contentType.EndsWith("+JAVASCRIPT", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
if (await FormatJsonAsync(programState, consoleManager, content, bodyFileWriter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can someone disable formatting? It seems like it may be useful to see the actual response, unmodified, with the option to have the repl
pretty-print.
I'm also a little concerned about how this will behave if someone uses the repl to hit an endpoint that dumps a large XML or JSON response.
Hopefully that's not super common, but when someone inevitably downloads a 1000 line JSON file, it's going to bombard console output. Have
we considered using a pager for large responses?
break; | ||
} | ||
|
||
string str = new string(buffer.Span.Slice(0, readTask.Result)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may run into trouble here with encoding and charsets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had thought of this too, with this being the streaming scenario & the end of the chunk being determined by the server, no good ways around it are coming to mind.
Pagination hasn't been dealt with yet mac keybindings may be able to be simplified, pending some additional verification Fix 3rd party signing cert Bind a few common bash/zsh mappings Check for output redirection Make package version variable name consistent Add --help option for the command line Remove regions Remove old pointer resolution code Make command not found message more friendly Fix issue where base address was required for requests to absolute URIs Add options to suppress response formatting and streaming Turn off packing for the REPL project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating in response to PR feedback. You already called out the last concern I have - low test coverage. Before merging, can you file an issue to follow-up on this?
No additional engineering concerns right now. I'll let @glennc sign off on experience review.
@@ -156,6 +156,7 @@ private async Task ExecuteCommandInternalAsync(IShellState shellState, Cancellat | |||
} | |||
|
|||
shellState.ConsoleManager.Error.WriteLine("No matching command found".Red().Bold()); | |||
shellState.ConsoleManager.Error.WriteLine("Execute 'help' to se available commands".Red().Bold()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "to see"
NuGetPackageVerifier.json
Outdated
"Microsoft.AspNetCore.DeveloperCertificates.XPlat": { | ||
"Exclusions": { | ||
"DOC_MISSING": { | ||
"lib/netcoreapp2.2/Microsoft.AspNetCore.DeveloperCertificates.XPlat.dll": "Docs not required to shipoob package" | ||
} | ||
} | ||
}, | ||
"Microsoft.Repl": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this should make builds happy :)
Default to requerying swagger for each exec Auto-set the content-type if not yet set for requests based on swagger Fix swagger UI command Make error and warning colors configurable Allow aliases to be specified in structured input based commands Have delete not require a body Show allowed methods for . and .. Show verbs on the announced path after CD Issue a request on set base and warn if there's a socket error
I believe we're waiting on some additional changes from @glennc around some of the experiences before merging |
Merging per Glenn |
Mainly looking for verification that the build process changes to include the HTTP REPL are correct and that style guidelines are being met
Before merge: