mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
Revert "fix: strip parentheses from file paths generated by llm"
This reverts commit 6c1a1a77b7.
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/rest": "^22.0.1",
|
"@octokit/rest": "^22.0.1",
|
||||||
"@opencode-ai/plugin": "1.0.162",
|
"@opencode-ai/plugin": "0.0.0-dev-202512160508",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -34,9 +34,9 @@
|
|||||||
|
|
||||||
"@octokit/types": ["@octokit/types@16.0.0", "", { "dependencies": { "@octokit/openapi-types": "^27.0.0" } }, "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg=="],
|
"@octokit/types": ["@octokit/types@16.0.0", "", { "dependencies": { "@octokit/openapi-types": "^27.0.0" } }, "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg=="],
|
||||||
|
|
||||||
"@opencode-ai/plugin": ["@opencode-ai/plugin@1.0.162", "", { "dependencies": { "@opencode-ai/sdk": "1.0.162", "zod": "4.1.8" } }, "sha512-tiJw7SCfSlG/3tY2O0J2UT06OLuazOzsv1zYlFbLxLy/EVedtW0pzxYalO20a4e//vInvOXFkhd2jLyB5vNEVA=="],
|
"@opencode-ai/plugin": ["@opencode-ai/plugin@0.0.0-dev-202512160508", "", { "dependencies": { "@opencode-ai/sdk": "0.0.0-dev-202512160508", "zod": "4.1.8" } }, "sha512-GLnvMQhEWRHG9E84FyyQKPKi54bGUkytXPfZYjwNy9W6djw8zAW/kpeYPrdIJHPdTHk4OjIHEwoB1SXZzGaLFQ=="],
|
||||||
|
|
||||||
"@opencode-ai/sdk": ["@opencode-ai/sdk@1.0.162", "", {}, "sha512-+XqRErBUt9eb1m3i/7WkZc/QCKCCjTaGV3MvhLhs/CUwbUn767D/ugzcG/i2ec8j/4nQmjJbjPDRmrQfvF1Qjw=="],
|
"@opencode-ai/sdk": ["@opencode-ai/sdk@0.0.0-dev-202512160508", "", {}, "sha512-ICpZ1bX528yQKqYGGyUJQMu3RY0F1pQ6RCoTJ4ESLiYmcXUY1EldgIidiwPA+A/zpEXLu2lPwPZ1LYn/bX6aFA=="],
|
||||||
|
|
||||||
"before-after-hook": ["before-after-hook@4.0.0", "", {}, "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ=="],
|
"before-after-hook": ["before-after-hook@4.0.0", "", {}, "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ=="],
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/rest": "^22.0.1",
|
"@octokit/rest": "^22.0.1",
|
||||||
"@opencode-ai/plugin": "1.0.162"
|
"@opencode-ai/plugin": "0.0.0-dev-202512160508"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,6 @@ function strip(text: string): string {
|
|||||||
return match ? match[2] : text
|
return match ? match[2] : text
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeParensAroundFileRefs(text: string): string {
|
|
||||||
// Remove parentheses around inline code that looks like a file reference
|
|
||||||
// Matches: (`path/to/file.ext`) or (`path/to/file.ext:1-10`) or (`file.ext:42`)
|
|
||||||
return text.replace(/\(\s*(`[^`]+\.[a-zA-Z0-9]+(?::\d+(?:-\d+)?)?`)\s*\)/g, "$1")
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Markdown(
|
export function Markdown(
|
||||||
props: ComponentProps<"div"> & {
|
props: ComponentProps<"div"> & {
|
||||||
text: string
|
text: string
|
||||||
@@ -23,7 +17,7 @@ export function Markdown(
|
|||||||
const [local, others] = splitProps(props, ["text", "class", "classList"])
|
const [local, others] = splitProps(props, ["text", "class", "classList"])
|
||||||
const marked = useMarked()
|
const marked = useMarked()
|
||||||
const [html] = createResource(
|
const [html] = createResource(
|
||||||
() => removeParensAroundFileRefs(strip(local.text)),
|
() => strip(local.text),
|
||||||
async (markdown) => {
|
async (markdown) => {
|
||||||
return marked.parse(markdown)
|
return marked.parse(markdown)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
export function ContentMarkdown(props: Props) {
|
export function ContentMarkdown(props: Props) {
|
||||||
const [html] = createResource(
|
const [html] = createResource(
|
||||||
() => removeParensAroundFileRefs(strip(props.text)),
|
() => strip(props.text),
|
||||||
async (markdown) => {
|
async (markdown) => {
|
||||||
return markedWithShiki.parse(markdown)
|
return markedWithShiki.parse(markdown)
|
||||||
},
|
},
|
||||||
@@ -65,9 +65,3 @@ function strip(text: string): string {
|
|||||||
const match = text.match(wrappedRe)
|
const match = text.match(wrappedRe)
|
||||||
return match ? match[2] : text
|
return match ? match[2] : text
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeParensAroundFileRefs(text: string): string {
|
|
||||||
// Remove parentheses around inline code that looks like a file reference
|
|
||||||
// Matches: (`path/to/file.ext`) or (`path/to/file.ext:1-10`) or (`file.ext:42`)
|
|
||||||
return text.replace(/\(\s*(`[^`]+\.[a-zA-Z0-9]+(?::\d+(?:-\d+)?)?`)\s*\)/g, "$1")
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user