Skip to Content
DevelopmentBuild and test

Development

Package structure

Buckler is a Swift 6 package with three targets:

TargetTypeDescription
BucklerCoreLibraryLocators, providers, matcher, storage, LLM client
bucklerExecutableCLI tool
BucklerAppExecutableMenu 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 build

The debug build lands in .build/debug/buckler. Run it with --help to see subcommands.

App bundle

./scripts/build-app.sh

This script:

  1. Builds the app target in release mode
  2. Creates Buckler.app with the correct bundle structure
  3. Copies the app icon and Info.plist
  4. 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 test

Run a specific test target:

swift test --filter BucklerCoreTests

Run one test class:

swift test --filter WindowLifecycleTests

End-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.sh

Options:

./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 screen

UI 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:

  1. It compiles scripts/e2e/ui-check.swift.
  2. It scans the fixture home and records one failed dispatch, so the Latest dispatch section has data.
  3. 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.
  4. It captures the status menu and the windows of that instance as PNG files.
  5. 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 now with Paused until and the end time. Resume restores Pause for 1 hour.
  • A tier row opens Findings with that tier filter on. Since yesterday turns 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 Buckler with 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 install

Development server:

pnpm dev

The site runs at http://localhost:3000. Edit MDX files in site/content/ and see live updates.

Build for production:

pnpm build

Dependencies

Declared in Package.swift, pinned in Package.resolved:

  • swift-argument-parser — CLI parsing
  • GRDB.swift — SQLite database access
  • TOMLKit — TOML config parsing

Update dependencies:

swift package update
Last updated on