From d75cfce3e73e31a98086e64d3ddbe3943b196d05 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:05:55 +0000 Subject: [PATCH 1/6] Initial plan From d5fab5e9afbc90228f8b83bbd27025d3d3b09ee0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:14:06 +0000 Subject: [PATCH 2/6] Initial exploration complete Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/unbloat-docs.lock.yml | 2 +- pkg/workflow/schemas/github-workflow.json | 76 ++++++++++++++++++++--- 2 files changed, 68 insertions(+), 10 deletions(-) diff --git a/.github/workflows/unbloat-docs.lock.yml b/.github/workflows/unbloat-docs.lock.yml index 07e4b38944..0c8bd30d6b 100644 --- a/.github/workflows/unbloat-docs.lock.yml +++ b/.github/workflows/unbloat-docs.lock.yml @@ -846,7 +846,7 @@ jobs: - name: Checkout repository uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 with: cache: npm cache-dependency-path: docs/package-lock.json diff --git a/pkg/workflow/schemas/github-workflow.json b/pkg/workflow/schemas/github-workflow.json index 6b93ceff0b..160824c1de 100644 --- a/pkg/workflow/schemas/github-workflow.json +++ b/pkg/workflow/schemas/github-workflow.json @@ -983,9 +983,19 @@ "$ref": "#/definitions/types", "items": { "type": "string", - "enum": ["created", "rerequested", "completed", "requested_action"] + "enum": [ + "created", + "rerequested", + "completed", + "requested_action" + ] }, - "default": ["created", "rerequested", "completed", "requested_action"] + "default": [ + "created", + "rerequested", + "completed", + "requested_action" + ] } } }, @@ -1197,7 +1207,13 @@ "type": "string", "enum": ["created", "closed", "opened", "edited", "deleted"] }, - "default": ["created", "closed", "opened", "edited", "deleted"] + "default": [ + "created", + "closed", + "opened", + "edited", + "deleted" + ] } } }, @@ -1215,9 +1231,23 @@ "$ref": "#/definitions/types", "items": { "type": "string", - "enum": ["created", "updated", "closed", "reopened", "edited", "deleted"] + "enum": [ + "created", + "updated", + "closed", + "reopened", + "edited", + "deleted" + ] }, - "default": ["created", "updated", "closed", "reopened", "edited", "deleted"] + "default": [ + "created", + "updated", + "closed", + "reopened", + "edited", + "deleted" + ] } } }, @@ -1230,9 +1260,21 @@ "$ref": "#/definitions/types", "items": { "type": "string", - "enum": ["created", "moved", "converted", "edited", "deleted"] + "enum": [ + "created", + "moved", + "converted", + "edited", + "deleted" + ] }, - "default": ["created", "moved", "converted", "edited", "deleted"] + "default": [ + "created", + "moved", + "converted", + "edited", + "deleted" + ] } } }, @@ -1516,9 +1558,25 @@ "$ref": "#/definitions/types", "items": { "type": "string", - "enum": ["published", "unpublished", "created", "edited", "deleted", "prereleased", "released"] + "enum": [ + "published", + "unpublished", + "created", + "edited", + "deleted", + "prereleased", + "released" + ] }, - "default": ["published", "unpublished", "created", "edited", "deleted", "prereleased", "released"] + "default": [ + "published", + "unpublished", + "created", + "edited", + "deleted", + "prereleased", + "released" + ] } } }, From 50ea48cf4bda047cb332af6d368b9dfb7bb77cc5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:23:14 +0000 Subject: [PATCH 3/6] Convert create-agentic-workflow.prompt.md to custom agent format - Created new agent template at pkg/cli/templates/create-agentic-workflow.agent.md - Agent uses proper frontmatter with 'name', 'description', and 'tools' fields - Updated init command to create agent file instead of prompt file - Init command now removes old prompt file if it exists - Updated all tests to reflect the new agent file structure - Updated documentation in init_command.go and success messages - All unit tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/cli/add_command.go | 32 +++- pkg/cli/agentic_workflow_prompt_test.go | 97 ++++++++---- pkg/cli/commands.go | 4 +- pkg/cli/compile_instructions_test.go | 16 +- pkg/cli/copilot-prompts.go | 50 +++++++ pkg/cli/init.go | 21 ++- pkg/cli/init_command.go | 5 +- pkg/cli/init_test.go | 14 +- .../create-agentic-workflow.agent.md | 141 ++++++++++++++++++ 9 files changed, 327 insertions(+), 53 deletions(-) create mode 100644 pkg/cli/templates/create-agentic-workflow.agent.md diff --git a/pkg/cli/add_command.go b/pkg/cli/add_command.go index 138ed3890f..c37e484b43 100644 --- a/pkg/cli/add_command.go +++ b/pkg/cli/add_command.go @@ -671,9 +671,37 @@ func ensureCopilotInstructions(verbose bool, skipInstructions bool) error { return nil } -// ensureAgenticWorkflowPrompt ensures that .github/prompts/create-agentic-workflow.prompt.md contains the agentic workflow creation prompt +// ensureAgenticWorkflowPrompt removes the old agentic workflow prompt file if it exists func ensureAgenticWorkflowPrompt(verbose bool, skipInstructions bool) error { - return ensurePromptFromTemplate("create-agentic-workflow.prompt.md", agenticWorkflowPromptTemplate, verbose, skipInstructions) + // This function now removes the old prompt file since we've migrated to agent format + if skipInstructions { + return nil + } + + gitRoot, err := findGitRoot() + if err != nil { + return err // Not in a git repository, skip + } + + promptsDir := filepath.Join(gitRoot, ".github", "prompts") + oldPromptPath := filepath.Join(promptsDir, "create-agentic-workflow.prompt.md") + + // Check if the old prompt file exists and remove it + if _, err := os.Stat(oldPromptPath); err == nil { + if err := os.Remove(oldPromptPath); err != nil { + return fmt.Errorf("failed to remove old prompt file: %w", err) + } + if verbose { + fmt.Printf("Removed old prompt file: %s\n", oldPromptPath) + } + } + + return nil +} + +// ensureAgenticWorkflowAgent ensures that .github/agents/create-agentic-workflow.agent.md contains the agentic workflow creation agent +func ensureAgenticWorkflowAgent(verbose bool, skipInstructions bool) error { + return ensureAgentFromTemplate("create-agentic-workflow.agent.md", agenticWorkflowAgentTemplate, verbose, skipInstructions) } // ensureSharedAgenticWorkflowPrompt ensures that .github/prompts/create-shared-agentic-workflow.prompt.md contains the shared workflow creation prompt diff --git a/pkg/cli/agentic_workflow_prompt_test.go b/pkg/cli/agentic_workflow_prompt_test.go index 32f5f71543..1b3d1ee6ba 100644 --- a/pkg/cli/agentic_workflow_prompt_test.go +++ b/pkg/cli/agentic_workflow_prompt_test.go @@ -8,26 +8,26 @@ import ( "testing" ) -func TestEnsureAgenticWorkflowPrompt(t *testing.T) { +func TestEnsureAgenticWorkflowAgent(t *testing.T) { tests := []struct { name string existingContent string expectedContent string }{ { - name: "creates new agentic workflow prompt file", + name: "creates new agentic workflow agent file", existingContent: "", - expectedContent: strings.TrimSpace(agenticWorkflowPromptTemplate), + expectedContent: strings.TrimSpace(agenticWorkflowAgentTemplate), }, { name: "does not modify existing correct file", - existingContent: agenticWorkflowPromptTemplate, - expectedContent: strings.TrimSpace(agenticWorkflowPromptTemplate), + existingContent: agenticWorkflowAgentTemplate, + expectedContent: strings.TrimSpace(agenticWorkflowAgentTemplate), }, { name: "updates modified file", - existingContent: "# Modified Agentic Workflow Prompt\n\nThis is a modified version.", - expectedContent: strings.TrimSpace(agenticWorkflowPromptTemplate), + existingContent: "# Modified Agentic Workflow Agent\n\nThis is a modified version.", + expectedContent: strings.TrimSpace(agenticWorkflowAgentTemplate), }, } @@ -51,34 +51,34 @@ func TestEnsureAgenticWorkflowPrompt(t *testing.T) { t.Fatalf("Failed to init git repo: %v", err) } - promptsDir := filepath.Join(tempDir, ".github", "prompts") - agenticWorkflowPromptPath := filepath.Join(promptsDir, "create-agentic-workflow.prompt.md") + agentsDir := filepath.Join(tempDir, ".github", "agents") + agenticWorkflowAgentPath := filepath.Join(agentsDir, "create-agentic-workflow.agent.md") // Create initial content if specified if tt.existingContent != "" { - if err := os.MkdirAll(promptsDir, 0755); err != nil { - t.Fatalf("Failed to create prompts directory: %v", err) + if err := os.MkdirAll(agentsDir, 0755); err != nil { + t.Fatalf("Failed to create agents directory: %v", err) } - if err := os.WriteFile(agenticWorkflowPromptPath, []byte(tt.existingContent), 0644); err != nil { - t.Fatalf("Failed to create initial agentic workflow prompt: %v", err) + if err := os.WriteFile(agenticWorkflowAgentPath, []byte(tt.existingContent), 0644); err != nil { + t.Fatalf("Failed to create initial agentic workflow agent: %v", err) } } // Call the function with skipInstructions=false to test the functionality - err = ensureAgenticWorkflowPrompt(false, false) + err = ensureAgenticWorkflowAgent(false, false) if err != nil { - t.Fatalf("ensureAgenticWorkflowPrompt() returned error: %v", err) + t.Fatalf("ensureAgenticWorkflowAgent() returned error: %v", err) } // Check that file exists - if _, err := os.Stat(agenticWorkflowPromptPath); os.IsNotExist(err) { - t.Fatalf("Expected agentic workflow prompt file to exist") + if _, err := os.Stat(agenticWorkflowAgentPath); os.IsNotExist(err) { + t.Fatalf("Expected agentic workflow agent file to exist") } // Check content - content, err := os.ReadFile(agenticWorkflowPromptPath) + content, err := os.ReadFile(agenticWorkflowAgentPath) if err != nil { - t.Fatalf("Failed to read agentic workflow prompt: %v", err) + t.Fatalf("Failed to read agentic workflow agent: %v", err) } contentStr := strings.TrimSpace(string(content)) @@ -93,7 +93,7 @@ func TestEnsureAgenticWorkflowPrompt(t *testing.T) { } } -func TestEnsureAgenticWorkflowPrompt_WithSkipInstructionsTrue(t *testing.T) { +func TestEnsureAgenticWorkflowAgent_WithSkipInstructionsTrue(t *testing.T) { // Create a temporary directory for testing tempDir := t.TempDir() @@ -113,15 +113,62 @@ func TestEnsureAgenticWorkflowPrompt_WithSkipInstructionsTrue(t *testing.T) { } // Call the function with skipInstructions=true - err = ensureAgenticWorkflowPrompt(false, true) + err = ensureAgenticWorkflowAgent(false, true) if err != nil { - t.Fatalf("ensureAgenticWorkflowPrompt() returned error: %v", err) + t.Fatalf("ensureAgenticWorkflowAgent() returned error: %v", err) } // Check that file was NOT created + agentsDir := filepath.Join(tempDir, ".github", "agents") + agenticWorkflowAgentPath := filepath.Join(agentsDir, "create-agentic-workflow.agent.md") + if _, err := os.Stat(agenticWorkflowAgentPath); !os.IsNotExist(err) { + t.Fatalf("Expected agentic workflow agent file to NOT exist when skipInstructions=true") + } +} + +func TestEnsureAgenticWorkflowPrompt_RemovesOldFile(t *testing.T) { + // Create a temporary directory for testing + tempDir := t.TempDir() + + // Change to temp directory and initialize git repo for findGitRoot to work + oldWd, _ := os.Getwd() + defer func() { + _ = os.Chdir(oldWd) + }() + err := os.Chdir(tempDir) + if err != nil { + t.Fatalf("Failed to change directory: %v", err) + } + + // Initialize git repo + if err := exec.Command("git", "init").Run(); err != nil { + t.Fatalf("Failed to init git repo: %v", err) + } + + // Create the old prompt file promptsDir := filepath.Join(tempDir, ".github", "prompts") - agenticWorkflowPromptPath := filepath.Join(promptsDir, "create-agentic-workflow.prompt.md") - if _, err := os.Stat(agenticWorkflowPromptPath); !os.IsNotExist(err) { - t.Fatalf("Expected agentic workflow prompt file to NOT exist when skipInstructions=true") + oldPromptPath := filepath.Join(promptsDir, "create-agentic-workflow.prompt.md") + + if err := os.MkdirAll(promptsDir, 0755); err != nil { + t.Fatalf("Failed to create prompts directory: %v", err) + } + if err := os.WriteFile(oldPromptPath, []byte("old content"), 0644); err != nil { + t.Fatalf("Failed to create old prompt file: %v", err) + } + + // Verify old file exists + if _, err := os.Stat(oldPromptPath); os.IsNotExist(err) { + t.Fatalf("Old prompt file should exist before test") + } + + // Call the function to remove old prompt + err = ensureAgenticWorkflowPrompt(false, false) + if err != nil { + t.Fatalf("ensureAgenticWorkflowPrompt() returned error: %v", err) + } + + // Check that old file was removed + if _, err := os.Stat(oldPromptPath); !os.IsNotExist(err) { + t.Fatalf("Expected old prompt file to be removed") } } diff --git a/pkg/cli/commands.go b/pkg/cli/commands.go index e67d2248b1..e53aa467cf 100644 --- a/pkg/cli/commands.go +++ b/pkg/cli/commands.go @@ -22,8 +22,8 @@ var ( //go:embed templates/github-agentic-workflows.instructions.md var copilotInstructionsTemplate string -//go:embed templates/create-agentic-workflow.prompt.md -var agenticWorkflowPromptTemplate string +//go:embed templates/create-agentic-workflow.agent.md +var agenticWorkflowAgentTemplate string //go:embed templates/create-shared-agentic-workflow.prompt.md var sharedAgenticWorkflowPromptTemplate string diff --git a/pkg/cli/compile_instructions_test.go b/pkg/cli/compile_instructions_test.go index e313afb121..52afc1b84d 100644 --- a/pkg/cli/compile_instructions_test.go +++ b/pkg/cli/compile_instructions_test.go @@ -67,7 +67,7 @@ This is a test workflow for compilation. // Define paths for instruction files copilotInstructionsPath := filepath.Join(tempDir, ".github", "instructions", "github-agentic-workflows.instructions.md") - agenticWorkflowPromptPath := filepath.Join(tempDir, ".github", "prompts", "create-agentic-workflow.prompt.md") + agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.agent.md") sharedAgenticWorkflowPromptPath := filepath.Join(tempDir, ".github", "prompts", "create-shared-agentic-workflow.prompt.md") // Compile the workflow @@ -102,12 +102,12 @@ This is a test workflow for compilation. t.Errorf("Expected copilot instructions file NOT to exist, but it was created at %s", copilotInstructionsPath) } - if _, err := os.Stat(agenticWorkflowPromptPath); !os.IsNotExist(err) { - t.Errorf("Expected agentic workflow prompt file NOT to exist, but it was created at %s", agenticWorkflowPromptPath) + if _, err := os.Stat(agenticWorkflowAgentPath); !os.IsNotExist(err) { + t.Errorf("Expected agentic workflow agent file NOT to exist, but it was created at %s", agenticWorkflowAgentPath) } if _, err := os.Stat(sharedAgenticWorkflowPromptPath); !os.IsNotExist(err) { - t.Errorf("Expected shared agentic workflow prompt file NOT to exist, but it was created at %s", sharedAgenticWorkflowPromptPath) + t.Errorf("Expected shared agentic workflow agent file NOT to exist, but it was created at %s", sharedAgenticWorkflowPromptPath) } } @@ -171,7 +171,7 @@ This is a test workflow for compilation. // Define paths for instruction files copilotInstructionsPath := filepath.Join(tempDir, ".github", "instructions", "github-agentic-workflows.instructions.md") - agenticWorkflowPromptPath := filepath.Join(tempDir, ".github", "prompts", "create-agentic-workflow.prompt.md") + agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.agent.md") sharedAgenticWorkflowPromptPath := filepath.Join(tempDir, ".github", "prompts", "create-shared-agentic-workflow.prompt.md") // Compile all workflows (no specific files) @@ -207,11 +207,11 @@ This is a test workflow for compilation. t.Errorf("Expected copilot instructions file NOT to exist, but it was created at %s", copilotInstructionsPath) } - if _, err := os.Stat(agenticWorkflowPromptPath); !os.IsNotExist(err) { - t.Errorf("Expected agentic workflow prompt file NOT to exist, but it was created at %s", agenticWorkflowPromptPath) + if _, err := os.Stat(agenticWorkflowAgentPath); !os.IsNotExist(err) { + t.Errorf("Expected agentic workflow agent file NOT to exist, but it was created at %s", agenticWorkflowAgentPath) } if _, err := os.Stat(sharedAgenticWorkflowPromptPath); !os.IsNotExist(err) { - t.Errorf("Expected shared agentic workflow prompt file NOT to exist, but it was created at %s", sharedAgenticWorkflowPromptPath) + t.Errorf("Expected shared agentic workflow agent file NOT to exist, but it was created at %s", sharedAgenticWorkflowPromptPath) } } diff --git a/pkg/cli/copilot-prompts.go b/pkg/cli/copilot-prompts.go index 61fd87ae1a..5ad7df1a6f 100644 --- a/pkg/cli/copilot-prompts.go +++ b/pkg/cli/copilot-prompts.go @@ -56,3 +56,53 @@ func ensurePromptFromTemplate(promptFileName, templateContent string, verbose bo return nil } + +// ensureAgentFromTemplate ensures that an agent file exists and matches the embedded template +func ensureAgentFromTemplate(agentFileName, templateContent string, verbose bool, skipInstructions bool) error { + if skipInstructions { + return nil // Skip writing agent if flag is set + } + + gitRoot, err := findGitRoot() + if err != nil { + return err // Not in a git repository, skip + } + + agentsDir := filepath.Join(gitRoot, ".github", "agents") + agentPath := filepath.Join(agentsDir, agentFileName) + + // Ensure the .github/agents directory exists + if err := os.MkdirAll(agentsDir, 0755); err != nil { + return fmt.Errorf("failed to create .github/agents directory: %w", err) + } + + // Check if the agent file already exists and matches the template + existingContent := "" + if content, err := os.ReadFile(agentPath); err == nil { + existingContent = string(content) + } + + // Check if content matches our expected template + expectedContent := strings.TrimSpace(templateContent) + if strings.TrimSpace(existingContent) == expectedContent { + if verbose { + fmt.Printf("Agent is up-to-date: %s\n", agentPath) + } + return nil + } + + // Write the agent file + if err := os.WriteFile(agentPath, []byte(templateContent), 0644); err != nil { + return fmt.Errorf("failed to write agent file: %w", err) + } + + if verbose { + if existingContent == "" { + fmt.Printf("Created agent: %s\n", agentPath) + } else { + fmt.Printf("Updated agent: %s\n", agentPath) + } + } + + return nil +} diff --git a/pkg/cli/init.go b/pkg/cli/init.go index ae81b32cf0..d067db2d43 100644 --- a/pkg/cli/init.go +++ b/pkg/cli/init.go @@ -42,14 +42,21 @@ func InitRepository(verbose bool, mcp bool) error { fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Created GitHub Copilot instructions")) } - // Write agentic workflow prompt - initLog.Print("Writing agentic workflow prompt") + // Remove old agentic workflow prompt if it exists + initLog.Print("Removing old agentic workflow prompt") if err := ensureAgenticWorkflowPrompt(verbose, false); err != nil { - initLog.Printf("Failed to write agentic workflow prompt: %v", err) - return fmt.Errorf("failed to write agentic workflow prompt: %w", err) + initLog.Printf("Failed to remove old agentic workflow prompt: %v", err) + return fmt.Errorf("failed to remove old agentic workflow prompt: %w", err) + } + + // Write agentic workflow agent + initLog.Print("Writing agentic workflow agent") + if err := ensureAgenticWorkflowAgent(verbose, false); err != nil { + initLog.Printf("Failed to write agentic workflow agent: %v", err) + return fmt.Errorf("failed to write agentic workflow agent: %w", err) } if verbose { - fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Created /create-agentic-workflow command")) + fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Created custom agent for workflow creation")) } // Write shared agentic workflow prompt @@ -105,9 +112,9 @@ func InitRepository(verbose bool, mcp bool) error { fmt.Fprintln(os.Stderr, console.FormatInfoMessage("✓ GitHub Copilot Agent MCP integration configured")) fmt.Fprintln(os.Stderr, "") } - fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Start a chat and copy the following prompt to create a new workflow:")) + fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Start a chat and use the custom agent to create a new workflow:")) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, " activate @.github/prompts/create-agentic-workflow.prompt.md") + fmt.Fprintln(os.Stderr, " @.github/agents/create-agentic-workflow.agent.md") fmt.Fprintln(os.Stderr, "") fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Or add workflows from the catalog: "+constants.CLIExtensionPrefix+" add ")) fmt.Fprintln(os.Stderr, "") diff --git a/pkg/cli/init_command.go b/pkg/cli/init_command.go index 5422f51ff4..d9eefa9502 100644 --- a/pkg/cli/init_command.go +++ b/pkg/cli/init_command.go @@ -19,14 +19,15 @@ func NewInitCommand() *cobra.Command { This command: - Configures .gitattributes to mark .lock.yml files as generated - Creates GitHub Copilot custom instructions at .github/instructions/github-agentic-workflows.instructions.md -- Creates the /create-agentic-workflow prompt at .github/prompts/create-agentic-workflow.prompt.md +- Creates the custom agent for workflow creation at .github/agents/create-agentic-workflow.agent.md +- Removes the old /create-agentic-workflow prompt if it exists With --mcp flag: - Creates .github/workflows/copilot-setup-steps.yml with gh-aw installation steps - Creates .vscode/mcp.json with gh-aw MCP server configuration After running this command, you can: -- Use GitHub Copilot Chat with /create-agentic-workflow to create workflows interactively +- Use GitHub Copilot Chat with @.github/agents/create-agentic-workflow.agent.md to create workflows interactively - Add workflows from the catalog with: ` + constants.CLIExtensionPrefix + ` add - Create new workflows from scratch with: ` + constants.CLIExtensionPrefix + ` new diff --git a/pkg/cli/init_test.go b/pkg/cli/init_test.go index 1c8a1a5420..ff911605b3 100644 --- a/pkg/cli/init_test.go +++ b/pkg/cli/init_test.go @@ -78,10 +78,10 @@ func TestInitRepository(t *testing.T) { t.Errorf("Expected copilot instructions file to exist") } - // Verify agentic workflow prompt was created - agenticWorkflowPromptPath := filepath.Join(tempDir, ".github", "prompts", "create-agentic-workflow.prompt.md") - if _, err := os.Stat(agenticWorkflowPromptPath); os.IsNotExist(err) { - t.Errorf("Expected agentic workflow prompt file to exist") + // Verify agentic workflow agent was created + agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.agent.md") + if _, err := os.Stat(agenticWorkflowAgentPath); os.IsNotExist(err) { + t.Errorf("Expected agentic workflow agent file to exist") } // Verify .gitattributes contains the correct entry @@ -141,9 +141,9 @@ func TestInitRepository_Idempotent(t *testing.T) { t.Errorf("Expected copilot instructions file to exist after second call") } - agenticWorkflowPromptPath := filepath.Join(tempDir, ".github", "prompts", "create-agentic-workflow.prompt.md") - if _, err := os.Stat(agenticWorkflowPromptPath); os.IsNotExist(err) { - t.Errorf("Expected agentic workflow prompt file to exist after second call") + agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.agent.md") + if _, err := os.Stat(agenticWorkflowAgentPath); os.IsNotExist(err) { + t.Errorf("Expected agentic workflow agent file to exist after second call") } } diff --git a/pkg/cli/templates/create-agentic-workflow.agent.md b/pkg/cli/templates/create-agentic-workflow.agent.md new file mode 100644 index 0000000000..12bec76552 --- /dev/null +++ b/pkg/cli/templates/create-agentic-workflow.agent.md @@ -0,0 +1,141 @@ +--- +name: create-agentic-workflow +description: Design agentic workflows using GitHub Agentic Workflows (gh-aw) extension with interactive guidance on triggers, tools, and security best practices. +tools: + - runInTerminal + - getTerminalOutput + - createFile + - createDirectory + - editFiles + - search + - changes + - githubRepo +--- + +This file will configure the agent into a mode to create agentic workflows. Read the ENTIRE content of this file carefully before proceeding. Follow the instructions precisely. + +# GitHub Agentic Workflow Designer + +You are an assistant specialized in **GitHub Agentic Workflows (gh-aw)**. +Your job is to help the user create secure and valid **agentic workflows** in this repository, using the already-installed gh-aw CLI extension. + +You are a conversational chat agent that interacts with the user to gather requirements and iteratively builds the workflow. Don't overwhelm the user with too many questions at once or long bullet points; always ask the user to express their intent in their own words and translate it in an agent workflow. + +- Do NOT tell me what you did until I ask you to as a question to the user. + +## Writing Style + +You format your questions and responses similarly to the GitHub Copilot CLI chat style. Here is an example of copilot cli output that you can mimic: +You love to use emojis to make the conversation more engaging. + +## Capabilities & Responsibilities + +**Read the gh-aw instructions** + +- Always consult the **instructions file** for schema and features: + - Local copy: @.github/instructions/github-agentic-workflows.instructions.md + - Canonical upstream: https://raw.githubusercontent.com/githubnext/gh-aw/main/pkg/cli/templates/instructions.md +- Key commands: + - `gh aw compile` → compile all workflows + - `gh aw compile ` → compile one workflow + - `gh aw compile --strict` → compile with strict mode validation (recommended for production) + - `gh aw compile --purge` → remove stale lock files + +## Starting the conversation + +1. **Initial Decision** + Start by asking the user: + - What do you want to automate today? + +That's it, no more text. Wait for the user to respond. + +2. **Interact and Clarify** + +Analyze the user's response and map it to agentic workflows. Ask clarifying questions as needed, such as: + + - What should trigger the workflow (`on:` — e.g., issues, pull requests, schedule, slash command)? + - What should the agent do (comment, triage, create PR, fetch API data, etc.)? + - ⚠️ If you think the task requires **network access beyond localhost**, explicitly ask about configuring the top-level `network:` allowlist (ecosystems like `node`, `python`, `playwright`, or specific domains). + - 💡 If you detect the task requires **browser automation**, suggest the **`playwright`** tool. + +**Scheduling Best Practices:** + - 📅 When creating a **daily scheduled workflow**, pick a random hour. + - 🚫 **Avoid weekend scheduling**: For daily workflows, use `cron: "0 * * 1-5"` to run only on weekdays (Monday-Friday) instead of `* * *` which includes weekends. + - Example daily schedule avoiding weekends: `cron: "0 14 * * 1-5"` (2 PM UTC, weekdays only) + +DO NOT ask all these questions at once; instead, engage in a back-and-forth conversation to gather the necessary details. + +4. **Tools & MCP Servers** + - Detect which tools are needed based on the task. Examples: + - API integration → `github` (with fine-grained `allowed`), `web-fetch`, `web-search`, `jq` (via `bash`) + - Browser automation → `playwright` + - Media manipulation → `ffmpeg` (installed via `steps:`) + - Code parsing/analysis → `ast-grep`, `codeql` (installed via `steps:`) + - When a task benefits from reusable/external capabilities, design a **Model Context Protocol (MCP) server**. + - For each tool / MCP server: + - Explain why it's needed. + - Declare it in **`tools:`** (for built-in tools) or in **`mcp-servers:`** (for MCP servers). + - If a tool needs installation (e.g., Playwright, FFmpeg), add install commands in the workflow **`steps:`** before usage. + - For MCP inspection/listing details in workflows, use: + - `gh aw mcp inspect` (and flags like `--server`, `--tool`) to analyze configured MCP servers and tool availability. + + ### Correct tool snippets (reference) + + **GitHub tool with fine-grained allowances**: + ```yaml + tools: + github: + allowed: + - add_issue_comment + - update_issue + - create_issue + ``` + + **General tools (editing, fetching, searching, bash patterns, Playwright)**: + ```yaml + tools: + edit: # File editing + web-fetch: # Web content fetching + web-search: # Web search + bash: # Shell commands (whitelist patterns) + - "gh label list:*" + - "gh label view:*" + - "git status" + playwright: # Browser automation + ``` + + **MCP servers (top-level block)**: + ```yaml + mcp-servers: + my-custom-server: + command: "node" + args: ["path/to/mcp-server.js"] + allowed: + - custom_function_1 + - custom_function_2 + ``` + +5. **Generate Workflows** + - Author workflows in the **agentic markdown format** (frontmatter: `on:`, `permissions:`, `engine:`, `tools:`, `mcp-servers:`, `safe-outputs:`, `network:`, etc.). + - Compile with `gh aw compile` to produce `.github/workflows/.lock.yml`. + - 💡 If the task benefits from **caching** (repeated model calls, large context reuse), suggest top-level **`cache-memory:`**. + - ⚙️ Default to **`engine: copilot`** unless the user requests another engine. + - Apply security best practices: + - Default to `permissions: read-all` and expand only if necessary. + - Prefer `safe-outputs` (`create-issue`, `add-comment`, `create-pull-request`, `create-pull-request-review-comment`, `update-issue`) over granting write perms. + - Constrain `network:` to the minimum required ecosystems/domains. + - Use sanitized expressions (`${{ needs.activation.outputs.text }}`) instead of raw event text. + +6. **Final words** + + - After completing the workflow, inform the user: + - The workflow has been created and compiled successfully. + - Commit and push the changes to activate it. + +## Guidelines + +- Only edit the current agentic wokflow file, no other files. +- Use the `gh aw compile --strict` command to validate syntax. +- Always follow security best practices (least privilege, safe outputs, constrained network). +- The body of the markdown file is a prompt so use best practices for prompt engineering to format the body. +- skip the summary at the end, keep it short. From feb6045d8c102690a9178686965b7a3abf81202a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:26:16 +0000 Subject: [PATCH 4/6] Delete old prompt files and update Makefile sync - Moved .github/prompts/create-agentic-workflow.prompt.md to .github/agents/create-agentic-workflow.agent.md - Updated Makefile sync-templates to copy agent file instead of prompt file - Removed old template file pkg/cli/templates/create-agentic-workflow.prompt.md - All tests passing with new file structure Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../create-agentic-workflow.agent.md} | 14 +- Makefile | 2 +- .../create-agentic-workflow.prompt.md | 133 ------------------ 3 files changed, 12 insertions(+), 137 deletions(-) rename .github/{prompts/create-agentic-workflow.prompt.md => agents/create-agentic-workflow.agent.md} (96%) delete mode 100644 pkg/cli/templates/create-agentic-workflow.prompt.md diff --git a/.github/prompts/create-agentic-workflow.prompt.md b/.github/agents/create-agentic-workflow.agent.md similarity index 96% rename from .github/prompts/create-agentic-workflow.prompt.md rename to .github/agents/create-agentic-workflow.agent.md index f2aff576e7..12bec76552 100644 --- a/.github/prompts/create-agentic-workflow.prompt.md +++ b/.github/agents/create-agentic-workflow.agent.md @@ -1,7 +1,15 @@ --- +name: create-agentic-workflow description: Design agentic workflows using GitHub Agentic Workflows (gh-aw) extension with interactive guidance on triggers, tools, and security best practices. -tools: ['runInTerminal', 'getTerminalOutput', 'createFile', 'createDirectory', 'editFiles', 'search', 'changes', 'githubRepo'] -model: GPT-5 +tools: + - runInTerminal + - getTerminalOutput + - createFile + - createDirectory + - editFiles + - search + - changes + - githubRepo --- This file will configure the agent into a mode to create agentic workflows. Read the ENTIRE content of this file carefully before proceeding. Follow the instructions precisely. @@ -130,4 +138,4 @@ DO NOT ask all these questions at once; instead, engage in a back-and-forth conv - Use the `gh aw compile --strict` command to validate syntax. - Always follow security best practices (least privilege, safe outputs, constrained network). - The body of the markdown file is a prompt so use best practices for prompt engineering to format the body. -- skip the summary at the end, keep it short. \ No newline at end of file +- skip the summary at the end, keep it short. diff --git a/Makefile b/Makefile index 569f2dc4b3..f662f4c899 100644 --- a/Makefile +++ b/Makefile @@ -204,7 +204,7 @@ sync-templates: @echo "Syncing templates from .github to pkg/cli/templates..." @mkdir -p pkg/cli/templates @cp .github/instructions/github-agentic-workflows.instructions.md pkg/cli/templates/ - @cp .github/prompts/create-agentic-workflow.prompt.md pkg/cli/templates/ + @cp .github/agents/create-agentic-workflow.agent.md pkg/cli/templates/ @cp .github/prompts/create-shared-agentic-workflow.prompt.md pkg/cli/templates/ @cp .github/prompts/setup-agentic-workflows.prompt.md pkg/cli/templates/ @echo "✓ Templates synced successfully" diff --git a/pkg/cli/templates/create-agentic-workflow.prompt.md b/pkg/cli/templates/create-agentic-workflow.prompt.md deleted file mode 100644 index f2aff576e7..0000000000 --- a/pkg/cli/templates/create-agentic-workflow.prompt.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -description: Design agentic workflows using GitHub Agentic Workflows (gh-aw) extension with interactive guidance on triggers, tools, and security best practices. -tools: ['runInTerminal', 'getTerminalOutput', 'createFile', 'createDirectory', 'editFiles', 'search', 'changes', 'githubRepo'] -model: GPT-5 ---- - -This file will configure the agent into a mode to create agentic workflows. Read the ENTIRE content of this file carefully before proceeding. Follow the instructions precisely. - -# GitHub Agentic Workflow Designer - -You are an assistant specialized in **GitHub Agentic Workflows (gh-aw)**. -Your job is to help the user create secure and valid **agentic workflows** in this repository, using the already-installed gh-aw CLI extension. - -You are a conversational chat agent that interacts with the user to gather requirements and iteratively builds the workflow. Don't overwhelm the user with too many questions at once or long bullet points; always ask the user to express their intent in their own words and translate it in an agent workflow. - -- Do NOT tell me what you did until I ask you to as a question to the user. - -## Writing Style - -You format your questions and responses similarly to the GitHub Copilot CLI chat style. Here is an example of copilot cli output that you can mimic: -You love to use emojis to make the conversation more engaging. - -## Capabilities & Responsibilities - -**Read the gh-aw instructions** - -- Always consult the **instructions file** for schema and features: - - Local copy: @.github/instructions/github-agentic-workflows.instructions.md - - Canonical upstream: https://raw.githubusercontent.com/githubnext/gh-aw/main/pkg/cli/templates/instructions.md -- Key commands: - - `gh aw compile` → compile all workflows - - `gh aw compile ` → compile one workflow - - `gh aw compile --strict` → compile with strict mode validation (recommended for production) - - `gh aw compile --purge` → remove stale lock files - -## Starting the conversation - -1. **Initial Decision** - Start by asking the user: - - What do you want to automate today? - -That's it, no more text. Wait for the user to respond. - -2. **Interact and Clarify** - -Analyze the user's response and map it to agentic workflows. Ask clarifying questions as needed, such as: - - - What should trigger the workflow (`on:` — e.g., issues, pull requests, schedule, slash command)? - - What should the agent do (comment, triage, create PR, fetch API data, etc.)? - - ⚠️ If you think the task requires **network access beyond localhost**, explicitly ask about configuring the top-level `network:` allowlist (ecosystems like `node`, `python`, `playwright`, or specific domains). - - 💡 If you detect the task requires **browser automation**, suggest the **`playwright`** tool. - -**Scheduling Best Practices:** - - 📅 When creating a **daily scheduled workflow**, pick a random hour. - - 🚫 **Avoid weekend scheduling**: For daily workflows, use `cron: "0 * * 1-5"` to run only on weekdays (Monday-Friday) instead of `* * *` which includes weekends. - - Example daily schedule avoiding weekends: `cron: "0 14 * * 1-5"` (2 PM UTC, weekdays only) - -DO NOT ask all these questions at once; instead, engage in a back-and-forth conversation to gather the necessary details. - -4. **Tools & MCP Servers** - - Detect which tools are needed based on the task. Examples: - - API integration → `github` (with fine-grained `allowed`), `web-fetch`, `web-search`, `jq` (via `bash`) - - Browser automation → `playwright` - - Media manipulation → `ffmpeg` (installed via `steps:`) - - Code parsing/analysis → `ast-grep`, `codeql` (installed via `steps:`) - - When a task benefits from reusable/external capabilities, design a **Model Context Protocol (MCP) server**. - - For each tool / MCP server: - - Explain why it's needed. - - Declare it in **`tools:`** (for built-in tools) or in **`mcp-servers:`** (for MCP servers). - - If a tool needs installation (e.g., Playwright, FFmpeg), add install commands in the workflow **`steps:`** before usage. - - For MCP inspection/listing details in workflows, use: - - `gh aw mcp inspect` (and flags like `--server`, `--tool`) to analyze configured MCP servers and tool availability. - - ### Correct tool snippets (reference) - - **GitHub tool with fine-grained allowances**: - ```yaml - tools: - github: - allowed: - - add_issue_comment - - update_issue - - create_issue - ``` - - **General tools (editing, fetching, searching, bash patterns, Playwright)**: - ```yaml - tools: - edit: # File editing - web-fetch: # Web content fetching - web-search: # Web search - bash: # Shell commands (whitelist patterns) - - "gh label list:*" - - "gh label view:*" - - "git status" - playwright: # Browser automation - ``` - - **MCP servers (top-level block)**: - ```yaml - mcp-servers: - my-custom-server: - command: "node" - args: ["path/to/mcp-server.js"] - allowed: - - custom_function_1 - - custom_function_2 - ``` - -5. **Generate Workflows** - - Author workflows in the **agentic markdown format** (frontmatter: `on:`, `permissions:`, `engine:`, `tools:`, `mcp-servers:`, `safe-outputs:`, `network:`, etc.). - - Compile with `gh aw compile` to produce `.github/workflows/.lock.yml`. - - 💡 If the task benefits from **caching** (repeated model calls, large context reuse), suggest top-level **`cache-memory:`**. - - ⚙️ Default to **`engine: copilot`** unless the user requests another engine. - - Apply security best practices: - - Default to `permissions: read-all` and expand only if necessary. - - Prefer `safe-outputs` (`create-issue`, `add-comment`, `create-pull-request`, `create-pull-request-review-comment`, `update-issue`) over granting write perms. - - Constrain `network:` to the minimum required ecosystems/domains. - - Use sanitized expressions (`${{ needs.activation.outputs.text }}`) instead of raw event text. - -6. **Final words** - - - After completing the workflow, inform the user: - - The workflow has been created and compiled successfully. - - Commit and push the changes to activate it. - -## Guidelines - -- Only edit the current agentic wokflow file, no other files. -- Use the `gh aw compile --strict` command to validate syntax. -- Always follow security best practices (least privilege, safe outputs, constrained network). -- The body of the markdown file is a prompt so use best practices for prompt engineering to format the body. -- skip the summary at the end, keep it short. \ No newline at end of file From 2f3f9ffb88ba710a0a0f188a05810f2b949f06e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:56:27 +0000 Subject: [PATCH 5/6] Run formatting and fix tests - Fixed trailing whitespace in agentic_workflow_prompt_test.go - Reformatted JSON arrays in github-workflow.json schema - All tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/cli/agentic_workflow_prompt_test.go | 2 +- pkg/workflow/schemas/github-workflow.json | 76 +++-------------------- 2 files changed, 10 insertions(+), 68 deletions(-) diff --git a/pkg/cli/agentic_workflow_prompt_test.go b/pkg/cli/agentic_workflow_prompt_test.go index 1b3d1ee6ba..1d9fa7b58c 100644 --- a/pkg/cli/agentic_workflow_prompt_test.go +++ b/pkg/cli/agentic_workflow_prompt_test.go @@ -148,7 +148,7 @@ func TestEnsureAgenticWorkflowPrompt_RemovesOldFile(t *testing.T) { // Create the old prompt file promptsDir := filepath.Join(tempDir, ".github", "prompts") oldPromptPath := filepath.Join(promptsDir, "create-agentic-workflow.prompt.md") - + if err := os.MkdirAll(promptsDir, 0755); err != nil { t.Fatalf("Failed to create prompts directory: %v", err) } diff --git a/pkg/workflow/schemas/github-workflow.json b/pkg/workflow/schemas/github-workflow.json index 160824c1de..6b93ceff0b 100644 --- a/pkg/workflow/schemas/github-workflow.json +++ b/pkg/workflow/schemas/github-workflow.json @@ -983,19 +983,9 @@ "$ref": "#/definitions/types", "items": { "type": "string", - "enum": [ - "created", - "rerequested", - "completed", - "requested_action" - ] + "enum": ["created", "rerequested", "completed", "requested_action"] }, - "default": [ - "created", - "rerequested", - "completed", - "requested_action" - ] + "default": ["created", "rerequested", "completed", "requested_action"] } } }, @@ -1207,13 +1197,7 @@ "type": "string", "enum": ["created", "closed", "opened", "edited", "deleted"] }, - "default": [ - "created", - "closed", - "opened", - "edited", - "deleted" - ] + "default": ["created", "closed", "opened", "edited", "deleted"] } } }, @@ -1231,23 +1215,9 @@ "$ref": "#/definitions/types", "items": { "type": "string", - "enum": [ - "created", - "updated", - "closed", - "reopened", - "edited", - "deleted" - ] + "enum": ["created", "updated", "closed", "reopened", "edited", "deleted"] }, - "default": [ - "created", - "updated", - "closed", - "reopened", - "edited", - "deleted" - ] + "default": ["created", "updated", "closed", "reopened", "edited", "deleted"] } } }, @@ -1260,21 +1230,9 @@ "$ref": "#/definitions/types", "items": { "type": "string", - "enum": [ - "created", - "moved", - "converted", - "edited", - "deleted" - ] + "enum": ["created", "moved", "converted", "edited", "deleted"] }, - "default": [ - "created", - "moved", - "converted", - "edited", - "deleted" - ] + "default": ["created", "moved", "converted", "edited", "deleted"] } } }, @@ -1558,25 +1516,9 @@ "$ref": "#/definitions/types", "items": { "type": "string", - "enum": [ - "published", - "unpublished", - "created", - "edited", - "deleted", - "prereleased", - "released" - ] + "enum": ["published", "unpublished", "created", "edited", "deleted", "prereleased", "released"] }, - "default": [ - "published", - "unpublished", - "created", - "edited", - "deleted", - "prereleased", - "released" - ] + "default": ["published", "unpublished", "created", "edited", "deleted", "prereleased", "released"] } } }, From 5553402b9635a719d7660523ac46c049399a77c6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 31 Oct 2025 03:01:30 +0000 Subject: [PATCH 6/6] Rename agent file from .agent.md to .md extension - Renamed .github/agents/create-agentic-workflow.agent.md to create-agentic-workflow.md - Renamed pkg/cli/templates/create-agentic-workflow.agent.md to create-agentic-workflow.md - Updated all references in code, tests, and Makefile - Custom agent files in .github/agents don't need .agent.md extension, just .md - Matches convention used by existing technical-doc-writer.md agent - All tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- ...e-agentic-workflow.agent.md => create-agentic-workflow.md} | 0 Makefile | 2 +- pkg/cli/add_command.go | 4 ++-- pkg/cli/agentic_workflow_prompt_test.go | 4 ++-- pkg/cli/commands.go | 2 +- pkg/cli/compile_instructions_test.go | 4 ++-- pkg/cli/init.go | 2 +- pkg/cli/init_command.go | 4 ++-- pkg/cli/init_test.go | 4 ++-- ...e-agentic-workflow.agent.md => create-agentic-workflow.md} | 0 10 files changed, 13 insertions(+), 13 deletions(-) rename .github/agents/{create-agentic-workflow.agent.md => create-agentic-workflow.md} (100%) rename pkg/cli/templates/{create-agentic-workflow.agent.md => create-agentic-workflow.md} (100%) diff --git a/.github/agents/create-agentic-workflow.agent.md b/.github/agents/create-agentic-workflow.md similarity index 100% rename from .github/agents/create-agentic-workflow.agent.md rename to .github/agents/create-agentic-workflow.md diff --git a/Makefile b/Makefile index f662f4c899..e47e897c5c 100644 --- a/Makefile +++ b/Makefile @@ -204,7 +204,7 @@ sync-templates: @echo "Syncing templates from .github to pkg/cli/templates..." @mkdir -p pkg/cli/templates @cp .github/instructions/github-agentic-workflows.instructions.md pkg/cli/templates/ - @cp .github/agents/create-agentic-workflow.agent.md pkg/cli/templates/ + @cp .github/agents/create-agentic-workflow.md pkg/cli/templates/ @cp .github/prompts/create-shared-agentic-workflow.prompt.md pkg/cli/templates/ @cp .github/prompts/setup-agentic-workflows.prompt.md pkg/cli/templates/ @echo "✓ Templates synced successfully" diff --git a/pkg/cli/add_command.go b/pkg/cli/add_command.go index c37e484b43..bc05c07819 100644 --- a/pkg/cli/add_command.go +++ b/pkg/cli/add_command.go @@ -699,9 +699,9 @@ func ensureAgenticWorkflowPrompt(verbose bool, skipInstructions bool) error { return nil } -// ensureAgenticWorkflowAgent ensures that .github/agents/create-agentic-workflow.agent.md contains the agentic workflow creation agent +// ensureAgenticWorkflowAgent ensures that .github/agents/create-agentic-workflow.md contains the agentic workflow creation agent func ensureAgenticWorkflowAgent(verbose bool, skipInstructions bool) error { - return ensureAgentFromTemplate("create-agentic-workflow.agent.md", agenticWorkflowAgentTemplate, verbose, skipInstructions) + return ensureAgentFromTemplate("create-agentic-workflow.md", agenticWorkflowAgentTemplate, verbose, skipInstructions) } // ensureSharedAgenticWorkflowPrompt ensures that .github/prompts/create-shared-agentic-workflow.prompt.md contains the shared workflow creation prompt diff --git a/pkg/cli/agentic_workflow_prompt_test.go b/pkg/cli/agentic_workflow_prompt_test.go index 1d9fa7b58c..03d6cdbbe4 100644 --- a/pkg/cli/agentic_workflow_prompt_test.go +++ b/pkg/cli/agentic_workflow_prompt_test.go @@ -52,7 +52,7 @@ func TestEnsureAgenticWorkflowAgent(t *testing.T) { } agentsDir := filepath.Join(tempDir, ".github", "agents") - agenticWorkflowAgentPath := filepath.Join(agentsDir, "create-agentic-workflow.agent.md") + agenticWorkflowAgentPath := filepath.Join(agentsDir, "create-agentic-workflow.md") // Create initial content if specified if tt.existingContent != "" { @@ -120,7 +120,7 @@ func TestEnsureAgenticWorkflowAgent_WithSkipInstructionsTrue(t *testing.T) { // Check that file was NOT created agentsDir := filepath.Join(tempDir, ".github", "agents") - agenticWorkflowAgentPath := filepath.Join(agentsDir, "create-agentic-workflow.agent.md") + agenticWorkflowAgentPath := filepath.Join(agentsDir, "create-agentic-workflow.md") if _, err := os.Stat(agenticWorkflowAgentPath); !os.IsNotExist(err) { t.Fatalf("Expected agentic workflow agent file to NOT exist when skipInstructions=true") } diff --git a/pkg/cli/commands.go b/pkg/cli/commands.go index e53aa467cf..51a472f2ee 100644 --- a/pkg/cli/commands.go +++ b/pkg/cli/commands.go @@ -22,7 +22,7 @@ var ( //go:embed templates/github-agentic-workflows.instructions.md var copilotInstructionsTemplate string -//go:embed templates/create-agentic-workflow.agent.md +//go:embed templates/create-agentic-workflow.md var agenticWorkflowAgentTemplate string //go:embed templates/create-shared-agentic-workflow.prompt.md diff --git a/pkg/cli/compile_instructions_test.go b/pkg/cli/compile_instructions_test.go index 52afc1b84d..ad1953ee35 100644 --- a/pkg/cli/compile_instructions_test.go +++ b/pkg/cli/compile_instructions_test.go @@ -67,7 +67,7 @@ This is a test workflow for compilation. // Define paths for instruction files copilotInstructionsPath := filepath.Join(tempDir, ".github", "instructions", "github-agentic-workflows.instructions.md") - agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.agent.md") + agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.md") sharedAgenticWorkflowPromptPath := filepath.Join(tempDir, ".github", "prompts", "create-shared-agentic-workflow.prompt.md") // Compile the workflow @@ -171,7 +171,7 @@ This is a test workflow for compilation. // Define paths for instruction files copilotInstructionsPath := filepath.Join(tempDir, ".github", "instructions", "github-agentic-workflows.instructions.md") - agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.agent.md") + agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.md") sharedAgenticWorkflowPromptPath := filepath.Join(tempDir, ".github", "prompts", "create-shared-agentic-workflow.prompt.md") // Compile all workflows (no specific files) diff --git a/pkg/cli/init.go b/pkg/cli/init.go index d067db2d43..fe4053007b 100644 --- a/pkg/cli/init.go +++ b/pkg/cli/init.go @@ -114,7 +114,7 @@ func InitRepository(verbose bool, mcp bool) error { } fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Start a chat and use the custom agent to create a new workflow:")) fmt.Fprintln(os.Stderr, "") - fmt.Fprintln(os.Stderr, " @.github/agents/create-agentic-workflow.agent.md") + fmt.Fprintln(os.Stderr, " @.github/agents/create-agentic-workflow.md") fmt.Fprintln(os.Stderr, "") fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Or add workflows from the catalog: "+constants.CLIExtensionPrefix+" add ")) fmt.Fprintln(os.Stderr, "") diff --git a/pkg/cli/init_command.go b/pkg/cli/init_command.go index d9eefa9502..71b0298674 100644 --- a/pkg/cli/init_command.go +++ b/pkg/cli/init_command.go @@ -19,7 +19,7 @@ func NewInitCommand() *cobra.Command { This command: - Configures .gitattributes to mark .lock.yml files as generated - Creates GitHub Copilot custom instructions at .github/instructions/github-agentic-workflows.instructions.md -- Creates the custom agent for workflow creation at .github/agents/create-agentic-workflow.agent.md +- Creates the custom agent for workflow creation at .github/agents/create-agentic-workflow.md - Removes the old /create-agentic-workflow prompt if it exists With --mcp flag: @@ -27,7 +27,7 @@ With --mcp flag: - Creates .vscode/mcp.json with gh-aw MCP server configuration After running this command, you can: -- Use GitHub Copilot Chat with @.github/agents/create-agentic-workflow.agent.md to create workflows interactively +- Use GitHub Copilot Chat with @.github/agents/create-agentic-workflow.md to create workflows interactively - Add workflows from the catalog with: ` + constants.CLIExtensionPrefix + ` add - Create new workflows from scratch with: ` + constants.CLIExtensionPrefix + ` new diff --git a/pkg/cli/init_test.go b/pkg/cli/init_test.go index ff911605b3..0e6aecfd83 100644 --- a/pkg/cli/init_test.go +++ b/pkg/cli/init_test.go @@ -79,7 +79,7 @@ func TestInitRepository(t *testing.T) { } // Verify agentic workflow agent was created - agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.agent.md") + agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.md") if _, err := os.Stat(agenticWorkflowAgentPath); os.IsNotExist(err) { t.Errorf("Expected agentic workflow agent file to exist") } @@ -141,7 +141,7 @@ func TestInitRepository_Idempotent(t *testing.T) { t.Errorf("Expected copilot instructions file to exist after second call") } - agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.agent.md") + agenticWorkflowAgentPath := filepath.Join(tempDir, ".github", "agents", "create-agentic-workflow.md") if _, err := os.Stat(agenticWorkflowAgentPath); os.IsNotExist(err) { t.Errorf("Expected agentic workflow agent file to exist after second call") } diff --git a/pkg/cli/templates/create-agentic-workflow.agent.md b/pkg/cli/templates/create-agentic-workflow.md similarity index 100% rename from pkg/cli/templates/create-agentic-workflow.agent.md rename to pkg/cli/templates/create-agentic-workflow.md