@qulib/core 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +22 -0
  2. package/dist/analyze.js +2 -2
  3. package/dist/cli/auth-login-resolve.d.ts +14 -0
  4. package/dist/cli/auth-login-resolve.d.ts.map +1 -0
  5. package/dist/cli/auth-login-resolve.js +68 -0
  6. package/dist/cli/auth-login-run.d.ts +13 -0
  7. package/dist/cli/auth-login-run.d.ts.map +1 -0
  8. package/dist/cli/auth-login-run.js +128 -0
  9. package/dist/cli/index.js +51 -1
  10. package/dist/harness/state-manager.d.ts +10 -0
  11. package/dist/harness/state-manager.d.ts.map +1 -1
  12. package/dist/harness/state-manager.js +15 -0
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -1
  16. package/dist/phases/act.js +3 -3
  17. package/dist/phases/observe.js +3 -3
  18. package/dist/schemas/automation-maturity.schema.d.ts +40 -0
  19. package/dist/schemas/automation-maturity.schema.d.ts.map +1 -1
  20. package/dist/schemas/automation-maturity.schema.js +27 -0
  21. package/dist/schemas/config.schema.d.ts +229 -73
  22. package/dist/schemas/config.schema.d.ts.map +1 -1
  23. package/dist/schemas/config.schema.js +19 -18
  24. package/dist/schemas/index.d.ts +1 -1
  25. package/dist/schemas/index.d.ts.map +1 -1
  26. package/dist/schemas/index.js +1 -1
  27. package/dist/schemas/repo-analysis.schema.d.ts +22 -0
  28. package/dist/schemas/repo-analysis.schema.d.ts.map +1 -1
  29. package/dist/schemas/repo-analysis.schema.js +1 -0
  30. package/dist/telemetry/emit.d.ts +22 -0
  31. package/dist/telemetry/emit.d.ts.map +1 -1
  32. package/dist/telemetry/emit.js +37 -0
  33. package/dist/tools/auth-detector.d.ts +18 -0
  34. package/dist/tools/auth-detector.d.ts.map +1 -1
  35. package/dist/tools/auth-detector.js +287 -28
  36. package/dist/tools/auth-surface-analyzer.d.ts.map +1 -1
  37. package/dist/tools/auth-surface-analyzer.js +26 -10
  38. package/dist/tools/automation-maturity.d.ts.map +1 -1
  39. package/dist/tools/automation-maturity.js +76 -20
  40. package/dist/tools/repo-scanner.d.ts.map +1 -1
  41. package/dist/tools/repo-scanner.js +7 -2
  42. package/package.json +12 -2
@@ -367,67 +367,6 @@ export declare const HarnessConfigSchema: z.ZodObject<{
367
367
  }>;
368
368
  export type HarnessConfig = z.infer<typeof HarnessConfigSchema>;
369
369
  export declare function resolveMaxOutputTokensPerLlmCall(config: HarnessConfig): number;
