swiftpatch-cli 1.0.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 +275 -0
- package/bin/orbit-plus +3 -0
- package/bin/swiftpatch +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4942 -0
- package/dist/index.js.map +1 -0
- package/package.json +89 -0
package/README.md
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://swiftpatch.io/og-image.png" alt="SwiftPatch" width="600" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">SwiftPatch CLI</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
Ship React Native OTA updates instantly from the terminal.<br/>
|
|
9
|
+
Bundle, sign, publish, and manage releases — with AI-powered diagnostics.
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/swiftpatch-cli"><img src="https://img.shields.io/npm/v/swiftpatch-cli.svg" alt="npm version" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/swiftpatch-cli"><img src="https://img.shields.io/npm/dm/swiftpatch-cli.svg" alt="npm downloads" /></a>
|
|
15
|
+
<a href="https://github.com/codewprincee/swiftpatch-cli/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/swiftpatch-cli.svg" alt="license" /></a>
|
|
16
|
+
<a href="https://swiftpatch.io"><img src="https://img.shields.io/badge/platform-swiftpatch.io-blue" alt="SwiftPatch" /></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Why SwiftPatch?
|
|
22
|
+
|
|
23
|
+
CodePush is deprecated. Expo Updates locks you into Expo. Shorebird doesn't support React Native.
|
|
24
|
+
|
|
25
|
+
**SwiftPatch** is a modern OTA update platform built specifically for React Native. Push JS bundle updates to your users in seconds -- no app store review required.
|
|
26
|
+
|
|
27
|
+
| Feature | SwiftPatch | CodePush | Expo Updates |
|
|
28
|
+
|---------|-----------|----------|--------------|
|
|
29
|
+
| React Native support | Yes | Deprecated | Expo only |
|
|
30
|
+
| Hermes bytecode | Yes | No | Limited |
|
|
31
|
+
| Bundle signing (RSA-256) | Yes | No | No |
|
|
32
|
+
| AI-powered diagnostics | Yes | No | No |
|
|
33
|
+
| Rollback & rollout control | Yes | Limited | Limited |
|
|
34
|
+
| CI/CD tokens | Yes | Limited | Yes |
|
|
35
|
+
| Self-hosted option | Coming soon | No | No |
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g swiftpatch-cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Requires **Node.js 18+**.
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 1. Authenticate
|
|
49
|
+
swiftpatch login
|
|
50
|
+
|
|
51
|
+
# 2. Create an app
|
|
52
|
+
swiftpatch apps create
|
|
53
|
+
|
|
54
|
+
# 3. Publish a bundle
|
|
55
|
+
swiftpatch publish-bundle -p ios --hermes
|
|
56
|
+
|
|
57
|
+
# 4. Promote to release
|
|
58
|
+
swiftpatch release-bundle --hash <hash> --app-version 1.0.0 --ci-token <token>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or use the one-step deploy:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
swiftpatch deploy -p ios --ci-token <token>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Commands
|
|
68
|
+
|
|
69
|
+
### Authentication
|
|
70
|
+
|
|
71
|
+
| Command | Description |
|
|
72
|
+
|---------|-------------|
|
|
73
|
+
| `swiftpatch login` | Authenticate via browser or API key |
|
|
74
|
+
| `swiftpatch logout` | Clear stored credentials |
|
|
75
|
+
| `swiftpatch whoami` | Show current authenticated user |
|
|
76
|
+
|
|
77
|
+
### Apps
|
|
78
|
+
|
|
79
|
+
| Command | Description |
|
|
80
|
+
|---------|-------------|
|
|
81
|
+
| `swiftpatch apps list` | List all apps |
|
|
82
|
+
| `swiftpatch apps create` | Create a new app |
|
|
83
|
+
| `swiftpatch apps info <app-id>` | Get app details |
|
|
84
|
+
| `swiftpatch apps delete <app-id>` | Delete an app |
|
|
85
|
+
|
|
86
|
+
### Publishing & Releases
|
|
87
|
+
|
|
88
|
+
| Command | Description |
|
|
89
|
+
|---------|-------------|
|
|
90
|
+
| `swiftpatch publish-bundle -p <platform>` | Bundle, compile, sign, and upload |
|
|
91
|
+
| `swiftpatch release-bundle --hash <hash>` | Promote a bundle to a release |
|
|
92
|
+
| `swiftpatch deploy -p <platform>` | One-step bundle + upload + release |
|
|
93
|
+
| `swiftpatch releases list -a <app-id>` | List releases |
|
|
94
|
+
| `swiftpatch releases rollout <id> --percent 50` | Update rollout percentage |
|
|
95
|
+
| `swiftpatch releases rollback <id>` | Rollback a release |
|
|
96
|
+
|
|
97
|
+
### Channels
|
|
98
|
+
|
|
99
|
+
| Command | Description |
|
|
100
|
+
|---------|-------------|
|
|
101
|
+
| `swiftpatch channels list -a <app-id>` | List channels |
|
|
102
|
+
| `swiftpatch channels create -a <app-id>` | Create a channel |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## AI-Powered Intelligence
|
|
107
|
+
|
|
108
|
+
SwiftPatch includes AI features powered by **Claude** (Anthropic) for local project analysis and by the SwiftPatch backend for release intelligence.
|
|
109
|
+
|
|
110
|
+
### Local AI Commands (Claude-powered)
|
|
111
|
+
|
|
112
|
+
These commands analyze your local project. You will be prompted for consent before any data is read or sent.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Scan your project for OTA readiness issues
|
|
116
|
+
swiftpatch ai doctor
|
|
117
|
+
|
|
118
|
+
# Generate a changelog from git history
|
|
119
|
+
swiftpatch ai explain
|
|
120
|
+
|
|
121
|
+
# Safety review your code changes before deploying OTA
|
|
122
|
+
swiftpatch ai review
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
| Command | What it does |
|
|
126
|
+
|---------|-------------|
|
|
127
|
+
| `swiftpatch ai doctor` | Scans package.json, native deps, assets, Hermes config, signing keys. Flags anything that could break an OTA update. |
|
|
128
|
+
| `swiftpatch ai explain` | Reads git log between the last tag and HEAD, generates a categorized changelog (Features, Bug Fixes, Improvements). |
|
|
129
|
+
| `swiftpatch ai review` | Diffs your JS/TS changes, detects native code modifications, sensitive file changes, and gives an OTA safety score (1-10). |
|
|
130
|
+
|
|
131
|
+
All three commands support:
|
|
132
|
+
- `-y, --yes` to skip the consent prompt (for CI/CD)
|
|
133
|
+
- `--json` for machine-readable output
|
|
134
|
+
- `-f, --from` and `-t, --to` for custom git ranges (explain & review)
|
|
135
|
+
|
|
136
|
+
### Backend AI Commands
|
|
137
|
+
|
|
138
|
+
These require SwiftPatch authentication and query the platform API.
|
|
139
|
+
|
|
140
|
+
| Command | Description |
|
|
141
|
+
|---------|-------------|
|
|
142
|
+
| `swiftpatch ai ask <question>` | Ask AI about releases, crashes, or strategy |
|
|
143
|
+
| `swiftpatch ai risk-score` | Get AI risk assessment for a release |
|
|
144
|
+
| `swiftpatch ai crashes` | List AI-grouped crash reports |
|
|
145
|
+
| `swiftpatch ai insights` | View AI-generated insights |
|
|
146
|
+
|
|
147
|
+
### Setting up the Claude API Key
|
|
148
|
+
|
|
149
|
+
Local AI commands require a Claude API key. Configure it in one of three ways:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Option 1: Store in encrypted config (recommended for local dev)
|
|
153
|
+
swiftpatch config set claudeApiKey sk-ant-xxxxx
|
|
154
|
+
|
|
155
|
+
# Option 2: Environment variable (recommended for CI/CD)
|
|
156
|
+
export SWIFTPATCH_CLAUDE_API_KEY=sk-ant-xxxxx
|
|
157
|
+
|
|
158
|
+
# Option 3: SwiftPatch Pro (platform-provisioned key -- no setup needed)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Your API key is stored in an encrypted local store and is never logged or exposed.
|
|
162
|
+
|
|
163
|
+
### Data & Privacy
|
|
164
|
+
|
|
165
|
+
Before any local data is read or sent to the AI:
|
|
166
|
+
|
|
167
|
+
1. You are shown exactly what data categories will be accessed
|
|
168
|
+
2. You must explicitly consent (or pass `--yes` for CI/CD)
|
|
169
|
+
3. Consent can be remembered or revoked anytime
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Revoke all AI consent
|
|
173
|
+
swiftpatch config delete aiConsentScopes
|
|
174
|
+
|
|
175
|
+
# Remove your Claude API key
|
|
176
|
+
swiftpatch config delete claudeApiKey
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
No source code is stored by the AI service. All data is transmitted over encrypted HTTPS.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Bundle Signing
|
|
184
|
+
|
|
185
|
+
SwiftPatch supports RSA-256 bundle signing to verify bundle integrity on device:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Generate a key pair
|
|
189
|
+
swiftpatch generate-key-pair
|
|
190
|
+
|
|
191
|
+
# Publish with signing
|
|
192
|
+
swiftpatch publish-bundle -p ios --hermes -k ./swiftpatch-private.pem
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Add the public key to your React Native app via the [SwiftPatch SDK](https://www.npmjs.com/package/react-native-swiftpatch).
|
|
196
|
+
|
|
197
|
+
## Hermes Support
|
|
198
|
+
|
|
199
|
+
Compile your JS bundle to Hermes bytecode for faster startup:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
swiftpatch publish-bundle -p ios --hermes
|
|
203
|
+
|
|
204
|
+
# Or with a custom hermesc binary
|
|
205
|
+
swiftpatch publish-bundle -p android --hermes --hermesc-path ./node_modules/react-native/sdks/hermesc/osx-bin/hermesc
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## CI/CD Integration
|
|
209
|
+
|
|
210
|
+
Use CI tokens for automated deployments:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Create a token
|
|
214
|
+
swiftpatch ci-tokens create
|
|
215
|
+
|
|
216
|
+
# Use in your pipeline
|
|
217
|
+
export SWIFTPATCH_CI_TOKEN=sp_ci_xxxxx
|
|
218
|
+
|
|
219
|
+
swiftpatch publish-bundle -p ios --hermes
|
|
220
|
+
swiftpatch release-bundle --hash $HASH --app-version $VERSION
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### GitHub Actions Example
|
|
224
|
+
|
|
225
|
+
```yaml
|
|
226
|
+
- name: Deploy OTA update
|
|
227
|
+
env:
|
|
228
|
+
SWIFTPATCH_CI_TOKEN: ${{ secrets.SWIFTPATCH_CI_TOKEN }}
|
|
229
|
+
run: |
|
|
230
|
+
npx swiftpatch-cli publish-bundle -p ios --hermes
|
|
231
|
+
npx swiftpatch-cli release-bundle --hash $HASH --app-version $VERSION
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Configuration
|
|
235
|
+
|
|
236
|
+
| Command | Description |
|
|
237
|
+
|---------|-------------|
|
|
238
|
+
| `swiftpatch config set <key> <value>` | Set a config value |
|
|
239
|
+
| `swiftpatch config get <key>` | Get a config value |
|
|
240
|
+
| `swiftpatch config delete <key>` | Delete a config value |
|
|
241
|
+
| `swiftpatch config list` | List all config values |
|
|
242
|
+
|
|
243
|
+
**Config keys:** `apiUrl`, `defaultOrg`, `defaultApp`, `defaultPlatform`, `defaultChannel`, `claudeApiKey`
|
|
244
|
+
|
|
245
|
+
## Environment Variables
|
|
246
|
+
|
|
247
|
+
| Variable | Description |
|
|
248
|
+
|----------|-------------|
|
|
249
|
+
| `SWIFTPATCH_CI_TOKEN` | CI/CD token for automated auth |
|
|
250
|
+
| `SWIFTPATCH_API_URL` | Custom API endpoint |
|
|
251
|
+
| `SWIFTPATCH_CLAUDE_API_KEY` | Claude API key for AI features |
|
|
252
|
+
| `DEBUG` | Enable debug logging |
|
|
253
|
+
|
|
254
|
+
## Development
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
git clone https://github.com/codewprincee/swiftpatch-cli.git
|
|
258
|
+
cd swiftpatch-cli
|
|
259
|
+
npm install
|
|
260
|
+
npm run dev # watch mode
|
|
261
|
+
npm run build # production build
|
|
262
|
+
npm test # run tests
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Links
|
|
266
|
+
|
|
267
|
+
- [Website](https://swiftpatch.io)
|
|
268
|
+
- [Dashboard](https://app.swiftpatch.io)
|
|
269
|
+
- [Documentation](https://docs.swiftpatch.io)
|
|
270
|
+
- [React Native SDK](https://www.npmjs.com/package/react-native-swiftpatch)
|
|
271
|
+
- [GitHub](https://github.com/codewprincee/swiftpatch-cli)
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
MIT
|
package/bin/orbit-plus
ADDED
package/bin/swiftpatch
ADDED
package/dist/index.d.ts
ADDED