Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ For architecture and decision rationale, see [ARCHITECTURE.md](ARCHITECTURE.md).
- **Frameworks**: IOKit.pwr_mgt (power assertions), ServiceManagement (login items), Foundation (UserDefaults)
- **Target**: macOS 15.6 (Sequoia), Apple Silicon + Intel
- **Dependencies**: None. Zero third-party packages.
- **Build**: `xcodebuild build -project app/Vigil.xcodeproj -scheme Vigil -destination 'platform=macOS'`
- **Test**: `xcodebuild test -project app/Vigil.xcodeproj -scheme Vigil -destination 'platform=macOS'`

## Project Structure

Expand All @@ -26,7 +24,7 @@ vigil/
├── PRD.md # Product requirements
├── app/ # macOS app (Xcode project)
│ ├── Vigil.xcodeproj/
│ ├── Vigil/ # Source + PrivacyInfo.xcprivacy
│ ├── Vigil/ # Source + PrivacyInfo.xcprivacy + Localizable.xcstrings
│ └── VigilTests/
├── appstore/ # App Store screenshots (2880×1800)
└── website/ # Static promo site (Vercel): vigil-for-mac.vercel.app
Expand All @@ -43,6 +41,7 @@ New `.swift` files in `app/Vigil/` are auto-included in the build (PBXFileSystem
- `// MARK: -` comments for view section organization
- `import IOKit.pwr_mgt` (submodule import, not `import IOKit`)
- Computed properties for view decomposition (`heroSection`, `modeSection`, etc.)
- `LocalizedStringResource` for localizable strings in enums/models (not plain `String`) — enables auto-extraction into String Catalogs

## Testing

Expand All @@ -53,6 +52,37 @@ New `.swift` files in `app/Vigil/` are auto-included in the build (PBXFileSystem
- **Integration-style**: Tests create real IOPMAssertions and verify via `findAssertions(forPid:)`, a helper that queries the kernel with `IOPMCopyAssertionsByProcess`
- **Entry point**: `AppLauncher` (the actual `@main`) detects test runs via `NSClassFromString("XCTestCase")` and substitutes a lightweight `TestApp`. Do not add `@main` to `VigilApp` directly.

## Localization

- **Catalog**: Single `Localizable.xcstrings` (String Catalog) — all languages in one file
- **Languages**: English (source), German (de), Spanish (es), Hindi (hi), Ukrainian (uk), Chinese Simplified (zh-Hans)
- **SwiftUI views**: `Text("...")` and `Label("...")` strings are auto-extracted on build — no manual registration
- **Enum/model strings**: Return `LocalizedStringResource` (not `String`) so Xcode auto-extracts them too
- **Not localized**: `SleepMode.assertionReason` — intentionally English (appears in `pmset` output and Activity Monitor)
- **Adding a new string**: Just use `Text("New string")` or return `LocalizedStringResource`. Build the project — the key appears in `Localizable.xcstrings` marked "New". Add translations there.
- **Testing a language**: In Xcode: Edit Scheme → Run → Options → App Language. See CLI Commands below for command-line testing.

## CLI Commands

```bash
# Build
xcodebuild build -project app/Vigil.xcodeproj -scheme Vigil -destination 'platform=macOS'

# Test
xcodebuild test -project app/Vigil.xcodeproj -scheme Vigil -destination 'platform=macOS'

# Build and run
xcodebuild build -project app/Vigil.xcodeproj -scheme Vigil -destination 'platform=macOS' -quiet && \
open "$(xcodebuild -project app/Vigil.xcodeproj -scheme Vigil -showBuildSettings 2>/dev/null | grep '^ *BUILT_PRODUCTS_DIR = ' | sed 's/.*= //')/Vigil.app"

# Build and run with a specific language (replace 'uk' with: de, es, hi, zh-Hans)
xcodebuild build -project app/Vigil.xcodeproj -scheme Vigil -destination 'platform=macOS' -quiet && \
open "$(xcodebuild -project app/Vigil.xcodeproj -scheme Vigil -showBuildSettings 2>/dev/null | grep '^ *BUILT_PRODUCTS_DIR = ' | sed 's/.*= //')/Vigil.app" --args -AppleLanguages '(uk)'

# Verify sleep assertion is active
pmset -g assertions | grep Vigil
```

## Distribution

- **App Store name**: "Vigil - Stay Awake" (managed in App Store Connect, separate from PRODUCT_NAME)
Expand Down
8 changes: 2 additions & 6 deletions app/Vigil.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,10 @@
en,
Base,
de,
fr,
es,
"es-US",
uk,
"en-GB",
"en-IN",
hi,
ar,
uk,
"zh-Hans",
);
mainGroup = 8C983B4B2F634369004A6B1A;
minimizedProjectReferenceProxies = 1;
Expand Down
Loading