@straitlink/cli 0.3.5 → 0.3.6
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 +1 -1
- package/package.json +1 -1
- package/src/app.mjs +4 -3
- package/src/cli.mjs +7 -4
- package/src/version.mjs +1 -1
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ Android (assetlinks.json)
|
|
|
83
83
|
| `--key` | Also check the publishable key. Env: `STRAIT_PUBLISHABLE_KEY`. Left out, the key check is skipped |
|
|
84
84
|
| `--json` | The reports as JSON, for CI and agents |
|
|
85
85
|
|
|
86
|
-
With a secret key (`STRAIT_SECRET_KEY` or `--secret-key`), `doctor` also runs [`strait app verify`](#whats-wrong-with-my-setup-strait-app-verify) and prints its checks under "Account"; `--host` is then optional. If those checks can't run (a refused or malformed key, no connection, the 6-a-minute limit) it says "Could not check"
|
|
86
|
+
With a secret key (`STRAIT_SECRET_KEY` or `--secret-key`), `doctor` also runs [`strait app verify`](#whats-wrong-with-my-setup-strait-app-verify) and prints its checks under "Account"; `--host` is then optional. If those checks can't run (a refused or malformed key, no connection, the 6-a-minute limit) it says "Could not check". They are shown but don't change the exit code, so a CI job that already sets `STRAIT_SECRET_KEY` keeps passing as before; add `--strict` to exit `1` when one fails or can't run. `--json` adds them as `verify` (its own `ok` inside); the top-level `ok` matches the exit code.
|
|
87
87
|
|
|
88
88
|
Exit codes: `0` no errors (warnings allowed), `1` a check failed, `2` usage problem. What a terminal can't see (intent filters, the Associated Domains entitlement) is checked by `doctor()` inside a debug build and by the [free tools](https://straitlink.in/tools/).
|
|
89
89
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@straitlink/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Strait deep links from the terminal: init sets them up in a React Native, Expo, Flutter or Android app, doctor checks your link host, app verify checks your whole setup with a fix for each problem, links creates and lists links and saves QR codes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strait",
|
package/src/app.mjs
CHANGED
|
@@ -99,8 +99,9 @@ function formatVerify(answer) {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/** `strait doctor`'s account block: the verify answer, or why it could not run (never a silent pass). */
|
|
102
|
-
export function formatAccount(answer) {
|
|
102
|
+
export function formatAccount(answer, strict = false) {
|
|
103
103
|
const head = 'Account (strait app verify)';
|
|
104
|
-
|
|
105
|
-
return lines([head,
|
|
104
|
+
const soft = !strict && answer?.ok !== true ? ['These checks don\'t change doctor\'s exit code: add --strict to make doctor fail on them.'] : [];
|
|
105
|
+
if (answer?.error) return lines([head, ` Could not check: ${answer.error}`, ...soft]);
|
|
106
|
+
return lines([head, ...verifyLines(answer), '', verifyVerdict(answer), ...soft]);
|
|
106
107
|
}
|
package/src/cli.mjs
CHANGED
|
@@ -31,6 +31,7 @@ const OPTIONS = {
|
|
|
31
31
|
cert: { type: 'string', multiple: true },
|
|
32
32
|
'secret-key': { type: 'string' },
|
|
33
33
|
'api-url': { type: 'string' },
|
|
34
|
+
strict: { type: 'boolean', default: false },
|
|
34
35
|
json: { type: 'boolean', default: false },
|
|
35
36
|
},
|
|
36
37
|
links: {
|
|
@@ -93,7 +94,8 @@ doctor options (the same checks and messages as doctor() in the SDKs)
|
|
|
93
94
|
--cert <sha256> Android signing certificate fingerprint (repeatable)
|
|
94
95
|
--key <st_pub_live_…> Also check the publishable key (env STRAIT_PUBLISHABLE_KEY)
|
|
95
96
|
--secret-key <st_live_…> Also run strait app verify (env STRAIT_SECRET_KEY); --host is then optional.
|
|
96
|
-
If it can't run (refused key, no connection), doctor says so
|
|
97
|
+
If it can't run (refused key, no connection), doctor says so
|
|
98
|
+
--strict Exit 1 when an account check fails or can't run (default: shown, exit unchanged)
|
|
97
99
|
--api-url <url> Engine for those checks (env STRAIT_API_URL, default https://strait.link)
|
|
98
100
|
--json Print the reports as JSON
|
|
99
101
|
With neither --android nor --ios, both files are checked and the apps they list are shown.
|
|
@@ -255,7 +257,8 @@ async function doctor({ values: v }, { out, env, io }) {
|
|
|
255
257
|
result = await runDoctor({ host: normalizeHost(hostIn), key, android: v.android?.trim(), ios: v.ios?.trim(), certs: v.cert ?? [], fetch: fetchImpl });
|
|
256
258
|
}
|
|
257
259
|
if (secretIn) {
|
|
258
|
-
// A secret key adds the engine's checks (docs/adr/0003)
|
|
260
|
+
// A secret key adds the engine's checks (docs/adr/0003), always shown; if they can't run, that is shown too.
|
|
261
|
+
// They change the exit code only with --strict, so a CI job that already sets the key keeps passing as before.
|
|
259
262
|
try {
|
|
260
263
|
const call = apiClient({ apiUrl: v['api-url'] ?? env.STRAIT_API_URL ?? DEFAULT_API_URL, key: secretKey(secretIn), fetch: fetchImpl, userAgent: `strait-cli/${CLI_VERSION}` });
|
|
261
264
|
result.verify = await getVerify(call);
|
|
@@ -263,9 +266,9 @@ async function doctor({ values: v }, { out, env, io }) {
|
|
|
263
266
|
if (!(e instanceof ApiError || e instanceof UsageError)) throw e;
|
|
264
267
|
result.verify = { error: e.message };
|
|
265
268
|
}
|
|
266
|
-
if (result.verify?.ok !== true) result.ok = false;
|
|
269
|
+
if (v.strict && result.verify?.ok !== true) result.ok = false;
|
|
267
270
|
}
|
|
268
|
-
const text = v.json ? toJson(result) : [hostIn && formatDoctor(result), secretIn && formatAccount(result.verify)].filter(Boolean).join('\n\n');
|
|
271
|
+
const text = v.json ? toJson(result) : [hostIn && formatDoctor(result), secretIn && formatAccount(result.verify, v.strict)].filter(Boolean).join('\n\n');
|
|
269
272
|
out.write(text + '\n');
|
|
270
273
|
return result.ok ? 0 : 1;
|
|
271
274
|
}
|
package/src/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Kept equal to package.json version (test/links.test.mjs checks it). Sent as the API User-Agent.
|
|
2
|
-
export const CLI_VERSION = '0.3.
|
|
2
|
+
export const CLI_VERSION = '0.3.6';
|