sela-core 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/ErrorHandler.d.ts +1 -1
- package/dist/cli/ErrorHandler.js +14 -14
- package/dist/cli/commands/bulk.d.ts +1 -1
- package/dist/cli/commands/bulk.d.ts.map +1 -1
- package/dist/cli/commands/bulk.js +51 -33
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +26 -18
- package/dist/cli/commands/showReport.d.ts +1 -1
- package/dist/cli/commands/showReport.d.ts.map +1 -1
- package/dist/cli/commands/showReport.js +12 -10
- package/dist/cli/commands/status.d.ts +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +8 -8
- package/dist/cli/commands/sync.d.ts +1 -1
- package/dist/cli/commands/sync.d.ts.map +1 -1
- package/dist/cli/commands/sync.js +38 -30
- package/dist/cli/index.js +9 -9
- package/dist/cli/ui/DnaTable.d.ts +1 -1
- package/dist/cli/ui/DnaTable.d.ts.map +1 -1
- package/dist/cli/ui/DnaTable.js +23 -16
- package/dist/cli/ui/RefactorWizard.d.ts +3 -3
- package/dist/cli/ui/RefactorWizard.d.ts.map +1 -1
- package/dist/cli/ui/RefactorWizard.js +108 -82
- package/dist/config/ConfigLoader.d.ts +2 -2
- package/dist/config/ConfigLoader.d.ts.map +1 -1
- package/dist/config/ConfigLoader.js +15 -15
- package/dist/config/DryRunGuard.d.ts +1 -1
- package/dist/config/DryRunGuard.js +7 -7
- package/dist/config/SelaConfig.d.ts +12 -16
- package/dist/config/SelaConfig.d.ts.map +1 -1
- package/dist/config/SelaConfig.js +32 -26
- package/dist/engine/HealingRegistry.d.ts +1 -1
- package/dist/engine/HealingRegistry.js +3 -3
- package/dist/engine/SelaEngine.d.ts +1 -1
- package/dist/engine/SelaEngine.d.ts.map +1 -1
- package/dist/engine/SelaEngine.js +63 -49
- package/dist/errors/SelaError.d.ts +0 -1
- package/dist/errors/SelaError.d.ts.map +1 -1
- package/dist/errors/SelaError.js +6 -7
- package/dist/fixtures/expectProxy.d.ts +1 -1
- package/dist/fixtures/expectProxy.js +11 -11
- package/dist/fixtures/index.js +14 -14
- package/dist/fixtures/proxyTag.d.ts +1 -1
- package/dist/fixtures/proxyTag.js +3 -3
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/reporter/SelaReporter.d.ts +45 -12
- package/dist/reporter/SelaReporter.d.ts.map +1 -1
- package/dist/reporter/SelaReporter.js +139 -39
- package/dist/services/ASTSourceUpdater.d.ts +3 -3
- package/dist/services/ASTSourceUpdater.d.ts.map +1 -1
- package/dist/services/ASTSourceUpdater.js +92 -68
- package/dist/services/ArgumentTypeAnalyzer.js +7 -7
- package/dist/services/BlastRadiusAnalyzer.d.ts.map +1 -1
- package/dist/services/BlastRadiusAnalyzer.js +5 -2
- package/dist/services/ChainValidator.js +22 -22
- package/dist/services/CrossFileHealer.js +7 -7
- package/dist/services/DefinitionTracer.d.ts +1 -1
- package/dist/services/DefinitionTracer.d.ts.map +1 -1
- package/dist/services/DefinitionTracer.js +28 -13
- package/dist/services/DnaEditorService.d.ts +2 -2
- package/dist/services/DnaEditorService.d.ts.map +1 -1
- package/dist/services/DnaEditorService.js +81 -62
- package/dist/services/DnaIndexService.d.ts +1 -1
- package/dist/services/DnaIndexService.d.ts.map +1 -1
- package/dist/services/DnaIndexService.js +14 -14
- package/dist/services/HealReportService.d.ts +6 -6
- package/dist/services/HealReportService.d.ts.map +1 -1
- package/dist/services/HealReportService.js +33 -29
- package/dist/services/HealingAdvisory.js +1 -1
- package/dist/services/HealingCacheService.d.ts +8 -8
- package/dist/services/HealingCacheService.d.ts.map +1 -1
- package/dist/services/HealingCacheService.js +24 -24
- package/dist/services/HealthReportService.d.ts +1 -1
- package/dist/services/HealthReportService.d.ts.map +1 -1
- package/dist/services/HealthReportService.js +25 -25
- package/dist/services/InitializerUpdater.js +2 -2
- package/dist/services/IntentAuditor.d.ts.map +1 -1
- package/dist/services/IntentAuditor.js +32 -21
- package/dist/services/InteractiveReview.d.ts +8 -17
- package/dist/services/InteractiveReview.d.ts.map +1 -1
- package/dist/services/InteractiveReview.js +31 -124
- package/dist/services/LLMService.d.ts +1 -1
- package/dist/services/LLMService.js +16 -16
- package/dist/services/PRAutomationService.d.ts +2 -2
- package/dist/services/PRAutomationService.d.ts.map +1 -1
- package/dist/services/PRAutomationService.js +43 -39
- package/dist/services/PendingPromptLedger.d.ts +2 -2
- package/dist/services/PendingPromptLedger.js +6 -6
- package/dist/services/ReportGenerator.d.ts +2 -2
- package/dist/services/ReportGenerator.d.ts.map +1 -1
- package/dist/services/ReportGenerator.js +5 -5
- package/dist/services/SafetyGuard.d.ts +3 -6
- package/dist/services/SafetyGuard.d.ts.map +1 -1
- package/dist/services/SafetyGuard.js +29 -106
- package/dist/services/SnapshotService.js +5 -5
- package/dist/services/SourceLinkService.d.ts +2 -2
- package/dist/services/SourceLinkService.d.ts.map +1 -1
- package/dist/services/SourceLinkService.js +31 -22
- package/dist/services/SourceUpdater.d.ts +1 -1
- package/dist/services/SourceUpdater.d.ts.map +1 -1
- package/dist/services/SourceUpdater.js +27 -26
- package/dist/services/TemplateDiffService.d.ts.map +1 -1
- package/dist/services/TemplateDiffService.js +18 -15
- package/dist/services/WorkspaceSnapshotService.d.ts +6 -6
- package/dist/services/WorkspaceSnapshotService.d.ts.map +1 -1
- package/dist/services/WorkspaceSnapshotService.js +10 -12
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/IsolatedDiff.d.ts +2 -2
- package/dist/utils/IsolatedDiff.d.ts.map +1 -1
- package/dist/utils/IsolatedDiff.js +13 -10
- package/package.json +2 -2
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
//
|
|
7
7
|
// Runs 5 sequential guards before any AST mutation occurs:
|
|
8
8
|
//
|
|
9
|
-
// [1] SchemaValidator
|
|
10
|
-
// [2] TypeFlowValidator
|
|
11
|
-
// [3] ReceiverValidator
|
|
12
|
-
// [4] PlacementValidator
|
|
13
|
-
// [5] SemanticUpgrader
|
|
9
|
+
// [1] SchemaValidator - required fields, no unknown segment types
|
|
10
|
+
// [2] TypeFlowValidator - tracks Locator|FrameLocator state
|
|
11
|
+
// [3] ReceiverValidator - root must match original chain's receiver
|
|
12
|
+
// [4] PlacementValidator - filter() / nth() / first() only after Locator
|
|
13
|
+
// [5] SemanticUpgrader - upgrades flat CSS to semantic where possible
|
|
14
14
|
//
|
|
15
15
|
// Each guard returns a ValidationResult. The pipeline short-circuits on
|
|
16
16
|
// the first REJECT, falling back to the original flat-CSS strategy.
|
|
@@ -139,7 +139,7 @@ const VALID_ARIA_ROLES = new Set([
|
|
|
139
139
|
"generic",
|
|
140
140
|
]);
|
|
141
141
|
// ─────────────────────────────────────────────────────────────────
|
|
142
|
-
// GUARD 1
|
|
142
|
+
// GUARD 1 - Schema Validator
|
|
143
143
|
// ─────────────────────────────────────────────────────────────────
|
|
144
144
|
function schemaValidate(segments) {
|
|
145
145
|
if (!Array.isArray(segments) || segments.length === 0) {
|
|
@@ -226,7 +226,7 @@ function schemaValidate(segments) {
|
|
|
226
226
|
return { valid: true };
|
|
227
227
|
}
|
|
228
228
|
// ─────────────────────────────────────────────────────────────────
|
|
229
|
-
// GUARD 2
|
|
229
|
+
// GUARD 2 - Type Flow Validator
|
|
230
230
|
//
|
|
231
231
|
// Simulates the chain execution, tracking whether the current
|
|
232
232
|
// expression is a Locator, FrameLocator, or Page/unknown.
|
|
@@ -266,13 +266,13 @@ function typeFlowValidate(segments, rootType) {
|
|
|
266
266
|
if (currentType === "FrameLocator") {
|
|
267
267
|
return {
|
|
268
268
|
valid: false,
|
|
269
|
-
reason: "chain ends on FrameLocator
|
|
269
|
+
reason: "chain ends on FrameLocator - assertions require a Locator at the end",
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
return { valid: true };
|
|
273
273
|
}
|
|
274
274
|
// ─────────────────────────────────────────────────────────────────
|
|
275
|
-
// GUARD 3
|
|
275
|
+
// GUARD 3 - Receiver Validator
|
|
276
276
|
//
|
|
277
277
|
// The first segment's effective receiver must be compatible with
|
|
278
278
|
// the original code's root receiver. Prevents `page.getByRole()`
|
|
@@ -284,14 +284,14 @@ function receiverValidate(segments, originalRootReceiver, proposedRootReceiver)
|
|
|
284
284
|
// If both are "page" or both are the same variable, we're fine
|
|
285
285
|
if (orig === proposed)
|
|
286
286
|
return { valid: true };
|
|
287
|
-
// "page" is a global receiver
|
|
287
|
+
// "page" is a global receiver - the AI sometimes proposes it even when
|
|
288
288
|
// the original chain was scoped. This is only acceptable if the original
|
|
289
289
|
// chain itself started from "page".
|
|
290
290
|
const PAGE_RECEIVERS = new Set(["page", "context", "browser"]);
|
|
291
291
|
if (PAGE_RECEIVERS.has(proposed) && !PAGE_RECEIVERS.has(orig)) {
|
|
292
292
|
return {
|
|
293
293
|
valid: false,
|
|
294
|
-
reason: `receiver mismatch: original chain rooted at "${orig}" but proposed chain starts from "${proposed}"
|
|
294
|
+
reason: `receiver mismatch: original chain rooted at "${orig}" but proposed chain starts from "${proposed}" - this would change element scope`,
|
|
295
295
|
};
|
|
296
296
|
}
|
|
297
297
|
// If the original root is a local variable and proposed is different,
|
|
@@ -299,14 +299,14 @@ function receiverValidate(segments, originalRootReceiver, proposedRootReceiver)
|
|
|
299
299
|
// We allow this since sometimes variables are renamed but semantically
|
|
300
300
|
// equivalent.
|
|
301
301
|
if (!PAGE_RECEIVERS.has(orig) && !PAGE_RECEIVERS.has(proposed)) {
|
|
302
|
-
// Both are custom variables
|
|
303
|
-
console.warn(`[ChainValidator] ⚠️ Receiver mismatch: "${orig}" vs "${proposed}"
|
|
302
|
+
// Both are custom variables - trust the AI's context
|
|
303
|
+
console.warn(`[ChainValidator] ⚠️ Receiver mismatch: "${orig}" vs "${proposed}" - proceeding cautiously`);
|
|
304
304
|
return { valid: true };
|
|
305
305
|
}
|
|
306
306
|
return { valid: true };
|
|
307
307
|
}
|
|
308
308
|
// ─────────────────────────────────────────────────────────────────
|
|
309
|
-
// GUARD 4
|
|
309
|
+
// GUARD 4 - Placement Validator
|
|
310
310
|
//
|
|
311
311
|
// Validates placement-sensitive rules:
|
|
312
312
|
// - filter/first/last/nth must follow a Locator-producing segment
|
|
@@ -322,7 +322,7 @@ function placementValidate(segments) {
|
|
|
322
322
|
if (prev.type === "frameLocator") {
|
|
323
323
|
return {
|
|
324
324
|
valid: false,
|
|
325
|
-
reason: `segment[${i}] .${seg.type}() placed immediately after frameLocator()
|
|
325
|
+
reason: `segment[${i}] .${seg.type}() placed immediately after frameLocator() - invalid`,
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
328
|
}
|
|
@@ -335,7 +335,7 @@ function placementValidate(segments) {
|
|
|
335
335
|
if (!hasAnyPredicate) {
|
|
336
336
|
return {
|
|
337
337
|
valid: false,
|
|
338
|
-
reason: `segment[${i}] filter() has all-empty predicates
|
|
338
|
+
reason: `segment[${i}] filter() has all-empty predicates - would be a no-op`,
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
341
|
}
|
|
@@ -343,16 +343,16 @@ function placementValidate(segments) {
|
|
|
343
343
|
return { valid: true };
|
|
344
344
|
}
|
|
345
345
|
// ─────────────────────────────────────────────────────────────────
|
|
346
|
-
// GUARD 5
|
|
346
|
+
// GUARD 5 - Semantic Upgrader
|
|
347
347
|
//
|
|
348
348
|
// Opportunistically upgrades flat CSS locator segments to semantic
|
|
349
349
|
// equivalents following Playwright's priority hierarchy:
|
|
350
350
|
// 1. getByTestId (data-testid)
|
|
351
351
|
// 2. getByRole (aria role inference from CSS)
|
|
352
352
|
// 3. getByLabel (form elements)
|
|
353
|
-
// 4. locator (CSS
|
|
353
|
+
// 4. locator (CSS - unchanged)
|
|
354
354
|
//
|
|
355
|
-
// This guard NEVER rejects
|
|
355
|
+
// This guard NEVER rejects - it only upgrades and returns the
|
|
356
356
|
// possibly-improved segments.
|
|
357
357
|
// ─────────────────────────────────────────────────────────────────
|
|
358
358
|
const ROLE_BY_TAG = {
|
|
@@ -396,12 +396,12 @@ function tryUpgradeToSemantic(seg) {
|
|
|
396
396
|
return { type: "getByRole", role };
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
// Priority 3b: button[type="submit"] or button.classname
|
|
399
|
+
// Priority 3b: button[type="submit"] or button.classname - still a button role
|
|
400
400
|
const buttonMatch = css.match(/^button(?:[.[#][^\s]*)?$/);
|
|
401
401
|
if (buttonMatch) {
|
|
402
402
|
return { type: "getByRole", role: "button" };
|
|
403
403
|
}
|
|
404
|
-
// Priority 4: has-text()
|
|
404
|
+
// Priority 4: has-text() - convert to getByText
|
|
405
405
|
const hasTextMatch = css.match(/^.*:has-text\(["']([^"']+)["']\)$/);
|
|
406
406
|
if (hasTextMatch) {
|
|
407
407
|
return { type: "getByText", text: hasTextMatch[1] };
|
|
@@ -506,7 +506,7 @@ class ChainValidator {
|
|
|
506
506
|
// Guard 2: Type flow
|
|
507
507
|
const effectiveRootType = rootType === "unknown" ? "Locator" : rootType;
|
|
508
508
|
// For Page-level (page.xxx), the root is not yet a Locator/FrameLocator
|
|
509
|
-
//
|
|
509
|
+
// - we treat the first segment as the producer.
|
|
510
510
|
const isPageReceiver = originalRootReceiver === "page" ||
|
|
511
511
|
originalRootReceiver === "context" ||
|
|
512
512
|
originalRootReceiver === "browser";
|
|
@@ -45,12 +45,12 @@ const InitializerUpdater_js_1 = require("./InitializerUpdater.js");
|
|
|
45
45
|
// then delegates mutation to InitializerUpdater.
|
|
46
46
|
//
|
|
47
47
|
// Entry point: CrossFileHealer.heal()
|
|
48
|
-
// modulePath
|
|
49
|
-
// symbolName
|
|
50
|
-
// oldValue
|
|
51
|
-
// newValue
|
|
52
|
-
// callerFilePath
|
|
53
|
-
// project
|
|
48
|
+
// modulePath - the import specifier string (e.g. "./constants")
|
|
49
|
+
// symbolName - the exported identifier name (e.g. "SHARED_SEL")
|
|
50
|
+
// oldValue - the current string value (used for verification)
|
|
51
|
+
// newValue - the replacement value
|
|
52
|
+
// callerFilePath - absolute path of the file containing the import
|
|
53
|
+
// project - the shared ASTSourceUpdater Project instance
|
|
54
54
|
// ═══════════════════════════════════════════════════════════════════
|
|
55
55
|
const DEPTH_GUARD = 3;
|
|
56
56
|
class CrossFileHealer {
|
|
@@ -91,7 +91,7 @@ class CrossFileHealer {
|
|
|
91
91
|
if (!traceResult.found) {
|
|
92
92
|
// Follow re-export chains (barrel files).
|
|
93
93
|
if (traceResult.crossFile) {
|
|
94
|
-
console.log(`[CrossFileHealer] 🔄 "${symbolName}" re-exported from "${traceResult.modulePath}"
|
|
94
|
+
console.log(`[CrossFileHealer] 🔄 "${symbolName}" re-exported from "${traceResult.modulePath}" - following chain`);
|
|
95
95
|
return CrossFileHealer.heal(traceResult.modulePath, traceResult.symbolName, newValue, externalPath, project, depth + 1);
|
|
96
96
|
}
|
|
97
97
|
return {
|
|
@@ -3,7 +3,7 @@ export type TraceResult = {
|
|
|
3
3
|
found: true;
|
|
4
4
|
targetNode: Node;
|
|
5
5
|
targetFile: SourceFile;
|
|
6
|
-
/** The enclosing VariableDeclaration or PropertyAssignment
|
|
6
|
+
/** The enclosing VariableDeclaration or PropertyAssignment - used by BlastRadiusAnalyzer. */
|
|
7
7
|
declarationNode?: Node;
|
|
8
8
|
} | {
|
|
9
9
|
found: false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefinitionTracer.d.ts","sourceRoot":"","sources":["../../src/services/DefinitionTracer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EAKV,aAAa,EACb,6BAA6B,EAC7B,kBAAkB,EAGnB,MAAM,UAAU,CAAC;AAMlB,MAAM,MAAM,WAAW,GACnB;IACE,KAAK,EAAE,IAAI,CAAC;IACZ,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,6FAA6F;IAC7F,eAAe,CAAC,EAAE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;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAC1B;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,kBAAkB,CAAC;IACjC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,YAAY,EAAE,UAAU,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,aAAa,GAAG,6BAA6B,CAAC;IAC3D,YAAY,EAAE,UAAU,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB,GACD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAcxC,qBAAa,gBAAgB;IAK3B,MAAM,CAAC,eAAe,CACpB,cAAc,EAAE,IAAI,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,KAAK,SAAI,GACR,WAAW;IA0Fd,MAAM,CAAC,mBAAmB,CACxB,cAAc,EAAE,IAAI,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,GACjB,WAAW;IA+Ed,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,WAAW;CAkC5E;AASD,qBAAa,wBAAwB;IACnC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,kBAAkB;CAmF3E"}
|
|
@@ -5,8 +5,8 @@ const ts_morph_1 = require("ts-morph");
|
|
|
5
5
|
// ═══════════════════════════════════════════════════════════════════
|
|
6
6
|
// DefinitionTracer
|
|
7
7
|
//
|
|
8
|
-
// T-5: traceIdentifier
|
|
9
|
-
// T-6: tracePropertyAccess
|
|
8
|
+
// T-5: traceIdentifier - follow bare variable name to its initializer.
|
|
9
|
+
// T-6: tracePropertyAccess - follow OBJECT.prop to the property value.
|
|
10
10
|
//
|
|
11
11
|
// In-file first; signals crossFile when symbol comes from an import.
|
|
12
12
|
// Never does I/O beyond what ts-morph provides on the given SourceFile.
|
|
@@ -42,9 +42,14 @@ class DefinitionTracer {
|
|
|
42
42
|
}
|
|
43
43
|
console.log(`[DefinitionTracer] ✅ traceIdentifier: "${symbolName}" → ` +
|
|
44
44
|
`${init.getKindName()} @ ${sourceFile.getBaseName()}:${init.getStartLineNumber()}`);
|
|
45
|
-
return {
|
|
45
|
+
return {
|
|
46
|
+
found: true,
|
|
47
|
+
targetNode: init,
|
|
48
|
+
targetFile: sourceFile,
|
|
49
|
+
declarationNode: decl,
|
|
50
|
+
};
|
|
46
51
|
}
|
|
47
|
-
// 2. Symbol not in file
|
|
52
|
+
// 2. Symbol not in file - check import declarations.
|
|
48
53
|
const imported = findImportedSymbol(sourceFile, symbolName);
|
|
49
54
|
if (imported) {
|
|
50
55
|
console.log(`[DefinitionTracer] 🌐 traceIdentifier: "${symbolName}" comes from "${imported.modulePath}" (cross-file)`);
|
|
@@ -71,7 +76,7 @@ class DefinitionTracer {
|
|
|
71
76
|
}
|
|
72
77
|
}
|
|
73
78
|
catch {
|
|
74
|
-
// Language service unavailable
|
|
79
|
+
// Language service unavailable - not an error.
|
|
75
80
|
}
|
|
76
81
|
return {
|
|
77
82
|
found: false,
|
|
@@ -115,7 +120,7 @@ class DefinitionTracer {
|
|
|
115
120
|
reason: `"${objectName}" initializer is not an ObjectLiteralExpression (got ${init?.getKindName() ?? "none"})`,
|
|
116
121
|
};
|
|
117
122
|
}
|
|
118
|
-
// ts-morph getProperty(name)
|
|
123
|
+
// ts-morph getProperty(name) - returns the first matching property.
|
|
119
124
|
const prop = init.getProperty(propName);
|
|
120
125
|
if (!prop || !ts_morph_1.Node.isPropertyAssignment(prop)) {
|
|
121
126
|
return {
|
|
@@ -135,10 +140,15 @@ class DefinitionTracer {
|
|
|
135
140
|
console.log(`[DefinitionTracer] ✅ tracePropertyAccess: "${objectName}.${propName}" → ` +
|
|
136
141
|
`${valueNode.getKindName()} "${valueNode.getText()}" ` +
|
|
137
142
|
`@ ${sourceFile.getBaseName()}:${valueNode.getStartLineNumber()}`);
|
|
138
|
-
return {
|
|
143
|
+
return {
|
|
144
|
+
found: true,
|
|
145
|
+
targetNode: valueNode,
|
|
146
|
+
targetFile: sourceFile,
|
|
147
|
+
declarationNode: prop,
|
|
148
|
+
};
|
|
139
149
|
}
|
|
140
150
|
// ─────────────────────────────────────────────────────────────────
|
|
141
|
-
// traceByName
|
|
151
|
+
// traceByName - used by CrossFileHealer
|
|
142
152
|
//
|
|
143
153
|
// Like traceIdentifier but takes a plain symbol name string instead
|
|
144
154
|
// of an Identifier node. Searches the entire file (no callerLine
|
|
@@ -166,7 +176,12 @@ class DefinitionTracer {
|
|
|
166
176
|
}
|
|
167
177
|
console.log(`[DefinitionTracer] ✅ traceByName: "${symbolName}" → ` +
|
|
168
178
|
`${init.getKindName()} @ ${sourceFile.getBaseName()}:${init.getStartLineNumber()}`);
|
|
169
|
-
return {
|
|
179
|
+
return {
|
|
180
|
+
found: true,
|
|
181
|
+
targetNode: init,
|
|
182
|
+
targetFile: sourceFile,
|
|
183
|
+
declarationNode: decl,
|
|
184
|
+
};
|
|
170
185
|
}
|
|
171
186
|
}
|
|
172
187
|
exports.DefinitionTracer = DefinitionTracer;
|
|
@@ -241,7 +256,7 @@ class FunctionalReturnAnalyzer {
|
|
|
241
256
|
}
|
|
242
257
|
return {
|
|
243
258
|
kind: "complex",
|
|
244
|
-
reason: `"${calleeName}" return expression is ${returnExpr.getKindName()}
|
|
259
|
+
reason: `"${calleeName}" return expression is ${returnExpr.getKindName()} - not directly healable`,
|
|
245
260
|
};
|
|
246
261
|
}
|
|
247
262
|
}
|
|
@@ -316,7 +331,7 @@ function findFunctionBody(sourceFile, fnName) {
|
|
|
316
331
|
const arrow = init;
|
|
317
332
|
const params = arrow.getParameters().map((p) => p.getName());
|
|
318
333
|
const body = arrow.getBody();
|
|
319
|
-
// Concise body: (role) => `...`
|
|
334
|
+
// Concise body: (role) => `...` - body IS the return expression.
|
|
320
335
|
if (!ts_morph_1.Node.isBlock(body)) {
|
|
321
336
|
return { returnExpr: body, params, line: decl.getStartLineNumber() };
|
|
322
337
|
}
|
|
@@ -338,13 +353,13 @@ function findFunctionBody(sourceFile, fnName) {
|
|
|
338
353
|
return null;
|
|
339
354
|
}
|
|
340
355
|
function extractReturnExpression(body) {
|
|
341
|
-
// Concise arrow body
|
|
356
|
+
// Concise arrow body - the node itself is the return value.
|
|
342
357
|
if (!ts_morph_1.Node.isBlock(body))
|
|
343
358
|
return body;
|
|
344
359
|
// Block body: search for ReturnStatement.
|
|
345
360
|
const returnStmts = body.getDescendantsOfKind(ts_morph_1.SyntaxKind.ReturnStatement);
|
|
346
361
|
if (returnStmts.length === 0)
|
|
347
362
|
return null;
|
|
348
|
-
// Use the first one
|
|
363
|
+
// Use the first one - for conditional returns we signal COMPLEX upstream.
|
|
349
364
|
return returnStmts[0].getExpression() ?? null;
|
|
350
365
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ElementSnapshotV2 } from
|
|
1
|
+
import type { ElementSnapshotV2 } from "../types/index.js";
|
|
2
2
|
export interface ValidationResult {
|
|
3
3
|
valid: boolean;
|
|
4
4
|
errors: string[];
|
|
@@ -9,7 +9,7 @@ export interface DnaSnapshotExtended extends ElementSnapshotV2 {
|
|
|
9
9
|
sourceFile?: string;
|
|
10
10
|
sourceLine?: number;
|
|
11
11
|
lastHealed?: string | null;
|
|
12
|
-
status?:
|
|
12
|
+
status?: "healed" | "broken";
|
|
13
13
|
originalSelector?: string;
|
|
14
14
|
healedSelector?: string;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnaEditorService.d.ts","sourceRoot":"","sources":["../../src/services/DnaEditorService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAID,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB,CAAC;CAChD;
|
|
1
|
+
{"version":3,"file":"DnaEditorService.d.ts","sourceRoot":"","sources":["../../src/services/DnaEditorService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,WAAW,gBAAgB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"}
|
|
@@ -17,14 +17,14 @@ function bakPath(dir, key) {
|
|
|
17
17
|
}
|
|
18
18
|
// Derive a best-effort selector from engine snapshot fields when none is stored.
|
|
19
19
|
function deriveSelector(snap) {
|
|
20
|
-
const id = snap[
|
|
21
|
-
const classes = snap[
|
|
22
|
-
const tagName = snap[
|
|
23
|
-
if (typeof id ===
|
|
20
|
+
const id = snap["id"];
|
|
21
|
+
const classes = snap["classes"];
|
|
22
|
+
const tagName = snap["tagName"];
|
|
23
|
+
if (typeof id === "string" && id)
|
|
24
24
|
return `#${id}`;
|
|
25
25
|
if (Array.isArray(classes) && classes.length > 0)
|
|
26
|
-
return `.${classes.join(
|
|
27
|
-
return typeof tagName ===
|
|
26
|
+
return `.${classes.join(".")}`;
|
|
27
|
+
return typeof tagName === "string" ? tagName : "unknown";
|
|
28
28
|
}
|
|
29
29
|
function dnaError(message, code) {
|
|
30
30
|
const err = new Error(message);
|
|
@@ -40,15 +40,15 @@ class DnaEditorService {
|
|
|
40
40
|
const target = jsonPath(this.snapshotDir, key);
|
|
41
41
|
let raw;
|
|
42
42
|
try {
|
|
43
|
-
raw = await promises_1.default.readFile(target,
|
|
43
|
+
raw = await promises_1.default.readFile(target, "utf-8");
|
|
44
44
|
}
|
|
45
45
|
catch {
|
|
46
|
-
throw dnaError(`DNA not found: ${key}`,
|
|
46
|
+
throw dnaError(`DNA not found: ${key}`, "DNA_NOT_FOUND");
|
|
47
47
|
}
|
|
48
48
|
const parsed = JSON.parse(raw);
|
|
49
49
|
// Promote to extended format if selector not stored
|
|
50
|
-
if (!parsed[
|
|
51
|
-
parsed[
|
|
50
|
+
if (!parsed["selector"]) {
|
|
51
|
+
parsed["selector"] = deriveSelector(parsed);
|
|
52
52
|
}
|
|
53
53
|
return parsed;
|
|
54
54
|
}
|
|
@@ -59,22 +59,25 @@ class DnaEditorService {
|
|
|
59
59
|
// 1. Read existing snapshot
|
|
60
60
|
const original = await this.read(key);
|
|
61
61
|
// 2. Shallow-merge patch (arrays and objects replaced, not deep-merged)
|
|
62
|
-
const merged = {
|
|
62
|
+
const merged = {
|
|
63
|
+
...original,
|
|
64
|
+
...patch,
|
|
65
|
+
};
|
|
63
66
|
// Any CLI write = human has reviewed the DNA → clear auto-heal status flag.
|
|
64
|
-
delete merged[
|
|
65
|
-
// 3. Derive selector only when absent
|
|
66
|
-
if (merged[
|
|
67
|
-
merged[
|
|
67
|
+
delete merged["status"];
|
|
68
|
+
// 3. Derive selector only when absent - never override an explicit (possibly invalid) value
|
|
69
|
+
if (merged["selector"] == null) {
|
|
70
|
+
merged["selector"] = deriveSelector(merged);
|
|
68
71
|
}
|
|
69
72
|
// 4. Validate before touching disk
|
|
70
73
|
const validation = this.validate(merged);
|
|
71
74
|
if (!validation.valid) {
|
|
72
|
-
throw dnaError(`Validation failed for ${key}: ${validation.errors.join(
|
|
75
|
+
throw dnaError(`Validation failed for ${key}: ${validation.errors.join("; ")}`, "VALIDATION_FAILED");
|
|
73
76
|
}
|
|
74
77
|
// 5. Backup current file (overwrite previous bak)
|
|
75
|
-
await promises_1.default.writeFile(bak, JSON.stringify(original, null, 2),
|
|
78
|
+
await promises_1.default.writeFile(bak, JSON.stringify(original, null, 2), "utf-8");
|
|
76
79
|
// 6. Write to tmp
|
|
77
|
-
await promises_1.default.writeFile(tmp, JSON.stringify(merged, null, 2),
|
|
80
|
+
await promises_1.default.writeFile(tmp, JSON.stringify(merged, null, 2), "utf-8");
|
|
78
81
|
// 7. Atomic rename tmp → json
|
|
79
82
|
await promises_1.default.rename(tmp, target);
|
|
80
83
|
return bak;
|
|
@@ -86,111 +89,127 @@ class DnaEditorService {
|
|
|
86
89
|
await promises_1.default.access(bak);
|
|
87
90
|
}
|
|
88
91
|
catch {
|
|
89
|
-
throw dnaError(`No backup found for: ${key}`,
|
|
92
|
+
throw dnaError(`No backup found for: ${key}`, "DNA_NOT_FOUND");
|
|
90
93
|
}
|
|
91
94
|
await promises_1.default.rename(bak, target);
|
|
92
95
|
}
|
|
93
96
|
validate(candidate) {
|
|
94
97
|
const errors = [];
|
|
95
|
-
if (typeof candidate !==
|
|
96
|
-
|
|
98
|
+
if (typeof candidate !== "object" ||
|
|
99
|
+
candidate === null ||
|
|
100
|
+
Array.isArray(candidate)) {
|
|
101
|
+
return { valid: false, errors: ["candidate must be a plain object"] };
|
|
97
102
|
}
|
|
98
103
|
const snap = candidate;
|
|
99
104
|
// ── Required top-level fields ─────────────────────────────────────────────
|
|
100
|
-
for (const field of [
|
|
105
|
+
for (const field of [
|
|
106
|
+
"tagName",
|
|
107
|
+
"selector",
|
|
108
|
+
"schemaVersion",
|
|
109
|
+
"timestamp",
|
|
110
|
+
]) {
|
|
101
111
|
if (!(field in snap) || snap[field] === undefined) {
|
|
102
112
|
errors.push(`Missing required field: ${field}`);
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
|
-
if (snap[
|
|
106
|
-
errors.push(`schemaVersion must be 2, got ${String(snap[
|
|
115
|
+
if (snap["schemaVersion"] !== 2) {
|
|
116
|
+
errors.push(`schemaVersion must be 2, got ${String(snap["schemaVersion"])}`);
|
|
107
117
|
}
|
|
108
118
|
// ── selector ─────────────────────────────────────────────────────────────
|
|
109
|
-
const sel = snap[
|
|
110
|
-
if (typeof sel ===
|
|
111
|
-
if (sel.trim() ===
|
|
112
|
-
errors.push(
|
|
113
|
-
if (sel ===
|
|
119
|
+
const sel = snap["selector"];
|
|
120
|
+
if (typeof sel === "string") {
|
|
121
|
+
if (sel.trim() === "")
|
|
122
|
+
errors.push("selector must not be empty");
|
|
123
|
+
if (sel === "undefined")
|
|
114
124
|
errors.push('selector must not be the string "undefined"');
|
|
115
125
|
if (/[\r\n]/.test(sel))
|
|
116
|
-
errors.push(
|
|
126
|
+
errors.push("selector must not contain raw newlines");
|
|
117
127
|
}
|
|
118
|
-
else if (
|
|
119
|
-
errors.push(
|
|
128
|
+
else if ("selector" in snap) {
|
|
129
|
+
errors.push("selector must be a string");
|
|
120
130
|
}
|
|
121
131
|
// ── tagName ───────────────────────────────────────────────────────────────
|
|
122
|
-
const tag = snap[
|
|
123
|
-
if (typeof tag ===
|
|
132
|
+
const tag = snap["tagName"];
|
|
133
|
+
if (typeof tag === "string") {
|
|
124
134
|
if (!/^[a-z][a-z0-9-]*$/.test(tag)) {
|
|
125
|
-
errors.push(
|
|
135
|
+
errors.push("tagName must match /^[a-z][a-z0-9-]*$/");
|
|
126
136
|
}
|
|
127
137
|
}
|
|
128
|
-
else if (
|
|
129
|
-
errors.push(
|
|
138
|
+
else if ("tagName" in snap) {
|
|
139
|
+
errors.push("tagName must be a string");
|
|
130
140
|
}
|
|
131
141
|
// ── text ─────────────────────────────────────────────────────────────────
|
|
132
|
-
const text = snap[
|
|
142
|
+
const text = snap["text"];
|
|
133
143
|
if (text !== null && text !== undefined) {
|
|
134
|
-
if (typeof text !==
|
|
135
|
-
errors.push(
|
|
144
|
+
if (typeof text !== "string") {
|
|
145
|
+
errors.push("text must be a string or null");
|
|
136
146
|
}
|
|
137
147
|
else if (text.length >= 2000) {
|
|
138
|
-
errors.push(
|
|
148
|
+
errors.push("text must be fewer than 2000 characters");
|
|
139
149
|
}
|
|
140
150
|
}
|
|
141
151
|
// ── attributes ───────────────────────────────────────────────────────────
|
|
142
|
-
const attrs = snap[
|
|
152
|
+
const attrs = snap["attributes"];
|
|
143
153
|
if (attrs !== undefined) {
|
|
144
|
-
if (typeof attrs !==
|
|
145
|
-
errors.push(
|
|
154
|
+
if (typeof attrs !== "object" || attrs === null || Array.isArray(attrs)) {
|
|
155
|
+
errors.push("attributes must be a plain object");
|
|
146
156
|
}
|
|
147
157
|
else {
|
|
148
158
|
for (const [k, v] of Object.entries(attrs)) {
|
|
149
159
|
if (!k)
|
|
150
|
-
errors.push(
|
|
151
|
-
if (typeof v !==
|
|
160
|
+
errors.push("attributes keys must not be empty");
|
|
161
|
+
if (typeof v !== "string")
|
|
152
162
|
errors.push(`attributes["${k}"] must be a string`);
|
|
153
163
|
}
|
|
154
164
|
}
|
|
155
165
|
}
|
|
156
166
|
// ── visibility (all 4 keys required) ─────────────────────────────────────
|
|
157
|
-
const vis = snap[
|
|
158
|
-
if (typeof vis ===
|
|
167
|
+
const vis = snap["visibility"];
|
|
168
|
+
if (typeof vis === "object" && vis !== null && !Array.isArray(vis)) {
|
|
159
169
|
const visObj = vis;
|
|
160
|
-
for (const key of [
|
|
170
|
+
for (const key of [
|
|
171
|
+
"isGhost",
|
|
172
|
+
"ghostReason",
|
|
173
|
+
"isOccluded",
|
|
174
|
+
"opacity",
|
|
175
|
+
]) {
|
|
161
176
|
if (!(key in visObj))
|
|
162
177
|
errors.push(`visibility.${key} is required`);
|
|
163
178
|
}
|
|
164
179
|
}
|
|
165
180
|
else {
|
|
166
|
-
errors.push(
|
|
181
|
+
errors.push("visibility block is required and must be an object");
|
|
167
182
|
}
|
|
168
183
|
// ── anchors (all 3 keys required) ────────────────────────────────────────
|
|
169
|
-
const anch = snap[
|
|
170
|
-
if (typeof anch ===
|
|
184
|
+
const anch = snap["anchors"];
|
|
185
|
+
if (typeof anch === "object" && anch !== null && !Array.isArray(anch)) {
|
|
171
186
|
const anchObj = anch;
|
|
172
|
-
for (const key of [
|
|
187
|
+
for (const key of [
|
|
188
|
+
"closestLabel",
|
|
189
|
+
"rowAnchor",
|
|
190
|
+
"neighborTexts",
|
|
191
|
+
]) {
|
|
173
192
|
if (!(key in anchObj))
|
|
174
193
|
errors.push(`anchors.${key} is required`);
|
|
175
194
|
}
|
|
176
|
-
const cl = anchObj[
|
|
177
|
-
if (cl !== null && typeof cl !==
|
|
178
|
-
errors.push(
|
|
195
|
+
const cl = anchObj["closestLabel"];
|
|
196
|
+
if (cl !== null && typeof cl !== "string") {
|
|
197
|
+
errors.push("anchors.closestLabel must be a string or null");
|
|
179
198
|
}
|
|
180
|
-
const nt = anchObj[
|
|
199
|
+
const nt = anchObj["neighborTexts"];
|
|
181
200
|
if (!Array.isArray(nt)) {
|
|
182
|
-
errors.push(
|
|
201
|
+
errors.push("anchors.neighborTexts must be an array");
|
|
183
202
|
}
|
|
184
203
|
else {
|
|
185
204
|
if (nt.length > 10)
|
|
186
|
-
errors.push(
|
|
187
|
-
if (!nt.every((x) => typeof x ===
|
|
188
|
-
errors.push(
|
|
205
|
+
errors.push("anchors.neighborTexts must have at most 10 elements");
|
|
206
|
+
if (!nt.every((x) => typeof x === "string")) {
|
|
207
|
+
errors.push("anchors.neighborTexts elements must all be strings");
|
|
189
208
|
}
|
|
190
209
|
}
|
|
191
210
|
}
|
|
192
211
|
else {
|
|
193
|
-
errors.push(
|
|
212
|
+
errors.push("anchors block is required and must be an object");
|
|
194
213
|
}
|
|
195
214
|
return { valid: errors.length === 0, errors };
|
|
196
215
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnaIndexService.d.ts","sourceRoot":"","sources":["../../src/services/DnaIndexService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAatD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,CAAC;IAC7C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,CAAC;IACzC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,CAAC;IAChD,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,CAAC;IAC9C,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACxC,QAAQ,IAAI,QAAQ,CAAC;IACrB,OAAO,IAAI,IAAI,CAAC;CACjB;AAkED,qBAAa,eAAgB,YAAW,gBAAgB;IACtD,OAAO,CAAC,WAAW,CAAyB;IAEtC,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;
|
|
1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