From 859af5033b8fb16e138a56db769a9912b6f3238d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Catriel=20M=C3=BCller?= Date: Mon, 1 Jun 2026 23:33:44 -0300 Subject: [PATCH] refactor: move new changes to kilo folders --- packages/opencode/src/cli/cmd/run.ts | 2 +- .../src/{ => kilocode}/cli/cmd/run-message.ts | 5 ++--- .../cli/cmd/run-message.test.ts} | 11 +++++------ 3 files changed, 8 insertions(+), 10 deletions(-) rename packages/opencode/src/{ => kilocode}/cli/cmd/run-message.ts (78%) rename packages/opencode/test/{cli/cmd/run.test.ts => kilocode/cli/cmd/run-message.test.ts} (73%) diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts index af6949ee3c..10414a4fe4 100644 --- a/packages/opencode/src/cli/cmd/run.ts +++ b/packages/opencode/src/cli/cmd/run.ts @@ -4,7 +4,7 @@ import { pathToFileURL } from "url" import { UI } from "../ui" import { cmd } from "./cmd" import { Flag } from "@opencode-ai/core/flag/flag" -import { buildRunMessage } from "./run-message" // kilocode_change +import { buildRunMessage } from "@/kilocode/cli/cmd/run-message" // kilocode_change import { bootstrap } from "../bootstrap" import { EOL } from "os" import { text as streamText } from "node:stream/consumers" diff --git a/packages/opencode/src/cli/cmd/run-message.ts b/packages/opencode/src/kilocode/cli/cmd/run-message.ts similarity index 78% rename from packages/opencode/src/cli/cmd/run-message.ts rename to packages/opencode/src/kilocode/cli/cmd/run-message.ts index 141856ecf4..4dc3eeb771 100644 --- a/packages/opencode/src/cli/cmd/run-message.ts +++ b/packages/opencode/src/kilocode/cli/cmd/run-message.ts @@ -1,4 +1,3 @@ -// kilocode_change - new file // Atoms before `--` are positional shell arguments where re-quoting around // embedded spaces preserves the user's word-binding intent (PR #4979). // Atoms in `args["--"]` are raw passthrough per yargs `populate--` semantics: @@ -6,7 +5,7 @@ // not synthesize quote bytes around them. Re-quoting raw atoms breaks // leading-dash inputs like `kilo run -- "- Who are you?"` (#9622) by // emitting `"- Who are you?"` (literal quotes) into the model prompt. -export function buildRunMessage(positionals: string[], dashDash?: string[]): string { +export function buildRunMessage(positionals: string[], dash?: string[]): string { const quoted = positionals.map((arg) => (arg.includes(" ") ? `"${arg.replace(/"/g, '\\"')}"` : arg)) - return [...quoted, ...(dashDash ?? [])].join(" ") + return [...quoted, ...(dash ?? [])].join(" ") } diff --git a/packages/opencode/test/cli/cmd/run.test.ts b/packages/opencode/test/kilocode/cli/cmd/run-message.test.ts similarity index 73% rename from packages/opencode/test/cli/cmd/run.test.ts rename to packages/opencode/test/kilocode/cli/cmd/run-message.test.ts index fffebcf8c1..e1179e65cb 100644 --- a/packages/opencode/test/cli/cmd/run.test.ts +++ b/packages/opencode/test/kilocode/cli/cmd/run-message.test.ts @@ -1,6 +1,5 @@ -// kilocode_change - new file import { describe, expect, test } from "bun:test" -import { buildRunMessage } from "../../../src/cli/cmd/run-message" +import { buildRunMessage } from "../../../../src/kilocode/cli/cmd/run-message" describe("buildRunMessage", () => { test("preserves shell-bound multi-word positionals via wrap-quote (PR #4979)", () => { @@ -16,21 +15,21 @@ describe("buildRunMessage", () => { }) test("passes args['--'] through verbatim without wrap-quote (#9622)", () => { - // `kilo run -- "- Who are you?"` — yargs+populate-- captures the leading-dash + // `kilo run -- "- Who are you?"` - yargs+populate-- captures the leading-dash // phrase as a single atom in args["--"]. The assembler must NOT wrap it, // because the user typed `--` precisely to opt out of further parsing. expect(buildRunMessage([], ["- Who are you?"])).toBe("- Who are you?") }) - test("does not synthesize quote bytes around dashDash atoms even when they contain spaces", () => { + test("does not synthesize quote bytes around dash atoms even when they contain spaces", () => { expect(buildRunMessage([], ["one two", "three"])).toBe("one two three") }) - test("combines positionals and dashDash with appropriate quoting per source", () => { + test("combines positionals and dash args with appropriate quoting per source", () => { expect(buildRunMessage(["pre", "fix arg"], ["raw arg", "tail"])).toBe('pre "fix arg" raw arg tail') }) - test("handles undefined and empty dashDash identically", () => { + test("handles undefined and empty dash args identically", () => { expect(buildRunMessage(["x"], undefined)).toBe("x") expect(buildRunMessage(["x"], [])).toBe("x") })