sela-core 0.1.0-alpha.1
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/README.md +103 -0
- package/bin/sela.js +3 -0
- package/dist/cli/ErrorHandler.d.ts +10 -0
- package/dist/cli/ErrorHandler.d.ts.map +1 -0
- package/dist/cli/ErrorHandler.js +70 -0
- package/dist/cli/commands/bulk.d.ts +3 -0
- package/dist/cli/commands/bulk.d.ts.map +1 -0
- package/dist/cli/commands/bulk.js +158 -0
- package/dist/cli/commands/find.d.ts +3 -0
- package/dist/cli/commands/find.d.ts.map +1 -0
- package/dist/cli/commands/find.js +51 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +166 -0
- package/dist/cli/commands/list.d.ts +3 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +56 -0
- package/dist/cli/commands/merge.d.ts +13 -0
- package/dist/cli/commands/merge.d.ts.map +1 -0
- package/dist/cli/commands/merge.js +119 -0
- package/dist/cli/commands/refactor.d.ts +3 -0
- package/dist/cli/commands/refactor.d.ts.map +1 -0
- package/dist/cli/commands/refactor.js +30 -0
- package/dist/cli/commands/showReport.d.ts +3 -0
- package/dist/cli/commands/showReport.d.ts.map +1 -0
- package/dist/cli/commands/showReport.js +82 -0
- package/dist/cli/commands/status.d.ts +3 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +51 -0
- package/dist/cli/commands/sync.d.ts +3 -0
- package/dist/cli/commands/sync.d.ts.map +1 -0
- package/dist/cli/commands/sync.js +131 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +94 -0
- package/dist/cli/ui/DnaTable.d.ts +3 -0
- package/dist/cli/ui/DnaTable.d.ts.map +1 -0
- package/dist/cli/ui/DnaTable.js +77 -0
- package/dist/cli/ui/LocatorPicker.d.ts +8 -0
- package/dist/cli/ui/LocatorPicker.d.ts.map +1 -0
- package/dist/cli/ui/LocatorPicker.js +33 -0
- package/dist/cli/ui/ProgressReporter.d.ts +11 -0
- package/dist/cli/ui/ProgressReporter.d.ts.map +1 -0
- package/dist/cli/ui/ProgressReporter.js +33 -0
- package/dist/cli/ui/RefactorWizard.d.ts +26 -0
- package/dist/cli/ui/RefactorWizard.d.ts.map +1 -0
- package/dist/cli/ui/RefactorWizard.js +295 -0
- package/dist/config/ConfigLoader.d.ts +16 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -0
- package/dist/config/ConfigLoader.js +185 -0
- package/dist/config/DryRunGuard.d.ts +14 -0
- package/dist/config/DryRunGuard.d.ts.map +1 -0
- package/dist/config/DryRunGuard.js +80 -0
- package/dist/config/PathScopeGuard.d.ts +42 -0
- package/dist/config/PathScopeGuard.d.ts.map +1 -0
- package/dist/config/PathScopeGuard.js +192 -0
- package/dist/config/SelaConfig.d.ts +178 -0
- package/dist/config/SelaConfig.d.ts.map +1 -0
- package/dist/config/SelaConfig.js +141 -0
- package/dist/config/defineConfig.d.ts +3 -0
- package/dist/config/defineConfig.d.ts.map +1 -0
- package/dist/config/defineConfig.js +9 -0
- package/dist/engine/FixwrightEngine.d.ts +24 -0
- package/dist/engine/FixwrightEngine.d.ts.map +1 -0
- package/dist/engine/FixwrightEngine.js +403 -0
- package/dist/engine/HealingRegistry.d.ts +40 -0
- package/dist/engine/HealingRegistry.d.ts.map +1 -0
- package/dist/engine/HealingRegistry.js +99 -0
- package/dist/engine/SelaEngine.d.ts +57 -0
- package/dist/engine/SelaEngine.d.ts.map +1 -0
- package/dist/engine/SelaEngine.js +1146 -0
- package/dist/engine/singleton.d.ts +3 -0
- package/dist/engine/singleton.d.ts.map +1 -0
- package/dist/engine/singleton.js +5 -0
- package/dist/errors/SelaError.d.ts +146 -0
- package/dist/errors/SelaError.d.ts.map +1 -0
- package/dist/errors/SelaError.js +168 -0
- package/dist/fixtures/expectProxy.d.ts +12 -0
- package/dist/fixtures/expectProxy.d.ts.map +1 -0
- package/dist/fixtures/expectProxy.js +246 -0
- package/dist/fixtures/index.d.ts +30 -0
- package/dist/fixtures/index.d.ts.map +1 -0
- package/dist/fixtures/index.js +765 -0
- package/dist/fixtures/moduleExpect.d.ts +2 -0
- package/dist/fixtures/moduleExpect.d.ts.map +1 -0
- package/dist/fixtures/moduleExpect.js +54 -0
- package/dist/fixtures/proxyTag.d.ts +12 -0
- package/dist/fixtures/proxyTag.d.ts.map +1 -0
- package/dist/fixtures/proxyTag.js +45 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/reporter/SelaReporter.d.ts +165 -0
- package/dist/reporter/SelaReporter.d.ts.map +1 -0
- package/dist/reporter/SelaReporter.js +517 -0
- package/dist/services/ASTSourceUpdater.d.ts +143 -0
- package/dist/services/ASTSourceUpdater.d.ts.map +1 -0
- package/dist/services/ASTSourceUpdater.js +3514 -0
- package/dist/services/AnchorResolver.d.ts +157 -0
- package/dist/services/AnchorResolver.d.ts.map +1 -0
- package/dist/services/AnchorResolver.js +289 -0
- package/dist/services/ArgumentTypeAnalyzer.d.ts +26 -0
- package/dist/services/ArgumentTypeAnalyzer.d.ts.map +1 -0
- package/dist/services/ArgumentTypeAnalyzer.js +92 -0
- package/dist/services/BlastRadiusAnalyzer.d.ts +15 -0
- package/dist/services/BlastRadiusAnalyzer.d.ts.map +1 -0
- package/dist/services/BlastRadiusAnalyzer.js +107 -0
- package/dist/services/ChainValidator.d.ts +76 -0
- package/dist/services/ChainValidator.d.ts.map +1 -0
- package/dist/services/ChainValidator.js +570 -0
- package/dist/services/CrossFileHealer.d.ts +6 -0
- package/dist/services/CrossFileHealer.d.ts.map +1 -0
- package/dist/services/CrossFileHealer.js +135 -0
- package/dist/services/DecisionEngine.d.ts +51 -0
- package/dist/services/DecisionEngine.d.ts.map +1 -0
- package/dist/services/DecisionEngine.js +260 -0
- package/dist/services/DefinitionTracer.d.ts +41 -0
- package/dist/services/DefinitionTracer.d.ts.map +1 -0
- package/dist/services/DefinitionTracer.js +366 -0
- package/dist/services/DnaEditorService.d.ts +31 -0
- package/dist/services/DnaEditorService.d.ts.map +1 -0
- package/dist/services/DnaEditorService.js +217 -0
- package/dist/services/DnaIndexService.d.ts +24 -0
- package/dist/services/DnaIndexService.d.ts.map +1 -0
- package/dist/services/DnaIndexService.js +131 -0
- package/dist/services/HealBudget.d.ts +32 -0
- package/dist/services/HealBudget.d.ts.map +1 -0
- package/dist/services/HealBudget.js +85 -0
- package/dist/services/HealReportService.d.ts +161 -0
- package/dist/services/HealReportService.d.ts.map +1 -0
- package/dist/services/HealReportService.js +1039 -0
- package/dist/services/HealingAdvisory.d.ts +30 -0
- package/dist/services/HealingAdvisory.d.ts.map +1 -0
- package/dist/services/HealingAdvisory.js +51 -0
- package/dist/services/HealingCacheService.d.ts +135 -0
- package/dist/services/HealingCacheService.d.ts.map +1 -0
- package/dist/services/HealingCacheService.js +404 -0
- package/dist/services/HealthReportService.d.ts +10 -0
- package/dist/services/HealthReportService.d.ts.map +1 -0
- package/dist/services/HealthReportService.js +84 -0
- package/dist/services/InitializerUpdater.d.ts +16 -0
- package/dist/services/InitializerUpdater.d.ts.map +1 -0
- package/dist/services/InitializerUpdater.js +73 -0
- package/dist/services/IntentAuditor.d.ts +56 -0
- package/dist/services/IntentAuditor.d.ts.map +1 -0
- package/dist/services/IntentAuditor.js +326 -0
- package/dist/services/InteractiveReview.d.ts +15 -0
- package/dist/services/InteractiveReview.d.ts.map +1 -0
- package/dist/services/InteractiveReview.js +128 -0
- package/dist/services/LLMService.d.ts +121 -0
- package/dist/services/LLMService.d.ts.map +1 -0
- package/dist/services/LLMService.js +475 -0
- package/dist/services/MutationApplier.d.ts +69 -0
- package/dist/services/MutationApplier.d.ts.map +1 -0
- package/dist/services/MutationApplier.js +360 -0
- package/dist/services/PRAutomationService.d.ts +50 -0
- package/dist/services/PRAutomationService.d.ts.map +1 -0
- package/dist/services/PRAutomationService.js +760 -0
- package/dist/services/PendingPromptLedger.d.ts +51 -0
- package/dist/services/PendingPromptLedger.d.ts.map +1 -0
- package/dist/services/PendingPromptLedger.js +205 -0
- package/dist/services/ReportGenerator.d.ts +156 -0
- package/dist/services/ReportGenerator.d.ts.map +1 -0
- package/dist/services/ReportGenerator.js +278 -0
- package/dist/services/ReportMergeService.d.ts +95 -0
- package/dist/services/ReportMergeService.d.ts.map +1 -0
- package/dist/services/ReportMergeService.js +0 -0
- package/dist/services/SafetyGuard.d.ts +112 -0
- package/dist/services/SafetyGuard.d.ts.map +1 -0
- package/dist/services/SafetyGuard.js +87 -0
- package/dist/services/Sanitizer.d.ts +28 -0
- package/dist/services/Sanitizer.d.ts.map +1 -0
- package/dist/services/Sanitizer.js +142 -0
- package/dist/services/SanitizingAnthropic.d.ts +19 -0
- package/dist/services/SanitizingAnthropic.d.ts.map +1 -0
- package/dist/services/SanitizingAnthropic.js +84 -0
- package/dist/services/SelectorSanitizer.d.ts +52 -0
- package/dist/services/SelectorSanitizer.d.ts.map +1 -0
- package/dist/services/SelectorSanitizer.js +318 -0
- package/dist/services/SnapshotService.d.ts +11 -0
- package/dist/services/SnapshotService.d.ts.map +1 -0
- package/dist/services/SnapshotService.js +352 -0
- package/dist/services/SourceLinkService.d.ts +26 -0
- package/dist/services/SourceLinkService.d.ts.map +1 -0
- package/dist/services/SourceLinkService.js +165 -0
- package/dist/services/SourceUpdater.d.ts +45 -0
- package/dist/services/SourceUpdater.d.ts.map +1 -0
- package/dist/services/SourceUpdater.js +1091 -0
- package/dist/services/TemplateDiffService.d.ts +25 -0
- package/dist/services/TemplateDiffService.d.ts.map +1 -0
- package/dist/services/TemplateDiffService.js +334 -0
- package/dist/services/TraceBackEngine.d.ts +67 -0
- package/dist/services/TraceBackEngine.d.ts.map +1 -0
- package/dist/services/TraceBackEngine.js +672 -0
- package/dist/services/WorkspaceSnapshotService.d.ts +71 -0
- package/dist/services/WorkspaceSnapshotService.d.ts.map +1 -0
- package/dist/services/WorkspaceSnapshotService.js +200 -0
- package/dist/services/safety/PipelineContext.d.ts +63 -0
- package/dist/services/safety/PipelineContext.d.ts.map +1 -0
- package/dist/services/safety/PipelineContext.js +34 -0
- package/dist/services/safety/roleClassifier.d.ts +4 -0
- package/dist/services/safety/roleClassifier.d.ts.map +1 -0
- package/dist/services/safety/roleClassifier.js +233 -0
- package/dist/services/safety/rules/ConfidenceTierRule.d.ts +3 -0
- package/dist/services/safety/rules/ConfidenceTierRule.d.ts.map +1 -0
- package/dist/services/safety/rules/ConfidenceTierRule.js +32 -0
- package/dist/services/safety/rules/DangerousSinkRule.d.ts +10 -0
- package/dist/services/safety/rules/DangerousSinkRule.d.ts.map +1 -0
- package/dist/services/safety/rules/DangerousSinkRule.js +53 -0
- package/dist/services/safety/rules/FunctionalRoleRule.d.ts +3 -0
- package/dist/services/safety/rules/FunctionalRoleRule.d.ts.map +1 -0
- package/dist/services/safety/rules/FunctionalRoleRule.js +64 -0
- package/dist/services/safety/rules/HardConfidenceRule.d.ts +3 -0
- package/dist/services/safety/rules/HardConfidenceRule.d.ts.map +1 -0
- package/dist/services/safety/rules/HardConfidenceRule.js +22 -0
- package/dist/services/safety/rules/IntentAuditorRule.d.ts +3 -0
- package/dist/services/safety/rules/IntentAuditorRule.d.ts.map +1 -0
- package/dist/services/safety/rules/IntentAuditorRule.js +97 -0
- package/dist/services/safety/rules/SemanticOppositeRule.d.ts +3 -0
- package/dist/services/safety/rules/SemanticOppositeRule.d.ts.map +1 -0
- package/dist/services/safety/rules/SemanticOppositeRule.js +30 -0
- package/dist/services/safety/rules/StructuralOnlyRule.d.ts +3 -0
- package/dist/services/safety/rules/StructuralOnlyRule.d.ts.map +1 -0
- package/dist/services/safety/rules/StructuralOnlyRule.js +38 -0
- package/dist/services/safety/rules/VisibilityRule.d.ts +3 -0
- package/dist/services/safety/rules/VisibilityRule.d.ts.map +1 -0
- package/dist/services/safety/rules/VisibilityRule.js +53 -0
- package/dist/services/safety/rules/ZeroTrustRule.d.ts +3 -0
- package/dist/services/safety/rules/ZeroTrustRule.d.ts.map +1 -0
- package/dist/services/safety/rules/ZeroTrustRule.js +37 -0
- package/dist/services/safety/rules/index.d.ts +3 -0
- package/dist/services/safety/rules/index.d.ts.map +1 -0
- package/dist/services/safety/rules/index.js +34 -0
- package/dist/services/types.d.ts +59 -0
- package/dist/services/types.d.ts.map +1 -0
- package/dist/services/types.js +2 -0
- package/dist/storage/SnapshotManager.d.ts +5 -0
- package/dist/storage/SnapshotManager.d.ts.map +1 -0
- package/dist/storage/SnapshotManager.js +32 -0
- package/dist/types/index.d.ts +95 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/utils/DOMUtils.d.ts +49 -0
- package/dist/utils/DOMUtils.d.ts.map +1 -0
- package/dist/utils/DOMUtils.js +466 -0
- package/dist/utils/FileLock.d.ts +44 -0
- package/dist/utils/FileLock.d.ts.map +1 -0
- package/dist/utils/FileLock.js +189 -0
- package/dist/utils/IsolatedDiff.d.ts +45 -0
- package/dist/utils/IsolatedDiff.d.ts.map +1 -0
- package/dist/utils/IsolatedDiff.js +382 -0
- package/dist/utils/StackUtils.d.ts +11 -0
- package/dist/utils/StackUtils.d.ts.map +1 -0
- package/dist/utils/StackUtils.js +120 -0
- package/dist/utils/SummaryTable.d.ts +17 -0
- package/dist/utils/SummaryTable.d.ts.map +1 -0
- package/dist/utils/SummaryTable.js +37 -0
- package/dist/utils/atomicWrite.d.ts +9 -0
- package/dist/utils/atomicWrite.d.ts.map +1 -0
- package/dist/utils/atomicWrite.js +83 -0
- package/dist/utils/logger.d.ts +59 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +123 -0
- package/dist/vendor/enquirer.d.ts +33 -0
- package/dist/vendor/enquirer.d.ts.map +1 -0
- package/dist/vendor/enquirer.js +11 -0
- package/package.json +71 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.StackUtils = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const crypto = __importStar(require("crypto"));
|
|
39
|
+
class StackUtils {
|
|
40
|
+
static getCallerInfo(stackOverride) {
|
|
41
|
+
let stack = "";
|
|
42
|
+
if (stackOverride) {
|
|
43
|
+
stack = stackOverride;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
47
|
+
Error.stackTraceLimit = 20;
|
|
48
|
+
stack = new Error().stack || "";
|
|
49
|
+
Error.stackTraceLimit = originalStackTraceLimit;
|
|
50
|
+
}
|
|
51
|
+
const lines = stack.split("\n");
|
|
52
|
+
const testLine = lines.find((line) => {
|
|
53
|
+
const lowerLine = line.toLowerCase();
|
|
54
|
+
// שימוש בבדיקה פשוטה של מחרוזות שמתאימה גם ל-/ וגם ל-\
|
|
55
|
+
const isInternal = lowerLine.includes("node_modules") ||
|
|
56
|
+
lowerLine.includes("stackutils") ||
|
|
57
|
+
lowerLine.includes("fixtures/index") ||
|
|
58
|
+
lowerLine.includes("fixtures\\index") ||
|
|
59
|
+
lowerLine.includes("src/fixtures") ||
|
|
60
|
+
lowerLine.includes("src\\fixtures") ||
|
|
61
|
+
lowerLine.includes("vitest");
|
|
62
|
+
const isTestFile = lowerLine.includes(".spec.ts") ||
|
|
63
|
+
lowerLine.includes(".test.ts") ||
|
|
64
|
+
lowerLine.includes(".ts");
|
|
65
|
+
return isTestFile && !isInternal;
|
|
66
|
+
});
|
|
67
|
+
if (!testLine)
|
|
68
|
+
return {
|
|
69
|
+
filePath: "",
|
|
70
|
+
fileName: "",
|
|
71
|
+
line: 0,
|
|
72
|
+
column: 0,
|
|
73
|
+
locationKey: "unknown",
|
|
74
|
+
};
|
|
75
|
+
const match = testLine.match(/(?:at\s+)?(?:.*\s+\()?(.+?):(\d+):(\d+)\)?/);
|
|
76
|
+
if (!match)
|
|
77
|
+
return {
|
|
78
|
+
filePath: "",
|
|
79
|
+
fileName: "",
|
|
80
|
+
line: 0,
|
|
81
|
+
column: 0,
|
|
82
|
+
locationKey: "unknown",
|
|
83
|
+
};
|
|
84
|
+
const filePath = path.normalize(match[1]);
|
|
85
|
+
const line = parseInt(match[2], 10);
|
|
86
|
+
const column = parseInt(match[3], 10);
|
|
87
|
+
const fileName = path.basename(filePath);
|
|
88
|
+
const fileKey = fileName.replace(/\./g, "_");
|
|
89
|
+
return {
|
|
90
|
+
filePath,
|
|
91
|
+
fileName,
|
|
92
|
+
line,
|
|
93
|
+
column,
|
|
94
|
+
locationKey: `${fileKey}_L${line}_C${column}`,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
static getActionKey(testTitle, action, index) {
|
|
98
|
+
const stack = new Error().stack || "";
|
|
99
|
+
const lines = stack.split("\n");
|
|
100
|
+
const filteredStack = lines
|
|
101
|
+
.filter((line) => line.includes("at "))
|
|
102
|
+
.filter((line) => !line.includes("node_modules") &&
|
|
103
|
+
!line.includes("StackUtils") &&
|
|
104
|
+
!line.includes("fixtures/index") &&
|
|
105
|
+
!line.includes("internal/"))
|
|
106
|
+
.map((line) => line.trim());
|
|
107
|
+
const topFrame = filteredStack[0] || "unknown_location";
|
|
108
|
+
// Regex משופר:
|
|
109
|
+
// 1. מחליף לוכסנים של ווינדוס בלוכסנים רגילים.
|
|
110
|
+
// 2. לוקח רק את שם הקובץ ומספר השורה (למשל auth.spec.ts:10).
|
|
111
|
+
// 3. מתעלם מכל מה שלפני שם הקובץ (הנתיב האבסולוטי).
|
|
112
|
+
const cleanedFrame = topFrame
|
|
113
|
+
.replace(/\\/g, "/")
|
|
114
|
+
.replace(/.*\/([^\/]+\.[jt]s:\d+).*/, "$1") // שומר filename:line
|
|
115
|
+
.replace(/:\d+$/, (match) => match); // וידוא סופי שהשורה שם
|
|
116
|
+
const rawKey = `${testTitle}#${cleanedFrame}#${action}#${index}`;
|
|
117
|
+
return crypto.createHash("md5").update(rawKey).digest("hex");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.StackUtils = StackUtils;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface RunSummary {
|
|
2
|
+
/** Distinct test cases / call-sites Sela inspected this run. */
|
|
3
|
+
testsScanned: number;
|
|
4
|
+
/** Broken selectors / failures Sela detected. */
|
|
5
|
+
errorsDetected: number;
|
|
6
|
+
/** Heals that were applied to source successfully. */
|
|
7
|
+
successfulHeals: number;
|
|
8
|
+
/** Files Sela deliberately skipped (out of scope, directive, etc.). */
|
|
9
|
+
skippedFiles: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Build the summary table as a ready-to-print string. The numeric column is
|
|
13
|
+
* lightly colored — green when there is something positive to report, neutral
|
|
14
|
+
* otherwise — staying within the "elegant and standard" styling rule.
|
|
15
|
+
*/
|
|
16
|
+
export declare function renderSummaryTable(summary: RunSummary): string;
|
|
17
|
+
//# sourceMappingURL=SummaryTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SummaryTable.d.ts","sourceRoot":"","sources":["../../src/utils/SummaryTable.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAwB9D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/utils/SummaryTable.ts
|
|
3
|
+
//
|
|
4
|
+
// End-of-run ASCII summary table for a Sela session. Renders a single clean,
|
|
5
|
+
// structured table so a developer can read the outcome of a run at a glance
|
|
6
|
+
// without scrolling through per-heal chatter.
|
|
7
|
+
//
|
|
8
|
+
// Pure renderer: takes explicit counts and returns a string. Keeping it free
|
|
9
|
+
// of I/O (no direct stdout/stderr writes) makes it trivially testable and lets
|
|
10
|
+
// the caller decide where the table goes (Logger, reporter, file, …).
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.renderSummaryTable = renderSummaryTable;
|
|
16
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
17
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
18
|
+
/**
|
|
19
|
+
* Build the summary table as a ready-to-print string. The numeric column is
|
|
20
|
+
* lightly colored — green when there is something positive to report, neutral
|
|
21
|
+
* otherwise — staying within the "elegant and standard" styling rule.
|
|
22
|
+
*/
|
|
23
|
+
function renderSummaryTable(summary) {
|
|
24
|
+
const table = new cli_table3_1.default({
|
|
25
|
+
head: [chalk_1.default.bold("Metric"), chalk_1.default.bold("Count")],
|
|
26
|
+
colAligns: ["left", "right"],
|
|
27
|
+
style: { head: [], border: [] },
|
|
28
|
+
});
|
|
29
|
+
const heals = summary.successfulHeals > 0
|
|
30
|
+
? chalk_1.default.green(String(summary.successfulHeals))
|
|
31
|
+
: String(summary.successfulHeals);
|
|
32
|
+
const errors = summary.errorsDetected > 0
|
|
33
|
+
? chalk_1.default.yellow(String(summary.errorsDetected))
|
|
34
|
+
: String(summary.errorsDetected);
|
|
35
|
+
table.push(["🔍 Tests Scanned", String(summary.testsScanned)], ["⚠️ Errors Detected", errors], ["🛠️ Successful Heals", heals], ["⏭️ Skipped Files", String(summary.skippedFiles)]);
|
|
36
|
+
return table.toString();
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AtomicWriteOptions {
|
|
2
|
+
/**
|
|
3
|
+
* When true, copy the existing target to `<filePath>.bak` before the
|
|
4
|
+
* rename commit. No-op when the target does not yet exist.
|
|
5
|
+
*/
|
|
6
|
+
backup?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function atomicWriteFile(filePath: string, content: string, opts?: AtomicWriteOptions): void;
|
|
9
|
+
//# sourceMappingURL=atomicWrite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomicWrite.d.ts","sourceRoot":"","sources":["../../src/utils/atomicWrite.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,kBAAuB,GAC5B,IAAI,CAwBN"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/utils/atomicWrite.ts
|
|
3
|
+
//
|
|
4
|
+
// Single audited atomic-write primitive, shared by every disk writer that
|
|
5
|
+
// must never leave a torn (half-written) file behind — the healing cache,
|
|
6
|
+
// DNA snapshots, and AST source mutations.
|
|
7
|
+
//
|
|
8
|
+
// Strategy:
|
|
9
|
+
// 1. Write the full payload to a pid-namespaced temp file
|
|
10
|
+
// (`<filePath>.sela-tmp-<pid>`). Pid-namespacing means two processes
|
|
11
|
+
// writing the SAME target never collide on the temp file — each owns
|
|
12
|
+
// its own — so a torn file is impossible even without an external lock.
|
|
13
|
+
// 2. Optionally copy the current target to `<filePath>.bak` (best-effort
|
|
14
|
+
// crash-recovery sidecar; never blocks the commit).
|
|
15
|
+
// 3. `rename(temp → target)` — the single atomic commit point. A crash
|
|
16
|
+
// before this leaves the original target intact.
|
|
17
|
+
//
|
|
18
|
+
// IMPORTANT: this guarantees no *torn* file, NOT no *lost update*. Two
|
|
19
|
+
// concurrent read-modify-write callers can still clobber each other's
|
|
20
|
+
// changes. When the write is an RMW of shared state, pair this with a
|
|
21
|
+
// {@link FileLock} so the read and the write happen under one mutex.
|
|
22
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
25
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
55
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
+
exports.atomicWriteFile = atomicWriteFile;
|
|
57
|
+
const fs = __importStar(require("fs"));
|
|
58
|
+
function atomicWriteFile(filePath, content, opts = {}) {
|
|
59
|
+
const tmp = `${filePath}.sela-tmp-${process.pid}`;
|
|
60
|
+
fs.writeFileSync(tmp, content, "utf8");
|
|
61
|
+
if (opts.backup && fs.existsSync(filePath)) {
|
|
62
|
+
try {
|
|
63
|
+
fs.copyFileSync(filePath, `${filePath}.bak`);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// Backup is best-effort — a failed sidecar must never block the commit.
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
fs.renameSync(tmp, filePath); // atomic on POSIX; replace-on-Windows
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// Windows can rarely reject rename-over-existing — fall back to a
|
|
74
|
+
// direct write, then best-effort remove the orphaned temp file.
|
|
75
|
+
fs.writeFileSync(filePath, content, "utf8");
|
|
76
|
+
try {
|
|
77
|
+
fs.unlinkSync(tmp);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
/* best effort */
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle stages of a Sela run. Each maps to a single, standard color —
|
|
3
|
+
* deliberately restrained (no backgrounds, no rainbow effects).
|
|
4
|
+
*/
|
|
5
|
+
export type StageName = "SCANNING" | "ANALYZING AST" | "HEALING" | "COMPILING" | "UPDATING" | "GENERATING REPORT";
|
|
6
|
+
export interface LoggerOptions {
|
|
7
|
+
/** Force verbose on/off. When omitted, auto-detected from env/argv. */
|
|
8
|
+
verbose?: boolean;
|
|
9
|
+
/** Output sink. Defaults to process.stderr; injectable for tests. */
|
|
10
|
+
stream?: NodeJS.WritableStream;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The Logger. A single shared instance ({@link logger}) is exported for the
|
|
14
|
+
* whole codebase; the class is exported too so tests can spin up isolated
|
|
15
|
+
* instances with a captured stream.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Logger {
|
|
18
|
+
private verbose;
|
|
19
|
+
private stream;
|
|
20
|
+
constructor(opts?: LoggerOptions);
|
|
21
|
+
/**
|
|
22
|
+
* Verbose is active when SELA_DEBUG is truthy (`1`/`true`) or `--verbose`
|
|
23
|
+
* is present on the command line. Anything else → quiet default mode.
|
|
24
|
+
*/
|
|
25
|
+
static detectVerbose(): boolean;
|
|
26
|
+
/** Override the verbose flag at runtime (e.g. after parsing CLI flags). */
|
|
27
|
+
setVerbose(value: boolean): void;
|
|
28
|
+
isVerbose(): boolean;
|
|
29
|
+
/** Redirect output (primarily for tests capturing into a buffer). */
|
|
30
|
+
setStream(stream: NodeJS.WritableStream): void;
|
|
31
|
+
private write;
|
|
32
|
+
/**
|
|
33
|
+
* Emit a color-coded stage banner, e.g. `[HEALING] repairing locator`.
|
|
34
|
+
* The optional message keeps the prefix and detail on one tidy line.
|
|
35
|
+
*/
|
|
36
|
+
stage(stage: StageName, message?: string): void;
|
|
37
|
+
/** Neutral, high-level status line. Always shown. */
|
|
38
|
+
info(message: string): void;
|
|
39
|
+
/** Clear success indicator — green check + short summary. Always shown. */
|
|
40
|
+
success(message: string): void;
|
|
41
|
+
/** Actionable warning. Always shown. */
|
|
42
|
+
warn(message: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Readable error. The reason is highlighted in red. A stack trace is only
|
|
45
|
+
* appended when the failure is fatal or verbose mode is active — otherwise
|
|
46
|
+
* just the concise message is shown (no 50-line dumps in default mode).
|
|
47
|
+
*/
|
|
48
|
+
error(message: string, detail?: unknown, opts?: {
|
|
49
|
+
fatal?: boolean;
|
|
50
|
+
}): void;
|
|
51
|
+
/**
|
|
52
|
+
* Heavy debugging payload (AST nodes, raw AI responses, deep DOM). Silently
|
|
53
|
+
* dropped unless verbose mode is active — this is the spam gate.
|
|
54
|
+
*/
|
|
55
|
+
debug(message: string): void;
|
|
56
|
+
}
|
|
57
|
+
/** Shared singleton used across the whole toolchain. */
|
|
58
|
+
export declare const logger: Logger;
|
|
59
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,UAAU,GACV,eAAe,GACf,SAAS,GACT,WAAW,GACX,UAAU,GACV,mBAAmB,CAAC;AAYxB,MAAM,WAAW,aAAa;IAC5B,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;CAChC;AAED;;;;GAIG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,MAAM,CAAwB;gBAE1B,IAAI,GAAE,aAAkB;IAKpC;;;OAGG;IACH,MAAM,CAAC,aAAa,IAAI,OAAO;IAM/B,2EAA2E;IAC3E,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAIhC,SAAS,IAAI,OAAO;IAIpB,qEAAqE;IACrE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI;IAI9C,OAAO,CAAC,KAAK;IAIb;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,SAAK,GAAG,IAAI;IAM3C,qDAAqD;IACrD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,2EAA2E;IAC3E,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B,wCAAwC;IACxC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B;;;;OAIG;IACH,KAAK,CACH,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,EAChB,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAC7B,IAAI;IAgBP;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAI7B;AAED,wDAAwD;AACxD,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/utils/logger.ts
|
|
3
|
+
//
|
|
4
|
+
// Centralized, singleton logging utility for the entire Sela toolchain.
|
|
5
|
+
//
|
|
6
|
+
// Goals (SELA-1 Terminal UX overhaul):
|
|
7
|
+
// • One funnel for every diagnostic line — no scattered console.* calls.
|
|
8
|
+
// • Color-coded lifecycle stage prefixes ([SCANNING], [HEALING], …).
|
|
9
|
+
// • Strict verbosity discipline: the DEFAULT mode is clean and concise;
|
|
10
|
+
// heavy debugging payloads (AST nodes, raw LLM JSON, DOM dumps) only
|
|
11
|
+
// surface under --verbose / SELA_DEBUG=1.
|
|
12
|
+
// • Readable success (green ✔) and error (red ✖) lines — never a 50-line
|
|
13
|
+
// stack trace in default mode unless the failure is fatal.
|
|
14
|
+
//
|
|
15
|
+
// All output is written to STDERR by default so STDOUT stays pipe-clean for
|
|
16
|
+
// machine-readable payloads (JSON reports, etc.) — matching the convention the
|
|
17
|
+
// CLI entry point already enforces.
|
|
18
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.logger = exports.Logger = void 0;
|
|
23
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
24
|
+
/** One color per stage label. Kept lightweight and standard. */
|
|
25
|
+
const STAGE_COLORS = {
|
|
26
|
+
SCANNING: chalk_1.default.cyan,
|
|
27
|
+
"ANALYZING AST": chalk_1.default.magenta,
|
|
28
|
+
HEALING: chalk_1.default.yellow,
|
|
29
|
+
COMPILING: chalk_1.default.green,
|
|
30
|
+
UPDATING: chalk_1.default.green,
|
|
31
|
+
"GENERATING REPORT": chalk_1.default.gray,
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The Logger. A single shared instance ({@link logger}) is exported for the
|
|
35
|
+
* whole codebase; the class is exported too so tests can spin up isolated
|
|
36
|
+
* instances with a captured stream.
|
|
37
|
+
*/
|
|
38
|
+
class Logger {
|
|
39
|
+
verbose;
|
|
40
|
+
stream;
|
|
41
|
+
constructor(opts = {}) {
|
|
42
|
+
this.stream = opts.stream ?? process.stderr;
|
|
43
|
+
this.verbose = opts.verbose ?? Logger.detectVerbose();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Verbose is active when SELA_DEBUG is truthy (`1`/`true`) or `--verbose`
|
|
47
|
+
* is present on the command line. Anything else → quiet default mode.
|
|
48
|
+
*/
|
|
49
|
+
static detectVerbose() {
|
|
50
|
+
const debugEnv = (process.env.SELA_DEBUG ?? "").trim().toLowerCase();
|
|
51
|
+
if (debugEnv === "1" || debugEnv === "true")
|
|
52
|
+
return true;
|
|
53
|
+
return process.argv.includes("--verbose");
|
|
54
|
+
}
|
|
55
|
+
/** Override the verbose flag at runtime (e.g. after parsing CLI flags). */
|
|
56
|
+
setVerbose(value) {
|
|
57
|
+
this.verbose = value;
|
|
58
|
+
}
|
|
59
|
+
isVerbose() {
|
|
60
|
+
return this.verbose;
|
|
61
|
+
}
|
|
62
|
+
/** Redirect output (primarily for tests capturing into a buffer). */
|
|
63
|
+
setStream(stream) {
|
|
64
|
+
this.stream = stream;
|
|
65
|
+
}
|
|
66
|
+
write(line) {
|
|
67
|
+
this.stream.write(line + "\n");
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Emit a color-coded stage banner, e.g. `[HEALING] repairing locator`.
|
|
71
|
+
* The optional message keeps the prefix and detail on one tidy line.
|
|
72
|
+
*/
|
|
73
|
+
stage(stage, message = "") {
|
|
74
|
+
const paint = STAGE_COLORS[stage];
|
|
75
|
+
const label = paint(`[${stage}]`);
|
|
76
|
+
this.write(message ? `${label} ${message}` : label);
|
|
77
|
+
}
|
|
78
|
+
/** Neutral, high-level status line. Always shown. */
|
|
79
|
+
info(message) {
|
|
80
|
+
this.write(message);
|
|
81
|
+
}
|
|
82
|
+
/** Clear success indicator — green check + short summary. Always shown. */
|
|
83
|
+
success(message) {
|
|
84
|
+
this.write(`${chalk_1.default.green("✔")} ${message}`);
|
|
85
|
+
}
|
|
86
|
+
/** Actionable warning. Always shown. */
|
|
87
|
+
warn(message) {
|
|
88
|
+
this.write(`${chalk_1.default.yellow("⚠")} ${chalk_1.default.yellow(message)}`);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Readable error. The reason is highlighted in red. A stack trace is only
|
|
92
|
+
* appended when the failure is fatal or verbose mode is active — otherwise
|
|
93
|
+
* just the concise message is shown (no 50-line dumps in default mode).
|
|
94
|
+
*/
|
|
95
|
+
error(message, detail, opts = {}) {
|
|
96
|
+
this.write(`${chalk_1.default.red("✖")} ${chalk_1.default.red(message)}`);
|
|
97
|
+
if (detail === undefined || detail === null)
|
|
98
|
+
return;
|
|
99
|
+
const showStack = this.verbose || opts.fatal === true;
|
|
100
|
+
let text;
|
|
101
|
+
if (detail instanceof Error) {
|
|
102
|
+
text = (showStack && detail.stack ? detail.stack : detail.message) ?? "";
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
text = String(detail);
|
|
106
|
+
}
|
|
107
|
+
if (text.length > 0) {
|
|
108
|
+
this.write(chalk_1.default.dim(` ${text}`));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Heavy debugging payload (AST nodes, raw AI responses, deep DOM). Silently
|
|
113
|
+
* dropped unless verbose mode is active — this is the spam gate.
|
|
114
|
+
*/
|
|
115
|
+
debug(message) {
|
|
116
|
+
if (!this.verbose)
|
|
117
|
+
return;
|
|
118
|
+
this.write(chalk_1.default.dim(`[DEBUG] ${message}`));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.Logger = Logger;
|
|
122
|
+
/** Shared singleton used across the whole toolchain. */
|
|
123
|
+
exports.logger = new Logger();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const Confirm: new (opts: {
|
|
2
|
+
name?: string;
|
|
3
|
+
message: string;
|
|
4
|
+
initial?: boolean;
|
|
5
|
+
}) => {
|
|
6
|
+
run(): Promise<boolean>;
|
|
7
|
+
};
|
|
8
|
+
export declare const Select: new (opts: {
|
|
9
|
+
name?: string;
|
|
10
|
+
message: string;
|
|
11
|
+
choices: any[];
|
|
12
|
+
initial?: number;
|
|
13
|
+
limit?: number;
|
|
14
|
+
}) => {
|
|
15
|
+
run(): Promise<any>;
|
|
16
|
+
};
|
|
17
|
+
export declare const Input: new (opts: {
|
|
18
|
+
name?: string;
|
|
19
|
+
message: string;
|
|
20
|
+
initial?: string;
|
|
21
|
+
}) => {
|
|
22
|
+
run(): Promise<string>;
|
|
23
|
+
};
|
|
24
|
+
export declare const AutoComplete: new (opts: {
|
|
25
|
+
name?: string;
|
|
26
|
+
message: string;
|
|
27
|
+
choices: any[];
|
|
28
|
+
limit?: number;
|
|
29
|
+
suggest?: (input: string, choices: any[]) => Promise<any[]>;
|
|
30
|
+
}) => {
|
|
31
|
+
run(): Promise<any>;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=enquirer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enquirer.d.ts","sourceRoot":"","sources":["../../src/vendor/enquirer.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,OAAO,aAtBE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK;IAC5E,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAqBM,CAAC;AACnC,eAAO,MAAM,MAAM,aApBE;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KAAK;IAAE,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;CAcG,CAAC;AACjC,eAAO,MAAM,KAAK,aAdE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK;IACzE,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAaG,CAAC;AAC/B,eAAO,MAAM,YAAY,aAZE;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;CAC7D,KAAK;IAAE,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;CAMe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Typed shim for enquirer classes that exist at runtime but are absent from
|
|
3
|
+
// enquirer's official TypeScript declarations (which only expose `export = Enquirer`).
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.AutoComplete = exports.Input = exports.Select = exports.Confirm = void 0;
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
7
|
+
const _eq = require('enquirer');
|
|
8
|
+
exports.Confirm = _eq.Confirm;
|
|
9
|
+
exports.Select = _eq.Select;
|
|
10
|
+
exports.Input = _eq.Input;
|
|
11
|
+
exports.AutoComplete = _eq.AutoComplete;
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sela-core",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "AI self-healing Playwright wrapper - drop-in replacement for @playwright/test",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./reporter": {
|
|
13
|
+
"types": "./dist/reporter/SelaReporter.d.ts",
|
|
14
|
+
"default": "./dist/reporter/SelaReporter.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"bin"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"sela": "bin/sela.js"
|
|
23
|
+
},
|
|
24
|
+
"author": "",
|
|
25
|
+
"license": "ISC",
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@playwright/test": ">=1.40.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@anthropic-ai/sdk": "^0.80.0",
|
|
31
|
+
"axios": "^1.13.6",
|
|
32
|
+
"chalk": "^4.1.2",
|
|
33
|
+
"cli-table3": "^0.6.5",
|
|
34
|
+
"commander": "^14.0.3",
|
|
35
|
+
"dotenv": "^17.3.1",
|
|
36
|
+
"enquirer": "^2.4.1",
|
|
37
|
+
"minimatch": "^10.2.5",
|
|
38
|
+
"ora": "^5.4.1",
|
|
39
|
+
"playwright": "^1.58.2",
|
|
40
|
+
"ts-morph": "^27.0.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@playwright/test": "^1.60.0",
|
|
44
|
+
"@types/jest": "^30.0.0",
|
|
45
|
+
"@types/node": "^25.9.1",
|
|
46
|
+
"jest": "^30.3.0",
|
|
47
|
+
"jsdom": "^29.0.1",
|
|
48
|
+
"ts-jest": "^29.4.6",
|
|
49
|
+
"tsx": "^4.21.0",
|
|
50
|
+
"vitest": "^4.1.1"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"sela": "tsx src/cli/index.ts",
|
|
54
|
+
"build": "tsc -p tsconfig.build.json",
|
|
55
|
+
"build:watch": "tsc -p tsconfig.build.json --watch",
|
|
56
|
+
"test": "npx playwright test demo.spec.ts --headed --retries=0",
|
|
57
|
+
"test-shadow": "npx playwright test shadow.spec.ts --headed --retries=0",
|
|
58
|
+
"test-core": "npx playwright test tests/Core/CoreExample.spec.ts --headed --retries=0",
|
|
59
|
+
"test-DNA": "npx playwright test tests/DnaSurvival/DnaSurvival.spec.ts --headed --retries=0",
|
|
60
|
+
"test-advanced": "npx playwright test tests/AdvancedLogic/AdvancedLogic.spec.ts --headed --retries=0",
|
|
61
|
+
"test-isolation": "npx playwright test tests/Isolation/Isolation.spec.ts --headed --retries=0",
|
|
62
|
+
"test-playwright-actions": "npx playwright test tests/PlaywrightActions/BasicActions/BasicActions.spec.ts --headed --retries=0",
|
|
63
|
+
"test-forms-actions": "npx playwright test tests/PlaywrightActions/FormsActions/FormsActions.spec.ts --headed --retries=0",
|
|
64
|
+
"test-locators-actions": "npx playwright test tests/PlaywrightActions/LocatorsActions/LocatorsActions.spec.ts --headed --retries=0",
|
|
65
|
+
"test-config": "npx playwright test tests/TestConfig/TestConfig.spec.ts --headed --retries=0",
|
|
66
|
+
"test-safety-guard": "npx playwright test tests/SafetyGuard/SafetyGuard.spec.ts --headed --retries=0",
|
|
67
|
+
"test-improve-methods": "npx playwright test tests/ImproveMethods/ImproveMethods.spec.ts --headed --retries=0",
|
|
68
|
+
"test-shadow-dom": "npx playwright test tests/ShadowDom/ShadowDom.spec.ts --headed --retries=0",
|
|
69
|
+
"test-ut": "npx vitest run tests/unit/safetyguard/ tests/unit/engine/ tests/unit/ast/ tests/unit/proxy/ tests/unit/_harness/ tests/unit/config/ tests/unit/services/ tests/unit/reporter/ tests/unit/utils/"
|
|
70
|
+
}
|
|
71
|
+
}
|