Public/Utilities/Get-EdenServiceCommandList.ps1

function Get-EdenServiceCommandList {
    <#
        .SYNOPSIS
        Gets Eden command metadata.

        .DESCRIPTION
        Gets the metadata for all eden service commands.
    #>

    [CmdletBinding()]
    param(
    )

    $commandsAndFiles = @(

    @{Command="-----EDEN e-e -----";                 Alias="e-e";            Type = "Group";   },

        @{Group = "Eden"; Command="Install-EdenTools";                          Alias="e-eti";          Type = "System";  },
        @{Group = "Eden"; Command="Get-EdenServiceCommands";                    Alias="e-esc";          Type = "System";  },

    @{Command="-----CODING e-c -----";                   Alias="e-c";          Type = "Group";   },

        @{Group = "Coding"; Command="New-EdenSolution";                           Alias="e-csol";       Type = "Template";},
        @{Group = "Coding"; Command="New-EdenSolution -Template";                 Alias="e-csol -t";    Type = "Template";},
        @{Group = "Coding"; Command="New-EdenService";                            Alias="e-cs";         Type = "Template";},
        @{Group = "Coding"; Command="New-EdenService -Template";                  Alias="e-cs -t";      Type = "Template";},
        @{Group = "Coding"; Command="Get-EdenTemplates";                          Alias="e-ct";         Type = "System";  },
        @{Group = "Coding"; Command="Install-EdenTemplates -Source";              Alias="e-ctmp -s";    Type = "System";  },
        @{Group = "Coding"; Command="New-EdenServiceComponent -Type";             Alias="e-cc -ty";     Type = "Special"; },
        @{Group = "Coding"; Command="New-EdenServiceComponent -Template";         Alias="e-cc -t";      Type = "Template";},

    @{Command="-----CODING - STANDARD COMPONENTS e-csc -----";                   Alias="e-csc";        Type = "Group";},

        @{Group = "Coding"; Command="Install-EdenServiceCodingTools";             Alias="e-cscti";      Type = "Standard"; Message = "Installing coding tools."},
        @{Group = "Coding"; Command="Show-EdenServiceCodingTools";                Alias="e-cscts";      Type = "Standard"; Message = "Showing coding tools."},
        @{Group = "Coding"; Command="New-EdenServiceFunction";                    Alias="e-cscf";       Type = "Coding";   Message = "Creating new function."},
        @{Group = "Coding"; Command="New-EdenServiceFunctionRequest";             Alias="e-cscreq";     Type = "Coding";   Message = "Creating new function request."},
        @{Group = "Coding"; Command="New-EdenServiceFunctionResponse";            Alias="e-cscres";     Type = "Coding";   Message = "Creating new function response."},
        @{Group = "Coding"; Command="New-EdenServiceEvent";                       Alias="e-csce";       Type = "Coding";   Message = "Creating new event."},
        @{Group = "Coding"; Command="New-EdenServiceService";                     Alias="e-cscsvc";     Type = "Coding";   Message = "Creating new internal service."},
        @{Group = "Coding"; Command="New-EdenServiceSubscription";                Alias="e-cscsub";     Type = "Coding";   Message = "Creating new subscription."},
        @{Group = "Coding"; Command="New-EdenServiceFeatureTest";                 Alias="e-cscftest";   Type = "Coding";   Message = "Creating new feature test."},

    @{Command="-----BUILDING e-b -----";                     Alias="e-b";        Type = "Group";},

        @{Group = "Building"; Command="Install-EdenServiceBuildTools";              Alias="e-bti";      Type = "Standard"; Message = "Installing build tools."},
        @{Group = "Building"; Command="Build-EdenService";                          Alias="e-bb";       Type = "Standard"; Message = "Building the service."},
        @{Group = "Building"; Command="Build-EdenServiceContinuous";                Alias="e-bbc";      Type = "Standard"; Message = "Building the service continuously."},
        @{Group = "Building"; Command="Show-EdenServiceBuildReport";                Alias="e-bbr";      Type = "Standard"; Message = "Showing build report."},
        @{Group = "Building"; Command="Publish-EdenServiceBuildReport";             Alias="e-bpbr";     Type = "Standard"; Message = "Publish build report."},
        @{Group = "Building"; Command="Show-EdenServiceBuildReportPublished";       Alias="e-bbrp";     Type = "Standard"; Message = "Showing published build report."},
        @{Group = "Building"; Command="Publish-EdenService";                        Alias="e-bp";       Type = "Standard"; Message = "Publishing the service."},

    @{Command="-----TESTING CODE e-tc -----";                       Alias="e-tc";     Type = "Group";},

        @{Group = "Testing Code"; Command="Install-EdenServiceCodeTestTools";         Alias="e-tcti";   Type = "Standard"; Message = "Installing code testing tools."},
        @{Group = "Testing Code"; Command="Test-EdenServiceCode";                     Alias="e-tct";    Type = "Standard"; Message = "Testing the code."},
        @{Group = "Testing Code"; Command="Test-EdenServiceCodeContinuous";           Alias="e-tctc";   Type = "Standard"; Message = "Testing the code continuously."}
        @{Group = "Testing Code"; Command="Show-EdenServiceCodeCoverage";             Alias="e-tccc";   Type = "Standard"; Message = "Showing the code coverage."},
        @{Group = "Testing Code"; Command="Publish-EdenServiceCodeCoverage";          Alias="e-tcpcc";  Type = "Standard"; Message = "Publishing the code coverage results."},
        @{Group = "Testing Code"; Command="Show-EdenServiceCodeCoveragePublished";    Alias="e-tcccp";  Type = "Standard"; Message = "Showing the published code coverage."},
        @{Group = "Testing Code"; Command="Show-EdenServiceCodeTestResults";          Alias="e-tctr";   Type = "Standard"; Message = "Showing the code test results."},
        @{Group = "Testing Code"; Command="Publish-EdenServiceCodeTestResults";       Alias="e-tcptr";  Type = "Standard"; Message = "Publishing the code test results."},
        @{Group = "Testing Code"; Command="Show-EdenServiceCodeTestResultsPublished"; Alias="e-tctrp";  Type = "Standard"; Message = "Showing the published code test results."},

    @{Command="-----SETTINGS e-st -----";                       Alias="e-st";     Type = "Group";},

        @{Group = "Settings"; Command="New-EdenSettings -Name";                       Alias="e-stn -n"; Type = "System";   Message = "Creating the new settings."},
        @{Group = "Settings"; Command="Get-EdenSettings -Name";                       Alias="e-stg -n"; Type = "System";   Message = "Getting the settings."},
        @{Group = "Settings"; Command="Get-EdenSecureSetting -Value";                 Alias="e-stss";   Type = "System";   Message = "Getting the secure setting value."},

    @{Command="-----RUNNING e-r -----";                    Alias="e-r";         Type = "Group";},

        @{Group = "Running"; Command="Install-EdenServiceRunTools";                Alias="e-rti";       Type = "Standard"; Message = "Installing the run time tools."},
        @{Group = "Running"; Command="Start-EdenLocalServiceApplication";          Alias="e-rsa";       Type = "Standard"; Message = "Starting the local service application."},
        @{Group = "Running"; Command="Start-EdenLocalServiceApplicationContinuous";Alias="e-rsac";      Type = "Standard"; Message = "Starting the local service application continuously."},
        @{Group = "Running"; Command="Start-EdenLocalServiceTunnel";               Alias="e-rst";       Type = "Standard"; Message = "Creating the public tunnel to the local application."},
        @{Group = "Running"; Command="Get-EdenLocalServicePublicUrl";              Alias="e-rgu";       Type = "Standard"; Message = "Getting the public url of the local service."},
        @{Group = "Running"; Command="Get-EdenLocalServiceStatus";                 Alias="e-rgs";       Type = "Standard"; Message = "Getting the boolean status of the local service."},
        @{Group = "Running"; Command="Deploy-EdenLocalServiceSubscriptions";       Alias="e-rds";       Type = "Standard"; Message = "Deploying the subscriptions for the local application."},
        @{Group = "Running"; Command="Start-EdenLocalService";                     Alias="e-rs";        Type = "Command";  Commands = @("Start-EdenLocalServiceApplication",
                                                                                                                                        "Start-EdenLocalServiceTunnel",
                                                                                                                                        "Get-EdenLocalServicePublicUrl",
                                                                                                                                        "Get-EdenLocalServiceStatus",
                                                                                                                                        "Deploy-EdenLocalServiceSubscriptions");
                                                                                                                           Message = "Starting the local service."},
        @{Group = "Running"; Command="Start-EdenLocalService -Continuous";         Alias="e-rs -c";     Type = "Command";  Commands = @("Start-EdenLocalServiceApplicationContinuous",
                                                                                                                                        "Start-EdenLocalServiceTunnel",
                                                                                                                                        "Get-EdenLocalServicePublicUrl",
                                                                                                                                        "Get-EdenLocalServiceStatus",
                                                                                                                                        "Deploy-EdenLocalServiceSubscriptions");
                                                                                                                           Message = "Starting the local service continuously."},
        @{Group = "Running"; Command="Show-EdenLocalService";                      Alias="e-rshow";     Type = "Standard"; Message = "Showing the local service."},

    @{Command="-----TESTING FEATURES e-tf -----";                               Alias="e-tf";   Type = "Group";},

        @{Group = "Testing Features"; Command="Install-EdenServiceFeaturesTestTools";         Alias="e-tfti";  Type = "Standard"; Message = "Installing feature testing tools."},
        @{Group = "Testing Features"; Command="Test-EdenServiceFeatures";                     Alias="e-tft";   Type = "Standard"; Message = "Testing features."},
        @{Group = "Testing Features"; Command="Test-EdenServiceFeaturesContinuous";           Alias="e-tftc";  Type = "Standard"; Message = "Testing features continuously."},
        @{Group = "Testing Features"; Command="Show-EdenServiceFeaturesTestResults";          Alias="e-tftr";  Type = "Standard"; Message = "Showing feature test results."},
        @{Group = "Testing Features"; Command="Publish-EdenServiceFeaturesTestResults";       Alias="e-tfptr"; Type = "Standard"; Message = "Publishing feature test results."},
        @{Group = "Testing Features"; Command="Show-EdenServiceFeaturesTestResultsPublished"; Alias="e-tftrp"; Type = "Standard"; Message = "Showing published feature test results."},

    @{Command="-----SOURCE CONROL e-sc -----";                 Alias="e-sc";           Type = "Group";},

        @{Group = "Source Control"; Command="Install-EdenSourceControlTools";   Alias="e-scti";         Type = "Standard"; Message = "Installing source control tools."},
        @{Group = "Source Control"; Command="New-EdenRepo";                     Alias="e-scrn";         Type = "Standard"; Message = "Creating a new repository."},
        @{Group = "Source Control"; Command="Show-EdenChanges";                 Alias="e-scch";         Type = "Standard"; Message = "Showing the source code changes."},
        @{Group = "Source Control"; Command="New-EdenCommit";                   Alias="e-sccn";         Type = "Standard"; Message = "Committing the source code changes."},
        @{Group = "Source Control"; Command="Sync-EdenCommits";                 Alias="e-sccs";         Type = "Standard"; Message = "Syncing the source code commits."},

    @{Command="-----TESTING PERFORMANCE e-tp -----";                                     Alias="e-tp"},

        @{Group = "Testing Performance"; Command="Install-EdenServicePerformanceTestTools";         Alias="e-tpti";  Type = "Standard"; Message = "Installing performance testing tools."},
        @{Group = "Testing Performance"; Command="Test-EdenServicePerformance";                     Alias="e-tpt";   Type = "Standard"; Message = "Testing performance."},
        @{Group = "Testing Performance"; Command="Show-EdenServicePerformanceTestResults";          Alias="e-tptr";  Type = "Standard"; Message = "Showing performance test results."},
        @{Group = "Testing Performance"; Command="Publish-EdenServicePerformanceTestResults";       Alias="e-tpptr"; Type = "Standard"; Message = "Publishing the performance test results."},
        @{Group = "Testing Performance"; Command="Show-EdenServicePerformanceTestResultsPublished"; Alias="e-tptrp"; Type = "Standard"; Message = "Showing published performance test results."},

    @{Command="-----TESTING SECURITY e-ts -----";                               Alias="e-ts";           Type = "Group";},

        @{Group = "Testing Security"; Command="Install-EdenServiceTestSecurityTools";         Alias="e-tsti";  Type = "Standard"; Message = "Installing security testing tools."},
        @{Group = "Testing Security"; Command="Test-EdenServiceSecurity";                     Alias="e-tst";   Type = "Standard"; Message = "Testing security."},
        @{Group = "Testing Security"; Command="Show-EdenServiceSecurityTestResults";          Alias="e-tstr";  Type = "Standard"; Message = "Showing security test results."},
        @{Group = "Testing Security"; Command="Publish-EdenServiceSecurityTestResults";       Alias="e-tsptr"; Type = "Standard"; Message = "Publishing security test results."},
        @{Group = "Testing Security"; Command="Show-EdenServiceSecurityTestResultsPublished"; Alias="e-tstrp"; Type = "Standard"; Message = "Showing published security test results."},

    @{Command="-----DEPLOYING e-d -----";                 Alias="e-dp";   Type = "Group";},

        @{Group = "Deploying"; Command="Install-EdenServiceDeploymentTools";    Alias="e-dpti"; Type = "Standard"; Message = "Installing deployment tools."},
        @{Group = "Deploying"; Command="Deploy-EdenServiceInfrastructure";      Alias="e-dpi";  Type = "Standard"; Message = "Deploying infrastructure."},
        @{Group = "Deploying"; Command="Deploy-EdenServiceApplicationStaging";  Alias="e-dpas"; Type = "Standard"; Message = "Deploying staging application(s)."},
        @{Group = "Deploying"; Command="Test-EdenServiceFeaturesStaging";       Alias="e-dptf"; Type = "Standard"; Message = "Testing features in staging."},
        @{Group = "Deploying"; Command="Test-EdenServiceSecurityStaging";       Alias="e-dpts"; Type = "Standard"; Message = "Testing security in staging."},
        @{Group = "Deploying"; Command="Test-EdenServicePerformanceStaging";    Alias="e-dptp"; Type = "Standard"; Message = "Testing performance in staging."},
        @{Group = "Deploying"; Command="Invoke-EdenServiceStagingSwap";         Alias="e-dpss"; Type = "Standard"; Message = "Swaping staging with production."},
        @{Group = "Deploying"; Command="Deploy-EdenServiceApplication";         Alias="e-dpa";  Type = "Command";  Commands = @("Deploy-EdenServiceApplicationStaging",
                                                                                                                                "Test-EdenServiceFeaturesStaging",
                                                                                                                                "Test-EdenServiceSecurityStaging",
                                                                                                                                "Test-EdenServicePerformanceStaging",
                                                                                                                                "Invoke-ServiceStagingSwap");
                                                                                                                   Message = "Deploying application(s)."},
        @{Group = "Deploying"; Command="Deploy-EdenServiceSubscriptions";       Alias="e-dps";  Type = "Standard"; Message = "Deploying subscriptions."},
        @{Group = "Deploying"; Command="Deploy-EdenService";                    Alias="e-dpd";  Type = "Command";  Commands = @("Deploy-EdenServiceInfrastructure",
                                                                                                                                "Deploy-EdenServiceApplication",
                                                                                                                                "Deploy-EdenServiceSubscriptions");
                                                                                                                   Message = "Deploying service."},
        @{Group = "Deploying"; Command="Show-EdenServiceDeploymentsList";       Alias="e-dpl";  Type = "Standard"; Message = "Showing deployments."},

    @{Command="-----PIPELINE e-pl -----";                 Alias="e-pl";   Type = "Group";},

        @{Group = "Pipeline"; Command="Install-EdenServicePipelineTools";       Alias="e-plti"; Type = "Standard"; Message = "Installing pipeline tools."},
        @{Group = "Pipeline"; Command="New-EdenServicePipeline";                Alias="e-pln";  Type = "Standard"; Message = "Creating pipeline."},
        @{Group = "Pipeline"; Command="Invoke-EdenServicePipeline";             Alias="e-pli";  Type = "Command";  Commands = @("Build-EdenService",
                                                                                                                                "Test-EdenServiceCode",
                                                                                                                                "Publish-EdenService",
                                                                                                                                "Deploy-EdenService");
                                                                                                                   Message = "Invoking pipeline."},
        @{Group = "Pipeline"; Command="Show-EdenServicePipelineReport";         Alias="e-plr";  Type = "Standard"; Message = "Showing pipeline report."},
        @{Group = "Pipeline"; Command="Show-EdenServicePipelineHistory";        Alias="e-plh";  Type = "Standard"; Message = "Showing pipeline history."},

    @{Command="-----OPERATIONS e-o -----";                 Alias="e-o";    Type = "Group";},

        @{Group = "Operations"; Command="Install-EdenServiceOperationsTools";   Alias="e-oti";  Type = "Standard"; Message = "Installing operations tools."},
        @{Group = "Operations"; Command="Show-EdenServiceInfrastructure";       Alias="e-oi";   Type = "Standard"; Message = "Showing service infrastructure."},
        @{Group = "Operations"; Command="Show-EdenServiceMonitor";              Alias="e-om";   Type = "Standard"; Message = "Installing service monitoring."},
        @{Group = "Operations"; Command="Get-EdenServiceHealth";                Alias="e-oh";   Type = "Standard"; Message = "Getting service health."},
        @{Group = "Operations"; Command="Get-EdenServiceStatus";                Alias="e-os";   Type = "Standard"; Message = "Getting service status."},
        @{Group = "Operations"; Command="Get-EdenServiceUrl";                   Alias="e-ou";   Type = "Standard"; Message = "Getting service url."},

    @{Command="-----WORK e-w -----";                 Alias="e-w";    Type = "Group";},

        @{Group = "Work"; Command="Install-EdenServiceWorkTools";               Alias="e-wti";  Type = "Standard"; Message = "Installing work tools."},
        @{Group = "Work"; Command="Show-EdenServiceFeatureRoadMap";             Alias="e-wfrm"; Type = "Standard"; Message = "Showing product roadmap."},
        @{Group = "Work"; Command="Show-EdenServiceFeatureList";                Alias="e-wfl";  Type = "Standard"; Message = "Showing product features."},
        @{Group = "Work"; Command="Show-EdenServiceWorkItemAssignments";        Alias="e-wia";  Type = "Standard"; Message = "Showing working item assignments."},
        @{Group = "Work"; Command="Show-EdenServiceWorkItemList";               Alias="e-wil";  Type = "Standard"; Message = "Showing work item list."},
        @{Group = "Work"; Command="Show-EdenServiceWorkItemBoard";              Alias="e-wib";  Type = "Standard"; Message = "Installing coding tools."},

    @{Command="-----SUPPORT e-su -----";                 Alias="e-su";   Type = "Group";},

        @{Group = "Support"; Command="Install-EdenServiceSupportTools";         Alias="e-suti"; Type = "Standard"; Message = "Installing support tools."},
        @{Group = "Support"; Command="Show-EdenServiceSupportList";             Alias="e-sul";  Type = "Standard"; Message = "Showing support list."},
        @{Group = "Support"; Command="Show-EdenServiceSupportSubmissionForm";   Alias="e-susf"; Type = "Standard"; Message = "Showing support submission form."},

    @{Command="-----DOCUMENTATION e-doc -----";                 Alias="e-doc";  Type = "Group";},

        @{Group = "Documentation"; Command="Install-EdenServiceDocTools";        Alias="e-docti"; Type = "Standard"; Message = "Installing documentation tools."},
        @{Group = "Documentation"; Command="Show-EdenServiceDocs";               Alias="e-docs";  Type = "Standard"; Message = "Showing service docs."},
        @{Group = "Documentation"; Command="Show-EdenServiceDocsFunctional";     Alias="e-docsf"; Type = "Standard"; Message = "Showing service functional docs."},
        @{Group = "Documentation"; Command="Show-EdenServiceDocsReference";      Alias="e-docsr"; Type = "Standard"; Message = "Showing service reference docs."},
        @{Group = "Documentation"; Command="Show-EdenServiceDocsArchitecture";   Alias="e-docsa"; Type = "Standard"; Message = "Showing service architecture docs."},
        @{Group = "Documentation"; Command="Show-EdenServiceDocsInfrastructure"; Alias="e-docsi"; Type = "Standard"; Message = "Showing service infrastructure docs."},
        @{Group = "Documentation"; Command="Show-EdenServiceDocsOperations";     Alias="e-docso"; Type = "Standard"; Message = "Showing service operations docs."},
        @{Group = "Documentation"; Command="Show-EdenServiceDocsTeam";           Alias="e-docst"; Type = "Standard"; Message = "Showing service team docs."},
        @{Group = "Documentation"; Command="Show-EdenServiceDocsChat";           Alias="e-docsc"; Type = "Standard"; Message = "Showing service chat docs."},
        @{Group = "Documentation"; Command="Show-EdenServiceDocsBots";           Alias="e-docsb"; Type = "Standard"; Message = "Showing service bot docs."},

    @{Command="-----UTILITIES e-u -----";                 Alias="e-u";    Type = "Group";},

        @{Group = "Utilities"; Command="Watch-EdenFolder";                      Alias="e-uwf";  Type = "System";},
        @{Group = "Utilities"; Command="Write-EdenInfo";                        Alias="e-uwi";  Type = "System";},
        @{Group = "Utilities"; Command="Write-EdenError";                       Alias="e-uwe";  Type = "System";}
    )

    # Loop through the commands.
    foreach ($command in $commandsAndFiles) {
        $supported = "Yes" # logic assumes the command has the files until it can't find one.
        $missing = @() # keeps an array of the missing files.
        $displayFileList = @() # keeps an array of the files to display to the user.
        if ($command.Type -eq "Group") {
            $command.Supported = "Group"
        } elseif (Get-Command $command.Command.Split()[0] -errorAction SilentlyContinue) { #if the command actuallys exists and is imported
            if ($command.Type -eq "Standard" -or $command.Type -eq "Coding" -or $command.Type -eq "Command") { # If the command is designed to call a local script.
                $file = "./Eden/$($command.Group -replace ' ', '/')/$($command.Command -replace 'Eden', '').ps1"
                $fileFound = (Test-Path $file) # Check whether the file has been created in the local Eden folder.
                if ($fileFound) {
                    $command.Testable = (Get-Command $file).ScriptBlock.Attributes.Where{$_.TypeId.Name -eq 'IsTestableAttribute' }.Count -gt 0
                    if ($command.Testable) {
                        $command.TestSettings = (Get-Command $file).ScriptBlock.Attributes.Where{$_.TypeId.Name -eq 'IsTestableAttribute' }[0].SettingsNameValue
                        $command.TestContinuous = (Get-Command $file).ScriptBlock.Attributes.Where{$_.TypeId.Name -eq 'IsTestableAttribute' }[0].IsContinuousValue
                    }
                }
                $seedFile = "./Eden/$($command.Group -replace ' ', '/')/$($command.Command -replace 'Eden', '').seed.ps1"
                $seedFileFound = (Test-Path $seedFile) # Check whether the file has been created in the local Eden folder.
                $supported = if(!$fileFound) {"No"} else {$supported} # Set supported to false it file not found.
                $supported = if($supported -eq "No" -and $seedFileFound) {"Seeded"} else {$supported}
            }
            if ($command.Type -eq "Command" -and $supported -ne "Yes") { # the the command can use other commands (default logic flow) then reset the supported command to true and the check if each default flow command is supported.
                $supported = "Yes"
                foreach ($commandDependency in $command.Commands) {
                    $commandSupported = ($commandsAndFiles | Where-Object {$_.Command -eq $commandDependency -and $_.Supported -eq $True }).Count -gt 0
                    # If there is not a matching command in the collection that is supported then set supported to false.
                    $supported = if(!$commandSupported) { "No" } else {$supported}
                }
            }
            # Update the command object with whether it is supported.
            $command.Supported = $supported
        } else { # The command has not been implemented in the Eden module.
            $command.Supported = "Future"
        }
    }

    return $commandsAndFiles

}
New-Alias `
    -Name e-escl `
    -Value Get-EdenServiceCommandList `
    -Force