Skip to content

Commit 2911b09

Browse files
Copilotalexec
andauthored
Add .agents/commands as a search path for tasks (#131)
* Initial plan * Add .agents/commands as a search path for tasks Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> * Update docs to include .agents/commands search path Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
1 parent c824fd6 commit 2911b09

5 files changed

Lines changed: 36 additions & 6 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This tool is compatible with configuration files from various AI coding agents a
2828
- **[OpenCode.ai](https://opencode.ai/)**: `.opencode/agent`, `.opencode/command`, `.opencode/rules`
2929
- **[GitHub Copilot](https://github.com/features/copilot)**: `.github/copilot-instructions.md`, `.github/agents`
3030
- **[Google Gemini](https://gemini.google.com/)**: `GEMINI.md`, `.gemini/styleguide.md`
31-
- **Generic AI Agents**: `AGENTS.md`, `.agents/rules`
31+
- **Generic AI Agents**: `AGENTS.md`, `.agents/rules`, `.agents/commands` (tasks), `.agents/tasks`
3232

3333
The tool automatically discovers and includes rules from these locations in your project, parent directories, and user home directory (`~`).
3434

@@ -166,6 +166,9 @@ The tool looks for task and rule files in the following locations, in order of p
166166

167167
**Tasks:**
168168
- `./.agents/tasks/*.md` (any `.md` file with matching `task_name` in frontmatter)
169+
- `./.agents/commands/*.md`
170+
- `./.cursor/commands/*.md`
171+
- `./.opencode/command/*.md`
169172
- `~/.agents/tasks/*.md`
170173

171174
**Rules:**

docs/how-to/create-tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Please review the code changes with focus on:
2525
- Security implications
2626
```
2727

28-
Save as `.agents/tasks/code-review.md`.
28+
Save as `.agents/tasks/code-review.md` (or `.agents/commands/code-review.md`).
2929

3030
Use with:
3131
```bash

docs/reference/search-paths.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ All directories (local and remote) are processed via go-getter, which downloads
2020
Within each directory, task files are searched in the following locations:
2121

2222
1. `.agents/tasks/`
23-
2. `.cursor/commands/`
24-
3. `.opencode/command/`
23+
2. `.agents/commands/`
24+
3. `.cursor/commands/`
25+
4. `.opencode/command/`
2526

2627
### Discovery Rules
2728

@@ -115,7 +116,7 @@ The CLI automatically discovers rules from configuration files for these AI codi
115116
| **OpenCode.ai** | `.opencode/agent/`, `.opencode/command/` (tasks), `.opencode/rules/` |
116117
| **GitHub Copilot** | `.github/copilot-instructions.md`, `.github/agents/` |
117118
| **Google Gemini** | `GEMINI.md`, `.gemini/styleguide.md` |
118-
| **Generic** | `AGENTS.md`, `.agents/rules/` |
119+
| **Generic** | `AGENTS.md`, `.agents/rules/`, `.agents/commands/` (tasks) |
119120
120121
## Discovery Behavior
121122
@@ -285,7 +286,7 @@ coding-context -s team=backend fix-bug
285286
- For remote directories, verify the download succeeded (check stderr logs)
286287

287288
**Task not found:**
288-
- Verify that `.agents/tasks/`, `.cursor/commands/`, or `.opencode/command/` directory exists in one of the search path directories
289+
- Verify that `.agents/tasks/`, `.agents/commands/`, `.cursor/commands/`, or `.opencode/command/` directory exists in one of the search path directories
289290
- Check `task_name` field in frontmatter matches the task name you're using
290291
- Ensure filename has `.md` extension
291292
- Verify the directory containing the task is in search paths (working directory and home directory are added automatically)

pkg/codingcontext/context_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,31 @@ func TestFindTaskFile(t *testing.T) {
303303
searchPaths: []string{"downloaded"}, // Will be resolved relative to tmpDir
304304
wantErr: false,
305305
},
306+
{
307+
name: "task file found in .agents/commands directory",
308+
taskName: "agents_commands_task",
309+
setupFiles: func(t *testing.T, tmpDir string) {
310+
taskDir := filepath.Join(tmpDir, ".agents", "commands")
311+
createMarkdownFile(t, filepath.Join(taskDir, "agents_commands_task.md"),
312+
"",
313+
"# Agents Commands Task")
314+
},
315+
wantErr: false,
316+
},
317+
{
318+
name: "task file found in downloaded .agents/commands directory",
319+
taskName: "agents_commands_remote_task",
320+
setupFiles: func(t *testing.T, tmpDir string) {
321+
// Create task file in downloaded directory's .agents/commands
322+
downloadedDir := filepath.Join(tmpDir, "downloaded")
323+
taskDir := filepath.Join(downloadedDir, ".agents", "commands")
324+
createMarkdownFile(t, filepath.Join(taskDir, "agents_commands_remote_task.md"),
325+
"",
326+
"# Agents Commands Remote Task")
327+
},
328+
searchPaths: []string{"downloaded"}, // Will be resolved relative to tmpDir
329+
wantErr: false,
330+
},
306331
{
307332
name: "task file found in .opencode/command directory",
308333
taskName: "opencode_task",

pkg/codingcontext/paths.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func rulePaths(dir string, home bool) []string {
3737
func taskSearchPaths(dir string) []string {
3838
return []string{
3939
filepath.Join(dir, ".agents", "tasks"),
40+
filepath.Join(dir, ".agents", "commands"),
4041
filepath.Join(dir, ".cursor", "commands"),
4142
filepath.Join(dir, ".opencode", "command"),
4243
}

0 commit comments

Comments
 (0)