mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 07:04:34 +00:00
Merge pull request #232 from aliou/fix/symlinked-slash-commands
fix(coding-agent): support symlinked slash commands in discovery
This commit is contained in:
commit
c1f2541639
1 changed files with 2 additions and 2 deletions
|
|
@ -99,7 +99,7 @@ export function substituteArgs(content: string, args: string[]): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively scan a directory for .md files and load them as slash commands
|
* Recursively scan a directory for .md files (and symlinks to .md files) and load them as slash commands
|
||||||
*/
|
*/
|
||||||
function loadCommandsFromDir(dir: string, source: "user" | "project", subdir: string = ""): FileSlashCommand[] {
|
function loadCommandsFromDir(dir: string, source: "user" | "project", subdir: string = ""): FileSlashCommand[] {
|
||||||
const commands: FileSlashCommand[] = [];
|
const commands: FileSlashCommand[] = [];
|
||||||
|
|
@ -118,7 +118,7 @@ function loadCommandsFromDir(dir: string, source: "user" | "project", subdir: st
|
||||||
// Recurse into subdirectory
|
// Recurse into subdirectory
|
||||||
const newSubdir = subdir ? `${subdir}:${entry.name}` : entry.name;
|
const newSubdir = subdir ? `${subdir}:${entry.name}` : entry.name;
|
||||||
commands.push(...loadCommandsFromDir(fullPath, source, newSubdir));
|
commands.push(...loadCommandsFromDir(fullPath, source, newSubdir));
|
||||||
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
} else if ((entry.isFile() || entry.isSymbolicLink()) && entry.name.endsWith(".md")) {
|
||||||
try {
|
try {
|
||||||
const rawContent = readFileSync(fullPath, "utf-8");
|
const rawContent = readFileSync(fullPath, "utf-8");
|
||||||
const { frontmatter, content } = parseFrontmatter(rawContent);
|
const { frontmatter, content } = parseFrontmatter(rawContent);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue