@qulib/core 0.5.1 → 0.5.3

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 (97) hide show
  1. package/README.md +9 -9
  2. package/dist/cli/index.js +3 -3
  3. package/dist/llm/context-builder.js +2 -2
  4. package/dist/tools/auth/detect.d.ts +8 -0
  5. package/dist/tools/auth/detect.d.ts.map +1 -1
  6. package/dist/tools/auth/detect.js +46 -9
  7. package/package.json +2 -2
  8. package/dist/tools/apply-auth.d.ts +0 -4
  9. package/dist/tools/apply-auth.d.ts.map +0 -1
  10. package/dist/tools/apply-auth.js +0 -35
  11. package/dist/tools/auth/block-gap.d.ts +0 -9
  12. package/dist/tools/auth/block-gap.d.ts.map +0 -1
  13. package/dist/tools/auth/block-gap.js +0 -52
  14. package/dist/tools/auth/detector.d.ts +0 -23
  15. package/dist/tools/auth/detector.d.ts.map +0 -1
  16. package/dist/tools/auth/detector.js +0 -526
  17. package/dist/tools/auth/explorer.d.ts +0 -4
  18. package/dist/tools/auth/explorer.d.ts.map +0 -1
  19. package/dist/tools/auth/explorer.js +0 -346
  20. package/dist/tools/auth/oauth-providers.d.ts +0 -7
  21. package/dist/tools/auth/oauth-providers.d.ts.map +0 -1
  22. package/dist/tools/auth/oauth-providers.js +0 -21
  23. package/dist/tools/auth/surface-analyzer.d.ts +0 -4
  24. package/dist/tools/auth/surface-analyzer.d.ts.map +0 -1
  25. package/dist/tools/auth/surface-analyzer.js +0 -170
  26. package/dist/tools/auth/user-providers.d.ts +0 -15
  27. package/dist/tools/auth/user-providers.d.ts.map +0 -1
  28. package/dist/tools/auth/user-providers.js +0 -62
  29. package/dist/tools/auth-block-gap.d.ts +0 -9
  30. package/dist/tools/auth-block-gap.d.ts.map +0 -1
  31. package/dist/tools/auth-block-gap.js +0 -52
  32. package/dist/tools/auth-detector.d.ts +0 -23
  33. package/dist/tools/auth-detector.d.ts.map +0 -1
  34. package/dist/tools/auth-detector.js +0 -526
  35. package/dist/tools/auth-explorer.d.ts +0 -4
  36. package/dist/tools/auth-explorer.d.ts.map +0 -1
  37. package/dist/tools/auth-explorer.js +0 -346
  38. package/dist/tools/auth-surface-analyzer.d.ts +0 -4
  39. package/dist/tools/auth-surface-analyzer.d.ts.map +0 -1
  40. package/dist/tools/auth-surface-analyzer.js +0 -170
  41. package/dist/tools/auth.d.ts +0 -4
  42. package/dist/tools/auth.d.ts.map +0 -1
  43. package/dist/tools/auth.js +0 -35
  44. package/dist/tools/automation-maturity.d.ts +0 -4
  45. package/dist/tools/automation-maturity.d.ts.map +0 -1
  46. package/dist/tools/automation-maturity.js +0 -219
  47. package/dist/tools/browser.d.ts +0 -3
  48. package/dist/tools/browser.d.ts.map +0 -1
  49. package/dist/tools/browser.js +0 -13
  50. package/dist/tools/cypress-explorer.d.ts +0 -8
  51. package/dist/tools/cypress-explorer.d.ts.map +0 -1
  52. package/dist/tools/cypress-explorer.js +0 -5
  53. package/dist/tools/explorer-factory.d.ts +0 -4
  54. package/dist/tools/explorer-factory.d.ts.map +0 -1
  55. package/dist/tools/explorer-factory.js +0 -12
  56. package/dist/tools/explorer.interface.d.ts +0 -7
  57. package/dist/tools/explorer.interface.d.ts.map +0 -1
  58. package/dist/tools/explorer.interface.js +0 -1
  59. package/dist/tools/explorers/cypress-explorer.d.ts +0 -8
  60. package/dist/tools/explorers/cypress-explorer.d.ts.map +0 -1
  61. package/dist/tools/explorers/cypress-explorer.js +0 -5
  62. package/dist/tools/explorers/explorer.interface.d.ts +0 -7
  63. package/dist/tools/explorers/explorer.interface.d.ts.map +0 -1
  64. package/dist/tools/explorers/explorer.interface.js +0 -1
  65. package/dist/tools/explorers/playwright-explorer.d.ts +0 -8
  66. package/dist/tools/explorers/playwright-explorer.d.ts.map +0 -1
  67. package/dist/tools/explorers/playwright-explorer.js +0 -172
  68. package/dist/tools/framework-detector.d.ts +0 -15
  69. package/dist/tools/framework-detector.d.ts.map +0 -1
  70. package/dist/tools/framework-detector.js +0 -153
  71. package/dist/tools/gap-engine.d.ts +0 -8
  72. package/dist/tools/gap-engine.d.ts.map +0 -1
  73. package/dist/tools/gap-engine.js +0 -138
  74. package/dist/tools/oauth-providers.d.ts +0 -7
  75. package/dist/tools/oauth-providers.d.ts.map +0 -1
  76. package/dist/tools/oauth-providers.js +0 -21
  77. package/dist/tools/playwright-explorer.d.ts +0 -8
  78. package/dist/tools/playwright-explorer.d.ts.map +0 -1
  79. package/dist/tools/playwright-explorer.js +0 -172
  80. package/dist/tools/public-surface.d.ts +0 -5
  81. package/dist/tools/public-surface.d.ts.map +0 -1
  82. package/dist/tools/public-surface.js +0 -13
  83. package/dist/tools/repo/framework-detector.d.ts +0 -15
  84. package/dist/tools/repo/framework-detector.d.ts.map +0 -1
  85. package/dist/tools/repo/framework-detector.js +0 -153
  86. package/dist/tools/repo/scanner.d.ts +0 -19
  87. package/dist/tools/repo/scanner.d.ts.map +0 -1
  88. package/dist/tools/repo/scanner.js +0 -181
  89. package/dist/tools/repo-scanner.d.ts +0 -19
  90. package/dist/tools/repo-scanner.d.ts.map +0 -1
  91. package/dist/tools/repo-scanner.js +0 -181
  92. package/dist/tools/scoring/gap-engine.d.ts +0 -8
  93. package/dist/tools/scoring/gap-engine.d.ts.map +0 -1
  94. package/dist/tools/scoring/gap-engine.js +0 -138
  95. package/dist/tools/user-providers.d.ts +0 -15
  96. package/dist/tools/user-providers.d.ts.map +0 -1
  97. package/dist/tools/user-providers.js +0 -62