370
- export declare const DetectedAuthSchema: z.ZodObject<{
371
- hasAuth: z.ZodBoolean;
372
- type: z.ZodEnum<["none", "form-login", "oauth", "magic-link", "unknown"]>;
373
- provider: z.ZodNullable<z.ZodString>;
374
- loginUrl: z.ZodNullable<z.ZodString>;
375
- observedSelectors: z.ZodNullable<z.ZodObject<{
376
- usernameSelector: z.ZodNullable<z.ZodString>;
377
- passwordSelector: z.ZodNullable<z.ZodString>;
378
- submitSelector: z.ZodNullable<z.ZodString>;
379
- }, "strip", z.ZodTypeAny, {
380
- usernameSelector: string | null;
381
- passwordSelector: string | null;
382
- submitSelector: string | null;
383
- }, {
384
- usernameSelector: string | null;
385
- passwordSelector: string | null;
386
- submitSelector: string | null;
387
- }>>;
388
- oauthButtons: z.ZodArray<z.ZodObject<{
389
- provider: z.ZodString;
390
- text: z.ZodString;
391
- }, "strip", z.ZodTypeAny, {
392
- provider: string;
393
- text: string;
394
- }, {
395
- provider: string;
396
- text: string;
397
- }>, "many">;
398
- recommendation: z.ZodString;
399
- }, "strip", z.ZodTypeAny, {
400
- type: "unknown" | "form-login" | "none" | "oauth" | "magic-link";
401
- loginUrl: string | null;
402
- hasAuth: boolean;
403
- provider: string | null;
404
- observedSelectors: {
405
- usernameSelector: string | null;
406
- passwordSelector: string | null;
407
- submitSelector: string | null;
408
- } | null;
409
- oauthButtons: {
410
- provider: string;
411
- text: string;
412
- }[];
413
- recommendation: string;
414
- }, {
415
- type: "unknown" | "form-login" | "none" | "oauth" | "magic-link";
416
- loginUrl: string | null;
417
- hasAuth: boolean;
418
- provider: string | null;
419
- observedSelectors: {
420
- usernameSelector: string | null;
421
- passwordSelector: string | null;
422
- submitSelector: string | null;
423
- } | null;
424
- oauthButtons: {
425
- provider: string;
426
- text: string;
427
- }[];
428
- recommendation: string;
429
- }>;
430
- export type DetectedAuth = z.infer<typeof DetectedAuthSchema>;
431
370
  export declare const AuthPathRequirementsSchema: z.ZodDiscriminatedUnion<"method", [z.ZodObject<{
432
371
  method: z.ZodLiteral<"storage-state">;
433
372
  instruction: z.ZodString;
@@ -543,10 +482,10 @@ export declare const AuthPathSchema: z.ZodObject<{
543
482
  instruction: string;
544
483
  }>]>;
545
484
  }, "strip", z.ZodTypeAny, {
546
- type: "unknown" | "form-login" | "oauth" | "magic-link" | "oauth-unknown" | "form-multi";
547
- provider: string | null;
485
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
548
486
  label: string;
549
487
  id: string;
488
+ provider: string | null;
550
489
  source: "built-in" | "user-local" | "heuristic";
551
490
  automatable: boolean;
552
491
  confidence: "high" | "medium" | "low";
@@ -566,10 +505,10 @@ export declare const AuthPathSchema: z.ZodObject<{
566
505
  instruction: string;
567
506
  };
568
507
  }, {
569
- type: "unknown" | "form-login" | "oauth" | "magic-link" | "oauth-unknown" | "form-multi";
570
- provider: string | null;
508
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
571
509
  label: string;
572
510
  id: string;
511
+ provider: string | null;
573
512
  source: "built-in" | "user-local" | "heuristic";
574
513
  automatable: boolean;
575
514
  confidence: "high" | "medium" | "low";
@@ -589,6 +528,223 @@ export declare const AuthPathSchema: z.ZodObject<{
589
528
  instruction: string;
590
529
  };
591
530
  }>;
531
+ export declare const DetectedAuthSchema: z.ZodObject<{
532
+ hasAuth: z.ZodBoolean;
533
+ type: z.ZodEnum<["none", "form-login", "oauth", "magic-link", "unknown"]>;
534
+ provider: z.ZodNullable<z.ZodString>;
535
+ loginUrl: z.ZodNullable<z.ZodString>;
536
+ observedSelectors: z.ZodNullable<z.ZodObject<{
537
+ usernameSelector: z.ZodNullable<z.ZodString>;
538
+ passwordSelector: z.ZodNullable<z.ZodString>;
539
+ submitSelector: z.ZodNullable<z.ZodString>;
540
+ }, "strip", z.ZodTypeAny, {
541
+ usernameSelector: string | null;
542
+ passwordSelector: string | null;
543
+ submitSelector: string | null;
544
+ }, {
545
+ usernameSelector: string | null;
546
+ passwordSelector: string | null;
547
+ submitSelector: string | null;
548
+ }>>;
549
+ oauthButtons: z.ZodArray<z.ZodObject<{
550
+ provider: z.ZodString;
551
+ text: z.ZodString;
552
+ }, "strip", z.ZodTypeAny, {
553
+ text: string;
554
+ provider: string;
555
+ }, {
556
+ text: string;
557
+ provider: string;
558
+ }>, "many">;
559
+ authOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
560
+ id: z.ZodString;
561
+ label: z.ZodString;
562
+ type: z.ZodEnum<["oauth", "oauth-unknown", "form-login", "form-multi", "magic-link", "unknown"]>;
563
+ provider: z.ZodNullable<z.ZodString>;
564
+ source: z.ZodEnum<["built-in", "user-local", "heuristic"]>;
565
+ automatable: z.ZodBoolean;
566
+ confidence: z.ZodEnum<["high", "medium", "low"]>;
567
+ requirements: z.ZodDiscriminatedUnion<"method", [z.ZodObject<{
568
+ method: z.ZodLiteral<"storage-state">;
569
+ instruction: z.ZodString;
570
+ }, "strip", z.ZodTypeAny, {
571
+ method: "storage-state";
572
+ instruction: string;
573
+ }, {
574
+ method: "storage-state";
575
+ instruction: string;
576
+ }>, z.ZodObject<{
577
+ method: z.ZodLiteral<"credentials">;
578
+ fields: z.ZodArray<z.ZodObject<{
579
+ name: z.ZodString;
580
+ label: z.ZodString;
581
+ type: z.ZodEnum<["text", "password", "email", "select", "checkbox"]>;
582
+ observedOptions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
583
+ }, "strip", z.ZodTypeAny, {
584
+ type: "password" | "text" | "email" | "select" | "checkbox";
585
+ name: string;
586
+ label: string;
587
+ observedOptions: string[];
588
+ }, {
589
+ type: "password" | "text" | "email" | "select" | "checkbox";
590
+ name: string;
591
+ label: string;
592
+ observedOptions?: string[] | undefined;
593
+ }>, "many">;
594
+ }, "strip", z.ZodTypeAny, {
595
+ method: "credentials";
596
+ fields: {
597
+ type: "password" | "text" | "email" | "select" | "checkbox";
598
+ name: string;
599
+ label: string;
600
+ observedOptions: string[];
601
+ }[];
602
+ }, {
603
+ method: "credentials";
604
+ fields: {
605
+ type: "password" | "text" | "email" | "select" | "checkbox";
606
+ name: string;
607
+ label: string;
608
+ observedOptions?: string[] | undefined;
609
+ }[];
610
+ }>, z.ZodObject<{
611
+ method: z.ZodLiteral<"unknown">;
612
+ instruction: z.ZodString;
613
+ }, "strip", z.ZodTypeAny, {
614
+ method: "unknown";
615
+ instruction: string;
616
+ }, {
617
+ method: "unknown";
618
+ instruction: string;
619
+ }>]>;
620
+ }, "strip", z.ZodTypeAny, {
621
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
622
+ label: string;
623
+ id: string;
624
+ provider: string | null;
625
+ source: "built-in" | "user-local" | "heuristic";
626
+ automatable: boolean;
627
+ confidence: "high" | "medium" | "low";
628
+ requirements: {
629
+ method: "storage-state";
630
+ instruction: string;
631
+ } | {
632
+ method: "credentials";
633
+ fields: {
634
+ type: "password" | "text" | "email" | "select" | "checkbox";
635
+ name: string;
636
+ label: string;
637
+ observedOptions: string[];
638
+ }[];
639
+ } | {
640
+ method: "unknown";
641
+ instruction: string;
642
+ };
643
+ }, {
644
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
645
+ label: string;
646
+ id: string;
647
+ provider: string | null;
648
+ source: "built-in" | "user-local" | "heuristic";
649
+ automatable: boolean;
650
+ confidence: "high" | "medium" | "low";
651
+ requirements: {
652
+ method: "storage-state";
653
+ instruction: string;
654
+ } | {
655
+ method: "credentials";
656
+ fields: {
657
+ type: "password" | "text" | "email" | "select" | "checkbox";
658
+ name: string;
659
+ label: string;
660
+ observedOptions?: string[] | undefined;
661
+ }[];
662
+ } | {
663
+ method: "unknown";
664
+ instruction: string;
665
+ };
666
+ }>, "many">>;
667
+ recommendation: z.ZodString;
668
+ }, "strip", z.ZodTypeAny, {
669
+ type: "unknown" | "form-login" | "oauth" | "magic-link" | "none";
670
+ loginUrl: string | null;
671
+ provider: string | null;
672
+ hasAuth: boolean;
673
+ observedSelectors: {
674
+ usernameSelector: string | null;
675
+ passwordSelector: string | null;
676
+ submitSelector: string | null;
677
+ } | null;
678
+ oauthButtons: {
679
+ text: string;
680
+ provider: string;
681
+ }[];
682
+ recommendation: string;
683
+ authOptions?: {
684
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
685
+ label: string;
686
+ id: string;
687
+ provider: string | null;
688
+ source: "built-in" | "user-local" | "heuristic";
689
+ automatable: boolean;
690
+ confidence: "high" | "medium" | "low";
691
+ requirements: {
692
+ method: "storage-state";
693
+ instruction: string;
694
+ } | {
695
+ method: "credentials";
696
+ fields: {
697
+ type: "password" | "text" | "email" | "select" | "checkbox";
698
+ name: string;
699
+ label: string;
700
+ observedOptions: string[];
701
+ }[];
702
+ } | {
703
+ method: "unknown";
704
+ instruction: string;
705
+ };
706
+ }[] | undefined;
707
+ }, {
708
+ type: "unknown" | "form-login" | "oauth" | "magic-link" | "none";
709
+ loginUrl: string | null;
710
+ provider: string | null;
711
+ hasAuth: boolean;
712
+ observedSelectors: {
713
+ usernameSelector: string | null;
714
+ passwordSelector: string | null;
715
+ submitSelector: string | null;
716
+ } | null;
717
+ oauthButtons: {
718
+ text: string;
719
+ provider: string;
720
+ }[];
721
+ recommendation: string;
722
+ authOptions?: {
723
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
724
+ label: string;
725
+ id: string;
726
+ provider: string | null;
727
+ source: "built-in" | "user-local" | "heuristic";
728
+ automatable: boolean;
729
+ confidence: "high" | "medium" | "low";
730
+ requirements: {
731
+ method: "storage-state";
732
+ instruction: string;
733
+ } | {
734
+ method: "credentials";
735
+ fields: {
736
+ type: "password" | "text" | "email" | "select" | "checkbox";
737
+ name: string;
738
+ label: string;
739
+ observedOptions?: string[] | undefined;
740
+ }[];
741
+ } | {
742
+ method: "unknown";
743
+ instruction: string;
744
+ };
745
+ }[] | undefined;
746
+ }>;
747
+ export type DetectedAuth = z.infer<typeof DetectedAuthSchema>;
592
748
  export declare const AuthExplorationSchema: z.ZodObject<{
593
749
  url: z.ZodString;
594
750
  authRequired: z.ZodBoolean;
@@ -655,10 +811,10 @@ export declare const AuthExplorationSchema: z.ZodObject<{
655
811
  instruction: string;
656
812
  }>]>;
657
813
  }, "strip", z.ZodTypeAny, {
658
- type: "unknown" | "form-login" | "oauth" | "magic-link" | "oauth-unknown" | "form-multi";
659
- provider: string | null;
814
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
660
815
  label: string;
661
816
  id: string;
817
+ provider: string | null;
662
818
  source: "built-in" | "user-local" | "heuristic";
663
819
  automatable: boolean;
664
820
  confidence: "high" | "medium" | "low";
@@ -678,10 +834,10 @@ export declare const AuthExplorationSchema: z.ZodObject<{
678
834
  instruction: string;
679
835
  };
680
836
  }, {
681
- type: "unknown" | "form-login" | "oauth" | "magic-link" | "oauth-unknown" | "form-multi";
682
- provider: string | null;
837
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
683
838
  label: string;
684
839
  id: string;
840
+ provider: string | null;
685
841
  source: "built-in" | "user-local" | "heuristic";
686
842
  automatable: boolean;
687
843
  confidence: "high" | "medium" | "low";
@@ -718,10 +874,10 @@ export declare const AuthExplorationSchema: z.ZodObject<{
718
874
  authRequired: boolean;
719
875
  authScope: "none" | "site-wide" | "section-only" | "optional";
720
876
  authPaths: {
721
- type: "unknown" | "form-login" | "oauth" | "magic-link" | "oauth-unknown" | "form-multi";
722
- provider: string | null;
877
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
723
878
  label: string;
724
879
  id: string;
880
+ provider: string | null;
725
881
  source: "built-in" | "user-local" | "heuristic";
726
882
  automatable: boolean;
727
883
  confidence: "high" | "medium" | "low";
@@ -752,10 +908,10 @@ export declare const AuthExplorationSchema: z.ZodObject<{
752
908
  authRequired: boolean;
753
909
  authScope: "none" | "site-wide" | "section-only" | "optional";
754
910
  authPaths: {
755
- type: "unknown" | "form-login" | "oauth" | "magic-link" | "oauth-unknown" | "form-multi";
756
- provider: string | null;
911
+ type: "unknown" | "form-login" | "oauth" | "oauth-unknown" | "form-multi" | "magic-link";
757
912
  label: string;
758
913
  id: string;
914
+ provider: string | null;
759
915
  source: "built-in" | "user-local" | "heuristic";
760
916
  automatable: boolean;
761
917
  confidence: "high" | "medium" | "low";
@@ -1 +1 @@
1
- {"version":3,"file":"config.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/config.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,SAAS,CAAC;AACpD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,aAAa,GAAG,mBAAmB,GAAG,KAAK,GAAG,eAAe,CAAC;AAEvG,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBvB,CAAC;AAEH,QAAA,MAAM,sBAAsB;;;;;;;;;EAG1B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA8E,CAAC;AAE5G,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAehC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -65,24 +65,6 @@ export const HarnessConfigSchema = z.object({
65
65
  export function resolveMaxOutputTokensPerLlmCall(config) {
66
66
  return config.llmMaxOutputTokensPerCall ?? config.llmTokenBudget;
67
67
  }
68
- export const DetectedAuthSchema = z.object({
69
- hasAuth: z.boolean(),
70
- type: z.enum(['none', 'form-login', 'oauth', 'magic-link', 'unknown']),
71
- provider: z.string().nullable(),
72
- loginUrl: z.string().nullable(),
73
- observedSelectors: z
74
- .object({
75
- usernameSelector: z.string().nullable(),
76
- passwordSelector: z.string().nullable(),
77
- submitSelector: z.string().nullable(),
78
- })
79
- .nullable(),
80
- oauthButtons: z.array(z.object({
81
- provider: z.string(),
82
- text: z.string(),
83
- })),
84
- recommendation: z.string(),
85
- });
86
68
  export const AuthPathRequirementsSchema = z.discriminatedUnion('method', [
87
69
  z.object({ method: z.literal('storage-state'), instruction: z.string() }),
88
70
  z.object({
@@ -106,6 +88,25 @@ export const AuthPathSchema = z.object({
106
88
  confidence: z.enum(['high', 'medium', 'low']),
107
89
  requirements: AuthPathRequirementsSchema,
108
90
  });
91
+ export const DetectedAuthSchema = z.object({
92
+ hasAuth: z.boolean(),
93
+ type: z.enum(['none', 'form-login', 'oauth', 'magic-link', 'unknown']),
94
+ provider: z.string().nullable(),
95
+ loginUrl: z.string().nullable(),
96
+ observedSelectors: z
97
+ .object({
98
+ usernameSelector: z.string().nullable(),
99
+ passwordSelector: z.string().nullable(),
100
+ submitSelector: z.string().nullable(),
101
+ })
102
+ .nullable(),
103
+ oauthButtons: z.array(z.object({
104
+ provider: z.string(),
105
+ text: z.string(),
106
+ })),
107
+ authOptions: z.array(AuthPathSchema).optional(),
108
+ recommendation: z.string(),
109
+ });
109
110
  export const AuthExplorationSchema = z.object({
110
111
  url: z.string(),
111
112
  authRequired: z.boolean(),
@@ -4,6 +4,6 @@ export { RouteInventorySchema, RouteSchema, A11yViolationSchema, BrokenLinkSchem
4
4
  export { GapAnalysisSchema, GapSchema, NeutralScenarioSchema, GeneratedTestSchema, TestStepSchema, FrameworkRecommendationSchema, type GapAnalysis, type Gap, type NeutralScenario, type GeneratedTest, type TestStep, type FrameworkRecommendation, } from './gap-analysis.schema.js';
5
5
  export { CostIntelligenceSchema, LlmUsageRecordSchema, LlmDataQualitySchema, LlmOperationTypeSchema, RepeatedAiPatternSchema, DeterministicMaturitySchema, type CostIntelligence, type LlmUsageRecord, type LlmDataQuality, type LlmOperationType, type RepeatedAiPattern, type DeterministicMaturity, } from './cost-intelligence.schema.js';
6
6
  export { RepoAnalysisSchema, FrameworkDetectionSchema, DetectedFrameworkPrimarySchema, FrameworkDetectionConfidenceSchema, TestFrameworkDetectedSchema, type RepoAnalysis, type FrameworkDetectionResult, type DetectedFrameworkPrimary, } from './repo-analysis.schema.js';
7
- export { AutomationMaturitySchema, AutomationMaturityDimensionSchema, type AutomationMaturity, type AutomationMaturityDimension, } from './automation-maturity.schema.js';
7
+ export { AutomationMaturitySchema, AutomationMaturityDimensionSchema, AutomationMaturityApplicabilitySchema, type AutomationMaturity, type AutomationMaturityDimension, type AutomationMaturityApplicability, } from './automation-maturity.schema.js';
8
8
  export { PublicSurfaceSchema, PublicSurfaceViolationSchema, PublicSurfaceBrokenLinkSchema, type PublicSurface, type PublicSurfaceViolation, type PublicSurfaceBrokenLink, } from './public-surface.schema.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"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kB,EACvB,KAAK,2BAA2B,GACjC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,6BAA6B,EAC7B,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gCAAgC,EAChC,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,KAAK,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,6BAA6B,EAC7B,KAAK,WAAW,EAChB,KAAK,GAAG,EACR,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,2BAA2B,EAC3B,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,iCAAiC,EACjC,qCAAqC,EACrC,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,GACrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,6BAA6B,EAC7B,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,4BAA4B,CAAC"}
@@ -4,5 +4,5 @@ export { RouteInventorySchema, RouteSchema, A11yViolationSchema, BrokenLinkSchem
4
4
  export { GapAnalysisSchema, GapSchema, NeutralScenarioSchema, GeneratedTestSchema, TestStepSchema, FrameworkRecommendationSchema, } from './gap-analysis.schema.js';
5
5
  export { CostIntelligenceSchema, LlmUsageRecordSchema, LlmDataQualitySchema, LlmOperationTypeSchema, RepeatedAiPatternSchema, DeterministicMaturitySchema, } from './cost-intelligence.schema.js';
6
6
  export { RepoAnalysisSchema, FrameworkDetectionSchema, DetectedFrameworkPrimarySchema, FrameworkDetectionConfidenceSchema, TestFrameworkDetectedSchema, } from './repo-analysis.schema.js';
7
- export { AutomationMaturitySchema, AutomationMaturityDimensionSchema, } from './automation-maturity.schema.js';
7
+ export { AutomationMaturitySchema, AutomationMaturityDimensionSchema, AutomationMaturityApplicabilitySchema, } from './automation-maturity.schema.js';
8
8
  export { PublicSurfaceSchema, PublicSurfaceViolationSchema, PublicSurfaceBrokenLinkSchema, } from './public-surface.schema.js';
@@ -104,6 +104,7 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
104
104
  coveredPaths: string[];
105
105
  }>, "many">;
106
106
  missingTestIds: z.ZodArray<z.ZodString, "many">;
107
+ interactiveTsxFilesScanned: z.ZodOptional<z.ZodNumber>;
107
108
  cypressStructure: z.ZodObject<{
108
109
  detected: z.ZodBoolean;
109
110
  e2eFolder: z.ZodOptional<z.ZodString>;
@@ -160,20 +161,27 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
160
161
  weight: z.ZodNumber;
161
162
  evidence: z.ZodArray<z.ZodString, "many">;
162
163
  recommendations: z.ZodArray<z.ZodString, "many">;
164
+ applicability: z.ZodOptional<z.ZodEnum<["applicable", "not_applicable", "unknown"]>>;
165
+ reason: z.ZodOptional<z.ZodString>;
163
166
  }, "strip", z.ZodTypeAny, {
164
167
  recommendations: string[];
165
168
  dimension: "test-coverage-breadth" | "framework-adoption" | "test-id-hygiene" | "ci-integration" | "auth-test-coverage" | "component-test-ratio";
166
169
  score: number;
167
170
  weight: number;
168
171
  evidence: string[];
172
+ reason?: string | undefined;
173
+ applicability?: "unknown" | "applicable" | "not_applicable" | undefined;
169
174
  }, {
170
175
  recommendations: string[];
171
176
  dimension: "test-coverage-breadth" | "framework-adoption" | "test-id-hygiene" | "ci-integration" | "auth-test-coverage" | "component-test-ratio";
172
177
  score: number;
173
178
  weight: number;
174
179
  evidence: string[];
180
+ reason?: string | undefined;
181
+ applicability?: "unknown" | "applicable" | "not_applicable" | undefined;
175
182
  }>, "many">;
176
183
  topRecommendations: z.ZodArray<z.ZodString, "many">;
184
+ scoreFormula: z.ZodOptional<z.ZodString>;
177
185
  }, "strip", z.ZodTypeAny, {
178
186
  label: string;
179
187
  level: number;
@@ -186,8 +194,11 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
186
194
  score: number;
187
195
  weight: number;
188
196
  evidence: string[];
197
+ reason?: string | undefined;
198
+ applicability?: "unknown" | "applicable" | "not_applicable" | undefined;
189
199
  }[];
190
200
  topRecommendations: string[];
201
+ scoreFormula?: string | undefined;
191
202
  }, {
192
203
  label: string;
193
204
  level: number;
@@ -200,8 +211,11 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
200
211
  score: number;
201
212
  weight: number;
202
213
  evidence: string[];
214
+ reason?: string | undefined;
215
+ applicability?: "unknown" | "applicable" | "not_applicable" | undefined;
203
216
  }[];
204
217
  topRecommendations: string[];
218
+ scoreFormula?: string | undefined;
205
219
  }>>;
206
220
  }, "strip", z.ZodTypeAny, {
207
221
  scannedAt: string;
@@ -227,6 +241,7 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
227
241
  fixturesFolder?: string | undefined;
228
242
  supportFolder?: string | undefined;
229
243
  };
244
+ interactiveTsxFilesScanned?: number | undefined;
230
245
  framework?: {
231
246
  confidence: "high" | "medium" | "low";
232
247
  evidence: string[];
@@ -245,8 +260,11 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
245
260
  score: number;
246
261
  weight: number;
247
262
  evidence: string[];
263
+ reason?: string | undefined;
264
+ applicability?: "unknown" | "applicable" | "not_applicable" | undefined;
248
265
  }[];
249
266
  topRecommendations: string[];
267
+ scoreFormula?: string | undefined;
250
268
  } | undefined;
251
269
  }, {
252
270
  scannedAt: string;
@@ -272,6 +290,7 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
272
290
  fixturesFolder?: string | undefined;
273
291
  supportFolder?: string | undefined;
274
292
  };
293
+ interactiveTsxFilesScanned?: number | undefined;
275
294
  framework?: {
276
295
  confidence: "high" | "medium" | "low";
277
296
  evidence: string[];
@@ -290,8 +309,11 @@ export declare const RepoAnalysisSchema: z.ZodObject<{
290
309
  score: number;
291
310
  weight: number;
292
311
  evidence: string[];
312
+ reason?: string | undefined;
313
+ applicability?: "unknown" | "applicable" | "not_applicable" | undefined;
293
314
  }[];
294
315
  topRecommendations: string[];
316
+ scoreFormula?: string | undefined;
295
317
  } | undefined;
296
318
  }>;
297
319
  export type RepoAnalysis = z.infer<typeof RepoAnalysisSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"repo-analysis.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/repo-analysis.schema.ts"],"names":[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eAAO,MAAM,kCAAkC,sCAAoC,CAAC;AAEpF,eAAO,MAAM,2BAA2B,0FAOtC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;EAKnC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;EAIzB,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;EASjC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -52,6 +52,7 @@ export const RepoAnalysisSchema = z.object({
52
52
  routes: z.array(RepoRouteSchema),
53
53
  testFiles: z.array(TestFileSchema),
54
54
  missingTestIds: z.array(z.string()),
55
+ interactiveTsxFilesScanned: z.number().int().min(0).optional(),
55
56
  cypressStructure: CypressStructureSchema,
56
57
  framework: FrameworkDetectionSchema.optional(),
57
58
  automationMaturity: AutomationMaturitySchema.optional(),
@@ -1,3 +1,25 @@
1
1
  import type { TelemetryEvent, TelemetryEventKind, TelemetrySink } from './telemetry.interface.js';
2
2
  export declare function emitTelemetry(sink: TelemetrySink | undefined, kind: TelemetryEventKind, sessionId: string, metadata: TelemetryEvent['metadata'], durationMs?: number): void;
3
+ /**
4
+ * Strip the query string and fragment from a URL before emitting it in telemetry.
5
+ *
6
+ * Telemetry must not carry credentials, share tokens, or any other secret-shaped
7
+ * material that callers may embed in query strings (e.g. `?token=...`, `?key=...`).
8
+ * Returns `origin + pathname` only for valid `http:` / `https:` URLs, and additionally
9
+ * strips any `user:pass@` userinfo from the origin.
10
+ *
11
+ * If the input is not a valid `http(s)` URL, this helper returns the literal string
12
+ * `'[redacted-non-url]'` rather than echoing the original input. Two reasons:
13
+ *
14
+ * 1. `new URL(...)` parses many `scheme:rest` shapes that are not real URLs
15
+ * (e.g. `mailto:`, custom `user:pass@host`, `data:`). Those still produce a
16
+ * non-empty `origin + pathname` and would echo the right-hand side back.
17
+ * 2. The exported helper makes no assumption about caller provenance: a non-URL
18
+ * string passed in may itself be secret-shaped (a raw token, a path with
19
+ * embedded credentials, etc.), so the only safe fallback is to discard the
20
+ * value entirely.
21
+ *
22
+ * Telemetry never throws on malformed input.
23
+ */
24
+ export declare function redactUrlForTelemetry(url: string): string;
3
25
  //# sourceMappingURL=emit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/telemetry/emit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAElG,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI,CASN"}
1
+ {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/telemetry/emit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAElG,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI,CASN;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAczD"}
@@ -9,3 +9,40 @@ export function emitTelemetry(sink, kind, sessionId, metadata, durationMs) {
9
9
  ...(durationMs !== undefined && { durationMs }),
10
10
  });
11
11
  }
12
+ /**
13
+ * Strip the query string and fragment from a URL before emitting it in telemetry.
14
+ *
15
+ * Telemetry must not carry credentials, share tokens, or any other secret-shaped
16
+ * material that callers may embed in query strings (e.g. `?token=...`, `?key=...`).
17
+ * Returns `origin + pathname` only for valid `http:` / `https:` URLs, and additionally
18
+ * strips any `user:pass@` userinfo from the origin.
19
+ *
20
+ * If the input is not a valid `http(s)` URL, this helper returns the literal string
21
+ * `'[redacted-non-url]'` rather than echoing the original input. Two reasons:
22
+ *
23
+ * 1. `new URL(...)` parses many `scheme:rest` shapes that are not real URLs
24
+ * (e.g. `mailto:`, custom `user:pass@host`, `data:`). Those still produce a
25
+ * non-empty `origin + pathname` and would echo the right-hand side back.
26
+ * 2. The exported helper makes no assumption about caller provenance: a non-URL
27
+ * string passed in may itself be secret-shaped (a raw token, a path with
28
+ * embedded credentials, etc.), so the only safe fallback is to discard the
29
+ * value entirely.
30
+ *
31
+ * Telemetry never throws on malformed input.
32
+ */
33
+ export function redactUrlForTelemetry(url) {
34
+ let parsed;
35
+ try {
36
+ parsed = new URL(url);
37
+ }
38
+ catch {
39
+ return '[redacted-non-url]';
40
+ }
41
+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
42
+ return '[redacted-non-url]';
43
+ }
44
+ // Strip any user:pass@ from the origin. `URL.origin` already omits userinfo,
45
+ // but rebuilding from `protocol + host` makes the intent explicit and removes
46
+ // any chance of credentials leaking through future Node URL changes.
47
+ return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
48
+ }