@qulib/core 0.6.0 → 0.8.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.
- package/dist/__tests__/fixtures/api-fixture-repo/app/api/orders/route.d.ts +7 -0
- package/dist/__tests__/fixtures/api-fixture-repo/app/api/orders/route.d.ts.map +1 -0
- package/dist/__tests__/fixtures/api-fixture-repo/app/api/orders/route.js +7 -0
- package/dist/__tests__/fixtures/api-fixture-repo/app/api/users/route.d.ts +10 -0
- package/dist/__tests__/fixtures/api-fixture-repo/app/api/users/route.d.ts.map +1 -0
- package/dist/__tests__/fixtures/api-fixture-repo/app/api/users/route.js +9 -0
- package/dist/__tests__/fixtures/api-fixture-repo/pages/api/health.d.ts +9 -0
- package/dist/__tests__/fixtures/api-fixture-repo/pages/api/health.d.ts.map +1 -0
- package/dist/__tests__/fixtures/api-fixture-repo/pages/api/health.js +10 -0
- package/dist/adapters/api-adapter.d.ts +26 -0
- package/dist/adapters/api-adapter.d.ts.map +1 -1
- package/dist/adapters/api-adapter.js +156 -2
- package/dist/adapters/cypress-e2e-adapter.d.ts.map +1 -1
- package/dist/adapters/cypress-e2e-adapter.js +63 -2
- package/dist/adapters/playwright-adapter.d.ts.map +1 -1
- package/dist/adapters/playwright-adapter.js +71 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/scaffold-tests.d.ts +34 -0
- package/dist/scaffold-tests.d.ts.map +1 -0
- package/dist/scaffold-tests.js +113 -0
- package/dist/schemas/automation-maturity.schema.d.ts +8 -8
- package/dist/schemas/automation-maturity.schema.d.ts.map +1 -1
- package/dist/schemas/automation-maturity.schema.js +1 -0
- package/dist/schemas/gap-analysis.schema.d.ts +8 -8
- package/dist/schemas/gap-analysis.schema.js +1 -1
- package/dist/schemas/public-surface.schema.d.ts +5 -5
- package/dist/schemas/repo-analysis.schema.d.ts +7 -7
- package/dist/tools/repo/api-surface.d.ts +59 -0
- package/dist/tools/repo/api-surface.d.ts.map +1 -0
- package/dist/tools/repo/api-surface.js +414 -0
- package/dist/tools/scoring/api-coverage.d.ts +74 -0
- package/dist/tools/scoring/api-coverage.d.ts.map +1 -0
- package/dist/tools/scoring/api-coverage.js +158 -0
- package/dist/tools/scoring/automation-maturity.d.ts +11 -1
- package/dist/tools/scoring/automation-maturity.d.ts.map +1 -1
- package/dist/tools/scoring/automation-maturity.js +43 -9
- package/package.json +4 -2
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { AutomationMaturitySchema } from '../../schemas/automation-maturity.schema.js';
|
|
4
|
+
import { REBALANCED_WEIGHTS } from './api-coverage.js';
|
|
4
5
|
/**
|
|
5
|
-
* Dimension weights (sum = 1).
|
|
6
|
-
*
|
|
6
|
+
* Dimension weights (sum = 1).
|
|
7
|
+
*
|
|
8
|
+
* When apiSurface is NOT provided (backward-compat path), the original 6 dimensions
|
|
9
|
+
* continue to use the original weights (sum = 1.0). When apiSurface IS provided, the
|
|
10
|
+
* rebalanced weights from api-coverage.ts are used and the 7th dimension is added.
|
|
11
|
+
*
|
|
12
|
+
* Original weights (no API surface):
|
|
13
|
+
* test-coverage-breadth 0.28, framework-adoption 0.22, test-id-hygiene 0.18,
|
|
14
|
+
* ci-integration 0.14, auth-test-coverage 0.10, component-test-ratio 0.08
|
|
15
|
+
*
|
|
16
|
+
* Rebalanced weights (with API surface, sum still = 1.0 across all 7):
|
|
17
|
+
* test-coverage-breadth 0.24, framework-adoption 0.19, test-id-hygiene 0.15,
|
|
18
|
+
* ci-integration 0.12, auth-test-coverage 0.09, component-test-ratio 0.06,
|
|
19
|
+
* api-test-coverage 0.15
|
|
7
20
|
*/
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
21
|
+
const W_TEST_BREADTH_ORIGINAL = 0.28;
|
|
22
|
+
const W_FRAMEWORK_ORIGINAL = 0.22;
|
|
23
|
+
const W_TEST_ID_ORIGINAL = 0.18;
|
|
24
|
+
const W_CI_ORIGINAL = 0.14;
|
|
25
|
+
const W_AUTH_TESTS_ORIGINAL = 0.1;
|
|
26
|
+
const W_COMPONENT_RATIO_ORIGINAL = 0.08;
|
|
14
27
|
function hasCiAtRoot(repoPath) {
|
|
15
28
|
const ev = [];
|
|
16
29
|
const gh = join(repoPath, '.github', 'workflows');
|
|
@@ -49,7 +62,24 @@ function scoreLevel(overall) {
|
|
|
49
62
|
return { level: 4, label: 'L4 — strong automation' };
|
|
50
63
|
return { level: 5, label: 'L5 — advanced QA automation' };
|
|
51
64
|
}
|
|
52
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Compute automation maturity for a repo.
|
|
67
|
+
*
|
|
68
|
+
* @param repo - The scanned repo analysis.
|
|
69
|
+
* @param apiCoverageResult - Optional pre-computed API coverage result. When absent the
|
|
70
|
+
* 6 original dimensions are scored with the original weights (backward-compatible).
|
|
71
|
+
* When provided, a 7th dimension (`api-test-coverage`) is added and weights are
|
|
72
|
+
* rebalanced so the total still sums to 1.0 across applicable dimensions.
|
|
73
|
+
*/
|
|
74
|
+
export function computeAutomationMaturity(repo, apiCoverageResult) {
|
|
75
|
+
// Choose weights based on whether we have an API surface result
|
|
76
|
+
const hasApiDim = apiCoverageResult !== undefined;
|
|
77
|
+
const W_TEST_BREADTH = hasApiDim ? REBALANCED_WEIGHTS.TEST_BREADTH : W_TEST_BREADTH_ORIGINAL;
|
|
78
|
+
const W_FRAMEWORK = hasApiDim ? REBALANCED_WEIGHTS.FRAMEWORK : W_FRAMEWORK_ORIGINAL;
|
|
79
|
+
const W_TEST_ID = hasApiDim ? REBALANCED_WEIGHTS.TEST_ID : W_TEST_ID_ORIGINAL;
|
|
80
|
+
const W_CI = hasApiDim ? REBALANCED_WEIGHTS.CI : W_CI_ORIGINAL;
|
|
81
|
+
const W_AUTH_TESTS = hasApiDim ? REBALANCED_WEIGHTS.AUTH_TESTS : W_AUTH_TESTS_ORIGINAL;
|
|
82
|
+
const W_COMPONENT_RATIO = hasApiDim ? REBALANCED_WEIGHTS.COMPONENT_RATIO : W_COMPONENT_RATIO_ORIGINAL;
|
|
53
83
|
const routePaths = [...new Set(repo.routes.map((r) => r.path))];
|
|
54
84
|
let coveredRoutes = 0;
|
|
55
85
|
for (const p of routePaths) {
|
|
@@ -204,6 +234,10 @@ export function computeAutomationMaturity(repo) {
|
|
|
204
234
|
...(compGuidance && { guidance: compGuidance }),
|
|
205
235
|
};
|
|
206
236
|
const dimensions = [breadthDim, frameworkDim, hygieneDim, ciDim, authDim, compDim];
|
|
237
|
+
// Append api-test-coverage dimension when an API surface result was provided
|
|
238
|
+
if (apiCoverageResult) {
|
|
239
|
+
dimensions.push(apiCoverageResult.dimension);
|
|
240
|
+
}
|
|
207
241
|
// Overall score normalizes over applicable dimensions only.
|
|
208
242
|
// overallScore = round( Σ score_i * weight_i / Σ weight_i ) for i ∈ applicable.
|
|
209
243
|
// If no dimension is applicable (degenerate repo), overall = 0 and level = L1.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qulib/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Qulib — analyze deployed web apps for honest quality gaps (CLI + programmatic API)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Tapesh Nagarwal",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"analyze": "tsx src/cli/index.ts analyze",
|
|
49
49
|
"clean": "tsx src/cli/index.ts clean",
|
|
50
50
|
"build": "tsc",
|
|
51
|
-
"test": "node --import tsx/esm --test src/llm/__tests__/cost-intelligence.test.ts src/llm/__tests__/context-builder.test.ts src/tools/scoring/__tests__/gaps.test.ts src/tools/auth/__tests__/gaps.test.ts src/tools/auth/__tests__/detect.test.ts src/tools/scoring/__tests__/automation-maturity.test.ts src/harness/__tests__/state-manager.test.ts src/telemetry/__tests__/redact-url.test.ts src/cli/__tests__/auth-login.test.ts src/cli/__tests__/cli-version.test.ts src/__tests__/agent-summary.test.ts src/__tests__/cli-agent-summary.test.ts src/__tests__/analyze.storage-state-invalid.test.ts src/__tests__/analyze.fixtures.test.ts",
|
|
51
|
+
"test": "node --import tsx/esm --test src/llm/__tests__/cost-intelligence.test.ts src/llm/__tests__/context-builder.test.ts src/tools/scoring/__tests__/gaps.test.ts src/tools/auth/__tests__/gaps.test.ts src/tools/auth/__tests__/detect.test.ts src/tools/scoring/__tests__/automation-maturity.test.ts src/tools/scoring/__tests__/api-coverage.test.ts src/tools/scoring/__tests__/automation-maturity-with-api.test.ts src/harness/__tests__/state-manager.test.ts src/telemetry/__tests__/redact-url.test.ts src/cli/__tests__/auth-login.test.ts src/cli/__tests__/cli-version.test.ts src/__tests__/agent-summary.test.ts src/__tests__/cli-agent-summary.test.ts src/__tests__/analyze.storage-state-invalid.test.ts src/__tests__/analyze.fixtures.test.ts src/adapters/__tests__/playwright-adapter.test.ts src/adapters/__tests__/api-adapter.test.ts src/tools/repo/__tests__/api-surface.test.ts",
|
|
52
52
|
"test:integration": "node --import tsx/esm --test src/__tests__/analyze.integration.test.ts",
|
|
53
53
|
"smoke": "tsx src/cli/index.ts analyze --url https://example.com --ephemeral",
|
|
54
54
|
"cost-doctor": "tsx src/cli/index.ts cost doctor"
|
|
@@ -58,9 +58,11 @@
|
|
|
58
58
|
"@playwright/test": "^1.44.0",
|
|
59
59
|
"commander": "^12.1.0",
|
|
60
60
|
"fast-glob": "^3.3.2",
|
|
61
|
+
"js-yaml": "^4.2.0",
|
|
61
62
|
"zod": "^3.23.0"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
65
|
+
"@types/js-yaml": "^4.0.9",
|
|
64
66
|
"@types/node": "^20.0.0",
|
|
65
67
|
"tsx": "^4.11.0",
|
|
66
68
|
"typescript": "^5.4.0"
|