581bbbb319
* feat(cli,vscode): add custom commit message prompt setting Support user-configurable system prompt for AI commit message generation. Adds a dedicated Commit Message tab in VS Code settings with a toggle to override the built-in conventional commits prompt. * fix: add missing kilocode_change annotation and fix i18n formatting * refactor: move Config reading to route handler, add textarea max-height Move kilo-specific Config.get() from shared generate.ts to the route handler. The generator now accepts an optional prompt param instead. Cap textarea height at 300px with scroll for long prompts. * fix: resolve annotation gaps and prompt clear serialization bug Add kilocode_change markers to JSDoc comment and extend block to cover the generateCommitMessage call. Use empty string instead of undefined when clearing the prompt so JSON serialization persists the removal to disk. * refactor(cli): move commit-message module to kilocode paths Move src/commit-message/ to src/kilocode/commit-message/, route to src/kilocode/server/routes/, and tests to test/kilocode/commit-message/. Extract CommitMessageSchema to KilocodeConfig and reference it from the main Config.Info. Removes all kilocode_change markers from moved files since they are now in exempt paths. * test(cli): fix moved commit-message tests
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { describe, expect, spyOn, test } from "bun:test"
|
|
import { getGitContext } from "../../src/kilocode/commit-message/git-context"
|
|
|
|
describe("commit-message git context", () => {
|
|
test("hides Windows console windows for git subprocesses", async () => {
|
|
const out = new Map([
|
|
["branch --show-current", "main"],
|
|
["log --oneline -5", "abc1234 init"],
|
|
["diff --name-status --cached", "M\tsrc/index.ts"],
|
|
["diff --cached -- src/index.ts", "+console.log('hi')"],
|
|
])
|
|
|
|
const spy = spyOn(Bun, "spawnSync").mockImplementation(((cmd: unknown, opts: unknown) => {
|
|
const key = Array.isArray(cmd) ? cmd.slice(1).join(" ") : ""
|
|
return {
|
|
stdout: Buffer.from(out.get(key) ?? ""),
|
|
stderr: Buffer.alloc(0),
|
|
} as never
|
|
}) as unknown as typeof Bun.spawnSync)
|
|
|
|
try {
|
|
await getGitContext("/repo")
|
|
|
|
expect(spy).toHaveBeenCalledTimes(4)
|
|
for (const call of spy.mock.calls) {
|
|
expect(call[0]).toEqual(expect.arrayContaining(["git"]))
|
|
expect(call[1]).toMatchObject({
|
|
cwd: "/repo",
|
|
stdout: "pipe",
|
|
stderr: "pipe",
|
|
windowsHide: true,
|
|
})
|
|
}
|
|
} finally {
|
|
spy.mockRestore()
|
|
}
|
|
})
|
|
})
|