@contentful/experience-design-system-cli 2.37.1-dev-build-5efcf6e5.0 → 2.37.1-dev-build-daf63213.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +315 -780
- package/dist/index.js +371 -1775
- package/dist/package.json +1 -1
- package/dist/src/tui/settings/configuration/agents/agent-store.d.ts +6 -1
- package/dist/src/tui/settings/shared/FieldForm.d.ts +13 -0
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -9663,8 +9663,8 @@ function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false)
|
|
|
9663
9663
|
accessors.set(name, entry);
|
|
9664
9664
|
}
|
|
9665
9665
|
for (const [name, { getter, setter }] of accessors) {
|
|
9666
|
-
const
|
|
9667
|
-
if (!
|
|
9666
|
+
const hasPropertyDecorator = getter?.getDecorators().some((decorator) => decorator.getName() === "property") || setter?.getDecorators().some((decorator) => decorator.getName() === "property");
|
|
9667
|
+
if (!hasPropertyDecorator && !(getter && setter))
|
|
9668
9668
|
continue;
|
|
9669
9669
|
const type = getter?.getReturnTypeNode()?.getText() ?? setter?.getParameters()[0]?.getTypeNode()?.getText() ?? "any";
|
|
9670
9670
|
const accessorNode = getter ?? setter;
|
|
@@ -12934,9 +12934,9 @@ function generateUlid(now = Date.now()) {
|
|
|
12934
12934
|
tsBytes[i] = n & 255;
|
|
12935
12935
|
n = Math.floor(n / 256);
|
|
12936
12936
|
}
|
|
12937
|
-
const
|
|
12937
|
+
const ts3 = encodeBase32(tsBytes, 10);
|
|
12938
12938
|
const rand = encodeBase32(randomBytes2(10), 16);
|
|
12939
|
-
return (
|
|
12939
|
+
return (ts3 + rand).toUpperCase();
|
|
12940
12940
|
}
|
|
12941
12941
|
|
|
12942
12942
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
@@ -15350,610 +15350,7 @@ async function runMapTokens(request) {
|
|
|
15350
15350
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
15351
15351
|
import { relative as relative2 } from "node:path";
|
|
15352
15352
|
|
|
15353
|
-
// packages/experience-design-system-
|
|
15354
|
-
import { Node as Node10, Project as Project7 } from "ts-morph";
|
|
15355
|
-
|
|
15356
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/shared/helpers/tsx-shared.js
|
|
15357
|
-
import { Project as Project8 } from "ts-morph";
|
|
15358
|
-
|
|
15359
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/shared/helpers/tsx-node-utils.js
|
|
15360
|
-
import { Node as Node12, SyntaxKind as SyntaxKind7 } from "ts-morph";
|
|
15361
|
-
|
|
15362
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-workspace-imports.js
|
|
15363
|
-
import { Node as Node11 } from "ts-morph";
|
|
15364
|
-
|
|
15365
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/shared/helpers/resolve-tsx-tsconfig-path.js
|
|
15366
|
-
import ts3 from "typescript";
|
|
15367
|
-
|
|
15368
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/shared/helpers/tsx-renderable-exports.js
|
|
15369
|
-
import { Node as Node13 } from "ts-morph";
|
|
15370
|
-
|
|
15371
|
-
// packages/experience-design-system-extraction/dist/src/extract/helpers/evidence/collect-jsx-component-references.js
|
|
15372
|
-
import { Node as Node15, SyntaxKind as SyntaxKind9 } from "ts-morph";
|
|
15373
|
-
|
|
15374
|
-
// packages/experience-design-system-extraction/dist/src/extract/helpers/evidence/ast/get-jsx-ast-data.js
|
|
15375
|
-
import { Node as Node14 } from "ts-morph";
|
|
15376
|
-
|
|
15377
|
-
// packages/experience-design-system-extraction/dist/src/extract/helpers/evidence/ast/collect-structural-jsx-evidence.js
|
|
15378
|
-
import { SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
15379
|
-
|
|
15380
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/extract-from-react-source-file.js
|
|
15381
|
-
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
15382
|
-
|
|
15383
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/extract-react-component-from-export.js
|
|
15384
|
-
import { Node as Node32 } from "ts-morph";
|
|
15385
|
-
|
|
15386
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/collect-prop-dataflow.js
|
|
15387
|
-
import { Node as Node17, SyntaxKind as SyntaxKind10 } from "ts-morph";
|
|
15388
|
-
|
|
15389
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/resolve-component-function.js
|
|
15390
|
-
import { Node as Node16 } from "ts-morph";
|
|
15391
|
-
|
|
15392
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/extract-react-props-from-type.js
|
|
15393
|
-
import { Node as Node24 } from "ts-morph";
|
|
15394
|
-
|
|
15395
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/dom-attribute-surfaces.js
|
|
15396
|
-
import { Node as Node18 } from "ts-morph";
|
|
15397
|
-
function createTextControlSurface2(onChangeType, specificProps) {
|
|
15398
|
-
return [
|
|
15399
|
-
{ name: "autoComplete", type: "string", required: false },
|
|
15400
|
-
...specificProps,
|
|
15401
|
-
{ name: "disabled", type: "boolean", required: false },
|
|
15402
|
-
{ name: "name", type: "string", required: false },
|
|
15403
|
-
{ name: "onChange", type: onChangeType, required: false },
|
|
15404
|
-
{ name: "placeholder", type: "string", required: false },
|
|
15405
|
-
{ name: "readOnly", type: "boolean", required: false },
|
|
15406
|
-
{ name: "required", type: "boolean", required: false },
|
|
15407
|
-
{
|
|
15408
|
-
name: "value",
|
|
15409
|
-
type: "string | number | readonly string[]",
|
|
15410
|
-
required: false
|
|
15411
|
-
}
|
|
15412
|
-
];
|
|
15413
|
-
}
|
|
15414
|
-
var DOM_ATTRIBUTE_PROP_SURFACES2 = {
|
|
15415
|
-
HTMLProps: [],
|
|
15416
|
-
HTMLAttributes: [
|
|
15417
|
-
{ name: "className", type: "string", required: false },
|
|
15418
|
-
{ name: "hidden", type: "boolean", required: false },
|
|
15419
|
-
{ name: "id", type: "string", required: false },
|
|
15420
|
-
{
|
|
15421
|
-
name: "onClick",
|
|
15422
|
-
type: "MouseEventHandler<HTMLElement>",
|
|
15423
|
-
required: false
|
|
15424
|
-
},
|
|
15425
|
-
{ name: "style", type: "CSSProperties", required: false },
|
|
15426
|
-
{ name: "tabIndex", type: "number", required: false },
|
|
15427
|
-
{ name: "title", type: "string", required: false }
|
|
15428
|
-
],
|
|
15429
|
-
ImgHTMLAttributes: [
|
|
15430
|
-
{ name: "alt", type: "string", required: false },
|
|
15431
|
-
{ name: "crossOrigin", type: "string", required: false },
|
|
15432
|
-
{ name: "height", type: "number | string", required: false },
|
|
15433
|
-
{
|
|
15434
|
-
name: "loading",
|
|
15435
|
-
type: "string",
|
|
15436
|
-
required: false,
|
|
15437
|
-
allowedValues: ["eager", "lazy"]
|
|
15438
|
-
},
|
|
15439
|
-
{ name: "sizes", type: "string", required: false },
|
|
15440
|
-
{ name: "src", type: "string", required: false },
|
|
15441
|
-
{ name: "srcSet", type: "string", required: false },
|
|
15442
|
-
{ name: "width", type: "number | string", required: false }
|
|
15443
|
-
],
|
|
15444
|
-
LiHTMLAttributes: [],
|
|
15445
|
-
AnchorHTMLAttributes: [
|
|
15446
|
-
{ name: "download", type: "boolean | string", required: false },
|
|
15447
|
-
{ name: "href", type: "string", required: false },
|
|
15448
|
-
{ name: "hrefLang", type: "string", required: false },
|
|
15449
|
-
{ name: "referrerPolicy", type: "string", required: false },
|
|
15450
|
-
{ name: "rel", type: "string", required: false },
|
|
15451
|
-
{
|
|
15452
|
-
name: "target",
|
|
15453
|
-
type: "string",
|
|
15454
|
-
required: false,
|
|
15455
|
-
allowedValues: ["_blank", "_parent", "_self", "_top"]
|
|
15456
|
-
}
|
|
15457
|
-
],
|
|
15458
|
-
ButtonHTMLAttributes: [
|
|
15459
|
-
{ name: "autoFocus", type: "boolean", required: false },
|
|
15460
|
-
{ name: "disabled", type: "boolean", required: false },
|
|
15461
|
-
{ name: "form", type: "string", required: false },
|
|
15462
|
-
{ name: "formAction", type: "string", required: false },
|
|
15463
|
-
{ name: "formMethod", type: "string", required: false },
|
|
15464
|
-
{ name: "formNoValidate", type: "boolean", required: false },
|
|
15465
|
-
{ name: "formTarget", type: "string", required: false },
|
|
15466
|
-
{ name: "name", type: "string", required: false },
|
|
15467
|
-
{
|
|
15468
|
-
name: "type",
|
|
15469
|
-
type: "string",
|
|
15470
|
-
required: false,
|
|
15471
|
-
allowedValues: ["button", "reset", "submit"]
|
|
15472
|
-
},
|
|
15473
|
-
{
|
|
15474
|
-
name: "value",
|
|
15475
|
-
type: "string | number | readonly string[]",
|
|
15476
|
-
required: false
|
|
15477
|
-
}
|
|
15478
|
-
],
|
|
15479
|
-
InputHTMLAttributes: createTextControlSurface2("ChangeEventHandler<HTMLInputElement>", [
|
|
15480
|
-
{ name: "checked", type: "boolean", required: false },
|
|
15481
|
-
{ name: "max", type: "number | string", required: false },
|
|
15482
|
-
{ name: "maxLength", type: "number", required: false },
|
|
15483
|
-
{ name: "min", type: "number | string", required: false },
|
|
15484
|
-
{ name: "minLength", type: "number", required: false },
|
|
15485
|
-
{ name: "type", type: "string", required: false }
|
|
15486
|
-
]),
|
|
15487
|
-
FieldsetHTMLAttributes: [
|
|
15488
|
-
{ name: "disabled", type: "boolean", required: false },
|
|
15489
|
-
{ name: "form", type: "string", required: false },
|
|
15490
|
-
{ name: "name", type: "string", required: false }
|
|
15491
|
-
],
|
|
15492
|
-
LabelHTMLAttributes: [
|
|
15493
|
-
{ name: "form", type: "string", required: false },
|
|
15494
|
-
{ name: "htmlFor", type: "string", required: false }
|
|
15495
|
-
],
|
|
15496
|
-
SelectHTMLAttributes: [
|
|
15497
|
-
{ name: "autoComplete", type: "string", required: false },
|
|
15498
|
-
{ name: "disabled", type: "boolean", required: false },
|
|
15499
|
-
{ name: "form", type: "string", required: false },
|
|
15500
|
-
{ name: "multiple", type: "boolean", required: false },
|
|
15501
|
-
{ name: "name", type: "string", required: false },
|
|
15502
|
-
{
|
|
15503
|
-
name: "onChange",
|
|
15504
|
-
type: "ChangeEventHandler<HTMLSelectElement>",
|
|
15505
|
-
required: false
|
|
15506
|
-
},
|
|
15507
|
-
{ name: "required", type: "boolean", required: false },
|
|
15508
|
-
{ name: "size", type: "number", required: false },
|
|
15509
|
-
{
|
|
15510
|
-
name: "value",
|
|
15511
|
-
type: "string | number | readonly string[]",
|
|
15512
|
-
required: false
|
|
15513
|
-
}
|
|
15514
|
-
],
|
|
15515
|
-
SVGAttributes: [
|
|
15516
|
-
{
|
|
15517
|
-
name: "focusable",
|
|
15518
|
-
type: 'boolean | "auto"',
|
|
15519
|
-
required: false,
|
|
15520
|
-
allowedValues: ["auto"]
|
|
15521
|
-
},
|
|
15522
|
-
{ name: "height", type: "number | string", required: false },
|
|
15523
|
-
{ name: "viewBox", type: "string", required: false },
|
|
15524
|
-
{ name: "width", type: "number | string", required: false }
|
|
15525
|
-
],
|
|
15526
|
-
SVGProps: [],
|
|
15527
|
-
TextareaHTMLAttributes: createTextControlSurface2("ChangeEventHandler<HTMLTextAreaElement>", [
|
|
15528
|
-
{ name: "cols", type: "number", required: false },
|
|
15529
|
-
{ name: "rows", type: "number", required: false },
|
|
15530
|
-
{ name: "wrap", type: "string", required: false }
|
|
15531
|
-
]),
|
|
15532
|
-
TdHTMLAttributes: [
|
|
15533
|
-
{
|
|
15534
|
-
name: "align",
|
|
15535
|
-
type: "string",
|
|
15536
|
-
required: false,
|
|
15537
|
-
allowedValues: ["center", "char", "justify", "left", "right"]
|
|
15538
|
-
},
|
|
15539
|
-
{ name: "colSpan", type: "number", required: false },
|
|
15540
|
-
{ name: "headers", type: "string", required: false },
|
|
15541
|
-
{ name: "rowSpan", type: "number", required: false },
|
|
15542
|
-
{ name: "scope", type: "string", required: false }
|
|
15543
|
-
]
|
|
15544
|
-
};
|
|
15545
|
-
|
|
15546
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/collect-dom-wrapper-contexts.js
|
|
15547
|
-
import { Node as Node19 } from "ts-morph";
|
|
15548
|
-
|
|
15549
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/detect-dom-is-pure-wrapper.js
|
|
15550
|
-
import { Node as Node20 } from "ts-morph";
|
|
15551
|
-
|
|
15552
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/detect-omit-wrapped-custom-props.js
|
|
15553
|
-
import { Node as Node21 } from "ts-morph";
|
|
15554
|
-
|
|
15555
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/detect-pick-type-patterns.js
|
|
15556
|
-
import { Node as Node22 } from "ts-morph";
|
|
15557
|
-
|
|
15558
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/detect-react-polymorphic.js
|
|
15559
|
-
import { Node as Node23 } from "ts-morph";
|
|
15560
|
-
|
|
15561
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/resolve-react-props-type.js
|
|
15562
|
-
import { Node as Node25 } from "ts-morph";
|
|
15563
|
-
|
|
15564
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/extract-react-binding-defaults.js
|
|
15565
|
-
import { Node as Node28 } from "ts-morph";
|
|
15566
|
-
|
|
15567
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/filter-impl-alias-props.js
|
|
15568
|
-
import { Node as Node26 } from "ts-morph";
|
|
15569
|
-
|
|
15570
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/extract-binding-fallback-props.js
|
|
15571
|
-
import { Node as Node27, SyntaxKind as SyntaxKind11 } from "ts-morph";
|
|
15572
|
-
|
|
15573
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/collect-react-impl-hints.js
|
|
15574
|
-
import { Node as Node30, SyntaxKind as SyntaxKind13 } from "ts-morph";
|
|
15575
|
-
|
|
15576
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/infer-primitive-dom-props.js
|
|
15577
|
-
import { Node as Node29, SyntaxKind as SyntaxKind12 } from "ts-morph";
|
|
15578
|
-
|
|
15579
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/react/helpers/extract-react-prop-types.js
|
|
15580
|
-
import { Node as Node31 } from "ts-morph";
|
|
15581
|
-
|
|
15582
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/stencil/extractor.js
|
|
15583
|
-
import { Project as Project9, Node as Node37 } from "ts-morph";
|
|
15584
|
-
|
|
15585
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/stencil/helpers/detect-stencil-class.js
|
|
15586
|
-
import { Node as Node33 } from "ts-morph";
|
|
15587
|
-
|
|
15588
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-props.js
|
|
15589
|
-
import { Node as Node35 } from "ts-morph";
|
|
15590
|
-
|
|
15591
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/stencil/helpers/stencil-prop-helpers.js
|
|
15592
|
-
import { Node as Node34, SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
15593
|
-
|
|
15594
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/stencil/helpers/extract-stencil-slots.js
|
|
15595
|
-
import { Node as Node36 } from "ts-morph";
|
|
15596
|
-
|
|
15597
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-unresolved-retry.js
|
|
15598
|
-
import { Project as Project12, ScriptTarget as ScriptTarget4, ModuleKind as ModuleKind4, ts as ts5 } from "ts-morph";
|
|
15599
|
-
|
|
15600
|
-
// packages/experience-design-system-extraction/dist/src/extract/services/quality/helpers/scoring/collect-scoring-inputs.js
|
|
15601
|
-
var OPAQUE_TYPES2 = /* @__PURE__ */ new Set(["any", "unknown", "object", "Record<string, unknown>", "Record<string, any>"]);
|
|
15602
|
-
var OBVIOUS_PROP_NAMES2 = /* @__PURE__ */ new Set([
|
|
15603
|
-
"className",
|
|
15604
|
-
"style",
|
|
15605
|
-
"id",
|
|
15606
|
-
"children",
|
|
15607
|
-
"disabled",
|
|
15608
|
-
"hidden",
|
|
15609
|
-
"onClick",
|
|
15610
|
-
"onChange",
|
|
15611
|
-
"onSubmit",
|
|
15612
|
-
"onBlur",
|
|
15613
|
-
"onFocus",
|
|
15614
|
-
"href",
|
|
15615
|
-
"src",
|
|
15616
|
-
"alt",
|
|
15617
|
-
"type",
|
|
15618
|
-
"value",
|
|
15619
|
-
"checked",
|
|
15620
|
-
"placeholder",
|
|
15621
|
-
"label",
|
|
15622
|
-
"title",
|
|
15623
|
-
"name",
|
|
15624
|
-
"required",
|
|
15625
|
-
"readOnly",
|
|
15626
|
-
"autoFocus",
|
|
15627
|
-
"tabIndex",
|
|
15628
|
-
"role",
|
|
15629
|
-
"aria-label",
|
|
15630
|
-
"aria-describedby"
|
|
15631
|
-
]);
|
|
15632
|
-
function isWidePrimitiveUnion2(type) {
|
|
15633
|
-
const parts = type.split("|").map((p) => p.trim());
|
|
15634
|
-
if (parts.length < 3)
|
|
15635
|
-
return false;
|
|
15636
|
-
const basePrimitives = /* @__PURE__ */ new Set(["string", "number", "boolean"]);
|
|
15637
|
-
const nullability = /* @__PURE__ */ new Set(["null", "undefined"]);
|
|
15638
|
-
const baseCount = parts.filter((p) => basePrimitives.has(p)).length;
|
|
15639
|
-
const nullabilityCount = parts.filter((p) => nullability.has(p)).length;
|
|
15640
|
-
return baseCount >= 3 || baseCount >= 2 && nullabilityCount > 0 && baseCount + nullabilityCount >= 3;
|
|
15641
|
-
}
|
|
15642
|
-
function countExtractionIssues(component, options = {}) {
|
|
15643
|
-
let count = 0;
|
|
15644
|
-
const reasons = [];
|
|
15645
|
-
if (component.props.length === 0 && component.slots.length === 0) {
|
|
15646
|
-
count++;
|
|
15647
|
-
reasons.push("no-props-or-slots");
|
|
15648
|
-
}
|
|
15649
|
-
if (component.props.length > 50) {
|
|
15650
|
-
count++;
|
|
15651
|
-
reasons.push(`high-prop-count:${component.props.length}`);
|
|
15652
|
-
}
|
|
15653
|
-
for (const prop of component.props) {
|
|
15654
|
-
if (OPAQUE_TYPES2.has(prop.type.trim())) {
|
|
15655
|
-
count++;
|
|
15656
|
-
reasons.push(`opaque-type:${prop.name}`);
|
|
15657
|
-
break;
|
|
15658
|
-
}
|
|
15659
|
-
if (isWidePrimitiveUnion2(prop.type)) {
|
|
15660
|
-
count++;
|
|
15661
|
-
reasons.push(`wide-union:${prop.name}`);
|
|
15662
|
-
break;
|
|
15663
|
-
}
|
|
15664
|
-
if (!prop.description && !OBVIOUS_PROP_NAMES2.has(prop.name)) {
|
|
15665
|
-
count++;
|
|
15666
|
-
reasons.push("props-missing-description");
|
|
15667
|
-
break;
|
|
15668
|
-
}
|
|
15669
|
-
}
|
|
15670
|
-
count += options.additionalIssueCount ?? 0;
|
|
15671
|
-
if (options.additionalReasons && options.additionalReasons.length > 0) {
|
|
15672
|
-
reasons.push(...options.additionalReasons);
|
|
15673
|
-
}
|
|
15674
|
-
return { count, reasons: [...new Set(reasons)] };
|
|
15675
|
-
}
|
|
15676
|
-
function mapIssueCountToConfidence(count) {
|
|
15677
|
-
if (count === 0)
|
|
15678
|
-
return 5;
|
|
15679
|
-
if (count === 1)
|
|
15680
|
-
return 4;
|
|
15681
|
-
if (count === 2)
|
|
15682
|
-
return 3;
|
|
15683
|
-
if (count === 3)
|
|
15684
|
-
return 2;
|
|
15685
|
-
return 1;
|
|
15686
|
-
}
|
|
15687
|
-
|
|
15688
|
-
// packages/experience-design-system-extraction/dist/src/extract/services/quality/helpers/scoring/compute-extraction-score.js
|
|
15689
|
-
function computeExtractionScore2(component, options = {}) {
|
|
15690
|
-
const { count, reasons } = countExtractionIssues(component, options);
|
|
15691
|
-
return {
|
|
15692
|
-
confidence: mapIssueCountToConfidence(count),
|
|
15693
|
-
reasons
|
|
15694
|
-
};
|
|
15695
|
-
}
|
|
15696
|
-
function deriveNeedsReview2(confidence) {
|
|
15697
|
-
return confidence <= 2;
|
|
15698
|
-
}
|
|
15699
|
-
|
|
15700
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-type-checker.js
|
|
15701
|
-
import { Project as Project10, ScriptTarget as ScriptTarget2, ModuleKind as ModuleKind2, ts as ts4 } from "ts-morph";
|
|
15702
|
-
|
|
15703
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-declaration-data.js
|
|
15704
|
-
import { Node as Node38 } from "ts-morph";
|
|
15705
|
-
|
|
15706
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/svelte/helpers/resolve-svelte-external-type-readers.js
|
|
15707
|
-
import { Node as Node40, Project as Project11, ScriptTarget as ScriptTarget3, ModuleKind as ModuleKind3 } from "ts-morph";
|
|
15708
|
-
|
|
15709
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/svelte/helpers/extract-svelte-external-type-members.js
|
|
15710
|
-
import { Node as Node39 } from "ts-morph";
|
|
15711
|
-
|
|
15712
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/svelte/helpers/extract-from-svelte-file.js
|
|
15713
|
-
import { parse as parseSvelte2 } from "svelte/compiler";
|
|
15714
|
-
|
|
15715
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/vue-tsx/extractor.js
|
|
15716
|
-
import { Node as Node44 } from "ts-morph";
|
|
15717
|
-
|
|
15718
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-props.js
|
|
15719
|
-
import { Node as Node42 } from "ts-morph";
|
|
15720
|
-
|
|
15721
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/vue-tsx/helpers/resolve-ast-object.js
|
|
15722
|
-
import { Node as Node41, SyntaxKind as SyntaxKind16 } from "ts-morph";
|
|
15723
|
-
|
|
15724
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/vue-tsx/helpers/extract-vue-tsx-slots.js
|
|
15725
|
-
import { Node as Node43, SyntaxKind as SyntaxKind17 } from "ts-morph";
|
|
15726
|
-
|
|
15727
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/vue/extractor.js
|
|
15728
|
-
import { parse as parseSFC3 } from "@vue/compiler-sfc";
|
|
15729
|
-
|
|
15730
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-props.js
|
|
15731
|
-
import { Project as Project14, Node as Node47 } from "ts-morph";
|
|
15732
|
-
|
|
15733
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/vue/helpers/extract-vue-setup-object-props.js
|
|
15734
|
-
import { Project as Project13, Node as Node46 } from "ts-morph";
|
|
15735
|
-
|
|
15736
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/vue/helpers/extract-vue-object-props.js
|
|
15737
|
-
import { Node as Node45 } from "ts-morph";
|
|
15738
|
-
|
|
15739
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/vue/helpers/extract-vue-options-props.js
|
|
15740
|
-
import { parse as parseSFC2 } from "@vue/compiler-sfc";
|
|
15741
|
-
import { Node as Node48, Project as Project15 } from "ts-morph";
|
|
15742
|
-
|
|
15743
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/extractor.js
|
|
15744
|
-
import { Project as Project16 } from "ts-morph";
|
|
15745
|
-
|
|
15746
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-observed-attrs.js
|
|
15747
|
-
import { Node as Node49 } from "ts-morph";
|
|
15748
|
-
|
|
15749
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-class-properties.js
|
|
15750
|
-
import { Node as Node50 } from "ts-morph";
|
|
15751
|
-
|
|
15752
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-decorator-tag.js
|
|
15753
|
-
import { Node as Node51 } from "ts-morph";
|
|
15754
|
-
|
|
15755
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-sibling-definition.js
|
|
15756
|
-
import { Node as Node54, SyntaxKind as SyntaxKind19 } from "ts-morph";
|
|
15757
|
-
|
|
15758
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import.js
|
|
15759
|
-
import { Node as Node53, SyntaxKind as SyntaxKind18 } from "ts-morph";
|
|
15760
|
-
|
|
15761
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-import-source.js
|
|
15762
|
-
import { Node as Node52 } from "ts-morph";
|
|
15763
|
-
|
|
15764
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/helpers/extract-wc-template-content.js
|
|
15765
|
-
import { Node as Node56 } from "ts-morph";
|
|
15766
|
-
|
|
15767
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/helpers/collect-wc-html-templates.js
|
|
15768
|
-
import { Node as Node55 } from "ts-morph";
|
|
15769
|
-
|
|
15770
|
-
// packages/experience-design-system-extraction/dist/src/extract/framework-adapters/web-components/helpers/resolve-wc-base-class.js
|
|
15771
|
-
import { Node as Node57, SyntaxKind as SyntaxKind20 } from "ts-morph";
|
|
15772
|
-
|
|
15773
|
-
// packages/experience-design-system-extraction/dist/src/extract/services/classification/helpers/check-prop-types.js
|
|
15774
|
-
function isStringLiteralUnion(type) {
|
|
15775
|
-
return type.includes("|") && type.includes("'");
|
|
15776
|
-
}
|
|
15777
|
-
function isSimpleType(type) {
|
|
15778
|
-
const t = type.trim();
|
|
15779
|
-
if (t === "string" || t === "boolean" || t === "number")
|
|
15780
|
-
return true;
|
|
15781
|
-
return isStringLiteralUnion(t);
|
|
15782
|
-
}
|
|
15783
|
-
function isBooleanType(type) {
|
|
15784
|
-
return type.trim() === "boolean";
|
|
15785
|
-
}
|
|
15786
|
-
function isStringType(type) {
|
|
15787
|
-
return type.trim() === "string";
|
|
15788
|
-
}
|
|
15789
|
-
function isNumberType(type) {
|
|
15790
|
-
return type.trim() === "number";
|
|
15791
|
-
}
|
|
15792
|
-
function isComplexType(type) {
|
|
15793
|
-
return !isSimpleType(type);
|
|
15794
|
-
}
|
|
15795
|
-
|
|
15796
|
-
// packages/experience-design-system-extraction/dist/src/extract/services/classification/helpers/detect-dom-props.js
|
|
15797
|
-
var DOM_PASS_THROUGH_PROPS = /* @__PURE__ */ new Set([
|
|
15798
|
-
// Bare HTML / framework styling pass-through
|
|
15799
|
-
"className",
|
|
15800
|
-
"class",
|
|
15801
|
-
"classes",
|
|
15802
|
-
"classNames",
|
|
15803
|
-
"rootClassName",
|
|
15804
|
-
"prefixCls",
|
|
15805
|
-
"style",
|
|
15806
|
-
"styles",
|
|
15807
|
-
// Bare HTML attributes
|
|
15808
|
-
"id",
|
|
15809
|
-
"role",
|
|
15810
|
-
"tabIndex",
|
|
15811
|
-
"tabindex",
|
|
15812
|
-
"htmlFor",
|
|
15813
|
-
"for",
|
|
15814
|
-
"slot",
|
|
15815
|
-
"is",
|
|
15816
|
-
"lang",
|
|
15817
|
-
"dir",
|
|
15818
|
-
"hidden",
|
|
15819
|
-
"draggable",
|
|
15820
|
-
"spellCheck",
|
|
15821
|
-
"spellcheck",
|
|
15822
|
-
"contentEditable",
|
|
15823
|
-
"contenteditable",
|
|
15824
|
-
"inputMode",
|
|
15825
|
-
"inputmode",
|
|
15826
|
-
"autoComplete",
|
|
15827
|
-
"autocomplete",
|
|
15828
|
-
"autoFocus",
|
|
15829
|
-
"autofocus",
|
|
15830
|
-
"translate",
|
|
15831
|
-
"part",
|
|
15832
|
-
"exportparts",
|
|
15833
|
-
"aria",
|
|
15834
|
-
// Framework theming / pass-through escape hatches — dev-facing, never marketer-configurable
|
|
15835
|
-
"dt",
|
|
15836
|
-
"pt",
|
|
15837
|
-
"ptOptions",
|
|
15838
|
-
"unstyled",
|
|
15839
|
-
"sx",
|
|
15840
|
-
// Polymorphic component props — change rendered HTML/component, not marketer-visible behavior
|
|
15841
|
-
"as",
|
|
15842
|
-
"element",
|
|
15843
|
-
"component",
|
|
15844
|
-
// QA / vendor test attributes
|
|
15845
|
-
"dataQa",
|
|
15846
|
-
"data-qa",
|
|
15847
|
-
// Vue v-model internals — framework wiring, never marketer-configurable
|
|
15848
|
-
"modelValue",
|
|
15849
|
-
"modelModifiers"
|
|
15850
|
-
]);
|
|
15851
|
-
function isDomPassThroughProp(name) {
|
|
15852
|
-
if (DOM_PASS_THROUGH_PROPS.has(name))
|
|
15853
|
-
return true;
|
|
15854
|
-
if (/^aria[-A-Z]/.test(name))
|
|
15855
|
-
return true;
|
|
15856
|
-
return name.startsWith("data-");
|
|
15857
|
-
}
|
|
15858
|
-
|
|
15859
|
-
// packages/experience-design-system-extraction/dist/src/extract/services/classification/classify-component-props.js
|
|
15860
|
-
function preClassifyProp(prop) {
|
|
15861
|
-
const { name, type } = prop;
|
|
15862
|
-
if (/^on[A-Z]/.test(name) || type.includes("=> void") || type.includes("EventHandler")) {
|
|
15863
|
-
return { category: "exclude" };
|
|
15864
|
-
}
|
|
15865
|
-
if (name === "ref" || name === "innerRef" || type.includes("Ref<") || type.includes("RefObject<")) {
|
|
15866
|
-
return { category: "exclude" };
|
|
15867
|
-
}
|
|
15868
|
-
if (name === "testId" || name === "data-testid" || name === "dataTestId") {
|
|
15869
|
-
return { category: "exclude" };
|
|
15870
|
-
}
|
|
15871
|
-
if (name === "key") {
|
|
15872
|
-
return { category: "exclude" };
|
|
15873
|
-
}
|
|
15874
|
-
if (type.includes("Dispatch<") || type.includes("SetStateAction")) {
|
|
15875
|
-
return { category: "exclude" };
|
|
15876
|
-
}
|
|
15877
|
-
if (isDomPassThroughProp(name)) {
|
|
15878
|
-
return { category: "exclude" };
|
|
15879
|
-
}
|
|
15880
|
-
if (name === "name" && prop.domAttribute) {
|
|
15881
|
-
return { category: "exclude" };
|
|
15882
|
-
}
|
|
15883
|
-
if (isStringLiteralUnion(type)) {
|
|
15884
|
-
return { category: "design", cdfTypeHint: "enum" };
|
|
15885
|
-
}
|
|
15886
|
-
if (!isComplexType(type)) {
|
|
15887
|
-
const designNameStart = /^(variant|size|spacing|gap|color|bg|theme|align|layout|orientation|position)/i;
|
|
15888
|
-
const designNameEnd = /(Color|Size|Variant|Style)$/;
|
|
15889
|
-
if (designNameStart.test(name) || designNameEnd.test(name)) {
|
|
15890
|
-
return { category: "design", cdfTypeHint: "string" };
|
|
15891
|
-
}
|
|
15892
|
-
}
|
|
15893
|
-
if (isBooleanType(type)) {
|
|
15894
|
-
const stateNames = ["disabled", "loading", "expanded", "isOpen", "selected", "checked", "active", "preview"];
|
|
15895
|
-
if (stateNames.includes(name)) {
|
|
15896
|
-
return { category: "state", cdfTypeHint: "boolean" };
|
|
15897
|
-
}
|
|
15898
|
-
}
|
|
15899
|
-
if (isBooleanType(type)) {
|
|
15900
|
-
const visualToggle = /^(hide|show|enable|disable|vertical|horizontal|reverse|bold|italic|imageOn|with)/i;
|
|
15901
|
-
if (visualToggle.test(name)) {
|
|
15902
|
-
return { category: "design", cdfTypeHint: "boolean" };
|
|
15903
|
-
}
|
|
15904
|
-
}
|
|
15905
|
-
if (name === "componentId" || name === "sectionKey" || name === "locale" || name === "variantIndex") {
|
|
15906
|
-
return { category: "state", cdfTypeHint: "string" };
|
|
15907
|
-
}
|
|
15908
|
-
if (isStringType(type)) {
|
|
15909
|
-
const urlNameStart = /^(href|url|link|src)/i;
|
|
15910
|
-
const urlNameEnd = /(Url|Href|Link|Src)$/;
|
|
15911
|
-
if (urlNameStart.test(name) || urlNameEnd.test(name)) {
|
|
15912
|
-
return { category: "content", cdfTypeHint: "string" };
|
|
15913
|
-
}
|
|
15914
|
-
}
|
|
15915
|
-
if (isStringType(type)) {
|
|
15916
|
-
const textNameStart = /^(label|title|text|description|caption|heading|subheading|body|alt|name|placeholder|summary)/i;
|
|
15917
|
-
const textNameEnd = /(Text|Label|Title|Name)$/;
|
|
15918
|
-
if (textNameStart.test(name) || textNameEnd.test(name)) {
|
|
15919
|
-
return { category: "content", cdfTypeHint: "string" };
|
|
15920
|
-
}
|
|
15921
|
-
}
|
|
15922
|
-
if (isStringType(type)) {
|
|
15923
|
-
return { category: "content", cdfTypeHint: "string" };
|
|
15924
|
-
}
|
|
15925
|
-
if (isBooleanType(type)) {
|
|
15926
|
-
return { category: "design", cdfTypeHint: "boolean" };
|
|
15927
|
-
}
|
|
15928
|
-
if (isNumberType(type)) {
|
|
15929
|
-
return { category: "design", cdfTypeHint: "string" };
|
|
15930
|
-
}
|
|
15931
|
-
return void 0;
|
|
15932
|
-
}
|
|
15933
|
-
function preClassifyComponent(component) {
|
|
15934
|
-
const props = component.props.flatMap((prop) => {
|
|
15935
|
-
const result = preClassifyProp(prop);
|
|
15936
|
-
if (result?.category === "exclude") {
|
|
15937
|
-
return [];
|
|
15938
|
-
}
|
|
15939
|
-
const { domAttribute: _domAttribute, ...authorableProp } = prop;
|
|
15940
|
-
if (prop.category) {
|
|
15941
|
-
return [authorableProp];
|
|
15942
|
-
}
|
|
15943
|
-
if (!result) {
|
|
15944
|
-
return [authorableProp];
|
|
15945
|
-
}
|
|
15946
|
-
return [
|
|
15947
|
-
{
|
|
15948
|
-
...authorableProp,
|
|
15949
|
-
category: result.category
|
|
15950
|
-
}
|
|
15951
|
-
];
|
|
15952
|
-
});
|
|
15953
|
-
return { ...component, props };
|
|
15954
|
-
}
|
|
15955
|
-
|
|
15956
|
-
// packages/experience-design-system-extraction/dist/src/extract/services/quality/helpers/authorability/evaluate-authorability.js
|
|
15353
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/quality/non-authorable-filter.js
|
|
15957
15354
|
var HANDLER_TYPE_PATTERN = /=>|EventHandler|Dispatch<|SetStateAction/;
|
|
15958
15355
|
var REF_TYPE_PATTERN = /Ref<|RefObject<|MutableRefObject/;
|
|
15959
15356
|
function isHandlerOrRefProp(prop) {
|
|
@@ -16006,10 +15403,15 @@ function hasNoAuthoringSurface(component) {
|
|
|
16006
15403
|
return { skip: false };
|
|
16007
15404
|
}
|
|
16008
15405
|
|
|
16009
|
-
// packages/experience-design-system-
|
|
15406
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
16010
15407
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
16011
15408
|
|
|
16012
|
-
// packages/experience-design-system-
|
|
15409
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
|
|
15410
|
+
var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
|
|
15411
|
+
var POSSIBLE_DATA_FETCH_WRAPPER_REASON = "possible-data-fetch-wrapper";
|
|
15412
|
+
var ZERO_SURFACE_RENDERED_UI_REASON = "zero-surface:rendered-ui";
|
|
15413
|
+
|
|
15414
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/parse-imported-names.js
|
|
16013
15415
|
function parseImportedNames(importClause) {
|
|
16014
15416
|
const trimmed = importClause.trim();
|
|
16015
15417
|
if (!trimmed)
|
|
@@ -16034,7 +15436,7 @@ function parseImportedNames(importClause) {
|
|
|
16034
15436
|
return names;
|
|
16035
15437
|
}
|
|
16036
15438
|
|
|
16037
|
-
// packages/experience-design-system-
|
|
15439
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
16038
15440
|
var INFRA_PROP_NAMES = /* @__PURE__ */ new Set(["id", "locale", "preview", "slug", "topic", "previousComponent", "__typename"]);
|
|
16039
15441
|
var VISIBLE_UI_TAG_PATTERN = /<(?:[A-Z][A-Za-z0-9_.]*|div|span|section|main|article|header|footer|nav|aside|img|video|p|h[1-6]|ul|ol|li|button|input|textarea|select|form|label|table|tbody|thead|tr|td|th)\b/;
|
|
16040
15442
|
var GENERATED_IMPORT_PATTERN = /from\s+['"][^'"]*__generated[^'"]*['"]/;
|
|
@@ -16076,11 +15478,11 @@ function hasSiblingForwardRender(sourceText, siblingImports) {
|
|
|
16076
15478
|
function hasVisibleUiRender(sourceText) {
|
|
16077
15479
|
return /return\s*(?:\(|<)/.test(sourceText) && VISIBLE_UI_TAG_PATTERN.test(sourceText);
|
|
16078
15480
|
}
|
|
16079
|
-
function
|
|
15481
|
+
function infraPropNames(component) {
|
|
16080
15482
|
const props = component.props.map((prop) => prop.name);
|
|
16081
15483
|
return props.length > 0 && props.every((prop) => INFRA_PROP_NAMES.has(prop)) ? props : [];
|
|
16082
15484
|
}
|
|
16083
|
-
function
|
|
15485
|
+
function scoreToConfidence(score) {
|
|
16084
15486
|
if (score <= 0)
|
|
16085
15487
|
return 0;
|
|
16086
15488
|
if (score <= 2)
|
|
@@ -16091,14 +15493,9 @@ function mapScoreToWrapperConfidence(score) {
|
|
|
16091
15493
|
return 4;
|
|
16092
15494
|
return 5;
|
|
16093
15495
|
}
|
|
16094
|
-
function
|
|
16095
|
-
return [...new Set(
|
|
15496
|
+
function dedupeReasons(reasons) {
|
|
15497
|
+
return [...new Set(reasons)];
|
|
16096
15498
|
}
|
|
16097
|
-
|
|
16098
|
-
// packages/experience-design-system-extraction/dist/src/extract/services/quality/helpers/inspection/inspect-component-source.js
|
|
16099
|
-
var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
|
|
16100
|
-
var POSSIBLE_DATA_FETCH_WRAPPER_REASON = "possible-data-fetch-wrapper";
|
|
16101
|
-
var ZERO_SURFACE_RENDERED_UI_REASON = "zero-surface:rendered-ui";
|
|
16102
15499
|
async function inspectComponentSource(component) {
|
|
16103
15500
|
let sourceText = "";
|
|
16104
15501
|
try {
|
|
@@ -16113,7 +15510,7 @@ async function inspectComponentSource(component) {
|
|
|
16113
15510
|
const reviewReasons = [];
|
|
16114
15511
|
let wrapperScore = 0;
|
|
16115
15512
|
const hasGeneratedQueryHook = GENERATED_IMPORT_PATTERN.test(sourceText) && GENERATED_QUERY_HOOK_PATTERN.test(sourceText);
|
|
16116
|
-
const infraProps =
|
|
15513
|
+
const infraProps = infraPropNames(component);
|
|
16117
15514
|
const siblingImports = collectSiblingRendererImports(sourceText);
|
|
16118
15515
|
if (GQL_FILENAME_PATTERN.test(component.source)) {
|
|
16119
15516
|
reviewReasons.push("data-wrapper:gql-filename");
|
|
@@ -16126,137 +15523,70 @@ async function inspectComponentSource(component) {
|
|
|
16126
15523
|
if (siblingImports.length > 0 && (hasGeneratedQueryHook || infraProps.length > 0)) {
|
|
16127
15524
|
reviewReasons.push("data-wrapper:sibling-renderer-import");
|
|
16128
15525
|
wrapperScore += 1;
|
|
16129
|
-
}
|
|
16130
|
-
if (hasSiblingForwardRender(sourceText, siblingImports)) {
|
|
16131
|
-
reviewReasons.push("data-wrapper:fetch-forward-render");
|
|
16132
|
-
wrapperScore += 3;
|
|
16133
|
-
}
|
|
16134
|
-
if (sourceText.includes("useContentfulLiveUpdates(") || sourceText.includes("useContentfulContext(")) {
|
|
16135
|
-
reviewReasons.push("data-wrapper:contentful-runtime");
|
|
16136
|
-
wrapperScore += 1;
|
|
16137
|
-
}
|
|
16138
|
-
if (infraProps.length > 0) {
|
|
16139
|
-
reviewReasons.push("data-wrapper:infra-props");
|
|
16140
|
-
wrapperScore += 2;
|
|
16141
|
-
}
|
|
16142
|
-
if (LOADING_NULL_GUARD_PATTERN.test(sourceText)) {
|
|
16143
|
-
reviewReasons.push("data-wrapper:loading-null-guard");
|
|
16144
|
-
wrapperScore += 1;
|
|
16145
|
-
}
|
|
16146
|
-
const wrapperConfidence =
|
|
16147
|
-
if (wrapperConfidence >= 4) {
|
|
16148
|
-
reviewReasons.unshift(HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON);
|
|
16149
|
-
} else if (wrapperConfidence === 3) {
|
|
16150
|
-
reviewReasons.unshift(POSSIBLE_DATA_FETCH_WRAPPER_REASON);
|
|
16151
|
-
}
|
|
16152
|
-
const keepDespiteZeroSurface = component.props.length === 0 && component.slots.length === 0 && hasVisibleUiRender(sourceText);
|
|
16153
|
-
if (keepDespiteZeroSurface) {
|
|
16154
|
-
reviewReasons.push(ZERO_SURFACE_RENDERED_UI_REASON);
|
|
16155
|
-
}
|
|
16156
|
-
return {
|
|
16157
|
-
wrapperConfidence,
|
|
16158
|
-
reviewReasons:
|
|
16159
|
-
keepDespiteZeroSurface
|
|
16160
|
-
};
|
|
16161
|
-
}
|
|
16162
|
-
function describeReviewReason(reason) {
|
|
16163
|
-
switch (reason) {
|
|
16164
|
-
case HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON:
|
|
16165
|
-
return "high-confidence data-fetch wrapper";
|
|
16166
|
-
case POSSIBLE_DATA_FETCH_WRAPPER_REASON:
|
|
16167
|
-
return "possible data-fetch wrapper";
|
|
16168
|
-
case "data-wrapper:gql-filename":
|
|
16169
|
-
return "source file follows a gql wrapper naming pattern";
|
|
16170
|
-
case "data-wrapper:generated-query-hook":
|
|
16171
|
-
return "imports and calls a generated query hook";
|
|
16172
|
-
case "data-wrapper:sibling-renderer-import":
|
|
16173
|
-
return "imports a sibling renderer from the same folder";
|
|
16174
|
-
case "data-wrapper:fetch-forward-render":
|
|
16175
|
-
return "forwards fetched data into a sibling renderer";
|
|
16176
|
-
case "data-wrapper:contentful-runtime":
|
|
16177
|
-
return "uses Contentful runtime hooks";
|
|
16178
|
-
case "data-wrapper:infra-props":
|
|
16179
|
-
return "only exposes infra-fetch props";
|
|
16180
|
-
case "data-wrapper:loading-null-guard":
|
|
16181
|
-
return "returns early while loading or when fetched data is missing";
|
|
16182
|
-
case ZERO_SURFACE_RENDERED_UI_REASON:
|
|
16183
|
-
return "source renders visible/compositional UI despite zero extracted props and slots";
|
|
16184
|
-
default:
|
|
16185
|
-
return reason;
|
|
16186
|
-
}
|
|
16187
|
-
}
|
|
16188
|
-
function describeReviewReasons(reasons) {
|
|
16189
|
-
return
|
|
16190
|
-
}
|
|
16191
|
-
|
|
16192
|
-
// packages/experience-design-system-extraction/dist/src/extract/services/quality/helpers/inspection/validate-extracted-components.js
|
|
16193
|
-
function validateExtractedComponents2(components) {
|
|
16194
|
-
const nameCounts = /* @__PURE__ */ new Map();
|
|
16195
|
-
for (const component of components) {
|
|
16196
|
-
const key = component.name.trim();
|
|
16197
|
-
nameCounts.set(key, (nameCounts.get(key) ?? 0) + 1);
|
|
16198
|
-
}
|
|
16199
|
-
return components.map((component) => {
|
|
16200
|
-
const issues = [];
|
|
16201
|
-
if (!component.name.trim()) {
|
|
16202
|
-
issues.push({
|
|
16203
|
-
severity: "error",
|
|
16204
|
-
code: "EMPTY_COMPONENT_NAME",
|
|
16205
|
-
message: "Component name must not be empty"
|
|
16206
|
-
});
|
|
16207
|
-
}
|
|
16208
|
-
for (let i = 0; i < component.props.length; i++) {
|
|
16209
|
-
if (!component.props[i].name.trim()) {
|
|
16210
|
-
issues.push({
|
|
16211
|
-
severity: "error",
|
|
16212
|
-
code: "EMPTY_PROP_NAME",
|
|
16213
|
-
message: `Prop at index ${i} has an empty name`,
|
|
16214
|
-
field: `props[${i}].name`
|
|
16215
|
-
});
|
|
16216
|
-
}
|
|
16217
|
-
}
|
|
16218
|
-
for (let i = 0; i < component.slots.length; i++) {
|
|
16219
|
-
if (!component.slots[i].name.trim()) {
|
|
16220
|
-
issues.push({
|
|
16221
|
-
severity: "warning",
|
|
16222
|
-
code: "EMPTY_SLOT_NAME",
|
|
16223
|
-
message: `Slot at index ${i} has an empty name`,
|
|
16224
|
-
field: `slots[${i}].name`
|
|
16225
|
-
});
|
|
16226
|
-
}
|
|
16227
|
-
}
|
|
16228
|
-
const propNames = new Set(component.props.map((p) => p.name.trim()).filter(Boolean));
|
|
16229
|
-
for (let i = 0; i < component.slots.length; i++) {
|
|
16230
|
-
const slotName = component.slots[i].name.trim();
|
|
16231
|
-
if (slotName && propNames.has(slotName)) {
|
|
16232
|
-
issues.push({
|
|
16233
|
-
severity: "error",
|
|
16234
|
-
code: "PROP_SLOT_NAME_COLLISION",
|
|
16235
|
-
message: `"${slotName}" is used as both a prop name and a slot name`,
|
|
16236
|
-
field: `slots[${i}].name`
|
|
16237
|
-
});
|
|
16238
|
-
}
|
|
16239
|
-
}
|
|
16240
|
-
const nameKey = component.name.trim();
|
|
16241
|
-
if (nameKey && (nameCounts.get(nameKey) ?? 0) > 1) {
|
|
16242
|
-
issues.push({
|
|
16243
|
-
severity: "error",
|
|
16244
|
-
code: "DUPLICATE_COMPONENT_NAME",
|
|
16245
|
-
message: `Component name "${component.name}" appears more than once in the extracted set`
|
|
16246
|
-
});
|
|
16247
|
-
}
|
|
16248
|
-
if (component.props.length === 0 && component.slots.length === 0) {
|
|
16249
|
-
issues.push({
|
|
16250
|
-
severity: "warning",
|
|
16251
|
-
code: "EMPTY_COMPONENT",
|
|
16252
|
-
message: "Component has no props or slots and will be filtered out during generation"
|
|
16253
|
-
});
|
|
16254
|
-
}
|
|
16255
|
-
return { ...component, validationIssues: issues };
|
|
16256
|
-
});
|
|
15526
|
+
}
|
|
15527
|
+
if (hasSiblingForwardRender(sourceText, siblingImports)) {
|
|
15528
|
+
reviewReasons.push("data-wrapper:fetch-forward-render");
|
|
15529
|
+
wrapperScore += 3;
|
|
15530
|
+
}
|
|
15531
|
+
if (sourceText.includes("useContentfulLiveUpdates(") || sourceText.includes("useContentfulContext(")) {
|
|
15532
|
+
reviewReasons.push("data-wrapper:contentful-runtime");
|
|
15533
|
+
wrapperScore += 1;
|
|
15534
|
+
}
|
|
15535
|
+
if (infraProps.length > 0) {
|
|
15536
|
+
reviewReasons.push("data-wrapper:infra-props");
|
|
15537
|
+
wrapperScore += 2;
|
|
15538
|
+
}
|
|
15539
|
+
if (LOADING_NULL_GUARD_PATTERN.test(sourceText)) {
|
|
15540
|
+
reviewReasons.push("data-wrapper:loading-null-guard");
|
|
15541
|
+
wrapperScore += 1;
|
|
15542
|
+
}
|
|
15543
|
+
const wrapperConfidence = scoreToConfidence(wrapperScore);
|
|
15544
|
+
if (wrapperConfidence >= 4) {
|
|
15545
|
+
reviewReasons.unshift(HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON);
|
|
15546
|
+
} else if (wrapperConfidence === 3) {
|
|
15547
|
+
reviewReasons.unshift(POSSIBLE_DATA_FETCH_WRAPPER_REASON);
|
|
15548
|
+
}
|
|
15549
|
+
const keepDespiteZeroSurface = component.props.length === 0 && component.slots.length === 0 && hasVisibleUiRender(sourceText);
|
|
15550
|
+
if (keepDespiteZeroSurface) {
|
|
15551
|
+
reviewReasons.push(ZERO_SURFACE_RENDERED_UI_REASON);
|
|
15552
|
+
}
|
|
15553
|
+
return {
|
|
15554
|
+
wrapperConfidence,
|
|
15555
|
+
reviewReasons: dedupeReasons(reviewReasons),
|
|
15556
|
+
keepDespiteZeroSurface
|
|
15557
|
+
};
|
|
15558
|
+
}
|
|
15559
|
+
function describeReviewReason(reason) {
|
|
15560
|
+
switch (reason) {
|
|
15561
|
+
case HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON:
|
|
15562
|
+
return "high-confidence data-fetch wrapper";
|
|
15563
|
+
case POSSIBLE_DATA_FETCH_WRAPPER_REASON:
|
|
15564
|
+
return "possible data-fetch wrapper";
|
|
15565
|
+
case "data-wrapper:gql-filename":
|
|
15566
|
+
return "source file follows a gql wrapper naming pattern";
|
|
15567
|
+
case "data-wrapper:generated-query-hook":
|
|
15568
|
+
return "imports and calls a generated query hook";
|
|
15569
|
+
case "data-wrapper:sibling-renderer-import":
|
|
15570
|
+
return "imports a sibling renderer from the same folder";
|
|
15571
|
+
case "data-wrapper:fetch-forward-render":
|
|
15572
|
+
return "forwards fetched data into a sibling renderer";
|
|
15573
|
+
case "data-wrapper:contentful-runtime":
|
|
15574
|
+
return "uses Contentful runtime hooks";
|
|
15575
|
+
case "data-wrapper:infra-props":
|
|
15576
|
+
return "only exposes infra-fetch props";
|
|
15577
|
+
case "data-wrapper:loading-null-guard":
|
|
15578
|
+
return "returns early while loading or when fetched data is missing";
|
|
15579
|
+
case ZERO_SURFACE_RENDERED_UI_REASON:
|
|
15580
|
+
return "source renders visible/compositional UI despite zero extracted props and slots";
|
|
15581
|
+
default:
|
|
15582
|
+
return reason;
|
|
15583
|
+
}
|
|
15584
|
+
}
|
|
15585
|
+
function describeReviewReasons(reasons) {
|
|
15586
|
+
return dedupeReasons(reasons.map(describeReviewReason));
|
|
16257
15587
|
}
|
|
16258
15588
|
|
|
16259
|
-
// packages/experience-design-system-
|
|
15589
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/quality/evaluate-extraction-quality.js
|
|
16260
15590
|
function wrapperConfidenceToIssueCount(confidence) {
|
|
16261
15591
|
if (confidence >= 4)
|
|
16262
15592
|
return 2;
|
|
@@ -16288,7 +15618,7 @@ async function evaluateExtractionQuality(components, initialWarnings = []) {
|
|
|
16288
15618
|
}
|
|
16289
15619
|
const extractorReasons = component.reviewReasons ?? [];
|
|
16290
15620
|
const nonAuthorableReason = retainedForReview ? [`non-authorable:${verdict.reason}`] : [];
|
|
16291
|
-
const { confidence, reasons } =
|
|
15621
|
+
const { confidence, reasons } = computeExtractionScore(component, {
|
|
16292
15622
|
additionalIssueCount: wrapperConfidenceToIssueCount(inspection.wrapperConfidence) + extractorReasons.length + nonAuthorableReason.length,
|
|
16293
15623
|
additionalReasons: [...extractorReasons, ...inspection.reviewReasons, ...nonAuthorableReason]
|
|
16294
15624
|
});
|
|
@@ -16296,15 +15626,194 @@ async function evaluateExtractionQuality(components, initialWarnings = []) {
|
|
|
16296
15626
|
...component,
|
|
16297
15627
|
extractionConfidence: confidence,
|
|
16298
15628
|
reviewReasons: reasons,
|
|
16299
|
-
needsReview:
|
|
15629
|
+
needsReview: deriveNeedsReview(confidence) || inspection.wrapperConfidence >= 4 || inspection.keepDespiteZeroSurface || retainedForReview || extractorReasons.includes("props-type-unresolved") || (component.needsReview ?? false)
|
|
16300
15630
|
});
|
|
16301
15631
|
}
|
|
16302
15632
|
return {
|
|
16303
|
-
components:
|
|
15633
|
+
components: validateExtractedComponents(scoredComponents),
|
|
16304
15634
|
warnings
|
|
16305
15635
|
};
|
|
16306
15636
|
}
|
|
16307
15637
|
|
|
15638
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/pre-classify.js
|
|
15639
|
+
function isStringLiteralUnion(type) {
|
|
15640
|
+
return type.includes("|") && type.includes("'");
|
|
15641
|
+
}
|
|
15642
|
+
function isSimpleType(type) {
|
|
15643
|
+
const t = type.trim();
|
|
15644
|
+
if (t === "string" || t === "boolean" || t === "number")
|
|
15645
|
+
return true;
|
|
15646
|
+
return isStringLiteralUnion(t);
|
|
15647
|
+
}
|
|
15648
|
+
function isBooleanType(type) {
|
|
15649
|
+
return type.trim() === "boolean";
|
|
15650
|
+
}
|
|
15651
|
+
function isStringType(type) {
|
|
15652
|
+
return type.trim() === "string";
|
|
15653
|
+
}
|
|
15654
|
+
function isNumberType(type) {
|
|
15655
|
+
return type.trim() === "number";
|
|
15656
|
+
}
|
|
15657
|
+
function isComplexType(type) {
|
|
15658
|
+
return !isSimpleType(type);
|
|
15659
|
+
}
|
|
15660
|
+
var DOM_PASS_THROUGH_PROPS = /* @__PURE__ */ new Set([
|
|
15661
|
+
// Bare HTML / framework styling pass-through
|
|
15662
|
+
"className",
|
|
15663
|
+
"class",
|
|
15664
|
+
"classes",
|
|
15665
|
+
"classNames",
|
|
15666
|
+
"rootClassName",
|
|
15667
|
+
"prefixCls",
|
|
15668
|
+
"style",
|
|
15669
|
+
"styles",
|
|
15670
|
+
// Bare HTML attributes
|
|
15671
|
+
"id",
|
|
15672
|
+
"role",
|
|
15673
|
+
"tabIndex",
|
|
15674
|
+
"tabindex",
|
|
15675
|
+
"htmlFor",
|
|
15676
|
+
"for",
|
|
15677
|
+
"slot",
|
|
15678
|
+
"is",
|
|
15679
|
+
"lang",
|
|
15680
|
+
"dir",
|
|
15681
|
+
"hidden",
|
|
15682
|
+
"draggable",
|
|
15683
|
+
"spellCheck",
|
|
15684
|
+
"spellcheck",
|
|
15685
|
+
"contentEditable",
|
|
15686
|
+
"contenteditable",
|
|
15687
|
+
"inputMode",
|
|
15688
|
+
"inputmode",
|
|
15689
|
+
"autoComplete",
|
|
15690
|
+
"autocomplete",
|
|
15691
|
+
"autoFocus",
|
|
15692
|
+
"autofocus",
|
|
15693
|
+
"translate",
|
|
15694
|
+
"part",
|
|
15695
|
+
"exportparts",
|
|
15696
|
+
"aria",
|
|
15697
|
+
// Framework theming / pass-through escape hatches — dev-facing, never marketer-configurable
|
|
15698
|
+
"dt",
|
|
15699
|
+
"pt",
|
|
15700
|
+
"ptOptions",
|
|
15701
|
+
"unstyled",
|
|
15702
|
+
"sx",
|
|
15703
|
+
// Polymorphic component props — change rendered HTML/component, not marketer-visible behavior
|
|
15704
|
+
"as",
|
|
15705
|
+
"element",
|
|
15706
|
+
"component",
|
|
15707
|
+
// QA / vendor test attributes
|
|
15708
|
+
"dataQa",
|
|
15709
|
+
"data-qa",
|
|
15710
|
+
// Vue v-model internals — framework wiring, never marketer-configurable
|
|
15711
|
+
"modelValue",
|
|
15712
|
+
"modelModifiers"
|
|
15713
|
+
]);
|
|
15714
|
+
function isDomPassThroughProp(name) {
|
|
15715
|
+
if (DOM_PASS_THROUGH_PROPS.has(name))
|
|
15716
|
+
return true;
|
|
15717
|
+
if (/^aria[-A-Z]/.test(name))
|
|
15718
|
+
return true;
|
|
15719
|
+
return name.startsWith("data-");
|
|
15720
|
+
}
|
|
15721
|
+
function preClassifyProp(prop) {
|
|
15722
|
+
const { name, type } = prop;
|
|
15723
|
+
if (/^on[A-Z]/.test(name) || type.includes("=> void") || type.includes("EventHandler")) {
|
|
15724
|
+
return { category: "exclude" };
|
|
15725
|
+
}
|
|
15726
|
+
if (name === "ref" || name === "innerRef" || type.includes("Ref<") || type.includes("RefObject<")) {
|
|
15727
|
+
return { category: "exclude" };
|
|
15728
|
+
}
|
|
15729
|
+
if (name === "testId" || name === "data-testid" || name === "dataTestId") {
|
|
15730
|
+
return { category: "exclude" };
|
|
15731
|
+
}
|
|
15732
|
+
if (name === "key") {
|
|
15733
|
+
return { category: "exclude" };
|
|
15734
|
+
}
|
|
15735
|
+
if (type.includes("Dispatch<") || type.includes("SetStateAction")) {
|
|
15736
|
+
return { category: "exclude" };
|
|
15737
|
+
}
|
|
15738
|
+
if (isDomPassThroughProp(name)) {
|
|
15739
|
+
return { category: "exclude" };
|
|
15740
|
+
}
|
|
15741
|
+
if (name === "name" && prop.domAttribute) {
|
|
15742
|
+
return { category: "exclude" };
|
|
15743
|
+
}
|
|
15744
|
+
if (isStringLiteralUnion(type)) {
|
|
15745
|
+
return { category: "design", cdfTypeHint: "enum" };
|
|
15746
|
+
}
|
|
15747
|
+
if (!isComplexType(type)) {
|
|
15748
|
+
const designNameStart = /^(variant|size|spacing|gap|color|bg|theme|align|layout|orientation|position)/i;
|
|
15749
|
+
const designNameEnd = /(Color|Size|Variant|Style)$/;
|
|
15750
|
+
if (designNameStart.test(name) || designNameEnd.test(name)) {
|
|
15751
|
+
return { category: "design", cdfTypeHint: "string" };
|
|
15752
|
+
}
|
|
15753
|
+
}
|
|
15754
|
+
if (isBooleanType(type)) {
|
|
15755
|
+
const stateNames = ["disabled", "loading", "expanded", "isOpen", "selected", "checked", "active", "preview"];
|
|
15756
|
+
if (stateNames.includes(name)) {
|
|
15757
|
+
return { category: "state", cdfTypeHint: "boolean" };
|
|
15758
|
+
}
|
|
15759
|
+
}
|
|
15760
|
+
if (isBooleanType(type)) {
|
|
15761
|
+
const visualToggle = /^(hide|show|enable|disable|vertical|horizontal|reverse|bold|italic|imageOn|with)/i;
|
|
15762
|
+
if (visualToggle.test(name)) {
|
|
15763
|
+
return { category: "design", cdfTypeHint: "boolean" };
|
|
15764
|
+
}
|
|
15765
|
+
}
|
|
15766
|
+
if (name === "componentId" || name === "sectionKey" || name === "locale" || name === "variantIndex") {
|
|
15767
|
+
return { category: "state", cdfTypeHint: "string" };
|
|
15768
|
+
}
|
|
15769
|
+
if (isStringType(type)) {
|
|
15770
|
+
const urlNameStart = /^(href|url|link|src)/i;
|
|
15771
|
+
const urlNameEnd = /(Url|Href|Link|Src)$/;
|
|
15772
|
+
if (urlNameStart.test(name) || urlNameEnd.test(name)) {
|
|
15773
|
+
return { category: "content", cdfTypeHint: "string" };
|
|
15774
|
+
}
|
|
15775
|
+
}
|
|
15776
|
+
if (isStringType(type)) {
|
|
15777
|
+
const textNameStart = /^(label|title|text|description|caption|heading|subheading|body|alt|name|placeholder|summary)/i;
|
|
15778
|
+
const textNameEnd = /(Text|Label|Title|Name)$/;
|
|
15779
|
+
if (textNameStart.test(name) || textNameEnd.test(name)) {
|
|
15780
|
+
return { category: "content", cdfTypeHint: "string" };
|
|
15781
|
+
}
|
|
15782
|
+
}
|
|
15783
|
+
if (isStringType(type)) {
|
|
15784
|
+
return { category: "content", cdfTypeHint: "string" };
|
|
15785
|
+
}
|
|
15786
|
+
if (isBooleanType(type)) {
|
|
15787
|
+
return { category: "design", cdfTypeHint: "boolean" };
|
|
15788
|
+
}
|
|
15789
|
+
if (isNumberType(type)) {
|
|
15790
|
+
return { category: "design", cdfTypeHint: "string" };
|
|
15791
|
+
}
|
|
15792
|
+
return void 0;
|
|
15793
|
+
}
|
|
15794
|
+
function preClassifyComponent(component) {
|
|
15795
|
+
const props = component.props.flatMap((prop) => {
|
|
15796
|
+
const result = preClassifyProp(prop);
|
|
15797
|
+
if (result?.category === "exclude") {
|
|
15798
|
+
return [];
|
|
15799
|
+
}
|
|
15800
|
+
const { domAttribute: _domAttribute, ...authorableProp } = prop;
|
|
15801
|
+
if (prop.category) {
|
|
15802
|
+
return [authorableProp];
|
|
15803
|
+
}
|
|
15804
|
+
if (!result) {
|
|
15805
|
+
return [authorableProp];
|
|
15806
|
+
}
|
|
15807
|
+
return [
|
|
15808
|
+
{
|
|
15809
|
+
...authorableProp,
|
|
15810
|
+
category: result.category
|
|
15811
|
+
}
|
|
15812
|
+
];
|
|
15813
|
+
});
|
|
15814
|
+
return { ...component, props };
|
|
15815
|
+
}
|
|
15816
|
+
|
|
16308
15817
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/emit-pre-classification-exclusions.js
|
|
16309
15818
|
function emitPreClassificationExclusions(extraction, onExclusion) {
|
|
16310
15819
|
if (!onExclusion)
|
|
@@ -28607,7 +28116,8 @@ function emptyAgents() {
|
|
|
28607
28116
|
async function readAgentConfig() {
|
|
28608
28117
|
const store = await readV1Store();
|
|
28609
28118
|
const stored = asString(store["agent"]);
|
|
28610
|
-
const
|
|
28119
|
+
const defaultChosen = isAgentName(stored);
|
|
28120
|
+
const defaultAgent = defaultChosen ? stored : DEFAULT_AGENT_NAME;
|
|
28611
28121
|
const agents = emptyAgents();
|
|
28612
28122
|
const saved = store["agents"];
|
|
28613
28123
|
if (saved && typeof saved === "object") {
|
|
@@ -28622,7 +28132,7 @@ async function readAgentConfig() {
|
|
|
28622
28132
|
const legacyModel = asString(store["agentModel"]);
|
|
28623
28133
|
if (legacyModel && !agents[defaultAgent].model)
|
|
28624
28134
|
agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
|
|
28625
|
-
return { defaultAgent, agents };
|
|
28135
|
+
return { defaultAgent, defaultChosen, agents };
|
|
28626
28136
|
}
|
|
28627
28137
|
async function writeAgentConfig(config) {
|
|
28628
28138
|
const existing = await readV1Store();
|
|
@@ -28633,8 +28143,9 @@ async function writeAgentConfig(config) {
|
|
|
28633
28143
|
const binary = config.agents[name].binary.trim();
|
|
28634
28144
|
if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
28635
28145
|
}
|
|
28636
|
-
|
|
28637
|
-
|
|
28146
|
+
const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
|
|
28147
|
+
if (config.defaultChosen) merged["agent"] = config.defaultAgent;
|
|
28148
|
+
else delete merged["agent"];
|
|
28638
28149
|
if (defaultModel) merged["agentModel"] = defaultModel;
|
|
28639
28150
|
else delete merged["agentModel"];
|
|
28640
28151
|
if (Object.keys(agents).length > 0) merged["agents"] = agents;
|
|
@@ -28854,6 +28365,20 @@ import { useState as useState29 } from "react";
|
|
|
28854
28365
|
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
28855
28366
|
import TextInput4 from "ink-text-input";
|
|
28856
28367
|
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
28368
|
+
function formLabelWidth(rows) {
|
|
28369
|
+
return Math.max(...rows.map((row) => row.label.length));
|
|
28370
|
+
}
|
|
28371
|
+
function FormReadOnlyRow({
|
|
28372
|
+
label,
|
|
28373
|
+
labelWidth,
|
|
28374
|
+
children
|
|
28375
|
+
}) {
|
|
28376
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
28377
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28378
|
+
/* @__PURE__ */ jsx55(Box44, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: label }) }),
|
|
28379
|
+
children
|
|
28380
|
+
] });
|
|
28381
|
+
}
|
|
28857
28382
|
function FieldForm({
|
|
28858
28383
|
title,
|
|
28859
28384
|
subtitle,
|
|
@@ -28871,10 +28396,7 @@ function FieldForm({
|
|
|
28871
28396
|
const [editing, setEditing] = useState29(false);
|
|
28872
28397
|
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
28873
28398
|
const rowCount = fields2.length + actions.length;
|
|
28874
|
-
const labelWidth =
|
|
28875
|
-
...fields2.map((field) => field.label.length),
|
|
28876
|
-
...actions.map((action) => action.label.length)
|
|
28877
|
-
);
|
|
28399
|
+
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
28878
28400
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
28879
28401
|
const currentAction = currentField ? void 0 : actions[active - fields2.length];
|
|
28880
28402
|
useInput11((input, key) => {
|
|
@@ -28936,8 +28458,12 @@ function FieldForm({
|
|
|
28936
28458
|
onSubmit: () => setEditing(false),
|
|
28937
28459
|
mask: field.masked ? "\u2022" : void 0
|
|
28938
28460
|
}
|
|
28939
|
-
) :
|
|
28940
|
-
|
|
28461
|
+
) : display ? /* @__PURE__ */ jsx55(Text46, { bold: true, children: display }) : (
|
|
28462
|
+
// An empty value shows its hint (or "(empty)") in the value's place, not after an empty element, so the
|
|
28463
|
+
// text starts in the same column as every other row's.
|
|
28464
|
+
/* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint ?? "(empty)" })
|
|
28465
|
+
),
|
|
28466
|
+
display && field.hint && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint })
|
|
28941
28467
|
] }, field.key);
|
|
28942
28468
|
}),
|
|
28943
28469
|
actions.map((action, index) => {
|
|
@@ -29020,15 +28546,7 @@ var fields = (name) => [
|
|
|
29020
28546
|
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name]}\` from the PATH)` },
|
|
29021
28547
|
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
29022
28548
|
];
|
|
29023
|
-
var
|
|
29024
|
-
var LABEL_GAP = 2;
|
|
29025
|
-
var POINTER_WIDTH = 2;
|
|
29026
|
-
function Row2({ label, children }) {
|
|
29027
|
-
return /* @__PURE__ */ jsxs46(Box45, { children: [
|
|
29028
|
-
/* @__PURE__ */ jsx57(Box45, { width: POINTER_WIDTH + LABEL_WIDTH + LABEL_GAP, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: label }) }),
|
|
29029
|
-
children
|
|
29030
|
-
] });
|
|
29031
|
-
}
|
|
28549
|
+
var INSPECT_DELAY_MS = 400;
|
|
29032
28550
|
function StatusHeading() {
|
|
29033
28551
|
return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
29034
28552
|
/* @__PURE__ */ jsx57(Text48, { bold: true, color: PALETTE.muted, children: "STATUS" }),
|
|
@@ -29049,9 +28567,12 @@ function AgentDetail({
|
|
|
29049
28567
|
useEffect22(() => {
|
|
29050
28568
|
let active = true;
|
|
29051
28569
|
setChecks(void 0);
|
|
29052
|
-
|
|
28570
|
+
const timer = setTimeout(() => {
|
|
28571
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
28572
|
+
}, INSPECT_DELAY_MS);
|
|
29053
28573
|
return () => {
|
|
29054
28574
|
active = false;
|
|
28575
|
+
clearTimeout(timer);
|
|
29055
28576
|
};
|
|
29056
28577
|
}, [name, settings.binary]);
|
|
29057
28578
|
const save = () => {
|
|
@@ -29084,12 +28605,14 @@ function AgentDetail({
|
|
|
29084
28605
|
hint: "run test",
|
|
29085
28606
|
onRun: runTest
|
|
29086
28607
|
};
|
|
28608
|
+
const formFields = fields(name);
|
|
28609
|
+
const labelWidth = formLabelWidth([...formFields, action]);
|
|
29087
28610
|
return /* @__PURE__ */ jsx57(
|
|
29088
28611
|
FieldForm,
|
|
29089
28612
|
{
|
|
29090
28613
|
title: AGENT_LABELS[name],
|
|
29091
28614
|
subtitle: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name]}\` command.`,
|
|
29092
|
-
fields:
|
|
28615
|
+
fields: formFields,
|
|
29093
28616
|
values: { binary: settings.binary, model: settings.model },
|
|
29094
28617
|
onChange: (key, value) => {
|
|
29095
28618
|
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
|
|
@@ -29102,7 +28625,7 @@ function AgentDetail({
|
|
|
29102
28625
|
busy: saving || testing,
|
|
29103
28626
|
children: /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
|
|
29104
28627
|
/* @__PURE__ */ jsx57(StatusHeading, {}),
|
|
29105
|
-
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx57(
|
|
28628
|
+
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx57(FormReadOnlyRow, { label: row.label, labelWidth, children: /* @__PURE__ */ jsx57(Text48, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label))
|
|
29106
28629
|
] })
|
|
29107
28630
|
}
|
|
29108
28631
|
);
|
|
@@ -29118,6 +28641,7 @@ function AgentsScreen({ onDone }) {
|
|
|
29118
28641
|
const [open, setOpen] = useState31(null);
|
|
29119
28642
|
const [notice, setNotice] = useState31(null);
|
|
29120
28643
|
const [saving, setSaving] = useState31(false);
|
|
28644
|
+
const [loadError, setLoadError] = useState31(null);
|
|
29121
28645
|
const [checks, setChecks] = useState31({});
|
|
29122
28646
|
const inspectAll = (loaded) => {
|
|
29123
28647
|
for (const name of AGENT_NAMES) {
|
|
@@ -29127,7 +28651,7 @@ function AgentsScreen({ onDone }) {
|
|
|
29127
28651
|
}
|
|
29128
28652
|
};
|
|
29129
28653
|
useEffect23(() => {
|
|
29130
|
-
|
|
28654
|
+
readAgentConfig().then((loaded) => {
|
|
29131
28655
|
setConfig(loaded);
|
|
29132
28656
|
inspectAll(loaded);
|
|
29133
28657
|
startDebugRun({
|
|
@@ -29136,7 +28660,7 @@ function AgentsScreen({ onDone }) {
|
|
|
29136
28660
|
menuOption: "Configuration > Agents",
|
|
29137
28661
|
inputs: { default_agent: loaded.defaultAgent }
|
|
29138
28662
|
});
|
|
29139
|
-
});
|
|
28663
|
+
}).catch((err) => setLoadError(err instanceof Error ? err.message : String(err)));
|
|
29140
28664
|
}, []);
|
|
29141
28665
|
const makeDefault = (name) => {
|
|
29142
28666
|
if (!config || saving) return;
|
|
@@ -29146,8 +28670,8 @@ function AgentsScreen({ onDone }) {
|
|
|
29146
28670
|
}
|
|
29147
28671
|
setSaving(true);
|
|
29148
28672
|
setNotice(null);
|
|
29149
|
-
writeAgentConfig({ ...config, defaultAgent: name }).then(() => {
|
|
29150
|
-
setConfig((current) => current ? { ...current, defaultAgent: name } : current);
|
|
28673
|
+
writeAgentConfig({ ...config, defaultAgent: name, defaultChosen: true }).then(() => {
|
|
28674
|
+
setConfig((current) => current ? { ...current, defaultAgent: name, defaultChosen: true } : current);
|
|
29151
28675
|
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
29152
28676
|
}).catch(
|
|
29153
28677
|
(err) => setNotice({
|
|
@@ -29157,6 +28681,10 @@ function AgentsScreen({ onDone }) {
|
|
|
29157
28681
|
).finally(() => setSaving(false));
|
|
29158
28682
|
};
|
|
29159
28683
|
useInput12((input, key) => {
|
|
28684
|
+
if (loadError && (key.escape || input === "q")) {
|
|
28685
|
+
onDone();
|
|
28686
|
+
return;
|
|
28687
|
+
}
|
|
29160
28688
|
if (!config || open || saving) return;
|
|
29161
28689
|
const focused = AGENT_NAMES[focus];
|
|
29162
28690
|
if (key.upArrow || key.downArrow || key.tab) setNotice(null);
|
|
@@ -29186,7 +28714,14 @@ function AgentsScreen({ onDone }) {
|
|
|
29186
28714
|
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29187
28715
|
/* @__PURE__ */ jsx58(Text49, { bold: true, children: "Agents" }),
|
|
29188
28716
|
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
29189
|
-
/* @__PURE__ */
|
|
28717
|
+
loadError ? /* @__PURE__ */ jsxs47(Fragment18, { children: [
|
|
28718
|
+
/* @__PURE__ */ jsxs47(Text49, { color: PALETTE.error, children: [
|
|
28719
|
+
"\u2717 Could not read the settings: ",
|
|
28720
|
+
loadError
|
|
28721
|
+
] }),
|
|
28722
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
28723
|
+
/* @__PURE__ */ jsx58(ControlHints, { hints: [{ keys: "Esc/q", label: "back" }] })
|
|
28724
|
+
] }) : /* @__PURE__ */ jsx58(Text49, { color: PALETTE.accent, children: "Loading..." })
|
|
29190
28725
|
] });
|
|
29191
28726
|
}
|
|
29192
28727
|
if (open) {
|