mirror of
https://github.com/przeprogramowani/10x-cli.git
synced 2026-09-19 03:30:01 +08:00
e0b122c8a2
- Conflict detection: clean update, user edit, matching edit, each resolution - v2 manifest upgrade: false positive on diff, clean match, v3 upgrade, 3-way after upgrade - Removal tracking: skill/prompt removals, empty on fresh, dry-run populates - Hash persistence: stored after apply, preserved on skip, updated on overwrite/save_user - Non-TTY conflict resolver: always skips without prompting - Update get-command test types for new counts.removals field Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { createConflictResolver } from "../src/lib/conflict-prompt";
|
|
import type { ConflictInfo } from "../src/lib/writer";
|
|
|
|
function makeConflict(overrides: Partial<ConflictInfo> = {}): ConflictInfo {
|
|
return {
|
|
artifactType: "skill",
|
|
artifactName: "code-review/SKILL.md",
|
|
filePath: "/project/.claude/skills/code-review/SKILL.md",
|
|
relativePath: "SKILL.md",
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
describe("conflict resolver — non-TTY mode", () => {
|
|
it("returns skip for every conflict without prompting", async () => {
|
|
const resolver = createConflictResolver(false);
|
|
|
|
const result1 = await resolver(makeConflict());
|
|
const result2 = await resolver(makeConflict({ artifactName: "tdd/SKILL.md" }));
|
|
const result3 = await resolver(makeConflict({ artifactType: "prompt", artifactName: "plan" }));
|
|
|
|
expect(result1).toBe("skip");
|
|
expect(result2).toBe("skip");
|
|
expect(result3).toBe("skip");
|
|
});
|
|
|
|
it("never silently destroys user edits in non-TTY mode", async () => {
|
|
const resolver = createConflictResolver(false);
|
|
|
|
// Simulate many conflicts in a CI pipeline
|
|
const results = await Promise.all(
|
|
Array.from({ length: 10 }, (_, i) =>
|
|
resolver(makeConflict({ artifactName: `skill-${i}/SKILL.md` })),
|
|
),
|
|
);
|
|
|
|
expect(results.every((r) => r === "skip")).toBe(true);
|
|
});
|
|
});
|