Development
Package structure
Buckler is a Swift 6 package with three targets:
| Target | Type | Description |
|---|---|---|
BucklerCore | Library | Locators, providers, matcher, storage, LLM client |
buckler | Executable | CLI tool |
BucklerApp | Executable | Menu bar application |
Test targets:
BucklerCoreTests— Core library tests (locator fixtures, matcher logic, provider parsing)BucklerAppTests— Application tests (window lifecycle, view models)
Building
CLI and library
swift buildThe debug build lands in .build/debug/buckler. Run it with --help to see subcommands.
App bundle
./scripts/build-app.shThis script:
- Builds the app target in release mode
- Creates
Buckler.appwith the correct bundle structure - Copies the app icon and
Info.plist - Signs the bundle (ad-hoc for local builds, Developer ID for release)
The built app is at .build/apple/Products/Release/Buckler.app.
Testing
Run all tests:
swift testRun a specific test target:
swift test --filter BucklerCoreTestsRun one test class:
swift test --filter WindowLifecycleTestsEnd-to-end tests
The scripts/e2e.sh script runs complete end-to-end tests. It builds the CLI and app. It creates a fixture home directory with test projects. It runs scans, dispatch, and other features without touching your real data. By default it opens no menu or window and sends no keys, so you can use the Mac while it runs. The default run fails if the test instance comes to the front.
Run the default checks:
./scripts/e2e.shOptions:
./scripts/e2e.sh --skip-build # Uses existing .build/release/buckler
./scripts/e2e.sh --skip-app # CLI tests only
./scripts/e2e.sh --ui # Also drives the app UI and takes over the screenUI tests
The UI step runs only with --ui. It tests the built app through its real user interface: windows, menus, toolbars, and keyboard shortcuts. It uses only the app instance that e2e.sh starts with the fixture home. It does not touch the app that you use.
The step opens menus and windows on your screen, brings them to the front, and sends keys. Do not use the Mac while it runs: your input can close a menu or move the focus, and then a check fails. swift test renders the windows and the status menu offscreen, so most view changes do not need the UI step.
Before you run it, give Accessibility and Screen Recording permission to the terminal app (System Settings › Privacy & Security).
The menu bar must be visible while the step runs. A full-screen app hides the menu bar, and then the Accessibility API cannot find the status item of the test instance. Leave full screen before you run e2e.sh --ui.
The step does these tasks:
- It compiles
scripts/e2e/ui-check.swift. - It scans the fixture home and records one failed dispatch, so the Latest dispatch section has data.
- It starts the app and uses the Accessibility API to choose status menu items, press buttons and read values. It sends keys only to that app instance.
- It captures the status menu and the windows of that instance as PNG files.
- It stops the instance, starts a second instance in dark appearance and does the menu and toolbar checks again.
The step checks these items:
- The status menu rows, and a tier icon in front of each colored tier row.
- Findings, Providers and Settings open, close and open again five times each. The app stays alive and writes no crash report.
- Pause shows
Resume nowwithPaused untiland the end time. Resume restoresPause for 1 hour. - A tier row opens Findings with that tier filter on.
Since yesterdayturns on and off. - The Latest dispatch section shows the failed dispatch.
- Cmd-1, Cmd-2, Cmd-comma, Cmd-F, Escape and Tab. Cmd-W closes Findings, Providers and Settings.
- VoiceOver reads the status item as
Bucklerwith the current state as its value. - Tab moves through Findings, Providers and Settings and does not lose the focus. Tab reaches the search field and the list in Findings, the table in Providers, and the text fields in Settings. If Keyboard navigation is on in System Settings › Keyboard, Tab must also reach buttons. The step writes the order of the stops to
tab-order-light.txt. - The Findings window opens again at the position where it closed.
- The Providers table sorts by a column, and the Inspector button shows provider details.
The step also measures spacing from the Accessibility frames (toolbar gaps, row heights, column widths, form row gaps) and writes it to spacing-light.txt. These values are for the design review. They do not make the step fail.
The PNG files go to $E2E_EVIDENCE_DIR. If you do not set it, the script makes a temporary directory and prints its path at the end, after UI evidence:.
Two checks need a person. A title-bar drag needs the real pointer. A menu choice made through the Accessibility API does not let macOS bring the app to the front, so the step reports window-front as skipped unless the app came to the front. Do these two checks by hand with a real click.
While the step runs, the test instance comes to the front and takes the keyboard focus for some seconds.
Documentation site
The docs site is a Nextra 4 project in the site/ directory.
Install dependencies:
cd site
pnpm installDevelopment server:
pnpm devThe site runs at http://localhost:3000. Edit MDX files in site/content/ and see live updates.
Build for production:
pnpm buildDependencies
Declared in Package.swift, pinned in Package.resolved:
swift-argument-parser— CLI parsingGRDB.swift— SQLite database accessTOMLKit— TOML config parsing
Update dependencies:
swift package update