From 8f6cf2699a1c7f08ed94b02e8717373274521857 Mon Sep 17 00:00:00 2001 From: Brian Lalonde Date: Sun, 6 Sep 2026 21:27:09 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Remove=20Codesmithy=20cmdlets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Add-VsCodeDatabaseConnection.ps1 | 91 -- Copy-GitHubLabels.ps1 | 71 -- Export-OpenApiSchema.ps1 | 50 - Find-DotNetTools.ps1 | 35 - Get-AssemblyFramework.ps1 | 38 - Get-GitFileMetadata.ps1 | 60 -- Get-GitFirstCommit.ps1 | 23 - Get-GitHubRepoChildItem.ps1 | 131 --- Get-LibraryVulnerabilityInfo.ps1 | 60 -- Get-NuGetConfigs.ps1 | 38 - Get-OpenApiInfo.ps1 | 50 - Get-RepoName.ps1 | 37 - Get-Todos.ps1 | 30 - Get-VSCCurrentFile.ps1 | 26 - Get-VSCodeSetting.ps1 | 53 - Get-VSCodeSettingsFile.ps1 | 89 -- Import-VsCodeDatabaseConnections.ps1 | 61 -- New-Jwt.ps1 | 96 -- Push-WorkspaceLocation.ps1 | 20 - README.md | 161 +--- Rename-GitHubLocalBranch.ps1 | 50 - Repair-ScriptStyle.ps1 | 72 -- Set-VSCodeSetting.ps1 | 50 - Show-DataRef.ps1 | 32 - Show-OpenApiInfo.ps1 | 40 - Test-Jwt.ps1 | 49 - Trace-GitRepoTest.ps1 | 34 - Update-Everything.ps1 | 9 +- docs/Add-GitHubMetadata.ps1.md | 467 --------- docs/Add-NotebookCell.ps1.md | 73 -- docs/Add-VsCodeDatabaseConnection.ps1.md | 144 --- docs/Backup-File.ps1.md | 76 -- docs/Compare-Xml.ps1.md | 165 ---- docs/Connect-SshKey.ps1.md | 86 -- docs/Convert-Xml.ps1.md | 196 ---- docs/ConvertFrom-EscapedXml.ps1.md | 90 -- docs/ConvertFrom-XmlElement.ps1.md | 153 --- docs/ConvertTo-BasicAuthentication.ps1.md | 84 -- docs/ConvertTo-MultipartFormData.ps1.md | 85 -- docs/ConvertTo-XmlElements.ps1.md | 131 --- docs/Copy-GitHubLabels.ps1.md | 150 --- docs/Export-DatabaseScripts.ps1.md | 299 ------ docs/Export-Json.ps1.md | 150 --- docs/Export-MermaidER.ps1.md | 204 ---- docs/Export-OpenApiSchema.ps1.md | 155 --- docs/Export-SecretVault.ps1.md | 96 -- docs/Export-TableMerge.ps1.md | 91 -- docs/Find-DatabaseValue.ps1.md | 193 ---- docs/Find-DbColumn.ps1.md | 193 ---- docs/Find-DbIndexes.ps1.md | 191 ---- docs/Find-DotNetTools.ps1.md | 75 -- docs/Format-Xml.ps1.md | 180 ---- docs/Get-AssemblyFramework.ps1.md | 79 -- docs/Get-CharacterDetails.ps1.md | 911 ------------------ .../Get-ConfigConnectionStringBuilders.ps1.md | 79 -- docs/Get-ContentSecurityPolicy.ps1.md | 106 -- docs/Get-Dns.ps1.md | 98 -- docs/Get-GitFileMetadata.ps1.md | 103 -- docs/Get-GitFirstCommit.ps1.md | 61 -- docs/Get-GitHubRepoChildItem.ps1.md | 224 ----- docs/Get-LibraryVulnerabilityInfo.ps1.md | 106 -- docs/Get-NuGetConfigs.ps1.md | 79 -- docs/Get-OpenApiInfo.ps1.md | 75 -- docs/Get-PocketArticles.ps1.md | 268 ------ docs/Get-RepoName.ps1.md | 72 -- docs/Get-SecretDetails.ps1.md | 65 -- docs/Get-ServerCertificate.ps1.md | 83 -- docs/Get-SslDetails.ps1.md | 109 --- docs/Get-Todos.ps1.md | 57 -- docs/Get-Unicode.ps1.md | 108 --- docs/Get-UnicodeByName.ps1.md | 144 --- docs/Get-UnicodeName.ps1.md | 113 --- docs/Get-VSCCurrentFile.ps1.md | 63 -- docs/Get-VSCodeSetting.ps1.md | 113 --- docs/Get-VSCodeSettingsFile.ps1.md | 93 -- docs/Get-XmlNamespaces.ps1.md | 93 -- docs/Import-CharConstants.ps1.md | 134 --- docs/Import-SecretVault.ps1.md | 174 ---- docs/Import-VsCodeDatabaseConnections.ps1.md | 80 -- docs/Initialize-DatabaseNotebook.ps1.md | 137 --- docs/Measure-DbColumn.ps1.md | 226 ----- docs/Measure-DbColumnValues.ps1.md | 149 --- docs/Measure-DbTable.ps1.md | 149 --- docs/Merge-Json.ps1.md | 107 -- docs/Merge-XmlSelections.ps1.md | 133 --- docs/New-DbProviderObject.ps1.md | 178 ---- docs/New-Jwt.ps1.md | 282 ------ docs/New-NamespaceManager.ps1.md | 79 -- docs/Push-WorkspaceLocation.ps1.md | 65 -- docs/Remove-PocketArticle.ps1.md | 121 --- docs/Rename-GitHubLocalBranch.ps1.md | 111 --- docs/Repair-DatabaseConstraintNames.ps1.md | 138 --- ...Repair-DatabaseUntrustedConstraints.ps1.md | 138 --- docs/Repair-ScriptStyle.ps1.md | 118 --- docs/Resolve-JsonPointer.ps1.md | 164 ---- docs/Resolve-XPath.ps1.md | 87 -- docs/Resolve-XmlSchemaLocation.ps1.md | 111 --- docs/Save-PodcastEpisodes.ps1.md | 166 ---- docs/Save-WebRequest.ps1.md | 150 --- docs/Select-Json.ps1.md | 94 -- docs/Send-SeqEvent.ps1.md | 169 ---- docs/Send-SeqScriptEvent.ps1.md | 157 --- docs/Send-SqlReport.ps1.md | 157 --- docs/Set-Json.ps1.md | 193 ---- docs/Set-VSCodeSetting.ps1.md | 126 --- docs/Show-DataRef.ps1.md | 73 -- docs/Show-HttpStatus.ps1.md | 92 -- docs/Show-OpenApiInfo.ps1.md | 80 -- docs/Test-ConnectionString.ps1.md | 120 --- docs/Test-HttpSecurity.ps1.md | 200 ---- docs/Test-Jwt.ps1.md | 90 -- docs/Test-Xml.ps1.md | 169 ---- docs/Trace-GitRepoTest.ps1.md | 103 -- docs/Trace-WebRequest.ps1.md | 156 --- docs/Use-SeqServer.ps1.md | 90 -- docs/index.md | 157 +-- test/Add-VsCodeDatabaseConnection.Tests.ps1 | 44 - test/Copy-GitHubLabels.Tests.ps1 | 58 -- test/Export-OpenApiSchema.Tests.ps1 | 53 - test/Find-DotNetTools.Tests.ps1 | 25 - test/README.md | 225 +---- test/dependencies.psd1 | 1 + 122 files changed, 97 insertions(+), 14317 deletions(-) delete mode 100644 Add-VsCodeDatabaseConnection.ps1 delete mode 100644 Copy-GitHubLabels.ps1 delete mode 100644 Export-OpenApiSchema.ps1 delete mode 100644 Find-DotNetTools.ps1 delete mode 100644 Get-AssemblyFramework.ps1 delete mode 100644 Get-GitFileMetadata.ps1 delete mode 100644 Get-GitFirstCommit.ps1 delete mode 100644 Get-GitHubRepoChildItem.ps1 delete mode 100644 Get-LibraryVulnerabilityInfo.ps1 delete mode 100644 Get-NuGetConfigs.ps1 delete mode 100644 Get-OpenApiInfo.ps1 delete mode 100644 Get-RepoName.ps1 delete mode 100644 Get-Todos.ps1 delete mode 100644 Get-VSCCurrentFile.ps1 delete mode 100644 Get-VSCodeSetting.ps1 delete mode 100644 Get-VSCodeSettingsFile.ps1 delete mode 100644 Import-VsCodeDatabaseConnections.ps1 delete mode 100644 New-Jwt.ps1 delete mode 100644 Push-WorkspaceLocation.ps1 delete mode 100644 Rename-GitHubLocalBranch.ps1 delete mode 100644 Repair-ScriptStyle.ps1 delete mode 100644 Set-VSCodeSetting.ps1 delete mode 100644 Show-DataRef.ps1 delete mode 100644 Show-OpenApiInfo.ps1 delete mode 100644 Test-Jwt.ps1 delete mode 100644 Trace-GitRepoTest.ps1 delete mode 100644 docs/Add-GitHubMetadata.ps1.md delete mode 100644 docs/Add-NotebookCell.ps1.md delete mode 100644 docs/Add-VsCodeDatabaseConnection.ps1.md delete mode 100644 docs/Backup-File.ps1.md delete mode 100644 docs/Compare-Xml.ps1.md delete mode 100644 docs/Connect-SshKey.ps1.md delete mode 100644 docs/Convert-Xml.ps1.md delete mode 100644 docs/ConvertFrom-EscapedXml.ps1.md delete mode 100644 docs/ConvertFrom-XmlElement.ps1.md delete mode 100644 docs/ConvertTo-BasicAuthentication.ps1.md delete mode 100644 docs/ConvertTo-MultipartFormData.ps1.md delete mode 100644 docs/ConvertTo-XmlElements.ps1.md delete mode 100644 docs/Copy-GitHubLabels.ps1.md delete mode 100644 docs/Export-DatabaseScripts.ps1.md delete mode 100644 docs/Export-Json.ps1.md delete mode 100644 docs/Export-MermaidER.ps1.md delete mode 100644 docs/Export-OpenApiSchema.ps1.md delete mode 100644 docs/Export-SecretVault.ps1.md delete mode 100644 docs/Export-TableMerge.ps1.md delete mode 100644 docs/Find-DatabaseValue.ps1.md delete mode 100644 docs/Find-DbColumn.ps1.md delete mode 100644 docs/Find-DbIndexes.ps1.md delete mode 100644 docs/Find-DotNetTools.ps1.md delete mode 100644 docs/Format-Xml.ps1.md delete mode 100644 docs/Get-AssemblyFramework.ps1.md delete mode 100644 docs/Get-CharacterDetails.ps1.md delete mode 100644 docs/Get-ConfigConnectionStringBuilders.ps1.md delete mode 100644 docs/Get-ContentSecurityPolicy.ps1.md delete mode 100644 docs/Get-Dns.ps1.md delete mode 100644 docs/Get-GitFileMetadata.ps1.md delete mode 100644 docs/Get-GitFirstCommit.ps1.md delete mode 100644 docs/Get-GitHubRepoChildItem.ps1.md delete mode 100644 docs/Get-LibraryVulnerabilityInfo.ps1.md delete mode 100644 docs/Get-NuGetConfigs.ps1.md delete mode 100644 docs/Get-OpenApiInfo.ps1.md delete mode 100644 docs/Get-PocketArticles.ps1.md delete mode 100644 docs/Get-RepoName.ps1.md delete mode 100644 docs/Get-SecretDetails.ps1.md delete mode 100644 docs/Get-ServerCertificate.ps1.md delete mode 100644 docs/Get-SslDetails.ps1.md delete mode 100644 docs/Get-Todos.ps1.md delete mode 100644 docs/Get-Unicode.ps1.md delete mode 100644 docs/Get-UnicodeByName.ps1.md delete mode 100644 docs/Get-UnicodeName.ps1.md delete mode 100644 docs/Get-VSCCurrentFile.ps1.md delete mode 100644 docs/Get-VSCodeSetting.ps1.md delete mode 100644 docs/Get-VSCodeSettingsFile.ps1.md delete mode 100644 docs/Get-XmlNamespaces.ps1.md delete mode 100644 docs/Import-CharConstants.ps1.md delete mode 100644 docs/Import-SecretVault.ps1.md delete mode 100644 docs/Import-VsCodeDatabaseConnections.ps1.md delete mode 100644 docs/Initialize-DatabaseNotebook.ps1.md delete mode 100644 docs/Measure-DbColumn.ps1.md delete mode 100644 docs/Measure-DbColumnValues.ps1.md delete mode 100644 docs/Measure-DbTable.ps1.md delete mode 100644 docs/Merge-Json.ps1.md delete mode 100644 docs/Merge-XmlSelections.ps1.md delete mode 100644 docs/New-DbProviderObject.ps1.md delete mode 100644 docs/New-Jwt.ps1.md delete mode 100644 docs/New-NamespaceManager.ps1.md delete mode 100644 docs/Push-WorkspaceLocation.ps1.md delete mode 100644 docs/Remove-PocketArticle.ps1.md delete mode 100644 docs/Rename-GitHubLocalBranch.ps1.md delete mode 100644 docs/Repair-DatabaseConstraintNames.ps1.md delete mode 100644 docs/Repair-DatabaseUntrustedConstraints.ps1.md delete mode 100644 docs/Repair-ScriptStyle.ps1.md delete mode 100644 docs/Resolve-JsonPointer.ps1.md delete mode 100644 docs/Resolve-XPath.ps1.md delete mode 100644 docs/Resolve-XmlSchemaLocation.ps1.md delete mode 100644 docs/Save-PodcastEpisodes.ps1.md delete mode 100644 docs/Save-WebRequest.ps1.md delete mode 100644 docs/Select-Json.ps1.md delete mode 100644 docs/Send-SeqEvent.ps1.md delete mode 100644 docs/Send-SeqScriptEvent.ps1.md delete mode 100644 docs/Send-SqlReport.ps1.md delete mode 100644 docs/Set-Json.ps1.md delete mode 100644 docs/Set-VSCodeSetting.ps1.md delete mode 100644 docs/Show-DataRef.ps1.md delete mode 100644 docs/Show-HttpStatus.ps1.md delete mode 100644 docs/Show-OpenApiInfo.ps1.md delete mode 100644 docs/Test-ConnectionString.ps1.md delete mode 100644 docs/Test-HttpSecurity.ps1.md delete mode 100644 docs/Test-Jwt.ps1.md delete mode 100644 docs/Test-Xml.ps1.md delete mode 100644 docs/Trace-GitRepoTest.ps1.md delete mode 100644 docs/Trace-WebRequest.ps1.md delete mode 100644 docs/Use-SeqServer.ps1.md delete mode 100644 test/Add-VsCodeDatabaseConnection.Tests.ps1 delete mode 100644 test/Copy-GitHubLabels.Tests.ps1 delete mode 100644 test/Export-OpenApiSchema.Tests.ps1 delete mode 100644 test/Find-DotNetTools.Tests.ps1 diff --git a/Add-VsCodeDatabaseConnection.ps1 b/Add-VsCodeDatabaseConnection.ps1 deleted file mode 100644 index 42eb94fa..00000000 --- a/Add-VsCodeDatabaseConnection.ps1 +++ /dev/null @@ -1,91 +0,0 @@ -<# -.SYNOPSIS -Adds a VS Code MSSQL database connection to the repo. - -.DESCRIPTION -The VSCode MSSQL extension can use saved database connections to connect to for queries, -and this allows adding those to the VSCode settings in the current git repo. - -.INPUTS -Any object with these properties, used to construct a database connection entry: -* ProfileName or Name -* ServerInstance or Server or DataSource -* Database or InitialCatalog -* UserName or UID - -.FUNCTIONALITY -VSCode - -.LINK -https://marketplace.visualstudio.com/items?itemName=ms-mssql.mssql - -.LINK -Get-VSCodeSetting.ps1 - -.LINK -Set-VSCodeSetting.ps1 - -.EXAMPLE -Add-VsCodeDatabaseConnection.ps1 ConnectionName ServerName\instance DatabaseName - -Adds an MSSQL extension trusted connection named ConnectionName that -connects to the server ServerName\instance and database DatabaseName. -#> - -#Requires -Version 3 -[CmdletBinding()][OutputType([void])] Param( -# The name of the connection. -[Parameter(Position=0,Mandatory=$true,ValueFromPipelineByPropertyName=$true)] -[Alias('Name')][string] $ProfileName, -# The name of a server (and optional instance) to connect and use for the query. -[Parameter(Position=1,Mandatory=$true,ValueFromPipelineByPropertyName=$true)] -[Alias('Server','DataSource')][string] $ServerInstance, -# The the database to connect to on the server. -[Parameter(Position=2,Mandatory=$true,ValueFromPipelineByPropertyName=$true)] -[Alias('InitialCatalog')][string] $Database, -<# -The username to connect with. No password will be stored. -If no username is given, a trusted connection will be created. -#> -[Parameter(Position=3,ValueFromPipelineByPropertyName=$true)] -[Alias('UID')][string] $UserName, -# Overwrite an existing profile with the same name. -[switch] $Force -) -Begin -{ - [psobject[]]$connections = Get-VSCodeSetting.ps1 /mssql.connections -Workspace - if(!$connections) {[psobject[]]$connections = @()} -} -Process -{ - if($connections |Where-Object profileName -eq $ProfileName) - { - if($Force) {$connections = $connections |Where-Object profileName -ne $ProfileName} - else {Write-Verbose "Connection '$ProfileName' already exists"; return} - } - $connections += - if($UserName) - {[pscustomobject]@{ - server = $ServerInstance - database = $Database - authenticationType = 'SqlLogin' - profileName = $ProfileName - password = '' - user = $UserName - savePassword = $false - }} - else - {[pscustomobject]@{ - server = $ServerInstance - database = $Database - authenticationType = 'Integrated' - profileName = $ProfileName - password = '' - }} -} -End -{ - $connections |ConvertTo-Json -Compress |Write-Verbose - Set-VSCodeSetting.ps1 /mssql.connections $connections -Workspace -} diff --git a/Copy-GitHubLabels.ps1 b/Copy-GitHubLabels.ps1 deleted file mode 100644 index 7c2484e4..00000000 --- a/Copy-GitHubLabels.ps1 +++ /dev/null @@ -1,71 +0,0 @@ -<# -.SYNOPSIS -Copies configured issue labels from one repo to another. - -.FUNCTIONALITY -Git and GitHub - -.INPUTS -An object with these properties: -* owner or DestinationOwnerName (optional) -* name or DestinationRepositoryName - -.LINK -Get-GitHubLabel - -.LINK -New-GitHubLabel - -.LINK -Set-GitHubLabel - -.LINK -Remove-GitHubLabel - -.EXAMPLE -Copy-GitHubLabels.ps1 -OwnerName brianary -RepositoryName scripts -DestinationRepositoryName webcoder - -Inserts new labels from the brianary/scripts repo to the brianary/webcoder repo, and also -updates attributes like description and color from matching labels in the source. -#> - -#Requires -Version 7 -#Requires -Modules PowerShellForGitHub -[CmdletBinding()] Param( -# The source repository's owner name. -[Parameter(Position=0,Mandatory=$true)][string] $OwnerName, -# The source repository name. -[Parameter(Position=1,Mandatory=$true)][string] $RepositoryName, -# The destination repository's owner name. -[Parameter(ValueFromPipelineByPropertyName=$true)][Alias('owner')][string] $DestinationOwnerName = $OwnerName, -# The destination repository name. -[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][Alias('name')][string] $DestinationRepositoryName, -<# -Determines the copy behavior: -* AddNew: Insert new labels from the source. -* AddAndUpdate: Insert new labels from the source, and also overwrite attributes from matching labels in the source. -* ReplaceAll: Insert new labels from the source, overwrite attributes from matching labels in the source, and delete - any labels that don't exist in the source. -#> -[ValidateSet('AddAndUpdate','AddNew','ReplaceAll')][string] $Mode = 'AddAndUpdate' -) -Begin -{ - [pscustomobject[]] $source = Get-GitHubLabel -OwnerName $OwnerName -RepositoryName $RepositoryName -} -Process -{ - $destination = @{ OwnerName = $DestinationOwnerName; RepositoryName = $DestinationRepositoryName } - [pscustomobject[]] $labels = Get-GitHubLabel @destination - $source |Where-Object LabelName -NotIn $labels.LabelName | - ForEach-Object {New-GitHubLabel @destination -Label $_.name -Color $_.color -Description $_.description} - if($Mode -ne 'AddNew') - { - $source |Where-Object LabelName -In $labels.LabelName | - ForEach-Object {Set-GitHubLabel @destination -Label $_.name -Color $_.color -Description $_.description} - if($Mode -eq 'ReplaceAll') - { - $labels |Where-Object LabelName -NotIn $source.LabelName |Remove-GitHubLabel @destination - } - } -} diff --git a/Export-OpenApiSchema.ps1 b/Export-OpenApiSchema.ps1 deleted file mode 100644 index fdf9b6fa..00000000 --- a/Export-OpenApiSchema.ps1 +++ /dev/null @@ -1,50 +0,0 @@ -<# -.SYNOPSIS -Extracts a JSON schema from an OpenAPI definition. - -.OUTPUTS -System.String of the extracted JSON schema. - -.FUNCTIONALITY -Json - -.LINK -https://www.openapis.org/ - -.LINK -Export-Json - -.LINK -Set-Json - -.EXAMPLE -Export-OpenApiSchema api.json - -Returns the schema of the 200 response of any defined endpoint is returned. - -.EXAMPLE -Export-OpenApiSchema api.json POST /hello -RequestSchema - -Returns the schema of the request body of the POST /hello endpoint. -#> - -[CmdletBinding(DefaultParameterSetName='ResponseStatus')][OutputType([string])] Param( -# The path to the OpenAPI JSON file. -[Parameter(Position=0)][string] $Path, -# The HTTP verb of the endpoint to extract the schema from. -[Parameter(Position=1)][string] $Method = '*', -# The HTTP path of the endpoint to extract the schema from. -[Parameter(Position=2)][Alias('ApiPath')][string] $EndpointPath = '*', -# Indicates that the request schema of the endpoint should be returned. -[Parameter(ParameterSetName='RequestSchema')][Alias('In')][switch] $RequestSchema, -# Indicates the HTTP status code of the response schema of the endpoint that should be returned. -[Parameter(ParameterSetName='ResponseStatus',Position=3)][int] $ResponseStatus = 200 -) -Process -{ - $Method = $Method.ToLowerInvariant() - return ($PSCmdlet.ParameterSetName -eq 'RequestSchema' ` - ? (Export-Json "/paths/$EndpointPath/$Method/parameters/*/schema" -Path $Path) - : (Export-Json "/paths/$EndpointPath/$Method/responses/$ResponseStatus/content/*/schema" -Path $Path) ) | - Set-Json '/$schema' 'http://json-schema.org/draft-04/schema#' -} diff --git a/Find-DotNetTools.ps1 b/Find-DotNetTools.ps1 deleted file mode 100644 index c52bd53e..00000000 --- a/Find-DotNetTools.ps1 +++ /dev/null @@ -1,35 +0,0 @@ -<# -.SYNOPSIS -Returns a list of matching dotnet tools. - -.FUNCTIONALITY -DotNet - -.EXAMPLE -Find-DotNetTools.ps1 interactive |Format-Table -AutoSize - -PackageName Version Authors Downloads Verified ------------ ------- ------- --------- -------- -microsoft.dotnet-interactive 1.0.516401 Microsoft 33682741 True -dotnet-repl 0.1.216 jonsequitur 117599 False -#> - -#Requires -Version 3 -[CmdletBinding()] Param( -# The name of the tool to search for. -[Parameter(Position=0,Mandatory=$true)][string] $Name -) - -Use-Command.ps1 dotnet "$env:ProgramFiles\dotnet\dotnet.exe" -cinst dotnet-sdk - -foreach($line in dotnet tool search $Name |Where-Object {$_ -match '^\S+\s+\d+(?:\.\d+)+\b'}) -{ - $package,$version,$authors,$downloads,$verified = $line -split '\s\s+',5 - [pscustomobject]@{ - PackageName = $package - Version = try{[semver]$version}catch{try{[version]$version}catch{$version}}; - Authors = $authors - Downloads = [long]$downloads - Verified = $verified.Trim() -eq 'x' - } -} diff --git a/Get-AssemblyFramework.ps1 b/Get-AssemblyFramework.ps1 deleted file mode 100644 index d8e120a5..00000000 --- a/Get-AssemblyFramework.ps1 +++ /dev/null @@ -1,38 +0,0 @@ -<# -.SYNOPSIS -Gets the framework version an assembly was compiled for. - -.INPUTS -Objects with System.String properties named Path or FullName. - -.OUTPUTS -System.Management.Automation.PSCustomObject with RuntimeVersion and CompileVersion properties. - -.FUNCTIONALITY -DotNet - -.LINK -https://stackoverflow.com/questions/3460982/determine-net-framework-version-for-dll#25649840 - -.EXAMPLE -Get-AssemblyFramework.ps1 Program.exe - -RuntimeVersion CompileVersion --------------- -------------- -v4.0.30319 .NETFramework,Version=v4.7.2 -#> - -[CmdletBinding()][OutputType([Management.Automation.PSCustomObject])] Param( -# The assembly to get the framework version of. -[Parameter(Position=0,Mandatory=$true,ValueFromPipelineByPropertyName=$true)][Alias('FullName')][string] $Path -) -Process -{ - $assembly = [Reflection.Assembly]::ReflectionOnlyLoadFrom((Resolve-Path $Path)) - [PSCustomObject]@{ - RuntimeVersion = $assembly.ImageRuntimeVersion - CompileVersion = $assembly.CustomAttributes | - Where-Object {$_.AttributeType.Name -eq "TargetFrameworkAttribute" } | - ForEach-Object {$_.ConstructorArguments.value} - } -} diff --git a/Get-GitFileMetadata.ps1 b/Get-GitFileMetadata.ps1 deleted file mode 100644 index 75a37354..00000000 --- a/Get-GitFileMetadata.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -<# -.SYNOPSIS -Returns the creation and last modification metadata for a file in a git repo. - -.FUNCTIONALITY -Git and GitHub - -.LINK -Use-Command.ps1 - -.LINK -Get-ChildItem - -.LINK -Resolve-Path - -.EXAMPLE -Get-GitFileMetadata.ps1 README.md - -Path : .\README.md -CreateCommit : 1fde7af -CreateAuthor : Brian Lalonde -CreateEmail : brianary@example.com -CreateDate : 01/19/2015 11:44:15 -LastCommit : dbe27ba -LastAuthor : Brian Lalonde -LastEmail : brianary@example.com -LastDate : 12/07/2020 20:17:15 -#> - -#Requires -Version 3 -[CmdletBinding()][OutputType([psobject])] Param( -# The path (or paths) to get metadata for. -[Parameter(Position=0,Mandatory=$true,ValueFromPipelineByPropertyName=$true,ValueFromRemainingArguments=$true)] -[string[]] $Path, -# Recurse into subdirectories. -[switch] $Recurse -) -Begin { Use-Command.ps1 git "$env:ProgramFiles\Git\cmd\git.exe" -choco git } -Process -{ - foreach($f in Get-ChildItem $Path -Recurse:$Recurse) - { - $create_commit,$create_author,$create_email,$create_date = - (git log --reverse --format="%h%x09%cn%x09%ae%x09%ai" $f |Select-Object -f 1) -split '\t' - $last_commit,$last_author,$last_email,$last_date = - (git log -1 --format="%h%x09%cn%x09%ae%x09%ai" $f |Select-Object -f 1) -split '\t' - [pscustomobject]@{ - Path = Resolve-Path $f -Relative - CreateCommit = $create_commit - CreateAuthor = $create_author - CreateEmail = $create_email - CreateDate = [datetime]$create_date - LastCommit = $last_commit - LastAuthor = $last_author - LastEmail = $last_email - LastDate = [datetime]$last_date - } - } -} diff --git a/Get-GitFirstCommit.ps1 b/Get-GitFirstCommit.ps1 deleted file mode 100644 index e4a6ef40..00000000 --- a/Get-GitFirstCommit.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -<# -.SYNOPSIS -Gets the SHA-1 hash of the first commit of the current repo. - -.OUTPUTS -System.String containing the SHA-1 hash of this repo's first commit. - -.FUNCTIONALITY -Git and GitHub - -.LINK -Use-Command.ps1 - -.EXAMPLE -Get-GitFirstCommit.ps1 - -1fde7af20e8560c720d42227495e8d15459aafa4 -#> - -#Requires -Version 3 -[CmdletBinding()][OutputType([string])] Param() -Use-Command.ps1 git "$env:ProgramFiles\Git\cmd\git.exe" -choco git -git log --max-parents=0 --format=format:%H HEAD diff --git a/Get-GitHubRepoChildItem.ps1 b/Get-GitHubRepoChildItem.ps1 deleted file mode 100644 index fd5358f9..00000000 --- a/Get-GitHubRepoChildItem.ps1 +++ /dev/null @@ -1,131 +0,0 @@ -<# -.SYNOPSIS -Gets the items and child items in one or more specified locations. - -.EXAMPLE -Get-GitHubRepoChildItem.ps1 -Filter *.csproj -Recurse -File -OwnerName PowerShell -RepositoryName PSScriptAnalyzer |Format-Table name,size,path -AutoSize - -name size path ----- ---- ---- -Engine.csproj 3679 Engine/Engine.csproj -Rules.csproj 2586 Rules/Rules.csproj - -.EXAMPLE -Get-GitHubRepoChildItem.ps1 -Path src -AlternatePath / -Filter LICENSE -File -OwnerName PowerShell -RepositoryName PSScriptAnalyzer - -name : LICENSE -path : LICENSE -sha : cec380d8ef7f7a1ad3ff9ef2356a88a13a78b491 -size : 1089 -url : https://api.github.com/repos/PowerShell/PSScriptAnalyzer/contents/LICENSE?ref=master -html_url : https://github.com/PowerShell/PSScriptAnalyzer/blob/master/LICENSE -git_url : https://api.github.com/repos/PowerShell/PSScriptAnalyzer/git/blobs/cec380d8ef7f7a1ad3ff9ef2356a88a13a78b491 -download_url : https://raw.githubusercontent.com/PowerShell/PSScriptAnalyzer/master/LICENSE -type : file -_links : @{self=https://api.github.com/repos/PowerShell/PSScriptAnalyzer/contents/LICENSE?ref=master; git=https://api.github.com/repos/PowerShell/PSScriptAnalyzer/git/blobs/cec380d8ef7f7a1ad3ff9ef2356a88a13a78b491; html=https://github.com/PowerShell/PSScriptAnalyzer/blob/master/LICENSE} -#> - -#Requires -Version 7 -#Requires -Modules PowerShellForGitHub -[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars','', -Justification='Using a global variable to cache responses, to avoid abusive API iteration.')] -[CmdletBinding()] Param( -# The path for which to retrieve contents. -[Parameter(Position=0)][string] $Path = '', -# Specifies a wildcard pattern to filter matches against. -[string] $Filter = '*', -# Specifies a wildcard pattern to exclude matches against. -[string] $Exclude = '', -# An alternate path to retrieve if the primary Path isn't found. -[string] $AlternatePath, -# Indicates subdirectories should be searched. -[switch] $Recurse, -# Indicates that only files should be returned. -[switch] $File, -# Indicates that only directories should be returned. -[switch] $Directory, -# Owner of the repository. -[Parameter(ValueFromPipelineByPropertyName)][psobject] $OwnerName, -# Name of the repository. -[Parameter(ValueFromPipelineByPropertyName)][Alias('Name')][string] $RepositoryName, -# The branch, or defaults to the default branch of not specified. -[string] $BranchName, -# Ignores any cached result and re-queries the GitHub API. -[switch] $Force -) -Begin -{ - if(!(Get-Variable GitHubRepoContents -Scope Global -ErrorAction SilentlyContinue)) {$Global:GitHubRepoContents = @{}} - function Get-PathContentOrAlternate - { - [CmdletBinding()] Param( - [psobject] $OwnerName, - [string] $RepositoryName, - [string] $Path, - [string] $Branch, - [string] $AlternatePath - ) - [void]$PSBoundParameters.Remove('AlternatePath') - if($Path -in '','.','/') {[void]$PSBoundParameters.Remove('Path')} - try {return Get-GitHubContent @PSBoundParameters} - catch [Microsoft.PowerShell.Commands.HttpResponseException] - { - Write-Verbose "Could not find path $Path in $OwnerName/$RepositoryName" - if($_.Exception.Response.StatusCode -ne 404 -or $AlternatePath -eq $null) {throw} - if($AlternatePath -in '','.','/') {[void]$PSBoundParameters.Remove('Path')} - else {$PSBoundParameters['Path'] = $AlternatePath} - return Get-GitHubContent @PSBoundParameters - } - } -} -Process -{ - Write-Verbose $MyInvocation.Line - if($OwnerName -isnot [string]) {$PSBoundParameters['OwnerName'] = $OwnerName = $OwnerName.UserName} - $repoContext, $searchContext = "$OwnerName/$RepositoryName/$BranchName", - "$Path|$AlternatePath|$Filter|$Exclude|$Recurse|$File|$Directory" - if(!$Global:GitHubRepoContents.ContainsKey($repoContext)) - { - $Global:GitHubRepoContents[$repoContext] = @{} - } - elseif(!$Force -and $Global:GitHubRepoContents[$repoContext].ContainsKey($searchContext)) - { - return $Global:GitHubRepoContents[$repoContext][$searchContext] - } - $entryType = if($File -and $Directory) {''} elseif($File) {'file'} elseif($Directory) {'dir'} else {'*'} - $contentSpec = @{ - OwnerName = $OwnerName - RepositoryName = $RepositoryName - Path = $Path - AlternatePath = $AlternatePath - } - if($BranchName) {$contentSpec += @{BranchName=$BranchName}} - Write-Progress "Searching $OwnerName/$RepositoryName $BranchName" ( $Path ? $Path : '/' ) - if(!$Force -and $Global:GitHubRepoContents[$repoContext].ContainsKey("$Path|$AlternatePath")) - { - $content = $Global:GitHubRepoContents[$repoContext]["$Path|$AlternatePath"] - } - else - { - $content = Get-PathContentOrAlternate @contentSpec - $Global:GitHubRepoContents[$repoContext]["$Path|$AlternatePath"] = $content - } - if($content.type -eq 'file') - { - if($content.type -notlike $entryType -or $content.name -notlike $Filter -or $content.name -like $Exclude) {return} - $Global:GitHubRepoContents[$repoContext][$searchContext] = $content - return $content - } - $found = @($content.entries | - Where-Object {$_.type -like $entryType -and $_.name -like $Filter -and $_.name -notlike $Exclude}) - if($Recurse) - { - $found += @($content.entries | - Where-Object {$_.type -eq 'dir' -and $_.name -notlike $Exclude} | - ForEach-Object {& $PSCommandPath -Path $_.path -Filter $Filter -Exclude $Exclude -Recurse -File:$File ` - -Directory:$Directory -OwnerName $OwnerName -RepositoryName $RepositoryName -BranchName $BranchName}) - } - $Global:GitHubRepoContents[$repoContext][$searchContext] = $found - Write-Progress "Searching $OwnerName/$RepositoryName $BranchName" -Completed - return $found -} diff --git a/Get-LibraryVulnerabilityInfo.ps1 b/Get-LibraryVulnerabilityInfo.ps1 deleted file mode 100644 index 3393b85d..00000000 --- a/Get-LibraryVulnerabilityInfo.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -<# -.SYNOPSIS -Get the list of module/package/library vulnerabilities from the RetireJS or SafeNuGet projects. - -.INPUTS -System.String of a package/module name to search for. - -.OUTPUTS -System.Management.Automation.PSCustomObject with details about any vulnerabilities found. - -.FUNCTIONALITY -Packages and libraries - -.LINK -Invoke-RestMethod - -.LINK -Select-Xml - -.EXAMPLE -Get-LibraryVulnerabilityInfo.ps1 Backbone.js - -atOrAbove below identifiers info ---------- ----- ----------- ---- - 0.5.0 @{release=0.5.0; summary=cross-site scripting vulnerability} {http://backbonejs.org/#changelog} - - -.EXAMPLE -Get-LibraryVulnerabilityInfo.ps1 Backbone.js -Repository nuget - -id before infoUri --- ------ ------- -Backbone.js 0.5.3 http://backbonejs.org/#changelog -#> - -#Requires -Version 3 -[CmdletBinding()][OutputType([Management.Automation.PSCustomObject])] Param( -# The name of the module or package or library to check. -[Parameter(Position=0,Mandatory=$true,ValueFromPipeline=$true)] -[Alias('Module','Package','Library')][string]$Name, -# Whether to check the NPM, JS, or NuGet vulnerability lists. -[ValidateSet('js','npm','nuget')][string]$Repository = 'js' -) -Process -{ - if($Repository -eq 'nuget') - { - Invoke-RestMethod https://raw.githubusercontent.com/OWASP/SafeNuGet/master/feed/unsafepackages.xml | - Select-Xml //package | - Select-Object -ExpandProperty Node | - Where-Object {$_.id -eq $Name} | - ForEach-Object {[pscustomobject]@{id=$_.id;before=$_.before;infoUri=$_.infoUri}} - } - else - { - $lib = Invoke-RestMethod https://raw.githubusercontent.com/RetireJS/retire.js/master/repository/${Repository}repository.json - if($lib.$Name) {$lib.$Name.vulnerabilities |Select-Object atOrAbove,below,identifiers,info} - else {Write-Warning "$Name not found"} - } -} diff --git a/Get-NuGetConfigs.ps1 b/Get-NuGetConfigs.ps1 deleted file mode 100644 index 1770ec28..00000000 --- a/Get-NuGetConfigs.ps1 +++ /dev/null @@ -1,38 +0,0 @@ -<# -.SYNOPSIS -Returns the available NuGet configuration files, in order of preference. - -.OUTPUTS -System.String containing the path to a NuGet config file. - -.FUNCTIONALITY -Configuration - -.LINK -https://docs.myget.org/docs/how-to/nuget-configuration-inheritance - -.EXAMPLE -Get-NuGetConfigs.ps1 - -C:\Users\zaphodb\GitHub\ProjectX\src\nuget.config -C:\Users\zaphodb\AppData\Roaming\NuGet\NuGet.config -C:\ProgramData\NuGet\Config.config -C:\ProgramData\NuGet\NuGetDefaults.config -#> - -#Requires -Version 7 -[CmdletBinding()][OutputType([string])] Param( -# The directory to walk the parents of, to look for configs. -[Parameter(Position=0)][string] $Directory = "$PWD" -) - -function Get-Parent([Parameter(Position=0)][string] $Directory) -{ - if($Directory -eq "$(Join-Path (Split-Path $Directory -Qualifier) '')") {$Directory} - else {$Directory; Get-Parent (Split-Path $Directory)} -} - -Get-Parent $Directory |ForEach-Object {Join-Path $_ nuget.config} |Where-Object {Test-Path $_ -Type Leaf} -Join-Path $env:APPDATA NuGet NuGet.config |Where-Object {Test-Path $_ -Type Leaf} -Join-Path $env:ProgramData NuGet Config*.config |Resolve-Path -ErrorAction Ignore |Sort-Object Length -Descending -Join-Path $env:ProgramData NuGet NuGetDefaults.config |Where-Object {Test-Path $_ -Type Leaf} diff --git a/Get-OpenApiInfo.ps1 b/Get-OpenApiInfo.ps1 deleted file mode 100644 index 65e7a5b6..00000000 --- a/Get-OpenApiInfo.ps1 +++ /dev/null @@ -1,50 +0,0 @@ -<# -.SYNOPSIS -Returns metadata from an OpenAPI definition. - -.FUNCTIONALITY -Json - -.LINK -https://www.openapis.org/ - -.EXAMPLE -Get-OpenApiInfo.ps1 .\test\data\sample-openapi.json - -Source : .\test\data\sample-openapi.json -OpenApi : 3.0.3 -Title : Sample REST API -Description : An example OpenAPI definition. -Version : 1.0.0 -Endpoints : {@{Endpoint=GET /users/{userId}; Summary=Returns a user by ID.; Description=Gets a user's details.}, -| @{Endpoint=POST /users; Summary=Creates a new user.; Description=Adds a user account.}} -#> - -#Requires -Version 7 -[CmdletBinding()] Param( -[Parameter(Position=0,Mandatory=$true,ValueFromPipelineByPropertyName=$true)][Alias('FullName')][string] $Path -) -Process -{ - Get-Content $Path -Raw | - ConvertFrom-Json -AsHashtable | - ForEach-Object {[pscustomobject]@{ - Source = $Path - OpenApi = $_.ContainsKey('openapi') ? $_.openapi : - $_.ContainsKey('swagger') ? $_.swagger : $null - Title = $_.info.title - Description = $_.info.description - Version = $_.info.version - Endpoints = $_.paths.GetEnumerator() |% { - $p = $_.Key - $e = $_.Value - $_.Value.Keys |% { - [pscustomobject]@{ - Endpoint = "$($_.ToUpperInvariant()) $p" - Summary = $e[$_].summary - Description = $e[$_].description - } - } - } - }} -} \ No newline at end of file diff --git a/Get-RepoName.ps1 b/Get-RepoName.ps1 deleted file mode 100644 index 48b71f7f..00000000 --- a/Get-RepoName.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -<# -.SYNOPSIS -Gets the name of the repo. - -.INPUTS -Objects with System.String Path or FullName properties. - -.OUTPUTS -System.String of the repo name (the final segment of the first remote location). - -.FUNCTIONALITY -Git and GitHub - -.EXAMPLE -Get-RepoName.ps1 -#> - -[CmdletBinding()][OutputType([string])] Param( -# The path to the git repo to get the name for. -[Parameter(Position=0,ValueFromPipelineByPropertyName=$true)] -[Alias('FullName')][string] $Path = $PWD.Path -) -Begin { Use-Command.ps1 git "$env:ProgramFiles\Git\cmd\git.exe" -cinst git } -Process -{ - if(!(Test-Path $Path -Type Container)) {ModernConveniences\Stop-ThrowError "The path $Path was not found." -Argument Path} - try - { - Push-Location $Path - git status |Out-Null - if(!$?) {ModernConveniences\Stop-ThrowError "The path $Path is not a git repo."-Argument Path} - $remote = git remote |Select-Object -First 1 - if($remote) {return ([uri](git remote get-url $remote)).Segments[-1] -replace '\.git\z',''} - else {return Split-Path $Path -Leaf} - } - finally {Pop-Location} -} diff --git a/Get-Todos.ps1 b/Get-Todos.ps1 deleted file mode 100644 index 731e0764..00000000 --- a/Get-Todos.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -<# -.SYNOPSIS -Returns the TODOs for the current git repo, which can help document technical debt. - -.EXAMPLE -Get-Todos.ps1 |Out-GridView -Title "$((Get-Item $(git rev-parse --show-toplevel)).Name) TODOs" - -Shows TODOs in this repo. -#> - -#Requires -Version 7 -[CmdletBinding()] Param() - -Push-Location $(git rev-parse --show-toplevel) -Find-Lines.ps1 -Pattern '\bTODO\b' -Filters * -Path ((Test-Path src -Type Container) ? 'src' : '.') -CaseSensitive | - ForEach-Object { - [string[]] $blame = git blame -p -L "$($_.LineNumber),$($_.LineNumber)" -- $_.Path - $author = $blame |Select-String '^author (?.*)$' |ModernConveniences\Select-CapturesFromMatches -ValuesOnly - $Time = $blame |Select-String '^author-time (?