adds claude-generated commit messages and a recent commits panel to the git view - adds log tailing in the explorer, branch merging and a clean up button

This commit is contained in:
2026-11-04 10:07:52 +01:00
parent 600d4874d2
commit cc6651c08a
49 changed files with 1944 additions and 180 deletions
@@ -42,6 +42,11 @@ import Testing
#expect(!labels(.terminal(.shell, hasSelection: false)).contains("Read aloud selection"))
}
@Test func theTailPaneOffersCopyButNoPasteOrWaitWhat() {
#expect(labels(.terminal(.tail, hasSelection: true)) == ["Copy", "Read aloud selection", "Plak"])
#expect(ContextActions.entries(for: .terminal(.tail, hasSelection: false)).isEmpty)
}
@Test func theMenuHasNoHeader() {
#expect(ContextActions.header(for: .terminal(.agent, hasSelection: false), projectName: "app").isEmpty)
#expect(ContextActions.header(for: .directory(path: "src"), projectName: "app").isEmpty)
@@ -143,16 +148,6 @@ import Testing
#expect(ContextAction.openFile("src/a.php").isEmphasized)
}
@Test func theCommitMenuOffersCommitAndABoldCommitAndPush() {
#expect(ContextActions.header(for: .commitMenu, projectName: "app") == "")
#expect(ContextActions.entries(for: .commitMenu) == [
.action(.commit(andPush: false), label: "Commit"),
.action(.commit(andPush: true), label: "Commit and push"),
])
#expect(ContextAction.commit(andPush: true).isEmphasized)
#expect(!ContextAction.commit(andPush: false).isEmphasized)
}
@Test func aSelectionCanBeReadAloudAfterCopyReference() {
let reference = AgentReference(path: "src/a.php", startLine: 3, endLine: 4)
#expect(ContextActions.entries(for: .editor(reference: reference, code: "$a = 1;", showDiffLine: 3)) == [
@@ -204,3 +199,59 @@ import Testing
#expect(plak(.editor(reference: reference, code: "")).isEmpty)
}
}
@Suite struct BranchContextMenuTests {
@Test func aCleanTreeOffersTheMergeIntoTheCurrentBranch() {
#expect(ContextActions.entries(for: .branch(name: "feature", remote: false, current: "dev", isDirty: false)) == [
.action(.mergeBranch("feature"), label: "Merge into dev"),
])
#expect(ContextActions.entries(for: .branch(name: "origin/feature", remote: true, current: "dev", isDirty: false)) == [
.action(.mergeBranch("origin/feature"), label: "Merge into dev"),
])
}
@Test func aDirtyTreeShowsTheMergeDisabled() {
let entries = ContextActions.entries(for: .branch(name: "feature", remote: false, current: "dev", isDirty: true))
#expect(entries == [
.disabled(.mergeBranch("feature"), label: "Merge into dev", hint: "Commit or discard your changes first"),
])
#expect(!entries[0].isSelectable)
}
@Test func theCurrentBranchHasNoMenuButItsUpstreamHas() {
#expect(ContextActions.entries(for: .branch(name: "dev", remote: false, current: "dev", isDirty: false)).isEmpty)
#expect(ContextActions.entries(for: .branch(name: "origin/dev", remote: true, current: "dev", isDirty: false)).count == 1)
}
@Test func theHeaderIsTheBranchName() {
#expect(ContextActions.header(for: .branch(name: "origin/feature", remote: true, current: "dev", isDirty: false),
projectName: "app") == "origin/feature")
}
}
@Suite struct TailLogContextMenuTests {
private func hasTailLog(_ target: ContextTarget) -> Bool {
ContextActions.entries(for: target).contains { entry in
guard case .action(.tailLog, _) = entry else { return false }
return true
}
}
@Test func aLogFileOffersTailLogInItsOwnGroupAfterTheCopyItems() {
let entries = ContextActions.entries(for: .file(path: "storage/logs/laravel.log"))
#expect(Array(entries[4...6]) == [
.separator,
.action(.tailLog("storage/logs/laravel.log"), label: "Tail log"),
.separator,
])
#expect(hasTailLog(.file(path: "LOGS/Error.LOG")))
}
@Test func otherFilesAndFoldersDoNot() {
#expect(!hasTailLog(.file(path: "src/app.php")))
#expect(!hasTailLog(.file(path: "notes.md")))
#expect(!hasTailLog(.file(path: "catalog")))
#expect(!hasTailLog(.directory(path: "storage/logs.log")))
#expect(!hasTailLog(.gitRow(path: "laravel.log", isDeleted: false)))
}
}