jetbridge 0.1.0-rc.0 → 0.1.0-rc.2

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 CHANGED
@@ -2,129 +2,63 @@
2
2
 
3
3
  Build, sign and deliver iOS dev builds — to a simulator, down a cable, or over the air to your own bucket.
4
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.
5
+ One config file, one command per destination, and no service in the middle: the `.ipa` goes to a bucket you own, and the phone installs from a link.
6
6
 
7
+ ```sh
8
+ npm install --save-dev jetbridge
7
9
  ```
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
10
 
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.
11
+ **Contents** — [Quick start](#quick-start) · [Commands](#commands) · [Variants](#variants) · [Configuration](#configuration) · [Credentials](#credentials) · [Unattended runs](#unattended-runs) · [JSON output](#json-output) · [Guides](#guides)
19
12
 
20
- ## Variants: two branches, two apps
13
+ ## Quick start
21
14
 
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
15
+ ```sh
16
+ npx jetbridge init # writes jetbridge.config.json by reading your Xcode project
17
+ npx jetbridge install # builds and launches on a simulator
30
18
  ```
31
19
 
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:
20
+ Start there deliberately: a simulator validates no code signature, so that second command needs no Apple credentials, no provisioning and no paired phone. Once it works, add [credentials](#credentials) and move to a real device.
80
21
 
81
22
  ```sh
82
- mkdir -p ~/.appstoreconnect/private_keys
83
- mv ~/Downloads/AuthKey_ABCD123456.p8 ~/.appstoreconnect/private_keys/
23
+ npx jetbridge install --device # over the cable
24
+ npx jetbridge link # upload, and print a link anyone can install from
84
25
  ```
85
26
 
86
- That directory is the last of the four Apple's own tools search, and jetbridge searches the same four in the same order:
27
+ ## Commands
87
28
 
88
- ```
89
- ./private_keys
90
- ~/private_keys
91
- ~/.private_keys
92
- ~/.appstoreconnect/private_keys
93
- ```
29
+ | Command | What it does | Needs Apple credentials |
30
+ | ----------------------------- | ------------------------------------------------- | ----------------------- |
31
+ | `jetbridge init` | write the config by inspecting your Xcode project | no |
32
+ | `jetbridge install` | build and launch on a simulator | no |
33
+ | `jetbridge install --device` | build and install over the cable | only with `--suffix` |
34
+ | `jetbridge link` | archive, upload, print an install link | yes |
35
+ | `jetbridge bundles ls` | what this project has registered with Apple | yes |
36
+ | `jetbridge bundles provision` | refresh profiles without building | yes |
37
+ | `jetbridge bundles rm <slug>` | remove named variants | yes |
38
+ | `jetbridge bundles prune` | remove variants whose git branch is gone | yes |
39
+ | `jetbridge reindex` | rebuild the build index page from the bucket | no |
94
40
 
95
- Anywhere else, point `ASC_API_KEY_PATH` at the file directly.
41
+ The destination is a flag, not a separate command: `--device` means the cable, and `--device "Dev's iPhone"` means that one phone. Same for `--simulator`.
96
42
 
97
- ### 4. Export the identifiers
43
+ Deleting anything is a dry run by default — `bundles rm` and `bundles prune` print the plan and stop until you pass `-y`. Apple restores nothing.
98
44
 
99
- ```sh
100
- export ASC_API_KEY_ID=ABCD123456
101
- export ASC_API_ISSUER_ID=69a6de70-0000-0000-0000-000000000000
102
- ```
45
+ ## Variants
103
46
 
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.
47
+ Two branches installing dev builds overwrite each other, because both 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.
105
48
 
106
- Rename the variables if your project prefers different ones:
49
+ ```sh
50
+ jetbridge install --device --suffix seeded-feed
51
+ → io.acme.app.dev.seededfeed, home-screen "Acme Seeded Feed"
107
52
 
108
- ```jsonc
109
- "credentials": {
110
- "ascKeyId": "MY_ASC_KEY_ID",
111
- "ascIssuerId": "MY_ASC_ISSUER_ID"
112
- }
53
+ jetbridge install --device --suffix
54
+ → the same, named after the current git branch
113
55
  ```
114
56
 
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.
57
+ Every variant registers a bundle id and a profile with Apple, permanently. `jetbridge bundles prune` clears out the ones whose branch has since been merged or deleted.
124
58
 
125
59
  ## Configuration
126
60
 
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.
61
+ `jetbridge.config.json` sits at the root of your project, and `jetbridge init` writes it for you. Editors autocomplete it from the `$schema` key.
128
62
 
129
63
  ```jsonc
130
64
  {
@@ -133,24 +67,19 @@ The `.p8` is a credential for your whole developer account. Never commit it, nev
133
67
 
134
68
  "project": {
135
69
  "iosDir": "ios",
136
- "xcodeproj": "Acme.xcodeproj",
137
70
  "scheme": "Acme",
138
71
  "teamId": "ABCDE12345",
139
72
  "baseBundleId": "io.acme.app.dev",
140
73
  },
141
74
 
142
- "configurations": {
143
- "available": ["Debug", "Release"],
144
- "wired": "Debug",
145
- "archive": "Release",
146
- },
147
-
148
75
  "variant": {
149
76
  "displayName": "Acme Dev",
150
- "targets": [
151
- { "name": "Acme", "capabilities": ["PUSH_NOTIFICATIONS"] },
152
- { "name": "UploadWidget", "bundleIdSuffix": "uploadwidget" },
153
- ],
77
+ "targets": [{ "name": "Acme" }, { "name": "UploadWidget" }],
78
+ },
79
+
80
+ "credentials": {
81
+ "ascKeyId": "${ASC_API_KEY_ID}",
82
+ "ascIssuerId": "${ASC_API_ISSUER_ID}",
154
83
  },
155
84
 
156
85
  "ota": {
@@ -158,79 +87,79 @@ The `.p8` is a credential for your whole developer account. Never commit it, nev
158
87
  "bucket": "acme-builds",
159
88
  "region": "eu-central-1",
160
89
  "publicBaseUrl": "https://builds.example.com",
90
+ "accessKeyId": "${JETBRIDGE_S3_ACCESS_KEY_ID}",
91
+ "secretAccessKey": "${JETBRIDGE_S3_SECRET_ACCESS_KEY}",
161
92
  },
162
93
  },
163
94
  }
164
95
  ```
165
96
 
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`.
97
+ Nothing secret belongs in this file. Every credential is a `${VAR}` reference to the environment, never a value, so the config is safe to commit — and a bare `"ASC_API_KEY_ID"` is rejected rather than guessed at, because it reads as either a name or the secret.
169
98
 
170
- ### What your project has to do
99
+ Your project also has to consume a few build settings that jetbridge passes on the command line — appending the variant suffix to the bundle id, and pointing at the generated profile. The names are fixed: `JETBRIDGE_SUFFIX`, `JETBRIDGE_DISPLAY_NAME`, `JETBRIDGE_SIGN_STYLE`, `JETBRIDGE_GIT_SHA`, and one `JETBRIDGE_PROFILE_<TARGET>` per target. Those lines, and the reduced entitlements a variant needs, are in **[Adopting jetbridge](https://github.com/panofm/jetbridge/blob/main/docs/adopting.md)**.
171
100
 
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:
101
+ ## Credentials
173
102
 
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` |
103
+ Registering a variant bundle id or minting a profile goes through the App Store Connect API, so those commands need an API key with the **App Manager** role. `install` on a simulator needs nothing, and a plain `install --device` signs against a profile you already have.
180
104
 
181
- ### Hooks
105
+ ```sh
106
+ export ASC_API_KEY_ID=ABCD123456
107
+ export ASC_API_ISSUER_ID=69a6de70-0000-0000-0000-000000000000
108
+ # key file at ~/.appstoreconnect/private_keys/AuthKey_ABCD123456.p8
109
+ ```
182
110
 
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.
111
+ Making the key, where to put it, which role fails and why, and registering your device: **[Credentials](https://github.com/panofm/jetbridge/blob/main/docs/credentials.md)**.
184
112
 
185
113
  ## Unattended runs
186
114
 
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`.**
115
+ Every command works with nobody watching — a script, a pipe, CI, or an AI agent. **You never need to set `CI=1`.**
188
116
 
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.
117
+ No terminal means no questions: jetbridge falls back to the flag-driven path 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.
190
118
 
191
- ```
192
- jetbridge init --yes --scheme Acme --team-id ABCDE12345 | cat # no terminal, no prompt
119
+ ```sh
120
+ jetbridge init --yes --scheme Acme --team-id ABCDE12345 | cat
193
121
  ```
194
122
 
195
- Flags that supply answers non-interactively:
123
+ `--yes` supplies consent: to writing the config, and to a deletion in `bundles rm` / `bundles prune`. If you are on a terminal and want the unattended path anyway, `CI=1` and `JETBRIDGE_NON_INTERACTIVE=1` both force it — neither is ever required.
196
124
 
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 |
125
+ ## JSON output
203
126
 
204
- Two overrides exist for a person who IS on a terminal but wants the unattended path anyway. Neither is ever required:
127
+ Every command takes `--json`. Machine output goes to **stdout**, one JSON object per line; every human line goes to **stderr**. So a script parses stdout while a person still watches the run.
205
128
 
206
- - `CI=1` — the long-standing convention, still honoured.
207
- - `JETBRIDGE_NON_INTERACTIVE=1` — the same lever, for when you are not in CI.
129
+ ```sh
130
+ jetbridge install --device --json | jq -c 'select(.event == "step" and .phase == "end")'
131
+ ```
208
132
 
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.
133
+ ```jsonc
134
+ {"event":"start","command":"install","destination":"device","bundleId":"io.acme.app.dev.wave","displayName":"Acme Wave","configuration":"Debug","suffix":"wave"}
135
+ {"event":"devices","devices":[{"id":"10BFE051","name":"Dev's 17 Pro","udid":"…","transport":"wired"}]}
136
+ {"event":"signing","decision":"cached","profiles":["Acme wave app","Acme wave uploadwidget"]}
137
+ {"event":"step","step":"build","phase":"start"}
138
+ {"event":"step","step":"build","phase":"end","ok":true,"durationMs":72000,"buildNumber":"1786437647","configuration":"Debug"}
139
+ {"event":"step","step":"install","phase":"end","ok":true,"durationMs":18000,"device":{"id":"10BFE051","name":"Dev's 17 Pro"},"bundleId":"io.acme.app.dev.wave"}
140
+ {"event":"done","ok":true,"durationMs":113000,"devices":1,"bundleId":"io.acme.app.dev.wave"}
141
+ ```
210
142
 
211
- ## Requirements
143
+ Every object has an `event`. `start` names the run, `devices` and `signing` carry the header facts, each `step` appears twice (`phase` `start` then `end`, the second with `durationMs` and `ok`), and `done` closes the stream with `ok` and the total. `jetbridge link` adds `link`, with the install, index and manifest URLs. A failure emits `error` with the message, then `done` with `"ok":false`, and the exit code is non-zero — so a reader can loop until `done` and never hang.
212
144
 
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
145
+ Every command opens with `start` and closes with `done`, so a reader can loop until `done` and never hang. `init` and `reindex` carry no header rows and add one event of their own (`init`, `reindex`) before closing.
218
146
 
219
- Releases go through [Changesets](https://github.com/changesets/changesets). Nothing is published from a laptop.
147
+ `bundles ls --json` is the one exception: it prints a single array of variants, the shape it always had, and nothing else — no `start`, no `done`. Read it with `JSON.parse` on the whole stream, not line by line.
220
148
 
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:
149
+ Without `--json`, stdout carries only a command's own payload (the `bundles ls` table); the progress you read while it runs is stderr either way. On a terminal a step rewrites its own line as it finishes; redirected to a file, each step prints one plain line and no escape codes.
222
150
 
223
- ```sh
224
- npx changeset # pick patch / minor / major, describe the change
225
- git add .changeset
226
- ```
151
+ ## Guides
227
152
 
228
- From there it is automatic:
153
+ - **[Adopting jetbridge](https://github.com/panofm/jetbridge/blob/main/docs/adopting.md)** — an existing app from nothing to a working variant install: what `init` infers, the xcconfig wiring, reduced entitlements, extensions.
154
+ - **[Credentials](https://github.com/panofm/jetbridge/blob/main/docs/credentials.md)** — creating the App Store Connect key, where it lives, registering devices.
155
+ - **[Troubleshooting](https://github.com/panofm/jetbridge/blob/main/docs/troubleshooting.md)** — organised by the symptom you see, because the visible error rarely names the cause.
156
+ - **[Releasing](https://github.com/panofm/jetbridge/blob/main/docs/releasing.md)** — how a change reaches npm.
229
157
 
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.
158
+ ## Requirements
232
159
 
233
- The only requirement is an `NPM_TOKEN` automation token in the repository's `npm-publish` environment.
160
+ - macOS with Xcode and its command line tools
161
+ - Node 20 or newer
162
+ - An Apple Developer account, for anything that signs for a device
234
163
 
235
164
  ## License
236
165
 
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as Boundary, P as Project } from './variant-Bh99wLZC.js';
2
- export { a as assertSingleSegment } from './variant-Bh99wLZC.js';
1
+ import { B as Boundary, P as Project } from './variant-BqU-O12A.js';
2
+ export { a as assertSingleSegment } from './variant-BqU-O12A.js';
3
3
  import 'zod';
4
4
 
5
5
  interface VariantOptions {