Skip to content

Commit 338ac68

Browse files
authored
Use a directory under workdir for skills
1 parent ed8d507 commit 338ac68

15 files changed

+65
-279
lines changed

dotnet/test/SkillsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class SkillsTests : E2ETestBase, IDisposable
1515

1616
public SkillsTests(E2ETestFixture fixture, ITestOutputHelper output) : base(fixture, "skills", output)
1717
{
18-
// Create a temporary skills directory with a test skill
19-
_skillsDir = Path.Combine(Path.GetTempPath(), $"copilot-skills-test-{Guid.NewGuid()}");
18+
// Create a skills directory in the working directory
19+
_skillsDir = Path.Combine(Directory.GetCurrentDirectory(), "copilot-skills-test");
2020
Directory.CreateDirectory(_skillsDir);
2121

2222
// Create a skill subdirectory with SKILL.md

go/e2e/skills_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ import (
1414
const skillMarker = "PINEAPPLE_COCONUT_42"
1515

1616
func createTestSkillDir(t *testing.T, marker string) string {
17-
skillsDir, err := os.MkdirTemp("", "copilot-skills-test-")
17+
cwd, err := os.Getwd()
1818
if err != nil {
19-
t.Fatalf("Failed to create temp skills directory: %v", err)
19+
t.Fatalf("Failed to get current working directory: %v", err)
20+
}
21+
skillsDir := filepath.Join(cwd, "copilot-skills-test")
22+
if err := os.MkdirAll(skillsDir, 0755); err != nil {
23+
t.Fatalf("Failed to create skills directory: %v", err)
2024
}
2125

2226
skillSubdir := filepath.Join(skillsDir, "test-skill")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: test-skill
3+
description: A test skill that adds a marker to responses
4+
---
5+
6+
# Test Skill Instructions
7+
8+
IMPORTANT: You MUST include the exact text "PINEAPPLE_COCONUT_42" somewhere in EVERY response you give. This is a mandatory requirement. Include it naturally in your response.

nodejs/test/e2e/skills.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*--------------------------------------------------------------------------------------------*/
44

55
import * as fs from "fs";
6-
import * as os from "os";
76
import * as path from "path";
87
import { afterAll, beforeAll, describe, expect, it } from "vitest";
98
import { createSdkTestContext } from "./harness/sdkTestContext.js";
@@ -14,8 +13,9 @@ describe("Skills Configuration", async () => {
1413
const SKILL_MARKER = "PINEAPPLE_COCONUT_42";
1514

1615
beforeAll(() => {
17-
// Create a temporary skills directory with a test skill
18-
skillsDir = fs.mkdtempSync(path.join(os.tmpdir(), "copilot-skills-test-"));
16+
// Create a skills directory in the working directory
17+
skillsDir = path.join(process.cwd(), "copilot-skills-test");
18+
fs.mkdirSync(skillsDir, { recursive: true });
1919

2020
// Create a skill subdirectory with SKILL.md
2121
const skillSubdir = path.join(skillsDir, "test-skill");

python/e2e/test_skills.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import os
66
import shutil
7-
import tempfile
7+
88
import pytest
99

1010
from .testharness import E2ETestContext
@@ -16,8 +16,9 @@
1616

1717
@pytest.fixture(scope="module")
1818
def skills_dir():
19-
"""Create a temporary skills directory with a test skill"""
20-
skills_dir = tempfile.mkdtemp(prefix="copilot-skills-test-")
19+
"""Create a skills directory in the working directory"""
20+
skills_dir = os.path.join(os.getcwd(), "copilot-skills-test")
21+
os.makedirs(skills_dir, exist_ok=True)
2122

2223
# Create a skill subdirectory with SKILL.md
2324
skill_subdir = os.path.join(skills_dir, "test-skill")

test/snapshots/session/should_abort_a_session.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ conversations:
77
- role: user
88
content: run the shell command 'sleep 100' (note this works on both bash and PowerShell)
99
- role: assistant
10-
content: I'll run the sleep command for 100 seconds in async mode.
10+
content: I'll run the sleep command for 100 seconds.
1111
- role: assistant
1212
tool_calls:
1313
- id: toolcall_0
@@ -21,14 +21,14 @@ conversations:
2121
type: function
2222
function:
2323
name: ${shell}
24-
arguments: '{"command":"sleep 100","description":"Sleep for 100 seconds","mode":"async"}'
24+
arguments: '{"description":"Run sleep 100 command","command":"sleep 100","mode":"sync","initial_wait":105}'
2525
- messages:
2626
- role: system
2727
content: ${system}
2828
- role: user
2929
content: run the shell command 'sleep 100' (note this works on both bash and PowerShell)
3030
- role: assistant
31-
content: I'll run the sleep command for 100 seconds in async mode.
31+
content: I'll run the sleep command for 100 seconds.
3232
tool_calls:
3333
- id: toolcall_0
3434
type: function
@@ -39,7 +39,7 @@ conversations:
3939
type: function
4040
function:
4141
name: ${shell}
42-
arguments: '{"command":"sleep 100","description":"Sleep for 100 seconds","mode":"async"}'
42+
arguments: '{"description":"Run sleep 100 command","command":"sleep 100","mode":"sync","initial_wait":105}'
4343
- role: tool
4444
tool_call_id: toolcall_0
4545
content: Intent logged

test/snapshots/skillbehavior/apply_skill_on_session_resume_with_skilldirectories.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ conversations:
77
- role: user
88
content: Say hi.
99
- role: assistant
10-
content: Hi! I'm GitHub Copilot CLI, ready to help with your software engineering tasks. What can I do for you?
10+
content: Hi! I'm GitHub Copilot in the CLI. I can help you with software engineering tasks like exploring codebases,
11+
making code changes, running tests, and more. What can I help you with today?
1112
- role: user
1213
content: Say hello again using the test skill.
1314
- role: assistant
@@ -24,7 +25,7 @@ conversations:
2425
content: >-
2526
<skill-context name="test-skill">
2627
27-
Base directory for this skill: /tmp/copilot-skills-test-3578831123/test-skill
28+
Base directory for this skill: /workspaces/copilot-sdk/go/e2e/copilot-skills-test/test-skill
2829
2930
3031
---
@@ -45,4 +46,4 @@ conversations:
4546
4647
</skill-context>
4748
- role: assistant
48-
content: Hello again! PINEAPPLE_COCONUT_42 - ready to assist you with the test skill activated!
49+
content: Hello again! PINEAPPLE_COCONUT_42 - I'm here and ready to help you with your software engineering tasks!

test/snapshots/skillbehavior/load_and_apply_skill_from_skilldirectories.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ conversations:
2020
content: >-
2121
<skill-context name="test-skill">
2222
23-
Base directory for this skill: /tmp/copilot-skills-test-3578831123/test-skill
23+
Base directory for this skill: /workspaces/copilot-sdk/go/e2e/copilot-skills-test/test-skill
2424
2525
2626
---
@@ -41,4 +41,4 @@ conversations:
4141
4242
</skill-context>
4343
- role: assistant
44-
content: Hello! PINEAPPLE_COCONUT_42 – Good to meet you!
44+
content: Hello! PINEAPPLE_COCONUT_42 - Hope you're having a great day!

test/snapshots/skillbehavior/not_apply_skill_when_disabled_via_disabledskills.yaml

Lines changed: 2 additions & 223 deletions
Original file line numberDiff line numberDiff line change
@@ -7,226 +7,5 @@ conversations:
77
- role: user
88
content: Say hello briefly using the test skill.
99
- role: assistant
10-
tool_calls:
11-
- id: toolcall_0
12-
type: function
13-
function:
14-
name: fetch_copilot_cli_documentation
15-
arguments: "{}"
16-
- role: tool
17-
tool_call_id: toolcall_0
18-
content: |-
19-
# GitHub Copilot CLI Documentation
20-
21-
## README
22-
# GitHub Copilot CLI (Public Preview)
23-
24-
The power of GitHub Copilot, now in your terminal.
25-
26-
GitHub Copilot CLI brings AI-powered coding assistance directly to your command line, enabling you to build, debug, and understand code through natural language conversations. Powered by the same agentic harness as GitHub's Copilot coding agent, it provides intelligent assistance while staying deeply integrated with your GitHub workflow.
27-
28-
See [our official documentation](https://docs.github.com/copilot/concepts/agents/about-copilot-cli) for more information.
29-
30-
![Image of the splash screen for the Copilot CLI](https://github.com/user-attachments/assets/51ac25d2-c074-467a-9c88-38a8d76690e3)
31-
32-
## 🚀 Introduction and Overview
33-
34-
We're bringing the power of GitHub Copilot coding agent directly to your terminal. With GitHub Copilot CLI, you can work locally and synchronously with an AI agent that understands your code and GitHub context.
35-
36-
- **Terminal-native development:** Work with Copilot coding agent directly in your command line — no context switching required.
37-
- **GitHub integration out of the box:** Access your repositories, issues, and pull requests using natural language, all authenticated with your existing GitHub account.
38-
- **Agentic capabilities:** Build, edit, debug, and refactor code with an AI collaborator that can plan and execute complex tasks.
39-
- **MCP-powered extensibility:** Take advantage of the fact that the coding agent ships with GitHub's MCP server by default and supports custom MCP servers to extend capabilities.
40-
- **Full control:** Preview every action before execution — nothing happens without your explicit approval.
41-
42-
We're still early in our journey, but with your feedback, we're rapidly iterating to make the GitHub Copilot CLI the best possible companion in your terminal.
43-
44-
## 📦 Getting Started
45-
46-
### Supported Platforms
47-
48-
- **Linux**
49-
- **macOS**
50-
- **Windows**
51-
52-
### Prerequisites
53-
54-
- (On Windows) **PowerShell** v6 or higher
55-
- An **active Copilot subscription**. See [Copilot plans](https://github.com/features/copilot/plans?ref_cta=Copilot+plans+signup&ref_loc=install-copilot-cli&ref_page=docs).
56-
57-
If you have access to GitHub Copilot via your organization or enterprise, you cannot use GitHub Copilot CLI if your organization owner or enterprise administrator has disabled it in the organization or enterprise settings. See [Managing policies and features for GitHub Copilot in your organization](http://docs.github.com/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-github-copilot-features-in-your-organization/managing-policies-for-copilot-in-your-organization) for more information.
58-
59-
### Installation
60-
61-
Install with [WinGet](https://github.com/microsoft/winget-cli) (Windows):
62-
63-
```bash
64-
winget install GitHub.Copilot
65-
```
66-
67-
```bash
68-
winget install GitHub.Copilot.Prerelease
69-
```
70-
71-
Install with [Homebrew](https://formulae.brew.sh/cask/copilot-cli) (macOS and Linux):
72-
73-
```bash
74-
brew install copilot-cli
75-
```
76-
77-
```bash
78-
brew install copilot-cli@prerelease
79-
```
80-
81-
Install with [npm](https://www.npmjs.com/package/@github/copilot) (macOS, Linux, and Windows):
82-
83-
```bash
84-
npm install -g @github/copilot
85-
```
86-
87-
```bash
88-
npm install -g @github/copilot@prerelease
89-
```
90-
91-
Install with the install script (macOS and Linux):
92-
93-
```bash
94-
curl -fsSL https://gh.io/copilot-install | bash
95-
```
96-
97-
Or
98-
99-
```bash
100-
wget -qO- https://gh.io/copilot-install | bash
101-
```
102-
103-
Use `| sudo bash` to run as root and install to `/usr/local/bin`.
104-
105-
Set `PREFIX` to install to `$PREFIX/bin/` directory. Defaults to `/usr/local`
106-
when run as root or `$HOME/.local` when run as a non-root user.
107-
108-
Set `VERSION` to install a specific version. Defaults to the latest version.
109-
110-
For example, to install version `v0.0.369` to a custom directory:
111-
112-
```bash
113-
curl -fsSL https://gh.io/copilot-install | VERSION="v0.0.369" PREFIX="$HOME/custom" bash
114-
```
115-
116-
### Launching the CLI
117-
118-
```bash
119-
copilot
120-
```
121-
122-
On first launch, you'll be greeted with our adorable animated banner! If you'd like to see this banner again, launch `copilot` with the `--banner` flag.
123-
124-
If you're not currently logged in to GitHub, you'll be prompted to use the `/login` slash command. Enter this command and follow the on-screen instructions to authenticate.
125-
126-
#### Authenticate with a Personal Access Token (PAT)
127-
128-
You can also authenticate using a fine-grained PAT with the "Copilot Requests" permission enabled.
129-
130-
1. Visit https://github.com/settings/personal-access-tokens/new
131-
2. Under "Permissions," click "add permissions" and select "Copilot Requests"
132-
3. Generate your token
133-
4. Add the token to your environment via the environment variable `GH_TOKEN` or `GITHUB_TOKEN` (in order of precedence)
134-
135-
### Using the CLI
136-
137-
Launch `copilot` in a folder that contains code you want to work with.
138-
139-
By default, `copilot` utilizes Claude Sonnet 4.5. Run the `/model` slash command to choose from other available models, including Claude Sonnet 4 and GPT-5.
140-
141-
Each time you submit a prompt to GitHub Copilot CLI, your monthly quota of premium requests is reduced by one. For information about premium requests, see [About premium requests](https://docs.github.com/copilot/managing-copilot/monitoring-usage-and-entitlements/about-premium-requests).
142-
143-
For more information about how to use the GitHub Copilot CLI, see [our official documentation](https://docs.github.com/copilot/concepts/agents/about-copilot-cli).
144-
145-
## 📢 Feedback and Participation
146-
147-
We're excited to have you join us early in the Copilot CLI journey.
148-
149-
This is an early-stage preview, and we're building quickly. Expect frequent updates--please keep your client up to date for the latest features and fixes!
150-
151-
Your insights are invaluable! Open issue in this repo, join Discussions, and run `/feedback` from the CLI to submit a confidential feedback survey!
152-
153-
154-
## Help Command Output
155-
Global shortcuts:
156-
@ - mention files, include contents in the current context
157-
Esc - cancel the current operation
158-
! - Execute the command in your local shell without sending to Copilot
159-
ctrl+c - cancel operation if thinking, clear input if present, or exit
160-
ctrl+d - shutdown
161-
ctrl+l - clear the screen
162-
163-
Expand timeline content shortcuts:
164-
ctrl+o - expand recent timeline/collapse timeline
165-
ctrl+e - expand all timeline/collapse timeline
166-
167-
Plan mode shortcuts:
168-
shift+tab - cycle between interactive and plan modes
169-
ctrl+y - open plan file in editor
170-
171-
Motion shortcuts:
172-
ctrl+a - move to the beginning of the line
173-
ctrl+h - delete previous character
174-
ctrl+w - delete previous word
175-
ctrl+u - delete from cursor to beginning of line
176-
ctrl+k - delete from cursor to end of line
177-
meta+←/→ - move cursor by word
178-
179-
Use ↑↓ keys to navigate command history
180-
181-
Respects instructions sourced from various locations:
182-
`.github/instructions/**/*.instructions.md` (in git root and cwd)
183-
`.github/copilot-instructions.md`
184-
`AGENTS.md` (in git root and cwd)
185-
`CLAUDE.md`
186-
`GEMINI.md`
187-
`$HOME/.copilot/copilot-instructions.md`
188-
Additional directories via `COPILOT_CUSTOM_INSTRUCTIONS_DIRS`
189-
190-
To learn about what I can do:
191-
Ask me "What can you do?"
192-
Or visit: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli
193-
194-
Available commands:
195-
/add-dir <directory> - Add a directory to the allowed list for file access
196-
/agent - Browse and select from available agents (if any)
197-
/clear, /new - Clear the conversation history
198-
/compact - Summarize conversation history to reduce context window usage
199-
/context - Show context window token usage and visualization
200-
/cwd, /cd [directory] - Change working directory or show current directory
201-
/delegate <prompt> - Delegate changes to remote repository with AI-generated PR
202-
/exit, /quit - Exit the CLI
203-
/share [file|gist] [path] - Share session to markdown file or GitHub gist
204-
/feedback - Provide feedback about the CLI
205-
/help - Show help for interactive commands
206-
/list-dirs - Display all allowed directories for file access
207-
/login - Log in to Copilot
208-
/logout - Log out of Copilot
209-
/mcp [show|add|edit|delete|disable|enable] [server-name] - Manage MCP server configuration
210-
/model [model] - Select AI model to use
211-
/plan [prompt] - Create an implementation plan before coding
212-
/reset-allowed-tools - Reset the list of allowed tools
213-
/resume [sessionId] - Switch to a different session (optionally specify session ID)
214-
/review [prompt] - Run code review agent to analyze changes
215-
/session [checkpoints [n]|files|plan|rename <name>] - Show session info and workspace summary. Use subcommands for details.
216-
/skills [list|info|add|remove|reload] [args...] - Manage skills for enhanced capabilities
217-
/terminal-setup - Configure terminal for multiline input support (shift+enter and ctrl+enter)
218-
/theme [show|set|list] [auto|dark|light] - View or configure terminal theme
219-
/usage - Display session usage metrics and statistics
220-
/user [show|list|switch] - Manage GitHub user list
221-
222-
---
223-
224-
**Note**: If the above documentation doesn't answer the user's request, you can fetch additional documentation from the official GitHub Docs for more information.
225-
226-
Use the web_fetch tool to fetch https://docs.github.com/api/article/body?pathname=/en/copilot/how-tos/use-copilot-agents/use-copilot-cli
227-
228-
You can also follow hyperlinks to related docs pages using the same API pattern.
229-
- role: assistant
230-
content: I don't see a "test skill" feature in the documentation. Based on the docs, I can manage skills with the
231-
`/skills` command, but there's no specific "test skill" mentioned. Could you clarify what you'd like me to do?
232-
Would you like me to just say hello, or were you referring to a specific feature?
10+
content: Hello! I don't have a specific "test skill" tool available. However, I'm ready to help you with coding tasks,
11+
running commands, searching files, and more. What would you like to work on?

0 commit comments

Comments
 (0)