@@ -1,138 +0,0 @@
1
- import { randomUUID } from 'node:crypto';
2
- import { GapSchema } from '../../schemas/gap-analysis.schema.js';
3
- // TODO: Add category-specific weight overrides (e.g., auth-surface gaps should cost more than untested-route gaps by default).
4
- // Requires a 2D weight matrix: { [severity]: { [category]: number } }.
5
- // Deferred until there is empirical data from real scan runs to calibrate.
6
- const DEFAULT_SCORING_WEIGHTS = { critical: 25, high: 20, medium: 8, low: 3 };
7
- export function computeQualityScoreFromGaps(gaps, scoringWeights) {
8
- let critical = 0;
9
- let high = 0;
10
- let medium = 0;
11
- let low = 0;
12
- for (const g of gaps) {
13
- if (g.severity === 'critical')
14
- critical++;
15
- else if (g.severity === 'high')
16
- high++;
17
- else if (g.severity === 'medium')
18
- medium++;
19
- else
20
- low++;
21
- }
22
- const w = {
23
- critical: scoringWeights?.critical ?? DEFAULT_SCORING_WEIGHTS.critical,
24
- high: scoringWeights?.high ?? DEFAULT_SCORING_WEIGHTS.high,
25
- medium: scoringWeights?.medium ?? DEFAULT_SCORING_WEIGHTS.medium,
26
- low: scoringWeights?.low ?? DEFAULT_SCORING_WEIGHTS.low,
27
- };
28
- return Math.max(0, 100 - critical * w.critical - high * w.high - medium * w.medium - low * w.low);
29
- }
30
- export function computeCoverageScore(routes) {
31
- const scanned = routes.routes.length;
32
- const skipped = routes.pagesSkipped;
33
- const denom = scanned + skipped;
34
- // TODO: return null here once the explorer exposes an explicit "discovered-but-unknown" signal
35
- // (i.e. routes were found but the full set couldn't be confirmed — a low score is misleading)
36
- if (denom === 0) {
37
- if (routes.budgetExceeded) {
38
- return 0;
39
- }
40
- return scanned === 0 ? 0 : 100;
41
- }
42
- return Math.round((100 * scanned) / denom);
43
- }
44
- export function analyzeGaps(routes, repo, mode, config) {
45
- const coveredPaths = new Set();
46
- if (repo) {
47
- for (const testFile of repo.testFiles) {
48
- for (const path of testFile.coveredPaths) {
49
- coveredPaths.add(path);
50
- }
51
- }
52
- }
53
- const gaps = [];
54
- const addGap = (gap) => {
55
- const validated = GapSchema.parse(gap);
56
- gaps.push(validated);
57
- };
58
- let hasNavigationFailures = false;
59
- for (const route of routes.routes) {
60
- if (repo && !coveredPaths.has(route.path)) {
61
- const highRisk = /checkout|payment|auth|login|order/i.test(route.path);
62
- addGap({
63
- id: randomUUID(),
64
- path: route.path,
65
- severity: highRisk ? 'high' : 'medium',
66
- reason: `Route is not covered by existing tests: ${route.path}`,
67
- category: 'untested-route',
68
- });
69
- }
70
- const navErrors = route.consoleErrors.filter((e) => e.startsWith('Navigation error:'));
71
- if (navErrors.length > 0) {
72
- hasNavigationFailures = true;
73
- addGap({
74
- id: randomUUID(),
75
- path: route.path,
76
- severity: 'high',
77
- reason: `Navigation failed: ${navErrors.join('; ')}`,
78
- category: 'console-error',
79
- });
80
- }
81
- else if (route.consoleErrors.length > 0) {
82
- addGap({
83
- id: randomUUID(),
84
- path: route.path,
85
- severity: 'high',
86
- reason: `Console errors detected (${route.consoleErrors.length})`,
87
- category: 'console-error',
88
- });
89
- }
90
- if (route.brokenLinks.length > 0) {
91
- addGap({
92
- id: randomUUID(),
93
- path: route.path,
94
- severity: 'medium',
95
- reason: `Broken or invalid links detected (${route.brokenLinks.length})`,
96
- category: 'broken-link',
97
- });
98
- }
99
- for (const violation of route.a11yViolations) {
100
- const impact = violation.impact.toLowerCase();
101
- const severity = impact === 'critical'
102
- ? 'critical'
103
- : impact === 'serious'
104
- ? 'high'
105
- : impact === 'moderate'
106
- ? 'medium'
107
- : 'low';
108
- addGap({
109
- id: randomUUID(),
110
- path: route.path,
111
- severity,
112
- reason: `A11y violation ${violation.id} (${violation.impact}): ${violation.helpUrl}`,
113
- category: 'a11y',
114
- });
115
- }
116
- }
117
- const releaseConfidence = computeQualityScoreFromGaps(gaps, config.scoringWeights);
118
- const pagesScanned = routes.routes.length;
119
- let coverageWarning;
120
- if (routes.budgetExceeded) {
121
- coverageWarning = 'budget-exceeded';
122
- }
123
- else if (hasNavigationFailures) {
124
- coverageWarning = 'navigation-failures';
125
- }
126
- else if (pagesScanned < config.minPagesForConfidence) {
127
- coverageWarning = 'low-coverage';
128
- }
129
- return {
130
- analyzedAt: new Date().toISOString(),
131
- mode,
132
- releaseConfidence,
133
- coveragePagesScanned: pagesScanned,
134
- coverageBudgetExceeded: routes.budgetExceeded,
135
- coverageWarning,
136
- gaps,
137
- };
138
- }
@@ -1,15 +0,0 @@
1
- import type { OAuthProvider } from './oauth-providers.js';
2
- export interface SerializedProvider {
3
- id: string;
4
- label: string;
5
- patterns: string[];
6
- }
7
- export declare function loadUserProviders(): OAuthProvider[];
8
- export declare function addUserProvider(input: {
9
- id: string;
10
- label: string;
11
- pattern: string;
12
- }): void;
13
- export declare function removeUserProvider(id: string): boolean;
14
- export declare function listUserProviders(): SerializedProvider[];
15
- //# sourceMappingURL=user-providers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-providers.d.ts","sourceRoot":"","sources":["../../src/tools/user-providers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAOnD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAc3F;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAStD;AAED,wBAAgB,iBAAiB,IAAI,kBAAkB,EAAE,CAExD"}
@@ -1,62 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
- import { dirname, join } from 'node:path';
3
- import { homedir } from 'node:os';
4
- const USER_PROVIDERS_PATH = join(homedir(), '.qulib', 'providers.json');
5
- export function loadUserProviders() {
6
- const raw = loadSerialized();
7
- return raw.map((p) => ({
8
- id: p.id,
9
- label: p.label,
10
- patterns: p.patterns.map((src) => new RegExp(src, 'i')),
11
- }));
12
- }
13
- export function addUserProvider(input) {
14
- const existing = loadSerialized();
15
- const idx = existing.findIndex((p) => p.id === input.id);
16
- if (idx >= 0) {
17
- const p = existing[idx];
18
- if (!p.patterns.includes(input.pattern)) {
19
- p.patterns.push(input.pattern);
20
- }
21
- p.label = input.label;
22
- }
23
- else {
24
- existing.push({ id: input.id, label: input.label, patterns: [input.pattern] });
25
- }
26
- ensureDir();
27
- writeFileSync(USER_PROVIDERS_PATH, JSON.stringify(existing, null, 2), 'utf-8');
28
- }
29
- export function removeUserProvider(id) {
30
- const existing = loadSerialized();
31
- const filtered = existing.filter((p) => p.id !== id);
32
- if (filtered.length === existing.length) {
33
- return false;
34
- }
35
- ensureDir();
36
- writeFileSync(USER_PROVIDERS_PATH, JSON.stringify(filtered, null, 2), 'utf-8');
37
- return true;
38
- }
39
- export function listUserProviders() {
40
- return loadSerialized();
41
- }
42
- function loadSerialized() {
43
- if (!existsSync(USER_PROVIDERS_PATH)) {
44
- return [];
45
- }
46
- try {
47
- const parsed = JSON.parse(readFileSync(USER_PROVIDERS_PATH, 'utf-8'));
48
- if (!Array.isArray(parsed)) {
49
- return [];
50
- }
51
- return parsed;
52
- }
53
- catch {
54
- return [];
55
- }
56
- }
57
- function ensureDir() {
58
- const dir = dirname(USER_PROVIDERS_PATH);
59
- if (!existsSync(dir)) {
60
- mkdirSync(dir, { recursive: true });
61
- }
62
- }