wood-fired-tasks 2.0.1 → 2.0.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/CHANGELOG.md +16 -0
- package/dist/cli/commands/setup.d.ts +28 -15
- package/dist/cli/commands/setup.js +31 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,22 @@ vulnerabilities, supply-chain pinning) are always called out under `Security`.
|
|
|
13
13
|
|
|
14
14
|
_No changes yet._
|
|
15
15
|
|
|
16
|
+
## [v2.0.2] - 2026-06-08
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- **`tasks setup` remote onboarding now reaches the automated device-flow login
|
|
20
|
+
instead of always falling back to manual PAT entry.** The onboarding probe
|
|
21
|
+
read the server's OIDC state from `GET /health/detailed`, but v2.0's identity
|
|
22
|
+
cutover put that endpoint behind Bearer-PAT auth — so an unauthenticated probe
|
|
23
|
+
(the only kind possible *before* you have a token) always got `401`, the OIDC
|
|
24
|
+
state was "undeterminable", and setup fell back to asking you to paste a
|
|
25
|
+
personal access token. The probe now targets the **public** `GET /auth/login`
|
|
26
|
+
endpoint (`redirect: 'manual'`): a `3xx` redirect to the IdP means browser
|
|
27
|
+
login is available (`ready`), a `501` means OIDC is disabled (`manual-pat`).
|
|
28
|
+
Verified against a live OIDC-ready server: the probe now resolves `ready`
|
|
29
|
+
where it previously 401'd, so the device-flow browser login launches as
|
|
30
|
+
intended.
|
|
31
|
+
|
|
16
32
|
## [v2.0.1] - 2026-06-08
|
|
17
33
|
|
|
18
34
|
### Fixed
|
|
@@ -274,9 +274,11 @@ export declare function writeRemoteMcpEntryOnly(options?: RunSetupOptions): RunS
|
|
|
274
274
|
*/
|
|
275
275
|
export type SetupMode = 'local' | 'service' | 'remote';
|
|
276
276
|
/**
|
|
277
|
-
* Coarse OIDC subsystem state
|
|
278
|
-
*
|
|
279
|
-
* (
|
|
277
|
+
* Coarse OIDC subsystem state used by the remote-setup branch selector (#807)
|
|
278
|
+
* to route deterministically. Derived by {@link probeOidcState} from the public
|
|
279
|
+
* `/auth/login` endpoint (`ready` = redirects to IdP, `disabled` = 501 stub).
|
|
280
|
+
* `degraded` is retained for back-compat but is no longer emitted by the probe
|
|
281
|
+
* (an unhealthy OIDC surfaces as an inconclusive status → manual-PAT fallback).
|
|
280
282
|
*/
|
|
281
283
|
export type OidcState = 'ready' | 'disabled' | 'degraded';
|
|
282
284
|
/**
|
|
@@ -287,10 +289,12 @@ export type OidcState = 'ready' | 'disabled' | 'degraded';
|
|
|
287
289
|
*/
|
|
288
290
|
export type RemoteOnboardingMethod = 'device-flow' | 'manual-pat';
|
|
289
291
|
/**
|
|
290
|
-
* Result of probing
|
|
291
|
-
*
|
|
292
|
-
* - `{ ok:
|
|
293
|
-
*
|
|
292
|
+
* Result of probing the server for whether browser/device-flow login is
|
|
293
|
+
* available.
|
|
294
|
+
* - `{ ok: true, oidc }` — the probe got a conclusive answer (`ready` =
|
|
295
|
+
* device-flow available, `disabled` = no OIDC → manual PAT).
|
|
296
|
+
* - `{ ok: false, reason }` — network error / inconclusive status. The
|
|
297
|
+
* `reason` is surfaced to the user before falling back to manual PAT.
|
|
294
298
|
*/
|
|
295
299
|
export type OidcProbeResult = {
|
|
296
300
|
ok: true;
|
|
@@ -302,13 +306,22 @@ export type OidcProbeResult = {
|
|
|
302
306
|
/** Injectable probe signature so tests can drive each branch without a server. */
|
|
303
307
|
export type OidcProbe = (baseUrl: string) => Promise<OidcProbeResult>;
|
|
304
308
|
/**
|
|
305
|
-
* Default OIDC probe: `GET <baseUrl>/
|
|
309
|
+
* Default OIDC probe: `GET <baseUrl>/auth/login` (the browser-login entry
|
|
310
|
+
* point) and read OIDC availability from the HTTP status.
|
|
306
311
|
*
|
|
307
|
-
* `/health/detailed`
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
+
* Why NOT `/health/detailed` (the original #807 target): v2.0's identity
|
|
313
|
+
* cutover put `/health/detailed` behind Bearer-PAT auth, so an unauthenticated
|
|
314
|
+
* probe — which is the ONLY kind possible during onboarding, before any PAT
|
|
315
|
+
* exists — gets a hard `401 {"error":"UNAUTHORIZED"}` with NO `oidc.state` in
|
|
316
|
+
* the body. That made this probe always fail and `setup --remote` always fall
|
|
317
|
+
* back to manual-PAT entry, defeating the automated device-flow login
|
|
318
|
+
* (wood-fired-tasks #831).
|
|
319
|
+
*
|
|
320
|
+
* `/auth/login` is PUBLIC (`skipAuth: true`) and an unambiguous signal:
|
|
321
|
+
* - OIDC ready → `302` redirect to the IdP authorize URL.
|
|
322
|
+
* - OIDC disabled → the disabled-stub returns `501`.
|
|
323
|
+
* We do NOT follow the redirect (`redirect: 'manual'`) — only its status
|
|
324
|
+
* matters. Any other/unreachable status is inconclusive → manual-PAT fallback.
|
|
312
325
|
* Bounded by a 5s timeout so a half-open server can't hang `setup --remote`.
|
|
313
326
|
*/
|
|
314
327
|
export declare function probeOidcState(baseUrl: string): Promise<OidcProbeResult>;
|
|
@@ -367,8 +380,8 @@ export declare function persistManualPat(baseUrl: string, token: string): Promis
|
|
|
367
380
|
export interface RunSetupInteractiveOptions extends RunSetupOptions {
|
|
368
381
|
/**
|
|
369
382
|
* Injectable OIDC-state probe for the `--remote` path (#807). Defaults to
|
|
370
|
-
* {@link probeOidcState} (a real `GET /
|
|
371
|
-
* drive the ready / disabled /
|
|
383
|
+
* {@link probeOidcState} (a real `GET /auth/login`, public). Tests stub this
|
|
384
|
+
* to drive the ready / disabled / probe-failure branches.
|
|
372
385
|
*/
|
|
373
386
|
oidcProbe?: OidcProbe;
|
|
374
387
|
/**
|
|
@@ -546,40 +546,50 @@ export function writeRemoteMcpEntryOnly(options = {}) {
|
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
548
|
/**
|
|
549
|
-
* Default OIDC probe: `GET <baseUrl>/
|
|
549
|
+
* Default OIDC probe: `GET <baseUrl>/auth/login` (the browser-login entry
|
|
550
|
+
* point) and read OIDC availability from the HTTP status.
|
|
550
551
|
*
|
|
551
|
-
* `/health/detailed`
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
*
|
|
552
|
+
* Why NOT `/health/detailed` (the original #807 target): v2.0's identity
|
|
553
|
+
* cutover put `/health/detailed` behind Bearer-PAT auth, so an unauthenticated
|
|
554
|
+
* probe — which is the ONLY kind possible during onboarding, before any PAT
|
|
555
|
+
* exists — gets a hard `401 {"error":"UNAUTHORIZED"}` with NO `oidc.state` in
|
|
556
|
+
* the body. That made this probe always fail and `setup --remote` always fall
|
|
557
|
+
* back to manual-PAT entry, defeating the automated device-flow login
|
|
558
|
+
* (wood-fired-tasks #831).
|
|
559
|
+
*
|
|
560
|
+
* `/auth/login` is PUBLIC (`skipAuth: true`) and an unambiguous signal:
|
|
561
|
+
* - OIDC ready → `302` redirect to the IdP authorize URL.
|
|
562
|
+
* - OIDC disabled → the disabled-stub returns `501`.
|
|
563
|
+
* We do NOT follow the redirect (`redirect: 'manual'`) — only its status
|
|
564
|
+
* matters. Any other/unreachable status is inconclusive → manual-PAT fallback.
|
|
556
565
|
* Bounded by a 5s timeout so a half-open server can't hang `setup --remote`.
|
|
557
566
|
*/
|
|
558
567
|
export async function probeOidcState(baseUrl) {
|
|
559
|
-
const probeUrl = new URL('/
|
|
568
|
+
const probeUrl = new URL('/auth/login', baseUrl).toString();
|
|
560
569
|
let response;
|
|
561
570
|
try {
|
|
562
|
-
response = await fetch(probeUrl, {
|
|
571
|
+
response = await fetch(probeUrl, {
|
|
572
|
+
method: 'GET',
|
|
573
|
+
redirect: 'manual',
|
|
574
|
+
signal: AbortSignal.timeout(5000),
|
|
575
|
+
});
|
|
563
576
|
}
|
|
564
577
|
catch (err) {
|
|
565
578
|
const message = err instanceof Error ? err.message : String(err);
|
|
566
579
|
return { ok: false, reason: `could not reach ${probeUrl}: ${message}` };
|
|
567
580
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
}
|
|
575
|
-
catch {
|
|
576
|
-
return { ok: false, reason: `${probeUrl} returned a non-JSON body` };
|
|
581
|
+
// 3xx → /auth/login is redirecting to the IdP → device-flow is available.
|
|
582
|
+
// (`redirect: 'manual'` surfaces the real 3xx status rather than following
|
|
583
|
+
// it; some runtimes report an opaque-redirect as status 0 with type
|
|
584
|
+
// 'opaqueredirect', which we also treat as a redirect.)
|
|
585
|
+
if ((response.status >= 300 && response.status < 400) || response.type === 'opaqueredirect') {
|
|
586
|
+
return { ok: true, oidc: 'ready' };
|
|
577
587
|
}
|
|
578
|
-
|
|
579
|
-
if (
|
|
580
|
-
return { ok: true, oidc };
|
|
588
|
+
// 501 → the OIDC-disabled stub → no browser login; use a manual PAT.
|
|
589
|
+
if (response.status === 501) {
|
|
590
|
+
return { ok: true, oidc: 'disabled' };
|
|
581
591
|
}
|
|
582
|
-
return { ok: false, reason: `${probeUrl}
|
|
592
|
+
return { ok: false, reason: `${probeUrl} returned HTTP ${response.status}` };
|
|
583
593
|
}
|
|
584
594
|
/**
|
|
585
595
|
* Map a probe outcome to the onboarding method (task #807).
|