playwright-intelligence-engine 0.0.0-stage → 2.0.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/LICENSE +191 -0
- package/README.md +229 -3
- package/bin/pw-intel.js +37 -0
- package/dist/authoring/author.d.ts +83 -0
- package/dist/authoring/author.d.ts.map +1 -0
- package/dist/authoring/generation-contract.d.ts +90 -0
- package/dist/authoring/generation-contract.d.ts.map +1 -0
- package/dist/authoring/hybrid-author.d.ts +6 -0
- package/dist/authoring/hybrid-author.d.ts.map +1 -0
- package/dist/authoring/index.d.ts +7 -0
- package/dist/authoring/index.d.ts.map +1 -0
- package/dist/authoring/llm-author.d.ts +28 -0
- package/dist/authoring/llm-author.d.ts.map +1 -0
- package/dist/authoring/naming/index.d.ts +4 -0
- package/dist/authoring/naming/index.d.ts.map +1 -0
- package/dist/authoring/naming/name-plan.d.ts +45 -0
- package/dist/authoring/naming/name-plan.d.ts.map +1 -0
- package/dist/authoring/naming/name-planner.d.ts +25 -0
- package/dist/authoring/naming/name-planner.d.ts.map +1 -0
- package/dist/authoring/naming/naming-linter.d.ts +20 -0
- package/dist/authoring/naming/naming-linter.d.ts.map +1 -0
- package/dist/authoring/template-author.d.ts +6 -0
- package/dist/authoring/template-author.d.ts.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/collectors/collector-interface.d.ts +7 -0
- package/dist/collectors/collector-interface.d.ts.map +1 -0
- package/dist/collectors/environment-collector.d.ts +12 -0
- package/dist/collectors/environment-collector.d.ts.map +1 -0
- package/dist/collectors/error-collector.d.ts +18 -0
- package/dist/collectors/error-collector.d.ts.map +1 -0
- package/dist/collectors/git-diff-collector.d.ts +20 -0
- package/dist/collectors/git-diff-collector.d.ts.map +1 -0
- package/dist/collectors/live-browser-collector.d.ts +45 -0
- package/dist/collectors/live-browser-collector.d.ts.map +1 -0
- package/dist/collectors/network-collector.d.ts +28 -0
- package/dist/collectors/network-collector.d.ts.map +1 -0
- package/dist/collectors/static-ast-collector.d.ts +32 -0
- package/dist/collectors/static-ast-collector.d.ts.map +1 -0
- package/dist/collectors/trace-collector.d.ts +12 -0
- package/dist/collectors/trace-collector.d.ts.map +1 -0
- package/dist/config/project-config.d.ts +33 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/core/errors/engine-errors.d.ts +34 -0
- package/dist/core/errors/engine-errors.d.ts.map +1 -0
- package/dist/core/types/diagnostic-context.d.ts +151 -0
- package/dist/core/types/diagnostic-context.d.ts.map +1 -0
- package/dist/core/types/repair-evidence.d.ts +56 -0
- package/dist/core/types/repair-evidence.d.ts.map +1 -0
- package/dist/core/version.d.ts +13 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/diagnostics/diagnostic-contract.d.ts +52 -0
- package/dist/diagnostics/diagnostic-contract.d.ts.map +1 -0
- package/dist/diagnostics/diagnostic-report.d.ts +11 -0
- package/dist/diagnostics/diagnostic-report.d.ts.map +1 -0
- package/dist/diagnostics/evidence-correlator.d.ts +22 -0
- package/dist/diagnostics/evidence-correlator.d.ts.map +1 -0
- package/dist/diagnostics/external-failure-evidence.d.ts +18 -0
- package/dist/diagnostics/external-failure-evidence.d.ts.map +1 -0
- package/dist/diagnostics/failure-category.d.ts +4 -0
- package/dist/diagnostics/failure-category.d.ts.map +1 -0
- package/dist/diagnostics/failure-classifier.d.ts +58 -0
- package/dist/diagnostics/failure-classifier.d.ts.map +1 -0
- package/dist/evaluation/evaluation-scorecard.d.ts +72 -0
- package/dist/evaluation/evaluation-scorecard.d.ts.map +1 -0
- package/dist/evaluation/repository-inspector.d.ts +21 -0
- package/dist/evaluation/repository-inspector.d.ts.map +1 -0
- package/dist/evaluation/repository-runner.d.ts +24 -0
- package/dist/evaluation/repository-runner.d.ts.map +1 -0
- package/dist/evidence/evidence-model.d.ts +88 -0
- package/dist/evidence/evidence-model.d.ts.map +1 -0
- package/dist/evidence/evidence-normalizer.d.ts +19 -0
- package/dist/evidence/evidence-normalizer.d.ts.map +1 -0
- package/dist/evidence/evidence-redactor.d.ts +37 -0
- package/dist/evidence/evidence-redactor.d.ts.map +1 -0
- package/dist/framework/config-adapter.d.ts +28 -0
- package/dist/framework/config-adapter.d.ts.map +1 -0
- package/dist/gate/index.d.ts +21 -0
- package/dist/gate/index.d.ts.map +1 -0
- package/dist/gate/oracle.d.ts +26 -0
- package/dist/gate/oracle.d.ts.map +1 -0
- package/dist/gate/quality.d.ts +27 -0
- package/dist/gate/quality.d.ts.map +1 -0
- package/dist/gate/safety.d.ts +28 -0
- package/dist/gate/safety.d.ts.map +1 -0
- package/dist/generator/architecture-generator.d.ts +55 -0
- package/dist/generator/architecture-generator.d.ts.map +1 -0
- package/dist/generator/assertion-quality-gate.d.ts +18 -0
- package/dist/generator/assertion-quality-gate.d.ts.map +1 -0
- package/dist/generator/candidate-writer.d.ts +34 -0
- package/dist/generator/candidate-writer.d.ts.map +1 -0
- package/dist/generator/test-generator.d.ts +26 -0
- package/dist/generator/test-generator.d.ts.map +1 -0
- package/dist/governance/audit-log.d.ts +23 -0
- package/dist/governance/audit-log.d.ts.map +1 -0
- package/dist/governance/governance-policy.d.ts +24 -0
- package/dist/governance/governance-policy.d.ts.map +1 -0
- package/dist/governance/team-dashboard.d.ts +51 -0
- package/dist/governance/team-dashboard.d.ts.map +1 -0
- package/dist/governance/workflow-audit.d.ts +13 -0
- package/dist/governance/workflow-audit.d.ts.map +1 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20318 -0
- package/dist/integrations/ci-summary.d.ts +14 -0
- package/dist/integrations/ci-summary.d.ts.map +1 -0
- package/dist/integrations/playwright-report-adapter.d.ts +22 -0
- package/dist/integrations/playwright-report-adapter.d.ts.map +1 -0
- package/dist/integrations/quality-gate.d.ts +35 -0
- package/dist/integrations/quality-gate.d.ts.map +1 -0
- package/dist/integrations/sarif-report.d.ts +48 -0
- package/dist/integrations/sarif-report.d.ts.map +1 -0
- package/dist/intelligence/autonomous-repair-workflow.d.ts +31 -0
- package/dist/intelligence/autonomous-repair-workflow.d.ts.map +1 -0
- package/dist/intelligence/business-intent.d.ts +58 -0
- package/dist/intelligence/business-intent.d.ts.map +1 -0
- package/dist/intelligence/evidence-bundle.d.ts +364 -0
- package/dist/intelligence/evidence-bundle.d.ts.map +1 -0
- package/dist/intelligence/failure-clustering.d.ts +38 -0
- package/dist/intelligence/failure-clustering.d.ts.map +1 -0
- package/dist/intelligence/generation-agent.d.ts +120 -0
- package/dist/intelligence/generation-agent.d.ts.map +1 -0
- package/dist/intelligence/generation-verifier.d.ts +151 -0
- package/dist/intelligence/generation-verifier.d.ts.map +1 -0
- package/dist/intelligence/llm-proposal.d.ts +377 -0
- package/dist/intelligence/llm-proposal.d.ts.map +1 -0
- package/dist/intelligence/locator-disambiguation-engine.d.ts +38 -0
- package/dist/intelligence/locator-disambiguation-engine.d.ts.map +1 -0
- package/dist/intelligence/model-contract.d.ts +86 -0
- package/dist/intelligence/model-contract.d.ts.map +1 -0
- package/dist/intelligence/model-provider.d.ts +75 -0
- package/dist/intelligence/model-provider.d.ts.map +1 -0
- package/dist/intelligence/project-intelligence.d.ts +22 -0
- package/dist/intelligence/project-intelligence.d.ts.map +1 -0
- package/dist/intelligence/repair-agent.d.ts +46 -0
- package/dist/intelligence/repair-agent.d.ts.map +1 -0
- package/dist/intelligence/repository-profile.d.ts +131 -0
- package/dist/intelligence/repository-profile.d.ts.map +1 -0
- package/dist/intelligence/suite-intelligence.d.ts +59 -0
- package/dist/intelligence/suite-intelligence.d.ts.map +1 -0
- package/dist/intelligence/test-intelligence.d.ts +44 -0
- package/dist/intelligence/test-intelligence.d.ts.map +1 -0
- package/dist/intelligence/trace-proposal-workflow.d.ts +30 -0
- package/dist/intelligence/trace-proposal-workflow.d.ts.map +1 -0
- package/dist/intelligence/verified-llm-repair-workflow.d.ts +21 -0
- package/dist/intelligence/verified-llm-repair-workflow.d.ts.map +1 -0
- package/dist/intelligence/workflow-planner.d.ts +278 -0
- package/dist/intelligence/workflow-planner.d.ts.map +1 -0
- package/dist/mcp/server.d.ts +32 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/memory/stability-ledger.d.ts +46 -0
- package/dist/memory/stability-ledger.d.ts.map +1 -0
- package/dist/perception/app-model.d.ts +55 -0
- package/dist/perception/app-model.d.ts.map +1 -0
- package/dist/perception/crawler.d.ts +18 -0
- package/dist/perception/crawler.d.ts.map +1 -0
- package/dist/perception/index.d.ts +3 -0
- package/dist/perception/index.d.ts.map +1 -0
- package/dist/repair/approval-service.d.ts +139 -0
- package/dist/repair/approval-service.d.ts.map +1 -0
- package/dist/repair/assertion-hasher.d.ts +62 -0
- package/dist/repair/assertion-hasher.d.ts.map +1 -0
- package/dist/repair/ast-patcher.d.ts +36 -0
- package/dist/repair/ast-patcher.d.ts.map +1 -0
- package/dist/repair/browser-operation-executor.d.ts +27 -0
- package/dist/repair/browser-operation-executor.d.ts.map +1 -0
- package/dist/repair/diff-allowlist.d.ts +74 -0
- package/dist/repair/diff-allowlist.d.ts.map +1 -0
- package/dist/repair/intent-validator.d.ts +157 -0
- package/dist/repair/intent-validator.d.ts.map +1 -0
- package/dist/repair/repair-operations.d.ts +40 -0
- package/dist/repair/repair-operations.d.ts.map +1 -0
- package/dist/repair/repair-planner.d.ts +98 -0
- package/dist/repair/repair-planner.d.ts.map +1 -0
- package/dist/repair/repair-workflow.d.ts +42 -0
- package/dist/repair/repair-workflow.d.ts.map +1 -0
- package/dist/repair/safe-operation-compiler.d.ts +15 -0
- package/dist/repair/safe-operation-compiler.d.ts.map +1 -0
- package/dist/repair/source-mapper.d.ts +19 -0
- package/dist/repair/source-mapper.d.ts.map +1 -0
- package/dist/repair/statement-patcher.d.ts +75 -0
- package/dist/repair/statement-patcher.d.ts.map +1 -0
- package/dist/repair/verification-gates.d.ts +25 -0
- package/dist/repair/verification-gates.d.ts.map +1 -0
- package/dist/repair/workflow-plan.d.ts +35 -0
- package/dist/repair/workflow-plan.d.ts.map +1 -0
- package/dist/repair/workspace-promoter.d.ts +43 -0
- package/dist/repair/workspace-promoter.d.ts.map +1 -0
- package/dist/reproduce/diagnostic-rerunner.d.ts +40 -0
- package/dist/reproduce/diagnostic-rerunner.d.ts.map +1 -0
- package/dist/reproduce/direct-browser-investigator.d.ts +41 -0
- package/dist/reproduce/direct-browser-investigator.d.ts.map +1 -0
- package/dist/reproduce/interactive-workflow-runner.d.ts +43 -0
- package/dist/reproduce/interactive-workflow-runner.d.ts.map +1 -0
- package/dist/sandbox/dependency-strategy.d.ts +45 -0
- package/dist/sandbox/dependency-strategy.d.ts.map +1 -0
- package/dist/sandbox/execution-runner.d.ts +81 -0
- package/dist/sandbox/execution-runner.d.ts.map +1 -0
- package/dist/sandbox/worktree-manager.d.ts +51 -0
- package/dist/sandbox/worktree-manager.d.ts.map +1 -0
- package/dist/selector/abstention-policy.d.ts +34 -0
- package/dist/selector/abstention-policy.d.ts.map +1 -0
- package/dist/selector/candidate-extractor.d.ts +71 -0
- package/dist/selector/candidate-extractor.d.ts.map +1 -0
- package/dist/selector/live-locator-verifier.d.ts +28 -0
- package/dist/selector/live-locator-verifier.d.ts.map +1 -0
- package/dist/selector/repair-candidate-ranker.d.ts +10 -0
- package/dist/selector/repair-candidate-ranker.d.ts.map +1 -0
- package/dist/selector/selector-scorer.d.ts +43 -0
- package/dist/selector/selector-scorer.d.ts.map +1 -0
- package/dist/trace/adapters/adapter-registry.d.ts +18 -0
- package/dist/trace/adapters/adapter-registry.d.ts.map +1 -0
- package/dist/trace/adapters/trace-adapter.d.ts +21 -0
- package/dist/trace/adapters/trace-adapter.d.ts.map +1 -0
- package/dist/trace/adapters/unknown-adapter.d.ts +10 -0
- package/dist/trace/adapters/unknown-adapter.d.ts.map +1 -0
- package/dist/trace/adapters/v10-adapter.d.ts +10 -0
- package/dist/trace/adapters/v10-adapter.d.ts.map +1 -0
- package/dist/trace/adapters/v4-adapter.d.ts +11 -0
- package/dist/trace/adapters/v4-adapter.d.ts.map +1 -0
- package/dist/trace/adapters/v8-adapter.d.ts +10 -0
- package/dist/trace/adapters/v8-adapter.d.ts.map +1 -0
- package/dist/trace/adapters/v9-adapter.d.ts +10 -0
- package/dist/trace/adapters/v9-adapter.d.ts.map +1 -0
- package/dist/trace/archive-reader.d.ts +44 -0
- package/dist/trace/archive-reader.d.ts.map +1 -0
- package/dist/trace/snapshot-resolver.d.ts +55 -0
- package/dist/trace/snapshot-resolver.d.ts.map +1 -0
- package/dist/trace/trace-parser.d.ts +50 -0
- package/dist/trace/trace-parser.d.ts.map +1 -0
- package/dist/trace/version-detector.d.ts +20 -0
- package/dist/trace/version-detector.d.ts.map +1 -0
- package/package.json +76 -6
- package/skills/README.md +20 -0
- package/skills/pie-failure-investigation/SKILL.md +16 -0
- package/skills/pie-quality-engineer/SKILL.md +66 -0
- package/skills/pie-release-readiness/SKILL.md +22 -0
- package/skills/pie-repair-review/SKILL.md +21 -0
- package/skills/pie-trace-to-repair/SKILL.md +35 -0
- package/src/authoring/author.ts +81 -0
- package/src/authoring/generation-contract.ts +283 -0
- package/src/authoring/hybrid-author.ts +115 -0
- package/src/authoring/index.ts +7 -0
- package/src/authoring/llm-author.ts +282 -0
- package/src/authoring/naming/index.ts +4 -0
- package/src/authoring/naming/name-plan.ts +28 -0
- package/src/authoring/naming/name-planner.ts +339 -0
- package/src/authoring/naming/naming-linter.ts +292 -0
- package/src/authoring/template-author.ts +39 -0
- package/src/cli/index.ts +1172 -0
- package/src/collectors/collector-interface.ts +8 -0
- package/src/collectors/environment-collector.ts +103 -0
- package/src/collectors/error-collector.ts +177 -0
- package/src/collectors/git-diff-collector.ts +190 -0
- package/src/collectors/live-browser-collector.ts +412 -0
- package/src/collectors/network-collector.ts +90 -0
- package/src/collectors/static-ast-collector.ts +226 -0
- package/src/collectors/trace-collector.ts +66 -0
- package/src/config/project-config.ts +114 -0
- package/src/core/errors/engine-errors.ts +90 -0
- package/src/core/types/diagnostic-context.ts +94 -0
- package/src/core/types/repair-evidence.ts +45 -0
- package/src/core/version.ts +25 -0
- package/src/diagnostics/diagnostic-contract.ts +79 -0
- package/src/diagnostics/diagnostic-report.ts +204 -0
- package/src/diagnostics/evidence-correlator.ts +117 -0
- package/src/diagnostics/external-failure-evidence.ts +72 -0
- package/src/diagnostics/failure-category.ts +40 -0
- package/src/diagnostics/failure-classifier.ts +701 -0
- package/src/evaluation/evaluation-scorecard.ts +198 -0
- package/src/evaluation/repository-inspector.ts +143 -0
- package/src/evaluation/repository-runner.ts +197 -0
- package/src/evidence/evidence-model.ts +76 -0
- package/src/evidence/evidence-normalizer.ts +322 -0
- package/src/evidence/evidence-redactor.ts +218 -0
- package/src/framework/config-adapter.ts +131 -0
- package/src/gate/index.ts +43 -0
- package/src/gate/oracle.ts +69 -0
- package/src/gate/quality.ts +101 -0
- package/src/gate/safety.ts +94 -0
- package/src/generator/architecture-generator.ts +582 -0
- package/src/generator/assertion-quality-gate.ts +88 -0
- package/src/generator/candidate-writer.ts +288 -0
- package/src/generator/test-generator.ts +52 -0
- package/src/governance/audit-log.ts +115 -0
- package/src/governance/governance-policy.ts +72 -0
- package/src/governance/team-dashboard.ts +189 -0
- package/src/governance/workflow-audit.ts +72 -0
- package/src/index.ts +107 -0
- package/src/integrations/ci-summary.ts +37 -0
- package/src/integrations/playwright-report-adapter.ts +173 -0
- package/src/integrations/quality-gate.ts +95 -0
- package/src/integrations/sarif-report.ts +110 -0
- package/src/intelligence/autonomous-repair-workflow.ts +139 -0
- package/src/intelligence/business-intent.ts +163 -0
- package/src/intelligence/evidence-bundle.ts +300 -0
- package/src/intelligence/failure-clustering.ts +134 -0
- package/src/intelligence/generation-agent.ts +561 -0
- package/src/intelligence/generation-verifier.ts +1115 -0
- package/src/intelligence/llm-proposal.ts +519 -0
- package/src/intelligence/locator-disambiguation-engine.ts +331 -0
- package/src/intelligence/model-contract.ts +205 -0
- package/src/intelligence/model-provider.ts +348 -0
- package/src/intelligence/project-intelligence.ts +140 -0
- package/src/intelligence/repair-agent.ts +297 -0
- package/src/intelligence/repository-profile.ts +796 -0
- package/src/intelligence/suite-intelligence.ts +305 -0
- package/src/intelligence/test-intelligence.ts +136 -0
- package/src/intelligence/trace-proposal-workflow.ts +318 -0
- package/src/intelligence/verified-llm-repair-workflow.ts +48 -0
- package/src/intelligence/workflow-planner.ts +966 -0
- package/src/mcp/server.ts +970 -0
- package/src/memory/stability-ledger.ts +243 -0
- package/src/perception/app-model.ts +32 -0
- package/src/perception/crawler.ts +263 -0
- package/src/perception/index.ts +3 -0
- package/src/repair/approval-service.ts +541 -0
- package/src/repair/assertion-hasher.ts +386 -0
- package/src/repair/ast-patcher.ts +223 -0
- package/src/repair/browser-operation-executor.ts +263 -0
- package/src/repair/diff-allowlist.ts +612 -0
- package/src/repair/intent-validator.ts +761 -0
- package/src/repair/repair-operations.ts +65 -0
- package/src/repair/repair-planner.ts +467 -0
- package/src/repair/repair-workflow.ts +241 -0
- package/src/repair/safe-operation-compiler.ts +68 -0
- package/src/repair/source-mapper.ts +156 -0
- package/src/repair/statement-patcher.ts +544 -0
- package/src/repair/verification-gates.ts +46 -0
- package/src/repair/workflow-plan.ts +59 -0
- package/src/repair/workspace-promoter.ts +313 -0
- package/src/reproduce/diagnostic-rerunner.ts +287 -0
- package/src/reproduce/direct-browser-investigator.ts +208 -0
- package/src/reproduce/interactive-workflow-runner.ts +828 -0
- package/src/sandbox/dependency-strategy.ts +215 -0
- package/src/sandbox/execution-runner.ts +408 -0
- package/src/sandbox/worktree-manager.ts +287 -0
- package/src/selector/abstention-policy.ts +175 -0
- package/src/selector/candidate-extractor.ts +343 -0
- package/src/selector/live-locator-verifier.ts +139 -0
- package/src/selector/repair-candidate-ranker.ts +92 -0
- package/src/selector/selector-scorer.ts +344 -0
- package/src/trace/adapters/adapter-registry.ts +49 -0
- package/src/trace/adapters/trace-adapter.ts +28 -0
- package/src/trace/adapters/unknown-adapter.ts +50 -0
- package/src/trace/adapters/v10-adapter.ts +39 -0
- package/src/trace/adapters/v4-adapter.ts +31 -0
- package/src/trace/adapters/v8-adapter.ts +42 -0
- package/src/trace/adapters/v9-adapter.ts +39 -0
- package/src/trace/archive-reader.ts +246 -0
- package/src/trace/snapshot-resolver.ts +308 -0
- package/src/trace/trace-parser.ts +467 -0
- package/src/trace/version-detector.ts +81 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import type { NamePlan } from './name-plan.js';
|
|
2
|
+
|
|
3
|
+
export interface NamingLintViolation {
|
|
4
|
+
kind:
|
|
5
|
+
| 'INDEX_DERIVED_IDENTIFIER'
|
|
6
|
+
| 'DUPLICATE_PROPERTY'
|
|
7
|
+
| 'DUPLICATE_METHOD'
|
|
8
|
+
| 'DUPLICATE_WORD_IN_IDENTIFIER'
|
|
9
|
+
| 'CLASS_NAME_CASING'
|
|
10
|
+
| 'RESERVED_WORD_COLLISION'
|
|
11
|
+
| 'MISSING_VERB'
|
|
12
|
+
| 'ZERO_SEMANTIC_OVERLAP'
|
|
13
|
+
| 'UNGROUNDED_IDENTIFIER';
|
|
14
|
+
message: string;
|
|
15
|
+
identifier: string;
|
|
16
|
+
ref?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface NamingLintReport {
|
|
20
|
+
passed: boolean;
|
|
21
|
+
violations: NamingLintViolation[];
|
|
22
|
+
totalIdentifiers: number;
|
|
23
|
+
indexDerivedIdentifierCount: number;
|
|
24
|
+
duplicateSymbolCount: number;
|
|
25
|
+
semanticNameCoverage: number | null;
|
|
26
|
+
namingConformanceRate: number | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const RESERVED_WORDS = new Set([
|
|
30
|
+
'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger', 'default', 'delete', 'do',
|
|
31
|
+
'else', 'export', 'extends', 'finally', 'for', 'function', 'if', 'import', 'in', 'instanceof',
|
|
32
|
+
'new', 'return', 'super', 'switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while',
|
|
33
|
+
'with', 'yield', 'enum', 'implements', 'interface', 'let', 'package', 'private', 'protected',
|
|
34
|
+
'public', 'static', 'await', 'abstract', 'boolean', 'byte', 'char', 'double', 'final', 'float',
|
|
35
|
+
'goto', 'int', 'long', 'native', 'short', 'synchronized', 'throws', 'transient', 'volatile',
|
|
36
|
+
'page', 'constructor', 'locator',
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
const ALLOWED_VERBS = new Set([
|
|
40
|
+
'fill', 'enter', 'click', 'submit', 'signIn', 'signUp', 'open', 'goTo', 'select', 'check',
|
|
41
|
+
'uncheck', 'expectVisible', 'expectText', 'expectHidden', 'perform', 'press', 'hover', 'clear',
|
|
42
|
+
'add', 'create', 'update', 'edit', 'delete', 'remove', 'toggle', 'filter', 'search', 'navigate',
|
|
43
|
+
'login', 'logout', 'register', 'verify', 'assert', 'wait', 'proceed', 'confirm', 'cancel',
|
|
44
|
+
'complete', 'reset', 'sort', 'apply', 'upload', 'download', 'type', 'focus', 'get', 'is', 'has',
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
/** Generic role-derived identifiers with no accessible name (actionButton, buttonButton). */
|
|
48
|
+
const GENERIC_ROLE_NAME_RE = /^(action|button|input|element|field|link|text|heading|checkbox|combobox|radio|select|tab|cell|status|dialog|content|widget)(Button|Input|Element|Field|Link|Text|Heading|Checkbox|Combobox|Radio|Select|Tab|Cell|Status|Dialog|Content|Widget)?$/i;
|
|
49
|
+
|
|
50
|
+
const SEMANTIC_SYNONYMS: Record<string, string[]> = {
|
|
51
|
+
register: ['signup', 'sign', 'up', 'register', 'enroll'],
|
|
52
|
+
signup: ['register', 'sign', 'up', 'signup', 'enroll'],
|
|
53
|
+
login: ['signin', 'sign', 'in', 'login', 'auth'],
|
|
54
|
+
signin: ['login', 'sign', 'in', 'signin', 'auth'],
|
|
55
|
+
checkout: ['order', 'buy', 'purchase', 'submit', 'pay'],
|
|
56
|
+
save: ['submit', 'confirm', 'apply'],
|
|
57
|
+
apply: ['submit', 'save', 'application'],
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
function extractWords(identifier: string): string[] {
|
|
61
|
+
const tokens = identifier
|
|
62
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
63
|
+
.replace(/[^a-zA-Z0-9]+/g, ' ')
|
|
64
|
+
.trim()
|
|
65
|
+
.split(/\s+/)
|
|
66
|
+
.filter(Boolean);
|
|
67
|
+
|
|
68
|
+
const words: string[] = [];
|
|
69
|
+
for (const token of tokens) {
|
|
70
|
+
if (token.length >= 6 && token.length % 2 === 0) {
|
|
71
|
+
const half = token.slice(0, token.length / 2);
|
|
72
|
+
const secondHalf = token.slice(token.length / 2);
|
|
73
|
+
if (half.toLowerCase() === secondHalf.toLowerCase()) {
|
|
74
|
+
words.push(half, secondHalf);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
words.push(token);
|
|
79
|
+
}
|
|
80
|
+
return words;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function hasDuplicateAdjacentWords(identifier: string): boolean {
|
|
84
|
+
const words = extractWords(identifier);
|
|
85
|
+
if (words.length < 2) return false;
|
|
86
|
+
for (let i = 0; i < words.length - 1; i++) {
|
|
87
|
+
if (words[i]!.toLowerCase() === words[i + 1]!.toLowerCase()) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export class NamingLinter {
|
|
95
|
+
public static lint(plan: NamePlan): NamingLintReport {
|
|
96
|
+
const violations: NamingLintViolation[] = [];
|
|
97
|
+
const seenProperties = new Set<string>();
|
|
98
|
+
const seenMethods = new Set<string>();
|
|
99
|
+
|
|
100
|
+
let indexDerivedCount = 0;
|
|
101
|
+
let duplicateCount = 0;
|
|
102
|
+
let semanticMatches = 0;
|
|
103
|
+
let totalAssessed = 0;
|
|
104
|
+
|
|
105
|
+
// Check class name casing
|
|
106
|
+
if (plan.pageClassName) {
|
|
107
|
+
totalAssessed++;
|
|
108
|
+
if (!/^[A-Z][a-zA-Z0-9]*Page$/.test(plan.pageClassName)) {
|
|
109
|
+
violations.push({
|
|
110
|
+
kind: 'CLASS_NAME_CASING',
|
|
111
|
+
message: `Class name '${plan.pageClassName}' must be PascalCase and end with 'Page'`,
|
|
112
|
+
identifier: plan.pageClassName,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Detect flattened casing (e.g. OrderreviewPage vs OrderReviewPage)
|
|
117
|
+
const base = plan.pageClassName.replace(/Page$/, '');
|
|
118
|
+
const words = extractWords(base);
|
|
119
|
+
if (words.length === 1 && words[0]!.length > 8 && /^[A-Z][a-z]+$/.test(words[0]!)) {
|
|
120
|
+
// Known compound keywords that should not be flattened
|
|
121
|
+
const commonCompounds = ['orderreview', 'userlogin', 'customersignup', 'productsearch', 'shoppingcart'];
|
|
122
|
+
if (commonCompounds.some((c) => words[0]!.toLowerCase().includes(c))) {
|
|
123
|
+
violations.push({
|
|
124
|
+
kind: 'CLASS_NAME_CASING',
|
|
125
|
+
message: `Class name '${plan.pageClassName}' exhibits flattened compound casing`,
|
|
126
|
+
identifier: plan.pageClassName,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
for (let stepIndex = 0; stepIndex < plan.symbols.length; stepIndex++) {
|
|
133
|
+
const sym = plan.symbols[stepIndex]!;
|
|
134
|
+
const expectedNum = stepIndex + 1;
|
|
135
|
+
|
|
136
|
+
// 1. Check property
|
|
137
|
+
totalAssessed++;
|
|
138
|
+
|
|
139
|
+
// Check positional correlation for index derivation
|
|
140
|
+
const propDigitMatch = sym.property.match(/\d+$/);
|
|
141
|
+
const isPropPositionalIndex = propDigitMatch && (parseInt(propDigitMatch[0], 10) === expectedNum || parseInt(propDigitMatch[0], 10) === stepIndex);
|
|
142
|
+
const isPropGenericIndexed = /^(actionButton|inputField|button|input|action|field|element)\d+$/i.test(sym.property);
|
|
143
|
+
|
|
144
|
+
if (isPropPositionalIndex || isPropGenericIndexed) {
|
|
145
|
+
indexDerivedCount++;
|
|
146
|
+
violations.push({
|
|
147
|
+
kind: 'INDEX_DERIVED_IDENTIFIER',
|
|
148
|
+
message: `Property '${sym.property}' is derived from a raw index (matched step ${expectedNum})`,
|
|
149
|
+
identifier: sym.property,
|
|
150
|
+
ref: sym.ref,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Check duplicate adjacent words
|
|
155
|
+
if (hasDuplicateAdjacentWords(sym.property)) {
|
|
156
|
+
violations.push({
|
|
157
|
+
kind: 'DUPLICATE_WORD_IN_IDENTIFIER',
|
|
158
|
+
message: `Property '${sym.property}' contains duplicated adjacent word`,
|
|
159
|
+
identifier: sym.property,
|
|
160
|
+
ref: sym.ref,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (seenProperties.has(sym.property)) {
|
|
165
|
+
duplicateCount++;
|
|
166
|
+
violations.push({
|
|
167
|
+
kind: 'DUPLICATE_PROPERTY',
|
|
168
|
+
message: `Duplicate property '${sym.property}' declared in Page Object`,
|
|
169
|
+
identifier: sym.property,
|
|
170
|
+
ref: sym.ref,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
seenProperties.add(sym.property);
|
|
174
|
+
|
|
175
|
+
if (RESERVED_WORDS.has(sym.property.toLowerCase())) {
|
|
176
|
+
violations.push({
|
|
177
|
+
kind: 'RESERVED_WORD_COLLISION',
|
|
178
|
+
message: `Property '${sym.property}' collides with reserved language keyword`,
|
|
179
|
+
identifier: sym.property,
|
|
180
|
+
ref: sym.ref,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// 2. Check method
|
|
185
|
+
totalAssessed++;
|
|
186
|
+
|
|
187
|
+
const methodDigitMatch = sym.method.match(/\d+$/);
|
|
188
|
+
const isMethodPositionalIndex = methodDigitMatch && (parseInt(methodDigitMatch[0], 10) === expectedNum || parseInt(methodDigitMatch[0], 10) === stepIndex);
|
|
189
|
+
const isMethodGenericIndexed = /^(click|fill|action|perform|open)\d+$/i.test(sym.method);
|
|
190
|
+
|
|
191
|
+
if (isMethodPositionalIndex || isMethodGenericIndexed) {
|
|
192
|
+
indexDerivedCount++;
|
|
193
|
+
violations.push({
|
|
194
|
+
kind: 'INDEX_DERIVED_IDENTIFIER',
|
|
195
|
+
message: `Method '${sym.method}' is derived from a raw index (matched step ${expectedNum})`,
|
|
196
|
+
identifier: sym.method,
|
|
197
|
+
ref: sym.ref,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Check duplicate adjacent words
|
|
202
|
+
if (hasDuplicateAdjacentWords(sym.method)) {
|
|
203
|
+
violations.push({
|
|
204
|
+
kind: 'DUPLICATE_WORD_IN_IDENTIFIER',
|
|
205
|
+
message: `Method '${sym.method}' contains duplicated adjacent word`,
|
|
206
|
+
identifier: sym.method,
|
|
207
|
+
ref: sym.ref,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (seenMethods.has(sym.method)) {
|
|
212
|
+
duplicateCount++;
|
|
213
|
+
violations.push({
|
|
214
|
+
kind: 'DUPLICATE_METHOD',
|
|
215
|
+
message: `Duplicate method '${sym.method}' declared in Page Object`,
|
|
216
|
+
identifier: sym.method,
|
|
217
|
+
ref: sym.ref,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
seenMethods.add(sym.method);
|
|
221
|
+
|
|
222
|
+
if (RESERVED_WORDS.has(sym.method.toLowerCase())) {
|
|
223
|
+
violations.push({
|
|
224
|
+
kind: 'RESERVED_WORD_COLLISION',
|
|
225
|
+
message: `Method '${sym.method}' collides with reserved language keyword`,
|
|
226
|
+
identifier: sym.method,
|
|
227
|
+
ref: sym.ref,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (!ALLOWED_VERBS.has(sym.verb)) {
|
|
232
|
+
violations.push({
|
|
233
|
+
kind: 'MISSING_VERB',
|
|
234
|
+
message: `Method '${sym.method}' has unapproved verb '${sym.verb}'`,
|
|
235
|
+
identifier: sym.method,
|
|
236
|
+
ref: sym.ref,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// 3. Check semantic overlap with accessibleName (evaluating BOTH property and method)
|
|
241
|
+
if (sym.accessibleName && sym.accessibleName.trim().length > 0) {
|
|
242
|
+
const tokens = sym.accessibleName.toLowerCase().match(/[a-z0-9]+/g) ?? [];
|
|
243
|
+
const propLower = sym.property.toLowerCase();
|
|
244
|
+
const methodLower = sym.method.toLowerCase();
|
|
245
|
+
const meaningfulTokens = tokens.filter((t) => t.length > 2 && !['the', 'and', 'for', 'with'].includes(t));
|
|
246
|
+
const candidateTerms = [
|
|
247
|
+
...meaningfulTokens,
|
|
248
|
+
...meaningfulTokens.flatMap((t) => SEMANTIC_SYNONYMS[t] ?? []),
|
|
249
|
+
];
|
|
250
|
+
|
|
251
|
+
const propOverlap = candidateTerms.some((t) => propLower.includes(t));
|
|
252
|
+
const methodOverlap = candidateTerms.some((t) => methodLower.includes(t));
|
|
253
|
+
|
|
254
|
+
if (propOverlap && methodOverlap) {
|
|
255
|
+
semanticMatches++;
|
|
256
|
+
} else {
|
|
257
|
+
// Zero semantic overlap violation: applies to both heuristic and LLM sources
|
|
258
|
+
violations.push({
|
|
259
|
+
kind: 'ZERO_SEMANTIC_OVERLAP',
|
|
260
|
+
message: `Symbol '${sym.property}'/'${sym.method}' shares insufficient semantic tokens with accessible name '${sym.accessibleName}'`,
|
|
261
|
+
identifier: `${sym.property} / ${sym.method}`,
|
|
262
|
+
ref: sym.ref,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
} else if (GENERIC_ROLE_NAME_RE.test(sym.property)) {
|
|
266
|
+
violations.push({
|
|
267
|
+
kind: 'UNGROUNDED_IDENTIFIER',
|
|
268
|
+
message: `Property '${sym.property}' is a generic role-derived name with no accessible name`,
|
|
269
|
+
identifier: sym.property,
|
|
270
|
+
ref: sym.ref,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
// Note: If no accessibleName is provided, semanticMatches is NOT incremented (absent evidence is not covered)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const totalSymbols = plan.symbols.length;
|
|
277
|
+
// Empty denominator rule: n === 0 -> null (never 1.0 or 100%)
|
|
278
|
+
const semanticNameCoverage = totalSymbols > 0 ? Number((semanticMatches / totalSymbols).toFixed(4)) : null;
|
|
279
|
+
const nonViolating = Math.max(0, totalAssessed - violations.length);
|
|
280
|
+
const namingConformanceRate = totalAssessed > 0 ? Number((nonViolating / totalAssessed).toFixed(4)) : null;
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
passed: violations.length === 0 && totalAssessed > 0 && totalSymbols > 0,
|
|
284
|
+
violations,
|
|
285
|
+
totalIdentifiers: totalAssessed,
|
|
286
|
+
indexDerivedIdentifierCount: indexDerivedCount,
|
|
287
|
+
duplicateSymbolCount: duplicateCount,
|
|
288
|
+
semanticNameCoverage,
|
|
289
|
+
namingConformanceRate,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Author, AuthorInput, CandidateChange } from './author.js';
|
|
2
|
+
import { planArchitecture, toSlug } from '../generator/architecture-generator.js';
|
|
3
|
+
import { NamePlanner } from './naming/name-planner.js';
|
|
4
|
+
|
|
5
|
+
export class TemplateAuthor implements Author {
|
|
6
|
+
public readonly kind = 'template';
|
|
7
|
+
|
|
8
|
+
public async propose(input: AuthorInput): Promise<CandidateChange> {
|
|
9
|
+
const steps = input.steps ?? [{ action: 'navigate' }, { action: 'assert-visible', role: 'heading', name: input.featureName }];
|
|
10
|
+
const symbols = NamePlanner.planNames(input.featureName, steps, { source: 'heuristic' });
|
|
11
|
+
|
|
12
|
+
const plan = planArchitecture({
|
|
13
|
+
featureName: input.featureName,
|
|
14
|
+
mode: input.mode,
|
|
15
|
+
baseUrl: input.baseUrl,
|
|
16
|
+
requirements: input.requirements,
|
|
17
|
+
steps,
|
|
18
|
+
profile: input.profile,
|
|
19
|
+
existingFiles: input.existingFiles,
|
|
20
|
+
namePlan: symbols,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
files: plan.files.map((f) => ({
|
|
25
|
+
relativePath: f.relativePath,
|
|
26
|
+
content: f.content,
|
|
27
|
+
purpose: f.purpose,
|
|
28
|
+
action: f.action,
|
|
29
|
+
})),
|
|
30
|
+
symbols,
|
|
31
|
+
rationale: 'Template-authored scaffold with deterministic heuristic symbol mapping.',
|
|
32
|
+
authorKind: 'template',
|
|
33
|
+
featureName: input.featureName,
|
|
34
|
+
slug: toSlug(input.featureName),
|
|
35
|
+
mode: input.mode,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|