diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7bd4ca4..5cc90f37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: run: ./scripts/build.sh ${{ env.CI_VERSION }} Release - name: Test - run: dotnet test --configuration Release --verbosity normal --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults + run: dotnet test --configuration Release --framework net9.0 --verbosity normal --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults - name: Run cycodt tests run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c45cb276..c2744e2d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,7 @@ jobs: ./scripts/build.sh ${{ env.VERSION }} Release - name: Test - run: dotnet test --configuration Release --verbosity normal --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults + run: dotnet test --configuration Release --framework net9.0 --verbosity normal --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults - name: Run cycodt tests run: | diff --git a/scripts/_functions.sh b/scripts/_functions.sh index 0d02ee4d..f9074f6b 100644 --- a/scripts/_functions.sh +++ b/scripts/_functions.sh @@ -126,6 +126,7 @@ cycod_build_dotnet() { echo "Building $PROJECT..." dotnet build "$PROJECT" \ -c "$CONFIGURATION" \ + --framework net9.0 \ --no-restore \ -p:Version="$VERSION" \ -p:AssemblyVersion="$NUMERIC_VERSION" \ @@ -171,27 +172,8 @@ cycod_pack_dotnet() { for TOOL in "${TOOLS[@]}"; do echo "→ Packing $TOOL" - # First publish for each platform - for RID in "${RIDS[@]}"; do - echo " Publishing for $RID..." - dotnet publish "src/$TOOL/$TOOL.csproj" \ - -c "$CONFIGURATION" \ - -r "$RID" \ - -p:Version="$VERSION" \ - -p:AssemblyVersion="$NUMERIC_VERSION" \ - -p:FileVersion="$NUMERIC_VERSION" \ - -p:InformationalVersion="$VERSION" - - if [ $? -ne 0 ]; then - echo "Error: Failed to publish $TOOL for $RID" - return 1 - fi - done - - # Then create the NuGet package dotnet pack "src/$TOOL/$TOOL.csproj" \ -c "$CONFIGURATION" \ - --no-build \ -p:Version="$VERSION" \ -p:AssemblyVersion="$NUMERIC_VERSION" \ -p:FileVersion="$NUMERIC_VERSION" \ @@ -305,6 +287,7 @@ cycod_publish_self_contained() { # Run the publish command with self-contained and single-file parameters dotnet publish "src/$TOOL/$TOOL.csproj" \ -c "$CONFIGURATION" \ + --framework net9.0 \ -r "$RID" \ --self-contained \ -p:PublishSingleFile=true \ diff --git a/src/cycod/CommandLineCommands/ChatCommand.cs b/src/cycod/CommandLineCommands/ChatCommand.cs index 42425e83..867b5526 100644 --- a/src/cycod/CommandLineCommands/ChatCommand.cs +++ b/src/cycod/CommandLineCommands/ChatCommand.cs @@ -110,6 +110,7 @@ public override async Task ExecuteAsync(bool interactive) factory.AddFunctions(new ImageHelperFunctions(this)); factory.AddFunctions(new ScreenshotHelperFunctions(this)); factory.AddFunctions(new ShellAndProcessHelperFunctions()); + factory.AddFunctions(new GitHubSearchHelperFunctions()); // Add MCP functions if any are configured await AddMcpFunctions(factory); diff --git a/src/cycod/FunctionCallingTools/GitHubSearchHelperFunctions.cs b/src/cycod/FunctionCallingTools/GitHubSearchHelperFunctions.cs new file mode 100644 index 00000000..49bd9cce --- /dev/null +++ b/src/cycod/FunctionCallingTools/GitHubSearchHelperFunctions.cs @@ -0,0 +1,86 @@ +using System; +using System.ComponentModel; +using System.Threading.Tasks; + +/// +/// AI tool wrapper for cycodgr GitHub search CLI +/// +public class GitHubSearchHelperFunctions +{ + [Description(@"Search GitHub repositories and code using the cycodgr CLI. + +This tool provides access to GitHub's search capabilities with powerful filtering options. + +QUICK EXAMPLES: + SearchGitHub(""--contains 'terminal emulator' --max-results 10"") + SearchGitHub(""microsoft/terminal --file-contains 'ConPTY'"") + SearchGitHub(""--repo-contains 'jwt' --language csharp --min-stars 500"") + SearchGitHub(""--file-contains 'OSC 133' --language rust --lines 10"") + +MULTI-LANGUAGE SEARCH: + SearchGitHub(""--file-contains 'async' --language python --max-results 10"") + SearchGitHub(""--file-contains 'ChatClient' --language csharp --language python"") + +REPOSITORY FINGERPRINTING (two-step workflow): + Step 1: SearchGitHub(""--file-contains 'Microsoft.AI' --extension csproj --format repos"") + Result: List of repo names (one per line) + Step 2: SearchGitHub(""microsoft/semantic-kernel microsoft/autogen --file-contains 'ChatClient'"") + +TARGETED SEARCHES: + SearchGitHub(""microsoft/terminal wezterm/wezterm --file-contains 'OSC 133' --lines 10"") + +GET COMPREHENSIVE HELP: + SearchGitHub(""help"") - Full documentation with all options and examples + SearchGitHub(""help examples"") - Usage examples + SearchGitHub(""help filtering"") - Filtering and sorting options + SearchGitHub(""help language shortcuts"") - Language-specific shortcuts + +The help command is automatically expanded to show detailed documentation.")] + public async Task SearchGitHub( + [Description("Command-line arguments to pass to cycodgr. Use 'help' to see all available options and examples.")] + string arguments) + { + // Smart help expansion + if (arguments == "help" || arguments == "--help" || arguments == "-h") + { + arguments = "help topics --expand"; + } + else if (arguments.StartsWith("help ") && !arguments.Contains("--expand")) + { + arguments += " --expand"; + } + + Logger.Info($"Executing cycodgr command: cycodgr {arguments}"); + + if (ConsoleHelpers.IsVerbose()) + { + ConsoleHelpers.WriteLine($"Executing cycodgr command: cycodgr {arguments}"); + } + + // Execute cycodgr command + var processBuilder = new RunnableProcessBuilder() + .WithFileName("cycodgr") + .WithArguments(arguments) + .WithTimeout(120000) // 2 minute timeout for GitHub API calls + .WithVerboseLogging(ConsoleHelpers.IsVerbose()); + + var result = await processBuilder.RunAsync(); + + // Handle errors + if (result.CompletionState == ProcessCompletionState.Error) + { + var errorOutput = $"\n{result.StandardError}"; + Logger.Error(errorOutput); + return errorOutput; + } + + if (result.CompletionState == ProcessCompletionState.TimedOut) + { + var timeoutOutput = $""; + Logger.Warning(timeoutOutput); + return timeoutOutput; + } + + return result.StandardOutput; + } +} diff --git a/src/cycodgr/Program.cs b/src/cycodgr/Program.cs index 8df70efb..b503b58e 100644 --- a/src/cycodgr/Program.cs +++ b/src/cycodgr/Program.cs @@ -103,7 +103,7 @@ private static async Task HandleSearchCommandAsync(CycoGr.CommandLineCommands.Se // Stage 2: Phase E - Dual behavior for --file-contains // If --file-contains is specified WITHOUT repo pre-filtering, use it to find repos first - var hasRepoPreFiltering = !string.IsNullOrEmpty(command.RepoFileContains) || command.Repos.Any(); + var hasRepoPreFiltering = !string.IsNullOrEmpty(command.RepoFileContains) || command.Repos.Any() || command.RepoPatterns.Any(); var hasFileContains = !string.IsNullOrEmpty(command.FileContains); if (hasFileContains && !hasRepoPreFiltering)