fix: address Cubic CLI and agent issues — URL encode, JSONC leading comments, config clone, untracked files, parse error handling, cache path, message-dir dedup

This commit is contained in:
YeonGyu-Kim
2026-02-09 11:17:51 +09:00
parent 5ca3d9c489
commit d6fbe7bd8d
4 changed files with 45 additions and 24 deletions
@@ -15,7 +15,11 @@ const execFileSyncMock = mock((file: string, args: string[], _opts: { cwd?: stri
}
if (subcommand === "status") {
return " M file.ts\n"
return " M file.ts\n?? new-file.ts\n"
}
if (subcommand === "ls-files") {
return "new-file.ts\n"
}
throw new Error(`unexpected args: ${args.join(" ")}`)
@@ -38,7 +42,7 @@ describe("collectGitDiffStats", () => {
//#then
expect(execSyncMock).not.toHaveBeenCalled()
expect(execFileSyncMock).toHaveBeenCalledTimes(2)
expect(execFileSyncMock).toHaveBeenCalledTimes(3)
const [firstCallFile, firstCallArgs, firstCallOpts] = execFileSyncMock.mock
.calls[0]! as unknown as [string, string[], { cwd?: string }]
@@ -54,6 +58,13 @@ describe("collectGitDiffStats", () => {
expect(secondCallOpts.cwd).toBe(directory)
expect(secondCallArgs.join(" ")).not.toContain(directory)
const [thirdCallFile, thirdCallArgs, thirdCallOpts] = execFileSyncMock.mock
.calls[2]! as unknown as [string, string[], { cwd?: string }]
expect(thirdCallFile).toBe("git")
expect(thirdCallArgs).toEqual(["ls-files", "--others", "--exclude-standard"])
expect(thirdCallOpts.cwd).toBe(directory)
expect(thirdCallArgs.join(" ")).not.toContain(directory)
expect(result).toEqual([
{
path: "file.ts",
@@ -61,6 +72,12 @@ describe("collectGitDiffStats", () => {
removed: 2,
status: "modified",
},
{
path: "new-file.ts",
added: 0,
removed: 0,
status: "added",
},
])
})
})