From 4811f203e85d24d8e5ee159db7184b633233ff1e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:29:00 +0000 Subject: [PATCH 1/9] deps: bump the minor-and-patch group with 5 updates (#322) Bumps the minor-and-patch group with 5 updates: | Package | From | To | | --- | --- | --- | | [@clack/prompts](https://github.com/bombshell-dev/clack/tree/HEAD/packages/prompts) | `1.8.1` | `1.9.0` | | [plist](https://github.com/TooTallNate/plist.js) | `5.0.0` | `5.1.1` | | [tar](https://github.com/isaacs/node-tar) | `7.5.22` | `7.5.23` | | [prettier](https://github.com/prettier/prettier) | `3.9.10` | `3.10.1` | | [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.72.1` | `8.72.2` | Updates `@clack/prompts` from 1.8.1 to 1.9.0 - [Release notes](https://github.com/bombshell-dev/clack/releases) - [Changelog](https://github.com/bombshell-dev/clack/blob/main/packages/prompts/CHANGELOG.md) - [Commits](https://github.com/bombshell-dev/clack/commits/@clack/prompts@1.9.0/packages/prompts) Updates `plist` from 5.0.0 to 5.1.1 - [Release notes](https://github.com/TooTallNate/plist.js/releases) - [Changelog](https://github.com/TooTallNate/plist.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/TooTallNate/plist.js/compare/plist@5.0.0...plist@5.1.1) Updates `tar` from 7.5.22 to 7.5.23 - [Release notes](https://github.com/isaacs/node-tar/releases) - [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md) - [Commits](https://github.com/isaacs/node-tar/compare/v7.5.22...v7.5.23) Updates `prettier` from 3.9.10 to 3.10.1 - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.9.10...3.10.1) Updates `typescript-eslint` from 8.72.1 to 8.72.2 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.72.2/packages/typescript-eslint) --- updated-dependencies: - dependency-name: "@clack/prompts" dependency-version: 1.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: plist dependency-version: 5.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: tar dependency-version: 7.5.23 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor-and-patch - dependency-name: prettier dependency-version: 3.10.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: typescript-eslint dependency-version: 8.72.2 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor-and-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pnpm-lock.yaml | 203 ++++++++++++++++++++++++++----------------------- 1 file changed, 109 insertions(+), 94 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4734621..01f2243 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,7 +43,7 @@ importers: dependencies: '@clack/prompts': specifier: ^1.6.0 - version: 1.8.1 + version: 1.9.0 '@modelcontextprotocol/sdk': specifier: ^1.31.0 version: 1.32.2(zod@4.6.7) @@ -67,10 +67,10 @@ importers: version: 1.16.0 plist: specifier: ^5.0.0 - version: 5.0.0 + version: 5.1.1 tar: specifier: ^7.5.16 - version: 7.5.22 + version: 7.5.23 tus-js-client: specifier: ^4.3.1 version: 4.3.1 @@ -119,7 +119,7 @@ importers: version: 12.0.3 prettier: specifier: ^3.8.4 - version: 3.9.10 + version: 3.10.1 shx: specifier: ^0.4.0 version: 0.4.0 @@ -131,7 +131,7 @@ importers: version: 6.0.3 typescript-eslint: specifier: ^8.61.1 - version: 8.72.1(eslint@10.14.0)(typescript@6.0.3) + version: 8.72.2(eslint@10.14.0)(typescript@6.0.3) packages: @@ -141,12 +141,12 @@ packages: '@cacheable/utils@2.5.0': resolution: {integrity: sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==} - '@clack/core@1.5.1': - resolution: {integrity: sha512-iHTrHA8MtVuLl2TfZySmcKv1qO2PoyC9Z7pfSDozEuV5vtY3/wcOPKJXlqJ5Oq2Cx5DDGQGAMVx6HZfRRoVEbQ==} + '@clack/core@1.6.0': + resolution: {integrity: sha512-4GZynIB2IIe431odxesswvWTCP6orvqd6e2b07b3VFWBQRqUqIHc/EPIZwFoKS692QBp+ooPuXKaJV8g4kXuYA==} engines: {node: '>= 20.12.0'} - '@clack/prompts@1.8.1': - resolution: {integrity: sha512-dlT1m5e/0yUL0kRNcQn7yGLVThkgbB0Ga/1AmfDDC/8ik6AIiSf2QLQO2zPYvefsHP0aFgxO93cVLCCfDp7kzQ==} + '@clack/prompts@1.9.0': + resolution: {integrity: sha512-tEj8X2No2A1c9NDnZECxiiJ8TP3vmFlN9tLlLeSaMqVW4tUmVG2R4qpv/eP4zymWxnymYLkLcIYVV0VcWj3RCQ==} engines: {node: '>= 20.12.0'} '@esbuild/aix-ppc64@0.28.2': @@ -315,6 +315,10 @@ packages: resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint-community/regexpp@4.12.3': + resolution: {integrity: sha512-R76UKbvsqI68DJJVTVyqFKqU98CN4+B+acxNfEA2IFarSzP0SjtKf/3+fFiXzTyv5Fj3PxLkGHe2wnVWWMxobQ==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint/config-array@0.23.5': resolution: {integrity: sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==} engines: {node: ^20.19.0 || ^22.13.0 || >=24} @@ -477,63 +481,63 @@ packages: '@types/yazl@3.3.1': resolution: {integrity: sha512-DIWfCKpsTp6hE5BDBHV3+fIL/bLUF9Bv13iDrWnMlmhQpH67buNvI291ZauQ1xcccxK3FqQ9honnXpq4R8NMuQ==} - '@typescript-eslint/eslint-plugin@8.72.1': - resolution: {integrity: sha512-5CokTWXpmbylfFabsbvHC0CAw3XLaGnoa+nFJX5FR592h/LoZsENUE6p/rg5xvkKrFEXz6pYmgI29AgXc2N3BQ==} + '@typescript-eslint/eslint-plugin@8.72.2': + resolution: {integrity: sha512-222PKFXKihmFpi/pS5njoBgdAqsPhj2/GBmFbrNw8Tq8gEG9Sv+kSlKFy4u2q+mJv9ZzJgM2Gkv/bUzRZwZw5g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^8.72.1 + '@typescript-eslint/parser': ^8.72.2 eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/parser@8.72.1': - resolution: {integrity: sha512-ZGwZP4OCfyA0AQTpEAMWz+rtX01DRhQWW5hB0ucKDEIX5U7jdmPSaMx94rQfaPAQzIYz2BimOgKOJtjfpRFQ9g==} + '@typescript-eslint/parser@8.72.2': + resolution: {integrity: sha512-llP+T1YuJOLlxEciP6OyQGtz5SMxyn+9LA2BvZw5RmToGVa1y4beEDVQL6Gje7T5WFYh19WREjDCN9Ev4gm5AA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/project-service@8.72.1': - resolution: {integrity: sha512-fAuVMkwdO/huI8nyo/WKnNKf6Gag93S56Rh3Ts5mGcavwSdaN8tRg1gCeIGX8PF+nzp1BjGfO4gHhGzW1J6jTg==} + '@typescript-eslint/project-service@8.72.2': + resolution: {integrity: sha512-6y5dLTZdHhI8Eh3yIQ/bfQhRKwn5e+TpJj64o18Cngc0iW/BCrVvrr6zGYqXPnYH31u6YXAYiFh0+qxX5mybJw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/scope-manager@8.72.1': - resolution: {integrity: sha512-lC/t6eMCZZQAAKZEYGL6RDVSuFehpdmMT6h+nJIjIa6oylN/PwDgDVtEIbB7O9xFfZYtZAYLoLlDNWKJhtF+uQ==} + '@typescript-eslint/scope-manager@8.72.2': + resolution: {integrity: sha512-iIoMJ6/8c1/QpFNyFjU0d1YzPco4MsZjQw0k3V+vfzNWAFmUmvhlyMoYEoYYDQZXc+J6Gi1X5XcxlzW2taIIGQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/tsconfig-utils@8.72.1': - resolution: {integrity: sha512-e4D5R5vpeAEPBxT2BAzsFQL3sbwyeeeo5+aczgNSRK1V734jE7pTqaGFU+fXapWEQwnZbpFaTn32+Z8DwS6OTg==} + '@typescript-eslint/tsconfig-utils@8.72.2': + resolution: {integrity: sha512-+h3iCgZXuTNtoLXcnnjP12ZUHLMqoUcIHPfQrFEXTUqvb9dF8QK9b5nv5VtSo5fLkdHuks8ehbTzZj3rImAm9w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/type-utils@8.72.1': - resolution: {integrity: sha512-iY2wlmyrXJmx4yxUGP3aYCFF3cA/6ShddOKmLU2dx7LnEykbAM8WThlxZEfd1NddqceF6eJmZUayxx9oKIYNlg==} + '@typescript-eslint/type-utils@8.72.2': + resolution: {integrity: sha512-STfkR38qIdhfkLpgtXnUjAzsNy4xouqiBO0lrVc/Wpk9Kem5/aHXUx1J8dGC16zpdYN1+yc2ILQ28er1kXX7ag==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/types@8.72.1': - resolution: {integrity: sha512-LmE5IhQet1BWOWEXqBrVtBPsMAOQ6Nzk35d+WLh3mk4EUF33sqlfxjio1MdYeSvKSG5skactKKuixBIKXhL4Rw==} + '@typescript-eslint/types@8.72.2': + resolution: {integrity: sha512-Xfn37OLZx03+PCU7qWx9DTv2FCRh1E6fk2+wONeNY15HXIwtcwuveaSwVpGAUptkNmPQegRxW5JyRel9T7wrog==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.72.1': - resolution: {integrity: sha512-DAlUoUV93hIvrtIQLwCbmZQYVZwOMhiHJrOVUUIWicFZaIYjTRqlY3I/NZevfkLmSqkNHRu2qYDcq9lrn16oOQ==} + '@typescript-eslint/typescript-estree@8.72.2': + resolution: {integrity: sha512-pQEGqIK/cqEvKivVWaFLYpe7XYejFxfuAOi4mu1oAWFvIo36aRHI9esRFTUxcIy/z8N482RJyH+LpZB0ZIU7Ow==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/utils@8.72.1': - resolution: {integrity: sha512-5v5liypurJBFHCBNqh/RjsymAD+VWcE0djuGY/BUqp5fC3Qn+luWDEksjuTtWjPn6i5zQlUtkZCRG/CYG0yCkA==} + '@typescript-eslint/utils@8.72.2': + resolution: {integrity: sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/visitor-keys@8.72.1': - resolution: {integrity: sha512-SB8xqipSzZHUePCCLNeYxqnxq83X61/qzNhjQGbTfjxGZIeOEP7tBgWYX05Tcd6CgE02WdTJnh5b8kMZJ/+bnQ==} + '@typescript-eslint/visitor-keys@8.72.2': + resolution: {integrity: sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@xmldom/xmldom@0.9.12': @@ -1388,8 +1392,8 @@ packages: resolution: {integrity: sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==} engines: {node: '>=16.20.0'} - plist@5.0.0: - resolution: {integrity: sha512-20N+g1DvMm/DFRbsvER7tT4wDryq0WunK7VMkDaiJcKNapAnUMkTsAnacFYf8n420F4Hf6/hefgmJRkMb1M0fg==} + plist@5.1.1: + resolution: {integrity: sha512-n55fGiwWNHf6zFdP9qvtr1x7P898lfJ/rbDvB3pYqVRcO+iG3sl5SSkGSLiIoAI9ZZc2F3Ga/5wPtM8EqhgSqA==} engines: {node: '>=18'} pluralize@8.0.0: @@ -1400,8 +1404,8 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prettier@3.9.10: - resolution: {integrity: sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==} + prettier@3.10.1: + resolution: {integrity: sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg==} engines: {node: '>=14'} hasBin: true @@ -1491,8 +1495,8 @@ packages: safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - semver@5.7.2: - resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==} + semver@5.7.3: + resolution: {integrity: sha512-kM18BPOqTi0+TB68703/GJRpAML5Me+IDQsR1J26YB3EFKKNEyHIVZuWDX7+WKQB3tHwDwgk24BfhdpWUbytvQ==} hasBin: true semver@7.8.5: @@ -1500,6 +1504,11 @@ packages: engines: {node: '>=10'} hasBin: true + semver@7.8.6: + resolution: {integrity: sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==} + engines: {node: '>=10'} + hasBin: true + send@1.2.1: resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==} engines: {node: '>= 18'} @@ -1560,8 +1569,9 @@ packages: signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - sisteransi@1.0.5: - resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + sisteransi@2.0.0: + resolution: {integrity: sha512-2WCqLdt12eN6ehLI50S2/ZxoowXU3DD1KVPRyVP0WEsFahrGZZmCdq1K59qjJljMRIDTwx1D9YaRK+hDneBUMg==} + engines: {node: '>=20'} source-map-js@1.2.2: resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==} @@ -1591,8 +1601,8 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - tar@7.5.22: - resolution: {integrity: sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==} + tar@7.5.23: + resolution: {integrity: sha512-lkukzdoGngZHJZXxW4S/E4Fp9ghTDlyZXrQGRNoJ/LXvDKcXUTq2sg5yQe74po7Voea6n/IN09+wE/QvJMiifA==} engines: {node: '>=18'} tinyglobby@0.2.17: @@ -1633,8 +1643,8 @@ packages: resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==} engines: {node: '>= 18'} - typescript-eslint@8.72.1: - resolution: {integrity: sha512-3Li9FfPmQp45nxEtFD1ZCrYFI3cYK5kpyNtmm1H7lMagm8u9sy6PTjy3ytwQZs7KNukOyKFHAZ6z6GjYFeaeXw==} + typescript-eslint@8.72.2: + resolution: {integrity: sha512-c/+AKMW1KB81r28Sp0AAdcyXj5dzNmAsZFcsrxKbZTKmcBK2xIwBR31dcSYSDu3bKmzXe8GKrSxO+eDQ401Uzg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 @@ -1729,17 +1739,18 @@ snapshots: hashery: 1.5.1 keyv: 5.6.0 - '@clack/core@1.5.1': + '@clack/core@1.6.0': dependencies: + fast-string-width: 3.0.2 fast-wrap-ansi: 0.2.2 - sisteransi: 1.0.5 + sisteransi: 2.0.0 - '@clack/prompts@1.8.1': + '@clack/prompts@1.9.0': dependencies: - '@clack/core': 1.5.1 + '@clack/core': 1.6.0 fast-string-width: 3.0.2 fast-wrap-ansi: 0.2.2 - sisteransi: 1.0.5 + sisteransi: 2.0.0 '@esbuild/aix-ppc64@0.28.2': optional: true @@ -1826,6 +1837,8 @@ snapshots: '@eslint-community/regexpp@4.12.2': {} + '@eslint-community/regexpp@4.12.3': {} + '@eslint/config-array@0.23.5': dependencies: '@eslint/object-schema': 3.0.5 @@ -1989,14 +2002,14 @@ snapshots: dependencies: '@types/node': 26.6.6 - '@typescript-eslint/eslint-plugin@8.72.1(@typescript-eslint/parser@8.72.1(eslint@10.14.0)(typescript@6.0.3))(eslint@10.14.0)(typescript@6.0.3)': + '@typescript-eslint/eslint-plugin@8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3))(eslint@10.14.0)(typescript@6.0.3)': dependencies: - '@eslint-community/regexpp': 4.12.2 - '@typescript-eslint/parser': 8.72.1(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/scope-manager': 8.72.1 - '@typescript-eslint/type-utils': 8.72.1(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/utils': 8.72.1(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/visitor-keys': 8.72.1 + '@eslint-community/regexpp': 4.12.3 + '@typescript-eslint/parser': 8.72.2(eslint@10.14.0)(typescript@6.0.3) + '@typescript-eslint/scope-manager': 8.72.2 + '@typescript-eslint/type-utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3) + '@typescript-eslint/utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3) + '@typescript-eslint/visitor-keys': 8.72.2 eslint: 10.14.0 ignore: 7.0.14 natural-compare: 1.4.0 @@ -2005,41 +2018,41 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.72.1(eslint@10.14.0)(typescript@6.0.3)': + '@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3)': dependencies: - '@typescript-eslint/scope-manager': 8.72.1 - '@typescript-eslint/types': 8.72.1 - '@typescript-eslint/typescript-estree': 8.72.1(typescript@6.0.3) - '@typescript-eslint/visitor-keys': 8.72.1 + '@typescript-eslint/scope-manager': 8.72.2 + '@typescript-eslint/types': 8.72.2 + '@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3) + '@typescript-eslint/visitor-keys': 8.72.2 debug: 4.4.3(supports-color@8.1.1) eslint: 10.14.0 typescript: 6.0.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/project-service@8.72.1(typescript@6.0.3)': + '@typescript-eslint/project-service@8.72.2(typescript@6.0.3)': dependencies: - '@typescript-eslint/tsconfig-utils': 8.72.1(typescript@6.0.3) - '@typescript-eslint/types': 8.72.1 + '@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3) + '@typescript-eslint/types': 8.72.2 debug: 4.4.3(supports-color@8.1.1) typescript: 6.0.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.72.1': + '@typescript-eslint/scope-manager@8.72.2': dependencies: - '@typescript-eslint/types': 8.72.1 - '@typescript-eslint/visitor-keys': 8.72.1 + '@typescript-eslint/types': 8.72.2 + '@typescript-eslint/visitor-keys': 8.72.2 - '@typescript-eslint/tsconfig-utils@8.72.1(typescript@6.0.3)': + '@typescript-eslint/tsconfig-utils@8.72.2(typescript@6.0.3)': dependencies: typescript: 6.0.3 - '@typescript-eslint/type-utils@8.72.1(eslint@10.14.0)(typescript@6.0.3)': + '@typescript-eslint/type-utils@8.72.2(eslint@10.14.0)(typescript@6.0.3)': dependencies: - '@typescript-eslint/types': 8.72.1 - '@typescript-eslint/typescript-estree': 8.72.1(typescript@6.0.3) - '@typescript-eslint/utils': 8.72.1(eslint@10.14.0)(typescript@6.0.3) + '@typescript-eslint/types': 8.72.2 + '@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3) + '@typescript-eslint/utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3) debug: 4.4.3(supports-color@8.1.1) eslint: 10.14.0 ts-api-utils: 2.5.0(typescript@6.0.3) @@ -2047,37 +2060,37 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/types@8.72.1': {} + '@typescript-eslint/types@8.72.2': {} - '@typescript-eslint/typescript-estree@8.72.1(typescript@6.0.3)': + '@typescript-eslint/typescript-estree@8.72.2(typescript@6.0.3)': dependencies: - '@typescript-eslint/project-service': 8.72.1(typescript@6.0.3) - '@typescript-eslint/tsconfig-utils': 8.72.1(typescript@6.0.3) - '@typescript-eslint/types': 8.72.1 - '@typescript-eslint/visitor-keys': 8.72.1 + '@typescript-eslint/project-service': 8.72.2(typescript@6.0.3) + '@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3) + '@typescript-eslint/types': 8.72.2 + '@typescript-eslint/visitor-keys': 8.72.2 debug: 4.4.3(supports-color@8.1.1) minimatch: 11.0.1 - semver: 7.8.5 + semver: 7.8.6 tinyglobby: 0.2.17 ts-api-utils: 2.5.0(typescript@6.0.3) typescript: 6.0.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.72.1(eslint@10.14.0)(typescript@6.0.3)': + '@typescript-eslint/utils@8.72.2(eslint@10.14.0)(typescript@6.0.3)': dependencies: '@eslint-community/eslint-utils': 4.10.1(eslint@10.14.0) - '@typescript-eslint/scope-manager': 8.72.1 - '@typescript-eslint/types': 8.72.1 - '@typescript-eslint/typescript-estree': 8.72.1(typescript@6.0.3) + '@typescript-eslint/scope-manager': 8.72.2 + '@typescript-eslint/types': 8.72.2 + '@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3) eslint: 10.14.0 typescript: 6.0.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/visitor-keys@8.72.1': + '@typescript-eslint/visitor-keys@8.72.2': dependencies: - '@typescript-eslint/types': 8.72.1 + '@typescript-eslint/types': 8.72.2 eslint-visitor-keys: 5.0.1 '@xmldom/xmldom@0.9.12': {} @@ -2227,7 +2240,7 @@ snapshots: dependencies: nice-try: 1.0.5 path-key: 2.0.1 - semver: 5.7.2 + semver: 5.7.3 shebang-command: 1.2.0 which: 1.3.1 @@ -3004,7 +3017,7 @@ snapshots: pkce-challenge@5.0.1: {} - plist@5.0.0: + plist@5.1.1: dependencies: '@xmldom/xmldom': 0.9.12 xmlbuilder: 15.1.1 @@ -3013,7 +3026,7 @@ snapshots: prelude-ls@1.2.1: {} - prettier@3.9.10: {} + prettier@3.10.1: {} proper-lockfile@4.1.2: dependencies: @@ -3100,10 +3113,12 @@ snapshots: safer-buffer@2.1.2: {} - semver@5.7.2: {} + semver@5.7.3: {} semver@7.8.5: {} + semver@7.8.6: {} + send@1.2.1: dependencies: debug: 4.4.3(supports-color@8.1.1) @@ -3187,7 +3202,7 @@ snapshots: signal-exit@3.0.7: {} - sisteransi@1.0.5: {} + sisteransi@2.0.0: {} source-map-js@1.2.2: {} @@ -3205,7 +3220,7 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - tar@7.5.22: + tar@7.5.23: dependencies: '@isaacs/fs-minipass': 4.0.1 chownr: 3.0.0 @@ -3256,12 +3271,12 @@ snapshots: media-typer: 1.1.1 mime-types: 3.0.2 - typescript-eslint@8.72.1(eslint@10.14.0)(typescript@6.0.3): + typescript-eslint@8.72.2(eslint@10.14.0)(typescript@6.0.3): dependencies: - '@typescript-eslint/eslint-plugin': 8.72.1(@typescript-eslint/parser@8.72.1(eslint@10.14.0)(typescript@6.0.3))(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/parser': 8.72.1(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/typescript-estree': 8.72.1(typescript@6.0.3) - '@typescript-eslint/utils': 8.72.1(eslint@10.14.0)(typescript@6.0.3) + '@typescript-eslint/eslint-plugin': 8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3))(eslint@10.14.0)(typescript@6.0.3) + '@typescript-eslint/parser': 8.72.2(eslint@10.14.0)(typescript@6.0.3) + '@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3) + '@typescript-eslint/utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3) eslint: 10.14.0 typescript: 6.0.3 transitivePeerDependencies: From 7d07473c6f42b87a2a72bbd69100f38b1104735f Mon Sep 17 00:00:00 2001 From: "dcd-release-please[bot]" <296541543+dcd-release-please[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:32:04 +0000 Subject: [PATCH 2/9] chore: merge production into dev after 5.13.0 (#321) * chore: pin the 5.12.0 promotion Release-As: 5.12.0 * chore(production): release 5.12.0 * chore: release 5.13.0 * ci: Replace release-please with a custom version that handles our dev -> prod flow (#305) * ci: cut a stable release with one workflow run and one PR A stable release used to take a hand-built promotion branch (dev, a merge of production, and an empty Release-As pin commit), a promotion PR, then release-please's own Release PR, then the back-merge PR. A new "Promote to stable" workflow (promote.yml) now builds the release branch: dev, with production merged in, plus one commit that sets the version in package.json and server.json and adds the CHANGELOG.md section. It opens that as the only PR into production. Merging it is the release: the Release workflow tags the untagged version, creates the GitHub Release from the changelog section, and publishes npm, the binaries and the back-merge as before. scripts/stable-release.mjs derives the version from the Conventional Commit PR titles since the last release, as release-please did, but never derives a major: a breaking marker stops the run until the version is given explicitly. Its changelog lists each PR once, using the full title when GitHub cut it short, where release-please listed such PRs twice. Production is merged in on every run because dev only allows squash merges, so the back-merge can never make production an ancestor of dev. release-please, its config and manifest, and the Release-As promotion-pin check are removed. A release-check job verifies every PR into production instead. Release PRs skip claude-review, like back-merge PRs, because the review action rejects bot actors. The Release workflow keeps the release-please.yml filename, because npm's trusted publisher is registered against it. * ci: keep the stable release PR open and current on every push to dev Promote to stable now also runs on every push to dev. It rebuilds one fixed branch, promote/cli-next, and opens the release PR into production or updates the open one, so the PR always carries all of dev with the version and changelog to match. Nothing ships until someone merges it. - A push with nothing releasable since the last release (docs, the back-merge) does nothing. - A version set by hand is kept on later runs (plan --keep) whenever it is above the derived one, so a major has to be given only once, and a breaking marker still never derives one. - If production moved during the run, nothing is pushed; the back-merge push rebuilds the PR. The force-push is leased against the branch tip the run saw, and skipped when the content is unchanged. - A PR into production from any other branch is left alone: push runs warn and stop. (cherry picked from commit 6bebbefd6c94df0191a72f0b5648c18951e3829d) * ci: lint PR titles on pull_request instead of pull_request_target (#308) GitHub blocks pull_request_target by default in public repositories from 2026-12-02. The PR title check only reads the event payload, so it runs on pull_request, which also fires for fork PRs with a read-only token. The CLA workflow has to write to fork PRs, so it stays on pull_request_target. A repository Actions policy allows that trigger for cla.yml only. Its header now says so. (cherry picked from commit 02d99b9274b7b8b4659bda94c2b94a7f14998fbd) * fix: treat dev-api.devicecloud.dev as the dev environment (#314) The dev API is now at dev-api.devicecloud.dev. Make it the dev apiUrl and keep api.dev.devicecloud.dev as a legacy URL, so saved configs and CI flags that name it still resolve to dev. inferEnvFromApiUrl only recognised 'api.dev.', so a dev-api URL fell through to prod and the Supabase copy of an upload would target the prod project. Both hostnames now map to dev. Co-authored-by: Claude Opus 5.5 (cherry picked from commit 25d09cab0f255ebfeadd74793a7984534126dbeb) * deps: raise the hono override to 4.13.16 for new moderate advisories Co-Authored-By: Claude Opus 5.5 (cherry picked from commit 2476581042ff4a8b4c31bd3e40d9618fd810f31c) * chore: release 5.12.1 * chore: release 5.13.0 --------- Co-authored-by: finalerock44 Co-authored-by: finalerock44 <77282157+finalerock44@users.noreply.github.com> Co-authored-by: dcd-release-please[bot] <296541543+dcd-release-please[bot]@users.noreply.github.com> Co-authored-by: Tom Riglar Co-authored-by: Claude Opus 5.5 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ package.json | 2 +- server.json | 4 ++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 685c55a..a454e6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## [5.13.0](https://github.com/devicecloud-dev/dcd-cli/compare/v5.12.1...v5.13.0) (2026-11-13) + + +### Features + +* drop iPhone 16 Pro Max and gpu1 from help text (removed 9 Nov 2026) ([#302](https://github.com/devicecloud-dev/dcd-cli/issues/302)) ([55fb4a1](https://github.com/devicecloud-dev/dcd-cli/commit/55fb4a196a086c4346f554e1c28633b70113e396)) +* **auth:** say when a dcd login session has expired ([#303](https://github.com/devicecloud-dev/dcd-cli/issues/303)) ([9fafa2f](https://github.com/devicecloud-dev/dcd-cli/commit/9fafa2f62347dd77debd46874d59bd599abc358b)) +* **device:** tap, type, swipe and press-key subcommands ([#310](https://github.com/devicecloud-dev/dcd-cli/issues/310)) ([12f4da5](https://github.com/devicecloud-dev/dcd-cli/commit/12f4da5dc1d2b742239f2a6c0ae4d669c978d9f3)) +* **mcp:** set up Codex with dcd mcp install, and document every hosted client ([#306](https://github.com/devicecloud-dev/dcd-cli/issues/306)) ([dab495b](https://github.com/devicecloud-dev/dcd-cli/commit/dab495bf501059b2866ead21603b3693ae14dcbc)) + + +### Bug Fixes + +* **device:** keep a missing --text on `type` inside the --json envelope ([#311](https://github.com/devicecloud-dev/dcd-cli/issues/311)) ([9f16ca2](https://github.com/devicecloud-dev/dcd-cli/commit/9f16ca2dfc3159b827c1447c3e9287933eff2de8)) +* **device:** make --maestro a no-op now that device sessions have one engine ([#317](https://github.com/devicecloud-dev/dcd-cli/issues/317)) ([07df107](https://github.com/devicecloud-dev/dcd-cli/commit/07df10717c556b212caf7e233a0850142d20d92a)) +* **mcp:** find code and claude .cmd shims on Windows ([#286](https://github.com/devicecloud-dev/dcd-cli/issues/286)) ([18efa4f](https://github.com/devicecloud-dev/dcd-cli/commit/18efa4f3309d8a7d2719720c10e3195bc708ad2d)) +* **mcp:** say why a tool is missing in read-only mode ([#307](https://github.com/devicecloud-dev/dcd-cli/issues/307)) ([9a54e3a](https://github.com/devicecloud-dev/dcd-cli/commit/9a54e3a21b3175fd67158dc68be071099b7c8cb7)) + + +### Dependencies + +* bump @supabase/supabase-js from 2.118.0 to 2.119.0 in the minor-and-patch group across 1 directory ([#304](https://github.com/devicecloud-dev/dcd-cli/issues/304)) ([f5db0b0](https://github.com/devicecloud-dev/dcd-cli/commit/f5db0b0376ba1b07f15ba6d5dfb5b3065cfbd0f7)) + + +### Code Refactoring + +* **auth:** stop calling Supabase directly for logout, login checks and live status ([#312](https://github.com/devicecloud-dev/dcd-cli/issues/312)) ([14ae83d](https://github.com/devicecloud-dev/dcd-cli/commit/14ae83dc50018ac70a1a5d7ed4c75fd854e3e0c6)) + ## [5.12.1](https://github.com/devicecloud-dev/dcd-cli/compare/v5.12.0...v5.12.1) (2026-11-13) diff --git a/package.json b/package.json index a4f2a5d..638ccaf 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "test:unit": "node scripts/test-runner.mjs --unit", "typecheck": "tsc --noEmit -p tsconfig.test.json" }, - "version": "5.12.1", + "version": "5.13.0", "bugs": { "url": "https://discord.gg/gm3mJwcNw8" }, diff --git a/server.json b/server.json index 598d447..d713cc5 100644 --- a/server.json +++ b/server.json @@ -2,7 +2,7 @@ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", "name": "dev.devicecloud/dcd", "description": "Run Maestro mobile app tests on devicecloud.dev: submit flows, check status, download artifacts.", - "version": "5.12.1", + "version": "5.13.0", "repository": { "url": "https://github.com/devicecloud-dev/dcd-cli", "source": "github" @@ -11,7 +11,7 @@ { "registryType": "npm", "identifier": "@devicecloud.dev/dcd", - "version": "5.12.1", + "version": "5.13.0", "runtimeHint": "npx", "runtimeArguments": [ { From e539bd77cef42c132b50947f0eb6a5d13aff1ebc Mon Sep 17 00:00:00 2001 From: Tom Riglar Date: Mon, 16 Nov 2026 21:18:51 +0000 Subject: [PATCH 3/9] fix(artifacts): record why a bundle download falls back to the inline endpoint (#324) tryBundleDownload returned false at seven different points, and the fallback is silent: the inline download still delivers the file. So there was no way to tell a deployment without bundle delivery from a dropped connection or a stream that broke partway. Each point now returns a reason, and tryBundleDownload sends it as a "bundle download fell back" telemetry event (context cli.download) with the route, upload id, duration, HTTP status or error name/message/code, and the bytes received before a stream broke. A 501 (no bundle delivery on this deployment) is logged at info; everything else at warn. Nothing is printed: the MCP server uses the same gateway, and its stdout is the JSON-RPC channel. Co-authored-by: Claude Opus 5.5 --- src/gateways/api-gateway.ts | 120 ++++++++++++++++--- src/services/telemetry.service.ts | 45 +++++++ test/unit/report-download.service.test.ts | 136 ++++++++++++++++++++-- 3 files changed, 276 insertions(+), 25 deletions(-) diff --git a/src/gateways/api-gateway.ts b/src/gateways/api-gateway.ts index d08eb1d..1714f1d 100644 --- a/src/gateways/api-gateway.ts +++ b/src/gateways/api-gateway.ts @@ -4,6 +4,11 @@ import * as path from 'node:path'; import { Readable } from 'node:stream'; import { pipeline } from 'node:stream/promises'; +import { + type BundleFallbackReason, + type BundleFallbackTelemetry, + telemetry, +} from '../services/telemetry.service.js'; import { TAppMetadata } from '../types.js'; import type { AuthContext } from '../types/domain/auth.types.js'; import type { @@ -14,6 +19,39 @@ import type { } from '../types/domain/live.types.js'; import { components, paths } from '../types/generated/schema.types.js'; +/** Expand a leading `~` to the home directory, as the download paths allow. */ +function expandHome(p: string): string { + return p.replace(/^~(?=$|\/|\\)/, homedir()); +} + +/** What went wrong in a bundle attempt, minus the route/timing added later. */ +type BundleFailure = Omit< + BundleFallbackTelemetry, + 'duration_ms' | 'route' | 'upload_id' +>; + +/** Name, message and low-level code (e.g. ECONNRESET) of a thrown error. */ +function errorDetail(error: unknown): Pick< + BundleFallbackTelemetry, + 'error_code' | 'error_message' | 'error_name' +> { + const err = error instanceof Error ? error : new Error(String(error)); + const cause = (err as { cause?: { code?: unknown } }).cause; + const code = cause?.code ?? (err as { code?: unknown }).code; + return { + error_code: typeof code === 'string' ? code : undefined, + error_message: err.message.slice(0, 300), + error_name: err.name, + }; +} + +function failure( + reason: BundleFallbackReason, + extra: Omit = {}, +): BundleFailure { + return { reason, ...extra }; +} + /** * Error thrown for non-OK API responses, carrying the HTTP status so callers * can branch on auth failures etc. without string matching. @@ -180,7 +218,7 @@ export const ApiGateway = { } // Handle tilde expansion for home directory - const expandedPath = destinationPath.replace(/^~(?=$|\/|\\)/, homedir()); + const expandedPath = expandHome(destinationPath); // Create directory structure if it doesn't exist const directory = path.dirname(expandedPath); @@ -219,20 +257,57 @@ export const ApiGateway = { destinationPath: string, operation: string, ): Promise { + const startedAt = Date.now(); + const outcome = await this.attemptBundleDownload( + baseUrl, + auth, + manifestEndpoint, + destinationPath, + operation, + ); + if (outcome === true) return true; + + // The fallback is silent to the user (the inline download still delivers + // the file), so this event is the only record of why the bundle path was + // skipped. + const route = /\/results\/([^/?]+)\/([a-z-]+)/.exec(manifestEndpoint); + telemetry.recordBundleFallback({ + ...outcome, + duration_ms: Date.now() - startedAt, + route: route?.[2] ?? manifestEndpoint.split('?')[0], + upload_id: route?.[1], + }); + return false; + }, + + /** + * One bundle-download attempt. Resolves `true` once the ZIP is on disk, or + * with the reason it fell through, for {@link tryBundleDownload} to record. + */ + async attemptBundleDownload( + baseUrl: string, + auth: AuthContext, + manifestEndpoint: string, + destinationPath: string, + operation: string, + ): Promise { let manifestRes: Response; try { manifestRes = await fetch(`${baseUrl}${manifestEndpoint}`, { headers: { ...auth.headers }, method: 'GET', }); - } catch { - return false; + } catch (error) { + return failure('manifest_request_failed', errorDetail(error)); } // 501 => this deployment has no bundle delivery; any other non-OK => let // the inline path re-request and surface the real error. if (!manifestRes.ok) { - return false; + return failure( + manifestRes.status === 501 ? 'manifest_unavailable' : 'manifest_http_error', + { status: manifestRes.status }, + ); } let bundle: { @@ -242,11 +317,11 @@ export const ApiGateway = { }; try { bundle = (await manifestRes.json()) as typeof bundle; - } catch { - return false; + } catch (error) { + return failure('manifest_invalid_json', errorDetail(error)); } if (!bundle?.bundleUrl || !bundle?.manifest || !bundle?.sig) { - return false; + return failure('manifest_incomplete'); } let zipRes: Response; @@ -257,21 +332,40 @@ export const ApiGateway = { headers: { 'content-type': 'application/json' }, method: 'POST', }); - } catch { - return false; + } catch (error) { + return failure('bundle_request_failed', errorDetail(error)); } if (!zipRes.ok) { - return false; + return failure('bundle_http_error', { status: zipRes.status }); } // A mid-stream failure (dropped/truncated connection) or a null body on an // otherwise-OK response throws here — fall back to the inline path rather // than let it escape past the caller's fallback. The inline path re-opens // the destination with flags: 'w', truncating any partial file left behind. + // Count bytes as they arrive, so a broken stream records how far it got. + // (The file's size on disk understates it: the write stream is torn down + // with buffered bytes still unflushed.) + let bytesReceived = 0; + const counted = zipRes.body?.pipeThrough( + new TransformStream({ + transform(chunk, controller) { + bytesReceived += chunk.byteLength; + controller.enqueue(chunk); + }, + }), + ); try { - await this.streamResponseToFile(zipRes, destinationPath, operation); - } catch { - return false; + await this.streamResponseToFile( + counted ? new Response(counted) : zipRes, + destinationPath, + operation, + ); + } catch (error) { + return failure('bundle_stream_failed', { + ...errorDetail(error), + bytes_received: bytesReceived, + }); } return true; }, diff --git a/src/services/telemetry.service.ts b/src/services/telemetry.service.ts index 6e3df8e..8bb51ea 100644 --- a/src/services/telemetry.service.ts +++ b/src/services/telemetry.service.ts @@ -40,6 +40,37 @@ export interface EncryptionTelemetry { source: EncryptionSource; } +/** + * Why a bundle download fell back to the inline endpoint. `manifest_unavailable` + * (a 501) is the expected answer from a deployment without bundle delivery; + * the rest are failures worth counting. + */ +export type BundleFallbackReason = + | 'bundle_http_error' + | 'bundle_request_failed' + | 'bundle_stream_failed' + | 'manifest_http_error' + | 'manifest_incomplete' + | 'manifest_invalid_json' + | 'manifest_request_failed' + | 'manifest_unavailable'; + +export interface BundleFallbackTelemetry { + /** Bytes of the ZIP received before the stream failed. */ + bytes_received?: number; + duration_ms: number; + /** Low-level error code from the cause, e.g. `ECONNRESET`. */ + error_code?: string; + error_message?: string; + error_name?: string; + reason: BundleFallbackReason; + /** The manifest route, e.g. `artifacts-bundle`. */ + route: string; + /** HTTP status, for the `*_http_error` / `manifest_unavailable` reasons. */ + status?: number; + upload_id?: string; +} + interface TelemetryConfig { apiUrl: string; auth: AuthContext; @@ -150,6 +181,20 @@ class Telemetry { this.submitAttempts = attempts; } + /** + * Record that a bundle download fell back to the inline endpoint, and why. + * The user never sees the fallback (the inline download still delivers the + * file), so without this the reason is lost. + */ + recordBundleFallback(detail: BundleFallbackTelemetry) { + this.enqueue( + detail.reason === 'manifest_unavailable' ? 'info' : 'warn', + 'cli.download', + 'bundle download fell back', + { ...detail }, + ); + } + recordCommandSuccess() { this.enqueue('info', 'cli.lifecycle', 'command completed', { duration_ms: Date.now() - this.startedAt, diff --git a/test/unit/report-download.service.test.ts b/test/unit/report-download.service.test.ts index 5077afb..eba68ee 100644 --- a/test/unit/report-download.service.test.ts +++ b/test/unit/report-download.service.test.ts @@ -8,6 +8,10 @@ import { ReportDownloadService, reportFormatDeprecation, } from '../../src/services/report-download.service.js'; +import { + type BundleFallbackTelemetry, + telemetry, +} from '../../src/services/telemetry.service.js'; import type { AuthContext } from '../../src/types/domain/auth.types.js'; const TEST_AUTH: AuthContext = { @@ -360,9 +364,27 @@ describe('ReportDownloadService', () => { * flow (manifest GET, then bundle POST, no inline call) can be asserted. */ function mockBundleFetch( - opts: { manifestStatus?: number; zipBody?: string } = {}, + opts: { + manifestBody?: Record; + manifestStatus?: number; + zipBody?: string; + zipBreaksAfter?: string; + zipStatus?: number; + } = {}, ) { - const { manifestStatus = 200, zipBody = 'bundle-zip' } = opts; + const { + manifestBody = { + bundleUrl: 'https://cdn.example.com/bundle', + entryCount: 3, + filename: 'artifacts-all.zip', + manifest: '{"version":1}', + sig: 'SIG', + }, + manifestStatus = 200, + zipBody = 'bundle-zip', + zipBreaksAfter, + zipStatus = 200, + } = opts; const encoder = new TextEncoder(); const stream = (s: string) => new ReadableStream({ @@ -387,15 +409,7 @@ describe('ReportDownloadService', () => { if (url.includes('artifacts-bundle') || url.includes('report-bundle')) { return new Response( - stream( - JSON.stringify({ - bundleUrl: 'https://cdn.example.com/bundle', - entryCount: 3, - filename: 'artifacts-all.zip', - manifest: '{"version":1}', - sig: 'SIG', - }), - ), + stream(JSON.stringify(manifestBody)), { headers: { 'content-type': 'application/json' }, status: manifestStatus, @@ -403,15 +417,42 @@ describe('ReportDownloadService', () => { ); } if (url === 'https://cdn.example.com/bundle') { - return new Response(stream(zipBody), { status: 200 }); + if (zipBreaksAfter !== undefined) { + // Sends some bytes, then the connection drops. + const broken = new ReadableStream({ + start(controller) { + controller.enqueue(encoder.encode(zipBreaksAfter)); + }, + pull(controller) { + controller.error( + Object.assign(new TypeError('terminated'), { + cause: { code: 'UND_ERR_SOCKET' }, + }), + ); + }, + }); + return new Response(broken, { status: 200 }); + } + return new Response(stream(zipBody), { status: zipStatus }); } return new Response(stream('inline-zip'), { status: 200 }); }; globalThis.fetch = impl as typeof fetch; } + let fallbacks: BundleFallbackTelemetry[]; + const realRecordBundleFallback = telemetry.recordBundleFallback; + beforeEach(() => { calls = []; + fallbacks = []; + telemetry.recordBundleFallback = (detail) => { + fallbacks.push(detail); + }; + }); + + afterEach(() => { + telemetry.recordBundleFallback = realRecordBundleFallback; }); it('streams from the bundle URL and skips the inline endpoint', async () => { @@ -471,6 +512,77 @@ describe('ReportDownloadService', () => { expect(fs.readFileSync(outPath, 'utf8')).to.equal('inline-zip'); }); + describe('records why it fell back', () => { + const download = (name: string) => + service.downloadArtifacts({ + ...BASE, + artifactsPath: path.join(tempDir, name), + downloadType: 'ALL', + }); + + it('records nothing when the bundle download succeeds', async () => { + mockBundleFetch(); + await download('ok.zip'); + expect(fallbacks).to.deep.equal([]); + }); + + it('records a 501 as manifest_unavailable, with route and upload id', async () => { + mockBundleFetch({ manifestStatus: 501 }); + await download('unavailable.zip'); + + expect(fallbacks).to.have.length(1); + expect(fallbacks[0]).to.include({ + reason: 'manifest_unavailable', + route: 'artifacts-bundle', + status: 501, + upload_id: 'run-42', + }); + expect(fallbacks[0].duration_ms).to.be.a('number'); + }); + + it('records a manifest missing its fields as manifest_incomplete', async () => { + mockBundleFetch({ manifestBody: { bundleUrl: 'https://cdn.example.com/bundle' } }); + await download('incomplete.zip'); + expect(fallbacks[0]).to.include({ reason: 'manifest_incomplete' }); + }); + + it('records a non-OK bundle response with its status', async () => { + mockBundleFetch({ zipStatus: 502 }); + const outPath = path.join(tempDir, 'bundle-502.zip'); + await service.downloadArtifacts({ + ...BASE, + artifactsPath: outPath, + downloadType: 'ALL', + }); + + expect(fallbacks[0]).to.include({ + reason: 'bundle_http_error', + status: 502, + }); + expect(fs.readFileSync(outPath, 'utf8')).to.equal('inline-zip'); + }); + + it('records a stream that breaks partway, with the error and bytes received', async () => { + mockBundleFetch({ zipBreaksAfter: 'partial' }); + const outPath = path.join(tempDir, 'bundle-broken.zip'); + await service.downloadArtifacts({ + ...BASE, + artifactsPath: outPath, + downloadType: 'ALL', + }); + + expect(fallbacks[0]).to.include({ + bytes_received: 'partial'.length, + error_code: 'UND_ERR_SOCKET', + error_message: 'terminated', + error_name: 'TypeError', + reason: 'bundle_stream_failed', + }); + // The inline download still replaced the partial file. + expect(fs.readFileSync(outPath, 'utf8')).to.equal('inline-zip'); + }); + }); + it('uses bundle delivery for the html report', async () => { mockBundleFetch(); From 61f4e91e105afa7790495bc2cf7dc956adda3699 Mon Sep 17 00:00:00 2001 From: finalerock44 <77282157+finalerock44@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:10:17 +0000 Subject: [PATCH 4/9] feat: dcd settings command and dcd_get_team_settings MCP tool (#325) Teams could see most of their settings only in the console. `dcd settings` prints them, and `dcd_get_team_settings` gives an agent the same object: - team name, org id and sign-in requirement - concurrency: each runner type's min/max, and shared pools with their members - test runtime: the default and the EXTENDED_RUNTIME cap, or off - retry escalation and the overage limit - whether a webhook, Slack and GitHub are connected Both read GET /org/settings with the usual auth: --api-key, DEVICE_CLOUD_API_KEY, or the `dcd login` session and its org. `--json` prints the API response as-is. For a standard team member the API withholds the sign-in requirement, retry escalation and overage limit, and the command shows them as "owner or admin only" rather than as off. An API without the endpoint answers 404, which becomes "This DeviceCloud API doesn't support reading team settings yet" rather than "Resource not found". The response type is hand-defined in src/types/domain/team-settings.types.ts, as the device-session types are, rather than regenerating schema.types.ts. The MCP tool is read-only, so it is also served in --read-only mode. --- CLAUDE.md | 4 +- README.md | 1 + src/commands/settings.ts | 171 ++++++++++++++++ src/gateways/api-gateway.ts | 31 +++ src/index.ts | 2 + src/mcp/bridge.ts | 4 +- src/mcp/server.ts | 2 + src/mcp/tools/get-team-settings.ts | 33 +++ src/types/domain/team-settings.types.ts | 47 +++++ test/integration/mcp.integration.test.ts | 3 +- test/unit/get-team-settings-tool.test.ts | 92 +++++++++ test/unit/settings-command.test.ts | 245 +++++++++++++++++++++++ 12 files changed, 630 insertions(+), 5 deletions(-) create mode 100644 src/commands/settings.ts create mode 100644 src/mcp/tools/get-team-settings.ts create mode 100644 src/types/domain/team-settings.types.ts create mode 100644 test/unit/get-team-settings-tool.test.ts create mode 100644 test/unit/settings-command.test.ts diff --git a/CLAUDE.md b/CLAUDE.md index c73acc9..b821a9f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,7 +24,7 @@ The package ships a **second bin, `dcd-mcp`** (`bin.dcd-mcp` → `dist/mcp/index ## Architecture -Top-level `defineCommand` in `src/index.ts` wires thirteen subcommands (`cloud`, `upload`, `list`, `status`, `artifacts`, `device`, `mcp`, `live`, `upgrade`, plus the auth-related `login`, `logout`, `whoami`, `switch-org`). `live` is hidden and deprecated: it still works for old scripts, and prints a deprecation line on stderr pointing at `device`. `cloud` is the primary command and replicates `maestro cloud`; `upgrade` self-updates the standalone bun binary (no-op for npm installs, which it redirects to `npm install -g`). Note `src/index.ts` deliberately **reimplements** citty's `runMain` rather than calling it — see the Telemetry section for why. +Top-level `defineCommand` in `src/index.ts` wires fourteen subcommands (`cloud`, `upload`, `list`, `status`, `settings`, `artifacts`, `device`, `mcp`, `live`, `upgrade`, plus the auth-related `login`, `logout`, `whoami`, `switch-org`). `live` is hidden and deprecated: it still works for old scripts, and prints a deprecation line on stderr pointing at `device`. `cloud` is the primary command and replicates `maestro cloud`; `upgrade` self-updates the standalone bun binary (no-op for npm installs, which it redirects to `npm install -g`). Note `src/index.ts` deliberately **reimplements** citty's `runMain` rather than calling it — see the Telemetry section for why. **Flag composition.** Flag definitions are split by domain in `src/config/flags/*.flags.ts` (api, binary, device, environment, execution, github, output) and re-exported as a single `flags` object from `src/constants.ts`. Commands that need the full cloud surface spread `...flags` into their citty `args`; subset commands import individual flag groups. @@ -51,7 +51,7 @@ Top-level `defineCommand` in `src/index.ts` wires thirteen subcommands (`cloud`, **Telemetry.** `src/services/telemetry.service.ts` ships lifecycle (`command started` / `command completed` / `command failed`) and error events to the dcd API's `/cli/logs` proxy → Axiom `cli-dev` / `cli-prod`. Wired in at three points: `src/index.ts` replicates citty's `runMain` (which would otherwise swallow errors and exit 1) to record start/success/failure and honor `CliError.exitCode`; `src/utils/auth.ts` calls `telemetry.configure({ auth })` from `resolveAuth` so the token never has to be re-derived; `src/utils/cli.ts` `logger.error` calls `telemetry.flushSync()` (which shells out to `curl` because `process.exit` bypasses `beforeExit`) before exiting. Unauthenticated invocations (`--help`, `--version`, `dcd login` pre-success) buffer in memory and drop on exit — by design, since there's no identity to attach. Opt out per-invocation with `DCD_TELEMETRY_DISABLED=1`. -**MCP server.** `src/mcp/` is a third front-end onto the same service layer (a sibling to `src/commands/`), shipped as the `dcd-mcp` bin over stdio transport (`@modelcontextprotocol/sdk`, `zod` schemas). `index.ts` boots the server; `server.ts` registers tools; `context.ts` resolves auth + API URL **lazily**, and again when a `dcd login` session nears expiry (so `tools/list` works unauthenticated, auth errors surface as tool errors rather than a boot crash, and a long-lived server outlasts the one-hour access token) via the same `resolveAuth`/`resolveApiUrl` as the CLI — `DEVICE_CLOUD_API_KEY` env or stored `dcd login` session, with `DCD_API_URL` to override. **Critical invariant: stdout is the JSON-RPC channel** — tools must never call the `src/commands/*` layer or `utils/cli` `logger` (both write to stdout / can `process.exit`); they call services/gateways directly with `logStderr` and return data via `helpers.ts` `jsonResult`/`errorResult`. The `runTool` wrapper records `mcp tool …` telemetry and converts thrown errors to `isError` results. Tools: `dcd_list_devices`, `dcd_list_runs`, `dcd_get_status`, `dcd_download_artifacts` (read-only), and `dcd_run_cloud_test` (billable — gated out by `--read-only` / `DCD_MCP_READONLY=1`, annotated destructive, async-by-default). `dcd_run_cloud_test` reuses `computeCommonRoot`/`buildTestMetadataMap` from `src/services/flow-paths.ts` (extracted from `cloud.ts` so both build identical server-side paths). Registry manifest: `server.json` at repo root. +**MCP server.** `src/mcp/` is a third front-end onto the same service layer (a sibling to `src/commands/`), shipped as the `dcd-mcp` bin over stdio transport (`@modelcontextprotocol/sdk`, `zod` schemas). `index.ts` boots the server; `server.ts` registers tools; `context.ts` resolves auth + API URL **lazily**, and again when a `dcd login` session nears expiry (so `tools/list` works unauthenticated, auth errors surface as tool errors rather than a boot crash, and a long-lived server outlasts the one-hour access token) via the same `resolveAuth`/`resolveApiUrl` as the CLI — `DEVICE_CLOUD_API_KEY` env or stored `dcd login` session, with `DCD_API_URL` to override. **Critical invariant: stdout is the JSON-RPC channel** — tools must never call the `src/commands/*` layer or `utils/cli` `logger` (both write to stdout / can `process.exit`); they call services/gateways directly with `logStderr` and return data via `helpers.ts` `jsonResult`/`errorResult`. The `runTool` wrapper records `mcp tool …` telemetry and converts thrown errors to `isError` results. Tools: `dcd_list_devices`, `dcd_list_runs`, `dcd_get_status`, `dcd_download_artifacts`, `dcd_get_team_settings` (read-only), and `dcd_run_cloud_test` (billable — gated out by `--read-only` / `DCD_MCP_READONLY=1`, annotated destructive, async-by-default). `dcd_run_cloud_test` reuses `computeCommonRoot`/`buildTestMetadataMap` from `src/services/flow-paths.ts` (extracted from `cloud.ts` so both build identical server-side paths). Registry manifest: `server.json` at repo root. **`dcd mcp` (the bridge).** A second stdio entry point, `src/mcp/bridge.ts`, run by the `dcd mcp` command. It is a low-level `Server` that routes between two MCP clients: the `dcd_*` tools from the same in-process `createServer()` (over an in-memory transport), and the device tools proxied from the hosted `/mcp`, so those are defined and contract-tested once, in the dcd API. It adds the inputs only a local process can serve: `install_app` takes `app_path` (uploaded with `uploadLocalApp`) and `run` takes `path` (a file is sent as `yaml`, a directory is uploaded as a flow bundle). Credentials are the CLI's (`getContext`): the hosted `/mcp` accepts an API key or a `dcd login` session with `x-dcd-org`. One connection is shared, and its `fetch` re-reads the auth headers from `getContext()` on every request, so a renewed session is picked up without remaking the connection (which would close it under a `run` still going). If the hosted endpoint can't be reached, it serves the `dcd_*` tools only and says why on stderr. Read-only mode keeps only device tools annotated `readOnlyHint`. `dcd-mcp` itself is unchanged. diff --git a/README.md b/README.md index 646a023..b465c52 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ It signs in the same way as the CLI: with your `dcd login` session, which it ren | `dcd_list_runs` | List recent test runs (filter by name/date, paginated) | | `dcd_get_status` | Get the status + per-test results of a run | | `dcd_download_artifacts` | Download a run's artifacts/report to disk | +| `dcd_get_team_settings` | Read your team's settings: concurrency, test runtime, integrations and more | | `dcd_run_cloud_test` | Submit a flow to run on the cloud (**billable**) | By default `dcd_run_cloud_test` is async: it returns an `uploadId` immediately, which you poll with `dcd_get_status`. Pass `wait: true` (bounded by `waitTimeoutSeconds`) to block until completion, or `dryRun: true` to preview the flows without submitting. diff --git a/src/commands/settings.ts b/src/commands/settings.ts new file mode 100644 index 0000000..c805860 --- /dev/null +++ b/src/commands/settings.ts @@ -0,0 +1,171 @@ +/** + * `dcd settings` — prints the active team's settings: concurrency, test + * runtime, sign-in requirement, retry escalation, overage limit and which + * integrations are connected. Read-only; change settings in the console. + * + * Owner/admin settings come back null for a standard member (the API sets + * `restricted`), and are shown as such rather than as "off". + */ +import { defineCommand } from 'citty'; + +import { apiFlags } from '../config/flags/api.flags.js'; +import { jsonFlag } from '../config/flags/output.flags.js'; +import { ApiGateway } from '../gateways/api-gateway.js'; +import type { + Platform, + SignInRequirement, + TeamSettings, +} from '../types/domain/team-settings.types.js'; +import { resolveAuth } from '../utils/auth.js'; +import { logger } from '../utils/cli.js'; +import { resolveApiUrl } from '../utils/config-store.js'; +import { colors, formatId } from '../utils/styling.js'; +import { type Field, ui } from '../utils/ui.js'; + +const OWNER_OR_ADMIN = colors.dim('owner or admin only'); + +const PLATFORM_LABELS: Record = { android: 'Android', ios: 'iOS' }; + +// The console's wording for each level. +const SIGN_IN_LABELS: Record = { + off: 'off', + passkey: 'a passkey', + passkey_and_code: 'a passkey and a code', + two_factor: 'two-factor', +}; + +const ESCALATION_TARGET_LABELS: Record = { gpu1: 'GPU', m1: 'M1' }; + +function limit(min: number, max: number): string { + return max <= 0 ? colors.dim('not enabled') : `min ${min} · max ${max}`; +} + +function connected(value: boolean): string { + return value ? 'connected' : colors.dim('not connected'); +} + +function signInRequirement(settings: TeamSettings): string { + if (settings.signInRequirement === null) return OWNER_OR_ADMIN; + return SIGN_IN_LABELS[settings.signInRequirement] ?? settings.signInRequirement; +} + +function retryEscalation(settings: TeamSettings): string { + const escalation = settings.retryEscalation; + if (escalation === null) return OWNER_OR_ADMIN; + if (!escalation.available || !escalation.target) return colors.dim('not available'); + const target = ESCALATION_TARGET_LABELS[escalation.target] ?? escalation.target; + return `${escalation.enabled ? 'on' : 'off'} · Android retries move to ${target} runners`; +} + +function overage(settings: TeamSettings): string { + const value = settings.overage; + if (value === null) return OWNER_OR_ADMIN; + if (!value.hasSubscription) return colors.dim('no active subscription'); + if (value.limitUsd === null) return 'uncapped'; + return `$${value.limitUsd} per billing period, on top of included credits`; +} + +function concurrencyRows(settings: TeamSettings): string[] { + const { pools, runners } = settings.concurrency; + const fields: Field[] = [ + ...runners.map(({ max, min, platform, runnerType }): Field => [ + `${PLATFORM_LABELS[platform] ?? platform} ${runnerType}`, + limit(min, max), + ]), + ...pools.map(({ max, min, name }): Field => [`${name} pool`, limit(min, max)]), + ]; + if (fields.length === 0) return [colors.dim('none')]; + + const shared = pools.map( + ({ members, name }) => + `${name} pool is shared by ${members + .map((m) => `${PLATFORM_LABELS[m.platform] ?? m.platform} ${m.runnerType}`) + .join(' and ')}`, + ); + return [ + ...ui.fields(fields), + ...shared.map((line) => ui.note(line)), + ui.note('min: always available · max: when capacity allows'), + ]; +} + +/** Human-readable output; one section per area, as in the console. */ +export function renderTeamSettings(settings: TeamSettings): string[] { + const { extendedMinutes, defaultMinutes } = settings.testRuntime; + const lines = [ + ui.section('Team'), + ui.branch( + ui.fields([ + ['name', settings.name ?? colors.dim('(unnamed)')], + ['org id', formatId(String(settings.orgId))], + ['sign-in requirement', signInRequirement(settings)], + ]), + ), + ui.section('Concurrency'), + ui.branch(concurrencyRows(settings)), + ui.section('Test Runtime'), + ui.branch( + ui.fields([ + ['default', `${defaultMinutes} min per flow`], + [ + 'extended', + extendedMinutes === null + ? colors.dim('off') + : `${extendedMinutes} min per flow with EXTENDED_RUNTIME, charged at twice the rate`, + ], + ]), + ), + ui.section('Retries & Billing'), + ui.branch( + ui.fields([ + ['retry escalation', retryEscalation(settings)], + ['overage limit', overage(settings)], + ]), + ), + ui.section('Integrations'), + ui.branch( + ui.fields([ + ['webhook', connected(settings.integrations.webhook)], + ['slack', connected(settings.integrations.slack)], + ['github', connected(settings.integrations.github)], + ]), + ), + ]; + if (settings.restricted) { + lines.push('', ui.note('Some settings are shown to team owners and admins only.')); + } + + return lines; +} + +export const settingsCommand = defineCommand({ + meta: { + name: 'settings', + description: "Show your team's settings (read-only)", + }, + args: { + ...apiFlags, + json: jsonFlag, + }, + async run({ args }) { + const apiKeyFlag = args['api-key'] as string | undefined; + const apiUrl = resolveApiUrl(args['api-url'] as string | undefined); + const json = Boolean(args.json); + + try { + const auth = await resolveAuth({ apiKeyFlag }); + const settings = await ApiGateway.getTeamSettings(apiUrl, auth); + + if (json) { + logger.json(settings); + return; + } + + for (const line of renderTeamSettings(settings)) logger.log(line); + } catch (error) { + logger.error(error as Error, { exit: 1, json }); + } + }, +}); + +export default settingsCommand; diff --git a/src/gateways/api-gateway.ts b/src/gateways/api-gateway.ts index 1714f1d..88bff73 100644 --- a/src/gateways/api-gateway.ts +++ b/src/gateways/api-gateway.ts @@ -17,6 +17,7 @@ import type { LiveSession, LiveSessionSummary, } from '../types/domain/live.types.js'; +import type { TeamSettings } from '../types/domain/team-settings.types.js'; import { components, paths } from '../types/generated/schema.types.js'; /** Expand a leading `~` to the home directory, as the download paths allow. */ @@ -710,6 +711,36 @@ export const ApiGateway = { } }, + /** + * The team's settings (`GET /org/settings`). A 404 means the API predates + * the endpoint, so it gets a message that says so rather than "not found". + */ + async getTeamSettings(baseUrl: string, auth: AuthContext): Promise { + const url = `${baseUrl}/org/settings`; + try { + const response = await fetch(url, { headers: { ...auth.headers } }); + + if (response.status === 404) { + throw new ApiError( + "This DeviceCloud API doesn't support reading team settings yet.", + 404, + ); + } + + if (!response.ok) { + await this.handleApiError(response, 'Failed to get team settings'); + } + + return await parseJsonResponse(response, 'Failed to get team settings'); + } catch (error) { + if (error instanceof TypeError && error.message === 'fetch failed') { + throw this.enhanceFetchError(error, url); + } + + throw error; + } + }, + async listUploads( baseUrl: string, auth: AuthContext, diff --git a/src/index.ts b/src/index.ts index d6a0b79..90f8499 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ import { liveCommand } from './commands/live.js'; import { loginCommand } from './commands/login.js'; import { logoutCommand } from './commands/logout.js'; import { mcpCommand } from './commands/mcp.js'; +import { settingsCommand } from './commands/settings.js'; import { statusCommand } from './commands/status.js'; import { switchOrgCommand } from './commands/switch-org.js'; import { upgradeCommand } from './commands/upgrade.js'; @@ -36,6 +37,7 @@ const main = defineCommand({ upload: uploadCommand, list: listCommand, status: statusCommand, + settings: settingsCommand, artifacts: artifactsCommand, device: deviceCommand, live: liveCommand, diff --git a/src/mcp/bridge.ts b/src/mcp/bridge.ts index 5614c77..421f388 100644 --- a/src/mcp/bridge.ts +++ b/src/mcp/bridge.ts @@ -47,7 +47,7 @@ import { createServer } from './server.js'; * themselves in their own descriptions. */ const INSTRUCTIONS = - 'DeviceCloud tools. dcd_* tools run Maestro test suites in the cloud: dcd_list_devices shows what you can test on, dcd_run_cloud_test submits flows (billable), and dcd_get_status follows a run. Any other tools describe their own use. Where a tool takes a path to a local file (an app build, a flow file or a directory), this server uploads it for you.'; + 'DeviceCloud tools. dcd_* tools run Maestro test suites in the cloud: dcd_list_devices shows what you can test on, dcd_run_cloud_test submits flows (billable), and dcd_get_status follows a run. dcd_get_team_settings reads the team settings and limits. Any other tools describe their own use. Where a tool takes a path to a local file (an app build, a flow file or a directory), this server uploads it for you.'; /** * How long one forwarded call may take. Longer than dcd_run_cloud_test's @@ -57,7 +57,7 @@ const INSTRUCTIONS = export const CALL_TIMEOUT_MS = 2 * 60 * 60 * 1000; const READ_ONLY_INSTRUCTIONS = - 'DeviceCloud tools, read-only: nothing here runs a test or changes anything. dcd_* tools read cloud test runs and their results. Any other tools describe their own use.'; + 'DeviceCloud tools, read-only: nothing here runs a test or changes anything. dcd_* tools read cloud test runs and their results, and the team settings. Any other tools describe their own use.'; /** The inputs this bridge adds to hosted tools, and what they say. */ const LOCAL_INPUTS: Record }> = { diff --git a/src/mcp/server.ts b/src/mcp/server.ts index 662bac7..e87cba4 100644 --- a/src/mcp/server.ts +++ b/src/mcp/server.ts @@ -5,6 +5,7 @@ import { getCliVersion } from '../utils/cli.js'; import { isReadOnly } from './context.js'; import { registerDownloadArtifacts } from './tools/download-artifacts.js'; import { registerGetStatus } from './tools/get-status.js'; +import { registerGetTeamSettings } from './tools/get-team-settings.js'; import { registerListDevices } from './tools/list-devices.js'; import { registerListRuns } from './tools/list-runs.js'; import { registerRunCloudTest } from './tools/run-cloud-test.js'; @@ -24,6 +25,7 @@ export function createServer(): McpServer { registerListRuns(server); registerGetStatus(server); registerDownloadArtifacts(server); + registerGetTeamSettings(server); if (!isReadOnly()) { registerRunCloudTest(server); diff --git a/src/mcp/tools/get-team-settings.ts b/src/mcp/tools/get-team-settings.ts new file mode 100644 index 0000000..7c540f9 --- /dev/null +++ b/src/mcp/tools/get-team-settings.ts @@ -0,0 +1,33 @@ +import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; + +import { ApiGateway } from '../../gateways/api-gateway.js'; +import { getContext } from '../context.js'; +import { jsonResult, runTool } from '../helpers.js'; + +/** + * Read-only: the team's settings, the same object `dcd settings --json` + * prints. Lets an agent check limits (concurrency, test runtime) before it + * plans a run, and see how the team is set up without the console. + */ +export function registerGetTeamSettings(server: McpServer): void { + server.registerTool( + 'dcd_get_team_settings', + { + title: 'Get team settings', + description: + "Read the devicecloud.dev team's settings. Changes nothing. " + + 'Returns: { orgId, name, restricted, concurrency: { runners, pools }, testRuntime: { defaultMinutes, extendedMinutes }, ' + + 'integrations: { webhook, slack, github }, signInRequirement, retryEscalation, overage }. ' + + 'concurrency gives each runner type\'s min/max tests at once; a pooled runner type is listed under its pool. ' + + 'extendedMinutes is null when extended runtime is off. ' + + 'When restricted is true (a standard team member), signInRequirement, retryEscalation and overage are null; owners, admins and API keys see them.', + inputSchema: {}, + annotations: { readOnlyHint: true, openWorldHint: true }, + }, + async () => + runTool('dcd_get_team_settings', async () => { + const { apiUrl, auth } = await getContext(); + return jsonResult(await ApiGateway.getTeamSettings(apiUrl, auth)); + }), + ); +} diff --git a/src/types/domain/team-settings.types.ts b/src/types/domain/team-settings.types.ts new file mode 100644 index 0000000..63addbd --- /dev/null +++ b/src/types/domain/team-settings.types.ts @@ -0,0 +1,47 @@ +// Hand-defined: GET /org/settings is newer than the swagger spec the CLI +// generates schema.types.ts from. It mirrors OrgSettingsResponseDto in the +// API (dcd/api/src/apps/org-settings/dto/org-settings.dto.ts). + +export type Platform = 'android' | 'ios'; + +export type SignInRequirement = 'off' | 'passkey' | 'passkey_and_code' | 'two_factor'; + +export interface TeamSettings { + orgId: number; + name: null | string; + /** + * True when the caller is a standard member: `signInRequirement`, + * `retryEscalation` and `overage` are then null. Owners, admins and org API + * keys see them. + */ + restricted: boolean; + concurrency: { + /** Runner types with their own limit. A pooled runner type is listed under its pool. */ + runners: Array<{ max: number; min: number; platform: Platform; runnerType: string }>; + /** Limits shared by several runner types. */ + pools: Array<{ + max: number; + members: Array<{ platform: Platform; runnerType: string }>; + min: number; + name: string; + }>; + }; + testRuntime: { + defaultMinutes: number; + /** With the EXTENDED_RUNTIME override; null when extended runtime is off. */ + extendedMinutes: null | number; + }; + integrations: { github: boolean; slack: boolean; webhook: boolean }; + signInRequirement: null | SignInRequirement; + retryEscalation: { + available: boolean; + enabled: boolean; + /** Runner type an Android test is retried on after an infrastructure failure. */ + target: 'gpu1' | 'm1' | null; + } | null; + overage: { + hasSubscription: boolean; + /** US dollars per billing period on top of included credits; null when uncapped. */ + limitUsd: null | number; + } | null; +} diff --git a/test/integration/mcp.integration.test.ts b/test/integration/mcp.integration.test.ts index 5553cda..862cca5 100644 --- a/test/integration/mcp.integration.test.ts +++ b/test/integration/mcp.integration.test.ts @@ -41,7 +41,7 @@ function parseResult(result: { content: Array<{ type: string; text?: string }>; describe('MCP Server Integration Tests', () => { describe('tool discovery', () => { - it('lists all five tools by default', async () => { + it('lists all six tools by default', async () => { const { client, ready } = connect(); await ready; try { @@ -50,6 +50,7 @@ describe('MCP Server Integration Tests', () => { expect(names).to.deep.equal([ 'dcd_download_artifacts', 'dcd_get_status', + 'dcd_get_team_settings', 'dcd_list_devices', 'dcd_list_runs', 'dcd_run_cloud_test', diff --git a/test/unit/get-team-settings-tool.test.ts b/test/unit/get-team-settings-tool.test.ts new file mode 100644 index 0000000..d834e82 --- /dev/null +++ b/test/unit/get-team-settings-tool.test.ts @@ -0,0 +1,92 @@ +import { Client } from '@modelcontextprotocol/sdk/client/index.js'; +import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js'; +import { expect } from 'chai'; +import * as fs from 'node:fs'; +import * as os from 'node:os'; +import * as path from 'node:path'; + +import { clearContextCache } from '../../src/mcp/context.js'; +import { createServer } from '../../src/mcp/server.js'; +import { OWNER_SETTINGS } from './settings-command.test.js'; + +const API = 'https://api.example.test'; + +describe('dcd_get_team_settings', () => { + const realFetch = globalThis.fetch; + const ORIGINAL_ENV = { ...process.env }; + let tempDir: string; + let client: Client; + let calls: Array<{ headers: Record; url: string }>; + + const stubFetch = (status: number, body: unknown) => { + globalThis.fetch = (async (input: unknown, init?: RequestInit) => { + calls.push({ url: String(input), headers: (init?.headers ?? {}) as Record }); + return new Response(JSON.stringify(body), { status }); + }) as typeof fetch; + }; + + const connect = async () => { + const server = createServer(); + const [a, b] = InMemoryTransport.createLinkedPair(); + await server.connect(b); + client = new Client({ name: 'agent', version: '1' }); + await client.connect(a); + }; + + const text = (result: Awaited>) => + (result.content as { text: string }[])[0].text; + + beforeEach(async () => { + tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'dcd-team-settings-tool-')); + process.env.DCD_CONFIG_DIR = tempDir; + process.env.DCD_TELEMETRY_DISABLED = '1'; + process.env.DEVICE_CLOUD_API_KEY = 'k'; + process.env.DCD_API_URL = API; + clearContextCache(); + calls = []; + }); + + afterEach(async () => { + await client?.close(); + globalThis.fetch = realFetch; + process.env = { ...ORIGINAL_ENV }; + clearContextCache(); + fs.rmSync(tempDir, { force: true, recursive: true }); + }); + + it('is a read-only tool with no inputs, present in read-only mode too', async () => { + process.env.DCD_MCP_READONLY = '1'; + await connect(); + + const { tools } = await client.listTools(); + const tool = tools.find((t) => t.name === 'dcd_get_team_settings'); + + expect(tool, 'dcd_get_team_settings is registered').to.exist; + expect(tool!.annotations?.readOnlyHint).to.equal(true); + expect(tool!.inputSchema.properties ?? {}).to.deep.equal({}); + }); + + it('returns the API response as JSON', async () => { + stubFetch(200, OWNER_SETTINGS); + await connect(); + + const result = await client.callTool({ name: 'dcd_get_team_settings', arguments: {} }); + + expect(result.isError).to.not.equal(true); + expect(JSON.parse(text(result))).to.deep.equal(OWNER_SETTINGS); + // runTool also flushes telemetry through fetch; only the settings call matters here. + const settingsCalls = calls.filter((c) => c.url === `${API}/org/settings`); + expect(settingsCalls).to.have.length(1); + expect(settingsCalls[0].headers['x-app-api-key']).to.equal('k'); + }); + + it('returns an error result the agent can read when the API predates the endpoint', async () => { + stubFetch(404, { message: 'Cannot GET /org/settings' }); + await connect(); + + const result = await client.callTool({ name: 'dcd_get_team_settings', arguments: {} }); + + expect(result.isError).to.equal(true); + expect(text(result)).to.include("doesn't support reading team settings yet"); + }); +}); diff --git a/test/unit/settings-command.test.ts b/test/unit/settings-command.test.ts new file mode 100644 index 0000000..c21c500 --- /dev/null +++ b/test/unit/settings-command.test.ts @@ -0,0 +1,245 @@ +import { expect } from 'chai'; +import * as fs from 'node:fs'; +import * as os from 'node:os'; +import * as path from 'node:path'; +import { stripVTControlCharacters } from 'node:util'; + +import { settingsCommand } from '../../src/commands/settings.js'; +import type { TeamSettings } from '../../src/types/domain/team-settings.types.js'; +import { writeConfig } from '../../src/utils/config-store.js'; + +const API = 'https://api.devicecloud.dev'; + +/** What the API returns to an owner, an admin or an org API key. */ +export const OWNER_SETTINGS: TeamSettings = { + orgId: 7, + name: 'Acme', + restricted: false, + concurrency: { + runners: [ + { platform: 'ios', runnerType: 'm4', min: 0, max: 2 }, + { platform: 'android', runnerType: 'gpu1', min: 0, max: 0 }, + ], + pools: [ + { + name: 'standard', + min: 2, + max: 12, + members: [ + { platform: 'ios', runnerType: 'default' }, + { platform: 'android', runnerType: 'cpu1' }, + ], + }, + ], + }, + testRuntime: { defaultMinutes: 10, extendedMinutes: 20 }, + integrations: { webhook: true, slack: false, github: true }, + signInRequirement: 'passkey', + retryEscalation: { available: true, target: 'm1', enabled: true }, + overage: { hasSubscription: true, limitUsd: 200 }, +}; + +/** What a standard member gets. */ +const STANDARD_SETTINGS: TeamSettings = { + ...OWNER_SETTINGS, + restricted: true, + signInRequirement: null, + retryEscalation: null, + overage: null, +}; + +interface Call { + headers: Record; + method: string; + url: string; +} + +function stubFetch(status: number, body: unknown): Call[] { + const calls: Call[] = []; + globalThis.fetch = (async (input: unknown, init?: RequestInit) => { + calls.push({ + url: String(input), + method: init?.method ?? 'GET', + headers: (init?.headers ?? {}) as Record, + }); + return new Response(JSON.stringify(body), { status }); + }) as typeof fetch; + return calls; +} + +class ExitError extends Error { + constructor(public code: number) { + super(`exit ${code}`); + } +} + +/** Run `dcd settings`, capturing stdout and the exit code. */ +async function run(args: Record): Promise<{ exit: number; out: string }> { + let out = ''; + const write = process.stdout.write.bind(process.stdout); + const log = console.log; + const exit = process.exit; + process.stdout.write = ((chunk: string) => { + out += chunk; + return true; + }) as typeof process.stdout.write; + console.log = (...parts: unknown[]) => { + out += parts.join(' ') + '\n'; + }; + process.exit = ((code?: number) => { + throw new ExitError(code ?? 0); + }) as typeof process.exit; + let code = 0; + try { + await (settingsCommand.run as (c: unknown) => Promise)({ + args: { 'api-url': API, ...args }, + rawArgs: [], + }); + } catch (error) { + if (!(error instanceof ExitError)) throw error; + code = error.code; + } finally { + process.stdout.write = write; + console.log = log; + process.exit = exit; + } + + return { exit: code, out: stripVTControlCharacters(out) }; +} + +describe('dcd settings', () => { + const realFetch = globalThis.fetch; + const ORIGINAL_ENV = { ...process.env }; + let tempDir: string; + + beforeEach(() => { + tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'dcd-settings-test-')); + process.env.DCD_CONFIG_DIR = tempDir; + process.env.DCD_TELEMETRY_DISABLED = '1'; + delete process.env.DEVICE_CLOUD_API_KEY; + }); + + afterEach(() => { + globalThis.fetch = realFetch; + process.env = { ...ORIGINAL_ENV }; + fs.rmSync(tempDir, { force: true, recursive: true }); + }); + + it('reads GET /org/settings with the API key and prints it as-is with --json', async () => { + const calls = stubFetch(200, OWNER_SETTINGS); + + const { exit, out } = await run({ 'api-key': 'k', json: true }); + + expect(exit).to.equal(0); + expect(JSON.parse(out)).to.deep.equal(OWNER_SETTINGS); + expect(calls).to.have.length(1); + expect(calls[0].url).to.equal(`${API}/org/settings`); + expect(calls[0].method).to.equal('GET'); + expect(calls[0].headers['x-app-api-key']).to.equal('k'); + }); + + it('uses the dcd login session and its org when there is no API key', async () => { + writeConfig({ + version: 1, + env: 'prod', + api_url: API, + supabase_url: 'https://cloud.devicecloud.dev', + session: { + access_token: 'access', + refresh_token: 'refresh', + expires_at: Math.floor(Date.now() / 1000) + 3600, + user_email: 'u@example.com', + user_id: 'u1', + }, + current_org_id: '7', + current_org_name: 'Acme', + }); + const calls = stubFetch(200, OWNER_SETTINGS); + + const { exit } = await run({ json: true }); + + expect(exit).to.equal(0); + expect(calls[0].headers.authorization).to.equal('Bearer access'); + expect(calls[0].headers['x-dcd-org']).to.equal('7'); + expect(calls[0].headers).not.to.have.property('x-app-api-key'); + }); + + it('prints every section for an owner', async () => { + stubFetch(200, OWNER_SETTINGS); + + const { exit, out } = await run({ 'api-key': 'k' }); + + expect(exit).to.equal(0); + for (const expected of [ + 'Team', + 'Acme', + 'sign-in requirement a passkey', + 'iOS m4', + 'min 0 · max 2', + 'Android gpu1', + 'not enabled', + 'standard pool', + 'min 2 · max 12', + 'standard pool is shared by iOS default and Android cpu1', + '10 min per flow', + '20 min per flow with EXTENDED_RUNTIME', + 'on · Android retries move to M1 runners', + '$200 per billing period, on top of included credits', + 'webhook connected', + 'slack not connected', + 'github connected', + ]) { + expect(out).to.include(expected); + } + expect(out).not.to.include('owner or admin only'); + }); + + it('marks the owner/admin settings for a standard member instead of showing them as off', async () => { + stubFetch(200, STANDARD_SETTINGS); + + const { exit, out } = await run({ 'api-key': 'k' }); + + expect(exit).to.equal(0); + expect(out.match(/owner or admin only/g)).to.have.length(3); + expect(out).to.include('Some settings are shown to team owners and admins only.'); + }); + + it('describes the empty states', async () => { + stubFetch(200, { + ...OWNER_SETTINGS, + name: null, + testRuntime: { defaultMinutes: 10, extendedMinutes: null }, + retryEscalation: { available: false, target: null, enabled: false }, + overage: { hasSubscription: true, limitUsd: null }, + concurrency: { runners: [], pools: [] }, + }); + + const { out } = await run({ 'api-key': 'k' }); + + expect(out).to.include('(unnamed)'); + expect(out).to.match(/extended\s+off/); + expect(out).to.include('retry escalation not available'); + expect(out).to.include('overage limit uncapped'); + expect(out).to.match(/Concurrency\n\s+⎿ none/); + }); + + it('says so when the API predates the endpoint', async () => { + stubFetch(404, { message: 'Cannot GET /org/settings' }); + + const { exit, out } = await run({ 'api-key': 'k', json: true }); + + expect(exit).to.equal(1); + const body = JSON.parse(out); + expect(body.status).to.equal('FAILED'); + expect(body.error).to.include("doesn't support reading team settings yet"); + }); + + it('passes a 403 through, e.g. for a key scoped to device sessions', async () => { + stubFetch(403, { message: 'This API key is limited to device sessions', error: 'API_KEY_SCOPE' }); + + const { exit, out } = await run({ 'api-key': 'k', json: true }); + + expect(exit).to.equal(1); + expect(JSON.parse(out).error).to.include('This API key is limited to device sessions'); + }); +}); From b5d83059936d007f62a8a0ad46e353c5665e8bcf Mon Sep 17 00:00:00 2001 From: finalerock44 <77282157+finalerock44@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:10:42 +0000 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20explain=20and=20stop=20retrying=20wh?= =?UTF-8?q?en=20an=20API=20key's=20access=20doesn't=20cover=E2=80=A6=20(#3?= =?UTF-8?q?26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: explain and stop retrying when an API key's access doesn't cover a call An API key's access can be limited when it is created, for example to starting test runs and reading only the runs it started. The API answers a call outside that access with 403 `API_KEY_SCOPE`, and a run the key didn't start with 404 `UPLOAD_NOT_FOUND`. - `ApiError` keeps the API's error code. A scope 403 now says what the key is limited to and where access is chosen, instead of the advice for a revoked or wrong key. - The `dcd cloud` poll loop stops at once on either code instead of retrying 30 times (about 14 minutes) first. - `dcd status` treats any 4xx `ApiError` as final instead of retrying it 5 times and then reporting the API as unreachable. - Fetching compatibility data reports the API's reason instead of only "HTTP error! status: 403". --- src/commands/status.ts | 6 +- src/gateways/api-gateway.ts | 50 ++++++-- src/services/results-polling.service.ts | 15 ++- src/utils/compatibility.ts | 5 +- test/unit/api-key-access-errors.test.ts | 161 ++++++++++++++++++++++++ 5 files changed, 224 insertions(+), 13 deletions(-) create mode 100644 test/unit/api-key-access-errors.test.ts diff --git a/src/commands/status.ts b/src/commands/status.ts index a629709..2e99d4f 100644 --- a/src/commands/status.ts +++ b/src/commands/status.ts @@ -2,7 +2,7 @@ import { defineCommand } from 'citty'; import { apiFlags } from '../config/flags/api.flags.js'; import { resolveFrontendUrl } from '../config/environments.js'; -import { ApiGateway } from '../gateways/api-gateway.js'; +import { ApiError, ApiGateway } from '../gateways/api-gateway.js'; import { formatDurationSeconds } from '../methods.js'; import { resolveAuth } from '../utils/auth.js'; import { CliError, logger } from '../utils/cli.js'; @@ -42,6 +42,10 @@ type StatusResponse = { /** Errors the API gateway surfaces for 4xx-class failures — retrying is pointless. */ function isClientApiError(error: Error | null): boolean { if (!error) return false; + if (error instanceof ApiError && error.status >= 400 && error.status < 500) { + return true; + } + return ( error.message.includes('Invalid request:') || error.message.includes('Resource not found') || diff --git a/src/gateways/api-gateway.ts b/src/gateways/api-gateway.ts index 88bff73..69629f8 100644 --- a/src/gateways/api-gateway.ts +++ b/src/gateways/api-gateway.ts @@ -59,14 +59,29 @@ function failure( */ export class ApiError extends Error { status: number; + /** The API's machine-readable error code, such as `API_KEY_SCOPE`, when it sent one. */ + code?: string; - constructor(message: string, status: number) { + constructor(message: string, status: number, code?: string) { super(message); this.name = 'ApiError'; this.status = status; + this.code = code; } } +/** + * API errors no retry can clear: an API key whose access doesn't cover the + * call (`API_KEY_SCOPE`), or an upload the key can't see (`UPLOAD_NOT_FOUND`). + * A key's access is fixed when it is created. + */ +export function isPermanentApiError(error: unknown): error is ApiError { + return ( + error instanceof ApiError && + (error.code === 'API_KEY_SCOPE' || error.code === 'UPLOAD_NOT_FOUND') + ); +} + /** * Parses a successful response body as JSON, wrapping parse failures in a * descriptive error (a 200 with an HTML body otherwise surfaces as a bare @@ -143,11 +158,17 @@ export const ApiGateway = { async handleApiError(res: Response, operation: string): Promise { const errorText = await res.text(); let userMessage: string; + let code: string | undefined; // Parse common API error formats try { const errorData = JSON.parse(errorText); userMessage = errorData.message || errorData.error || errorText; + // The API's own codes are UPPER_SNAKE_CASE. Its framework fills `error` + // with the HTTP reason ("Forbidden") otherwise, which is not a code. + if (typeof errorData.error === 'string' && /^[A-Z][A-Z0-9_]+$/.test(errorData.error)) { + code = errorData.error; + } } catch { userMessage = errorText; } @@ -155,7 +176,7 @@ export const ApiGateway = { // Add context and improve readability switch (res.status) { case 400: { - throw new ApiError(`Invalid request: ${userMessage}`, 400); + throw new ApiError(`Invalid request: ${userMessage}`, 400, code); } case 401: { @@ -168,10 +189,22 @@ export const ApiGateway = { message += `\nServer response: ${userMessage}`; } - throw new ApiError(message, 401); + throw new ApiError(message, 401, code); } case 403: { + // A valid key whose access is limited, such as a CI-only key. The + // revoked-key advice below would send the user looking in the wrong + // place, and the server's message already names what to use instead. + if (code === 'API_KEY_SCOPE') { + throw new ApiError( + `Access denied. ${userMessage}\n` + + `An API key's access is chosen when the key is created, under Settings → API keys in the console.`, + 403, + code, + ); + } + // For 403, use the server's error message directly as it's now detailed // If the message suggests an API key issue, provide additional guidance if (userMessage.toLowerCase().includes('api key')) { @@ -182,28 +215,29 @@ export const ApiGateway = { ` 3. Ensure the API key hasn't been deleted or revoked\n` + ` 4. Confirm you're connecting to the correct API URL`, 403, + code, ); } - throw new ApiError(`Access denied. ${userMessage}`, 403); + throw new ApiError(`Access denied. ${userMessage}`, 403, code); } case 404: { - throw new ApiError(`Resource not found. ${userMessage}`, 404); + throw new ApiError(`Resource not found. ${userMessage}`, 404, code); } case 429: { - throw new ApiError(`Rate limit exceeded. Please try again later. (${operation})`, 429); + throw new ApiError(`Rate limit exceeded. Please try again later. (${operation})`, 429, code); } case 500: { - throw new ApiError(`Server error occurred. Please try again or contact support. (${operation})`, 500); + throw new ApiError(`Server error occurred. Please try again or contact support. (${operation})`, 500, code); } default: { // `operation` is already phrased as "Failed to …", so don't append // another "failed" here (avoids "Failed to execute test failed: …"). - throw new ApiError(`${operation}: ${userMessage} (HTTP ${res.status})`, res.status); + throw new ApiError(`${operation}: ${userMessage} (HTTP ${res.status})`, res.status, code); } } }, diff --git a/src/services/results-polling.service.ts b/src/services/results-polling.service.ts index 8840d82..17937a7 100644 --- a/src/services/results-polling.service.ts +++ b/src/services/results-polling.service.ts @@ -1,6 +1,10 @@ import * as path from 'node:path'; -import { ApiGateway, type ResultsPollCache } from '../gateways/api-gateway.js'; +import { + ApiGateway, + isPermanentApiError, + type ResultsPollCache, +} from '../gateways/api-gateway.js'; import { formatDurationSeconds } from '../methods.js'; import type { AuthContext } from '../types/domain/auth.types.js'; import { paths } from '../types/generated/schema.types.js'; @@ -295,8 +299,13 @@ export class ResultsPollingService { await this.sleep(pollIntervalMs); } catch (error) { // Re-throw RunFailedError immediately (test failures, not polling - // errors), and an expired login no retry can fix. - if (error instanceof RunFailedError || error instanceof PollingAuthError) { + // errors), and an expired login or a key without access to this run, + // which no retry can fix. + if ( + error instanceof RunFailedError || + error instanceof PollingAuthError || + isPermanentApiError(error) + ) { throw error; } diff --git a/src/utils/compatibility.ts b/src/utils/compatibility.ts index 6525dec..4f855e8 100644 --- a/src/utils/compatibility.ts +++ b/src/utils/compatibility.ts @@ -1,3 +1,4 @@ +import { ApiGateway } from '../gateways/api-gateway.js'; import type { AuthContext } from '../types/domain/auth.types.js'; import type { Notice } from '../services/notices.service.js'; @@ -43,7 +44,9 @@ export async function fetchCompatibilityData( }); if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); + // Says why, such as a key whose access doesn't cover running tests, + // rather than only the status code. + await ApiGateway.handleApiError(response, 'Failed to fetch compatibility data'); } const result = await response.json() as { data?: CompatibilityData; message?: string; statusCode: number }; diff --git a/test/unit/api-key-access-errors.test.ts b/test/unit/api-key-access-errors.test.ts new file mode 100644 index 0000000..34f0a5c --- /dev/null +++ b/test/unit/api-key-access-errors.test.ts @@ -0,0 +1,161 @@ +import { expect } from 'chai'; +import * as http from 'node:http'; +import type { AddressInfo } from 'node:net'; + +import { ApiError, ApiGateway, isPermanentApiError } from '../../src/gateways/api-gateway.js'; +import { ResultsPollingService } from '../../src/services/results-polling.service.js'; +import type { AuthContext } from '../../src/types/domain/auth.types.js'; +import { clearCompatibilityCache, fetchCompatibilityData } from '../../src/utils/compatibility.js'; + +/** + * An API key's access can be limited when it is created (for example a key + * that may only start test runs and read the runs it started). A call + * outside that access is a 403 `API_KEY_SCOPE`, and a run the key didn't + * start is a 404 `UPLOAD_NOT_FOUND`. Neither clears on retry, and neither + * means the key is invalid. + */ + +const AUTH: AuthContext = { mode: 'apiKey', headers: { 'x-app-api-key': 'k' } }; + +const SCOPE_BODY = { + statusCode: 403, + message: + "This API key is limited to CI (run tests only) and can't reach /uploads/list. Use a key with full access for this.", + error: 'API_KEY_SCOPE', +}; + +const reply = (status: number, body: unknown) => + new Response(JSON.stringify(body), { + status, + headers: { 'content-type': 'application/json' }, + }); + +const thrownBy = async (promise: Promise): Promise => { + try { + await promise; + } catch (error) { + return error; + } + + throw new Error('expected a rejection'); +}; + +describe('API key access errors', () => { + describe('handleApiError', () => { + it('explains a scope denial without the invalid-key advice', async () => { + const error = await thrownBy(ApiGateway.handleApiError(reply(403, SCOPE_BODY), 'Failed to list uploads')); + + expect(error).to.be.instanceOf(ApiError); + const apiError = error as ApiError; + expect(apiError.status).to.equal(403); + expect(apiError.code).to.equal('API_KEY_SCOPE'); + expect(apiError.message).to.include('limited to CI (run tests only)'); + expect(apiError.message).to.include('Settings → API keys'); + expect(apiError.message).not.to.include('revoked'); + }); + + it('keeps the invalid-key advice for a key the API rejected', async () => { + const error = (await thrownBy( + ApiGateway.handleApiError( + reply(403, { + statusCode: 403, + message: 'Invalid API key. Please check your API key and ensure it is valid for this environment.', + error: 'Forbidden', + }), + 'Failed to list uploads', + ), + )) as ApiError; + + // "Forbidden" is the HTTP reason, not one of the API's codes. + expect(error.code).to.equal(undefined); + expect(error.message).to.include('Troubleshooting steps'); + }); + + it('carries the code of a run the key cannot see', async () => { + const error = (await thrownBy( + ApiGateway.handleApiError( + reply(404, { message: 'Upload not found', error: 'UPLOAD_NOT_FOUND' }), + 'Failed to get results', + ), + )) as ApiError; + + expect(error.code).to.equal('UPLOAD_NOT_FOUND'); + expect(isPermanentApiError(error)).to.equal(true); + }); + + it('treats only those two codes as permanent', () => { + expect(isPermanentApiError(new ApiError('x', 403, 'API_KEY_SCOPE'))).to.equal(true); + expect(isPermanentApiError(new ApiError('x', 404))).to.equal(false); + expect(isPermanentApiError(new ApiError('x', 503))).to.equal(false); + expect(isPermanentApiError(new Error('fetch failed'))).to.equal(false); + }); + }); + + describe('dcd cloud polling', () => { + const realGetResults = ApiGateway.getResultsForUpload; + afterEach(() => { + ApiGateway.getResultsForUpload = realGetResults; + }); + + for (const [label, error] of [ + ['a scope denial', new ApiError('Access denied.', 403, 'API_KEY_SCOPE')], + ['a run the key cannot see', new ApiError('Resource not found.', 404, 'UPLOAD_NOT_FOUND')], + ] as const) { + it(`stops at once on ${label}, rather than retrying 30 times`, async () => { + let polls = 0; + ApiGateway.getResultsForUpload = (async () => { + polls++; + throw error; + }) as unknown as typeof ApiGateway.getResultsForUpload; + const service = new ResultsPollingService(); + // Would skip the backoff if it retried; it must not get that far. + (service as unknown as { sleep: () => Promise }).sleep = async () => {}; + + const caught = await thrownBy( + service.pollUntilComplete({ + auth: AUTH, + apiUrl: 'https://api.example.com', + consoleUrl: 'https://console.example.com/results?upload=u1', + json: true, + uploadId: 'u1', + }), + ); + + expect(caught).to.equal(error); + expect(polls).to.equal(1); + }); + } + }); + + describe('compatibility data', () => { + let server: http.Server; + let baseUrl: string; + + before(async () => { + server = http.createServer((_req, res) => { + res.writeHead(403, { 'content-type': 'application/json' }); + res.end(JSON.stringify({ ...SCOPE_BODY, message: SCOPE_BODY.message.replace('CI (run tests only)', 'device sessions') })); + }); + await new Promise((resolve) => { + server.listen(0, '127.0.0.1', resolve); + }); + baseUrl = `http://127.0.0.1:${(server.address() as AddressInfo).port}`; + }); + + after(async () => { + await new Promise((resolve) => { + server.close(resolve); + }); + }); + + beforeEach(() => clearCompatibilityCache()); + + it('says why the API refused, not only the status code', async () => { + const error = (await thrownBy(fetchCompatibilityData(baseUrl, AUTH))) as Error; + + expect(error.message).to.include('limited to device sessions'); + expect(error.message).not.to.include('HTTP error! status: 403'); + expect(error.cause).to.be.instanceOf(ApiError); + }); + }); +}); From bef0beb16aafe6723128e94576a04038a8e2a1f1 Mon Sep 17 00:00:00 2001 From: Tom Riglar Date: Tue, 17 Nov 2026 11:51:13 +0000 Subject: [PATCH 6/9] chore(deps): drop stale overrides and unused dev dependencies (#329) Most pnpm overrides no longer guard against anything: the packages they pinned have shipped fixed versions within their parents' ranges. Keep only glob and minimatch, which an audit still flags without them. Remove @types/js-yaml (js-yaml 5 ships its own types) and shx (the build script now uses node:fs). Bump eslint to 10.15 and typescript-eslint to 8.73. Co-authored-by: Claude Opus 5.5 --- package.json | 39 +--- pnpm-lock.yaml | 581 +++++++++++-------------------------------------- 2 files changed, 130 insertions(+), 490 deletions(-) diff --git a/package.json b/package.json index 638ccaf..515da0b 100644 --- a/package.json +++ b/package.json @@ -23,21 +23,19 @@ "devDependencies": { "@eslint/js": "^10.0.1", "@types/chai": "^5.2.3", - "@types/js-yaml": "^4.0.9", "@types/mocha": "^10.0.10", "@types/node": "^26.0.0", "@types/yazl": "^3.3.1", "chai": "^6.2.2", - "eslint": "^10.5.0", + "eslint": "^10.15.0", "eslint-config-prettier": "^10.1.8", "eslint-plugin-unicorn": "^79.0.0", "husky": "^9.1.7", "mocha": "^12.0.0", "prettier": "^3.8.4", - "shx": "^0.4.0", "tsx": "^4.22.4", "typescript": "^6.0.3", - "typescript-eslint": "^8.61.1" + "typescript-eslint": "^8.73.0" }, "engines": { "node": ">=22.0.0" @@ -60,7 +58,7 @@ }, "scripts": { "dcd": "tsx src/index.ts", - "build": "shx rm -rf dist && tsc -b && shx chmod +x dist/index.js dist/mcp/index.js", + "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -b && node -e \"for (const f of ['dist/index.js','dist/mcp/index.js']) require('node:fs').chmodSync(f,0o755)\"", "build:binaries": "node scripts/build-binaries.mjs", "lint": "eslint src test --ext .ts", "prepare": "pnpm build && husky", @@ -84,37 +82,8 @@ "packageManager": "pnpm@10.17.1", "pnpm": { "overrides": { - "js-yaml@<3.14.2": ">=3.14.2", - "js-yaml@>=4.0.0 <4.2.0": ">=4.2.0", - "js-yaml@>=5.0.0 <5.2.2": ">=5.2.2", - "tar@<7.5.16": ">=7.5.16", - "@isaacs/brace-expansion": ">=5.0.1", - "fast-xml-parser": ">=5.5.7", - "flatted": ">=3.4.2", - "lodash": ">=4.18.0", - "@xmldom/xmldom": ">=0.9.12", - "minimatch@<3.1.4": "3.1.4", - "minimatch@>=5.0.0 <5.1.8": "5.1.8", - "minimatch@>=9.0.0 <9.0.7": "9.0.7", "minimatch@>=10.0.0 <11.0.1": "11.0.1", - "glob@>=9.0.0 <14.0.2": "14.0.2", - "picomatch@<2.3.2": "2.3.2", - "picomatch@>=4.0.0 <4.0.4": "4.0.4", - "serialize-javascript": ">=7.0.5", - "ajv@<7.0.0": "6.14.0", - "diff@>=4.0.0 <6.0.0": "4.0.4", - "diff@>=6.0.0": "8.0.3", - "brace-expansion@<1.1.16": "1.1.16", - "brace-expansion@>=2.0.0 <2.0.3": "2.0.3", - "brace-expansion@>=3.0.0 <5.0.12": "5.0.12", - "ws@>=8.0.0 <8.21.0": "8.21.0", - "esbuild@<0.28.1": ">=0.28.1", - "qs@<6.16.1": "6.16.1", - "fast-uri@>=3.0.0 <3.1.9": "3.1.9", - "hono@>=4.0.0 <4.13.16": "4.13.16", - "source-map-js@<1.2.2": "1.2.2", - "micromatch>picomatch": "^2.3.2", - "tinyglobby>picomatch": "^4.0.4" + "glob@>=9.0.0 <14.0.2": "14.0.2" }, "auditConfig": { "ignoreGhsas": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01f2243..91c6355 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,37 +5,8 @@ settings: excludeLinksFromLockfile: false overrides: - js-yaml@<3.14.2: '>=3.14.2' - js-yaml@>=4.0.0 <4.2.0: '>=4.2.0' - js-yaml@>=5.0.0 <5.2.2: '>=5.2.2' - tar@<7.5.16: '>=7.5.16' - '@isaacs/brace-expansion': '>=5.0.1' - fast-xml-parser: '>=5.5.7' - flatted: '>=3.4.2' - lodash: '>=4.18.0' - '@xmldom/xmldom': '>=0.9.12' - minimatch@<3.1.4: 3.1.4 - minimatch@>=5.0.0 <5.1.8: 5.1.8 - minimatch@>=9.0.0 <9.0.7: 9.0.7 minimatch@>=10.0.0 <11.0.1: 11.0.1 glob@>=9.0.0 <14.0.2: 14.0.2 - picomatch@<2.3.2: 2.3.2 - picomatch@>=4.0.0 <4.0.4: 4.0.4 - serialize-javascript: '>=7.0.5' - ajv@<7.0.0: 6.14.0 - diff@>=4.0.0 <6.0.0: 4.0.4 - diff@>=6.0.0: 8.0.3 - brace-expansion@<1.1.16: 1.1.16 - brace-expansion@>=2.0.0 <2.0.3: 2.0.3 - brace-expansion@>=3.0.0 <5.0.12: 5.0.12 - ws@>=8.0.0 <8.21.0: 8.21.0 - esbuild@<0.28.1: '>=0.28.1' - qs@<6.16.1: 6.16.1 - fast-uri@>=3.0.0 <3.1.9: 3.1.9 - hono@>=4.0.0 <4.13.16: 4.13.16 - source-map-js@<1.2.2: 1.2.2 - micromatch>picomatch: ^2.3.2 - tinyglobby>picomatch: ^4.0.4 importers: @@ -83,13 +54,10 @@ importers: devDependencies: '@eslint/js': specifier: ^10.0.1 - version: 10.0.1(eslint@10.14.0) + version: 10.0.1(eslint@10.15.0) '@types/chai': specifier: ^5.2.3 version: 5.2.3 - '@types/js-yaml': - specifier: ^4.0.9 - version: 4.0.9 '@types/mocha': specifier: ^10.0.10 version: 10.0.10 @@ -103,14 +71,14 @@ importers: specifier: ^6.2.2 version: 6.3.0 eslint: - specifier: ^10.5.0 - version: 10.14.0 + specifier: ^10.15.0 + version: 10.15.0 eslint-config-prettier: specifier: ^10.1.8 - version: 10.1.8(eslint@10.14.0) + version: 10.1.8(eslint@10.15.0) eslint-plugin-unicorn: specifier: ^79.0.0 - version: 79.0.0(eslint@10.14.0)(typescript@6.0.3) + version: 79.0.0(eslint@10.15.0)(typescript@6.0.3) husky: specifier: ^9.1.7 version: 9.1.7 @@ -120,9 +88,6 @@ importers: prettier: specifier: ^3.8.4 version: 3.10.1 - shx: - specifier: ^0.4.0 - version: 0.4.0 tsx: specifier: ^4.22.4 version: 4.23.15 @@ -130,8 +95,8 @@ importers: specifier: ^6.0.3 version: 6.0.3 typescript-eslint: - specifier: ^8.61.1 - version: 8.72.2(eslint@10.14.0)(typescript@6.0.3) + specifier: ^8.73.0 + version: 8.73.0(eslint@10.15.0)(typescript@6.0.3) packages: @@ -311,16 +276,12 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - '@eslint-community/regexpp@4.12.2': - resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==} - engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - '@eslint-community/regexpp@4.12.3': resolution: {integrity: sha512-R76UKbvsqI68DJJVTVyqFKqU98CN4+B+acxNfEA2IFarSzP0SjtKf/3+fFiXzTyv5Fj3PxLkGHe2wnVWWMxobQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - '@eslint/config-array@0.23.5': - resolution: {integrity: sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==} + '@eslint/config-array@0.23.6': + resolution: {integrity: sha512-WrTH7nioI9QPY4NZGnsywmecswJdgeq4BCM76qok9VgjTO29ZgUzUvcuJLVPYVQM4uDbaPBU0M33R9DIxI8X3w==} engines: {node: ^20.19.0 || ^22.13.0 || >=24} '@eslint/config-helpers@0.7.0': @@ -356,7 +317,7 @@ packages: resolution: {integrity: sha512-jdf7FHh6A1lzjpHHQUgxsg2GeER2vMetnAOfeActzcoli6jamlK+NAwL6Dsr5Fl3BS3tYUQzCdtZjU8Qxv7bEA==} engines: {node: '>=20'} peerDependencies: - hono: 4.13.16 + hono: ^4 || ^5.0.0-0 '@humanfs/core@0.19.2': resolution: {integrity: sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==} @@ -385,6 +346,9 @@ packages: '@isaacs/nonrecursive-glob-match@1.0.3': resolution: {integrity: sha512-SI7kyKHq4XXDRozw+r9GlRZkia1ZkFrpLW98r2IC2Bpr8YkFGE3fvjzmxCG0x78A++69HmDNrDvSMYBZmHGpKA==} + '@isaacs/nonrecursive-glob-match@1.1.0': + resolution: {integrity: sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==} + '@keyv/bigmap@1.3.1': resolution: {integrity: sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==} engines: {node: '>= 18'} @@ -404,18 +368,6 @@ packages: '@cfworker/json-schema': optional: true - '@nodelib/fs.scandir@2.1.5': - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - - '@nodelib/fs.stat@2.0.5': - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - - '@nodelib/fs.walk@1.2.8': - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - '@supabase/auth-js@2.119.0': resolution: {integrity: sha512-WI7KqJRxqZjm77PlRO/VfKretL4SG8g8stWfBmpyx9To+fFapZlSbXA8QkduoMvr72rRpIF24ZLrjktBrp+ZFA==} engines: {node: '>=22.0.0'} @@ -463,9 +415,6 @@ packages: '@types/estree@1.0.10': resolution: {integrity: sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==} - '@types/js-yaml@4.0.9': - resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} - '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} @@ -481,63 +430,67 @@ packages: '@types/yazl@3.3.1': resolution: {integrity: sha512-DIWfCKpsTp6hE5BDBHV3+fIL/bLUF9Bv13iDrWnMlmhQpH67buNvI291ZauQ1xcccxK3FqQ9honnXpq4R8NMuQ==} - '@typescript-eslint/eslint-plugin@8.72.2': - resolution: {integrity: sha512-222PKFXKihmFpi/pS5njoBgdAqsPhj2/GBmFbrNw8Tq8gEG9Sv+kSlKFy4u2q+mJv9ZzJgM2Gkv/bUzRZwZw5g==} + '@typescript-eslint/eslint-plugin@8.73.0': + resolution: {integrity: sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^8.72.2 + '@typescript-eslint/parser': ^8.73.0 eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/parser@8.72.2': - resolution: {integrity: sha512-llP+T1YuJOLlxEciP6OyQGtz5SMxyn+9LA2BvZw5RmToGVa1y4beEDVQL6Gje7T5WFYh19WREjDCN9Ev4gm5AA==} + '@typescript-eslint/parser@8.73.0': + resolution: {integrity: sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/project-service@8.72.2': - resolution: {integrity: sha512-6y5dLTZdHhI8Eh3yIQ/bfQhRKwn5e+TpJj64o18Cngc0iW/BCrVvrr6zGYqXPnYH31u6YXAYiFh0+qxX5mybJw==} + '@typescript-eslint/project-service@8.73.0': + resolution: {integrity: sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/scope-manager@8.72.2': - resolution: {integrity: sha512-iIoMJ6/8c1/QpFNyFjU0d1YzPco4MsZjQw0k3V+vfzNWAFmUmvhlyMoYEoYYDQZXc+J6Gi1X5XcxlzW2taIIGQ==} + '@typescript-eslint/scope-manager@8.73.0': + resolution: {integrity: sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/tsconfig-utils@8.72.2': - resolution: {integrity: sha512-+h3iCgZXuTNtoLXcnnjP12ZUHLMqoUcIHPfQrFEXTUqvb9dF8QK9b5nv5VtSo5fLkdHuks8ehbTzZj3rImAm9w==} + '@typescript-eslint/tsconfig-utils@8.73.0': + resolution: {integrity: sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/type-utils@8.72.2': - resolution: {integrity: sha512-STfkR38qIdhfkLpgtXnUjAzsNy4xouqiBO0lrVc/Wpk9Kem5/aHXUx1J8dGC16zpdYN1+yc2ILQ28er1kXX7ag==} + '@typescript-eslint/type-utils@8.73.0': + resolution: {integrity: sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/types@8.72.2': - resolution: {integrity: sha512-Xfn37OLZx03+PCU7qWx9DTv2FCRh1E6fk2+wONeNY15HXIwtcwuveaSwVpGAUptkNmPQegRxW5JyRel9T7wrog==} + '@typescript-eslint/types@8.73.0': + resolution: {integrity: sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.72.2': - resolution: {integrity: sha512-pQEGqIK/cqEvKivVWaFLYpe7XYejFxfuAOi4mu1oAWFvIo36aRHI9esRFTUxcIy/z8N482RJyH+LpZB0ZIU7Ow==} + '@typescript-eslint/typescript-estree@8.73.0': + resolution: {integrity: sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: + '@typescript/native': npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev typescript: '>=4.8.4 <6.1.0' + peerDependenciesMeta: + '@typescript/native': + optional: true - '@typescript-eslint/utils@8.72.2': - resolution: {integrity: sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==} + '@typescript-eslint/utils@8.73.0': + resolution: {integrity: sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 typescript: '>=4.8.4 <6.1.0' - '@typescript-eslint/visitor-keys@8.72.2': - resolution: {integrity: sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==} + '@typescript-eslint/visitor-keys@8.73.0': + resolution: {integrity: sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@xmldom/xmldom@0.9.12': @@ -600,10 +553,6 @@ packages: resolution: {integrity: sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==} engines: {node: 20 || >=22} - braces@3.0.3: - resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} - engines: {node: '>=8'} - browser-stdout@1.3.1: resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} @@ -701,10 +650,6 @@ packages: resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==} engines: {node: '>= 0.10'} - cross-spawn@6.0.6: - resolution: {integrity: sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==} - engines: {node: '>=4.8'} - cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -742,8 +687,8 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} - diff@8.0.3: - resolution: {integrity: sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==} + diff@9.0.0: + resolution: {integrity: sha512-svtcdpS8CgJyqAjEQIXdb3OjhFVVYjzGAPO8WGCmRbrml64SPw/jJD4GoE98aR7r25A0XcgrK3F02yw9R/vhQw==} engines: {node: '>=0.3.1'} dunder-proto@1.0.1: @@ -760,9 +705,6 @@ packages: resolution: {integrity: sha512-Ev/hIyePLZtpL98x562lvPtenrUfGr0lfaf44HFZ+hDEwso7ccV9QAZrEVLg0hxNAzygaAFxy2dYaAKKM0G06A==} engines: {node: '>= 0.8'} - end-of-stream@1.4.5: - resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} - entities@8.1.0: resolution: {integrity: sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==} engines: {node: '>=20.19.0'} @@ -823,8 +765,8 @@ packages: resolution: {integrity: sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==} engines: {node: ^20.19.0 || ^22.13.0 || >=24} - eslint@10.14.0: - resolution: {integrity: sha512-T0pNsxkb9IKmtQjhpK3d7nWOpFv+YHuMbTJnSVMoQblF0onvXfErrtp4V1jHtsQPan7dKaGVD0q1WCXnzMF31A==} + eslint@10.15.0: + resolution: {integrity: sha512-+5Wg4p+ze3sG1WErYgUO/3H1IQIfFBymVUA0Fo/XTeBOLS6UQIUekpSJ8sdRkn7O7wjh84b55w/roqavH2aScg==} engines: {node: ^20.19.0 || ^22.13.0 || >=24} hasBin: true peerDependencies: @@ -865,10 +807,6 @@ packages: resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==} engines: {node: '>=18.0.0'} - execa@1.0.0: - resolution: {integrity: sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==} - engines: {node: '>=6'} - express-rate-limit@8.7.2: resolution: {integrity: sha512-U1ScocxDD9WI09LaBVypvNkOtNR5yWAmZLkuKJdAzIchA4YKFYF6GT5IKER7epG58oXtjvGlV0/6ii0F83EyZg==} engines: {node: '>= 16'} @@ -882,10 +820,6 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - fast-glob@3.3.3: - resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} - engines: {node: '>=8.6.0'} - fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -904,14 +838,11 @@ packages: fast-wrap-ansi@0.2.2: resolution: {integrity: sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==} - fastq@1.20.1: - resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==} - fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} peerDependencies: - picomatch: 4.0.4 + picomatch: ^3 || ^4 peerDependenciesMeta: picomatch: optional: true @@ -919,10 +850,6 @@ packages: file-entry-cache@11.1.5: resolution: {integrity: sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==} - fill-range@7.1.1: - resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} - engines: {node: '>=8'} - finalhandler@2.1.1: resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==} engines: {node: '>= 18.0.0'} @@ -965,14 +892,6 @@ packages: resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} engines: {node: '>= 0.4'} - get-stream@4.1.0: - resolution: {integrity: sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==} - engines: {node: '>=6'} - - glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - glob-parent@6.0.2: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} @@ -1058,10 +977,6 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - interpret@1.4.0: - resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} - engines: {node: '>= 0.10'} - ip-address@10.7.5: resolution: {integrity: sha512-t2v0rkILYv9WXmSL7TpAaU3HXgaFYOPUcH3QHgwQ++gpJuH3bqyMy4Fvt/DJCTKwzH3Cf+bAp5W/mFL39KPLzA==} engines: {node: '>= 12'} @@ -1074,10 +989,6 @@ packages: resolution: {integrity: sha512-f4RqJKBUe5rQkJ2eJEJBXSticB3hGbN9j0yxxMQFqIW89Jp9WYFtzfTcRlstDKVUTRzSOTLKRfO9vIztenwtxA==} engines: {node: '>=18.20'} - is-core-module@2.16.2: - resolution: {integrity: sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==} - engines: {node: '>= 0.4'} - is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -1086,10 +997,6 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} - is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - is-path-inside@4.0.0: resolution: {integrity: sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==} engines: {node: '>=12'} @@ -1097,10 +1004,6 @@ packages: is-promise@4.0.0: resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} - is-stream@1.1.0: - resolution: {integrity: sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==} - engines: {node: '>=0.10.0'} - is-stream@2.0.1: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} @@ -1193,10 +1096,6 @@ packages: resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==} engines: {node: '>=18'} - merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - micromark-core-commonmark@2.0.4: resolution: {integrity: sha512-wxEeE8v8XVvOrxn1TZj74qYhAtTQsSqufHVS3uNVyT1MupXxhyaHk8/9xDNPh9BmL77QNDgWTkZ3RsYHB2ry7w==} @@ -1260,10 +1159,6 @@ packages: micromark@4.0.3: resolution: {integrity: sha512-oGYfQzHSG5dOMovQcJ3fyTmZlWAWpi0XA0sJwJs+i6OT88o1+Jtw/8z0CmdowSLxGhhFK89rQ/oXph/wN02PNw==} - micromatch@4.0.8: - resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} - engines: {node: '>=8.6'} - mime-db@1.54.0: resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} engines: {node: '>= 0.6'} @@ -1276,8 +1171,9 @@ packages: resolution: {integrity: sha512-t+Vn6DX4wPCxS23y03C0uhF7S1jpi1GfqPrnlEipCJaA2ykiNbMkVlDutZtmvLfRcUN6R8AYVlzTsQrT4RZoLQ==} engines: {node: 18 || 20 || >=22} - minimist@1.2.8: - resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + minimatch@11.0.9: + resolution: {integrity: sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==} + engines: {node: 20 || >=22} minipass@7.1.3: resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==} @@ -1302,9 +1198,6 @@ packages: resolution: {integrity: sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==} engines: {node: '>=18'} - nice-try@1.0.5: - resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} - node-releases@2.0.62: resolution: {integrity: sha512-A0Eq+qVDQI97IbAD6g/HriIuv256el9N8EwF4+xqJ49pwrdRYpdCSmLk0sO4I3fnS6hpYE5v22B73Bk+WArEoQ==} engines: {node: '>=18'} @@ -1313,10 +1206,6 @@ packages: resolution: {integrity: sha512-ObaRrRoR8T68wF6suxHd7R4XQNamij6ZQHrwG7Dx1D2zeHcDNLsIOBcWrIwtDm7AsCXBguaPHgXhcjxDa2szrg==} engines: {node: '>=0.12.0'} - npm-run-path@2.0.2: - resolution: {integrity: sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==} - engines: {node: '>=4'} - object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} @@ -1336,10 +1225,6 @@ packages: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} - p-finally@1.0.0: - resolution: {integrity: sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==} - engines: {node: '>=4'} - p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -1359,17 +1244,10 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} - path-key@2.0.1: - resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==} - engines: {node: '>=4'} - path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} - path-parse@1.0.7: - resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - path-scurry@3.0.0: resolution: {integrity: sha512-1pTbQqH1wIwMi/eleQ5leFTTCkzFsPcgXNjwOA8YGGW/W4/kHT3dssE7Z6NH+zuqNLOzOB0uaD61yl7cAcVhgg==} engines: {node: 18 || 20 || >=22} @@ -1380,10 +1258,6 @@ packages: picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} - picomatch@2.3.2: - resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} - engines: {node: '>=8.6'} - picomatch@4.0.7: resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} engines: {node: '>=12'} @@ -1416,9 +1290,6 @@ packages: resolution: {integrity: sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==} engines: {node: '>= 0.10'} - pump@3.0.4: - resolution: {integrity: sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==} - punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -1434,9 +1305,6 @@ packages: querystringify@2.2.0: resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} - queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - quote-js-string@0.1.0: resolution: {integrity: sha512-Y3NoRtprEEZQD8RfxMCfS0ZTqc4e+i18OrXEXAvpM6TfC/3y+0L5rNbZiSnbBBEkDfFzbpd8o+cE8q3/anjMGA==} engines: {node: '>=22'} @@ -1453,10 +1321,6 @@ packages: resolution: {integrity: sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==} engines: {node: '>= 20.19.0'} - rechoir@0.6.2: - resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==} - engines: {node: '>= 0.10'} - regjsparser@0.13.4: resolution: {integrity: sha512-EWV80YgFaVgFrjGCAsV7oybp4GOxbls5RzBg8OB0nKEVXsBJR1JlV8Di1JhCROg3MzTfe1RI8yitIm1eOs68iA==} hasBin: true @@ -1472,33 +1336,17 @@ packages: resolution: {integrity: sha512-yE7KUfFvaBFzGPs5H3Ops1RevfUEsDc5Iz65rOwWg4lE8HJSYtle77uul3+573457oHvBKuHYDl/xqUkKpEEdw==} engines: {node: '>=18'} - resolve@1.22.12: - resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==} - engines: {node: '>= 0.4'} - hasBin: true - retry@0.12.0: resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} engines: {node: '>= 4'} - reusify@1.1.0: - resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - router@2.2.0: resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==} engines: {node: '>= 18'} - run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - semver@5.7.3: - resolution: {integrity: sha512-kM18BPOqTi0+TB68703/GJRpAML5Me+IDQsR1J26YB3EFKKNEyHIVZuWDX7+WKQB3tHwDwgk24BfhdpWUbytvQ==} - hasBin: true - semver@7.8.5: resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} engines: {node: '>=10'} @@ -1513,8 +1361,8 @@ packages: resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==} engines: {node: '>= 18'} - serialize-javascript@7.1.2: - resolution: {integrity: sha512-GL2BWwVa6JydKO6l/ljVgjAZF4QJ3S7dWDWi53s5GZT8PJzD2fNxi67HANQGKAqPrwEpL5ba7gUBGi0Ls/sEoQ==} + serialize-javascript@7.1.4: + resolution: {integrity: sha512-FqlEuoTq/zRmA4Lg6aOqyH3lCHbUtCB0bmHCeFniX2GBdDqMJM3FwdvEhlE5Pim1dlt2FfBdVPmUNNiGhhKqpw==} engines: {node: '>=20.0.0'} serve-static@2.2.1: @@ -1524,32 +1372,14 @@ packages: setprototypeof@1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} - shebang-command@1.2.0: - resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==} - engines: {node: '>=0.10.0'} - shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} - shebang-regex@1.0.0: - resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==} - engines: {node: '>=0.10.0'} - shebang-regex@3.0.0: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - shelljs@0.9.2: - resolution: {integrity: sha512-S3I64fEiKgTZzKCC46zT/Ib9meqofLrQVbpSswtjFfAVDW+AZ54WTnAM/3/yENoxz/V1Cy6u3kiiEbQ4DNphvw==} - engines: {node: '>=18'} - hasBin: true - - shx@0.4.0: - resolution: {integrity: sha512-Z0KixSIlGPpijKgcH6oCMCbltPImvaKy0sGH8AkLRXw1KyzpKtaCTizP2xen+hNDqVF4xxgvA0KXSb9o4Q6hnA==} - engines: {node: '>=18'} - hasBin: true - side-channel-list@1.0.1: resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==} engines: {node: '>= 0.4'} @@ -1581,10 +1411,6 @@ packages: resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} engines: {node: '>= 0.8'} - strip-eof@1.0.0: - resolution: {integrity: sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==} - engines: {node: '>=0.10.0'} - strip-indent@4.1.1: resolution: {integrity: sha512-SlyRoSkdh1dYP0PzclLE7r0M9sgbFKKMFXpFRUMNuKhQSbC6VQIGzq3E0qsfvGJaUFJPGv6Ws1NZ/haTAjfbMA==} engines: {node: '>=12'} @@ -1597,10 +1423,6 @@ packages: resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} engines: {node: '>=10'} - supports-preserve-symlinks-flag@1.0.0: - resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} - engines: {node: '>= 0.4'} - tar@7.5.23: resolution: {integrity: sha512-lkukzdoGngZHJZXxW4S/E4Fp9ghTDlyZXrQGRNoJ/LXvDKcXUTq2sg5yQe74po7Voea6n/IN09+wE/QvJMiifA==} engines: {node: '>=18'} @@ -1609,10 +1431,6 @@ packages: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} - to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - toidentifier@1.0.1: resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} engines: {node: '>=0.6'} @@ -1643,8 +1461,8 @@ packages: resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==} engines: {node: '>= 18'} - typescript-eslint@8.72.2: - resolution: {integrity: sha512-c/+AKMW1KB81r28Sp0AAdcyXj5dzNmAsZFcsrxKbZTKmcBK2xIwBR31dcSYSDu3bKmzXe8GKrSxO+eDQ401Uzg==} + typescript-eslint@8.73.0: + resolution: {integrity: sha512-+EnKy9rkYPun4l+kG2bDuYWQ6y1tGVgdR/tY1U9AC6h21CjEwOoc7gsjwe0FXB8uWFzk4QiCFbuRWgX758PiAg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 @@ -1678,10 +1496,6 @@ packages: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} - which@1.3.1: - resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} - hasBin: true - which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -1830,20 +1644,18 @@ snapshots: '@esbuild/win32-x64@0.28.2': optional: true - '@eslint-community/eslint-utils@4.10.1(eslint@10.14.0)': + '@eslint-community/eslint-utils@4.10.1(eslint@10.15.0)': dependencies: - eslint: 10.14.0 + eslint: 10.15.0 eslint-visitor-keys: 3.4.3 - '@eslint-community/regexpp@4.12.2': {} - '@eslint-community/regexpp@4.12.3': {} - '@eslint/config-array@0.23.5': + '@eslint/config-array@0.23.6': dependencies: '@eslint/object-schema': 3.0.5 debug: 4.4.3(supports-color@8.1.1) - minimatch: 11.0.1 + minimatch: 11.0.9 transitivePeerDependencies: - supports-color @@ -1860,9 +1672,9 @@ snapshots: mdn-data: 2.37.2 source-map-js: 1.2.2 - '@eslint/js@10.0.1(eslint@10.14.0)': + '@eslint/js@10.0.1(eslint@10.15.0)': optionalDependencies: - eslint: 10.14.0 + eslint: 10.15.0 '@eslint/object-schema@3.0.5': {} @@ -1897,6 +1709,8 @@ snapshots: '@isaacs/nonrecursive-glob-match@1.0.3': {} + '@isaacs/nonrecursive-glob-match@1.1.0': {} + '@keyv/bigmap@1.3.1(keyv@5.6.0)': dependencies: hashery: 1.5.1 @@ -1927,18 +1741,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@nodelib/fs.scandir@2.1.5': - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - - '@nodelib/fs.stat@2.0.5': {} - - '@nodelib/fs.walk@1.2.8': - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.20.1 - '@supabase/auth-js@2.119.0': dependencies: tslib: 2.8.1 @@ -1986,8 +1788,6 @@ snapshots: '@types/estree@1.0.10': {} - '@types/js-yaml@4.0.9': {} - '@types/json-schema@7.0.15': {} '@types/mocha@10.0.10': {} @@ -2002,72 +1802,75 @@ snapshots: dependencies: '@types/node': 26.6.6 - '@typescript-eslint/eslint-plugin@8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3))(eslint@10.14.0)(typescript@6.0.3)': + '@typescript-eslint/eslint-plugin@8.73.0(@typescript-eslint/parser@8.73.0(eslint@10.15.0)(typescript@6.0.3))(eslint@10.15.0)(typescript@6.0.3)': dependencies: '@eslint-community/regexpp': 4.12.3 - '@typescript-eslint/parser': 8.72.2(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/scope-manager': 8.72.2 - '@typescript-eslint/type-utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/visitor-keys': 8.72.2 - eslint: 10.14.0 + '@typescript-eslint/parser': 8.73.0(eslint@10.15.0)(typescript@6.0.3) + '@typescript-eslint/scope-manager': 8.73.0 + '@typescript-eslint/type-utils': 8.73.0(eslint@10.15.0)(typescript@6.0.3) + '@typescript-eslint/utils': 8.73.0(eslint@10.15.0)(typescript@6.0.3) + '@typescript-eslint/visitor-keys': 8.73.0 + eslint: 10.15.0 ignore: 7.0.14 natural-compare: 1.4.0 ts-api-utils: 2.5.0(typescript@6.0.3) typescript: 6.0.3 transitivePeerDependencies: + - '@typescript/native' - supports-color - '@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3)': + '@typescript-eslint/parser@8.73.0(eslint@10.15.0)(typescript@6.0.3)': dependencies: - '@typescript-eslint/scope-manager': 8.72.2 - '@typescript-eslint/types': 8.72.2 - '@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3) - '@typescript-eslint/visitor-keys': 8.72.2 + '@typescript-eslint/scope-manager': 8.73.0 + '@typescript-eslint/types': 8.73.0 + '@typescript-eslint/typescript-estree': 8.73.0(typescript@6.0.3) + '@typescript-eslint/visitor-keys': 8.73.0 debug: 4.4.3(supports-color@8.1.1) - eslint: 10.14.0 + eslint: 10.15.0 typescript: 6.0.3 transitivePeerDependencies: + - '@typescript/native' - supports-color - '@typescript-eslint/project-service@8.72.2(typescript@6.0.3)': + '@typescript-eslint/project-service@8.73.0(typescript@6.0.3)': dependencies: - '@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3) - '@typescript-eslint/types': 8.72.2 + '@typescript-eslint/tsconfig-utils': 8.73.0(typescript@6.0.3) + '@typescript-eslint/types': 8.73.0 debug: 4.4.3(supports-color@8.1.1) typescript: 6.0.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.72.2': + '@typescript-eslint/scope-manager@8.73.0': dependencies: - '@typescript-eslint/types': 8.72.2 - '@typescript-eslint/visitor-keys': 8.72.2 + '@typescript-eslint/types': 8.73.0 + '@typescript-eslint/visitor-keys': 8.73.0 - '@typescript-eslint/tsconfig-utils@8.72.2(typescript@6.0.3)': + '@typescript-eslint/tsconfig-utils@8.73.0(typescript@6.0.3)': dependencies: typescript: 6.0.3 - '@typescript-eslint/type-utils@8.72.2(eslint@10.14.0)(typescript@6.0.3)': + '@typescript-eslint/type-utils@8.73.0(eslint@10.15.0)(typescript@6.0.3)': dependencies: - '@typescript-eslint/types': 8.72.2 - '@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3) - '@typescript-eslint/utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3) + '@typescript-eslint/types': 8.73.0 + '@typescript-eslint/typescript-estree': 8.73.0(typescript@6.0.3) + '@typescript-eslint/utils': 8.73.0(eslint@10.15.0)(typescript@6.0.3) debug: 4.4.3(supports-color@8.1.1) - eslint: 10.14.0 + eslint: 10.15.0 ts-api-utils: 2.5.0(typescript@6.0.3) typescript: 6.0.3 transitivePeerDependencies: + - '@typescript/native' - supports-color - '@typescript-eslint/types@8.72.2': {} + '@typescript-eslint/types@8.73.0': {} - '@typescript-eslint/typescript-estree@8.72.2(typescript@6.0.3)': + '@typescript-eslint/typescript-estree@8.73.0(typescript@6.0.3)': dependencies: - '@typescript-eslint/project-service': 8.72.2(typescript@6.0.3) - '@typescript-eslint/tsconfig-utils': 8.72.2(typescript@6.0.3) - '@typescript-eslint/types': 8.72.2 - '@typescript-eslint/visitor-keys': 8.72.2 + '@typescript-eslint/project-service': 8.73.0(typescript@6.0.3) + '@typescript-eslint/tsconfig-utils': 8.73.0(typescript@6.0.3) + '@typescript-eslint/types': 8.73.0 + '@typescript-eslint/visitor-keys': 8.73.0 debug: 4.4.3(supports-color@8.1.1) minimatch: 11.0.1 semver: 7.8.6 @@ -2077,20 +1880,21 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.72.2(eslint@10.14.0)(typescript@6.0.3)': + '@typescript-eslint/utils@8.73.0(eslint@10.15.0)(typescript@6.0.3)': dependencies: - '@eslint-community/eslint-utils': 4.10.1(eslint@10.14.0) - '@typescript-eslint/scope-manager': 8.72.2 - '@typescript-eslint/types': 8.72.2 - '@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3) - eslint: 10.14.0 + '@eslint-community/eslint-utils': 4.10.1(eslint@10.15.0) + '@typescript-eslint/scope-manager': 8.73.0 + '@typescript-eslint/types': 8.73.0 + '@typescript-eslint/typescript-estree': 8.73.0(typescript@6.0.3) + eslint: 10.15.0 typescript: 6.0.3 transitivePeerDependencies: + - '@typescript/native' - supports-color - '@typescript-eslint/visitor-keys@8.72.2': + '@typescript-eslint/visitor-keys@8.73.0': dependencies: - '@typescript-eslint/types': 8.72.2 + '@typescript-eslint/types': 8.73.0 eslint-visitor-keys: 5.0.1 '@xmldom/xmldom@0.9.12': {} @@ -2152,10 +1956,6 @@ snapshots: dependencies: balanced-match: 4.0.4 - braces@3.0.3: - dependencies: - fill-range: 7.1.1 - browser-stdout@1.3.1: {} browserslist@4.29.5: @@ -2236,14 +2036,6 @@ snapshots: object-assign: 4.1.1 vary: 1.1.2 - cross-spawn@6.0.6: - dependencies: - nice-try: 1.0.5 - path-key: 2.0.1 - semver: 5.7.3 - shebang-command: 1.2.0 - which: 1.3.1 - cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -2274,7 +2066,7 @@ snapshots: dependencies: dequal: 2.0.3 - diff@8.0.3: {} + diff@9.0.0: {} dunder-proto@1.0.1: dependencies: @@ -2288,10 +2080,6 @@ snapshots: encodeurl@2.0.1: {} - end-of-stream@1.4.5: - dependencies: - once: 1.4.0 - entities@8.1.0: {} es-define-property@1.0.1: {} @@ -2337,13 +2125,13 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-config-prettier@10.1.8(eslint@10.14.0): + eslint-config-prettier@10.1.8(eslint@10.15.0): dependencies: - eslint: 10.14.0 + eslint: 10.15.0 - eslint-plugin-unicorn@79.0.0(eslint@10.14.0)(typescript@6.0.3): + eslint-plugin-unicorn@79.0.0(eslint@10.15.0)(typescript@6.0.3): dependencies: - '@eslint-community/eslint-utils': 4.10.1(eslint@10.14.0) + '@eslint-community/eslint-utils': 4.10.1(eslint@10.15.0) '@eslint/css-tree': 4.1.2 browserslist: 4.29.5 change-case: 5.4.4 @@ -2351,7 +2139,7 @@ snapshots: core-js-compat: 3.51.0 detect-indent: 7.0.2 entities: 8.1.0 - eslint: 10.14.0 + eslint: 10.15.0 find-up-simple: 1.0.1 globals: 17.13.0 identifier-regex: 1.1.0 @@ -2382,11 +2170,11 @@ snapshots: eslint-visitor-keys@5.0.1: {} - eslint@10.14.0: + eslint@10.15.0: dependencies: - '@eslint-community/eslint-utils': 4.10.1(eslint@10.14.0) - '@eslint-community/regexpp': 4.12.2 - '@eslint/config-array': 0.23.5 + '@eslint-community/eslint-utils': 4.10.1(eslint@10.15.0) + '@eslint-community/regexpp': 4.12.3 + '@eslint/config-array': 0.23.6 '@eslint/config-helpers': 0.7.0 '@eslint/core': 1.2.1 '@eslint/plugin-kit': 0.7.3 @@ -2411,7 +2199,7 @@ snapshots: imurmurhash: 0.1.4 is-glob: 4.0.3 json-stable-stringify-without-jsonify: 1.0.1 - minimatch: 11.0.1 + minimatch: 11.0.9 natural-compare: 1.4.0 optionator: 0.9.4 transitivePeerDependencies: @@ -2443,16 +2231,6 @@ snapshots: dependencies: eventsource-parser: 3.1.1 - execa@1.0.0: - dependencies: - cross-spawn: 6.0.6 - get-stream: 4.1.0 - is-stream: 1.1.0 - npm-run-path: 2.0.2 - p-finally: 1.0.0 - signal-exit: 3.0.7 - strip-eof: 1.0.0 - express-rate-limit@8.7.2(express@5.3.0): dependencies: debug: 4.4.3(supports-color@8.1.1) @@ -2496,14 +2274,6 @@ snapshots: fast-deep-equal@3.1.3: {} - fast-glob@3.3.3: - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.8 - fast-json-stable-stringify@2.1.0: {} fast-levenshtein@2.0.6: {} @@ -2520,10 +2290,6 @@ snapshots: dependencies: fast-string-width: 3.0.2 - fastq@1.20.1: - dependencies: - reusify: 1.1.0 - fdir@6.5.0(picomatch@4.0.7): optionalDependencies: picomatch: 4.0.7 @@ -2532,10 +2298,6 @@ snapshots: dependencies: flat-cache: 6.1.23 - fill-range@7.1.1: - dependencies: - to-regex-range: 5.0.1 - finalhandler@2.1.1: dependencies: debug: 4.4.3(supports-color@8.1.1) @@ -2589,14 +2351,6 @@ snapshots: dunder-proto: 1.0.1 es-object-atoms: 1.1.2 - get-stream@4.1.0: - dependencies: - pump: 3.0.4 - - glob-parent@5.1.2: - dependencies: - is-glob: 4.0.3 - glob-parent@6.0.2: dependencies: is-glob: 4.0.3 @@ -2661,8 +2415,6 @@ snapshots: inherits@2.0.4: {} - interpret@1.4.0: {} - ip-address@10.7.5: {} ipaddr.js@1.9.1: {} @@ -2671,24 +2423,16 @@ snapshots: dependencies: builtin-modules: 5.4.0 - is-core-module@2.16.2: - dependencies: - hasown: 2.0.4 - is-extglob@2.1.1: {} is-glob@4.0.3: dependencies: is-extglob: 2.1.1 - is-number@7.0.0: {} - is-path-inside@4.0.0: {} is-promise@4.0.0: {} - is-stream@1.1.0: {} - is-stream@2.0.1: {} is-unicode-supported@0.1.0: {} @@ -2762,8 +2506,6 @@ snapshots: merge-descriptors@2.0.0: {} - merge2@1.4.1: {} - micromark-core-commonmark@2.0.4: dependencies: decode-named-character-reference: 1.3.0 @@ -2896,11 +2638,6 @@ snapshots: transitivePeerDependencies: - supports-color - micromatch@4.0.8: - dependencies: - braces: 3.0.3 - picomatch: 2.3.2 - mime-db@1.54.0: {} mime-types@3.0.2: @@ -2912,7 +2649,10 @@ snapshots: '@isaacs/nonrecursive-glob-match': 1.0.3 brace-expansion: 5.0.12 - minimist@1.2.8: {} + minimatch@11.0.9: + dependencies: + '@isaacs/nonrecursive-glob-match': 1.1.0 + brace-expansion: 5.0.12 minipass@7.1.3: {} @@ -2925,7 +2665,7 @@ snapshots: browser-stdout: 1.3.1 chokidar: 5.0.0 debug: 4.4.3(supports-color@8.1.1) - diff: 8.0.3 + diff: 9.0.0 find-up-simple: 1.0.1 glob: 14.0.2 is-path-inside: 4.0.0 @@ -2934,7 +2674,7 @@ snapshots: minimatch: 11.0.1 ms: 2.1.3 picocolors: 1.1.1 - serialize-javascript: 7.1.2 + serialize-javascript: 7.1.4 strip-json-comments: 5.0.3 supports-color: 8.1.1 workerpool: 10.0.3 @@ -2947,16 +2687,10 @@ snapshots: dependencies: content-type: 2.1.0 - nice-try@1.0.5: {} - node-releases@2.0.62: {} node-stream-zip@1.16.0: {} - npm-run-path@2.0.2: - dependencies: - path-key: 2.0.1 - object-assign@4.1.1: {} object-inspect@1.13.4: {} @@ -2978,8 +2712,6 @@ snapshots: type-check: 0.4.0 word-wrap: 1.2.5 - p-finally@1.0.0: {} - p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 @@ -2996,12 +2728,8 @@ snapshots: path-exists@4.0.0: {} - path-key@2.0.1: {} - path-key@3.1.1: {} - path-parse@1.0.7: {} - path-scurry@3.0.0: dependencies: lru-cache: 11.5.3 @@ -3011,8 +2739,6 @@ snapshots: picocolors@1.1.1: {} - picomatch@2.3.2: {} - picomatch@4.0.7: {} pkce-challenge@5.0.1: {} @@ -3039,11 +2765,6 @@ snapshots: forwarded: 0.2.0 ipaddr.js: 1.9.1 - pump@3.0.4: - dependencies: - end-of-stream: 1.4.5 - once: 1.4.0 - punycode@2.3.1: {} qified@0.10.1: @@ -3057,8 +2778,6 @@ snapshots: querystringify@2.2.0: {} - queue-microtask@1.2.3: {} - quote-js-string@0.1.0: {} range-parser@1.3.0: {} @@ -3072,10 +2791,6 @@ snapshots: readdirp@5.1.1: {} - rechoir@0.6.2: - dependencies: - resolve: 1.22.12 - regjsparser@0.13.4: dependencies: jsesc: 3.1.0 @@ -3086,17 +2801,8 @@ snapshots: reserved-identifiers@1.2.0: {} - resolve@1.22.12: - dependencies: - es-errors: 1.3.0 - is-core-module: 2.16.2 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - retry@0.12.0: {} - reusify@1.1.0: {} - router@2.2.0: dependencies: debug: 4.4.3(supports-color@8.1.1) @@ -3107,14 +2813,8 @@ snapshots: transitivePeerDependencies: - supports-color - run-parallel@1.2.0: - dependencies: - queue-microtask: 1.2.3 - safer-buffer@2.1.2: {} - semver@5.7.3: {} - semver@7.8.5: {} semver@7.8.6: {} @@ -3135,7 +2835,7 @@ snapshots: transitivePeerDependencies: - supports-color - serialize-javascript@7.1.2: {} + serialize-javascript@7.1.4: {} serve-static@2.2.1: dependencies: @@ -3148,30 +2848,12 @@ snapshots: setprototypeof@1.2.0: {} - shebang-command@1.2.0: - dependencies: - shebang-regex: 1.0.0 - shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 - shebang-regex@1.0.0: {} - shebang-regex@3.0.0: {} - shelljs@0.9.2: - dependencies: - execa: 1.0.0 - fast-glob: 3.3.3 - interpret: 1.4.0 - rechoir: 0.6.2 - - shx@0.4.0: - dependencies: - minimist: 1.2.8 - shelljs: 0.9.2 - side-channel-list@1.0.1: dependencies: es-errors: 1.3.0 @@ -3208,8 +2890,6 @@ snapshots: statuses@2.0.2: {} - strip-eof@1.0.0: {} - strip-indent@4.1.1: {} strip-json-comments@5.0.3: {} @@ -3218,8 +2898,6 @@ snapshots: dependencies: has-flag: 4.0.0 - supports-preserve-symlinks-flag@1.0.0: {} - tar@7.5.23: dependencies: '@isaacs/fs-minipass': 4.0.1 @@ -3233,10 +2911,6 @@ snapshots: fdir: 6.5.0(picomatch@4.0.7) picomatch: 4.0.7 - to-regex-range@5.0.1: - dependencies: - is-number: 7.0.0 - toidentifier@1.0.1: {} ts-api-utils@2.5.0(typescript@6.0.3): @@ -3271,15 +2945,16 @@ snapshots: media-typer: 1.1.1 mime-types: 3.0.2 - typescript-eslint@8.72.2(eslint@10.14.0)(typescript@6.0.3): + typescript-eslint@8.73.0(eslint@10.15.0)(typescript@6.0.3): dependencies: - '@typescript-eslint/eslint-plugin': 8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3))(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/parser': 8.72.2(eslint@10.14.0)(typescript@6.0.3) - '@typescript-eslint/typescript-estree': 8.72.2(typescript@6.0.3) - '@typescript-eslint/utils': 8.72.2(eslint@10.14.0)(typescript@6.0.3) - eslint: 10.14.0 + '@typescript-eslint/eslint-plugin': 8.73.0(@typescript-eslint/parser@8.73.0(eslint@10.15.0)(typescript@6.0.3))(eslint@10.15.0)(typescript@6.0.3) + '@typescript-eslint/parser': 8.73.0(eslint@10.15.0)(typescript@6.0.3) + '@typescript-eslint/typescript-estree': 8.73.0(typescript@6.0.3) + '@typescript-eslint/utils': 8.73.0(eslint@10.15.0)(typescript@6.0.3) + eslint: 10.15.0 typescript: 6.0.3 transitivePeerDependencies: + - '@typescript/native' - supports-color typescript@6.0.3: {} @@ -3305,10 +2980,6 @@ snapshots: vary@1.1.2: {} - which@1.3.1: - dependencies: - isexe: 2.0.0 - which@2.0.2: dependencies: isexe: 2.0.0 From ec778b2de43b724ff5e8c323c67700ebfeea9cf1 Mon Sep 17 00:00:00 2001 From: Tom Riglar Date: Tue, 17 Nov 2026 12:03:41 +0000 Subject: [PATCH 7/9] refactor(auth): refresh `dcd login` sessions through the API, not Supabase (#313) * refactor(auth): refresh `dcd login` sessions through the API, not Supabase The CLI refreshed its session by calling Supabase Auth with a publishable key fetched from the API. It now posts the refresh token to the API's POST /cli-login/refresh, which does the refresh server-side. - 401 (Supabase refused the token) and 400 are final: run `dcd login`. The friendly messages for session_expired / session_not_found / refresh_token_not_found are kept. - Network errors, 404, 429 and 5xx keep the stored session for a retry. - Sends the CLI identity headers, like every other API call. Co-Authored-By: Claude Opus 5.5 * fix(auth): treat a non-JSON 200 from the refresh endpoint as retryable A 200 whose body is not JSON (a proxy page, say) made res.json() throw a plain SyntaxError. It now throws a retryable SessionRefreshError, like the other might-work-later cases, so the user sees a clear message. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- CLAUDE.md | 2 +- src/gateways/cli-auth-gateway.ts | 123 ++++++++++++---------- src/utils/auth.ts | 6 +- test/unit/cli-auth-gateway.test.ts | 162 +++++++++++++++++++++++++++++ test/unit/supabase-key.test.ts | 120 --------------------- 5 files changed, 232 insertions(+), 181 deletions(-) create mode 100644 test/unit/cli-auth-gateway.test.ts diff --git a/CLAUDE.md b/CLAUDE.md index b821a9f..a561baf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -43,7 +43,7 @@ Top-level `defineCommand` in `src/index.ts` wires fourteen subcommands (`cloud`, **Cloud command workflow** (the canonical shape other commands mirror): upload binary with SHA dedup → extract metadata / validate devices → build execution plan → submit tests → poll results every 10s → download artifacts (reports/videos/logs). `RunFailedError` from the polling service is the signal for a failed test run (distinct from infra errors). -**Auth.** Every command calls `resolveAuth({ apiKeyFlag })` (`src/utils/auth.ts`) once and threads the returned `AuthContext` into gateways/services. `ApiGateway` and `fetchCompatibilityData` spread `auth.headers` into fetch headers — they no longer accept a raw api key. The same headers carry the CLI's identity on every request (`x-dcd-cli-version`, plus `x-dcd-ci-provider` / `x-dcd-ci-wrapper-version` from `detectCiContext`), which the API uses for notice targeting and records on each upload and binary (dcd#1622). Precedence: `--api-key` flag > `DEVICE_CLOUD_API_KEY` env > stored session from `dcd login`. `resolveAuth` refreshes expiring Supabase sessions via `CliAuthGateway.refresh` and rewrites the config atomically. A session's access token lasts about an hour, so code that can outlive it re-checks with `isAuthExpiring` / `refreshAuth`: the `dcd cloud` poll loop and the report downloads after it, the MCP context, and `dcd_run_cloud_test`'s wait loop. `refreshAuth` keeps the org the command started with and leaves API-key contexts untouched. +**Auth.** Every command calls `resolveAuth({ apiKeyFlag })` (`src/utils/auth.ts`) once and threads the returned `AuthContext` into gateways/services. `ApiGateway` and `fetchCompatibilityData` spread `auth.headers` into fetch headers — they no longer accept a raw api key. The same headers carry the CLI's identity on every request (`x-dcd-cli-version`, plus `x-dcd-ci-provider` / `x-dcd-ci-wrapper-version` from `detectCiContext`), which the API uses for notice targeting and records on each upload and binary (dcd#1622). Precedence: `--api-key` flag > `DEVICE_CLOUD_API_KEY` env > stored session from `dcd login`. `resolveAuth` refreshes expiring Supabase sessions via `CliAuthGateway.refresh`, which posts the refresh token to the API's `POST /cli-login/refresh` (no Supabase key needed; a 401 or 400 is final, anything else keeps the stored session for a retry), and rewrites the config atomically. A session's access token lasts about an hour, so code that can outlive it re-checks with `isAuthExpiring` / `refreshAuth`: the `dcd cloud` poll loop and the report downloads after it, the MCP context, and `dcd_run_cloud_test`'s wait loop. `refreshAuth` keeps the org the command started with and leaves API-key contexts untouched. **Config store.** `dcd login` writes `$XDG_CONFIG_HOME/dcd/config.json` (fallback `~/.dcd/config.json`, 0600). Shape: `{ version, env, api_url, supabase_url, session: { access_token, refresh_token, expires_at, user_email, user_id }, current_org_id, current_org_name }`. `DCD_CONFIG_DIR` overrides the directory (used by tests). The login command itself (`src/commands/login.ts`) uses PKCE (S256) with a server rendezvous — no loopback server: it mints `state`, `code_verifier`, and `code_challenge`, opens `/cli-login?state=...&code_challenge=...`, then polls the dcd API's `POST /cli-login/claim` with `{state, code_verifier}` while the frontend POSTs proof of identity (the browser's access token) to `POST /cli-login/handoff`; the API verifies the token, **mints a dedicated Supabase session for the CLI** (its own refresh-token family — sharing the browser's tokens caused "Invalid Refresh Token: Already Used" whenever either client rotated them), stores it keyed by state, then on claim verifies `sha256(verifier) === challenge` and returns it. After claiming, the CLI fetches `/me/orgs` and picks the org with `selectOrg` (`src/utils/orgs.ts`): `--org ` if given, else the only org, else the picker `dcd switch-org` uses, starting on the last login's org. That org only counts when the stored `api_url` matches, because org ids are per environment. Without a TTY (`canPrompt` in `src/utils/ci.ts`) the prompts can't be answered: the "already logged in" confirm takes its default and signs in again, the last login's org is used, and with none the command fails pointing at `--org`. `dcd logout` deletes the whole config, so nothing is remembered after it. The frontend lives in `../dcd/frontend/app/features/cli-login/CliLoginScreen.tsx`. diff --git a/src/gateways/cli-auth-gateway.ts b/src/gateways/cli-auth-gateway.ts index bee282e..efe335d 100644 --- a/src/gateways/cli-auth-gateway.ts +++ b/src/gateways/cli-auth-gateway.ts @@ -1,20 +1,16 @@ /** - * Supabase session operations for the CLI: refresh an expired access token - * and sign-out (best-effort revocation on the Supabase side). + * Refreshes a `dcd login` session through the dcd API's + * `POST /cli-login/refresh`, which calls Supabase Auth on the CLI's behalf. + * The CLI holds no Supabase key for this. * - * Does not talk to the dcd API — the dcd-side session exchange lives in the - * login command's PKCE rendezvous flow (see src/commands/login.ts). + * The login itself is the PKCE rendezvous in src/commands/login.ts. */ -import { createClient, isAuthApiError, isAuthSessionMissingError } from '@supabase/supabase-js'; - -import type { DcdEnvName } from '../config/environments.js'; -import { getSupabaseKey } from '../config/supabase-key.js'; import type { StoredSession } from '../utils/config-store.js'; /** - * Thrown when a session refresh fails. `definitive` distinguishes "Supabase - * rejected this refresh token" (revoked, already used, malformed — re-login - * is the only fix) from transient failures (network, GoTrue 5xx) where the + * Thrown when a session refresh fails. `definitive` distinguishes "this + * refresh token was rejected" (revoked, already used, expired — re-login is + * the only fix) from transient failures (network, 5xx, rate limit) where the * stored session may still be good on the next attempt. */ export class SessionRefreshError extends Error { @@ -53,63 +49,80 @@ export interface RefreshedSession { user_id: string; } -function client(supabaseUrl: string, supabaseKey: string) { - return createClient(supabaseUrl, supabaseKey, { - auth: { persistSession: false, autoRefreshToken: false, detectSessionInUrl: false }, - }); +/** The API's error envelope: `{ statusCode, error, message }`. */ +interface ApiErrorBody { + error?: unknown; + message?: unknown; } export const CliAuthGateway = { + /** + * @param apiUrl The API the session was minted by (the stored `api_url`) + * @param session The stored session, whose refresh token is spent on success + * @param headers Extra headers, such as the CLI's identity headers + */ async refresh( - supabaseUrl: string, - env: DcdEnvName, + apiUrl: string, session: StoredSession, + headers: Record = {}, ): Promise { - let supabaseKey: string; + let res: Response; try { - supabaseKey = await getSupabaseKey(env); + res = await fetch(`${apiUrl.replace(/\/$/, '')}/cli-login/refresh`, { + body: JSON.stringify({ refresh_token: session.refresh_token }), + headers: { ...headers, 'content-type': 'application/json' }, + method: 'POST', + }); } catch (error) { - // Never definitive: the refresh token was not even tried, so the stored - // session must survive for the next attempt. + // Never definitive: the token was not even tried. throw new SessionRefreshError( `Failed to refresh session: ${(error as Error).message}`, false, ); } - const sb = client(supabaseUrl, supabaseKey); - const { data, error } = await sb.auth.refreshSession({ - refresh_token: session.refresh_token, - }); - if (error || !data.session || !data.user) { - // 4xx from GoTrue means the token itself was rejected; anything else - // (fetch failure, 5xx) could succeed on retry with the same token. - // supabase-js turns GoTrue's `session_not_found` into an - // AuthSessionMissingError rather than an AuthApiError (it throws the same - // for an empty refresh token); only `dcd login` fixes either. - const apiError = error != null && isAuthApiError(error) ? error : undefined; - const sessionMissing = error != null && isAuthSessionMissingError(error); - const definitive = - sessionMissing || - (apiError !== undefined && apiError.status >= 400 && apiError.status < 500); - const code = apiError?.code ?? (sessionMissing ? 'session_not_found' : undefined); - const known = definitive && code ? REFRESH_REFUSAL_MESSAGES.get(code) : undefined; - throw new SessionRefreshError( - known ?? - `Failed to refresh session: ${error?.message ?? 'no session returned'}. ` + - `Run \`dcd login\` again.`, - definitive, - code, - ); + + if (res.ok) { + let s: Partial; + try { + s = (await res.json()) as Partial; + } catch { + // A 200 that is not JSON (a proxy page, say). The token may not have + // been spent, so keep the session and try again next time. + throw new SessionRefreshError('Failed to refresh session: response was not JSON', false); + } + if (!s.access_token || !s.refresh_token || !s.expires_at || !s.user_id) { + throw new SessionRefreshError('Failed to refresh session: incomplete response', false); + } + return { + access_token: s.access_token, + refresh_token: s.refresh_token, + expires_at: s.expires_at, + user_email: s.user_email || session.user_email, + user_id: s.user_id, + }; } - const s = data.session; - const u = data.user; - if (!s.expires_at) throw new Error('Refreshed session is missing expires_at'); - return { - access_token: s.access_token, - refresh_token: s.refresh_token, - expires_at: s.expires_at, - user_email: u.email ?? session.user_email, - user_id: u.id, - }; + + let body: ApiErrorBody = {}; + try { + body = (await res.json()) as ApiErrorBody; + } catch { + // Not JSON (a proxy page, say). The status alone decides. + } + const code = typeof body.error === 'string' ? body.error : undefined; + const reason = + typeof body.message === 'string' && body.message ? body.message : `HTTP ${res.status}`; + + // 401: Supabase Auth refused the token, and `error` is its code. 400: the + // API refused the request itself (an empty token). Only `dcd login` fixes + // either. Anything else (404 from an API without this route, 429, 5xx) + // may work later with the same token, so it must survive. + const definitive = res.status === 401 || res.status === 400; + const known = definitive && code ? REFRESH_REFUSAL_MESSAGES.get(code) : undefined; + throw new SessionRefreshError( + known ?? + `Failed to refresh session: ${reason}.` + (definitive ? ' Run `dcd login` again.' : ''), + definitive, + definitive ? code : undefined, + ); }, }; diff --git a/src/utils/auth.ts b/src/utils/auth.ts index b923ea1..1875c41 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -221,11 +221,7 @@ async function refreshSessionWithLock( // forced a fresh login when an upgrade alone would have fixed it. The // error tells the user to log in again; only `dcd logout` (or the next // `dcd login`) replaces the stored session. - const refreshed = await CliAuthGateway.refresh( - current.supabase_url, - current.env, - session, - ); + const refreshed = await CliAuthGateway.refresh(current.api_url, session, clientHeaders()); // Re-read again and merge only `session` so a concurrent `switch-org` // write (org fields) isn't reverted by our pre-refresh snapshot. const merged: StoredConfig = { ...(readConfig() ?? current), session: refreshed }; diff --git a/test/unit/cli-auth-gateway.test.ts b/test/unit/cli-auth-gateway.test.ts new file mode 100644 index 0000000..fe1ccfe --- /dev/null +++ b/test/unit/cli-auth-gateway.test.ts @@ -0,0 +1,162 @@ +import { expect } from 'chai'; + +import { CliAuthGateway, SessionRefreshError } from '../../src/gateways/cli-auth-gateway.js'; + +/** + * A `dcd login` session is refreshed through the API's POST /cli-login/refresh, + * not Supabase Auth, so the CLI needs no Supabase key for it. A refusal the + * user can only fix with `dcd login` must be `definitive`; anything else must + * leave the stored session alone for the next try. + */ +describe('CliAuthGateway.refresh', () => { + const realFetch = globalThis.fetch; + const stored = { + access_token: 'a', + refresh_token: 'r', + expires_at: 0, + user_email: 'u@example.com', + user_id: 'u1', + }; + let calls: Array<{ body: unknown; headers: Record; url: string }>; + + function stubFetch(respond: () => Response | Promise): void { + calls = []; + globalThis.fetch = (async (input: string | URL | Request, init?: RequestInit) => { + calls.push({ + body: JSON.parse(String(init?.body)), + headers: init?.headers as Record, + url: String(input), + }); + return respond(); + }) as typeof fetch; + } + + const json = (body: unknown, status = 200) => + new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } }); + + async function refreshError(): Promise { + try { + await CliAuthGateway.refresh('https://api.devicecloud.dev', stored); + } catch (error) { + expect(error).to.be.instanceOf(SessionRefreshError); + return error as SessionRefreshError; + } + throw new Error('expected the refresh to fail'); + } + + afterEach(() => { + globalThis.fetch = realFetch; + }); + + it('posts the refresh token to the API and returns the new session', async () => { + stubFetch(() => + json({ + access_token: 'a2', + refresh_token: 'r2', + expires_at: 123, + user_email: 'u@example.com', + user_id: 'u1', + }), + ); + + const session = await CliAuthGateway.refresh('https://api.devicecloud.dev/', stored, { + 'x-dcd-cli-version': '9.9.9', + }); + + expect(session).to.deep.equal({ + access_token: 'a2', + refresh_token: 'r2', + expires_at: 123, + user_email: 'u@example.com', + user_id: 'u1', + }); + expect(calls).to.have.length(1); + expect(calls[0].url).to.equal('https://api.devicecloud.dev/cli-login/refresh'); + expect(calls[0].body).to.deep.equal({ refresh_token: 'r' }); + expect(calls[0].headers).to.include({ + 'content-type': 'application/json', + 'x-dcd-cli-version': '9.9.9', + }); + }); + + it('keeps the stored email when the API sends none', async () => { + stubFetch(() => + json({ access_token: 'a2', refresh_token: 'r2', expires_at: 123, user_email: '', user_id: 'u1' }), + ); + + const session = await CliAuthGateway.refresh('https://api.devicecloud.dev', stored); + + expect(session.user_email).to.equal('u@example.com'); + }); + + it('says the session expired', async () => { + stubFetch(() => json({ statusCode: 401, error: 'session_expired', message: 'Session Expired' }, 401)); + + const error = await refreshError(); + + expect(error.message).to.equal('Your session expired. Run `dcd login` to sign in again.'); + expect(error.code).to.equal('session_expired'); + expect(error.definitive).to.equal(true); + }); + + it('says the session was signed out when it no longer exists', async () => { + for (const code of ['refresh_token_not_found', 'session_not_found']) { + stubFetch(() => json({ statusCode: 401, error: code, message: 'Not Found' }, 401)); + + const error = await refreshError(); + + expect(error.message).to.equal('Your session was signed out. Run `dcd login` to sign in again.'); + expect(error.code).to.equal(code); + expect(error.definitive).to.equal(true); + } + }); + + it("keeps Supabase's message for any other refusal", async () => { + stubFetch(() => + json( + { + statusCode: 401, + error: 'refresh_token_already_used', + message: 'Invalid Refresh Token: Already Used', + }, + 401, + ), + ); + + const error = await refreshError(); + + expect(error.message).to.equal( + 'Failed to refresh session: Invalid Refresh Token: Already Used. Run `dcd login` again.', + ); + expect(error.code).to.equal('refresh_token_already_used'); + expect(error.definitive).to.equal(true); + }); + + it('treats a 400 from the API as final', async () => { + stubFetch(() => json({ statusCode: 400, message: ['refresh_token should not be empty'] }, 400)); + + const error = await refreshError(); + + expect(error.definitive).to.equal(true); + }); + + for (const [label, respond] of [ + ['a network failure', () => Promise.reject(new TypeError('fetch failed'))], + ['a 503', () => json({ statusCode: 503, error: 'refresh_unavailable', message: 'Try again.' }, 503)], + ['a 429', () => json({ statusCode: 429, message: 'ThrottlerException: Too Many Requests' }, 429)], + ['a 404 from an API without the route', () => json({ statusCode: 404, message: 'Cannot POST' }, 404)], + ['a page that is not JSON', () => new Response('bad gateway', { status: 502 })], + ['a 200 that is not JSON', () => new Response('ok', { status: 200 })], + ] as Array<[string, () => Promise | Response]>) { + it(`keeps the stored session after ${label}`, async () => { + stubFetch(respond); + + const error = await refreshError(); + + // Not definitive, so callers keep the session and try again later. + expect(error.definitive).to.equal(false); + expect(error.code).to.equal(undefined); + expect(error.message).to.not.contain('dcd login'); + }); + } +}); diff --git a/test/unit/supabase-key.test.ts b/test/unit/supabase-key.test.ts index 32ce7bf..c6da796 100644 --- a/test/unit/supabase-key.test.ts +++ b/test/unit/supabase-key.test.ts @@ -5,7 +5,6 @@ import { resetSupabaseKeyCache, supabaseKeyHeaders, } from '../../src/config/supabase-key.js'; -import { CliAuthGateway, SessionRefreshError } from '../../src/gateways/cli-auth-gateway.js'; /** * The Supabase key is fetched from the API's `GET /cli-config` (dcd#1112) @@ -73,123 +72,4 @@ describe('Supabase key from /cli-config', () => { authorization: 'Bearer eyJhbGciOi.x.y', }); }); - - it('keeps the stored session when the key cannot be fetched during a refresh', async () => { - stubFetch(() => { - throw new TypeError('fetch failed'); - }); - let caught: unknown; - try { - await CliAuthGateway.refresh('https://cloud.devicecloud.dev', 'prod', { - access_token: 'a', - refresh_token: 'r', - expires_at: 0, - user_email: 'u@example.com', - user_id: 'u1', - }); - } catch (error) { - caught = error; - } - expect(caught).to.be.instanceOf(SessionRefreshError); - // Not definitive, so resolveAuth will not delete the user's login. - expect((caught as SessionRefreshError).definitive).to.equal(false); - }); - - /** - * Supabase Auth refuses a refresh with a 4xx and an error code: in `code` - * when the response is versioned (2024-01-01 and later), in `error_code` - * before that. The CLI names the common causes instead of echoing them. - */ - describe('when Supabase refuses the refresh', () => { - const storedSession = { - access_token: 'a', - refresh_token: 'r', - expires_at: 0, - user_email: 'u@example.com', - user_id: 'u1', - }; - - function refuseRefresh(token: () => Response): void { - stubFetch((url) => - url.endsWith('/cli-config') - ? json({ supabase_publishable_key: 'sb_publishable_abc' }) - : token(), - ); - } - - const versioned = (status: number, code: string, message: string) => - new Response(JSON.stringify({ code, message }), { - status, - headers: { - 'content-type': 'application/json', - 'x-supabase-api-version': '2024-01-01', - }, - }); - - async function refreshError(): Promise { - try { - await CliAuthGateway.refresh('https://cloud.devicecloud.dev', 'prod', storedSession); - } catch (error) { - expect(error).to.be.instanceOf(SessionRefreshError); - return error as SessionRefreshError; - } - throw new Error('expected the refresh to fail'); - } - - it('says the session expired', async () => { - refuseRefresh(() => versioned(403, 'session_expired', 'Invalid Refresh Token: Session Expired')); - - const error = await refreshError(); - - expect(error.message).to.equal('Your session expired. Run `dcd login` to sign in again.'); - expect(error.code).to.equal('session_expired'); - expect(error.definitive).to.equal(true); - expect(requested[1]).to.equal( - 'https://cloud.devicecloud.dev/auth/v1/token?grant_type=refresh_token', - ); - }); - - it('reads the code from an unversioned response too', async () => { - refuseRefresh(() => - json( - { code: 403, error_code: 'session_expired', msg: 'Invalid Refresh Token: Session Expired (Inactivity)' }, - 403, - ), - ); - - const error = await refreshError(); - - expect(error.message).to.equal('Your session expired. Run `dcd login` to sign in again.'); - expect(error.code).to.equal('session_expired'); - expect(error.definitive).to.equal(true); - }); - - it('says the session was signed out when it no longer exists', async () => { - for (const code of ['refresh_token_not_found', 'session_not_found']) { - refuseRefresh(() => versioned(400, code, 'Invalid Refresh Token: Refresh Token Not Found')); - - const error = await refreshError(); - - expect(error.message).to.equal( - 'Your session was signed out. Run `dcd login` to sign in again.', - ); - expect(error.code).to.equal(code); - expect(error.definitive).to.equal(true); - } - }); - - it("keeps Supabase's message for any other refusal", async () => { - refuseRefresh(() => - versioned(400, 'refresh_token_already_used', 'Invalid Refresh Token: Already Used'), - ); - - const error = await refreshError(); - - expect(error.message).to.equal( - 'Failed to refresh session: Invalid Refresh Token: Already Used. Run `dcd login` again.', - ); - expect(error.code).to.equal('refresh_token_already_used'); - expect(error.definitive).to.equal(true); - }); - }); }); From 7a20e48611bd7caec1089d0d277279f8f8192cbc Mon Sep 17 00:00:00 2001 From: finalerock44 <77282157+finalerock44@users.noreply.github.com> Date: Tue, 17 Nov 2026 12:04:38 +0000 Subject: [PATCH 8/9] feat: open link command, device location and timeout options (#327) * feat(device): open a link, set the location, and a wait on tap Three additions to `dcd device`, for the device session API's new actions. `dcd device open-link [id] ` opens a link on the device as tapping it would: a deep link into an app, or a web link in the app that claims it or the browser. `--sensitive` keeps a link that carries a token out of the timeline and out of what the command prints. `dcd device set-location [id] --latitude --longitude ` sets the device's GPS position in decimal degrees. South and west are negative. `dcd device tap --text|--rid ... --timeout ` says how long to wait for the element before the tap fails (0 to 60; 0 looks once). Without it the device waits 17 seconds, as before. A lone positional with a colon is the link, not a session id, as a lone key is for `press-key`. Usage errors answer inside the --json envelope and call nothing. * fix(telemetry): keep an open-link link and typed text out of telemetry Telemetry records the argv of every command, with the values of a few flags redacted by name. `dcd device open-link` takes its link as a positional, which no flag name marks, so a link sent with `--sensitive` was kept out of the terminal and the session's timeline and still sent to telemetry in full, token included. `scrubArgv` now redacts everything after `device open-link` that is not a flag, and the value of any flag there but the API URL: with or without `--sensitive`, since a sign-in link is a credential whether or not the caller marked it. The session id goes with it, and a link too malformed to send is not kept either. The subcommand is found by name anywhere after `device`, so a flag's value in between cannot hide it. `dcd device type --text` had the same hole: `--text` was never in the list, so a typed password or code went to telemetry even with `--sensitive`. It is redacted for `device type`; `device tap --text`, an element's label, is kept. --- src/commands/device.ts | 112 +++++++++++++++++- src/gateways/device-gateway.ts | 2 +- src/services/telemetry.service.ts | 41 ++++++- src/types/domain/device-session.types.ts | 15 ++- test/unit/device-command.test.ts | 141 +++++++++++++++++++++++ test/unit/telemetry-scrub-argv.test.ts | 121 +++++++++++++++++++ 6 files changed, 423 insertions(+), 9 deletions(-) create mode 100644 test/unit/telemetry-scrub-argv.test.ts diff --git a/src/commands/device.ts b/src/commands/device.ts index db11dfb..eb7c2c4 100644 --- a/src/commands/device.ts +++ b/src/commands/device.ts @@ -738,6 +738,38 @@ function percentArg(value: unknown, flag: string): number { return n; } +/** The longest a tap may wait for its target, as the API allows. */ +const MAX_TAP_TIMEOUT_SECONDS = 60; + +/** Seconds from a flag value, from 0 to `max`, or a usage error. Undefined when the flag was not given. */ +function secondsArg(value: unknown, flag: string, max: number): number | undefined { + if (value === undefined) return undefined; + const n = typeof value === 'number' ? value : Number(value); + if (typeof value === 'boolean' || value === '' || !Number.isFinite(n) || n < 0 || n > max) { + throw new CliError(`--${flag} must be a number of seconds from 0 to ${max}.`, 1); + } + return n; +} + +/** Decimal degrees from a flag value, within `limit` either way, or a usage error. */ +function degreesArg(value: unknown, flag: string, limit: number): number { + const n = typeof value === 'number' ? value : Number(value); + if ( + value === undefined || + typeof value === 'boolean' || + (typeof value === 'string' && value.trim() === '') || + !Number.isFinite(n) || + n < -limit || + n > limit + ) { + throw new CliError(`--${flag} must be a number from -${limit} to ${limit} (decimal degrees).`, 1); + } + return n; +} + +/** A link with a scheme and nothing a shell or a URL would split on. A session id has no colon. */ +const LINK = /^[A-Za-z][A-Za-z0-9+.-]*:\S+$/; + /** "x,y" (percentages) from a flag value, or a usage error. */ function pointArg(value: unknown, flag: string): DevicePoint { const parts = typeof value === 'string' ? value.split(',') : []; @@ -782,6 +814,10 @@ const tapSub = defineCommand({ rid: { type: 'string', description: 'The element\'s resource id (rid in `dcd device inspect`)' }, x: { type: 'string', description: 'With --y: a point, as percentages of the screen (0-100)' }, y: { type: 'string', description: 'See --x' }, + timeout: { + type: 'string', + description: `With --text or --rid: seconds to wait for it to appear before failing (0-${MAX_TAP_TIMEOUT_SECONDS}, default 17; 0 looks once)`, + }, maestro: maestroArg, }, async run({ args }) { @@ -795,11 +831,16 @@ const tapSub = defineCommand({ if (targets !== 1) { throw new CliError('tap takes exactly one target: --text, --rid, or --x and --y.', 1); } + const timeoutSeconds = secondsArg(args.timeout, 'timeout', MAX_TAP_TIMEOUT_SECONDS); + if (timeoutSeconds !== undefined && args.text === undefined && args.rid === undefined) { + throw new CliError('tap --timeout goes with --text or --rid: a point has nothing to wait for.', 1); + } + const wait = timeoutSeconds === undefined ? {} : { timeoutSeconds }; const body: DeviceActionRequest = args.text !== undefined - ? { type: 'tap', text: String(args.text) } + ? { type: 'tap', text: String(args.text), ...wait } : args.rid !== undefined - ? { type: 'tap', id: String(args.rid) } + ? { type: 'tap', id: String(args.rid), ...wait } : { type: 'tap', x: percentArg(args.x, 'x'), y: percentArg(args.y, 'y') }; const what = args.text !== undefined @@ -914,6 +955,71 @@ const pressKeySub = defineCommand({ }, }); +const openLinkSub = defineCommand({ + meta: { name: 'open-link', description: 'Open a link on the device: a deep link into an app, or a web link' }, + args: { + ...commonArgs, + id: idArg, + // Not `required`, as with `type --text`: a missing link fails inside the envelope. + url: { + type: 'positional', + required: false, + description: 'The link with its scheme, e.g. myapp://path or https://example.com', + }, + sensitive: { + type: 'boolean', + default: false, + description: 'The link is a secret (it carries a token): stored encrypted, never shown', + }, + }, + async run({ args }) { + const json = Boolean(args.json); + await runDeviceCommand(json, async () => { + let id = args.id as string | undefined; + let url = args.url as string | undefined; + // `dcd device open-link myapp://path`: the one positional is the link, not a session. + if (id && !url && id.includes(':')) [id, url] = [undefined, id]; + if (!url || !LINK.test(url)) { + throw new CliError( + 'open-link takes a link with its scheme and no spaces, e.g. myapp://path or https://example.com.', + 1, + ); + } + const shown = args.sensitive ? 'a link' : url; + return performAction( + args, + id, + { type: 'open_link', url, ...(args.sensitive ? { sensitive: true } : {}) }, + { done: `Opened ${shown}`, failed: `Opening ${shown} failed` }, + ); + }); + }, +}); + +const setLocationSub = defineCommand({ + meta: { name: 'set-location', description: "Set the device's GPS position, in decimal degrees" }, + args: { + ...commonArgs, + id: idArg, + latitude: { type: 'string', description: 'Decimal degrees, north positive (-90 to 90)' }, + longitude: { type: 'string', description: 'Decimal degrees, east positive (-180 to 180)' }, + }, + async run({ args }) { + const json = Boolean(args.json); + await runDeviceCommand(json, async () => { + // South and west are negative. citty keeps a value that is a number, minus sign and all. + const latitude = degreesArg(args.latitude, 'latitude', 90); + const longitude = degreesArg(args.longitude, 'longitude', 180); + return performAction( + args, + args.id as string | undefined, + { type: 'set_location', latitude, longitude }, + { done: `Location set to ${latitude}, ${longitude}`, failed: 'Setting the location failed' }, + ); + }); + }, +}); + const modelsSub = defineCommand({ meta: { name: 'models', description: 'The devices a session can ask for' }, args: { @@ -1553,6 +1659,8 @@ export const deviceCommand = defineCommand({ type: typeSub, swipe: swipeSub, 'press-key': pressKeySub, + 'open-link': openLinkSub, + 'set-location': setLocationSub, models: modelsSub, inspect: inspectSub, screenshot: screenshotSub, diff --git a/src/gateways/device-gateway.ts b/src/gateways/device-gateway.ts index bd99951..4c044c2 100644 --- a/src/gateways/device-gateway.ts +++ b/src/gateways/device-gateway.ts @@ -278,7 +278,7 @@ export const DeviceGateway = { return request(baseUrl, auth, 'POST', `${sessionPath(id)}/request-human`, { reason }); }, - /** One typed action: tap, type, swipe or press_key. Synchronous: answers with the outcome. */ + /** One typed action: tap, type, swipe, press_key, open_link or set_location. Synchronous: answers with the outcome. */ action( baseUrl: string, auth: AuthContext, diff --git a/src/services/telemetry.service.ts b/src/services/telemetry.service.ts index 8bb51ea..2726533 100644 --- a/src/services/telemetry.service.ts +++ b/src/services/telemetry.service.ts @@ -345,22 +345,55 @@ const SENSITIVE_FLAG_NAMES = new Set([ '--env', ]); -function scrubArgv(args: string[]): string[] { +const REDACTED = ''; + +/** + * The argv a command was run with, as telemetry may keep it: without the + * values of the flags above, and without what two `dcd device` subcommands + * are given that no flag name marks as a secret. + * + * - `device open-link` takes its link as a positional. A sign-in link is a + * credential, and `--sensitive` promises it is never shown, so everything + * after `open-link` that is not a flag is taken for the link, and the value + * of any flag but the API URL goes too. That costs the session id, and + * keeps a link too malformed to send from being kept either. + * - `device type` takes `--text`, which is a password or a code as often as + * not. `device tap` has a `--text` as well, an element's label, and keeps it. + * + * The subcommand is found by its name anywhere after `device`, not as the + * first positional: a flag's value in between must not hide it. + */ +export function scrubArgv(args: string[]): string[] { + const device = args.indexOf('device'); + const subcommand = (name: string) => (device === -1 ? -1 : args.indexOf(name, device + 1)); + const openLink = subcommand('open-link'); + const type = subcommand('type'); + const keeps = (flag: string) => API_URL_FLAGS.includes(flag); + const scrubbed: string[] = []; for (let i = 0; i < args.length; i++) { const arg = args[i]; + const isFlag = arg.startsWith('-'); const eqIndex = arg.indexOf('='); const flagName = eqIndex === -1 ? arg : arg.slice(0, eqIndex); - if (arg.startsWith('-') && SENSITIVE_FLAG_NAMES.has(flagName)) { + const afterOpenLink = openLink !== -1 && i > openLink; + const secretFlag = + SENSITIVE_FLAG_NAMES.has(flagName) || + (type !== -1 && i > type && flagName === '--text') || + // `--anything=value` after open-link: no flag of the command needs its value kept. + (afterOpenLink && eqIndex !== -1 && !keeps(flagName)); + if (isFlag && secretFlag) { if (eqIndex === -1) { scrubbed.push(arg); if (i + 1 < args.length) { - scrubbed.push(''); + scrubbed.push(REDACTED); i++; } } else { - scrubbed.push(`${flagName}=`); + scrubbed.push(`${flagName}=${REDACTED}`); } + } else if (afterOpenLink && !isFlag) { + scrubbed.push(keeps(args[i - 1]) ? arg : REDACTED); } else { scrubbed.push(arg); } diff --git a/src/types/domain/device-session.types.ts b/src/types/domain/device-session.types.ts index 774b978..8f65875 100644 --- a/src/types/domain/device-session.types.ts +++ b/src/types/domain/device-session.types.ts @@ -130,7 +130,16 @@ export interface DevicePoint { * no longer sends it. */ export type DeviceActionRequest = - | { id?: string; mode?: 'maestro'; text?: string; type: 'tap'; x?: number; y?: number } + | { + id?: string; + mode?: 'maestro'; + text?: string; + /** With `text` or `id`: seconds to wait for it to appear (0 to 60; 0 looks once). */ + timeoutSeconds?: number; + type: 'tap'; + x?: number; + y?: number; + } | { key: string; mode?: 'maestro'; type: 'press_key' } | { mode?: 'maestro'; sensitive?: boolean; text: string; type: 'type' } | { @@ -139,7 +148,9 @@ export type DeviceActionRequest = mode?: 'maestro'; to?: DevicePoint; type: 'swipe'; - }; + } + | { sensitive?: boolean; type: 'open_link'; url: string } + | { latitude: number; longitude: number; type: 'set_location' }; /** The keys press_key takes, as the API names them. */ export const DEVICE_KEYS = [ diff --git a/test/unit/device-command.test.ts b/test/unit/device-command.test.ts index cf2529c..6287add 100644 --- a/test/unit/device-command.test.ts +++ b/test/unit/device-command.test.ts @@ -151,6 +151,36 @@ async function runText(name: string, args: Record): Promise` through citty's own parser with --json, capturing + * the envelope and the exit code: for what the parser does to a value before + * a subcommand sees it. + */ +async function runArgv(rawArgs: string[]): Promise<{ exit: number; out: Record }> { + let out = ''; + const write = process.stdout.write.bind(process.stdout); + const exit = process.exit; + process.stdout.write = ((chunk: string) => { + out += chunk; + return true; + }) as typeof process.stdout.write; + process.exit = ((code?: number) => { + throw new ExitError(code ?? 0); + }) as typeof process.exit; + let code = 0; + try { + await runCommand(deviceCommand, { rawArgs: [...rawArgs, '--json', '--api-url', API, '--api-key', 'k'] }); + } catch (error) { + if (!(error instanceof ExitError)) throw error; + code = error.code; + } finally { + process.stdout.write = write; + process.exit = exit; + } + + return { exit: code, out: JSON.parse(out) as Record }; +} + describe('dcd device', () => { const realFetch = globalThis.fetch; const ORIGINAL_ENV = { ...process.env }; @@ -384,6 +414,117 @@ describe('dcd device', () => { expect(exit).to.equal(DEVICE_EXIT.usage); }); + it('tap --timeout rides on a tap by text or id, in seconds', async () => { + const calls = stubFetch(ok); + await runJson('tap', { id: 'a-b-c', rid: 'login_button', timeout: '2.5' }); + await runJson('tap', { id: 'a-b-c', text: 'Log in', timeout: '0' }); + expect(calls.map((c) => c.body)).to.deep.equal([ + { type: 'tap', id: 'login_button', timeoutSeconds: 2.5 }, + // 0 is a wait of its own: look once. + { type: 'tap', text: 'Log in', timeoutSeconds: 0 }, + ]); + }); + + it('tap --timeout is refused with a point, out of range or not a number, without calling the API', async () => { + const calls = stubFetch(ok); + for (const args of [ + { id: 'a-b-c', x: '50', y: '50', timeout: '2' }, + { id: 'a-b-c', text: 'x', timeout: '61' }, + { id: 'a-b-c', text: 'x', timeout: '-1' }, + { id: 'a-b-c', text: 'x', timeout: 'soon' }, + { id: 'a-b-c', text: 'x', timeout: '' }, + ]) { + const { exit, out } = await runJson('tap', args); + expect(exit, JSON.stringify(args)).to.equal(DEVICE_EXIT.usage); + expect(out.ok).to.equal(false); + } + expect(calls).to.have.length(0); + }); + + it('open-link takes the link as its only positional when the session is implied', async () => { + const calls = stubFetch((call) => + call.url.endsWith('/device/sessions') ? { body: { sessions: [session('a-b-c')] } } : ok(), + ); + await runJson('open-link', { id: 'myapp://sign-in?user=a' }); + await runJson('open-link', { id: 'a-b-c', url: 'https://example.com/page?a=1&b=2' }); + await runJson('open-link', { id: 'a-b-c', url: 'myapp://sign-in?token=abc', sensitive: true }); + const posts = calls.filter((c) => c.method === 'POST'); + expect(posts.map((c) => [c.url, c.body])).to.deep.equal([ + [`${API}/device/sessions/a-b-c/actions`, { type: 'open_link', url: 'myapp://sign-in?user=a' }], + [`${API}/device/sessions/a-b-c/actions`, { type: 'open_link', url: 'https://example.com/page?a=1&b=2' }], + [ + `${API}/device/sessions/a-b-c/actions`, + { type: 'open_link', url: 'myapp://sign-in?token=abc', sensitive: true }, + ], + ]); + }); + + it('open-link refuses no link, no scheme and a space, without calling the API', async () => { + const calls = stubFetch(ok); + for (const args of [ + { id: 'a-b-c' }, + { id: 'a-b-c', url: 'example.com/page' }, + { id: 'a-b-c', url: 'myapp://a b' }, + { id: 'a-b-c', url: ':nothing' }, + ]) { + const { exit, out } = await runJson('open-link', args); + expect(exit, JSON.stringify(args)).to.equal(DEVICE_EXIT.usage); + expect(out.ok).to.equal(false); + } + expect(calls).to.have.length(0); + }); + + it('open-link --sensitive does not print the link', async () => { + stubFetch(ok); + const shown = await runText('open-link', { id: 'a-b-c', url: 'myapp://sign-in?user=a' }); + expect(shown).to.contain('myapp://sign-in?user=a'); + const hidden = await runText('open-link', { + id: 'a-b-c', + url: 'myapp://sign-in?token=hunter2', + sensitive: true, + }); + expect(hidden).to.contain('Opened a link'); + expect(hidden).to.not.contain('hunter2'); + }); + + it('set-location sends decimal degrees, south and west as negative numbers', async () => { + const calls = stubFetch((call) => + call.url.endsWith('/device/sessions') ? { body: { sessions: [session('a-b-c')] } } : ok(), + ); + await runJson('set-location', { id: 'a-b-c', latitude: '51.5074', longitude: '-0.1278' }); + // Through citty's own parser too: a value that starts with `-` must arrive as the number it is. + const south = await runArgv(['set-location', 'a-b-c', '--latitude', '-33.86882', '--longitude', '151.2093']); + expect(south.exit).to.equal(0); + const west = await runArgv(['set-location', '--latitude=40.7128', '--longitude', '-74.006']); + expect(west.exit).to.equal(0); + const nearZero = await runArgv(['set-location', '--latitude', '-0.5', '--longitude', '-0.1278']); + expect(nearZero.exit).to.equal(0); + const posts = calls.filter((c) => c.method === 'POST'); + expect(posts.map((c) => [c.url, c.body])).to.deep.equal([ + [`${API}/device/sessions/a-b-c/actions`, { type: 'set_location', latitude: 51.5074, longitude: -0.1278 }], + [`${API}/device/sessions/a-b-c/actions`, { type: 'set_location', latitude: -33.86882, longitude: 151.2093 }], + [`${API}/device/sessions/a-b-c/actions`, { type: 'set_location', latitude: 40.7128, longitude: -74.006 }], + [`${API}/device/sessions/a-b-c/actions`, { type: 'set_location', latitude: -0.5, longitude: -0.1278 }], + ]); + }); + + it('set-location refuses a missing, out-of-range or non-numeric coordinate, without calling the API', async () => { + const calls = stubFetch(ok); + for (const args of [ + { id: 'a-b-c' }, + { id: 'a-b-c', latitude: '51.5' }, + { id: 'a-b-c', latitude: '90.1', longitude: '0' }, + { id: 'a-b-c', latitude: '0', longitude: '-180.5' }, + { id: 'a-b-c', latitude: 'north', longitude: '0' }, + { id: 'a-b-c', latitude: '', longitude: '0' }, + ]) { + const { exit, out } = await runJson('set-location', args); + expect(exit, JSON.stringify(args)).to.equal(DEVICE_EXIT.usage); + expect(out.ok).to.equal(false); + } + expect(calls).to.have.length(0); + }); + it('exits 2 with the result when the device could not do the action', async () => { stubFetch(() => ({ body: { result: { success: false, error: 'Element not found: "Nope"' }, session: session('a-b-c') }, diff --git a/test/unit/telemetry-scrub-argv.test.ts b/test/unit/telemetry-scrub-argv.test.ts new file mode 100644 index 0000000..972987b --- /dev/null +++ b/test/unit/telemetry-scrub-argv.test.ts @@ -0,0 +1,121 @@ +import { expect } from 'chai'; + +import { scrubArgv } from '../../src/services/telemetry.service.js'; + +/** + * Telemetry keeps the argv of every command. What a caller gives a command + * as a secret must not be in it: the link of `device open-link`, which is a + * positional and so has no flag name to go by, and the text of `device type`. + */ +describe('telemetry: scrubArgv', () => { + const R = ''; + + it('redacts the link of device open-link, with or without --sensitive, wherever it sits', () => { + expect(scrubArgv(['device', 'open-link', 'myapp://sign-in?token=SECRET', '--sensitive'])).to.deep.equal([ + 'device', + 'open-link', + R, + '--sensitive', + ]); + expect(scrubArgv(['device', 'open-link', '--sensitive', '--json', 'myapp://sign-in?token=SECRET'])).to.deep.equal([ + 'device', + 'open-link', + '--sensitive', + '--json', + R, + ]); + // No flag: the link is the caller's all the same, and may carry a token they did not think to mark. + expect(scrubArgv(['device', 'open-link', 'https://example.com/reset?token=SECRET'])).to.deep.equal([ + 'device', + 'open-link', + R, + ]); + }); + + it('redacts a link too malformed to send, and the session id with it', () => { + expect(scrubArgv(['device', 'open-link', 'brave-teal-otter', 'example.com/reset?token=SECRET'])).to.deep.equal([ + 'device', + 'open-link', + R, + R, + ]); + }); + + it('finds open-link behind a flag and its value, and keeps only the API URL of what follows', () => { + const scrubbed = scrubArgv([ + '--api-url', + 'https://dev-api.devicecloud.dev', + 'device', + '--api-key', + 'dcd_SECRETKEY', + 'open-link', + 'myapp://x?token=SECRET', + '--api-url', + 'https://dev-api.devicecloud.dev', + '--url=myapp://y?token=SECRET', + '--other', + 'myapp://z?token=SECRET', + ]); + expect(scrubbed).to.deep.equal([ + '--api-url', + 'https://dev-api.devicecloud.dev', + 'device', + '--api-key', + R, + 'open-link', + R, + '--api-url', + 'https://dev-api.devicecloud.dev', + `--url=${R}`, + '--other', + R, + ]); + expect(JSON.stringify(scrubbed)).to.not.contain('SECRET'); + }); + + it('redacts the text of device type, in both spellings, and keeps the label of a tap', () => { + expect(scrubArgv(['device', 'type', '--text', 'hunter2', '--sensitive'])).to.deep.equal([ + 'device', + 'type', + '--text', + R, + '--sensitive', + ]); + expect(scrubArgv(['device', 'type', 'brave-teal-otter', '--text=hunter2'])).to.deep.equal([ + 'device', + 'type', + 'brave-teal-otter', + `--text=${R}`, + ]); + expect(scrubArgv(['device', 'tap', '--text', 'Log in', '--timeout', '2'])).to.deep.equal([ + 'device', + 'tap', + '--text', + 'Log in', + '--timeout', + '2', + ]); + }); + + it('still redacts the flags it always did, and leaves other commands alone', () => { + expect(scrubArgv(['cloud', '--api-key', 'dcd_SECRETKEY', '-e', 'PASSWORD=hunter2', '--env=TOKEN=abc', 'flows/'])).to.deep.equal([ + 'cloud', + '--api-key', + R, + '-e', + R, + `--env=${R}`, + 'flows/', + ]); + expect(scrubArgv(['device', 'set-location', '--latitude', '51.5074', '--longitude', '-0.1278'])).to.deep.equal([ + 'device', + 'set-location', + '--latitude', + '51.5074', + '--longitude', + '-0.1278', + ]); + // A link is only a link after `device open-link`. + expect(scrubArgv(['upload', 'open-link', 'app.apk'])).to.deep.equal(['upload', 'open-link', 'app.apk']); + }); +}); From c47e0c32ab840328697f807936b3f40ab6d274e5 Mon Sep 17 00:00:00 2001 From: "dcd-release-please[bot]" <296541543+dcd-release-please[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 12:04:54 +0000 Subject: [PATCH 9/9] chore: release 5.14.0 --- CHANGELOG.md | 24 ++++++++++++++++++++++++ package.json | 2 +- server.json | 4 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a454e6f..eb6df5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## [5.14.0](https://github.com/devicecloud-dev/dcd-cli/compare/v5.13.0...v5.14.0) (2026-11-17) + + +### Features + +* dcd settings command and dcd_get_team_settings MCP tool ([#325](https://github.com/devicecloud-dev/dcd-cli/issues/325)) ([61f4e91](https://github.com/devicecloud-dev/dcd-cli/commit/61f4e91e105afa7790495bc2cf7dc956adda3699)) +* open link command, device location and timeout options ([#327](https://github.com/devicecloud-dev/dcd-cli/issues/327)) ([7a20e48](https://github.com/devicecloud-dev/dcd-cli/commit/7a20e48611bd7caec1089d0d277279f8f8192cbc)) + + +### Bug Fixes + +* explain and stop retrying when an API key's access doesn't cover a call ([#326](https://github.com/devicecloud-dev/dcd-cli/issues/326)) ([b5d8305](https://github.com/devicecloud-dev/dcd-cli/commit/b5d83059936d007f62a8a0ad46e353c5665e8bcf)) +* **artifacts:** record why a bundle download falls back to the inline endpoint ([#324](https://github.com/devicecloud-dev/dcd-cli/issues/324)) ([e539bd7](https://github.com/devicecloud-dev/dcd-cli/commit/e539bd77cef42c132b50947f0eb6a5d13aff1ebc)) + + +### Dependencies + +* bump the minor-and-patch group with 5 updates ([#322](https://github.com/devicecloud-dev/dcd-cli/issues/322)) ([4811f20](https://github.com/devicecloud-dev/dcd-cli/commit/4811f203e85d24d8e5ee159db7184b633233ff1e)) + + +### Code Refactoring + +* **auth:** refresh `dcd login` sessions through the API, not Supabase ([#313](https://github.com/devicecloud-dev/dcd-cli/issues/313)) ([ec778b2](https://github.com/devicecloud-dev/dcd-cli/commit/ec778b2de43b724ff5e8c323c67700ebfeea9cf1)) + ## [5.13.0](https://github.com/devicecloud-dev/dcd-cli/compare/v5.12.1...v5.13.0) (2026-11-13) diff --git a/package.json b/package.json index 515da0b..a652866 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "test:unit": "node scripts/test-runner.mjs --unit", "typecheck": "tsc --noEmit -p tsconfig.test.json" }, - "version": "5.13.0", + "version": "5.14.0", "bugs": { "url": "https://discord.gg/gm3mJwcNw8" }, diff --git a/server.json b/server.json index d713cc5..620b6f2 100644 --- a/server.json +++ b/server.json @@ -2,7 +2,7 @@ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", "name": "dev.devicecloud/dcd", "description": "Run Maestro mobile app tests on devicecloud.dev: submit flows, check status, download artifacts.", - "version": "5.13.0", + "version": "5.14.0", "repository": { "url": "https://github.com/devicecloud-dev/dcd-cli", "source": "github" @@ -11,7 +11,7 @@ { "registryType": "npm", "identifier": "@devicecloud.dev/dcd", - "version": "5.13.0", + "version": "5.14.0", "runtimeHint": "npx", "runtimeArguments": [ {