@antasphere/cli-core 0.5.0 → 0.7.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.
Files changed (48) hide show
  1. package/README.md +324 -85
  2. package/dist/auth.d.ts +1 -1
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/config.d.ts +120 -62
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +207 -91
  7. package/dist/config.js.map +1 -1
  8. package/dist/connect-on-demand.d.ts +196 -99
  9. package/dist/connect-on-demand.d.ts.map +1 -1
  10. package/dist/connect-on-demand.js +565 -117
  11. package/dist/connect-on-demand.js.map +1 -1
  12. package/dist/connect.d.ts +8 -8
  13. package/dist/connect.d.ts.map +1 -1
  14. package/dist/index.d.ts +25 -17
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +20 -15
  17. package/dist/index.js.map +1 -1
  18. package/dist/kept-keys.d.ts +208 -0
  19. package/dist/kept-keys.d.ts.map +1 -0
  20. package/dist/kept-keys.js +484 -0
  21. package/dist/kept-keys.js.map +1 -0
  22. package/dist/lock.d.ts +65 -0
  23. package/dist/lock.d.ts.map +1 -0
  24. package/dist/lock.js +408 -0
  25. package/dist/lock.js.map +1 -0
  26. package/dist/migrate.d.ts +9 -3
  27. package/dist/migrate.d.ts.map +1 -1
  28. package/dist/migrate.js +32 -11
  29. package/dist/migrate.js.map +1 -1
  30. package/dist/resolve.d.ts +12 -4
  31. package/dist/resolve.d.ts.map +1 -1
  32. package/dist/resolve.js +12 -8
  33. package/dist/resolve.js.map +1 -1
  34. package/dist/sign-in.d.ts +266 -0
  35. package/dist/sign-in.d.ts.map +1 -0
  36. package/dist/sign-in.js +398 -0
  37. package/dist/sign-in.js.map +1 -0
  38. package/package.json +1 -1
  39. package/src/auth.ts +1 -1
  40. package/src/config.ts +303 -136
  41. package/src/connect-on-demand.ts +801 -223
  42. package/src/connect.ts +8 -8
  43. package/src/index.ts +42 -26
  44. package/src/kept-keys.ts +561 -0
  45. package/src/lock.ts +479 -0
  46. package/src/migrate.ts +33 -11
  47. package/src/resolve.ts +20 -15
  48. package/src/sign-in.ts +601 -0
