sela-core 1.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/README.md +93 -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 +140 -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 +133 -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/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/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 +123 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +42 -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 +70 -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 +269 -0
- package/dist/config/ConfigLoader.d.ts +15 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -0
- package/dist/config/ConfigLoader.js +174 -0
- package/dist/config/SelaConfig.d.ts +67 -0
- package/dist/config/SelaConfig.d.ts.map +1 -0
- package/dist/config/SelaConfig.js +57 -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 +98 -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/fixtures/expectProxy.d.ts +12 -0
- package/dist/fixtures/expectProxy.d.ts.map +1 -0
- package/dist/fixtures/expectProxy.js +228 -0
- package/dist/fixtures/index.d.ts +6 -0
- package/dist/fixtures/index.d.ts.map +1 -0
- package/dist/fixtures/index.js +688 -0
- package/dist/fixtures/moduleExpect.d.ts +2 -0
- package/dist/fixtures/moduleExpect.d.ts.map +1 -0
- package/dist/fixtures/moduleExpect.js +46 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/services/ASTSourceUpdater.d.ts +79 -0
- package/dist/services/ASTSourceUpdater.d.ts.map +1 -0
- package/dist/services/ASTSourceUpdater.js +3177 -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 +103 -0
- package/dist/services/ChainValidator.d.ts +76 -0
- package/dist/services/ChainValidator.d.ts.map +1 -0
- package/dist/services/ChainValidator.js +569 -0
- package/dist/services/CrossFileHealer.d.ts +6 -0
- package/dist/services/CrossFileHealer.d.ts.map +1 -0
- package/dist/services/CrossFileHealer.js +134 -0
- package/dist/services/DefinitionTracer.d.ts +41 -0
- package/dist/services/DefinitionTracer.d.ts.map +1 -0
- package/dist/services/DefinitionTracer.js +350 -0
- package/dist/services/DnaEditorService.d.ts +31 -0
- package/dist/services/DnaEditorService.d.ts.map +1 -0
- package/dist/services/DnaEditorService.js +198 -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/HealingAdvisory.d.ts +22 -0
- package/dist/services/HealingAdvisory.d.ts.map +1 -0
- package/dist/services/HealingAdvisory.js +42 -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 +37 -0
- package/dist/services/IntentAuditor.d.ts +39 -0
- package/dist/services/IntentAuditor.d.ts.map +1 -0
- package/dist/services/IntentAuditor.js +302 -0
- package/dist/services/LLMService.d.ts +100 -0
- package/dist/services/LLMService.d.ts.map +1 -0
- package/dist/services/LLMService.js +439 -0
- package/dist/services/SafetyGuard.d.ts +65 -0
- package/dist/services/SafetyGuard.d.ts.map +1 -0
- package/dist/services/SafetyGuard.js +524 -0
- package/dist/services/SnapshotService.d.ts +11 -0
- package/dist/services/SnapshotService.d.ts.map +1 -0
- package/dist/services/SnapshotService.js +349 -0
- package/dist/services/SourceLinkService.d.ts +26 -0
- package/dist/services/SourceLinkService.d.ts.map +1 -0
- package/dist/services/SourceLinkService.js +156 -0
- package/dist/services/SourceUpdater.d.ts +45 -0
- package/dist/services/SourceUpdater.d.ts.map +1 -0
- package/dist/services/SourceUpdater.js +1021 -0
- package/dist/services/TemplateDiffService.d.ts +25 -0
- package/dist/services/TemplateDiffService.d.ts.map +1 -0
- package/dist/services/TemplateDiffService.js +331 -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 +31 -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 +33 -0
- package/dist/utils/DOMUtils.d.ts.map +1 -0
- package/dist/utils/DOMUtils.js +179 -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/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 +67 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DOMUtils = void 0;
|
|
4
|
+
class DOMUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Sanitizes a Playwright selector (which may contain `>>`) into a CSS-safe
|
|
7
|
+
* selector by extracting only the last segment. Returns the last meaningful
|
|
8
|
+
* CSS part so querySelector can be used inside the correct context.
|
|
9
|
+
*/
|
|
10
|
+
static sanitizeSelector(selector) {
|
|
11
|
+
const parts = selector.split(">>").map((s) => s.trim());
|
|
12
|
+
return parts[parts.length - 1];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Given a Playwright `>>` selector, returns each segment in order.
|
|
16
|
+
* e.g. "#my-iframe >> #shadow-host >> #btn"
|
|
17
|
+
* → ["#my-iframe", "#shadow-host", "#btn"]
|
|
18
|
+
*/
|
|
19
|
+
static parseSegments(selector) {
|
|
20
|
+
return selector.split(">>").map((s) => s.trim());
|
|
21
|
+
}
|
|
22
|
+
// src/utils/DOMUtils.ts (חלק רלוונטי)
|
|
23
|
+
// בתוך DOMUtils.ts
|
|
24
|
+
static async getNeighborhoodDom(page, fullSelector) {
|
|
25
|
+
// וודא שה-Return Type מעודכן כאן!
|
|
26
|
+
const segments = fullSelector.split(" >> ").map((s) => s.trim());
|
|
27
|
+
// כאן קוראים לפונקציה הפרטית שכתבנו קודם
|
|
28
|
+
const result = await this._getNeighborhoodFromFrame(page, segments);
|
|
29
|
+
// השגיאה שהצגת (Property length does not exist) קרתה כאן כנראה בלוג או בבדיקה
|
|
30
|
+
if (!result.dom || result.dom.length === 0) {
|
|
31
|
+
console.warn("[DOM-EXTRACT] ⚠️ No DOM content extracted");
|
|
32
|
+
}
|
|
33
|
+
return result; // מחזירים את האובייקט המלא { dom, successfulPath }
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* When a selector has multiple ">>" segments, the first segments are
|
|
37
|
+
* typically iframe selectors. This helper drills into the correct frame
|
|
38
|
+
* before running the DOM extraction.
|
|
39
|
+
*/
|
|
40
|
+
static async _getNeighborhoodFromFrame(page, segments) {
|
|
41
|
+
const targetSelector = segments[segments.length - 1];
|
|
42
|
+
let currentContext = page;
|
|
43
|
+
const successfulPath = [];
|
|
44
|
+
try {
|
|
45
|
+
// עוברים על כל הפריימים בשרשרת
|
|
46
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
47
|
+
const selector = segments[i];
|
|
48
|
+
console.log(`[DOM-EXTRACT] 🕳️ Attempting to enter frame: ${selector}`);
|
|
49
|
+
let frameHandle = await currentContext
|
|
50
|
+
.locator(selector)
|
|
51
|
+
.elementHandle({ timeout: 2000 })
|
|
52
|
+
.catch(() => null);
|
|
53
|
+
if (!frameHandle) {
|
|
54
|
+
console.warn(`[DOM-EXTRACT] ⚠️ Frame ${selector} not found. Stopping drill at: ${successfulPath.join(" >> ") || "root"}`);
|
|
55
|
+
break; // עוצרים ומחלצים מאיפה שהצלחנו להגיע
|
|
56
|
+
}
|
|
57
|
+
const frame = await frameHandle.contentFrame();
|
|
58
|
+
if (frame) {
|
|
59
|
+
currentContext = frame;
|
|
60
|
+
successfulPath.push(selector); // שומרים את ה-Breadcrumb
|
|
61
|
+
console.log(`[DOM-EXTRACT] 🌐 Successfully entered context: ${selector}`);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const dom = await DOMUtils._evaluateNeighborhood(currentContext, targetSelector);
|
|
68
|
+
return { dom, successfulPath };
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
console.error(`[DOM-EXTRACT] ⚠️ Critical error: ${e.message}`);
|
|
72
|
+
return {
|
|
73
|
+
dom: await DOMUtils._evaluateNeighborhood(page, targetSelector),
|
|
74
|
+
successfulPath: [],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Runs the neighborhood-DOM extraction script inside the given execution
|
|
80
|
+
* context (either a Page or a Frame).
|
|
81
|
+
*/
|
|
82
|
+
static async _evaluateNeighborhood(context, selector) {
|
|
83
|
+
console.log(`[DOM-EXTRACT] 🧠 Force-Extracting full context DOM for: "${selector}"`);
|
|
84
|
+
const result = await context.evaluate(() => {
|
|
85
|
+
let indexCounter = 0;
|
|
86
|
+
const processNode = (node) => {
|
|
87
|
+
// 1. טיפול בטקסט
|
|
88
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
89
|
+
const text = node.textContent?.trim();
|
|
90
|
+
return text ? text : null;
|
|
91
|
+
}
|
|
92
|
+
// 2. סינון אלמנטים לא רלוונטיים
|
|
93
|
+
if (node.nodeType !== Node.ELEMENT_NODE &&
|
|
94
|
+
!(node instanceof ShadowRoot))
|
|
95
|
+
return null;
|
|
96
|
+
const el = node instanceof ShadowRoot
|
|
97
|
+
? node.host
|
|
98
|
+
: node;
|
|
99
|
+
const tag = node instanceof ShadowRoot ? "shadow-root" : el.tagName.toLowerCase();
|
|
100
|
+
if (["script", "style", "link", "svg"].includes(tag))
|
|
101
|
+
return null;
|
|
102
|
+
// 3. איסוף אטריביוטים
|
|
103
|
+
const attrs = [];
|
|
104
|
+
const preserved = [
|
|
105
|
+
"id",
|
|
106
|
+
"class",
|
|
107
|
+
"data-testid",
|
|
108
|
+
"name",
|
|
109
|
+
"role",
|
|
110
|
+
"src",
|
|
111
|
+
"srcdoc",
|
|
112
|
+
];
|
|
113
|
+
preserved.forEach((a) => {
|
|
114
|
+
const v = el.getAttribute?.(a);
|
|
115
|
+
if (v) {
|
|
116
|
+
// שומרים מספיק מ-srcdoc כדי שה-AI יזהה מה יש בפנים
|
|
117
|
+
const val = a === "srcdoc" ? v.substring(0, 200) : v;
|
|
118
|
+
attrs.push(`${a}="${val}"`);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
attrs.push(`fx-id="${indexCounter++}"`);
|
|
122
|
+
// 4. איסוף ילדים (כולל Shadow DOM)
|
|
123
|
+
const childrenArr = [];
|
|
124
|
+
if (el instanceof HTMLElement && el.shadowRoot) {
|
|
125
|
+
childrenArr.push(...Array.from(el.shadowRoot.childNodes));
|
|
126
|
+
}
|
|
127
|
+
childrenArr.push(...Array.from(node.childNodes));
|
|
128
|
+
// 5. עיבוד ילדים וטקסט פנימי
|
|
129
|
+
const childrenHtml = childrenArr
|
|
130
|
+
.map(processNode)
|
|
131
|
+
.filter(Boolean)
|
|
132
|
+
.join("");
|
|
133
|
+
// אם אין ילדים אבל יש טקסט (כמו בכפתור), ניקח אותו
|
|
134
|
+
const innerContent = childrenHtml || node.textContent?.trim() || "";
|
|
135
|
+
const attrStr = attrs.length > 0 ? " " + attrs.join(" ") : "";
|
|
136
|
+
return `<${tag}${attrStr}>${innerContent}</${tag}>`;
|
|
137
|
+
};
|
|
138
|
+
const root = document.body || document.documentElement;
|
|
139
|
+
return processNode(root) || "";
|
|
140
|
+
});
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
static getElementDNA = async (page, selector) => {
|
|
144
|
+
return await page
|
|
145
|
+
.locator(selector)
|
|
146
|
+
.first()
|
|
147
|
+
.evaluate((el) => {
|
|
148
|
+
const rect = el.getBoundingClientRect();
|
|
149
|
+
const style = window.getComputedStyle(el);
|
|
150
|
+
const neighbors = Array.from(el.parentElement?.children || [])
|
|
151
|
+
.filter((child) => child !== el)
|
|
152
|
+
.map((child) => child.innerText?.substring(0, 20))
|
|
153
|
+
.filter(Boolean);
|
|
154
|
+
return {
|
|
155
|
+
tagName: el.tagName,
|
|
156
|
+
text: el.innerText,
|
|
157
|
+
attributes: Object.fromEntries(Array.from(el.attributes).map((a) => [a.name, a.value])),
|
|
158
|
+
styles: {
|
|
159
|
+
backgroundColor: style.backgroundColor,
|
|
160
|
+
color: style.color,
|
|
161
|
+
display: style.display,
|
|
162
|
+
visibility: style.visibility,
|
|
163
|
+
},
|
|
164
|
+
rect: {
|
|
165
|
+
x: rect.x,
|
|
166
|
+
y: rect.y,
|
|
167
|
+
width: rect.width,
|
|
168
|
+
height: rect.height,
|
|
169
|
+
},
|
|
170
|
+
hierarchy: {
|
|
171
|
+
parentTag: el.parentElement?.tagName || "",
|
|
172
|
+
parentClass: el.parentElement?.className || "",
|
|
173
|
+
neighborTexts: neighbors,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
exports.DOMUtils = DOMUtils;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class StackUtils {
|
|
2
|
+
static getCallerInfo(stackOverride?: string): {
|
|
3
|
+
filePath: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
line: number;
|
|
6
|
+
column: number;
|
|
7
|
+
locationKey: string;
|
|
8
|
+
};
|
|
9
|
+
static getActionKey(testTitle: string, action: string, index: number): string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=StackUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackUtils.d.ts","sourceRoot":"","sources":["../../src/utils/StackUtils.ts"],"names":[],"mappings":"AAGA,qBAAa,UAAU;IACrB,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG;QAC5C,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;KACrB;IAmED,MAAM,CAAC,YAAY,CACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM;CA6BV"}
|
|
@@ -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,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,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sela-core",
|
|
3
|
+
"version": "1.0.0",
|
|
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
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"bin"
|
|
16
|
+
],
|
|
17
|
+
"bin": {
|
|
18
|
+
"sela": "bin/sela.js"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"sela": "tsx src/cli/index.ts",
|
|
22
|
+
"build": "tsc -p tsconfig.build.json",
|
|
23
|
+
"build:watch": "tsc -p tsconfig.build.json --watch",
|
|
24
|
+
"prepublishOnly": "npm run build",
|
|
25
|
+
"test": "npx playwright test demo.spec.ts --headed --retries=0",
|
|
26
|
+
"test-shadow": "npx playwright test shadow.spec.ts --headed --retries=0",
|
|
27
|
+
"test-core": "npx playwright test tests/Core/CoreExample.spec.ts --headed --retries=0",
|
|
28
|
+
"test-DNA": "npx playwright test tests/DnaSurvival/DnaSurvival.spec.ts --headed --retries=0",
|
|
29
|
+
"test-advanced": "npx playwright test tests/AdvancedLogic/AdvancedLogic.spec.ts --headed --retries=0",
|
|
30
|
+
"test-isolation": "npx playwright test tests/Isolation/Isolation.spec.ts --headed --retries=0",
|
|
31
|
+
"test-playwright-actions": "npx playwright test tests/PlaywrightActions/BasicActions/BasicActions.spec.ts --headed --retries=0",
|
|
32
|
+
"test-forms-actions": "npx playwright test tests/PlaywrightActions/FormsActions/FormsActions.spec.ts --headed --retries=0",
|
|
33
|
+
"test-locators-actions": "npx playwright test tests/PlaywrightActions/LocatorsActions/LocatorsActions.spec.ts --headed --retries=0",
|
|
34
|
+
"test-config": "npx playwright test tests/TestConfig/TestConfig.spec.ts --headed --retries=0",
|
|
35
|
+
"test-safety-guard": "npx playwright test tests/SafetyGuard/SafetyGuard.spec.ts --headed --retries=0",
|
|
36
|
+
"test-improve-methods": "npx playwright test tests/ImproveMethods/ImproveMethods.spec.ts --headed --retries=0",
|
|
37
|
+
"test-shadow-dom": "npx playwright test tests/ShadowDom/ShadowDom.spec.ts --headed --retries=0",
|
|
38
|
+
"test-ut": "npx vitest run tests/unit/DOMUtils.test.ts && npx jest tests/unit/StackUtils.test.ts"
|
|
39
|
+
},
|
|
40
|
+
"author": "",
|
|
41
|
+
"license": "ISC",
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@playwright/test": ">=1.40.0"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@anthropic-ai/sdk": "^0.80.0",
|
|
47
|
+
"axios": "^1.13.6",
|
|
48
|
+
"chalk": "^4.1.2",
|
|
49
|
+
"cli-table3": "^0.6.5",
|
|
50
|
+
"commander": "^14.0.3",
|
|
51
|
+
"dotenv": "^17.3.1",
|
|
52
|
+
"enquirer": "^2.4.1",
|
|
53
|
+
"ora": "^5.4.1",
|
|
54
|
+
"playwright": "^1.58.2",
|
|
55
|
+
"ts-morph": "^27.0.2"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@playwright/test": "^1.58.2",
|
|
59
|
+
"@types/jest": "^30.0.0",
|
|
60
|
+
"@types/node": "^25.6.0",
|
|
61
|
+
"jest": "^30.3.0",
|
|
62
|
+
"jsdom": "^29.0.1",
|
|
63
|
+
"ts-jest": "^29.4.6",
|
|
64
|
+
"tsx": "^4.21.0",
|
|
65
|
+
"vitest": "^4.1.1"
|
|
66
|
+
}
|
|
67
|
+
}
|