Skip to content

Commit

Permalink
Merge branch 'main' into update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinmvrk authored Nov 21, 2024
2 parents 7c1d482 + 68f90ea commit db2ba75
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ Reply: [y/N]
```
8. Currently, the supported event types for debug mode are references, errors, and confirmations! Have fun chatting with your assistant!


## Using the gh debug stream tool
1. To quickly parse an agent response by running command `gh debug-cli stream --file test.txt`

Expand All @@ -136,10 +135,18 @@ Reply: [y/N]
- In this example, if a file test.txt holds the following streamed response. Then will return the response "A closure in JavaScript is a function that retains access... " This will make repsonse more readable.

example of .txt file

```
data: {"choices":[{"delta":{"content":"A closure in JavaScript "}}],"created":1727120830,"id":"chatcmpl-AAjJW0Nz9E2Gu1P6YQMFqqmn10mdR","model":"gpt-4o-2024-05-13","system_fingerprint":"fp_80a1bad4c7"}
data: {"choices":[{"delta":{"content":"is a function that retains access "}}],"created":1727120831,"id":"chatcmpl-AAjJW0Nz9E2Gu1P6YQMFqqmn10mdR","model":"gpt-4o-2024-05-13","system_fingerprint":"fp_80a1bad4c7"}
data: {"choices":[{"delta":{"content":"to its lexical scope, even "}}],"created":1727120832,"id":"chatcmpl-AAjJW0Nz9E2Gu1P6YQMFqqmn10mdR","model":"gpt-4o-2024-05-13","system_fingerprint":"fp_80a1bad4c7"}
data: {"choices":[{"delta":{"content":"when the function is executed "}}],"created":1727120833,"id":"chatcmpl-AAjJW0Nz9E2Gu1P6YQMFqqmn10mdR","model":"gpt-4o-2024-05-13","system_fingerprint":"fp_80a1bad4c7"}
data: {"choices":[{"delta":{"content":"outside that scope. "}}],"created":1727120834,"id":"chatcmpl-AAjJW0Nz9E2Gu1P6YQMFqqmn10mdR","model":"gpt-4o-2024-05-13","system_fingerprint":"fp_80a1bad4c7"}
```
```

## Copilot Extensions Documentation
- [Using Copilot Extensions](https://docs.github.com/en/copilot/using-github-copilot/using-extensions-to-integrate-external-tools-with-copilot-chat)
- [About building Copilot Extensions](https://docs.github.com/en/copilot/building-copilot-extensions/about-building-copilot-extensions)
- [Set up process](https://docs.github.com/en/copilot/building-copilot-extensions/setting-up-copilot-extensions)
- [Communicating with the Copilot platform](https://docs.github.com/en/copilot/building-copilot-extensions/building-a-copilot-agent-for-your-copilot-extension/configuring-your-copilot-agent-to-communicate-with-the-copilot-platform)
- [Communicating with GitHub](https://docs.github.com/en/copilot/building-copilot-extensions/building-a-copilot-agent-for-your-copilot-extension/configuring-your-copilot-agent-to-communicate-with-github)
2 changes: 0 additions & 2 deletions cmd/rootCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import (
)

var rootCmd = &cobra.Command{
Use: "gh-debug-cli",
Short: "A CLI tool for debugging",
Long: `This CLI tool allows you to debug your agent by chatting with it locally.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Use 'gh-debug-cli --help' to see available commands")
},
}

Expand Down
12 changes: 8 additions & 4 deletions cmd/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const (

// streamCmd represents the new command for streaming functionality
var streamCmd = &cobra.Command{
Use: "stream [file]",
Short: "Stream data to your agent",
Long: `The stream command allows you to initiate a data stream to your agent.`,
Use: "stream --file [filename]",
Short: "Parse stream data from agent",
Long: `Allows you to parse a data stream to your agent response.`,
Run: agentStream,
}

Expand All @@ -28,7 +28,11 @@ func init() {
func agentStream(cmd *cobra.Command, args []string) {
fmt.Println("stream command executed successfully")

file := args[0]
file, _ := cmd.Flags().GetString(streamCmdFileFlag)
if file == "" {
fmt.Fprintln(os.Stderr, "Error: --file [file] is required")
os.Exit(1)
}

result, err := stream.ParseFile(file)
if err != nil {
Expand Down

0 comments on commit db2ba75

Please sign in to comment.