@@ -0,0 +1,398 @@
1
+ import { HUB_TOOL, loadConfig } from './config.js';
2
+ import { keysOfProfile, newestKey, sameEmail, sortKeys, text } from './kept-keys.js';
3
+ import { normalizeUrl, profileUrl, sameInstance } from './resolve.js';
4
+ /**
5
+ * Which Antasphere login signs a tool command in (R2, PRDCT-3521): the login
6
+ * at the hub the command's SITE trusts, never the machine's active hub login.
7
+ *
8
+ * - A LOGIN is an entry of the hub file (`HUB_TOOL`, `config.json`) that
9
+ * holds a key: its name, its hub (`baseUrl`, else the hub's cloud URL), its
10
+ * e-mail. Several may share a hub. An entry that holds a key and whose hub
11
+ * cannot be told (a `baseUrl` that does not parse as an `http:` or `https:`
12
+ * URL) is no login but UNDECIDED (`undecidedLogins`): unknown is not gone,
13
+ * so while one is there no kept key is judged gone for want of a login.
14
+ * Every function whose answer decides a stale key requires `hubCloudUrl`,
15
+ * so an entry with no `baseUrl` always has a hub.
16
+ * - Rule R2, the hub (`chooseHub`): a site that names its hub (discovery
17
+ * `auth.hub`) decides it, and `--hub` or `ANTASPHERE_URL` naming ANOTHER
18
+ * hub is refused before any exchange, both named. A site that names none (a
19
+ * server from before), or one never reached: `--hub`, else
20
+ * `ANTASPHERE_URL`, else the hub of the profile's newest kept key whose
21
+ * login is still in place, else the hub its last exchange went through
22
+ * (`lastHub`) while a login is in place there, else an error naming the
23
+ * machine's logins and the one command that picks one. Never a guess, even
24
+ * with one login. A recovery after a 401 (`decide`'s internal `hubHint`)
25
+ * continues the command whose key was refused: for a site that names none,
26
+ * right after `ANTASPHERE_URL`, the refused key's hub while a login is in
27
+ * place there.
28
+ * - Rule 3, the login at that hub (`chooseLogin`): `--email` when given,
29
+ * else the only one, else the one whose address the profile's newest kept
30
+ * key there carries, else an error naming them; none there, an error
31
+ * naming the hub and `login`.
32
+ *
33
+ * `planSignIn` is the one decision the command (`connectOnDemand`) and a
34
+ * listing share: pure, it reads the hub file, writes nothing and asks
35
+ * nothing of the network.
36
+ */
37
+ /**
38
+ * A hub address this CLI can read: the URL a non-blank string parses as, when
39
+ * its scheme is `http:` or `https:`; undefined otherwise (a value that is not
40
+ * a string included).
41
+ */
42
+ export function httpUrl(value) {
43
+ const raw = text(value);
44
+ if (!raw)
45
+ return undefined;
46
+ try {
47
+ const url = new URL(raw);
48
+ return url.protocol === 'http:' || url.protocol === 'https:' ? url : undefined;
49
+ }
50
+ catch {
51
+ return undefined;
52
+ }
53
+ }
54
+ /**
55
+ * The `hubCloudUrl` of a function whose answer decides a stale key, trimmed.
56
+ * Missing, blank, or not an `http:` or `https:` URL, it is a `TypeError`
57
+ * naming the option: with it, a hub entry with no `baseUrl` always has a hub
58
+ * (its default address, the rule the selection applies).
59
+ */
60
+ export function requireHubCloudUrl(fn, value) {
61
+ const raw = text(value);
62
+ if (raw && httpUrl(raw))
63
+ return raw;
64
+ throw new TypeError(`${fn}: the hubCloudUrl option is required (the hub's cloud URL, the hub of a login with no baseUrl); ` +
65
+ (raw ? `"${raw}" is not an http: or https: URL.` : 'it is missing or blank.'));
66
+ }
67
+ /**
68
+ * A hub entry's hub, normalized: its `baseUrl`, else (none, or a blank one)
69
+ * `hubCloudUrl`; undefined when that is not an `http:` or `https:` URL (a
70
+ * `baseUrl` that is not a string included).
71
+ */
72
+ function entryHub(baseUrl, hubCloudUrl) {
73
+ const none = baseUrl === undefined || baseUrl === null || (typeof baseUrl === 'string' && !baseUrl.trim());
74
+ const url = httpUrl(none ? hubCloudUrl : baseUrl);
75
+ return url ? normalizeUrl(url.href) : undefined;
76
+ }
77
+ /**
78
+ * One read of the hub file: each entry that holds a key is a login when its
79
+ * hub can be told (`entryHub`), and UNDECIDED otherwise. An entry with no key
80
+ * is neither. Strict like `loadConfig`: a hub file that does not parse throws.
81
+ */
82
+ export function readLogins(env, hubCloudUrl) {
83
+ const read = { logins: [], undecided: [] };
84
+ for (const [name, profile] of Object.entries(loadConfig(env, HUB_TOOL).profiles)) {
85
+ if (!text(profile.apiKey))
86
+ continue;
87
+ const hub = entryHub(profile.baseUrl, hubCloudUrl);
88
+ if (hub === undefined) {
89
+ read.undecided.push(name);
90
+ continue;
91
+ }
92
+ const email = text(profile.email);
93
+ read.logins.push({ name, hub, ...(email ? { email } : {}), profile });
94
+ }
95
+ return read;
96
+ }
97
+ /**
98
+ * The logins of this machine, in the hub file's order: every entry that holds
99
+ * a key and whose hub can be told: its `baseUrl` when that is an `http:` or
100
+ * `https:` URL, else (no `baseUrl`, or a blank one) `hubCloudUrl`. An entry
101
+ * with no key is no login, nor one whose hub cannot be told: a `baseUrl` that
102
+ * does not parse as such a URL (`undecidedLogins` names those), or none when
103
+ * no `hubCloudUrl` is given. Strict like `loadConfig`: a hub file that does
104
+ * not parse throws.
105
+ */
106
+ export function listLogins(env, opts = {}) {
107
+ return readLogins(env, text(opts.hubCloudUrl)).logins;
108
+ }
109
+ /**
110
+ * The names of the hub file's entries that hold a key and whose hub cannot be
111
+ * told (a `baseUrl` that does not parse as an `http:` or `https:` URL), in the
112
+ * file's order, for a listing to say. Such an entry is no login, and while
113
+ * one is there no kept key is judged gone for want of a login: nothing is
114
+ * revoked on that ground. `hubCloudUrl` is required (a `TypeError` naming it):
115
+ * an entry with no `baseUrl` is at it.
116
+ */
117
+ export function undecidedLogins(env, opts) {
118
+ return readLogins(env, requireHubCloudUrl('undecidedLogins', opts?.hubCloudUrl)).undecided;
119
+ }
120
+ /** How a login is named in a sentence: its address, or that it carries none. */
121
+ function addressOf(login) {
122
+ return login.email ?? '(no address)';
123
+ }
124
+ /**
125
+ * How every sentence names the profile to sign in on at `site`: `--profile <name>` when that
126
+ * profile is on disk there (`onDisk`: its name), else `--api-url <site>`. `--profile` names only a
127
+ * profile on disk (`resolveProfile` throws `Unknown profile` otherwise); `--api-url` selects the
128
+ * site's profile, or makes it.
129
+ */
130
+ export function profileFlag(site, onDisk) {
131
+ return onDisk ? `--profile ${onDisk}` : `--api-url ${normalizeUrl(site)}`;
132
+ }
133
+ /** The flag of `chooseHub`'s and `chooseLogin`'s sentences: their `profile` is the one on disk at the site. */
134
+ function flagOf(input) {
135
+ return profileFlag(input.siteUrl, input.profile ? input.profileName : undefined);
136
+ }
137
+ /** Rule R2: the hub that signs a command on this site in. */
138
+ export function chooseHub(input) {
139
+ const kept = sortKeys(input.profile, input.logins, input.siteHub, new Date().toISOString()).kept;
140
+ return givenHub(input) ?? profileHub(input, kept, lastHubOf(input.profile), flagOf(input));
141
+ }
142
+ /** Whether a kept key's login is in place: a login at its hub carrying its address. */
143
+ function inPlace(key, logins) {
144
+ return logins.some((l) => sameInstance(l.hub, key.hub) && sameEmail(l.email, key.email));
145
+ }
146
+ /** The hub a profile's last exchange went through, normalized; undefined when it holds none, or not a string. */
147
+ function lastHubOf(profile) {
148
+ const hub = text(profile?.lastHub);
149
+ return hub ? normalizeUrl(hub) : undefined;
150
+ }
151
+ /**
152
+ * Rule R2's first half: the hub the site names (`--hub` or `ANTASPHERE_URL` naming another one
153
+ * refused, both named), else `--hub`, else `ANTASPHERE_URL`; undefined when none of them names one.
154
+ */
155
+ function givenHub(input) {
156
+ const site = normalizeUrl(input.siteUrl);
157
+ const named = text(input.siteHub);
158
+ const option = text(input.hubUrl);
159
+ const env = text(input.envHub);
160
+ if (named) {
161
+ const hub = normalizeUrl(named);
162
+ if (option && !sameInstance(option, hub)) {
163
+ return {
164
+ kind: 'refused',
165
+ sentence: `${site} signs in through the Antasphere hub ${hub}, and --hub names ${normalizeUrl(option)}. ` +
166
+ 'Drop --hub: a site that names its hub decides it.'
167
+ };
168
+ }
169
+ if (env && !sameInstance(env, hub)) {
170
+ return {
171
+ kind: 'refused',
172
+ sentence: `${site} signs in through the Antasphere hub ${hub}, and ANTASPHERE_URL names ${normalizeUrl(env)}. ` +
173
+ 'Unset ANTASPHERE_URL: a site that names its hub decides it.'
174
+ };
175
+ }
176
+ return { kind: 'hub', hub, source: 'site' };
177
+ }
178
+ if (option)
179
+ return { kind: 'hub', hub: normalizeUrl(option), source: 'option' };
180
+ if (env)
181
+ return { kind: 'hub', hub: normalizeUrl(env), source: 'env' };
182
+ return undefined;
183
+ }
184
+ /**
185
+ * A recovery's hint, for a site that names no hub and no hub given (internal, never an option and
186
+ * never refused): the hub of the key the site just refused, while a login is in place there.
187
+ */
188
+ function hintedHub(hint, logins) {
189
+ const hub = text(hint);
190
+ if (!hub || !logins.some((l) => sameInstance(l.hub, hub)))
191
+ return undefined;
192
+ return { kind: 'hub', hub: normalizeUrl(hub), source: 'refused_key' };
193
+ }
194
+ /**
195
+ * Rule R2's second half, for a site that names no hub and no hub given: the hub of the newest kept
196
+ * key whose login is in place, else the profile's `lastHub` while a login is in place there, else
197
+ * the pick-a-hub sentence, naming the profile by `flag` (`profileFlag`).
198
+ */
199
+ function profileHub(input, kept, remembered, flag) {
200
+ const site = normalizeUrl(input.siteUrl);
201
+ const last = newestKey(kept.filter((k) => inPlace(k, input.logins)));
202
+ if (last)
203
+ return { kind: 'hub', hub: normalizeUrl(last.hub), source: 'kept_key' };
204
+ // The hub of the profile's last sign-in, while a login is in place there.
205
+ if (remembered && input.logins.some((l) => sameInstance(l.hub, remembered))) {
206
+ return { kind: 'hub', hub: remembered, source: 'remembered' };
207
+ }
208
+ const n = input.logins.length;
209
+ const holds = n === 0
210
+ ? 'This machine holds no Antasphere login.'
211
+ : `This machine holds ${n} Antasphere login${n === 1 ? '' : 's'}: ` +
212
+ `${input.logins.map((l) => `${addressOf(l)} at ${l.hub}`).join(', ')}.`;
213
+ const history = remembered
214
+ ? `last signed in through ${remembered}, where this machine holds no login now`
215
+ : 'has never signed in there';
216
+ return {
217
+ kind: 'pick_hub',
218
+ candidates: input.logins,
219
+ sentence: `${site} names no Antasphere hub (it runs a version from before sites named theirs), and profile ` +
220
+ `"${input.profileName}" ${history}. ${holds} Pick the hub this site trusts: ` +
221
+ `${input.bin} ${flag} login --hub <hub>.`
222
+ };
223
+ }
224
+ /** Rule 3: the login at that hub. */
225
+ export function chooseLogin(input) {
226
+ // Rule 3 reads only the kept keys at this hub: what the site names elsewhere does not matter here.
227
+ const kept = sortKeys(input.profile, input.logins, undefined, new Date().toISOString()).kept;
228
+ return pickLogin(input, kept, flagOf(input));
229
+ }
230
+ /** Rule 3, its sentences naming the profile by `flag` (`profileFlag`). */
231
+ function pickLogin(input, kept, flag) {
232
+ const site = normalizeUrl(input.siteUrl);
233
+ const hub = normalizeUrl(input.hub);
234
+ const atHub = input.logins.filter((l) => sameInstance(l.hub, hub));
235
+ const none = (fix, forAddress = '') => ({
236
+ kind: 'no_login_at_hub',
237
+ sentence: `${site} signs in through the Antasphere hub ${hub}, and this machine holds no Antasphere login there` +
238
+ `${forAddress}. Run ${input.bin} ${flag} ${fix} to sign in.`
239
+ });
240
+ const wanted = text(input.email);
241
+ if (wanted) {
242
+ const match = atHub.find((l) => sameEmail(l.email, wanted));
243
+ return match ? { kind: 'login', login: match } : none(`login --email ${wanted}`, ` for ${wanted}`);
244
+ }
245
+ if (atHub.length === 0)
246
+ return none('login');
247
+ // One account may sit in several entries (one address at one hub): they are one login.
248
+ const accounts = [];
249
+ for (const l of atHub) {
250
+ if (!accounts.some((a) => a === l || (a.email !== undefined && sameEmail(a.email, l.email)))) {
251
+ accounts.push(l);
252
+ }
253
+ }
254
+ if (accounts.length === 1)
255
+ return { kind: 'login', login: accounts[0] };
256
+ const last = newestKey(kept.filter((k) => sameInstance(k.hub, hub) && atHub.some((l) => sameEmail(l.email, k.email))));
257
+ const used = last ? atHub.find((l) => sameEmail(l.email, last.email)) : undefined;
258
+ if (used)
259
+ return { kind: 'login', login: used };
260
+ return {
261
+ kind: 'pick_login',
262
+ candidates: atHub,
263
+ sentence: `This machine holds ${accounts.length} Antasphere logins at ${hub} ` +
264
+ `(${accounts.map(addressOf).join(', ')}), and profile "${input.profileName}" has used none of them. ` +
265
+ `Pick one: ${input.bin} ${flag} login --email <address>.`
266
+ };
267
+ }
268
+ /** A profile's remembered site facts, when they read as such. */
269
+ export function siteFactsOf(profile) {
270
+ const s = profile?.site;
271
+ if (typeof s !== 'object' || s === null)
272
+ return undefined;
273
+ const f = s;
274
+ const nullableText = (v) => v === null || typeof v === 'string';
275
+ if (!nullableText(f.hub) || typeof f.federated !== 'boolean' || !nullableText(f.name))
276
+ return undefined;
277
+ if (!nullableText(f.cliVersion) || typeof f.seenAt !== 'string')
278
+ return undefined;
279
+ return s;
280
+ }
281
+ /**
282
+ * The plan of who signs a profile in on a site, in this order: the profile's
283
+ * own key (`signed_in`, `own_key`); a site that signs in by itself
284
+ * (`site.federated` false: `needs_login`, `own_sign_in`); rule R2 (a refusal:
285
+ * `needs_login`, `refused`, with its sentence); rule 3; then the kept key:
286
+ * servable (`signed_in`, `kept_key`), else a login ready to sign in at the
287
+ * next command (`will_sign_in`, `login_ready`), no login at the hub
288
+ * (`no_login_at_hub`), several (`pick_login`), nothing found for a site that
289
+ * names no hub (`pick_hub`), nothing known at all (`unknown`,
290
+ * `never_reached`). Pure: it reads the hub file once (`readLogins`), writes
291
+ * nothing and asks nothing of the network. A kept key is servable only on a
292
+ * profile at `siteUrl`, at the hub R2 picks, to the login rule 3 picks.
293
+ * `hubCloudUrl` is required: a `TypeError` naming it otherwise.
294
+ */
295
+ export function planSignIn(input) {
296
+ const hubCloudUrl = requireHubCloudUrl('planSignIn', input.hubCloudUrl);
297
+ const { logins, undecided } = readLogins(input.env, hubCloudUrl);
298
+ return decide({
299
+ siteUrl: input.siteUrl,
300
+ profileName: input.profileName,
301
+ profile: input.profile,
302
+ cloudUrl: input.cloudUrl,
303
+ site: undefined,
304
+ logins,
305
+ undecided,
306
+ envHub: input.envHub,
307
+ hubUrl: input.hubUrl,
308
+ email: input.email,
309
+ bin: input.tool,
310
+ ownKeyFirst: true,
311
+ now: new Date().toISOString()
312
+ }).plan;
313
+ }
314
+ /** The plan, and the sentence of its refusal or of what the person must pick (internal). */
315
+ export function decide(input) {
316
+ const { profile, logins } = input;
317
+ const siteUrl = normalizeUrl(input.siteUrl);
318
+ const at = profile ? profileUrl(profile, input.cloudUrl) : undefined;
319
+ const here = profile !== undefined && at !== undefined && sameInstance(at, siteUrl);
320
+ const site = input.site ?? (here ? siteFactsOf(profile) : undefined);
321
+ // Unknown is not gone: an entry whose hub cannot be told may be any key's login.
322
+ const judgeGone = input.undecided.length === 0;
323
+ const sort = here
324
+ ? sortKeys(profile, logins, site?.hub, input.now, { judgeGone })
325
+ : { kept: [], stale: [] };
326
+ const plan = (state, via, reason, more = {}) => ({
327
+ state,
328
+ via,
329
+ hub: null,
330
+ login: null,
331
+ keptKey: null,
332
+ reason,
333
+ refusal: null,
334
+ candidates: [],
335
+ stale: sort.stale,
336
+ ...more
337
+ });
338
+ if (input.ownKeyFirst && here && text(profile.apiKey)) {
339
+ return { plan: plan('signed_in', 'key', 'own_key'), sentence: null };
340
+ }
341
+ if (site?.federated === false)
342
+ return { plan: plan('needs_login', null, 'own_sign_in'), sentence: null };
343
+ const ruleInput = { siteUrl, logins, profileName: input.profileName, bin: input.bin };
344
+ const remembered = here ? lastHubOf(profile) : undefined;
345
+ const hubInput = { ...ruleInput, siteHub: site?.hub, hubUrl: input.hubUrl, envHub: input.envHub };
346
+ // The sentences name the profile by --profile only when it is on disk at this site.
347
+ const flag = profileFlag(siteUrl, here ? input.profileName : undefined);
348
+ // A recovery continues the command whose key was refused: that key's hub comes before the profile's.
349
+ const hub = givenHub(hubInput) ??
350
+ hintedHub(input.hubHint, logins) ??
351
+ profileHub(hubInput, sort.kept, remembered, flag);
352
+ if (hub.kind === 'refused') {
353
+ return { plan: plan('needs_login', null, 'refused', { refusal: hub.sentence }), sentence: hub.sentence };
354
+ }
355
+ if (hub.kind === 'pick_hub') {
356
+ // Nothing known: the site never reached, and the profile holds no key and no hub of its last sign-in.
357
+ const known = site !== undefined || (here && (keysOfProfile(profile).length > 0 || remembered !== undefined));
358
+ return known
359
+ ? {
360
+ plan: plan('needs_login', null, 'pick_hub', { candidates: hub.candidates }),
361
+ sentence: hub.sentence
362
+ }
363
+ : { plan: plan('unknown', null, 'never_reached'), sentence: hub.sentence };
364
+ }
365
+ const hubSource = hub.source;
366
+ const choice = pickLogin({ ...ruleInput, hub: hub.hub, email: input.email }, sort.kept, flag);
367
+ if (choice.kind === 'no_login_at_hub') {
368
+ return {
369
+ plan: plan('needs_login', null, 'no_login_at_hub', { hub: hub.hub }),
370
+ sentence: choice.sentence,
371
+ hubSource
372
+ };
373
+ }
374
+ if (choice.kind === 'pick_login') {
375
+ return {
376
+ plan: plan('needs_login', null, 'pick_login', { hub: hub.hub, candidates: choice.candidates }),
377
+ sentence: choice.sentence,
378
+ hubSource
379
+ };
380
+ }
381
+ const { login } = choice;
382
+ const keptKey = login.email
383
+ ? sort.kept.find((k) => sameInstance(k.hub, hub.hub) && sameEmail(k.email, login.email) && k.apiKey !== input.avoid)
384
+ : undefined;
385
+ if (keptKey) {
386
+ return {
387
+ plan: plan('signed_in', 'login', 'kept_key', { hub: hub.hub, login, keptKey }),
388
+ sentence: null,
389
+ hubSource
390
+ };
391
+ }
392
+ return {
393
+ plan: plan('will_sign_in', 'login', 'login_ready', { hub: hub.hub, login }),
394
+ sentence: null,
395
+ hubSource
396
+ };
397
+ }
398
+ //# sourceMappingURL=sign-in.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../src/sign-in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,MAAM,GAA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ere/cli-core",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Shared CLI foundation for Antasphere tool CLIs: the ~/.config/antasphere config home, profiles that are instances (with the implicit cloud profile), the flag → env → profile → cloud URL resolution, the per-command organization override, the instance email-OTP auth client, the hub→tool connect exchange with its connect-on-demand seam and stranded-key recovery, and the CliIo prompt seam",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/auth.ts CHANGED
@@ -70,7 +70,7 @@ export interface CliAuthRevoked {
70
70
  }
71
71
 
72
72
  export interface CliAuthClientOptions {
73
- /** Instance origin, e.g. https://account.antasphere.com */
73
+ /** Instance origin, e.g. https://account.example.com */
74
74
  baseUrl: string;
75
75
  fetch?: typeof globalThis.fetch;
76
76
  }