mirror of
https://github.com/BigMarc/grammargem.git
synced 2026-10-13 17:01:55 +02:00
Replace the NSSpellChecker + regex-stub engine with harper-core 2.5.0: real subject-verb agreement, verb forms, punctuation, repetition and spelling. New harper-ffi crate (staticlib) exposes harper_check over a C ABI; the CHarper module bridges it to Swift; HarperEngine maps Harper's char spans onto UTF-16 ranges and de-dups overlapping lints. NSSpellChecker stays only as a case-preserving spelling supplement, which fixes the problemm->Problem mis-casing. Bulk apply now skips no-op suggestions. build.sh / scripts/build.sh build the universal static lib; target/ and lib/ are gitignored (regenerate via harper-ffi/build.sh). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.6 KiB
Swift
44 lines
1.6 KiB
Swift
// swift-tools-version:5.10
|
|
import PackageDescription
|
|
import Foundation
|
|
|
|
// GrammaGem — native macOS menu-bar writing assistant.
|
|
//
|
|
// Layer-1 grammar is the real **Harper** core (Apache-2.0), embedded as a Rust
|
|
// C-FFI static library (see `harper-ffi/`). Build the lib first with
|
|
// `harper-ffi/build.sh` (universal arm64+x86_64 -> harper-ffi/lib/libharper_ffi.a);
|
|
// `scripts/build.sh` does this automatically. The remaining heavyweight pieces
|
|
// (MLX local LLM, Sparkle, KeyboardShortcuts) are still behind protocol seams.
|
|
|
|
// Absolute path to the prebuilt Harper static lib, independent of build cwd.
|
|
let packageRoot = URL(fileURLWithPath: #filePath).deletingLastPathComponent().path
|
|
let harperLibDir = packageRoot + "/harper-ffi/lib"
|
|
|
|
let package = Package(
|
|
name: "GrammaGem",
|
|
platforms: [
|
|
.macOS(.v14) // Apple Silicon, macOS 14+ (per the product spec)
|
|
],
|
|
products: [
|
|
.executable(name: "GrammaGem", targets: ["GrammaGem"])
|
|
],
|
|
targets: [
|
|
// C shim exposing libharper_ffi's C ABI (harper-ffi/include/harper.h) to Swift.
|
|
.target(name: "CHarper", path: "Sources/CHarper"),
|
|
.executableTarget(
|
|
name: "GrammaGem",
|
|
dependencies: ["CHarper"],
|
|
path: "Sources/GrammaGem",
|
|
linkerSettings: [
|
|
// Link the prebuilt universal Harper static library.
|
|
.unsafeFlags(["-L\(harperLibDir)", "-lharper_ffi"])
|
|
]
|
|
),
|
|
.testTarget(
|
|
name: "GrammaGemTests",
|
|
dependencies: ["GrammaGem"],
|
|
path: "Tests/GrammaGemTests"
|
|
),
|
|
]
|
|
)
|