jetbridge 0.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,237 @@
1
+ # jetbridge
2
+
3
+ Build, sign and deliver iOS dev builds — to a simulator, down a cable, or over the air to your own bucket.
4
+
5
+ One config file, one command per delivery route, and no CI service in the middle: the `.ipa` goes to a bucket you own and the phone installs from a link.
6
+
7
+ ```
8
+ jetbridge init # write jetbridge.config.json by inspecting your Xcode project
9
+ jetbridge sim # build and launch on a simulator
10
+ jetbridge wired # build and install over the cable
11
+ jetbridge ota # archive, upload, print an install URL
12
+ jetbridge clean # remove variant bundle ids from your developer account
13
+ ```
14
+
15
+ ## Documentation
16
+
17
+ - [Adopting jetbridge](docs/adopting.md) — taking an existing app from nothing to a working variant install: what `init` infers, the xcconfig wiring, reduced variant entitlements, extensions.
18
+ - [Troubleshooting](docs/troubleshooting.md) — organised by the symptom you see, because the visible error rarely names the cause.
19
+
20
+ ## Variants: two branches, two apps
21
+
22
+ The problem this solves: two people (or two branches) installing dev builds overwrite each other, because both builds carry the same bundle id. A variant gives a branch its own bundle id and its own home-screen label, so both apps sit side by side and stay distinguishable.
23
+
24
+ ```
25
+ jetbridge wired --suffix seeded-feed
26
+ → io.acme.app.dev.seededfeed, home-screen "Acme Seeded Feed"
27
+
28
+ jetbridge wired --suffix
29
+ → the same, named after the current git branch
30
+ ```
31
+
32
+ Registering a new bundle id needs App Store Connect API credentials. A simulator validates no signature at all, so `jetbridge sim --suffix` needs nothing.
33
+
34
+ ## Over the air
35
+
36
+ `jetbridge ota` archives, exports an Ad Hoc `.ipa`, uploads it to any S3-compatible bucket (AWS, R2, MinIO, Backblaze) and prints an `itms-services://` URL. A rolling index page lists recent builds.
37
+
38
+ Two things iOS insists on, and jetbridge checks before printing a URL rather than letting you find out on the phone:
39
+
40
+ 1. **HTTPS with a valid certificate**, for both the manifest and the `.ipa`. A `http://` base URL is rejected by the config schema.
41
+ 2. **The device must be in the Ad Hoc profile.** An unregistered phone gets "Unable to install" with no explanation.
42
+
43
+ A bucket that is not publicly readable returns 403, and iOS reports only "Cannot connect" — so the manifest is fetched once, before the URL is shown, and the failure names the bucket policy.
44
+
45
+ ## App Store Connect credentials
46
+
47
+ Registering a variant bundle id and minting a provisioning profile happens through the App Store Connect API, so jetbridge needs an API key. You make one once, per team.
48
+
49
+ Not every command needs it:
50
+
51
+ | Command | Needs a key | Why |
52
+ | -------------------------- | ----------- | ------------------------------------------------ |
53
+ | `jetbridge sim` | no | a simulator validates no signature at all |
54
+ | `jetbridge sim --suffix` | no | same — a variant on the simulator signs nothing |
55
+ | `jetbridge wired` | no | signs against a profile you already have |
56
+ | `jetbridge wired --suffix` | **yes** | a new bundle id has to be registered |
57
+ | `jetbridge ota` | **yes** | archives against a generated Ad Hoc profile |
58
+ | `jetbridge clean` | **yes** | removes bundle ids and profiles from the account |
59
+
60
+ ### 1. Create the key
61
+
62
+ In [App Store Connect](https://appstoreconnect.apple.com) → **Users and Access** → **Integrations** → **App Store Connect API** → **Team Keys**, select **+**.
63
+
64
+ Give it a name you will recognise later (`jetbridge`), and grant the **App Manager** role. Admin works too. **Developer is not enough** — it cannot register a new bundle id, and the failure arrives as a bare `403 FORBIDDEN_ERROR` with nothing about roles in it.
65
+
66
+ You need a key of the **Team Keys** kind, not an Individual Key: individual keys cannot manage bundle ids or profiles.
67
+
68
+ ### 2. Download the `.p8`, once
69
+
70
+ Apple lets you download the private key **exactly once**. Lose it and the only remedy is to revoke the key and make another.
71
+
72
+ Note the two identifiers on the same page:
73
+
74
+ - **Key ID** — ten characters, also in the filename Apple gives you.
75
+ - **Issuer ID** — a UUID at the top of the page, shared by every key on the team.
76
+
77
+ ### 3. Put the key where jetbridge looks
78
+
79
+ Use the filename Apple gave you, unchanged:
80
+
81
+ ```sh
82
+ mkdir -p ~/.appstoreconnect/private_keys
83
+ mv ~/Downloads/AuthKey_ABCD123456.p8 ~/.appstoreconnect/private_keys/
84
+ ```
85
+
86
+ That directory is the last of the four Apple's own tools search, and jetbridge searches the same four in the same order:
87
+
88
+ ```
89
+ ./private_keys
90
+ ~/private_keys
91
+ ~/.private_keys
92
+ ~/.appstoreconnect/private_keys
93
+ ```
94
+
95
+ Anywhere else, point `ASC_API_KEY_PATH` at the file directly.
96
+
97
+ ### 4. Export the identifiers
98
+
99
+ ```sh
100
+ export ASC_API_KEY_ID=ABCD123456
101
+ export ASC_API_ISSUER_ID=69a6de70-0000-0000-0000-000000000000
102
+ ```
103
+
104
+ Put them in whatever your project already uses for local environment variables. The config file stores only these **variable names**, never their values, so the config is safe to commit and the key never is.
105
+
106
+ Rename the variables if your project prefers different ones:
107
+
108
+ ```jsonc
109
+ "credentials": {
110
+ "ascKeyId": "MY_ASC_KEY_ID",
111
+ "ascIssuerId": "MY_ASC_ISSUER_ID"
112
+ }
113
+ ```
114
+
115
+ ### 5. Register your device
116
+
117
+ A profile can only install on devices registered to the team. The simplest way to register one is to plug it in and build to it once from Xcode; after that jetbridge picks it up automatically, because every profile it mints covers every enabled device on the team.
118
+
119
+ An unregistered device is the second most common OTA failure — iOS says only "Unable to install", with no hint that the device is missing from the profile.
120
+
121
+ ### Keeping the key safe
122
+
123
+ The `.p8` is a credential for your whole developer account. Never commit it, never put it in the config file, and never paste it into a CI log. For CI, hold it as a secret and write it to disk at the start of the job. If it leaks, revoke it in App Store Connect immediately — revoking is instant and making a replacement takes a minute.
124
+
125
+ ## Configuration
126
+
127
+ `jetbridge.config.json` lives at the root of your project. `jetbridge init` writes it for you by reading your Xcode project; the whole file is documented by its JSON Schema, which editors pick up from the `$schema` key.
128
+
129
+ ```jsonc
130
+ {
131
+ "$schema": "https://unpkg.com/jetbridge/schema/v1.json",
132
+ "configVersion": 1,
133
+
134
+ "project": {
135
+ "iosDir": "ios",
136
+ "xcodeproj": "Acme.xcodeproj",
137
+ "scheme": "Acme",
138
+ "teamId": "ABCDE12345",
139
+ "baseBundleId": "io.acme.app.dev",
140
+ },
141
+
142
+ "configurations": {
143
+ "available": ["Debug", "Release"],
144
+ "wired": "Debug",
145
+ "archive": "Release",
146
+ },
147
+
148
+ "variant": {
149
+ "displayName": "Acme Dev",
150
+ "targets": [
151
+ { "name": "Acme", "capabilities": ["PUSH_NOTIFICATIONS"] },
152
+ { "name": "UploadWidget", "bundleIdSuffix": "uploadwidget" },
153
+ ],
154
+ },
155
+
156
+ "ota": {
157
+ "storage": {
158
+ "bucket": "acme-builds",
159
+ "region": "eu-central-1",
160
+ "publicBaseUrl": "https://builds.example.com",
161
+ },
162
+ },
163
+ }
164
+ ```
165
+
166
+ Credentials are referenced by **environment variable name**, never by value — nothing secret belongs in this file.
167
+
168
+ `teamId` is your ten-character Apple team id, on the [Membership details](https://developer.apple.com/account) page — the same value Xcode shows as **Team ID**. `jetbridge init` reads it out of your project when the project already sets `DEVELOPMENT_TEAM`.
169
+
170
+ ### What your project has to do
171
+
172
+ jetbridge passes a few build settings on the xcodebuild command line; your xcconfig decides what they mean. The names are configurable, and these are the defaults:
173
+
174
+ | Setting | Value | Use it for |
175
+ | ------------------------- | -------------------------- | ------------------------------------- |
176
+ | `JETBRIDGE_BUNDLE_SUFFIX` | `.seededfeed` | append to `PRODUCT_BUNDLE_IDENTIFIER` |
177
+ | `JETBRIDGE_DISPLAY_NAME` | `Acme Seeded Feed` | `INFOPLIST_KEY_CFBundleDisplayName` |
178
+ | `JETBRIDGE_SIGN_STYLE` | `Manual` for a variant | `CODE_SIGN_STYLE` |
179
+ | `JETBRIDGE_PROFILE_APP` | the generated profile name | `PROVISIONING_PROFILE_SPECIFIER` |
180
+
181
+ ### Hooks
182
+
183
+ `hooks.preBuild` and `hooks.postBuild` are shell commands run in the project root — the escape hatch for whatever your project does before a build that jetbridge should not know about. JSON cannot hold a function; shell strings are the deliberate cost of a config file a wizard can write and a person can read.
184
+
185
+ ## Unattended runs
186
+
187
+ Every command works with nobody watching — from a script, a pipe, CI, or an AI agent. **You do not need to set `CI=1`.**
188
+
189
+ jetbridge decides for itself: no terminal means no questions. It falls back to the flag-driven behaviour and, where an answer is genuinely required, fails immediately naming the flag that supplies it. It never waits for input it cannot receive, because a command that hangs prints nothing at all — the worst thing that can happen to an unattended caller.
190
+
191
+ ```
192
+ jetbridge init --yes --scheme Acme --team-id ABCDE12345 | cat # no terminal, no prompt
193
+ ```
194
+
195
+ Flags that supply answers non-interactively:
196
+
197
+ | Flag | Answers |
198
+ | ------------------------------- | ------------------------------------------------------------------------ |
199
+ | `jetbridge init --yes` | accepts every detected default, and consents to writing the file |
200
+ | `jetbridge init --scheme` etc. | any value `init` could not infer — the error names the missing flag |
201
+ | `jetbridge bundles rm --yes` | consents to the deletion; without it the plan prints and nothing changes |
202
+ | `jetbridge bundles prune --yes` | the same, for pruning |
203
+
204
+ Two overrides exist for a person who IS on a terminal but wants the unattended path anyway. Neither is ever required:
205
+
206
+ - `CI=1` — the long-standing convention, still honoured.
207
+ - `JETBRIDGE_NON_INTERACTIVE=1` — the same lever, for when you are not in CI.
208
+
209
+ Hooks (`hooks.preBuild` / `hooks.postBuild`) run with stdin closed unless there is a real terminal, so a hook that tries to prompt gets EOF and fails rather than hanging the build forever.
210
+
211
+ ## Requirements
212
+
213
+ - macOS with Xcode and its command line tools
214
+ - Node 20 or newer
215
+ - An Apple Developer account, for anything that signs for a device
216
+
217
+ ## Releasing
218
+
219
+ Releases go through [Changesets](https://github.com/changesets/changesets). Nothing is published from a laptop.
220
+
221
+ A pull request that changes anything shipped — `src/`, `templates/`, `schema/`, `package.json`, `README.md` — has to carry a changeset, and CI fails the PR if it does not:
222
+
223
+ ```sh
224
+ npx changeset # pick patch / minor / major, describe the change
225
+ git add .changeset
226
+ ```
227
+
228
+ From there it is automatic:
229
+
230
+ 1. The PR lands on `main`. The release workflow opens a **"chore(release): version packages"** PR that bumps the version, writes the CHANGELOG and deletes the consumed changesets.
231
+ 2. Merging that PR publishes to npm and pushes the git tag.
232
+
233
+ The only requirement is an `NPM_TOKEN` automation token in the repository's `npm-publish` environment.
234
+
235
+ ## License
236
+
237
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { B as Boundary, P as Project } from './variant-Bh99wLZC.js';
2
+ export { a as assertSingleSegment } from './variant-Bh99wLZC.js';
3
+ import 'zod';
4
+
5
+ interface VariantOptions {
6
+ suffix?: string | boolean;
7
+ name?: string;
8
+ }
9
+ interface ResolvedVariant {
10
+ suffix: string;
11
+ displayName: string;
12
+ }
13
+ /**
14
+ * What this build is called.
15
+ *
16
+ * `--suffix` takes an OPTIONAL value: commander hands back `true` when the flag
17
+ * was given without one, which is the "name it after the branch" signal. The
18
+ * RAW string feeds the label, because it still has the word boundaries a bundle
19
+ * id cannot carry (`seeded-feed` → "Acme Seeded Feed"); the sanitized slug
20
+ * feeds the bundle id.
21
+ */
22
+ declare function resolveVariant(boundary: Boundary, project: Project, options: VariantOptions): ResolvedVariant;
23
+
24
+ export { resolveVariant };