feat: extract paths
This commit is contained in:
parent
f95cdfaf83
commit
2ffb4aefeb
1 changed files with 16 additions and 0 deletions
16
core/llm/utils/extractPathsFromCodeBlocks.ts
Normal file
16
core/llm/utils/extractPathsFromCodeBlocks.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Extracts file paths from markdown code blocks
|
||||
*/
|
||||
export function extractPathsFromCodeBlocks(content: string): string[] {
|
||||
const codeBlockRegex = /```[\w-+#]*\s+([^\s(]+)(?:\s|$|\()/g;
|
||||
const paths: string[] = [];
|
||||
let match;
|
||||
|
||||
while ((match = codeBlockRegex.exec(content)) !== null) {
|
||||
if (match[1]) {
|
||||
paths.push(match[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue