Skip to content

Commit 3825858

Browse files
committed
Add AGENTS.md
1 parent c35398e commit 3825858

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# AGENTS.md
2+
3+
`trash` is a small Swift CLI that moves files/folders to the macOS Trash
4+
asynchronously (via `NSWorkspace.recycle`).
5+
6+
- `Sources/Trash/Trash.swift` — the entire app. `Trash.put` spins
7+
`CFRunLoopRun()`/`CFRunLoopStop` to block on `NSWorkspace.recycle`'s
8+
async-only completion handler — don't "simplify" this into an early return.
9+
- `Tests/TrashTests/TrashTests.swift` — XCTest suite.
10+
11+
## Build / test / run
12+
13+
```sh
14+
swift build
15+
swift test -v
16+
swift run trash <paths>
17+
swiftlint # same rules CI runs; no config file
18+
```
19+
20+
CI also runs `swiftlint` (default rules, no config file) before tests.
21+
22+
## Releasing
23+
24+
`Trash.swift`'s hardcoded `version` constant must be bumped to match the new
25+
tag *before* tagging (see e.g. commit "Cut 0.3.7"). The Homebrew formula test
26+
in `.goreleaser.yml` asserts `trash --version` matches the tag, so a missed
27+
bump fails the release even though the build succeeds.
28+
29+
## hack.go / goreleaser gotcha
30+
31+
`hack.go` is a one-line stub, not real application code — never edit it.
32+
goreleaser only builds Go projects, so `hack.go` just gives it a Go main
33+
package to point at; `.goreleaser.yml`'s `pre`/`post` hooks actually build
34+
the binary via `swift build -c release`. To change the build, edit
35+
`.goreleaser.yml` or `Package.swift`, not `hack.go`.

0 commit comments

Comments
 (0)