Repository navigation
Expand file tree
/
Copy pathPackage.swift
More file actions
124 lines (123 loc) · 7.28 KB
/
Copy pathPackage.swift
File metadata and controls
124 lines (123 loc) · 7.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "termio",
defaultLocalization: "en",
platforms: [.macOS(.v14)],
dependencies: [
// libghostty (Ghostty's terminal core), via our termio-sh/libghostty-swift
// fork of Lakr233/libghostty-spm (ships the `GhosttyTerminal` Swift wrapper —
// incl. the host-managed `.inMemory` backend the daemon feeds — plus a prebuilt
// GhosttyKit.xcframework, so no zig toolchain here). Same package the iOS app
// uses, so both platforms track one dependency. The 2026-07 "fork regressed
// live resize" suspicion that briefly rolled this back to Lakr233 was a
// misdiagnosis — the real bug was termio's own PTY spawn shape (see
// docs/bug/terminal-resize-no-reflow-HANDOFF.md §0).
.package(url: "https://github.com/termio-sh/libghostty-swift", from: "1.2.0"),
// Sparkle powers in-app auto-update (the "Check for Updates…" menu item and
// background update checks). It reads the appcast published with each GitHub
// release; the matching EdDSA public key is embedded in packaging/Info.plist.
.package(url: "https://github.com/sparkle-project/Sparkle.git", from: "2.6.0"),
// Highlightr (the highlight.js wrapper powering the file editor) is VENDORED
// at Sources/termio/Editor/Highlightr, not a dependency: `swift build` bakes a
// dependency's `Bundle.module` accessor with only the .app root + a build-machine
// path, so CI-built releases crashed on `Highlightr.init` (v0.2.4). See the
// vendor README.
// swift-markdown — Apple's cmark-gfm wrapper (the parser behind DocC). Parses
// agent messages for the session trace; `TraceMarkdown` walks the AST and emits
// escaped HTML. Apache-2.0.
.package(url: "https://github.com/swiftlang/swift-markdown.git", from: "0.5.0"),
// Code shared with the iOS companion app — the companion wire protocol
// (roster + control messages) lives here so both ends stay in sync.
.package(path: "Shared"),
],
targets: [
.executableTarget(
name: "termio",
dependencies: [
.product(name: "GhosttyTerminal", package: "libghostty-swift"),
// The raw libghostty C API. Used by session control to deliver a real
// Return key event (`ghostty_surface_key`) when driving a sibling.
.product(name: "GhosttyKit", package: "libghostty-swift"),
// Bundled color-scheme catalog (Ghostty's built-in themes), used by
// the appearance settings to offer a theme picker.
.product(name: "GhosttyTheme", package: "libghostty-swift"),
// libghostty-vt on its own: the terminal a `vt_stream` session
// keeps on this side (TermiodStreamTerminal). Built from the same
// ghostty as termiod's VT, with only its C API left global so it
// links beside GhosttyKit.
.product(name: "GhosttyVt", package: "libghostty-swift"),
.product(name: "Sparkle", package: "Sparkle"),
.product(name: "Markdown", package: "swift-markdown"),
.product(name: "TermioShared", package: "Shared"),
.product(name: "TermioStream", package: "Shared"),
],
path: "Sources/termio",
// The vendored Highlightr copy ships its own README; it's documentation, not
// a build input, so exclude it rather than let SwiftPM flag it as unhandled.
exclude: [
"Editor/Highlightr/README.md",
// The String Catalog is the *editing* source for UI strings, not a
// shippable resource: `swift build` can't compile .xcstrings
// (swiftlang/swift-package-manager#6993), so scripts/compile-strings.sh
// compiles it into Resources/Localization, which ships instead.
"Resources/Localizable.xcstrings",
],
resources: [
// Process app assets into the resource-bundle root so existing
// name-based lookups stay stable. Agent manifests are copied as a
// directory because the catalog intentionally enumerates only it —
// and that directory is coding agents only. The plain shell is a
// session kind, not a manageable agent, so its manifest sits apart at
// the bundle root, loaded by name (see AgentCatalog.loadBundledShell).
.process("Resources/assets"),
// The Markdown reader's prose face (iA Writer Quattro V, variable
// wght 400–700), embedded into the reader HTML as base64 @font-face
// by `MarkdownReaderRenderer`. `.process` flattens the woff2s to the
// bundle root, where the name-based lookup expects them.
.process("Resources/Fonts"),
.copy("Resources/agents"),
.copy("Resources/terminal.json"),
// UI strings: per-language .lproj folders generated from the String
// Catalog by scripts/compile-strings.sh. Every lookup must pass
// `Bundle.termioResources` explicitly — `String(localized:)`'s
// default of `Bundle.main` holds no strings in a packaged .app.
// Each .lproj is a verbatim `.copy`, one entry per language:
// `.process` lowercases the folder to `zh-hans.lproj`, and
// CFBundle's language matching is case-sensitive about the script
// subtag, so a processed zh-Hans silently resolves to English.
.copy("Resources/Localization/en.lproj"),
.copy("Resources/Localization/zh-Hans.lproj"),
// Agent skills installed into ~/.claude/skills and ~/.codex/skills
// by SessionSkillInstaller, kept as real markdown files. Folder copy
// so the skill-folder layout survives into the bundle.
.copy("Resources/skills"),
// Devicon language/tool logos (one SVG per file type), loaded by name
// for the file tree; see LangIconCatalog / LangIconView. Kept as a
// folder copy (not `.process`) so the lookup subdirectory survives.
.copy("LangIcons"),
],
swiftSettings: [
.swiftLanguageMode(.v6),
]
),
.testTarget(
name: "termioTests",
dependencies: [
"termio",
// The shared diff model the iOS reader parses with — pure logic,
// so it is tested here rather than in an Xcode-only test bundle.
.product(name: "TermioShared", package: "Shared"),
.product(name: "TermioStream", package: "Shared"),
],
path: "Tests/termioTests",
// The Markdown feature sheet is both the end-to-end fixture
// `MarkdownFeatureSheetTests` renders and the document to open in the
// reader when judging the result by eye.
resources: [.copy("Fixtures")],
swiftSettings: [
.swiftLanguageMode(.v5),
]
),
]
)