CONTRIBUTING.org

58f3b73e8ff337e5a15111fbb32c0d57cf2346da
orgstar/CONTRIBUTING.org rendered · source · history · blame · raw

212 lines · 11344 bytes

10 symbols in this file
  1#+TITLE: Contributing
  2
  3* Status
  4
  5Design phases 1–7 are built. The Mac app is released as a notarized DMG and a Homebrew
  6cask, with Sparkle updates; a second, sandboxed build is on the Mac App Store (see /Mac
  7App Store build/). The iOS and watchOS apps build from the Xcode project
  8for the Simulator and for a device signed with your own team, and go to TestFlight and the
  9[[https://apps.apple.com/us/app/orgstar-org-mode-agenda/id6821552018][App Store]] with =scripts/release-ios.sh=. Owed: the M1 Air gate run (issue 2) and the VoiceOver
 10passes on the Mac and iOS (issues 3 and 4).
 11
 12=docs/design.md= is the design; =docs/plans/= has one plan per piece of work.
 13
 14* Build and run
 15
 16Requires macOS 26 and Xcode 27 (Swift 6.2 tools).
 17
 18#+BEGIN_SRC sh
 19scripts/build-app.sh          # builds .build/app/orgstar.app, signed ad hoc
 20open .build/app/orgstar.app
 21#+END_SRC
 22
 23Add a folder with File > Add Folder… (⇧⌘O). ⌘P opens a file by name, ⇧⌘F searches,
 24⇧⌘A shows the agenda. In the editor, TAB on a heading cycles its folding and Shift-TAB
 25cycles the whole file. orgstar opens =.org= files from Finder once the app has been
 26launched.
 27
 28C-c C-v t tangles the file's source blocks into the files their =:tangle= header
 29names, as =org-babel-tangle= does.
 30
 31=org-protocol://capture?template=…&url=…&title=…&body=…= and
 32=org-protocol://store-link?url=…&title=…= links work as in Emacs, so browser
 33bookmarklets written for org-protocol work unchanged. Shortcuts has a "Capture to
 34orgstar" action that files text with a capture template.
 35
 36Settings live in =~/.config/orgstar/config.toml= (orgstar ▸ Edit Config File), with
 37keys in =keymap.toml= and capture templates in =capture.toml= beside it. Settings ▸
 38General ▸ Import from Emacs reads an existing Emacs or Doom configuration.
 39
 40* iOS
 41
 42The iOS app (iOS 26) is the "Orgstar iOS" scheme in =ios/Orgstar.xcodeproj=, with the
 43share and Quick Look extensions. It builds from the package's sources and signs
 44automatically with the team set in the project; choose a device or Simulator and Run.
 45For the Simulator without Xcode:
 46
 47#+BEGIN_SRC sh
 48scripts/build-ios-app.sh      # builds .build/ios-app/orgstar.app
 49xcrun simctl install booted .build/ios-app/orgstar.app
 50#+END_SRC
 51
 52On iOS, orgstar in the share sheet takes a page or text with a template; the app opens
 53its capture sheet with it when it's next active. Shortcuts has the same "Capture to
 54orgstar" action as on the Mac.
 55
 56** In-app purchases
 57
 58=ios/Orgstar.storekit= is the StoreKit configuration the "Orgstar iOS" and "Orgstar macOS"
 59schemes run with, so purchases work in Xcode without App Store Connect. It holds orgstar+
 60(=sh.krz.orgstar.pro.monthly=, =.yearly=, =.lifetime=) and the consumable tips
 61(=sh.krz.orgstar.tip.small=, =.medium=, =.large=, at 0.99, 2.99 and 4.99). Tips unlock
 62nothing. On iOS they are in Settings ▸ About orgstar ▸ Support Development, and in the Mac App
 63Store build in Settings ▸ orgstar+, below the plans. The Developer ID Mac app has no StoreKit
 64and no tips; orgstar+ there comes with a license key (see /Mac licenses/).
 65
 66The Mac App Store build has the iOS app's bundle ID, =sh.krz.orgstar=, as a Universal
 67Purchase, so it sells the same products at the same prices and a purchase on one platform
 68unlocks the other. Nobody is grandfathered in the Mac App Store build: =ProStore.grandfathers=
 69is true only on iOS.
 70
 71In App Store Connect, create each tip as a Consumable with the exact product ID, a display
 72name and description in every localization the app has (de, fr, ja, es-ES, pt-BR), a price
 73and availability, and a review screenshot of the About screen's Support Development section.
 74Submit new in-app purchases with an app version. Changes take up to an hour to reach the
 75sandbox; test there with a Sandbox Apple Account (Settings ▸ Developer on the device).
 76
 77* Mac App Store build
 78
 79The "Orgstar macOS" scheme in =ios/Orgstar.xcodeproj= builds the Mac app for the Mac App
 80Store: the same =Sources/Orgstar= with the =APPSTORE= compilation condition, sandboxed, with
 81the widgets, Quick Look and Spotlight extensions, and without Sparkle or the =OrgPrograms=
 82target. =ios/OrgstarMac= has its =Info.plist=, entitlements and privacy manifest. Choose My Mac
 83and Run; it signs with the team set in the project.
 84
 85=APPSTORE= is set only by the Xcode targets, so =swift build= and =scripts/build-app.sh= build
 86the Developer ID app exactly as before. Within the shared packages, the sandbox is detected at
 87run time (=Sandbox.isActive=). The manual's Install page lists what the App Store build does
 88differently.
 89
 90The sandboxed app keeps its data in =~/Library/Containers/sh.krz.orgstar/=, and the widgets'
 91data in =~/Library/Group Containers/group.sh.krz.orgstar/=. A development build and a Mac App
 92Store install share them, as they share the bundle ID. Keep the Developer ID app out of the way
 93while testing, since Finder, Quick Look, Spotlight and URL handlers bind to one copy.
 94
 95** Mac screenshots
 96
 97App Store Connect takes Mac screenshots at 1280x800, 1440x900, 2560x1600 or 2880x1800 pixels.
 98The set lives in =ios/AppStore/screenshots/mac/=, at 2880x1800: window captures centred on a
 99radial gradient. To take one on a Retina display:
100
1011. Run the "Orgstar macOS" scheme. Remove other folders from its sidebar and add
102   =ios/AppStore/demo= with File ▸ Add Folder….
1032. Set up each shot, then run =screencapture -o -w raw.png= and click the window.
1043. Put it on the background, scaled to fit 2640x1640, with no alpha channel:
105   #+BEGIN_SRC sh
106   magick -size 2880x1800 radial-gradient:'#56722c-#182109' bg.png
107   magick raw.png -resize '2640x1640>' win.png
108   magick bg.png win.png -gravity center -composite -background '#182109' -alpha remove -alpha off \
109       ios/AppStore/screenshots/mac/NN-name.png
110   #+END_SRC
111
112The demo's dates are around Friday 16 October 2026; in the agenda, Go to Date shows that week.
113The set has four shots: =01-editor= (=work.org=, with the sidebar showing), =02-agenda= (the
114week), =03-table= (=home.org= and its table) and =04-capture= (the capture window with a
115template). Show nothing the App Store build leaves out: no code block results from languages
116other than Emacs Lisp, no Emacs exports, no license key form and no update settings.
117
118* Mac licenses
119
120orgstar+ for Mac comes with GitHub Sponsors: $60 once for a key that doesn't expire, or $5 a
121month for a key that expires after 40 days and that the app renews daily from 30 days before.
122=packaging/license-issuer= is the Cloudflare Worker that serves =krz.sh/apps/orgstar/buy=,
123=/license= (Sign in with GitHub, then the key) and =/renew=; its header describes the key
124format.
125
126Setup, once:
127- In GitHub Sponsors, publish a $60 one-time tier and a $5 monthly tier.
128- Create a GitHub OAuth app with the callback URL =https://krz.sh/apps/orgstar/license= and
129  put its client ID in =GITHUB_CLIENT_ID= in =wrangler.toml=.
130- =npx wrangler secret put GITHUB_CLIENT_SECRET= with the OAuth app's secret, and
131  =GITHUB_TOKEN= with a classic token of an owner of the krz-labs organization (=read:org=,
132  =read:user=), which renewals use to list its sponsors.
133- =packaging/license-issuer/keygen.sh= set =LICENSE_PRIVATE_KEY= and the app's public key.
134  Running it again invalidates every key issued so far.
135
136=node --test packaging/license-issuer= runs the Worker's tests; =npx wrangler deploy= from
137that folder publishes it.
138
139* Tests
140
141#+BEGIN_SRC sh
142swift test                                                 # all tests
143ORGSTAR_GATES=1 swift test -c release --filter GateTests   # performance gates
144#+END_SRC
145
146Randomised tests use a fixed seed and print it when they fail. =ORGSTAR_SEED=<n> swift test=
147runs them with another; the incremental-parse and restyle fuzz tests read =ORGSTAR_FUZZ_SEED= instead.
148
149=swift test= covers the Developer ID build. =APPSTORE= is set only in the Xcode targets, so
150also check that the App Store build and the iOS app compile:
151
152#+BEGIN_SRC sh
153xcodebuild -project ios/Orgstar.xcodeproj -scheme 'Orgstar macOS' -destination 'generic/platform=macOS' \
154    -derivedDataPath .build/xcode CODE_SIGNING_ALLOWED=NO build
155xcodebuild -project ios/Orgstar.xcodeproj -scheme 'Orgstar iOS' -destination 'generic/platform=iOS Simulator' \
156    -derivedDataPath .build/xcode build
157#+END_SRC
158
159There is no CI; run these before committing.
160
161* Release
162
163=scripts/release-mac.sh <version>= builds a universal app, signs it with the
164keychain's Developer ID, notarizes a DMG, tags =v<version>=, uploads the DMG to the
165gitbay release and updates the cask in krz/homebrew-tap.
166
167=scripts/build-app.sh= strips the executables and copies their dSYMs to =.build/app/dSYMs=;
168the release zips them to =.build/release/orgstar-<version>-dSYMs.zip= and doesn't upload
169them. Keep the zip to symbolicate that release's crash reports.
170
171Set =ORGSTAR_NOTES= to an HTML file of release notes for the appcast, which Sparkle's
172update window shows, and =ORGSTAR_RELEASE_NOTES= to a Markdown file for the gitbay
173release. Without them both get the one-line platform note.
174
175Each release goes out on three channels, in this order, from the same commit:
176
1771. =scripts/release-mac.sh <version>=, the Developer ID app.
1782. =scripts/release-ios.sh=, the iOS app.
1793. =scripts/release-macos.sh=, the Mac App Store app.
180
181Each of them runs the performance gates (=ORGSTAR_GATES=1 swift test -c release --filter GateTests=)
182before it builds anything for signing, and stops if one misses. Run releases on a Mac that is
183otherwise idle, since the gates measure time.
184
185The App Store builds take their version from =MARKETING_VERSION= in =ios/Orgstar.xcodeproj=,
186which every target shares and appstore-kit requires to be the same across them. Set it to
187=<version>= before the release.
188
189=scripts/release-ios.sh= archives the =Orgstar iOS= scheme, with its extensions and the
190watch app, and uploads it to App Store Connect for TestFlight. It signs automatically with the
191team's distribution certificate through the Apple ID signed in to Xcode (Xcode ▸ Settings ▸
192Accounts), so it needs no key of its own. The version is the project's =MARKETING_VERSION=;
193the build number is the commit count, as the Mac's is, so each upload needs a new commit.
194=ORGSTAR_PUBLISH=0= archives and exports the =.ipa= to =.build/ios-release= without uploading.
195The script sources =release-ios.sh= from appstore-kit, checked out beside this repository or
196at =$APPSTORE_KIT=.
197
198=scripts/release-macos.sh= does the same for the =Orgstar macOS= scheme, with appstore-kit's
199=platform=macos=, and uploads a =.pkg=. Before archiving it checks that the scheme has
200=APPSTORE= and the bundle ID =sh.krz.orgstar= and that no entitlements file has a temporary
201exception. Before exporting it checks the archive: no Sparkle, no =SU*= keys in =Info.plist=, no
202=NSTask= or =posix_spawn= in any executable, and no temporary-exception entitlements.
203It doesn't check provisioning profiles: the archive is signed for development, which gives
204extensions without capabilities none, and the export signs every bundle again.
205=ORGSTAR_PUBLISH=0= exports the =.pkg= to =.build/macos-release= without uploading.
206
207The macOS listing, review notes and TestFlight information are in =ios/AppStore/metadata.md=.
208
209* App Store header
210
211=ios/AppStore/header.conf= sets the product page header's background and screenshots;
212appstore-kit's =render-header.sh ios/AppStore= renders it.