@kerfjs/ui 5.0.0-beta.125 → 5.0.0-beta.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/ai/application-ui-diagnostic-ids-v1.json +1 -0
- package/ai/component-catalog.json +77 -6
- package/ai/component-catalog.schema.json +14 -1
- package/ai/component-composition.json +27 -6
- package/ai/component-props.json +265 -40
- package/ai/components/combobox.md +1 -1
- package/ai/components/surface-scaffold.md +19 -5
- package/ai/components/tab-bar.md +2 -0
- package/ai/components/toolbar.md +1 -0
- package/ai/public-api-signatures-v1.md +251 -298
- package/ai/skill.md +10 -4
- package/ai/view-document.schema.json +55 -2
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/analyzer/cli.mjs +60 -24
- package/analyzer/index.mjs +331 -58
- package/catalog-projection-cli.mjs +86 -50
- package/dist/anchored-surface.js +2 -1
- package/dist/browser/editor.js +12 -7
- package/dist/catalog-resources.d.ts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.js +6 -6
- package/dist/{chunk-VX3YF2UD.js → chunk-3K5V3ZSD.js} +3 -3
- package/dist/{chunk-VX3YF2UD.js.map → chunk-3K5V3ZSD.js.map} +1 -1
- package/dist/{chunk-NHQOX7T4.js → chunk-3ZKUXWAV.js} +4 -4
- package/dist/chunk-3ZKUXWAV.js.map +1 -0
- package/dist/{chunk-ADMWT7FX.js → chunk-3ZWYGGEC.js} +136 -8
- package/dist/chunk-3ZWYGGEC.js.map +1 -0
- package/dist/{chunk-KLR3DCHH.js → chunk-4L5ZIKDZ.js} +1 -1
- package/dist/chunk-4L5ZIKDZ.js.map +1 -0
- package/dist/{chunk-2E7S5C4D.js → chunk-4UWLHKNU.js} +5 -5
- package/dist/chunk-4UWLHKNU.js.map +1 -0
- package/dist/{chunk-EXGDKG7B.js → chunk-5A2DN3LR.js} +5 -5
- package/dist/chunk-5A2DN3LR.js.map +1 -0
- package/dist/{chunk-DJ65XFVN.js → chunk-63TJH2RF.js} +4 -4
- package/dist/chunk-63TJH2RF.js.map +1 -0
- package/dist/{chunk-Q2CLQ3IJ.js → chunk-6PHG2DMG.js} +1 -1
- package/dist/chunk-6PHG2DMG.js.map +1 -0
- package/dist/{chunk-SPI6VMIY.js → chunk-6T7AX365.js} +4 -4
- package/dist/chunk-6T7AX365.js.map +1 -0
- package/dist/{chunk-GVII4JSD.js → chunk-6V6UHPJD.js} +4 -4
- package/dist/chunk-6V6UHPJD.js.map +1 -0
- package/dist/{chunk-NR3ZO4LK.js → chunk-7U65KLDL.js} +1 -1
- package/dist/chunk-7U65KLDL.js.map +1 -0
- package/dist/chunk-BMOZSNDU.js +133 -0
- package/dist/chunk-BMOZSNDU.js.map +1 -0
- package/dist/{chunk-2LM3PYHA.js → chunk-C2TY5DJC.js} +11 -8
- package/dist/chunk-C2TY5DJC.js.map +1 -0
- package/dist/{chunk-3WYREXW4.js → chunk-COMEWURO.js} +8 -6
- package/dist/chunk-COMEWURO.js.map +1 -0
- package/dist/{chunk-VPDSPD76.js → chunk-DB64I3DB.js} +4 -3
- package/dist/chunk-DB64I3DB.js.map +1 -0
- package/dist/{chunk-SBCXWGNP.js → chunk-DBCDYBZP.js} +2 -2
- package/dist/{chunk-SBCXWGNP.js.map → chunk-DBCDYBZP.js.map} +1 -1
- package/dist/{chunk-CNM6ZWP2.js → chunk-DJWBXEF4.js} +4 -2
- package/dist/chunk-DJWBXEF4.js.map +1 -0
- package/dist/{chunk-SVUJIVMR.js → chunk-E2MTHHLS.js} +3 -3
- package/dist/{chunk-SVUJIVMR.js.map → chunk-E2MTHHLS.js.map} +1 -1
- package/dist/{chunk-JG4ONAOI.js → chunk-EI55KWHP.js} +2 -2
- package/dist/chunk-EI55KWHP.js.map +1 -0
- package/dist/{chunk-MVKHSAKE.js → chunk-GE2BQXB3.js} +41 -4
- package/dist/chunk-GE2BQXB3.js.map +1 -0
- package/dist/chunk-GHV36C6I.js +94 -0
- package/dist/chunk-GHV36C6I.js.map +1 -0
- package/dist/{chunk-BCO673YW.js → chunk-GQUDCWOD.js} +10 -4
- package/dist/chunk-GQUDCWOD.js.map +1 -0
- package/dist/chunk-HD7ZLISK.js +808 -0
- package/dist/chunk-HD7ZLISK.js.map +1 -0
- package/dist/{chunk-KELWWCMX.js → chunk-I2K4OQKB.js} +4 -4
- package/dist/chunk-I2K4OQKB.js.map +1 -0
- package/dist/chunk-IFDTSVE6.js +9 -0
- package/dist/chunk-IFDTSVE6.js.map +1 -0
- package/dist/{chunk-TPLVC5BE.js → chunk-IR32NI2O.js} +336 -247
- package/dist/chunk-IR32NI2O.js.map +1 -0
- package/dist/{chunk-ZKKO4MHC.js → chunk-JYKP7TBZ.js} +4 -2
- package/dist/chunk-JYKP7TBZ.js.map +1 -0
- package/dist/{chunk-6OT7FOSA.js → chunk-K3C35KGR.js} +4 -4
- package/dist/chunk-K3C35KGR.js.map +1 -0
- package/dist/{chunk-4RECPEHI.js → chunk-KBS3GP6S.js} +4 -3
- package/dist/chunk-KBS3GP6S.js.map +1 -0
- package/dist/{chunk-YHRJNKD5.js → chunk-KS7EXW4P.js} +6 -4
- package/dist/chunk-KS7EXW4P.js.map +1 -0
- package/dist/{chunk-V6N3YLTM.js → chunk-LTOTL5AS.js} +3 -3
- package/dist/chunk-LTOTL5AS.js.map +1 -0
- package/dist/chunk-M64TAGZY.js +590 -0
- package/dist/chunk-M64TAGZY.js.map +1 -0
- package/dist/{chunk-JZZVWTUB.js → chunk-MMOQR426.js} +2 -2
- package/dist/chunk-MMOQR426.js.map +1 -0
- package/dist/{chunk-SJBMKA4X.js → chunk-OHT2AXER.js} +11 -10
- package/dist/chunk-OHT2AXER.js.map +1 -0
- package/dist/{chunk-TTFW6E6C.js → chunk-OZKBIPXU.js} +2 -2
- package/dist/chunk-OZKBIPXU.js.map +1 -0
- package/dist/{chunk-Q2SLOMN6.js → chunk-RHMY45DK.js} +4 -4
- package/dist/chunk-RHMY45DK.js.map +1 -0
- package/dist/{chunk-BZXA5SSA.js → chunk-S7QB5KMM.js} +2 -2
- package/dist/{chunk-BZXA5SSA.js.map → chunk-S7QB5KMM.js.map} +1 -1
- package/dist/{chunk-HDXUHLTQ.js → chunk-SHECA2N4.js} +8 -2
- package/dist/chunk-SHECA2N4.js.map +1 -0
- package/dist/{chunk-R6FIXYAE.js → chunk-SJEPM5ZU.js} +2 -2
- package/dist/{chunk-R6FIXYAE.js.map → chunk-SJEPM5ZU.js.map} +1 -1
- package/dist/{chunk-FJMABKKV.js → chunk-UQ4FRQ6M.js} +35 -17
- package/dist/chunk-UQ4FRQ6M.js.map +1 -0
- package/dist/{chunk-S4ZGTDSG.js → chunk-UU37OR3D.js} +2 -2
- package/dist/chunk-UU37OR3D.js.map +1 -0
- package/dist/{chunk-SWXWLSUD.js → chunk-WEQNPYVA.js} +1 -1
- package/dist/{chunk-SWXWLSUD.js.map → chunk-WEQNPYVA.js.map} +1 -1
- package/dist/{chunk-5SFHBYEY.js → chunk-WUVHP3UC.js} +97 -24
- package/dist/chunk-WUVHP3UC.js.map +1 -0
- package/dist/{chunk-3S3WXAZ5.js → chunk-X43QQWVC.js} +3 -2
- package/dist/chunk-X43QQWVC.js.map +1 -0
- package/dist/{chunk-Z3T24FX3.js → chunk-YE6KCAIN.js} +3 -2
- package/dist/chunk-YE6KCAIN.js.map +1 -0
- package/dist/{chunk-KQZIC5CA.js → chunk-ZC4KSRAF.js} +7 -7
- package/dist/chunk-ZC4KSRAF.js.map +1 -0
- package/dist/collapsible-panel.d.ts +2 -2
- package/dist/collapsible-panel.js +2 -2
- package/dist/collapsible-panel.js.map +1 -1
- package/dist/column-explorer.d.ts +3 -3
- package/dist/column-explorer.js +16 -138
- package/dist/column-explorer.js.map +1 -1
- package/dist/dialog-surface-controller-BeKZ3e8Z.d.ts +251 -0
- package/dist/editor-frame.d.ts +1 -1
- package/dist/editor-frame.js +1 -1
- package/dist/editor.d.ts +38 -20
- package/dist/editor.js +11651 -7052
- package/dist/editor.js.map +1 -1
- package/dist/file-picker.js +1 -1
- package/dist/help-tags-register.js +2 -1
- package/dist/help-tags-register.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +24 -23
- package/dist/list-action-row.d.ts +1 -1
- package/dist/list-action-row.js +1 -1
- package/dist/list-detail-dialog.d.ts +7 -7
- package/dist/list-detail-dialog.js +6 -5
- package/dist/list-detail-dialog.js.map +1 -1
- package/dist/list-header.d.ts +1 -1
- package/dist/list-header.js +1 -1
- package/dist/list-item.d.ts +1 -1
- package/dist/list-item.js +1 -1
- package/dist/message-composer.js +1 -1
- package/dist/nav-stack.d.ts +6 -6
- package/dist/nav-stack.js +1 -1
- package/dist/popup-menu-register.js +1 -7
- package/dist/popup-menu-register.js.map +1 -1
- package/dist/popup-menu.d.ts +2 -2
- package/dist/popup-menu.js +1 -1
- package/dist/resizable-region.js +1 -1
- package/dist/segmented-control.d.ts +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/select-register.js +17 -23
- package/dist/select-register.js.map +1 -1
- package/dist/split-view.d.ts +6 -6
- package/dist/split-view.js +1 -1
- package/dist/styles/collapsible-panel.css +34 -25
- package/dist/styles/components/actions/popup-menu/popup-menu.css +4 -4
- package/dist/styles/components/actions/toolbar/toolbar.css +34 -1
- package/dist/styles/components/actions/toolbar-control-group/toolbar-control-group.css +1 -1
- package/dist/styles/components/forms/segmented-control/segmented-control.css +1 -1
- package/dist/styles/components/layout/collapsible-panel/collapsible-panel.css +34 -25
- package/dist/styles/components/layout/split-view/split-view.css +19 -33
- package/dist/styles/components/navigation/nav-stack/nav-stack.css +15 -19
- package/dist/styles/components/navigation/tab-navigator/tab-navigator.css +30 -29
- package/dist/styles/components/surfaces/editor-frame/editor-frame.css +10 -3
- package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +291 -4
- package/dist/styles/editor/editor.css +78 -0
- package/dist/styles/editor-frame.css +10 -3
- package/dist/styles/nav-stack.css +15 -19
- package/dist/styles/popup-menu.css +4 -4
- package/dist/styles/segmented-control.css +1 -1
- package/dist/styles/split-view.css +19 -33
- package/dist/styles/surface-scaffold.css +291 -4
- package/dist/styles/tab-navigator.css +30 -29
- package/dist/styles/toolbar-control-group.css +1 -1
- package/dist/styles/toolbar.css +34 -1
- package/dist/styles/webawesome.css +4 -5
- package/dist/surface-scaffold-register.js +2 -1
- package/dist/surface-scaffold-register.js.map +1 -1
- package/dist/surface-scaffold.d.ts +155 -246
- package/dist/surface-scaffold.js +3 -2
- package/dist/toolbar-control-group.d.ts +2 -2
- package/dist/toolbar-control-group.js +1 -1
- package/dist/toolbar.d.ts +6 -1
- package/dist/toolbar.js +1 -1
- package/dist/tree-list.d.ts +4 -4
- package/dist/tree-list.js +2 -2
- package/dist/{tree-rows-eHnnGLGM.d.ts → tree-rows-Bms5QJvG.d.ts} +3 -0
- package/dist/wire-catalog.d.ts +1 -1
- package/dist/wire-catalog.js +3 -2
- package/dist/wire-catalog.js.map +1 -1
- package/dist/wire-checkboxes.js +2 -1
- package/dist/wire-choice-chips.js +2 -1
- package/dist/wire-color-fields.js +2 -1
- package/dist/wire-color-pickers.js +2 -1
- package/dist/wire-column-explorer.js +1 -92
- package/dist/wire-column-explorer.js.map +1 -1
- package/dist/wire-comboboxes.d.ts +2 -0
- package/dist/wire-comboboxes.js +2 -1
- package/dist/wire-content-items.js +2 -1
- package/dist/wire-corner-status.js +2 -1
- package/dist/wire-nav-stack.js +2 -1
- package/dist/wire-overlay-sheets.js +2 -1
- package/dist/wire-paged-views.js +2 -2
- package/dist/wire-paged-views.js.map +1 -1
- package/dist/wire-resizable-regions.js +2 -1
- package/dist/wire-scroll-dividers.js +1 -1
- package/dist/wire-search-fields.js +2 -1
- package/dist/wire-sidebar.js +2 -1
- package/dist/wire-tab-bars.d.ts +41 -2
- package/dist/wire-tab-bars.js +1 -1
- package/dist/wire-tab-navigator.js +2 -1
- package/dist/wire-tag-fields.js +2 -1
- package/dist/wire-workbench.js +2 -1
- package/dist/workbench-dialog.d.ts +7 -7
- package/dist/workbench-dialog.js +5 -4
- package/dist/workbench-dialog.js.map +1 -1
- package/dist/workbench.d.ts +1 -1
- package/dist/workbench.js +1 -1
- package/docs/accessibility.md +3 -6
- package/docs/component-contract.md +47 -7
- package/docs/component-selection.md +90 -80
- package/docs/design/templates.md +5 -4
- package/docs/editor-frame.md +1 -1
- package/docs/editor-host.md +15 -2
- package/docs/overlay-tooltip.md +1 -1
- package/docs/recipes.md +1 -1
- package/docs/surface-scaffold.md +63 -2
- package/docs/ui-analyzer.md +42 -0
- package/docs/ui-doctor.md +45 -1
- package/docs/ui-evaluator.md +35 -0
- package/docs/ux-demo.md +1 -1
- package/docs/view.md +314 -0
- package/docs/webawesome-theme.md +16 -0
- package/doctor/cli.mjs +36 -31
- package/doctor/index.mjs +349 -162
- package/evaluator/cli.mjs +36 -30
- package/llms.txt +17 -4
- package/package.json +6 -2
- package/props/cli.mjs +47 -21
- package/scripts/lib/cli-args.mjs +98 -0
- package/ux-demo/recipes/app-shell.tsx +48 -141
- package/ux-demo/recipes/collapsible-sidebar.tsx +43 -169
- package/ux-demo/recipes/compact-toolbar.tsx +22 -114
- package/ux-demo/recipes/composer-form.tsx +14 -104
- package/ux-demo/recipes/list-detail-dialog.tsx +38 -84
- package/ux-demo/recipes/list-workspace-states.tsx +29 -152
- package/ux-demo/recipes/loading-inspector.tsx +30 -174
- package/ux-demo/recipes/media-detail.tsx +29 -146
- package/ux-demo/recipes/navigation-sidebar.tsx +24 -113
- package/ux-demo/recipes/navigation-stack.tsx +7 -43
- package/ux-demo/recipes/workspace-header.tsx +2 -66
- package/view/catalog.mjs +229 -0
- package/view/child-kind.mjs +22 -0
- package/view/cli.mjs +142 -119
- package/view/contract.mjs +84 -11
- package/view/css-grammar.mjs +93 -0
- package/view/generate.d.mts +16 -0
- package/view/generate.mjs +155 -56
- package/view/index.d.mts +80 -14
- package/view/index.mjs +5 -9
- package/view/interpret.mjs +104 -36
- package/view/types.mjs +161 -0
- package/view/validate-move.mjs +66 -30
- package/view/validate.mjs +420 -654
- package/vite-editor.d.mts +16 -1
- package/vite-editor.mjs +74 -4
- package/dist/chunk-2E7S5C4D.js.map +0 -1
- package/dist/chunk-2LM3PYHA.js.map +0 -1
- package/dist/chunk-3S3WXAZ5.js.map +0 -1
- package/dist/chunk-3WYREXW4.js.map +0 -1
- package/dist/chunk-4RECPEHI.js.map +0 -1
- package/dist/chunk-5SFHBYEY.js.map +0 -1
- package/dist/chunk-6OT7FOSA.js.map +0 -1
- package/dist/chunk-ADMWT7FX.js.map +0 -1
- package/dist/chunk-BCO673YW.js.map +0 -1
- package/dist/chunk-CNM6ZWP2.js.map +0 -1
- package/dist/chunk-DJ65XFVN.js.map +0 -1
- package/dist/chunk-EXGDKG7B.js.map +0 -1
- package/dist/chunk-FJMABKKV.js.map +0 -1
- package/dist/chunk-GVII4JSD.js.map +0 -1
- package/dist/chunk-HDXUHLTQ.js.map +0 -1
- package/dist/chunk-JG4ONAOI.js.map +0 -1
- package/dist/chunk-JZZVWTUB.js.map +0 -1
- package/dist/chunk-KELWWCMX.js.map +0 -1
- package/dist/chunk-KLR3DCHH.js.map +0 -1
- package/dist/chunk-KQZIC5CA.js.map +0 -1
- package/dist/chunk-LD6A6PYB.js +0 -268
- package/dist/chunk-LD6A6PYB.js.map +0 -1
- package/dist/chunk-MVKHSAKE.js.map +0 -1
- package/dist/chunk-NHQOX7T4.js.map +0 -1
- package/dist/chunk-NR3ZO4LK.js.map +0 -1
- package/dist/chunk-Q2CLQ3IJ.js.map +0 -1
- package/dist/chunk-Q2SLOMN6.js.map +0 -1
- package/dist/chunk-S4ZGTDSG.js.map +0 -1
- package/dist/chunk-SJBMKA4X.js.map +0 -1
- package/dist/chunk-SPI6VMIY.js.map +0 -1
- package/dist/chunk-TPLVC5BE.js.map +0 -1
- package/dist/chunk-TTFW6E6C.js.map +0 -1
- package/dist/chunk-V6N3YLTM.js.map +0 -1
- package/dist/chunk-VNT4MXR5.js +0 -548
- package/dist/chunk-VNT4MXR5.js.map +0 -1
- package/dist/chunk-VPDSPD76.js.map +0 -1
- package/dist/chunk-YHRJNKD5.js.map +0 -1
- package/dist/chunk-Z3T24FX3.js.map +0 -1
- package/dist/chunk-ZKKO4MHC.js.map +0 -1
- package/dist/{nav-stack-DwxpXxqJ.d.ts → nav-stack-vQ3ieerq.d.ts} +3 -3
package/doctor/index.mjs
CHANGED
|
@@ -1113,20 +1113,23 @@ async function stage(name, runner, signal) {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1116
|
+
// The config file a diagnostic should name: the supplied-options marker, or the
|
|
1117
|
+
// read config's path relative to the workspace root.
|
|
1118
|
+
function configSourceLabel(root, configResult) {
|
|
1119
|
+
return configResult.path === '<options>'
|
|
1120
|
+
? '<options>'
|
|
1121
|
+
: portablePath(root, configResult.path);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
// Target phase: resolve the workspace root, the doctor config, and the package
|
|
1125
|
+
// under examination; a package the selector cannot resolve becomes a
|
|
1126
|
+
// configuration diagnostic rather than a thrown error.
|
|
1127
|
+
async function resolveDoctorTarget({
|
|
1128
|
+
requestedRoot,
|
|
1129
|
+
packageSelector,
|
|
1130
|
+
suppliedConfig,
|
|
1122
1131
|
configPath,
|
|
1123
|
-
|
|
1124
|
-
failOn,
|
|
1125
|
-
signal,
|
|
1126
|
-
browser,
|
|
1127
|
-
runners = {},
|
|
1128
|
-
eslintConfig = 'recommended-ui',
|
|
1129
|
-
} = {}) {
|
|
1132
|
+
}) {
|
|
1130
1133
|
const root = resolve(requestedRoot);
|
|
1131
1134
|
const configResult = suppliedConfig
|
|
1132
1135
|
? {
|
|
@@ -1154,6 +1157,24 @@ export async function runUiDoctor({
|
|
|
1154
1157
|
}),
|
|
1155
1158
|
);
|
|
1156
1159
|
}
|
|
1160
|
+
return { root, configResult, config, packageRoot, initialDiagnostics };
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// Selection phase: pick the mode, the fail-on level, the stage set, the
|
|
1164
|
+
// changed-mode paths, and the cache switch from the options and the config,
|
|
1165
|
+
// recording any option the run cannot honor as a configuration diagnostic.
|
|
1166
|
+
function selectDoctorRun({
|
|
1167
|
+
root,
|
|
1168
|
+
packageRoot,
|
|
1169
|
+
config,
|
|
1170
|
+
configResult,
|
|
1171
|
+
mode,
|
|
1172
|
+
failOn,
|
|
1173
|
+
browser,
|
|
1174
|
+
paths,
|
|
1175
|
+
cache,
|
|
1176
|
+
initialDiagnostics,
|
|
1177
|
+
}) {
|
|
1157
1178
|
const selectedMode = mode ?? config.mode ?? 'full';
|
|
1158
1179
|
const selectedFailOn = failOn ?? config.failOn ?? 'error';
|
|
1159
1180
|
if (failOn !== undefined && !['error', 'review', 'warning'].includes(failOn))
|
|
@@ -1174,19 +1195,25 @@ export async function runUiDoctor({
|
|
|
1174
1195
|
configDiagnostic(
|
|
1175
1196
|
'Changed mode requires at least one explicit --path. This prevents a false-clean report.',
|
|
1176
1197
|
{
|
|
1177
|
-
file:
|
|
1178
|
-
configResult.path === '<options>'
|
|
1179
|
-
? '<options>'
|
|
1180
|
-
: portablePath(root, configResult.path),
|
|
1198
|
+
file: configSourceLabel(root, configResult),
|
|
1181
1199
|
path: '$.mode',
|
|
1182
1200
|
},
|
|
1183
1201
|
),
|
|
1184
1202
|
);
|
|
1185
1203
|
const cacheEnabled = cache ?? config.cache ?? true;
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1204
|
+
return { selectedMode, selectedFailOn, stages, selectedPaths, cacheEnabled };
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
// Cache phase: the cache file and the key that identifies this run's inputs
|
|
1208
|
+
// (the browser URL is redacted so the key never stores it).
|
|
1209
|
+
async function doctorCacheIdentity({
|
|
1210
|
+
root,
|
|
1211
|
+
packageRoot,
|
|
1212
|
+
selectedMode,
|
|
1213
|
+
selectedPaths,
|
|
1214
|
+
config,
|
|
1215
|
+
selectedFailOn,
|
|
1216
|
+
}) {
|
|
1190
1217
|
const cachePath = resolve(root, '.kerf-cache/ui-doctor-v1.json');
|
|
1191
1218
|
const key = await cacheKey(root, packageRoot, selectedMode, selectedPaths, {
|
|
1192
1219
|
...config,
|
|
@@ -1195,17 +1222,140 @@ export async function runUiDoctor({
|
|
|
1195
1222
|
? { ...config.browser, url: '<redacted-url>' }
|
|
1196
1223
|
: undefined,
|
|
1197
1224
|
});
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1225
|
+
return { cachePath, key };
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
// Cache phase: a previous report for the same key, with its stages that ran
|
|
1229
|
+
// marked `cached`; `undefined` on a miss.
|
|
1230
|
+
async function cachedDoctorReport(cachePath, key) {
|
|
1231
|
+
const cached = await readCache(cachePath, key);
|
|
1232
|
+
if (!cached) return undefined;
|
|
1233
|
+
return {
|
|
1234
|
+
...cached,
|
|
1235
|
+
stages: cached.stages.map((item) =>
|
|
1236
|
+
item.status === 'ran' ? { ...item, status: 'cached' } : item,
|
|
1237
|
+
),
|
|
1238
|
+
cache: { hit: true, key },
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
// The analyzer options the doctor config supplies, shared by the injected and
|
|
1243
|
+
// the default analyzer runners.
|
|
1244
|
+
function analyzerOwnershipOptions(config) {
|
|
1245
|
+
return {
|
|
1246
|
+
ownership: config.ownership ?? 'package',
|
|
1247
|
+
ownershipContext: config.ownershipContext ?? 'subject',
|
|
1248
|
+
implicitComponentOwnership: config.implicitComponentOwnership ?? false,
|
|
1249
|
+
ownershipGroups: config.ownershipGroups ?? [],
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// Default catalog stage: the application UI profile, the local catalogs, and
|
|
1254
|
+
// the project guidance files.
|
|
1255
|
+
async function catalogStage({
|
|
1256
|
+
root,
|
|
1257
|
+
packageRoot,
|
|
1258
|
+
registeredRuleIds,
|
|
1259
|
+
eslintRuleIds,
|
|
1260
|
+
}) {
|
|
1261
|
+
const knownRules = [...registeredRuleIds, ...eslintRuleIds];
|
|
1262
|
+
const result = await loadApplicationUiProfile({
|
|
1263
|
+
workspaceRoot: root,
|
|
1264
|
+
startDirectory: packageRoot,
|
|
1265
|
+
knownRules,
|
|
1266
|
+
});
|
|
1267
|
+
const local = await validateLocalCatalogs(packageRoot);
|
|
1268
|
+
return {
|
|
1269
|
+
diagnostics: [
|
|
1270
|
+
...result.diagnostics.map((item) => normalizeProfile(item, root)),
|
|
1271
|
+
...local.diagnostics,
|
|
1272
|
+
...(await checkProjectGuidance(root, packageRoot)),
|
|
1273
|
+
],
|
|
1274
|
+
detail: local.detail,
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
// Default analyzer stage: the UI analyzer plus the component-style and
|
|
1279
|
+
// copy-capitalization checks over the package's inputs.
|
|
1280
|
+
async function analyzerStage({
|
|
1281
|
+
root,
|
|
1282
|
+
packageRoot,
|
|
1283
|
+
config,
|
|
1284
|
+
selectedPaths,
|
|
1285
|
+
registeredRuleIds,
|
|
1286
|
+
eslintRuleIds,
|
|
1287
|
+
}) {
|
|
1288
|
+
return {
|
|
1289
|
+
diagnostics: [
|
|
1290
|
+
...normalizeAnalyzer(
|
|
1291
|
+
await analyzeUiProject({
|
|
1292
|
+
root: packageRoot,
|
|
1293
|
+
workspaceRoot: root,
|
|
1294
|
+
paths: selectedPaths,
|
|
1295
|
+
...analyzerOwnershipOptions(config),
|
|
1296
|
+
knownRules: [...registeredRuleIds, ...eslintRuleIds],
|
|
1297
|
+
}),
|
|
1298
|
+
),
|
|
1299
|
+
...(await checkComponentStyles(
|
|
1300
|
+
packageRoot,
|
|
1301
|
+
await collectInputs(packageRoot),
|
|
1302
|
+
config.ownershipGroups ?? [],
|
|
1303
|
+
selectedPaths,
|
|
1304
|
+
root,
|
|
1305
|
+
)),
|
|
1306
|
+
...(await checkCopyCapitalization(
|
|
1307
|
+
packageRoot,
|
|
1308
|
+
await collectInputs(packageRoot),
|
|
1309
|
+
selectedPaths,
|
|
1310
|
+
)),
|
|
1311
|
+
],
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
// Default browser stage: evaluate the configured URL with the UI evaluator.
|
|
1316
|
+
async function browserStage({ root, packageRoot, options, signal }) {
|
|
1317
|
+
if (!options.url)
|
|
1318
|
+
throw new Error('The browser stage requires an explicit URL.');
|
|
1319
|
+
const report = await evaluateUi({
|
|
1320
|
+
url: options.url,
|
|
1321
|
+
workspaceRoot: root,
|
|
1322
|
+
startDirectory: packageRoot,
|
|
1323
|
+
browsers: options.browsers,
|
|
1324
|
+
retention: options.retention ?? 'on-failure',
|
|
1325
|
+
outputDirectory: resolve(
|
|
1326
|
+
root,
|
|
1327
|
+
options.outputDirectory ?? 'kerf-ui-evidence',
|
|
1328
|
+
),
|
|
1329
|
+
reportPath: resolve(
|
|
1330
|
+
root,
|
|
1331
|
+
options.reportPath ?? 'kerf-ui-evidence/report.json',
|
|
1332
|
+
),
|
|
1333
|
+
signal,
|
|
1334
|
+
});
|
|
1335
|
+
return { diagnostics: normalizeEvaluator(report) };
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
// Stage phase: run every enabled stage in the fixed order (catalog,
|
|
1339
|
+
// typescript, eslint, analyzer, browser), preferring an injected runner over
|
|
1340
|
+
// the default, then record each disabled stage as skipped.
|
|
1341
|
+
async function runDoctorStages(context) {
|
|
1342
|
+
const {
|
|
1343
|
+
root,
|
|
1344
|
+
packageRoot,
|
|
1345
|
+
config,
|
|
1346
|
+
stages,
|
|
1347
|
+
selectedPaths,
|
|
1348
|
+
signal,
|
|
1349
|
+
browser,
|
|
1350
|
+
runners,
|
|
1351
|
+
eslintConfig,
|
|
1352
|
+
} = context;
|
|
1353
|
+
const runnerInputs = () => ({
|
|
1354
|
+
root,
|
|
1355
|
+
packageRoot,
|
|
1356
|
+
paths: selectedPaths,
|
|
1357
|
+
signal,
|
|
1358
|
+
});
|
|
1209
1359
|
const results = [];
|
|
1210
1360
|
if (stages.catalog)
|
|
1211
1361
|
results.push(
|
|
@@ -1213,31 +1363,8 @@ export async function runUiDoctor({
|
|
|
1213
1363
|
'catalog',
|
|
1214
1364
|
async () =>
|
|
1215
1365
|
runners.catalog
|
|
1216
|
-
? runners.catalog(
|
|
1217
|
-
|
|
1218
|
-
packageRoot,
|
|
1219
|
-
paths: selectedPaths,
|
|
1220
|
-
signal,
|
|
1221
|
-
})
|
|
1222
|
-
: (async () => {
|
|
1223
|
-
const knownRules = [...registeredRuleIds, ...eslintRuleIds];
|
|
1224
|
-
const result = await loadApplicationUiProfile({
|
|
1225
|
-
workspaceRoot: root,
|
|
1226
|
-
startDirectory: packageRoot,
|
|
1227
|
-
knownRules,
|
|
1228
|
-
});
|
|
1229
|
-
const local = await validateLocalCatalogs(packageRoot);
|
|
1230
|
-
return {
|
|
1231
|
-
diagnostics: [
|
|
1232
|
-
...result.diagnostics.map((item) =>
|
|
1233
|
-
normalizeProfile(item, root),
|
|
1234
|
-
),
|
|
1235
|
-
...local.diagnostics,
|
|
1236
|
-
...(await checkProjectGuidance(root, packageRoot)),
|
|
1237
|
-
],
|
|
1238
|
-
detail: local.detail,
|
|
1239
|
-
};
|
|
1240
|
-
})(),
|
|
1366
|
+
? runners.catalog(runnerInputs())
|
|
1367
|
+
: catalogStage(context),
|
|
1241
1368
|
signal,
|
|
1242
1369
|
),
|
|
1243
1370
|
);
|
|
@@ -1245,13 +1372,7 @@ export async function runUiDoctor({
|
|
|
1245
1372
|
results.push(
|
|
1246
1373
|
await stage(
|
|
1247
1374
|
'typescript',
|
|
1248
|
-
() =>
|
|
1249
|
-
(runners.typescript ?? runTypeScript)({
|
|
1250
|
-
root,
|
|
1251
|
-
packageRoot,
|
|
1252
|
-
paths: selectedPaths,
|
|
1253
|
-
signal,
|
|
1254
|
-
}),
|
|
1375
|
+
() => (runners.typescript ?? runTypeScript)(runnerInputs()),
|
|
1255
1376
|
signal,
|
|
1256
1377
|
),
|
|
1257
1378
|
);
|
|
@@ -1260,13 +1381,7 @@ export async function runUiDoctor({
|
|
|
1260
1381
|
await stage(
|
|
1261
1382
|
'eslint',
|
|
1262
1383
|
() =>
|
|
1263
|
-
(runners.eslint ?? runEslint)({
|
|
1264
|
-
root,
|
|
1265
|
-
packageRoot,
|
|
1266
|
-
paths: selectedPaths,
|
|
1267
|
-
signal,
|
|
1268
|
-
eslintConfig,
|
|
1269
|
-
}),
|
|
1384
|
+
(runners.eslint ?? runEslint)({ ...runnerInputs(), eslintConfig }),
|
|
1270
1385
|
signal,
|
|
1271
1386
|
),
|
|
1272
1387
|
);
|
|
@@ -1277,45 +1392,10 @@ export async function runUiDoctor({
|
|
|
1277
1392
|
() =>
|
|
1278
1393
|
runners.analyzer
|
|
1279
1394
|
? runners.analyzer({
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
paths: selectedPaths,
|
|
1283
|
-
ownership: config.ownership ?? 'package',
|
|
1284
|
-
ownershipContext: config.ownershipContext ?? 'subject',
|
|
1285
|
-
implicitComponentOwnership:
|
|
1286
|
-
config.implicitComponentOwnership ?? false,
|
|
1287
|
-
ownershipGroups: config.ownershipGroups ?? [],
|
|
1288
|
-
signal,
|
|
1395
|
+
...runnerInputs(),
|
|
1396
|
+
...analyzerOwnershipOptions(config),
|
|
1289
1397
|
})
|
|
1290
|
-
: (
|
|
1291
|
-
diagnostics: [
|
|
1292
|
-
...normalizeAnalyzer(
|
|
1293
|
-
await analyzeUiProject({
|
|
1294
|
-
root: packageRoot,
|
|
1295
|
-
workspaceRoot: root,
|
|
1296
|
-
paths: selectedPaths,
|
|
1297
|
-
ownership: config.ownership ?? 'package',
|
|
1298
|
-
ownershipContext: config.ownershipContext ?? 'subject',
|
|
1299
|
-
implicitComponentOwnership:
|
|
1300
|
-
config.implicitComponentOwnership ?? false,
|
|
1301
|
-
ownershipGroups: config.ownershipGroups ?? [],
|
|
1302
|
-
knownRules: [...registeredRuleIds, ...eslintRuleIds],
|
|
1303
|
-
}),
|
|
1304
|
-
),
|
|
1305
|
-
...(await checkComponentStyles(
|
|
1306
|
-
packageRoot,
|
|
1307
|
-
await collectInputs(packageRoot),
|
|
1308
|
-
config.ownershipGroups ?? [],
|
|
1309
|
-
selectedPaths,
|
|
1310
|
-
root,
|
|
1311
|
-
)),
|
|
1312
|
-
...(await checkCopyCapitalization(
|
|
1313
|
-
packageRoot,
|
|
1314
|
-
await collectInputs(packageRoot),
|
|
1315
|
-
selectedPaths,
|
|
1316
|
-
)),
|
|
1317
|
-
],
|
|
1318
|
-
}))(),
|
|
1398
|
+
: analyzerStage(context),
|
|
1319
1399
|
signal,
|
|
1320
1400
|
),
|
|
1321
1401
|
);
|
|
@@ -1323,39 +1403,12 @@ export async function runUiDoctor({
|
|
|
1323
1403
|
results.push(
|
|
1324
1404
|
await stage(
|
|
1325
1405
|
'browser',
|
|
1326
|
-
async () =>
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
signal,
|
|
1333
|
-
browser: { ...config.browser, ...browser },
|
|
1334
|
-
})
|
|
1335
|
-
: (async () => {
|
|
1336
|
-
const options = { ...config.browser, ...browser };
|
|
1337
|
-
if (!options.url)
|
|
1338
|
-
throw new Error(
|
|
1339
|
-
'The browser stage requires an explicit URL.',
|
|
1340
|
-
);
|
|
1341
|
-
const report = await evaluateUi({
|
|
1342
|
-
url: options.url,
|
|
1343
|
-
workspaceRoot: root,
|
|
1344
|
-
startDirectory: packageRoot,
|
|
1345
|
-
browsers: options.browsers,
|
|
1346
|
-
retention: options.retention ?? 'on-failure',
|
|
1347
|
-
outputDirectory: resolve(
|
|
1348
|
-
root,
|
|
1349
|
-
options.outputDirectory ?? 'kerf-ui-evidence',
|
|
1350
|
-
),
|
|
1351
|
-
reportPath: resolve(
|
|
1352
|
-
root,
|
|
1353
|
-
options.reportPath ?? 'kerf-ui-evidence/report.json',
|
|
1354
|
-
),
|
|
1355
|
-
signal,
|
|
1356
|
-
});
|
|
1357
|
-
return { diagnostics: normalizeEvaluator(report) };
|
|
1358
|
-
})(),
|
|
1406
|
+
async () => {
|
|
1407
|
+
const options = { ...config.browser, ...browser };
|
|
1408
|
+
return runners.browser
|
|
1409
|
+
? runners.browser({ ...runnerInputs(), browser: options })
|
|
1410
|
+
: browserStage({ root, packageRoot, options, signal });
|
|
1411
|
+
},
|
|
1359
1412
|
signal,
|
|
1360
1413
|
),
|
|
1361
1414
|
);
|
|
@@ -1367,10 +1420,21 @@ export async function runUiDoctor({
|
|
|
1367
1420
|
detail: 'Disabled by configuration.',
|
|
1368
1421
|
diagnostics: [],
|
|
1369
1422
|
});
|
|
1370
|
-
|
|
1371
|
-
|
|
1423
|
+
return results;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
// Suppression phase: copy the configured suppressions and flag any rule id
|
|
1427
|
+
// that no stage emitted, no plugin registers, and no TS/ESLint pattern covers.
|
|
1428
|
+
function validateSuppressions({
|
|
1429
|
+
root,
|
|
1430
|
+
configResult,
|
|
1431
|
+
config,
|
|
1432
|
+
emitted,
|
|
1433
|
+
registeredRuleIds,
|
|
1434
|
+
eslintRuleIds,
|
|
1435
|
+
initialDiagnostics,
|
|
1436
|
+
}) {
|
|
1372
1437
|
const suppressionSource = [...(config.suppressions ?? [])];
|
|
1373
|
-
const emitted = results.flatMap((item) => item.diagnostics);
|
|
1374
1438
|
const knownSuppressionRules = new Set([
|
|
1375
1439
|
...registeredRuleIds,
|
|
1376
1440
|
...eslintRuleIds,
|
|
@@ -1385,37 +1449,66 @@ export async function runUiDoctor({
|
|
|
1385
1449
|
)
|
|
1386
1450
|
initialDiagnostics.push(
|
|
1387
1451
|
configDiagnostic(`Unknown or stale suppression rule id ${rule}.`, {
|
|
1388
|
-
file:
|
|
1389
|
-
configResult.path === '<options>'
|
|
1390
|
-
? '<options>'
|
|
1391
|
-
: portablePath(root, configResult.path),
|
|
1452
|
+
file: configSourceLabel(root, configResult),
|
|
1392
1453
|
path: `$.suppressions[${index}].rules`,
|
|
1393
1454
|
}),
|
|
1394
1455
|
);
|
|
1395
1456
|
});
|
|
1457
|
+
return suppressionSource;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
// Exit phase: cancellation first, then infrastructure failure, then findings
|
|
1461
|
+
// at or above the selected fail-on level.
|
|
1462
|
+
function doctorExitCode({
|
|
1463
|
+
cancelled,
|
|
1464
|
+
infrastructureFailure,
|
|
1465
|
+
summary,
|
|
1466
|
+
selectedFailOn,
|
|
1467
|
+
}) {
|
|
1468
|
+
if (cancelled) return UI_DOCTOR_EXIT.cancelled;
|
|
1469
|
+
if (infrastructureFailure) return UI_DOCTOR_EXIT.configuration;
|
|
1470
|
+
if (
|
|
1471
|
+
summary.errors ||
|
|
1472
|
+
(selectedFailOn !== 'error' && summary.review) ||
|
|
1473
|
+
(selectedFailOn === 'warning' && summary.warnings)
|
|
1474
|
+
)
|
|
1475
|
+
return UI_DOCTOR_EXIT.findings;
|
|
1476
|
+
return UI_DOCTOR_EXIT.clean;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
// Report phase: merge and redact every diagnostic, apply the suppressions,
|
|
1480
|
+
// summarize the active set, and assemble the redacted report.
|
|
1481
|
+
function buildDoctorReport({
|
|
1482
|
+
root,
|
|
1483
|
+
packageRoot,
|
|
1484
|
+
selectedMode,
|
|
1485
|
+
selectedPaths,
|
|
1486
|
+
selectedFailOn,
|
|
1487
|
+
initialDiagnostics,
|
|
1488
|
+
emitted,
|
|
1489
|
+
suppressionSource,
|
|
1490
|
+
results,
|
|
1491
|
+
cancelled,
|
|
1492
|
+
infrastructureFailure,
|
|
1493
|
+
key,
|
|
1494
|
+
}) {
|
|
1396
1495
|
const merged = mergeDiagnostics(
|
|
1397
1496
|
redact(root, [...initialDiagnostics, ...emitted]),
|
|
1398
1497
|
);
|
|
1399
1498
|
const { active, suppressed } = applySuppressions(merged, suppressionSource);
|
|
1400
|
-
const infrastructureFailure =
|
|
1401
|
-
initialDiagnostics.length ||
|
|
1402
|
-
results.some((item) => ['failed', 'unavailable'].includes(item.status));
|
|
1403
1499
|
const summary = {
|
|
1404
1500
|
errors: active.filter((item) => item.severity === 'error').length,
|
|
1405
1501
|
warnings: active.filter((item) => item.severity === 'warning').length,
|
|
1406
1502
|
review: active.filter((item) => item.severity === 'review').length,
|
|
1407
1503
|
suppressed: suppressed.length,
|
|
1408
1504
|
};
|
|
1409
|
-
const exitCode =
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
? UI_DOCTOR_EXIT.findings
|
|
1417
|
-
: UI_DOCTOR_EXIT.clean;
|
|
1418
|
-
const report = redact(root, {
|
|
1505
|
+
const exitCode = doctorExitCode({
|
|
1506
|
+
cancelled,
|
|
1507
|
+
infrastructureFailure,
|
|
1508
|
+
summary,
|
|
1509
|
+
selectedFailOn,
|
|
1510
|
+
});
|
|
1511
|
+
return redact(root, {
|
|
1419
1512
|
schemaVersion: UI_DOCTOR_SCHEMA_VERSION,
|
|
1420
1513
|
tool: { name: '@kerfjs/ui/doctor', reportVersion: 1 },
|
|
1421
1514
|
mode: selectedMode,
|
|
@@ -1435,6 +1528,100 @@ export async function runUiDoctor({
|
|
|
1435
1528
|
exitCode,
|
|
1436
1529
|
cache: { hit: false, key },
|
|
1437
1530
|
});
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
export async function runUiDoctor({
|
|
1534
|
+
root: requestedRoot = process.cwd(),
|
|
1535
|
+
package: packageSelector,
|
|
1536
|
+
mode,
|
|
1537
|
+
paths,
|
|
1538
|
+
config: suppliedConfig,
|
|
1539
|
+
configPath,
|
|
1540
|
+
cache,
|
|
1541
|
+
failOn,
|
|
1542
|
+
signal,
|
|
1543
|
+
browser,
|
|
1544
|
+
runners = {},
|
|
1545
|
+
eslintConfig = 'recommended-ui',
|
|
1546
|
+
} = {}) {
|
|
1547
|
+
const { root, configResult, config, packageRoot, initialDiagnostics } =
|
|
1548
|
+
await resolveDoctorTarget({
|
|
1549
|
+
requestedRoot,
|
|
1550
|
+
packageSelector,
|
|
1551
|
+
suppliedConfig,
|
|
1552
|
+
configPath,
|
|
1553
|
+
});
|
|
1554
|
+
const { selectedMode, selectedFailOn, stages, selectedPaths, cacheEnabled } =
|
|
1555
|
+
selectDoctorRun({
|
|
1556
|
+
root,
|
|
1557
|
+
packageRoot,
|
|
1558
|
+
config,
|
|
1559
|
+
configResult,
|
|
1560
|
+
mode,
|
|
1561
|
+
failOn,
|
|
1562
|
+
browser,
|
|
1563
|
+
paths,
|
|
1564
|
+
cache,
|
|
1565
|
+
initialDiagnostics,
|
|
1566
|
+
});
|
|
1567
|
+
const [eslintRuleIds, registeredRuleIds] = await Promise.all([
|
|
1568
|
+
installedEslintRuleIds(packageRoot),
|
|
1569
|
+
sharedDiagnosticRuleIds(),
|
|
1570
|
+
]);
|
|
1571
|
+
const { cachePath, key } = await doctorCacheIdentity({
|
|
1572
|
+
root,
|
|
1573
|
+
packageRoot,
|
|
1574
|
+
selectedMode,
|
|
1575
|
+
selectedPaths,
|
|
1576
|
+
config,
|
|
1577
|
+
selectedFailOn,
|
|
1578
|
+
});
|
|
1579
|
+
if (cacheEnabled && !initialDiagnostics.length && !stages.browser) {
|
|
1580
|
+
const cached = await cachedDoctorReport(cachePath, key);
|
|
1581
|
+
if (cached) return cached;
|
|
1582
|
+
}
|
|
1583
|
+
const results = await runDoctorStages({
|
|
1584
|
+
root,
|
|
1585
|
+
packageRoot,
|
|
1586
|
+
config,
|
|
1587
|
+
stages,
|
|
1588
|
+
selectedPaths,
|
|
1589
|
+
signal,
|
|
1590
|
+
browser,
|
|
1591
|
+
runners,
|
|
1592
|
+
eslintConfig,
|
|
1593
|
+
registeredRuleIds,
|
|
1594
|
+
eslintRuleIds,
|
|
1595
|
+
});
|
|
1596
|
+
const cancelled =
|
|
1597
|
+
signal?.aborted || results.some((item) => item.status === 'cancelled');
|
|
1598
|
+
const emitted = results.flatMap((item) => item.diagnostics);
|
|
1599
|
+
const suppressionSource = validateSuppressions({
|
|
1600
|
+
root,
|
|
1601
|
+
configResult,
|
|
1602
|
+
config,
|
|
1603
|
+
emitted,
|
|
1604
|
+
registeredRuleIds,
|
|
1605
|
+
eslintRuleIds,
|
|
1606
|
+
initialDiagnostics,
|
|
1607
|
+
});
|
|
1608
|
+
const infrastructureFailure =
|
|
1609
|
+
initialDiagnostics.length ||
|
|
1610
|
+
results.some((item) => ['failed', 'unavailable'].includes(item.status));
|
|
1611
|
+
const report = buildDoctorReport({
|
|
1612
|
+
root,
|
|
1613
|
+
packageRoot,
|
|
1614
|
+
selectedMode,
|
|
1615
|
+
selectedPaths,
|
|
1616
|
+
selectedFailOn,
|
|
1617
|
+
initialDiagnostics,
|
|
1618
|
+
emitted,
|
|
1619
|
+
suppressionSource,
|
|
1620
|
+
results,
|
|
1621
|
+
cancelled,
|
|
1622
|
+
infrastructureFailure,
|
|
1623
|
+
key,
|
|
1624
|
+
});
|
|
1438
1625
|
if (cacheEnabled && !cancelled && !infrastructureFailure && !stages.browser)
|
|
1439
1626
|
await writeCache(cachePath, key, report);
|
|
1440
1627
|
return report;
|
package/evaluator/cli.mjs
CHANGED
|
@@ -4,21 +4,13 @@ import console from 'node:console';
|
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
5
|
import process from 'node:process';
|
|
6
6
|
|
|
7
|
+
import { parseCliArguments, wantsHelp } from '../scripts/lib/cli-args.mjs';
|
|
7
8
|
import { evaluateUi, formatUiEvaluationText } from './index.mjs';
|
|
8
9
|
|
|
9
10
|
const args = process.argv.slice(2);
|
|
10
|
-
const take = (name) => {
|
|
11
|
-
const index = args.indexOf(name);
|
|
12
|
-
if (index < 0) return undefined;
|
|
13
|
-
const value = args[index + 1];
|
|
14
|
-
if (!value || value.startsWith('--'))
|
|
15
|
-
throw new Error(`${name} requires a value.`);
|
|
16
|
-
args.splice(index, 2);
|
|
17
|
-
return value;
|
|
18
|
-
};
|
|
19
11
|
|
|
20
12
|
try {
|
|
21
|
-
if (
|
|
13
|
+
if (wantsHelp(args)) {
|
|
22
14
|
console.log(`Usage: kerf-ui-evaluate --url <running-app> [options]
|
|
23
15
|
|
|
24
16
|
Options:
|
|
@@ -32,30 +24,44 @@ Options:
|
|
|
32
24
|
--settle <ms> App settle delay after navigation (default: 100)
|
|
33
25
|
--retention <policy> always, on-failure, or never
|
|
34
26
|
--format <format> text or json (default: text)
|
|
35
|
-
--no-fail Exit zero even when objective diagnostics fail
|
|
27
|
+
--no-fail Exit zero even when objective diagnostics fail
|
|
28
|
+
-h, --help Show this help
|
|
29
|
+
|
|
30
|
+
Exit codes: 0 passed, 1 objective diagnostics failed, 2 usage or input error.`);
|
|
36
31
|
process.exit(0);
|
|
37
32
|
}
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
const { options } = parseCliArguments(args, {
|
|
34
|
+
values: {
|
|
35
|
+
'--url': 'url',
|
|
36
|
+
'--root': 'root',
|
|
37
|
+
'--start': 'start',
|
|
38
|
+
'--profile': 'profile',
|
|
39
|
+
'--output': 'output',
|
|
40
|
+
'--report': 'report',
|
|
41
|
+
'--browser': 'browser',
|
|
42
|
+
'--timeout': 'timeout',
|
|
43
|
+
'--settle': 'settle',
|
|
44
|
+
'--retention': 'retention',
|
|
45
|
+
'--format': 'format',
|
|
46
|
+
},
|
|
47
|
+
flags: { '--no-fail': 'noFail' },
|
|
48
|
+
});
|
|
49
|
+
const url = options.url;
|
|
50
|
+
const root = resolve(options.root ?? process.cwd());
|
|
51
|
+
const startDirectory = resolve(root, options.start ?? '.');
|
|
52
|
+
const packageProfile = options.profile;
|
|
53
|
+
const outputDirectory = resolve(root, options.output ?? 'kerf-ui-evidence');
|
|
54
|
+
const reportPath = options.report
|
|
55
|
+
? resolve(root, options.report)
|
|
46
56
|
: resolve(outputDirectory, 'report.json');
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
? browserValue.split(',').map((value) => value.trim())
|
|
57
|
+
const browsers = options.browser
|
|
58
|
+
? options.browser.split(',').map((value) => value.trim())
|
|
50
59
|
: undefined;
|
|
51
|
-
const timeoutMs = Number(
|
|
52
|
-
const settleMs = Number(
|
|
53
|
-
const retention =
|
|
54
|
-
const format =
|
|
55
|
-
const noFail =
|
|
56
|
-
const unknown = args.filter((argument) => argument !== '--no-fail');
|
|
57
|
-
if (unknown.length)
|
|
58
|
-
throw new Error(`Unknown arguments: ${unknown.join(' ')}`);
|
|
60
|
+
const timeoutMs = Number(options.timeout ?? 15_000);
|
|
61
|
+
const settleMs = Number(options.settle ?? 100);
|
|
62
|
+
const retention = options.retention ?? 'on-failure';
|
|
63
|
+
const format = options.format ?? 'text';
|
|
64
|
+
const noFail = options.noFail === true;
|
|
59
65
|
if (!url) throw new Error('--url is required.');
|
|
60
66
|
if (!['text', 'json'].includes(format))
|
|
61
67
|
throw new Error('--format must be text or json.');
|