From 6c61d8af5aaa70ba591afa3603c7cbc42cbcdd5c Mon Sep 17 00:00:00 2001 From: AliceSaikawa <94857789+AliceSaikawa@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:14:53 +0900 Subject: [PATCH 1/7] build(scripts): add rsync and SSH runner for the Mac scripts/mac syncs the Linux checkout to a per-worktree directory on the Mac and runs scripts/on-mac/ there. bootstrap installs the Brewfile tools. --- .gitignore | 6 +++++ AGENTS.md | 23 ++++++++++++++++++ Brewfile | 3 +++ scripts/mac | 51 ++++++++++++++++++++++++++++++++++++++++ scripts/on-mac/bootstrap | 11 +++++++++ 5 files changed, 94 insertions(+) create mode 100644 .gitignore create mode 100644 AGENTS.md create mode 100644 Brewfile create mode 100755 scripts/mac create mode 100755 scripts/on-mac/bootstrap diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5c7e6ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.DS_Store +.build/ +.swiftpm/ +DerivedData/ +*.xcodeproj/ +Brewfile.lock.json diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..5895cb2 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,23 @@ +# AGENTS.md + +仕様は [docs/spec.md](docs/spec.md) を正とする。決定には `D-xx` の ID が付いている。 + +## 判断が要る規則 + +ここには、仕組みで強制できない判断だけを書く。 + +- 設定画面の項目は、頻繁に変えるもの(触覚、トグル入力、変換モデル)に限る。それ以外の調整はコードを書き換えてビルドし直す(D-40)。項目を足す前に、本当に頻繁に変えるかを確かめる。 +- 同じ種類の誤りが2回起きたら、下の「観察中の誤り」から規則に格上げし、強制手段(設計、型、リンター、テストの順に検討)を同じ変更で足す。1回目は「観察中の誤り」に記録するだけにする。 + +## 規則と強制手段 + +| 規則 | 強制手段 | +|---|---| +| Mac でのビルド・テスト・インストールは `scripts/mac ` を通す。Linux に Swift を入れない(D-63) | 設計:`scripts/mac` が同期と SSH 実行を受け持ち、Mac 側の手順は `scripts/on-mac/` だけに置く | +| 設定画面の項目を増やさない(D-40) | 文書:上の「判断が要る規則」 | + +## 観察中の誤り + +1回起きた誤りを、日付と PR のリンク付きで記録する。2回目が起きたら規則に格上げする。 + +(まだない) diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..d114854 --- /dev/null +++ b/Brewfile @@ -0,0 +1,3 @@ +brew "xcodegen" +brew "swiftlint" +brew "swiftformat" diff --git a/scripts/mac b/scripts/mac new file mode 100755 index 0000000..5b4902d --- /dev/null +++ b/scripts/mac @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# Linux 上のリポジトリを Mac に同期し、scripts/on-mac/ を SSH 越しに実行する(D-63)。 +set -euo pipefail + +repo_root=$(git -C "$(dirname "$0")" rev-parse --show-toplevel) +remote_dir="dev/practical-sync/$(basename "$repo_root")" +ssh_opts=(-F "$HOME/.ssh/config") + +usage() { + cat < [args...] + +Commands: + sync Mac の ~/$remote_dir に同期するだけ +$(cd "$repo_root/scripts/on-mac" && for f in *; do [[ -x $f ]] && printf ' %s\n' "$f"; done) + + は同期してから scripts/on-mac/ を Mac で実行する。 +EOF +} + +sync_to_mac() { + ssh "${ssh_opts[@]}" mac "mkdir -p ~/$remote_dir" + rsync -az --delete \ + --exclude=/.git --exclude=/.agents \ + --exclude-from="$repo_root/.gitignore" \ + -e "ssh ${ssh_opts[*]}" \ + "$repo_root/" "mac:$remote_dir/" +} + +run_on_mac() { + local tty=() + [[ -t 0 && -t 1 ]] && tty=(-t) + ssh "${ssh_opts[@]}" "${tty[@]}" mac \ + "export PATH=/opt/homebrew/bin:\$PATH; cd ~/$remote_dir && $(printf '%q ' "$@")" +} + +command=${1:-} +case $command in + "" | -h | --help) usage ;; + sync) sync_to_mac ;; + *) + if [[ ! -x $repo_root/scripts/on-mac/$command ]]; then + echo "unknown command: $command" >&2 + usage >&2 + exit 64 + fi + shift + sync_to_mac + run_on_mac "scripts/on-mac/$command" "$@" + ;; +esac diff --git a/scripts/on-mac/bootstrap b/scripts/on-mac/bootstrap new file mode 100755 index 0000000..1dca0fd --- /dev/null +++ b/scripts/on-mac/bootstrap @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/../.." + +brew bundle --file=Brewfile --quiet + +xcodebuild -version | head -1 +swift --version 2>&1 | head -1 +echo "xcodegen $(xcodegen --version)" +echo "swiftlint $(swiftlint version)" +echo "swiftformat $(swiftformat --version)" From d046ddcd2f188b631f6307451ee42b56f60e0e90 Mon Sep 17 00:00:00 2001 From: AliceSaikawa <94857789+AliceSaikawa@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:15:39 +0900 Subject: [PATCH 2/7] build(package): add PracticalKit with KeyboardCore test target scripts/mac test runs swift test on the Mac host. The package uses the Swift 6 language mode and treats warnings as errors. --- AGENTS.md | 3 +++ PracticalKit/Package.swift | 17 +++++++++++++++++ .../Sources/KeyboardCore/KeyboardCore.swift | 0 .../KeyboardCoreTests/KeyboardCoreTests.swift | 2 ++ scripts/on-mac/test | 4 ++++ 5 files changed, 26 insertions(+) create mode 100644 PracticalKit/Package.swift create mode 100644 PracticalKit/Sources/KeyboardCore/KeyboardCore.swift create mode 100644 PracticalKit/Tests/KeyboardCoreTests/KeyboardCoreTests.swift create mode 100755 scripts/on-mac/test diff --git a/AGENTS.md b/AGENTS.md index 5895cb2..7604d83 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,6 +15,9 @@ |---|---| | Mac でのビルド・テスト・インストールは `scripts/mac ` を通す。Linux に Swift を入れない(D-63) | 設計:`scripts/mac` が同期と SSH 実行を受け持ち、Mac 側の手順は `scripts/on-mac/` だけに置く | | 設定画面の項目を増やさない(D-40) | 文書:上の「判断が要る規則」 | +| 入力・変換・設定のロジックは共有パッケージ `PracticalKit` に置く(D-60) | 設計:単体テストは `PracticalKit` にしかない(`scripts/mac test`) | +| テストするモジュールは UIKit に依存しない(D-61) | 設計:テストを macOS の `swift test` で実行するため、`import UIKit` があるとビルドが失敗する | +| 自分で書く Swift は Swift 6 言語モードで、警告を残さない | 型:`Package.swift` の `swiftLanguageModes: [.v6]` と `treatAllWarnings(as: .error)` | ## 観察中の誤り diff --git a/PracticalKit/Package.swift b/PracticalKit/Package.swift new file mode 100644 index 0000000..dfc9742 --- /dev/null +++ b/PracticalKit/Package.swift @@ -0,0 +1,17 @@ +// swift-tools-version: 6.2 +import PackageDescription + +let strict: [SwiftSetting] = [.treatAllWarnings(as: .error)] + +let package = Package( + name: "PracticalKit", + platforms: [.iOS(.v17)], + products: [ + .library(name: "KeyboardCore", targets: ["KeyboardCore"]), + ], + targets: [ + .target(name: "KeyboardCore", swiftSettings: strict), + .testTarget(name: "KeyboardCoreTests", dependencies: ["KeyboardCore"], swiftSettings: strict), + ], + swiftLanguageModes: [.v6] +) diff --git a/PracticalKit/Sources/KeyboardCore/KeyboardCore.swift b/PracticalKit/Sources/KeyboardCore/KeyboardCore.swift new file mode 100644 index 0000000..e69de29 diff --git a/PracticalKit/Tests/KeyboardCoreTests/KeyboardCoreTests.swift b/PracticalKit/Tests/KeyboardCoreTests/KeyboardCoreTests.swift new file mode 100644 index 0000000..2c10b4c --- /dev/null +++ b/PracticalKit/Tests/KeyboardCoreTests/KeyboardCoreTests.swift @@ -0,0 +1,2 @@ +import Testing +@testable import KeyboardCore diff --git a/scripts/on-mac/test b/scripts/on-mac/test new file mode 100755 index 0000000..b9ce0b5 --- /dev/null +++ b/scripts/on-mac/test @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/../../PracticalKit" +swift test "$@" From 56a6b7bb5bb841e157e6610169c07188a6f29554 Mon Sep 17 00:00:00 2001 From: AliceSaikawa <94857789+AliceSaikawa@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:16:49 +0900 Subject: [PATCH 3/7] chore(lint): add SwiftFormat and SwiftLint scripts/mac lint runs swiftformat --lint and swiftlint --strict on the Mac. scripts/mac format formats on the Mac and copies the tracked Swift files back. SwiftLint drops opening_brace and trailing_comma because SwiftFormat owns them. --- .swiftformat | 2 ++ .swiftlint.yml | 7 +++++++ AGENTS.md | 1 + PracticalKit/Package.swift | 2 +- .../Tests/KeyboardCoreTests/KeyboardCoreTests.swift | 2 +- scripts/mac | 7 +++++++ scripts/on-mac/format | 4 ++++ scripts/on-mac/lint | 5 +++++ 8 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .swiftformat create mode 100644 .swiftlint.yml create mode 100755 scripts/on-mac/format create mode 100755 scripts/on-mac/lint diff --git a/.swiftformat b/.swiftformat new file mode 100644 index 0000000..2be846e --- /dev/null +++ b/.swiftformat @@ -0,0 +1,2 @@ +--swiftversion 6.2 +--exclude .build,**/.build,DerivedData diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..dd589bb --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,7 @@ +excluded: + - .build + - PracticalKit/.build + - DerivedData +disabled_rules: + - opening_brace + - trailing_comma diff --git a/AGENTS.md b/AGENTS.md index 7604d83..17eb0bc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -17,6 +17,7 @@ | 設定画面の項目を増やさない(D-40) | 文書:上の「判断が要る規則」 | | 入力・変換・設定のロジックは共有パッケージ `PracticalKit` に置く(D-60) | 設計:単体テストは `PracticalKit` にしかない(`scripts/mac test`) | | テストするモジュールは UIKit に依存しない(D-61) | 設計:テストを macOS の `swift test` で実行するため、`import UIKit` があるとビルドが失敗する | +| Swift の整形は手で直さず `scripts/mac format` で揃える | リンター:`scripts/mac lint`(`swiftformat --lint` と `swiftlint --strict`)。独自ルールは足さず、2回起きた誤りだけを足す | | 自分で書く Swift は Swift 6 言語モードで、警告を残さない | 型:`Package.swift` の `swiftLanguageModes: [.v6]` と `treatAllWarnings(as: .error)` | ## 観察中の誤り diff --git a/PracticalKit/Package.swift b/PracticalKit/Package.swift index dfc9742..023f31e 100644 --- a/PracticalKit/Package.swift +++ b/PracticalKit/Package.swift @@ -13,5 +13,5 @@ let package = Package( .target(name: "KeyboardCore", swiftSettings: strict), .testTarget(name: "KeyboardCoreTests", dependencies: ["KeyboardCore"], swiftSettings: strict), ], - swiftLanguageModes: [.v6] + swiftLanguageModes: [.v6], ) diff --git a/PracticalKit/Tests/KeyboardCoreTests/KeyboardCoreTests.swift b/PracticalKit/Tests/KeyboardCoreTests/KeyboardCoreTests.swift index 2c10b4c..6495f5e 100644 --- a/PracticalKit/Tests/KeyboardCoreTests/KeyboardCoreTests.swift +++ b/PracticalKit/Tests/KeyboardCoreTests/KeyboardCoreTests.swift @@ -1,2 +1,2 @@ -import Testing @testable import KeyboardCore +import Testing diff --git a/scripts/mac b/scripts/mac index 5b4902d..3779434 100755 --- a/scripts/mac +++ b/scripts/mac @@ -15,6 +15,7 @@ Commands: $(cd "$repo_root/scripts/on-mac" && for f in *; do [[ -x $f ]] && printf ' %s\n' "$f"; done) は同期してから scripts/on-mac/ を Mac で実行する。 +format だけは、Mac で整形した *.swift をこのリポジトリに書き戻す。 EOF } @@ -27,6 +28,11 @@ sync_to_mac() { "$repo_root/" "mac:$remote_dir/" } +pull_swift_from_mac() { + git -C "$repo_root" ls-files -co --exclude-standard -- '*.swift' | + rsync -az --files-from=- -e "ssh ${ssh_opts[*]}" "mac:$remote_dir/" "$repo_root/" +} + run_on_mac() { local tty=() [[ -t 0 && -t 1 ]] && tty=(-t) @@ -47,5 +53,6 @@ case $command in shift sync_to_mac run_on_mac "scripts/on-mac/$command" "$@" + if [[ $command == format ]]; then pull_swift_from_mac; fi ;; esac diff --git a/scripts/on-mac/format b/scripts/on-mac/format new file mode 100755 index 0000000..4c89615 --- /dev/null +++ b/scripts/on-mac/format @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/../.." +swiftformat --quiet . diff --git a/scripts/on-mac/lint b/scripts/on-mac/lint new file mode 100755 index 0000000..f947d64 --- /dev/null +++ b/scripts/on-mac/lint @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/../.." +swiftformat --lint . +swiftlint lint --strict --quiet From f5ddbe635b1b52c9c87141eeeeadd5c3e5305ed3 Mon Sep 17 00:00:00 2001 From: AliceSaikawa <94857789+AliceSaikawa@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:18:49 +0900 Subject: [PATCH 4/7] build(xcodegen): generate app and keyboard extension from project.yml scripts/mac build generates Practical.xcodeproj and builds an unsigned generic iOS build. The keyboard extension requests open access and links KeyboardCore. --- .gitignore | 1 + AGENTS.md | 5 ++- App/PracticalApp.swift | 10 +++++ Keyboard/KeyboardViewController.swift | 19 ++++++++ project.yml | 64 +++++++++++++++++++++++++++ scripts/on-mac/build | 9 ++++ scripts/on-mac/gen | 4 ++ 7 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 App/PracticalApp.swift create mode 100644 Keyboard/KeyboardViewController.swift create mode 100644 project.yml create mode 100755 scripts/on-mac/build create mode 100755 scripts/on-mac/gen diff --git a/.gitignore b/.gitignore index 5c7e6ac..2a31fef 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ DerivedData/ *.xcodeproj/ Brewfile.lock.json +Keyboard/Info.plist diff --git a/AGENTS.md b/AGENTS.md index 17eb0bc..a1897bb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,10 +15,13 @@ |---|---| | Mac でのビルド・テスト・インストールは `scripts/mac ` を通す。Linux に Swift を入れない(D-63) | 設計:`scripts/mac` が同期と SSH 実行を受け持ち、Mac 側の手順は `scripts/on-mac/` だけに置く | | 設定画面の項目を増やさない(D-40) | 文書:上の「判断が要る規則」 | +| Xcode の設定は `project.yml` だけで変える。`.xcodeproj` と拡張の `Info.plist` は生成物で、Git に入れない(D-62) | 設計:`.gitignore` で除外し、`scripts/on-mac/gen` が毎回生成する | +| iPhone のみ・iOS 17 以上、完全アクセスを求める、Bundle ID は `APP_BUNDLE_ID` から作る(D-03、D-04、D-64) | 設計:`project.yml` の1か所で定義する。`Package.swift` の `.iOS(.v17)` もそろえる | +| UI テストのターゲットを作らない(D-72) | 設計:`project.yml` にテストターゲットを置かない。テストは `PracticalKit` だけ | | 入力・変換・設定のロジックは共有パッケージ `PracticalKit` に置く(D-60) | 設計:単体テストは `PracticalKit` にしかない(`scripts/mac test`) | | テストするモジュールは UIKit に依存しない(D-61) | 設計:テストを macOS の `swift test` で実行するため、`import UIKit` があるとビルドが失敗する | | Swift の整形は手で直さず `scripts/mac format` で揃える | リンター:`scripts/mac lint`(`swiftformat --lint` と `swiftlint --strict`)。独自ルールは足さず、2回起きた誤りだけを足す | -| 自分で書く Swift は Swift 6 言語モードで、警告を残さない | 型:`Package.swift` の `swiftLanguageModes: [.v6]` と `treatAllWarnings(as: .error)` | +| 自分で書く Swift は Swift 6 言語モードで、警告を残さない | 型:`Package.swift` の `swiftLanguageModes: [.v6]` と `treatAllWarnings(as: .error)`、`project.yml` の `SWIFT_VERSION: "6.0"` と `SWIFT_TREAT_WARNINGS_AS_ERRORS` | ## 観察中の誤り diff --git a/App/PracticalApp.swift b/App/PracticalApp.swift new file mode 100644 index 0000000..f5de25e --- /dev/null +++ b/App/PracticalApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct PracticalApp: App { + var body: some Scene { + WindowGroup { + Text("Practical") + } + } +} diff --git a/Keyboard/KeyboardViewController.swift b/Keyboard/KeyboardViewController.swift new file mode 100644 index 0000000..d3ac049 --- /dev/null +++ b/Keyboard/KeyboardViewController.swift @@ -0,0 +1,19 @@ +import SwiftUI +import UIKit + +final class KeyboardViewController: UIInputViewController { + override func viewDidLoad() { + super.viewDidLoad() + let host = UIHostingController(rootView: Text("Practical").frame(maxWidth: .infinity, minHeight: 216)) + addChild(host) + host.view.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(host.view) + NSLayoutConstraint.activate([ + host.view.leadingAnchor.constraint(equalTo: view.leadingAnchor), + host.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), + host.view.topAnchor.constraint(equalTo: view.topAnchor), + host.view.bottomAnchor.constraint(equalTo: view.bottomAnchor), + ]) + host.didMove(toParent: self) + } +} diff --git a/project.yml b/project.yml new file mode 100644 index 0000000..0f18096 --- /dev/null +++ b/project.yml @@ -0,0 +1,64 @@ +name: Practical +options: + deploymentTarget: + iOS: "17.0" +packages: + PracticalKit: + path: PracticalKit +settings: + base: + APP_BUNDLE_ID: com.alicesaikawa.practical + DEVELOPMENT_TEAM: DPDNZ82WD8 + CODE_SIGN_STYLE: Automatic + MARKETING_VERSION: "0.1" + CURRENT_PROJECT_VERSION: "1" + TARGETED_DEVICE_FAMILY: "1" + SWIFT_VERSION: "6.0" + SWIFT_TREAT_WARNINGS_AS_ERRORS: YES + GCC_TREAT_WARNINGS_AS_ERRORS: YES +targets: + Practical: + type: application + platform: iOS + sources: [App] + dependencies: + - target: PracticalKeyboard + - package: PracticalKit + product: KeyboardCore + settings: + base: + PRODUCT_BUNDLE_IDENTIFIER: $(APP_BUNDLE_ID) + GENERATE_INFOPLIST_FILE: YES + INFOPLIST_KEY_CFBundleDisplayName: Practical + INFOPLIST_KEY_UILaunchScreen_Generation: YES + INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait + INFOPLIST_KEY_UIRequiresFullScreen: YES + PracticalKeyboard: + type: app-extension + platform: iOS + sources: [Keyboard] + dependencies: + - package: PracticalKit + product: KeyboardCore + info: + path: Keyboard/Info.plist + properties: + CFBundleDisplayName: Practical + CFBundleShortVersionString: $(MARKETING_VERSION) + CFBundleVersion: $(CURRENT_PROJECT_VERSION) + NSExtension: + NSExtensionPointIdentifier: com.apple.keyboard-service + NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).KeyboardViewController + NSExtensionAttributes: + PrimaryLanguage: ja-JP + IsASCIICapable: false + PrefersRightToLeft: false + RequestsOpenAccess: true + settings: + base: + PRODUCT_BUNDLE_IDENTIFIER: $(APP_BUNDLE_ID).keyboard +schemes: + Practical: + build: + targets: + Practical: all diff --git a/scripts/on-mac/build b/scripts/on-mac/build new file mode 100755 index 0000000..2bdec1b --- /dev/null +++ b/scripts/on-mac/build @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/../.." +scripts/on-mac/gen +xcodebuild build -quiet \ + -project Practical.xcodeproj -scheme Practical \ + -destination generic/platform=iOS \ + -derivedDataPath DerivedData \ + CODE_SIGNING_ALLOWED=NO "$@" diff --git a/scripts/on-mac/gen b/scripts/on-mac/gen new file mode 100755 index 0000000..e9e2266 --- /dev/null +++ b/scripts/on-mac/gen @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/../.." +xcodegen generate --quiet From ed587ebca2e5432aede17436f806c11e665f37e9 Mon Sep 17 00:00:00 2001 From: AliceSaikawa <94857789+AliceSaikawa@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:19:58 +0900 Subject: [PATCH 5/7] build(scripts): install signed build on iPhone with devicectl scripts/mac install picks the connected iPhone, unlocks the login keychain when it is locked, builds with automatic provisioning, then installs and launches the app. docs/device-checklist.md lists the manual steps. --- AGENTS.md | 2 ++ docs/device-checklist.md | 17 +++++++++++++++++ scripts/on-mac/install | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 docs/device-checklist.md create mode 100755 scripts/on-mac/install diff --git a/AGENTS.md b/AGENTS.md index a1897bb..3aaa676 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,6 +14,8 @@ | 規則 | 強制手段 | |---|---| | Mac でのビルド・テスト・インストールは `scripts/mac ` を通す。Linux に Swift を入れない(D-63) | 設計:`scripts/mac` が同期と SSH 実行を受け持ち、Mac 側の手順は `scripts/on-mac/` だけに置く | +| 実機へのインストールは `scripts/mac install` で行い、無料アカウントで署名する(D-01) | 設計:`project.yml` の `DEVELOPMENT_TEAM` と `scripts/on-mac/install` の `-allowProvisioningUpdates` | +| 触覚、実際の文字入力、メモリ、遅延は実機で確かめる(D-71) | 文書:[docs/device-checklist.md](docs/device-checklist.md)。機能を足す PR が確認項目を足す | | 設定画面の項目を増やさない(D-40) | 文書:上の「判断が要る規則」 | | Xcode の設定は `project.yml` だけで変える。`.xcodeproj` と拡張の `Info.plist` は生成物で、Git に入れない(D-62) | 設計:`.gitignore` で除外し、`scripts/on-mac/gen` が毎回生成する | | iPhone のみ・iOS 17 以上、完全アクセスを求める、Bundle ID は `APP_BUNDLE_ID` から作る(D-03、D-04、D-64) | 設計:`project.yml` の1か所で定義する。`Package.swift` の `.iOS(.v17)` もそろえる | diff --git a/docs/device-checklist.md b/docs/device-checklist.md new file mode 100644 index 0000000..89315c8 --- /dev/null +++ b/docs/device-checklist.md @@ -0,0 +1,17 @@ +# 実機チェックリスト + +単体テストで確かめられないことを、iPhone で確かめる手順(D-71)。機能を足す PR は、その機能の確認項目をここに足す。 + +## インストール + +無料の開発者アカウントの署名は7日で切れる(D-01)。切れたら同じ手順で入れ直す。 + +1. iPhone を Mac につなぎ、ロックを解除する。 +2. Linux で `scripts/mac install` を実行する。ログインキーチェーンにロックがかかっていれば、Mac のログインパスワードを聞かれる。 +3. 初回だけ、iPhone の「設定 > 一般 > VPN とデバイス管理」で開発元を信頼する。 +4. 初回だけ、「設定 > 一般 > キーボード > キーボード > 新しいキーボードを追加」で「Practical」を追加し、「フルアクセスを許可」をオンにする(D-04)。 + +## 確認すること + +- [ ] アプリが起動し、「Practical」と表示される。 +- [ ] 任意のアプリの文字入力で地球儀キーから Practical に切り替えると、「Practical」と表示されたキーボードが出る。 diff --git a/scripts/on-mac/install b/scripts/on-mac/install new file mode 100755 index 0000000..ff42455 --- /dev/null +++ b/scripts/on-mac/install @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "$0")/../.." + +devices_json=$(mktemp) +trap 'rm -f "$devices_json"' EXIT +xcrun devicectl list devices --quiet --json-output "$devices_json" +device=${DEVICE:-$(jq -r ' + [.result.devices[] + | select(.hardwareProperties.reality == "physical" + and .hardwareProperties.deviceType == "iPhone" + and .connectionProperties.tunnelState != "unavailable") + ][0].hardwareProperties.udid // empty' "$devices_json")} +if [[ -z $device ]]; then + echo "接続中の iPhone がない。iPhone をつないでロックを解除し、もう一度実行する" >&2 + exit 69 +fi + +keychain=~/Library/Keychains/login.keychain-db +if ! security show-keychain-info "$keychain" >/dev/null 2>&1; then + echo "コード署名のためにログインキーチェーンを解錠する(パスワードは保存しない)" >&2 + security unlock-keychain "$keychain" +fi + +scripts/on-mac/gen +xcodebuild build -quiet \ + -project Practical.xcodeproj -scheme Practical \ + -destination generic/platform=iOS \ + -derivedDataPath DerivedData \ + -allowProvisioningUpdates "$@" + +app=DerivedData/Build/Products/Debug-iphoneos/Practical.app +bundle_id=$(/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' "$app/Info.plist") +xcrun devicectl device install app --quiet --device "$device" "$app" +xcrun devicectl device process launch --quiet --device "$device" "$bundle_id" +echo "インストールして起動した:$bundle_id → $device" From a0eb7b19a2eb7cb7b667cc8d12d6e814ef491719 Mon Sep 17 00:00:00 2001 From: AliceSaikawa <94857789+AliceSaikawa@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:20:06 +0900 Subject: [PATCH 6/7] ci: run lint, package tests, and build on macOS runner The workflow calls the same scripts/on-mac scripts that scripts/mac runs over SSH. --- .github/workflows/check.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..4bb5585 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,16 @@ +name: check + +on: + pull_request: + push: + branches: [main] + +jobs: + check: + runs-on: macos-latest + steps: + - uses: actions/checkout@v5 + - run: scripts/on-mac/bootstrap + - run: scripts/on-mac/lint + - run: scripts/on-mac/test + - run: scripts/on-mac/build From 848fa263b4466a7df7bc9a05030d2eb091ec6e76 Mon Sep 17 00:00:00 2001 From: AliceSaikawa <94857789+AliceSaikawa@users.noreply.github.com> Date: Thu, 19 Nov 2026 21:59:25 +0900 Subject: [PATCH 7/7] fix(scripts): read version lines without closing the pipe early head exits after the first line, so xcodebuild -version hit a broken pipe on its second line and aborted. With pipefail this failed bootstrap on CI intermittently. sed -n 1p reads all input and prints only the first line. AI-Harness: Claude Code AI-Model: claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 --- scripts/on-mac/bootstrap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/on-mac/bootstrap b/scripts/on-mac/bootstrap index 1dca0fd..eb221f8 100755 --- a/scripts/on-mac/bootstrap +++ b/scripts/on-mac/bootstrap @@ -4,8 +4,8 @@ cd "$(dirname "$0")/../.." brew bundle --file=Brewfile --quiet -xcodebuild -version | head -1 -swift --version 2>&1 | head -1 +xcodebuild -version | sed -n 1p +swift --version 2>&1 | sed -n 1p echo "xcodegen $(xcodegen --version)" echo "swiftlint $(swiftlint version)" echo "swiftformat $(swiftformat --version)"