Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
21 changes: 2 additions & 19 deletions scripts/_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down Expand Up @@ -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" \
Expand Down Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions src/cycod/CommandLineCommands/ChatCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public override async Task<object> 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);
Expand Down
86 changes: 86 additions & 0 deletions src/cycod/FunctionCallingTools/GitHubSearchHelperFunctions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;

/// <summary>
/// AI tool wrapper for cycodgr GitHub search CLI
/// </summary>
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<string> 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 = $"<cycodgr command failed>\n{result.StandardError}";
Logger.Error(errorOutput);
return errorOutput;
}

if (result.CompletionState == ProcessCompletionState.TimedOut)
{
var timeoutOutput = $"<cycodgr command timed out after 120 seconds>";
Logger.Warning(timeoutOutput);
return timeoutOutput;
}

return result.StandardOutput;
}
}
2 changes: 1 addition & 1 deletion src/cycodgr/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down