diff --git a/packages/core/src/shell/select.ts b/packages/core/src/shell/select.ts index eeba40145a..8147156cff 100644 --- a/packages/core/src/shell/select.ts +++ b/packages/core/src/shell/select.ts @@ -158,8 +158,6 @@ function info(file: string, options?: Options, bin?: string): Item { export function args(file: string, command: string) { const n = name(file) - if (n === "nu" || n === "fish") return ["-c", command] - if (n === "zsh" || n === "bash") return ["-c", command] if (n === "cmd") return ["/c", command] if (ps(file)) return ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", command] return ["-c", command] diff --git a/packages/core/src/tool/html-markdown.ts b/packages/core/src/tool/html-markdown.ts index 241c048ab4..a4ea1611bd 100644 --- a/packages/core/src/tool/html-markdown.ts +++ b/packages/core/src/tool/html-markdown.ts @@ -109,9 +109,10 @@ export function convertHTMLToMarkdown(html: string) { outputBytes -= encoder.encode(value).byteLength return value } + const quotePrefix = () => "> ".repeat(Math.min(8, quoteDepth)) const prefixQuote = () => { if (!needsQuotePrefix || quoteDepth === 0 || activeCell) return - append(`${"> ".repeat(Math.min(8, quoteDepth))}`) + append(quotePrefix()) needsQuotePrefix = false } const flushSpace = () => { @@ -228,8 +229,7 @@ export function convertHTMLToMarkdown(html: string) { const fence = marker.repeat(length) block() const prefix = `${fence}${code.language ?? ""}\n` - const quote = quoteDepth > 0 ? `${"> ".repeat(Math.min(8, quoteDepth))}` : "" - const closing = `${code.text.endsWith("\n") ? "" : "\n"}${fence}` + const quote = quoteDepth > 0 ? quotePrefix() : "" let payload = code.text for (;;) { const candidate = `${prefix}${payload}${payload.endsWith("\n") ? "" : "\n"}${fence}` @@ -606,7 +606,7 @@ export function convertHTMLToMarkdown(html: string) { block() } if (!table.fallback && rectangular) { - const prefix = `${quoteDepth > 0 ? `${"> ".repeat(Math.min(8, quoteDepth))}` : ""}${pendingIndent}` + const prefix = `${quoteDepth > 0 ? quotePrefix() : ""}${pendingIndent}` pendingIndent = "" append(`${prefix}| ${table.rows[0].join(" | ")} |\n${prefix}|${" --- |".repeat(width)}`) for (const row of table.rows.slice(1)) append(`\n${prefix}| ${row.join(" | ")} |`) diff --git a/packages/core/src/tool/plugin/edit.ts b/packages/core/src/tool/plugin/edit.ts index 77c2ba298d..0aac63e034 100644 --- a/packages/core/src/tool/plugin/edit.ts +++ b/packages/core/src/tool/plugin/edit.ts @@ -87,7 +87,7 @@ const findLineOccurrences = (content: string, search: string) => { if ( !actual.every( (item, lineIndex) => - normalizeForMatch(item.text.trimEnd()) === normalizeForMatch(expected[lineIndex]!.trimEnd()), + normalizeForMatch(item.text.trimEnd()) === normalizeForMatch(expected[lineIndex].trimEnd()), ) ) return [] diff --git a/packages/core/src/tool/runtime.ts b/packages/core/src/tool/runtime.ts index 279ece4135..67812827c2 100644 --- a/packages/core/src/tool/runtime.ts +++ b/packages/core/src/tool/runtime.ts @@ -101,15 +101,13 @@ const standardFailure = (prefix: string, error: unknown) => const inputJsonSchema = (schema: Tool.ValueSchema): JsonSchema.JsonSchema => { if (schema === undefined || schema === null) return {} - if (isStandardSchema(schema)) - return schema["~standard"].jsonSchema.input({ target: "draft-2020-12" }) as JsonSchema.JsonSchema - return Schema.isSchema(schema) ? toJsonSchema(schema) : (schema as JsonSchema.JsonSchema) + if (isStandardSchema(schema)) return schema["~standard"].jsonSchema.input({ target: "draft-2020-12" }) + return Schema.isSchema(schema) ? toJsonSchema(schema) : schema } const outputJsonSchema = (schema: Tool.ValueSchema): JsonSchema.JsonSchema => { - if (isStandardSchema(schema)) - return schema["~standard"].jsonSchema.output({ target: "draft-2020-12" }) as JsonSchema.JsonSchema - return Schema.isSchema(schema) ? toJsonSchema(schema) : (schema as JsonSchema.JsonSchema) + if (isStandardSchema(schema)) return schema["~standard"].jsonSchema.output({ target: "draft-2020-12" }) + return Schema.isSchema(schema) ? toJsonSchema(schema) : schema } const toJsonSchema = (schema: Schema.Top): JsonSchema.JsonSchema => {